@loaders.gl/shapefile 4.4.0-alpha.13 → 4.4.0-alpha.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dbf-arrow-loader.js +1 -1
- package/dist/dbf-loader.js +1 -1
- package/dist/dbf-worker.js +1 -1
- package/dist/dist.dev.js +3715 -2766
- package/dist/dist.min.js +5 -5
- package/dist/index.cjs +4 -4
- package/dist/shapefile-loader.d.ts +1 -1
- package/dist/shapefile-loader.js +1 -1
- package/dist/shp-loader.d.ts +1 -1
- package/dist/shp-loader.js +1 -1
- package/dist/shp-worker.js +1 -1
- package/package.json +5 -5
package/dist/dist.min.js
CHANGED
|
@@ -4,18 +4,18 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['loaders'] = factory();
|
|
6
6
|
else root['loaders'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var sd=Object.create;var jn=Object.defineProperty;var nd=Object.getOwnPropertyDescriptor;var od=Object.getOwnPropertyNames;var ad=Object.getPrototypeOf,hd=Object.prototype.hasOwnProperty;var ld=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),$r=(e,t)=>{for(var r in t)jn(e,r,{get:t[r],enumerable:!0})},zn=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of od(t))!hd.call(e,s)&&s!==r&&jn(e,s,{get:()=>t[s],enumerable:!(i=nd(t,s))||i.enumerable});return e},Vn=(e,t,r)=>(zn(e,t,"default"),r&&zn(r,t,"default")),cd=(e,t,r)=>(r=e!=null?sd(ad(e)):{},zn(t||!e||!e.__esModule?jn(r,"default",{value:e,enumerable:!0}):r,e)),ud=e=>zn(jn({},"__esModule",{value:!0}),e);var cl=ld((Lb,ll)=>{ll.exports=globalThis.loaders});var Cn={};$r(Cn,{DBFArrowLoader:()=>rd,DBFArrowWorkerLoader:()=>hl,DBFLoader:()=>Rn,DBFWorkerLoader:()=>nl,SHPLoader:()=>Rs,SHPWorkerLoader:()=>ja,ShapefileLoader:()=>Kf,_BinaryChunkReader:()=>nr,_BinaryReader:()=>Ra,_zipBatchIterators:()=>Oa});Vn(Cn,cd(cl(),1));async function kn(e,t,r,i){return i._parse(e,t,r,i)}async function Gn(e,t,r,i){if(!i._parseInBatches)throw new Error("parseInBatches");return i._parseInBatches(e,t,r,i)}async function*Dr(e){for await(let t of e)yield fd(t)}function fd(e){if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e)){let{buffer:t,byteOffset:r,byteLength:i}=e;return ul(t,r,i)}return ul(e)}function ul(e,t=0,r=e.byteLength-t){let i=new Uint8Array(e,t,r),s=new Uint8Array(i.length);return s.set(i),s.buffer}var nr=class{offset;arrayBuffers;ended;maxRewindBytes;constructor(t){let{maxRewindBytes:r=0}=t||{};this.offset=0,this.arrayBuffers=[],this.ended=!1,this.maxRewindBytes=r}write(t){this.arrayBuffers.push(t)}end(){this.arrayBuffers=[],this.ended=!0}hasAvailableBytes(t){let r=-this.offset;for(let i of this.arrayBuffers)if(r+=i.byteLength,r>=t)return!0;return!1}findBufferOffsets(t){let r=-this.offset,i=[];for(let s=0;s<this.arrayBuffers.length;s++){let n=this.arrayBuffers[s];if(r+n.byteLength<=0){r+=n.byteLength;continue}let o=r<=0?Math.abs(r):0,a;if(o+t<=n.byteLength)return a=o+t,i.push([s,[o,a]]),i;a=n.byteLength,i.push([s,[o,a]]),t-=n.byteLength-o,r+=n.byteLength}return null}getDataView(t){let r=this.findBufferOffsets(t);if(!r&&this.ended)throw new Error("binary data exhausted");if(!r)return null;if(r.length===1){let[s,[n,o]]=r[0],a=this.arrayBuffers[s],h=new DataView(a,n,o-n);return this.offset+=t,this.disposeBuffers(),h}let i=new DataView(this._combineArrayBuffers(r));return this.offset+=t,this.disposeBuffers(),i}disposeBuffers(){for(;this.arrayBuffers.length>0&&this.offset-this.maxRewindBytes>=this.arrayBuffers[0].byteLength;)this.offset-=this.arrayBuffers[0].byteLength,this.arrayBuffers.shift()}_combineArrayBuffers(t){let r=0;for(let n of t){let[o,a]=n[1];r+=a-o}let i=new Uint8Array(r),s=0;for(let n of t){let[o,[a,h]]=n,l=new Uint8Array(this.arrayBuffers[o]);i.set(l.subarray(a,h),s),s+=h-a}return i.buffer}skip(t){this.offset+=t}rewind(t){this.offset-=t}};function Wn(e){let t={magic:e.getInt32(0,!1),length:e.getInt32(24,!1)*2,version:e.getInt32(28,!0),type:e.getInt32(32,!0),bbox:{minX:e.getFloat64(36,!0),minY:e.getFloat64(44,!0),minZ:e.getFloat64(68,!0),minM:e.getFloat64(84,!0),maxX:e.getFloat64(52,!0),maxY:e.getFloat64(60,!0),maxZ:e.getFloat64(76,!0),maxM:e.getFloat64(92,!0)}};return t.magic!==9994&&console.error(`SHP file: bad magic number ${t.magic}`),t.version!==1e3&&console.error(`SHP file: bad version ${t.version}`),t}function fl(e,t){let{_maxDimensions:r=4}=t?.shp||{},i=0,s=e.getInt32(i,!0);switch(i+=Int32Array.BYTES_PER_ELEMENT,s){case 0:return dd();case 1:return Ua(e,i,Math.min(2,r));case 3:return ji(e,i,Math.min(2,r),"LineString");case 5:return ji(e,i,Math.min(2,r),"Polygon");case 8:return Ca(e,i,Math.min(2,r));case 11:return Ua(e,i,Math.min(4,r));case 13:return ji(e,i,Math.min(4,r),"LineString");case 15:return ji(e,i,Math.min(4,r),"Polygon");case 18:return Ca(e,i,Math.min(4,r));case 21:return Ua(e,i,Math.min(3,r));case 23:return ji(e,i,Math.min(3,r),"LineString");case 25:return ji(e,i,Math.min(3,r),"Polygon");case 28:return Ca(e,i,Math.min(3,r));default:throw new Error(`unsupported shape type: ${s}`)}}function dd(){return null}function Ua(e,t,r){let i;return[i,t]=ii(e,t,1,r),{positions:{value:i,size:r},type:"Point"}}function Ca(e,t,r){t+=4*Float64Array.BYTES_PER_ELEMENT;let i=e.getInt32(t,!0);t+=Int32Array.BYTES_PER_ELEMENT;let s=null,n=null,o=null;return[s,t]=ii(e,t,i,2),r===4&&(t+=2*Float64Array.BYTES_PER_ELEMENT,[o,t]=ii(e,t,i,1)),r>=3&&(t+=2*Float64Array.BYTES_PER_ELEMENT,[n,t]=ii(e,t,i,1)),{positions:{value:dl(s,n,o),size:r},type:"Point"}}function ji(e,t,r,i){t+=4*Float64Array.BYTES_PER_ELEMENT;let s=e.getInt32(t,!0);t+=Int32Array.BYTES_PER_ELEMENT;let n=e.getInt32(t,!0);t+=Int32Array.BYTES_PER_ELEMENT;let o=e.byteOffset+t,a=s*Int32Array.BYTES_PER_ELEMENT,h=new Int32Array(s+1);h.set(new Int32Array(e.buffer.slice(o,o+a))),h[s]=n,t+=s*Int32Array.BYTES_PER_ELEMENT;let l=null,c=null,u=null;[l,t]=ii(e,t,n,2),r===4&&(t+=2*Float64Array.BYTES_PER_ELEMENT,[u,t]=ii(e,t,n,1)),r>=3&&(t+=2*Float64Array.BYTES_PER_ELEMENT,[c,t]=ii(e,t,n,1));let d=dl(l,c,u);if(i==="LineString")return{type:i,positions:{value:d,size:r},pathIndices:{value:h,size:1}};let p=[];for(let m=1;m<h.length;m++){let g=h[m-1],v=h[m],I=l.subarray(g*2,v*2);pd(I)>0&&p.push(g)}return p.push(n),{type:i,positions:{value:d,size:r},primitivePolygonIndices:{value:h,size:1},polygonIndices:{value:new Uint32Array(p),size:1}}}function ii(e,t,r,i){let s=e.byteOffset+t,n=r*i*Float64Array.BYTES_PER_ELEMENT;return[new Float64Array(e.buffer.slice(s,s+n)),t+n]}function dl(e,t,r){if(!(t||r))return e;let i=e.length,s=2;r&&r.length&&(i+=r.length,s++),t&&t.length&&(i+=t.length,s++);let n=new Float64Array(i);for(let o=0;o<e.length/2;o++)n[s*o]=e[o*2],n[s*o+1]=e[o*2+1];if(r&&r.length)for(let o=0;o<r.length;o++)n[s*o+2]=r[o];if(t&&t.length)for(let o=0;o<t.length;o++)n[s*o+(s-1)]=t[o];return n}function pd(e){return Math.sign(md(e))}function md(e){let t=0,r=e.length/2-1;for(let i=0;i<r;i++)t+=(e[i*2]+e[(i+1)*2])*(e[i*2+1]-e[(i+1)*2+1]);return t/2}var yd=!0,pl=!1,gd=100,Ls=12,ze={EXPECTING_HEADER:0,EXPECTING_RECORD:1,END:2,ERROR:3},Hn=class{options={};binaryReader=new nr({maxRewindBytes:Ls});state=ze.EXPECTING_HEADER;result={geometries:[],progress:{bytesTotal:NaN,bytesUsed:NaN,rows:NaN},currentIndex:NaN};constructor(t){this.options=t}write(t){this.binaryReader.write(t),this.state=ml(this.state,this.result,this.binaryReader,this.options)}end(){this.binaryReader.end(),this.state=ml(this.state,this.result,this.binaryReader,this.options),this.state!==ze.END&&(this.state=ze.ERROR,this.result.error="SHP incomplete file")}};function Pa(e,t){let r=new Hn(t);return r.write(e),r.end(),r.result}async function*yl(e,t){let r=new Hn(t),i=!1;for await(let s of Dr(e))r.write(s),!i&&r.result.header&&(i=!0,yield r.result.header),r.result.geometries.length>0&&(yield r.result.geometries,r.result.geometries=[]);r.end(),r.result.geometries.length>0&&(yield r.result.geometries)}function ml(e,t,r,i){for(;;)try{switch(e){case ze.ERROR:case ze.END:return e;case ze.EXPECTING_HEADER:let s=r.getDataView(gd);if(!s)return e;t.header=Wn(s),t.progress={bytesUsed:0,bytesTotal:t.header.length,rows:0},t.currentIndex=1,e=ze.EXPECTING_RECORD;break;case ze.EXPECTING_RECORD:for(;r.hasAvailableBytes(Ls);){let n=r.getDataView(Ls),o={recordNumber:n.getInt32(0,pl),byteLength:n.getInt32(4,pl)*2,type:n.getInt32(8,yd)};if(!r.hasAvailableBytes(o.byteLength-4))return r.rewind(Ls),e;if(o.byteLength<4||o.type!==t.header?.type||o.recordNumber!==t.currentIndex)r.rewind(Ls-4);else{r.rewind(4);let h=r.getDataView(o.byteLength),l=fl(h,i);t.geometries.push(l),t.currentIndex++,t.progress.rows=t.currentIndex-1}}return r.ended&&(e=ze.END),e;default:return e=ze.ERROR,t.error=`illegal parser state ${e}`,e}}catch(s){return e=ze.ERROR,t.error=`SHP parsing failed: ${s?.message}`,e}}var bd="4.4.0-alpha.13",za=[0,0,39,10],ja={dataType:null,batchType:null,name:"SHP",id:"shp",module:"shapefile",version:bd,worker:!0,category:"geometry",extensions:["shp"],mimeTypes:["application/octet-stream"],tests:[new Uint8Array(za).buffer],options:{shp:{_maxDimensions:4}}},Rs={...ja,parse:async(e,t)=>Pa(e,t),parseSync:Pa,parseInBatches:(e,t)=>yl(e,t)};function Va(e,t){for(let r of e)r.geometry.coordinates=gl(r.geometry.coordinates,t);return e}function gl(e,t){return _d(e)?t(e):e.map(r=>gl(r,t))}function _d(e){return Array.isArray(e)&&Number.isFinite(e[0])&&Number.isFinite(e[1])}function _l(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(r[i[s]]=e[i[s]]);return r}function x(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function a(c){try{l(i.next(c))}catch(u){o(u)}}function h(c){try{l(i.throw(c))}catch(u){o(u)}}function l(c){c.done?n(c.value):s(c.value).then(a,h)}l((i=i.apply(e,t||[])).next())})}function bl(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function k(e){return this instanceof k?(this.v=e,this):new k(e)}function be(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(e,t||[]),s,n=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(p){return function(m){return Promise.resolve(m).then(p,u)}}function a(p,m){i[p]&&(s[p]=function(g){return new Promise(function(v,I){n.push([p,g,v,I])>1||h(p,g)})},m&&(s[p]=m(s[p])))}function h(p,m){try{l(i[p](m))}catch(g){d(n[0][3],g)}}function l(p){p.value instanceof k?Promise.resolve(p.value.v).then(c,u):d(n[0][2],p)}function c(p){h("next",p)}function u(p){h("throw",p)}function d(p,m){p(m),n.shift(),n.length&&h(n[0][0],n[0][1])}}function Vi(e){var t,r;return t={},i("next"),i("throw",function(s){throw s}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(s,n){t[s]=e[s]?function(o){return(r=!r)?{value:k(e[s](o)),done:!1}:n?n(o):o}:n}}function je(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof bl=="function"?bl(e):e[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(n){r[n]=e[n]&&function(o){return new Promise(function(a,h){o=e[n](o),s(a,h,o.done,o.value)})}}function s(n,o,a,h){Promise.resolve(h).then(function(l){n({value:l,done:a})},o)}}var $a={};$r($a,{compareArrayLike:()=>qa,joinUint8Arrays:()=>_e,memcpy:()=>Ps,rebaseValueOffsets:()=>Qn,toArrayBufferView:()=>G,toArrayBufferViewAsyncIterator:()=>Ge,toArrayBufferViewIterator:()=>ar,toBigInt64Array:()=>Zn,toBigUint64Array:()=>Dd,toFloat32Array:()=>Td,toFloat32ArrayAsyncIterator:()=>Hd,toFloat32ArrayIterator:()=>Cd,toFloat64Array:()=>Od,toFloat64ArrayAsyncIterator:()=>qd,toFloat64ArrayIterator:()=>Pd,toInt16Array:()=>Sd,toInt16ArrayAsyncIterator:()=>Vd,toInt16ArrayIterator:()=>Fd,toInt32Array:()=>si,toInt32ArrayAsyncIterator:()=>kd,toInt32ArrayIterator:()=>Ld,toInt8Array:()=>Id,toInt8ArrayAsyncIterator:()=>jd,toInt8ArrayIterator:()=>Nd,toUint16Array:()=>Bd,toUint16ArrayAsyncIterator:()=>Gd,toUint16ArrayIterator:()=>Rd,toUint32Array:()=>Ad,toUint32ArrayAsyncIterator:()=>Wd,toUint32ArrayIterator:()=>Ud,toUint8Array:()=>N,toUint8ArrayAsyncIterator:()=>Ha,toUint8ArrayIterator:()=>Wa,toUint8ClampedArray:()=>Ed,toUint8ClampedArrayAsyncIterator:()=>$d,toUint8ClampedArrayIterator:()=>zd});var vd=new TextDecoder("utf-8"),Us=e=>vd.decode(e),wd=new TextEncoder,or=e=>wd.encode(e);var xd=e=>typeof e=="number",vl=e=>typeof e=="boolean",St=e=>typeof e=="function",Gt=e=>e!=null&&Object(e)===e,Ve=e=>Gt(e)&&St(e.then);var ke=e=>Gt(e)&&St(e[Symbol.iterator]),Ae=e=>Gt(e)&&St(e[Symbol.asyncIterator]),qn=e=>Gt(e)&&Gt(e.schema);var $n=e=>Gt(e)&&"done"in e&&"value"in e;var Yn=e=>Gt(e)&&St(e.stat)&&xd(e.fd);var Jn=e=>Gt(e)&&Cs(e.body),Xn=e=>"_getDOMStream"in e&&"_getNodeStream"in e,wl=e=>Gt(e)&&St(e.abort)&&St(e.getWriter)&&!Xn(e),Cs=e=>Gt(e)&&St(e.cancel)&&St(e.getReader)&&!Xn(e),xl=e=>Gt(e)&&St(e.end)&&St(e.write)&&vl(e.writable)&&!Xn(e),Kn=e=>Gt(e)&&St(e.read)&&St(e.pipe)&&vl(e.readable)&&!Xn(e),Ml=e=>Gt(e)&&St(e.clear)&&St(e.bytes)&&St(e.position)&&St(e.setPosition)&&St(e.capacity)&&St(e.getBufferIdentifier)&&St(e.createLong);var Ga=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Md(e){let t=e[0]?[e[0]]:[],r,i,s,n;for(let o,a,h=0,l=0,c=e.length;++h<c;){if(o=t[l],a=e[h],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:r,byteLength:s}=o,{byteOffset:i,byteLength:n}=a,r+s<i||i+n<r){a&&(t[++l]=a);continue}t[l]=new Uint8Array(o.buffer,r,i-r+n)}return t}function Ps(e,t,r=0,i=t.byteLength){let s=e.byteLength,n=new Uint8Array(e.buffer,e.byteOffset,s),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(i,s));return n.set(o,r),e}function _e(e,t){let r=Md(e),i=r.reduce((c,u)=>c+u.byteLength,0),s,n,o,a=0,h=-1,l=Math.min(t||Number.POSITIVE_INFINITY,i);for(let c=r.length;++h<c;){if(s=r[h],n=s.subarray(0,Math.min(s.length,l-a)),l<=a+n.length){n.length<s.length?r[h]=s.subarray(n.length):n.length===s.length&&h++,o?Ps(o,n,a):o=n;break}Ps(o||(o=new Uint8Array(l)),n,a),a+=n.length}return[o||new Uint8Array(0),r.slice(h),i-(o?o.byteLength:0)]}function G(e,t){let r=$n(t)?t.value:t;return r instanceof e?e===Uint8Array?new e(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=or(r)),r instanceof ArrayBuffer?new e(r):r instanceof Ga?new e(r):Ml(r)?G(e,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new e(0):new e(r.buffer,r.byteOffset,r.byteLength/e.BYTES_PER_ELEMENT):e.from(r)):new e(0)}var Id=e=>G(Int8Array,e),Sd=e=>G(Int16Array,e),si=e=>G(Int32Array,e),Zn=e=>G(BigInt64Array,e),N=e=>G(Uint8Array,e),Bd=e=>G(Uint16Array,e),Ad=e=>G(Uint32Array,e),Dd=e=>G(BigUint64Array,e),Td=e=>G(Float32Array,e),Od=e=>G(Float64Array,e),Ed=e=>G(Uint8ClampedArray,e),ka=e=>(e.next(),e);function*ar(e,t){let r=function*(s){yield s},i=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Ga?r(t):ke(t)?t:r(t);return yield*ka(function*(s){let n=null;do n=s.next(yield G(e,n));while(!n.done)}(i[Symbol.iterator]())),new e}var Nd=e=>ar(Int8Array,e),Fd=e=>ar(Int16Array,e),Ld=e=>ar(Int32Array,e),Wa=e=>ar(Uint8Array,e),Rd=e=>ar(Uint16Array,e),Ud=e=>ar(Uint32Array,e),Cd=e=>ar(Float32Array,e),Pd=e=>ar(Float64Array,e),zd=e=>ar(Uint8ClampedArray,e);function Ge(e,t){return be(this,arguments,function*(){if(Ve(t))return yield k(yield k(yield*Vi(je(Ge(e,yield k(t))))));let i=function(o){return be(this,arguments,function*(){yield yield k(yield k(o))})},s=function(o){return be(this,arguments,function*(){yield k(yield*Vi(je(ka(function*(a){let h=null;do h=a.next(yield h?.value);while(!h.done)}(o[Symbol.iterator]())))))})},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Ga?i(t):ke(t)?s(t):Ae(t)?t:i(t);return yield k(yield*Vi(je(ka(function(o){return be(this,arguments,function*(){let a=null;do a=yield k(o.next(yield yield k(G(e,a))));while(!a.done)})}(n[Symbol.asyncIterator]()))))),yield k(new e)})}var jd=e=>Ge(Int8Array,e),Vd=e=>Ge(Int16Array,e),kd=e=>Ge(Int32Array,e),Ha=e=>Ge(Uint8Array,e),Gd=e=>Ge(Uint16Array,e),Wd=e=>Ge(Uint32Array,e),Hd=e=>Ge(Float32Array,e),qd=e=>Ge(Float64Array,e),$d=e=>Ge(Uint8ClampedArray,e);function Qn(e,t,r){if(e!==0){r=r.slice(0,t);for(let i=-1,s=r.length;++i<s;)r[i]+=e}return r.subarray(0,t)}function qa(e,t){let r=0,i=e.length;if(i!==t.length)return!1;if(i>0)do if(e[r]!==t[r])return!1;while(++r<i);return!0}var Lt={fromIterable(e){return to(Yd(e))},fromAsyncIterable(e){return to(Jd(e))},fromDOMStream(e){return to(Xd(e))},fromNodeStream(e){return to(Kd(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},to=e=>(e.next(),e);function*Yd(e){let t,r=!1,i=[],s,n,o,a=0;function h(){return n==="peek"?_e(i,o)[0]:([s,i,a]=_e(i,o),s)}({cmd:n,size:o}=(yield(()=>null)())||{cmd:"read",size:0});let l=Wa(e)[Symbol.iterator]();try{do if({done:t,value:s}=Number.isNaN(o-a)?l.next():l.next(o-a),!t&&s.byteLength>0&&(i.push(s),a+=s.byteLength),t||o<=a)do({cmd:n,size:o}=yield h());while(o<a);while(!t)}catch(c){(r=!0)&&typeof l.throw=="function"&&l.throw(c)}finally{r===!1&&typeof l.return=="function"&&l.return(null)}return null}function Jd(e){return be(this,arguments,function*(){let r,i=!1,s=[],n,o,a,h=0;function l(){return o==="peek"?_e(s,a)[0]:([n,s,h]=_e(s,a),n)}({cmd:o,size:a}=(yield yield k((()=>null)()))||{cmd:"read",size:0});let c=Ha(e)[Symbol.asyncIterator]();try{do if({done:r,value:n}=Number.isNaN(a-h)?yield k(c.next()):yield k(c.next(a-h)),!r&&n.byteLength>0&&(s.push(n),h+=n.byteLength),r||a<=h)do({cmd:o,size:a}=yield yield k(l()));while(a<h);while(!r)}catch(u){(i=!0)&&typeof c.throw=="function"&&(yield k(c.throw(u)))}finally{i===!1&&typeof c.return=="function"&&(yield k(c.return(new Uint8Array(0))))}return yield k(null)})}function Xd(e){return be(this,arguments,function*(){let r=!1,i=!1,s=[],n,o,a,h=0;function l(){return o==="peek"?_e(s,a)[0]:([n,s,h]=_e(s,a),n)}({cmd:o,size:a}=(yield yield k((()=>null)()))||{cmd:"read",size:0});let c=new Ja(e);try{do if({done:r,value:n}=Number.isNaN(a-h)?yield k(c.read()):yield k(c.read(a-h)),!r&&n.byteLength>0&&(s.push(N(n)),h+=n.byteLength),r||a<=h)do({cmd:o,size:a}=yield yield k(l()));while(a<h);while(!r)}catch(u){(i=!0)&&(yield k(c.cancel(u)))}finally{i===!1?yield k(c.cancel()):e.locked&&c.releaseLock()}return yield k(null)})}var Ja=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return x(this,void 0,void 0,function*(){let{reader:r,source:i}=this;r&&(yield r.cancel(t).catch(()=>{})),i&&i.locked&&this.releaseLock()})}read(t){return x(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=N(r)),r})}},Ya=(e,t)=>{let r=s=>i([t,s]),i;return[t,r,new Promise(s=>(i=s)&&e.once(t,r))]};function Kd(e){return be(this,arguments,function*(){let r=[],i="error",s=!1,n=null,o,a,h=0,l=[],c;function u(){return o==="peek"?_e(l,a)[0]:([c,l,h]=_e(l,a),c)}if({cmd:o,size:a}=(yield yield k((()=>null)()))||{cmd:"read",size:0},e.isTTY)return yield yield k(new Uint8Array(0)),yield k(null);try{r[0]=Ya(e,"end"),r[1]=Ya(e,"error");do{if(r[2]=Ya(e,"readable"),[i,n]=yield k(Promise.race(r.map(p=>p[2]))),i==="error")break;if((s=i==="end")||(Number.isFinite(a-h)?(c=N(e.read(a-h)),c.byteLength<a-h&&(c=N(e.read()))):c=N(e.read()),c.byteLength>0&&(l.push(c),h+=c.byteLength)),s||a<=h)do({cmd:o,size:a}=yield yield k(u()));while(a<h)}while(!s)}finally{yield k(d(r,i==="error"?n:null))}return yield k(null);function d(p,m){return c=l=null,new Promise((g,v)=>{for(let[I,z]of p)e.off(I,z);try{let I=e.destroy;I&&I.call(e,m),m=void 0}catch(I){m=I||m}finally{m!=null?v(m):g()}})}})}var et;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(et||(et={}));var at;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(at||(at={}));var st;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(st||(st={}));var ft;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(ft||(ft={}));var M;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(M||(M={}));var bt;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(bt||(bt={}));var hr=new Int32Array(2),eo=new Float32Array(hr.buffer),ro=new Float64Array(hr.buffer),ki=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var zs;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(zs||(zs={}));var Wt=class{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new Wt(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return hr[0]=this.readInt32(t),eo[0]}readFloat64(t){return hr[ki?0:1]=this.readInt32(t),hr[ki?1:0]=this.readInt32(t+4),ro[0]}writeInt8(t,r){this.bytes_[t]=r}writeUint8(t,r){this.bytes_[t]=r}writeInt16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeUint16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeInt32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeUint32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeInt64(t,r){this.writeInt32(t,Number(BigInt.asIntN(32,r))),this.writeInt32(t+4,Number(BigInt.asIntN(32,r>>BigInt(32))))}writeUint64(t,r){this.writeUint32(t,Number(BigInt.asUintN(32,r))),this.writeUint32(t+4,Number(BigInt.asUintN(32,r>>BigInt(32))))}writeFloat32(t,r){eo[0]=r,this.writeInt32(t,hr[0])}writeFloat64(t,r){ro[0]=r,this.writeInt32(t,hr[ki?0:1]),this.writeInt32(t+4,hr[ki?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let r=0;r<4;r++)t+=String.fromCharCode(this.readInt8(this.position_+4+r));return t}__offset(t,r){let i=t-this.readInt32(t);return r<this.readInt16(i)?this.readInt16(i+r):0}__union(t,r){return t.bb_pos=r+this.readInt32(r),t.bb=this,t}__string(t,r){t+=this.readInt32(t);let i=this.readInt32(t);t+=4;let s=this.bytes_.subarray(t,t+i);return r===zs.UTF8_BYTES?s:this.text_decoder_.decode(s)}__union_with_string(t,r){return typeof t=="string"?this.__string(r):this.__union(t,r)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let r=0;r<4;r++)if(t.charCodeAt(r)!=this.readInt8(this.position()+4+r))return!1;return!0}createScalarList(t,r){let i=[];for(let s=0;s<r;++s){let n=t(s);n!==null&&i.push(n)}return i}createObjList(t,r){let i=[];for(let s=0;s<r;++s){let n=t(s);n!==null&&i.push(n.unpack())}return i}};var Tr=class{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let r;t?r=t:r=1024,this.bb=Wt.allocate(r),this.space=r}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,r){t>this.minalign&&(this.minalign=t);let i=~(this.bb.capacity()-this.space+r)+1&t-1;for(;this.space<i+t+r;){let s=this.bb.capacity();this.bb=Tr.growByteBuffer(this.bb),this.space+=this.bb.capacity()-s}this.pad(i)}pad(t){for(let r=0;r<t;r++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,r,i){(this.force_defaults||r!=i)&&(this.addInt8(r),this.slot(t))}addFieldInt16(t,r,i){(this.force_defaults||r!=i)&&(this.addInt16(r),this.slot(t))}addFieldInt32(t,r,i){(this.force_defaults||r!=i)&&(this.addInt32(r),this.slot(t))}addFieldInt64(t,r,i){(this.force_defaults||r!==i)&&(this.addInt64(r),this.slot(t))}addFieldFloat32(t,r,i){(this.force_defaults||r!=i)&&(this.addFloat32(r),this.slot(t))}addFieldFloat64(t,r,i){(this.force_defaults||r!=i)&&(this.addFloat64(r),this.slot(t))}addFieldOffset(t,r,i){(this.force_defaults||r!=i)&&(this.addOffset(r),this.slot(t))}addFieldStruct(t,r,i){r!=i&&(this.nested(r),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let r=t.capacity();if(r&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let i=r<<1,s=Wt.allocate(i);return s.setPosition(i-r),s.bytes().set(t.bytes(),i-r),s}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let r=0;r<t;r++)this.vtable[r]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),r=this.vtable_in_use-1;for(;r>=0&&this.vtable[r]==0;r--);let i=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);let s=2;this.addInt16(t-this.object_start);let n=(i+s)*2;this.addInt16(n);let o=0,a=this.space;t:for(r=0;r<this.vtables.length;r++){let h=this.bb.capacity()-this.vtables[r];if(n==this.bb.readInt16(h)){for(let l=2;l<n;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(h+l))continue t;o=this.vtables[r];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,r,i){let s=i?4:0;if(r){let n=r;if(this.prep(this.minalign,4+4+s),n.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let o=4-1;o>=0;o--)this.writeInt8(n.charCodeAt(o))}this.prep(this.minalign,4+s),this.addOffset(t),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,r){this.finish(t,r,!0)}requiredField(t,r){let i=this.bb.capacity()-t,s=i-this.bb.readInt32(i);if(!(r<this.bb.readInt16(s)&&this.bb.readInt16(s+r)!=0))throw new TypeError("FlatBuffers: field "+r+" must be set")}startVector(t,r,i){this.notNested(),this.vector_num_elems=r,this.prep(4,t*r),this.prep(i,t*r)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let r=this.createString(t);return this.string_maps.set(t,r),r}createString(t){if(t==null)return 0;let r;return t instanceof Uint8Array?r=t:r=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,r.length,1),this.bb.setPosition(this.space-=r.length),this.bb.bytes().set(r,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let r=[];for(let i=0;i<t.length;++i){let s=t[i];if(s!==null)r.push(this.createObjectOffset(s));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return r}createStructOffsetList(t,r){return r(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var js;(function(e){e[e.BUFFER=0]="BUFFER"})(js||(js={}));var Vs;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(Vs||(Vs={}));var He=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBodyCompression(t,r){return(r||new He).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,r){return t.setPosition(t.position()+4),(r||new He).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Vs.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):js.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,r){t.addFieldInt8(0,r,Vs.LZ4_FRAME)}static addMethod(t,r){t.addFieldInt8(1,r,js.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,r,i){return He.startBodyCompression(t),He.addCodec(t,r),He.addMethod(t,i),He.endBodyCompression(t)}};var Gi=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,r,i){return t.prep(8,16),t.writeInt64(BigInt(i??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var Wi=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,r,i){return t.prep(8,16),t.writeInt64(BigInt(i??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var Pt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsRecordBatch(t,r){return(r||new Pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,r){return t.setPosition(t.position()+4),(r||new Pt).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,r){let i=this.bb.__offset(this.bb_pos,6);return i?(r||new Wi).__init(this.bb.__vector(this.bb_pos+i)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new Gi).__init(this.bb.__vector(this.bb_pos+i)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let r=this.bb.__offset(this.bb_pos,10);return r?(t||new He).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addNodes(t,r){t.addFieldOffset(1,r,0)}static startNodesVector(t,r){t.startVector(16,r,8)}static addBuffers(t,r){t.addFieldOffset(2,r,0)}static startBuffersVector(t,r){t.startVector(16,r,8)}static addCompression(t,r){t.addFieldOffset(3,r,0)}static endRecordBatch(t){return t.endObject()}};var Te=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryBatch(t,r){return(r||new Te).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,r){return t.setPosition(t.position()+4),(r||new Te).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new Pt).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addData(t,r){t.addFieldOffset(1,r,0)}static addIsDelta(t,r){t.addFieldInt8(2,+r,0)}static endDictionaryBatch(t){return t.endObject()}};var Yr;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(Yr||(Yr={}));var ks;(function(e){e[e.DenseArray=0]="DenseArray"})(ks||(ks={}));var Tt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInt(t,r){return(r||new Tt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,r){return t.setPosition(t.position()+4),(r||new Tt).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,r){t.addFieldInt32(0,r,0)}static addIsSigned(t,r){t.addFieldInt8(1,+r,0)}static endInt(t){return t.endObject()}static createInt(t,r,i){return Tt.startInt(t),Tt.addBitWidth(t,r),Tt.addIsSigned(t,i),Tt.endInt(t)}};var ve=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryEncoding(t,r){return(r||new ve).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,r){return t.setPosition(t.position()+4),(r||new ve).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new Tt).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):ks.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addIndexType(t,r){t.addFieldOffset(1,r,0)}static addIsOrdered(t,r){t.addFieldInt8(2,+r,0)}static addDictionaryKind(t,r){t.addFieldInt16(3,r,ks.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var ht=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsKeyValue(t,r){return(r||new ht).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,r){return t.setPosition(t.position()+4),(r||new ht).__init(t.readInt32(t.position())+t.position(),t)}key(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}value(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,r){t.addFieldOffset(0,r,0)}static addValue(t,r){t.addFieldOffset(1,r,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,r,i){return ht.startKeyValue(t),ht.addKey(t,r),ht.addValue(t,i),ht.endKeyValue(t)}};var lr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinary(t,r){return(r||new lr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,r){return t.setPosition(t.position()+4),(r||new lr).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return lr.startBinary(t),lr.endBinary(t)}};var cr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBool(t,r){return(r||new cr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,r){return t.setPosition(t.position()+4),(r||new cr).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return cr.startBool(t),cr.endBool(t)}};var Qt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDate(t,r){return(r||new Qt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,r){return t.setPosition(t.position()+4),(r||new Qt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ft.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,ft.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,r){return Qt.startDate(t),Qt.addUnit(t,r),Qt.endDate(t)}};var Ot=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDecimal(t,r){return(r||new Ot).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,r){return t.setPosition(t.position()+4),(r||new Ot).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,r){t.addFieldInt32(0,r,0)}static addScale(t,r){t.addFieldInt32(1,r,0)}static addBitWidth(t,r){t.addFieldInt32(2,r,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,r,i,s){return Ot.startDecimal(t),Ot.addPrecision(t,r),Ot.addScale(t,i),Ot.addBitWidth(t,s),Ot.endDecimal(t)}};var te=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDuration(t,r){return(r||new te).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,r){return t.setPosition(t.position()+4),(r||new te).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):M.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,M.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,r){return te.startDuration(t),te.addUnit(t,r),te.endDuration(t)}};var ee=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeBinary(t,r){return(r||new ee).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,r){return t.setPosition(t.position()+4),(r||new ee).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,r){return ee.startFixedSizeBinary(t),ee.addByteWidth(t,r),ee.endFixedSizeBinary(t)}};var re=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeList(t,r){return(r||new re).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,r){return t.setPosition(t.position()+4),(r||new re).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,r){return re.startFixedSizeList(t),re.addListSize(t,r),re.endFixedSizeList(t)}};var ie=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFloatingPoint(t,r){return(r||new ie).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,r){return t.setPosition(t.position()+4),(r||new ie).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):st.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,r){t.addFieldInt16(0,r,st.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,r){return ie.startFloatingPoint(t),ie.addPrecision(t,r),ie.endFloatingPoint(t)}};var se=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInterval(t,r){return(r||new se).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,r){return t.setPosition(t.position()+4),(r||new se).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):bt.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,bt.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,r){return se.startInterval(t),se.addUnit(t,r),se.endInterval(t)}};var ur=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeBinary(t,r){return(r||new ur).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,r){return t.setPosition(t.position()+4),(r||new ur).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return ur.startLargeBinary(t),ur.endLargeBinary(t)}};var fr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeUtf8(t,r){return(r||new fr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,r){return t.setPosition(t.position()+4),(r||new fr).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return fr.startLargeUtf8(t),fr.endLargeUtf8(t)}};var dr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsList(t,r){return(r||new dr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,r){return t.setPosition(t.position()+4),(r||new dr).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return dr.startList(t),dr.endList(t)}};var ne=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMap(t,r){return(r||new ne).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,r){return t.setPosition(t.position()+4),(r||new ne).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,r){t.addFieldInt8(0,+r,0)}static endMap(t){return t.endObject()}static createMap(t,r){return ne.startMap(t),ne.addKeysSorted(t,r),ne.endMap(t)}};var pr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsNull(t,r){return(r||new pr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,r){return t.setPosition(t.position()+4),(r||new pr).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return pr.startNull(t),pr.endNull(t)}};var mr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsStruct_(t,r){return(r||new mr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,r){return t.setPosition(t.position()+4),(r||new mr).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return mr.startStruct_(t),mr.endStruct_(t)}};var zt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTime(t,r){return(r||new zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,r){return t.setPosition(t.position()+4),(r||new zt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):M.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,M.MILLISECOND)}static addBitWidth(t,r){t.addFieldInt32(1,r,32)}static endTime(t){return t.endObject()}static createTime(t,r,i){return zt.startTime(t),zt.addUnit(t,r),zt.addBitWidth(t,i),zt.endTime(t)}};var jt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTimestamp(t,r){return(r||new jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,r){return t.setPosition(t.position()+4),(r||new jt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):M.SECOND}timezone(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,M.SECOND)}static addTimezone(t,r){t.addFieldOffset(1,r,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,r,i){return jt.startTimestamp(t),jt.addUnit(t,r),jt.addTimezone(t,i),jt.endTimestamp(t)}};var Et=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUnion(t,r){return(r||new Et).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,r){return t.setPosition(t.position()+4),(r||new Et).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):at.Sparse}typeIds(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readInt32(this.bb.__vector(this.bb_pos+r)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,r){t.addFieldInt16(0,r,at.Sparse)}static addTypeIds(t,r){t.addFieldOffset(1,r,0)}static createTypeIdsVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addInt32(r[i]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,i){return Et.startUnion(t),Et.addMode(t,r),Et.addTypeIds(t,i),Et.endUnion(t)}};var yr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new yr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||new yr).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return yr.startUtf8(t),yr.endUtf8(t)}};var ot;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded"})(ot||(ot={}));var wt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new wt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new wt).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):ot.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new ve).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let i=this.bb.__offset(this.bb_pos,14);return i?(r||new wt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,16);return i?(r||new ht).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,ot.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}};var pt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||new pt).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Yr.Little}fields(t,r){let i=this.bb.__offset(this.bb_pos,6);return i?(r||new wt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new ht).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,r){t.addFieldInt16(0,r,Yr.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let i=r.length-1;i>=0;i--)t.addInt64(r[i]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,r){t.finish(r)}static finishSizePrefixedSchemaBuffer(t,r){t.finish(r,void 0,!0)}static createSchema(t,r,i,s,n){return pt.startSchema(t),pt.addEndianness(t,r),pt.addFields(t,i),pt.addCustomMetadata(t,s),pt.addFeatures(t,n),pt.endSchema(t)}};var H;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(H||(H={}));var f;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(f||(f={}));var qe;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(qe||(qe={}));var mh={};$r(mh,{clampRange:()=>Hs,createElementComparator:()=>Zr,wrapIndex:()=>yi});var Xa={};$r(Xa,{valueToString:()=>$e});function $e(e){if(e===null)return"null";if(e===void 0)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>$e(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r=="bigint"?`${r}`:r)}var th={};$r(th,{BN:()=>ni,bigNumToBigInt:()=>Sl,bigNumToNumber:()=>Qa,bigNumToString:()=>$i,isArrowBigNumSymbol:()=>Il});function Y(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function Ka(e,t){return Y(e/t)+Y(e%t)/Y(t)}var Il=Symbol.for("isArrowBigNum");function Ye(e,...t){return t.length===0?Object.setPrototypeOf(G(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}Ye.prototype[Il]=!0;Ye.prototype.toJSON=function(){return`"${$i(this)}"`};Ye.prototype.valueOf=function(e){return Qa(this,e)};Ye.prototype.toString=function(){return $i(this)};Ye.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return Qa(this);case"string":return $i(this);case"default":return Sl(this)}return $i(this)};function Hi(...e){return Ye.apply(this,e)}function qi(...e){return Ye.apply(this,e)}function Gs(...e){return Ye.apply(this,e)}Object.setPrototypeOf(Hi.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(qi.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Gs.prototype,Object.create(Uint32Array.prototype));Object.assign(Hi.prototype,Ye.prototype,{constructor:Hi,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(qi.prototype,Ye.prototype,{constructor:qi,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Gs.prototype,Ye.prototype,{constructor:Gs,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var Zd=BigInt(4294967296)*BigInt(4294967296),Qd=Zd-BigInt(1);function Qa(e,t){let{buffer:r,byteOffset:i,byteLength:s,signed:n}=e,o=new BigUint64Array(r,i,s/8),a=n&&o.at(-1)&BigInt(1)<<BigInt(63),h=BigInt(0),l=0;if(a){for(let c of o)h|=(c^Qd)*(BigInt(1)<<BigInt(64*l++));h*=BigInt(-1),h-=BigInt(1)}else for(let c of o)h|=c*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"){let c=BigInt(Math.pow(10,t)),u=h/c,d=h%c;return Y(u)+Y(d)/Y(c)}return Y(h)}function $i(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return Za(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Za(e);t=t.slice();let i=1;for(let n=0;n<t.length;n++){let o=t[n],a=~o+i;t[n]=a,i&=o===0?1:0}return`-${Za(t)}`}function Sl(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:$i(e)}function Za(e){let t="",r=new Uint32Array(2),i=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),s=new Uint32Array((i=new Uint16Array(i).reverse()).buffer),n=-1,o=i.length-1;do{for(r[0]=i[n=0];n<o;)i[n++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+i[n];i[n]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,t=`${r[0]}${t}`}while(s[0]||s[1]||s[2]||s[3]);return t??"0"}var ni=class{static new(t,r){switch(r){case!0:return new Hi(t);case!1:return new qi(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Hi(t)}return t.byteLength===16?new Gs(t):new qi(t)}static signed(t){return new Hi(t)}static unsigned(t){return new qi(t)}static decimal(t){return new Gs(t)}constructor(t,r){return ni.new(t,r)}};var Bl,Al,Dl,Tl,Ol,El,Nl,Fl,Ll,Rl,Ul,Cl,Pl,zl,jl,Vl,kl,Gl,Wl,Hl,ql,$l,w=class{static isNull(t){return t?.typeId===f.Null}static isInt(t){return t?.typeId===f.Int}static isFloat(t){return t?.typeId===f.Float}static isBinary(t){return t?.typeId===f.Binary}static isLargeBinary(t){return t?.typeId===f.LargeBinary}static isUtf8(t){return t?.typeId===f.Utf8}static isLargeUtf8(t){return t?.typeId===f.LargeUtf8}static isBool(t){return t?.typeId===f.Bool}static isDecimal(t){return t?.typeId===f.Decimal}static isDate(t){return t?.typeId===f.Date}static isTime(t){return t?.typeId===f.Time}static isTimestamp(t){return t?.typeId===f.Timestamp}static isInterval(t){return t?.typeId===f.Interval}static isDuration(t){return t?.typeId===f.Duration}static isList(t){return t?.typeId===f.List}static isStruct(t){return t?.typeId===f.Struct}static isUnion(t){return t?.typeId===f.Union}static isFixedSizeBinary(t){return t?.typeId===f.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===f.FixedSizeList}static isMap(t){return t?.typeId===f.Map}static isDictionary(t){return t?.typeId===f.Dictionary}static isDenseUnion(t){return w.isUnion(t)&&t.mode===at.Dense}static isSparseUnion(t){return w.isUnion(t)&&t.mode===at.Sparse}constructor(t){this.typeId=t}};Bl=Symbol.toStringTag;w[Bl]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(w.prototype);var Nt=class extends w{constructor(){super(f.Null)}toString(){return"Null"}};Al=Symbol.toStringTag;Nt[Al]=(e=>e[Symbol.toStringTag]="Null")(Nt.prototype);var _t=class extends w{constructor(t,r){super(f.Int),this.isSigned=t,this.bitWidth=r}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};Dl=Symbol.toStringTag;_t[Dl]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(_t.prototype);var oi=class extends _t{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},ai=class extends _t{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},we=class extends _t{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},hi=class extends _t{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},li=class extends _t{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},ci=class extends _t{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},ui=class extends _t{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},fi=class extends _t{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(oi.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(ai.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(we.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(hi.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(li.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(ci.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ui.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(fi.prototype,"ArrayType",{value:BigUint64Array});var oe=class extends w{constructor(t){super(f.Float),this.precision=t}get ArrayType(){switch(this.precision){case st.HALF:return Uint16Array;case st.SINGLE:return Float32Array;case st.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Tl=Symbol.toStringTag;oe[Tl]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(oe.prototype);var di=class extends oe{constructor(){super(st.HALF)}},pi=class extends oe{constructor(){super(st.SINGLE)}},mi=class extends oe{constructor(){super(st.DOUBLE)}};Object.defineProperty(di.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(pi.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(mi.prototype,"ArrayType",{value:Float64Array});var Oe=class extends w{constructor(){super(f.Binary)}toString(){return"Binary"}};Ol=Symbol.toStringTag;Oe[Ol]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Oe.prototype);var gr=class extends w{constructor(){super(f.LargeBinary)}toString(){return"LargeBinary"}};El=Symbol.toStringTag;gr[El]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(gr.prototype);var Ee=class extends w{constructor(){super(f.Utf8)}toString(){return"Utf8"}};Nl=Symbol.toStringTag;Ee[Nl]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Ee.prototype);var br=class extends w{constructor(){super(f.LargeUtf8)}toString(){return"LargeUtf8"}};Fl=Symbol.toStringTag;br[Fl]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(br.prototype);var Ne=class extends w{constructor(){super(f.Bool)}toString(){return"Bool"}};Ll=Symbol.toStringTag;Ne[Ll]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Ne.prototype);var Fe=class extends w{constructor(t,r,i=128){super(f.Decimal),this.scale=t,this.precision=r,this.bitWidth=i}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};Rl=Symbol.toStringTag;Fe[Rl]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Fe.prototype);var xe=class extends w{constructor(t){super(f.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${ft[this.unit]}>`}get ArrayType(){return this.unit===ft.DAY?Int32Array:BigInt64Array}};Ul=Symbol.toStringTag;xe[Ul]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(xe.prototype);var Yi=class extends xe{constructor(){super(ft.DAY)}},Ji=class extends xe{constructor(){super(ft.MILLISECOND)}},Ht=class extends w{constructor(t,r){super(f.Time),this.unit=t,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${M[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Cl=Symbol.toStringTag;Ht[Cl]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Ht.prototype);var Xi=class extends Ht{constructor(){super(M.SECOND,32)}},Ki=class extends Ht{constructor(){super(M.MILLISECOND,32)}},Zi=class extends Ht{constructor(){super(M.MICROSECOND,64)}},Qi=class extends Ht{constructor(){super(M.NANOSECOND,64)}},qt=class extends w{constructor(t,r){super(f.Timestamp),this.unit=t,this.timezone=r}toString(){return`Timestamp<${M[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};Pl=Symbol.toStringTag;qt[Pl]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(qt.prototype);var ts=class extends qt{constructor(t){super(M.SECOND,t)}},es=class extends qt{constructor(t){super(M.MILLISECOND,t)}},rs=class extends qt{constructor(t){super(M.MICROSECOND,t)}},is=class extends qt{constructor(t){super(M.NANOSECOND,t)}},Me=class extends w{constructor(t){super(f.Interval),this.unit=t}toString(){return`Interval<${bt[this.unit]}>`}};zl=Symbol.toStringTag;Me[zl]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Me.prototype);var ss=class extends Me{constructor(){super(bt.DAY_TIME)}},ns=class extends Me{constructor(){super(bt.YEAR_MONTH)}},_r=class extends w{constructor(t){super(f.Duration),this.unit=t}toString(){return`Duration<${M[this.unit]}>`}};jl=Symbol.toStringTag;_r[jl]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(_r.prototype);var ae=class extends w{constructor(t){super(f.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};Vl=Symbol.toStringTag;ae[Vl]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(ae.prototype);var Q=class extends w{constructor(t){super(f.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};kl=Symbol.toStringTag;Q[kl]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(Q.prototype);var Le=class extends w{constructor(t,r,i){super(f.Union),this.mode=t,this.children=i,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((s,n,o)=>(s[n]=o)&&s||s,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};Gl=Symbol.toStringTag;Le[Gl]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Le.prototype);var vr=class extends w{constructor(t){super(f.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};Wl=Symbol.toStringTag;vr[Wl]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(vr.prototype);var he=class extends w{constructor(t,r){super(f.FixedSizeList),this.listSize=t,this.children=[r]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};Hl=Symbol.toStringTag;he[Hl]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(he.prototype);var le=class extends w{constructor(t,r=!1){var i,s,n;if(super(f.Map),this.children=[t],this.keysSorted=r,t&&(t.name="entries",!((i=t?.type)===null||i===void 0)&&i.children)){let o=(s=t?.type)===null||s===void 0?void 0:s.children[0];o&&(o.name="key");let a=(n=t?.type)===null||n===void 0?void 0:n.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};ql=Symbol.toStringTag;le[ql]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(le.prototype);var tp=(e=>()=>++e)(-1),ce=class extends w{constructor(t,r,i,s){super(f.Dictionary),this.indices=r,this.dictionary=t,this.isOrdered=s||!1,this.id=i==null?tp():Y(i)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};$l=Symbol.toStringTag;ce[$l]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(ce.prototype);function Ie(e){let t=e;switch(e.typeId){case f.Decimal:return e.bitWidth/32;case f.Interval:return 1+t.unit;case f.FixedSizeList:return t.listSize;case f.FixedSizeBinary:return t.byteWidth;default:return 1}}var B=class{visitMany(t,...r){return t.map((i,s)=>this.visit(i,...r.map(n=>n[s])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return ep(this,t,r)}getVisitFnByTypeId(t,r=!0){return os(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitLargeUtf8(t,...r){return null}visitBinary(t,...r){return null}visitLargeBinary(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};function ep(e,t,r=!0){return typeof t=="number"?os(e,t,r):typeof t=="string"&&t in f?os(e,f[t],r):t&&t instanceof w?os(e,Yl(t),r):t?.type&&t.type instanceof w?os(e,Yl(t.type),r):os(e,f.NONE,r)}function os(e,t,r=!0){let i=null;switch(t){case f.Null:i=e.visitNull;break;case f.Bool:i=e.visitBool;break;case f.Int:i=e.visitInt;break;case f.Int8:i=e.visitInt8||e.visitInt;break;case f.Int16:i=e.visitInt16||e.visitInt;break;case f.Int32:i=e.visitInt32||e.visitInt;break;case f.Int64:i=e.visitInt64||e.visitInt;break;case f.Uint8:i=e.visitUint8||e.visitInt;break;case f.Uint16:i=e.visitUint16||e.visitInt;break;case f.Uint32:i=e.visitUint32||e.visitInt;break;case f.Uint64:i=e.visitUint64||e.visitInt;break;case f.Float:i=e.visitFloat;break;case f.Float16:i=e.visitFloat16||e.visitFloat;break;case f.Float32:i=e.visitFloat32||e.visitFloat;break;case f.Float64:i=e.visitFloat64||e.visitFloat;break;case f.Utf8:i=e.visitUtf8;break;case f.LargeUtf8:i=e.visitLargeUtf8;break;case f.Binary:i=e.visitBinary;break;case f.LargeBinary:i=e.visitLargeBinary;break;case f.FixedSizeBinary:i=e.visitFixedSizeBinary;break;case f.Date:i=e.visitDate;break;case f.DateDay:i=e.visitDateDay||e.visitDate;break;case f.DateMillisecond:i=e.visitDateMillisecond||e.visitDate;break;case f.Timestamp:i=e.visitTimestamp;break;case f.TimestampSecond:i=e.visitTimestampSecond||e.visitTimestamp;break;case f.TimestampMillisecond:i=e.visitTimestampMillisecond||e.visitTimestamp;break;case f.TimestampMicrosecond:i=e.visitTimestampMicrosecond||e.visitTimestamp;break;case f.TimestampNanosecond:i=e.visitTimestampNanosecond||e.visitTimestamp;break;case f.Time:i=e.visitTime;break;case f.TimeSecond:i=e.visitTimeSecond||e.visitTime;break;case f.TimeMillisecond:i=e.visitTimeMillisecond||e.visitTime;break;case f.TimeMicrosecond:i=e.visitTimeMicrosecond||e.visitTime;break;case f.TimeNanosecond:i=e.visitTimeNanosecond||e.visitTime;break;case f.Decimal:i=e.visitDecimal;break;case f.List:i=e.visitList;break;case f.Struct:i=e.visitStruct;break;case f.Union:i=e.visitUnion;break;case f.DenseUnion:i=e.visitDenseUnion||e.visitUnion;break;case f.SparseUnion:i=e.visitSparseUnion||e.visitUnion;break;case f.Dictionary:i=e.visitDictionary;break;case f.Interval:i=e.visitInterval;break;case f.IntervalDayTime:i=e.visitIntervalDayTime||e.visitInterval;break;case f.IntervalYearMonth:i=e.visitIntervalYearMonth||e.visitInterval;break;case f.Duration:i=e.visitDuration;break;case f.DurationSecond:i=e.visitDurationSecond||e.visitDuration;break;case f.DurationMillisecond:i=e.visitDurationMillisecond||e.visitDuration;break;case f.DurationMicrosecond:i=e.visitDurationMicrosecond||e.visitDuration;break;case f.DurationNanosecond:i=e.visitDurationNanosecond||e.visitDuration;break;case f.FixedSizeList:i=e.visitFixedSizeList;break;case f.Map:i=e.visitMap;break}if(typeof i=="function")return i;if(!r)return()=>null;throw new Error(`Unrecognized type '${f[t]}'`)}function Yl(e){switch(e.typeId){case f.Null:return f.Null;case f.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?f.Int8:f.Uint8;case 16:return r?f.Int16:f.Uint16;case 32:return r?f.Int32:f.Uint32;case 64:return r?f.Int64:f.Uint64}return f.Int}case f.Float:switch(e.precision){case st.HALF:return f.Float16;case st.SINGLE:return f.Float32;case st.DOUBLE:return f.Float64}return f.Float;case f.Binary:return f.Binary;case f.LargeBinary:return f.LargeBinary;case f.Utf8:return f.Utf8;case f.LargeUtf8:return f.LargeUtf8;case f.Bool:return f.Bool;case f.Decimal:return f.Decimal;case f.Time:switch(e.unit){case M.SECOND:return f.TimeSecond;case M.MILLISECOND:return f.TimeMillisecond;case M.MICROSECOND:return f.TimeMicrosecond;case M.NANOSECOND:return f.TimeNanosecond}return f.Time;case f.Timestamp:switch(e.unit){case M.SECOND:return f.TimestampSecond;case M.MILLISECOND:return f.TimestampMillisecond;case M.MICROSECOND:return f.TimestampMicrosecond;case M.NANOSECOND:return f.TimestampNanosecond}return f.Timestamp;case f.Date:switch(e.unit){case ft.DAY:return f.DateDay;case ft.MILLISECOND:return f.DateMillisecond}return f.Date;case f.Interval:switch(e.unit){case bt.DAY_TIME:return f.IntervalDayTime;case bt.YEAR_MONTH:return f.IntervalYearMonth}return f.Interval;case f.Duration:switch(e.unit){case M.SECOND:return f.DurationSecond;case M.MILLISECOND:return f.DurationMillisecond;case M.MICROSECOND:return f.DurationMicrosecond;case M.NANOSECOND:return f.DurationNanosecond}return f.Duration;case f.Map:return f.Map;case f.List:return f.List;case f.Struct:return f.Struct;case f.Union:switch(e.mode){case at.Dense:return f.DenseUnion;case at.Sparse:return f.SparseUnion}return f.Union;case f.FixedSizeBinary:return f.FixedSizeBinary;case f.FixedSizeList:return f.FixedSizeList;case f.Dictionary:return f.Dictionary}throw new Error(`Unrecognized type '${f[e.typeId]}'`)}B.prototype.visitInt8=null;B.prototype.visitInt16=null;B.prototype.visitInt32=null;B.prototype.visitInt64=null;B.prototype.visitUint8=null;B.prototype.visitUint16=null;B.prototype.visitUint32=null;B.prototype.visitUint64=null;B.prototype.visitFloat16=null;B.prototype.visitFloat32=null;B.prototype.visitFloat64=null;B.prototype.visitDateDay=null;B.prototype.visitDateMillisecond=null;B.prototype.visitTimestampSecond=null;B.prototype.visitTimestampMillisecond=null;B.prototype.visitTimestampMicrosecond=null;B.prototype.visitTimestampNanosecond=null;B.prototype.visitTimeSecond=null;B.prototype.visitTimeMillisecond=null;B.prototype.visitTimeMicrosecond=null;B.prototype.visitTimeNanosecond=null;B.prototype.visitDenseUnion=null;B.prototype.visitSparseUnion=null;B.prototype.visitIntervalDayTime=null;B.prototype.visitIntervalYearMonth=null;B.prototype.visitDuration=null;B.prototype.visitDurationSecond=null;B.prototype.visitDurationMillisecond=null;B.prototype.visitDurationMicrosecond=null;B.prototype.visitDurationNanosecond=null;var eh={};$r(eh,{float64ToUint16:()=>Ws,uint16ToFloat64:()=>so});var Jl=new Float64Array(1),as=new Uint32Array(Jl.buffer);function so(e){let t=(e&31744)>>10,r=(e&1023)/1024,i=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return i*(r?Number.NaN:1/0);case 0:return i*(r?6103515625e-14*r:0)}return i*Math.pow(2,t-15)*(1+r)}function Ws(e){if(e!==e)return 32256;Jl[0]=e;let t=(as[1]&2147483648)>>16&65535,r=as[1]&2146435072,i=0;return r>=1089470464?as[0]>0?r=31744:(r=(r&2080374784)>>16,i=(as[1]&1048575)>>10):r<=1056964608?(i=1048576+(as[1]&1048575),i=1048576+(i<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,i=(as[1]&1048575)+512>>10),t|r|i&65535}var E=class extends B{};function R(e){return(t,r,i)=>{if(t.setValid(r,i!=null))return e(t,r,i)}}var rp=(e,t,r)=>{e[t]=Math.floor(r/864e5)},Xl=(e,t,r,i)=>{if(r+1<t.length){let s=Y(t[r]),n=Y(t[r+1]);e.set(i.subarray(0,n-s),s)}},ip=({offset:e,values:t},r,i)=>{let s=e+r;i?t[s>>3]|=1<<s%8:t[s>>3]&=~(1<<s%8)},Or=({values:e},t,r)=>{e[t]=r},rh=({values:e},t,r)=>{e[t]=r},Kl=({values:e},t,r)=>{e[t]=Ws(r)},sp=(e,t,r)=>{switch(e.type.precision){case st.HALF:return Kl(e,t,r);case st.SINGLE:case st.DOUBLE:return rh(e,t,r)}},no=({values:e},t,r)=>{rp(e,t,r.valueOf())},oo=({values:e},t,r)=>{e[t]=BigInt(r)},ih=({stride:e,values:t},r,i)=>{t.set(i.subarray(0,e),e*r)},Zl=({values:e,valueOffsets:t},r,i)=>Xl(e,t,r,i),Ql=({values:e,valueOffsets:t},r,i)=>Xl(e,t,r,or(i)),sh=(e,t,r)=>{e.type.unit===ft.DAY?no(e,t,r):oo(e,t,r)},ao=({values:e},t,r)=>{e[t]=BigInt(r/1e3)},ho=({values:e},t,r)=>{e[t]=BigInt(r)},lo=({values:e},t,r)=>{e[t]=BigInt(r*1e3)},co=({values:e},t,r)=>{e[t]=BigInt(r*1e6)},nh=(e,t,r)=>{switch(e.type.unit){case M.SECOND:return ao(e,t,r);case M.MILLISECOND:return ho(e,t,r);case M.MICROSECOND:return lo(e,t,r);case M.NANOSECOND:return co(e,t,r)}},uo=({values:e},t,r)=>{e[t]=r},fo=({values:e},t,r)=>{e[t]=r},po=({values:e},t,r)=>{e[t]=r},mo=({values:e},t,r)=>{e[t]=r},oh=(e,t,r)=>{switch(e.type.unit){case M.SECOND:return uo(e,t,r);case M.MILLISECOND:return fo(e,t,r);case M.MICROSECOND:return po(e,t,r);case M.NANOSECOND:return mo(e,t,r)}},ah=({values:e,stride:t},r,i)=>{e.set(i.subarray(0,t),t*r)},np=(e,t,r)=>{let i=e.children[0],s=e.valueOffsets,n=Rt.getVisitFn(i);if(Array.isArray(r))for(let o=-1,a=s[t],h=s[t+1];a<h;)n(i,a++,r[++o]);else for(let o=-1,a=s[t],h=s[t+1];a<h;)n(i,a++,r.get(++o))},op=(e,t,r)=>{let i=e.children[0],{valueOffsets:s}=e,n=Rt.getVisitFn(i),{[t]:o,[t+1]:a}=s,h=r instanceof Map?r.entries():Object.entries(r);for(let l of h)if(n(i,o,l),++o>=a)break},ap=(e,t)=>(r,i,s,n)=>i&&r(i,e,t[n]),hp=(e,t)=>(r,i,s,n)=>i&&r(i,e,t.get(n)),lp=(e,t)=>(r,i,s,n)=>i&&r(i,e,t.get(s.name)),cp=(e,t)=>(r,i,s,n)=>i&&r(i,e,t[s.name]),up=(e,t,r)=>{let i=e.type.children.map(n=>Rt.getVisitFn(n.type)),s=r instanceof Map?lp(t,r):r instanceof j?hp(t,r):Array.isArray(r)?ap(t,r):cp(t,r);e.type.children.forEach((n,o)=>s(i[o],e.children[o],n,o))},fp=(e,t,r)=>{e.type.mode===at.Dense?tc(e,t,r):ec(e,t,r)},tc=(e,t,r)=>{let i=e.type.typeIdToChildIndex[e.typeIds[t]],s=e.children[i];Rt.visit(s,e.valueOffsets[t],r)},ec=(e,t,r)=>{let i=e.type.typeIdToChildIndex[e.typeIds[t]],s=e.children[i];Rt.visit(s,t,r)},dp=(e,t,r)=>{var i;(i=e.dictionary)===null||i===void 0||i.set(e.values[t],r)},hh=(e,t,r)=>{e.type.unit===bt.DAY_TIME?yo(e,t,r):go(e,t,r)},yo=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},go=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},bo=({values:e},t,r)=>{e[t]=r},_o=({values:e},t,r)=>{e[t]=r},vo=({values:e},t,r)=>{e[t]=r},wo=({values:e},t,r)=>{e[t]=r},lh=(e,t,r)=>{switch(e.type.unit){case M.SECOND:return bo(e,t,r);case M.MILLISECOND:return _o(e,t,r);case M.MICROSECOND:return vo(e,t,r);case M.NANOSECOND:return wo(e,t,r)}},pp=(e,t,r)=>{let{stride:i}=e,s=e.children[0],n=Rt.getVisitFn(s);if(Array.isArray(r))for(let o=-1,a=t*i;++o<i;)n(s,a+o,r[o]);else for(let o=-1,a=t*i;++o<i;)n(s,a+o,r.get(o))};E.prototype.visitBool=R(ip);E.prototype.visitInt=R(Or);E.prototype.visitInt8=R(Or);E.prototype.visitInt16=R(Or);E.prototype.visitInt32=R(Or);E.prototype.visitInt64=R(Or);E.prototype.visitUint8=R(Or);E.prototype.visitUint16=R(Or);E.prototype.visitUint32=R(Or);E.prototype.visitUint64=R(Or);E.prototype.visitFloat=R(sp);E.prototype.visitFloat16=R(Kl);E.prototype.visitFloat32=R(rh);E.prototype.visitFloat64=R(rh);E.prototype.visitUtf8=R(Ql);E.prototype.visitLargeUtf8=R(Ql);E.prototype.visitBinary=R(Zl);E.prototype.visitLargeBinary=R(Zl);E.prototype.visitFixedSizeBinary=R(ih);E.prototype.visitDate=R(sh);E.prototype.visitDateDay=R(no);E.prototype.visitDateMillisecond=R(oo);E.prototype.visitTimestamp=R(nh);E.prototype.visitTimestampSecond=R(ao);E.prototype.visitTimestampMillisecond=R(ho);E.prototype.visitTimestampMicrosecond=R(lo);E.prototype.visitTimestampNanosecond=R(co);E.prototype.visitTime=R(oh);E.prototype.visitTimeSecond=R(uo);E.prototype.visitTimeMillisecond=R(fo);E.prototype.visitTimeMicrosecond=R(po);E.prototype.visitTimeNanosecond=R(mo);E.prototype.visitDecimal=R(ah);E.prototype.visitList=R(np);E.prototype.visitStruct=R(up);E.prototype.visitUnion=R(fp);E.prototype.visitDenseUnion=R(tc);E.prototype.visitSparseUnion=R(ec);E.prototype.visitDictionary=R(dp);E.prototype.visitInterval=R(hh);E.prototype.visitIntervalDayTime=R(yo);E.prototype.visitIntervalYearMonth=R(go);E.prototype.visitDuration=R(lh);E.prototype.visitDurationSecond=R(bo);E.prototype.visitDurationMillisecond=R(_o);E.prototype.visitDurationMicrosecond=R(vo);E.prototype.visitDurationNanosecond=R(wo);E.prototype.visitFixedSizeList=R(pp);E.prototype.visitMap=R(op);var Rt=new E;var Je=Symbol.for("parent"),hs=Symbol.for("rowIndex"),Jr=class{constructor(t,r){return this[Je]=t,this[hs]=r,new Proxy(this,new uh)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[hs],r=this[Je],i=r.type.children,s={};for(let n=-1,o=i.length;++n<o;)s[i[n].name]=xt.visit(r.children[n],t);return s}toString(){return`{${[...this].map(([t,r])=>`${$e(t)}: ${$e(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new ch(this[Je],this[hs])}},ch=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,xt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Jr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Je]:{writable:!0,enumerable:!1,configurable:!1,value:null},[hs]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var uh=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Je].type.children.map(r=>r.name)}has(t,r){return t[Je].type.children.findIndex(i=>i.name===r)!==-1}getOwnPropertyDescriptor(t,r){if(t[Je].type.children.findIndex(i=>i.name===r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let i=t[Je].type.children.findIndex(s=>s.name===r);if(i!==-1){let s=xt.visit(t[Je].children[i],t[hs]);return Reflect.set(t,r,s),s}}set(t,r,i){let s=t[Je].type.children.findIndex(n=>n.name===r);return s!==-1?(Rt.visit(t[Je].children[s],t[hs],i),Reflect.set(t,r,i)):Reflect.has(t,r)||typeof r=="symbol"?Reflect.set(t,r,i):!1}};var A=class extends B{};function F(e){return(t,r)=>t.getValid(r)?e(t,r):null}var mp=(e,t)=>864e5*e[t],yp=(e,t)=>null,rc=(e,t,r)=>{if(r+1>=t.length)return null;let i=Y(t[r]),s=Y(t[r+1]);return e.subarray(i,s)},gp=({offset:e,values:t},r)=>{let i=e+r;return(t[i>>3]&1<<i%8)!==0},ic=({values:e},t)=>mp(e,t),sc=({values:e},t)=>Y(e[t]),Xr=({stride:e,values:t},r)=>t[e*r],bp=({stride:e,values:t},r)=>so(t[e*r]),nc=({values:e},t)=>e[t],_p=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),oc=({values:e,valueOffsets:t},r)=>rc(e,t,r),ac=({values:e,valueOffsets:t},r)=>{let i=rc(e,t,r);return i!==null?Us(i):null},vp=({values:e},t)=>e[t],wp=({type:e,values:t},r)=>e.precision!==st.HALF?t[r]:so(t[r]),xp=(e,t)=>e.type.unit===ft.DAY?ic(e,t):sc(e,t),hc=({values:e},t)=>1e3*Y(e[t]),lc=({values:e},t)=>Y(e[t]),cc=({values:e},t)=>Ka(e[t],BigInt(1e3)),uc=({values:e},t)=>Ka(e[t],BigInt(1e6)),Mp=(e,t)=>{switch(e.type.unit){case M.SECOND:return hc(e,t);case M.MILLISECOND:return lc(e,t);case M.MICROSECOND:return cc(e,t);case M.NANOSECOND:return uc(e,t)}},fc=({values:e},t)=>e[t],dc=({values:e},t)=>e[t],pc=({values:e},t)=>e[t],mc=({values:e},t)=>e[t],Ip=(e,t)=>{switch(e.type.unit){case M.SECOND:return fc(e,t);case M.MILLISECOND:return dc(e,t);case M.MICROSECOND:return pc(e,t);case M.NANOSECOND:return mc(e,t)}},Sp=({values:e,stride:t},r)=>ni.decimal(e.subarray(t*r,t*(r+1))),Bp=(e,t)=>{let{valueOffsets:r,stride:i,children:s}=e,{[t*i]:n,[t*i+1]:o}=r,h=s[0].slice(n,o-n);return new j([h])},Ap=(e,t)=>{let{valueOffsets:r,children:i}=e,{[t]:s,[t+1]:n}=r,o=i[0];return new wr(o.slice(s,n-s))},Dp=(e,t)=>new Jr(e,t),Tp=(e,t)=>e.type.mode===at.Dense?yc(e,t):gc(e,t),yc=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];return xt.visit(i,e.valueOffsets[t])},gc=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];return xt.visit(i,t)},Op=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},Ep=(e,t)=>e.type.unit===bt.DAY_TIME?bc(e,t):_c(e,t),bc=({values:e},t)=>e.subarray(2*t,2*(t+1)),_c=({values:e},t)=>{let r=e[t],i=new Int32Array(2);return i[0]=Math.trunc(r/12),i[1]=Math.trunc(r%12),i},vc=({values:e},t)=>e[t],wc=({values:e},t)=>e[t],xc=({values:e},t)=>e[t],Mc=({values:e},t)=>e[t],Np=(e,t)=>{switch(e.type.unit){case M.SECOND:return vc(e,t);case M.MILLISECOND:return wc(e,t);case M.MICROSECOND:return xc(e,t);case M.NANOSECOND:return Mc(e,t)}},Fp=(e,t)=>{let{stride:r,children:i}=e,n=i[0].slice(t*r,r);return new j([n])};A.prototype.visitNull=F(yp);A.prototype.visitBool=F(gp);A.prototype.visitInt=F(vp);A.prototype.visitInt8=F(Xr);A.prototype.visitInt16=F(Xr);A.prototype.visitInt32=F(Xr);A.prototype.visitInt64=F(nc);A.prototype.visitUint8=F(Xr);A.prototype.visitUint16=F(Xr);A.prototype.visitUint32=F(Xr);A.prototype.visitUint64=F(nc);A.prototype.visitFloat=F(wp);A.prototype.visitFloat16=F(bp);A.prototype.visitFloat32=F(Xr);A.prototype.visitFloat64=F(Xr);A.prototype.visitUtf8=F(ac);A.prototype.visitLargeUtf8=F(ac);A.prototype.visitBinary=F(oc);A.prototype.visitLargeBinary=F(oc);A.prototype.visitFixedSizeBinary=F(_p);A.prototype.visitDate=F(xp);A.prototype.visitDateDay=F(ic);A.prototype.visitDateMillisecond=F(sc);A.prototype.visitTimestamp=F(Mp);A.prototype.visitTimestampSecond=F(hc);A.prototype.visitTimestampMillisecond=F(lc);A.prototype.visitTimestampMicrosecond=F(cc);A.prototype.visitTimestampNanosecond=F(uc);A.prototype.visitTime=F(Ip);A.prototype.visitTimeSecond=F(fc);A.prototype.visitTimeMillisecond=F(dc);A.prototype.visitTimeMicrosecond=F(pc);A.prototype.visitTimeNanosecond=F(mc);A.prototype.visitDecimal=F(Sp);A.prototype.visitList=F(Bp);A.prototype.visitStruct=F(Dp);A.prototype.visitUnion=F(Tp);A.prototype.visitDenseUnion=F(yc);A.prototype.visitSparseUnion=F(gc);A.prototype.visitDictionary=F(Op);A.prototype.visitInterval=F(Ep);A.prototype.visitIntervalDayTime=F(bc);A.prototype.visitIntervalYearMonth=F(_c);A.prototype.visitDuration=F(Np);A.prototype.visitDurationSecond=F(vc);A.prototype.visitDurationMillisecond=F(wc);A.prototype.visitDurationMicrosecond=F(xc);A.prototype.visitDurationNanosecond=F(Mc);A.prototype.visitFixedSizeList=F(Fp);A.prototype.visitMap=F(Ap);var xt=new A;var Kr=Symbol.for("keys"),cs=Symbol.for("vals"),ls=Symbol.for("kKeysAsStrings"),fh=Symbol.for("_kKeysAsStrings"),wr=class{constructor(t){return this[Kr]=new j([t.children[0]]).memoize(),this[cs]=t.children[1],new Proxy(this,new ph)}get[ls](){return this[fh]||(this[fh]=Array.from(this[Kr].toArray(),String))}[Symbol.iterator](){return new dh(this[Kr],this[cs])}get size(){return this[Kr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Kr],r=this[cs],i={};for(let s=-1,n=t.length;++s<n;)i[t.get(s)]=xt.visit(r,s);return i}toString(){return`{${[...this].map(([t,r])=>`${$e(t)}: ${$e(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},dh=class{constructor(t,r){this.keys=t,this.vals=r,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),xt.visit(this.vals,t)]})}},ph=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[ls]}has(t,r){return t[ls].includes(r)}getOwnPropertyDescriptor(t,r){if(t[ls].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let i=t[ls].indexOf(r);if(i!==-1){let s=xt.visit(Reflect.get(t,cs),i);return Reflect.set(t,r,s),s}}set(t,r,i){let s=t[ls].indexOf(r);return s!==-1?(Rt.visit(Reflect.get(t,cs),s,i),Reflect.set(t,r,i)):Reflect.has(t,r)?Reflect.set(t,r,i):!1}};Object.defineProperties(wr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Kr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[cs]:{writable:!0,enumerable:!1,configurable:!1,value:null},[fh]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var Ic;function Hs(e,t,r,i){let{length:s=0}=e,n=typeof t!="number"?0:t,o=typeof r!="number"?s:r;return n<0&&(n=(n%s+s)%s),o<0&&(o=(o%s+s)%s),o<n&&(Ic=n,n=o,o=Ic),o>s&&(o=s),i?i(e,n,o):[n,o]}var yi=(e,t)=>e<0?t+e:e,Sc=e=>e!==e;function Zr(e){if(typeof e!=="object"||e===null)return Sc(e)?Sc:r=>r===e;if(e instanceof Date){let r=e.valueOf();return i=>i instanceof Date?i.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?qa(e,r):!1:e instanceof Map?Rp(e):Array.isArray(e)?Lp(e):e instanceof j?Up(e):Cp(e,!0)}function Lp(e){let t=[];for(let r=-1,i=e.length;++r<i;)t[r]=Zr(e[r]);return xo(t)}function Rp(e){let t=-1,r=[];for(let i of e.values())r[++t]=Zr(i);return xo(r)}function Up(e){let t=[];for(let r=-1,i=e.length;++r<i;)t[r]=Zr(e.get(r));return xo(t)}function Cp(e,t=!1){let r=Object.keys(e);if(!t&&r.length===0)return()=>!1;let i=[];for(let s=-1,n=r.length;++s<n;)i[s]=Zr(e[r[s]]);return xo(i,r)}function xo(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return Pp(e,r);case Map:return Bc(e,r,r.keys());case wr:case Jr:case Object:case void 0:return Bc(e,r,t||Object.keys(r))}return r instanceof j?zp(e,r):!1}}function Pp(e,t){let r=e.length;if(t.length!==r)return!1;for(let i=-1;++i<r;)if(!e[i](t[i]))return!1;return!0}function zp(e,t){let r=e.length;if(t.length!==r)return!1;for(let i=-1;++i<r;)if(!e[i](t.get(i)))return!1;return!0}function Bc(e,t,r){let i=r[Symbol.iterator](),s=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),n=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,a=e.length,h=n.next(),l=i.next(),c=s.next();for(;o<a&&!l.done&&!c.done&&!h.done&&!(l.value!==c.value||!e[o](h.value));++o,l=i.next(),c=s.next(),h=n.next());return o===a&&l.done&&c.done&&h.done?!0:(i.return&&i.return(),s.return&&s.return(),n.return&&n.return(),!1)}var yh={};$r(yh,{BitIterator:()=>gi,getBit:()=>Ac,getBool:()=>Io,packBools:()=>_i,popcnt_array:()=>Dc,popcnt_bit_range:()=>qs,popcnt_uint32:()=>Mo,setBool:()=>jp,truncateBitmap:()=>bi});function Io(e,t,r,i){return(r&1<<i)!==0}function Ac(e,t,r,i){return(r&1<<i)>>i}function jp(e,t,r){return r?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function bi(e,t,r){let i=r.byteLength+7&-8;if(e>0||r.byteLength<i){let s=new Uint8Array(i);return s.set(e%8===0?r.subarray(e>>3):_i(new gi(r,e,t,null,Io)).subarray(0,i)),s}return r}function _i(e){let t=[],r=0,i=0,s=0;for(let o of e)o&&(s|=1<<i),++i===8&&(t[r++]=s,s=i=0);(r===0||i>0)&&(t[r++]=s);let n=new Uint8Array(t.length+7&-8);return n.set(t),n}var gi=class{constructor(t,r,i,s,n){this.bytes=t,this.length=i,this.context=s,this.get=n,this.bit=r%8,this.byteIndex=r>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function qs(e,t,r){if(r-t<=0)return 0;if(r-t<8){let n=0;for(let o of new gi(e,t,r-t,e,Ac))n+=o;return n}let i=r>>3<<3,s=t+(t%8===0?0:8-t%8);return qs(e,t,s)+qs(e,i,r)+Dc(e,s>>3,i-s>>3)}function Dc(e,t,r){let i=0,s=Math.trunc(t),n=new DataView(e.buffer,e.byteOffset,e.byteLength),o=r===void 0?e.byteLength:s+r;for(;o-s>=4;)i+=Mo(n.getUint32(s)),s+=4;for(;o-s>=2;)i+=Mo(n.getUint16(s)),s+=2;for(;o-s>=1;)i+=Mo(n.getUint8(s)),s+=1;return i}function Mo(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var Vp=-1,q=class{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return w.isSparseUnion(t)?this.children.some(r=>r.nullable):w.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:i,nullBitmap:s,typeIds:n}=this;return r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),n&&(t+=n.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(w.isUnion(this.type))return this.children.reduce((i,s)=>i+s.nullCount,0);let t=this._nullCount,r;return t<=Vp&&(r=this.nullBitmap)&&(this._nullCount=t=r.length===0?0:this.length-qs(r,this.offset,this.offset+this.length)),t}constructor(t,r,i,s,n,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(i||0,0)),this._nullCount=Math.floor(Math.max(s||0,-1));let h;n instanceof q?(this.stride=n.stride,this.values=n.values,this.typeIds=n.typeIds,this.nullBitmap=n.nullBitmap,this.valueOffsets=n.valueOffsets):(this.stride=Ie(t),n&&((h=n[0])&&(this.valueOffsets=h),(h=n[1])&&(this.values=h),(h=n[2])&&(this.nullBitmap=h),(h=n[3])&&(this.typeIds=h)))}getValid(t){let{type:r}=this;if(w.isUnion(r)){let i=r,s=this.children[i.typeIdToChildIndex[this.typeIds[t]]],n=i.mode===at.Dense?this.valueOffsets[t]:t;return s.getValid(n)}if(this.nullable&&this.nullCount>0){let i=this.offset+t;return(this.nullBitmap[i>>3]&1<<i%8)!==0}return!0}setValid(t,r){let i,{type:s}=this;if(w.isUnion(s)){let n=s,o=this.children[n.typeIdToChildIndex[this.typeIds[t]]],a=n.mode===at.Dense?this.valueOffsets[t]:t;i=o.getValid(a),o.setValid(a,r)}else{let{nullBitmap:n}=this,{offset:o,length:a}=this,h=o+t,l=1<<h%8,c=h>>3;(!n||n.byteLength<=c)&&(n=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(n.set(bi(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:n})):Object.assign(this,{nullBitmap:n,_nullCount:0}));let u=n[c];i=(u&l)!==0,n[c]=r?u|l:u&~l}return i!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,i=this.length,s=this._nullCount,n=this,o=this.children){return new q(t,r,i,s,n,o,this.dictionary)}slice(t,r){let{stride:i,typeId:s,children:n}=this,o=+(this._nullCount===0)-1,a=s===16?i:1,h=this._sliceBuffers(t,r,i,s);return this.clone(this.type,this.offset+t,r,o,h,n.length===0||this.valueOffsets?n:this._sliceChildren(n,a*t,a*r))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===f.Null)return this.clone(this.type,0,t,0);let{length:r,nullCount:i}=this,s=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);s[r>>3]=(1<<r-(r&-8))-1,i>0&&s.set(bi(this.offset,r,this.nullBitmap),0);let n=this.buffers;return n[qe.VALIDITY]=s,this.clone(this.type,0,t,i+(t-r),n)}_sliceBuffers(t,r,i,s){let n,{buffers:o}=this;return(n=o[qe.TYPE])&&(o[qe.TYPE]=n.subarray(t,t+r)),(n=o[qe.OFFSET])&&(o[qe.OFFSET]=n.subarray(t,t+r+1))||(n=o[qe.DATA])&&(o[qe.DATA]=s===6?n:n.subarray(i*t,i*(t+r))),o}_sliceChildren(t,r,i){return t.map(s=>s.slice(r,i))}};q.prototype.children=Object.freeze([]);var vi=class extends B{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:r,["offset"]:i=0,["length"]:s=0}=t;return new q(r,i,s,s)}visitBool(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitInt(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitFloat(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitUtf8(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.data),n=N(t.nullBitmap),o=si(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,s,n])}visitLargeUtf8(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.data),n=N(t.nullBitmap),o=Zn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,s,n])}visitBinary(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.data),n=N(t.nullBitmap),o=si(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,s,n])}visitLargeBinary(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.data),n=N(t.nullBitmap),o=Zn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,s,n])}visitFixedSizeBinary(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitDate(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitTimestamp(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitTime(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitDecimal(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitList(t){let{["type"]:r,["offset"]:i=0,["child"]:s}=t,n=N(t.nullBitmap),o=si(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,void 0,n],[s])}visitStruct(t){let{["type"]:r,["offset"]:i=0,["children"]:s=[]}=t,n=N(t.nullBitmap),{length:o=s.reduce((h,{length:l})=>Math.max(h,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,void 0,n],s)}visitUnion(t){let{["type"]:r,["offset"]:i=0,["children"]:s=[]}=t,n=G(r.ArrayType,t.typeIds),{["length"]:o=n.length,["nullCount"]:a=-1}=t;if(w.isSparseUnion(r))return new q(r,i,o,a,[void 0,void 0,void 0,n],s);let h=si(t.valueOffsets);return new q(r,i,o,a,[h,void 0,void 0,n],s)}visitDictionary(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.indices.ArrayType,t.data),{["dictionary"]:o=new j([new vi().visit({type:r.dictionary})])}=t,{["length"]:a=n.length,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[void 0,n,s],[],o)}visitInterval(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitDuration(t){let{["type"]:r,["offset"]:i=0}=t,s=N(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitFixedSizeList(t){let{["type"]:r,["offset"]:i=0,["child"]:s=new vi().visit({type:r.valueType})}=t,n=N(t.nullBitmap),{["length"]:o=s.length/Ie(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,void 0,n],[s])}visitMap(t){let{["type"]:r,["offset"]:i=0,["child"]:s=new vi().visit({type:r.childType})}=t,n=N(t.nullBitmap),o=si(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,void 0,n],[s])}},kp=new vi;function U(e){return kp.visit(e)}var $s=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function Tc(e){return e.some(t=>t.nullable)}function So(e){return e.reduce((t,r)=>t+r.nullCount,0)}function Bo(e){return e.reduce((t,r,i)=>(t[i+1]=t[i]+r.length,t),new Uint32Array(e.length+1))}function Ao(e,t,r,i){let s=[];for(let n=-1,o=e.length;++n<o;){let a=e[n],h=t[n],{length:l}=a;if(h>=i)break;if(r>=h+l)continue;if(h>=r&&h+l<=i){s.push(a);continue}let c=Math.max(0,r-h),u=Math.min(i-h,l);s.push(a.slice(c,u-c))}return s.length===0&&s.push(e[0].slice(0,0)),s}function gh(e,t,r,i){let s=0,n=0,o=t.length-1;do{if(s>=o-1)return r<t[o]?i(e,s,r-t[s]):null;n=s+Math.trunc((o-s)*.5),r<t[n]?o=n:s=n}while(s<o)}function Ys(e,t){return e.getValid(t)}function us(e){function t(r,i,s){return e(r[i],s)}return function(r){let i=this.data;return gh(i,this._offsets,r,t)}}function Do(e){let t;function r(i,s,n){return e(i[s],n,t)}return function(i,s){let n=this.data;t=s;let o=gh(n,this._offsets,i,r);return t=void 0,o}}function To(e){let t;function r(i,s,n){let o=n,a=0,h=0;for(let l=s-1,c=i.length;++l<c;){let u=i[l];if(~(a=e(u,t,o)))return h+a;o=0,h+=u.length}return-1}return function(i,s){t=i;let n=this.data,o=typeof s!="number"?r(n,0,0):gh(n,this._offsets,s,r);return t=void 0,o}}var D=class extends B{};function Gp(e,t){return t===null&&e.length>0?0:-1}function Wp(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let i=0;for(let s of new gi(r,e.offset+(t||0),e.length,r,Io)){if(!s)return i;++i}return-1}function C(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case f.Union:break;case f.Dictionary:break;default:return Wp(e,r)}let i=xt.getVisitFn(e),s=Zr(t);for(let n=(r||0)-1,o=e.length;++n<o;)if(s(i(e,n)))return n;return-1}function Oc(e,t,r){let i=xt.getVisitFn(e),s=Zr(t);for(let n=(r||0)-1,o=e.length;++n<o;)if(s(i(e,n)))return n;return-1}D.prototype.visitNull=Gp;D.prototype.visitBool=C;D.prototype.visitInt=C;D.prototype.visitInt8=C;D.prototype.visitInt16=C;D.prototype.visitInt32=C;D.prototype.visitInt64=C;D.prototype.visitUint8=C;D.prototype.visitUint16=C;D.prototype.visitUint32=C;D.prototype.visitUint64=C;D.prototype.visitFloat=C;D.prototype.visitFloat16=C;D.prototype.visitFloat32=C;D.prototype.visitFloat64=C;D.prototype.visitUtf8=C;D.prototype.visitLargeUtf8=C;D.prototype.visitBinary=C;D.prototype.visitLargeBinary=C;D.prototype.visitFixedSizeBinary=C;D.prototype.visitDate=C;D.prototype.visitDateDay=C;D.prototype.visitDateMillisecond=C;D.prototype.visitTimestamp=C;D.prototype.visitTimestampSecond=C;D.prototype.visitTimestampMillisecond=C;D.prototype.visitTimestampMicrosecond=C;D.prototype.visitTimestampNanosecond=C;D.prototype.visitTime=C;D.prototype.visitTimeSecond=C;D.prototype.visitTimeMillisecond=C;D.prototype.visitTimeMicrosecond=C;D.prototype.visitTimeNanosecond=C;D.prototype.visitDecimal=C;D.prototype.visitList=C;D.prototype.visitStruct=C;D.prototype.visitUnion=C;D.prototype.visitDenseUnion=Oc;D.prototype.visitSparseUnion=Oc;D.prototype.visitDictionary=C;D.prototype.visitInterval=C;D.prototype.visitIntervalDayTime=C;D.prototype.visitIntervalYearMonth=C;D.prototype.visitDuration=C;D.prototype.visitDurationSecond=C;D.prototype.visitDurationMillisecond=C;D.prototype.visitDurationMicrosecond=C;D.prototype.visitDurationNanosecond=C;D.prototype.visitFixedSizeList=C;D.prototype.visitMap=C;var wi=new D;var T=class extends B{};function L(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(w.isInt(t)&&t.bitWidth!==64||w.isTime(t)&&t.bitWidth!==64||w.isFloat(t)&&t.precision!==st.HALF))return new $s(e.data.length,i=>{let s=e.data[i];return s.values.subarray(0,s.length)[Symbol.iterator]()});let r=0;return new $s(e.data.length,i=>{let n=e.data[i].length,o=e.slice(r,r+n);return r+=n,new bh(o)})}var bh=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};T.prototype.visitNull=L;T.prototype.visitBool=L;T.prototype.visitInt=L;T.prototype.visitInt8=L;T.prototype.visitInt16=L;T.prototype.visitInt32=L;T.prototype.visitInt64=L;T.prototype.visitUint8=L;T.prototype.visitUint16=L;T.prototype.visitUint32=L;T.prototype.visitUint64=L;T.prototype.visitFloat=L;T.prototype.visitFloat16=L;T.prototype.visitFloat32=L;T.prototype.visitFloat64=L;T.prototype.visitUtf8=L;T.prototype.visitLargeUtf8=L;T.prototype.visitBinary=L;T.prototype.visitLargeBinary=L;T.prototype.visitFixedSizeBinary=L;T.prototype.visitDate=L;T.prototype.visitDateDay=L;T.prototype.visitDateMillisecond=L;T.prototype.visitTimestamp=L;T.prototype.visitTimestampSecond=L;T.prototype.visitTimestampMillisecond=L;T.prototype.visitTimestampMicrosecond=L;T.prototype.visitTimestampNanosecond=L;T.prototype.visitTime=L;T.prototype.visitTimeSecond=L;T.prototype.visitTimeMillisecond=L;T.prototype.visitTimeMicrosecond=L;T.prototype.visitTimeNanosecond=L;T.prototype.visitDecimal=L;T.prototype.visitList=L;T.prototype.visitStruct=L;T.prototype.visitUnion=L;T.prototype.visitDenseUnion=L;T.prototype.visitSparseUnion=L;T.prototype.visitDictionary=L;T.prototype.visitInterval=L;T.prototype.visitIntervalDayTime=L;T.prototype.visitIntervalYearMonth=L;T.prototype.visitDuration=L;T.prototype.visitDurationSecond=L;T.prototype.visitDurationMillisecond=L;T.prototype.visitDurationMicrosecond=L;T.prototype.visitDurationNanosecond=L;T.prototype.visitFixedSizeList=L;T.prototype.visitMap=L;var fs=new T;var Ec,Nc={},Fc={},j=class{constructor(t){var r,i,s;let n=t[0]instanceof j?t.flatMap(a=>a.data):t;if(n.length===0||n.some(a=>!(a instanceof q)))throw new TypeError("Vector constructor expects an Array of Data instances.");let o=(r=n[0])===null||r===void 0?void 0:r.type;switch(n.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:h,indexOf:l}=Nc[o.typeId],c=n[0];this.isValid=u=>Ys(c,u),this.get=u=>a(c,u),this.set=(u,d)=>h(c,u,d),this.indexOf=u=>l(c,u),this._offsets=[0,c.length];break}default:Object.setPrototypeOf(this,Fc[o.typeId]),this._offsets=Bo(n);break}this.data=n,this.type=o,this.stride=Ie(o),this.numChildren=(s=(i=o.children)===null||i===void 0?void 0:i.length)!==null&&s!==void 0?s:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullable(){return Tc(this.data)}get nullCount(){return So(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${f[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(yi(t,this.length))}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}[Symbol.iterator](){return fs.visit(this)}concat(...t){return new j(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new j(Hs(this,t,r,({data:i,_offsets:s},n,o)=>Ao(i,s,n,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:i,stride:s,ArrayType:n}=this;switch(t.typeId){case f.Int:case f.Float:case f.Decimal:case f.Time:case f.Timestamp:switch(r.length){case 0:return new n;case 1:return r[0].values.subarray(0,i*s);default:return r.reduce((o,{values:a,length:h})=>(o.array.set(a.subarray(0,h*s),o.offset),o.offset+=h*s,o),{array:new n(i*s),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new j(this.data.map(({children:r})=>r[t])):null}get isMemoized(){return w.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(w.isDictionary(this.type)){let t=new ds(this.data[0].dictionary),r=this.data.map(i=>{let s=i.clone();return s.dictionary=t,s});return new j(r)}return new ds(this)}unmemoize(){if(w.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(i=>{let s=i.clone();return s.dictionary=t,s});return new j(r)}return this}};Ec=Symbol.toStringTag;j[Ec]=(e=>{e.type=w.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(f).map(r=>f[r]).filter(r=>typeof r=="number"&&r!==f.NONE);for(let r of t){let i=xt.getVisitFnByTypeId(r),s=Rt.getVisitFnByTypeId(r),n=wi.getVisitFnByTypeId(r);Nc[r]={get:i,set:s,indexOf:n},Fc[r]=Object.create(e,{isValid:{value:us(Ys)},get:{value:us(xt.getVisitFnByTypeId(r))},set:{value:Do(Rt.getVisitFnByTypeId(r))},indexOf:{value:To(wi.getVisitFnByTypeId(r))}})}return"Vector"})(j.prototype);var ds=class extends j{constructor(t){super(t.data);let r=this.get,i=this.set,s=this.slice,n=new Array(this.length);Object.defineProperty(this,"get",{value(o){let a=n[o];if(a!==void 0)return a;let h=r.call(this,o);return n[o]=h,h}}),Object.defineProperty(this,"set",{value(o,a){i.call(this,o,a),n[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new ds(s.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new j(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function Lc(e){if(!e||e.length<=0)return function(s){return!0};let t="",r=e.filter(i=>i===i);return r.length>0&&(t=`
|
|
7
|
+
"use strict";var __exports__=(()=>{var Cd=Object.create;var Hn=Object.defineProperty;var Ud=Object.getOwnPropertyDescriptor;var Pd=Object.getOwnPropertyNames;var kd=Object.getPrototypeOf,Vd=Object.prototype.hasOwnProperty;var zd=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Dr=(e,t)=>{for(var r in t)Hn(e,r,{get:t[r],enumerable:!0})},Gn=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Pd(t))!Vd.call(e,s)&&s!==r&&Hn(e,s,{get:()=>t[s],enumerable:!(i=Ud(t,s))||i.enumerable});return e},Wn=(e,t,r)=>(Gn(e,t,"default"),r&&Gn(r,t,"default")),jd=(e,t,r)=>(r=e!=null?Cd(kd(e)):{},Gn(t||!e||!e.__esModule?Hn(r,"default",{value:e,enumerable:!0}):r,e)),Gd=e=>Gn(Hn({},"__esModule",{value:!0}),e);var Tc=zd((gb,Bc)=>{Bc.exports=globalThis.loaders});var zn={};Dr(zn,{DBFArrowLoader:()=>Fd,DBFArrowWorkerLoader:()=>Ac,DBFLoader:()=>kn,DBFWorkerLoader:()=>xc,SHPLoader:()=>Vs,SHPWorkerLoader:()=>Ya,ShapefileLoader:()=>Dd,_BinaryChunkReader:()=>ar,_BinaryReader:()=>Ha,_zipBatchIterators:()=>ka});Wn(zn,jd(Tc(),1));async function qn(e,t,r,i){return i._parse(e,t,r,i)}async function $n(e,t,r,i){if(!i._parseInBatches)throw new Error("parseInBatches");return i._parseInBatches(e,t,r,i)}async function*Er(e){for await(let t of e)yield Hd(t)}function Hd(e){if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e)){let{buffer:t,byteOffset:r,byteLength:i}=e;return Dc(t,r,i)}return Dc(e)}function Dc(e,t=0,r=e.byteLength-t){let i=new Uint8Array(e,t,r),s=new Uint8Array(i.length);return s.set(i),s.buffer}var ar=class{offset;arrayBuffers;ended;maxRewindBytes;constructor(t){let{maxRewindBytes:r=0}=t||{};this.offset=0,this.arrayBuffers=[],this.ended=!1,this.maxRewindBytes=r}write(t){this.arrayBuffers.push(t)}end(){this.arrayBuffers=[],this.ended=!0}hasAvailableBytes(t){let r=-this.offset;for(let i of this.arrayBuffers)if(r+=i.byteLength,r>=t)return!0;return!1}findBufferOffsets(t){let r=-this.offset,i=[];for(let s=0;s<this.arrayBuffers.length;s++){let n=this.arrayBuffers[s];if(r+n.byteLength<=0){r+=n.byteLength;continue}let o=r<=0?Math.abs(r):0,a;if(o+t<=n.byteLength)return a=o+t,i.push([s,[o,a]]),i;a=n.byteLength,i.push([s,[o,a]]),t-=n.byteLength-o,r+=n.byteLength}return null}getDataView(t){let r=this.findBufferOffsets(t);if(!r&&this.ended)throw new Error("binary data exhausted");if(!r)return null;if(r.length===1){let[s,[n,o]]=r[0],a=this.arrayBuffers[s],h=new DataView(a,n,o-n);return this.offset+=t,this.disposeBuffers(),h}let i=new DataView(this._combineArrayBuffers(r));return this.offset+=t,this.disposeBuffers(),i}disposeBuffers(){for(;this.arrayBuffers.length>0&&this.offset-this.maxRewindBytes>=this.arrayBuffers[0].byteLength;)this.offset-=this.arrayBuffers[0].byteLength,this.arrayBuffers.shift()}_combineArrayBuffers(t){let r=0;for(let n of t){let[o,a]=n[1];r+=a-o}let i=new Uint8Array(r),s=0;for(let n of t){let[o,[a,h]]=n,c=new Uint8Array(this.arrayBuffers[o]);i.set(c.subarray(a,h),s),s+=h-a}return i.buffer}skip(t){this.offset+=t}rewind(t){this.offset-=t}};function Jn(e){let t={magic:e.getInt32(0,!1),length:e.getInt32(24,!1)*2,version:e.getInt32(28,!0),type:e.getInt32(32,!0),bbox:{minX:e.getFloat64(36,!0),minY:e.getFloat64(44,!0),minZ:e.getFloat64(68,!0),minM:e.getFloat64(84,!0),maxX:e.getFloat64(52,!0),maxY:e.getFloat64(60,!0),maxZ:e.getFloat64(76,!0),maxM:e.getFloat64(92,!0)}};return t.magic!==9994&&console.error(`SHP file: bad magic number ${t.magic}`),t.version!==1e3&&console.error(`SHP file: bad version ${t.version}`),t}function Ec(e,t){let{_maxDimensions:r=4}=t?.shp||{},i=0,s=e.getInt32(i,!0);switch(i+=Int32Array.BYTES_PER_ELEMENT,s){case 0:return Wd();case 1:return Wa(e,i,Math.min(2,r));case 3:return Gi(e,i,Math.min(2,r),"LineString");case 5:return Gi(e,i,Math.min(2,r),"Polygon");case 8:return qa(e,i,Math.min(2,r));case 11:return Wa(e,i,Math.min(4,r));case 13:return Gi(e,i,Math.min(4,r),"LineString");case 15:return Gi(e,i,Math.min(4,r),"Polygon");case 18:return qa(e,i,Math.min(4,r));case 21:return Wa(e,i,Math.min(3,r));case 23:return Gi(e,i,Math.min(3,r),"LineString");case 25:return Gi(e,i,Math.min(3,r),"Polygon");case 28:return qa(e,i,Math.min(3,r));default:throw new Error(`unsupported shape type: ${s}`)}}function Wd(){return null}function Wa(e,t,r){let i;return[i,t]=ni(e,t,1,r),{positions:{value:i,size:r},type:"Point"}}function qa(e,t,r){t+=4*Float64Array.BYTES_PER_ELEMENT;let i=e.getInt32(t,!0);t+=Int32Array.BYTES_PER_ELEMENT;let s=null,n=null,o=null;return[s,t]=ni(e,t,i,2),r===4&&(t+=2*Float64Array.BYTES_PER_ELEMENT,[o,t]=ni(e,t,i,1)),r>=3&&(t+=2*Float64Array.BYTES_PER_ELEMENT,[n,t]=ni(e,t,i,1)),{positions:{value:Nc(s,n,o),size:r},type:"Point"}}function Gi(e,t,r,i){t+=4*Float64Array.BYTES_PER_ELEMENT;let s=e.getInt32(t,!0);t+=Int32Array.BYTES_PER_ELEMENT;let n=e.getInt32(t,!0);t+=Int32Array.BYTES_PER_ELEMENT;let o=e.byteOffset+t,a=s*Int32Array.BYTES_PER_ELEMENT,h=new Int32Array(s+1);h.set(new Int32Array(e.buffer.slice(o,o+a))),h[s]=n,t+=s*Int32Array.BYTES_PER_ELEMENT;let c=null,l=null,u=null;[c,t]=ni(e,t,n,2),r===4&&(t+=2*Float64Array.BYTES_PER_ELEMENT,[u,t]=ni(e,t,n,1)),r>=3&&(t+=2*Float64Array.BYTES_PER_ELEMENT,[l,t]=ni(e,t,n,1));let p=Nc(c,l,u);if(i==="LineString")return{type:i,positions:{value:p,size:r},pathIndices:{value:h,size:1}};let f=[];for(let m=1;m<h.length;m++){let g=h[m-1],v=h[m],I=c.subarray(g*2,v*2);qd(I)>0&&f.push(g)}return f.push(n),{type:i,positions:{value:p,size:r},primitivePolygonIndices:{value:h,size:1},polygonIndices:{value:new Uint32Array(f),size:1}}}function ni(e,t,r,i){let s=e.byteOffset+t,n=r*i*Float64Array.BYTES_PER_ELEMENT;return[new Float64Array(e.buffer.slice(s,s+n)),t+n]}function Nc(e,t,r){if(!(t||r))return e;let i=e.length,s=2;r&&r.length&&(i+=r.length,s++),t&&t.length&&(i+=t.length,s++);let n=new Float64Array(i);for(let o=0;o<e.length/2;o++)n[s*o]=e[o*2],n[s*o+1]=e[o*2+1];if(r&&r.length)for(let o=0;o<r.length;o++)n[s*o+2]=r[o];if(t&&t.length)for(let o=0;o<t.length;o++)n[s*o+(s-1)]=t[o];return n}function qd(e){return Math.sign($d(e))}function $d(e){let t=0,r=e.length/2-1;for(let i=0;i<r;i++)t+=(e[i*2]+e[(i+1)*2])*(e[i*2+1]-e[(i+1)*2+1]);return t/2}var Jd=!0,Oc=!1,Yd=100,ks=12,je={EXPECTING_HEADER:0,EXPECTING_RECORD:1,END:2,ERROR:3},Yn=class{options={};binaryReader=new ar({maxRewindBytes:ks});state=je.EXPECTING_HEADER;result={geometries:[],progress:{bytesTotal:NaN,bytesUsed:NaN,rows:NaN},currentIndex:NaN};constructor(t){this.options=t}write(t){this.binaryReader.write(t),this.state=Lc(this.state,this.result,this.binaryReader,this.options)}end(){this.binaryReader.end(),this.state=Lc(this.state,this.result,this.binaryReader,this.options),this.state!==je.END&&(this.state=je.ERROR,this.result.error="SHP incomplete file")}};function $a(e,t){let r=new Yn(t);return r.write(e),r.end(),r.result}async function*Fc(e,t){let r=new Yn(t),i=!1;for await(let s of Er(e))r.write(s),!i&&r.result.header&&(i=!0,yield r.result.header),r.result.geometries.length>0&&(yield r.result.geometries,r.result.geometries=[]);r.end(),r.result.geometries.length>0&&(yield r.result.geometries)}function Lc(e,t,r,i){for(;;)try{switch(e){case je.ERROR:case je.END:return e;case je.EXPECTING_HEADER:let s=r.getDataView(Yd);if(!s)return e;t.header=Jn(s),t.progress={bytesUsed:0,bytesTotal:t.header.length,rows:0},t.currentIndex=1,e=je.EXPECTING_RECORD;break;case je.EXPECTING_RECORD:for(;r.hasAvailableBytes(ks);){let n=r.getDataView(ks),o={recordNumber:n.getInt32(0,Oc),byteLength:n.getInt32(4,Oc)*2,type:n.getInt32(8,Jd)};if(!r.hasAvailableBytes(o.byteLength-4))return r.rewind(ks),e;if(o.byteLength<4||o.type!==t.header?.type||o.recordNumber!==t.currentIndex)r.rewind(ks-4);else{r.rewind(4);let h=r.getDataView(o.byteLength),c=Ec(h,i);t.geometries.push(c),t.currentIndex++,t.progress.rows=t.currentIndex-1}}return r.ended&&(e=je.END),e;default:return e=je.ERROR,t.error=`illegal parser state ${e}`,e}}catch(s){return e=je.ERROR,t.error=`SHP parsing failed: ${s?.message}`,e}}var Kd="4.4.0-alpha.15",Ja=[0,0,39,10],Ya={dataType:null,batchType:null,name:"SHP",id:"shp",module:"shapefile",version:Kd,worker:!0,category:"geometry",extensions:["shp"],mimeTypes:["application/octet-stream"],tests:[new Uint8Array(Ja).buffer],options:{shp:{_maxDimensions:4}}},Vs={...Ya,parse:async(e,t)=>$a(e,t),parseSync:$a,parseInBatches:(e,t)=>Fc(e,t)};function Ka(e,t){for(let r of e)r.geometry.coordinates=Rc(r.geometry.coordinates,t);return e}function Rc(e,t){return Xd(e)?t(e):e.map(r=>Rc(r,t))}function Xd(e){return Array.isArray(e)&&Number.isFinite(e[0])&&Number.isFinite(e[1])}function Uc(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(r[i[s]]=e[i[s]]);return r}function M(e,t,r,i){function s(n){return n instanceof r?n:new r(function(o){o(n)})}return new(r||(r=Promise))(function(n,o){function a(l){try{c(i.next(l))}catch(u){o(u)}}function h(l){try{c(i.throw(l))}catch(u){o(u)}}function c(l){l.done?n(l.value):s(l.value).then(a,h)}c((i=i.apply(e,t||[])).next())})}function Cc(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function j(e){return this instanceof j?(this.v=e,this):new j(e)}function ve(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(e,t||[]),s,n=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(f){return function(m){return Promise.resolve(m).then(f,u)}}function a(f,m){i[f]&&(s[f]=function(g){return new Promise(function(v,I){n.push([f,g,v,I])>1||h(f,g)})},m&&(s[f]=m(s[f])))}function h(f,m){try{c(i[f](m))}catch(g){p(n[0][3],g)}}function c(f){f.value instanceof j?Promise.resolve(f.value.v).then(l,u):p(n[0][2],f)}function l(f){h("next",f)}function u(f){h("throw",f)}function p(f,m){f(m),n.shift(),n.length&&h(n[0][0],n[0][1])}}function Hi(e){var t,r;return t={},i("next"),i("throw",function(s){throw s}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(s,n){t[s]=e[s]?function(o){return(r=!r)?{value:j(e[s](o)),done:!1}:n?n(o):o}:n}}function Ge(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Cc=="function"?Cc(e):e[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(n){r[n]=e[n]&&function(o){return new Promise(function(a,h){o=e[n](o),s(a,h,o.done,o.value)})}}function s(n,o,a,h){Promise.resolve(h).then(function(c){n({value:c,done:a})},o)}}var rh={};Dr(rh,{compareArrayLike:()=>eh,joinUint8Arrays:()=>we,memcpy:()=>Gs,rebaseValueOffsets:()=>io,toArrayBufferView:()=>G,toArrayBufferViewAsyncIterator:()=>qe,toArrayBufferViewIterator:()=>cr,toBigInt64Array:()=>ro,toBigUint64Array:()=>np,toFloat32Array:()=>op,toFloat32ArrayAsyncIterator:()=>Mp,toFloat32ArrayIterator:()=>pp,toFloat64Array:()=>ap,toFloat64ArrayAsyncIterator:()=>xp,toFloat64ArrayIterator:()=>mp,toInt16Array:()=>rp,toInt16ArrayAsyncIterator:()=>_p,toInt16ArrayIterator:()=>lp,toInt32Array:()=>oi,toInt32ArrayAsyncIterator:()=>bp,toInt32ArrayIterator:()=>up,toInt8Array:()=>ep,toInt8ArrayAsyncIterator:()=>gp,toInt8ArrayIterator:()=>cp,toUint16Array:()=>ip,toUint16ArrayAsyncIterator:()=>vp,toUint16ArrayIterator:()=>fp,toUint32Array:()=>sp,toUint32ArrayAsyncIterator:()=>wp,toUint32ArrayIterator:()=>dp,toUint8Array:()=>O,toUint8ArrayAsyncIterator:()=>th,toUint8ArrayIterator:()=>Qa,toUint8ClampedArray:()=>hp,toUint8ClampedArrayAsyncIterator:()=>Ip,toUint8ClampedArrayIterator:()=>yp});var Pc=new TextDecoder("utf-8"),zs=Pc.decode.bind(Pc),Zd=new TextEncoder,hr=e=>Zd.encode(e);var Qd=e=>typeof e=="number",kc=e=>typeof e=="boolean",Bt=e=>typeof e=="function",$t=e=>e!=null&&Object(e)===e,He=e=>$t(e)&&Bt(e.then);var We=e=>$t(e)&&Bt(e[Symbol.iterator]),De=e=>$t(e)&&Bt(e[Symbol.asyncIterator]),Kn=e=>$t(e)&&$t(e.schema);var Xn=e=>$t(e)&&"done"in e&&"value"in e;var Zn=e=>$t(e)&&Bt(e.stat)&&Qd(e.fd);var Qn=e=>$t(e)&&js(e.body),to=e=>"_getDOMStream"in e&&"_getNodeStream"in e,Vc=e=>$t(e)&&Bt(e.abort)&&Bt(e.getWriter)&&!to(e),js=e=>$t(e)&&Bt(e.cancel)&&Bt(e.getReader)&&!to(e),zc=e=>$t(e)&&Bt(e.end)&&Bt(e.write)&&kc(e.writable)&&!to(e),eo=e=>$t(e)&&Bt(e.read)&&Bt(e.pipe)&&kc(e.readable)&&!to(e),jc=e=>$t(e)&&Bt(e.clear)&&Bt(e.bytes)&&Bt(e.position)&&Bt(e.setPosition)&&Bt(e.capacity)&&Bt(e.getBufferIdentifier)&&Bt(e.createLong);var Za=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function tp(e){let t=e[0]?[e[0]]:[],r,i,s,n;for(let o,a,h=0,c=0,l=e.length;++h<l;){if(o=t[c],a=e[h],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++c]=a);continue}if({byteOffset:r,byteLength:s}=o,{byteOffset:i,byteLength:n}=a,r+s<i||i+n<r){a&&(t[++c]=a);continue}t[c]=new Uint8Array(o.buffer,r,i-r+n)}return t}function Gs(e,t,r=0,i=t.byteLength){let s=e.byteLength,n=new Uint8Array(e.buffer,e.byteOffset,s),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(i,s));return n.set(o,r),e}function we(e,t){let r=tp(e),i=r.reduce((l,u)=>l+u.byteLength,0),s,n,o,a=0,h=-1,c=Math.min(t||Number.POSITIVE_INFINITY,i);for(let l=r.length;++h<l;){if(s=r[h],n=s.subarray(0,Math.min(s.length,c-a)),c<=a+n.length){n.length<s.length?r[h]=s.subarray(n.length):n.length===s.length&&h++,o?Gs(o,n,a):o=n;break}Gs(o||(o=new Uint8Array(c)),n,a),a+=n.length}return[o||new Uint8Array(0),r.slice(h),i-(o?o.byteLength:0)]}function G(e,t){let r=Xn(t)?t.value:t;return r instanceof e?e===Uint8Array?new e(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=hr(r)),r instanceof ArrayBuffer?new e(r):r instanceof Za?new e(r):jc(r)?G(e,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new e(0):new e(r.buffer,r.byteOffset,r.byteLength/e.BYTES_PER_ELEMENT):e.from(r)):new e(0)}var ep=e=>G(Int8Array,e),rp=e=>G(Int16Array,e),oi=e=>G(Int32Array,e),ro=e=>G(BigInt64Array,e),O=e=>G(Uint8Array,e),ip=e=>G(Uint16Array,e),sp=e=>G(Uint32Array,e),np=e=>G(BigUint64Array,e),op=e=>G(Float32Array,e),ap=e=>G(Float64Array,e),hp=e=>G(Uint8ClampedArray,e),Xa=e=>(e.next(),e);function*cr(e,t){let r=function*(s){yield s},i=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Za?r(t):We(t)?t:r(t);return yield*Xa(function*(s){let n=null;do n=s.next(yield G(e,n));while(!n.done)}(i[Symbol.iterator]())),new e}var cp=e=>cr(Int8Array,e),lp=e=>cr(Int16Array,e),up=e=>cr(Int32Array,e),Qa=e=>cr(Uint8Array,e),fp=e=>cr(Uint16Array,e),dp=e=>cr(Uint32Array,e),pp=e=>cr(Float32Array,e),mp=e=>cr(Float64Array,e),yp=e=>cr(Uint8ClampedArray,e);function qe(e,t){return ve(this,arguments,function*(){if(He(t))return yield j(yield j(yield*Hi(Ge(qe(e,yield j(t))))));let i=function(o){return ve(this,arguments,function*(){yield yield j(yield j(o))})},s=function(o){return ve(this,arguments,function*(){yield j(yield*Hi(Ge(Xa(function*(a){let h=null;do h=a.next(yield h?.value);while(!h.done)}(o[Symbol.iterator]())))))})},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Za?i(t):We(t)?s(t):De(t)?t:i(t);return yield j(yield*Hi(Ge(Xa(function(o){return ve(this,arguments,function*(){let a=null;do a=yield j(o.next(yield yield j(G(e,a))));while(!a.done)})}(n[Symbol.asyncIterator]()))))),yield j(new e)})}var gp=e=>qe(Int8Array,e),_p=e=>qe(Int16Array,e),bp=e=>qe(Int32Array,e),th=e=>qe(Uint8Array,e),vp=e=>qe(Uint16Array,e),wp=e=>qe(Uint32Array,e),Mp=e=>qe(Float32Array,e),xp=e=>qe(Float64Array,e),Ip=e=>qe(Uint8ClampedArray,e);function io(e,t,r){if(e!==0){r=r.slice(0,t);for(let i=-1,s=r.length;++i<s;)r[i]+=e}return r.subarray(0,t)}function eh(e,t){let r=0,i=e.length;if(i!==t.length)return!1;if(i>0)do if(e[r]!==t[r])return!1;while(++r<i);return!0}var Ut={fromIterable(e){return so(Sp(e))},fromAsyncIterable(e){return so(Ap(e))},fromDOMStream(e){return so(Bp(e))},fromNodeStream(e){return so(Tp(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},so=e=>(e.next(),e);function*Sp(e){let t,r=!1,i=[],s,n,o,a=0;function h(){return n==="peek"?we(i,o)[0]:([s,i,a]=we(i,o),s)}({cmd:n,size:o}=(yield(()=>null)())||{cmd:"read",size:0});let c=Qa(e)[Symbol.iterator]();try{do if({done:t,value:s}=Number.isNaN(o-a)?c.next():c.next(o-a),!t&&s.byteLength>0&&(i.push(s),a+=s.byteLength),t||o<=a)do({cmd:n,size:o}=yield h());while(o<a);while(!t)}catch(l){r=!0,typeof c.throw=="function"&&c.throw(l)}finally{r===!1&&typeof c.return=="function"&&c.return(null)}return null}function Ap(e){return ve(this,arguments,function*(){let r,i=!1,s=[],n,o,a,h=0;function c(){return o==="peek"?we(s,a)[0]:([n,s,h]=we(s,a),n)}({cmd:o,size:a}=(yield yield j((()=>null)()))||{cmd:"read",size:0});let l=th(e)[Symbol.asyncIterator]();try{do if({done:r,value:n}=Number.isNaN(a-h)?yield j(l.next()):yield j(l.next(a-h)),!r&&n.byteLength>0&&(s.push(n),h+=n.byteLength),r||a<=h)do({cmd:o,size:a}=yield yield j(c()));while(a<h);while(!r)}catch(u){i=!0,typeof l.throw=="function"&&(yield j(l.throw(u)))}finally{i===!1&&typeof l.return=="function"&&(yield j(l.return(new Uint8Array(0))))}return yield j(null)})}function Bp(e){return ve(this,arguments,function*(){let r=!1,i=!1,s=[],n,o,a,h=0;function c(){return o==="peek"?we(s,a)[0]:([n,s,h]=we(s,a),n)}({cmd:o,size:a}=(yield yield j((()=>null)()))||{cmd:"read",size:0});let l=new sh(e);try{do if({done:r,value:n}=Number.isNaN(a-h)?yield j(l.read()):yield j(l.read(a-h)),!r&&n.byteLength>0&&(s.push(O(n)),h+=n.byteLength),r||a<=h)do({cmd:o,size:a}=yield yield j(c()));while(a<h);while(!r)}catch(u){i=!0,yield j(l.cancel(u))}finally{i===!1?yield j(l.cancel()):e.locked&&l.releaseLock()}return yield j(null)})}var sh=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return M(this,void 0,void 0,function*(){let{reader:r,source:i}=this;r&&(yield r.cancel(t).catch(()=>{})),i&&i.locked&&this.releaseLock()})}read(t){return M(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=O(r)),r})}},ih=(e,t)=>{let r=s=>i([t,s]),i;return[t,r,new Promise(s=>(i=s)&&e.once(t,r))]};function Tp(e){return ve(this,arguments,function*(){let r=[],i="error",s=!1,n=null,o,a,h=0,c=[],l;function u(){return o==="peek"?we(c,a)[0]:([l,c,h]=we(c,a),l)}if({cmd:o,size:a}=(yield yield j((()=>null)()))||{cmd:"read",size:0},e.isTTY)return yield yield j(new Uint8Array(0)),yield j(null);try{r[0]=ih(e,"end"),r[1]=ih(e,"error");do{if(r[2]=ih(e,"readable"),[i,n]=yield j(Promise.race(r.map(f=>f[2]))),i==="error")break;if((s=i==="end")||(Number.isFinite(a-h)?(l=O(e.read(a-h)),l.byteLength<a-h&&(l=O(e.read()))):l=O(e.read()),l.byteLength>0&&(c.push(l),h+=l.byteLength)),s||a<=h)do({cmd:o,size:a}=yield yield j(u()));while(a<h)}while(!s)}finally{yield j(p(r,i==="error"?n:null))}return yield j(null);function p(f,m){return l=c=null,new Promise((g,v)=>{for(let[I,k]of f)e.off(I,k);try{let I=e.destroy;I&&I.call(e,m),m=void 0}catch(I){m=I||m}finally{m!=null?v(m):g()}})}})}var et;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(et||(et={}));var ht;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(ht||(ht={}));var st;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(st||(st={}));var dt;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(dt||(dt={}));var x;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(x||(x={}));var nt;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(nt||(nt={}));var lr=new Int32Array(2),no=new Float32Array(lr.buffer),oo=new Float64Array(lr.buffer),Wi=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Hs;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Hs||(Hs={}));var Tt=class{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new Tt(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return lr[0]=this.readInt32(t),no[0]}readFloat64(t){return lr[Wi?0:1]=this.readInt32(t),lr[Wi?1:0]=this.readInt32(t+4),oo[0]}writeInt8(t,r){this.bytes_[t]=r}writeUint8(t,r){this.bytes_[t]=r}writeInt16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeUint16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeInt32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeUint32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeInt64(t,r){this.writeInt32(t,Number(BigInt.asIntN(32,r))),this.writeInt32(t+4,Number(BigInt.asIntN(32,r>>BigInt(32))))}writeUint64(t,r){this.writeUint32(t,Number(BigInt.asUintN(32,r))),this.writeUint32(t+4,Number(BigInt.asUintN(32,r>>BigInt(32))))}writeFloat32(t,r){no[0]=r,this.writeInt32(t,lr[0])}writeFloat64(t,r){oo[0]=r,this.writeInt32(t,lr[Wi?0:1]),this.writeInt32(t+4,lr[Wi?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let r=0;r<4;r++)t+=String.fromCharCode(this.readInt8(this.position_+4+r));return t}__offset(t,r){let i=t-this.readInt32(t);return r<this.readInt16(i)?this.readInt16(i+r):0}__union(t,r){return t.bb_pos=r+this.readInt32(r),t.bb=this,t}__string(t,r){t+=this.readInt32(t);let i=this.readInt32(t);t+=4;let s=this.bytes_.subarray(t,t+i);return r===Hs.UTF8_BYTES?s:this.text_decoder_.decode(s)}__union_with_string(t,r){return typeof t=="string"?this.__string(r):this.__union(t,r)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let r=0;r<4;r++)if(t.charCodeAt(r)!=this.readInt8(this.position()+4+r))return!1;return!0}createScalarList(t,r){let i=[];for(let s=0;s<r;++s){let n=t(s);n!==null&&i.push(n)}return i}createObjList(t,r){let i=[];for(let s=0;s<r;++s){let n=t(s);n!==null&&i.push(n.unpack())}return i}};var Nr=class{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let r;t?r=t:r=1024,this.bb=Tt.allocate(r),this.space=r}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,r){t>this.minalign&&(this.minalign=t);let i=~(this.bb.capacity()-this.space+r)+1&t-1;for(;this.space<i+t+r;){let s=this.bb.capacity();this.bb=Nr.growByteBuffer(this.bb),this.space+=this.bb.capacity()-s}this.pad(i)}pad(t){for(let r=0;r<t;r++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,r,i){(this.force_defaults||r!=i)&&(this.addInt8(r),this.slot(t))}addFieldInt16(t,r,i){(this.force_defaults||r!=i)&&(this.addInt16(r),this.slot(t))}addFieldInt32(t,r,i){(this.force_defaults||r!=i)&&(this.addInt32(r),this.slot(t))}addFieldInt64(t,r,i){(this.force_defaults||r!==i)&&(this.addInt64(r),this.slot(t))}addFieldFloat32(t,r,i){(this.force_defaults||r!=i)&&(this.addFloat32(r),this.slot(t))}addFieldFloat64(t,r,i){(this.force_defaults||r!=i)&&(this.addFloat64(r),this.slot(t))}addFieldOffset(t,r,i){(this.force_defaults||r!=i)&&(this.addOffset(r),this.slot(t))}addFieldStruct(t,r,i){r!=i&&(this.nested(r),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let r=t.capacity();if(r&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let i=r<<1,s=Tt.allocate(i);return s.setPosition(i-r),s.bytes().set(t.bytes(),i-r),s}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let r=0;r<t;r++)this.vtable[r]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),r=this.vtable_in_use-1;for(;r>=0&&this.vtable[r]==0;r--);let i=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);let s=2;this.addInt16(t-this.object_start);let n=(i+s)*2;this.addInt16(n);let o=0,a=this.space;t:for(r=0;r<this.vtables.length;r++){let h=this.bb.capacity()-this.vtables[r];if(n==this.bb.readInt16(h)){for(let c=2;c<n;c+=2)if(this.bb.readInt16(a+c)!=this.bb.readInt16(h+c))continue t;o=this.vtables[r];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,r,i){let s=i?4:0;if(r){let n=r;if(this.prep(this.minalign,4+4+s),n.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let o=4-1;o>=0;o--)this.writeInt8(n.charCodeAt(o))}this.prep(this.minalign,4+s),this.addOffset(t),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,r){this.finish(t,r,!0)}requiredField(t,r){let i=this.bb.capacity()-t,s=i-this.bb.readInt32(i);if(!(r<this.bb.readInt16(s)&&this.bb.readInt16(s+r)!=0))throw new TypeError("FlatBuffers: field "+r+" must be set")}startVector(t,r,i){this.notNested(),this.vector_num_elems=r,this.prep(4,t*r),this.prep(i,t*r)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let r=this.createString(t);return this.string_maps.set(t,r),r}createString(t){if(t==null)return 0;let r;return t instanceof Uint8Array?r=t:r=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,r.length,1),this.bb.setPosition(this.space-=r.length),this.bb.bytes().set(r,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let r=[];for(let i=0;i<t.length;++i){let s=t[i];if(s!==null)r.push(this.createObjectOffset(s));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return r}createStructOffsetList(t,r){return r(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var ai;(function(e){e[e.BUFFER=0]="BUFFER"})(ai||(ai={}));var Jt;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(Jt||(Jt={}));var zt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBodyCompression(t,r){return(r||new zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,r){return t.setPosition(t.position()+4),(r||new zt).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Jt.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):ai.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,r){t.addFieldInt8(0,r,Jt.LZ4_FRAME)}static addMethod(t,r){t.addFieldInt8(1,r,ai.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,r,i){return zt.startBodyCompression(t),zt.addCodec(t,r),zt.addMethod(t,i),zt.endBodyCompression(t)}};var qi=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,r,i){return t.prep(8,16),t.writeInt64(BigInt(i??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var $i=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,r,i){return t.prep(8,16),t.writeInt64(BigInt(i??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var Pt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsRecordBatch(t,r){return(r||new Pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,r){return t.setPosition(t.position()+4),(r||new Pt).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,r){let i=this.bb.__offset(this.bb_pos,6);return i?(r||new $i).__init(this.bb.__vector(this.bb_pos+i)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new qi).__init(this.bb.__vector(this.bb_pos+i)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let r=this.bb.__offset(this.bb_pos,10);return r?(t||new zt).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addNodes(t,r){t.addFieldOffset(1,r,0)}static startNodesVector(t,r){t.startVector(16,r,8)}static addBuffers(t,r){t.addFieldOffset(2,r,0)}static startBuffersVector(t,r){t.startVector(16,r,8)}static addCompression(t,r){t.addFieldOffset(3,r,0)}static endRecordBatch(t){return t.endObject()}};var Ne=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryBatch(t,r){return(r||new Ne).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,r){return t.setPosition(t.position()+4),(r||new Ne).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new Pt).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addData(t,r){t.addFieldOffset(1,r,0)}static addIsDelta(t,r){t.addFieldInt8(2,+r,0)}static endDictionaryBatch(t){return t.endObject()}};var Yr;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(Yr||(Yr={}));var Ws;(function(e){e[e.DenseArray=0]="DenseArray"})(Ws||(Ws={}));var Ot=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInt(t,r){return(r||new Ot).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,r){return t.setPosition(t.position()+4),(r||new Ot).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,r){t.addFieldInt32(0,r,0)}static addIsSigned(t,r){t.addFieldInt8(1,+r,0)}static endInt(t){return t.endObject()}static createInt(t,r,i){return Ot.startInt(t),Ot.addBitWidth(t,r),Ot.addIsSigned(t,i),Ot.endInt(t)}};var Me=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryEncoding(t,r){return(r||new Me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,r){return t.setPosition(t.position()+4),(r||new Me).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new Ot).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Ws.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addIndexType(t,r){t.addFieldOffset(1,r,0)}static addIsOrdered(t,r){t.addFieldInt8(2,+r,0)}static addDictionaryKind(t,r){t.addFieldInt16(3,r,Ws.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var ct=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsKeyValue(t,r){return(r||new ct).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,r){return t.setPosition(t.position()+4),(r||new ct).__init(t.readInt32(t.position())+t.position(),t)}key(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}value(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,r){t.addFieldOffset(0,r,0)}static addValue(t,r){t.addFieldOffset(1,r,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,r,i){return ct.startKeyValue(t),ct.addKey(t,r),ct.addValue(t,i),ct.endKeyValue(t)}};var ur=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinary(t,r){return(r||new ur).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,r){return t.setPosition(t.position()+4),(r||new ur).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return ur.startBinary(t),ur.endBinary(t)}};var fr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBool(t,r){return(r||new fr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,r){return t.setPosition(t.position()+4),(r||new fr).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return fr.startBool(t),fr.endBool(t)}};var ie=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDate(t,r){return(r||new ie).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,r){return t.setPosition(t.position()+4),(r||new ie).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):dt.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,dt.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,r){return ie.startDate(t),ie.addUnit(t,r),ie.endDate(t)}};var Lt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDecimal(t,r){return(r||new Lt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,r){return t.setPosition(t.position()+4),(r||new Lt).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,r){t.addFieldInt32(0,r,0)}static addScale(t,r){t.addFieldInt32(1,r,0)}static addBitWidth(t,r){t.addFieldInt32(2,r,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,r,i,s){return Lt.startDecimal(t),Lt.addPrecision(t,r),Lt.addScale(t,i),Lt.addBitWidth(t,s),Lt.endDecimal(t)}};var se=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDuration(t,r){return(r||new se).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,r){return t.setPosition(t.position()+4),(r||new se).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):x.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,x.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,r){return se.startDuration(t),se.addUnit(t,r),se.endDuration(t)}};var ne=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeBinary(t,r){return(r||new ne).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,r){return t.setPosition(t.position()+4),(r||new ne).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,r){return ne.startFixedSizeBinary(t),ne.addByteWidth(t,r),ne.endFixedSizeBinary(t)}};var oe=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeList(t,r){return(r||new oe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,r){return t.setPosition(t.position()+4),(r||new oe).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,r){return oe.startFixedSizeList(t),oe.addListSize(t,r),oe.endFixedSizeList(t)}};var ae=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFloatingPoint(t,r){return(r||new ae).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,r){return t.setPosition(t.position()+4),(r||new ae).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):st.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,r){t.addFieldInt16(0,r,st.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,r){return ae.startFloatingPoint(t),ae.addPrecision(t,r),ae.endFloatingPoint(t)}};var he=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInterval(t,r){return(r||new he).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,r){return t.setPosition(t.position()+4),(r||new he).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):nt.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,nt.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,r){return he.startInterval(t),he.addUnit(t,r),he.endInterval(t)}};var dr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeBinary(t,r){return(r||new dr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,r){return t.setPosition(t.position()+4),(r||new dr).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return dr.startLargeBinary(t),dr.endLargeBinary(t)}};var pr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeUtf8(t,r){return(r||new pr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,r){return t.setPosition(t.position()+4),(r||new pr).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return pr.startLargeUtf8(t),pr.endLargeUtf8(t)}};var mr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsList(t,r){return(r||new mr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,r){return t.setPosition(t.position()+4),(r||new mr).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return mr.startList(t),mr.endList(t)}};var ce=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMap(t,r){return(r||new ce).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,r){return t.setPosition(t.position()+4),(r||new ce).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,r){t.addFieldInt8(0,+r,0)}static endMap(t){return t.endObject()}static createMap(t,r){return ce.startMap(t),ce.addKeysSorted(t,r),ce.endMap(t)}};var yr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsNull(t,r){return(r||new yr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,r){return t.setPosition(t.position()+4),(r||new yr).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return yr.startNull(t),yr.endNull(t)}};var gr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsStruct_(t,r){return(r||new gr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,r){return t.setPosition(t.position()+4),(r||new gr).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return gr.startStruct_(t),gr.endStruct_(t)}};var jt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTime(t,r){return(r||new jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,r){return t.setPosition(t.position()+4),(r||new jt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):x.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,x.MILLISECOND)}static addBitWidth(t,r){t.addFieldInt32(1,r,32)}static endTime(t){return t.endObject()}static createTime(t,r,i){return jt.startTime(t),jt.addUnit(t,r),jt.addBitWidth(t,i),jt.endTime(t)}};var Gt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTimestamp(t,r){return(r||new Gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,r){return t.setPosition(t.position()+4),(r||new Gt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):x.SECOND}timezone(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,x.SECOND)}static addTimezone(t,r){t.addFieldOffset(1,r,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,r,i){return Gt.startTimestamp(t),Gt.addUnit(t,r),Gt.addTimezone(t,i),Gt.endTimestamp(t)}};var Ft=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUnion(t,r){return(r||new Ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,r){return t.setPosition(t.position()+4),(r||new Ft).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ht.Sparse}typeIds(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readInt32(this.bb.__vector(this.bb_pos+r)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,r){t.addFieldInt16(0,r,ht.Sparse)}static addTypeIds(t,r){t.addFieldOffset(1,r,0)}static createTypeIdsVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addInt32(r[i]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,i){return Ft.startUnion(t),Ft.addMode(t,r),Ft.addTypeIds(t,i),Ft.endUnion(t)}};var _r=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new _r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||new _r).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return _r.startUtf8(t),_r.endUtf8(t)}};var at;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded"})(at||(at={}));var wt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new wt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new wt).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):at.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new Me).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let i=this.bb.__offset(this.bb_pos,14);return i?(r||new wt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,16);return i?(r||new ct).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,at.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}};var mt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new mt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||new mt).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Yr.Little}fields(t,r){let i=this.bb.__offset(this.bb_pos,6);return i?(r||new wt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new ct).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,r){t.addFieldInt16(0,r,Yr.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let i=r.length-1;i>=0;i--)t.addInt64(r[i]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,r){t.finish(r)}static finishSizePrefixedSchemaBuffer(t,r){t.finish(r,void 0,!0)}static createSchema(t,r,i,s,n){return mt.startSchema(t),mt.addEndianness(t,r),mt.addFields(t,i),mt.addCustomMetadata(t,s),mt.addFeatures(t,n),mt.endSchema(t)}};var W;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(W||(W={}));var d;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond",e[e.IntervalMonthDayNano=-31]="IntervalMonthDayNano"})(d||(d={}));var Je;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(Je||(Je={}));var Ih={};Dr(Ih,{clampRange:()=>Js,createElementComparator:()=>Qr,wrapIndex:()=>bi});var nh={};Dr(nh,{valueToString:()=>Ye});function Ye(e){if(e===null)return"null";if(e===void 0)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>Ye(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r=="bigint"?`${r}`:r)}var ch={};Dr(ch,{BN:()=>hi,bigNumToBigInt:()=>Hc,bigNumToNumber:()=>hh,bigNumToString:()=>Ki,isArrowBigNumSymbol:()=>Gc});function J(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function oh(e,t){return J(e/t)+J(e%t)/J(t)}var Gc=Symbol.for("isArrowBigNum");function Ke(e,...t){return t.length===0?Object.setPrototypeOf(G(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}Ke.prototype[Gc]=!0;Ke.prototype.toJSON=function(){return`"${Ki(this)}"`};Ke.prototype.valueOf=function(e){return hh(this,e)};Ke.prototype.toString=function(){return Ki(this)};Ke.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return hh(this);case"string":return Ki(this);case"default":return Hc(this)}return Ki(this)};function Ji(...e){return Ke.apply(this,e)}function Yi(...e){return Ke.apply(this,e)}function qs(...e){return Ke.apply(this,e)}Object.setPrototypeOf(Ji.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Yi.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(qs.prototype,Object.create(Uint32Array.prototype));Object.assign(Ji.prototype,Ke.prototype,{constructor:Ji,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Yi.prototype,Ke.prototype,{constructor:Yi,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(qs.prototype,Ke.prototype,{constructor:qs,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var Dp=BigInt(4294967296)*BigInt(4294967296),Ep=Dp-BigInt(1);function hh(e,t){let{buffer:r,byteOffset:i,byteLength:s,signed:n}=e,o=new BigUint64Array(r,i,s/8),a=n&&o.at(-1)&BigInt(1)<<BigInt(63),h=BigInt(0),c=0;if(a){for(let l of o)h|=(l^Ep)*(BigInt(1)<<BigInt(64*c++));h*=BigInt(-1),h-=BigInt(1)}else for(let l of o)h|=l*(BigInt(1)<<BigInt(64*c++));if(typeof t=="number"&&t>0){let l=BigInt("1".padEnd(t+1,"0")),u=h/l,p=a?-(h%l):h%l,f=J(u),m=`${p}`.padStart(t,"0");return+`${a&&f===0?"-":""}${f}.${m}`}return J(h)}function Ki(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return ah(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return ah(e);t=t.slice();let i=1;for(let n=0;n<t.length;n++){let o=t[n],a=~o+i;t[n]=a,i&=o===0?1:0}return`-${ah(t)}`}function Hc(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Ki(e)}function ah(e){let t="",r=new Uint32Array(2),i=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),s=new Uint32Array((i=new Uint16Array(i).reverse()).buffer),n=-1,o=i.length-1;do{for(r[0]=i[n=0];n<o;)i[n++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+i[n];i[n]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,t=`${r[0]}${t}`}while(s[0]||s[1]||s[2]||s[3]);return t??"0"}var hi=class{static new(t,r){switch(r){case!0:return new Ji(t);case!1:return new Yi(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Ji(t)}return t.byteLength===16?new qs(t):new Yi(t)}static signed(t){return new Ji(t)}static unsigned(t){return new Yi(t)}static decimal(t){return new qs(t)}constructor(t,r){return hi.new(t,r)}};var Wc,qc,$c,Jc,Yc,Kc,Xc,Zc,Qc,tl,el,rl,il,sl,nl,ol,al,hl,cl,ll,ul,fl,w=class{static isNull(t){return t?.typeId===d.Null}static isInt(t){return t?.typeId===d.Int}static isFloat(t){return t?.typeId===d.Float}static isBinary(t){return t?.typeId===d.Binary}static isLargeBinary(t){return t?.typeId===d.LargeBinary}static isUtf8(t){return t?.typeId===d.Utf8}static isLargeUtf8(t){return t?.typeId===d.LargeUtf8}static isBool(t){return t?.typeId===d.Bool}static isDecimal(t){return t?.typeId===d.Decimal}static isDate(t){return t?.typeId===d.Date}static isTime(t){return t?.typeId===d.Time}static isTimestamp(t){return t?.typeId===d.Timestamp}static isInterval(t){return t?.typeId===d.Interval}static isDuration(t){return t?.typeId===d.Duration}static isList(t){return t?.typeId===d.List}static isStruct(t){return t?.typeId===d.Struct}static isUnion(t){return t?.typeId===d.Union}static isFixedSizeBinary(t){return t?.typeId===d.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===d.FixedSizeList}static isMap(t){return t?.typeId===d.Map}static isDictionary(t){return t?.typeId===d.Dictionary}static isDenseUnion(t){return w.isUnion(t)&&t.mode===ht.Dense}static isSparseUnion(t){return w.isUnion(t)&&t.mode===ht.Sparse}constructor(t){this.typeId=t}};Wc=Symbol.toStringTag;w[Wc]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(w.prototype);var Rt=class extends w{constructor(){super(d.Null)}toString(){return"Null"}};qc=Symbol.toStringTag;Rt[qc]=(e=>e[Symbol.toStringTag]="Null")(Rt.prototype);var bt=class extends w{constructor(t,r){super(d.Int),this.isSigned=t,this.bitWidth=r}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};$c=Symbol.toStringTag;bt[$c]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(bt.prototype);var ci=class extends bt{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},li=class extends bt{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},xe=class extends bt{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},ui=class extends bt{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},fi=class extends bt{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},di=class extends bt{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},pi=class extends bt{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},mi=class extends bt{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(ci.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(li.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(xe.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(ui.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(fi.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(di.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(pi.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(mi.prototype,"ArrayType",{value:BigUint64Array});var le=class extends w{constructor(t){super(d.Float),this.precision=t}get ArrayType(){switch(this.precision){case st.HALF:return Uint16Array;case st.SINGLE:return Float32Array;case st.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Jc=Symbol.toStringTag;le[Jc]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(le.prototype);var yi=class extends le{constructor(){super(st.HALF)}},gi=class extends le{constructor(){super(st.SINGLE)}},_i=class extends le{constructor(){super(st.DOUBLE)}};Object.defineProperty(yi.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(gi.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(_i.prototype,"ArrayType",{value:Float64Array});var Oe=class extends w{constructor(){super(d.Binary)}toString(){return"Binary"}};Yc=Symbol.toStringTag;Oe[Yc]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Oe.prototype);var br=class extends w{constructor(){super(d.LargeBinary)}toString(){return"LargeBinary"}};Kc=Symbol.toStringTag;br[Kc]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(br.prototype);var Le=class extends w{constructor(){super(d.Utf8)}toString(){return"Utf8"}};Xc=Symbol.toStringTag;Le[Xc]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Le.prototype);var vr=class extends w{constructor(){super(d.LargeUtf8)}toString(){return"LargeUtf8"}};Zc=Symbol.toStringTag;vr[Zc]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(vr.prototype);var Fe=class extends w{constructor(){super(d.Bool)}toString(){return"Bool"}};Qc=Symbol.toStringTag;Fe[Qc]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Fe.prototype);var Re=class extends w{constructor(t,r,i=128){super(d.Decimal),this.scale=t,this.precision=r,this.bitWidth=i}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};tl=Symbol.toStringTag;Re[tl]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Re.prototype);var Ie=class extends w{constructor(t){super(d.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${dt[this.unit]}>`}get ArrayType(){return this.unit===dt.DAY?Int32Array:BigInt64Array}};el=Symbol.toStringTag;Ie[el]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(Ie.prototype);var Xi=class extends Ie{constructor(){super(dt.DAY)}},Zi=class extends Ie{constructor(){super(dt.MILLISECOND)}},Yt=class extends w{constructor(t,r){super(d.Time),this.unit=t,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${x[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};rl=Symbol.toStringTag;Yt[rl]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Yt.prototype);var Qi=class extends Yt{constructor(){super(x.SECOND,32)}},ts=class extends Yt{constructor(){super(x.MILLISECOND,32)}},es=class extends Yt{constructor(){super(x.MICROSECOND,64)}},rs=class extends Yt{constructor(){super(x.NANOSECOND,64)}},Kt=class extends w{constructor(t,r){super(d.Timestamp),this.unit=t,this.timezone=r}toString(){return`Timestamp<${x[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};il=Symbol.toStringTag;Kt[il]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(Kt.prototype);var is=class extends Kt{constructor(t){super(x.SECOND,t)}},ss=class extends Kt{constructor(t){super(x.MILLISECOND,t)}},ns=class extends Kt{constructor(t){super(x.MICROSECOND,t)}},os=class extends Kt{constructor(t){super(x.NANOSECOND,t)}},Se=class extends w{constructor(t){super(d.Interval),this.unit=t}toString(){return`Interval<${nt[this.unit]}>`}};sl=Symbol.toStringTag;Se[sl]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Se.prototype);var as=class extends Se{constructor(){super(nt.DAY_TIME)}},hs=class extends Se{constructor(){super(nt.YEAR_MONTH)}};var wr=class extends w{constructor(t){super(d.Duration),this.unit=t}toString(){return`Duration<${x[this.unit]}>`}};nl=Symbol.toStringTag;wr[nl]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(wr.prototype);var ue=class extends w{constructor(t){super(d.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};ol=Symbol.toStringTag;ue[ol]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(ue.prototype);var Q=class extends w{constructor(t){super(d.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};al=Symbol.toStringTag;Q[al]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(Q.prototype);var Ce=class extends w{constructor(t,r,i){super(d.Union),this.mode=t,this.children=i,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((s,n,o)=>(s[n]=o)&&s||s,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};hl=Symbol.toStringTag;Ce[hl]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Ce.prototype);var Mr=class extends w{constructor(t){super(d.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};cl=Symbol.toStringTag;Mr[cl]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(Mr.prototype);var fe=class extends w{constructor(t,r){super(d.FixedSizeList),this.listSize=t,this.children=[r]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};ll=Symbol.toStringTag;fe[ll]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(fe.prototype);var de=class extends w{constructor(t,r=!1){var i,s,n;if(super(d.Map),this.children=[t],this.keysSorted=r,t&&(t.name="entries",!((i=t?.type)===null||i===void 0)&&i.children)){let o=(s=t?.type)===null||s===void 0?void 0:s.children[0];o&&(o.name="key");let a=(n=t?.type)===null||n===void 0?void 0:n.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};ul=Symbol.toStringTag;de[ul]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(de.prototype);var Np=(e=>()=>++e)(-1),pe=class extends w{constructor(t,r,i,s){super(d.Dictionary),this.indices=r,this.dictionary=t,this.isOrdered=s||!1,this.id=i==null?Np():J(i)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};fl=Symbol.toStringTag;pe[fl]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(pe.prototype);function Ae(e){let t=e;switch(e.typeId){case d.Decimal:return e.bitWidth/32;case d.Interval:return t.unit===nt.MONTH_DAY_NANO?4:1+t.unit;case d.FixedSizeList:return t.listSize;case d.FixedSizeBinary:return t.byteWidth;default:return 1}}var A=class{visitMany(t,...r){return t.map((i,s)=>this.visit(i,...r.map(n=>n[s])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return Op(this,t,r)}getVisitFnByTypeId(t,r=!0){return cs(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitLargeUtf8(t,...r){return null}visitBinary(t,...r){return null}visitLargeBinary(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};function Op(e,t,r=!0){return typeof t=="number"?cs(e,t,r):typeof t=="string"&&t in d?cs(e,d[t],r):t&&t instanceof w?cs(e,dl(t),r):t?.type&&t.type instanceof w?cs(e,dl(t.type),r):cs(e,d.NONE,r)}function cs(e,t,r=!0){let i=null;switch(t){case d.Null:i=e.visitNull;break;case d.Bool:i=e.visitBool;break;case d.Int:i=e.visitInt;break;case d.Int8:i=e.visitInt8||e.visitInt;break;case d.Int16:i=e.visitInt16||e.visitInt;break;case d.Int32:i=e.visitInt32||e.visitInt;break;case d.Int64:i=e.visitInt64||e.visitInt;break;case d.Uint8:i=e.visitUint8||e.visitInt;break;case d.Uint16:i=e.visitUint16||e.visitInt;break;case d.Uint32:i=e.visitUint32||e.visitInt;break;case d.Uint64:i=e.visitUint64||e.visitInt;break;case d.Float:i=e.visitFloat;break;case d.Float16:i=e.visitFloat16||e.visitFloat;break;case d.Float32:i=e.visitFloat32||e.visitFloat;break;case d.Float64:i=e.visitFloat64||e.visitFloat;break;case d.Utf8:i=e.visitUtf8;break;case d.LargeUtf8:i=e.visitLargeUtf8;break;case d.Binary:i=e.visitBinary;break;case d.LargeBinary:i=e.visitLargeBinary;break;case d.FixedSizeBinary:i=e.visitFixedSizeBinary;break;case d.Date:i=e.visitDate;break;case d.DateDay:i=e.visitDateDay||e.visitDate;break;case d.DateMillisecond:i=e.visitDateMillisecond||e.visitDate;break;case d.Timestamp:i=e.visitTimestamp;break;case d.TimestampSecond:i=e.visitTimestampSecond||e.visitTimestamp;break;case d.TimestampMillisecond:i=e.visitTimestampMillisecond||e.visitTimestamp;break;case d.TimestampMicrosecond:i=e.visitTimestampMicrosecond||e.visitTimestamp;break;case d.TimestampNanosecond:i=e.visitTimestampNanosecond||e.visitTimestamp;break;case d.Time:i=e.visitTime;break;case d.TimeSecond:i=e.visitTimeSecond||e.visitTime;break;case d.TimeMillisecond:i=e.visitTimeMillisecond||e.visitTime;break;case d.TimeMicrosecond:i=e.visitTimeMicrosecond||e.visitTime;break;case d.TimeNanosecond:i=e.visitTimeNanosecond||e.visitTime;break;case d.Decimal:i=e.visitDecimal;break;case d.List:i=e.visitList;break;case d.Struct:i=e.visitStruct;break;case d.Union:i=e.visitUnion;break;case d.DenseUnion:i=e.visitDenseUnion||e.visitUnion;break;case d.SparseUnion:i=e.visitSparseUnion||e.visitUnion;break;case d.Dictionary:i=e.visitDictionary;break;case d.Interval:i=e.visitInterval;break;case d.IntervalDayTime:i=e.visitIntervalDayTime||e.visitInterval;break;case d.IntervalYearMonth:i=e.visitIntervalYearMonth||e.visitInterval;break;case d.IntervalMonthDayNano:i=e.visitIntervalMonthDayNano||e.visitInterval;break;case d.Duration:i=e.visitDuration;break;case d.DurationSecond:i=e.visitDurationSecond||e.visitDuration;break;case d.DurationMillisecond:i=e.visitDurationMillisecond||e.visitDuration;break;case d.DurationMicrosecond:i=e.visitDurationMicrosecond||e.visitDuration;break;case d.DurationNanosecond:i=e.visitDurationNanosecond||e.visitDuration;break;case d.FixedSizeList:i=e.visitFixedSizeList;break;case d.Map:i=e.visitMap;break}if(typeof i=="function")return i;if(!r)return()=>null;throw new Error(`Unrecognized type '${d[t]}'`)}function dl(e){switch(e.typeId){case d.Null:return d.Null;case d.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?d.Int8:d.Uint8;case 16:return r?d.Int16:d.Uint16;case 32:return r?d.Int32:d.Uint32;case 64:return r?d.Int64:d.Uint64}return d.Int}case d.Float:switch(e.precision){case st.HALF:return d.Float16;case st.SINGLE:return d.Float32;case st.DOUBLE:return d.Float64}return d.Float;case d.Binary:return d.Binary;case d.LargeBinary:return d.LargeBinary;case d.Utf8:return d.Utf8;case d.LargeUtf8:return d.LargeUtf8;case d.Bool:return d.Bool;case d.Decimal:return d.Decimal;case d.Time:switch(e.unit){case x.SECOND:return d.TimeSecond;case x.MILLISECOND:return d.TimeMillisecond;case x.MICROSECOND:return d.TimeMicrosecond;case x.NANOSECOND:return d.TimeNanosecond}return d.Time;case d.Timestamp:switch(e.unit){case x.SECOND:return d.TimestampSecond;case x.MILLISECOND:return d.TimestampMillisecond;case x.MICROSECOND:return d.TimestampMicrosecond;case x.NANOSECOND:return d.TimestampNanosecond}return d.Timestamp;case d.Date:switch(e.unit){case dt.DAY:return d.DateDay;case dt.MILLISECOND:return d.DateMillisecond}return d.Date;case d.Interval:switch(e.unit){case nt.DAY_TIME:return d.IntervalDayTime;case nt.YEAR_MONTH:return d.IntervalYearMonth;case nt.MONTH_DAY_NANO:return d.IntervalMonthDayNano}return d.Interval;case d.Duration:switch(e.unit){case x.SECOND:return d.DurationSecond;case x.MILLISECOND:return d.DurationMillisecond;case x.MICROSECOND:return d.DurationMicrosecond;case x.NANOSECOND:return d.DurationNanosecond}return d.Duration;case d.Map:return d.Map;case d.List:return d.List;case d.Struct:return d.Struct;case d.Union:switch(e.mode){case ht.Dense:return d.DenseUnion;case ht.Sparse:return d.SparseUnion}return d.Union;case d.FixedSizeBinary:return d.FixedSizeBinary;case d.FixedSizeList:return d.FixedSizeList;case d.Dictionary:return d.Dictionary}throw new Error(`Unrecognized type '${d[e.typeId]}'`)}A.prototype.visitInt8=null;A.prototype.visitInt16=null;A.prototype.visitInt32=null;A.prototype.visitInt64=null;A.prototype.visitUint8=null;A.prototype.visitUint16=null;A.prototype.visitUint32=null;A.prototype.visitUint64=null;A.prototype.visitFloat16=null;A.prototype.visitFloat32=null;A.prototype.visitFloat64=null;A.prototype.visitDateDay=null;A.prototype.visitDateMillisecond=null;A.prototype.visitTimestampSecond=null;A.prototype.visitTimestampMillisecond=null;A.prototype.visitTimestampMicrosecond=null;A.prototype.visitTimestampNanosecond=null;A.prototype.visitTimeSecond=null;A.prototype.visitTimeMillisecond=null;A.prototype.visitTimeMicrosecond=null;A.prototype.visitTimeNanosecond=null;A.prototype.visitDenseUnion=null;A.prototype.visitSparseUnion=null;A.prototype.visitIntervalDayTime=null;A.prototype.visitIntervalYearMonth=null;A.prototype.visitIntervalMonthDayNano=null;A.prototype.visitDuration=null;A.prototype.visitDurationSecond=null;A.prototype.visitDurationMillisecond=null;A.prototype.visitDurationMicrosecond=null;A.prototype.visitDurationNanosecond=null;var lh={};Dr(lh,{float64ToUint16:()=>$s,uint16ToFloat64:()=>ho});var pl=new Float64Array(1),ls=new Uint32Array(pl.buffer);function ho(e){let t=(e&31744)>>10,r=(e&1023)/1024,i=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return i*(r?Number.NaN:1/0);case 0:return i*(r?6103515625e-14*r:0)}return i*Math.pow(2,t-15)*(1+r)}function $s(e){if(e!==e)return 32256;pl[0]=e;let t=(ls[1]&2147483648)>>16&65535,r=ls[1]&2146435072,i=0;return r>=1089470464?ls[0]>0?r=31744:(r=(r&2080374784)>>16,i=(ls[1]&1048575)>>10):r<=1056964608?(i=1048576+(ls[1]&1048575),i=1048576+(i<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,i=(ls[1]&1048575)+512>>10),t|r|i&65535}var N=class extends A{};function R(e){return(t,r,i)=>{if(t.setValid(r,i!=null))return e(t,r,i)}}var Lp=(e,t,r)=>{e[t]=Math.floor(r/864e5)},ml=(e,t,r,i)=>{if(r+1<t.length){let s=J(t[r]),n=J(t[r+1]);e.set(i.subarray(0,n-s),s)}},Fp=({offset:e,values:t},r,i)=>{let s=e+r;i?t[s>>3]|=1<<s%8:t[s>>3]&=~(1<<s%8)},Or=({values:e},t,r)=>{e[t]=r},uh=({values:e},t,r)=>{e[t]=r},yl=({values:e},t,r)=>{e[t]=$s(r)},Rp=(e,t,r)=>{switch(e.type.precision){case st.HALF:return yl(e,t,r);case st.SINGLE:case st.DOUBLE:return uh(e,t,r)}},co=({values:e},t,r)=>{Lp(e,t,r.valueOf())},lo=({values:e},t,r)=>{e[t]=BigInt(r)},fh=({stride:e,values:t},r,i)=>{t.set(i.subarray(0,e),e*r)},gl=({values:e,valueOffsets:t},r,i)=>ml(e,t,r,i),_l=({values:e,valueOffsets:t},r,i)=>ml(e,t,r,hr(i)),dh=(e,t,r)=>{e.type.unit===dt.DAY?co(e,t,r):lo(e,t,r)},uo=({values:e},t,r)=>{e[t]=BigInt(r/1e3)},fo=({values:e},t,r)=>{e[t]=BigInt(r)},po=({values:e},t,r)=>{e[t]=BigInt(r*1e3)},mo=({values:e},t,r)=>{e[t]=BigInt(r*1e6)},ph=(e,t,r)=>{switch(e.type.unit){case x.SECOND:return uo(e,t,r);case x.MILLISECOND:return fo(e,t,r);case x.MICROSECOND:return po(e,t,r);case x.NANOSECOND:return mo(e,t,r)}},yo=({values:e},t,r)=>{e[t]=r},go=({values:e},t,r)=>{e[t]=r},_o=({values:e},t,r)=>{e[t]=r},bo=({values:e},t,r)=>{e[t]=r},mh=(e,t,r)=>{switch(e.type.unit){case x.SECOND:return yo(e,t,r);case x.MILLISECOND:return go(e,t,r);case x.MICROSECOND:return _o(e,t,r);case x.NANOSECOND:return bo(e,t,r)}},yh=({values:e,stride:t},r,i)=>{e.set(i.subarray(0,t),t*r)},Cp=(e,t,r)=>{let i=e.children[0],s=e.valueOffsets,n=kt.getVisitFn(i);if(Array.isArray(r))for(let o=-1,a=s[t],h=s[t+1];a<h;)n(i,a++,r[++o]);else for(let o=-1,a=s[t],h=s[t+1];a<h;)n(i,a++,r.get(++o))},Up=(e,t,r)=>{let i=e.children[0],{valueOffsets:s}=e,n=kt.getVisitFn(i),{[t]:o,[t+1]:a}=s,h=r instanceof Map?r.entries():Object.entries(r);for(let c of h)if(n(i,o,c),++o>=a)break},Pp=(e,t)=>(r,i,s,n)=>i&&r(i,e,t[n]),kp=(e,t)=>(r,i,s,n)=>i&&r(i,e,t.get(n)),Vp=(e,t)=>(r,i,s,n)=>i&&r(i,e,t.get(s.name)),zp=(e,t)=>(r,i,s,n)=>i&&r(i,e,t[s.name]),jp=(e,t,r)=>{let i=e.type.children.map(n=>kt.getVisitFn(n.type)),s=r instanceof Map?Vp(t,r):r instanceof V?kp(t,r):Array.isArray(r)?Pp(t,r):zp(t,r);e.type.children.forEach((n,o)=>s(i[o],e.children[o],n,o))},Gp=(e,t,r)=>{e.type.mode===ht.Dense?bl(e,t,r):vl(e,t,r)},bl=(e,t,r)=>{let i=e.type.typeIdToChildIndex[e.typeIds[t]],s=e.children[i];kt.visit(s,e.valueOffsets[t],r)},vl=(e,t,r)=>{let i=e.type.typeIdToChildIndex[e.typeIds[t]],s=e.children[i];kt.visit(s,t,r)},Hp=(e,t,r)=>{var i;(i=e.dictionary)===null||i===void 0||i.set(e.values[t],r)},gh=(e,t,r)=>{switch(e.type.unit){case nt.YEAR_MONTH:return wo(e,t,r);case nt.DAY_TIME:return vo(e,t,r);case nt.MONTH_DAY_NANO:return Mo(e,t,r)}},vo=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},wo=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},Mo=({values:e,stride:t},r,i)=>{e.set(i.subarray(0,t),t*r)},xo=({values:e},t,r)=>{e[t]=r},Io=({values:e},t,r)=>{e[t]=r},So=({values:e},t,r)=>{e[t]=r},Ao=({values:e},t,r)=>{e[t]=r},_h=(e,t,r)=>{switch(e.type.unit){case x.SECOND:return xo(e,t,r);case x.MILLISECOND:return Io(e,t,r);case x.MICROSECOND:return So(e,t,r);case x.NANOSECOND:return Ao(e,t,r)}},Wp=(e,t,r)=>{let{stride:i}=e,s=e.children[0],n=kt.getVisitFn(s);if(Array.isArray(r))for(let o=-1,a=t*i;++o<i;)n(s,a+o,r[o]);else for(let o=-1,a=t*i;++o<i;)n(s,a+o,r.get(o))};N.prototype.visitBool=R(Fp);N.prototype.visitInt=R(Or);N.prototype.visitInt8=R(Or);N.prototype.visitInt16=R(Or);N.prototype.visitInt32=R(Or);N.prototype.visitInt64=R(Or);N.prototype.visitUint8=R(Or);N.prototype.visitUint16=R(Or);N.prototype.visitUint32=R(Or);N.prototype.visitUint64=R(Or);N.prototype.visitFloat=R(Rp);N.prototype.visitFloat16=R(yl);N.prototype.visitFloat32=R(uh);N.prototype.visitFloat64=R(uh);N.prototype.visitUtf8=R(_l);N.prototype.visitLargeUtf8=R(_l);N.prototype.visitBinary=R(gl);N.prototype.visitLargeBinary=R(gl);N.prototype.visitFixedSizeBinary=R(fh);N.prototype.visitDate=R(dh);N.prototype.visitDateDay=R(co);N.prototype.visitDateMillisecond=R(lo);N.prototype.visitTimestamp=R(ph);N.prototype.visitTimestampSecond=R(uo);N.prototype.visitTimestampMillisecond=R(fo);N.prototype.visitTimestampMicrosecond=R(po);N.prototype.visitTimestampNanosecond=R(mo);N.prototype.visitTime=R(mh);N.prototype.visitTimeSecond=R(yo);N.prototype.visitTimeMillisecond=R(go);N.prototype.visitTimeMicrosecond=R(_o);N.prototype.visitTimeNanosecond=R(bo);N.prototype.visitDecimal=R(yh);N.prototype.visitList=R(Cp);N.prototype.visitStruct=R(jp);N.prototype.visitUnion=R(Gp);N.prototype.visitDenseUnion=R(bl);N.prototype.visitSparseUnion=R(vl);N.prototype.visitDictionary=R(Hp);N.prototype.visitInterval=R(gh);N.prototype.visitIntervalDayTime=R(vo);N.prototype.visitIntervalYearMonth=R(wo);N.prototype.visitIntervalMonthDayNano=R(Mo);N.prototype.visitDuration=R(_h);N.prototype.visitDurationSecond=R(xo);N.prototype.visitDurationMillisecond=R(Io);N.prototype.visitDurationMicrosecond=R(So);N.prototype.visitDurationNanosecond=R(Ao);N.prototype.visitFixedSizeList=R(Wp);N.prototype.visitMap=R(Up);var kt=new N;var Xe=Symbol.for("parent"),us=Symbol.for("rowIndex"),Kr=class{constructor(t,r){return this[Xe]=t,this[us]=r,new Proxy(this,qp)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[us],r=this[Xe],i=r.type.children,s={};for(let n=-1,o=i.length;++n<o;)s[i[n].name]=Mt.visit(r.children[n],t);return s}toString(){return`{${[...this].map(([t,r])=>`${Ye(t)}: ${Ye(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new bh(this[Xe],this[us])}},bh=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,Mt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Kr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Xe]:{writable:!0,enumerable:!1,configurable:!1,value:null},[us]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var vh=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Xe].type.children.map(r=>r.name)}has(t,r){return t[Xe].type.children.some(i=>i.name===r)}getOwnPropertyDescriptor(t,r){if(t[Xe].type.children.some(i=>i.name===r))return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let i=t[Xe].type.children.findIndex(s=>s.name===r);if(i!==-1){let s=Mt.visit(t[Xe].children[i],t[us]);return Reflect.set(t,r,s),s}}set(t,r,i){let s=t[Xe].type.children.findIndex(n=>n.name===r);return s!==-1?(kt.visit(t[Xe].children[s],t[us],i),Reflect.set(t,r,i)):Reflect.has(t,r)||typeof r=="symbol"?Reflect.set(t,r,i):!1}},qp=new vh;var B=class extends A{};function L(e){return(t,r)=>t.getValid(r)?e(t,r):null}var $p=(e,t)=>864e5*e[t],Jp=(e,t)=>null,wl=(e,t,r)=>{if(r+1>=t.length)return null;let i=J(t[r]),s=J(t[r+1]);return e.subarray(i,s)},Yp=({offset:e,values:t},r)=>{let i=e+r;return(t[i>>3]&1<<i%8)!==0},Ml=({values:e},t)=>$p(e,t),xl=({values:e},t)=>J(e[t]),Xr=({stride:e,values:t},r)=>t[e*r],Kp=({stride:e,values:t},r)=>ho(t[e*r]),Il=({values:e},t)=>e[t],Xp=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),Sl=({values:e,valueOffsets:t},r)=>wl(e,t,r),Al=({values:e,valueOffsets:t},r)=>{let i=wl(e,t,r);return i!==null?zs(i):null},Zp=({values:e},t)=>e[t],Qp=({type:e,values:t},r)=>e.precision!==st.HALF?t[r]:ho(t[r]),tm=(e,t)=>e.type.unit===dt.DAY?Ml(e,t):xl(e,t),Bl=({values:e},t)=>1e3*J(e[t]),Tl=({values:e},t)=>J(e[t]),Dl=({values:e},t)=>oh(e[t],BigInt(1e3)),El=({values:e},t)=>oh(e[t],BigInt(1e6)),em=(e,t)=>{switch(e.type.unit){case x.SECOND:return Bl(e,t);case x.MILLISECOND:return Tl(e,t);case x.MICROSECOND:return Dl(e,t);case x.NANOSECOND:return El(e,t)}},Nl=({values:e},t)=>e[t],Ol=({values:e},t)=>e[t],Ll=({values:e},t)=>e[t],Fl=({values:e},t)=>e[t],rm=(e,t)=>{switch(e.type.unit){case x.SECOND:return Nl(e,t);case x.MILLISECOND:return Ol(e,t);case x.MICROSECOND:return Ll(e,t);case x.NANOSECOND:return Fl(e,t)}},im=({values:e,stride:t},r)=>hi.decimal(e.subarray(t*r,t*(r+1))),sm=(e,t)=>{let{valueOffsets:r,stride:i,children:s}=e,{[t*i]:n,[t*i+1]:o}=r,h=s[0].slice(n,o-n);return new V([h])},nm=(e,t)=>{let{valueOffsets:r,children:i}=e,{[t]:s,[t+1]:n}=r,o=i[0];return new xr(o.slice(s,n-s))},om=(e,t)=>new Kr(e,t),am=(e,t)=>e.type.mode===ht.Dense?Rl(e,t):Cl(e,t),Rl=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];return Mt.visit(i,e.valueOffsets[t])},Cl=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];return Mt.visit(i,t)},hm=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},cm=(e,t)=>e.type.unit===nt.MONTH_DAY_NANO?kl(e,t):e.type.unit===nt.DAY_TIME?Ul(e,t):Pl(e,t),Ul=({values:e},t)=>e.subarray(2*t,2*(t+1)),Pl=({values:e},t)=>{let r=e[t],i=new Int32Array(2);return i[0]=Math.trunc(r/12),i[1]=Math.trunc(r%12),i},kl=({values:e},t)=>e.subarray(4*t,4*(t+1)),Vl=({values:e},t)=>e[t],zl=({values:e},t)=>e[t],jl=({values:e},t)=>e[t],Gl=({values:e},t)=>e[t],lm=(e,t)=>{switch(e.type.unit){case x.SECOND:return Vl(e,t);case x.MILLISECOND:return zl(e,t);case x.MICROSECOND:return jl(e,t);case x.NANOSECOND:return Gl(e,t)}},um=(e,t)=>{let{stride:r,children:i}=e,n=i[0].slice(t*r,r);return new V([n])};B.prototype.visitNull=L(Jp);B.prototype.visitBool=L(Yp);B.prototype.visitInt=L(Zp);B.prototype.visitInt8=L(Xr);B.prototype.visitInt16=L(Xr);B.prototype.visitInt32=L(Xr);B.prototype.visitInt64=L(Il);B.prototype.visitUint8=L(Xr);B.prototype.visitUint16=L(Xr);B.prototype.visitUint32=L(Xr);B.prototype.visitUint64=L(Il);B.prototype.visitFloat=L(Qp);B.prototype.visitFloat16=L(Kp);B.prototype.visitFloat32=L(Xr);B.prototype.visitFloat64=L(Xr);B.prototype.visitUtf8=L(Al);B.prototype.visitLargeUtf8=L(Al);B.prototype.visitBinary=L(Sl);B.prototype.visitLargeBinary=L(Sl);B.prototype.visitFixedSizeBinary=L(Xp);B.prototype.visitDate=L(tm);B.prototype.visitDateDay=L(Ml);B.prototype.visitDateMillisecond=L(xl);B.prototype.visitTimestamp=L(em);B.prototype.visitTimestampSecond=L(Bl);B.prototype.visitTimestampMillisecond=L(Tl);B.prototype.visitTimestampMicrosecond=L(Dl);B.prototype.visitTimestampNanosecond=L(El);B.prototype.visitTime=L(rm);B.prototype.visitTimeSecond=L(Nl);B.prototype.visitTimeMillisecond=L(Ol);B.prototype.visitTimeMicrosecond=L(Ll);B.prototype.visitTimeNanosecond=L(Fl);B.prototype.visitDecimal=L(im);B.prototype.visitList=L(sm);B.prototype.visitStruct=L(om);B.prototype.visitUnion=L(am);B.prototype.visitDenseUnion=L(Rl);B.prototype.visitSparseUnion=L(Cl);B.prototype.visitDictionary=L(hm);B.prototype.visitInterval=L(cm);B.prototype.visitIntervalDayTime=L(Ul);B.prototype.visitIntervalYearMonth=L(Pl);B.prototype.visitIntervalMonthDayNano=L(kl);B.prototype.visitDuration=L(lm);B.prototype.visitDurationSecond=L(Vl);B.prototype.visitDurationMillisecond=L(zl);B.prototype.visitDurationMicrosecond=L(jl);B.prototype.visitDurationNanosecond=L(Gl);B.prototype.visitFixedSizeList=L(um);B.prototype.visitMap=L(nm);var Mt=new B;var Zr=Symbol.for("keys"),ds=Symbol.for("vals"),fs=Symbol.for("kKeysAsStrings"),wh=Symbol.for("_kKeysAsStrings"),xr=class{constructor(t){return this[Zr]=new V([t.children[0]]).memoize(),this[ds]=t.children[1],new Proxy(this,new xh)}get[fs](){return this[wh]||(this[wh]=Array.from(this[Zr].toArray(),String))}[Symbol.iterator](){return new Mh(this[Zr],this[ds])}get size(){return this[Zr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Zr],r=this[ds],i={};for(let s=-1,n=t.length;++s<n;)i[t.get(s)]=Mt.visit(r,s);return i}toString(){return`{${[...this].map(([t,r])=>`${Ye(t)}: ${Ye(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},Mh=class{constructor(t,r){this.keys=t,this.vals=r,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),Mt.visit(this.vals,t)]})}},xh=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[fs]}has(t,r){return t[fs].includes(r)}getOwnPropertyDescriptor(t,r){if(t[fs].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let i=t[fs].indexOf(r);if(i!==-1){let s=Mt.visit(Reflect.get(t,ds),i);return Reflect.set(t,r,s),s}}set(t,r,i){let s=t[fs].indexOf(r);return s!==-1?(kt.visit(Reflect.get(t,ds),s,i),Reflect.set(t,r,i)):Reflect.has(t,r)?Reflect.set(t,r,i):!1}};Object.defineProperties(xr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Zr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ds]:{writable:!0,enumerable:!1,configurable:!1,value:null},[wh]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var Hl;function Js(e,t,r,i){let{length:s=0}=e,n=typeof t!="number"?0:t,o=typeof r!="number"?s:r;return n<0&&(n=(n%s+s)%s),o<0&&(o=(o%s+s)%s),o<n&&(Hl=n,n=o,o=Hl),o>s&&(o=s),i?i(e,n,o):[n,o]}var bi=(e,t)=>e<0?t+e:e,Wl=e=>e!==e;function Qr(e){if(typeof e!=="object"||e===null)return Wl(e)?Wl:r=>r===e;if(e instanceof Date){let r=e.valueOf();return i=>i instanceof Date?i.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?eh(e,r):!1:e instanceof Map?dm(e):Array.isArray(e)?fm(e):e instanceof V?pm(e):mm(e,!0)}function fm(e){let t=[];for(let r=-1,i=e.length;++r<i;)t[r]=Qr(e[r]);return Bo(t)}function dm(e){let t=-1,r=[];for(let i of e.values())r[++t]=Qr(i);return Bo(r)}function pm(e){let t=[];for(let r=-1,i=e.length;++r<i;)t[r]=Qr(e.get(r));return Bo(t)}function mm(e,t=!1){let r=Object.keys(e);if(!t&&r.length===0)return()=>!1;let i=[];for(let s=-1,n=r.length;++s<n;)i[s]=Qr(e[r[s]]);return Bo(i,r)}function Bo(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return ym(e,r);case Map:return ql(e,r,r.keys());case xr:case Kr:case Object:case void 0:return ql(e,r,t||Object.keys(r))}return r instanceof V?gm(e,r):!1}}function ym(e,t){let r=e.length;if(t.length!==r)return!1;for(let i=-1;++i<r;)if(!e[i](t[i]))return!1;return!0}function gm(e,t){let r=e.length;if(t.length!==r)return!1;for(let i=-1;++i<r;)if(!e[i](t.get(i)))return!1;return!0}function ql(e,t,r){let i=r[Symbol.iterator](),s=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),n=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,a=e.length,h=n.next(),c=i.next(),l=s.next();for(;o<a&&!c.done&&!l.done&&!h.done&&!(c.value!==l.value||!e[o](h.value));++o,c=i.next(),l=s.next(),h=n.next());return o===a&&c.done&&l.done&&h.done?!0:(i.return&&i.return(),s.return&&s.return(),n.return&&n.return(),!1)}var Sh={};Dr(Sh,{BitIterator:()=>vi,getBit:()=>$l,getBool:()=>Do,packBools:()=>Mi,popcnt_array:()=>Jl,popcnt_bit_range:()=>Ys,popcnt_uint32:()=>To,setBool:()=>_m,truncateBitmap:()=>wi});function Do(e,t,r,i){return(r&1<<i)!==0}function $l(e,t,r,i){return(r&1<<i)>>i}function _m(e,t,r){return r?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function wi(e,t,r){let i=r.byteLength+7&-8;if(e>0||r.byteLength<i){let s=new Uint8Array(i);return s.set(e%8===0?r.subarray(e>>3):Mi(new vi(r,e,t,null,Do)).subarray(0,i)),s}return r}function Mi(e){let t=[],r=0,i=0,s=0;for(let o of e)o&&(s|=1<<i),++i===8&&(t[r++]=s,s=i=0);(r===0||i>0)&&(t[r++]=s);let n=new Uint8Array(t.length+7&-8);return n.set(t),n}var vi=class{constructor(t,r,i,s,n){this.bytes=t,this.length=i,this.context=s,this.get=n,this.bit=r%8,this.byteIndex=r>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function Ys(e,t,r){if(r-t<=0)return 0;if(r-t<8){let n=0;for(let o of new vi(e,t,r-t,e,$l))n+=o;return n}let i=r>>3<<3,s=t+(t%8===0?0:8-t%8);return Ys(e,t,s)+Ys(e,i,r)+Jl(e,s>>3,i-s>>3)}function Jl(e,t,r){let i=0,s=Math.trunc(t),n=new DataView(e.buffer,e.byteOffset,e.byteLength),o=r===void 0?e.byteLength:s+r;for(;o-s>=4;)i+=To(n.getUint32(s)),s+=4;for(;o-s>=2;)i+=To(n.getUint16(s)),s+=2;for(;o-s>=1;)i+=To(n.getUint8(s)),s+=1;return i}function To(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var bm=-1,q=class{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return w.isSparseUnion(t)?this.children.some(r=>r.nullable):w.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:i,nullBitmap:s,typeIds:n}=this;return r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),n&&(t+=n.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(w.isUnion(this.type))return this.children.reduce((i,s)=>i+s.nullCount,0);let t=this._nullCount,r;return t<=bm&&(r=this.nullBitmap)&&(this._nullCount=t=r.length===0?0:this.length-Ys(r,this.offset,this.offset+this.length)),t}constructor(t,r,i,s,n,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(i||0,0)),this._nullCount=Math.floor(Math.max(s||0,-1));let h;n instanceof q?(this.stride=n.stride,this.values=n.values,this.typeIds=n.typeIds,this.nullBitmap=n.nullBitmap,this.valueOffsets=n.valueOffsets):(this.stride=Ae(t),n&&((h=n[0])&&(this.valueOffsets=h),(h=n[1])&&(this.values=h),(h=n[2])&&(this.nullBitmap=h),(h=n[3])&&(this.typeIds=h)))}getValid(t){let{type:r}=this;if(w.isUnion(r)){let i=r,s=this.children[i.typeIdToChildIndex[this.typeIds[t]]],n=i.mode===ht.Dense?this.valueOffsets[t]:t;return s.getValid(n)}if(this.nullable&&this.nullCount>0){let i=this.offset+t;return(this.nullBitmap[i>>3]&1<<i%8)!==0}return!0}setValid(t,r){let i,{type:s}=this;if(w.isUnion(s)){let n=s,o=this.children[n.typeIdToChildIndex[this.typeIds[t]]],a=n.mode===ht.Dense?this.valueOffsets[t]:t;i=o.getValid(a),o.setValid(a,r)}else{let{nullBitmap:n}=this,{offset:o,length:a}=this,h=o+t,c=1<<h%8,l=h>>3;(!n||n.byteLength<=l)&&(n=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(n.set(wi(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:n})):Object.assign(this,{nullBitmap:n,_nullCount:0}));let u=n[l];i=(u&c)!==0,n[l]=r?u|c:u&~c}return i!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,i=this.length,s=this._nullCount,n=this,o=this.children){return new q(t,r,i,s,n,o,this.dictionary)}slice(t,r){let{stride:i,typeId:s,children:n}=this,o=+(this._nullCount===0)-1,a=s===16?i:1,h=this._sliceBuffers(t,r,i,s);return this.clone(this.type,this.offset+t,r,o,h,n.length===0||this.valueOffsets?n:this._sliceChildren(n,a*t,a*r))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===d.Null)return this.clone(this.type,0,t,0);let{length:r,nullCount:i}=this,s=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);s[r>>3]=(1<<r-(r&-8))-1,i>0&&s.set(wi(this.offset,r,this.nullBitmap),0);let n=this.buffers;return n[Je.VALIDITY]=s,this.clone(this.type,0,t,i+(t-r),n)}_sliceBuffers(t,r,i,s){let n,{buffers:o}=this;return(n=o[Je.TYPE])&&(o[Je.TYPE]=n.subarray(t,t+r)),(n=o[Je.OFFSET])&&(o[Je.OFFSET]=n.subarray(t,t+r+1))||(n=o[Je.DATA])&&(o[Je.DATA]=s===6?n:n.subarray(i*t,i*(t+r))),o}_sliceChildren(t,r,i){return t.map(s=>s.slice(r,i))}};q.prototype.children=Object.freeze([]);var xi=class extends A{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:r,["offset"]:i=0,["length"]:s=0}=t;return new q(r,i,s,s)}visitBool(t){let{["type"]:r,["offset"]:i=0}=t,s=O(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitInt(t){let{["type"]:r,["offset"]:i=0}=t,s=O(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitFloat(t){let{["type"]:r,["offset"]:i=0}=t,s=O(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitUtf8(t){let{["type"]:r,["offset"]:i=0}=t,s=O(t.data),n=O(t.nullBitmap),o=oi(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,s,n])}visitLargeUtf8(t){let{["type"]:r,["offset"]:i=0}=t,s=O(t.data),n=O(t.nullBitmap),o=ro(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,s,n])}visitBinary(t){let{["type"]:r,["offset"]:i=0}=t,s=O(t.data),n=O(t.nullBitmap),o=oi(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,s,n])}visitLargeBinary(t){let{["type"]:r,["offset"]:i=0}=t,s=O(t.data),n=O(t.nullBitmap),o=ro(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,s,n])}visitFixedSizeBinary(t){let{["type"]:r,["offset"]:i=0}=t,s=O(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ae(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitDate(t){let{["type"]:r,["offset"]:i=0}=t,s=O(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ae(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitTimestamp(t){let{["type"]:r,["offset"]:i=0}=t,s=O(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ae(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitTime(t){let{["type"]:r,["offset"]:i=0}=t,s=O(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ae(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitDecimal(t){let{["type"]:r,["offset"]:i=0}=t,s=O(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ae(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitList(t){let{["type"]:r,["offset"]:i=0,["child"]:s}=t,n=O(t.nullBitmap),o=oi(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,void 0,n],[s])}visitStruct(t){let{["type"]:r,["offset"]:i=0,["children"]:s=[]}=t,n=O(t.nullBitmap),{length:o=s.reduce((h,{length:c})=>Math.max(h,c),0),nullCount:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,void 0,n],s)}visitUnion(t){let{["type"]:r,["offset"]:i=0,["children"]:s=[]}=t,n=G(r.ArrayType,t.typeIds),{["length"]:o=n.length,["nullCount"]:a=-1}=t;if(w.isSparseUnion(r))return new q(r,i,o,a,[void 0,void 0,void 0,n],s);let h=oi(t.valueOffsets);return new q(r,i,o,a,[h,void 0,void 0,n],s)}visitDictionary(t){let{["type"]:r,["offset"]:i=0}=t,s=O(t.nullBitmap),n=G(r.indices.ArrayType,t.data),{["dictionary"]:o=new V([new xi().visit({type:r.dictionary})])}=t,{["length"]:a=n.length,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[void 0,n,s],[],o)}visitInterval(t){let{["type"]:r,["offset"]:i=0}=t,s=O(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length/Ae(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitDuration(t){let{["type"]:r,["offset"]:i=0}=t,s=O(t.nullBitmap),n=G(r.ArrayType,t.data),{["length"]:o=n.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,n,s])}visitFixedSizeList(t){let{["type"]:r,["offset"]:i=0,["child"]:s=new xi().visit({type:r.valueType})}=t,n=O(t.nullBitmap),{["length"]:o=s.length/Ae(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new q(r,i,o,a,[void 0,void 0,n],[s])}visitMap(t){let{["type"]:r,["offset"]:i=0,["child"]:s=new xi().visit({type:r.childType})}=t,n=O(t.nullBitmap),o=oi(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:h=t.nullBitmap?-1:0}=t;return new q(r,i,a,h,[o,void 0,n],[s])}},vm=new xi;function C(e){return vm.visit(e)}var Ks=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function Yl(e){return e.some(t=>t.nullable)}function Eo(e){return e.reduce((t,r)=>t+r.nullCount,0)}function No(e){return e.reduce((t,r,i)=>(t[i+1]=t[i]+r.length,t),new Uint32Array(e.length+1))}function Oo(e,t,r,i){let s=[];for(let n=-1,o=e.length;++n<o;){let a=e[n],h=t[n],{length:c}=a;if(h>=i)break;if(r>=h+c)continue;if(h>=r&&h+c<=i){s.push(a);continue}let l=Math.max(0,r-h),u=Math.min(i-h,c);s.push(a.slice(l,u-l))}return s.length===0&&s.push(e[0].slice(0,0)),s}function Ah(e,t,r,i){let s=0,n=0,o=t.length-1;do{if(s>=o-1)return r<t[o]?i(e,s,r-t[s]):null;n=s+Math.trunc((o-s)*.5),r<t[n]?o=n:s=n}while(s<o)}function Xs(e,t){return e.getValid(t)}function ps(e){function t(r,i,s){return e(r[i],s)}return function(r){let i=this.data;return Ah(i,this._offsets,r,t)}}function Lo(e){let t;function r(i,s,n){return e(i[s],n,t)}return function(i,s){let n=this.data;t=s;let o=Ah(n,this._offsets,i,r);return t=void 0,o}}function Fo(e){let t;function r(i,s,n){let o=n,a=0,h=0;for(let c=s-1,l=i.length;++c<l;){let u=i[c];if(~(a=e(u,t,o)))return h+a;o=0,h+=u.length}return-1}return function(i,s){t=i;let n=this.data,o=typeof s!="number"?r(n,0,0):Ah(n,this._offsets,s,r);return t=void 0,o}}var T=class extends A{};function wm(e,t){return t===null&&e.length>0?0:-1}function Mm(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let i=0;for(let s of new vi(r,e.offset+(t||0),e.length,r,Do)){if(!s)return i;++i}return-1}function U(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case d.Union:break;case d.Dictionary:break;default:return Mm(e,r)}let i=Mt.getVisitFn(e),s=Qr(t);for(let n=(r||0)-1,o=e.length;++n<o;)if(s(i(e,n)))return n;return-1}function Kl(e,t,r){let i=Mt.getVisitFn(e),s=Qr(t);for(let n=(r||0)-1,o=e.length;++n<o;)if(s(i(e,n)))return n;return-1}T.prototype.visitNull=wm;T.prototype.visitBool=U;T.prototype.visitInt=U;T.prototype.visitInt8=U;T.prototype.visitInt16=U;T.prototype.visitInt32=U;T.prototype.visitInt64=U;T.prototype.visitUint8=U;T.prototype.visitUint16=U;T.prototype.visitUint32=U;T.prototype.visitUint64=U;T.prototype.visitFloat=U;T.prototype.visitFloat16=U;T.prototype.visitFloat32=U;T.prototype.visitFloat64=U;T.prototype.visitUtf8=U;T.prototype.visitLargeUtf8=U;T.prototype.visitBinary=U;T.prototype.visitLargeBinary=U;T.prototype.visitFixedSizeBinary=U;T.prototype.visitDate=U;T.prototype.visitDateDay=U;T.prototype.visitDateMillisecond=U;T.prototype.visitTimestamp=U;T.prototype.visitTimestampSecond=U;T.prototype.visitTimestampMillisecond=U;T.prototype.visitTimestampMicrosecond=U;T.prototype.visitTimestampNanosecond=U;T.prototype.visitTime=U;T.prototype.visitTimeSecond=U;T.prototype.visitTimeMillisecond=U;T.prototype.visitTimeMicrosecond=U;T.prototype.visitTimeNanosecond=U;T.prototype.visitDecimal=U;T.prototype.visitList=U;T.prototype.visitStruct=U;T.prototype.visitUnion=U;T.prototype.visitDenseUnion=Kl;T.prototype.visitSparseUnion=Kl;T.prototype.visitDictionary=U;T.prototype.visitInterval=U;T.prototype.visitIntervalDayTime=U;T.prototype.visitIntervalYearMonth=U;T.prototype.visitIntervalMonthDayNano=U;T.prototype.visitDuration=U;T.prototype.visitDurationSecond=U;T.prototype.visitDurationMillisecond=U;T.prototype.visitDurationMicrosecond=U;T.prototype.visitDurationNanosecond=U;T.prototype.visitFixedSizeList=U;T.prototype.visitMap=U;var Ii=new T;var D=class extends A{};function F(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(w.isInt(t)&&t.bitWidth!==64||w.isTime(t)&&t.bitWidth!==64||w.isFloat(t)&&t.precision!==st.HALF))return new Ks(e.data.length,i=>{let s=e.data[i];return s.values.subarray(0,s.length)[Symbol.iterator]()});let r=0;return new Ks(e.data.length,i=>{let n=e.data[i].length,o=e.slice(r,r+n);return r+=n,new Bh(o)})}var Bh=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};D.prototype.visitNull=F;D.prototype.visitBool=F;D.prototype.visitInt=F;D.prototype.visitInt8=F;D.prototype.visitInt16=F;D.prototype.visitInt32=F;D.prototype.visitInt64=F;D.prototype.visitUint8=F;D.prototype.visitUint16=F;D.prototype.visitUint32=F;D.prototype.visitUint64=F;D.prototype.visitFloat=F;D.prototype.visitFloat16=F;D.prototype.visitFloat32=F;D.prototype.visitFloat64=F;D.prototype.visitUtf8=F;D.prototype.visitLargeUtf8=F;D.prototype.visitBinary=F;D.prototype.visitLargeBinary=F;D.prototype.visitFixedSizeBinary=F;D.prototype.visitDate=F;D.prototype.visitDateDay=F;D.prototype.visitDateMillisecond=F;D.prototype.visitTimestamp=F;D.prototype.visitTimestampSecond=F;D.prototype.visitTimestampMillisecond=F;D.prototype.visitTimestampMicrosecond=F;D.prototype.visitTimestampNanosecond=F;D.prototype.visitTime=F;D.prototype.visitTimeSecond=F;D.prototype.visitTimeMillisecond=F;D.prototype.visitTimeMicrosecond=F;D.prototype.visitTimeNanosecond=F;D.prototype.visitDecimal=F;D.prototype.visitList=F;D.prototype.visitStruct=F;D.prototype.visitUnion=F;D.prototype.visitDenseUnion=F;D.prototype.visitSparseUnion=F;D.prototype.visitDictionary=F;D.prototype.visitInterval=F;D.prototype.visitIntervalDayTime=F;D.prototype.visitIntervalYearMonth=F;D.prototype.visitIntervalMonthDayNano=F;D.prototype.visitDuration=F;D.prototype.visitDurationSecond=F;D.prototype.visitDurationMillisecond=F;D.prototype.visitDurationMicrosecond=F;D.prototype.visitDurationNanosecond=F;D.prototype.visitFixedSizeList=F;D.prototype.visitMap=F;var ms=new D;var Xl,Zl={},Ql={},V=class{constructor(t){var r,i,s;let n=t[0]instanceof V?t.flatMap(a=>a.data):t;if(n.length===0||n.some(a=>!(a instanceof q)))throw new TypeError("Vector constructor expects an Array of Data instances.");let o=(r=n[0])===null||r===void 0?void 0:r.type;switch(n.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:h,indexOf:c}=Zl[o.typeId],l=n[0];this.isValid=u=>Xs(l,u),this.get=u=>a(l,u),this.set=(u,p)=>h(l,u,p),this.indexOf=u=>c(l,u),this._offsets=[0,l.length];break}default:Object.setPrototypeOf(this,Ql[o.typeId]),this._offsets=No(n);break}this.data=n,this.type=o,this.stride=Ae(o),this.numChildren=(s=(i=o.children)===null||i===void 0?void 0:i.length)!==null&&s!==void 0?s:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullable(){return Yl(this.data)}get nullCount(){return Eo(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${d[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(bi(t,this.length))}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}[Symbol.iterator](){return ms.visit(this)}concat(...t){return new V(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new V(Js(this,t,r,({data:i,_offsets:s},n,o)=>Oo(i,s,n,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:i,stride:s,ArrayType:n}=this;switch(t.typeId){case d.Int:case d.Float:case d.Decimal:case d.Time:case d.Timestamp:switch(r.length){case 0:return new n;case 1:return r[0].values.subarray(0,i*s);default:return r.reduce((o,{values:a,length:h})=>(o.array.set(a.subarray(0,h*s),o.offset),o.offset+=h*s,o),{array:new n(i*s),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new V(this.data.map(({children:r})=>r[t])):null}get isMemoized(){return w.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(w.isDictionary(this.type)){let t=new ys(this.data[0].dictionary),r=this.data.map(i=>{let s=i.clone();return s.dictionary=t,s});return new V(r)}return new ys(this)}unmemoize(){if(w.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(i=>{let s=i.clone();return s.dictionary=t,s});return new V(r)}return this}};Xl=Symbol.toStringTag;V[Xl]=(e=>{e.type=w.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(d).map(r=>d[r]).filter(r=>typeof r=="number"&&r!==d.NONE);for(let r of t){let i=Mt.getVisitFnByTypeId(r),s=kt.getVisitFnByTypeId(r),n=Ii.getVisitFnByTypeId(r);Zl[r]={get:i,set:s,indexOf:n},Ql[r]=Object.create(e,{isValid:{value:ps(Xs)},get:{value:ps(Mt.getVisitFnByTypeId(r))},set:{value:Lo(kt.getVisitFnByTypeId(r))},indexOf:{value:Fo(Ii.getVisitFnByTypeId(r))}})}return"Vector"})(V.prototype);var ys=class extends V{constructor(t){super(t.data);let r=this.get,i=this.set,s=this.slice,n=new Array(this.length);Object.defineProperty(this,"get",{value(o){let a=n[o];if(a!==void 0)return a;let h=r.call(this,o);return n[o]=h,h}}),Object.defineProperty(this,"set",{value(o,a){i.call(this,o,a),n[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new ys(s.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new V(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function tu(e){if(!e||e.length<=0)return function(s){return!0};let t="",r=e.filter(i=>i===i);return r.length>0&&(t=`
|
|
8
8
|
switch (x) {${r.map(i=>`
|
|
9
|
-
case ${
|
|
9
|
+
case ${xm(i)}:`).join("")}
|
|
10
10
|
return false;
|
|
11
11
|
}`),e.length!==r.length&&(t=`if (x !== x) return false;
|
|
12
12
|
${t}`),new Function("x",`${t}
|
|
13
|
-
return true;`)}function Hp(e){return typeof e!="bigint"?$e(e):`${$e(e)}n`}function _h(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function Rc(e,t=0){return e.length>=t?e.subarray(0,t):Ps(new e.constructor(t),e,0)}var Xe=class{constructor(t,r=0,i=1){this.length=Math.ceil(r/i),this.buffer=new t(this.length),this.stride=i,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,i=this.length*r,s=this.buffer.length;i>=s&&this._resize(s===0?_h(i*1,this.BYTES_PER_ELEMENT):_h(i*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=_h(t*this.stride,this.BYTES_PER_ELEMENT);let r=Rc(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=Rc(this.buffer,t)}},Er=class extends Xe{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},ps=class extends Er{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){let{buffer:i}=this.reserve(t-this.length+1),s=t>>3,n=t%8,o=i[s]>>n&1;return r?o===0&&(i[s]|=1<<n,++this.numValid):o===1&&(i[s]&=~(1<<n),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},ms=class extends Er{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,r){let i=this.length-1,s=this.reserve(t-i+1).buffer;return i<t++&&i>=0&&s.fill(s[i],i,t),s[t]=s[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var ut=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=Ie(t),this._nulls=new ps,r&&r.length>0&&(this._isValid=Lc(r))}toVector(){return new j([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:r,_values:i,_nulls:s,_typeIds:n,children:o}=this;return r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),n&&(t+=n.byteLength),o.reduce((a,h)=>a+h.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((r,i)=>r+i.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,i,s,{type:n,length:o,nullCount:a,_typeIds:h,_offsets:l,_values:c,_nulls:u}=this;(r=h?.flush(o))?s=l?.flush(o):(s=l?.flush(o))?t=c?.flush(l.last()):t=c?.flush(o),a>0&&(i=u?.flush(o));let d=this.children.map(p=>p.flush());return this.clear(),U({type:n,length:o,nullCount:a,children:d,child:d[0],data:t,typeIds:r,nullBitmap:i,valueOffsets:s})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,i,s;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(i=this._offsets)===null||i===void 0||i.clear(),(s=this._typeIds)===null||s===void 0||s.clear();for(let n of this.children)n.clear();return this}};ut.prototype.length=1;ut.prototype.stride=1;ut.prototype.children=null;ut.prototype.finished=!1;ut.prototype.nullValues=null;ut.prototype._isValid=()=>!0;var Mt=class extends ut{constructor(t){super(t),this._values=new Er(this.ArrayType,0,this.stride)}setValue(t,r){let i=this._values;return i.reserve(t-i.length+1),super.setValue(t,r)}},ue=class extends ut{constructor(t){super(t),this._pendingLength=0,this._offsets=new ms(t.type)}setValue(t,r){let i=this._pending||(this._pending=new Map),s=i.get(t);s&&(this._pendingLength-=s.length),this._pendingLength+=r instanceof wr?r[Kr].length:r.length,i.set(t,r)}setValid(t,r){return super.setValid(t,r)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}};var xi=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,r,i,s){return t.prep(8,24),t.writeInt64(BigInt(s??0)),t.pad(4),t.writeInt32(i),t.writeInt64(BigInt(r??0)),t.offset()}};var Vt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new Vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||new Vt).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):et.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new pt).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new xi).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,r){let i=this.bb.__offset(this.bb_pos,10);return i?(r||new xi).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,12);return i?(r||new ht).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,et.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}};var W=class{constructor(t=[],r,i,s=et.V5){this.fields=t||[],this.metadata=r||new Map,i||(i=vh(this.fields)),this.dictionaries=i,this.metadataVersion=s}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(", ")} }>`}select(t){let r=new Set(t),i=this.fields.filter(s=>r.has(s.name));return new W(i,this.metadata)}selectAt(t){let r=t.map(i=>this.fields[i]).filter(Boolean);return new W(r,this.metadata)}assign(...t){let r=t[0]instanceof W?t[0]:Array.isArray(t[0])?new W(t[0]):new W(t),i=[...this.fields],s=Oo(Oo(new Map,this.metadata),r.metadata),n=r.fields.filter(a=>{let h=i.findIndex(l=>l.name===a.name);return~h?(i[h]=a.clone({metadata:Oo(Oo(new Map,i[h].metadata),a.metadata)}))&&!1:!0}),o=vh(n,new Map);return new W([...i,...n],s,new Map([...this.dictionaries,...o]))}};W.prototype.fields=null;W.prototype.metadata=null;W.prototype.dictionaries=null;var P=class{static new(...t){let[r,i,s,n]=t;return t[0]&&typeof t[0]=="object"&&({name:r}=t[0],i===void 0&&(i=t[0].type),s===void 0&&(s=t[0].nullable),n===void 0&&(n=t[0].metadata)),new P(`${r}`,i,s,n)}constructor(t,r,i=!1,s){this.name=t,this.type=r,this.nullable=i,this.metadata=s||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[r,i,s,n]=t;return!t[0]||typeof t[0]!="object"?[r=this.name,i=this.type,s=this.nullable,n=this.metadata]=t:{name:r=this.name,type:i=this.type,nullable:s=this.nullable,metadata:n=this.metadata}=t[0],P.new(r,i,s,n)}};P.prototype.type=null;P.prototype.name=null;P.prototype.nullable=null;P.prototype.metadata=null;function Oo(e,t){return new Map([...e||new Map,...t||new Map])}function vh(e,t=new Map){for(let r=-1,i=e.length;++r<i;){let n=e[r].type;if(w.isDictionary(n)){if(!t.has(n.id))t.set(n.id,n.dictionary);else if(t.get(n.id)!==n.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}n.children&&n.children.length>0&&vh(n.children,t)}return t}var qp=Tr,$p=Wt,Nr=class{static decode(t){t=new $p(N(t));let r=Vt.getRootAsFooter(t),i=W.decode(r.schema(),new Map,r.version());return new wh(i,r)}static encode(t){let r=new qp,i=W.encode(r,t.schema);Vt.startRecordBatchesVector(r,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())Ke.encode(r,o);let s=r.endVector();Vt.startDictionariesVector(r,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())Ke.encode(r,o);let n=r.endVector();return Vt.startFooter(r),Vt.addSchema(r,i),Vt.addVersion(r,et.V5),Vt.addRecordBatches(r,s),Vt.addDictionaries(r,n),Vt.finishFooterBuffer(r,Vt.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=et.V5,i,s){this.schema=t,this.version=r,i&&(this._recordBatches=i),s&&(this._dictionaryBatches=s)}*recordBatches(){for(let t,r=-1,i=this.numRecordBatches;++r<i;)(t=this.getRecordBatch(r))&&(yield t)}*dictionaryBatches(){for(let t,r=-1,i=this.numDictionaries;++r<i;)(t=this.getDictionaryBatch(r))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var wh=class extends Nr{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,r){super(t,r.version()),this._footer=r}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let r=this._footer.recordBatches(t);if(r)return Ke.decode(r)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let r=this._footer.dictionaries(t);if(r)return Ke.decode(r)}return null}},Ke=class{static decode(t){return new Ke(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,r){let{metaDataLength:i}=r,s=BigInt(r.offset),n=BigInt(r.bodyLength);return xi.createBlock(t,s,i,n)}constructor(t,r,i){this.metaDataLength=t,this.offset=Y(i),this.bodyLength=Y(r)}};var lt=Object.freeze({done:!0,value:void 0}),Js=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Mi=class{tee(){return this._getDOMStream().tee()}pipe(t,r){return this._getNodeStream().pipe(t,r)}pipeTo(t,r){return this._getDOMStream().pipeTo(t,r)}pipeThrough(t,r){return this._getDOMStream().pipeThrough(t,r)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},Eo=class extends Mi{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return x(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(lt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Lt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Lt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return x(this,void 0,void 0,function*(){return yield this.abort(t),lt})}return(t){return x(this,void 0,void 0,function*(){return yield this.close(),lt})}read(t){return x(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return x(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((r,i)=>{this.resolvers.push({resolve:r,reject:i})}):Promise.resolve(lt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var xr=class extends Eo{write(t){if((t=N(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Us(this.toUint8Array(!0)):this.toUint8Array(!1).then(Us)}toUint8Array(t=!1){return t?_e(this._values)[0]:(()=>x(this,void 0,void 0,function*(){var r,i,s,n;let o=[],a=0;try{for(var h=!0,l=je(this),c;c=yield l.next(),r=c.done,!r;h=!0){n=c.value,h=!1;let u=n;o.push(u),a+=u.byteLength}}catch(u){i={error:u}}finally{try{!h&&!r&&(s=l.return)&&(yield s.call(l))}finally{if(i)throw i.error}}return _e(o,a)[0]}))()}},Mr=class{constructor(t){t&&(this.source=new xh(Lt.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},fe=class{constructor(t){t instanceof fe?this.source=t.source:t instanceof xr?this.source=new Fr(Lt.fromAsyncIterable(t)):Kn(t)?this.source=new Fr(Lt.fromNodeStream(t)):Cs(t)?this.source=new Fr(Lt.fromDOMStream(t)):Jn(t)?this.source=new Fr(Lt.fromDOMStream(t.body)):ke(t)?this.source=new Fr(Lt.fromIterable(t)):Ve(t)?this.source=new Fr(Lt.fromAsyncIterable(t)):Ae(t)&&(this.source=new Fr(Lt.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},xh=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,r="read"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||lt)}return(t){return Object.create(this.source.return&&this.source.return(t)||lt)}},Fr=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return x(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return x(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return x(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return x(this,arguments,void 0,function*(r,i="read"){return yield this.source.next({cmd:i,size:r})})}throw(t){return x(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||lt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return x(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||lt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}};var Xs=class extends Mr{constructor(t,r){super(),this.position=0,this.buffer=N(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:i}=this.readAt(t,4);return new DataView(r,i).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:r,size:i,position:s}=this;return r&&s<i?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(i,s+Math.min(i-s,t)),r.subarray(s,this.position)):null}readAt(t,r){let i=this.buffer,s=Math.min(this.size,t+r);return i?i.subarray(t,s):new Uint8Array(r)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Qr=class extends fe{constructor(t,r){super(),this.position=0,this._handle=t,typeof r=="number"?this.size=r:this._pending=(()=>x(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return x(this,void 0,void 0,function*(){let{buffer:r,byteOffset:i}=yield this.readAt(t,4);return new DataView(r,i).getInt32(0,!0)})}seek(t){return x(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return x(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:i,position:s}=this;if(r&&s<i){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let n=s,o=0,a=0,h=Math.min(i,n+Math.min(i-n,t)),l=new Uint8Array(Math.max(0,(this.position=h)-n));for(;(n+=a)<h&&(o+=a)<l.byteLength;)({bytesRead:a}=yield r.read(l,o,l.byteLength-o,n));return l}return null})}readAt(t,r){return x(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:i,size:s}=this;if(i&&t+r<s){let n=Math.min(s,t+r),o=new Uint8Array(n-t);return(yield i.read(o,0,r,t)).buffer}return new Uint8Array(r)})}close(){return x(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return x(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return x(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var Ih={};$r(Ih,{BaseInt64:()=>Ks,Int128:()=>de,Int64:()=>Ft,Uint64:()=>X});function ys(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var gs=8,Mh=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Ks=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),i=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),s=r[3]*i[3];this.buffer[0]=s&65535;let n=s>>>16;return s=r[2]*i[3],n+=s,s=r[3]*i[2]>>>0,n+=s,this.buffer[0]+=n<<16,this.buffer[1]=n>>>0<s?65536:0,this.buffer[1]+=n>>>16,this.buffer[1]+=r[1]*i[3]+r[2]*i[2]+r[3]*i[1],this.buffer[1]+=r[0]*i[3]+r[1]*i[2]+r[2]*i[1]+r[3]*i[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=r}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${ys(this.buffer[1])} ${ys(this.buffer[0])}`}},X=class extends Ks{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,r=new Uint32Array(2)){return X.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return X.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let i=t.length,s=new X(r);for(let n=0;n<i;){let o=gs<i-n?gs:i-n,a=new X(new Uint32Array([Number.parseInt(t.slice(n,n+o),10),0])),h=new X(new Uint32Array([Mh[o],0]));s.times(h),s.plus(a),n+=o}return s}static convertArray(t){let r=new Uint32Array(t.length*2);for(let i=-1,s=t.length;++i<s;)X.from(t[i],new Uint32Array(r.buffer,r.byteOffset+2*i*4,2));return r}static multiply(t,r){return new X(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new X(new Uint32Array(t.buffer)).plus(r)}},Ft=class extends Ks{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let r=this.buffer[1]<<0,i=t.buffer[1]<<0;return r<i||r===i&&this.buffer[0]<t.buffer[0]}static from(t,r=new Uint32Array(2)){return Ft.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return Ft.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let i=t.startsWith("-"),s=t.length,n=new Ft(r);for(let o=i?1:0;o<s;){let a=gs<s-o?gs:s-o,h=new Ft(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),l=new Ft(new Uint32Array([Mh[a],0]));n.times(l),n.plus(h),o+=a}return i?n.negate():n}static convertArray(t){let r=new Uint32Array(t.length*2);for(let i=-1,s=t.length;++i<s;)Ft.from(t[i],new Uint32Array(r.buffer,r.byteOffset+2*i*4,2));return r}static multiply(t,r){return new Ft(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new Ft(new Uint32Array(t.buffer)).plus(r)}},de=class{constructor(t){this.buffer=t}high(){return new Ft(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Ft(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let r=new X(new Uint32Array([this.buffer[3],0])),i=new X(new Uint32Array([this.buffer[2],0])),s=new X(new Uint32Array([this.buffer[1],0])),n=new X(new Uint32Array([this.buffer[0],0])),o=new X(new Uint32Array([t.buffer[3],0])),a=new X(new Uint32Array([t.buffer[2],0])),h=new X(new Uint32Array([t.buffer[1],0])),l=new X(new Uint32Array([t.buffer[0],0])),c=X.multiply(n,l);this.buffer[0]=c.low();let u=new X(new Uint32Array([c.high(),0]));return c=X.multiply(s,l),u.plus(c),c=X.multiply(n,h),u.plus(c),this.buffer[1]=u.low(),this.buffer[3]=u.lessThan(c)?1:0,this.buffer[2]=u.high(),new X(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(X.multiply(i,l)).plus(X.multiply(s,h)).plus(X.multiply(n,a)),this.buffer[3]+=X.multiply(r,l).plus(X.multiply(i,h)).plus(X.multiply(s,a)).plus(X.multiply(n,o)).low(),this}plus(t){let r=new Uint32Array(4);return r[3]=this.buffer[3]+t.buffer[3]>>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]<this.buffer[0]>>>0&&++r[1],r[1]<this.buffer[1]>>>0&&++r[2],r[2]<this.buffer[2]>>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${ys(this.buffer[3])} ${ys(this.buffer[2])} ${ys(this.buffer[1])} ${ys(this.buffer[0])}`}static multiply(t,r){return new de(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new de(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return de.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return de.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let i=t.startsWith("-"),s=t.length,n=new de(r);for(let o=i?1:0;o<s;){let a=gs<s-o?gs:s-o,h=new de(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),l=new de(new Uint32Array([Mh[a],0,0,0]));n.times(l),n.plus(h),o+=a}return i?n.negate():n}static convertArray(t){let r=new Uint32Array(t.length*4);for(let i=-1,s=t.length;++i<s;)de.from(t[i],new Uint32Array(r.buffer,r.byteOffset+4*4*i,4));return r}};var Zs=class extends B{constructor(t,r,i,s,n=et.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=r,this.buffers=i,this.dictionaries=s,this.metadataVersion=n}visit(t){return super.visit(t instanceof P?t.type:t)}visitNull(t,{length:r}=this.nextFieldNode()){return U({type:t,length:r})}visitBool(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitInt(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFloat(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitUtf8(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDate(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTimestamp(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTime(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDecimal(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitList(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),children:this.visitMany(t.children)})}visitUnion(t,{length:r,nullCount:i}=this.nextFieldNode()){return this.metadataVersion<et.V5&&this.readNullBitmap(t,i),t.mode===at.Sparse?this.visitSparseUnion(t,{length:r,nullCount:i}):this.visitDenseUnion(t,{length:r,nullCount:i})}visitDenseUnion(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDuration(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFixedSizeList(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),child:this.visit(t.children[0])})}visitMap(t,{length:r,nullCount:i}=this.nextFieldNode()){return U({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,r,i=this.nextBufferRange()){return r>0&&this.readData(t,i)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:i}=this.nextBufferRange()){return this.bytes.subarray(i,i+r)}readDictionary(t){return this.dictionaries.get(t.id)}},No=class extends Zs{constructor(t,r,i,s,n){super(new Uint8Array(0),r,i,s,n),this.sources=t}readNullBitmap(t,r,{offset:i}=this.nextBufferRange()){return r<=0?new Uint8Array(0):_i(this.sources[i])}readOffsets(t,{offset:r}=this.nextBufferRange()){return G(Uint8Array,G(t.OffsetArrayType,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return G(Uint8Array,G(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:i}=this;return w.isTimestamp(t)?G(Uint8Array,Ft.convertArray(i[r])):(w.isInt(t)||w.isTime(t))&&t.bitWidth===64||w.isDuration(t)?G(Uint8Array,Ft.convertArray(i[r])):w.isDate(t)&&t.unit===ft.MILLISECOND?G(Uint8Array,Ft.convertArray(i[r])):w.isDecimal(t)?G(Uint8Array,de.convertArray(i[r])):w.isBinary(t)||w.isLargeBinary(t)||w.isFixedSizeBinary(t)?Yp(i[r]):w.isBool(t)?_i(i[r]):w.isUtf8(t)||w.isLargeUtf8(t)?or(i[r].join("")):G(Uint8Array,G(t.ArrayType,i[r].map(s=>+s)))}};function Yp(e){let t=e.join(""),r=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)r[i>>1]=Number.parseInt(t.slice(i,i+2),16);return r}var bs=class extends ue{constructor(t){super(t),this._values=new Xe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,N(r))}_flushPending(t,r){let i=this._offsets,s=this._values.reserve(r).buffer,n=0;for(let[o,a]of t)if(a===void 0)i.set(o,0);else{let h=a.length;s.set(a,n),i.set(o,h),n+=h}}};var _s=class extends ue{constructor(t){super(t),this._values=new Xe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,N(r))}_flushPending(t,r){let i=this._offsets,s=this._values.reserve(r).buffer,n=0;for(let[o,a]of t)if(a===void 0)i.set(o,BigInt(0));else{let h=a.length;s.set(a,n),i.set(o,BigInt(h)),n+=h}}};var Fo=class extends ut{constructor(t){super(t),this._values=new ps}setValue(t,r){this._values.set(t,+r)}};var Ii=class extends Mt{};Ii.prototype._setValue=sh;var Qs=class extends Ii{};Qs.prototype._setValue=no;var tn=class extends Ii{};tn.prototype._setValue=oo;var en=class extends Mt{};en.prototype._setValue=ah;var Lo=class extends ut{constructor({type:t,nullValues:r,dictionaryHashFunction:i}){super({type:new ce(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Ir({type:this.type.indices,nullValues:r}),this.dictionary=Ir({type:this.type.dictionary,nullValues:null}),typeof i=="function"&&(this.valueToKey=i)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,r){let i=this.indices;return r=i.setValid(t,r),this.length=i.length,r}setValue(t,r){let i=this._keysToIndices,s=this.valueToKey(r),n=i[s];return n===void 0&&(i[s]=n=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,n)}flush(){let t=this.type,r=this._dictionary,i=this.dictionary.toVector(),s=this.indices.flush().clone(t);return s.dictionary=r?r.concat(i):i,this.finished||(this._dictionaryOffset+=i.length),this._dictionary=s.dictionary,this.clear(),s}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var rn=class extends Mt{};rn.prototype._setValue=ih;var Ro=class extends ut{setValue(t,r){let[i]=this.children,s=t*this.stride;for(let n=-1,o=r.length;++n<o;)i.set(s+n,r[n])}addChild(t,r="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let i=this.children.push(t);return this.type=new he(this.type.listSize,new P(r,t.type,!0)),i}};var Si=class extends Mt{setValue(t,r){this._values.set(t,r)}},Uo=class extends Si{setValue(t,r){super.setValue(t,Ws(r))}},Co=class extends Si{},Po=class extends Si{};var Bi=class extends Mt{};Bi.prototype._setValue=hh;var sn=class extends Bi{};sn.prototype._setValue=yo;var nn=class extends Bi{};nn.prototype._setValue=go;var Lr=class extends Mt{};Lr.prototype._setValue=lh;var on=class extends Lr{};on.prototype._setValue=bo;var an=class extends Lr{};an.prototype._setValue=_o;var hn=class extends Lr{};hn.prototype._setValue=vo;var ln=class extends Lr{};ln.prototype._setValue=wo;var Re=class extends Mt{setValue(t,r){this._values.set(t,r)}},zo=class extends Re{},jo=class extends Re{},Vo=class extends Re{},ko=class extends Re{},Go=class extends Re{},Wo=class extends Re{},Ho=class extends Re{},qo=class extends Re{};var $o=class extends ue{constructor(t){super(t),this._offsets=new ms(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new ae(new P(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[i]=this.children;for(let[s,n]of t)if(typeof n>"u")r.set(s,0);else{let o=n,a=o.length,h=r.set(s,a).buffer[s];for(let l=-1;++l<a;)i.set(h+l,o[l])}}};var Yo=class extends ue{set(t,r){return super.set(t,r)}setValue(t,r){let i=r instanceof Map?r:new Map(Object.entries(r)),s=this._pending||(this._pending=new Map),n=s.get(t);n&&(this._pendingLength-=n.size),this._pendingLength+=i.size,s.set(t,i)}addChild(t,r=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new le(new P(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[i]=this.children;for(let[s,n]of t)if(n===void 0)r.set(s,0);else{let{[s]:o,[s+1]:a}=r.set(s,n.size).buffer;for(let h of n.entries())if(i.set(o,h),++o>=a)break}}};var Jo=class extends ut{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}};var Xo=class extends ut{setValue(t,r){let{children:i,type:s}=this;switch(Array.isArray(r)||r.constructor){case!0:return s.children.forEach((n,o)=>i[o].set(t,r[o]));case Map:return s.children.forEach((n,o)=>i[o].set(t,r.get(n.name)));default:return s.children.forEach((n,o)=>i[o].set(t,r[n.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(i=>i.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let i=this.children.push(t);return this.type=new Q([...this.type.children,new P(r,t.type,!0)]),i}};var Rr=class extends Mt{};Rr.prototype._setValue=nh;var cn=class extends Rr{};cn.prototype._setValue=ao;var un=class extends Rr{};un.prototype._setValue=ho;var fn=class extends Rr{};fn.prototype._setValue=lo;var dn=class extends Rr{};dn.prototype._setValue=co;var Ur=class extends Mt{};Ur.prototype._setValue=oh;var pn=class extends Ur{};pn.prototype._setValue=uo;var mn=class extends Ur{};mn.prototype._setValue=fo;var yn=class extends Ur{};yn.prototype._setValue=po;var gn=class extends Ur{};gn.prototype._setValue=mo;var vs=class extends ut{constructor(t){super(t),this._typeIds=new Er(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,i){return i===void 0&&(i=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,i),this}setValue(t,r,i){this._typeIds.set(t,i);let s=this.type.typeIdToChildIndex[i],n=this.children[s];n?.set(t,r)}addChild(t,r=`${this.children.length}`){let i=this.children.push(t),{type:{children:s,mode:n,typeIds:o}}=this,a=[...s,new P(r,t.type)];return this.type=new Le(n,[...o,i],a),i}_valueToChildTypeId(t,r,i){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},Ko=class extends vs{},Zo=class extends vs{constructor(t){super(t),this._offsets=new Er(Int32Array)}setValue(t,r,i){let s=this._typeIds.set(t,i).buffer[t],n=this.getChildAt(this.type.typeIdToChildIndex[s]),o=this._offsets.set(t,n.length).buffer[t];n?.set(o,r)}};var bn=class extends ue{constructor(t){super(t),this._values=new Xe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,or(r))}_flushPending(t,r){}};bn.prototype._flushPending=bs.prototype._flushPending;var _n=class extends ue{constructor(t){super(t),this._values=new Xe(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,or(r))}_flushPending(t,r){}};_n.prototype._flushPending=_s.prototype._flushPending;var Sh=class extends B{visitNull(){return Jo}visitBool(){return Fo}visitInt(){return Re}visitInt8(){return zo}visitInt16(){return jo}visitInt32(){return Vo}visitInt64(){return ko}visitUint8(){return Go}visitUint16(){return Wo}visitUint32(){return Ho}visitUint64(){return qo}visitFloat(){return Si}visitFloat16(){return Uo}visitFloat32(){return Co}visitFloat64(){return Po}visitUtf8(){return bn}visitLargeUtf8(){return _n}visitBinary(){return bs}visitLargeBinary(){return _s}visitFixedSizeBinary(){return rn}visitDate(){return Ii}visitDateDay(){return Qs}visitDateMillisecond(){return tn}visitTimestamp(){return Rr}visitTimestampSecond(){return cn}visitTimestampMillisecond(){return un}visitTimestampMicrosecond(){return fn}visitTimestampNanosecond(){return dn}visitTime(){return Ur}visitTimeSecond(){return pn}visitTimeMillisecond(){return mn}visitTimeMicrosecond(){return yn}visitTimeNanosecond(){return gn}visitDecimal(){return en}visitList(){return $o}visitStruct(){return Xo}visitUnion(){return vs}visitDenseUnion(){return Zo}visitSparseUnion(){return Ko}visitDictionary(){return Lo}visitInterval(){return Bi}visitIntervalDayTime(){return sn}visitIntervalYearMonth(){return nn}visitDuration(){return Lr}visitDurationSecond(){return on}visitDurationMillisecond(){return an}visitDurationMicrosecond(){return hn}visitDurationNanosecond(){return ln}visitFixedSizeList(){return Ro}visitMap(){return Yo}},Uc=new Sh;var O=class extends B{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((i,s)=>this.compareFields(i,r[s]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};function $t(e,t){return t instanceof e.constructor}function Ai(e,t){return e===t||$t(e,t)}function Cr(e,t){return e===t||$t(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function Qo(e,t){return e===t||$t(e,t)&&e.precision===t.precision}function Jp(e,t){return e===t||$t(e,t)&&e.byteWidth===t.byteWidth}function Bh(e,t){return e===t||$t(e,t)&&e.unit===t.unit}function vn(e,t){return e===t||$t(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function wn(e,t){return e===t||$t(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function Xp(e,t){return e===t||$t(e,t)&&e.children.length===t.children.length&&Sr.compareManyFields(e.children,t.children)}function Kp(e,t){return e===t||$t(e,t)&&e.children.length===t.children.length&&Sr.compareManyFields(e.children,t.children)}function Ah(e,t){return e===t||$t(e,t)&&e.mode===t.mode&&e.typeIds.every((r,i)=>r===t.typeIds[i])&&Sr.compareManyFields(e.children,t.children)}function Zp(e,t){return e===t||$t(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Sr.visit(e.indices,t.indices)&&Sr.visit(e.dictionary,t.dictionary)}function Dh(e,t){return e===t||$t(e,t)&&e.unit===t.unit}function xn(e,t){return e===t||$t(e,t)&&e.unit===t.unit}function Qp(e,t){return e===t||$t(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Sr.compareManyFields(e.children,t.children)}function tm(e,t){return e===t||$t(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Sr.compareManyFields(e.children,t.children)}O.prototype.visitNull=Ai;O.prototype.visitBool=Ai;O.prototype.visitInt=Cr;O.prototype.visitInt8=Cr;O.prototype.visitInt16=Cr;O.prototype.visitInt32=Cr;O.prototype.visitInt64=Cr;O.prototype.visitUint8=Cr;O.prototype.visitUint16=Cr;O.prototype.visitUint32=Cr;O.prototype.visitUint64=Cr;O.prototype.visitFloat=Qo;O.prototype.visitFloat16=Qo;O.prototype.visitFloat32=Qo;O.prototype.visitFloat64=Qo;O.prototype.visitUtf8=Ai;O.prototype.visitLargeUtf8=Ai;O.prototype.visitBinary=Ai;O.prototype.visitLargeBinary=Ai;O.prototype.visitFixedSizeBinary=Jp;O.prototype.visitDate=Bh;O.prototype.visitDateDay=Bh;O.prototype.visitDateMillisecond=Bh;O.prototype.visitTimestamp=vn;O.prototype.visitTimestampSecond=vn;O.prototype.visitTimestampMillisecond=vn;O.prototype.visitTimestampMicrosecond=vn;O.prototype.visitTimestampNanosecond=vn;O.prototype.visitTime=wn;O.prototype.visitTimeSecond=wn;O.prototype.visitTimeMillisecond=wn;O.prototype.visitTimeMicrosecond=wn;O.prototype.visitTimeNanosecond=wn;O.prototype.visitDecimal=Ai;O.prototype.visitList=Xp;O.prototype.visitStruct=Kp;O.prototype.visitUnion=Ah;O.prototype.visitDenseUnion=Ah;O.prototype.visitSparseUnion=Ah;O.prototype.visitDictionary=Zp;O.prototype.visitInterval=Dh;O.prototype.visitIntervalDayTime=Dh;O.prototype.visitIntervalYearMonth=Dh;O.prototype.visitDuration=xn;O.prototype.visitDurationSecond=xn;O.prototype.visitDurationMillisecond=xn;O.prototype.visitDurationMicrosecond=xn;O.prototype.visitDurationNanosecond=xn;O.prototype.visitFixedSizeList=Qp;O.prototype.visitMap=tm;var Sr=new O;function Di(e,t){return Sr.compareSchemas(e,t)}function Cc(e,t){return Sr.compareFields(e,t)}function Pc(e,t){return Sr.visit(e,t)}function Ir(e){let t=e.type,r=new(Uc.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let i=e.children||[],s={nullValues:e.nullValues},n=Array.isArray(i)?(o,a)=>i[a]||s:({name:o})=>i[o]||s;for(let[o,a]of t.children.entries()){let{type:h}=a,l=n(a,o);r.children.push(Ir(Object.assign(Object.assign({},l),{type:h})))}}return r}function ta(e,t){return em(e,t.map(r=>r.data.concat()))}function em(e,t){let r=[...e.fields],i=[],s={numBatches:t.reduce((u,d)=>Math.max(u,d.length),0)},n=0,o=0,a=-1,h=t.length,l,c=[];for(;s.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<h;)c[a]=l=t[a].shift(),o=Math.min(o,l?l.length:o);Number.isFinite(o)&&(c=rm(r,o,c,t,s),o>0&&(i[n++]=U({type:new Q(r),length:o,nullCount:0,children:c.slice()})))}return[e=e.assign(r),i.map(u=>new rt(e,u))]}function rm(e,t,r,i,s){var n;let o=(t+63&-64)>>3;for(let a=-1,h=i.length;++a<h;){let l=r[a],c=l?.length;if(c>=t)c===t?r[a]=l:(r[a]=l.slice(0,t),s.numBatches=Math.max(s.numBatches,i[a].unshift(l.slice(t,c-t))));else{let u=e[a];e[a]=u.clone({nullable:!0}),r[a]=(n=l?._changeLengthAndBackfillNullBitmap(t))!==null&&n!==void 0?n:U({type:u.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return r}var zc,dt=class{constructor(...t){var r,i;if(t.length===0)return this.batches=[],this.schema=new W([]),this._offsets=[0],this;let s,n;t[0]instanceof W&&(s=t.shift()),t.at(-1)instanceof Uint32Array&&(n=t.pop());let o=h=>{if(h){if(h instanceof rt)return[h];if(h instanceof dt)return h.batches;if(h instanceof q){if(h.type instanceof Q)return[new rt(new W(h.type.children),h)]}else{if(Array.isArray(h))return h.flatMap(l=>o(l));if(typeof h[Symbol.iterator]=="function")return[...h].flatMap(l=>o(l));if(typeof h=="object"){let l=Object.keys(h),c=l.map(p=>new j([h[p]])),u=s??new W(l.map((p,m)=>new P(String(p),c[m].type,c[m].nullable))),[,d]=ta(u,c);return d.length===0?[new rt(h)]:d}}}return[]},a=t.flatMap(h=>o(h));if(s=(i=s??((r=a[0])===null||r===void 0?void 0:r.schema))!==null&&i!==void 0?i:new W([]),!(s instanceof W))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let h of a){if(!(h instanceof rt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Di(s,h.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=s,this.batches=a,this._offsets=n??Bo(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=So(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(yi(t,this.numRows))}set(t,r){}indexOf(t,r){return-1}[Symbol.iterator](){return this.batches.length>0?fs.visit(new j(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
13
|
+
return true;`)}function xm(e){return typeof e!="bigint"?Ye(e):`${Ye(e)}n`}function Th(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function eu(e,t=0){return e.length>=t?e.subarray(0,t):Gs(new e.constructor(t),e,0)}var Ze=class{constructor(t,r=0,i=1){this.length=Math.ceil(r/i),this.buffer=new t(this.length),this.stride=i,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,i=this.length*r,s=this.buffer.length;i>=s&&this._resize(s===0?Th(i*1,this.BYTES_PER_ELEMENT):Th(i*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Th(t*this.stride,this.BYTES_PER_ELEMENT);let r=eu(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=eu(this.buffer,t)}},Lr=class extends Ze{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},gs=class extends Lr{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){let{buffer:i}=this.reserve(t-this.length+1),s=t>>3,n=t%8,o=i[s]>>n&1;return r?o===0&&(i[s]|=1<<n,++this.numValid):o===1&&(i[s]&=~(1<<n),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},_s=class extends Lr{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,r){let i=this.length-1,s=this.reserve(t-i+1).buffer;return i<t++&&i>=0&&s.fill(s[i],i,t),s[t]=s[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var ut=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=Ae(t),this._nulls=new gs,r&&r.length>0&&(this._isValid=tu(r))}toVector(){return new V([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:r,_values:i,_nulls:s,_typeIds:n,children:o}=this;return r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),n&&(t+=n.byteLength),o.reduce((a,h)=>a+h.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((r,i)=>r+i.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,i,s,{type:n,length:o,nullCount:a,_typeIds:h,_offsets:c,_values:l,_nulls:u}=this;(r=h?.flush(o))?s=c?.flush(o):(s=c?.flush(o))?t=l?.flush(c.last()):t=l?.flush(o),a>0&&(i=u?.flush(o));let p=this.children.map(f=>f.flush());return this.clear(),C({type:n,length:o,nullCount:a,children:p,child:p[0],data:t,typeIds:r,nullBitmap:i,valueOffsets:s})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,i,s;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(i=this._offsets)===null||i===void 0||i.clear(),(s=this._typeIds)===null||s===void 0||s.clear();for(let n of this.children)n.clear();return this}};ut.prototype.length=1;ut.prototype.stride=1;ut.prototype.children=null;ut.prototype.finished=!1;ut.prototype.nullValues=null;ut.prototype._isValid=()=>!0;var xt=class extends ut{constructor(t){super(t),this._values=new Lr(this.ArrayType,0,this.stride)}setValue(t,r){let i=this._values;return i.reserve(t-i.length+1),super.setValue(t,r)}},me=class extends ut{constructor(t){super(t),this._pendingLength=0,this._offsets=new _s(t.type)}setValue(t,r){let i=this._pending||(this._pending=new Map),s=i.get(t);s&&(this._pendingLength-=s.length),this._pendingLength+=r instanceof xr?r[Zr].length:r.length,i.set(t,r)}setValid(t,r){return super.setValid(t,r)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}};var Si=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,r,i,s){return t.prep(8,24),t.writeInt64(BigInt(s??0)),t.pad(4),t.writeInt32(i),t.writeInt64(BigInt(r??0)),t.offset()}};var Ht=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new Ht).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||new Ht).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):et.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new mt).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new Si).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,r){let i=this.bb.__offset(this.bb_pos,10);return i?(r||new Si).__init(this.bb.__vector(this.bb_pos+i)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,12);return i?(r||new ct).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,et.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}};var H=class{constructor(t=[],r,i,s=et.V5){this.fields=t||[],this.metadata=r||new Map,i||(i=Dh(this.fields)),this.dictionaries=i,this.metadataVersion=s}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(", ")} }>`}select(t){let r=new Set(t),i=this.fields.filter(s=>r.has(s.name));return new H(i,this.metadata)}selectAt(t){let r=t.map(i=>this.fields[i]).filter(Boolean);return new H(r,this.metadata)}assign(...t){let r=t[0]instanceof H?t[0]:Array.isArray(t[0])?new H(t[0]):new H(t),i=[...this.fields],s=Ro(Ro(new Map,this.metadata),r.metadata),n=r.fields.filter(a=>{let h=i.findIndex(c=>c.name===a.name);return~h?(i[h]=a.clone({metadata:Ro(Ro(new Map,i[h].metadata),a.metadata)}))&&!1:!0}),o=Dh(n,new Map);return new H([...i,...n],s,new Map([...this.dictionaries,...o]))}};H.prototype.fields=null;H.prototype.metadata=null;H.prototype.dictionaries=null;var P=class{static new(...t){let[r,i,s,n]=t;return t[0]&&typeof t[0]=="object"&&({name:r}=t[0],i===void 0&&(i=t[0].type),s===void 0&&(s=t[0].nullable),n===void 0&&(n=t[0].metadata)),new P(`${r}`,i,s,n)}constructor(t,r,i=!1,s){this.name=t,this.type=r,this.nullable=i,this.metadata=s||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[r,i,s,n]=t;return!t[0]||typeof t[0]!="object"?[r=this.name,i=this.type,s=this.nullable,n=this.metadata]=t:{name:r=this.name,type:i=this.type,nullable:s=this.nullable,metadata:n=this.metadata}=t[0],P.new(r,i,s,n)}};P.prototype.type=null;P.prototype.name=null;P.prototype.nullable=null;P.prototype.metadata=null;function Ro(e,t){return new Map([...e||new Map,...t||new Map])}function Dh(e,t=new Map){for(let r=-1,i=e.length;++r<i;){let n=e[r].type;if(w.isDictionary(n)){if(!t.has(n.id))t.set(n.id,n.dictionary);else if(t.get(n.id)!==n.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}n.children&&n.children.length>0&&Dh(n.children,t)}return t}var Im=Nr,Sm=Tt,Fr=class{static decode(t){t=new Sm(O(t));let r=Ht.getRootAsFooter(t),i=H.decode(r.schema(),new Map,r.version());return new Eh(i,r)}static encode(t){let r=new Im,i=H.encode(r,t.schema);Ht.startRecordBatchesVector(r,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())Qe.encode(r,o);let s=r.endVector();Ht.startDictionariesVector(r,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())Qe.encode(r,o);let n=r.endVector();return Ht.startFooter(r),Ht.addSchema(r,i),Ht.addVersion(r,et.V5),Ht.addRecordBatches(r,s),Ht.addDictionaries(r,n),Ht.finishFooterBuffer(r,Ht.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=et.V5,i,s){this.schema=t,this.version=r,i&&(this._recordBatches=i),s&&(this._dictionaryBatches=s)}*recordBatches(){for(let t,r=-1,i=this.numRecordBatches;++r<i;)(t=this.getRecordBatch(r))&&(yield t)}*dictionaryBatches(){for(let t,r=-1,i=this.numDictionaries;++r<i;)(t=this.getDictionaryBatch(r))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var Eh=class extends Fr{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,r){super(t,r.version()),this._footer=r}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let r=this._footer.recordBatches(t);if(r)return Qe.decode(r)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let r=this._footer.dictionaries(t);if(r)return Qe.decode(r)}return null}},Qe=class{static decode(t){return new Qe(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,r){let{metaDataLength:i}=r,s=BigInt(r.offset),n=BigInt(r.bodyLength);return Si.createBlock(t,s,i,n)}constructor(t,r,i){this.metaDataLength=t,this.offset=J(i),this.bodyLength=J(r)}};var vt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||new vt).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):et.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):W.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,12);return i?(r||new ct).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,et.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,W.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt("0"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,i,s,n,o){return vt.startMessage(t),vt.addVersion(t,r),vt.addHeaderType(t,i),vt.addHeader(t,s),vt.addBodyLength(t,n),vt.addCustomMetadata(t,o),vt.endMessage(t)}};var Nh=class extends A{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return yr.startNull(r),yr.endNull(r)}visitInt(t,r){return Ot.startInt(r),Ot.addBitWidth(r,t.bitWidth),Ot.addIsSigned(r,t.isSigned),Ot.endInt(r)}visitFloat(t,r){return ae.startFloatingPoint(r),ae.addPrecision(r,t.precision),ae.endFloatingPoint(r)}visitBinary(t,r){return ur.startBinary(r),ur.endBinary(r)}visitLargeBinary(t,r){return dr.startLargeBinary(r),dr.endLargeBinary(r)}visitBool(t,r){return fr.startBool(r),fr.endBool(r)}visitUtf8(t,r){return _r.startUtf8(r),_r.endUtf8(r)}visitLargeUtf8(t,r){return pr.startLargeUtf8(r),pr.endLargeUtf8(r)}visitDecimal(t,r){return Lt.startDecimal(r),Lt.addScale(r,t.scale),Lt.addPrecision(r,t.precision),Lt.addBitWidth(r,t.bitWidth),Lt.endDecimal(r)}visitDate(t,r){return ie.startDate(r),ie.addUnit(r,t.unit),ie.endDate(r)}visitTime(t,r){return jt.startTime(r),jt.addUnit(r,t.unit),jt.addBitWidth(r,t.bitWidth),jt.endTime(r)}visitTimestamp(t,r){let i=t.timezone&&r.createString(t.timezone)||void 0;return Gt.startTimestamp(r),Gt.addUnit(r,t.unit),i!==void 0&&Gt.addTimezone(r,i),Gt.endTimestamp(r)}visitInterval(t,r){return he.startInterval(r),he.addUnit(r,t.unit),he.endInterval(r)}visitDuration(t,r){return se.startDuration(r),se.addUnit(r,t.unit),se.endDuration(r)}visitList(t,r){return mr.startList(r),mr.endList(r)}visitStruct(t,r){return gr.startStruct_(r),gr.endStruct_(r)}visitUnion(t,r){Ft.startTypeIdsVector(r,t.typeIds.length);let i=Ft.createTypeIdsVector(r,t.typeIds);return Ft.startUnion(r),Ft.addMode(r,t.mode),Ft.addTypeIds(r,i),Ft.endUnion(r)}visitDictionary(t,r){let i=this.visit(t.indices,r);return Me.startDictionaryEncoding(r),Me.addId(r,BigInt(t.id)),Me.addIsOrdered(r,t.isOrdered),i!==void 0&&Me.addIndexType(r,i),Me.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return ne.startFixedSizeBinary(r),ne.addByteWidth(r,t.byteWidth),ne.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return oe.startFixedSizeList(r),oe.addListSize(r,t.listSize),oe.endFixedSizeList(r)}visitMap(t,r){return ce.startMap(r),ce.addKeysSorted(r,t.keysSorted),ce.endMap(r)}},Co=new Nh;function nu(e,t=new Map){return new H(Am(e,t),Uo(e.metadata),t)}function Oh(e){return new St(e.count,au(e.columns),hu(e.columns),null)}function ou(e){return new Wt(Oh(e.data),e.id,e.isDelta)}function Am(e,t){return(e.fields||[]).filter(Boolean).map(r=>P.fromJSON(r,t))}function ru(e,t){return(e.children||[]).filter(Boolean).map(r=>P.fromJSON(r,t))}function au(e){return(e||[]).reduce((t,r)=>[...t,new Ue(r.count,Bm(r.VALIDITY)),...au(r.children)],[])}function hu(e,t=[]){for(let r=-1,i=(e||[]).length;++r<i;){let s=e[r];s.VALIDITY&&t.push(new It(t.length,s.VALIDITY.length)),s.TYPE_ID&&t.push(new It(t.length,s.TYPE_ID.length)),s.OFFSET&&t.push(new It(t.length,s.OFFSET.length)),s.DATA&&t.push(new It(t.length,s.DATA.length)),t=hu(s.children,t)}return t}function Bm(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function cu(e,t){let r,i,s,n,o,a;return!t||!(n=e.dictionary)?(o=su(e,ru(e,t)),s=new P(e.name,o,e.nullable,Uo(e.metadata))):t.has(r=n.id)?(i=(i=n.indexType)?iu(i):new xe,a=new pe(t.get(r),i,r,n.isOrdered),s=new P(e.name,a,e.nullable,Uo(e.metadata))):(i=(i=n.indexType)?iu(i):new xe,t.set(r,o=su(e,ru(e,t))),a=new pe(o,i,r,n.isOrdered),s=new P(e.name,a,e.nullable,Uo(e.metadata))),s||null}function Uo(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function iu(e){return new bt(e.isSigned,e.bitWidth)}function su(e,t){let r=e.type.name;switch(r){case"NONE":return new Rt;case"null":return new Rt;case"binary":return new Oe;case"largebinary":return new br;case"utf8":return new Le;case"largeutf8":return new vr;case"bool":return new Fe;case"list":return new ue((t||[])[0]);case"struct":return new Q(t||[]);case"struct_":return new Q(t||[])}switch(r){case"int":{let i=e.type;return new bt(i.isSigned,i.bitWidth)}case"floatingpoint":{let i=e.type;return new le(st[i.precision])}case"decimal":{let i=e.type;return new Re(i.scale,i.precision,i.bitWidth)}case"date":{let i=e.type;return new Ie(dt[i.unit])}case"time":{let i=e.type;return new Yt(x[i.unit],i.bitWidth)}case"timestamp":{let i=e.type;return new Kt(x[i.unit],i.timezone)}case"interval":{let i=e.type;return new Se(nt[i.unit])}case"duration":{let i=e.type;return new wr(x[i.unit])}case"union":{let i=e.type,[s,...n]=(i.mode+"").toLowerCase(),o=s.toUpperCase()+n.join("");return new Ce(ht[o],i.typeIds||[],t||[])}case"fixedsizebinary":{let i=e.type;return new Mr(i.byteWidth)}case"fixedsizelist":{let i=e.type;return new fe(i.listSize,(t||[])[0])}case"map":{let i=e.type;return new de((t||[])[0],i.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var Tm=Nr,Dm=Tt,At=class{static fromJSON(t,r){let i=new At(0,et.V5,r);return i._createHeader=Em(t,r),i}static decode(t){t=new Dm(O(t));let r=vt.getRootAsMessage(t),i=r.bodyLength(),s=r.version(),n=r.headerType(),o=new At(i,s,n);return o._createHeader=Nm(r,n),o}static encode(t){let r=new Tm,i=-1;return t.isSchema()?i=H.encode(r,t.header()):t.isRecordBatch()?i=St.encode(r,t.header()):t.isDictionaryBatch()&&(i=Wt.encode(r,t.header())),vt.startMessage(r),vt.addVersion(r,et.V5),vt.addHeader(r,i),vt.addHeaderType(r,t.headerType),vt.addBodyLength(r,BigInt(t.bodyLength)),vt.finishMessageBuffer(r,vt.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof H)return new At(0,et.V5,W.Schema,t);if(t instanceof St)return new At(r,et.V5,W.RecordBatch,t);if(t instanceof Wt)return new At(r,et.V5,W.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get compression(){return this._compression}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===W.Schema}isRecordBatch(){return this.headerType===W.RecordBatch}isDictionaryBatch(){return this.headerType===W.DictionaryBatch}constructor(t,r,i,s){this._version=r,this._headerType=i,this.body=new Uint8Array(0),this._compression=s?.compression,s&&(this._createHeader=()=>s),this._bodyLength=J(t)}},St=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}get compression(){return this._compression}constructor(t,r,i,s){this._nodes=r,this._buffers=i,this._length=J(t),this._compression=s}},Wt=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,r,i=!1){this._data=t,this._isDelta=i,this._id=J(r)}},It=class{constructor(t,r){this.offset=J(t),this.length=J(r)}},Ue=class{constructor(t,r){this.length=J(t),this.nullCount=J(r)}},Ai=class{constructor(t,r=ai.BUFFER){this.type=t,this.method=r}};function Em(e,t){return()=>{switch(t){case W.Schema:return H.fromJSON(e);case W.RecordBatch:return St.fromJSON(e);case W.DictionaryBatch:return Wt.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${W[t]}, type: ${t} }`)}}function Nm(e,t){return()=>{switch(t){case W.Schema:return H.decode(e.header(new mt),new Map,e.version());case W.RecordBatch:return St.decode(e.header(new Pt),e.version());case W.DictionaryBatch:return Wt.decode(e.header(new Ne),e.version())}throw new Error(`Unrecognized Message type: { name: ${W[t]}, type: ${t} }`)}}P.encode=jm;P.decode=Vm;P.fromJSON=cu;H.encode=zm;H.decode=Om;H.fromJSON=nu;St.encode=Gm;St.decode=Lm;St.fromJSON=Oh;Wt.encode=Hm;Wt.decode=Fm;Wt.fromJSON=ou;Ue.encode=Wm;Ue.decode=Cm;It.encode=qm;It.decode=Rm;Ai.encode=pu;Ai.decode=du;function Om(e,t=new Map,r=et.V5){let i=km(e,t);return new H(i,Po(e),t,r)}function Lm(e,t=et.V5){return new St(e.length(),Um(e),Pm(e,t),du(e.compression()))}function Fm(e,t=et.V5){return new Wt(St.decode(e.data(),t),e.id(),e.isDelta())}function Rm(e){return new It(e.offset(),e.length())}function Cm(e){return new Ue(e.length(),e.nullCount())}function Um(e){let t=[];for(let r,i=-1,s=-1,n=e.nodesLength();++i<n;)(r=e.nodes(i))&&(t[++s]=Ue.decode(r));return t}function Pm(e,t){let r=[];for(let i,s=-1,n=-1,o=e.buffersLength();++s<o;)(i=e.buffers(s))&&(t<et.V4&&(i.bb_pos+=8*(s+1)),r[++n]=It.decode(i));return r}function km(e,t){let r=[];for(let i,s=-1,n=-1,o=e.fieldsLength();++s<o;)(i=e.fields(s))&&(r[++n]=P.decode(i,t));return r}function lu(e,t){let r=[];for(let i,s=-1,n=-1,o=e.childrenLength();++s<o;)(i=e.children(s))&&(r[++n]=P.decode(i,t));return r}function Vm(e,t){let r,i,s,n,o,a;return!t||!(a=e.dictionary())?(s=fu(e,lu(e,t)),i=new P(e.name(),s,e.nullable(),Po(e))):t.has(r=J(a.id()))?(n=(n=a.indexType())?uu(n):new xe,o=new pe(t.get(r),n,r,a.isOrdered()),i=new P(e.name(),o,e.nullable(),Po(e))):(n=(n=a.indexType())?uu(n):new xe,t.set(r,s=fu(e,lu(e,t))),o=new pe(s,n,r,a.isOrdered()),i=new P(e.name(),o,e.nullable(),Po(e))),i||null}function Po(e){let t=new Map;if(e)for(let r,i,s=-1,n=Math.trunc(e.customMetadataLength());++s<n;)(r=e.customMetadata(s))&&(i=r.key())!=null&&t.set(i,r.value());return t}function uu(e){return new bt(e.isSigned(),e.bitWidth())}function fu(e,t){let r=e.typeType();switch(r){case at.NONE:return new Rt;case at.Null:return new Rt;case at.Binary:return new Oe;case at.LargeBinary:return new br;case at.Utf8:return new Le;case at.LargeUtf8:return new vr;case at.Bool:return new Fe;case at.List:return new ue((t||[])[0]);case at.Struct_:return new Q(t||[])}switch(r){case at.Int:{let i=e.type(new Ot);return new bt(i.isSigned(),i.bitWidth())}case at.FloatingPoint:{let i=e.type(new ae);return new le(i.precision())}case at.Decimal:{let i=e.type(new Lt);return new Re(i.scale(),i.precision(),i.bitWidth())}case at.Date:{let i=e.type(new ie);return new Ie(i.unit())}case at.Time:{let i=e.type(new jt);return new Yt(i.unit(),i.bitWidth())}case at.Timestamp:{let i=e.type(new Gt);return new Kt(i.unit(),i.timezone())}case at.Interval:{let i=e.type(new he);return new Se(i.unit())}case at.Duration:{let i=e.type(new se);return new wr(i.unit())}case at.Union:{let i=e.type(new Ft);return new Ce(i.mode(),i.typeIdsArray()||[],t||[])}case at.FixedSizeBinary:{let i=e.type(new ne);return new Mr(i.byteWidth())}case at.FixedSizeList:{let i=e.type(new oe);return new fe(i.listSize(),(t||[])[0])}case at.Map:{let i=e.type(new ce);return new de((t||[])[0],i.keysSorted())}}throw new Error(`Unrecognized type: "${at[r]}" (${r})`)}function du(e){return e?new Ai(e.codec(),e.method()):null}function zm(e,t){let r=t.fields.map(n=>P.encode(e,n));mt.startFieldsVector(e,r.length);let i=mt.createFieldsVector(e,r),s=t.metadata&&t.metadata.size>0?mt.createCustomMetadataVector(e,[...t.metadata].map(([n,o])=>{let a=e.createString(`${n}`),h=e.createString(`${o}`);return ct.startKeyValue(e),ct.addKey(e,a),ct.addValue(e,h),ct.endKeyValue(e)})):-1;return mt.startSchema(e),mt.addFields(e,i),mt.addEndianness(e,$m?Yr.Little:Yr.Big),s!==-1&&mt.addCustomMetadata(e,s),mt.endSchema(e)}function jm(e,t){let r=-1,i=-1,s=-1,n=t.type,o=t.typeId;w.isDictionary(n)?(o=n.dictionary.typeId,s=Co.visit(n,e),i=Co.visit(n.dictionary,e)):i=Co.visit(n,e);let a=(n.children||[]).map(l=>P.encode(e,l)),h=wt.createChildrenVector(e,a),c=t.metadata&&t.metadata.size>0?wt.createCustomMetadataVector(e,[...t.metadata].map(([l,u])=>{let p=e.createString(`${l}`),f=e.createString(`${u}`);return ct.startKeyValue(e),ct.addKey(e,p),ct.addValue(e,f),ct.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),wt.startField(e),wt.addType(e,i),wt.addTypeType(e,o),wt.addChildren(e,h),wt.addNullable(e,!!t.nullable),r!==-1&&wt.addName(e,r),s!==-1&&wt.addDictionary(e,s),c!==-1&&wt.addCustomMetadata(e,c),wt.endField(e)}function Gm(e,t){let r=t.nodes||[],i=t.buffers||[];Pt.startNodesVector(e,r.length);for(let a of r.slice().reverse())Ue.encode(e,a);let s=e.endVector();Pt.startBuffersVector(e,i.length);for(let a of i.slice().reverse())It.encode(e,a);let n=e.endVector(),o=null;return t.compression!==null&&(o=pu(e,t.compression)),Pt.startRecordBatch(e),Pt.addLength(e,BigInt(t.length)),Pt.addNodes(e,s),Pt.addBuffers(e,n),t.compression!==null&&o&&Pt.addCompression(e,o),Pt.endRecordBatch(e)}function pu(e,t){return zt.startBodyCompression(e),zt.addCodec(e,t.type),zt.addMethod(e,t.method),zt.endBodyCompression(e)}function Hm(e,t){let r=St.encode(e,t.data);return Ne.startDictionaryBatch(e),Ne.addId(e,BigInt(t.id)),Ne.addIsDelta(e,t.isDelta),Ne.addData(e,r),Ne.endDictionaryBatch(e)}function Wm(e,t){return $i.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function qm(e,t){return qi.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var $m=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var lt=Object.freeze({done:!0,value:void 0}),Zs=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Bi=class{tee(){return this._getDOMStream().tee()}pipe(t,r){return this._getNodeStream().pipe(t,r)}pipeTo(t,r){return this._getDOMStream().pipeTo(t,r)}pipeThrough(t,r){return this._getDOMStream().pipeThrough(t,r)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},ko=class extends Bi{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return M(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(lt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Ut.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Ut.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return M(this,void 0,void 0,function*(){return yield this.abort(t),lt})}return(t){return M(this,void 0,void 0,function*(){return yield this.close(),lt})}read(t){return M(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return M(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((r,i)=>{this.resolvers.push({resolve:r,reject:i})}):Promise.resolve(lt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var Ir=class extends ko{write(t){if((t=O(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?zs(this.toUint8Array(!0)):this.toUint8Array(!1).then(zs)}toUint8Array(t=!1){return t?we(this._values)[0]:(()=>M(this,void 0,void 0,function*(){var r,i,s,n;let o=[],a=0;try{for(var h=!0,c=Ge(this),l;l=yield c.next(),r=l.done,!r;h=!0){n=l.value,h=!1;let u=n;o.push(u),a+=u.byteLength}}catch(u){i={error:u}}finally{try{!h&&!r&&(s=c.return)&&(yield s.call(c))}finally{if(i)throw i.error}}return we(o,a)[0]}))()}},Sr=class{constructor(t){t&&(this.source=new Lh(Ut.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},ye=class{constructor(t){t instanceof ye?this.source=t.source:t instanceof Ir?this.source=new Rr(Ut.fromAsyncIterable(t)):eo(t)?this.source=new Rr(Ut.fromNodeStream(t)):js(t)?this.source=new Rr(Ut.fromDOMStream(t)):Qn(t)?this.source=new Rr(Ut.fromDOMStream(t.body)):We(t)?this.source=new Rr(Ut.fromIterable(t)):He(t)?this.source=new Rr(Ut.fromAsyncIterable(t)):De(t)&&(this.source=new Rr(Ut.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},Lh=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,r="read"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||lt)}return(t){return Object.create(this.source.return&&this.source.return(t)||lt)}},Rr=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return M(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return M(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return M(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return M(this,arguments,void 0,function*(r,i="read"){return yield this.source.next({cmd:i,size:r})})}throw(t){return M(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||lt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return M(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||lt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}};var Qs=class extends Sr{constructor(t,r){super(),this.position=0,this.buffer=O(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:i}=this.readAt(t,4);return new DataView(r,i).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:r,size:i,position:s}=this;return r&&s<i?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(i,s+Math.min(i-s,t)),r.subarray(s,this.position)):null}readAt(t,r){let i=this.buffer,s=Math.min(this.size,t+r);return i?i.subarray(t,s):new Uint8Array(r)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},ti=class extends ye{constructor(t,r){super(),this.position=0,this._handle=t,typeof r=="number"?this.size=r:this._pending=(()=>M(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return M(this,void 0,void 0,function*(){let{buffer:r,byteOffset:i}=yield this.readAt(t,4);return new DataView(r,i).getInt32(0,!0)})}seek(t){return M(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return M(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:i,position:s}=this;if(r&&s<i){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let n=s,o=0,a=0,h=Math.min(i,n+Math.min(i-n,t)),c=new Uint8Array(Math.max(0,(this.position=h)-n));for(;(n+=a)<h&&(o+=a)<c.byteLength;)({bytesRead:a}=yield r.read(c,o,c.byteLength-o,n));return c}return null})}readAt(t,r){return M(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:i,size:s}=this;if(i&&t+r<s){let n=Math.min(s,t+r),o=new Uint8Array(n-t);return(yield i.read(o,0,r,t)).buffer}return new Uint8Array(r)})}close(){return M(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return M(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return M(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var Rh={};Dr(Rh,{BaseInt64:()=>tn,Int128:()=>ge,Int64:()=>Ct,Uint64:()=>X});function bs(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var vs=8,Fh=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],tn=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),i=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),s=r[3]*i[3];this.buffer[0]=s&65535;let n=s>>>16;return s=r[2]*i[3],n+=s,s=r[3]*i[2]>>>0,n+=s,this.buffer[0]+=n<<16,this.buffer[1]=n>>>0<s?65536:0,this.buffer[1]+=n>>>16,this.buffer[1]+=r[1]*i[3]+r[2]*i[2]+r[3]*i[1],this.buffer[1]+=r[0]*i[3]+r[1]*i[2]+r[2]*i[1]+r[3]*i[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=r}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${bs(this.buffer[1])} ${bs(this.buffer[0])}`}},X=class extends tn{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,r=new Uint32Array(2)){return X.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return X.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let i=t.length,s=new X(r);for(let n=0;n<i;){let o=vs<i-n?vs:i-n,a=new X(new Uint32Array([Number.parseInt(t.slice(n,n+o),10),0])),h=new X(new Uint32Array([Fh[o],0]));s.times(h),s.plus(a),n+=o}return s}static convertArray(t){let r=new Uint32Array(t.length*2);for(let i=-1,s=t.length;++i<s;)X.from(t[i],new Uint32Array(r.buffer,r.byteOffset+2*i*4,2));return r}static multiply(t,r){return new X(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new X(new Uint32Array(t.buffer)).plus(r)}},Ct=class extends tn{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let r=this.buffer[1]<<0,i=t.buffer[1]<<0;return r<i||r===i&&this.buffer[0]<t.buffer[0]}static from(t,r=new Uint32Array(2)){return Ct.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return Ct.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let i=t.startsWith("-"),s=t.length,n=new Ct(r);for(let o=i?1:0;o<s;){let a=vs<s-o?vs:s-o,h=new Ct(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),c=new Ct(new Uint32Array([Fh[a],0]));n.times(c),n.plus(h),o+=a}return i?n.negate():n}static convertArray(t){let r=new Uint32Array(t.length*2);for(let i=-1,s=t.length;++i<s;)Ct.from(t[i],new Uint32Array(r.buffer,r.byteOffset+2*i*4,2));return r}static multiply(t,r){return new Ct(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new Ct(new Uint32Array(t.buffer)).plus(r)}},ge=class{constructor(t){this.buffer=t}high(){return new Ct(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Ct(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let r=new X(new Uint32Array([this.buffer[3],0])),i=new X(new Uint32Array([this.buffer[2],0])),s=new X(new Uint32Array([this.buffer[1],0])),n=new X(new Uint32Array([this.buffer[0],0])),o=new X(new Uint32Array([t.buffer[3],0])),a=new X(new Uint32Array([t.buffer[2],0])),h=new X(new Uint32Array([t.buffer[1],0])),c=new X(new Uint32Array([t.buffer[0],0])),l=X.multiply(n,c);this.buffer[0]=l.low();let u=new X(new Uint32Array([l.high(),0]));return l=X.multiply(s,c),u.plus(l),l=X.multiply(n,h),u.plus(l),this.buffer[1]=u.low(),this.buffer[3]=u.lessThan(l)?1:0,this.buffer[2]=u.high(),new X(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(X.multiply(i,c)).plus(X.multiply(s,h)).plus(X.multiply(n,a)),this.buffer[3]+=X.multiply(r,c).plus(X.multiply(i,h)).plus(X.multiply(s,a)).plus(X.multiply(n,o)).low(),this}plus(t){let r=new Uint32Array(4);return r[3]=this.buffer[3]+t.buffer[3]>>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]<this.buffer[0]>>>0&&++r[1],r[1]<this.buffer[1]>>>0&&++r[2],r[2]<this.buffer[2]>>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${bs(this.buffer[3])} ${bs(this.buffer[2])} ${bs(this.buffer[1])} ${bs(this.buffer[0])}`}static multiply(t,r){return new ge(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new ge(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return ge.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return ge.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let i=t.startsWith("-"),s=t.length,n=new ge(r);for(let o=i?1:0;o<s;){let a=vs<s-o?vs:s-o,h=new ge(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),c=new ge(new Uint32Array([Fh[a],0,0,0]));n.times(c),n.plus(h),o+=a}return i?n.negate():n}static convertArray(t){let r=new Uint32Array(t.length*4);for(let i=-1,s=t.length;++i<s;)ge.from(t[i],new Uint32Array(r.buffer,r.byteOffset+4*4*i,4));return r}};var Ph={};Dr(Ph,{toIntervalDayTimeInt32Array:()=>Ch,toIntervalDayTimeObjects:()=>Jm,toIntervalMonthDayNanoInt32Array:()=>Uh,toIntervalMonthDayNanoObjects:()=>Ym});function Ch(e){var t,r;let i=e.length,s=new Int32Array(i*2);for(let n=0,o=0;n<i;n++){let a=e[n];s[o++]=(t=a.days)!==null&&t!==void 0?t:0,s[o++]=(r=a.milliseconds)!==null&&r!==void 0?r:0}return s}function Uh(e){var t,r;let i=e.length,s=new Int32Array(i*4);for(let n=0,o=0;n<i;n++){let a=e[n];s[o++]=(t=a.months)!==null&&t!==void 0?t:0,s[o++]=(r=a.days)!==null&&r!==void 0?r:0;let h=a.nanoseconds;h?(s[o++]=Number(BigInt(h)&BigInt(4294967295)),s[o++]=Number(BigInt(h)>>BigInt(32))):o+=2}return s}function Jm(e){let t=e.length,r=new Array(t/2);for(let i=0,s=0;i<t;i+=2)r[s++]={days:e[i],milliseconds:e[i+1]};return r}function Ym(e,t){let r=e.length,i=new Array(r/4);for(let s=0,n=0;s<r;s+=4){let o=BigInt(e[s+3])<<BigInt(32)|BigInt(e[s+2]>>>0);i[n++]={months:e[s],days:e[s+1],nanoseconds:t?`${o}`:o}}return i}var ws=class extends A{constructor(t,r,i,s,n=et.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=r,this.buffers=i,this.dictionaries=s,this.metadataVersion=n}visit(t){return super.visit(t instanceof P?t.type:t)}visitNull(t,{length:r}=this.nextFieldNode()){return C({type:t,length:r})}visitBool(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitInt(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFloat(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitUtf8(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDate(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTimestamp(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitTime(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDecimal(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitList(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),children:this.visitMany(t.children)})}visitUnion(t,{length:r,nullCount:i}=this.nextFieldNode()){return this.metadataVersion<et.V5&&this.readNullBitmap(t,i),t.mode===ht.Sparse?this.visitSparseUnion(t,{length:r,nullCount:i}):this.visitDenseUnion(t,{length:r,nullCount:i})}visitDenseUnion(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitDuration(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),data:this.readData(t)})}visitFixedSizeList(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),child:this.visit(t.children[0])})}visitMap(t,{length:r,nullCount:i}=this.nextFieldNode()){return C({type:t,length:r,nullCount:i,nullBitmap:this.readNullBitmap(t,i),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,r,i=this.nextBufferRange()){return r>0&&this.readData(t,i)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:i}=this.nextBufferRange()){return this.bytes.subarray(i,i+r)}readDictionary(t){return this.dictionaries.get(t.id)}},Vo=class extends ws{constructor(t,r,i,s,n){super(new Uint8Array(0),r,i,s,n),this.sources=t}readNullBitmap(t,r,{offset:i}=this.nextBufferRange()){return r<=0?new Uint8Array(0):Mi(this.sources[i])}readOffsets(t,{offset:r}=this.nextBufferRange()){return G(Uint8Array,G(t.OffsetArrayType,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return G(Uint8Array,G(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:i}=this;if(w.isTimestamp(t))return G(Uint8Array,Ct.convertArray(i[r]));if((w.isInt(t)||w.isTime(t))&&t.bitWidth===64||w.isDuration(t))return G(Uint8Array,Ct.convertArray(i[r]));if(w.isDate(t)&&t.unit===dt.MILLISECOND)return G(Uint8Array,Ct.convertArray(i[r]));if(w.isDecimal(t))return G(Uint8Array,ge.convertArray(i[r]));if(w.isBinary(t)||w.isLargeBinary(t)||w.isFixedSizeBinary(t))return Km(i[r]);if(w.isBool(t))return Mi(i[r]);if(w.isUtf8(t)||w.isLargeUtf8(t))return hr(i[r].join(""));if(w.isInterval(t))switch(t.unit){case nt.DAY_TIME:return Ch(i[r]);case nt.MONTH_DAY_NANO:return Uh(i[r]);default:break}return G(Uint8Array,G(t.ArrayType,i[r].map(s=>+s)))}};function Km(e){let t=e.join(""),r=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)r[i>>1]=Number.parseInt(t.slice(i,i+2),16);return r}var zo=class extends ws{constructor(t,r,i,s,n){super(new Uint8Array(0),r,i,s,n),this.bodyChunks=t}readData(t,r=this.nextBufferRange()){return this.bodyChunks[this.buffersIndex]}};var Ms=class extends me{constructor(t){super(t),this._values=new Ze(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,O(r))}_flushPending(t,r){let i=this._offsets,s=this._values.reserve(r).buffer,n=0;for(let[o,a]of t)if(a===void 0)i.set(o,0);else{let h=a.length;s.set(a,n),i.set(o,h),n+=h}}};var xs=class extends me{constructor(t){super(t),this._values=new Ze(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,O(r))}_flushPending(t,r){let i=this._offsets,s=this._values.reserve(r).buffer,n=0;for(let[o,a]of t)if(a===void 0)i.set(o,BigInt(0));else{let h=a.length;s.set(a,n),i.set(o,BigInt(h)),n+=h}}};var jo=class extends ut{constructor(t){super(t),this._values=new gs}setValue(t,r){this._values.set(t,+r)}};var Ti=class extends xt{};Ti.prototype._setValue=dh;var en=class extends Ti{};en.prototype._setValue=co;var rn=class extends Ti{};rn.prototype._setValue=lo;var sn=class extends xt{};sn.prototype._setValue=yh;var Go=class extends ut{constructor({type:t,nullValues:r,dictionaryHashFunction:i}){super({type:new pe(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Ar({type:this.type.indices,nullValues:r}),this.dictionary=Ar({type:this.type.dictionary,nullValues:null}),typeof i=="function"&&(this.valueToKey=i)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,r){let i=this.indices;return r=i.setValid(t,r),this.length=i.length,r}setValue(t,r){let i=this._keysToIndices,s=this.valueToKey(r),n=i[s];return n===void 0&&(i[s]=n=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,n)}flush(){let t=this.type,r=this._dictionary,i=this.dictionary.toVector(),s=this.indices.flush().clone(t);return s.dictionary=r?r.concat(i):i,this.finished||(this._dictionaryOffset+=i.length),this._dictionary=s.dictionary,this.clear(),s}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var nn=class extends xt{};nn.prototype._setValue=fh;var Ho=class extends ut{setValue(t,r){let[i]=this.children,s=t*this.stride;for(let n=-1,o=this.stride;++n<o;)i.set(s+n,r[n])}setValid(t,r){return super.setValid(t,r)||this.children[0].setValid((t+1)*this.stride-1,!1),r}addChild(t,r="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let i=this.children.push(t);return this.type=new fe(this.type.listSize,new P(r,t.type,!0)),i}};var Di=class extends xt{setValue(t,r){this._values.set(t,r)}},Wo=class extends Di{setValue(t,r){super.setValue(t,$s(r))}},qo=class extends Di{},$o=class extends Di{};var ei=class extends xt{};ei.prototype._setValue=gh;var on=class extends ei{};on.prototype._setValue=vo;var an=class extends ei{};an.prototype._setValue=wo;var hn=class extends ei{};hn.prototype._setValue=Mo;var Cr=class extends xt{};Cr.prototype._setValue=_h;var cn=class extends Cr{};cn.prototype._setValue=xo;var ln=class extends Cr{};ln.prototype._setValue=Io;var un=class extends Cr{};un.prototype._setValue=So;var fn=class extends Cr{};fn.prototype._setValue=Ao;var Pe=class extends xt{setValue(t,r){this._values.set(t,r)}},Jo=class extends Pe{},Yo=class extends Pe{},Ko=class extends Pe{},Xo=class extends Pe{},Zo=class extends Pe{},Qo=class extends Pe{},ta=class extends Pe{},ea=class extends Pe{};var ra=class extends me{constructor(t){super(t),this._offsets=new _s(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new ue(new P(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[i]=this.children;for(let[s,n]of t)if(typeof n>"u")r.set(s,0);else{let o=n,a=o.length,h=r.set(s,a).buffer[s];for(let c=-1;++c<a;)i.set(h+c,o[c])}}};var ia=class extends me{set(t,r){return super.set(t,r)}setValue(t,r){let i=r instanceof Map?r:new Map(Object.entries(r)),s=this._pending||(this._pending=new Map),n=s.get(t);n&&(this._pendingLength-=n.size),this._pendingLength+=i.size,s.set(t,i)}addChild(t,r=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new de(new P(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[i]=this.children;for(let[s,n]of t)if(n===void 0)r.set(s,0);else{let{[s]:o,[s+1]:a}=r.set(s,n.size).buffer;for(let h of n.entries())if(i.set(o,h),++o>=a)break}}};var sa=class extends ut{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}};var na=class extends ut{setValue(t,r){let{children:i,type:s}=this;switch(Array.isArray(r)||r.constructor){case!0:return s.children.forEach((n,o)=>i[o].set(t,r[o]));case Map:return s.children.forEach((n,o)=>i[o].set(t,r.get(n.name)));default:return s.children.forEach((n,o)=>i[o].set(t,r[n.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(i=>i.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let i=this.children.push(t);return this.type=new Q([...this.type.children,new P(r,t.type,!0)]),i}};var Ur=class extends xt{};Ur.prototype._setValue=ph;var dn=class extends Ur{};dn.prototype._setValue=uo;var pn=class extends Ur{};pn.prototype._setValue=fo;var mn=class extends Ur{};mn.prototype._setValue=po;var yn=class extends Ur{};yn.prototype._setValue=mo;var Pr=class extends xt{};Pr.prototype._setValue=mh;var gn=class extends Pr{};gn.prototype._setValue=yo;var _n=class extends Pr{};_n.prototype._setValue=go;var bn=class extends Pr{};bn.prototype._setValue=_o;var vn=class extends Pr{};vn.prototype._setValue=bo;var Is=class extends ut{constructor(t){super(t),this._typeIds=new Lr(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,i){return i===void 0&&(i=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,i),this}setValue(t,r,i){this._typeIds.set(t,i);let s=this.type.typeIdToChildIndex[i],n=this.children[s];n?.set(t,r),this.length=Math.max(t+1,this.length)}addChild(t,r=`${this.children.length}`){let i=this.children.push(t),{type:{children:s,mode:n,typeIds:o}}=this,a=[...s,new P(r,t.type)];return this.type=new Ce(n,[...o,i],a),i}_valueToChildTypeId(t,r,i){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},oa=class extends Is{},aa=class extends Is{constructor(t){super(t),this._offsets=new Lr(Int32Array)}setValue(t,r,i){let s=this._typeIds.set(t,i).buffer[t],n=this.getChildAt(this.type.typeIdToChildIndex[s]),o=this._offsets.set(t,n.length).buffer[t];n?.set(o,r),this.length=Math.max(t+1,this.length)}};var wn=class extends me{constructor(t){super(t),this._values=new Ze(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,hr(r))}_flushPending(t,r){}};wn.prototype._flushPending=Ms.prototype._flushPending;var Mn=class extends me{constructor(t){super(t),this._values=new Ze(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,hr(r))}_flushPending(t,r){}};Mn.prototype._flushPending=xs.prototype._flushPending;var kh=class extends A{visitNull(){return sa}visitBool(){return jo}visitInt(){return Pe}visitInt8(){return Jo}visitInt16(){return Yo}visitInt32(){return Ko}visitInt64(){return Xo}visitUint8(){return Zo}visitUint16(){return Qo}visitUint32(){return ta}visitUint64(){return ea}visitFloat(){return Di}visitFloat16(){return Wo}visitFloat32(){return qo}visitFloat64(){return $o}visitUtf8(){return wn}visitLargeUtf8(){return Mn}visitBinary(){return Ms}visitLargeBinary(){return xs}visitFixedSizeBinary(){return nn}visitDate(){return Ti}visitDateDay(){return en}visitDateMillisecond(){return rn}visitTimestamp(){return Ur}visitTimestampSecond(){return dn}visitTimestampMillisecond(){return pn}visitTimestampMicrosecond(){return mn}visitTimestampNanosecond(){return yn}visitTime(){return Pr}visitTimeSecond(){return gn}visitTimeMillisecond(){return _n}visitTimeMicrosecond(){return bn}visitTimeNanosecond(){return vn}visitDecimal(){return sn}visitList(){return ra}visitStruct(){return na}visitUnion(){return Is}visitDenseUnion(){return aa}visitSparseUnion(){return oa}visitDictionary(){return Go}visitInterval(){return ei}visitIntervalDayTime(){return on}visitIntervalYearMonth(){return an}visitIntervalMonthDayNano(){return hn}visitDuration(){return Cr}visitDurationSecond(){return cn}visitDurationMillisecond(){return ln}visitDurationMicrosecond(){return un}visitDurationNanosecond(){return fn}visitFixedSizeList(){return Ho}visitMap(){return ia}},yu=new kh;var E=class extends A{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((i,s)=>this.compareFields(i,r[s]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};function Xt(e,t){return t instanceof e.constructor}function Ei(e,t){return e===t||Xt(e,t)}function kr(e,t){return e===t||Xt(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function ha(e,t){return e===t||Xt(e,t)&&e.precision===t.precision}function Xm(e,t){return e===t||Xt(e,t)&&e.byteWidth===t.byteWidth}function Vh(e,t){return e===t||Xt(e,t)&&e.unit===t.unit}function xn(e,t){return e===t||Xt(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function In(e,t){return e===t||Xt(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function Zm(e,t){return e===t||Xt(e,t)&&e.children.length===t.children.length&&Br.compareManyFields(e.children,t.children)}function Qm(e,t){return e===t||Xt(e,t)&&e.children.length===t.children.length&&Br.compareManyFields(e.children,t.children)}function zh(e,t){return e===t||Xt(e,t)&&e.mode===t.mode&&e.typeIds.every((r,i)=>r===t.typeIds[i])&&Br.compareManyFields(e.children,t.children)}function ty(e,t){return e===t||Xt(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Br.visit(e.indices,t.indices)&&Br.visit(e.dictionary,t.dictionary)}function ca(e,t){return e===t||Xt(e,t)&&e.unit===t.unit}function Sn(e,t){return e===t||Xt(e,t)&&e.unit===t.unit}function ey(e,t){return e===t||Xt(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Br.compareManyFields(e.children,t.children)}function ry(e,t){return e===t||Xt(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Br.compareManyFields(e.children,t.children)}E.prototype.visitNull=Ei;E.prototype.visitBool=Ei;E.prototype.visitInt=kr;E.prototype.visitInt8=kr;E.prototype.visitInt16=kr;E.prototype.visitInt32=kr;E.prototype.visitInt64=kr;E.prototype.visitUint8=kr;E.prototype.visitUint16=kr;E.prototype.visitUint32=kr;E.prototype.visitUint64=kr;E.prototype.visitFloat=ha;E.prototype.visitFloat16=ha;E.prototype.visitFloat32=ha;E.prototype.visitFloat64=ha;E.prototype.visitUtf8=Ei;E.prototype.visitLargeUtf8=Ei;E.prototype.visitBinary=Ei;E.prototype.visitLargeBinary=Ei;E.prototype.visitFixedSizeBinary=Xm;E.prototype.visitDate=Vh;E.prototype.visitDateDay=Vh;E.prototype.visitDateMillisecond=Vh;E.prototype.visitTimestamp=xn;E.prototype.visitTimestampSecond=xn;E.prototype.visitTimestampMillisecond=xn;E.prototype.visitTimestampMicrosecond=xn;E.prototype.visitTimestampNanosecond=xn;E.prototype.visitTime=In;E.prototype.visitTimeSecond=In;E.prototype.visitTimeMillisecond=In;E.prototype.visitTimeMicrosecond=In;E.prototype.visitTimeNanosecond=In;E.prototype.visitDecimal=Ei;E.prototype.visitList=Zm;E.prototype.visitStruct=Qm;E.prototype.visitUnion=zh;E.prototype.visitDenseUnion=zh;E.prototype.visitSparseUnion=zh;E.prototype.visitDictionary=ty;E.prototype.visitInterval=ca;E.prototype.visitIntervalDayTime=ca;E.prototype.visitIntervalYearMonth=ca;E.prototype.visitIntervalMonthDayNano=ca;E.prototype.visitDuration=Sn;E.prototype.visitDurationSecond=Sn;E.prototype.visitDurationMillisecond=Sn;E.prototype.visitDurationMicrosecond=Sn;E.prototype.visitDurationNanosecond=Sn;E.prototype.visitFixedSizeList=ey;E.prototype.visitMap=ry;var Br=new E;function Ni(e,t){return Br.compareSchemas(e,t)}function gu(e,t){return Br.compareFields(e,t)}function _u(e,t){return Br.visit(e,t)}function Ar(e){let t=e.type,r=new(yu.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let i=e.children||[],s={nullValues:e.nullValues},n=Array.isArray(i)?(o,a)=>i[a]||s:({name:o})=>i[o]||s;for(let[o,a]of t.children.entries()){let{type:h}=a,c=n(a,o);r.children.push(Ar(Object.assign(Object.assign({},c),{type:h})))}}return r}function la(e,t){return iy(e,t.map(r=>r.data.concat()))}function iy(e,t){let r=[...e.fields],i=[],s={numBatches:t.reduce((u,p)=>Math.max(u,p.length),0)},n=0,o=0,a=-1,h=t.length,c,l=[];for(;s.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<h;)l[a]=c=t[a].shift(),o=Math.min(o,c?c.length:o);Number.isFinite(o)&&(l=sy(r,o,l,t,s),o>0&&(i[n++]=C({type:new Q(r),length:o,nullCount:0,children:l.slice()})))}return[e=e.assign(r),i.map(u=>new rt(e,u))]}function sy(e,t,r,i,s){var n;let o=(t+63&-64)>>3;for(let a=-1,h=i.length;++a<h;){let c=r[a],l=c?.length;if(l>=t)l===t?r[a]=c:(r[a]=c.slice(0,t),s.numBatches=Math.max(s.numBatches,i[a].unshift(c.slice(t,l-t))));else{let u=e[a];e[a]=u.clone({nullable:!0}),r[a]=(n=c?._changeLengthAndBackfillNullBitmap(t))!==null&&n!==void 0?n:C({type:u.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return r}var bu,pt=class{constructor(...t){var r,i;if(t.length===0)return this.batches=[],this.schema=new H([]),this._offsets=[0],this;let s,n;t[0]instanceof H&&(s=t.shift()),t.at(-1)instanceof Uint32Array&&(n=t.pop());let o=h=>{if(h){if(h instanceof rt)return[h];if(h instanceof pt)return h.batches;if(h instanceof q){if(h.type instanceof Q)return[new rt(new H(h.type.children),h)]}else{if(Array.isArray(h))return h.flatMap(c=>o(c));if(typeof h[Symbol.iterator]=="function")return[...h].flatMap(c=>o(c));if(typeof h=="object"){let c=Object.keys(h),l=c.map(f=>new V([h[f]])),u=s??new H(c.map((f,m)=>new P(String(f),l[m].type,l[m].nullable))),[,p]=la(u,l);return p.length===0?[new rt(h)]:p}}}return[]},a=t.flatMap(h=>o(h));if(s=(i=s??((r=a[0])===null||r===void 0?void 0:r.schema))!==null&&i!==void 0?i:new H([]),!(s instanceof H))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let h of a){if(!(h instanceof rt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Ni(s,h.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=s,this.batches=a,this._offsets=n??No(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=Eo(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(bi(t,this.numRows))}set(t,r){}indexOf(t,r){return-1}[Symbol.iterator](){return this.batches.length>0?ms.visit(new V(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
14
14
|
${this.toArray().join(`,
|
|
15
15
|
`)}
|
|
16
|
-
]`}concat(...t){let r=this.schema,i=this.data.concat(t.flatMap(({data:s})=>s));return new dt(r,i.map(s=>new rt(r,s)))}slice(t,r){let i=this.schema;[t,r]=Hs({length:this.numRows},t,r);let s=Ao(this.data,this._offsets,t,r);return new dt(i,s.map(n=>new rt(i,n)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let r=this.data.map(i=>i.children[t]);if(r.length===0){let{type:i}=this.schema.fields[t],s=U({type:i,length:0,nullCount:0});r.push(s._changeLengthAndBackfillNullBitmap(this.numRows))}return new j(r)}return null}setChild(t,r){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(s=>s.name===t),r)}setChildAt(t,r){let i=this.schema,s=[...this.batches];if(t>-1&&t<this.numCols){r||(r=new j([U({type:new Nt,length:this.numRows})]));let n=i.fields.slice(),o=n[t].clone({type:r.type}),a=this.schema.fields.map((h,l)=>this.getChildAt(l));[n[t],a[t]]=[o,r],[i,s]=ta(i,a)}return new dt(i,s)}select(t){let r=this.schema.fields.reduce((i,s,n)=>i.set(s.name,n),new Map);return this.selectAt(t.map(i=>r.get(i)).filter(i=>i>-1))}selectAt(t){let r=this.schema.selectAt(t),i=this.batches.map(s=>s.selectAt(t));return new dt(r,i)}assign(t){let r=this.schema.fields,[i,s]=t.schema.fields.reduce((a,h,l)=>{let[c,u]=a,d=r.findIndex(p=>p.name===h.name);return~d?u[d]=l:c.push(l),a},[[],[]]),n=this.schema.assign(t.schema),o=[...r.map((a,h)=>[h,s[h]]).map(([a,h])=>h===void 0?this.getChildAt(a):t.getChildAt(h)),...i.map(a=>t.getChildAt(a))].filter(Boolean);return new dt(...ta(n,o))}};zc=Symbol.toStringTag;dt[zc]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=us(Ys),e.get=us(xt.getVisitFn(f.Struct)),e.set=Do(Rt.getVisitFn(f.Struct)),e.indexOf=To(wi.getVisitFn(f.Struct)),"Table"))(dt.prototype);var Vc,rt=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof W))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=U({nullCount:0,type:new Q(this.schema.fields),children:this.schema.fields.map(r=>U({type:r.type,nullCount:0}))})]=t,!(this.data instanceof q))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=jc(this.schema,this.data.children);break}case 1:{let[r]=t,{fields:i,children:s,length:n}=Object.keys(r).reduce((h,l,c)=>(h.children[c]=r[l],h.length=Math.max(h.length,r[l].length),h.fields[c]=P.new({name:l,type:r[l].type,nullable:!0}),h),{length:0,fields:new Array,children:new Array}),o=new W(i),a=U({type:new Q(i),length:n,children:s,nullCount:0});[this.schema,this.data]=jc(o,a.children,n);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=kc(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return xt.visit(this.data,t)}at(t){return this.get(yi(t,this.numRows))}set(t,r){return Rt.visit(this.data,t,r)}indexOf(t,r){return wi.visit(this.data,t,r)}[Symbol.iterator](){return fs.visit(new j([this.data]))}toArray(){return[...this]}concat(...t){return new dt(this.schema,[this,...t])}slice(t,r){let[i]=new j([this.data]).slice(t,r).data;return new rt(this.schema,i)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new j([this.data.children[t]]):null}setChild(t,r){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(s=>s.name===t),r)}setChildAt(t,r){let i=this.schema,s=this.data;if(t>-1&&t<this.numCols){r||(r=new j([U({type:new Nt,length:this.numRows})]));let n=i.fields.slice(),o=s.children.slice(),a=n[t].clone({type:r.type});[n[t],o[t]]=[a,r.data[0]],i=new W(n,new Map(this.schema.metadata)),s=U({type:new Q(n),children:o})}return new rt(i,s)}select(t){let r=this.schema.select(t),i=new Q(r.fields),s=[];for(let n of t){let o=this.schema.fields.findIndex(a=>a.name===n);~o&&(s[o]=this.data.children[o])}return new rt(r,U({type:i,length:this.numRows,children:s}))}selectAt(t){let r=this.schema.selectAt(t),i=t.map(n=>this.data.children[n]).filter(Boolean),s=U({type:new Q(r.fields),length:this.numRows,children:i});return new rt(r,s)}};Vc=Symbol.toStringTag;rt[Vc]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(rt.prototype);function jc(e,t,r=t.reduce((i,s)=>Math.max(i,s.length),0)){var i;let s=[...e.fields],n=[...t],o=(r+63&-64)>>3;for(let[a,h]of e.fields.entries()){let l=t[a];(!l||l.length!==r)&&(s[a]=h.clone({nullable:!0}),n[a]=(i=l?._changeLengthAndBackfillNullBitmap(r))!==null&&i!==void 0?i:U({type:h.type,length:r,nullCount:r,nullBitmap:new Uint8Array(o)}))}return[e.assign(s),U({type:new Q(s),length:r,children:n})]}function kc(e,t,r=new Map){var i,s;if(((i=e?.length)!==null&&i!==void 0?i:0)>0&&e?.length===t?.length)for(let n=-1,o=e.length;++n<o;){let{type:a}=e[n],h=t[n];for(let l of[h,...((s=h?.dictionary)===null||s===void 0?void 0:s.data)||[]])kc(a.children,l?.children,r);if(w.isDictionary(a)){let{id:l}=a;if(!r.has(l))h?.dictionary&&r.set(l,h.dictionary);else if(r.get(l)!==h.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return r}var Ti=class extends rt{constructor(t){let r=t.fields.map(s=>U({type:s.type})),i=U({type:new Q(t.fields),nullCount:0,children:r});super(t,i)}};var vt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||new vt).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):et.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):H.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,r){let i=this.bb.__offset(this.bb_pos,12);return i?(r||new ht).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,et.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,H.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt("0"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let i=r.length-1;i>=0;i--)t.addOffset(r[i]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,i,s,n,o){return vt.startMessage(t),vt.addVersion(t,r),vt.addHeaderType(t,i),vt.addHeader(t,s),vt.addBodyLength(t,n),vt.addCustomMetadata(t,o),vt.endMessage(t)}};var Th=class extends B{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return pr.startNull(r),pr.endNull(r)}visitInt(t,r){return Tt.startInt(r),Tt.addBitWidth(r,t.bitWidth),Tt.addIsSigned(r,t.isSigned),Tt.endInt(r)}visitFloat(t,r){return ie.startFloatingPoint(r),ie.addPrecision(r,t.precision),ie.endFloatingPoint(r)}visitBinary(t,r){return lr.startBinary(r),lr.endBinary(r)}visitLargeBinary(t,r){return ur.startLargeBinary(r),ur.endLargeBinary(r)}visitBool(t,r){return cr.startBool(r),cr.endBool(r)}visitUtf8(t,r){return yr.startUtf8(r),yr.endUtf8(r)}visitLargeUtf8(t,r){return fr.startLargeUtf8(r),fr.endLargeUtf8(r)}visitDecimal(t,r){return Ot.startDecimal(r),Ot.addScale(r,t.scale),Ot.addPrecision(r,t.precision),Ot.addBitWidth(r,t.bitWidth),Ot.endDecimal(r)}visitDate(t,r){return Qt.startDate(r),Qt.addUnit(r,t.unit),Qt.endDate(r)}visitTime(t,r){return zt.startTime(r),zt.addUnit(r,t.unit),zt.addBitWidth(r,t.bitWidth),zt.endTime(r)}visitTimestamp(t,r){let i=t.timezone&&r.createString(t.timezone)||void 0;return jt.startTimestamp(r),jt.addUnit(r,t.unit),i!==void 0&&jt.addTimezone(r,i),jt.endTimestamp(r)}visitInterval(t,r){return se.startInterval(r),se.addUnit(r,t.unit),se.endInterval(r)}visitDuration(t,r){return te.startDuration(r),te.addUnit(r,t.unit),te.endDuration(r)}visitList(t,r){return dr.startList(r),dr.endList(r)}visitStruct(t,r){return mr.startStruct_(r),mr.endStruct_(r)}visitUnion(t,r){Et.startTypeIdsVector(r,t.typeIds.length);let i=Et.createTypeIdsVector(r,t.typeIds);return Et.startUnion(r),Et.addMode(r,t.mode),Et.addTypeIds(r,i),Et.endUnion(r)}visitDictionary(t,r){let i=this.visit(t.indices,r);return ve.startDictionaryEncoding(r),ve.addId(r,BigInt(t.id)),ve.addIsOrdered(r,t.isOrdered),i!==void 0&&ve.addIndexType(r,i),ve.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return ee.startFixedSizeBinary(r),ee.addByteWidth(r,t.byteWidth),ee.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return re.startFixedSizeList(r),re.addListSize(r,t.listSize),re.endFixedSizeList(r)}visitMap(t,r){return ne.startMap(r),ne.addKeysSorted(r,t.keysSorted),ne.endMap(r)}},ea=new Th;function qc(e,t=new Map){return new W(sm(e,t),ra(e.metadata),t)}function Oh(e){return new Ut(e.count,Yc(e.columns),Jc(e.columns))}function $c(e){return new me(Oh(e.data),e.id,e.isDelta)}function sm(e,t){return(e.fields||[]).filter(Boolean).map(r=>P.fromJSON(r,t))}function Gc(e,t){return(e.children||[]).filter(Boolean).map(r=>P.fromJSON(r,t))}function Yc(e){return(e||[]).reduce((t,r)=>[...t,new Ue(r.count,nm(r.VALIDITY)),...Yc(r.children)],[])}function Jc(e,t=[]){for(let r=-1,i=(e||[]).length;++r<i;){let s=e[r];s.VALIDITY&&t.push(new pe(t.length,s.VALIDITY.length)),s.TYPE_ID&&t.push(new pe(t.length,s.TYPE_ID.length)),s.OFFSET&&t.push(new pe(t.length,s.OFFSET.length)),s.DATA&&t.push(new pe(t.length,s.DATA.length)),t=Jc(s.children,t)}return t}function nm(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function Xc(e,t){let r,i,s,n,o,a;return!t||!(n=e.dictionary)?(o=Hc(e,Gc(e,t)),s=new P(e.name,o,e.nullable,ra(e.metadata))):t.has(r=n.id)?(i=(i=n.indexType)?Wc(i):new we,a=new ce(t.get(r),i,r,n.isOrdered),s=new P(e.name,a,e.nullable,ra(e.metadata))):(i=(i=n.indexType)?Wc(i):new we,t.set(r,o=Hc(e,Gc(e,t))),a=new ce(o,i,r,n.isOrdered),s=new P(e.name,a,e.nullable,ra(e.metadata))),s||null}function ra(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function Wc(e){return new _t(e.isSigned,e.bitWidth)}function Hc(e,t){let r=e.type.name;switch(r){case"NONE":return new Nt;case"null":return new Nt;case"binary":return new Oe;case"largebinary":return new gr;case"utf8":return new Ee;case"largeutf8":return new br;case"bool":return new Ne;case"list":return new ae((t||[])[0]);case"struct":return new Q(t||[]);case"struct_":return new Q(t||[])}switch(r){case"int":{let i=e.type;return new _t(i.isSigned,i.bitWidth)}case"floatingpoint":{let i=e.type;return new oe(st[i.precision])}case"decimal":{let i=e.type;return new Fe(i.scale,i.precision,i.bitWidth)}case"date":{let i=e.type;return new xe(ft[i.unit])}case"time":{let i=e.type;return new Ht(M[i.unit],i.bitWidth)}case"timestamp":{let i=e.type;return new qt(M[i.unit],i.timezone)}case"interval":{let i=e.type;return new Me(bt[i.unit])}case"duration":{let i=e.type;return new _r(M[i.unit])}case"union":{let i=e.type,[s,...n]=(i.mode+"").toLowerCase(),o=s.toUpperCase()+n.join("");return new Le(at[o],i.typeIds||[],t||[])}case"fixedsizebinary":{let i=e.type;return new vr(i.byteWidth)}case"fixedsizelist":{let i=e.type;return new he(i.listSize,(t||[])[0])}case"map":{let i=e.type;return new le((t||[])[0],i.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var om=Tr,am=Wt,It=class{static fromJSON(t,r){let i=new It(0,et.V5,r);return i._createHeader=hm(t,r),i}static decode(t){t=new am(N(t));let r=vt.getRootAsMessage(t),i=r.bodyLength(),s=r.version(),n=r.headerType(),o=new It(i,s,n);return o._createHeader=lm(r,n),o}static encode(t){let r=new om,i=-1;return t.isSchema()?i=W.encode(r,t.header()):t.isRecordBatch()?i=Ut.encode(r,t.header()):t.isDictionaryBatch()&&(i=me.encode(r,t.header())),vt.startMessage(r),vt.addVersion(r,et.V5),vt.addHeader(r,i),vt.addHeaderType(r,t.headerType),vt.addBodyLength(r,BigInt(t.bodyLength)),vt.finishMessageBuffer(r,vt.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof W)return new It(0,et.V5,H.Schema,t);if(t instanceof Ut)return new It(r,et.V5,H.RecordBatch,t);if(t instanceof me)return new It(r,et.V5,H.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===H.Schema}isRecordBatch(){return this.headerType===H.RecordBatch}isDictionaryBatch(){return this.headerType===H.DictionaryBatch}constructor(t,r,i,s){this._version=r,this._headerType=i,this.body=new Uint8Array(0),s&&(this._createHeader=()=>s),this._bodyLength=Y(t)}},Ut=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,r,i){this._nodes=r,this._buffers=i,this._length=Y(t)}},me=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,r,i=!1){this._data=t,this._isDelta=i,this._id=Y(r)}},pe=class{constructor(t,r){this.offset=Y(t),this.length=Y(r)}},Ue=class{constructor(t,r){this.length=Y(t),this.nullCount=Y(r)}};function hm(e,t){return()=>{switch(t){case H.Schema:return W.fromJSON(e);case H.RecordBatch:return Ut.fromJSON(e);case H.DictionaryBatch:return me.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${H[t]}, type: ${t} }`)}}function lm(e,t){return()=>{switch(t){case H.Schema:return W.decode(e.header(new pt),new Map,e.version());case H.RecordBatch:return Ut.decode(e.header(new Pt),e.version());case H.DictionaryBatch:return me.decode(e.header(new Te),e.version())}throw new Error(`Unrecognized Message type: { name: ${H[t]}, type: ${t} }`)}}P.encode=vm;P.decode=bm;P.fromJSON=Xc;W.encode=_m;W.decode=cm;W.fromJSON=qc;Ut.encode=wm;Ut.decode=um;Ut.fromJSON=Oh;me.encode=xm;me.decode=fm;me.fromJSON=$c;Ue.encode=Mm;Ue.decode=pm;pe.encode=Im;pe.decode=dm;function cm(e,t=new Map,r=et.V5){let i=gm(e,t);return new W(i,ia(e),t,r)}function um(e,t=et.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new Ut(e.length(),mm(e),ym(e,t))}function fm(e,t=et.V5){return new me(Ut.decode(e.data(),t),e.id(),e.isDelta())}function dm(e){return new pe(e.offset(),e.length())}function pm(e){return new Ue(e.length(),e.nullCount())}function mm(e){let t=[];for(let r,i=-1,s=-1,n=e.nodesLength();++i<n;)(r=e.nodes(i))&&(t[++s]=Ue.decode(r));return t}function ym(e,t){let r=[];for(let i,s=-1,n=-1,o=e.buffersLength();++s<o;)(i=e.buffers(s))&&(t<et.V4&&(i.bb_pos+=8*(s+1)),r[++n]=pe.decode(i));return r}function gm(e,t){let r=[];for(let i,s=-1,n=-1,o=e.fieldsLength();++s<o;)(i=e.fields(s))&&(r[++n]=P.decode(i,t));return r}function Kc(e,t){let r=[];for(let i,s=-1,n=-1,o=e.childrenLength();++s<o;)(i=e.children(s))&&(r[++n]=P.decode(i,t));return r}function bm(e,t){let r,i,s,n,o,a;return!t||!(a=e.dictionary())?(s=Qc(e,Kc(e,t)),i=new P(e.name(),s,e.nullable(),ia(e))):t.has(r=Y(a.id()))?(n=(n=a.indexType())?Zc(n):new we,o=new ce(t.get(r),n,r,a.isOrdered()),i=new P(e.name(),o,e.nullable(),ia(e))):(n=(n=a.indexType())?Zc(n):new we,t.set(r,s=Qc(e,Kc(e,t))),o=new ce(s,n,r,a.isOrdered()),i=new P(e.name(),o,e.nullable(),ia(e))),i||null}function ia(e){let t=new Map;if(e)for(let r,i,s=-1,n=Math.trunc(e.customMetadataLength());++s<n;)(r=e.customMetadata(s))&&(i=r.key())!=null&&t.set(i,r.value());return t}function Zc(e){return new _t(e.isSigned(),e.bitWidth())}function Qc(e,t){let r=e.typeType();switch(r){case ot.NONE:return new Nt;case ot.Null:return new Nt;case ot.Binary:return new Oe;case ot.LargeBinary:return new gr;case ot.Utf8:return new Ee;case ot.LargeUtf8:return new br;case ot.Bool:return new Ne;case ot.List:return new ae((t||[])[0]);case ot.Struct_:return new Q(t||[])}switch(r){case ot.Int:{let i=e.type(new Tt);return new _t(i.isSigned(),i.bitWidth())}case ot.FloatingPoint:{let i=e.type(new ie);return new oe(i.precision())}case ot.Decimal:{let i=e.type(new Ot);return new Fe(i.scale(),i.precision(),i.bitWidth())}case ot.Date:{let i=e.type(new Qt);return new xe(i.unit())}case ot.Time:{let i=e.type(new zt);return new Ht(i.unit(),i.bitWidth())}case ot.Timestamp:{let i=e.type(new jt);return new qt(i.unit(),i.timezone())}case ot.Interval:{let i=e.type(new se);return new Me(i.unit())}case ot.Duration:{let i=e.type(new te);return new _r(i.unit())}case ot.Union:{let i=e.type(new Et);return new Le(i.mode(),i.typeIdsArray()||[],t||[])}case ot.FixedSizeBinary:{let i=e.type(new ee);return new vr(i.byteWidth())}case ot.FixedSizeList:{let i=e.type(new re);return new he(i.listSize(),(t||[])[0])}case ot.Map:{let i=e.type(new ne);return new le((t||[])[0],i.keysSorted())}}throw new Error(`Unrecognized type: "${ot[r]}" (${r})`)}function _m(e,t){let r=t.fields.map(n=>P.encode(e,n));pt.startFieldsVector(e,r.length);let i=pt.createFieldsVector(e,r),s=t.metadata&&t.metadata.size>0?pt.createCustomMetadataVector(e,[...t.metadata].map(([n,o])=>{let a=e.createString(`${n}`),h=e.createString(`${o}`);return ht.startKeyValue(e),ht.addKey(e,a),ht.addValue(e,h),ht.endKeyValue(e)})):-1;return pt.startSchema(e),pt.addFields(e,i),pt.addEndianness(e,Sm?Yr.Little:Yr.Big),s!==-1&&pt.addCustomMetadata(e,s),pt.endSchema(e)}function vm(e,t){let r=-1,i=-1,s=-1,n=t.type,o=t.typeId;w.isDictionary(n)?(o=n.dictionary.typeId,s=ea.visit(n,e),i=ea.visit(n.dictionary,e)):i=ea.visit(n,e);let a=(n.children||[]).map(c=>P.encode(e,c)),h=wt.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?wt.createCustomMetadataVector(e,[...t.metadata].map(([c,u])=>{let d=e.createString(`${c}`),p=e.createString(`${u}`);return ht.startKeyValue(e),ht.addKey(e,d),ht.addValue(e,p),ht.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),wt.startField(e),wt.addType(e,i),wt.addTypeType(e,o),wt.addChildren(e,h),wt.addNullable(e,!!t.nullable),r!==-1&&wt.addName(e,r),s!==-1&&wt.addDictionary(e,s),l!==-1&&wt.addCustomMetadata(e,l),wt.endField(e)}function wm(e,t){let r=t.nodes||[],i=t.buffers||[];Pt.startNodesVector(e,r.length);for(let o of r.slice().reverse())Ue.encode(e,o);let s=e.endVector();Pt.startBuffersVector(e,i.length);for(let o of i.slice().reverse())pe.encode(e,o);let n=e.endVector();return Pt.startRecordBatch(e),Pt.addLength(e,BigInt(t.length)),Pt.addNodes(e,s),Pt.addBuffers(e,n),Pt.endRecordBatch(e)}function xm(e,t){let r=Ut.encode(e,t.data);return Te.startDictionaryBatch(e),Te.addId(e,BigInt(t.id)),Te.addIsDelta(e,t.isDelta),Te.addData(e,r),Te.endDictionaryBatch(e)}function Mm(e,t){return Wi.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function Im(e,t){return Gi.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var Sm=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var Nh=e=>`Expected ${H[e]} Message in stream, but was null or length 0.`,Fh=e=>`Header pointer of flatbuffer-encoded ${H[e]} Message is null or length 0.`,tu=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,eu=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,ws=class{constructor(t){this.source=t instanceof Mr?t:new Mr(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?lt:t.value===-1&&(t=this.readMetadataLength()).done?lt:(t=this.readMetadata(t.value)).done?lt:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(Nh(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=N(this.source.read(t));if(r.byteLength<t)throw new Error(eu(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()}readSchema(t=!1){let r=H.Schema,i=this.readMessage(r),s=i?.header();if(t&&!s)throw new Error(Fh(r));return s}readMetadataLength(){let t=this.source.read(sa),r=t&&new Wt(t),i=r?.readInt32(0)||0;return{done:i===0,value:i}}readMetadata(t){let r=this.source.read(t);if(!r)return lt;if(r.byteLength<t)throw new Error(tu(t,r.byteLength));return{done:!1,value:It.decode(r)}}},Mn=class{constructor(t,r){this.source=t instanceof fe?t:Yn(t)?new Qr(t,r):new fe(t)}[Symbol.asyncIterator](){return this}next(){return x(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?lt:t.value===-1&&(t=yield this.readMetadataLength()).done?lt:(t=yield this.readMetadata(t.value)).done?lt:t})}throw(t){return x(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return x(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return x(this,void 0,void 0,function*(){let r;if((r=yield this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(Nh(t));return r.value})}readMessageBody(t){return x(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let r=N(yield this.source.read(t));if(r.byteLength<t)throw new Error(eu(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()})}readSchema(){return x(this,arguments,void 0,function*(t=!1){let r=H.Schema,i=yield this.readMessage(r),s=i?.header();if(t&&!s)throw new Error(Fh(r));return s})}readMetadataLength(){return x(this,void 0,void 0,function*(){let t=yield this.source.read(sa),r=t&&new Wt(t),i=r?.readInt32(0)||0;return{done:i===0,value:i}})}readMetadata(t){return x(this,void 0,void 0,function*(){let r=yield this.source.read(t);if(!r)return lt;if(r.byteLength<t)throw new Error(tu(t,r.byteLength));return{done:!1,value:It.decode(r)}})}},In=class extends ws{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Js?t:new Js(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:It.fromJSON(t.schema,H.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let r=t.dictionaries[this._dictionaryIndex++];return this._body=r.data.columns,{done:!1,value:It.fromJSON(r,H.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let r=t.batches[this._batchIndex++];return this._body=r.columns,{done:!1,value:It.fromJSON(r,H.RecordBatch)}}return this._body=[],lt}readMessageBody(t){return r(this._body);function r(i){return(i||[]).reduce((s,n)=>[...s,...n.VALIDITY&&[n.VALIDITY]||[],...n.TYPE_ID&&[n.TYPE_ID]||[],...n.OFFSET&&[n.OFFSET]||[],...n.DATA&&[n.DATA]||[],...r(n.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(Nh(t));return r.value}readSchema(){let t=H.Schema,r=this.readMessage(t),i=r?.header();if(!r||!i)throw new Error(Fh(t));return i}},sa=4,Eh="ARROW1",xs=new Uint8Array(Eh.length);for(let e=0;e<Eh.length;e+=1)xs[e]=Eh.codePointAt(e);function na(e,t=0){for(let r=-1,i=xs.length;++r<i;)if(xs[r]!==e[t+r])return!1;return!0}var Ms=xs.length,Lh=Ms+sa,ru=Ms*2+sa;var Yt=class extends Mi{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let r=this._impl.open(t);return Ve(r)?r.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Lt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Lt.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof Yt?t:qn(t)?Am(t):Yn(t)?Om(t):Ve(t)?(()=>x(this,void 0,void 0,function*(){return yield Yt.from(yield t)}))():Jn(t)||Cs(t)||Kn(t)||Ae(t)?Tm(new fe(t)):Dm(new Mr(t))}static readAll(t){return t instanceof Yt?t.isSync()?iu(t):su(t):qn(t)||ArrayBuffer.isView(t)||ke(t)||$n(t)?iu(t):su(t)}},Pr=class extends Yt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return be(this,arguments,function*(){yield k(yield*Vi(je(this[Symbol.iterator]())))})}},Oi=class extends Yt{constructor(t){super(t),this._impl=t}readAll(){return x(this,void 0,void 0,function*(){var t,r,i,s;let n=new Array;try{for(var o=!0,a=je(this),h;h=yield a.next(),t=h.done,!t;o=!0){s=h.value,o=!1;let l=s;n.push(l)}}catch(l){r={error:l}}finally{try{!o&&!t&&(i=a.return)&&(yield i.call(a))}finally{if(r)throw r.error}}return n})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Ei=class extends Pr{constructor(t){super(t),this._impl=t}},oa=class extends Oi{constructor(t){super(t),this._impl=t}},aa=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,r){let i=this._loadVectors(t,r,this.schema.fields),s=U({type:new Q(this.schema.fields),length:t.length,children:i});return new rt(this.schema,s)}_loadDictionaryBatch(t,r){let{id:i,isDelta:s}=t,{dictionaries:n,schema:o}=this,a=n.get(i),h=o.dictionaries.get(i),l=this._loadVectors(t.data,r,[h]);return(a&&s?a.concat(new j(l)):new j(l)).memoize()}_loadVectors(t,r,i){return new Zs(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}},Is=class extends aa{constructor(t,r){super(r),this._reader=qn(t)?new In(this._handle=t):new ws(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=nu(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):lt}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):lt}next(){if(this.closed)return lt;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),s=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),s=r.readMessageBody(t.bodyLength),n=this._loadDictionaryBatch(i,s);this.dictionaries.set(i.id,n)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Ti(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Ss=class extends aa{constructor(t,r){super(r),this._reader=new Mn(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return x(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return x(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=nu(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return x(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):lt})}return(t){return x(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):lt})}next(){return x(this,void 0,void 0,function*(){if(this.closed)return lt;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),s=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),s=yield r.readMessageBody(t.bodyLength),n=this._loadDictionaryBatch(i,s);this.dictionaries.set(i.id,n)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Ti(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return x(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},ha=class extends Is{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,r){super(t instanceof Xs?t:new Xs(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(i&&this._handle.seek(i.offset)){let s=this._reader.readMessage(H.RecordBatch);if(s?.isRecordBatch()){let n=s.header(),o=this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(n,o)}}return null}_readDictionaryBatch(t){var r;let i=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(i&&this._handle.seek(i.offset)){let s=this._reader.readMessage(H.DictionaryBatch);if(s?.isDictionaryBatch()){let n=s.header(),o=this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(n,o);this.dictionaries.set(n.id,a)}}}_readFooter(){let{_handle:t}=this,r=t.size-Lh,i=t.readInt32(r),s=t.readAt(r-i,i);return Nr.decode(s)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(this._recordBatchIndex);if(i&&this._handle.seek(i.offset))return this._reader.readMessage(t)}return null}},Rh=class extends Ss{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...r){let i=typeof r[0]!="number"?r.shift():void 0,s=r[0]instanceof Map?r.shift():void 0;super(t instanceof Qr?t:new Qr(t,i),s)}isFile(){return!0}isAsync(){return!0}open(t){let r=Object.create(null,{open:{get:()=>super.open}});return x(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let i of this._footer.dictionaryBatches())i&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){return x(this,void 0,void 0,function*(){var r;if(this.closed)return null;this._footer||(yield this.open());let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(i&&(yield this._handle.seek(i.offset))){let s=yield this._reader.readMessage(H.RecordBatch);if(s?.isRecordBatch()){let n=s.header(),o=yield this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(n,o)}}return null})}_readDictionaryBatch(t){return x(this,void 0,void 0,function*(){var r;let i=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(i&&(yield this._handle.seek(i.offset))){let s=yield this._reader.readMessage(H.DictionaryBatch);if(s?.isDictionaryBatch()){let n=s.header(),o=yield this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(n,o);this.dictionaries.set(n.id,a)}}})}_readFooter(){return x(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-Lh,i=yield t.readInt32(r),s=yield t.readAt(r-i,i);return Nr.decode(s)})}_readNextMessageAndValidate(t){return x(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=this._footer.getRecordBatch(this._recordBatchIndex);if(r&&(yield this._handle.seek(r.offset)))return yield this._reader.readMessage(t)}return null})}},Uh=class extends Is{constructor(t,r){super(t,r)}_loadVectors(t,r,i){return new No(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}};function nu(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*iu(e){let t=Yt.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function su(e){return be(this,arguments,function*(){let r=yield k(Yt.from(e));try{if(!(yield k(r.open({autoDestroy:!1}))).closed)do yield yield k(r);while(!(yield k(r.reset().open())).closed)}finally{yield k(r.cancel())}})}function Am(e){return new Pr(new Uh(e))}function Dm(e){let t=e.peek(Ms+7&-8);return t&&t.byteLength>=4?na(t)?new Ei(new ha(e.read())):new Pr(new Is(e)):new Pr(new Is(function*(){}()))}function Tm(e){return x(this,void 0,void 0,function*(){let t=yield e.peek(Ms+7&-8);return t&&t.byteLength>=4?na(t)?new Ei(new ha(yield e.read())):new Oi(new Ss(e)):new Oi(new Ss(function(){return be(this,arguments,function*(){})}()))})}function Om(e){return x(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new Qr(e,t);return t>=ru&&na(yield r.readAt(0,Ms+7&-8))?new oa(new Rh(r)):new Oi(new Ss(r))})}var ct=class extends B{static assemble(...t){let r=s=>s.flatMap(n=>Array.isArray(n)?r(n):n instanceof rt?n.data.children:n.data),i=new ct;return i.visitMany(r(t)),i}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof j)return this.visitMany(t.data),this;let{type:r}=t;if(!w.isDictionary(r)){let{length:i}=t;if(i>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(w.isUnion(r))this.nodes.push(new Ue(i,0));else{let{nullCount:s}=t;w.isNull(r)||Ze.call(this,s<=0?new Uint8Array(0):bi(t.offset,i,t.nullBitmap)),this.nodes.push(new Ue(i,s))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function Ze(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new pe(this._byteLength,t)),this._byteLength+=t,this}function Em(e){var t;let{type:r,length:i,typeIds:s,valueOffsets:n}=e;if(Ze.call(this,s),r.mode===at.Sparse)return Ch.call(this,e);if(r.mode===at.Dense){if(e.offset<=0)return Ze.call(this,n),Ch.call(this,e);{let o=new Int32Array(i),a=Object.create(null),h=Object.create(null);for(let l,c,u=-1;++u<i;)(l=s[u])!==void 0&&((c=a[l])===void 0&&(c=a[l]=n[u]),o[u]=n[u]-c,h[l]=((t=h[l])!==null&&t!==void 0?t:0)+1);Ze.call(this,o),this.visitMany(e.children.map((l,c)=>{let u=r.typeIds[c],d=a[u],p=h[u];return l.slice(d,Math.min(i,p))}))}}return this}function Nm(e){let t;return e.nullCount>=e.length?Ze.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Ze.call(this,bi(e.offset,e.length,t)):Ze.call(this,_i(e.values))}function zr(e){return Ze.call(this,e.values.subarray(0,e.length*e.stride))}function la(e){let{length:t,values:r,valueOffsets:i}=e,s=Y(i[0]),n=Y(i[t]),o=Math.min(n-s,r.byteLength-s);return Ze.call(this,Qn(-s,t+1,i)),Ze.call(this,r.subarray(s,s+o)),this}function Ph(e){let{length:t,valueOffsets:r}=e;if(r){let{[0]:i,[t]:s}=r;return Ze.call(this,Qn(-i,t+1,r)),this.visit(e.children[0].slice(i,s-i))}return this.visit(e.children[0])}function Ch(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}ct.prototype.visitBool=Nm;ct.prototype.visitInt=zr;ct.prototype.visitFloat=zr;ct.prototype.visitUtf8=la;ct.prototype.visitLargeUtf8=la;ct.prototype.visitBinary=la;ct.prototype.visitLargeBinary=la;ct.prototype.visitFixedSizeBinary=zr;ct.prototype.visitDate=zr;ct.prototype.visitTimestamp=zr;ct.prototype.visitTime=zr;ct.prototype.visitDecimal=zr;ct.prototype.visitList=Ph;ct.prototype.visitStruct=Ch;ct.prototype.visitUnion=Em;ct.prototype.visitInterval=zr;ct.prototype.visitDuration=zr;ct.prototype.visitFixedSizeList=Ph;ct.prototype.visitMap=Ph;var Ni=class extends Mi{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new xr,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,Gt(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Ve(t)?t.then(r=>this.writeAll(r)):Ae(t)?jh(this,t):zh(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,r=null){return t===this._sink||t instanceof xr?this._sink=t:(this._sink=new xr,t&&wl(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&xl(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!r||!Di(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof dt&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof rt&&!(r=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!Di(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof rt?t instanceof Ti||this._writeRecordBatch(t):t instanceof dt?this.writeAll(t.batches):ke(t)&&this.writeAll(t)}_writeMessage(t,r=8){let i=r-1,s=It.encode(t),n=s.byteLength,o=this._writeLegacyIpcFormat?4:8,a=n+o+i&~i,h=a-n-o;return t.headerType===H.RecordBatch?this._recordBatchBlocks.push(new Ke(a,t.bodyLength,this._position)):t.headerType===H.DictionaryBatch&&this._dictionaryBlocks.push(new Ke(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),n>0&&this._write(s),this._writePadding(h)}_write(t){if(this._started){let r=N(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(It.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(xs)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:i,bufferRegions:s,buffers:n}=ct.assemble(t),o=new Ut(t.numRows,i,s),a=It.from(o,r);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(n)}_writeDictionaryBatch(t,r,i=!1){let{byteLength:s,nodes:n,bufferRegions:o,buffers:a}=ct.assemble(new j([t])),h=new Ut(t.length,n,o),l=new me(h,r,i),c=It.from(l,s);return this._writeMessage(c)._writeBodyBuffers(a)}_writeBodyBuffers(t){let r,i,s;for(let n=-1,o=t.length;++n<o;)(r=t[n])&&(i=r.byteLength)>0&&(this._write(r),(s=(i+7&-8)-i)>0&&this._writePadding(s));return this}_writeDictionaries(t){var r,i;for(let[s,n]of t.dictionaries){let o=(r=n?.data)!==null&&r!==void 0?r:[],a=this._seenDictionaries.get(s),h=(i=this._dictionaryDeltaOffsets.get(s))!==null&&i!==void 0?i:0;if(!a||a.data[0]!==o[0])for(let[l,c]of o.entries())this._writeDictionaryBatch(c,s,l>0);else if(h<o.length)for(let l of o.slice(h))this._writeDictionaryBatch(l,s,!0);this._seenDictionaries.set(s,n),this._dictionaryDeltaOffsets.set(s,o.length)}return this}},Fi=class extends Ni{static writeAll(t,r){let i=new Fi(r);return Ve(t)?t.then(s=>i.writeAll(s)):Ae(t)?jh(i,t):zh(i,t)}},Li=class extends Ni{static writeAll(t){let r=new Li;return Ve(t)?t.then(i=>r.writeAll(i)):Ae(t)?jh(r,t):zh(r,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,r,i=!1){if(!i&&this._seenDictionaries.has(r))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,r,i)}_writeFooter(t){let r=Nr.encode(new Nr(t,et.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}};function zh(e,t){let r=t;t instanceof dt&&(r=t.batches,e.reset(void 0,t.schema));for(let i of r)e.write(i);return e.finish()}function jh(e,t){return x(this,void 0,void 0,function*(){var r,i,s,n,o,a,h;try{for(r=!0,i=je(t);s=yield i.next(),n=s.done,!n;r=!0){h=s.value,r=!1;let l=h;e.write(l)}}catch(l){o={error:l}}finally{try{!r&&!n&&(a=i.return)&&(yield a.call(i))}finally{if(o)throw o.error}}return e.finish()})}function ou(e,t){if(Ae(e))return Lm(e,t);if(ke(e))return Fm(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Fm(e,t){let r=null,i=t?.type==="bytes"||!1,s=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){n(o,r||(r=e[Symbol.iterator]()))},pull(o){r?n(o,r):o.close()},cancel(){(r?.return&&r.return()||!0)&&(r=null)}}),Object.assign({highWaterMark:i?s:void 0},t));function n(o,a){let h,l=null,c=o.desiredSize||null;for(;!(l=a.next(i?c:null)).done;)if(ArrayBuffer.isView(l.value)&&(h=N(l.value))&&(c!=null&&i&&(c=c-h.byteLength+1),l.value=h),o.enqueue(l.value),c!=null&&--c<=0)return;o.close()}}function Lm(e,t){let r=null,i=t?.type==="bytes"||!1,s=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){return x(this,void 0,void 0,function*(){yield n(o,r||(r=e[Symbol.asyncIterator]()))})},pull(o){return x(this,void 0,void 0,function*(){r?yield n(o,r):o.close()})},cancel(){return x(this,void 0,void 0,function*(){(r?.return&&(yield r.return())||!0)&&(r=null)})}}),Object.assign({highWaterMark:i?s:void 0},t));function n(o,a){return x(this,void 0,void 0,function*(){let h,l=null,c=o.desiredSize||null;for(;!(l=yield a.next(i?c:null)).done;)if(ArrayBuffer.isView(l.value)&&(h=N(l.value))&&(c!=null&&i&&(c=c-h.byteLength+1),l.value=h),o.enqueue(l.value),c!=null&&--c<=0)return;o.close()})}}function lu(e){return new Vh(e)}var Vh=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:i,["queueingStrategy"]:s="count"}=t,n=_l(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Ir(n),this._getSize=s!=="bytes"?au:hu;let{["highWaterMark"]:o=s==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r),{["highWaterMark"]:a=s==="bytes"?Math.pow(2,14):1e3}=Object.assign({},i);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:h=>{this._maybeFlush(this._builder,this._controller=h)},start:h=>{this._maybeFlush(this._builder,this._controller=h)}},{highWaterMark:o,size:s!=="bytes"?au:hu}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:h=>this._writeValueAndReturnChunkSize(h)})}_writeValueAndReturnChunkSize(t){let r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},au=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},hu=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function ca(e,t){let r=new xr,i=null,s=new ReadableStream({cancel(){return x(this,void 0,void 0,function*(){yield r.close()})},start(a){return x(this,void 0,void 0,function*(){yield o(a,i||(i=yield n()))})},pull(a){return x(this,void 0,void 0,function*(){i?yield o(a,i):a.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:s};function n(){return x(this,void 0,void 0,function*(){return yield(yield Yt.from(r)).open(t)})}function o(a,h){return x(this,void 0,void 0,function*(){let l=a.desiredSize,c=null;for(;!(c=yield h.next()).done;)if(a.enqueue(c.value),l!=null&&--l<=0)return;a.close()})}}function ua(e,t){let r=new this(e),i=new fe(r),s=new ReadableStream({cancel(){return x(this,void 0,void 0,function*(){yield i.cancel()})},pull(o){return x(this,void 0,void 0,function*(){yield n(o)})},start(o){return x(this,void 0,void 0,function*(){yield n(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:s};function n(o){return x(this,void 0,void 0,function*(){let a=null,h=o.desiredSize;for(;a=yield i.read(h||null);)if(o.enqueue(a),h!=null&&(h-=a.byteLength)<=0)return;o.close()})}}var $m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},th),Ih),yh),eh),$a),mh),Xa),{compareSchemas:Di,compareFields:Cc,compareTypes:Pc});Lt.toDOMStream=ou;ut.throughDOM=lu;Yt.throughDOM=ca;Ei.throughDOM=ca;Pr.throughDOM=ca;Ni.throughDOM=ua;Li.throughDOM=ua;Fi.throughDOM=ua;function kh(e){return uu(e)}function uu(e){return new W(e.fields.map(t=>Bs(t)),Gh(e.metadata))}function Gh(e){return e?new Map(Object.entries(e)):new Map}function Bs(e){return new P(e.name,fu(e.type),e.nullable,Gh(e.metadata))}function fu(e){if(typeof e=="object")switch(e.type){case"decimal":return new Fe(e.precision,e.scale,e.bitWidth);case"map":let t=e.children.map(s=>Bs(s));return new le(t,e.keysSorted);case"list":let r=Bs(e.children[0]);return new ae(r);case"fixed-size-list":let i=Bs(e.children[0]);return new he(e.listSize,i);case"struct":return t=e.children.map(s=>Bs(s)),new Q(t);default:throw new Error("array type not supported")}switch(e){case"null":return new Nt;case"binary":return new Oe;case"bool":return new Ne;case"int8":return new oi;case"int16":return new ai;case"int32":return new we;case"int64":return new hi;case"uint8":return new li;case"uint16":return new ci;case"uint32":return new ui;case"uint64":return new fi;case"float16":return new di;case"float32":return new pi;case"float64":return new mi;case"utf8":return new Ee;case"date-day":return new Yi;case"date-millisecond":return new Ji;case"time-second":return new Xi;case"time-millisecond":return new Ki;case"time-microsecond":return new Zi;case"time-nanosecond":return new Qi;case"timestamp-second":return new ts;case"timestamp-millisecond":return new es;case"timestamp-microsecond":return new rs;case"timestamp-nanosecond":return new is;case"interval-daytime":return new ss;case"interval-yearmonth":return new ns;default:throw new Error("array type not supported")}}var Sn=class{schema;arrowSchema;arrowBuilders;length;constructor(t){this.schema=t,this.arrowSchema=kh(t),this.arrowBuilders=this.arrowSchema.fields.map(r=>Ir({type:r.type,nullValues:[null]})),this.length=0}addObjectRow(t){for(let r=0;r<this.arrowBuilders.length;r++){let i=this.schema.fields[r].name,s=t[i];this.arrowBuilders[r].append(s)}this.length++}addArrayRow(t){for(let r=0;r<this.arrowBuilders.length;r++)this.arrowBuilders[r].append(t[r]);this.length++}firstBatch(){let t=this._getArrowRecordBatch();return t.numCols!==0?null:{shape:"arrow-table",batchType:"data",length:t.numRows,schema:this.schema,data:new dt(t)}}flushBatch(){let t=this._getArrowRecordBatch();return t.numCols===0?null:{shape:"arrow-table",batchType:"data",length:t.numRows,schema:this.schema,data:new dt(t)}}finishBatch(){let t=this._getArrowRecordBatch();return this.arrowBuilders.forEach(r=>r.finish()),t.numCols===0?null:{shape:"arrow-table",batchType:"data",length:t.numRows,schema:this.schema,data:new dt(t)}}finishTable(){let t=this._getArrowRecordBatch();return this.arrowBuilders.forEach(r=>r.finish()),{shape:"arrow-table",schema:this.schema,data:new dt(t)}}_getArrowRecordBatch(){let{arrowBuilders:t,arrowSchema:r}=this,i=t.map(h=>h.flush()),s=i[0].length,n=new Q(r.fields),o=new q(n,0,s,0,void 0,i);return new rt(r,o)}};function Wh(e,t,r){switch(e.type){case"Point":return Jm(e,t,r);case"LineString":return Ym(e,t,r);case"Polygon":return du(e,t,r);default:let i=e;throw new Error(`Unsupported geometry type: ${i?.type}`)}}function du(e,t=-1/0,r=1/0){let{positions:i}=e,s=e.polygonIndices.value.filter(h=>h>=t&&h<=r),n=e.primitivePolygonIndices.value.filter(h=>h>=t&&h<=r);if(!(s.length>2)){let h=[];for(let l=0;l<n.length-1;l++){let c=n[l],u=n[l+1],d=fa(i,c,u);h.push(d)}return{type:"Polygon",coordinates:h}}let a=[];for(let h=0;h<s.length-1;h++){let l=s[h],c=s[h+1],u=du(e,l,c).coordinates;a.push(u)}return{type:"MultiPolygon",coordinates:a}}function Ym(e,t=-1/0,r=1/0){let{positions:i}=e,s=e.pathIndices.value.filter(a=>a>=t&&a<=r);if(!(s.length>2))return{type:"LineString",coordinates:fa(i,s[0],s[1])};let o=[];for(let a=0;a<s.length-1;a++){let h=fa(i,s[a],s[a+1]);o.push(h)}return{type:"MultiLineString",coordinates:o}}function Jm(e,t,r){let{positions:i}=e,s=fa(i,t,r);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function fa(e,t,r){t=t||0,r=r||e.value.length/e.size;let i=[];for(let s=t;s<r;s++){let n=Array();for(let o=s*e.size;o<(s+1)*e.size;o++)n.push(Number(e.value[o]));i.push(n)}return i}function pu(e){e("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),e("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),e("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),e.WGS84=e["EPSG:4326"],e["EPSG:3785"]=e["EPSG:3857"],e.GOOGLE=e["EPSG:3857"],e["EPSG:900913"]=e["EPSG:3857"],e["EPSG:102113"]=e["EPSG:3857"]}var Qe=1,tr=2,mu=4,Bn=5,Ri=484813681109536e-20,y=Math.PI/2,yu=.16666666666666666,gu=.04722222222222222,bu=.022156084656084655,b=1e-10,Bt=.017453292519943295,er=57.29577951308232,J=Math.PI/4,An=Math.PI*2,mt=3.14159265359;var Jt={};Jt.greenwich=0;Jt.lisbon=-9.131906111111;Jt.paris=2.337229166667;Jt.bogota=-74.080916666667;Jt.madrid=-3.687938888889;Jt.rome=12.452333333333;Jt.bern=7.439583333333;Jt.jakarta=106.807719444444;Jt.ferro=-17.666666666667;Jt.brussels=4.367975;Jt.stockholm=18.058277777778;Jt.athens=23.7163375;Jt.oslo=10.722916666667;var _u={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}};var vu=/[\s_\-\/\(\)]/g;function Se(e,t){if(e[t])return e[t];for(var r=Object.keys(e),i=t.toLowerCase().replace(vu,""),s=-1,n,o;++s<r.length;)if(n=r[s],o=n.toLowerCase().replace(vu,""),o===i)return e[n]}function Dn(e){var t={},r=e.split("+").map(function(a){return a.trim()}).filter(function(a){return a}).reduce(function(a,h){var l=h.split("=");return l.push(!0),a[l[0].toLowerCase()]=l[1],a},{}),i,s,n,o={proj:"projName",datum:"datumCode",rf:function(a){t.rf=parseFloat(a)},lat_0:function(a){t.lat0=a*Bt},lat_1:function(a){t.lat1=a*Bt},lat_2:function(a){t.lat2=a*Bt},lat_ts:function(a){t.lat_ts=a*Bt},lon_0:function(a){t.long0=a*Bt},lon_1:function(a){t.long1=a*Bt},lon_2:function(a){t.long2=a*Bt},alpha:function(a){t.alpha=parseFloat(a)*Bt},lonc:function(a){t.longc=a*Bt},x_0:function(a){t.x0=parseFloat(a)},y_0:function(a){t.y0=parseFloat(a)},k_0:function(a){t.k0=parseFloat(a)},k:function(a){t.k0=parseFloat(a)},a:function(a){t.a=parseFloat(a)},b:function(a){t.b=parseFloat(a)},r_a:function(){t.R_A=!0},zone:function(a){t.zone=parseInt(a,10)},south:function(){t.utmSouth=!0},towgs84:function(a){t.datum_params=a.split(",").map(function(h){return parseFloat(h)})},to_meter:function(a){t.to_meter=parseFloat(a)},units:function(a){t.units=a;var h=Se(_u,a);h&&(t.to_meter=h.to_meter)},from_greenwich:function(a){t.from_greenwich=a*Bt},pm:function(a){var h=Se(Jt,a);t.from_greenwich=(h||parseFloat(a))*Bt},nadgrids:function(a){a==="@null"?t.datumCode="none":t.nadgrids=a},axis:function(a){var h="ewnsud";a.length===3&&h.indexOf(a.substr(0,1))!==-1&&h.indexOf(a.substr(1,1))!==-1&&h.indexOf(a.substr(2,1))!==-1&&(t.axis=a)}};for(i in r)s=r[i],i in o?(n=o[i],typeof n=="function"?n(s):t[n]=s):t[i]=s;return typeof t.datumCode=="string"&&t.datumCode!=="WGS84"&&(t.datumCode=t.datumCode.toLowerCase()),t}var wu=Qm,Tn=1,xu=2,Mu=3,da=4,Iu=5,Hh=-1,Xm=/\s/,Km=/[A-Za-z]/,Zm=/[A-Za-z84_]/,pa=/[,\]]/,Su=/[\d\.E\-\+]/;function jr(e){if(typeof e!="string")throw new Error("not a string");this.text=e.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Tn}jr.prototype.readCharicter=function(){var e=this.text[this.place++];if(this.state!==da)for(;Xm.test(e);){if(this.place>=this.text.length)return;e=this.text[this.place++]}switch(this.state){case Tn:return this.neutral(e);case xu:return this.keyword(e);case da:return this.quoted(e);case Iu:return this.afterquote(e);case Mu:return this.number(e);case Hh:return}};jr.prototype.afterquote=function(e){if(e==='"'){this.word+='"',this.state=da;return}if(pa.test(e)){this.word=this.word.trim(),this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in afterquote yet, index '+this.place)};jr.prototype.afterItem=function(e){if(e===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Tn;return}if(e==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Tn,this.currentObject=this.stack.pop(),this.currentObject||(this.state=Hh);return}};jr.prototype.number=function(e){if(Su.test(e)){this.word+=e;return}if(pa.test(e)){this.word=parseFloat(this.word),this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in number yet, index '+this.place)};jr.prototype.quoted=function(e){if(e==='"'){this.state=Iu;return}this.word+=e};jr.prototype.keyword=function(e){if(Zm.test(e)){this.word+=e;return}if(e==="["){var t=[];t.push(this.word),this.level++,this.root===null?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,this.state=Tn;return}if(pa.test(e)){this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in keyword yet, index '+this.place)};jr.prototype.neutral=function(e){if(Km.test(e)){this.word=e,this.state=xu;return}if(e==='"'){this.word="",this.state=da;return}if(Su.test(e)){this.word=e,this.state=Mu;return}if(pa.test(e)){this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in neutral yet, index '+this.place)};jr.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===Hh)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function Qm(e){var t=new jr(e);return t.output()}function Bu(e,t,r){Array.isArray(t)&&(r.unshift(t),t=null);var i=t?{}:e,s=r.reduce(function(n,o){return Ui(o,n),n},i);t&&(e[t]=s)}function Ui(e,t){if(!Array.isArray(e)){t[e]=!0;return}var r=e.shift();if(r==="PARAMETER"&&(r=e.shift()),e.length===1){if(Array.isArray(e[0])){t[r]={},Ui(e[0],t[r]);return}t[r]=e[0];return}if(!e.length){t[r]=!0;return}if(r==="TOWGS84"){t[r]=e;return}if(r==="AXIS"){r in t||(t[r]=[]),t[r].push(e);return}Array.isArray(r)||(t[r]={});var i;switch(r){case"UNIT":case"PRIMEM":case"VERT_DATUM":t[r]={name:e[0].toLowerCase(),convert:e[1]},e.length===3&&Ui(e[2],t[r]);return;case"SPHEROID":case"ELLIPSOID":t[r]={name:e[0],a:e[1],rf:e[2]},e.length===4&&Ui(e[3],t[r]);return;case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":e[0]=["name",e[0]],Bu(t,r,e);return;default:for(i=-1;++i<e.length;)if(!Array.isArray(e[i]))return Ui(e,t[r]);return Bu(t,r,e)}}var t0=.017453292519943295;function e0(e,t){var r=t[0],i=t[1];!(r in e)&&i in e&&(e[r]=e[i],t.length===3&&(e[r]=t[2](e[r])))}function Br(e){return e*t0}function r0(e){if(e.type==="GEOGCS"?e.projName="longlat":e.type==="LOCAL_CS"?(e.projName="identity",e.local=!0):typeof e.PROJECTION=="object"?e.projName=Object.keys(e.PROJECTION)[0]:e.projName=e.PROJECTION,e.AXIS){for(var t="",r=0,i=e.AXIS.length;r<i;++r){var s=[e.AXIS[r][0].toLowerCase(),e.AXIS[r][1].toLowerCase()];s[0].indexOf("north")!==-1||(s[0]==="y"||s[0]==="lat")&&s[1]==="north"?t+="n":s[0].indexOf("south")!==-1||(s[0]==="y"||s[0]==="lat")&&s[1]==="south"?t+="s":s[0].indexOf("east")!==-1||(s[0]==="x"||s[0]==="lon")&&s[1]==="east"?t+="e":(s[0].indexOf("west")!==-1||(s[0]==="x"||s[0]==="lon")&&s[1]==="west")&&(t+="w")}t.length===2&&(t+="u"),t.length===3&&(e.axis=t)}e.UNIT&&(e.units=e.UNIT.name.toLowerCase(),e.units==="metre"&&(e.units="meter"),e.UNIT.convert&&(e.type==="GEOGCS"?e.DATUM&&e.DATUM.SPHEROID&&(e.to_meter=e.UNIT.convert*e.DATUM.SPHEROID.a):e.to_meter=e.UNIT.convert));var n=e.GEOGCS;e.type==="GEOGCS"&&(n=e),n&&(n.DATUM?e.datumCode=n.DATUM.name.toLowerCase():e.datumCode=n.name.toLowerCase(),e.datumCode.slice(0,2)==="d_"&&(e.datumCode=e.datumCode.slice(2)),(e.datumCode==="new_zealand_geodetic_datum_1949"||e.datumCode==="new_zealand_1949")&&(e.datumCode="nzgd49"),(e.datumCode==="wgs_1984"||e.datumCode==="world_geodetic_system_1984")&&(e.PROJECTION==="Mercator_Auxiliary_Sphere"&&(e.sphere=!0),e.datumCode="wgs84"),e.datumCode.slice(-6)==="_ferro"&&(e.datumCode=e.datumCode.slice(0,-6)),e.datumCode.slice(-8)==="_jakarta"&&(e.datumCode=e.datumCode.slice(0,-8)),~e.datumCode.indexOf("belge")&&(e.datumCode="rnb72"),n.DATUM&&n.DATUM.SPHEROID&&(e.ellps=n.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),e.ellps.toLowerCase().slice(0,13)==="international"&&(e.ellps="intl"),e.a=n.DATUM.SPHEROID.a,e.rf=parseFloat(n.DATUM.SPHEROID.rf,10)),n.DATUM&&n.DATUM.TOWGS84&&(e.datum_params=n.DATUM.TOWGS84),~e.datumCode.indexOf("osgb_1936")&&(e.datumCode="osgb36"),~e.datumCode.indexOf("osni_1952")&&(e.datumCode="osni52"),(~e.datumCode.indexOf("tm65")||~e.datumCode.indexOf("geodetic_datum_of_1965"))&&(e.datumCode="ire65"),e.datumCode==="ch1903+"&&(e.datumCode="ch1903"),~e.datumCode.indexOf("israel")&&(e.datumCode="isr93")),e.b&&!isFinite(e.b)&&(e.b=e.a);function o(l){var c=e.to_meter||1;return l*c}var a=function(l){return e0(e,l)},h=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",Br],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Br],["x0","false_easting",o],["y0","false_northing",o],["long0","central_meridian",Br],["lat0","latitude_of_origin",Br],["lat0","standard_parallel_1",Br],["lat1","standard_parallel_1",Br],["lat2","standard_parallel_2",Br],["azimuth","Azimuth"],["alpha","azimuth",Br],["srsCode","name"]];h.forEach(a),!e.long0&&e.longc&&(e.projName==="Albers_Conic_Equal_Area"||e.projName==="Lambert_Azimuthal_Equal_Area")&&(e.long0=e.longc),!e.lat_ts&&e.lat1&&(e.projName==="Stereographic_South_Pole"||e.projName==="Polar Stereographic (variant B)")?(e.lat0=Br(e.lat1>0?90:-90),e.lat_ts=e.lat1):!e.lat_ts&&e.lat0&&e.projName==="Polar_Stereographic"&&(e.lat_ts=e.lat0,e.lat0=Br(e.lat0>0?90:-90))}function ma(e){var t=wu(e),r=t.shift(),i=t.shift();t.unshift(["name",i]),t.unshift(["type",r]);var s={};return Ui(t,s),r0(s),s}function Ce(e){var t=this;if(arguments.length===2){var r=arguments[1];typeof r=="string"?r.charAt(0)==="+"?Ce[e]=Dn(arguments[1]):Ce[e]=ma(arguments[1]):Ce[e]=r}else if(arguments.length===1){if(Array.isArray(e))return e.map(function(i){Array.isArray(i)?Ce.apply(t,i):Ce(i)});if(typeof e=="string"){if(e in Ce)return Ce[e]}else"EPSG"in e?Ce["EPSG:"+e.EPSG]=e:"ESRI"in e?Ce["ESRI:"+e.ESRI]=e:"IAU2000"in e?Ce["IAU2000:"+e.IAU2000]=e:console.log(e);return}}pu(Ce);var As=Ce;function i0(e){return typeof e=="string"}function s0(e){return e in As}var n0=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function o0(e){return n0.some(function(t){return e.indexOf(t)>-1})}var a0=["3857","900913","3785","102113"];function h0(e){var t=Se(e,"authority");if(t){var r=Se(t,"epsg");return r&&a0.indexOf(r)>-1}}function l0(e){var t=Se(e,"extension");if(t)return Se(t,"proj4")}function c0(e){return e[0]==="+"}function u0(e){if(i0(e)){if(s0(e))return As[e];if(o0(e)){var t=ma(e);if(h0(t))return As["EPSG:3857"];var r=l0(t);return r?Dn(r):t}if(c0(e))return Dn(e)}else return e}var Au=u0;function qh(e,t){e=e||{};var r,i;if(!t)return e;for(i in t)r=t[i],r!==void 0&&(e[i]=r);return e}function kt(e,t,r){var i=e*t;return r/Math.sqrt(1-i*i)}function Ar(e){return e<0?-1:1}function _(e){return Math.abs(e)<=mt?e:e-Ar(e)*An}function Xt(e,t,r){var i=e*r,s=.5*e;return i=Math.pow((1-i)/(1+i),s),Math.tan(.5*(y-t))/i}function Vr(e,t){for(var r=.5*e,i,s,n=y-2*Math.atan(t),o=0;o<=15;o++)if(i=e*Math.sin(n),s=y-2*Math.atan(t*Math.pow((1-i)/(1+i),r))-n,n+=s,Math.abs(s)<=1e-10)return n;return-9999}function f0(){var e=this.b/this.a;this.es=1-e*e,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=kt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function d0(e){var t=e.x,r=e.y;if(r*er>90&&r*er<-90&&t*er>180&&t*er<-180)return null;var i,s;if(Math.abs(Math.abs(r)-y)<=b)return null;if(this.sphere)i=this.x0+this.a*this.k0*_(t-this.long0),s=this.y0+this.a*this.k0*Math.log(Math.tan(J+.5*r));else{var n=Math.sin(r),o=Xt(this.e,r,n);i=this.x0+this.a*this.k0*_(t-this.long0),s=this.y0-this.a*this.k0*Math.log(o)}return e.x=i,e.y=s,e}function p0(e){var t=e.x-this.x0,r=e.y-this.y0,i,s;if(this.sphere)s=y-2*Math.atan(Math.exp(-r/(this.a*this.k0)));else{var n=Math.exp(-r/(this.a*this.k0));if(s=Vr(this.e,n),s===-9999)return null}return i=_(this.long0+t/(this.a*this.k0)),e.x=i,e.y=s,e}var m0=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],Du={init:f0,forward:d0,inverse:p0,names:m0};function y0(){}function Tu(e){return e}var g0=["longlat","identity"],Ou={init:y0,forward:Tu,inverse:Tu,names:g0};var b0=[Du,Ou],ya={},ga=[];function Eu(e,t){var r=ga.length;return e.names?(ga[r]=e,e.names.forEach(function(i){ya[i.toLowerCase()]=r}),this):(console.log(t),!0)}function _0(e){if(!e)return!1;var t=e.toLowerCase();if(typeof ya[t]<"u"&&ga[ya[t]])return ga[ya[t]]}function v0(){b0.forEach(Eu)}var Nu={start:v0,add:Eu,get:_0};var V={};V.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"};V.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"};V.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"};V.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"};V.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"};V.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"};V.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"};V.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"};V.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"};V.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"};V.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"};V.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"};V.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"};V.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"};V.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."};V.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"};V.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"};V.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"};V.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"};V.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"};V.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"};V.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"};V.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"};V.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"};V.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"};V.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"};V.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"};V.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"};V.hough={a:6378270,rf:297,ellipseName:"Hough"};V.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"};V.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"};V.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"};V.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"};V.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"};V.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"};V.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"};V.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"};V.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"};V.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"};V.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"};V.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var Fu=V.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};V.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function Lu(e,t,r,i){var s=e*e,n=t*t,o=(s-n)/s,a=0;i?(e*=1-o*(yu+o*(gu+o*bu)),s=e*e,o=0):a=Math.sqrt(o);var h=(s-n)/n;return{es:o,e:a,ep2:h}}function Ru(e,t,r,i,s){if(!e){var n=Se(V,i);n||(n=Fu),e=n.a,t=n.b,r=n.rf}return r&&!t&&(t=(1-1/r)*e),(r===0||Math.abs(e-t)<b)&&(s=!0,t=e),{a:e,b:t,rf:r,sphere:s}}var At={};At.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"};At.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"};At.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"};At.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"};At.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"};At.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"};At.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"};At.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"};At.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"};At.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"};At.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"};At.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"};At.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"};At.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"};At.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"};At.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"};At.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function w0(e,t,r,i,s,n){var o={};return e===void 0||e==="none"?o.datum_type=Bn:o.datum_type=mu,t&&(o.datum_params=t.map(parseFloat),(o.datum_params[0]!==0||o.datum_params[1]!==0||o.datum_params[2]!==0)&&(o.datum_type=Qe),o.datum_params.length>3&&(o.datum_params[3]!==0||o.datum_params[4]!==0||o.datum_params[5]!==0||o.datum_params[6]!==0)&&(o.datum_type=tr,o.datum_params[3]*=Ri,o.datum_params[4]*=Ri,o.datum_params[5]*=Ri,o.datum_params[6]=o.datum_params[6]/1e6+1)),o.a=r,o.b=i,o.es=s,o.ep2=n,o}var Uu=w0;function Ds(e,t){if(!(this instanceof Ds))return new Ds(e);t=t||function(h){if(h)throw h};var r=Au(e);if(typeof r!="object"){t(e);return}var i=Ds.projections.get(r.projName);if(!i){t(e);return}if(r.datumCode&&r.datumCode!=="none"){var s=Se(At,r.datumCode);s&&(r.datum_params=s.towgs84?s.towgs84.split(","):null,r.ellps=s.ellipse,r.datumName=s.datumName?s.datumName:r.datumCode)}r.k0=r.k0||1,r.axis=r.axis||"enu",r.ellps=r.ellps||"wgs84";var n=Ru(r.a,r.b,r.rf,r.ellps,r.sphere),o=Lu(n.a,n.b,n.rf,r.R_A),a=r.datum||Uu(r.datumCode,r.datum_params,n.a,n.b,o.es,o.ep2);qh(this,r),qh(this,i),this.a=n.a,this.b=n.b,this.rf=n.rf,this.sphere=n.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=a,this.init(),t(null,this)}Ds.projections=Nu;Ds.projections.start();var ti=Ds;function Cu(e,t){return e.datum_type!==t.datum_type||e.a!==t.a||Math.abs(e.es-t.es)>5e-11?!1:e.datum_type===Qe?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]:e.datum_type===tr?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]&&e.datum_params[3]===t.datum_params[3]&&e.datum_params[4]===t.datum_params[4]&&e.datum_params[5]===t.datum_params[5]&&e.datum_params[6]===t.datum_params[6]:!0}function ba(e,t,r){var i=e.x,s=e.y,n=e.z?e.z:0,o,a,h,l;if(s<-y&&s>-1.001*y)s=-y;else if(s>y&&s<1.001*y)s=y;else{if(s<-y)return{x:-1/0,y:-1/0,z:e.z};if(s>y)return{x:1/0,y:1/0,z:e.z}}return i>Math.PI&&(i-=2*Math.PI),a=Math.sin(s),l=Math.cos(s),h=a*a,o=r/Math.sqrt(1-t*h),{x:(o+n)*l*Math.cos(i),y:(o+n)*l*Math.sin(i),z:(o*(1-t)+n)*a}}function _a(e,t,r,i){var s=1e-12,n=s*s,o=30,a,h,l,c,u,d,p,m,g,v,I,z,$,nt=e.x,K=e.y,tt=e.z?e.z:0,Ct,gt,sr;if(a=Math.sqrt(nt*nt+K*K),h=Math.sqrt(nt*nt+K*K+tt*tt),a/r<s){if(Ct=0,h/r<s)return gt=y,sr=-i,{x:e.x,y:e.y,z:e.z}}else Ct=Math.atan2(K,nt);l=tt/h,c=a/h,u=1/Math.sqrt(1-t*(2-t)*c*c),m=c*(1-t)*u,g=l*u,$=0;do $++,p=r/Math.sqrt(1-t*g*g),sr=a*m+tt*g-p*(1-t*g*g),d=t*p/(p+sr),u=1/Math.sqrt(1-d*(2-d)*c*c),v=c*(1-d)*u,I=l*u,z=I*m-v*g,m=v,g=I;while(z*z>n&&$<o);return gt=Math.atan(I/Math.abs(v)),{x:Ct,y:gt,z:sr}}function Pu(e,t,r){if(t===Qe)return{x:e.x+r[0],y:e.y+r[1],z:e.z+r[2]};if(t===tr){var i=r[0],s=r[1],n=r[2],o=r[3],a=r[4],h=r[5],l=r[6];return{x:l*(e.x-h*e.y+a*e.z)+i,y:l*(h*e.x+e.y-o*e.z)+s,z:l*(-a*e.x+o*e.y+e.z)+n}}}function zu(e,t,r){if(t===Qe)return{x:e.x-r[0],y:e.y-r[1],z:e.z-r[2]};if(t===tr){var i=r[0],s=r[1],n=r[2],o=r[3],a=r[4],h=r[5],l=r[6],c=(e.x-i)/l,u=(e.y-s)/l,d=(e.z-n)/l;return{x:c+h*u-a*d,y:-h*c+u+o*d,z:a*c-o*u+d}}}function va(e){return e===Qe||e===tr}function ju(e,t,r){return Cu(e,t)||e.datum_type===Bn||t.datum_type===Bn||e.es===t.es&&e.a===t.a&&!va(e.datum_type)&&!va(t.datum_type)?r:(r=ba(r,e.es,e.a),va(e.datum_type)&&(r=Pu(r,e.datum_type,e.datum_params)),va(t.datum_type)&&(r=zu(r,t.datum_type,t.datum_params)),_a(r,t.es,t.a,t.b))}function $h(e,t,r){var i=r.x,s=r.y,n=r.z||0,o,a,h,l={};for(h=0;h<3;h++)if(!(t&&h===2&&r.z===void 0))switch(h===0?(o=i,"ew".indexOf(e.axis[h])!==-1?a="x":a="y"):h===1?(o=s,"ns".indexOf(e.axis[h])!==-1?a="y":a="x"):(o=n,a="z"),e.axis[h]){case"e":case"w":case"n":case"s":l[a]=o;break;case"u":r[a]!==void 0&&(l.z=o);break;case"d":r[a]!==void 0&&(l.z=-o);break;default:return null}return l}function wa(e){var t={x:e[0],y:e[1]};return e.length>2&&(t.z=e[2]),e.length>3&&(t.m=e[3]),t}function ku(e){Vu(e.x),Vu(e.y)}function Vu(e){if(typeof Number.isFinite=="function"){if(Number.isFinite(e))return;throw new TypeError("coordinates must be finite numbers")}if(typeof e!="number"||e!==e||!isFinite(e))throw new TypeError("coordinates must be finite numbers")}function x0(e,t){return(e.datum.datum_type===Qe||e.datum.datum_type===tr)&&t.datumCode!=="WGS84"||(t.datum.datum_type===Qe||t.datum.datum_type===tr)&&e.datumCode!=="WGS84"}function Ci(e,t,r){var i;if(Array.isArray(r)&&(r=wa(r)),ku(r),e.datum&&t.datum&&x0(e,t)&&(i=new ti("WGS84"),r=Ci(e,i,r),e=i),e.axis!=="enu"&&(r=$h(e,!1,r)),e.projName==="longlat")r={x:r.x*Bt,y:r.y*Bt,z:r.z||0};else if(e.to_meter&&(r={x:r.x*e.to_meter,y:r.y*e.to_meter,z:r.z||0}),r=e.inverse(r),!r)return;return e.from_greenwich&&(r.x+=e.from_greenwich),r=ju(e.datum,t.datum,r),t.from_greenwich&&(r={x:r.x-t.from_greenwich,y:r.y,z:r.z||0}),t.projName==="longlat"?r={x:r.x*er,y:r.y*er,z:r.z||0}:(r=t.forward(r),t.to_meter&&(r={x:r.x/t.to_meter,y:r.y/t.to_meter,z:r.z||0})),t.axis!=="enu"?$h(t,!0,r):r}var Gu=ti("WGS84");function Yh(e,t,r){var i,s,n;return Array.isArray(r)?(i=Ci(e,t,r)||{x:NaN,y:NaN},r.length>2?typeof e.name<"u"&&e.name==="geocent"||typeof t.name<"u"&&t.name==="geocent"?typeof i.z=="number"?[i.x,i.y,i.z].concat(r.splice(3)):[i.x,i.y,r[2]].concat(r.splice(3)):[i.x,i.y].concat(r.splice(2)):[i.x,i.y]):(s=Ci(e,t,r),n=Object.keys(r),n.length===2||n.forEach(function(o){if(typeof e.name<"u"&&e.name==="geocent"||typeof t.name<"u"&&t.name==="geocent"){if(o==="x"||o==="y"||o==="z")return}else if(o==="x"||o==="y")return;s[o]=r[o]}),s)}function Wu(e){return e instanceof ti?e:e.oProj?e.oProj:ti(e)}function M0(e,t,r){e=Wu(e);var i=!1,s;return typeof t>"u"?(t=e,e=Gu,i=!0):(typeof t.x<"u"||Array.isArray(t))&&(r=t,t=e,e=Gu,i=!0),t=Wu(t),r?Yh(e,t,r):(s={forward:function(n){return Yh(e,t,n)},inverse:function(n){return Yh(t,e,n)}},i&&(s.oProj=t),s)}var Be=M0;var Hu=6,$u="AJSAJS",Yu="AFAFAF",Ts=65,ye=73,Pe=79,On=86,En=90,Ju={forward:Xh,inverse:I0,toPoint:Kh};function Xh(e,t){return t=t||5,A0(S0({lat:e[1],lon:e[0]}),t)}function I0(e){var t=Zh(Ku(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]}function Kh(e){var t=Zh(Ku(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function Jh(e){return e*(Math.PI/180)}function qu(e){return 180*(e/Math.PI)}function S0(e){var t=e.lat,r=e.lon,i=6378137,s=.00669438,n=.9996,o,a,h,l,c,u,d,p=Jh(t),m=Jh(r),g,v;v=Math.floor((r+180)/6)+1,r===180&&(v=60),t>=56&&t<64&&r>=3&&r<12&&(v=32),t>=72&&t<84&&(r>=0&&r<9?v=31:r>=9&&r<21?v=33:r>=21&&r<33?v=35:r>=33&&r<42&&(v=37)),o=(v-1)*6-180+3,g=Jh(o),a=s/(1-s),h=i/Math.sqrt(1-s*Math.sin(p)*Math.sin(p)),l=Math.tan(p)*Math.tan(p),c=a*Math.cos(p)*Math.cos(p),u=Math.cos(p)*(m-g),d=i*((1-s/4-3*s*s/64-5*s*s*s/256)*p-(3*s/8+3*s*s/32+45*s*s*s/1024)*Math.sin(2*p)+(15*s*s/256+45*s*s*s/1024)*Math.sin(4*p)-35*s*s*s/3072*Math.sin(6*p));var I=n*h*(u+(1-l+c)*u*u*u/6+(5-18*l+l*l+72*c-58*a)*u*u*u*u*u/120)+5e5,z=n*(d+h*Math.tan(p)*(u*u/2+(5-l+9*c+4*c*c)*u*u*u*u/24+(61-58*l+l*l+600*c-330*a)*u*u*u*u*u*u/720));return t<0&&(z+=1e7),{northing:Math.round(z),easting:Math.round(I),zoneNumber:v,zoneLetter:B0(t)}}function Zh(e){var t=e.northing,r=e.easting,i=e.zoneLetter,s=e.zoneNumber;if(s<0||s>60)return null;var n=.9996,o=6378137,a=.00669438,h,l=(1-Math.sqrt(1-a))/(1+Math.sqrt(1-a)),c,u,d,p,m,g,v,I,z,$=r-5e5,nt=t;i<"N"&&(nt-=1e7),v=(s-1)*6-180+3,h=a/(1-a),g=nt/n,I=g/(o*(1-a/4-3*a*a/64-5*a*a*a/256)),z=I+(3*l/2-27*l*l*l/32)*Math.sin(2*I)+(21*l*l/16-55*l*l*l*l/32)*Math.sin(4*I)+151*l*l*l/96*Math.sin(6*I),c=o/Math.sqrt(1-a*Math.sin(z)*Math.sin(z)),u=Math.tan(z)*Math.tan(z),d=h*Math.cos(z)*Math.cos(z),p=o*(1-a)/Math.pow(1-a*Math.sin(z)*Math.sin(z),1.5),m=$/(c*n);var K=z-c*Math.tan(z)/p*(m*m/2-(5+3*u+10*d-4*d*d-9*h)*m*m*m*m/24+(61+90*u+298*d+45*u*u-252*h-3*d*d)*m*m*m*m*m*m/720);K=qu(K);var tt=(m-(1+2*u+d)*m*m*m/6+(5-2*d+28*u-3*d*d+8*h+24*u*u)*m*m*m*m*m/120)/Math.cos(z);tt=v+qu(tt);var Ct;if(e.accuracy){var gt=Zh({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});Ct={top:gt.lat,right:gt.lon,bottom:K,left:tt}}else Ct={lat:K,lon:tt};return Ct}function B0(e){var t="Z";return 84>=e&&e>=72?t="X":72>e&&e>=64?t="W":64>e&&e>=56?t="V":56>e&&e>=48?t="U":48>e&&e>=40?t="T":40>e&&e>=32?t="S":32>e&&e>=24?t="R":24>e&&e>=16?t="Q":16>e&&e>=8?t="P":8>e&&e>=0?t="N":0>e&&e>=-8?t="M":-8>e&&e>=-16?t="L":-16>e&&e>=-24?t="K":-24>e&&e>=-32?t="J":-32>e&&e>=-40?t="H":-40>e&&e>=-48?t="G":-48>e&&e>=-56?t="F":-56>e&&e>=-64?t="E":-64>e&&e>=-72?t="D":-72>e&&e>=-80&&(t="C"),t}function A0(e,t){var r="00000"+e.easting,i="00000"+e.northing;return e.zoneNumber+e.zoneLetter+D0(e.easting,e.northing,e.zoneNumber)+r.substr(r.length-5,t)+i.substr(i.length-5,t)}function D0(e,t,r){var i=Xu(r),s=Math.floor(e/1e5),n=Math.floor(t/1e5)%20;return T0(s,n,i)}function Xu(e){var t=e%Hu;return t===0&&(t=Hu),t}function T0(e,t,r){var i=r-1,s=$u.charCodeAt(i),n=Yu.charCodeAt(i),o=s+e-1,a=n+t,h=!1;o>En&&(o=o-En+Ts-1,h=!0),(o===ye||s<ye&&o>ye||(o>ye||s<ye)&&h)&&o++,(o===Pe||s<Pe&&o>Pe||(o>Pe||s<Pe)&&h)&&(o++,o===ye&&o++),o>En&&(o=o-En+Ts-1),a>On?(a=a-On+Ts-1,h=!0):h=!1,(a===ye||n<ye&&a>ye||(a>ye||n<ye)&&h)&&a++,(a===Pe||n<Pe&&a>Pe||(a>Pe||n<Pe)&&h)&&(a++,a===ye&&a++),a>On&&(a=a-On+Ts-1);var l=String.fromCharCode(o)+String.fromCharCode(a);return l}function Ku(e){if(e&&e.length===0)throw"MGRSPoint coverting from nothing";for(var t=e.length,r=null,i="",s,n=0;!/[A-Z]/.test(s=e.charAt(n));){if(n>=2)throw"MGRSPoint bad conversion from: "+e;i+=s,n++}var o=parseInt(i,10);if(n===0||n+3>t)throw"MGRSPoint bad conversion from: "+e;var a=e.charAt(n++);if(a<="A"||a==="B"||a==="Y"||a>="Z"||a==="I"||a==="O")throw"MGRSPoint zone letter "+a+" not handled: "+e;r=e.substring(n,n+=2);for(var h=Xu(o),l=O0(r.charAt(0),h),c=E0(r.charAt(1),h);c<N0(a);)c+=2e6;var u=t-n;if(u%2!==0)throw`MGRSPoint has to have an even number
|
|
16
|
+
]`}concat(...t){let r=this.schema,i=this.data.concat(t.flatMap(({data:s})=>s));return new pt(r,i.map(s=>new rt(r,s)))}slice(t,r){let i=this.schema;[t,r]=Js({length:this.numRows},t,r);let s=Oo(this.data,this._offsets,t,r);return new pt(i,s.map(n=>new rt(i,n)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let r=this.data.map(i=>i.children[t]);if(r.length===0){let{type:i}=this.schema.fields[t],s=C({type:i,length:0,nullCount:0});r.push(s._changeLengthAndBackfillNullBitmap(this.numRows))}return new V(r)}return null}setChild(t,r){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(s=>s.name===t),r)}setChildAt(t,r){let i=this.schema,s=[...this.batches];if(t>-1&&t<this.numCols){r||(r=new V([C({type:new Rt,length:this.numRows})]));let n=i.fields.slice(),o=n[t].clone({type:r.type}),a=this.schema.fields.map((h,c)=>this.getChildAt(c));[n[t],a[t]]=[o,r],[i,s]=la(i,a)}return new pt(i,s)}select(t){let r=this.schema.fields.reduce((i,s,n)=>i.set(s.name,n),new Map);return this.selectAt(t.map(i=>r.get(i)).filter(i=>i>-1))}selectAt(t){let r=this.schema.selectAt(t),i=this.batches.map(s=>s.selectAt(t));return new pt(r,i)}assign(t){let r=this.schema.fields,[i,s]=t.schema.fields.reduce((a,h,c)=>{let[l,u]=a,p=r.findIndex(f=>f.name===h.name);return~p?u[p]=c:l.push(c),a},[[],[]]),n=this.schema.assign(t.schema),o=[...r.map((a,h)=>[h,s[h]]).map(([a,h])=>h===void 0?this.getChildAt(a):t.getChildAt(h)),...i.map(a=>t.getChildAt(a))].filter(Boolean);return new pt(...la(n,o))}};bu=Symbol.toStringTag;pt[bu]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=ps(Xs),e.get=ps(Mt.getVisitFn(d.Struct)),e.set=Lo(kt.getVisitFn(d.Struct)),e.indexOf=Fo(Ii.getVisitFn(d.Struct)),"Table"))(pt.prototype);var wu,rt=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof H))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=C({nullCount:0,type:new Q(this.schema.fields),children:this.schema.fields.map(r=>C({type:r.type,nullCount:0}))})]=t,!(this.data instanceof q))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=vu(this.schema,this.data.children);break}case 1:{let[r]=t,{fields:i,children:s,length:n}=Object.keys(r).reduce((h,c,l)=>(h.children[l]=r[c],h.length=Math.max(h.length,r[c].length),h.fields[l]=P.new({name:c,type:r[c].type,nullable:!0}),h),{length:0,fields:new Array,children:new Array}),o=new H(i),a=C({type:new Q(i),length:n,children:s,nullCount:0});[this.schema,this.data]=vu(o,a.children,n);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=Mu(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return Mt.visit(this.data,t)}at(t){return this.get(bi(t,this.numRows))}set(t,r){return kt.visit(this.data,t,r)}indexOf(t,r){return Ii.visit(this.data,t,r)}[Symbol.iterator](){return ms.visit(new V([this.data]))}toArray(){return[...this]}concat(...t){return new pt(this.schema,[this,...t])}slice(t,r){let[i]=new V([this.data]).slice(t,r).data;return new rt(this.schema,i)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new V([this.data.children[t]]):null}setChild(t,r){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(s=>s.name===t),r)}setChildAt(t,r){let i=this.schema,s=this.data;if(t>-1&&t<this.numCols){r||(r=new V([C({type:new Rt,length:this.numRows})]));let n=i.fields.slice(),o=s.children.slice(),a=n[t].clone({type:r.type});[n[t],o[t]]=[a,r.data[0]],i=new H(n,new Map(this.schema.metadata)),s=C({type:new Q(n),children:o})}return new rt(i,s)}select(t){let r=this.schema.select(t),i=new Q(r.fields),s=[];for(let n of t){let o=this.schema.fields.findIndex(a=>a.name===n);~o&&(s[o]=this.data.children[o])}return new rt(r,C({type:i,length:this.numRows,children:s}))}selectAt(t){let r=this.schema.selectAt(t),i=t.map(n=>this.data.children[n]).filter(Boolean),s=C({type:new Q(r.fields),length:this.numRows,children:i});return new rt(r,s)}};wu=Symbol.toStringTag;rt[wu]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(rt.prototype);function vu(e,t,r=t.reduce((i,s)=>Math.max(i,s.length),0)){var i;let s=[...e.fields],n=[...t],o=(r+63&-64)>>3;for(let[a,h]of e.fields.entries()){let c=t[a];(!c||c.length!==r)&&(s[a]=h.clone({nullable:!0}),n[a]=(i=c?._changeLengthAndBackfillNullBitmap(r))!==null&&i!==void 0?i:C({type:h.type,length:r,nullCount:r,nullBitmap:new Uint8Array(o)}))}return[e.assign(s),C({type:new Q(s),length:r,children:n})]}function Mu(e,t,r=new Map){var i,s;if(((i=e?.length)!==null&&i!==void 0?i:0)>0&&e?.length===t?.length)for(let n=-1,o=e.length;++n<o;){let{type:a}=e[n],h=t[n];for(let c of[h,...((s=h?.dictionary)===null||s===void 0?void 0:s.data)||[]])Mu(a.children,c?.children,r);if(w.isDictionary(a)){let{id:c}=a;if(!r.has(c))h?.dictionary&&r.set(c,h.dictionary);else if(r.get(c)!==h.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return r}var Oi=class extends rt{constructor(t){let r=t.fields.map(s=>C({type:s.type})),i=C({type:new Q(t.fields),nullCount:0,children:r});super(t,i)}};var Gh=e=>`Expected ${W[e]} Message in stream, but was null or length 0.`,Hh=e=>`Header pointer of flatbuffer-encoded ${W[e]} Message is null or length 0.`,xu=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,Iu=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,Ss=class{constructor(t){this.source=t instanceof Sr?t:new Sr(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?lt:t.value===-1&&(t=this.readMetadataLength()).done?lt:(t=this.readMetadata(t.value)).done?lt:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(Gh(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=O(this.source.read(t));if(r.byteLength<t)throw new Error(Iu(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()}readSchema(t=!1){let r=W.Schema,i=this.readMessage(r),s=i?.header();if(t&&!s)throw new Error(Hh(r));return s}readMetadataLength(){let t=this.source.read(ua),r=t&&new Tt(t),i=r?.readInt32(0)||0;return{done:i===0,value:i}}readMetadata(t){let r=this.source.read(t);if(!r)return lt;if(r.byteLength<t)throw new Error(xu(t,r.byteLength));return{done:!1,value:At.decode(r)}}},An=class{constructor(t,r){this.source=t instanceof ye?t:Zn(t)?new ti(t,r):new ye(t)}[Symbol.asyncIterator](){return this}next(){return M(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?lt:t.value===-1&&(t=yield this.readMetadataLength()).done?lt:(t=yield this.readMetadata(t.value)).done?lt:t})}throw(t){return M(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return M(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return M(this,void 0,void 0,function*(){let r;if((r=yield this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(Gh(t));return r.value})}readMessageBody(t){return M(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let r=O(yield this.source.read(t));if(r.byteLength<t)throw new Error(Iu(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()})}readSchema(){return M(this,arguments,void 0,function*(t=!1){let r=W.Schema,i=yield this.readMessage(r),s=i?.header();if(t&&!s)throw new Error(Hh(r));return s})}readMetadataLength(){return M(this,void 0,void 0,function*(){let t=yield this.source.read(ua),r=t&&new Tt(t),i=r?.readInt32(0)||0;return{done:i===0,value:i}})}readMetadata(t){return M(this,void 0,void 0,function*(){let r=yield this.source.read(t);if(!r)return lt;if(r.byteLength<t)throw new Error(xu(t,r.byteLength));return{done:!1,value:At.decode(r)}})}},Bn=class extends Ss{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Zs?t:new Zs(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:At.fromJSON(t.schema,W.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let r=t.dictionaries[this._dictionaryIndex++];return this._body=r.data.columns,{done:!1,value:At.fromJSON(r,W.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let r=t.batches[this._batchIndex++];return this._body=r.columns,{done:!1,value:At.fromJSON(r,W.RecordBatch)}}return this._body=[],lt}readMessageBody(t){return r(this._body);function r(i){return(i||[]).reduce((s,n)=>[...s,...n.VALIDITY&&[n.VALIDITY]||[],...n.TYPE_ID&&[n.TYPE_ID]||[],...n.OFFSET&&[n.OFFSET]||[],...n.DATA&&[n.DATA]||[],...r(n.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(Gh(t));return r.value}readSchema(){let t=W.Schema,r=this.readMessage(t),i=r?.header();if(!r||!i)throw new Error(Hh(t));return i}},ua=4,jh="ARROW1",As=new Uint8Array(jh.length);for(let e=0;e<jh.length;e+=1)As[e]=jh.codePointAt(e);function fa(e,t=0){for(let r=-1,i=As.length;++r<i;)if(As[r]!==e[t+r])return!1;return!0}var Bs=As.length,Wh=Bs+ua,Su=Bs*2+ua;var qh=class{constructor(){this.LZ4_FRAME_MAGIC=new Uint8Array([4,34,77,24]),this.MIN_HEADER_LENGTH=7}isValidCodecEncode(t){let r=new Uint8Array([1,2,3,4,5,6,7,8]),i=t.encode(r);return this._isValidCompressed(i)}_isValidCompressed(t){return this._hasMinimumLength(t)&&this._hasValidMagicNumber(t)&&this._hasValidVersion(t)}_hasMinimumLength(t){return t.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(t){return this.LZ4_FRAME_MAGIC.every((r,i)=>t[i]===r)}_hasValidVersion(t){return(t[4]&192)>>6===1}},$h=class{constructor(){this.ZSTD_MAGIC=new Uint8Array([40,181,47,253]),this.MIN_HEADER_LENGTH=6}isValidCodecEncode(t){let r=new Uint8Array([1,2,3,4,5,6,7,8]),i=t.encode(r);return this._isValidCompressed(i)}_isValidCompressed(t){return this._hasMinimumLength(t)&&this._hasValidMagicNumber(t)}_hasMinimumLength(t){return t.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(t){return this.ZSTD_MAGIC.every((r,i)=>t[i]===r)}},Au={[Jt.LZ4_FRAME]:new qh,[Jt.ZSTD]:new $h};var Jh=class{constructor(){this.registry={}}set(t,r){if(r?.encode&&typeof r.encode=="function"&&!Au[t].isValidCodecEncode(r))throw new Error(`Encoder for ${Jt[t]} is not valid.`);this.registry[t]=r}get(t){var r;return((r=this.registry)===null||r===void 0?void 0:r[t])||null}},Ts=new Jh;var Zt=class extends Bi{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let r=this._impl.open(t);return He(r)?r.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Ut.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Ut.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof Zt?t:Kn(t)?ay(t):Zn(t)?ly(t):He(t)?(()=>M(this,void 0,void 0,function*(){return yield Zt.from(yield t)}))():Qn(t)||js(t)||eo(t)||De(t)?cy(new ye(t)):hy(new Sr(t))}static readAll(t){return t instanceof Zt?t.isSync()?Bu(t):Tu(t):Kn(t)||ArrayBuffer.isView(t)||We(t)||Xn(t)?Bu(t):Tu(t)}},Vr=class extends Zt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return ve(this,arguments,function*(){yield j(yield*Hi(Ge(this[Symbol.iterator]())))})}},Li=class extends Zt{constructor(t){super(t),this._impl=t}readAll(){return M(this,void 0,void 0,function*(){var t,r,i,s;let n=new Array;try{for(var o=!0,a=Ge(this),h;h=yield a.next(),t=h.done,!t;o=!0){s=h.value,o=!1;let c=s;n.push(c)}}catch(c){r={error:c}}finally{try{!o&&!t&&(i=a.return)&&(yield i.call(a))}finally{if(r)throw r.error}}return n})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Fi=class extends Vr{constructor(t){super(t),this._impl=t}},da=class extends Li{constructor(t){super(t),this._impl=t}},pa=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,r){let i;if(t.compression!=null){let n=Ts.get(t.compression.type);if(n?.decode&&typeof n.decode=="function"){let{decommpressedBody:o,buffers:a}=this._decompressBuffers(t,r,n);i=this._loadCompressedVectors(t,o,this.schema.fields),t=new St(t.length,t.nodes,a,null)}else throw new Error("Record batch is compressed but codec not found")}else i=this._loadVectors(t,r,this.schema.fields);let s=C({type:new Q(this.schema.fields),length:t.length,children:i});return new rt(this.schema,s)}_loadDictionaryBatch(t,r){let{id:i,isDelta:s}=t,{dictionaries:n,schema:o}=this,a=n.get(i),h=o.dictionaries.get(i),c;if(t.data.compression!=null){let l=Ts.get(t.data.compression.type);if(l?.decode&&typeof l.decode=="function"){let{decommpressedBody:u,buffers:p}=this._decompressBuffers(t.data,r,l);c=this._loadCompressedVectors(t.data,u,[h]),t=new Wt(new St(t.data.length,t.data.nodes,p,null),i,s)}else throw new Error("Dictionary batch is compressed but codec not found")}else c=this._loadVectors(t.data,r,[h]);return(a&&s?a.concat(new V(c)):new V(c)).memoize()}_loadVectors(t,r,i){return new ws(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}_loadCompressedVectors(t,r,i){return new zo(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}_decompressBuffers(t,r,i){let s=[],n=[],o=0;for(let{offset:a,length:h}of t.buffers){if(h===0){s.push(new Uint8Array(0)),n.push(new It(o,0));continue}let c=new Tt(r.subarray(a,a+h)),l=J(c.readInt64(0)),u=c.bytes().subarray(8),p=l===-1?u:i.decode(u);s.push(p);let f=(o+7&-8)-o;o+=f,n.push(new It(o,p.length)),o+=p.length}return{decommpressedBody:s,buffers:n}}},Ds=class extends pa{constructor(t,r){super(r),this._reader=Kn(t)?new Bn(this._handle=t):new Ss(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=Eu(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):lt}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):lt}next(){if(this.closed)return lt;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),s=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),s=r.readMessageBody(t.bodyLength),n=this._loadDictionaryBatch(i,s);this.dictionaries.set(i.id,n)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Oi(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Es=class extends pa{constructor(t,r){super(r),this._reader=new An(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return M(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return M(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Eu(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return M(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):lt})}return(t){return M(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):lt})}next(){return M(this,void 0,void 0,function*(){if(this.closed)return lt;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),s=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),s=yield r.readMessageBody(t.bodyLength),n=this._loadDictionaryBatch(i,s);this.dictionaries.set(i.id,n)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Oi(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return M(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},ma=class extends Ds{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,r){super(t instanceof Qs?t:new Qs(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(i&&this._handle.seek(i.offset)){let s=this._reader.readMessage(W.RecordBatch);if(s?.isRecordBatch()){let n=s.header(),o=this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(n,o)}}return null}_readDictionaryBatch(t){var r;let i=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(i&&this._handle.seek(i.offset)){let s=this._reader.readMessage(W.DictionaryBatch);if(s?.isDictionaryBatch()){let n=s.header(),o=this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(n,o);this.dictionaries.set(n.id,a)}}}_readFooter(){let{_handle:t}=this,r=t.size-Wh,i=t.readInt32(r),s=t.readAt(r-i,i);return Fr.decode(s)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(this._recordBatchIndex);if(i&&this._handle.seek(i.offset))return this._reader.readMessage(t)}return null}},Yh=class extends Es{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...r){let i=typeof r[0]!="number"?r.shift():void 0,s=r[0]instanceof Map?r.shift():void 0;super(t instanceof ti?t:new ti(t,i),s)}isFile(){return!0}isAsync(){return!0}open(t){let r=Object.create(null,{open:{get:()=>super.open}});return M(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let i of this._footer.dictionaryBatches())i&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){return M(this,void 0,void 0,function*(){var r;if(this.closed)return null;this._footer||(yield this.open());let i=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(i&&(yield this._handle.seek(i.offset))){let s=yield this._reader.readMessage(W.RecordBatch);if(s?.isRecordBatch()){let n=s.header(),o=yield this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(n,o)}}return null})}_readDictionaryBatch(t){return M(this,void 0,void 0,function*(){var r;let i=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(i&&(yield this._handle.seek(i.offset))){let s=yield this._reader.readMessage(W.DictionaryBatch);if(s?.isDictionaryBatch()){let n=s.header(),o=yield this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(n,o);this.dictionaries.set(n.id,a)}}})}_readFooter(){return M(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-Wh,i=yield t.readInt32(r),s=yield t.readAt(r-i,i);return Fr.decode(s)})}_readNextMessageAndValidate(t){return M(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=this._footer.getRecordBatch(this._recordBatchIndex);if(r&&(yield this._handle.seek(r.offset)))return yield this._reader.readMessage(t)}return null})}},Kh=class extends Ds{constructor(t,r){super(t,r)}_loadVectors(t,r,i){return new Vo(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}};function Eu(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*Bu(e){let t=Zt.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Tu(e){return ve(this,arguments,function*(){let r=yield j(Zt.from(e));try{if(!(yield j(r.open({autoDestroy:!1}))).closed)do yield yield j(r);while(!(yield j(r.reset().open())).closed)}finally{yield j(r.cancel())}})}function ay(e){return new Vr(new Kh(e))}function hy(e){let t=e.peek(Bs+7&-8);return t&&t.byteLength>=4?fa(t)?new Fi(new ma(e.read())):new Vr(new Ds(e)):new Vr(new Ds(function*(){}()))}function cy(e){return M(this,void 0,void 0,function*(){let t=yield e.peek(Bs+7&-8);return t&&t.byteLength>=4?fa(t)?new Fi(new ma(yield e.read())):new Li(new Es(e)):new Li(new Es(function(){return ve(this,arguments,function*(){})}()))})}function ly(e){return M(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new ti(e,t);return t>=Su&&fa(yield r.readAt(0,Bs+7&-8))?new da(new Yh(r)):new Li(new Es(r))})}var ft=class extends A{static assemble(...t){let r=s=>s.flatMap(n=>Array.isArray(n)?r(n):n instanceof rt?n.data.children:n.data),i=new ft;return i.visitMany(r(t)),i}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof V)return this.visitMany(t.data),this;let{type:r}=t;if(!w.isDictionary(r)){let{length:i}=t;if(i>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(w.isUnion(r))this.nodes.push(new Ue(i,0));else{let{nullCount:s}=t;w.isNull(r)||tr.call(this,s<=0?new Uint8Array(0):wi(t.offset,i,t.nullBitmap)),this.nodes.push(new Ue(i,s))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function tr(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new It(this._byteLength,t)),this._byteLength+=t,this}function uy(e){var t;let{type:r,length:i,typeIds:s,valueOffsets:n}=e;if(tr.call(this,s),r.mode===ht.Sparse)return Xh.call(this,e);if(r.mode===ht.Dense){if(e.offset<=0)return tr.call(this,n),Xh.call(this,e);{let o=new Int32Array(i),a=Object.create(null),h=Object.create(null);for(let c,l,u=-1;++u<i;)(c=s[u])!==void 0&&((l=a[c])===void 0&&(l=a[c]=n[u]),o[u]=n[u]-l,h[c]=((t=h[c])!==null&&t!==void 0?t:0)+1);tr.call(this,o),this.visitMany(e.children.map((c,l)=>{let u=r.typeIds[l],p=a[u],f=h[u];return c.slice(p,Math.min(i,f))}))}}return this}function fy(e){let t;return e.nullCount>=e.length?tr.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?tr.call(this,wi(e.offset,e.length,t)):tr.call(this,Mi(e.values))}function zr(e){return tr.call(this,e.values.subarray(0,e.length*e.stride))}function ya(e){let{length:t,values:r,valueOffsets:i}=e,s=J(i[0]),n=J(i[t]),o=Math.min(n-s,r.byteLength-s);return tr.call(this,io(-s,t+1,i)),tr.call(this,r.subarray(s,s+o)),this}function Zh(e){let{length:t,valueOffsets:r}=e;if(r){let{[0]:i,[t]:s}=r;return tr.call(this,io(-i,t+1,r)),this.visit(e.children[0].slice(i,s-i))}return this.visit(e.children[0])}function Xh(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}ft.prototype.visitBool=fy;ft.prototype.visitInt=zr;ft.prototype.visitFloat=zr;ft.prototype.visitUtf8=ya;ft.prototype.visitLargeUtf8=ya;ft.prototype.visitBinary=ya;ft.prototype.visitLargeBinary=ya;ft.prototype.visitFixedSizeBinary=zr;ft.prototype.visitDate=zr;ft.prototype.visitTimestamp=zr;ft.prototype.visitTime=zr;ft.prototype.visitDecimal=zr;ft.prototype.visitList=Zh;ft.prototype.visitStruct=Xh;ft.prototype.visitUnion=uy;ft.prototype.visitInterval=zr;ft.prototype.visitDuration=zr;ft.prototype.visitFixedSizeList=Zh;ft.prototype.visitMap=Zh;var Ri=class extends Bi{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}constructor(t){if(super(),this._position=0,this._started=!1,this._compression=null,this._sink=new Ir,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,$t(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1,compressionType:null}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1,t.compressionType!=null){if(this._writeLegacyIpcFormat)throw new Error("Legacy IPC format does not support columnar compression. Use modern IPC format (writeLegacyIpcFormat=false).");if(Object.values(Jt).includes(t.compressionType))this._compression=new Ai(t.compressionType);else{let r=Object.values(Jt).filter(i=>typeof i=="string");throw new Error(`Unsupported compressionType: ${t.compressionType} Available types: ${r.join(", ")}`)}}else this._compression=null}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return He(t)?t.then(r=>this.writeAll(r)):De(t)?tc(this,t):Qh(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,r=null){return t===this._sink||t instanceof Ir?this._sink=t:(this._sink=new Ir,t&&Vc(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&zc(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!r||!Ni(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof pt&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof rt&&!(r=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!Ni(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof rt?t instanceof Oi||this._writeRecordBatch(t):t instanceof pt?this.writeAll(t.batches):We(t)&&this.writeAll(t)}_writeMessage(t,r=8){let i=r-1,s=At.encode(t),n=s.byteLength,o=this._writeLegacyIpcFormat?4:8,a=n+o+i&~i,h=a-n-o;return t.headerType===W.RecordBatch?this._recordBatchBlocks.push(new Qe(a,t.bodyLength,this._position)):t.headerType===W.DictionaryBatch&&this._dictionaryBlocks.push(new Qe(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),n>0&&this._write(s),this._writePadding(h)}_write(t){if(this._started){let r=O(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(At.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(As)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:i,bufferRegions:s,buffers:n}=this._assembleRecordBatch(t),o=new St(t.numRows,i,s,this._compression),a=At.from(o,r);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(n)}_assembleRecordBatch(t){let{byteLength:r,nodes:i,bufferRegions:s,buffers:n}=ft.assemble(t);return this._compression!=null&&({byteLength:r,bufferRegions:s,buffers:n}=this._compressBodyBuffers(n)),{byteLength:r,nodes:i,bufferRegions:s,buffers:n}}_compressBodyBuffers(t){let r=Ts.get(this._compression.type);if(!r?.encode||typeof r.encode!="function")throw new Error(`Codec for compression type "${Jt[this._compression.type]}" has invalid encode method`);let i=0,s=[],n=[];for(let a of t){let h=O(a);if(h.length===0){s.push(new Uint8Array(0),new Uint8Array(0)),n.push(new It(i,0));continue}let c=r.encode(h),l=c.length<h.length,u=l?c:h,p=l?u.length:-1,f=new Tt(new Uint8Array(8));f.writeInt64(0,BigInt(p)),s.push(f.bytes(),new Uint8Array(u));let m=(i+7&-8)-i;i+=m;let g=8+u.length;n.push(new It(i,g)),i+=g}let o=(i+7&-8)-i;return i+=o,{byteLength:i,bufferRegions:n,buffers:s}}_writeDictionaryBatch(t,r,i=!1){let{byteLength:s,nodes:n,bufferRegions:o,buffers:a}=this._assembleRecordBatch(new V([t])),h=new St(t.length,n,o,this._compression),c=new Wt(h,r,i),l=At.from(c,s);return this._writeMessage(l)._writeBodyBuffers(a)}_writeBodyBuffers(t){let r=this._compression!=null?2:1,i=new Array(r);for(let s=0;s<t.length;s+=r){let n=0;for(let a=-1;++a<r;)i[a]=t[s+a],n+=i[a].byteLength;if(n===0)continue;for(let a of i)this._write(a);let o=(n+7&-8)-n;o>0&&this._writePadding(o)}return this}_writeDictionaries(t){var r,i;for(let[s,n]of t.dictionaries){let o=(r=n?.data)!==null&&r!==void 0?r:[],a=this._seenDictionaries.get(s),h=(i=this._dictionaryDeltaOffsets.get(s))!==null&&i!==void 0?i:0;if(!a||a.data[0]!==o[0])for(let[c,l]of o.entries())this._writeDictionaryBatch(l,s,c>0);else if(h<o.length)for(let c of o.slice(h))this._writeDictionaryBatch(c,s,!0);this._seenDictionaries.set(s,n),this._dictionaryDeltaOffsets.set(s,o.length)}return this}},Ci=class extends Ri{static writeAll(t,r){let i=new Ci(r);return He(t)?t.then(s=>i.writeAll(s)):De(t)?tc(i,t):Qh(i,t)}},Ui=class extends Ri{static writeAll(t,r){let i=new Ui(r);return He(t)?t.then(s=>i.writeAll(s)):De(t)?tc(i,t):Qh(i,t)}constructor(t){super(t),this._autoDestroy=!0,this._writeLegacyIpcFormat=!1}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,r,i=!1){if(!i&&this._seenDictionaries.has(r))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,r,i)}_writeFooter(t){let r=Fr.encode(new Fr(t,et.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}};function Qh(e,t){let r=t;t instanceof pt&&(r=t.batches,e.reset(void 0,t.schema));for(let i of r)e.write(i);return e.finish()}function tc(e,t){return M(this,void 0,void 0,function*(){var r,i,s,n,o,a,h;try{for(r=!0,i=Ge(t);s=yield i.next(),n=s.done,!n;r=!0){h=s.value,r=!1;let c=h;e.write(c)}}catch(c){o={error:c}}finally{try{!r&&!n&&(a=i.return)&&(yield a.call(i))}finally{if(o)throw o.error}}return e.finish()})}function Nu(e,t){if(De(e))return py(e,t);if(We(e))return dy(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function dy(e,t){let r=null,i=t?.type==="bytes"||!1,s=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){n(o,r||(r=e[Symbol.iterator]()))},pull(o){r?n(o,r):o.close()},cancel(){r?.return&&r.return(),r=null}}),Object.assign({highWaterMark:i?s:void 0},t));function n(o,a){let h,c=null,l=o.desiredSize||null;for(;!(c=a.next(i?l:null)).done;)if(ArrayBuffer.isView(c.value)&&(h=O(c.value))&&(l!=null&&i&&(l=l-h.byteLength+1),c.value=h),o.enqueue(c.value),l!=null&&--l<=0)return;o.close()}}function py(e,t){let r=null,i=t?.type==="bytes"||!1,s=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){return M(this,void 0,void 0,function*(){yield n(o,r||(r=e[Symbol.asyncIterator]()))})},pull(o){return M(this,void 0,void 0,function*(){r?yield n(o,r):o.close()})},cancel(){return M(this,void 0,void 0,function*(){r?.return&&(yield r.return()),r=null})}}),Object.assign({highWaterMark:i?s:void 0},t));function n(o,a){return M(this,void 0,void 0,function*(){let h,c=null,l=o.desiredSize||null;for(;!(c=yield a.next(i?l:null)).done;)if(ArrayBuffer.isView(c.value)&&(h=O(c.value))&&(l!=null&&i&&(l=l-h.byteLength+1),c.value=h),o.enqueue(c.value),l!=null&&--l<=0)return;o.close()})}}function Fu(e){return new ec(e)}var ec=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:i,["queueingStrategy"]:s="count"}=t,n=Uc(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Ar(n),this._getSize=s!=="bytes"?Ou:Lu;let{["highWaterMark"]:o=s==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r),{["highWaterMark"]:a=s==="bytes"?Math.pow(2,14):1e3}=Object.assign({},i);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:h=>{this._maybeFlush(this._builder,this._controller=h)},start:h=>{this._maybeFlush(this._builder,this._controller=h)}},{highWaterMark:o,size:s!=="bytes"?Ou:Lu}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:h=>this._writeValueAndReturnChunkSize(h)})}_writeValueAndReturnChunkSize(t){let r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},Ou=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},Lu=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function ga(e,t){let r=new Ir,i=null,s=new ReadableStream({cancel(){return M(this,void 0,void 0,function*(){yield r.close()})},start(a){return M(this,void 0,void 0,function*(){yield o(a,i||(i=yield n()))})},pull(a){return M(this,void 0,void 0,function*(){i?yield o(a,i):a.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:s};function n(){return M(this,void 0,void 0,function*(){return yield(yield Zt.from(r)).open(t)})}function o(a,h){return M(this,void 0,void 0,function*(){let c=a.desiredSize,l=null;for(;!(l=yield h.next()).done;)if(a.enqueue(l.value),c!=null&&--c<=0)return;a.close()})}}function _a(e,t){let r=new this(e),i=new ye(r),s=new ReadableStream({cancel(){return M(this,void 0,void 0,function*(){yield i.cancel()})},pull(o){return M(this,void 0,void 0,function*(){yield n(o)})},start(o){return M(this,void 0,void 0,function*(){yield n(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:s};function n(o){return M(this,void 0,void 0,function*(){let a=null,h=o.desiredSize;for(;a=yield i.read(h||null);)if(o.enqueue(a),h!=null&&(h-=a.byteLength)<=0)return;o.close()})}}var Ty=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},ch),Rh),Sh),lh),rh),Ih),nh),Ph),{compareSchemas:Ni,compareFields:gu,compareTypes:_u});Ut.toDOMStream=Nu;ut.throughDOM=Fu;Zt.throughDOM=ga;Fi.throughDOM=ga;Vr.throughDOM=ga;Ri.throughDOM=_a;Ui.throughDOM=_a;Ci.throughDOM=_a;function rc(e){return Cu(e)}function Cu(e){return new H(e.fields.map(t=>Ns(t)),ic(e.metadata))}function ic(e){return e?new Map(Object.entries(e)):new Map}function Ns(e){return new P(e.name,Uu(e.type),e.nullable,ic(e.metadata))}function Uu(e){if(typeof e=="object")switch(e.type){case"decimal":return new Re(e.precision,e.scale,e.bitWidth);case"map":let t=e.children.map(s=>Ns(s));return new de(t,e.keysSorted);case"list":let r=Ns(e.children[0]);return new ue(r);case"fixed-size-list":let i=Ns(e.children[0]);return new fe(e.listSize,i);case"struct":return t=e.children.map(s=>Ns(s)),new Q(t);default:throw new Error("array type not supported")}switch(e){case"null":return new Rt;case"binary":return new Oe;case"bool":return new Fe;case"int8":return new ci;case"int16":return new li;case"int32":return new xe;case"int64":return new ui;case"uint8":return new fi;case"uint16":return new di;case"uint32":return new pi;case"uint64":return new mi;case"float16":return new yi;case"float32":return new gi;case"float64":return new _i;case"utf8":return new Le;case"date-day":return new Xi;case"date-millisecond":return new Zi;case"time-second":return new Qi;case"time-millisecond":return new ts;case"time-microsecond":return new es;case"time-nanosecond":return new rs;case"timestamp-second":return new is;case"timestamp-millisecond":return new ss;case"timestamp-microsecond":return new ns;case"timestamp-nanosecond":return new os;case"interval-daytime":return new as;case"interval-yearmonth":return new hs;default:throw new Error("array type not supported")}}var Tn=class{schema;arrowSchema;arrowBuilders;length;constructor(t){this.schema=t,this.arrowSchema=rc(t),this.arrowBuilders=this.arrowSchema.fields.map(r=>Ar({type:r.type,nullValues:[null]})),this.length=0}addObjectRow(t){for(let r=0;r<this.arrowBuilders.length;r++){let i=this.schema.fields[r].name,s=t[i];this.arrowBuilders[r].append(s)}this.length++}addArrayRow(t){for(let r=0;r<this.arrowBuilders.length;r++)this.arrowBuilders[r].append(t[r]);this.length++}firstBatch(){let t=this._getArrowRecordBatch();return t.numCols!==0?null:{shape:"arrow-table",batchType:"data",length:t.numRows,schema:this.schema,data:new pt(t)}}flushBatch(){let t=this._getArrowRecordBatch();return t.numCols===0?null:{shape:"arrow-table",batchType:"data",length:t.numRows,schema:this.schema,data:new pt(t)}}finishBatch(){let t=this._getArrowRecordBatch();return this.arrowBuilders.forEach(r=>r.finish()),t.numCols===0?null:{shape:"arrow-table",batchType:"data",length:t.numRows,schema:this.schema,data:new pt(t)}}finishTable(){let t=this._getArrowRecordBatch();return this.arrowBuilders.forEach(r=>r.finish()),{shape:"arrow-table",schema:this.schema,data:new pt(t)}}_getArrowRecordBatch(){let{arrowBuilders:t,arrowSchema:r}=this,i=t.map(h=>h.flush()),s=i[0].length,n=new Q(r.fields),o=new q(n,0,s,0,void 0,i);return new rt(r,o)}};function sc(e,t,r){switch(e.type){case"Point":return Ey(e,t,r);case"LineString":return Dy(e,t,r);case"Polygon":return Pu(e,t,r);default:let i=e;throw new Error(`Unsupported geometry type: ${i?.type}`)}}function Pu(e,t=-1/0,r=1/0){let{positions:i}=e,s=e.polygonIndices.value.filter(h=>h>=t&&h<=r),n=e.primitivePolygonIndices.value.filter(h=>h>=t&&h<=r);if(!(s.length>2)){let h=[];for(let c=0;c<n.length-1;c++){let l=n[c],u=n[c+1],p=ba(i,l,u);h.push(p)}return{type:"Polygon",coordinates:h}}let a=[];for(let h=0;h<s.length-1;h++){let c=s[h],l=s[h+1],u=Pu(e,c,l).coordinates;a.push(u)}return{type:"MultiPolygon",coordinates:a}}function Dy(e,t=-1/0,r=1/0){let{positions:i}=e,s=e.pathIndices.value.filter(a=>a>=t&&a<=r);if(!(s.length>2))return{type:"LineString",coordinates:ba(i,s[0],s[1])};let o=[];for(let a=0;a<s.length-1;a++){let h=ba(i,s[a],s[a+1]);o.push(h)}return{type:"MultiLineString",coordinates:o}}function Ey(e,t,r){let{positions:i}=e,s=ba(i,t,r);return s.length>1?{type:"MultiPoint",coordinates:s}:{type:"Point",coordinates:s[0]}}function ba(e,t,r){t=t||0,r=r||e.value.length/e.size;let i=[];for(let s=t;s<r;s++){let n=Array();for(let o=s*e.size;o<(s+1)*e.size;o++)n.push(Number(e.value[o]));i.push(n)}return i}function ku(e){e("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),e("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),e("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),e.WGS84=e["EPSG:4326"],e["EPSG:3785"]=e["EPSG:3857"],e.GOOGLE=e["EPSG:3857"],e["EPSG:900913"]=e["EPSG:3857"],e["EPSG:102113"]=e["EPSG:3857"]}var er=1,rr=2,Vu=4,Dn=5,Pi=484813681109536e-20,y=Math.PI/2,zu=.16666666666666666,ju=.04722222222222222,Gu=.022156084656084655,_=1e-10,Dt=.017453292519943295,ir=57.29577951308232,Y=Math.PI/4,En=Math.PI*2,yt=3.14159265359;var Qt={};Qt.greenwich=0;Qt.lisbon=-9.131906111111;Qt.paris=2.337229166667;Qt.bogota=-74.080916666667;Qt.madrid=-3.687938888889;Qt.rome=12.452333333333;Qt.bern=7.439583333333;Qt.jakarta=106.807719444444;Qt.ferro=-17.666666666667;Qt.brussels=4.367975;Qt.stockholm=18.058277777778;Qt.athens=23.7163375;Qt.oslo=10.722916666667;var Hu={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}};var Wu=/[\s_\-\/\(\)]/g;function Be(e,t){if(e[t])return e[t];for(var r=Object.keys(e),i=t.toLowerCase().replace(Wu,""),s=-1,n,o;++s<r.length;)if(n=r[s],o=n.toLowerCase().replace(Wu,""),o===i)return e[n]}function Nn(e){var t={},r=e.split("+").map(function(a){return a.trim()}).filter(function(a){return a}).reduce(function(a,h){var c=h.split("=");return c.push(!0),a[c[0].toLowerCase()]=c[1],a},{}),i,s,n,o={proj:"projName",datum:"datumCode",rf:function(a){t.rf=parseFloat(a)},lat_0:function(a){t.lat0=a*Dt},lat_1:function(a){t.lat1=a*Dt},lat_2:function(a){t.lat2=a*Dt},lat_ts:function(a){t.lat_ts=a*Dt},lon_0:function(a){t.long0=a*Dt},lon_1:function(a){t.long1=a*Dt},lon_2:function(a){t.long2=a*Dt},alpha:function(a){t.alpha=parseFloat(a)*Dt},lonc:function(a){t.longc=a*Dt},x_0:function(a){t.x0=parseFloat(a)},y_0:function(a){t.y0=parseFloat(a)},k_0:function(a){t.k0=parseFloat(a)},k:function(a){t.k0=parseFloat(a)},a:function(a){t.a=parseFloat(a)},b:function(a){t.b=parseFloat(a)},r_a:function(){t.R_A=!0},zone:function(a){t.zone=parseInt(a,10)},south:function(){t.utmSouth=!0},towgs84:function(a){t.datum_params=a.split(",").map(function(h){return parseFloat(h)})},to_meter:function(a){t.to_meter=parseFloat(a)},units:function(a){t.units=a;var h=Be(Hu,a);h&&(t.to_meter=h.to_meter)},from_greenwich:function(a){t.from_greenwich=a*Dt},pm:function(a){var h=Be(Qt,a);t.from_greenwich=(h||parseFloat(a))*Dt},nadgrids:function(a){a==="@null"?t.datumCode="none":t.nadgrids=a},axis:function(a){var h="ewnsud";a.length===3&&h.indexOf(a.substr(0,1))!==-1&&h.indexOf(a.substr(1,1))!==-1&&h.indexOf(a.substr(2,1))!==-1&&(t.axis=a)}};for(i in r)s=r[i],i in o?(n=o[i],typeof n=="function"?n(s):t[n]=s):t[i]=s;return typeof t.datumCode=="string"&&t.datumCode!=="WGS84"&&(t.datumCode=t.datumCode.toLowerCase()),t}var nc=class{static getId(t){let r=t.find(i=>Array.isArray(i)&&i[0]==="ID");return r&&r.length>=3?{authority:r[1],code:parseInt(r[2],10)}:null}static convertUnit(t,r="unit"){if(!t||t.length<3)return{type:r,name:"unknown",conversion_factor:null};let i=t[1],s=parseFloat(t[2])||null,n=t.find(a=>Array.isArray(a)&&a[0]==="ID"),o=n?{authority:n[1],code:parseInt(n[2],10)}:null;return{type:r,name:i,conversion_factor:s,id:o}}static convertAxis(t){let r=t[1]||"Unknown",i,s=r.match(/^\((.)\)$/);if(s){let c=s[1].toUpperCase();if(c==="E")i="east";else if(c==="N")i="north";else if(c==="U")i="up";else throw new Error(`Unknown axis abbreviation: ${c}`)}else i=t[2]?t[2].toLowerCase():"unknown";let n=t.find(c=>Array.isArray(c)&&c[0]==="ORDER"),o=n?parseInt(n[1],10):null,a=t.find(c=>Array.isArray(c)&&(c[0]==="LENGTHUNIT"||c[0]==="ANGLEUNIT"||c[0]==="SCALEUNIT")),h=this.convertUnit(a);return{name:r,direction:i,unit:h,order:o}}static extractAxes(t){return t.filter(r=>Array.isArray(r)&&r[0]==="AXIS").map(r=>this.convertAxis(r)).sort((r,i)=>(r.order||0)-(i.order||0))}static convert(t,r={}){switch(t[0]){case"PROJCRS":r.type="ProjectedCRS",r.name=t[1],r.base_crs=t.find(f=>Array.isArray(f)&&f[0]==="BASEGEOGCRS")?this.convert(t.find(f=>Array.isArray(f)&&f[0]==="BASEGEOGCRS")):null,r.conversion=t.find(f=>Array.isArray(f)&&f[0]==="CONVERSION")?this.convert(t.find(f=>Array.isArray(f)&&f[0]==="CONVERSION")):null;let i=t.find(f=>Array.isArray(f)&&f[0]==="CS");i&&(r.coordinate_system={type:i[1],axis:this.extractAxes(t)});let s=t.find(f=>Array.isArray(f)&&f[0]==="LENGTHUNIT");if(s){let f=this.convertUnit(s);r.coordinate_system.unit=f}r.id=this.getId(t);break;case"BASEGEOGCRS":case"GEOGCRS":r.type="GeographicCRS",r.name=t[1];let n=t.find(f=>Array.isArray(f)&&(f[0]==="DATUM"||f[0]==="ENSEMBLE"));if(n){let f=this.convert(n);n[0]==="ENSEMBLE"?r.datum_ensemble=f:r.datum=f;let m=t.find(g=>Array.isArray(g)&&g[0]==="PRIMEM");m&&m[1]!=="Greenwich"&&(f.prime_meridian={name:m[1],longitude:parseFloat(m[2])})}r.coordinate_system={type:"ellipsoidal",axis:this.extractAxes(t)},r.id=this.getId(t);break;case"DATUM":r.type="GeodeticReferenceFrame",r.name=t[1],r.ellipsoid=t.find(f=>Array.isArray(f)&&f[0]==="ELLIPSOID")?this.convert(t.find(f=>Array.isArray(f)&&f[0]==="ELLIPSOID")):null;break;case"ENSEMBLE":r.type="DatumEnsemble",r.name=t[1],r.members=t.filter(f=>Array.isArray(f)&&f[0]==="MEMBER").map(f=>({type:"DatumEnsembleMember",name:f[1],id:this.getId(f)}));let o=t.find(f=>Array.isArray(f)&&f[0]==="ENSEMBLEACCURACY");o&&(r.accuracy=parseFloat(o[1]));let a=t.find(f=>Array.isArray(f)&&f[0]==="ELLIPSOID");a&&(r.ellipsoid=this.convert(a)),r.id=this.getId(t);break;case"ELLIPSOID":r.type="Ellipsoid",r.name=t[1],r.semi_major_axis=parseFloat(t[2]),r.inverse_flattening=parseFloat(t[3]);let h=t.find(f=>Array.isArray(f)&&f[0]==="LENGTHUNIT")?this.convert(t.find(f=>Array.isArray(f)&&f[0]==="LENGTHUNIT"),r):null;break;case"CONVERSION":r.type="Conversion",r.name=t[1],r.method=t.find(f=>Array.isArray(f)&&f[0]==="METHOD")?this.convert(t.find(f=>Array.isArray(f)&&f[0]==="METHOD")):null,r.parameters=t.filter(f=>Array.isArray(f)&&f[0]==="PARAMETER").map(f=>this.convert(f));break;case"METHOD":r.type="Method",r.name=t[1],r.id=this.getId(t);break;case"PARAMETER":r.type="Parameter",r.name=t[1],r.value=parseFloat(t[2]),r.unit=this.convertUnit(t.find(f=>Array.isArray(f)&&(f[0]==="LENGTHUNIT"||f[0]==="ANGLEUNIT"||f[0]==="SCALEUNIT"))),r.id=this.getId(t);break;case"BOUNDCRS":r.type="BoundCRS";let c=t.find(f=>Array.isArray(f)&&f[0]==="SOURCECRS");if(c){let f=c.find(m=>Array.isArray(m));r.source_crs=f?this.convert(f):null}let l=t.find(f=>Array.isArray(f)&&f[0]==="TARGETCRS");if(l){let f=l.find(m=>Array.isArray(m));r.target_crs=f?this.convert(f):null}let u=t.find(f=>Array.isArray(f)&&f[0]==="ABRIDGEDTRANSFORMATION");u?r.transformation=this.convert(u):r.transformation=null;break;case"ABRIDGEDTRANSFORMATION":if(r.type="Transformation",r.name=t[1],r.method=t.find(f=>Array.isArray(f)&&f[0]==="METHOD")?this.convert(t.find(f=>Array.isArray(f)&&f[0]==="METHOD")):null,r.parameters=t.filter(f=>Array.isArray(f)&&(f[0]==="PARAMETER"||f[0]==="PARAMETERFILE")).map(f=>{if(f[0]==="PARAMETER")return this.convert(f);if(f[0]==="PARAMETERFILE")return{name:f[1],value:f[2],id:{authority:"EPSG",code:8656}}}),r.parameters.length===7){let f=r.parameters[6];f.name==="Scale difference"&&(f.value=Math.round((f.value-1)*1e12)/1e6)}r.id=this.getId(t);break;case"AXIS":r.coordinate_system||(r.coordinate_system={type:"unspecified",axis:[]}),r.coordinate_system.axis.push(this.convertAxis(t));break;case"LENGTHUNIT":let p=this.convertUnit(t,"LinearUnit");r.coordinate_system&&r.coordinate_system.axis&&r.coordinate_system.axis.forEach(f=>{f.unit||(f.unit=p)}),p.conversion_factor&&p.conversion_factor!==1&&r.semi_major_axis&&(r.semi_major_axis={value:r.semi_major_axis,unit:p});break;default:r.keyword=t[0];break}return r}},va=nc;var oc=class extends va{static convert(t,r={}){return super.convert(t,r),r.coordinate_system&&r.coordinate_system.subtype==="Cartesian"&&delete r.coordinate_system,r.usage&&delete r.usage,r}},qu=oc;var ac=class extends va{static convert(t,r={}){super.convert(t,r);let i=t.find(n=>Array.isArray(n)&&n[0]==="CS");i&&(r.coordinate_system={subtype:i[1],axis:this.extractAxes(t)});let s=t.find(n=>Array.isArray(n)&&n[0]==="USAGE");if(s){let n=s.find(h=>Array.isArray(h)&&h[0]==="SCOPE"),o=s.find(h=>Array.isArray(h)&&h[0]==="AREA"),a=s.find(h=>Array.isArray(h)&&h[0]==="BBOX");r.usage={},n&&(r.usage.scope=n[1]),o&&(r.usage.area=o[1]),a&&(r.usage.bbox=a.slice(1))}return r}},$u=ac;function Ny(e){return e.find(t=>Array.isArray(t)&&t[0]==="USAGE")?"2019":(e.find(t=>Array.isArray(t)&&t[0]==="CS")||e[0]==="BOUNDCRS"||e[0]==="PROJCRS"||e[0]==="GEOGCRS","2015")}function Ju(e){return(Ny(e)==="2019"?$u:qu).convert(e)}function Yu(e){let t=e.toUpperCase();return t.includes("PROJCRS")||t.includes("GEOGCRS")||t.includes("BOUNDCRS")||t.includes("VERTCRS")||t.includes("LENGTHUNIT")||t.includes("ANGLEUNIT")||t.includes("SCALEUNIT")?"WKT2":(t.includes("PROJCS")||t.includes("GEOGCS")||t.includes("LOCAL_CS")||t.includes("VERT_CS")||t.includes("UNIT"),"WKT1")}var Ku=Ry,On=1,Xu=2,Zu=3,wa=4,Qu=5,hc=-1,Oy=/\s/,Ly=/[A-Za-z]/,Fy=/[A-Za-z84_]/,Ma=/[,\]]/,tf=/[\d\.E\-\+]/;function jr(e){if(typeof e!="string")throw new Error("not a string");this.text=e.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=On}jr.prototype.readCharicter=function(){var e=this.text[this.place++];if(this.state!==wa)for(;Oy.test(e);){if(this.place>=this.text.length)return;e=this.text[this.place++]}switch(this.state){case On:return this.neutral(e);case Xu:return this.keyword(e);case wa:return this.quoted(e);case Qu:return this.afterquote(e);case Zu:return this.number(e);case hc:return}};jr.prototype.afterquote=function(e){if(e==='"'){this.word+='"',this.state=wa;return}if(Ma.test(e)){this.word=this.word.trim(),this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in afterquote yet, index '+this.place)};jr.prototype.afterItem=function(e){if(e===","){this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=On;return}if(e==="]"){this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=On,this.currentObject=this.stack.pop(),this.currentObject||(this.state=hc);return}};jr.prototype.number=function(e){if(tf.test(e)){this.word+=e;return}if(Ma.test(e)){this.word=parseFloat(this.word),this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in number yet, index '+this.place)};jr.prototype.quoted=function(e){if(e==='"'){this.state=Qu;return}this.word+=e};jr.prototype.keyword=function(e){if(Fy.test(e)){this.word+=e;return}if(e==="["){var t=[];t.push(this.word),this.level++,this.root===null?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,this.state=On;return}if(Ma.test(e)){this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in keyword yet, index '+this.place)};jr.prototype.neutral=function(e){if(Ly.test(e)){this.word=e,this.state=Xu;return}if(e==='"'){this.word="",this.state=wa;return}if(tf.test(e)){this.word=e,this.state=Zu;return}if(Ma.test(e)){this.afterItem(e);return}throw new Error(`havn't handled "`+e+'" in neutral yet, index '+this.place)};jr.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===hc)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};function Ry(e){var t=new jr(e);return t.output()}function cc(e,t,r){Array.isArray(t)&&(r.unshift(t),t=null);var i=t?{}:e,s=r.reduce(function(n,o){return ki(o,n),n},i);t&&(e[t]=s)}function ki(e,t){if(!Array.isArray(e)){t[e]=!0;return}var r=e.shift();if(r==="PARAMETER"&&(r=e.shift()),e.length===1){if(Array.isArray(e[0])){t[r]={},ki(e[0],t[r]);return}t[r]=e[0];return}if(!e.length){t[r]=!0;return}if(r==="TOWGS84"){t[r]=e;return}if(r==="AXIS"){r in t||(t[r]=[]),t[r].push(e);return}Array.isArray(r)||(t[r]={});var i;switch(r){case"UNIT":case"PRIMEM":case"VERT_DATUM":t[r]={name:e[0].toLowerCase(),convert:e[1]},e.length===3&&ki(e[2],t[r]);return;case"SPHEROID":case"ELLIPSOID":t[r]={name:e[0],a:e[1],rf:e[2]},e.length===4&&ki(e[3],t[r]);return;case"EDATUM":case"ENGINEERINGDATUM":case"LOCAL_DATUM":case"DATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":e[0]=["name",e[0]],cc(t,r,e);return;case"COMPD_CS":case"COMPOUNDCRS":case"FITTED_CS":case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"ENGCRS":case"ENGINEERINGCRS":e[0]=["name",e[0]],cc(t,r,e),t[r].type=r;return;default:for(i=-1;++i<e.length;)if(!Array.isArray(e[i]))return ki(e,t[r]);return cc(t,r,e)}}var Cy=.017453292519943295;function ke(e){return e*Cy}function xa(e){let t=(e.projName||"").toLowerCase().replace(/_/g," ");!e.long0&&e.longc&&(t==="albers conic equal area"||t==="lambert azimuthal equal area")&&(e.long0=e.longc),!e.lat_ts&&e.lat1&&(t==="stereographic south pole"||t==="polar stereographic (variant b)")?(e.lat0=ke(e.lat1>0?90:-90),e.lat_ts=e.lat1,delete e.lat1):!e.lat_ts&&e.lat0&&(t==="polar stereographic"||t==="polar stereographic (variant a)")&&(e.lat_ts=e.lat0,e.lat0=ke(e.lat0>0?90:-90),delete e.lat1)}function ef(e){let t={units:null,to_meter:void 0};return typeof e=="string"?(t.units=e.toLowerCase(),t.units==="metre"&&(t.units="meter"),t.units==="meter"&&(t.to_meter=1)):e&&e.name&&(t.units=e.name.toLowerCase(),t.units==="metre"&&(t.units="meter"),t.to_meter=e.conversion_factor),t}function rf(e){return typeof e=="object"?e.value*e.unit.conversion_factor:e}function sf(e,t){e.ellipsoid.radius?(t.a=e.ellipsoid.radius,t.rf=0):(t.a=rf(e.ellipsoid.semi_major_axis),e.ellipsoid.inverse_flattening!==void 0?t.rf=e.ellipsoid.inverse_flattening:e.ellipsoid.semi_major_axis!==void 0&&e.ellipsoid.semi_minor_axis!==void 0&&(t.rf=t.a/(t.a-rf(e.ellipsoid.semi_minor_axis))))}function Ln(e,t={}){return!e||typeof e!="object"?e:e.type==="BoundCRS"?(Ln(e.source_crs,t),e.transformation&&(e.transformation.method&&e.transformation.method.name==="NTv2"?t.nadgrids=e.transformation.parameters[0].value:t.datum_params=e.transformation.parameters.map(r=>r.value)),t):(Object.keys(e).forEach(r=>{let i=e[r];if(i!==null)switch(r){case"name":if(t.srsCode)break;t.name=i,t.srsCode=i;break;case"type":i==="GeographicCRS"?t.projName="longlat":i==="ProjectedCRS"&&e.conversion&&e.conversion.method&&(t.projName=e.conversion.method.name);break;case"datum":case"datum_ensemble":i.ellipsoid&&(t.ellps=i.ellipsoid.name,sf(i,t)),i.prime_meridian&&(t.from_greenwich=i.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":t.ellps=i.name,sf(i,t);break;case"prime_meridian":t.long0=(i.longitude||0)*Math.PI/180;break;case"coordinate_system":if(i.axis){if(t.axis=i.axis.map(s=>{let n=s.direction;if(n==="east")return"e";if(n==="north")return"n";if(n==="west")return"w";if(n==="south")return"s";throw new Error(`Unknown axis direction: ${n}`)}).join("")+"u",i.unit){let{units:s,to_meter:n}=ef(i.unit);t.units=s,t.to_meter=n}else if(i.axis[0]&&i.axis[0].unit){let{units:s,to_meter:n}=ef(i.axis[0].unit);t.units=s,t.to_meter=n}}break;case"id":i.authority&&i.code&&(t.title=i.authority+":"+i.code);break;case"conversion":i.method&&i.method.name&&(t.projName=i.method.name),i.parameters&&i.parameters.forEach(s=>{let n=s.name.toLowerCase().replace(/\s+/g,"_"),o=s.value;s.unit&&s.unit.conversion_factor?t[n]=o*s.unit.conversion_factor:s.unit==="degree"?t[n]=o*Math.PI/180:t[n]=o});break;case"unit":i.name&&(t.units=i.name.toLowerCase(),t.units==="metre"&&(t.units="meter")),i.conversion_factor&&(t.to_meter=i.conversion_factor);break;case"base_crs":Ln(i,t),t.datumCode=i.id?i.id.authority+"_"+i.id.code:i.name;break;default:break}}),t.latitude_of_false_origin!==void 0&&(t.lat0=t.latitude_of_false_origin),t.longitude_of_false_origin!==void 0&&(t.long0=t.longitude_of_false_origin),t.latitude_of_standard_parallel!==void 0&&(t.lat0=t.latitude_of_standard_parallel,t.lat1=t.latitude_of_standard_parallel),t.latitude_of_1st_standard_parallel!==void 0&&(t.lat1=t.latitude_of_1st_standard_parallel),t.latitude_of_2nd_standard_parallel!==void 0&&(t.lat2=t.latitude_of_2nd_standard_parallel),t.latitude_of_projection_centre!==void 0&&(t.lat0=t.latitude_of_projection_centre),t.longitude_of_projection_centre!==void 0&&(t.longc=t.longitude_of_projection_centre),t.easting_at_false_origin!==void 0&&(t.x0=t.easting_at_false_origin),t.northing_at_false_origin!==void 0&&(t.y0=t.northing_at_false_origin),t.latitude_of_natural_origin!==void 0&&(t.lat0=t.latitude_of_natural_origin),t.longitude_of_natural_origin!==void 0&&(t.long0=t.longitude_of_natural_origin),t.longitude_of_origin!==void 0&&(t.long0=t.longitude_of_origin),t.false_easting!==void 0&&(t.x0=t.false_easting),t.easting_at_projection_centre&&(t.x0=t.easting_at_projection_centre),t.false_northing!==void 0&&(t.y0=t.false_northing),t.northing_at_projection_centre&&(t.y0=t.northing_at_projection_centre),t.standard_parallel_1!==void 0&&(t.lat1=t.standard_parallel_1),t.standard_parallel_2!==void 0&&(t.lat2=t.standard_parallel_2),t.scale_factor_at_natural_origin!==void 0&&(t.k0=t.scale_factor_at_natural_origin),t.scale_factor_at_projection_centre!==void 0&&(t.k0=t.scale_factor_at_projection_centre),t.scale_factor_on_pseudo_standard_parallel!==void 0&&(t.k0=t.scale_factor_on_pseudo_standard_parallel),t.azimuth!==void 0&&(t.alpha=t.azimuth),t.azimuth_at_projection_centre!==void 0&&(t.alpha=t.azimuth_at_projection_centre),t.angle_from_rectified_to_skew_grid&&(t.rectified_grid_angle=t.angle_from_rectified_to_skew_grid),xa(t),t)}var Uy=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function Py(e,t){var r=t[0],i=t[1];!(r in e)&&i in e&&(e[r]=e[i],t.length===3&&(e[r]=t[2](e[r])))}function nf(e){for(var t=Object.keys(e),r=0,i=t.length;r<i;++r){var s=t[r];Uy.indexOf(s)!==-1&&ky(e[s]),typeof e[s]=="object"&&nf(e[s])}}function ky(e){if(e.AUTHORITY){var t=Object.keys(e.AUTHORITY)[0];t&&t in e.AUTHORITY&&(e.title=t+":"+e.AUTHORITY[t])}if(e.type==="GEOGCS"?e.projName="longlat":e.type==="LOCAL_CS"?(e.projName="identity",e.local=!0):typeof e.PROJECTION=="object"?e.projName=Object.keys(e.PROJECTION)[0]:e.projName=e.PROJECTION,e.AXIS){for(var r="",i=0,s=e.AXIS.length;i<s;++i){var n=[e.AXIS[i][0].toLowerCase(),e.AXIS[i][1].toLowerCase()];n[0].indexOf("north")!==-1||(n[0]==="y"||n[0]==="lat")&&n[1]==="north"?r+="n":n[0].indexOf("south")!==-1||(n[0]==="y"||n[0]==="lat")&&n[1]==="south"?r+="s":n[0].indexOf("east")!==-1||(n[0]==="x"||n[0]==="lon")&&n[1]==="east"?r+="e":(n[0].indexOf("west")!==-1||(n[0]==="x"||n[0]==="lon")&&n[1]==="west")&&(r+="w")}r.length===2&&(r+="u"),r.length===3&&(e.axis=r)}e.UNIT&&(e.units=e.UNIT.name.toLowerCase(),e.units==="metre"&&(e.units="meter"),e.UNIT.convert&&(e.type==="GEOGCS"?e.DATUM&&e.DATUM.SPHEROID&&(e.to_meter=e.UNIT.convert*e.DATUM.SPHEROID.a):e.to_meter=e.UNIT.convert));var o=e.GEOGCS;e.type==="GEOGCS"&&(o=e),o&&(o.DATUM?e.datumCode=o.DATUM.name.toLowerCase():e.datumCode=o.name.toLowerCase(),e.datumCode.slice(0,2)==="d_"&&(e.datumCode=e.datumCode.slice(2)),e.datumCode==="new_zealand_1949"&&(e.datumCode="nzgd49"),(e.datumCode==="wgs_1984"||e.datumCode==="world_geodetic_system_1984")&&(e.PROJECTION==="Mercator_Auxiliary_Sphere"&&(e.sphere=!0),e.datumCode="wgs84"),e.datumCode==="belge_1972"&&(e.datumCode="rnb72"),o.DATUM&&o.DATUM.SPHEROID&&(e.ellps=o.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),e.ellps.toLowerCase().slice(0,13)==="international"&&(e.ellps="intl"),e.a=o.DATUM.SPHEROID.a,e.rf=parseFloat(o.DATUM.SPHEROID.rf,10)),o.DATUM&&o.DATUM.TOWGS84&&(e.datum_params=o.DATUM.TOWGS84),~e.datumCode.indexOf("osgb_1936")&&(e.datumCode="osgb36"),~e.datumCode.indexOf("osni_1952")&&(e.datumCode="osni52"),(~e.datumCode.indexOf("tm65")||~e.datumCode.indexOf("geodetic_datum_of_1965"))&&(e.datumCode="ire65"),e.datumCode==="ch1903+"&&(e.datumCode="ch1903"),~e.datumCode.indexOf("israel")&&(e.datumCode="isr93")),e.b&&!isFinite(e.b)&&(e.b=e.a),e.rectified_grid_angle&&(e.rectified_grid_angle=ke(e.rectified_grid_angle));function a(l){var u=e.to_meter||1;return l*u}var h=function(l){return Py(e,l)},c=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",ke],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",ke],["x0","false_easting",a],["y0","false_northing",a],["long0","central_meridian",ke],["lat0","latitude_of_origin",ke],["lat0","standard_parallel_1",ke],["lat1","standard_parallel_1",ke],["lat2","standard_parallel_2",ke],["azimuth","Azimuth"],["alpha","azimuth",ke],["srsCode","name"]];c.forEach(h),xa(e)}function Ia(e){if(typeof e=="object")return Ln(e);let t=Yu(e);var r=Ku(e);if(t==="WKT2"){let n=Ju(r);return Ln(n)}var i=r[0],s={};return ki(r,s),nf(s),s[i]}function Ve(e){var t=this;if(arguments.length===2){var r=arguments[1];typeof r=="string"?r.charAt(0)==="+"?Ve[e]=Nn(arguments[1]):Ve[e]=Ia(arguments[1]):Ve[e]=r}else if(arguments.length===1){if(Array.isArray(e))return e.map(function(i){Array.isArray(i)?Ve.apply(t,i):Ve(i)});if(typeof e=="string"){if(e in Ve)return Ve[e]}else"EPSG"in e?Ve["EPSG:"+e.EPSG]=e:"ESRI"in e?Ve["ESRI:"+e.ESRI]=e:"IAU2000"in e?Ve["IAU2000:"+e.IAU2000]=e:console.log(e);return}}ku(Ve);var Os=Ve;function Vy(e){return typeof e=="string"}function zy(e){return e in Os}var jy=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function Gy(e){return jy.some(function(t){return e.indexOf(t)>-1})}var Hy=["3857","900913","3785","102113"];function Wy(e){var t=Be(e,"authority");if(t){var r=Be(t,"epsg");return r&&Hy.indexOf(r)>-1}}function qy(e){var t=Be(e,"extension");if(t)return Be(t,"proj4")}function $y(e){return e[0]==="+"}function Jy(e){if(Vy(e)){if(zy(e))return Os[e];if(Gy(e)){var t=Ia(e);if(Wy(t))return Os["EPSG:3857"];var r=qy(t);return r?Nn(r):t}if($y(e))return Nn(e)}else return e}var of=Jy;function lc(e,t){e=e||{};var r,i;if(!t)return e;for(i in t)r=t[i],r!==void 0&&(e[i]=r);return e}function qt(e,t,r){var i=e*t;return r/Math.sqrt(1-i*i)}function Tr(e){return e<0?-1:1}function b(e){return Math.abs(e)<=yt?e:e-Tr(e)*En}function te(e,t,r){var i=e*r,s=.5*e;return i=Math.pow((1-i)/(1+i),s),Math.tan(.5*(y-t))/i}function Gr(e,t){for(var r=.5*e,i,s,n=y-2*Math.atan(t),o=0;o<=15;o++)if(i=e*Math.sin(n),s=y-2*Math.atan(t*Math.pow((1-i)/(1+i),r))-n,n+=s,Math.abs(s)<=1e-10)return n;return-9999}function Yy(){var e=this.b/this.a;this.es=1-e*e,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=qt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function Ky(e){var t=e.x,r=e.y;if(r*ir>90&&r*ir<-90&&t*ir>180&&t*ir<-180)return null;var i,s;if(Math.abs(Math.abs(r)-y)<=_)return null;if(this.sphere)i=this.x0+this.a*this.k0*b(t-this.long0),s=this.y0+this.a*this.k0*Math.log(Math.tan(Y+.5*r));else{var n=Math.sin(r),o=te(this.e,r,n);i=this.x0+this.a*this.k0*b(t-this.long0),s=this.y0-this.a*this.k0*Math.log(o)}return e.x=i,e.y=s,e}function Xy(e){var t=e.x-this.x0,r=e.y-this.y0,i,s;if(this.sphere)s=y-2*Math.atan(Math.exp(-r/(this.a*this.k0)));else{var n=Math.exp(-r/(this.a*this.k0));if(s=Gr(this.e,n),s===-9999)return null}return i=b(this.long0+t/(this.a*this.k0)),e.x=i,e.y=s,e}var Zy=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"],af={init:Yy,forward:Ky,inverse:Xy,names:Zy};function Qy(){}function hf(e){return e}var t0=["longlat","identity"],cf={init:Qy,forward:hf,inverse:hf,names:t0};var e0=[af,cf],Sa={},Aa=[];function lf(e,t){var r=Aa.length;return e.names?(Aa[r]=e,e.names.forEach(function(i){Sa[i.toLowerCase()]=r}),this):(console.log(t),!0)}function r0(e){if(!e)return!1;var t=e.toLowerCase();if(typeof Sa[t]<"u"&&Aa[Sa[t]])return Aa[Sa[t]]}function i0(){e0.forEach(lf)}var uf={start:i0,add:lf,get:r0};var z={};z.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"};z.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"};z.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"};z.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"};z.airy={a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"};z.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"};z.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"};z.mod_airy={a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"};z.andrae={a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"};z.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"};z.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"};z.bessel={a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"};z.bess_nam={a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"};z.clrk66={a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"};z.clrk80={a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."};z.clrk58={a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"};z.CPM={a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"};z.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"};z.engelis={a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"};z.evrst30={a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"};z.evrst48={a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"};z.evrst56={a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"};z.evrst69={a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"};z.evrstSS={a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"};z.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"};z.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"};z.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"};z.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"};z.hough={a:6378270,rf:297,ellipseName:"Hough"};z.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"};z.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"};z.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"};z.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"};z.new_intl={a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"};z.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"};z.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"};z.SEasia={a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"};z.walbeck={a:6376896,b:63558348467e-4,ellipseName:"Walbeck"};z.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"};z.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"};z.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"};var ff=z.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};z.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};function df(e,t,r,i){var s=e*e,n=t*t,o=(s-n)/s,a=0;i?(e*=1-o*(zu+o*(ju+o*Gu)),s=e*e,o=0):a=Math.sqrt(o);var h=(s-n)/n;return{es:o,e:a,ep2:h}}function pf(e,t,r,i,s){if(!e){var n=Be(z,i);n||(n=ff),e=n.a,t=n.b,r=n.rf}return r&&!t&&(t=(1-1/r)*e),(r===0||Math.abs(e-t)<_)&&(s=!0,t=e),{a:e,b:t,rf:r,sphere:s}}var Et={};Et.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"};Et.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"};Et.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"};Et.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"};Et.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"};Et.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"};Et.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"};Et.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"};Et.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"};Et.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"};Et.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"};Et.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"};Et.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"};Et.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"};Et.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"};Et.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"};Et.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};function s0(e,t,r,i,s,n){var o={};return e===void 0||e==="none"?o.datum_type=Dn:o.datum_type=Vu,t&&(o.datum_params=t.map(parseFloat),(o.datum_params[0]!==0||o.datum_params[1]!==0||o.datum_params[2]!==0)&&(o.datum_type=er),o.datum_params.length>3&&(o.datum_params[3]!==0||o.datum_params[4]!==0||o.datum_params[5]!==0||o.datum_params[6]!==0)&&(o.datum_type=rr,o.datum_params[3]*=Pi,o.datum_params[4]*=Pi,o.datum_params[5]*=Pi,o.datum_params[6]=o.datum_params[6]/1e6+1)),o.a=r,o.b=i,o.es=s,o.ep2=n,o}var mf=s0;function Ls(e,t){if(!(this instanceof Ls))return new Ls(e);t=t||function(h){if(h)throw h};var r=of(e);if(typeof r!="object"){t(e);return}var i=Ls.projections.get(r.projName);if(!i){t(e);return}if(r.datumCode&&r.datumCode!=="none"){var s=Be(Et,r.datumCode);s&&(r.datum_params=s.towgs84?s.towgs84.split(","):null,r.ellps=s.ellipse,r.datumName=s.datumName?s.datumName:r.datumCode)}r.k0=r.k0||1,r.axis=r.axis||"enu",r.ellps=r.ellps||"wgs84";var n=pf(r.a,r.b,r.rf,r.ellps,r.sphere),o=df(n.a,n.b,n.rf,r.R_A),a=r.datum||mf(r.datumCode,r.datum_params,n.a,n.b,o.es,o.ep2);lc(this,r),lc(this,i),this.a=n.a,this.b=n.b,this.rf=n.rf,this.sphere=n.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=a,this.init(),t(null,this)}Ls.projections=uf;Ls.projections.start();var ri=Ls;function yf(e,t){return e.datum_type!==t.datum_type||e.a!==t.a||Math.abs(e.es-t.es)>5e-11?!1:e.datum_type===er?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]:e.datum_type===rr?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]&&e.datum_params[3]===t.datum_params[3]&&e.datum_params[4]===t.datum_params[4]&&e.datum_params[5]===t.datum_params[5]&&e.datum_params[6]===t.datum_params[6]:!0}function Ba(e,t,r){var i=e.x,s=e.y,n=e.z?e.z:0,o,a,h,c;if(s<-y&&s>-1.001*y)s=-y;else if(s>y&&s<1.001*y)s=y;else{if(s<-y)return{x:-1/0,y:-1/0,z:e.z};if(s>y)return{x:1/0,y:1/0,z:e.z}}return i>Math.PI&&(i-=2*Math.PI),a=Math.sin(s),c=Math.cos(s),h=a*a,o=r/Math.sqrt(1-t*h),{x:(o+n)*c*Math.cos(i),y:(o+n)*c*Math.sin(i),z:(o*(1-t)+n)*a}}function Ta(e,t,r,i){var s=1e-12,n=s*s,o=30,a,h,c,l,u,p,f,m,g,v,I,k,$,ot=e.x,Z=e.y,tt=e.z?e.z:0,Vt,_t,or;if(a=Math.sqrt(ot*ot+Z*Z),h=Math.sqrt(ot*ot+Z*Z+tt*tt),a/r<s){if(Vt=0,h/r<s)return _t=y,or=-i,{x:e.x,y:e.y,z:e.z}}else Vt=Math.atan2(Z,ot);c=tt/h,l=a/h,u=1/Math.sqrt(1-t*(2-t)*l*l),m=l*(1-t)*u,g=c*u,$=0;do $++,f=r/Math.sqrt(1-t*g*g),or=a*m+tt*g-f*(1-t*g*g),p=t*f/(f+or),u=1/Math.sqrt(1-p*(2-p)*l*l),v=l*(1-p)*u,I=c*u,k=I*m-v*g,m=v,g=I;while(k*k>n&&$<o);return _t=Math.atan(I/Math.abs(v)),{x:Vt,y:_t,z:or}}function gf(e,t,r){if(t===er)return{x:e.x+r[0],y:e.y+r[1],z:e.z+r[2]};if(t===rr){var i=r[0],s=r[1],n=r[2],o=r[3],a=r[4],h=r[5],c=r[6];return{x:c*(e.x-h*e.y+a*e.z)+i,y:c*(h*e.x+e.y-o*e.z)+s,z:c*(-a*e.x+o*e.y+e.z)+n}}}function _f(e,t,r){if(t===er)return{x:e.x-r[0],y:e.y-r[1],z:e.z-r[2]};if(t===rr){var i=r[0],s=r[1],n=r[2],o=r[3],a=r[4],h=r[5],c=r[6],l=(e.x-i)/c,u=(e.y-s)/c,p=(e.z-n)/c;return{x:l+h*u-a*p,y:-h*l+u+o*p,z:a*l-o*u+p}}}function Da(e){return e===er||e===rr}function bf(e,t,r){return yf(e,t)||e.datum_type===Dn||t.datum_type===Dn||e.es===t.es&&e.a===t.a&&!Da(e.datum_type)&&!Da(t.datum_type)?r:(r=Ba(r,e.es,e.a),Da(e.datum_type)&&(r=gf(r,e.datum_type,e.datum_params)),Da(t.datum_type)&&(r=_f(r,t.datum_type,t.datum_params)),Ta(r,t.es,t.a,t.b))}function uc(e,t,r){var i=r.x,s=r.y,n=r.z||0,o,a,h,c={};for(h=0;h<3;h++)if(!(t&&h===2&&r.z===void 0))switch(h===0?(o=i,"ew".indexOf(e.axis[h])!==-1?a="x":a="y"):h===1?(o=s,"ns".indexOf(e.axis[h])!==-1?a="y":a="x"):(o=n,a="z"),e.axis[h]){case"e":case"w":case"n":case"s":c[a]=o;break;case"u":r[a]!==void 0&&(c.z=o);break;case"d":r[a]!==void 0&&(c.z=-o);break;default:return null}return c}function Ea(e){var t={x:e[0],y:e[1]};return e.length>2&&(t.z=e[2]),e.length>3&&(t.m=e[3]),t}function wf(e){vf(e.x),vf(e.y)}function vf(e){if(typeof Number.isFinite=="function"){if(Number.isFinite(e))return;throw new TypeError("coordinates must be finite numbers")}if(typeof e!="number"||e!==e||!isFinite(e))throw new TypeError("coordinates must be finite numbers")}function n0(e,t){return(e.datum.datum_type===er||e.datum.datum_type===rr)&&t.datumCode!=="WGS84"||(t.datum.datum_type===er||t.datum.datum_type===rr)&&e.datumCode!=="WGS84"}function Vi(e,t,r){var i;if(Array.isArray(r)&&(r=Ea(r)),wf(r),e.datum&&t.datum&&n0(e,t)&&(i=new ri("WGS84"),r=Vi(e,i,r),e=i),e.axis!=="enu"&&(r=uc(e,!1,r)),e.projName==="longlat")r={x:r.x*Dt,y:r.y*Dt,z:r.z||0};else if(e.to_meter&&(r={x:r.x*e.to_meter,y:r.y*e.to_meter,z:r.z||0}),r=e.inverse(r),!r)return;return e.from_greenwich&&(r.x+=e.from_greenwich),r=bf(e.datum,t.datum,r),t.from_greenwich&&(r={x:r.x-t.from_greenwich,y:r.y,z:r.z||0}),t.projName==="longlat"?r={x:r.x*ir,y:r.y*ir,z:r.z||0}:(r=t.forward(r),t.to_meter&&(r={x:r.x/t.to_meter,y:r.y/t.to_meter,z:r.z||0})),t.axis!=="enu"?uc(t,!0,r):r}var Mf=ri("WGS84");function fc(e,t,r){var i,s,n;return Array.isArray(r)?(i=Vi(e,t,r)||{x:NaN,y:NaN},r.length>2?typeof e.name<"u"&&e.name==="geocent"||typeof t.name<"u"&&t.name==="geocent"?typeof i.z=="number"?[i.x,i.y,i.z].concat(r.splice(3)):[i.x,i.y,r[2]].concat(r.splice(3)):[i.x,i.y].concat(r.splice(2)):[i.x,i.y]):(s=Vi(e,t,r),n=Object.keys(r),n.length===2||n.forEach(function(o){if(typeof e.name<"u"&&e.name==="geocent"||typeof t.name<"u"&&t.name==="geocent"){if(o==="x"||o==="y"||o==="z")return}else if(o==="x"||o==="y")return;s[o]=r[o]}),s)}function xf(e){return e instanceof ri?e:e.oProj?e.oProj:ri(e)}function o0(e,t,r){e=xf(e);var i=!1,s;return typeof t>"u"?(t=e,e=Mf,i=!0):(typeof t.x<"u"||Array.isArray(t))&&(r=t,t=e,e=Mf,i=!0),t=xf(t),r?fc(e,t,r):(s={forward:function(n){return fc(e,t,n)},inverse:function(n){return fc(t,e,n)}},i&&(s.oProj=t),s)}var Te=o0;var If=6,Af="AJSAJS",Bf="AFAFAF",Fs=65,_e=73,ze=79,Fn=86,Rn=90,Tf={forward:pc,inverse:a0,toPoint:mc};function pc(e,t){return t=t||5,l0(h0({lat:e[1],lon:e[0]}),t)}function a0(e){var t=yc(Ef(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]}function mc(e){var t=yc(Ef(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function dc(e){return e*(Math.PI/180)}function Sf(e){return 180*(e/Math.PI)}function h0(e){var t=e.lat,r=e.lon,i=6378137,s=.00669438,n=.9996,o,a,h,c,l,u,p,f=dc(t),m=dc(r),g,v;v=Math.floor((r+180)/6)+1,r===180&&(v=60),t>=56&&t<64&&r>=3&&r<12&&(v=32),t>=72&&t<84&&(r>=0&&r<9?v=31:r>=9&&r<21?v=33:r>=21&&r<33?v=35:r>=33&&r<42&&(v=37)),o=(v-1)*6-180+3,g=dc(o),a=s/(1-s),h=i/Math.sqrt(1-s*Math.sin(f)*Math.sin(f)),c=Math.tan(f)*Math.tan(f),l=a*Math.cos(f)*Math.cos(f),u=Math.cos(f)*(m-g),p=i*((1-s/4-3*s*s/64-5*s*s*s/256)*f-(3*s/8+3*s*s/32+45*s*s*s/1024)*Math.sin(2*f)+(15*s*s/256+45*s*s*s/1024)*Math.sin(4*f)-35*s*s*s/3072*Math.sin(6*f));var I=n*h*(u+(1-c+l)*u*u*u/6+(5-18*c+c*c+72*l-58*a)*u*u*u*u*u/120)+5e5,k=n*(p+h*Math.tan(f)*(u*u/2+(5-c+9*l+4*l*l)*u*u*u*u/24+(61-58*c+c*c+600*l-330*a)*u*u*u*u*u*u/720));return t<0&&(k+=1e7),{northing:Math.round(k),easting:Math.round(I),zoneNumber:v,zoneLetter:c0(t)}}function yc(e){var t=e.northing,r=e.easting,i=e.zoneLetter,s=e.zoneNumber;if(s<0||s>60)return null;var n=.9996,o=6378137,a=.00669438,h,c=(1-Math.sqrt(1-a))/(1+Math.sqrt(1-a)),l,u,p,f,m,g,v,I,k,$=r-5e5,ot=t;i<"N"&&(ot-=1e7),v=(s-1)*6-180+3,h=a/(1-a),g=ot/n,I=g/(o*(1-a/4-3*a*a/64-5*a*a*a/256)),k=I+(3*c/2-27*c*c*c/32)*Math.sin(2*I)+(21*c*c/16-55*c*c*c*c/32)*Math.sin(4*I)+151*c*c*c/96*Math.sin(6*I),l=o/Math.sqrt(1-a*Math.sin(k)*Math.sin(k)),u=Math.tan(k)*Math.tan(k),p=h*Math.cos(k)*Math.cos(k),f=o*(1-a)/Math.pow(1-a*Math.sin(k)*Math.sin(k),1.5),m=$/(l*n);var Z=k-l*Math.tan(k)/f*(m*m/2-(5+3*u+10*p-4*p*p-9*h)*m*m*m*m/24+(61+90*u+298*p+45*u*u-252*h-3*p*p)*m*m*m*m*m*m/720);Z=Sf(Z);var tt=(m-(1+2*u+p)*m*m*m/6+(5-2*p+28*u-3*p*p+8*h+24*u*u)*m*m*m*m*m/120)/Math.cos(k);tt=v+Sf(tt);var Vt;if(e.accuracy){var _t=yc({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});Vt={top:_t.lat,right:_t.lon,bottom:Z,left:tt}}else Vt={lat:Z,lon:tt};return Vt}function c0(e){var t="Z";return 84>=e&&e>=72?t="X":72>e&&e>=64?t="W":64>e&&e>=56?t="V":56>e&&e>=48?t="U":48>e&&e>=40?t="T":40>e&&e>=32?t="S":32>e&&e>=24?t="R":24>e&&e>=16?t="Q":16>e&&e>=8?t="P":8>e&&e>=0?t="N":0>e&&e>=-8?t="M":-8>e&&e>=-16?t="L":-16>e&&e>=-24?t="K":-24>e&&e>=-32?t="J":-32>e&&e>=-40?t="H":-40>e&&e>=-48?t="G":-48>e&&e>=-56?t="F":-56>e&&e>=-64?t="E":-64>e&&e>=-72?t="D":-72>e&&e>=-80&&(t="C"),t}function l0(e,t){var r="00000"+e.easting,i="00000"+e.northing;return e.zoneNumber+e.zoneLetter+u0(e.easting,e.northing,e.zoneNumber)+r.substr(r.length-5,t)+i.substr(i.length-5,t)}function u0(e,t,r){var i=Df(r),s=Math.floor(e/1e5),n=Math.floor(t/1e5)%20;return f0(s,n,i)}function Df(e){var t=e%If;return t===0&&(t=If),t}function f0(e,t,r){var i=r-1,s=Af.charCodeAt(i),n=Bf.charCodeAt(i),o=s+e-1,a=n+t,h=!1;o>Rn&&(o=o-Rn+Fs-1,h=!0),(o===_e||s<_e&&o>_e||(o>_e||s<_e)&&h)&&o++,(o===ze||s<ze&&o>ze||(o>ze||s<ze)&&h)&&(o++,o===_e&&o++),o>Rn&&(o=o-Rn+Fs-1),a>Fn?(a=a-Fn+Fs-1,h=!0):h=!1,(a===_e||n<_e&&a>_e||(a>_e||n<_e)&&h)&&a++,(a===ze||n<ze&&a>ze||(a>ze||n<ze)&&h)&&(a++,a===_e&&a++),a>Fn&&(a=a-Fn+Fs-1);var c=String.fromCharCode(o)+String.fromCharCode(a);return c}function Ef(e){if(e&&e.length===0)throw"MGRSPoint coverting from nothing";for(var t=e.length,r=null,i="",s,n=0;!/[A-Z]/.test(s=e.charAt(n));){if(n>=2)throw"MGRSPoint bad conversion from: "+e;i+=s,n++}var o=parseInt(i,10);if(n===0||n+3>t)throw"MGRSPoint bad conversion from: "+e;var a=e.charAt(n++);if(a<="A"||a==="B"||a==="Y"||a>="Z"||a==="I"||a==="O")throw"MGRSPoint zone letter "+a+" not handled: "+e;r=e.substring(n,n+=2);for(var h=Df(o),c=d0(r.charAt(0),h),l=p0(r.charAt(1),h);l<m0(a);)l+=2e6;var u=t-n;if(u%2!==0)throw`MGRSPoint has to have an even number
|
|
17
17
|
of digits after the zone letter and two 100km letters - front
|
|
18
18
|
half for easting meters, second half for
|
|
19
|
-
northing meters`+e;var d=u/2,p=0,m=0,g,v,I,z,$;return d>0&&(g=1e5/Math.pow(10,d),v=e.substring(n,n+d),p=parseFloat(v)*g,I=e.substring(n+d),m=parseFloat(I)*g),z=p+l,$=m+c,{easting:z,northing:$,zoneLetter:a,zoneNumber:o,accuracy:g}}function O0(e,t){for(var r=$u.charCodeAt(t-1),i=1e5,s=!1;r!==e.charCodeAt(0);){if(r++,r===ye&&r++,r===Pe&&r++,r>En){if(s)throw"Bad character: "+e;r=Ts,s=!0}i+=1e5}return i}function E0(e,t){if(e>"V")throw"MGRSPoint given invalid Northing "+e;for(var r=Yu.charCodeAt(t-1),i=0,s=!1;r!==e.charCodeAt(0);){if(r++,r===ye&&r++,r===Pe&&r++,r>On){if(s)throw"Bad character: "+e;r=Ts,s=!0}i+=1e5}return i}function N0(e){var t;switch(e){case"C":t=11e5;break;case"D":t=2e6;break;case"E":t=28e5;break;case"F":t=37e5;break;case"G":t=46e5;break;case"H":t=55e5;break;case"J":t=64e5;break;case"K":t=73e5;break;case"L":t=82e5;break;case"M":t=91e5;break;case"N":t=0;break;case"P":t=8e5;break;case"Q":t=17e5;break;case"R":t=26e5;break;case"S":t=35e5;break;case"T":t=44e5;break;case"U":t=53e5;break;case"V":t=62e5;break;case"W":t=7e6;break;case"X":t=79e5;break;default:t=-1}if(t>=0)return t;throw"Invalid zone letter: "+e}function Os(e,t,r){if(!(this instanceof Os))return new Os(e,t,r);if(Array.isArray(e))this.x=e[0],this.y=e[1],this.z=e[2]||0;else if(typeof e=="object")this.x=e.x,this.y=e.y,this.z=e.z||0;else if(typeof e=="string"&&typeof t>"u"){var i=e.split(",");this.x=parseFloat(i[0],10),this.y=parseFloat(i[1],10),this.z=parseFloat(i[2],10)||0}else this.x=e,this.y=t,this.z=r||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Os.fromMGRS=function(e){return new Os(Kh(e))};Os.prototype.toMGRS=function(e){return Xh([this.x,this.y],e)};var Zu=Os;var F0=1,L0=.25,Qu=.046875,tf=.01953125,ef=.01068115234375,R0=.75,U0=.46875,C0=.013020833333333334,P0=.007120768229166667,z0=.3645833333333333,j0=.005696614583333333,V0=.3076171875;function xa(e){var t=[];t[0]=F0-e*(L0+e*(Qu+e*(tf+e*ef))),t[1]=e*(R0-e*(Qu+e*(tf+e*ef)));var r=e*e;return t[2]=r*(U0-e*(C0+e*P0)),r*=e,t[3]=r*(z0-e*j0),t[4]=r*e*V0,t}function Pi(e,t,r,i){return r*=t,t*=t,i[0]*e-r*(i[1]+t*(i[2]+t*(i[3]+t*i[4])))}var k0=20;function Ma(e,t,r){for(var i=1/(1-t),s=e,n=k0;n;--n){var o=Math.sin(s),a=1-t*o*o;if(a=(Pi(s,o,Math.cos(s),r)-e)*(a*Math.sqrt(a))*i,s-=a,Math.abs(a)<b)return s}return s}function G0(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=xa(this.es),this.ml0=Pi(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function W0(e){var t=e.x,r=e.y,i=_(t-this.long0),s,n,o,a=Math.sin(r),h=Math.cos(r);if(this.es){var c=h*i,u=Math.pow(c,2),d=this.ep2*Math.pow(h,2),p=Math.pow(d,2),m=Math.abs(h)>b?Math.tan(r):0,g=Math.pow(m,2),v=Math.pow(g,2);s=1-this.es*Math.pow(a,2),c=c/Math.sqrt(s);var I=Pi(r,a,h,this.en);n=this.a*(this.k0*c*(1+u/6*(1-g+d+u/20*(5-18*g+v+14*d-58*g*d+u/42*(61+179*v-v*g-479*g)))))+this.x0,o=this.a*(this.k0*(I-this.ml0+a*i*c/2*(1+u/12*(5-g+9*d+4*p+u/30*(61+v-58*g+270*d-330*g*d+u/56*(1385+543*v-v*g-3111*g))))))+this.y0}else{var l=h*Math.sin(i);if(Math.abs(Math.abs(l)-1)<b)return 93;if(n=.5*this.a*this.k0*Math.log((1+l)/(1-l))+this.x0,o=h*Math.cos(i)/Math.sqrt(1-Math.pow(l,2)),l=Math.abs(o),l>=1){if(l-1>b)return 93;o=0}else o=Math.acos(o);r<0&&(o=-o),o=this.a*this.k0*(o-this.lat0)+this.y0}return e.x=n,e.y=o,e}function H0(e){var t,r,i,s,n=(e.x-this.x0)*(1/this.a),o=(e.y-this.y0)*(1/this.a);if(this.es)if(t=this.ml0+o/this.k0,r=Ma(t,this.es,this.en),Math.abs(r)<y){var u=Math.sin(r),d=Math.cos(r),p=Math.abs(d)>b?Math.tan(r):0,m=this.ep2*Math.pow(d,2),g=Math.pow(m,2),v=Math.pow(p,2),I=Math.pow(v,2);t=1-this.es*Math.pow(u,2);var z=n*Math.sqrt(t)/this.k0,$=Math.pow(z,2);t=t*p,i=r-t*$/(1-this.es)*.5*(1-$/12*(5+3*v-9*m*v+m-4*g-$/30*(61+90*v-252*m*v+45*I+46*m-$/56*(1385+3633*v+4095*I+1574*I*v)))),s=_(this.long0+z*(1-$/6*(1+2*v+m-$/20*(5+28*v+24*I+8*m*v+6*m-$/42*(61+662*v+1320*I+720*I*v))))/d)}else i=y*Ar(o),s=0;else{var a=Math.exp(n/this.k0),h=.5*(a-1/a),l=this.lat0+o/this.k0,c=Math.cos(l);t=Math.sqrt((1-Math.pow(c,2))/(1+Math.pow(h,2))),i=Math.asin(t),o<0&&(i=-i),h===0&&c===0?s=0:s=_(Math.atan2(h,c)+this.long0)}return e.x=s,e.y=i,e}var q0=["Transverse_Mercator","Transverse Mercator","tmerc"],rf={init:G0,forward:W0,inverse:H0,names:q0};function Ia(e){var t=Math.exp(e);return t=(t-1/t)/2,t}function Nn(e,t){e=Math.abs(e),t=Math.abs(t);var r=Math.max(e,t),i=Math.min(e,t)/(r||1);return r*Math.sqrt(1+Math.pow(i,2))}function sf(e){var t=1+e,r=t-1;return r===0?e:e*Math.log(t)/r}function nf(e){var t=Math.abs(e);return t=sf(t*(1+t/(Nn(1,t)+1))),e<0?-t:t}function Sa(e,t){for(var r=2*Math.cos(2*t),i=e.length-1,s=e[i],n=0,o;--i>=0;)o=-n+r*s+e[i],n=s,s=o;return t+o*Math.sin(2*t)}function of(e,t){for(var r=2*Math.cos(t),i=e.length-1,s=e[i],n=0,o;--i>=0;)o=-n+r*s+e[i],n=s,s=o;return Math.sin(t)*o}function af(e){var t=Math.exp(e);return t=(t+1/t)/2,t}function Qh(e,t,r){for(var i=Math.sin(t),s=Math.cos(t),n=Ia(r),o=af(r),a=2*s*o,h=-2*i*n,l=e.length-1,c=e[l],u=0,d=0,p=0,m,g;--l>=0;)m=d,g=u,d=c,u=p,c=-m+a*d-h*u+e[l],p=-g+h*d+a*u;return a=i*o,h=s*n,[a*c-h*p,a*p+h*c]}function $0(){if(this.es===void 0||this.es<=0)throw new Error("incorrect elliptical usage");this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var e=this.es/(1+Math.sqrt(1-this.es)),t=e/(2-e),r=t;this.cgb[0]=t*(2+t*(-2/3+t*(-2+t*(116/45+t*(26/45+t*(-2854/675)))))),this.cbg[0]=t*(-2+t*(2/3+t*(4/3+t*(-82/45+t*(32/45+t*(4642/4725)))))),r=r*t,this.cgb[1]=r*(7/3+t*(-8/5+t*(-227/45+t*(2704/315+t*(2323/945))))),this.cbg[1]=r*(5/3+t*(-16/15+t*(-13/9+t*(904/315+t*(-1522/945))))),r=r*t,this.cgb[2]=r*(56/15+t*(-136/35+t*(-1262/105+t*(73814/2835)))),this.cbg[2]=r*(-26/15+t*(34/21+t*(8/5+t*(-12686/2835)))),r=r*t,this.cgb[3]=r*(4279/630+t*(-332/35+t*(-399572/14175))),this.cbg[3]=r*(1237/630+t*(-12/5+t*(-24832/14175))),r=r*t,this.cgb[4]=r*(4174/315+t*(-144838/6237)),this.cbg[4]=r*(-734/315+t*(109598/31185)),r=r*t,this.cgb[5]=r*(601676/22275),this.cbg[5]=r*(444337/155925),r=Math.pow(t,2),this.Qn=this.k0/(1+t)*(1+r*(1/4+r*(1/64+r/256))),this.utg[0]=t*(-.5+t*(2/3+t*(-37/96+t*(1/360+t*(81/512+t*(-96199/604800)))))),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+t*(7891/37800)))))),this.utg[1]=r*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+t*(1118711/3870720))))),this.gtu[1]=r*(13/48+t*(-3/5+t*(557/1440+t*(281/630+t*(-1983433/1935360))))),r=r*t,this.utg[2]=r*(-17/480+t*(37/840+t*(209/4480+t*(-5569/90720)))),this.gtu[2]=r*(61/240+t*(-103/140+t*(15061/26880+t*(167603/181440)))),r=r*t,this.utg[3]=r*(-4397/161280+t*(11/504+t*(830251/7257600))),this.gtu[3]=r*(49561/161280+t*(-179/168+t*(6601661/7257600))),r=r*t,this.utg[4]=r*(-4583/161280+t*(108847/3991680)),this.gtu[4]=r*(34729/80640+t*(-3418889/1995840)),r=r*t,this.utg[5]=r*(-20648693/638668800),this.gtu[5]=r*(212378941/319334400);var i=Sa(this.cbg,this.lat0);this.Zb=-this.Qn*(i+of(this.gtu,2*i))}function Y0(e){var t=_(e.x-this.long0),r=e.y;r=Sa(this.cbg,r);var i=Math.sin(r),s=Math.cos(r),n=Math.sin(t),o=Math.cos(t);r=Math.atan2(i,o*s),t=Math.atan2(n*s,Nn(i,s*o)),t=nf(Math.tan(t));var a=Qh(this.gtu,2*r,2*t);r=r+a[0],t=t+a[1];var h,l;return Math.abs(t)<=2.623395162778?(h=this.a*(this.Qn*t)+this.x0,l=this.a*(this.Qn*r+this.Zb)+this.y0):(h=1/0,l=1/0),e.x=h,e.y=l,e}function J0(e){var t=(e.x-this.x0)*(1/this.a),r=(e.y-this.y0)*(1/this.a);r=(r-this.Zb)/this.Qn,t=t/this.Qn;var i,s;if(Math.abs(t)<=2.623395162778){var n=Qh(this.utg,2*r,2*t);r=r+n[0],t=t+n[1],t=Math.atan(Ia(t));var o=Math.sin(r),a=Math.cos(r),h=Math.sin(t),l=Math.cos(t);r=Math.atan2(o*l,Nn(h,l*a)),t=Math.atan2(h,l*a),i=_(t+this.long0),s=Sa(this.cgb,r)}else i=1/0,s=1/0;return e.x=i,e.y=s,e}var X0=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],Es={init:$0,forward:Y0,inverse:J0,names:X0};function hf(e,t){if(e===void 0){if(e=Math.floor((_(t)+Math.PI)*30/Math.PI)+1,e<0)return 0;if(e>60)return 60}return e}var K0="etmerc";function Z0(){var e=hf(this.zone,this.long0);if(e===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(e)-183)*Bt,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Es.init.apply(this),this.forward=Es.forward,this.inverse=Es.inverse}var Q0=["Universal Transverse Mercator System","utm"],lf={init:Z0,names:Q0,dependsOn:K0};function Ba(e,t){return Math.pow((1-e)/(1+e),t)}var ty=20;function ey(){var e=Math.sin(this.lat0),t=Math.cos(this.lat0);t*=t,this.rc=Math.sqrt(1-this.es)/(1-this.es*e*e),this.C=Math.sqrt(1+this.es*t*t/(1-this.es)),this.phic0=Math.asin(e/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+J)/(Math.pow(Math.tan(.5*this.lat0+J),this.C)*Ba(this.e*e,this.ratexp))}function ry(e){var t=e.x,r=e.y;return e.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*r+J),this.C)*Ba(this.e*Math.sin(r),this.ratexp))-y,e.x=this.C*t,e}function iy(e){for(var t=1e-14,r=e.x/this.C,i=e.y,s=Math.pow(Math.tan(.5*i+J)/this.K,1/this.C),n=ty;n>0&&(i=2*Math.atan(s*Ba(this.e*Math.sin(e.y),-.5*this.e))-y,!(Math.abs(i-e.y)<t));--n)e.y=i;return n?(e.x=r,e.y=i,e):null}var sy=["gauss"],Aa={init:ey,forward:ry,inverse:iy,names:sy};function ny(){Aa.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function oy(e){var t,r,i,s;return e.x=_(e.x-this.long0),Aa.forward.apply(this,[e]),t=Math.sin(e.y),r=Math.cos(e.y),i=Math.cos(e.x),s=this.k0*this.R2/(1+this.sinc0*t+this.cosc0*r*i),e.x=s*r*Math.sin(e.x),e.y=s*(this.cosc0*t-this.sinc0*r*i),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e}function ay(e){var t,r,i,s,n;if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,n=Math.sqrt(e.x*e.x+e.y*e.y)){var o=2*Math.atan2(n,this.R2);t=Math.sin(o),r=Math.cos(o),s=Math.asin(r*this.sinc0+e.y*t*this.cosc0/n),i=Math.atan2(e.x*t,n*this.cosc0*r-e.y*this.sinc0*t)}else s=this.phic0,i=0;return e.x=i,e.y=s,Aa.inverse.apply(this,[e]),e.x=_(e.x+this.long0),e}var hy=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],cf={init:ny,forward:oy,inverse:ay,names:hy};function ly(e,t,r){return t*=r,Math.tan(.5*(y+e))*Math.pow((1-t)/(1+t),.5*r)}function cy(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=b&&(this.k0=.5*(1+Ar(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=b&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=b&&(this.k0=.5*this.cons*kt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Xt(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=kt(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-y,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function uy(e){var t=e.x,r=e.y,i=Math.sin(r),s=Math.cos(r),n,o,a,h,l,c,u=_(t-this.long0);return Math.abs(Math.abs(t-this.long0)-Math.PI)<=b&&Math.abs(r+this.lat0)<=b?(e.x=NaN,e.y=NaN,e):this.sphere?(n=2*this.k0/(1+this.sinlat0*i+this.coslat0*s*Math.cos(u)),e.x=this.a*n*s*Math.sin(u)+this.x0,e.y=this.a*n*(this.coslat0*i-this.sinlat0*s*Math.cos(u))+this.y0,e):(o=2*Math.atan(this.ssfn_(r,i,this.e))-y,h=Math.cos(o),a=Math.sin(o),Math.abs(this.coslat0)<=b?(l=Xt(this.e,r*this.con,this.con*i),c=2*this.a*this.k0*l/this.cons,e.x=this.x0+c*Math.sin(t-this.long0),e.y=this.y0-this.con*c*Math.cos(t-this.long0),e):(Math.abs(this.sinlat0)<b?(n=2*this.a*this.k0/(1+h*Math.cos(u)),e.y=n*a):(n=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*a+this.cosX0*h*Math.cos(u))),e.y=n*(this.cosX0*a-this.sinX0*h*Math.cos(u))+this.y0),e.x=n*h*Math.sin(u)+this.x0,e))}function fy(e){e.x-=this.x0,e.y-=this.y0;var t,r,i,s,n,o=Math.sqrt(e.x*e.x+e.y*e.y);if(this.sphere){var a=2*Math.atan(o/(2*this.a*this.k0));return t=this.long0,r=this.lat0,o<=b?(e.x=t,e.y=r,e):(r=Math.asin(Math.cos(a)*this.sinlat0+e.y*Math.sin(a)*this.coslat0/o),Math.abs(this.coslat0)<b?this.lat0>0?t=_(this.long0+Math.atan2(e.x,-1*e.y)):t=_(this.long0+Math.atan2(e.x,e.y)):t=_(this.long0+Math.atan2(e.x*Math.sin(a),o*this.coslat0*Math.cos(a)-e.y*this.sinlat0*Math.sin(a))),e.x=t,e.y=r,e)}else if(Math.abs(this.coslat0)<=b){if(o<=b)return r=this.lat0,t=this.long0,e.x=t,e.y=r,e;e.x*=this.con,e.y*=this.con,i=o*this.cons/(2*this.a*this.k0),r=this.con*Vr(this.e,i),t=this.con*_(this.con*this.long0+Math.atan2(e.x,-1*e.y))}else s=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,o<=b?n=this.X0:(n=Math.asin(Math.cos(s)*this.sinX0+e.y*Math.sin(s)*this.cosX0/o),t=_(this.long0+Math.atan2(e.x*Math.sin(s),o*this.cosX0*Math.cos(s)-e.y*this.sinX0*Math.sin(s)))),r=-1*Vr(this.e,Math.tan(.5*(y+n)));return e.x=t,e.y=r,e}var dy=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],uf={init:cy,forward:uy,inverse:fy,names:dy,ssfn_:ly};function py(){var e=this.lat0;this.lambda0=this.long0;var t=Math.sin(e),r=this.a,i=this.rf,s=1/i,n=2*s-Math.pow(s,2),o=this.e=Math.sqrt(n);this.R=this.k0*r*Math.sqrt(1-n)/(1-n*Math.pow(t,2)),this.alpha=Math.sqrt(1+n/(1-n)*Math.pow(Math.cos(e),4)),this.b0=Math.asin(t/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),h=Math.log(Math.tan(Math.PI/4+e/2)),l=Math.log((1+o*t)/(1-o*t));this.K=a-this.alpha*h+this.alpha*o/2*l}function my(e){var t=Math.log(Math.tan(Math.PI/4-e.y/2)),r=this.e/2*Math.log((1+this.e*Math.sin(e.y))/(1-this.e*Math.sin(e.y))),i=-this.alpha*(t+r)+this.K,s=2*(Math.atan(Math.exp(i))-Math.PI/4),n=this.alpha*(e.x-this.lambda0),o=Math.atan(Math.sin(n)/(Math.sin(this.b0)*Math.tan(s)+Math.cos(this.b0)*Math.cos(n))),a=Math.asin(Math.cos(this.b0)*Math.sin(s)-Math.sin(this.b0)*Math.cos(s)*Math.cos(n));return e.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,e.x=this.R*o+this.x0,e}function yy(e){for(var t=e.x-this.x0,r=e.y-this.y0,i=t/this.R,s=2*(Math.atan(Math.exp(r/this.R))-Math.PI/4),n=Math.asin(Math.cos(this.b0)*Math.sin(s)+Math.sin(this.b0)*Math.cos(s)*Math.cos(i)),o=Math.atan(Math.sin(i)/(Math.cos(this.b0)*Math.cos(i)-Math.sin(this.b0)*Math.tan(s))),a=this.lambda0+o/this.alpha,h=0,l=n,c=-1e3,u=0;Math.abs(l-c)>1e-7;){if(++u>20)return;h=1/this.alpha*(Math.log(Math.tan(Math.PI/4+n/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),c=l,l=2*Math.atan(Math.exp(h))-Math.PI/2}return e.x=a,e.y=l,e}var gy=["somerc"],ff={init:py,forward:my,inverse:yy,names:gy};function by(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var e=Math.sin(this.lat0),t=Math.cos(this.lat0),r=this.e*e;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(t,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-r*r);var i=Xt(this.e,this.lat0,e),s=this.bl/t*Math.sqrt((1-this.es)/(1-r*r));s*s<1&&(s=1);var n,o;if(!isNaN(this.longc))this.lat0>=0?n=s+Math.sqrt(s*s-1):n=s-Math.sqrt(s*s-1),this.el=n*Math.pow(i,this.bl),o=.5*(n-1/n),this.gamma0=Math.asin(Math.sin(this.alpha)/s),this.long0=this.longc-Math.asin(o*Math.tan(this.gamma0))/this.bl;else{var a=Xt(this.e,this.lat1,Math.sin(this.lat1)),h=Xt(this.e,this.lat2,Math.sin(this.lat2));this.lat0>=0?this.el=(s+Math.sqrt(s*s-1))*Math.pow(i,this.bl):this.el=(s-Math.sqrt(s*s-1))*Math.pow(i,this.bl);var l=Math.pow(a,this.bl),c=Math.pow(h,this.bl);n=this.el/l,o=.5*(n-1/n);var u=(this.el*this.el-c*l)/(this.el*this.el+c*l),d=(c-l)/(c+l),p=_(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(u*Math.tan(.5*this.bl*p)/d)/this.bl,this.long0=_(this.long0);var m=_(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*m)/o),this.alpha=Math.asin(s*Math.sin(this.gamma0))}this.no_off?this.uc=0:this.lat0>=0?this.uc=this.al/this.bl*Math.atan2(Math.sqrt(s*s-1),Math.cos(this.alpha)):this.uc=-1*this.al/this.bl*Math.atan2(Math.sqrt(s*s-1),Math.cos(this.alpha))}function _y(e){var t=e.x,r=e.y,i=_(t-this.long0),s,n,o;if(Math.abs(Math.abs(r)-y)<=b)r>0?o=-1:o=1,n=this.al/this.bl*Math.log(Math.tan(J+o*this.gamma0*.5)),s=-1*o*y*this.al/this.bl;else{var a=Xt(this.e,r,Math.sin(r)),h=this.el/Math.pow(a,this.bl),l=.5*(h-1/h),c=.5*(h+1/h),u=Math.sin(this.bl*i),d=(l*Math.sin(this.gamma0)-u*Math.cos(this.gamma0))/c;Math.abs(Math.abs(d)-1)<=b?n=Number.POSITIVE_INFINITY:n=.5*this.al*Math.log((1-d)/(1+d))/this.bl,Math.abs(Math.cos(this.bl*i))<=b?s=this.al*this.bl*i:s=this.al*Math.atan2(l*Math.cos(this.gamma0)+u*Math.sin(this.gamma0),Math.cos(this.bl*i))/this.bl}return this.no_rot?(e.x=this.x0+s,e.y=this.y0+n):(s-=this.uc,e.x=this.x0+n*Math.cos(this.alpha)+s*Math.sin(this.alpha),e.y=this.y0+s*Math.cos(this.alpha)-n*Math.sin(this.alpha)),e}function vy(e){var t,r;this.no_rot?(r=e.y-this.y0,t=e.x-this.x0):(r=(e.x-this.x0)*Math.cos(this.alpha)-(e.y-this.y0)*Math.sin(this.alpha),t=(e.y-this.y0)*Math.cos(this.alpha)+(e.x-this.x0)*Math.sin(this.alpha),t+=this.uc);var i=Math.exp(-1*this.bl*r/this.al),s=.5*(i-1/i),n=.5*(i+1/i),o=Math.sin(this.bl*t/this.al),a=(o*Math.cos(this.gamma0)+s*Math.sin(this.gamma0))/n,h=Math.pow(this.el/Math.sqrt((1+a)/(1-a)),1/this.bl);return Math.abs(a-1)<b?(e.x=this.long0,e.y=y):Math.abs(a+1)<b?(e.x=this.long0,e.y=-1*y):(e.y=Vr(this.e,h),e.x=_(this.long0-Math.atan2(s*Math.cos(this.gamma0)-o*Math.sin(this.gamma0),Math.cos(this.bl*t/this.al))/this.bl)),e}var wy=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"],df={init:by,forward:_y,inverse:vy,names:wy};function xy(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<b)){var e=this.b/this.a;this.e=Math.sqrt(1-e*e);var t=Math.sin(this.lat1),r=Math.cos(this.lat1),i=kt(this.e,t,r),s=Xt(this.e,this.lat1,t),n=Math.sin(this.lat2),o=Math.cos(this.lat2),a=kt(this.e,n,o),h=Xt(this.e,this.lat2,n),l=Xt(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>b?this.ns=Math.log(i/a)/Math.log(s/h):this.ns=t,isNaN(this.ns)&&(this.ns=t),this.f0=i/(this.ns*Math.pow(s,this.ns)),this.rh=this.a*this.f0*Math.pow(l,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function My(e){var t=e.x,r=e.y;Math.abs(2*Math.abs(r)-Math.PI)<=b&&(r=Ar(r)*(y-2*b));var i=Math.abs(Math.abs(r)-y),s,n;if(i>b)s=Xt(this.e,r,Math.sin(r)),n=this.a*this.f0*Math.pow(s,this.ns);else{if(i=r*this.ns,i<=0)return null;n=0}var o=this.ns*_(t-this.long0);return e.x=this.k0*(n*Math.sin(o))+this.x0,e.y=this.k0*(this.rh-n*Math.cos(o))+this.y0,e}function Iy(e){var t,r,i,s,n,o=(e.x-this.x0)/this.k0,a=this.rh-(e.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(o*o+a*a),r=1):(t=-Math.sqrt(o*o+a*a),r=-1);var h=0;if(t!==0&&(h=Math.atan2(r*o,r*a)),t!==0||this.ns>0){if(r=1/this.ns,i=Math.pow(t/(this.a*this.f0),r),s=Vr(this.e,i),s===-9999)return null}else s=-y;return n=_(h/this.ns+this.long0),e.x=n,e.y=s,e}var Sy=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"],pf={init:xy,forward:My,inverse:Iy,names:Sy};function By(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function Ay(e){var t,r,i,s,n,o,a,h=e.x,l=e.y,c=_(h-this.long0);return t=Math.pow((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)),this.alfa*this.e/2),r=2*(Math.atan(this.k*Math.pow(Math.tan(l/2+this.s45),this.alfa)/t)-this.s45),i=-c*this.alfa,s=Math.asin(Math.cos(this.ad)*Math.sin(r)+Math.sin(this.ad)*Math.cos(r)*Math.cos(i)),n=Math.asin(Math.cos(r)*Math.sin(i)/Math.cos(s)),o=this.n*n,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(s/2+this.s45),this.n),e.y=a*Math.cos(o)/1,e.x=a*Math.sin(o)/1,this.czech||(e.y*=-1,e.x*=-1),e}function Dy(e){var t,r,i,s,n,o,a,h,l=e.x;e.x=e.y,e.y=l,this.czech||(e.y*=-1,e.x*=-1),o=Math.sqrt(e.x*e.x+e.y*e.y),n=Math.atan2(e.y,e.x),s=n/Math.sin(this.s0),i=2*(Math.atan(Math.pow(this.ro0/o,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),t=Math.asin(Math.cos(this.ad)*Math.sin(i)-Math.sin(this.ad)*Math.cos(i)*Math.cos(s)),r=Math.asin(Math.cos(i)*Math.sin(s)/Math.cos(t)),e.x=this.long0-r/this.alfa,a=t,h=0;var c=0;do e.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(t/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),Math.abs(a-e.y)<1e-10&&(h=1),a=e.y,c+=1;while(h===0&&c<15);return c>=15?null:e}var Ty=["Krovak","krovak"],mf={init:By,forward:Ay,inverse:Dy,names:Ty};function Dt(e,t,r,i,s){return e*s-t*Math.sin(2*s)+r*Math.sin(4*s)-i*Math.sin(6*s)}function kr(e){return 1-.25*e*(1+e/16*(3+1.25*e))}function Gr(e){return .375*e*(1+.25*e*(1+.46875*e))}function Wr(e){return .05859375*e*e*(1+.75*e)}function Hr(e){return e*e*e*(35/3072)}function qr(e,t,r){var i=t*r;return e/Math.sqrt(1-i*i)}function rr(e){return Math.abs(e)<y?e:e-Ar(e)*Math.PI}function zi(e,t,r,i,s){var n,o;n=e/t;for(var a=0;a<15;a++)if(o=(e-(t*n-r*Math.sin(2*n)+i*Math.sin(4*n)-s*Math.sin(6*n)))/(t-2*r*Math.cos(2*n)+4*i*Math.cos(4*n)-6*s*Math.cos(6*n)),n+=o,Math.abs(o)<=1e-10)return n;return NaN}function Oy(){this.sphere||(this.e0=kr(this.es),this.e1=Gr(this.es),this.e2=Wr(this.es),this.e3=Hr(this.es),this.ml0=this.a*Dt(this.e0,this.e1,this.e2,this.e3,this.lat0))}function Ey(e){var t,r,i=e.x,s=e.y;if(i=_(i-this.long0),this.sphere)t=this.a*Math.asin(Math.cos(s)*Math.sin(i)),r=this.a*(Math.atan2(Math.tan(s),Math.cos(i))-this.lat0);else{var n=Math.sin(s),o=Math.cos(s),a=qr(this.a,this.e,n),h=Math.tan(s)*Math.tan(s),l=i*Math.cos(s),c=l*l,u=this.es*o*o/(1-this.es),d=this.a*Dt(this.e0,this.e1,this.e2,this.e3,s);t=a*l*(1-c*h*(1/6-(8-h+8*u)*c/120)),r=d-this.ml0+a*n/o*c*(.5+(5-h+6*u)*c/24)}return e.x=t+this.x0,e.y=r+this.y0,e}function Ny(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,r=e.y/this.a,i,s;if(this.sphere){var n=r+this.lat0;i=Math.asin(Math.sin(n)*Math.cos(t)),s=Math.atan2(Math.tan(t),Math.cos(n))}else{var o=this.ml0/this.a+r,a=zi(o,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(a)-y)<=b)return e.x=this.long0,e.y=y,r<0&&(e.y*=-1),e;var h=qr(this.a,this.e,Math.sin(a)),l=h*h*h/this.a/this.a*(1-this.es),c=Math.pow(Math.tan(a),2),u=t*this.a/h,d=u*u;i=a-h*Math.tan(a)/l*u*u*(.5-(1+3*c)*u*u/24),s=u*(1-d*(c/3+(1+3*c)*c*d/15))/Math.cos(a)}return e.x=_(s+this.long0),e.y=rr(i),e}var Fy=["Cassini","Cassini_Soldner","cass"],yf={init:Oy,forward:Ey,inverse:Ny,names:Fy};function ir(e,t){var r;return e>1e-7?(r=e*t,(1-e*e)*(t/(1-r*r)-.5/e*Math.log((1-r)/(1+r)))):2*t}var Ly=1,Ry=2,Uy=3,Cy=4;function Py(){var e=Math.abs(this.lat0);if(Math.abs(e-y)<b?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(e)<b?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var t;switch(this.qp=ir(this.e,1),this.mmf=.5/(1-this.es),this.apa=$y(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=ir(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function zy(e){var t,r,i,s,n,o,a,h,l,c,u=e.x,d=e.y;if(u=_(u-this.long0),this.sphere){if(n=Math.sin(d),c=Math.cos(d),i=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(r=this.mode===this.EQUIT?1+c*i:1+this.sinph0*n+this.cosph0*c*i,r<=b)return null;r=Math.sqrt(2/r),t=r*c*Math.sin(u),r*=this.mode===this.EQUIT?n:this.cosph0*n-this.sinph0*c*i}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(i=-i),Math.abs(d+this.lat0)<b)return null;r=J-d*.5,r=2*(this.mode===this.S_POLE?Math.cos(r):Math.sin(r)),t=r*Math.sin(u),r*=i}}else{switch(a=0,h=0,l=0,i=Math.cos(u),s=Math.sin(u),n=Math.sin(d),o=ir(this.e,n),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(a=o/this.qp,h=Math.sqrt(1-a*a)),this.mode){case this.OBLIQ:l=1+this.sinb1*a+this.cosb1*h*i;break;case this.EQUIT:l=1+h*i;break;case this.N_POLE:l=y+d,o=this.qp-o;break;case this.S_POLE:l=d-y,o=this.qp+o;break}if(Math.abs(l)<b)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:l=Math.sqrt(2/l),this.mode===this.OBLIQ?r=this.ymf*l*(this.cosb1*a-this.sinb1*h*i):r=(l=Math.sqrt(2/(1+h*i)))*a*this.ymf,t=this.xmf*l*h*s;break;case this.N_POLE:case this.S_POLE:o>=0?(t=(l=Math.sqrt(o))*s,r=i*(this.mode===this.S_POLE?l:-l)):t=r=0;break}}return e.x=this.a*t+this.x0,e.y=this.a*r+this.y0,e}function jy(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,r=e.y/this.a,i,s,n,o,a,h,l;if(this.sphere){var c=0,u,d=0;if(u=Math.sqrt(t*t+r*r),s=u*.5,s>1)return null;switch(s=2*Math.asin(s),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(d=Math.sin(s),c=Math.cos(s)),this.mode){case this.EQUIT:s=Math.abs(u)<=b?0:Math.asin(r*d/u),t*=d,r=c*u;break;case this.OBLIQ:s=Math.abs(u)<=b?this.lat0:Math.asin(c*this.sinph0+r*d*this.cosph0/u),t*=d*this.cosph0,r=(c-Math.sin(s)*this.sinph0)*u;break;case this.N_POLE:r=-r,s=y-s;break;case this.S_POLE:s-=y;break}i=r===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(t,r)}else{if(l=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t/=this.dd,r*=this.dd,h=Math.sqrt(t*t+r*r),h<b)return e.x=this.long0,e.y=this.lat0,e;o=2*Math.asin(.5*h/this.rq),n=Math.cos(o),t*=o=Math.sin(o),this.mode===this.OBLIQ?(l=n*this.sinb1+r*o*this.cosb1/h,a=this.qp*l,r=h*this.cosb1*n-r*this.sinb1*o):(l=r*o/h,a=this.qp*l,r=h*n)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(r=-r),a=t*t+r*r,!a)return e.x=this.long0,e.y=this.lat0,e;l=1-a/this.qp,this.mode===this.S_POLE&&(l=-l)}i=Math.atan2(t,r),s=Yy(Math.asin(l),this.apa)}return e.x=_(this.long0+i),e.y=s,e}var Vy=.3333333333333333,ky=.17222222222222222,Gy=.10257936507936508,Wy=.06388888888888888,Hy=.0664021164021164,qy=.016415012942191543;function $y(e){var t,r=[];return r[0]=e*Vy,t=e*e,r[0]+=t*ky,r[1]=t*Wy,t*=e,r[0]+=t*Gy,r[1]+=t*Hy,r[2]=t*qy,r}function Yy(e,t){var r=e+e;return e+t[0]*Math.sin(r)+t[1]*Math.sin(r+r)+t[2]*Math.sin(r+r+r)}var Jy=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],gf={init:Py,forward:zy,inverse:jy,names:Jy,S_POLE:Ly,N_POLE:Ry,EQUIT:Uy,OBLIQ:Cy};function ge(e){return Math.abs(e)>1&&(e=e>1?1:-1),Math.asin(e)}function Xy(){Math.abs(this.lat1+this.lat2)<b||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=kt(this.e3,this.sin_po,this.cos_po),this.qs1=ir(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=kt(this.e3,this.sin_po,this.cos_po),this.qs2=ir(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=ir(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>b?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function Ky(e){var t=e.x,r=e.y;this.sin_phi=Math.sin(r),this.cos_phi=Math.cos(r);var i=ir(this.e3,this.sin_phi,this.cos_phi),s=this.a*Math.sqrt(this.c-this.ns0*i)/this.ns0,n=this.ns0*_(t-this.long0),o=s*Math.sin(n)+this.x0,a=this.rh-s*Math.cos(n)+this.y0;return e.x=o,e.y=a,e}function Zy(e){var t,r,i,s,n,o;return e.x-=this.x0,e.y=this.rh-e.y+this.y0,this.ns0>=0?(t=Math.sqrt(e.x*e.x+e.y*e.y),i=1):(t=-Math.sqrt(e.x*e.x+e.y*e.y),i=-1),s=0,t!==0&&(s=Math.atan2(i*e.x,i*e.y)),i=t*this.ns0/this.a,this.sphere?o=Math.asin((this.c-i*i)/(2*this.ns0)):(r=(this.c-i*i)/this.ns0,o=this.phi1z(this.e3,r)),n=_(s/this.ns0+this.long0),e.x=n,e.y=o,e}function Qy(e,t){var r,i,s,n,o,a=ge(.5*t);if(e<b)return a;for(var h=e*e,l=1;l<=25;l++)if(r=Math.sin(a),i=Math.cos(a),s=e*r,n=1-s*s,o=.5*n*n/i*(t/(1-h)-r/n+.5/e*Math.log((1-s)/(1+s))),a=a+o,Math.abs(o)<=1e-7)return a;return null}var tg=["Albers_Conic_Equal_Area","Albers","aea"],bf={init:Xy,forward:Ky,inverse:Zy,names:tg,phi1z:Qy};function eg(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function rg(e){var t,r,i,s,n,o,a,h,l=e.x,c=e.y;return i=_(l-this.long0),t=Math.sin(c),r=Math.cos(c),s=Math.cos(i),o=this.sin_p14*t+this.cos_p14*r*s,n=1,o>0||Math.abs(o)<=b?(a=this.x0+this.a*n*r*Math.sin(i)/o,h=this.y0+this.a*n*(this.cos_p14*t-this.sin_p14*r*s)/o):(a=this.x0+this.infinity_dist*r*Math.sin(i),h=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*r*s)),e.x=a,e.y=h,e}function ig(e){var t,r,i,s,n,o;return e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,(t=Math.sqrt(e.x*e.x+e.y*e.y))?(s=Math.atan2(t,this.rc),r=Math.sin(s),i=Math.cos(s),o=ge(i*this.sin_p14+e.y*r*this.cos_p14/t),n=Math.atan2(e.x*r,t*this.cos_p14*i-e.y*this.sin_p14*r),n=_(this.long0+n)):(o=this.phic0,n=0),e.x=n,e.y=o,e}var sg=["gnom"],_f={init:eg,forward:rg,inverse:ig,names:sg};function vf(e,t){var r=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));if(Math.abs(Math.abs(t)-r)<1e-6)return t<0?-1*y:y;for(var i=Math.asin(.5*t),s,n,o,a,h=0;h<30;h++)if(n=Math.sin(i),o=Math.cos(i),a=e*n,s=Math.pow(1-a*a,2)/(2*o)*(t/(1-e*e)-n/(1-a*a)+.5/e*Math.log((1-a)/(1+a))),i+=s,Math.abs(s)<=1e-10)return i;return NaN}function ng(){this.sphere||(this.k0=kt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function og(e){var t=e.x,r=e.y,i,s,n=_(t-this.long0);if(this.sphere)i=this.x0+this.a*n*Math.cos(this.lat_ts),s=this.y0+this.a*Math.sin(r)/Math.cos(this.lat_ts);else{var o=ir(this.e,Math.sin(r));i=this.x0+this.a*this.k0*n,s=this.y0+this.a*o*.5/this.k0}return e.x=i,e.y=s,e}function ag(e){e.x-=this.x0,e.y-=this.y0;var t,r;return this.sphere?(t=_(this.long0+e.x/this.a/Math.cos(this.lat_ts)),r=Math.asin(e.y/this.a*Math.cos(this.lat_ts))):(r=vf(this.e,2*e.y*this.k0/this.a),t=_(this.long0+e.x/(this.a*this.k0))),e.x=t,e.y=r,e}var hg=["cea"],wf={init:ng,forward:og,inverse:ag,names:hg};function lg(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function cg(e){var t=e.x,r=e.y,i=_(t-this.long0),s=rr(r-this.lat0);return e.x=this.x0+this.a*i*this.rc,e.y=this.y0+this.a*s,e}function ug(e){var t=e.x,r=e.y;return e.x=_(this.long0+(t-this.x0)/(this.a*this.rc)),e.y=rr(this.lat0+(r-this.y0)/this.a),e}var fg=["Equirectangular","Equidistant_Cylindrical","eqc"],xf={init:lg,forward:cg,inverse:ug,names:fg};var Mf=20;function dg(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=kr(this.es),this.e1=Gr(this.es),this.e2=Wr(this.es),this.e3=Hr(this.es),this.ml0=this.a*Dt(this.e0,this.e1,this.e2,this.e3,this.lat0)}function pg(e){var t=e.x,r=e.y,i,s,n,o=_(t-this.long0);if(n=o*Math.sin(r),this.sphere)Math.abs(r)<=b?(i=this.a*o,s=-1*this.a*this.lat0):(i=this.a*Math.sin(n)/Math.tan(r),s=this.a*(rr(r-this.lat0)+(1-Math.cos(n))/Math.tan(r)));else if(Math.abs(r)<=b)i=this.a*o,s=-1*this.ml0;else{var a=qr(this.a,this.e,Math.sin(r))/Math.tan(r);i=a*Math.sin(n),s=this.a*Dt(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+a*(1-Math.cos(n))}return e.x=i+this.x0,e.y=s+this.y0,e}function mg(e){var t,r,i,s,n,o,a,h,l;if(i=e.x-this.x0,s=e.y-this.y0,this.sphere)if(Math.abs(s+this.a*this.lat0)<=b)t=_(i/this.a+this.long0),r=0;else{o=this.lat0+s/this.a,a=i*i/this.a/this.a+o*o,h=o;var c;for(n=Mf;n;--n)if(c=Math.tan(h),l=-1*(o*(h*c+1)-h-.5*(h*h+a)*c)/((h-o)/c-1),h+=l,Math.abs(l)<=b){r=h;break}t=_(this.long0+Math.asin(i*Math.tan(h)/this.a)/Math.sin(r))}else if(Math.abs(s+this.ml0)<=b)r=0,t=_(this.long0+i/this.a);else{o=(this.ml0+s)/this.a,a=i*i/this.a/this.a+o*o,h=o;var u,d,p,m,g;for(n=Mf;n;--n)if(g=this.e*Math.sin(h),u=Math.sqrt(1-g*g)*Math.tan(h),d=this.a*Dt(this.e0,this.e1,this.e2,this.e3,h),p=this.e0-2*this.e1*Math.cos(2*h)+4*this.e2*Math.cos(4*h)-6*this.e3*Math.cos(6*h),m=d/this.a,l=(o*(u*m+1)-m-.5*u*(m*m+a))/(this.es*Math.sin(2*h)*(m*m+a-2*o*m)/(4*u)+(o-m)*(u*p-2/Math.sin(2*h))-p),h-=l,Math.abs(l)<=b){r=h;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(r),2))*Math.tan(r),t=_(this.long0+Math.asin(i*u/this.a)/Math.sin(r))}return e.x=t,e.y=r,e}var yg=["Polyconic","poly"],If={init:dg,forward:pg,inverse:mg,names:yg};function gg(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function bg(e){var t,r=e.x,i=e.y,s=i-this.lat0,n=r-this.long0,o=s/Ri*1e-5,a=n,h=1,l=0;for(t=1;t<=10;t++)h=h*o,l=l+this.A[t]*h;var c=l,u=a,d=1,p=0,m,g,v=0,I=0;for(t=1;t<=6;t++)m=d*c-p*u,g=p*c+d*u,d=m,p=g,v=v+this.B_re[t]*d-this.B_im[t]*p,I=I+this.B_im[t]*d+this.B_re[t]*p;return e.x=I*this.a+this.x0,e.y=v*this.a+this.y0,e}function _g(e){var t,r=e.x,i=e.y,s=r-this.x0,n=i-this.y0,o=n/this.a,a=s/this.a,h=1,l=0,c,u,d=0,p=0;for(t=1;t<=6;t++)c=h*o-l*a,u=l*o+h*a,h=c,l=u,d=d+this.C_re[t]*h-this.C_im[t]*l,p=p+this.C_im[t]*h+this.C_re[t]*l;for(var m=0;m<this.iterations;m++){var g=d,v=p,I,z,$=o,nt=a;for(t=2;t<=6;t++)I=g*d-v*p,z=v*d+g*p,g=I,v=z,$=$+(t-1)*(this.B_re[t]*g-this.B_im[t]*v),nt=nt+(t-1)*(this.B_im[t]*g+this.B_re[t]*v);g=1,v=0;var K=this.B_re[1],tt=this.B_im[1];for(t=2;t<=6;t++)I=g*d-v*p,z=v*d+g*p,g=I,v=z,K=K+t*(this.B_re[t]*g-this.B_im[t]*v),tt=tt+t*(this.B_im[t]*g+this.B_re[t]*v);var Ct=K*K+tt*tt;d=($*K+nt*tt)/Ct,p=(nt*K-$*tt)/Ct}var gt=d,sr=p,ei=1,ri=0;for(t=1;t<=9;t++)ei=ei*gt,ri=ri+this.D[t]*ei;var Pn=this.lat0+ri*Ri*1e5,id=this.long0+sr;return e.x=id,e.y=Pn,e}var vg=["New_Zealand_Map_Grid","nzmg"],Sf={init:gg,forward:bg,inverse:_g,names:vg};function wg(){}function xg(e){var t=e.x,r=e.y,i=_(t-this.long0),s=this.x0+this.a*i,n=this.y0+this.a*Math.log(Math.tan(Math.PI/4+r/2.5))*1.25;return e.x=s,e.y=n,e}function Mg(e){e.x-=this.x0,e.y-=this.y0;var t=_(this.long0+e.x/this.a),r=2.5*(Math.atan(Math.exp(.8*e.y/this.a))-Math.PI/4);return e.x=t,e.y=r,e}var Ig=["Miller_Cylindrical","mill"],Bf={init:wg,forward:xg,inverse:Mg,names:Ig};var Sg=20;function Bg(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=xa(this.es)}function Ag(e){var t,r,i=e.x,s=e.y;if(i=_(i-this.long0),this.sphere){if(!this.m)s=this.n!==1?Math.asin(this.n*Math.sin(s)):s;else for(var n=this.n*Math.sin(s),o=Sg;o;--o){var a=(this.m*s+Math.sin(s)-n)/(this.m+Math.cos(s));if(s-=a,Math.abs(a)<b)break}t=this.a*this.C_x*i*(this.m+Math.cos(s)),r=this.a*this.C_y*s}else{var h=Math.sin(s),l=Math.cos(s);r=this.a*Pi(s,h,l,this.en),t=this.a*i*l/Math.sqrt(1-this.es*h*h)}return e.x=t,e.y=r,e}function Dg(e){var t,r,i,s;return e.x-=this.x0,i=e.x/this.a,e.y-=this.y0,t=e.y/this.a,this.sphere?(t/=this.C_y,i=i/(this.C_x*(this.m+Math.cos(t))),this.m?t=ge((this.m*t+Math.sin(t))/this.n):this.n!==1&&(t=ge(Math.sin(t)/this.n)),i=_(i+this.long0),t=rr(t)):(t=Ma(e.y/this.a,this.es,this.en),s=Math.abs(t),s<y?(s=Math.sin(t),r=this.long0+e.x*Math.sqrt(1-this.es*s*s)/(this.a*Math.cos(t)),i=_(r)):s-b<y&&(i=this.long0)),e.x=i,e.y=t,e}var Tg=["Sinusoidal","sinu"],Af={init:Bg,forward:Ag,inverse:Dg,names:Tg};function Og(){}function Eg(e){for(var t=e.x,r=e.y,i=_(t-this.long0),s=r,n=Math.PI*Math.sin(r);;){var o=-(s+Math.sin(s)-n)/(1+Math.cos(s));if(s+=o,Math.abs(o)<b)break}s/=2,Math.PI/2-Math.abs(r)<b&&(i=0);var a=.900316316158*this.a*i*Math.cos(s)+this.x0,h=1.4142135623731*this.a*Math.sin(s)+this.y0;return e.x=a,e.y=h,e}function Ng(e){var t,r;e.x-=this.x0,e.y-=this.y0,r=e.y/(1.4142135623731*this.a),Math.abs(r)>.999999999999&&(r=.999999999999),t=Math.asin(r);var i=_(this.long0+e.x/(.900316316158*this.a*Math.cos(t)));i<-Math.PI&&(i=-Math.PI),i>Math.PI&&(i=Math.PI),r=(2*t+Math.sin(2*t))/Math.PI,Math.abs(r)>1&&(r=1);var s=Math.asin(r);return e.x=i,e.y=s,e}var Fg=["Mollweide","moll"],Df={init:Og,forward:Eg,inverse:Ng,names:Fg};function Lg(){Math.abs(this.lat1+this.lat2)<b||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=kr(this.es),this.e1=Gr(this.es),this.e2=Wr(this.es),this.e3=Hr(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=kt(this.e,this.sinphi,this.cosphi),this.ml1=Dt(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<b?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=kt(this.e,this.sinphi,this.cosphi),this.ml2=Dt(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=Dt(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function Rg(e){var t=e.x,r=e.y,i;if(this.sphere)i=this.a*(this.g-r);else{var s=Dt(this.e0,this.e1,this.e2,this.e3,r);i=this.a*(this.g-s)}var n=this.ns*_(t-this.long0),o=this.x0+i*Math.sin(n),a=this.y0+this.rh-i*Math.cos(n);return e.x=o,e.y=a,e}function Ug(e){e.x-=this.x0,e.y=this.rh-e.y+this.y0;var t,r,i,s;this.ns>=0?(r=Math.sqrt(e.x*e.x+e.y*e.y),t=1):(r=-Math.sqrt(e.x*e.x+e.y*e.y),t=-1);var n=0;if(r!==0&&(n=Math.atan2(t*e.x,t*e.y)),this.sphere)return s=_(this.long0+n/this.ns),i=rr(this.g-r/this.a),e.x=s,e.y=i,e;var o=this.g-r/this.a;return i=zi(o,this.e0,this.e1,this.e2,this.e3),s=_(this.long0+n/this.ns),e.x=s,e.y=i,e}var Cg=["Equidistant_Conic","eqdc"],Tf={init:Lg,forward:Rg,inverse:Ug,names:Cg};function Pg(){this.R=this.a}function zg(e){var t=e.x,r=e.y,i=_(t-this.long0),s,n;Math.abs(r)<=b&&(s=this.x0+this.R*i,n=this.y0);var o=ge(2*Math.abs(r/Math.PI));(Math.abs(i)<=b||Math.abs(Math.abs(r)-y)<=b)&&(s=this.x0,r>=0?n=this.y0+Math.PI*this.R*Math.tan(.5*o):n=this.y0+Math.PI*this.R*-Math.tan(.5*o));var a=.5*Math.abs(Math.PI/i-i/Math.PI),h=a*a,l=Math.sin(o),c=Math.cos(o),u=c/(l+c-1),d=u*u,p=u*(2/l-1),m=p*p,g=Math.PI*this.R*(a*(u-m)+Math.sqrt(h*(u-m)*(u-m)-(m+h)*(d-m)))/(m+h);i<0&&(g=-g),s=this.x0+g;var v=h+u;return g=Math.PI*this.R*(p*v-a*Math.sqrt((m+h)*(h+1)-v*v))/(m+h),r>=0?n=this.y0+g:n=this.y0-g,e.x=s,e.y=n,e}function jg(e){var t,r,i,s,n,o,a,h,l,c,u,d,p;return e.x-=this.x0,e.y-=this.y0,u=Math.PI*this.R,i=e.x/u,s=e.y/u,n=i*i+s*s,o=-Math.abs(s)*(1+n),a=o-2*s*s+i*i,h=-2*o+1+2*s*s+n*n,p=s*s/h+(2*a*a*a/h/h/h-9*o*a/h/h)/27,l=(o-a*a/3/h)/h,c=2*Math.sqrt(-l/3),u=3*p/l/c,Math.abs(u)>1&&(u>=0?u=1:u=-1),d=Math.acos(u)/3,e.y>=0?r=(-c*Math.cos(d+Math.PI/3)-a/3/h)*Math.PI:r=-(-c*Math.cos(d+Math.PI/3)-a/3/h)*Math.PI,Math.abs(i)<b?t=this.long0:t=_(this.long0+Math.PI*(n-1+Math.sqrt(1+2*(i*i-s*s)+n*n))/2/i),e.x=t,e.y=r,e}var Vg=["Van_der_Grinten_I","VanDerGrinten","vandg"],Of={init:Pg,forward:zg,inverse:jg,names:Vg};function kg(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function Gg(e){var t=e.x,r=e.y,i=Math.sin(e.y),s=Math.cos(e.y),n=_(t-this.long0),o,a,h,l,c,u,d,p,m,g,v,I,z,$,nt,K,tt,Ct,gt,sr,ei,ri,Pn;return this.sphere?Math.abs(this.sin_p12-1)<=b?(e.x=this.x0+this.a*(y-r)*Math.sin(n),e.y=this.y0-this.a*(y-r)*Math.cos(n),e):Math.abs(this.sin_p12+1)<=b?(e.x=this.x0+this.a*(y+r)*Math.sin(n),e.y=this.y0+this.a*(y+r)*Math.cos(n),e):(Ct=this.sin_p12*i+this.cos_p12*s*Math.cos(n),K=Math.acos(Ct),tt=K?K/Math.sin(K):1,e.x=this.x0+this.a*tt*s*Math.sin(n),e.y=this.y0+this.a*tt*(this.cos_p12*i-this.sin_p12*s*Math.cos(n)),e):(o=kr(this.es),a=Gr(this.es),h=Wr(this.es),l=Hr(this.es),Math.abs(this.sin_p12-1)<=b?(c=this.a*Dt(o,a,h,l,y),u=this.a*Dt(o,a,h,l,r),e.x=this.x0+(c-u)*Math.sin(n),e.y=this.y0-(c-u)*Math.cos(n),e):Math.abs(this.sin_p12+1)<=b?(c=this.a*Dt(o,a,h,l,y),u=this.a*Dt(o,a,h,l,r),e.x=this.x0+(c+u)*Math.sin(n),e.y=this.y0+(c+u)*Math.cos(n),e):(d=i/s,p=qr(this.a,this.e,this.sin_p12),m=qr(this.a,this.e,i),g=Math.atan((1-this.es)*d+this.es*p*this.sin_p12/(m*s)),v=Math.atan2(Math.sin(n),this.cos_p12*Math.tan(g)-this.sin_p12*Math.cos(n)),v===0?gt=Math.asin(this.cos_p12*Math.sin(g)-this.sin_p12*Math.cos(g)):Math.abs(Math.abs(v)-Math.PI)<=b?gt=-Math.asin(this.cos_p12*Math.sin(g)-this.sin_p12*Math.cos(g)):gt=Math.asin(Math.sin(n)*Math.cos(g)/Math.sin(v)),I=this.e*this.sin_p12/Math.sqrt(1-this.es),z=this.e*this.cos_p12*Math.cos(v)/Math.sqrt(1-this.es),$=I*z,nt=z*z,sr=gt*gt,ei=sr*gt,ri=ei*gt,Pn=ri*gt,K=p*gt*(1-sr*nt*(1-nt)/6+ei/8*$*(1-2*nt)+ri/120*(nt*(4-7*nt)-3*I*I*(1-7*nt))-Pn/48*$),e.x=this.x0+K*Math.sin(v),e.y=this.y0+K*Math.cos(v),e))}function Wg(e){e.x-=this.x0,e.y-=this.y0;var t,r,i,s,n,o,a,h,l,c,u,d,p,m,g,v,I,z,$,nt,K,tt,Ct,gt;return this.sphere?(t=Math.sqrt(e.x*e.x+e.y*e.y),t>2*y*this.a?void 0:(r=t/this.a,i=Math.sin(r),s=Math.cos(r),n=this.long0,Math.abs(t)<=b?o=this.lat0:(o=ge(s*this.sin_p12+e.y*i*this.cos_p12/t),a=Math.abs(this.lat0)-y,Math.abs(a)<=b?this.lat0>=0?n=_(this.long0+Math.atan2(e.x,-e.y)):n=_(this.long0-Math.atan2(-e.x,e.y)):n=_(this.long0+Math.atan2(e.x*i,t*this.cos_p12*s-e.y*this.sin_p12*i))),e.x=n,e.y=o,e)):(h=kr(this.es),l=Gr(this.es),c=Wr(this.es),u=Hr(this.es),Math.abs(this.sin_p12-1)<=b?(d=this.a*Dt(h,l,c,u,y),t=Math.sqrt(e.x*e.x+e.y*e.y),p=d-t,o=zi(p/this.a,h,l,c,u),n=_(this.long0+Math.atan2(e.x,-1*e.y)),e.x=n,e.y=o,e):Math.abs(this.sin_p12+1)<=b?(d=this.a*Dt(h,l,c,u,y),t=Math.sqrt(e.x*e.x+e.y*e.y),p=t-d,o=zi(p/this.a,h,l,c,u),n=_(this.long0+Math.atan2(e.x,e.y)),e.x=n,e.y=o,e):(t=Math.sqrt(e.x*e.x+e.y*e.y),v=Math.atan2(e.x,e.y),m=qr(this.a,this.e,this.sin_p12),I=Math.cos(v),z=this.e*this.cos_p12*I,$=-z*z/(1-this.es),nt=3*this.es*(1-$)*this.sin_p12*this.cos_p12*I/(1-this.es),K=t/m,tt=K-$*(1+$)*Math.pow(K,3)/6-nt*(1+3*$)*Math.pow(K,4)/24,Ct=1-$*tt*tt/2-K*tt*tt*tt/6,g=Math.asin(this.sin_p12*Math.cos(tt)+this.cos_p12*Math.sin(tt)*I),n=_(this.long0+Math.asin(Math.sin(v)*Math.sin(tt)/Math.cos(g))),gt=Math.sin(g),o=Math.atan2((gt-this.es*Ct*this.sin_p12)*Math.tan(g),gt*(1-this.es)),e.x=n,e.y=o,e))}var Hg=["Azimuthal_Equidistant","aeqd"],Ef={init:kg,forward:Gg,inverse:Wg,names:Hg};function qg(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function $g(e){var t,r,i,s,n,o,a,h,l=e.x,c=e.y;return i=_(l-this.long0),t=Math.sin(c),r=Math.cos(c),s=Math.cos(i),o=this.sin_p14*t+this.cos_p14*r*s,n=1,(o>0||Math.abs(o)<=b)&&(a=this.a*n*r*Math.sin(i),h=this.y0+this.a*n*(this.cos_p14*t-this.sin_p14*r*s)),e.x=a,e.y=h,e}function Yg(e){var t,r,i,s,n,o,a;return e.x-=this.x0,e.y-=this.y0,t=Math.sqrt(e.x*e.x+e.y*e.y),r=ge(t/this.a),i=Math.sin(r),s=Math.cos(r),o=this.long0,Math.abs(t)<=b?(a=this.lat0,e.x=o,e.y=a,e):(a=ge(s*this.sin_p14+e.y*i*this.cos_p14/t),n=Math.abs(this.lat0)-y,Math.abs(n)<=b?(this.lat0>=0?o=_(this.long0+Math.atan2(e.x,-e.y)):o=_(this.long0-Math.atan2(-e.x,e.y)),e.x=o,e.y=a,e):(o=_(this.long0+Math.atan2(e.x*i,t*this.cos_p14*s-e.y*this.sin_p14*i)),e.x=o,e.y=a,e))}var Jg=["ortho"],Nf={init:qg,forward:$g,inverse:Yg,names:Jg};var yt={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},it={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function Xg(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=y-J/2?this.face=yt.TOP:this.lat0<=-(y-J/2)?this.face=yt.BOTTOM:Math.abs(this.long0)<=J?this.face=yt.FRONT:Math.abs(this.long0)<=y+J?this.face=this.long0>0?yt.RIGHT:yt.LEFT:this.face=yt.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function Kg(e){var t={x:0,y:0},r,i,s,n,o,a,h={value:0};if(e.x-=this.long0,this.es!==0?r=Math.atan(this.one_minus_f_squared*Math.tan(e.y)):r=e.y,i=e.x,this.face===yt.TOP)n=y-r,i>=J&&i<=y+J?(h.value=it.AREA_0,s=i-y):i>y+J||i<=-(y+J)?(h.value=it.AREA_1,s=i>0?i-mt:i+mt):i>-(y+J)&&i<=-J?(h.value=it.AREA_2,s=i+y):(h.value=it.AREA_3,s=i);else if(this.face===yt.BOTTOM)n=y+r,i>=J&&i<=y+J?(h.value=it.AREA_0,s=-i+y):i<J&&i>=-J?(h.value=it.AREA_1,s=-i):i<-J&&i>=-(y+J)?(h.value=it.AREA_2,s=-i-y):(h.value=it.AREA_3,s=i>0?-i+mt:-i-mt);else{var l,c,u,d,p,m,g;this.face===yt.RIGHT?i=Ns(i,+y):this.face===yt.BACK?i=Ns(i,+mt):this.face===yt.LEFT&&(i=Ns(i,-y)),d=Math.sin(r),p=Math.cos(r),m=Math.sin(i),g=Math.cos(i),l=p*g,c=p*m,u=d,this.face===yt.FRONT?(n=Math.acos(l),s=Da(n,u,c,h)):this.face===yt.RIGHT?(n=Math.acos(c),s=Da(n,u,-l,h)):this.face===yt.BACK?(n=Math.acos(-l),s=Da(n,u,-c,h)):this.face===yt.LEFT?(n=Math.acos(-c),s=Da(n,u,l,h)):(n=s=0,h.value=it.AREA_0)}return a=Math.atan(12/mt*(s+Math.acos(Math.sin(s)*Math.cos(J))-y)),o=Math.sqrt((1-Math.cos(n))/(Math.cos(a)*Math.cos(a))/(1-Math.cos(Math.atan(1/Math.cos(s))))),h.value===it.AREA_1?a+=y:h.value===it.AREA_2?a+=mt:h.value===it.AREA_3&&(a+=1.5*mt),t.x=o*Math.cos(a),t.y=o*Math.sin(a),t.x=t.x*this.a+this.x0,t.y=t.y*this.a+this.y0,e.x=t.x,e.y=t.y,e}function Zg(e){var t={lam:0,phi:0},r,i,s,n,o,a,h,l,c,u={value:0};if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,i=Math.atan(Math.sqrt(e.x*e.x+e.y*e.y)),r=Math.atan2(e.y,e.x),e.x>=0&&e.x>=Math.abs(e.y)?u.value=it.AREA_0:e.y>=0&&e.y>=Math.abs(e.x)?(u.value=it.AREA_1,r-=y):e.x<0&&-e.x>=Math.abs(e.y)?(u.value=it.AREA_2,r=r<0?r+mt:r-mt):(u.value=it.AREA_3,r+=y),c=mt/12*Math.tan(r),o=Math.sin(c)/(Math.cos(c)-1/Math.sqrt(2)),a=Math.atan(o),s=Math.cos(r),n=Math.tan(i),h=1-s*s*n*n*(1-Math.cos(Math.atan(1/Math.cos(a)))),h<-1?h=-1:h>1&&(h=1),this.face===yt.TOP)l=Math.acos(h),t.phi=y-l,u.value===it.AREA_0?t.lam=a+y:u.value===it.AREA_1?t.lam=a<0?a+mt:a-mt:u.value===it.AREA_2?t.lam=a-y:t.lam=a;else if(this.face===yt.BOTTOM)l=Math.acos(h),t.phi=l-y,u.value===it.AREA_0?t.lam=-a+y:u.value===it.AREA_1?t.lam=-a:u.value===it.AREA_2?t.lam=-a-y:t.lam=a<0?-a-mt:-a+mt;else{var d,p,m;d=h,c=d*d,c>=1?m=0:m=Math.sqrt(1-c)*Math.sin(a),c+=m*m,c>=1?p=0:p=Math.sqrt(1-c),u.value===it.AREA_1?(c=p,p=-m,m=c):u.value===it.AREA_2?(p=-p,m=-m):u.value===it.AREA_3&&(c=p,p=m,m=-c),this.face===yt.RIGHT?(c=d,d=-p,p=c):this.face===yt.BACK?(d=-d,p=-p):this.face===yt.LEFT&&(c=d,d=p,p=-c),t.phi=Math.acos(-m)-y,t.lam=Math.atan2(p,d),this.face===yt.RIGHT?t.lam=Ns(t.lam,-y):this.face===yt.BACK?t.lam=Ns(t.lam,-mt):this.face===yt.LEFT&&(t.lam=Ns(t.lam,+y))}if(this.es!==0){var g,v,I;g=t.phi<0?1:0,v=Math.tan(t.phi),I=this.b/Math.sqrt(v*v+this.one_minus_f_squared),t.phi=Math.atan(Math.sqrt(this.a*this.a-I*I)/(this.one_minus_f*I)),g&&(t.phi=-t.phi)}return t.lam+=this.long0,e.x=t.lam,e.y=t.phi,e}function Da(e,t,r,i){var s;return e<b?(i.value=it.AREA_0,s=0):(s=Math.atan2(t,r),Math.abs(s)<=J?i.value=it.AREA_0:s>J&&s<=y+J?(i.value=it.AREA_1,s-=y):s>y+J||s<=-(y+J)?(i.value=it.AREA_2,s=s>=0?s-mt:s+mt):(i.value=it.AREA_3,s+=y)),s}function Ns(e,t){var r=e+t;return r<-mt?r+=An:r>+mt&&(r-=An),r}var Qg=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],Ff={init:Xg,forward:Kg,inverse:Zg,names:Qg};var tl=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],Fn=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Lf=.8487,Rf=1.3523,Uf=er/5,tb=1/Uf,Fs=18,Ta=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},eb=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function rb(e,t,r,i){for(var s=t;i;--i){var n=e(s);if(s-=n,Math.abs(n)<r)break}return s}function ib(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function sb(e){var t=_(e.x-this.long0),r=Math.abs(e.y),i=Math.floor(r*Uf);i<0?i=0:i>=Fs&&(i=Fs-1),r=er*(r-tb*i);var s={x:Ta(tl[i],r)*t,y:Ta(Fn[i],r)};return e.y<0&&(s.y=-s.y),s.x=s.x*this.a*Lf+this.x0,s.y=s.y*this.a*Rf+this.y0,s}function nb(e){var t={x:(e.x-this.x0)/(this.a*Lf),y:Math.abs(e.y-this.y0)/(this.a*Rf)};if(t.y>=1)t.x/=tl[Fs][0],t.y=e.y<0?-y:y;else{var r=Math.floor(t.y*Fs);for(r<0?r=0:r>=Fs&&(r=Fs-1);;)if(Fn[r][0]>t.y)--r;else if(Fn[r+1][0]<=t.y)++r;else break;var i=Fn[r],s=5*(t.y-i[0])/(Fn[r+1][0]-i[0]);s=rb(function(n){return(Ta(i,n)-t.y)/eb(i,n)},s,b,100),t.x/=Ta(tl[r],s),t.y=(5*r+s)*Bt,e.y<0&&(t.y=-t.y)}return t.x=_(t.x+this.long0),t}var ob=["Robinson","robin"],Cf={init:ib,forward:sb,inverse:nb,names:ob};function ab(){this.name="geocent"}function hb(e){var t=ba(e,this.es,this.a);return t}function lb(e){var t=_a(e,this.es,this.a,this.b);return t}var cb=["Geocentric","geocentric","geocent","Geocent"],Pf={init:ab,forward:hb,inverse:lb,names:cb};function zf(e){e.Proj.projections.add(rf),e.Proj.projections.add(Es),e.Proj.projections.add(lf),e.Proj.projections.add(cf),e.Proj.projections.add(uf),e.Proj.projections.add(ff),e.Proj.projections.add(df),e.Proj.projections.add(pf),e.Proj.projections.add(mf),e.Proj.projections.add(yf),e.Proj.projections.add(gf),e.Proj.projections.add(bf),e.Proj.projections.add(_f),e.Proj.projections.add(wf),e.Proj.projections.add(xf),e.Proj.projections.add(If),e.Proj.projections.add(Sf),e.Proj.projections.add(Bf),e.Proj.projections.add(Af),e.Proj.projections.add(Df),e.Proj.projections.add(Tf),e.Proj.projections.add(Of),e.Proj.projections.add(Ef),e.Proj.projections.add(Nf),e.Proj.projections.add(Ff),e.Proj.projections.add(Cf),e.Proj.projections.add(Pf)}Be.defaultDatum="WGS84";Be.Proj=ti;Be.WGS84=new Be.Proj("WGS84");Be.Point=Zu;Be.toPoint=wa;Be.defs=As;Be.transform=Ci;Be.mgrs=Ju;Be.version="__VERSION__";zf(Be);var el=Be;var Ln=class{static defineProjectionAliases(t){let r=[];for(let i in t)r.push([i,t[i]]);el.defs(r)}constructor({from:t="WGS84",to:r="WGS84"}){if(this._projection=el(t,r),!this._projection)throw new Error("Invalid projection");this.project=this.project.bind(this),this.unproject=this.unproject.bind(this)}project(t){return this._projection.forward(t)}unproject(t){return this._projection.inverse(t)}};var rl=100,jf=!1;function Vf(e){let t=new DataView(e,0,rl),i=Wn(t).length-rl,s=new DataView(e,rl,i),n=new Int32Array(i),o=new Int32Array(i);for(let a=0;a<i/8;a++)n[a]=s.getInt32(a*8,jf),o[a]=s.getInt32(a*8+4,jf);return{offsets:n,lengths:o}}async function*Oa(e,t,r){let i=[],s=[],n=!1,o=!1;for(;!n&&!o;){if(i.length===0&&!n){let{value:h,done:l}=await e.next();l?n=!0:i.push(...h)}if(s.length===0&&!o){let{value:h,done:l}=await t.next();l?o=!0:s.push(...h)}let a=ub(i,s);a&&(yield{batchType:"data",shape:r,length:a.length,data:a})}}function ub(e,t){let r=Math.min(e.length,t.length);if(r===0)return null;let i=[e.slice(0,r),t.slice(0,r)];return e.splice(0,r),t.splice(0,r),i}var il=!0,kf=32,Kt;(function(e){e[e.START=0]="START",e[e.FIELD_DESCRIPTORS=1]="FIELD_DESCRIPTORS",e[e.FIELD_PROPERTIES=2]="FIELD_PROPERTIES",e[e.END=3]="END",e[e.ERROR=4]="ERROR"})(Kt||(Kt={}));var Na=class{binaryReader=new nr;textDecoder;state=Kt.START;result={data:[]};constructor(t){this.textDecoder=new TextDecoder(t.encoding)}write(t){this.binaryReader.write(t),this.state=Gf(this.state,this.result,this.binaryReader,this.textDecoder)}end(){this.binaryReader.end(),this.state=Gf(this.state,this.result,this.binaryReader,this.textDecoder),this.state!==Kt.END&&(this.state=Kt.ERROR,this.result.error="DBF incomplete file")}};function sl(e,t={}){let{encoding:r="latin1"}=t.dbf||{},i=new Na({encoding:r});i.write(e),i.end();let{data:s,schema:n}=i.result;switch(t?.dbf?.shape){case"object-row-table":return{shape:"object-row-table",schema:n,data:s};case"table":return{schema:n,rows:s};case"rows":default:return s}}async function*Wf(e,t={}){let{encoding:r="latin1"}=t.dbf||{},i=new Na({encoding:r}),s=!1;for await(let n of Dr(e))i.write(n),!s&&i.result.dbfHeader&&(s=!0,yield i.result.dbfHeader),i.result.data.length>0&&(yield i.result.data,i.result.data=[]);i.end(),i.result.data.length>0&&(yield i.result.data)}function Gf(e,t,r,i){for(;;)try{switch(e){case Kt.ERROR:case Kt.END:return e;case Kt.START:let s=r.getDataView(kf);if(!s)return e;t.dbfHeader=fb(s),t.progress={bytesUsed:0,rowsTotal:t.dbfHeader.nRecords,rows:0},e=Kt.FIELD_DESCRIPTORS;break;case Kt.FIELD_DESCRIPTORS:let n=r.getDataView(t.dbfHeader.headerLength-kf);if(!n)return e;t.dbfFields=db(n,i),t.schema={fields:t.dbfFields.map(h=>_b(h)),metadata:{}},e=Kt.FIELD_PROPERTIES,r.skip(1);break;case Kt.FIELD_PROPERTIES:let{recordLength:o=0,nRecords:a=0}=t?.dbfHeader||{};for(;t.data.length<a;){let h=r.getDataView(o-1);if(!h)return e;r.skip(1);let l=pb(h,t.dbfFields,i);t.data.push(l),t.progress.rows=t.data.length}e=Kt.END;break;default:return e=Kt.ERROR,t.error=`illegal parser state ${e}`,e}}catch(s){return e=Kt.ERROR,t.error=`DBF parsing failed: ${s.message}`,e}}function fb(e){return{year:e.getUint8(1)+1900,month:e.getUint8(2),day:e.getUint8(3),nRecords:e.getUint32(4,il),headerLength:e.getUint16(8,il),recordLength:e.getUint16(10,il),languageDriver:e.getUint8(29)}}function db(e,t){let r=(e.byteLength-1)/32,i=[],s=0;for(let n=0;n<r;n++){let o=t.decode(new Uint8Array(e.buffer,e.byteOffset+s,11)).replace(/\u0000/g,"");i.push({name:o,dataType:String.fromCharCode(e.getUint8(s+11)),fieldLength:e.getUint8(s+16),decimal:e.getUint8(s+17)}),s+=32}return i}function pb(e,t,r){let i={},s=0;for(let n of t){let o=r.decode(new Uint8Array(e.buffer,e.byteOffset+s,n.fieldLength));i[n.name]=mb(o,n.dataType),s+=n.fieldLength}return i}function mb(e,t){switch(t){case"B":return Ea(e);case"C":return bb(e);case"F":return Ea(e);case"N":return Ea(e);case"O":return Ea(e);case"D":return yb(e);case"L":return gb(e);default:throw new Error("Unsupported data type")}}function yb(e){return Date.UTC(e.slice(0,4),parseInt(e.slice(4,6),10)-1,e.slice(6,8))}function gb(e){return/^[nf]$/i.test(e)?!1:/^[yt]$/i.test(e)?!0:null}function Ea(e){let t=parseFloat(e);return isNaN(t)?null:t}function bb(e){return e.trim()||null}function _b({name:e,dataType:t,fieldLength:r,decimal:i}){switch(t){case"B":return{name:e,type:"float64",nullable:!0,metadata:{}};case"C":return{name:e,type:"utf8",nullable:!0,metadata:{}};case"F":return{name:e,type:"float64",nullable:!0,metadata:{}};case"N":return{name:e,type:"float64",nullable:!0,metadata:{}};case"O":return{name:e,type:"float64",nullable:!0,metadata:{}};case"D":return{name:e,type:"timestamp-millisecond",nullable:!0,metadata:{}};case"L":return{name:e,type:"bool",nullable:!0,metadata:{}};default:throw new Error("Unsupported data type")}}var vb="4.4.0-alpha.13",nl={name:"DBF",dataType:null,batchType:null,id:"dbf",module:"shapefile",version:vb,worker:!0,category:"table",extensions:["dbf"],mimeTypes:["application/x-dbf"],options:{dbf:{encoding:"latin1"}}},Rn={...nl,parse:async(e,t)=>sl(e,t),parseSync:sl,parseInBatches(e,t){return Wf(e,t)}};async function*Hf(e,t,r){let{reproject:i=!1,_targetCrs:s="WGS84"}=t?.gis||{},{shx:n,cpg:o,prj:a}=await Xf(t,r),h=await Gn(Dr(e),Rs,t,r),l=h[Symbol.asyncIterator]?.()||h[Symbol.iterator]?.(),c=null,u=await r?.fetch(Un(r?.url||"","dbf"));if(u?.ok){let v=await Gn(u,Rn,{...t,dbf:{...t?.dbf,encoding:o||"latin1"}},r);c=v[Symbol.asyncIterator]?.()||v[Symbol.iterator]()}let d=(await l.next()).value;d&&d.batchType==="metadata"&&(d=(await l.next()).value);let p={};c&&(p=(await c.next()).value,p&&p.batchType==="metadata"&&(p=(await c.next()).value));let m=c?Oa(l,c,"object-row-table"):l,g={[Symbol.asyncIterator](){return m}};for await(let v of g){let I,z;c?[I,z]=v.data:I=v;let $=$f(I),nt=Yf($,z);i&&(nt=Jf(nt,a,s)),yield{encoding:o,prj:a,shx:n,header:d,data:nt}}}async function qf(e,t,r){let{reproject:i=!1,_targetCrs:s="WGS84"}=t?.gis||{},{shx:n,cpg:o,prj:a}=await Xf(t,r),{header:h,geometries:l}=await kn(e,Rs,t,r),c=$f(l),u,d=await r?.fetch(Un(r?.url,"dbf"));if(d?.ok){let m={...t,dbf:{...t?.dbf,shape:"object-row-table",encoding:o||"latin1"}};u=await kn(d,Rn,m,r)}let p=Yf(c,u?.data||[]);switch(i&&(p=Jf(p,a,s)),t?.shapefile?.shape){case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",encoding:o,schema:u?.schema||{metadata:{},fields:[]},prj:a,shx:n,header:h,features:p};default:return{encoding:o,prj:a,shx:n,header:h,data:p}}}function $f(e){let t=[];for(let r of e)t.push(Wh(r));return t}function Yf(e,t){let r=[];for(let i=0;i<e.length;i++){let n={type:"Feature",geometry:e[i],properties:t&&t[i]||{}};r.push(n)}return r}function Jf(e,t,r){if(!t&&!r)return e;let i=new Ln({from:t||"WGS84",to:r||"WGS84"});return Va(e,s=>i.project(s))}async function Xf(e,t){let{url:r,fetch:i}=t,s=i(Un(r,"shx")),n=i(Un(r,"cpg")),o=i(Un(r,"prj"));await Promise.all([s,n,o]);let a,h,l,c=await s;if(c.ok){let p=await c.arrayBuffer();a=Vf(p)}let u=await n;u.ok&&(h=await u.text());let d=await o;return d.ok&&(l=await d.text()),{shx:a,cpg:h,prj:l}}function Un(e,t){let r=wb(e),i=xb(e);return i===i.toUpperCase()&&(t=t.toUpperCase()),`${r}.${t}`}function wb(e){let t=e&&e.lastIndexOf(".");return typeof t=="number"?t>=0?e.substr(0,t):"":t}function xb(e){let t=e&&e.lastIndexOf(".");return typeof t=="number"?t>=0?e.substr(t+1):"":t}var Mb="4.4.0-alpha.13",Kf={name:"Shapefile",id:"shapefile",module:"shapefile",version:Mb,category:"geometry",extensions:["shp"],mimeTypes:["application/octet-stream"],tests:[new Uint8Array(za).buffer],options:{shapefile:{shape:"v3"},shp:{_maxDimensions:4}},parse:qf,parseInBatches:Hf};var ol=!0,Zf=32,Zt;(function(e){e[e.START=0]="START",e[e.FIELD_DESCRIPTORS=1]="FIELD_DESCRIPTORS",e[e.FIELD_PROPERTIES=2]="FIELD_PROPERTIES",e[e.END=3]="END",e[e.ERROR=4]="ERROR"})(Zt||(Zt={}));var La=class{binaryReader=new nr;textDecoder;state=Zt.START;result={};constructor(t){this.textDecoder=new TextDecoder(t.encoding)}write(t){this.binaryReader.write(t),this.state=Qf(this.state,this.result,this.binaryReader,this.textDecoder)}end(){this.binaryReader.end(),this.state=Qf(this.state,this.result,this.binaryReader,this.textDecoder),this.state!==Zt.END&&(this.state=Zt.ERROR,this.result.error="DBF incomplete file")}};function al(e,t={}){let{encoding:r="latin1"}=t.dbf||{},i=new La({encoding:r});return i.write(e),i.end(),i.result.tableBuilder.finishTable()}async function*td(e,t={}){let{encoding:r="latin1"}=t.dbf||{},i=new La({encoding:r}),s=!1;for await(let a of Dr(e)){if(i.write(a),!s&&i.result.dbfHeader){s=!0;let u=i.result.tableBuilder.firstBatch();u&&(yield u)}let l=i.result.tableBuilder.flushBatch();l&&(yield l)}i.end();let o=i.result.tableBuilder.finishBatch();o&&(yield o)}function Qf(e,t,r,i){for(;;)try{switch(e){case Zt.ERROR:case Zt.END:return e;case Zt.START:let s=r.getDataView(Zf);if(!s)return e;t.dbfHeader=Ib(s),t.progress={bytesUsed:0,rowsTotal:t.dbfHeader.nRecords,rows:0},e=Zt.FIELD_DESCRIPTORS;break;case Zt.FIELD_DESCRIPTORS:let n=r.getDataView(t.dbfHeader.headerLength-Zf);if(!n)return e;t.dbfFields=Sb(n,i);let o={fields:t.dbfFields.map(c=>Eb(c)),metadata:{}};t.tableBuilder=new Sn(o),e=Zt.FIELD_PROPERTIES,r.skip(1);break;case Zt.FIELD_PROPERTIES:let{recordLength:a=0,nRecords:h=0}=t?.dbfHeader||{},l=0;for(;l<h;){l++;let c=r.getDataView(a-1);if(!c)return e;r.skip(1);let u=Bb(c,t.dbfFields,i);t.tableBuilder.addObjectRow(u)}e=Zt.END;break;default:return e=Zt.ERROR,t.error=`illegal parser state ${e}`,e}}catch(s){return e=Zt.ERROR,t.error=`DBF parsing failed: ${s.message}`,e}}function Ib(e){return{year:e.getUint8(1)+1900,month:e.getUint8(2),day:e.getUint8(3),nRecords:e.getUint32(4,ol),headerLength:e.getUint16(8,ol),recordLength:e.getUint16(10,ol),languageDriver:e.getUint8(29)}}function Sb(e,t){let r=(e.byteLength-1)/32,i=[],s=0;for(let n=0;n<r;n++){let o=t.decode(new Uint8Array(e.buffer,e.byteOffset+s,11)).replace(/\u0000/g,"");i.push({name:o,dataType:String.fromCharCode(e.getUint8(s+11)),fieldLength:e.getUint8(s+16),decimal:e.getUint8(s+17)}),s+=32}return i}function Bb(e,t,r){let i={},s=0;for(let n of t){let o=r.decode(new Uint8Array(e.buffer,e.byteOffset+s,n.fieldLength));i[n.name]=Ab(o,n.dataType),s+=n.fieldLength}return i}function Ab(e,t){switch(t){case"B":return Fa(e);case"C":return Ob(e);case"F":return Fa(e);case"N":return Fa(e);case"O":return Fa(e);case"D":return Db(e);case"L":return Tb(e);default:throw new Error("Unsupported data type")}}function Db(e){return Date.UTC(e.slice(0,4),parseInt(e.slice(4,6),10)-1,e.slice(6,8))}function Tb(e){return/^[nf]$/i.test(e)?!1:/^[yt]$/i.test(e)?!0:null}function Fa(e){let t=parseFloat(e);return isNaN(t)?null:t}function Ob(e){return e.trim()||null}function Eb({name:e,dataType:t,fieldLength:r,decimal:i}){switch(t){case"B":return{name:e,type:"float64",nullable:!0,metadata:{}};case"C":return{name:e,type:"utf8",nullable:!0,metadata:{}};case"F":return{name:e,type:"float64",nullable:!0,metadata:{}};case"N":return{name:e,type:"float64",nullable:!0,metadata:{}};case"O":return{name:e,type:"float64",nullable:!0,metadata:{}};case"D":return{name:e,type:"timestamp-millisecond",nullable:!0,metadata:{}};case"L":return{name:e,type:"bool",nullable:!0,metadata:{}};default:throw new Error("Unsupported data type")}}var ed={name:"DBF",id:"dbf",module:"shapefile",category:"table",extensions:["dbf"],mimeTypes:["application/x-dbf"]};var Nb="4.4.0-alpha.13",hl={...ed,dataType:null,batchType:null,version:Nb,worker:!0,options:{dbf:{encoding:"latin1"}}},rd={...hl,parse:async(e,t)=>al(e,t),parseSync:al,parseInBatches(e,t){return td(e,t)}};var Ra=class{offset;arrayBuffer;constructor(t){this.offset=0,this.arrayBuffer=t}hasAvailableBytes(t){return this.arrayBuffer.byteLength-this.offset>=t}getDataView(t){if(t&&!this.hasAvailableBytes(t))throw new Error("binary data exhausted");let r=t?new DataView(this.arrayBuffer,this.offset,t):new DataView(this.arrayBuffer,this.offset);return this.offset+=t,r}skip(t){this.offset+=t}rewind(t){this.offset-=t}};return ud(Cn);})();
|
|
19
|
+
northing meters`+e;var p=u/2,f=0,m=0,g,v,I,k,$;return p>0&&(g=1e5/Math.pow(10,p),v=e.substring(n,n+p),f=parseFloat(v)*g,I=e.substring(n+p),m=parseFloat(I)*g),k=f+c,$=m+l,{easting:k,northing:$,zoneLetter:a,zoneNumber:o,accuracy:g}}function d0(e,t){for(var r=Af.charCodeAt(t-1),i=1e5,s=!1;r!==e.charCodeAt(0);){if(r++,r===_e&&r++,r===ze&&r++,r>Rn){if(s)throw"Bad character: "+e;r=Fs,s=!0}i+=1e5}return i}function p0(e,t){if(e>"V")throw"MGRSPoint given invalid Northing "+e;for(var r=Bf.charCodeAt(t-1),i=0,s=!1;r!==e.charCodeAt(0);){if(r++,r===_e&&r++,r===ze&&r++,r>Fn){if(s)throw"Bad character: "+e;r=Fs,s=!0}i+=1e5}return i}function m0(e){var t;switch(e){case"C":t=11e5;break;case"D":t=2e6;break;case"E":t=28e5;break;case"F":t=37e5;break;case"G":t=46e5;break;case"H":t=55e5;break;case"J":t=64e5;break;case"K":t=73e5;break;case"L":t=82e5;break;case"M":t=91e5;break;case"N":t=0;break;case"P":t=8e5;break;case"Q":t=17e5;break;case"R":t=26e5;break;case"S":t=35e5;break;case"T":t=44e5;break;case"U":t=53e5;break;case"V":t=62e5;break;case"W":t=7e6;break;case"X":t=79e5;break;default:t=-1}if(t>=0)return t;throw"Invalid zone letter: "+e}function Rs(e,t,r){if(!(this instanceof Rs))return new Rs(e,t,r);if(Array.isArray(e))this.x=e[0],this.y=e[1],this.z=e[2]||0;else if(typeof e=="object")this.x=e.x,this.y=e.y,this.z=e.z||0;else if(typeof e=="string"&&typeof t>"u"){var i=e.split(",");this.x=parseFloat(i[0],10),this.y=parseFloat(i[1],10),this.z=parseFloat(i[2],10)||0}else this.x=e,this.y=t,this.z=r||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Rs.fromMGRS=function(e){return new Rs(mc(e))};Rs.prototype.toMGRS=function(e){return pc([this.x,this.y],e)};var Nf=Rs;var y0=1,g0=.25,Of=.046875,Lf=.01953125,Ff=.01068115234375,_0=.75,b0=.46875,v0=.013020833333333334,w0=.007120768229166667,M0=.3645833333333333,x0=.005696614583333333,I0=.3076171875;function Na(e){var t=[];t[0]=y0-e*(g0+e*(Of+e*(Lf+e*Ff))),t[1]=e*(_0-e*(Of+e*(Lf+e*Ff)));var r=e*e;return t[2]=r*(b0-e*(v0+e*w0)),r*=e,t[3]=r*(M0-e*x0),t[4]=r*e*I0,t}function zi(e,t,r,i){return r*=t,t*=t,i[0]*e-r*(i[1]+t*(i[2]+t*(i[3]+t*i[4])))}var S0=20;function Oa(e,t,r){for(var i=1/(1-t),s=e,n=S0;n;--n){var o=Math.sin(s),a=1-t*o*o;if(a=(zi(s,o,Math.cos(s),r)-e)*(a*Math.sqrt(a))*i,s-=a,Math.abs(a)<_)return s}return s}function A0(){this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.es&&(this.en=Na(this.es),this.ml0=zi(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function B0(e){var t=e.x,r=e.y,i=b(t-this.long0),s,n,o,a=Math.sin(r),h=Math.cos(r);if(this.es){var l=h*i,u=Math.pow(l,2),p=this.ep2*Math.pow(h,2),f=Math.pow(p,2),m=Math.abs(h)>_?Math.tan(r):0,g=Math.pow(m,2),v=Math.pow(g,2);s=1-this.es*Math.pow(a,2),l=l/Math.sqrt(s);var I=zi(r,a,h,this.en);n=this.a*(this.k0*l*(1+u/6*(1-g+p+u/20*(5-18*g+v+14*p-58*g*p+u/42*(61+179*v-v*g-479*g)))))+this.x0,o=this.a*(this.k0*(I-this.ml0+a*i*l/2*(1+u/12*(5-g+9*p+4*f+u/30*(61+v-58*g+270*p-330*g*p+u/56*(1385+543*v-v*g-3111*g))))))+this.y0}else{var c=h*Math.sin(i);if(Math.abs(Math.abs(c)-1)<_)return 93;if(n=.5*this.a*this.k0*Math.log((1+c)/(1-c))+this.x0,o=h*Math.cos(i)/Math.sqrt(1-Math.pow(c,2)),c=Math.abs(o),c>=1){if(c-1>_)return 93;o=0}else o=Math.acos(o);r<0&&(o=-o),o=this.a*this.k0*(o-this.lat0)+this.y0}return e.x=n,e.y=o,e}function T0(e){var t,r,i,s,n=(e.x-this.x0)*(1/this.a),o=(e.y-this.y0)*(1/this.a);if(this.es)if(t=this.ml0+o/this.k0,r=Oa(t,this.es,this.en),Math.abs(r)<y){var u=Math.sin(r),p=Math.cos(r),f=Math.abs(p)>_?Math.tan(r):0,m=this.ep2*Math.pow(p,2),g=Math.pow(m,2),v=Math.pow(f,2),I=Math.pow(v,2);t=1-this.es*Math.pow(u,2);var k=n*Math.sqrt(t)/this.k0,$=Math.pow(k,2);t=t*f,i=r-t*$/(1-this.es)*.5*(1-$/12*(5+3*v-9*m*v+m-4*g-$/30*(61+90*v-252*m*v+45*I+46*m-$/56*(1385+3633*v+4095*I+1574*I*v)))),s=b(this.long0+k*(1-$/6*(1+2*v+m-$/20*(5+28*v+24*I+8*m*v+6*m-$/42*(61+662*v+1320*I+720*I*v))))/p)}else i=y*Tr(o),s=0;else{var a=Math.exp(n/this.k0),h=.5*(a-1/a),c=this.lat0+o/this.k0,l=Math.cos(c);t=Math.sqrt((1-Math.pow(l,2))/(1+Math.pow(h,2))),i=Math.asin(t),o<0&&(i=-i),h===0&&l===0?s=0:s=b(Math.atan2(h,l)+this.long0)}return e.x=s,e.y=i,e}var D0=["Transverse_Mercator","Transverse Mercator","tmerc"],Rf={init:A0,forward:B0,inverse:T0,names:D0};function La(e){var t=Math.exp(e);return t=(t-1/t)/2,t}function Cn(e,t){e=Math.abs(e),t=Math.abs(t);var r=Math.max(e,t),i=Math.min(e,t)/(r||1);return r*Math.sqrt(1+Math.pow(i,2))}function Cf(e){var t=1+e,r=t-1;return r===0?e:e*Math.log(t)/r}function Uf(e){var t=Math.abs(e);return t=Cf(t*(1+t/(Cn(1,t)+1))),e<0?-t:t}function Fa(e,t){for(var r=2*Math.cos(2*t),i=e.length-1,s=e[i],n=0,o;--i>=0;)o=-n+r*s+e[i],n=s,s=o;return t+o*Math.sin(2*t)}function Pf(e,t){for(var r=2*Math.cos(t),i=e.length-1,s=e[i],n=0,o;--i>=0;)o=-n+r*s+e[i],n=s,s=o;return Math.sin(t)*o}function kf(e){var t=Math.exp(e);return t=(t+1/t)/2,t}function gc(e,t,r){for(var i=Math.sin(t),s=Math.cos(t),n=La(r),o=kf(r),a=2*s*o,h=-2*i*n,c=e.length-1,l=e[c],u=0,p=0,f=0,m,g;--c>=0;)m=p,g=u,p=l,u=f,l=-m+a*p-h*u+e[c],f=-g+h*p+a*u;return a=i*o,h=s*n,[a*l-h*f,a*f+h*l]}function E0(){if(this.es===void 0||this.es<=0)throw new Error("incorrect elliptical usage");this.x0=this.x0!==void 0?this.x0:0,this.y0=this.y0!==void 0?this.y0:0,this.long0=this.long0!==void 0?this.long0:0,this.lat0=this.lat0!==void 0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var e=this.es/(1+Math.sqrt(1-this.es)),t=e/(2-e),r=t;this.cgb[0]=t*(2+t*(-2/3+t*(-2+t*(116/45+t*(26/45+t*(-2854/675)))))),this.cbg[0]=t*(-2+t*(2/3+t*(4/3+t*(-82/45+t*(32/45+t*(4642/4725)))))),r=r*t,this.cgb[1]=r*(7/3+t*(-8/5+t*(-227/45+t*(2704/315+t*(2323/945))))),this.cbg[1]=r*(5/3+t*(-16/15+t*(-13/9+t*(904/315+t*(-1522/945))))),r=r*t,this.cgb[2]=r*(56/15+t*(-136/35+t*(-1262/105+t*(73814/2835)))),this.cbg[2]=r*(-26/15+t*(34/21+t*(8/5+t*(-12686/2835)))),r=r*t,this.cgb[3]=r*(4279/630+t*(-332/35+t*(-399572/14175))),this.cbg[3]=r*(1237/630+t*(-12/5+t*(-24832/14175))),r=r*t,this.cgb[4]=r*(4174/315+t*(-144838/6237)),this.cbg[4]=r*(-734/315+t*(109598/31185)),r=r*t,this.cgb[5]=r*(601676/22275),this.cbg[5]=r*(444337/155925),r=Math.pow(t,2),this.Qn=this.k0/(1+t)*(1+r*(1/4+r*(1/64+r/256))),this.utg[0]=t*(-.5+t*(2/3+t*(-37/96+t*(1/360+t*(81/512+t*(-96199/604800)))))),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+t*(7891/37800)))))),this.utg[1]=r*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+t*(1118711/3870720))))),this.gtu[1]=r*(13/48+t*(-3/5+t*(557/1440+t*(281/630+t*(-1983433/1935360))))),r=r*t,this.utg[2]=r*(-17/480+t*(37/840+t*(209/4480+t*(-5569/90720)))),this.gtu[2]=r*(61/240+t*(-103/140+t*(15061/26880+t*(167603/181440)))),r=r*t,this.utg[3]=r*(-4397/161280+t*(11/504+t*(830251/7257600))),this.gtu[3]=r*(49561/161280+t*(-179/168+t*(6601661/7257600))),r=r*t,this.utg[4]=r*(-4583/161280+t*(108847/3991680)),this.gtu[4]=r*(34729/80640+t*(-3418889/1995840)),r=r*t,this.utg[5]=r*(-20648693/638668800),this.gtu[5]=r*(212378941/319334400);var i=Fa(this.cbg,this.lat0);this.Zb=-this.Qn*(i+Pf(this.gtu,2*i))}function N0(e){var t=b(e.x-this.long0),r=e.y;r=Fa(this.cbg,r);var i=Math.sin(r),s=Math.cos(r),n=Math.sin(t),o=Math.cos(t);r=Math.atan2(i,o*s),t=Math.atan2(n*s,Cn(i,s*o)),t=Uf(Math.tan(t));var a=gc(this.gtu,2*r,2*t);r=r+a[0],t=t+a[1];var h,c;return Math.abs(t)<=2.623395162778?(h=this.a*(this.Qn*t)+this.x0,c=this.a*(this.Qn*r+this.Zb)+this.y0):(h=1/0,c=1/0),e.x=h,e.y=c,e}function O0(e){var t=(e.x-this.x0)*(1/this.a),r=(e.y-this.y0)*(1/this.a);r=(r-this.Zb)/this.Qn,t=t/this.Qn;var i,s;if(Math.abs(t)<=2.623395162778){var n=gc(this.utg,2*r,2*t);r=r+n[0],t=t+n[1],t=Math.atan(La(t));var o=Math.sin(r),a=Math.cos(r),h=Math.sin(t),c=Math.cos(t);r=Math.atan2(o*c,Cn(h,c*a)),t=Math.atan2(h,c*a),i=b(t+this.long0),s=Fa(this.cgb,r)}else i=1/0,s=1/0;return e.x=i,e.y=s,e}var L0=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc"],Cs={init:E0,forward:N0,inverse:O0,names:L0};function Vf(e,t){if(e===void 0){if(e=Math.floor((b(t)+Math.PI)*30/Math.PI)+1,e<0)return 0;if(e>60)return 60}return e}var F0="etmerc";function R0(){var e=Vf(this.zone,this.long0);if(e===void 0)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(e)-183)*Dt,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Cs.init.apply(this),this.forward=Cs.forward,this.inverse=Cs.inverse}var C0=["Universal Transverse Mercator System","utm"],zf={init:R0,names:C0,dependsOn:F0};function Ra(e,t){return Math.pow((1-e)/(1+e),t)}var U0=20;function P0(){var e=Math.sin(this.lat0),t=Math.cos(this.lat0);t*=t,this.rc=Math.sqrt(1-this.es)/(1-this.es*e*e),this.C=Math.sqrt(1+this.es*t*t/(1-this.es)),this.phic0=Math.asin(e/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+Y)/(Math.pow(Math.tan(.5*this.lat0+Y),this.C)*Ra(this.e*e,this.ratexp))}function k0(e){var t=e.x,r=e.y;return e.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*r+Y),this.C)*Ra(this.e*Math.sin(r),this.ratexp))-y,e.x=this.C*t,e}function V0(e){for(var t=1e-14,r=e.x/this.C,i=e.y,s=Math.pow(Math.tan(.5*i+Y)/this.K,1/this.C),n=U0;n>0&&(i=2*Math.atan(s*Ra(this.e*Math.sin(e.y),-.5*this.e))-y,!(Math.abs(i-e.y)<t));--n)e.y=i;return n?(e.x=r,e.y=i,e):null}var z0=["gauss"],Ca={init:P0,forward:k0,inverse:V0,names:z0};function j0(){Ca.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function G0(e){var t,r,i,s;return e.x=b(e.x-this.long0),Ca.forward.apply(this,[e]),t=Math.sin(e.y),r=Math.cos(e.y),i=Math.cos(e.x),s=this.k0*this.R2/(1+this.sinc0*t+this.cosc0*r*i),e.x=s*r*Math.sin(e.x),e.y=s*(this.cosc0*t-this.sinc0*r*i),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e}function H0(e){var t,r,i,s,n;if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,n=Math.sqrt(e.x*e.x+e.y*e.y)){var o=2*Math.atan2(n,this.R2);t=Math.sin(o),r=Math.cos(o),s=Math.asin(r*this.sinc0+e.y*t*this.cosc0/n),i=Math.atan2(e.x*t,n*this.cosc0*r-e.y*this.sinc0*t)}else s=this.phic0,i=0;return e.x=i,e.y=s,Ca.inverse.apply(this,[e]),e.x=b(e.x+this.long0),e}var W0=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],jf={init:j0,forward:G0,inverse:H0,names:W0};function q0(e,t,r){return t*=r,Math.tan(.5*(y+e))*Math.pow((1-t)/(1+t),.5*r)}function $0(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=_&&(this.k0=.5*(1+Tr(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=_&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),this.k0===1&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=_&&(this.k0=.5*this.cons*qt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/te(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=qt(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-y,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function J0(e){var t=e.x,r=e.y,i=Math.sin(r),s=Math.cos(r),n,o,a,h,c,l,u=b(t-this.long0);return Math.abs(Math.abs(t-this.long0)-Math.PI)<=_&&Math.abs(r+this.lat0)<=_?(e.x=NaN,e.y=NaN,e):this.sphere?(n=2*this.k0/(1+this.sinlat0*i+this.coslat0*s*Math.cos(u)),e.x=this.a*n*s*Math.sin(u)+this.x0,e.y=this.a*n*(this.coslat0*i-this.sinlat0*s*Math.cos(u))+this.y0,e):(o=2*Math.atan(this.ssfn_(r,i,this.e))-y,h=Math.cos(o),a=Math.sin(o),Math.abs(this.coslat0)<=_?(c=te(this.e,r*this.con,this.con*i),l=2*this.a*this.k0*c/this.cons,e.x=this.x0+l*Math.sin(t-this.long0),e.y=this.y0-this.con*l*Math.cos(t-this.long0),e):(Math.abs(this.sinlat0)<_?(n=2*this.a*this.k0/(1+h*Math.cos(u)),e.y=n*a):(n=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*a+this.cosX0*h*Math.cos(u))),e.y=n*(this.cosX0*a-this.sinX0*h*Math.cos(u))+this.y0),e.x=n*h*Math.sin(u)+this.x0,e))}function Y0(e){e.x-=this.x0,e.y-=this.y0;var t,r,i,s,n,o=Math.sqrt(e.x*e.x+e.y*e.y);if(this.sphere){var a=2*Math.atan(o/(2*this.a*this.k0));return t=this.long0,r=this.lat0,o<=_?(e.x=t,e.y=r,e):(r=Math.asin(Math.cos(a)*this.sinlat0+e.y*Math.sin(a)*this.coslat0/o),Math.abs(this.coslat0)<_?this.lat0>0?t=b(this.long0+Math.atan2(e.x,-1*e.y)):t=b(this.long0+Math.atan2(e.x,e.y)):t=b(this.long0+Math.atan2(e.x*Math.sin(a),o*this.coslat0*Math.cos(a)-e.y*this.sinlat0*Math.sin(a))),e.x=t,e.y=r,e)}else if(Math.abs(this.coslat0)<=_){if(o<=_)return r=this.lat0,t=this.long0,e.x=t,e.y=r,e;e.x*=this.con,e.y*=this.con,i=o*this.cons/(2*this.a*this.k0),r=this.con*Gr(this.e,i),t=this.con*b(this.con*this.long0+Math.atan2(e.x,-1*e.y))}else s=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,o<=_?n=this.X0:(n=Math.asin(Math.cos(s)*this.sinX0+e.y*Math.sin(s)*this.cosX0/o),t=b(this.long0+Math.atan2(e.x*Math.sin(s),o*this.cosX0*Math.cos(s)-e.y*this.sinX0*Math.sin(s)))),r=-1*Gr(this.e,Math.tan(.5*(y+n)));return e.x=t,e.y=r,e}var K0=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"],Gf={init:$0,forward:J0,inverse:Y0,names:K0,ssfn_:q0};function X0(){var e=this.lat0;this.lambda0=this.long0;var t=Math.sin(e),r=this.a,i=this.rf,s=1/i,n=2*s-Math.pow(s,2),o=this.e=Math.sqrt(n);this.R=this.k0*r*Math.sqrt(1-n)/(1-n*Math.pow(t,2)),this.alpha=Math.sqrt(1+n/(1-n)*Math.pow(Math.cos(e),4)),this.b0=Math.asin(t/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),h=Math.log(Math.tan(Math.PI/4+e/2)),c=Math.log((1+o*t)/(1-o*t));this.K=a-this.alpha*h+this.alpha*o/2*c}function Z0(e){var t=Math.log(Math.tan(Math.PI/4-e.y/2)),r=this.e/2*Math.log((1+this.e*Math.sin(e.y))/(1-this.e*Math.sin(e.y))),i=-this.alpha*(t+r)+this.K,s=2*(Math.atan(Math.exp(i))-Math.PI/4),n=this.alpha*(e.x-this.lambda0),o=Math.atan(Math.sin(n)/(Math.sin(this.b0)*Math.tan(s)+Math.cos(this.b0)*Math.cos(n))),a=Math.asin(Math.cos(this.b0)*Math.sin(s)-Math.sin(this.b0)*Math.cos(s)*Math.cos(n));return e.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,e.x=this.R*o+this.x0,e}function Q0(e){for(var t=e.x-this.x0,r=e.y-this.y0,i=t/this.R,s=2*(Math.atan(Math.exp(r/this.R))-Math.PI/4),n=Math.asin(Math.cos(this.b0)*Math.sin(s)+Math.sin(this.b0)*Math.cos(s)*Math.cos(i)),o=Math.atan(Math.sin(i)/(Math.cos(this.b0)*Math.cos(i)-Math.sin(this.b0)*Math.tan(s))),a=this.lambda0+o/this.alpha,h=0,c=n,l=-1e3,u=0;Math.abs(c-l)>1e-7;){if(++u>20)return;h=1/this.alpha*(Math.log(Math.tan(Math.PI/4+n/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(c))/2)),l=c,c=2*Math.atan(Math.exp(h))-Math.PI/2}return e.x=a,e.y=c,e}var tg=["somerc"],Hf={init:X0,forward:Z0,inverse:Q0,names:tg};function eg(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var e=Math.sin(this.lat0),t=Math.cos(this.lat0),r=this.e*e;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(t,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-r*r);var i=te(this.e,this.lat0,e),s=this.bl/t*Math.sqrt((1-this.es)/(1-r*r));s*s<1&&(s=1);var n,o;if(!isNaN(this.longc))this.lat0>=0?n=s+Math.sqrt(s*s-1):n=s-Math.sqrt(s*s-1),this.el=n*Math.pow(i,this.bl),o=.5*(n-1/n),this.gamma0=Math.asin(Math.sin(this.alpha)/s),this.long0=this.longc-Math.asin(o*Math.tan(this.gamma0))/this.bl;else{var a=te(this.e,this.lat1,Math.sin(this.lat1)),h=te(this.e,this.lat2,Math.sin(this.lat2));this.lat0>=0?this.el=(s+Math.sqrt(s*s-1))*Math.pow(i,this.bl):this.el=(s-Math.sqrt(s*s-1))*Math.pow(i,this.bl);var c=Math.pow(a,this.bl),l=Math.pow(h,this.bl);n=this.el/c,o=.5*(n-1/n);var u=(this.el*this.el-l*c)/(this.el*this.el+l*c),p=(l-c)/(l+c),f=b(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(u*Math.tan(.5*this.bl*f)/p)/this.bl,this.long0=b(this.long0);var m=b(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*m)/o),this.alpha=Math.asin(s*Math.sin(this.gamma0))}this.no_off?this.uc=0:this.lat0>=0?this.uc=this.al/this.bl*Math.atan2(Math.sqrt(s*s-1),Math.cos(this.alpha)):this.uc=-1*this.al/this.bl*Math.atan2(Math.sqrt(s*s-1),Math.cos(this.alpha))}function rg(e){var t=e.x,r=e.y,i=b(t-this.long0),s,n,o;if(Math.abs(Math.abs(r)-y)<=_)r>0?o=-1:o=1,n=this.al/this.bl*Math.log(Math.tan(Y+o*this.gamma0*.5)),s=-1*o*y*this.al/this.bl;else{var a=te(this.e,r,Math.sin(r)),h=this.el/Math.pow(a,this.bl),c=.5*(h-1/h),l=.5*(h+1/h),u=Math.sin(this.bl*i),p=(c*Math.sin(this.gamma0)-u*Math.cos(this.gamma0))/l;Math.abs(Math.abs(p)-1)<=_?n=Number.POSITIVE_INFINITY:n=.5*this.al*Math.log((1-p)/(1+p))/this.bl,Math.abs(Math.cos(this.bl*i))<=_?s=this.al*this.bl*i:s=this.al*Math.atan2(c*Math.cos(this.gamma0)+u*Math.sin(this.gamma0),Math.cos(this.bl*i))/this.bl}return this.no_rot?(e.x=this.x0+s,e.y=this.y0+n):(s-=this.uc,e.x=this.x0+n*Math.cos(this.alpha)+s*Math.sin(this.alpha),e.y=this.y0+s*Math.cos(this.alpha)-n*Math.sin(this.alpha)),e}function ig(e){var t,r;this.no_rot?(r=e.y-this.y0,t=e.x-this.x0):(r=(e.x-this.x0)*Math.cos(this.alpha)-(e.y-this.y0)*Math.sin(this.alpha),t=(e.y-this.y0)*Math.cos(this.alpha)+(e.x-this.x0)*Math.sin(this.alpha),t+=this.uc);var i=Math.exp(-1*this.bl*r/this.al),s=.5*(i-1/i),n=.5*(i+1/i),o=Math.sin(this.bl*t/this.al),a=(o*Math.cos(this.gamma0)+s*Math.sin(this.gamma0))/n,h=Math.pow(this.el/Math.sqrt((1+a)/(1-a)),1/this.bl);return Math.abs(a-1)<_?(e.x=this.long0,e.y=y):Math.abs(a+1)<_?(e.x=this.long0,e.y=-1*y):(e.y=Gr(this.e,h),e.x=b(this.long0-Math.atan2(s*Math.cos(this.gamma0)-o*Math.sin(this.gamma0),Math.cos(this.bl*t/this.al))/this.bl)),e}var sg=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"],Wf={init:eg,forward:rg,inverse:ig,names:sg};function ng(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<_)){var e=this.b/this.a;this.e=Math.sqrt(1-e*e);var t=Math.sin(this.lat1),r=Math.cos(this.lat1),i=qt(this.e,t,r),s=te(this.e,this.lat1,t),n=Math.sin(this.lat2),o=Math.cos(this.lat2),a=qt(this.e,n,o),h=te(this.e,this.lat2,n),c=te(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>_?this.ns=Math.log(i/a)/Math.log(s/h):this.ns=t,isNaN(this.ns)&&(this.ns=t),this.f0=i/(this.ns*Math.pow(s,this.ns)),this.rh=this.a*this.f0*Math.pow(c,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function og(e){var t=e.x,r=e.y;Math.abs(2*Math.abs(r)-Math.PI)<=_&&(r=Tr(r)*(y-2*_));var i=Math.abs(Math.abs(r)-y),s,n;if(i>_)s=te(this.e,r,Math.sin(r)),n=this.a*this.f0*Math.pow(s,this.ns);else{if(i=r*this.ns,i<=0)return null;n=0}var o=this.ns*b(t-this.long0);return e.x=this.k0*(n*Math.sin(o))+this.x0,e.y=this.k0*(this.rh-n*Math.cos(o))+this.y0,e}function ag(e){var t,r,i,s,n,o=(e.x-this.x0)/this.k0,a=this.rh-(e.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(o*o+a*a),r=1):(t=-Math.sqrt(o*o+a*a),r=-1);var h=0;if(t!==0&&(h=Math.atan2(r*o,r*a)),t!==0||this.ns>0){if(r=1/this.ns,i=Math.pow(t/(this.a*this.f0),r),s=Gr(this.e,i),s===-9999)return null}else s=-y;return n=b(h/this.ns+this.long0),e.x=n,e.y=s,e}var hg=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"],qf={init:ng,forward:og,inverse:ag,names:hg};function cg(){this.a=6377397155e-3,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.7417649320975901-.308341501185665),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function lg(e){var t,r,i,s,n,o,a,h=e.x,c=e.y,l=b(h-this.long0);return t=Math.pow((1+this.e*Math.sin(c))/(1-this.e*Math.sin(c)),this.alfa*this.e/2),r=2*(Math.atan(this.k*Math.pow(Math.tan(c/2+this.s45),this.alfa)/t)-this.s45),i=-l*this.alfa,s=Math.asin(Math.cos(this.ad)*Math.sin(r)+Math.sin(this.ad)*Math.cos(r)*Math.cos(i)),n=Math.asin(Math.cos(r)*Math.sin(i)/Math.cos(s)),o=this.n*n,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(s/2+this.s45),this.n),e.y=a*Math.cos(o)/1,e.x=a*Math.sin(o)/1,this.czech||(e.y*=-1,e.x*=-1),e}function ug(e){var t,r,i,s,n,o,a,h,c=e.x;e.x=e.y,e.y=c,this.czech||(e.y*=-1,e.x*=-1),o=Math.sqrt(e.x*e.x+e.y*e.y),n=Math.atan2(e.y,e.x),s=n/Math.sin(this.s0),i=2*(Math.atan(Math.pow(this.ro0/o,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),t=Math.asin(Math.cos(this.ad)*Math.sin(i)-Math.sin(this.ad)*Math.cos(i)*Math.cos(s)),r=Math.asin(Math.cos(i)*Math.sin(s)/Math.cos(t)),e.x=this.long0-r/this.alfa,a=t,h=0;var l=0;do e.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(t/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),Math.abs(a-e.y)<1e-10&&(h=1),a=e.y,l+=1;while(h===0&&l<15);return l>=15?null:e}var fg=["Krovak","krovak"],$f={init:cg,forward:lg,inverse:ug,names:fg};function Nt(e,t,r,i,s){return e*s-t*Math.sin(2*s)+r*Math.sin(4*s)-i*Math.sin(6*s)}function Hr(e){return 1-.25*e*(1+e/16*(3+1.25*e))}function Wr(e){return .375*e*(1+.25*e*(1+.46875*e))}function qr(e){return .05859375*e*e*(1+.75*e)}function $r(e){return e*e*e*(35/3072)}function Jr(e,t,r){var i=t*r;return e/Math.sqrt(1-i*i)}function sr(e){return Math.abs(e)<y?e:e-Tr(e)*Math.PI}function ji(e,t,r,i,s){var n,o;n=e/t;for(var a=0;a<15;a++)if(o=(e-(t*n-r*Math.sin(2*n)+i*Math.sin(4*n)-s*Math.sin(6*n)))/(t-2*r*Math.cos(2*n)+4*i*Math.cos(4*n)-6*s*Math.cos(6*n)),n+=o,Math.abs(o)<=1e-10)return n;return NaN}function dg(){this.sphere||(this.e0=Hr(this.es),this.e1=Wr(this.es),this.e2=qr(this.es),this.e3=$r(this.es),this.ml0=this.a*Nt(this.e0,this.e1,this.e2,this.e3,this.lat0))}function pg(e){var t,r,i=e.x,s=e.y;if(i=b(i-this.long0),this.sphere)t=this.a*Math.asin(Math.cos(s)*Math.sin(i)),r=this.a*(Math.atan2(Math.tan(s),Math.cos(i))-this.lat0);else{var n=Math.sin(s),o=Math.cos(s),a=Jr(this.a,this.e,n),h=Math.tan(s)*Math.tan(s),c=i*Math.cos(s),l=c*c,u=this.es*o*o/(1-this.es),p=this.a*Nt(this.e0,this.e1,this.e2,this.e3,s);t=a*c*(1-l*h*(1/6-(8-h+8*u)*l/120)),r=p-this.ml0+a*n/o*l*(.5+(5-h+6*u)*l/24)}return e.x=t+this.x0,e.y=r+this.y0,e}function mg(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,r=e.y/this.a,i,s;if(this.sphere){var n=r+this.lat0;i=Math.asin(Math.sin(n)*Math.cos(t)),s=Math.atan2(Math.tan(t),Math.cos(n))}else{var o=this.ml0/this.a+r,a=ji(o,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(a)-y)<=_)return e.x=this.long0,e.y=y,r<0&&(e.y*=-1),e;var h=Jr(this.a,this.e,Math.sin(a)),c=h*h*h/this.a/this.a*(1-this.es),l=Math.pow(Math.tan(a),2),u=t*this.a/h,p=u*u;i=a-h*Math.tan(a)/c*u*u*(.5-(1+3*l)*u*u/24),s=u*(1-p*(l/3+(1+3*l)*l*p/15))/Math.cos(a)}return e.x=b(s+this.long0),e.y=sr(i),e}var yg=["Cassini","Cassini_Soldner","cass"],Jf={init:dg,forward:pg,inverse:mg,names:yg};function nr(e,t){var r;return e>1e-7?(r=e*t,(1-e*e)*(t/(1-r*r)-.5/e*Math.log((1-r)/(1+r)))):2*t}var gg=1,_g=2,bg=3,vg=4;function wg(){var e=Math.abs(this.lat0);if(Math.abs(e-y)<_?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(e)<_?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var t;switch(this.qp=nr(this.e,1),this.mmf=.5/(1-this.es),this.apa=Eg(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=nr(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function Mg(e){var t,r,i,s,n,o,a,h,c,l,u=e.x,p=e.y;if(u=b(u-this.long0),this.sphere){if(n=Math.sin(p),l=Math.cos(p),i=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(r=this.mode===this.EQUIT?1+l*i:1+this.sinph0*n+this.cosph0*l*i,r<=_)return null;r=Math.sqrt(2/r),t=r*l*Math.sin(u),r*=this.mode===this.EQUIT?n:this.cosph0*n-this.sinph0*l*i}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(i=-i),Math.abs(p+this.lat0)<_)return null;r=Y-p*.5,r=2*(this.mode===this.S_POLE?Math.cos(r):Math.sin(r)),t=r*Math.sin(u),r*=i}}else{switch(a=0,h=0,c=0,i=Math.cos(u),s=Math.sin(u),n=Math.sin(p),o=nr(this.e,n),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(a=o/this.qp,h=Math.sqrt(1-a*a)),this.mode){case this.OBLIQ:c=1+this.sinb1*a+this.cosb1*h*i;break;case this.EQUIT:c=1+h*i;break;case this.N_POLE:c=y+p,o=this.qp-o;break;case this.S_POLE:c=p-y,o=this.qp+o;break}if(Math.abs(c)<_)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:c=Math.sqrt(2/c),this.mode===this.OBLIQ?r=this.ymf*c*(this.cosb1*a-this.sinb1*h*i):r=(c=Math.sqrt(2/(1+h*i)))*a*this.ymf,t=this.xmf*c*h*s;break;case this.N_POLE:case this.S_POLE:o>=0?(t=(c=Math.sqrt(o))*s,r=i*(this.mode===this.S_POLE?c:-c)):t=r=0;break}}return e.x=this.a*t+this.x0,e.y=this.a*r+this.y0,e}function xg(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,r=e.y/this.a,i,s,n,o,a,h,c;if(this.sphere){var l=0,u,p=0;if(u=Math.sqrt(t*t+r*r),s=u*.5,s>1)return null;switch(s=2*Math.asin(s),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(p=Math.sin(s),l=Math.cos(s)),this.mode){case this.EQUIT:s=Math.abs(u)<=_?0:Math.asin(r*p/u),t*=p,r=l*u;break;case this.OBLIQ:s=Math.abs(u)<=_?this.lat0:Math.asin(l*this.sinph0+r*p*this.cosph0/u),t*=p*this.cosph0,r=(l-Math.sin(s)*this.sinph0)*u;break;case this.N_POLE:r=-r,s=y-s;break;case this.S_POLE:s-=y;break}i=r===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(t,r)}else{if(c=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t/=this.dd,r*=this.dd,h=Math.sqrt(t*t+r*r),h<_)return e.x=this.long0,e.y=this.lat0,e;o=2*Math.asin(.5*h/this.rq),n=Math.cos(o),t*=o=Math.sin(o),this.mode===this.OBLIQ?(c=n*this.sinb1+r*o*this.cosb1/h,a=this.qp*c,r=h*this.cosb1*n-r*this.sinb1*o):(c=r*o/h,a=this.qp*c,r=h*n)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(r=-r),a=t*t+r*r,!a)return e.x=this.long0,e.y=this.lat0,e;c=1-a/this.qp,this.mode===this.S_POLE&&(c=-c)}i=Math.atan2(t,r),s=Ng(Math.asin(c),this.apa)}return e.x=b(this.long0+i),e.y=s,e}var Ig=.3333333333333333,Sg=.17222222222222222,Ag=.10257936507936508,Bg=.06388888888888888,Tg=.0664021164021164,Dg=.016415012942191543;function Eg(e){var t,r=[];return r[0]=e*Ig,t=e*e,r[0]+=t*Sg,r[1]=t*Bg,t*=e,r[0]+=t*Ag,r[1]+=t*Tg,r[2]=t*Dg,r}function Ng(e,t){var r=e+e;return e+t[0]*Math.sin(r)+t[1]*Math.sin(r+r)+t[2]*Math.sin(r+r+r)}var Og=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],Yf={init:wg,forward:Mg,inverse:xg,names:Og,S_POLE:gg,N_POLE:_g,EQUIT:bg,OBLIQ:vg};function be(e){return Math.abs(e)>1&&(e=e>1?1:-1),Math.asin(e)}function Lg(){Math.abs(this.lat1+this.lat2)<_||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=qt(this.e3,this.sin_po,this.cos_po),this.qs1=nr(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=qt(this.e3,this.sin_po,this.cos_po),this.qs2=nr(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=nr(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>_?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function Fg(e){var t=e.x,r=e.y;this.sin_phi=Math.sin(r),this.cos_phi=Math.cos(r);var i=nr(this.e3,this.sin_phi,this.cos_phi),s=this.a*Math.sqrt(this.c-this.ns0*i)/this.ns0,n=this.ns0*b(t-this.long0),o=s*Math.sin(n)+this.x0,a=this.rh-s*Math.cos(n)+this.y0;return e.x=o,e.y=a,e}function Rg(e){var t,r,i,s,n,o;return e.x-=this.x0,e.y=this.rh-e.y+this.y0,this.ns0>=0?(t=Math.sqrt(e.x*e.x+e.y*e.y),i=1):(t=-Math.sqrt(e.x*e.x+e.y*e.y),i=-1),s=0,t!==0&&(s=Math.atan2(i*e.x,i*e.y)),i=t*this.ns0/this.a,this.sphere?o=Math.asin((this.c-i*i)/(2*this.ns0)):(r=(this.c-i*i)/this.ns0,o=this.phi1z(this.e3,r)),n=b(s/this.ns0+this.long0),e.x=n,e.y=o,e}function Cg(e,t){var r,i,s,n,o,a=be(.5*t);if(e<_)return a;for(var h=e*e,c=1;c<=25;c++)if(r=Math.sin(a),i=Math.cos(a),s=e*r,n=1-s*s,o=.5*n*n/i*(t/(1-h)-r/n+.5/e*Math.log((1-s)/(1+s))),a=a+o,Math.abs(o)<=1e-7)return a;return null}var Ug=["Albers_Conic_Equal_Area","Albers","aea"],Kf={init:Lg,forward:Fg,inverse:Rg,names:Ug,phi1z:Cg};function Pg(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function kg(e){var t,r,i,s,n,o,a,h,c=e.x,l=e.y;return i=b(c-this.long0),t=Math.sin(l),r=Math.cos(l),s=Math.cos(i),o=this.sin_p14*t+this.cos_p14*r*s,n=1,o>0||Math.abs(o)<=_?(a=this.x0+this.a*n*r*Math.sin(i)/o,h=this.y0+this.a*n*(this.cos_p14*t-this.sin_p14*r*s)/o):(a=this.x0+this.infinity_dist*r*Math.sin(i),h=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*r*s)),e.x=a,e.y=h,e}function Vg(e){var t,r,i,s,n,o;return e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,(t=Math.sqrt(e.x*e.x+e.y*e.y))?(s=Math.atan2(t,this.rc),r=Math.sin(s),i=Math.cos(s),o=be(i*this.sin_p14+e.y*r*this.cos_p14/t),n=Math.atan2(e.x*r,t*this.cos_p14*i-e.y*this.sin_p14*r),n=b(this.long0+n)):(o=this.phic0,n=0),e.x=n,e.y=o,e}var zg=["gnom"],Xf={init:Pg,forward:kg,inverse:Vg,names:zg};function Zf(e,t){var r=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));if(Math.abs(Math.abs(t)-r)<1e-6)return t<0?-1*y:y;for(var i=Math.asin(.5*t),s,n,o,a,h=0;h<30;h++)if(n=Math.sin(i),o=Math.cos(i),a=e*n,s=Math.pow(1-a*a,2)/(2*o)*(t/(1-e*e)-n/(1-a*a)+.5/e*Math.log((1-a)/(1+a))),i+=s,Math.abs(s)<=1e-10)return i;return NaN}function jg(){this.sphere||(this.k0=qt(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function Gg(e){var t=e.x,r=e.y,i,s,n=b(t-this.long0);if(this.sphere)i=this.x0+this.a*n*Math.cos(this.lat_ts),s=this.y0+this.a*Math.sin(r)/Math.cos(this.lat_ts);else{var o=nr(this.e,Math.sin(r));i=this.x0+this.a*this.k0*n,s=this.y0+this.a*o*.5/this.k0}return e.x=i,e.y=s,e}function Hg(e){e.x-=this.x0,e.y-=this.y0;var t,r;return this.sphere?(t=b(this.long0+e.x/this.a/Math.cos(this.lat_ts)),r=Math.asin(e.y/this.a*Math.cos(this.lat_ts))):(r=Zf(this.e,2*e.y*this.k0/this.a),t=b(this.long0+e.x/(this.a*this.k0))),e.x=t,e.y=r,e}var Wg=["cea"],Qf={init:jg,forward:Gg,inverse:Hg,names:Wg};function qg(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function $g(e){var t=e.x,r=e.y,i=b(t-this.long0),s=sr(r-this.lat0);return e.x=this.x0+this.a*i*this.rc,e.y=this.y0+this.a*s,e}function Jg(e){var t=e.x,r=e.y;return e.x=b(this.long0+(t-this.x0)/(this.a*this.rc)),e.y=sr(this.lat0+(r-this.y0)/this.a),e}var Yg=["Equirectangular","Equidistant_Cylindrical","eqc"],td={init:qg,forward:$g,inverse:Jg,names:Yg};var ed=20;function Kg(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Hr(this.es),this.e1=Wr(this.es),this.e2=qr(this.es),this.e3=$r(this.es),this.ml0=this.a*Nt(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Xg(e){var t=e.x,r=e.y,i,s,n,o=b(t-this.long0);if(n=o*Math.sin(r),this.sphere)Math.abs(r)<=_?(i=this.a*o,s=-1*this.a*this.lat0):(i=this.a*Math.sin(n)/Math.tan(r),s=this.a*(sr(r-this.lat0)+(1-Math.cos(n))/Math.tan(r)));else if(Math.abs(r)<=_)i=this.a*o,s=-1*this.ml0;else{var a=Jr(this.a,this.e,Math.sin(r))/Math.tan(r);i=a*Math.sin(n),s=this.a*Nt(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+a*(1-Math.cos(n))}return e.x=i+this.x0,e.y=s+this.y0,e}function Zg(e){var t,r,i,s,n,o,a,h,c;if(i=e.x-this.x0,s=e.y-this.y0,this.sphere)if(Math.abs(s+this.a*this.lat0)<=_)t=b(i/this.a+this.long0),r=0;else{o=this.lat0+s/this.a,a=i*i/this.a/this.a+o*o,h=o;var l;for(n=ed;n;--n)if(l=Math.tan(h),c=-1*(o*(h*l+1)-h-.5*(h*h+a)*l)/((h-o)/l-1),h+=c,Math.abs(c)<=_){r=h;break}t=b(this.long0+Math.asin(i*Math.tan(h)/this.a)/Math.sin(r))}else if(Math.abs(s+this.ml0)<=_)r=0,t=b(this.long0+i/this.a);else{o=(this.ml0+s)/this.a,a=i*i/this.a/this.a+o*o,h=o;var u,p,f,m,g;for(n=ed;n;--n)if(g=this.e*Math.sin(h),u=Math.sqrt(1-g*g)*Math.tan(h),p=this.a*Nt(this.e0,this.e1,this.e2,this.e3,h),f=this.e0-2*this.e1*Math.cos(2*h)+4*this.e2*Math.cos(4*h)-6*this.e3*Math.cos(6*h),m=p/this.a,c=(o*(u*m+1)-m-.5*u*(m*m+a))/(this.es*Math.sin(2*h)*(m*m+a-2*o*m)/(4*u)+(o-m)*(u*f-2/Math.sin(2*h))-f),h-=c,Math.abs(c)<=_){r=h;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(r),2))*Math.tan(r),t=b(this.long0+Math.asin(i*u/this.a)/Math.sin(r))}return e.x=t,e.y=r,e}var Qg=["Polyconic","poly"],rd={init:Kg,forward:Xg,inverse:Zg,names:Qg};function t_(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function e_(e){var t,r=e.x,i=e.y,s=i-this.lat0,n=r-this.long0,o=s/Pi*1e-5,a=n,h=1,c=0;for(t=1;t<=10;t++)h=h*o,c=c+this.A[t]*h;var l=c,u=a,p=1,f=0,m,g,v=0,I=0;for(t=1;t<=6;t++)m=p*l-f*u,g=f*l+p*u,p=m,f=g,v=v+this.B_re[t]*p-this.B_im[t]*f,I=I+this.B_im[t]*p+this.B_re[t]*f;return e.x=I*this.a+this.x0,e.y=v*this.a+this.y0,e}function r_(e){var t,r=e.x,i=e.y,s=r-this.x0,n=i-this.y0,o=n/this.a,a=s/this.a,h=1,c=0,l,u,p=0,f=0;for(t=1;t<=6;t++)l=h*o-c*a,u=c*o+h*a,h=l,c=u,p=p+this.C_re[t]*h-this.C_im[t]*c,f=f+this.C_im[t]*h+this.C_re[t]*c;for(var m=0;m<this.iterations;m++){var g=p,v=f,I,k,$=o,ot=a;for(t=2;t<=6;t++)I=g*p-v*f,k=v*p+g*f,g=I,v=k,$=$+(t-1)*(this.B_re[t]*g-this.B_im[t]*v),ot=ot+(t-1)*(this.B_im[t]*g+this.B_re[t]*v);g=1,v=0;var Z=this.B_re[1],tt=this.B_im[1];for(t=2;t<=6;t++)I=g*p-v*f,k=v*p+g*f,g=I,v=k,Z=Z+t*(this.B_re[t]*g-this.B_im[t]*v),tt=tt+t*(this.B_im[t]*g+this.B_re[t]*v);var Vt=Z*Z+tt*tt;p=($*Z+ot*tt)/Vt,f=(ot*Z-$*tt)/Vt}var _t=p,or=f,ii=1,si=0;for(t=1;t<=9;t++)ii=ii*_t,si=si+this.D[t]*ii;var jn=this.lat0+si*Pi*1e5,Rd=this.long0+or;return e.x=Rd,e.y=jn,e}var i_=["New_Zealand_Map_Grid","nzmg"],id={init:t_,forward:e_,inverse:r_,names:i_};function s_(){}function n_(e){var t=e.x,r=e.y,i=b(t-this.long0),s=this.x0+this.a*i,n=this.y0+this.a*Math.log(Math.tan(Math.PI/4+r/2.5))*1.25;return e.x=s,e.y=n,e}function o_(e){e.x-=this.x0,e.y-=this.y0;var t=b(this.long0+e.x/this.a),r=2.5*(Math.atan(Math.exp(.8*e.y/this.a))-Math.PI/4);return e.x=t,e.y=r,e}var a_=["Miller_Cylindrical","mill"],sd={init:s_,forward:n_,inverse:o_,names:a_};var h_=20;function c_(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=Na(this.es)}function l_(e){var t,r,i=e.x,s=e.y;if(i=b(i-this.long0),this.sphere){if(!this.m)s=this.n!==1?Math.asin(this.n*Math.sin(s)):s;else for(var n=this.n*Math.sin(s),o=h_;o;--o){var a=(this.m*s+Math.sin(s)-n)/(this.m+Math.cos(s));if(s-=a,Math.abs(a)<_)break}t=this.a*this.C_x*i*(this.m+Math.cos(s)),r=this.a*this.C_y*s}else{var h=Math.sin(s),c=Math.cos(s);r=this.a*zi(s,h,c,this.en),t=this.a*i*c/Math.sqrt(1-this.es*h*h)}return e.x=t,e.y=r,e}function u_(e){var t,r,i,s;return e.x-=this.x0,i=e.x/this.a,e.y-=this.y0,t=e.y/this.a,this.sphere?(t/=this.C_y,i=i/(this.C_x*(this.m+Math.cos(t))),this.m?t=be((this.m*t+Math.sin(t))/this.n):this.n!==1&&(t=be(Math.sin(t)/this.n)),i=b(i+this.long0),t=sr(t)):(t=Oa(e.y/this.a,this.es,this.en),s=Math.abs(t),s<y?(s=Math.sin(t),r=this.long0+e.x*Math.sqrt(1-this.es*s*s)/(this.a*Math.cos(t)),i=b(r)):s-_<y&&(i=this.long0)),e.x=i,e.y=t,e}var f_=["Sinusoidal","sinu"],nd={init:c_,forward:l_,inverse:u_,names:f_};function d_(){}function p_(e){for(var t=e.x,r=e.y,i=b(t-this.long0),s=r,n=Math.PI*Math.sin(r);;){var o=-(s+Math.sin(s)-n)/(1+Math.cos(s));if(s+=o,Math.abs(o)<_)break}s/=2,Math.PI/2-Math.abs(r)<_&&(i=0);var a=.900316316158*this.a*i*Math.cos(s)+this.x0,h=1.4142135623731*this.a*Math.sin(s)+this.y0;return e.x=a,e.y=h,e}function m_(e){var t,r;e.x-=this.x0,e.y-=this.y0,r=e.y/(1.4142135623731*this.a),Math.abs(r)>.999999999999&&(r=.999999999999),t=Math.asin(r);var i=b(this.long0+e.x/(.900316316158*this.a*Math.cos(t)));i<-Math.PI&&(i=-Math.PI),i>Math.PI&&(i=Math.PI),r=(2*t+Math.sin(2*t))/Math.PI,Math.abs(r)>1&&(r=1);var s=Math.asin(r);return e.x=i,e.y=s,e}var y_=["Mollweide","moll"],od={init:d_,forward:p_,inverse:m_,names:y_};function g_(){Math.abs(this.lat1+this.lat2)<_||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Hr(this.es),this.e1=Wr(this.es),this.e2=qr(this.es),this.e3=$r(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=qt(this.e,this.sinphi,this.cosphi),this.ml1=Nt(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<_?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=qt(this.e,this.sinphi,this.cosphi),this.ml2=Nt(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=Nt(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function __(e){var t=e.x,r=e.y,i;if(this.sphere)i=this.a*(this.g-r);else{var s=Nt(this.e0,this.e1,this.e2,this.e3,r);i=this.a*(this.g-s)}var n=this.ns*b(t-this.long0),o=this.x0+i*Math.sin(n),a=this.y0+this.rh-i*Math.cos(n);return e.x=o,e.y=a,e}function b_(e){e.x-=this.x0,e.y=this.rh-e.y+this.y0;var t,r,i,s;this.ns>=0?(r=Math.sqrt(e.x*e.x+e.y*e.y),t=1):(r=-Math.sqrt(e.x*e.x+e.y*e.y),t=-1);var n=0;if(r!==0&&(n=Math.atan2(t*e.x,t*e.y)),this.sphere)return s=b(this.long0+n/this.ns),i=sr(this.g-r/this.a),e.x=s,e.y=i,e;var o=this.g-r/this.a;return i=ji(o,this.e0,this.e1,this.e2,this.e3),s=b(this.long0+n/this.ns),e.x=s,e.y=i,e}var v_=["Equidistant_Conic","eqdc"],ad={init:g_,forward:__,inverse:b_,names:v_};function w_(){this.R=this.a}function M_(e){var t=e.x,r=e.y,i=b(t-this.long0),s,n;Math.abs(r)<=_&&(s=this.x0+this.R*i,n=this.y0);var o=be(2*Math.abs(r/Math.PI));(Math.abs(i)<=_||Math.abs(Math.abs(r)-y)<=_)&&(s=this.x0,r>=0?n=this.y0+Math.PI*this.R*Math.tan(.5*o):n=this.y0+Math.PI*this.R*-Math.tan(.5*o));var a=.5*Math.abs(Math.PI/i-i/Math.PI),h=a*a,c=Math.sin(o),l=Math.cos(o),u=l/(c+l-1),p=u*u,f=u*(2/c-1),m=f*f,g=Math.PI*this.R*(a*(u-m)+Math.sqrt(h*(u-m)*(u-m)-(m+h)*(p-m)))/(m+h);i<0&&(g=-g),s=this.x0+g;var v=h+u;return g=Math.PI*this.R*(f*v-a*Math.sqrt((m+h)*(h+1)-v*v))/(m+h),r>=0?n=this.y0+g:n=this.y0-g,e.x=s,e.y=n,e}function x_(e){var t,r,i,s,n,o,a,h,c,l,u,p,f;return e.x-=this.x0,e.y-=this.y0,u=Math.PI*this.R,i=e.x/u,s=e.y/u,n=i*i+s*s,o=-Math.abs(s)*(1+n),a=o-2*s*s+i*i,h=-2*o+1+2*s*s+n*n,f=s*s/h+(2*a*a*a/h/h/h-9*o*a/h/h)/27,c=(o-a*a/3/h)/h,l=2*Math.sqrt(-c/3),u=3*f/c/l,Math.abs(u)>1&&(u>=0?u=1:u=-1),p=Math.acos(u)/3,e.y>=0?r=(-l*Math.cos(p+Math.PI/3)-a/3/h)*Math.PI:r=-(-l*Math.cos(p+Math.PI/3)-a/3/h)*Math.PI,Math.abs(i)<_?t=this.long0:t=b(this.long0+Math.PI*(n-1+Math.sqrt(1+2*(i*i-s*s)+n*n))/2/i),e.x=t,e.y=r,e}var I_=["Van_der_Grinten_I","VanDerGrinten","vandg"],hd={init:w_,forward:M_,inverse:x_,names:I_};function S_(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)}function A_(e){var t=e.x,r=e.y,i=Math.sin(e.y),s=Math.cos(e.y),n=b(t-this.long0),o,a,h,c,l,u,p,f,m,g,v,I,k,$,ot,Z,tt,Vt,_t,or,ii,si,jn;return this.sphere?Math.abs(this.sin_p12-1)<=_?(e.x=this.x0+this.a*(y-r)*Math.sin(n),e.y=this.y0-this.a*(y-r)*Math.cos(n),e):Math.abs(this.sin_p12+1)<=_?(e.x=this.x0+this.a*(y+r)*Math.sin(n),e.y=this.y0+this.a*(y+r)*Math.cos(n),e):(Vt=this.sin_p12*i+this.cos_p12*s*Math.cos(n),Z=Math.acos(Vt),tt=Z?Z/Math.sin(Z):1,e.x=this.x0+this.a*tt*s*Math.sin(n),e.y=this.y0+this.a*tt*(this.cos_p12*i-this.sin_p12*s*Math.cos(n)),e):(o=Hr(this.es),a=Wr(this.es),h=qr(this.es),c=$r(this.es),Math.abs(this.sin_p12-1)<=_?(l=this.a*Nt(o,a,h,c,y),u=this.a*Nt(o,a,h,c,r),e.x=this.x0+(l-u)*Math.sin(n),e.y=this.y0-(l-u)*Math.cos(n),e):Math.abs(this.sin_p12+1)<=_?(l=this.a*Nt(o,a,h,c,y),u=this.a*Nt(o,a,h,c,r),e.x=this.x0+(l+u)*Math.sin(n),e.y=this.y0+(l+u)*Math.cos(n),e):(p=i/s,f=Jr(this.a,this.e,this.sin_p12),m=Jr(this.a,this.e,i),g=Math.atan((1-this.es)*p+this.es*f*this.sin_p12/(m*s)),v=Math.atan2(Math.sin(n),this.cos_p12*Math.tan(g)-this.sin_p12*Math.cos(n)),v===0?_t=Math.asin(this.cos_p12*Math.sin(g)-this.sin_p12*Math.cos(g)):Math.abs(Math.abs(v)-Math.PI)<=_?_t=-Math.asin(this.cos_p12*Math.sin(g)-this.sin_p12*Math.cos(g)):_t=Math.asin(Math.sin(n)*Math.cos(g)/Math.sin(v)),I=this.e*this.sin_p12/Math.sqrt(1-this.es),k=this.e*this.cos_p12*Math.cos(v)/Math.sqrt(1-this.es),$=I*k,ot=k*k,or=_t*_t,ii=or*_t,si=ii*_t,jn=si*_t,Z=f*_t*(1-or*ot*(1-ot)/6+ii/8*$*(1-2*ot)+si/120*(ot*(4-7*ot)-3*I*I*(1-7*ot))-jn/48*$),e.x=this.x0+Z*Math.sin(v),e.y=this.y0+Z*Math.cos(v),e))}function B_(e){e.x-=this.x0,e.y-=this.y0;var t,r,i,s,n,o,a,h,c,l,u,p,f,m,g,v,I,k,$,ot,Z,tt,Vt,_t;return this.sphere?(t=Math.sqrt(e.x*e.x+e.y*e.y),t>2*y*this.a?void 0:(r=t/this.a,i=Math.sin(r),s=Math.cos(r),n=this.long0,Math.abs(t)<=_?o=this.lat0:(o=be(s*this.sin_p12+e.y*i*this.cos_p12/t),a=Math.abs(this.lat0)-y,Math.abs(a)<=_?this.lat0>=0?n=b(this.long0+Math.atan2(e.x,-e.y)):n=b(this.long0-Math.atan2(-e.x,e.y)):n=b(this.long0+Math.atan2(e.x*i,t*this.cos_p12*s-e.y*this.sin_p12*i))),e.x=n,e.y=o,e)):(h=Hr(this.es),c=Wr(this.es),l=qr(this.es),u=$r(this.es),Math.abs(this.sin_p12-1)<=_?(p=this.a*Nt(h,c,l,u,y),t=Math.sqrt(e.x*e.x+e.y*e.y),f=p-t,o=ji(f/this.a,h,c,l,u),n=b(this.long0+Math.atan2(e.x,-1*e.y)),e.x=n,e.y=o,e):Math.abs(this.sin_p12+1)<=_?(p=this.a*Nt(h,c,l,u,y),t=Math.sqrt(e.x*e.x+e.y*e.y),f=t-p,o=ji(f/this.a,h,c,l,u),n=b(this.long0+Math.atan2(e.x,e.y)),e.x=n,e.y=o,e):(t=Math.sqrt(e.x*e.x+e.y*e.y),v=Math.atan2(e.x,e.y),m=Jr(this.a,this.e,this.sin_p12),I=Math.cos(v),k=this.e*this.cos_p12*I,$=-k*k/(1-this.es),ot=3*this.es*(1-$)*this.sin_p12*this.cos_p12*I/(1-this.es),Z=t/m,tt=Z-$*(1+$)*Math.pow(Z,3)/6-ot*(1+3*$)*Math.pow(Z,4)/24,Vt=1-$*tt*tt/2-Z*tt*tt*tt/6,g=Math.asin(this.sin_p12*Math.cos(tt)+this.cos_p12*Math.sin(tt)*I),n=b(this.long0+Math.asin(Math.sin(v)*Math.sin(tt)/Math.cos(g))),_t=Math.sin(g),o=Math.atan2((_t-this.es*Vt*this.sin_p12)*Math.tan(g),_t*(1-this.es)),e.x=n,e.y=o,e))}var T_=["Azimuthal_Equidistant","aeqd"],cd={init:S_,forward:A_,inverse:B_,names:T_};function D_(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)}function E_(e){var t,r,i,s,n,o,a,h,c=e.x,l=e.y;return i=b(c-this.long0),t=Math.sin(l),r=Math.cos(l),s=Math.cos(i),o=this.sin_p14*t+this.cos_p14*r*s,n=1,(o>0||Math.abs(o)<=_)&&(a=this.a*n*r*Math.sin(i),h=this.y0+this.a*n*(this.cos_p14*t-this.sin_p14*r*s)),e.x=a,e.y=h,e}function N_(e){var t,r,i,s,n,o,a;return e.x-=this.x0,e.y-=this.y0,t=Math.sqrt(e.x*e.x+e.y*e.y),r=be(t/this.a),i=Math.sin(r),s=Math.cos(r),o=this.long0,Math.abs(t)<=_?(a=this.lat0,e.x=o,e.y=a,e):(a=be(s*this.sin_p14+e.y*i*this.cos_p14/t),n=Math.abs(this.lat0)-y,Math.abs(n)<=_?(this.lat0>=0?o=b(this.long0+Math.atan2(e.x,-e.y)):o=b(this.long0-Math.atan2(-e.x,e.y)),e.x=o,e.y=a,e):(o=b(this.long0+Math.atan2(e.x*i,t*this.cos_p14*s-e.y*this.sin_p14*i)),e.x=o,e.y=a,e))}var O_=["ortho"],ld={init:D_,forward:E_,inverse:N_,names:O_};var gt={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},it={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function L_(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=y-Y/2?this.face=gt.TOP:this.lat0<=-(y-Y/2)?this.face=gt.BOTTOM:Math.abs(this.long0)<=Y?this.face=gt.FRONT:Math.abs(this.long0)<=y+Y?this.face=this.long0>0?gt.RIGHT:gt.LEFT:this.face=gt.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function F_(e){var t={x:0,y:0},r,i,s,n,o,a,h={value:0};if(e.x-=this.long0,this.es!==0?r=Math.atan(this.one_minus_f_squared*Math.tan(e.y)):r=e.y,i=e.x,this.face===gt.TOP)n=y-r,i>=Y&&i<=y+Y?(h.value=it.AREA_0,s=i-y):i>y+Y||i<=-(y+Y)?(h.value=it.AREA_1,s=i>0?i-yt:i+yt):i>-(y+Y)&&i<=-Y?(h.value=it.AREA_2,s=i+y):(h.value=it.AREA_3,s=i);else if(this.face===gt.BOTTOM)n=y+r,i>=Y&&i<=y+Y?(h.value=it.AREA_0,s=-i+y):i<Y&&i>=-Y?(h.value=it.AREA_1,s=-i):i<-Y&&i>=-(y+Y)?(h.value=it.AREA_2,s=-i-y):(h.value=it.AREA_3,s=i>0?-i+yt:-i-yt);else{var c,l,u,p,f,m,g;this.face===gt.RIGHT?i=Us(i,+y):this.face===gt.BACK?i=Us(i,+yt):this.face===gt.LEFT&&(i=Us(i,-y)),p=Math.sin(r),f=Math.cos(r),m=Math.sin(i),g=Math.cos(i),c=f*g,l=f*m,u=p,this.face===gt.FRONT?(n=Math.acos(c),s=Ua(n,u,l,h)):this.face===gt.RIGHT?(n=Math.acos(l),s=Ua(n,u,-c,h)):this.face===gt.BACK?(n=Math.acos(-c),s=Ua(n,u,-l,h)):this.face===gt.LEFT?(n=Math.acos(-l),s=Ua(n,u,c,h)):(n=s=0,h.value=it.AREA_0)}return a=Math.atan(12/yt*(s+Math.acos(Math.sin(s)*Math.cos(Y))-y)),o=Math.sqrt((1-Math.cos(n))/(Math.cos(a)*Math.cos(a))/(1-Math.cos(Math.atan(1/Math.cos(s))))),h.value===it.AREA_1?a+=y:h.value===it.AREA_2?a+=yt:h.value===it.AREA_3&&(a+=1.5*yt),t.x=o*Math.cos(a),t.y=o*Math.sin(a),t.x=t.x*this.a+this.x0,t.y=t.y*this.a+this.y0,e.x=t.x,e.y=t.y,e}function R_(e){var t={lam:0,phi:0},r,i,s,n,o,a,h,c,l,u={value:0};if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,i=Math.atan(Math.sqrt(e.x*e.x+e.y*e.y)),r=Math.atan2(e.y,e.x),e.x>=0&&e.x>=Math.abs(e.y)?u.value=it.AREA_0:e.y>=0&&e.y>=Math.abs(e.x)?(u.value=it.AREA_1,r-=y):e.x<0&&-e.x>=Math.abs(e.y)?(u.value=it.AREA_2,r=r<0?r+yt:r-yt):(u.value=it.AREA_3,r+=y),l=yt/12*Math.tan(r),o=Math.sin(l)/(Math.cos(l)-1/Math.sqrt(2)),a=Math.atan(o),s=Math.cos(r),n=Math.tan(i),h=1-s*s*n*n*(1-Math.cos(Math.atan(1/Math.cos(a)))),h<-1?h=-1:h>1&&(h=1),this.face===gt.TOP)c=Math.acos(h),t.phi=y-c,u.value===it.AREA_0?t.lam=a+y:u.value===it.AREA_1?t.lam=a<0?a+yt:a-yt:u.value===it.AREA_2?t.lam=a-y:t.lam=a;else if(this.face===gt.BOTTOM)c=Math.acos(h),t.phi=c-y,u.value===it.AREA_0?t.lam=-a+y:u.value===it.AREA_1?t.lam=-a:u.value===it.AREA_2?t.lam=-a-y:t.lam=a<0?-a-yt:-a+yt;else{var p,f,m;p=h,l=p*p,l>=1?m=0:m=Math.sqrt(1-l)*Math.sin(a),l+=m*m,l>=1?f=0:f=Math.sqrt(1-l),u.value===it.AREA_1?(l=f,f=-m,m=l):u.value===it.AREA_2?(f=-f,m=-m):u.value===it.AREA_3&&(l=f,f=m,m=-l),this.face===gt.RIGHT?(l=p,p=-f,f=l):this.face===gt.BACK?(p=-p,f=-f):this.face===gt.LEFT&&(l=p,p=f,f=-l),t.phi=Math.acos(-m)-y,t.lam=Math.atan2(f,p),this.face===gt.RIGHT?t.lam=Us(t.lam,-y):this.face===gt.BACK?t.lam=Us(t.lam,-yt):this.face===gt.LEFT&&(t.lam=Us(t.lam,+y))}if(this.es!==0){var g,v,I;g=t.phi<0?1:0,v=Math.tan(t.phi),I=this.b/Math.sqrt(v*v+this.one_minus_f_squared),t.phi=Math.atan(Math.sqrt(this.a*this.a-I*I)/(this.one_minus_f*I)),g&&(t.phi=-t.phi)}return t.lam+=this.long0,e.x=t.lam,e.y=t.phi,e}function Ua(e,t,r,i){var s;return e<_?(i.value=it.AREA_0,s=0):(s=Math.atan2(t,r),Math.abs(s)<=Y?i.value=it.AREA_0:s>Y&&s<=y+Y?(i.value=it.AREA_1,s-=y):s>y+Y||s<=-(y+Y)?(i.value=it.AREA_2,s=s>=0?s-yt:s+yt):(i.value=it.AREA_3,s+=y)),s}function Us(e,t){var r=e+t;return r<-yt?r+=En:r>+yt&&(r-=En),r}var C_=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],ud={init:L_,forward:F_,inverse:R_,names:C_};var _c=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],Un=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],fd=.8487,dd=1.3523,pd=ir/5,U_=1/pd,Ps=18,Pa=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},P_=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function k_(e,t,r,i){for(var s=t;i;--i){var n=e(s);if(s-=n,Math.abs(n)<r)break}return s}function V_(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function z_(e){var t=b(e.x-this.long0),r=Math.abs(e.y),i=Math.floor(r*pd);i<0?i=0:i>=Ps&&(i=Ps-1),r=ir*(r-U_*i);var s={x:Pa(_c[i],r)*t,y:Pa(Un[i],r)};return e.y<0&&(s.y=-s.y),s.x=s.x*this.a*fd+this.x0,s.y=s.y*this.a*dd+this.y0,s}function j_(e){var t={x:(e.x-this.x0)/(this.a*fd),y:Math.abs(e.y-this.y0)/(this.a*dd)};if(t.y>=1)t.x/=_c[Ps][0],t.y=e.y<0?-y:y;else{var r=Math.floor(t.y*Ps);for(r<0?r=0:r>=Ps&&(r=Ps-1);;)if(Un[r][0]>t.y)--r;else if(Un[r+1][0]<=t.y)++r;else break;var i=Un[r],s=5*(t.y-i[0])/(Un[r+1][0]-i[0]);s=k_(function(n){return(Pa(i,n)-t.y)/P_(i,n)},s,_,100),t.x/=Pa(_c[r],s),t.y=(5*r+s)*Dt,e.y<0&&(t.y=-t.y)}return t.x=b(t.x+this.long0),t}var G_=["Robinson","robin"],md={init:V_,forward:z_,inverse:j_,names:G_};function H_(){this.name="geocent"}function W_(e){var t=Ba(e,this.es,this.a);return t}function q_(e){var t=Ta(e,this.es,this.a,this.b);return t}var $_=["Geocentric","geocentric","geocent","Geocent"],yd={init:H_,forward:W_,inverse:q_,names:$_};function gd(e){e.Proj.projections.add(Rf),e.Proj.projections.add(Cs),e.Proj.projections.add(zf),e.Proj.projections.add(jf),e.Proj.projections.add(Gf),e.Proj.projections.add(Hf),e.Proj.projections.add(Wf),e.Proj.projections.add(qf),e.Proj.projections.add($f),e.Proj.projections.add(Jf),e.Proj.projections.add(Yf),e.Proj.projections.add(Kf),e.Proj.projections.add(Xf),e.Proj.projections.add(Qf),e.Proj.projections.add(td),e.Proj.projections.add(rd),e.Proj.projections.add(id),e.Proj.projections.add(sd),e.Proj.projections.add(nd),e.Proj.projections.add(od),e.Proj.projections.add(ad),e.Proj.projections.add(hd),e.Proj.projections.add(cd),e.Proj.projections.add(ld),e.Proj.projections.add(ud),e.Proj.projections.add(md),e.Proj.projections.add(yd)}Te.defaultDatum="WGS84";Te.Proj=ri;Te.WGS84=new Te.Proj("WGS84");Te.Point=Nf;Te.toPoint=Ea;Te.defs=Os;Te.transform=Vi;Te.mgrs=Tf;Te.version="__VERSION__";gd(Te);var bc=Te;var Pn=class{static defineProjectionAliases(t){let r=[];for(let i in t)r.push([i,t[i]]);bc.defs(r)}constructor({from:t="WGS84",to:r="WGS84"}){if(this._projection=bc(t,r),!this._projection)throw new Error("Invalid projection");this.project=this.project.bind(this),this.unproject=this.unproject.bind(this)}project(t){return this._projection.forward(t)}unproject(t){return this._projection.inverse(t)}};var vc=100,_d=!1;function bd(e){let t=new DataView(e,0,vc),i=Jn(t).length-vc,s=new DataView(e,vc,i),n=new Int32Array(i),o=new Int32Array(i);for(let a=0;a<i/8;a++)n[a]=s.getInt32(a*8,_d),o[a]=s.getInt32(a*8+4,_d);return{offsets:n,lengths:o}}async function*ka(e,t,r){let i=[],s=[],n=!1,o=!1;for(;!n&&!o;){if(i.length===0&&!n){let{value:h,done:c}=await e.next();c?n=!0:i.push(...h)}if(s.length===0&&!o){let{value:h,done:c}=await t.next();c?o=!0:s.push(...h)}let a=J_(i,s);a&&(yield{batchType:"data",shape:r,length:a.length,data:a})}}function J_(e,t){let r=Math.min(e.length,t.length);if(r===0)return null;let i=[e.slice(0,r),t.slice(0,r)];return e.splice(0,r),t.splice(0,r),i}var wc=!0,vd=32,ee;(function(e){e[e.START=0]="START",e[e.FIELD_DESCRIPTORS=1]="FIELD_DESCRIPTORS",e[e.FIELD_PROPERTIES=2]="FIELD_PROPERTIES",e[e.END=3]="END",e[e.ERROR=4]="ERROR"})(ee||(ee={}));var za=class{binaryReader=new ar;textDecoder;state=ee.START;result={data:[]};constructor(t){this.textDecoder=new TextDecoder(t.encoding)}write(t){this.binaryReader.write(t),this.state=wd(this.state,this.result,this.binaryReader,this.textDecoder)}end(){this.binaryReader.end(),this.state=wd(this.state,this.result,this.binaryReader,this.textDecoder),this.state!==ee.END&&(this.state=ee.ERROR,this.result.error="DBF incomplete file")}};function Mc(e,t={}){let{encoding:r="latin1"}=t.dbf||{},i=new za({encoding:r});i.write(e),i.end();let{data:s,schema:n}=i.result;switch(t?.dbf?.shape){case"object-row-table":return{shape:"object-row-table",schema:n,data:s};case"table":return{schema:n,rows:s};case"rows":default:return s}}async function*Md(e,t={}){let{encoding:r="latin1"}=t.dbf||{},i=new za({encoding:r}),s=!1;for await(let n of Er(e))i.write(n),!s&&i.result.dbfHeader&&(s=!0,yield i.result.dbfHeader),i.result.data.length>0&&(yield i.result.data,i.result.data=[]);i.end(),i.result.data.length>0&&(yield i.result.data)}function wd(e,t,r,i){for(;;)try{switch(e){case ee.ERROR:case ee.END:return e;case ee.START:let s=r.getDataView(vd);if(!s)return e;t.dbfHeader=Y_(s),t.progress={bytesUsed:0,rowsTotal:t.dbfHeader.nRecords,rows:0},e=ee.FIELD_DESCRIPTORS;break;case ee.FIELD_DESCRIPTORS:let n=r.getDataView(t.dbfHeader.headerLength-vd);if(!n)return e;t.dbfFields=K_(n,i),t.schema={fields:t.dbfFields.map(h=>rb(h)),metadata:{}},e=ee.FIELD_PROPERTIES,r.skip(1);break;case ee.FIELD_PROPERTIES:let{recordLength:o=0,nRecords:a=0}=t?.dbfHeader||{};for(;t.data.length<a;){let h=r.getDataView(o-1);if(!h)return e;r.skip(1);let c=X_(h,t.dbfFields,i);t.data.push(c),t.progress.rows=t.data.length}e=ee.END;break;default:return e=ee.ERROR,t.error=`illegal parser state ${e}`,e}}catch(s){return e=ee.ERROR,t.error=`DBF parsing failed: ${s.message}`,e}}function Y_(e){return{year:e.getUint8(1)+1900,month:e.getUint8(2),day:e.getUint8(3),nRecords:e.getUint32(4,wc),headerLength:e.getUint16(8,wc),recordLength:e.getUint16(10,wc),languageDriver:e.getUint8(29)}}function K_(e,t){let r=(e.byteLength-1)/32,i=[],s=0;for(let n=0;n<r;n++){let o=t.decode(new Uint8Array(e.buffer,e.byteOffset+s,11)).replace(/\u0000/g,"");i.push({name:o,dataType:String.fromCharCode(e.getUint8(s+11)),fieldLength:e.getUint8(s+16),decimal:e.getUint8(s+17)}),s+=32}return i}function X_(e,t,r){let i={},s=0;for(let n of t){let o=r.decode(new Uint8Array(e.buffer,e.byteOffset+s,n.fieldLength));i[n.name]=Z_(o,n.dataType),s+=n.fieldLength}return i}function Z_(e,t){switch(t){case"B":return Va(e);case"C":return eb(e);case"F":return Va(e);case"N":return Va(e);case"O":return Va(e);case"D":return Q_(e);case"L":return tb(e);default:throw new Error("Unsupported data type")}}function Q_(e){return Date.UTC(e.slice(0,4),parseInt(e.slice(4,6),10)-1,e.slice(6,8))}function tb(e){return/^[nf]$/i.test(e)?!1:/^[yt]$/i.test(e)?!0:null}function Va(e){let t=parseFloat(e);return isNaN(t)?null:t}function eb(e){return e.trim()||null}function rb({name:e,dataType:t,fieldLength:r,decimal:i}){switch(t){case"B":return{name:e,type:"float64",nullable:!0,metadata:{}};case"C":return{name:e,type:"utf8",nullable:!0,metadata:{}};case"F":return{name:e,type:"float64",nullable:!0,metadata:{}};case"N":return{name:e,type:"float64",nullable:!0,metadata:{}};case"O":return{name:e,type:"float64",nullable:!0,metadata:{}};case"D":return{name:e,type:"timestamp-millisecond",nullable:!0,metadata:{}};case"L":return{name:e,type:"bool",nullable:!0,metadata:{}};default:throw new Error("Unsupported data type")}}var ib="4.4.0-alpha.15",xc={name:"DBF",dataType:null,batchType:null,id:"dbf",module:"shapefile",version:ib,worker:!0,category:"table",extensions:["dbf"],mimeTypes:["application/x-dbf"],options:{dbf:{encoding:"latin1"}}},kn={...xc,parse:async(e,t)=>Mc(e,t),parseSync:Mc,parseInBatches(e,t){return Md(e,t)}};async function*xd(e,t,r){let{reproject:i=!1,_targetCrs:s="WGS84"}=t?.gis||{},{shx:n,cpg:o,prj:a}=await Td(t,r),h=await $n(Er(e),Vs,t,r),c=h[Symbol.asyncIterator]?.()||h[Symbol.iterator]?.(),l=null,u=await r?.fetch(Vn(r?.url||"","dbf"));if(u?.ok){let v=await $n(u,kn,{...t,dbf:{...t?.dbf,encoding:o||"latin1"}},r);l=v[Symbol.asyncIterator]?.()||v[Symbol.iterator]()}let p=(await c.next()).value;p&&p.batchType==="metadata"&&(p=(await c.next()).value);let f={};l&&(f=(await l.next()).value,f&&f.batchType==="metadata"&&(f=(await l.next()).value));let m=l?ka(c,l,"object-row-table"):c,g={[Symbol.asyncIterator](){return m}};for await(let v of g){let I,k;l?[I,k]=v.data:I=v;let $=Sd(I),ot=Ad($,k);i&&(ot=Bd(ot,a,s)),yield{encoding:o,prj:a,shx:n,header:p,data:ot}}}async function Id(e,t,r){let{reproject:i=!1,_targetCrs:s="WGS84"}=t?.gis||{},{shx:n,cpg:o,prj:a}=await Td(t,r),{header:h,geometries:c}=await qn(e,Vs,t,r),l=Sd(c),u,p=await r?.fetch(Vn(r?.url,"dbf"));if(p?.ok){let m={...t,dbf:{...t?.dbf,shape:"object-row-table",encoding:o||"latin1"}};u=await qn(p,kn,m,r)}let f=Ad(l,u?.data||[]);switch(i&&(f=Bd(f,a,s)),t?.shapefile?.shape){case"geojson-table":return{shape:"geojson-table",type:"FeatureCollection",encoding:o,schema:u?.schema||{metadata:{},fields:[]},prj:a,shx:n,header:h,features:f};default:return{encoding:o,prj:a,shx:n,header:h,data:f}}}function Sd(e){let t=[];for(let r of e)t.push(sc(r));return t}function Ad(e,t){let r=[];for(let i=0;i<e.length;i++){let n={type:"Feature",geometry:e[i],properties:t&&t[i]||{}};r.push(n)}return r}function Bd(e,t,r){if(!t&&!r)return e;let i=new Pn({from:t||"WGS84",to:r||"WGS84"});return Ka(e,s=>i.project(s))}async function Td(e,t){let{url:r,fetch:i}=t,s=i(Vn(r,"shx")),n=i(Vn(r,"cpg")),o=i(Vn(r,"prj"));await Promise.all([s,n,o]);let a,h,c,l=await s;if(l.ok){let f=await l.arrayBuffer();a=bd(f)}let u=await n;u.ok&&(h=await u.text());let p=await o;return p.ok&&(c=await p.text()),{shx:a,cpg:h,prj:c}}function Vn(e,t){let r=sb(e),i=nb(e);return i===i.toUpperCase()&&(t=t.toUpperCase()),`${r}.${t}`}function sb(e){let t=e&&e.lastIndexOf(".");return typeof t=="number"?t>=0?e.substr(0,t):"":t}function nb(e){let t=e&&e.lastIndexOf(".");return typeof t=="number"?t>=0?e.substr(t+1):"":t}var ob="4.4.0-alpha.15",Dd={name:"Shapefile",id:"shapefile",module:"shapefile",version:ob,category:"geometry",extensions:["shp"],mimeTypes:["application/octet-stream"],tests:[new Uint8Array(Ja).buffer],options:{shapefile:{shape:"v3"},shp:{_maxDimensions:4}},parse:Id,parseInBatches:xd};var Ic=!0,Ed=32,re;(function(e){e[e.START=0]="START",e[e.FIELD_DESCRIPTORS=1]="FIELD_DESCRIPTORS",e[e.FIELD_PROPERTIES=2]="FIELD_PROPERTIES",e[e.END=3]="END",e[e.ERROR=4]="ERROR"})(re||(re={}));var Ga=class{binaryReader=new ar;textDecoder;state=re.START;result={};constructor(t){this.textDecoder=new TextDecoder(t.encoding)}write(t){this.binaryReader.write(t),this.state=Nd(this.state,this.result,this.binaryReader,this.textDecoder)}end(){this.binaryReader.end(),this.state=Nd(this.state,this.result,this.binaryReader,this.textDecoder),this.state!==re.END&&(this.state=re.ERROR,this.result.error="DBF incomplete file")}};function Sc(e,t={}){let{encoding:r="latin1"}=t.dbf||{},i=new Ga({encoding:r});return i.write(e),i.end(),i.result.tableBuilder.finishTable()}async function*Od(e,t={}){let{encoding:r="latin1"}=t.dbf||{},i=new Ga({encoding:r}),s=!1;for await(let a of Er(e)){if(i.write(a),!s&&i.result.dbfHeader){s=!0;let u=i.result.tableBuilder.firstBatch();u&&(yield u)}let c=i.result.tableBuilder.flushBatch();c&&(yield c)}i.end();let o=i.result.tableBuilder.finishBatch();o&&(yield o)}function Nd(e,t,r,i){for(;;)try{switch(e){case re.ERROR:case re.END:return e;case re.START:let s=r.getDataView(Ed);if(!s)return e;t.dbfHeader=ab(s),t.progress={bytesUsed:0,rowsTotal:t.dbfHeader.nRecords,rows:0},e=re.FIELD_DESCRIPTORS;break;case re.FIELD_DESCRIPTORS:let n=r.getDataView(t.dbfHeader.headerLength-Ed);if(!n)return e;t.dbfFields=hb(n,i);let o={fields:t.dbfFields.map(l=>pb(l)),metadata:{}};t.tableBuilder=new Tn(o),e=re.FIELD_PROPERTIES,r.skip(1);break;case re.FIELD_PROPERTIES:let{recordLength:a=0,nRecords:h=0}=t?.dbfHeader||{},c=0;for(;c<h;){c++;let l=r.getDataView(a-1);if(!l)return e;r.skip(1);let u=cb(l,t.dbfFields,i);t.tableBuilder.addObjectRow(u)}e=re.END;break;default:return e=re.ERROR,t.error=`illegal parser state ${e}`,e}}catch(s){return e=re.ERROR,t.error=`DBF parsing failed: ${s.message}`,e}}function ab(e){return{year:e.getUint8(1)+1900,month:e.getUint8(2),day:e.getUint8(3),nRecords:e.getUint32(4,Ic),headerLength:e.getUint16(8,Ic),recordLength:e.getUint16(10,Ic),languageDriver:e.getUint8(29)}}function hb(e,t){let r=(e.byteLength-1)/32,i=[],s=0;for(let n=0;n<r;n++){let o=t.decode(new Uint8Array(e.buffer,e.byteOffset+s,11)).replace(/\u0000/g,"");i.push({name:o,dataType:String.fromCharCode(e.getUint8(s+11)),fieldLength:e.getUint8(s+16),decimal:e.getUint8(s+17)}),s+=32}return i}function cb(e,t,r){let i={},s=0;for(let n of t){let o=r.decode(new Uint8Array(e.buffer,e.byteOffset+s,n.fieldLength));i[n.name]=lb(o,n.dataType),s+=n.fieldLength}return i}function lb(e,t){switch(t){case"B":return ja(e);case"C":return db(e);case"F":return ja(e);case"N":return ja(e);case"O":return ja(e);case"D":return ub(e);case"L":return fb(e);default:throw new Error("Unsupported data type")}}function ub(e){return Date.UTC(e.slice(0,4),parseInt(e.slice(4,6),10)-1,e.slice(6,8))}function fb(e){return/^[nf]$/i.test(e)?!1:/^[yt]$/i.test(e)?!0:null}function ja(e){let t=parseFloat(e);return isNaN(t)?null:t}function db(e){return e.trim()||null}function pb({name:e,dataType:t,fieldLength:r,decimal:i}){switch(t){case"B":return{name:e,type:"float64",nullable:!0,metadata:{}};case"C":return{name:e,type:"utf8",nullable:!0,metadata:{}};case"F":return{name:e,type:"float64",nullable:!0,metadata:{}};case"N":return{name:e,type:"float64",nullable:!0,metadata:{}};case"O":return{name:e,type:"float64",nullable:!0,metadata:{}};case"D":return{name:e,type:"timestamp-millisecond",nullable:!0,metadata:{}};case"L":return{name:e,type:"bool",nullable:!0,metadata:{}};default:throw new Error("Unsupported data type")}}var Ld={name:"DBF",id:"dbf",module:"shapefile",category:"table",extensions:["dbf"],mimeTypes:["application/x-dbf"]};var mb="4.4.0-alpha.15",Ac={...Ld,dataType:null,batchType:null,version:mb,worker:!0,options:{dbf:{encoding:"latin1"}}},Fd={...Ac,parse:async(e,t)=>Sc(e,t),parseSync:Sc,parseInBatches(e,t){return Od(e,t)}};var Ha=class{offset;arrayBuffer;constructor(t){this.offset=0,this.arrayBuffer=t}hasAvailableBytes(t){return this.arrayBuffer.byteLength-this.offset>=t}getDataView(t){if(t&&!this.hasAvailableBytes(t))throw new Error("binary data exhausted");let r=t?new DataView(this.arrayBuffer,this.offset,t):new DataView(this.arrayBuffer,this.offset);return this.offset+=t,r}skip(t){this.offset+=t}rewind(t){this.offset-=t}};return Gd(zn);})();
|
|
20
20
|
return __exports__;
|
|
21
21
|
});
|