@bicharts/shape-core 0.6.111 → 0.6.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{chunk-QHZYDO3U.mjs → chunk-755USHC4.mjs} +1 -1
- package/dist/chunk-QAGRGHJI.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/indexedText.mjs +1 -1
- package/dist/ingest.mjs +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/models.d.ts +6 -0
- package/dist/types/vocab/coordinates.d.ts +8 -0
- package/package.json +1 -1
- package/dist/chunk-O6A7HGFH.mjs +0 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @bicharts/shape-core
|
|
2
2
|
|
|
3
|
-
> **Make Generative AI for
|
|
3
|
+
> **Make Generative AI for Data Apps and Maps *Better*.**
|
|
4
4
|
|
|
5
5
|
That is what **RegiaBI** is for; this package is the part that measures your data so the
|
|
6
6
|
rest of it can be honest about what your data will actually support.
|
|
@@ -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{
|
|
2
|
+
import{R as I,Z as A,f as R}from"./chunk-QAGRGHJI.mjs";import{a as h,c as x,d as E,e as L}from"./chunk-TZ74QIKA.mjs";import{u as C}from"./chunk-CZJ7M6A5.mjs";import M from"papaparse";var k=500,P=/^[+-]?\d{1,15}$/,v=/^\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,s=0,i=0,l=0;for(let c of e){if(c==null)continue;if(typeof c=="number"){l++,s++,Number.isInteger(c)&&r++;continue}if(c instanceof Date){l++,i++;continue}if(typeof c=="boolean"){l++;continue}let m=String(c).trim();if(m!==""){if(l++,P.test(h(m))){r++,s++;continue}if(L(m,o)){s++;continue}if((v.test(m)||N.test(m))&&!isNaN(Date.parse(m))){i++;continue}}}return l===0?"String":i===l?"DateTime":r===l?"Integer":s===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 s=String(e).trim();if(s==="")return null;switch(o){case"Integer":{let i=h(s);return P.test(i)?parseInt(i,10):null}case"Decimal":return E(s,n);case"DateTime":return r?r.read(s):C(s);default:return s}}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 g(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,s=e.map((t,a)=>o.slice(0,k).map(u=>u?.[a])),i=s.map(t=>x(t,n.locale)),l=e.map((t,a)=>t.dataType===void 0||t.dataType==="DateTime"?R(q(o,a),{locale:n.locale??"en"}):null),c=e.map((t,a)=>t.dataType??O(s[a],i[a],l[a]!==null)),m=new Set((n.measures??[]).map(t=>t.toLowerCase())),b=new Set((n.dimensions??[]).map(t=>t.toLowerCase())),j=new Set((n.nonAdditive??[]).map(t=>t.toLowerCase())),D=e.map((t,a)=>{let u=t.name.toLowerCase(),f=t.isMeasure??((c[a]==="Integer"||c[a]==="Decimal")&&!I(t.name));m.has(u)&&(f=!0),b.has(u)&&(f=!1);let T={name:t.name,dataType:c[a],isMeasure:f};return f&&j.has(u)&&(T.discourageAggregationAcrossGroups=!0),T}),d=new A;d.dedupRows=n.dedup!==!1,d.deriveProvinces=n.deriveProvinces!==!1,d.setColumns(D),d.declareDimensions(D.filter((t,a)=>b.has(e[a].name.toLowerCase())));for(let t=0;t<o.length;t++){let a=o[t];d.addRow(Array.from({length:r},(u,f)=>_(a?.[f],c[f],i[f],l[f])),t)}let p=d.getColumnsWithStats(n.privacyLevel??"20",n.locale??"en"),S=new Map(p.map(t=>[t.name,t]));e.forEach(t=>{let a=S.get(t.name);a&&(t.format&&(a.modelFormat=t.format),t.description&&(a.modelDesc=t.description))});let y=t=>{let a=S.get(t);if(a)return[a];let u=t.toLowerCase();return p.filter(f=>f.name.toLowerCase()===u)};for(let[t,a]of Object.entries(n.formats??{}))for(let u of y(t))u.modelFormat=a;for(let[t,a]of Object.entries(n.descriptions??{}))for(let u of y(t))u.modelDesc=a;for(let t of n.groupBy??[])for(let a of y(t))a.isGrouping=!0;return{columns:p,rows:d.toObjectArray(),totalRows:d.getRowCount(),index:d}}function w(e,o){return e.map(n=>Array.isArray(n)?n:o.map(r=>n[r]))}function F(e,o){let n=[],r=new Set,s=Math.min(e.length,Math.max(1,o));for(let i=0;i<s;i++){let l=e[i];if(!(!l||typeof l!="object"))for(let c of Object.keys(l))r.has(c)||(r.add(c),n.push(c))}return n}function V(e){let o=String(e??"").replace(/^\uFEFF/,""),n=[],r=[],s=0;return M.parse(o,{skipEmptyLines:!1,step:i=>{let l=i.meta.cursor,c=o.slice(s,l);s=l,i.errors?.length&&r.push(...i.errors);let m=i.data;m.length===1&&m[0]===""&&c.replace(/[\r\n]/g,"")===""||n.push(m)}}),!n.length&&!r.length&&r.push(...M.parse(o,{skipEmptyLines:!0}).errors),{rows:n,errors:r}}function Y(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 s=r[0].map(i=>(i??"").trim());return g(s.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 g(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 g(e.columns,w(e.rows??[],n),o)}case"objects":{let n=e.rows??[],r=e.columns?.length?e.columns:F(n,o.columnScanLimit??k).map(s=>({name:s}));if(!r.length)throw new Error("ingest: 'objects' produced no columns - the rows array is empty or holds no object keys.");return g(r,w(n,r.map(s=>s.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 s=$(r.dataType);return{name:r.name,dataType:s,isMeasure:r.isMeasure,format:r.format,description:r.description}});return g(n,w(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,Y as c};
|
|
@@ -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 be}from"./chunk-U3H6UBOO.mjs";import{a as xt,f as ee,g as Se,h as se,i as _e,j as re}from"./chunk-TZ74QIKA.mjs";import{b as yt,c as bt,d as St,e as _t,f as At}from"./chunk-YDYFP2T4.mjs";import{c as gt,l as pt,n as he,p as ht,s as ie,w as ye,x as ke,y as De,z as Oe}from"./chunk-DTBXJVUG.mjs";import{e as ut,k as ge,m as mt,n as ft,o as pe}from"./chunk-3ZAS32F5.mjs";import{b as ct,d as dt}from"./chunk-5HI6TVMM.mjs";import{A as fe,B as at,E as lt,a as ne,b as J,c as qe,d as de,g as Qe,h as Je,j as et,l as tt,m as nt,o as rt,p as me,q as it,r as st,u as Ne,w as ot}from"./chunk-CZJ7M6A5.mjs";import{c as Ze,f as Ee}from"./chunk-WC4JINEZ.mjs";var mn=85,fn=60,gn=/(^|[^a-z])(state|province|provincia|provinz|region|regione|regiao|county|department|departement|departamento|prefecture|oblast|canton|kanton|bundesland|land|territory)([^a-z]|$)/i,Pe=t=>Math.round(t*10)/10,Ae=t=>t.split("-")[0];function Ct(t){let e=new Map,n=0;if(t.forEach((s,a)=>{let l=he(a);l&&(e.set(l,(e.get(l)||0)+s),n+=s)}),n===0)return{};let[i,r]=[...e].sort((s,a)=>a[1]-s[1])[0];return{dominantRegion:i,dominantRegionPct:Pe(100*r/n)}}function wi(t){let e=t.province===null||t.province===void 0?"":String(t.province).trim();if(e)return wt(e,t.provinceKind,t.country);if(!ie())return null;let n=t.city===null||t.city===void 0?"":String(t.city).trim();if(!n)return null;let i=ye(n,{country:t.country===null||t.country===void 0?null:String(t.country)});return i.status==="resolved"?i.provinceId:null}function wt(t,e,n){if(e==="us-state-code"||e==="us-state-name"){let s=At(t,e);return s?"US-"+s:null}if(!ie())return null;if(e==="admin1-code")return Oe(t)?t.toUpperCase():null;let i=n==null?null:String(n),r=new Set(ke(t,i).map(De).filter(s=>!!s));return r.size===1?[...r][0]:null}function Mi(t,e={}){let n=e.deriveProvinces!==!1,i=new Array(t.length),r=new Array(t.length),s=new Set,a=[],l=new Set,o=[],c=0,u=0,g=0,d=A=>{let S=A.toLowerCase();s.has(S)||(s.add(S),a.push(A))},y=A=>A==null||A===""?null:Number(A),w=new Map;return t.forEach((A,S)=>{i[S]=null,r[S]=null;let p=A.country===null||A.country===void 0||String(A.country).trim()===""?null:String(A.country).trim(),h=A.province===null||A.province===void 0?"":String(A.province).trim();if(h){let _=wt(h,e.provinceKind,p);_?(i[S]=_,r[S]="province",c++):d(h);return}if(!n)return;let x=y(A.lat),f=y(A.lon),C=!1;if(e.locate&&x!==null&&f!==null&&isFinite(x)&&isFinite(f)){C=!0;let _=e.locate(x,f);if(_){i[S]=_,r[S]="coordinates",c++;return}}let b=A.city===null||A.city===void 0?"":String(A.city).trim();if(b&&ie()){let _=b.toLowerCase()+""+(p??""),M=w.get(_);if(M||(M=ye(b,{country:p}),w.set(_,M)),M.status==="resolved"&&M.provinceId){i[S]=M.provinceId,r[S]="city",c++;return}if(M.status==="ambiguous"){u++,l.has(_)||(l.add(_),o.length<8&&o.push(b));return}d(b);return}C&&g++}),{iso:i,source:r,unmatched:a,matchedRows:c,totalRows:t.length,ambiguousRows:u,ambiguousExamples:o,unplacedPoints:g}}function Mt(t,e,n={}){let i=new Map;if(!ie()||e.length===0)return i;let r=t.findIndex(l=>!l.isMeasure&&(l.geoKind||"").startsWith("country")),s=l=>l==null?"":String(l).trim(),a=l=>{let o=new Map;for(let y of e){let w=s(y[l]);if(!w)continue;let A=r>=0&&s(y[r])||null,S=w+""+(A??""),p=o.get(S);p?p.rows++:o.set(S,{city:w,country:A,rows:1})}if(o.size===0)return null;let c=0,u=0,g=new Set,d=new Map;return o.forEach(y=>{let w=ye(y.city,{country:y.country});w.status!=="unmatched"&&u++,!(w.status!=="resolved"||!w.provinceId)&&(c++,g.add(w.provinceId),d.set(w.cc,(d.get(w.cc)||0)+y.rows))}),{signals:{rollupPct:Pe(100*c/o.size),regionCount:g.size,countryCount:d.size,...Ct(d)},cityPct:100*u/o.size,distinct:o.size}};return t.forEach((l,o)=>{if(l.isMeasure||o===r)return;let c=l.geoKind||"";if(c.startsWith("city")){if(n.cities===!1)return;let _=a(o);_&&i.set(o,_.signals);return}if(c)return;let u=new Map,g=new Map;for(let _ of e){let M=s(_[o]);M&&(u.set(M,(u.get(M)||0)+1),g.has(M)||g.set(M,r>=0&&s(_[r])||null))}if(u.size<3)return;let d=0,y=0,w=0,A=new Set,S=new Map;u.forEach((_,M)=>{if(Oe(M)){d++;let z=M.toUpperCase();A.add(z),S.set(Ae(z),(S.get(Ae(z))||0)+_);return}let W=new Set(ke(M,g.get(M)).map(De).filter(z=>!!z));if(W.size===1){y++;let z=[...W][0];A.add(z),S.set(Ae(z),(S.get(Ae(z))||0)+_)}else W.size>1&&w++});let h=gn.test(l.name.replace(/[_-]+/g," "))?fn:mn,x=100*d/u.size,f=100*y/u.size,C=x>=f,b=C?x:f;if(b<h){if(n.cities===!1)return;let _=a(o);if(!_||_.cityPct<gt||_.distinct<St&&!bt(l.name,yt))return;i.set(o,_.signals);return}i.set(o,{kind:C?"admin1-code":"admin1-name",matchPct:Pe(b),ambiguous:!C&&w/u.size>.15?!0:void 0,regionCount:A.size,countryCount:S.size,...Ct(S)})}),i}function ze(t){let e=(t||"").toLowerCase();return e==="en-us"||e==="en"||e.startsWith("en-us-")||e==="en-ph"||e==="en-bz"}var Le={a:0,b:0,c:0,yearFirst:!1,sep:"",trail:"",word:"",day:0,year:0,namedOrder:"dmy",cjkPattern:""},pn=/\s+(\d{1,2}):(\d{2})(?::(\d{2})(?:[.,]\d{1,9})?)?(?:\s*([ap])\.?\s?m\.?)?$/i,hn=/^(\d{1,4})(\s*[./-]\s*)(\d{1,2})(\s*[./-]\s*)(\d{1,4})(\.?)$/,yn=/^(\d{4})(\s*[年년]\s*)(\d{1,2})(\s*[月월]\s*)(\d{1,2})(\s*[日일号])$/,bn=/(\d)(?:st|nd|rd|th|er|º|ª)(?=[\s.,/-]|$)/gi,Sn=new Set(["de","del","of"]),_n=new Set(["\u0433","\u0440","r"]),An=/^[\p{L}\p{M}\u0970\u05f3]+$/u,Fe=/^\d+$/;function xn(t){let e=+t[1],n=+t[2],i=t[3]===void 0?0:+t[3],r=t[4]!==void 0;if(n>59||i>59)return null;if(r){if(e<1||e>12)return null;e=e%12+(t[4].toLowerCase()==="p"?12:0)}else if(e>23)return null;return{h:e,mi:n,s:i,seconds:t[3]!==void 0,meridiem:r}}function Tt(t){let e=t.replace(/[\u200e\u200f\u061c]/g,"").replace(/\s+/g," ").trim();if(e==="")return null;e=xt(e);let n=null,i=pn.exec(e);if(i){if(n=xn(i),!n)return null;e=e.slice(0,i.index)}let r;if(r=yn.exec(e)){let d=`cjk|${r[2]}|${r[4]}|${r[6]}`;return{...Le,form:"cjk",key:d,clock:n,a:+r[1],b:+r[3],c:+r[5],yearFirst:!0,cjkPattern:`%Y${r[2]}%m${r[4]}%d${r[6]}`}}if(r=hn.exec(e)){let d=r[2],y=r[4];if(d!==y)return null;let w=d.trim(),A=r[6];if(A&&w!==".")return null;let S=[r[1].length,r[3].length,r[5].length],p=S[0]===4,h=S[2]===4;return p===h||(p?S[1]>2||S[2]>2:S[0]>2||S[1]>2)?null:p&&w==="-"&&d==="-"&&S[1]===2&&S[2]===2?"iso":p&&w==="."&&d==="."&&!A&&!(S[1]===2&&S[2]===2)?null:{...Le,form:"numeric",key:`num|${p?"y":"x"}|${d}|${A}`,clock:n,a:+r[1],b:+r[3],c:+r[5],yearFirst:p,sep:d,trail:A}}let s=e.replace(bn,"$1").split(/[\s.,/-]+/).filter(d=>d!==""&&!Sn.has(d.toLowerCase()));if(s.length===4&&Fe.test(s[2])&&_n.has(s[3].toLowerCase())&&s.pop(),s.length!==3)return null;let a=s.map(d=>Fe.test(d)?"N":An.test(d)?"W":"?").join(""),l=s.map(d=>Fe.test(d)?d:""),o=0,c=0,u="",g;if(a==="NWN"&&l[0].length<=2&&l[2].length===4)o=+l[0],u=s[1],c=+l[2],g="dmy";else if(a==="WNN"&&l[1].length<=2&&l[2].length===4)u=s[0],o=+l[1],c=+l[2],g="mdy";else if(a==="NWN"&&l[0].length===4&&l[2].length<=2)c=+l[0],u=s[1],o=+l[2],g="ymd";else return null;return{...Le,form:"named",key:`named|${g}`,clock:n,day:o,year:c,word:u,namedOrder:g}}var Cn=[31,28,31,30,31,30,31,31,30,31,30,31],wn=t=>t%4===0&&t%100!==0||t%400===0;function vt(t,e,n){return t>=1&&t<=9999&&e>=1&&e<=12&&n>=1?n<=(e===2&&wn(t)?29:Cn[e-1]):!1}function Mn(t,e,n,i){let r=new Date(Date.UTC(2e3,e-1,n,i?.h??0,i?.mi??0,i?.s??0));return r.setUTCFullYear(t),r}function It(t,e={}){let n=(e.floor??1)>=1,i=new Map,r=new Map,s=0,a=null;for(let p of t){if(p==null)continue;if(typeof p!="string"){if(n)return null;s++;continue}let h=p.trim();if(h==="")continue;s++;let x=i.get(h);if(x===void 0&&(x=Tt(h),i.set(h,x)),x===null||x==="iso"){if(n)return null;continue}if(n){if(a===null)a=x;else if(x.key!==a.key)return null}else r.set(x.key,(r.get(x.key)??0)+1)}if(!n){let p=0,h="";for(let[x,f]of r)f>p&&(p=f,h=x);if(p===0||p/s<e.floor)return null;a=[...i.values()].find(x=>x!==null&&x!=="iso"&&x.key===h)??null}if(a===null)return null;let l=a.key,o=[...i.values()].filter(p=>p!==null&&p!=="iso"&&p.key===l),c,u="shape",g=null;if(a.form==="named"){if(c=a.namedOrder,g=_e(o.map(p=>p.word),e.locale),!g)return null}else if(a.form==="cjk"||a.yearFirst)c="ymd";else{let p=0,h=0;for(let x of o)x.a>12&&p++,x.b>12&&h++;if(p>0&&h>0)return null;p>0?(c="dmy",u="values"):h>0?(c="mdy",u="values"):a.sep.trim()==="."?(c="dmy",u="shape"):(c=ze(e.locale)?"mdy":"dmy",u="locale")}let d=p=>{if(p.form==="named"){let h=g.get(ee(p.word));return h===void 0?null:[p.year,h+1,p.day]}return p.yearFirst?[p.a,p.b,p.c]:c==="dmy"?[p.c,p.b,p.a]:[p.c,p.a,p.b]},y=1/0,w=-1/0,A=0;for(let p of o){let h=d(p);if(!h||!vt(h[0],h[1],h[2])){if(n)return null;A++;continue}y=Math.min(y,h[0]),w=Math.max(w,h[0])}if(!n&&(r.get(l)-A)/s<e.floor||y>=2400&&w<=2699||y>=1300&&w<=1500)return null;let S={form:a.form,order:c,orderFrom:u,hasTime:o.some(p=>p.clock!==null),read(p){if(typeof p!="string")return null;let h=p.trim();if(h==="")return null;let x=i.get(h);if(x===void 0&&(x=Tt(h),i.set(h,x)),x===null||x==="iso"||x.key!==l)return null;let f=d(x);return!f||!vt(f[0],f[1],f[2])?null:Mn(f[0],f[1],f[2],x.clock)}};if(a.form!=="named"&&!o.some(p=>p.clock?.meridiem)){let p;a.form==="cjk"?p=a.cjkPattern:a.yearFirst?p=`%Y${a.sep}%m${a.sep}%d${a.trail}`:p=(c==="dmy"?`%d${a.sep}%m${a.sep}%Y`:`%m${a.sep}%d${a.sep}%Y`)+a.trail;let h=o.filter(x=>x.clock!==null).length;h===0?S.pattern=p:h===o.length&&(S.pattern=p+(o.every(x=>x.clock.seconds)?" %H:%M:%S":" %H:%M"))}return S}import on from"papaparse";var Tn={es:["latitud"],pt:["latitude"],fr:["latitude"],it:["latitudine"],nl:["breedtegraad"],de:["breitengrad"]},vn={es:["longitud"],pt:["longitude"],fr:["longitude"],it:["longitudine"],nl:["lengtegraad"],de:["l\xE4ngengrad"]},We=t=>ne(t.normalize("NFC")).toLowerCase(),In=new Set(Object.values(Tn).flatMap(t=>(t??[]).map(We))),Rn=new Set(Object.values(vn).flatMap(t=>(t??[]).map(We)));function Rt(t){let e=!1,n=!1;for(let i of t){let r=We(i);In.has(r)?e=!0:Rn.has(r)&&(n=!0)}return e===n?null:e?"lat":"lon"}var En=["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"],Nn=["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"],kn=["latitude","longitude"],Dn=["latitude","longitude"];function q(t){return ne(t)}var kt=["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"],On=["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"],Pn=["osszege","sucet","\u7684\u603B\u548C","\u7684\u8BA1\u6570","\u306E\u5408\u8A08","\uC758 \uD569\uACC4"],Ln=["atlaga","priemer","\u7684\u5E73\u5747\u503C","\u306E\u5E73\u5747","\uC758 \uD3C9\uADE0"],xe=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 $e(t){return[...t].sort((e,n)=>n.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")}var Dt=new RegExp("^\\s*(?:(?:sum|count|count\\s+distinct|distinct\\s+count)\\s+of\\s+|(?:"+$e(kt)+")\\s+)","i");function Et(t){for(let e of t){let n=e.codePointAt(0)??0;if(n>=11904&&n<=40959||n>=44032&&n<=55215)return!0}return!1}var Fn="[\u2013\u2014-]";function Ot(t){let e=t.filter(r=>!Et(r)),n=t.filter(Et),i=[];return e.length&&i.push("(?:\\s+|\\s*"+Fn+"\\s*)("+$e(e)+")"),n.length&&i.push("\\s*("+$e(n)+")"),new RegExp("(?:"+i.join("|")+")\\s*$","i")}var Be=Ot(Pn),zn=Ot(Ln);function Ce(t,e){let n=e.exec(t);if(!n)return null;let i=t.slice(0,n.index);return i.trim()===""?null:{base:i,label:(n[1]??n[2]??"").toLowerCase()}}function Pt(t){let e=q(String(t??"").trim().toLowerCase());if(!e)return null;for(let r of On)if(e.startsWith(r+" "))return xe[r]??"avg";for(let r of kt)if(e.startsWith(r+" ")||e===r)return xe[r]??"sum";let n=Ce(e,zn);if(n)return xe[n.label]??"avg";let i=Ce(e,Be);return i?xe[i.label]??"sum":null}var Wn=/(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])/g,$n=new RegExp("\\b("+En.join("|")+")\\b|("+Nn.join("|")+")$","i"),Bn=new RegExp("\\b("+kn.join("|")+")\\b|("+Dn.join("|")+")$","i");function Me(t){if(!t)return"";let e=String(t),n=q(e),i=Dt.exec(n);if(i)return e.slice(i[0].length).trim();let r=Ce(n,Be);return(r?e.slice(0,r.base.length):e).trim()}function Gn(t){if(!t)return!1;let e=q(String(t));return Dt.test(e)||Ce(e,Be)!==null}var Vn=["count (distinct)","count distinct","distinct count","standard deviation","average","variance","median","product","stddev","std dev","count","sum","avg","min","minimum","max","maximum","var"],Nt=new RegExp("^\\s*("+[...Vn].sort((t,e)=>e.length-t.length).map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")+")\\s+of\\s+","i");function Lt(t){if(t==null)return"";let e=String(t),n=Nt.exec(e);if(!n)return e;let i=l=>l.toLowerCase().replace(/\s+/g," ").trim(),r=i(n[1]),s=e.slice(n[0].length),a=0;for(;a<8;){let l=Nt.exec(s);if(!l||i(l[1])!==r)break;let o=s.slice(l[0].length);if(o.trim()==="")break;s=o,a++}return a===0?e:e.slice(0,n[0].length)+s}function Ge(t,e){if(!t||!e)return!1;let n=String(t);for(let i of e){let r=i?.hostName;if(r&&r!==i?.name&&n.includes(r))return!0}return!1}var we={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 "]},Ft=new RegExp("^("+Object.keys(we).join("|")+")\\((.+)\\)$");function zt(t){if(!t)return[];let e=Ft.exec(String(t).trim());if(!e)return[];let n=we[e[1]],i=e[2],r=[];for(let s=i.indexOf(".");s>=0;s=i.indexOf(".",s+1)){if(s===0)continue;let a=i.slice(s+1);if(a.trim()!=="")for(let l of n){let o=l+a;r.includes(o)||r.push(o)}}return r}function Wt(t,e,n){let i=Ft.exec(String(t??"").trim());if(!i)return!1;let r=i[1];if((r==="Count"||r==="CountNonNull")&&n==="Decimal")return!0;let s=new Set(we[r]),a=String(e??""),l=i[2];for(let o=l.indexOf(".");o>=0;o=l.indexOf(".",o+1)){if(o===0)continue;let c=l.slice(o+1);if(c.trim()!==""){for(let u of Object.values(we))for(let g of u)if(!s.has(g)&&a===g+c)return!0}}return!1}function Kn(t){let e=Me(t);return e.length===0?"":e.replace(Wn," ")}function $t(t,e){if(!e)return!1;let n=Me(e);return t.test(q(Kn(e)))||t.test(q(n))||t.test(q(J(n).join(" ")))}function Bt(t){return $t(Bn,t)}function Un(t){return $t($n,t)||Bt(t)}var Gt=/int|double|decimal|single|float|number|currency|money/i;function Hn(t){let e=String(t?.valueNature??"").trim().toLowerCase();return e==="categorical"?"Categorical":e==="ordinal"?"Ordinal":e==="continuous"||t?.isMeasure===!0||Gt.test(String(t?.dataType??""))?"Continuous":"Categorical"}function Yn(t){return t?.isMeasure===!0||Gt.test(String(t?.dataType??""))}function Vt(t){let e=t??{},n=Hn(e);if(n!=="Continuous")return{nature:n,additivity:"unknown",basis:"role",suppressed:!1};if(Bt(e.name))return{nature:n,additivity:"positional",basis:"name",suppressed:!0};let i=String(e.additivity??"").trim().toLowerCase();if(!(i==="additive"&&Gn(e.name))){if(i==="additive")return{nature:n,additivity:"additive",basis:"measured",suppressed:!1};if(i==="part_of_whole")return{nature:n,additivity:"part_of_whole",basis:"measured",suppressed:!1};if(i==="intensive_rate")return{nature:n,additivity:"intensive_rate",basis:"measured",suppressed:!1}}return e.discourageAggregationAcrossGroups===!0?{nature:n,additivity:"intensive_rate",basis:"host-flag",suppressed:!1}:Un(e.name)?{nature:n,additivity:"intensive_rate",basis:"name",suppressed:!1}:{nature:n,additivity:"additive",basis:"default",suppressed:!1}}function Kt(t){let e=Vt(t),n=t??{};if(e.nature==="Categorical")return["first","distinctcount","count"];if(e.nature==="Ordinal")return Yn(n)?["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 Oi(t){return Kt(t)[0]}function Pi(t,e){return Kt(t).indexOf(e)>=0}function Li(t,e){if(e!=="sum"&&e!=="count")return!1;if(e==="count")return!0;let n=Vt(t);return n.additivity==="additive"||n.additivity==="part_of_whole"||n.additivity==="unknown"}var jn={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"]},Xn=["fr","es","pt","it","pl","cs","sk","hr","ru","uk","el","ar","he","id","vi","th"],Zn=["num\xE9ro"],qn=t=>t.normalize("NFC").toLowerCase();function Qn(t,e,n,i){let r=Ee(n);return!r||!t?null:t===e?"word":r.wordBreaks===!1?Array.from(e).length<nt?null:(i?t.startsWith(e):t.endsWith(e))&&t.length>e.length?"suffix":null:i?et(t,n).includes(e)?"word":null:r.script==="Hang"?tt(t,e)?"suffix":null:r.compounds&&Je(t,e,Qe)?"suffix":null}function Ut(t){let e=String(t??"").trim();if(!e)return null;let n=de(e),i=de(Me(e));for(let[r,s]of Object.entries(jn)){let a=Xn.includes(r),l=a?i:n;for(let o of s){let c=Zn.includes(o)||!!Ee(r)?.foldSensitive,u=c?l.words:l.folded;if(u.length===0)continue;let g=c?qn(o):de(o).folded.join(" "),d=Qn(a?u[0]:u[u.length-1],g,r,a);if(d)return{lang:r,word:o,view:d}}}return null}var Jn=[["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 Te(t){for(let[e,n]of Jn)if(n.test(t))return e;return null}var er=[{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]]}],ve=new Map;function Ht(t,e,n,i){let r=ve.get(t);if(r)return r;let s=[];for(let[a,l]of e)for(let o=a;o<=l;o++){let c=String.fromCodePoint(o);Te(c)===n&&(i&&!i.test(c)||s.push(c))}return ve.set(t,s),s}function tr(t){let n=t.codePointAt(0);for(let a=0;a<9&&Te(String.fromCodePoint(n-1))==="Nd";a++)n--;let i="nd:"+n.toString(16),r=ve.get(i);if(r)return r;let s=[];for(let a=n;a<n+10;a++){let l=String.fromCodePoint(a);Te(l)==="Nd"&&s.push(l)}return ve.set(i,s),s}function nr(t,e){if(e==="Nd")return tr(t);for(let r of er)if(r.test.test(t))return Ht(r.id+":"+e,r.ranges,e,r.id==="ascii"?null:r.test);let i=t.codePointAt(0)&-128;return Ht("block:"+i.toString(16)+":"+e,[[i,i+127]],e,null)}function rr(t,e,n,i){let r=t.filter(s=>!e.has(s));return r.length===0&&(r=t.filter(s=>s!==n)),r.length===0?n:r[Math.min(r.length-1,Math.floor(i()*r.length))]}var ir=/^[\p{L}\p{M}\p{Nd}]$/u,Yt=/^[\p{L}\p{Nd}]$/u;function jt(t,e){if(!t)return t??"";let n=new Set(Array.from(t)),i=u=>{let g=Te(u);return!g||!ir.test(u)?u:rr(nr(u,g),n,u,e)},r=u=>{let g=[];for(let d of u)g.push(i(d)),Yt.test(d)&&e()<.2&&g.push(i(d));if(g.length>6){let d=Math.floor(e()*Math.min(3,g.length-6));for(let y=0;y<d;y++)for(let w=0;w<5;w++){let A=Math.floor(e()*g.length);if(Yt.test(g[A])){g.splice(A,1);break}}}return g.join("")};if(!(t.includes("@")&&t.includes(".")))return r(t);let[a,l=""]=t.split("@"),o=l.endsWith(".com"),c=o?l.slice(0,-4):l;return`${r(a)}@${r(c)}${o?".com":""}`}var sr=/^[A-Za-z_$][A-Za-z0-9_$]*$/,or=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ar=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 oe(t,e){if(!t||!e)return!1;let n=or(e);return new RegExp("['\"`]"+n+"['\"`]").test(t)?!0:sr.test(e)&&new RegExp("\\."+n+"(?![A-Za-z0-9_$])").test(t)}function lr(t){return!!t&&ar.test(t)}function Vi(t,e,n){return t?lr(t)?[...e]:[...n,...e].some(i=>oe(t,i))?e.filter(i=>oe(t,i)):[...e]:[]}var ur=5,cr=6,dr=3,te=864e5,mr=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,fr=/^(\d{4})[-/](\d{1,2})$/,gr=/^(\d{4})[-\s]?Q([1-4])$/i,pr=/^Q([1-4])[-\s](\d{4})$/i,hr=/^(\d{4})$/,yr=/^(\d{4})(0[1-9]|1[0-2])$/,br=/^(\d{4})(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])$/,Sr=/^(\D+?)[\s\-/.,']*((?:19|20)\d{2})$/u,_r=/^((?:19|20)\d{2})[\s\-/.,']+(\D+)$/u;function Ve(t,e,n){let i=ee(t);if(!i)return 0;if(i==="sept")return 9;for(let a of e&&!/^en\b/i.test(e)?["en",e]:["en"]){let l=Se(a)[i];if(l!==void 0)return l+1}let r=n?.get(i);if(r!==void 0)return r+1;let s=se(t);if(s.length>0){if(s.every(o=>o.month===s[0].month))return s[0].month+1;let a=Ze(String(e??"").split(/[-_]/)[0])?.code,l=s.find(o=>o.lang===a);if(l)return l.month+1}return 0}function Ar(t){let e=ge(t).filter(i=>i.yearDigits===4);if(e.length===0||e.some(i=>i.lang==="en"))return null;let n=e[0];return e.some(i=>i.grain!=="quarter"||i.n!==n.n||i.year!==n.year)?null:Y(n.year,(n.n-1)*3+1,1)}function Y(t,e,n,i=0,r=0,s=0){if(!(t>=1&&e>=1&&e<=12&&n>=1&&n<=31))return null;let a=Date.UTC(t,e-1,n,i,r,s);if(!Number.isFinite(a))return null;let l=o=>o<10?"0"+o:String(o);return{ms:a,y:t,m:e,d:n,iso:`${t}-${l(e)}-${l(n)}`}}function xr(t,e){let n=[],i="";for(let o=0;o<e.length;o++){if(e[o]!=="%"){i+=e[o].replace(/[.*+?^${}()|[\]\\]/g,"\\$&");continue}switch(e[++o]){case"Y":n.push("Y"),i+="(\\d{4})";break;case"m":n.push("m"),i+="(\\d{1,2})";break;case"d":n.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(t);if(!r)return null;let s=0,a=1,l=1;return n.forEach((o,c)=>{let u=+r[c+1];o==="Y"?s=u:o==="m"?a=u:l=u}),s?Y(s,a,l):null}function j(t,e,n,i){let r=(t??"").trim();if(r==="")return null;if(e){let o=xr(r,e);return o||null}let s=mr.exec(r);if(s)return Y(+s[1],+s[2],+s[3],+(s[4]??0),+(s[5]??0),+(s[6]??0));if(s=gr.exec(r),s)return Y(+s[1],(+s[2]-1)*3+1,1);if(s=pr.exec(r),s)return Y(+s[2],(+s[1]-1)*3+1,1);if(s=fr.exec(r),s&&+s[2]>=1&&+s[2]<=12)return Y(+s[1],+s[2],1);if(s=br.exec(r),s)return Y(+s[1],+s[2],+s[3]);if(s=yr.exec(r),s)return Y(+s[1],+s[2],1);if(s=hr.exec(r),s){let o=+s[1];return o>=1900&&o<=2100?Y(o,1,1):null}let a=Ar(r);if(a)return a;if(s=Sr.exec(r),s){let o=Ve(s[1],n,i);if(o)return Y(+s[2],o,1)}if(s=_r.exec(r),s){let o=Ve(s[2],n,i);if(o)return Y(+s[1],o,1)}let l=re(r);if(l){let o="month"in l?l.month:Ve(l.word,n,i);if(o)return Y(l.year,o,1)}return null}function Xt(t){let e=new Date(t).getUTCDay();return e>=1&&e<=5}function Zt(t,e){if(e<=t)return 0;let n=Math.round((e-t)/te),i=Math.floor(n/7),r=i*5,s=t+i*7*te;for(;s<e;)Xt(s)&&r++,s+=te;return r}function Cr(t){if(t.length===0)return 0;let e=[...t].sort((i,r)=>i-r),n=e.length>>1;return e.length%2?e[n]:(e[n-1]+e[n])/2}function wr(t){return t>0?t<.95?"hour":t<=1.05?"day":t>=6.5&&t<=7.5?"week":t>=27&&t<=31.5?"month":t>=88&&t<=93?"quarter":t>=362&&t<=368?"year":"irregular":"irregular"}function ae(t,e,n,i){switch(n){case"year":return e.y-t.y;case"quarter":return e.y*4+Math.floor((e.m-1)/3)-(t.y*4+Math.floor((t.m-1)/3));case"month":return e.y*12+e.m-(t.y*12+t.m);case"week":return Math.round((e.ms-t.ms)/(7*te));case"weekday":return Zt(t.ms,e.ms);case"day":return Math.round((e.ms-t.ms)/te);default:return i>0?Math.round((e.ms-t.ms)/i):0}}function qt(t,e){return Ke(t,e)?.cadence??null}function Ke(t,e){let n=e?.gapFactor??ur,i=0,r=0,s=new Map,a=Array.from(t),l;if(!e?.pattern){let f=[];for(let C of a){if(C==null||C==="")continue;let b=re(String(C));b&&"word"in b&&f.push(b.word)}f.length>0&&(l=_e(f,e?.locale)??void 0)}for(let f of a){if(f==null||f==="")continue;i++;let C=j(String(f),e?.pattern,e?.locale,l);C&&(r++,s.set(C.ms,C))}let o=[...s.values()].sort((f,C)=>f.ms-C.ms);if(o.length<dr||i>0&&r/i<.8)return null;let c=o[o.length-1].ms-o[0].ms;if(c<=0)return null;let u=[];for(let f=1;f<o.length;f++)u.push(o[f].ms-o[f-1].ms);let g=Cr(u);if(!(g>0))return null;let d=wr(g/te);d==="day"&&c>=7*te&&o.every(f=>Xt(f.ms))&&Zt(o[0].ms,o[o.length-1].ms)+1>o.length*.5&&(d="weekday");let y=d==="irregular"?o.length:ae(o[0],o[o.length-1],d,g)+1,w=1,A=1,S=[],p=o[0],h=1;for(let f=1;f<o.length;f++){let C=ae(o[f-1],o[f],d,g);C>w&&(w=C),d!=="irregular"&&C>n?(A++,S.push({from:p.iso,to:o[f-1].iso,points:h}),p=o[f],h=1):h++}S.push({from:p.iso,to:o[o.length-1].iso,points:h});let x={grain:d,points:o.length,expectedPoints:Math.max(y,o.length),coveragePct:Math.round(o.length/Math.max(y,o.length)*1e3)/10,runs:A,largestGapUnits:w,gapFactor:n};return e?.includeBounds&&S.length<=cr&&(x.runBounds=S),{cadence:x,points:o,stepMs:g}}var Mr=8,Tr=.5,vr=200,Ir=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"]),Rr=["category","classification","segment","status","priority","severity","channel"],Er=new Set(["UUID","EMAIL_LIKE","URL_LIKE","PHONE_LIKE","NUMERIC_ID","HEX_ID","OPAQUE_ID_ALPHANUMERIC","DATE_STR","BOOLEAN"]);function Nr(t){let e=J(t);if(e.length===0)return!1;let n=e[e.length-1];return Ir.has(n)?!0:Rr.some(i=>n.length>i.length&&n.endsWith(i))}function kr(t){if(t.isMeasure)return"measure";if(t.isTemporal||t.isDatePart||t.isReassembledDate)return"temporal";let e=Array.from(t.values).filter(n=>n!==""&&n!==null&&n!==void 0);return e.length<2||e.length>vr?"cardinality":t.rows>0&&e.length>=t.rows?"row-identity":t.isBinaryFlag?"flag":pe(e,t.locale)!==null?"ordinal":t.identifierNamed||t.dataType==="String"&&Er.has(be(e))?"identifier":!t.geoKind&&Nr(t.name)?"attribute":"entity"}function en(t){let e=-1,n=1/0,i=!1;return t.forEach((r,s)=>{if(kr(r)!=="entity")return;let a=new Set(Array.from(r.values).filter(o=>o!=="")).size,l=!!r.geoKind;(a<n||a===n&&l&&!i)&&(e=s,n=a,i=l)}),e}var Qt=t=>t<10?"0"+t:String(t);function Jt(t,e){switch(e){case"year":return`${t.y}-01-01`;case"quarter":return`${t.y}-${Qt(Math.floor((t.m-1)/3)*3+1)}-01`;case"month":return`${t.y}-${Qt(t.m)}-01`;case"hour":return new Date(t.ms).toISOString().replace(/\.\d{3}Z$/,"Z");default:return t.iso}}function tn(t){let{periods:e,series:n}=t,i=Math.min(e.length,n.length),r=new Set;for(let C=0;C<i;C++)e[C]&&r.add(e[C]);let s=Ke(r,{pattern:t.pattern,locale:t.locale});if(!s)return null;let a=s.cadence.grain;if(a==="irregular")return null;let l=s.points[0],o=ae(l,s.points[s.points.length-1],a,s.stepMs)+1;if(o!==s.cadence.expectedPoints)return null;let c=new Map;for(let C of r){let b=j(C,t.pattern,t.locale);if(!b)continue;let _=ae(l,b,a,s.stepMs);_>=0&&_<o&&c.set(C,{idx:_,stamp:b})}let u=new Map;for(let C=0;C<i;C++){let b=n[C];if(!b)continue;let _=c.get(e[C]);if(!_)continue;let M=u.get(b);M||(M={seen:new Set,lo:_.idx,hi:_.idx,loStamp:_.stamp,hiStamp:_.stamp,order:u.size},u.set(b,M)),M.seen.add(_.idx),_.idx<M.lo&&(M.lo=_.idx,M.loStamp=_.stamp),_.idx>M.hi&&(M.hi=_.idx,M.hiStamp=_.stamp)}if(u.size<2)return null;let g=0;for(let C of u.values())g+=C.seen.size;if(g/(u.size*o)<(t.minFill??Tr))return null;let d=[],y=new Set,w=0,A=0,S=0,p=0,h=0,x=1;for(let[C,b]of u){for(let z of b.seen)y.add(z);if(b.seen.size>=o)continue;let _=[...b.seen].sort((z,X)=>z-X),M=1;for(let z=1;z<_.length;z++)M=Math.max(M,_[z]-_[z-1]);let W={key:C,acc:b,coverage:b.seen.size/o,before:b.lo,after:o-1-b.hi,interior:b.hi-b.lo+1-b.seen.size,gap:M};d.push(W),W.before>0&&w++,W.after>0&&A++,W.interior>0&&S++,p=Math.max(p,W.before),h=Math.max(h,W.after),x=Math.max(x,M)}if(d.length===0)return null;d.sort((C,b)=>C.coverage-b.coverage||C.acc.order-b.acc.order);let f=d.slice(0,t.maxListed??Mr);return{seriesColumn:t.seriesColumn,grain:a,periods:o,seriesCount:u.size,incompleteSeries:d.length,lateStarts:w,earlyEnds:A,withHoles:S,columnWideMissing:o-y.size,maxMissingBefore:p,maxMissingAfter:h,largestGap:x,series:f.map(C=>{let b={};return t.includeNames&&(b.name=C.key),t.includeDates&&(b.first=Jt(C.acc.loStamp,a),b.last=Jt(C.acc.hiStamp,a)),b.missingBefore=C.before,b.missingAfter=C.after,b.missingInterior=C.interior,b.largestGap=C.gap,b.coverage=Math.round(C.coverage*1e3)/1e3,b}),more:d.length-f.length}}var Ie=6;function le(t){let e=t.slice().sort((i,r)=>i-r),n=e.length>>1;return e.length%2?e[n]:(e[n-1]+e[n])/2}function Dr(t){let e=t.length;if(e<Ie)return null;let n=t[0],i=t[0],r=0;for(let f of t)f<n&&(n=f),f>i&&(i=f),r+=f;if(n===i)return null;let s=le(t.map(Math.abs));if(s===0)return null;let a=[];for(let f=1;f<e;f++)a.push(t[f]-t[f-1]);let l=le(a.map(Math.abs))/s,o=(e-1)/2,c=r/e,u=0,g=0,d=0;for(let f=0;f<e;f++)u+=(f-o)*(t[f]-c),g+=(f-o)*(f-o),d+=(t[f]-c)*(t[f]-c);d/=e;let y=u/g,w=c-y*o,A=t.map((f,C)=>f-(w+y*C)),S=A.reduce((f,C)=>f+C,0)/e,p=0,h=0;for(let f=0;f<e;f++)p+=(A[f]-S)*(A[f]-S),f>0&&(h+=(A[f]-A[f-1])*(A[f]-A[f-1]));return p/=e,h/=e-1,{vnDetrended:p<=d*1e-12?2:h/p,relStep:l}}function Ue(t){let{stamps:e,series:n,values:i}=t,r=Math.min(e.length,i.length),s=new Map;for(let c=0;c<r;c++){let u=e[c],g=i[c];if(u===null||g===null||!Number.isFinite(g))continue;let d="";if(n&&(d=n[c]??"",d===""))continue;let y=s.get(d);y||s.set(d,y=new Map),y.set(u,(y.get(u)??0)+g)}let a=[],l=[],o=[];for(let c of s.values()){let u=[...c.entries()].sort((d,y)=>d[0]-y[0]).map(d=>d[1]),g=Dr(u);g&&(a.push(g.vnDetrended),l.push(g.relStep),o.push(u.length))}return a.length===0?null:{series:a.length,points:Math.round(le(o)),vnDetrended:Math.round(le(a)*1e3)/1e3,relStep:Math.round(le(l)*1e4)/1e4}}function ts(t){let e=t.times.map(n=>j(n,t.pattern,t.locale)?.ms??null);return Ue({stamps:e,series:t.series,values:t.values})}var Or=5e5,Pr=8,Lr=4,Fr=5,He=1,Ye=2,zr=4,Wr=8;function $r(t,e,n){let[i,r]=[...t];if(e.isTemporal){let s=j(i,e.temporalTextPattern,n),a=j(r,e.temporalTextPattern,n);if(s&&a&&s.ms!==a.ms)return s.ms<a.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 Br(t,e,n){let{rows:i,text:r,locale:s}=t,a=$r(n.values,n,s),l=new Uint8Array(i.length),o=0;for(let c=0;c<i.length;c++){let u=r(i[c][e]);u===a.a?l[c]=1:u===a.b?l[c]=2:o++}return{code:l,blankRows:o,setOrder:a.setOrder}}function Gr(t,e){let{rows:n,text:i}=t,r=new Int32Array(n.length),s=new Map;for(let a=0;a<n.length;a++){let l=i(n[a][e]);if(l===""){r[a]=-1;continue}let o=s.get(l);o===void 0&&(o=s.size,s.set(l,o)),r[a]=o}return{ids:r,dict:s}}function Vr(t,e,n){let i=new Uint8Array(n);for(let s=0;s<t.length;s++){let a=e[s];if(a===0)continue;let l=t[s];if(l<0)continue;let o=i[l];i[l]=o&a?o|a<<2:o|a}let r={keysA:0,keysB:0,keysBoth:0,dupA:0,dupB:0};for(let s=0;s<n;s++){let a=i[s];a&He&&r.keysA++,a&Ye&&r.keysB++,(a&(He|Ye))===(He|Ye)&&r.keysBoth++,a&zr&&r.dupA++,a&Wr&&r.dupB++}return r}function Kr(t,e){let n=(t.dupA+t.dupB)*(e.keysA+e.keysB),i=(e.dupA+e.dupB)*(t.keysA+t.keysB);return n<i||n===i&&t.keysBoth>e.keysBoth}var nn=t=>t==null||typeof t=="string"&&t.trim()==="";function Ur(t,e,n){if(t===e)return!0;let i=nn(t),r=nn(e);return i||r?i&&r:typeof t=="number"&&typeof e=="number"?!1:t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():n(t).trim()===n(e).trim()}function rn(t){let{rows:e,columns:n}=t,i=e.length;if(i<2||i>Or)return null;let r=n.map((b,_)=>({c:b,i:_})).filter(({c:b})=>!b.isMeasure&&!b.isTemporal&&!b.isDatePart&&b.distinct>=Fr).sort((b,_)=>(_.c.identifierNamed?1:0)-(b.c.identifierNamed?1:0)||_.c.distinct-b.c.distinct||b.i-_.i).slice(0,Pr),s=n.map((b,_)=>({c:b,i:_})).filter(({c:b})=>!b.isMeasure&&b.values!==null&&b.values.size===2).slice(0,Lr);if(r.length===0||s.length===0)return null;let a=s.map(({c:b,i:_})=>Br(t,_,b)),l=null;for(let{i:b}of r){let _=Gr(t,b);for(let M=0;M<s.length;M++){if(s[M].i===b)continue;let W=Vr(_.ids,a[M].code,_.dict.size);W.keysBoth<1||(!l||Kr(W,l.tally))&&(l={tally:W,keyIdx:b,setNo:M,ids:_.ids,dict:_.dict})}}if(!l)return null;let{ids:o,dict:c,tally:u}=l,g=a[l.setNo],d=s[l.setNo].i,y=c.size,w=new Int32Array(y).fill(-1),A=new Int32Array(y).fill(-1);for(let b=0;b<i;b++){let _=g.code[b],M=o[b];_===0||M<0||(_===1?w[M]<0&&(w[M]=b):A[M]<0&&(A[M]=b))}let S=[];for(let b=0;b<n.length;b++)b!==l.keyIdx&&b!==d&&S.push(b);let p=0;for(let b=0;b<y;b++){let _=w[b],M=A[b];if(_<0||M<0)continue;let W=e[_],z=e[M],X=!0;for(let Q of S)if(!Ur(W[Q],z[Q],t.text)){X=!1;break}X&&p++}let h=p===u.keysBoth?100:p===0?0:Math.min(99,Math.max(1,Math.round(p/u.keysBoth*100))),x=new Map,f=new Map;for(let[b,_]of c){let M=w[_]>=0,W=A[_]>=0;if(!M&&!W)continue;let z=ct(b);dt(z)&&(M&&x.set(z,(x.get(z)??0)+1),W&&f.set(z,(f.get(z)??0)+1))}let C=b=>{let _=0;for(let M of b.values())M>=2&&(_+=M);return _};return{key:l.keyIdx,discriminator:d,pairing:{form:"long",key:n[l.keyIdx].name,discriminator:n[d].name,keysA:u.keysA,keysB:u.keysB,keysBoth:u.keysBoth,duplicateKeysA:u.dupA,duplicateKeysB:u.dupB,identicalPct:h,discriminatorBlankRows:g.blankRows,looseCollisionsA:C(x),looseCollisionsB:C(f),setOrder:g.setOrder}}}var Hr=t=>t==="Integer"||t==="Decimal";function Yr(t){let e=[],n=[];return t.forEach((i,r)=>{if(i.twoValues){if(i.isBinaryFlag){e.push(r);return}i.isMeasure||i.isTemporal||i.isDatePart||i.identifierNamed||n.push(r)}}),[...e,...n].slice(0,6)}function jr(t,e){let n=[];for(let i=0;i<t.length&&n.length<12;i++){let r=t[i];e.has(i)||!Hr(r.dataType)||r.isTemporal||r.isDatePart||r.identifierNamed||r.distinct<3||n.push(i)}return n}function sn(t){let e=new Map,{rows:n,columns:i,text:r}=t;if(n.length===0||n.length>(t.maxRows??5e5))return e;let s=Yr(i);if(s.length===0)return e;let a=jr(i,new Set(s));if(a.length===0)return e;let l=s.map(o=>{let[c,u]=i[o].twoValues,g=new Uint8Array(n.length);for(let d=0;d<n.length;d++){let y=r(n[d][o]);g[d]=y===c?1:y===u?2:0}return g});for(let o of a){let c=new Float64Array(n.length),u=0;for(let h=0;h<n.length;h++){let x=n[h][o],f=x==null||x===""?NaN:typeof x=="number"?x:parseFloat(x);c[h]=f,f===f&&f!==1/0&&f!==-1/0&&u++}if(u<2)continue;let g=new Float64Array(u);for(let h=0,x=0;h<n.length;h++){let f=c[h];f===f&&f!==1/0&&f!==-1/0&&(g[x++]=f)}g.sort();let d=new Float64Array(u),y=0;for(let h=0;h<u;h++)(h===0||g[h]!==g[h-1])&&(d[y++]=g[h]);let w=new Int32Array(n.length).fill(-1);for(let h=0;h<n.length;h++){let x=c[h];if(!(x===x&&x!==1/0&&x!==-1/0))continue;let f=0,C=y-1;for(;f<C;){let b=f+C>>>1;d[b]<x?f=b+1:C=b}w[h]=f}let A=[],S=new Int32Array(y),p=new Int32Array(y);for(let h=0;h<s.length;h++){let x=l[h];S.fill(0),p.fill(0);let f=0,C=0;for(let U=0;U<n.length;U++){let m=w[U];m<0||(x[U]===1?(S[m]++,f++):x[U]===2&&(p[m]++,C++))}if(f===0||C===0)continue;let b=f<=C,_=b?f:C,M=b?C:f,W=b?S:p,z=b?p:S,X=0,Q=0,ue=0;for(let U=0;U<y;U++){let m=W[U],T=z[U];X+=m*(Q+.5*T),Q+=T,m+T>=2&&(ue+=m+T)}A.push({outcome:i[s[h]].name,aucMinorityHigh:Math.round(X/(_*M)*1e4)/1e4,nMinority:_,nMajority:M,ties:ue})}A.length>0&&e.set(o,A)}return e}var Xr=12,Zr=100,qr=.3,Qr=.9,Jr=120,ei=1900,ti=2100,ni=0,ri=20,ii=new Set(["id","ids","uuid","guid","key","zip","zipcode","postal","postalcode","ssn","code","codes","sku","isbn","msisdn","imei"]);function Re(t){if(!t)return!1;let e=J(t);return e.length===0?!1:ii.has(e[e.length-1])?!0:Ut(t)!==null}var si=new Set(["year","yr","fy"]),oi=t=>J(t).some(e=>si.has(e))||ut(t)!==null,ai=/^(?:(?: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 je(t){if(!Number.isInteger(t)||t<190001||t>210012)return!1;let e=t%100;return e>=1&&e<=12}function Xe(t){if(!Number.isInteger(t)||t<19000101||t>21001231)return!1;let e=Math.floor(t/100)%100,n=t%100;return e>=1&&e<=12&&n>=1&&n<=31}var li=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,ui=/^(\d{4})([\/.])(\d{1,2})\2(\d{1,2})$/,ci=/^(\d{1,2})([\/.\-])(\d{1,2})\2(\d{4})(?:[ T](\d{2}):(\d{2})(?::(\d{2}))?)?$/;function un(t,e){let n=[],i=0,r=di(t,e,n,()=>{i++});if(r)return r;if(i>0||n.length<2)return null;let s=It(n,{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 di(t,e,n,i){let r=0,s=0,a=0,l=0,o=0,c="",u=0,g="",d=0,y=0,w=0,A=0,S=!1;for(let b of t){if(b==null)continue;let _=String(b).trim();if(_==="")continue;r++,n.push(_);let M;if(M=li.exec(_)){i();let W=+M[2],z=+M[3];W>=1&&W<=12&&z>=1&&z<=31&&(s++,M[4]!==void 0&&a++,M[6]!==void 0&&l++)}else if(M=ui.exec(_)){i();let W=+M[3],z=+M[4];W>=1&&W<=12&&z>=1&&z<=31&&(c&&c!==M[2]&&(S=!0),c=M[2],o++)}else if(M=ci.exec(_)){i();let W=+M[1],z=+M[3];W>=1&&W<=31&&z>=1&&z<=31&&(W<=12||z<=12)&&(g&&g!==M[2]&&(S=!0),g=M[2],u++,W>12&&w++,z>12&&A++,M[5]!==void 0&&d++,M[7]!==void 0&&y++)}if(r>=200)break}if(r<2||(s+o+u)/r<.8||(s>0?1:0)+(o>0?1:0)+(u>0?1:0)!==1||S)return null;if(s>0)return a===s?{pattern:l===s?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M",orderFrom:"iso"}:{pattern:"%Y-%m-%d",orderFrom:"iso"};if(o>0)return{pattern:`%Y${c}%m${c}%d`,orderFrom:"iso"};if(w>0&&A>0)return null;let x,f;w>0?(x=!0,f="values"):A>0?(x=!1,f="values"):g==="."?(x=!0,f="shape"):(x=!ze(e),f="locale");let C=x?`%d${g}%m${g}%Y`:`%m${g}%d${g}%Y`;return d===u?{pattern:C+(y===u?" %H:%M:%S":" %H:%M"),orderFrom:f}:{pattern:C,orderFrom:f}}function mi(t,e){if(!e||!/\b(?:19|20)\d{2}\b/.test(t))return!1;let n=t.replace(/\b(?:19|20)\d{2}\b/g,"").replace(/[-/.,]/g," ").trim();if(!n)return!1;let i=ee(n);return i.length>0&&e[i]!==void 0}function fi(t,e){let n=new Map,i=new Map;for(let l of t){let o=re(l);if(!o||"month"in o)continue;let c=se(o.word),u=c.some(d=>d.lang==="en"),g=ee(o.word);for(let d of new Set(c.map(y=>y.lang)))d!=="en"&&(n.has(d)||(n.set(d,new Set),i.set(d,new Set)),n.get(d).add(g),u||i.get(d).add(g))}let r=[...n.keys()].filter(l=>n.get(l).size>=3&&i.get(l).size>=1),s=0,a=new Map(r.map(l=>[l,0]));for(let l of e){let o=re(l);if(!o)continue;if("month"in o){s++;continue}let c=se(o.word);if(c.length===0)continue;let u=c.some(g=>g.lang==="en");for(let g of r)(u||c.some(d=>d.lang===g))&&a.set(g,a.get(g)+1)}return s+Math.max(0,...a.values())}var gi=/(?:19|20)[0-9]{2}/;function pi(t){let e=new Map,n=0;for(let r of t){if(!gi.test(ne(r)))continue;let s=new Set(ge(r).filter(a=>a.yearDigits===4&&(a.grain==="quarter"||a.grain==="week")).map(a=>a.lang));if(s.size!==0){if(s.has("en")){n++;continue}for(let a of s)e.set(a,(e.get(a)??0)+1)}}let i=0;for(let r of e.values())i=Math.max(i,r);return i>0?i+n:0}function hi(t){let{dataType:e,name:n,isMeasure:i,distinctCount:r}=t;if(e==="DateTime")return!0;if(i)return!1;if(e==="Integer"||e==="Decimal"){let s=t.minNum,a=t.maxNum;if(!(s!=null&&a!=null&&Number.isFinite(s)&&Number.isFinite(a)&&Number.isInteger(s)&&Number.isInteger(a)&&a>=s))return!1;let o=s>=1900&&a<=2100;if(o&&r>=2&&oi(n)||o&&r>=3&&r===a-s+1)return!0;let c=je(s)&&je(a),u=Xe(s)&&Xe(a);if(c||u){if(!t.sampleValues)return!0;let g=0,d=0;for(let y of t.sampleValues){if(y==null||y==="")continue;g++;let w=Number(String(y).trim());if(Number.isFinite(w)&&(c?je(w):Xe(w))&&d++,g>=60)break}if(g>=2&&d===g)return!0}return!1}if(t.sampleValues){let s=t.locale?Se(t.locale):null,a=0,l=0,o=[],c=[];for(let u of t.sampleValues){if(u==null||u==="")continue;a++;let g=String(u).trim();if(o.push(g),ai.test(g)||mi(g,s)?l++:c.push(g),a>=60)break}if(a>=2&&l/a>=.8||a>=2&&(l+pi(c)+fi(o,c))/a>=.8||un(o,t.locale)!==null)return!0}return!1}function yi(t){let e=q((t||"").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":Pt(t)}function bi(t){let{rows:e,measureColIdx:n,measureName:i,candidateDims:r,minNum:s,maxNum:a,discourageAgg:l}=t,o=100,c=.01,u="";for(let d of r){if(d.distinct<2||d.distinct>o)continue;let y=r.filter(h=>h.idx!==d.idx).map(h=>h.idx),w=new Map;for(let h of e){let x=h[n];if(typeof x!="number"||!Number.isFinite(x))continue;let f=y.length?y.map(b=>String(h[b])).join(u):"",C=w.get(f);C||(C={sum:0,cset:new Set},w.set(f,C)),C.sum+=x,C.cset.add(String(h[d.idx]))}let A=0,S=0,p=0;for(let h of w.values())h.cset.size<2||(p++,Math.abs(h.sum-100)<=100*c?A++:Math.abs(h.sum-1)<=1*c&&S++);if(p>=2&&(A/p>=.9||S/p>=.9))return{additivity:"part_of_whole",partOfWholeDim:d.name}}if(l)return{additivity:"intensive_rate"};let g=yi(i);return g==="avg"||g==="min"||g==="max"?{additivity:"intensive_rate"}:g==="count"?{additivity:"additive"}:g==="sum"?{additivity:"unknown"}:s!=null&&a!=null&&Number.isFinite(s)&&Number.isFinite(a)&&s>=0&&a<=1.0001&&a>0?{additivity:"intensive_rate"}:{additivity:"unknown"}}function cn(t){let{dataType:e,isMeasure:n,name:i,distinct:r,nonblank:s,prec:a,maxval:l,minval:o}=t,c=l-o+1,u=c>0?r/c:1,g=s>0?r/s:0,d=e==="Decimal"||a>0;return!n&&Re(i)?"Categorical":u>=Qr&&(mt(i)&&r<=Jr||o>=ei&&l<=ti||o>=ni&&l<=ri)?"Ordinal":n||r>Xr&&(d||r>=Zr||g>=qr)?"Continuous":"Categorical"}function an(t,e,n){return!t||t.isMeasure||e||t.dataType!=="Integer"&&t.dataType!=="Decimal"?!1:cn({dataType:t.dataType,isMeasure:!1,name:t.name,distinct:n.distinct,nonblank:n.nonblank,prec:n.prec,maxval:typeof n.maxval=="number"?n.maxval:0,minval:typeof n.minval=="number"?n.minval:0})==="Continuous"}function Si(t){let e=null;for(let n=0;n<t.length;n++){let i=t[n];if(typeof i!="string"||i.length===0)continue;let r=i.trim();r.length!==i.length&&(e||(e=t.slice()),e[n]=r)}return e||t}var ln=class{_computedStatsForLevel=null;_cols=[];_rows=[];_origIndices=[];_rowHashes=new Set;_hostQueryNames=[];_englishAliases=new Map;_declaredDimensions=new WeakSet;_inferredMeasureFlags=null;dedupRows=!0;emitLegacyAggAliases=!1;deriveProvinces=!0;dateCellsAreLocalWallClock=!1;wallClockColumnIndexes(){let e=new Set;if(!this.dateCellsAreLocalWallClock||!this._cols)return e;for(let n=0;n<this._cols.length;n++){let i=this._cols[n];!i||!/date|time/i.test(String(i.dataType??""))||at(this._rows.map(r=>r[n]))&&e.add(n)}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(n=>!!(n&&n.isMeasure));return this._cols.forEach((n,i)=>{if(!n||n.isMeasure||this._declaredDimensions.has(n)||n.dataType!=="Integer"&&n.dataType!=="Decimal")return;let r=new Set,s=0,a=0,l=null,o=null;for(let c of this._rows){let u=c[i],g=this.STR(u);if(g!=""&&(r.add(g),s++,(l===null||u<l)&&(l=u),(o===null||u>o)&&(o=u),n.dataType=="Decimal")){let d=this.getPrecision(u);d>a&&(a=d)}}e[i]=an(n,!1,{distinct:r.size,nonblank:s,prec:a,minval:l,maxval:o})}),Object.freeze(e),this._inferredMeasureFlags=e,e}declareDimensions(e){this._inferredMeasureFlags=null;for(let n of e)n&&this._declaredDimensions.add(n)}wholeDayIso(e){return ot(e)}hasTimeComponent(e){return!(e instanceof Date)||isNaN(e.getTime())?!1:this.wholeDayIso(e)===null}getColumnsWithStats(e,n){if(this._computedStatsForLevel==e)return this._cols;let i=0,r=parseInt(e),s=this.wallClockColumnIndexes(),a=[],l=[],o=[];for(let m of this._cols){let T=new Map,O=[],D=0,v=0,k=0,F=null,P=null,N=null,G=!1,V=!0,R=!0,E=null,K=!1,L=s.has(i);for(let I of this._rows){let $=I[i],B=L&&$ instanceof Date?fe($):$,H=this.STR(B);if(H!=""){if(D+=H.length,T.set(H,(T.get(H)||0)+1),v++,m.dataType=="Integer"||m.dataType=="Decimal"||m.dataType=="DateTime")if((F===null||B<F)&&(F=B),(P===null||B>P)&&(P=B),m.dataType=="Integer"||m.dataType=="Decimal"){if(N===null?N=B:N+=B,m.dataType=="Decimal"){let Z=this.getPrecision(B);Z>k&&(k=Z)}O.push(B)}else G=G||this.hasTimeComponent(B);K&&(B<E?V=!1:B>E&&(R=!1)),E=B,K=!0}}if(v>=3&&(V&&!R?m.sortedDirection="asc":R&&!V?m.sortedDirection="desc":m.sortedDirection="none"),v>0&&T.size>0&&!m.isMeasure){let I=0,$=Number.MAX_SAFE_INTEGER;for(let B of T.values())B>I&&(I=B),B<$&&($=B);if(m.modalShare=I/v,m.minGroupCount=$===Number.MAX_SAFE_INTEGER?null:$,T.size===2){let B=[...T.keys()].map(ce=>rt(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]),dn=/^(is|has)[_\p{L}\p{N}]|(?:default|churn|fraud|approv|convert|active|cancel|delinquen|flag|paid|win|pass|fail)/iu.test(m.name);(Z||dn)&&(m.isBinaryFlag=!0)}}else m.isMeasure&&(m.dataType==="Integer"||m.dataType==="Decimal")&&T.size===2&&T.has("0")&&T.has("1")&&(m.isBinaryFlag=!0);if(m.dataType=="DateTime"&&(m.dateWithTime=G,G&<(L?this._rows.map(I=>I[i]instanceof Date?fe(I[i]):I[i]):this._rows.map(I=>I[i]))?m.timeOfDayOnly=!0:delete m.timeOfDayOnly),m.isTemporal=hi({dataType:m.dataType,name:m.name,isMeasure:m.isMeasure,distinctCount:T.size,minNum:typeof F=="number"?F:null,maxNum:typeof P=="number"?P:null,sampleValues:T.keys(),locale:n}),m.isTemporal&&m.dataType==="String"&&!m.isMeasure){let I=un(T.keys(),n);I&&(m.temporalTextPattern=I.pattern)}if(m.timeOfDayOnly)delete m.temporalCadence;else if(m.isTemporal&&!m.isMeasure){let I=qt(T.keys(),{includeBounds:r>=20,pattern:m.temporalTextPattern,locale:n});I&&(m.temporalCadence=I)}this.updateColumnStats10(r,m,v,T,k,P,F),this.updateColumnStats20(r,O,v,N,m,D,G,F,P,k,T,n),an(m,this._declaredDimensions.has(m),{distinct:T.size,nonblank:v,prec:k,minval:F,maxval:P})&&(m.isMeasure=!0,m.geoKind=void 0,m.geoMatchPct=void 0,m.geoAmbiguous=void 0,m.dominantGeoRegion=void 0,m.dominantGeoRegionPct=void 0,m.geoRegionCount=void 0),a[i]=m.isMeasure||T.size>2e3?null:new Set(T.keys()),l[i]=T.size,o[i]=T.size===2?[...T.keys()].sort():null,i++}Mt(this._cols,this._rows,{cities:this.deriveProvinces}).forEach((m,T)=>{let O=this._cols[T];m.kind&&(O.geoKind=m.kind,O.geoMatchPct=m.matchPct,m.ambiguous&&(O.geoAmbiguous=!0)),m.rollupPct!==void 0&&(O.admin1RollupPct=m.rollupPct),m.regionCount!==void 0&&(O.admin1RegionCount=m.regionCount),m.countryCount!==void 0&&(O.admin1CountryCount=m.countryCount),m.dominantRegion&&(O.dominantGeoRegion=m.dominantRegion,O.dominantGeoRegionPct=m.dominantRegionPct)});let c=this.getGeoExtent();if(c&&c.dominantFrame&&this._geoExtentLatIdx>=0){let m=this._cols[this._geoExtentLatIdx];m.geoKind||(m.dominantGeoRegion=c.dominantFrame,m.dominantGeoRegionPct=c.dominantFramePct,this.deriveProvinces&&(m.admin1RollupPct=c.dominantFramePct))}let u=[];this._cols.forEach((m,T)=>{m.isMeasure||u.push({idx:T,distinct:m.distinctCount??0,name:m.name})}),this._cols.forEach((m,T)=>{if(!m.isMeasure)return;let O=typeof m.lowValue=="number"?m.lowValue:null,D=typeof m.highValue=="number"?m.highValue:null,v=bi({rows:this._rows,measureColIdx:T,measureName:m.name,candidateDims:u,minNum:O,maxNum:D,discourageAgg:!!m.discourageAggregationAcrossGroups});m.additivity=v.additivity,v.partOfWholeDim&&(m.partOfWholeDim=v.partOfWholeDim)});let g=50,d=4,y=u.filter(m=>m.distinct>=2&&m.distinct<=g);this._cols.forEach((m,T)=>{if(!m.isMeasure)return;let O=[];for(let R of this._rows){let E=R[T];if(E==null||E==="")continue;let K=typeof E=="number"?E:parseFloat(E);isNaN(K)||O.push(K)}if(O.length===0)return;let D=[...O].sort((R,E)=>R-E);if(D[0]===D[D.length-1])m.relativeDispersion=0;else if(D.length>=d){let R=me(D,.5),E=me(D,.1),K=me(D,.9);m.relativeDispersion=Math.abs(R)>1e-9?Math.round((K-E)/Math.abs(R)*1e3)/1e3:void 0}else m.relativeDispersion=void 0;let v=[];for(let R of y){let E=new Set;for(let K of this._rows){let L=K[T];L==null||L===""||E.add(this.STR(K[R.idx])+"")}v.push({otherColumn:R.name,nonBlankGroupCount:E.size})}v.length>0&&(m.nonBlankGroups=v);let k=0;for(let R of O)k+=R;k/=O.length;let F=0;for(let R of O)F+=(R-k)*(R-k);if(F<=1e-12)return;let P=[],N=[],G=R=>{if(R.length<4)return NaN;let E=[...R].sort((L,I)=>L-I),K=L=>E[Math.min(E.length-1,Math.max(0,Math.floor(L*(E.length-1))))];return K(.75)-K(.25)},V=G(O);for(let R of y){let E=new Map;for(let I of this._rows){let $=I[T];if($==null||$==="")continue;let B=typeof $=="number"?$:parseFloat($);if(isNaN(B))continue;let H=this.STR(I[R.idx])+"",Z=E.get(H);Z?(Z.s+=B,Z.n++,Z.vals.push(B)):E.set(H,{s:B,n:1,vals:[B]})}let K=0;for(let I of E.values()){let $=I.s/I.n;K+=I.n*($-k)*($-k)}P.push({otherColumn:R.name,eta2:Math.round(K/F*1e4)/1e4});let L=[];for(let I of E.values()){let $=G(I.vals);isNaN($)||L.push($)}if(L.length>=2&&isFinite(V)&&V>1e-9){let I=(Math.max(...L)-Math.min(...L))/V;N.push({otherColumn:R.name,spreadRatio:Math.round(I*1e4)/1e4})}}P.length>0&&(m.groupDiscrimination=P),N.length>0&&(m.spreadDiscrimination=N)});let w=.97,A=.8,S=8,p=5,h=this._cols.map((m,T)=>({c:m,i:T})).filter(m=>m.c.isMeasure);for(let m=0;m<h.length;m++)for(let T=m+1;T<h.length;T++){let O=h[m].i,D=h[T].i,v=0,k=0,F=0,P=0,N=0,G=0;for(let L of this._rows){let I=L[O],$=L[D];if(I==null||I===""||$===null||$===void 0||$==="")continue;let B=typeof I=="number"?I:parseFloat(I),H=typeof $=="number"?$:parseFloat($);isNaN(B)||isNaN(H)||(v++,k+=B,F+=H,P+=B*B,N+=H*H,G+=B*H)}if(v<p)continue;let V=v*P-k*k,R=v*N-F*F;if(V<=1e-12||R<=1e-12)continue;let E=(v*G-k*F)/Math.sqrt(V*R),K=Math.min(1,Math.round(Math.abs(E)*1e3)/1e3);for(let L of[h[m].c,h[T].c])(L.maxAbsMeasureCorrelation===void 0||K>L.maxAbsMeasureCorrelation)&&(L.maxAbsMeasureCorrelation=K);if(Math.abs(E)>=w){let L=h[m].c,I=h[T].c;L.collinearWithMeasures||(L.collinearWithMeasures=[]),I.collinearWithMeasures||(I.collinearWithMeasures=[]),L.collinearWithMeasures.push(I.name),I.collinearWithMeasures.push(L.name)}else if(Math.abs(E)>=A){let L=h[m].c,I=h[T].c,$=Math.round(E*1e3)/1e3;L.correlatedWithMeasures||(L.correlatedWithMeasures=[]),I.correlatedWithMeasures||(I.correlatedWithMeasures=[]),L.correlatedWithMeasures.push({otherColumn:I.name,r:$}),I.correlatedWithMeasures.push({otherColumn:L.name,r:$})}}for(let{c:m}of h)m.correlatedWithMeasures&&(m.correlatedWithMeasures.sort((T,O)=>Math.abs(O.r)-Math.abs(T.r)||(T.otherColumn<O.otherColumn?-1:1)),m.correlatedWithMeasures.length=Math.min(m.correlatedWithMeasures.length,S));for(let m=0;m<this._cols.length;m++){let T=a[m];if(!T||T.size===0)continue;let O=[];for(let D=0;D<this._cols.length;D++){if(D===m)continue;let v=a[D];if(!v||v.size===0)continue;let k=0;for(let P of T)v.has(P)&&k++;let F=Math.round(k/T.size*100);F>0&&O.push({otherColumn:this._cols[D].name,percentShared:F})}O.length>0&&(this._cols[m].sharedValueRatioWithOthers=O)}let x=50,f=[];for(let m=0;m<this._cols.length;m++){let T=a[m];T&&T.size>=2&&T.size<=x&&f.push(m)}if(f.length>=2){let m=new Map,T=(D,v)=>D+":"+v;for(let D=0;D<f.length;D++)for(let v=D+1;v<f.length;v++)m.set(T(f[D],f[v]),new Map);for(let D of this._rows)for(let v=0;v<f.length;v++){let k=this.STR(D[f[v]])+"";for(let F=v+1;F<f.length;F++){let P=""+this.STR(D[f[F]]),N=m.get(T(f[v],f[F])),G=k+""+P;N.set(G,(N.get(G)??0)+1)}}let O=new Map;for(let D=0;D<f.length;D++)for(let v=D+1;v<f.length;v++){let k=f[D],F=f[v],P=a[k].size,N=a[F].size,G=m.get(T(k,F)),V=G.size,R=0;for(let I of G.values())(R===0||I<R)&&(R=I);let E=Math.round(V/(P*N)*100),K=V===P,L=V===N;if((this._cols[k].categoricalPairStats||=[]).push({otherColumn:this._cols[F].name,fillPct:E,determinesOther:K,minCellCount:R,distinctCombinations:V}),(this._cols[F].categoricalPairStats||=[]).push({otherColumn:this._cols[k].name,fillPct:E,determinesOther:L,minCellCount:R,distinctCombinations:V}),K&&P>N){let I=O.get(k);(!I||N<I.card)&&O.set(k,{name:this._cols[F].name,card:N,ratio:N/P})}if(L&&N>P){let I=O.get(F);(!I||P<I.card)&&O.set(F,{name:this._cols[k].name,card:P,ratio:P/N})}}for(let[D,v]of O)this._cols[D].primaryParentColumn=v.name,this._cols[D].nestingRatio=Math.round(v.ratio*100)/100}let C=6,b=this._rows.length;for(let m=0;m<this._cols.length;m++){let T=this._cols[m];if(T.isMeasure||T.primaryParentColumn)continue;let O=T.distinctCount??0;if(O<=x||b>0&&O>=b)continue;let D=[];for(let v=0;v<this._cols.length;v++){if(v===m)continue;let k=this._cols[v];if(k.isMeasure)continue;let F=k.distinctCount??0;F<2||F>=O||D.push(v)}D.sort((v,k)=>(this._cols[v].distinctCount??0)-(this._cols[k].distinctCount??0));for(let v of D.slice(0,C)){let k=new Map,F=!0;for(let N of this._rows){let G=this.STR(N[m])+"",V=this.STR(N[v])+"",R=k.get(G);if(R===void 0)k.set(G,V);else if(R!==V){F=!1;break}}if(!F)continue;let P=this._cols[v].distinctCount??0;T.primaryParentColumn=this._cols[v].name,T.nestingRatio=Math.round(P/O*100)/100;break}}let _=.01,M=.05,W=.95,z=8,X=8,Q=6,ue=500,U=[];for(let m=0;m<this._cols.length&&U.length<X;m++){let T=this._cols[m].dataType;(T==="Double"||T==="Integer"||T==="Decimal")&&U.push(m)}if(U.length>=3&&this._rows.length>=z){let m=Math.min(this._rows.length,ue),T=U.map(P=>{let N=[];for(let R=0;R<m;R++){let E=this._rows[R][P],K=typeof E=="number"?E:parseFloat(String(E).replace(/,/g,""));if(E==null||E===""||!isFinite(K))return null;N.push(K)}let G=N[0],V=!1;for(let R of N)if(R!==G){V=!0;break}return V?N:null}),O=U.map((P,N)=>N).filter(P=>T[P]!==null),D=P=>{let N=P.slice().sort((V,R)=>V-R),G=N.length>>1;return N.length%2?N[G]:(N[G-1]+N[G])/2},v=null,k=[],F=P=>{if(k.length>=3){let N=k.map(E=>T[E]),G=N[0].length,V=new Array(G);for(let E=0;E<G;E++){let K=0;for(let L of N)K+=L[E];V[E]=K}let R=D(V);if(R>0){let E=0;for(let L of V)Math.abs(L-R)<=R*_&&E++;let K=E/G;if(K>=W){let L=1;for(let I of N){let $=D(I)/R;$<L&&(L=$)}L>=M&&(!v||k.length>v.cols.length)&&(v={cols:k.slice(),total:R,matched:K})}}}if(!(k.length>=Q))for(let N=P;N<O.length;N++)k.push(O[N]),F(N+1),k.pop()};if(F(0),v){let P=v,G={columns:P.cols.map(V=>this._cols[U[V]].name),total:Math.round(P.total*1e3)/1e3,matchedPct:Math.round(P.matched*100)/100};for(let V of P.cols)this._cols[U[V]].constantSumGroup=G}}return this.applyTwoSetPairing(n,a),this.applyScoreSeparation(l,o),this.applySeriesCompleteness(r,n,a),this.applyMeasurePersistence(n,a),this._computedStatsForLevel=e,this._cols}applyTwoSetPairing(e,n){for(let r of this._cols)r.twoSetPairing!==void 0&&delete r.twoSetPairing;let i=rn({rows:this._rows,columns:this._cols.map((r,s)=>{let a=n[s];return{name:r.name,values:a,distinct:a?a.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,n){for(let r of this._cols)r.scoreSeparation!==void 0&&delete r.scoreSeparation;let i=sn({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:n[s]??null})),text:r=>this.STR(r)});for(let[r,s]of i)this._cols[r].scoreSeparation=s}applySeriesCompleteness(e,n,i){for(let c of this._cols)c.seriesCompleteness!==void 0&&delete c.seriesCompleteness;let r=this._cols.map((c,u)=>({c,i:u})).filter(({c})=>c.isTemporal&&!c.isMeasure&&c.temporalCadence&&c.temporalCadence.grain!=="irregular");if(r.length===0)return;let s=this.seriesKeyIndex(n,i);if(s<0)return;let a=this._cols[s],l=this._rows.map(c=>this.STR(c[s])),o=e>=20&&(a.dataType!=="String"||Array.isArray(a.safeDistinctValues));for(let{c,i:u}of r){let g=tn({periods:this._rows.map(d=>this.STR(d[u])),series:l,seriesColumn:a.name,pattern:c.temporalTextPattern,locale:n,includeDates:e>=20,includeNames:o});g&&(c.seriesCompleteness=g)}}seriesKeyIndex(e,n){let i=[],r=[];this._cols.forEach((a,l)=>{let o=n[l];o&&(i.push(l),r.push({name:a.name,dataType:a.dataType,isMeasure:!!a.isMeasure,isTemporal:!!a.isTemporal,isDatePart:!!a.isDatePart,isReassembledDate:!!a.isReassembledDate,isBinaryFlag:!!a.isBinaryFlag,geoKind:a.geoKind,identifierNamed:Re(a.name),values:o,rows:this._rows.length,locale:e}))});let s=en(r);return s<0?-1:i[s]}applyMeasurePersistence(e,n){for(let o of this._cols)o.persistence!==void 0&&delete o.persistence;let i=[];if(this._cols.forEach((o,c)=>{o.isMeasure&&(o.dataType==="Integer"||o.dataType==="Decimal"||o.dataType==="Double")&&i.push(c)}),i.length===0||this._rows.length<Ie)return;let r=-1,s=[];for(let o=0;o<this._cols.length&&r<0;o++){let c=this._cols[o];if(!c.isTemporal||c.isMeasure||c.isDatePart)continue;let u=this._rows.map(g=>j(this.STR(g[o]),c.temporalTextPattern,e)?.ms??null);new Set(u.filter(g=>g!==null)).size<Ie||(r=o,s=u)}if(r<0)return;let a=this.seriesKeyIndex(e,n),l=a>=0?this._rows.map(o=>this.STR(o[a])):void 0;for(let o of i){let c=this._rows.map(g=>{let d=g[o];if(d==null||d==="")return null;let y=typeof d=="number"?d:parseFloat(String(d).replace(/,/g,""));return Number.isFinite(y)?y:null}),u=Ue({stamps:s,series:l,values:c});u&&(this._cols[o].persistence={timeColumn:this._cols[r].name,...a>=0?{seriesColumn:this._cols[a].name}:{},...u})}}updateColumnStats20(e,n,i,r,s,a,l,o,c,u,g,d){if(e>=20){let y=[...n].sort((S,p)=>S-p),w=Math.floor(y.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=a/i),this._rows.length>0){let S=p=>{let h=p instanceof Date?p:typeof p=="string"?Ne(p)??new Date(p):new Date(p),x=this.wholeDayIso(h);return x?x+"T00:00:00.000Z":isNaN(h.getTime())?p:h.toISOString().slice(0,10)+"T00:00:00.000Z"};s.dataType!="DateTime"||l||!o?s.lowValue=o:s.lowValue=S(o),s.dataType!="DateTime"||l||!c?s.highValue=c:s.highValue=S(c),s.medianValue=y.length===0?null:y.length%2===0?s.dataType=="Integer"?Math.round((y[w-1]+y[w])/2):(y[w-1]+y[w])/2:y[w],s.numericPrecision=u}if(y.length>0){let S=s.avgValue??0,p=y.length,h=0,x=0;for(let b of y){let _=b-S;h+=_*_,x+=_*_*_}let f=h/p,C=Math.sqrt(f);s.skewness=f===0?0:x/p/(C*C*C),s.stdDev=Math.sqrt(f)}r!==null&&(s.sum=r);let A=Array.from(g.entries()).sort((S,p)=>p[1]-S[1]);if(s.topCategories=A.slice(0,10).map(S=>S[1]),!s.isMeasure&&A.length>0&&(s.dataType!=="String"&&(s.topCategoryValues=A.slice(0,5).map(S=>S[0])),e>=20)){let S=A.map(h=>h[0]),p=pe(S,d);if(p!==null)s.ordinalPattern=p.pattern,s.orderedDomain=p.orderedDomain;else if(s.dataType==="String"){let h=ft(S);h!==null&&(s.safeDistinctValues=h)}}if(y.length>=8&&(s.dataType==="Integer"||s.dataType==="Decimal")){let S=p=>y[Math.floor((y.length-1)*p)];s.quantiles={p05:S(.05),p25:S(.25),p75:S(.75),p95:S(.95)}}}if(!s.isMeasure&&s.dataType==="String"&&g.size>0){let y=Array.from(g.entries()).sort((S,p)=>p[1]-S[1]).map(S=>S[0]);s.formatSignature=be(y);let w=i>0?a/i:void 0,A=/^(UUID|EMAIL_LIKE|URL_LIKE|PHONE_LIKE|NUMERIC_ID|HEX_ID|OPAQUE_ID_ALPHANUMERIC|DATE_STR|BOOLEAN)$/;s.formatSignature&&!A.test(s.formatSignature)&&(w===void 0||w>=3)&&(s.isFreeText=!0)}if(!s.isMeasure&&g.size>0){let y=Array.from(g.entries()).sort((A,S)=>S[1]-A[1]),w=_t(y.map(A=>A[0]),s.name,d);if(w!==null&&(s.geoKind=w.geoKind,s.geoMatchPct=w.geoMatchPct,w.geoAmbiguous&&(s.geoAmbiguous=!0),w.geoKind.indexOf("country")===0)){let A=ht(y);A&&(s.dominantGeoRegion=A.dominantGeoRegion,s.dominantGeoRegionPct=A.dominantGeoRegionPct,s.geoRegionCount=A.regionCount,A.middleEastPct>0&&(s.middleEastPct=A.middleEastPct))}}}updateColumnStats10(e,n,i,r,s,a,l){let o=this._rows.length-i;e>=10&&(n.blankCount=o),n.distinctCount=r.size+(o!=0?1:0),n.valueNature="Categorical",i>0&&(n.dataType==="Integer"||n.dataType==="Decimal"?n.valueNature=cn({dataType:n.dataType,isMeasure:!!n.isMeasure,name:n.name,distinct:r.size,nonblank:i,prec:s,maxval:a,minval:l}):n.dataType==="DateTime"&&(n.valueNature=n.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 n=new Set;for(let i of this._rows)n.add(JSON.stringify(e.map(r=>i[r])));return this._leafCardinality=n.size,this._leafCardinality}_leafCardinality=null;getGeoExtent(){if(this._geoExtentComputed)return this._geoExtent;this._geoExtentComputed=!0,this._geoExtent=null;let e=a=>qe(a,{camel:!0}),n=-1,i=-1,r=-1;if(this._cols.forEach((a,l)=>{let o=e(a.name),c=a.dataType==="Integer"||a.dataType==="Decimal";c&&n<0&&o.some(u=>u==="lat"||u==="latitude")?n=l:c&&i<0&&o.some(u=>u==="lon"||u==="lng"||u==="long"||u==="longitude")&&(i=l),r<0&&!a.isMeasure&&typeof a.geoKind=="string"&&a.geoKind.indexOf("country")===0&&(r=l)}),n<0||i<0){let a=(c,u)=>{let g=0;for(let d of this._rows){let y=d[c];if(y==null||y==="")continue;let w=Number(y);if(!Number.isFinite(w)||w<-u||w>u)return!1;g++}return g>0},l=-1,o=-1;if(this._cols.forEach((c,u)=>{if(!(c.dataType==="Integer"||c.dataType==="Decimal"))return;let g=e(c.name),d=g.some(y=>y==="lat"||y==="latitude")?"lat":g.some(y=>y==="lon"||y==="lng"||y==="long"||y==="longitude")?"lon":Rt(g);d==="lat"&&l<0&&a(u,90)?l=u:d==="lon"&&o<0&&a(u,180)&&(o=u)}),l<0||o<0)return null;n=l,i=o}this._geoExtentLatIdx=n;let s=[];for(let a of this._rows){let l=a[n],o=a[i],c=l==null||l===""?null:Number(l),u=o==null||o===""?null:Number(o);s.push({lat:c,lon:u,country:r>=0&&he(this.STR(a[r]))?this.STR(a[r]):null})}return this._geoExtent=pt(s),this._geoExtent}_geoExtent=null;_geoExtentComputed=!1;_geoExtentLatIdx=-1;obfuscateString(e){return jt(e,st)}toObjectArray(){let e=this.liveEnglishAliases();return this._rows.map(n=>{let i={};this._cols.forEach((r,s)=>{i[r.name]=n[s],this.emitLegacyAggAliases&&r.hostName&&r.hostName!==r.name&&!Object.prototype.hasOwnProperty.call(i,r.hostName)&&(i[r.hostName]=n[s])});for(let[r,s]of e)Object.prototype.hasOwnProperty.call(i,s.alias)||(i[s.alias]=n[r]);return i})}async getCSVAsync(e){let n=[],i=e?25:1e7,r=e?4e3:1e7,s=new Map,a=this.wallClockColumnIndexes();for(let o of this._rows){let c={};for(let u=0;u<this._cols.length;u++){let g=this._cols[u],d=o[u];if(this.STR(d)!=""){if(e&&g.dataType=="String")if(s.has(d))d=s.get(d);else{let y=this.obfuscateString(d);s.set(d,y),d=y}else if(g.dataType=="DateTime"&&!g.dateWithTime){let y=d instanceof Date?d:typeof d=="string"?Ne(d)??new Date(d):new Date(d);d=(this.wholeDayIso(y)??y.toISOString().slice(0,10))+"T00:00:00.000Z"}else a.has(u)&&d instanceof Date&&(d=fe(d));r-=this.STR(d).length}else d=null;c[u]=d,--r}if(n.push(c),--i,i<=0||r<=0)break}return await on.unparse(n,{header:!1})}getCSVHeaderLine(){let e=this.liveEnglishAliases();return on.unparse([this._cols.map((n,i)=>{if(this.emitLegacyAggAliases&&n.hostName)return this.STR(n.hostName);let r=e.get(i);return this.STR(r&&r.headerName?r.alias:n.name)})])}setHostQueryNames(e){this._hostQueryNames=(e??[]).map(n=>n==null?null:this.STR(n)),this._englishAliases=new Map}aliasesForCode(e){let n=Ge(e,this._cols)?this.legacyAliases():[];for(let i of this.englishAliasesFor(e).values())n.push({name:i.name,alias:i.alias,reason:"english-implicit-agg"});return n}armAliasesForCode(e){return this.emitLegacyAggAliases=Ge(e,this._cols),this._englishAliases=this.englishAliasesFor(e),this.getArmedAliases()}getArmedAliases(){let e=this.emitLegacyAggAliases?this.legacyAliases():[];for(let n of this.liveEnglishAliases().values())e.push({name:n.name,alias:n.alias,reason:"english-implicit-agg"});return e}legacyAliases(){let e=[];for(let n of this._cols)n&&n.hostName&&n.hostName!==n.name&&e.push({name:this.STR(n.name),alias:this.STR(n.hostName),reason:"doubled-agg-prefix"});return e}englishAliasesFor(e){let n=new Map;if(!e||this._hostQueryNames.length===0||!this._cols||this._cols.length===0)return n;let i=String(e),r=new Set;for(let a of this._cols)a&&(r.add(this.STR(a.name)),a.hostName&&r.add(this.STR(a.hostName)));let s=new Map;for(let a=0;a<this._cols.length;a++){if(!this._cols[a]||Wt(this._hostQueryNames[a],this._cols[a].name,this._cols[a].dataType))continue;let l=zt(this._hostQueryNames[a]).filter(o=>!r.has(o)&&oe(i,o));l.length===1&&s.set(l[0],[...s.get(l[0])??[],a])}for(let[a,l]of s){if(l.length!==1)continue;let o=this.STR(this._cols[l[0]].name);n.set(l[0],{name:o,alias:a,headerName:!oe(i,o)})}return n}liveEnglishAliases(){let e=new Map;for(let[n,i]of this._englishAliases){let r=this._cols?this._cols[n]:null;r&&this.STR(r.name)===i.name&&e.set(n,i)}return e}addRow(e,n){if(this.dedupRows){let i="";for(let s of e)i+=this.STR(s)+"~";let r=it(i);if(this._rowHashes.has(r))return!1;this._rowHashes.add(r)}return this._rows.push(Si(e)),this._inferredMeasureFlags=null,this._origIndices.push(n??-1),!0}getOriginalRowIndex(e){return e<0||e>=this._origIndices.length?-1:this._origIndices[e]}invalidateStats(){this._computedStatsForLevel=null,this._geoExtentComputed=!1,this._geoExtent=null,this._geoExtentLatIdx=-1}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 n=new Set(e.map(i=>this.STR(i?.name)));for(let i of e){if(!i)continue;let r=this.STR(i.name),s=Lt(r);!s||s===r||n.has(s)||(n.delete(r),n.add(s),i.hostName=r,i.name=s)}}};export{mn as a,fn as b,wi as c,Mi as d,Mt as e,It as f,Tn as g,vn as h,Rt as i,En as j,Nn as k,kn as l,Dn as m,Me as n,Gn as o,Lt as p,Ge as q,zt as r,Bt as s,Un as t,Vt as u,Kt as v,Oi as w,Pi as x,Li as y,jn as z,Xn as A,Zn as B,Ut as C,oe as D,lr as E,Vi as F,ur as G,cr as H,j as I,qt as J,Mr as K,Tr as L,vr as M,kr as N,en as O,tn as P,ts as Q,Re as R,un as S,hi as T,yi as U,bi as V,cn as W,an as X,Si as Y,ln as Z};
|
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 yr,b as hr}from"./chunk-HIVICMC5.mjs";import{a as Cr,b as M,c as br,d as D,e as E,f as Er,g as J,h as Z}from"./chunk-4J7WPYLM.mjs";import{a as fr,b as pr,c as gr}from"./chunk-QHZYDO3U.mjs";import{A as Hn,B as Kn,C as Bn,D as jn,E as Yn,F as Qn,G as Xn,H as Jn,I as Zn,J as er,K as tr,L as nr,M as rr,N as or,O as ir,P as sr,Q as ar,R as lr,S as ur,T as cr,U as dr,W as mr,a as pn,b as gn,c as yn,d as hn,e as Cn,g as wn,h as _n,i as On,j as Pn,k as An,l as vn,m as Ln,n as Mn,o as In,p as Nn,q as Fn,r as Dn,s as kn,t as Gn,u as Vn,v as Un,w as Wn,x as qn,y as $n,z as zn}from"./chunk-O6A7HGFH.mjs";import{a as bn}from"./chunk-U3H6UBOO.mjs";import{b as En,c as Tn,d as Sn,f as Rn,g as xn}from"./chunk-TZ74QIKA.mjs";import{a as de,c as me,e as cn,f as dn,g as mn,h as fn}from"./chunk-YDYFP2T4.mjs";import{A as Q,B as Zt,C as en,D as ce,E as I,F as tn,G as nn,H as rn,I as W,J as on,K as sn,L as an,M as ln,N as X,O as un,a as L,b as G,c as j,d as V,j as U,k as Vt,l as Ut,m as Wt,n as qt,o as $t,q as zt,r as Ht,s as Y,t as Kt,u as Bt,v as jt,w as Yt,x as Qt,y as Xt,z as Jt}from"./chunk-DTBXJVUG.mjs";import"./chunk-5MRZID36.mjs";import{a as Et,b as Tt,c as St,d as Rt,e as xt,f as wt,g as _t,h as Ot,i as Pt,j as At,k as vt,l as Lt,m as Dt,n as kt,o as Gt}from"./chunk-3ZAS32F5.mjs";import{b as Mt,c as It,d as Nt,e as Ft}from"./chunk-5HI6TVMM.mjs";import{A as gt,B as yt,C as ht,D as Ct,E as bt,a as He,b as Ke,c as Be,d as je,e as Ye,f as Qe,g as Xe,h as Je,i as Ze,j as et,k as tt,l as nt,m as rt,n as ot,o as it,q as B,r as st,s as at,t as lt,u as ut,v as ct,w as dt,x as mt,y as ft,z as pt}from"./chunk-CZJ7M6A5.mjs";import{a as Ve,b as Ue,c as We,d as qe,e as $e,f as K,g as ze}from"./chunk-WC4JINEZ.mjs";var ee=2,ge=400;function ne(e){return!!U(e)}function F(e){let t=new Set;for(let n of e){if(n==null)continue;let o=V(String(n));if(!G(o)&&!t.has(o)&&(t.add(o),t.size>=ge))break}return Array.from(t)}function N(e){let t=F(e);if(t.length===0||re(e)<95)return!1;let n=t.filter(a=>ne(a)&&!I(a)).length,o=t.filter(a=>!ne(a)&&!!I(a)).length;return n>=1&&n>=o}function fe(e,t){if(!I(e))return!1;let n=U(e);return n?t==="world"?!0:ce.has(n):!1}function re(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let o of t)ne(o)&&n++;return Math.round(n/t.length*1e3)/10}function oe(e){return I(e)?!0:Y()?Q(e).status!=="unmatched"||Q(e.trim().replace(/\s+/g,"-")).status!=="unmatched":!1}function q(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let o of t)oe(o)&&n++;return Math.round(n/t.length*1e3)/10}function se(e){let t=new Set;for(let n of e){if(n==null)continue;let o=String(n).trim();if(!G(V(o))&&!t.has(o)&&(t.add(o),t.size>=ge))break}return Array.from(t)}function ie(e){let t=se(e);if(t.length===0)return 0;let n=0;for(let o of t)W(o).length>0&&n++;return Math.round(n/t.length*1e3)/10}function pe(e,t){return me(t,de)?!0:se(e).some(n=>/^\d{5}(-\d{4})?$/.test(n.replace(/\.0+$/,"")))}function Tr(e,t){let n=F(e);if(n.length===0)return 0;let o=0;for(let a of n)X(a,t)&&o++;return Math.round(o/n.length*1e3)/10}function te(e,t){let n=0;for(let o of F(e))t(o)&&n++;return n}function Sr(e,t){let n=0;for(let o of se(e))t(o)&&n++;return n}function Rr(e,t,n,o,a){let u=[],l=[],i={},y={},h=new Set(e),b=s=>t.map(d=>d[s]);for(let s of["city","country"]){let d=n?.[s];d&&h.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&&h.has(f)){let s=b(f),d=ie(s);d<95?l.push(`zip=${f} (only ${d}% of values read as ZIPs)`):pe(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&&h.has(c)){let s=b(c),d=F(s);d.length>0&&d.every(S=>fe(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)):q(s)<95?l.push(`state=${c} (only ${q(s)}% of values are states/provinces)`):i.state=c}let p=new Set(Object.values(i).filter(Boolean)),C=e.filter(s=>!p.has(s)&&!s.startsWith("__"));if(!i.state){let s=null;for(let d of C){let S=b(d);if(N(S))continue;let O=q(S);if(O<95)continue;let H=te(S,oe),Ge=te(S,ue=>oe(ue)&&!fe(ue,o));H<ee&&Ge<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 C){if(p.has(s))continue;let d=b(s),S=ie(d);if(!(S<95)&&pe(d,s)&&!(Sr(d,O=>W(O).length>0)<ee)){i.zip=s,p.add(s),u.push(`zip=${s} (${S}% ZIP codes)`);break}}let T=i.country;if(!T||!N(b(T))){let s=null;for(let d of C){if(p.has(d)||!N(b(d)))continue;let S=re(b(d));(!s||S>s.pct)&&(s={name:d,pct:S})}s&&(T&&(l.push(`country=${T} (only ${re(b(T))}% of values are country identifiers; using ${s.name} instead)`),y.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 C){if(p.has(d))continue;let S=b(d),O=Tr(S,o);O<j||te(S,H=>X(H,o))<ee||(!s||O>s.pct)&&(s={name:d,pct:O})}s&&(i.city=s.name,u.push(`city=${s.name} (${s.pct}% known cities)`))}let A=i.country?b(i.country):[],R=!!i.country&&N(A),v=R?new Set(A.map(s=>U(s==null?null:String(s))).filter(Boolean)).size:0,x=R&&v>=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(y).length?{labelFallback:y}:{}}}var r=(e,...t)=>({part:e,langs:Object.freeze(t)}),ae=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")}),xr=Object.freeze(Array.from(new Set(Object.values(ae).flatMap(e=>e.langs)))),ye=Object.freeze(["fa","ar","he","th"]),he=1900,Ce=2100;function wr(e,t){let n=[],o=K(t);try{o&&n.push(e.toLocaleLowerCase(o.intl))}catch{}let a=e.toLowerCase();return n.includes(a)||n.push(a),n}function _r(e,t){let n=String(e??"").trim().normalize("NFC");if(!n)return null;for(let o of wr(n,t)){let a=ae[o];if(a&&a.langs.includes(t))return a.part}return null}function Or(e,t){return ye.includes(e)?typeof t=="number"&&Number.isFinite(t)&&t>=he&&t<=Ce:!0}function be(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Pr=/\b(?:columns|cols|column)\b/i;function $(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)),Pr.test(o)}function Ee(e,t){return Te(e,t,n=>new RegExp(String.raw`\b${n}\s*(?:>=\s*0|>\s*-1|[!=]==?\s*-1)`).test(e))}function Te(e,t,n){let o=be(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;)$(e,i.index)&&l++;let y=0;for(;(i=a.exec(e))!==null;){let h=i.index+i[0].lastIndexOf(".name");if(!$(e,h))continue;y++;let b=be(i[1]);if(!n(b))return!1}return y>0&&y===l}function Ar(e,t){return Te(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 Se=["__rowIdx__","__geoIso__","__geoLat__","__geoLon__","__geoPrecision__"];function vr(e,t){if(!e)return[];let n=new Set(t);for(let i of Se)n.add(i);let o=new Set,a=/\.name\s*===?\s*(['"])([^'"]+)\1/g,u;for(;(u=a.exec(e))!==null;)$(e,u.index)&&o.add(u[2]);if(o.size===0)return[];let l=[];return o.forEach(i=>{n.has(i)||Ee(e,i)||l.push(i)}),l}function Lr(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 Re(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 Mr(e,t,n){let o=Re(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=xe(n);return i.length===0?l:l+" "+i.join(" ")}function xe(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():"",y=typeof u.name=="string"?u.name.trim():"",h=i!==""?i:y;h!==""&&o.set(l,h)}}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,we=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},Ir=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function _e(e,t){let n={};for(let[o,a]of Ir){let u=m(E(e,t+a));u&&(n[o]=u)}return n}function Nr(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 Fr(e){let t=h=>E(e,h),n=t("retryAfterSeconds"),o=t("overrideThumbnailUpload"),a=t("forceThumbnailUpload"),u=_e(e,"point"),l=_e(e,"destPoint");Object.keys(l).length&&(u.dest=l);let i=t("retryable"),y=t("isPollFinal");return{errorMessage:m(t("errorMessage")),errorCode:m(t("errorCode")),refusalCode:m(t("refusalCode")),retryable:typeof i=="boolean"?i:null,notices:Nr(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:we(t("creditBalanceBefore")),creditCost:we(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 y=="boolean"?{isPollFinal:y}:{},...m(t("pollOutcome"))!==""?{pollOutcome:m(t("pollOutcome"))}:{},...typeof o=="boolean"?{overrideThumbnailUpload:o}:{},...typeof a=="boolean"?{forceThumbnailUpload:a}:{}}}var Oe=e=>e==null?void 0:Number(e),k=e=>m(e)||void 0;function Dr(e){let t=E(e,"charts"),n=E(e,"refused"),o=Array.isArray(t)?t.map(u=>{let l=y=>E(u,y),i=l("recommended");return{name:m(l("chartTypeName")??l("name")),description:m(l("description")??l("chartDesc")),rank:Oe(l("rank")),score:Oe(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 kr(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 Pe=["working","analyze","generate","refine","review"];function Gr(e,t){let n=String(e??"").trim().toLowerCase();if(Pe.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 Vr="FREEMIUM_ATTEMPT_SPENT",Ur="CLIENT_SECRET_MISMATCH",Wr="FREEMIUM_COLUMN_CAP",qr="OAUTH_TOKEN_EXPIRED",$r="OAUTH_SIGNED_OUT";function zr(e){let t=e?.retryable;return typeof t=="boolean"?t:null}function Hr(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 Kr(e){let{width:t,height:n}=e.measure();return{request:{height:n,width:t},hints:{viewportWidth:t,viewportHeight:n}}}function Br(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 Ae(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 jr(e){let t=e.fetchCorrelationId!=null,o=t||e.recoveryFetchVersion!=null?!1:e.genNew,a=Ae({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,i=e.fetchCutAtMs,y=t&&typeof i=="number"&&Number.isSafeInteger(i)&&i>0?i:void 0,h=t?Yr(e.fetchCause):"";return{genNew:o,version:a.version,fetchOnly:a.fetchOnly,fetchCorrelationId:e.fetchCorrelationId??void 0,...l!==void 0?{fetchArmedAtMs:l}:{},...y!==void 0?{fetchCutAtMs:y}:{},...h?{fetchCause:h}:{}}}function Yr(e){if(typeof e!="string")return"";let t=e.replace(/[\u0000-\u001f\u007f]+/g," ").trim().slice(0,120);return/[\ud800-\udbff]$/.test(t)&&(t=t.slice(0,-1)),t.trimEnd()}function Qr(e){let t=n=>e.renderers.has(n);return{supportsD3:t("D3"),supportsPlotly:t("PLOTLY"),supportsVega:t("VEGA")}}function Xr(e){let t=e.cap!=null&&e.budget>e.cap?e.cap:e.budget;return{triesLeft:e.triesLeft??t,maxTries:t}}function Jr(e){return e&&e>0?{leafCardinality:Math.round(e)}:{}}function Zr(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 eo={fit:"Best fit",variety:"Something different"};function ve(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return t==="fit"||t==="variety"?t:null}function to(e){let t=ve(e);return t?{qualifyOrder:t}:{}}function Le(e,t){return e!=null&&t!=null&&e!==t}function no(e,t){return e?Le(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 ro=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function Me(e){let t=String(e??"").trim().toLowerCase();return ro[t]??t}function Ie(e){let t="";for(let n of e)t+=JSON.stringify([String(n.name??""),n.isMeasure?"M":"D",Me(n.dataType)]);return t}function oo(e){return B(Ie(e))}var io=2,so=3,ao=4,lo=64,uo=8e3,co=6e4,mo=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict",REDRAW:"redraw",INTERACT:"interact"}),fo=Object.freeze(["open","generate","version","rebind","data","sample","fix","resize","other"]);function po(e,t){return t?`${t};draw:${e}`:`draw:${e}`}function go(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 yo(){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 ho(e){return!!e&&!e.includes("|")&&!e.includes(",")}function le(e,t,n,o){let a=`${e},${t}|${n}`;return o?`${a}|${Math.max(0,Math.round(o.count))}|${o.nonce}`:a}function Co(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,y=()=>typeof t.baseUrl=="function"?t.baseUrl():t.baseUrl,h=g=>{try{t.onFailure?.(g)}catch{}},b=async(g,f,c,p)=>{let C;try{let T=await a.post(f,c,p,{timeoutMs:i});C=T.status;try{T.body?.cancel().catch(()=>{})}catch{}}catch(T){h({channel:g,stage:"post",status:null,error:T});return}(C<200||C>299)&&h({channel:g,stage:"status",status:C,error:null})};return{async sendClientMessage(g){let f,c,p;try{f=`${y()}${l}/LogClientMsg/?nocache=${u.now()}`,c=M(g),p=D(c,o)}catch(C){h({channel:"client-message",stage:"build",status:null,error:C});return}await b("client-message",f,c,{"Content-Type":"text/plain","X-Signature":p})},async countEvent(g,f,c){let p,C;try{p=`${y()}${l}/eventlog`,C=le(g,t.clientVersion,f,c)}catch(T){h({channel:"event-count",stage:"build",status:null,error:T});return}await b("event-count",p,C,{"Content-Type":"text/plain"})}}}var Ne=2**31-1;function Fe(e){return Object.assign(new Error(`The request did not finish within ${e} ms.`),{name:"TimeoutError"})}function bo(e){return typeof e=="number"&&e>0&&e<=Ne?null:new RangeError(`fetchTransport cannot keep a deadline of ${String(e)} ms: it must be a number of milliseconds above 0 and at most ${Ne} (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 y=i.timeoutMs,h=bo(y);if(h)throw h;let b=new AbortController,g=!1,f=setTimeout(()=>{g=!0,b.abort(Fe(y))},y),c=()=>b.abort(i.signal?.reason);i.signal&&(i.signal.aborted?c():i.signal.addEventListener("abort",c,{once:!0}));let p=!1,C=()=>{p||(p=!0,clearTimeout(f),i.signal?.removeEventListener("abort",c))},T=_=>g?Fe(y):_,A;try{A=await n(a,{method:"POST",body:u,headers:l,credentials:o,signal:b.signal})}catch(_){throw C(),T(_)}let R=J(A),v=R.statusText!==void 0?{statusText:R.statusText}:{};if(!R.body)return{status:R.status,...v,contentType:R.contentType,body:null,text:async()=>{try{return await R.text()}catch(_){throw T(_)}finally{C()}}};let x=R.body.getReader(),w=new ReadableStream({async pull(_){try{let s=await x.read();if(s.done){C(),_.close();return}_.enqueue(s.value)}catch(s){C(),_.error(T(s))}},cancel(_){return C(),x.cancel(_)}});return{status:R.status,...v,contentType:R.contentType,body:w,text:()=>new Response(w).text()}}}}var De=300;function ke(e){return String(e??"").toLowerCase().replace(/[^a-z0-9-]/g,"").slice(0,40)}var To="/LLMChart/",So="/LLMChart/qualify",Ro="/VisionReview/",xo="/LLMChart/sample",wo="/RefundGenerate/",_o=e=>!!e&&typeof e=="object"&&e.name==="TimeoutError",z=async e=>JSON.parse(await e.text());function Oo(e){try{e.body?e.body.cancel().catch(()=>{}):e.text().catch(()=>{})}catch{}}function Po(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,y=g=>t.nocache?t.nocache(g):String(u.now());async function h(g,f,c,p,C){let T=`${i()}${l}${f}?nocache=${y(g)}`,A={"Content-Type":"text/plain","X-Signature":D(c,o)},R=p.signal??void 0,v=(w,_)=>{let s=!!R?.aborted;return{kind:"transport",headersReceived:w,timedOut:!s&&_o(_),cancelled:s,error:_}},x;try{x=await a.post(T,c,A,R?{timeoutMs:p.timeoutMs,signal:R}:{timeoutMs:p.timeoutMs})}catch(w){return v(!1,w)}if(x.status<200||x.status>299){let w="";if(p.readErrorBody===!1)Oo(x);else try{w=(await x.text()).slice(0,De)}catch{}return{kind:"http",status:x.status,statusText:x.statusText??"",bodyStart:w}}try{return{kind:"answer",status:x.status,value:await C(x)}}catch(w){return v(!0,w)}}function b(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=b("generate",f),p=c.onStage??void 0;return h("generate",To,M(g),c,C=>Z(C,p))},async qualify(g,f){let c=b("qualify",f),p=c.route??So;if(typeof p!="string"||!p.startsWith("/"))throw new TypeError("The qualify route must start with '/'");return h("qualify",p,M(g),c,z)},async review(g,f){let c=b("review",f),p=JSON.stringify(g);if(typeof p!="string")throw new TypeError("The review wire did not serialize to JSON");return h("review",Ro,p,c,z)},async sample(g,f){let c=b("sample",f);return h("sample",xo,M(g),c,z)},async refund(g,f,c){let p=b("refund",f);if(typeof g!="string"||g.trim()==="")throw new TypeError("A refund needs the generation's correlation id");let C=ke(c),T=C?{CorrelationID:g.trim(),Reason:C}:{CorrelationID:g.trim()};return h("refund",wo,JSON.stringify(T),p,z)}}}export{pn as ADMIN1_MATCH_PCT,gn as ADMIN1_MATCH_PCT_NAMED,j as CITY_ROLE_MATCH_PCT,jt as CITY_TIE_RATIO,mo as CLIENT_EVENT_KINDS,Ur as CLIENT_SECRET_MISMATCH,Xe as COMPOUND_MIN_STEM,Et as CYCLE_MEMBERS,St as CYCLE_WORDS,Ce as DATE_LEVEL_GREGORIAN_YEAR_MAX,he as DATE_LEVEL_GREGORIAN_YEAR_MIN,xr as DATE_LEVEL_LANGUAGES,ae as DATE_LEVEL_NAMES,ye as DATE_LEVEL_NON_GREGORIAN_LANGUAGES,jn as DEFAULT_GAP_FACTOR,lt as DEFAULT_TEMPERATURE,fo as DRAW_REASONS,Vr as FREEMIUM_ATTEMPT_SPENT,Wr as FREEMIUM_COLUMN_CAP,st as GET_RANDOM,Ze as GLUED_STEM_MIN,tt as HANGUL_MIN_STEM,Se as HOST_SYNTHETIC_COLUMNS,De as HTTP_BODY_START_CHARS,qn as IDENTIFIER_HEAD_INITIAL,$n as IDENTIFIER_UNFOLDED,Wn as IDENTIFIER_WORDS,_n as INTENSIVE_SUFFIX_TOKENS,wn as INTENSIVE_WORD_TOKENS,mr as IndexedText,It as LOOSE_KEY_MIN_LENGTH,Ft as LooseIndex,Yn as MAX_RUN_BOUNDS,$r as OAUTH_SIGNED_OUT,qr as OAUTH_TOKEN_EXPIRED,Ot as PERIOD_CODE_FORMS,_t as PERIOD_CODE_MEMBERS,Pt as PERIOD_ORDINALS,At as PERIOD_UNFOLDED,Pn as POSITIONAL_SUFFIX_TOKENS,On as POSITIONAL_WORD_TOKENS,yr as PREVIEW_OMITTED_FIELDS,Pe as PROGRESS_STAGE_IDS,eo as QUALIFY_ORDER_LABELS,Vt as REGION_FRAME_WINDOWS,L as ROLE_MATCH_PCT,Jn as SERIES_COMPLETENESS_MAX_LISTED,Zn as SERIES_COMPLETENESS_MIN_FILL,er as SERIES_KEY_MAX_DISTINCT,ao as SEV_ERROR,io as SEV_INFO,lo as SEV_USER_PRESENTED,so as SEV_WARNING,B as SIMPLE_STRING_HASH,it as STR,rt as SUBSTRING_MIN,Ve as SUPPORTED_LANGUAGES,Ue as SUPPORTED_LANGUAGE_CODES,co as TELEMETRY_TIMEOUT_DEV_MS,uo as TELEMETRY_TIMEOUT_MS,$e as VOCABULARY_LANGUAGE_CODES,qe as VOCABULARY_ONLY_LANGUAGES,Tt as YEAR_WORDS,Qt as admin1CodesForName,Y as admin1LookupRegistered,q as admin1MatchPct,kn as allowedAggregations,Ct as anchorLocalWallClockDates,zr as answerIsRetryable,fn as buildGeoIsoColumn,an as buildGeoPointColumns,hn as buildProvinceIsoColumn,Rt as calendarWordIn,Qr as capabilityFields,un as cityMatchPct,ln as cityTagsFor,ur as classifyAdditivity,go as classifyDraw,Dn as classifyForAggregation,cr as classifyNumericValueNature,ar as classifyTemporal,Kt as clearAdmin1LookupForTests,Mn as codeNeedsLegacyAggNames,Hn as codeReadsColumn,Kn as codeReadsColumnsByRoleOrPosition,Ln as collapseRepeatedAggPrefix,Bn as columnsTheCodeReads,Bt as countryIso2,qt as countryRegion,yo as createDrawLedger,Po as createGenerateClient,Co as createTelemetryClient,Hr as credentialFields,Zr as dataCompletenessFields,_r as dateLevelPart,Or as dateLevelYearAdmits,bt as datesAreTimeOfDayOnly,yt as datesCarryTimeOfDay,En as decimalSeparatorOf,Gn as defaultAggregation,Tn as detectDecimalSeparator,bn as detectFormatSignature,cn as detectGeo,Gt as detectOrdinalDomain,sr as detectTextDatePattern,po as drawLocation,M as encodePayload,fr as engineTypeForSqlType,In as englishImplicitAggNames,le as eventLogLine,jr as fetchFields,Eo as fetchTransport,He as foldName,Mr as freemiumColumnCapRefusal,Re as freemiumColumnsOverCap,xe as freemiumDateHierarchyClauses,et as gluedPrefixStems,Lr as guardColumnNames,Cr as gzipWireText,nt as hangulWordEndsWith,vn as hasDefaultAggPrefix,Ye as hasUnsegmentedScript,lr as hostAggHint,zt as inMiddleEast,gr as ingest,Vn as isAggregationAllowed,G as isBlankLike,en as isCityTableLoaded,$ as isColumnContextRef,at as isDeterministicRefusal,ho as isEventLogCode,on as isGeoPointAmbiguity,ir as isIdentifierName,mn as isJoinGeoKind,Jt as isKnownProvinceId,Er as isNdjsonContentType,Dt as isOrdinalFriendlyName,Nt as isUsableLooseKey,br as keyedSigner,Jr as leafCardinalityField,ft as localMidnightDateColumns,mt as localMidnightToUtcDay,ht as localWallClockDateColumns,wt as localizedCycleIn,zn as localizedIdentifierWordIn,xt as localizedYearWordIn,N as looksLikeCountryColumn,Mt as looseNameKey,ot as matchNameToken,Br as maxNonMeasureCardinality,Cn as measureAdmin1Columns,Xn as measureCadence,or as measurePersistence,rr as measureSeriesCompleteness,D as messageSignature,vr as missingHardColumnRefs,xn as monthLookupFor,Be as nameLetterRuns,Fn as nameLooksIntensiveRate,Nn as nameLooksPositional,Ee as nameProbeIsGuarded,Ar as nameProbeKeepsDrawing,Ke as nameWords,tn as normalizeCountry,pt as normalizeLocalMidnightDates,Rn as normalizeMonthKey,V as normalizePlaceName,rn as normalizeZip5,no as offeredShortlistFor,pr as parseCsvRows,ut as parseDateStable,Fr as parseGenerateResponse,Sn as parseNumberText,Dr as parseQualifyResponse,kr as parseReviewVerdict,Qn as parseTemporalPoint,hr as payloadPreview,Lt as periodCodeSeries,nr as pickSeriesColumn,Gr as progressStageOf,dr as promotesToMeasure,Xt as provinceIdForAdmin1Code,yn as provinceIdForRow,to as qualifyOrderField,ve as qualifyOrderOf,Z as readGenerateStream,je as readName,vt as readPeriodCode,E as readWireField,ke as refundReasonCode,Ht as registerAdmin1Lookup,Zt as registerCityTable,Wt as registerIso3Regions,I as resolveAdmin1,Yt as resolveCityAdmin1,Ae as resolveFetchVersion,sn as resolveGeoPoint,ze as resolveLanguage,Rr as resolvePointRoles,Xr as retryFields,kt as safeDistinctValuesToShip,Ie as schemaIdentity,oo as schemaIdentityKey,Me as schemaTypeFamily,tr as seriesKeyVerdict,Un as shareOfTotalIsHonest,Le as shortlistIsStale,An as stripHostAggPrefix,$t as summarizeCountryRegions,Ut as summarizeGeoExtent,We as supportedLanguage,dn as toGeoIso,Qe as unsegmentedRuns,gt as utcWallClock,Kr as viewportFields,K as vocabularyLanguage,ct as wholeDayFrame,dt as wholeDayIso,J as wireResponseFromFetch,Je as wordEndsWith,ie as zipMatchPct,W as zipPrefixCandidates,nn as zipToPrefix3};
|
|
2
|
+
import{a as br,b as Er}from"./chunk-HIVICMC5.mjs";import{a as Tr,b as M,c as Sr,d as D,e as E,f as Rr,g as J,h as Z}from"./chunk-4J7WPYLM.mjs";import{a as yr,b as hr,c as Cr}from"./chunk-755USHC4.mjs";import{A as Hn,B as Kn,C as Bn,D as jn,E as Yn,F as Qn,G as Xn,H as Jn,I as Zn,J as er,K as tr,L as nr,M as rr,N as or,O as ir,P as sr,Q as ar,R as lr,S as ur,T as cr,U as dr,V as mr,W as fr,X as pr,Z as gr,a as pn,b as gn,c as yn,d as hn,e as Cn,g as wn,h as _n,i as On,j as An,k as Pn,l as Ln,m as vn,n as Mn,o as In,p as Nn,q as Fn,r as Dn,s as kn,t as Gn,u as Vn,v as Wn,w as Un,x as qn,y as $n,z as zn}from"./chunk-QAGRGHJI.mjs";import{a as bn}from"./chunk-U3H6UBOO.mjs";import{b as En,c as Tn,d as Sn,f as Rn,g as xn}from"./chunk-TZ74QIKA.mjs";import{a as de,c as me,e as cn,f as dn,g as mn,h as fn}from"./chunk-YDYFP2T4.mjs";import{A as Q,B as Zt,C as en,D as ce,E as I,F as tn,G as nn,H as rn,I as U,J as on,K as sn,L as an,M as ln,N as X,O as un,a as v,b as G,c as j,d as V,j as W,k as Vt,l as Wt,m as Ut,n as qt,o as $t,q as zt,r as Ht,s as Y,t as Kt,u as Bt,v as jt,w as Yt,x as Qt,y as Xt,z as Jt}from"./chunk-DTBXJVUG.mjs";import"./chunk-5MRZID36.mjs";import{a as Et,b as Tt,c as St,d as Rt,e as xt,f as wt,g as _t,h as Ot,i as At,j as Pt,k as Lt,l as vt,m as Dt,n as kt,o as Gt}from"./chunk-3ZAS32F5.mjs";import{b as Mt,c as It,d as Nt,e as Ft}from"./chunk-5HI6TVMM.mjs";import{A as gt,B as yt,C as ht,D as Ct,E as bt,a as He,b as Ke,c as Be,d as je,e as Ye,f as Qe,g as Xe,h as Je,i as Ze,j as et,k as tt,l as nt,m as rt,n as ot,o as it,q as B,r as st,s as at,t as lt,u as ut,v as ct,w as dt,x as mt,y as ft,z as pt}from"./chunk-CZJ7M6A5.mjs";import{a as Ve,b as We,c as Ue,d as qe,e as $e,f as K,g as ze}from"./chunk-WC4JINEZ.mjs";var ee=2,ge=400;function ne(e){return!!W(e)}function F(e){let t=new Set;for(let n of e){if(n==null)continue;let o=V(String(n));if(!G(o)&&!t.has(o)&&(t.add(o),t.size>=ge))break}return Array.from(t)}function N(e){let t=F(e);if(t.length===0||re(e)<95)return!1;let n=t.filter(a=>ne(a)&&!I(a)).length,o=t.filter(a=>!ne(a)&&!!I(a)).length;return n>=1&&n>=o}function fe(e,t){if(!I(e))return!1;let n=W(e);return n?t==="world"?!0:ce.has(n):!1}function re(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let o of t)ne(o)&&n++;return Math.round(n/t.length*1e3)/10}function oe(e){return I(e)?!0:Y()?Q(e).status!=="unmatched"||Q(e.trim().replace(/\s+/g,"-")).status!=="unmatched":!1}function q(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let o of t)oe(o)&&n++;return Math.round(n/t.length*1e3)/10}function se(e){let t=new Set;for(let n of e){if(n==null)continue;let o=String(n).trim();if(!G(V(o))&&!t.has(o)&&(t.add(o),t.size>=ge))break}return Array.from(t)}function ie(e){let t=se(e);if(t.length===0)return 0;let n=0;for(let o of t)U(o).length>0&&n++;return Math.round(n/t.length*1e3)/10}function pe(e,t){return me(t,de)?!0:se(e).some(n=>/^\d{5}(-\d{4})?$/.test(n.replace(/\.0+$/,"")))}function xr(e,t){let n=F(e);if(n.length===0)return 0;let o=0;for(let a of n)X(a,t)&&o++;return Math.round(o/n.length*1e3)/10}function te(e,t){let n=0;for(let o of F(e))t(o)&&n++;return n}function wr(e,t){let n=0;for(let o of se(e))t(o)&&n++;return n}function _r(e,t,n,o,a){let u=[],l=[],i={},y={},h=new Set(e),b=s=>t.map(d=>d[s]);for(let s of["city","country"]){let d=n?.[s];d&&h.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&&h.has(f)){let s=b(f),d=ie(s);d<95?l.push(`zip=${f} (only ${d}% of values read as ZIPs)`):pe(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&&h.has(c)){let s=b(c),d=F(s);d.length>0&&d.every(S=>fe(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)):q(s)<95?l.push(`state=${c} (only ${q(s)}% of values are states/provinces)`):i.state=c}let p=new Set(Object.values(i).filter(Boolean)),C=e.filter(s=>!p.has(s)&&!s.startsWith("__"));if(!i.state){let s=null;for(let d of C){let S=b(d);if(N(S))continue;let O=q(S);if(O<95)continue;let H=te(S,oe),Ge=te(S,ue=>oe(ue)&&!fe(ue,o));H<ee&&Ge<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 C){if(p.has(s))continue;let d=b(s),S=ie(d);if(!(S<95)&&pe(d,s)&&!(wr(d,O=>U(O).length>0)<ee)){i.zip=s,p.add(s),u.push(`zip=${s} (${S}% ZIP codes)`);break}}let T=i.country;if(!T||!N(b(T))){let s=null;for(let d of C){if(p.has(d)||!N(b(d)))continue;let S=re(b(d));(!s||S>s.pct)&&(s={name:d,pct:S})}s&&(T&&(l.push(`country=${T} (only ${re(b(T))}% of values are country identifiers; using ${s.name} instead)`),y.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 C){if(p.has(d))continue;let S=b(d),O=xr(S,o);O<j||te(S,H=>X(H,o))<ee||(!s||O>s.pct)&&(s={name:d,pct:O})}s&&(i.city=s.name,u.push(`city=${s.name} (${s.pct}% known cities)`))}let P=i.country?b(i.country):[],R=!!i.country&&N(P),L=R?new Set(P.map(s=>W(s==null?null:String(s))).filter(Boolean)).size:0,x=R&&L>=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(y).length?{labelFallback:y}:{}}}var r=(e,...t)=>({part:e,langs:Object.freeze(t)}),ae=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")}),Or=Object.freeze(Array.from(new Set(Object.values(ae).flatMap(e=>e.langs)))),ye=Object.freeze(["fa","ar","he","th"]),he=1900,Ce=2100;function Ar(e,t){let n=[],o=K(t);try{o&&n.push(e.toLocaleLowerCase(o.intl))}catch{}let a=e.toLowerCase();return n.includes(a)||n.push(a),n}function Pr(e,t){let n=String(e??"").trim().normalize("NFC");if(!n)return null;for(let o of Ar(n,t)){let a=ae[o];if(a&&a.langs.includes(t))return a.part}return null}function Lr(e,t){return ye.includes(e)?typeof t=="number"&&Number.isFinite(t)&&t>=he&&t<=Ce:!0}function be(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var vr=/\b(?:columns|cols|column)\b/i;function $(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)),vr.test(o)}function Ee(e,t){return Te(e,t,n=>new RegExp(String.raw`\b${n}\s*(?:>=\s*0|>\s*-1|[!=]==?\s*-1)`).test(e))}function Te(e,t,n){let o=be(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;)$(e,i.index)&&l++;let y=0;for(;(i=a.exec(e))!==null;){let h=i.index+i[0].lastIndexOf(".name");if(!$(e,h))continue;y++;let b=be(i[1]);if(!n(b))return!1}return y>0&&y===l}function Mr(e,t){return Te(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 Se=["__rowIdx__","__geoIso__","__geoLat__","__geoLon__","__geoPrecision__"];function Ir(e,t){if(!e)return[];let n=new Set(t);for(let i of Se)n.add(i);let o=new Set,a=/\.name\s*===?\s*(['"])([^'"]+)\1/g,u;for(;(u=a.exec(e))!==null;)$(e,u.index)&&o.add(u[2]);if(o.size===0)return[];let l=[];return o.forEach(i=>{n.has(i)||Ee(e,i)||l.push(i)}),l}function Nr(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 Re(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=Re(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=xe(n);return i.length===0?l:l+" "+i.join(" ")}function xe(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():"",y=typeof u.name=="string"?u.name.trim():"",h=i!==""?i:y;h!==""&&o.set(l,h)}}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),A=e=>e===!0,we=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},Dr=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function _e(e,t){let n={};for(let[o,a]of Dr){let u=m(E(e,t+a));u&&(n[o]=u)}return n}function kr(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 Gr(e){let t=h=>E(e,h),n=t("retryAfterSeconds"),o=t("overrideThumbnailUpload"),a=t("forceThumbnailUpload"),u=_e(e,"point"),l=_e(e,"destPoint");Object.keys(l).length&&(u.dest=l);let i=t("retryable"),y=t("isPollFinal");return{errorMessage:m(t("errorMessage")),errorCode:m(t("errorCode")),refusalCode:m(t("refusalCode")),retryable:typeof i=="boolean"?i:null,notices:kr(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:we(t("creditBalanceBefore")),creditCost:we(t("creditCost")),isServiceError:A(t("isServiceError")),isRateLimited:A(t("isRateLimited")),suppressSelectionGlyph:A(t("suppressSelectionGlyph")),isRefusal:A(t("isRefusal")),isVersionNotFound:A(t("isVersionNotFound")),isGenerationCancelled:A(t("isGenerationCancelled")),retryAfterSeconds:typeof n=="number"&&Number.isFinite(n)?n:null,servedCorrelationId:m(t("servedCorrelationId")),...typeof y=="boolean"?{isPollFinal:y}:{},...m(t("pollOutcome"))!==""?{pollOutcome:m(t("pollOutcome"))}:{},...typeof o=="boolean"?{overrideThumbnailUpload:o}:{},...typeof a=="boolean"?{forceThumbnailUpload:a}:{}}}var Oe=e=>e==null?void 0:Number(e),k=e=>m(e)||void 0;function Vr(e){let t=E(e,"charts"),n=E(e,"refused"),o=Array.isArray(t)?t.map(u=>{let l=y=>E(u,y),i=l("recommended");return{name:m(l("chartTypeName")??l("name")),description:m(l("description")??l("chartDesc")),rank:Oe(l("rank")),score:Oe(l("score")),renderer:k(l("renderer")),language:k(l("language")),isPreview:A(l("isPreview")),alsoWorthALook:A(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:A(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 Wr(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 Ae=["working","analyze","generate","refine","review"];function Ur(e,t){let n=String(e??"").trim().toLowerCase();if(Ae.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 qr="FREEMIUM_ATTEMPT_SPENT",$r="CLIENT_SECRET_MISMATCH",zr="FREEMIUM_COLUMN_CAP",Hr="OAUTH_TOKEN_EXPIRED",Kr="OAUTH_SIGNED_OUT";function Br(e){let t=e?.retryable;return typeof t=="boolean"?t:null}function jr(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 Yr(e){let{width:t,height:n}=e.measure();return{request:{height:n,width:t},hints:{viewportWidth:t,viewportHeight:n}}}function Qr(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 Pe(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 Xr(e){let t=e.fetchCorrelationId!=null,o=t||e.recoveryFetchVersion!=null?!1:e.genNew,a=Pe({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,i=e.fetchCutAtMs,y=t&&typeof i=="number"&&Number.isSafeInteger(i)&&i>0?i:void 0,h=t?Jr(e.fetchCause):"";return{genNew:o,version:a.version,fetchOnly:a.fetchOnly,fetchCorrelationId:e.fetchCorrelationId??void 0,...l!==void 0?{fetchArmedAtMs:l}:{},...y!==void 0?{fetchCutAtMs:y}:{},...h?{fetchCause:h}:{}}}function Jr(e){if(typeof e!="string")return"";let t=e.replace(/[\u0000-\u001f\u007f]+/g," ").trim().slice(0,120);return/[\ud800-\udbff]$/.test(t)&&(t=t.slice(0,-1)),t.trimEnd()}function Zr(e){let t=n=>e.renderers.has(n);return{supportsD3:t("D3"),supportsPlotly:t("PLOTLY"),supportsVega:t("VEGA")}}function eo(e){let t=e.cap!=null&&e.budget>e.cap?e.cap:e.budget;return{triesLeft:e.triesLeft??t,maxTries:t}}function to(e){return e&&e>0?{leafCardinality:Math.round(e)}:{}}function no(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 ro={fit:"Best fit",variety:"Something different"};function Le(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return t==="fit"||t==="variety"?t:null}function oo(e){let t=Le(e);return t?{qualifyOrder:t}:{}}function ve(e,t){return e!=null&&t!=null&&e!==t}function io(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 so=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function Me(e){let t=String(e??"").trim().toLowerCase();return so[t]??t}function Ie(e){let t="";for(let n of e)t+=JSON.stringify([String(n.name??""),n.isMeasure?"M":"D",Me(n.dataType)]);return t}function ao(e){return B(Ie(e))}var lo=2,uo=3,co=4,mo=64,fo=8e3,po=6e4,go=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict",REDRAW:"redraw",INTERACT:"interact"}),yo=Object.freeze(["open","generate","version","rebind","data","sample","fix","resize","other"]);function ho(e,t){return t?`${t};draw:${e}`:`draw:${e}`}function Co(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 bo(){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 Eo(e){return!!e&&!e.includes("|")&&!e.includes(",")}function le(e,t,n,o){let a=`${e},${t}|${n}`;return o?`${a}|${Math.max(0,Math.round(o.count))}|${o.nonce}`:a}function To(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,y=()=>typeof t.baseUrl=="function"?t.baseUrl():t.baseUrl,h=g=>{try{t.onFailure?.(g)}catch{}},b=async(g,f,c,p)=>{let C;try{let T=await a.post(f,c,p,{timeoutMs:i});C=T.status;try{T.body?.cancel().catch(()=>{})}catch{}}catch(T){h({channel:g,stage:"post",status:null,error:T});return}(C<200||C>299)&&h({channel:g,stage:"status",status:C,error:null})};return{async sendClientMessage(g){let f,c,p;try{f=`${y()}${l}/LogClientMsg/?nocache=${u.now()}`,c=M(g),p=D(c,o)}catch(C){h({channel:"client-message",stage:"build",status:null,error:C});return}await b("client-message",f,c,{"Content-Type":"text/plain","X-Signature":p})},async countEvent(g,f,c){let p,C;try{p=`${y()}${l}/eventlog`,C=le(g,t.clientVersion,f,c)}catch(T){h({channel:"event-count",stage:"build",status:null,error:T});return}await b("event-count",p,C,{"Content-Type":"text/plain"})}}}var Ne=2**31-1;function Fe(e){return Object.assign(new Error(`The request did not finish within ${e} ms.`),{name:"TimeoutError"})}function So(e){return typeof e=="number"&&e>0&&e<=Ne?null:new RangeError(`fetchTransport cannot keep a deadline of ${String(e)} ms: it must be a number of milliseconds above 0 and at most ${Ne} (about 24.8 days), the longest a timer can wait. Nothing was sent.`)}function Ro(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 y=i.timeoutMs,h=So(y);if(h)throw h;let b=new AbortController,g=!1,f=setTimeout(()=>{g=!0,b.abort(Fe(y))},y),c=()=>b.abort(i.signal?.reason);i.signal&&(i.signal.aborted?c():i.signal.addEventListener("abort",c,{once:!0}));let p=!1,C=()=>{p||(p=!0,clearTimeout(f),i.signal?.removeEventListener("abort",c))},T=_=>g?Fe(y):_,P;try{P=await n(a,{method:"POST",body:u,headers:l,credentials:o,signal:b.signal})}catch(_){throw C(),T(_)}let R=J(P),L=R.statusText!==void 0?{statusText:R.statusText}:{};if(!R.body)return{status:R.status,...L,contentType:R.contentType,body:null,text:async()=>{try{return await R.text()}catch(_){throw T(_)}finally{C()}}};let x=R.body.getReader(),w=new ReadableStream({async pull(_){try{let s=await x.read();if(s.done){C(),_.close();return}_.enqueue(s.value)}catch(s){C(),_.error(T(s))}},cancel(_){return C(),x.cancel(_)}});return{status:R.status,...L,contentType:R.contentType,body:w,text:()=>new Response(w).text()}}}}var De=300;function ke(e){return String(e??"").toLowerCase().replace(/[^a-z0-9-]/g,"").slice(0,40)}var xo="/LLMChart/",wo="/LLMChart/qualify",_o="/VisionReview/",Oo="/LLMChart/sample",Ao="/RefundGenerate/",Po=e=>!!e&&typeof e=="object"&&e.name==="TimeoutError",z=async e=>JSON.parse(await e.text());function Lo(e){try{e.body?e.body.cancel().catch(()=>{}):e.text().catch(()=>{})}catch{}}function vo(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,y=g=>t.nocache?t.nocache(g):String(u.now());async function h(g,f,c,p,C){let T=`${i()}${l}${f}?nocache=${y(g)}`,P={"Content-Type":"text/plain","X-Signature":D(c,o)},R=p.signal??void 0,L=(w,_)=>{let s=!!R?.aborted;return{kind:"transport",headersReceived:w,timedOut:!s&&Po(_),cancelled:s,error:_}},x;try{x=await a.post(T,c,P,R?{timeoutMs:p.timeoutMs,signal:R}:{timeoutMs:p.timeoutMs})}catch(w){return L(!1,w)}if(x.status<200||x.status>299){let w="";if(p.readErrorBody===!1)Lo(x);else try{w=(await x.text()).slice(0,De)}catch{}return{kind:"http",status:x.status,statusText:x.statusText??"",bodyStart:w}}try{return{kind:"answer",status:x.status,value:await C(x)}}catch(w){return L(!0,w)}}function b(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=b("generate",f),p=c.onStage??void 0;return h("generate",xo,M(g),c,C=>Z(C,p))},async qualify(g,f){let c=b("qualify",f),p=c.route??wo;if(typeof p!="string"||!p.startsWith("/"))throw new TypeError("The qualify route must start with '/'");return h("qualify",p,M(g),c,z)},async review(g,f){let c=b("review",f),p=JSON.stringify(g);if(typeof p!="string")throw new TypeError("The review wire did not serialize to JSON");return h("review",_o,p,c,z)},async sample(g,f){let c=b("sample",f);return h("sample",Oo,M(g),c,z)},async refund(g,f,c){let p=b("refund",f);if(typeof g!="string"||g.trim()==="")throw new TypeError("A refund needs the generation's correlation id");let C=ke(c),T=C?{CorrelationID:g.trim(),Reason:C}:{CorrelationID:g.trim()};return h("refund",Ao,JSON.stringify(T),p,z)}}}export{pn as ADMIN1_MATCH_PCT,gn as ADMIN1_MATCH_PCT_NAMED,j as CITY_ROLE_MATCH_PCT,jt as CITY_TIE_RATIO,go as CLIENT_EVENT_KINDS,$r as CLIENT_SECRET_MISMATCH,Xe as COMPOUND_MIN_STEM,Et as CYCLE_MEMBERS,St as CYCLE_WORDS,Ce as DATE_LEVEL_GREGORIAN_YEAR_MAX,he as DATE_LEVEL_GREGORIAN_YEAR_MIN,Or as DATE_LEVEL_LANGUAGES,ae as DATE_LEVEL_NAMES,ye as DATE_LEVEL_NON_GREGORIAN_LANGUAGES,Xn as DEFAULT_GAP_FACTOR,lt as DEFAULT_TEMPERATURE,yo as DRAW_REASONS,qr as FREEMIUM_ATTEMPT_SPENT,zr as FREEMIUM_COLUMN_CAP,st as GET_RANDOM,Ze as GLUED_STEM_MIN,tt as HANGUL_MIN_STEM,Se as HOST_SYNTHETIC_COLUMNS,De as HTTP_BODY_START_CHARS,Hn as IDENTIFIER_HEAD_INITIAL,Kn as IDENTIFIER_UNFOLDED,zn as IDENTIFIER_WORDS,Pn as INTENSIVE_SUFFIX_TOKENS,An as INTENSIVE_WORD_TOKENS,gr as IndexedText,wn as LATITUDE_WORDS,_n as LONGITUDE_WORDS,It as LOOSE_KEY_MIN_LENGTH,Ft as LooseIndex,Jn as MAX_RUN_BOUNDS,Kr as OAUTH_SIGNED_OUT,Hr as OAUTH_TOKEN_EXPIRED,Ot as PERIOD_CODE_FORMS,_t as PERIOD_CODE_MEMBERS,At as PERIOD_ORDINALS,Pt as PERIOD_UNFOLDED,vn as POSITIONAL_SUFFIX_TOKENS,Ln as POSITIONAL_WORD_TOKENS,br as PREVIEW_OMITTED_FIELDS,Ae as PROGRESS_STAGE_IDS,ro as QUALIFY_ORDER_LABELS,Vt as REGION_FRAME_WINDOWS,v as ROLE_MATCH_PCT,tr as SERIES_COMPLETENESS_MAX_LISTED,nr as SERIES_COMPLETENESS_MIN_FILL,rr as SERIES_KEY_MAX_DISTINCT,co as SEV_ERROR,lo as SEV_INFO,mo as SEV_USER_PRESENTED,uo as SEV_WARNING,B as SIMPLE_STRING_HASH,it as STR,rt as SUBSTRING_MIN,Ve as SUPPORTED_LANGUAGES,We as SUPPORTED_LANGUAGE_CODES,po as TELEMETRY_TIMEOUT_DEV_MS,fo as TELEMETRY_TIMEOUT_MS,$e as VOCABULARY_LANGUAGE_CODES,qe as VOCABULARY_ONLY_LANGUAGES,Tt as YEAR_WORDS,Qt as admin1CodesForName,Y as admin1LookupRegistered,q as admin1MatchPct,Wn as allowedAggregations,Ct as anchorLocalWallClockDates,Br as answerIsRetryable,fn as buildGeoIsoColumn,an as buildGeoPointColumns,hn as buildProvinceIsoColumn,Rt as calendarWordIn,Zr as capabilityFields,un as cityMatchPct,ln as cityTagsFor,mr as classifyAdditivity,Co as classifyDraw,Vn as classifyForAggregation,fr as classifyNumericValueNature,cr as classifyTemporal,Kt as clearAdmin1LookupForTests,Fn as codeNeedsLegacyAggNames,jn as codeReadsColumn,Yn as codeReadsColumnsByRoleOrPosition,Nn as collapseRepeatedAggPrefix,Qn as columnsTheCodeReads,On as coordinateAxisOfWords,Bt as countryIso2,qt as countryRegion,bo as createDrawLedger,vo as createGenerateClient,To as createTelemetryClient,jr as credentialFields,no as dataCompletenessFields,Pr as dateLevelPart,Lr as dateLevelYearAdmits,bt as datesAreTimeOfDayOnly,yt as datesCarryTimeOfDay,En as decimalSeparatorOf,Un as defaultAggregation,Tn as detectDecimalSeparator,bn as detectFormatSignature,cn as detectGeo,Gt as detectOrdinalDomain,ur as detectTextDatePattern,ho as drawLocation,M as encodePayload,yr as engineTypeForSqlType,Dn as englishImplicitAggNames,le as eventLogLine,Xr as fetchFields,Ro as fetchTransport,He as foldName,Fr as freemiumColumnCapRefusal,Re as freemiumColumnsOverCap,xe as freemiumDateHierarchyClauses,et as gluedPrefixStems,Nr as guardColumnNames,Tr as gzipWireText,nt as hangulWordEndsWith,In as hasDefaultAggPrefix,Ye as hasUnsegmentedScript,dr as hostAggHint,zt as inMiddleEast,Cr as ingest,qn as isAggregationAllowed,G as isBlankLike,en as isCityTableLoaded,$ as isColumnContextRef,at as isDeterministicRefusal,Eo as isEventLogCode,on as isGeoPointAmbiguity,lr as isIdentifierName,mn as isJoinGeoKind,Jt as isKnownProvinceId,Rr as isNdjsonContentType,Dt as isOrdinalFriendlyName,Nt as isUsableLooseKey,Sr as keyedSigner,to as leafCardinalityField,ft as localMidnightDateColumns,mt as localMidnightToUtcDay,ht as localWallClockDateColumns,wt as localizedCycleIn,Bn as localizedIdentifierWordIn,xt as localizedYearWordIn,N as looksLikeCountryColumn,Mt as looseNameKey,ot as matchNameToken,Qr as maxNonMeasureCardinality,Cn as measureAdmin1Columns,er as measureCadence,ar as measurePersistence,sr as measureSeriesCompleteness,D as messageSignature,Ir as missingHardColumnRefs,xn as monthLookupFor,Be as nameLetterRuns,Gn as nameLooksIntensiveRate,kn as nameLooksPositional,Ee as nameProbeIsGuarded,Mr as nameProbeKeepsDrawing,Ke as nameWords,tn as normalizeCountry,pt as normalizeLocalMidnightDates,Rn as normalizeMonthKey,V as normalizePlaceName,rn as normalizeZip5,io as offeredShortlistFor,hr as parseCsvRows,ut as parseDateStable,Gr as parseGenerateResponse,Sn as parseNumberText,Vr as parseQualifyResponse,Wr as parseReviewVerdict,Zn as parseTemporalPoint,Er as payloadPreview,vt as periodCodeSeries,ir as pickSeriesColumn,Ur as progressStageOf,pr as promotesToMeasure,Xt as provinceIdForAdmin1Code,yn as provinceIdForRow,oo as qualifyOrderField,Le as qualifyOrderOf,Z as readGenerateStream,je as readName,Lt as readPeriodCode,E as readWireField,ke as refundReasonCode,Ht as registerAdmin1Lookup,Zt as registerCityTable,Ut as registerIso3Regions,I as resolveAdmin1,Yt as resolveCityAdmin1,Pe as resolveFetchVersion,sn as resolveGeoPoint,ze as resolveLanguage,_r as resolvePointRoles,eo as retryFields,kt as safeDistinctValuesToShip,Ie as schemaIdentity,ao as schemaIdentityKey,Me as schemaTypeFamily,or as seriesKeyVerdict,$n as shareOfTotalIsHonest,ve as shortlistIsStale,Mn as stripHostAggPrefix,$t as summarizeCountryRegions,Wt as summarizeGeoExtent,Ue as supportedLanguage,dn as toGeoIso,Qe as unsegmentedRuns,gt as utcWallClock,Yr as viewportFields,K as vocabularyLanguage,ct as wholeDayFrame,dt as wholeDayIso,J as wireResponseFromFetch,Je as wordEndsWith,ie as zipMatchPct,U as zipPrefixCandidates,nn as zipToPrefix3};
|
package/dist/indexedText.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{
|
|
2
|
+
import{R as a,S as b,T as c,U as d,V as e,W as f,X as g,Y as h,Z as i}from"./chunk-QAGRGHJI.mjs";import"./chunk-U3H6UBOO.mjs";import"./chunk-TZ74QIKA.mjs";import"./chunk-YDYFP2T4.mjs";import"./chunk-DTBXJVUG.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-3ZAS32F5.mjs";import"./chunk-5HI6TVMM.mjs";import"./chunk-CZJ7M6A5.mjs";import"./chunk-WC4JINEZ.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-
|
|
2
|
+
import{a,b,c}from"./chunk-755USHC4.mjs";import"./chunk-QAGRGHJI.mjs";import"./chunk-U3H6UBOO.mjs";import"./chunk-TZ74QIKA.mjs";import"./chunk-YDYFP2T4.mjs";import"./chunk-DTBXJVUG.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-3ZAS32F5.mjs";import"./chunk-5HI6TVMM.mjs";import"./chunk-CZJ7M6A5.mjs";import"./chunk-WC4JINEZ.mjs";export{a as engineTypeForSqlType,c as ingest,b as parseCsvRows};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export type { MeasurePersistence } from "./measurePersistence";
|
|
|
11
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";
|
|
12
12
|
export type { AggKind, AggAdditivity, AggBasis, AggNature, AggregationClass, AggregationColumn, } from "./aggregation";
|
|
13
13
|
export type { LLMColumnWithValue, TwoSetPairing, ScoreSeparationEntry } from "./models";
|
|
14
|
-
export type { LLMRequestModifier, SimpleColumn, VegaRendererPayload, LLMClientHints, LLMRequestCode, LLMQualifyResult, LLMRequestCodeResult, LLMResultNotice, GetLicenseStatusResult, ShareAskWire, ShareTargetWire, } from "./models";
|
|
14
|
+
export type { LLMRequestModifier, SimpleColumn, VegaRendererPayload, LLMClientHints, LLMDirectionOfGood, LLMRequestCode, LLMQualifyResult, LLMRequestCodeResult, LLMResultNotice, GetLicenseStatusResult, ShareAskWire, ShareTargetWire, } from "./models";
|
|
15
15
|
export { ROLE_MATCH_PCT, CITY_ROLE_MATCH_PCT, isBlankLike } from "./matchQuality";
|
|
16
16
|
export { detectOrdinalDomain, safeDistinctValuesToShip, isOrdinalFriendlyName } from "./ordinalDetector";
|
|
17
17
|
export { detectFormatSignature } from "./formatDetector";
|
|
@@ -39,6 +39,7 @@ export { DATE_LEVEL_NAMES, DATE_LEVEL_LANGUAGES, DATE_LEVEL_NON_GREGORIAN_LANGUA
|
|
|
39
39
|
export type { DateLevelPart, DateLevelEntry } from "./vocab/dateLevels";
|
|
40
40
|
export { YEAR_WORDS, CYCLE_WORDS, CYCLE_MEMBERS, calendarWordIn, localizedYearWordIn, localizedCycleIn, } from "./vocab/calendarWords";
|
|
41
41
|
export type { CycleConcept, CalendarWordHit } from "./vocab/calendarWords";
|
|
42
|
+
export { LATITUDE_WORDS, LONGITUDE_WORDS, coordinateAxisOfWords } from "./vocab/coordinates";
|
|
42
43
|
export { PERIOD_CODE_FORMS, PERIOD_ORDINALS, PERIOD_UNFOLDED, PERIOD_CODE_MEMBERS, readPeriodCode, periodCodeSeries, } from "./vocab/periodCodes";
|
|
43
44
|
export type { PeriodCodeGrain, PeriodCodeForms, PeriodCodeReading, PeriodCodeSeries } from "./vocab/periodCodes";
|
|
44
45
|
export { IDENTIFIER_WORDS, IDENTIFIER_HEAD_INITIAL, IDENTIFIER_UNFOLDED, localizedIdentifierWordIn, } from "./vocab/identifierWords";
|
package/dist/types/models.d.ts
CHANGED
|
@@ -190,6 +190,11 @@ export type LLMColumnWithValue = {
|
|
|
190
190
|
admin1RegionCount?: number;
|
|
191
191
|
admin1CountryCount?: number;
|
|
192
192
|
};
|
|
193
|
+
/** One measure's direction of good, as the reader set it (LLMClientHints.directionOfGood). */
|
|
194
|
+
export type LLMDirectionOfGood = {
|
|
195
|
+
measure: string;
|
|
196
|
+
better: "higher" | "lower";
|
|
197
|
+
};
|
|
193
198
|
export type LLMClientHints = {
|
|
194
199
|
viewportWidth?: number;
|
|
195
200
|
viewportHeight?: number;
|
|
@@ -319,6 +324,7 @@ export type LLMClientHints = {
|
|
|
319
324
|
dominantFramePct?: number;
|
|
320
325
|
};
|
|
321
326
|
levelOfDetail?: string;
|
|
327
|
+
directionOfGood?: LLMDirectionOfGood[];
|
|
322
328
|
clientIdSource?: "persisted" | "fingerprint" | "session";
|
|
323
329
|
};
|
|
324
330
|
export type LLMRequestCode = {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { VocabularyLanguageCode } from "../languages";
|
|
2
|
+
type Vocab = Partial<Record<VocabularyLanguageCode, readonly string[]>>;
|
|
3
|
+
export declare const LATITUDE_WORDS: Vocab;
|
|
4
|
+
export declare const LONGITUDE_WORDS: Vocab;
|
|
5
|
+
/** "lat" / "lon" when one of a name's words (as nameLetterRuns gives them) is another language's latitude / longitude word,
|
|
6
|
+
* else null (also null when the name carries both). A nomination, never an admission - see the header. */
|
|
7
|
+
export declare function coordinateAxisOfWords(words: readonly string[]): "lat" | "lon" | null;
|
|
8
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bicharts/shape-core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.113",
|
|
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",
|
package/dist/chunk-O6A7HGFH.mjs
DELETED
|
@@ -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 be}from"./chunk-U3H6UBOO.mjs";import{a as At,f as ee,g as Se,h as ie,i as _e,j as ne}from"./chunk-TZ74QIKA.mjs";import{b as ht,c as yt,d as bt,e as St,f as _t}from"./chunk-YDYFP2T4.mjs";import{c as ft,l as gt,n as he,p as pt,s as re,w as ye,x as ke,y as De,z as Pe}from"./chunk-DTBXJVUG.mjs";import{e as lt,k as ge,m as dt,n as mt,o as pe}from"./chunk-3ZAS32F5.mjs";import{b as ut,d as ct}from"./chunk-5HI6TVMM.mjs";import{A as fe,B as ot,E as at,a as ce,b as J,c as Ze,d as de,g as qe,h as Qe,j as Je,l as et,m as tt,o as nt,p as me,q as rt,r as it,u as Ne,w as st}from"./chunk-CZJ7M6A5.mjs";import{c as Xe,f as Ee}from"./chunk-WC4JINEZ.mjs";var cn=85,dn=60,mn=/(^|[^a-z])(state|province|provincia|provinz|region|regione|regiao|county|department|departement|departamento|prefecture|oblast|canton|kanton|bundesland|land|territory)([^a-z]|$)/i,Oe=t=>Math.round(t*10)/10,Ae=t=>t.split("-")[0];function xt(t){let e=new Map,n=0;if(t.forEach((s,o)=>{let l=he(o);l&&(e.set(l,(e.get(l)||0)+s),n+=s)}),n===0)return{};let[i,r]=[...e].sort((s,o)=>o[1]-s[1])[0];return{dominantRegion:i,dominantRegionPct:Oe(100*r/n)}}function bi(t){let e=t.province===null||t.province===void 0?"":String(t.province).trim();if(e)return Ct(e,t.provinceKind,t.country);if(!re())return null;let n=t.city===null||t.city===void 0?"":String(t.city).trim();if(!n)return null;let i=ye(n,{country:t.country===null||t.country===void 0?null:String(t.country)});return i.status==="resolved"?i.provinceId:null}function Ct(t,e,n){if(e==="us-state-code"||e==="us-state-name"){let s=_t(t,e);return s?"US-"+s:null}if(!re())return null;if(e==="admin1-code")return Pe(t)?t.toUpperCase():null;let i=n==null?null:String(n),r=new Set(ke(t,i).map(De).filter(s=>!!s));return r.size===1?[...r][0]:null}function Si(t,e={}){let n=e.deriveProvinces!==!1,i=new Array(t.length),r=new Array(t.length),s=new Set,o=[],l=new Set,a=[],c=0,d=0,g=0,m=A=>{let S=A.toLowerCase();s.has(S)||(s.add(S),o.push(A))},b=A=>A==null||A===""?null:Number(A),M=new Map;return t.forEach((A,S)=>{i[S]=null,r[S]=null;let p=A.country===null||A.country===void 0||String(A.country).trim()===""?null:String(A.country).trim(),h=A.province===null||A.province===void 0?"":String(A.province).trim();if(h){let _=Ct(h,e.provinceKind,p);_?(i[S]=_,r[S]="province",c++):m(h);return}if(!n)return;let x=b(A.lat),f=b(A.lon),C=!1;if(e.locate&&x!==null&&f!==null&&isFinite(x)&&isFinite(f)){C=!0;let _=e.locate(x,f);if(_){i[S]=_,r[S]="coordinates",c++;return}}let y=A.city===null||A.city===void 0?"":String(A.city).trim();if(y&&re()){let _=y.toLowerCase()+""+(p??""),w=M.get(_);if(w||(w=ye(y,{country:p}),M.set(_,w)),w.status==="resolved"&&w.provinceId){i[S]=w.provinceId,r[S]="city",c++;return}if(w.status==="ambiguous"){d++,l.has(_)||(l.add(_),a.length<8&&a.push(y));return}m(y);return}C&&g++}),{iso:i,source:r,unmatched:o,matchedRows:c,totalRows:t.length,ambiguousRows:d,ambiguousExamples:a,unplacedPoints:g}}function wt(t,e,n={}){let i=new Map;if(!re()||e.length===0)return i;let r=t.findIndex(l=>!l.isMeasure&&(l.geoKind||"").startsWith("country")),s=l=>l==null?"":String(l).trim(),o=l=>{let a=new Map;for(let b of e){let M=s(b[l]);if(!M)continue;let A=r>=0&&s(b[r])||null,S=M+""+(A??""),p=a.get(S);p?p.rows++:a.set(S,{city:M,country:A,rows:1})}if(a.size===0)return null;let c=0,d=0,g=new Set,m=new Map;return a.forEach(b=>{let M=ye(b.city,{country:b.country});M.status!=="unmatched"&&d++,!(M.status!=="resolved"||!M.provinceId)&&(c++,g.add(M.provinceId),m.set(M.cc,(m.get(M.cc)||0)+b.rows))}),{signals:{rollupPct:Oe(100*c/a.size),regionCount:g.size,countryCount:m.size,...xt(m)},cityPct:100*d/a.size,distinct:a.size}};return t.forEach((l,a)=>{if(l.isMeasure||a===r)return;let c=l.geoKind||"";if(c.startsWith("city")){if(n.cities===!1)return;let _=o(a);_&&i.set(a,_.signals);return}if(c)return;let d=new Map,g=new Map;for(let _ of e){let w=s(_[a]);w&&(d.set(w,(d.get(w)||0)+1),g.has(w)||g.set(w,r>=0&&s(_[r])||null))}if(d.size<3)return;let m=0,b=0,M=0,A=new Set,S=new Map;d.forEach((_,w)=>{if(Pe(w)){m++;let z=w.toUpperCase();A.add(z),S.set(Ae(z),(S.get(Ae(z))||0)+_);return}let W=new Set(ke(w,g.get(w)).map(De).filter(z=>!!z));if(W.size===1){b++;let z=[...W][0];A.add(z),S.set(Ae(z),(S.get(Ae(z))||0)+_)}else W.size>1&&M++});let h=mn.test(l.name.replace(/[_-]+/g," "))?dn:cn,x=100*m/d.size,f=100*b/d.size,C=x>=f,y=C?x:f;if(y<h){if(n.cities===!1)return;let _=o(a);if(!_||_.cityPct<ft||_.distinct<bt&&!yt(l.name,ht))return;i.set(a,_.signals);return}i.set(a,{kind:C?"admin1-code":"admin1-name",matchPct:Oe(y),ambiguous:!C&&M/d.size>.15?!0:void 0,regionCount:A.size,countryCount:S.size,...xt(S)})}),i}function ze(t){let e=(t||"").toLowerCase();return e==="en-us"||e==="en"||e.startsWith("en-us-")||e==="en-ph"||e==="en-bz"}var Le={a:0,b:0,c:0,yearFirst:!1,sep:"",trail:"",word:"",day:0,year:0,namedOrder:"dmy",cjkPattern:""},fn=/\s+(\d{1,2}):(\d{2})(?::(\d{2})(?:[.,]\d{1,9})?)?(?:\s*([ap])\.?\s?m\.?)?$/i,gn=/^(\d{1,4})(\s*[./-]\s*)(\d{1,2})(\s*[./-]\s*)(\d{1,4})(\.?)$/,pn=/^(\d{4})(\s*[年년]\s*)(\d{1,2})(\s*[月월]\s*)(\d{1,2})(\s*[日일号])$/,hn=/(\d)(?:st|nd|rd|th|er|º|ª)(?=[\s.,/-]|$)/gi,yn=new Set(["de","del","of"]),bn=new Set(["\u0433","\u0440","r"]),Sn=/^[\p{L}\p{M}\u0970\u05f3]+$/u,Fe=/^\d+$/;function _n(t){let e=+t[1],n=+t[2],i=t[3]===void 0?0:+t[3],r=t[4]!==void 0;if(n>59||i>59)return null;if(r){if(e<1||e>12)return null;e=e%12+(t[4].toLowerCase()==="p"?12:0)}else if(e>23)return null;return{h:e,mi:n,s:i,seconds:t[3]!==void 0,meridiem:r}}function Mt(t){let e=t.replace(/[\u200e\u200f\u061c]/g,"").replace(/\s+/g," ").trim();if(e==="")return null;e=At(e);let n=null,i=fn.exec(e);if(i){if(n=_n(i),!n)return null;e=e.slice(0,i.index)}let r;if(r=pn.exec(e)){let m=`cjk|${r[2]}|${r[4]}|${r[6]}`;return{...Le,form:"cjk",key:m,clock:n,a:+r[1],b:+r[3],c:+r[5],yearFirst:!0,cjkPattern:`%Y${r[2]}%m${r[4]}%d${r[6]}`}}if(r=gn.exec(e)){let m=r[2],b=r[4];if(m!==b)return null;let M=m.trim(),A=r[6];if(A&&M!==".")return null;let S=[r[1].length,r[3].length,r[5].length],p=S[0]===4,h=S[2]===4;return p===h||(p?S[1]>2||S[2]>2:S[0]>2||S[1]>2)?null:p&&M==="-"&&m==="-"&&S[1]===2&&S[2]===2?"iso":p&&M==="."&&m==="."&&!A&&!(S[1]===2&&S[2]===2)?null:{...Le,form:"numeric",key:`num|${p?"y":"x"}|${m}|${A}`,clock:n,a:+r[1],b:+r[3],c:+r[5],yearFirst:p,sep:m,trail:A}}let s=e.replace(hn,"$1").split(/[\s.,/-]+/).filter(m=>m!==""&&!yn.has(m.toLowerCase()));if(s.length===4&&Fe.test(s[2])&&bn.has(s[3].toLowerCase())&&s.pop(),s.length!==3)return null;let o=s.map(m=>Fe.test(m)?"N":Sn.test(m)?"W":"?").join(""),l=s.map(m=>Fe.test(m)?m:""),a=0,c=0,d="",g;if(o==="NWN"&&l[0].length<=2&&l[2].length===4)a=+l[0],d=s[1],c=+l[2],g="dmy";else if(o==="WNN"&&l[1].length<=2&&l[2].length===4)d=s[0],a=+l[1],c=+l[2],g="mdy";else if(o==="NWN"&&l[0].length===4&&l[2].length<=2)c=+l[0],d=s[1],a=+l[2],g="ymd";else return null;return{...Le,form:"named",key:`named|${g}`,clock:n,day:a,year:c,word:d,namedOrder:g}}var An=[31,28,31,30,31,30,31,31,30,31,30,31],xn=t=>t%4===0&&t%100!==0||t%400===0;function Tt(t,e,n){return t>=1&&t<=9999&&e>=1&&e<=12&&n>=1?n<=(e===2&&xn(t)?29:An[e-1]):!1}function Cn(t,e,n,i){let r=new Date(Date.UTC(2e3,e-1,n,i?.h??0,i?.mi??0,i?.s??0));return r.setUTCFullYear(t),r}function vt(t,e={}){let n=(e.floor??1)>=1,i=new Map,r=new Map,s=0,o=null;for(let p of t){if(p==null)continue;if(typeof p!="string"){if(n)return null;s++;continue}let h=p.trim();if(h==="")continue;s++;let x=i.get(h);if(x===void 0&&(x=Mt(h),i.set(h,x)),x===null||x==="iso"){if(n)return null;continue}if(n){if(o===null)o=x;else if(x.key!==o.key)return null}else r.set(x.key,(r.get(x.key)??0)+1)}if(!n){let p=0,h="";for(let[x,f]of r)f>p&&(p=f,h=x);if(p===0||p/s<e.floor)return null;o=[...i.values()].find(x=>x!==null&&x!=="iso"&&x.key===h)??null}if(o===null)return null;let l=o.key,a=[...i.values()].filter(p=>p!==null&&p!=="iso"&&p.key===l),c,d="shape",g=null;if(o.form==="named"){if(c=o.namedOrder,g=_e(a.map(p=>p.word),e.locale),!g)return null}else if(o.form==="cjk"||o.yearFirst)c="ymd";else{let p=0,h=0;for(let x of a)x.a>12&&p++,x.b>12&&h++;if(p>0&&h>0)return null;p>0?(c="dmy",d="values"):h>0?(c="mdy",d="values"):o.sep.trim()==="."?(c="dmy",d="shape"):(c=ze(e.locale)?"mdy":"dmy",d="locale")}let m=p=>{if(p.form==="named"){let h=g.get(ee(p.word));return h===void 0?null:[p.year,h+1,p.day]}return p.yearFirst?[p.a,p.b,p.c]:c==="dmy"?[p.c,p.b,p.a]:[p.c,p.a,p.b]},b=1/0,M=-1/0,A=0;for(let p of a){let h=m(p);if(!h||!Tt(h[0],h[1],h[2])){if(n)return null;A++;continue}b=Math.min(b,h[0]),M=Math.max(M,h[0])}if(!n&&(r.get(l)-A)/s<e.floor||b>=2400&&M<=2699||b>=1300&&M<=1500)return null;let S={form:o.form,order:c,orderFrom:d,hasTime:a.some(p=>p.clock!==null),read(p){if(typeof p!="string")return null;let h=p.trim();if(h==="")return null;let x=i.get(h);if(x===void 0&&(x=Mt(h),i.set(h,x)),x===null||x==="iso"||x.key!==l)return null;let f=m(x);return!f||!Tt(f[0],f[1],f[2])?null:Cn(f[0],f[1],f[2],x.clock)}};if(o.form!=="named"&&!a.some(p=>p.clock?.meridiem)){let p;o.form==="cjk"?p=o.cjkPattern:o.yearFirst?p=`%Y${o.sep}%m${o.sep}%d${o.trail}`:p=(c==="dmy"?`%d${o.sep}%m${o.sep}%Y`:`%m${o.sep}%d${o.sep}%Y`)+o.trail;let h=a.filter(x=>x.clock!==null).length;h===0?S.pattern=p:h===a.length&&(S.pattern=p+(a.every(x=>x.clock.seconds)?" %H:%M:%S":" %H:%M"))}return S}import rn from"papaparse";var wn=["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"],Mn=["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"],Tn=["latitude","longitude"],vn=["latitude","longitude"];function q(t){return ce(t)}var Et=["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"],In=["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"],Rn=["osszege","sucet","\u7684\u603B\u548C","\u7684\u8BA1\u6570","\u306E\u5408\u8A08","\uC758 \uD569\uACC4"],En=["atlaga","priemer","\u7684\u5E73\u5747\u503C","\u306E\u5E73\u5747","\uC758 \uD3C9\uADE0"],xe=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 We(t){return[...t].sort((e,n)=>n.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")}var Nt=new RegExp("^\\s*(?:(?:sum|count|count\\s+distinct|distinct\\s+count)\\s+of\\s+|(?:"+We(Et)+")\\s+)","i");function It(t){for(let e of t){let n=e.codePointAt(0)??0;if(n>=11904&&n<=40959||n>=44032&&n<=55215)return!0}return!1}var Nn="[\u2013\u2014-]";function kt(t){let e=t.filter(r=>!It(r)),n=t.filter(It),i=[];return e.length&&i.push("(?:\\s+|\\s*"+Nn+"\\s*)("+We(e)+")"),n.length&&i.push("\\s*("+We(n)+")"),new RegExp("(?:"+i.join("|")+")\\s*$","i")}var $e=kt(Rn),kn=kt(En);function Ce(t,e){let n=e.exec(t);if(!n)return null;let i=t.slice(0,n.index);return i.trim()===""?null:{base:i,label:(n[1]??n[2]??"").toLowerCase()}}function Dt(t){let e=q(String(t??"").trim().toLowerCase());if(!e)return null;for(let r of In)if(e.startsWith(r+" "))return xe[r]??"avg";for(let r of Et)if(e.startsWith(r+" ")||e===r)return xe[r]??"sum";let n=Ce(e,kn);if(n)return xe[n.label]??"avg";let i=Ce(e,$e);return i?xe[i.label]??"sum":null}var Dn=/(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])/g,Pn=new RegExp("\\b("+wn.join("|")+")\\b|("+Mn.join("|")+")$","i"),On=new RegExp("\\b("+Tn.join("|")+")\\b|("+vn.join("|")+")$","i");function Me(t){if(!t)return"";let e=String(t),n=q(e),i=Nt.exec(n);if(i)return e.slice(i[0].length).trim();let r=Ce(n,$e);return(r?e.slice(0,r.base.length):e).trim()}function Ln(t){if(!t)return!1;let e=q(String(t));return Nt.test(e)||Ce(e,$e)!==null}var Fn=["count (distinct)","count distinct","distinct count","standard deviation","average","variance","median","product","stddev","std dev","count","sum","avg","min","minimum","max","maximum","var"],Rt=new RegExp("^\\s*("+[...Fn].sort((t,e)=>e.length-t.length).map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")+")\\s+of\\s+","i");function Pt(t){if(t==null)return"";let e=String(t),n=Rt.exec(e);if(!n)return e;let i=l=>l.toLowerCase().replace(/\s+/g," ").trim(),r=i(n[1]),s=e.slice(n[0].length),o=0;for(;o<8;){let l=Rt.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,n[0].length)+s}function Be(t,e){if(!t||!e)return!1;let n=String(t);for(let i of e){let r=i?.hostName;if(r&&r!==i?.name&&n.includes(r))return!0}return!1}var we={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 "]},Ot=new RegExp("^("+Object.keys(we).join("|")+")\\((.+)\\)$");function Lt(t){if(!t)return[];let e=Ot.exec(String(t).trim());if(!e)return[];let n=we[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 n){let a=l+o;r.includes(a)||r.push(a)}}return r}function Ft(t,e,n){let i=Ot.exec(String(t??"").trim());if(!i)return!1;let r=i[1];if((r==="Count"||r==="CountNonNull")&&n==="Decimal")return!0;let s=new Set(we[r]),o=String(e??""),l=i[2];for(let a=l.indexOf(".");a>=0;a=l.indexOf(".",a+1)){if(a===0)continue;let c=l.slice(a+1);if(c.trim()!==""){for(let d of Object.values(we))for(let g of d)if(!s.has(g)&&o===g+c)return!0}}return!1}function zn(t){let e=Me(t);return e.length===0?"":e.replace(Dn," ")}function zt(t,e){if(!e)return!1;let n=Me(e);return t.test(q(zn(e)))||t.test(q(n))||t.test(q(J(n).join(" ")))}function Wt(t){return zt(On,t)}function Wn(t){return zt(Pn,t)||Wt(t)}var $t=/int|double|decimal|single|float|number|currency|money/i;function $n(t){let e=String(t?.valueNature??"").trim().toLowerCase();return e==="categorical"?"Categorical":e==="ordinal"?"Ordinal":e==="continuous"||t?.isMeasure===!0||$t.test(String(t?.dataType??""))?"Continuous":"Categorical"}function Bn(t){return t?.isMeasure===!0||$t.test(String(t?.dataType??""))}function Bt(t){let e=t??{},n=$n(e);if(n!=="Continuous")return{nature:n,additivity:"unknown",basis:"role",suppressed:!1};if(Wt(e.name))return{nature:n,additivity:"positional",basis:"name",suppressed:!0};let i=String(e.additivity??"").trim().toLowerCase();if(!(i==="additive"&&Ln(e.name))){if(i==="additive")return{nature:n,additivity:"additive",basis:"measured",suppressed:!1};if(i==="part_of_whole")return{nature:n,additivity:"part_of_whole",basis:"measured",suppressed:!1};if(i==="intensive_rate")return{nature:n,additivity:"intensive_rate",basis:"measured",suppressed:!1}}return e.discourageAggregationAcrossGroups===!0?{nature:n,additivity:"intensive_rate",basis:"host-flag",suppressed:!1}:Wn(e.name)?{nature:n,additivity:"intensive_rate",basis:"name",suppressed:!1}:{nature:n,additivity:"additive",basis:"default",suppressed:!1}}function Gt(t){let e=Bt(t),n=t??{};if(e.nature==="Categorical")return["first","distinctcount","count"];if(e.nature==="Ordinal")return Bn(n)?["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 Ti(t){return Gt(t)[0]}function vi(t,e){return Gt(t).indexOf(e)>=0}function Ii(t,e){if(e!=="sum"&&e!=="count")return!1;if(e==="count")return!0;let n=Bt(t);return n.additivity==="additive"||n.additivity==="part_of_whole"||n.additivity==="unknown"}var Gn={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"]},Kn=["fr","es","pt","it","pl","cs","sk","hr","ru","uk","el","ar","he","id","vi","th"],Vn=["num\xE9ro"],Un=t=>t.normalize("NFC").toLowerCase();function Hn(t,e,n,i){let r=Ee(n);return!r||!t?null:t===e?"word":r.wordBreaks===!1?Array.from(e).length<tt?null:(i?t.startsWith(e):t.endsWith(e))&&t.length>e.length?"suffix":null:i?Je(t,n).includes(e)?"word":null:r.script==="Hang"?et(t,e)?"suffix":null:r.compounds&&Qe(t,e,qe)?"suffix":null}function Kt(t){let e=String(t??"").trim();if(!e)return null;let n=de(e),i=de(Me(e));for(let[r,s]of Object.entries(Gn)){let o=Kn.includes(r),l=o?i:n;for(let a of s){let c=Vn.includes(a)||!!Ee(r)?.foldSensitive,d=c?l.words:l.folded;if(d.length===0)continue;let g=c?Un(a):de(a).folded.join(" "),m=Hn(o?d[0]:d[d.length-1],g,r,o);if(m)return{lang:r,word:a,view:m}}}return null}var Yn=[["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 Te(t){for(let[e,n]of Yn)if(n.test(t))return e;return null}var jn=[{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]]}],ve=new Map;function Vt(t,e,n,i){let r=ve.get(t);if(r)return r;let s=[];for(let[o,l]of e)for(let a=o;a<=l;a++){let c=String.fromCodePoint(a);Te(c)===n&&(i&&!i.test(c)||s.push(c))}return ve.set(t,s),s}function Xn(t){let n=t.codePointAt(0);for(let o=0;o<9&&Te(String.fromCodePoint(n-1))==="Nd";o++)n--;let i="nd:"+n.toString(16),r=ve.get(i);if(r)return r;let s=[];for(let o=n;o<n+10;o++){let l=String.fromCodePoint(o);Te(l)==="Nd"&&s.push(l)}return ve.set(i,s),s}function Zn(t,e){if(e==="Nd")return Xn(t);for(let r of jn)if(r.test.test(t))return Vt(r.id+":"+e,r.ranges,e,r.id==="ascii"?null:r.test);let i=t.codePointAt(0)&-128;return Vt("block:"+i.toString(16)+":"+e,[[i,i+127]],e,null)}function qn(t,e,n,i){let r=t.filter(s=>!e.has(s));return r.length===0&&(r=t.filter(s=>s!==n)),r.length===0?n:r[Math.min(r.length-1,Math.floor(i()*r.length))]}var Qn=/^[\p{L}\p{M}\p{Nd}]$/u,Ut=/^[\p{L}\p{Nd}]$/u;function Ht(t,e){if(!t)return t??"";let n=new Set(Array.from(t)),i=d=>{let g=Te(d);return!g||!Qn.test(d)?d:qn(Zn(d,g),n,d,e)},r=d=>{let g=[];for(let m of d)g.push(i(m)),Ut.test(m)&&e()<.2&&g.push(i(m));if(g.length>6){let m=Math.floor(e()*Math.min(3,g.length-6));for(let b=0;b<m;b++)for(let M=0;M<5;M++){let A=Math.floor(e()*g.length);if(Ut.test(g[A])){g.splice(A,1);break}}}return g.join("")};if(!(t.includes("@")&&t.includes(".")))return r(t);let[o,l=""]=t.split("@"),a=l.endsWith(".com"),c=a?l.slice(0,-4):l;return`${r(o)}@${r(c)}${a?".com":""}`}var Jn=/^[A-Za-z_$][A-Za-z0-9_$]*$/,er=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),tr=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 se(t,e){if(!t||!e)return!1;let n=er(e);return new RegExp("['\"`]"+n+"['\"`]").test(t)?!0:Jn.test(e)&&new RegExp("\\."+n+"(?![A-Za-z0-9_$])").test(t)}function nr(t){return!!t&&tr.test(t)}function Oi(t,e,n){return t?nr(t)?[...e]:[...n,...e].some(i=>se(t,i))?e.filter(i=>se(t,i)):[...e]:[]}var rr=5,ir=6,sr=3,te=864e5,or=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,ar=/^(\d{4})[-/](\d{1,2})$/,lr=/^(\d{4})[-\s]?Q([1-4])$/i,ur=/^Q([1-4])[-\s](\d{4})$/i,cr=/^(\d{4})$/,dr=/^(\d{4})(0[1-9]|1[0-2])$/,mr=/^(\d{4})(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])$/,fr=/^(\D+?)[\s\-/.,']*((?:19|20)\d{2})$/u,gr=/^((?:19|20)\d{2})[\s\-/.,']+(\D+)$/u;function Ge(t,e,n){let i=ee(t);if(!i)return 0;if(i==="sept")return 9;for(let o of e&&!/^en\b/i.test(e)?["en",e]:["en"]){let l=Se(o)[i];if(l!==void 0)return l+1}let r=n?.get(i);if(r!==void 0)return r+1;let s=ie(t);if(s.length>0){if(s.every(a=>a.month===s[0].month))return s[0].month+1;let o=Xe(String(e??"").split(/[-_]/)[0])?.code,l=s.find(a=>a.lang===o);if(l)return l.month+1}return 0}function pr(t){let e=ge(t).filter(i=>i.yearDigits===4);if(e.length===0||e.some(i=>i.lang==="en"))return null;let n=e[0];return e.some(i=>i.grain!=="quarter"||i.n!==n.n||i.year!==n.year)?null:Y(n.year,(n.n-1)*3+1,1)}function Y(t,e,n,i=0,r=0,s=0){if(!(t>=1&&e>=1&&e<=12&&n>=1&&n<=31))return null;let o=Date.UTC(t,e-1,n,i,r,s);if(!Number.isFinite(o))return null;let l=a=>a<10?"0"+a:String(a);return{ms:o,y:t,m:e,d:n,iso:`${t}-${l(e)}-${l(n)}`}}function hr(t,e){let n=[],i="";for(let a=0;a<e.length;a++){if(e[a]!=="%"){i+=e[a].replace(/[.*+?^${}()|[\]\\]/g,"\\$&");continue}switch(e[++a]){case"Y":n.push("Y"),i+="(\\d{4})";break;case"m":n.push("m"),i+="(\\d{1,2})";break;case"d":n.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(t);if(!r)return null;let s=0,o=1,l=1;return n.forEach((a,c)=>{let d=+r[c+1];a==="Y"?s=d:a==="m"?o=d:l=d}),s?Y(s,o,l):null}function j(t,e,n,i){let r=(t??"").trim();if(r==="")return null;if(e){let a=hr(r,e);return a||null}let s=or.exec(r);if(s)return Y(+s[1],+s[2],+s[3],+(s[4]??0),+(s[5]??0),+(s[6]??0));if(s=lr.exec(r),s)return Y(+s[1],(+s[2]-1)*3+1,1);if(s=ur.exec(r),s)return Y(+s[2],(+s[1]-1)*3+1,1);if(s=ar.exec(r),s&&+s[2]>=1&&+s[2]<=12)return Y(+s[1],+s[2],1);if(s=mr.exec(r),s)return Y(+s[1],+s[2],+s[3]);if(s=dr.exec(r),s)return Y(+s[1],+s[2],1);if(s=cr.exec(r),s){let a=+s[1];return a>=1900&&a<=2100?Y(a,1,1):null}let o=pr(r);if(o)return o;if(s=fr.exec(r),s){let a=Ge(s[1],n,i);if(a)return Y(+s[2],a,1)}if(s=gr.exec(r),s){let a=Ge(s[2],n,i);if(a)return Y(+s[1],a,1)}let l=ne(r);if(l){let a="month"in l?l.month:Ge(l.word,n,i);if(a)return Y(l.year,a,1)}return null}function Yt(t){let e=new Date(t).getUTCDay();return e>=1&&e<=5}function jt(t,e){if(e<=t)return 0;let n=Math.round((e-t)/te),i=Math.floor(n/7),r=i*5,s=t+i*7*te;for(;s<e;)Yt(s)&&r++,s+=te;return r}function yr(t){if(t.length===0)return 0;let e=[...t].sort((i,r)=>i-r),n=e.length>>1;return e.length%2?e[n]:(e[n-1]+e[n])/2}function br(t){return t>0?t<.95?"hour":t<=1.05?"day":t>=6.5&&t<=7.5?"week":t>=27&&t<=31.5?"month":t>=88&&t<=93?"quarter":t>=362&&t<=368?"year":"irregular":"irregular"}function oe(t,e,n,i){switch(n){case"year":return e.y-t.y;case"quarter":return e.y*4+Math.floor((e.m-1)/3)-(t.y*4+Math.floor((t.m-1)/3));case"month":return e.y*12+e.m-(t.y*12+t.m);case"week":return Math.round((e.ms-t.ms)/(7*te));case"weekday":return jt(t.ms,e.ms);case"day":return Math.round((e.ms-t.ms)/te);default:return i>0?Math.round((e.ms-t.ms)/i):0}}function Xt(t,e){return Ke(t,e)?.cadence??null}function Ke(t,e){let n=e?.gapFactor??rr,i=0,r=0,s=new Map,o=Array.from(t),l;if(!e?.pattern){let f=[];for(let C of o){if(C==null||C==="")continue;let y=ne(String(C));y&&"word"in y&&f.push(y.word)}f.length>0&&(l=_e(f,e?.locale)??void 0)}for(let f of o){if(f==null||f==="")continue;i++;let C=j(String(f),e?.pattern,e?.locale,l);C&&(r++,s.set(C.ms,C))}let a=[...s.values()].sort((f,C)=>f.ms-C.ms);if(a.length<sr||i>0&&r/i<.8)return null;let c=a[a.length-1].ms-a[0].ms;if(c<=0)return null;let d=[];for(let f=1;f<a.length;f++)d.push(a[f].ms-a[f-1].ms);let g=yr(d);if(!(g>0))return null;let m=br(g/te);m==="day"&&c>=7*te&&a.every(f=>Yt(f.ms))&&jt(a[0].ms,a[a.length-1].ms)+1>a.length*.5&&(m="weekday");let b=m==="irregular"?a.length:oe(a[0],a[a.length-1],m,g)+1,M=1,A=1,S=[],p=a[0],h=1;for(let f=1;f<a.length;f++){let C=oe(a[f-1],a[f],m,g);C>M&&(M=C),m!=="irregular"&&C>n?(A++,S.push({from:p.iso,to:a[f-1].iso,points:h}),p=a[f],h=1):h++}S.push({from:p.iso,to:a[a.length-1].iso,points:h});let x={grain:m,points:a.length,expectedPoints:Math.max(b,a.length),coveragePct:Math.round(a.length/Math.max(b,a.length)*1e3)/10,runs:A,largestGapUnits:M,gapFactor:n};return e?.includeBounds&&S.length<=ir&&(x.runBounds=S),{cadence:x,points:a,stepMs:g}}var Sr=8,_r=.5,Ar=200,xr=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"],wr=new Set(["UUID","EMAIL_LIKE","URL_LIKE","PHONE_LIKE","NUMERIC_ID","HEX_ID","OPAQUE_ID_ALPHANUMERIC","DATE_STR","BOOLEAN"]);function Mr(t){let e=J(t);if(e.length===0)return!1;let n=e[e.length-1];return xr.has(n)?!0:Cr.some(i=>n.length>i.length&&n.endsWith(i))}function Tr(t){if(t.isMeasure)return"measure";if(t.isTemporal||t.isDatePart||t.isReassembledDate)return"temporal";let e=Array.from(t.values).filter(n=>n!==""&&n!==null&&n!==void 0);return e.length<2||e.length>Ar?"cardinality":t.rows>0&&e.length>=t.rows?"row-identity":t.isBinaryFlag?"flag":pe(e,t.locale)!==null?"ordinal":t.identifierNamed||t.dataType==="String"&&wr.has(be(e))?"identifier":!t.geoKind&&Mr(t.name)?"attribute":"entity"}function Qt(t){let e=-1,n=1/0,i=!1;return t.forEach((r,s)=>{if(Tr(r)!=="entity")return;let o=new Set(Array.from(r.values).filter(a=>a!=="")).size,l=!!r.geoKind;(o<n||o===n&&l&&!i)&&(e=s,n=o,i=l)}),e}var Zt=t=>t<10?"0"+t:String(t);function qt(t,e){switch(e){case"year":return`${t.y}-01-01`;case"quarter":return`${t.y}-${Zt(Math.floor((t.m-1)/3)*3+1)}-01`;case"month":return`${t.y}-${Zt(t.m)}-01`;case"hour":return new Date(t.ms).toISOString().replace(/\.\d{3}Z$/,"Z");default:return t.iso}}function Jt(t){let{periods:e,series:n}=t,i=Math.min(e.length,n.length),r=new Set;for(let C=0;C<i;C++)e[C]&&r.add(e[C]);let s=Ke(r,{pattern:t.pattern,locale:t.locale});if(!s)return null;let o=s.cadence.grain;if(o==="irregular")return null;let l=s.points[0],a=oe(l,s.points[s.points.length-1],o,s.stepMs)+1;if(a!==s.cadence.expectedPoints)return null;let c=new Map;for(let C of r){let y=j(C,t.pattern,t.locale);if(!y)continue;let _=oe(l,y,o,s.stepMs);_>=0&&_<a&&c.set(C,{idx:_,stamp:y})}let d=new Map;for(let C=0;C<i;C++){let y=n[C];if(!y)continue;let _=c.get(e[C]);if(!_)continue;let w=d.get(y);w||(w={seen:new Set,lo:_.idx,hi:_.idx,loStamp:_.stamp,hiStamp:_.stamp,order:d.size},d.set(y,w)),w.seen.add(_.idx),_.idx<w.lo&&(w.lo=_.idx,w.loStamp=_.stamp),_.idx>w.hi&&(w.hi=_.idx,w.hiStamp=_.stamp)}if(d.size<2)return null;let g=0;for(let C of d.values())g+=C.seen.size;if(g/(d.size*a)<(t.minFill??_r))return null;let m=[],b=new Set,M=0,A=0,S=0,p=0,h=0,x=1;for(let[C,y]of d){for(let z of y.seen)b.add(z);if(y.seen.size>=a)continue;let _=[...y.seen].sort((z,X)=>z-X),w=1;for(let z=1;z<_.length;z++)w=Math.max(w,_[z]-_[z-1]);let W={key:C,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:w};m.push(W),W.before>0&&M++,W.after>0&&A++,W.interior>0&&S++,p=Math.max(p,W.before),h=Math.max(h,W.after),x=Math.max(x,w)}if(m.length===0)return null;m.sort((C,y)=>C.coverage-y.coverage||C.acc.order-y.acc.order);let f=m.slice(0,t.maxListed??Sr);return{seriesColumn:t.seriesColumn,grain:o,periods:a,seriesCount:d.size,incompleteSeries:m.length,lateStarts:M,earlyEnds:A,withHoles:S,columnWideMissing:a-b.size,maxMissingBefore:p,maxMissingAfter:h,largestGap:x,series:f.map(C=>{let y={};return t.includeNames&&(y.name=C.key),t.includeDates&&(y.first=qt(C.acc.loStamp,o),y.last=qt(C.acc.hiStamp,o)),y.missingBefore=C.before,y.missingAfter=C.after,y.missingInterior=C.interior,y.largestGap=C.gap,y.coverage=Math.round(C.coverage*1e3)/1e3,y}),more:m.length-f.length}}var Ie=6;function ae(t){let e=t.slice().sort((i,r)=>i-r),n=e.length>>1;return e.length%2?e[n]:(e[n-1]+e[n])/2}function vr(t){let e=t.length;if(e<Ie)return null;let n=t[0],i=t[0],r=0;for(let f of t)f<n&&(n=f),f>i&&(i=f),r+=f;if(n===i)return null;let s=ae(t.map(Math.abs));if(s===0)return null;let o=[];for(let f=1;f<e;f++)o.push(t[f]-t[f-1]);let l=ae(o.map(Math.abs))/s,a=(e-1)/2,c=r/e,d=0,g=0,m=0;for(let f=0;f<e;f++)d+=(f-a)*(t[f]-c),g+=(f-a)*(f-a),m+=(t[f]-c)*(t[f]-c);m/=e;let b=d/g,M=c-b*a,A=t.map((f,C)=>f-(M+b*C)),S=A.reduce((f,C)=>f+C,0)/e,p=0,h=0;for(let f=0;f<e;f++)p+=(A[f]-S)*(A[f]-S),f>0&&(h+=(A[f]-A[f-1])*(A[f]-A[f-1]));return p/=e,h/=e-1,{vnDetrended:p<=m*1e-12?2:h/p,relStep:l}}function Ve(t){let{stamps:e,series:n,values:i}=t,r=Math.min(e.length,i.length),s=new Map;for(let c=0;c<r;c++){let d=e[c],g=i[c];if(d===null||g===null||!Number.isFinite(g))continue;let m="";if(n&&(m=n[c]??"",m===""))continue;let b=s.get(m);b||s.set(m,b=new Map),b.set(d,(b.get(d)??0)+g)}let o=[],l=[],a=[];for(let c of s.values()){let d=[...c.entries()].sort((m,b)=>m[0]-b[0]).map(m=>m[1]),g=vr(d);g&&(o.push(g.vnDetrended),l.push(g.relStep),a.push(d.length))}return o.length===0?null:{series:o.length,points:Math.round(ae(a)),vnDetrended:Math.round(ae(o)*1e3)/1e3,relStep:Math.round(ae(l)*1e4)/1e4}}function Yi(t){let e=t.times.map(n=>j(n,t.pattern,t.locale)?.ms??null);return Ve({stamps:e,series:t.series,values:t.values})}var Ir=5e5,Rr=8,Er=4,Nr=5,Ue=1,He=2,kr=4,Dr=8;function Pr(t,e,n){let[i,r]=[...t];if(e.isTemporal){let s=j(i,e.temporalTextPattern,n),o=j(r,e.temporalTextPattern,n);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 Or(t,e,n){let{rows:i,text:r,locale:s}=t,o=Pr(n.values,n,s),l=new Uint8Array(i.length),a=0;for(let c=0;c<i.length;c++){let d=r(i[c][e]);d===o.a?l[c]=1:d===o.b?l[c]=2:a++}return{code:l,blankRows:a,setOrder:o.setOrder}}function Lr(t,e){let{rows:n,text:i}=t,r=new Int32Array(n.length),s=new Map;for(let o=0;o<n.length;o++){let l=i(n[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 Fr(t,e,n){let i=new Uint8Array(n);for(let s=0;s<t.length;s++){let o=e[s];if(o===0)continue;let l=t[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<n;s++){let o=i[s];o&Ue&&r.keysA++,o&He&&r.keysB++,(o&(Ue|He))===(Ue|He)&&r.keysBoth++,o&kr&&r.dupA++,o&Dr&&r.dupB++}return r}function zr(t,e){let n=(t.dupA+t.dupB)*(e.keysA+e.keysB),i=(e.dupA+e.dupB)*(t.keysA+t.keysB);return n<i||n===i&&t.keysBoth>e.keysBoth}var en=t=>t==null||typeof t=="string"&&t.trim()==="";function Wr(t,e,n){if(t===e)return!0;let i=en(t),r=en(e);return i||r?i&&r:typeof t=="number"&&typeof e=="number"?!1:t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():n(t).trim()===n(e).trim()}function tn(t){let{rows:e,columns:n}=t,i=e.length;if(i<2||i>Ir)return null;let r=n.map((y,_)=>({c:y,i:_})).filter(({c:y})=>!y.isMeasure&&!y.isTemporal&&!y.isDatePart&&y.distinct>=Nr).sort((y,_)=>(_.c.identifierNamed?1:0)-(y.c.identifierNamed?1:0)||_.c.distinct-y.c.distinct||y.i-_.i).slice(0,Rr),s=n.map((y,_)=>({c:y,i:_})).filter(({c:y})=>!y.isMeasure&&y.values!==null&&y.values.size===2).slice(0,Er);if(r.length===0||s.length===0)return null;let o=s.map(({c:y,i:_})=>Or(t,_,y)),l=null;for(let{i:y}of r){let _=Lr(t,y);for(let w=0;w<s.length;w++){if(s[w].i===y)continue;let W=Fr(_.ids,o[w].code,_.dict.size);W.keysBoth<1||(!l||zr(W,l.tally))&&(l={tally:W,keyIdx:y,setNo:w,ids:_.ids,dict:_.dict})}}if(!l)return null;let{ids:a,dict:c,tally:d}=l,g=o[l.setNo],m=s[l.setNo].i,b=c.size,M=new Int32Array(b).fill(-1),A=new Int32Array(b).fill(-1);for(let y=0;y<i;y++){let _=g.code[y],w=a[y];_===0||w<0||(_===1?M[w]<0&&(M[w]=y):A[w]<0&&(A[w]=y))}let S=[];for(let y=0;y<n.length;y++)y!==l.keyIdx&&y!==m&&S.push(y);let p=0;for(let y=0;y<b;y++){let _=M[y],w=A[y];if(_<0||w<0)continue;let W=e[_],z=e[w],X=!0;for(let Q of S)if(!Wr(W[Q],z[Q],t.text)){X=!1;break}X&&p++}let h=p===d.keysBoth?100:p===0?0:Math.min(99,Math.max(1,Math.round(p/d.keysBoth*100))),x=new Map,f=new Map;for(let[y,_]of c){let w=M[_]>=0,W=A[_]>=0;if(!w&&!W)continue;let z=ut(y);ct(z)&&(w&&x.set(z,(x.get(z)??0)+1),W&&f.set(z,(f.get(z)??0)+1))}let C=y=>{let _=0;for(let w of y.values())w>=2&&(_+=w);return _};return{key:l.keyIdx,discriminator:m,pairing:{form:"long",key:n[l.keyIdx].name,discriminator:n[m].name,keysA:d.keysA,keysB:d.keysB,keysBoth:d.keysBoth,duplicateKeysA:d.dupA,duplicateKeysB:d.dupB,identicalPct:h,discriminatorBlankRows:g.blankRows,looseCollisionsA:C(x),looseCollisionsB:C(f),setOrder:g.setOrder}}}var $r=t=>t==="Integer"||t==="Decimal";function Br(t){let e=[],n=[];return t.forEach((i,r)=>{if(i.twoValues){if(i.isBinaryFlag){e.push(r);return}i.isMeasure||i.isTemporal||i.isDatePart||i.identifierNamed||n.push(r)}}),[...e,...n].slice(0,6)}function Gr(t,e){let n=[];for(let i=0;i<t.length&&n.length<12;i++){let r=t[i];e.has(i)||!$r(r.dataType)||r.isTemporal||r.isDatePart||r.identifierNamed||r.distinct<3||n.push(i)}return n}function nn(t){let e=new Map,{rows:n,columns:i,text:r}=t;if(n.length===0||n.length>(t.maxRows??5e5))return e;let s=Br(i);if(s.length===0)return e;let o=Gr(i,new Set(s));if(o.length===0)return e;let l=s.map(a=>{let[c,d]=i[a].twoValues,g=new Uint8Array(n.length);for(let m=0;m<n.length;m++){let b=r(n[m][a]);g[m]=b===c?1:b===d?2:0}return g});for(let a of o){let c=new Float64Array(n.length),d=0;for(let h=0;h<n.length;h++){let x=n[h][a],f=x==null||x===""?NaN:typeof x=="number"?x:parseFloat(x);c[h]=f,f===f&&f!==1/0&&f!==-1/0&&d++}if(d<2)continue;let g=new Float64Array(d);for(let h=0,x=0;h<n.length;h++){let f=c[h];f===f&&f!==1/0&&f!==-1/0&&(g[x++]=f)}g.sort();let m=new Float64Array(d),b=0;for(let h=0;h<d;h++)(h===0||g[h]!==g[h-1])&&(m[b++]=g[h]);let M=new Int32Array(n.length).fill(-1);for(let h=0;h<n.length;h++){let x=c[h];if(!(x===x&&x!==1/0&&x!==-1/0))continue;let f=0,C=b-1;for(;f<C;){let y=f+C>>>1;m[y]<x?f=y+1:C=y}M[h]=f}let A=[],S=new Int32Array(b),p=new Int32Array(b);for(let h=0;h<s.length;h++){let x=l[h];S.fill(0),p.fill(0);let f=0,C=0;for(let U=0;U<n.length;U++){let u=M[U];u<0||(x[U]===1?(S[u]++,f++):x[U]===2&&(p[u]++,C++))}if(f===0||C===0)continue;let y=f<=C,_=y?f:C,w=y?C:f,W=y?S:p,z=y?p:S,X=0,Q=0,le=0;for(let U=0;U<b;U++){let u=W[U],T=z[U];X+=u*(Q+.5*T),Q+=T,u+T>=2&&(le+=u+T)}A.push({outcome:i[s[h]].name,aucMinorityHigh:Math.round(X/(_*w)*1e4)/1e4,nMinority:_,nMajority:w,ties:le})}A.length>0&&e.set(a,A)}return e}var Kr=12,Vr=100,Ur=.3,Hr=.9,Yr=120,jr=1900,Xr=2100,Zr=0,qr=20,Qr=new Set(["id","ids","uuid","guid","key","zip","zipcode","postal","postalcode","ssn","code","codes","sku","isbn","msisdn","imei"]);function Re(t){if(!t)return!1;let e=J(t);return e.length===0?!1:Qr.has(e[e.length-1])?!0:Kt(t)!==null}var Jr=new Set(["year","yr","fy"]),ei=t=>J(t).some(e=>Jr.has(e))||lt(t)!==null,ti=/^(?:(?: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 Ye(t){if(!Number.isInteger(t)||t<190001||t>210012)return!1;let e=t%100;return e>=1&&e<=12}function je(t){if(!Number.isInteger(t)||t<19000101||t>21001231)return!1;let e=Math.floor(t/100)%100,n=t%100;return e>=1&&e<=12&&n>=1&&n<=31}var ni=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,ri=/^(\d{4})([\/.])(\d{1,2})\2(\d{1,2})$/,ii=/^(\d{1,2})([\/.\-])(\d{1,2})\2(\d{4})(?:[ T](\d{2}):(\d{2})(?::(\d{2}))?)?$/;function an(t,e){let n=[],i=0,r=si(t,e,n,()=>{i++});if(r)return r;if(i>0||n.length<2)return null;let s=vt(n,{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 si(t,e,n,i){let r=0,s=0,o=0,l=0,a=0,c="",d=0,g="",m=0,b=0,M=0,A=0,S=!1;for(let y of t){if(y==null)continue;let _=String(y).trim();if(_==="")continue;r++,n.push(_);let w;if(w=ni.exec(_)){i();let W=+w[2],z=+w[3];W>=1&&W<=12&&z>=1&&z<=31&&(s++,w[4]!==void 0&&o++,w[6]!==void 0&&l++)}else if(w=ri.exec(_)){i();let W=+w[3],z=+w[4];W>=1&&W<=12&&z>=1&&z<=31&&(c&&c!==w[2]&&(S=!0),c=w[2],a++)}else if(w=ii.exec(_)){i();let W=+w[1],z=+w[3];W>=1&&W<=31&&z>=1&&z<=31&&(W<=12||z<=12)&&(g&&g!==w[2]&&(S=!0),g=w[2],d++,W>12&&M++,z>12&&A++,w[5]!==void 0&&m++,w[7]!==void 0&&b++)}if(r>=200)break}if(r<2||(s+a+d)/r<.8||(s>0?1:0)+(a>0?1:0)+(d>0?1:0)!==1||S)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${c}%m${c}%d`,orderFrom:"iso"};if(M>0&&A>0)return null;let x,f;M>0?(x=!0,f="values"):A>0?(x=!1,f="values"):g==="."?(x=!0,f="shape"):(x=!ze(e),f="locale");let C=x?`%d${g}%m${g}%Y`:`%m${g}%d${g}%Y`;return m===d?{pattern:C+(b===d?" %H:%M:%S":" %H:%M"),orderFrom:f}:{pattern:C,orderFrom:f}}function oi(t,e){if(!e||!/\b(?:19|20)\d{2}\b/.test(t))return!1;let n=t.replace(/\b(?:19|20)\d{2}\b/g,"").replace(/[-/.,]/g," ").trim();if(!n)return!1;let i=ee(n);return i.length>0&&e[i]!==void 0}function ai(t,e){let n=new Map,i=new Map;for(let l of t){let a=ne(l);if(!a||"month"in a)continue;let c=ie(a.word),d=c.some(m=>m.lang==="en"),g=ee(a.word);for(let m of new Set(c.map(b=>b.lang)))m!=="en"&&(n.has(m)||(n.set(m,new Set),i.set(m,new Set)),n.get(m).add(g),d||i.get(m).add(g))}let r=[...n.keys()].filter(l=>n.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=ne(l);if(!a)continue;if("month"in a){s++;continue}let c=ie(a.word);if(c.length===0)continue;let d=c.some(g=>g.lang==="en");for(let g of r)(d||c.some(m=>m.lang===g))&&o.set(g,o.get(g)+1)}return s+Math.max(0,...o.values())}var li=/(?:19|20)[0-9]{2}/;function ui(t){let e=new Map,n=0;for(let r of t){if(!li.test(ce(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")){n++;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+n:0}function ci(t){let{dataType:e,name:n,isMeasure:i,distinctCount:r}=t;if(e==="DateTime")return!0;if(i)return!1;if(e==="Integer"||e==="Decimal"){let s=t.minNum,o=t.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&&ei(n)||a&&r>=3&&r===o-s+1)return!0;let c=Ye(s)&&Ye(o),d=je(s)&&je(o);if(c||d){if(!t.sampleValues)return!0;let g=0,m=0;for(let b of t.sampleValues){if(b==null||b==="")continue;g++;let M=Number(String(b).trim());if(Number.isFinite(M)&&(c?Ye(M):je(M))&&m++,g>=60)break}if(g>=2&&m===g)return!0}return!1}if(t.sampleValues){let s=t.locale?Se(t.locale):null,o=0,l=0,a=[],c=[];for(let d of t.sampleValues){if(d==null||d==="")continue;o++;let g=String(d).trim();if(a.push(g),ti.test(g)||oi(g,s)?l++:c.push(g),o>=60)break}if(o>=2&&l/o>=.8||o>=2&&(l+ui(c)+ai(a,c))/o>=.8||an(a,t.locale)!==null)return!0}return!1}function di(t){let e=q((t||"").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":Dt(t)}function mi(t){let{rows:e,measureColIdx:n,measureName:i,candidateDims:r,minNum:s,maxNum:o,discourageAgg:l}=t,a=100,c=.01,d="";for(let m of r){if(m.distinct<2||m.distinct>a)continue;let b=r.filter(h=>h.idx!==m.idx).map(h=>h.idx),M=new Map;for(let h of e){let x=h[n];if(typeof x!="number"||!Number.isFinite(x))continue;let f=b.length?b.map(y=>String(h[y])).join(d):"",C=M.get(f);C||(C={sum:0,cset:new Set},M.set(f,C)),C.sum+=x,C.cset.add(String(h[m.idx]))}let A=0,S=0,p=0;for(let h of M.values())h.cset.size<2||(p++,Math.abs(h.sum-100)<=100*c?A++:Math.abs(h.sum-1)<=1*c&&S++);if(p>=2&&(A/p>=.9||S/p>=.9))return{additivity:"part_of_whole",partOfWholeDim:m.name}}if(l)return{additivity:"intensive_rate"};let g=di(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 ln(t){let{dataType:e,isMeasure:n,name:i,distinct:r,nonblank:s,prec:o,maxval:l,minval:a}=t,c=l-a+1,d=c>0?r/c:1,g=s>0?r/s:0,m=e==="Decimal"||o>0;return!n&&Re(i)?"Categorical":d>=Hr&&(dt(i)&&r<=Yr||a>=jr&&l<=Xr||a>=Zr&&l<=qr)?"Ordinal":n||r>Kr&&(m||r>=Vr||g>=Ur)?"Continuous":"Categorical"}function sn(t,e,n){return!t||t.isMeasure||e||t.dataType!=="Integer"&&t.dataType!=="Decimal"?!1:ln({dataType:t.dataType,isMeasure:!1,name:t.name,distinct:n.distinct,nonblank:n.nonblank,prec:n.prec,maxval:typeof n.maxval=="number"?n.maxval:0,minval:typeof n.minval=="number"?n.minval:0})==="Continuous"}function fi(t){let e=null;for(let n=0;n<t.length;n++){let i=t[n];if(typeof i!="string"||i.length===0)continue;let r=i.trim();r.length!==i.length&&(e||(e=t.slice()),e[n]=r)}return e||t}var on=class{_computedStatsForLevel=null;_cols=[];_rows=[];_origIndices=[];_rowHashes=new Set;_hostQueryNames=[];_englishAliases=new Map;_declaredDimensions=new WeakSet;_inferredMeasureFlags=null;dedupRows=!0;emitLegacyAggAliases=!1;deriveProvinces=!0;dateCellsAreLocalWallClock=!1;wallClockColumnIndexes(){let e=new Set;if(!this.dateCellsAreLocalWallClock||!this._cols)return e;for(let n=0;n<this._cols.length;n++){let i=this._cols[n];!i||!/date|time/i.test(String(i.dataType??""))||ot(this._rows.map(r=>r[n]))&&e.add(n)}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(n=>!!(n&&n.isMeasure));return this._cols.forEach((n,i)=>{if(!n||n.isMeasure||this._declaredDimensions.has(n)||n.dataType!=="Integer"&&n.dataType!=="Decimal")return;let r=new Set,s=0,o=0,l=null,a=null;for(let c of this._rows){let d=c[i],g=this.STR(d);if(g!=""&&(r.add(g),s++,(l===null||d<l)&&(l=d),(a===null||d>a)&&(a=d),n.dataType=="Decimal")){let m=this.getPrecision(d);m>o&&(o=m)}}e[i]=sn(n,!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 n of e)n&&this._declaredDimensions.add(n)}wholeDayIso(e){return st(e)}hasTimeComponent(e){return!(e instanceof Date)||isNaN(e.getTime())?!1:this.wholeDayIso(e)===null}getColumnsWithStats(e,n){if(this._computedStatsForLevel==e)return this._cols;let i=0,r=parseInt(e),s=this.wallClockColumnIndexes(),o=[],l=[],a=[];for(let u of this._cols){let T=new Map,P=[],D=0,v=0,k=0,F=null,O=null,N=null,G=!1,K=!0,R=!0,E=null,V=!1,L=s.has(i);for(let I of this._rows){let $=I[i],B=L&&$ instanceof Date?fe($):$,H=this.STR(B);if(H!=""){if(D+=H.length,T.set(H,(T.get(H)||0)+1),v++,u.dataType=="Integer"||u.dataType=="Decimal"||u.dataType=="DateTime")if((F===null||B<F)&&(F=B),(O===null||B>O)&&(O=B),u.dataType=="Integer"||u.dataType=="Decimal"){if(N===null?N=B:N+=B,u.dataType=="Decimal"){let Z=this.getPrecision(B);Z>k&&(k=Z)}P.push(B)}else G=G||this.hasTimeComponent(B);V&&(B<E?K=!1:B>E&&(R=!1)),E=B,V=!0}}if(v>=3&&(K&&!R?u.sortedDirection="asc":R&&!K?u.sortedDirection="desc":u.sortedDirection="none"),v>0&&T.size>0&&!u.isMeasure){let I=0,$=Number.MAX_SAFE_INTEGER;for(let B of T.values())B>I&&(I=B),B<$&&($=B);if(u.modalShare=I/v,u.minGroupCount=$===Number.MAX_SAFE_INTEGER?null:$,T.size===2){let B=[...T.keys()].map(ue=>nt(ue).trim().toLowerCase()).sort(),Z=[["false","true"],["no","yes"],["n","y"],["0","1"],["f","t"]].some(ue=>B[0]===ue[0]&&B[1]===ue[1]),un=/^(is|has)[_\p{L}\p{N}]|(?:default|churn|fraud|approv|convert|active|cancel|delinquen|flag|paid|win|pass|fail)/iu.test(u.name);(Z||un)&&(u.isBinaryFlag=!0)}}else u.isMeasure&&(u.dataType==="Integer"||u.dataType==="Decimal")&&T.size===2&&T.has("0")&&T.has("1")&&(u.isBinaryFlag=!0);if(u.dataType=="DateTime"&&(u.dateWithTime=G,G&&at(L?this._rows.map(I=>I[i]instanceof Date?fe(I[i]):I[i]):this._rows.map(I=>I[i]))?u.timeOfDayOnly=!0:delete u.timeOfDayOnly),u.isTemporal=ci({dataType:u.dataType,name:u.name,isMeasure:u.isMeasure,distinctCount:T.size,minNum:typeof F=="number"?F:null,maxNum:typeof O=="number"?O:null,sampleValues:T.keys(),locale:n}),u.isTemporal&&u.dataType==="String"&&!u.isMeasure){let I=an(T.keys(),n);I&&(u.temporalTextPattern=I.pattern)}if(u.timeOfDayOnly)delete u.temporalCadence;else if(u.isTemporal&&!u.isMeasure){let I=Xt(T.keys(),{includeBounds:r>=20,pattern:u.temporalTextPattern,locale:n});I&&(u.temporalCadence=I)}this.updateColumnStats10(r,u,v,T,k,O,F),this.updateColumnStats20(r,P,v,N,u,D,G,F,O,k,T,n),sn(u,this._declaredDimensions.has(u),{distinct:T.size,nonblank:v,prec:k,minval:F,maxval:O})&&(u.isMeasure=!0,u.geoKind=void 0,u.geoMatchPct=void 0,u.geoAmbiguous=void 0,u.dominantGeoRegion=void 0,u.dominantGeoRegionPct=void 0,u.geoRegionCount=void 0),o[i]=u.isMeasure||T.size>2e3?null:new Set(T.keys()),l[i]=T.size,a[i]=T.size===2?[...T.keys()].sort():null,i++}wt(this._cols,this._rows,{cities:this.deriveProvinces}).forEach((u,T)=>{let P=this._cols[T];u.kind&&(P.geoKind=u.kind,P.geoMatchPct=u.matchPct,u.ambiguous&&(P.geoAmbiguous=!0)),u.rollupPct!==void 0&&(P.admin1RollupPct=u.rollupPct),u.regionCount!==void 0&&(P.admin1RegionCount=u.regionCount),u.countryCount!==void 0&&(P.admin1CountryCount=u.countryCount),u.dominantRegion&&(P.dominantGeoRegion=u.dominantRegion,P.dominantGeoRegionPct=u.dominantRegionPct)});let c=this.getGeoExtent();if(c&&c.dominantFrame&&this._geoExtentLatIdx>=0){let u=this._cols[this._geoExtentLatIdx];u.geoKind||(u.dominantGeoRegion=c.dominantFrame,u.dominantGeoRegionPct=c.dominantFramePct,this.deriveProvinces&&(u.admin1RollupPct=c.dominantFramePct))}let d=[];this._cols.forEach((u,T)=>{u.isMeasure||d.push({idx:T,distinct:u.distinctCount??0,name:u.name})}),this._cols.forEach((u,T)=>{if(!u.isMeasure)return;let P=typeof u.lowValue=="number"?u.lowValue:null,D=typeof u.highValue=="number"?u.highValue:null,v=mi({rows:this._rows,measureColIdx:T,measureName:u.name,candidateDims:d,minNum:P,maxNum:D,discourageAgg:!!u.discourageAggregationAcrossGroups});u.additivity=v.additivity,v.partOfWholeDim&&(u.partOfWholeDim=v.partOfWholeDim)});let g=50,m=4,b=d.filter(u=>u.distinct>=2&&u.distinct<=g);this._cols.forEach((u,T)=>{if(!u.isMeasure)return;let P=[];for(let R of this._rows){let E=R[T];if(E==null||E==="")continue;let V=typeof E=="number"?E:parseFloat(E);isNaN(V)||P.push(V)}if(P.length===0)return;let D=[...P].sort((R,E)=>R-E);if(D[0]===D[D.length-1])u.relativeDispersion=0;else if(D.length>=m){let R=me(D,.5),E=me(D,.1),V=me(D,.9);u.relativeDispersion=Math.abs(R)>1e-9?Math.round((V-E)/Math.abs(R)*1e3)/1e3:void 0}else u.relativeDispersion=void 0;let v=[];for(let R of b){let E=new Set;for(let V of this._rows){let L=V[T];L==null||L===""||E.add(this.STR(V[R.idx])+"")}v.push({otherColumn:R.name,nonBlankGroupCount:E.size})}v.length>0&&(u.nonBlankGroups=v);let k=0;for(let R of P)k+=R;k/=P.length;let F=0;for(let R of P)F+=(R-k)*(R-k);if(F<=1e-12)return;let O=[],N=[],G=R=>{if(R.length<4)return NaN;let E=[...R].sort((L,I)=>L-I),V=L=>E[Math.min(E.length-1,Math.max(0,Math.floor(L*(E.length-1))))];return V(.75)-V(.25)},K=G(P);for(let R of b){let E=new Map;for(let I of this._rows){let $=I[T];if($==null||$==="")continue;let B=typeof $=="number"?$:parseFloat($);if(isNaN(B))continue;let H=this.STR(I[R.idx])+"",Z=E.get(H);Z?(Z.s+=B,Z.n++,Z.vals.push(B)):E.set(H,{s:B,n:1,vals:[B]})}let V=0;for(let I of E.values()){let $=I.s/I.n;V+=I.n*($-k)*($-k)}O.push({otherColumn:R.name,eta2:Math.round(V/F*1e4)/1e4});let L=[];for(let I of E.values()){let $=G(I.vals);isNaN($)||L.push($)}if(L.length>=2&&isFinite(K)&&K>1e-9){let I=(Math.max(...L)-Math.min(...L))/K;N.push({otherColumn:R.name,spreadRatio:Math.round(I*1e4)/1e4})}}O.length>0&&(u.groupDiscrimination=O),N.length>0&&(u.spreadDiscrimination=N)});let M=.97,A=.8,S=8,p=5,h=this._cols.map((u,T)=>({c:u,i:T})).filter(u=>u.c.isMeasure);for(let u=0;u<h.length;u++)for(let T=u+1;T<h.length;T++){let P=h[u].i,D=h[T].i,v=0,k=0,F=0,O=0,N=0,G=0;for(let L of this._rows){let I=L[P],$=L[D];if(I==null||I===""||$===null||$===void 0||$==="")continue;let B=typeof I=="number"?I:parseFloat(I),H=typeof $=="number"?$:parseFloat($);isNaN(B)||isNaN(H)||(v++,k+=B,F+=H,O+=B*B,N+=H*H,G+=B*H)}if(v<p)continue;let K=v*O-k*k,R=v*N-F*F;if(K<=1e-12||R<=1e-12)continue;let E=(v*G-k*F)/Math.sqrt(K*R),V=Math.min(1,Math.round(Math.abs(E)*1e3)/1e3);for(let L of[h[u].c,h[T].c])(L.maxAbsMeasureCorrelation===void 0||V>L.maxAbsMeasureCorrelation)&&(L.maxAbsMeasureCorrelation=V);if(Math.abs(E)>=M){let L=h[u].c,I=h[T].c;L.collinearWithMeasures||(L.collinearWithMeasures=[]),I.collinearWithMeasures||(I.collinearWithMeasures=[]),L.collinearWithMeasures.push(I.name),I.collinearWithMeasures.push(L.name)}else if(Math.abs(E)>=A){let L=h[u].c,I=h[T].c,$=Math.round(E*1e3)/1e3;L.correlatedWithMeasures||(L.correlatedWithMeasures=[]),I.correlatedWithMeasures||(I.correlatedWithMeasures=[]),L.correlatedWithMeasures.push({otherColumn:I.name,r:$}),I.correlatedWithMeasures.push({otherColumn:L.name,r:$})}}for(let{c:u}of h)u.correlatedWithMeasures&&(u.correlatedWithMeasures.sort((T,P)=>Math.abs(P.r)-Math.abs(T.r)||(T.otherColumn<P.otherColumn?-1:1)),u.correlatedWithMeasures.length=Math.min(u.correlatedWithMeasures.length,S));for(let u=0;u<this._cols.length;u++){let T=o[u];if(!T||T.size===0)continue;let P=[];for(let D=0;D<this._cols.length;D++){if(D===u)continue;let v=o[D];if(!v||v.size===0)continue;let k=0;for(let O of T)v.has(O)&&k++;let F=Math.round(k/T.size*100);F>0&&P.push({otherColumn:this._cols[D].name,percentShared:F})}P.length>0&&(this._cols[u].sharedValueRatioWithOthers=P)}let x=50,f=[];for(let u=0;u<this._cols.length;u++){let T=o[u];T&&T.size>=2&&T.size<=x&&f.push(u)}if(f.length>=2){let u=new Map,T=(D,v)=>D+":"+v;for(let D=0;D<f.length;D++)for(let v=D+1;v<f.length;v++)u.set(T(f[D],f[v]),new Map);for(let D of this._rows)for(let v=0;v<f.length;v++){let k=this.STR(D[f[v]])+"";for(let F=v+1;F<f.length;F++){let O=""+this.STR(D[f[F]]),N=u.get(T(f[v],f[F])),G=k+""+O;N.set(G,(N.get(G)??0)+1)}}let P=new Map;for(let D=0;D<f.length;D++)for(let v=D+1;v<f.length;v++){let k=f[D],F=f[v],O=o[k].size,N=o[F].size,G=u.get(T(k,F)),K=G.size,R=0;for(let I of G.values())(R===0||I<R)&&(R=I);let E=Math.round(K/(O*N)*100),V=K===O,L=K===N;if((this._cols[k].categoricalPairStats||=[]).push({otherColumn:this._cols[F].name,fillPct:E,determinesOther:V,minCellCount:R,distinctCombinations:K}),(this._cols[F].categoricalPairStats||=[]).push({otherColumn:this._cols[k].name,fillPct:E,determinesOther:L,minCellCount:R,distinctCombinations:K}),V&&O>N){let I=P.get(k);(!I||N<I.card)&&P.set(k,{name:this._cols[F].name,card:N,ratio:N/O})}if(L&&N>O){let I=P.get(F);(!I||O<I.card)&&P.set(F,{name:this._cols[k].name,card:O,ratio:O/N})}}for(let[D,v]of P)this._cols[D].primaryParentColumn=v.name,this._cols[D].nestingRatio=Math.round(v.ratio*100)/100}let C=6,y=this._rows.length;for(let u=0;u<this._cols.length;u++){let T=this._cols[u];if(T.isMeasure||T.primaryParentColumn)continue;let P=T.distinctCount??0;if(P<=x||y>0&&P>=y)continue;let D=[];for(let v=0;v<this._cols.length;v++){if(v===u)continue;let k=this._cols[v];if(k.isMeasure)continue;let F=k.distinctCount??0;F<2||F>=P||D.push(v)}D.sort((v,k)=>(this._cols[v].distinctCount??0)-(this._cols[k].distinctCount??0));for(let v of D.slice(0,C)){let k=new Map,F=!0;for(let N of this._rows){let G=this.STR(N[u])+"",K=this.STR(N[v])+"",R=k.get(G);if(R===void 0)k.set(G,K);else if(R!==K){F=!1;break}}if(!F)continue;let O=this._cols[v].distinctCount??0;T.primaryParentColumn=this._cols[v].name,T.nestingRatio=Math.round(O/P*100)/100;break}}let _=.01,w=.05,W=.95,z=8,X=8,Q=6,le=500,U=[];for(let u=0;u<this._cols.length&&U.length<X;u++){let T=this._cols[u].dataType;(T==="Double"||T==="Integer"||T==="Decimal")&&U.push(u)}if(U.length>=3&&this._rows.length>=z){let u=Math.min(this._rows.length,le),T=U.map(O=>{let N=[];for(let R=0;R<u;R++){let E=this._rows[R][O],V=typeof E=="number"?E:parseFloat(String(E).replace(/,/g,""));if(E==null||E===""||!isFinite(V))return null;N.push(V)}let G=N[0],K=!1;for(let R of N)if(R!==G){K=!0;break}return K?N:null}),P=U.map((O,N)=>N).filter(O=>T[O]!==null),D=O=>{let N=O.slice().sort((K,R)=>K-R),G=N.length>>1;return N.length%2?N[G]:(N[G-1]+N[G])/2},v=null,k=[],F=O=>{if(k.length>=3){let N=k.map(E=>T[E]),G=N[0].length,K=new Array(G);for(let E=0;E<G;E++){let V=0;for(let L of N)V+=L[E];K[E]=V}let R=D(K);if(R>0){let E=0;for(let L of K)Math.abs(L-R)<=R*_&&E++;let V=E/G;if(V>=W){let L=1;for(let I of N){let $=D(I)/R;$<L&&(L=$)}L>=w&&(!v||k.length>v.cols.length)&&(v={cols:k.slice(),total:R,matched:V})}}}if(!(k.length>=Q))for(let N=O;N<P.length;N++)k.push(P[N]),F(N+1),k.pop()};if(F(0),v){let O=v,G={columns:O.cols.map(K=>this._cols[U[K]].name),total:Math.round(O.total*1e3)/1e3,matchedPct:Math.round(O.matched*100)/100};for(let K of O.cols)this._cols[U[K]].constantSumGroup=G}}return this.applyTwoSetPairing(n,o),this.applyScoreSeparation(l,a),this.applySeriesCompleteness(r,n,o),this.applyMeasurePersistence(n,o),this._computedStatsForLevel=e,this._cols}applyTwoSetPairing(e,n){for(let r of this._cols)r.twoSetPairing!==void 0&&delete r.twoSetPairing;let i=tn({rows:this._rows,columns:this._cols.map((r,s)=>{let o=n[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,n){for(let r of this._cols)r.scoreSeparation!==void 0&&delete r.scoreSeparation;let i=nn({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:n[s]??null})),text:r=>this.STR(r)});for(let[r,s]of i)this._cols[r].scoreSeparation=s}applySeriesCompleteness(e,n,i){for(let c of this._cols)c.seriesCompleteness!==void 0&&delete c.seriesCompleteness;let r=this._cols.map((c,d)=>({c,i:d})).filter(({c})=>c.isTemporal&&!c.isMeasure&&c.temporalCadence&&c.temporalCadence.grain!=="irregular");if(r.length===0)return;let s=this.seriesKeyIndex(n,i);if(s<0)return;let o=this._cols[s],l=this._rows.map(c=>this.STR(c[s])),a=e>=20&&(o.dataType!=="String"||Array.isArray(o.safeDistinctValues));for(let{c,i:d}of r){let g=Jt({periods:this._rows.map(m=>this.STR(m[d])),series:l,seriesColumn:o.name,pattern:c.temporalTextPattern,locale:n,includeDates:e>=20,includeNames:a});g&&(c.seriesCompleteness=g)}}seriesKeyIndex(e,n){let i=[],r=[];this._cols.forEach((o,l)=>{let a=n[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=Qt(r);return s<0?-1:i[s]}applyMeasurePersistence(e,n){for(let a of this._cols)a.persistence!==void 0&&delete a.persistence;let i=[];if(this._cols.forEach((a,c)=>{a.isMeasure&&(a.dataType==="Integer"||a.dataType==="Decimal"||a.dataType==="Double")&&i.push(c)}),i.length===0||this._rows.length<Ie)return;let r=-1,s=[];for(let a=0;a<this._cols.length&&r<0;a++){let c=this._cols[a];if(!c.isTemporal||c.isMeasure||c.isDatePart)continue;let d=this._rows.map(g=>j(this.STR(g[a]),c.temporalTextPattern,e)?.ms??null);new Set(d.filter(g=>g!==null)).size<Ie||(r=a,s=d)}if(r<0)return;let o=this.seriesKeyIndex(e,n),l=o>=0?this._rows.map(a=>this.STR(a[o])):void 0;for(let a of i){let c=this._rows.map(g=>{let m=g[a];if(m==null||m==="")return null;let b=typeof m=="number"?m:parseFloat(String(m).replace(/,/g,""));return Number.isFinite(b)?b:null}),d=Ve({stamps:s,series:l,values:c});d&&(this._cols[a].persistence={timeColumn:this._cols[r].name,...o>=0?{seriesColumn:this._cols[o].name}:{},...d})}}updateColumnStats20(e,n,i,r,s,o,l,a,c,d,g,m){if(e>=20){let b=[...n].sort((S,p)=>S-p),M=Math.floor(b.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 S=p=>{let h=p instanceof Date?p:typeof p=="string"?Ne(p)??new Date(p):new Date(p),x=this.wholeDayIso(h);return x?x+"T00:00:00.000Z":isNaN(h.getTime())?p:h.toISOString().slice(0,10)+"T00:00:00.000Z"};s.dataType!="DateTime"||l||!a?s.lowValue=a:s.lowValue=S(a),s.dataType!="DateTime"||l||!c?s.highValue=c:s.highValue=S(c),s.medianValue=b.length===0?null:b.length%2===0?s.dataType=="Integer"?Math.round((b[M-1]+b[M])/2):(b[M-1]+b[M])/2:b[M],s.numericPrecision=d}if(b.length>0){let S=s.avgValue??0,p=b.length,h=0,x=0;for(let y of b){let _=y-S;h+=_*_,x+=_*_*_}let f=h/p,C=Math.sqrt(f);s.skewness=f===0?0:x/p/(C*C*C),s.stdDev=Math.sqrt(f)}r!==null&&(s.sum=r);let A=Array.from(g.entries()).sort((S,p)=>p[1]-S[1]);if(s.topCategories=A.slice(0,10).map(S=>S[1]),!s.isMeasure&&A.length>0&&(s.dataType!=="String"&&(s.topCategoryValues=A.slice(0,5).map(S=>S[0])),e>=20)){let S=A.map(h=>h[0]),p=pe(S,m);if(p!==null)s.ordinalPattern=p.pattern,s.orderedDomain=p.orderedDomain;else if(s.dataType==="String"){let h=mt(S);h!==null&&(s.safeDistinctValues=h)}}if(b.length>=8&&(s.dataType==="Integer"||s.dataType==="Decimal")){let S=p=>b[Math.floor((b.length-1)*p)];s.quantiles={p05:S(.05),p25:S(.25),p75:S(.75),p95:S(.95)}}}if(!s.isMeasure&&s.dataType==="String"&&g.size>0){let b=Array.from(g.entries()).sort((S,p)=>p[1]-S[1]).map(S=>S[0]);s.formatSignature=be(b);let M=i>0?o/i:void 0,A=/^(UUID|EMAIL_LIKE|URL_LIKE|PHONE_LIKE|NUMERIC_ID|HEX_ID|OPAQUE_ID_ALPHANUMERIC|DATE_STR|BOOLEAN)$/;s.formatSignature&&!A.test(s.formatSignature)&&(M===void 0||M>=3)&&(s.isFreeText=!0)}if(!s.isMeasure&&g.size>0){let b=Array.from(g.entries()).sort((A,S)=>S[1]-A[1]),M=St(b.map(A=>A[0]),s.name,m);if(M!==null&&(s.geoKind=M.geoKind,s.geoMatchPct=M.geoMatchPct,M.geoAmbiguous&&(s.geoAmbiguous=!0),M.geoKind.indexOf("country")===0)){let A=pt(b);A&&(s.dominantGeoRegion=A.dominantGeoRegion,s.dominantGeoRegionPct=A.dominantGeoRegionPct,s.geoRegionCount=A.regionCount,A.middleEastPct>0&&(s.middleEastPct=A.middleEastPct))}}}updateColumnStats10(e,n,i,r,s,o,l){let a=this._rows.length-i;e>=10&&(n.blankCount=a),n.distinctCount=r.size+(a!=0?1:0),n.valueNature="Categorical",i>0&&(n.dataType==="Integer"||n.dataType==="Decimal"?n.valueNature=ln({dataType:n.dataType,isMeasure:!!n.isMeasure,name:n.name,distinct:r.size,nonblank:i,prec:s,maxval:o,minval:l}):n.dataType==="DateTime"&&(n.valueNature=n.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 n=new Set;for(let i of this._rows)n.add(JSON.stringify(e.map(r=>i[r])));return this._leafCardinality=n.size,this._leafCardinality}_leafCardinality=null;getGeoExtent(){if(this._geoExtentComputed)return this._geoExtent;this._geoExtentComputed=!0,this._geoExtent=null;let e=o=>Ze(o,{camel:!0}),n=-1,i=-1,r=-1;if(this._cols.forEach((o,l)=>{let a=e(o.name),c=o.dataType==="Integer"||o.dataType==="Decimal";c&&n<0&&a.some(d=>d==="lat"||d==="latitude")?n=l:c&&i<0&&a.some(d=>d==="lon"||d==="lng"||d==="long"||d==="longitude")&&(i=l),r<0&&!o.isMeasure&&typeof o.geoKind=="string"&&o.geoKind.indexOf("country")===0&&(r=l)}),n<0||i<0)return null;this._geoExtentLatIdx=n;let s=[];for(let o of this._rows){let l=o[n],a=o[i],c=l==null||l===""?null:Number(l),d=a==null||a===""?null:Number(a);s.push({lat:c,lon:d,country:r>=0&&he(this.STR(o[r]))?this.STR(o[r]):null})}return this._geoExtent=gt(s),this._geoExtent}_geoExtent=null;_geoExtentComputed=!1;_geoExtentLatIdx=-1;obfuscateString(e){return Ht(e,it)}toObjectArray(){let e=this.liveEnglishAliases();return this._rows.map(n=>{let i={};this._cols.forEach((r,s)=>{i[r.name]=n[s],this.emitLegacyAggAliases&&r.hostName&&r.hostName!==r.name&&!Object.prototype.hasOwnProperty.call(i,r.hostName)&&(i[r.hostName]=n[s])});for(let[r,s]of e)Object.prototype.hasOwnProperty.call(i,s.alias)||(i[s.alias]=n[r]);return i})}async getCSVAsync(e){let n=[],i=e?25:1e7,r=e?4e3:1e7,s=new Map,o=this.wallClockColumnIndexes();for(let a of this._rows){let c={};for(let d=0;d<this._cols.length;d++){let g=this._cols[d],m=a[d];if(this.STR(m)!=""){if(e&&g.dataType=="String")if(s.has(m))m=s.get(m);else{let b=this.obfuscateString(m);s.set(m,b),m=b}else if(g.dataType=="DateTime"&&!g.dateWithTime){let b=m instanceof Date?m:typeof m=="string"?Ne(m)??new Date(m):new Date(m);m=(this.wholeDayIso(b)??b.toISOString().slice(0,10))+"T00:00:00.000Z"}else o.has(d)&&m instanceof Date&&(m=fe(m));r-=this.STR(m).length}else m=null;c[d]=m,--r}if(n.push(c),--i,i<=0||r<=0)break}return await rn.unparse(n,{header:!1})}getCSVHeaderLine(){let e=this.liveEnglishAliases();return rn.unparse([this._cols.map((n,i)=>{if(this.emitLegacyAggAliases&&n.hostName)return this.STR(n.hostName);let r=e.get(i);return this.STR(r&&r.headerName?r.alias:n.name)})])}setHostQueryNames(e){this._hostQueryNames=(e??[]).map(n=>n==null?null:this.STR(n)),this._englishAliases=new Map}aliasesForCode(e){let n=Be(e,this._cols)?this.legacyAliases():[];for(let i of this.englishAliasesFor(e).values())n.push({name:i.name,alias:i.alias,reason:"english-implicit-agg"});return n}armAliasesForCode(e){return this.emitLegacyAggAliases=Be(e,this._cols),this._englishAliases=this.englishAliasesFor(e),this.getArmedAliases()}getArmedAliases(){let e=this.emitLegacyAggAliases?this.legacyAliases():[];for(let n of this.liveEnglishAliases().values())e.push({name:n.name,alias:n.alias,reason:"english-implicit-agg"});return e}legacyAliases(){let e=[];for(let n of this._cols)n&&n.hostName&&n.hostName!==n.name&&e.push({name:this.STR(n.name),alias:this.STR(n.hostName),reason:"doubled-agg-prefix"});return e}englishAliasesFor(e){let n=new Map;if(!e||this._hostQueryNames.length===0||!this._cols||this._cols.length===0)return n;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]||Ft(this._hostQueryNames[o],this._cols[o].name,this._cols[o].dataType))continue;let l=Lt(this._hostQueryNames[o]).filter(a=>!r.has(a)&&se(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);n.set(l[0],{name:a,alias:o,headerName:!se(i,a)})}return n}liveEnglishAliases(){let e=new Map;for(let[n,i]of this._englishAliases){let r=this._cols?this._cols[n]:null;r&&this.STR(r.name)===i.name&&e.set(n,i)}return e}addRow(e,n){if(this.dedupRows){let i="";for(let s of e)i+=this.STR(s)+"~";let r=rt(i);if(this._rowHashes.has(r))return!1;this._rowHashes.add(r)}return this._rows.push(fi(e)),this._inferredMeasureFlags=null,this._origIndices.push(n??-1),!0}getOriginalRowIndex(e){return e<0||e>=this._origIndices.length?-1:this._origIndices[e]}invalidateStats(){this._computedStatsForLevel=null,this._geoExtentComputed=!1,this._geoExtent=null,this._geoExtentLatIdx=-1}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 n=new Set(e.map(i=>this.STR(i?.name)));for(let i of e){if(!i)continue;let r=this.STR(i.name),s=Pt(r);!s||s===r||n.has(s)||(n.delete(r),n.add(s),i.hostName=r,i.name=s)}}};export{cn as a,dn as b,bi as c,Si as d,wt as e,vt as f,wn as g,Mn as h,Tn as i,vn as j,Me as k,Ln as l,Pt as m,Be as n,Lt as o,Wt as p,Wn as q,Bt as r,Gt as s,Ti as t,vi as u,Ii as v,Gn as w,Kn as x,Vn as y,Kt as z,se as A,nr as B,Oi as C,rr as D,ir as E,j as F,Xt as G,Sr as H,_r as I,Ar as J,Tr as K,Qt as L,Jt as M,Yi as N,Re as O,an as P,ci as Q,di as R,mi as S,ln as T,sn as U,fi as V,on as W};
|