@loaders.gl/shapefile 4.4.0 → 4.4.1
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.min.js +2 -2
- package/dist/index.cjs +4 -4
- package/dist/shapefile-loader.js +1 -1
- package/dist/shp-loader.js +1 -1
- package/dist/shp-worker.js +1 -1
- package/package.json +6 -6
package/dist/dist.min.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
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 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",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=`
|
|
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.1",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
9
|
case ${xm(i)}:`).join("")}
|
|
10
10
|
return false;
|
|
@@ -16,6 +16,6 @@ return true;`)}function xm(e){return typeof e!="bigint"?Ye(e):`${Ye(e)}n`}functi
|
|
|
16
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 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",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",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",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);})();
|
|
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.1",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.1",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.1",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
|
});
|