@bicharts/shape-core 0.6.113 → 0.6.115

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
2
- import{a as br,b as Er}from"./chunk-HIVICMC5.mjs";import{a as Tr,b as M,c as Sr,d as D,e as E,f as Rr,g as J,h as Z}from"./chunk-4J7WPYLM.mjs";import{a as yr,b as hr,c as Cr}from"./chunk-755USHC4.mjs";import{A as Hn,B as Kn,C as Bn,D as jn,E as Yn,F as Qn,G as Xn,H as Jn,I as Zn,J as er,K as tr,L as nr,M as rr,N as or,O as ir,P as sr,Q as ar,R as lr,S as ur,T as cr,U as dr,V as mr,W as fr,X as pr,Z as gr,a as pn,b as gn,c as yn,d as hn,e as Cn,g as wn,h as _n,i as On,j as An,k as Pn,l as Ln,m as vn,n as Mn,o as In,p as Nn,q as Fn,r as Dn,s as kn,t as Gn,u as Vn,v as Wn,w as Un,x as qn,y as $n,z as zn}from"./chunk-QAGRGHJI.mjs";import{a as bn}from"./chunk-U3H6UBOO.mjs";import{b as En,c as Tn,d as Sn,f as Rn,g as xn}from"./chunk-TZ74QIKA.mjs";import{a as de,c as me,e as cn,f as dn,g as mn,h as fn}from"./chunk-YDYFP2T4.mjs";import{A as Q,B as Zt,C as en,D as ce,E as I,F as tn,G as nn,H as rn,I as U,J as on,K as sn,L as an,M as ln,N as X,O as un,a as v,b as G,c as j,d as V,j as W,k as Vt,l as Wt,m as Ut,n as qt,o as $t,q as zt,r as Ht,s as Y,t as Kt,u as Bt,v as jt,w as Yt,x as Qt,y as Xt,z as Jt}from"./chunk-DTBXJVUG.mjs";import"./chunk-5MRZID36.mjs";import{a as Et,b as Tt,c as St,d as Rt,e as xt,f as wt,g as _t,h as Ot,i as At,j as Pt,k as Lt,l as vt,m as Dt,n as kt,o as Gt}from"./chunk-3ZAS32F5.mjs";import{b as Mt,c as It,d as Nt,e as Ft}from"./chunk-5HI6TVMM.mjs";import{A as gt,B as yt,C as ht,D as Ct,E as bt,a as He,b as Ke,c as Be,d as je,e as Ye,f as Qe,g as Xe,h as Je,i as Ze,j as et,k as tt,l as nt,m as rt,n as ot,o as it,q as B,r as st,s as at,t as lt,u as ut,v as ct,w as dt,x as mt,y as ft,z as pt}from"./chunk-CZJ7M6A5.mjs";import{a as Ve,b as We,c as Ue,d as qe,e as $e,f as K,g as ze}from"./chunk-WC4JINEZ.mjs";var ee=2,ge=400;function ne(e){return!!W(e)}function F(e){let t=new Set;for(let n of e){if(n==null)continue;let o=V(String(n));if(!G(o)&&!t.has(o)&&(t.add(o),t.size>=ge))break}return Array.from(t)}function N(e){let t=F(e);if(t.length===0||re(e)<95)return!1;let n=t.filter(a=>ne(a)&&!I(a)).length,o=t.filter(a=>!ne(a)&&!!I(a)).length;return n>=1&&n>=o}function fe(e,t){if(!I(e))return!1;let n=W(e);return n?t==="world"?!0:ce.has(n):!1}function re(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let o of t)ne(o)&&n++;return Math.round(n/t.length*1e3)/10}function oe(e){return I(e)?!0:Y()?Q(e).status!=="unmatched"||Q(e.trim().replace(/\s+/g,"-")).status!=="unmatched":!1}function q(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let o of t)oe(o)&&n++;return Math.round(n/t.length*1e3)/10}function se(e){let t=new Set;for(let n of e){if(n==null)continue;let o=String(n).trim();if(!G(V(o))&&!t.has(o)&&(t.add(o),t.size>=ge))break}return Array.from(t)}function ie(e){let t=se(e);if(t.length===0)return 0;let n=0;for(let o of t)U(o).length>0&&n++;return Math.round(n/t.length*1e3)/10}function pe(e,t){return me(t,de)?!0:se(e).some(n=>/^\d{5}(-\d{4})?$/.test(n.replace(/\.0+$/,"")))}function xr(e,t){let n=F(e);if(n.length===0)return 0;let o=0;for(let a of n)X(a,t)&&o++;return Math.round(o/n.length*1e3)/10}function te(e,t){let n=0;for(let o of F(e))t(o)&&n++;return n}function wr(e,t){let n=0;for(let o of se(e))t(o)&&n++;return n}function _r(e,t,n,o,a){let u=[],l=[],i={},y={},h=new Set(e),b=s=>t.map(d=>d[s]);for(let s of["city","country"]){let d=n?.[s];d&&h.has(d)&&(i[s]=d)}let g=new Set(a??e);for(let s of["lat","lon"]){let d=n?.[s];d&&g.has(d)&&(i[s]=d)}let f=n?.zip;if(f&&h.has(f)){let s=b(f),d=ie(s);d<95?l.push(`zip=${f} (only ${d}% of values read as ZIPs)`):pe(s,f)?i.zip=f:l.push(`zip=${f} (all values are 3-4 digits with nothing to say they are postal)`)}let c=n?.state;if(c&&h.has(c)){let s=b(c),d=F(s);d.length>0&&d.every(S=>fe(S,o))?l.push(`state=${c} (every value is "CA", which is both Canada and California)`):N(s)?(l.push(`state=${c} (every value is a country, not a state)`),i.country||(i.country=c)):q(s)<95?l.push(`state=${c} (only ${q(s)}% of values are states/provinces)`):i.state=c}let p=new Set(Object.values(i).filter(Boolean)),C=e.filter(s=>!p.has(s)&&!s.startsWith("__"));if(!i.state){let s=null;for(let d of C){let S=b(d);if(N(S))continue;let O=q(S);if(O<95)continue;let H=te(S,oe),Ge=te(S,ue=>oe(ue)&&!fe(ue,o));H<ee&&Ge<1||(!s||O>s.pct)&&(s={name:d,pct:O})}s&&(i.state=s.name,p.add(s.name),u.push(`state=${s.name} (${s.pct}% states/provinces)`))}if(!i.zip)for(let s of C){if(p.has(s))continue;let d=b(s),S=ie(d);if(!(S<95)&&pe(d,s)&&!(wr(d,O=>U(O).length>0)<ee)){i.zip=s,p.add(s),u.push(`zip=${s} (${S}% ZIP codes)`);break}}let T=i.country;if(!T||!N(b(T))){let s=null;for(let d of C){if(p.has(d)||!N(b(d)))continue;let S=re(b(d));(!s||S>s.pct)&&(s={name:d,pct:S})}s&&(T&&(l.push(`country=${T} (only ${re(b(T))}% of values are country identifiers; using ${s.name} instead)`),y.country=T),i.country=s.name,p.add(s.name),u.push(`country=${s.name}`))}if(!i.city){let s=null;for(let d of C){if(p.has(d))continue;let S=b(d),O=xr(S,o);O<j||te(S,H=>X(H,o))<ee||(!s||O>s.pct)&&(s={name:d,pct:O})}s&&(i.city=s.name,u.push(`city=${s.name} (${s.pct}% known cities)`))}let P=i.country?b(i.country):[],R=!!i.country&&N(P),L=R?new Set(P.map(s=>W(s==null?null:String(s))).filter(Boolean)).size:0,x=R&&L>=2,w=!!(i.lat&&i.lon)&&t.some(s=>{let d=+String(s[i.lat]??"").trim(),S=+String(s[i.lon]??"").trim();return isFinite(d)&&isFinite(S)&&d>=-90&&d<=90&&S>=-180&&S<=180&&String(s[i.lat]??"").trim()!==""&&String(s[i.lon]??"").trim()!==""});return i.lat&&i.lon&&!w&&l.push(`lat/lon=${i.lat}/${i.lon} (no row holds a usable coordinate pair)`),i.country&&!x&&!(i.city||i.state||i.zip||w)&&l.push(R?`country=${i.country} (every row resolves to the same country - nothing to place apart)`:`country=${i.country} (values are not country identifiers)`),{bind:!!(i.city||i.state||i.zip||x||w)?i:null,backfilled:u,refused:l,...Object.keys(y).length?{labelFallback:y}:{}}}var r=(e,...t)=>({part:e,langs:Object.freeze(t)}),ae=Object.freeze({jaar:r("year","nl"),kwartaal:r("quarter","nl"),maand:r("month","nl"),dag:r("day","nl","sv","da","nb"),jahr:r("year","de"),quartal:r("quarter","de"),monat:r("month","de"),tag:r("day","de"),ann\u00E9e:r("year","fr"),mois:r("month","fr"),jour:r("day","fr"),trimestre:r("quarter","fr","es","pt","it"),a\u00F1o:r("year","es"),mes:r("month","es"),d\u00EDa:r("day","es"),ano:r("year","pt"),m\u00EAs:r("month","pt"),dia:r("day","pt"),anno:r("year","it"),mese:r("month","it"),giorno:r("day","it"),\u0433\u043E\u0434:r("year","ru"),\u043C\u0435\u0441\u044F\u0446:r("month","ru"),\u0440\u0456\u043A:r("year","uk"),\u043C\u0456\u0441\u044F\u0446\u044C:r("month","uk"),\u043A\u0432\u0430\u0440\u0442\u0430\u043B:r("quarter","ru","uk"),\u0434\u0435\u043D\u044C:r("day","ru","uk"),rok:r("year","pl","cs","sk"),kwarta\u0142:r("quarter","pl"),miesi\u0105c:r("month","pl"),dzie\u0144:r("day","pl"),\u010Dtvrtlet\u00ED:r("quarter","cs"),m\u011Bs\u00EDc:r("month","cs"),den:r("day","cs"),\u0161tvr\u0165rok:r("quarter","sk"),mesiac:r("month","sk"),de\u0148:r("day","sk"),\u00E5r:r("year","sv","da","nb"),kvartal:r("quarter","sv","da","nb"),m\u00E5nad:r("month","sv"),m\u00E5ned:r("month","da","nb"),vuosi:r("year","fi"),vuosinelj\u00E4nnes:r("quarter","fi"),kuukausi:r("month","fi"),p\u00E4iv\u00E4:r("day","fi"),\u00E9v:r("year","hu"),negyed\u00E9v:r("quarter","hu"),h\u00F3nap:r("month","hu"),nap:r("day","hu"),y\u0131l:r("year","tr"),\u00E7eyrek:r("quarter","tr"),ay:r("month","tr"),g\u00FCn:r("day","tr"),\u03AD\u03C4\u03BF\u03C2:r("year","el"),\u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF:r("quarter","el"),\u03BC\u03AE\u03BD\u03B1\u03C2:r("month","el"),\u03B7\u03BC\u03AD\u03C1\u03B1:r("day","el"),an:r("year","ro"),trimestru:r("quarter","ro"),lun\u0103:r("month","ro"),zi:r("day","ro"),godina:r("year","hr"),tromjese\u010Dje:r("quarter","hr"),mjesec:r("month","hr"),dan:r("day","hr"),\u5E74:r("year","ja","zh"),\u56DB\u534A\u671F:r("quarter","ja"),\u5B63\u5EA6:r("quarter","zh"),\u6708:r("month","ja","zh"),\u65E5:r("day","ja","zh"),\uC5F0\uB3C4:r("year","ko"),\uBD84\uAE30:r("quarter","ko"),\uC6D4:r("month","ko"),\uC77C:r("day","ko"),tahun:r("year","id"),kuartal:r("quarter","id"),triwulan:r("quarter","id"),bulan:r("month","id"),hari:r("day","id"),n\u0103m:r("year","vi"),qu\u00FD:r("quarter","vi"),th\u00E1ng:r("month","vi"),ng\u00E0y:r("day","vi"),\u0E1B\u0E35:r("year","th"),\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A:r("quarter","th"),\u0E40\u0E14\u0E37\u0E2D\u0E19:r("month","th"),\u0E27\u0E31\u0E19:r("day","th"),\u0627\u0644\u0633\u0646\u0629:r("year","ar"),\u0633\u0646\u0629:r("year","ar"),\u0627\u0644\u0639\u0627\u0645:r("year","ar"),\u0639\u0627\u0645:r("year","ar"),\u0627\u0644\u0631\u0628\u0639:r("quarter","ar"),\u0631\u0628\u0639:r("quarter","ar"),"\u0631\u0628\u0639 \u0627\u0644\u0633\u0646\u0629":r("quarter","ar"),\u0627\u0644\u0634\u0647\u0631:r("month","ar"),\u0634\u0647\u0631:r("month","ar"),\u0627\u0644\u064A\u0648\u0645:r("day","ar"),\u064A\u0648\u0645:r("day","ar"),\u05E9\u05E0\u05D4:r("year","he"),\u05E8\u05D1\u05E2\u05D5\u05DF:r("quarter","he"),\u05D7\u05D5\u05D3\u05E9:r("month","he"),\u05D9\u05D5\u05DD:r("day","he"),\u0935\u0930\u094D\u0937:r("year","hi"),\u0938\u093E\u0932:r("year","hi"),\u0924\u093F\u092E\u093E\u0939\u0940:r("quarter","hi"),\u092E\u0939\u0940\u0928\u093E:r("month","hi"),\u092E\u093E\u0939:r("month","hi"),\u0926\u093F\u0928:r("day","hi"),\u0633\u0627\u0644:r("year","fa"),\u0645\u0627\u0647:r("month","fa"),\u0631\u0648\u0632:r("day","fa")}),Or=Object.freeze(Array.from(new Set(Object.values(ae).flatMap(e=>e.langs)))),ye=Object.freeze(["fa","ar","he","th"]),he=1900,Ce=2100;function Ar(e,t){let n=[],o=K(t);try{o&&n.push(e.toLocaleLowerCase(o.intl))}catch{}let a=e.toLowerCase();return n.includes(a)||n.push(a),n}function Pr(e,t){let n=String(e??"").trim().normalize("NFC");if(!n)return null;for(let o of Ar(n,t)){let a=ae[o];if(a&&a.langs.includes(t))return a.part}return null}function Lr(e,t){return ye.includes(e)?typeof t=="number"&&Number.isFinite(t)&&t>=he&&t<=Ce:!0}function be(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var vr=/\b(?:columns|cols|column)\b/i;function $(e,t){let n=Math.max(0,t-240),o=e.slice(n,t),a=o.lastIndexOf(";");return a>=0&&(o=o.slice(a+1)),vr.test(o)}function Ee(e,t){return Te(e,t,n=>new RegExp(String.raw`\b${n}\s*(?:>=\s*0|>\s*-1|[!=]==?\s*-1)`).test(e))}function Te(e,t,n){let o=be(t),a=new RegExp(String.raw`(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*?\.name\s*===?\s*(['"])${o}\2`,"g"),u=new RegExp(String.raw`\.name\s*===?\s*(['"])${o}\1`,"g"),l=0,i;for(;(i=u.exec(e))!==null;)$(e,i.index)&&l++;let y=0;for(;(i=a.exec(e))!==null;){let h=i.index+i[0].lastIndexOf(".name");if(!$(e,h))continue;y++;let b=be(i[1]);if(!n(b))return!1}return y>0&&y===l}function Mr(e,t){return Te(e,t,n=>new RegExp(String.raw`\b${n}\s*(?:>=\s*0|>\s*-1|!==?\s*-1)`).test(e)&&!new RegExp(String.raw`\b${n}\s*===?\s*-1`).test(e))}var Se=["__rowIdx__","__geoIso__","__geoLat__","__geoLon__","__geoPrecision__"];function Ir(e,t){if(!e)return[];let n=new Set(t);for(let i of Se)n.add(i);let o=new Set,a=/\.name\s*===?\s*(['"])([^'"]+)\1/g,u;for(;(u=a.exec(e))!==null;)$(e,u.index)&&o.add(u[2]);if(o.size===0)return[];let l=[];return o.forEach(i=>{n.has(i)||Ee(e,i)||l.push(i)}),l}function Nr(e,t){if(!e)return[];let n=(e.getColumns()||[]).map(o=>o.name);if(!t||typeof e.aliasesForCode!="function")return n;for(let o of e.aliasesForCode(t))n.push(o.alias);return n}function Re(e,t){let n=t?.freemiumMaxShapeColumns;return typeof n!="number"||!isFinite(n)||n<1?null:!isFinite(e)||e<=n?0:Math.round(e-n)}function Fr(e,t,n){let o=Re(e,t);if(o===null||o<=0)return null;let a=typeof t?.freemiumColumnCapPivot=="number"?t.freemiumColumnCapPivot:4,u=o>a?t?.freemiumColumnCapMessageMany:t?.freemiumColumnCapMessageFew;if(typeof u!="string"||u.trim().length===0)return null;let l=u.split("{n}").join(String(o)).split("{fields}").join(o===1?"field":"fields"),i=xe(n);return i.length===0?l:l+" "+i.join(" ")}function xe(e){if(!e||e.length===0)return[];let t=[],n=new Map,o=new Map;for(let u of e){let l=typeof u?.dateGroupId=="string"?u.dateGroupId.trim():"";if(l!==""&&(n.has(l)||(t.push(l),n.set(l,0)),u.isDatePart===!0&&n.set(l,n.get(l)+1),u.isReassembledDate===!0&&!o.has(l))){let i=typeof u.sourceField=="string"?u.sourceField.trim():"",y=typeof u.name=="string"?u.name.trim():"",h=i!==""?i:y;h!==""&&o.set(l,h)}}let a=[];for(let u of t){let l=o.get(u),i=n.get(u)??0;!l||i===0||a.push(`'${l}' is a date hierarchy and counts as ${i+1} fields - bind the date itself instead of its hierarchy.`)}return a}var m=e=>e==null?"":String(e),A=e=>e===!0,we=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return null},Dr=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function _e(e,t){let n={};for(let[o,a]of Dr){let u=m(E(e,t+a));u&&(n[o]=u)}return n}function kr(e){return Array.isArray(e)?e.map(t=>({code:m(E(t,"code")),severity:m(E(t,"severity")),text:m(E(t,"text"))})).filter(t=>t.text!==""):[]}function Gr(e){let t=h=>E(e,h),n=t("retryAfterSeconds"),o=t("overrideThumbnailUpload"),a=t("forceThumbnailUpload"),u=_e(e,"point"),l=_e(e,"destPoint");Object.keys(l).length&&(u.dest=l);let i=t("retryable"),y=t("isPollFinal");return{errorMessage:m(t("errorMessage")),errorCode:m(t("errorCode")),refusalCode:m(t("refusalCode")),retryable:typeof i=="boolean"?i:null,notices:kr(t("notices")),freemiumStatusCode:m(t("freemiumStatusCode")),code:m(t("code")),language:m(t("language")),version:Number(t("version")??0),codeSummary:m(t("codeSummary")),chartName:m(t("chartName")??t("chartType")),finalChartName:m(t("finalChartName")),warningMessage:m(t("warningMessage")),outputHash:m(t("outputHash")),validatorToken:m(t("validatorToken")),editCodeKey:m(t("editCodeKey")),signedLLMRequestID:m(t("signedLLMRequestID")),userReply:m(t("userReply")),userReplyOutcome:m(t("userReplyOutcome")),improvementSuggestion:m(t("improvementSuggestion")),geoColumn:m(t("geoColumn")),geoKind:m(t("geoKind")),geoPointCols:Object.keys(u).length?u:null,creditBalanceBefore:we(t("creditBalanceBefore")),creditCost:we(t("creditCost")),isServiceError:A(t("isServiceError")),isRateLimited:A(t("isRateLimited")),suppressSelectionGlyph:A(t("suppressSelectionGlyph")),isRefusal:A(t("isRefusal")),isVersionNotFound:A(t("isVersionNotFound")),isGenerationCancelled:A(t("isGenerationCancelled")),retryAfterSeconds:typeof n=="number"&&Number.isFinite(n)?n:null,servedCorrelationId:m(t("servedCorrelationId")),...typeof y=="boolean"?{isPollFinal:y}:{},...m(t("pollOutcome"))!==""?{pollOutcome:m(t("pollOutcome"))}:{},...typeof o=="boolean"?{overrideThumbnailUpload:o}:{},...typeof a=="boolean"?{forceThumbnailUpload:a}:{}}}var Oe=e=>e==null?void 0:Number(e),k=e=>m(e)||void 0;function Vr(e){let t=E(e,"charts"),n=E(e,"refused"),o=Array.isArray(t)?t.map(u=>{let l=y=>E(u,y),i=l("recommended");return{name:m(l("chartTypeName")??l("name")),description:m(l("description")??l("chartDesc")),rank:Oe(l("rank")),score:Oe(l("score")),renderer:k(l("renderer")),language:k(l("language")),isPreview:A(l("isPreview")),alsoWorthALook:A(l("alsoWorthALook")),recommended:typeof i=="boolean"?i:void 0,viaProjection:k(l("viaProjection")),viaProjectionKey:k(l("viaProjectionKey")),detailNote:k(l("detailNote"))}}).filter(u=>u.name):null,a=Array.isArray(n)?n.map(u=>({name:m(E(u,"chartTypeName")??E(u,"name")),reason:m(E(u,"reason")),reasonCode:m(E(u,"reasonCode")),isVeto:A(E(u,"isVeto"))})).filter(u=>u.name):[];return{errorMessage:m(E(e,"errorMessage")),errorCode:m(E(e,"errorCode")),charts:o,refused:a,noFitSummary:m(E(e,"noFitSummary"))}}function Wr(e){return!e||typeof e!="object"?null:{status:String(E(e,"status")??""),verdictReason:E(e,"verdictReason")??null,instruction:E(e,"instruction")??null,fix:E(e,"fix")??null,errorMessage:E(e,"errorMessage")??null,errorCode:E(e,"errorCode")??null}}var Ae=["working","analyze","generate","refine","review"];function Ur(e,t){let n=String(e??"").trim().toLowerCase();if(Ae.includes(n))return n;let o=String(t??"").toLowerCase();return o.includes("analyz")?"analyze":o.includes("generat")?"generate":o.includes("refin")?"refine":o.includes("review")?"review":null}var qr="FREEMIUM_ATTEMPT_SPENT",$r="CLIENT_SECRET_MISMATCH",zr="FREEMIUM_COLUMN_CAP",Hr="OAUTH_TOKEN_EXPIRED",Kr="OAUTH_SIGNED_OUT";function Br(e){let t=e?.retryable;return typeof t=="boolean"?t:null}function jr(e){let t=e.linkNonce?(e.linkNonce()??"").trim():null,n=t?null:e.accessToken?(e.accessToken()??"").trim():null,o=t||n?{licensee:"",licenseKey:"",secretKey:""}:e.triple();return{request:{licenseKey:o.licenseKey,licensee:o.licensee,secretKey:o.secretKey,freemiumKey:e.freemiumKey?.()??""},linkNonce:t,accessToken:n}}function Yr(e){let{width:t,height:n}=e.measure();return{request:{height:n,width:t},hints:{viewportWidth:t,viewportHeight:n}}}function Qr(e){let t=0;for(let n of e){if(n.isMeasure)continue;let o=n.distinctCount;typeof o=="number"&&o>t&&(t=o)}return t}function Pe(e){if(e.recoveryFetchByCorrelation)return{version:null,fetchOnly:!0};if(e.recoveryFetchVersion!=null)return{version:e.recoveryFetchVersion,fetchOnly:!0};let t=e.settingVersion??null;if(e.genNew)return{version:t,fetchOnly:void 0};let n=(t??0)>0?t:null,o=(e.codeVersion??0)>0?e.codeVersion:null,a=n??o??t;return{version:a,fetchOnly:a!=null&&a>0?!0:void 0}}function Xr(e){let t=e.fetchCorrelationId!=null,o=t||e.recoveryFetchVersion!=null?!1:e.genNew,a=Pe({genNew:o,recoveryFetchVersion:e.recoveryFetchVersion,recoveryFetchByCorrelation:t,settingVersion:e.settingVersion,codeVersion:e.codeVersion}),u=e.fetchArmedAtMs,l=t&&typeof u=="number"&&Number.isSafeInteger(u)&&u>0?u:void 0,i=e.fetchCutAtMs,y=t&&typeof i=="number"&&Number.isSafeInteger(i)&&i>0?i:void 0,h=t?Jr(e.fetchCause):"";return{genNew:o,version:a.version,fetchOnly:a.fetchOnly,fetchCorrelationId:e.fetchCorrelationId??void 0,...l!==void 0?{fetchArmedAtMs:l}:{},...y!==void 0?{fetchCutAtMs:y}:{},...h?{fetchCause:h}:{}}}function Jr(e){if(typeof e!="string")return"";let t=e.replace(/[\u0000-\u001f\u007f]+/g," ").trim().slice(0,120);return/[\ud800-\udbff]$/.test(t)&&(t=t.slice(0,-1)),t.trimEnd()}function Zr(e){let t=n=>e.renderers.has(n);return{supportsD3:t("D3"),supportsPlotly:t("PLOTLY"),supportsVega:t("VEGA")}}function eo(e){let t=e.cap!=null&&e.budget>e.cap?e.cap:e.budget;return{triesLeft:e.triesLeft??t,maxTries:t}}function to(e){return e&&e>0?{leafCardinality:Math.round(e)}:{}}function no(e,t,n){let o=a=>typeof a=="number"&&Number.isInteger(a)&&a>0;return{...typeof e=="boolean"?{dataComplete:e}:{},...o(t)?{rowsWithheld:t}:{},...o(n)?{rowsFilteredOut:n}:{}}}var ro={fit:"Best fit",variety:"Something different"};function Le(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return t==="fit"||t==="variety"?t:null}function oo(e){let t=Le(e);return t?{qualifyOrder:t}:{}}function ve(e,t){return e!=null&&t!=null&&e!==t}function io(e,t){return e?ve(t.capturedFor,t.now)?{shortlist:void 0,stale:!0}:{shortlist:{...e,ageMs:t.atMs>0?Math.max(0,Math.round(t.nowMs-t.atMs)):void 0},stale:!1}:{shortlist:void 0,stale:!1}}var so=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function Me(e){let t=String(e??"").trim().toLowerCase();return so[t]??t}function Ie(e){let t="";for(let n of e)t+=JSON.stringify([String(n.name??""),n.isMeasure?"M":"D",Me(n.dataType)]);return t}function ao(e){return B(Ie(e))}var lo=2,uo=3,co=4,mo=64,fo=8e3,po=6e4,go=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict",REDRAW:"redraw",INTERACT:"interact"}),yo=Object.freeze(["open","generate","version","rebind","data","sample","fix","resize","other"]);function ho(e,t){return t?`${t};draw:${e}`:`draw:${e}`}function Co(e){return e.hint?e.hint:e.generated?"generate":e.previous?e.outputHash!==e.previous.outputHash?"version":e.dataSignature!==e.previous.dataSignature?"data":e.viewport!==e.previous.viewport?"resize":"other":"open"}function bo(){let e=new Set,t=new Set;return{firstDraw(n,o){if(!n)return!1;let a=`${n}|${o}`;return e.has(a)?!1:(e.add(a),!0)},firstInteract(n){return!n||t.has(n)?!1:(t.add(n),!0)}}}function Eo(e){return!!e&&!e.includes("|")&&!e.includes(",")}function le(e,t,n,o){let a=`${e},${t}|${n}`;return o?`${a}|${Math.max(0,Math.round(o.count))}|${o.nonce}`:a}function To(e,t){let n=e;if(!n||!n.signer||typeof n.signer.sign!="function")throw new TypeError("createTelemetryClient needs the host's signer");if(!n.transport||typeof n.transport.post!="function")throw new TypeError("createTelemetryClient needs the host's transport");if(!n.clock||typeof n.clock.now!="function")throw new TypeError("createTelemetryClient needs the host's clock");if(!t||typeof t.baseUrl!="string"&&typeof t.baseUrl!="function")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof t.baseUrl=="string"&&t.baseUrl==="")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof t.clientVersion!="string"||t.clientVersion==="")throw new TypeError("createTelemetryClient needs the client version");if(typeof t.timeoutMs!="number"||!Number.isFinite(t.timeoutMs)||t.timeoutMs<=0)throw new TypeError("createTelemetryClient needs a positive deadline in milliseconds");let{signer:o,transport:a,clock:u}=n,l=t.apiPath??"/api",i=t.timeoutMs,y=()=>typeof t.baseUrl=="function"?t.baseUrl():t.baseUrl,h=g=>{try{t.onFailure?.(g)}catch{}},b=async(g,f,c,p)=>{let C;try{let T=await a.post(f,c,p,{timeoutMs:i});C=T.status;try{T.body?.cancel().catch(()=>{})}catch{}}catch(T){h({channel:g,stage:"post",status:null,error:T});return}(C<200||C>299)&&h({channel:g,stage:"status",status:C,error:null})};return{async sendClientMessage(g){let f,c,p;try{f=`${y()}${l}/LogClientMsg/?nocache=${u.now()}`,c=M(g),p=D(c,o)}catch(C){h({channel:"client-message",stage:"build",status:null,error:C});return}await b("client-message",f,c,{"Content-Type":"text/plain","X-Signature":p})},async countEvent(g,f,c){let p,C;try{p=`${y()}${l}/eventlog`,C=le(g,t.clientVersion,f,c)}catch(T){h({channel:"event-count",stage:"build",status:null,error:T});return}await b("event-count",p,C,{"Content-Type":"text/plain"})}}}var Ne=2**31-1;function Fe(e){return Object.assign(new Error(`The request did not finish within ${e} ms.`),{name:"TimeoutError"})}function So(e){return typeof e=="number"&&e>0&&e<=Ne?null:new RangeError(`fetchTransport cannot keep a deadline of ${String(e)} ms: it must be a number of milliseconds above 0 and at most ${Ne} (about 24.8 days), the longest a timer can wait. Nothing was sent.`)}function Ro(e,t={}){if(typeof e!="function")throw new TypeError("fetchTransport needs the host's fetch");let n=e,o=t.credentials??"omit";return{async post(a,u,l,i){let y=i.timeoutMs,h=So(y);if(h)throw h;let b=new AbortController,g=!1,f=setTimeout(()=>{g=!0,b.abort(Fe(y))},y),c=()=>b.abort(i.signal?.reason);i.signal&&(i.signal.aborted?c():i.signal.addEventListener("abort",c,{once:!0}));let p=!1,C=()=>{p||(p=!0,clearTimeout(f),i.signal?.removeEventListener("abort",c))},T=_=>g?Fe(y):_,P;try{P=await n(a,{method:"POST",body:u,headers:l,credentials:o,signal:b.signal})}catch(_){throw C(),T(_)}let R=J(P),L=R.statusText!==void 0?{statusText:R.statusText}:{};if(!R.body)return{status:R.status,...L,contentType:R.contentType,body:null,text:async()=>{try{return await R.text()}catch(_){throw T(_)}finally{C()}}};let x=R.body.getReader(),w=new ReadableStream({async pull(_){try{let s=await x.read();if(s.done){C(),_.close();return}_.enqueue(s.value)}catch(s){C(),_.error(T(s))}},cancel(_){return C(),x.cancel(_)}});return{status:R.status,...L,contentType:R.contentType,body:w,text:()=>new Response(w).text()}}}}var De=300;function ke(e){return String(e??"").toLowerCase().replace(/[^a-z0-9-]/g,"").slice(0,40)}var xo="/LLMChart/",wo="/LLMChart/qualify",_o="/VisionReview/",Oo="/LLMChart/sample",Ao="/RefundGenerate/",Po=e=>!!e&&typeof e=="object"&&e.name==="TimeoutError",z=async e=>JSON.parse(await e.text());function Lo(e){try{e.body?e.body.cancel().catch(()=>{}):e.text().catch(()=>{})}catch{}}function vo(e,t){let n=e;if(!n||!n.signer||typeof n.signer.sign!="function")throw new TypeError("createGenerateClient needs the host's signer");if(!n.transport||typeof n.transport.post!="function")throw new TypeError("createGenerateClient needs the host's transport");if(!n.clock||typeof n.clock.now!="function")throw new TypeError("createGenerateClient needs the host's clock");if(!t||typeof t.baseUrl!="string"&&typeof t.baseUrl!="function")throw new TypeError("createGenerateClient needs the service's base URL");if(typeof t.baseUrl=="string"&&t.baseUrl==="")throw new TypeError("createGenerateClient needs the service's base URL");if(t.apiPath!==void 0&&typeof t.apiPath!="string")throw new TypeError("createGenerateClient's apiPath must be a string");if(t.nocache!==void 0&&t.nocache!==null&&typeof t.nocache!="function")throw new TypeError("createGenerateClient's nocache must be a function");let{signer:o,transport:a,clock:u}=n,l=t.apiPath??"/api",i=()=>typeof t.baseUrl=="function"?t.baseUrl():t.baseUrl,y=g=>t.nocache?t.nocache(g):String(u.now());async function h(g,f,c,p,C){let T=`${i()}${l}${f}?nocache=${y(g)}`,P={"Content-Type":"text/plain","X-Signature":D(c,o)},R=p.signal??void 0,L=(w,_)=>{let s=!!R?.aborted;return{kind:"transport",headersReceived:w,timedOut:!s&&Po(_),cancelled:s,error:_}},x;try{x=await a.post(T,c,P,R?{timeoutMs:p.timeoutMs,signal:R}:{timeoutMs:p.timeoutMs})}catch(w){return L(!1,w)}if(x.status<200||x.status>299){let w="";if(p.readErrorBody===!1)Lo(x);else try{w=(await x.text()).slice(0,De)}catch{}return{kind:"http",status:x.status,statusText:x.statusText??"",bodyStart:w}}try{return{kind:"answer",status:x.status,value:await C(x)}}catch(w){return L(!0,w)}}function b(g,f){if(!f||typeof f.timeoutMs!="number"||!Number.isFinite(f.timeoutMs)||f.timeoutMs<=0)throw new TypeError(`The ${g} call needs a positive deadline in milliseconds`);return f}return{async generate(g,f){let c=b("generate",f),p=c.onStage??void 0;return h("generate",xo,M(g),c,C=>Z(C,p))},async qualify(g,f){let c=b("qualify",f),p=c.route??wo;if(typeof p!="string"||!p.startsWith("/"))throw new TypeError("The qualify route must start with '/'");return h("qualify",p,M(g),c,z)},async review(g,f){let c=b("review",f),p=JSON.stringify(g);if(typeof p!="string")throw new TypeError("The review wire did not serialize to JSON");return h("review",_o,p,c,z)},async sample(g,f){let c=b("sample",f);return h("sample",Oo,M(g),c,z)},async refund(g,f,c){let p=b("refund",f);if(typeof g!="string"||g.trim()==="")throw new TypeError("A refund needs the generation's correlation id");let C=ke(c),T=C?{CorrelationID:g.trim(),Reason:C}:{CorrelationID:g.trim()};return h("refund",Ao,JSON.stringify(T),p,z)}}}export{pn as ADMIN1_MATCH_PCT,gn as ADMIN1_MATCH_PCT_NAMED,j as CITY_ROLE_MATCH_PCT,jt as CITY_TIE_RATIO,go as CLIENT_EVENT_KINDS,$r as CLIENT_SECRET_MISMATCH,Xe as COMPOUND_MIN_STEM,Et as CYCLE_MEMBERS,St as CYCLE_WORDS,Ce as DATE_LEVEL_GREGORIAN_YEAR_MAX,he as DATE_LEVEL_GREGORIAN_YEAR_MIN,Or as DATE_LEVEL_LANGUAGES,ae as DATE_LEVEL_NAMES,ye as DATE_LEVEL_NON_GREGORIAN_LANGUAGES,Xn as DEFAULT_GAP_FACTOR,lt as DEFAULT_TEMPERATURE,yo as DRAW_REASONS,qr as FREEMIUM_ATTEMPT_SPENT,zr as FREEMIUM_COLUMN_CAP,st as GET_RANDOM,Ze as GLUED_STEM_MIN,tt as HANGUL_MIN_STEM,Se as HOST_SYNTHETIC_COLUMNS,De as HTTP_BODY_START_CHARS,Hn as IDENTIFIER_HEAD_INITIAL,Kn as IDENTIFIER_UNFOLDED,zn as IDENTIFIER_WORDS,Pn as INTENSIVE_SUFFIX_TOKENS,An as INTENSIVE_WORD_TOKENS,gr as IndexedText,wn as LATITUDE_WORDS,_n as LONGITUDE_WORDS,It as LOOSE_KEY_MIN_LENGTH,Ft as LooseIndex,Jn as MAX_RUN_BOUNDS,Kr as OAUTH_SIGNED_OUT,Hr as OAUTH_TOKEN_EXPIRED,Ot as PERIOD_CODE_FORMS,_t as PERIOD_CODE_MEMBERS,At as PERIOD_ORDINALS,Pt as PERIOD_UNFOLDED,vn as POSITIONAL_SUFFIX_TOKENS,Ln as POSITIONAL_WORD_TOKENS,br as PREVIEW_OMITTED_FIELDS,Ae as PROGRESS_STAGE_IDS,ro as QUALIFY_ORDER_LABELS,Vt as REGION_FRAME_WINDOWS,v as ROLE_MATCH_PCT,tr as SERIES_COMPLETENESS_MAX_LISTED,nr as SERIES_COMPLETENESS_MIN_FILL,rr as SERIES_KEY_MAX_DISTINCT,co as SEV_ERROR,lo as SEV_INFO,mo as SEV_USER_PRESENTED,uo as SEV_WARNING,B as SIMPLE_STRING_HASH,it as STR,rt as SUBSTRING_MIN,Ve as SUPPORTED_LANGUAGES,We as SUPPORTED_LANGUAGE_CODES,po as TELEMETRY_TIMEOUT_DEV_MS,fo as TELEMETRY_TIMEOUT_MS,$e as VOCABULARY_LANGUAGE_CODES,qe as VOCABULARY_ONLY_LANGUAGES,Tt as YEAR_WORDS,Qt as admin1CodesForName,Y as admin1LookupRegistered,q as admin1MatchPct,Wn as allowedAggregations,Ct as anchorLocalWallClockDates,Br as answerIsRetryable,fn as buildGeoIsoColumn,an as buildGeoPointColumns,hn as buildProvinceIsoColumn,Rt as calendarWordIn,Zr as capabilityFields,un as cityMatchPct,ln as cityTagsFor,mr as classifyAdditivity,Co as classifyDraw,Vn as classifyForAggregation,fr as classifyNumericValueNature,cr as classifyTemporal,Kt as clearAdmin1LookupForTests,Fn as codeNeedsLegacyAggNames,jn as codeReadsColumn,Yn as codeReadsColumnsByRoleOrPosition,Nn as collapseRepeatedAggPrefix,Qn as columnsTheCodeReads,On as coordinateAxisOfWords,Bt as countryIso2,qt as countryRegion,bo as createDrawLedger,vo as createGenerateClient,To as createTelemetryClient,jr as credentialFields,no as dataCompletenessFields,Pr as dateLevelPart,Lr as dateLevelYearAdmits,bt as datesAreTimeOfDayOnly,yt as datesCarryTimeOfDay,En as decimalSeparatorOf,Un as defaultAggregation,Tn as detectDecimalSeparator,bn as detectFormatSignature,cn as detectGeo,Gt as detectOrdinalDomain,ur as detectTextDatePattern,ho as drawLocation,M as encodePayload,yr as engineTypeForSqlType,Dn as englishImplicitAggNames,le as eventLogLine,Xr as fetchFields,Ro as fetchTransport,He as foldName,Fr as freemiumColumnCapRefusal,Re as freemiumColumnsOverCap,xe as freemiumDateHierarchyClauses,et as gluedPrefixStems,Nr as guardColumnNames,Tr as gzipWireText,nt as hangulWordEndsWith,In as hasDefaultAggPrefix,Ye as hasUnsegmentedScript,dr as hostAggHint,zt as inMiddleEast,Cr as ingest,qn as isAggregationAllowed,G as isBlankLike,en as isCityTableLoaded,$ as isColumnContextRef,at as isDeterministicRefusal,Eo as isEventLogCode,on as isGeoPointAmbiguity,lr as isIdentifierName,mn as isJoinGeoKind,Jt as isKnownProvinceId,Rr as isNdjsonContentType,Dt as isOrdinalFriendlyName,Nt as isUsableLooseKey,Sr as keyedSigner,to as leafCardinalityField,ft as localMidnightDateColumns,mt as localMidnightToUtcDay,ht as localWallClockDateColumns,wt as localizedCycleIn,Bn as localizedIdentifierWordIn,xt as localizedYearWordIn,N as looksLikeCountryColumn,Mt as looseNameKey,ot as matchNameToken,Qr as maxNonMeasureCardinality,Cn as measureAdmin1Columns,er as measureCadence,ar as measurePersistence,sr as measureSeriesCompleteness,D as messageSignature,Ir as missingHardColumnRefs,xn as monthLookupFor,Be as nameLetterRuns,Gn as nameLooksIntensiveRate,kn as nameLooksPositional,Ee as nameProbeIsGuarded,Mr as nameProbeKeepsDrawing,Ke as nameWords,tn as normalizeCountry,pt as normalizeLocalMidnightDates,Rn as normalizeMonthKey,V as normalizePlaceName,rn as normalizeZip5,io as offeredShortlistFor,hr as parseCsvRows,ut as parseDateStable,Gr as parseGenerateResponse,Sn as parseNumberText,Vr as parseQualifyResponse,Wr as parseReviewVerdict,Zn as parseTemporalPoint,Er as payloadPreview,vt as periodCodeSeries,ir as pickSeriesColumn,Ur as progressStageOf,pr as promotesToMeasure,Xt as provinceIdForAdmin1Code,yn as provinceIdForRow,oo as qualifyOrderField,Le as qualifyOrderOf,Z as readGenerateStream,je as readName,Lt as readPeriodCode,E as readWireField,ke as refundReasonCode,Ht as registerAdmin1Lookup,Zt as registerCityTable,Ut as registerIso3Regions,I as resolveAdmin1,Yt as resolveCityAdmin1,Pe as resolveFetchVersion,sn as resolveGeoPoint,ze as resolveLanguage,_r as resolvePointRoles,eo as retryFields,kt as safeDistinctValuesToShip,Ie as schemaIdentity,ao as schemaIdentityKey,Me as schemaTypeFamily,or as seriesKeyVerdict,$n as shareOfTotalIsHonest,ve as shortlistIsStale,Mn as stripHostAggPrefix,$t as summarizeCountryRegions,Wt as summarizeGeoExtent,Ue as supportedLanguage,dn as toGeoIso,Qe as unsegmentedRuns,gt as utcWallClock,Yr as viewportFields,K as vocabularyLanguage,ct as wholeDayFrame,dt as wholeDayIso,J as wireResponseFromFetch,Je as wordEndsWith,ie as zipMatchPct,U as zipPrefixCandidates,nn as zipToPrefix3};
2
+ import{a as Er,b as Tr}from"./chunk-HIVICMC5.mjs";import{a as Sr,b as M,c as Rr,d as D,e as E,f as xr,g as J,h as Z}from"./chunk-4J7WPYLM.mjs";import{a as hr,b as Cr,c as br}from"./chunk-755USHC4.mjs";import{A as Kn,B as Bn,C as jn,D as Yn,E as Qn,F as Xn,G as Jn,H as Zn,I as er,J as tr,K as nr,L as rr,M as or,N as ir,O as sr,P as ar,Q as lr,R as ur,S as cr,T as dr,U as mr,V as fr,W as pr,X as gr,Z as yr,a as gn,b as yn,c as hn,d as Cn,e as bn,g as _n,h as On,i as An,j as Pn,k as Ln,l as vn,m as Mn,n as In,o as Nn,p as Fn,q as Dn,r as kn,s as Gn,t as Wn,u as Vn,v as Un,w as Hn,x as qn,y as $n,z as zn}from"./chunk-QAGRGHJI.mjs";import{a as En}from"./chunk-U3H6UBOO.mjs";import{b as Tn,c as Sn,d as Rn,f as xn,g as wn}from"./chunk-TZ74QIKA.mjs";import{a as me,c as fe,e as dn,f as mn,g as fn,h as pn}from"./chunk-YDYFP2T4.mjs";import{A as Q,B as en,C as tn,D as de,E as I,F as nn,G as rn,H as on,I as U,J as sn,K as an,L as ln,M as un,N as X,O as cn,a as v,b as G,c as j,d as W,j as V,k as Vt,l as Ut,m as Ht,n as qt,o as $t,q as zt,r as Kt,s as Y,t as Bt,u as jt,v as Yt,w as Qt,x as Xt,y as Jt,z as Zt}from"./chunk-DTBXJVUG.mjs";import"./chunk-5MRZID36.mjs";import{a as Tt,b as St,c as Rt,d as xt,e as wt,f as _t,g as Ot,h as At,i as Pt,j as Lt,k as vt,l as Mt,m as kt,n as Gt,o as Wt}from"./chunk-3ZAS32F5.mjs";import{b as It,c as Nt,d as Ft,e as Dt}from"./chunk-5HI6TVMM.mjs";import{A as yt,B as ht,C as Ct,D as bt,E as Et,a as Ke,b as Be,c as je,d as Ye,e as Qe,f as Xe,g as Je,h as Ze,i as et,j as tt,k as nt,l as rt,m as ot,n as it,o as st,q as B,r as at,s as lt,t as ut,u as ct,v as dt,w as mt,x as ft,y as pt,z as gt}from"./chunk-CZJ7M6A5.mjs";import{a as Ve,b as Ue,c as He,d as qe,e as $e,f as K,g as ze}from"./chunk-WC4JINEZ.mjs";var ee=2,ye=400;function ne(e){return!!V(e)}function F(e){let t=new Set;for(let n of e){if(n==null)continue;let o=W(String(n));if(!G(o)&&!t.has(o)&&(t.add(o),t.size>=ye))break}return Array.from(t)}function N(e){let t=F(e);if(t.length===0||re(e)<95)return!1;let n=t.filter(a=>ne(a)&&!I(a)).length,o=t.filter(a=>!ne(a)&&!!I(a)).length;return n>=1&&n>=o}function pe(e,t){if(!I(e))return!1;let n=V(e);return n?t==="world"?!0:de.has(n):!1}function re(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let o of t)ne(o)&&n++;return Math.round(n/t.length*1e3)/10}function oe(e){return I(e)?!0:Y()?Q(e).status!=="unmatched"||Q(e.trim().replace(/\s+/g,"-")).status!=="unmatched":!1}function H(e){let t=F(e);if(t.length===0)return 0;let n=0;for(let o of t)oe(o)&&n++;return Math.round(n/t.length*1e3)/10}function se(e){let t=new Set;for(let n of e){if(n==null)continue;let o=String(n).trim();if(!G(W(o))&&!t.has(o)&&(t.add(o),t.size>=ye))break}return Array.from(t)}function ie(e){let t=se(e);if(t.length===0)return 0;let n=0;for(let o of t)U(o).length>0&&n++;return Math.round(n/t.length*1e3)/10}function ge(e,t){return fe(t,me)?!0:se(e).some(n=>/^\d{5}(-\d{4})?$/.test(n.replace(/\.0+$/,"")))}function wr(e,t){let n=F(e);if(n.length===0)return 0;let o=0;for(let a of n)X(a,t)&&o++;return Math.round(o/n.length*1e3)/10}function te(e,t){let n=0;for(let o of F(e))t(o)&&n++;return n}function _r(e,t){let n=0;for(let o of se(e))t(o)&&n++;return n}function Or(e,t,n,o,a){let u=[],l=[],i={},C={},y=new Set(e),h=s=>t.map(d=>d[s]);for(let s of["city","country"]){let d=n?.[s];d&&y.has(d)&&(i[s]=d)}let f=new Set(a??e);for(let s of["lat","lon"]){let d=n?.[s];d&&f.has(d)&&(i[s]=d)}let p=n?.zip;if(p&&y.has(p)){let s=h(p),d=ie(s);d<95?l.push(`zip=${p} (only ${d}% of values read as ZIPs)`):ge(s,p)?i.zip=p:l.push(`zip=${p} (all values are 3-4 digits with nothing to say they are postal)`)}let c=n?.state;if(c&&y.has(c)){let s=h(c),d=F(s);d.length>0&&d.every(S=>pe(S,o))?l.push(`state=${c} (every value is "CA", which is both Canada and California)`):N(s)?(l.push(`state=${c} (every value is a country, not a state)`),i.country||(i.country=c)):H(s)<95?l.push(`state=${c} (only ${H(s)}% of values are states/provinces)`):i.state=c}let g=new Set(Object.values(i).filter(Boolean)),b=e.filter(s=>!g.has(s)&&!s.startsWith("__"));if(!i.state){let s=null;for(let d of b){let S=h(d);if(N(S))continue;let O=H(S);if(O<95)continue;let z=te(S,oe),We=te(S,ce=>oe(ce)&&!pe(ce,o));z<ee&&We<1||(!s||O>s.pct)&&(s={name:d,pct:O})}s&&(i.state=s.name,g.add(s.name),u.push(`state=${s.name} (${s.pct}% states/provinces)`))}if(!i.zip)for(let s of b){if(g.has(s))continue;let d=h(s),S=ie(d);if(!(S<95)&&ge(d,s)&&!(_r(d,O=>U(O).length>0)<ee)){i.zip=s,g.add(s),u.push(`zip=${s} (${S}% ZIP codes)`);break}}let T=i.country;if(!T||!N(h(T))){let s=null;for(let d of b){if(g.has(d)||!N(h(d)))continue;let S=re(h(d));(!s||S>s.pct)&&(s={name:d,pct:S})}s&&(T&&(l.push(`country=${T} (only ${re(h(T))}% of values are country identifiers; using ${s.name} instead)`),C.country=T),i.country=s.name,g.add(s.name),u.push(`country=${s.name}`))}if(!i.city){let s=null;for(let d of b){if(g.has(d))continue;let S=h(d),O=wr(S,o);O<j||te(S,z=>X(z,o))<ee||(!s||O>s.pct)&&(s={name:d,pct:O})}s&&(i.city=s.name,u.push(`city=${s.name} (${s.pct}% known cities)`))}let P=i.country?h(i.country):[],R=!!i.country&&N(P),L=R?new Set(P.map(s=>V(s==null?null:String(s))).filter(Boolean)).size:0,x=R&&L>=2,w=!!(i.lat&&i.lon)&&t.some(s=>{let d=+String(s[i.lat]??"").trim(),S=+String(s[i.lon]??"").trim();return isFinite(d)&&isFinite(S)&&d>=-90&&d<=90&&S>=-180&&S<=180&&String(s[i.lat]??"").trim()!==""&&String(s[i.lon]??"").trim()!==""});return i.lat&&i.lon&&!w&&l.push(`lat/lon=${i.lat}/${i.lon} (no row holds a usable coordinate pair)`),i.country&&!x&&!(i.city||i.state||i.zip||w)&&l.push(R?`country=${i.country} (every row resolves to the same country - nothing to place apart)`:`country=${i.country} (values are not country identifiers)`),{bind:!!(i.city||i.state||i.zip||x||w)?i:null,backfilled:u,refused:l,...Object.keys(C).length?{labelFallback:C}:{}}}var r=(e,...t)=>({part:e,langs:Object.freeze(t)}),ae=Object.freeze({jaar:r("year","nl"),kwartaal:r("quarter","nl"),maand:r("month","nl"),dag:r("day","nl","sv","da","nb"),jahr:r("year","de"),quartal:r("quarter","de"),monat:r("month","de"),tag:r("day","de"),ann\u00E9e:r("year","fr"),mois:r("month","fr"),jour:r("day","fr"),trimestre:r("quarter","fr","es","pt","it"),a\u00F1o:r("year","es"),mes:r("month","es"),d\u00EDa:r("day","es"),ano:r("year","pt"),m\u00EAs:r("month","pt"),dia:r("day","pt"),anno:r("year","it"),mese:r("month","it"),giorno:r("day","it"),\u0433\u043E\u0434:r("year","ru"),\u043C\u0435\u0441\u044F\u0446:r("month","ru"),\u0440\u0456\u043A:r("year","uk"),\u043C\u0456\u0441\u044F\u0446\u044C:r("month","uk"),\u043A\u0432\u0430\u0440\u0442\u0430\u043B:r("quarter","ru","uk"),\u0434\u0435\u043D\u044C:r("day","ru","uk"),rok:r("year","pl","cs","sk"),kwarta\u0142:r("quarter","pl"),miesi\u0105c:r("month","pl"),dzie\u0144:r("day","pl"),\u010Dtvrtlet\u00ED:r("quarter","cs"),m\u011Bs\u00EDc:r("month","cs"),den:r("day","cs"),\u0161tvr\u0165rok:r("quarter","sk"),mesiac:r("month","sk"),de\u0148:r("day","sk"),\u00E5r:r("year","sv","da","nb"),kvartal:r("quarter","sv","da","nb"),m\u00E5nad:r("month","sv"),m\u00E5ned:r("month","da","nb"),vuosi:r("year","fi"),vuosinelj\u00E4nnes:r("quarter","fi"),kuukausi:r("month","fi"),p\u00E4iv\u00E4:r("day","fi"),\u00E9v:r("year","hu"),negyed\u00E9v:r("quarter","hu"),h\u00F3nap:r("month","hu"),nap:r("day","hu"),y\u0131l:r("year","tr"),\u00E7eyrek:r("quarter","tr"),ay:r("month","tr"),g\u00FCn:r("day","tr"),\u03AD\u03C4\u03BF\u03C2:r("year","el"),\u03C4\u03C1\u03AF\u03BC\u03B7\u03BD\u03BF:r("quarter","el"),\u03BC\u03AE\u03BD\u03B1\u03C2:r("month","el"),\u03B7\u03BC\u03AD\u03C1\u03B1:r("day","el"),an:r("year","ro"),trimestru:r("quarter","ro"),lun\u0103:r("month","ro"),zi:r("day","ro"),godina:r("year","hr"),tromjese\u010Dje:r("quarter","hr"),mjesec:r("month","hr"),dan:r("day","hr"),\u5E74:r("year","ja","zh"),\u56DB\u534A\u671F:r("quarter","ja"),\u5B63\u5EA6:r("quarter","zh"),\u6708:r("month","ja","zh"),\u65E5:r("day","ja","zh"),\uC5F0\uB3C4:r("year","ko"),\uBD84\uAE30:r("quarter","ko"),\uC6D4:r("month","ko"),\uC77C:r("day","ko"),tahun:r("year","id"),kuartal:r("quarter","id"),triwulan:r("quarter","id"),bulan:r("month","id"),hari:r("day","id"),n\u0103m:r("year","vi"),qu\u00FD:r("quarter","vi"),th\u00E1ng:r("month","vi"),ng\u00E0y:r("day","vi"),\u0E1B\u0E35:r("year","th"),\u0E44\u0E15\u0E23\u0E21\u0E32\u0E2A:r("quarter","th"),\u0E40\u0E14\u0E37\u0E2D\u0E19:r("month","th"),\u0E27\u0E31\u0E19:r("day","th"),\u0627\u0644\u0633\u0646\u0629:r("year","ar"),\u0633\u0646\u0629:r("year","ar"),\u0627\u0644\u0639\u0627\u0645:r("year","ar"),\u0639\u0627\u0645:r("year","ar"),\u0627\u0644\u0631\u0628\u0639:r("quarter","ar"),\u0631\u0628\u0639:r("quarter","ar"),"\u0631\u0628\u0639 \u0627\u0644\u0633\u0646\u0629":r("quarter","ar"),\u0627\u0644\u0634\u0647\u0631:r("month","ar"),\u0634\u0647\u0631:r("month","ar"),\u0627\u0644\u064A\u0648\u0645:r("day","ar"),\u064A\u0648\u0645:r("day","ar"),\u05E9\u05E0\u05D4:r("year","he"),\u05E8\u05D1\u05E2\u05D5\u05DF:r("quarter","he"),\u05D7\u05D5\u05D3\u05E9:r("month","he"),\u05D9\u05D5\u05DD:r("day","he"),\u0935\u0930\u094D\u0937:r("year","hi"),\u0938\u093E\u0932:r("year","hi"),\u0924\u093F\u092E\u093E\u0939\u0940:r("quarter","hi"),\u092E\u0939\u0940\u0928\u093E:r("month","hi"),\u092E\u093E\u0939:r("month","hi"),\u0926\u093F\u0928:r("day","hi"),\u0633\u0627\u0644:r("year","fa"),\u0645\u0627\u0647:r("month","fa"),\u0631\u0648\u0632:r("day","fa")}),Ar=Object.freeze(Array.from(new Set(Object.values(ae).flatMap(e=>e.langs)))),he=Object.freeze(["fa","ar","he","th"]),Ce=1900,be=2100;function Pr(e,t){let n=[],o=K(t);try{o&&n.push(e.toLocaleLowerCase(o.intl))}catch{}let a=e.toLowerCase();return n.includes(a)||n.push(a),n}function Lr(e,t){let n=String(e??"").trim().normalize("NFC");if(!n)return null;for(let o of Pr(n,t)){let a=ae[o];if(a&&a.langs.includes(t))return a.part}return null}function vr(e,t){return he.includes(e)?typeof t=="number"&&Number.isFinite(t)&&t>=Ce&&t<=be:!0}function Ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var Mr=/\b(?:columns|cols|column)\b/i;function q(e,t){let n=Math.max(0,t-240),o=e.slice(n,t),a=o.lastIndexOf(";");return a>=0&&(o=o.slice(a+1)),Mr.test(o)}function Te(e,t){return Se(e,t,n=>new RegExp(String.raw`\b${n}\s*(?:>=\s*0|>\s*-1|[!=]==?\s*-1)`).test(e))}function Se(e,t,n){let o=Ee(t),a=new RegExp(String.raw`(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*?\.name\s*===?\s*(['"])${o}\2`,"g"),u=new RegExp(String.raw`\.name\s*===?\s*(['"])${o}\1`,"g"),l=0,i;for(;(i=u.exec(e))!==null;)q(e,i.index)&&l++;let C=0;for(;(i=a.exec(e))!==null;){let y=i.index+i[0].lastIndexOf(".name");if(!q(e,y))continue;C++;let h=Ee(i[1]);if(!n(h))return!1}return C>0&&C===l}function Ir(e,t){return Se(e,t,n=>new RegExp(String.raw`\b${n}\s*(?:>=\s*0|>\s*-1|!==?\s*-1)`).test(e)&&!new RegExp(String.raw`\b${n}\s*===?\s*-1`).test(e))}var Re=["__rowIdx__","__geoIso__","__geoLat__","__geoLon__","__geoPrecision__"];function Nr(e,t){if(!e)return[];let n=new Set(t);for(let i of Re)n.add(i);let o=new Set,a=/\.name\s*===?\s*(['"])([^'"]+)\1/g,u;for(;(u=a.exec(e))!==null;)q(e,u.index)&&o.add(u[2]);if(o.size===0)return[];let l=[];return o.forEach(i=>{n.has(i)||Te(e,i)||l.push(i)}),l}function Fr(e,t){if(!e)return[];let n=(e.getColumns()||[]).map(o=>o.name);if(!t||typeof e.aliasesForCode!="function")return n;for(let o of e.aliasesForCode(t))n.push(o.alias);return n}function xe(e,t){let n=t?.freemiumMaxShapeColumns;return typeof n!="number"||!isFinite(n)||n<1?null:!isFinite(e)||e<=n?0:Math.round(e-n)}function Dr(e,t,n){let o=xe(e,t);if(o===null||o<=0)return null;let a=typeof t?.freemiumColumnCapPivot=="number"?t.freemiumColumnCapPivot:4,u=o>a?t?.freemiumColumnCapMessageMany:t?.freemiumColumnCapMessageFew;if(typeof u!="string"||u.trim().length===0)return null;let l=u.split("{n}").join(String(o)).split("{fields}").join(o===1?"field":"fields"),i=we(n);return i.length===0?l:l+" "+i.join(" ")}function we(e){if(!e||e.length===0)return[];let t=[],n=new Map,o=new Map;for(let u of e){let l=typeof u?.dateGroupId=="string"?u.dateGroupId.trim():"";if(l!==""&&(n.has(l)||(t.push(l),n.set(l,0)),u.isDatePart===!0&&n.set(l,n.get(l)+1),u.isReassembledDate===!0&&!o.has(l))){let i=typeof u.sourceField=="string"?u.sourceField.trim():"",C=typeof u.name=="string"?u.name.trim():"",y=i!==""?i:C;y!==""&&o.set(l,y)}}let a=[];for(let u of t){let l=o.get(u),i=n.get(u)??0;!l||i===0||a.push(`'${l}' is a date hierarchy and counts as ${i+1} fields - bind the date itself instead of its hierarchy.`)}return a}var m=e=>e==null?"":String(e),A=e=>e===!0,le=e=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let t=Number(e);return Number.isFinite(t)?t:null}return null},_e=e=>{let t=le(e);return t!==null&&t>0?t:null},kr=[["city","CityColumn"],["state","StateColumn"],["zip","ZipColumn"],["lat","LatColumn"],["lon","LonColumn"],["country","CountryColumn"]];function Oe(e,t){let n={};for(let[o,a]of kr){let u=m(E(e,t+a));u&&(n[o]=u)}return n}function Gr(e){return Array.isArray(e)?e.map(t=>({code:m(E(t,"code")),severity:m(E(t,"severity")),text:m(E(t,"text"))})).filter(t=>t.text!==""):[]}function Wr(e){let t=f=>E(e,f),n=t("retryAfterSeconds"),o=t("overrideThumbnailUpload"),a=t("forceThumbnailUpload"),u=Oe(e,"point"),l=Oe(e,"destPoint");Object.keys(l).length&&(u.dest=l);let i=t("retryable"),C=t("isPollFinal"),y=_e(t("chartMinWidth")),h=_e(t("chartMinHeight"));return{errorMessage:m(t("errorMessage")),errorCode:m(t("errorCode")),refusalCode:m(t("refusalCode")),retryable:typeof i=="boolean"?i:null,notices:Gr(t("notices")),freemiumStatusCode:m(t("freemiumStatusCode")),code:m(t("code")),language:m(t("language")),version:Number(t("version")??0),codeSummary:m(t("codeSummary")),chartName:m(t("chartName")??t("chartType")),finalChartName:m(t("finalChartName")),warningMessage:m(t("warningMessage")),outputHash:m(t("outputHash")),validatorToken:m(t("validatorToken")),editCodeKey:m(t("editCodeKey")),signedLLMRequestID:m(t("signedLLMRequestID")),userReply:m(t("userReply")),userReplyOutcome:m(t("userReplyOutcome")),improvementSuggestion:m(t("improvementSuggestion")),geoColumn:m(t("geoColumn")),geoKind:m(t("geoKind")),geoPointCols:Object.keys(u).length?u:null,creditBalanceBefore:le(t("creditBalanceBefore")),creditCost:le(t("creditCost")),isServiceError:A(t("isServiceError")),isRateLimited:A(t("isRateLimited")),suppressSelectionGlyph:A(t("suppressSelectionGlyph")),isRefusal:A(t("isRefusal")),isVersionNotFound:A(t("isVersionNotFound")),isGenerationCancelled:A(t("isGenerationCancelled")),retryAfterSeconds:typeof n=="number"&&Number.isFinite(n)?n:null,servedCorrelationId:m(t("servedCorrelationId")),...typeof C=="boolean"?{isPollFinal:C}:{},...m(t("pollOutcome"))!==""?{pollOutcome:m(t("pollOutcome"))}:{},...y!==null?{chartMinWidth:y}:{},...h!==null?{chartMinHeight:h}:{},...typeof o=="boolean"?{overrideThumbnailUpload:o}:{},...typeof a=="boolean"?{forceThumbnailUpload:a}:{}}}var Ae=e=>e==null?void 0:Number(e),k=e=>m(e)||void 0;function Vr(e){let t=E(e,"charts"),n=E(e,"refused"),o=Array.isArray(t)?t.map(u=>{let l=C=>E(u,C),i=l("recommended");return{name:m(l("chartTypeName")??l("name")),description:m(l("description")??l("chartDesc")),rank:Ae(l("rank")),score:Ae(l("score")),renderer:k(l("renderer")),language:k(l("language")),isPreview:A(l("isPreview")),alsoWorthALook:A(l("alsoWorthALook")),recommended:typeof i=="boolean"?i:void 0,viaProjection:k(l("viaProjection")),viaProjectionKey:k(l("viaProjectionKey")),detailNote:k(l("detailNote"))}}).filter(u=>u.name):null,a=Array.isArray(n)?n.map(u=>({name:m(E(u,"chartTypeName")??E(u,"name")),reason:m(E(u,"reason")),reasonCode:m(E(u,"reasonCode")),isVeto:A(E(u,"isVeto"))})).filter(u=>u.name):[];return{errorMessage:m(E(e,"errorMessage")),errorCode:m(E(e,"errorCode")),charts:o,refused:a,noFitSummary:m(E(e,"noFitSummary"))}}function Ur(e){return!e||typeof e!="object"?null:{status:String(E(e,"status")??""),verdictReason:E(e,"verdictReason")??null,instruction:E(e,"instruction")??null,fix:E(e,"fix")??null,errorMessage:E(e,"errorMessage")??null,errorCode:E(e,"errorCode")??null}}var Pe=["working","analyze","generate","refine","review"];function Hr(e,t){let n=String(e??"").trim().toLowerCase();if(Pe.includes(n))return n;let o=String(t??"").toLowerCase();return o.includes("analyz")?"analyze":o.includes("generat")?"generate":o.includes("refin")?"refine":o.includes("review")?"review":null}var qr="FREEMIUM_ATTEMPT_SPENT",$r="CLIENT_SECRET_MISMATCH",zr="FREEMIUM_COLUMN_CAP",Kr="OAUTH_TOKEN_EXPIRED",Br="OAUTH_SIGNED_OUT";function jr(e){let t=e?.retryable;return typeof t=="boolean"?t:null}function Yr(e){let t=e.linkNonce?(e.linkNonce()??"").trim():null,n=t?null:e.accessToken?(e.accessToken()??"").trim():null,o=t||n?{licensee:"",licenseKey:"",secretKey:""}:e.triple();return{request:{licenseKey:o.licenseKey,licensee:o.licensee,secretKey:o.secretKey,freemiumKey:e.freemiumKey?.()??""},linkNonce:t,accessToken:n}}function Qr(e){let{width:t,height:n}=e.measure();return{request:{height:n,width:t},hints:{viewportWidth:t,viewportHeight:n}}}function Xr(e){let t=0;for(let n of e){if(n.isMeasure)continue;let o=n.distinctCount;typeof o=="number"&&o>t&&(t=o)}return t}function Le(e){if(e.recoveryFetchByCorrelation)return{version:null,fetchOnly:!0};if(e.recoveryFetchVersion!=null)return{version:e.recoveryFetchVersion,fetchOnly:!0};let t=e.settingVersion??null;if(e.genNew)return{version:t,fetchOnly:void 0};let n=(t??0)>0?t:null,o=(e.codeVersion??0)>0?e.codeVersion:null,a=n??o??t;return{version:a,fetchOnly:a!=null&&a>0?!0:void 0}}function Jr(e){let t=e.fetchCorrelationId!=null,o=t||e.recoveryFetchVersion!=null?!1:e.genNew,a=Le({genNew:o,recoveryFetchVersion:e.recoveryFetchVersion,recoveryFetchByCorrelation:t,settingVersion:e.settingVersion,codeVersion:e.codeVersion}),u=e.fetchArmedAtMs,l=t&&typeof u=="number"&&Number.isSafeInteger(u)&&u>0?u:void 0,i=e.fetchCutAtMs,C=t&&typeof i=="number"&&Number.isSafeInteger(i)&&i>0?i:void 0,y=t?Zr(e.fetchCause):"";return{genNew:o,version:a.version,fetchOnly:a.fetchOnly,fetchCorrelationId:e.fetchCorrelationId??void 0,...l!==void 0?{fetchArmedAtMs:l}:{},...C!==void 0?{fetchCutAtMs:C}:{},...y?{fetchCause:y}:{}}}function Zr(e){if(typeof e!="string")return"";let t=e.replace(/[\u0000-\u001f\u007f]+/g," ").trim().slice(0,120);return/[\ud800-\udbff]$/.test(t)&&(t=t.slice(0,-1)),t.trimEnd()}function eo(e){let t=n=>e.renderers.has(n);return{supportsD3:t("D3"),supportsPlotly:t("PLOTLY"),supportsVega:t("VEGA")}}function to(e){let t=e.cap!=null&&e.budget>e.cap?e.cap:e.budget;return{triesLeft:e.triesLeft??t,maxTries:t}}function no(e){return e&&e>0?{leafCardinality:Math.round(e)}:{}}function ro(e,t,n){let o=a=>typeof a=="number"&&Number.isInteger(a)&&a>0;return{...typeof e=="boolean"?{dataComplete:e}:{},...o(t)?{rowsWithheld:t}:{},...o(n)?{rowsFilteredOut:n}:{}}}var oo={fit:"Best fit",variety:"Something different"};function ve(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return t==="fit"||t==="variety"?t:null}function io(e){let t=ve(e);return t?{qualifyOrder:t}:{}}function Me(e,t){return e!=null&&t!=null&&e!==t}function so(e,t){return e?Me(t.capturedFor,t.now)?{shortlist:void 0,stale:!0}:{shortlist:{...e,ageMs:t.atMs>0?Math.max(0,Math.round(t.nowMs-t.atMs)):void 0},stale:!1}:{shortlist:void 0,stale:!1}}var ao=Object.freeze({integer:"number",decimal:"number",double:"number",datetime:"date",date:"date",boolean:"boolean",string:"text"});function Ie(e){let t=String(e??"").trim().toLowerCase();return ao[t]??t}function Ne(e){let t="";for(let n of e)t+=JSON.stringify([String(n.name??""),n.isMeasure?"M":"D",Ie(n.dataType)]);return t}function lo(e){return B(Ne(e))}var uo=2,co=3,mo=4,fo=64,po=8e3,go=6e4,yo=Object.freeze({RENDER_START:"render-start",RENDER_OK:"render-ok",RENDER_ERROR:"render-error",VIEW:"view",VIEW_VERDICT:"view-verdict",REDRAW:"redraw",INTERACT:"interact"}),ho=Object.freeze(["open","generate","version","rebind","data","sample","fix","resize","other"]);function Co(e,t){return t?`${t};draw:${e}`:`draw:${e}`}function bo(e){return e.hint?e.hint:e.generated?"generate":e.previous?e.outputHash!==e.previous.outputHash?"version":e.dataSignature!==e.previous.dataSignature?"data":e.viewport!==e.previous.viewport?"resize":"other":"open"}function Eo(){let e=new Set,t=new Set;return{firstDraw(n,o){if(!n)return!1;let a=`${n}|${o}`;return e.has(a)?!1:(e.add(a),!0)},firstInteract(n){return!n||t.has(n)?!1:(t.add(n),!0)}}}function To(e){return!!e&&!e.includes("|")&&!e.includes(",")}function ue(e,t,n,o){let a=`${e},${t}|${n}`;return o?`${a}|${Math.max(0,Math.round(o.count))}|${o.nonce}`:a}function So(e,t){let n=e;if(!n||!n.signer||typeof n.signer.sign!="function")throw new TypeError("createTelemetryClient needs the host's signer");if(!n.transport||typeof n.transport.post!="function")throw new TypeError("createTelemetryClient needs the host's transport");if(!n.clock||typeof n.clock.now!="function")throw new TypeError("createTelemetryClient needs the host's clock");if(!t||typeof t.baseUrl!="string"&&typeof t.baseUrl!="function")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof t.baseUrl=="string"&&t.baseUrl==="")throw new TypeError("createTelemetryClient needs the service's base URL");if(typeof t.clientVersion!="string"||t.clientVersion==="")throw new TypeError("createTelemetryClient needs the client version");if(typeof t.timeoutMs!="number"||!Number.isFinite(t.timeoutMs)||t.timeoutMs<=0)throw new TypeError("createTelemetryClient needs a positive deadline in milliseconds");let{signer:o,transport:a,clock:u}=n,l=t.apiPath??"/api",i=t.timeoutMs,C=()=>typeof t.baseUrl=="function"?t.baseUrl():t.baseUrl,y=f=>{try{t.onFailure?.(f)}catch{}},h=async(f,p,c,g)=>{let b;try{let T=await a.post(p,c,g,{timeoutMs:i});b=T.status;try{T.body?.cancel().catch(()=>{})}catch{}}catch(T){y({channel:f,stage:"post",status:null,error:T});return}(b<200||b>299)&&y({channel:f,stage:"status",status:b,error:null})};return{async sendClientMessage(f){let p,c,g;try{p=`${C()}${l}/LogClientMsg/?nocache=${u.now()}`,c=M(f),g=D(c,o)}catch(b){y({channel:"client-message",stage:"build",status:null,error:b});return}await h("client-message",p,c,{"Content-Type":"text/plain","X-Signature":g})},async countEvent(f,p,c){let g,b;try{g=`${C()}${l}/eventlog`,b=ue(f,t.clientVersion,p,c)}catch(T){y({channel:"event-count",stage:"build",status:null,error:T});return}await h("event-count",g,b,{"Content-Type":"text/plain"})}}}var Fe=2**31-1;function De(e){return Object.assign(new Error(`The request did not finish within ${e} ms.`),{name:"TimeoutError"})}function Ro(e){return typeof e=="number"&&e>0&&e<=Fe?null:new RangeError(`fetchTransport cannot keep a deadline of ${String(e)} ms: it must be a number of milliseconds above 0 and at most ${Fe} (about 24.8 days), the longest a timer can wait. Nothing was sent.`)}function xo(e,t={}){if(typeof e!="function")throw new TypeError("fetchTransport needs the host's fetch");let n=e,o=t.credentials??"omit";return{async post(a,u,l,i){let C=i.timeoutMs,y=Ro(C);if(y)throw y;let h=new AbortController,f=!1,p=setTimeout(()=>{f=!0,h.abort(De(C))},C),c=()=>h.abort(i.signal?.reason);i.signal&&(i.signal.aborted?c():i.signal.addEventListener("abort",c,{once:!0}));let g=!1,b=()=>{g||(g=!0,clearTimeout(p),i.signal?.removeEventListener("abort",c))},T=_=>f?De(C):_,P;try{P=await n(a,{method:"POST",body:u,headers:l,credentials:o,signal:h.signal})}catch(_){throw b(),T(_)}let R=J(P),L=R.statusText!==void 0?{statusText:R.statusText}:{};if(!R.body)return{status:R.status,...L,contentType:R.contentType,body:null,text:async()=>{try{return await R.text()}catch(_){throw T(_)}finally{b()}}};let x=R.body.getReader(),w=new ReadableStream({async pull(_){try{let s=await x.read();if(s.done){b(),_.close();return}_.enqueue(s.value)}catch(s){b(),_.error(T(s))}},cancel(_){return b(),x.cancel(_)}});return{status:R.status,...L,contentType:R.contentType,body:w,text:()=>new Response(w).text()}}}}var ke=300;function Ge(e){return String(e??"").toLowerCase().replace(/[^a-z0-9-]/g,"").slice(0,40)}var wo="/LLMChart/",_o="/LLMChart/qualify",Oo="/VisionReview/",Ao="/LLMChart/sample",Po="/RefundGenerate/",Lo=e=>!!e&&typeof e=="object"&&e.name==="TimeoutError",$=async e=>JSON.parse(await e.text());function vo(e){try{e.body?e.body.cancel().catch(()=>{}):e.text().catch(()=>{})}catch{}}function Mo(e,t){let n=e;if(!n||!n.signer||typeof n.signer.sign!="function")throw new TypeError("createGenerateClient needs the host's signer");if(!n.transport||typeof n.transport.post!="function")throw new TypeError("createGenerateClient needs the host's transport");if(!n.clock||typeof n.clock.now!="function")throw new TypeError("createGenerateClient needs the host's clock");if(!t||typeof t.baseUrl!="string"&&typeof t.baseUrl!="function")throw new TypeError("createGenerateClient needs the service's base URL");if(typeof t.baseUrl=="string"&&t.baseUrl==="")throw new TypeError("createGenerateClient needs the service's base URL");if(t.apiPath!==void 0&&typeof t.apiPath!="string")throw new TypeError("createGenerateClient's apiPath must be a string");if(t.nocache!==void 0&&t.nocache!==null&&typeof t.nocache!="function")throw new TypeError("createGenerateClient's nocache must be a function");let{signer:o,transport:a,clock:u}=n,l=t.apiPath??"/api",i=()=>typeof t.baseUrl=="function"?t.baseUrl():t.baseUrl,C=f=>t.nocache?t.nocache(f):String(u.now());async function y(f,p,c,g,b){let T=`${i()}${l}${p}?nocache=${C(f)}`,P={"Content-Type":"text/plain","X-Signature":D(c,o)},R=g.signal??void 0,L=(w,_)=>{let s=!!R?.aborted;return{kind:"transport",headersReceived:w,timedOut:!s&&Lo(_),cancelled:s,error:_}},x;try{x=await a.post(T,c,P,R?{timeoutMs:g.timeoutMs,signal:R}:{timeoutMs:g.timeoutMs})}catch(w){return L(!1,w)}if(x.status<200||x.status>299){let w="";if(g.readErrorBody===!1)vo(x);else try{w=(await x.text()).slice(0,ke)}catch{}return{kind:"http",status:x.status,statusText:x.statusText??"",bodyStart:w}}try{return{kind:"answer",status:x.status,value:await b(x)}}catch(w){return L(!0,w)}}function h(f,p){if(!p||typeof p.timeoutMs!="number"||!Number.isFinite(p.timeoutMs)||p.timeoutMs<=0)throw new TypeError(`The ${f} call needs a positive deadline in milliseconds`);return p}return{async generate(f,p){let c=h("generate",p),g=c.onStage??void 0;return y("generate",wo,M(f),c,b=>Z(b,g))},async qualify(f,p){let c=h("qualify",p),g=c.route??_o;if(typeof g!="string"||!g.startsWith("/"))throw new TypeError("The qualify route must start with '/'");return y("qualify",g,M(f),c,$)},async review(f,p){let c=h("review",p),g=JSON.stringify(f);if(typeof g!="string")throw new TypeError("The review wire did not serialize to JSON");return y("review",Oo,g,c,$)},async sample(f,p){let c=h("sample",p);return y("sample",Ao,M(f),c,$)},async refund(f,p,c){let g=h("refund",p);if(typeof f!="string"||f.trim()==="")throw new TypeError("A refund needs the generation's correlation id");let b=Ge(c),T=b?{CorrelationID:f.trim(),Reason:b}:{CorrelationID:f.trim()};return y("refund",Po,JSON.stringify(T),g,$)}}}export{gn as ADMIN1_MATCH_PCT,yn as ADMIN1_MATCH_PCT_NAMED,j as CITY_ROLE_MATCH_PCT,Yt as CITY_TIE_RATIO,yo as CLIENT_EVENT_KINDS,$r as CLIENT_SECRET_MISMATCH,Je as COMPOUND_MIN_STEM,Tt as CYCLE_MEMBERS,Rt as CYCLE_WORDS,be as DATE_LEVEL_GREGORIAN_YEAR_MAX,Ce as DATE_LEVEL_GREGORIAN_YEAR_MIN,Ar as DATE_LEVEL_LANGUAGES,ae as DATE_LEVEL_NAMES,he as DATE_LEVEL_NON_GREGORIAN_LANGUAGES,Jn as DEFAULT_GAP_FACTOR,ut as DEFAULT_TEMPERATURE,ho as DRAW_REASONS,qr as FREEMIUM_ATTEMPT_SPENT,zr as FREEMIUM_COLUMN_CAP,at as GET_RANDOM,et as GLUED_STEM_MIN,nt as HANGUL_MIN_STEM,Re as HOST_SYNTHETIC_COLUMNS,ke as HTTP_BODY_START_CHARS,Kn as IDENTIFIER_HEAD_INITIAL,Bn as IDENTIFIER_UNFOLDED,zn as IDENTIFIER_WORDS,Ln as INTENSIVE_SUFFIX_TOKENS,Pn as INTENSIVE_WORD_TOKENS,yr as IndexedText,_n as LATITUDE_WORDS,On as LONGITUDE_WORDS,Nt as LOOSE_KEY_MIN_LENGTH,Dt as LooseIndex,Zn as MAX_RUN_BOUNDS,Br as OAUTH_SIGNED_OUT,Kr as OAUTH_TOKEN_EXPIRED,At as PERIOD_CODE_FORMS,Ot as PERIOD_CODE_MEMBERS,Pt as PERIOD_ORDINALS,Lt as PERIOD_UNFOLDED,Mn as POSITIONAL_SUFFIX_TOKENS,vn as POSITIONAL_WORD_TOKENS,Er as PREVIEW_OMITTED_FIELDS,Pe as PROGRESS_STAGE_IDS,oo as QUALIFY_ORDER_LABELS,Vt as REGION_FRAME_WINDOWS,v as ROLE_MATCH_PCT,nr as SERIES_COMPLETENESS_MAX_LISTED,rr as SERIES_COMPLETENESS_MIN_FILL,or as SERIES_KEY_MAX_DISTINCT,mo as SEV_ERROR,uo as SEV_INFO,fo as SEV_USER_PRESENTED,co as SEV_WARNING,B as SIMPLE_STRING_HASH,st as STR,ot as SUBSTRING_MIN,Ve as SUPPORTED_LANGUAGES,Ue as SUPPORTED_LANGUAGE_CODES,go as TELEMETRY_TIMEOUT_DEV_MS,po as TELEMETRY_TIMEOUT_MS,$e as VOCABULARY_LANGUAGE_CODES,qe as VOCABULARY_ONLY_LANGUAGES,St as YEAR_WORDS,Xt as admin1CodesForName,Y as admin1LookupRegistered,H as admin1MatchPct,Un as allowedAggregations,bt as anchorLocalWallClockDates,jr as answerIsRetryable,pn as buildGeoIsoColumn,ln as buildGeoPointColumns,Cn as buildProvinceIsoColumn,xt as calendarWordIn,eo as capabilityFields,cn as cityMatchPct,un as cityTagsFor,fr as classifyAdditivity,bo as classifyDraw,Vn as classifyForAggregation,pr as classifyNumericValueNature,dr as classifyTemporal,Bt as clearAdmin1LookupForTests,Dn as codeNeedsLegacyAggNames,Yn as codeReadsColumn,Qn as codeReadsColumnsByRoleOrPosition,Fn as collapseRepeatedAggPrefix,Xn as columnsTheCodeReads,An as coordinateAxisOfWords,jt as countryIso2,qt as countryRegion,Eo as createDrawLedger,Mo as createGenerateClient,So as createTelemetryClient,Yr as credentialFields,ro as dataCompletenessFields,Lr as dateLevelPart,vr as dateLevelYearAdmits,Et as datesAreTimeOfDayOnly,ht as datesCarryTimeOfDay,Tn as decimalSeparatorOf,Hn as defaultAggregation,Sn as detectDecimalSeparator,En as detectFormatSignature,dn as detectGeo,Wt as detectOrdinalDomain,cr as detectTextDatePattern,Co as drawLocation,M as encodePayload,hr as engineTypeForSqlType,kn as englishImplicitAggNames,ue as eventLogLine,Jr as fetchFields,xo as fetchTransport,Ke as foldName,Dr as freemiumColumnCapRefusal,xe as freemiumColumnsOverCap,we as freemiumDateHierarchyClauses,tt as gluedPrefixStems,Fr as guardColumnNames,Sr as gzipWireText,rt as hangulWordEndsWith,Nn as hasDefaultAggPrefix,Qe as hasUnsegmentedScript,mr as hostAggHint,zt as inMiddleEast,br as ingest,qn as isAggregationAllowed,G as isBlankLike,tn as isCityTableLoaded,q as isColumnContextRef,lt as isDeterministicRefusal,To as isEventLogCode,sn as isGeoPointAmbiguity,ur as isIdentifierName,fn as isJoinGeoKind,Zt as isKnownProvinceId,xr as isNdjsonContentType,kt as isOrdinalFriendlyName,Ft as isUsableLooseKey,Rr as keyedSigner,no as leafCardinalityField,pt as localMidnightDateColumns,ft as localMidnightToUtcDay,Ct as localWallClockDateColumns,_t as localizedCycleIn,jn as localizedIdentifierWordIn,wt as localizedYearWordIn,N as looksLikeCountryColumn,It as looseNameKey,it as matchNameToken,Xr as maxNonMeasureCardinality,bn as measureAdmin1Columns,tr as measureCadence,lr as measurePersistence,ar as measureSeriesCompleteness,D as messageSignature,Nr as missingHardColumnRefs,wn as monthLookupFor,je as nameLetterRuns,Wn as nameLooksIntensiveRate,Gn as nameLooksPositional,Te as nameProbeIsGuarded,Ir as nameProbeKeepsDrawing,Be as nameWords,nn as normalizeCountry,gt as normalizeLocalMidnightDates,xn as normalizeMonthKey,W as normalizePlaceName,on as normalizeZip5,so as offeredShortlistFor,Cr as parseCsvRows,ct as parseDateStable,Wr as parseGenerateResponse,Rn as parseNumberText,Vr as parseQualifyResponse,Ur as parseReviewVerdict,er as parseTemporalPoint,Tr as payloadPreview,Mt as periodCodeSeries,sr as pickSeriesColumn,Hr as progressStageOf,gr as promotesToMeasure,Jt as provinceIdForAdmin1Code,hn as provinceIdForRow,io as qualifyOrderField,ve as qualifyOrderOf,Z as readGenerateStream,Ye as readName,vt as readPeriodCode,E as readWireField,Ge as refundReasonCode,Kt as registerAdmin1Lookup,en as registerCityTable,Ht as registerIso3Regions,I as resolveAdmin1,Qt as resolveCityAdmin1,Le as resolveFetchVersion,an as resolveGeoPoint,ze as resolveLanguage,Or as resolvePointRoles,to as retryFields,Gt as safeDistinctValuesToShip,Ne as schemaIdentity,lo as schemaIdentityKey,Ie as schemaTypeFamily,ir as seriesKeyVerdict,$n as shareOfTotalIsHonest,Me as shortlistIsStale,In as stripHostAggPrefix,$t as summarizeCountryRegions,Ut as summarizeGeoExtent,He as supportedLanguage,mn as toGeoIso,Xe as unsegmentedRuns,yt as utcWallClock,Qr as viewportFields,K as vocabularyLanguage,dt as wholeDayFrame,mt as wholeDayIso,J as wireResponseFromFetch,Ze as wordEndsWith,ie as zipMatchPct,U as zipPrefixCandidates,rn as zipToPrefix3};
@@ -81,6 +81,13 @@ export interface ParsedGenerateResponse {
81
81
  isPollFinal?: boolean;
82
82
  /** Which final answer: "cancelled", "failed", "not-received" or "lost-in-restart". Present only when sent. */
83
83
  pollOutcome?: string;
84
+ /**
85
+ * The chart type's own minimum drawing size in pixels: below it the chart must SCROLL, never squash.
86
+ * Present only when the server sent a positive number; absent when the generation has no type or the
87
+ * server is older, so a host keeps drawing at whatever size it was given.
88
+ */
89
+ chartMinWidth?: number;
90
+ chartMinHeight?: number;
84
91
  /**
85
92
  * The account's thumbnail override - an account-level "include thumbnails" setting, which a
86
93
  * host counts as the reader's consent to upload a new chart's first rendering. Unlike the flags
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bicharts/shape-core",
3
- "version": "0.6.113",
3
+ "version": "0.6.115",
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",