df-script 1.7.0 → 1.9.0

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.
Files changed (36) hide show
  1. package/README.md +51 -12
  2. package/dist/api.d.ts +2 -1
  3. package/dist/columnExpressions/ExprBase.d.ts +8 -0
  4. package/dist/columnExpressions/constants.d.ts +2 -0
  5. package/dist/columnExpressions/functions/duration.d.ts +33 -0
  6. package/dist/columnExpressions/functions/when.d.ts +8 -6
  7. package/dist/columnExpressions/index.d.ts +2 -0
  8. package/dist/columnExpressions/mixins/AggregationExpr.d.ts +203 -1
  9. package/dist/columnExpressions/mixins/ArrayExpr.d.ts +57 -41
  10. package/dist/columnExpressions/mixins/StringExpr.d.ts +277 -13
  11. package/dist/columnExpressions/mixins/StructExpr.d.ts +7 -7
  12. package/dist/columnExpressions/mixins/TemporalExpr.d.ts +123 -72
  13. package/dist/columnExpressions/typeInference.d.ts +13 -0
  14. package/dist/columnExpressions/types.d.ts +1 -1
  15. package/dist/columnExpressions/utils.d.ts +19 -0
  16. package/dist/constants.d.ts +44 -3
  17. package/dist/dataframe/dataframe.d.ts +233 -109
  18. package/dist/dataframe/types.d.ts +25 -3
  19. package/dist/dataframe/utils.d.ts +21 -1
  20. package/dist/datatypes/types.d.ts +8 -3
  21. package/dist/exceptions/index.d.ts +10 -0
  22. package/dist/exceptions/utils.d.ts +2 -0
  23. package/dist/index.js +5 -5
  24. package/dist/index.mjs +5 -5
  25. package/dist/types.d.ts +132 -1
  26. package/dist/utils/array.d.ts +62 -6
  27. package/dist/utils/binary.d.ts +6 -2
  28. package/dist/utils/date.d.ts +6 -2
  29. package/dist/utils/duration.d.ts +5 -0
  30. package/dist/utils/index.d.ts +1 -0
  31. package/dist/utils/json.d.ts +54 -2
  32. package/dist/utils/number.d.ts +5 -2
  33. package/dist/utils/object.d.ts +13 -0
  34. package/dist/utils/string.d.ts +78 -2
  35. package/dist/utils/table.d.ts +76 -0
  36. package/package.json +13 -3
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";var xn=Object.defineProperty;var Bo=Object.getOwnPropertyDescriptor;var $o=Object.getOwnPropertyNames;var Ko=Object.prototype.hasOwnProperty;var R=(n,t)=>()=>(n&&(t=n(n=0)),t);var wr=(n,t)=>{for(var e in t)xn(n,e,{get:t[e],enumerable:!0})},qo=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $o(t))!Ko.call(n,o)&&o!==e&&xn(n,o,{get:()=>t[o],enumerable:!(r=Bo(t,o))||r.enumerable});return n};var Sr=n=>qo(xn({},"__esModule",{value:!0}),n);var et,wn,Sn,jt,Tn,_t=R(()=>{"use strict";et="*",wn="*literal*",Sn="*coalesce*",jt="*element*",Tn="*struct*"});function B(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function It(n){if(!B(n))return!1;let t=Object.getPrototypeOf(n);if(t===null)return!0;let e=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof e!="function"?!1:Function.prototype.toString.call(e)===us}function Nr(n){if(typeof n!="function")return!1;let t="";try{t=Function.prototype.toString.call(n)}catch{return!1}if(/^class[\s{]/.test(t))return!0;if(n===Symbol||n===BigInt)return!1;let e=Object.getOwnPropertyDescriptor(n,"prototype");return e&&!e.writable?t.includes("[native code]"):!1}function ut(n,t,e,r){if(!B(n))return!1;if(!(Symbol.toStringTag in n))return Object.prototype.toString.call(n)===t;if(!e)return!1;try{return e.call(n,r),!0}catch{return!1}}function M(n){return ut(n,Wo,Cn)&&Cn?!Number.isNaN(Cn.call(n)):!1}function bt(n){return ut(n,Go,ss)}function Ce(n){return ut(n,zo,is)}function De(n){return ut(n,Ho,as)}function jr(n){return ut(n,Yo,ls,"key")}function _r(n){return B(n)?Symbol.toStringTag in n?n instanceof Error:Object.prototype.toString.call(n)===Jo:!1}function Dr(n){return ut(n,Er,Dn)}function Ar(n){return ut(n,Rr,An)}function Or(n){return ut(n,Ur,On)}function kr(n){return ut(n,Fr,Jt)}function Ir(n){return ut(n,Mr,Yt)}function it(n){if(!B(n))return n;switch(Object.prototype.toString.call(n)){case Rr:if(Ar(n))try{return An.call(n)}catch{}break;case Er:if(Dr(n))try{return Dn.call(n)}catch{}break;case Ur:if(Or(n))try{return On.call(n)}catch{}break;case Fr:if(kr(n)&&Jt)try{return Jt.call(n)}catch{}break;case Mr:if(Ir(n)&&Yt)try{return Yt.call(n)}catch{}break}if(Symbol.toStringTag in n){if(Ar(n))try{return An.call(n)}catch{}else if(Dr(n))try{return Dn.call(n)}catch{}else if(Or(n))try{return On.call(n)}catch{}else if(kr(n)&&Jt)try{return Jt.call(n)}catch{}else if(Ir(n)&&Yt)try{return Yt.call(n)}catch{}}if(typeof n.valueOf=="function"&&n.valueOf!==Object.prototype.valueOf)try{let e=n.valueOf();if(typeof e!="object"||e===null)return e}catch{}return n}var Wo,Go,zo,Ho,Jo,Yo,Er,Rr,Ur,Fr,Mr,Xo,Zo,Tr,Cr,Qo,ts,es,ns,rs,os,ss,is,as,Cn,ls,Dn,An,On,Jt,Yt,us,xt=R(()=>{"use strict";Wo="[object Date]",Go="[object RegExp]",zo="[object Set]",Ho="[object Map]",Jo="[object Error]",Yo="[object URLSearchParams]",Er="[object String]",Rr="[object Number]",Ur="[object Boolean]",Fr="[object BigInt]",Mr="[object Symbol]",Xo=typeof Date=="function"?Date.prototype:void 0,Zo=Object.getPrototypeOf(/./),Tr=typeof Set=="function"?Set.prototype:void 0,Cr=typeof Map=="function"?Map.prototype:void 0,Qo=typeof URLSearchParams=="function"?URLSearchParams.prototype:void 0,ts=Object.getPrototypeOf(""),es=Object.getPrototypeOf(0),ns=Object.getPrototypeOf(!0),rs=typeof BigInt=="function"?BigInt.prototype:void 0,os=typeof Symbol=="function"?Symbol.prototype:void 0,ss=Object.getOwnPropertyDescriptor(Zo,"source")?.get,is=Tr?Object.getOwnPropertyDescriptor(Tr,"size")?.get:void 0,as=Cr?Object.getOwnPropertyDescriptor(Cr,"size")?.get:void 0,Cn=Xo?.valueOf,ls=Qo?.has,Dn=ts.valueOf,An=es.valueOf,On=ns.valueOf,Jt=rs?.valueOf,Yt=os?.valueOf,us=Function.prototype.toString.call(Object)});function z(n,t){return typeof n!="number"?!1:Number.isNaN(n)?t?.allowNaN??t?.allowNonFiniteNumbers??!1:Number.isFinite(n)?!0:t?.allowNonFiniteNumbers??!1}function vr(n){for(let t=1;t<n.length;t++)if(n[t].length!==3)return!1;return!0}function $r(n,t){if(cs.test(n))return null;let e=n.trim();if(e==="")return null;e.startsWith("(")&&e.endsWith(")")&&(e="-"+e.slice(1,-1).trim());let r=e[e.length-1];(r==="-"||r==="+")&&e.length>1&&(e=r+e.slice(0,-1).trim()),t||(e=e.replace(fs,""));let o=e.includes("."),s=e.includes(",");if(o&&s){let i=e.lastIndexOf("."),a=e.lastIndexOf(","),l=a>i,c=l?".":",",u=l?a:i,f=e.slice(0,u).split(c);return f.length>1&&!vr(f)||f[0].replace(Lr,"").length>3?null:l?e.replace(Vr,"").replace(Ae,"."):e.replace(Ae,"")}if(s||o){let i=s?",":".",a=e.split(i);if(a.length>2||i===","&&a.length===2&&a[1].length===3){let l=a[0].replace(Lr,"").length;if(l===0){if(i===","||a.length>2)return null}else return l>3?null:vr(a)?e.replace(s?Ae:Vr,""):null}if(s)return e.replace(Ae,".")}return e}function K(n,{allowNonFiniteNumbers:t=!1,strictNumericString:e=!1,floatScientific:r=!0}={}){if(n==null||typeof n=="symbol")return null;switch(n=it(n),typeof n){case"number":return z(n,{allowNonFiniteNumbers:t})?n:null;case"boolean":return n?1:0;case"bigint":{let o=Number(n);return z(o,{allowNonFiniteNumbers:t})?o:null}case"object":{if(M(n)){let o=n.getTime();return z(o,{allowNonFiniteNumbers:t})?o:null}return null}case"string":{let o=$r(n,e);if(o===null)return null;if(t){let a=o.toLowerCase();if(a==="nan"||a==="-nan"||a==="+nan")return NaN;if(a==="infinity"||a==="+infinity")return 1/0;if(a==="-infinity")return-1/0}if(Br.test(o)&&!r||!Pr.test(o))return null;let i=Number(o);return z(i,{allowNonFiniteNumbers:t})?i:null}default:return null}}function Kr({locale:n="en-US",accountingNegatives:t=!1,fallback:e="NaN",formatNonFinite:r=!1,...o}={}){o.useGrouping===void 0&&(o.useGrouping=!1),o.maximumFractionDigits===void 0&&o.maximumSignificantDigits===void 0&&(o.maximumFractionDigits=20),t&&(o.currencySign="accounting",o.style===void 0&&(o.style="decimal"));let s=new Intl.NumberFormat(n,o);return i=>{if(typeof i=="bigint")return t&&i<0n?`(${s.format(-i)})`:s.format(i);let a=K(i,{allowNonFiniteNumbers:!0});return a===null||Number.isNaN(a)?e:Number.isFinite(a)?t&&a<0?`(${s.format(Math.abs(a))})`:s.format(a):r?e:t&&a===-1/0?`(${s.format(1/0)})`:String(a)}}function kn(n,{floatPrecision:t="Float64",allowNonFiniteNumbers:e=!0,floatScientific:r=!0,strictNumericString:o=!1}={}){let s=K(n,{allowNonFiniteNumbers:e,floatScientific:r,strictNumericString:o});return s===null||(t==="Float32"&&(s=Math.fround(s)),!z(s,{allowNonFiniteNumbers:e}))?null:s}function Wr(n,{range:t="Int32"}={}){if(!z(n)||!Number.isInteger(n))return!1;let e=typeof t=="string"?qr[t]:t;return n>=e.min&&n<=e.max}function pt(n,{range:t="Int32",coerce:e="truncate"}={}){let r=K(n);if(r===null)return null;switch(e){case"round":r=Math.round(r);break;case"floor":r=Math.floor(r);break;case"ceil":r=Math.ceil(r);break;case"truncate":r=Math.trunc(r);break}let o=typeof t=="string"?qr[t]:t;return ct(r,{min:o.min,max:o.max})}function vt(n,{range:t="Int64",truncate:e=!1}={}){if(n==null||typeof n=="symbol")return null;n=it(n);let r=null;if(typeof n=="bigint")r=n;else if(typeof n=="string"){let s=$r(n,!1);if(s===null||!Pr.test(s))return null;if(Br.test(s)){let i=Number(s);if(!Number.isFinite(i)||!e&&!Number.isInteger(i))return null;r=BigInt(Math.trunc(i))}else{let i=s.indexOf(".");if(i!==-1){if(!e&&/[^0]/.test(s.slice(i+1)))return null;s=s.slice(0,i)}try{r=BigInt(s)}catch{return null}}}else{let s=K(n);if(s===null||!e&&!Number.isInteger(s))return null;r=BigInt(Math.trunc(s))}let o=typeof t=="string"?ms[t]:t;return ct(r,{min:o.min,max:o.max})}function ps(n,t){let e=n-t;if(e<0||t<0)return null;if(e>15)return Number.H;let r=Math.min(t,16),o=Math.pow(10,e)-Math.pow(10,-r);return o>0?o:null}function In(n,t){let e=n.toString();if(e.includes("e")){let r=Math.pow(10,t);return Math.round(n*r)/r}return+(Math.round(+(e+"e"+t))+"e"+-t)}function Oe(n,{precision:t,scale:e}={}){let r=K(n);if(r===null)return null;let o=r;if(e!==void 0&&(o=In(o,e)),t!==void 0){let i=ps(t,e??0);i!==null&&(o=ct(o,{min:-i,max:i}))}return o}function ct(n,t){if(!t)return n;let{min:e=null,max:r=null,safe:o=!0}=t;if(e!==null&&r!==null&&e>r)return e;let s=n;if(o&&typeof s=="number"){if(Number.isNaN(s))return e!==null?e:r!==null?r:n;if(s===1/0)return r!==null?r:n;if(s===-1/0)return e!==null?e:n}return e!==null&&s<e?e:r!==null&&s>r?r:s}function Gr(n){let t=n|0;return function(){let e=t=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}var Pr,cs,fs,Br,Lr,Vr,Ae,qr,ms,Xt=R(()=>{"use strict";xt();Pr=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,cs=/0[xobXOB]/,fs=/[\s_]/g,Br=/[eE]/;Lr=/^[+-]/,Vr=/\./g,Ae=/,/g;qr={Int8:{min:-128,max:127},Int16:{min:-32768,max:32767},Int32:{min:-2147483648,max:2147483647},UInt8:{min:0,max:255},UInt16:{min:0,max:65535},UInt32:{min:0,max:4294967295}};ms={Int64:{min:-9223372036854775808n,max:9223372036854775807n},UInt64:{min:0n,max:18446744073709551615n}}});function L(n){if(!ArrayBuffer.isView(n))return!1;if(zr)return zr.call(n)!==void 0;let t=Object.prototype.toString.call(n);return t!=="[object DataView]"&&t.endsWith("Array]")}function O(n){return Array.isArray(n)||L(n)}function Zt(n){return n==null?[]:Array.isArray(n)?[...n]:L(n)?Array.from(n):[n]}function Lt(n){let t=Zt(n),e=t.length,r=new Array(e);for(let o=0;o<e;o++)r[o]=String(t[o]);return r}function ke(n,t,e){let r=n.length,o=t<-r||t>=r;if(o&&!e)throw new at(`Index ${t} is out of bounds for array of length ${r}`);return o?null:n.at(t)??null}function H(n,t,{mode:e="every",allowNulls:r=!1,allowEmpty:o=!0}={}){if(!O(n))return!1;let s=n.length;if(s===0)return o?e==="every":!1;let i=n,a;if(typeof t=="function")a=Nr(t)?c=>c instanceof t:t;else switch(t){case"null":a=l=>l===null;break;case"undefined":a=l=>l===void 0;break;case"nullish":a=l=>l==null;break;case"any":a=()=>!0;break;case"date":a=M;break;case"object":a=B;break;case"plainObject":a=It;break;case"number":a=z;break;default:a=l=>typeof l===t;break}if(r){let l=a;a=c=>c==null||l(c)}if(e==="every"){for(let l=0;l<s;l++)if(!a(i[l]))return!1;return!0}else{for(let l=0;l<s;l++)if(a(i[l]))return!0;return!1}}function Qt(n,{descending:t=!1,nullsLast:e=!0}={}){if(!O(n))return[];let r=n,o=r.length;if(o===0)return[];if(L(n)){let f=r.slice().sort();return t&&f.reverse(),Array.from(f)}let s=[],i=[],a=!0,l=!0,c=!0;for(let f=0;f<o;f++){let m=r[f];if(m==null)i.push(m);else if(s.push(m),c){let h=typeof m;h!=="number"&&(a=!1),h!=="string"&&(l=!1),!a&&!l&&(c=!1)}}return s.length>1&&(a?s.sort(t?(f,m)=>m-f:(f,m)=>f-m):l?s.sort(t?(f,m)=>m.localeCompare(f):(f,m)=>f.localeCompare(m)):s.sort((f,m)=>{let h=typeof f,p=typeof m;if(h!==p){let y=h<p?-1:1;return t?-y:y}return f<m?t?1:-1:f>m?t?-1:1:0})),i.length===0?s:e?s.concat(i):i.concat(s)}function N(n){if(!O(n))return Hr;let t=n.length;if(t===0)return Hr;let e=null,r=null,o=null,s=null,i=0,a=0,l=0,c=0,u=0,f=0;for(let h=0;h<t;h++){let p=n[h];if(p==null||typeof p=="number"&&!z(p,{allowNonFiniteNumbers:!0,allowNaN:!1})){a++;continue}(e==null||p<e)&&(e=p,o=h),(r==null||p>r)&&(r=p,s=h);let y=K(p);if(y!==null){let d=l+y;Math.abs(l)>=Math.abs(y)?c+=l-d+y:c+=y-d+l,l=d,i++;let g=y-u;u+=g/i;let b=y-u;f+=g*b}}let m=i>1?f/(i-1):0;return{sum:i>0?l+c:null,count:i,min:e,max:r,minIdx:o,maxIdx:s,mean:i>0?(l+c)/i:null,variance:m,std:Math.sqrt(m),nullCount:a,len:t,hasNulls:a>0,isNumeric:i>0&&i===t-a}}function wt(n,{strict:t=!1,keySelector:e}={}){let r=Array.from(n),o=new Map;if(t){let i=e??W,a=new Map,l=r.length;for(let u=0;u<l;u++){let f=r[u],m=i(f),h=a.get(m);h===void 0?a.set(m,{val:f,count:1}):h.count++}let c=[];for(let u of a.values())c.push(u.val);for(let u=0;u<l;u++){let f=r[u],m=i(f),h=a.get(m);o.set(f,h.count)}return{values:c,count:c.length,frequencies:o}}let s=r.length;for(let i=0;i<s;i++){let a=r[i];o.set(a,(o.get(a)??0)+1)}return{values:Array.from(o.keys()),count:o.size,frequencies:o}}function Yr(n,{step:t=1,offsetStart:e=0,offsetEnd:r,maxItemsGathered:o,ut:s=!0}={}){if(n==null)return null;if(o!==void 0&&o<=0)return[];if(t===0)throw new Error("Step size step cannot be zero");let i=n.length;if(i===0?e!==0:e>=i||e<-i){if(!s)throw new Error(`Start offset ${e} is out of bounds for array of length ${i}`);return null}let l=e<0?i+e:e,c=r!==void 0?r<0?i+r:r:t>0?i:-1,u=[];if(t>0)for(let f=l;f<c&&f<i&&!(f>=0&&(u.push(n[f]),o!==void 0&&u.length>=o));f+=t);else for(let f=l;f>c&&f>=0&&!(f<i&&(u.push(n[f]),o!==void 0&&u.length>=o));f+=t);return u}function Xr(n,t=",",{ignoreNulls:e=!1,nullValue:r="",prefix:o="",suffix:s="",limit:i,truncationMarker:a="...",valueFormatter:l}={}){let c=n.length,u=[],f=i!==void 0?Math.max(0,i):c,m=!1;for(let h=0;h<c;h++){if(u.length>=f){m=!0;break}let p=n[h];p!=null?u.push(l?l(p,h):String(p)):e||u.push(r)}return o+u.join(t)+(m?a:"")+s}function Et(n,t,e={}){let r=n.length,{mode:o="cumulative",step:s=1,coerce:i=y=>y,condition:a,reverse:l=!1,startIndex:c=l?r-1:0,endIndex:u=l?-1:r}=e,f=l?-1:1,m=c,h=u,p=(y,d)=>{(!a||a(n[y],y,n))&&(n[y]=i(d))};if(o==="constant"){let y=i(t);for(let d=m;l?d>h:d<h;d+=f)p(d,y)}else if(o==="independent")if(typeof s=="function"){let y=0;for(let d=m;l?d>h:d<h;d+=f)p(d,s({index:y,initialValue:t,originalValue:n[d],absoluteIndex:d,targetArray:n})),y++}else for(let y=m;l?y>h:y<h;y+=f)p(y,t+y*s);else{let y=t,d=!0,g=0;for(let b=m;l?b>h:b<h;b+=f)d?(p(b,y),d=!1):(typeof s=="function"?y=s({prev:y,index:g,originalValue:n[b],absoluteIndex:b,targetArray:n}):y=y+s,p(b,y)),g++}}function Zr(n){let t=n.length,e=0,r=new Float64Array(t);for(let s=0;s<t;s++){let i=n[s],a=K(i,{allowNonFiniteNumbers:!0});a!==null&&z(a,{allowNonFiniteNumbers:!0,allowNaN:!1})&&(r[e++]=a)}if(e===0)return null;let o=r.subarray(0,e);return o.sort(),o}function Vt(n){let t=Zr(n);if(!t)return null;let e=t.length,r=Math.floor(e/2);return e%2!==0?t[r]:(t[r-1]+t[r])/2}function Ie(n,t){if(t<0||t>1)return null;let e=Zr(n);if(!e)return null;let r=e.length,o=t*(r-1),s=Math.floor(o),i=Math.ceil(o);return s===i?e[s]:e[s]+(o-s)*(e[i]-e[s])}function Ee(n){if(!O(n)||n.length===0)return null;let t=new Map,e=n.length,r=0,o=[];for(let s=0;s<e;s++){let i=n[s];if(i==null||typeof i=="number"&&!z(i,{allowNonFiniteNumbers:!0,allowNaN:!1}))continue;let a=(t.get(i)??0)+1;t.set(i,a),a>r?(r=a,o=[i]):a===r&&o.push(i)}return o.length===0?null:Qt(o)}function Qr(n,t){let e=n.length;if(e===0)return[];let r=Math.trunc(t);if(isNaN(r)||r===0)return Array.isArray(n)?n.slice():Array.from(n);let o=Math.abs(r);if(o>=e)return new Array(e).fill(null);let s=new Array(e);if(r>0){s.fill(null,0,r);for(let i=r;i<e;i++){let a=n[i-r];s[i]=a??null}}else{let i=e-o;for(let a=0;a<i;a++){let l=n[a+o];s[a]=l??null}s.fill(null,i,e)}return s}function En(n){let t=n.length,e=0,r=0,o=0,s=0,i=0,a=0;for(let m=0;m<t;m++){let h=n[m];if(!h)continue;let p=K(h[0]),y=K(h[1]);if(p===null||y===null)continue;e++;let d=p-r;r+=d/e;let g=p-r,b=y-o;o+=b/e;let S=y-o;a+=d*S,s+=d*g,i+=b*S}if(e<2)return{covariance:null,correlation:null};let l=a/(e-1);if(s===0||i===0)return{covariance:l,correlation:null};let c=Math.sqrt(s*i);if(c===0||Number.isNaN(c))return{covariance:l,correlation:null};let u=a/c,f=Math.max(-1,Math.min(1,u));return{covariance:l,correlation:f}}function Jr(n){let t=n.length,e=new Int32Array(t);for(let s=0;s<t;s++)e[s]=s;e.sort((s,i)=>n[s]-n[i]);let r=new Float64Array(t),o=0;for(;o<t;){let s=o+1;for(;s<t&&n[e[s]]===n[e[o]];)s++;let i=(o+1+s)/2;for(let a=o;a<s;a++)r[e[a]]=i;o=s}return r}function hs(n,t,e){if(e<2)return null;let r=0,o=0,s=0,i=0,a=0;for(let u=0;u<e;u++){let f=n[u],m=t[u],h=f-r;r+=h/(u+1);let p=f-r,y=m-o;o+=y/(u+1);let d=m-o;a+=h*d,s+=h*p,i+=y*d}if(s===0||i===0)return null;let l=Math.sqrt(s*i);if(l===0||Number.isNaN(l))return null;let c=a/l;return Math.max(-1,Math.min(1,c))}function to(n){let t=n.length,e=new Float64Array(t),r=new Float64Array(t),o=0;for(let a=0;a<t;a++){let l=n[a];if(l){let c=K(l[0]),u=K(l[1]);c!==null&&u!==null&&(e[o]=c,r[o]=u,o++)}}if(o<2)return null;let s=Jr(e.subarray(0,o)),i=Jr(r.subarray(0,o));return hs(s,i,o)}function eo(n){let t=n.length,e=0,r=0;for(let o=0;o<t;o++){let s=n[o];if(!s)continue;let i=K(s[0]),a=K(s[1]);i===null||a===null||(e+=i*a,r++)}return r>0?e:null}function no(n){let t=n.length,e=0,r=0,o=0;for(let s=0;s<t;s++){let i=n[s];if(!i)continue;let a=K(i[0]),l=K(i[1]);a===null||l===null||(e+=a*l,r+=l,o++)}return o===0||Math.abs(r)<1e-12?null:e/r}var zr,Hr,te=R(()=>{"use strict";xt();Xt();Re();rt();zr=(()=>{try{let n=new Uint8Array(0),t=Object.getPrototypeOf(n),e=Object.getPrototypeOf(t),r=Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.get;return r&&r.call(n)==="Uint8Array"?r:void 0}catch{return}})();Hr={sum:null,count:0,min:null,max:null,minIdx:null,maxIdx:null,mean:null,variance:0,std:0,nullCount:0,len:0,hasNulls:!1,isNumeric:!1}});function ro(n){let t=it(n);return typeof t=="string"?t.trim().length===0:!1}function Ue(n){let t=it(n);if(t==null)return"";let e=String(t);return typeof RegExp.escape=="function"?RegExp.escape(e):e.replace(ys,"\\$&")}function Pt(n,t=null,e={}){if(n==null)return e.returnStringOnNull?"":null;let{mode:r="both",returnStringOnNull:o=!1,maxScanStart:s=1,maxScanEnd:i=1,maxMatchesStart:a=1,maxMatchesEnd:l=1,trimFirst:c=!1,stringOptions:u}=e,{literal:f=!1,caseInsensitive:m=!1}=u??{},h=(T,D="both")=>D==="start"?T.trimStart():D==="end"?T.trimEnd():T.trim(),p=n;if(c&&t!=null&&(p=h(n,r)),t==null){let T=h(p,r);return o||T!==""?T:null}let y=bt(t)?T=>{try{t.lastIndex=0}catch{}return t.test(T)}:(()=>{let T=new Set(m?t.toLowerCase():t);return D=>T.has(m?D.toLowerCase():D)})(),d=p.length;if(s===1&&a===1&&i===1&&l===1&&!f){let T=0,D=d;if(r==="both"||r==="start")for(;T<d&&y(p[T]);)T++;if(r==="both"||r==="end")for(;D>T&&y(p[D-1]);)D--;let v=T===0&&D===d?p:p.substring(T,D);return o||v!==""?v:null}let b=new Uint8Array(d),S=(T,D,v)=>{if(d===0||v===0)return;let mt=T?0:d-1,lt=T?d:-1,I=T?1:-1,E=!1,P=0,q=0;for(let Y=mt;Y!==lt;Y+=I)if(y(p[Y])){if(!E){if(D!==null&&D>=0&&q>=D||v!==null&&v>=0&&P>=v)break;E=!0,P++}b[Y]=1}else if(E=!1,q++,D!==null&&D>=0&&q>=D)break},w=(T,D,v,mt,lt)=>{if(d===0||lt===0||D===0)return;let I=v?0:d-1,E=0,P=0,q=m?p.toLowerCase():p;for(;I>=0&&I<d&&!(lt!==null&&lt>=0&&E>=lt);){let Y=v?I:I-D+1;if(!v&&Y<0)break;let X=v?q.indexOf(T,Y):q.lastIndexOf(T,Y);if(X===-1)break;let st=v?X-I:I-(X+D-1);if(P+=st,mt!==null&&mt>=0&&P>=mt)break;for(let nt=0;nt<D;nt++)b[X+nt]=1;E++,I=v?X+D:X-1}};if(r==="both"||r==="start")if(f&&typeof t=="string"){let T=m?t.toLowerCase():t;w(T,t.length,!0,s,a)}else S(!0,s,a);if(r==="both"||r==="end")if(f&&typeof t=="string"){let T=m?t.toLowerCase():t;w(T,t.length,!1,i,l)}else S(!1,i,l);let C="";for(let T=0;T<d;T++)b[T]===0&&(C+=p[T]);return o||C!==""?C:null}function W(n,{depth:t=0,maxDepth:e=50}={}){if(t>e)return"v:circular";if(n===null)return"v:null";if(n===void 0)return"v:undefined";if(M(n))return`d:${n.getTime()}`;if(L(n))return`u:${n.constructor.name}:${n.toString()}`;if(Array.isArray(n)){let r=n.length,o=new Array(r),s={depth:t+1,maxDepth:e};for(let i=0;i<r;i++)o[i]=W(n[i],s);return`a:[${o.join(",")}]`}if(Ce(n)){let r=Array.from(n),o=r.length,s=new Array(o),i={depth:t+1,maxDepth:e};for(let a=0;a<o;a++)s[a]=W(r[a],i);return s.sort(),`set:[${s.join(",")}]`}if(De(n)){let r=Array.from(n.keys()),o=r.length,s=new Array(o),i={depth:t+1,maxDepth:e};for(let a=0;a<o;a++){let l=r[a];s[a]=`${W(l,i)}:${W(n.get(l),i)}`}return s.sort(),`map:{${s.join(",")}}`}if(typeof n=="object"&&typeof n.toJSON=="function"){let r=n.toJSON();if(r!==n)return`j:${W(r,{depth:t+1,maxDepth:e})}`}if(It(n)){let r=Object.keys(n).sort(),o=r.length,s=new Array(o),i={depth:t+1,maxDepth:e};for(let a=0;a<o;a++){let l=r[a];s[a]=`${l}:${W(n[l],i)}`}return`o:{${s.join(",")}}`}return bt(n)?`r:${n.toString()}`:typeof n=="function"?`f:${n.toString()}`:typeof n=="string"?`s:${n}`:typeof n=="symbol"?`y:${n.toString()}`:`${typeof n}:${n}`}function xs(n){if(n==null)return[];let t=String(n);if(!t)return[];let r=t.normalize("NFC").replace(ds,"$1$2").match(gs)||[],o=[];for(let s=0;s<r.length;s++){let i=r[s];bs.has(i)||o.push(i)}return o}function ee(n,t){let e=xs(n),r=e.length;if(r===0)return"";let{format:o}=t;if(o==="camel"||o==="pascal"){let s="";for(let i=0;i<r;i++){let a=e[i];s+=i===0&&o==="camel"?a.toLowerCase():a.charAt(0).toUpperCase()+a.slice(1).toLowerCase()}return s}if(o==="kebab"||o==="snake"){let s=o==="kebab"?"-":"_",i=new Array(r);for(let a=0;a<r;a++)i[a]=e[a].toLowerCase();return i.join(s)}return String(n)}var ys,ds,gs,bs,Re=R(()=>{"use strict";xt();te();ys=/[-\/\\^$*+?.()|\[\]{}]/g;ds=/(\p{L})['’](\p{L})/gu,gs=new RegExp(["\\p{Lu}+s(?!\\p{Ll})","\\p{Lu}+(?=\\p{Lu}\\p{Ll})","\\p{Lu}+\\p{Ll}*","\\p{Ll}+","\\p{N}+","\\p{L}+"].join("|"),"gu"),bs=new Set(["__proto__","proto","constructor","prototype"])});var Rn,Un,oo=R(()=>{"use strict";Rn=1000n,Un=1000000n});function Cs(n){let t=so.get(n);return t||(t=new Intl.DateTimeFormat("en-US",{timeZone:n,hourCycle:"h23",weekday:"short",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3}),so.set(n,t)),t}function Ds(n,t){let e=`${n}_${t}`,r=io.get(e);return r||(r=new Intl.DateTimeFormat(n,{timeZoneName:"short",timeZone:t}),io.set(e,r)),r}function As(n){let t=ao.get(n);if(t===void 0){try{Intl.DateTimeFormat(void 0,{timeZone:n}),t=!0}catch{t=!1}ao.set(n,t)}return t}function ht(n){let t=!n||n==="local"?Intl.DateTimeFormat().resolvedOptions().timeZone:n;return As(t)?t:"UTC"}function tt(n,t=0,e=1,r=0,o=0,s=0,i=0){let a=new Date(0);return a.setUTCFullYear(n,t,e),a.setUTCHours(r,o,s,i),a}function Os(n,t,e){let r=[0,3,2,5,0,3,5,1,4,6,2,4],o=n;return t<3&&(o-=1),(o+Math.floor(o/4)-Math.floor(o/100)+Math.floor(o/400)+r[t-1]+e)%7}function ne(n,t){let e=ht(t);if(e.toUpperCase()==="UTC")return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),ms:n.getUTCMilliseconds(),dayOfWeek:n.getUTCDay()};let o=Cs(e).formatToParts(n),s="0",i="0",a="0",l="0",c="0",u="0",f="0";for(let b=0,S=o.length;b<S;b++){let w=o[b];switch(w.type){case"year":s=w.value;break;case"month":i=w.value;break;case"day":a=w.value;break;case"hour":l=w.value;break;case"minute":c=w.value;break;case"second":u=w.value;break;case"fractionalSecond":f=w.value;break}}let m=parseInt(s,10),h=parseInt(i,10),p=parseInt(a,10),y=parseInt(l,10);y===24&&(y=0);let d=Math.round(parseFloat("0."+f)*1e3)||0,g=Os(m,h,p);return{year:m,month:h,day:p,hour:y,minute:parseInt(c,10),second:parseInt(u,10),ms:d,dayOfWeek:g}}function Bt(n,t,e){if(t.toUpperCase()==="UTC")return 0;let r=ne(n,"UTC"),o=e||ne(n,t),s=tt(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.ms).getTime(),i=tt(o.year,o.month-1,o.day,o.hour,o.minute,o.second,o.ms).getTime();return Math.round((i-s)/6e4)}function lo(n,t){let e=n>=0?"+":"-",r=Math.abs(n),o=String(Math.floor(r/60)).padStart(2,"0"),s=String(r%60).padStart(2,"0");return t==="iso"?`${e}${o}:${s}`:`${e}${o}${s}`}function G(n,t){let e=it(n);if(e==null)return null;let r=null;if(M(e))r=e;else if(typeof e=="number"||typeof e=="bigint")r=new Date(ks(e));else if(typeof e=="string"){if(ro(e))return null;r=new Date(e)}if(!r||!M(r))return null;if(t?.dateOnly){let o=typeof e=="string",s=o&&Ts.test(e),i=o&&!s&&!co.test(e)?"local":"UTC",a=ne(r,i);return tt(a.year,a.month-1,a.day)}return r}function Me(n){let t=it(n);if(t==null)return null;let e=null;if(typeof t=="string"){let o=t.trim();if(Ss.test(o)){let s=co.test(o);e=G(`1970-01-01T${o}${s?"":"Z"}`)}}let r=e||G(t);return r?Rt(r,{format:"%H:%M:%S.%ms"}):null}function fo(n,t="ms"){let e=n.getTime();switch(t){case"s":return Math.floor(e/1e3);case"ms":return e;case"us":return BigInt(e)*Rn;case"ns":return BigInt(e)*Un}}function ks(n){if(typeof n=="bigint"){let e=n<0n?-n:n;return e<=30000000000n?Number(n)*1e3:e<=30000000000000n?Number(n):e<=30000000000000000n?Number(n/Rn):Number(n/Un)}let t=Math.abs(n);return t<=3e10?n*1e3:t<=3e13?n:t<=3e16?Math.floor(n/1e3):Math.floor(n/1e6)}function mo(n){if(!M(n))return null;let t=n.getUTCFullYear();return Math.floor((t-1)/100)+1}function jn(n,t={field:"week"}){if(!M(n))return null;let e=tt(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),r=e.getUTCDay()||7;if(e.setUTCDate(e.getUTCDate()+4-r),t.field==="year")return e.getUTCFullYear();let o=tt(e.getUTCFullYear(),0,1),s=Math.round((e.getTime()-o.getTime())/864e5);return Math.floor(s/7)+1}function po(n){if(!M(n))return null;let t=n.getUTCFullYear();return Math.floor((t-1)/1e3)+1}function Ne(n,t,e=1){return M(n)?tt(n.getUTCFullYear(),n.getUTCMonth()+t,e):null}function _n(n){if(!M(n))return null;let t=tt(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()).getTime(),e=tt(n.getUTCFullYear(),0,1).getTime();return Math.floor((t-e)/864e5)+1}function ho(n){return M(n)?Math.floor(n.getUTCMonth()/3)+1:null}function vn(n){let t;if(M(n))t=n.getUTCFullYear();else if(z(n))t=n;else return!1;return t%4===0&&t%100!==0||t%400===0}function yo(n){return n.replace(/%[FTRD]/g,t=>Es[t]||t)}function Fn(n,t){return new Date(n.getTime()-t*60*1e3)}function Rs(n){let t=n.replace(":",""),e=t[0]==="+"?1:-1,r=parseInt(t.slice(1,3),10)||0,o=parseInt(t.slice(3,5),10)||0;return e*(r*60+o)}function Rt(n,{format:t,locale:e,timeZone:r="UTC"}){if(!M(n)||typeof t!="string")return"";let o=e&&e.trim()||Intl.DateTimeFormat().resolvedOptions().locale||"en-US",s=yo(t),i=null,a=()=>i??=ne(n,r);return s.replace(Fe,(l,c)=>{if(c==="%")return"%";let u=Ln[c];return u?u.format(n,o,r,a()):l})}function go(n,{format:t,strict:e=!0,defaultTimeZone:r="UTC"}){if(typeof n!="string"||typeof t!="string")return null;let o=yo(t),s=[],i="",a=0;Fe.lastIndex=0;let l;for(;(l=Fe.exec(o))!==null;){let y=o.slice(a,l.index);i+=Ue(y);let d=l[1];if(d==="%")i+="\\%";else{let g=Ln[d];g&&g.parseRegex?(s.push(g),i+=`(${g.parseRegex})`):i+=Ue(l[0])}a=Fe.lastIndex}i+=Ue(o.slice(a));let c=new RegExp("^\\s*"+i+"\\s*$"),u=n.match(c);if(!u)return e?null:G(n);let f={year:1970,month:1,day:1,hour:0,minute:0,second:0,ms:0,offset:null},m=null,h=!1;for(let y=0;y<s.length;y++){let d=u[y+1],g=s[y],b=g.parseNormalize?g.parseNormalize(d):parseInt(d,10);g.key==="j"&&(h=!0),g.parseField==="ampm"?m=b:g.parseField==="offset"?f.offset=b:g.parseField&&(f[g.parseField]=b)}if(m&&(m==="PM"&&f.hour<12&&(f.hour+=12),m==="AM"&&f.hour===12&&(f.hour=0)),h){let y=vn(f.year)?366:365;if(f.day<1||f.day>y)return null;let d=tt(f.year,0,1);d.setUTCDate(f.day),f.month=d.getUTCMonth()+1,f.day=d.getUTCDate()}let p=tt(f.year,f.month-1,f.day,f.hour,f.minute,f.second,f.ms);if(!M(p)||p.getUTCFullYear()!==f.year||p.getUTCMonth()+1!==f.month||p.getUTCDate()!==f.day||p.getUTCHours()!==f.hour||p.getUTCMinutes()!==f.minute||p.getUTCSeconds()!==f.second||p.getUTCMilliseconds()!==f.ms)return null;if(f.offset)p=Fn(p,Rs(f.offset));else if(r.toUpperCase()!=="UTC"){let y=ht(r),d=Bt(p,y);p=Fn(p,d);let g=Bt(p,y);g!==d&&(p=Fn(p,g-d))}return M(p)?p:null}function Vn(n,t,{excludeWeekdays:e=[],holidays:r=[],roll:o}={}){if(!Wr(t))throw new at(`The offset parameter 'n' must be a whole integer. Received: ${t}`);if(7-e.length<=0)throw new at("All weekdays are excluded; cannot offset.");let i=new Set;if(r instanceof Set)for(let m of r){let h=new Date(m);e.includes(h.getUTCDay())||i.add(m)}else if(Array.isArray(r))for(let m=0;m<r.length;m++){let h=G(r[m]);if(!h||e.includes(h.getUTCDay()))continue;let p=tt(h.getUTCFullYear(),h.getUTCMonth(),h.getUTCDate());i.add(p.getTime())}let a=m=>e.includes(m.getUTCDay())?!0:i.has(m.getTime()),l=tt(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate());if(o&&a(l)){if(o==="raise")throw new at("Start date falls on an excluded day or holiday.");let m=o==="forward"?1:-1;for(;a(l);)l.setUTCDate(l.getUTCDate()+m)}if(t===0)return l;let c=t>0?1:-1,u=0,f=Math.abs(t);for(;u<f;)l.setUTCDate(l.getUTCDate()+c),a(l)||u++;return l}function Pn(n,t,e){let r=ht(t),o=e?.type??"total",s;if(o==="total")s=Bt(n,r);else{let a=ne(n,r),l=a.year,c=Bt(tt(l,0,1),r),u=Bt(tt(l,6,1),r),f=Math.min(c,u);o==="daylightSavingTime"?s=Bt(n,r,a)-f:s=f}switch(e?.format??"milliseconds"){case"minutes":return s;case"hours":return s/60;case"iso":return lo(s,"iso");case"basic":return lo(s,"basic");default:return s*6e4}}function bo(n,t={}){if(!M(n))return null;let e=t.excludeWeekdays??[0,6],r=n.getUTCDay();if(e.includes(r))return!1;let o=t.holidays;if(o){if(o instanceof Set){let s=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate());if(o.has(s))return!1}else if(Array.isArray(o)&&o.length>0){let s=new Set;for(let a=0;a<o.length;a++){let l=G(o[a]);l&&s.add(Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()))}let i=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate());if(s.has(i))return!1}}return!0}var Ss,co,Ts,so,io,ao,Ln,Is,Fe,Es,Bn=R(()=>{"use strict";Re();rt();xt();Xt();oo();Ss=/^\d{2}:\d{2}/,co=/(?:Z|[+-]\d{2}(?::?\d{2})?)$/i,Ts=/^\d{4}-\d{2}-\d{2}$/,so=new Map;io=new Map;ao=new Map;Ln={Y:{key:"Y",format:(n,t,e,r)=>{let o=r.year;return o>=0?String(o).padStart(4,"0"):"-"+String(Math.abs(o)).padStart(4,"0")},parseRegex:"[+-]?\\d{4,}",parseField:"year"},y:{key:"y",format:(n,t,e,r)=>String(Math.abs(r.year)%100).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"year",parseNormalize:n=>{let t=parseInt(n,10);return t+(t>=69?1900:2e3)}},m:{key:"m",format:(n,t,e,r)=>String(r.month).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"month"},d:{key:"d",format:(n,t,e,r)=>String(r.day).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"day"},e:{key:"e",format:(n,t,e,r)=>String(r.day).padStart(2," "),parseRegex:"\\s?\\d{1,2}",parseField:"day"},H:{key:"H",format:(n,t,e,r)=>String(r.hour).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"hour"},I:{key:"I",format:(n,t,e,r)=>String(r.hour%12||12).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"hour"},p:{key:"p",format:(n,t,e,r)=>r.hour>=12?"PM":"AM",parseRegex:"AM|PM|am|pm",parseField:"ampm",parseNormalize:n=>n.toUpperCase()},M:{key:"M",format:(n,t,e,r)=>String(r.minute).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"minute"},S:{key:"S",format:(n,t,e,r)=>String(r.second).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"second"},A:{key:"A",format:(n,t,e)=>n.toLocaleDateString(t,{weekday:"long",timeZone:ht(e)})},a:{key:"a",format:(n,t,e)=>n.toLocaleDateString(t,{weekday:"short",timeZone:ht(e)})},B:{key:"B",format:(n,t,e)=>n.toLocaleDateString(t,{month:"long",timeZone:ht(e)})},b:{key:"b",format:(n,t,e)=>n.toLocaleDateString(t,{month:"short",timeZone:ht(e)})},h:{key:"h",format:(n,t,e)=>n.toLocaleDateString(t,{month:"short",timeZone:ht(e)})},j:{key:"j",format:(n,t,e,r)=>String(_n(tt(r.year,r.month-1,r.day))??1).padStart(3,"0"),parseRegex:"\\d{3}",parseField:"day",parseNormalize:n=>parseInt(n,10)},u:{key:"u",format:(n,t,e,r)=>String(r.dayOfWeek||7)},w:{key:"w",format:(n,t,e,r)=>String(r.dayOfWeek)},Z:{key:"Z",format:(n,t,e)=>{let r=ht(e);if(r.toUpperCase()==="UTC")return"UTC";let o=Ds(t,r).formatToParts(n);for(let s=0,i=o.length;s<i;s++)if(o[s].type==="timeZoneName")return o[s].value;return"UTC"}},z:{key:"z",format:(n,t,e)=>Pn(n,e,{format:"basic"}),parseRegex:"[+-]\\d{2}(?::?\\d{2})?",parseField:"offset",parseNormalize:n=>n.replace(":","")},ms:{key:"ms",format:(n,t,e,r)=>String(r.ms).padStart(3,"0"),parseRegex:"\\d{3}",parseField:"ms",parseNormalize:n=>parseInt(n,10)},f:{key:"f",format:(n,t,e,r)=>String(r.ms).padStart(3,"0").padEnd(6,"0"),parseRegex:"\\d{1,9}",parseField:"ms",parseNormalize:n=>parseInt(n.padEnd(6,"0").slice(0,3),10)}},Is=Object.keys(Ln).concat("%").sort((n,t)=>t.length-n.length),Fe=new RegExp("%("+Is.join("|")+")","g"),Es={"%F":"%Y-%m-%d","%T":"%H:%M:%S","%R":"%H:%M","%D":"%m/%d/%y"}});function xo(n,{format:t="json",allowPrimitives:e=!1,trimBeforeParse:r=!1,reviver:o,ndjson:{skipInvalidLines:s=!1,maxLines:i,skipLines:a}={},guard:l,onError:c,fallback:u=re}={}){if(typeof n!="string")return u!==re?u:n;let f=r?n.trim():n;if(f==="")return u!==re?u:n;let m;try{if(t==="ndjson"){let h=[],p=0,y=0,d=0;$n.lastIndex=0;let g;for(;;){g=$n.exec(f);let b=g?f.substring(d,g.index):f.substring(d);g&&(d=$n.lastIndex);let S=b.trim();if(S!==""&&(p++,a===void 0||p>a))if(!e&&!Us(S)){if(!s)throw new Error("NDJSON line is not wrapped and primitives are disallowed")}else try{if(h.push(JSON.parse(S,o)),y++,i!==void 0&&y>=i)break}catch(w){if(!s)throw w}if(!g)break}if(h.length===0)throw new Error("No valid NDJSON lines processed");m=h}else{if(!e&&!Fs(f))throw new Error("JSON string is not wrapped and primitives are disallowed");m=JSON.parse(f,o)}}catch(h){return c?.(h),u!==re?u:n}return l&&!l(m)?(c?.(new Error("Parsed value failed guard validation")),u!==re?u:n):m}function oe(n={}){let t=n.bigintStrategy??"string",e=n.handleCircular?new WeakSet:null,o=Array.isArray(n.replacer)?n.replacer.map(String):null,s=i=>t==="number"&&i<=BigInt(Number.H)&&i>=BigInt(Number.ct)?Number(i):i.toString();return function(a,l){let c=l;if(typeof n.replacer=="function")c=n.replacer.call(this,a,l);else if(o&&a!==""&&!Array.isArray(this)&&!o.includes(a))return;if(c===void 0)return;let u=c===l&&this!=null?this[a]:c;if(typeof n.onCustom=="function"){let f=n.onCustom.call(this,a,u);if(f!==u||f===void 0&&u!==void 0)return f}if(u!==null&&typeof u!="object"&&typeof u!="bigint")return c;if(e&&u!==null&&typeof u=="object"){if(a===""&&(e=new WeakSet),e.has(u))return n.onCircular?n.onCircular.call(this,a,u):"[Circular]";e.add(u)}return typeof u=="bigint"?n.voidBigIntReplacement?c:n.onBigInt?n.onBigInt(u):s(u):L(u)?n.voidTypedArrayReplacement?c:n.onTypedArray?n.onTypedArray(u):Array.from(u):Ce(u)?n.voidSetReplacement?c:n.onSet?n.onSet(u):Array.from(u):De(u)?n.voidMapReplacement?c:n.onMap?n.onMap(u):Array.from(u.entries()):bt(u)?n.voidRegExpReplacement?c:n.onRegExp?n.onRegExp(u):u.toString():M(u)?n.voidDateReplacement?c:n.onDate?n.onDate(u):n.formatDate?n.formatDate(u):u.toISOString():_r(u)?n.onError?n.onError(u):{name:u.name,message:u.message,stack:u.stack}:jr(u)?n.onURLSearchParams?n.onURLSearchParams(u):u.toString():c}}var $n,re,Us,Fs,je=R(()=>{"use strict";te();xt();$n=/\r\n|\n|\r/g,re=Symbol("no_fallback"),Us=n=>{let t=n.length;if(t<2)return!1;let e=n[0],r=n[t-1];return e==="{"&&r==="}"||e==="["&&r==="]"},Fs=n=>{let t=0,e=n.length;for(;t<e&&/\s/.test(n[t]);)t++;let r=e-1;for(;r>=t&&/\s/.test(n[r]);)r--;if(t>=r)return!1;let o=n[t],s=n[r];return o==="{"&&s==="}"||o==="["&&s==="]"}});var Z,Ut,se,St,Tt,$t,Ct,Kt,_e=R(()=>{"use strict";Z=class n{matches(t){if(t==null)return!1;if(t instanceof n)return!!(this.equals(t)||this.name.startsWith("Decimal")&&t.name.startsWith("Decimal")&&t.precision===void 0&&t.scale===void 0);if(typeof t=="function"){if(t.prototype instanceof n)return this instanceof t;try{let e=t();if(e instanceof n)return this.constructor===e.constructor}catch{}}return!1}get isNumeric(){return!1}get isInteger(){return!1}get isFloat(){return!1}get isSigned(){return!1}get isUnsigned(){return!1}get isTemporal(){return!1}get isNested(){return!1}get isBoolean(){return!1}get isString(){return!1}get isUtf8(){return!1}get isObject(){return!1}get isNull(){return!1}get isBinary(){return!1}},Ut=class extends Z{get isNumeric(){return!0}},se=class extends Ut{get isInteger(){return!0}},St=class extends se{get isSigned(){return!0}},Tt=class extends se{get isUnsigned(){return!0}},$t=class extends Ut{get isFloat(){return!0}},Ct=class extends Z{get isTemporal(){return!0}},Kt=class extends Z{get isNested(){return!0}}});var ve,Kn,Le,qn,Ve,Wn,Pe,ae,Be,Gn,$e,zn,Ke,Hn,qe,Jn,We,Yn,Ge,le,ie,ze,ue,He,qt,Je,Xn,Ye,Zn,Xe,Qn,Ze,tr,Qe,ce,tn,er,en,nr,nn,rr,rn,or,sr=R(()=>{"use strict";_e();$();ve=class extends St{name="Int8";coerce(t){return pt(t,{range:"Int8"})}equals(t){return t.name==="Int8"}allocate(t){return new Int8Array(t)}},Kn=new ve,Le=class extends St{name="Int16";coerce(t){return pt(t,{range:"Int16"})}equals(t){return t.name==="Int16"}allocate(t){return new Int16Array(t)}},qn=new Le,Ve=class extends St{name="Int32";coerce(t){return pt(t,{range:"Int32"})}equals(t){return t.name==="Int32"}allocate(t){return new Int32Array(t)}},Wn=new Ve,Pe=class extends St{name="Int64";coerce(t){return vt(t,{truncate:!0})}equals(t){return t.name==="Int64"}allocate(t){return new BigInt64Array(t)}},ae=new Pe,Be=class extends Tt{name="UInt8";coerce(t){return pt(t,{range:"UInt8"})}equals(t){return t.name==="UInt8"}allocate(t){return new Uint8Array(t)}},Gn=new Be,$e=class extends Tt{name="UInt16";coerce(t){return pt(t,{range:"UInt16"})}equals(t){return t.name==="UInt16"}allocate(t){return new Uint16Array(t)}},zn=new $e,Ke=class extends Tt{name="UInt32";coerce(t){return pt(t,{range:"UInt32"})}equals(t){return t.name==="UInt32"}allocate(t){return new Uint32Array(t)}},Hn=new Ke,qe=class extends Tt{name="UInt64";coerce(t){return vt(t,{range:"UInt64"})}equals(t){return t.name==="UInt64"}allocate(t){return new BigUint64Array(t)}},Jn=new qe,We=class extends $t{name="Float32";coerce(t){return kn(t,{floatPrecision:"Float32"})}equals(t){return t.name==="Float32"}allocate(t){return new Float32Array(t)}},Yn=new We,Ge=class extends $t{name="Float64";coerce(t){return kn(t,{floatPrecision:"Float64"})}equals(t){return t.name==="Float64"}allocate(t){return new Float64Array(t)}},le=new Ge,ie=class n extends Ut{constructor(e,r){super();this.precision=e;this.scale=r;this.name=e!==void 0&&r!==void 0?`Decimal(${e}, ${r})`:"Decimal"}precision;scale;name;coerce(e){return Oe(e,{precision:this.precision,scale:this.scale})}equals(e){return e instanceof n&&this.precision===e.precision&&this.scale===e.scale}allocate(e){return new Array(e).fill(null)}},ze=class extends Z{name="Boolean";get isBoolean(){return!0}coerce(t){return t==null?null:!!t}equals(t){return t.name==="Boolean"}allocate(t){return new Array(t).fill(null)}},ue=new ze,He=class extends Z{name="Utf8";get isString(){return!0}get isUtf8(){return!0}coerce(t){return t==null?null:String(t)}equals(t){return t.name==="Utf8"}allocate(t){return new Array(t).fill(null)}},qt=new He,Je=class extends Z{name="Binary";get isBinary(){return!0}coerce(t){return wo(t)}equals(t){return t.name==="Binary"}allocate(t){return new Array(t).fill(null)}},Xn=new Je,Ye=class extends Z{name="Null";get isNull(){return!0}coerce(t){return null}equals(t){return t.name==="Null"}allocate(t){return new Array(t).fill(null)}},Zn=new Ye,Xe=class extends Z{name="Object";get isObject(){return!0}coerce(t){return t===void 0?null:t}equals(t){return t.name==="Object"}allocate(t){return new Array(t).fill(null)}},Qn=new Xe,Ze=class extends Ct{name="Date";coerce(t){return G(t,{dateOnly:!0})}equals(t){return t.name==="Date"}allocate(t){return new Array(t).fill(null)}},tr=new Ze,Qe=class extends Ct{name="Datetime";coerce(t){return G(t)}equals(t){return t.name==="Datetime"}allocate(t){return new Array(t).fill(null)}},ce=new Qe,tn=class extends Ct{name="Time";coerce(t){return Me(t)}equals(t){return t.name==="Time"}allocate(t){return new Array(t).fill(null)}},er=new tn,en=class extends Ct{name="Duration";coerce(t){return K(t)}equals(t){return t.name==="Duration"}allocate(t){return new Array(t).fill(null)}},nr=new en,nn=class n extends Kt{constructor(e){super();this.innerType=e}innerType;name="Array";coerce(e){if(e==null)return null;let r=O(e)?Array.from(e):[e],o=r.length,s=new Array(o);for(let i=0;i<o;i++)s[i]=this.innerType.coerce(r[i]);return s}equals(e){return e instanceof n&&this.innerType.equals(e.innerType)}allocate(e){return new Array(e).fill(null)}},rr=n=>new nn(n),rn=class n extends Kt{constructor(e){super();this.fields=e}fields;name="Struct";coerce(e){if(!B(e))return null;let r={},o=Object.keys(this.fields),s=o.length;for(let i=0;i<s;i++){let a=o[i],l=this.fields[a];r[a]=l.coerce(e[a])}return r}equals(e){if(!(e instanceof n))return!1;let r=Object.keys(this.fields),o=Object.keys(e.fields);if(r.length!==o.length)return!1;for(let s=0;s<r.length;s++){let i=r[s];if(!this.fields[i].equals(e.fields[i]))return!1}return!0}allocate(e){return new Array(e).fill(null)}},or=n=>new rn(n)});var F,Dt=R(()=>{"use strict";_e();sr();sr();_e();F={Int8:Kn,Int16:qn,Int32:Wn,Int64:ae,UInt8:Gn,UInt16:zn,UInt32:Hn,UInt64:Jn,Float32:Yn,Float64:le,Decimal:(n,t)=>new ie(n,t),Boolean:ue,Utf8:qt,Binary:Xn,Date:tr,Datetime:ce,Time:er,Duration:nr,Object:Qn,Null:Zn,Array:rr,Struct:or}});function Ns(n={}){let t=n.nullValue!==void 0?n.nullValue:"",e=Kr(n.numericFormatOptions),r=n.replacerOptions||{},o=a=>n.datetimeFormat?Rt(a,{format:n.datetimeFormat}):n.dateFormat?Rt(a,{format:n.dateFormat}):n.timeFormat?Rt(a,{format:n.timeFormat}):a.toISOString(),s=oe({formatDate:o,...r}),i=typeof r.onBigInt=="function";return a=>{if(a==null||typeof a=="symbol"||typeof a=="function")return{str:t,isNumeric:!1};if(typeof a=="bigint"&&!i&&!r.voidBigIntReplacement)return{str:e(a),isNumeric:!0};let l=s.call(null,"",a),c=it(l);return c==null||typeof c=="symbol"||typeof c=="function"?{str:t,isNumeric:!1}:typeof c=="string"?{str:c,isNumeric:!1}:typeof c=="number"||typeof c=="bigint"?{str:e(c),isNumeric:!0}:typeof c=="boolean"?{str:c?"true":"false",isNumeric:!1}:typeof c=="object"?{str:JSON.stringify(c,oe({formatDate:o,...r})),isNumeric:!1}:{str:String(c),isNumeric:!1}}}function sn(n,t,e={}){let{separator:r=",",quoteChar:o='"',includeHeader:s=!0,lineTerminator:i=`
2
- `,quoteStyle:a="necessary",includeBom:l=!1,onRow:c,...u}=e,f=Object.keys(n),m=f.length,h=[],p=!0,y=Ns(u),d=(b,S=!1)=>{let w,C=!1;if(S)w=String(b);else{let D=y(b);w=D.str,C=D.isNumeric}if(a==="never")return w;if(a==="always"){let D=w.split(o).join(o+o);return o+D+o}if(a==="non_numeric"&&!C&&b!=null){let D=w.split(o).join(o+o);return o+D+o}if(w.includes(r)||w.includes(o)||w.includes(`
3
- `)||w.includes("\r")){let D=w.split(o).join(o+o);return o+D+o}return w},g=b=>{if(p){let S=l?"\uFEFF"+b:b;c?c(S):h.push(S),p=!1}else c?c(i+b):h.push(b)};if(s){let b=new Array(m);for(let S=0;S<m;S++)b[S]=d(f[S],!0);g(b.join(r))}for(let b=0;b<t;b++){let S=new Array(m);for(let w=0;w<m;w++)S[w]=d(n[f[w]][b],!1);g(S.join(r))}return c?l?"\uFEFF":"":h.join(i)}function So(n,t={}){let e=t.separator||",",r=t.quoteChar||'"',o=n;o.startsWith("\uFEFF")&&(o=o.substring("\uFEFF".length));let s=[],i=[],a="",l=!1,c=!1,u=!1,f=o.length;for(let m=0;m<f;m++){let h=o[m];if(l)c=!0,u=!1,h===r?m+1<f&&o[m+1]===r?(a+=r,m++):l=!1:a+=h;else if(h===r)c=!0,u=!1,l=!0;else if(h===e)i.push(a),a="",u=!0;else{let p=!1;h==="\r"?(p=!0,m+1<f&&o[m+1]===`
1
+ "use strict";var nr=Object.defineProperty;var Ks=Object.getOwnPropertyDescriptor;var qs=Object.getOwnPropertyNames;var zs=Object.prototype.hasOwnProperty;var R=(n,e)=>()=>(n&&(e=n(n=0)),e);var rr=(n,e)=>{for(var t in e)nr(n,t,{get:e[t],enumerable:!0})},Gs=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of qs(e))!zs.call(n,o)&&o!==t&&nr(n,o,{get:()=>e[o],enumerable:!(r=Ks(e,o))||r.enumerable});return n};var or=n=>Gs(nr({},"__esModule",{value:!0}),n);var oe,ir,sr,We,ar,lr,ur,Te=R(()=>{"use strict";oe="*",ir="*literal*",sr="*coalesce*",We="*element*",ar="*struct*",lr="*duration*",ur="*when*"});var To=R(()=>{"use strict"});function F(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function Pe(n){if(!F(n))return!1;try{if(!Object.prototype.hasOwnProperty.call(n,Symbol.toStringTag)&&Object.prototype.toString.call(n)!==oa)return!1;let e=Object.getPrototypeOf(n);if(e===null)return!0;if(Object.getPrototypeOf(e)!==null||!Object.prototype.hasOwnProperty.call(e,"isPrototypeOf"))return!1;let t=Object.getOwnPropertyDescriptor(e,"toString");if(!t||typeof t.value!="function")return!1;let r=Object.prototype.hasOwnProperty.call(e,"constructor")&&e.constructor;return typeof r!="function"?!1:Function.prototype.toString.call(r)===Ta}catch{return!1}}function vo(n){if(typeof n!="function")return!1;try{let e=Function.prototype.toString.call(n),t=e.replace(/^(?:\s+|\/\*[\s\S]*?\*\/|\/\/[^\r\n]*)+/,"");if(/^(?:@[\w$.]+(?:\([^)]*\))?\s+)*class\b/.test(t))return!0;let r=Object.getOwnPropertyDescriptor(n,"prototype");if(r&&!r.writable&&e.includes("[native code]")){let o=No.length;for(let i=0;i<o;i++)try{return Reflect.construct(n,No[i],Da),!0}catch{}}}catch{return!1}return!1}function De(n,e,t,r){if(!F(n))return!1;if(t)try{let o=t.call(n);return r!==void 0?o===r:!0}catch{return!1}try{return Object.prototype.hasOwnProperty.call(n,Symbol.toStringTag)?!1:Object.prototype.toString.call(n)===e}catch{return!1}}function P(n){if(!F(n))return!1;if(Ro)try{return!Number.isNaN(Ro.call(n))}catch{return!1}try{return Object.prototype.hasOwnProperty.call(n,Symbol.toStringTag)?!1:Object.prototype.toString.call(n)===Js&&!Number.isNaN(n.getTime())}catch{return!1}}function ge(n){return De(n,Ws,ma)}function Qt(n){return De(n,Xs,pa)}function en(n){return De(n,Hs,ha)}function Fo(n){if(!F(n))return!1;if(ko)try{return ko.call(n,"key"),!0}catch{return!1}return De(n,Zs,void 0)}function jo(n){if(!F(n))return!1;try{if(n instanceof Error)return!0;let e=n;for(;e!==null;){if(!Object.prototype.hasOwnProperty.call(e,Symbol.toStringTag)&&Object.prototype.toString.call(e)===Ys)return!0;e=Object.getPrototypeOf(e)}}catch{return!1}return!1}function fr(n){if(!F(n))return!1;try{let e=ArrayBuffer.isView(n)?n.buffer:n;return nn(e)||!tn(e)?!1:"detached"in e&&e.detached!==void 0?e.detached===!0:(ga?.call(e,0,0),!1)}catch{return!0}}function tn(n){return De(n,ta,da)}function nn(n){return De(n,na,ya)}function Bo(n){return De(n,ra,_a)}function mr(n){return De(n,Qs,Be,"Uint8Array")}function Po(n){return De(n,ea,Be,"Uint8ClampedArray")}function ie(n){if(!F(n))return n;let e=Mo.length;for(let t=0;t<e;t++){let r=Mo[t];if(r)try{return r.call(n)}catch{}}return n}var Js,Ws,Xs,Hs,Ys,Zs,Qs,ea,ta,na,ra,oa,ia,Do,Oo,Eo,sa,aa,la,ua,ca,fa,ma,pa,ha,cr,Io,Co,Be,da,ga,ya,_a,Ro,ko,xa,ba,wa,Aa,Sa,Ta,Uo,Da,Oa,No,Mo,ye=R(()=>{"use strict";Js="[object Date]",Ws="[object RegExp]",Xs="[object Set]",Hs="[object Map]",Ys="[object Error]",Zs="[object URLSearchParams]",Qs="[object Uint8Array]",ea="[object Uint8ClampedArray]",ta="[object ArrayBuffer]",na="[object SharedArrayBuffer]",ra="[object DataView]",oa="[object Object]",ia=typeof Date=="function"?Date.prototype:void 0,Do=typeof RegExp=="function"?RegExp.prototype:void 0,Oo=typeof Set=="function"?Set.prototype:void 0,Eo=typeof Map=="function"?Map.prototype:void 0,sa=typeof URLSearchParams=="function"?URLSearchParams.prototype:void 0,aa=typeof String=="function"?String.prototype:void 0,la=typeof Number=="function"?Number.prototype:void 0,ua=typeof Boolean=="function"?Boolean.prototype:void 0,ca=typeof BigInt=="function"?BigInt.prototype:void 0,fa=typeof Symbol=="function"?Symbol.prototype:void 0,ma=Do?Object.getOwnPropertyDescriptor(Do,"source")?.get:void 0,pa=Oo?Object.getOwnPropertyDescriptor(Oo,"size")?.get:void 0,ha=Eo?Object.getOwnPropertyDescriptor(Eo,"size")?.get:void 0,cr=typeof ArrayBuffer=="function"?ArrayBuffer.prototype:void 0,Io=typeof SharedArrayBuffer=="function"?SharedArrayBuffer.prototype:void 0,Co=typeof DataView=="function"?DataView.prototype:void 0,Be=typeof Uint8Array=="function"?Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get:void 0,da=cr?Object.getOwnPropertyDescriptor(cr,"byteLength")?.get:void 0,ga=cr?.slice,ya=Io?Object.getOwnPropertyDescriptor(Io,"byteLength")?.get:void 0,_a=Co?Object.getOwnPropertyDescriptor(Co,"byteLength")?.get:void 0,Ro=ia?.valueOf,ko=sa?.has,xa=aa?.valueOf,ba=la?.valueOf,wa=ua?.valueOf,Aa=ca?.valueOf,Sa=fa?.valueOf,Ta=Function.prototype.toString.call(Object);Uo=function(){},Da=new Proxy(Uo,{construct(){return this}}),Oa=typeof ArrayBuffer=="function"?new ArrayBuffer(0):void 0,No=[[],[Uo],[Oa],[{}]];Mo=[ba,xa,wa,Aa,Sa]});var Oe,Lo,Le,Dt,_e,lt,Vo,$o,Ko,pr,hr,dr,gr,ut,Ot,Et,Ea,qo,zo,Go,Jo,Wo,Xo,Ho,Yo,Zo,Qo,ei,ti,ni,ri,oi,ii,si,ai,li,ui,yr,ci,xe=R(()=>{"use strict";Oe=new TextEncoder,Lo=6048e5,Le=864e5,Dt=36e5,_e=6e4,lt=1e3,Vo=1,$o=.001,Ko=1e-6,pr=1e3,hr=1e6,dr=1000n,gr=1000000n,ut="\0",Ot="",Et=-1,Ea=4294967295,qo=-9223372036854775808n,zo=9223372036854775807n,Go=0n,Jo=18446744073709551615n,Wo=-2147483648,Xo=2147483647,Ho=0,Yo=Ea,Zo=-32768,Qo=32767,ei=0,ti=65535,ni=-128,ri=127,oi=0,ii=255,si=31,ai=127,li=55296,ui=57343,yr=Object.freeze({9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r"}),ci=Object.freeze({b:"\b",0:"\0",...Object.fromEntries(Object.entries(yr).map(([n,e])=>[e.slice(1),String.fromCharCode(Number(n))]))})});function v(n,e){return typeof n!="number"?!1:Number.isNaN(n)?e?.allowNaN??e?.allowNonFiniteNumbers??!1:Number.isFinite(n)?!0:e?.allowNonFiniteNumbers??!1}function fi(n){for(let e=1;e<n.length;e++)if(n[e].length!==3)return!1;return!0}function gi(n,e){if(Ia.test(n))return null;let t=n.trim();if(t==="")return null;t.startsWith("(")&&t.endsWith(")")&&(t="-"+t.slice(1,-1).trim());let r=t[t.length-1];(r==="-"||r==="+")&&t.length>1&&(t=r+t.slice(0,-1).trim()),e||(t=t.replace(Ca,""));let o=t.includes("."),i=t.includes(",");if(o&&i){let s=t.lastIndexOf("."),a=t.lastIndexOf(","),l=a>s,u=l?".":",",c=l?a:s,f=t.slice(0,c).split(u);return f.length>1&&!fi(f)||f[0].replace(mi,"").length>3?null:l?t.replace(pi,"").replace(rn,"."):t.replace(rn,"")}if(i||o){let s=i?",":".",a=t.split(s);if(a.length>2||s===","&&a.length===2&&a[1].length===3){let l=a[0].replace(mi,"").length;if(l===0){if(s===","||a.length>2)return null}else return l>3?null:fi(a)?t.replace(i?rn:pi,""):null}if(i)return t.replace(rn,".")}return t}function j(n,{allowNonFiniteNumbers:e=!1,strictNumericString:t=!1,floatScientific:r=!0}={}){if(n==null||typeof n=="symbol")return null;switch(n=ie(n),typeof n){case"number":return v(n,{allowNonFiniteNumbers:e})?n:null;case"boolean":return n?1:0;case"bigint":{let o=Number(n);return v(o,{allowNonFiniteNumbers:e})?o:null}case"object":{if(P(n)){let o=n.getTime();return v(o,{allowNonFiniteNumbers:e})?o:null}return null}case"string":{let o=gi(n,t);if(o===null)return null;if(e){let a=o.toLowerCase();if(a==="nan"||a==="-nan"||a==="+nan")return NaN;if(a==="infinity"||a==="+infinity")return 1/0;if(a==="-infinity")return-1/0}if(di.test(o)&&!r||!hi.test(o))return null;let s=Number(o);return v(s,{allowNonFiniteNumbers:e})?s:null}default:return null}}function yi({locale:n="en-US",accountingNegatives:e=!1,fallback:t="NaN",formatNonFinite:r=!1,...o}={}){o.useGrouping===void 0&&(o.useGrouping=!1),o.maximumFractionDigits===void 0&&o.maximumSignificantDigits===void 0&&(o.maximumFractionDigits=20),e&&(o.currencySign="accounting",o.style===void 0&&(o.style="decimal"));let i=new Intl.NumberFormat(n,o);return s=>{if(typeof s=="bigint")return e&&s<0n?`(${i.format(-s)})`:i.format(s);let a=j(s,{allowNonFiniteNumbers:!0});return a===null||Number.isNaN(a)?t:Number.isFinite(a)?e&&a<0?`(${i.format(Math.abs(a))})`:i.format(a):r?t:e&&a===-1/0?`(${i.format(1/0)})`:String(a)}}function _r(n,{floatPrecision:e="Float64",allowNonFiniteNumbers:t=!0,floatScientific:r=!0,strictNumericString:o=!1}={}){let i=j(n,{allowNonFiniteNumbers:t,floatScientific:r,strictNumericString:o});return i===null||(e==="Float32"&&(i=Math.fround(i)),!v(i,{allowNonFiniteNumbers:t}))?null:i}function Ee(n,{range:e="Int32"}={}){if(!v(n)||!Number.isInteger(n))return!1;let t=typeof e=="string"?_i[e]:e;return n>=t.min&&n<=t.max}function se(n,{range:e="Int32",coerce:t="truncate"}={}){let r=j(n);if(r===null)return null;switch(t){case"round":r=Math.round(r);break;case"floor":r=Math.floor(r);break;case"ceil":r=Math.ceil(r);break;case"truncate":r=Math.trunc(r);break}let o=typeof e=="string"?_i[e]:e;return Ce(r,{min:o.min,max:o.max})}function on(n,{range:e="Int64"}={}){let t=ie(n);if(typeof t!="bigint")return!1;let r=typeof e=="string"?xi[e]:e;return t>=r.min&&t<=r.max}function Ie(n,{range:e="Int64",truncate:t=!1}={}){if(n==null||typeof n=="symbol")return null;try{n=ie(n)}catch{return null}let r=null;if(typeof n=="bigint")r=n;else if(typeof n=="string"){let i=gi(n,!1);if(i===null||!hi.test(i))return null;if(di.test(i)){let s=i.search(/[eE]/),a=i.slice(0,s),l=i.slice(s+1),u=parseInt(l,10);if(Number.isNaN(u)||u>1e5||u<-1e5)return null;let c=a.startsWith("-");(c||a.startsWith("+"))&&(a=a.slice(1));let f=a.indexOf("."),m=a,h=0;f!==-1&&(h=a.length-f-1,m=a.slice(0,f)+a.slice(f+1)),m=m.replace(/^0+/,"")||"0";try{let p=BigInt(m);c&&(p=-p);let d=u-h;if(d>=0)r=p*10n**BigInt(d);else{let g=10n**BigInt(-d),y=p%g;if(!t&&y!==0n)return null;r=p/g}}catch{return null}}else{let s=i.indexOf(".");if(s!==-1){if(!t&&/[^0]/.test(i.slice(s+1)))return null;i=i.slice(0,s)}try{r=BigInt(i)}catch{return null}}}else{let i=j(n);if(i===null||!t&&!Number.isInteger(i))return null;r=BigInt(Math.trunc(i))}let o=typeof e=="string"?xi[e]:e;return r<o.min||r>o.max?null:r}function Ra(n,e){let t=n-e;if(t<0||e<0)return null;if(t>15)return Number.MAX_SAFE_INTEGER;let r=Math.min(e,16),o=Math.pow(10,t)-Math.pow(10,-r);return o>0?o:null}function xr(n,e){let t=n.toString();if(t.includes("e")){let r=Math.pow(10,e);return Math.round(n*r)/r}return+(Math.round(+(t+"e"+e))+"e"+-e)}function sn(n,{precision:e,scale:t}={}){let r=j(n);if(r===null)return null;let o=r;if(t!==void 0&&(o=xr(o,t)),e!==void 0){let s=Ra(e,t??0);s!==null&&(o=Ce(o,{min:-s,max:s}))}return o}function Ce(n,e){if(!e)return n;let{min:t=null,max:r=null,safe:o=!0}=e;if(t!==null&&r!==null&&t>r)return t;let i=n;if(o&&typeof i=="number"){if(Number.isNaN(i))return t!==null?t:r!==null?r:n;if(i===1/0)return r!==null?r:n;if(i===-1/0)return t!==null?t:n}return t!==null&&i<t?t:r!==null&&i>r?r:i}function bi(n){let e=n|0;return function(){let t=e=e+1831565813|0;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}var hi,Ia,Ca,di,mi,pi,rn,_i,xi,Ve=R(()=>{"use strict";ye();xe();hi=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,Ia=/0[xobXOB]/,Ca=/[\s_]/g,di=/[eE]/;mi=/^[+-]/,pi=/\./g,rn=/,/g;_i={Int8:{min:ni,max:ri},Int16:{min:Zo,max:Qo},Int32:{min:Wo,max:Xo},UInt8:{min:oi,max:ii},UInt16:{min:ei,max:ti},UInt32:{min:Ho,max:Yo}};xi={Int64:{min:qo,max:zo},UInt64:{min:Go,max:Jo}}});function K(n){if(!ArrayBuffer.isView(n))return!1;if(Be)return Be.call(n)!==void 0;let e=Object.prototype.toString.call(n);return e!=="[object DataView]"&&e.endsWith("Array]")}function k(n){return Array.isArray(n)||K(n)}function be(n){return n==null?[]:Array.isArray(n)?[...n]:K(n)?Array.from(n):[n]}function an(n,e,t){let r=n.length,o=e<-r||e>=r;if(o&&!t)throw new ne(`Index ${e} is out of bounds for array of length ${r}`);return o?null:n.at(e)??null}function Si(n){if(typeof n=="function"){let e=vo(n);return{check:e?t=>t instanceof n:t=>!!n(t),coerce:t=>{if(e)return t instanceof n?t:null;let r=n(t);return typeof r=="boolean"?r?t:null:r}}}switch(n){case"string":return{check:e=>typeof e=="string",coerce:e=>String(e)};case"number":return{check:v,coerce:e=>j(e)??NaN};case"boolean":return{check:e=>typeof e=="boolean",coerce:Boolean};case"bigint":return{check:on,coerce:e=>Ie(e)};case"date":return{check:P,coerce:e=>J(e)};case"object":return{check:F,coerce:e=>F(e)?e:null};case"plainObject":return{check:Pe,coerce:e=>Pe(e)?e:null};case"null":return{check:e=>e===null,coerce:()=>null};case"undefined":return{check:e=>e===void 0,coerce:()=>{}};case"nullish":return{check:e=>e==null,coerce:()=>null};default:return{check:()=>!0,coerce:e=>e}}}function ee(n,e,{mode:t="every",allowNulls:r=!1,allowEmpty:o=!0}={}){if(!k(n))return!1;let i=n,s=i.length;if(s===0)return o?t==="every":!1;let{check:a}=Si(e);if(t==="every"){for(let l=0;l<s;l++){let u=i[l];if(!(r&&u==null)&&!a(u))return!1}return!0}for(let l=0;l<s;l++){let u=i[l];if(r&&u==null||a(u))return!0}return!1}function $e(n,e="any",{mode:t="every",allowNulls:r=!1,allowEmpty:o=!0}={}){let i=be(n),s=i.length;if(s===0){if(!o)throw new ne("Expected non-empty array");return[]}let{check:a,coerce:l}=Si(e),u=new Array(s),c=0;for(let f=0;f<s;f++){let m=i[f];if(r&&m==null){u[c++]=m;continue}let h=l(m);if(a(h))u[c++]=h;else if(t==="every")throw new ne(`Failed to convert array item at index ${f} ('${m}') to target type '${e}'`)}if(t==="some"){if(c===0)throw new ne(`No items in array could be converted to target type '${e}'`);c<s&&(u.length=c)}return u}function It(n,{descending:e=!1,nullsLast:t=!0}={}){if(!k(n))return[];let r=n,o=r.length;if(o===0)return[];if(K(n)){let f=r.slice().sort();return e&&f.reverse(),Array.from(f)}let i=[],s=[],a=!0,l=!0,u=!0;for(let f=0;f<o;f++){let m=r[f];if(m==null)s.push(m);else if(i.push(m),u){let h=typeof m;h!=="number"&&(a=!1),h!=="string"&&(l=!1),!a&&!l&&(u=!1)}}return i.length>1&&(a?i.sort(e?(f,m)=>m-f:(f,m)=>f-m):l?i.sort(e?(f,m)=>m.localeCompare(f):(f,m)=>f.localeCompare(m)):i.sort((f,m)=>{let h=typeof f,p=typeof m;if(h!==p){let d=h<p?-1:1;return e?-d:d}return f<m?e?1:-1:f>m?e?-1:1:0})),s.length===0?i:t?i.concat(s):s.concat(i)}function B(n){if(!k(n))return wi;let e=n.length;if(e===0)return wi;let t=null,r=null,o=null,i=null,s=0,a=0,l=0,u=0,c=0,f=1,m=0,h=0;for(let g=0;g<e;g++){let y=n[g];if(y==null){a++;continue}if(typeof y=="number"&&Number.isNaN(y)){l++,a++;continue}(t==null||y<t)&&(t=y,o=g),(r==null||y>r)&&(r=y,i=g);let _=j(y);if(_!==null){let S=u+_;Math.abs(u)>=Math.abs(_)?c+=u-S+_:c+=_-S+u,u=S,f*=_,s++;let b=_-m;m+=b/s;let x=_-m;h+=b*x}}let p=s>1?h/(s-1):0,d=l>0;return{sum:s>0?u+c:null,product:s>0?f:null,count:s,min:t,max:r,nanMin:d?NaN:t,nanMax:d?NaN:r,minIdx:o,maxIdx:i,mean:s>0?(u+c)/s:null,variance:p,std:Math.sqrt(p),nullCount:a,nanCount:l,len:e,hasNulls:a>0,isNumeric:s>0&&s===e-a}}function Ke(n,{strict:e=!1,keySelector:t}={}){let r=Array.from(n),o=new Map;if(e){let s=t??G,a=new Map,l=r.length;for(let c=0;c<l;c++){let f=r[c],m=s(f),h=a.get(m);h===void 0?a.set(m,{val:f,count:1}):h.count++}let u=[];for(let c of a.values())u.push(c.val);for(let c=0;c<l;c++){let f=r[c],m=s(f),h=a.get(m);o.set(f,h.count)}return{values:u,count:u.length,frequencies:o}}let i=r.length;for(let s=0;s<i;s++){let a=r[s];o.set(a,(o.get(a)??0)+1)}return{values:Array.from(o.keys()),count:o.size,frequencies:o}}function ln(n,{step:e=1,offsetStart:t=0,offsetEnd:r,maxItemsGathered:o,null_on_oob:i=!0}={}){if(n==null)return null;if(o!==void 0&&o<=0)return[];if(e===0)throw new M("Step size step cannot be zero");let s=n.length;if(s===0?t!==0:t>=s||t<-s){if(!i)throw new ne(`Start offset ${t} is out of bounds for array of length ${s}`);return null}let l=t<0?s+t:t,u=r!==void 0?r<0?s+r:r:e>0?s:-1,c=[];if(e>0)for(let f=l;f<u&&f<s&&!(f>=0&&(c.push(n[f]),o!==void 0&&c.length>=o));f+=e);else for(let f=l;f>u&&f>=0&&!(f<s&&(c.push(n[f]),o!==void 0&&c.length>=o));f+=e);return c}function un(n,e=",",{ignoreNulls:t=!1,nullValue:r="",prefix:o="",suffix:i="",limit:s,truncationMarker:a="...",valueFormatter:l}={}){let u=n.length,c=[],f=s!==void 0?Math.max(0,s):u,m=!1;for(let h=0;h<u;h++){if(c.length>=f){m=!0;break}let p=n[h];p!=null?c.push(l?l(p,h):String(p)):t||c.push(r)}return o+c.join(e)+(m?a:"")+i}function Xe(n,e,t={}){let r=n.length,{mode:o="cumulative",step:i=1,coerce:s=d=>d,condition:a,reverse:l=!1,startIndex:u=l?r-1:0,endIndex:c=l?-1:r}=t,f=l?-1:1,m=u,h=c,p=(d,g)=>{(!a||a(n[d],d,n))&&(n[d]=s(g))};if(o==="constant"){let d=s(e);for(let g=m;l?g>h:g<h;g+=f)p(g,d)}else if(o==="independent")if(typeof i=="function"){let d=0;for(let g=m;l?g>h:g<h;g+=f)p(g,i({index:d,initialValue:e,originalValue:n[g],absoluteIndex:g,targetArray:n})),d++}else for(let d=m;l?d>h:d<h;d+=f)p(d,e+d*i);else{let d=e,g=!0,y=0;for(let _=m;l?_>h:_<h;_+=f)g?(p(_,d),g=!1):(typeof i=="function"?d=i({prev:d,index:y,originalValue:n[_],absoluteIndex:_,targetArray:n}):d=d+i,p(_,d)),y++}}function Ti(n){let e=n.length,t=0,r=new Float64Array(e);for(let i=0;i<e;i++){let s=n[i],a=j(s,{allowNonFiniteNumbers:!0});a!==null&&v(a,{allowNonFiniteNumbers:!0,allowNaN:!1})&&(r[t++]=a)}if(t===0)return null;let o=r.subarray(0,t);return o.sort(),o}function ct(n){let e=Ti(n);if(!e)return null;let t=e.length,r=Math.floor(t/2);return t%2!==0?e[r]:(e[r-1]+e[r])/2}function cn(n,e){if(e<0||e>1)return null;let t=Ti(n);if(!t)return null;let r=t.length,o=e*(r-1),i=Math.floor(o),s=Math.ceil(o);return i===s?t[i]:t[i]+(o-i)*(t[s]-t[i])}function fn(n){if(!k(n)||n.length===0)return null;let e=new Map,t=n.length,r=0,o=[];for(let i=0;i<t;i++){let s=n[i];if(s==null||typeof s=="number"&&!v(s,{allowNonFiniteNumbers:!0,allowNaN:!1}))continue;let a=(e.get(s)??0)+1;e.set(s,a),a>r?(r=a,o=[s]):a===r&&o.push(s)}return o.length===0?null:It(o)}function Di(n,e){let t=n.length;if(t===0)return[];let r=Math.trunc(e);if(isNaN(r)||r===0)return Array.isArray(n)?n.slice():Array.from(n);let o=Math.abs(r);if(o>=t)return new Array(t).fill(null);let i=new Array(t);if(r>0){i.fill(null,0,r);for(let s=r;s<t;s++){let a=n[s-r];i[s]=a??null}}else{let s=t-o;for(let a=0;a<s;a++){let l=n[a+o];i[a]=l??null}i.fill(null,s,t)}return i}function br(n){let e=n.length,t=0,r=0,o=0,i=0,s=0,a=0;for(let m=0;m<e;m++){let h=n[m];if(!h)continue;let p=j(h[0]),d=j(h[1]);if(p===null||d===null)continue;t++;let g=p-r;r+=g/t;let y=p-r,_=d-o;o+=_/t;let S=d-o;a+=g*S,i+=g*y,s+=_*S}if(t<2)return{covariance:null,correlation:null};let l=a/(t-1);if(i===0||s===0)return{covariance:l,correlation:null};let u=Math.sqrt(i*s);if(u===0||Number.isNaN(u))return{covariance:l,correlation:null};let c=a/u,f=Math.max(-1,Math.min(1,c));return{covariance:l,correlation:f}}function Ai(n){let e=n.length,t=new Int32Array(e);for(let i=0;i<e;i++)t[i]=i;t.sort((i,s)=>n[i]-n[s]);let r=new Float64Array(e),o=0;for(;o<e;){let i=o+1;for(;i<e&&n[t[i]]===n[t[o]];)i++;let s=(o+1+i)/2;for(let a=o;a<i;a++)r[t[a]]=s;o=i}return r}function ka(n,e,t){if(t<2)return null;let r=0,o=0,i=0,s=0,a=0;for(let c=0;c<t;c++){let f=n[c],m=e[c],h=f-r;r+=h/(c+1);let p=f-r,d=m-o;o+=d/(c+1);let g=m-o;a+=h*g,i+=h*p,s+=d*g}if(i===0||s===0)return null;let l=Math.sqrt(i*s);if(l===0||Number.isNaN(l))return null;let u=a/l;return Math.max(-1,Math.min(1,u))}function Oi(n){let e=n.length,t=new Float64Array(e),r=new Float64Array(e),o=0;for(let a=0;a<e;a++){let l=n[a];if(l){let u=j(l[0]),c=j(l[1]);u!==null&&c!==null&&(t[o]=u,r[o]=c,o++)}}if(o<2)return null;let i=Ai(t.subarray(0,o)),s=Ai(r.subarray(0,o));return ka(i,s,o)}function Ei(n){let e=n.length,t=0,r=0;for(let o=0;o<e;o++){let i=n[o];if(!i)continue;let s=j(i[0]),a=j(i[1]);s===null||a===null||(t+=s*a,r++)}return r>0?t:null}function Ii(n){let e=n.length,t=0,r=0,o=0;for(let i=0;i<e;i++){let s=n[i];if(!s)continue;let a=j(s[0]),l=j(s[1]);a===null||l===null||(t+=a*l,r+=l,o++)}return o===0||Math.abs(r)<1e-12?null:t/r}function Ci(n,e){let t=Math.max(0,Math.floor(n||0)),r=Math.max(0,Math.floor(e||0)),o=t*r;if(!Ee(o,{range:"UInt32"}))throw new M(`Cartesian product size (${o} rows) exceeds maximum JavaScript array capacity.`);let i=new Array(o),s=new Array(o),a=0;for(let l=0;l<t;l++)for(let u=0;u<r;u++)i[a]=l,s[a]=u,a++;return{leftIndices:i,rightIndices:s}}function mn(n,e,t={}){let r=t.side==="right",o=t.getValue,i=0,s=n.length;for(;i<s;){let a=i+s>>>1,l=o?o(a,n[a]):n[a];(r?l<=e:l<e)?i=a+1:s=a}return i}function Ri(n){if(!k(n))return null;let{mean:e,count:t}=B(n);if(t<2||e===null)return null;let r=0,o=0,i=0,s=n.length;for(let a=0;a<s;a++){let l=j(n[a]);if(l===null)continue;let u=l-e,c=u*u;r+=c,o+=c*u,i+=c*c}return r<=0?null:{count:t,mean:e,m2Sum:r,m3Sum:o,m4Sum:i}}function ki(n,e={}){let t=Ri(n);if(!t)return null;let{count:r,m2Sum:o,m3Sum:i}=t,s=o/r,l=i/r/Math.pow(s,1.5);if(e?.bias??!0)return v(l)?l:null;if(r<3)return null;let c=Math.sqrt(r*(r-1))/(r-2)*l;return v(c)?c:null}function Ni(n,e={}){let t=Ri(n);if(!t)return null;let{count:r,m2Sum:o,m4Sum:i}=t,s=o/r,l=i/r/(s*s),u=l-3,c=e?.fisher??!0;if(e?.bias??!0){let p=c?u:l;return v(p)?p:null}if(r<4)return null;let m=(r-1)/((r-2)*(r-3))*((r+1)*u+6),h=c?m:m+3;return v(h)?h:null}function Mi(n,e={}){if(!n||n.length===0)return null;let{base:t=Math.E,normalize:r=!0}=e;if(t<=0||t===1)return null;let o=n.length,i=Math.log(t);if(r){let s=new Map,a=0;for(let u=0;u<o;u++){let c=n[u];if(c==null||Number.isNaN(c))continue;let f=G(c);s.set(f,(s.get(f)||0)+1),a++}if(a===0)return null;let l=0;for(let u of s.values()){let c=u/a;c>0&&(l-=c*(Math.log(c)/i))}return v(l)?((l<0||Object.is(l,-0))&&(l=0),l):null}else{let s=[],a=0;for(let c=0;c<o;c++){let f=n[c];if(f==null||Number.isNaN(f))continue;let m=Number(f);if(!v(m)||m<0)return null;m>0&&(s.push(m),a+=m)}if(s.length===0||a<=0)return null;let l=0,u=s.length;for(let c=0;c<u;c++){let f=s[c]/a;f>0&&(l-=f*(Math.log(f)/i))}return v(l)?((l<0||Object.is(l,-0))&&(l=0),l):null}}function pn(n,e){if(!n||n.length===0)return null;let t=null,r=n.length;for(let o=0;o<r;o++){let i=Ie(n[o],{range:"Int64"});i!==null&&(t=t===null?i:e(t,i))}return t===null?null:t>=Number.MIN_SAFE_INTEGER&&t<=Number.MAX_SAFE_INTEGER?Number(t):t}function wr(n,e){if(!n||n.length===0)return null;let t=n.length,r=new Array(t),o=new Array(t);for(let s=0;s<t;s++){let a=n[s];r[s]=a?.[0],o[s]=a?.[1]}let i=B(o)[e];return i!==null?r[i]:null}var wi,hn=R(()=>{"use strict";ye();Ve();dn();Ct();X();wi={sum:null,product:null,count:0,min:null,max:null,nanMin:null,nanMax:null,minIdx:null,maxIdx:null,mean:null,variance:0,std:0,nullCount:0,nanCount:0,len:0,hasNulls:!1,isNumeric:!1}});function Rt(n,e={}){let{format:t="json",allowPrimitives:r=!1,trimBeforeParse:o=!1,reviver:i,ndjson:{skipInvalidLines:s=!1,maxLines:a,skipLines:l}={},guard:u,onError:c}=e,f="fallback"in e,m=f?e.fallback:Na;if(typeof n!="string")return f?m:n;let h=o?n.trim():n;if(h==="")return f?m:n;let p;try{if(t==="ndjson"){let d=[],g=0,y=0,_=0,S=/\r\n|\n|\r/g,b;for(;;){b=S.exec(h);let x=b?h.substring(_,b.index):h.substring(_);b&&(_=S.lastIndex);let A=x.trim();if(A!==""&&(g++,l===void 0||g>l))if(!r&&!Ma(A)){if(!s)throw new M("NDJSON line is not wrapped and primitives are disallowed")}else{if(a!==void 0&&y>=a)break;try{d.push(JSON.parse(A,i)),y++}catch(w){if(!s)throw w}}if(!b)break}if(d.length===0)throw new Re("No valid NDJSON lines processed");p=d}else{if(!r&&!Ua(h))throw new M("JSON string is not wrapped and primitives are disallowed");p=JSON.parse(h,i)}if(u&&!u(p))throw new M("Parsed value failed guard validation")}catch(d){if(c)try{c(d)}catch{}return f?m:n}return p}function He(n={}){let e=n.bigintStrategy??"string",t=n.handleCircular?new WeakSet:null,o=Array.isArray(n.replacer)?n.replacer.map(String):null,i=s=>e==="number"&&s<=BigInt(Number.MAX_SAFE_INTEGER)&&s>=BigInt(Number.MIN_SAFE_INTEGER)?Number(s):s.toString();return function(a,l){let u=l;if(typeof n.replacer=="function")u=n.replacer.call(this,a,l);else if(o&&a!==""&&!Array.isArray(this)&&!o.includes(a))return;if(u===void 0)return;let c=u===l&&this!=null?this[a]:u;if(typeof n.onCustom=="function"){let f=n.onCustom.call(this,a,c);if(f!==c||f===void 0&&c!==void 0)return f}if(c!==null&&typeof c!="object"&&typeof c!="bigint")return u;if(t&&c!==null&&typeof c=="object"){if(a===""&&(t=new WeakSet),t.has(c))return n.onCircular?n.onCircular.call(this,a,c):"[Circular]";t.add(c)}return typeof c=="bigint"?n.voidBigIntReplacement?u:n.onBigInt?n.onBigInt(c):i(c):K(c)?n.voidTypedArrayReplacement?u:n.onTypedArray?n.onTypedArray(c):Array.from(c):Qt(c)?n.voidSetReplacement?u:n.onSet?n.onSet(c):Array.from(c):en(c)?n.voidMapReplacement?u:n.onMap?n.onMap(c):Array.from(c.entries()):ge(c)?n.voidRegExpReplacement?u:n.onRegExp?n.onRegExp(c):c.toString():P(c)?n.voidDateReplacement?u:n.onDate?n.onDate(c):n.formatDate?n.formatDate(c):c.toISOString():jo(c)?n.onError?n.onError(c):{name:c.name,message:c.message,stack:c.stack}:Fo(c)?n.onURLSearchParams?n.onURLSearchParams(c):c.toString():u}}function va(n){let e=n.trim().replace(/^\$/,"");if(!e)return[];let t=[],r=/\.\.\[\s*(?:'((?:\\.|[^'])*)'|"((?:\\.|[^"])*)"|(\*))\s*\]|\.\.([^\.\[]+)|\.([\w$-]+|\*)|\[\s*(?:'((?:\\.|[^'])*)'|"((?:\\.|[^"])*)"|(\*)|(-?\d*(?::-?\d*){0,2}))\s*\]/g,o,i=0;for(;(o=r.exec(e))!==null;){if(o.index!==i)return null;i=r.lastIndex;let[,s,a,l,u,c,f,m,h,p]=o,d=s??a,g=f??m;if(d!==void 0)t.push({type:"rec",key:vi(d)});else if(l!==void 0)t.push({type:"rec",key:Ar});else if(u!==void 0)t.push({type:"rec",key:u});else if(c!==void 0)t.push(c===Ar?{type:"wildcard"}:{type:"prop",key:c});else if(g!==void 0)t.push({type:"prop",key:vi(g)});else if(h!==void 0)t.push({type:"wildcard"});else if(p!==void 0)if(p.includes(":")){let[y,_,S]=p.split(":");t.push({type:"slice",start:se(y)??void 0,end:se(_)??void 0,step:se(S)??1})}else{let y=se(p);if(y===null)return null;t.push({type:"idx",idx:y})}}return i===e.length?t:null}function ji(n,e,t,r=new Set){if(n==null||!Fi(e.key)||typeof n!="object"||r.has(n))return;r.add(n);let o=Array.isArray(n);if(!o&&!F(n))return;e.key===Ar?Bi(n,{type:"wildcard"},t):!o&&Object.prototype.hasOwnProperty.call(n,e.key)&&t.push(n[e.key]);let i=o?n:Object.values(n);for(let s=0;s<i.length;s++)ji(i[s],e,t,r)}function Bi(n,e,t){if(n!=null)switch(e.type){case"prop":F(n)&&Fi(e.key)&&Object.prototype.hasOwnProperty.call(n,e.key)&&t.push(n[e.key]);break;case"idx":{if(!Array.isArray(n))break;let r=e.idx<0?n.length+e.idx:e.idx;r>=0&&r<n.length&&t.push(n[r]);break}case"slice":{if(!Array.isArray(n)||e.step===0)break;let r=e.step??1,o=e.start??(r>0?0:n.length-1),i=ln(n,{step:r,offsetStart:o,offsetEnd:e.end,null_on_oob:!0});if(i)for(let s=0;s<i.length;s++)t.push(i[s]);break}case"wildcard":{let r=Array.isArray(n)?n:F(n)?Object.values(n):null;if(r)for(let o=0;o<r.length;o++)t.push(r[o]);break}case"rec":ji(n,e,t);break}}function Pi(n,e){if(n==null||gn(e))return null;let t=n;if(typeof n=="string"){let s=n.trim();if(s==="")return null;let a=Rt(s,{allowPrimitives:!0,fallback:Ui});if(a===Ui)throw new M(`Invalid JSON string encountered in json_path_match: "${n}"`);t=a}let r=va(e);if(r===null)return null;let o=[t];for(let s=0;s<r.length;s++){if(o.length===0)return null;let a=[];for(let l=0;l<o.length;l++)Bi(o[l],r[s],a);o=a}if(o.length===0||o[0]==null)return null;let i=o[0];if(typeof i=="object")try{return JSON.stringify(i)}catch{return null}return String(i)}var Na,Ui,Ma,Ua,Ar,vi,Fi,kt=R(()=>{"use strict";hn();ye();Ve();Ct();X();xe();Na=Symbol("no_fallback"),Ui=Symbol("invalid"),Ma=n=>{let e=n.length;if(e<2)return!1;let t=n[0],r=n[e-1];return t==="{"&&r==="}"||t==="["&&r==="]"},Ua=n=>{let e=0,t=n.length;for(;e<t&&/\s/.test(n[e]);)e++;let r=t-1;for(;r>=e&&/\s/.test(n[r]);)r--;if(e>=r)return!1;let o=n[e],i=n[r];return o==="{"&&i==="}"||o==="["&&i==="]"};Ar="*",vi=n=>n.replace(/\\(.)/g,(e,t)=>ci[t]??t),Fi=n=>n!==void 0&&n!=="__proto__"&&n!=="constructor"&&n!=="prototype"});function Fa(n){return!F(n)||fr(n)?!1:ArrayBuffer.isView(n)?mr(n)||Po(n)||Bo(n):tn(n)||nn(n)}function Sr(n,e){if(n==null)return!1;try{if(Fa(n))return!0;if(e?.strict)return!1;if(typeof n=="string")return!0;if(ArrayBuffer.isView(n))return!fr(n);if(Array.isArray(n)){let t=n.length;for(let r=0;r<t;r++)if(!Ee(n[r],ja))return!1;return!0}}catch{return!1}return!1}function yn(n,e){try{if(!Sr(n,e))return null;if(mr(n))return n;if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);if(tn(n)||nn(n))return new Uint8Array(n);if(typeof n=="string")return Oe.encode(n);if(Array.isArray(n))return Uint8Array.from(n)}catch{return null}return null}var ja,Tr=R(()=>{"use strict";ye();Ve();xe();ja={range:"UInt8"}});function gn(n){let e=ie(n);return typeof e=="string"?e.trim().length===0:!1}function ft(n,e=null,t={}){if(n==null)return t.returnStringOnNull?"":null;let{mode:r="both",returnStringOnNull:o=!1,maxScanStart:i=1,maxScanEnd:s=1,maxMatchesStart:a=1,maxMatchesEnd:l=1,trimFirst:u=!1,stringOptions:c}=t,{literal:f=!1,caseInsensitive:m=!1}=c??{},h=(A,w="both")=>w==="start"?A.trimStart():w==="end"?A.trimEnd():A.trim(),p=n;if(u&&e!=null&&(p=h(n,r)),e==null){let A=h(p,r);return o||A!==""?A:null}let d=ge(e)?A=>{try{e.lastIndex=0}catch{}return e.test(A)}:(()=>{let A=new Set(m?e.toLowerCase():e);return w=>A.has(m?w.toLowerCase():w)})(),g=p.length;if(i===1&&a===1&&s===1&&l===1&&!f){let A=0,w=g;if(r==="both"||r==="start")for(;A<g&&d(p[A]);)A++;if(r==="both"||r==="end")for(;w>A&&d(p[w-1]);)w--;let D=A===0&&w===g?p:p.substring(A,w);return o||D!==""?D:null}let _=new Uint8Array(g),S=(A,w,D)=>{if(g===0||D===0)return;let O=A?0:g-1,C=A?g:-1,N=A?1:-1,Y=!1,Q=0,W=0;for(let le=O;le!==C;le+=N)if(d(p[le])){if(!Y){if(w!==null&&w>=0&&W>=w||D!==null&&D>=0&&Q>=D)break;Y=!0,Q++}_[le]=1}else if(Y=!1,W++,w!==null&&w>=0&&W>=w)break},b=(A,w,D,O,C)=>{if(g===0||C===0||w===0)return;let N=D?0:g-1,Y=0,Q=0,W=m?p.toLowerCase():p;for(;N>=0&&N<g&&!(C!==null&&C>=0&&Y>=C);){let le=D?N:N-w+1;if(!D&&le<0)break;let fe=D?W.indexOf(A,le):W.lastIndexOf(A,le);if(fe===-1)break;let Zt=D?fe-N:N-(fe+w-1);if(Q+=Zt,O!==null&&O>=0&&Q>=O)break;for(let at=0;at<w;at++)_[fe+at]=1;Y++,N=D?fe+w:fe-1}};if(r==="both"||r==="start")if(f&&typeof e=="string"){let A=m?e.toLowerCase():e;b(A,e.length,!0,i,a)}else S(!0,i,a);if(r==="both"||r==="end")if(f&&typeof e=="string"){let A=m?e.toLowerCase():e;b(A,e.length,!1,s,l)}else S(!1,s,l);let x="";for(let A=0;A<g;A++)_[A]===0&&(x+=p[A]);return o||x!==""?x:null}function G(n,{depth:e=0,maxDepth:t=50}={}){if(e>t)return"v:circular";if(n===null)return"v:null";if(n===void 0)return"v:undefined";if(P(n))return`d:${n.getTime()}`;if(K(n)){let o=n.toString();return`u:${n.constructor.name}:${o.length}:${o}`}if(Array.isArray(n)){let o=n.length,i=new Array(o),s={depth:e+1,maxDepth:t};for(let a=0;a<o;a++)i[a]=G(n[a],s);return`a:[${i.join(Ot)}]`}if(Qt(n)){let o=Array.from(n),i=o.length,s=new Array(i),a={depth:e+1,maxDepth:t};for(let l=0;l<i;l++)s[l]=G(o[l],a);return s.sort(),`set:[${s.join(Ot)}]`}if(en(n)){let o=Array.from(n.keys()),i=o.length,s=new Array(i),a={depth:e+1,maxDepth:t};for(let l=0;l<i;l++){let u=o[l];s[l]=`${G(u,a)}${ut}${G(n.get(u),a)}`}return s.sort(),`map:{${s.join(Ot)}}`}if(typeof n=="object"&&typeof n.toJSON=="function"){let o=n.toJSON();if(o!==n)return`j:${G(o,{depth:e+1,maxDepth:t})}`}if(ge(n)){let o=n.toString();return`r:${o.length}:${o}`}if(Pe(n)){let o=Object.keys(n).sort(),i=o.length,s=new Array(i),a={depth:e+1,maxDepth:t};for(let l=0;l<i;l++){let u=o[l];s[l]=`${G(u,a)}${ut}${G(n[u],a)}`}return`o:{${s.join(Ot)}}`}if(typeof n=="function"){let o=n.toString();return`f:${o.length}:${o}`}if(typeof n=="string")return`s:${n.length}:${n}`;if(typeof n=="symbol"){let o=n.toString();return`y:${o.length}:${o}`}if(typeof n=="number"||typeof n=="boolean"||typeof n=="bigint")return`${typeof n}:${n}`;let r=String(n);return`${typeof n}:${r.length}:${r}`}function Va(n){if(n==null)return[];let e=String(n);if(!e)return[];let r=e.normalize("NFC").replace(Ba,"$1$2").match(Pa)||[],o=[];for(let i=0;i<r.length;i++){let s=r[i];La.has(s)||o.push(s)}return o}function mt(n,e){let t=Va(n),r=t.length;if(r===0)return"";let{format:o}=e;if(o==="camel"||o==="pascal"||o==="title"){let i=o==="title"?" ":"",s=new Array(r);for(let a=0;a<r;a++){let l=t[a];s[a]=a===0&&o==="camel"?l.toLowerCase():l.charAt(0).toUpperCase()+l.slice(1).toLowerCase()}return s.join(i)}if(o==="kebab"||o==="snake"){let i=o==="kebab"?"-":"_",s=new Array(r);for(let a=0;a<r;a++)s[a]=t[a].toLowerCase();return s.join(i)}return String(n)}function zi(n){return typeof n!="string"&&(n=String(n)),Oe.encode(n)}function Ja(n){let e=yn(n);if(!e)return"";if(Ki&&typeof Uint8Array.prototype.toBase64=="function")return e.toBase64();if(xn)return Nt.from(e).toString("base64");let t="",r=e.length;for(let o=0;o<r;o+=Li){let i=e.subarray(o,o+Li);t+=String.fromCharCode.apply(null,i)}return btoa(t)}function Wa(n){if(typeof n!="string"&&(n=String(n)),xn)return Nt.from(n,"utf-8").toString("hex");let e=zi(n),t=e.length,r="";for(let o=0;o<t;o++)r+=qi[e[o]];return r}function Xa(n){typeof n!="string"&&(n=String(n));let e=zi(n);return Ja(e)}function Gi(n,e){if(n==null)return null;let t=Ha[e];if(!t)throw new Error(`Unsupported encoding: '${e}'. Supported encodings are 'hex' and 'base64'.`);return t(String(n))}function Ya(n){typeof n!="string"&&(n=String(n));let e=n.replace(qa,r=>Ka[r]),t=e.length%4;return t===0?e:e.padEnd(e.length+(4-t),"=")}function Za(n,e=!0){if(typeof n!="string"&&(n=String(n)),n!==""&&(n.length%4!==0||!za.test(n)))throw new Error("Invalid base64 encoding format");if(Ki)return Uint8Array.fromBase64(n,{strict:e});if(xn)return new Uint8Array(Nt.from(n,"base64"));let t=atob(n),r=t.length,o=new Uint8Array(r);for(let i=0;i<r;i++)o[i]=t.charCodeAt(i);return o}function Qa(n){typeof n!="string"&&(n=String(n));let e=n.trim();if(e.length%2!==0||!Ga.test(e))throw new Error("Invalid hex string format");if($a)return Uint8Array.fromHex(e);if(xn){let r=Nt.from(e,"hex");if(r.length!==e.length/2)throw new Error("Invalid hex string format");return new Uint8Array(r)}let t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){let o=parseInt(e.substring(r*2,r*2+2),16);if(Number.isNaN(o))throw new Error("Invalid hex string format");t[r]=o}return t}function el(n,e=!0){try{let t=Qa(n);return new TextDecoder("utf-8",{fatal:e}).decode(t)}catch(t){if(e)throw t;return null}}function tl(n,e=!0){try{typeof n!="string"&&(n=String(n));let t=n.trim(),r=Ya(t),o=Za(r,e);return new TextDecoder("utf-8",{fatal:e}).decode(o)}catch(t){if(e)throw t;return null}}function Ji(n,e,t={}){if(n==null)return null;let r=nl[e];if(!r)throw new Error(`Unsupported encoding: '${e}'. Supported encodings are 'hex' and 'base64'.`);let o=typeof t=="boolean"?t:t.strict??!0;return r(String(n),o)}function de(n,e){let t=ie(n);if(t==null)return"";let r=ge(t)?t.source:typeof t=="string"?t:String(t);return(e?.mode??"tc39")==="tc39"?typeof RegExp.escape=="function"&&!rl.test(r)?RegExp.escape(r):r.replace(ol,Vi):r.replace(il,Vi)}function pt(n,e,t){if(n==null||e==null)return null;let r=typeof n=="string"?n:String(n),o=t?.global??!1;try{if(!ge(e)){let a=typeof e=="string"?e:String(e),l=o?"g":"";if(t?.asciiCaseInsensitive&&(l+="i"),(a.includes("\\p{")||a.includes("\\P{"))&&!l.includes("u")&&!l.includes("v"))try{return{reg:new RegExp(a,l+"u"),input:r}}catch{try{return{reg:new RegExp(a,l+"v"),input:r}}catch{}}try{return{reg:new RegExp(a,l),input:r}}catch{return null}}let i=e.flags.replace(/y/g,"");o?i.includes("g")||(i+="g"):i=i.replace(/g/g,""),t?.asciiCaseInsensitive!==void 0&&(i=t.asciiCaseInsensitive?i.includes("i")?i:i+"i":i.replace(/i/g,""));let s=new RegExp(e.source,i);return s.lastIndex=0,{reg:s,input:r}}catch{return null}}function $i(n){let e=Object.create(null);n.index!==void 0&&Object.defineProperty(e,"_index",{value:String(n.index),writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"_length",{value:n.length,writable:!0,enumerable:!1,configurable:!0});for(let t=0;t<n.length;t++)e[String(t)]=n[t]!==void 0?n[t]:null;if(n.groups)for(let t in n.groups){let r=n.groups[t];e[t]=r!==void 0?r:null}return e}function Dr(n,e){if(typeof e=="string")return e in n?n[e]:null;let t=Number(e);if(Number.isNaN(t))return null;let r=Math.trunc(t);if(r>=0)return n[String(r)]??null;let i=(n._length??0)+r;return i>=1?n[String(i)]??null:null}function sl(n,e,t,r,o){let{literal:i=!1,mode:s,asciiCaseInsensitive:a=!1}=r??{},l=i?de(e,{mode:s}):e,c=pt(n,l,{global:!0,asciiCaseInsensitive:a})?.reg??null;if(!c)return[];let f=[];c.lastIndex=0;let m;for(;(m=c.exec(n))!==null;){let h=m.index,p=c.lastIndex,d=o(m,h,p);if(f.push({start:h,end:p,patternIndex:t,payload:d}),h===p){if(h===n.length)break;let g=n.codePointAt(h),y=g!=null&&g>65535?2:1;c.lastIndex=h+y}}return f}function Xi(n){if(n.length<=1)return n;n.sort((o,i)=>{if(o.start!==i.start)return o.start-i.start;let s=o.patternIndex??o.i??0,a=i.patternIndex??i.i??0;return s-a});let e=[],t=0,r=n.length;for(let o=0;o<r;o++){let i=n[o];i.start>=t&&(e.push(i),t=i.end)}return e}function Hi(n,e,t,r,o){let{overlapping:i=!1,leftmost:s,...a}=t??{},l=s??!0;if(i&&s)throw new M("Cannot specify both 'overlapping' and 'leftmost' as true.");if(n==null||e==null)return null;let u=be(e),c=u.length;if(c===0)return[];if(i){let h=new Array(c);for(let p=0;p<c;p++)h[p]=r(u[p]);return h}let f=[];for(let h=0;h<c;h++){let p=Mt(n,u[h],{...a,global:!1});if(p&&p[0]&&p[0]._index!=null){let d=Number(p[0]._index),g=p[0][0]?.length??0;f.push({i:h,start:d,end:d+g,payload:o(p[0],d)})}}let m=new Array(c).fill(null);if(f.length===0)return m;if(l){let h=Xi(f);for(let p=0;p<h.length;p++){let d=h[p];m[d.i]=d.payload}}else{let h=[];f.sort((g,y)=>g.i-y.i);let p=f.length;for(let g=0;g<p;g++){let y=f[g],_=!1,S=h.length;for(let b=0;b<S;b++){let x=h[b],A=!1;if(y.start===y.end&&x.start===x.end?A=y.start===x.start:x.start===x.end?A=x.start>=y.start&&x.start<y.end:y.start===y.end?A=y.start>=x.start&&y.start<x.end:A=y.start<x.end&&y.end>x.start,A){_=!0;break}}_||h.push(y)}let d=h.length;for(let g=0;g<d;g++){let y=h[g];m[y.i]=y.payload}}return m}function Mt(n,e,t){let r=pt(n,e,t);if(!r)return null;if(!t?.global){let s=r.input.match(r.reg);return s?[$i(s)]:null}let o=Array.from(r.input.matchAll(r.reg));if(o.length===0)return null;let i=new Array(o.length);for(let s=0;s<o.length;s++)i[s]=$i(o[s]);return i}function Or(n,e,t){let r=Mt(n,e,t);return r?Dr(r[0],t?.groupIndex??1):null}function Yi(n,e,t){let r=Mt(n,e,{...t,global:!0});if(!r)return null;let o=t?.groupIndex??0,i=new Array(r.length);for(let s=0;s<r.length;s++)i[s]=Dr(r[s],o);return i}function Zi(n,e,t){return Mt(n,e,t)?.[0]??null}function Qi(n,e,t){let r=t?.groupIndex??0;return Hi(n,e,t,o=>Or(n,o,{...t,groupIndex:r}),o=>Dr(o,r))}function _n(n,e,t){if(n==null||e==null)return null;let{literal:r=!1,asciiCaseInsensitive:o=!1,mode:i}=t??{};if(r){let l=ge(e),u=de(e,{mode:i}),c=o?"i":"";if(l)for(let h of["i","u","v","m","s"])e.flags.includes(h)&&!c.includes(h)&&(c+=h);let f=new RegExp(u,c),m=n.match(f);return!m||m.index==null?null:Oe.encode(n.slice(0,m.index)).length}let s=Mt(n,e,{...t,global:!1});if(!s||!s[0]||s[0]._index==null)return null;let a=Number(s[0]._index);return Oe.encode(n.slice(0,a)).length}function es(n,e,t){if(t?.literal){if(n==null||e==null)return null;let r=be(e),o=new Array(r.length);for(let i=0;i<r.length;i++)o[i]=_n(n,r[i],t);return o}return Hi(n,e,t,r=>_n(n,r,t),(r,o)=>Oe.encode(n.slice(0,o)).length)}function ts(n,e,t){if(n==null||e==null)return null;let{literal:r=!0,inclusive:o=!1,limit:i,exact:s=!1,strict:a=!1,mode:l,...u}=t??{},c=r?de(e,{mode:l}):e,f=pt(n,c,{...u,global:!0});if(!f)return null;let{reg:m}=f;m.lastIndex=0;let h=[],p=0,d=0,g=i!=null&&i>=0?i:1/0,y;for(;d<g&&(y=m.exec(n))!==null;){let S=y.index,b=m.lastIndex;if(S===b){if(S===n.length)break;let x=n.codePointAt(S),A=x!=null&&x>65535?2:1;if(S>0&&S>=p&&(h.push(n.slice(p,S)),d++,p=S,d>=g))break;m.lastIndex=S+A;continue}h.push(n.slice(p,o?b:S)),p=b,d++}if(h.push(n.slice(p)),i==null||i<0)return h;let _=i+1;if(a&&h.length<_)throw new M(`split exact error: expected string to split into at least ${_} parts, but got ${h.length}`);if(s)for(;h.length<_;)h.push(null);return h}function ns(n,e,t,r,o,i){return n.replace(/\$\$|\$([$'`&]|\d{1,2}|<[^>]+>)/g,(s,a)=>{if(s==="$$")return"$";if(!a)return s;if(a==="$")return"$";if(a==="&")return e;if(a==="`")return r.slice(0,t);if(a==="'")return r.slice(t+e.length);if(a.startsWith("<")){if(i===void 0)return s;let u=a.slice(1,-1);return i[u]??""}let l=Number(a);if(l>0&&l<=o.length)return o[l-1]??"";if(a.length===2){let u=Number(a[0]);if(u>0&&u<=o.length)return(o[u-1]??"")+a[1]}return s})}function Er(n,e,t,r){if(n==null||e==null||t==null)return null;let o=typeof n=="string"?n:String(n),{literal:i=!1,n:s,mode:a,...l}=r??{},u=s??(l?.global?1/0:1),c=v(u,{allowNonFiniteNumbers:!0,allowNaN:!1})?Math.trunc(u):1;if(c===0)return o;let f=i?de(e,{mode:a}):e,m=pt(o,f,{...l,global:l?.global??c!==1});if(!m)return o;let{reg:h}=m,p=typeof t=="function";if(c===1||c<0||c===1/0){if(i&&!p){let y=String(t);return o.replace(h,()=>y)}return o.replace(h,t)}let d=0,g=p?"":String(t);return o.replace(h,(...y)=>{if(d++>=c)return y[0];if(p)return String(t(...y));if(i)return g;let _=y.length,S=typeof y[_-1]=="object"&&y[_-1]!==null,b=S?y[_-1]:void 0,x=S?y[_-3]:y[_-2],A=y.slice(1,S?_-3:_-2);return ns(g,y[0],x,o,A,b)})}function rs(n,e,t,r){if(n==null||e==null)return null;let o=typeof n=="string"?n:String(n),i,s=null,a=null;if(!Array.isArray(e)&&typeof e=="object")i=Object.keys(e),s=Object.values(e);else if(Array.isArray(e))if(i=e,Array.isArray(t))if(t.length===1&&i.length>1)a=t[0];else{if(t.length!==i.length)throw new M(`replace_many length mismatch: expected ${i.length} replacement strings, got ${t.length}`);s=t}else if(t!=null)a=t;else return o;else return o;let l=i.length;if(l===0)return o;let u=[];for(let p=0;p<l;p++){let d=i[p],g=s?s[p]:a;if(d==null||g==null)continue;let y=sl(o,d,p,r,(_,S)=>{let b=Array.prototype.slice.call(_,1);if(typeof g=="function"){let x=[_[0],...b,S,o];return _.groups!==void 0&&x.push(_.groups),String(g(...x))}return r?.literal?String(g):ns(String(g),_[0],S,o,b,_.groups)});for(let _=0;_<y.length;_++)u.push(y[_])}if(u.length===0)return o;let c=Xi(u),f="",m=0,h=c.length;for(let p=0;p<h;p++){let d=c[p];f+=o.slice(m,d.start)+d.payload,m=d.end}return f+=o.slice(m),f}var Ba,Pa,La,Nt,xn,$a,Ki,Li,qi,Ka,qa,za,Ga,su,Ha,nl,rl,Wi,ol,il,Vi,Ct=R(()=>{"use strict";ye();hn();kt();Tr();Ve();xe();X();Ba=/(\p{L})['’](\p{L})/gu,Pa=new RegExp(["\\p{Lu}+s(?!\\p{Ll})","\\p{Lu}+(?=\\p{Lu}\\p{Ll})","\\p{Lu}+\\p{Ll}*","\\p{Ll}+","\\p{N}+","\\p{L}+"].join("|"),"gu"),La=new Set(["__proto__","proto","constructor","prototype"]);Nt=typeof globalThis<"u"?globalThis.Buffer:void 0,xn=typeof Nt<"u",$a=typeof Uint8Array<"u"&&typeof Uint8Array.fromHex=="function",Ki=typeof Uint8Array<"u"&&typeof Uint8Array.fromBase64=="function",Li=8192,qi=new Array(256);for(let n=0;n<256;n++)qi[n]=n.toString(16).padStart(2,"0");Ka={"-":"+",_:"/"},qa=/[-_]/g,za=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Ga=/^[0-9a-fA-F]*$/,su=He({handleCircular:!0});Ha={hex:Wa,base64:Xa};nl={hex:el,base64:tl};rl=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Wi="\\x00-\\x1F\\x7F\\u{D800}-\\u{DFFF}",ol=new RegExp(`[${Wi}\\\\^$*+?.()|[\\]{}/#,=<>&!%:;@~'"\`-]`,"gu"),il=new RegExp(`[${Wi}]|[\\x20-\\x2F\\x3A-\\x40\\x5B-\\x5E\\x5F\\x60\\x7B-\\x7E]`,"gu"),Vi=n=>{let e=n.codePointAt(0),t=e<=si||e===ai,r=n.length===1&&e>=li&&e<=ui;if(t||r){let o=yr[e];if(o)return o;let i=e.toString(16);return t?`\\x${i.padStart(2,"0")}`:`\\u${i.padStart(4,"0")}`}return"\\"+n}});function ul(n){let e=os.get(n);return e||(e=new Intl.DateTimeFormat("en-US",{timeZone:n,hourCycle:"h23",weekday:"short",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3}),os.set(n,e)),e}function cl(n,e){let t=`${n}_${e}`,r=is.get(t);return r||(r=new Intl.DateTimeFormat(n,{timeZoneName:"short",timeZone:e}),is.set(t,r)),r}function fl(n){let e=ss.get(n);if(e===void 0){try{Intl.DateTimeFormat(void 0,{timeZone:n}),e=!0}catch{e=!1}ss.set(n,e)}return e}function we(n){let e=!n||n==="local"?Intl.DateTimeFormat().resolvedOptions().timeZone:n;return fl(e)?e:"UTC"}function te(n,e=0,t=1,r=0,o=0,i=0,s=0){let a=new Date(0);return a.setUTCFullYear(n,e,t),a.setUTCHours(r,o,i,s),a}function ml(n,e,t){let r=[0,3,2,5,0,3,5,1,4,6,2,4],o=n;return e<3&&(o-=1),(o+Math.floor(o/4)-Math.floor(o/100)+Math.floor(o/400)+r[e-1]+t)%7}function ae(n,e){let t=we(e);if(t.toUpperCase()==="UTC")return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),ms:n.getUTCMilliseconds(),dayOfWeek:n.getUTCDay(),timeZone:"UTC"};let o=ul(t).formatToParts(n),i="0",s="0",a="0",l="0",u="0",c="0",f="0";for(let _=0,S=o.length;_<S;_++){let b=o[_];switch(b.type){case"year":i=b.value;break;case"month":s=b.value;break;case"day":a=b.value;break;case"hour":l=b.value;break;case"minute":u=b.value;break;case"second":c=b.value;break;case"fractionalSecond":f=b.value;break}}let m=parseInt(i,10),h=parseInt(s,10),p=parseInt(a,10),d=parseInt(l,10);d===24&&(d=0);let g=Math.round(parseFloat("0."+f)*1e3)||0,y=ml(m,h,p);return{year:m,month:h,day:p,hour:d,minute:parseInt(u,10),second:parseInt(c,10),ms:g,dayOfWeek:y,timeZone:t}}function ht(n,e){let t=we(e);if(t.toUpperCase()==="UTC")return 0;let r=ae(n,"UTC"),o=ae(n,t),i=te(r.year,r.month-1,r.day,r.hour,r.minute,r.second,r.ms).getTime(),s=te(o.year,o.month-1,o.day,o.hour,o.minute,o.second,o.ms).getTime();return Math.round((s-i)/_e)}function as(n,e){let t=n>=0?"+":"-",r=Math.abs(n),o=String(Math.floor(r/60)).padStart(2,"0"),i=String(r%60).padStart(2,"0");return e==="iso"?`${t}${o}:${i}`:`${t}${o}${i}`}function J(n,e){let t=ie(n);if(t==null)return null;let r=null;if(P(t))r=t;else if(typeof t=="number"||typeof t=="bigint")r=new Date(pl(t));else if(typeof t=="string"){if(gn(t))return null;r=new Date(t)}if(!r||!P(r))return null;if(e?.dateOnly){let o=typeof t=="string",i=o&&ll.test(t),s=o&&!i&&!ls.test(t)?"local":"UTC",a=ae(r,s);return te(a.year,a.month-1,a.day)}return r}function wn(n){let e=ie(n);if(e==null)return null;let t=null;if(typeof e=="string"){let o=e.trim();if(al.test(o)){let i=ls.test(o);t=J(`1970-01-01T${o}${i?"":"Z"}`)}}let r=t||J(e);return r?Ye(r,{format:"%H:%M:%S.%ms"}):null}function us(n,e="ms"){let t=n.getTime();switch(e){case"s":return Math.floor(t/lt);case"ms":return t;case"us":return BigInt(t)*dr;case"ns":return BigInt(t)*gr}}function pl(n){if(typeof n=="bigint"){let t=n<0n?-n:n;return t<=30000000000n?Number(n)*1e3:t<=30000000000000n?Number(n):t<=30000000000000000n?Number(n/dr):Number(n/gr)}let e=Math.abs(n);return e<=3e10?n*1e3:e<=3e13?n:e<=3e16?Math.floor(n/1e3):Math.floor(n/1e6)}function cs(n){if(!P(n))return null;let e=n.getUTCFullYear();return Math.floor((e-1)/100)+1}function Ir(n,e={field:"week"}){if(!P(n))return null;let t=te(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),r=t.getUTCDay()||7;if(t.setUTCDate(t.getUTCDate()+4-r),e.field==="year")return t.getUTCFullYear();let o=te(t.getUTCFullYear(),0,1),i=Math.round((t.getTime()-o.getTime())/Le);return Math.floor(i/7)+1}function fs(n){if(!P(n))return null;let e=n.getUTCFullYear();return Math.floor((e-1)/1e3)+1}function An(n,e,t=1){return P(n)?te(n.getUTCFullYear(),n.getUTCMonth()+e,t):null}function Cr(n){if(!P(n))return null;let e=te(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()).getTime(),t=te(n.getUTCFullYear(),0,1).getTime();return Math.floor((e-t)/Le)+1}function ms(n){return P(n)?Math.floor(n.getUTCMonth()/3)+1:null}function Rr(n){let e;if(P(n))e=n.getUTCFullYear();else if(v(n))e=n;else return!1;return e%4===0&&e%100!==0||e%400===0}function ps(n){return n.replace(/%[FTRD]/g,e=>dl[e]||e)}function gl(n){let e=n.replace(":",""),t=e[0]==="+"?1:-1,r=parseInt(e.slice(1,3),10)||0,o=parseInt(e.slice(3,5),10)||0;return t*(r*60+o)}function Ye(n,{format:e,locale:t,timeZone:r="UTC"}){if(!P(n)||typeof e!="string")return"";let o=t&&t.trim()||Intl.DateTimeFormat().resolvedOptions().locale||"en-US",i=ps(e),s=null,a=()=>s??=ae(n,r);return i.replace(bn,(l,u)=>{if(u==="%")return"%";let c=kr[u];return c?c.format(n,o,r,a()):l})}function hs(n,{format:e,strict:t=!0,defaultTimeZone:r="UTC"}){if(typeof n!="string"||typeof e!="string")return null;let o=ps(e),i=[],s="",a=0;bn.lastIndex=0;let l;for(;(l=bn.exec(o))!==null;){let d=o.slice(a,l.index);s+=de(d);let g=l[1];if(g==="%")s+="\\%";else{let y=kr[g];y&&y.parseRegex?(i.push(y),s+=`(${y.parseRegex})`):s+=de(l[0])}a=bn.lastIndex}s+=de(o.slice(a));let u=new RegExp("^\\s*"+s+"\\s*$"),c=n.match(u);if(!c)return t?null:J(n);let f={year:1970,month:1,day:1,hour:0,minute:0,second:0,ms:0,offset:null},m=null,h=!1;for(let d=0;d<i.length;d++){let g=c[d+1],y=i[d],_=y.parseNormalize?y.parseNormalize(g):parseInt(g,10);y.key==="j"&&(h=!0),y.parseField==="ampm"?m=_:y.parseField==="offset"?f.offset=_:y.parseField&&(f[y.parseField]=_)}if(m&&(m==="PM"&&f.hour<12&&(f.hour+=12),m==="AM"&&f.hour===12&&(f.hour=0)),h){let d=Rr(f.year)?366:365;if(f.day<1||f.day>d)return null;let g=te(f.year,0,1);g.setUTCDate(f.day),f.month=g.getUTCMonth()+1,f.day=g.getUTCDate()}let p=te(f.year,f.month-1,f.day,f.hour,f.minute,f.second,f.ms);if(!P(p)||p.getUTCFullYear()!==f.year||p.getUTCMonth()+1!==f.month||p.getUTCDate()!==f.day||p.getUTCHours()!==f.hour||p.getUTCMinutes()!==f.minute||p.getUTCSeconds()!==f.second||p.getUTCMilliseconds()!==f.ms)return null;if(f.offset)p=new Date(p.getTime()-gl(f.offset)*_e);else if(r.toUpperCase()!=="UTC"){let d=we(r),g=ht(p,d);p=new Date(p.getTime()-g*_e);let y=ht(p,d);y!==g&&(p=new Date(p.getTime()-(y-g)*_e))}return P(p)?p:null}function ds(n,e,{excludeWeekdays:t=[],holidays:r=[],roll:o}={}){if(!Ee(e))throw new ne(`The offset parameter 'n' must be a whole integer. Received: ${e}`);if(t.length===0&&(!r||Array.isArray(r)&&r.length===0||r instanceof Set&&r.size===0)&&!o)return e;if(7-t.length<=0)throw new ne("All weekdays are excluded; cannot offset.");let s=new Set;if(r instanceof Set)for(let f of r){let m=new Date(f);t.includes(m.getUTCDay())||s.add(f)}else if(Array.isArray(r))for(let f=0;f<r.length;f++){let m=J(r[f]);if(!m||t.includes(m.getUTCDay()))continue;let h=te(m.getUTCFullYear(),m.getUTCMonth(),m.getUTCDate());s.add(h.getTime())}let a=f=>t.includes(f.getUTCDay())?!0:s.has(f.getTime()),l=te(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()),u=new Date(l.getTime());if(o&&a(u)){if(o==="raise")throw new ne("Start date falls on an excluded day or holiday.");let f=o==="forward"?1:-1;for(;a(u);)u.setUTCDate(u.getUTCDate()+f)}if(e!==0){let f=e>0?1:-1,m=0,h=Math.abs(e);for(;m<h;)u.setUTCDate(u.getUTCDate()+f),a(u)||m++}let c=u.getTime()-l.getTime();return Math.round(c/Le)}function Nr(n,e,t){let r=we(e),o=t?.type??"total",i;if(o==="total")i=ht(n,r);else{let l=ae(n,r).year,u=ht(te(l,0,1),r),c=ht(te(l,6,1),r),f=Math.min(u,c);o==="daylightSavingTime"?i=ht(n,r)-f:i=f}switch(t?.format??"milliseconds"){case"minutes":return i;case"hours":return i/60;case"iso":return as(i,"iso");case"basic":return as(i,"basic");default:return i*_e}}function gs(n,e={}){if(!P(n))return null;let t=e.excludeWeekdays??[0,6],r=n.getUTCDay();if(t.includes(r))return!1;let o=e.holidays;if(o){if(o instanceof Set){let i=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate());if(o.has(i))return!1}else if(Array.isArray(o)&&o.length>0){let i=new Set;for(let a=0;a<o.length;a++){let l=J(o[a]);l&&i.add(Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()))}let s=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate());if(i.has(s))return!1}}return!0}function ys(n,e={}){let t=ae(n,e?.timeZone??void 0),r=e?.year??t.year,o=e?.month!=null?e.month-1:t.month-1,i=e?.day??t.day,s=e?.hour??t.hour,a=e?.minute??t.minute,l=e?.second??t.second,u=e?.ms??t.ms;return te(r,o,i,s,a,l,u)}var al,ls,ll,os,is,ss,kr,hl,bn,dl,dn=R(()=>{"use strict";Ct();X();ye();Ve();xe();al=/^\d{2}:\d{2}/,ls=/(?:Z|[+-]\d{2}(?::?\d{2})?)$/i,ll=/^\d{4}-\d{2}-\d{2}$/,os=new Map;is=new Map;ss=new Map;kr={Y:{key:"Y",format:(n,e,t,r)=>{let o=r.year;return o>=0?String(o).padStart(4,"0"):"-"+String(Math.abs(o)).padStart(4,"0")},parseRegex:"[+-]?\\d{4,}",parseField:"year"},y:{key:"y",format:(n,e,t,r)=>String(Math.abs(r.year)%100).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"year",parseNormalize:n=>{let e=parseInt(n,10);return e+(e>=69?1900:2e3)}},m:{key:"m",format:(n,e,t,r)=>String(r.month).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"month"},d:{key:"d",format:(n,e,t,r)=>String(r.day).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"day"},e:{key:"e",format:(n,e,t,r)=>String(r.day).padStart(2," "),parseRegex:"\\s?\\d{1,2}",parseField:"day"},H:{key:"H",format:(n,e,t,r)=>String(r.hour).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"hour"},I:{key:"I",format:(n,e,t,r)=>String(r.hour%12||12).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"hour"},p:{key:"p",format:(n,e,t,r)=>r.hour>=12?"PM":"AM",parseRegex:"AM|PM|am|pm",parseField:"ampm",parseNormalize:n=>n.toUpperCase()},M:{key:"M",format:(n,e,t,r)=>String(r.minute).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"minute"},S:{key:"S",format:(n,e,t,r)=>String(r.second).padStart(2,"0"),parseRegex:"\\d{2}",parseField:"second"},A:{key:"A",format:(n,e,t)=>n.toLocaleDateString(e,{weekday:"long",timeZone:we(t)})},a:{key:"a",format:(n,e,t)=>n.toLocaleDateString(e,{weekday:"short",timeZone:we(t)})},B:{key:"B",format:(n,e,t)=>n.toLocaleDateString(e,{month:"long",timeZone:we(t)})},b:{key:"b",format:(n,e,t)=>n.toLocaleDateString(e,{month:"short",timeZone:we(t)})},h:{key:"h",format:(n,e,t)=>n.toLocaleDateString(e,{month:"short",timeZone:we(t)})},j:{key:"j",format:(n,e,t,r)=>String(Cr(te(r.year,r.month-1,r.day))??1).padStart(3,"0"),parseRegex:"\\d{3}",parseField:"day",parseNormalize:n=>parseInt(n,10)},u:{key:"u",format:(n,e,t,r)=>String(r.dayOfWeek||7)},w:{key:"w",format:(n,e,t,r)=>String(r.dayOfWeek)},Z:{key:"Z",format:(n,e,t)=>{let r=we(t);if(r.toUpperCase()==="UTC")return"UTC";let o=cl(e,r).formatToParts(n);for(let i=0,s=o.length;i<s;i++)if(o[i].type==="timeZoneName")return o[i].value;return"UTC"}},z:{key:"z",format:(n,e,t)=>Nr(n,t,{format:"basic"}),parseRegex:"[+-]\\d{2}(?::?\\d{2})?",parseField:"offset",parseNormalize:n=>n.replace(":","")},ms:{key:"ms",format:(n,e,t,r)=>String(r.ms).padStart(3,"0"),parseRegex:"\\d{3}",parseField:"ms",parseNormalize:n=>parseInt(n,10)},f:{key:"f",format:(n,e,t,r)=>String(r.ms).padStart(3,"0").padEnd(6,"0"),parseRegex:"\\d{1,9}",parseField:"ms",parseNormalize:n=>parseInt(n.padEnd(6,"0").slice(0,3),10)}},hl=Object.keys(kr).concat("%").sort((n,e)=>e.length-n.length),bn=new RegExp("%("+hl.join("|")+")","g"),dl={"%F":"%Y-%m-%d","%T":"%H:%M:%S","%R":"%H:%M","%D":"%m/%d/%y"}});var Z,Ze,Ut,qe,ze,dt,Ge,gt,Sn=R(()=>{"use strict";Z=class n{matches(e){if(e==null)return!1;if(e instanceof n)return!!(this.equals(e)||this.name.startsWith("Decimal")&&e.name.startsWith("Decimal")&&e.precision===void 0&&e.scale===void 0);if(typeof e=="function"){if(e.prototype instanceof n)return this instanceof e;try{let t=e();if(t instanceof n)return this.constructor===t.constructor}catch{}}return!1}get isNumeric(){return!1}get isInteger(){return!1}get isFloat(){return!1}get isSigned(){return!1}get isUnsigned(){return!1}get isTemporal(){return!1}get isNested(){return!1}get isBoolean(){return!1}get isString(){return!1}get isUtf8(){return!1}get isObject(){return!1}get isNull(){return!1}get isBinary(){return!1}},Ze=class extends Z{get isNumeric(){return!0}},Ut=class extends Ze{get isInteger(){return!0}},qe=class extends Ut{get isSigned(){return!0}},ze=class extends Ut{get isUnsigned(){return!0}},dt=class extends Ze{get isFloat(){return!0}},Ge=class extends Z{get isTemporal(){return!0}},gt=class extends Z{get isNested(){return!0}}});var Tn,Mr,Dn,Ur,On,vr,En,vt,In,Fr,Cn,jr,Rn,Br,kn,Pr,Qe,Lr,et,Ft,ke,Nn,jt,Mn,_t,Un,Vr,vn,$r,Fn,Kr,jn,qr,Ae,Bt,Bn,zr,me,Gr,tt,Jr,yt,Wr,xt=R(()=>{"use strict";Sn();z();Tn=class extends qe{name="Int8";coerce(e){return se(e,{range:"Int8"})}equals(e){return e.name==="Int8"}allocate(e){return new Int8Array(e)}},Mr=new Tn,Dn=class extends qe{name="Int16";coerce(e){return se(e,{range:"Int16"})}equals(e){return e.name==="Int16"}allocate(e){return new Int16Array(e)}},Ur=new Dn,On=class extends qe{name="Int32";coerce(e){return se(e,{range:"Int32"})}equals(e){return e.name==="Int32"}allocate(e){return new Int32Array(e)}},vr=new On,En=class extends qe{name="Int64";coerce(e){return Ie(e,{truncate:!0})}equals(e){return e.name==="Int64"}allocate(e){return new BigInt64Array(e)}},vt=new En,In=class extends ze{name="UInt8";coerce(e){return se(e,{range:"UInt8"})}equals(e){return e.name==="UInt8"}allocate(e){return new Uint8Array(e)}},Fr=new In,Cn=class extends ze{name="UInt16";coerce(e){return se(e,{range:"UInt16"})}equals(e){return e.name==="UInt16"}allocate(e){return new Uint16Array(e)}},jr=new Cn,Rn=class extends ze{name="UInt32";coerce(e){return se(e,{range:"UInt32"})}equals(e){return e.name==="UInt32"}allocate(e){return new Uint32Array(e)}},Br=new Rn,kn=class extends ze{name="UInt64";coerce(e){return Ie(e,{range:"UInt64"})}equals(e){return e.name==="UInt64"}allocate(e){return new BigUint64Array(e)}},Pr=new kn,Qe=class extends dt{name="Float32";coerce(e){return _r(e,{floatPrecision:"Float32"})}equals(e){return e.name==="Float32"}allocate(e){return new Float32Array(e)}},Lr=new Qe,et=class extends dt{name="Float64";coerce(e){return _r(e,{floatPrecision:"Float64"})}equals(e){return e.name==="Float64"}allocate(e){return new Float64Array(e)}},Ft=new et,ke=class n extends Ze{constructor(t,r){super();this.precision=t;this.scale=r;this.name=t!==void 0&&r!==void 0?`Decimal(${t}, ${r})`:"Decimal"}precision;scale;name;coerce(t){return sn(t,{precision:this.precision,scale:this.scale})}equals(t){return t instanceof n&&this.precision===t.precision&&this.scale===t.scale}allocate(t){return new Array(t).fill(null)}},Nn=class extends Z{name="Boolean";get isBoolean(){return!0}coerce(e){return e==null?null:!!e}equals(e){return e.name==="Boolean"}allocate(e){return new Array(e).fill(null)}},jt=new Nn,Mn=class extends Z{name="Utf8";get isString(){return!0}get isUtf8(){return!0}coerce(e){return e==null?null:String(e)}equals(e){return e.name==="Utf8"}allocate(e){return new Array(e).fill(null)}},_t=new Mn,Un=class extends Z{name="Binary";get isBinary(){return!0}coerce(e){return yn(e)}equals(e){return e.name==="Binary"}allocate(e){return new Array(e).fill(null)}},Vr=new Un,vn=class extends Z{name="Null";get isNull(){return!0}coerce(e){return null}equals(e){return e.name==="Null"}allocate(e){return new Array(e).fill(null)}},$r=new vn,Fn=class extends Z{name="Object";get isObject(){return!0}coerce(e){return e===void 0?null:e}equals(e){return e.name==="Object"}allocate(e){return new Array(e).fill(null)}},Kr=new Fn,jn=class extends Ge{name="Date";coerce(e){return J(e,{dateOnly:!0})}equals(e){return e.name==="Date"}allocate(e){return new Array(e).fill(null)}},qr=new jn,Ae=class n extends Ge{name="Datetime";timeUnit;timeZone;constructor(e="ms",t=null){super(),this.timeUnit=e,this.timeZone=t}coerce(e){return J(e)}equals(e){return e instanceof n&&e.timeUnit===this.timeUnit&&e.timeZone===this.timeZone}allocate(e){return new Array(e).fill(null)}},Bt=new Ae,Bn=class extends Ge{name="Time";coerce(e){return wn(e)}equals(e){return e.name==="Time"}allocate(e){return new Array(e).fill(null)}},zr=new Bn,me=class n extends Ge{name="Duration";timeUnit;constructor(e="ms"){super(),this.timeUnit=e}coerce(e){return j(e)}equals(e){return e instanceof n&&e.timeUnit===this.timeUnit}allocate(e){return new Array(e).fill(null)}},Gr=new me,tt=class n extends gt{constructor(t){super();this.innerType=t}innerType;name="Array";coerce(t){if(t==null)return null;let r=k(t)?Array.from(t):[t],o=r.length,i=new Array(o);for(let s=0;s<o;s++)i[s]=this.innerType.coerce(r[s]);return i}equals(t){return t instanceof n&&this.innerType.equals(t.innerType)}allocate(t){return new Array(t).fill(null)}},Jr=n=>new tt(n),yt=class n extends gt{constructor(t){super();this.fields=t}fields;name="Struct";coerce(t){if(!F(t))return null;let r={},o=Object.keys(this.fields),i=o.length;for(let s=0;s<i;s++){let a=o[s],l=this.fields[a];r[a]=l.coerce(t[a])}return r}equals(t){if(!(t instanceof n))return!1;let r=Object.keys(this.fields),o=Object.keys(t.fields);if(r.length!==o.length)return!1;for(let i=0;i<r.length;i++){let s=r[i];if(!this.fields[s].equals(t.fields[s]))return!1}return!0}allocate(t){return new Array(t).fill(null)}},Wr=n=>new yt(n)});var E,Ne=R(()=>{"use strict";Sn();xt();xt();Sn();E={Int8:Mr,Int16:Ur,Int32:vr,Int64:vt,UInt8:Fr,UInt16:jr,UInt32:Br,UInt64:Pr,Float32:Lr,Float64:Ft,Decimal:(n,e)=>new ke(n,e),Boolean:jt,Utf8:_t,Binary:Vr,Date:qr,Datetime:Bt,Time:zr,Duration:Gr,Object:Kr,Null:$r,Array:Jr,Struct:Wr}});function _l(n={}){let e=n.nullValue!==void 0?n.nullValue:"",t=yi(n.numericFormatOptions),r=n.replacerOptions||{},o=a=>n.datetimeFormat?Ye(a,{format:n.datetimeFormat}):n.dateFormat?Ye(a,{format:n.dateFormat}):n.timeFormat?Ye(a,{format:n.timeFormat}):a.toISOString(),i=He({formatDate:o,...r}),s=typeof r.onBigInt=="function";return a=>{if(a==null||typeof a=="symbol"||typeof a=="function")return{str:e,isNumeric:!1};if(typeof a=="bigint"&&!s&&!r.voidBigIntReplacement)return{str:t(a),isNumeric:!0};let l=i.call(null,"",a),u=ie(l);return u==null||typeof u=="symbol"||typeof u=="function"?{str:e,isNumeric:!1}:typeof u=="string"?{str:u,isNumeric:!1}:typeof u=="number"||typeof u=="bigint"?{str:t(u),isNumeric:!0}:typeof u=="boolean"?{str:u?"true":"false",isNumeric:!1}:typeof u=="object"?{str:JSON.stringify(u,He({formatDate:o,...r})),isNumeric:!1}:{str:String(u),isNumeric:!1}}}function Ln(n,e,t={}){let{separator:r=",",quoteChar:o='"',includeHeader:i=!0,lineTerminator:s=`
2
+ `,quoteStyle:a="necessary",includeBom:l=!1,onRow:u,...c}=t,f=Object.keys(n),m=f.length,h=[],p=!0,d=_l(c),g=(_,S=!1)=>{let b,x=!1;if(S)b=String(_);else{let w=d(_);b=w.str,x=w.isNumeric}if(a==="never")return b;if(a==="always"){let w=b.split(o).join(o+o);return o+w+o}if(a==="non_numeric"&&!x&&_!=null){let w=b.split(o).join(o+o);return o+w+o}if(b.includes(r)||b.includes(o)||b.includes(`
3
+ `)||b.includes("\r")){let w=b.split(o).join(o+o);return o+w+o}return b},y=_=>{if(p){let S=l?"\uFEFF"+_:_;u?u(S):h.push(S),p=!1}else u?u(s+_):h.push(_)};if(i){let _=new Array(m);for(let S=0;S<m;S++)_[S]=g(f[S],!0);y(_.join(r))}for(let _=0;_<e;_++){let S=new Array(m);for(let b=0;b<m;b++)S[b]=g(n[f[b]][_],!1);y(S.join(r))}return u?l?"\uFEFF":"":h.join(s)}function _s(n,e={}){let t=e.separator||",",r=e.quoteChar||'"',o=n;o.startsWith("\uFEFF")&&(o=o.substring("\uFEFF".length));let i=[],s=[],a="",l=!1,u=!1,c=!1,f=o.length;for(let m=0;m<f;m++){let h=o[m];if(l)u=!0,c=!1,h===r?m+1<f&&o[m+1]===r?(a+=r,m++):l=!1:a+=h;else if(h===r)u=!0,c=!1,l=!0;else if(h===t)s.push(a),a="",c=!0;else{let p=!1;h==="\r"?(p=!0,m+1<f&&o[m+1]===`
4
4
  `&&m++):h===`
5
- `&&(p=!0),p?(c||i.length>0||a!==""||u)&&(i.push(a),s.push(i),i=[],a="",c=!1,u=!1):(c=!0,u=!1,a+=h)}}return(c||i.length>0||a!==""||u)&&(i.push(a),s.push(i)),s}function To(n,t={}){let e=new Set(t.nullValues??["","NA","null","NaN"]),r=n.length,o=!0,s=!0,i=!0,a=!0,l=!1;for(let u=0;u<r;u++){let f=n[u].trim();if(!e.has(f)){if(l=!0,o){let m=f.toLowerCase();m!=="true"&&m!=="false"&&m!=="1"&&m!=="0"&&(o=!1)}if(i&&vt(f,{truncate:!1})===null&&(i=!1),s&&K(f,{allowNonFiniteNumbers:!0})===null&&(s=!1),a&&G(f)===null&&(a=!1),!o&&!s&&!i&&!a)break}}let c=new Array(r);if(!l||!o&&!s&&!i&&!a){for(let u=0;u<r;u++){let f=n[u];c[u]=e.has(f.trim())?null:f}return{type:qt,values:c}}if(o){for(let u=0;u<r;u++){let f=n[u].trim();if(e.has(f))c[u]=null;else{let m=f.toLowerCase();c[u]=m==="true"||m==="1"}}return{type:ue,values:c}}if(i){for(let u=0;u<r;u++){let f=n[u].trim();c[u]=e.has(f)?null:vt(f,{truncate:!1})}return{type:ae,values:c}}if(s){for(let u=0;u<r;u++){let f=n[u].trim();c[u]=e.has(f)?null:K(f,{allowNonFiniteNumbers:!0})}return{type:le,values:c}}if(a){for(let u=0;u<r;u++){let f=n[u].trim();c[u]=e.has(f)?null:G(f)}return{type:ce,values:c}}return{type:qt,values:c}}var Co=R(()=>{"use strict";Bn();je();Xt();Dt();xt()});function js(n){return n==null?!1:typeof n=="string"||L(n)?!0:Array.isArray(n)}function wo(n){return js(n)?Object.prototype.toString.call(n)==="[object Uint8Array]"?n:typeof n=="string"?new TextEncoder().encode(n):L(n)?new Uint8Array(n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)):new Uint8Array(n):null}var Do=R(()=>{"use strict";te()});var $=R(()=>{"use strict";xt();Xt();Bn();te();Re();je();Co();Do()});function Q(n,t,e,r=""){if(!(n in t))throw new yt(n,`${e} "${n}" does not exist${r}`)}function an(n,t){let e=Object.keys(n),r=e.length,o=t;for(let s=0;s<r;s++){let i=e[s],a=n[i],l=O(a)?a.length:0;if(o===void 0)o=l;else if(l!==o)throw new J(`Column height mismatch: Column "${i}" has length ${l}, but DataFrame height is ${o}`)}return o===void 0?0:o}var Ao=R(()=>{"use strict";rt();$()});var Ft,V,yt,Wt,at,J,rt=R(()=>{"use strict";Ao();Ft=class extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},V=class extends Ft{},yt=class extends V{constructor(t,e){super(e||`Column "${t}" does not exist in the DataFrame.`)}},Wt=class extends Ft{},at=class extends Ft{},J=class extends Ft{}});function vs(n,t,e){let r=new Map,o=e.length,s=new Array(o);for(let i=0;i<o;i++){let a=e[i];typeof a=="string"?(Q(a,n,"Partition key"," in the DataFrame."),s[i]=n[a]):s[i]=a.evaluate(n,t)}if(o===1){let i=s[0];for(let a=0;a<t;a++){let l=i[a],c=l==null?"":W(l),u=r.get(c);u===void 0&&(u=[],r.set(c,u)),u.push(a)}return r}for(let i=0;i<t;i++){let a=new Array(o);for(let u=0;u<o;u++){let f=s[u][i];a[u]=f==null?"":W(f)}let l=a.join("\0"),c=r.get(l);c===void 0&&(c=[],r.set(l,c)),c.push(i)}return r}function ar(n,t,e){let r=new Array(e);if(e===0)return r;let o=n.p||[],s=vs(t,e,o),i=n.U(n.T,t,e);for(let a of s.values()){let l=a.length,c=new Array(l);for(let u=0;u<l;u++)c[u]=i[a[u]];if(n.b){for(let u=0;u<l;u++)r[a[u]]=n.b(c,a,u);continue}if(n.m){let u=n.m(c);for(let f=0;f<l;f++)r[a[f]]=u;continue}for(let u=0;u<l;u++)r[a[u]]=i[a[u]]}return n.v(n.T,r,t)}function lr(n){if(!Array.isArray(n)||n.length===0)return{columns:{},height:0};let t=n.length,e=new Set;for(let s=0;s<t;s++){let i=n[s];if(B(i)){let a=Object.keys(i);for(let l=0;l<a.length;l++)e.add(a[l])}}let r=Array.from(e),o={};for(let s=0;s<r.length;s++)o[r[s]]=new Array(t);for(let s=0;s<t;s++){let i=n[s]||{};for(let a=0;a<r.length;a++){let l=r[a],c=i[l];o[l][s]=c===void 0?null:c}}return{columns:o,height:t}}function ur(n,t){let e=Object.keys(n),r=new Array(t);for(let o=0;o<t;o++){let s={};for(let i=0;i<e.length;i++){let a=e[i],l=n[a][o];s[a]=l===void 0?null:l}r[o]=s}return r}function Ls(n,t,e){let r={};for(let o=0;o<e.length;o++){let s=e[o],i=n[s][t];r[s]=i===void 0?null:i}return r}function dt(n){if(n.length===0)return F.Utf8;let t=!0,e=!0,r=!0,o=!0,s=!0,i=!0,a=!0,l=!0,c=!1,u=!1,f=[];for(let m=0;m<n.length;m++){let h=n[m];if(h!=null){if(u=!0,h instanceof Uint8Array||(a=!1),!O(h)||h instanceof Uint8Array)i=!1;else{let p=h,y=p.length;for(let d=0;d<y;d++)f.push(p[d])}M(h)&&(c=!0),typeof h!="boolean"&&(t=!1),typeof h!="bigint"&&(o=!1),typeof h!="number"?(r=!1,e=!1):Number.isInteger(h)||(e=!1),!M(h)&&(typeof h!="string"||isNaN(Date.parse(h)))&&(s=!1),(!B(h)||h instanceof Uint8Array)&&(l=!1)}}if(!u)return F.Utf8;if(a)return F.Binary;if(i){let m=dt(f);return F.Array(m)}if(t)return F.Boolean;if(o)return F.Int64;if(r&&!e)return F.Float64;if(r&&e){let m=!0;for(let h=0;h<n.length;h++){let p=n[h];if(p!=null&&(p<-2147483648||p>2147483647)){m=!1;break}}return m?F.Int32:F.Float64}return s&&c?F.Datetime:l?F.Object:F.Utf8}function Gt(n,t){let e=Object.keys(n),r=e.length,o=t.length,s={};for(let i=0;i<r;i++){let a=e[i],l=n[a],c=L(l)?new l.constructor(o):new Array(o);for(let u=0;u<o;u++)c[u]=l[t[u]];s[a]=c}return s}function Mt(n,t,e){let r=t.length;if(r===1){let s=n[t[0]][e];return s==null?"":W(s)}let o=new Array(r);for(let s=0;s<r;s++){let i=n[t[s]][e];o[s]=i==null?"":W(i)}return o.join("\0")}function At(n,t,e){let r=t.allocate?t.allocate(e):new Array(e);if(L(r)){let s=r;for(let i=0;i<e;i++){let a=t.coerce(n[i]);if(a==null){let l=new Array(e);for(let c=0;c<i;c++)l[c]=s[c];l[i]=null;for(let c=i+1;c<e;c++)l[c]=t.coerce(n[c]);return l}s[i]=a}}else for(let s=0;s<e;s++)r[s]=t.coerce(n[s]);return r}function cr(n,t){if(n)if(typeof n=="string"){if(typeof require!="function")throw new Error("File writing is not supported in this environment (missing require('fs')).");require("fs").writeFileSync(n,t,"utf8")}else if(B(n)&&typeof n.write=="function")n.write(t);else throw new TypeError("Invalid file argument. Expected a file path string or a writable stream/object with a write method.")}var ln=R(()=>{"use strict";Dt();$();rt()});function Ot(n,t,e){return n.P?ar(n,t,e):n.evaluate(t,e)}var A,U,gt=R(()=>{"use strict";$();ln();A=n=>t=>{let e=t.length,r=new Array(e);for(let o=0;o<e;o++){let s=t[o];r[o]=s==null?null:n(s)}return r},U=(n,t,e)=>(r,o)=>{let s=r.length,i=n.y(t,o,s),a=new Array(s);if(O(i))for(let l=0;l<s;l++){let c=r[l],u=i[l];a[l]=c==null||u==null?null:e(c,u)}else for(let l=0;l<s;l++){let c=r[l];a[l]=c==null||i==null?null:e(c,i)}return a}});var x,j,ot=R(()=>{"use strict";rt();gt();x=(n,t)=>{let e=n.constructor,r=n.C||n.u||"",o=new e(r);return Object.assign(o,n),o.c=t?[...n.c,t]:[...n.c],o},j=class n{c=[];f="";N;L;m=null;d;T;p=null;b;v(t,e,r){let o=this.c,s=t!==void 0?t:o.length,i=e;for(let a=s;a<o.length;a++)i=o[a](i,r);return i}U(t,e,r){let o=this.Y(e,r),s=this.c,i=t!==void 0?t:s.length;for(let a=0;a<i;a++)o=s[a](o,e);return o}Y(t,e){let r=this.u;if(r&&r!=="*"&&!r.startsWith("*")&&!(r in t))throw new yt(r);return(r&&r!=="*"?t[r]:null)||new Array(e).fill(null)}y(t,e,r){return t instanceof n?t.N&&t.c.length===1?t.L:Ot(t,e,r):t}alias(t){let e=x(this);return e.f=t,e}cast(t){return x(this,e=>{let r=e.length,o=new Array(r);for(let s=0;s<r;s++)o[s]=t.coerce(e[s]);return o})}debug(t){return x(this,e=>(console.log(`[DEBUG] ${t?t+": ":""}`,e),e))}evaluate(t,e){return this.U(void 0,t,e)}}});var fe,Oo=R(()=>{"use strict";ot();gt();$();fe=class extends j{abs(){return x(this,A(Math.abs))}acos(){return x(this,A(t=>t<-1||t>1?null:Math.acos(t)))}acosh(){return x(this,A(t=>t<1?null:Math.acosh(t)))}add(t){return x(this,U(this,t,(e,r)=>e+r))}asin(){return x(this,A(t=>t<-1||t>1?null:Math.asin(t)))}asinh(){return x(this,A(Math.asinh))}atan(){return x(this,A(Math.atan))}atan2(t){return x(this,U(this,t,Math.atan2))}atanh(){return x(this,A(t=>t<=-1||t>=1?null:Math.atanh(t)))}cbrt(){return x(this,A(Math.cbrt))}ceil(){return x(this,A(Math.ceil))}clip(t=null,e=null){return x(this,A(r=>ct(r,{min:t,max:e})))}copysign(t){return x(this,U(this,t,(e,r)=>Math.abs(e)*(r>=0?1:-1)))}cos(){return x(this,A(Math.cos))}cosh(){return x(this,A(Math.cosh))}degrees(){return x(this,A(t=>t*(180/Math.PI)))}div(t){return x(this,U(this,t,(e,r)=>r===0?null:e/r))}exp(){return x(this,A(Math.exp))}expm1(){return x(this,A(Math.expm1))}floor(){return x(this,A(Math.floor))}floordiv(t){return x(this,U(this,t,(e,r)=>r===0?null:Math.floor(e/r)))}hypot(t){return x(this,U(this,t,Math.hypot))}log(t=Math.E){return x(this,A(e=>e<=0?null:t===Math.E?Math.log(e):Math.log(e)/Math.log(t)))}log1p(){return x(this,A(t=>t<=-1?null:Math.log1p(t)))}mod(t){return x(this,U(this,t,(e,r)=>r===0?null:e%r))}mul(t){return x(this,U(this,t,(e,r)=>e*r))}negate(){return x(this,A(t=>-t))}pow(t){return x(this,U(this,t,Math.pow))}radians(){return x(this,A(t=>t*(Math.PI/180)))}rand(t,{min:e=0,max:r=1,integer:o=!1}={}){return x(this,s=>{let i=s.length,a=new Float64Array(i),l=t!==void 0?Gr(t):Math.random,c=r-e;for(let u=0;u<i;u++){let f=l();a[u]=o?Math.floor(f*(c+1))+e:f*c+e}return a})}round(t=0){return x(this,A(e=>In(e,t)))}ft(t){return x(this,A(e=>z(e)?Number(e.toPrecision(t)):e))}sign(){return x(this,A(Math.sign))}sin(){return x(this,A(Math.sin))}sinh(){return x(this,A(Math.sinh))}sqrt(){return x(this,A(t=>t<0?null:Math.sqrt(t)))}sub(t){return x(this,U(this,t,(e,r)=>e-r))}tan(){return x(this,A(Math.tan))}tanh(){return x(this,A(Math.tanh))}trunc(){return x(this,A(Math.trunc))}}});var me,ko=R(()=>{"use strict";ot();gt();$();me=class extends j{and(t){return x(this,(e,r)=>{let o=e.length,s=this.y(t,r,o),i=O(s),a=new Array(o);for(let l=0;l<o;l++){let c=e[l],u=i?s[l]:s;c===!1||u===!1?a[l]=!1:c==null||u==null?a[l]=null:a[l]=!0}return a})}not(){return x(this,A(t=>!t))}or(t){return x(this,(e,r)=>{let o=e.length,s=this.y(t,r,o),i=O(s),a=new Array(o);for(let l=0;l<o;l++){let c=e[l],u=i?s[l]:s;c===!0||u===!0?a[l]=!0:c==null||u==null?a[l]=null:a[l]=!1}return a})}xor(t){return x(this,U(this,t,(e,r)=>!!e!=!!r))}}});function Io(n,t,e,r){let o=n.length,s=new Array(o);if(e&&typeof e=="object"&&"evaluate"in e){let i=e.evaluate(t,o);for(let a=0;a<o;a++){let l=n[a];if(l==null)s[a]=null;else{let c=i[a],u=new Set;if(O(c)){let m=c.length;for(let h=0;h<m;h++)u.add(W(c[h]))}else u.add(W(c));let f=u.has(W(l));s[a]=r?!f:f}}}else{let i=O(e)?e:[],a=new Set,l=i.length;for(let c=0;c<l;c++)a.add(W(i[c]));for(let c=0;c<o;c++){let u=n[c];if(u==null)s[c]=null;else{let f=a.has(W(u));s[c]=r?!f:f}}}return s}function Eo(n,t){let{frequencies:e}=wt(n,{strict:!0}),r=n.length,o=new Array(r);for(let s=0;s<r;s++){let i=e.get(n[s])||0;o[s]=t?i>1:i===1}return o}function Ro(n,t,e){let r=n.length,o=new Array(r);if(O(t))for(let s=0;s<r;s++){let i=n[s],a=t[s];i==null&&a==null?o[s]=!e:i==null||a==null?o[s]=e:o[s]=e?i!==a:i===a}else for(let s=0;s<r;s++){let i=n[s];i==null&&t==null?o[s]=!e:i==null||t==null?o[s]=e:o[s]=e?i!==t:i===t}return o}var pe,Uo=R(()=>{"use strict";ot();gt();$();pe=class extends j{between(t,e,r="both"){return x(this,(o,s)=>{let i=o.length,a=this.y(t,s,i),l=this.y(e,s,i),c=new Array(i),u=O(a),f=O(l);for(let m=0;m<i;m++){let h=o[m],p=u?a[m]:a,y=f?l[m]:l;if(h==null||p==null||y==null)c[m]=null;else{let d=r==="both"||r==="left"?h>=p:h>p,g=r==="both"||r==="right"?h<=y:h<y;c[m]=d&&g}}return c})}eq(t){return x(this,U(this,t,(e,r)=>e===r))}mt(t){return x(this,(e,r)=>{let o=this.y(t,r,e.length);return Ro(e,o,!1)})}ge(t){return x(this,U(this,t,(e,r)=>e>=r))}gt(t){return x(this,U(this,t,(e,r)=>e>r))}pt(){return this.l(t=>{for(let e=0;e<t.length;e++)if(t[e]==null)return!0;return!1})}ht(t,{yt:e=1e-8,bt:r=1e-8,xt:o=!1}={}){return x(this,(s,i)=>{let a=s.length,l=this.y(t,i,a),c=O(l),u=new Array(a);for(let f=0;f<a;f++){let m=s[f],h=c?l[f]:l;if(m==null||h==null)u[f]=null;else if(z(m)&&z(h)){let p=Math.abs(m-h),y=Math.max(r*Math.max(Math.abs(m),Math.abs(h)),e);u[f]=p<=y}else Number.isNaN(m)&&Number.isNaN(h)?u[f]=o:u[f]=m===h}return u})}wt(){return x(this,t=>Eo(t,!0))}St({ignoreNulls:t=!1}={}){return x(this,A(e=>typeof e=="string"?e.length===0:O(e)?t?H(e,"nullish",{mode:"every"}):e.length===0:null))}Tt(){return x(this,A(Number.isFinite))}Ct(t){return x(this,(e,r)=>Io(e,r,t,!1))}Dt(){return x(this,A(t=>t===1/0||t===-1/0))}At(){return x(this,A(Number.isNaN))}Ot(){return x(this,A(t=>!Number.isNaN(t)))}B(){return x(this,t=>{let e=t.length,r=new Array(e);for(let o=0;o<e;o++)r[o]=t[o]!=null;return r})}kt(){return x(this,t=>{let e=t.length,r=new Array(e);for(let o=0;o<e;o++)r[o]=t[o]==null;return r})}Et(){return x(this,t=>Eo(t,!1))}le(t){return x(this,U(this,t,(e,r)=>e<=r))}lt(t){return x(this,U(this,t,(e,r)=>e<r))}ne(t){return x(this,U(this,t,(e,r)=>e!==r))}It(t){return x(this,(e,r)=>{let o=this.y(t,r,e.length);return Ro(e,o,!0)})}Rt(t){return x(this,(e,r)=>Io(e,r,t,!0))}}});var un,he,Fo=R(()=>{"use strict";ot();gt();$();un=class{constructor(t){this.expr=t}expr;r(t){return x(this.expr,A(e=>t(String(e))))}O(t,e){return t==null?x(this.expr,r=>new Array(r.length).fill(null)):e()}concat(t){return x(this.expr,U(this.expr,t,(e,r)=>String(e)+String(r)))}contains(t){return this.O(t,()=>this.r(e=>bt(t)?t.test(e):e.includes(t)))}X(t){return this.O(t,()=>this.r(e=>{if(bt(t)){let r=t.global?t:new RegExp(t.source,t.flags+"g"),o=e.match(r);return o?o.length:0}else{let r=0,o=e.indexOf(t);for(;o!==-1;)r++,o=e.indexOf(t,o+t.length);return r}}))}Ft(){return this.r(t=>{try{return decodeURIComponent(t)}catch{return t}})}Ut(){return this.r(t=>{try{return encodeURIComponent(t)}catch{return t}})}Nt(t){return this.r(e=>e.endsWith(t))}explode(){return this.r(t=>t.split(""))}extract(t,e=0){return this.O(t,()=>this.r(r=>{let o=r.match(t);return o&&o[e]!==void 0?o[e]:null}))}len(){return this.Z()}Mt(){return this.r(t=>new TextEncoder().encode(t).length)}Z(){return this.r(t=>t.length)}lower(){return this.r(t=>t.toLowerCase())}lpad(t,e=" "){return this.r(r=>r.padStart(t,e))}jt(t,e=" "){return this.rpad(t,e)}_t(t,e=" "){return this.lpad(t,e)}replace(t,e){return this.O(t,()=>this.r(r=>r.replace(t,e)))}vt(t,e){return this.O(t,()=>this.r(r=>r.replaceAll(t,e)))}reverse(){return this.r(t=>t.split("").reverse().join(""))}rpad(t,e=" "){return this.r(r=>r.padEnd(t,e))}slice(t,e){return this.r(r=>{let o=t<0?r.length+t:t,s=e!==void 0?o+e:void 0;return r.slice(o,s)})}split(t){return this.r(e=>e.split(t))}Lt(t){return this.r(e=>e.startsWith(t))}Q(t,e){return this.r(r=>Pt(r,t,{mode:"both",...e}))}tt(t,e){return this.r(r=>Pt(r,t,{mode:"end",...e}))}et(t,e){return this.r(r=>Pt(r,t,{mode:"start",...e}))}Vt(t){return this.r(e=>Pt(e,t,{mode:"start",maxScanStart:1,maxMatchesStart:1,returnStringOnNull:!0,stringOptions:{literal:!0}}))}Pt(t){return this.r(e=>Pt(e,t,{mode:"end",maxScanEnd:1,maxMatchesEnd:1,returnStringOnNull:!0,stringOptions:{literal:!0}}))}strptime(t){return this.r(e=>go(e,t))}Bt(){return this.r(t=>ee(t,{format:"camel"}))}$t(){return this.r(t=>G(t,{dateOnly:!0}))}Kt(){return this.r(G)}qt(t,e){return this.r(r=>Oe(r,{precision:t,scale:e}))}Jt(){return this.r(t=>pt(t))}Wt(){return this.r(t=>ee(t,{format:"kebab"}))}Gt(){return this.lower()}zt(){return this.r(t=>ee(t,{format:"pascal"}))}Ht(){return this.r(t=>ee(t,{format:"snake"}))}Yt(){return this.r(Me)}Xt(){return this.r(t=>t.replace(/\b\w/g,e=>e.toUpperCase()))}Zt(){return this.upper()}trim(){return this.Q()}Qt(){return this.tt()}te(){return this.et()}upper(){return this.r(t=>t.toUpperCase())}zfill(t){return this.r(e=>e.padStart(t,"0"))}},he=class extends j{get str(){return new un(this)}}});var ye,Mo=R(()=>{"use strict";ot();gt();rt();$();ye=class extends j{l(t){let e=x(this);return e.m=t,e.d=this.c.length,e.T=this.c.length,e}k(t,e){return x(this,U(this,t,(r,o)=>[r,o])).l(e)}all(){return this.l(t=>H(t,e=>!!e,{mode:"every"}))}ee(){return this.l(t=>H(t,"nullish",{mode:"every"}))}any(){return this.l(t=>H(t,e=>!!e,{mode:"some"}))}re(){return this.l(t=>H(t,"nullish",{mode:"some"}))}avg(){return this.l(t=>N(t).mean)}corr(t){return this.k(t,e=>En(e)?.correlation??null)}count(t={}){return t.includeNulls?this.l(e=>e.length):this.l(e=>N(e).count)}cov(t){return this.k(t,e=>En(e)?.covariance??null)}dot(t){return this.k(t,e=>eo(e))}first(){return this.l(t=>t[0]??null)}implode(){return this.l(t=>t)}last(){return this.l(t=>t[t.length-1]??null)}max(){return this.l(t=>N(t).max)}mean(){return this.avg()}median(){return this.l(t=>Vt(t))}min(){return this.l(t=>N(t).min)}mode(){return this.l(t=>Ee(t))}nt(t={}){return this.l(e=>wt(e,t).count)}oe(){return this.l(t=>N(t).nullCount)}quantile(t){if(t<0||t>1)throw new at("Quantile q must be between 0 and 1");return this.l(e=>Ie(e,t))}se(t){return this.k(t,e=>to(e))}std(){return this.l(t=>N(t).std)}sum(){return this.l(t=>N(t).sum)}ie(t){return this.k(t,e=>no(e))}}});function fr(n,t,e={}){if(t==null)return null;let r=e.dense?"_denseRankCache":"_rankCache",o=n[r];if(!o){let s=n;if(e.ignoreNulls){s=[];let l=n.length;for(let c=0;c<l;c++)n[c]!=null&&s.push(n[c])}e.dense&&(s=Array.from(new Set(s)));let i=Qt(s);o=new Map;let a=i.length;for(let l=0;l<a;l++){let c=i[l];o.has(c)||o.set(c,l+1)}n[r]=o}return o.get(t)??null}var de,No=R(()=>{"use strict";ot();$();de=class extends j{p=this.p||null;x(t){let e=x(this);return e.T=this.c.length,e.d=this.c.length,e.b=t,e}g(t,e){return this.x(function(r,o,s){let i=Math.max(0,s-t+1),a=s+1,l=r.slice(i,a);return e(l)})}I(t,e,r,o){return this.x(function(s,i,a){let l=e,c=!1,u=t?a:0,f=t?s.length-1:a;for(let m=u;m<=f;m++){let h=s[m];h!=null&&(l=r(l,h),c=!0)}return o?o(l,c):l})}get P(){return this.p!==null||this.b!==void 0||this.m!==null}ae(t=!1){return this.I(t,0,e=>e+1)}ue(t=!1){return this.I(t,null,(e,r)=>e===null||r>e?r:e)}ce(t=!1){return this.I(t,null,(e,r)=>e===null||r<e?r:e)}fe(t=!1){return this.I(t,1,(e,r)=>e*r,(e,r)=>r?e:null)}me(t=!1){return this.I(t,0,(e,r)=>e+r)}pe(){return this.x(function(t,e,r){return fr(t,t[r],{dense:!0})})}lag(t=1,e=null){return this.x(function(r,o,s){let i=e;return s-t>=0&&(i=r[s-t]),i})}lead(t=1,e=null){return this.x(function(r,o,s){let i=e;return s+t<r.length&&(i=r[s+t]),i})}over(t){let e=x(this),r=Array.isArray(t)?t:[t];return e.p=r,e}rank(){return this.x(function(t,e,r){return fr(t,t[r])})}he(t){return this.g(t,e=>N(e).max)}ye(t){return this.g(t,e=>N(e).mean)}de(t){return this.g(t,e=>Vt(e))}be(t){return this.g(t,e=>N(e).min)}xe(t,e){return this.g(e,r=>Ie(r,t))}we(t){return this.g(t,e=>fr(e,e[e.length-1],{ignoreNulls:!0}))}Se(t){return this.g(t,e=>N(e).std)}Te(t){return this.g(t,e=>N(e).sum)}Ce(){let t=this.x(function(e,r,o){return o+1});return t.f="row_number",t}}});var cn,ge,jo=R(()=>{"use strict";ot();gt();$();cn=class{constructor(t){this.expr=t}expr;i(t){return x(this.expr,A(e=>{let r=G(e);return r?t(r):null}))}w(t){return x(this.expr,A(e=>typeof e=="number"?t(e):null))}century(){return this.i(mo)}date(){return this.i(t=>new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())))}day(){return this.i(t=>t.getUTCDate())}De(){return this.i(t=>{let e=Ne(t,1,0);return e?e.getUTCDate():null})}epoch(t="ms"){return this.i(e=>fo(e,t))}hour(){return this.i(t=>t.getUTCHours())}Ae(t={}){return this.i(e=>bo(e,t))}Oe(){return this.i(vn)}rt(){return this.i(t=>jn(t,{field:"week"}))}ke(){return this.i(t=>jn(t,{field:"year"}))}microsecond(){return this.i(t=>t.getUTCMilliseconds()*1e3)}millennium(){return this.i(po)}millisecond(){return this.i(t=>t.getUTCMilliseconds())}minute(){return this.i(t=>t.getUTCMinutes())}month(){return this.i(t=>t.getUTCMonth()+1)}Ee(){return this.i(t=>Ne(t,1,0))}Ie(){return this.i(t=>Ne(t,0,1))}nanosecond(){return this.i(t=>t.getUTCMilliseconds()*1e6)}Re(t,{excludeWeekdays:e=[0,6],...r}={}){let o={excludeWeekdays:e,...r};return x(this.expr,U(this.expr,t,(s,i)=>{let a=G(s);return a?Vn(a,i,o):null}))}Fe(t,e={}){return x(this.expr,U(this.expr,t,(r,o)=>{let s=G(r);return s?Vn(s,o,e):null}))}Ue(){return this.i(_n)}quarter(){return this.i(ho)}second(){return this.i(t=>t.getUTCSeconds())}strftime(t){return this.i(e=>Rt(e,t))}time(){return this.i(t=>t.toISOString().split("T")[1].slice(0,12))}timestamp(t="ms"){return this.epoch(t)}Ne(t){return this.strftime(t)}Me(){return this.w(t=>t/864e5)}je(){return this.w(t=>t/36e5)}_e(){return this.w(t=>t*1e3)}ve(){return this.w(t=>t)}Le(){return this.w(t=>t/6e4)}Ve(){return this.w(t=>t*1e6)}Pe(){return this.w(t=>t/1e3)}Be(t,e={}){return x(this.expr,A(r=>{let o=G(r);return o?Pn(o,t,e):null}))}week(){return this.rt()}weekday(){return this.i(t=>t.getUTCDay()||7)}year(){return this.i(t=>t.getUTCFullYear())}},ge=class extends j{get dt(){return new cn(this)}}});var fn,be,_o=R(()=>{"use strict";ot();gt();$();_t();fn=class{constructor(t){this.expr=t}expr;s(t){return x(this.expr,A(e=>O(e)?t(e):null))}all(){return this.s(t=>H(t,e=>!!e,{mode:"every"}))}any(){return this.s(t=>H(t,e=>!!e,{mode:"some"}))}contains(t){return this.s(e=>e.includes(t))}$e(t){return this.s(e=>H(t,r=>e.includes(r),{mode:"every"}))}Ke(t){return this.s(e=>H(t,r=>e.includes(r),{mode:"some"}))}X(t,e={}){return this.s(r=>wt(r,e).frequencies.get(t)??0)}filter(t){return x(this.expr,(e,r)=>{let o=e.length,s=new Array(o),i=Object.create(r);for(let a=0;a<o;a++){let l=e[a];if(!O(l)){s[a]=null;continue}let c=l.length;i[jt]=l;let u=Ot(t,i,c),f=[];if(O(u)){let m=Math.min(c,u.length);for(let h=0;h<m;h++)u[h]&&f.push(l[h])}else if(u)for(let m=0;m<c;m++)f.push(l[m]);s[a]=f}return s})}explode({qe:t=!0,Je:e=!0}={}){return x(this.expr,r=>{let o=r.length,s=0;for(let c=0;c<o;c++){let u=r[c];if(O(u)){s+=u.length||(t?1:0);continue}if(u!=null){s+=1;continue}e&&(s+=1)}let i=new Array(s),a=new Int32Array(s),l=0;for(let c=0;c<o;c++){let u=r[c];if(O(u)){let f=u.length;if(f>0){for(let m=0;m<f;m++)a[l]=c,i[l++]=u[m];continue}t&&(a[l]=c,i[l++]=null);continue}if(u!=null){a[l]=c,i[l++]=u;continue}e&&(a[l]=c,i[l++]=null)}return i.rowMap=a,i})}first(t=!0){return this.get(0,t)}gather(t,e=!0){return this.s(r=>{let o=typeof t=="number"?[t]:t,s=o.length,i=new Array(s);for(let a=0;a<s;a++)i[a]=ke(r,o[a],e);return i})}We(t={}){return this.s(e=>Yr(e,t))}get(t,e=!0){return this.s(r=>ke(r,t,e))}join(t=",",e={}){return this.s(r=>Xr(r,t,e))}last(t=!0){return this.get(-1,t)}len(){return this.lengths()}lengths(){return this.s(t=>t.length)}max(){return this.s(t=>N(t).max)}Ge(){return this.s(t=>N(t).maxIdx)}mean(){return this.s(t=>N(t).mean)}median(){return this.s(t=>Vt(t))}min(){return this.s(t=>N(t).min)}ze(){return this.s(t=>N(t).minIdx)}mode(){return this.s(t=>Ee(t))}nt(t={}){return this.s(e=>wt(e,t).count)}reverse(){return this.s(t=>t.slice().reverse())}shift(t=1){return this.s(e=>Qr(e,t))}slice(t,e){return this.s(r=>r.slice(t,e))}splice(t,e,...r){return this.s(o=>{let s=[...o];return s.splice(t,e??s.length,...r),s})}sort(t){return this.s(e=>Qt(e,t))}std(){return this.s(t=>N(t).std)}sum(){return this.s(t=>N(t).sum)}He({Ye:t,fields:e}={}){return x(this.expr,r=>{let o=r.length,s=new Array(o),i=0;if(Array.isArray(e))i=e.length;else if(typeof t=="number")i=t;else for(let l=0;l<o;l++){let c=r[l];O(c)&&c.length>i&&(i=c.length)}if(i===0)throw new Error("to_struct cannot be evaluated: struct width is 0. Provide an upper_bound, non-empty fields names, or non-empty lists.");let a=new Array(i);for(let l=0;l<i;l++)typeof e=="function"?a[l]=e(l):a[l]=(Array.isArray(e)?e[l]:null)??`field_${l}`;for(let l=0;l<o;l++){let c=r[l];if(!O(c)){s[l]=null;continue}let u={};for(let f=0;f<i;f++)u[a[f]]=ke(c,f,!0);s[l]=u}return s})}unique(t={}){return this.s(e=>wt(e,t).values)}variance(){return this.s(t=>N(t).variance)}eval(t){return x(this.expr,(e,r)=>{let o=e.length,s=new Array(o);for(let i=0;i<o;i++){let a=e[i];if(!O(a)){s[i]=null;continue}let l=a.length,c={...r,[jt]:a};if(t.m!=null&&(t.p==null||t.p.length===0)){let f=t.d!==void 0?t.d:t.c.length,m=t.U(f,c,l),h=t.m(Array.from(m));s[i]=t.v(f,[h],c)}else s[i]=Ot(t,c,l)}return s})}},be=class extends j{get arr(){return new fn(this)}}});var mn,vo=R(()=>{"use strict";ot();$();mn=class extends j{$({value:t=void 0,strategy:e=void 0,limit:r=void 0}={}){return x(this,(o,s)=>{let i=o.length,a=Array.from(o);if(e!==void 0)if(e==="zero"||e==="one"||e==="min"||e==="max"||e==="mean"){let l;e==="zero"?l=0:e==="one"?l=1:l=N(o)[e],Et(a,l,{mode:"constant",condition:c=>c==null})}else if(e==="forward"||e==="backward"){let l=e==="forward",c=null,u=0;Et(a,null,{mode:"independent",reverse:!l,step:({originalValue:f})=>f!=null?(c=f,u=0,f):c!==null&&(r===void 0||u<r)?(u++,c):null})}else throw new Error(`Unsupported fill_null strategy: "${e}"`);else{let l=this.y(t,s,i),c=O(l);Et(a,null,{mode:"independent",step:({index:u,originalValue:f})=>f??(c?l[u]:l)})}return a})}reverse(){return x(this,t=>t.slice().reverse())}}});var Lo={};wr(Lo,{ColumnExpr:()=>k,resolveColumnSelectors:()=>kt});function Bs(n,t){for(let e of t)for(let r of Object.getOwnPropertyNames(e.prototype))r!=="constructor"&&Object.defineProperty(n.prototype,r,Object.getOwnPropertyDescriptor(e.prototype,r)||Object.create(null))}function $s(n,t,e,r){if(!(n instanceof k)){if(B(n)&&"evaluate"in n&&!n.u){let o=[];for(let s=0;s<t.length;s++)e.has(t[s])||o.push(t[s]);return o}return null}if(n.C&&n.C.length>0)return n.C;if(n.u==="*"){let o=new Set(n.K),s=[];for(let i=0;i<t.length;i++){let a=t[i];!o.has(a)&&!e.has(a)&&s.push(a)}return s}if(n.M||n.D&&n.D.length>0){if(!r)throw new Error("Cannot resolve DataType column selector without DataFrame schema.");let o=[];for(let s=0;s<t.length;s++){let i=t[s];if(e.has(i))continue;let a=r[i];if(a){if(n.M)a.matches(n.M)&&o.push(i);else if(n.D){for(let l=0;l<n.D.length;l++)if(a.matches(n.D[l])){o.push(i);break}}}}return o}return null}function kt(n,t,e,r,o){let s=[],i=e?new Set(e):new Set;for(let a=0;a<n.length;a++){let l=n[a];if(typeof l=="string"){s.push(new k(l));continue}if(B(l)&&l.isUnnest){let u=[],f=l.u;if(typeof f=="string"&&r&&r[f]&&r[f].name==="Struct"&&(u=Object.keys(r[f].fields)),u.length===0&&o){let p=Object.keys(o)[0],y=p?o[p].length:0,d=l.baseExpr.evaluate(o,y),g=d.length;for(let b=0;b<g;b++){let S=d[b];if(S!=null&&typeof S=="object"){u=Object.keys(S);break}}}let m=u.length;if(m>0){for(let h=0;h<m;h++){let p=u[h],y=l.baseExpr.struct.field(p);s.push(y)}continue}}let c=$s(l,t,i,r);if(c!==null)for(let u=0;u<c.length;u++){let f=new k(c[u]);f.c=[...l.c||[]],f.m=l.m,f.T=l.T,f.d=l.d,f.p=l.p,l.b&&(f.b=l.b),l.f&&l.f!=="*"&&(f.f=l.f),s.push(f)}else s.push(l)}return s}var k,ft=R(()=>{"use strict";ot();Oo();Uo();Mo();No();Fo();ko();jo();_o();Vo();vo();$();Dt();k=class n extends j{u="";C;K=[];M;D;static isColExpr(t){if(!B(t))return!1;try{return"evaluate"in t&&typeof t.evaluate=="function"}catch{return!1}}static toColExpr(t){if(t==null)throw new Error("Column reference cannot be null or undefined.");return n.isColExpr(t)?t:new n(t)}constructor(t){super(),Array.isArray(t)?t.some(r=>r instanceof Z||typeof r=="function")?this.D=t:this.C=t.map(String):t instanceof Z||typeof t=="function"?this.M=t:(this.u=String(t),this.f=this.u)}};Bs(k,[fe,pe,ye,de,he,me,ge,be,xe,mn])});function Po(n){if(n==null)throw new Error("Column reference cannot be null or undefined.");return pn||(pn=(ft(),Sr(Lo)).ColumnExpr),pn.isColExpr(n)?n:new pn(n)}var pn,hn,xe,Vo=R(()=>{"use strict";ot();pn=null;hn=class{constructor(t){this.expr=t;return new Proxy(this,{get(e,r,o){return r in e?Reflect.get(e,r,o):typeof r=="string"?e.field(r):Reflect.get(e,r,o)}})}expr;field(t){return x(this.expr,e=>{let r=e.length,o=new Array(r);for(let s=0;s<r;s++){let i=e[s];o[s]=i!=null&&typeof i=="object"?i[t]:null}return o}).alias(t)}Xe(t){return x(this.expr,e=>{let r=e.length,o=new Array(r),s=Object.keys(t),i=s.length;for(let a=0;a<r;a++){let l=e[a];if(l==null||typeof l!="object"){o[a]=null;continue}let c={},u=Object.keys(l),f=u.length;for(let m=0;m<f;m++){let h=u[m];c[h]=l[h]}for(let m=0;m<i;m++){let h=s[m];if(h in c){let p=t[h];c[p]=c[h],delete c[h]}}o[a]=c}return o})}ot(t){return x(this.expr,(e,r)=>{let o=e.length,s=new Array(o),i=[];if(Array.isArray(t)){let c=t.length;for(let u=0;u<c;u++){let f=t[u],m=Po(f),h=m.f||m.u;if(!h)throw new Error("Expressions passed to struct.with_fields must have a name/alias.");i.push({name:h,expr:m})}}else if(t&&typeof t=="object"){let c=Object.keys(t),u=c.length;for(let f=0;f<u;f++){let m=c[f],h=Po(t[m]);i.push({name:m,expr:h})}}let a=i.length,l=new Array(a);for(let c=0;c<a;c++)l[c]=i[c].expr.evaluate(r,o);for(let c=0;c<o;c++){let u=e[c];if(u==null||typeof u!="object"){s[c]=null;continue}let f={},m=Object.keys(u),h=m.length;for(let p=0;p<h;p++){let y=m[p];f[y]=u[y]}for(let p=0;p<a;p++)f[i[p].name]=l[p][c];s[c]=f}return s})}unnest(){let t=x(this.expr);return t.isUnnest=!0,t.baseExpr=this.expr,t}},xe=class extends j{get struct(){return new hn(this)}}});var Gs={};wr(Gs,{$df:()=>Ws,ALL_COLUMNS_MARKER:()=>et,AggregationExpr:()=>ye,ArithmeticExpr:()=>fe,Array:()=>rr,ArrayDataType:()=>rr,ArrayExpr:()=>be,ArrayExprNamespace:()=>fn,ArrayType:()=>nn,Binary:()=>Xn,BinaryType:()=>Je,Boolean:()=>ue,BooleanDataType:()=>ue,BooleanType:()=>ze,COALESCE_MARKER:()=>Sn,ColumnExpr:()=>k,ColumnNotFoundError:()=>yt,ComparisonExpr:()=>pe,ComputeError:()=>at,DFScriptError:()=>Ft,DataFrame:()=>_,DataFrameError:()=>V,DataType:()=>Z,DataTypeRegistry:()=>F,Date:()=>tr,DateDataType:()=>tr,DateTimeExprNamespace:()=>cn,DateType:()=>Ze,Datetime:()=>ce,DatetimeType:()=>Qe,DecimalType:()=>ie,Duration:()=>nr,DurationType:()=>en,ELEMENT_MARKER:()=>jt,ExprBase:()=>j,Float32:()=>Yn,Float32Type:()=>We,Float64:()=>le,Float64Type:()=>Ge,FloatDataType:()=>$t,GroupedData:()=>Te,Int16:()=>qn,Int16Type:()=>Le,Int32:()=>Wn,Int32Type:()=>Ve,Int64:()=>ae,Int64Type:()=>Pe,Int8:()=>Kn,Int8Type:()=>ve,IntegerDataType:()=>se,LITERAL_MARKER:()=>wn,LogicalExpr:()=>me,NestedDataType:()=>Kt,Null:()=>Zn,NullType:()=>Ye,NumericDataType:()=>Ut,Object:()=>Qn,ObjectDataType:()=>Qn,ObjectType:()=>Xe,STRUCT_MARKER:()=>Tn,SchemaError:()=>Wt,ShapeError:()=>J,SignedIntegerType:()=>St,StringExpr:()=>he,StringExprNamespace:()=>un,Struct:()=>or,StructExpr:()=>xe,StructExprNamespace:()=>hn,StructType:()=>rn,TemporalDataType:()=>Ct,TemporalExpr:()=>ge,Time:()=>er,TimeType:()=>tn,UInt16:()=>zn,UInt16Type:()=>$e,UInt32:()=>Hn,UInt32Type:()=>Ke,UInt64:()=>Jn,UInt64Type:()=>qe,UInt8:()=>Gn,UInt8Type:()=>Be,UnsignedIntegerType:()=>Tt,Utf8:()=>qt,Utf8Type:()=>He,When:()=>dn,WhenThen:()=>Se,WhenThenChain:()=>yn,WindowExpr:()=>de,all:()=>zt,assertColumnExists:()=>Q,assertHeight:()=>an,coalesce:()=>pr,coerceColumn:()=>At,columnsToRows:()=>ur,computeRowHash:()=>Mt,concat:()=>Ht,derive:()=>x,element:()=>dr,evaluateExpression:()=>Ot,exclude:()=>mr,gatherColumnsByIndices:()=>Gt,getRowFromColumns:()=>Ls,implode:()=>yr,inferColumnType:()=>dt,kleeneBinary:()=>U,kleeneUnary:()=>A,lit:()=>we,read_csv:()=>bn,read_json:()=>gn,resolveColumnSelectors:()=>kt,resolveWindowExpr:()=>ar,rowsToColumns:()=>lr,seq_range:()=>Nt,struct:()=>gr,when:()=>hr,writeStringToFileOrStream:()=>cr});module.exports=Sr(Gs);ft();_t();rt();$();function Nt(n,t={strict:!0}){let e=t,r=new k(wn);return r.L=n,e.name&&(r.f=e.name),r.c.push(o=>{let s=o.length,i=(C,T)=>C===void 0?T:ct(C<0?s+C:C,{min:0,max:s}),a=i(e.startIndex,0),l=i(e.endIndex,s),c=Math.max(0,l-a),u=e.n!==void 0?e.n:c,f=e.strict!==!1;if(f){if(u!==s)throw new J(`Column height mismatch: seq_range length ${u} does not match DataFrame height ${s}`)}else{let C=e.pad??!1,T=e.truncate??!1;if(C&&!T&&u>c)throw new J(`Cannot pad seq_range output: specified length ${u} starting at index ${a} exceeds slice width ${c} (requires truncation).`);if(T&&!C&&u<c)throw new J(`Cannot truncate seq_range output: specified length ${u} starting at index ${a} is less than slice width ${c} (requires padding).`)}let m=s,h=!!e.dtype,p=e.mode||"cumulative",y=e.step!==void 0?e.step:1,d=h?C=>e.dtype.coerce(C):C=>C;if(f){let C=e.dtype?.allocate?e.dtype.allocate(m):new Array(m);return Et(C,n,{mode:p,step:y,coerce:d,startIndex:0,endIndex:m}),C}let g=Math.min(a+u,l),b=e.padValue!==void 0?e.padValue:null,S=d(b);if(p==="constant"&&a===0&&g===m&&!e.dtype){let C=new Array(m);for(let T=0;T<m;T++)C[T]=n;return C}let w=new Array(m);return w.fill(S),Et(w,n,{mode:p,step:y,coerce:d,startIndex:a,endIndex:g}),w}),r}function we(n,t){let e=Nt(n,{strict:!0,mode:"constant",dtype:t?.dtype,name:t?.name});return e.N=!0,e}ft();function zt(){return new k("*")}ft();function mr(n){let t=new k("*");return t.K=Array.isArray(n)?n:[n],t}ft();$();_t();function pr(...n){let t=n.length===1&&Array.isArray(n[0])?n[0]:n,e=new k(Sn);return e.c.push((r,o)=>{let s=r.length,i=u=>k.isColExpr(u)?u.evaluate(o,s):typeof u=="string"?o[u]||new Array(s).fill(null):u,a=t.length,l=new Array(a);for(let u=0;u<a;u++)l[u]=i(t[u]);let c=new Array(s);for(let u=0;u<s;u++){let f=null;for(let m=0;m<a;m++){let h=l[m],p=O(h)?h[u]:h;if(p!=null){f=p;break}}c[u]=f}return c}),e}ft();$();var yn=class{h;S;constructor(t,e){this.h=t,this.S=e}then(t){return new Se(this.h,this.S.concat(t))}},dn=class{h;constructor(t){this.h=[t]}then(t){return new Se(this.h,[t])}},Se=class n extends k{h;S;q;constructor(t,e,r=null){super(typeof t=="string"?t:"*when*"),this.h=Array.isArray(t)?t:[],this.S=e||[],this.q=r,this.c.push((o,s)=>{let i=o.length,a=h=>k.isColExpr(h)?h.evaluate(s,i):typeof h=="string"&&h in s?s[h]:h,l=this.h.length,c=new Array(l),u=new Array(l);for(let h=0;h<l;h++)c[h]=a(this.h[h]),u[h]=a(this.S[h]);let f=a(this.q),m=new Array(i);for(let h=0;h<i;h++){let p=!1;for(let y=0;y<l;y++)if((O(c[y])?c[y][h]:c[y])===!0){m[h]=O(u[y])?u[y][h]:u[y],p=!0;break}p||(m[h]=O(f)?f[h]:f)}return m})}when(t){return new yn(this.h.concat(t),this.S)}otherwise(t){return new n(this.h,this.S,t)}};function hr(n){return new dn(n)}ft();function yr(n){return k.toColExpr(n).implode()}ft();_t();function dr(){return new k(jt)}ft();_t();function gr(n,...t){let e;Array.isArray(n)||n&&typeof n=="object"&&!k.isColExpr(n)?e=n:e=[n,...t];let r=we({}).struct.ot(e);return delete r.N,delete r.L,r.u=Tn,r.alias("struct")}ln();var Te=class{A;R;V;F;J;j;constructor(t,e,r,o,s,i){this.A=t,this.R=e,this.V=r,this.F=o,this.J=s,this.j=i}Ze(){let t=this.R.length,e=new Array(t);for(let a=0;a<t;a++)e[a]=String(this.R[a]);let r=this.A.size,o={};for(let a=0;a<e.length;a++)o[e[a]]=new Array(r);let s=0;for(let a of this.A.values()){if(a.length===0)continue;let l=a[0];for(let c=0;c<e.length;c++){let u=e[c],f=this.F[u][l];o[u][s]=f===void 0?null:f}s++}let i={};for(let a of e)i[a]=this.j[a];return _.a(o,i,s)}agg(...t){let e=this.V.length,r=new Array(e);for(let f=0;f<e;f++)r[f]=String(this.V[f]);let o=this.R.length,s=new Array(o);for(let f=0;f<o;f++)s[f]=String(this.R[f]);let i=kt(t.flat(),r,s,this.j,this.F),a=this.A.size,l={};for(let f=0;f<s.length;f++)l[s[f]]=new Array(a);let c=0;for(let f of this.A.values()){if(f.length===0)continue;let m=f[0];for(let h=0;h<s.length;h++){let p=s[h],y=this.F[p][m];l[p][c]=y===void 0?null:y}c++}for(let f=0;f<i.length;f++){let m=i[f],h=m.f||m.u||"*";if(!m.m)l[h]=m.evaluate(l,a);else{let p=m.U(m.d,this.F,this.J),y=new Array(a),d=0;for(let g of this.A.values()){if(g.length===0)continue;let b=new Array(g.length);for(let S=0;S<g.length;S++)b[S]=p[g[S]];y[d]=m.m(b),d++}l[h]=m.v(m.d,y,l)}}let u={};for(let f of s)u[f]=this.j[f];for(let f of i){let m=f.f||f.u||"*";u[m]=dt(l[m])}return _.a(l,u,c)}};je();Dt();$();rt();Dt();$();rt();function Ks(n,t,e){if(n==null)throw new V(`Invalid input to ${t} at index ${e}: item cannot be null or undefined.`);if(n instanceof _)return[n];if(It(n))return[new _(n)];if(O(n)){if(H(n,_,{mode:"every"}))return n;if(H(n,"plainObject",{mode:"every"}))return[new _(n)];let r=H(n,_,{mode:"some"});for(let o=0;o<n.length;o++)if(r?!(n[o]instanceof _):!It(n[o]))throw new V(r?`Invalid input to ${t} at index ${e}, sub-index ${o}: nested array must contain only DataFrame instances.`:`Invalid input to ${t} at index ${e}, row ${o}: rows must be plain objects.`)}throw new V(`Invalid input to ${t} at index ${e}: expected DataFrame, row array, or column dictionary.`)}function Ht(n,{how:t="vertical",horizontal:e}={}){if(n==null)throw new V("Invalid input to concat: rawItems cannot be null or undefined.");let r=Array.isArray(n)?n:[n],o=[];for(let i=0;i<r.length;i++)o.push(...Ks(r[i],"concat",i));let s=e?.strict??!0;if(o.length===0)return _.a({},{},0);if(o.length===1&&t!=="horizontal")return o[0];switch(t){case"vertical":{let i=[];for(let p=0;p<o.length;p++)o[p].height>0&&i.push(o[p]);if(i.length===0)return _.a({},{},0);let a=i[0],l=Object.keys(a.t);for(let p=0;p<o.length;p++){let y=o[p];if(y.height===0)continue;let d=Object.keys(y.t);if(l.length!==d.length)throw new V(`[Strict Vertical] Column count mismatch at index ${p}.`);for(let g=0;g<l.length;g++){if(l[g]!==d[g])throw new V(`[Strict Vertical] Schema mismatch at position ${g} in DF ${p}. Expected column "${l[g]}", but found "${d[g]}".`);let b=a.schema[l[g]],S=y.schema[l[g]];if(b&&S&&!b.equals(S))throw new Wt(`[Strict Type Check] Schema type mismatch for column "${l[g]}": expected ${b.name}, found ${S.name}.`)}}let c=0;for(let p of o)c+=p.height;let u={},f=o.length;for(let p=0;p<f;p++)if(o[p].height>0){u=o[p].schema;break}Object.keys(u).length===0&&f>0&&(u=o[0].schema);let m={};for(let p of l){let y=u[p],d=!1;for(let b of o){let S=b.t[p];if(!S){d=!0;break}if(!L(S)){for(let w=0;w<S.length;w++)if(S[w]==null){d=!0;break}}if(d)break}let g=y&&y.allocate?y.allocate(c):new Array(c).fill(null);d&&L(g)&&(g=new Array(c).fill(null)),m[p]=g}let h=0;for(let p of o){let y=p.height;if(y!==0){for(let d of l){let g=p.t[d]||new Array(y).fill(null),b=m[d];if(L(b)&&L(g))b.set(g,h);else{let S=b;for(let w=0;w<y;w++)S[h+w]=g[w]}}h+=y}}return _.a(m,u,c)}case"horizontal":{let i=o[0].height;for(let u=1;u<o.length;u++)o[u].height>i&&(i=o[u].height);let a=new Set;for(let u=0;u<o.length;u++){let f=o[u];if(s&&f.height!==i)throw new J(`[Horizontal] Row count mismatch at index ${u}. Expected ${i}, got ${f.height}. Set strict=false to allow padding.`);for(let m of Object.keys(f.t)){if(a.has(m))throw new V(`[Horizontal] Duplicate column name "${m}" detected. Horizontal concat requires unique names.`);a.add(m)}}let l={},c={};for(let u of o){let f=u.height;Object.assign(c,u.schema);let m=Object.keys(u.t),h=m.length;for(let p=0;p<h;p++){let y=m[p],d=u.t[y];if(f===i)l[y]=L(d)?Array.from(d):d;else{let g=new Array(i);for(let b=0;b<f;b++)g[b]=d[b];for(let b=f;b<i;b++)g[b]=null;l[y]=g}}}return _.a(l,c,i)}case"diagonal":{let i=new Set;for(let m of o)for(let h of Object.keys(m.t))i.add(h);let a=Array.from(i),l=0;for(let m=0;m<o.length;m++)l+=o[m].height;let c={};for(let m of a){let h=null;for(let p of o){let y=p.schema[m];if(y){if(h===null)h=y;else if(!h.equals(y))throw new Wt(`[Strict Type Check] Schema type mismatch for column "${m}": expected ${h.name}, found ${y.name}.`)}}c[m]=h||F.Utf8}let u={};for(let m=0;m<a.length;m++)u[a[m]]=new Array(l).fill(null);let f=0;for(let m=0;m<o.length;m++){let h=o[m],p=h.height;if(p!==0){for(let y=0;y<a.length;y++){let d=a[y],g=u[d],b=h.t[d];if(b!==void 0)if(L(b)&&L(g))g.set(b,f);else{let S=g;for(let w=0;w<p;w++)S[f+w]=b[w]}else{let S=g;for(let w=0;w<p;w++)S[f+w]=null}}f+=p}}return _.a(u,c,l)}}}ln();var _=class n{t;e;o={};static a(t,e,r){an(t,r);let o=Object.create(n.prototype);return o.t=t,o.o=e,o.e=r,o}constructor(t,e,r){if(Array.isArray(t)){let{columns:o,height:s}=lr(t);this.t=o,this.e=s,e?this._(e):this.W();return}if(B(t)){this.t=t,this.e=an(t,r),e?this._(e):this.W();return}this.t={},this.e=0,e?this._(e):this.o={}}W(){let t={},e=Object.keys(this.t),r=e.length;for(let o=0;o<r;o++){let s=e[o];t[s]=dt(this.t[s])}this._(t)}_(t){this.o=t;let e=Object.keys(t),r={};for(let o of e){let s=t[o],i=this.t[o];r[o]=i?At(i,s,this.e):At(new Array(this.e).fill(null),s,this.e)}this.t=r}get columns(){return Object.keys(this.t)}concat(t,e={}){let r=H(t,n,{mode:"every",allowEmpty:!1})?t:[t];return Ht([this,...r],e)}drop(...t){let e=new Set(t.flat()),r={},o={};for(let s of Object.keys(this.t))e.has(s)||(r[s]=this.t[s],o[s]=this.o[s]);return n.a(r,o,this.e)}Qe(t){return this.e===0?this:this.filter(t?new k(t).B():zt().B())}get dtypes(){let t=Object.keys(this.t),e=t.length,r=new Array(e);for(let o=0;o<e;o++)r[o]=this.o[t[o]];return r}explode(t,e){let r=k.toColExpr(t),o=r.C||[r.u||r.f],s=new Set,i=o.length;for(let u=0;u<i;u++){let f=o[u];if(!f)throw new V("Expression passed to explode must have a column name.");Q(f,this.t,"Explode column"),s.add(f)}let a=Object.keys(this.t),l=[],c=a.length;for(let u=0;u<c;u++){let f=a[u];l.push(s.has(f)?new k(f).arr.explode(e):new k(f))}return this.select(...l)}$(t={}){return this.e===0?this:this.st(zt().$(t))}filter(...t){if(this.e===0)return n.a({},this.o,0);let e=this.e,r=Object.keys(this.t),o=r.length,s=[],i=[],a=[],l=t.length;for(let d=0;d<l;d++){let g=t[d];typeof g=="function"?i.push(g):a.push(g)}let c=kt(a,r,void 0,this.o,this.t),u=c.length;for(let d=0;d<u;d++)s.push(c[d].evaluate(this.t,e));let f=[],m=0,h=null;if(i.length>0){let d=this.t;h={};for(let g=0;g<o;g++){let b=r[g],S=d[b];Object.defineProperty(h,b,{get(){let w=S[m];return w===void 0?null:w},enumerable:!0,configurable:!0})}}for(let d=0;d<e;d++){let g=!0;for(let b=0;b<s.length;b++)if(!s[b][d]){g=!1;break}if(g){if(h){m=d;for(let b=0;b<i.length;b++)if(!i[b](h)){g=!1;break}}g&&f.push(d)}}let p=Gt(this.t,f),y=f.length;return n.a(p,this.o,y)}tn(){return this.o}groupby(t){let e=Zt(t),r=new Map,o=this.e,s=Lt(t);for(let a=0;a<s.length;a++)Q(s[a],this.t,"Grouping key");for(let a=0;a<o;a++){let l=Mt(this.t,s,a),c=r.get(l);c===void 0&&r.set(l,c=[]),c.push(a)}let i=Object.keys(this.t);return new Te(r,e,i,this.t,this.e,this.o)}head(t=10){return this.limit(t,{offset:0,from:"start"})}get height(){return this.e}hstack(t,e={}){return this.concat(t,{how:"horizontal",horizontal:e})}it(t,e,r){let o=k.toColExpr(r).alias(e),s=Object.keys(this.t),i=s.length,a=[];for(let c=0;c<i;c++){let u=s[c];u!==e&&a.push(u)}let l=Math.max(0,Math.min(t,a.length));return a.splice(l,0,o),this.select(...a)}item(t,e){let r=this.e,o=Object.keys(this.t),s=o.length;if(t===void 0&&e===void 0){if(r!==1||s!==1)throw new V("DataFrame.item() can only be called without arguments if the shape is (1, 1).");return this.t[o[0]][0]}if(t===void 0||e===void 0)throw new V("DataFrame.item() requires both row and column to be specified if not empty.");if(t<0||t>=r)throw new J(`Row index ${t} is out of bounds for DataFrame height ${r}.`);let i;if(typeof e=="number"){if(e<0||e>=s)throw new J(`Column index ${e} is out of bounds for DataFrame width ${s}.`);i=o[e]}else if(i=e,this.t[i]===void 0)throw new yt(i);return this.t[i][t]}*en(){let t=Object.keys(this.t),e=t.length,r=this.t;for(let o=0;o<e;o++)yield r[t[o]]}*nn({named:t=!1}={}){let e=Object.keys(this.t),r=e.length,o=this.t,s=this.e,i=new Array(r);for(let a=0;a<r;a++)i[a]=o[e[a]];if(t)for(let a=0;a<s;a++){let l={};for(let c=0;c<r;c++)l[e[c]]=i[c][a];yield l}else for(let a=0;a<s;a++){let l=new Array(r);for(let c=0;c<r;c++)l[c]=i[c][a];yield l}}join(t){let{other:e,on:r,how:o="inner",suffixes:s=["","_right"]}=t,i=Lt(r);for(let I=0;I<i.length;I++){let E=i[I];Q(E,this.t,"Join key"," in the left DataFrame."),Q(E,e.t,"Join key"," in the right DataFrame.")}let[a,l]=s,c=Object.keys(this.t),u=Object.keys(e.t),f=new Set(i),m=c.length,h=u.length,p=(I,E)=>{let P=i.length;for(let q=0;q<P;q++)if(I[i[q]][E]==null)return null;return Mt(I,i,E)},y=new Map,d=e.e,g=e.t;for(let I=0;I<d;I++){let E=p(g,I);if(E===null)continue;let P=y.get(E);P===void 0&&(P=[],y.set(E,P)),P.push(I)}let b=this.e,S=this.t,w=[],C=[],T=o==="outer"||o==="right",D=T?new Set:null;for(let I=0;I<b;I++){let E=p(S,I),P=E===null?void 0:y.get(E);if(P===void 0)(o==="left"||o==="outer")&&(w.push(I),C.push(null));else for(let q=0;q<P.length;q++){let Y=P[q];T&&D.add(Y),w.push(I),C.push(Y)}}if(T)for(let I=0;I<d;I++)D.has(I)||(w.push(-1),C.push(I));let v=w.length,mt={},lt={};for(let I=0;I<m;I++){let E=c[I],P=E in e.t&&!f.has(E)?`${E}${a}`:E,q=this.t[E],Y=f.has(E),X=new Array(v);if(Y){let st=e.t[E];for(let nt=0;nt<v;nt++){let br=w[nt];if(br!==-1)X[nt]=q[br];else{let xr=C[nt];X[nt]=xr!==null?st[xr]:null}}}else for(let st=0;st<v;st++){let nt=w[st];X[st]=nt!==-1?q[nt]:null}mt[P]=X,this.o[E]&&(lt[P]=this.o[E])}for(let I=0;I<h;I++){let E=u[I];if(!f.has(E)){let P=E in this.t?`${E}${l}`:E,q=e.t[E],Y=new Array(v);for(let X=0;X<v;X++){let st=C[X];Y[X]=st!==null?q[st]:null}mt[P]=Y,e.o[E]&&(lt[P]=e.o[E])}}return n.a(mt,lt,v)}limit(t,{offset:e=0,from:r="start"}={}){let o=this.e,s=ct(Math.floor(t),{min:0,max:o}),i=ct(Math.floor(e),{min:0,max:o}),a=i,l=Math.min(i+s,o);r==="end"&&(l=o-i,a=Math.max(l-s,0));let c=l-a,u={},f=Object.keys(this.t),m=f.length;for(let h=0;h<m;h++){let p=f[h];u[p]=this.t[p].slice(a,l)}return n.a(u,this.o,c)}pivot(t){if(this.e===0)return n.a({},{},0);let{index:e,columns:r,values:o}=t,s=Lt(e),i=s.length;for(let C=0;C<i;C++)Q(s[C],this.t,"Pivot index key");let a=String(r),l=String(o);Q(a,this.t,"Pivot column key"),Q(l,this.t,"Pivot values key");let c=new Map,u=[],f=new Set,m=this.e,h=this.t[a],p=this.t[l];for(let C=0;C<m;C++){let T=Mt(this.t,s,C);f.add(String(h[C])),c.get(T)===void 0&&(c.set(T,c.size),u.push(C))}let y=c.size,d={},g={};for(let C=0;C<i;C++){let T=s[C];d[T]=this.t[T],this.o[T]&&(g[T]=this.o[T])}let b=Gt(d,u),S=Array.from(f),w=this.o[l]||F.Utf8;for(let C=0;C<S.length;C++){let T=S[C];b[T]=new Array(y).fill(null),g[T]=w}for(let C=0;C<m;C++){let T=Mt(this.t,s,C),D=c.get(T),v=String(h[C]);b[v][D]=p[C]}return n.a(b,g,y)}rename(t){let e=t||{},r={},o={},s=Object.keys(this.t);for(let a of s){let l=e[a]||a;r[l]=this.t[a],o[l]=this.o[a]}if(Object.keys(r).length<s.length)throw new V("Rename collision: Multiple columns mapped to the same output name.");return n.a(r,o,this.e)}reverse(){if(this.e===0)return this;let t={},e=Object.keys(this.t),r=e.length;for(let o=0;o<r;o++){let s=e[o];t[s]=this.t[s].slice().reverse()}return n.a(t,this.o,this.e)}get schema(){return this.o}select(...t){let e=this.G(t),r=Object.keys(this.t),o=kt(e,r,void 0,this.o,this.t),s=o.length;if(s===0)return n.a({},{},this.e);let i={},a={},l=new Array(s),c=new Array(s),u=new Set,f=null;for(let p=0;p<s;p++){let y=o[p],d=y.f||y.u||"*";if(u.has(d))throw new V(`Duplicate column selection: "${d}" is selected multiple times.`);u.add(d);let g=Ot(y,this.t,this.e);l[p]=g,c[p]=d;let b=g&&g.rowMap;if(b)if(f){let S=b.length;if(S!==f.length)throw new J(`Mismatched explode heights: Column "${d}" has length ${S}, but another exploded column has length ${f.length}`);for(let w=0;w<S;w++)if(b[w]!==f[w])throw new J(`Mismatched explode heights: Column "${d}" has mismatched row lengths compared to another exploded column.`)}else f=b}let m=f?f.length:this.e,h=s>0;for(let p=0;p<s;p++){let y=o[p],d=y.m!=null&&(y.p==null||y.p.length===0),g=!!y.N;if(!d&&!g){h=!1;break}}for(let p=0;p<s;p++){let y=c[p],d=l[p],g=d,b=g&&g.rowMap,S=O(d)?d.length:0,w=f&&!b?this.e:m;if(S!==w)throw new J(`Column height mismatch: Column "${y}" has length ${S}, but expected ${w}`);if(f&&!b){let C=f.length;if(L(d)){let T=new g.constructor(C);for(let D=0;D<C;D++)T[D]=g[f[D]];d=T}else{let T=new Array(C);for(let D=0;D<C;D++)T[D]=g[f[D]];d=T}}l[p]=d}h&&(m=1);for(let p=0;p<s;p++){let y=o[p],d=c[p],g=l[p],b=y.u||d,w=y instanceof k&&y.c.length===0&&!y.P&&!y.m&&this.o[b]||dt(g);a[d]=w,i[d]=At(g,w,m)}return n.a(i,a,m)}get shape(){return[this.height,this.width]}slice(t,e){let r=this.e,o=t<0?Math.max(r+t,0):Math.min(t,r),s=e===void 0?r:e<0?Math.max(r+e,0):Math.min(e,r),i=Math.max(s-o,0);return this.limit(i,{offset:o})}sort(t){if(!t||!t.by||this.e===0)return this;let{by:e,descending:r=!1,nullsLast:o=!0,custom:s}=t,i=Zt(e);for(let p=0;p<i.length;p++){let y=k.toColExpr(i[p]);y.u&&Q(y.u,this.t,"Sort key")}let a=Array.isArray(r)?r:new Array(i.length).fill(r),l=i.length,c=new Array(l);for(let p=0;p<l;p++){let y=i[p],d=a[p]?-1:1,g=s&&typeof y=="string"?s[y]:null,b=k.toColExpr(y).evaluate(this.t,this.e);c[p]={values:b,isDesc:d,customComp:g}}let u=c.length,f=o?1:-1,m=new Array(this.e);for(let p=0;p<this.e;p++)m[p]=p;m.sort((p,y)=>{for(let d=0;d<u;d++){let{values:g,isDesc:b,customComp:S}=c[d],w=g[p],C=g[y];if(S){let D=S(w,C);if(D!==0)return D*b;continue}if(w==null||C==null){if(w===C)continue;return(w==null?1:-1)*f}if(w===C)continue;return(w<C?-1:1)*b}return 0});let h=Gt(this.t,m);return n.a(h,this.o,this.e)}tail(t=10){return this.limit(t,{offset:0,from:"end"})}rn(){return{...this.t}}z(){return ur(this.t,this.e)}sn(t){if(this.e===0)return[];if(t==null)return new Array(this.e).fill(null);let r=k.toColExpr(t).evaluate(this.t,this.e);return Array.isArray(r)?r:Array.from(r)}transpose({an:t=!1,ln:e="column",un:r}={}){if(this.e===0){let u={},f={};return t&&(u[e]=At([],F.Utf8,0),f[e]=F.Utf8),n.a(u,f,0)}let o=this.columns;typeof r=="string"&&(Q(r,this.t,"column_names"),o=o.filter(u=>u!==r));let s=[];if(typeof r=="string"){let u=this.t[r];s=new Array(this.e);for(let f=0;f<this.e;f++){let m=u[f];if(m==null)throw new V(`Transpose column_names column "${r}" contains null/undefined at index ${f}`);s[f]=String(m)}}else if(r!=null&&typeof r!="string"&&Symbol.iterator in Object(r)){let u=Array.from(r);if(u.length!==this.e)throw new V(`column_names length (${u.length}) must match the height of the DataFrame (${this.e})`);s=new Array(this.e);for(let f=0;f<this.e;f++)s[f]=String(u[f])}else{s=new Array(this.e);for(let u=0;u<this.e;u++)s[u]=`column_${u}`}let i=new Set;t&&i.add(e);for(let u=0;u<s.length;u++){let f=s[u];if(i.has(f))throw new V(`Duplicate column name in transposed DataFrame: "${f}"`);i.add(f)}let a=o.length,l={},c={};t&&(l[e]=At(o,F.Utf8,a),c[e]=F.Utf8);for(let u=0;u<this.e;u++){let f=s[u],m=new Array(a);for(let p=0;p<a;p++)m[p]=this.t[o[p]][u];let h=dt(m);l[f]=At(m,h,a),c[f]=h}return n.a(l,c,a)}unique(t){if(this.e===0)return n.a({},this.o,0);let e=Zt(t),r=e.length===0?Object.keys(this.t):e.map(String);for(let c of r)Q(c,this.t,"Unique column key");let o=new Set,s=[],i=this.e;for(let c=0;c<i;c++){let u=Mt(this.t,r,c);o.has(u)||(o.add(u),s.push(c))}let a=Gt(this.t,s),l=s.length;return n.a(a,this.o,l)}unpivot(t){let{idVars:e,valueVars:r,varName:o="variable",valueName:s="value"}=t,i=Lt(e),a=Lt(r),l=i.length,c=a.length;for(let p of i)Q(p,this.t,"Unpivot id variable key");for(let p of a)Q(p,this.t,"Unpivot value variable key");let u=this.e*c,f={};for(let p=0;p<l;p++)f[i[p]]=new Array(u);f[o]=new Array(u),f[s]=new Array(u);let m=0;for(let p=0;p<this.e;p++)for(let y=0;y<c;y++){let d=a[y];for(let g=0;g<l;g++){let b=i[g];f[b][m]=this.t[b][p]}f[o][m]=d,f[s][m]=this.t[d][p],m++}let h={};for(let p of i)h[p]=this.o[p];return h[o]=F.Utf8,h[s]=dt(f[s]),n.a(f,h,u)}vstack(t){return this.concat(t,{how:"vertical"})}get width(){return Object.keys(this.t).length}G(t){let e=t.flat(),r=[];for(let o of e)if(typeof o=="string")r.push(new k(o));else if(k.isColExpr(o))r.push(o);else if(B(o)){let s=Object.keys(o),i=s.length;for(let a=0;a<i;a++){let l=s[a],c=o[l];if(k.isColExpr(c))r.push(c.alias(l));else{let u=new k(l);u.evaluate=(f,m)=>new Array(m).fill(c),r.push(u)}}}return r}st(...t){if(t.length===0)return this;let e=this.G(t),r=Object.keys(this.t),o=kt(e,r,void 0,this.o,this.t),s=o.length;if(s===0)return this;let i=new Map;for(let c=0;c<s;c++){let u=o[c],f=u.f||u.u||"*";i.set(f,u)}let a=[],l=r.length;for(let c=0;c<l;c++){let u=r[c];a.push(i.get(u)||new k(u)),i.delete(u)}for(let c of i.values())a.push(c);return this.select(...a)}cn(t="index",e=0){let r=Nt(e,{mode:"independent",dtype:F.UInt32,step:1}),o=this.it(0,t,r);return o.o[t]=F.UInt32,o}fn(t,{format:e="json",replacerOptions:r}={}){if(e!=="json"&&e!=="ndjson")throw new TypeError(`Unsupported JSON format: "${e}". Expected "json" or "ndjson".`);let o=r?.replacer===null?void 0:oe(r),s;if(e==="ndjson"){let i=this.z(),a=i.length,l=new Array(a);for(let c=0;c<a;c++)l[c]=JSON.stringify(i[c],o);s=l.join(`
6
- `)}else s=JSON.stringify(this.z(),o);return cr(t,s),s}mn(t,e={}){if(t){if(typeof t=="string"){if(typeof require!="function")throw new Error("File writing is not supported in this environment (missing require('fs')).");let r=require("fs"),o=r.openSync(t,"w");try{sn(this.t,this.e,{...e,onRow:s=>{r.writeSync(o,s,null,"utf8")}})}finally{r.closeSync(o)}}else if(B(t)&&typeof t.write=="function")sn(this.t,this.e,{...e,onRow:r=>{t.write(r)}});else throw new TypeError("Invalid file argument. Expected a file path string or a writable stream/object with a write method.");return""}return sn(this.t,this.e,e)}};Dt();$();rt();function gn(n,{format:t="json",trimBeforeParse:e=!0,schema:r,...o}={}){let s=xo(n,{format:t,trimBeforeParse:e,...o});if(s===n)throw new V(`Invalid JSON input: must be a valid, non-empty JSON ${t} string.`);let i=Array.isArray(s)?s:B(s)?[s]:[];return new _(i,r)}$();function bn(n,t={}){let{hasHeader:e=!0,schema:r,inferSchema:o=!0}=t,s=So(n,t);if(s.length===0)return new _({});let i,a;e?(i=s[0],a=s.slice(1)):(i=s[0].map((m,h)=>`column_${h}`),a=s);let l=i.length,c=a.length,u={};for(let m=0;m<l;m++){let h=i[m],p=new Array(c);for(let y=0;y<c;y++)p[y]=a[y][m]!==void 0?a[y][m]:"";u[h]=p}let f={};for(let m=0;m<l;m++){let h=i[m],p=u[h];if(r&&r[h])f[h]=p;else if(o){let{values:y}=To(p,t);f[h]=y}else f[h]=p}return new _(f,r)}function qs(n,t){return new _(n,t)}var Ws={data:qs,col:n=>new k(n),all:zt,exclude:mr,coalesce:pr,concat:Ht,pn:gn,hn:bn,lit:we,when:hr,implode:yr,yn:Nt,element:dr,struct:gr,DataType:F};Dt();rt();0&&(module.exports={$df,ALL_COLUMNS_MARKER,AggregationExpr,ArithmeticExpr,Array,ArrayDataType,ArrayExpr,ArrayExprNamespace,ArrayType,Binary,BinaryType,Boolean,BooleanDataType,BooleanType,COALESCE_MARKER,ColumnExpr,ColumnNotFoundError,ComparisonExpr,ComputeError,DFScriptError,DataFrame,DataFrameError,DataType,DataTypeRegistry,Date,DateDataType,DateTimeExprNamespace,DateType,Datetime,DatetimeType,DecimalType,Duration,DurationType,ELEMENT_MARKER,ExprBase,Float32,Float32Type,Float64,Float64Type,FloatDataType,GroupedData,Int16,Int16Type,Int32,Int32Type,Int64,Int64Type,Int8,Int8Type,IntegerDataType,LITERAL_MARKER,LogicalExpr,NestedDataType,Null,NullType,NumericDataType,Object,ObjectDataType,ObjectType,STRUCT_MARKER,SchemaError,ShapeError,SignedIntegerType,StringExpr,StringExprNamespace,Struct,StructExpr,StructExprNamespace,StructType,TemporalDataType,TemporalExpr,Time,TimeType,UInt16,UInt16Type,UInt32,UInt32Type,UInt64,UInt64Type,UInt8,UInt8Type,UnsignedIntegerType,Utf8,Utf8Type,When,WhenThen,WhenThenChain,WindowExpr,all,assertColumnExists,assertHeight,coalesce,coerceColumn,columnsToRows,computeRowHash,concat,derive,element,evaluateExpression,exclude,gatherColumnsByIndices,getRowFromColumns,implode,inferColumnType,kleeneBinary,kleeneUnary,lit,read_csv,read_json,resolveColumnSelectors,resolveWindowExpr,rowsToColumns,seq_range,struct,when,writeStringToFileOrStream});
5
+ `&&(p=!0),p?(u||s.length>0||a!==""||c)&&(s.push(a),i.push(s),s=[],a="",u=!1,c=!1):(u=!0,c=!1,a+=h)}}return(u||s.length>0||a!==""||c)&&(s.push(a),i.push(s)),i}function xs(n,e={}){let t=new Set(e.nullValues??["","NA","null","NaN"]),r=n.length,o=!0,i=!0,s=!0,a=!0,l=!1;for(let c=0;c<r;c++){let f=n[c].trim();if(!t.has(f)){if(l=!0,o){let m=f.toLowerCase();m!=="true"&&m!=="false"&&m!=="1"&&m!=="0"&&(o=!1)}if(s&&Ie(f,{truncate:!1})===null&&(s=!1),i&&j(f,{allowNonFiniteNumbers:!0})===null&&(i=!1),a&&J(f)===null&&(a=!1),!o&&!i&&!s&&!a)break}}let u=new Array(r);if(!l||!o&&!i&&!s&&!a){for(let c=0;c<r;c++){let f=n[c];u[c]=t.has(f.trim())?null:f}return{type:_t,values:u}}if(o){for(let c=0;c<r;c++){let f=n[c].trim();if(t.has(f))u[c]=null;else{let m=f.toLowerCase();u[c]=m==="true"||m==="1"}}return{type:jt,values:u}}if(s){for(let c=0;c<r;c++){let f=n[c].trim();u[c]=t.has(f)?null:Ie(f,{truncate:!1})}return{type:vt,values:u}}if(i){for(let c=0;c<r;c++){let f=n[c].trim();u[c]=t.has(f)?null:j(f,{allowNonFiniteNumbers:!0})}return{type:Ft,values:u}}if(a){for(let c=0;c<r;c++){let f=n[c].trim();u[c]=t.has(f)?null:J(f)}return{type:Bt,values:u}}return{type:_t,values:u}}var bs=R(()=>{"use strict";dn();kt();Ve();Ne();ye()});function ws(n,e){return e==="us"?n*1e3:e==="ns"?n*1e6:n}var As=R(()=>{"use strict"});var z=R(()=>{"use strict";ye();Ve();dn();hn();Ct();kt();bs();Tr();As()});function H(n,e,t,r=""){if(!(n in e))throw new Me(n,`${t} "${n}" does not exist${r}`)}function Vn(n,e){let t=Object.keys(n),r=t.length,o=e;for(let i=0;i<r;i++){let s=t[i],a=n[s],l=k(a)?a.length:0;if(o===void 0)o=l;else if(l!==o)throw new re(`Column height mismatch: Column "${s}" has length ${l}, but DataFrame height is ${o}`)}return o===void 0?0:o}function Pt(n,e="Value cannot be null or undefined"){if(n==null)throw new M(e);return n}function xl(n,e){if(!n)throw new M(e)}var Ss=R(()=>{"use strict";X();z()});var Ue,q,Me,Je,ne,re,M,Re,X=R(()=>{"use strict";Ss();Ue=class extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},q=class extends Ue{},Me=class extends q{constructor(e,t){super(t||`Column "${e}" does not exist in the DataFrame.`)}},Je=class extends Ue{},ne=class extends Ue{},re=class extends Ue{},M=class extends Ue{},Re=class extends Ue{}});function bl(n,e,t){let r=new Map,o=t.length,i=new Array(o);for(let s=0;s<o;s++){let a=t[s];typeof a=="string"?(H(a,n,"Partition key"," in the DataFrame."),i[s]=n[a]):i[s]=a.evaluate(n,e)}if(o===1){let s=i[0];for(let a=0;a<e;a++){let l=s[a],u=l==null?"":G(l),c=r.get(u);c===void 0&&(c=[],r.set(u,c)),c.push(a)}return r}for(let s=0;s<e;s++){let a=new Array(o);for(let c=0;c<o;c++){let f=i[c][s];a[c]=f==null?"":G(f)}let l=a.join(ut),u=r.get(l);u===void 0&&(u=[],r.set(l,u)),u.push(s)}return r}function Hr(n,e,t){let r=new Array(t);if(t===0)return r;let o=n._partitionBy||[],i=bl(e,t,o),s=n._evaluatePre(n._partitionOpsIndex,e,t);for(let a of i.values()){let l=a.length,u=new Array(l);for(let c=0;c<l;c++)u[c]=s[a[c]];if(n._evaluateWindow){for(let c=0;c<l;c++)r[a[c]]=n._evaluateWindow(u,a,c);continue}if(n._aggFn){let c=n._aggFn(u);for(let f=0;f<l;f++)r[a[f]]=c;continue}for(let c=0;c<l;c++)r[a[c]]=s[a[c]]}return n._evaluatePost(n._partitionOpsIndex,r,e)}function Yr(n){if(!Array.isArray(n)||n.length===0)return{columns:{},height:0};let e=n.length,t=new Set;for(let i=0;i<e;i++){let s=n[i];if(F(s)){let a=Object.keys(s);for(let l=0;l<a.length;l++)t.add(a[l])}}let r=Array.from(t),o={};for(let i=0;i<r.length;i++)o[r[i]]=new Array(e);for(let i=0;i<e;i++){let s=n[i]||{};for(let a=0;a<r.length;a++){let l=r[a],u=s[l];o[l][i]=u===void 0?null:u}}return{columns:o,height:e}}function Zr(n,e){let t=Object.keys(n),r=new Array(e);for(let o=0;o<e;o++){let i={};for(let s=0;s<t.length;s++){let a=t[s],l=n[a][o];i[a]=l===void 0?null:l}r[o]=i}return r}function wl(n,e,t){let r={};for(let o=0;o<t.length;o++){let i=t[o],s=n[i][e];r[i]=s===void 0?null:s}return r}function Fe(n){if(n.length===0)return E.Utf8;let e=!0,t=!0,r=!0,o=!0,i=!0,s=!0,a=!0,l=!0,u=!1,c=!1,f=[];for(let m=0;m<n.length;m++){let h=n[m];if(h!=null){if(c=!0,h instanceof Uint8Array||(a=!1),!k(h)||h instanceof Uint8Array)s=!1;else{let p=h,d=p.length;for(let g=0;g<d;g++)f.push(p[g])}P(h)&&(u=!0),typeof h!="boolean"&&(e=!1),typeof h!="bigint"&&(o=!1),typeof h!="number"?(r=!1,t=!1):Number.isInteger(h)||(t=!1),!P(h)&&(typeof h!="string"||isNaN(Date.parse(h)))&&(i=!1),(!F(h)||h instanceof Uint8Array)&&(l=!1)}}if(!c)return E.Null;if(a)return E.Binary;if(s){let m=Fe(f);return E.Array(m)}if(e)return E.Boolean;if(o)return E.Int64;if(r&&!t)return E.Float64;if(r&&t){let m=!0;for(let h=0;h<n.length;h++){let p=n[h];if(p!=null&&(p<-2147483648||p>2147483647)){m=!1;break}}return m?E.Int32:E.Float64}return i&&u?E.Datetime:l?E.Object:E.Utf8}function bt(n,e){let t=Object.keys(n),r=t.length,o=e.length,i={};for(let s=0;s<r;s++){let a=t[s],l=n[a],u=K(l)?new l.constructor(o):new Array(o);for(let c=0;c<o;c++)u[c]=l[e[c]];i[a]=u}return i}function ve(n,e,t){let r=e.length;if(r===1)return G(n[e[0]][t]);let o=new Array(r);for(let i=0;i<r;i++)o[i]=G(n[e[i]][t]);return o.join(ut)}function Se(n,e,t){let r=e.allocate?e.allocate(t):new Array(t);if(K(r)){let i=r;for(let s=0;s<t;s++){let a=e.coerce(n[s]);if(a==null){let l=new Array(t);for(let u=0;u<s;u++)l[u]=i[u];l[s]=null;for(let u=s+1;u<t;u++)l[u]=e.coerce(n[u]);return l}i[s]=a}}else for(let i=0;i<t;i++)r[i]=e.coerce(n[i]);return r}function Qr(n,e){if(n)if(typeof n=="string"){if(typeof require!="function")throw new Re("File writing is not supported in this environment (missing require('fs')).");require("fs").writeFileSync(n,e,"utf8")}else if(F(n)&&typeof n.write=="function")n.write(e);else throw new M("Invalid file argument. Expected a file path string or a writable stream/object with a write method.")}function eo(n,e,t,r,o,i,s={}){let{how:a="inner",join_nulls:l=!1,maintain_order:u}=s,c=(w,D,O)=>{if(!l){for(let C=0;C<D.length;C++)if(w[D[C]][O]==null)return null}return ve(w,D,O)};if(a==="cross")return Ci(t,r);let f=new Map;for(let w=0;w<r;w++){let D=c(e,i,w);if(D===null)continue;let O=f.get(D);O===void 0&&(O=[],f.set(D,O)),O.push(w)}let m=[],h=[];if(a==="semi"||a==="anti"){for(let w=0;w<t;w++){let D=c(n,o,w),O=D===null?void 0:f.get(D),C=O!==void 0&&O.length>0;(a==="semi"&&C||a==="anti"&&!C)&&(m.push(w),h.push(null))}return{leftIndices:m,rightIndices:h}}let p=a==="outer"||a==="right",d=p?new Set:null;for(let w=0;w<t;w++){let D=c(n,o,w),O=D===null?void 0:f.get(D);if(O===void 0)(a==="left"||a==="outer")&&(m.push(w),h.push(null));else for(let C=0;C<O.length;C++){let N=O[C];p&&d.add(N),m.push(w),h.push(N)}}if(p)for(let w=0;w<r;w++)d.has(w)||(m.push(Et),h.push(w));let g=u||"none";if(g==="none"||g==="left")return{leftIndices:m,rightIndices:h};let y=m.length,_=new Int32Array(y);for(let w=0;w<y;w++)_[w]=w;let S=w=>m[w]===Et?Number.MAX_SAFE_INTEGER:m[w],b=w=>h[w]??Number.MAX_SAFE_INTEGER;g==="right"?_.sort((w,D)=>b(w)-b(D)||w-D):g==="left_right"?_.sort((w,D)=>S(w)-S(D)||b(w)-b(D)||w-D):g==="right_left"&&_.sort((w,D)=>b(w)-b(D)||S(w)-S(D)||w-D);let x=new Array(y),A=new Array(y);for(let w=0;w<y;w++){let D=_[w];x[w]=m[D],A[w]=h[D]}return{leftIndices:x,rightIndices:A}}function to(n,e,t,r,o,i,s,a,l={}){let u=l.strategy??"backward",c=l.allow_exact_matches??!0,f=l.check_sorted??!0;H(o,n,"Join on key"," in the left DataFrame."),H(i,e,"Join on key"," in the right DataFrame.");let m=n[o],h=e[i];if(f){let x=(A,w,D,O)=>{for(let C=1;C<w;C++){let N=j(A[C-1]),Y=j(A[C]);if(v(N)&&v(Y)&&Y<N)throw new M(`${O} DataFrame key column "${D}" is not sorted in ascending order at row ${C}.`)}};x(m,t,o,"left"),x(h,r,i,"right")}let p=s.length>0,d=new Map;if(p)for(let x=0;x<r;x++){let A=ve(e,a,x),w=d.get(A);w||(w=[],d.set(A,w)),w.push(x)}let g=new Array(r);if(!p)for(let x=0;x<r;x++)g[x]=x;let y=new Array(t),_=new Array(t),S=(x,A)=>{let w=A.length;if(w===0)return null;let D=(W,le)=>j(h[le])??NaN;if(u==="backward"){let W=mn(A,x,{side:c?"right":"left",getValue:D})-1;return W>=0?A[W]:null}if(u==="forward"){let W=mn(A,x,{side:c?"left":"right",getValue:D});return W<w?A[W]:null}let O=mn(A,x,{side:"right",getValue:D}),C=O-1,N=O;if(c||(C>=0&&D(C,A[C])===x&&C--,N<w&&D(N,A[N])===x&&N++),C<0)return N<w?A[N]:null;if(N>=w)return C>=0?A[C]:null;let Y=D(C,A[C]),Q=D(N,A[N]);return Math.abs(x-Y)<=Math.abs(x-Q)?A[C]:A[N]},b=l.tolerance!==void 0?j(l.tolerance):null;for(let x=0;x<t;x++){y[x]=x;let A=j(m[x]);if(!v(A)){_[x]=null;continue}let w=p?d.get(ve(n,s,x))||[]:g;if(w.length===0){_[x]=null;continue}let D=S(A,w);if(D!==null&&b!==null){let O=j(h[D]);(!v(b)||!v(O)||Math.abs(A-O)>b)&&(D=null)}_[x]=D}return{leftIndices:y,rightIndices:_}}function $n(n,e,t,r,o,i,s,a,l={}){let[u="",c="_right"]=l.suffixes||[],f=l.coalesce??!0,m=l.how||"inner",h=o.length,p={},d={},g=new Set(s),y=new Set(a),_=(D,O)=>{let C=O!==""?O:"_left",N=`${D}${C}`,Y=1;for(;x.has(N);)N=`${D}${C}_${Y++}`;return x.add(N),N},S=(D,O,C=Et)=>{let N=O.length,Y=new Array(N);for(let Q=0;Q<N;Q++){let W=O[Q];Y[Q]=W!==null&&W!==C?D[W]:null}return Y},b=new Map;for(let D=0;D<s.length;D++)b.has(s[D])||b.set(s[D],a[D]);let x=new Set,A=Object.keys(n),w=Object.keys(e);for(let D=0;D<A.length;D++){let O=A[D];(!(O in e)||g.has(O)||y.has(O))&&x.add(O)}for(let D=0;D<A.length;D++){let O=A[D],C=g.has(O),N;O in e&&!C&&!y.has(O)?u!==""?(x.add(O),N=_(O,u)):x.has(O)?N=_(O,u):(N=O,x.add(O)):N=O;let Y=n[O],Q=C?b.get(O):null,W=Q?e[Q]:null;if(C&&f){let le=new Array(h);for(let fe=0;fe<h;fe++){let Zt=o[fe],at=i[fe],Vs=Zt!==Et?Y[Zt]:null,$s=at!==null&&W?W[at]:null;le[fe]=Vs??$s}p[N]=le}else p[N]=S(Y,o);t[O]?d[N]=t[O]:Q&&r[Q]&&(d[N]=r[Q])}if(m!=="semi"&&m!=="anti")for(let D=0;D<w.length;D++){let O=w[D];if(f&&y.has(O))continue;let C;x.has(O)?C=_(O,c):(C=O,x.add(O)),p[C]=S(e[O],i),r[O]&&(d[C]=r[O])}return L._createDirect(p,d,h)}var Kn=R(()=>{"use strict";wt();Ne();xe();z();X()});function Ts(n,e){if(n==null)return null;let t=P(n)?n.getTime():n;return e(t)}function no(n,e,t){if(n==null||e==null)return null;let r=P(n)?n.getTime():n,o=P(e)?e.getTime():e;return t(r,o)}function pe(n,e,t){return n._isWindow?Hr(n,e,t):n.evaluate(e,t)}function nt(n,e,t){return typeof n=="object"&&n!==null&&"_ops"in n?pe(n,e||{},t):typeof n=="string"&&e!=null&&n in e?e[n]:n}function rt(n,e,t,r){return!k(e)||e.length!==r?!1:typeof n=="object"&&n!==null&&"_ops"in n||typeof n=="string"&&t!=null&&n in t}var I,V,ue=R(()=>{"use strict";z();ye();Kn();I=n=>e=>{let t=e.length,r=new Array(t);for(let o=0;o<t;o++)r[o]=Ts(e[o],n);return r},V=(n,e,t)=>{let r=(o,i)=>{let s=o.length,a=n._resolve(e,i,s),l=new Array(s);if(k(a))for(let u=0;u<s;u++)l[u]=no(o[u],a[u],t);else for(let u=0;u<s;u++)l[u]=no(o[u],a,t);return l};return r._binaryMeta={left:n,right:e},r}});var T,$,ce=R(()=>{"use strict";X();ue();T=(n,e)=>{let t=n.constructor,r=n._colNames||n._colName||"",o=new t(r);return Object.assign(o,n),o._ops=e?[...n._ops,e]:[...n._ops],e&&e._binaryMeta&&(o._binaryMeta=e._binaryMeta),o},$=class n{_ops=[];_outputName="";_isLiteral;_literalValue;_aggFn=null;_castType;_binaryMeta;_groupingOpsIndex;_partitionOpsIndex;_partitionBy=null;_evaluateWindow;_baseExpr;_fieldName;_isUnnest;_evaluatePost(e,t,r){let o=this._ops,i=e!==void 0?e:o.length,s=t;for(let a=i;a<o.length;a++)s=o[a](s,r);return s}_evaluatePre(e,t,r){let o=this._getInitialValue(t,r),i=this._ops,s=e!==void 0?e:i.length;for(let a=0;a<s;a++)o=i[a](o,t);return o}_getInitialValue(e,t){let r=this._colName;if(r&&r!=="*"&&!r.startsWith("*")&&!(r in e))throw new Me(r);return(r&&r!=="*"?e[r]:null)||new Array(t).fill(null)}_resolve(e,t,r){return e instanceof n?e._isLiteral&&e._ops.length===1?e._literalValue:pe(e,t,r):e}alias(e){let t=T(this);return t._outputName=e,t}cast(e){let t=T(this,I(r=>e.coerce(r)));return t._castType=e,t}debug(e){return T(this,t=>(console.log(`[DEBUG] ${e?e+": ":""}`,t),t))}evaluate(e,t){return this._evaluatePre(void 0,e,t)}}});var Lt,ro=R(()=>{"use strict";ce();ue();z();Lt=class extends ${abs(){return T(this,I(Math.abs))}acos(){return T(this,I(e=>e<-1||e>1?null:Math.acos(e)))}acosh(){return T(this,I(e=>e<1?null:Math.acosh(e)))}add(e){return T(this,V(this,e,(t,r)=>t+r))}asin(){return T(this,I(e=>e<-1||e>1?null:Math.asin(e)))}asinh(){return T(this,I(Math.asinh))}atan(){return T(this,I(Math.atan))}atan2(e){return T(this,V(this,e,Math.atan2))}atanh(){return T(this,I(e=>e<=-1||e>=1?null:Math.atanh(e)))}cbrt(){return T(this,I(Math.cbrt))}ceil(){return T(this,I(Math.ceil))}clip(e=null,t=null){return T(this,I(r=>Ce(r,{min:e,max:t})))}copysign(e){return T(this,V(this,e,(t,r)=>Math.abs(t)*(r>=0?1:-1)))}cos(){return T(this,I(Math.cos))}cosh(){return T(this,I(Math.cosh))}degrees(){return T(this,I(e=>e*(180/Math.PI)))}div(e){return T(this,V(this,e,(t,r)=>r===0?null:t/r))}exp(){return T(this,I(Math.exp))}expm1(){return T(this,I(Math.expm1))}floor(){return T(this,I(Math.floor))}floordiv(e){return T(this,V(this,e,(t,r)=>r===0?null:Math.floor(t/r)))}hypot(e){return T(this,V(this,e,Math.hypot))}log(e=Math.E){return T(this,I(t=>t<=0?null:e===Math.E?Math.log(t):Math.log(t)/Math.log(e)))}log1p(){return T(this,I(e=>e<=-1?null:Math.log1p(e)))}mod(e){return T(this,V(this,e,(t,r)=>r===0?null:t%r))}mul(e){return T(this,V(this,e,(t,r)=>t*r))}negate(){return T(this,I(e=>-e))}pow(e){return T(this,V(this,e,Math.pow))}radians(){return T(this,I(e=>e*(Math.PI/180)))}rand(e,{min:t=0,max:r=1,integer:o=!1}={}){return T(this,i=>{let s=i.length,a=new Float64Array(s),l=e!==void 0?bi(e):Math.random,u=r-t;for(let c=0;c<s;c++){let f=l();a[c]=o?Math.floor(f*(u+1))+t:f*u+t}return a})}round(e=0){return T(this,I(t=>xr(t,e)))}round_sig_figs(e){return T(this,I(t=>v(t)?Number(t.toPrecision(e)):t))}sign(){return T(this,I(Math.sign))}sin(){return T(this,I(Math.sin))}sinh(){return T(this,I(Math.sinh))}sqrt(){return T(this,I(e=>e<0?null:Math.sqrt(e)))}sub(e){return T(this,V(this,e,(t,r)=>t-r))}tan(){return T(this,I(Math.tan))}tanh(){return T(this,I(Math.tanh))}trunc(){return T(this,I(Math.trunc))}}});var Vt,oo=R(()=>{"use strict";ce();ue();z();Vt=class extends ${and(e){return T(this,(t,r)=>{let o=t.length,i=this._resolve(e,r,o),s=k(i),a=new Array(o);for(let l=0;l<o;l++){let u=t[l],c=s?i[l]:i;u===!1||c===!1?a[l]=!1:u==null||c==null?a[l]=null:a[l]=!0}return a})}not(){return T(this,I(e=>!e))}or(e){return T(this,(t,r)=>{let o=t.length,i=this._resolve(e,r,o),s=k(i),a=new Array(o);for(let l=0;l<o;l++){let u=t[l],c=s?i[l]:i;u===!0||c===!0?a[l]=!0:u==null||c==null?a[l]=null:a[l]=!1}return a})}xor(e){return T(this,V(this,e,(t,r)=>!!t!=!!r))}}});function Ds(n,e,t,r){let o=n.length,i=new Array(o);if(t&&typeof t=="object"&&"evaluate"in t){let s=t.evaluate(e,o);for(let a=0;a<o;a++){let l=n[a];if(l==null)i[a]=null;else{let u=s[a],c=new Set;if(k(u)){let m=u.length;for(let h=0;h<m;h++)c.add(G(u[h]))}else c.add(G(u));let f=c.has(G(l));i[a]=r?!f:f}}}else{let s=k(t)?t:[],a=new Set,l=s.length;for(let u=0;u<l;u++)a.add(G(s[u]));for(let u=0;u<o;u++){let c=n[u];if(c==null)i[u]=null;else{let f=a.has(G(c));i[u]=r?!f:f}}}return i}function Os(n,e){let{frequencies:t}=Ke(n,{strict:!0}),r=n.length,o=new Array(r);for(let i=0;i<r;i++){let s=t.get(n[i])||0;o[i]=e?s>1:s===1}return o}function Es(n,e,t){let r=n.length,o=new Array(r);if(k(e))for(let i=0;i<r;i++){let s=n[i],a=e[i];s==null&&a==null?o[i]=!t:s==null||a==null?o[i]=t:o[i]=t?s!==a:s===a}else for(let i=0;i<r;i++){let s=n[i];s==null&&e==null?o[i]=!t:s==null||e==null?o[i]=t:o[i]=t?s!==e:s===e}return o}var $t,io=R(()=>{"use strict";ce();ue();z();$t=class extends ${between(e,t,r="both"){return T(this,(o,i)=>{let s=o.length,a=this._resolve(e,i,s),l=this._resolve(t,i,s),u=new Array(s),c=k(a),f=k(l);for(let m=0;m<s;m++){let h=o[m],p=c?a[m]:a,d=f?l[m]:l;if(h==null||p==null||d==null)u[m]=null;else{let g=r==="both"||r==="left"?h>=p:h>p,y=r==="both"||r==="right"?h<=d:h<d;u[m]=g&&y}}return u})}eq(e){return T(this,V(this,e,(t,r)=>t===r))}eq_missing(e){return T(this,(t,r)=>{let o=this._resolve(e,r,t.length);return Es(t,o,!1)})}ge(e){return T(this,V(this,e,(t,r)=>t>=r))}gt(e){return T(this,V(this,e,(t,r)=>t>r))}has_nulls(){return this._deriveAgg(e=>{for(let t=0;t<e.length;t++)if(e[t]==null)return!0;return!1})}is_close(e,{abs_tol:t=1e-8,rel_tol:r=1e-8,nans_equal:o=!1}={}){return T(this,(i,s)=>{let a=i.length,l=this._resolve(e,s,a),u=k(l),c=new Array(a);for(let f=0;f<a;f++){let m=i[f],h=u?l[f]:l;if(m==null||h==null)c[f]=null;else if(v(m)&&v(h)){let p=Math.abs(m-h),d=Math.max(r*Math.max(Math.abs(m),Math.abs(h)),t);c[f]=p<=d}else Number.isNaN(m)&&Number.isNaN(h)?c[f]=o:c[f]=m===h}return c})}is_duplicated(){return T(this,e=>Os(e,!0))}is_empty({ignoreNulls:e=!1}={}){return T(this,I(t=>typeof t=="string"?t.length===0:k(t)?e?ee(t,"nullish",{mode:"every"}):t.length===0:null))}is_finite(){return T(this,I(Number.isFinite))}is_in(e){return T(this,(t,r)=>Ds(t,r,e,!1))}is_infinite(){return T(this,I(e=>e===1/0||e===-1/0))}is_nan(){return T(this,I(Number.isNaN))}is_not_nan(){return T(this,I(e=>!Number.isNaN(e)))}is_not_null(){return T(this,e=>{let t=e.length,r=new Array(t);for(let o=0;o<t;o++)r[o]=e[o]!=null;return r})}is_null(){return T(this,e=>{let t=e.length,r=new Array(t);for(let o=0;o<t;o++)r[o]=e[o]==null;return r})}is_unique(){return T(this,e=>Os(e,!1))}le(e){return T(this,V(this,e,(t,r)=>t<=r))}lt(e){return T(this,V(this,e,(t,r)=>t<r))}ne(e){return T(this,V(this,e,(t,r)=>t!==r))}ne_missing(e){return T(this,(t,r)=>{let o=this._resolve(e,r,t.length);return Es(t,o,!0)})}not_in(e){return T(this,(t,r)=>Ds(t,r,e,!0))}}});var qn,Kt,so=R(()=>{"use strict";ce();ue();xe();z();qn=class{constructor(e){this.expr=e}expr;_deriveString(e){return T(this.expr,I(t=>e(String(t))))}_patternGuard(e,t){return e==null?T(this.expr,r=>new Array(r.length).fill(null)):t()}_matchPattern(e,t){return t==null?!1:ge(t)?(t.lastIndex=0,t.test(e)):e.includes(t)}concat(e){return T(this.expr,V(this.expr,e,(t,r)=>String(t)+String(r)))}contains(e){return this._patternGuard(e,()=>this._deriveString(t=>this._matchPattern(t,e)))}contains_any(e){return this._patternGuard(e,()=>{let t=Array.isArray(e)?e:[e];return this._deriveString(r=>{let o=t.length;for(let i=0;i<o;i++)if(this._matchPattern(r,t[i]))return!0;return!1})})}count_matches(e,t={}){let r=typeof t=="boolean"?t:t?.literal??!1;return this._patternGuard(e,()=>this._deriveString(o=>{let i=r?de(e):e,s=pt(o,i,{global:!0});if(!s)return 0;let a=s.input.match(s.reg);return a?a.length:0}))}escape_regex(e={}){return this._deriveString(t=>de(t,e))}decode(e){return this._deriveString(t=>Ji(t,e.encoding,e))}encode(e){return this._deriveString(t=>Gi(t,e.encoding))}decode_uri_component(){return this._deriveString(e=>{try{return decodeURIComponent(e)}catch{return e}})}encode_uri_component(){return this._deriveString(e=>{try{return encodeURIComponent(e)}catch{return e}})}ends_with(e){return this._deriveString(t=>t.endsWith(e))}explode(){return this._deriveString(e=>e.split(""))}extract(e,t){return this._patternGuard(e,()=>this._deriveString(r=>Or(r,e,t)))}extract_all(e,t){return this._patternGuard(e,()=>this._deriveString(r=>Yi(r,e,t)??[]))}extract_groups(e,t={}){return this._patternGuard(e,()=>this._deriveString(r=>Zi(r,e,t)))}extract_many(e,t={}){return this._patternGuard(e,()=>this._deriveString(r=>Qi(r,e,t)))}find(e,t={}){return this._patternGuard(e,()=>this._deriveString(r=>_n(r,e,t)))}find_many(e,t={}){return this._patternGuard(e,()=>this._deriveString(r=>es(r,e,t)))}head(e=1){return this.slice(0,e)}join(e="",t={}){return T(this.expr,I(r=>{let o=be(r);return o==null?null:un(o,e,t)}))}json_decode(e={}){return this._deriveString(t=>Rt(t,e))}json_path_match(e){return this._deriveString(t=>Pi(t,e))}len(){return this.len_chars()}len_bytes(){return this._deriveString(e=>Oe.encode(e).length)}len_chars(){return this._deriveString(e=>e.length)}lower(){return this._deriveString(e=>e.toLowerCase())}lpad(e,t=" "){return this._deriveString(r=>r.padStart(e,t))}normalize(e){return this._deriveString(t=>t.normalize(e))}pad_end(e,t=" "){return this.rpad(e,t)}pad_start(e,t=" "){return this.lpad(e,t)}replace(e,t,r){return this._patternGuard(e,()=>this._deriveString(o=>Er(o,e,t,{n:1,...r})??o))}replace_all(e,t,r){return this._patternGuard(e,()=>this._deriveString(o=>Er(o,e,t,{...r,n:-1})??o))}replace_many(e,t,r){return this._patternGuard(e,()=>this._deriveString(o=>rs(o,e,t,r)??o))}reverse(){return this._deriveString(e=>e.split("").reverse().join(""))}rpad(e,t=" "){return this._deriveString(r=>r.padEnd(e,t))}slice(e,t){return this._deriveString(r=>{let o=e<0?r.length+e:e,i=t!==void 0?o+t:void 0;return r.slice(o,i)})}split(e,t){return this._deriveString(r=>ts(r,e,t))}starts_with(e){return this._deriveString(t=>t.startsWith(e))}strip_chars(e,t){return this._deriveString(r=>ft(r,e,{mode:"both",...t}))}strip_chars_end(e,t){return this._deriveString(r=>ft(r,e,{mode:"end",...t}))}strip_chars_start(e,t){return this._deriveString(r=>ft(r,e,{mode:"start",...t}))}strip_prefix(e){return this._deriveString(t=>ft(t,e,{mode:"start",maxScanStart:1,maxMatchesStart:1,returnStringOnNull:!0,stringOptions:{literal:!0}}))}strip_suffix(e){return this._deriveString(t=>ft(t,e,{mode:"end",maxScanEnd:1,maxMatchesEnd:1,returnStringOnNull:!0,stringOptions:{literal:!0}}))}tail(e=1){return this.slice(-e)}strptime(e){return this._deriveString(t=>hs(t,e))}to_camelcase(){return this._deriveString(e=>mt(e,{format:"camel"}))}to_date(){return this._deriveString(e=>J(e,{dateOnly:!0}))}to_datetime(){return this._deriveString(J)}to_decimal(e,t){return this._deriveString(r=>sn(r,{precision:e,scale:t}))}to_integer(){return this._deriveString(e=>se(e))}to_kebabcase(){return this._deriveString(e=>mt(e,{format:"kebab"}))}to_lowercase(){return this.lower()}to_pascalcase(){return this._deriveString(e=>mt(e,{format:"pascal"}))}to_snakecase(){return this._deriveString(e=>mt(e,{format:"snake"}))}to_time(){return this._deriveString(wn)}to_titlecase(){return this._deriveString(e=>mt(e,{format:"title"}))}to_uppercase(){return this.upper()}trim(){return this.strip_chars()}trim_end(){return this.strip_chars_end()}trim_start(){return this.strip_chars_start()}upper(){return this._deriveString(e=>e.toUpperCase())}zfill(e){return this._deriveString(t=>t.padStart(e,"0"))}},Kt=class extends ${get str(){return new qn(this)}}});var qt,ao=R(()=>{"use strict";ce();ue();X();z();qt=class extends ${_deriveAgg(e){let t=T(this);return t._aggFn=e,t._groupingOpsIndex=this._ops.length,t._partitionOpsIndex=this._ops.length,t}_deriveAggBinary(e,t){return T(this,V(this,e,(r,o)=>[r,o]))._deriveAgg(t)}all(){return this._deriveAgg(e=>ee(e,t=>!!t,{mode:"every"}))}all_null(){return this._deriveAgg(e=>ee(e,"nullish",{mode:"every"}))}any(){return this._deriveAgg(e=>ee(e,t=>!!t,{mode:"some"}))}any_null(){return this._deriveAgg(e=>ee(e,"nullish",{mode:"some"}))}arg_max(){return this._deriveAgg(e=>B(e).maxIdx)}arg_min(){return this._deriveAgg(e=>B(e).minIdx)}avg(){return this._deriveAgg(e=>B(e).mean)}bitwise_and(){return this._deriveAgg(e=>pn(e,(t,r)=>t&r))}bitwise_or(){return this._deriveAgg(e=>pn(e,(t,r)=>t|r))}bitwise_xor(){return this._deriveAgg(e=>pn(e,(t,r)=>t^r))}corr(e){return this._deriveAggBinary(e,t=>br(t)?.correlation??null)}count(e={}){return e.includeNulls?this._deriveAgg(t=>t.length):this._deriveAgg(t=>B(t).count)}cov(e){return this._deriveAggBinary(e,t=>br(t)?.covariance??null)}dot(e){return this._deriveAggBinary(e,t=>Ei(t))}entropy(e={base:Math.E,normalize:!0}){return this._deriveAgg(t=>Mi(t,e))}first(){return this._deriveAgg(e=>e[0]??null)}implode(){return this._deriveAgg(e=>e)}kurtosis(e={}){return this._deriveAgg(t=>Ni(t,e))}last(){return this._deriveAgg(e=>e[e.length-1]??null)}max(){return this._deriveAgg(e=>B(e).max)}max_by(e){return this._deriveAggBinary(e,t=>wr(t,"maxIdx"))}mean(){return this.avg()}median(){return this._deriveAgg(e=>ct(e))}min(){return this._deriveAgg(e=>B(e).min)}min_by(e){return this._deriveAggBinary(e,t=>wr(t,"minIdx"))}mode(){return this._deriveAgg(e=>fn(e))}n_unique(e={}){return this._deriveAgg(t=>Ke(t,e).count)}nan_max(){return this._deriveAgg(e=>B(e).nanMax)}nan_min(){return this._deriveAgg(e=>B(e).nanMin)}null_count(){return this._deriveAgg(e=>B(e).nullCount)}quantile(e){if(e<0||e>1)throw new ne("Quantile q must be between 0 and 1");return this._deriveAgg(t=>cn(t,e))}product(){return this._deriveAgg(e=>B(e).product)}skew(e={}){return this._deriveAgg(t=>ki(t,e))}spearman_corr(e){return this._deriveAggBinary(e,t=>Oi(t))}std(){return this._deriveAgg(e=>B(e).std)}sum(){return this._deriveAgg(e=>B(e).sum)}variance(){return this._deriveAgg(e=>B(e).variance)}w_avg(e){return this._deriveAggBinary(e,t=>Ii(t))}}});function lo(n,e,t={}){if(e==null)return null;let r=t.dense?"_denseRankCache":"_rankCache",o=n[r];if(!o){let i=n;if(t.ignoreNulls){i=[];let l=n.length;for(let u=0;u<l;u++)n[u]!=null&&i.push(n[u])}t.dense&&(i=Array.from(new Set(i)));let s=It(i);o=new Map;let a=s.length;for(let l=0;l<a;l++){let u=s[l];o.has(u)||o.set(u,l+1)}n[r]=o}return o.get(e)??null}var zt,uo=R(()=>{"use strict";ce();z();zt=class extends ${_partitionBy=this._partitionBy||null;_window(e){let t=T(this);return t._partitionOpsIndex=this._ops.length,t._groupingOpsIndex=this._ops.length,t._evaluateWindow=e,t}_rolling(e,t){return this._window(function(r,o,i){let s=Math.max(0,i-e+1),a=i+1,l=r.slice(s,a);return t(l)})}_cum(e,t,r,o){return this._window(function(i,s,a){let l=t,u=!1,c=e?a:0,f=e?i.length-1:a;for(let m=c;m<=f;m++){let h=i[m];h!=null&&(l=r(l,h),u=!0)}return o?o(l,u):l})}get _isWindow(){return this._partitionBy!==null||this._evaluateWindow!==void 0||this._aggFn!==null}cum_count(e=!1){return this._cum(e,0,t=>t+1)}cum_max(e=!1){return this._cum(e,null,(t,r)=>t===null||r>t?r:t)}cum_min(e=!1){return this._cum(e,null,(t,r)=>t===null||r<t?r:t)}cum_prod(e=!1){return this._cum(e,1,(t,r)=>t*r,(t,r)=>r?t:null)}cum_sum(e=!1){return this._cum(e,0,(t,r)=>t+r)}dense_rank(){return this._window(function(e,t,r){return lo(e,e[r],{dense:!0})})}lag(e=1,t=null){return this._window(function(r,o,i){let s=t;return i-e>=0&&(s=r[i-e]),s})}lead(e=1,t=null){return this._window(function(r,o,i){let s=t;return i+e<r.length&&(s=r[i+e]),s})}over(e){let t=T(this),r=Array.isArray(e)?e:[e];return t._partitionBy=r,t}rank(){return this._window(function(e,t,r){return lo(e,e[r])})}rolling_max(e){return this._rolling(e,t=>B(t).max)}rolling_mean(e){return this._rolling(e,t=>B(t).mean)}rolling_median(e){return this._rolling(e,t=>ct(t))}rolling_min(e){return this._rolling(e,t=>B(t).min)}rolling_quantile(e,t){return this._rolling(t,r=>cn(r,e))}rolling_rank(e){return this._rolling(e,t=>lo(t,t[t.length-1],{ignoreNulls:!0}))}rolling_std(e){return this._rolling(e,t=>B(t).std)}rolling_sum(e){return this._rolling(e,t=>B(t).sum)}row_number(){let e=this._window(function(t,r,o){return o+1});return e._outputName="row_number",e}}});var zn,Gt,co=R(()=>{"use strict";ce();ue();z();Te();X();zn=class{constructor(e){this.expr=e}expr;_deriveArray(e){return T(this.expr,I(t=>k(t)?e(t):null))}agg(e){return T(this.expr,(t,r)=>{let o=t.length,i=new Array(o),s=Object.create(r);for(let a=0;a<o;a++){let l=t[a];if(!k(l)){i[a]=null;continue}let u=l.length;s[We]=l;let c=pe(e,s,u);i[a]=k(c)?c[0]??null:c}return i})}all(){return this._deriveArray(e=>ee(e,t=>!!t,{mode:"every"}))}any(){return this._deriveArray(e=>ee(e,t=>!!t,{mode:"some"}))}arg_max(){return this._deriveArray(e=>B(e).maxIdx)}arg_min(){return this._deriveArray(e=>B(e).minIdx)}contains(e){return this._deriveArray(t=>Array.prototype.includes.call(t,e))}contains_all(e){return this._deriveArray(t=>ee(e,r=>Array.prototype.includes.call(t,r),{mode:"every"}))}contains_any(e){return this._deriveArray(t=>ee(e,r=>Array.prototype.includes.call(t,r),{mode:"some"}))}count_matches(e,t={}){return this._deriveArray(r=>Ke(r,t).frequencies.get(e)??0)}filter(e){return T(this.expr,(t,r)=>{let o=t.length,i=new Array(o),s=Object.create(r);for(let a=0;a<o;a++){let l=t[a];if(!k(l)){i[a]=null;continue}let u=l.length;s[We]=l;let c=pe(e,s,u),f=[];if(k(c)){let m=Math.min(u,c.length);for(let h=0;h<m;h++)c[h]&&f.push(l[h])}else if(c)for(let m=0;m<u;m++)f.push(l[m]);i[a]=f}return i})}explode({empty_as_null:e=!0,keep_nulls:t=!0}={}){return T(this.expr,r=>{let o=r.length,i=0;for(let u=0;u<o;u++){let c=r[u];if(k(c)){i+=c.length||(e?1:0);continue}if(c!=null){i+=1;continue}t&&(i+=1)}let s=new Array(i),a=new Int32Array(i),l=0;for(let u=0;u<o;u++){let c=r[u];if(k(c)){let f=c.length;if(f>0){for(let m=0;m<f;m++)a[l]=u,s[l++]=c[m];continue}e&&(a[l]=u,s[l++]=null);continue}if(c!=null){a[l]=u,s[l++]=c;continue}t&&(a[l]=u,s[l++]=null)}return s.rowMap=a,s})}first(e=!0){return this.get(0,e)}gather(e,t=!0){return this._deriveArray(r=>{let o=typeof e=="number"?[e]:e,i=o.length,s=new Array(i);for(let a=0;a<i;a++)s[a]=an(r,o[a],t);return s})}gather_every(e={}){return this._deriveArray(t=>ln(t,e))}get(e,t=!0){return this._deriveArray(r=>an(r,e,t))}join(e=",",t={}){return this._deriveArray(r=>un(r,e,t))}last(e=!0){return this.get(-1,e)}len(){return this.lengths()}lengths(){return this._deriveArray(e=>e.length)}max(){return this._deriveArray(e=>B(e).max)}mean(){return this._deriveArray(e=>B(e).mean)}median(){return this._deriveArray(e=>ct(e))}min(){return this._deriveArray(e=>B(e).min)}mode(){return this._deriveArray(e=>fn(e))}n_unique(e={}){return this._deriveArray(t=>Ke(t,e).count)}reverse(){return this._deriveArray(e=>e.slice().reverse())}shift(e=1){return this._deriveArray(t=>Di(t,e))}slice(e,t){return this._deriveArray(r=>r.slice(e,t))}splice(e,t,...r){return this._deriveArray(o=>{let i=[...o];return i.splice(e,t??i.length,...r),i})}sort(e){return this._deriveArray(t=>It(t,e))}std(){return this._deriveArray(e=>B(e).std)}sum(){return this._deriveArray(e=>B(e).sum)}to_struct({upper_bound:e,fields:t}={}){return T(this.expr,r=>{let o=r.length,i=new Array(o),s=0;if(Array.isArray(t))s=t.length;else if(typeof e=="number")s=e;else for(let l=0;l<o;l++){let u=r[l];k(u)&&u.length>s&&(s=u.length)}if(s===0)throw new ne("to_struct cannot be evaluated: struct width is 0. Provide an upper_bound, non-empty fields names, or non-empty lists.");let a=new Array(s);for(let l=0;l<s;l++)typeof t=="function"?a[l]=t(l):a[l]=(Array.isArray(t)?t[l]:null)??`field_${l}`;for(let l=0;l<o;l++){let u=r[l];if(!k(u)){i[l]=null;continue}let c={};for(let f=0;f<s;f++)c[a[f]]=an(u,f,!0);i[l]=c}return i})}unique(e={}){return this._deriveArray(t=>Ke(t,e).values)}variance(){return this._deriveArray(e=>B(e).variance)}eval(e){return T(this.expr,(t,r)=>{let o=t.length,i=new Array(o);for(let s=0;s<o;s++){let a=t[s];if(!k(a)){i[s]=null;continue}let l=a.length,u={...r,[We]:a};if(e._aggFn!=null&&(e._partitionBy==null||e._partitionBy.length===0)){let f=e._groupingOpsIndex!==void 0?e._groupingOpsIndex:e._ops.length,m=e._evaluatePre(f,u,l),h=e._aggFn(Array.from(m));i[s]=e._evaluatePost(f,[h],u)}else i[s]=pe(e,u,l)}return i})}},Gt=class extends ${get arr(){return new zn(this)}}});function Is(n){return Pt(n,"Column reference cannot be null or undefined."),Gn||(Gn=(he(),or(Cs)).ColumnExpr),Gn.isColExpr(n)?n:new Gn(n)}var Gn,Jn,Jt,fo=R(()=>{"use strict";ce();X();Gn=null;Jn=class{constructor(e){this.expr=e;return new Proxy(this,{get(t,r,o){return r in t?Reflect.get(t,r,o):typeof r=="string"?t.field(r):Reflect.get(t,r,o)}})}expr;field(e){let t=T(this.expr,r=>{let o=r.length,i=new Array(o);for(let s=0;s<o;s++){let a=r[s];i[s]=a!=null&&typeof a=="object"?a[e]:null}return i});return t._baseExpr=this.expr,t._fieldName=e,t.alias(e)}rename_fields(e){return T(this.expr,t=>{let r=t.length,o=new Array(r),i=Object.keys(e),s=i.length;for(let a=0;a<r;a++){let l=t[a];if(l==null||typeof l!="object"){o[a]=null;continue}let u={},c=Object.keys(l),f=c.length;for(let m=0;m<f;m++){let h=c[m];u[h]=l[h]}for(let m=0;m<s;m++){let h=i[m];if(h in u){let p=e[h];u[p]=u[h],delete u[h]}}o[a]=u}return o})}with_fields(e){return T(this.expr,(t,r)=>{let o=t.length,i=new Array(o),s=[];if(Array.isArray(e)){let u=e.length;for(let c=0;c<u;c++){let f=e[c],m=Is(f),h=m._outputName||m._colName;if(!h)throw new M("Expressions passed to struct.with_fields must have a name/alias.");s.push({name:h,expr:m})}}else if(e&&typeof e=="object"){let u=Object.keys(e),c=u.length;for(let f=0;f<c;f++){let m=u[f],h=Is(e[m]);s.push({name:m,expr:h})}}let a=s.length,l=new Array(a);for(let u=0;u<a;u++)l[u]=s[u].expr.evaluate(r,o);for(let u=0;u<o;u++){let c=t[u];if(c==null||typeof c!="object"){i[u]=null;continue}let f={},m=Object.keys(c),h=m.length;for(let p=0;p<h;p++){let d=m[p];f[d]=c[d]}for(let p=0;p<a;p++)f[s[p].name]=l[p][u];i[u]=f}return i})}unnest(){let e=T(this.expr);return e._isUnnest=!0,e._baseExpr=this.expr,e}},Jt=class extends ${get struct(){return new Jn(this)}}});var Wn,Rs=R(()=>{"use strict";ce();z();X();Wn=class extends ${fill_null({value:e=void 0,strategy:t=void 0,limit:r=void 0}={}){return T(this,(o,i)=>{let s=o.length,a=Array.from(o);if(t!==void 0)if(t==="zero"||t==="one"||t==="min"||t==="max"||t==="mean"){let l;t==="zero"?l=0:t==="one"?l=1:l=B(o)[t],Xe(a,l,{mode:"constant",condition:u=>u==null})}else if(t==="forward"||t==="backward"){let l=t==="forward",u=null,c=0;Xe(a,null,{mode:"independent",reverse:!l,step:({originalValue:f})=>f!=null?(u=f,c=0,f):u!==null&&(r===void 0||c<r)?(c++,u):null})}else throw new M(`Unsupported fill_null strategy: "${t}"`);else{let l=this._resolve(e,i,s),u=k(l);Xe(a,null,{mode:"independent",step:({index:c,originalValue:f})=>f??(u?l[c]:l)})}return a})}reverse(){return T(this,e=>e.slice().reverse())}}});var Cs={};rr(Cs,{ColumnExpr:()=>U,resolveColumnSelectors:()=>je});function Al(n,e){for(let t of e)for(let r of Object.getOwnPropertyNames(t.prototype))r!=="constructor"&&Object.defineProperty(n.prototype,r,Object.getOwnPropertyDescriptor(t.prototype,r)||Object.create(null))}function Sl(n,e,t,r){if(!(n instanceof U)){if(F(n)&&"evaluate"in n&&!n._colName){let o=[];for(let i=0;i<e.length;i++)t.has(e[i])||o.push(e[i]);return o}return null}if(n._colNames&&n._colNames.length>0)return n._colNames;if(n._colName==="*"){let o=new Set(n._excludedCols),i=[];for(let s=0;s<e.length;s++){let a=e[s];!o.has(a)&&!t.has(a)&&i.push(a)}return i}if(n._targetType||n._targetTypes&&n._targetTypes.length>0){if(!r)throw new Je("Cannot resolve DataType column selector without DataFrame schema.");let o=[];for(let i=0;i<e.length;i++){let s=e[i];if(t.has(s))continue;let a=r[s];if(a){if(n._targetType)a.matches(n._targetType)&&o.push(s);else if(n._targetTypes){for(let l=0;l<n._targetTypes.length;l++)if(a.matches(n._targetTypes[l])){o.push(s);break}}}}return o}return null}function je(n,e,t,r,o){let i=[],s=t?new Set(t):new Set;for(let a=0;a<n.length;a++){let l=n[a];if(typeof l=="string"){i.push(new U(l));continue}if(F(l)&&l._isUnnest&&l._baseExpr){let c=l._baseExpr,f=[],m=l._colName;if(typeof m=="string"&&r&&r[m]&&r[m].name==="Struct"&&(f=Object.keys(r[m].fields)),f.length===0&&o){let d=Object.keys(o)[0],g=d?o[d].length:0,y=c.evaluate(o,g),_=y.length;for(let S=0;S<_;S++){let b=y[S];if(b!=null&&typeof b=="object"){f=Object.keys(b);break}}}let h=f.length;if(h>0){for(let p=0;p<h;p++){let d=f[p],g=c.struct.field(d);i.push(g)}continue}}let u=Sl(l,e,s,r);if(u!==null)for(let c=0;c<u.length;c++){let f=new U(u[c]);f._ops=[...l._ops||[]],f._aggFn=l._aggFn,f._partitionOpsIndex=l._partitionOpsIndex,f._groupingOpsIndex=l._groupingOpsIndex,f._partitionBy=l._partitionBy,l._evaluateWindow&&(f._evaluateWindow=l._evaluateWindow),l._outputName&&l._outputName!=="*"&&(f._outputName=l._outputName),i.push(f)}else i.push(l)}return i}var U,he=R(()=>{"use strict";ce();ro();io();ao();uo();so();oo();mo();co();fo();Rs();z();Ne();X();U=class n extends ${_colName="";_colNames;_excludedCols=[];_targetType;_targetTypes;static isColExpr(e){if(!F(e))return!1;try{return"evaluate"in e&&typeof e.evaluate=="function"}catch{return!1}}static toColExpr(e){return Pt(e,"Column reference cannot be null or undefined."),n.isColExpr(e)?e:new n(e)}constructor(e){super(),Array.isArray(e)?e.some(r=>r instanceof Z||typeof r=="function")?this._targetTypes=e:this._colNames=e.map(String):e instanceof Z||typeof e=="function"?this._targetType=e:(this._colName=String(e),this._outputName=this._colName)}};Al(U,[Lt,$t,qt,zt,Kt,Vt,Wt,Gt,Jt,Wn])});function ot(n,e={strict:!0}){let t=e,r=new U(ir);return r._literalValue=n,t.name&&(r._outputName=t.name),r._ops.push(o=>{let i=o.length,s=(x,A)=>x===void 0?A:Ce(x<0?i+x:x,{min:0,max:i}),a=s(t.startIndex,0),l=s(t.endIndex,i),u=Math.max(0,l-a),c=t.n!==void 0?t.n:u,f=t.strict!==!1;if(f){if(c!==i)throw new re(`Column height mismatch: seq_range length ${c} does not match DataFrame height ${i}`)}else{let x=t.pad??!1,A=t.truncate??!1;if(x&&!A&&c>u)throw new re(`Cannot pad seq_range output: specified length ${c} starting at index ${a} exceeds slice width ${u} (requires truncation).`);if(A&&!x&&c<u)throw new re(`Cannot truncate seq_range output: specified length ${c} starting at index ${a} is less than slice width ${u} (requires padding).`)}let m=i,h=!!t.dtype,p=t.mode||"cumulative",d=t.step!==void 0?t.step:1,g=h?x=>t.dtype.coerce(x):x=>x;if(f){let x=t.dtype?.allocate?t.dtype.allocate(m):new Array(m);return Xe(x,n,{mode:p,step:d,coerce:g,startIndex:0,endIndex:m}),x}let y=Math.min(a+c,l),_=t.padValue!==void 0?t.padValue:null,S=g(_);if(p==="constant"&&a===0&&y===m&&!t.dtype){let x=new Array(m);for(let A=0;A<m;A++)x[A]=n;return x}let b=new Array(m);return b.fill(S),Xe(b,n,{mode:p,step:d,coerce:g,startIndex:a,endIndex:y}),b}),r}var po=R(()=>{"use strict";he();Te();X();z()});function it(n,e){let t=ot(n,{strict:!0,mode:"constant",dtype:e?.dtype,name:e?.name});return t._isLiteral=!0,t}var Xn=R(()=>{"use strict";po()});var ks={};rr(ks,{duration:()=>Hn});function Hn(n={}){let e=n.timeUnit??"ms",t=[],r=[[n.weeks,Lo],[n.days,Le],[n.hours,Dt],[n.minutes,_e],[n.seconds,lt],[n.milliseconds,Vo],[n.microseconds,$o],[n.nanoseconds,Ko]];for(let[i,s]of r)if(i!=null){let a=v(i)?it(i):U.toColExpr(i);t.push({expr:a,multiplier:s})}if(t.length===0)throw new M("At least one duration component must be specified for $df.duration().");let o=new U(lr);return o._castType=new me(e),o._ops.push((i,s)=>{let a=i?i.length:0;if(a===0&&s){let f=Object.keys(s)[0];f&&k(s[f])&&(a=s[f].length)}a===0&&(a=1);let l=new Float64Array(a),u=new Uint8Array(a);for(let f=0;f<t.length;f++){let{expr:m,multiplier:h}=t[f],p=pe(m,s,a);if(k(p)){let d=p,g=d.length;for(let y=0;y<a;y++){if(u[y]===1)continue;let _=j(y<g?d[y]:g===1?d[0]:null);_!=null?l[y]+=_*h:(u[y]=1,l[y]=0)}}else{let d=j(p);if(d!=null){let g=d*h;for(let y=0;y<a;y++)u[y]!==1&&(l[y]+=g)}else{u.fill(1),l.fill(0);break}}}let c=new Array(a);for(let f=0;f<a;f++)if(u[f]===1)c[f]=null;else{let m=Math.round(l[f]*1e6)/1e6;c[f]=ws(m,e)}return c}),o.alias("duration")}var ho=R(()=>{"use strict";he();Xn();Te();ue();xt();X();z();xe()});var Yn,Wt,mo=R(()=>{"use strict";xt();X();ce();ue();z();xe();Yn=class{constructor(e){this.expr=e}expr;_colTz(){let e=this.expr._castType;return e instanceof Ae?e.timeZone:null}_colTu(){let e=this.expr._castType;return e instanceof Ae?e.timeUnit:null}_deriveDate(e){return T(this.expr,I(t=>{let r=J(t);return r?e(r):null}))}cast_time_unit(e){return this.expr.cast(new Ae(e,this._colTz()))}century(){return this._deriveDate(cs)}convert_time_zone(e){let t=this._colTz();if(this.expr._castType instanceof Ae&&t===null)throw new M('convert_time_zone() requires a timezone-aware Datetime column. Use .dt.replace({ timeZone: "..." }) to assign a timezone first.');return this.expr.cast(new Ae(this._colTu()??"ms",e))}date(){return this._deriveDate(e=>new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())))}day(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>ae(r,t).day)}days_in_month(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>{let o=ae(r,t),i=An(te(o.year,o.month-1,1),1,0);return i?i.getUTCDate():null})}epoch(e="ms"){return this._deriveDate(t=>us(t,e))}hour(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>ae(r,t).hour)}is_business_day(e={}){return this._deriveDate(t=>gs(t,e))}is_leap_year(){return this._deriveDate(Rr)}iso_week(){return this._deriveDate(e=>Ir(e,{field:"week"}))}iso_year(){return this._deriveDate(e=>Ir(e,{field:"year"}))}microsecond(){return this.millisecond().mul(pr)}millennium(){return this._deriveDate(fs)}millisecond(){return this._deriveDate(e=>e.getUTCMilliseconds())}minute(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>ae(r,t).minute)}month(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>ae(r,t).month)}month_end(){return this._deriveDate(e=>An(e,1,0))}month_start(){return this._deriveDate(e=>An(e,0,1))}nanosecond(){return this.millisecond().mul(hr)}offset_day(e,t={}){let o=t?.excludeWeekdays?.length||t?.holidays||t?.roll?T(this.expr,V(this.expr,e,(s,a)=>{let l=J(s);return l?ds(l,a,t):null})):e,{duration:i}=(ho(),or(ks));return this.expr.add(i({days:o}))}ordinal_day(){return this._deriveDate(Cr)}quarter(){return this._deriveDate(ms)}replace(e){return T(this.expr,I(t=>{let r=J(t);return r?ys(r,e):null}))}second(){return this._deriveDate(e=>e.getUTCSeconds())}strftime(e){let t=this._colTz(),r=t&&!e.timeZone?{...e,timeZone:t}:e;return this._deriveDate(o=>Ye(o,r))}time(){return this._deriveDate(e=>e.toISOString().split("T")[1].slice(0,12))}timestamp(e="ms"){return this.epoch(e)}total_days(){return this.expr.div(Le)}total_hours(){return this.expr.div(Dt)}total_microseconds(){return this.expr.mul(pr)}total_milliseconds(){return this.expr}total_minutes(){return this.expr.div(_e)}total_nanoseconds(){return this.expr.mul(hr)}total_seconds(){return this.expr.div(lt)}utc_offset(e,t={}){return T(this.expr,I(r=>{let o=J(r);return o?Nr(o,e,t):null}))}week(){return this.iso_week()}weekday(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>ae(r,t).dayOfWeek||7)}year(e){let t=e||this._colTz()||"UTC";return this._deriveDate(r=>ae(r,t).year)}},Wt=class extends ${get dt(){return new Yn(this)}}});function At(){return new U("*")}var Ns=R(()=>{"use strict";he()});function go(n){let e=new U("*");return e._excludedCols=Array.isArray(n)?n:[n],e}var Ms=R(()=>{"use strict";he()});function yo(...n){let e=n.length===1&&Array.isArray(n[0])?n[0]:n,t=new U(sr);return t._ops.push((r,o)=>{let i=r.length,s=e.length,a=new Array(s),l=new Array(s);for(let c=0;c<s;c++){let f=e[c],m=nt(f,o,i);a[c]=m,l[c]=rt(f,m,o,i)}let u=new Array(i);for(let c=0;c<i;c++){let f=null;for(let m=0;m<s;m++){let h=a[m],p=l[m]?h[c]:h;if(p!=null){f=p;break}}u[c]=f}return u}),t}var Us=R(()=>{"use strict";he();ue();Te()});function _o(n){return new Qn(n)}var Zn,Qn,Xt,vs=R(()=>{"use strict";he();ue();Te();Zn=class{_predicates;_values;constructor(e,t){this._predicates=e,this._values=t}then(e){return new Xt(this._predicates,this._values.concat(e))}},Qn=class{_predicates;constructor(e){this._predicates=[e]}then(e){return new Xt(this._predicates,[e])}},Xt=class n extends U{_predicates;_values;_otherwise;get _otherwiseValue(){return this._otherwise}get _branchOperands(){return this._otherwise!=null?[...this._values,this._otherwise]:this._values}constructor(e=[],t=[],r=null){super(ur),this._predicates=Array.isArray(e)?e:[],this._values=t||[],this._otherwise=r,this._ops=[(o,i)=>{let s=o.length,a=this._predicates,l=this._values,u=a.length,c=new Array(u),f=new Array(u),m=new Array(u),h=new Array(u);for(let _=0;_<u;_++){let S=a[_],b=l[_],x=nt(S,i,s),A=nt(b,i,s);c[_]=x,f[_]=A,m[_]=rt(S,x,i,s),h[_]=rt(b,A,i,s)}let p=this._otherwise,d=nt(p,i,s),g=rt(p,d,i,s),y=new Array(s);for(let _=0;_<s;_++){let S=!1;for(let b=0;b<u;b++)if((m[b]?c[b][_]:c[b])===!0){y[_]=h[b]?f[b][_]:f[b],S=!0;break}S||(y[_]=g?d[_]:d)}return y}]}when(e){return new Zn(this._predicates.concat(e),this._values)}otherwise(e){return new n(this._predicates,this._values,e)}}});function xo(n){return U.toColExpr(n).implode()}var Fs=R(()=>{"use strict";he()});function bo(){return new U(We)}var js=R(()=>{"use strict";he();Te()});function wo(n,...e){let t;Array.isArray(n)||n&&typeof n=="object"&&!U.isColExpr(n)?t=n:t=[n,...e];let r=it({}).struct.with_fields(t);return delete r._isLiteral,delete r._literalValue,r._colName=ar,r.alias("struct")}var Bs=R(()=>{"use strict";he();Xn();Te()});function st(n,e){if(n==null)return;if(n instanceof Z)return n;if(typeof n=="object"&&("_ops"in n||"_literalValue"in n||"_targetType"in n))return St(n,e);let t=ie(n);if(typeof t=="string")return e[t]??E.Utf8;if(typeof t=="boolean")return E.Boolean;if(typeof t=="bigint")return on(t,{range:"Int64"})?E.Int64:E.UInt64;if(v(t))return Ee(t,{range:"Int32"})?E.Int32:Number.isInteger(t)?E.Int64:E.Float64;if(P(t))return E.Datetime;if(Sr(t,{strict:!0}))return E.Binary;if(Array.isArray(t)){let r,o=t.length;for(let i=0;i<o;i++){let s=t[i];if(s!=null&&(r=st(s,e)))break}return E.Array(r??E.Utf8)}if(K(t)){let r=Be?Be.call(t):t.constructor.name,o=Tl[r];return o?E.Array(o):E.Binary}if(F(t))return E.Object}function Ao(n,e,t){if(!n||!e)return;if(t&&t.length>0){let a=!1;for(let l=0;l<t.length;l++){let u=t[l];if(u!=null){if(typeof u!="boolean"){a=!1;break}a=!0}}if(a)return E.Boolean}let r=n instanceof me,o=e instanceof me,i=n.isTemporal&&!r,s=e.isTemporal&&!o;if(i||s){if(i&&s){let a=n.timeUnit||e.timeUnit||"ms";return new me(a)}return i?n:e}if(r||o)return r?n:e;if(n.isUtf8||e.isUtf8)return E.Utf8;if(n.isNumeric&&e.isNumeric){let a=n instanceof et||e instanceof et,l=n instanceof Qe||e instanceof Qe,u=n instanceof ke||e instanceof ke;if(a||l&&u)return E.Float64;if(l)return E.Float32;if(u)return n instanceof ke?n:e;if(t!==void 0){let m={range:{min:-1/0,max:1/0}},h=t.length;for(let p=0;p<h;p++){let d=t[p];if(v(d)&&!Ee(d,m))return E.Float64}}if(n===e)return n;let c=n.name,f=e.name;return c.endsWith("64")||f.endsWith("64")?E.Int64:c.endsWith("32")||f.endsWith("32")?c==="UInt32"&&f==="UInt32"?E.UInt32:E.Int32:c.endsWith("16")||f.endsWith("16")?c==="UInt16"&&f==="UInt16"?E.UInt16:E.Int16:c==="UInt8"&&f==="UInt8"?E.UInt8:E.Int8}}function St(n,e,t){if(!n)return;if(n._castType)return n._castType;if(n._targetType instanceof Z)return n._targetType;if(n._isLiteral&&n._literalValue!==void 0)return st(n._literalValue,e);if(n._binaryMeta)return Ao(st(n._binaryMeta.left,e),st(n._binaryMeta.right,e),t);if(n._branchOperands){let s,a=n._branchOperands.length;for(let l=0;l<a;l++){let u=st(n._branchOperands[l],e);u&&(s?s!==u&&s.isNumeric&&u.isNumeric&&(s=Ao(s,u,t)??s):s=u)}if(s)return s}if(n._baseExpr&&n._fieldName){let s=st(n._baseExpr,e);if(s instanceof yt)return s.fields?.[n._fieldName]}let r=n._colName?e[n._colName]:void 0,o=t?.[0],i=(!n._ops||n._ops.length===0)&&!n._aggFn;if(r){if(r instanceof tt&&(n._isUnnest||t?.rowMap))return r.innerType;if(!(r instanceof tt)&&Array.isArray(o))return E.Array(r);if(i||r.isTemporal&&n._aggFn&&(P(o)||typeof o=="string")||r instanceof me&&n._aggFn&&v(o))return r}if(n._aggFn&&v(o))return!Number.isInteger(o)||r?.isNumeric&&!(r instanceof me)?E.Float64:E.Int32}var Tl,Ps=R(()=>{"use strict";xt();Ne();z();Tl={Float64Array:E.Float64,Float32Array:E.Float32,Int32Array:E.Int32,Int16Array:E.Int16,Int8Array:E.Int8,BigInt64Array:E.Int64,BigUint64Array:E.UInt64,BigUint64:E.UInt64,Uint32Array:E.UInt32,Uint16Array:E.UInt16}});var Ht=R(()=>{"use strict";Te();To();ce();ro();oo();io();so();ao();uo();mo();co();fo();he();Xn();Ns();Ms();Us();vs();Fs();po();js();Bs();ho();Ps();ue()});var Yt,Ls=R(()=>{"use strict";wt();Kn();Ht();Yt=class{_groups;_keys;_allKeys;_parentColumns;_parentHeight;_parentSchema;constructor(e,t,r,o,i,s){this._groups=e,this._keys=t,this._allKeys=r,this._parentColumns=o,this._parentHeight=i,this._parentSchema=s}to_dataframe(){let e=this._keys.length,t=new Array(e);for(let a=0;a<e;a++)t[a]=String(this._keys[a]);let r=this._groups.size,o={};for(let a=0;a<t.length;a++)o[t[a]]=new Array(r);let i=0;for(let a of this._groups.values()){if(a.length===0)continue;let l=a[0];for(let u=0;u<t.length;u++){let c=t[u],f=this._parentColumns[c][l];o[c][i]=f===void 0?null:f}i++}let s={};for(let a of t)s[a]=this._parentSchema[a];return L._createDirect(o,s,i)}agg(...e){let t=this._allKeys.length,r=new Array(t);for(let f=0;f<t;f++)r[f]=String(this._allKeys[f]);let o=this._keys.length,i=new Array(o);for(let f=0;f<o;f++)i[f]=String(this._keys[f]);let s=je(e.flat(),r,i,this._parentSchema,this._parentColumns),a=this._groups.size,l={};for(let f=0;f<i.length;f++)l[i[f]]=new Array(a);let u=0;for(let f of this._groups.values()){if(f.length===0)continue;let m=f[0];for(let h=0;h<i.length;h++){let p=i[h],d=this._parentColumns[p][m];l[p][u]=d===void 0?null:d}u++}for(let f=0;f<s.length;f++){let m=s[f],h=m._outputName||m._colName||"*";if(!m._aggFn)l[h]=m.evaluate(l,a);else{let p=m._evaluatePre(m._groupingOpsIndex,this._parentColumns,this._parentHeight),d=new Array(a),g=0;for(let y of this._groups.values()){if(y.length===0)continue;let _=new Array(y.length);for(let S=0;S<y.length;S++)_[S]=p[y[S]];d[g]=m._aggFn(_),g++}l[h]=m._evaluatePost(m._groupingOpsIndex,d,l)}}let c={};for(let f of i)c[f]=this._parentSchema[f];for(let f of s){let m=f._outputName||f._colName||"*",h=St(f,this._parentSchema,l[m])||Fe(l[m]);c[m]=h,l[m]=Se(l[m],h,u)}return L._createDirect(l,c,u)}}});function Dl(n,e,t){if(n==null)throw new q(`Invalid input to ${e} at index ${t}: item cannot be null or undefined.`);if(n instanceof L)return[n];if(Pe(n))return[new L(n)];if(k(n)){if(ee(n,L,{mode:"every"}))return n;if(ee(n,"plainObject",{mode:"every"}))return[new L(n)];let r=ee(n,L,{mode:"some"});for(let o=0;o<n.length;o++)if(r?!(n[o]instanceof L):!Pe(n[o]))throw new q(r?`Invalid input to ${e} at index ${t}, sub-index ${o}: nested array must contain only DataFrame instances.`:`Invalid input to ${e} at index ${t}, row ${o}: rows must be plain objects.`)}throw new q(`Invalid input to ${e} at index ${t}: expected DataFrame, row array, or column dictionary.`)}function Tt(n,{how:e="vertical",horizontal:t}={}){if(n==null)throw new q("Invalid input to concat: rawItems cannot be null or undefined.");let r=Array.isArray(n)?n:[n],o=[];for(let s=0;s<r.length;s++)o.push(...Dl(r[s],"concat",s));let i=t?.strict??!0;if(o.length===0)return L._createDirect({},{},0);if(o.length===1&&e!=="horizontal")return o[0];switch(e){case"vertical":{let s=[];for(let p=0;p<o.length;p++)o[p].height>0&&s.push(o[p]);if(s.length===0)return L._createDirect({},{},0);let a=s[0],l=Object.keys(a._columns);for(let p=0;p<o.length;p++){let d=o[p];if(d.height===0)continue;let g=Object.keys(d._columns);if(l.length!==g.length)throw new q(`[Strict Vertical] Column count mismatch at index ${p}.`);for(let y=0;y<l.length;y++){if(l[y]!==g[y])throw new q(`[Strict Vertical] Schema mismatch at position ${y} in DF ${p}. Expected column "${l[y]}", but found "${g[y]}".`);let _=a.schema[l[y]],S=d.schema[l[y]];if(_&&S&&!_.equals(S))throw new Je(`[Strict Type Check] Schema type mismatch for column "${l[y]}": expected ${_.name}, found ${S.name}.`)}}let u=0;for(let p of o)u+=p.height;let c={},f=o.length;for(let p=0;p<f;p++)if(o[p].height>0){c=o[p].schema;break}Object.keys(c).length===0&&f>0&&(c=o[0].schema);let m={};for(let p of l){let d=c[p],g=!1;for(let _ of o){let S=_._columns[p];if(!S){g=!0;break}if(!K(S)){for(let b=0;b<S.length;b++)if(S[b]==null){g=!0;break}}if(g)break}let y=d&&d.allocate?d.allocate(u):new Array(u).fill(null);g&&K(y)&&(y=new Array(u).fill(null)),m[p]=y}let h=0;for(let p of o){let d=p.height;if(d!==0){for(let g of l){let y=p._columns[g]||new Array(d).fill(null),_=m[g];if(K(_)&&K(y))_.set(y,h);else{let S=_;for(let b=0;b<d;b++)S[h+b]=y[b]}}h+=d}}return L._createDirect(m,c,u)}case"horizontal":{let s=o[0].height;for(let c=1;c<o.length;c++)o[c].height>s&&(s=o[c].height);let a=new Set;for(let c=0;c<o.length;c++){let f=o[c];if(i&&f.height!==s)throw new re(`[Horizontal] Row count mismatch at index ${c}. Expected ${s}, got ${f.height}. Set strict=false to allow padding.`);for(let m of Object.keys(f._columns)){if(a.has(m))throw new q(`[Horizontal] Duplicate column name "${m}" detected. Horizontal concat requires unique names.`);a.add(m)}}let l={},u={};for(let c of o){let f=c.height;Object.assign(u,c.schema);let m=Object.keys(c._columns),h=m.length;for(let p=0;p<h;p++){let d=m[p],g=c._columns[d];if(f===s)l[d]=K(g)?Array.from(g):g;else{let y=new Array(s);for(let _=0;_<f;_++)y[_]=g[_];for(let _=f;_<s;_++)y[_]=null;l[d]=y}}}return L._createDirect(l,u,s)}case"diagonal":{let s=new Set;for(let m of o)for(let h of Object.keys(m._columns))s.add(h);let a=Array.from(s),l=0;for(let m=0;m<o.length;m++)l+=o[m].height;let u={};for(let m of a){let h=null;for(let p of o){let d=p.schema[m];if(d){if(h===null)h=d;else if(!h.equals(d))throw new Je(`[Strict Type Check] Schema type mismatch for column "${m}": expected ${h.name}, found ${d.name}.`)}}u[m]=h||E.Utf8}let c={};for(let m=0;m<a.length;m++)c[a[m]]=new Array(l).fill(null);let f=0;for(let m=0;m<o.length;m++){let h=o[m],p=h.height;if(p!==0){for(let d=0;d<a.length;d++){let g=a[d],y=c[g],_=h._columns[g];if(_!==void 0)if(K(_)&&K(y))y.set(_,f);else{let S=y;for(let b=0;b<p;b++)S[f+b]=_[b]}else{let S=y;for(let b=0;b<p;b++)S[f+b]=null}}f+=p}}return L._createDirect(c,u,l)}}}var So=R(()=>{"use strict";wt();Ne();z();X()});var L,wt=R(()=>{"use strict";Ht();Ls();kt();Ne();z();X();So();Kn();L=class n{_columns;_height;_schema={};static _createDirect(e,t,r){Vn(e,r);let o=Object.create(n.prototype);return o._columns=e,o._schema=t,o._height=r,o}constructor(e,t,r){if(Array.isArray(e)){let{columns:o,height:i}=Yr(e);this._columns=o,this._height=i,t?this._applySchema(t):this._inferSchema();return}if(F(e)){this._columns=e,this._height=Vn(e,r),t?this._applySchema(t):this._inferSchema();return}this._columns={},this._height=0,t?this._applySchema(t):this._schema={}}_inferSchema(){let e={},t=Object.keys(this._columns),r=t.length;for(let o=0;o<r;o++){let i=t[o];e[i]=Fe(this._columns[i])}this._applySchema(e)}_applySchema(e){this._schema=e;let t=Object.keys(e),r={};for(let o of t){let i=e[o],s=this._columns[o];r[o]=s?Se(s,i,this._height):Se(new Array(this._height).fill(null),i,this._height)}this._columns=r}get columns(){return Object.keys(this._columns)}concat(e,t={}){let r=ee(e,n,{mode:"every",allowEmpty:!1})?e:[e];return Tt([this,...r],t)}drop(...e){let t=new Set(e.flat()),r={},o={};for(let i of Object.keys(this._columns))t.has(i)||(r[i]=this._columns[i],o[i]=this._schema[i]);return n._createDirect(r,o,this._height)}drop_nulls(e){return this._height===0?this:this.filter(e?new U(e).is_not_null():At().is_not_null())}get dtypes(){let e=Object.keys(this._columns),t=e.length,r=new Array(t);for(let o=0;o<t;o++)r[o]=this._schema[e[o]];return r}explode(e,t){let r=Array.isArray(e)?e:[e],o=this._normalizeArgs(r),i=je(o,Object.keys(this._columns),void 0,this._schema,this._columns),s=new Set,a=i.length;for(let f=0;f<a;f++){let m=i[f],h=m._colName||m._outputName;if(!h||h==="*")throw new q("Expression passed to explode must have a column name.");H(h,this._columns,"Explode column"),s.add(h)}let l=Object.keys(this._columns),u=[],c=l.length;for(let f=0;f<c;f++){let m=l[f];u.push(s.has(m)?new U(m).arr.explode(t):new U(m))}return this.select(...u)}fill_null(e={}){return this._height===0?this:this.with_columns(At().fill_null(e))}filter(...e){if(this._height===0)return n._createDirect({},this._schema,0);let t=this._height,r=Object.keys(this._columns),o=r.length,i=[],s=[],a=[],l=e.length;for(let g=0;g<l;g++){let y=e[g];typeof y=="function"?s.push(y):a.push(y)}let u=je(a,r,void 0,this._schema,this._columns),c=u.length;for(let g=0;g<c;g++)i.push(u[g].evaluate(this._columns,t));let f=[],m=0,h=null;if(s.length>0){let g=this._columns;h={};for(let y=0;y<o;y++){let _=r[y],S=g[_];Object.defineProperty(h,_,{get(){let b=S[m];return b===void 0?null:b},enumerable:!0,configurable:!0})}}for(let g=0;g<t;g++){let y=!0;for(let _=0;_<i.length;_++)if(!i[_][g]){y=!1;break}if(y){if(h){m=g;for(let _=0;_<s.length;_++)if(!s[_](h)){y=!1;break}}y&&f.push(g)}}let p=bt(this._columns,f),d=f.length;return n._createDirect(p,this._schema,d)}groupby(e){let t=be(e),r=new Map,o=this._height,i=$e(e,"string");for(let a=0;a<i.length;a++)H(i[a],this._columns,"Grouping key");for(let a=0;a<o;a++){let l=ve(this._columns,i,a),u=r.get(l);u===void 0&&r.set(l,u=[]),u.push(a)}let s=Object.keys(this._columns);return new Yt(r,t,s,this._columns,this._height,this._schema)}head(e=10){return this.limit(e,{offset:0,from:"start"})}clone(){let e={};for(let t of Object.keys(this._columns)){let r=this._columns[t];(Array.isArray(r)||K(r))&&(e[t]=r.slice())}return n._createDirect(e,{...this._schema},this._height)}get height(){return this._height}hstack(e,t={}){return this.concat(e,{how:"horizontal",horizontal:t})}insert_column(e,t,r){let o=U.toColExpr(r).alias(t),i=Object.keys(this._columns),s=i.length,a=[];for(let u=0;u<s;u++){let c=i[u];c!==t&&a.push(c)}let l=Math.max(0,Math.min(e,a.length));return a.splice(l,0,o),this.select(...a)}item(e,t){let r=this._height,o=Object.keys(this._columns),i=o.length;if(e===void 0&&t===void 0){if(r!==1||i!==1)throw new q("DataFrame.item() can only be called without arguments if the shape is (1, 1).");return this._columns[o[0]][0]}if(e===void 0||t===void 0)throw new q("DataFrame.item() requires both row and column to be specified if not empty.");if(e<0||e>=r)throw new re(`Row index ${e} is out of bounds for DataFrame height ${r}.`);let s;if(typeof t=="number"){if(t<0||t>=i)throw new re(`Column index ${t} is out of bounds for DataFrame width ${i}.`);s=o[t]}else if(s=t,this._columns[s]===void 0)throw new Me(s);return this._columns[s][e]}*iter_columns(){let e=Object.keys(this._columns),t=e.length,r=this._columns;for(let o=0;o<t;o++)yield r[e[o]]}*iter_rows({named:e=!1}={}){let t=Object.keys(this._columns),r=t.length,o=this._columns,i=this._height,s=new Array(r);for(let a=0;a<r;a++)s[a]=o[t[a]];if(e)for(let a=0;a<i;a++){let l={};for(let u=0;u<r;u++)l[t[u]]=s[u][a];yield l}else for(let a=0;a<i;a++){let l=new Array(r);for(let u=0;u<r;u++)l[u]=s[u][a];yield l}}join(e){let{other:t,on:r,leftOn:o,rightOn:i,how:s="inner",suffixes:a=["","_right"],join_nulls:l=!1,coalesce:u=!0,maintain_order:c="none"}=e;if(s==="cross"&&(r!==void 0||o!==void 0||i!==void 0))throw new M('Cannot specify "on", "leftOn", or "rightOn" when how is "cross". Cross joins produce a keyless Cartesian product.');if(r!==void 0&&(o!==void 0||i!==void 0))throw new M('Cannot specify both "on" and "leftOn"/"rightOn" in join(). Use either "on" or both "leftOn" and "rightOn".');if(o!==void 0&&i===void 0||o===void 0&&i!==void 0)throw new M('join() requires both "leftOn" and "rightOn" when specifying heterogeneous join keys.');if(s!=="cross"&&r===void 0&&o===void 0&&i===void 0)throw new M('join() requires either "on" or both "leftOn" and "rightOn" parameters.');let f=[],m=[];if(o!==void 0&&i!==void 0){if(f=$e(o,"string"),m=$e(i,"string"),f.length===0||m.length===0)throw new M('join() requires non-empty key arrays in "leftOn" and "rightOn".');if(f.length!==m.length)throw new M(`join() "leftOn" length (${f.length}) must match "rightOn" length (${m.length}).`)}else if(r!==void 0&&(f=$e(r,"string"),m=f,f.length===0))throw new M('join() requires at least one key column in "on".');for(let y=0;y<f.length;y++)H(f[y],this._columns,"Join key"," in the left DataFrame."),H(m[y],t._columns,"Join key"," in the right DataFrame.");let p={...e,how:s,suffixes:a,join_nulls:l,coalesce:u,maintain_order:typeof c=="boolean"?c?"left":"none":c??"none"},{leftIndices:d,rightIndices:g}=eo(this._columns,t._columns,this._height,t._height,f,m,p);return $n(this._columns,t._columns,this._schema,t._schema,d,g,f,m,{suffixes:a,coalesce:u,how:s})}join_asof(e){let{other:t,on:r,leftOn:o,rightOn:i,by:s,leftBy:a,rightBy:l,strategy:u="backward",tolerance:c,allow_exact_matches:f=!0,suffixes:m=["","_right"],coalesce:h=!0,check_sorted:p=!0}=e;if(!t||!(t instanceof n))throw new M("join_asof() requires a valid right DataFrame in the 'other' parameter.");let d=String(o??r??""),g=String(i??r??"");if(!d||!g)throw new M('join_asof() requires join key specified via "on", or "leftOn" and "rightOn".');let y=O=>O?Array.isArray(O)?O.map(String):[String(O)]:[],_=y(a??s),S=y(l??s);if(_.length!==S.length)throw new M('join_asof() "by" (or "leftBy" / "rightBy") key lists must have equal lengths.');for(let O=0;O<_.length;O++)H(_[O],this._columns,"Partition key"," in the left DataFrame."),H(S[O],t._columns,"Partition key"," in the right DataFrame.");let b={...e,strategy:u,tolerance:c,allow_exact_matches:f,suffixes:m,coalesce:h,check_sorted:p},{leftIndices:x,rightIndices:A}=to(this._columns,t._columns,this._height,t._height,d,g,_,S,b),w=[d,..._],D=[g,...S];return $n(this._columns,t._columns,this._schema,t._schema,x,A,w,D,{suffixes:m,coalesce:h,how:"left"})}limit(e,{offset:t=0,from:r="start"}={}){let o=this._height,i=Ce(Math.floor(e),{min:0,max:o}),s=Ce(Math.floor(t),{min:0,max:o}),a=s,l=Math.min(s+i,o);r==="end"&&(l=o-s,a=Math.max(l-i,0));let u=l-a,c={},f=Object.keys(this._columns),m=f.length;for(let h=0;h<m;h++){let p=f[h];c[p]=this._columns[p].slice(a,l)}return n._createDirect(c,this._schema,u)}pivot(e){if(this._height===0)return n._createDirect({},{},0);let{index:t,columns:r,values:o}=e,i=$e(t,"string"),s=i.length;for(let x=0;x<s;x++)H(i[x],this._columns,"Pivot index key");let a=String(r),l=String(o);H(a,this._columns,"Pivot column key"),H(l,this._columns,"Pivot values key");let u=new Map,c=[],f=new Set,m=this._height,h=this._columns[a],p=this._columns[l];for(let x=0;x<m;x++){let A=ve(this._columns,i,x);f.add(String(h[x])),u.get(A)===void 0&&(u.set(A,u.size),c.push(x))}let d=u.size,g={},y={};for(let x=0;x<s;x++){let A=i[x];g[A]=this._columns[A],this._schema[A]&&(y[A]=this._schema[A])}let _=bt(g,c),S=Array.from(f),b=this._schema[l]||E.Utf8;for(let x=0;x<S.length;x++){let A=S[x];_[A]=new Array(d).fill(null),y[A]=b}for(let x=0;x<m;x++){let A=ve(this._columns,i,x),w=u.get(A),D=String(h[x]);_[D][w]=p[x]}return n._createDirect(_,y,d)}rename(e){let t=e||{},r={},o={},i=Object.keys(this._columns);for(let a of i){let l=t[a]||a;r[l]=this._columns[a],o[l]=this._schema[a]}if(Object.keys(r).length<i.length)throw new q("Rename collision: Multiple columns mapped to the same output name.");return n._createDirect(r,o,this._height)}reverse(){if(this._height===0)return this;let e={},t=Object.keys(this._columns),r=t.length;for(let o=0;o<r;o++){let i=t[o];e[i]=this._columns[i].slice().reverse()}return n._createDirect(e,this._schema,this._height)}get schema(){return this._schema}select(...e){let t=this._normalizeArgs(e),r=Object.keys(this._columns),o=je(t,r,void 0,this._schema,this._columns),i=o.length;if(i===0)return n._createDirect({},{},this._height);let s={},a={},l=new Array(i),u=new Array(i),c=new Set,f=null;for(let p=0;p<i;p++){let d=o[p],g=d._outputName||d._colName||"*";if(c.has(g))throw new q(`Duplicate column selection: "${g}" is selected multiple times.`);c.add(g);let y=pe(d,this._columns,this._height);l[p]=y,u[p]=g;let _=y&&y.rowMap;if(_)if(f){let S=_.length;if(S!==f.length)throw new re(`Mismatched explode heights: Column "${g}" has length ${S}, but another exploded column has length ${f.length}`);for(let b=0;b<S;b++)if(_[b]!==f[b])throw new re(`Mismatched explode heights: Column "${g}" has mismatched row lengths compared to another exploded column.`)}else f=_}let m=f?f.length:this._height,h=i>0;for(let p=0;p<i;p++){let d=o[p],g=d._aggFn!=null&&(d._partitionBy==null||d._partitionBy.length===0),y=!!d._isLiteral;if(!g&&!y){h=!1;break}}for(let p=0;p<i;p++){let d=u[p],g=l[p],y=g,_=y&&y.rowMap,S=k(g)?g.length:0,b=f&&!_?this._height:m;if(S!==b)throw new re(`Column height mismatch: Column "${d}" has length ${S}, but expected ${b}`);if(f&&!_){let x=f.length;if(K(g)){let A=new y.constructor(x);for(let w=0;w<x;w++)A[w]=y[f[w]];g=A}else{let A=new Array(x);for(let w=0;w<x;w++)A[w]=y[f[w]];g=A}}l[p]=g}h&&(m=1);for(let p=0;p<i;p++){let d=o[p],g=u[p],y=l[p],_=St(d,this._schema,y)||Fe(y);a[g]=_,s[g]=Se(y,_,m)}return n._createDirect(s,a,m)}get shape(){return[this.height,this.width]}slice(e,t){let r=this._height,o=e<0?Math.max(r+e,0):Math.min(e,r),i=t===void 0?r:t<0?Math.max(r+t,0):Math.min(t,r),s=Math.max(i-o,0);return this.limit(s,{offset:o})}sort(e){if(!e||!e.by||this._height===0)return this;let{by:t,descending:r=!1,nullsLast:o=!0,custom:i}=e,s=be(t);for(let p=0;p<s.length;p++){let d=U.toColExpr(s[p]);d._colName&&H(d._colName,this._columns,"Sort key")}let a=Array.isArray(r)?r:new Array(s.length).fill(r),l=s.length,u=new Array(l);for(let p=0;p<l;p++){let d=s[p],g=a[p]?-1:1,y=i&&typeof d=="string"?i[d]:null,_=U.toColExpr(d).evaluate(this._columns,this._height);u[p]={values:_,isDesc:g,customComp:y}}let c=u.length,f=o?1:-1,m=new Array(this._height);for(let p=0;p<this._height;p++)m[p]=p;m.sort((p,d)=>{for(let g=0;g<c;g++){let{values:y,isDesc:_,customComp:S}=u[g],b=y[p],x=y[d];if(S){let w=S(b,x);if(w!==0)return w*_;continue}if(b==null||x==null){if(b===x)continue;return(b==null?1:-1)*f}if(b===x)continue;return(b<x?-1:1)*_}return 0});let h=bt(this._columns,m);return n._createDirect(h,this._schema,this._height)}tail(e=10){return this.limit(e,{offset:0,from:"end"})}to_dict(){return{...this._columns}}to_dicts(){return Zr(this._columns,this._height)}to_array(e){if(this._height===0)return[];if(e==null)return new Array(this._height).fill(null);let r=U.toColExpr(e).evaluate(this._columns,this._height);return Array.isArray(r)?r:Array.from(r)}transpose({include_header:e=!1,header_name:t="column",column_names:r}={}){if(this._height===0){let c={},f={};return e&&(c[t]=Se([],E.Utf8,0),f[t]=E.Utf8),n._createDirect(c,f,0)}let o=this.columns;typeof r=="string"&&(H(r,this._columns,"column_names"),o=o.filter(c=>c!==r));let i=[];if(typeof r=="string"){let c=this._columns[r];i=new Array(this._height);for(let f=0;f<this._height;f++){let m=c[f];if(m==null)throw new q(`Transpose column_names column "${r}" contains null/undefined at index ${f}`);i[f]=String(m)}}else if(r!=null&&typeof r!="string"&&Symbol.iterator in Object(r)){let c=Array.from(r);if(c.length!==this._height)throw new q(`column_names length (${c.length}) must match the height of the DataFrame (${this._height})`);i=new Array(this._height);for(let f=0;f<this._height;f++)i[f]=String(c[f])}else{i=new Array(this._height);for(let c=0;c<this._height;c++)i[c]=`column_${c}`}let s=new Set;e&&s.add(t);for(let c=0;c<i.length;c++){let f=i[c];if(s.has(f))throw new q(`Duplicate column name in transposed DataFrame: "${f}"`);s.add(f)}let a=o.length,l={},u={};e&&(l[t]=Se(o,E.Utf8,a),u[t]=E.Utf8);for(let c=0;c<this._height;c++){let f=i[c],m=new Array(a);for(let p=0;p<a;p++)m[p]=this._columns[o[p]][c];let h=Fe(m);l[f]=Se(m,h,a),u[f]=h}return n._createDirect(l,u,a)}unique(e){if(this._height===0)return n._createDirect({},this._schema,0);let t=be(e),r=t.length===0?Object.keys(this._columns):t.map(String);for(let u of r)H(u,this._columns,"Unique column key");let o=new Set,i=[],s=this._height;for(let u=0;u<s;u++){let c=ve(this._columns,r,u);o.has(c)||(o.add(c),i.push(u))}let a=bt(this._columns,i),l=i.length;return n._createDirect(a,this._schema,l)}unpivot(e){let{idVars:t,valueVars:r,varName:o="variable",valueName:i="value"}=e,s=$e(t,"string"),a=$e(r,"string"),l=s.length,u=a.length;for(let p of s)H(p,this._columns,"Unpivot id variable key");for(let p of a)H(p,this._columns,"Unpivot value variable key");let c=this._height*u,f={};for(let p=0;p<l;p++)f[s[p]]=new Array(c);f[o]=new Array(c),f[i]=new Array(c);let m=0;for(let p=0;p<this._height;p++)for(let d=0;d<u;d++){let g=a[d];for(let y=0;y<l;y++){let _=s[y];f[_][m]=this._columns[_][p]}f[o][m]=g,f[i][m]=this._columns[g][p],m++}let h={};for(let p of s)h[p]=this._schema[p];return h[o]=E.Utf8,h[i]=Fe(f[i]),n._createDirect(f,h,c)}vstack(e){return this.concat(e,{how:"vertical"})}get width(){return Object.keys(this._columns).length}_normalizeArgs(e){let t=e.flat(),r=[];for(let o of t)if(typeof o=="string")r.push(new U(o));else if(U.isColExpr(o))r.push(o);else if(F(o)){let i=Object.keys(o),s=i.length;for(let a=0;a<s;a++){let l=i[a],u=o[l];if(U.isColExpr(u))r.push(u.alias(l));else{let c=new U(l);c.evaluate=(f,m)=>new Array(m).fill(u),r.push(c)}}}return r}with_columns(...e){if(e.length===0)return this;let t=this._normalizeArgs(e),r=Object.keys(this._columns),o=je(t,r,void 0,this._schema,this._columns),i=o.length;if(i===0)return this;let s=new Map;for(let u=0;u<i;u++){let c=o[u],f=c._outputName||c._colName||"*";s.set(f,c)}let a=[],l=r.length;for(let u=0;u<l;u++){let c=r[u];a.push(s.get(c)||new U(c)),s.delete(c)}for(let u of s.values())a.push(u);return this.select(...a)}with_row_index(e="index",t=0){let r=ot(t,{mode:"independent",dtype:E.UInt32,step:1}),o=this.insert_column(0,e,r);return o._schema[e]=E.UInt32,o}write_json(e,{format:t="json",replacerOptions:r}={}){if(t!=="json"&&t!=="ndjson")throw new M(`Unsupported JSON format: "${t}". Expected "json" or "ndjson".`);let o=r?.replacer===null?void 0:He(r),i;if(t==="ndjson"){let s=this.to_dicts(),a=s.length,l=new Array(a);for(let u=0;u<a;u++)l[u]=JSON.stringify(s[u],o);i=l.join(`
6
+ `)}else i=JSON.stringify(this.to_dicts(),o);return Qr(e,i),i}write_csv(e,t={}){if(e){if(typeof e=="string"){if(typeof require!="function")throw new Re("File writing is not supported in this environment (missing require('fs')).");let r=require("fs"),o=r.openSync(e,"w");try{Ln(this._columns,this._height,{...t,onRow:i=>{r.writeSync(o,i,null,"utf8")}})}finally{r.closeSync(o)}}else if(F(e)&&typeof e.write=="function")Ln(this._columns,this._height,{...t,onRow:r=>{e.write(r)}});else throw new M("Invalid file argument. Expected a file path string or a writable stream/object with a write method.");return""}return Ln(this._columns,this._height,t)}}});var Il={};rr(Il,{$df:()=>El,ALL_COLUMNS_MARKER:()=>oe,AggregationExpr:()=>qt,ArithmeticExpr:()=>Lt,Array:()=>Jr,ArrayDataType:()=>Jr,ArrayExpr:()=>Gt,ArrayExprNamespace:()=>zn,ArrayType:()=>tt,Binary:()=>Vr,BinaryType:()=>Un,Boolean:()=>jt,BooleanDataType:()=>jt,BooleanType:()=>Nn,COALESCE_MARKER:()=>sr,ColumnExpr:()=>U,ColumnNotFoundError:()=>Me,ComparisonExpr:()=>$t,ComputeError:()=>ne,DFScriptError:()=>Ue,DURATION_MARKER:()=>lr,DataFrame:()=>L,DataFrameError:()=>q,DataType:()=>Z,DataTypeRegistry:()=>E,Date:()=>qr,DateDataType:()=>qr,DateTimeExprNamespace:()=>Yn,DateType:()=>jn,Datetime:()=>Bt,DatetimeType:()=>Ae,DecimalType:()=>ke,Duration:()=>Gr,DurationType:()=>me,ELEMENT_MARKER:()=>We,ExprBase:()=>$,Float32:()=>Lr,Float32Type:()=>Qe,Float64:()=>Ft,Float64Type:()=>et,FloatDataType:()=>dt,GroupedData:()=>Yt,IOStreamError:()=>Re,Int16:()=>Ur,Int16Type:()=>Dn,Int32:()=>vr,Int32Type:()=>On,Int64:()=>vt,Int64Type:()=>En,Int8:()=>Mr,Int8Type:()=>Tn,IntegerDataType:()=>Ut,InvalidArgumentError:()=>M,LITERAL_MARKER:()=>ir,LogicalExpr:()=>Vt,NestedDataType:()=>gt,Null:()=>$r,NullType:()=>vn,NumericDataType:()=>Ze,Object:()=>Kr,ObjectDataType:()=>Kr,ObjectType:()=>Fn,STRUCT_MARKER:()=>ar,SchemaError:()=>Je,ShapeError:()=>re,SignedIntegerType:()=>qe,StringExpr:()=>Kt,StringExprNamespace:()=>qn,Struct:()=>Wr,StructExpr:()=>Jt,StructExprNamespace:()=>Jn,StructType:()=>yt,TemporalDataType:()=>Ge,TemporalExpr:()=>Wt,Time:()=>zr,TimeType:()=>Bn,UInt16:()=>jr,UInt16Type:()=>Cn,UInt32:()=>Br,UInt32Type:()=>Rn,UInt64:()=>Pr,UInt64Type:()=>kn,UInt8:()=>Fr,UInt8Type:()=>In,UnsignedIntegerType:()=>ze,Utf8:()=>_t,Utf8Type:()=>Mn,WHEN_MARKER:()=>ur,When:()=>Qn,WhenThen:()=>Xt,WhenThenChain:()=>Zn,WindowExpr:()=>zt,alignAsofIndices:()=>to,alignKeyIndices:()=>eo,all:()=>At,assertColumnExists:()=>H,assertHeight:()=>Vn,assertNotNull:()=>Pt,assertValidArgument:()=>xl,coalesce:()=>yo,coerceColumn:()=>Se,columnsToRows:()=>Zr,computeRowHash:()=>ve,concat:()=>Tt,deduceBinaryType:()=>Ao,derive:()=>T,duration:()=>Hn,element:()=>bo,evalBinaryOp:()=>no,evalUnaryOp:()=>Ts,evaluateArg:()=>nt,evaluateExpression:()=>pe,exclude:()=>go,gatherColumnsByIndices:()=>bt,getRowFromColumns:()=>wl,implode:()=>xo,inferColumnType:()=>Fe,isEvaluatedColumn:()=>rt,kleeneBinary:()=>V,kleeneUnary:()=>I,lit:()=>it,materializeJoinedDataFrame:()=>$n,read_csv:()=>tr,read_json:()=>er,resolveColumnSelectors:()=>je,resolveExprOutputType:()=>St,resolveOperandType:()=>st,resolveWindowExpr:()=>Hr,rowsToColumns:()=>Yr,seq_range:()=>ot,struct:()=>wo,when:()=>_o,writeStringToFileOrStream:()=>Qr});module.exports=or(Il);Ht();Ht();Ne();So();wt();z();X();function er(n,{format:e="json",trimBeforeParse:t=!0,schema:r,...o}={}){let i=Rt(n,{format:e,trimBeforeParse:t,...o});if(i===n)throw new q(`Invalid JSON input: must be a valid, non-empty JSON ${e} string.`);let s=Array.isArray(i)?i:F(i)?[i]:[];return new L(s,r)}wt();z();function tr(n,e={}){let{hasHeader:t=!0,schema:r,inferSchema:o=!0}=e,i=_s(n,e);if(i.length===0)return new L({});let s,a;t?(s=i[0],a=i.slice(1)):(s=i[0].map((m,h)=>`column_${h}`),a=i);let l=s.length,u=a.length,c={};for(let m=0;m<l;m++){let h=s[m],p=new Array(u);for(let d=0;d<u;d++)p[d]=a[d][m]!==void 0?a[d][m]:"";c[h]=p}let f={};for(let m=0;m<l;m++){let h=s[m],p=c[h];if(r&&r[h])f[h]=p;else if(o){let{values:d}=xs(p,e);f[h]=d}else f[h]=p}return new L(f,r)}function Ol(n,e){return new L(n,e)}var El={data:Ol,col:n=>new U(n),all:At,exclude:go,coalesce:yo,concat:Tt,read_json:er,read_csv:tr,lit:it,when:_o,implode:xo,seq_range:ot,element:bo,struct:wo,duration:Hn,DataType:E};Ne();X();0&&(module.exports={$df,ALL_COLUMNS_MARKER,AggregationExpr,ArithmeticExpr,Array,ArrayDataType,ArrayExpr,ArrayExprNamespace,ArrayType,Binary,BinaryType,Boolean,BooleanDataType,BooleanType,COALESCE_MARKER,ColumnExpr,ColumnNotFoundError,ComparisonExpr,ComputeError,DFScriptError,DURATION_MARKER,DataFrame,DataFrameError,DataType,DataTypeRegistry,Date,DateDataType,DateTimeExprNamespace,DateType,Datetime,DatetimeType,DecimalType,Duration,DurationType,ELEMENT_MARKER,ExprBase,Float32,Float32Type,Float64,Float64Type,FloatDataType,GroupedData,IOStreamError,Int16,Int16Type,Int32,Int32Type,Int64,Int64Type,Int8,Int8Type,IntegerDataType,InvalidArgumentError,LITERAL_MARKER,LogicalExpr,NestedDataType,Null,NullType,NumericDataType,Object,ObjectDataType,ObjectType,STRUCT_MARKER,SchemaError,ShapeError,SignedIntegerType,StringExpr,StringExprNamespace,Struct,StructExpr,StructExprNamespace,StructType,TemporalDataType,TemporalExpr,Time,TimeType,UInt16,UInt16Type,UInt32,UInt32Type,UInt64,UInt64Type,UInt8,UInt8Type,UnsignedIntegerType,Utf8,Utf8Type,WHEN_MARKER,When,WhenThen,WhenThenChain,WindowExpr,alignAsofIndices,alignKeyIndices,all,assertColumnExists,assertHeight,assertNotNull,assertValidArgument,coalesce,coerceColumn,columnsToRows,computeRowHash,concat,deduceBinaryType,derive,duration,element,evalBinaryOp,evalUnaryOp,evaluateArg,evaluateExpression,exclude,gatherColumnsByIndices,getRowFromColumns,implode,inferColumnType,isEvaluatedColumn,kleeneBinary,kleeneUnary,lit,materializeJoinedDataFrame,read_csv,read_json,resolveColumnSelectors,resolveExprOutputType,resolveOperandType,resolveWindowExpr,rowsToColumns,seq_range,struct,when,writeStringToFileOrStream});