@bicharts/shape-core 0.6.98 → 0.6.102

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.
@@ -0,0 +1,2 @@
1
+ /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
+ import{a as he}from"./chunk-U3H6UBOO.mjs";import{a as mt,f as te,g as ye,h as se,i as be,j as ie}from"./chunk-A4PQBWRA.mjs";import{c as ct}from"./chunk-IPPPCWAK.mjs";import{f as lt,k as ut}from"./chunk-INMDBTAR.mjs";import{e as rt,k as ge,m as ot,n as at,o as pe}from"./chunk-HJA26Z2E.mjs";import{A as fe,B as tt,E as nt,a as me,b as ee,c as Ke,d as de,g as He,h as Ye,j as je,l as Xe,m as Ze,o as Qe,p as Q,q as qe,r as Je,u as Ne,w as et}from"./chunk-CZJ7M6A5.mjs";import{c as Ve,f as Ie}from"./chunk-WC4JINEZ.mjs";import{b as it,d as st}from"./chunk-5HI6TVMM.mjs";var Jt=[[24.4,49.4,-125,-66.9],[51.2,71.5,-168,-129.9],[18.9,22.3,-160.3,-154.8]],en=[7,72,-172,-52];function dt(n,e,t){return n>=t[0]&&n<=t[1]&&e>=t[2]&&e<=t[3]}var ne=n=>Math.round(n*10)/10;function gt(n,e=3){let t=[],i=[],r=0,s=0;for(let l of n){let a=l?.lat,u=l?.lon;if(typeof a!="number"||typeof u!="number"||!isFinite(a)||!isFinite(u)||a<-90||a>90||u<-180||u>180)continue;t.push(a),i.push(u);let m=l?.country?String(l.country).trim().toUpperCase():"",f=m?Se(m):null;f?((m==="US"||m==="USA")&&r++,f==="north-america"&&s++):(Jt.some(c=>dt(a,u,c))&&r++,dt(a,u,en)&&s++)}let o=t.length;return o<e?null:(t.sort((l,a)=>l-a),i.sort((l,a)=>l-a),{pctUsa:ne(r/o*100),pctNa:ne(s/o*100),latP5:ne(Q(t,.05)),latP95:ne(Q(t,.95)),lonP5:ne(Q(i,.05)),lonP95:ne(Q(i,.95)),n:o})}var ft={"north-america":"AG AI AW BB BL BM BQ BS BZ CA CR CU CW DM DO GD GL GP GT HN HT JM KN KY LC MF MQ MS MX NI PA PM PR SV SX TC TT US VC VG VI","south-america":"AR BO BR CL CO EC FK GF GY PE PY SR UY VE",europe:"AD AL AT AX BA BE BG BY CH CY CZ DE DK EE ES FI FO FR GB GG GI GR HR HU IE IM IS IT JE LI LT LU LV MC MD ME MK MT NL NO PL PT RO RS RU SE SI SJ SK SM UA VA",africa:"AO BF BI BJ BW CD CF CG CI CM CV DJ DZ EG EH ER ET GA GH GM GN GQ GW KE KM LR LS LY MA MG ML MR MU MW MZ NA NE NG RE RW SC SD SH SL SN SO SS ST SZ TD TG TN TZ UG YT ZA ZM ZW",asia:"AE AF AM AZ BD BH BN BT CC CN CX GE HK ID IL IN IO IQ IR JO JP KG KH KP KR KW KZ LA LB LK MM MN MO MV MY NP OM PH PK PS QA SA SG SY TH TJ TL TM TR TW UZ VN YE",oceania:"AS AU CK FJ FM GU KI MH MP NC NF NR NU NZ PF PG PN PW SB TK TO TV UM VU WF WS",antarctica:"AQ BV GS HM TF"},oe=(()=>{let n=new Map;for(let e of Object.keys(ft))for(let t of ft[e].split(/\s+/))t&&n.set(t,e);return n})();function tn(n){for(let[e,t]of n){let i=oe.get(e);i&&!oe.has(t)&&oe.set(t,i)}}tn(lt);function Se(n){if(!n)return null;let e=String(n).trim().toUpperCase();if(!e)return null;let t=oe.get(e);if(t)return t;let i=ut(String(n));return i?oe.get(i)??null:null}function oi(n,e=2){return Ee(n.map(t=>[t,1]),e)}function Ee(n,e=2){let t=new Map,i=0;for(let[o,l]of n){let a=Se(o);if(!a)continue;let u=typeof l=="number"&&isFinite(l)&&l>0?l:1;t.set(a,(t.get(a)??0)+u),i+=u}if(i<e||!t.size)return null;let r="europe",s=-1;for(let o of Array.from(t.keys()).sort()){let l=t.get(o);l>s&&(r=o,s=l)}return{dominantGeoRegion:r,dominantGeoRegionPct:ne(s/i*100),regionCount:t.size,n:i}}function De(n){let e=(n||"").toLowerCase();return e==="en-us"||e==="en"||e.startsWith("en-us-")||e==="en-ph"||e==="en-bz"}var ve={a:0,b:0,c:0,yearFirst:!1,sep:"",trail:"",word:"",day:0,year:0,namedOrder:"dmy",cjkPattern:""},nn=/\s+(\d{1,2}):(\d{2})(?::(\d{2})(?:[.,]\d{1,9})?)?(?:\s*([ap])\.?\s?m\.?)?$/i,rn=/^(\d{1,4})(\s*[./-]\s*)(\d{1,2})(\s*[./-]\s*)(\d{1,4})(\.?)$/,sn=/^(\d{4})(\s*[年년]\s*)(\d{1,2})(\s*[月월]\s*)(\d{1,2})(\s*[日일号])$/,on=/(\d)(?:st|nd|rd|th|er|º|ª)(?=[\s.,/-]|$)/gi,an=new Set(["de","del","of"]),ln=new Set(["\u0433","\u0440","r"]),un=/^[\p{L}\p{M}\u0970\u05f3]+$/u,ke=/^\d+$/;function cn(n){let e=+n[1],t=+n[2],i=n[3]===void 0?0:+n[3],r=n[4]!==void 0;if(t>59||i>59)return null;if(r){if(e<1||e>12)return null;e=e%12+(n[4].toLowerCase()==="p"?12:0)}else if(e>23)return null;return{h:e,mi:t,s:i,seconds:n[3]!==void 0,meridiem:r}}function pt(n){let e=n.replace(/[\u200e\u200f\u061c]/g,"").replace(/\s+/g," ").trim();if(e==="")return null;e=mt(e);let t=null,i=nn.exec(e);if(i){if(t=cn(i),!t)return null;e=e.slice(0,i.index)}let r;if(r=sn.exec(e)){let c=`cjk|${r[2]}|${r[4]}|${r[6]}`;return{...ve,form:"cjk",key:c,clock:t,a:+r[1],b:+r[3],c:+r[5],yearFirst:!0,cjkPattern:`%Y${r[2]}%m${r[4]}%d${r[6]}`}}if(r=rn.exec(e)){let c=r[2],S=r[4];if(c!==S)return null;let I=c.trim(),w=r[6];if(w&&I!==".")return null;let C=[r[1].length,r[3].length,r[5].length],g=C[0]===4,h=C[2]===4;return g===h||(g?C[1]>2||C[2]>2:C[0]>2||C[1]>2)?null:g&&I==="-"&&c==="-"&&C[1]===2&&C[2]===2?"iso":g&&I==="."&&c==="."&&!w&&!(C[1]===2&&C[2]===2)?null:{...ve,form:"numeric",key:`num|${g?"y":"x"}|${c}|${w}`,clock:t,a:+r[1],b:+r[3],c:+r[5],yearFirst:g,sep:c,trail:w}}let s=e.replace(on,"$1").split(/[\s.,/-]+/).filter(c=>c!==""&&!an.has(c.toLowerCase()));if(s.length===4&&ke.test(s[2])&&ln.has(s[3].toLowerCase())&&s.pop(),s.length!==3)return null;let o=s.map(c=>ke.test(c)?"N":un.test(c)?"W":"?").join(""),l=s.map(c=>ke.test(c)?c:""),a=0,u=0,m="",f;if(o==="NWN"&&l[0].length<=2&&l[2].length===4)a=+l[0],m=s[1],u=+l[2],f="dmy";else if(o==="WNN"&&l[1].length<=2&&l[2].length===4)m=s[0],a=+l[1],u=+l[2],f="mdy";else if(o==="NWN"&&l[0].length===4&&l[2].length<=2)u=+l[0],m=s[1],a=+l[2],f="ymd";else return null;return{...ve,form:"named",key:`named|${f}`,clock:t,day:a,year:u,word:m,namedOrder:f}}var mn=[31,28,31,30,31,30,31,31,30,31,30,31],dn=n=>n%4===0&&n%100!==0||n%400===0;function ht(n,e,t){return n>=1&&n<=9999&&e>=1&&e<=12&&t>=1?t<=(e===2&&dn(n)?29:mn[e-1]):!1}function fn(n,e,t,i){let r=new Date(Date.UTC(2e3,e-1,t,i?.h??0,i?.mi??0,i?.s??0));return r.setUTCFullYear(n),r}function yt(n,e={}){let t=(e.floor??1)>=1,i=new Map,r=new Map,s=0,o=null;for(let g of n){if(g==null)continue;if(typeof g!="string"){if(t)return null;s++;continue}let h=g.trim();if(h==="")continue;s++;let b=i.get(h);if(b===void 0&&(b=pt(h),i.set(h,b)),b===null||b==="iso"){if(t)return null;continue}if(t){if(o===null)o=b;else if(b.key!==o.key)return null}else r.set(b.key,(r.get(b.key)??0)+1)}if(!t){let g=0,h="";for(let[b,p]of r)p>g&&(g=p,h=b);if(g===0||g/s<e.floor)return null;o=[...i.values()].find(b=>b!==null&&b!=="iso"&&b.key===h)??null}if(o===null)return null;let l=o.key,a=[...i.values()].filter(g=>g!==null&&g!=="iso"&&g.key===l),u,m="shape",f=null;if(o.form==="named"){if(u=o.namedOrder,f=be(a.map(g=>g.word),e.locale),!f)return null}else if(o.form==="cjk"||o.yearFirst)u="ymd";else{let g=0,h=0;for(let b of a)b.a>12&&g++,b.b>12&&h++;if(g>0&&h>0)return null;g>0?(u="dmy",m="values"):h>0?(u="mdy",m="values"):o.sep.trim()==="."?(u="dmy",m="shape"):(u=De(e.locale)?"mdy":"dmy",m="locale")}let c=g=>{if(g.form==="named"){let h=f.get(te(g.word));return h===void 0?null:[g.year,h+1,g.day]}return g.yearFirst?[g.a,g.b,g.c]:u==="dmy"?[g.c,g.b,g.a]:[g.c,g.a,g.b]},S=1/0,I=-1/0,w=0;for(let g of a){let h=c(g);if(!h||!ht(h[0],h[1],h[2])){if(t)return null;w++;continue}S=Math.min(S,h[0]),I=Math.max(I,h[0])}if(!t&&(r.get(l)-w)/s<e.floor||S>=2400&&I<=2699||S>=1300&&I<=1500)return null;let C={form:o.form,order:u,orderFrom:m,hasTime:a.some(g=>g.clock!==null),read(g){if(typeof g!="string")return null;let h=g.trim();if(h==="")return null;let b=i.get(h);if(b===void 0&&(b=pt(h),i.set(h,b)),b===null||b==="iso"||b.key!==l)return null;let p=c(b);return!p||!ht(p[0],p[1],p[2])?null:fn(p[0],p[1],p[2],b.clock)}};if(o.form!=="named"&&!a.some(g=>g.clock?.meridiem)){let g;o.form==="cjk"?g=o.cjkPattern:o.yearFirst?g=`%Y${o.sep}%m${o.sep}%d${o.trail}`:g=(u==="dmy"?`%d${o.sep}%m${o.sep}%Y`:`%m${o.sep}%d${o.sep}%Y`)+o.trail;let h=a.filter(b=>b.clock!==null).length;h===0?C.pattern=g:h===a.length&&(C.pattern=g+(a.every(b=>b.clock.seconds)?" %H:%M:%S":" %H:%M"))}return C}import Yt from"papaparse";var gn=["rate","ratio","pct","percent","percentage","rating","share","score","index","nps","csat","margin","yield","coverage","utilization","utilisation","z[_-]?score","average","avg","mean","median","stddev","variance","gpa","percentile","quantile","efficiency","accuracy","probability","multiplier","coefficient","correlation","occupancy","age","bmi","temperature","density","pressure","humidity","ph","velocity","speed","elevation","altitude","latency","throughput","bandwidth","iops","ppm","ppb","dpmo","bps","capita","temperatuur","temperatur","temperatura","teplota","lampotila","homerseklet","sicaklik","pression","presion","pressao","pressione","druck","tryck","tlak","paine","nyomas","presiune","humidite","humedad","umidade","umidita","feuchtigkeit","vochtigheid","kosteus","vlhkost","vitesse","velocidad","velocidade","velocita","geschwindigkeit","snelheid","hastighet","hastighed","rychlost","nopeus","sebesseg","brzina","predkosc","densite","densidad","densidade","densita","dichte","dichtheid","hustota","tiheys","gustoca","moyenne","mediane","promedio","mediana","gemiddelde","durchschnitt","mittelwert","genomsnitt","gennemsnit","gjennomsnitt","keskiarvo","atlag","ortalama","prosjek","srednia","prumer","priemer","medie","taux","tasa","taxa","tasso","verhaltnis","verhouding","aandeel","anteil","andel","osuus","podil","udzial","udio","pourcentage","porcentaje","percentual","prozent","procent","prosentti","szazalek","yuzde","participacion","participacao","pondere","omjer","arany","oran","rata","leeftijd","edad","idade","wiek","eletkor","varsta","puntuacion","pontuacao","punteggio","betyg","ocena","indice","indeks","wskaznik","puan","ocupacion","ocupacao","occupazione","auslastung","bezetting","belaggning","belaegning","belegg","kayttoaste","oblozenie","obsazenost","obsadenost","kihasznaltsag","doluluk","ocupare","popunjenost","efficacite","eficiencia","efficienza","effizienz","effectiviteit","verimlilik"],pn=["pct","percent","percentage","rate","ratio","rating","share","score","index","nps","csat","margin","yield","coverage","utilization","utilisation","gpa","percentile","quantile","bmi","density","pressure","humidity","velocity","efficiency","occupancy","latency","throughput","bandwidth","iops","ppm","ppb","dpmo","bps"],hn=["latitude","longitude"],yn=["latitude","longitude"];function q(n){return me(n)}var _t=["somme de","suma de","soma de","summe von","som van","somma di","summa av","sum av","sum af","soucet z","suma z","totaal van","total de","toplam","osszeg","nombre de","recuento de","contagem de","anzahl von","aantal van","conteggio di","antal av","lukumaara","pocet z","sum pa","\u0441\u0443\u043C\u043C\u0430","\u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E","\u0441\u0443\u043C\u0430","\u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C","\u03B1\u03B8\u03C1\u03BF\u03B9\u03C3\u03BC\u03B1","\u03C0\u03BB\u03B7\u03B8\u03BF\u03C2"],bn=["moyenne de","promedio de","media de","media di","durchschnitt von","gemiddelde van","medelvarde av","genomsnitt av","gennemsnit af","keskiarvo","atlag","ortalama","prumer z","srednia z","medie de","minimum de","minimo de","minimo di","minimum von","maximum de","maximo de","massimo di","maximum von","prom.","\u0441\u0440\u0435\u0434\u043D\u0435\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435","\u0441\u0440\u0435\u0434\u043D\u0435\u0435","\u0441\u0435\u0440\u0435\u0434\u043D\u0454","\u03BC\u03B5\u03C3\u03BF\u03C2 \u03BF\u03C1\u03BF\u03C2","\u0645\u06CC\u0627\u0646\u06AF\u06CC\u0646"],Sn=["osszege","sucet","\u7684\u603B\u548C","\u7684\u8BA1\u6570","\u306E\u5408\u8A08","\uC758 \uD569\uACC4"],_n=["atlaga","priemer","\u7684\u5E73\u5747\u503C","\u306E\u5E73\u5747","\uC758 \uD3C9\uADE0"],_e=Object.freeze({"nombre de":"count","recuento de":"count","contagem de":"count","anzahl von":"count","aantal van":"count","conteggio di":"count","antal av":"count",lukumaara:"count","pocet z":"count",\u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E:"count",\u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C:"count",\u03C0\u03BB\u03B7\u03B8\u03BF\u03C2:"count",\u7684\u8BA1\u6570:"count","minimum de":"min","minimo de":"min","minimo di":"min","minimum von":"min","maximum de":"max","maximo de":"max","massimo di":"max","maximum von":"max"});function Oe(n){return[...n].sort((e,t)=>t.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")}var At=new RegExp("^\\s*(?:(?:sum|count|count\\s+distinct|distinct\\s+count)\\s+of\\s+|(?:"+Oe(_t)+")\\s+)","i");function bt(n){for(let e of n){let t=e.codePointAt(0)??0;if(t>=11904&&t<=40959||t>=44032&&t<=55215)return!0}return!1}var An="[\u2013\u2014-]";function Ct(n){let e=n.filter(r=>!bt(r)),t=n.filter(bt),i=[];return e.length&&i.push("(?:\\s+|\\s*"+An+"\\s*)("+Oe(e)+")"),t.length&&i.push("\\s*("+Oe(t)+")"),new RegExp("(?:"+i.join("|")+")\\s*$","i")}var Pe=Ct(Sn),Cn=Ct(_n);function Ae(n,e){let t=e.exec(n);if(!t)return null;let i=n.slice(0,t.index);return i.trim()===""?null:{base:i,label:(t[1]??t[2]??"").toLowerCase()}}function xt(n){let e=q(String(n??"").trim().toLowerCase());if(!e)return null;for(let r of bn)if(e.startsWith(r+" "))return _e[r]??"avg";for(let r of _t)if(e.startsWith(r+" ")||e===r)return _e[r]??"sum";let t=Ae(e,Cn);if(t)return _e[t.label]??"avg";let i=Ae(e,Pe);return i?_e[i.label]??"sum":null}var xn=/(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])/g,Mn=new RegExp("\\b("+gn.join("|")+")\\b|("+pn.join("|")+")$","i"),Tn=new RegExp("\\b("+hn.join("|")+")\\b|("+yn.join("|")+")$","i");function xe(n){if(!n)return"";let e=String(n),t=q(e),i=At.exec(t);if(i)return e.slice(i[0].length).trim();let r=Ae(t,Pe);return(r?e.slice(0,r.base.length):e).trim()}function wn(n){if(!n)return!1;let e=q(String(n));return At.test(e)||Ae(e,Pe)!==null}var Rn=["count (distinct)","count distinct","distinct count","standard deviation","average","variance","median","product","stddev","std dev","count","sum","avg","min","minimum","max","maximum","var"],St=new RegExp("^\\s*("+[...Rn].sort((n,e)=>e.length-n.length).map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")+")\\s+of\\s+","i");function Mt(n){if(n==null)return"";let e=String(n),t=St.exec(e);if(!t)return e;let i=l=>l.toLowerCase().replace(/\s+/g," ").trim(),r=i(t[1]),s=e.slice(t[0].length),o=0;for(;o<8;){let l=St.exec(s);if(!l||i(l[1])!==r)break;let a=s.slice(l[0].length);if(a.trim()==="")break;s=a,o++}return o===0?e:e.slice(0,t[0].length)+s}function Le(n,e){if(!n||!e)return!1;let t=String(n);for(let i of e){let r=i?.hostName;if(r&&r!==i?.name&&t.includes(r))return!0}return!1}var Ce={Sum:["Sum of "],Avg:["Average of "],Average:["Average of "],Count:["Count of "],CountNonNull:["Count of "],Min:["Min of ","First ","Earliest "],Max:["Max of ","Last ","Latest "],Median:["Median of "],StandardDeviation:["Standard deviation of "],Variance:["Variance of "]},Tt=new RegExp("^("+Object.keys(Ce).join("|")+")\\((.+)\\)$");function wt(n){if(!n)return[];let e=Tt.exec(String(n).trim());if(!e)return[];let t=Ce[e[1]],i=e[2],r=[];for(let s=i.indexOf(".");s>=0;s=i.indexOf(".",s+1)){if(s===0)continue;let o=i.slice(s+1);if(o.trim()!=="")for(let l of t){let a=l+o;r.includes(a)||r.push(a)}}return r}function Rt(n,e,t){let i=Tt.exec(String(n??"").trim());if(!i)return!1;let r=i[1];if((r==="Count"||r==="CountNonNull")&&t==="Decimal")return!0;let s=new Set(Ce[r]),o=String(e??""),l=i[2];for(let a=l.indexOf(".");a>=0;a=l.indexOf(".",a+1)){if(a===0)continue;let u=l.slice(a+1);if(u.trim()!==""){for(let m of Object.values(Ce))for(let f of m)if(!s.has(f)&&o===f+u)return!0}}return!1}function In(n){let e=xe(n);return e.length===0?"":e.replace(xn," ")}function It(n,e){if(!e)return!1;let t=xe(e);return n.test(q(In(e)))||n.test(q(t))||n.test(q(ee(t).join(" ")))}function Nt(n){return It(Tn,n)}function Nn(n){return It(Mn,n)||Nt(n)}var Et=/int|double|decimal|single|float|number|currency|money/i;function En(n){let e=String(n?.valueNature??"").trim().toLowerCase();return e==="categorical"?"Categorical":e==="ordinal"?"Ordinal":e==="continuous"||n?.isMeasure===!0||Et.test(String(n?.dataType??""))?"Continuous":"Categorical"}function vn(n){return n?.isMeasure===!0||Et.test(String(n?.dataType??""))}function vt(n){let e=n??{},t=En(e);if(t!=="Continuous")return{nature:t,additivity:"unknown",basis:"role",suppressed:!1};if(Nt(e.name))return{nature:t,additivity:"positional",basis:"name",suppressed:!0};let i=String(e.additivity??"").trim().toLowerCase();if(!(i==="additive"&&wn(e.name))){if(i==="additive")return{nature:t,additivity:"additive",basis:"measured",suppressed:!1};if(i==="part_of_whole")return{nature:t,additivity:"part_of_whole",basis:"measured",suppressed:!1};if(i==="intensive_rate")return{nature:t,additivity:"intensive_rate",basis:"measured",suppressed:!1}}return e.discourageAggregationAcrossGroups===!0?{nature:t,additivity:"intensive_rate",basis:"host-flag",suppressed:!1}:Nn(e.name)?{nature:t,additivity:"intensive_rate",basis:"name",suppressed:!1}:{nature:t,additivity:"additive",basis:"default",suppressed:!1}}function kt(n){let e=vt(n),t=n??{};if(e.nature==="Categorical")return["first","distinctcount","count"];if(e.nature==="Ordinal")return vn(t)?["median","average","min","max","first","distinctcount","count"]:["first","distinctcount","count"];switch(e.additivity){case"positional":return["min","max","count","distinctcount","first"];case"intensive_rate":return["average","median","min","max","count","distinctcount","first"];default:return["sum","average","median","min","max","count","distinctcount","first"]}}function fi(n){return kt(n)[0]}function gi(n,e){return kt(n).indexOf(e)>=0}function pi(n,e){if(e!=="sum"&&e!=="count")return!1;if(e==="count")return!0;let t=vt(n);return t.additivity==="additive"||t.additivity==="part_of_whole"||t.additivity==="unknown"}var kn={de:["nr","nummer","kennung","kennziffer","plz","postleitzahl"],nl:["nr","nummer"],sv:["nr","nummer"],da:["nr","nummer"],nb:["nr","nummer"],fi:["tunnus","koodi","nro"],hu:["azonos\xEDt\xF3","k\xF3d"],tr:["kod","kodu","numaras\u0131","numarasi"],zh:["\u7F16\u53F7","\u4EE3\u7801","\u7F16\u7801","\u53F7\u7801","\u90AE\u7F16"],ja:["\u756A\u53F7","\u30B3\u30FC\u30C9"],ko:["\uBC88\uD638","\uCF54\uB4DC"],hi:["\u0915\u094B\u0921","\u0915\u094D\u0930\u092E\u093E\u0902\u0915"],fr:["num\xE9ro"],es:["c\xF3digo"],pt:["c\xF3digo","cep"],it:["codice"],pl:["kod","numer"],cs:["k\xF3d","\u010D\xEDslo"],sk:["k\xF3d","\u010D\xEDslo"],hr:["\u0161ifra","oznaka"],ru:["\u043A\u043E\u0434","\u043D\u043E\u043C\u0435\u0440"],uk:["\u043A\u043E\u0434","\u043D\u043E\u043C\u0435\u0440"],el:["\u03BA\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2"],ar:["\u0631\u0645\u0632","\u0643\u0648\u062F","\u0631\u0642\u0645"],he:["\u05E7\u05D5\u05D3"],id:["kode","nomor"],vi:["m\xE3"],th:["\u0E23\u0E2B\u0E31\u0E2A"]},Dn=["fr","es","pt","it","pl","cs","sk","hr","ru","uk","el","ar","he","id","vi","th"],On=["num\xE9ro"],Pn=n=>n.normalize("NFC").toLowerCase();function Ln(n,e,t,i){let r=Ie(t);return!r||!n?null:n===e?"word":r.wordBreaks===!1?Array.from(e).length<Ze?null:(i?n.startsWith(e):n.endsWith(e))&&n.length>e.length?"suffix":null:i?je(n,t).includes(e)?"word":null:r.script==="Hang"?Xe(n,e)?"suffix":null:r.compounds&&Ye(n,e,He)?"suffix":null}function Dt(n){let e=String(n??"").trim();if(!e)return null;let t=de(e),i=de(xe(e));for(let[r,s]of Object.entries(kn)){let o=Dn.includes(r),l=o?i:t;for(let a of s){let u=On.includes(a)||!!Ie(r)?.foldSensitive,m=u?l.words:l.folded;if(m.length===0)continue;let f=u?Pn(a):de(a).folded.join(" "),c=Ln(o?m[0]:m[m.length-1],f,r,o);if(c)return{lang:r,word:a,view:c}}}return null}var Fn=[["Lu",/^\p{Lu}$/u],["Ll",/^\p{Ll}$/u],["Lt",/^\p{Lt}$/u],["Lm",/^\p{Lm}$/u],["Lo",/^\p{Lo}$/u],["Mn",/^\p{Mn}$/u],["Mc",/^\p{Mc}$/u],["Nd",/^\p{Nd}$/u]];function Me(n){for(let[e,t]of Fn)if(t.test(n))return e;return null}var Wn=[{id:"ascii",test:/^[A-Za-z]$/,ranges:[[65,90],[97,122]]},{id:"latin",test:/^[\u00C0-\u017F]$/u,ranges:[[192,383]]},{id:"cyrillic",test:/^[\u0400-\u045F\u0490-\u0491]$/u,ranges:[[1024,1119],[1168,1169]]},{id:"greek",test:/^[\u0386-\u03CE]$/u,ranges:[[902,974]]},{id:"han",test:/^[\u4E00-\u9FFF]$/u,ranges:[[19968,40959]]},{id:"hiragana",test:/^\p{Script=Hiragana}$/u,ranges:[[12353,12447]]},{id:"katakana",test:/^\p{Script=Katakana}$/u,ranges:[[12448,12543]]},{id:"hangul",test:/^[\uAC00-\uD7A3]$/u,ranges:[[44032,55203]]},{id:"arabic",test:/^[\u0620-\u0652\u0671-\u06D3]$/u,ranges:[[1568,1618],[1649,1747]]},{id:"hebrew",test:/^[\u05B0-\u05EA]$/u,ranges:[[1456,1514]]},{id:"devanagari",test:/^\p{Script=Devanagari}$/u,ranges:[[2304,2431]]},{id:"thai",test:/^\p{Script=Thai}$/u,ranges:[[3585,3662]]}],Te=new Map;function Ot(n,e,t,i){let r=Te.get(n);if(r)return r;let s=[];for(let[o,l]of e)for(let a=o;a<=l;a++){let u=String.fromCodePoint(a);Me(u)===t&&(i&&!i.test(u)||s.push(u))}return Te.set(n,s),s}function Bn(n){let t=n.codePointAt(0);for(let o=0;o<9&&Me(String.fromCodePoint(t-1))==="Nd";o++)t--;let i="nd:"+t.toString(16),r=Te.get(i);if(r)return r;let s=[];for(let o=t;o<t+10;o++){let l=String.fromCodePoint(o);Me(l)==="Nd"&&s.push(l)}return Te.set(i,s),s}function Gn(n,e){if(e==="Nd")return Bn(n);for(let r of Wn)if(r.test.test(n))return Ot(r.id+":"+e,r.ranges,e,r.id==="ascii"?null:r.test);let i=n.codePointAt(0)&-128;return Ot("block:"+i.toString(16)+":"+e,[[i,i+127]],e,null)}function zn(n,e,t,i){let r=n.filter(s=>!e.has(s));return r.length===0&&(r=n.filter(s=>s!==t)),r.length===0?t:r[Math.min(r.length-1,Math.floor(i()*r.length))]}var $n=/^[\p{L}\p{M}\p{Nd}]$/u,Pt=/^[\p{L}\p{Nd}]$/u;function Lt(n,e){if(!n)return n??"";let t=new Set(Array.from(n)),i=m=>{let f=Me(m);return!f||!$n.test(m)?m:zn(Gn(m,f),t,m,e)},r=m=>{let f=[];for(let c of m)f.push(i(c)),Pt.test(c)&&e()<.2&&f.push(i(c));if(f.length>6){let c=Math.floor(e()*Math.min(3,f.length-6));for(let S=0;S<c;S++)for(let I=0;I<5;I++){let w=Math.floor(e()*f.length);if(Pt.test(f[w])){f.splice(w,1);break}}}return f.join("")};if(!(n.includes("@")&&n.includes(".")))return r(n);let[o,l=""]=n.split("@"),a=l.endsWith(".com"),u=a?l.slice(0,-4):l;return`${r(o)}@${r(u)}${a?".com":""}`}var Un=/^[A-Za-z_$][A-Za-z0-9_$]*$/,Vn=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Kn=new RegExp([String.raw`\bisMeasure\b`,String.raw`\bdataType\b`,String.raw`\bcolumns\s*\[\s*-?\d`,String.raw`\.iloc\s*\[[^\]]*,`,String.raw`\.iat\s*\[`,String.raw`\bselect_dtypes\b`,String.raw`\b_get_numeric_data\b`,String.raw`\bis_numeric_dtype\b`,String.raw`\bfor\s+\w+\s+in\s+(?:list\s*\(\s*)?df\.columns\b`,String.raw`\bdf\.columns\s*\.\s*(?:tolist|to_list|difference|drop)\b`,String.raw`\bdf\.dtypes\b`,String.raw`\bObject\s*\.\s*(?:keys|values|entries)\s*\(\s*(?:rows|data|df)?\s*\[\s*0\s*\]`,String.raw`\b(?:row|rw|r)\s*\[\s*\d+\s*\]`].join("|"));function ae(n,e){if(!n||!e)return!1;let t=Vn(e);return new RegExp("['\"`]"+t+"['\"`]").test(n)?!0:Un.test(e)&&new RegExp("\\."+t+"(?![A-Za-z0-9_$])").test(n)}function Hn(n){return!!n&&Kn.test(n)}function Ci(n,e,t){return n?Hn(n)?[...e]:[...t,...e].some(i=>ae(n,i))?e.filter(i=>ae(n,i)):[...e]:[]}var Yn=5,jn=6,Xn=3,re=864e5,Zn=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,Qn=/^(\d{4})[-/](\d{1,2})$/,qn=/^(\d{4})[-\s]?Q([1-4])$/i,Jn=/^Q([1-4])[-\s](\d{4})$/i,er=/^(\d{4})$/,tr=/^(\d{4})(0[1-9]|1[0-2])$/,nr=/^(\d{4})(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])$/,rr=/^(\D+?)[\s\-/.,']*((?:19|20)\d{2})$/u,ir=/^((?:19|20)\d{2})[\s\-/.,']+(\D+)$/u;function Fe(n,e,t){let i=te(n);if(!i)return 0;if(i==="sept")return 9;for(let o of e&&!/^en\b/i.test(e)?["en",e]:["en"]){let l=ye(o)[i];if(l!==void 0)return l+1}let r=t?.get(i);if(r!==void 0)return r+1;let s=se(n);if(s.length>0){if(s.every(a=>a.month===s[0].month))return s[0].month+1;let o=Ve(String(e??"").split(/[-_]/)[0])?.code,l=s.find(a=>a.lang===o);if(l)return l.month+1}return 0}function sr(n){let e=ge(n).filter(i=>i.yearDigits===4);if(e.length===0||e.some(i=>i.lang==="en"))return null;let t=e[0];return e.some(i=>i.grain!=="quarter"||i.n!==t.n||i.year!==t.year)?null:H(t.year,(t.n-1)*3+1,1)}function H(n,e,t,i=0,r=0,s=0){if(!(n>=1&&e>=1&&e<=12&&t>=1&&t<=31))return null;let o=Date.UTC(n,e-1,t,i,r,s);if(!Number.isFinite(o))return null;let l=a=>a<10?"0"+a:String(a);return{ms:o,y:n,m:e,d:t,iso:`${n}-${l(e)}-${l(t)}`}}function or(n,e){let t=[],i="";for(let a=0;a<e.length;a++){if(e[a]!=="%"){i+=e[a].replace(/[.*+?^${}()|[\]\\]/g,"\\$&");continue}switch(e[++a]){case"Y":t.push("Y"),i+="(\\d{4})";break;case"m":t.push("m"),i+="(\\d{1,2})";break;case"d":t.push("d"),i+="(\\d{1,2})";break;case"H":case"M":case"S":i+="\\d{1,2}";break;case"%":i+="%";break;default:return null}}let r=new RegExp("^"+i+"$").exec(n);if(!r)return null;let s=0,o=1,l=1;return t.forEach((a,u)=>{let m=+r[u+1];a==="Y"?s=m:a==="m"?o=m:l=m}),s?H(s,o,l):null}function j(n,e,t,i){let r=(n??"").trim();if(r==="")return null;if(e){let a=or(r,e);return a||null}let s=Zn.exec(r);if(s)return H(+s[1],+s[2],+s[3],+(s[4]??0),+(s[5]??0),+(s[6]??0));if(s=qn.exec(r),s)return H(+s[1],(+s[2]-1)*3+1,1);if(s=Jn.exec(r),s)return H(+s[2],(+s[1]-1)*3+1,1);if(s=Qn.exec(r),s&&+s[2]>=1&&+s[2]<=12)return H(+s[1],+s[2],1);if(s=nr.exec(r),s)return H(+s[1],+s[2],+s[3]);if(s=tr.exec(r),s)return H(+s[1],+s[2],1);if(s=er.exec(r),s){let a=+s[1];return a>=1900&&a<=2100?H(a,1,1):null}let o=sr(r);if(o)return o;if(s=rr.exec(r),s){let a=Fe(s[1],t,i);if(a)return H(+s[2],a,1)}if(s=ir.exec(r),s){let a=Fe(s[2],t,i);if(a)return H(+s[1],a,1)}let l=ie(r);if(l){let a="month"in l?l.month:Fe(l.word,t,i);if(a)return H(l.year,a,1)}return null}function Ft(n){let e=new Date(n).getUTCDay();return e>=1&&e<=5}function Wt(n,e){if(e<=n)return 0;let t=Math.round((e-n)/re),i=Math.floor(t/7),r=i*5,s=n+i*7*re;for(;s<e;)Ft(s)&&r++,s+=re;return r}function ar(n){if(n.length===0)return 0;let e=[...n].sort((i,r)=>i-r),t=e.length>>1;return e.length%2?e[t]:(e[t-1]+e[t])/2}function lr(n){return n>0?n<.95?"hour":n<=1.05?"day":n>=6.5&&n<=7.5?"week":n>=27&&n<=31.5?"month":n>=88&&n<=93?"quarter":n>=362&&n<=368?"year":"irregular":"irregular"}function le(n,e,t,i){switch(t){case"year":return e.y-n.y;case"quarter":return e.y*4+Math.floor((e.m-1)/3)-(n.y*4+Math.floor((n.m-1)/3));case"month":return e.y*12+e.m-(n.y*12+n.m);case"week":return Math.round((e.ms-n.ms)/(7*re));case"weekday":return Wt(n.ms,e.ms);case"day":return Math.round((e.ms-n.ms)/re);default:return i>0?Math.round((e.ms-n.ms)/i):0}}function Bt(n,e){return We(n,e)?.cadence??null}function We(n,e){let t=e?.gapFactor??Yn,i=0,r=0,s=new Map,o=Array.from(n),l;if(!e?.pattern){let p=[];for(let _ of o){if(_==null||_==="")continue;let y=ie(String(_));y&&"word"in y&&p.push(y.word)}p.length>0&&(l=be(p,e?.locale)??void 0)}for(let p of o){if(p==null||p==="")continue;i++;let _=j(String(p),e?.pattern,e?.locale,l);_&&(r++,s.set(_.ms,_))}let a=[...s.values()].sort((p,_)=>p.ms-_.ms);if(a.length<Xn||i>0&&r/i<.8)return null;let u=a[a.length-1].ms-a[0].ms;if(u<=0)return null;let m=[];for(let p=1;p<a.length;p++)m.push(a[p].ms-a[p-1].ms);let f=ar(m);if(!(f>0))return null;let c=lr(f/re);c==="day"&&u>=7*re&&a.every(p=>Ft(p.ms))&&Wt(a[0].ms,a[a.length-1].ms)+1>a.length*.5&&(c="weekday");let S=c==="irregular"?a.length:le(a[0],a[a.length-1],c,f)+1,I=1,w=1,C=[],g=a[0],h=1;for(let p=1;p<a.length;p++){let _=le(a[p-1],a[p],c,f);_>I&&(I=_),c!=="irregular"&&_>t?(w++,C.push({from:g.iso,to:a[p-1].iso,points:h}),g=a[p],h=1):h++}C.push({from:g.iso,to:a[a.length-1].iso,points:h});let b={grain:c,points:a.length,expectedPoints:Math.max(S,a.length),coveragePct:Math.round(a.length/Math.max(S,a.length)*1e3)/10,runs:w,largestGapUnits:I,gapFactor:t};return e?.includeBounds&&C.length<=jn&&(b.runBounds=C),{cadence:b,points:a,stepMs:f}}var ur=8,cr=.5,mr=200,dr=new Set(["category","categories","subcategory","type","types","kind","class","classes","classification","segment","segments","tier","status","priority","severity","grade","level","band","bucket","group","channel","method","mode","stage","phase","period","shift","gender","sex","result","outcome","reason","flag","genre","sector","source"]),fr=["category","classification","segment","status","priority","severity","channel"],gr=new Set(["UUID","EMAIL_LIKE","URL_LIKE","PHONE_LIKE","NUMERIC_ID","HEX_ID","OPAQUE_ID_ALPHANUMERIC","DATE_STR","BOOLEAN"]);function pr(n){let e=ee(n);if(e.length===0)return!1;let t=e[e.length-1];return dr.has(t)?!0:fr.some(i=>t.length>i.length&&t.endsWith(i))}function hr(n){if(n.isMeasure)return"measure";if(n.isTemporal||n.isDatePart||n.isReassembledDate)return"temporal";let e=Array.from(n.values).filter(t=>t!==""&&t!==null&&t!==void 0);return e.length<2||e.length>mr?"cardinality":n.rows>0&&e.length>=n.rows?"row-identity":n.isBinaryFlag?"flag":pe(e,n.locale)!==null?"ordinal":n.identifierNamed||n.dataType==="String"&&gr.has(he(e))?"identifier":!n.geoKind&&pr(n.name)?"attribute":"entity"}function $t(n){let e=-1,t=1/0,i=!1;return n.forEach((r,s)=>{if(hr(r)!=="entity")return;let o=new Set(Array.from(r.values).filter(a=>a!=="")).size,l=!!r.geoKind;(o<t||o===t&&l&&!i)&&(e=s,t=o,i=l)}),e}var Gt=n=>n<10?"0"+n:String(n);function zt(n,e){switch(e){case"year":return`${n.y}-01-01`;case"quarter":return`${n.y}-${Gt(Math.floor((n.m-1)/3)*3+1)}-01`;case"month":return`${n.y}-${Gt(n.m)}-01`;case"hour":return new Date(n.ms).toISOString().replace(/\.\d{3}Z$/,"Z");default:return n.iso}}function Ut(n){let{periods:e,series:t}=n,i=Math.min(e.length,t.length),r=new Set;for(let _=0;_<i;_++)e[_]&&r.add(e[_]);let s=We(r,{pattern:n.pattern,locale:n.locale});if(!s)return null;let o=s.cadence.grain;if(o==="irregular")return null;let l=s.points[0],a=le(l,s.points[s.points.length-1],o,s.stepMs)+1;if(a!==s.cadence.expectedPoints)return null;let u=new Map;for(let _ of r){let y=j(_,n.pattern,n.locale);if(!y)continue;let x=le(l,y,o,s.stepMs);x>=0&&x<a&&u.set(_,{idx:x,stamp:y})}let m=new Map;for(let _=0;_<i;_++){let y=t[_];if(!y)continue;let x=u.get(e[_]);if(!x)continue;let T=m.get(y);T||(T={seen:new Set,lo:x.idx,hi:x.idx,loStamp:x.stamp,hiStamp:x.stamp,order:m.size},m.set(y,T)),T.seen.add(x.idx),x.idx<T.lo&&(T.lo=x.idx,T.loStamp=x.stamp),x.idx>T.hi&&(T.hi=x.idx,T.hiStamp=x.stamp)}if(m.size<2)return null;let f=0;for(let _ of m.values())f+=_.seen.size;if(f/(m.size*a)<(n.minFill??cr))return null;let c=[],S=new Set,I=0,w=0,C=0,g=0,h=0,b=1;for(let[_,y]of m){for(let $ of y.seen)S.add($);if(y.seen.size>=a)continue;let x=[...y.seen].sort(($,X)=>$-X),T=1;for(let $=1;$<x.length;$++)T=Math.max(T,x[$]-x[$-1]);let V={key:_,acc:y,coverage:y.seen.size/a,before:y.lo,after:a-1-y.hi,interior:y.hi-y.lo+1-y.seen.size,gap:T};c.push(V),V.before>0&&I++,V.after>0&&w++,V.interior>0&&C++,g=Math.max(g,V.before),h=Math.max(h,V.after),b=Math.max(b,T)}if(c.length===0)return null;c.sort((_,y)=>_.coverage-y.coverage||_.acc.order-y.acc.order);let p=c.slice(0,n.maxListed??ur);return{seriesColumn:n.seriesColumn,grain:o,periods:a,seriesCount:m.size,incompleteSeries:c.length,lateStarts:I,earlyEnds:w,withHoles:C,columnWideMissing:a-S.size,maxMissingBefore:g,maxMissingAfter:h,largestGap:b,series:p.map(_=>{let y={};return n.includeNames&&(y.name=_.key),n.includeDates&&(y.first=zt(_.acc.loStamp,o),y.last=zt(_.acc.hiStamp,o)),y.missingBefore=_.before,y.missingAfter=_.after,y.missingInterior=_.interior,y.largestGap=_.gap,y.coverage=Math.round(_.coverage*1e3)/1e3,y}),more:c.length-p.length}}var we=6;function ue(n){let e=n.slice().sort((i,r)=>i-r),t=e.length>>1;return e.length%2?e[t]:(e[t-1]+e[t])/2}function yr(n){let e=n.length;if(e<we)return null;let t=n[0],i=n[0],r=0;for(let p of n)p<t&&(t=p),p>i&&(i=p),r+=p;if(t===i)return null;let s=ue(n.map(Math.abs));if(s===0)return null;let o=[];for(let p=1;p<e;p++)o.push(n[p]-n[p-1]);let l=ue(o.map(Math.abs))/s,a=(e-1)/2,u=r/e,m=0,f=0,c=0;for(let p=0;p<e;p++)m+=(p-a)*(n[p]-u),f+=(p-a)*(p-a),c+=(n[p]-u)*(n[p]-u);c/=e;let S=m/f,I=u-S*a,w=n.map((p,_)=>p-(I+S*_)),C=w.reduce((p,_)=>p+_,0)/e,g=0,h=0;for(let p=0;p<e;p++)g+=(w[p]-C)*(w[p]-C),p>0&&(h+=(w[p]-w[p-1])*(w[p]-w[p-1]));return g/=e,h/=e-1,{vnDetrended:g<=c*1e-12?2:h/g,relStep:l}}function Be(n){let{stamps:e,series:t,values:i}=n,r=Math.min(e.length,i.length),s=new Map;for(let u=0;u<r;u++){let m=e[u],f=i[u];if(m===null||f===null||!Number.isFinite(f))continue;let c="";if(t&&(c=t[u]??"",c===""))continue;let S=s.get(c);S||s.set(c,S=new Map),S.set(m,(S.get(m)??0)+f)}let o=[],l=[],a=[];for(let u of s.values()){let m=[...u.entries()].sort((c,S)=>c[0]-S[0]).map(c=>c[1]),f=yr(m);f&&(o.push(f.vnDetrended),l.push(f.relStep),a.push(m.length))}return o.length===0?null:{series:o.length,points:Math.round(ue(a)),vnDetrended:Math.round(ue(o)*1e3)/1e3,relStep:Math.round(ue(l)*1e4)/1e4}}function Oi(n){let e=n.times.map(t=>j(t,n.pattern,n.locale)?.ms??null);return Be({stamps:e,series:n.series,values:n.values})}var br=5e5,Sr=8,_r=4,Ar=5,Ge=1,ze=2,Cr=4,xr=8;function Mr(n,e,t){let[i,r]=[...n];if(e.isTemporal){let s=j(i,e.temporalTextPattern,t),o=j(r,e.temporalTextPattern,t);if(s&&o&&s.ms!==o.ms)return s.ms<o.ms?{a:i,b:r,setOrder:"temporal"}:{a:r,b:i,setOrder:"temporal"}}return i<r?{a:i,b:r,setOrder:"none"}:{a:r,b:i,setOrder:"none"}}function Tr(n,e,t){let{rows:i,text:r,locale:s}=n,o=Mr(t.values,t,s),l=new Uint8Array(i.length),a=0;for(let u=0;u<i.length;u++){let m=r(i[u][e]);m===o.a?l[u]=1:m===o.b?l[u]=2:a++}return{code:l,blankRows:a,setOrder:o.setOrder}}function wr(n,e){let{rows:t,text:i}=n,r=new Int32Array(t.length),s=new Map;for(let o=0;o<t.length;o++){let l=i(t[o][e]);if(l===""){r[o]=-1;continue}let a=s.get(l);a===void 0&&(a=s.size,s.set(l,a)),r[o]=a}return{ids:r,dict:s}}function Rr(n,e,t){let i=new Uint8Array(t);for(let s=0;s<n.length;s++){let o=e[s];if(o===0)continue;let l=n[s];if(l<0)continue;let a=i[l];i[l]=a&o?a|o<<2:a|o}let r={keysA:0,keysB:0,keysBoth:0,dupA:0,dupB:0};for(let s=0;s<t;s++){let o=i[s];o&Ge&&r.keysA++,o&ze&&r.keysB++,(o&(Ge|ze))===(Ge|ze)&&r.keysBoth++,o&Cr&&r.dupA++,o&xr&&r.dupB++}return r}function Ir(n,e){let t=(n.dupA+n.dupB)*(e.keysA+e.keysB),i=(e.dupA+e.dupB)*(n.keysA+n.keysB);return t<i||t===i&&n.keysBoth>e.keysBoth}var Vt=n=>n==null||typeof n=="string"&&n.trim()==="";function Nr(n,e,t){if(n===e)return!0;let i=Vt(n),r=Vt(e);return i||r?i&&r:typeof n=="number"&&typeof e=="number"?!1:n instanceof Date&&e instanceof Date?n.getTime()===e.getTime():t(n).trim()===t(e).trim()}function Kt(n){let{rows:e,columns:t}=n,i=e.length;if(i<2||i>br)return null;let r=t.map((y,x)=>({c:y,i:x})).filter(({c:y})=>!y.isMeasure&&!y.isTemporal&&!y.isDatePart&&y.distinct>=Ar).sort((y,x)=>(x.c.identifierNamed?1:0)-(y.c.identifierNamed?1:0)||x.c.distinct-y.c.distinct||y.i-x.i).slice(0,Sr),s=t.map((y,x)=>({c:y,i:x})).filter(({c:y})=>!y.isMeasure&&y.values!==null&&y.values.size===2).slice(0,_r);if(r.length===0||s.length===0)return null;let o=s.map(({c:y,i:x})=>Tr(n,x,y)),l=null;for(let{i:y}of r){let x=wr(n,y);for(let T=0;T<s.length;T++){if(s[T].i===y)continue;let V=Rr(x.ids,o[T].code,x.dict.size);V.keysBoth<1||(!l||Ir(V,l.tally))&&(l={tally:V,keyIdx:y,setNo:T,ids:x.ids,dict:x.dict})}}if(!l)return null;let{ids:a,dict:u,tally:m}=l,f=o[l.setNo],c=s[l.setNo].i,S=u.size,I=new Int32Array(S).fill(-1),w=new Int32Array(S).fill(-1);for(let y=0;y<i;y++){let x=f.code[y],T=a[y];x===0||T<0||(x===1?I[T]<0&&(I[T]=y):w[T]<0&&(w[T]=y))}let C=[];for(let y=0;y<t.length;y++)y!==l.keyIdx&&y!==c&&C.push(y);let g=0;for(let y=0;y<S;y++){let x=I[y],T=w[y];if(x<0||T<0)continue;let V=e[x],$=e[T],X=!0;for(let J of C)if(!Nr(V[J],$[J],n.text)){X=!1;break}X&&g++}let h=g===m.keysBoth?100:g===0?0:Math.min(99,Math.max(1,Math.round(g/m.keysBoth*100))),b=new Map,p=new Map;for(let[y,x]of u){let T=I[x]>=0,V=w[x]>=0;if(!T&&!V)continue;let $=it(y);st($)&&(T&&b.set($,(b.get($)??0)+1),V&&p.set($,(p.get($)??0)+1))}let _=y=>{let x=0;for(let T of y.values())T>=2&&(x+=T);return x};return{key:l.keyIdx,discriminator:c,pairing:{form:"long",key:t[l.keyIdx].name,discriminator:t[c].name,keysA:m.keysA,keysB:m.keysB,keysBoth:m.keysBoth,duplicateKeysA:m.dupA,duplicateKeysB:m.dupB,identicalPct:h,discriminatorBlankRows:f.blankRows,looseCollisionsA:_(b),looseCollisionsB:_(p),setOrder:f.setOrder}}}var Er=n=>n==="Integer"||n==="Decimal";function vr(n){let e=[],t=[];return n.forEach((i,r)=>{if(i.twoValues){if(i.isBinaryFlag){e.push(r);return}i.isMeasure||i.isTemporal||i.isDatePart||i.identifierNamed||t.push(r)}}),[...e,...t].slice(0,6)}function kr(n,e){let t=[];for(let i=0;i<n.length&&t.length<12;i++){let r=n[i];e.has(i)||!Er(r.dataType)||r.isTemporal||r.isDatePart||r.identifierNamed||r.distinct<3||t.push(i)}return t}function Ht(n){let e=new Map,{rows:t,columns:i,text:r}=n;if(t.length===0||t.length>(n.maxRows??5e5))return e;let s=vr(i);if(s.length===0)return e;let o=kr(i,new Set(s));if(o.length===0)return e;let l=s.map(a=>{let[u,m]=i[a].twoValues,f=new Uint8Array(t.length);for(let c=0;c<t.length;c++){let S=r(t[c][a]);f[c]=S===u?1:S===m?2:0}return f});for(let a of o){let u=new Float64Array(t.length),m=0;for(let h=0;h<t.length;h++){let b=t[h][a],p=b==null||b===""?NaN:typeof b=="number"?b:parseFloat(b);u[h]=p,p===p&&p!==1/0&&p!==-1/0&&m++}if(m<2)continue;let f=new Float64Array(m);for(let h=0,b=0;h<t.length;h++){let p=u[h];p===p&&p!==1/0&&p!==-1/0&&(f[b++]=p)}f.sort();let c=new Float64Array(m),S=0;for(let h=0;h<m;h++)(h===0||f[h]!==f[h-1])&&(c[S++]=f[h]);let I=new Int32Array(t.length).fill(-1);for(let h=0;h<t.length;h++){let b=u[h];if(!(b===b&&b!==1/0&&b!==-1/0))continue;let p=0,_=S-1;for(;p<_;){let y=p+_>>>1;c[y]<b?p=y+1:_=y}I[h]=p}let w=[],C=new Int32Array(S),g=new Int32Array(S);for(let h=0;h<s.length;h++){let b=l[h];C.fill(0),g.fill(0);let p=0,_=0;for(let d=0;d<t.length;d++){let A=I[d];A<0||(b[d]===1?(C[A]++,p++):b[d]===2&&(g[A]++,_++))}if(p===0||_===0)continue;let y=p<=_,x=y?p:_,T=y?_:p,V=y?C:g,$=y?g:C,X=0,J=0,Y=0;for(let d=0;d<S;d++){let A=V[d],F=$[d];X+=A*(J+.5*F),J+=F,A+F>=2&&(Y+=A+F)}w.push({outcome:i[s[h]].name,aucMinorityHigh:Math.round(X/(x*T)*1e4)/1e4,nMinority:x,nMajority:T,ties:Y})}w.length>0&&e.set(a,w)}return e}var Dr=12,Or=100,Pr=.3,Lr=.9,Fr=120,Wr=1900,Br=2100,Gr=0,zr=20,$r=new Set(["id","ids","uuid","guid","key","zip","zipcode","postal","postalcode","ssn","code","codes","sku","isbn","msisdn","imei"]);function Re(n){if(!n)return!1;let e=ee(n);return e.length===0?!1:$r.has(e[e.length-1])?!0:Dt(n)!==null}var Ur=new Set(["year","yr","fy"]),Vr=n=>ee(n).some(e=>Ur.has(e))||rt(n)!==null,Kr=/^(?:(?:19|20)\d{2}(?:[-/ ]?(?:q[1-4]|w(?:0?[1-9]|[1-4]\d|5[0-3])|(?:0?[1-9]|1[0-2])))?|q[1-4][-/ ](?:19|20)\d{2}|(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*[-/ ]?(?:19|20)?\d{2})$/i;function $e(n){if(!Number.isInteger(n)||n<190001||n>210012)return!1;let e=n%100;return e>=1&&e<=12}function Ue(n){if(!Number.isInteger(n)||n<19000101||n>21001231)return!1;let e=Math.floor(n/100)%100,t=n%100;return e>=1&&e<=12&&t>=1&&t<=31}var Hr=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,Yr=/^(\d{4})([\/.])(\d{1,2})\2(\d{1,2})$/,jr=/^(\d{1,2})([\/.\-])(\d{1,2})\2(\d{4})(?:[ T](\d{2}):(\d{2})(?::(\d{2}))?)?$/;function Zt(n,e){let t=[],i=0,r=Xr(n,e,t,()=>{i++});if(r)return r;if(i>0||t.length<2)return null;let s=yt(t,{locale:e,floor:.8});return!s||!s.pattern||s.form==="named"?null:{pattern:s.pattern,orderFrom:s.orderFrom==="shape"?s.order==="ymd"?"iso":"shape":s.orderFrom}}function Xr(n,e,t,i){let r=0,s=0,o=0,l=0,a=0,u="",m=0,f="",c=0,S=0,I=0,w=0,C=!1;for(let y of n){if(y==null)continue;let x=String(y).trim();if(x==="")continue;r++,t.push(x);let T;if(T=Hr.exec(x)){i();let V=+T[2],$=+T[3];V>=1&&V<=12&&$>=1&&$<=31&&(s++,T[4]!==void 0&&o++,T[6]!==void 0&&l++)}else if(T=Yr.exec(x)){i();let V=+T[3],$=+T[4];V>=1&&V<=12&&$>=1&&$<=31&&(u&&u!==T[2]&&(C=!0),u=T[2],a++)}else if(T=jr.exec(x)){i();let V=+T[1],$=+T[3];V>=1&&V<=31&&$>=1&&$<=31&&(V<=12||$<=12)&&(f&&f!==T[2]&&(C=!0),f=T[2],m++,V>12&&I++,$>12&&w++,T[5]!==void 0&&c++,T[7]!==void 0&&S++)}if(r>=200)break}if(r<2||(s+a+m)/r<.8||(s>0?1:0)+(a>0?1:0)+(m>0?1:0)!==1||C)return null;if(s>0)return o===s?{pattern:l===s?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M",orderFrom:"iso"}:{pattern:"%Y-%m-%d",orderFrom:"iso"};if(a>0)return{pattern:`%Y${u}%m${u}%d`,orderFrom:"iso"};if(I>0&&w>0)return null;let b,p;I>0?(b=!0,p="values"):w>0?(b=!1,p="values"):f==="."?(b=!0,p="shape"):(b=!De(e),p="locale");let _=b?`%d${f}%m${f}%Y`:`%m${f}%d${f}%Y`;return c===m?{pattern:_+(S===m?" %H:%M:%S":" %H:%M"),orderFrom:p}:{pattern:_,orderFrom:p}}function Zr(n,e){if(!e||!/\b(?:19|20)\d{2}\b/.test(n))return!1;let t=n.replace(/\b(?:19|20)\d{2}\b/g,"").replace(/[-/.,]/g," ").trim();if(!t)return!1;let i=te(t);return i.length>0&&e[i]!==void 0}function Qr(n,e){let t=new Map,i=new Map;for(let l of n){let a=ie(l);if(!a||"month"in a)continue;let u=se(a.word),m=u.some(c=>c.lang==="en"),f=te(a.word);for(let c of new Set(u.map(S=>S.lang)))c!=="en"&&(t.has(c)||(t.set(c,new Set),i.set(c,new Set)),t.get(c).add(f),m||i.get(c).add(f))}let r=[...t.keys()].filter(l=>t.get(l).size>=3&&i.get(l).size>=1),s=0,o=new Map(r.map(l=>[l,0]));for(let l of e){let a=ie(l);if(!a)continue;if("month"in a){s++;continue}let u=se(a.word);if(u.length===0)continue;let m=u.some(f=>f.lang==="en");for(let f of r)(m||u.some(c=>c.lang===f))&&o.set(f,o.get(f)+1)}return s+Math.max(0,...o.values())}var qr=/(?:19|20)[0-9]{2}/;function Jr(n){let e=new Map,t=0;for(let r of n){if(!qr.test(me(r)))continue;let s=new Set(ge(r).filter(o=>o.yearDigits===4&&(o.grain==="quarter"||o.grain==="week")).map(o=>o.lang));if(s.size!==0){if(s.has("en")){t++;continue}for(let o of s)e.set(o,(e.get(o)??0)+1)}}let i=0;for(let r of e.values())i=Math.max(i,r);return i>0?i+t:0}function ei(n){let{dataType:e,name:t,isMeasure:i,distinctCount:r}=n;if(e==="DateTime")return!0;if(i)return!1;if(e==="Integer"||e==="Decimal"){let s=n.minNum,o=n.maxNum;if(!(s!=null&&o!=null&&Number.isFinite(s)&&Number.isFinite(o)&&Number.isInteger(s)&&Number.isInteger(o)&&o>=s))return!1;let a=s>=1900&&o<=2100;if(a&&r>=2&&Vr(t)||a&&r>=3&&r===o-s+1)return!0;let u=$e(s)&&$e(o),m=Ue(s)&&Ue(o);if(u||m){if(!n.sampleValues)return!0;let f=0,c=0;for(let S of n.sampleValues){if(S==null||S==="")continue;f++;let I=Number(String(S).trim());if(Number.isFinite(I)&&(u?$e(I):Ue(I))&&c++,f>=60)break}if(f>=2&&c===f)return!0}return!1}if(n.sampleValues){let s=n.locale?ye(n.locale):null,o=0,l=0,a=[],u=[];for(let m of n.sampleValues){if(m==null||m==="")continue;o++;let f=String(m).trim();if(a.push(f),Kr.test(f)||Zr(f,s)?l++:u.push(f),o>=60)break}if(o>=2&&l/o>=.8||o>=2&&(l+Jr(u)+Qr(a,u))/o>=.8||Zt(a,n.locale)!==null)return!0}return!1}function ti(n){let e=q((n||"").trim().toLowerCase());return e.startsWith("sum ")||e.startsWith("total ")?"sum":e.startsWith("average ")||e.startsWith("avg. ")?"avg":e.startsWith("count ")||e.startsWith("distinct count ")||e.startsWith("count (distinct) ")?"count":e.startsWith("min ")||e.startsWith("minimum ")?"min":e.startsWith("max ")||e.startsWith("maximum ")?"max":xt(n)}function ni(n){let{rows:e,measureColIdx:t,measureName:i,candidateDims:r,minNum:s,maxNum:o,discourageAgg:l}=n,a=100,u=.01,m="";for(let c of r){if(c.distinct<2||c.distinct>a)continue;let S=r.filter(h=>h.idx!==c.idx).map(h=>h.idx),I=new Map;for(let h of e){let b=h[t];if(typeof b!="number"||!Number.isFinite(b))continue;let p=S.length?S.map(y=>String(h[y])).join(m):"",_=I.get(p);_||(_={sum:0,cset:new Set},I.set(p,_)),_.sum+=b,_.cset.add(String(h[c.idx]))}let w=0,C=0,g=0;for(let h of I.values())h.cset.size<2||(g++,Math.abs(h.sum-100)<=100*u?w++:Math.abs(h.sum-1)<=1*u&&C++);if(g>=2&&(w/g>=.9||C/g>=.9))return{additivity:"part_of_whole",partOfWholeDim:c.name}}if(l)return{additivity:"intensive_rate"};let f=ti(i);return f==="avg"||f==="min"||f==="max"?{additivity:"intensive_rate"}:f==="count"?{additivity:"additive"}:f==="sum"?{additivity:"unknown"}:s!=null&&o!=null&&Number.isFinite(s)&&Number.isFinite(o)&&s>=0&&o<=1.0001&&o>0?{additivity:"intensive_rate"}:{additivity:"unknown"}}function Qt(n){let{dataType:e,isMeasure:t,name:i,distinct:r,nonblank:s,prec:o,maxval:l,minval:a}=n,u=l-a+1,m=u>0?r/u:1,f=s>0?r/s:0,c=e==="Decimal"||o>0;return!t&&Re(i)?"Categorical":m>=Lr&&(ot(i)&&r<=Fr||a>=Wr&&l<=Br||a>=Gr&&l<=zr)?"Ordinal":t||r>Dr&&(c||r>=Or||f>=Pr)?"Continuous":"Categorical"}function jt(n,e,t){return!n||n.isMeasure||e||n.dataType!=="Integer"&&n.dataType!=="Decimal"?!1:Qt({dataType:n.dataType,isMeasure:!1,name:n.name,distinct:t.distinct,nonblank:t.nonblank,prec:t.prec,maxval:typeof t.maxval=="number"?t.maxval:0,minval:typeof t.minval=="number"?t.minval:0})==="Continuous"}function ri(n){let e=null;for(let t=0;t<n.length;t++){let i=n[t];if(typeof i!="string"||i.length===0)continue;let r=i.trim();r.length!==i.length&&(e||(e=n.slice()),e[t]=r)}return e||n}var Xt=class{_computedStatsForLevel=null;_cols=[];_rows=[];_origIndices=[];_rowHashes=new Set;_hostQueryNames=[];_englishAliases=new Map;_declaredDimensions=new WeakSet;_inferredMeasureFlags=null;dedupRows=!0;emitLegacyAggAliases=!1;dateCellsAreLocalWallClock=!1;wallClockColumnIndexes(){let e=new Set;if(!this.dateCellsAreLocalWallClock||!this._cols)return e;for(let t=0;t<this._cols.length;t++){let i=this._cols[t];!i||!/date|time/i.test(String(i.dataType??""))||tt(this._rows.map(r=>r[t]))&&e.add(t)}return e}STR(e){return e==null?"":e instanceof Date?this.wholeDayIso(e)??(isNaN(e.getTime())?"":e.toISOString()):e.toString()}getPrecision(e){if(!isFinite(e))return 0;let i=e.toString().split(".")[1];return i?i.length:0}getColumns(){return this._cols}inferredMeasureFlags(){if(this._inferredMeasureFlags)return this._inferredMeasureFlags;let e=this._cols.map(t=>!!(t&&t.isMeasure));return this._cols.forEach((t,i)=>{if(!t||t.isMeasure||this._declaredDimensions.has(t)||t.dataType!=="Integer"&&t.dataType!=="Decimal")return;let r=new Set,s=0,o=0,l=null,a=null;for(let u of this._rows){let m=u[i],f=this.STR(m);if(f!=""&&(r.add(f),s++,(l===null||m<l)&&(l=m),(a===null||m>a)&&(a=m),t.dataType=="Decimal")){let c=this.getPrecision(m);c>o&&(o=c)}}e[i]=jt(t,!1,{distinct:r.size,nonblank:s,prec:o,minval:l,maxval:a})}),Object.freeze(e),this._inferredMeasureFlags=e,e}declareDimensions(e){this._inferredMeasureFlags=null;for(let t of e)t&&this._declaredDimensions.add(t)}wholeDayIso(e){return et(e)}hasTimeComponent(e){return!(e instanceof Date)||isNaN(e.getTime())?!1:this.wholeDayIso(e)===null}getColumnsWithStats(e,t){if(this._computedStatsForLevel==e)return this._cols;let i=0,r=parseInt(e),s=this.wallClockColumnIndexes(),o=[],l=[],a=[];for(let d of this._cols){let A=new Map,F=[],D=0,M=0,k=0,L=null,O=null,v=null,G=!1,z=!0,N=!0,E=null,U=!1,P=s.has(i);for(let R of this._rows){let W=R[i],B=P&&W instanceof Date?fe(W):W,K=this.STR(B);if(K!=""){if(D+=K.length,A.set(K,(A.get(K)||0)+1),M++,d.dataType=="Integer"||d.dataType=="Decimal"||d.dataType=="DateTime")if((L===null||B<L)&&(L=B),(O===null||B>O)&&(O=B),d.dataType=="Integer"||d.dataType=="Decimal"){if(v===null?v=B:v+=B,d.dataType=="Decimal"){let Z=this.getPrecision(B);Z>k&&(k=Z)}F.push(B)}else G=G||this.hasTimeComponent(B);U&&(B<E?z=!1:B>E&&(N=!1)),E=B,U=!0}}if(M>=3&&(z&&!N?d.sortedDirection="asc":N&&!z?d.sortedDirection="desc":d.sortedDirection="none"),M>0&&A.size>0&&!d.isMeasure){let R=0,W=Number.MAX_SAFE_INTEGER;for(let B of A.values())B>R&&(R=B),B<W&&(W=B);if(d.modalShare=R/M,d.minGroupCount=W===Number.MAX_SAFE_INTEGER?null:W,A.size===2){let B=[...A.keys()].map(ce=>Qe(ce).trim().toLowerCase()).sort(),Z=[["false","true"],["no","yes"],["n","y"],["0","1"],["f","t"]].some(ce=>B[0]===ce[0]&&B[1]===ce[1]),qt=/^(is|has)[_\p{L}\p{N}]|(?:default|churn|fraud|approv|convert|active|cancel|delinquen|flag|paid|win|pass|fail)/iu.test(d.name);(Z||qt)&&(d.isBinaryFlag=!0)}}else d.isMeasure&&(d.dataType==="Integer"||d.dataType==="Decimal")&&A.size===2&&A.has("0")&&A.has("1")&&(d.isBinaryFlag=!0);if(d.dataType=="DateTime"&&(d.dateWithTime=G,G&&nt(P?this._rows.map(R=>R[i]instanceof Date?fe(R[i]):R[i]):this._rows.map(R=>R[i]))?d.timeOfDayOnly=!0:delete d.timeOfDayOnly),d.isTemporal=ei({dataType:d.dataType,name:d.name,isMeasure:d.isMeasure,distinctCount:A.size,minNum:typeof L=="number"?L:null,maxNum:typeof O=="number"?O:null,sampleValues:A.keys(),locale:t}),d.isTemporal&&d.dataType==="String"&&!d.isMeasure){let R=Zt(A.keys(),t);R&&(d.temporalTextPattern=R.pattern)}if(d.timeOfDayOnly)delete d.temporalCadence;else if(d.isTemporal&&!d.isMeasure){let R=Bt(A.keys(),{includeBounds:r>=20,pattern:d.temporalTextPattern,locale:t});R&&(d.temporalCadence=R)}this.updateColumnStats10(r,d,M,A,k,O,L),this.updateColumnStats20(r,F,M,v,d,D,G,L,O,k,A,t),jt(d,this._declaredDimensions.has(d),{distinct:A.size,nonblank:M,prec:k,minval:L,maxval:O})&&(d.isMeasure=!0,d.geoKind=void 0,d.geoMatchPct=void 0,d.geoAmbiguous=void 0,d.dominantGeoRegion=void 0,d.dominantGeoRegionPct=void 0,d.geoRegionCount=void 0),o[i]=d.isMeasure||A.size>2e3?null:new Set(A.keys()),l[i]=A.size,a[i]=A.size===2?[...A.keys()].sort():null,i++}let u=[];this._cols.forEach((d,A)=>{d.isMeasure||u.push({idx:A,distinct:d.distinctCount??0,name:d.name})}),this._cols.forEach((d,A)=>{if(!d.isMeasure)return;let F=typeof d.lowValue=="number"?d.lowValue:null,D=typeof d.highValue=="number"?d.highValue:null,M=ni({rows:this._rows,measureColIdx:A,measureName:d.name,candidateDims:u,minNum:F,maxNum:D,discourageAgg:!!d.discourageAggregationAcrossGroups});d.additivity=M.additivity,M.partOfWholeDim&&(d.partOfWholeDim=M.partOfWholeDim)});let m=50,f=4,c=u.filter(d=>d.distinct>=2&&d.distinct<=m);this._cols.forEach((d,A)=>{if(!d.isMeasure)return;let F=[];for(let N of this._rows){let E=N[A];if(E==null||E==="")continue;let U=typeof E=="number"?E:parseFloat(E);isNaN(U)||F.push(U)}if(F.length===0)return;let D=[...F].sort((N,E)=>N-E);if(D[0]===D[D.length-1])d.relativeDispersion=0;else if(D.length>=f){let N=Q(D,.5),E=Q(D,.1),U=Q(D,.9);d.relativeDispersion=Math.abs(N)>1e-9?Math.round((U-E)/Math.abs(N)*1e3)/1e3:void 0}else d.relativeDispersion=void 0;let M=[];for(let N of c){let E=new Set;for(let U of this._rows){let P=U[A];P==null||P===""||E.add(this.STR(U[N.idx])+"")}M.push({otherColumn:N.name,nonBlankGroupCount:E.size})}M.length>0&&(d.nonBlankGroups=M);let k=0;for(let N of F)k+=N;k/=F.length;let L=0;for(let N of F)L+=(N-k)*(N-k);if(L<=1e-12)return;let O=[],v=[],G=N=>{if(N.length<4)return NaN;let E=[...N].sort((P,R)=>P-R),U=P=>E[Math.min(E.length-1,Math.max(0,Math.floor(P*(E.length-1))))];return U(.75)-U(.25)},z=G(F);for(let N of c){let E=new Map;for(let R of this._rows){let W=R[A];if(W==null||W==="")continue;let B=typeof W=="number"?W:parseFloat(W);if(isNaN(B))continue;let K=this.STR(R[N.idx])+"",Z=E.get(K);Z?(Z.s+=B,Z.n++,Z.vals.push(B)):E.set(K,{s:B,n:1,vals:[B]})}let U=0;for(let R of E.values()){let W=R.s/R.n;U+=R.n*(W-k)*(W-k)}O.push({otherColumn:N.name,eta2:Math.round(U/L*1e4)/1e4});let P=[];for(let R of E.values()){let W=G(R.vals);isNaN(W)||P.push(W)}if(P.length>=2&&isFinite(z)&&z>1e-9){let R=(Math.max(...P)-Math.min(...P))/z;v.push({otherColumn:N.name,spreadRatio:Math.round(R*1e4)/1e4})}}O.length>0&&(d.groupDiscrimination=O),v.length>0&&(d.spreadDiscrimination=v)});let S=.97,I=.8,w=8,C=5,g=this._cols.map((d,A)=>({c:d,i:A})).filter(d=>d.c.isMeasure);for(let d=0;d<g.length;d++)for(let A=d+1;A<g.length;A++){let F=g[d].i,D=g[A].i,M=0,k=0,L=0,O=0,v=0,G=0;for(let P of this._rows){let R=P[F],W=P[D];if(R==null||R===""||W===null||W===void 0||W==="")continue;let B=typeof R=="number"?R:parseFloat(R),K=typeof W=="number"?W:parseFloat(W);isNaN(B)||isNaN(K)||(M++,k+=B,L+=K,O+=B*B,v+=K*K,G+=B*K)}if(M<C)continue;let z=M*O-k*k,N=M*v-L*L;if(z<=1e-12||N<=1e-12)continue;let E=(M*G-k*L)/Math.sqrt(z*N),U=Math.min(1,Math.round(Math.abs(E)*1e3)/1e3);for(let P of[g[d].c,g[A].c])(P.maxAbsMeasureCorrelation===void 0||U>P.maxAbsMeasureCorrelation)&&(P.maxAbsMeasureCorrelation=U);if(Math.abs(E)>=S){let P=g[d].c,R=g[A].c;P.collinearWithMeasures||(P.collinearWithMeasures=[]),R.collinearWithMeasures||(R.collinearWithMeasures=[]),P.collinearWithMeasures.push(R.name),R.collinearWithMeasures.push(P.name)}else if(Math.abs(E)>=I){let P=g[d].c,R=g[A].c,W=Math.round(E*1e3)/1e3;P.correlatedWithMeasures||(P.correlatedWithMeasures=[]),R.correlatedWithMeasures||(R.correlatedWithMeasures=[]),P.correlatedWithMeasures.push({otherColumn:R.name,r:W}),R.correlatedWithMeasures.push({otherColumn:P.name,r:W})}}for(let{c:d}of g)d.correlatedWithMeasures&&(d.correlatedWithMeasures.sort((A,F)=>Math.abs(F.r)-Math.abs(A.r)||(A.otherColumn<F.otherColumn?-1:1)),d.correlatedWithMeasures.length=Math.min(d.correlatedWithMeasures.length,w));for(let d=0;d<this._cols.length;d++){let A=o[d];if(!A||A.size===0)continue;let F=[];for(let D=0;D<this._cols.length;D++){if(D===d)continue;let M=o[D];if(!M||M.size===0)continue;let k=0;for(let O of A)M.has(O)&&k++;let L=Math.round(k/A.size*100);L>0&&F.push({otherColumn:this._cols[D].name,percentShared:L})}F.length>0&&(this._cols[d].sharedValueRatioWithOthers=F)}let h=50,b=[];for(let d=0;d<this._cols.length;d++){let A=o[d];A&&A.size>=2&&A.size<=h&&b.push(d)}if(b.length>=2){let d=new Map,A=(D,M)=>D+":"+M;for(let D=0;D<b.length;D++)for(let M=D+1;M<b.length;M++)d.set(A(b[D],b[M]),new Map);for(let D of this._rows)for(let M=0;M<b.length;M++){let k=this.STR(D[b[M]])+"";for(let L=M+1;L<b.length;L++){let O=""+this.STR(D[b[L]]),v=d.get(A(b[M],b[L])),G=k+""+O;v.set(G,(v.get(G)??0)+1)}}let F=new Map;for(let D=0;D<b.length;D++)for(let M=D+1;M<b.length;M++){let k=b[D],L=b[M],O=o[k].size,v=o[L].size,G=d.get(A(k,L)),z=G.size,N=0;for(let R of G.values())(N===0||R<N)&&(N=R);let E=Math.round(z/(O*v)*100),U=z===O,P=z===v;if((this._cols[k].categoricalPairStats||=[]).push({otherColumn:this._cols[L].name,fillPct:E,determinesOther:U,minCellCount:N,distinctCombinations:z}),(this._cols[L].categoricalPairStats||=[]).push({otherColumn:this._cols[k].name,fillPct:E,determinesOther:P,minCellCount:N,distinctCombinations:z}),U&&O>v){let R=F.get(k);(!R||v<R.card)&&F.set(k,{name:this._cols[L].name,card:v,ratio:v/O})}if(P&&v>O){let R=F.get(L);(!R||O<R.card)&&F.set(L,{name:this._cols[k].name,card:O,ratio:O/v})}}for(let[D,M]of F)this._cols[D].primaryParentColumn=M.name,this._cols[D].nestingRatio=Math.round(M.ratio*100)/100}let p=6,_=this._rows.length;for(let d=0;d<this._cols.length;d++){let A=this._cols[d];if(A.isMeasure||A.primaryParentColumn)continue;let F=A.distinctCount??0;if(F<=h||_>0&&F>=_)continue;let D=[];for(let M=0;M<this._cols.length;M++){if(M===d)continue;let k=this._cols[M];if(k.isMeasure)continue;let L=k.distinctCount??0;L<2||L>=F||D.push(M)}D.sort((M,k)=>(this._cols[M].distinctCount??0)-(this._cols[k].distinctCount??0));for(let M of D.slice(0,p)){let k=new Map,L=!0;for(let v of this._rows){let G=this.STR(v[d])+"",z=this.STR(v[M])+"",N=k.get(G);if(N===void 0)k.set(G,z);else if(N!==z){L=!1;break}}if(!L)continue;let O=this._cols[M].distinctCount??0;A.primaryParentColumn=this._cols[M].name,A.nestingRatio=Math.round(O/F*100)/100;break}}let y=.01,x=.05,T=.95,V=8,$=8,X=6,J=500,Y=[];for(let d=0;d<this._cols.length&&Y.length<$;d++){let A=this._cols[d].dataType;(A==="Double"||A==="Integer"||A==="Decimal")&&Y.push(d)}if(Y.length>=3&&this._rows.length>=V){let d=Math.min(this._rows.length,J),A=Y.map(O=>{let v=[];for(let N=0;N<d;N++){let E=this._rows[N][O],U=typeof E=="number"?E:parseFloat(String(E).replace(/,/g,""));if(E==null||E===""||!isFinite(U))return null;v.push(U)}let G=v[0],z=!1;for(let N of v)if(N!==G){z=!0;break}return z?v:null}),F=Y.map((O,v)=>v).filter(O=>A[O]!==null),D=O=>{let v=O.slice().sort((z,N)=>z-N),G=v.length>>1;return v.length%2?v[G]:(v[G-1]+v[G])/2},M=null,k=[],L=O=>{if(k.length>=3){let v=k.map(E=>A[E]),G=v[0].length,z=new Array(G);for(let E=0;E<G;E++){let U=0;for(let P of v)U+=P[E];z[E]=U}let N=D(z);if(N>0){let E=0;for(let P of z)Math.abs(P-N)<=N*y&&E++;let U=E/G;if(U>=T){let P=1;for(let R of v){let W=D(R)/N;W<P&&(P=W)}P>=x&&(!M||k.length>M.cols.length)&&(M={cols:k.slice(),total:N,matched:U})}}}if(!(k.length>=X))for(let v=O;v<F.length;v++)k.push(F[v]),L(v+1),k.pop()};if(L(0),M){let O=M,G={columns:O.cols.map(z=>this._cols[Y[z]].name),total:Math.round(O.total*1e3)/1e3,matchedPct:Math.round(O.matched*100)/100};for(let z of O.cols)this._cols[Y[z]].constantSumGroup=G}}return this.applyTwoSetPairing(t,o),this.applyScoreSeparation(l,a),this.applySeriesCompleteness(r,t,o),this.applyMeasurePersistence(t,o),this._computedStatsForLevel=e,this._cols}applyTwoSetPairing(e,t){for(let r of this._cols)r.twoSetPairing!==void 0&&delete r.twoSetPairing;let i=Kt({rows:this._rows,columns:this._cols.map((r,s)=>{let o=t[s];return{name:r.name,values:o,distinct:o?o.size:r.distinctCount??0,isMeasure:!!r.isMeasure,isTemporal:!!r.isTemporal,isDatePart:!!r.isDatePart,identifierNamed:Re(r.name),temporalTextPattern:r.temporalTextPattern}}),text:r=>this.STR(r),locale:e});i&&(this._cols[i.key].twoSetPairing=i.pairing,this._cols[i.discriminator].twoSetPairing=i.pairing)}applyScoreSeparation(e,t){for(let r of this._cols)r.scoreSeparation!==void 0&&delete r.scoreSeparation;let i=Ht({rows:this._rows,columns:this._cols.map((r,s)=>({name:r.name,dataType:r.dataType,isMeasure:!!r.isMeasure,isTemporal:!!r.isTemporal,isDatePart:!!r.isDatePart,identifierNamed:Re(r.name),isBinaryFlag:!!r.isBinaryFlag,distinct:e[s]??0,twoValues:t[s]??null})),text:r=>this.STR(r)});for(let[r,s]of i)this._cols[r].scoreSeparation=s}applySeriesCompleteness(e,t,i){for(let u of this._cols)u.seriesCompleteness!==void 0&&delete u.seriesCompleteness;let r=this._cols.map((u,m)=>({c:u,i:m})).filter(({c:u})=>u.isTemporal&&!u.isMeasure&&u.temporalCadence&&u.temporalCadence.grain!=="irregular");if(r.length===0)return;let s=this.seriesKeyIndex(t,i);if(s<0)return;let o=this._cols[s],l=this._rows.map(u=>this.STR(u[s])),a=e>=20&&(o.dataType!=="String"||Array.isArray(o.safeDistinctValues));for(let{c:u,i:m}of r){let f=Ut({periods:this._rows.map(c=>this.STR(c[m])),series:l,seriesColumn:o.name,pattern:u.temporalTextPattern,locale:t,includeDates:e>=20,includeNames:a});f&&(u.seriesCompleteness=f)}}seriesKeyIndex(e,t){let i=[],r=[];this._cols.forEach((o,l)=>{let a=t[l];a&&(i.push(l),r.push({name:o.name,dataType:o.dataType,isMeasure:!!o.isMeasure,isTemporal:!!o.isTemporal,isDatePart:!!o.isDatePart,isReassembledDate:!!o.isReassembledDate,isBinaryFlag:!!o.isBinaryFlag,geoKind:o.geoKind,identifierNamed:Re(o.name),values:a,rows:this._rows.length,locale:e}))});let s=$t(r);return s<0?-1:i[s]}applyMeasurePersistence(e,t){for(let a of this._cols)a.persistence!==void 0&&delete a.persistence;let i=[];if(this._cols.forEach((a,u)=>{a.isMeasure&&(a.dataType==="Integer"||a.dataType==="Decimal"||a.dataType==="Double")&&i.push(u)}),i.length===0||this._rows.length<we)return;let r=-1,s=[];for(let a=0;a<this._cols.length&&r<0;a++){let u=this._cols[a];if(!u.isTemporal||u.isMeasure||u.isDatePart)continue;let m=this._rows.map(f=>j(this.STR(f[a]),u.temporalTextPattern,e)?.ms??null);new Set(m.filter(f=>f!==null)).size<we||(r=a,s=m)}if(r<0)return;let o=this.seriesKeyIndex(e,t),l=o>=0?this._rows.map(a=>this.STR(a[o])):void 0;for(let a of i){let u=this._rows.map(f=>{let c=f[a];if(c==null||c==="")return null;let S=typeof c=="number"?c:parseFloat(String(c).replace(/,/g,""));return Number.isFinite(S)?S:null}),m=Be({stamps:s,series:l,values:u});m&&(this._cols[a].persistence={timeColumn:this._cols[r].name,...o>=0?{seriesColumn:this._cols[o].name}:{},...m})}}updateColumnStats20(e,t,i,r,s,o,l,a,u,m,f,c){if(e>=20){let S=[...t].sort((C,g)=>C-g),I=Math.floor(S.length/2);if(i>0&&r!=null?s.avgValue=s.dataType=="Integer"?Math.round(r/i):r/i:s.avgValue=null,i>0&&(s.avgLength=o/i),this._rows.length>0){let C=g=>{let h=g instanceof Date?g:typeof g=="string"?Ne(g)??new Date(g):new Date(g),b=this.wholeDayIso(h);return b?b+"T00:00:00.000Z":isNaN(h.getTime())?g:h.toISOString().slice(0,10)+"T00:00:00.000Z"};s.dataType!="DateTime"||l||!a?s.lowValue=a:s.lowValue=C(a),s.dataType!="DateTime"||l||!u?s.highValue=u:s.highValue=C(u),s.medianValue=S.length===0?null:S.length%2===0?s.dataType=="Integer"?Math.round((S[I-1]+S[I])/2):(S[I-1]+S[I])/2:S[I],s.numericPrecision=m}if(S.length>0){let C=s.avgValue??0,g=S.length,h=0,b=0;for(let y of S){let x=y-C;h+=x*x,b+=x*x*x}let p=h/g,_=Math.sqrt(p);s.skewness=p===0?0:b/g/(_*_*_),s.stdDev=Math.sqrt(p)}r!==null&&(s.sum=r);let w=Array.from(f.entries()).sort((C,g)=>g[1]-C[1]);if(s.topCategories=w.slice(0,10).map(C=>C[1]),!s.isMeasure&&w.length>0&&(s.dataType!=="String"&&(s.topCategoryValues=w.slice(0,5).map(C=>C[0])),e>=20)){let C=w.map(h=>h[0]),g=pe(C,c);if(g!==null)s.ordinalPattern=g.pattern,s.orderedDomain=g.orderedDomain;else if(s.dataType==="String"){let h=at(C);h!==null&&(s.safeDistinctValues=h)}}if(S.length>=8&&(s.dataType==="Integer"||s.dataType==="Decimal")){let C=g=>S[Math.floor((S.length-1)*g)];s.quantiles={p05:C(.05),p25:C(.25),p75:C(.75),p95:C(.95)}}}if(!s.isMeasure&&s.dataType==="String"&&f.size>0){let S=Array.from(f.entries()).sort((C,g)=>g[1]-C[1]).map(C=>C[0]);s.formatSignature=he(S);let I=i>0?o/i:void 0,w=/^(UUID|EMAIL_LIKE|URL_LIKE|PHONE_LIKE|NUMERIC_ID|HEX_ID|OPAQUE_ID_ALPHANUMERIC|DATE_STR|BOOLEAN)$/;s.formatSignature&&!w.test(s.formatSignature)&&(I===void 0||I>=3)&&(s.isFreeText=!0)}if(!s.isMeasure&&f.size>0){let S=Array.from(f.entries()).sort((w,C)=>C[1]-w[1]),I=ct(S.map(w=>w[0]),s.name,c);if(I!==null&&(s.geoKind=I.geoKind,s.geoMatchPct=I.geoMatchPct,I.geoAmbiguous&&(s.geoAmbiguous=!0),I.geoKind.indexOf("country")===0)){let w=Ee(S);w&&(s.dominantGeoRegion=w.dominantGeoRegion,s.dominantGeoRegionPct=w.dominantGeoRegionPct,s.geoRegionCount=w.regionCount)}}}updateColumnStats10(e,t,i,r,s,o,l){let a=this._rows.length-i;e>=10&&(t.blankCount=a),t.distinctCount=r.size+(a!=0?1:0),t.valueNature="Categorical",i>0&&(t.dataType==="Integer"||t.dataType==="Decimal"?t.valueNature=Qt({dataType:t.dataType,isMeasure:!!t.isMeasure,name:t.name,distinct:r.size,nonblank:i,prec:s,maxval:o,minval:l}):t.dataType==="DateTime"&&(t.valueNature=t.dateWithTime?"Continuous":"Ordinal"))}getRowCount(){return this._rows.length}getLeafCardinality(){if(this._leafCardinality!==null)return this._leafCardinality;let e=[];if(this._cols.forEach((i,r)=>{i.isMeasure||e.push(r)}),e.length===0)return this._leafCardinality=this._rows.length,this._leafCardinality;let t=new Set;for(let i of this._rows)t.add(JSON.stringify(e.map(r=>i[r])));return this._leafCardinality=t.size,this._leafCardinality}_leafCardinality=null;getGeoExtent(){if(this._geoExtentComputed)return this._geoExtent;this._geoExtentComputed=!0,this._geoExtent=null;let e=o=>Ke(o,{camel:!0}),t=-1,i=-1,r=-1;if(this._cols.forEach((o,l)=>{let a=e(o.name),u=o.dataType==="Integer"||o.dataType==="Decimal";u&&t<0&&a.some(m=>m==="lat"||m==="latitude")?t=l:u&&i<0&&a.some(m=>m==="lon"||m==="lng"||m==="long"||m==="longitude")&&(i=l),r<0&&!o.isMeasure&&typeof o.geoKind=="string"&&o.geoKind.indexOf("country")===0&&(r=l)}),t<0||i<0)return null;let s=[];for(let o of this._rows){let l=o[t],a=o[i],u=l==null||l===""?null:Number(l),m=a==null||a===""?null:Number(a);s.push({lat:u,lon:m,country:r>=0&&Se(this.STR(o[r]))?this.STR(o[r]):null})}return this._geoExtent=gt(s),this._geoExtent}_geoExtent=null;_geoExtentComputed=!1;obfuscateString(e){return Lt(e,Je)}toObjectArray(){let e=this.liveEnglishAliases();return this._rows.map(t=>{let i={};this._cols.forEach((r,s)=>{i[r.name]=t[s],this.emitLegacyAggAliases&&r.hostName&&r.hostName!==r.name&&!Object.prototype.hasOwnProperty.call(i,r.hostName)&&(i[r.hostName]=t[s])});for(let[r,s]of e)Object.prototype.hasOwnProperty.call(i,s.alias)||(i[s.alias]=t[r]);return i})}async getCSVAsync(e){let t=[],i=e?25:1e7,r=e?4e3:1e7,s=new Map,o=this.wallClockColumnIndexes();for(let a of this._rows){let u={};for(let m=0;m<this._cols.length;m++){let f=this._cols[m],c=a[m];if(this.STR(c)!=""){if(e&&f.dataType=="String")if(s.has(c))c=s.get(c);else{let S=this.obfuscateString(c);s.set(c,S),c=S}else if(f.dataType=="DateTime"&&!f.dateWithTime){let S=c instanceof Date?c:typeof c=="string"?Ne(c)??new Date(c):new Date(c);c=(this.wholeDayIso(S)??S.toISOString().slice(0,10))+"T00:00:00.000Z"}else o.has(m)&&c instanceof Date&&(c=fe(c));r-=this.STR(c).length}else c=null;u[m]=c,--r}if(t.push(u),--i,i<=0||r<=0)break}return await Yt.unparse(t,{header:!1})}getCSVHeaderLine(){let e=this.liveEnglishAliases();return Yt.unparse([this._cols.map((t,i)=>{if(this.emitLegacyAggAliases&&t.hostName)return this.STR(t.hostName);let r=e.get(i);return this.STR(r&&r.headerName?r.alias:t.name)})])}setHostQueryNames(e){this._hostQueryNames=(e??[]).map(t=>t==null?null:this.STR(t)),this._englishAliases=new Map}aliasesForCode(e){let t=Le(e,this._cols)?this.legacyAliases():[];for(let i of this.englishAliasesFor(e).values())t.push({name:i.name,alias:i.alias,reason:"english-implicit-agg"});return t}armAliasesForCode(e){return this.emitLegacyAggAliases=Le(e,this._cols),this._englishAliases=this.englishAliasesFor(e),this.getArmedAliases()}getArmedAliases(){let e=this.emitLegacyAggAliases?this.legacyAliases():[];for(let t of this.liveEnglishAliases().values())e.push({name:t.name,alias:t.alias,reason:"english-implicit-agg"});return e}legacyAliases(){let e=[];for(let t of this._cols)t&&t.hostName&&t.hostName!==t.name&&e.push({name:this.STR(t.name),alias:this.STR(t.hostName),reason:"doubled-agg-prefix"});return e}englishAliasesFor(e){let t=new Map;if(!e||this._hostQueryNames.length===0||!this._cols||this._cols.length===0)return t;let i=String(e),r=new Set;for(let o of this._cols)o&&(r.add(this.STR(o.name)),o.hostName&&r.add(this.STR(o.hostName)));let s=new Map;for(let o=0;o<this._cols.length;o++){if(!this._cols[o]||Rt(this._hostQueryNames[o],this._cols[o].name,this._cols[o].dataType))continue;let l=wt(this._hostQueryNames[o]).filter(a=>!r.has(a)&&ae(i,a));l.length===1&&s.set(l[0],[...s.get(l[0])??[],o])}for(let[o,l]of s){if(l.length!==1)continue;let a=this.STR(this._cols[l[0]].name);t.set(l[0],{name:a,alias:o,headerName:!ae(i,a)})}return t}liveEnglishAliases(){let e=new Map;for(let[t,i]of this._englishAliases){let r=this._cols?this._cols[t]:null;r&&this.STR(r.name)===i.name&&e.set(t,i)}return e}addRow(e,t){if(this.dedupRows){let i="";for(let s of e)i+=this.STR(s)+"~";let r=qe(i);if(this._rowHashes.has(r))return!1;this._rowHashes.add(r)}return this._rows.push(ri(e)),this._inferredMeasureFlags=null,this._origIndices.push(t??-1),!0}getOriginalRowIndex(e){return e<0||e>=this._origIndices.length?-1:this._origIndices[e]}reset(){this._inferredMeasureFlags=null,this._cols=[],this._rows=[],this._origIndices=[],this._rowHashes=new Set,this._leafCardinality=null,this._hostQueryNames=[],this._englishAliases=new Map}setColumns(e){if(this._inferredMeasureFlags=null,this._cols=e,!e||e.length===0)return;let t=new Set(e.map(i=>this.STR(i?.name)));for(let i of e){if(!i)continue;let r=this.STR(i.name),s=Mt(r);!s||s===r||t.has(s)||(t.delete(r),t.add(s),i.hostName=r,i.name=s)}}};export{gt as a,tn as b,Se as c,oi as d,yt as e,gn as f,pn as g,hn as h,yn as i,xe as j,wn as k,Mt as l,Le as m,wt as n,Nt as o,Nn as p,vt as q,kt as r,fi as s,gi as t,pi as u,kn as v,Dn as w,On as x,Dt as y,ae as z,Hn as A,Ci as B,Yn as C,jn as D,j as E,Bt as F,ur as G,cr as H,mr as I,hr as J,$t as K,Ut as L,Oi as M,Re as N,Zt as O,ei as P,ti as Q,ni as R,Qt as S,jt as T,ri as U,Xt as V};
@@ -1,2 +1,2 @@
1
1
  /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
- import{M as R,U as I,e as L}from"./chunk-TXKQGWEI.mjs";import{a as y,c as C,d as E,e as x}from"./chunk-A4PQBWRA.mjs";import{u as T}from"./chunk-CZJ7M6A5.mjs";import A from"papaparse";var M=500,k=/^[+-]?\d{1,15}$/,P=/^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/,N=/^\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4}$/;function O(e,o=".",n=!1){if(n)return"DateTime";let r=0,a=0,i=0,l=0;for(let m of e){if(m==null)continue;if(typeof m=="number"){l++,a++,Number.isInteger(m)&&r++;continue}if(m instanceof Date){l++,i++;continue}if(typeof m=="boolean"){l++;continue}let c=String(m).trim();if(c!==""){if(l++,k.test(y(c))){r++,a++;continue}if(x(c,o)){a++;continue}if((P.test(c)||N.test(c))&&!isNaN(Date.parse(c))){i++;continue}}}return l===0?"String":i===l?"DateTime":r===l?"Integer":a===l?"Decimal":"String"}function _(e,o,n=".",r=null){if(e==null)return null;if(typeof e=="number")return o==="String"?String(e):e;if(e instanceof Date)return o==="DateTime"?e:e.toISOString();if(typeof e=="boolean")return String(e);let a=String(e).trim();if(a==="")return null;switch(o){case"Integer":{let i=y(a);return k.test(i)?parseInt(i,10):null}case"Decimal":return E(a,n);case"DateTime":return r?r.read(a):T(a);default:return a}}function $(e){let o=(e||"").toLowerCase().replace(/\(.*$/,"").trim();return/^(tinyint|smallint|int|integer|int2|int4|int8|bigint|serial|bigserial)$/.test(o)?"Integer":/^(decimal|numeric|money|smallmoney|float|real|double|double precision|number)$/.test(o)?"Decimal":/^(date|datetime|datetime2|smalldatetime|datetimeoffset|timestamp|timestamptz|time)$/.test(o)?"DateTime":(/^(bit|bool|boolean)$/.test(o),"String")}function*q(e,o){for(let n of e)yield n?.[o]}function f(e,o,n){if(e.length===0)throw new Error("ingest: no columns were resolved from the source. Supply column descriptors, or use a source shape that carries them (grid/table/objects/sql).");let r=e.length,a=e.map((t,s)=>o.slice(0,M).map(u=>u?.[s])),i=a.map(t=>C(t,n.locale)),l=e.map((t,s)=>t.dataType===void 0||t.dataType==="DateTime"?L(q(o,s),{locale:n.locale??"en"}):null),m=e.map((t,s)=>t.dataType??O(a[s],i[s],l[s]!==null)),c=new Set((n.measures??[]).map(t=>t.toLowerCase())),w=new Set((n.dimensions??[]).map(t=>t.toLowerCase())),j=new Set((n.nonAdditive??[]).map(t=>t.toLowerCase())),b=e.map((t,s)=>{let u=t.name.toLowerCase(),g=t.isMeasure??((m[s]==="Integer"||m[s]==="Decimal")&&!R(t.name));c.has(u)&&(g=!0),w.has(u)&&(g=!1);let S={name:t.name,dataType:m[s],isMeasure:g};return g&&j.has(u)&&(S.discourageAggregationAcrossGroups=!0),S}),d=new I;d.dedupRows=n.dedup!==!1,d.setColumns(b),d.declareDimensions(b.filter((t,s)=>w.has(e[s].name.toLowerCase())));for(let t=0;t<o.length;t++){let s=o[t];d.addRow(Array.from({length:r},(u,g)=>_(s?.[g],m[g],i[g],l[g])),t)}let D=d.getColumnsWithStats(n.privacyLevel??"20",n.locale??"en"),p=new Map(D.map(t=>[t.name,t]));e.forEach(t=>{let s=p.get(t.name);s&&(t.format&&(s.modelFormat=t.format),t.description&&(s.modelDesc=t.description))});for(let[t,s]of Object.entries(n.formats??{})){let u=p.get(t);u&&(u.modelFormat=s)}for(let[t,s]of Object.entries(n.descriptions??{})){let u=p.get(t);u&&(u.modelDesc=s)}for(let t of n.groupBy??[]){let s=p.get(t);s&&(s.isGrouping=!0)}return{columns:D,rows:d.toObjectArray(),totalRows:d.getRowCount(),index:d}}function h(e,o){return e.map(n=>Array.isArray(n)?n:o.map(r=>n[r]))}function F(e,o){let n=[],r=new Set,a=Math.min(e.length,Math.max(1,o));for(let i=0;i<a;i++){let l=e[i];if(!(!l||typeof l!="object"))for(let m of Object.keys(l))r.has(m)||(r.add(m),n.push(m))}return n}function V(e){let o=String(e??"").replace(/^\uFEFF/,""),n=[],r=[],a=0;return A.parse(o,{skipEmptyLines:!1,step:i=>{let l=i.meta.cursor,m=o.slice(a,l);a=l,i.errors?.length&&r.push(...i.errors);let c=i.data;c.length===1&&c[0]===""&&m.replace(/[\r\n]/g,"")===""||n.push(c)}}),!n.length&&!r.length&&r.push(...A.parse(o,{skipEmptyLines:!0}).errors),{rows:n,errors:r}}function H(e,o={}){switch(e.kind){case"csv":{let n=V(e.text);if(n.errors.length&&n.rows.length===0)throw new Error(`ingest: CSV parse failed - ${n.errors[0].message}`);let r=n.rows;if(r.length<2)throw new Error("ingest: CSV needs a header line plus at least one data row.");let a=r[0].map(i=>(i??"").trim());return f(a.map(i=>({name:i})),r.slice(1),o)}case"grid":{if(!e.header?.length)throw new Error("ingest: 'grid' needs a non-empty header.");return f(e.header.map(n=>({name:(n??"").trim()})),e.rows??[],o)}case"table":{if(!e.columns?.length)throw new Error("ingest: 'table' needs at least one column descriptor.");let n=e.columns.map(r=>r.name);return f(e.columns,h(e.rows??[],n),o)}case"objects":{let n=e.rows??[],r=e.columns?.length?e.columns:F(n,o.columnScanLimit??M).map(a=>({name:a}));if(!r.length)throw new Error("ingest: 'objects' produced no columns - the rows array is empty or holds no object keys.");return f(r,h(n,r.map(a=>a.name)),o)}case"sql":{if(!e.schema?.length)throw new Error("ingest: 'sql' needs at least one schema column.");let n=e.schema.map(r=>{let a=$(r.dataType);return{name:r.name,dataType:a,isMeasure:r.isMeasure,format:r.format,description:r.description}});return f(n,h(e.rows??[],n.map(r=>r.name)),o)}default:{let n=e;throw new Error(`ingest: unknown source kind '${n?.kind}'. Expected one of: csv, grid, table, objects, sql.`)}}}export{$ as a,V as b,H as c};
2
+ import{N as R,V as I,e as L}from"./chunk-CQS6BGRJ.mjs";import{a as y,c as C,d as E,e as x}from"./chunk-A4PQBWRA.mjs";import{u as T}from"./chunk-CZJ7M6A5.mjs";import A from"papaparse";var M=500,k=/^[+-]?\d{1,15}$/,P=/^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/,N=/^\d{1,2}[\/\-.]\d{1,2}[\/\-.]\d{2,4}$/;function O(e,o=".",n=!1){if(n)return"DateTime";let r=0,a=0,i=0,l=0;for(let m of e){if(m==null)continue;if(typeof m=="number"){l++,a++,Number.isInteger(m)&&r++;continue}if(m instanceof Date){l++,i++;continue}if(typeof m=="boolean"){l++;continue}let c=String(m).trim();if(c!==""){if(l++,k.test(y(c))){r++,a++;continue}if(x(c,o)){a++;continue}if((P.test(c)||N.test(c))&&!isNaN(Date.parse(c))){i++;continue}}}return l===0?"String":i===l?"DateTime":r===l?"Integer":a===l?"Decimal":"String"}function _(e,o,n=".",r=null){if(e==null)return null;if(typeof e=="number")return o==="String"?String(e):e;if(e instanceof Date)return o==="DateTime"?e:e.toISOString();if(typeof e=="boolean")return String(e);let a=String(e).trim();if(a==="")return null;switch(o){case"Integer":{let i=y(a);return k.test(i)?parseInt(i,10):null}case"Decimal":return E(a,n);case"DateTime":return r?r.read(a):T(a);default:return a}}function $(e){let o=(e||"").toLowerCase().replace(/\(.*$/,"").trim();return/^(tinyint|smallint|int|integer|int2|int4|int8|bigint|serial|bigserial)$/.test(o)?"Integer":/^(decimal|numeric|money|smallmoney|float|real|double|double precision|number)$/.test(o)?"Decimal":/^(date|datetime|datetime2|smalldatetime|datetimeoffset|timestamp|timestamptz|time)$/.test(o)?"DateTime":(/^(bit|bool|boolean)$/.test(o),"String")}function*q(e,o){for(let n of e)yield n?.[o]}function f(e,o,n){if(e.length===0)throw new Error("ingest: no columns were resolved from the source. Supply column descriptors, or use a source shape that carries them (grid/table/objects/sql).");let r=e.length,a=e.map((t,s)=>o.slice(0,M).map(u=>u?.[s])),i=a.map(t=>C(t,n.locale)),l=e.map((t,s)=>t.dataType===void 0||t.dataType==="DateTime"?L(q(o,s),{locale:n.locale??"en"}):null),m=e.map((t,s)=>t.dataType??O(a[s],i[s],l[s]!==null)),c=new Set((n.measures??[]).map(t=>t.toLowerCase())),w=new Set((n.dimensions??[]).map(t=>t.toLowerCase())),j=new Set((n.nonAdditive??[]).map(t=>t.toLowerCase())),b=e.map((t,s)=>{let u=t.name.toLowerCase(),g=t.isMeasure??((m[s]==="Integer"||m[s]==="Decimal")&&!R(t.name));c.has(u)&&(g=!0),w.has(u)&&(g=!1);let S={name:t.name,dataType:m[s],isMeasure:g};return g&&j.has(u)&&(S.discourageAggregationAcrossGroups=!0),S}),d=new I;d.dedupRows=n.dedup!==!1,d.setColumns(b),d.declareDimensions(b.filter((t,s)=>w.has(e[s].name.toLowerCase())));for(let t=0;t<o.length;t++){let s=o[t];d.addRow(Array.from({length:r},(u,g)=>_(s?.[g],m[g],i[g],l[g])),t)}let D=d.getColumnsWithStats(n.privacyLevel??"20",n.locale??"en"),p=new Map(D.map(t=>[t.name,t]));e.forEach(t=>{let s=p.get(t.name);s&&(t.format&&(s.modelFormat=t.format),t.description&&(s.modelDesc=t.description))});for(let[t,s]of Object.entries(n.formats??{})){let u=p.get(t);u&&(u.modelFormat=s)}for(let[t,s]of Object.entries(n.descriptions??{})){let u=p.get(t);u&&(u.modelDesc=s)}for(let t of n.groupBy??[]){let s=p.get(t);s&&(s.isGrouping=!0)}return{columns:D,rows:d.toObjectArray(),totalRows:d.getRowCount(),index:d}}function h(e,o){return e.map(n=>Array.isArray(n)?n:o.map(r=>n[r]))}function F(e,o){let n=[],r=new Set,a=Math.min(e.length,Math.max(1,o));for(let i=0;i<a;i++){let l=e[i];if(!(!l||typeof l!="object"))for(let m of Object.keys(l))r.has(m)||(r.add(m),n.push(m))}return n}function V(e){let o=String(e??"").replace(/^\uFEFF/,""),n=[],r=[],a=0;return A.parse(o,{skipEmptyLines:!1,step:i=>{let l=i.meta.cursor,m=o.slice(a,l);a=l,i.errors?.length&&r.push(...i.errors);let c=i.data;c.length===1&&c[0]===""&&m.replace(/[\r\n]/g,"")===""||n.push(c)}}),!n.length&&!r.length&&r.push(...A.parse(o,{skipEmptyLines:!0}).errors),{rows:n,errors:r}}function H(e,o={}){switch(e.kind){case"csv":{let n=V(e.text);if(n.errors.length&&n.rows.length===0)throw new Error(`ingest: CSV parse failed - ${n.errors[0].message}`);let r=n.rows;if(r.length<2)throw new Error("ingest: CSV needs a header line plus at least one data row.");let a=r[0].map(i=>(i??"").trim());return f(a.map(i=>({name:i})),r.slice(1),o)}case"grid":{if(!e.header?.length)throw new Error("ingest: 'grid' needs a non-empty header.");return f(e.header.map(n=>({name:(n??"").trim()})),e.rows??[],o)}case"table":{if(!e.columns?.length)throw new Error("ingest: 'table' needs at least one column descriptor.");let n=e.columns.map(r=>r.name);return f(e.columns,h(e.rows??[],n),o)}case"objects":{let n=e.rows??[],r=e.columns?.length?e.columns:F(n,o.columnScanLimit??M).map(a=>({name:a}));if(!r.length)throw new Error("ingest: 'objects' produced no columns - the rows array is empty or holds no object keys.");return f(r,h(n,r.map(a=>a.name)),o)}case"sql":{if(!e.schema?.length)throw new Error("ingest: 'sql' needs at least one schema column.");let n=e.schema.map(r=>{let a=$(r.dataType);return{name:r.name,dataType:a,isMeasure:r.isMeasure,format:r.format,description:r.description}});return f(n,h(e.rows??[],n.map(r=>r.name)),o)}default:{let n=e;throw new Error(`ingest: unknown source kind '${n?.kind}'. Expected one of: csv, grid, table, objects, sql.`)}}}export{$ as a,V as b,H as c};
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
- import{a as Xn,b as Jn}from"./chunk-HIVICMC5.mjs";import{a as Zn,b as I,c as er,d as D,e as E,f as tr,g as X,h as J}from"./chunk-4J7WPYLM.mjs";import{a as jn,b as Yn,c as Qn}from"./chunk-RI5BOXDB.mjs";import{A as vn,B as Pn,C as Ln,D as An,E as Mn,F as In,G as Nn,H as Fn,I as Dn,J as kn,K as Gn,L as Vn,M as Un,N as Wn,O as qn,P as $n,Q as zn,R as Hn,S as Kn,U as Bn,a as Qt,b as Xt,c as Jt,d as Zt,f as an,g as ln,h as un,i as cn,j as dn,k as mn,l as fn,m as pn,n as gn,o as yn,p as hn,q as Cn,r as bn,s as En,t as Tn,u as Sn,v as Rn,w as xn,x as wn,y as _n,z as On}from"./chunk-TXKQGWEI.mjs";import{a as en}from"./chunk-U3H6UBOO.mjs";import{b as tn,c as nn,d as rn,f as on,g as sn}from"./chunk-A4PQBWRA.mjs";import{a as le,b as ue,c as Kt,d as Bt,e as jt,f as Yt}from"./chunk-IPPPCWAK.mjs";import{a as M,b as V,c as Y,d as U,k as W,l as Dt,m as kt,n as ae,o as P,p as Gt,q as Vt,r as Ut,s as q,t as Wt,u as qt,v as $t,w as zt,x as Q,y as Ht}from"./chunk-INMDBTAR.mjs";import"./chunk-5MRZID36.mjs";import{a as ht,b as Ct,c as bt,d as Et,e as Tt,f as St,g as Rt,h as xt,i as wt,j as _t,k as Ot,l as vt,m as It,n as Nt,o as Ft}from"./chunk-HJA26Z2E.mjs";import{A as mt,B as ft,C as pt,D as gt,E as yt,a as qe,b as $e,c as ze,d as He,e as Ke,f as Be,g as je,h as Ye,i as Qe,j as Xe,k as Je,l as Ze,m as et,n as tt,o as nt,q as j,r as rt,s as ot,t as it,u as st,v as at,w as lt,x as ut,y as ct,z as dt}from"./chunk-CZJ7M6A5.mjs";import{a as De,b as ke,c as Ge,d as Ve,e as Ue,f as B,g as We}from"./chunk-WC4JINEZ.mjs";import{b as Pt,c as Lt,d as At,e as Mt}from"./chunk-5HI6TVMM.mjs";var Z=2,me=400;function te(e){return!!W(e)}function F(e){let t=new Set;for(let n of e){if(n==null)continue;let o=U(String(n));if(!V(o)&&!t.has(o)&&(t.add(o),t.size>=me))break}return Array.from(t)}function N(e){let t=F(e);if(t.length===0||ne(e)<95)return!1;let n=t.filter(a=>te(a)&&!P(a)).length,o=t.filter(a=>!te(a)&&!!P(a)).length;return n>=1&&n>=o}function ce(e,t){if(!P(e))return!1;let n=W(e);return n?t==="world"?!0:ae.has(n):!1}function ne(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let o of t)te(o)&&n++;return Math.round(n/t.length*1e3)/10}function $(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let o of t)P(o)&&n++;return Math.round(n/t.length*1e3)/10}function oe(e){let t=new Set;for(let n of e){if(n==null)continue;let o=String(n).trim();if(!V(U(o))&&!t.has(o)&&(t.add(o),t.size>=me))break}return Array.from(t)}function re(e){let t=oe(e);if(t.length===0)return 0;let n=0;for(let o of t)q(o).length>0&&n++;return Math.round(n/t.length*1e3)/10}function de(e,t){return ue(t,le)?!0:oe(e).some(n=>/^\d{5}(-\d{4})?$/.test(n.replace(/\.0+$/,"")))}function nr(e,t){let n=F(e);if(n.length===0)return 0;let o=0;for(let a of n)Q(a,t)&&o++;return Math.round(o/n.length*1e3)/10}function ee(e,t){let n=0;for(let o of F(e))t(o)&&n++;return n}function rr(e,t){let n=0;for(let o of oe(e))t(o)&&n++;return n}function or(e,t,n,o,a){let u=[],l=[],i={},C={},b=new Set(e),h=s=>t.map(d=>d[s]);for(let s of["city","country"]){let d=n?.[s];d&&b.has(d)&&(i[s]=d)}let g=new Set(a??e);for(let s of["lat","lon"]){let d=n?.[s];d&&g.has(d)&&(i[s]=d)}let f=n?.zip;if(f&&b.has(f)){let s=h(f),d=re(s);d<95?l.push(`zip=${f} (only ${d}% of values read as ZIPs)`):de(s,f)?i.zip=f:l.push(`zip=${f} (all values are 3-4 digits with nothing to say they are postal)`)}let c=n?.state;if(c&&b.has(c)){let s=h(c),d=F(s);d.length>0&&d.every(S=>ce(S,o))?l.push(`state=${c} (every value is "CA", which is both Canada and California)`):N(s)?(l.push(`state=${c} (every value is a country, not a state)`),i.country||(i.country=c)):$(s)<95?l.push(`state=${c} (only ${$(s)}% of values are states/provinces)`):i.state=c}let p=new Set(Object.values(i).filter(Boolean)),y=e.filter(s=>!p.has(s)&&!s.startsWith("__"));if(!i.state){let s=null;for(let d of y){let S=h(d);if(N(S))continue;let O=$(S);if(O<95)continue;let K=ee(S,G=>!!P(G)),Fe=ee(S,G=>!!P(G)&&!ce(G,o));K<Z&&Fe<1||(!s||O>s.pct)&&(s={name:d,pct:O})}s&&(i.state=s.name,p.add(s.name),u.push(`state=${s.name} (${s.pct}% states/provinces)`))}if(!i.zip)for(let s of y){if(p.has(s))continue;let d=h(s),S=re(d);if(!(S<95)&&de(d,s)&&!(rr(d,O=>q(O).length>0)<Z)){i.zip=s,p.add(s),u.push(`zip=${s} (${S}% ZIP codes)`);break}}let T=i.country;if(!T||!N(h(T))){let s=null;for(let d of y){if(p.has(d)||!N(h(d)))continue;let S=ne(h(d));(!s||S>s.pct)&&(s={name:d,pct:S})}s&&(T&&(l.push(`country=${T} (only ${ne(h(T))}% of values are country identifiers; using ${s.name} instead)`),C.country=T),i.country=s.name,p.add(s.name),u.push(`country=${s.name}`))}if(!i.city){let s=null;for(let d of y){if(p.has(d))continue;let S=h(d),O=nr(S,o);O<Y||ee(S,K=>Q(K,o))<Z||(!s||O>s.pct)&&(s={name:d,pct:O})}s&&(i.city=s.name,u.push(`city=${s.name} (${s.pct}% known cities)`))}let L=i.country?h(i.country):[],R=!!i.country&&N(L),A=R?new Set(L.map(s=>W(s==null?null:String(s))).filter(Boolean)).size:0,x=R&&A>=2,w=!!(i.lat&&i.lon)&&t.some(s=>{let d=+String(s[i.lat]??"").trim(),S=+String(s[i.lon]??"").trim();return isFinite(d)&&isFinite(S)&&d>=-90&&d<=90&&S>=-180&&S<=180&&String(s[i.lat]??"").trim()!==""&&String(s[i.lon]??"").trim()!==""});return i.lat&&i.lon&&!w&&l.push(`lat/lon=${i.lat}/${i.lon} (no row holds a usable coordinate pair)`),i.country&&!x&&!(i.city||i.state||i.zip||w)&&l.push(R?`country=${i.country} (every row resolves to the same country - nothing to place apart)`:`country=${i.country} (values are not country identifiers)`),{bind:!!(i.city||i.state||i.zip||x||w)?i:null,backfilled:u,refused:l,...Object.keys(C).length?{labelFallback:C}:{}}}var r=(e,...t)=>({part:e,langs:Object.freeze(t)}),ie=Object.freeze({jaar:r("year","nl"),kwartaal:r("quarter","nl"),maand:r("month","nl"),dag:r("day","nl","sv","da","nb"),jahr:r("year","de"),quartal:r("quarter","de"),monat:r("month","de"),tag:r("day","de"),ann\u00E9e:r("year","fr"),mois:r("month","fr"),jour:r("day","fr"),trimestre:r("quarter","fr","es","pt","it"),a\u00F1o:r("year","es"),mes:r("month","es"),d\u00EDa:r("day","es"),ano:r("year","pt"),m\u00EAs:r("month","pt"),dia:r("day","pt"),anno:r("year","it"),mese:r("month","it"),giorno:r("day","it"),\u0433\u043E\u0434:r("year","ru"),\u043C\u0435\u0441\u044F\u0446:r("month","ru"),\u0440\u0456\u043A:r("year","uk"),\u043C\u0456\u0441\u044F\u0446\u044C:r("month","uk"),\u043A\u0432\u0430\u0440\u0442\u0430\u043B:r("quarter","ru","uk"),\u0434\u0435\u043D\u044C:r("day","ru","uk"),rok:r("year","pl","cs","sk"),kwarta\u0142:r("quarter","pl"),miesi\u0105c:r("month","pl"),dzie\u0144:r("day","pl"),\u010Dtvrtlet\u00ED:r("quarter","cs"),m\u011Bs\u00EDc:r("month","cs"),den:r("day","cs"),\u0161tvr\u0165rok:r("quarter","sk"),mesiac:r("month","sk"),de\u0148:r("day","sk"),\u00E5r:r("year","sv","da","nb"),kvartal:r("quarter","sv","da","nb"),m\u00E5nad:r("month","sv"),m\u00E5ned:r("month","da","nb"),vuosi:r("year","fi"),vuosinelj\u00E4nnes:r("quarter","fi"),kuukausi:r("month","fi"),p\u00E4iv\u00E4:r("day","fi"),\u00E9v:r("year","hu"),negyed\u00E9v:r("quarter","hu"),h\u00F3nap:r("month","hu"),nap:r("day","hu"),y\u0131l:r("year","tr"),\u00E7eyrek:r("quarter","tr"),ay:r("month","tr"),g\u00FCn:r("day","tr"),\u03AD\u03C4\u03BF\u03C2:r("year","el"),\u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF:r("quarter","el"),\u03BC\u03AE\u03BD\u03B1\u03C2:r("month","el"),\u03B7\u03BC\u03AD\u03C1\u03B1:r("day","el"),an:r("year","ro"),trimestru:r("quarter","ro"),lun\u0103:r("month","ro"),zi:r("day","ro"),godina:r("year","hr"),tromjese\u010Dje:r("quarter","hr"),mjesec:r("month","hr"),dan:r("day","hr"),\u5E74:r("year","ja","zh"),\u56DB\u534A\u671F:r("quarter","ja"),\u5B63\u5EA6:r("quarter","zh"),\u6708:r("month","ja","zh"),\u65E5:r("day","ja","zh"),\uC5F0\uB3C4:r("year","ko"),\uBD84\uAE30:r("quarter","ko"),\uC6D4:r("month","ko"),\uC77C:r("day","ko"),tahun:r("year","id"),kuartal:r("quarter","id"),triwulan:r("quarter","id"),bulan:r("month","id"),hari:r("day","id"),n\u0103m:r("year","vi"),qu\u00FD:r("quarter","vi"),th\u00E1ng:r("month","vi"),ng\u00E0y:r("day","vi"),\u0E1B\u0E35:r("year","th"),\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A:r("quarter","th"),\u0E40\u0E14\u0E37\u0E2D\u0E19:r("month","th"),\u0E27\u0E31\u0E19:r("day","th"),\u0627\u0644\u0633\u0646\u0629:r("year","ar"),\u0633\u0646\u0629:r("year","ar"),\u0627\u0644\u0639\u0627\u0645:r("year","ar"),\u0639\u0627\u0645:r("year","ar"),\u0627\u0644\u0631\u0628\u0639:r("quarter","ar"),\u0631\u0628\u0639:r("quarter","ar"),"\u0631\u0628\u0639 \u0627\u0644\u0633\u0646\u0629":r("quarter","ar"),\u0627\u0644\u0634\u0647\u0631:r("month","ar"),\u0634\u0647\u0631:r("month","ar"),\u0627\u0644\u064A\u0648\u0645:r("day","ar"),\u064A\u0648\u0645:r("day","ar"),\u05E9\u05E0\u05D4:r("year","he"),\u05E8\u05D1\u05E2\u05D5\u05DF:r("quarter","he"),\u05D7\u05D5\u05D3\u05E9:r("month","he"),\u05D9\u05D5\u05DD:r("day","he"),\u0935\u0930\u094D\u0937:r("year","hi"),\u0938\u093E\u0932:r("year","hi"),\u0924\u093F\u092E\u093E\u0939\u0940:r("quarter","hi"),\u092E\u0939\u0940\u0928\u093E:r("month","hi"),\u092E\u093E\u0939:r("month","hi"),\u0926\u093F\u0928:r("day","hi"),\u0633\u0627\u0644:r("year","fa"),\u0645\u0627\u0647:r("month","fa"),\u0631\u0648\u0632:r("day","fa")}),ir=Object.freeze(Array.from(new Set(Object.values(ie).flatMap(e=>e.langs)))),fe=Object.freeze(["fa","ar","he","th"]),pe=1900,ge=2100;function sr(e,t){let n=[],o=B(t);try{o&&n.push(e.toLocaleLowerCase(o.intl))}catch{}let a=e.toLowerCase();return n.includes(a)||n.push(a),n}function ar(e,t){let n=String(e??"").trim().normalize("NFC");if(!n)return null;for(let o of sr(n,t)){let a=ie[o];if(a&&a.langs.includes(t))return a.part}return null}function lr(e,t){return fe.includes(e)?typeof t=="number"&&Number.isFinite(t)&&t>=pe&&t<=ge:!0}function ye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var ur=/\b(?:columns|cols|column)\b/i;function z(e,t){let n=Math.max(0,t-240),o=e.slice(n,t),a=o.lastIndexOf(";");return a>=0&&(o=o.slice(a+1)),ur.test(o)}function he(e,t){return Ce(e,t,n=>new RegExp(String.raw`\b${n}\s*(?:>=\s*0|>\s*-1|[!=]==?\s*-1)`).test(e))}function Ce(e,t,n){let o=ye(t),a=new RegExp(String.raw`(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*?\.name\s*===?\s*(['"])${o}\2`,"g"),u=new RegExp(String.raw`\.name\s*===?\s*(['"])${o}\1`,"g"),l=0,i;for(;(i=u.exec(e))!==null;)z(e,i.index)&&l++;let C=0;for(;(i=a.exec(e))!==null;){let b=i.index+i[0].lastIndexOf(".name");if(!z(e,b))continue;C++;let h=ye(i[1]);if(!n(h))return!1}return C>0&&C===l}function cr(e,t){return Ce(e,t,n=>new RegExp(String.raw`\b${n}\s*(?:>=\s*0|>\s*-1|!==?\s*-1)`).test(e)&&!new RegExp(String.raw`\b${n}\s*===?\s*-1`).test(e))}var be=["__rowIdx__","__geoIso__","__geoLat__","__geoLon__","__geoPrecision__"];function dr(e,t){if(!e)return[];let n=new Set(t);for(let i of be)n.add(i);let o=new Set,a=/\.name\s*===?\s*(['"])([^'"]+)\1/g,u;for(;(u=a.exec(e))!==null;)z(e,u.index)&&o.add(u[2]);if(o.size===0)return[];let l=[];return o.forEach(i=>{n.has(i)||he(e,i)||l.push(i)}),l}function mr(e,t){if(!e)return[];let n=(e.getColumns()||[]).map(o=>o.name);if(!t||typeof e.aliasesForCode!="function")return n;for(let o of e.aliasesForCode(t))n.push(o.alias);return n}function Ee(e,t){let n=t?.freemiumMaxShapeColumns;return typeof n!="number"||!isFinite(n)||n<1?null:!isFinite(e)||e<=n?0:Math.round(e-n)}function fr(e,t,n){let o=Ee(e,t);if(o===null||o<=0)return null;let a=typeof t?.freemiumColumnCapPivot=="number"?t.freemiumColumnCapPivot:4,u=o>a?t?.freemiumColumnCapMessageMany:t?.freemiumColumnCapMessageFew;if(typeof u!="string"||u.trim().length===0)return null;let l=u.split("{n}").join(String(o)).split("{fields}").join(o===1?"field":"fields"),i=Te(n);return i.length===0?l:l+" "+i.join(" ")}function Te(e){if(!e||e.length===0)return[];let t=[],n=new Map,o=new Map;for(let u of e){let l=typeof u?.dateGroupId=="string"?u.dateGroupId.trim():"";if(l!==""&&(n.has(l)||(t.push(l),n.set(l,0)),u.isDatePart===!0&&n.set(l,n.get(l)+1),u.isReassembledDate===!0&&!o.has(l))){let i=typeof u.sourceField=="string"?u.sourceField.trim():"",C=typeof u.name=="string"?u.name.trim():"",b=i!==""?i:C;b!==""&&o.set(l,b)}}let a=[];for(let u of t){let l=o.get(u),i=n.get(u)??0;!l||i===0||a.push(`'${l}' is a date hierarchy and counts as ${i+1} fields - bind the date itself instead of its hierarchy.`)}return a}var m=e=>e==null?"":String(e),v=e=>e===!0,Se=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return null},pr=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function Re(e,t){let n={};for(let[o,a]of pr){let u=m(E(e,t+a));u&&(n[o]=u)}return n}function gr(e){return Array.isArray(e)?e.map(t=>({code:m(E(t,"code")),severity:m(E(t,"severity")),text:m(E(t,"text"))})).filter(t=>t.text!==""):[]}function yr(e){let t=b=>E(e,b),n=t("retryAfterSeconds"),o=t("overrideThumbnailUpload"),a=t("forceThumbnailUpload"),u=Re(e,"point"),l=Re(e,"destPoint");Object.keys(l).length&&(u.dest=l);let i=t("retryable"),C=t("isPollFinal");return{errorMessage:m(t("errorMessage")),errorCode:m(t("errorCode")),refusalCode:m(t("refusalCode")),retryable:typeof i=="boolean"?i:null,notices:gr(t("notices")),freemiumStatusCode:m(t("freemiumStatusCode")),code:m(t("code")),language:m(t("language")),version:Number(t("version")??0),codeSummary:m(t("codeSummary")),chartName:m(t("chartName")??t("chartType")),finalChartName:m(t("finalChartName")),warningMessage:m(t("warningMessage")),outputHash:m(t("outputHash")),validatorToken:m(t("validatorToken")),editCodeKey:m(t("editCodeKey")),signedLLMRequestID:m(t("signedLLMRequestID")),userReply:m(t("userReply")),userReplyOutcome:m(t("userReplyOutcome")),improvementSuggestion:m(t("improvementSuggestion")),geoColumn:m(t("geoColumn")),geoKind:m(t("geoKind")),geoPointCols:Object.keys(u).length?u:null,creditBalanceBefore:Se(t("creditBalanceBefore")),creditCost:Se(t("creditCost")),isServiceError:v(t("isServiceError")),isRateLimited:v(t("isRateLimited")),suppressSelectionGlyph:v(t("suppressSelectionGlyph")),isRefusal:v(t("isRefusal")),isVersionNotFound:v(t("isVersionNotFound")),isGenerationCancelled:v(t("isGenerationCancelled")),retryAfterSeconds:typeof n=="number"&&Number.isFinite(n)?n:null,servedCorrelationId:m(t("servedCorrelationId")),...typeof C=="boolean"?{isPollFinal:C}:{},...m(t("pollOutcome"))!==""?{pollOutcome:m(t("pollOutcome"))}:{},...typeof o=="boolean"?{overrideThumbnailUpload:o}:{},...typeof a=="boolean"?{forceThumbnailUpload:a}:{}}}var xe=e=>e==null?void 0:Number(e),k=e=>m(e)||void 0;function hr(e){let t=E(e,"charts"),n=E(e,"refused"),o=Array.isArray(t)?t.map(u=>{let l=C=>E(u,C),i=l("recommended");return{name:m(l("chartTypeName")??l("name")),description:m(l("description")??l("chartDesc")),rank:xe(l("rank")),score:xe(l("score")),renderer:k(l("renderer")),language:k(l("language")),isPreview:v(l("isPreview")),alsoWorthALook:v(l("alsoWorthALook")),recommended:typeof i=="boolean"?i:void 0,viaProjection:k(l("viaProjection")),viaProjectionKey:k(l("viaProjectionKey")),detailNote:k(l("detailNote"))}}).filter(u=>u.name):null,a=Array.isArray(n)?n.map(u=>({name:m(E(u,"chartTypeName")??E(u,"name")),reason:m(E(u,"reason")),reasonCode:m(E(u,"reasonCode")),isVeto:v(E(u,"isVeto"))})).filter(u=>u.name):[];return{errorMessage:m(E(e,"errorMessage")),errorCode:m(E(e,"errorCode")),charts:o,refused:a,noFitSummary:m(E(e,"noFitSummary"))}}function Cr(e){return!e||typeof e!="object"?null:{status:String(E(e,"status")??""),verdictReason:E(e,"verdictReason")??null,instruction:E(e,"instruction")??null,fix:E(e,"fix")??null,errorMessage:E(e,"errorMessage")??null,errorCode:E(e,"errorCode")??null}}var we=["working","analyze","generate","refine","review"];function br(e,t){let n=String(e??"").trim().toLowerCase();if(we.includes(n))return n;let o=String(t??"").toLowerCase();return o.includes("analyz")?"analyze":o.includes("generat")?"generate":o.includes("refin")?"refine":o.includes("review")?"review":null}var Er="FREEMIUM_ATTEMPT_SPENT",Tr="CLIENT_SECRET_MISMATCH",Sr="FREEMIUM_COLUMN_CAP",Rr="OAUTH_TOKEN_EXPIRED",xr="OAUTH_SIGNED_OUT";function wr(e){let t=e?.retryable;return typeof t=="boolean"?t:null}function _r(e){let t=e.linkNonce?(e.linkNonce()??"").trim():null,n=t?null:e.accessToken?(e.accessToken()??"").trim():null,o=t||n?{licensee:"",licenseKey:"",secretKey:""}:e.triple();return{request:{licenseKey:o.licenseKey,licensee:o.licensee,secretKey:o.secretKey,freemiumKey:e.freemiumKey?.()??""},linkNonce:t,accessToken:n}}function Or(e){let{width:t,height:n}=e.measure();return{request:{height:n,width:t},hints:{viewportWidth:t,viewportHeight:n}}}function vr(e){let t=0;for(let n of e){if(n.isMeasure)continue;let o=n.distinctCount;typeof o=="number"&&o>t&&(t=o)}return t}function _e(e){if(e.recoveryFetchByCorrelation)return{version:null,fetchOnly:!0};if(e.recoveryFetchVersion!=null)return{version:e.recoveryFetchVersion,fetchOnly:!0};let t=e.settingVersion??null;if(e.genNew)return{version:t,fetchOnly:void 0};let n=(t??0)>0?t:null,o=(e.codeVersion??0)>0?e.codeVersion:null,a=n??o??t;return{version:a,fetchOnly:a!=null&&a>0?!0:void 0}}function Pr(e){let t=e.fetchCorrelationId!=null,o=t||e.recoveryFetchVersion!=null?!1:e.genNew,a=_e({genNew:o,recoveryFetchVersion:e.recoveryFetchVersion,recoveryFetchByCorrelation:t,settingVersion:e.settingVersion,codeVersion:e.codeVersion}),u=e.fetchArmedAtMs,l=t&&typeof u=="number"&&Number.isSafeInteger(u)&&u>0?u:void 0;return{genNew:o,version:a.version,fetchOnly:a.fetchOnly,fetchCorrelationId:e.fetchCorrelationId??void 0,...l!==void 0?{fetchArmedAtMs:l}:{}}}function Lr(e){let t=n=>e.renderers.has(n);return{supportsD3:t("D3"),supportsPlotly:t("PLOTLY"),supportsVega:t("VEGA")}}function Ar(e){let t=e.cap!=null&&e.budget>e.cap?e.cap:e.budget;return{triesLeft:e.triesLeft??t,maxTries:t}}function Mr(e){return e&&e>0?{leafCardinality:Math.round(e)}:{}}function Ir(e,t,n){let o=a=>typeof a=="number"&&Number.isInteger(a)&&a>0;return{...typeof e=="boolean"?{dataComplete:e}:{},...o(t)?{rowsWithheld:t}:{},...o(n)?{rowsFilteredOut:n}:{}}}var Nr={fit:"Best fit",variety:"Something different"};function Oe(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return t==="fit"||t==="variety"?t:null}function Fr(e){let t=Oe(e);return t?{qualifyOrder:t}:{}}function ve(e,t){return e!=null&&t!=null&&e!==t}function Dr(e,t){return e?ve(t.capturedFor,t.now)?{shortlist:void 0,stale:!0}:{shortlist:{...e,ageMs:t.atMs>0?Math.max(0,Math.round(t.nowMs-t.atMs)):void 0},stale:!1}:{shortlist:void 0,stale:!1}}var kr=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function Pe(e){let t=String(e??"").trim().toLowerCase();return kr[t]??t}function Le(e){let t="";for(let n of e)t+=JSON.stringify([String(n.name??""),n.isMeasure?"M":"D",Pe(n.dataType)]);return t}function Gr(e){return j(Le(e))}var Vr=2,Ur=3,Wr=4,qr=64,$r=8e3,zr=6e4,Hr=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict",REDRAW:"redraw",INTERACT:"interact"}),Kr=Object.freeze(["open","generate","version","rebind","data","sample","fix","resize","other"]);function Br(e,t){return t?`${t};draw:${e}`:`draw:${e}`}function jr(e){return e.hint?e.hint:e.generated?"generate":e.previous?e.outputHash!==e.previous.outputHash?"version":e.dataSignature!==e.previous.dataSignature?"data":e.viewport!==e.previous.viewport?"resize":"other":"open"}function Yr(){let e=new Set,t=new Set;return{firstDraw(n,o){if(!n)return!1;let a=`${n}|${o}`;return e.has(a)?!1:(e.add(a),!0)},firstInteract(n){return!n||t.has(n)?!1:(t.add(n),!0)}}}function Qr(e){return!!e&&!e.includes("|")&&!e.includes(",")}function se(e,t,n,o){let a=`${e},${t}|${n}`;return o?`${a}|${Math.max(0,Math.round(o.count))}|${o.nonce}`:a}function Xr(e,t){let n=e;if(!n||!n.signer||typeof n.signer.sign!="function")throw new TypeError("createTelemetryClient needs the host's signer");if(!n.transport||typeof n.transport.post!="function")throw new TypeError("createTelemetryClient needs the host's transport");if(!n.clock||typeof n.clock.now!="function")throw new TypeError("createTelemetryClient needs the host's clock");if(!t||typeof t.baseUrl!="string"&&typeof t.baseUrl!="function")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof t.baseUrl=="string"&&t.baseUrl==="")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof t.clientVersion!="string"||t.clientVersion==="")throw new TypeError("createTelemetryClient needs the client version");if(typeof t.timeoutMs!="number"||!Number.isFinite(t.timeoutMs)||t.timeoutMs<=0)throw new TypeError("createTelemetryClient needs a positive deadline in milliseconds");let{signer:o,transport:a,clock:u}=n,l=t.apiPath??"/api",i=t.timeoutMs,C=()=>typeof t.baseUrl=="function"?t.baseUrl():t.baseUrl,b=g=>{try{t.onFailure?.(g)}catch{}},h=async(g,f,c,p)=>{let y;try{let T=await a.post(f,c,p,{timeoutMs:i});y=T.status;try{T.body?.cancel().catch(()=>{})}catch{}}catch(T){b({channel:g,stage:"post",status:null,error:T});return}(y<200||y>299)&&b({channel:g,stage:"status",status:y,error:null})};return{async sendClientMessage(g){let f,c,p;try{f=`${C()}${l}/LogClientMsg/?nocache=${u.now()}`,c=I(g),p=D(c,o)}catch(y){b({channel:"client-message",stage:"build",status:null,error:y});return}await h("client-message",f,c,{"Content-Type":"text/plain","X-Signature":p})},async countEvent(g,f,c){let p,y;try{p=`${C()}${l}/eventlog`,y=se(g,t.clientVersion,f,c)}catch(T){b({channel:"event-count",stage:"build",status:null,error:T});return}await h("event-count",p,y,{"Content-Type":"text/plain"})}}}var Ae=2**31-1;function Me(e){return Object.assign(new Error(`The request did not finish within ${e} ms.`),{name:"TimeoutError"})}function Jr(e){return typeof e=="number"&&e>0&&e<=Ae?null:new RangeError(`fetchTransport cannot keep a deadline of ${String(e)} ms: it must be a number of milliseconds above 0 and at most ${Ae} (about 24.8 days), the longest a timer can wait. Nothing was sent.`)}function Zr(e,t={}){if(typeof e!="function")throw new TypeError("fetchTransport needs the host's fetch");let n=e,o=t.credentials??"omit";return{async post(a,u,l,i){let C=i.timeoutMs,b=Jr(C);if(b)throw b;let h=new AbortController,g=!1,f=setTimeout(()=>{g=!0,h.abort(Me(C))},C),c=()=>h.abort(i.signal?.reason);i.signal&&(i.signal.aborted?c():i.signal.addEventListener("abort",c,{once:!0}));let p=!1,y=()=>{p||(p=!0,clearTimeout(f),i.signal?.removeEventListener("abort",c))},T=_=>g?Me(C):_,L;try{L=await n(a,{method:"POST",body:u,headers:l,credentials:o,signal:h.signal})}catch(_){throw y(),T(_)}let R=X(L),A=R.statusText!==void 0?{statusText:R.statusText}:{};if(!R.body)return{status:R.status,...A,contentType:R.contentType,body:null,text:async()=>{try{return await R.text()}catch(_){throw T(_)}finally{y()}}};let x=R.body.getReader(),w=new ReadableStream({async pull(_){try{let s=await x.read();if(s.done){y(),_.close();return}_.enqueue(s.value)}catch(s){y(),_.error(T(s))}},cancel(_){return y(),x.cancel(_)}});return{status:R.status,...A,contentType:R.contentType,body:w,text:()=>new Response(w).text()}}}}var Ie=300;function Ne(e){return String(e??"").toLowerCase().replace(/[^a-z0-9-]/g,"").slice(0,40)}var eo="/LLMChart/",to="/LLMChart/qualify",no="/VisionReview/",ro="/LLMChart/sample",oo="/RefundGenerate/",io=e=>!!e&&typeof e=="object"&&e.name==="TimeoutError",H=async e=>JSON.parse(await e.text());function so(e){try{e.body?e.body.cancel().catch(()=>{}):e.text().catch(()=>{})}catch{}}function ao(e,t){let n=e;if(!n||!n.signer||typeof n.signer.sign!="function")throw new TypeError("createGenerateClient needs the host's signer");if(!n.transport||typeof n.transport.post!="function")throw new TypeError("createGenerateClient needs the host's transport");if(!n.clock||typeof n.clock.now!="function")throw new TypeError("createGenerateClient needs the host's clock");if(!t||typeof t.baseUrl!="string"&&typeof t.baseUrl!="function")throw new TypeError("createGenerateClient needs the service's base URL");if(typeof t.baseUrl=="string"&&t.baseUrl==="")throw new TypeError("createGenerateClient needs the service's base URL");if(t.apiPath!==void 0&&typeof t.apiPath!="string")throw new TypeError("createGenerateClient's apiPath must be a string");if(t.nocache!==void 0&&t.nocache!==null&&typeof t.nocache!="function")throw new TypeError("createGenerateClient's nocache must be a function");let{signer:o,transport:a,clock:u}=n,l=t.apiPath??"/api",i=()=>typeof t.baseUrl=="function"?t.baseUrl():t.baseUrl,C=g=>t.nocache?t.nocache(g):String(u.now());async function b(g,f,c,p,y){let T=`${i()}${l}${f}?nocache=${C(g)}`,L={"Content-Type":"text/plain","X-Signature":D(c,o)},R=p.signal??void 0,A=(w,_)=>{let s=!!R?.aborted;return{kind:"transport",headersReceived:w,timedOut:!s&&io(_),cancelled:s,error:_}},x;try{x=await a.post(T,c,L,R?{timeoutMs:p.timeoutMs,signal:R}:{timeoutMs:p.timeoutMs})}catch(w){return A(!1,w)}if(x.status<200||x.status>299){let w="";if(p.readErrorBody===!1)so(x);else try{w=(await x.text()).slice(0,Ie)}catch{}return{kind:"http",status:x.status,statusText:x.statusText??"",bodyStart:w}}try{return{kind:"answer",status:x.status,value:await y(x)}}catch(w){return A(!0,w)}}function h(g,f){if(!f||typeof f.timeoutMs!="number"||!Number.isFinite(f.timeoutMs)||f.timeoutMs<=0)throw new TypeError(`The ${g} call needs a positive deadline in milliseconds`);return f}return{async generate(g,f){let c=h("generate",f),p=c.onStage??void 0;return b("generate",eo,I(g),c,y=>J(y,p))},async qualify(g,f){let c=h("qualify",f),p=c.route??to;if(typeof p!="string"||!p.startsWith("/"))throw new TypeError("The qualify route must start with '/'");return b("qualify",p,I(g),c,H)},async review(g,f){let c=h("review",f),p=JSON.stringify(g);if(typeof p!="string")throw new TypeError("The review wire did not serialize to JSON");return b("review",no,p,c,H)},async sample(g,f){let c=h("sample",f);return b("sample",ro,I(g),c,H)},async refund(g,f,c){let p=h("refund",f);if(typeof g!="string"||g.trim()==="")throw new TypeError("A refund needs the generation's correlation id");let y=Ne(c),T=y?{CorrelationID:g.trim(),Reason:y}:{CorrelationID:g.trim()};return b("refund",oo,JSON.stringify(T),p,H)}}}export{Y as CITY_ROLE_MATCH_PCT,Hr as CLIENT_EVENT_KINDS,Tr as CLIENT_SECRET_MISMATCH,je as COMPOUND_MIN_STEM,ht as CYCLE_MEMBERS,bt as CYCLE_WORDS,ge as DATE_LEVEL_GREGORIAN_YEAR_MAX,pe as DATE_LEVEL_GREGORIAN_YEAR_MIN,ir as DATE_LEVEL_LANGUAGES,ie as DATE_LEVEL_NAMES,fe as DATE_LEVEL_NON_GREGORIAN_LANGUAGES,Ln as DEFAULT_GAP_FACTOR,it as DEFAULT_TEMPERATURE,Kr as DRAW_REASONS,Er as FREEMIUM_ATTEMPT_SPENT,Sr as FREEMIUM_COLUMN_CAP,rt as GET_RANDOM,Qe as GLUED_STEM_MIN,Je as HANGUL_MIN_STEM,be as HOST_SYNTHETIC_COLUMNS,Ie as HTTP_BODY_START_CHARS,xn as IDENTIFIER_HEAD_INITIAL,wn as IDENTIFIER_UNFOLDED,Rn as IDENTIFIER_WORDS,ln as INTENSIVE_SUFFIX_TOKENS,an as INTENSIVE_WORD_TOKENS,Bn as IndexedText,Lt as LOOSE_KEY_MIN_LENGTH,Mt as LooseIndex,An as MAX_RUN_BOUNDS,xr as OAUTH_SIGNED_OUT,Rr as OAUTH_TOKEN_EXPIRED,xt as PERIOD_CODE_FORMS,Rt as PERIOD_CODE_MEMBERS,wt as PERIOD_ORDINALS,_t as PERIOD_UNFOLDED,cn as POSITIONAL_SUFFIX_TOKENS,un as POSITIONAL_WORD_TOKENS,Xn as PREVIEW_OMITTED_FIELDS,we as PROGRESS_STAGE_IDS,Nr as QUALIFY_ORDER_LABELS,M as ROLE_MATCH_PCT,Nn as SERIES_COMPLETENESS_MAX_LISTED,Fn as SERIES_COMPLETENESS_MIN_FILL,Dn as SERIES_KEY_MAX_DISTINCT,Wr as SEV_ERROR,Vr as SEV_INFO,qr as SEV_USER_PRESENTED,Ur as SEV_WARNING,j as SIMPLE_STRING_HASH,nt as STR,et as SUBSTRING_MIN,De as SUPPORTED_LANGUAGES,ke as SUPPORTED_LANGUAGE_CODES,zr as TELEMETRY_TIMEOUT_DEV_MS,$r as TELEMETRY_TIMEOUT_MS,Ue as VOCABULARY_LANGUAGE_CODES,Ve as VOCABULARY_ONLY_LANGUAGES,Ct as YEAR_WORDS,$ as admin1MatchPct,bn as allowedAggregations,gt as anchorLocalWallClockDates,wr as answerIsRetryable,Yt as buildGeoIsoColumn,$t as buildGeoPointColumns,Et as calendarWordIn,Lr as capabilityFields,Ht as cityMatchPct,zt as cityTagsFor,zn as classifyAdditivity,jr as classifyDraw,Cn as classifyForAggregation,Hn as classifyNumericValueNature,qn as classifyTemporal,pn as codeNeedsLegacyAggNames,On as codeReadsColumn,vn as codeReadsColumnsByRoleOrPosition,fn as collapseRepeatedAggPrefix,Pn as columnsTheCodeReads,Jt as countryRegion,Yr as createDrawLedger,ao as createGenerateClient,Xr as createTelemetryClient,_r as credentialFields,Ir as dataCompletenessFields,ar as dateLevelPart,lr as dateLevelYearAdmits,yt as datesAreTimeOfDayOnly,ft as datesCarryTimeOfDay,tn as decimalSeparatorOf,En as defaultAggregation,nn as detectDecimalSeparator,en as detectFormatSignature,Kt as detectGeo,Ft as detectOrdinalDomain,Wn as detectTextDatePattern,Br as drawLocation,I as encodePayload,jn as engineTypeForSqlType,gn as englishImplicitAggNames,se as eventLogLine,Pr as fetchFields,Zr as fetchTransport,qe as foldName,fr as freemiumColumnCapRefusal,Ee as freemiumColumnsOverCap,Te as freemiumDateHierarchyClauses,Xe as gluedPrefixStems,mr as guardColumnNames,Zn as gzipWireText,Ze as hangulWordEndsWith,mn as hasDefaultAggPrefix,Ke as hasUnsegmentedScript,$n as hostAggHint,Qn as ingest,Tn as isAggregationAllowed,V as isBlankLike,kt as isCityTableLoaded,z as isColumnContextRef,ot as isDeterministicRefusal,Qr as isEventLogCode,Wt as isGeoPointAmbiguity,Un as isIdentifierName,jt as isJoinGeoKind,tr as isNdjsonContentType,It as isOrdinalFriendlyName,At as isUsableLooseKey,er as keyedSigner,Mr as leafCardinalityField,ct as localMidnightDateColumns,ut as localMidnightToUtcDay,pt as localWallClockDateColumns,St as localizedCycleIn,_n as localizedIdentifierWordIn,Tt as localizedYearWordIn,N as looksLikeCountryColumn,Pt as looseNameKey,tt as matchNameToken,vr as maxNonMeasureCardinality,In as measureCadence,Vn as measureSeriesCompleteness,D as messageSignature,dr as missingHardColumnRefs,sn as monthLookupFor,ze as nameLetterRuns,hn as nameLooksIntensiveRate,yn as nameLooksPositional,he as nameProbeIsGuarded,cr as nameProbeKeepsDrawing,$e as nameWords,Gt as normalizeCountry,dt as normalizeLocalMidnightDates,on as normalizeMonthKey,U as normalizePlaceName,Ut as normalizeZip5,Dr as offeredShortlistFor,Yn as parseCsvRows,st as parseDateStable,yr as parseGenerateResponse,rn as parseNumberText,hr as parseQualifyResponse,Cr as parseReviewVerdict,Mn as parseTemporalPoint,Jn as payloadPreview,vt as periodCodeSeries,Gn as pickSeriesColumn,br as progressStageOf,Kn as promotesToMeasure,Fr as qualifyOrderField,Oe as qualifyOrderOf,J as readGenerateStream,He as readName,Ot as readPeriodCode,E as readWireField,Ne as refundReasonCode,Dt as registerCityTable,Xt as registerIso3Regions,P as resolveAdmin1,_e as resolveFetchVersion,qt as resolveGeoPoint,We as resolveLanguage,or as resolvePointRoles,Ar as retryFields,Nt as safeDistinctValuesToShip,Le as schemaIdentity,Gr as schemaIdentityKey,Pe as schemaTypeFamily,kn as seriesKeyVerdict,Sn as shareOfTotalIsHonest,ve as shortlistIsStale,dn as stripHostAggPrefix,Zt as summarizeCountryRegions,Qt as summarizeGeoExtent,Ge as supportedLanguage,Bt as toGeoIso,Be as unsegmentedRuns,mt as utcWallClock,Or as viewportFields,B as vocabularyLanguage,at as wholeDayFrame,lt as wholeDayIso,X as wireResponseFromFetch,Ye as wordEndsWith,re as zipMatchPct,q as zipPrefixCandidates,Vt as zipToPrefix3};
2
+ import{a as Jn,b as Zn}from"./chunk-HIVICMC5.mjs";import{a as er,b as I,c as tr,d as D,e as E,f as nr,g as X,h as J}from"./chunk-4J7WPYLM.mjs";import{a as Yn,b as Qn,c as Xn}from"./chunk-YVP6AMZB.mjs";import{A as Pn,B as vn,C as Ln,D as An,E as Mn,F as In,G as Nn,H as Fn,I as Dn,J as kn,K as Gn,L as Vn,M as Un,N as Wn,O as qn,P as $n,Q as zn,R as Hn,S as Kn,T as Bn,V as jn,a as Qt,b as Xt,c as Jt,d as Zt,f as an,g as ln,h as un,i as cn,j as dn,k as mn,l as fn,m as pn,n as gn,o as yn,p as hn,q as Cn,r as bn,s as En,t as Tn,u as Sn,v as Rn,w as xn,x as wn,y as _n,z as On}from"./chunk-CQS6BGRJ.mjs";import{a as en}from"./chunk-U3H6UBOO.mjs";import{b as tn,c as nn,d as rn,f as on,g as sn}from"./chunk-A4PQBWRA.mjs";import{a as le,b as ue,c as Kt,d as Bt,e as jt,f as Yt}from"./chunk-IPPPCWAK.mjs";import{a as M,b as V,c as Y,d as U,k as W,l as Dt,m as kt,n as ae,o as v,p as Gt,q as Vt,r as Ut,s as q,t as Wt,u as qt,v as $t,w as zt,x as Q,y as Ht}from"./chunk-INMDBTAR.mjs";import"./chunk-5MRZID36.mjs";import{a as ht,b as Ct,c as bt,d as Et,e as Tt,f as St,g as Rt,h as xt,i as wt,j as _t,k as Ot,l as Pt,m as It,n as Nt,o as Ft}from"./chunk-HJA26Z2E.mjs";import{A as mt,B as ft,C as pt,D as gt,E as yt,a as qe,b as $e,c as ze,d as He,e as Ke,f as Be,g as je,h as Ye,i as Qe,j as Xe,k as Je,l as Ze,m as et,n as tt,o as nt,q as j,r as rt,s as ot,t as it,u as st,v as at,w as lt,x as ut,y as ct,z as dt}from"./chunk-CZJ7M6A5.mjs";import{a as De,b as ke,c as Ge,d as Ve,e as Ue,f as B,g as We}from"./chunk-WC4JINEZ.mjs";import{b as vt,c as Lt,d as At,e as Mt}from"./chunk-5HI6TVMM.mjs";var Z=2,me=400;function te(e){return!!W(e)}function F(e){let t=new Set;for(let n of e){if(n==null)continue;let o=U(String(n));if(!V(o)&&!t.has(o)&&(t.add(o),t.size>=me))break}return Array.from(t)}function N(e){let t=F(e);if(t.length===0||ne(e)<95)return!1;let n=t.filter(a=>te(a)&&!v(a)).length,o=t.filter(a=>!te(a)&&!!v(a)).length;return n>=1&&n>=o}function ce(e,t){if(!v(e))return!1;let n=W(e);return n?t==="world"?!0:ae.has(n):!1}function ne(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let o of t)te(o)&&n++;return Math.round(n/t.length*1e3)/10}function $(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let o of t)v(o)&&n++;return Math.round(n/t.length*1e3)/10}function oe(e){let t=new Set;for(let n of e){if(n==null)continue;let o=String(n).trim();if(!V(U(o))&&!t.has(o)&&(t.add(o),t.size>=me))break}return Array.from(t)}function re(e){let t=oe(e);if(t.length===0)return 0;let n=0;for(let o of t)q(o).length>0&&n++;return Math.round(n/t.length*1e3)/10}function de(e,t){return ue(t,le)?!0:oe(e).some(n=>/^\d{5}(-\d{4})?$/.test(n.replace(/\.0+$/,"")))}function rr(e,t){let n=F(e);if(n.length===0)return 0;let o=0;for(let a of n)Q(a,t)&&o++;return Math.round(o/n.length*1e3)/10}function ee(e,t){let n=0;for(let o of F(e))t(o)&&n++;return n}function or(e,t){let n=0;for(let o of oe(e))t(o)&&n++;return n}function ir(e,t,n,o,a){let u=[],l=[],i={},C={},b=new Set(e),h=s=>t.map(d=>d[s]);for(let s of["city","country"]){let d=n?.[s];d&&b.has(d)&&(i[s]=d)}let g=new Set(a??e);for(let s of["lat","lon"]){let d=n?.[s];d&&g.has(d)&&(i[s]=d)}let f=n?.zip;if(f&&b.has(f)){let s=h(f),d=re(s);d<95?l.push(`zip=${f} (only ${d}% of values read as ZIPs)`):de(s,f)?i.zip=f:l.push(`zip=${f} (all values are 3-4 digits with nothing to say they are postal)`)}let c=n?.state;if(c&&b.has(c)){let s=h(c),d=F(s);d.length>0&&d.every(S=>ce(S,o))?l.push(`state=${c} (every value is "CA", which is both Canada and California)`):N(s)?(l.push(`state=${c} (every value is a country, not a state)`),i.country||(i.country=c)):$(s)<95?l.push(`state=${c} (only ${$(s)}% of values are states/provinces)`):i.state=c}let p=new Set(Object.values(i).filter(Boolean)),y=e.filter(s=>!p.has(s)&&!s.startsWith("__"));if(!i.state){let s=null;for(let d of y){let S=h(d);if(N(S))continue;let O=$(S);if(O<95)continue;let K=ee(S,G=>!!v(G)),Fe=ee(S,G=>!!v(G)&&!ce(G,o));K<Z&&Fe<1||(!s||O>s.pct)&&(s={name:d,pct:O})}s&&(i.state=s.name,p.add(s.name),u.push(`state=${s.name} (${s.pct}% states/provinces)`))}if(!i.zip)for(let s of y){if(p.has(s))continue;let d=h(s),S=re(d);if(!(S<95)&&de(d,s)&&!(or(d,O=>q(O).length>0)<Z)){i.zip=s,p.add(s),u.push(`zip=${s} (${S}% ZIP codes)`);break}}let T=i.country;if(!T||!N(h(T))){let s=null;for(let d of y){if(p.has(d)||!N(h(d)))continue;let S=ne(h(d));(!s||S>s.pct)&&(s={name:d,pct:S})}s&&(T&&(l.push(`country=${T} (only ${ne(h(T))}% of values are country identifiers; using ${s.name} instead)`),C.country=T),i.country=s.name,p.add(s.name),u.push(`country=${s.name}`))}if(!i.city){let s=null;for(let d of y){if(p.has(d))continue;let S=h(d),O=rr(S,o);O<Y||ee(S,K=>Q(K,o))<Z||(!s||O>s.pct)&&(s={name:d,pct:O})}s&&(i.city=s.name,u.push(`city=${s.name} (${s.pct}% known cities)`))}let L=i.country?h(i.country):[],R=!!i.country&&N(L),A=R?new Set(L.map(s=>W(s==null?null:String(s))).filter(Boolean)).size:0,x=R&&A>=2,w=!!(i.lat&&i.lon)&&t.some(s=>{let d=+String(s[i.lat]??"").trim(),S=+String(s[i.lon]??"").trim();return isFinite(d)&&isFinite(S)&&d>=-90&&d<=90&&S>=-180&&S<=180&&String(s[i.lat]??"").trim()!==""&&String(s[i.lon]??"").trim()!==""});return i.lat&&i.lon&&!w&&l.push(`lat/lon=${i.lat}/${i.lon} (no row holds a usable coordinate pair)`),i.country&&!x&&!(i.city||i.state||i.zip||w)&&l.push(R?`country=${i.country} (every row resolves to the same country - nothing to place apart)`:`country=${i.country} (values are not country identifiers)`),{bind:!!(i.city||i.state||i.zip||x||w)?i:null,backfilled:u,refused:l,...Object.keys(C).length?{labelFallback:C}:{}}}var r=(e,...t)=>({part:e,langs:Object.freeze(t)}),ie=Object.freeze({jaar:r("year","nl"),kwartaal:r("quarter","nl"),maand:r("month","nl"),dag:r("day","nl","sv","da","nb"),jahr:r("year","de"),quartal:r("quarter","de"),monat:r("month","de"),tag:r("day","de"),ann\u00E9e:r("year","fr"),mois:r("month","fr"),jour:r("day","fr"),trimestre:r("quarter","fr","es","pt","it"),a\u00F1o:r("year","es"),mes:r("month","es"),d\u00EDa:r("day","es"),ano:r("year","pt"),m\u00EAs:r("month","pt"),dia:r("day","pt"),anno:r("year","it"),mese:r("month","it"),giorno:r("day","it"),\u0433\u043E\u0434:r("year","ru"),\u043C\u0435\u0441\u044F\u0446:r("month","ru"),\u0440\u0456\u043A:r("year","uk"),\u043C\u0456\u0441\u044F\u0446\u044C:r("month","uk"),\u043A\u0432\u0430\u0440\u0442\u0430\u043B:r("quarter","ru","uk"),\u0434\u0435\u043D\u044C:r("day","ru","uk"),rok:r("year","pl","cs","sk"),kwarta\u0142:r("quarter","pl"),miesi\u0105c:r("month","pl"),dzie\u0144:r("day","pl"),\u010Dtvrtlet\u00ED:r("quarter","cs"),m\u011Bs\u00EDc:r("month","cs"),den:r("day","cs"),\u0161tvr\u0165rok:r("quarter","sk"),mesiac:r("month","sk"),de\u0148:r("day","sk"),\u00E5r:r("year","sv","da","nb"),kvartal:r("quarter","sv","da","nb"),m\u00E5nad:r("month","sv"),m\u00E5ned:r("month","da","nb"),vuosi:r("year","fi"),vuosinelj\u00E4nnes:r("quarter","fi"),kuukausi:r("month","fi"),p\u00E4iv\u00E4:r("day","fi"),\u00E9v:r("year","hu"),negyed\u00E9v:r("quarter","hu"),h\u00F3nap:r("month","hu"),nap:r("day","hu"),y\u0131l:r("year","tr"),\u00E7eyrek:r("quarter","tr"),ay:r("month","tr"),g\u00FCn:r("day","tr"),\u03AD\u03C4\u03BF\u03C2:r("year","el"),\u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF:r("quarter","el"),\u03BC\u03AE\u03BD\u03B1\u03C2:r("month","el"),\u03B7\u03BC\u03AD\u03C1\u03B1:r("day","el"),an:r("year","ro"),trimestru:r("quarter","ro"),lun\u0103:r("month","ro"),zi:r("day","ro"),godina:r("year","hr"),tromjese\u010Dje:r("quarter","hr"),mjesec:r("month","hr"),dan:r("day","hr"),\u5E74:r("year","ja","zh"),\u56DB\u534A\u671F:r("quarter","ja"),\u5B63\u5EA6:r("quarter","zh"),\u6708:r("month","ja","zh"),\u65E5:r("day","ja","zh"),\uC5F0\uB3C4:r("year","ko"),\uBD84\uAE30:r("quarter","ko"),\uC6D4:r("month","ko"),\uC77C:r("day","ko"),tahun:r("year","id"),kuartal:r("quarter","id"),triwulan:r("quarter","id"),bulan:r("month","id"),hari:r("day","id"),n\u0103m:r("year","vi"),qu\u00FD:r("quarter","vi"),th\u00E1ng:r("month","vi"),ng\u00E0y:r("day","vi"),\u0E1B\u0E35:r("year","th"),\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A:r("quarter","th"),\u0E40\u0E14\u0E37\u0E2D\u0E19:r("month","th"),\u0E27\u0E31\u0E19:r("day","th"),\u0627\u0644\u0633\u0646\u0629:r("year","ar"),\u0633\u0646\u0629:r("year","ar"),\u0627\u0644\u0639\u0627\u0645:r("year","ar"),\u0639\u0627\u0645:r("year","ar"),\u0627\u0644\u0631\u0628\u0639:r("quarter","ar"),\u0631\u0628\u0639:r("quarter","ar"),"\u0631\u0628\u0639 \u0627\u0644\u0633\u0646\u0629":r("quarter","ar"),\u0627\u0644\u0634\u0647\u0631:r("month","ar"),\u0634\u0647\u0631:r("month","ar"),\u0627\u0644\u064A\u0648\u0645:r("day","ar"),\u064A\u0648\u0645:r("day","ar"),\u05E9\u05E0\u05D4:r("year","he"),\u05E8\u05D1\u05E2\u05D5\u05DF:r("quarter","he"),\u05D7\u05D5\u05D3\u05E9:r("month","he"),\u05D9\u05D5\u05DD:r("day","he"),\u0935\u0930\u094D\u0937:r("year","hi"),\u0938\u093E\u0932:r("year","hi"),\u0924\u093F\u092E\u093E\u0939\u0940:r("quarter","hi"),\u092E\u0939\u0940\u0928\u093E:r("month","hi"),\u092E\u093E\u0939:r("month","hi"),\u0926\u093F\u0928:r("day","hi"),\u0633\u0627\u0644:r("year","fa"),\u0645\u0627\u0647:r("month","fa"),\u0631\u0648\u0632:r("day","fa")}),sr=Object.freeze(Array.from(new Set(Object.values(ie).flatMap(e=>e.langs)))),fe=Object.freeze(["fa","ar","he","th"]),pe=1900,ge=2100;function ar(e,t){let n=[],o=B(t);try{o&&n.push(e.toLocaleLowerCase(o.intl))}catch{}let a=e.toLowerCase();return n.includes(a)||n.push(a),n}function lr(e,t){let n=String(e??"").trim().normalize("NFC");if(!n)return null;for(let o of ar(n,t)){let a=ie[o];if(a&&a.langs.includes(t))return a.part}return null}function ur(e,t){return fe.includes(e)?typeof t=="number"&&Number.isFinite(t)&&t>=pe&&t<=ge:!0}function ye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var cr=/\b(?:columns|cols|column)\b/i;function z(e,t){let n=Math.max(0,t-240),o=e.slice(n,t),a=o.lastIndexOf(";");return a>=0&&(o=o.slice(a+1)),cr.test(o)}function he(e,t){return Ce(e,t,n=>new RegExp(String.raw`\b${n}\s*(?:>=\s*0|>\s*-1|[!=]==?\s*-1)`).test(e))}function Ce(e,t,n){let o=ye(t),a=new RegExp(String.raw`(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*?\.name\s*===?\s*(['"])${o}\2`,"g"),u=new RegExp(String.raw`\.name\s*===?\s*(['"])${o}\1`,"g"),l=0,i;for(;(i=u.exec(e))!==null;)z(e,i.index)&&l++;let C=0;for(;(i=a.exec(e))!==null;){let b=i.index+i[0].lastIndexOf(".name");if(!z(e,b))continue;C++;let h=ye(i[1]);if(!n(h))return!1}return C>0&&C===l}function dr(e,t){return Ce(e,t,n=>new RegExp(String.raw`\b${n}\s*(?:>=\s*0|>\s*-1|!==?\s*-1)`).test(e)&&!new RegExp(String.raw`\b${n}\s*===?\s*-1`).test(e))}var be=["__rowIdx__","__geoIso__","__geoLat__","__geoLon__","__geoPrecision__"];function mr(e,t){if(!e)return[];let n=new Set(t);for(let i of be)n.add(i);let o=new Set,a=/\.name\s*===?\s*(['"])([^'"]+)\1/g,u;for(;(u=a.exec(e))!==null;)z(e,u.index)&&o.add(u[2]);if(o.size===0)return[];let l=[];return o.forEach(i=>{n.has(i)||he(e,i)||l.push(i)}),l}function fr(e,t){if(!e)return[];let n=(e.getColumns()||[]).map(o=>o.name);if(!t||typeof e.aliasesForCode!="function")return n;for(let o of e.aliasesForCode(t))n.push(o.alias);return n}function Ee(e,t){let n=t?.freemiumMaxShapeColumns;return typeof n!="number"||!isFinite(n)||n<1?null:!isFinite(e)||e<=n?0:Math.round(e-n)}function pr(e,t,n){let o=Ee(e,t);if(o===null||o<=0)return null;let a=typeof t?.freemiumColumnCapPivot=="number"?t.freemiumColumnCapPivot:4,u=o>a?t?.freemiumColumnCapMessageMany:t?.freemiumColumnCapMessageFew;if(typeof u!="string"||u.trim().length===0)return null;let l=u.split("{n}").join(String(o)).split("{fields}").join(o===1?"field":"fields"),i=Te(n);return i.length===0?l:l+" "+i.join(" ")}function Te(e){if(!e||e.length===0)return[];let t=[],n=new Map,o=new Map;for(let u of e){let l=typeof u?.dateGroupId=="string"?u.dateGroupId.trim():"";if(l!==""&&(n.has(l)||(t.push(l),n.set(l,0)),u.isDatePart===!0&&n.set(l,n.get(l)+1),u.isReassembledDate===!0&&!o.has(l))){let i=typeof u.sourceField=="string"?u.sourceField.trim():"",C=typeof u.name=="string"?u.name.trim():"",b=i!==""?i:C;b!==""&&o.set(l,b)}}let a=[];for(let u of t){let l=o.get(u),i=n.get(u)??0;!l||i===0||a.push(`'${l}' is a date hierarchy and counts as ${i+1} fields - bind the date itself instead of its hierarchy.`)}return a}var m=e=>e==null?"":String(e),P=e=>e===!0,Se=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return null},gr=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function Re(e,t){let n={};for(let[o,a]of gr){let u=m(E(e,t+a));u&&(n[o]=u)}return n}function yr(e){return Array.isArray(e)?e.map(t=>({code:m(E(t,"code")),severity:m(E(t,"severity")),text:m(E(t,"text"))})).filter(t=>t.text!==""):[]}function hr(e){let t=b=>E(e,b),n=t("retryAfterSeconds"),o=t("overrideThumbnailUpload"),a=t("forceThumbnailUpload"),u=Re(e,"point"),l=Re(e,"destPoint");Object.keys(l).length&&(u.dest=l);let i=t("retryable"),C=t("isPollFinal");return{errorMessage:m(t("errorMessage")),errorCode:m(t("errorCode")),refusalCode:m(t("refusalCode")),retryable:typeof i=="boolean"?i:null,notices:yr(t("notices")),freemiumStatusCode:m(t("freemiumStatusCode")),code:m(t("code")),language:m(t("language")),version:Number(t("version")??0),codeSummary:m(t("codeSummary")),chartName:m(t("chartName")??t("chartType")),finalChartName:m(t("finalChartName")),warningMessage:m(t("warningMessage")),outputHash:m(t("outputHash")),validatorToken:m(t("validatorToken")),editCodeKey:m(t("editCodeKey")),signedLLMRequestID:m(t("signedLLMRequestID")),userReply:m(t("userReply")),userReplyOutcome:m(t("userReplyOutcome")),improvementSuggestion:m(t("improvementSuggestion")),geoColumn:m(t("geoColumn")),geoKind:m(t("geoKind")),geoPointCols:Object.keys(u).length?u:null,creditBalanceBefore:Se(t("creditBalanceBefore")),creditCost:Se(t("creditCost")),isServiceError:P(t("isServiceError")),isRateLimited:P(t("isRateLimited")),suppressSelectionGlyph:P(t("suppressSelectionGlyph")),isRefusal:P(t("isRefusal")),isVersionNotFound:P(t("isVersionNotFound")),isGenerationCancelled:P(t("isGenerationCancelled")),retryAfterSeconds:typeof n=="number"&&Number.isFinite(n)?n:null,servedCorrelationId:m(t("servedCorrelationId")),...typeof C=="boolean"?{isPollFinal:C}:{},...m(t("pollOutcome"))!==""?{pollOutcome:m(t("pollOutcome"))}:{},...typeof o=="boolean"?{overrideThumbnailUpload:o}:{},...typeof a=="boolean"?{forceThumbnailUpload:a}:{}}}var xe=e=>e==null?void 0:Number(e),k=e=>m(e)||void 0;function Cr(e){let t=E(e,"charts"),n=E(e,"refused"),o=Array.isArray(t)?t.map(u=>{let l=C=>E(u,C),i=l("recommended");return{name:m(l("chartTypeName")??l("name")),description:m(l("description")??l("chartDesc")),rank:xe(l("rank")),score:xe(l("score")),renderer:k(l("renderer")),language:k(l("language")),isPreview:P(l("isPreview")),alsoWorthALook:P(l("alsoWorthALook")),recommended:typeof i=="boolean"?i:void 0,viaProjection:k(l("viaProjection")),viaProjectionKey:k(l("viaProjectionKey")),detailNote:k(l("detailNote"))}}).filter(u=>u.name):null,a=Array.isArray(n)?n.map(u=>({name:m(E(u,"chartTypeName")??E(u,"name")),reason:m(E(u,"reason")),reasonCode:m(E(u,"reasonCode")),isVeto:P(E(u,"isVeto"))})).filter(u=>u.name):[];return{errorMessage:m(E(e,"errorMessage")),errorCode:m(E(e,"errorCode")),charts:o,refused:a,noFitSummary:m(E(e,"noFitSummary"))}}function br(e){return!e||typeof e!="object"?null:{status:String(E(e,"status")??""),verdictReason:E(e,"verdictReason")??null,instruction:E(e,"instruction")??null,fix:E(e,"fix")??null,errorMessage:E(e,"errorMessage")??null,errorCode:E(e,"errorCode")??null}}var we=["working","analyze","generate","refine","review"];function Er(e,t){let n=String(e??"").trim().toLowerCase();if(we.includes(n))return n;let o=String(t??"").toLowerCase();return o.includes("analyz")?"analyze":o.includes("generat")?"generate":o.includes("refin")?"refine":o.includes("review")?"review":null}var Tr="FREEMIUM_ATTEMPT_SPENT",Sr="CLIENT_SECRET_MISMATCH",Rr="FREEMIUM_COLUMN_CAP",xr="OAUTH_TOKEN_EXPIRED",wr="OAUTH_SIGNED_OUT";function _r(e){let t=e?.retryable;return typeof t=="boolean"?t:null}function Or(e){let t=e.linkNonce?(e.linkNonce()??"").trim():null,n=t?null:e.accessToken?(e.accessToken()??"").trim():null,o=t||n?{licensee:"",licenseKey:"",secretKey:""}:e.triple();return{request:{licenseKey:o.licenseKey,licensee:o.licensee,secretKey:o.secretKey,freemiumKey:e.freemiumKey?.()??""},linkNonce:t,accessToken:n}}function Pr(e){let{width:t,height:n}=e.measure();return{request:{height:n,width:t},hints:{viewportWidth:t,viewportHeight:n}}}function vr(e){let t=0;for(let n of e){if(n.isMeasure)continue;let o=n.distinctCount;typeof o=="number"&&o>t&&(t=o)}return t}function _e(e){if(e.recoveryFetchByCorrelation)return{version:null,fetchOnly:!0};if(e.recoveryFetchVersion!=null)return{version:e.recoveryFetchVersion,fetchOnly:!0};let t=e.settingVersion??null;if(e.genNew)return{version:t,fetchOnly:void 0};let n=(t??0)>0?t:null,o=(e.codeVersion??0)>0?e.codeVersion:null,a=n??o??t;return{version:a,fetchOnly:a!=null&&a>0?!0:void 0}}function Lr(e){let t=e.fetchCorrelationId!=null,o=t||e.recoveryFetchVersion!=null?!1:e.genNew,a=_e({genNew:o,recoveryFetchVersion:e.recoveryFetchVersion,recoveryFetchByCorrelation:t,settingVersion:e.settingVersion,codeVersion:e.codeVersion}),u=e.fetchArmedAtMs,l=t&&typeof u=="number"&&Number.isSafeInteger(u)&&u>0?u:void 0;return{genNew:o,version:a.version,fetchOnly:a.fetchOnly,fetchCorrelationId:e.fetchCorrelationId??void 0,...l!==void 0?{fetchArmedAtMs:l}:{}}}function Ar(e){let t=n=>e.renderers.has(n);return{supportsD3:t("D3"),supportsPlotly:t("PLOTLY"),supportsVega:t("VEGA")}}function Mr(e){let t=e.cap!=null&&e.budget>e.cap?e.cap:e.budget;return{triesLeft:e.triesLeft??t,maxTries:t}}function Ir(e){return e&&e>0?{leafCardinality:Math.round(e)}:{}}function Nr(e,t,n){let o=a=>typeof a=="number"&&Number.isInteger(a)&&a>0;return{...typeof e=="boolean"?{dataComplete:e}:{},...o(t)?{rowsWithheld:t}:{},...o(n)?{rowsFilteredOut:n}:{}}}var Fr={fit:"Best fit",variety:"Something different"};function Oe(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return t==="fit"||t==="variety"?t:null}function Dr(e){let t=Oe(e);return t?{qualifyOrder:t}:{}}function Pe(e,t){return e!=null&&t!=null&&e!==t}function kr(e,t){return e?Pe(t.capturedFor,t.now)?{shortlist:void 0,stale:!0}:{shortlist:{...e,ageMs:t.atMs>0?Math.max(0,Math.round(t.nowMs-t.atMs)):void 0},stale:!1}:{shortlist:void 0,stale:!1}}var Gr=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function ve(e){let t=String(e??"").trim().toLowerCase();return Gr[t]??t}function Le(e){let t="";for(let n of e)t+=JSON.stringify([String(n.name??""),n.isMeasure?"M":"D",ve(n.dataType)]);return t}function Vr(e){return j(Le(e))}var Ur=2,Wr=3,qr=4,$r=64,zr=8e3,Hr=6e4,Kr=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict",REDRAW:"redraw",INTERACT:"interact"}),Br=Object.freeze(["open","generate","version","rebind","data","sample","fix","resize","other"]);function jr(e,t){return t?`${t};draw:${e}`:`draw:${e}`}function Yr(e){return e.hint?e.hint:e.generated?"generate":e.previous?e.outputHash!==e.previous.outputHash?"version":e.dataSignature!==e.previous.dataSignature?"data":e.viewport!==e.previous.viewport?"resize":"other":"open"}function Qr(){let e=new Set,t=new Set;return{firstDraw(n,o){if(!n)return!1;let a=`${n}|${o}`;return e.has(a)?!1:(e.add(a),!0)},firstInteract(n){return!n||t.has(n)?!1:(t.add(n),!0)}}}function Xr(e){return!!e&&!e.includes("|")&&!e.includes(",")}function se(e,t,n,o){let a=`${e},${t}|${n}`;return o?`${a}|${Math.max(0,Math.round(o.count))}|${o.nonce}`:a}function Jr(e,t){let n=e;if(!n||!n.signer||typeof n.signer.sign!="function")throw new TypeError("createTelemetryClient needs the host's signer");if(!n.transport||typeof n.transport.post!="function")throw new TypeError("createTelemetryClient needs the host's transport");if(!n.clock||typeof n.clock.now!="function")throw new TypeError("createTelemetryClient needs the host's clock");if(!t||typeof t.baseUrl!="string"&&typeof t.baseUrl!="function")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof t.baseUrl=="string"&&t.baseUrl==="")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof t.clientVersion!="string"||t.clientVersion==="")throw new TypeError("createTelemetryClient needs the client version");if(typeof t.timeoutMs!="number"||!Number.isFinite(t.timeoutMs)||t.timeoutMs<=0)throw new TypeError("createTelemetryClient needs a positive deadline in milliseconds");let{signer:o,transport:a,clock:u}=n,l=t.apiPath??"/api",i=t.timeoutMs,C=()=>typeof t.baseUrl=="function"?t.baseUrl():t.baseUrl,b=g=>{try{t.onFailure?.(g)}catch{}},h=async(g,f,c,p)=>{let y;try{let T=await a.post(f,c,p,{timeoutMs:i});y=T.status;try{T.body?.cancel().catch(()=>{})}catch{}}catch(T){b({channel:g,stage:"post",status:null,error:T});return}(y<200||y>299)&&b({channel:g,stage:"status",status:y,error:null})};return{async sendClientMessage(g){let f,c,p;try{f=`${C()}${l}/LogClientMsg/?nocache=${u.now()}`,c=I(g),p=D(c,o)}catch(y){b({channel:"client-message",stage:"build",status:null,error:y});return}await h("client-message",f,c,{"Content-Type":"text/plain","X-Signature":p})},async countEvent(g,f,c){let p,y;try{p=`${C()}${l}/eventlog`,y=se(g,t.clientVersion,f,c)}catch(T){b({channel:"event-count",stage:"build",status:null,error:T});return}await h("event-count",p,y,{"Content-Type":"text/plain"})}}}var Ae=2**31-1;function Me(e){return Object.assign(new Error(`The request did not finish within ${e} ms.`),{name:"TimeoutError"})}function Zr(e){return typeof e=="number"&&e>0&&e<=Ae?null:new RangeError(`fetchTransport cannot keep a deadline of ${String(e)} ms: it must be a number of milliseconds above 0 and at most ${Ae} (about 24.8 days), the longest a timer can wait. Nothing was sent.`)}function eo(e,t={}){if(typeof e!="function")throw new TypeError("fetchTransport needs the host's fetch");let n=e,o=t.credentials??"omit";return{async post(a,u,l,i){let C=i.timeoutMs,b=Zr(C);if(b)throw b;let h=new AbortController,g=!1,f=setTimeout(()=>{g=!0,h.abort(Me(C))},C),c=()=>h.abort(i.signal?.reason);i.signal&&(i.signal.aborted?c():i.signal.addEventListener("abort",c,{once:!0}));let p=!1,y=()=>{p||(p=!0,clearTimeout(f),i.signal?.removeEventListener("abort",c))},T=_=>g?Me(C):_,L;try{L=await n(a,{method:"POST",body:u,headers:l,credentials:o,signal:h.signal})}catch(_){throw y(),T(_)}let R=X(L),A=R.statusText!==void 0?{statusText:R.statusText}:{};if(!R.body)return{status:R.status,...A,contentType:R.contentType,body:null,text:async()=>{try{return await R.text()}catch(_){throw T(_)}finally{y()}}};let x=R.body.getReader(),w=new ReadableStream({async pull(_){try{let s=await x.read();if(s.done){y(),_.close();return}_.enqueue(s.value)}catch(s){y(),_.error(T(s))}},cancel(_){return y(),x.cancel(_)}});return{status:R.status,...A,contentType:R.contentType,body:w,text:()=>new Response(w).text()}}}}var Ie=300;function Ne(e){return String(e??"").toLowerCase().replace(/[^a-z0-9-]/g,"").slice(0,40)}var to="/LLMChart/",no="/LLMChart/qualify",ro="/VisionReview/",oo="/LLMChart/sample",io="/RefundGenerate/",so=e=>!!e&&typeof e=="object"&&e.name==="TimeoutError",H=async e=>JSON.parse(await e.text());function ao(e){try{e.body?e.body.cancel().catch(()=>{}):e.text().catch(()=>{})}catch{}}function lo(e,t){let n=e;if(!n||!n.signer||typeof n.signer.sign!="function")throw new TypeError("createGenerateClient needs the host's signer");if(!n.transport||typeof n.transport.post!="function")throw new TypeError("createGenerateClient needs the host's transport");if(!n.clock||typeof n.clock.now!="function")throw new TypeError("createGenerateClient needs the host's clock");if(!t||typeof t.baseUrl!="string"&&typeof t.baseUrl!="function")throw new TypeError("createGenerateClient needs the service's base URL");if(typeof t.baseUrl=="string"&&t.baseUrl==="")throw new TypeError("createGenerateClient needs the service's base URL");if(t.apiPath!==void 0&&typeof t.apiPath!="string")throw new TypeError("createGenerateClient's apiPath must be a string");if(t.nocache!==void 0&&t.nocache!==null&&typeof t.nocache!="function")throw new TypeError("createGenerateClient's nocache must be a function");let{signer:o,transport:a,clock:u}=n,l=t.apiPath??"/api",i=()=>typeof t.baseUrl=="function"?t.baseUrl():t.baseUrl,C=g=>t.nocache?t.nocache(g):String(u.now());async function b(g,f,c,p,y){let T=`${i()}${l}${f}?nocache=${C(g)}`,L={"Content-Type":"text/plain","X-Signature":D(c,o)},R=p.signal??void 0,A=(w,_)=>{let s=!!R?.aborted;return{kind:"transport",headersReceived:w,timedOut:!s&&so(_),cancelled:s,error:_}},x;try{x=await a.post(T,c,L,R?{timeoutMs:p.timeoutMs,signal:R}:{timeoutMs:p.timeoutMs})}catch(w){return A(!1,w)}if(x.status<200||x.status>299){let w="";if(p.readErrorBody===!1)ao(x);else try{w=(await x.text()).slice(0,Ie)}catch{}return{kind:"http",status:x.status,statusText:x.statusText??"",bodyStart:w}}try{return{kind:"answer",status:x.status,value:await y(x)}}catch(w){return A(!0,w)}}function h(g,f){if(!f||typeof f.timeoutMs!="number"||!Number.isFinite(f.timeoutMs)||f.timeoutMs<=0)throw new TypeError(`The ${g} call needs a positive deadline in milliseconds`);return f}return{async generate(g,f){let c=h("generate",f),p=c.onStage??void 0;return b("generate",to,I(g),c,y=>J(y,p))},async qualify(g,f){let c=h("qualify",f),p=c.route??no;if(typeof p!="string"||!p.startsWith("/"))throw new TypeError("The qualify route must start with '/'");return b("qualify",p,I(g),c,H)},async review(g,f){let c=h("review",f),p=JSON.stringify(g);if(typeof p!="string")throw new TypeError("The review wire did not serialize to JSON");return b("review",ro,p,c,H)},async sample(g,f){let c=h("sample",f);return b("sample",oo,I(g),c,H)},async refund(g,f,c){let p=h("refund",f);if(typeof g!="string"||g.trim()==="")throw new TypeError("A refund needs the generation's correlation id");let y=Ne(c),T=y?{CorrelationID:g.trim(),Reason:y}:{CorrelationID:g.trim()};return b("refund",io,JSON.stringify(T),p,H)}}}export{Y as CITY_ROLE_MATCH_PCT,Kr as CLIENT_EVENT_KINDS,Sr as CLIENT_SECRET_MISMATCH,je as COMPOUND_MIN_STEM,ht as CYCLE_MEMBERS,bt as CYCLE_WORDS,ge as DATE_LEVEL_GREGORIAN_YEAR_MAX,pe as DATE_LEVEL_GREGORIAN_YEAR_MIN,sr as DATE_LEVEL_LANGUAGES,ie as DATE_LEVEL_NAMES,fe as DATE_LEVEL_NON_GREGORIAN_LANGUAGES,Ln as DEFAULT_GAP_FACTOR,it as DEFAULT_TEMPERATURE,Br as DRAW_REASONS,Tr as FREEMIUM_ATTEMPT_SPENT,Rr as FREEMIUM_COLUMN_CAP,rt as GET_RANDOM,Qe as GLUED_STEM_MIN,Je as HANGUL_MIN_STEM,be as HOST_SYNTHETIC_COLUMNS,Ie as HTTP_BODY_START_CHARS,xn as IDENTIFIER_HEAD_INITIAL,wn as IDENTIFIER_UNFOLDED,Rn as IDENTIFIER_WORDS,ln as INTENSIVE_SUFFIX_TOKENS,an as INTENSIVE_WORD_TOKENS,jn as IndexedText,Lt as LOOSE_KEY_MIN_LENGTH,Mt as LooseIndex,An as MAX_RUN_BOUNDS,wr as OAUTH_SIGNED_OUT,xr as OAUTH_TOKEN_EXPIRED,xt as PERIOD_CODE_FORMS,Rt as PERIOD_CODE_MEMBERS,wt as PERIOD_ORDINALS,_t as PERIOD_UNFOLDED,cn as POSITIONAL_SUFFIX_TOKENS,un as POSITIONAL_WORD_TOKENS,Jn as PREVIEW_OMITTED_FIELDS,we as PROGRESS_STAGE_IDS,Fr as QUALIFY_ORDER_LABELS,M as ROLE_MATCH_PCT,Nn as SERIES_COMPLETENESS_MAX_LISTED,Fn as SERIES_COMPLETENESS_MIN_FILL,Dn as SERIES_KEY_MAX_DISTINCT,qr as SEV_ERROR,Ur as SEV_INFO,$r as SEV_USER_PRESENTED,Wr as SEV_WARNING,j as SIMPLE_STRING_HASH,nt as STR,et as SUBSTRING_MIN,De as SUPPORTED_LANGUAGES,ke as SUPPORTED_LANGUAGE_CODES,Hr as TELEMETRY_TIMEOUT_DEV_MS,zr as TELEMETRY_TIMEOUT_MS,Ue as VOCABULARY_LANGUAGE_CODES,Ve as VOCABULARY_ONLY_LANGUAGES,Ct as YEAR_WORDS,$ as admin1MatchPct,bn as allowedAggregations,gt as anchorLocalWallClockDates,_r as answerIsRetryable,Yt as buildGeoIsoColumn,$t as buildGeoPointColumns,Et as calendarWordIn,Ar as capabilityFields,Ht as cityMatchPct,zt as cityTagsFor,Hn as classifyAdditivity,Yr as classifyDraw,Cn as classifyForAggregation,Kn as classifyNumericValueNature,$n as classifyTemporal,pn as codeNeedsLegacyAggNames,On as codeReadsColumn,Pn as codeReadsColumnsByRoleOrPosition,fn as collapseRepeatedAggPrefix,vn as columnsTheCodeReads,Jt as countryRegion,Qr as createDrawLedger,lo as createGenerateClient,Jr as createTelemetryClient,Or as credentialFields,Nr as dataCompletenessFields,lr as dateLevelPart,ur as dateLevelYearAdmits,yt as datesAreTimeOfDayOnly,ft as datesCarryTimeOfDay,tn as decimalSeparatorOf,En as defaultAggregation,nn as detectDecimalSeparator,en as detectFormatSignature,Kt as detectGeo,Ft as detectOrdinalDomain,qn as detectTextDatePattern,jr as drawLocation,I as encodePayload,Yn as engineTypeForSqlType,gn as englishImplicitAggNames,se as eventLogLine,Lr as fetchFields,eo as fetchTransport,qe as foldName,pr as freemiumColumnCapRefusal,Ee as freemiumColumnsOverCap,Te as freemiumDateHierarchyClauses,Xe as gluedPrefixStems,fr as guardColumnNames,er as gzipWireText,Ze as hangulWordEndsWith,mn as hasDefaultAggPrefix,Ke as hasUnsegmentedScript,zn as hostAggHint,Xn as ingest,Tn as isAggregationAllowed,V as isBlankLike,kt as isCityTableLoaded,z as isColumnContextRef,ot as isDeterministicRefusal,Xr as isEventLogCode,Wt as isGeoPointAmbiguity,Wn as isIdentifierName,jt as isJoinGeoKind,nr as isNdjsonContentType,It as isOrdinalFriendlyName,At as isUsableLooseKey,tr as keyedSigner,Ir as leafCardinalityField,ct as localMidnightDateColumns,ut as localMidnightToUtcDay,pt as localWallClockDateColumns,St as localizedCycleIn,_n as localizedIdentifierWordIn,Tt as localizedYearWordIn,N as looksLikeCountryColumn,vt as looseNameKey,tt as matchNameToken,vr as maxNonMeasureCardinality,In as measureCadence,Un as measurePersistence,Vn as measureSeriesCompleteness,D as messageSignature,mr as missingHardColumnRefs,sn as monthLookupFor,ze as nameLetterRuns,hn as nameLooksIntensiveRate,yn as nameLooksPositional,he as nameProbeIsGuarded,dr as nameProbeKeepsDrawing,$e as nameWords,Gt as normalizeCountry,dt as normalizeLocalMidnightDates,on as normalizeMonthKey,U as normalizePlaceName,Ut as normalizeZip5,kr as offeredShortlistFor,Qn as parseCsvRows,st as parseDateStable,hr as parseGenerateResponse,rn as parseNumberText,Cr as parseQualifyResponse,br as parseReviewVerdict,Mn as parseTemporalPoint,Zn as payloadPreview,Pt as periodCodeSeries,Gn as pickSeriesColumn,Er as progressStageOf,Bn as promotesToMeasure,Dr as qualifyOrderField,Oe as qualifyOrderOf,J as readGenerateStream,He as readName,Ot as readPeriodCode,E as readWireField,Ne as refundReasonCode,Dt as registerCityTable,Xt as registerIso3Regions,v as resolveAdmin1,_e as resolveFetchVersion,qt as resolveGeoPoint,We as resolveLanguage,ir as resolvePointRoles,Mr as retryFields,Nt as safeDistinctValuesToShip,Le as schemaIdentity,Vr as schemaIdentityKey,ve as schemaTypeFamily,kn as seriesKeyVerdict,Sn as shareOfTotalIsHonest,Pe as shortlistIsStale,dn as stripHostAggPrefix,Zt as summarizeCountryRegions,Qt as summarizeGeoExtent,Ge as supportedLanguage,Bt as toGeoIso,Be as unsegmentedRuns,mt as utcWallClock,Pr as viewportFields,B as vocabularyLanguage,at as wholeDayFrame,lt as wholeDayIso,X as wireResponseFromFetch,Ye as wordEndsWith,re as zipMatchPct,q as zipPrefixCandidates,Vt as zipToPrefix3};
@@ -1,2 +1,2 @@
1
1
  /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
- import{M as a,N as b,O as c,P as d,Q as e,R as f,S as g,T as h,U as i}from"./chunk-TXKQGWEI.mjs";import"./chunk-U3H6UBOO.mjs";import"./chunk-A4PQBWRA.mjs";import"./chunk-IPPPCWAK.mjs";import"./chunk-INMDBTAR.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-HJA26Z2E.mjs";import"./chunk-CZJ7M6A5.mjs";import"./chunk-WC4JINEZ.mjs";import"./chunk-5HI6TVMM.mjs";export{i as IndexedText,e as classifyAdditivity,f as classifyNumericValueNature,c as classifyTemporal,b as detectTextDatePattern,d as hostAggHint,a as isIdentifierName,g as promotesToMeasure,h as trimmedCells};
2
+ import{N as a,O as b,P as c,Q as d,R as e,S as f,T as g,U as h,V as i}from"./chunk-CQS6BGRJ.mjs";import"./chunk-U3H6UBOO.mjs";import"./chunk-A4PQBWRA.mjs";import"./chunk-IPPPCWAK.mjs";import"./chunk-INMDBTAR.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-HJA26Z2E.mjs";import"./chunk-CZJ7M6A5.mjs";import"./chunk-WC4JINEZ.mjs";import"./chunk-5HI6TVMM.mjs";export{i as IndexedText,e as classifyAdditivity,f as classifyNumericValueNature,c as classifyTemporal,b as detectTextDatePattern,d as hostAggHint,a as isIdentifierName,g as promotesToMeasure,h as trimmedCells};
package/dist/ingest.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
- import{a,b,c}from"./chunk-RI5BOXDB.mjs";import"./chunk-TXKQGWEI.mjs";import"./chunk-U3H6UBOO.mjs";import"./chunk-A4PQBWRA.mjs";import"./chunk-IPPPCWAK.mjs";import"./chunk-INMDBTAR.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-HJA26Z2E.mjs";import"./chunk-CZJ7M6A5.mjs";import"./chunk-WC4JINEZ.mjs";import"./chunk-5HI6TVMM.mjs";export{a as engineTypeForSqlType,c as ingest,b as parseCsvRows};
2
+ import{a,b,c}from"./chunk-YVP6AMZB.mjs";import"./chunk-CQS6BGRJ.mjs";import"./chunk-U3H6UBOO.mjs";import"./chunk-A4PQBWRA.mjs";import"./chunk-IPPPCWAK.mjs";import"./chunk-INMDBTAR.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-HJA26Z2E.mjs";import"./chunk-CZJ7M6A5.mjs";import"./chunk-WC4JINEZ.mjs";import"./chunk-5HI6TVMM.mjs";export{a as engineTypeForSqlType,c as ingest,b as parseCsvRows};
@@ -6,6 +6,8 @@ export { measureCadence, parseTemporalPoint, DEFAULT_GAP_FACTOR, MAX_RUN_BOUNDS
6
6
  export type { TemporalCadence, TemporalRun } from "./cadence";
7
7
  export { measureSeriesCompleteness, pickSeriesColumn, seriesKeyVerdict, SERIES_COMPLETENESS_MAX_LISTED, SERIES_COMPLETENESS_MIN_FILL, SERIES_KEY_MAX_DISTINCT, } from "./seriesCompleteness";
8
8
  export type { SeriesCompleteness, SeriesCoverage, SeriesKeyCandidate, SeriesKeyVerdict, } from "./seriesCompleteness";
9
+ export { measurePersistence } from "./measurePersistence";
10
+ export type { MeasurePersistence } from "./measurePersistence";
9
11
  export { classifyForAggregation, allowedAggregations, defaultAggregation, isAggregationAllowed, shareOfTotalIsHonest, nameLooksIntensiveRate, nameLooksPositional, stripHostAggPrefix, hasDefaultAggPrefix, collapseRepeatedAggPrefix, codeNeedsLegacyAggNames, englishImplicitAggNames, INTENSIVE_WORD_TOKENS, INTENSIVE_SUFFIX_TOKENS, POSITIONAL_WORD_TOKENS, POSITIONAL_SUFFIX_TOKENS, } from "./aggregation";
10
12
  export type { AggKind, AggAdditivity, AggBasis, AggNature, AggregationClass, AggregationColumn, } from "./aggregation";
11
13
  export type { LLMColumnWithValue, TwoSetPairing, ScoreSeparationEntry } from "./models";
@@ -199,6 +199,8 @@ export declare class IndexedText implements IValueCollection {
199
199
  private applyTwoSetPairing;
200
200
  private applyScoreSeparation;
201
201
  private applySeriesCompleteness;
202
+ private seriesKeyIndex;
203
+ private applyMeasurePersistence;
202
204
  private updateColumnStats20;
203
205
  private updateColumnStats10;
204
206
  getRowCount(): number;
@@ -0,0 +1,36 @@
1
+ /** How a measure's value moves from one point of a time axis to the next. Ratios and counts only: every privacy tier. */
2
+ export type MeasurePersistence = {
3
+ /** The temporal column the series run along. */
4
+ timeColumn: string;
5
+ /** The series key (pickSeriesColumn's choice); absent when the measure was read as one series. */
6
+ seriesColumn?: string;
7
+ /** Series measured: those with at least 6 points and some variation. */
8
+ series: number;
9
+ /** Median points per measured series. */
10
+ points: number;
11
+ /** Median over series of the von Neumann ratio of the straight-line residuals, 3 places: ~2 independent, ~0 carried over. */
12
+ vnDetrended: number;
13
+ /** Median over series of median abs(step) / median abs(value), 4 places. */
14
+ relStep: number;
15
+ };
16
+ /** A series shorter than this has no steps worth a ratio. */
17
+ export declare const MEASURE_PERSISTENCE_MIN_POINTS = 6;
18
+ type Measured = Omit<MeasurePersistence, "timeColumn" | "seriesColumn">;
19
+ /**
20
+ * The persistence of one measure from the stamps of its time column (epoch ms, null where the cell did not
21
+ * parse) - the part IndexedText runs once per measure, so the time column is parsed once per table and
22
+ * not once per measure. `series` is the key column's cell text row by row, or absent for one series.
23
+ */
24
+ export declare function measurePersistenceFromStamps(input: {
25
+ stamps: ReadonlyArray<number | null>;
26
+ series?: ReadonlyArray<string>;
27
+ values: ReadonlyArray<number | null>;
28
+ }): Measured | null;
29
+ export declare function measurePersistence(input: {
30
+ times: ReadonlyArray<string>;
31
+ series?: ReadonlyArray<string>;
32
+ values: ReadonlyArray<number | null>;
33
+ pattern?: string;
34
+ locale?: string;
35
+ }): Omit<MeasurePersistence, "timeColumn" | "seriesColumn"> | null;
36
+ export {};
@@ -1,7 +1,9 @@
1
1
  import type { TemporalCadence } from "./cadence";
2
2
  import type { SeriesCompleteness } from "./seriesCompleteness";
3
+ import type { MeasurePersistence } from "./measurePersistence";
3
4
  export type { TemporalCadence, TemporalRun } from "./cadence";
4
5
  export type { SeriesCompleteness, SeriesCoverage } from "./seriesCompleteness";
6
+ export type { MeasurePersistence } from "./measurePersistence";
5
7
  export type LLMRequestModifier = {
6
8
  code: string;
7
9
  not: boolean;
@@ -134,6 +136,7 @@ export type LLMColumnWithValue = {
134
136
  sourceField?: string;
135
137
  temporalCadence?: TemporalCadence;
136
138
  seriesCompleteness?: SeriesCompleteness;
139
+ persistence?: MeasurePersistence;
137
140
  sharedValueRatioWithOthers?: {
138
141
  otherColumn: string;
139
142
  percentShared: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/shape-core",
3
- "version": "0.6.98",
3
+ "version": "0.6.102",
4
4
  "description": "Host-agnostic data-shape profiler: ingest a dataset's rows through IValueCollection.addRow and read back the measured shape as an LLMColumnWithValue[] payload — types, cardinality, temporal/ordinal detection, geographic region and point resolution, cross-column signals. MEASUREMENT only: the policy that decides what a measured shape means for chart selection lives server-side.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -1,2 +0,0 @@
1
- /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
- import{a as pe}from"./chunk-U3H6UBOO.mjs";import{a as lt,f as ee,g as he,h as se,i as ye,j as re}from"./chunk-A4PQBWRA.mjs";import{c as at}from"./chunk-IPPPCWAK.mjs";import{f as st,k as ot}from"./chunk-INMDBTAR.mjs";import{e as et,k as fe,m as rt,n as it,o as ge}from"./chunk-HJA26Z2E.mjs";import{A as de,B as qe,E as Je,a as ce,b as J,c as $e,d as me,g as Ue,h as Ve,j as Ke,l as He,m as Ye,o as je,p as Z,q as Xe,r as Ze,u as Re,w as Qe}from"./chunk-CZJ7M6A5.mjs";import{c as ze,f as we}from"./chunk-WC4JINEZ.mjs";import{b as tt,d as nt}from"./chunk-5HI6TVMM.mjs";var Zt=[[24.4,49.4,-125,-66.9],[51.2,71.5,-168,-129.9],[18.9,22.3,-160.3,-154.8]],Qt=[7,72,-172,-52];function ut(n,e,t){return n>=t[0]&&n<=t[1]&&e>=t[2]&&e<=t[3]}var te=n=>Math.round(n*10)/10;function mt(n,e=3){let t=[],i=[],r=0,s=0;for(let l of n){let a=l?.lat,f=l?.lon;if(typeof a!="number"||typeof f!="number"||!isFinite(a)||!isFinite(f)||a<-90||a>90||f<-180||f>180)continue;t.push(a),i.push(f);let m=l?.country?String(l.country).trim().toUpperCase():"",g=m?be(m):null;g?((m==="US"||m==="USA")&&r++,g==="north-america"&&s++):(Zt.some(u=>ut(a,f,u))&&r++,ut(a,f,Qt)&&s++)}let o=t.length;return o<e?null:(t.sort((l,a)=>l-a),i.sort((l,a)=>l-a),{pctUsa:te(r/o*100),pctNa:te(s/o*100),latP5:te(Z(t,.05)),latP95:te(Z(t,.95)),lonP5:te(Z(i,.05)),lonP95:te(Z(i,.95)),n:o})}var ct={"north-america":"AG AI AW BB BL BM BQ BS BZ CA CR CU CW DM DO GD GL GP GT HN HT JM KN KY LC MF MQ MS MX NI PA PM PR SV SX TC TT US VC VG VI","south-america":"AR BO BR CL CO EC FK GF GY PE PY SR UY VE",europe:"AD AL AT AX BA BE BG BY CH CY CZ DE DK EE ES FI FO FR GB GG GI GR HR HU IE IM IS IT JE LI LT LU LV MC MD ME MK MT NL NO PL PT RO RS RU SE SI SJ SK SM UA VA",africa:"AO BF BI BJ BW CD CF CG CI CM CV DJ DZ EG EH ER ET GA GH GM GN GQ GW KE KM LR LS LY MA MG ML MR MU MW MZ NA NE NG RE RW SC SD SH SL SN SO SS ST SZ TD TG TN TZ UG YT ZA ZM ZW",asia:"AE AF AM AZ BD BH BN BT CC CN CX GE HK ID IL IN IO IQ IR JO JP KG KH KP KR KW KZ LA LB LK MM MN MO MV MY NP OM PH PK PS QA SA SG SY TH TJ TL TM TR TW UZ VN YE",oceania:"AS AU CK FJ FM GU KI MH MP NC NF NR NU NZ PF PG PN PW SB TK TO TV UM VU WF WS",antarctica:"AQ BV GS HM TF"},oe=(()=>{let n=new Map;for(let e of Object.keys(ct))for(let t of ct[e].split(/\s+/))t&&n.set(t,e);return n})();function qt(n){for(let[e,t]of n){let i=oe.get(e);i&&!oe.has(t)&&oe.set(t,i)}}qt(st);function be(n){if(!n)return null;let e=String(n).trim().toUpperCase();if(!e)return null;let t=oe.get(e);if(t)return t;let i=ot(String(n));return i?oe.get(i)??null:null}function ni(n,e=2){return Ie(n.map(t=>[t,1]),e)}function Ie(n,e=2){let t=new Map,i=0;for(let[o,l]of n){let a=be(o);if(!a)continue;let f=typeof l=="number"&&isFinite(l)&&l>0?l:1;t.set(a,(t.get(a)??0)+f),i+=f}if(i<e||!t.size)return null;let r="europe",s=-1;for(let o of Array.from(t.keys()).sort()){let l=t.get(o);l>s&&(r=o,s=l)}return{dominantGeoRegion:r,dominantGeoRegionPct:te(s/i*100),regionCount:t.size,n:i}}function ve(n){let e=(n||"").toLowerCase();return e==="en-us"||e==="en"||e.startsWith("en-us-")||e==="en-ph"||e==="en-bz"}var Ne={a:0,b:0,c:0,yearFirst:!1,sep:"",trail:"",word:"",day:0,year:0,namedOrder:"dmy",cjkPattern:""},Jt=/\s+(\d{1,2}):(\d{2})(?::(\d{2})(?:[.,]\d{1,9})?)?(?:\s*([ap])\.?\s?m\.?)?$/i,en=/^(\d{1,4})(\s*[./-]\s*)(\d{1,2})(\s*[./-]\s*)(\d{1,4})(\.?)$/,tn=/^(\d{4})(\s*[年년]\s*)(\d{1,2})(\s*[月월]\s*)(\d{1,2})(\s*[日일号])$/,nn=/(\d)(?:st|nd|rd|th|er|º|ª)(?=[\s.,/-]|$)/gi,rn=new Set(["de","del","of"]),sn=new Set(["\u0433","\u0440","r"]),on=/^[\p{L}\p{M}\u0970\u05f3]+$/u,Ee=/^\d+$/;function an(n){let e=+n[1],t=+n[2],i=n[3]===void 0?0:+n[3],r=n[4]!==void 0;if(t>59||i>59)return null;if(r){if(e<1||e>12)return null;e=e%12+(n[4].toLowerCase()==="p"?12:0)}else if(e>23)return null;return{h:e,mi:t,s:i,seconds:n[3]!==void 0,meridiem:r}}function dt(n){let e=n.replace(/[\u200e\u200f\u061c]/g,"").replace(/\s+/g," ").trim();if(e==="")return null;e=lt(e);let t=null,i=Jt.exec(e);if(i){if(t=an(i),!t)return null;e=e.slice(0,i.index)}let r;if(r=tn.exec(e)){let u=`cjk|${r[2]}|${r[4]}|${r[6]}`;return{...Ne,form:"cjk",key:u,clock:t,a:+r[1],b:+r[3],c:+r[5],yearFirst:!0,cjkPattern:`%Y${r[2]}%m${r[4]}%d${r[6]}`}}if(r=en.exec(e)){let u=r[2],S=r[4];if(u!==S)return null;let M=u.trim(),I=r[6];if(I&&M!==".")return null;let x=[r[1].length,r[3].length,r[5].length],d=x[0]===4,h=x[2]===4;return d===h||(d?x[1]>2||x[2]>2:x[0]>2||x[1]>2)?null:d&&M==="-"&&u==="-"&&x[1]===2&&x[2]===2?"iso":d&&M==="."&&u==="."&&!I&&!(x[1]===2&&x[2]===2)?null:{...Ne,form:"numeric",key:`num|${d?"y":"x"}|${u}|${I}`,clock:t,a:+r[1],b:+r[3],c:+r[5],yearFirst:d,sep:u,trail:I}}let s=e.replace(nn,"$1").split(/[\s.,/-]+/).filter(u=>u!==""&&!rn.has(u.toLowerCase()));if(s.length===4&&Ee.test(s[2])&&sn.has(s[3].toLowerCase())&&s.pop(),s.length!==3)return null;let o=s.map(u=>Ee.test(u)?"N":on.test(u)?"W":"?").join(""),l=s.map(u=>Ee.test(u)?u:""),a=0,f=0,m="",g;if(o==="NWN"&&l[0].length<=2&&l[2].length===4)a=+l[0],m=s[1],f=+l[2],g="dmy";else if(o==="WNN"&&l[1].length<=2&&l[2].length===4)m=s[0],a=+l[1],f=+l[2],g="mdy";else if(o==="NWN"&&l[0].length===4&&l[2].length<=2)f=+l[0],m=s[1],a=+l[2],g="ymd";else return null;return{...Ne,form:"named",key:`named|${g}`,clock:t,day:a,year:f,word:m,namedOrder:g}}var ln=[31,28,31,30,31,30,31,31,30,31,30,31],un=n=>n%4===0&&n%100!==0||n%400===0;function ft(n,e,t){return n>=1&&n<=9999&&e>=1&&e<=12&&t>=1?t<=(e===2&&un(n)?29:ln[e-1]):!1}function cn(n,e,t,i){let r=new Date(Date.UTC(2e3,e-1,t,i?.h??0,i?.mi??0,i?.s??0));return r.setUTCFullYear(n),r}function gt(n,e={}){let t=(e.floor??1)>=1,i=new Map,r=new Map,s=0,o=null;for(let d of n){if(d==null)continue;if(typeof d!="string"){if(t)return null;s++;continue}let h=d.trim();if(h==="")continue;s++;let y=i.get(h);if(y===void 0&&(y=dt(h),i.set(h,y)),y===null||y==="iso"){if(t)return null;continue}if(t){if(o===null)o=y;else if(y.key!==o.key)return null}else r.set(y.key,(r.get(y.key)??0)+1)}if(!t){let d=0,h="";for(let[y,b]of r)b>d&&(d=b,h=y);if(d===0||d/s<e.floor)return null;o=[...i.values()].find(y=>y!==null&&y!=="iso"&&y.key===h)??null}if(o===null)return null;let l=o.key,a=[...i.values()].filter(d=>d!==null&&d!=="iso"&&d.key===l),f,m="shape",g=null;if(o.form==="named"){if(f=o.namedOrder,g=ye(a.map(d=>d.word),e.locale),!g)return null}else if(o.form==="cjk"||o.yearFirst)f="ymd";else{let d=0,h=0;for(let y of a)y.a>12&&d++,y.b>12&&h++;if(d>0&&h>0)return null;d>0?(f="dmy",m="values"):h>0?(f="mdy",m="values"):o.sep.trim()==="."?(f="dmy",m="shape"):(f=ve(e.locale)?"mdy":"dmy",m="locale")}let u=d=>{if(d.form==="named"){let h=g.get(ee(d.word));return h===void 0?null:[d.year,h+1,d.day]}return d.yearFirst?[d.a,d.b,d.c]:f==="dmy"?[d.c,d.b,d.a]:[d.c,d.a,d.b]},S=1/0,M=-1/0,I=0;for(let d of a){let h=u(d);if(!h||!ft(h[0],h[1],h[2])){if(t)return null;I++;continue}S=Math.min(S,h[0]),M=Math.max(M,h[0])}if(!t&&(r.get(l)-I)/s<e.floor||S>=2400&&M<=2699||S>=1300&&M<=1500)return null;let x={form:o.form,order:f,orderFrom:m,hasTime:a.some(d=>d.clock!==null),read(d){if(typeof d!="string")return null;let h=d.trim();if(h==="")return null;let y=i.get(h);if(y===void 0&&(y=dt(h),i.set(h,y)),y===null||y==="iso"||y.key!==l)return null;let b=u(y);return!b||!ft(b[0],b[1],b[2])?null:cn(b[0],b[1],b[2],y.clock)}};if(o.form!=="named"&&!a.some(d=>d.clock?.meridiem)){let d;o.form==="cjk"?d=o.cjkPattern:o.yearFirst?d=`%Y${o.sep}%m${o.sep}%d${o.trail}`:d=(f==="dmy"?`%d${o.sep}%m${o.sep}%Y`:`%m${o.sep}%d${o.sep}%Y`)+o.trail;let h=a.filter(y=>y.clock!==null).length;h===0?x.pattern=d:h===a.length&&(x.pattern=d+(a.every(y=>y.clock.seconds)?" %H:%M:%S":" %H:%M"))}return x}import Vt from"papaparse";var mn=["rate","ratio","pct","percent","percentage","rating","share","score","index","nps","csat","margin","yield","coverage","utilization","utilisation","z[_-]?score","average","avg","mean","median","stddev","variance","gpa","percentile","quantile","efficiency","accuracy","probability","multiplier","coefficient","correlation","occupancy","age","bmi","temperature","density","pressure","humidity","ph","velocity","speed","elevation","altitude","latency","throughput","bandwidth","iops","ppm","ppb","dpmo","bps","capita","temperatuur","temperatur","temperatura","teplota","lampotila","homerseklet","sicaklik","pression","presion","pressao","pressione","druck","tryck","tlak","paine","nyomas","presiune","humidite","humedad","umidade","umidita","feuchtigkeit","vochtigheid","kosteus","vlhkost","vitesse","velocidad","velocidade","velocita","geschwindigkeit","snelheid","hastighet","hastighed","rychlost","nopeus","sebesseg","brzina","predkosc","densite","densidad","densidade","densita","dichte","dichtheid","hustota","tiheys","gustoca","moyenne","mediane","promedio","mediana","gemiddelde","durchschnitt","mittelwert","genomsnitt","gennemsnit","gjennomsnitt","keskiarvo","atlag","ortalama","prosjek","srednia","prumer","priemer","medie","taux","tasa","taxa","tasso","verhaltnis","verhouding","aandeel","anteil","andel","osuus","podil","udzial","udio","pourcentage","porcentaje","percentual","prozent","procent","prosentti","szazalek","yuzde","participacion","participacao","pondere","omjer","arany","oran","rata","leeftijd","edad","idade","wiek","eletkor","varsta","puntuacion","pontuacao","punteggio","betyg","ocena","indice","indeks","wskaznik","puan","ocupacion","ocupacao","occupazione","auslastung","bezetting","belaggning","belaegning","belegg","kayttoaste","oblozenie","obsazenost","obsadenost","kihasznaltsag","doluluk","ocupare","popunjenost","efficacite","eficiencia","efficienza","effizienz","effectiviteit","verimlilik"],dn=["pct","percent","percentage","rate","ratio","rating","share","score","index","nps","csat","margin","yield","coverage","utilization","utilisation","gpa","percentile","quantile","bmi","density","pressure","humidity","velocity","efficiency","occupancy","latency","throughput","bandwidth","iops","ppm","ppb","dpmo","bps"],fn=["latitude","longitude"],gn=["latitude","longitude"];function Q(n){return ce(n)}var yt=["somme de","suma de","soma de","summe von","som van","somma di","summa av","sum av","sum af","soucet z","suma z","totaal van","total de","toplam","osszeg","nombre de","recuento de","contagem de","anzahl von","aantal van","conteggio di","antal av","lukumaara","pocet z","sum pa","\u0441\u0443\u043C\u043C\u0430","\u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E","\u0441\u0443\u043C\u0430","\u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C","\u03B1\u03B8\u03C1\u03BF\u03B9\u03C3\u03BC\u03B1","\u03C0\u03BB\u03B7\u03B8\u03BF\u03C2"],pn=["moyenne de","promedio de","media de","media di","durchschnitt von","gemiddelde van","medelvarde av","genomsnitt av","gennemsnit af","keskiarvo","atlag","ortalama","prumer z","srednia z","medie de","minimum de","minimo de","minimo di","minimum von","maximum de","maximo de","massimo di","maximum von","prom.","\u0441\u0440\u0435\u0434\u043D\u0435\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435","\u0441\u0440\u0435\u0434\u043D\u0435\u0435","\u0441\u0435\u0440\u0435\u0434\u043D\u0454","\u03BC\u03B5\u03C3\u03BF\u03C2 \u03BF\u03C1\u03BF\u03C2","\u0645\u06CC\u0627\u0646\u06AF\u06CC\u0646"],hn=["osszege","sucet","\u7684\u603B\u548C","\u7684\u8BA1\u6570","\u306E\u5408\u8A08","\uC758 \uD569\uACC4"],yn=["atlaga","priemer","\u7684\u5E73\u5747\u503C","\u306E\u5E73\u5747","\uC758 \uD3C9\uADE0"],Se=Object.freeze({"nombre de":"count","recuento de":"count","contagem de":"count","anzahl von":"count","aantal van":"count","conteggio di":"count","antal av":"count",lukumaara:"count","pocet z":"count",\u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E:"count",\u043A\u0456\u043B\u044C\u043A\u0456\u0441\u0442\u044C:"count",\u03C0\u03BB\u03B7\u03B8\u03BF\u03C2:"count",\u7684\u8BA1\u6570:"count","minimum de":"min","minimo de":"min","minimo di":"min","minimum von":"min","maximum de":"max","maximo de":"max","massimo di":"max","maximum von":"max"});function ke(n){return[...n].sort((e,t)=>t.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")}var bt=new RegExp("^\\s*(?:(?:sum|count|count\\s+distinct|distinct\\s+count)\\s+of\\s+|(?:"+ke(yt)+")\\s+)","i");function pt(n){for(let e of n){let t=e.codePointAt(0)??0;if(t>=11904&&t<=40959||t>=44032&&t<=55215)return!0}return!1}var bn="[\u2013\u2014-]";function St(n){let e=n.filter(r=>!pt(r)),t=n.filter(pt),i=[];return e.length&&i.push("(?:\\s+|\\s*"+bn+"\\s*)("+ke(e)+")"),t.length&&i.push("\\s*("+ke(t)+")"),new RegExp("(?:"+i.join("|")+")\\s*$","i")}var De=St(hn),Sn=St(yn);function _e(n,e){let t=e.exec(n);if(!t)return null;let i=n.slice(0,t.index);return i.trim()===""?null:{base:i,label:(t[1]??t[2]??"").toLowerCase()}}function _t(n){let e=Q(String(n??"").trim().toLowerCase());if(!e)return null;for(let r of pn)if(e.startsWith(r+" "))return Se[r]??"avg";for(let r of yt)if(e.startsWith(r+" ")||e===r)return Se[r]??"sum";let t=_e(e,Sn);if(t)return Se[t.label]??"avg";let i=_e(e,De);return i?Se[i.label]??"sum":null}var _n=/(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])/g,An=new RegExp("\\b("+mn.join("|")+")\\b|("+dn.join("|")+")$","i"),xn=new RegExp("\\b("+fn.join("|")+")\\b|("+gn.join("|")+")$","i");function xe(n){if(!n)return"";let e=String(n),t=Q(e),i=bt.exec(t);if(i)return e.slice(i[0].length).trim();let r=_e(t,De);return(r?e.slice(0,r.base.length):e).trim()}function Cn(n){if(!n)return!1;let e=Q(String(n));return bt.test(e)||_e(e,De)!==null}var Mn=["count (distinct)","count distinct","distinct count","standard deviation","average","variance","median","product","stddev","std dev","count","sum","avg","min","minimum","max","maximum","var"],ht=new RegExp("^\\s*("+[...Mn].sort((n,e)=>e.length-n.length).map(n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")+")\\s+of\\s+","i");function At(n){if(n==null)return"";let e=String(n),t=ht.exec(e);if(!t)return e;let i=l=>l.toLowerCase().replace(/\s+/g," ").trim(),r=i(t[1]),s=e.slice(t[0].length),o=0;for(;o<8;){let l=ht.exec(s);if(!l||i(l[1])!==r)break;let a=s.slice(l[0].length);if(a.trim()==="")break;s=a,o++}return o===0?e:e.slice(0,t[0].length)+s}function Oe(n,e){if(!n||!e)return!1;let t=String(n);for(let i of e){let r=i?.hostName;if(r&&r!==i?.name&&t.includes(r))return!0}return!1}var Ae={Sum:["Sum of "],Avg:["Average of "],Average:["Average of "],Count:["Count of "],CountNonNull:["Count of "],Min:["Min of ","First ","Earliest "],Max:["Max of ","Last ","Latest "],Median:["Median of "],StandardDeviation:["Standard deviation of "],Variance:["Variance of "]},xt=new RegExp("^("+Object.keys(Ae).join("|")+")\\((.+)\\)$");function Ct(n){if(!n)return[];let e=xt.exec(String(n).trim());if(!e)return[];let t=Ae[e[1]],i=e[2],r=[];for(let s=i.indexOf(".");s>=0;s=i.indexOf(".",s+1)){if(s===0)continue;let o=i.slice(s+1);if(o.trim()!=="")for(let l of t){let a=l+o;r.includes(a)||r.push(a)}}return r}function Mt(n,e,t){let i=xt.exec(String(n??"").trim());if(!i)return!1;let r=i[1];if((r==="Count"||r==="CountNonNull")&&t==="Decimal")return!0;let s=new Set(Ae[r]),o=String(e??""),l=i[2];for(let a=l.indexOf(".");a>=0;a=l.indexOf(".",a+1)){if(a===0)continue;let f=l.slice(a+1);if(f.trim()!==""){for(let m of Object.values(Ae))for(let g of m)if(!s.has(g)&&o===g+f)return!0}}return!1}function Tn(n){let e=xe(n);return e.length===0?"":e.replace(_n," ")}function Tt(n,e){if(!e)return!1;let t=xe(e);return n.test(Q(Tn(e)))||n.test(Q(t))||n.test(Q(J(t).join(" ")))}function wt(n){return Tt(xn,n)}function wn(n){return Tt(An,n)||wt(n)}var Rt=/int|double|decimal|single|float|number|currency|money/i;function Rn(n){let e=String(n?.valueNature??"").trim().toLowerCase();return e==="categorical"?"Categorical":e==="ordinal"?"Ordinal":e==="continuous"||n?.isMeasure===!0||Rt.test(String(n?.dataType??""))?"Continuous":"Categorical"}function In(n){return n?.isMeasure===!0||Rt.test(String(n?.dataType??""))}function It(n){let e=n??{},t=Rn(e);if(t!=="Continuous")return{nature:t,additivity:"unknown",basis:"role",suppressed:!1};if(wt(e.name))return{nature:t,additivity:"positional",basis:"name",suppressed:!0};let i=String(e.additivity??"").trim().toLowerCase();if(!(i==="additive"&&Cn(e.name))){if(i==="additive")return{nature:t,additivity:"additive",basis:"measured",suppressed:!1};if(i==="part_of_whole")return{nature:t,additivity:"part_of_whole",basis:"measured",suppressed:!1};if(i==="intensive_rate")return{nature:t,additivity:"intensive_rate",basis:"measured",suppressed:!1}}return e.discourageAggregationAcrossGroups===!0?{nature:t,additivity:"intensive_rate",basis:"host-flag",suppressed:!1}:wn(e.name)?{nature:t,additivity:"intensive_rate",basis:"name",suppressed:!1}:{nature:t,additivity:"additive",basis:"default",suppressed:!1}}function Nt(n){let e=It(n),t=n??{};if(e.nature==="Categorical")return["first","distinctcount","count"];if(e.nature==="Ordinal")return In(t)?["median","average","min","max","first","distinctcount","count"]:["first","distinctcount","count"];switch(e.additivity){case"positional":return["min","max","count","distinctcount","first"];case"intensive_rate":return["average","median","min","max","count","distinctcount","first"];default:return["sum","average","median","min","max","count","distinctcount","first"]}}function ui(n){return Nt(n)[0]}function ci(n,e){return Nt(n).indexOf(e)>=0}function mi(n,e){if(e!=="sum"&&e!=="count")return!1;if(e==="count")return!0;let t=It(n);return t.additivity==="additive"||t.additivity==="part_of_whole"||t.additivity==="unknown"}var Nn={de:["nr","nummer","kennung","kennziffer","plz","postleitzahl"],nl:["nr","nummer"],sv:["nr","nummer"],da:["nr","nummer"],nb:["nr","nummer"],fi:["tunnus","koodi","nro"],hu:["azonos\xEDt\xF3","k\xF3d"],tr:["kod","kodu","numaras\u0131","numarasi"],zh:["\u7F16\u53F7","\u4EE3\u7801","\u7F16\u7801","\u53F7\u7801","\u90AE\u7F16"],ja:["\u756A\u53F7","\u30B3\u30FC\u30C9"],ko:["\uBC88\uD638","\uCF54\uB4DC"],hi:["\u0915\u094B\u0921","\u0915\u094D\u0930\u092E\u093E\u0902\u0915"],fr:["num\xE9ro"],es:["c\xF3digo"],pt:["c\xF3digo","cep"],it:["codice"],pl:["kod","numer"],cs:["k\xF3d","\u010D\xEDslo"],sk:["k\xF3d","\u010D\xEDslo"],hr:["\u0161ifra","oznaka"],ru:["\u043A\u043E\u0434","\u043D\u043E\u043C\u0435\u0440"],uk:["\u043A\u043E\u0434","\u043D\u043E\u043C\u0435\u0440"],el:["\u03BA\u03C9\u03B4\u03B9\u03BA\u03CC\u03C2"],ar:["\u0631\u0645\u0632","\u0643\u0648\u062F","\u0631\u0642\u0645"],he:["\u05E7\u05D5\u05D3"],id:["kode","nomor"],vi:["m\xE3"],th:["\u0E23\u0E2B\u0E31\u0E2A"]},En=["fr","es","pt","it","pl","cs","sk","hr","ru","uk","el","ar","he","id","vi","th"],vn=["num\xE9ro"],kn=n=>n.normalize("NFC").toLowerCase();function Dn(n,e,t,i){let r=we(t);return!r||!n?null:n===e?"word":r.wordBreaks===!1?Array.from(e).length<Ye?null:(i?n.startsWith(e):n.endsWith(e))&&n.length>e.length?"suffix":null:i?Ke(n,t).includes(e)?"word":null:r.script==="Hang"?He(n,e)?"suffix":null:r.compounds&&Ve(n,e,Ue)?"suffix":null}function Et(n){let e=String(n??"").trim();if(!e)return null;let t=me(e),i=me(xe(e));for(let[r,s]of Object.entries(Nn)){let o=En.includes(r),l=o?i:t;for(let a of s){let f=vn.includes(a)||!!we(r)?.foldSensitive,m=f?l.words:l.folded;if(m.length===0)continue;let g=f?kn(a):me(a).folded.join(" "),u=Dn(o?m[0]:m[m.length-1],g,r,o);if(u)return{lang:r,word:a,view:u}}}return null}var On=[["Lu",/^\p{Lu}$/u],["Ll",/^\p{Ll}$/u],["Lt",/^\p{Lt}$/u],["Lm",/^\p{Lm}$/u],["Lo",/^\p{Lo}$/u],["Mn",/^\p{Mn}$/u],["Mc",/^\p{Mc}$/u],["Nd",/^\p{Nd}$/u]];function Ce(n){for(let[e,t]of On)if(t.test(n))return e;return null}var Ln=[{id:"ascii",test:/^[A-Za-z]$/,ranges:[[65,90],[97,122]]},{id:"latin",test:/^[\u00C0-\u017F]$/u,ranges:[[192,383]]},{id:"cyrillic",test:/^[\u0400-\u045F\u0490-\u0491]$/u,ranges:[[1024,1119],[1168,1169]]},{id:"greek",test:/^[\u0386-\u03CE]$/u,ranges:[[902,974]]},{id:"han",test:/^[\u4E00-\u9FFF]$/u,ranges:[[19968,40959]]},{id:"hiragana",test:/^\p{Script=Hiragana}$/u,ranges:[[12353,12447]]},{id:"katakana",test:/^\p{Script=Katakana}$/u,ranges:[[12448,12543]]},{id:"hangul",test:/^[\uAC00-\uD7A3]$/u,ranges:[[44032,55203]]},{id:"arabic",test:/^[\u0620-\u0652\u0671-\u06D3]$/u,ranges:[[1568,1618],[1649,1747]]},{id:"hebrew",test:/^[\u05B0-\u05EA]$/u,ranges:[[1456,1514]]},{id:"devanagari",test:/^\p{Script=Devanagari}$/u,ranges:[[2304,2431]]},{id:"thai",test:/^\p{Script=Thai}$/u,ranges:[[3585,3662]]}],Me=new Map;function vt(n,e,t,i){let r=Me.get(n);if(r)return r;let s=[];for(let[o,l]of e)for(let a=o;a<=l;a++){let f=String.fromCodePoint(a);Ce(f)===t&&(i&&!i.test(f)||s.push(f))}return Me.set(n,s),s}function Pn(n){let t=n.codePointAt(0);for(let o=0;o<9&&Ce(String.fromCodePoint(t-1))==="Nd";o++)t--;let i="nd:"+t.toString(16),r=Me.get(i);if(r)return r;let s=[];for(let o=t;o<t+10;o++){let l=String.fromCodePoint(o);Ce(l)==="Nd"&&s.push(l)}return Me.set(i,s),s}function Fn(n,e){if(e==="Nd")return Pn(n);for(let r of Ln)if(r.test.test(n))return vt(r.id+":"+e,r.ranges,e,r.id==="ascii"?null:r.test);let i=n.codePointAt(0)&-128;return vt("block:"+i.toString(16)+":"+e,[[i,i+127]],e,null)}function Wn(n,e,t,i){let r=n.filter(s=>!e.has(s));return r.length===0&&(r=n.filter(s=>s!==t)),r.length===0?t:r[Math.min(r.length-1,Math.floor(i()*r.length))]}var Bn=/^[\p{L}\p{M}\p{Nd}]$/u,kt=/^[\p{L}\p{Nd}]$/u;function Dt(n,e){if(!n)return n??"";let t=new Set(Array.from(n)),i=m=>{let g=Ce(m);return!g||!Bn.test(m)?m:Wn(Fn(m,g),t,m,e)},r=m=>{let g=[];for(let u of m)g.push(i(u)),kt.test(u)&&e()<.2&&g.push(i(u));if(g.length>6){let u=Math.floor(e()*Math.min(3,g.length-6));for(let S=0;S<u;S++)for(let M=0;M<5;M++){let I=Math.floor(e()*g.length);if(kt.test(g[I])){g.splice(I,1);break}}}return g.join("")};if(!(n.includes("@")&&n.includes(".")))return r(n);let[o,l=""]=n.split("@"),a=l.endsWith(".com"),f=a?l.slice(0,-4):l;return`${r(o)}@${r(f)}${a?".com":""}`}var Gn=/^[A-Za-z_$][A-Za-z0-9_$]*$/,zn=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),$n=new RegExp([String.raw`\bisMeasure\b`,String.raw`\bdataType\b`,String.raw`\bcolumns\s*\[\s*-?\d`,String.raw`\.iloc\s*\[[^\]]*,`,String.raw`\.iat\s*\[`,String.raw`\bselect_dtypes\b`,String.raw`\b_get_numeric_data\b`,String.raw`\bis_numeric_dtype\b`,String.raw`\bfor\s+\w+\s+in\s+(?:list\s*\(\s*)?df\.columns\b`,String.raw`\bdf\.columns\s*\.\s*(?:tolist|to_list|difference|drop)\b`,String.raw`\bdf\.dtypes\b`,String.raw`\bObject\s*\.\s*(?:keys|values|entries)\s*\(\s*(?:rows|data|df)?\s*\[\s*0\s*\]`,String.raw`\b(?:row|rw|r)\s*\[\s*\d+\s*\]`].join("|"));function ae(n,e){if(!n||!e)return!1;let t=zn(e);return new RegExp("['\"`]"+t+"['\"`]").test(n)?!0:Gn.test(e)&&new RegExp("\\."+t+"(?![A-Za-z0-9_$])").test(n)}function Un(n){return!!n&&$n.test(n)}function bi(n,e,t){return n?Un(n)?[...e]:[...t,...e].some(i=>ae(n,i))?e.filter(i=>ae(n,i)):[...e]:[]}var Vn=5,Kn=6,Hn=3,ne=864e5,Yn=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,jn=/^(\d{4})[-/](\d{1,2})$/,Xn=/^(\d{4})[-\s]?Q([1-4])$/i,Zn=/^Q([1-4])[-\s](\d{4})$/i,Qn=/^(\d{4})$/,qn=/^(\d{4})(0[1-9]|1[0-2])$/,Jn=/^(\d{4})(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])$/,er=/^(\D+?)[\s\-/.,']*((?:19|20)\d{2})$/u,tr=/^((?:19|20)\d{2})[\s\-/.,']+(\D+)$/u;function Le(n,e,t){let i=ee(n);if(!i)return 0;if(i==="sept")return 9;for(let o of e&&!/^en\b/i.test(e)?["en",e]:["en"]){let l=he(o)[i];if(l!==void 0)return l+1}let r=t?.get(i);if(r!==void 0)return r+1;let s=se(n);if(s.length>0){if(s.every(a=>a.month===s[0].month))return s[0].month+1;let o=ze(String(e??"").split(/[-_]/)[0])?.code,l=s.find(a=>a.lang===o);if(l)return l.month+1}return 0}function nr(n){let e=fe(n).filter(i=>i.yearDigits===4);if(e.length===0||e.some(i=>i.lang==="en"))return null;let t=e[0];return e.some(i=>i.grain!=="quarter"||i.n!==t.n||i.year!==t.year)?null:H(t.year,(t.n-1)*3+1,1)}function H(n,e,t,i=0,r=0,s=0){if(!(n>=1&&e>=1&&e<=12&&t>=1&&t<=31))return null;let o=Date.UTC(n,e-1,t,i,r,s);if(!Number.isFinite(o))return null;let l=a=>a<10?"0"+a:String(a);return{ms:o,y:n,m:e,d:t,iso:`${n}-${l(e)}-${l(t)}`}}function rr(n,e){let t=[],i="";for(let a=0;a<e.length;a++){if(e[a]!=="%"){i+=e[a].replace(/[.*+?^${}()|[\]\\]/g,"\\$&");continue}switch(e[++a]){case"Y":t.push("Y"),i+="(\\d{4})";break;case"m":t.push("m"),i+="(\\d{1,2})";break;case"d":t.push("d"),i+="(\\d{1,2})";break;case"H":case"M":case"S":i+="\\d{1,2}";break;case"%":i+="%";break;default:return null}}let r=new RegExp("^"+i+"$").exec(n);if(!r)return null;let s=0,o=1,l=1;return t.forEach((a,f)=>{let m=+r[f+1];a==="Y"?s=m:a==="m"?o=m:l=m}),s?H(s,o,l):null}function ie(n,e,t,i){let r=(n??"").trim();if(r==="")return null;if(e){let a=rr(r,e);return a||null}let s=Yn.exec(r);if(s)return H(+s[1],+s[2],+s[3],+(s[4]??0),+(s[5]??0),+(s[6]??0));if(s=Xn.exec(r),s)return H(+s[1],(+s[2]-1)*3+1,1);if(s=Zn.exec(r),s)return H(+s[2],(+s[1]-1)*3+1,1);if(s=jn.exec(r),s&&+s[2]>=1&&+s[2]<=12)return H(+s[1],+s[2],1);if(s=Jn.exec(r),s)return H(+s[1],+s[2],+s[3]);if(s=qn.exec(r),s)return H(+s[1],+s[2],1);if(s=Qn.exec(r),s){let a=+s[1];return a>=1900&&a<=2100?H(a,1,1):null}let o=nr(r);if(o)return o;if(s=er.exec(r),s){let a=Le(s[1],t,i);if(a)return H(+s[2],a,1)}if(s=tr.exec(r),s){let a=Le(s[2],t,i);if(a)return H(+s[1],a,1)}let l=re(r);if(l){let a="month"in l?l.month:Le(l.word,t,i);if(a)return H(l.year,a,1)}return null}function Ot(n){let e=new Date(n).getUTCDay();return e>=1&&e<=5}function Lt(n,e){if(e<=n)return 0;let t=Math.round((e-n)/ne),i=Math.floor(t/7),r=i*5,s=n+i*7*ne;for(;s<e;)Ot(s)&&r++,s+=ne;return r}function ir(n){if(n.length===0)return 0;let e=[...n].sort((i,r)=>i-r),t=e.length>>1;return e.length%2?e[t]:(e[t-1]+e[t])/2}function sr(n){return n>0?n<.95?"hour":n<=1.05?"day":n>=6.5&&n<=7.5?"week":n>=27&&n<=31.5?"month":n>=88&&n<=93?"quarter":n>=362&&n<=368?"year":"irregular":"irregular"}function le(n,e,t,i){switch(t){case"year":return e.y-n.y;case"quarter":return e.y*4+Math.floor((e.m-1)/3)-(n.y*4+Math.floor((n.m-1)/3));case"month":return e.y*12+e.m-(n.y*12+n.m);case"week":return Math.round((e.ms-n.ms)/(7*ne));case"weekday":return Lt(n.ms,e.ms);case"day":return Math.round((e.ms-n.ms)/ne);default:return i>0?Math.round((e.ms-n.ms)/i):0}}function Pt(n,e){return Pe(n,e)?.cadence??null}function Pe(n,e){let t=e?.gapFactor??Vn,i=0,r=0,s=new Map,o=Array.from(n),l;if(!e?.pattern){let b=[];for(let A of o){if(A==null||A==="")continue;let p=re(String(A));p&&"word"in p&&b.push(p.word)}b.length>0&&(l=ye(b,e?.locale)??void 0)}for(let b of o){if(b==null||b==="")continue;i++;let A=ie(String(b),e?.pattern,e?.locale,l);A&&(r++,s.set(A.ms,A))}let a=[...s.values()].sort((b,A)=>b.ms-A.ms);if(a.length<Hn||i>0&&r/i<.8)return null;let f=a[a.length-1].ms-a[0].ms;if(f<=0)return null;let m=[];for(let b=1;b<a.length;b++)m.push(a[b].ms-a[b-1].ms);let g=ir(m);if(!(g>0))return null;let u=sr(g/ne);u==="day"&&f>=7*ne&&a.every(b=>Ot(b.ms))&&Lt(a[0].ms,a[a.length-1].ms)+1>a.length*.5&&(u="weekday");let S=u==="irregular"?a.length:le(a[0],a[a.length-1],u,g)+1,M=1,I=1,x=[],d=a[0],h=1;for(let b=1;b<a.length;b++){let A=le(a[b-1],a[b],u,g);A>M&&(M=A),u!=="irregular"&&A>t?(I++,x.push({from:d.iso,to:a[b-1].iso,points:h}),d=a[b],h=1):h++}x.push({from:d.iso,to:a[a.length-1].iso,points:h});let y={grain:u,points:a.length,expectedPoints:Math.max(S,a.length),coveragePct:Math.round(a.length/Math.max(S,a.length)*1e3)/10,runs:I,largestGapUnits:M,gapFactor:t};return e?.includeBounds&&x.length<=Kn&&(y.runBounds=x),{cadence:y,points:a,stepMs:g}}var or=8,ar=.5,lr=200,ur=new Set(["category","categories","subcategory","type","types","kind","class","classes","classification","segment","segments","tier","status","priority","severity","grade","level","band","bucket","group","channel","method","mode","stage","phase","period","shift","gender","sex","result","outcome","reason","flag","genre","sector","source"]),cr=["category","classification","segment","status","priority","severity","channel"],mr=new Set(["UUID","EMAIL_LIKE","URL_LIKE","PHONE_LIKE","NUMERIC_ID","HEX_ID","OPAQUE_ID_ALPHANUMERIC","DATE_STR","BOOLEAN"]);function dr(n){let e=J(n);if(e.length===0)return!1;let t=e[e.length-1];return ur.has(t)?!0:cr.some(i=>t.length>i.length&&t.endsWith(i))}function fr(n){if(n.isMeasure)return"measure";if(n.isTemporal||n.isDatePart||n.isReassembledDate)return"temporal";let e=Array.from(n.values).filter(t=>t!==""&&t!==null&&t!==void 0);return e.length<2||e.length>lr?"cardinality":n.rows>0&&e.length>=n.rows?"row-identity":n.isBinaryFlag?"flag":ge(e,n.locale)!==null?"ordinal":n.identifierNamed||n.dataType==="String"&&mr.has(pe(e))?"identifier":!n.geoKind&&dr(n.name)?"attribute":"entity"}function Bt(n){let e=-1,t=1/0,i=!1;return n.forEach((r,s)=>{if(fr(r)!=="entity")return;let o=new Set(Array.from(r.values).filter(a=>a!=="")).size,l=!!r.geoKind;(o<t||o===t&&l&&!i)&&(e=s,t=o,i=l)}),e}var Ft=n=>n<10?"0"+n:String(n);function Wt(n,e){switch(e){case"year":return`${n.y}-01-01`;case"quarter":return`${n.y}-${Ft(Math.floor((n.m-1)/3)*3+1)}-01`;case"month":return`${n.y}-${Ft(n.m)}-01`;case"hour":return new Date(n.ms).toISOString().replace(/\.\d{3}Z$/,"Z");default:return n.iso}}function Gt(n){let{periods:e,series:t}=n,i=Math.min(e.length,t.length),r=new Set;for(let A=0;A<i;A++)e[A]&&r.add(e[A]);let s=Pe(r,{pattern:n.pattern,locale:n.locale});if(!s)return null;let o=s.cadence.grain;if(o==="irregular")return null;let l=s.points[0],a=le(l,s.points[s.points.length-1],o,s.stepMs)+1;if(a!==s.cadence.expectedPoints)return null;let f=new Map;for(let A of r){let p=ie(A,n.pattern,n.locale);if(!p)continue;let w=le(l,p,o,s.stepMs);w>=0&&w<a&&f.set(A,{idx:w,stamp:p})}let m=new Map;for(let A=0;A<i;A++){let p=t[A];if(!p)continue;let w=f.get(e[A]);if(!w)continue;let T=m.get(p);T||(T={seen:new Set,lo:w.idx,hi:w.idx,loStamp:w.stamp,hiStamp:w.stamp,order:m.size},m.set(p,T)),T.seen.add(w.idx),w.idx<T.lo&&(T.lo=w.idx,T.loStamp=w.stamp),w.idx>T.hi&&(T.hi=w.idx,T.hiStamp=w.stamp)}if(m.size<2)return null;let g=0;for(let A of m.values())g+=A.seen.size;if(g/(m.size*a)<(n.minFill??ar))return null;let u=[],S=new Set,M=0,I=0,x=0,d=0,h=0,y=1;for(let[A,p]of m){for(let $ of p.seen)S.add($);if(p.seen.size>=a)continue;let w=[...p.seen].sort(($,j)=>$-j),T=1;for(let $=1;$<w.length;$++)T=Math.max(T,w[$]-w[$-1]);let V={key:A,acc:p,coverage:p.seen.size/a,before:p.lo,after:a-1-p.hi,interior:p.hi-p.lo+1-p.seen.size,gap:T};u.push(V),V.before>0&&M++,V.after>0&&I++,V.interior>0&&x++,d=Math.max(d,V.before),h=Math.max(h,V.after),y=Math.max(y,T)}if(u.length===0)return null;u.sort((A,p)=>A.coverage-p.coverage||A.acc.order-p.acc.order);let b=u.slice(0,n.maxListed??or);return{seriesColumn:n.seriesColumn,grain:o,periods:a,seriesCount:m.size,incompleteSeries:u.length,lateStarts:M,earlyEnds:I,withHoles:x,columnWideMissing:a-S.size,maxMissingBefore:d,maxMissingAfter:h,largestGap:y,series:b.map(A=>{let p={};return n.includeNames&&(p.name=A.key),n.includeDates&&(p.first=Wt(A.acc.loStamp,o),p.last=Wt(A.acc.hiStamp,o)),p.missingBefore=A.before,p.missingAfter=A.after,p.missingInterior=A.interior,p.largestGap=A.gap,p.coverage=Math.round(A.coverage*1e3)/1e3,p}),more:u.length-b.length}}var gr=5e5,pr=8,hr=4,yr=5,Fe=1,We=2,br=4,Sr=8;function _r(n,e,t){let[i,r]=[...n];if(e.isTemporal){let s=ie(i,e.temporalTextPattern,t),o=ie(r,e.temporalTextPattern,t);if(s&&o&&s.ms!==o.ms)return s.ms<o.ms?{a:i,b:r,setOrder:"temporal"}:{a:r,b:i,setOrder:"temporal"}}return i<r?{a:i,b:r,setOrder:"none"}:{a:r,b:i,setOrder:"none"}}function Ar(n,e,t){let{rows:i,text:r,locale:s}=n,o=_r(t.values,t,s),l=new Uint8Array(i.length),a=0;for(let f=0;f<i.length;f++){let m=r(i[f][e]);m===o.a?l[f]=1:m===o.b?l[f]=2:a++}return{code:l,blankRows:a,setOrder:o.setOrder}}function xr(n,e){let{rows:t,text:i}=n,r=new Int32Array(t.length),s=new Map;for(let o=0;o<t.length;o++){let l=i(t[o][e]);if(l===""){r[o]=-1;continue}let a=s.get(l);a===void 0&&(a=s.size,s.set(l,a)),r[o]=a}return{ids:r,dict:s}}function Cr(n,e,t){let i=new Uint8Array(t);for(let s=0;s<n.length;s++){let o=e[s];if(o===0)continue;let l=n[s];if(l<0)continue;let a=i[l];i[l]=a&o?a|o<<2:a|o}let r={keysA:0,keysB:0,keysBoth:0,dupA:0,dupB:0};for(let s=0;s<t;s++){let o=i[s];o&Fe&&r.keysA++,o&We&&r.keysB++,(o&(Fe|We))===(Fe|We)&&r.keysBoth++,o&br&&r.dupA++,o&Sr&&r.dupB++}return r}function Mr(n,e){let t=(n.dupA+n.dupB)*(e.keysA+e.keysB),i=(e.dupA+e.dupB)*(n.keysA+n.keysB);return t<i||t===i&&n.keysBoth>e.keysBoth}var zt=n=>n==null||typeof n=="string"&&n.trim()==="";function Tr(n,e,t){if(n===e)return!0;let i=zt(n),r=zt(e);return i||r?i&&r:typeof n=="number"&&typeof e=="number"?!1:n instanceof Date&&e instanceof Date?n.getTime()===e.getTime():t(n).trim()===t(e).trim()}function $t(n){let{rows:e,columns:t}=n,i=e.length;if(i<2||i>gr)return null;let r=t.map((p,w)=>({c:p,i:w})).filter(({c:p})=>!p.isMeasure&&!p.isTemporal&&!p.isDatePart&&p.distinct>=yr).sort((p,w)=>(w.c.identifierNamed?1:0)-(p.c.identifierNamed?1:0)||w.c.distinct-p.c.distinct||p.i-w.i).slice(0,pr),s=t.map((p,w)=>({c:p,i:w})).filter(({c:p})=>!p.isMeasure&&p.values!==null&&p.values.size===2).slice(0,hr);if(r.length===0||s.length===0)return null;let o=s.map(({c:p,i:w})=>Ar(n,w,p)),l=null;for(let{i:p}of r){let w=xr(n,p);for(let T=0;T<s.length;T++){if(s[T].i===p)continue;let V=Cr(w.ids,o[T].code,w.dict.size);V.keysBoth<1||(!l||Mr(V,l.tally))&&(l={tally:V,keyIdx:p,setNo:T,ids:w.ids,dict:w.dict})}}if(!l)return null;let{ids:a,dict:f,tally:m}=l,g=o[l.setNo],u=s[l.setNo].i,S=f.size,M=new Int32Array(S).fill(-1),I=new Int32Array(S).fill(-1);for(let p=0;p<i;p++){let w=g.code[p],T=a[p];w===0||T<0||(w===1?M[T]<0&&(M[T]=p):I[T]<0&&(I[T]=p))}let x=[];for(let p=0;p<t.length;p++)p!==l.keyIdx&&p!==u&&x.push(p);let d=0;for(let p=0;p<S;p++){let w=M[p],T=I[p];if(w<0||T<0)continue;let V=e[w],$=e[T],j=!0;for(let q of x)if(!Tr(V[q],$[q],n.text)){j=!1;break}j&&d++}let h=d===m.keysBoth?100:d===0?0:Math.min(99,Math.max(1,Math.round(d/m.keysBoth*100))),y=new Map,b=new Map;for(let[p,w]of f){let T=M[w]>=0,V=I[w]>=0;if(!T&&!V)continue;let $=tt(p);nt($)&&(T&&y.set($,(y.get($)??0)+1),V&&b.set($,(b.get($)??0)+1))}let A=p=>{let w=0;for(let T of p.values())T>=2&&(w+=T);return w};return{key:l.keyIdx,discriminator:u,pairing:{form:"long",key:t[l.keyIdx].name,discriminator:t[u].name,keysA:m.keysA,keysB:m.keysB,keysBoth:m.keysBoth,duplicateKeysA:m.dupA,duplicateKeysB:m.dupB,identicalPct:h,discriminatorBlankRows:g.blankRows,looseCollisionsA:A(y),looseCollisionsB:A(b),setOrder:g.setOrder}}}var wr=n=>n==="Integer"||n==="Decimal";function Rr(n){let e=[],t=[];return n.forEach((i,r)=>{if(i.twoValues){if(i.isBinaryFlag){e.push(r);return}i.isMeasure||i.isTemporal||i.isDatePart||i.identifierNamed||t.push(r)}}),[...e,...t].slice(0,6)}function Ir(n,e){let t=[];for(let i=0;i<n.length&&t.length<12;i++){let r=n[i];e.has(i)||!wr(r.dataType)||r.isTemporal||r.isDatePart||r.identifierNamed||r.distinct<3||t.push(i)}return t}function Ut(n){let e=new Map,{rows:t,columns:i,text:r}=n;if(t.length===0||t.length>(n.maxRows??5e5))return e;let s=Rr(i);if(s.length===0)return e;let o=Ir(i,new Set(s));if(o.length===0)return e;let l=s.map(a=>{let[f,m]=i[a].twoValues,g=new Uint8Array(t.length);for(let u=0;u<t.length;u++){let S=r(t[u][a]);g[u]=S===f?1:S===m?2:0}return g});for(let a of o){let f=new Float64Array(t.length),m=0;for(let h=0;h<t.length;h++){let y=t[h][a],b=y==null||y===""?NaN:typeof y=="number"?y:parseFloat(y);f[h]=b,b===b&&b!==1/0&&b!==-1/0&&m++}if(m<2)continue;let g=new Float64Array(m);for(let h=0,y=0;h<t.length;h++){let b=f[h];b===b&&b!==1/0&&b!==-1/0&&(g[y++]=b)}g.sort();let u=new Float64Array(m),S=0;for(let h=0;h<m;h++)(h===0||g[h]!==g[h-1])&&(u[S++]=g[h]);let M=new Int32Array(t.length).fill(-1);for(let h=0;h<t.length;h++){let y=f[h];if(!(y===y&&y!==1/0&&y!==-1/0))continue;let b=0,A=S-1;for(;b<A;){let p=b+A>>>1;u[p]<y?b=p+1:A=p}M[h]=b}let I=[],x=new Int32Array(S),d=new Int32Array(S);for(let h=0;h<s.length;h++){let y=l[h];x.fill(0),d.fill(0);let b=0,A=0;for(let c=0;c<t.length;c++){let _=M[c];_<0||(y[c]===1?(x[_]++,b++):y[c]===2&&(d[_]++,A++))}if(b===0||A===0)continue;let p=b<=A,w=p?b:A,T=p?A:b,V=p?x:d,$=p?d:x,j=0,q=0,Y=0;for(let c=0;c<S;c++){let _=V[c],F=$[c];j+=_*(q+.5*F),q+=F,_+F>=2&&(Y+=_+F)}I.push({outcome:i[s[h]].name,aucMinorityHigh:Math.round(j/(w*T)*1e4)/1e4,nMinority:w,nMajority:T,ties:Y})}I.length>0&&e.set(a,I)}return e}var Nr=12,Er=100,vr=.3,kr=.9,Dr=120,Or=1900,Lr=2100,Pr=0,Fr=20,Wr=new Set(["id","ids","uuid","guid","key","zip","zipcode","postal","postalcode","ssn","code","codes","sku","isbn","msisdn","imei"]);function Te(n){if(!n)return!1;let e=J(n);return e.length===0?!1:Wr.has(e[e.length-1])?!0:Et(n)!==null}var Br=new Set(["year","yr","fy"]),Gr=n=>J(n).some(e=>Br.has(e))||et(n)!==null,zr=/^(?:(?:19|20)\d{2}(?:[-/ ]?(?:q[1-4]|w(?:0?[1-9]|[1-4]\d|5[0-3])|(?:0?[1-9]|1[0-2])))?|q[1-4][-/ ](?:19|20)\d{2}|(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*[-/ ]?(?:19|20)?\d{2})$/i;function Be(n){if(!Number.isInteger(n)||n<190001||n>210012)return!1;let e=n%100;return e>=1&&e<=12}function Ge(n){if(!Number.isInteger(n)||n<19000101||n>21001231)return!1;let e=Math.floor(n/100)%100,t=n%100;return e>=1&&e<=12&&t>=1&&t<=31}var $r=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,Ur=/^(\d{4})([\/.])(\d{1,2})\2(\d{1,2})$/,Vr=/^(\d{1,2})([\/.\-])(\d{1,2})\2(\d{4})(?:[ T](\d{2}):(\d{2})(?::(\d{2}))?)?$/;function Yt(n,e){let t=[],i=0,r=Kr(n,e,t,()=>{i++});if(r)return r;if(i>0||t.length<2)return null;let s=gt(t,{locale:e,floor:.8});return!s||!s.pattern||s.form==="named"?null:{pattern:s.pattern,orderFrom:s.orderFrom==="shape"?s.order==="ymd"?"iso":"shape":s.orderFrom}}function Kr(n,e,t,i){let r=0,s=0,o=0,l=0,a=0,f="",m=0,g="",u=0,S=0,M=0,I=0,x=!1;for(let p of n){if(p==null)continue;let w=String(p).trim();if(w==="")continue;r++,t.push(w);let T;if(T=$r.exec(w)){i();let V=+T[2],$=+T[3];V>=1&&V<=12&&$>=1&&$<=31&&(s++,T[4]!==void 0&&o++,T[6]!==void 0&&l++)}else if(T=Ur.exec(w)){i();let V=+T[3],$=+T[4];V>=1&&V<=12&&$>=1&&$<=31&&(f&&f!==T[2]&&(x=!0),f=T[2],a++)}else if(T=Vr.exec(w)){i();let V=+T[1],$=+T[3];V>=1&&V<=31&&$>=1&&$<=31&&(V<=12||$<=12)&&(g&&g!==T[2]&&(x=!0),g=T[2],m++,V>12&&M++,$>12&&I++,T[5]!==void 0&&u++,T[7]!==void 0&&S++)}if(r>=200)break}if(r<2||(s+a+m)/r<.8||(s>0?1:0)+(a>0?1:0)+(m>0?1:0)!==1||x)return null;if(s>0)return o===s?{pattern:l===s?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M",orderFrom:"iso"}:{pattern:"%Y-%m-%d",orderFrom:"iso"};if(a>0)return{pattern:`%Y${f}%m${f}%d`,orderFrom:"iso"};if(M>0&&I>0)return null;let y,b;M>0?(y=!0,b="values"):I>0?(y=!1,b="values"):g==="."?(y=!0,b="shape"):(y=!ve(e),b="locale");let A=y?`%d${g}%m${g}%Y`:`%m${g}%d${g}%Y`;return u===m?{pattern:A+(S===m?" %H:%M:%S":" %H:%M"),orderFrom:b}:{pattern:A,orderFrom:b}}function Hr(n,e){if(!e||!/\b(?:19|20)\d{2}\b/.test(n))return!1;let t=n.replace(/\b(?:19|20)\d{2}\b/g,"").replace(/[-/.,]/g," ").trim();if(!t)return!1;let i=ee(t);return i.length>0&&e[i]!==void 0}function Yr(n,e){let t=new Map,i=new Map;for(let l of n){let a=re(l);if(!a||"month"in a)continue;let f=se(a.word),m=f.some(u=>u.lang==="en"),g=ee(a.word);for(let u of new Set(f.map(S=>S.lang)))u!=="en"&&(t.has(u)||(t.set(u,new Set),i.set(u,new Set)),t.get(u).add(g),m||i.get(u).add(g))}let r=[...t.keys()].filter(l=>t.get(l).size>=3&&i.get(l).size>=1),s=0,o=new Map(r.map(l=>[l,0]));for(let l of e){let a=re(l);if(!a)continue;if("month"in a){s++;continue}let f=se(a.word);if(f.length===0)continue;let m=f.some(g=>g.lang==="en");for(let g of r)(m||f.some(u=>u.lang===g))&&o.set(g,o.get(g)+1)}return s+Math.max(0,...o.values())}var jr=/(?:19|20)[0-9]{2}/;function Xr(n){let e=new Map,t=0;for(let r of n){if(!jr.test(ce(r)))continue;let s=new Set(fe(r).filter(o=>o.yearDigits===4&&(o.grain==="quarter"||o.grain==="week")).map(o=>o.lang));if(s.size!==0){if(s.has("en")){t++;continue}for(let o of s)e.set(o,(e.get(o)??0)+1)}}let i=0;for(let r of e.values())i=Math.max(i,r);return i>0?i+t:0}function Zr(n){let{dataType:e,name:t,isMeasure:i,distinctCount:r}=n;if(e==="DateTime")return!0;if(i)return!1;if(e==="Integer"||e==="Decimal"){let s=n.minNum,o=n.maxNum;if(!(s!=null&&o!=null&&Number.isFinite(s)&&Number.isFinite(o)&&Number.isInteger(s)&&Number.isInteger(o)&&o>=s))return!1;let a=s>=1900&&o<=2100;if(a&&r>=2&&Gr(t)||a&&r>=3&&r===o-s+1)return!0;let f=Be(s)&&Be(o),m=Ge(s)&&Ge(o);if(f||m){if(!n.sampleValues)return!0;let g=0,u=0;for(let S of n.sampleValues){if(S==null||S==="")continue;g++;let M=Number(String(S).trim());if(Number.isFinite(M)&&(f?Be(M):Ge(M))&&u++,g>=60)break}if(g>=2&&u===g)return!0}return!1}if(n.sampleValues){let s=n.locale?he(n.locale):null,o=0,l=0,a=[],f=[];for(let m of n.sampleValues){if(m==null||m==="")continue;o++;let g=String(m).trim();if(a.push(g),zr.test(g)||Hr(g,s)?l++:f.push(g),o>=60)break}if(o>=2&&l/o>=.8||o>=2&&(l+Xr(f)+Yr(a,f))/o>=.8||Yt(a,n.locale)!==null)return!0}return!1}function Qr(n){let e=Q((n||"").trim().toLowerCase());return e.startsWith("sum ")||e.startsWith("total ")?"sum":e.startsWith("average ")||e.startsWith("avg. ")?"avg":e.startsWith("count ")||e.startsWith("distinct count ")||e.startsWith("count (distinct) ")?"count":e.startsWith("min ")||e.startsWith("minimum ")?"min":e.startsWith("max ")||e.startsWith("maximum ")?"max":_t(n)}function qr(n){let{rows:e,measureColIdx:t,measureName:i,candidateDims:r,minNum:s,maxNum:o,discourageAgg:l}=n,a=100,f=.01,m="";for(let u of r){if(u.distinct<2||u.distinct>a)continue;let S=r.filter(h=>h.idx!==u.idx).map(h=>h.idx),M=new Map;for(let h of e){let y=h[t];if(typeof y!="number"||!Number.isFinite(y))continue;let b=S.length?S.map(p=>String(h[p])).join(m):"",A=M.get(b);A||(A={sum:0,cset:new Set},M.set(b,A)),A.sum+=y,A.cset.add(String(h[u.idx]))}let I=0,x=0,d=0;for(let h of M.values())h.cset.size<2||(d++,Math.abs(h.sum-100)<=100*f?I++:Math.abs(h.sum-1)<=1*f&&x++);if(d>=2&&(I/d>=.9||x/d>=.9))return{additivity:"part_of_whole",partOfWholeDim:u.name}}if(l)return{additivity:"intensive_rate"};let g=Qr(i);return g==="avg"||g==="min"||g==="max"?{additivity:"intensive_rate"}:g==="count"?{additivity:"additive"}:g==="sum"?{additivity:"unknown"}:s!=null&&o!=null&&Number.isFinite(s)&&Number.isFinite(o)&&s>=0&&o<=1.0001&&o>0?{additivity:"intensive_rate"}:{additivity:"unknown"}}function jt(n){let{dataType:e,isMeasure:t,name:i,distinct:r,nonblank:s,prec:o,maxval:l,minval:a}=n,f=l-a+1,m=f>0?r/f:1,g=s>0?r/s:0,u=e==="Decimal"||o>0;return!t&&Te(i)?"Categorical":m>=kr&&(rt(i)&&r<=Dr||a>=Or&&l<=Lr||a>=Pr&&l<=Fr)?"Ordinal":t||r>Nr&&(u||r>=Er||g>=vr)?"Continuous":"Categorical"}function Kt(n,e,t){return!n||n.isMeasure||e||n.dataType!=="Integer"&&n.dataType!=="Decimal"?!1:jt({dataType:n.dataType,isMeasure:!1,name:n.name,distinct:t.distinct,nonblank:t.nonblank,prec:t.prec,maxval:typeof t.maxval=="number"?t.maxval:0,minval:typeof t.minval=="number"?t.minval:0})==="Continuous"}function Jr(n){let e=null;for(let t=0;t<n.length;t++){let i=n[t];if(typeof i!="string"||i.length===0)continue;let r=i.trim();r.length!==i.length&&(e||(e=n.slice()),e[t]=r)}return e||n}var Ht=class{_computedStatsForLevel=null;_cols=[];_rows=[];_origIndices=[];_rowHashes=new Set;_hostQueryNames=[];_englishAliases=new Map;_declaredDimensions=new WeakSet;_inferredMeasureFlags=null;dedupRows=!0;emitLegacyAggAliases=!1;dateCellsAreLocalWallClock=!1;wallClockColumnIndexes(){let e=new Set;if(!this.dateCellsAreLocalWallClock||!this._cols)return e;for(let t=0;t<this._cols.length;t++){let i=this._cols[t];!i||!/date|time/i.test(String(i.dataType??""))||qe(this._rows.map(r=>r[t]))&&e.add(t)}return e}STR(e){return e==null?"":e instanceof Date?this.wholeDayIso(e)??(isNaN(e.getTime())?"":e.toISOString()):e.toString()}getPrecision(e){if(!isFinite(e))return 0;let i=e.toString().split(".")[1];return i?i.length:0}getColumns(){return this._cols}inferredMeasureFlags(){if(this._inferredMeasureFlags)return this._inferredMeasureFlags;let e=this._cols.map(t=>!!(t&&t.isMeasure));return this._cols.forEach((t,i)=>{if(!t||t.isMeasure||this._declaredDimensions.has(t)||t.dataType!=="Integer"&&t.dataType!=="Decimal")return;let r=new Set,s=0,o=0,l=null,a=null;for(let f of this._rows){let m=f[i],g=this.STR(m);if(g!=""&&(r.add(g),s++,(l===null||m<l)&&(l=m),(a===null||m>a)&&(a=m),t.dataType=="Decimal")){let u=this.getPrecision(m);u>o&&(o=u)}}e[i]=Kt(t,!1,{distinct:r.size,nonblank:s,prec:o,minval:l,maxval:a})}),Object.freeze(e),this._inferredMeasureFlags=e,e}declareDimensions(e){this._inferredMeasureFlags=null;for(let t of e)t&&this._declaredDimensions.add(t)}wholeDayIso(e){return Qe(e)}hasTimeComponent(e){return!(e instanceof Date)||isNaN(e.getTime())?!1:this.wholeDayIso(e)===null}getColumnsWithStats(e,t){if(this._computedStatsForLevel==e)return this._cols;let i=0,r=parseInt(e),s=this.wallClockColumnIndexes(),o=[],l=[],a=[];for(let c of this._cols){let _=new Map,F=[],D=0,C=0,k=0,P=null,O=null,v=null,G=!1,z=!0,N=!0,E=null,U=!1,L=s.has(i);for(let R of this._rows){let W=R[i],B=L&&W instanceof Date?de(W):W,K=this.STR(B);if(K!=""){if(D+=K.length,_.set(K,(_.get(K)||0)+1),C++,c.dataType=="Integer"||c.dataType=="Decimal"||c.dataType=="DateTime")if((P===null||B<P)&&(P=B),(O===null||B>O)&&(O=B),c.dataType=="Integer"||c.dataType=="Decimal"){if(v===null?v=B:v+=B,c.dataType=="Decimal"){let X=this.getPrecision(B);X>k&&(k=X)}F.push(B)}else G=G||this.hasTimeComponent(B);U&&(B<E?z=!1:B>E&&(N=!1)),E=B,U=!0}}if(C>=3&&(z&&!N?c.sortedDirection="asc":N&&!z?c.sortedDirection="desc":c.sortedDirection="none"),C>0&&_.size>0&&!c.isMeasure){let R=0,W=Number.MAX_SAFE_INTEGER;for(let B of _.values())B>R&&(R=B),B<W&&(W=B);if(c.modalShare=R/C,c.minGroupCount=W===Number.MAX_SAFE_INTEGER?null:W,_.size===2){let B=[..._.keys()].map(ue=>je(ue).trim().toLowerCase()).sort(),X=[["false","true"],["no","yes"],["n","y"],["0","1"],["f","t"]].some(ue=>B[0]===ue[0]&&B[1]===ue[1]),Xt=/^(is|has)[_\p{L}\p{N}]|(?:default|churn|fraud|approv|convert|active|cancel|delinquen|flag|paid|win|pass|fail)/iu.test(c.name);(X||Xt)&&(c.isBinaryFlag=!0)}}else c.isMeasure&&(c.dataType==="Integer"||c.dataType==="Decimal")&&_.size===2&&_.has("0")&&_.has("1")&&(c.isBinaryFlag=!0);if(c.dataType=="DateTime"&&(c.dateWithTime=G,G&&Je(L?this._rows.map(R=>R[i]instanceof Date?de(R[i]):R[i]):this._rows.map(R=>R[i]))?c.timeOfDayOnly=!0:delete c.timeOfDayOnly),c.isTemporal=Zr({dataType:c.dataType,name:c.name,isMeasure:c.isMeasure,distinctCount:_.size,minNum:typeof P=="number"?P:null,maxNum:typeof O=="number"?O:null,sampleValues:_.keys(),locale:t}),c.isTemporal&&c.dataType==="String"&&!c.isMeasure){let R=Yt(_.keys(),t);R&&(c.temporalTextPattern=R.pattern)}if(c.isTemporal&&!c.isMeasure){let R=Pt(_.keys(),{includeBounds:r>=20,pattern:c.temporalTextPattern,locale:t});R&&(c.temporalCadence=R)}this.updateColumnStats10(r,c,C,_,k,O,P),this.updateColumnStats20(r,F,C,v,c,D,G,P,O,k,_,t),Kt(c,this._declaredDimensions.has(c),{distinct:_.size,nonblank:C,prec:k,minval:P,maxval:O})&&(c.isMeasure=!0,c.geoKind=void 0,c.geoMatchPct=void 0,c.geoAmbiguous=void 0,c.dominantGeoRegion=void 0,c.dominantGeoRegionPct=void 0,c.geoRegionCount=void 0),o[i]=c.isMeasure||_.size>2e3?null:new Set(_.keys()),l[i]=_.size,a[i]=_.size===2?[..._.keys()].sort():null,i++}let f=[];this._cols.forEach((c,_)=>{c.isMeasure||f.push({idx:_,distinct:c.distinctCount??0,name:c.name})}),this._cols.forEach((c,_)=>{if(!c.isMeasure)return;let F=typeof c.lowValue=="number"?c.lowValue:null,D=typeof c.highValue=="number"?c.highValue:null,C=qr({rows:this._rows,measureColIdx:_,measureName:c.name,candidateDims:f,minNum:F,maxNum:D,discourageAgg:!!c.discourageAggregationAcrossGroups});c.additivity=C.additivity,C.partOfWholeDim&&(c.partOfWholeDim=C.partOfWholeDim)});let m=50,g=4,u=f.filter(c=>c.distinct>=2&&c.distinct<=m);this._cols.forEach((c,_)=>{if(!c.isMeasure)return;let F=[];for(let N of this._rows){let E=N[_];if(E==null||E==="")continue;let U=typeof E=="number"?E:parseFloat(E);isNaN(U)||F.push(U)}if(F.length===0)return;let D=[...F].sort((N,E)=>N-E);if(D[0]===D[D.length-1])c.relativeDispersion=0;else if(D.length>=g){let N=Z(D,.5),E=Z(D,.1),U=Z(D,.9);c.relativeDispersion=Math.abs(N)>1e-9?Math.round((U-E)/Math.abs(N)*1e3)/1e3:void 0}else c.relativeDispersion=void 0;let C=[];for(let N of u){let E=new Set;for(let U of this._rows){let L=U[_];L==null||L===""||E.add(this.STR(U[N.idx])+"")}C.push({otherColumn:N.name,nonBlankGroupCount:E.size})}C.length>0&&(c.nonBlankGroups=C);let k=0;for(let N of F)k+=N;k/=F.length;let P=0;for(let N of F)P+=(N-k)*(N-k);if(P<=1e-12)return;let O=[],v=[],G=N=>{if(N.length<4)return NaN;let E=[...N].sort((L,R)=>L-R),U=L=>E[Math.min(E.length-1,Math.max(0,Math.floor(L*(E.length-1))))];return U(.75)-U(.25)},z=G(F);for(let N of u){let E=new Map;for(let R of this._rows){let W=R[_];if(W==null||W==="")continue;let B=typeof W=="number"?W:parseFloat(W);if(isNaN(B))continue;let K=this.STR(R[N.idx])+"",X=E.get(K);X?(X.s+=B,X.n++,X.vals.push(B)):E.set(K,{s:B,n:1,vals:[B]})}let U=0;for(let R of E.values()){let W=R.s/R.n;U+=R.n*(W-k)*(W-k)}O.push({otherColumn:N.name,eta2:Math.round(U/P*1e4)/1e4});let L=[];for(let R of E.values()){let W=G(R.vals);isNaN(W)||L.push(W)}if(L.length>=2&&isFinite(z)&&z>1e-9){let R=(Math.max(...L)-Math.min(...L))/z;v.push({otherColumn:N.name,spreadRatio:Math.round(R*1e4)/1e4})}}O.length>0&&(c.groupDiscrimination=O),v.length>0&&(c.spreadDiscrimination=v)});let S=.97,M=.8,I=8,x=5,d=this._cols.map((c,_)=>({c,i:_})).filter(c=>c.c.isMeasure);for(let c=0;c<d.length;c++)for(let _=c+1;_<d.length;_++){let F=d[c].i,D=d[_].i,C=0,k=0,P=0,O=0,v=0,G=0;for(let L of this._rows){let R=L[F],W=L[D];if(R==null||R===""||W===null||W===void 0||W==="")continue;let B=typeof R=="number"?R:parseFloat(R),K=typeof W=="number"?W:parseFloat(W);isNaN(B)||isNaN(K)||(C++,k+=B,P+=K,O+=B*B,v+=K*K,G+=B*K)}if(C<x)continue;let z=C*O-k*k,N=C*v-P*P;if(z<=1e-12||N<=1e-12)continue;let E=(C*G-k*P)/Math.sqrt(z*N),U=Math.min(1,Math.round(Math.abs(E)*1e3)/1e3);for(let L of[d[c].c,d[_].c])(L.maxAbsMeasureCorrelation===void 0||U>L.maxAbsMeasureCorrelation)&&(L.maxAbsMeasureCorrelation=U);if(Math.abs(E)>=S){let L=d[c].c,R=d[_].c;L.collinearWithMeasures||(L.collinearWithMeasures=[]),R.collinearWithMeasures||(R.collinearWithMeasures=[]),L.collinearWithMeasures.push(R.name),R.collinearWithMeasures.push(L.name)}else if(Math.abs(E)>=M){let L=d[c].c,R=d[_].c,W=Math.round(E*1e3)/1e3;L.correlatedWithMeasures||(L.correlatedWithMeasures=[]),R.correlatedWithMeasures||(R.correlatedWithMeasures=[]),L.correlatedWithMeasures.push({otherColumn:R.name,r:W}),R.correlatedWithMeasures.push({otherColumn:L.name,r:W})}}for(let{c}of d)c.correlatedWithMeasures&&(c.correlatedWithMeasures.sort((_,F)=>Math.abs(F.r)-Math.abs(_.r)||(_.otherColumn<F.otherColumn?-1:1)),c.correlatedWithMeasures.length=Math.min(c.correlatedWithMeasures.length,I));for(let c=0;c<this._cols.length;c++){let _=o[c];if(!_||_.size===0)continue;let F=[];for(let D=0;D<this._cols.length;D++){if(D===c)continue;let C=o[D];if(!C||C.size===0)continue;let k=0;for(let O of _)C.has(O)&&k++;let P=Math.round(k/_.size*100);P>0&&F.push({otherColumn:this._cols[D].name,percentShared:P})}F.length>0&&(this._cols[c].sharedValueRatioWithOthers=F)}let h=50,y=[];for(let c=0;c<this._cols.length;c++){let _=o[c];_&&_.size>=2&&_.size<=h&&y.push(c)}if(y.length>=2){let c=new Map,_=(D,C)=>D+":"+C;for(let D=0;D<y.length;D++)for(let C=D+1;C<y.length;C++)c.set(_(y[D],y[C]),new Map);for(let D of this._rows)for(let C=0;C<y.length;C++){let k=this.STR(D[y[C]])+"";for(let P=C+1;P<y.length;P++){let O=""+this.STR(D[y[P]]),v=c.get(_(y[C],y[P])),G=k+""+O;v.set(G,(v.get(G)??0)+1)}}let F=new Map;for(let D=0;D<y.length;D++)for(let C=D+1;C<y.length;C++){let k=y[D],P=y[C],O=o[k].size,v=o[P].size,G=c.get(_(k,P)),z=G.size,N=0;for(let R of G.values())(N===0||R<N)&&(N=R);let E=Math.round(z/(O*v)*100),U=z===O,L=z===v;if((this._cols[k].categoricalPairStats||=[]).push({otherColumn:this._cols[P].name,fillPct:E,determinesOther:U,minCellCount:N,distinctCombinations:z}),(this._cols[P].categoricalPairStats||=[]).push({otherColumn:this._cols[k].name,fillPct:E,determinesOther:L,minCellCount:N,distinctCombinations:z}),U&&O>v){let R=F.get(k);(!R||v<R.card)&&F.set(k,{name:this._cols[P].name,card:v,ratio:v/O})}if(L&&v>O){let R=F.get(P);(!R||O<R.card)&&F.set(P,{name:this._cols[k].name,card:O,ratio:O/v})}}for(let[D,C]of F)this._cols[D].primaryParentColumn=C.name,this._cols[D].nestingRatio=Math.round(C.ratio*100)/100}let b=6,A=this._rows.length;for(let c=0;c<this._cols.length;c++){let _=this._cols[c];if(_.isMeasure||_.primaryParentColumn)continue;let F=_.distinctCount??0;if(F<=h||A>0&&F>=A)continue;let D=[];for(let C=0;C<this._cols.length;C++){if(C===c)continue;let k=this._cols[C];if(k.isMeasure)continue;let P=k.distinctCount??0;P<2||P>=F||D.push(C)}D.sort((C,k)=>(this._cols[C].distinctCount??0)-(this._cols[k].distinctCount??0));for(let C of D.slice(0,b)){let k=new Map,P=!0;for(let v of this._rows){let G=this.STR(v[c])+"",z=this.STR(v[C])+"",N=k.get(G);if(N===void 0)k.set(G,z);else if(N!==z){P=!1;break}}if(!P)continue;let O=this._cols[C].distinctCount??0;_.primaryParentColumn=this._cols[C].name,_.nestingRatio=Math.round(O/F*100)/100;break}}let p=.01,w=.05,T=.95,V=8,$=8,j=6,q=500,Y=[];for(let c=0;c<this._cols.length&&Y.length<$;c++){let _=this._cols[c].dataType;(_==="Double"||_==="Integer"||_==="Decimal")&&Y.push(c)}if(Y.length>=3&&this._rows.length>=V){let c=Math.min(this._rows.length,q),_=Y.map(O=>{let v=[];for(let N=0;N<c;N++){let E=this._rows[N][O],U=typeof E=="number"?E:parseFloat(String(E).replace(/,/g,""));if(E==null||E===""||!isFinite(U))return null;v.push(U)}let G=v[0],z=!1;for(let N of v)if(N!==G){z=!0;break}return z?v:null}),F=Y.map((O,v)=>v).filter(O=>_[O]!==null),D=O=>{let v=O.slice().sort((z,N)=>z-N),G=v.length>>1;return v.length%2?v[G]:(v[G-1]+v[G])/2},C=null,k=[],P=O=>{if(k.length>=3){let v=k.map(E=>_[E]),G=v[0].length,z=new Array(G);for(let E=0;E<G;E++){let U=0;for(let L of v)U+=L[E];z[E]=U}let N=D(z);if(N>0){let E=0;for(let L of z)Math.abs(L-N)<=N*p&&E++;let U=E/G;if(U>=T){let L=1;for(let R of v){let W=D(R)/N;W<L&&(L=W)}L>=w&&(!C||k.length>C.cols.length)&&(C={cols:k.slice(),total:N,matched:U})}}}if(!(k.length>=j))for(let v=O;v<F.length;v++)k.push(F[v]),P(v+1),k.pop()};if(P(0),C){let O=C,G={columns:O.cols.map(z=>this._cols[Y[z]].name),total:Math.round(O.total*1e3)/1e3,matchedPct:Math.round(O.matched*100)/100};for(let z of O.cols)this._cols[Y[z]].constantSumGroup=G}}return this.applyTwoSetPairing(t,o),this.applyScoreSeparation(l,a),this.applySeriesCompleteness(r,t,o),this._computedStatsForLevel=e,this._cols}applyTwoSetPairing(e,t){for(let r of this._cols)r.twoSetPairing!==void 0&&delete r.twoSetPairing;let i=$t({rows:this._rows,columns:this._cols.map((r,s)=>{let o=t[s];return{name:r.name,values:o,distinct:o?o.size:r.distinctCount??0,isMeasure:!!r.isMeasure,isTemporal:!!r.isTemporal,isDatePart:!!r.isDatePart,identifierNamed:Te(r.name),temporalTextPattern:r.temporalTextPattern}}),text:r=>this.STR(r),locale:e});i&&(this._cols[i.key].twoSetPairing=i.pairing,this._cols[i.discriminator].twoSetPairing=i.pairing)}applyScoreSeparation(e,t){for(let r of this._cols)r.scoreSeparation!==void 0&&delete r.scoreSeparation;let i=Ut({rows:this._rows,columns:this._cols.map((r,s)=>({name:r.name,dataType:r.dataType,isMeasure:!!r.isMeasure,isTemporal:!!r.isTemporal,isDatePart:!!r.isDatePart,identifierNamed:Te(r.name),isBinaryFlag:!!r.isBinaryFlag,distinct:e[s]??0,twoValues:t[s]??null})),text:r=>this.STR(r)});for(let[r,s]of i)this._cols[r].scoreSeparation=s}applySeriesCompleteness(e,t,i){for(let u of this._cols)u.seriesCompleteness!==void 0&&delete u.seriesCompleteness;let r=this._cols.map((u,S)=>({c:u,i:S})).filter(({c:u})=>u.isTemporal&&!u.isMeasure&&u.temporalCadence&&u.temporalCadence.grain!=="irregular");if(r.length===0)return;let s=[],o=[];this._cols.forEach((u,S)=>{let M=i[S];M&&(s.push(S),o.push({name:u.name,dataType:u.dataType,isMeasure:!!u.isMeasure,isTemporal:!!u.isTemporal,isDatePart:!!u.isDatePart,isReassembledDate:!!u.isReassembledDate,isBinaryFlag:!!u.isBinaryFlag,geoKind:u.geoKind,identifierNamed:Te(u.name),values:M,rows:this._rows.length,locale:t}))});let l=Bt(o);if(l<0)return;let a=s[l],f=this._cols[a],m=this._rows.map(u=>this.STR(u[a])),g=e>=20&&(f.dataType!=="String"||Array.isArray(f.safeDistinctValues));for(let{c:u,i:S}of r){let M=Gt({periods:this._rows.map(I=>this.STR(I[S])),series:m,seriesColumn:f.name,pattern:u.temporalTextPattern,locale:t,includeDates:e>=20,includeNames:g});M&&(u.seriesCompleteness=M)}}updateColumnStats20(e,t,i,r,s,o,l,a,f,m,g,u){if(e>=20){let S=[...t].sort((x,d)=>x-d),M=Math.floor(S.length/2);if(i>0&&r!=null?s.avgValue=s.dataType=="Integer"?Math.round(r/i):r/i:s.avgValue=null,i>0&&(s.avgLength=o/i),this._rows.length>0){let x=d=>{let h=d instanceof Date?d:typeof d=="string"?Re(d)??new Date(d):new Date(d),y=this.wholeDayIso(h);return y?y+"T00:00:00.000Z":isNaN(h.getTime())?d:h.toISOString().slice(0,10)+"T00:00:00.000Z"};s.dataType!="DateTime"||l||!a?s.lowValue=a:s.lowValue=x(a),s.dataType!="DateTime"||l||!f?s.highValue=f:s.highValue=x(f),s.medianValue=S.length===0?null:S.length%2===0?s.dataType=="Integer"?Math.round((S[M-1]+S[M])/2):(S[M-1]+S[M])/2:S[M],s.numericPrecision=m}if(S.length>0){let x=s.avgValue??0,d=S.length,h=0,y=0;for(let A of S){let p=A-x;h+=p*p,y+=p*p*p}let b=h/d;s.skewness=b===0?0:y/d/Math.pow(Math.sqrt(b),3),s.stdDev=Math.sqrt(b)}r!==null&&(s.sum=r);let I=Array.from(g.entries()).sort((x,d)=>d[1]-x[1]);if(s.topCategories=I.slice(0,10).map(x=>x[1]),!s.isMeasure&&I.length>0&&(s.dataType!=="String"&&(s.topCategoryValues=I.slice(0,5).map(x=>x[0])),e>=20)){let x=I.map(h=>h[0]),d=ge(x,u);if(d!==null)s.ordinalPattern=d.pattern,s.orderedDomain=d.orderedDomain;else if(s.dataType==="String"){let h=it(x);h!==null&&(s.safeDistinctValues=h)}}if(S.length>=8&&(s.dataType==="Integer"||s.dataType==="Decimal")){let x=d=>S[Math.floor((S.length-1)*d)];s.quantiles={p05:x(.05),p25:x(.25),p75:x(.75),p95:x(.95)}}}if(!s.isMeasure&&s.dataType==="String"&&g.size>0){let S=Array.from(g.entries()).sort((x,d)=>d[1]-x[1]).map(x=>x[0]);s.formatSignature=pe(S);let M=i>0?o/i:void 0,I=/^(UUID|EMAIL_LIKE|URL_LIKE|PHONE_LIKE|NUMERIC_ID|HEX_ID|OPAQUE_ID_ALPHANUMERIC|DATE_STR|BOOLEAN)$/;s.formatSignature&&!I.test(s.formatSignature)&&(M===void 0||M>=3)&&(s.isFreeText=!0)}if(!s.isMeasure&&g.size>0){let S=Array.from(g.entries()).sort((I,x)=>x[1]-I[1]),M=at(S.map(I=>I[0]),s.name,u);if(M!==null&&(s.geoKind=M.geoKind,s.geoMatchPct=M.geoMatchPct,M.geoAmbiguous&&(s.geoAmbiguous=!0),M.geoKind.indexOf("country")===0)){let I=Ie(S);I&&(s.dominantGeoRegion=I.dominantGeoRegion,s.dominantGeoRegionPct=I.dominantGeoRegionPct,s.geoRegionCount=I.regionCount)}}}updateColumnStats10(e,t,i,r,s,o,l){let a=this._rows.length-i;e>=10&&(t.blankCount=a),t.distinctCount=r.size+(a!=0?1:0),t.valueNature="Categorical",i>0&&(t.dataType==="Integer"||t.dataType==="Decimal"?t.valueNature=jt({dataType:t.dataType,isMeasure:!!t.isMeasure,name:t.name,distinct:r.size,nonblank:i,prec:s,maxval:o,minval:l}):t.dataType==="DateTime"&&(t.valueNature=t.dateWithTime?"Continuous":"Ordinal"))}getRowCount(){return this._rows.length}getLeafCardinality(){if(this._leafCardinality!==null)return this._leafCardinality;let e=[];if(this._cols.forEach((i,r)=>{i.isMeasure||e.push(r)}),e.length===0)return this._leafCardinality=this._rows.length,this._leafCardinality;let t=new Set;for(let i of this._rows)t.add(JSON.stringify(e.map(r=>i[r])));return this._leafCardinality=t.size,this._leafCardinality}_leafCardinality=null;getGeoExtent(){if(this._geoExtentComputed)return this._geoExtent;this._geoExtentComputed=!0,this._geoExtent=null;let e=o=>$e(o,{camel:!0}),t=-1,i=-1,r=-1;if(this._cols.forEach((o,l)=>{let a=e(o.name),f=o.dataType==="Integer"||o.dataType==="Decimal";f&&t<0&&a.some(m=>m==="lat"||m==="latitude")?t=l:f&&i<0&&a.some(m=>m==="lon"||m==="lng"||m==="long"||m==="longitude")&&(i=l),r<0&&!o.isMeasure&&typeof o.geoKind=="string"&&o.geoKind.indexOf("country")===0&&(r=l)}),t<0||i<0)return null;let s=[];for(let o of this._rows){let l=o[t],a=o[i],f=l==null||l===""?null:Number(l),m=a==null||a===""?null:Number(a);s.push({lat:f,lon:m,country:r>=0&&be(this.STR(o[r]))?this.STR(o[r]):null})}return this._geoExtent=mt(s),this._geoExtent}_geoExtent=null;_geoExtentComputed=!1;obfuscateString(e){return Dt(e,Ze)}toObjectArray(){let e=this.liveEnglishAliases();return this._rows.map(t=>{let i={};this._cols.forEach((r,s)=>{i[r.name]=t[s],this.emitLegacyAggAliases&&r.hostName&&r.hostName!==r.name&&!Object.prototype.hasOwnProperty.call(i,r.hostName)&&(i[r.hostName]=t[s])});for(let[r,s]of e)Object.prototype.hasOwnProperty.call(i,s.alias)||(i[s.alias]=t[r]);return i})}async getCSVAsync(e){let t=[],i=e?25:1e7,r=e?4e3:1e7,s=new Map,o=this.wallClockColumnIndexes();for(let a of this._rows){let f={};for(let m=0;m<this._cols.length;m++){let g=this._cols[m],u=a[m];if(this.STR(u)!=""){if(e&&g.dataType=="String")if(s.has(u))u=s.get(u);else{let S=this.obfuscateString(u);s.set(u,S),u=S}else if(g.dataType=="DateTime"&&!g.dateWithTime){let S=u instanceof Date?u:typeof u=="string"?Re(u)??new Date(u):new Date(u);u=(this.wholeDayIso(S)??S.toISOString().slice(0,10))+"T00:00:00.000Z"}else o.has(m)&&u instanceof Date&&(u=de(u));r-=this.STR(u).length}else u=null;f[m]=u,--r}if(t.push(f),--i,i<=0||r<=0)break}return await Vt.unparse(t,{header:!1})}getCSVHeaderLine(){let e=this.liveEnglishAliases();return Vt.unparse([this._cols.map((t,i)=>{if(this.emitLegacyAggAliases&&t.hostName)return this.STR(t.hostName);let r=e.get(i);return this.STR(r&&r.headerName?r.alias:t.name)})])}setHostQueryNames(e){this._hostQueryNames=(e??[]).map(t=>t==null?null:this.STR(t)),this._englishAliases=new Map}aliasesForCode(e){let t=Oe(e,this._cols)?this.legacyAliases():[];for(let i of this.englishAliasesFor(e).values())t.push({name:i.name,alias:i.alias,reason:"english-implicit-agg"});return t}armAliasesForCode(e){return this.emitLegacyAggAliases=Oe(e,this._cols),this._englishAliases=this.englishAliasesFor(e),this.getArmedAliases()}getArmedAliases(){let e=this.emitLegacyAggAliases?this.legacyAliases():[];for(let t of this.liveEnglishAliases().values())e.push({name:t.name,alias:t.alias,reason:"english-implicit-agg"});return e}legacyAliases(){let e=[];for(let t of this._cols)t&&t.hostName&&t.hostName!==t.name&&e.push({name:this.STR(t.name),alias:this.STR(t.hostName),reason:"doubled-agg-prefix"});return e}englishAliasesFor(e){let t=new Map;if(!e||this._hostQueryNames.length===0||!this._cols||this._cols.length===0)return t;let i=String(e),r=new Set;for(let o of this._cols)o&&(r.add(this.STR(o.name)),o.hostName&&r.add(this.STR(o.hostName)));let s=new Map;for(let o=0;o<this._cols.length;o++){if(!this._cols[o]||Mt(this._hostQueryNames[o],this._cols[o].name,this._cols[o].dataType))continue;let l=Ct(this._hostQueryNames[o]).filter(a=>!r.has(a)&&ae(i,a));l.length===1&&s.set(l[0],[...s.get(l[0])??[],o])}for(let[o,l]of s){if(l.length!==1)continue;let a=this.STR(this._cols[l[0]].name);t.set(l[0],{name:a,alias:o,headerName:!ae(i,a)})}return t}liveEnglishAliases(){let e=new Map;for(let[t,i]of this._englishAliases){let r=this._cols?this._cols[t]:null;r&&this.STR(r.name)===i.name&&e.set(t,i)}return e}addRow(e,t){if(this.dedupRows){let i="";for(let s of e)i+=this.STR(s)+"~";let r=Xe(i);if(this._rowHashes.has(r))return!1;this._rowHashes.add(r)}return this._rows.push(Jr(e)),this._inferredMeasureFlags=null,this._origIndices.push(t??-1),!0}getOriginalRowIndex(e){return e<0||e>=this._origIndices.length?-1:this._origIndices[e]}reset(){this._inferredMeasureFlags=null,this._cols=[],this._rows=[],this._origIndices=[],this._rowHashes=new Set,this._leafCardinality=null,this._hostQueryNames=[],this._englishAliases=new Map}setColumns(e){if(this._inferredMeasureFlags=null,this._cols=e,!e||e.length===0)return;let t=new Set(e.map(i=>this.STR(i?.name)));for(let i of e){if(!i)continue;let r=this.STR(i.name),s=At(r);!s||s===r||t.has(s)||(t.delete(r),t.add(s),i.hostName=r,i.name=s)}}};export{mt as a,qt as b,be as c,ni as d,gt as e,mn as f,dn as g,fn as h,gn as i,xe as j,Cn as k,At as l,Oe as m,Ct as n,wt as o,wn as p,It as q,Nt as r,ui as s,ci as t,mi as u,Nn as v,En as w,vn as x,Et as y,ae as z,Un as A,bi as B,Vn as C,Kn as D,ie as E,Pt as F,or as G,ar as H,lr as I,fr as J,Bt as K,Gt as L,Te as M,Yt as N,Zr as O,Qr as P,qr as Q,jt as R,Kt as S,Jr as T,Ht as U};