@graphysdk/viz-engine 1.9.0-beta.1789467548664 → 1.9.0-beta.1789480282040

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
@@ -18,7 +18,7 @@ npm install @graphysdk/viz-engine
18
18
  import { createSpec, pipe, geom, scale, createCompiler } from '@graphysdk/viz-engine';
19
19
 
20
20
  const input = pipe(createSpec({ x: 'month', y: 'revenue' }), geom.bar(), scale.x(), scale.y());
21
- const { compiled } = createCompiler().compile({ input, data });
21
+ const { scene } = createCompiler().compile({ input, data });
22
22
  ```
23
23
 
24
24
  ## Docs
@@ -1 +1 @@
1
- let y=require("date-fns"),Me=require("lodash-es");var Tt=e=>e.length>0;function ne(e){return e!=null}function _t(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}var Y=e=>e instanceof Date&&(0,y.isValid)(e),Mt=e=>Y(e)||e===null,Lt=e=>typeof e=="string",Le=e=>typeof e=="number"&&!Number.isNaN(e)&&Number.isFinite(e),Dt=e=>Le(e)||e===null,De="\0graphy\0_",m=e=>`${De}${e}`,ae={x:m("constantX")},St={bar:m("barSeriesLabel"),line:m("lineSeriesLabel")},oe={count:m("count"),mean:m("mean"),sum:m("sum")},Se={group:m("group")},Fe={x:m("x"),y:m("y"),xMin:m("xMin"),xMax:m("xMax"),yMin:m("yMin"),yMax:m("yMax"),yRaw:m("yRaw")},Pe={role:m("stackRole")},Re={color:m("color"),size:m("size"),alpha:m("alpha"),strokeWidth:m("strokeWidth"),lineType:m("lineType")},Ne={y:m("ruleY"),x:m("ruleX")},ca={...ae,...oe,...Se,...Fe,...Pe,...Re,...Ne},Ft=new Set(Object.values(oe)),Pt=e=>m(`scaled_${e}`),Rt=e=>e.startsWith(De),Nt=e=>Ft.has(e);function wt(e){const{numeric:t,categorical:r,temporal:n}=e.groupVariableNamesByType();return n[0]??r[0]??t[0]??""}function It(e,t){const{categorical:r,temporal:n}=e.groupVariableNamesByType(),a=[...r,...n];return t===""||a.includes(t)?a:[t,...a]}function kt(e){const t=ie(e.x);return t===null||t===ae.x?"":t}function ie(e){return ne(e)?typeof e=="string"?e:"variable"in e?e.variable:null:null}function we(e){if(!(!ne(e)||typeof e=="string")&&"value"in e)return e.value}function jt(e,t){return[...new Set([...Object.keys(e),...Object.keys(t)])].every(r=>de(e[r])===de(t[r]))}function de(e){const t=ie(e);if(t!==null)return`variable:${t}`;const r=we(e);return r===void 0?"":r===null?"value:null":r instanceof Date?`value:date:${r.getTime()}`:`value:${typeof r}:${r}`}var X="en-GB",se=class extends Error{constructor(e){super(e.message,e.cause!==void 0?{cause:e.cause}:void 0),this.name=new.target.name,this.code=e.code,this.context=e.context,this.suggestion=e.suggestion}},V=class extends se{constructor(e){super(e),this.kind="user-input"}},E=class extends se{constructor(e){super({...e,code:e.code??"INTERNAL_INVARIANT"}),this.kind="internal"}},le=e=>e.type==="lookup",Ie=e=>e.type==="text",j=e=>e.type==="date"||e.type==="datetime"||e.type==="year"||e.type==="month_year"||e.type==="month"||e.type==="day_month"||e.type==="weekly_date_range"||e.type==="weekly_date_range_with_year"||e.type==="quarter"||e.type==="time",ke=e=>e.type==="decimal"||e.type==="integer"||e.type==="percentage"||e.type==="duration"||e.type==="currency",Ct=e=>e.type==="currency",xt=e=>e.type==="month"||e.type==="day_month"||e.type==="weekly_date_range",je=e=>{if(le(e))return je(e.fallback);if(j(e))return"temporal";if(ke(e))return"numeric";if(Ie(e))return"categorical";throw new E({message:`No data type found for value format: ${e.type}`})},Vt=e=>le(e)?e.fallback:e,Ce=class{constructor(){this.currentYear=new Date().getUTCFullYear(),this.previousDate=null,this.previousYear=null}incrementYearIfNeeded(e){this.previousYear===null?this.previousYear=e.getUTCFullYear():this.previousDate!==null&&(0,y.isBefore)(new Date(this.currentYear,e.getUTCMonth(),e.getUTCDate()),new Date(this.currentYear,this.previousDate.getUTCMonth(),this.previousDate.getUTCDate()))&&this.previousYear++;const t=new Date(e.getTime());return t.setUTCFullYear(this.previousYear),this.previousDate=t,t}},xe={k:1e3,m:1e6,b:1e9,t:1e12},ue=["k","m","b","t"],Bt=new RegExp(`^-?(\\d{1,3}(,\\d{3})*|\\d+)\\.?\\d*(${ue.join("|")})?$`,"i"),Ut=/^-?\d{1,3}(?:,\d{3})*(?:\.\d+)?%?$/,N=e=>e===null||e instanceof Date||Array.isArray(e)||typeof e=="boolean"?!1:typeof e=="string"?Bt.test(e)&&!Number.isNaN(Number(e.replace(new RegExp(`[,${ue.join("")}]`,"gi"),""))):!Number.isNaN(Number(e)),Ve=e=>N(e)?!0:typeof e=="string"?Ut.test(e):!1,Wt=/^\d{4}-\d{2}-\d{2}(T|\s)\d{1,2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|\+00:00)?$/,zt=/^\s*(19\d{2}|2[01]\d{2})\s*$/,Gt=[[/\bJan\b/i,"January"],[/\bFeb\b/i,"February"],[/\bMar\b/i,"March"],[/\bApr\b/i,"April"],[/\bJun\b/i,"June"],[/\bJul\b/i,"July"],[/\bAug\b/i,"August"],[/\bSept?\b/i,"September"],[/\bOct\b/i,"October"],[/\bNov\b/i,"November"],[/\bDec\b/i,"December"]],Ht={"en-US":"MDY","en-GB":"DMY","pt-PT":"DMY",ar:"DMY"},Be=["/","-","."," "],fe=[["d","M","yy"],["d","MM","yy"],["d","MMMM","yy"],["dd","M","yy"],["dd","MM","yy"],["dd","MMMM","yy"],["do","MMMM","yy"],["d","M","yyyy"],["d","MM","yyyy"],["d","MMMM","yyyy"],["dd","M","yyyy"],["dd","MM","yyyy"],["dd","MMMM","yyyy"],["do","MMMM","yyyy"]],ge=[["M","d","yy"],["M","dd","yy"],["MM","d","yy"],["MM","dd","yy"],["MMMM","d","yy"],["MMMM","dd","yy"],["MMMM","do","yy"],["M","d","yyyy"],["M","dd","yyyy"],["MM","d","yyyy"],["MM","dd","yyyy"],["MMMM","d","yyyy"],["MMMM","dd","yyyy"],["MMMM","do","yyyy"]],be=[["yyyy","M","d"],["yyyy","M","dd"],["yyyy","MM","d"],["yyyy","MM","dd"],["yyyy","MMMM","d"],["yyyy","MMMM","dd"],["yyyy","MMMM","do"]],Ue=[["d","MMMM"],["dd","MMMM"],["do","MMMM"],["MMMM","d"],["MMMM","dd"],["MMMM","do"]],Yt=[{dateFormat:"MMMM d, yyyy",type:"date"},{dateFormat:"MMMM dd, yyyy",type:"date"},{dateFormat:"MMMM do, yyyy",type:"date"},{dateFormat:"yyyy-MM",type:"month_year"}],We=1900,ze=2199,$t=3,Kt=6,Xt=5,qt=1,Qt=28,Zt=/\s*[–—]\s*|\s-\s/,Jt=e=>typeof e=="number"?Number.isNaN(e)?!1:e>=We&&e<=ze:typeof e=="string"?zt.test(e):!1,Ge=(e,t)=>{const r=B(e);return!t&&N(r)?rr(r):typeof r=="string"?t?(0,y.isValid)((0,y.parse)(r,t,new Date)):!!He(r)||q(r)&&(0,y.isValid)(new Date(r)):(0,y.isValid)(r)},B=e=>{if(typeof e!="string")return e;let t=e;for(const[r,n]of Gt)t=t.replace(r,n);return t},He=(e,t=X)=>{const r=B(e);return q(r)?{type:"datetime"}:$e(t).find(n=>!j(n)||n.type==="month"&&r.length<$t?!1:n.dateFormat&&(0,y.isValid)((0,y.parse)(r,n.dateFormat,new Date)))},q=e=>Wt.test(e.trim()),Ye=e=>{if(e instanceof Date)return(0,y.isValid)(e)?e:null;if(typeof e!="string"||!q(e))return null;const t=new Date(e.trim());return(0,y.isValid)(t)?t:null},er=(e,t=X)=>{const[r,n]=e.split(Zt);if(!r||!n)return;const a=B(r).trim(),o=B(n).trim();return tr(t).find(i=>{if(!j(i)||!i.dateFormat)return!1;const s=(0,y.parse)(a,i.dateFormat,new Date),c=(0,y.parse)(o,i.dateFormat,new Date);if(!(0,y.isValid)(s)||!(0,y.isValid)(c))return!1;const f=new Ce,b=f.incrementYearIfNeeded(s),h=f.incrementYearIfNeeded(c),g=(0,y.differenceInDays)(h,b);return(0,y.isWithinInterval)(new Date(b.getFullYear(),qt,Qt),{start:b,end:h})&&g===Xt?!0:g===Kt})},$e=e=>{const t={date:Ke(e),year:[["yyyy"]],day_month:Ue,month_year:[["MMMM","yyyy"],["yyyy","MMMM"]],month:[["MMMM"]],quarter:[["QQQ","yyyy"],["yyyy","QQQ"]]};return[...Yt,...Object.entries(t).flatMap(([r,n])=>n.flatMap(a=>Be.map(o=>({dateFormat:a.join(o),type:r}))))]},Ke=e=>Ht[e]==="MDY"?[...ge,...fe,...be]:[...fe,...ge,...be],tr=e=>{const t={weekly_date_range:Ue,weekly_date_range_with_year:Ke(e)};return Object.entries(t).flatMap(([r,n])=>n.flatMap(a=>Be.map(o=>({dateFormat:a.join(o),type:r}))))},rr=e=>{const t=Number(e);if(!(0,Me.isInteger)(t))return!1;const r=new Date(t),n=new Date(t*1e3),a=o=>(0,y.isValid)(o)&&o.getFullYear()>=We&&o.getFullYear()<=ze;return a(r)||a(n)},Xe={$:"usd","£":"gbp","€":"eur","¥":"jpy","₹":"inr","₱":"php",P:"php","₩":"krw","₪":"ils","₫":"vnd","₽":"rub","฿":"thb",R$:"brl",Rp:"idr",RM:"myr","₦":"ngn",zł:"pln","₺":"try",kr:"dkk",Fr:"chf",R:"zar","د.إ":"aed","﷼":"sar",Ch$:"clp",NT$:"twd",HK$:"hkd",S$:"sgd",A$:"aud",C$:"cad",NZ$:"nzd",MX$:"mxn"},qe=e=>{if(typeof e=="string"){const t=Qe(e);return t.length?N(t):!1}return N(e)},nr=e=>{const t=Ze(e),r=t?Xe[t]:void 0;if(!r)throw new E({message:"Could not get currency ISO"});return r},Qe=e=>{const t=Ze(e);let r=e;if(t){const n=e.indexOf(t);n===0?r=e.slice(t.length):n===e.length-t.length?r=e.slice(0,e.length-t.length):e[0]==="-"&&n===1&&(r=`-${e.slice(t.length+1)}`)}return N(r)?r.split(",").join(""):""},Ze=e=>Object.keys(Xe).sort((t,r)=>r.length-t.length).find(t=>e.includes(t)),Je=e=>{const t=Object.entries(e);return!t.length||!t.some(([,r])=>!k(r))},k=e=>typeof e=="string"&&e.trim()===""||e===void 0||e===null||e==="-",ar=/\s*[–—]\s*|\s-\s/,ce=(e,t,r)=>{if(k(e))return null;switch(t.type){case"decimal":case"integer":case"duration":return tt(e);case"percentage":return or(e);case"currency":return ir(e);case"datetime":case"date":case"year":case"month_year":case"month":case"day_month":case"quarter":case"time":return et(e,t.dateFormat,r);case"weekly_date_range":case"weekly_date_range_with_year":return sr(e,t.dateFormat,r);case"text":return lr(e);case"lookup":throw new E({message:"Cannot parse: lookup value formats are produced by transforms, not raw input"});default:throw new E({message:`Unhandled value format: ${t.type}`})}},et=(e,t,r)=>{if(e instanceof Date)return(0,y.isValid)(e)?e:null;const n=B(String(e).trim());if(n.length===0)return null;const a=new Date;if(t){const i=(0,y.parse)(n,t,a);return(0,y.isValid)(i)?Z(i):null}for(const i of $e(r)){if(!j(i)||!i.dateFormat)continue;const s=(0,y.parse)(n,i.dateFormat,a);if((0,y.isValid)(s))return Z(s)}const o=new Date(n);return Ge(o)?q(n)?o:Z(o):null},tt=e=>{if(typeof e=="number")return Number.isNaN(e)?null:e;if(typeof e!="string")return null;let t=e.trim();if(!N(t))return null;let r=1;for(const n of ue)if(new RegExp(`${n}$`,"i").test(t)){r=xe[n],t=t.slice(0,-1);break}return Number(t.split(",").join(""))*r},or=e=>{if(typeof e=="number")return Number.isNaN(e)?null:e;if(typeof e!="string")return null;const t=e.trim();if(!Ve(t))return null;const r=Number(t.replace(/%/g,"").replace(/,/g,""))/100;return Number.isNaN(r)?null:r},ir=e=>{if(typeof e=="number")return Number.isNaN(e)?null:e;if(typeof e!="string")return null;const t=e.trim();return qe(t)?tt(Qe(t)):null},sr=(e,t,r)=>{const n=String(e).trim().split(ar),[a,o]=[n[0]?.trim(),n[1]?.trim()];return!a||!o?null:et(a,t,r)},lr=e=>String(e).trim(),Z=e=>new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())),rt=(e,t,r)=>{const n=ce(e,t,r);return n!==null||!j(t)?n:Ye(e)},R=process.env.NODE_ENV!=="production";var Q=!0,ur=e=>{Q=e},cr=()=>Q,dr=()=>{let e=null;const t={hits:0,misses:0};return Object.assign((n,a)=>{if(!Q)return R&&(t.misses+=1),a();if(e&&at(e.args,n))return R&&(t.hits+=1),e.out;R&&(t.misses+=1);const o=a();return e={args:n,out:o},o},{stats:t,reset:()=>{e=null}})},nt=()=>{const e=new WeakMap,t={hits:0,misses:0};return Object.assign((n,a,o)=>{if(!Q)return R&&(t.misses+=1),o();const i=e.get(n);if(i)for(let c=0;c<i.length;c+=1){const f=i[c];if(f&&at(f.args,a))return R&&(t.hits+=1),c>0&&(i.splice(c,1),i.unshift(f)),f.out}R&&(t.misses+=1);const s=o();return i?(i.unshift({args:a,out:s}),i.length>16&&(i.length=16)):e.set(n,[{args:a,out:s}]),s},{stats:t})},fr=(...e)=>e.reduce((t,r)=>({hits:t.hits+r.hits,misses:t.misses+r.misses}),{hits:0,misses:0}),at=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1)if(e[r]!==t[r])return!1;return!0},ot=class{constructor(){this.memo=nt(),this.singletonKey={}}get stats(){return this.memo.stats}compile(e){return this.memo(this.key(e),this.dependencies(e),()=>this.run(e))}key(e){return this.singletonKey}},$=e=>(Array.isArray(e)?e:[e]).map(t=>t instanceof Date?t.toISOString():String(t??"<null>")).join("\0"),gr=(e,t)=>e===t?!0:Y(e)&&Y(t)?e.getTime()===t.getTime():!1,br=new Set(["count","sum","mean","median"]);function it(e,t){return br.has(e)?"numeric":t}function st(e,t,r){const n=r?.length??t.length;if(e==="count")return n;if(e==="median"||e==="mode"){const i=[];for(let s=0;s<n;s++){const c=J(t,r,s);ee(c)&&i.push(c)}return i.length===0?null:e==="median"?pr(i):hr(i)}if(e==="sum"||e==="mean"){let i=0,s=0;for(let c=0;c<n;c++){const f=J(t,r,c);ee(f)&&(i++,s+=Number(f))}return i===0?null:e==="sum"?s:s/i}const a=e==="min"?-1:1;let o=null;for(let i=0;i<n;i++){const s=J(t,r,i);ee(s)&&(o===null||mr(s,o)===a)&&(o=s)}return o}var J=(e,t,r)=>e[t?.[r]??r]??null,ee=e=>e!==null&&!(typeof e=="number"&&Number.isNaN(e)),mr=(e,t)=>e===null||t===null?0:e<t?-1:e>t?1:0,yr=e=>e instanceof Date?e.getTime():e??null;function pr(e){const t=e.map(Number).sort((o,i)=>o-i);if(t.length===1)return t[0]??0;const r=(t.length-1)/2,n=Math.floor(r),a=t[n]??0;return a+((t[n+1]??a)-a)*(r-n)}function hr(e){const t=new Map;for(const a of e){const o=yr(a),i=t.get(o);i===void 0?t.set(o,{value:a,count:1}):i.count++}let r=null,n=0;for(const{value:a,count:o}of t.values())o>n&&(n=o,r=a);return r}var Ar=e=>e==null||typeof e=="number"&&Number.isNaN(e),Er=e=>e instanceof Date?e.getTime():e??null,te=class F{constructor(t,r,n,a=null){this.rowShape=null,this.names=t,this.columns=r,this.rowCount=n,this.source=a}get columnCount(){return this.names.length}static from(t){const r=Object.entries(t);return new F(r.map(([n])=>n),new Map(r),r[0]?.[1].length??0)}columnNames(){return[...this.names]}hasColumn(t){return this.names.includes(t)}values(t){const r=this.columns.get(t);if(r!==void 0)return r;if(this.source===null||!this.names.includes(t))return;const n=this.source.table.values(t);if(n===void 0)return;const{indices:a}=this.source,o=new Array(a.length);for(let i=0;i<a.length;i++)o[i]=n[a[i]??0]??null;return this.columns.set(t,o),this.columns.size===this.names.length&&(this.source=null),o}assign(t,r){const n=this.gathered(),a=new Map(n.columns);a.set(t,r);const o=n.names.includes(t)?[...n.names]:[...n.names,t];return new F(o,a,n.names.length===0?r.length:n.rowCount)}select(t){const r=t.filter(a=>this.names.includes(a)),n=new Map;for(const a of r){const o=this.columns.get(a);o!==void 0&&n.set(a,o)}return new F(r,n,this.rowCount,this.source)}rename(t,r){const n=this.gathered(),a=new Map;for(const o of n.names){const i=n.columns.get(o);i!==void 0&&a.set(o===t?r:o,i)}return new F(n.names.map(o=>o===t?r:o),a,n.rowCount)}take(t){const r=this.source===null?{table:this,indices:t}:{table:this.source.table,indices:t.map(n=>this.source?.indices[n]??0)};return new F(this.names,new Map,t.length,r)}sortedIndices(t,r){const n=this.values(t);if(n===void 0)return Array.from({length:this.rowCount},(s,c)=>c);const a=[],o=[];for(let s=0;s<this.rowCount;s++)(Ar(n[s])?a:o).push(s);const i=r==="asc"?1:-1;return o.sort((s,c)=>{const f=n[s],b=n[c];return f<b?-i:f>b?i:0}),a.length===0?o:r==="asc"?[...a,...o]:[...o,...a]}partition(t){const r=t.map(o=>this.values(o)).filter(o=>o!==void 0),n=r.length===1?r[0]:void 0,a=new Map;if(n!==void 0){for(let o=0;o<this.rowCount;o++){const i=Er(n[o]),s=a.get(i);s===void 0?a.set(i,{key:$(n[o]??null),indices:[o]}):s.indices.push(o)}return[...a.values()]}for(let o=0;o<this.rowCount;o++){const i=$(r.map(c=>c[o])),s=a.get(i);s===void 0?a.set(i,{key:i,indices:[o]}):s.indices.push(o)}return[...a.values()]}fold(t,r,n){const a=this.names.filter(g=>!t.includes(g)),o=this.rowCount*t.length,i=a.map(g=>({name:g,source:this.values(g)??[],repeated:new Array(o)})),s=t.map(g=>this.values(g)??[]),c=new Array(o),f=new Array(o);let b=0;for(let g=0;g<this.rowCount;g++)for(let T=0;T<t.length;T++,b++){for(const I of i)I.repeated[b]=I.source[g]??null;c[b]=t[T]??"",f[b]=s[T]?.[g]??null}const h=new Map;for(const{name:g,repeated:T}of i)h.set(g,T);return h.set(r,c),h.set(n,f),new F([...a,r,n],h,o)}objectAt(t){const{names:r,arrays:n,template:a}=this.rowShape??this.resolveRowShape(),o={...a};for(let i=0;i<r.length;i++)o[r[i]??""]=n[i]?.[t]??null;return o}*[Symbol.iterator](){for(let t=0;t<this.rowCount;t++)yield this.objectAt(t)}resolveRowShape(){const t={};for(const r of this.names)t[r]=null;return this.rowShape={names:this.names,arrays:this.names.map(r=>this.values(r)??[]),template:t},this.rowShape}gathered(){if(this.source===null)return this;for(const t of this.names)this.values(t);return new F(this.names,new Map(this.columns),this.rowCount)}};var lt="value",x={numeric:{type:"decimal"},categorical:{type:"text"},temporal:{type:"datetime"}},me={eq:(e,t)=>e===t,neq:(e,t)=>e!==t,gt:(e,t)=>e!==null&&t!==null&&e>t,gte:(e,t)=>e!==null&&t!==null&&e>=t,lt:(e,t)=>e!==null&&t!==null&&e<t,lte:(e,t)=>e!==null&&t!==null&&e<=t},ye=e=>e===null?null:e instanceof Date?e.getTime():new Date(e).getTime(),ut=(e,t)=>e==="count"?{type:"integer"}:t,ct=(e,t,r)=>{const n=e.values(t);if(n!==void 0)return n;if(r==="count")return new Array(e.rowCount);throw new E({message:`Variable '${t}' not defined`})},K=class O{constructor(t={}){const{table:r,variableMetadata:n}=this.parseVariableMap(t);this.table=r,this.variableMetadata=n}static fromTrusted(t,r){const n=Object.create(O.prototype);return n.table=t,n.variableMetadata=r,n}size(){return this.table.rowCount}getVariableNames(){return this.table.columnNames()}hasVariable(t){return this.table.hasColumn(t)}addVariable(t,r,n,a){if(this.table.columnCount>0&&n.length!==this.size())throw new E({message:`Variable '${t}' has ${n.length} values, expected ${this.size()}`});const o={...this.variableMetadata,[t]:{type:r,valueFormat:this.resolveAddedVariableFormat(t,r,a)}},i=this.normalizeRawValues(r,n),s=this.table.assign(t,i);return O.fromTrusted(s,o)}addConstantVariable(t,r,n,a){const o={...this.variableMetadata,[t]:{type:r,valueFormat:this.resolveAddedVariableFormat(t,r,a),constant:{value:n}}},[i=null]=this.normalizeRawValues(r,[n]),s=this.table.assign(t,new Array(this.size()).fill(i));return O.fromTrusted(s,o)}getConstant(t){return this.variableMetadata[t]?.constant}deriveVariable(t,r,n,a){const o=Array.from({length:this.size()},(i,s)=>n(this.table.objectAt(s)));return this.addVariable(t,r,o,a)}deriveVariableFrom(t,r,n,a,o){const i=this.hasVariable(t)?this.getValues(t).map(a):Array.from({length:this.size()},()=>a(null));return this.addVariable(r,n,i,o)}renameVariable(t,r){const n=this.variableMetadata[t];if(!n)throw new E({message:`Variable ${t} not defined`});const a=this.table.rename(t,r),{[t]:o,...i}=this.variableMetadata,s={...i,[r]:n};return O.fromTrusted(a,s)}selectVariables(...t){const r=this.table.select(t),n=Object.fromEntries(Object.entries(this.variableMetadata).filter(([a])=>t.includes(a)));return O.fromTrusted(r,n)}getType(t){const r=this.variableMetadata[t];if(!r)throw new E({message:`Variable ${t} not defined`});return r.type}getValueFormat(t){const r=this.variableMetadata[t];if(!r)throw new E({message:`Variable ${t} not defined`});return r.valueFormat}groupVariableNamesByType(){const t={numeric:[],categorical:[],temporal:[]};for(const[r,{type:n}]of Object.entries(this.variableMetadata))t[n].push(r);return t}getValues(t,r){if(!this.hasVariable(t))throw new E({message:`Variable '${t}' not defined`});const n=this.getType(t);if(r?.type!==void 0&&n!==r.type){if(this.size()===0)return[];throw new E({message:`Variable '${t}' has type '${n}', expected '${r.type}'`})}let a=this.table.values(t)??[];return r?.distinct&&(a=this.getDistinctValues(n,a)),r?.skipNulls&&(a=this.skipNulls(a)),a}filter(t,r,n){if(this.hasVariable(t)&&this.getType(t)==="temporal")return this.filterByTimestamp(t,r,n);const a=me[r],o=this.table.values(t)??[],i=[];for(let s=0;s<o.length;s++)a(o[s]??null,n)&&i.push(s);return O.fromTrusted(this.table.take(i),this.variableMetadata)}filterByMask(t){if(t.length!==this.size())throw new E({message:`Row mask length ${t.length} does not match dataset size ${this.size()}`});const r=[];for(let n=0;n<t.length;n++)t[n]===1&&r.push(n);return O.fromTrusted(this.table.take(r),this.variableMetadata)}orderBy(t,r="asc"){const n=this.table.take(this.table.sortedIndices(t,r));return O.fromTrusted(n,this.variableMetadata)}getAt(t){return t<0||t>=this.size()?null:this.table.objectAt(t)}getFirst(){return this.getAt(0)}getLast(){return this.getAt(this.size()-1)}findFirst(t){const r=this.size();for(let n=0;n<r;n++){const a=this.table.objectAt(n);if(t(a))return a}return null}findLast(t){for(let r=this.size()-1;r>=0;r--){const n=this.table.objectAt(r);if(t(n))return n}return null}groupBy(...t){return new Or(t,this.table,this.variableMetadata)}rollup(t){const r=te.from(Object.fromEntries(Object.entries(t).map(([a,{variableName:o,aggregation:i}])=>[a,[st(i,ct(this.table,o,i))]]))),n={};for(const[a,{variableName:o,aggregation:i}]of Object.entries(t)){const s=this.variableMetadata[o],c=s?.type??"numeric",f=s?.valueFormat??x[c];n[a]={type:it(i,c),valueFormat:ut(i,f)}}return O.fromTrusted(r,n)}reshapeFromWideToLong({keep:t,reshape:r,keyName:n="key",valueName:a=lt}={}){const{numeric:o,categorical:i,temporal:s}=this.groupVariableNamesByType(),c=t??[...i,...s],f=r??o.filter(g=>!c.includes(g));if(c.includes(n)||c.includes(a))throw new V({code:"INVALID_DATA_SHAPE",message:`The variables to keep includes the variables '${n}' or '${a}' to create the key and value variables`});if(f.length===0){const g={};for(const T of c){const I=this.variableMetadata[T];I&&(g[T]={type:I.type,values:[],valueFormat:I.valueFormat})}return g[n]={type:"categorical",values:[],valueFormat:{type:"text"}},g[a]={type:"numeric",values:[],valueFormat:{type:"decimal"}},new O(g)}if(f.filter(g=>this.variableMetadata[g]?.type!=="numeric").length>0)throw new V({code:"INVALID_DATA_SHAPE",message:"Only numeric variables can be reshaped"});const b=this.table.select([...c,...f]).fold(f,n,a),h={};for(const g of c){const T=this.variableMetadata[g];T&&(h[g]=T)}return h[n]={type:"categorical",valueFormat:{type:"text"}},h[a]={type:"numeric",valueFormat:vr(this.variableMetadata,f,n)},O.fromTrusted(b,h)}print(){console.table(this.variableMetadata),console.table([...this.table])}[Symbol.iterator](){return this.table[Symbol.iterator]()}filterByTimestamp(t,r,n){const a=me[r],o=rt(n,this.getValueFormat(t),X),i=ye(o??n),s=this.getValues(t,{type:"temporal"}),c=[];for(let f=0;f<s.length;f++)a(ye(s[f]??null),i)&&c.push(f);return O.fromTrusted(this.table.take(c),this.variableMetadata)}resolveAddedVariableFormat(t,r,n){if(n!==void 0)return n;const a=this.variableMetadata[t];return a?a.valueFormat:x[r]}parseVariableMap(t){const r={},n={};for(const[a,{type:o,values:i,valueFormat:s}]of Object.entries(t))r[a]=i,n[a]={type:o,valueFormat:s??x[o]};return{table:te.from(r),variableMetadata:n}}normalizeRawValues(t,r){switch(t){case"numeric":return r.map(n=>typeof n!="number"||Number.isNaN(n)?null:n);case"categorical":return r.map(n=>typeof n!="string"?null:n);case"temporal":return r.map(n=>!(n instanceof Date)||!(0,y.isValid)(n)?null:n);default:throw new E({message:`Cannot normalize raw value of unknown type: ${t}`})}}skipNulls(t){return t.filter(r=>r!==null)}getDistinctValues(t,r){const n=t==="temporal",a=new Set,o=[];for(const i of r){const s=n&&i instanceof Date?i.getTime():i;a.has(s)||(a.add(s),o.push(i))}return o}},Or=class{constructor(e,t,r){this.groupedBy=e,this.table=t,this.variableMetadata=r}forEach(e){this.table.partition(this.groupedBy).forEach(({key:t,indices:r},n)=>{e(K.fromTrusted(this.table.take(r),this.variableMetadata),t,n)})}rollup(e){const t=this.table.partition(this.groupedBy),r={};for(const a of this.groupedBy){const o=this.table.values(a)??[];r[a]=t.map(({indices:i})=>o[i[0]??0]??null)}const n=Object.fromEntries(this.groupedBy.map(a=>{const o=this.variableMetadata[a],i=o?.type??"categorical";return[a,{type:i,valueFormat:o?.valueFormat??x[i]}]}));for(const[a,{variableName:o,aggregation:i}]of Object.entries(e)){const s=ct(this.table,o,i);r[a]=t.map(({indices:h})=>st(i,s,h));const c=this.variableMetadata[o],f=c?.type??"numeric",b=c?.valueFormat??x[f];n[a]={type:it(i,f),valueFormat:ut(i,b)}}return K.fromTrusted(te.from(r),n)}};function vr(e,t,r){const n=t.map(s=>e[s]?.valueFormat??{type:"decimal"}),[a,...o]=n;if(!a)return{type:"decimal"};for(const s of n)if(s.type==="lookup")throw new V({code:"INVALID_DATA_SHAPE",message:"Cannot reshape: a source column has a lookup format and lookups cannot nest"});if(o.every(s=>(0,Me.isEqual)(s,a))||a.type==="lookup")return a;const i={};for(const[s,c]of t.entries()){const f=$([c]),b=n[s];b&&b.type!=="lookup"&&(i[f]=b)}return{type:"lookup",byVariable:r,cases:i,fallback:a}}var dt=class{constructor(e){this.label=e,this.items=new Map}register(e,t){return this.items.set(e,t),this}get(e){if(!this.items.has(e)){const t=[...this.items.keys()].map(r=>`'${r}'`).join(", ");throw new V({code:"UNKNOWN_REGISTERED_TYPE",message:`Unknown ${this.label}: '${e}' (available: ${t})`,context:{kind:this.label,requested:e,available:[...this.items.keys()]},suggestion:`Register a custom ${this.label} named '${e}' in the \`plugins\` array, or use one of: ${t}.`})}return this.items.get(e)}getAll(){return[...this.items.values()]}has(e){return this.items.has(e)}},Tr=(e,t)=>{const r=typeof e=="string"?e.trim():e;if(N(r))return{type:"decimal"};const n=typeof r=="string"&&He(r,t);if(n)return n;const a=typeof r=="string"&&er(r,t);return a||(Ge(e)?{type:"date"}:Ve(e)?{type:"percentage"}:qe(e)&&typeof e=="string"?{type:"currency",iso:nr(e)}:{type:"text"})},_r={type:"year",dateFormat:"yyyy"},Mr={type:"text"},ft=e=>{const t=e._metadata?.parsingLocale??"en-GB",r={},n=Fr(e),a=Dr(e),o=n.size>0;for(const[i,s]of e.columns.entries()){if(s._metadata?.isHidden)continue;const c=n.get(s.key);if(k(c)&&o)continue;const f=k(c)?Mr:i===a?_r:Tr(c,t),b=je(f);r[s.key]=Sr(s.key,e.rows,f,b,t)}return new K(r)},Lr=class extends ot{dependencies(e){return[e]}run(e){return ft(e)}},Dr=e=>{const t=Pr(e.rows,5);return e.columns.findIndex(r=>{const n=t.map(a=>a[r.key]).filter(a=>!k(a));return n.length>=2&&n.every(Jt)})},Sr=(e,t,r,n,a)=>({type:n,values:t.reduce((o,i)=>(Je(i)||o.push(ce(i[e],r,a)),o),[]),valueFormat:r}),Fr=e=>{const t=new Map,r=new Set(e.columns.map(n=>n.key));for(const n of e.rows){for(const a of r){const o=n[a];k(o)||(t.set(a,o),r.delete(a))}if(r.size===0)break}return t},Pr=(e,t)=>{const r=[];for(const n of e)if(Je(n)||r.push(n),r.length===t)return r;return r},Rr=["observation","category","aggregate"],Nr=["inside","outside"],wr=["top","right","bottom","left"],Ir=["heading","label","value","primaryRow"],kr=["link"],jr=["h1","h2"],Cr=["number","numberCenter","caption","label","swatch","trend","trendUp","trendDown","trendFlat"],xr=["swatch"],Vr=["popover"],Br=["shape","arrow","differenceArrow","text","image","pinnedNumber","comment"],Ur={differenceArrow:["label"],pinnedNumber:["label"],comment:["label"]},Wr=["dimmed","hovered"],zr=e=>typeof e=="object"&&e!==null&&typeof e.light=="string"&&typeof e.dark=="string",Gr=e=>typeof e=="object"&&e!==null&&typeof e.token=="string";function Hr(e){return{type:"styles",...e}}function d(e){return{token:e}}var P=e=>{const t={...e?.where===void 0?{}:{where:e.where},...e?.state===void 0?{}:{state:e.state}};return{...e?.id===void 0?{}:{id:e.id},...Object.keys(t).length===0?{}:{when:t}}},S=e=>e?.layer===void 0?{}:{layer:e.layer},l=e=>e?.id===void 0?{}:{id:e.id},_=e=>e?.annotation===void 0?{}:{annotation:e.annotation},u={geom:Object.assign((e,t)=>({...P(t),select:{target:"geom",...S(t)},declarations:e}),{bar:(e,t)=>({...P(t),select:{target:"geom",kind:"bar",...S(t)},declarations:e}),line:(e,t)=>({...P(t),select:{target:"geom",kind:"line",...S(t)},declarations:e}),area:(e,t)=>({...P(t),select:{target:"geom",kind:"area",...S(t)},declarations:e}),point:(e,t)=>({...P(t),select:{target:"geom",kind:"point",...S(t)},declarations:e}),rule:Object.assign((e,t)=>({...P(t),select:{target:"geom",kind:"rule",...S(t)},declarations:e}),{label:(e,t)=>({...l(t),select:{target:"ruleLabel",...S(t)},declarations:e})}),tile:(e,t)=>({...P(t),select:{target:"geom",kind:"tile",...S(t)},declarations:e})}),panelBorder:Object.assign((e,t)=>({...l(t),select:{target:"panelBorder"},declarations:e}),{top:(e,t)=>({...l(t),select:{target:"panelBorder",edge:"top"},declarations:e}),right:(e,t)=>({...l(t),select:{target:"panelBorder",edge:"right"},declarations:e}),bottom:(e,t)=>({...l(t),select:{target:"panelBorder",edge:"bottom"},declarations:e}),left:(e,t)=>({...l(t),select:{target:"panelBorder",edge:"left"},declarations:e})}),gridLine:Object.assign((e,t)=>({...l(t),select:{target:"gridLine"},declarations:e}),{x:(e,t)=>({...l(t),select:{target:"gridLine",axis:"x"},declarations:e}),y:(e,t)=>({...l(t),select:{target:"gridLine",axis:"y"},declarations:e})}),tickLine:Object.assign((e,t)=>({...l(t),select:{target:"tickLine"},declarations:e}),{x:(e,t)=>({...l(t),select:{target:"tickLine",axis:"x"},declarations:e}),y:(e,t)=>({...l(t),select:{target:"tickLine",axis:"y"},declarations:e})}),axisLabel:Object.assign((e,t)=>({...l(t),select:{target:"axisLabel"},declarations:e}),{x:(e,t)=>({...l(t),select:{target:"axisLabel",axis:"x"},declarations:e}),y:(e,t)=>({...l(t),select:{target:"axisLabel",axis:"y"},declarations:e}),top:(e,t)=>({...l(t),select:{target:"axisLabel",edge:"top"},declarations:e}),right:(e,t)=>({...l(t),select:{target:"axisLabel",edge:"right"},declarations:e}),bottom:(e,t)=>({...l(t),select:{target:"axisLabel",edge:"bottom"},declarations:e}),left:(e,t)=>({...l(t),select:{target:"axisLabel",edge:"left"},declarations:e})}),tickLabel:Object.assign((e,t)=>({...l(t),select:{target:"tickLabel"},declarations:e}),{x:(e,t)=>({...l(t),select:{target:"tickLabel",axis:"x"},declarations:e}),y:(e,t)=>({...l(t),select:{target:"tickLabel",axis:"y"},declarations:e}),top:(e,t)=>({...l(t),select:{target:"tickLabel",edge:"top"},declarations:e}),right:(e,t)=>({...l(t),select:{target:"tickLabel",edge:"right"},declarations:e}),bottom:(e,t)=>({...l(t),select:{target:"tickLabel",edge:"bottom"},declarations:e}),left:(e,t)=>({...l(t),select:{target:"tickLabel",edge:"left"},declarations:e})}),dataLabel:Object.assign((e,t)=>({...l(t),select:{target:"dataLabel"},declarations:e}),{observation:Object.assign((e,t)=>({...l(t),select:{target:"dataLabel",role:"observation"},declarations:e}),{inside:(e,t)=>({...l(t),select:{target:"dataLabel",role:"observation",position:"inside"},declarations:e}),outside:(e,t)=>({...l(t),select:{target:"dataLabel",role:"observation",position:"outside"},declarations:e})}),category:Object.assign((e,t)=>({...l(t),select:{target:"dataLabel",role:"category"},declarations:e}),{inside:(e,t)=>({...l(t),select:{target:"dataLabel",role:"category",position:"inside"},declarations:e}),outside:(e,t)=>({...l(t),select:{target:"dataLabel",role:"category",position:"outside"},declarations:e})}),aggregate:(e,t)=>({...l(t),select:{target:"dataLabel",role:"aggregate"},declarations:e})}),graph:(e,t)=>({...l(t),select:{target:"graph"},declarations:e}),heading:Object.assign((e,t)=>({...l(t),select:{target:"heading"},declarations:e}),{h1:(e,t)=>({...l(t),select:{target:"heading",part:"h1"},declarations:e}),h2:(e,t)=>({...l(t),select:{target:"heading",part:"h2"},declarations:e})}),caption:(e,t)=>({...l(t),select:{target:"caption"},declarations:e}),source:Object.assign((e,t)=>({...l(t),select:{target:"source"},declarations:e}),{link:(e,t)=>({...l(t),select:{target:"source",part:"link"},declarations:e})}),header:(e,t)=>({...l(t),select:{target:"header"},declarations:e}),footer:(e,t)=>({...l(t),select:{target:"footer"},declarations:e}),hoverGuide:(e,t)=>({...l(t),select:{target:"hoverGuide"},declarations:e}),tooltip:Object.assign((e,t)=>({...l(t),select:{target:"tooltip"},declarations:e}),{heading:(e,t)=>({...l(t),select:{target:"tooltip",part:"heading"},declarations:e}),label:(e,t)=>({...l(t),select:{target:"tooltip",part:"label"},declarations:e}),value:(e,t)=>({...l(t),select:{target:"tooltip",part:"value"},declarations:e}),primaryRow:(e,t)=>({...l(t),select:{target:"tooltip",part:"primaryRow"},declarations:e})}),headline:(e,t)=>({...l(t),select:{target:"headline"},declarations:e}),headlineItem:{number:Object.assign((e,t)=>({...l(t),select:{target:"headlineItem",part:"number"},declarations:e}),{center:(e,t)=>({...l(t),select:{target:"headlineItem",part:"numberCenter"},declarations:e})}),caption:(e,t)=>({...l(t),select:{target:"headlineItem",part:"caption"},declarations:e}),label:(e,t)=>({...l(t),select:{target:"headlineItem",part:"label"},declarations:e}),swatch:(e,t)=>({...l(t),select:{target:"headlineItem",part:"swatch"},declarations:e}),trend:Object.assign((e,t)=>({...l(t),select:{target:"headlineItem",part:"trend"},declarations:e}),{up:(e,t)=>({...l(t),select:{target:"headlineItem",part:"trendUp"},declarations:e}),down:(e,t)=>({...l(t),select:{target:"headlineItem",part:"trendDown"},declarations:e}),flat:(e,t)=>({...l(t),select:{target:"headlineItem",part:"trendFlat"},declarations:e})})},legend:Object.assign((e,t)=>({...l(t),select:{target:"legend"},declarations:e}),{popover:(e,t)=>({...l(t),select:{target:"legend",part:"popover"},declarations:e}),top:(e,t)=>({...l(t),select:{target:"legend",edge:"top"},declarations:e}),right:(e,t)=>({...l(t),select:{target:"legend",edge:"right"},declarations:e}),bottom:(e,t)=>({...l(t),select:{target:"legend",edge:"bottom"},declarations:e}),left:(e,t)=>({...l(t),select:{target:"legend",edge:"left"},declarations:e})}),legendItem:Object.assign((e,t)=>({...l(t),select:{target:"legendItem"},declarations:e}),{swatch:(e,t)=>({...l(t),select:{target:"legendItem",part:"swatch"},declarations:e})}),directLabel:(e,t)=>({...l(t),select:{target:"directLabel"},declarations:e}),annotation:Object.assign((e,t)=>({...l(t),select:{target:"annotation",..._(t)},declarations:e}),{shape:(e,t)=>({...l(t),select:{target:"annotation",kind:"shape",..._(t)},declarations:e}),arrow:(e,t)=>({...l(t),select:{target:"annotation",kind:"arrow",..._(t)},declarations:e}),differenceArrow:Object.assign((e,t)=>({...l(t),select:{target:"annotation",kind:"differenceArrow",..._(t)},declarations:e}),{label:(e,t)=>({...l(t),select:{target:"annotation",kind:"differenceArrow",part:"label",..._(t)},declarations:e})}),text:(e,t)=>({...l(t),select:{target:"annotation",kind:"text",..._(t)},declarations:e}),image:(e,t)=>({...l(t),select:{target:"annotation",kind:"image",..._(t)},declarations:e}),pinnedNumber:Object.assign((e,t)=>({...l(t),select:{target:"annotation",kind:"pinnedNumber",..._(t)},declarations:e}),{label:(e,t)=>({...l(t),select:{target:"annotation",kind:"pinnedNumber",part:"label",..._(t)},declarations:e})}),comment:Object.assign((e,t)=>({...l(t),select:{target:"annotation",kind:"comment",..._(t)},declarations:e}),{label:(e,t)=>({...l(t),select:{target:"annotation",kind:"comment",part:"label",..._(t)},declarations:e})})})},gt="#B84737",bt=.4,Yr="sm",$r=2,Kr=8,Xr=12,re=Object.freeze({light:"#F5F1E9",dark:"#1F1E1C"}),mt="#ffffff",qr=1,Qr=24,Zr={top:24,right:24,bottom:24,left:24},pe=1,Jr=.3,en=10,tn=24,rn=8,he=Object.freeze({light:"#898373",dark:"#9F9886"}),p={label:{fontWeight:500,fontSize:11.5,lineHeight:1},dataLabelOutside:{fontWeight:600,fontSize:12.5,lineHeight:1},tooltipHeading:{fontSize:12.5,fontWeight:700,lineHeight:1.3},tooltipRow:{fontSize:12.5,fontWeight:500,lineHeight:1.43},heading:{fontWeight:600,fontSize:18,lineHeight:1.25},subtitle:{fontWeight:500,fontSize:15,lineHeight:1.47},caption:{fontWeight:500,fontSize:12,lineHeight:1.3},source:{fontWeight:500,fontSize:12,lineHeight:1.3},sourceLink:{fontWeight:400,fontSize:12,lineHeight:1.3}},nn={graphBackground:re,graphBorder:Object.freeze({light:"rgba(58, 56, 51, 0.15)",dark:"rgba(237, 231, 218, 0.15)"}),geom:gt,geomBorder:Object.freeze({light:"rgba(58, 56, 51, 0.55)",dark:"rgba(237, 231, 218, 0.55)"}),textPrimary:Object.freeze({light:"#3A3833",dark:"#EDE7DA"}),textSecondary:he,ruleLine:Object.freeze({light:"#3A3833",dark:"#EDE7DA"}),gridLine:Object.freeze({light:"#E1DAC9",dark:"#373531"}),hoverAffordance:mt,hoverGuideFill:Object.freeze({light:"#E7E1D2",dark:"#2B2A27"}),hoverGuideLine:Object.freeze({light:"#D5CDBA",dark:"#3B3934"}),tooltipBackground:Object.freeze({light:"#FCFCF9",dark:"#262522"}),tooltipBorder:Object.freeze({light:"rgba(58, 56, 51, 0.15)",dark:"rgba(237, 231, 218, 0.15)"}),tooltipPrimaryRow:Object.freeze({light:"#F5F1E9",dark:"#2E2C29"}),annotationShape:Object.freeze({light:"#3b82f6",dark:"#60a5fa"}),annotationArrow:Object.freeze({light:"#3A3833",dark:"#EDE7DA"}),differenceLabelBackground:re,trendPositive:{light:"#06B299",dark:"#0AC600"},trendNegative:{light:"#E14B49",dark:"#CB3333"},trendNeutral:he},Ae={color:d("gridLine"),strokeWidth:1,lineType:"dashed"},Ee={color:d("textPrimary"),size:8,borderColor:d("tooltipBackground"),borderWidth:2,shadow:{offsetX:0,offsetY:1,blur:1.5,color:"rgba(14, 14, 52, 0.18)"}},Oe={fontSize:12,fontWeight:500,lineHeight:1.3,textColor:d("textPrimary"),background:d("tooltipBackground"),borderColor:d("tooltipBorder"),borderWidth:1,borderRadius:6,paddingInline:7,paddingBlock:4,shadow:{offsetX:0,offsetY:2,blur:6,color:"rgba(0, 0, 0, 0.12)"}},yt=[u.geom({color:d("geom"),alpha:1}),u.geom.bar({borderRadius:"sm",borderWidth:pe,borderColor:d("geomBorder")}),u.geom.line({strokeWidth:2,lineType:"solid"}),u.geom.area({alpha:Jr,strokeWidth:2,lineType:"solid",strokeAlpha:1}),u.geom.point({size:8,borderColor:d("hoverAffordance"),borderWidth:pe}),u.geom.rule({color:d("ruleLine"),strokeWidth:1,lineType:"dashed"}),u.geom.tile({borderRadius:8,borderWidth:0}),u.geom({alpha:bt},{state:"dimmed"}),u.geom.point({borderColor:d("hoverAffordance")},{state:"hovered"}),u.geom.bar({borderColor:d("hoverAffordance")},{state:"hovered"}),u.geom.tile({borderColor:d("hoverAffordance"),borderWidth:2},{state:"hovered"}),u.hoverGuide({color:d("hoverGuideLine"),background:d("hoverGuideFill")}),u.panelBorder({...Ae,borderRadius:6}),u.gridLine.y({...Ae}),u.tickLine({strokeWidth:0,length:0}),u.graph({background:d("graphBackground"),borderWidth:1,borderColor:d("graphBorder"),borderRadius:8,textScale:1,padding:24}),u.heading({textColor:d("textPrimary")}),u.heading.h1({...p.heading}),u.heading.h2({...p.subtitle}),u.caption({...p.caption,textColor:d("textPrimary")}),u.source({...p.source,textColor:d("textSecondary")}),u.source.link({...p.sourceLink,textColor:d("textSecondary")}),u.header({margin:{bottom:10}}),u.axisLabel({...p.label,textColor:d("textPrimary")}),u.axisLabel.top({margin:{bottom:8}}),u.axisLabel.bottom({margin:{top:4,bottom:16}}),u.tickLabel({...p.label,textColor:d("textSecondary"),offset:en}),u.tickLabel.left({offset:14}),u.tickLabel.right({offset:14}),u.geom.rule.label({...p.label}),u.dataLabel({...p.label,textColor:d("textPrimary"),paddingInline:6,paddingBlock:2,borderRadius:4}),u.dataLabel.aggregate({...p.dataLabelOutside}),u.dataLabel.observation.inside({textColor:"#FFFFFF"}),u.dataLabel.category.inside({textColor:"#FFFFFF"}),u.dataLabel.observation.outside({...p.dataLabelOutside}),u.dataLabel.category.outside({...p.dataLabelOutside}),u.tooltip({background:d("tooltipBackground"),borderColor:d("tooltipBorder"),borderWidth:1,borderRadius:6,paddingBlock:8,paddingInline:10,shadow:{offsetX:0,offsetY:4,blur:12,color:"rgba(0, 0, 0, 0.18)"}}),u.tooltip.heading({...p.tooltipHeading,textColor:d("textPrimary")}),u.tooltip.label({...p.tooltipRow,textColor:d("textPrimary")}),u.tooltip.value({...p.tooltipRow,textColor:d("textSecondary")}),u.tooltip.primaryRow({background:d("tooltipPrimaryRow")}),u.headline({gap:tn,margin:{bottom:4}}),u.headlineItem.number({fontSize:26,fontWeight:700,lineHeight:1.3,textColor:d("textPrimary")}),u.headlineItem.caption({fontSize:12,textColor:d("textSecondary")}),u.headlineItem.label({fontSize:12,textColor:d("textSecondary")}),u.headlineItem.swatch({size:12}),u.headlineItem.trend({fontSize:12}),u.headlineItem.trend.up({textColor:d("trendPositive")}),u.headlineItem.trend.down({textColor:d("trendNegative")}),u.headlineItem.trend.flat({textColor:d("trendNeutral")}),u.legend({gap:rn}),u.legend.popover({background:d("tooltipBackground"),borderColor:d("tooltipBorder"),borderWidth:1,borderRadius:6,paddingBlock:8,paddingInline:10,shadow:{offsetX:0,offsetY:4,blur:12,color:"rgba(0, 0, 0, 0.18)"}}),u.legend.top({margin:{bottom:8}}),u.legend.bottom({margin:{top:16,bottom:10}}),u.legend.left({margin:{right:10}}),u.legend.right({margin:{left:10}}),u.footer({margin:{top:16}}),u.legendItem({...p.label,textColor:d("textSecondary"),borderWidth:0,paddingInline:2,paddingBlock:4}),u.legendItem.swatch({size:12,strokeWidth:2}),u.directLabel({fontSize:12,fontWeight:500,lineHeight:1.3,textColor:d("textPrimary"),strokeWidth:1,lineType:"dashed"}),u.annotation.shape({color:d("annotationShape"),alpha:.25,borderWidth:1}),u.annotation.arrow({color:d("annotationArrow"),strokeWidth:4,lineType:"solid",borderWidth:0,shadow:"none"}),u.annotation.differenceArrow({color:d("annotationArrow"),strokeWidth:2}),u.annotation.differenceArrow.label({...p.label,textColor:d("textPrimary"),background:d("differenceLabelBackground"),borderWidth:1,borderRadius:4,paddingInline:6,paddingBlock:3}),u.annotation.text({background:"transparent",alpha:1,borderWidth:1.5,borderRadius:9,paddingInline:6,paddingBlock:3,fontSize:15,fontWeight:500,lineHeight:1.25,textColor:d("textPrimary")}),u.annotation.image({alpha:1,borderRadius:0}),u.annotation.pinnedNumber(Ee),u.annotation.pinnedNumber.label(Oe),u.annotation.comment(Ee),u.annotation.comment.label(Oe)];for(const e of yt){Object.freeze(e.select);for(const t of Object.values(e.declarations))typeof t=="object"&&Object.freeze(t);Object.freeze(e.declarations),e.when!==void 0&&Object.freeze(e.when),Object.freeze(e)}var an=Object.freeze({tokens:Object.freeze(nn),defaults:Object.freeze(yt),overrides:Object.freeze([])}),on=class{constructor(){this.transformType="aggregate"}apply(e,t){const{options:r}=t,n={};for(const a of r.operations)n[a.as]={variableName:a.variableName,aggregation:a.op};return e.groupBy(...r.groupby).rollup(n)}},sn=class{constructor(){this.transformType="constant"}apply(e,t){const{options:r}=t;return e.addConstantVariable(r.variableName,r.type,r.value)}getIntroducedVariables(e){const{options:t}=e;return[t.variableName]}},ln=class{constructor(){this.transformType="filter"}apply(e,t){const{options:r}=t;return e.filter(r.variableName,r.operator,r.value)}},un=class{constructor(){this.transformType="reshape"}apply(e,t){const{options:r}=t;return e.reshapeFromWideToLong({keep:r.keep,reshape:r.reshape,keyName:r.keyName,valueName:r.valueName})}getIntroducedVariables(e){const{options:t}=e;return[t.keyName??"key"]}},cn=class{constructor(){this.transformType="sort"}apply(e,t){const{options:r}=t;return e.orderBy(r.variableName,r.direction??"asc")}},dn=[new on,new sn,new ln,new un,new cn],fn=class extends dt{constructor(){super("transform");for(const e of dn)this.register(e.transformType,e)}},gn=["brick","grey","red","orange","yellow","green","cyan","blue","purple","pink"],bn=["cyan","pink","purple","red","orange","yellow","green","blue"],pt=["#B84737","#BA7420","#0B8666","#3D63A8","#DD9583","#E2BF6B","#95CBA6","#AABCE5"],ht="brick",L={red:"#E83562",orange:"#F38650",yellow:"#FBBC30",green:"#31FCB4",cyan:"#40F8FF",blue:"#279EFF",purple:"#B399FD",dark_purple:"#6D48D2",plum:"#C82184",pink:"#FC8497"},mn=[L.purple,L.pink,L.yellow,L.blue,L.red,L.cyan,L.orange,L.plum,L.green,L.dark_purple],M={green:"#B2DDC9",cyan:"#A2D5E2",blue:"#AAC4FF",purple:"#B2A4FF",plum:"#DCA8C7",pink:"#FFCCD3",red:"#FFADAD",orange:"#FFDEB4",yellow:"#FDF7C3"},yn=[M.green,M.purple,M.red,M.cyan,M.pink,M.blue,M.orange,M.plum,M.yellow],U={brick900:"#6E0500",brick800:"#881D11",brick700:"#A03522",brick600:"#B0523B",brick500:"#C06D56",brick400:"#CE8772",brick300:"#DBA28E",brick200:"#E7BDAC",brick100:"#F2D8CB",brick50:"#FCF4EA",grey900:"#1c1917",grey800:"#292524",grey700:"#44403c",grey600:"#57534e",grey500:"#78716c",grey400:"#a8a29e",grey300:"#d6d3d1",grey200:"#e7e5e4",grey100:"#f5f5f4",grey50:"#fafaf9",red900:"#7f1d1d",red800:"#991b1b",red700:"#b91c1c",red600:"#dc2626",red500:"#ef4444",red400:"#f87171",red300:"#fca5a5",red200:"#fecaca",red100:"#fee2e2",red50:"#fef2f2",orange900:"#7c2d12",orange800:"#9a3412",orange700:"#c2410c",orange600:"#ea580c",orange500:"#f97316",orange400:"#fb923c",orange300:"#fdba74",orange200:"#fed7aa",orange100:"#ffedd5",orange50:"#fff7ed",yellow900:"#553B0C",yellow800:"#6F4B08",yellow700:"#8D6300",yellow600:"#BD8A00",yellow500:"#E5B400",yellow400:"#FFC800",yellow300:"#FBDA2B",yellow200:"#FEED72",yellow100:"#FEF8B4",yellow50:"#FEFCE2",green900:"#064e3b",green800:"#065f46",green700:"#047857",green600:"#059669",green500:"#10b981",green400:"#34d399",green300:"#6ee7b7",green200:"#a7f3d0",green100:"#d1fae5",green50:"#ecfdf5",cyan900:"#164e63",cyan800:"#155e75",cyan700:"#0e7490",cyan600:"#0891B2",cyan500:"#06b6d4",cyan400:"#22d3ee",cyan300:"#67e8f9",cyan200:"#a5f3fc",cyan100:"#cffafe",cyan50:"#ecfeff",blue900:"#1e3a8a",blue800:"#1e40af",blue700:"#1d4ed8",blue600:"#2563eb",blue500:"#3b82f6",blue400:"#60a5fa",blue300:"#93c5fd",blue200:"#bfdbfe",blue100:"#dbeafe",blue50:"#eff6ff",purple900:"#4c1d95",purple800:"#5b21b6",purple700:"#6d28d9",purple600:"#7c3aed",purple500:"#8b5cf6",purple400:"#a78bfa",purple300:"#c4b5fd",purple200:"#ddd6fe",purple100:"#ede9fe",purple50:"#f5f3ff",pink900:"#751A5E",pink800:"#8F1972",pink700:"#AF1C8A",pink600:"#D326A8",pink500:"#E845BF",pink400:"#F979D9",pink300:"#FCABE8",pink200:"#FED0F3",pink100:"#FFE8F9",pink50:"#FFF4FC"},pn=[U.brick100,U.brick900],hn=[U.grey200,M.green,M.red,U.grey200],ve={dark:{1:[500],2:[600,400],3:[600,400,200],4:[600,500,300,100],5:[700,600,400,200,50],6:[600,500,400,300,200,100],7:[600,500,400,300,200,100,50],default:[700,600,500,400,300,200,100,50]},light:{1:[600],2:[700,500],3:[800,600,400],4:[800,600,400,300],5:[800,700,600,500,400],6:[800,700,600,500,400,300],7:[900,800,700,600,500,400,300],default:[900,800,700,600,500,400,300,200]}},v={cyan:"#22D3EE",pink:"#F377EF",purple:"#6528F7",red:"#FB2576",orange:"#FF9300",yellow:"#FBFF00",green:"#06FF00",blue:"#0079FF"},W=[v.cyan,v.pink,v.purple,v.red,v.orange,v.yellow,v.green,v.blue],An=[v.cyan,v.green,v.red,v.cyan],z={start:"#84D1FC",positive:"#84FC89",negative:"#FC8497",total:"#84D1FC"},En=[z.start,z.positive,z.negative,z.total],On={transform:"linear",reverse:!1,nice:!0,zero:!1,domainMin:null,domainMax:null,range:null,scheme:null,interpolate:"lab",domainMid:null,symmetric:!1},vn={size:[4,20],alpha:[.1,1],strokeWidth:[1,4]},Tn={domainMin:null,domainMax:null,nice:!1,reverse:!1},_n={range:null,domain:null,padding:.1,reverse:!1},Te={palette:{type:"default"}};function _e(e,t="light",r){return((r!==void 0?ve[t][r]:void 0)??ve[t].default).map(n=>U[`${e}${n}`])}function Mn(e){const t=W.indexOf(v[e]);return t<=0?W:[...W.slice(t),...W.slice(0,t)]}function Ln(e,t={}){switch(e.type){case"default":return t.hasTouchingGeoms?_e(ht,t.colorScheme??"light",t.groupCount):pt;case"graphy":return e.variant==="waterfall"?En:mn;case"pastel":return e.variant==="waterfall"?hn:yn;case"neon":return e.variant==="waterfall"?An:Mn(e.base);case"mono":return _e(e.base,e.variant??"light",t.groupCount);case"custom":return e.colors}}function Dn(e,t){if(!t)return e;const r=[...e];for(const[n,a]of Object.entries(t)){const o=Number(n);if(!Number.isInteger(o)||o<1)continue;const i=o-1;i<r.length&&(r[i]=a)}return r}function Sn(e,t,r,n){if(!t)return;const a=r?.type==="custom"?n[r.id]:void 0,o={};for(const[i,s]of Object.entries(t)){const c=Number(i);if(!(!Number.isInteger(c)||c<1)){if(s.hex!==void 0){o[c]=s.hex;continue}if(s.id!==void 0){const f=a?.find(b=>b.id===s.id)?.hex;f!==void 0?o[c]=f:e.diagnostics.addWarning({code:"PALETTE_NOT_FOUND",message:`Palette override at slot ${c} with id '${s.id}' did not resolve against the active palette — falling back to palette color.`,context:{requested:s.id,available:a?.map(b=>b.id)??[]},suggestion:"Define the override id in the active custom palette, or use a hex value instead."})}}}return Object.keys(o).length>0?o:void 0}function Fn(e,t,r){if(!t)return Te.palette;if(t.type==="custom"){const n=r[t.id];if(!n)return e.diagnostics.addWarning({code:"PALETTE_NOT_FOUND",message:`Custom palette with id "${t.id}" not found — falling back to the default palette.`,context:{requested:t.id,available:Object.keys(r)},suggestion:"Register the palette in customPalettes, or reference an existing palette id."}),Te.palette;const a=n.map(o=>o.hex);return{type:"custom",id:t.id,colors:a}}return t}function A(e,t={}){const r=t;return{type:"scale",scaledAesthetic:e,scaleType:"continuous",transform:t.transform,reverse:t.reverse,nice:t.nice,zero:t.zero,clamp:t.clamp,domainMin:t.domainMin??null,domainMax:t.domainMax??null,range:t.range,scheme:r.scheme??null,interpolate:r.interpolate,domainMid:r.domainMid??null,symmetric:r.symmetric}}function G(e,t={}){return{type:"scale",scaledAesthetic:e,scaleType:"datetime",domainMin:t.domainMin??null,domainMax:t.domainMax??null,nice:t.nice,reverse:t.reverse,clamp:t.clamp}}function D(e,t={}){return{type:"scale",scaledAesthetic:e,scaleType:"discrete",range:t.range,domain:t.domain??null,padding:t.padding,reverse:t.reverse}}function C(e,t={}){return{type:"scale",scaledAesthetic:e,scaleType:"identity"}}function H(e,t){return{type:"scale",scaledAesthetic:e,scaleType:"inferred",options:t}}function At(e,t={}){return{type:"scale",scaledAesthetic:e,scaleType:"palette",palette:t.palette,overrides:t.overrides}}var Pn={labelCrossPosition:.5},Rn={kind:"rectangle",zOrder:"foreground"},Nn={zOrder:"foreground",fit:"contain"},wn={x:8,y:8,unit:"px"},In={align:"center"},kn={startArrowheadStyle:"none",endArrowheadStyle:"line-arrow"},jn={thin:2,medium:4,thick:8},Cn=.5,xn={borderWidth:2,shadow:{offsetX:0,offsetY:1.15,blur:1.15,color:"rgba(0, 0, 0, 0.16)"}},Vn={small:{arrow:{strokeWidth:2},label:{fontSize:12,fontWeight:500,paddingInline:6,paddingBlock:3,borderWidth:1}},medium:{arrow:{strokeWidth:3},label:{fontSize:16,fontWeight:500,paddingInline:8,paddingBlock:4,borderWidth:1.5}},large:{arrow:{strokeWidth:5},label:{fontSize:20,fontWeight:600,paddingInline:10,paddingBlock:5,borderWidth:2}}},Et=["none","xs","sm","md","lg","xl","full"],Bn={point:Wn,line:zn,area:Gn,bar:Hn,rule:Yn,tile:$n},Un=e=>typeof e=="string"&&Et.includes(e);function w(e,t){return{type:"layer",id:t.id,geom:e,mapping:t.aes,stat:t.stat,params:t.params,position:t.position,yScaleType:t.yScaleType,transforms:t.transforms,interactive:t.interactive,dataLabels:t.dataLabels}}function Wn(e={}){return w("point",e)}function zn(e={}){return w("line",e)}function Gn(e={}){return w("area",e)}function Hn(e={}){return w("bar",e)}function Yn(e={}){return w("rule",e)}function $n(e={}){return w("tile",e)}var Ot=["grouped-bars","stacked-bars","lines"],vt={"grouped-bars":"dodge","stacked-bars":"stack",lines:null},Kn=e=>e==="identity"?"grouped-bars":Ot.find(t=>vt[t]===e)??null,Xn={cartesian:(e={})=>({type:"coord",coordType:"cartesian",params:e}),flip:(e={})=>({type:"coord",coordType:"flip",params:e}),polar:(e={})=>({type:"coord",coordType:"polar",params:e})},qn={x:Object.assign(e=>H("x",e),{continuous:e=>A("x",e),discrete:e=>D("x",e),datetime:e=>G("x",e),log:e=>A("x",{...e,transform:"log"}),sqrt:e=>A("x",{...e,transform:"sqrt"})}),y:Object.assign(e=>H("y",e),{continuous:e=>A("y",e),discrete:e=>D("y",e),datetime:e=>G("y",e),log:e=>A("y",{...e,transform:"log"}),sqrt:e=>A("y",{...e,transform:"sqrt"})}),ySecondary:Object.assign(e=>H("ySecondary",e),{continuous:e=>A("ySecondary",e),discrete:e=>D("ySecondary",e),datetime:e=>G("ySecondary",e),log:e=>A("ySecondary",{...e,transform:"log"}),sqrt:e=>A("ySecondary",{...e,transform:"sqrt"})}),color:{continuous:e=>A("color",e),discrete:e=>D("color",e),palette:e=>At("color",e)},size:{continuous:e=>A("size",e),discrete:e=>D("size",e),identity:e=>C("size",e)},alpha:{continuous:e=>A("alpha",e),discrete:e=>D("alpha",e),identity:e=>C("alpha",e)},strokeWidth:{continuous:e=>A("strokeWidth",e),discrete:e=>D("strokeWidth",e),identity:e=>C("strokeWidth",e)},lineType:{discrete:e=>D("lineType",e),identity:e=>C("lineType",e)}},Qn={identity:Jn,count:ea,smooth:Zn,mean:ta,sum:ra};function Zn(e){return{type:"smooth",method:e.method,order:e.order,bandwidth:e.bandwidth}}function Jn(){return{type:"identity"}}function ea(){return{type:"count"}}function ta(){return{type:"mean"}}function ra(){return{type:"sum"}}var na={reshape:aa,filter:oa,sort:ia,aggregate:sa,constant:la};function aa(e={}){return{type:"transform",transformType:"reshape",options:e}}function oa(e){return{type:"transform",transformType:"filter",options:e}}function ia(e){return{type:"transform",transformType:"sort",options:e}}function sa(e){return{type:"transform",transformType:"aggregate",options:e}}function la(e){return{type:"transform",transformType:"constant",options:e}}function ua(e){return{type:"config",config:e}}Object.defineProperty(exports,"ANNOTATION_PARTS",{enumerable:!0,get:function(){return Ur}});Object.defineProperty(exports,"ANNOTATION_STYLE_KINDS",{enumerable:!0,get:function(){return Br}});Object.defineProperty(exports,"ARROW_DEFAULTS",{enumerable:!0,get:function(){return kn}});Object.defineProperty(exports,"ARROW_STICKER_DECLARATIONS",{enumerable:!0,get:function(){return xn}});Object.defineProperty(exports,"ARROW_STROKE_WIDTHS",{enumerable:!0,get:function(){return jn}});Object.defineProperty(exports,"BORDER_RADIUS_TOKENS",{enumerable:!0,get:function(){return Et}});Object.defineProperty(exports,"BUILTIN_STYLES",{enumerable:!0,get:function(){return an}});Object.defineProperty(exports,"COMBO_BAR_POSITIONS",{enumerable:!0,get:function(){return vt}});Object.defineProperty(exports,"COMBO_TYPES",{enumerable:!0,get:function(){return Ot}});Object.defineProperty(exports,"CONSTANT_VARIABLES",{enumerable:!0,get:function(){return ae}});Object.defineProperty(exports,"CONTINUOUS_SCALE_DEFAULTS",{enumerable:!0,get:function(){return On}});Object.defineProperty(exports,"ChronologicalDateManager",{enumerable:!0,get:function(){return Ce}});Object.defineProperty(exports,"DATA_LABEL_POSITIONS",{enumerable:!0,get:function(){return Nr}});Object.defineProperty(exports,"DATA_LABEL_ROLES",{enumerable:!0,get:function(){return Rr}});Object.defineProperty(exports,"DATETIME_SCALE_DEFAULTS",{enumerable:!0,get:function(){return Tn}});Object.defineProperty(exports,"DEFAULT_BAR_BORDER_RADIUS",{enumerable:!0,get:function(){return Yr}});Object.defineProperty(exports,"DEFAULT_COLOR_PALETTE",{enumerable:!0,get:function(){return pt}});Object.defineProperty(exports,"DEFAULT_DIMMED_ALPHA",{enumerable:!0,get:function(){return bt}});Object.defineProperty(exports,"DEFAULT_GEOM_COLOR",{enumerable:!0,get:function(){return gt}});Object.defineProperty(exports,"DEFAULT_GRAPH_BACKGROUND",{enumerable:!0,get:function(){return re}});Object.defineProperty(exports,"DEFAULT_GRAPH_BORDER_WIDTH",{enumerable:!0,get:function(){return qr}});Object.defineProperty(exports,"DEFAULT_GRAPH_PADDING",{enumerable:!0,get:function(){return Qr}});Object.defineProperty(exports,"DEFAULT_GRAPH_PADDING_EDGES",{enumerable:!0,get:function(){return Zr}});Object.defineProperty(exports,"DEFAULT_HEADLINE_SWATCH_SIZE",{enumerable:!0,get:function(){return Xr}});Object.defineProperty(exports,"DEFAULT_HOVER_AFFORDANCE_COLOR",{enumerable:!0,get:function(){return mt}});Object.defineProperty(exports,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return X}});Object.defineProperty(exports,"DEFAULT_MONO_BASE",{enumerable:!0,get:function(){return ht}});Object.defineProperty(exports,"DEFAULT_POINT_SIZE",{enumerable:!0,get:function(){return Kr}});Object.defineProperty(exports,"DEFAULT_RESHAPE_VALUE_NAME",{enumerable:!0,get:function(){return lt}});Object.defineProperty(exports,"DEFAULT_SEQUENTIAL_RAMP",{enumerable:!0,get:function(){return pn}});Object.defineProperty(exports,"DEFAULT_STROKE_WIDTH",{enumerable:!0,get:function(){return $r}});Object.defineProperty(exports,"DIFFERENCE_ARROW_DEFAULTS",{enumerable:!0,get:function(){return Pn}});Object.defineProperty(exports,"DIFFERENCE_ARROW_SIZE_DECLARATIONS",{enumerable:!0,get:function(){return Vn}});Object.defineProperty(exports,"DISCRETE_SCALE_DEFAULTS",{enumerable:!0,get:function(){return _n}});Object.defineProperty(exports,"DataCompiler",{enumerable:!0,get:function(){return Lr}});Object.defineProperty(exports,"Dataset",{enumerable:!0,get:function(){return K}});Object.defineProperty(exports,"GROUP_VARIABLES",{enumerable:!0,get:function(){return Se}});Object.defineProperty(exports,"HEADING_PARTS",{enumerable:!0,get:function(){return jr}});Object.defineProperty(exports,"HEADLINE_ITEM_PARTS",{enumerable:!0,get:function(){return Cr}});Object.defineProperty(exports,"IMAGE_ANNOTATION_DEFAULTS",{enumerable:!0,get:function(){return Nn}});Object.defineProperty(exports,"IS_DEV",{enumerable:!0,get:function(){return R}});Object.defineProperty(exports,"InternalError",{enumerable:!0,get:function(){return E}});Object.defineProperty(exports,"LAYER_LABEL_VARIABLES",{enumerable:!0,get:function(){return St}});Object.defineProperty(exports,"LEGEND_ITEM_PARTS",{enumerable:!0,get:function(){return xr}});Object.defineProperty(exports,"LEGEND_PARTS",{enumerable:!0,get:function(){return Vr}});Object.defineProperty(exports,"MONO_BASES",{enumerable:!0,get:function(){return gn}});Object.defineProperty(exports,"NEON_BASES",{enumerable:!0,get:function(){return bn}});Object.defineProperty(exports,"NON_POSITION_RANGE_DEFAULTS",{enumerable:!0,get:function(){return vn}});Object.defineProperty(exports,"PANEL_BORDER_EDGES",{enumerable:!0,get:function(){return wr}});Object.defineProperty(exports,"POSITION_VARIABLES",{enumerable:!0,get:function(){return Fe}});Object.defineProperty(exports,"RULE_VARIABLES",{enumerable:!0,get:function(){return Ne}});Object.defineProperty(exports,"Registry",{enumerable:!0,get:function(){return dt}});Object.defineProperty(exports,"SELECTION_PADDING_DEFAULT",{enumerable:!0,get:function(){return wn}});Object.defineProperty(exports,"SHAPE_DEFAULTS",{enumerable:!0,get:function(){return Rn}});Object.defineProperty(exports,"SOURCE_PARTS",{enumerable:!0,get:function(){return kr}});Object.defineProperty(exports,"STACK_VARIABLES",{enumerable:!0,get:function(){return Pe}});Object.defineProperty(exports,"STAT_VARIABLES",{enumerable:!0,get:function(){return oe}});Object.defineProperty(exports,"STYLE_STATES",{enumerable:!0,get:function(){return Wr}});Object.defineProperty(exports,"SUFFIX_MULTIPLIERS",{enumerable:!0,get:function(){return xe}});Object.defineProperty(exports,"Stage",{enumerable:!0,get:function(){return ot}});Object.defineProperty(exports,"TEXT_ANNOTATION_DEFAULTS",{enumerable:!0,get:function(){return In}});Object.defineProperty(exports,"TEXT_ANNOTATION_FADE_ALPHA",{enumerable:!0,get:function(){return Cn}});Object.defineProperty(exports,"TOOLTIP_PARTS",{enumerable:!0,get:function(){return Ir}});Object.defineProperty(exports,"TransformRegistry",{enumerable:!0,get:function(){return fn}});Object.defineProperty(exports,"UserInputError",{enumerable:!0,get:function(){return V}});Object.defineProperty(exports,"VISUAL_VARIABLES",{enumerable:!0,get:function(){return Re}});Object.defineProperty(exports,"VizError",{enumerable:!0,get:function(){return se}});Object.defineProperty(exports,"applyOverrides",{enumerable:!0,get:function(){return Dn}});Object.defineProperty(exports,"areDataValuesEqual",{enumerable:!0,get:function(){return gr}});Object.defineProperty(exports,"areMappingsEquivalent",{enumerable:!0,get:function(){return jt}});Object.defineProperty(exports,"buildLayerInput",{enumerable:!0,get:function(){return w}});Object.defineProperty(exports,"config",{enumerable:!0,get:function(){return ua}});Object.defineProperty(exports,"continuous",{enumerable:!0,get:function(){return A}});Object.defineProperty(exports,"coord",{enumerable:!0,get:function(){return Xn}});Object.defineProperty(exports,"createPerKeyMemo",{enumerable:!0,get:function(){return nt}});Object.defineProperty(exports,"createSingleSlotMemo",{enumerable:!0,get:function(){return dr}});Object.defineProperty(exports,"datetime",{enumerable:!0,get:function(){return G}});Object.defineProperty(exports,"discrete",{enumerable:!0,get:function(){return D}});Object.defineProperty(exports,"extractConstantValue",{enumerable:!0,get:function(){return we}});Object.defineProperty(exports,"extractVariableName",{enumerable:!0,get:function(){return ie}});Object.defineProperty(exports,"geom",{enumerable:!0,get:function(){return Bn}});Object.defineProperty(exports,"getStableKey",{enumerable:!0,get:function(){return $}});Object.defineProperty(exports,"identity",{enumerable:!0,get:function(){return C}});Object.defineProperty(exports,"inferXVariable",{enumerable:!0,get:function(){return wt}});Object.defineProperty(exports,"inferred",{enumerable:!0,get:function(){return H}});Object.defineProperty(exports,"isBorderRadiusToken",{enumerable:!0,get:function(){return Un}});Object.defineProperty(exports,"isCategoricalValueFormat",{enumerable:!0,get:function(){return Ie}});Object.defineProperty(exports,"isCompilerCachingEnabled",{enumerable:!0,get:function(){return cr}});Object.defineProperty(exports,"isCurrencyValueFormat",{enumerable:!0,get:function(){return Ct}});Object.defineProperty(exports,"isDateWithoutYearValueFormat",{enumerable:!0,get:function(){return xt}});Object.defineProperty(exports,"isDefined",{enumerable:!0,get:function(){return ne}});Object.defineProperty(exports,"isInternalVariable",{enumerable:!0,get:function(){return Rt}});Object.defineProperty(exports,"isLightDarkColor",{enumerable:!0,get:function(){return zr}});Object.defineProperty(exports,"isLookupValueFormat",{enumerable:!0,get:function(){return le}});Object.defineProperty(exports,"isNonEmptyArray",{enumerable:!0,get:function(){return Tt}});Object.defineProperty(exports,"isNumericDataValue",{enumerable:!0,get:function(){return Dt}});Object.defineProperty(exports,"isNumericValueFormat",{enumerable:!0,get:function(){return ke}});Object.defineProperty(exports,"isPlainObject",{enumerable:!0,get:function(){return _t}});Object.defineProperty(exports,"isStatVariable",{enumerable:!0,get:function(){return Nt}});Object.defineProperty(exports,"isStrictCategoricalDataValue",{enumerable:!0,get:function(){return Lt}});Object.defineProperty(exports,"isStrictNumericDataValue",{enumerable:!0,get:function(){return Le}});Object.defineProperty(exports,"isStrictTemporalDataValue",{enumerable:!0,get:function(){return Y}});Object.defineProperty(exports,"isStyleTokenRef",{enumerable:!0,get:function(){return Gr}});Object.defineProperty(exports,"isTemporalDataValue",{enumerable:!0,get:function(){return Mt}});Object.defineProperty(exports,"isTemporalValueFormat",{enumerable:!0,get:function(){return j}});Object.defineProperty(exports,"palette",{enumerable:!0,get:function(){return At}});Object.defineProperty(exports,"parseAddressingValue",{enumerable:!0,get:function(){return rt}});Object.defineProperty(exports,"parseDataset",{enumerable:!0,get:function(){return ft}});Object.defineProperty(exports,"parseValue",{enumerable:!0,get:function(){return ce}});Object.defineProperty(exports,"prefixInternalVariable",{enumerable:!0,get:function(){return m}});Object.defineProperty(exports,"readComboTypeOfBarPosition",{enumerable:!0,get:function(){return Kn}});Object.defineProperty(exports,"readFoldKeepVariables",{enumerable:!0,get:function(){return It}});Object.defineProperty(exports,"readISOInstant",{enumerable:!0,get:function(){return Ye}});Object.defineProperty(exports,"readMainAxisVariable",{enumerable:!0,get:function(){return kt}});Object.defineProperty(exports,"resolvePaletteConfig",{enumerable:!0,get:function(){return Fn}});Object.defineProperty(exports,"resolvePaletteOverrides",{enumerable:!0,get:function(){return Sn}});Object.defineProperty(exports,"resolvePaletteRange",{enumerable:!0,get:function(){return Ln}});Object.defineProperty(exports,"resolveScaledAestheticVariable",{enumerable:!0,get:function(){return Pt}});Object.defineProperty(exports,"scale",{enumerable:!0,get:function(){return qn}});Object.defineProperty(exports,"setCompilerCachingEnabled",{enumerable:!0,get:function(){return ur}});Object.defineProperty(exports,"stat",{enumerable:!0,get:function(){return Qn}});Object.defineProperty(exports,"style",{enumerable:!0,get:function(){return u}});Object.defineProperty(exports,"styles",{enumerable:!0,get:function(){return Hr}});Object.defineProperty(exports,"sumMemoStats",{enumerable:!0,get:function(){return fr}});Object.defineProperty(exports,"toExplicitValueFormat",{enumerable:!0,get:function(){return Vt}});Object.defineProperty(exports,"token",{enumerable:!0,get:function(){return d}});Object.defineProperty(exports,"transform",{enumerable:!0,get:function(){return na}});
1
+ let y=require("date-fns"),Me=require("lodash-es");var Tt=e=>e.length>0;function ne(e){return e!=null}function _t(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}var Y=e=>e instanceof Date&&(0,y.isValid)(e),Mt=e=>Y(e)||e===null,Lt=e=>typeof e=="string",Le=e=>typeof e=="number"&&!Number.isNaN(e)&&Number.isFinite(e),Dt=e=>Le(e)||e===null,De="\0graphy\0_",m=e=>`${De}${e}`,ae={x:m("constantX")},St={bar:m("barSeriesLabel"),line:m("lineSeriesLabel")},oe={count:m("count"),mean:m("mean"),sum:m("sum")},Se={group:m("group")},Fe={x:m("x"),y:m("y"),xMin:m("xMin"),xMax:m("xMax"),yMin:m("yMin"),yMax:m("yMax"),yRaw:m("yRaw")},Pe={role:m("stackRole")},Re={color:m("color"),size:m("size"),alpha:m("alpha"),strokeWidth:m("strokeWidth"),lineType:m("lineType")},Ne={y:m("ruleY"),x:m("ruleX")},ca={...ae,...oe,...Se,...Fe,...Pe,...Re,...Ne},Ft=new Set(Object.values(oe)),Pt=e=>m(`scaled_${e}`),Rt=e=>e.startsWith(De),Nt=e=>Ft.has(e);function wt(e){const{numeric:t,categorical:r,temporal:n}=e.groupVariableNamesByType();return n[0]??r[0]??t[0]??""}function It(e,t){const{categorical:r,temporal:n}=e.groupVariableNamesByType(),a=[...r,...n];return t===""||a.includes(t)?a:[t,...a]}function kt(e){const t=ie(e.x);return t===null||t===ae.x?"":t}function ie(e){return ne(e)?typeof e=="string"?e:"variable"in e?e.variable:null:null}function we(e){if(!(!ne(e)||typeof e=="string")&&"value"in e)return e.value}function jt(e,t){return[...new Set([...Object.keys(e),...Object.keys(t)])].every(r=>de(e[r])===de(t[r]))}function de(e){const t=ie(e);if(t!==null)return`variable:${t}`;const r=we(e);return r===void 0?"":r===null?"value:null":r instanceof Date?`value:date:${r.getTime()}`:`value:${typeof r}:${r}`}var X="en-GB",se=class extends Error{constructor(e){super(e.message,e.cause!==void 0?{cause:e.cause}:void 0),this.name=new.target.name,this.code=e.code,this.context=e.context,this.suggestion=e.suggestion}},V=class extends se{constructor(e){super(e),this.kind="user-input"}},E=class extends se{constructor(e){super({...e,code:e.code??"INTERNAL_INVARIANT"}),this.kind="internal"}},le=e=>e.type==="lookup",Ie=e=>e.type==="text",j=e=>e.type==="date"||e.type==="datetime"||e.type==="year"||e.type==="month_year"||e.type==="month"||e.type==="day_month"||e.type==="weekly_date_range"||e.type==="weekly_date_range_with_year"||e.type==="quarter"||e.type==="time",ke=e=>e.type==="decimal"||e.type==="integer"||e.type==="percentage"||e.type==="duration"||e.type==="currency",Ct=e=>e.type==="currency",xt=e=>e.type==="month"||e.type==="day_month"||e.type==="weekly_date_range",je=e=>{if(le(e))return je(e.fallback);if(j(e))return"temporal";if(ke(e))return"numeric";if(Ie(e))return"categorical";throw new E({message:`No data type found for value format: ${e.type}`})},Vt=e=>le(e)?e.fallback:e,Ce=class{constructor(){this.currentYear=new Date().getUTCFullYear(),this.previousDate=null,this.previousYear=null}incrementYearIfNeeded(e){this.previousYear===null?this.previousYear=e.getUTCFullYear():this.previousDate!==null&&(0,y.isBefore)(new Date(this.currentYear,e.getUTCMonth(),e.getUTCDate()),new Date(this.currentYear,this.previousDate.getUTCMonth(),this.previousDate.getUTCDate()))&&this.previousYear++;const t=new Date(e.getTime());return t.setUTCFullYear(this.previousYear),this.previousDate=t,t}},xe={k:1e3,m:1e6,b:1e9,t:1e12},ue=["k","m","b","t"],Bt=new RegExp(`^-?(\\d{1,3}(,\\d{3})*|\\d+)\\.?\\d*(${ue.join("|")})?$`,"i"),Ut=/^-?\d{1,3}(?:,\d{3})*(?:\.\d+)?%?$/,N=e=>e===null||e instanceof Date||Array.isArray(e)||typeof e=="boolean"?!1:typeof e=="string"?Bt.test(e)&&!Number.isNaN(Number(e.replace(new RegExp(`[,${ue.join("")}]`,"gi"),""))):!Number.isNaN(Number(e)),Ve=e=>N(e)?!0:typeof e=="string"?Ut.test(e):!1,Wt=/^\d{4}-\d{2}-\d{2}(T|\s)\d{1,2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|\+00:00)?$/,zt=/^\s*(19\d{2}|2[01]\d{2})\s*$/,Gt=[[/\bJan\b/i,"January"],[/\bFeb\b/i,"February"],[/\bMar\b/i,"March"],[/\bApr\b/i,"April"],[/\bJun\b/i,"June"],[/\bJul\b/i,"July"],[/\bAug\b/i,"August"],[/\bSept?\b/i,"September"],[/\bOct\b/i,"October"],[/\bNov\b/i,"November"],[/\bDec\b/i,"December"]],Ht={"en-US":"MDY","en-GB":"DMY","pt-PT":"DMY",ar:"DMY"},Be=["/","-","."," "],fe=[["d","M","yy"],["d","MM","yy"],["d","MMMM","yy"],["dd","M","yy"],["dd","MM","yy"],["dd","MMMM","yy"],["do","MMMM","yy"],["d","M","yyyy"],["d","MM","yyyy"],["d","MMMM","yyyy"],["dd","M","yyyy"],["dd","MM","yyyy"],["dd","MMMM","yyyy"],["do","MMMM","yyyy"]],ge=[["M","d","yy"],["M","dd","yy"],["MM","d","yy"],["MM","dd","yy"],["MMMM","d","yy"],["MMMM","dd","yy"],["MMMM","do","yy"],["M","d","yyyy"],["M","dd","yyyy"],["MM","d","yyyy"],["MM","dd","yyyy"],["MMMM","d","yyyy"],["MMMM","dd","yyyy"],["MMMM","do","yyyy"]],be=[["yyyy","M","d"],["yyyy","M","dd"],["yyyy","MM","d"],["yyyy","MM","dd"],["yyyy","MMMM","d"],["yyyy","MMMM","dd"],["yyyy","MMMM","do"]],Ue=[["d","MMMM"],["dd","MMMM"],["do","MMMM"],["MMMM","d"],["MMMM","dd"],["MMMM","do"]],Yt=[{dateFormat:"MMMM d, yyyy",type:"date"},{dateFormat:"MMMM dd, yyyy",type:"date"},{dateFormat:"MMMM do, yyyy",type:"date"},{dateFormat:"yyyy-MM",type:"month_year"}],We=1900,ze=2199,$t=3,Kt=6,Xt=5,qt=1,Qt=28,Zt=/\s*[–—]\s*|\s-\s/,Jt=e=>typeof e=="number"?Number.isNaN(e)?!1:e>=We&&e<=ze:typeof e=="string"?zt.test(e):!1,Ge=(e,t)=>{const r=B(e);return!t&&N(r)?rr(r):typeof r=="string"?t?(0,y.isValid)((0,y.parse)(r,t,new Date)):!!He(r)||q(r)&&(0,y.isValid)(new Date(r)):(0,y.isValid)(r)},B=e=>{if(typeof e!="string")return e;let t=e;for(const[r,n]of Gt)t=t.replace(r,n);return t},He=(e,t=X)=>{const r=B(e);return q(r)?{type:"datetime"}:$e(t).find(n=>!j(n)||n.type==="month"&&r.length<$t?!1:n.dateFormat&&(0,y.isValid)((0,y.parse)(r,n.dateFormat,new Date)))},q=e=>Wt.test(e.trim()),Ye=e=>{if(e instanceof Date)return(0,y.isValid)(e)?e:null;if(typeof e!="string"||!q(e))return null;const t=new Date(e.trim());return(0,y.isValid)(t)?t:null},er=(e,t=X)=>{const[r,n]=e.split(Zt);if(!r||!n)return;const a=B(r).trim(),o=B(n).trim();return tr(t).find(i=>{if(!j(i)||!i.dateFormat)return!1;const s=(0,y.parse)(a,i.dateFormat,new Date),c=(0,y.parse)(o,i.dateFormat,new Date);if(!(0,y.isValid)(s)||!(0,y.isValid)(c))return!1;const f=new Ce,b=f.incrementYearIfNeeded(s),h=f.incrementYearIfNeeded(c),g=(0,y.differenceInDays)(h,b);return(0,y.isWithinInterval)(new Date(b.getFullYear(),qt,Qt),{start:b,end:h})&&g===Xt?!0:g===Kt})},$e=e=>{const t={date:Ke(e),year:[["yyyy"]],day_month:Ue,month_year:[["MMMM","yyyy"],["yyyy","MMMM"]],month:[["MMMM"]],quarter:[["QQQ","yyyy"],["yyyy","QQQ"]]};return[...Yt,...Object.entries(t).flatMap(([r,n])=>n.flatMap(a=>Be.map(o=>({dateFormat:a.join(o),type:r}))))]},Ke=e=>Ht[e]==="MDY"?[...ge,...fe,...be]:[...fe,...ge,...be],tr=e=>{const t={weekly_date_range:Ue,weekly_date_range_with_year:Ke(e)};return Object.entries(t).flatMap(([r,n])=>n.flatMap(a=>Be.map(o=>({dateFormat:a.join(o),type:r}))))},rr=e=>{const t=Number(e);if(!(0,Me.isInteger)(t))return!1;const r=new Date(t),n=new Date(t*1e3),a=o=>(0,y.isValid)(o)&&o.getFullYear()>=We&&o.getFullYear()<=ze;return a(r)||a(n)},Xe={$:"usd","£":"gbp","€":"eur","¥":"jpy","₹":"inr","₱":"php",P:"php","₩":"krw","₪":"ils","₫":"vnd","₽":"rub","฿":"thb",R$:"brl",Rp:"idr",RM:"myr","₦":"ngn",zł:"pln","₺":"try",kr:"dkk",Fr:"chf",R:"zar","د.إ":"aed","﷼":"sar",Ch$:"clp",NT$:"twd",HK$:"hkd",S$:"sgd",A$:"aud",C$:"cad",NZ$:"nzd",MX$:"mxn"},qe=e=>{if(typeof e=="string"){const t=Qe(e);return t.length?N(t):!1}return N(e)},nr=e=>{const t=Ze(e),r=t?Xe[t]:void 0;if(!r)throw new E({message:"Could not get currency ISO"});return r},Qe=e=>{const t=Ze(e);let r=e;if(t){const n=e.indexOf(t);n===0?r=e.slice(t.length):n===e.length-t.length?r=e.slice(0,e.length-t.length):e[0]==="-"&&n===1&&(r=`-${e.slice(t.length+1)}`)}return N(r)?r.split(",").join(""):""},Ze=e=>Object.keys(Xe).sort((t,r)=>r.length-t.length).find(t=>e.includes(t)),Je=e=>{const t=Object.entries(e);return!t.length||!t.some(([,r])=>!k(r))},k=e=>typeof e=="string"&&e.trim()===""||e===void 0||e===null||e==="-",ar=/\s*[–—]\s*|\s-\s/,ce=(e,t,r)=>{if(k(e))return null;switch(t.type){case"decimal":case"integer":case"duration":return tt(e);case"percentage":return or(e);case"currency":return ir(e);case"datetime":case"date":case"year":case"month_year":case"month":case"day_month":case"quarter":case"time":return et(e,t.dateFormat,r);case"weekly_date_range":case"weekly_date_range_with_year":return sr(e,t.dateFormat,r);case"text":return lr(e);case"lookup":throw new E({message:"Cannot parse: lookup value formats are produced by transforms, not raw input"});default:throw new E({message:`Unhandled value format: ${t.type}`})}},et=(e,t,r)=>{if(e instanceof Date)return(0,y.isValid)(e)?e:null;const n=B(String(e).trim());if(n.length===0)return null;const a=new Date;if(t){const i=(0,y.parse)(n,t,a);return(0,y.isValid)(i)?Z(i):null}for(const i of $e(r)){if(!j(i)||!i.dateFormat)continue;const s=(0,y.parse)(n,i.dateFormat,a);if((0,y.isValid)(s))return Z(s)}const o=new Date(n);return Ge(o)?q(n)?o:Z(o):null},tt=e=>{if(typeof e=="number")return Number.isNaN(e)?null:e;if(typeof e!="string")return null;let t=e.trim();if(!N(t))return null;let r=1;for(const n of ue)if(new RegExp(`${n}$`,"i").test(t)){r=xe[n],t=t.slice(0,-1);break}return Number(t.split(",").join(""))*r},or=e=>{if(typeof e=="number")return Number.isNaN(e)?null:e;if(typeof e!="string")return null;const t=e.trim();if(!Ve(t))return null;const r=Number(t.replace(/%/g,"").replace(/,/g,""))/100;return Number.isNaN(r)?null:r},ir=e=>{if(typeof e=="number")return Number.isNaN(e)?null:e;if(typeof e!="string")return null;const t=e.trim();return qe(t)?tt(Qe(t)):null},sr=(e,t,r)=>{const n=String(e).trim().split(ar),[a,o]=[n[0]?.trim(),n[1]?.trim()];return!a||!o?null:et(a,t,r)},lr=e=>String(e).trim(),Z=e=>new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())),rt=(e,t,r)=>{const n=ce(e,t,r);return n!==null||!j(t)?n:Ye(e)},R=process.env.NODE_ENV!=="production";var Q=!0,ur=e=>{Q=e},cr=()=>Q,dr=()=>{let e=null;const t={hits:0,misses:0};return Object.assign((n,a)=>{if(!Q)return R&&(t.misses+=1),a();if(e&&at(e.args,n))return R&&(t.hits+=1),e.out;R&&(t.misses+=1);const o=a();return e={args:n,out:o},o},{stats:t,reset:()=>{e=null}})},nt=()=>{const e=new WeakMap,t={hits:0,misses:0};return Object.assign((n,a,o)=>{if(!Q)return R&&(t.misses+=1),o();const i=e.get(n);if(i)for(let c=0;c<i.length;c+=1){const f=i[c];if(f&&at(f.args,a))return R&&(t.hits+=1),c>0&&(i.splice(c,1),i.unshift(f)),f.out}R&&(t.misses+=1);const s=o();return i?(i.unshift({args:a,out:s}),i.length>16&&(i.length=16)):e.set(n,[{args:a,out:s}]),s},{stats:t})},fr=(...e)=>e.reduce((t,r)=>({hits:t.hits+r.hits,misses:t.misses+r.misses}),{hits:0,misses:0}),at=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1)if(e[r]!==t[r])return!1;return!0},ot=class{constructor(){this.memo=nt(),this.singletonKey={}}get stats(){return this.memo.stats}compile(e){return this.memo(this.key(e),this.dependencies(e),()=>this.run(e))}key(e){return this.singletonKey}},$=e=>(Array.isArray(e)?e:[e]).map(t=>t instanceof Date?t.toISOString():String(t??"<null>")).join("\0"),gr=(e,t)=>e===t?!0:Y(e)&&Y(t)?e.getTime()===t.getTime():!1,br=new Set(["count","sum","mean","median"]);function it(e,t){return br.has(e)?"numeric":t}function st(e,t,r){const n=r?.length??t.length;if(e==="count")return n;if(e==="median"||e==="mode"){const i=[];for(let s=0;s<n;s++){const c=J(t,r,s);ee(c)&&i.push(c)}return i.length===0?null:e==="median"?pr(i):hr(i)}if(e==="sum"||e==="mean"){let i=0,s=0;for(let c=0;c<n;c++){const f=J(t,r,c);ee(f)&&(i++,s+=Number(f))}return i===0?null:e==="sum"?s:s/i}const a=e==="min"?-1:1;let o=null;for(let i=0;i<n;i++){const s=J(t,r,i);ee(s)&&(o===null||mr(s,o)===a)&&(o=s)}return o}var J=(e,t,r)=>e[t?.[r]??r]??null,ee=e=>e!==null&&!(typeof e=="number"&&Number.isNaN(e)),mr=(e,t)=>e===null||t===null?0:e<t?-1:e>t?1:0,yr=e=>e instanceof Date?e.getTime():e??null;function pr(e){const t=e.map(Number).sort((o,i)=>o-i);if(t.length===1)return t[0]??0;const r=(t.length-1)/2,n=Math.floor(r),a=t[n]??0;return a+((t[n+1]??a)-a)*(r-n)}function hr(e){const t=new Map;for(const a of e){const o=yr(a),i=t.get(o);i===void 0?t.set(o,{value:a,count:1}):i.count++}let r=null,n=0;for(const{value:a,count:o}of t.values())o>n&&(n=o,r=a);return r}var Ar=e=>e==null||typeof e=="number"&&Number.isNaN(e),Er=e=>e instanceof Date?e.getTime():e??null,te=class F{constructor(t,r,n,a=null){this.rowShape=null,this.names=t,this.columns=r,this.rowCount=n,this.source=a}get columnCount(){return this.names.length}static from(t){const r=Object.entries(t);return new F(r.map(([n])=>n),new Map(r),r[0]?.[1].length??0)}columnNames(){return[...this.names]}hasColumn(t){return this.names.includes(t)}values(t){const r=this.columns.get(t);if(r!==void 0)return r;if(this.source===null||!this.names.includes(t))return;const n=this.source.table.values(t);if(n===void 0)return;const{indices:a}=this.source,o=new Array(a.length);for(let i=0;i<a.length;i++)o[i]=n[a[i]??0]??null;return this.columns.set(t,o),this.columns.size===this.names.length&&(this.source=null),o}assign(t,r){const n=this.gathered(),a=new Map(n.columns);a.set(t,r);const o=n.names.includes(t)?[...n.names]:[...n.names,t];return new F(o,a,n.names.length===0?r.length:n.rowCount)}select(t){const r=t.filter(a=>this.names.includes(a)),n=new Map;for(const a of r){const o=this.columns.get(a);o!==void 0&&n.set(a,o)}return new F(r,n,this.rowCount,this.source)}rename(t,r){const n=this.gathered(),a=new Map;for(const o of n.names){const i=n.columns.get(o);i!==void 0&&a.set(o===t?r:o,i)}return new F(n.names.map(o=>o===t?r:o),a,n.rowCount)}take(t){const r=this.source===null?{table:this,indices:t}:{table:this.source.table,indices:t.map(n=>this.source?.indices[n]??0)};return new F(this.names,new Map,t.length,r)}sortedIndices(t,r){const n=this.values(t);if(n===void 0)return Array.from({length:this.rowCount},(s,c)=>c);const a=[],o=[];for(let s=0;s<this.rowCount;s++)(Ar(n[s])?a:o).push(s);const i=r==="asc"?1:-1;return o.sort((s,c)=>{const f=n[s],b=n[c];return f<b?-i:f>b?i:0}),a.length===0?o:r==="asc"?[...a,...o]:[...o,...a]}partition(t){const r=t.map(o=>this.values(o)).filter(o=>o!==void 0),n=r.length===1?r[0]:void 0,a=new Map;if(n!==void 0){for(let o=0;o<this.rowCount;o++){const i=Er(n[o]),s=a.get(i);s===void 0?a.set(i,{key:$(n[o]??null),indices:[o]}):s.indices.push(o)}return[...a.values()]}for(let o=0;o<this.rowCount;o++){const i=$(r.map(c=>c[o])),s=a.get(i);s===void 0?a.set(i,{key:i,indices:[o]}):s.indices.push(o)}return[...a.values()]}fold(t,r,n){const a=this.names.filter(g=>!t.includes(g)),o=this.rowCount*t.length,i=a.map(g=>({name:g,source:this.values(g)??[],repeated:new Array(o)})),s=t.map(g=>this.values(g)??[]),c=new Array(o),f=new Array(o);let b=0;for(let g=0;g<this.rowCount;g++)for(let T=0;T<t.length;T++,b++){for(const I of i)I.repeated[b]=I.source[g]??null;c[b]=t[T]??"",f[b]=s[T]?.[g]??null}const h=new Map;for(const{name:g,repeated:T}of i)h.set(g,T);return h.set(r,c),h.set(n,f),new F([...a,r,n],h,o)}objectAt(t){const{names:r,arrays:n,template:a}=this.rowShape??this.resolveRowShape(),o={...a};for(let i=0;i<r.length;i++)o[r[i]??""]=n[i]?.[t]??null;return o}*[Symbol.iterator](){for(let t=0;t<this.rowCount;t++)yield this.objectAt(t)}resolveRowShape(){const t={};for(const r of this.names)t[r]=null;return this.rowShape={names:this.names,arrays:this.names.map(r=>this.values(r)??[]),template:t},this.rowShape}gathered(){if(this.source===null)return this;for(const t of this.names)this.values(t);return new F(this.names,new Map(this.columns),this.rowCount)}};var lt="value",x={numeric:{type:"decimal"},categorical:{type:"text"},temporal:{type:"datetime"}},me={eq:(e,t)=>e===t,neq:(e,t)=>e!==t,gt:(e,t)=>e!==null&&t!==null&&e>t,gte:(e,t)=>e!==null&&t!==null&&e>=t,lt:(e,t)=>e!==null&&t!==null&&e<t,lte:(e,t)=>e!==null&&t!==null&&e<=t},ye=e=>e===null?null:e instanceof Date?e.getTime():new Date(e).getTime(),ut=(e,t)=>e==="count"?{type:"integer"}:t,ct=(e,t,r)=>{const n=e.values(t);if(n!==void 0)return n;if(r==="count")return new Array(e.rowCount);throw new E({message:`Variable '${t}' not defined`})},K=class O{constructor(t={}){const{table:r,variableMetadata:n}=this.parseVariableMap(t);this.table=r,this.variableMetadata=n}static fromTrusted(t,r){const n=Object.create(O.prototype);return n.table=t,n.variableMetadata=r,n}size(){return this.table.rowCount}getVariableNames(){return this.table.columnNames()}hasVariable(t){return this.table.hasColumn(t)}addVariable(t,r,n,a){if(this.table.columnCount>0&&n.length!==this.size())throw new E({message:`Variable '${t}' has ${n.length} values, expected ${this.size()}`});const o={...this.variableMetadata,[t]:{type:r,valueFormat:this.resolveAddedVariableFormat(t,r,a)}},i=this.normalizeRawValues(r,n),s=this.table.assign(t,i);return O.fromTrusted(s,o)}addConstantVariable(t,r,n,a){const o={...this.variableMetadata,[t]:{type:r,valueFormat:this.resolveAddedVariableFormat(t,r,a),constant:{value:n}}},[i=null]=this.normalizeRawValues(r,[n]),s=this.table.assign(t,new Array(this.size()).fill(i));return O.fromTrusted(s,o)}getConstant(t){return this.variableMetadata[t]?.constant}deriveVariable(t,r,n,a){const o=Array.from({length:this.size()},(i,s)=>n(this.table.objectAt(s)));return this.addVariable(t,r,o,a)}deriveVariableFrom(t,r,n,a,o){const i=this.hasVariable(t)?this.getValues(t).map(a):Array.from({length:this.size()},()=>a(null));return this.addVariable(r,n,i,o)}renameVariable(t,r){const n=this.variableMetadata[t];if(!n)throw new E({message:`Variable ${t} not defined`});const a=this.table.rename(t,r),{[t]:o,...i}=this.variableMetadata,s={...i,[r]:n};return O.fromTrusted(a,s)}selectVariables(...t){const r=this.table.select(t),n=Object.fromEntries(Object.entries(this.variableMetadata).filter(([a])=>t.includes(a)));return O.fromTrusted(r,n)}getType(t){const r=this.variableMetadata[t];if(!r)throw new E({message:`Variable ${t} not defined`});return r.type}getValueFormat(t){const r=this.variableMetadata[t];if(!r)throw new E({message:`Variable ${t} not defined`});return r.valueFormat}groupVariableNamesByType(){const t={numeric:[],categorical:[],temporal:[]};for(const[r,{type:n}]of Object.entries(this.variableMetadata))t[n].push(r);return t}getValues(t,r){if(!this.hasVariable(t))throw new E({message:`Variable '${t}' not defined`});const n=this.getType(t);if(r?.type!==void 0&&n!==r.type){if(this.size()===0)return[];throw new E({message:`Variable '${t}' has type '${n}', expected '${r.type}'`})}let a=this.table.values(t)??[];return r?.distinct&&(a=this.getDistinctValues(n,a)),r?.skipNulls&&(a=this.skipNulls(a)),a}filter(t,r,n){if(this.hasVariable(t)&&this.getType(t)==="temporal")return this.filterByTimestamp(t,r,n);const a=me[r],o=this.table.values(t)??[],i=[];for(let s=0;s<o.length;s++)a(o[s]??null,n)&&i.push(s);return O.fromTrusted(this.table.take(i),this.variableMetadata)}filterByMask(t){if(t.length!==this.size())throw new E({message:`Row mask length ${t.length} does not match dataset size ${this.size()}`});const r=[];for(let n=0;n<t.length;n++)t[n]===1&&r.push(n);return O.fromTrusted(this.table.take(r),this.variableMetadata)}orderBy(t,r="asc"){const n=this.table.take(this.table.sortedIndices(t,r));return O.fromTrusted(n,this.variableMetadata)}getAt(t){return t<0||t>=this.size()?null:this.table.objectAt(t)}getFirst(){return this.getAt(0)}getLast(){return this.getAt(this.size()-1)}findFirst(t){const r=this.size();for(let n=0;n<r;n++){const a=this.table.objectAt(n);if(t(a))return a}return null}findLast(t){for(let r=this.size()-1;r>=0;r--){const n=this.table.objectAt(r);if(t(n))return n}return null}groupBy(...t){return new Or(t,this.table,this.variableMetadata)}rollup(t){const r=te.from(Object.fromEntries(Object.entries(t).map(([a,{variableName:o,aggregation:i}])=>[a,[st(i,ct(this.table,o,i))]]))),n={};for(const[a,{variableName:o,aggregation:i}]of Object.entries(t)){const s=this.variableMetadata[o],c=s?.type??"numeric",f=s?.valueFormat??x[c];n[a]={type:it(i,c),valueFormat:ut(i,f)}}return O.fromTrusted(r,n)}reshapeFromWideToLong({keep:t,reshape:r,keyName:n="key",valueName:a=lt}={}){const{numeric:o,categorical:i,temporal:s}=this.groupVariableNamesByType(),c=t??[...i,...s],f=r??o.filter(g=>!c.includes(g));if(c.includes(n)||c.includes(a))throw new V({code:"INVALID_DATA_SHAPE",message:`The variables to keep includes the variables '${n}' or '${a}' to create the key and value variables`});if(f.length===0){const g={};for(const T of c){const I=this.variableMetadata[T];I&&(g[T]={type:I.type,values:[],valueFormat:I.valueFormat})}return g[n]={type:"categorical",values:[],valueFormat:{type:"text"}},g[a]={type:"numeric",values:[],valueFormat:{type:"decimal"}},new O(g)}if(f.filter(g=>this.variableMetadata[g]?.type!=="numeric").length>0)throw new V({code:"INVALID_DATA_SHAPE",message:"Only numeric variables can be reshaped"});const b=this.table.select([...c,...f]).fold(f,n,a),h={};for(const g of c){const T=this.variableMetadata[g];T&&(h[g]=T)}return h[n]={type:"categorical",valueFormat:{type:"text"}},h[a]={type:"numeric",valueFormat:vr(this.variableMetadata,f,n)},O.fromTrusted(b,h)}print(){console.table(this.variableMetadata),console.table([...this.table])}[Symbol.iterator](){return this.table[Symbol.iterator]()}filterByTimestamp(t,r,n){const a=me[r],o=rt(n,this.getValueFormat(t),X),i=ye(o??n),s=this.getValues(t,{type:"temporal"}),c=[];for(let f=0;f<s.length;f++)a(ye(s[f]??null),i)&&c.push(f);return O.fromTrusted(this.table.take(c),this.variableMetadata)}resolveAddedVariableFormat(t,r,n){if(n!==void 0)return n;const a=this.variableMetadata[t];return a?a.valueFormat:x[r]}parseVariableMap(t){const r={},n={};for(const[a,{type:o,values:i,valueFormat:s}]of Object.entries(t))r[a]=i,n[a]={type:o,valueFormat:s??x[o]};return{table:te.from(r),variableMetadata:n}}normalizeRawValues(t,r){switch(t){case"numeric":return r.map(n=>typeof n!="number"||Number.isNaN(n)?null:n);case"categorical":return r.map(n=>typeof n!="string"?null:n);case"temporal":return r.map(n=>!(n instanceof Date)||!(0,y.isValid)(n)?null:n);default:throw new E({message:`Cannot normalize raw value of unknown type: ${t}`})}}skipNulls(t){return t.filter(r=>r!==null)}getDistinctValues(t,r){const n=t==="temporal",a=new Set,o=[];for(const i of r){const s=n&&i instanceof Date?i.getTime():i;a.has(s)||(a.add(s),o.push(i))}return o}},Or=class{constructor(e,t,r){this.groupedBy=e,this.table=t,this.variableMetadata=r}forEach(e){this.table.partition(this.groupedBy).forEach(({key:t,indices:r},n)=>{e(K.fromTrusted(this.table.take(r),this.variableMetadata),t,n)})}rollup(e){const t=this.table.partition(this.groupedBy),r={};for(const a of this.groupedBy){const o=this.table.values(a)??[];r[a]=t.map(({indices:i})=>o[i[0]??0]??null)}const n=Object.fromEntries(this.groupedBy.map(a=>{const o=this.variableMetadata[a],i=o?.type??"categorical";return[a,{type:i,valueFormat:o?.valueFormat??x[i]}]}));for(const[a,{variableName:o,aggregation:i}]of Object.entries(e)){const s=ct(this.table,o,i);r[a]=t.map(({indices:h})=>st(i,s,h));const c=this.variableMetadata[o],f=c?.type??"numeric",b=c?.valueFormat??x[f];n[a]={type:it(i,f),valueFormat:ut(i,b)}}return K.fromTrusted(te.from(r),n)}};function vr(e,t,r){const n=t.map(s=>e[s]?.valueFormat??{type:"decimal"}),[a,...o]=n;if(!a)return{type:"decimal"};for(const s of n)if(s.type==="lookup")throw new V({code:"INVALID_DATA_SHAPE",message:"Cannot reshape: a source column has a lookup format and lookups cannot nest"});if(o.every(s=>(0,Me.isEqual)(s,a))||a.type==="lookup")return a;const i={};for(const[s,c]of t.entries()){const f=$([c]),b=n[s];b&&b.type!=="lookup"&&(i[f]=b)}return{type:"lookup",byVariable:r,cases:i,fallback:a}}var dt=class{constructor(e){this.label=e,this.items=new Map}register(e,t){return this.items.set(e,t),this}get(e){if(!this.items.has(e)){const t=[...this.items.keys()].map(r=>`'${r}'`).join(", ");throw new V({code:"UNKNOWN_REGISTERED_TYPE",message:`Unknown ${this.label}: '${e}' (available: ${t})`,context:{kind:this.label,requested:e,available:[...this.items.keys()]},suggestion:`Register a custom ${this.label} named '${e}' in the \`plugins\` array, or use one of: ${t}.`})}return this.items.get(e)}getAll(){return[...this.items.values()]}has(e){return this.items.has(e)}},Tr=(e,t)=>{const r=typeof e=="string"?e.trim():e;if(N(r))return{type:"decimal"};const n=typeof r=="string"&&He(r,t);if(n)return n;const a=typeof r=="string"&&er(r,t);return a||(Ge(e)?{type:"date"}:Ve(e)?{type:"percentage"}:qe(e)&&typeof e=="string"?{type:"currency",iso:nr(e)}:{type:"text"})},_r={type:"year",dateFormat:"yyyy"},Mr={type:"text"},ft=e=>{const t=e._metadata?.parsingLocale??"en-GB",r={},n=Fr(e),a=Dr(e),o=n.size>0;for(const[i,s]of e.columns.entries()){if(s._metadata?.isHidden)continue;const c=n.get(s.key);if(k(c)&&o)continue;const f=k(c)?Mr:i===a?_r:Tr(c,t),b=je(f);r[s.key]=Sr(s.key,e.rows,f,b,t)}return new K(r)},Lr=class extends ot{dependencies(e){return[e]}run(e){return ft(e)}},Dr=e=>{const t=Pr(e.rows,5);return e.columns.findIndex(r=>{const n=t.map(a=>a[r.key]).filter(a=>!k(a));return n.length>=2&&n.every(Jt)})},Sr=(e,t,r,n,a)=>({type:n,values:t.reduce((o,i)=>(Je(i)||o.push(ce(i[e],r,a)),o),[]),valueFormat:r}),Fr=e=>{const t=new Map,r=new Set(e.columns.map(n=>n.key));for(const n of e.rows){for(const a of r){const o=n[a];k(o)||(t.set(a,o),r.delete(a))}if(r.size===0)break}return t},Pr=(e,t)=>{const r=[];for(const n of e)if(Je(n)||r.push(n),r.length===t)return r;return r},Rr=["observation","category","aggregate"],Nr=["inside","outside"],wr=["top","right","bottom","left"],Ir=["heading","label","value","primaryRow"],kr=["link"],jr=["h1","h2"],Cr=["number","numberCenter","caption","label","swatch","trend","trendUp","trendDown","trendFlat"],xr=["swatch"],Vr=["popover"],Br=["shape","arrow","differenceArrow","text","image","pinnedNumber","comment"],Ur={differenceArrow:["label"],pinnedNumber:["label"],comment:["label"]},Wr=["dimmed","hovered"],zr=e=>typeof e=="object"&&e!==null&&typeof e.light=="string"&&typeof e.dark=="string",Gr=e=>typeof e=="object"&&e!==null&&typeof e.token=="string";function Hr(e){return{type:"styles",...e}}function d(e){return{token:e}}var P=e=>{const t={...e?.where===void 0?{}:{where:e.where},...e?.state===void 0?{}:{state:e.state}};return{...e?.id===void 0?{}:{id:e.id},...Object.keys(t).length===0?{}:{when:t}}},S=e=>e?.layer===void 0?{}:{layer:e.layer},l=e=>e?.id===void 0?{}:{id:e.id},_=e=>e?.annotation===void 0?{}:{annotation:e.annotation},u={geom:Object.assign((e,t)=>({...P(t),select:{target:"geom",...S(t)},declarations:e}),{bar:(e,t)=>({...P(t),select:{target:"geom",kind:"bar",...S(t)},declarations:e}),line:(e,t)=>({...P(t),select:{target:"geom",kind:"line",...S(t)},declarations:e}),area:(e,t)=>({...P(t),select:{target:"geom",kind:"area",...S(t)},declarations:e}),point:(e,t)=>({...P(t),select:{target:"geom",kind:"point",...S(t)},declarations:e}),rule:Object.assign((e,t)=>({...P(t),select:{target:"geom",kind:"rule",...S(t)},declarations:e}),{label:(e,t)=>({...l(t),select:{target:"ruleLabel",...S(t)},declarations:e})}),tile:(e,t)=>({...P(t),select:{target:"geom",kind:"tile",...S(t)},declarations:e})}),panelBorder:Object.assign((e,t)=>({...l(t),select:{target:"panelBorder"},declarations:e}),{top:(e,t)=>({...l(t),select:{target:"panelBorder",edge:"top"},declarations:e}),right:(e,t)=>({...l(t),select:{target:"panelBorder",edge:"right"},declarations:e}),bottom:(e,t)=>({...l(t),select:{target:"panelBorder",edge:"bottom"},declarations:e}),left:(e,t)=>({...l(t),select:{target:"panelBorder",edge:"left"},declarations:e})}),gridLine:Object.assign((e,t)=>({...l(t),select:{target:"gridLine"},declarations:e}),{x:(e,t)=>({...l(t),select:{target:"gridLine",axis:"x"},declarations:e}),y:(e,t)=>({...l(t),select:{target:"gridLine",axis:"y"},declarations:e})}),tickLine:Object.assign((e,t)=>({...l(t),select:{target:"tickLine"},declarations:e}),{x:(e,t)=>({...l(t),select:{target:"tickLine",axis:"x"},declarations:e}),y:(e,t)=>({...l(t),select:{target:"tickLine",axis:"y"},declarations:e})}),axisLabel:Object.assign((e,t)=>({...l(t),select:{target:"axisLabel"},declarations:e}),{x:(e,t)=>({...l(t),select:{target:"axisLabel",axis:"x"},declarations:e}),y:(e,t)=>({...l(t),select:{target:"axisLabel",axis:"y"},declarations:e}),top:(e,t)=>({...l(t),select:{target:"axisLabel",edge:"top"},declarations:e}),right:(e,t)=>({...l(t),select:{target:"axisLabel",edge:"right"},declarations:e}),bottom:(e,t)=>({...l(t),select:{target:"axisLabel",edge:"bottom"},declarations:e}),left:(e,t)=>({...l(t),select:{target:"axisLabel",edge:"left"},declarations:e})}),tickLabel:Object.assign((e,t)=>({...l(t),select:{target:"tickLabel"},declarations:e}),{x:(e,t)=>({...l(t),select:{target:"tickLabel",axis:"x"},declarations:e}),y:(e,t)=>({...l(t),select:{target:"tickLabel",axis:"y"},declarations:e}),top:(e,t)=>({...l(t),select:{target:"tickLabel",edge:"top"},declarations:e}),right:(e,t)=>({...l(t),select:{target:"tickLabel",edge:"right"},declarations:e}),bottom:(e,t)=>({...l(t),select:{target:"tickLabel",edge:"bottom"},declarations:e}),left:(e,t)=>({...l(t),select:{target:"tickLabel",edge:"left"},declarations:e})}),dataLabel:Object.assign((e,t)=>({...l(t),select:{target:"dataLabel"},declarations:e}),{observation:Object.assign((e,t)=>({...l(t),select:{target:"dataLabel",role:"observation"},declarations:e}),{inside:(e,t)=>({...l(t),select:{target:"dataLabel",role:"observation",position:"inside"},declarations:e}),outside:(e,t)=>({...l(t),select:{target:"dataLabel",role:"observation",position:"outside"},declarations:e})}),category:Object.assign((e,t)=>({...l(t),select:{target:"dataLabel",role:"category"},declarations:e}),{inside:(e,t)=>({...l(t),select:{target:"dataLabel",role:"category",position:"inside"},declarations:e}),outside:(e,t)=>({...l(t),select:{target:"dataLabel",role:"category",position:"outside"},declarations:e})}),aggregate:(e,t)=>({...l(t),select:{target:"dataLabel",role:"aggregate"},declarations:e})}),graph:(e,t)=>({...l(t),select:{target:"graph"},declarations:e}),heading:Object.assign((e,t)=>({...l(t),select:{target:"heading"},declarations:e}),{h1:(e,t)=>({...l(t),select:{target:"heading",part:"h1"},declarations:e}),h2:(e,t)=>({...l(t),select:{target:"heading",part:"h2"},declarations:e})}),caption:(e,t)=>({...l(t),select:{target:"caption"},declarations:e}),source:Object.assign((e,t)=>({...l(t),select:{target:"source"},declarations:e}),{link:(e,t)=>({...l(t),select:{target:"source",part:"link"},declarations:e})}),header:(e,t)=>({...l(t),select:{target:"header"},declarations:e}),footer:(e,t)=>({...l(t),select:{target:"footer"},declarations:e}),hoverGuide:(e,t)=>({...l(t),select:{target:"hoverGuide"},declarations:e}),tooltip:Object.assign((e,t)=>({...l(t),select:{target:"tooltip"},declarations:e}),{heading:(e,t)=>({...l(t),select:{target:"tooltip",part:"heading"},declarations:e}),label:(e,t)=>({...l(t),select:{target:"tooltip",part:"label"},declarations:e}),value:(e,t)=>({...l(t),select:{target:"tooltip",part:"value"},declarations:e}),primaryRow:(e,t)=>({...l(t),select:{target:"tooltip",part:"primaryRow"},declarations:e})}),headline:(e,t)=>({...l(t),select:{target:"headline"},declarations:e}),headlineItem:{number:Object.assign((e,t)=>({...l(t),select:{target:"headlineItem",part:"number"},declarations:e}),{center:(e,t)=>({...l(t),select:{target:"headlineItem",part:"numberCenter"},declarations:e})}),caption:(e,t)=>({...l(t),select:{target:"headlineItem",part:"caption"},declarations:e}),label:(e,t)=>({...l(t),select:{target:"headlineItem",part:"label"},declarations:e}),swatch:(e,t)=>({...l(t),select:{target:"headlineItem",part:"swatch"},declarations:e}),trend:Object.assign((e,t)=>({...l(t),select:{target:"headlineItem",part:"trend"},declarations:e}),{up:(e,t)=>({...l(t),select:{target:"headlineItem",part:"trendUp"},declarations:e}),down:(e,t)=>({...l(t),select:{target:"headlineItem",part:"trendDown"},declarations:e}),flat:(e,t)=>({...l(t),select:{target:"headlineItem",part:"trendFlat"},declarations:e})})},legend:Object.assign((e,t)=>({...l(t),select:{target:"legend"},declarations:e}),{popover:(e,t)=>({...l(t),select:{target:"legend",part:"popover"},declarations:e}),top:(e,t)=>({...l(t),select:{target:"legend",edge:"top"},declarations:e}),right:(e,t)=>({...l(t),select:{target:"legend",edge:"right"},declarations:e}),bottom:(e,t)=>({...l(t),select:{target:"legend",edge:"bottom"},declarations:e}),left:(e,t)=>({...l(t),select:{target:"legend",edge:"left"},declarations:e})}),legendItem:Object.assign((e,t)=>({...l(t),select:{target:"legendItem"},declarations:e}),{swatch:(e,t)=>({...l(t),select:{target:"legendItem",part:"swatch"},declarations:e})}),directLabel:(e,t)=>({...l(t),select:{target:"directLabel"},declarations:e}),annotation:Object.assign((e,t)=>({...l(t),select:{target:"annotation",..._(t)},declarations:e}),{shape:(e,t)=>({...l(t),select:{target:"annotation",kind:"shape",..._(t)},declarations:e}),arrow:(e,t)=>({...l(t),select:{target:"annotation",kind:"arrow",..._(t)},declarations:e}),differenceArrow:Object.assign((e,t)=>({...l(t),select:{target:"annotation",kind:"differenceArrow",..._(t)},declarations:e}),{label:(e,t)=>({...l(t),select:{target:"annotation",kind:"differenceArrow",part:"label",..._(t)},declarations:e})}),text:(e,t)=>({...l(t),select:{target:"annotation",kind:"text",..._(t)},declarations:e}),image:(e,t)=>({...l(t),select:{target:"annotation",kind:"image",..._(t)},declarations:e}),pinnedNumber:Object.assign((e,t)=>({...l(t),select:{target:"annotation",kind:"pinnedNumber",..._(t)},declarations:e}),{label:(e,t)=>({...l(t),select:{target:"annotation",kind:"pinnedNumber",part:"label",..._(t)},declarations:e})}),comment:Object.assign((e,t)=>({...l(t),select:{target:"annotation",kind:"comment",..._(t)},declarations:e}),{label:(e,t)=>({...l(t),select:{target:"annotation",kind:"comment",part:"label",..._(t)},declarations:e})})})},gt="#B84737",bt=.4,Yr="sm",$r=2,Kr=8,Xr=12,re=Object.freeze({light:"#F5F1E9",dark:"#1F1E1C"}),mt="#ffffff",qr=1,Qr=24,Zr={top:24,right:24,bottom:24,left:24},pe=1,Jr=.3,en=10,tn=24,rn=8,he=Object.freeze({light:"#898373",dark:"#9F9886"}),p={label:{fontWeight:500,fontSize:11.5,lineHeight:1},dataLabelOutside:{fontWeight:600,fontSize:12.5,lineHeight:1},tooltipHeading:{fontSize:12.5,fontWeight:700,lineHeight:1.3},tooltipRow:{fontSize:12.5,fontWeight:500,lineHeight:1.43},heading:{fontWeight:600,fontSize:18,lineHeight:1.25},subtitle:{fontWeight:500,fontSize:15,lineHeight:1.47},caption:{fontWeight:500,fontSize:12,lineHeight:1.3},source:{fontWeight:500,fontSize:12,lineHeight:1.3},sourceLink:{fontWeight:400,fontSize:12,lineHeight:1.3}},nn={graphBackground:re,graphBorder:Object.freeze({light:"rgba(58, 56, 51, 0.15)",dark:"rgba(237, 231, 218, 0.15)"}),geom:gt,geomBorder:Object.freeze({light:"rgba(58, 56, 51, 0.55)",dark:"rgba(237, 231, 218, 0.55)"}),textPrimary:Object.freeze({light:"#3A3833",dark:"#EDE7DA"}),textSecondary:he,ruleLine:Object.freeze({light:"#3A3833",dark:"#EDE7DA"}),gridLine:Object.freeze({light:"#E1DAC9",dark:"#373531"}),hoverAffordance:mt,hoverGuideFill:Object.freeze({light:"#E7E1D2",dark:"#2B2A27"}),hoverGuideLine:Object.freeze({light:"#D5CDBA",dark:"#3B3934"}),tooltipBackground:Object.freeze({light:"#FCFCF9",dark:"#262522"}),tooltipBorder:Object.freeze({light:"rgba(58, 56, 51, 0.15)",dark:"rgba(237, 231, 218, 0.15)"}),tooltipPrimaryRow:Object.freeze({light:"#F5F1E9",dark:"#2E2C29"}),annotationShape:Object.freeze({light:"#3b82f6",dark:"#60a5fa"}),annotationArrow:Object.freeze({light:"#3A3833",dark:"#EDE7DA"}),differenceLabelBackground:re,trendPositive:{light:"#06B299",dark:"#0AC600"},trendNegative:{light:"#E14B49",dark:"#CB3333"},trendNeutral:he},Ae={color:d("gridLine"),strokeWidth:1,lineType:"dashed"},Ee={color:d("textPrimary"),size:8,borderColor:d("tooltipBackground"),borderWidth:2,shadow:{offsetX:0,offsetY:1,blur:1.5,color:"rgba(14, 14, 52, 0.18)"}},Oe={fontSize:12,fontWeight:500,lineHeight:1.3,textColor:d("textPrimary"),background:d("tooltipBackground"),borderColor:d("tooltipBorder"),borderWidth:1,borderRadius:6,paddingInline:7,paddingBlock:4,shadow:{offsetX:0,offsetY:2,blur:6,color:"rgba(0, 0, 0, 0.12)"}},yt=[u.geom({color:d("geom"),alpha:1}),u.geom.bar({borderRadius:"sm",borderWidth:pe,borderColor:d("geomBorder")}),u.geom.line({strokeWidth:2,lineType:"solid"}),u.geom.area({alpha:Jr,strokeWidth:2,lineType:"solid",strokeAlpha:1}),u.geom.point({size:8,borderColor:d("hoverAffordance"),borderWidth:pe}),u.geom.rule({color:d("ruleLine"),strokeWidth:1,lineType:"dashed"}),u.geom.tile({borderRadius:8,borderWidth:0}),u.geom({alpha:bt},{state:"dimmed"}),u.geom.point({borderColor:d("hoverAffordance")},{state:"hovered"}),u.geom.bar({borderColor:d("hoverAffordance")},{state:"hovered"}),u.geom.tile({borderColor:d("hoverAffordance"),borderWidth:2},{state:"hovered"}),u.hoverGuide({color:d("hoverGuideLine"),background:d("hoverGuideFill")}),u.panelBorder({...Ae,borderRadius:6}),u.gridLine.y({...Ae}),u.tickLine({strokeWidth:0,length:0}),u.graph({background:d("graphBackground"),borderWidth:1,borderColor:d("graphBorder"),borderRadius:8,textScale:1,padding:24}),u.heading({textColor:d("textPrimary")}),u.heading.h1({...p.heading}),u.heading.h2({...p.subtitle}),u.caption({...p.caption,textColor:d("textPrimary")}),u.source({...p.source,textColor:d("textSecondary")}),u.source.link({...p.sourceLink,textColor:d("textSecondary")}),u.header({margin:{bottom:10}}),u.axisLabel({...p.label,textColor:d("textPrimary")}),u.axisLabel.top({margin:{bottom:8}}),u.axisLabel.bottom({margin:{top:4,bottom:16}}),u.tickLabel({...p.label,textColor:d("textSecondary"),offset:en}),u.tickLabel.left({offset:14}),u.tickLabel.right({offset:14}),u.geom.rule.label({...p.label}),u.dataLabel({...p.label,textColor:d("textPrimary"),paddingInline:6,paddingBlock:2,borderRadius:4}),u.dataLabel.aggregate({...p.dataLabelOutside}),u.dataLabel.observation.inside({textColor:"#FFFFFF"}),u.dataLabel.category.inside({textColor:"#FFFFFF"}),u.dataLabel.observation.outside({...p.dataLabelOutside}),u.dataLabel.category.outside({...p.dataLabelOutside}),u.tooltip({background:d("tooltipBackground"),borderColor:d("tooltipBorder"),borderWidth:1,borderRadius:6,paddingBlock:8,paddingInline:10,shadow:{offsetX:0,offsetY:4,blur:12,color:"rgba(0, 0, 0, 0.18)"}}),u.tooltip.heading({...p.tooltipHeading,textColor:d("textPrimary")}),u.tooltip.label({...p.tooltipRow,textColor:d("textPrimary")}),u.tooltip.value({...p.tooltipRow,textColor:d("textSecondary")}),u.tooltip.primaryRow({background:d("tooltipPrimaryRow")}),u.headline({gap:tn,margin:{bottom:4}}),u.headlineItem.number({fontSize:26,fontWeight:700,lineHeight:1.3,textColor:d("textPrimary")}),u.headlineItem.caption({fontSize:12,textColor:d("textSecondary")}),u.headlineItem.label({fontSize:12,textColor:d("textSecondary")}),u.headlineItem.swatch({size:12}),u.headlineItem.trend({fontSize:12}),u.headlineItem.trend.up({textColor:d("trendPositive")}),u.headlineItem.trend.down({textColor:d("trendNegative")}),u.headlineItem.trend.flat({textColor:d("trendNeutral")}),u.legend({gap:rn}),u.legend.popover({background:d("tooltipBackground"),borderColor:d("tooltipBorder"),borderWidth:1,borderRadius:6,paddingBlock:8,paddingInline:10,shadow:{offsetX:0,offsetY:4,blur:12,color:"rgba(0, 0, 0, 0.18)"}}),u.legend.top({margin:{bottom:8}}),u.legend.bottom({margin:{top:16,bottom:10}}),u.legend.left({margin:{right:10}}),u.legend.right({margin:{left:10}}),u.footer({margin:{top:16}}),u.legendItem({...p.label,textColor:d("textSecondary"),borderWidth:0,paddingInline:2,paddingBlock:4}),u.legendItem.swatch({size:12,strokeWidth:2}),u.directLabel({fontSize:12,fontWeight:500,lineHeight:1.3,textColor:d("textPrimary"),strokeWidth:1,lineType:"dashed"}),u.annotation.shape({color:d("annotationShape"),alpha:.25,borderWidth:1}),u.annotation.arrow({color:d("annotationArrow"),strokeWidth:4,lineType:"solid",borderWidth:0,shadow:"none"}),u.annotation.differenceArrow({color:d("annotationArrow"),strokeWidth:2}),u.annotation.differenceArrow.label({...p.label,textColor:d("textPrimary"),background:d("differenceLabelBackground"),borderWidth:1,borderRadius:4,paddingInline:6,paddingBlock:3}),u.annotation.text({background:"transparent",alpha:1,borderWidth:1.5,borderRadius:9,paddingInline:6,paddingBlock:3,fontSize:15,fontWeight:500,lineHeight:1.25,textColor:d("textPrimary")}),u.annotation.image({alpha:1,borderRadius:0}),u.annotation.pinnedNumber(Ee),u.annotation.pinnedNumber.label(Oe),u.annotation.comment(Ee),u.annotation.comment.label(Oe)];for(const e of yt){Object.freeze(e.select);for(const t of Object.values(e.declarations))typeof t=="object"&&Object.freeze(t);Object.freeze(e.declarations),e.when!==void 0&&Object.freeze(e.when),Object.freeze(e)}var an=Object.freeze({tokens:Object.freeze(nn),defaults:Object.freeze(yt),overrides:Object.freeze([])}),on=class{constructor(){this.transformType="aggregate"}apply(e,t){const{options:r}=t,n={};for(const a of r.operations)n[a.as]={variableName:a.variableName,aggregation:a.op};return e.groupBy(...r.groupby).rollup(n)}},sn=class{constructor(){this.transformType="constant"}apply(e,t){const{options:r}=t;return e.addConstantVariable(r.variableName,r.type,r.value)}getIntroducedVariables(e){const{options:t}=e;return[t.variableName]}},ln=class{constructor(){this.transformType="filter"}apply(e,t){const{options:r}=t;return e.filter(r.variableName,r.operator,r.value)}},un=class{constructor(){this.transformType="reshape"}apply(e,t){const{options:r}=t;return e.reshapeFromWideToLong({keep:r.keep,reshape:r.reshape,keyName:r.keyName,valueName:r.valueName})}getIntroducedVariables(e){const{options:t}=e;return[t.keyName??"key"]}},cn=class{constructor(){this.transformType="sort"}apply(e,t){const{options:r}=t;return e.orderBy(r.variableName,r.direction??"asc")}},dn=[new on,new sn,new ln,new un,new cn],fn=class extends dt{constructor(){super("transform");for(const e of dn)this.register(e.transformType,e)}},gn=["brick","gray","red","orange","yellow","green","cyan","blue","purple","pink"],bn=["cyan","pink","purple","red","orange","yellow","green","blue"],pt=["#B84737","#BA7420","#0B8666","#3D63A8","#DD9583","#E2BF6B","#95CBA6","#AABCE5"],ht="brick",L={red:"#E83562",orange:"#F38650",yellow:"#FBBC30",green:"#31FCB4",cyan:"#40F8FF",blue:"#279EFF",purple:"#B399FD",dark_purple:"#6D48D2",plum:"#C82184",pink:"#FC8497"},mn=[L.purple,L.pink,L.yellow,L.blue,L.red,L.cyan,L.orange,L.plum,L.green,L.dark_purple],M={green:"#B2DDC9",cyan:"#A2D5E2",blue:"#AAC4FF",purple:"#B2A4FF",plum:"#DCA8C7",pink:"#FFCCD3",red:"#FFADAD",orange:"#FFDEB4",yellow:"#FDF7C3"},yn=[M.green,M.purple,M.red,M.cyan,M.pink,M.blue,M.orange,M.plum,M.yellow],U={brick900:"#6E0500",brick800:"#881D11",brick700:"#A03522",brick600:"#B0523B",brick500:"#C06D56",brick400:"#CE8772",brick300:"#DBA28E",brick200:"#E7BDAC",brick100:"#F2D8CB",brick50:"#FCF4EA",gray900:"#1c1917",gray800:"#292524",gray700:"#44403c",gray600:"#57534e",gray500:"#78716c",gray400:"#a8a29e",gray300:"#d6d3d1",gray200:"#e7e5e4",gray100:"#f5f5f4",gray50:"#fafaf9",red900:"#7f1d1d",red800:"#991b1b",red700:"#b91c1c",red600:"#dc2626",red500:"#ef4444",red400:"#f87171",red300:"#fca5a5",red200:"#fecaca",red100:"#fee2e2",red50:"#fef2f2",orange900:"#7c2d12",orange800:"#9a3412",orange700:"#c2410c",orange600:"#ea580c",orange500:"#f97316",orange400:"#fb923c",orange300:"#fdba74",orange200:"#fed7aa",orange100:"#ffedd5",orange50:"#fff7ed",yellow900:"#553B0C",yellow800:"#6F4B08",yellow700:"#8D6300",yellow600:"#BD8A00",yellow500:"#E5B400",yellow400:"#FFC800",yellow300:"#FBDA2B",yellow200:"#FEED72",yellow100:"#FEF8B4",yellow50:"#FEFCE2",green900:"#064e3b",green800:"#065f46",green700:"#047857",green600:"#059669",green500:"#10b981",green400:"#34d399",green300:"#6ee7b7",green200:"#a7f3d0",green100:"#d1fae5",green50:"#ecfdf5",cyan900:"#164e63",cyan800:"#155e75",cyan700:"#0e7490",cyan600:"#0891B2",cyan500:"#06b6d4",cyan400:"#22d3ee",cyan300:"#67e8f9",cyan200:"#a5f3fc",cyan100:"#cffafe",cyan50:"#ecfeff",blue900:"#1e3a8a",blue800:"#1e40af",blue700:"#1d4ed8",blue600:"#2563eb",blue500:"#3b82f6",blue400:"#60a5fa",blue300:"#93c5fd",blue200:"#bfdbfe",blue100:"#dbeafe",blue50:"#eff6ff",purple900:"#4c1d95",purple800:"#5b21b6",purple700:"#6d28d9",purple600:"#7c3aed",purple500:"#8b5cf6",purple400:"#a78bfa",purple300:"#c4b5fd",purple200:"#ddd6fe",purple100:"#ede9fe",purple50:"#f5f3ff",pink900:"#751A5E",pink800:"#8F1972",pink700:"#AF1C8A",pink600:"#D326A8",pink500:"#E845BF",pink400:"#F979D9",pink300:"#FCABE8",pink200:"#FED0F3",pink100:"#FFE8F9",pink50:"#FFF4FC"},pn=[U.brick100,U.brick900],hn=[U.gray200,M.green,M.red,U.gray200],ve={dark:{1:[500],2:[600,400],3:[600,400,200],4:[600,500,300,100],5:[700,600,400,200,50],6:[600,500,400,300,200,100],7:[600,500,400,300,200,100,50],default:[700,600,500,400,300,200,100,50]},light:{1:[600],2:[700,500],3:[800,600,400],4:[800,600,400,300],5:[800,700,600,500,400],6:[800,700,600,500,400,300],7:[900,800,700,600,500,400,300],default:[900,800,700,600,500,400,300,200]}},v={cyan:"#22D3EE",pink:"#F377EF",purple:"#6528F7",red:"#FB2576",orange:"#FF9300",yellow:"#FBFF00",green:"#06FF00",blue:"#0079FF"},W=[v.cyan,v.pink,v.purple,v.red,v.orange,v.yellow,v.green,v.blue],An=[v.cyan,v.green,v.red,v.cyan],z={start:"#84D1FC",positive:"#84FC89",negative:"#FC8497",total:"#84D1FC"},En=[z.start,z.positive,z.negative,z.total],On={transform:"linear",reverse:!1,nice:!0,zero:!1,domainMin:null,domainMax:null,range:null,scheme:null,interpolate:"lab",domainMid:null,symmetric:!1},vn={size:[4,20],alpha:[.1,1],strokeWidth:[1,4]},Tn={domainMin:null,domainMax:null,nice:!1,reverse:!1},_n={range:null,domain:null,padding:.1,reverse:!1},Te={palette:{type:"default"}};function _e(e,t="light",r){return((r!==void 0?ve[t][r]:void 0)??ve[t].default).map(n=>U[`${e}${n}`])}function Mn(e){const t=W.indexOf(v[e]);return t<=0?W:[...W.slice(t),...W.slice(0,t)]}function Ln(e,t={}){switch(e.type){case"default":return t.hasTouchingGeoms?_e(ht,t.colorScheme??"light",t.groupCount):pt;case"graphy":return e.variant==="waterfall"?En:mn;case"pastel":return e.variant==="waterfall"?hn:yn;case"neon":return e.variant==="waterfall"?An:Mn(e.base);case"mono":return _e(e.base,e.variant??"light",t.groupCount);case"custom":return e.colors}}function Dn(e,t){if(!t)return e;const r=[...e];for(const[n,a]of Object.entries(t)){const o=Number(n);if(!Number.isInteger(o)||o<1)continue;const i=o-1;i<r.length&&(r[i]=a)}return r}function Sn(e,t,r,n){if(!t)return;const a=r?.type==="custom"?n[r.id]:void 0,o={};for(const[i,s]of Object.entries(t)){const c=Number(i);if(!(!Number.isInteger(c)||c<1)){if(s.hex!==void 0){o[c]=s.hex;continue}if(s.id!==void 0){const f=a?.find(b=>b.id===s.id)?.hex;f!==void 0?o[c]=f:e.diagnostics.addWarning({code:"PALETTE_NOT_FOUND",message:`Palette override at slot ${c} with id '${s.id}' did not resolve against the active palette — falling back to palette color.`,context:{requested:s.id,available:a?.map(b=>b.id)??[]},suggestion:"Define the override id in the active custom palette, or use a hex value instead."})}}}return Object.keys(o).length>0?o:void 0}function Fn(e,t,r){if(!t)return Te.palette;if(t.type==="custom"){const n=r[t.id];if(!n)return e.diagnostics.addWarning({code:"PALETTE_NOT_FOUND",message:`Custom palette with id "${t.id}" not found — falling back to the default palette.`,context:{requested:t.id,available:Object.keys(r)},suggestion:"Register the palette in customPalettes, or reference an existing palette id."}),Te.palette;const a=n.map(o=>o.hex);return{type:"custom",id:t.id,colors:a}}return t}function A(e,t={}){const r=t;return{type:"scale",scaledAesthetic:e,scaleType:"continuous",transform:t.transform,reverse:t.reverse,nice:t.nice,zero:t.zero,clamp:t.clamp,domainMin:t.domainMin??null,domainMax:t.domainMax??null,range:t.range,scheme:r.scheme??null,interpolate:r.interpolate,domainMid:r.domainMid??null,symmetric:r.symmetric}}function G(e,t={}){return{type:"scale",scaledAesthetic:e,scaleType:"datetime",domainMin:t.domainMin??null,domainMax:t.domainMax??null,nice:t.nice,reverse:t.reverse,clamp:t.clamp}}function D(e,t={}){return{type:"scale",scaledAesthetic:e,scaleType:"discrete",range:t.range,domain:t.domain??null,padding:t.padding,reverse:t.reverse}}function C(e,t={}){return{type:"scale",scaledAesthetic:e,scaleType:"identity"}}function H(e,t){return{type:"scale",scaledAesthetic:e,scaleType:"inferred",options:t}}function At(e,t={}){return{type:"scale",scaledAesthetic:e,scaleType:"palette",palette:t.palette,overrides:t.overrides}}var Pn={labelCrossPosition:.5},Rn={kind:"rectangle",zOrder:"foreground"},Nn={zOrder:"foreground",fit:"contain"},wn={x:8,y:8,unit:"px"},In={align:"center"},kn={startArrowheadStyle:"none",endArrowheadStyle:"line-arrow"},jn={thin:2,medium:4,thick:8},Cn=.5,xn={borderWidth:2,shadow:{offsetX:0,offsetY:1.15,blur:1.15,color:"rgba(0, 0, 0, 0.16)"}},Vn={small:{arrow:{strokeWidth:2},label:{fontSize:12,fontWeight:500,paddingInline:6,paddingBlock:3,borderWidth:1}},medium:{arrow:{strokeWidth:3},label:{fontSize:16,fontWeight:500,paddingInline:8,paddingBlock:4,borderWidth:1.5}},large:{arrow:{strokeWidth:5},label:{fontSize:20,fontWeight:600,paddingInline:10,paddingBlock:5,borderWidth:2}}},Et=["none","xs","sm","md","lg","xl","full"],Bn={point:Wn,line:zn,area:Gn,bar:Hn,rule:Yn,tile:$n},Un=e=>typeof e=="string"&&Et.includes(e);function w(e,t){return{type:"layer",id:t.id,geom:e,mapping:t.aes,stat:t.stat,params:t.params,position:t.position,yScaleType:t.yScaleType,transforms:t.transforms,interactive:t.interactive,dataLabels:t.dataLabels}}function Wn(e={}){return w("point",e)}function zn(e={}){return w("line",e)}function Gn(e={}){return w("area",e)}function Hn(e={}){return w("bar",e)}function Yn(e={}){return w("rule",e)}function $n(e={}){return w("tile",e)}var Ot=["grouped-bars","stacked-bars","lines"],vt={"grouped-bars":"dodge","stacked-bars":"stack",lines:null},Kn=e=>e==="identity"?"grouped-bars":Ot.find(t=>vt[t]===e)??null,Xn={cartesian:(e={})=>({type:"coord",coordType:"cartesian",params:e}),flip:(e={})=>({type:"coord",coordType:"flip",params:e}),polar:(e={})=>({type:"coord",coordType:"polar",params:e})},qn={x:Object.assign(e=>H("x",e),{continuous:e=>A("x",e),discrete:e=>D("x",e),datetime:e=>G("x",e),log:e=>A("x",{...e,transform:"log"}),sqrt:e=>A("x",{...e,transform:"sqrt"})}),y:Object.assign(e=>H("y",e),{continuous:e=>A("y",e),discrete:e=>D("y",e),datetime:e=>G("y",e),log:e=>A("y",{...e,transform:"log"}),sqrt:e=>A("y",{...e,transform:"sqrt"})}),ySecondary:Object.assign(e=>H("ySecondary",e),{continuous:e=>A("ySecondary",e),discrete:e=>D("ySecondary",e),datetime:e=>G("ySecondary",e),log:e=>A("ySecondary",{...e,transform:"log"}),sqrt:e=>A("ySecondary",{...e,transform:"sqrt"})}),color:{continuous:e=>A("color",e),discrete:e=>D("color",e),palette:e=>At("color",e)},size:{continuous:e=>A("size",e),discrete:e=>D("size",e),identity:e=>C("size",e)},alpha:{continuous:e=>A("alpha",e),discrete:e=>D("alpha",e),identity:e=>C("alpha",e)},strokeWidth:{continuous:e=>A("strokeWidth",e),discrete:e=>D("strokeWidth",e),identity:e=>C("strokeWidth",e)},lineType:{discrete:e=>D("lineType",e),identity:e=>C("lineType",e)}},Qn={identity:Jn,count:ea,smooth:Zn,mean:ta,sum:ra};function Zn(e){return{type:"smooth",method:e.method,order:e.order,bandwidth:e.bandwidth}}function Jn(){return{type:"identity"}}function ea(){return{type:"count"}}function ta(){return{type:"mean"}}function ra(){return{type:"sum"}}var na={reshape:aa,filter:oa,sort:ia,aggregate:sa,constant:la};function aa(e={}){return{type:"transform",transformType:"reshape",options:e}}function oa(e){return{type:"transform",transformType:"filter",options:e}}function ia(e){return{type:"transform",transformType:"sort",options:e}}function sa(e){return{type:"transform",transformType:"aggregate",options:e}}function la(e){return{type:"transform",transformType:"constant",options:e}}function ua(e){return{type:"config",config:e}}Object.defineProperty(exports,"ANNOTATION_PARTS",{enumerable:!0,get:function(){return Ur}});Object.defineProperty(exports,"ANNOTATION_STYLE_KINDS",{enumerable:!0,get:function(){return Br}});Object.defineProperty(exports,"ARROW_DEFAULTS",{enumerable:!0,get:function(){return kn}});Object.defineProperty(exports,"ARROW_STICKER_DECLARATIONS",{enumerable:!0,get:function(){return xn}});Object.defineProperty(exports,"ARROW_STROKE_WIDTHS",{enumerable:!0,get:function(){return jn}});Object.defineProperty(exports,"BORDER_RADIUS_TOKENS",{enumerable:!0,get:function(){return Et}});Object.defineProperty(exports,"BUILTIN_STYLES",{enumerable:!0,get:function(){return an}});Object.defineProperty(exports,"COMBO_BAR_POSITIONS",{enumerable:!0,get:function(){return vt}});Object.defineProperty(exports,"COMBO_TYPES",{enumerable:!0,get:function(){return Ot}});Object.defineProperty(exports,"CONSTANT_VARIABLES",{enumerable:!0,get:function(){return ae}});Object.defineProperty(exports,"CONTINUOUS_SCALE_DEFAULTS",{enumerable:!0,get:function(){return On}});Object.defineProperty(exports,"ChronologicalDateManager",{enumerable:!0,get:function(){return Ce}});Object.defineProperty(exports,"DATA_LABEL_POSITIONS",{enumerable:!0,get:function(){return Nr}});Object.defineProperty(exports,"DATA_LABEL_ROLES",{enumerable:!0,get:function(){return Rr}});Object.defineProperty(exports,"DATETIME_SCALE_DEFAULTS",{enumerable:!0,get:function(){return Tn}});Object.defineProperty(exports,"DEFAULT_BAR_BORDER_RADIUS",{enumerable:!0,get:function(){return Yr}});Object.defineProperty(exports,"DEFAULT_COLOR_PALETTE",{enumerable:!0,get:function(){return pt}});Object.defineProperty(exports,"DEFAULT_DIMMED_ALPHA",{enumerable:!0,get:function(){return bt}});Object.defineProperty(exports,"DEFAULT_GEOM_COLOR",{enumerable:!0,get:function(){return gt}});Object.defineProperty(exports,"DEFAULT_GRAPH_BACKGROUND",{enumerable:!0,get:function(){return re}});Object.defineProperty(exports,"DEFAULT_GRAPH_BORDER_WIDTH",{enumerable:!0,get:function(){return qr}});Object.defineProperty(exports,"DEFAULT_GRAPH_PADDING",{enumerable:!0,get:function(){return Qr}});Object.defineProperty(exports,"DEFAULT_GRAPH_PADDING_EDGES",{enumerable:!0,get:function(){return Zr}});Object.defineProperty(exports,"DEFAULT_HEADLINE_SWATCH_SIZE",{enumerable:!0,get:function(){return Xr}});Object.defineProperty(exports,"DEFAULT_HOVER_AFFORDANCE_COLOR",{enumerable:!0,get:function(){return mt}});Object.defineProperty(exports,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return X}});Object.defineProperty(exports,"DEFAULT_MONO_BASE",{enumerable:!0,get:function(){return ht}});Object.defineProperty(exports,"DEFAULT_POINT_SIZE",{enumerable:!0,get:function(){return Kr}});Object.defineProperty(exports,"DEFAULT_RESHAPE_VALUE_NAME",{enumerable:!0,get:function(){return lt}});Object.defineProperty(exports,"DEFAULT_SEQUENTIAL_RAMP",{enumerable:!0,get:function(){return pn}});Object.defineProperty(exports,"DEFAULT_STROKE_WIDTH",{enumerable:!0,get:function(){return $r}});Object.defineProperty(exports,"DIFFERENCE_ARROW_DEFAULTS",{enumerable:!0,get:function(){return Pn}});Object.defineProperty(exports,"DIFFERENCE_ARROW_SIZE_DECLARATIONS",{enumerable:!0,get:function(){return Vn}});Object.defineProperty(exports,"DISCRETE_SCALE_DEFAULTS",{enumerable:!0,get:function(){return _n}});Object.defineProperty(exports,"DataCompiler",{enumerable:!0,get:function(){return Lr}});Object.defineProperty(exports,"Dataset",{enumerable:!0,get:function(){return K}});Object.defineProperty(exports,"GROUP_VARIABLES",{enumerable:!0,get:function(){return Se}});Object.defineProperty(exports,"HEADING_PARTS",{enumerable:!0,get:function(){return jr}});Object.defineProperty(exports,"HEADLINE_ITEM_PARTS",{enumerable:!0,get:function(){return Cr}});Object.defineProperty(exports,"IMAGE_ANNOTATION_DEFAULTS",{enumerable:!0,get:function(){return Nn}});Object.defineProperty(exports,"IS_DEV",{enumerable:!0,get:function(){return R}});Object.defineProperty(exports,"InternalError",{enumerable:!0,get:function(){return E}});Object.defineProperty(exports,"LAYER_LABEL_VARIABLES",{enumerable:!0,get:function(){return St}});Object.defineProperty(exports,"LEGEND_ITEM_PARTS",{enumerable:!0,get:function(){return xr}});Object.defineProperty(exports,"LEGEND_PARTS",{enumerable:!0,get:function(){return Vr}});Object.defineProperty(exports,"MONO_BASES",{enumerable:!0,get:function(){return gn}});Object.defineProperty(exports,"NEON_BASES",{enumerable:!0,get:function(){return bn}});Object.defineProperty(exports,"NON_POSITION_RANGE_DEFAULTS",{enumerable:!0,get:function(){return vn}});Object.defineProperty(exports,"PANEL_BORDER_EDGES",{enumerable:!0,get:function(){return wr}});Object.defineProperty(exports,"POSITION_VARIABLES",{enumerable:!0,get:function(){return Fe}});Object.defineProperty(exports,"RULE_VARIABLES",{enumerable:!0,get:function(){return Ne}});Object.defineProperty(exports,"Registry",{enumerable:!0,get:function(){return dt}});Object.defineProperty(exports,"SELECTION_PADDING_DEFAULT",{enumerable:!0,get:function(){return wn}});Object.defineProperty(exports,"SHAPE_DEFAULTS",{enumerable:!0,get:function(){return Rn}});Object.defineProperty(exports,"SOURCE_PARTS",{enumerable:!0,get:function(){return kr}});Object.defineProperty(exports,"STACK_VARIABLES",{enumerable:!0,get:function(){return Pe}});Object.defineProperty(exports,"STAT_VARIABLES",{enumerable:!0,get:function(){return oe}});Object.defineProperty(exports,"STYLE_STATES",{enumerable:!0,get:function(){return Wr}});Object.defineProperty(exports,"SUFFIX_MULTIPLIERS",{enumerable:!0,get:function(){return xe}});Object.defineProperty(exports,"Stage",{enumerable:!0,get:function(){return ot}});Object.defineProperty(exports,"TEXT_ANNOTATION_DEFAULTS",{enumerable:!0,get:function(){return In}});Object.defineProperty(exports,"TEXT_ANNOTATION_FADE_ALPHA",{enumerable:!0,get:function(){return Cn}});Object.defineProperty(exports,"TOOLTIP_PARTS",{enumerable:!0,get:function(){return Ir}});Object.defineProperty(exports,"TransformRegistry",{enumerable:!0,get:function(){return fn}});Object.defineProperty(exports,"UserInputError",{enumerable:!0,get:function(){return V}});Object.defineProperty(exports,"VISUAL_VARIABLES",{enumerable:!0,get:function(){return Re}});Object.defineProperty(exports,"VizError",{enumerable:!0,get:function(){return se}});Object.defineProperty(exports,"applyOverrides",{enumerable:!0,get:function(){return Dn}});Object.defineProperty(exports,"areDataValuesEqual",{enumerable:!0,get:function(){return gr}});Object.defineProperty(exports,"areMappingsEquivalent",{enumerable:!0,get:function(){return jt}});Object.defineProperty(exports,"buildLayerInput",{enumerable:!0,get:function(){return w}});Object.defineProperty(exports,"config",{enumerable:!0,get:function(){return ua}});Object.defineProperty(exports,"continuous",{enumerable:!0,get:function(){return A}});Object.defineProperty(exports,"coord",{enumerable:!0,get:function(){return Xn}});Object.defineProperty(exports,"createPerKeyMemo",{enumerable:!0,get:function(){return nt}});Object.defineProperty(exports,"createSingleSlotMemo",{enumerable:!0,get:function(){return dr}});Object.defineProperty(exports,"datetime",{enumerable:!0,get:function(){return G}});Object.defineProperty(exports,"discrete",{enumerable:!0,get:function(){return D}});Object.defineProperty(exports,"extractConstantValue",{enumerable:!0,get:function(){return we}});Object.defineProperty(exports,"extractVariableName",{enumerable:!0,get:function(){return ie}});Object.defineProperty(exports,"geom",{enumerable:!0,get:function(){return Bn}});Object.defineProperty(exports,"getStableKey",{enumerable:!0,get:function(){return $}});Object.defineProperty(exports,"identity",{enumerable:!0,get:function(){return C}});Object.defineProperty(exports,"inferXVariable",{enumerable:!0,get:function(){return wt}});Object.defineProperty(exports,"inferred",{enumerable:!0,get:function(){return H}});Object.defineProperty(exports,"isBorderRadiusToken",{enumerable:!0,get:function(){return Un}});Object.defineProperty(exports,"isCategoricalValueFormat",{enumerable:!0,get:function(){return Ie}});Object.defineProperty(exports,"isCompilerCachingEnabled",{enumerable:!0,get:function(){return cr}});Object.defineProperty(exports,"isCurrencyValueFormat",{enumerable:!0,get:function(){return Ct}});Object.defineProperty(exports,"isDateWithoutYearValueFormat",{enumerable:!0,get:function(){return xt}});Object.defineProperty(exports,"isDefined",{enumerable:!0,get:function(){return ne}});Object.defineProperty(exports,"isInternalVariable",{enumerable:!0,get:function(){return Rt}});Object.defineProperty(exports,"isLightDarkColor",{enumerable:!0,get:function(){return zr}});Object.defineProperty(exports,"isLookupValueFormat",{enumerable:!0,get:function(){return le}});Object.defineProperty(exports,"isNonEmptyArray",{enumerable:!0,get:function(){return Tt}});Object.defineProperty(exports,"isNumericDataValue",{enumerable:!0,get:function(){return Dt}});Object.defineProperty(exports,"isNumericValueFormat",{enumerable:!0,get:function(){return ke}});Object.defineProperty(exports,"isPlainObject",{enumerable:!0,get:function(){return _t}});Object.defineProperty(exports,"isStatVariable",{enumerable:!0,get:function(){return Nt}});Object.defineProperty(exports,"isStrictCategoricalDataValue",{enumerable:!0,get:function(){return Lt}});Object.defineProperty(exports,"isStrictNumericDataValue",{enumerable:!0,get:function(){return Le}});Object.defineProperty(exports,"isStrictTemporalDataValue",{enumerable:!0,get:function(){return Y}});Object.defineProperty(exports,"isStyleTokenRef",{enumerable:!0,get:function(){return Gr}});Object.defineProperty(exports,"isTemporalDataValue",{enumerable:!0,get:function(){return Mt}});Object.defineProperty(exports,"isTemporalValueFormat",{enumerable:!0,get:function(){return j}});Object.defineProperty(exports,"palette",{enumerable:!0,get:function(){return At}});Object.defineProperty(exports,"parseAddressingValue",{enumerable:!0,get:function(){return rt}});Object.defineProperty(exports,"parseDataset",{enumerable:!0,get:function(){return ft}});Object.defineProperty(exports,"parseValue",{enumerable:!0,get:function(){return ce}});Object.defineProperty(exports,"prefixInternalVariable",{enumerable:!0,get:function(){return m}});Object.defineProperty(exports,"readComboTypeOfBarPosition",{enumerable:!0,get:function(){return Kn}});Object.defineProperty(exports,"readFoldKeepVariables",{enumerable:!0,get:function(){return It}});Object.defineProperty(exports,"readISOInstant",{enumerable:!0,get:function(){return Ye}});Object.defineProperty(exports,"readMainAxisVariable",{enumerable:!0,get:function(){return kt}});Object.defineProperty(exports,"resolvePaletteConfig",{enumerable:!0,get:function(){return Fn}});Object.defineProperty(exports,"resolvePaletteOverrides",{enumerable:!0,get:function(){return Sn}});Object.defineProperty(exports,"resolvePaletteRange",{enumerable:!0,get:function(){return Ln}});Object.defineProperty(exports,"resolveScaledAestheticVariable",{enumerable:!0,get:function(){return Pt}});Object.defineProperty(exports,"scale",{enumerable:!0,get:function(){return qn}});Object.defineProperty(exports,"setCompilerCachingEnabled",{enumerable:!0,get:function(){return ur}});Object.defineProperty(exports,"stat",{enumerable:!0,get:function(){return Qn}});Object.defineProperty(exports,"style",{enumerable:!0,get:function(){return u}});Object.defineProperty(exports,"styles",{enumerable:!0,get:function(){return Hr}});Object.defineProperty(exports,"sumMemoStats",{enumerable:!0,get:function(){return fr}});Object.defineProperty(exports,"toExplicitValueFormat",{enumerable:!0,get:function(){return Vt}});Object.defineProperty(exports,"token",{enumerable:!0,get:function(){return d}});Object.defineProperty(exports,"transform",{enumerable:!0,get:function(){return na}});
@@ -2382,7 +2382,7 @@ var ja = Object.freeze({
2382
2382
  }
2383
2383
  }, za = [
2384
2384
  "brick",
2385
- "grey",
2385
+ "gray",
2386
2386
  "red",
2387
2387
  "orange",
2388
2388
  "yellow",
@@ -2462,16 +2462,16 @@ var ja = Object.freeze({
2462
2462
  brick200: "#E7BDAC",
2463
2463
  brick100: "#F2D8CB",
2464
2464
  brick50: "#FCF4EA",
2465
- grey900: "#1c1917",
2466
- grey800: "#292524",
2467
- grey700: "#44403c",
2468
- grey600: "#57534e",
2469
- grey500: "#78716c",
2470
- grey400: "#a8a29e",
2471
- grey300: "#d6d3d1",
2472
- grey200: "#e7e5e4",
2473
- grey100: "#f5f5f4",
2474
- grey50: "#fafaf9",
2465
+ gray900: "#1c1917",
2466
+ gray800: "#292524",
2467
+ gray700: "#44403c",
2468
+ gray600: "#57534e",
2469
+ gray500: "#78716c",
2470
+ gray400: "#a8a29e",
2471
+ gray300: "#d6d3d1",
2472
+ gray200: "#e7e5e4",
2473
+ gray100: "#f5f5f4",
2474
+ gray50: "#fafaf9",
2475
2475
  red900: "#7f1d1d",
2476
2476
  red800: "#991b1b",
2477
2477
  red700: "#b91c1c",
@@ -2553,10 +2553,10 @@ var ja = Object.freeze({
2553
2553
  pink100: "#FFE8F9",
2554
2554
  pink50: "#FFF4FC"
2555
2555
  }, Ya = [P.brick100, P.brick900], Tr = [
2556
- P.grey200,
2556
+ P.gray200,
2557
2557
  _.green,
2558
2558
  _.red,
2559
- P.grey200
2559
+ P.gray200
2560
2560
  ], he = {
2561
2561
  dark: {
2562
2562
  1: [500],
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./config.types-p7nmFVnK.cjs");var Z=10,J=["normal","italic","oblique"],Q=/^(\d*\.?\d+)(px|em)$/,O=/^\d*\.?\d+$/,ee=1,re=1e3,te={normal:400,bold:700},G=e=>J.includes(e),N=e=>{const r=Q.exec(e.trim());return r===null||r[1]===void 0||r[2]===void 0?null:{value:Number.parseFloat(r[1]),unit:r[2]==="px"?"px":"em"}},z=e=>{const r=e.trim(),t=te[r];if(t!==void 0)return t;if(!O.test(r))return null;const i=Number.parseFloat(r);return i>=ee&&i<=re?i:null},Y=e=>{const r=e.trim();return O.test(r)?Number.parseFloat(r):null},V=e=>e.unit==="em"?e.value*10:e.value,K=e=>{const r=e.trim().replace(/\s*\/\s*/g,"/").split(/\s+/);let t="normal",i=400,n=0;for(;n<r.length;){const f=r[n];if(f===void 0)return null;if(f==="normal")n++;else if(G(f))t=f,n++;else{const y=z(f);if(y===null)break;i=y,n++}}const s=r[n];if(s===void 0)return null;const[a="",l]=s.split("/"),c=N(a);if(c===null)return null;const u=l===void 0?null:Y(l),p=r.slice(n+1).join(" ").trim();return p===""?null:{style:t,weight:i,size:c,family:p,...u!==null?{lineHeight:u}:{}}};function oe(e){const r=[];for(const t of e??[]){if(t.type==="shape"&&r.push(o.style.annotation.shape({color:t.fillColor,alpha:t.fillOpacity,borderWidth:t.strokeWidth},{annotation:t.id})),t.type==="arrow"&&r.push(o.style.annotation.arrow({...t.color===void 0?{}:{color:t.color},strokeWidth:o.ARROW_STROKE_WIDTHS[t.thickness],lineType:t.lineStyle,...t.hasStickerStyle?o.ARROW_STICKER_DECLARATIONS:{}},{annotation:t.id})),t.type==="difference-arrow"){const i=o.DIFFERENCE_ARROW_SIZE_DECLARATIONS[t.size];r.push(o.style.annotation.differenceArrow({...t.color===void 0?{}:{color:t.color},...i.arrow},{annotation:t.id}),o.style.annotation.differenceArrow.label(i.label,{annotation:t.id}))}t.type==="text"&&t.backgroundColor!==void 0&&r.push(o.style.annotation.text({background:t.backgroundColor,...t.backgroundColorStyle==="fade"?{alpha:o.TEXT_ANNOTATION_FADE_ALPHA}:{}},{annotation:t.id})),t.type==="image"&&t.opacity!==void 0&&r.push(o.style.annotation.image({alpha:t.opacity},{annotation:t.id}))}return r}function ie(e){const r=[],t=e?.defaultAnnotationShapeFill;return typeof t=="string"&&r.push(o.style.annotation.shape({color:t})),r}function ne(e){const r=e?.defaultAnnotationArrowStroke;return typeof r=="string"?{annotationArrow:r}:void 0}var se="#%_ENCODED_%#",X=e=>{if(!e.startsWith(se))return e;try{const{value:r}=JSON.parse(e.slice(13));return typeof r=="string"?r:e}catch{return e}},ae=({annotations:e,dataset:r,mapping:t,seriesVariables:i})=>{const n=[],s=[],a=[],l=[],c=[],u=[],p=[],f=[],y={dataset:r,...le(t,i)};for(const b of e??[])switch(b.type){case"difference-arrow":{const d=ce(b,y);d!==null&&n.push(d);break}case"shape":s.push(ue(b));break;case"arrow":a.push(ye(b));break;case"highlight":break;case"text":l.push(fe(b));break;case"image":c.push(de(b));break;case"sticker":{const d=pe(b,y);d!==null&&u.push(d);break}case"tooltip":{const d=ve(b,y);if(d===null)break;d.kind==="pinnedNumber"?p.push(d.value):f.push(d.value);break}default:throw new o.InternalError({message:`Unsupported annotation type: ${b.type}`})}return{differenceArrows:n,shapes:s,arrows:a,textAnnotations:l,images:c,stickers:u,pinnedNumbers:p,comments:f}},le=(e,r)=>{const t=o.extractVariableName(e.x),i=o.extractVariableName(e.group)??o.extractVariableName(e.color),n=t!==null&&t!=="",s=i==="key"||r.length>=2;return{anchorVariable:n?t:i,groupIsSeriesKey:s}},ce=(e,r)=>{const t=k(r,e.start),i=k(r,e.end);return t===null||i===null?null:{id:e.id,start:t,end:i,label:e.show,labelCrossPosition:e.labelPosition}},ue=e=>({id:e.id,kind:e.shape,zOrder:e.layer==="abovePlot"?"foreground":"background",region:{anchorType:"panel",x:e.x,y:e.y,width:e.width,height:e.height}}),de=e=>({id:e.id,src:e.src,zOrder:e.layer==="abovePlot"?"foreground":"background",region:{anchorType:"panel",x:e.x,y:e.y,width:e.width,height:e.height},fit:e.fit}),fe=e=>({id:e.id,content:e.content,at:{anchorType:"panel",x:e.x,y:e.y},width:e.width,align:"top-left"}),pe=(e,r)=>{const t=k(r,e);return t===null?null:{id:e.id,at:{anchorType:"observation",...t},sticker:e.sticker}},ve=(e,r)=>{const t=k(r,e);return t===null?null:e.caption===null||e.caption===void 0?{kind:"pinnedNumber",value:{id:e.id,at:t}}:{kind:"comment",value:{id:e.id,at:t,content:e.caption}}},ye=e=>({id:e.id,start:{anchorType:"panel",x:e.startX,y:e.startY},end:{anchorType:"panel",x:e.endX,y:e.endY},startArrowheadStyle:e.startArrowheadStyle,endArrowheadStyle:e.endArrowheadStyle}),k=(e,r)=>{if(!o.isDefined(r))return null;const{dataset:t,anchorVariable:i,groupIsSeriesKey:n}=e;if(i===null)return null;const s=be(r,i,t);return s===null?null:n?o.isDefined(r.columnKey)?{anchorValue:s,groupValue:X(r.columnKey)}:null:{anchorValue:s,groupValue:void 0}},be=(e,r,t)=>!o.isDefined(e.rowIndex)||!t.hasVariable(r)?null:t.getValues(r)[e.rowIndex]??null;function me({palette:e,overrides:r,ctx:t}){const i=$(e,r,t);if(i!==void 0)return{type:"styles",defaults:[o.style.geom.bar({color:i}),o.style.geom.line({color:i}),o.style.geom.area({color:i}),o.style.geom.point({color:i}),o.style.geom.tile({color:i})]}}function he(e,r,t=void 0){const i=[...e?.defaults??[],...r??[]],n=[...e?.overrides??[],...t??[]];if(!(e===void 0&&i.length===0&&n.length===0))return{...e,type:"styles",defaults:i,...n.length===0?{}:{overrides:n}}}function ge(e,r){return r===void 0?e:{...e,type:"styles",tokens:{...e?.tokens,...r}}}function Se(e){return e?.highlightStyle===void 0?[]:e.highlightStyle==="grey"?[o.style.geom({saturation:0,alpha:.6},{state:"dimmed"})]:[o.style.geom({alpha:o.DEFAULT_DIMMED_ALPHA},{state:"dimmed"})]}function $(e,r,t){const i=e.type==="custom"?t.customPalettes?.[e.id]:void 0,n=r?.[1];if(n?.hex!==void 0)return n.hex;if(n?.id!==void 0){const s=i?.find(a=>a.id===n.id)?.hex;if(s!==void 0)return s}if(e.type!=="default")return e.type==="custom"?i?.[0]?.hex:o.resolvePaletteRange(e)[0]}var Ee=["lilac","neon_pink","blackberry","sun","iceland","sunset","ultraviolet","purple","ice_cream","mint","cool","fresh"],Ae="#E5E5E5",P=.1,C={light:.05,dark:.1},ke={lilac:"#C9C0F7",neon_pink:"#E04A95",blackberry:"#9F9FED",sun:"#FCDB61",iceland:"#29CDA8",sunset:"#FCDB62",ultraviolet:"#D167D8",purple:"#BBADFD",ice_cream:"#FC7E91",mint:"#25CDA5",cool:"#3F8EEB",fresh:"#A4A4EE"};function Te({appearance:e,themeOverrides:r,palette:t,overrides:i,ctx:n}){const s=$(t,i,n)??"#B84737",a=[],l=_e(e?.border,s),c=Le(e,r,s),u=F(e?.textStyle?.body?.fontId,n.fontList),p=e?.textStyle?.body?.color,f={...c===void 0?{}:{background:c},...l,...e?.hasRoundedCorners===!1?{borderRadius:0}:{},...u===void 0?{}:{fontFamily:u},...typeof p=="string"?{textColor:p}:{},...e?.textScale===void 0?{}:{textScale:e.textScale}};Object.keys(f).length>0&&a.push(o.style.graph(f));const y=F(e?.textStyle?.heading?.fontId,n.fontList),b=e?.textStyle?.heading?.color;y!==void 0&&a.push(o.style.heading({fontFamily:y})),typeof b=="string"&&a.push(o.style.heading.h1({textColor:b})),typeof p=="string"&&a.push(o.style.heading.h2({textColor:p}),o.style.caption({textColor:p}),o.style.source({textColor:p}),o.style.source.link({textColor:p}));const d=r?.gridLineColor;return typeof d=="string"&&a.push(o.style.gridLine({color:d}),o.style.tickLine({color:d}),o.style.panelBorder({color:d})),a}function Le(e,r,t){if(e?.backgroundModifier==="tint")return{light:B(o.DEFAULT_GRAPH_BACKGROUND.light,t,C.light),dark:B(o.DEFAULT_GRAPH_BACKGROUND.dark,t,C.dark)};const i=r?.graphBackground;return typeof i=="string"?i:void 0}function _e(e,r){if(!e?.style)return{};if(e.style==="none")return{borderWidth:0};const t=e.width??0;if(e.style==="grey")return{borderColor:Ae,borderWidth:t};if(e.style==="preset")return e.color===void 0||!Ne(e.color)?{}:{borderColor:ke[e.color],borderWidth:t};if(e.style==="custom")return e.color===void 0?{}:{borderColor:e.color,borderWidth:t};const i=e.color??r;return e.style==="tinted"?{borderColor:{light:Ve(i,P),dark:xe(i,P)},borderWidth:t}:{borderColor:i,borderWidth:t}}function F(e,r){if(!(e===void 0||r===void 0))return r.find(t=>t.id===e)?.fontFamily}var Ne=e=>Ee.includes(e),B=(e,r,t)=>`color-mix(in srgb, ${e}, ${r} ${t*100}%)`,Ve=(e,r)=>`hsl(from ${e} h s calc(l * ${1+r}))`,xe=(e,r)=>`hsl(from ${e} h s calc(l * ${1-r}))`,De={x:"top",y:"left"},Re=new Set(["pie","donut"]);function we(e,r=!1,t){return o.config({legend:Pe(e.legend,t?.legend),axes:Fe(e.axes,r,t?.axes),headline:Be(e),numberFormat:Ie(e.appearance),content:He(e.content)}).config}function Pe(e,r){if(!(!e&&!r))return{...e?{position:e.position}:void 0,...r}}function I(e,r,t){return!r&&t===void 0?{}:{...r?.isHidden!==void 0?{isVisible:!r.isHidden}:void 0,...r?.label!==void 0?{label:r.label}:void 0,...r?.isReversed?{position:De[e]}:void 0,...r?.tickDisplayMode?{ticks:{mode:r.tickDisplayMode}}:void 0,...t!==void 0?{grid:{isVisible:t}}:void 0}}function Ce(e){return{...e.label!==void 0?{label:e.label}:void 0}}function Fe(e,r=!1,t){if(!e&&!t)return;const i=I("x",e?.x,e?.showGridLines),n=I("y",e?.y,e?.showGridLines);return{x:{...r?n:i,...t?.x},y:{...r?i:n,...t?.y},...e?.y2?{ySecondary:Ce(e.y2)}:void 0}}function Be(e){const{headlineNumbers:r,options:t,type:i}=e,n=i!==void 0&&Re.has(i)?t?.pieTotalPosition:void 0;if(r===void 0&&n===void 0)return;const s={};return r?.show!==void 0&&(s.show=r.show),r?.compareWith!==void 0&&(s.compareWith=r.compareWith),r?.size!==void 0&&(s.size=r.size),n!==void 0&&(s.show="total",s.position=n==="center"?"center":"above"),s}function Ie(e){if(e?.numberFormat)return{decimals:e.numberFormat.decimalPlaces,abbreviation:e.numberFormat.abbreviation}}function He(e){if(!e)return;const r={};e.title!==void 0&&(r.title=e.title),e.isTitleHidden!==void 0&&(r.isTitleVisible=!e.isTitleHidden),e.subtitle!==void 0&&(r.subtitle=e.subtitle),e.isSubtitleHidden!==void 0&&(r.isSubtitleVisible=!e.isSubtitleHidden),e.caption!==void 0&&(r.caption=e.caption),e.isCaptionHidden!==void 0&&(r.isCaptionVisible=!e.isCaptionHidden);const t=Ue(e.source);return t!==void 0&&(r.source=t),e.isSourceHidden!==void 0&&(r.isSourceVisible=!e.isSourceHidden),e.brandMark!==void 0&&(r.brandMark={...e.brandMark},e.brandMark.enabled!==void 0&&(r.isBrandMarkVisible=e.brandMark.enabled)),e.isBrandMarkHidden!==void 0&&e.brandMark?.enabled===void 0&&(r.isBrandMarkVisible=!e.isBrandMarkHidden),r}function Ue(e){if(!e)return;const r={};return e.label!==void 0&&(r.label=e.label),e.url!==void 0&&(r.url=e.url),Object.keys(r).length===0?void 0:r}var x=o.prefixInternalVariable("constantY"),We=.15,Me=(e,r,t,i)=>je[r](e,t,i),D=e=>{const r=o.inferXVariable(e),{numeric:t}=e.groupVariableNamesByType(),i=t.filter(n=>n!==r);return i.length<=1?{transforms:[],mapping:{x:r,y:i[0]??""},seriesVariables:i}:{transforms:[o.transform.reshape({keep:[r],keyName:"key",valueName:o.DEFAULT_RESHAPE_VALUE_NAME})],mapping:{x:r,y:o.DEFAULT_RESHAPE_VALUE_NAME,color:"key"},seriesVariables:i}},R=e=>{const r=e.appearance?.seriesStyles;if(!r||e.seriesVariables.length===0)return{mapping:{},scales:[]};if(!e.seriesVariables.some(i=>o.isDefined(r[i]?.lineStyle)))return{mapping:{},scales:[]};if(e.seriesVariables.length===1){const i=e.seriesVariables[0];if(!i)return{mapping:{},scales:[]};const n=r[i]?.lineStyle;return n?{mapping:{lineType:{value:n}},scales:[]}:{mapping:{},scales:[]}}const t=e.seriesVariables.map(i=>r[i]?.lineStyle??"solid");return{mapping:{lineType:"key"},scales:[o.scale.lineType.discrete({domain:e.seriesVariables,range:t})]}},Oe=e=>{const{categorical:r,temporal:t,numeric:i}=e.groupVariableNamesByType(),n=i[0];if(!o.isDefined(n))throw new o.UserInputError({code:"INVALID_DATA_SHAPE",message:"No first numeric variable found",suggestion:"Provide at least one numeric column for this chart type."});const s=i.slice(1);return s.length===0?{...j(),mapping:{x:n,y:x,label:r[0]}}:s.length===1?{transforms:[],scales:[],mapping:{x:n,y:s[0]??"",label:r[0]}}:{transforms:[o.transform.reshape({keep:[n,...r,...t],keyName:"key",valueName:o.DEFAULT_RESHAPE_VALUE_NAME})],scales:[],mapping:{x:n,y:o.DEFAULT_RESHAPE_VALUE_NAME,label:r[0],color:"key"}}},j=()=>({transforms:[o.transform.constant({variableName:x,type:"categorical",value:""})],scales:[o.scale.y.discrete()]}),Ge=e=>{const{categorical:r,temporal:t,numeric:i}=e.groupVariableNamesByType();let n,s;if(o.isDefined(r[0])&&o.isDefined(i[0]))n=r[0],s=i[0];else if(o.isDefined(t[0])&&o.isDefined(i[0]))n=t[0],s=i[0];else if(o.isDefined(i[0])&&o.isDefined(i[1]))n=i[0],s=i[1];else throw new o.UserInputError({code:"INVALID_DATA_SHAPE",message:"No label or value variable found",suggestion:"Provide a label column and a numeric value column for this chart type."});return{x:"",y:s,color:n}},q=(e,r,t)=>{const{transforms:i,mapping:n,seriesVariables:s}=D(e.dataset),a=R({appearance:t,seriesVariables:s}),l=s.length<=1,c=[o.geom.line({params:{interpolate:r?.isSmoothLine?"catmull-rom":"linear",missingValues:r?.missingValues}})],u=[];return l&&(r?.showFill??!0)&&u.push(o.style.geom.line({fillAlpha:We})),typeof r?.lineThickness=="number"&&u.push(o.style.geom.line({strokeWidth:r.lineThickness})),r?.showPoints&&(c.push(o.geom.point({interactive:!1})),typeof r.pointSize=="number"&&u.push(o.style.geom.point({size:r.pointSize}))),{layers:c,coords:o.coord.cartesian(),mapping:{...n,...a.mapping},scales:a.scales,transforms:i,seriesVariables:s,styleDefaults:u}},ze=(e,r,t)=>{const{transforms:i,mapping:n,seriesVariables:s}=D(e.dataset),a=R({appearance:t,seriesVariables:s}),l=[o.geom.area({position:"stack",params:{interpolate:r?.isSmoothLine?"catmull-rom":"linear",missingValues:r?.missingValues}})],c=[];return typeof r?.lineThickness=="number"&&c.push(o.style.geom.area({strokeWidth:r.lineThickness})),r?.showPoints&&(l.push(o.geom.point({position:"stack",interactive:!1})),typeof r.pointSize=="number"&&c.push(o.style.geom.point({size:r.pointSize}))),{layers:l,coords:o.coord.cartesian(),mapping:{...n,...a.mapping},scales:a.scales,transforms:i,seriesVariables:s,styleDefaults:c}},g=(e,r,t,i,n)=>{const{transforms:s,mapping:a,seriesVariables:l}=D(e.dataset),c=[...s];if(i?.sortBars){const u=o.extractVariableName(a.y);u!==null&&u!==""&&c.push(o.transform.sort({variableName:u,direction:"desc"}))}if(!n?.useSingleColorForBars){const u=o.inferXVariable(e.dataset),{numeric:p}=e.dataset.groupVariableNamesByType();p.filter(f=>f!==u).length===1&&e.dataset.getType(u)==="categorical"&&(a.color=u)}return{layers:[o.geom.bar({position:r})],coords:t,mapping:a,scales:[],transforms:c,seriesVariables:l}},H=(e,r)=>({layers:[o.geom.bar({position:"fill"})],coords:o.coord.polar({theta:"y",innerRadius:r==="donut"?.55:0}),mapping:Ge(e.dataset),scales:[],seriesVariables:[]}),Ye=e=>{const{transforms:r,scales:t,mapping:i}=Oe(e.dataset);return{layers:[o.geom.point()],coords:o.coord.cartesian(),mapping:i,scales:t,transforms:r,seriesVariables:[]}},Ke=e=>{const{numeric:r,categorical:t}=e.dataset.groupVariableNamesByType(),i=r[0];if(!o.isDefined(i))throw new o.UserInputError({code:"INVALID_DATA_SHAPE",message:"No first numeric variable found",suggestion:"Provide at least one numeric column for this chart type."});const n=o.isDefined(r[1])?{transforms:[],scales:[]}:j(),s={x:i,y:r[1]??x,size:r[2],label:t[0]},a=[...n.scales];return o.isDefined(s.size)&&a.push(o.scale.size.continuous()),{layers:[o.geom.point()],coords:o.coord.cartesian(),mapping:s,scales:a,transforms:n.transforms,seriesVariables:[]}},Xe=e=>{const r=o.inferXVariable(e.dataset),{numeric:t}=e.dataset.groupVariableNamesByType(),i=t.filter(n=>n!==r);return{transforms:[o.transform.reshape({keep:[r],keyName:"key",valueName:o.DEFAULT_RESHAPE_VALUE_NAME}),o.transform.filter({variableName:o.DEFAULT_RESHAPE_VALUE_NAME,operator:"neq",value:null})],layers:[o.geom.tile()],coords:o.coord.cartesian(),mapping:{x:r,y:"key",color:o.DEFAULT_RESHAPE_VALUE_NAME},scales:[o.scale.color.continuous()],seriesVariables:i,config:{legend:{position:"none"},axes:{x:{position:"top"},y:{position:"left"}}}}},T=(e,r,t)=>{const i=t?.seriesStyles?.[e]?.lineStyle;return o.geom.line({transforms:[o.transform.constant({variableName:o.LAYER_LABEL_VARIABLES.line,type:"categorical",value:e})],aes:{y:e,color:o.LAYER_LABEL_VARIABLES.line,...i?{lineType:{value:i}}:{}},...r?{yScaleType:"secondary"}:void 0})},$e=(e,r,t)=>{const{numeric:i}=e.dataset.groupVariableNamesByType(),n=o.inferXVariable(e.dataset),s=o.readFoldKeepVariables(e.dataset,n),a=i.filter(d=>d!==n),l=o.COMBO_BAR_POSITIONS[r?.comboType??"grouped-bars"],c=l===null;if(a.length===1)return c?q(e,r,t):g(e,"dodge",o.coord.cartesian(),r,t);const u=e.axes?.hasDualYAxis===!0,p=c?[]:a.slice(0,-1),f=c?a:a.slice(-1),y=[],b=[];if(l!==null&&p.length>0){const d=p.length===1?p[0]:null;o.isDefined(d)?y.push(o.geom.bar({transforms:[o.transform.constant({variableName:o.LAYER_LABEL_VARIABLES.bar,type:"categorical",value:d})],aes:{y:d,color:o.LAYER_LABEL_VARIABLES.bar},position:l})):y.push(o.geom.bar({transforms:[o.transform.reshape({keep:s,reshape:p,keyName:"key",valueName:o.DEFAULT_RESHAPE_VALUE_NAME})],aes:{y:o.DEFAULT_RESHAPE_VALUE_NAME,color:"key"},position:l}))}if(c&&f.length>=2){const d=u?f.slice(0,-1):f,w=d.length===1?d[0]:null;if(o.isDefined(w))y.push(T(w,!1,t));else{const S=R({appearance:t,seriesVariables:d});y.push(o.geom.line({transforms:[o.transform.reshape({keep:s,reshape:d,keyName:"key",valueName:o.DEFAULT_RESHAPE_VALUE_NAME})],aes:{y:o.DEFAULT_RESHAPE_VALUE_NAME,color:"key",...S.mapping}})),b.push(...S.scales)}if(u){const S=f[f.length-1];o.isDefined(S)&&y.push(T(S,!0,t))}}else for(const d of f)y.push(T(d,u,t));return{layers:y,coords:o.coord.cartesian(),mapping:{x:n},scales:b,seriesVariables:a}},A=e=>()=>{throw new o.UserInputError({code:"UNSUPPORTED_GRAPH_TYPE",message:`Unsupported graph type: ${e}`,context:{requested:e}})},je={line:(e,r,t)=>q(e,r,t),areaStacked:(e,r,t)=>ze(e,r,t),bar:(e,r,t)=>g(e,"dodge",o.coord.flip(),r,t),barStacked:(e,r,t)=>g(e,"stack",o.coord.flip(),r,t),barStackedFill:(e,r,t)=>g(e,"fill",o.coord.flip(),r,t),column:(e,r,t)=>g(e,"dodge",o.coord.cartesian(),r,t),columnStacked:(e,r,t)=>g(e,"stack",o.coord.cartesian(),r,t),columnStackedFill:(e,r,t)=>g(e,"fill",o.coord.cartesian(),r,t),pie:e=>H(e,"pie"),donut:e=>H(e,"donut"),scatter:e=>Ye(e),bubble:e=>Ke(e),combo:(e,r,t)=>$e(e,r,t),funnel:A("funnel"),heatmap:e=>Xe(e),waterfall:A("waterfall"),mekko:A("mekko"),table:A("table")},qe=new o.TransformRegistry,Ze=["key",o.prefixInternalVariable("lineSeriesLabel"),o.prefixInternalVariable("barSeriesLabel")];function Je(e){const r=e.annotations??[],t=er(e.mapping),i=tr(e.dataset,e.transforms,e.layers),n=[];for(const s of r){if(s.type!=="highlight")continue;const a=rr({annotation:s,rowIdentityVariable:t,dataset:e.dataset,compiledVariableNames:i});a!==null&&n.push({type:"highlight",id:s.id,predicate:a,scope:Qe(s.highlight,e.mapping)})}return n}function Qe(e,r){const t=o.extractVariableName(r.x);return!(t!==null&&t!=="")&&e==="x-value"?"series":e}function er(e){const r=o.extractVariableName(e.x);return r!==null&&r!==""?r:o.extractVariableName(e.color)}function rr({annotation:e,rowIdentityVariable:r,dataset:t,compiledVariableNames:i}){switch(e.highlight){case"x-value":return U(e,r,t);case"series":return W(e,i);case"data-point":{const n=U(e,r,t),s=W(e,i);return n===null&&s===null?null:n===null?s:s===null?n:{and:[n,s]}}}}function U(e,r,t){if(r===null)return null;const i=or(e,r,t);return i===null?null:{variable:r,eq:i}}function W(e,r){const t=e.columnKey;if(!o.isDefined(t))return null;const i=Ze.filter(n=>r.includes(n));return i.length===0?null:{or:i.map(n=>({variable:n,eq:t}))}}function tr(e,r,t){const i=[...e.getVariableNames()],n=s=>{for(const a of s){const{getIntroducedVariables:l}=qe.get(a.transformType),c=l?.(a);c&&i.push(...c)}};n(r);for(const s of t)n(s.transforms??[]);return i}function or(e,r,t){return e.rowValue!==void 0?e.rowValue:!o.isDefined(e.rowIndex)||!t.getVariableNames().includes(r)?null:t.getValues(r)[e.rowIndex]??null}function ir(e,r,t){const{colorScheme:i,customPalettes:n}=t;if(n&&e&&n[e])return{type:"custom",id:e};if(e?.startsWith("preset:pastel"))return{type:"pastel",variant:L(r)};if(e?.startsWith("preset:graphy"))return{type:"graphy",variant:L(r)};if(e?.startsWith("preset:mono:")){const s=e.slice(12);if(nr(s))return{type:"mono",base:s,variant:i}}if(e?.startsWith("preset:neon:")){const s=e.slice(12);if(sr(s))return{type:"neon",base:s,variant:L(r)}}return{type:"default"}}function L(e){if(e==="waterfall")return"waterfall"}function nr(e){return o.MONO_BASES.includes(e)}function sr(e){return o.NEON_BASES.includes(e)}function ar({axes:e,palette:r,overrides:t,isFlipped:i}){const n=[];return n.push(M("x",i?e?.y:e?.x)),n.push(M("y",i?e?.x:e?.y)),n.push(o.scale.color.palette({palette:r,overrides:t})),n}function M(e,r){return r?.scaleType==="logarithmic"||r?.min!==void 0||r?.max!==void 0?r.scaleType==="logarithmic"?o.scale[e].log({domainMin:r.min??void 0,domainMax:r.max??void 0}):o.scale[e]({domainMin:r.min??void 0,domainMax:r.max??void 0}):o.scale[e]()}function lr(e){if(!e)return;const r={};for(const[t,i]of Object.entries(e)){if(!t.startsWith("series"))continue;const n=Number.parseInt(t.slice(6));if(Number.isNaN(n))continue;const s={hex:i.customColor,id:i.paletteColorId};(s.hex!==void 0||s.id!==void 0)&&(r[n]=s)}return Object.keys(r).length>0?r:void 0}function cr(e){const r=[],t=h(e?.fontAxisLabel);t!==void 0&&r.push(o.style.axisLabel(t));const i=gr(e);i!==void 0&&r.push(o.style.tickLabel(i));const n=h(e?.fontGoalLineLabel);return n!==void 0&&r.push(o.style.geom.rule.label(n)),r.push(...br(e)),r.push(...ur(e)),r.push(...pr(e)),r.push(...mr(e)),r}function ur(e){const r=[],t=fr(e);t!==void 0&&r.push(o.style.tooltip(t));const i=E(h(e?.fontTooltipHeading),v(e?.tooltipHeadingTextColor));i!==void 0&&r.push(o.style.tooltip.heading(i));const n=h(e?.fontTooltipLabel),s=E(n,v(e?.tooltipLabelTextColor));s!==void 0&&r.push(o.style.tooltip.label(s));const a=E(n,v(e?.tooltipValueTextColor));a!==void 0&&r.push(o.style.tooltip.value(a));const l=v(e?.tooltipPrimaryRowColor);l!==void 0&&r.push(o.style.tooltip.primaryRow({background:l}));const c=dr(e);return c!==void 0&&r.push(o.style.annotation.pinnedNumber.label(c),o.style.annotation.comment.label(c)),r}var dr=e=>{const r=v(e?.tooltipBackground),t=v(e?.tooltipBorderColor),i={...E(h(e?.fontMiniTooltipLabel),v(e?.tooltipValueTextColor)),...r===void 0?{}:{background:r},...t===void 0?{}:{borderColor:t}};return Object.keys(i).length===0?void 0:i},fr=e=>{const r=v(e?.tooltipBackground),t=v(e?.tooltipBorderColor),i=m(e?.tooltipBorderWidth),n=m(e?.tooltipBorderRadius),s=m(e?.tooltipPaddingBlock),a=m(e?.tooltipPaddingInline),l=typeof e?.tooltipShadow=="string"?hr(e.tooltipShadow)??void 0:void 0,c={...r===void 0?{}:{background:r},...t===void 0?{}:{borderColor:t},...i===void 0?{}:{borderWidth:i},...n===void 0?{}:{borderRadius:n},...s===void 0?{}:{paddingBlock:s},...a===void 0?{}:{paddingInline:a},...l===void 0?{}:{shadow:l}};return Object.keys(c).length===0?void 0:c};function pr(e){const r=[],t=m(e?.legendItemGap);t!==void 0&&r.push(o.style.legend({gap:t}));const i=h(e?.fontLegendLabel),n=v(e?.legendTextColor),s=E(i,n),a=vr(e,s);a!==void 0&&r.push(o.style.legendItem(a));const l=yr(e);return l!==void 0&&r.push(o.style.legendItem.swatch({size:l})),s!==void 0&&r.push(o.style.directLabel(s)),r}var vr=(e,r)=>{const t=v(e?.legendBackground),i=v(e?.legendBorderColor),n=m(e?.legendPillBorderWidth),s=m(e?.legendPillPaddingInline),a=m(e?.legendPillPaddingBlock),l={...r,...t===void 0?{}:{background:t},...i===void 0?{}:{borderColor:i},...n===void 0?{}:{borderWidth:n},...s===void 0?{}:{paddingInline:s},...a===void 0?{}:{paddingBlock:a}};return Object.keys(l).length===0?void 0:l},yr=e=>{const r=m(e?.legendSwatchWidth);return m(e?.legendSwatchHeight)??r},E=(e,r)=>{if(!(e===void 0&&r===void 0))return{...e,...r===void 0?{}:{textColor:r}}};function br(e){const r=v(e?.dataLabelTextColor),t=v(e?.stackTotalTextColor),i=[["observation",h(e?.fontDataLabel),r],["category",h(e?.fontCategoryLabel),r],["aggregate",h(e?.fontStackTotal),t]],n=[];for(const[u,p,f]of i)p===void 0&&f===void 0||n.push(o.style.dataLabel[u]({...p,...f===void 0?{}:{textColor:f}}));const s=v(e?.dataLabelInsideTextColor);s!==void 0&&(n.push(o.style.dataLabel.observation.inside({textColor:s})),n.push(o.style.dataLabel.category.inside({textColor:s})));const a=v(e?.dataLabelOutsideBackground);a!==void 0&&(n.push(o.style.dataLabel.observation.outside({background:a})),n.push(o.style.dataLabel.category.outside({background:a})));const l=v(e?.stackTotalBackground),c=v(e?.stackTotalStroke);return(l!==void 0||c!==void 0)&&n.push(o.style.dataLabel.aggregate({...l===void 0?{}:{background:l},...c===void 0?{}:{borderColor:c}})),n}function mr(e){const r=[],t=v(e?.trendPositiveColor),i=v(e?.trendNegativeColor),n=v(e?.trendNeutralColor);return t!==void 0&&r.push(o.style.headlineItem.trend.up({textColor:t})),i!==void 0&&r.push(o.style.headlineItem.trend.down({textColor:i})),n!==void 0&&r.push(o.style.headlineItem.trend.flat({textColor:n})),r}function v(e){if(!(typeof e!="string"||e.trim().length===0))return e}function hr(e){const r=e.trim();if(r==="none")return"none";const t=r.split(/\s+/),i=_(t[0]),n=_(t[1]),s=_(t[2]),a=t.slice(3).join(" ");return i===null||n===null||s===null||a.length===0?null:{offsetX:i,offsetY:n,blur:s,color:a}}var _=e=>{if(e===void 0)return null;const r=/^(-?\d*\.?\d+)(px)?$/.exec(e);if(r?.[1]===void 0)return null;const t=Number.parseFloat(r[1]);return Number.isFinite(t)?t:null};function h(e){if(typeof e!="string")return;const r=K(e);if(r!==null)return{fontFamily:r.family,fontSize:V(r.size),fontWeight:r.weight,...r.lineHeight===void 0?{}:{lineHeight:r.lineHeight}}}function gr(e){const r=h(e?.fontTickLabel),t=m(e?.tickLabelOffset);if(!(r===void 0&&t===void 0))return{...r,...t===void 0?{}:{offset:t}}}function m(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e!="string")return;const r=N(e);return r===null?void 0:V(r)}var Sr=new Set(["column","columnStacked","columnStackedFill","bar","barStacked","barStackedFill","line","areaStacked","scatter","bubble","funnel","combo"]),Er=new Set(["column","columnStacked","columnStackedFill","bar","barStacked","barStackedFill","line","areaStacked","combo"]);function Ar(e,r,t={}){return kr(o.parseDataset(r),e,t)}function kr(e,r,t={}){const i=r.type??"column",n=Me({dataset:e,axes:r.axes},i,r.options??void 0,r.appearance??void 0),s=n.coords.coordType==="flip",a=n.transforms??[],l=ir(r.appearance?.paletteId,i,t),c=lr(r.appearance?.seriesStyles);return{mapping:n.mapping,layers:Tr(i,r,n.layers,n.coords,n.mapping,n.seriesVariables),scales:[...ar({axes:r.axes,palette:l,overrides:c,isFlipped:s}),...n.scales],styles:ge(he(me({palette:l,overrides:c,ctx:t}),[...n.styleDefaults??[],...Se(r.appearance??void 0),...Te({appearance:r.appearance??void 0,themeOverrides:r.themeOverrides,palette:l,overrides:c,ctx:t}),...cr(r.themeOverrides),...ie(r.themeOverrides)],oe(r.annotations)),ne(r.themeOverrides)),transforms:a,highlights:Je({annotations:r.annotations,dataset:e,mapping:n.mapping,transforms:a,layers:n.layers}),annotations:ae({annotations:r.annotations,dataset:e,mapping:n.mapping,seriesVariables:n.seriesVariables}),coords:n.coords,config:we(r,s,n.config)}}function Tr(e,r,t,i,n,s){const a=xr(r.dataLabels),l=a===void 0?t:t.filter(u=>u.interactive!==!1).map(u=>({...u,dataLabels:{...a,...u.dataLabels}})),c=r.axes?.hasDualYAxis??!1;return[...l,...Lr({type:e,trendline:r.referenceLines?.trendline,coords:i}),..._r({type:e,hasDualYAxis:c,goalLine:r.referenceLines?.goalLine,coords:i}),...Vr({type:e,hasDualYAxis:c,averageLine:r.referenceLines?.averageLine,coords:i,mapping:n,seriesVariables:s})]}function Lr({type:e,trendline:r,coords:t}){return r===void 0?[]:Sr.has(e)?t.coordType==="polar"?[]:[o.geom.line({aes:{lineType:{value:"dashed"}},stat:o.stat.smooth({method:r}),interactive:!1})]:[]}function _r({type:e,hasDualYAxis:r,goalLine:t,coords:i}){if(!Nr(t))return[];if(i.coordType==="polar")return[];const n=i.coordType==="flip"?"end":"start";return[o.geom.rule({aes:{y:{value:t.target}},params:{labelPosition:n,label:t.label??"Goal"},yScaleType:e==="combo"&&r?"secondary":"primary",interactive:!1})]}function Nr(e){return e!==void 0&&Number.isFinite(e.target)}function Vr({type:e,hasDualYAxis:r,averageLine:t,coords:i,mapping:n,seriesVariables:s}){if(t===void 0)return[];if(!Er.has(e))return[];if(i.coordType==="polar")return[];const a=X(t.columnKey);if(!s.includes(a))return[];const l=n.color==="key",c=l?o.DEFAULT_RESHAPE_VALUE_NAME:a,u=l?[o.transform.filter({variableName:"key",operator:"eq",value:a})]:[];return[o.geom.rule({aes:{y:c,color:void 0,group:void 0,lineType:void 0},stat:o.stat.mean(),transforms:u,params:{label:"Average",labelPosition:i.coordType==="flip"?"end":"start"},yScaleType:e==="combo"&&r?"secondary":"primary",interactive:!1})]}function xr(e){if(!e)return;const r={};return e.showDataLabels!==void 0&&(r.showDataLabels=e.showDataLabels),e.dataLabelFormat!==void 0&&(r.format=e.dataLabelFormat),e.showStackTotals!==void 0&&(r.showStackTotals=e.showStackTotals),e.showCategoryLabels!==void 0&&(r.showCategoryLabels=e.showCategoryLabels),Object.keys(r).length===0?void 0:r}var Dr=[.8,1,1.2,1.4,1.6,1.8,2,2.5,3,4];exports.CHART_TEXT_SCALES=Dr;exports.ROOT_FONT_SIZE_PX=Z;exports.convertGraphConfig=Ar;exports.isFontStyle=G;exports.parseFontLength=N;exports.parseFontShorthand=K;exports.parseFontWeight=z;exports.parseUnitlessLineHeight=Y;exports.toPixels=V;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./config.types-BmvpkaJ9.cjs");var Z=10,J=["normal","italic","oblique"],Q=/^(\d*\.?\d+)(px|em)$/,O=/^\d*\.?\d+$/,ee=1,re=1e3,te={normal:400,bold:700},G=e=>J.includes(e),N=e=>{const r=Q.exec(e.trim());return r===null||r[1]===void 0||r[2]===void 0?null:{value:Number.parseFloat(r[1]),unit:r[2]==="px"?"px":"em"}},z=e=>{const r=e.trim(),t=te[r];if(t!==void 0)return t;if(!O.test(r))return null;const i=Number.parseFloat(r);return i>=ee&&i<=re?i:null},Y=e=>{const r=e.trim();return O.test(r)?Number.parseFloat(r):null},V=e=>e.unit==="em"?e.value*10:e.value,K=e=>{const r=e.trim().replace(/\s*\/\s*/g,"/").split(/\s+/);let t="normal",i=400,n=0;for(;n<r.length;){const f=r[n];if(f===void 0)return null;if(f==="normal")n++;else if(G(f))t=f,n++;else{const y=z(f);if(y===null)break;i=y,n++}}const s=r[n];if(s===void 0)return null;const[a="",l]=s.split("/"),c=N(a);if(c===null)return null;const u=l===void 0?null:Y(l),p=r.slice(n+1).join(" ").trim();return p===""?null:{style:t,weight:i,size:c,family:p,...u!==null?{lineHeight:u}:{}}};function oe(e){const r=[];for(const t of e??[]){if(t.type==="shape"&&r.push(o.style.annotation.shape({color:t.fillColor,alpha:t.fillOpacity,borderWidth:t.strokeWidth},{annotation:t.id})),t.type==="arrow"&&r.push(o.style.annotation.arrow({...t.color===void 0?{}:{color:t.color},strokeWidth:o.ARROW_STROKE_WIDTHS[t.thickness],lineType:t.lineStyle,...t.hasStickerStyle?o.ARROW_STICKER_DECLARATIONS:{}},{annotation:t.id})),t.type==="difference-arrow"){const i=o.DIFFERENCE_ARROW_SIZE_DECLARATIONS[t.size];r.push(o.style.annotation.differenceArrow({...t.color===void 0?{}:{color:t.color},...i.arrow},{annotation:t.id}),o.style.annotation.differenceArrow.label(i.label,{annotation:t.id}))}t.type==="text"&&t.backgroundColor!==void 0&&r.push(o.style.annotation.text({background:t.backgroundColor,...t.backgroundColorStyle==="fade"?{alpha:o.TEXT_ANNOTATION_FADE_ALPHA}:{}},{annotation:t.id})),t.type==="image"&&t.opacity!==void 0&&r.push(o.style.annotation.image({alpha:t.opacity},{annotation:t.id}))}return r}function ie(e){const r=[],t=e?.defaultAnnotationShapeFill;return typeof t=="string"&&r.push(o.style.annotation.shape({color:t})),r}function ne(e){const r=e?.defaultAnnotationArrowStroke;return typeof r=="string"?{annotationArrow:r}:void 0}var se="#%_ENCODED_%#",X=e=>{if(!e.startsWith(se))return e;try{const{value:r}=JSON.parse(e.slice(13));return typeof r=="string"?r:e}catch{return e}},ae=({annotations:e,dataset:r,mapping:t,seriesVariables:i})=>{const n=[],s=[],a=[],l=[],c=[],u=[],p=[],f=[],y={dataset:r,...le(t,i)};for(const b of e??[])switch(b.type){case"difference-arrow":{const d=ce(b,y);d!==null&&n.push(d);break}case"shape":s.push(ue(b));break;case"arrow":a.push(ye(b));break;case"highlight":break;case"text":l.push(fe(b));break;case"image":c.push(de(b));break;case"sticker":{const d=pe(b,y);d!==null&&u.push(d);break}case"tooltip":{const d=ve(b,y);if(d===null)break;d.kind==="pinnedNumber"?p.push(d.value):f.push(d.value);break}default:throw new o.InternalError({message:`Unsupported annotation type: ${b.type}`})}return{differenceArrows:n,shapes:s,arrows:a,textAnnotations:l,images:c,stickers:u,pinnedNumbers:p,comments:f}},le=(e,r)=>{const t=o.extractVariableName(e.x),i=o.extractVariableName(e.group)??o.extractVariableName(e.color),n=t!==null&&t!=="",s=i==="key"||r.length>=2;return{anchorVariable:n?t:i,groupIsSeriesKey:s}},ce=(e,r)=>{const t=k(r,e.start),i=k(r,e.end);return t===null||i===null?null:{id:e.id,start:t,end:i,label:e.show,labelCrossPosition:e.labelPosition}},ue=e=>({id:e.id,kind:e.shape,zOrder:e.layer==="abovePlot"?"foreground":"background",region:{anchorType:"panel",x:e.x,y:e.y,width:e.width,height:e.height}}),de=e=>({id:e.id,src:e.src,zOrder:e.layer==="abovePlot"?"foreground":"background",region:{anchorType:"panel",x:e.x,y:e.y,width:e.width,height:e.height},fit:e.fit}),fe=e=>({id:e.id,content:e.content,at:{anchorType:"panel",x:e.x,y:e.y},width:e.width,align:"top-left"}),pe=(e,r)=>{const t=k(r,e);return t===null?null:{id:e.id,at:{anchorType:"observation",...t},sticker:e.sticker}},ve=(e,r)=>{const t=k(r,e);return t===null?null:e.caption===null||e.caption===void 0?{kind:"pinnedNumber",value:{id:e.id,at:t}}:{kind:"comment",value:{id:e.id,at:t,content:e.caption}}},ye=e=>({id:e.id,start:{anchorType:"panel",x:e.startX,y:e.startY},end:{anchorType:"panel",x:e.endX,y:e.endY},startArrowheadStyle:e.startArrowheadStyle,endArrowheadStyle:e.endArrowheadStyle}),k=(e,r)=>{if(!o.isDefined(r))return null;const{dataset:t,anchorVariable:i,groupIsSeriesKey:n}=e;if(i===null)return null;const s=be(r,i,t);return s===null?null:n?o.isDefined(r.columnKey)?{anchorValue:s,groupValue:X(r.columnKey)}:null:{anchorValue:s,groupValue:void 0}},be=(e,r,t)=>!o.isDefined(e.rowIndex)||!t.hasVariable(r)?null:t.getValues(r)[e.rowIndex]??null;function me({palette:e,overrides:r,ctx:t}){const i=$(e,r,t);if(i!==void 0)return{type:"styles",defaults:[o.style.geom.bar({color:i}),o.style.geom.line({color:i}),o.style.geom.area({color:i}),o.style.geom.point({color:i}),o.style.geom.tile({color:i})]}}function he(e,r,t=void 0){const i=[...e?.defaults??[],...r??[]],n=[...e?.overrides??[],...t??[]];if(!(e===void 0&&i.length===0&&n.length===0))return{...e,type:"styles",defaults:i,...n.length===0?{}:{overrides:n}}}function ge(e,r){return r===void 0?e:{...e,type:"styles",tokens:{...e?.tokens,...r}}}function Se(e){return e?.highlightStyle===void 0?[]:e.highlightStyle==="gray"?[o.style.geom({saturation:0,alpha:.6},{state:"dimmed"})]:[o.style.geom({alpha:o.DEFAULT_DIMMED_ALPHA},{state:"dimmed"})]}function $(e,r,t){const i=e.type==="custom"?t.customPalettes?.[e.id]:void 0,n=r?.[1];if(n?.hex!==void 0)return n.hex;if(n?.id!==void 0){const s=i?.find(a=>a.id===n.id)?.hex;if(s!==void 0)return s}if(e.type!=="default")return e.type==="custom"?i?.[0]?.hex:o.resolvePaletteRange(e)[0]}var Ee=["lilac","neon_pink","blackberry","sun","iceland","sunset","ultraviolet","purple","ice_cream","mint","cool","fresh"],Ae="#E5E5E5",P=.1,C={light:.05,dark:.1},ke={lilac:"#C9C0F7",neon_pink:"#E04A95",blackberry:"#9F9FED",sun:"#FCDB61",iceland:"#29CDA8",sunset:"#FCDB62",ultraviolet:"#D167D8",purple:"#BBADFD",ice_cream:"#FC7E91",mint:"#25CDA5",cool:"#3F8EEB",fresh:"#A4A4EE"};function Te({appearance:e,themeOverrides:r,palette:t,overrides:i,ctx:n}){const s=$(t,i,n)??"#B84737",a=[],l=_e(e?.border,s),c=Le(e,r,s),u=F(e?.textStyle?.body?.fontId,n.fontList),p=e?.textStyle?.body?.color,f={...c===void 0?{}:{background:c},...l,...e?.hasRoundedCorners===!1?{borderRadius:0}:{},...u===void 0?{}:{fontFamily:u},...typeof p=="string"?{textColor:p}:{},...e?.textScale===void 0?{}:{textScale:e.textScale}};Object.keys(f).length>0&&a.push(o.style.graph(f));const y=F(e?.textStyle?.heading?.fontId,n.fontList),b=e?.textStyle?.heading?.color;y!==void 0&&a.push(o.style.heading({fontFamily:y})),typeof b=="string"&&a.push(o.style.heading.h1({textColor:b})),typeof p=="string"&&a.push(o.style.heading.h2({textColor:p}),o.style.caption({textColor:p}),o.style.source({textColor:p}),o.style.source.link({textColor:p}));const d=r?.gridLineColor;return typeof d=="string"&&a.push(o.style.gridLine({color:d}),o.style.tickLine({color:d}),o.style.panelBorder({color:d})),a}function Le(e,r,t){if(e?.backgroundModifier==="tint")return{light:B(o.DEFAULT_GRAPH_BACKGROUND.light,t,C.light),dark:B(o.DEFAULT_GRAPH_BACKGROUND.dark,t,C.dark)};const i=r?.graphBackground;return typeof i=="string"?i:void 0}function _e(e,r){if(!e?.style)return{};if(e.style==="none")return{borderWidth:0};const t=e.width??0;if(e.style==="gray")return{borderColor:Ae,borderWidth:t};if(e.style==="preset")return e.color===void 0||!Ne(e.color)?{}:{borderColor:ke[e.color],borderWidth:t};if(e.style==="custom")return e.color===void 0?{}:{borderColor:e.color,borderWidth:t};const i=e.color??r;return e.style==="tinted"?{borderColor:{light:Ve(i,P),dark:xe(i,P)},borderWidth:t}:{borderColor:i,borderWidth:t}}function F(e,r){if(!(e===void 0||r===void 0))return r.find(t=>t.id===e)?.fontFamily}var Ne=e=>Ee.includes(e),B=(e,r,t)=>`color-mix(in srgb, ${e}, ${r} ${t*100}%)`,Ve=(e,r)=>`hsl(from ${e} h s calc(l * ${1+r}))`,xe=(e,r)=>`hsl(from ${e} h s calc(l * ${1-r}))`,De={x:"top",y:"left"},Re=new Set(["pie","donut"]);function we(e,r=!1,t){return o.config({legend:Pe(e.legend,t?.legend),axes:Fe(e.axes,r,t?.axes),headline:Be(e),numberFormat:Ie(e.appearance),content:He(e.content)}).config}function Pe(e,r){if(!(!e&&!r))return{...e?{position:e.position}:void 0,...r}}function I(e,r,t){return!r&&t===void 0?{}:{...r?.isHidden!==void 0?{isVisible:!r.isHidden}:void 0,...r?.label!==void 0?{label:r.label}:void 0,...r?.isReversed?{position:De[e]}:void 0,...r?.tickDisplayMode?{ticks:{mode:r.tickDisplayMode}}:void 0,...t!==void 0?{grid:{isVisible:t}}:void 0}}function Ce(e){return{...e.label!==void 0?{label:e.label}:void 0}}function Fe(e,r=!1,t){if(!e&&!t)return;const i=I("x",e?.x,e?.showGridLines),n=I("y",e?.y,e?.showGridLines);return{x:{...r?n:i,...t?.x},y:{...r?i:n,...t?.y},...e?.y2?{ySecondary:Ce(e.y2)}:void 0}}function Be(e){const{headlineNumbers:r,options:t,type:i}=e,n=i!==void 0&&Re.has(i)?t?.pieTotalPosition:void 0;if(r===void 0&&n===void 0)return;const s={};return r?.show!==void 0&&(s.show=r.show),r?.compareWith!==void 0&&(s.compareWith=r.compareWith),r?.size!==void 0&&(s.size=r.size),n!==void 0&&(s.show="total",s.position=n==="center"?"center":"above"),s}function Ie(e){if(e?.numberFormat)return{decimals:e.numberFormat.decimalPlaces,abbreviation:e.numberFormat.abbreviation}}function He(e){if(!e)return;const r={};e.title!==void 0&&(r.title=e.title),e.isTitleHidden!==void 0&&(r.isTitleVisible=!e.isTitleHidden),e.subtitle!==void 0&&(r.subtitle=e.subtitle),e.isSubtitleHidden!==void 0&&(r.isSubtitleVisible=!e.isSubtitleHidden),e.caption!==void 0&&(r.caption=e.caption),e.isCaptionHidden!==void 0&&(r.isCaptionVisible=!e.isCaptionHidden);const t=Ue(e.source);return t!==void 0&&(r.source=t),e.isSourceHidden!==void 0&&(r.isSourceVisible=!e.isSourceHidden),e.brandMark!==void 0&&(r.brandMark={...e.brandMark},e.brandMark.enabled!==void 0&&(r.isBrandMarkVisible=e.brandMark.enabled)),e.isBrandMarkHidden!==void 0&&e.brandMark?.enabled===void 0&&(r.isBrandMarkVisible=!e.isBrandMarkHidden),r}function Ue(e){if(!e)return;const r={};return e.label!==void 0&&(r.label=e.label),e.url!==void 0&&(r.url=e.url),Object.keys(r).length===0?void 0:r}var x=o.prefixInternalVariable("constantY"),We=.15,Me=(e,r,t,i)=>je[r](e,t,i),D=e=>{const r=o.inferXVariable(e),{numeric:t}=e.groupVariableNamesByType(),i=t.filter(n=>n!==r);return i.length<=1?{transforms:[],mapping:{x:r,y:i[0]??""},seriesVariables:i}:{transforms:[o.transform.reshape({keep:[r],keyName:"key",valueName:o.DEFAULT_RESHAPE_VALUE_NAME})],mapping:{x:r,y:o.DEFAULT_RESHAPE_VALUE_NAME,color:"key"},seriesVariables:i}},R=e=>{const r=e.appearance?.seriesStyles;if(!r||e.seriesVariables.length===0)return{mapping:{},scales:[]};if(!e.seriesVariables.some(i=>o.isDefined(r[i]?.lineStyle)))return{mapping:{},scales:[]};if(e.seriesVariables.length===1){const i=e.seriesVariables[0];if(!i)return{mapping:{},scales:[]};const n=r[i]?.lineStyle;return n?{mapping:{lineType:{value:n}},scales:[]}:{mapping:{},scales:[]}}const t=e.seriesVariables.map(i=>r[i]?.lineStyle??"solid");return{mapping:{lineType:"key"},scales:[o.scale.lineType.discrete({domain:e.seriesVariables,range:t})]}},Oe=e=>{const{categorical:r,temporal:t,numeric:i}=e.groupVariableNamesByType(),n=i[0];if(!o.isDefined(n))throw new o.UserInputError({code:"INVALID_DATA_SHAPE",message:"No first numeric variable found",suggestion:"Provide at least one numeric column for this chart type."});const s=i.slice(1);return s.length===0?{...j(),mapping:{x:n,y:x,label:r[0]}}:s.length===1?{transforms:[],scales:[],mapping:{x:n,y:s[0]??"",label:r[0]}}:{transforms:[o.transform.reshape({keep:[n,...r,...t],keyName:"key",valueName:o.DEFAULT_RESHAPE_VALUE_NAME})],scales:[],mapping:{x:n,y:o.DEFAULT_RESHAPE_VALUE_NAME,label:r[0],color:"key"}}},j=()=>({transforms:[o.transform.constant({variableName:x,type:"categorical",value:""})],scales:[o.scale.y.discrete()]}),Ge=e=>{const{categorical:r,temporal:t,numeric:i}=e.groupVariableNamesByType();let n,s;if(o.isDefined(r[0])&&o.isDefined(i[0]))n=r[0],s=i[0];else if(o.isDefined(t[0])&&o.isDefined(i[0]))n=t[0],s=i[0];else if(o.isDefined(i[0])&&o.isDefined(i[1]))n=i[0],s=i[1];else throw new o.UserInputError({code:"INVALID_DATA_SHAPE",message:"No label or value variable found",suggestion:"Provide a label column and a numeric value column for this chart type."});return{x:"",y:s,color:n}},q=(e,r,t)=>{const{transforms:i,mapping:n,seriesVariables:s}=D(e.dataset),a=R({appearance:t,seriesVariables:s}),l=s.length<=1,c=[o.geom.line({params:{interpolate:r?.isSmoothLine?"catmull-rom":"linear",missingValues:r?.missingValues}})],u=[];return l&&(r?.showFill??!0)&&u.push(o.style.geom.line({fillAlpha:We})),typeof r?.lineThickness=="number"&&u.push(o.style.geom.line({strokeWidth:r.lineThickness})),r?.showPoints&&(c.push(o.geom.point({interactive:!1})),typeof r.pointSize=="number"&&u.push(o.style.geom.point({size:r.pointSize}))),{layers:c,coords:o.coord.cartesian(),mapping:{...n,...a.mapping},scales:a.scales,transforms:i,seriesVariables:s,styleDefaults:u}},ze=(e,r,t)=>{const{transforms:i,mapping:n,seriesVariables:s}=D(e.dataset),a=R({appearance:t,seriesVariables:s}),l=[o.geom.area({position:"stack",params:{interpolate:r?.isSmoothLine?"catmull-rom":"linear",missingValues:r?.missingValues}})],c=[];return typeof r?.lineThickness=="number"&&c.push(o.style.geom.area({strokeWidth:r.lineThickness})),r?.showPoints&&(l.push(o.geom.point({position:"stack",interactive:!1})),typeof r.pointSize=="number"&&c.push(o.style.geom.point({size:r.pointSize}))),{layers:l,coords:o.coord.cartesian(),mapping:{...n,...a.mapping},scales:a.scales,transforms:i,seriesVariables:s,styleDefaults:c}},g=(e,r,t,i,n)=>{const{transforms:s,mapping:a,seriesVariables:l}=D(e.dataset),c=[...s];if(i?.sortBars){const u=o.extractVariableName(a.y);u!==null&&u!==""&&c.push(o.transform.sort({variableName:u,direction:"desc"}))}if(!n?.useSingleColorForBars){const u=o.inferXVariable(e.dataset),{numeric:p}=e.dataset.groupVariableNamesByType();p.filter(f=>f!==u).length===1&&e.dataset.getType(u)==="categorical"&&(a.color=u)}return{layers:[o.geom.bar({position:r})],coords:t,mapping:a,scales:[],transforms:c,seriesVariables:l}},H=(e,r)=>({layers:[o.geom.bar({position:"fill"})],coords:o.coord.polar({theta:"y",innerRadius:r==="donut"?.55:0}),mapping:Ge(e.dataset),scales:[],seriesVariables:[]}),Ye=e=>{const{transforms:r,scales:t,mapping:i}=Oe(e.dataset);return{layers:[o.geom.point()],coords:o.coord.cartesian(),mapping:i,scales:t,transforms:r,seriesVariables:[]}},Ke=e=>{const{numeric:r,categorical:t}=e.dataset.groupVariableNamesByType(),i=r[0];if(!o.isDefined(i))throw new o.UserInputError({code:"INVALID_DATA_SHAPE",message:"No first numeric variable found",suggestion:"Provide at least one numeric column for this chart type."});const n=o.isDefined(r[1])?{transforms:[],scales:[]}:j(),s={x:i,y:r[1]??x,size:r[2],label:t[0]},a=[...n.scales];return o.isDefined(s.size)&&a.push(o.scale.size.continuous()),{layers:[o.geom.point()],coords:o.coord.cartesian(),mapping:s,scales:a,transforms:n.transforms,seriesVariables:[]}},Xe=e=>{const r=o.inferXVariable(e.dataset),{numeric:t}=e.dataset.groupVariableNamesByType(),i=t.filter(n=>n!==r);return{transforms:[o.transform.reshape({keep:[r],keyName:"key",valueName:o.DEFAULT_RESHAPE_VALUE_NAME}),o.transform.filter({variableName:o.DEFAULT_RESHAPE_VALUE_NAME,operator:"neq",value:null})],layers:[o.geom.tile()],coords:o.coord.cartesian(),mapping:{x:r,y:"key",color:o.DEFAULT_RESHAPE_VALUE_NAME},scales:[o.scale.color.continuous()],seriesVariables:i,config:{legend:{position:"none"},axes:{x:{position:"top"},y:{position:"left"}}}}},T=(e,r,t)=>{const i=t?.seriesStyles?.[e]?.lineStyle;return o.geom.line({transforms:[o.transform.constant({variableName:o.LAYER_LABEL_VARIABLES.line,type:"categorical",value:e})],aes:{y:e,color:o.LAYER_LABEL_VARIABLES.line,...i?{lineType:{value:i}}:{}},...r?{yScaleType:"secondary"}:void 0})},$e=(e,r,t)=>{const{numeric:i}=e.dataset.groupVariableNamesByType(),n=o.inferXVariable(e.dataset),s=o.readFoldKeepVariables(e.dataset,n),a=i.filter(d=>d!==n),l=o.COMBO_BAR_POSITIONS[r?.comboType??"grouped-bars"],c=l===null;if(a.length===1)return c?q(e,r,t):g(e,"dodge",o.coord.cartesian(),r,t);const u=e.axes?.hasDualYAxis===!0,p=c?[]:a.slice(0,-1),f=c?a:a.slice(-1),y=[],b=[];if(l!==null&&p.length>0){const d=p.length===1?p[0]:null;o.isDefined(d)?y.push(o.geom.bar({transforms:[o.transform.constant({variableName:o.LAYER_LABEL_VARIABLES.bar,type:"categorical",value:d})],aes:{y:d,color:o.LAYER_LABEL_VARIABLES.bar},position:l})):y.push(o.geom.bar({transforms:[o.transform.reshape({keep:s,reshape:p,keyName:"key",valueName:o.DEFAULT_RESHAPE_VALUE_NAME})],aes:{y:o.DEFAULT_RESHAPE_VALUE_NAME,color:"key"},position:l}))}if(c&&f.length>=2){const d=u?f.slice(0,-1):f,w=d.length===1?d[0]:null;if(o.isDefined(w))y.push(T(w,!1,t));else{const S=R({appearance:t,seriesVariables:d});y.push(o.geom.line({transforms:[o.transform.reshape({keep:s,reshape:d,keyName:"key",valueName:o.DEFAULT_RESHAPE_VALUE_NAME})],aes:{y:o.DEFAULT_RESHAPE_VALUE_NAME,color:"key",...S.mapping}})),b.push(...S.scales)}if(u){const S=f[f.length-1];o.isDefined(S)&&y.push(T(S,!0,t))}}else for(const d of f)y.push(T(d,u,t));return{layers:y,coords:o.coord.cartesian(),mapping:{x:n},scales:b,seriesVariables:a}},A=e=>()=>{throw new o.UserInputError({code:"UNSUPPORTED_GRAPH_TYPE",message:`Unsupported graph type: ${e}`,context:{requested:e}})},je={line:(e,r,t)=>q(e,r,t),areaStacked:(e,r,t)=>ze(e,r,t),bar:(e,r,t)=>g(e,"dodge",o.coord.flip(),r,t),barStacked:(e,r,t)=>g(e,"stack",o.coord.flip(),r,t),barStackedFill:(e,r,t)=>g(e,"fill",o.coord.flip(),r,t),column:(e,r,t)=>g(e,"dodge",o.coord.cartesian(),r,t),columnStacked:(e,r,t)=>g(e,"stack",o.coord.cartesian(),r,t),columnStackedFill:(e,r,t)=>g(e,"fill",o.coord.cartesian(),r,t),pie:e=>H(e,"pie"),donut:e=>H(e,"donut"),scatter:e=>Ye(e),bubble:e=>Ke(e),combo:(e,r,t)=>$e(e,r,t),funnel:A("funnel"),heatmap:e=>Xe(e),waterfall:A("waterfall"),mekko:A("mekko"),table:A("table")},qe=new o.TransformRegistry,Ze=["key",o.prefixInternalVariable("lineSeriesLabel"),o.prefixInternalVariable("barSeriesLabel")];function Je(e){const r=e.annotations??[],t=er(e.mapping),i=tr(e.dataset,e.transforms,e.layers),n=[];for(const s of r){if(s.type!=="highlight")continue;const a=rr({annotation:s,rowIdentityVariable:t,dataset:e.dataset,compiledVariableNames:i});a!==null&&n.push({type:"highlight",id:s.id,predicate:a,scope:Qe(s.highlight,e.mapping)})}return n}function Qe(e,r){const t=o.extractVariableName(r.x);return!(t!==null&&t!=="")&&e==="x-value"?"series":e}function er(e){const r=o.extractVariableName(e.x);return r!==null&&r!==""?r:o.extractVariableName(e.color)}function rr({annotation:e,rowIdentityVariable:r,dataset:t,compiledVariableNames:i}){switch(e.highlight){case"x-value":return U(e,r,t);case"series":return W(e,i);case"data-point":{const n=U(e,r,t),s=W(e,i);return n===null&&s===null?null:n===null?s:s===null?n:{and:[n,s]}}}}function U(e,r,t){if(r===null)return null;const i=or(e,r,t);return i===null?null:{variable:r,eq:i}}function W(e,r){const t=e.columnKey;if(!o.isDefined(t))return null;const i=Ze.filter(n=>r.includes(n));return i.length===0?null:{or:i.map(n=>({variable:n,eq:t}))}}function tr(e,r,t){const i=[...e.getVariableNames()],n=s=>{for(const a of s){const{getIntroducedVariables:l}=qe.get(a.transformType),c=l?.(a);c&&i.push(...c)}};n(r);for(const s of t)n(s.transforms??[]);return i}function or(e,r,t){return e.rowValue!==void 0?e.rowValue:!o.isDefined(e.rowIndex)||!t.getVariableNames().includes(r)?null:t.getValues(r)[e.rowIndex]??null}function ir(e,r,t){const{colorScheme:i,customPalettes:n}=t;if(n&&e&&n[e])return{type:"custom",id:e};if(e?.startsWith("preset:pastel"))return{type:"pastel",variant:L(r)};if(e?.startsWith("preset:graphy"))return{type:"graphy",variant:L(r)};if(e?.startsWith("preset:mono:")){const s=e.slice(12);if(nr(s))return{type:"mono",base:s,variant:i}}if(e?.startsWith("preset:neon:")){const s=e.slice(12);if(sr(s))return{type:"neon",base:s,variant:L(r)}}return{type:"default"}}function L(e){if(e==="waterfall")return"waterfall"}function nr(e){return o.MONO_BASES.includes(e)}function sr(e){return o.NEON_BASES.includes(e)}function ar({axes:e,palette:r,overrides:t,isFlipped:i}){const n=[];return n.push(M("x",i?e?.y:e?.x)),n.push(M("y",i?e?.x:e?.y)),n.push(o.scale.color.palette({palette:r,overrides:t})),n}function M(e,r){return r?.scaleType==="logarithmic"||r?.min!==void 0||r?.max!==void 0?r.scaleType==="logarithmic"?o.scale[e].log({domainMin:r.min??void 0,domainMax:r.max??void 0}):o.scale[e]({domainMin:r.min??void 0,domainMax:r.max??void 0}):o.scale[e]()}function lr(e){if(!e)return;const r={};for(const[t,i]of Object.entries(e)){if(!t.startsWith("series"))continue;const n=Number.parseInt(t.slice(6));if(Number.isNaN(n))continue;const s={hex:i.customColor,id:i.paletteColorId};(s.hex!==void 0||s.id!==void 0)&&(r[n]=s)}return Object.keys(r).length>0?r:void 0}function cr(e){const r=[],t=h(e?.fontAxisLabel);t!==void 0&&r.push(o.style.axisLabel(t));const i=gr(e);i!==void 0&&r.push(o.style.tickLabel(i));const n=h(e?.fontGoalLineLabel);return n!==void 0&&r.push(o.style.geom.rule.label(n)),r.push(...br(e)),r.push(...ur(e)),r.push(...pr(e)),r.push(...mr(e)),r}function ur(e){const r=[],t=fr(e);t!==void 0&&r.push(o.style.tooltip(t));const i=E(h(e?.fontTooltipHeading),v(e?.tooltipHeadingTextColor));i!==void 0&&r.push(o.style.tooltip.heading(i));const n=h(e?.fontTooltipLabel),s=E(n,v(e?.tooltipLabelTextColor));s!==void 0&&r.push(o.style.tooltip.label(s));const a=E(n,v(e?.tooltipValueTextColor));a!==void 0&&r.push(o.style.tooltip.value(a));const l=v(e?.tooltipPrimaryRowColor);l!==void 0&&r.push(o.style.tooltip.primaryRow({background:l}));const c=dr(e);return c!==void 0&&r.push(o.style.annotation.pinnedNumber.label(c),o.style.annotation.comment.label(c)),r}var dr=e=>{const r=v(e?.tooltipBackground),t=v(e?.tooltipBorderColor),i={...E(h(e?.fontMiniTooltipLabel),v(e?.tooltipValueTextColor)),...r===void 0?{}:{background:r},...t===void 0?{}:{borderColor:t}};return Object.keys(i).length===0?void 0:i},fr=e=>{const r=v(e?.tooltipBackground),t=v(e?.tooltipBorderColor),i=m(e?.tooltipBorderWidth),n=m(e?.tooltipBorderRadius),s=m(e?.tooltipPaddingBlock),a=m(e?.tooltipPaddingInline),l=typeof e?.tooltipShadow=="string"?hr(e.tooltipShadow)??void 0:void 0,c={...r===void 0?{}:{background:r},...t===void 0?{}:{borderColor:t},...i===void 0?{}:{borderWidth:i},...n===void 0?{}:{borderRadius:n},...s===void 0?{}:{paddingBlock:s},...a===void 0?{}:{paddingInline:a},...l===void 0?{}:{shadow:l}};return Object.keys(c).length===0?void 0:c};function pr(e){const r=[],t=m(e?.legendItemGap);t!==void 0&&r.push(o.style.legend({gap:t}));const i=h(e?.fontLegendLabel),n=v(e?.legendTextColor),s=E(i,n),a=vr(e,s);a!==void 0&&r.push(o.style.legendItem(a));const l=yr(e);return l!==void 0&&r.push(o.style.legendItem.swatch({size:l})),s!==void 0&&r.push(o.style.directLabel(s)),r}var vr=(e,r)=>{const t=v(e?.legendBackground),i=v(e?.legendBorderColor),n=m(e?.legendPillBorderWidth),s=m(e?.legendPillPaddingInline),a=m(e?.legendPillPaddingBlock),l={...r,...t===void 0?{}:{background:t},...i===void 0?{}:{borderColor:i},...n===void 0?{}:{borderWidth:n},...s===void 0?{}:{paddingInline:s},...a===void 0?{}:{paddingBlock:a}};return Object.keys(l).length===0?void 0:l},yr=e=>{const r=m(e?.legendSwatchWidth);return m(e?.legendSwatchHeight)??r},E=(e,r)=>{if(!(e===void 0&&r===void 0))return{...e,...r===void 0?{}:{textColor:r}}};function br(e){const r=v(e?.dataLabelTextColor),t=v(e?.stackTotalTextColor),i=[["observation",h(e?.fontDataLabel),r],["category",h(e?.fontCategoryLabel),r],["aggregate",h(e?.fontStackTotal),t]],n=[];for(const[u,p,f]of i)p===void 0&&f===void 0||n.push(o.style.dataLabel[u]({...p,...f===void 0?{}:{textColor:f}}));const s=v(e?.dataLabelInsideTextColor);s!==void 0&&(n.push(o.style.dataLabel.observation.inside({textColor:s})),n.push(o.style.dataLabel.category.inside({textColor:s})));const a=v(e?.dataLabelOutsideBackground);a!==void 0&&(n.push(o.style.dataLabel.observation.outside({background:a})),n.push(o.style.dataLabel.category.outside({background:a})));const l=v(e?.stackTotalBackground),c=v(e?.stackTotalStroke);return(l!==void 0||c!==void 0)&&n.push(o.style.dataLabel.aggregate({...l===void 0?{}:{background:l},...c===void 0?{}:{borderColor:c}})),n}function mr(e){const r=[],t=v(e?.trendPositiveColor),i=v(e?.trendNegativeColor),n=v(e?.trendNeutralColor);return t!==void 0&&r.push(o.style.headlineItem.trend.up({textColor:t})),i!==void 0&&r.push(o.style.headlineItem.trend.down({textColor:i})),n!==void 0&&r.push(o.style.headlineItem.trend.flat({textColor:n})),r}function v(e){if(!(typeof e!="string"||e.trim().length===0))return e}function hr(e){const r=e.trim();if(r==="none")return"none";const t=r.split(/\s+/),i=_(t[0]),n=_(t[1]),s=_(t[2]),a=t.slice(3).join(" ");return i===null||n===null||s===null||a.length===0?null:{offsetX:i,offsetY:n,blur:s,color:a}}var _=e=>{if(e===void 0)return null;const r=/^(-?\d*\.?\d+)(px)?$/.exec(e);if(r?.[1]===void 0)return null;const t=Number.parseFloat(r[1]);return Number.isFinite(t)?t:null};function h(e){if(typeof e!="string")return;const r=K(e);if(r!==null)return{fontFamily:r.family,fontSize:V(r.size),fontWeight:r.weight,...r.lineHeight===void 0?{}:{lineHeight:r.lineHeight}}}function gr(e){const r=h(e?.fontTickLabel),t=m(e?.tickLabelOffset);if(!(r===void 0&&t===void 0))return{...r,...t===void 0?{}:{offset:t}}}function m(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(typeof e!="string")return;const r=N(e);return r===null?void 0:V(r)}var Sr=new Set(["column","columnStacked","columnStackedFill","bar","barStacked","barStackedFill","line","areaStacked","scatter","bubble","funnel","combo"]),Er=new Set(["column","columnStacked","columnStackedFill","bar","barStacked","barStackedFill","line","areaStacked","combo"]);function Ar(e,r,t={}){return kr(o.parseDataset(r),e,t)}function kr(e,r,t={}){const i=r.type??"column",n=Me({dataset:e,axes:r.axes},i,r.options??void 0,r.appearance??void 0),s=n.coords.coordType==="flip",a=n.transforms??[],l=ir(r.appearance?.paletteId,i,t),c=lr(r.appearance?.seriesStyles);return{mapping:n.mapping,layers:Tr(i,r,n.layers,n.coords,n.mapping,n.seriesVariables),scales:[...ar({axes:r.axes,palette:l,overrides:c,isFlipped:s}),...n.scales],styles:ge(he(me({palette:l,overrides:c,ctx:t}),[...n.styleDefaults??[],...Se(r.appearance??void 0),...Te({appearance:r.appearance??void 0,themeOverrides:r.themeOverrides,palette:l,overrides:c,ctx:t}),...cr(r.themeOverrides),...ie(r.themeOverrides)],oe(r.annotations)),ne(r.themeOverrides)),transforms:a,highlights:Je({annotations:r.annotations,dataset:e,mapping:n.mapping,transforms:a,layers:n.layers}),annotations:ae({annotations:r.annotations,dataset:e,mapping:n.mapping,seriesVariables:n.seriesVariables}),coords:n.coords,config:we(r,s,n.config)}}function Tr(e,r,t,i,n,s){const a=xr(r.dataLabels),l=a===void 0?t:t.filter(u=>u.interactive!==!1).map(u=>({...u,dataLabels:{...a,...u.dataLabels}})),c=r.axes?.hasDualYAxis??!1;return[...l,...Lr({type:e,trendline:r.referenceLines?.trendline,coords:i}),..._r({type:e,hasDualYAxis:c,goalLine:r.referenceLines?.goalLine,coords:i}),...Vr({type:e,hasDualYAxis:c,averageLine:r.referenceLines?.averageLine,coords:i,mapping:n,seriesVariables:s})]}function Lr({type:e,trendline:r,coords:t}){return r===void 0?[]:Sr.has(e)?t.coordType==="polar"?[]:[o.geom.line({aes:{lineType:{value:"dashed"}},stat:o.stat.smooth({method:r}),interactive:!1})]:[]}function _r({type:e,hasDualYAxis:r,goalLine:t,coords:i}){if(!Nr(t))return[];if(i.coordType==="polar")return[];const n=i.coordType==="flip"?"end":"start";return[o.geom.rule({aes:{y:{value:t.target}},params:{labelPosition:n,label:t.label??"Goal"},yScaleType:e==="combo"&&r?"secondary":"primary",interactive:!1})]}function Nr(e){return e!==void 0&&Number.isFinite(e.target)}function Vr({type:e,hasDualYAxis:r,averageLine:t,coords:i,mapping:n,seriesVariables:s}){if(t===void 0)return[];if(!Er.has(e))return[];if(i.coordType==="polar")return[];const a=X(t.columnKey);if(!s.includes(a))return[];const l=n.color==="key",c=l?o.DEFAULT_RESHAPE_VALUE_NAME:a,u=l?[o.transform.filter({variableName:"key",operator:"eq",value:a})]:[];return[o.geom.rule({aes:{y:c,color:void 0,group:void 0,lineType:void 0},stat:o.stat.mean(),transforms:u,params:{label:"Average",labelPosition:i.coordType==="flip"?"end":"start"},yScaleType:e==="combo"&&r?"secondary":"primary",interactive:!1})]}function xr(e){if(!e)return;const r={};return e.showDataLabels!==void 0&&(r.showDataLabels=e.showDataLabels),e.dataLabelFormat!==void 0&&(r.format=e.dataLabelFormat),e.showStackTotals!==void 0&&(r.showStackTotals=e.showStackTotals),e.showCategoryLabels!==void 0&&(r.showCategoryLabels=e.showCategoryLabels),Object.keys(r).length===0?void 0:r}var Dr=[.8,1,1.2,1.4,1.6,1.8,2,2.5,3,4];exports.CHART_TEXT_SCALES=Dr;exports.ROOT_FONT_SIZE_PX=Z;exports.convertGraphConfig=Ar;exports.isFontStyle=G;exports.parseFontLength=N;exports.parseFontShorthand=K;exports.parseFontWeight=z;exports.parseUnitlessLineHeight=Y;exports.toPixels=V;
@@ -154,7 +154,7 @@ export declare interface Appearance {
154
154
  /** Tints the graph background with the palette instead of leaving it plain. */
155
155
  backgroundModifier?: 'none' | 'tint';
156
156
  border?: Partial<{
157
- style: 'none' | 'custom' | 'tinted' | 'gradient' | 'preset' | 'grey';
157
+ style: 'none' | 'custom' | 'tinted' | 'gradient' | 'preset' | 'gray';
158
158
  color: string;
159
159
  width: number;
160
160
  }>;
@@ -163,7 +163,7 @@ export declare interface Appearance {
163
163
  /** One of the {@link CHART_TEXT_SCALES} multipliers applied to all text sizes. */
164
164
  textScale?: number;
165
165
  /** How non-highlighted series are de-emphasized when one series is highlighted. */
166
- highlightStyle?: 'grey' | 'fade-color';
166
+ highlightStyle?: 'gray' | 'fade-color';
167
167
  isLogoHidden?: boolean;
168
168
  numberFormat?: Partial<{
169
169
  /** Fixed number of decimal places, or 'auto' to choose per value. */
@@ -1694,7 +1694,7 @@ declare interface MeanStatSpec {
1694
1694
  declare type MissingValuesType = 'zero' | 'gap' | 'connect';
1695
1695
 
1696
1696
  /** The hues available as a base for monochrome palettes, in pick order. */
1697
- declare const MONO_BASES: readonly ["brick", "grey", "red", "orange", "yellow", "green", "cyan", "blue", "purple", "pink"];
1697
+ declare const MONO_BASES: readonly ["brick", "gray", "red", "orange", "yellow", "green", "cyan", "blue", "purple", "pink"];
1698
1698
 
1699
1699
  /** One of the base hues a monochrome palette can be built from. */
1700
1700
  declare type MonoPaletteBase = (typeof MONO_BASES)[number];