@bicharts/shape-core 0.6.138 → 0.6.140

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.
@@ -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{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,_ as j}from"./chunk-FAAKJFLC.mjs";import"./chunk-U3H6UBOO.mjs";import"./chunk-DEDI5YYD.mjs";import"./chunk-2RTTKMKE.mjs";import"./chunk-S7AJDE7I.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-ZATHQUWM.mjs";import"./chunk-5HI6TVMM.mjs";import"./chunk-BLMRLXQJ.mjs";import"./chunk-F6UNSFU6.mjs";export{i as IndexedText,e as classifyAdditivity,f as classifyNumericValueNature,c as classifyTemporal,b as detectTextDatePattern,d as hostAggHint,a as isIdentifierName,j as nameReadsAsOutcome,g as promotesToMeasure,h as trimmedCells};
2
+ import{$ as j,S as a,T as b,U as c,V as d,W as e,X as f,Y as g,Z as h,_ as i}from"./chunk-TZNQ46XF.mjs";import"./chunk-U3H6UBOO.mjs";import"./chunk-DEDI5YYD.mjs";import"./chunk-2RTTKMKE.mjs";import"./chunk-S7AJDE7I.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-ECO2UKG6.mjs";import"./chunk-5HI6TVMM.mjs";import"./chunk-BLMRLXQJ.mjs";import"./chunk-F6UNSFU6.mjs";export{i as IndexedText,e as classifyAdditivity,f as classifyNumericValueNature,c as classifyTemporal,b as detectTextDatePattern,d as hostAggHint,a as isIdentifierName,j as nameReadsAsOutcome,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{c as a,d as b,e as c}from"./chunk-HJAWKDT2.mjs";import"./chunk-FAAKJFLC.mjs";import"./chunk-U3H6UBOO.mjs";import"./chunk-DEDI5YYD.mjs";import"./chunk-2RTTKMKE.mjs";import"./chunk-S7AJDE7I.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-ZATHQUWM.mjs";import"./chunk-5HI6TVMM.mjs";import"./chunk-BLMRLXQJ.mjs";import"./chunk-F6UNSFU6.mjs";export{a as engineTypeForSqlType,c as ingest,b as parseCsvRows};
2
+ import{c as a,d as b,e as c}from"./chunk-7APOCDHB.mjs";import"./chunk-TZNQ46XF.mjs";import"./chunk-U3H6UBOO.mjs";import"./chunk-DEDI5YYD.mjs";import"./chunk-2RTTKMKE.mjs";import"./chunk-S7AJDE7I.mjs";import"./chunk-5MRZID36.mjs";import"./chunk-ECO2UKG6.mjs";import"./chunk-5HI6TVMM.mjs";import"./chunk-BLMRLXQJ.mjs";import"./chunk-F6UNSFU6.mjs";export{a as engineTypeForSqlType,c as ingest,b as parseCsvRows};
@@ -1,2 +1,2 @@
1
1
  /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
- import{m as a,n as b,o as c}from"./chunk-ZATHQUWM.mjs";import"./chunk-5HI6TVMM.mjs";import"./chunk-BLMRLXQJ.mjs";import"./chunk-F6UNSFU6.mjs";export{c as detectOrdinalDomain,a as isOrdinalFriendlyName,b as safeDistinctValuesToShip};
2
+ import{m as a,n as b,o as c}from"./chunk-ECO2UKG6.mjs";import"./chunk-5HI6TVMM.mjs";import"./chunk-BLMRLXQJ.mjs";import"./chunk-F6UNSFU6.mjs";export{c as detectOrdinalDomain,a as isOrdinalFriendlyName,b as safeDistinctValuesToShip};
@@ -192,6 +192,20 @@ export declare function nameLooksPositional(name: string | null | undefined): bo
192
192
  * Coordinates answer TRUE here too, because on the server they are intensive; use
193
193
  * `classifyForAggregation` when the two need telling apart. */
194
194
  export declare function nameLooksIntensiveRate(name: string | null | undefined): boolean;
195
+ /** Stock words that count only as the WHOLE name. */
196
+ export declare const LEVEL_STOCK_WHOLE_NAMES: readonly string[];
197
+ /** A price, in the languages a model is authored in (accent-folded, lower-case). */
198
+ export declare const LEVEL_PRICE_TOKENS: readonly string[];
199
+ /** A total or an amount of a price is a sum of prices, which adds up. */
200
+ export declare const LEVEL_SUM_TOKENS: readonly string[];
201
+ export declare const LEVEL_LEVEL_TOKENS: readonly string[];
202
+ export declare const LEVEL_DAY_TOKENS: readonly string[];
203
+ /** Beside a day word, these make it a per-case duration rather than a count of days. */
204
+ export declare const LEVEL_PER_CASE_DAY_TOKENS: readonly string[];
205
+ /** Does this column NAME read as a level that is not summed - a price, a stock's
206
+ * open/high/low/close, a temperature, a life expectancy, a level or a per-case duration in days?
207
+ * Name only: no data, no culture. */
208
+ export declare function nameLooksLevelNotSum(name: string | null | undefined): boolean;
195
209
  /**
196
210
  * ONE verdict per column, both axes, from every signal in priority order.
197
211
  *
@@ -8,7 +8,7 @@ export { measureSeriesCompleteness, pickSeriesColumn, seriesKeyVerdict, SERIES_C
8
8
  export type { SeriesCompleteness, SeriesCoverage, SeriesKeyCandidate, SeriesKeyVerdict, } from "./seriesCompleteness";
9
9
  export { measurePersistence } from "./measurePersistence";
10
10
  export type { MeasurePersistence } from "./measurePersistence";
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";
11
+ export { classifyForAggregation, allowedAggregations, defaultAggregation, isAggregationAllowed, shareOfTotalIsHonest, nameLooksIntensiveRate, nameLooksPositional, nameLooksLevelNotSum, 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
14
  export type { LLMRequestModifier, SimpleColumn, VegaRendererPayload, LLMClientHints, LLMDirectionOfGood, LLMRequestCode, LLMQualifyResult, LLMRequestCodeResult, LLMResultNotice, GetLicenseStatusResult, ShareAskWire, ShareTargetWire, } from "./models";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/shape-core",
3
- "version": "0.6.138",
3
+ "version": "0.6.140",
4
4
  "description": "Host-agnostic data-shape profiler: ingest a dataset's rows through IValueCollection.addRow and read back the measured shape as an LLMColumnWithValue[] payload — types, cardinality, temporal/ordinal detection, geographic region and point resolution, cross-column signals. MEASUREMENT only: the policy that decides what a measured shape means for chart selection lives server-side.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -1,2 +0,0 @@
1
- /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
- import{a as Se}from"./chunk-U3H6UBOO.mjs";import{a as wt,f as te,g as _e,h as oe,i as Ae,j as ie}from"./chunk-DEDI5YYD.mjs";import{b as St,c as _t,d as At,e as Ct,f as xt}from"./chunk-2RTTKMKE.mjs";import{c as ht,l as yt,n as ye,p as bt,s as se,w as be,x as Oe,y as Pe,z as Le}from"./chunk-S7AJDE7I.mjs";import{e as mt,k as pe,m as De,n as pt,o as he}from"./chunk-ZATHQUWM.mjs";import{b as ft,d as gt}from"./chunk-5HI6TVMM.mjs";import{A as ge,B as ct,E as dt,a as re,b as ee,c as et,d as me,g as tt,h as nt,j as rt,l as it,m as st,o as ot,p as fe,q as at,r as lt,u as ke,w as ut}from"./chunk-BLMRLXQJ.mjs";import{c as Je,f as Ee}from"./chunk-F6UNSFU6.mjs";var yn=85,bn=60,Sn=/(^|[^a-z])(state|province|provincia|provinz|region|regione|regiao|county|department|departement|departamento|prefecture|oblast|canton|kanton|bundesland|land|territory)([^a-z]|$)/i,Fe=t=>Math.round(t*10)/10,Ce=t=>t.split("-")[0];function Mt(t){let e=new Map,n=0;if(t.forEach((s,a)=>{let l=ye(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:Fe(100*r/n)}}function Ni(t){let e=t.province===null||t.province===void 0?"":String(t.province).trim();if(e)return Tt(e,t.provinceKind,t.country);if(!se())return null;let n=t.city===null||t.city===void 0?"":String(t.city).trim();if(!n)return null;let i=be(n,{country:t.country===null||t.country===void 0?null:String(t.country)});return i.status==="resolved"?i.provinceId:null}function Tt(t,e,n){if(e==="us-state-code"||e==="us-state-name"){let s=xt(t,e);return s?"US-"+s:null}if(!se())return null;if(e==="admin1-code")return Le(t)?t.toUpperCase():null;let i=n==null?null:String(n),r=new Set(Oe(t,i).map(Pe).filter(s=>!!s));return r.size===1?[...r][0]:null}function Ei(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=[],u=0,c=0,f=0,m=C=>{let S=C.toLowerCase();s.has(S)||(s.add(S),a.push(C))},h=C=>C==null||C===""?null:Number(C),w=new Map;return t.forEach((C,S)=>{i[S]=null,r[S]=null;let g=C.country===null||C.country===void 0||String(C.country).trim()===""?null:String(C.country).trim(),y=C.province===null||C.province===void 0?"":String(C.province).trim();if(y){let x=Tt(y,e.provinceKind,g);x?(i[S]=x,r[S]="province",u++):m(y);return}if(!n)return;let A=h(C.lat),p=h(C.lon),_=!1;if(e.locate&&A!==null&&p!==null&&isFinite(A)&&isFinite(p)){_=!0;let x=e.locate(A,p);if(x){i[S]=x,r[S]="coordinates",u++;return}}let b=C.city===null||C.city===void 0?"":String(C.city).trim();if(b&&se()){let x=b.toLowerCase()+""+(g??""),M=w.get(x);if(M||(M=be(b,{country:g}),w.set(x,M)),M.status==="resolved"&&M.provinceId){i[S]=M.provinceId,r[S]="city",u++;return}if(M.status==="ambiguous"){c++,l.has(x)||(l.add(x),o.length<8&&o.push(b));return}m(b);return}_&&f++}),{iso:i,source:r,unmatched:a,matchedRows:u,totalRows:t.length,ambiguousRows:c,ambiguousExamples:o,unplacedPoints:f}}function vt(t,e,n={}){let i=new Map;if(!se()||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 h of e){let w=s(h[l]);if(!w)continue;let C=r>=0&&s(h[r])||null,S=w+""+(C??""),g=o.get(S);g?g.rows++:o.set(S,{city:w,country:C,rows:1})}if(o.size===0)return null;let u=0,c=0,f=new Set,m=new Map;return o.forEach(h=>{let w=be(h.city,{country:h.country});w.status!=="unmatched"&&c++,!(w.status!=="resolved"||!w.provinceId)&&(u++,f.add(w.provinceId),m.set(w.cc,(m.get(w.cc)||0)+h.rows))}),{signals:{rollupPct:Fe(100*u/o.size),regionCount:f.size,countryCount:m.size,...Mt(m)},cityPct:100*c/o.size,distinct:o.size}};return t.forEach((l,o)=>{if(l.isMeasure||o===r)return;let u=l.geoKind||"";if(u.startsWith("city")){if(n.cities===!1)return;let x=a(o);x&&i.set(o,x.signals);return}if(u)return;let c=new Map,f=new Map;for(let x of e){let M=s(x[o]);M&&(c.set(M,(c.get(M)||0)+1),f.has(M)||f.set(M,r>=0&&s(x[r])||null))}if(c.size<3)return;let m=0,h=0,w=0,C=new Set,S=new Map;c.forEach((x,M)=>{if(Le(M)){m++;let z=M.toUpperCase();C.add(z),S.set(Ce(z),(S.get(Ce(z))||0)+x);return}let W=new Set(Oe(M,f.get(M)).map(Pe).filter(z=>!!z));if(W.size===1){h++;let z=[...W][0];C.add(z),S.set(Ce(z),(S.get(Ce(z))||0)+x)}else W.size>1&&w++});let y=Sn.test(l.name.replace(/[_-]+/g," "))?bn:yn,A=100*m/c.size,p=100*h/c.size,_=A>=p,b=_?A:p;if(b<y){if(n.cities===!1)return;let x=a(o);if(!x||x.cityPct<ht||x.distinct<At&&!_t(l.name,St))return;i.set(o,x.signals);return}i.set(o,{kind:_?"admin1-code":"admin1-name",matchPct:Fe(b),ambiguous:!_&&w/c.size>.15?!0:void 0,regionCount:C.size,countryCount:S.size,...Mt(S)})}),i}function $e(t){let e=(t||"").toLowerCase();return e==="en-us"||e==="en"||e.startsWith("en-us-")||e==="en-ph"||e==="en-bz"}var ze={a:0,b:0,c:0,yearFirst:!1,sep:"",trail:"",word:"",day:0,year:0,namedOrder:"dmy",cjkPattern:""},_n=/\s+(\d{1,2}):(\d{2})(?::(\d{2})(?:[.,]\d{1,9})?)?(?:\s*([ap])\.?\s?m\.?)?$/i,An=/^(\d{1,4})(\s*[./-]\s*)(\d{1,2})(\s*[./-]\s*)(\d{1,4})(\.?)$/,Cn=/^(\d{4})(\s*[年년]\s*)(\d{1,2})(\s*[月월]\s*)(\d{1,2})(\s*[日일号])$/,xn=/(\d)(?:st|nd|rd|th|er|º|ª)(?=[\s.,/-]|$)/gi,wn=new Set(["de","del","of"]),Mn=new Set(["\u0433","\u0440","r"]),Tn=/^[\p{L}\p{M}\u0970\u05f3]+$/u,We=/^\d+$/;function vn(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 Rt(t){let e=t.replace(/[\u200e\u200f\u061c]/g,"").replace(/\s+/g," ").trim();if(e==="")return null;e=wt(e);let n=null,i=_n.exec(e);if(i){if(n=vn(i),!n)return null;e=e.slice(0,i.index)}let r;if(r=Cn.exec(e)){let m=`cjk|${r[2]}|${r[4]}|${r[6]}`;return{...ze,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=An.exec(e)){let m=r[2],h=r[4];if(m!==h)return null;let w=m.trim(),C=r[6];if(C&&w!==".")return null;let S=[r[1].length,r[3].length,r[5].length],g=S[0]===4,y=S[2]===4;return g===y||(g?S[1]>2||S[2]>2:S[0]>2||S[1]>2)?null:g&&w==="-"&&m==="-"&&S[1]===2&&S[2]===2?"iso":g&&w==="."&&m==="."&&!C&&!(S[1]===2&&S[2]===2)?null:{...ze,form:"numeric",key:`num|${g?"y":"x"}|${m}|${C}`,clock:n,a:+r[1],b:+r[3],c:+r[5],yearFirst:g,sep:m,trail:C}}let s=e.replace(xn,"$1").split(/[\s.,/-]+/).filter(m=>m!==""&&!wn.has(m.toLowerCase()));if(s.length===4&&We.test(s[2])&&Mn.has(s[3].toLowerCase())&&s.pop(),s.length!==3)return null;let a=s.map(m=>We.test(m)?"N":Tn.test(m)?"W":"?").join(""),l=s.map(m=>We.test(m)?m:""),o=0,u=0,c="",f;if(a==="NWN"&&l[0].length<=2&&l[2].length===4)o=+l[0],c=s[1],u=+l[2],f="dmy";else if(a==="WNN"&&l[1].length<=2&&l[2].length===4)c=s[0],o=+l[1],u=+l[2],f="mdy";else if(a==="NWN"&&l[0].length===4&&l[2].length<=2)u=+l[0],c=s[1],o=+l[2],f="ymd";else return null;return{...ze,form:"named",key:`named|${f}`,clock:n,day:o,year:u,word:c,namedOrder:f}}var Rn=[31,28,31,30,31,30,31,31,30,31,30,31],In=t=>t%4===0&&t%100!==0||t%400===0;function It(t,e,n){return t>=1&&t<=9999&&e>=1&&e<=12&&n>=1?n<=(e===2&&In(t)?29:Rn[e-1]):!1}function Nn(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 Nt(t,e={}){let n=(e.floor??1)>=1,i=new Map,r=new Map,s=0,a=null;for(let g of t){if(g==null)continue;if(typeof g!="string"){if(n)return null;s++;continue}let y=g.trim();if(y==="")continue;s++;let A=i.get(y);if(A===void 0&&(A=Rt(y),i.set(y,A)),A===null||A==="iso"){if(n)return null;continue}if(n){if(a===null)a=A;else if(A.key!==a.key)return null}else r.set(A.key,(r.get(A.key)??0)+1)}if(!n){let g=0,y="";for(let[A,p]of r)p>g&&(g=p,y=A);if(g===0||g/s<e.floor)return null;a=[...i.values()].find(A=>A!==null&&A!=="iso"&&A.key===y)??null}if(a===null)return null;let l=a.key,o=[...i.values()].filter(g=>g!==null&&g!=="iso"&&g.key===l),u,c="shape",f=null;if(a.form==="named"){if(u=a.namedOrder,f=Ae(o.map(g=>g.word),e.locale),!f)return null}else if(a.form==="cjk"||a.yearFirst)u="ymd";else{let g=0,y=0;for(let A of o)A.a>12&&g++,A.b>12&&y++;if(g>0&&y>0)return null;g>0?(u="dmy",c="values"):y>0?(u="mdy",c="values"):a.sep.trim()==="."?(u="dmy",c="shape"):(u=$e(e.locale)?"mdy":"dmy",c="locale")}let m=g=>{if(g.form==="named"){let y=f.get(te(g.word));return y===void 0?null:[g.year,y+1,g.day]}return g.yearFirst?[g.a,g.b,g.c]:u==="dmy"?[g.c,g.b,g.a]:[g.c,g.a,g.b]},h=1/0,w=-1/0,C=0;for(let g of o){let y=m(g);if(!y||!It(y[0],y[1],y[2])){if(n)return null;C++;continue}h=Math.min(h,y[0]),w=Math.max(w,y[0])}if(!n&&(r.get(l)-C)/s<e.floor||h>=2400&&w<=2699||h>=1300&&w<=1500)return null;let S={form:a.form,order:u,orderFrom:c,hasTime:o.some(g=>g.clock!==null),read(g){if(typeof g!="string")return null;let y=g.trim();if(y==="")return null;let A=i.get(y);if(A===void 0&&(A=Rt(y),i.set(y,A)),A===null||A==="iso"||A.key!==l)return null;let p=m(A);return!p||!It(p[0],p[1],p[2])?null:Nn(p[0],p[1],p[2],A.clock)}};if(a.form!=="named"&&!o.some(g=>g.clock?.meridiem)){let g;a.form==="cjk"?g=a.cjkPattern:a.yearFirst?g=`%Y${a.sep}%m${a.sep}%d${a.trail}`:g=(u==="dmy"?`%d${a.sep}%m${a.sep}%Y`:`%m${a.sep}%d${a.sep}%Y`)+a.trail;let y=o.filter(A=>A.clock!==null).length;y===0?S.pattern=g:y===o.length&&(S.pattern=g+(o.every(A=>A.clock.seconds)?" %H:%M:%S":" %H:%M"))}return S}import ln from"papaparse";var En={es:["latitud"],pt:["latitude"],fr:["latitude"],it:["latitudine"],nl:["breedtegraad"],de:["breitengrad"]},kn={es:["longitud"],pt:["longitude"],fr:["longitude"],it:["longitudine"],nl:["lengtegraad"],de:["l\xE4ngengrad"]},Be=t=>re(t.normalize("NFC")).toLowerCase(),Dn=new Set(Object.values(En).flatMap(t=>(t??[]).map(Be))),On=new Set(Object.values(kn).flatMap(t=>(t??[]).map(Be)));function Et(t){let e=!1,n=!1;for(let i of t){let r=Be(i);Dn.has(r)?e=!0:On.has(r)&&(n=!0)}return e===n?null:e?"lat":"lon"}var Pn=["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"],Ln=["pct","percent","percentage","rate","ratio","rating","share","score","index","nps","csat","margin","yield","coverage","utilization","utilisation","gpa","percentile","quantile","bmi","density","pressure","humidity","velocity","efficiency","occupancy","latency","throughput","bandwidth","iops","ppm","ppb","dpmo","bps"],Fn=["latitude","longitude"],zn=["latitude","longitude"];function Q(t){return re(t)}var Ot=["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"],Wn=["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"],$n=["osszege","sucet","\u7684\u603B\u548C","\u7684\u8BA1\u6570","\u306E\u5408\u8A08","\uC758 \uD569\uACC4"],Bn=["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 Ge(t){return[...t].sort((e,n)=>n.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")}var Pt=new RegExp("^\\s*(?:(?:sum|count|count\\s+distinct|distinct\\s+count)\\s+of\\s+|(?:"+Ge(Ot)+")\\s+)","i");function kt(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 Gn="[\u2013\u2014-]";function Lt(t){let e=t.filter(r=>!kt(r)),n=t.filter(kt),i=[];return e.length&&i.push("(?:\\s+|\\s*"+Gn+"\\s*)("+Ge(e)+")"),n.length&&i.push("\\s*("+Ge(n)+")"),new RegExp("(?:"+i.join("|")+")\\s*$","i")}var Ve=Lt($n),Vn=Lt(Bn);function we(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 Ft(t){let e=Q(String(t??"").trim().toLowerCase());if(!e)return null;for(let r of Wn)if(e.startsWith(r+" "))return xe[r]??"avg";for(let r of Ot)if(e.startsWith(r+" ")||e===r)return xe[r]??"sum";let n=we(e,Vn);if(n)return xe[n.label]??"avg";let i=we(e,Ve);return i?xe[i.label]??"sum":null}var Kn=/(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])/g,Un=new RegExp("\\b("+Pn.join("|")+")\\b|("+Ln.join("|")+")$","i"),Hn=new RegExp("\\b("+Fn.join("|")+")\\b|("+zn.join("|")+")$","i");function Te(t){if(!t)return"";let e=String(t),n=Q(e),i=Pt.exec(n);if(i)return e.slice(i[0].length).trim();let r=we(n,Ve);return(r?e.slice(0,r.base.length):e).trim()}function Yn(t){if(!t)return!1;let e=Q(String(t));return Pt.test(e)||we(e,Ve)!==null}var jn=["count (distinct)","count distinct","distinct count","standard deviation","average","variance","median","product","stddev","std dev","count","sum","avg","min","minimum","max","maximum","var"],Dt=new RegExp("^\\s*("+[...jn].sort((t,e)=>e.length-t.length).map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s+")).join("|")+")\\s+of\\s+","i");function Ke(t){if(t==null)return"";let e=String(t),n=Dt.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=Dt.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 zt(t){let e=t.map(r=>String(r??"")),n=new Set(e),i=new Set;for(let r=0;r<e.length;r++){if(!i.has(e[r])){i.add(e[r]);continue}let s=2;for(;n.has(`${e[r]} (${s})`);)s++;e[r]=`${e[r]} (${s})`,n.add(e[r]),i.add(e[r])}return e}function Ue(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 Me={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 "]},Wt=new RegExp("^("+Object.keys(Me).join("|")+")\\((.+)\\)$");function $t(t){if(!t)return[];let e=Wt.exec(String(t).trim());if(!e)return[];let n=Me[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 Bt(t,e,n){let i=Wt.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(Me[r]),a=String(e??""),l=i[2];for(let o=l.indexOf(".");o>=0;o=l.indexOf(".",o+1)){if(o===0)continue;let u=l.slice(o+1);if(u.trim()!==""){for(let c of Object.values(Me))for(let f of c)if(!s.has(f)&&a===f+u)return!0}}return!1}function Xn(t){let e=Te(t);return e.length===0?"":e.replace(Kn," ")}function Gt(t,e){if(!e)return!1;let n=Te(e);return t.test(Q(Xn(e)))||t.test(Q(n))||t.test(Q(ee(n).join(" ")))}function Vt(t){return Gt(Hn,t)}function qn(t){return Gt(Un,t)||Vt(t)}var Kt=/int|double|decimal|single|float|number|currency|money/i;function Zn(t){let e=String(t?.valueNature??"").trim().toLowerCase();return e==="categorical"?"Categorical":e==="ordinal"?"Ordinal":e==="continuous"||t?.isMeasure===!0||Kt.test(String(t?.dataType??""))?"Continuous":"Categorical"}function Qn(t){return t?.isMeasure===!0||Kt.test(String(t?.dataType??""))}function Ut(t){let e=t??{},n=Zn(e);if(n!=="Continuous")return{nature:n,additivity:"unknown",basis:"role",suppressed:!1};if(Vt(e.name))return{nature:n,additivity:"positional",basis:"name",suppressed:!0};let i=String(e.additivity??"").trim().toLowerCase();if(!(i==="additive"&&Yn(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}:qn(e.name)?{nature:n,additivity:"intensive_rate",basis:"name",suppressed:!1}:{nature:n,additivity:"additive",basis:"default",suppressed:!1}}function Ht(t){let e=Ut(t),n=t??{};if(e.nature==="Categorical")return["first","distinctcount","count"];if(e.nature==="Ordinal")return Qn(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 $i(t){return Ht(t)[0]}function Bi(t,e){return Ht(t).indexOf(e)>=0}function Gi(t,e){if(e!=="sum"&&e!=="count")return!1;if(e==="count")return!0;let n=Ut(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"]},er=["fr","es","pt","it","pl","cs","sk","hr","ru","uk","el","ar","he","id","vi","th"],tr=["num\xE9ro"],nr=t=>t.normalize("NFC").toLowerCase();function rr(t,e,n,i){let r=Ee(n);return!r||!t?null:t===e?"word":r.wordBreaks===!1?Array.from(e).length<st?null:(i?t.startsWith(e):t.endsWith(e))&&t.length>e.length?"suffix":null:i?rt(t,n).includes(e)?"word":null:r.script==="Hang"?it(t,e)?"suffix":null:r.compounds&&nt(t,e,tt)?"suffix":null}function Yt(t){let e=String(t??"").trim();if(!e)return null;let n=me(e),i=me(Te(e));for(let[r,s]of Object.entries(Jn)){let a=er.includes(r),l=a?i:n;for(let o of s){let u=tr.includes(o)||!!Ee(r)?.foldSensitive,c=u?l.words:l.folded;if(c.length===0)continue;let f=u?nr(o):me(o).folded.join(" "),m=rr(a?c[0]:c[c.length-1],f,r,a);if(m)return{lang:r,word:o,view:m}}}return null}var ir=[["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 ve(t){for(let[e,n]of ir)if(n.test(t))return e;return null}var sr=[{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]]}],Re=new Map;function jt(t,e,n,i){let r=Re.get(t);if(r)return r;let s=[];for(let[a,l]of e)for(let o=a;o<=l;o++){let u=String.fromCodePoint(o);ve(u)===n&&(i&&!i.test(u)||s.push(u))}return Re.set(t,s),s}function or(t){let n=t.codePointAt(0);for(let a=0;a<9&&ve(String.fromCodePoint(n-1))==="Nd";a++)n--;let i="nd:"+n.toString(16),r=Re.get(i);if(r)return r;let s=[];for(let a=n;a<n+10;a++){let l=String.fromCodePoint(a);ve(l)==="Nd"&&s.push(l)}return Re.set(i,s),s}function ar(t,e){if(e==="Nd")return or(t);for(let r of sr)if(r.test.test(t))return jt(r.id+":"+e,r.ranges,e,r.id==="ascii"?null:r.test);let i=t.codePointAt(0)&-128;return jt("block:"+i.toString(16)+":"+e,[[i,i+127]],e,null)}function lr(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 ur=/^[\p{L}\p{M}\p{Nd}]$/u,Xt=/^[\p{L}\p{Nd}]$/u;function qt(t,e){if(!t)return t??"";let n=new Set(Array.from(t)),i=c=>{let f=ve(c);return!f||!ur.test(c)?c:lr(ar(c,f),n,c,e)},r=c=>{let f=[];for(let m of c)f.push(i(m)),Xt.test(m)&&e()<.2&&f.push(i(m));if(f.length>6){let m=Math.floor(e()*Math.min(3,f.length-6));for(let h=0;h<m;h++)for(let w=0;w<5;w++){let C=Math.floor(e()*f.length);if(Xt.test(f[C])){f.splice(C,1);break}}}return f.join("")};if(!(t.includes("@")&&t.includes(".")))return r(t);let[a,l=""]=t.split("@"),o=l.endsWith(".com"),u=o?l.slice(0,-4):l;return`${r(a)}@${r(u)}${o?".com":""}`}var cr=/^[A-Za-z_$][A-Za-z0-9_$]*$/,dr=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),mr=new RegExp([String.raw`\bisMeasure\b`,String.raw`\bdataType\b`,String.raw`\bcolumns\s*\[\s*-?\d`,String.raw`\.iloc\s*\[[^\]]*,`,String.raw`\.iat\s*\[`,String.raw`\bselect_dtypes\b`,String.raw`\b_get_numeric_data\b`,String.raw`\bis_numeric_dtype\b`,String.raw`\bfor\s+\w+\s+in\s+(?:list\s*\(\s*)?df\.columns\b`,String.raw`\bdf\.columns\s*\.\s*(?:tolist|to_list|difference|drop)\b`,String.raw`\bdf\.dtypes\b`,String.raw`\bObject\s*\.\s*(?:keys|values|entries)\s*\(\s*(?:rows|data|df)?\s*\[\s*0\s*\]`,String.raw`\b(?:row|rw|r)\s*\[\s*\d+\s*\]`].join("|"));function ae(t,e){if(!t||!e)return!1;let n=dr(e);return new RegExp("['\"`]"+n+"['\"`]").test(t)?!0:cr.test(e)&&new RegExp("\\."+n+"(?![A-Za-z0-9_$])").test(t)}function fr(t){return!!t&&mr.test(t)}function Xi(t,e,n){return t?fr(t)?[...e]:[...n,...e].some(i=>ae(t,i))?e.filter(i=>ae(t,i)):[...e]:[]}var gr=5,pr=6,hr=3,ne=864e5,yr=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,br=/^(\d{4})[-/](\d{1,2})$/,Sr=/^(\d{4})[-\s]?Q([1-4])$/i,_r=/^Q([1-4])[-\s](\d{4})$/i,Ar=/^(\d{4})$/,Cr=/^(\d{4})(0[1-9]|1[0-2])$/,xr=/^(\d{4})(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])$/,wr=/^(\D+?)[\s\-/.,']*((?:19|20)\d{2})$/u,Mr=/^((?:19|20)\d{2})[\s\-/.,']+(\D+)$/u;function He(t,e,n){let i=te(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=_e(a)[i];if(l!==void 0)return l+1}let r=n?.get(i);if(r!==void 0)return r+1;let s=oe(t);if(s.length>0){if(s.every(o=>o.month===s[0].month))return s[0].month+1;let a=Je(String(e??"").split(/[-_]/)[0])?.code,l=s.find(o=>o.lang===a);if(l)return l.month+1}return 0}function Tr(t){let e=pe(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:j(n.year,(n.n-1)*3+1,1)}function j(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 vr(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,u)=>{let c=+r[u+1];o==="Y"?s=c:o==="m"?a=c:l=c}),s?j(s,a,l):null}function X(t,e,n,i){let r=(t??"").trim();if(r==="")return null;if(e){let o=vr(r,e);return o||null}let s=yr.exec(r);if(s)return j(+s[1],+s[2],+s[3],+(s[4]??0),+(s[5]??0),+(s[6]??0));if(s=Sr.exec(r),s)return j(+s[1],(+s[2]-1)*3+1,1);if(s=_r.exec(r),s)return j(+s[2],(+s[1]-1)*3+1,1);if(s=br.exec(r),s&&+s[2]>=1&&+s[2]<=12)return j(+s[1],+s[2],1);if(s=xr.exec(r),s)return j(+s[1],+s[2],+s[3]);if(s=Cr.exec(r),s)return j(+s[1],+s[2],1);if(s=Ar.exec(r),s){let o=+s[1];return o>=1900&&o<=2100?j(o,1,1):null}let a=Tr(r);if(a)return a;if(s=wr.exec(r),s){let o=He(s[1],n,i);if(o)return j(+s[2],o,1)}if(s=Mr.exec(r),s){let o=He(s[2],n,i);if(o)return j(+s[1],o,1)}let l=ie(r);if(l){let o="month"in l?l.month:He(l.word,n,i);if(o)return j(l.year,o,1)}return null}function Zt(t){let e=new Date(t).getUTCDay();return e>=1&&e<=5}function Qt(t,e){if(e<=t)return 0;let n=Math.round((e-t)/ne),i=Math.floor(n/7),r=i*5,s=t+i*7*ne;for(;s<e;)Zt(s)&&r++,s+=ne;return r}function Rr(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 Ir(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 le(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*ne));case"weekday":return Qt(t.ms,e.ms);case"day":return Math.round((e.ms-t.ms)/ne);default:return i>0?Math.round((e.ms-t.ms)/i):0}}function Jt(t,e){return Ye(t,e)?.cadence??null}function Ye(t,e){let n=e?.gapFactor??gr,i=0,r=0,s=new Map,a=Array.from(t),l;if(!e?.pattern){let p=[];for(let _ of a){if(_==null||_==="")continue;let b=ie(String(_));b&&"word"in b&&p.push(b.word)}p.length>0&&(l=Ae(p,e?.locale)??void 0)}for(let p of a){if(p==null||p==="")continue;i++;let _=X(String(p),e?.pattern,e?.locale,l);_&&(r++,s.set(_.ms,_))}let o=[...s.values()].sort((p,_)=>p.ms-_.ms);if(o.length<hr||i>0&&r/i<.8)return null;let u=o[o.length-1].ms-o[0].ms;if(u<=0)return null;let c=[];for(let p=1;p<o.length;p++)c.push(o[p].ms-o[p-1].ms);let f=Rr(c);if(!(f>0))return null;let m=Ir(f/ne);m==="day"&&u>=7*ne&&o.every(p=>Zt(p.ms))&&Qt(o[0].ms,o[o.length-1].ms)+1>o.length*.5&&(m="weekday");let h=m==="irregular"?o.length:le(o[0],o[o.length-1],m,f)+1,w=1,C=1,S=[],g=o[0],y=1;for(let p=1;p<o.length;p++){let _=le(o[p-1],o[p],m,f);_>w&&(w=_),m!=="irregular"&&_>n?(C++,S.push({from:g.iso,to:o[p-1].iso,points:y}),g=o[p],y=1):y++}S.push({from:g.iso,to:o[o.length-1].iso,points:y});let A={grain:m,points:o.length,expectedPoints:Math.max(h,o.length),coveragePct:Math.round(o.length/Math.max(h,o.length)*1e3)/10,runs:C,largestGapUnits:w,gapFactor:n};return e?.includeBounds&&S.length<=pr&&(A.runBounds=S),{cadence:A,points:o,stepMs:f}}var Nr=8,Er=.5,kr=200,Dr=new Set(["category","categories","subcategory","type","types","kind","class","classes","classification","segment","segments","tier","status","priority","severity","grade","level","band","bucket","group","channel","method","mode","stage","phase","period","shift","gender","sex","result","outcome","reason","flag","genre","sector","source"]),Or=["category","classification","segment","status","priority","severity","channel"],Pr=new Set(["UUID","EMAIL_LIKE","URL_LIKE","PHONE_LIKE","NUMERIC_ID","HEX_ID","OPAQUE_ID_ALPHANUMERIC","DATE_STR","BOOLEAN"]);function Lr(t){let e=ee(t);if(e.length===0)return!1;let n=e[e.length-1];return Dr.has(n)?!0:Or.some(i=>n.length>i.length&&n.endsWith(i))}function Fr(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>kr?"cardinality":t.rows>0&&e.length>=t.rows?"row-identity":t.isBinaryFlag?"flag":he(e,t.locale)!==null?"ordinal":t.identifierNamed||t.dataType==="String"&&Pr.has(Se(e))?"identifier":!t.geoKind&&Lr(t.name)?"attribute":"entity"}function nn(t){let e=-1,n=1/0,i=!1;return t.forEach((r,s)=>{if(Fr(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 en=t=>t<10?"0"+t:String(t);function tn(t,e){switch(e){case"year":return`${t.y}-01-01`;case"quarter":return`${t.y}-${en(Math.floor((t.m-1)/3)*3+1)}-01`;case"month":return`${t.y}-${en(t.m)}-01`;case"hour":return new Date(t.ms).toISOString().replace(/\.\d{3}Z$/,"Z");default:return t.iso}}function rn(t){let{periods:e,series:n}=t,i=Math.min(e.length,n.length),r=new Set;for(let _=0;_<i;_++)e[_]&&r.add(e[_]);let s=Ye(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=le(l,s.points[s.points.length-1],a,s.stepMs)+1;if(o!==s.cadence.expectedPoints)return null;let u=new Map;for(let _ of r){let b=X(_,t.pattern,t.locale);if(!b)continue;let x=le(l,b,a,s.stepMs);x>=0&&x<o&&u.set(_,{idx:x,stamp:b})}let c=new Map;for(let _=0;_<i;_++){let b=n[_];if(!b)continue;let x=u.get(e[_]);if(!x)continue;let M=c.get(b);M||(M={seen:new Set,lo:x.idx,hi:x.idx,loStamp:x.stamp,hiStamp:x.stamp,order:c.size},c.set(b,M)),M.seen.add(x.idx),x.idx<M.lo&&(M.lo=x.idx,M.loStamp=x.stamp),x.idx>M.hi&&(M.hi=x.idx,M.hiStamp=x.stamp)}if(c.size<2)return null;let f=0;for(let _ of c.values())f+=_.seen.size;if(f/(c.size*o)<(t.minFill??Er))return null;let m=[],h=new Set,w=0,C=0,S=0,g=0,y=0,A=1;for(let[_,b]of c){for(let z of b.seen)h.add(z);if(b.seen.size>=o)continue;let x=[...b.seen].sort((z,q)=>z-q),M=1;for(let z=1;z<x.length;z++)M=Math.max(M,x[z]-x[z-1]);let W={key:_,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};m.push(W),W.before>0&&w++,W.after>0&&C++,W.interior>0&&S++,g=Math.max(g,W.before),y=Math.max(y,W.after),A=Math.max(A,M)}if(m.length===0)return null;m.sort((_,b)=>_.coverage-b.coverage||_.acc.order-b.acc.order);let p=m.slice(0,t.maxListed??Nr);return{seriesColumn:t.seriesColumn,grain:a,periods:o,seriesCount:c.size,incompleteSeries:m.length,lateStarts:w,earlyEnds:C,withHoles:S,columnWideMissing:o-h.size,maxMissingBefore:g,maxMissingAfter:y,largestGap:A,series:p.map(_=>{let b={};return t.includeNames&&(b.name=_.key),t.includeDates&&(b.first=tn(_.acc.loStamp,a),b.last=tn(_.acc.hiStamp,a)),b.missingBefore=_.before,b.missingAfter=_.after,b.missingInterior=_.interior,b.largestGap=_.gap,b.coverage=Math.round(_.coverage*1e3)/1e3,b}),more:m.length-p.length}}var Ie=6;function ue(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 zr(t){let e=t.length;if(e<Ie)return null;let n=t[0],i=t[0],r=0;for(let p of t)p<n&&(n=p),p>i&&(i=p),r+=p;if(n===i)return null;let s=ue(t.map(Math.abs));if(s===0)return null;let a=[];for(let p=1;p<e;p++)a.push(t[p]-t[p-1]);let l=ue(a.map(Math.abs))/s,o=(e-1)/2,u=r/e,c=0,f=0,m=0;for(let p=0;p<e;p++)c+=(p-o)*(t[p]-u),f+=(p-o)*(p-o),m+=(t[p]-u)*(t[p]-u);m/=e;let h=c/f,w=u-h*o,C=t.map((p,_)=>p-(w+h*_)),S=C.reduce((p,_)=>p+_,0)/e,g=0,y=0;for(let p=0;p<e;p++)g+=(C[p]-S)*(C[p]-S),p>0&&(y+=(C[p]-C[p-1])*(C[p]-C[p-1]));return g/=e,y/=e-1,{vnDetrended:g<=m*1e-12?2:y/g,relStep:l}}function je(t){let{stamps:e,series:n,values:i}=t,r=Math.min(e.length,i.length),s=new Map;for(let u=0;u<r;u++){let c=e[u],f=i[u];if(c===null||f===null||!Number.isFinite(f))continue;let m="";if(n&&(m=n[u]??"",m===""))continue;let h=s.get(m);h||s.set(m,h=new Map),h.set(c,(h.get(c)??0)+f)}let a=[],l=[],o=[];for(let u of s.values()){let c=[...u.entries()].sort((m,h)=>m[0]-h[0]).map(m=>m[1]),f=zr(c);f&&(a.push(f.vnDetrended),l.push(f.relStep),o.push(c.length))}return a.length===0?null:{series:a.length,points:Math.round(ue(o)),vnDetrended:Math.round(ue(a)*1e3)/1e3,relStep:Math.round(ue(l)*1e4)/1e4}}function as(t){let e=t.times.map(n=>X(n,t.pattern,t.locale)?.ms??null);return je({stamps:e,series:t.series,values:t.values})}var Wr=5e5,$r=8,Br=4,Gr=5,Xe=1,qe=2,Vr=4,Kr=8;function Ur(t,e,n){let[i,r]=[...t];if(e.isTemporal){let s=X(i,e.temporalTextPattern,n),a=X(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 Hr(t,e,n){let{rows:i,text:r,locale:s}=t,a=Ur(n.values,n,s),l=new Uint8Array(i.length),o=0;for(let u=0;u<i.length;u++){let c=r(i[u][e]);c===a.a?l[u]=1:c===a.b?l[u]=2:o++}return{code:l,blankRows:o,setOrder:a.setOrder}}function Yr(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 jr(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&Xe&&r.keysA++,a&qe&&r.keysB++,(a&(Xe|qe))===(Xe|qe)&&r.keysBoth++,a&Vr&&r.dupA++,a&Kr&&r.dupB++}return r}function Xr(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 sn=t=>t==null||typeof t=="string"&&t.trim()==="";function qr(t,e,n){if(t===e)return!0;let i=sn(t),r=sn(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 on(t){let{rows:e,columns:n}=t,i=e.length;if(i<2||i>Wr)return null;let r=n.map((b,x)=>({c:b,i:x})).filter(({c:b})=>!b.isMeasure&&!b.isTemporal&&!b.isDatePart&&b.distinct>=Gr).sort((b,x)=>(x.c.identifierNamed?1:0)-(b.c.identifierNamed?1:0)||x.c.distinct-b.c.distinct||b.i-x.i).slice(0,$r),s=n.map((b,x)=>({c:b,i:x})).filter(({c:b})=>!b.isMeasure&&b.values!==null&&b.values.size===2).slice(0,Br);if(r.length===0||s.length===0)return null;let a=s.map(({c:b,i:x})=>Hr(t,x,b)),l=null;for(let{i:b}of r){let x=Yr(t,b);for(let M=0;M<s.length;M++){if(s[M].i===b)continue;let W=jr(x.ids,a[M].code,x.dict.size);W.keysBoth<1||(!l||Xr(W,l.tally))&&(l={tally:W,keyIdx:b,setNo:M,ids:x.ids,dict:x.dict})}}if(!l)return null;let{ids:o,dict:u,tally:c}=l,f=a[l.setNo],m=s[l.setNo].i,h=u.size,w=new Int32Array(h).fill(-1),C=new Int32Array(h).fill(-1);for(let b=0;b<i;b++){let x=f.code[b],M=o[b];x===0||M<0||(x===1?w[M]<0&&(w[M]=b):C[M]<0&&(C[M]=b))}let S=[];for(let b=0;b<n.length;b++)b!==l.keyIdx&&b!==m&&S.push(b);let g=0;for(let b=0;b<h;b++){let x=w[b],M=C[b];if(x<0||M<0)continue;let W=e[x],z=e[M],q=!0;for(let J of S)if(!qr(W[J],z[J],t.text)){q=!1;break}q&&g++}let y=g===c.keysBoth?100:g===0?0:Math.min(99,Math.max(1,Math.round(g/c.keysBoth*100))),A=new Map,p=new Map;for(let[b,x]of u){let M=w[x]>=0,W=C[x]>=0;if(!M&&!W)continue;let z=ft(b);gt(z)&&(M&&A.set(z,(A.get(z)??0)+1),W&&p.set(z,(p.get(z)??0)+1))}let _=b=>{let x=0;for(let M of b.values())M>=2&&(x+=M);return x};return{key:l.keyIdx,discriminator:m,pairing:{form:"long",key:n[l.keyIdx].name,discriminator:n[m].name,keysA:c.keysA,keysB:c.keysB,keysBoth:c.keysBoth,duplicateKeysA:c.dupA,duplicateKeysB:c.dupB,identicalPct:y,discriminatorBlankRows:f.blankRows,looseCollisionsA:_(A),looseCollisionsB:_(p),setOrder:f.setOrder}}}var Zr=t=>t==="Integer"||t==="Decimal";function Qr(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)||!Zr(r.dataType)||r.isTemporal||r.isDatePart||r.identifierNamed||r.distinct<3||n.push(i)}return n}function an(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=Qr(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[u,c]=i[o].twoValues,f=new Uint8Array(n.length);for(let m=0;m<n.length;m++){let h=r(n[m][o]);f[m]=h===u?1:h===c?2:0}return f});for(let o of a){let u=new Float64Array(n.length),c=0;for(let y=0;y<n.length;y++){let A=n[y][o],p=A==null||A===""?NaN:typeof A=="number"?A:parseFloat(A);u[y]=p,p===p&&p!==1/0&&p!==-1/0&&c++}if(c<2)continue;let f=new Float64Array(c);for(let y=0,A=0;y<n.length;y++){let p=u[y];p===p&&p!==1/0&&p!==-1/0&&(f[A++]=p)}f.sort();let m=new Float64Array(c),h=0;for(let y=0;y<c;y++)(y===0||f[y]!==f[y-1])&&(m[h++]=f[y]);let w=new Int32Array(n.length).fill(-1);for(let y=0;y<n.length;y++){let A=u[y];if(!(A===A&&A!==1/0&&A!==-1/0))continue;let p=0,_=h-1;for(;p<_;){let b=p+_>>>1;m[b]<A?p=b+1:_=b}w[y]=p}let C=[],S=new Int32Array(h),g=new Int32Array(h);for(let y=0;y<s.length;y++){let A=l[y];S.fill(0),g.fill(0);let p=0,_=0;for(let Y=0;Y<n.length;Y++){let U=w[Y];U<0||(A[Y]===1?(S[U]++,p++):A[Y]===2&&(g[U]++,_++))}if(p===0||_===0)continue;let b=p<=_,x=b?p:_,M=b?_:p,W=b?S:g,z=b?g:S,q=0,J=0,ce=0;for(let Y=0;Y<h;Y++){let U=W[Y],d=z[Y];q+=U*(J+.5*d),J+=d,U+d>=2&&(ce+=U+d)}C.push({outcome:i[s[y]].name,aucMinorityHigh:Math.round(q/(x*M)*1e4)/1e4,nMinority:x,nMajority:M,ties:ce})}C.length>0&&e.set(o,C)}return e}var un=12,ei=100,ti=.3,ni=3,ri=.75,cn=.9,ii=120,dn=1900,mn=2100,si=0,oi=20,ai=new Set(["id","ids","uuid","guid","key","zip","zipcode","postal","postalcode","ssn","code","codes","sku","isbn","msisdn","imei"]);function Ne(t){if(!t)return!1;let e=ee(t);return e.length===0?!1:ai.has(e[e.length-1])?!0:Yt(t)!==null}var li=new Set(["year","yr","fy"]),ui=t=>ee(t).some(e=>li.has(e))||mt(t)!==null,ci=/^(?:(?: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 Ze(t){if(!Number.isInteger(t)||t<190001||t>210012)return!1;let e=t%100;return e>=1&&e<=12}function Qe(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 di=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?Z?)?$/,mi=/^(\d{4})([\/.])(\d{1,2})\2(\d{1,2})$/,fi=/^(\d{1,2})([\/.\-])(\d{1,2})\2(\d{4})(?:[ T](\d{2}):(\d{2})(?::(\d{2}))?)?$/;function pn(t,e){let n=[],i=0,r=gi(t,e,n,()=>{i++});if(r)return r;if(i>0||n.length<2)return null;let s=Nt(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 gi(t,e,n,i){let r=0,s=0,a=0,l=0,o=0,u="",c=0,f="",m=0,h=0,w=0,C=0,S=!1;for(let b of t){if(b==null)continue;let x=String(b).trim();if(x==="")continue;r++,n.push(x);let M;if(M=di.exec(x)){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=mi.exec(x)){i();let W=+M[3],z=+M[4];W>=1&&W<=12&&z>=1&&z<=31&&(u&&u!==M[2]&&(S=!0),u=M[2],o++)}else if(M=fi.exec(x)){i();let W=+M[1],z=+M[3];W>=1&&W<=31&&z>=1&&z<=31&&(W<=12||z<=12)&&(f&&f!==M[2]&&(S=!0),f=M[2],c++,W>12&&w++,z>12&&C++,M[5]!==void 0&&m++,M[7]!==void 0&&h++)}if(r>=200)break}if(r<2||(s+o+c)/r<.8||(s>0?1:0)+(o>0?1:0)+(c>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${u}%m${u}%d`,orderFrom:"iso"};if(w>0&&C>0)return null;let A,p;w>0?(A=!0,p="values"):C>0?(A=!1,p="values"):f==="."?(A=!0,p="shape"):(A=!$e(e),p="locale");let _=A?`%d${f}%m${f}%Y`:`%m${f}%d${f}%Y`;return m===c?{pattern:_+(h===c?" %H:%M:%S":" %H:%M"),orderFrom:p}:{pattern:_,orderFrom:p}}function pi(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=te(n);return i.length>0&&e[i]!==void 0}function hi(t,e){let n=new Map,i=new Map;for(let l of t){let o=ie(l);if(!o||"month"in o)continue;let u=oe(o.word),c=u.some(m=>m.lang==="en"),f=te(o.word);for(let m of new Set(u.map(h=>h.lang)))m!=="en"&&(n.has(m)||(n.set(m,new Set),i.set(m,new Set)),n.get(m).add(f),c||i.get(m).add(f))}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=ie(l);if(!o)continue;if("month"in o){s++;continue}let u=oe(o.word);if(u.length===0)continue;let c=u.some(f=>f.lang==="en");for(let f of r)(c||u.some(m=>m.lang===f))&&a.set(f,a.get(f)+1)}return s+Math.max(0,...a.values())}var yi=/(?:19|20)[0-9]{2}/;function bi(t){let e=new Map,n=0;for(let r of t){if(!yi.test(re(r)))continue;let s=new Set(pe(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 Si(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&&ui(n)||o&&r>=3&&r===a-s+1)return!0;let u=Ze(s)&&Ze(a),c=Qe(s)&&Qe(a);if(u||c){if(!t.sampleValues)return!0;let f=0,m=0;for(let h of t.sampleValues){if(h==null||h==="")continue;f++;let w=Number(String(h).trim());if(Number.isFinite(w)&&(u?Ze(w):Qe(w))&&m++,f>=60)break}if(f>=2&&m===f)return!0}return!1}if(t.sampleValues){let s=t.locale?_e(t.locale):null,a=0,l=0,o=[],u=[];for(let c of t.sampleValues){if(c==null||c==="")continue;a++;let f=String(c).trim();if(o.push(f),ci.test(f)||pi(f,s)?l++:u.push(f),a>=60)break}if(a>=2&&l/a>=.8||a>=2&&(l+bi(u)+hi(o,u))/a>=.8||pn(o,t.locale)!==null)return!0}return!1}function _i(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":Ft(t)}function Ai(t){let{rows:e,measureColIdx:n,measureName:i,candidateDims:r,minNum:s,maxNum:a,discourageAgg:l}=t,o=100,u=.01,c="";for(let m of r){if(m.distinct<2||m.distinct>o)continue;let h=r.filter(y=>y.idx!==m.idx).map(y=>y.idx),w=new Map;for(let y of e){let A=y[n];if(typeof A!="number"||!Number.isFinite(A))continue;let p=h.length?h.map(b=>String(y[b])).join(c):"",_=w.get(p);_||(_={sum:0,cset:new Set},w.set(p,_)),_.sum+=A,_.cset.add(String(y[m.idx]))}let C=0,S=0,g=0;for(let y of w.values())y.cset.size<2||(g++,Math.abs(y.sum-100)<=100*u?C++:Math.abs(y.sum-1)<=1*u&&S++);if(g>=2&&(C/g>=.9||S/g>=.9))return{additivity:"part_of_whole",partOfWholeDim:m.name}}if(l)return{additivity:"intensive_rate"};let f=_i(i);return f==="avg"||f==="min"||f==="max"?{additivity:"intensive_rate"}:f==="count"?{additivity:"additive"}:f==="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 hn(t){let{dataType:e,isMeasure:n,name:i,distinct:r,nonblank:s,prec:a,maxval:l,minval:o}=t,u=l-o+1,c=u>0?r/u:1,f=s>0?r/s:0,m=e==="Decimal"||a>0;return!n&&Ne(i)?"Categorical":c>=cn&&!(t.ordinalNeedsWholeNumbers&&a>0)&&(De(i)&&r<=ii||o>=dn&&l<=mn||o>=si&&l<=oi)?"Ordinal":n?"Continuous":!m&&Number.isFinite(u)&&r>un&&r===s&&u===r?"Categorical":r>un&&(m||r>=ei||f>=ti)||r>=ni&&f>=ri&&(m||c<cn&&!De(i)&&!(o>=dn&&l<=mn))?"Continuous":"Categorical"}function fn(t,e,n){return!t||t.isMeasure||e||t.dataType!=="Integer"&&t.dataType!=="Decimal"?!1:hn({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,ordinalNeedsWholeNumbers:!0})==="Continuous"}function Ci(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 gn=class{_computedStatsForLevel=null;_cols=[];_rows=[];_origIndices=[];_rowHashes=new Set;_hostQueryNames=[];_englishAliases=new Map;_generationColumns=[];_generationColumnsSig="[]";_declaredDimensions=new WeakSet;_inferredMeasureFlags=null;_preStatsFields=null;_statsAddedKeys=null;dedupRows=!0;tellApartNames=!0;_renamedRepeats=[];getRenamedRepeats(){return this._renamedRepeats}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??""))||ct(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 u of this._rows){let c=u[i],f=this.STR(c);if(f!=""&&(r.add(f),s++,(l===null||c<l)&&(l=c),(o===null||c>o)&&(o=c),n.dataType=="Decimal")){let m=this.getPrecision(c);m>a&&(a=m)}}e[i]=fn(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 ut(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;this._preStatsFields&&this._statsAddedKeys&&this._preStatsFields.length===this._cols.length?this._cols.forEach((d,T)=>{let E=this._preStatsFields[T];if(!(!d||!E)){for(let k of this._statsAddedKeys[T]??[])delete d[k];for(let k of Object.keys(E))d[k]=E[k]}}):this._preStatsFields=this._cols.map(d=>d?{...d}:null);let i=this._cols.map(d=>new Set(d?Object.keys(d):[])),r=0,s=parseInt(e),a=this.wallClockColumnIndexes(),l=[],o=[],u=[];for(let d of this._cols){let T=new Map,E=[],k=0,v=0,O=0,F=null,P=null,D=null,G=!1,V=!0,I=!0,N=null,K=!1,L=a.has(r);for(let R of this._rows){let $=R[r],B=L&&$ instanceof Date?ge($):$,H=this.STR(B);if(H!=""){if(k+=H.length,T.set(H,(T.get(H)||0)+1),v++,d.dataType=="Integer"||d.dataType=="Decimal"||d.dataType=="DateTime")if((F===null||B<F)&&(F=B),(P===null||B>P)&&(P=B),d.dataType=="Integer"||d.dataType=="Decimal"){if(D===null?D=B:D+=B,d.dataType=="Decimal"){let Z=this.getPrecision(B);Z>O&&(O=Z)}E.push(B)}else G=G||this.hasTimeComponent(B);K&&(B<N?V=!1:B>N&&(I=!1)),N=B,K=!0}}if(v>=3&&(V&&!I?d.sortedDirection="asc":I&&!V?d.sortedDirection="desc":d.sortedDirection="none"),v>0&&T.size>0&&!d.isMeasure){let R=0,$=Number.MAX_SAFE_INTEGER;for(let B of T.values())B>R&&(R=B),B<$&&($=B);if(d.modalShare=R/v,d.minGroupCount=$===Number.MAX_SAFE_INTEGER?null:$,T.size===2){let B=[...T.keys()].map(de=>ot(de).trim().toLowerCase()).sort();([["false","true"],["no","yes"],["n","y"],["0","1"],["f","t"]].some(de=>B[0]===de[0]&&B[1]===de[1])||Mi(d.name))&&(d.isBinaryFlag=!0)}}else d.isMeasure&&(d.dataType==="Integer"||d.dataType==="Decimal")&&T.size===2&&T.has("0")&&T.has("1")&&(d.isBinaryFlag=!0);if(d.dataType=="DateTime"&&(d.dateWithTime=G,G&&dt(L?this._rows.map(R=>R[r]instanceof Date?ge(R[r]):R[r]):this._rows.map(R=>R[r]))?d.timeOfDayOnly=!0:delete d.timeOfDayOnly),d.isTemporal=Si({dataType:d.dataType,name:d.name,isMeasure:d.isMeasure,distinctCount:T.size,minNum:typeof F=="number"?F:null,maxNum:typeof P=="number"?P:null,sampleValues:T.keys(),locale:n}),d.isTemporal&&d.dataType==="String"&&!d.isMeasure){let R=pn(T.keys(),n);R&&(d.temporalTextPattern=R.pattern)}if(d.timeOfDayOnly)delete d.temporalCadence;else if(d.isTemporal&&!d.isMeasure){let R=Jt(T.keys(),{includeBounds:s>=20,pattern:d.temporalTextPattern,locale:n});R&&(d.temporalCadence=R)}this.updateColumnStats10(s,d,v,T,O,P,F),this.updateColumnStats20(s,E,v,D,d,k,G,F,P,O,T,n),fn(d,this._declaredDimensions.has(d),{distinct:T.size,nonblank:v,prec:O,minval:F,maxval:P})&&(d.isMeasure=!0,d.valueNature="Continuous",d.geoKind=void 0,d.geoMatchPct=void 0,d.geoAmbiguous=void 0,d.dominantGeoRegion=void 0,d.dominantGeoRegionPct=void 0,d.geoRegionCount=void 0),l[r]=d.isMeasure||T.size>2e3?null:new Set(T.keys()),o[r]=T.size,u[r]=T.size===2?[...T.keys()].sort():null,r++}vt(this._cols,this._rows,{cities:this.deriveProvinces}).forEach((d,T)=>{let E=this._cols[T];d.kind&&(E.geoKind=d.kind,E.geoMatchPct=d.matchPct,d.ambiguous&&(E.geoAmbiguous=!0)),d.rollupPct!==void 0&&(E.admin1RollupPct=d.rollupPct),d.regionCount!==void 0&&(E.admin1RegionCount=d.regionCount),d.countryCount!==void 0&&(E.admin1CountryCount=d.countryCount),d.dominantRegion&&(E.dominantGeoRegion=d.dominantRegion,E.dominantGeoRegionPct=d.dominantRegionPct)});let c=this.getGeoExtent();if(c&&c.dominantFrame&&this._geoExtentLatIdx>=0){let d=this._cols[this._geoExtentLatIdx];d.geoKind||(d.dominantGeoRegion=c.dominantFrame,d.dominantGeoRegionPct=c.dominantFramePct,this.deriveProvinces&&(d.admin1RollupPct=c.dominantFramePct))}let f=[];this._cols.forEach((d,T)=>{d.isMeasure||f.push({idx:T,distinct:d.distinctCount??0,name:d.name})}),this._cols.forEach((d,T)=>{if(!d.isMeasure)return;let E=typeof d.lowValue=="number"?d.lowValue:null,k=typeof d.highValue=="number"?d.highValue:null,v=Ai({rows:this._rows,measureColIdx:T,measureName:d.name,candidateDims:f,minNum:E,maxNum:k,discourageAgg:!!d.discourageAggregationAcrossGroups});d.additivity=v.additivity,v.partOfWholeDim&&(d.partOfWholeDim=v.partOfWholeDim)});let m=50,h=4,w=f.filter(d=>d.distinct>=2&&d.distinct<=m);this._cols.forEach((d,T)=>{if(!d.isMeasure)return;let E=[];for(let I of this._rows){let N=I[T];if(N==null||N==="")continue;let K=typeof N=="number"?N:parseFloat(N);isNaN(K)||E.push(K)}if(E.length===0)return;let k=[...E].sort((I,N)=>I-N);if(k[0]===k[k.length-1])d.relativeDispersion=0;else if(k.length>=h){let I=fe(k,.5),N=fe(k,.1),K=fe(k,.9);d.relativeDispersion=Math.abs(I)>1e-9?Math.round((K-N)/Math.abs(I)*1e3)/1e3:void 0}else d.relativeDispersion=void 0;let v=[];for(let I of w){let N=new Set;for(let K of this._rows){let L=K[T];L==null||L===""||N.add(this.STR(K[I.idx])+"")}v.push({otherColumn:I.name,nonBlankGroupCount:N.size})}v.length>0&&(d.nonBlankGroups=v);let O=0;for(let I of E)O+=I;O/=E.length;let F=0;for(let I of E)F+=(I-O)*(I-O);if(F<=1e-12)return;let P=[],D=[],G=I=>{if(I.length<4)return NaN;let N=[...I].sort((L,R)=>L-R),K=L=>N[Math.min(N.length-1,Math.max(0,Math.floor(L*(N.length-1))))];return K(.75)-K(.25)},V=G(E);for(let I of w){let N=new Map;for(let R of this._rows){let $=R[T];if($==null||$==="")continue;let B=typeof $=="number"?$:parseFloat($);if(isNaN(B))continue;let H=this.STR(R[I.idx])+"",Z=N.get(H);Z?(Z.s+=B,Z.n++,Z.vals.push(B)):N.set(H,{s:B,n:1,vals:[B]})}let K=0;for(let R of N.values()){let $=R.s/R.n;K+=R.n*($-O)*($-O)}P.push({otherColumn:I.name,eta2:Math.round(K/F*1e4)/1e4});let L=[];for(let R of N.values()){let $=G(R.vals);isNaN($)||L.push($)}if(L.length>=2&&isFinite(V)&&V>1e-9){let R=(Math.max(...L)-Math.min(...L))/V;D.push({otherColumn:I.name,spreadRatio:Math.round(R*1e4)/1e4})}}P.length>0&&(d.groupDiscrimination=P),D.length>0&&(d.spreadDiscrimination=D)});let C=.97,S=.8,g=8,y=5,A=this._cols.map((d,T)=>({c:d,i:T})).filter(d=>d.c.isMeasure);for(let d=0;d<A.length;d++)for(let T=d+1;T<A.length;T++){let E=A[d].i,k=A[T].i,v=0,O=0,F=0,P=0,D=0,G=0;for(let L of this._rows){let R=L[E],$=L[k];if(R==null||R===""||$===null||$===void 0||$==="")continue;let B=typeof R=="number"?R:parseFloat(R),H=typeof $=="number"?$:parseFloat($);isNaN(B)||isNaN(H)||(v++,O+=B,F+=H,P+=B*B,D+=H*H,G+=B*H)}if(v<y)continue;let V=v*P-O*O,I=v*D-F*F;if(V<=1e-12||I<=1e-12)continue;let N=(v*G-O*F)/Math.sqrt(V*I),K=Math.min(1,Math.round(Math.abs(N)*1e3)/1e3);for(let L of[A[d].c,A[T].c])(L.maxAbsMeasureCorrelation===void 0||K>L.maxAbsMeasureCorrelation)&&(L.maxAbsMeasureCorrelation=K);if(Math.abs(N)>=C){let L=A[d].c,R=A[T].c;L.collinearWithMeasures||(L.collinearWithMeasures=[]),R.collinearWithMeasures||(R.collinearWithMeasures=[]),L.collinearWithMeasures.push(R.name),R.collinearWithMeasures.push(L.name)}else if(Math.abs(N)>=S){let L=A[d].c,R=A[T].c,$=Math.round(N*1e3)/1e3;L.correlatedWithMeasures||(L.correlatedWithMeasures=[]),R.correlatedWithMeasures||(R.correlatedWithMeasures=[]),L.correlatedWithMeasures.push({otherColumn:R.name,r:$}),R.correlatedWithMeasures.push({otherColumn:L.name,r:$})}}for(let{c:d}of A)d.correlatedWithMeasures&&(d.correlatedWithMeasures.sort((T,E)=>Math.abs(E.r)-Math.abs(T.r)||(T.otherColumn<E.otherColumn?-1:1)),d.correlatedWithMeasures.length=Math.min(d.correlatedWithMeasures.length,g));for(let d=0;d<this._cols.length;d++){let T=l[d];if(!T||T.size===0)continue;let E=[];for(let k=0;k<this._cols.length;k++){if(k===d)continue;let v=l[k];if(!v||v.size===0)continue;let O=0;for(let P of T)v.has(P)&&O++;let F=Math.round(O/T.size*100);F>0&&E.push({otherColumn:this._cols[k].name,percentShared:F})}E.length>0&&(this._cols[d].sharedValueRatioWithOthers=E)}let p=50,_=[];for(let d=0;d<this._cols.length;d++){let T=l[d];T&&T.size>=2&&T.size<=p&&_.push(d)}if(_.length>=2){let d=new Map,T=(k,v)=>k+":"+v;for(let k=0;k<_.length;k++)for(let v=k+1;v<_.length;v++)d.set(T(_[k],_[v]),new Map);for(let k of this._rows)for(let v=0;v<_.length;v++){let O=this.STR(k[_[v]])+"";for(let F=v+1;F<_.length;F++){let P=""+this.STR(k[_[F]]),D=d.get(T(_[v],_[F])),G=O+""+P;D.set(G,(D.get(G)??0)+1)}}let E=new Map;for(let k=0;k<_.length;k++)for(let v=k+1;v<_.length;v++){let O=_[k],F=_[v],P=l[O].size,D=l[F].size,G=d.get(T(O,F)),V=G.size,I=0;for(let R of G.values())(I===0||R<I)&&(I=R);let N=Math.round(V/(P*D)*100),K=V===P,L=V===D;if((this._cols[O].categoricalPairStats||=[]).push({otherColumn:this._cols[F].name,fillPct:N,determinesOther:K,minCellCount:I,distinctCombinations:V}),(this._cols[F].categoricalPairStats||=[]).push({otherColumn:this._cols[O].name,fillPct:N,determinesOther:L,minCellCount:I,distinctCombinations:V}),K&&P>D){let R=E.get(O);(!R||D<R.card)&&E.set(O,{name:this._cols[F].name,card:D,ratio:D/P})}if(L&&D>P){let R=E.get(F);(!R||P<R.card)&&E.set(F,{name:this._cols[O].name,card:P,ratio:P/D})}}for(let[k,v]of E)this._cols[k].primaryParentColumn=v.name,this._cols[k].nestingRatio=Math.round(v.ratio*100)/100}let b=6,x=this._rows.length;for(let d=0;d<this._cols.length;d++){let T=this._cols[d];if(T.isMeasure||T.primaryParentColumn)continue;let E=T.distinctCount??0;if(E<=p||x>0&&E>=x)continue;let k=[];for(let v=0;v<this._cols.length;v++){if(v===d)continue;let O=this._cols[v];if(O.isMeasure)continue;let F=O.distinctCount??0;F<2||F>=E||k.push(v)}k.sort((v,O)=>(this._cols[v].distinctCount??0)-(this._cols[O].distinctCount??0));for(let v of k.slice(0,b)){let O=new Map,F=!0;for(let D of this._rows){let G=this.STR(D[d])+"",V=this.STR(D[v])+"",I=O.get(G);if(I===void 0)O.set(G,V);else if(I!==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/E*100)/100;break}}let M=.01,W=.05,z=.95,q=8,J=8,ce=6,Y=500,U=[];for(let d=0;d<this._cols.length&&U.length<J;d++){let T=this._cols[d].dataType;(T==="Double"||T==="Integer"||T==="Decimal")&&U.push(d)}if(U.length>=3&&this._rows.length>=q){let d=Math.min(this._rows.length,Y),T=U.map(P=>{let D=[];for(let I=0;I<d;I++){let N=this._rows[I][P],K=typeof N=="number"?N:parseFloat(String(N).replace(/,/g,""));if(N==null||N===""||!isFinite(K))return null;D.push(K)}let G=D[0],V=!1;for(let I of D)if(I!==G){V=!0;break}return V?D:null}),E=U.map((P,D)=>D).filter(P=>T[P]!==null),k=P=>{let D=P.slice().sort((V,I)=>V-I),G=D.length>>1;return D.length%2?D[G]:(D[G-1]+D[G])/2},v=null,O=[],F=P=>{if(O.length>=3){let D=O.map(N=>T[N]),G=D[0].length,V=new Array(G);for(let N=0;N<G;N++){let K=0;for(let L of D)K+=L[N];V[N]=K}let I=k(V);if(I>0){let N=0;for(let L of V)Math.abs(L-I)<=I*M&&N++;let K=N/G;if(K>=z){let L=1;for(let R of D){let $=k(R)/I;$<L&&(L=$)}L>=W&&(!v||O.length>v.cols.length)&&(v={cols:O.slice(),total:I,matched:K})}}}if(!(O.length>=ce))for(let D=P;D<E.length;D++)O.push(E[D]),F(D+1),O.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,l),this.applyScoreSeparation(o,u),this.applySeriesCompleteness(s,n,l),this.applyMeasurePersistence(n,l),this._statsAddedKeys=this._cols.map((d,T)=>d?Object.keys(d).filter(E=>!i[T].has(E)):[]),this._computedStatsForLevel=e,this._cols}applyTwoSetPairing(e,n){for(let r of this._cols)r.twoSetPairing!==void 0&&delete r.twoSetPairing;let i=on({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:Ne(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=an({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:Ne(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 u of this._cols)u.seriesCompleteness!==void 0&&delete u.seriesCompleteness;let r=this._cols.map((u,c)=>({c:u,i:c})).filter(({c:u})=>u.isTemporal&&!u.isMeasure&&u.temporalCadence&&u.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(u=>this.STR(u[s])),o=e>=20&&(a.dataType!=="String"||Array.isArray(a.safeDistinctValues));for(let{c:u,i:c}of r){let f=rn({periods:this._rows.map(m=>this.STR(m[c])),series:l,seriesColumn:a.name,pattern:u.temporalTextPattern,locale:n,includeDates:e>=20,includeNames:o});f&&(u.seriesCompleteness=f)}}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:Ne(a.name),values:o,rows:this._rows.length,locale:e}))});let s=nn(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,u)=>{o.isMeasure&&(o.dataType==="Integer"||o.dataType==="Decimal"||o.dataType==="Double")&&i.push(u)}),i.length===0||this._rows.length<Ie)return;let r=-1,s=[];for(let o=0;o<this._cols.length&&r<0;o++){let u=this._cols[o];if(!u.isTemporal||u.isMeasure||u.isDatePart)continue;let c=this._rows.map(f=>X(this.STR(f[o]),u.temporalTextPattern,e)?.ms??null);new Set(c.filter(f=>f!==null)).size<Ie||(r=o,s=c)}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 u=this._rows.map(f=>{let m=f[o];if(m==null||m==="")return null;let h=typeof m=="number"?m:parseFloat(String(m).replace(/,/g,""));return Number.isFinite(h)?h:null}),c=je({stamps:s,series:l,values:u});c&&(this._cols[o].persistence={timeColumn:this._cols[r].name,...a>=0?{seriesColumn:this._cols[a].name}:{},...c})}}updateColumnStats20(e,n,i,r,s,a,l,o,u,c,f,m){if(e>=20){let h=[...n].sort((S,g)=>S-g),w=Math.floor(h.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=g=>{let y=g instanceof Date?g:typeof g=="string"?ke(g)??new Date(g):new Date(g),A=this.wholeDayIso(y);return A?A+"T00:00:00.000Z":isNaN(y.getTime())?g:y.toISOString().slice(0,10)+"T00:00:00.000Z"};s.dataType!="DateTime"||l||!o?s.lowValue=o:s.lowValue=S(o),s.dataType!="DateTime"||l||!u?s.highValue=u:s.highValue=S(u),s.medianValue=h.length===0?null:h.length%2===0?s.dataType=="Integer"?Math.round((h[w-1]+h[w])/2):(h[w-1]+h[w])/2:h[w],s.numericPrecision=c}if(h.length>0){let S=i>0&&r!=null?r/i:s.avgValue??0,g=h.length,y=0,A=0;for(let b of h){let x=b-S;y+=x*x,A+=x*x*x}let p=y/g,_=Math.sqrt(p);s.skewness=p===0?0:A/g/(_*_*_),s.stdDev=Math.sqrt(p)}r!==null&&(s.sum=r);let C=Array.from(f.entries()).sort((S,g)=>g[1]-S[1]);if(s.topCategories=C.slice(0,10).map(S=>S[1]),!s.isMeasure&&C.length>0&&(s.dataType!=="String"&&(s.topCategoryValues=C.slice(0,5).map(S=>S[0])),e>=20)){let S=C.map(y=>y[0]),g=he(S,m);if(g!==null)s.ordinalPattern=g.pattern,s.orderedDomain=g.orderedDomain;else if(s.dataType==="String"){let y=pt(S);y!==null&&(s.safeDistinctValues=y)}}if(h.length>=8&&(s.dataType==="Integer"||s.dataType==="Decimal")){let S=g=>h[Math.floor((h.length-1)*g)];s.quantiles={p05:S(.05),p25:S(.25),p75:S(.75),p95:S(.95)}}}if(!s.isMeasure&&s.dataType==="String"&&f.size>0){let h=Array.from(f.entries()).sort((S,g)=>g[1]-S[1]).map(S=>S[0]);s.formatSignature=Se(h);let w=i>0?a/i:void 0,C=/^(UUID|EMAIL_LIKE|URL_LIKE|PHONE_LIKE|NUMERIC_ID|HEX_ID|OPAQUE_ID_ALPHANUMERIC|DATE_STR|BOOLEAN)$/;s.formatSignature&&!C.test(s.formatSignature)&&(w===void 0||w>=3)&&(s.isFreeText=!0)}if(!s.isMeasure&&f.size>0){let h=Array.from(f.entries()).sort((C,S)=>S[1]-C[1]),w=Ct(h.map(C=>C[0]),s.name,m);if(w!==null&&(s.geoKind=w.geoKind,s.geoMatchPct=w.geoMatchPct,w.geoAmbiguous&&(s.geoAmbiguous=!0),w.geoKind.indexOf("country")===0)){let C=bt(h);C&&(s.dominantGeoRegion=C.dominantGeoRegion,s.dominantGeoRegionPct=C.dominantGeoRegionPct,s.geoRegionCount=C.regionCount,C.middleEastPct>0&&(s.middleEastPct=C.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=hn({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=>et(a,{camel:!0}),n=-1,i=-1,r=-1;if(this._cols.forEach((a,l)=>{let o=e(a.name),u=a.dataType==="Integer"||a.dataType==="Decimal";u&&n<0&&o.some(c=>c==="lat"||c==="latitude")?n=l:u&&i<0&&o.some(c=>c==="lon"||c==="lng"||c==="long"||c==="longitude")&&(i=l),r<0&&!a.isMeasure&&typeof a.geoKind=="string"&&a.geoKind.indexOf("country")===0&&(r=l)}),n<0||i<0){let a=(u,c)=>{let f=0;for(let m of this._rows){let h=m[u];if(h==null||h==="")continue;let w=Number(h);if(!Number.isFinite(w)||w<-c||w>c)return!1;f++}return f>0},l=-1,o=-1;if(this._cols.forEach((u,c)=>{if(!(u.dataType==="Integer"||u.dataType==="Decimal"))return;let f=e(u.name),m=f.some(h=>h==="lat"||h==="latitude")?"lat":f.some(h=>h==="lon"||h==="lng"||h==="long"||h==="longitude")?"lon":Et(f);m==="lat"&&l<0&&a(c,90)?l=c:m==="lon"&&o<0&&a(c,180)&&(o=c)}),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],u=l==null||l===""?null:Number(l),c=o==null||o===""?null:Number(o);s.push({lat:u,lon:c,country:r>=0&&ye(this.STR(a[r]))?this.STR(a[r]):null})}return this._geoExtent=yt(s),this._geoExtent}_geoExtent=null;_geoExtentComputed=!1;_geoExtentLatIdx=-1;obfuscateString(e){return qt(e,lt)}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 u={};for(let c=0;c<this._cols.length;c++){let f=this._cols[c],m=o[c];if(this.STR(m)!=""){if(e&&f.dataType=="String")if(s.has(m))m=s.get(m);else{let h=this.obfuscateString(m);s.set(m,h),m=h}else if(f.dataType=="DateTime"&&!f.dateWithTime){let h=m instanceof Date?m:typeof m=="string"?ke(m)??new Date(m):new Date(m);m=(this.wholeDayIso(h)??h.toISOString().slice(0,10))+"T00:00:00.000Z"}else a.has(c)&&m instanceof Date&&(m=ge(m));r-=this.STR(m).length}else m=null;u[c]=m,--r}if(n.push(u),--i,i<=0||r<=0)break}return await ln.unparse(n,{header:!1})}getCSVHeaderLine(){let e=this.liveEnglishAliases();return ln.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}setGenerationColumns(e){let n=(e??[]).filter(r=>!!r&&typeof r.n=="string"&&r.n!==""&&typeof r.q=="string"&&r.q!=="").map(r=>({n:r.n,q:r.q})),i=JSON.stringify(n);i!==this._generationColumnsSig&&(this._generationColumns=n,this._generationColumnsSig=i,this._englishAliases=new Map)}aliasesForCode(e){let n=Ue(e,this._cols)?this.legacyAliases():[];for(let i of this.englishAliasesFor(e).values())n.push({name:i.name,alias:i.alias,reason:i.reason});return n}armAliasesForCode(e){return this.emitLegacyAggAliases=Ue(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:n.reason});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,i=(this._cols??[]).some(u=>!!u&&!!u.isReassembledDate&&!!u.sourceField);if(!e||this._hostQueryNames.length===0&&!i||!this._cols||this._cols.length===0)return n;let r=String(e),s=new Set;for(let u of this._cols)u&&(s.add(this.STR(u.name)),u.hostName&&s.add(this.STR(u.hostName)));let a=new Map,l=new Set,o=new Set;for(let u=0;u<this._cols.length;u++){if(!this._cols[u])continue;let c=this._hostQueryNames[u],f=Bt(c,this._cols[u].name,this._cols[u].dataType)?[]:$t(c),m=this.STR(this._cols[u].name),h=[];if(c){for(let g of this._generationColumns)if(g.q===c)for(let y of[g.n,Ke(g.n)])y&&y!==m&&!f.includes(y)&&!h.includes(y)&&h.push(y)}let w=this._cols[u].isReassembledDate?this.STR(this._cols[u].sourceField):"",C=w&&w!==m&&!f.includes(w)&&!h.includes(w)?[w]:[],S=[...f,...h,...C].filter(g=>!s.has(g)&&ae(r,g));S.length===1&&(a.set(S[0],[...a.get(S[0])??[],u]),h.includes(S[0])?l.add(S[0]):C.includes(S[0])&&o.add(S[0]))}for(let[u,c]of a){if(c.length!==1)continue;let f=this.STR(this._cols[c[0]].name);n.set(c[0],{name:f,alias:u,headerName:!ae(r,f),reason:l.has(u)?"stored-query-name":o.has(u)?"reassembled-date-source-field":"english-implicit-agg"})}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=at(i);if(this._rowHashes.has(r))return!1;this._rowHashes.add(r)}return this._rows.push(Ci(e)),this.invalidateStats(),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,this._leafCardinality=null,this._inferredMeasureFlags=null}reset(){this.invalidateStats(),this._preStatsFields=null,this._statsAddedKeys=null,this._inferredMeasureFlags=null,this._cols=[],this._rows=[],this._origIndices=[],this._rowHashes=new Set,this._leafCardinality=null,this._hostQueryNames=[],this._englishAliases=new Map,this._generationColumns=[],this._generationColumnsSig="[]",this._renamedRepeats=[]}setColumns(e){if(this.invalidateStats(),this._preStatsFields=null,this._statsAddedKeys=null,this._inferredMeasureFlags=null,this._cols=e,this._renamedRepeats=[],!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=Ke(r);!s||s===r||n.has(s)||(n.delete(r),n.add(s),i.hostName=r,i.name=s)}if(this.tellApartNames){let i=e.map(s=>this.STR(s?.name)),r=zt(i);for(let s=0;s<e.length;s++)!e[s]||r[s]===i[s]||(this._renamedRepeats.push({index:s,from:i[s],to:r[s]}),e[s].name=r[s])}}},xi=new Set(["active","inactive","flag","flags","flagged","paid","unpaid","win","wins","won","winner","pass","passed","passes","fail","failed","fails","failure","failures"]),wi=/^(?:default|churn|fraud|approv|convert|cancel|delinquen)/u;function Mi(t){let e=String(t??"");return/^(is|has)[_\p{L}\p{N}]/iu.test(e)?!0:e.replace(/([\p{Ll}\p{N}])(\p{Lu})/gu,"$1 $2").toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(i=>i.length>0).some(i=>xi.has(i)||wi.test(i))}export{yn as a,bn as b,Ni as c,Ei as d,vt as e,Nt as f,En as g,kn as h,Et as i,Pn as j,Ln as k,Fn as l,zn as m,Te as n,Yn as o,Ke as p,Ue as q,$t as r,Vt as s,qn as t,Ut as u,Ht as v,$i as w,Bi as x,Gi as y,Jn as z,er as A,tr as B,Yt as C,ae as D,fr as E,Xi as F,gr as G,pr as H,X as I,Jt as J,Nr as K,Er as L,kr as M,Fr as N,nn as O,rn as P,as as Q,Ne as R,pn as S,Si as T,_i as U,Ai as V,hn as W,fn as X,Ci as Y,gn as Z,Mi as _};
@@ -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 S}from"./chunk-5HI6TVMM.mjs";import{a as _,b as M,d as x,g as R,h as D,n as j}from"./chunk-BLMRLXQJ.mjs";import{f as p}from"./chunk-F6UNSFU6.mjs";var Pe=Object.freeze({hour:24,weekday:7,month:12,quarter:4,week:53,season:4}),J={nl:["jaar"],de:["jahr"],fr:["ann\xE9e"],es:["a\xF1o"],pt:["ano"],it:["anno"],pl:["rok"],cs:["rok"],sk:["rok"],sv:["\xE5r"],da:["\xE5r"],nb:["\xE5r"],fi:["vuosi"],hu:["\xE9v"],tr:["y\u0131l"],ro:["anul"],hr:["godina"],id:["tahun"],vi:["n\u0103m"],ru:["\u0433\u043E\u0434"],uk:["\u0440\u0456\u043A"],el:["\u03AD\u03C4\u03BF\u03C2"],zh:["\u5E74\u4EFD","\u5E74\u5EA6"],ja:["\u5E74\u5EA6"],ko:["\uC5F0\uB3C4","\uB144\uB3C4"],ar:["\u0633\u0646\u0629"],he:["\u05E9\u05E0\u05D4"],hi:["\u0935\u0930\u094D\u0937","\u0938\u093E\u0932"],th:["\u0E1B\u0E35\u0E07\u0E1A\u0E1B\u0E23\u0E30\u0E21\u0E32\u0E13"],fa:["\u0633\u0627\u0644"]},q={hour:{de:["stunde"],fr:["heure"],es:["hora"],pt:["hora"],it:["ora"],pl:["godzina"],cs:["hodina"],sk:["hodina"],sv:["timme"],fi:["tunti"],hu:["\xF3ra"],ro:["ora"],vi:["gi\u1EDD"],ru:["\u0447\u0430\u0441"],uk:["\u0433\u043E\u0434\u0438\u043D\u0430"],el:["\u03CE\u03C1\u03B1"],zh:["\u5C0F\u65F6"],ar:["\u0633\u0627\u0639\u0629"],he:["\u05E9\u05E2\u05D4"],hi:["\u0918\u0902\u091F\u093E"],th:["\u0E0A\u0E31\u0E48\u0E27\u0E42\u0E21\u0E07"],fa:["\u0633\u0627\u0639\u062A"]},weekday:{nl:["weekdag"],de:["wochentag"],sv:["veckodag"],da:["ugedag"],nb:["ukedag"],fi:["viikonp\xE4iv\xE4"],zh:["\u661F\u671F"],ja:["\u66DC\u65E5"],ko:["\uC694\uC77C"]},month:{nl:["maand"],de:["monat"],fr:["mois"],es:["mes"],pt:["m\xEAs"],it:["mese"],pl:["miesi\u0105c"],cs:["m\u011Bs\xEDc"],sk:["mesiac"],sv:["m\xE5nad"],da:["m\xE5ned"],nb:["m\xE5ned"],fi:["kuukausi"],hu:["h\xF3nap"],hr:["mjesec"],id:["bulan"],vi:["th\xE1ng"],ru:["\u043C\u0435\u0441\u044F\u0446"],uk:["\u043C\u0456\u0441\u044F\u0446\u044C"],el:["\u03BC\u03AE\u03BD\u03B1\u03C2"],zh:["\u6708\u4EFD"],ar:["\u0634\u0647\u0631"],he:["\u05D7\u05D5\u05D3\u05E9"],hi:["\u092E\u0939\u0940\u0928\u093E","\u092E\u093E\u0939"],th:["\u0E40\u0E14\u0E37\u0E2D\u0E19"],fa:["\u0645\u0627\u0647"]},quarter:{nl:["kwartaal"],de:["quartal"],fr:["trimestre"],es:["trimestre"],pt:["trimestre"],it:["trimestre"],pl:["kwarta\u0142"],cs:["\u010Dtvrtlet\xED"],sk:["\u0161tvr\u0165rok"],sv:["kvartal"],da:["kvartal"],nb:["kvartal"],fi:["vuosinelj\xE4nnes"],hu:["negyed\xE9v"],tr:["\xE7eyrek"],ro:["trimestru"],hr:["tromjese\u010Dje"],id:["kuartal","triwulan"],vi:["qu\xFD"],ru:["\u043A\u0432\u0430\u0440\u0442\u0430\u043B"],uk:["\u043A\u0432\u0430\u0440\u0442\u0430\u043B"],el:["\u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF"],zh:["\u5B63\u5EA6"],ja:["\u56DB\u534A\u671F"],ko:["\uBD84\uAE30"],ar:["\u0631\u0628\u0639"],he:["\u05E8\u05D1\u05E2\u05D5\u05DF"],hi:["\u0924\u093F\u092E\u093E\u0939\u0940"],th:["\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A"]},week:{de:["woche"],fr:["semaine"],es:["semana"],pt:["semana"],it:["settimana"],pl:["tydzie\u0144"],cs:["t\xFDden"],sk:["t\xFD\u017Ede\u0148"],sv:["vecka"],da:["uge"],nb:["uke"],fi:["viikko"],hu:["h\xE9t"],tr:["hafta"],ro:["s\u0103pt\u0103m\xE2n\u0103"],hr:["tjedan"],id:["minggu"],vi:["tu\u1EA7n"],ru:["\u043D\u0435\u0434\u0435\u043B\u044F"],uk:["\u0442\u0438\u0436\u0434\u0435\u043D\u044C"],el:["\u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1"],ar:["\u0623\u0633\u0628\u0648\u0639"],he:["\u05E9\u05D1\u05D5\u05E2"],hi:["\u0938\u092A\u094D\u0924\u093E\u0939"],th:["\u0E2A\u0E31\u0E1B\u0E14\u0E32\u0E2B\u0E4C"],fa:["\u0647\u0641\u062A\u0647"]},season:{nl:["seizoen"],de:["jahreszeit"],fr:["saison"],es:["temporada"],it:["stagione"],pl:["sezon"],cs:["sez\xF3na"],sk:["sez\xF3na"],sv:["s\xE4song","\xE5rstid"],da:["s\xE6son","\xE5rstid"],nb:["sesong","\xE5rstid"],fi:["vuodenaika"],hu:["\xE9vszak"],tr:["mevsim"],ro:["anotimp"],vi:["m\xF9a"],ru:["\u0441\u0435\u0437\u043E\u043D"],uk:["\u0441\u0435\u0437\u043E\u043D"],el:["\u03B5\u03C0\u03BF\u03C7\u03AE"],zh:["\u5B63\u8282"],ja:["\u5B63\u7BC0"],ko:["\uACC4\uC808"],ar:["\u0645\u0648\u0633\u0645"],he:["\u05E2\u05D5\u05E0\u05D4"],hi:["\u092E\u094C\u0938\u092E"],th:["\u0E24\u0E14\u0E39"],fa:["\u0641\u0635\u0644"]}},ee=["\xE5r","\xE9v","h\xE9t","\xF3ra"];function re(e,r,t){let n=p(t);if(!n)return null;let o=r.normalize("NFC").toLowerCase(),s=x(e).words;return s.includes(o)?"word":n.compounds&&s.some(i=>D(i,o,R))?"suffix":null}function O(e,r){let t=String(e??"");if(!t.trim())return null;for(let[n,o]of Object.entries(r))for(let s of o){let i=ee.includes(s)?re(t,s,n):j(t,s,n);if(i)return{lang:n,word:s,view:i}}return null}function z(e){return O(e,J)}function N(e){let r=null;for(let t of Object.keys(q)){let n=O(e,q[t]);if(n){if(r&&r.concept!==t)return null;r={concept:t,hit:n}}}return r}var ne=Object.freeze({quarter:4,half:2,week:53}),h={quarter:{en:{words:["quarter #","qtr #"],codes:["q #"]},nl:{words:["kwartaal #","# kwartaal","#e kwartaal","@ kwartaal"],codes:["k #"]},de:{words:["quartal #","# quartal","@ quartal"]},fr:{words:["trimestre #","# trimestre","#er trimestre","#e trimestre","#eme trimestre","@ trimestre"],codes:["t #","# t","trim. #"]},es:{words:["trimestre #","# trimestre","#er trimestre","#o trimestre","#\xBA trimestre","#\xB0 trimestre","@ trimestre"],codes:["t #","# t","trim. #"]},pt:{words:["trimestre #","# trimestre","#o trimestre","#\xBA trimestre","#\xB0 trimestre","@ trimestre"],codes:["t #","# t","#\xBA t","trim. #"]},it:{words:["trimestre #","# trimestre","#\xBA trimestre","#\xB0 trimestre","% trimestre","@ trimestre"],codes:["t #","trim. #"]},pl:{words:["kwarta\u0142 #","# kwarta\u0142","% kwarta\u0142","@ kwarta\u0142","# kw.","% kw."]},cs:{words:["\u010Dtvrtlet\xED #","# \u010Dtvrtlet\xED","% \u010Dtvrtlet\xED","@ \u010Dtvrtlet\xED"]},sk:{words:["\u0161tvr\u0165rok #","# \u0161tvr\u0165rok","% \u0161tvr\u0165rok","@ \u0161tvr\u0165rok"]},sv:{words:["kvartal #","# kvartalet","#:a kvartalet","#:e kvartalet","@ kvartalet"],codes:["k #"]},da:{words:["kvartal #","# kvartal","@ kvartal"],codes:["k #"]},nb:{words:["kvartal #","# kvartal","@ kvartal"],codes:["k #"]},fi:{words:["nelj\xE4nnes #","# nelj\xE4nnes","# vuosinelj\xE4nnes","vuosinelj\xE4nnes #"]},hu:{words:["negyed\xE9v #","# negyed\xE9v","% negyed\xE9v"]},tr:{words:["\xE7eyrek #","# \xE7eyrek","@ \xE7eyrek"],codes:["\xE7 #"]},ro:{words:["trimestrul #","trimestrul %","trimestru #"],codes:["t #"]},hr:{words:["tromjese\u010Dje #","# tromjese\u010Dje","% tromjese\u010Dje","kvartal #","# kvartal"]},id:{words:["kuartal #","kuartal %","kuartal ke #","triwulan #","triwulan %","triwulan ke #"],codes:["tw #","tw %"]},vi:{words:["qu\xFD #","qu\xFD %"]},ru:{words:["\u043A\u0432\u0430\u0440\u0442\u0430\u043B #","# \u043A\u0432\u0430\u0440\u0442\u0430\u043B","% \u043A\u0432\u0430\u0440\u0442\u0430\u043B","@ \u043A\u0432\u0430\u0440\u0442\u0430\u043B","# \u043A\u0432.","% \u043A\u0432."]},uk:{words:["\u043A\u0432\u0430\u0440\u0442\u0430\u043B #","# \u043A\u0432\u0430\u0440\u0442\u0430\u043B","% \u043A\u0432\u0430\u0440\u0442\u0430\u043B","@ \u043A\u0432\u0430\u0440\u0442\u0430\u043B","# \u043A\u0432.","% \u043A\u0432."]},el:{words:["\u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF #","# \u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF","#\u03BF \u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF","@ \u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF"]},zh:{words:["\u7B2C#\u5B63\u5EA6","\u7B2C@\u5B63\u5EA6","@\u5B63\u5EA6","#\u5B63\u5EA6"]},ja:{words:["\u7B2C#\u56DB\u534A\u671F","\u7B2C@\u56DB\u534A\u671F","#\u56DB\u534A\u671F"],codes:["# q"]},ko:{words:["#\uBD84\uAE30","#/4\uBD84\uAE30"]},ar:{words:["\u0627\u0644\u0631\u0628\u0639 #","\u0627\u0644\u0631\u0628\u0639 @","\u0631\u0628\u0639 #"]},he:{words:["\u05E8\u05D1\u05E2\u05D5\u05DF #","\u05E8\u05D1\u05E2\u05D5\u05DF @"]},hi:{words:["\u0924\u093F\u092E\u093E\u0939\u0940 #","# \u0924\u093F\u092E\u093E\u0939\u0940","@ \u0924\u093F\u092E\u093E\u0939\u0940"]},th:{words:["\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A #","\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A\u0E17\u0E35\u0E48 #"]}},half:{en:{words:["half #"],codes:["h #"]},nl:{words:["halfjaar #","# halfjaar","@ halfjaar"]},de:{words:["halbjahr #","# halbjahr","@ halbjahr"],codes:["hj #"]},fr:{words:["semestre #","# semestre","#er semestre","#e semestre","#eme semestre","@ semestre"],codes:["s #"]},es:{words:["semestre #","# semestre","#er semestre","#o semestre","#\xBA semestre","#\xB0 semestre","@ semestre"],codes:["s #","# s"]},pt:{words:["semestre #","# semestre","#o semestre","#\xBA semestre","#\xB0 semestre","@ semestre"],codes:["s #","# s"]},it:{words:["semestre #","# semestre","#\xBA semestre","#\xB0 semestre","% semestre","@ semestre"],codes:["s #"]},pl:{words:["p\xF3\u0142rocze #","# p\xF3\u0142rocze","% p\xF3\u0142rocze","@ p\xF3\u0142rocze"]},cs:{words:["pololet\xED #","# pololet\xED","% pololet\xED","@ pololet\xED"]},sk:{words:["polrok #","# polrok","% polrok"]},sv:{words:["halv\xE5r #","# halv\xE5ret","@ halv\xE5ret"]},da:{words:["halv\xE5r #","# halv\xE5r","@ halv\xE5r"]},nb:{words:["halv\xE5r #","# halv\xE5r","@ halv\xE5r"]},fi:{words:["vuosipuolisko #","# vuosipuolisko"]},hu:{words:["f\xE9l\xE9v #","# f\xE9l\xE9v","% f\xE9l\xE9v"]},tr:{words:["yar\u0131y\u0131l #","# yar\u0131y\u0131l","@ yar\u0131y\u0131l"]},ro:{words:["semestrul #","semestrul %"],codes:["s #"]},hr:{words:["polugodi\u0161te #","# polugodi\u0161te","% polugodi\u0161te"]},id:{words:["semester #","semester %"]},ru:{words:["\u043F\u043E\u043B\u0443\u0433\u043E\u0434\u0438\u0435 #","# \u043F\u043E\u043B\u0443\u0433\u043E\u0434\u0438\u0435","% \u043F\u043E\u043B\u0443\u0433\u043E\u0434\u0438\u0435","@ \u043F\u043E\u043B\u0443\u0433\u043E\u0434\u0438\u0435"]},uk:{words:["\u043F\u0456\u0432\u0440\u0456\u0447\u0447\u044F #","# \u043F\u0456\u0432\u0440\u0456\u0447\u0447\u044F","% \u043F\u0456\u0432\u0440\u0456\u0447\u0447\u044F","@ \u043F\u0456\u0432\u0440\u0456\u0447\u0447\u044F"]},el:{words:["\u03B5\u03BE\u03AC\u03BC\u03B7\u03BD\u03BF #","# \u03B5\u03BE\u03AC\u03BC\u03B7\u03BD\u03BF","#\u03BF \u03B5\u03BE\u03AC\u03BC\u03B7\u03BD\u03BF","@ \u03B5\u03BE\u03AC\u03BC\u03B7\u03BD\u03BF"]},zh:{words:["\u4E0A\u534A\u5E74=1","\u4E0B\u534A\u5E74=2"]},ja:{words:["\u4E0A\u671F=1","\u4E0B\u671F=2","\u4E0A\u534A\u671F=1","\u4E0B\u534A\u671F=2"]},ko:{words:["\uC0C1\uBC18\uAE30=1","\uD558\uBC18\uAE30=2"]},ar:{words:["\u0627\u0644\u0646\u0635\u0641 @"]},he:{words:["\u05D7\u05E6\u05D9\u05D5\u05DF #"]},hi:{words:["\u091B\u092E\u093E\u0939\u0940 #","@ \u091B\u092E\u093E\u0939\u0940"]},th:{words:["\u0E04\u0E23\u0E36\u0E48\u0E07\u0E1B\u0E35\u0E41\u0E23\u0E01=1","\u0E04\u0E23\u0E36\u0E48\u0E07\u0E1B\u0E35\u0E2B\u0E25\u0E31\u0E07=2"]}},week:{en:{words:["week #","wk #"],codes:["w #"]},de:{words:["woche #","# woche","kw #"]},fr:{words:["semaine #","sem. #"],codes:["s #"]},es:{words:["semana #","sem. #"],codes:["s #"]},pt:{words:["semana #","sem. #"],codes:["s #"]},it:{words:["settimana #","sett. #"]},pl:{words:["tydzie\u0144 #","# tydzie\u0144","tydz. #"]},cs:{words:["t\xFDden #","# t\xFDden"]},sk:{words:["t\xFD\u017Ede\u0148 #","# t\xFD\u017Ede\u0148"]},sv:{words:["vecka #"],codes:["v #"]},da:{words:["uge #"]},nb:{words:["uke #"]},fi:{words:["viikko #","vko #","vk #"]},hu:{words:["h\xE9t #","# h\xE9t"]},tr:{words:["hafta #","# hafta"]},ro:{words:["s\u0103pt\u0103m\xE2na #"]},hr:{words:["tjedan #","# tjedan"]},id:{words:["minggu #","minggu ke #"]},vi:{words:["tu\u1EA7n #"]},ru:{words:["\u043D\u0435\u0434\u0435\u043B\u044F #","# \u043D\u0435\u0434\u0435\u043B\u044F","\u043D\u0435\u0434. #"]},uk:{words:["\u0442\u0438\u0436\u0434\u0435\u043D\u044C #","# \u0442\u0438\u0436\u0434\u0435\u043D\u044C","\u0442\u0438\u0436. #"]},el:{words:["\u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1 #","# \u03B5\u03B2\u03B4\u03BF\u03BC\u03AC\u03B4\u03B1"]},zh:{words:["\u7B2C#\u5468"]},ja:{words:["\u7B2C#\u9031"]},ko:{words:["#\uC8FC","#\uC8FC\uCC28"]},ar:{words:["\u0627\u0644\u0623\u0633\u0628\u0648\u0639 #","\u0623\u0633\u0628\u0648\u0639 #"]},he:{words:["\u05E9\u05D1\u05D5\u05E2 #"]},hi:{words:["\u0938\u092A\u094D\u0924\u093E\u0939 #"]},th:{words:["\u0E2A\u0E31\u0E1B\u0E14\u0E32\u0E2B\u0E4C #","\u0E2A\u0E31\u0E1B\u0E14\u0E32\u0E2B\u0E4C\u0E17\u0E35\u0E48 #"]}}},G={nl:[["eerste"],["tweede"],["derde"],["vierde"]],de:[["erstes","erste"],["zweites","zweite"],["drittes","dritte"],["viertes","vierte"]],fr:[["premier"],["deuxi\xE8me","second"],["troisi\xE8me"],["quatri\xE8me"]],es:[["primer","primero"],["segundo"],["tercer","tercero"],["cuarto"]],pt:[["primeiro"],["segundo"],["terceiro"],["quarto"]],it:[["primo"],["secondo"],["terzo"],["quarto"]],pl:[["pierwszy","pierwsze"],["drugi","drugie"],["trzeci","trzecie"],["czwarty","czwarte"]],cs:[["prvn\xED"],["druh\xE9","druh\xFD"],["t\u0159et\xED"],["\u010Dtvrt\xE9","\u010Dtvrt\xFD"]],sk:[["prv\xFD"],["druh\xFD"],["tret\xED"],["\u0161tvrt\xFD"]],sv:[["f\xF6rsta"],["andra"],["tredje"],["fj\xE4rde"]],da:[["f\xF8rste"],["andet","anden"],["tredje"],["fjerde"]],nb:[["f\xF8rste"],["andre"],["tredje"],["fjerde"]],tr:[["birinci","ilk"],["ikinci"],["\xFC\xE7\xFCnc\xFC"],["d\xF6rd\xFCnc\xFC"]],ru:[["\u043F\u0435\u0440\u0432\u044B\u0439","\u043F\u0435\u0440\u0432\u043E\u0435"],["\u0432\u0442\u043E\u0440\u043E\u0439","\u0432\u0442\u043E\u0440\u043E\u0435"],["\u0442\u0440\u0435\u0442\u0438\u0439","\u0442\u0440\u0435\u0442\u044C\u0435"],["\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u044B\u0439","\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043E\u0435"]],uk:[["\u043F\u0435\u0440\u0448\u0438\u0439","\u043F\u0435\u0440\u0448\u0435"],["\u0434\u0440\u0443\u0433\u0438\u0439","\u0434\u0440\u0443\u0433\u0435"],["\u0442\u0440\u0435\u0442\u0456\u0439","\u0442\u0440\u0435\u0442\u0454"],["\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0438\u0439","\u0447\u0435\u0442\u0432\u0435\u0440\u0442\u0435"]],el:[["\u03C0\u03C1\u03CE\u03C4\u03BF"],["\u03B4\u03B5\u03CD\u03C4\u03B5\u03C1\u03BF"],["\u03C4\u03C1\u03AF\u03C4\u03BF"],["\u03C4\u03AD\u03C4\u03B1\u03C1\u03C4\u03BF"]],zh:[["\u4E00"],["\u4E8C"],["\u4E09"],["\u56DB"]],ja:[["\u4E00"],["\u4E8C"],["\u4E09"],["\u56DB"]],ar:[["\u0627\u0644\u0623\u0648\u0644"],["\u0627\u0644\u062B\u0627\u0646\u064A"],["\u0627\u0644\u062B\u0627\u0644\u062B"],["\u0627\u0644\u0631\u0627\u0628\u0639"]],he:[["\u05E8\u05D0\u05E9\u05D5\u05DF"],["\u05E9\u05E0\u05D9"],["\u05E9\u05DC\u05D9\u05E9\u05D9"],["\u05E8\u05D1\u05D9\u05E2\u05D9"]],hi:[["\u092A\u0939\u0932\u0940","\u092A\u0939\u0932\u093E"],["\u0926\u0942\u0938\u0930\u0940","\u0926\u0942\u0938\u0930\u093E"],["\u0924\u0940\u0938\u0930\u0940","\u0924\u0940\u0938\u0930\u093E"],["\u091A\u094C\u0925\u0940","\u091A\u094C\u0925\u093E"]]},te=["\xE7 #"],oe=String.raw`[\s\-_./]*`,se={i:1,ii:2,iii:3,iv:4};function g(e,r){let t=String(e??"").normalize("NFC").toLowerCase();return r||(t=_(t)),t.replace(/[\s_]+/g," ").trim().replace(/\.+$/,"").trim()}function L(e){return/[.*+?^${}()|[\]\\]/.test(e)?"\\"+e:e}function E(e,r,t,n){let s=!!p(r)?.foldSensitive||te.includes(e),i=e,a=null,d=/=(\d+)$/.exec(i);d&&(a=Number(d[1]),i=i.slice(0,d.index));let u=(G[r]??[]).map(m=>m.map(w=>g(w,s))),c=a!==null?{kind:"fixed",n:a}:{kind:"digits"},l="";for(let m of g(i,s))if(m==="#")l+="([0-9]{1,2})",c={kind:"digits"};else if(m==="%")l+="(iv|iii|ii|i)",c={kind:"roman"};else if(m==="@"){let w=u.flat().sort((k,Z)=>Z.length-k.length).map(k=>[...k].map(L).join(""));l+="("+w.join("|")+")",c={kind:"ordinal",words:u}}else m===" "?l+=oe:m==="."?l+="\\.?":l+=L(m);return{lang:r,grain:t,form:n,unfold:s,re:new RegExp("^"+l+"$","u"),number:c}}var b=null;function ae(){if(b)return b;let e=[];for(let r of Object.keys(h))for(let[t,n]of Object.entries(h[r])){for(let o of n.words??[])e.push(E(o,t,r,"word"));for(let o of n.codes??[])e.push(E(o,t,r,"code"))}return b=e,e}var I=/^[0-9]+$/,P=/^[0-9]/,A=/[0-9]$/,ie=/^[\s\-_./,']*/,le=/[\s\-_./,']*$/,de=/^(年|년)/u;function T(e){if(e.length===4){let r=Number(e);return r>=1900&&r<=2099?r:null}return 2e3+Number(e)}function F(e){let r=[{body:e,year:null,yearDigits:0}];for(let t of[4,2]){if(e.length<=t)continue;let n=e.slice(0,t);if(I.test(n)&&!P.test(e.slice(t))){let i=e.slice(t),a=de.exec(i),d=a?i.slice(a[0].length):i,u=ie.exec(d)[0],c=d.slice(u.length),l=T(n);c&&l!==null&&(a||u||!P.test(c))&&r.push({body:c,year:l,yearDigits:t})}let o=e.slice(e.length-t),s=e.slice(0,e.length-t);if(I.test(o)&&!A.test(s)){let i=le.exec(s)[0],a=s.slice(0,s.length-i.length),d=T(o);a&&d!==null&&(i||!A.test(a))&&r.push({body:a,year:d,yearDigits:t})}}return r}var y=null;function ce(){if(y)return y;let e=new Set;for(let[r,t]of Object.entries(G)){let n=!!p(r)?.foldSensitive;for(let o of t)for(let s of o)e.add(g(s,!1)),n&&e.add(g(s,!0))}for(let r of Object.keys(h))for(let t of Object.values(h[r]))for(let n of t?.words??[]){let o=/=[0-9]+$/.exec(n);o&&e.add(g(n.slice(0,o.index),!1))}return y=[...e],y}var ue=/[0-9]/,me=/(^|[^\p{L}])(iv|iii|ii|i)([^\p{L}]|$)/u;function V(e){return ue.test(e)||me.test(e)?!0:ce().some(r=>e.includes(r))}function fe(e,r){switch(e.number.kind){case"fixed":return e.number.n;case"digits":return r[1]===void 0?null:Number(r[1]);case"roman":return r[1]===void 0?null:se[r[1]]??null;case"ordinal":{let t=r[1],n=e.number.words.findIndex(o=>o.includes(t));return n<0?null:n+1}}}function ge(e){let r=String(e??"");if(!r.trim()||r.length>40)return[];let t=g(r,!1),n=g(r,!0);if(!V(t)&&!V(n))return[];let o=F(t),s=F(n),i=[],a=new Set;for(let d of ae()){let u=d.lang+"|"+d.grain;if(!a.has(u))for(let c of d.unfold?s:o){let l=d.re.exec(c.body);if(!l)continue;let m=fe(d,l);if(!(m===null||m<1||m>ne[d.grain])){i.push({lang:d.lang,grain:d.grain,n:m,year:c.year,yearDigits:c.yearDigits,form:d.form}),a.add(u);break}}}return i}function W(e,r=()=>!0){if(e.length===0)return null;let t=e.map(n=>ge(n).filter(r));if(t.some(n=>n.length===0))return null;for(let n of Object.keys(h))for(let o of Object.keys(h[n])){let s=[],i=0;for(let a of t){let d=a.find(l=>l.grain===n&&l.lang===o),c=a.find(l=>l.grain===n&&l.lang==="en")??d;if(!c)break;c.lang===o&&i++,s.push(c)}if(s.length===e.length&&(o==="en"||i>0))return{lang:o,grain:n,readings:s}}return null}var K=[{name:"likert7_agreement",minMatches:5,canonical:["strongly disagree","disagree","slightly disagree","neutral","slightly agree","agree","strongly agree"]},{name:"likert5_agreement",minMatches:3,canonical:["strongly disagree","disagree","neutral","agree","strongly agree"]},{name:"likert3_agreement",minMatches:2,canonical:["disagree","neutral","agree"]},{name:"likert5_satisfaction",minMatches:3,canonical:["very dissatisfied","dissatisfied","neutral","satisfied","very satisfied"]},{name:"likert3_satisfaction",minMatches:2,canonical:["dissatisfied","neutral","satisfied"]},{name:"likert5_quality",minMatches:3,canonical:["poor","fair","good","very good","excellent"]},{name:"likert3_quality",minMatches:2,canonical:["poor","fair","good"]},{name:"frequency5",minMatches:3,canonical:["never","rarely","sometimes","often","always"]},{name:"intensity5",minMatches:3,canonical:["not at all","slightly","moderately","very","extremely"]},{name:"importance5",minMatches:3,canonical:["not important","slightly important","moderately important","very important","extremely important"]},{name:"severity_low_critical",minMatches:3,canonical:["low","medium","high","critical"]},{name:"severity_low_urgent",minMatches:3,canonical:["low","medium","high","urgent"]},{name:"severity_none_critical",minMatches:3,canonical:["none","mild","moderate","severe","critical"]},{name:"priority_p4_p1",minMatches:3,canonical:["p4","p3","p2","p1","p0"]},{name:"severity_trivial_blocker",minMatches:3,canonical:["trivial","minor","major","critical","blocker"]},{name:"severity_minor_severe",minMatches:3,canonical:["minor","moderate","major","severe"]},{name:"magnitude5_medium",minMatches:3,canonical:["very low","low","medium","high","very high"]},{name:"magnitude5_moderate",minMatches:3,canonical:["very low","low","moderate","high","very high"]},{name:"speed5",minMatches:3,canonical:["very slow","slow","moderate","fast","very fast"]},{name:"temperature6",minMatches:3,canonical:["freezing","cold","cool","mild","warm","hot"]},{name:"experience6",minMatches:3,canonical:["novice","beginner","intermediate","advanced","expert","master"]},{name:"tier_metal",minMatches:3,canonical:["bronze","silver","gold","platinum","diamond"]},{name:"tshirt_letter_sizes",minMatches:4,canonical:["xxs","xs","s","m","l","xl","xxl","xxxl"]},{name:"tshirt_word_sizes",minMatches:3,canonical:["extra small","small","medium","large","extra large"]},{name:"nps_bands",minMatches:2,canonical:["detractor","passive","promoter"]},{name:"likelihood5",minMatches:3,canonical:["very unlikely","unlikely","neutral","likely","very likely"]},{name:"education",minMatches:3,canonical:["none","primary","secondary","bachelors","masters","doctoral"]},{name:"grades_a_to_f",minMatches:3,canonical:["a","b","c","d","f"]},{name:"grades_a_to_f_plusminus",minMatches:4,canonical:["a+","a","a-","b+","b","b-","c+","c","c-","d+","d","d-","f"]}],he={seldom:"rarely",infrequently:"rarely","hardly ever":"rarely",occasionally:"sometimes",periodically:"sometimes","now and then":"sometimes",frequently:"often",frequent:"often",regularly:"often",commonly:"often",usually:"often",constantly:"always","every time":"always","all the time":"always",consistently:"always",continually:"always",bad:"poor",weak:"poor",subpar:"poor",mediocre:"fair",passable:"fair","so so":"fair",decent:"good",solid:"good",outstanding:"excellent",superb:"excellent",exceptional:"excellent",stellar:"excellent",unsatisfied:"dissatisfied",unhappy:"dissatisfied",displeased:"dissatisfied",happy:"satisfied",content:"satisfied",pleased:"satisfied",delighted:"very satisfied","highly satisfied":"very satisfied","extremely satisfied":"very satisfied","highly dissatisfied":"very dissatisfied","extremely dissatisfied":"very dissatisfied",neither:"neutral",undecided:"neutral","no opinion":"neutral","neither agree nor disagree":"neutral","completely agree":"strongly agree","totally agree":"strongly agree","completely disagree":"strongly disagree","totally disagree":"strongly disagree","highly unlikely":"very unlikely","extremely unlikely":"very unlikely","highly likely":"very likely","extremely likely":"very likely","almost certain":"very likely",bachelor:"bachelors","bachelor's":"bachelors",undergraduate:"bachelors","bachelor degree":"bachelors","master's":"masters",graduate:"masters","master degree":"masters",doctorate:"doctoral",phd:"doctoral"},pe=(()=>{let e=new Set;for(let r of K)for(let t of r.canonical)e.add(f(t));return e})(),ye=(()=>{let e=new Map;for(let[r,t]of Object.entries(he)){let n=f(r);pe.has(n)||e.has(n)||e.set(n,f(t))}return e})();function U(e){return ye.get(e)??e}var we=new Set(["hour","hr","day","dow","dom","weekday","week","wk","woy","month","mth","quarter","qtr","year","yr","semester","trimester","decade","period","fiscal","fy","rank","level","lvl","tier","grade","band","decile","percentile","quartile","quintile","score","rating","stars","step","stage","phase","round","wave","episode","chapter","age","cohort","generation","seniority","position","sequence","seq","priority"]);function $e(e){if(!e)return!1;for(let r of M(e))if(we.has(r))return!0;return N(e)!==null||z(e)!==null}function f(e){return e.toLowerCase().replace(/[-_]+/g," ").replace(/\s+/g," ").trim()}function X(e){return S(e.normalize("NFD").replace(/\p{Diacritic}/gu,""))}function ke(e){let r=new Map;for(let[t,n]of e){let o=X(t);if(!o)continue;let s=r.get(o);r.set(o,s===void 0||s===n?n:-1)}return r}function v(e){let r=new Map;for(let[t,n]of e)for(let o of t)r.set(f(o),n);return r}var C=[{name:"weekday_mon_sun",minMatches:4,dict:v([[["monday","mon"],0],[["tuesday","tue","tues"],1],[["wednesday","wed","weds"],2],[["thursday","thu","thur","thurs","thr"],3],[["friday","fri"],4],[["saturday","sat"],5],[["sunday","sun"],6]])},{name:"month_jan_dec",minMatches:4,dict:v([[["january","jan"],0],[["february","feb"],1],[["march","mar"],2],[["april","apr"],3],[["may"],4],[["june","jun"],5],[["july","jul"],6],[["august","aug"],7],[["september","sep","sept"],8],[["october","oct"],9],[["november","nov"],10],[["december","dec"],11]])},{name:"quarter_q1_q4",minMatches:3,dict:v([[["q1","qtr 1","qtr1","quarter 1","q 1"],0],[["q2","qtr 2","qtr2","quarter 2","q 2"],1],[["q3","qtr 3","qtr3","quarter 3","q 3"],2],[["q4","qtr 4","qtr4","quarter 4","q 4"],3]])}],Y={};function be(e){let r=e||"";if(!r)return{weekday:new Map,month:new Map};let t=Y[r];if(t)return t;let n=new Map,o=new Map,s=(a,d,u)=>{let c=f(d);c&&a.set(c,u);let l=f(d.replace(/\./g,""));l&&l!==c&&a.set(l,u)};try{let a=new Intl.DateTimeFormat(r,{weekday:"long",timeZone:"UTC"}),d=new Intl.DateTimeFormat(r,{weekday:"short",timeZone:"UTC"});for(let l=0;l<7;++l){let m=new Date(Date.UTC(2024,0,1+l));s(n,a.format(m),l),s(n,d.format(m),l)}let u=new Intl.DateTimeFormat(r,{month:"long"}),c=new Intl.DateTimeFormat(r,{month:"short"});for(let l=0;l<12;++l){let m=new Date(Date.UTC(2020,l,15));s(o,u.format(m),l),s(o,c.format(m),l)}}catch{}let i={weekday:n,month:o};return Y[r]=i,i}function $(e,r){if(r.size===0)return e;let t=new Map(e);for(let[n,o]of r)t.has(n)||t.set(n,o);return t}function ve(e,r){let t=be(r);for(let n of C){let o=n.name==="weekday_mon_sun"?$(n.dict,t.weekday):n.name==="month_jan_dec"?$(n.dict,t.month):n.dict,s=!0,i=null,a=new Map;for(let[u,c]of e){let l=o.get(u);if(l===void 0){i=i??ke(o);let m=i.get(X(u));l=m===void 0||m<0?void 0:m}if(l===void 0){s=!1;break}a.has(l)||a.set(l,c)}if(!s||a.size<n.minMatches)continue;let d=[...a.entries()].sort((u,c)=>u[0]-c[0]).map(u=>u[1]);return{pattern:n.name,orderedDomain:d}}return Ce(e)}var H=C.find(e=>e.name==="quarter_q1_q4");function Ce(e){let r=[...e.values()],t=W(r,s=>s.grain==="quarter"&&s.year===null&&(s.lang==="en"||s.form==="word"));if(!t||t.lang==="en")return null;let n=new Map;if(t.readings.forEach((s,i)=>{n.has(s.n)||n.set(s.n,r[i])}),n.size<H.minMatches)return null;let o=[...n.entries()].sort((s,i)=>s[0]-i[0]).map(s=>s[1]);return{pattern:H.name,orderedDomain:o}}function B(e){let r=new Map;for(let t of e){if(t==null)continue;let n=String(t);if(n.length===0)continue;let o=f(n);r.has(o)||r.set(o,n)}return r}var _e=15,Me=10,xe=(()=>{let e=["xxs","xs","s","sm","small","m","med","medium","l","lg","large","xl","xlarge","xxl","xxxl","2xl","3xl","4xl","y","n","yes","no","t","f","true","false","na","n/a","n a","none","null","unknown","other","all","both","low","medium","med","high","very low","very high","minimal","critical","urgent"],r=new Set(e.map(f));for(let t of C)for(let n of t.dict.keys())r.add(n);return r})();function Re(e){let r=e.trim();return r.length===0||r.length>Me||(r.match(/\p{L}/gu)||[]).length>1?!1:/\p{Nd}/u.test(r)}function De(e){let r=e.trim();return r.length===1&&/[\p{L}\p{Nd}]/u.test(r)}function He(e){if(!e||e.length===0)return null;let r=new Set,t=[];for(let n of e){if(n==null)continue;let o=String(n);if(r.has(o))continue;let s=f(o);if(!(s===""||xe.has(s)||Re(o)||De(o))||(r.add(o),t.push(o),t.length>_e))return null}return t.length>0?t:null}var je=/^(\p{L}{0,3}) ?([0-9]+)\s*[-–—:.)]\s*(.+)$/u;function Se(e){let r=null,t=new Set,n=[];for(let o of e.values()){let s=je.exec(o.trim());if(!s)return null;let i=s[1].toLowerCase();if(r===null)r=i;else if(i!==r)return null;let a=Number(s[2]);if(t.has(a)||f(s[3])==="")return null;t.add(a),n.push({code:a,original:o,label:s[3]})}return n}function qe(e,r){let t=Q(B(e.map(a=>a.label)),r);if(t===null)return;if(t.orderedDomain.length!==e.length)return null;let n=new Map;for(let a of e)n.set(a.label,a);let o=t.orderedDomain.map(a=>n.get(a));if(o.some(a=>a===void 0))return null;let s=!0,i=!0;for(let a=1;a<o.length;++a)o[a].code<=o[a-1].code&&(s=!1),o[a].code>=o[a-1].code&&(i=!1);return!s&&!i?null:{pattern:t.pattern,orderedDomain:o.map(a=>a.original)}}function Ke(e,r){if(!e||e.length<2)return null;let t=B(e);if(t.size<2)return null;let n=Se(t);if(n!==null){let s=qe(n,r);if(s!==void 0)return s}let o=Q(t,r);return o!==null?o:n!==null?Le(t):null}var Oe=/^([0-9]+)\s*(?:\.|\)|-)\s*([^\s\d].*)$/u,ze=3,Ne=20;function Le(e){if(e.size<ze||e.size>Ne)return null;let r=new Set,t=[];for(let n of e.values()){let o=Oe.exec(n.trim());if(!o||f(o[2])==="")return null;let s=Number(o[1]);if(r.has(s))return null;r.add(s),t.push({n:s,original:n})}return t.sort((n,o)=>n.n-o.n),{pattern:"numeric_rank_prefix",orderedDomain:t.map(n=>n.original)}}function Q(e,r){let t=new Map;for(let[o,s]of e){let i=U(o);t.has(i)||t.set(i,s)}let n=null;for(let o of K){let s=[];for(let u of o.canonical){let c=t.get(u);c!==void 0&&s.push(c)}if(s.length<o.minMatches)continue;let i=new Set(o.canonical),a=!0;for(let u of e.keys())if(!i.has(U(u))){a=!1;break}if(!a)continue;let d;n===null||s.length>n.matched||s.length===n.matched&&o.canonical.length<n.pattern.canonical.length?d=!0:d=!1,d&&(n={pattern:o,matched:s.length,orderedDomain:s})}return n?{pattern:n.pattern.name,orderedDomain:n.orderedDomain}:ve(e,r)}export{Pe as a,J as b,q as c,O as d,z as e,N as f,ne as g,h,G as i,te as j,ge as k,W as l,$e as m,He as n,Ke as o};