@loaders.gl/json 4.4.0-alpha.16 → 4.4.0-alpha.18
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/dist.min.js +2 -2
- package/dist/geojson-loader.js +1 -1
- package/dist/geojson-worker.js +1 -1
- package/dist/index.cjs +3 -3
- package/dist/json-loader.js +1 -1
- package/dist/ndgeoson-loader.js +1 -1
- package/dist/ndjson-loader.js +1 -1
- package/package.json +6 -6
package/dist/dist.min.js
CHANGED
|
@@ -18,8 +18,8 @@ return true;`)}function _h(r){return typeof r!="bigint"?ye(r):`${ye(r)}n`}functi
|
|
|
18
18
|
`:n===F.r?this.textNode+="\r":n===F.t?this.textNode+=" ":n===F.f?this.textNode+="\f":n===F.b?this.textNode+="\b":n===F.u?(a=1,this.unicodeS=""):this.textNode+=String.fromCharCode(n),n=t.charCodeAt(e++),this.position++,s=e-1,n)continue;break}hu.lastIndex=e;let c=hu.exec(t);if(c===null){e=t.length+1,this.textNode+=t.substring(s,e-1),this.position+=e-1-s;break}if(e=c.index+1,n=t.charCodeAt(c.index),!n){this.textNode+=t.substring(s,e-1),this.position+=e-1-s;break}}this.slashed=o,this.unicodeI=a;continue;case b.TRUE:n===F.r?this.state=b.TRUE2:this._error(`Invalid true started with t${n}`);continue;case b.TRUE2:n===F.u?this.state=b.TRUE3:this._error(`Invalid true started with tr${n}`);continue;case b.TRUE3:n===F.e?(this.emit("onvalue",!0),this.state=this.stack.pop()||b.VALUE):this._error(`Invalid true started with tru${n}`);continue;case b.FALSE:n===F.a?this.state=b.FALSE2:this._error(`Invalid false started with f${n}`);continue;case b.FALSE2:n===F.l?this.state=b.FALSE3:this._error(`Invalid false started with fa${n}`);continue;case b.FALSE3:n===F.s?this.state=b.FALSE4:this._error(`Invalid false started with fal${n}`);continue;case b.FALSE4:n===F.e?(this.emit("onvalue",!1),this.state=this.stack.pop()||b.VALUE):this._error(`Invalid false started with fals${n}`);continue;case b.NULL:n===F.u?this.state=b.NULL2:this._error(`Invalid null started with n${n}`);continue;case b.NULL2:n===F.l?this.state=b.NULL3:this._error(`Invalid null started with nu${n}`);continue;case b.NULL3:n===F.l?(this.emit("onvalue",null),this.state=this.stack.pop()||b.VALUE):this._error(`Invalid null started with nul${n}`);continue;case b.NUMBER_DECIMAL_POINT:n===F.period?(this.numberNode+=".",this.state=b.NUMBER_DIGIT):this._error("Leading zero not followed by .");continue;case b.NUMBER_DIGIT:F._0<=n&&n<=F._9?this.numberNode+=String.fromCharCode(n):n===F.period?(this.numberNode.indexOf(".")!==-1&&this._error("Invalid number has two dots"),this.numberNode+="."):n===F.e||n===F.E?((this.numberNode.indexOf("e")!==-1||this.numberNode.indexOf("E")!==-1)&&this._error("Invalid number has two exponential"),this.numberNode+="e"):n===F.plus||n===F.minus?(i===F.e||i===F.E||this._error("Invalid symbol in number"),this.numberNode+=String.fromCharCode(n)):(this._closeNumber(),e--,this.state=this.stack.pop()||b.VALUE);continue;default:this._error(`Unknown state: ${this.state}`)}return this.position>=this.bufferCheckPosition&&zd(this),this.emit("onchunkparsed"),this}_closeValue(t="onvalue"){this.textNode!==void 0&&this.emit(t,this.textNode),this.textNode=void 0}_closeNumber(){this.numberNode&&this.emit("onvalue",parseFloat(this.numberNode)),this.numberNode=""}_error(t=""){this._closeValue(),t+=`
|
|
19
19
|
Line: ${this.line}
|
|
20
20
|
Column: ${this.column}
|
|
21
|
-
Char: ${this.c}`;let e=new Error(t);this.error=e,this.emit("onerror",e)}};function Di(r){return r===F.carriageReturn||r===F.lineFeed||r===F.space||r===F.tab}function zd(r){let t=Math.max(Ua,10),e=0;for(let n of["textNode","numberNode"]){let i=r[n]===void 0?0:r[n].length;if(i>t)switch(n){case"text":break;default:r._error(`Max buffer length exceeded: ${n}`)}e=Math.max(e,i)}r.bufferCheckPosition=Ua-e+r.position}var Lt=class{path;constructor(t=null){this.path=Wd(t)}clone(){return new Lt(this)}toString(){return qd(this.path)}push(t){this.path.push(t)}pop(){return this.path.pop()}set(t){this.path[this.path.length-1]=t}equals(t){if(!this||!t||this.path.length!==t.path.length)return!1;for(let e=0;e<this.path.length;++e)if(this.path[e]!==t.path[e])return!1;return!0}setFieldAtPath(t,e){let n=[...this.path];n.shift();let i=n.pop();for(let s of n)t=t[s];t[i]=e}getFieldAtPath(t){let e=[...this.path];e.shift();let n=e.pop();for(let i of e)t=t[i];return t[n]}};function Wd(r){return r instanceof Lt?[...r.path]:Array.isArray(r)?["$"].concat(r):typeof r=="string"?Jd(r):["$"]}function Jd(r){let t=r.trim();if(!t.startsWith("$"))throw new Error("JSONPath must start with $");let e=["$"],n=1,i=!1;for(;n<t.length;){let s=t[n];if(s==="."){if(i)throw new Error("JSONPath cannot select fields after array element selectors");if(n+=1,t[n]===".")throw new Error("JSONPath descendant selectors (..) are not supported");let{value:o,nextIndex:a,isWildcard:c}=Gd(t,n);if(c){if(a<t.length)throw new Error("JSONPath wildcard selectors must terminate the path");i=!0,n=a;continue}e.push(o),n=a;continue}if(s==="["){let o=$d(t,n);if(o.type==="property"){if(i)throw new Error("JSONPath cannot select fields after array element selectors");e.push(o.value)}else i=!0;n=o.nextIndex;continue}if(s==="@")throw new Error("JSONPath current node selector (@) is not supported");if(s.trim()===""){n+=1;continue}throw new Error(`Unexpected character "${s}" in JSONPath`)}return e}function Gd(r,t){if(t>=r.length)throw new Error("JSONPath cannot end with a period");if(r[t]==="*")return{value:"*",nextIndex:t+1,isWildcard:!0};let e=r[t];if(e==="@")throw new Error("JSONPath current node selector (@) is not supported");if(!Kd(e))throw new Error("JSONPath property names after period must start with a letter, $ or _");let n=t+1;for(;n<r.length&&Zd(r[n]);)n++;if(n===t)throw new Error("JSONPath is missing a property name after period");return{value:r.slice(t,n),nextIndex:n,isWildcard:!1}}function $d(r,t){let e=t+1;if(e>=r.length)throw new Error("JSONPath has unterminated bracket");let n=r[e];if(n==="'"||n==='"'){let{value:a,nextIndex:c}=Yd(r,e);return{type:"property",value:a,nextIndex:c}}let i=r.indexOf("]",e);if(i===-1)throw new Error("JSONPath has unterminated bracket");let s=r.slice(e,i).trim(),o=Hd(s);if(o)throw new Error(o);if(s==="*")return{type:"array-selector",nextIndex:i+1};if(/^\d+$/.test(s))throw new Error("JSONPath array index selectors are not supported");if(/^\d*\s*:\s*\d*(\s*:\s*\d*)?$/.test(s))return{type:"array-selector",nextIndex:i+1};throw new Error(`Unsupported bracket selector "[${s}]" in JSONPath`)}function Hd(r){return r.length?r.startsWith("(")?"JSONPath script selectors are not supported":r.startsWith("?")?"JSONPath filter selectors are not supported":r.includes(",")?"JSONPath union selectors are not supported":r.startsWith("@")||r.includes("@.")?"JSONPath current node selector (@) is not supported":null:"JSONPath bracket selectors cannot be empty"}function Yd(r,t){let e=r[t],n=t+1,i="",s=!1;for(;n<r.length;){let o=r[n];if(o==="\\"){if(n+=1,n>=r.length)break;i+=r[n],n+=1;continue}if(o===e){s=!0,n+=1;break}i+=o,n+=1}if(!s)throw new Error("JSONPath string in bracket property selector is unterminated");for(;n<r.length&&r[n].trim()==="";)n+=1;if(r[n]!=="]")throw new Error("JSONPath property selectors must end with ]");if(!i.length)throw new Error("JSONPath property selectors cannot be empty");return{value:i,nextIndex:n+1}}function Zd(r){return/[a-zA-Z0-9$_]/.test(r)}function Kd(r){return/[a-zA-Z_$]/.test(r)}function Xd(r){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(r)}function qd(r){return r.map((t,e)=>e===0?t:t==="*"?".*":Xd(t)?`.${t}`:`['${t.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}']`).join("")}var Ti=class{parser;result=void 0;previousStates=[];currentState=Object.freeze({container:[],key:null});jsonpath=new Lt;constructor(t){this.reset(),this.parser=new tn({onready:()=>{this.jsonpath=new Lt,this.previousStates.length=0,this.currentState.container.length=0},onopenobject:e=>{this._openObject({}),typeof e<"u"&&this.parser.emit("onkey",e)},onkey:e=>{this.jsonpath.set(e),this.currentState.key=e},oncloseobject:()=>{this._closeObject()},onopenarray:()=>{this._openArray()},onclosearray:()=>{this._closeArray()},onvalue:e=>{this._pushOrSet(e)},onerror:e=>{throw e},onend:()=>{this.result=this.currentState.container.pop()},...t})}reset(){this.result=void 0,this.previousStates=[],this.currentState=Object.freeze({container:[],key:null}),this.jsonpath=new Lt}write(t){this.parser.write(t)}close(){this.parser.close()}_pushOrSet(t){let{container:e,key:n}=this.currentState;n!==null?(e[n]=t,this.currentState.key=null):e.push(t)}_openArray(t=[]){this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!0,key:null}}_closeArray(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}_openObject(t={}){this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!1,key:null}}_closeObject(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}};var Fi=class extends Ti{jsonPaths;streamingJsonPath=null;streamingArray=null;topLevelObject=null;constructor(t={}){super({onopenarray:()=>{if(!this.streamingArray&&this._matchJSONPath()){this.streamingJsonPath=this.getJsonPath().clone(),this.streamingArray=[],this._openArray(this.streamingArray);return}this._openArray()},onopenobject:n=>{this.topLevelObject?this._openObject({}):(this.topLevelObject={},this._openObject(this.topLevelObject)),typeof n<"u"&&this.parser.emit("onkey",n)}});let e=t.jsonpaths||[];this.jsonPaths=e.map(n=>new Lt(n))}write(t){super.write(t);let e=[];return this.streamingArray&&(e=[...this.streamingArray],this.streamingArray.length=0),e}getPartialResult(){return this.topLevelObject}getStreamingJsonPath(){return this.streamingJsonPath}getStreamingJsonPathAsString(){return this.streamingJsonPath&&this.streamingJsonPath.toString()}getJsonPath(){return this.jsonpath}_matchJSONPath(){let t=this.getJsonPath();if(this.jsonPaths.length===0)return!0;for(let e of this.jsonPaths)if(e.equals(t))return!0;return!1}};async function*yo(r,t){let e=Ai(Oi(r)),n=Boolean(t?.core?.metadata||t?.metadata),{jsonpaths:i}=t.json||{},s=!0,o=null,a=new wr(o,t?.core),c=new Fi({jsonpaths:i});for await(let h of e){let d=c.write(h),p=d.length>0&&c.getStreamingJsonPathAsString();d.length>0&&s&&(n&&(yield{shape:t?.json?.shape||"array-row-table",batchType:"partial-result",data:[],length:0,bytesUsed:0,container:c.getPartialResult(),jsonpath:p}),s=!1);for(let z of d){a.addRow(z);let it=a.getFullBatch({jsonpath:p});it&&(yield it)}a.chunkComplete(h);let y=a.getFullBatch({jsonpath:p});y&&(yield y)}let l=c.getStreamingJsonPathAsString(),u=a.getFinalBatch({jsonpath:l});u&&(yield u),n&&(yield{shape:"json",batchType:"final-result",container:c.getPartialResult(),jsonpath:c.getStreamingJsonPathAsString(),data:[],length:0})}function pu(r,t){if(Ta(r.batchType==="final-result"),r.jsonpath==="$")return t;if(r.jsonpath&&r.jsonpath.length>1){let e=r.container;return new Lt(r.jsonpath).setFieldAtPath(e,t),e}return r.container}var Qd="4.4.0-alpha.
|
|
22
|
-
`).map((n,i)=>{try{return JSON.parse(n)}catch{throw new Error(`NDJSONLoader: failed to parse JSON on line ${i+1}`)}});return Bi(e)}async function*yu(r,t){let e=Ai(Oi(r)),n=Fa(e),i=Na(n),s=null,o="row-table",a=new wr(s,{...t?.core||t,shape:o});for await(let{counter:l,line:u}of i)try{let h=JSON.parse(u);a.addRow(h),a.chunkComplete(u);let d=a.getFullBatch();d&&(yield d)}catch{throw new Error(`NDJSONLoader: failed to parse JSON on line ${l}`)}let c=a.getFinalBatch();c&&(yield c)}var rp="4.4.0-alpha.16",gu={dataType:null,batchType:null,name:"NDJSON",id:"ndjson",module:"json",version:rp,extensions:["ndjson","jsonl"],mimeTypes:["application/x-ndjson","application/jsonlines","application/json-seq"],category:"table",text:!0,parse:async r=>Ca(new TextDecoder().decode(r)),parseTextSync:Ca,parseInBatches:yu,options:{}};function Ra(r,t){let e=t?.json?.shape||"object-row-table",n=[],i=Oa(r,e);for(let s of i)n.push(JSON.stringify(s));return`[${n.join(",")}]`}var bu={id:"json",version:"latest",module:"json",name:"JSON",extensions:["json"],mimeTypes:["application/json"],options:{},text:!0,encode:async(r,t)=>new TextEncoder().encode(Ra(r,t)).buffer,encodeTextSync:(r,t)=>Ra(r,t)};function _u(r){let t=0,e=0,n=0,i=0,s=0,o=0,a=0,c=0,l=0,u=new Set;for(let h of r){let d=h.geometry;switch(d.type){case"Point":e++,t++,u.add(d.coordinates.length);break;case"MultiPoint":e++,t+=d.coordinates.length;for(let y of d.coordinates)u.add(y.length);break;case"LineString":s++,n+=d.coordinates.length,i++;for(let y of d.coordinates)u.add(y.length);break;case"MultiLineString":s++;for(let y of d.coordinates){n+=y.length,i++;for(let z of y)u.add(z.length)}break;case"Polygon":l++,a++,c+=d.coordinates.length;let p=d.coordinates.flat();o+=p.length;for(let y of p)u.add(y.length);break;case"MultiPolygon":l++;for(let y of d.coordinates){a++,c+=y.length;let z=y.flat();o+=z.length;for(let it of z)u.add(it.length)}break;default:throw new Error(`Unsupported geometry type: ${d.type}`)}}return{coordLength:u.size>0?Math.max(...u):2,pointPositionsCount:t,pointFeaturesCount:e,linePositionsCount:n,linePathsCount:i,lineFeaturesCount:s,polygonPositionsCount:o,polygonObjectsCount:a,polygonRingsCount:c,polygonFeaturesCount:l}}var Ni={x:0,y:1,z:2};function Un(r,t={}){let{start:e=0,end:n=r.length,plane:i="xy"}=t,s=t.size||2,o=0,a=Ni[i[0]],c=Ni[i[1]];for(let l=e,u=n-s;l<n;l+=s)o+=(r[l+a]-r[u+a])*(r[l+c]+r[u+c]),u=l;return o/2}function ja(r,t,e=2,n,i="xy"){let s=t&&t.length,o=s?t[0]*e:r.length,a=vu(r,0,o,e,!0,n&&n[0],i),c=[];if(!a||a.next===a.prev)return c;let l,u,h,d,p,y,z;if(s&&(a=lp(r,t,a,e,n,i)),r.length>80*e){d=u=r[0],p=h=r[1];for(let it=e;it<o;it+=e)y=r[it],z=r[it+1],y<d&&(d=y),z<p&&(p=z),y>u&&(u=y),z>h&&(h=z);l=Math.max(u-d,h-p),l=l!==0?32767/l:0}return Li(a,c,e,d,p,l,0),c}function vu(r,t,e,n,i,s,o){let a,c;s===void 0&&(s=Un(r,{start:t,end:e,size:n,plane:o}));let l=Ni[o[0]],u=Ni[o[1]];if(i===s<0)for(a=t;a<e;a+=n)c=wu(a,r[a+l],r[a+u],c);else for(a=e-n;a>=t;a-=n)c=wu(a,r[a+l],r[a+u],c);return c&&wo(c,c.next)&&(Ei(c),c=c.next),c}function en(r,t){if(!r)return r;t||(t=r);let e=r,n;do if(n=!1,!e.steiner&&(wo(e,e.next)||at(e.prev,e,e.next)===0)){if(Ei(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function Li(r,t,e,n,i,s,o){if(!r)return;!o&&s&&pp(r,n,i,s);let a=r,c,l;for(;r.prev!==r.next;){if(c=r.prev,l=r.next,s?op(r,n,i,s):sp(r)){t.push(c.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Ei(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=ap(en(r),t,e),Li(r,t,e,n,i,s,2)):o===2&&cp(r,t,e,n,i,s):Li(en(r),t,e,n,i,s,1);break}}}function sp(r){let t=r.prev,e=r,n=r.next;if(at(t,e,n)>=0)return!1;let i=t.x,s=e.x,o=n.x,a=t.y,c=e.y,l=n.y,u=i<s?i<o?i:o:s<o?s:o,h=a<c?a<l?a:l:c<l?c:l,d=i>s?i>o?i:o:s>o?s:o,p=a>c?a>l?a:l:c>l?c:l,y=n.next;for(;y!==t;){if(y.x>=u&&y.x<=d&&y.y>=h&&y.y<=p&&Cn(i,a,s,c,o,l,y.x,y.y)&&at(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function op(r,t,e,n){let i=r.prev,s=r,o=r.next;if(at(i,s,o)>=0)return!1;let a=i.x,c=s.x,l=o.x,u=i.y,h=s.y,d=o.y,p=a<c?a<l?a:l:c<l?c:l,y=u<h?u<d?u:d:h<d?h:d,z=a>c?a>l?a:l:c>l?c:l,it=u>h?u>d?u:d:h>d?h:d,Mt=Pa(p,y,t,e,n),cr=Pa(z,it,t,e,n),W=r.prevZ,k=r.nextZ;for(;W&&W.z>=Mt&&k&&k.z<=cr;){if(W.x>=p&&W.x<=z&&W.y>=y&&W.y<=it&&W!==i&&W!==o&&Cn(a,u,c,h,l,d,W.x,W.y)&&at(W.prev,W,W.next)>=0||(W=W.prevZ,k.x>=p&&k.x<=z&&k.y>=y&&k.y<=it&&k!==i&&k!==o&&Cn(a,u,c,h,l,d,k.x,k.y)&&at(k.prev,k,k.next)>=0))return!1;k=k.nextZ}for(;W&&W.z>=Mt;){if(W.x>=p&&W.x<=z&&W.y>=y&&W.y<=it&&W!==i&&W!==o&&Cn(a,u,c,h,l,d,W.x,W.y)&&at(W.prev,W,W.next)>=0)return!1;W=W.prevZ}for(;k&&k.z<=cr;){if(k.x>=p&&k.x<=z&&k.y>=y&&k.y<=it&&k!==i&&k!==o&&Cn(a,u,c,h,l,d,k.x,k.y)&&at(k.prev,k,k.next)>=0)return!1;k=k.nextZ}return!0}function ap(r,t,e){let n=r;do{let i=n.prev,s=n.next.next;!wo(i,s)&&Iu(i,n,n.next,s)&&Mi(i,s)&&Mi(s,i)&&(t.push(i.i/e|0),t.push(n.i/e|0),t.push(s.i/e|0),Ei(n),Ei(n.next),n=r=s),n=n.next}while(n!==r);return en(n)}function cp(r,t,e,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&gp(o,a)){let c=xu(o,a);o=en(o,o.next),c=en(c,c.next),Li(o,t,e,n,i,s,0),Li(c,t,e,n,i,s,0);return}a=a.next}o=o.next}while(o!==r)}function lp(r,t,e,n,i,s){let o=[],a,c,l,u,h;for(a=0,c=t.length;a<c;a++)l=t[a]*n,u=a<c-1?t[a+1]*n:r.length,h=vu(r,l,u,n,!1,i&&i[a+1],s),h===h.next&&(h.steiner=!0),o.push(yp(h));for(o.sort(up),a=0;a<o.length;a++)e=fp(o[a],e);return e}function up(r,t){return r.x-t.x}function fp(r,t){let e=hp(r,t);if(!e)return t;let n=xu(e,r);return en(n,n.next),en(e,e.next)}function hp(r,t){let e=t,n=r.x,i=r.y,s=-1/0,o;do{if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){let d=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=n&&d>s&&(s=d,o=e.x<e.next.x?e:e.next,d===n))return o}e=e.next}while(e!==t);if(!o)return null;let a=o,c=o.x,l=o.y,u=1/0,h;e=o;do n>=e.x&&e.x>=c&&n!==e.x&&Cn(i<l?n:s,i,c,l,i<l?s:n,i,e.x,e.y)&&(h=Math.abs(i-e.y)/(n-e.x),Mi(e,r)&&(h<u||h===u&&(e.x>o.x||e.x===o.x&&dp(o,e)))&&(o=e,u=h)),e=e.next;while(e!==a);return o}function dp(r,t){return at(r.prev,r,t.prev)<0&&at(t.next,r,r.next)<0}function pp(r,t,e,n){let i=r;do i.z===0&&(i.z=Pa(i.x,i.y,t,e,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,mp(i)}function mp(r){let t,e,n=1,i,s,o,a,c,l;do{for(s=r,r=null,l=null,i=0;s;){for(i++,a=s,o=0,e=0;e<n&&(o++,a=a.nextZ,!!a);e++);for(c=n;o>0||c>0&&a;)o!==0&&(c===0||!a||s.z<=a.z)?(t=s,s=s.nextZ,o--):(t=a,a=a.nextZ,c--),l?l.nextZ=t:r=t,t.prevZ=l,l=t;s=a}l.nextZ=null,n*=2}while(i>1);return r}function Pa(r,t,e,n,i){return r=(r-e)*i|0,t=(t-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function yp(r){let t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Cn(r,t,e,n,i,s,o,a){return(i-o)*(t-a)>=(r-o)*(s-a)&&(r-o)*(n-a)>=(e-o)*(t-a)&&(e-o)*(s-a)>=(i-o)*(n-a)}function gp(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!bp(r,t)&&(Mi(r,t)&&Mi(t,r)&&_p(r,t)&&(at(r.prev,r,t.prev)||at(r,t.prev,t))||wo(r,t)&&at(r.prev,r,r.next)>0&&at(t.prev,t,t.next)>0)}function at(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function wo(r,t){return r.x===t.x&&r.y===t.y}function Iu(r,t,e,n){let i=_o(at(r,t,e)),s=_o(at(r,t,n)),o=_o(at(e,n,r)),a=_o(at(e,n,t));return!!(i!==s&&o!==a||i===0&&bo(r,e,t)||s===0&&bo(r,n,t)||o===0&&bo(e,r,n)||a===0&&bo(e,t,n))}function bo(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function _o(r){return r>0?1:r<0?-1:0}function bp(r,t){let e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Iu(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Mi(r,t){return at(r.prev,r,r.next)<0?at(r,t,r.next)>=0&&at(r,r.prev,t)>=0:at(r,t,r.prev)<0||at(r,r.next,t)<0}function _p(r,t){let e=r,n=!1,i=(r.x+t.x)/2,s=(r.y+t.y)/2;do e.y>s!=e.next.y>s&&e.next.y!==e.y&&i<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==r);return n}function xu(r,t){let e=new Ui(r.i,r.x,r.y),n=new Ui(t.i,t.x,t.y),i=r.next,s=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,n.next=e,e.prev=n,s.next=n,n.prev=s,n}function wu(r,t,e,n){let i=new Ui(r,t,e);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Ei(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}var Ui=class{constructor(t,e,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=e,this.y=n}};function Au(r,t,e){let n=Sp(r),i=Object.keys(n).filter(s=>n[s]!==Array);return Bp(r,{propArrayTypes:n,...t},{numericPropKeys:e&&e.numericPropKeys||i,PositionDataType:e?e.PositionDataType:Float32Array,triangulate:e?e.triangulate:!0})}function Sp(r){let t={};for(let e of r)if(e.properties)for(let n in e.properties){let i=e.properties[n];t[n]=Np(i,t[n])}return t}function Bp(r,t,e){let{pointPositionsCount:n,pointFeaturesCount:i,linePositionsCount:s,linePathsCount:o,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:l,polygonRingsCount:u,polygonFeaturesCount:h,propArrayTypes:d,coordLength:p}=t,{numericPropKeys:y=[],PositionDataType:z=Float32Array,triangulate:it=!0}=e,Mt=r[0]&&"id"in r[0],cr=r.length>65535?Uint32Array:Uint16Array,W={type:"Point",positions:new z(n*p),globalFeatureIds:new cr(n),featureIds:i>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},k={type:"LineString",pathIndices:s>65535?new Uint32Array(o+1):new Uint16Array(o+1),positions:new z(s*p),globalFeatureIds:new cr(s),featureIds:a>65535?new Uint32Array(s):new Uint16Array(s),numericProps:{},properties:[],fields:[]},lr={type:"Polygon",polygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),primitivePolygonIndices:c>65535?new Uint32Array(u+1):new Uint16Array(u+1),positions:new z(c*p),globalFeatureIds:new cr(c),featureIds:h>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};it&&(lr.triangles=[]);for(let ur of[W,k,lr])for(let Ir of y){let fr=d[Ir];ur.numericProps[Ir]=new fr(ur.positions.length/p)}k.pathIndices[o]=s,lr.polygonIndices[l]=c,lr.primitivePolygonIndices[u]=c;let vr={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let ur of r){let Ir=ur.geometry,fr=ur.properties||{};switch(Ir.type){case"Point":Ap(Ir,W,vr,p,fr),W.properties.push(ka(fr,y)),Mt&&W.fields.push({id:ur.id}),vr.pointFeature++;break;case"LineString":Op(Ir,k,vr,p,fr),k.properties.push(ka(fr,y)),Mt&&k.fields.push({id:ur.id}),vr.lineFeature++;break;case"Polygon":Dp(Ir,lr,vr,p,fr),lr.properties.push(ka(fr,y)),Mt&&lr.fields.push({id:ur.id}),vr.polygonFeature++;break;default:throw new Error("Invalid geometry type")}vr.feature++}return Fp(W,k,lr,p)}function Ap(r,t,e,n,i){t.positions.set(r.data,e.pointPosition*n);let s=r.data.length/n;za(t,i,e.pointPosition,s),t.globalFeatureIds.fill(e.feature,e.pointPosition,e.pointPosition+s),t.featureIds.fill(e.pointFeature,e.pointPosition,e.pointPosition+s),e.pointPosition+=s}function Op(r,t,e,n,i){t.positions.set(r.data,e.linePosition*n);let s=r.data.length/n;za(t,i,e.linePosition,s),t.globalFeatureIds.fill(e.feature,e.linePosition,e.linePosition+s),t.featureIds.fill(e.lineFeature,e.linePosition,e.linePosition+s);for(let o=0,a=r.indices.length;o<a;++o){let c=r.indices[o],l=o===a-1?r.data.length:r.indices[o+1];t.pathIndices[e.linePath++]=e.linePosition,e.linePosition+=(l-c)/n}}function Dp(r,t,e,n,i){t.positions.set(r.data,e.polygonPosition*n);let s=r.data.length/n;za(t,i,e.polygonPosition,s),t.globalFeatureIds.fill(e.feature,e.polygonPosition,e.polygonPosition+s),t.featureIds.fill(e.polygonFeature,e.polygonPosition,e.polygonPosition+s);for(let o=0,a=r.indices.length;o<a;++o){let c=e.polygonPosition;t.polygonIndices[e.polygonObject++]=c;let l=r.areas[o],u=r.indices[o],h=r.indices[o+1];for(let p=0,y=u.length;p<y;++p){let z=u[p],it=p===y-1?h===void 0?r.data.length:h[0]:u[p+1];t.primitivePolygonIndices[e.polygonRing++]=e.polygonPosition,e.polygonPosition+=(it-z)/n}let d=e.polygonPosition;Tp(t,l,u,{startPosition:c,endPosition:d,coordLength:n})}}function Tp(r,t,e,{startPosition:n,endPosition:i,coordLength:s}){if(!r.triangles)return;let o=n*s,a=i*s,c=r.positions.subarray(o,a),l=e[0],u=e.slice(1).map(d=>(d-l)/s),h=ja(c,u,s,t);for(let d=0,p=h.length;d<p;++d)r.triangles.push(n+h[d])}function Va(r,t){let e={};for(let n in r)e[n]={value:r[n],size:t};return e}function Fp(r,t,e,n){let i={shape:"binary-feature-collection",points:{...r,positions:{value:r.positions,size:n},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:Va(r.numericProps,1)},lines:{...t,positions:{value:t.positions,size:n},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Va(t.numericProps,1)},polygons:{...e,positions:{value:e.positions,size:n},polygonIndices:{value:e.polygonIndices,size:1},primitivePolygonIndices:{value:e.primitivePolygonIndices,size:1},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Va(e.numericProps,1)}};return i.polygons&&e.triangles&&(i.polygons.triangles={value:new Uint32Array(e.triangles),size:1}),i}function za(r,t,e,n){for(let i in r.numericProps)if(i in t){let s=t[i];r.numericProps[i].fill(s,e,e+n)}}function ka(r,t){let e={};for(let n in r)t.includes(n)||(e[n]=r[n]);return e}function Np(r,t){return t===Array||!Number.isFinite(r)?Array:t===Float64Array||Math.fround(r)!==r?Float64Array:Float32Array}function Tu(r,t={coordLength:2,fixRingWinding:!0}){return r.map(e=>Lp(e,t))}function Ou(r,t,e,n){e.push(t.length),t.push(...r);for(let i=r.length;i<n.coordLength;i++)t.push(0)}function Wa(r,t,e,n){e.push(t.length);for(let i of r){t.push(...i);for(let s=i.length;s<n.coordLength;s++)t.push(0)}}function Du(r,t,e,n,i){let s=0,o=[],a=[];for(let c of r){let l=c.map(d=>d.slice(0,2)),u=Un(l.flat()),h=u<0;i.fixRingWinding&&(s===0&&!h||s>0&&h)&&(c.reverse(),u=-u),o.push(u),Wa(c,t,a,i),s++}s>0&&(n.push(o),e.push(a))}function Lp(r,t){let{geometry:e}=r;if(e.type==="GeometryCollection")throw new Error("GeometryCollection type not supported");let n=[],i=[],s,o;switch(e.type){case"Point":o="Point",Ou(e.coordinates,n,i,t);break;case"MultiPoint":o="Point",e.coordinates.map(a=>Ou(a,n,i,t));break;case"LineString":o="LineString",Wa(e.coordinates,n,i,t);break;case"MultiLineString":o="LineString",e.coordinates.map(a=>Wa(a,n,i,t));break;case"Polygon":o="Polygon",s=[],Du(e.coordinates,n,i,s,t);break;case"MultiPolygon":o="Polygon",s=[],e.coordinates.map(a=>Du(a,n,i,s,t));break;default:throw new Error(`Unknown type: ${o}`)}return{...r,geometry:{type:o,indices:i,data:n,areas:s}}}function Ci(r,t={fixRingWinding:!0,triangulate:!0}){let e=_u(r),n=e.coordLength,{fixRingWinding:i}=t,s=Tu(r,{coordLength:n,fixRingWinding:i});return Au(s,e,{numericPropKeys:t.numericPropKeys,PositionDataType:t.PositionDataType||Float32Array,triangulate:t.triangulate})}var Mp="4.4.0-alpha.16",Ja={dataType:null,batchType:null,name:"GeoJSON",id:"geojson",module:"geojson",version:Mp,worker:!0,extensions:["geojson"],mimeTypes:["application/geo+json"],category:"geometry",text:!0,options:{geojson:{shape:"geojson-table"},json:{shape:"object-row-table",jsonpaths:["$","$.features"]},gis:{format:"geojson"}}},rn={...Ja,parse:Ep,parseTextSync:Fu,parseInBatches:Up};async function Ep(r,t){return Fu(new TextDecoder().decode(r),t)}function Fu(r,t){t={...rn.options,...t},t.geojson={...rn.options.geojson,...t.geojson},t.gis=t.gis||{};let e;try{e=JSON.parse(r)}catch{e={}}let n={shape:"geojson-table",type:"FeatureCollection",features:e?.features||[]};switch(t.gis.format){case"binary":return Ci(n.features);default:return n}}function Up(r,t){t={...rn.options,...t},t.json={...rn.options.json,...t.json},t.geojson={...rn.options.geojson,...t.geojson};let e=yo(r,t);switch(t.gis.format){case"binary":return Cp(e);default:return e}}async function*Cp(r){for await(let t of r)t.data=Ci(t.data),yield t}function Nu(r){let t=r.schema?.fields.findIndex(e=>e.name==="geometry")??-1;if(t>-1)return t;if(_r(r)>0){let e=fo(r,0);for(let n=0;n<lo(r);n++){let i=e?.[n];if(i&&typeof i=="object")return n}}throw new Error("Failed to detect geometry column")}function Lu(r,t,e=[]){let n={};for(let i=0;i<lo(r);++i){let s=r.schema?.fields[i].name;s&&!e.includes(i)&&(n[s]=t[s])}return n}function Mu(r,t,e,n){let i=uo(r,t);if(!i)return;let s=Rp(r,i,e),o=JSON.stringify(s);n.push(o)}function Rp(r,t,e){let n=Lu(r,t,[e]),i=r.schema?.fields[e].name,s=i&&t[i];if(!s)return{type:"Feature",geometry:null,properties:n};if(typeof s=="string")try{s=JSON.parse(s)}catch{throw new Error("Invalid string geometry")}if(typeof s!="object"||typeof s?.type!="string")throw new Error("invalid geometry column value");return s?.type==="Feature"?{...s,properties:n}:{type:"Feature",geometry:s,properties:n}}var vo=class{chunkSize;strings=[];totalLength=0;textEncoder=new TextEncoder;constructor(t){this.chunkSize=t}push(...t){for(let e of t)this.strings.push(e),this.totalLength+=e.length}isFull(){return this.totalLength>=this.chunkSize}getArrayBufferBatch(){return Ea(this.textEncoder.encode(this.getStringBatch()).buffer)}getStringBatch(){let t=this.strings.join("");return this.strings=[],this.totalLength=0,t}};async function*Ga(r,t={}){let e={geojson:{},chunkSize:1e4,...t},n=new vo(e.chunkSize);e.geojson.featureArray||n.push(`{
|
|
21
|
+
Char: ${this.c}`;let e=new Error(t);this.error=e,this.emit("onerror",e)}};function Di(r){return r===F.carriageReturn||r===F.lineFeed||r===F.space||r===F.tab}function zd(r){let t=Math.max(Ua,10),e=0;for(let n of["textNode","numberNode"]){let i=r[n]===void 0?0:r[n].length;if(i>t)switch(n){case"text":break;default:r._error(`Max buffer length exceeded: ${n}`)}e=Math.max(e,i)}r.bufferCheckPosition=Ua-e+r.position}var Lt=class{path;constructor(t=null){this.path=Wd(t)}clone(){return new Lt(this)}toString(){return qd(this.path)}push(t){this.path.push(t)}pop(){return this.path.pop()}set(t){this.path[this.path.length-1]=t}equals(t){if(!this||!t||this.path.length!==t.path.length)return!1;for(let e=0;e<this.path.length;++e)if(this.path[e]!==t.path[e])return!1;return!0}setFieldAtPath(t,e){let n=[...this.path];n.shift();let i=n.pop();for(let s of n)t=t[s];t[i]=e}getFieldAtPath(t){let e=[...this.path];e.shift();let n=e.pop();for(let i of e)t=t[i];return t[n]}};function Wd(r){return r instanceof Lt?[...r.path]:Array.isArray(r)?["$"].concat(r):typeof r=="string"?Jd(r):["$"]}function Jd(r){let t=r.trim();if(!t.startsWith("$"))throw new Error("JSONPath must start with $");let e=["$"],n=1,i=!1;for(;n<t.length;){let s=t[n];if(s==="."){if(i)throw new Error("JSONPath cannot select fields after array element selectors");if(n+=1,t[n]===".")throw new Error("JSONPath descendant selectors (..) are not supported");let{value:o,nextIndex:a,isWildcard:c}=Gd(t,n);if(c){if(a<t.length)throw new Error("JSONPath wildcard selectors must terminate the path");i=!0,n=a;continue}e.push(o),n=a;continue}if(s==="["){let o=$d(t,n);if(o.type==="property"){if(i)throw new Error("JSONPath cannot select fields after array element selectors");e.push(o.value)}else i=!0;n=o.nextIndex;continue}if(s==="@")throw new Error("JSONPath current node selector (@) is not supported");if(s.trim()===""){n+=1;continue}throw new Error(`Unexpected character "${s}" in JSONPath`)}return e}function Gd(r,t){if(t>=r.length)throw new Error("JSONPath cannot end with a period");if(r[t]==="*")return{value:"*",nextIndex:t+1,isWildcard:!0};let e=r[t];if(e==="@")throw new Error("JSONPath current node selector (@) is not supported");if(!Kd(e))throw new Error("JSONPath property names after period must start with a letter, $ or _");let n=t+1;for(;n<r.length&&Zd(r[n]);)n++;if(n===t)throw new Error("JSONPath is missing a property name after period");return{value:r.slice(t,n),nextIndex:n,isWildcard:!1}}function $d(r,t){let e=t+1;if(e>=r.length)throw new Error("JSONPath has unterminated bracket");let n=r[e];if(n==="'"||n==='"'){let{value:a,nextIndex:c}=Yd(r,e);return{type:"property",value:a,nextIndex:c}}let i=r.indexOf("]",e);if(i===-1)throw new Error("JSONPath has unterminated bracket");let s=r.slice(e,i).trim(),o=Hd(s);if(o)throw new Error(o);if(s==="*")return{type:"array-selector",nextIndex:i+1};if(/^\d+$/.test(s))throw new Error("JSONPath array index selectors are not supported");if(/^\d*\s*:\s*\d*(\s*:\s*\d*)?$/.test(s))return{type:"array-selector",nextIndex:i+1};throw new Error(`Unsupported bracket selector "[${s}]" in JSONPath`)}function Hd(r){return r.length?r.startsWith("(")?"JSONPath script selectors are not supported":r.startsWith("?")?"JSONPath filter selectors are not supported":r.includes(",")?"JSONPath union selectors are not supported":r.startsWith("@")||r.includes("@.")?"JSONPath current node selector (@) is not supported":null:"JSONPath bracket selectors cannot be empty"}function Yd(r,t){let e=r[t],n=t+1,i="",s=!1;for(;n<r.length;){let o=r[n];if(o==="\\"){if(n+=1,n>=r.length)break;i+=r[n],n+=1;continue}if(o===e){s=!0,n+=1;break}i+=o,n+=1}if(!s)throw new Error("JSONPath string in bracket property selector is unterminated");for(;n<r.length&&r[n].trim()==="";)n+=1;if(r[n]!=="]")throw new Error("JSONPath property selectors must end with ]");if(!i.length)throw new Error("JSONPath property selectors cannot be empty");return{value:i,nextIndex:n+1}}function Zd(r){return/[a-zA-Z0-9$_]/.test(r)}function Kd(r){return/[a-zA-Z_$]/.test(r)}function Xd(r){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(r)}function qd(r){return r.map((t,e)=>e===0?t:t==="*"?".*":Xd(t)?`.${t}`:`['${t.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}']`).join("")}var Ti=class{parser;result=void 0;previousStates=[];currentState=Object.freeze({container:[],key:null});jsonpath=new Lt;constructor(t){this.reset(),this.parser=new tn({onready:()=>{this.jsonpath=new Lt,this.previousStates.length=0,this.currentState.container.length=0},onopenobject:e=>{this._openObject({}),typeof e<"u"&&this.parser.emit("onkey",e)},onkey:e=>{this.jsonpath.set(e),this.currentState.key=e},oncloseobject:()=>{this._closeObject()},onopenarray:()=>{this._openArray()},onclosearray:()=>{this._closeArray()},onvalue:e=>{this._pushOrSet(e)},onerror:e=>{throw e},onend:()=>{this.result=this.currentState.container.pop()},...t})}reset(){this.result=void 0,this.previousStates=[],this.currentState=Object.freeze({container:[],key:null}),this.jsonpath=new Lt}write(t){this.parser.write(t)}close(){this.parser.close()}_pushOrSet(t){let{container:e,key:n}=this.currentState;n!==null?(e[n]=t,this.currentState.key=null):e.push(t)}_openArray(t=[]){this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!0,key:null}}_closeArray(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}_openObject(t={}){this.jsonpath.push(null),this._pushOrSet(t),this.previousStates.push(this.currentState),this.currentState={container:t,isArray:!1,key:null}}_closeObject(){this.jsonpath.pop(),this.currentState=this.previousStates.pop()}};var Fi=class extends Ti{jsonPaths;streamingJsonPath=null;streamingArray=null;topLevelObject=null;constructor(t={}){super({onopenarray:()=>{if(!this.streamingArray&&this._matchJSONPath()){this.streamingJsonPath=this.getJsonPath().clone(),this.streamingArray=[],this._openArray(this.streamingArray);return}this._openArray()},onopenobject:n=>{this.topLevelObject?this._openObject({}):(this.topLevelObject={},this._openObject(this.topLevelObject)),typeof n<"u"&&this.parser.emit("onkey",n)}});let e=t.jsonpaths||[];this.jsonPaths=e.map(n=>new Lt(n))}write(t){super.write(t);let e=[];return this.streamingArray&&(e=[...this.streamingArray],this.streamingArray.length=0),e}getPartialResult(){return this.topLevelObject}getStreamingJsonPath(){return this.streamingJsonPath}getStreamingJsonPathAsString(){return this.streamingJsonPath&&this.streamingJsonPath.toString()}getJsonPath(){return this.jsonpath}_matchJSONPath(){let t=this.getJsonPath();if(this.jsonPaths.length===0)return!0;for(let e of this.jsonPaths)if(e.equals(t))return!0;return!1}};async function*yo(r,t){let e=Ai(Oi(r)),n=Boolean(t?.core?.metadata||t?.metadata),{jsonpaths:i}=t.json||{},s=!0,o=null,a=new wr(o,t?.core),c=new Fi({jsonpaths:i});for await(let h of e){let d=c.write(h),p=d.length>0&&c.getStreamingJsonPathAsString();d.length>0&&s&&(n&&(yield{shape:t?.json?.shape||"array-row-table",batchType:"partial-result",data:[],length:0,bytesUsed:0,container:c.getPartialResult(),jsonpath:p}),s=!1);for(let z of d){a.addRow(z);let it=a.getFullBatch({jsonpath:p});it&&(yield it)}a.chunkComplete(h);let y=a.getFullBatch({jsonpath:p});y&&(yield y)}let l=c.getStreamingJsonPathAsString(),u=a.getFinalBatch({jsonpath:l});u&&(yield u),n&&(yield{shape:"json",batchType:"final-result",container:c.getPartialResult(),jsonpath:c.getStreamingJsonPathAsString(),data:[],length:0})}function pu(r,t){if(Ta(r.batchType==="final-result"),r.jsonpath==="$")return t;if(r.jsonpath&&r.jsonpath.length>1){let e=r.container;return new Lt(r.jsonpath).setFieldAtPath(e,t),e}return r.container}var Qd="4.4.0-alpha.18",go={dataType:null,batchType:null,name:"JSON",id:"json",module:"json",version:Qd,extensions:["json","geojson"],mimeTypes:["application/json"],category:"table",text:!0,options:{json:{shape:void 0,table:!1,jsonpaths:[]}},parse:tp,parseTextSync:mu,parseInBatches:ep};async function tp(r,t){return mu(new TextDecoder().decode(r),t)}function mu(r,t){let e={...t,json:{...go.options.json,...t?.json}};return ou(r,e)}function ep(r,t){let e={...t,json:{...go.options.json,...t?.json}};return yo(r,e)}function Ca(r){let e=r.trim().split(`
|
|
22
|
+
`).map((n,i)=>{try{return JSON.parse(n)}catch{throw new Error(`NDJSONLoader: failed to parse JSON on line ${i+1}`)}});return Bi(e)}async function*yu(r,t){let e=Ai(Oi(r)),n=Fa(e),i=Na(n),s=null,o="row-table",a=new wr(s,{...t?.core||t,shape:o});for await(let{counter:l,line:u}of i)try{let h=JSON.parse(u);a.addRow(h),a.chunkComplete(u);let d=a.getFullBatch();d&&(yield d)}catch{throw new Error(`NDJSONLoader: failed to parse JSON on line ${l}`)}let c=a.getFinalBatch();c&&(yield c)}var rp="4.4.0-alpha.18",gu={dataType:null,batchType:null,name:"NDJSON",id:"ndjson",module:"json",version:rp,extensions:["ndjson","jsonl"],mimeTypes:["application/x-ndjson","application/jsonlines","application/json-seq"],category:"table",text:!0,parse:async r=>Ca(new TextDecoder().decode(r)),parseTextSync:Ca,parseInBatches:yu,options:{}};function Ra(r,t){let e=t?.json?.shape||"object-row-table",n=[],i=Oa(r,e);for(let s of i)n.push(JSON.stringify(s));return`[${n.join(",")}]`}var bu={id:"json",version:"latest",module:"json",name:"JSON",extensions:["json"],mimeTypes:["application/json"],options:{},text:!0,encode:async(r,t)=>new TextEncoder().encode(Ra(r,t)).buffer,encodeTextSync:(r,t)=>Ra(r,t)};function _u(r){let t=0,e=0,n=0,i=0,s=0,o=0,a=0,c=0,l=0,u=new Set;for(let h of r){let d=h.geometry;switch(d.type){case"Point":e++,t++,u.add(d.coordinates.length);break;case"MultiPoint":e++,t+=d.coordinates.length;for(let y of d.coordinates)u.add(y.length);break;case"LineString":s++,n+=d.coordinates.length,i++;for(let y of d.coordinates)u.add(y.length);break;case"MultiLineString":s++;for(let y of d.coordinates){n+=y.length,i++;for(let z of y)u.add(z.length)}break;case"Polygon":l++,a++,c+=d.coordinates.length;let p=d.coordinates.flat();o+=p.length;for(let y of p)u.add(y.length);break;case"MultiPolygon":l++;for(let y of d.coordinates){a++,c+=y.length;let z=y.flat();o+=z.length;for(let it of z)u.add(it.length)}break;default:throw new Error(`Unsupported geometry type: ${d.type}`)}}return{coordLength:u.size>0?Math.max(...u):2,pointPositionsCount:t,pointFeaturesCount:e,linePositionsCount:n,linePathsCount:i,lineFeaturesCount:s,polygonPositionsCount:o,polygonObjectsCount:a,polygonRingsCount:c,polygonFeaturesCount:l}}var Ni={x:0,y:1,z:2};function Un(r,t={}){let{start:e=0,end:n=r.length,plane:i="xy"}=t,s=t.size||2,o=0,a=Ni[i[0]],c=Ni[i[1]];for(let l=e,u=n-s;l<n;l+=s)o+=(r[l+a]-r[u+a])*(r[l+c]+r[u+c]),u=l;return o/2}function ja(r,t,e=2,n,i="xy"){let s=t&&t.length,o=s?t[0]*e:r.length,a=vu(r,0,o,e,!0,n&&n[0],i),c=[];if(!a||a.next===a.prev)return c;let l,u,h,d,p,y,z;if(s&&(a=lp(r,t,a,e,n,i)),r.length>80*e){d=u=r[0],p=h=r[1];for(let it=e;it<o;it+=e)y=r[it],z=r[it+1],y<d&&(d=y),z<p&&(p=z),y>u&&(u=y),z>h&&(h=z);l=Math.max(u-d,h-p),l=l!==0?32767/l:0}return Li(a,c,e,d,p,l,0),c}function vu(r,t,e,n,i,s,o){let a,c;s===void 0&&(s=Un(r,{start:t,end:e,size:n,plane:o}));let l=Ni[o[0]],u=Ni[o[1]];if(i===s<0)for(a=t;a<e;a+=n)c=wu(a,r[a+l],r[a+u],c);else for(a=e-n;a>=t;a-=n)c=wu(a,r[a+l],r[a+u],c);return c&&wo(c,c.next)&&(Ei(c),c=c.next),c}function en(r,t){if(!r)return r;t||(t=r);let e=r,n;do if(n=!1,!e.steiner&&(wo(e,e.next)||at(e.prev,e,e.next)===0)){if(Ei(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function Li(r,t,e,n,i,s,o){if(!r)return;!o&&s&&pp(r,n,i,s);let a=r,c,l;for(;r.prev!==r.next;){if(c=r.prev,l=r.next,s?op(r,n,i,s):sp(r)){t.push(c.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Ei(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=ap(en(r),t,e),Li(r,t,e,n,i,s,2)):o===2&&cp(r,t,e,n,i,s):Li(en(r),t,e,n,i,s,1);break}}}function sp(r){let t=r.prev,e=r,n=r.next;if(at(t,e,n)>=0)return!1;let i=t.x,s=e.x,o=n.x,a=t.y,c=e.y,l=n.y,u=i<s?i<o?i:o:s<o?s:o,h=a<c?a<l?a:l:c<l?c:l,d=i>s?i>o?i:o:s>o?s:o,p=a>c?a>l?a:l:c>l?c:l,y=n.next;for(;y!==t;){if(y.x>=u&&y.x<=d&&y.y>=h&&y.y<=p&&Cn(i,a,s,c,o,l,y.x,y.y)&&at(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function op(r,t,e,n){let i=r.prev,s=r,o=r.next;if(at(i,s,o)>=0)return!1;let a=i.x,c=s.x,l=o.x,u=i.y,h=s.y,d=o.y,p=a<c?a<l?a:l:c<l?c:l,y=u<h?u<d?u:d:h<d?h:d,z=a>c?a>l?a:l:c>l?c:l,it=u>h?u>d?u:d:h>d?h:d,Mt=Pa(p,y,t,e,n),cr=Pa(z,it,t,e,n),W=r.prevZ,k=r.nextZ;for(;W&&W.z>=Mt&&k&&k.z<=cr;){if(W.x>=p&&W.x<=z&&W.y>=y&&W.y<=it&&W!==i&&W!==o&&Cn(a,u,c,h,l,d,W.x,W.y)&&at(W.prev,W,W.next)>=0||(W=W.prevZ,k.x>=p&&k.x<=z&&k.y>=y&&k.y<=it&&k!==i&&k!==o&&Cn(a,u,c,h,l,d,k.x,k.y)&&at(k.prev,k,k.next)>=0))return!1;k=k.nextZ}for(;W&&W.z>=Mt;){if(W.x>=p&&W.x<=z&&W.y>=y&&W.y<=it&&W!==i&&W!==o&&Cn(a,u,c,h,l,d,W.x,W.y)&&at(W.prev,W,W.next)>=0)return!1;W=W.prevZ}for(;k&&k.z<=cr;){if(k.x>=p&&k.x<=z&&k.y>=y&&k.y<=it&&k!==i&&k!==o&&Cn(a,u,c,h,l,d,k.x,k.y)&&at(k.prev,k,k.next)>=0)return!1;k=k.nextZ}return!0}function ap(r,t,e){let n=r;do{let i=n.prev,s=n.next.next;!wo(i,s)&&Iu(i,n,n.next,s)&&Mi(i,s)&&Mi(s,i)&&(t.push(i.i/e|0),t.push(n.i/e|0),t.push(s.i/e|0),Ei(n),Ei(n.next),n=r=s),n=n.next}while(n!==r);return en(n)}function cp(r,t,e,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&gp(o,a)){let c=xu(o,a);o=en(o,o.next),c=en(c,c.next),Li(o,t,e,n,i,s,0),Li(c,t,e,n,i,s,0);return}a=a.next}o=o.next}while(o!==r)}function lp(r,t,e,n,i,s){let o=[],a,c,l,u,h;for(a=0,c=t.length;a<c;a++)l=t[a]*n,u=a<c-1?t[a+1]*n:r.length,h=vu(r,l,u,n,!1,i&&i[a+1],s),h===h.next&&(h.steiner=!0),o.push(yp(h));for(o.sort(up),a=0;a<o.length;a++)e=fp(o[a],e);return e}function up(r,t){return r.x-t.x}function fp(r,t){let e=hp(r,t);if(!e)return t;let n=xu(e,r);return en(n,n.next),en(e,e.next)}function hp(r,t){let e=t,n=r.x,i=r.y,s=-1/0,o;do{if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){let d=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=n&&d>s&&(s=d,o=e.x<e.next.x?e:e.next,d===n))return o}e=e.next}while(e!==t);if(!o)return null;let a=o,c=o.x,l=o.y,u=1/0,h;e=o;do n>=e.x&&e.x>=c&&n!==e.x&&Cn(i<l?n:s,i,c,l,i<l?s:n,i,e.x,e.y)&&(h=Math.abs(i-e.y)/(n-e.x),Mi(e,r)&&(h<u||h===u&&(e.x>o.x||e.x===o.x&&dp(o,e)))&&(o=e,u=h)),e=e.next;while(e!==a);return o}function dp(r,t){return at(r.prev,r,t.prev)<0&&at(t.next,r,r.next)<0}function pp(r,t,e,n){let i=r;do i.z===0&&(i.z=Pa(i.x,i.y,t,e,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,mp(i)}function mp(r){let t,e,n=1,i,s,o,a,c,l;do{for(s=r,r=null,l=null,i=0;s;){for(i++,a=s,o=0,e=0;e<n&&(o++,a=a.nextZ,!!a);e++);for(c=n;o>0||c>0&&a;)o!==0&&(c===0||!a||s.z<=a.z)?(t=s,s=s.nextZ,o--):(t=a,a=a.nextZ,c--),l?l.nextZ=t:r=t,t.prevZ=l,l=t;s=a}l.nextZ=null,n*=2}while(i>1);return r}function Pa(r,t,e,n,i){return r=(r-e)*i|0,t=(t-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function yp(r){let t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Cn(r,t,e,n,i,s,o,a){return(i-o)*(t-a)>=(r-o)*(s-a)&&(r-o)*(n-a)>=(e-o)*(t-a)&&(e-o)*(s-a)>=(i-o)*(n-a)}function gp(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!bp(r,t)&&(Mi(r,t)&&Mi(t,r)&&_p(r,t)&&(at(r.prev,r,t.prev)||at(r,t.prev,t))||wo(r,t)&&at(r.prev,r,r.next)>0&&at(t.prev,t,t.next)>0)}function at(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function wo(r,t){return r.x===t.x&&r.y===t.y}function Iu(r,t,e,n){let i=_o(at(r,t,e)),s=_o(at(r,t,n)),o=_o(at(e,n,r)),a=_o(at(e,n,t));return!!(i!==s&&o!==a||i===0&&bo(r,e,t)||s===0&&bo(r,n,t)||o===0&&bo(e,r,n)||a===0&&bo(e,t,n))}function bo(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function _o(r){return r>0?1:r<0?-1:0}function bp(r,t){let e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Iu(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Mi(r,t){return at(r.prev,r,r.next)<0?at(r,t,r.next)>=0&&at(r,r.prev,t)>=0:at(r,t,r.prev)<0||at(r,r.next,t)<0}function _p(r,t){let e=r,n=!1,i=(r.x+t.x)/2,s=(r.y+t.y)/2;do e.y>s!=e.next.y>s&&e.next.y!==e.y&&i<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==r);return n}function xu(r,t){let e=new Ui(r.i,r.x,r.y),n=new Ui(t.i,t.x,t.y),i=r.next,s=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,n.next=e,e.prev=n,s.next=n,n.prev=s,n}function wu(r,t,e,n){let i=new Ui(r,t,e);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Ei(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}var Ui=class{constructor(t,e,n){this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1,this.i=t,this.x=e,this.y=n}};function Au(r,t,e){let n=Sp(r),i=Object.keys(n).filter(s=>n[s]!==Array);return Bp(r,{propArrayTypes:n,...t},{numericPropKeys:e&&e.numericPropKeys||i,PositionDataType:e?e.PositionDataType:Float32Array,triangulate:e?e.triangulate:!0})}function Sp(r){let t={};for(let e of r)if(e.properties)for(let n in e.properties){let i=e.properties[n];t[n]=Np(i,t[n])}return t}function Bp(r,t,e){let{pointPositionsCount:n,pointFeaturesCount:i,linePositionsCount:s,linePathsCount:o,lineFeaturesCount:a,polygonPositionsCount:c,polygonObjectsCount:l,polygonRingsCount:u,polygonFeaturesCount:h,propArrayTypes:d,coordLength:p}=t,{numericPropKeys:y=[],PositionDataType:z=Float32Array,triangulate:it=!0}=e,Mt=r[0]&&"id"in r[0],cr=r.length>65535?Uint32Array:Uint16Array,W={type:"Point",positions:new z(n*p),globalFeatureIds:new cr(n),featureIds:i>65535?new Uint32Array(n):new Uint16Array(n),numericProps:{},properties:[],fields:[]},k={type:"LineString",pathIndices:s>65535?new Uint32Array(o+1):new Uint16Array(o+1),positions:new z(s*p),globalFeatureIds:new cr(s),featureIds:a>65535?new Uint32Array(s):new Uint16Array(s),numericProps:{},properties:[],fields:[]},lr={type:"Polygon",polygonIndices:c>65535?new Uint32Array(l+1):new Uint16Array(l+1),primitivePolygonIndices:c>65535?new Uint32Array(u+1):new Uint16Array(u+1),positions:new z(c*p),globalFeatureIds:new cr(c),featureIds:h>65535?new Uint32Array(c):new Uint16Array(c),numericProps:{},properties:[],fields:[]};it&&(lr.triangles=[]);for(let ur of[W,k,lr])for(let Ir of y){let fr=d[Ir];ur.numericProps[Ir]=new fr(ur.positions.length/p)}k.pathIndices[o]=s,lr.polygonIndices[l]=c,lr.primitivePolygonIndices[u]=c;let vr={pointPosition:0,pointFeature:0,linePosition:0,linePath:0,lineFeature:0,polygonPosition:0,polygonObject:0,polygonRing:0,polygonFeature:0,feature:0};for(let ur of r){let Ir=ur.geometry,fr=ur.properties||{};switch(Ir.type){case"Point":Ap(Ir,W,vr,p,fr),W.properties.push(ka(fr,y)),Mt&&W.fields.push({id:ur.id}),vr.pointFeature++;break;case"LineString":Op(Ir,k,vr,p,fr),k.properties.push(ka(fr,y)),Mt&&k.fields.push({id:ur.id}),vr.lineFeature++;break;case"Polygon":Dp(Ir,lr,vr,p,fr),lr.properties.push(ka(fr,y)),Mt&&lr.fields.push({id:ur.id}),vr.polygonFeature++;break;default:throw new Error("Invalid geometry type")}vr.feature++}return Fp(W,k,lr,p)}function Ap(r,t,e,n,i){t.positions.set(r.data,e.pointPosition*n);let s=r.data.length/n;za(t,i,e.pointPosition,s),t.globalFeatureIds.fill(e.feature,e.pointPosition,e.pointPosition+s),t.featureIds.fill(e.pointFeature,e.pointPosition,e.pointPosition+s),e.pointPosition+=s}function Op(r,t,e,n,i){t.positions.set(r.data,e.linePosition*n);let s=r.data.length/n;za(t,i,e.linePosition,s),t.globalFeatureIds.fill(e.feature,e.linePosition,e.linePosition+s),t.featureIds.fill(e.lineFeature,e.linePosition,e.linePosition+s);for(let o=0,a=r.indices.length;o<a;++o){let c=r.indices[o],l=o===a-1?r.data.length:r.indices[o+1];t.pathIndices[e.linePath++]=e.linePosition,e.linePosition+=(l-c)/n}}function Dp(r,t,e,n,i){t.positions.set(r.data,e.polygonPosition*n);let s=r.data.length/n;za(t,i,e.polygonPosition,s),t.globalFeatureIds.fill(e.feature,e.polygonPosition,e.polygonPosition+s),t.featureIds.fill(e.polygonFeature,e.polygonPosition,e.polygonPosition+s);for(let o=0,a=r.indices.length;o<a;++o){let c=e.polygonPosition;t.polygonIndices[e.polygonObject++]=c;let l=r.areas[o],u=r.indices[o],h=r.indices[o+1];for(let p=0,y=u.length;p<y;++p){let z=u[p],it=p===y-1?h===void 0?r.data.length:h[0]:u[p+1];t.primitivePolygonIndices[e.polygonRing++]=e.polygonPosition,e.polygonPosition+=(it-z)/n}let d=e.polygonPosition;Tp(t,l,u,{startPosition:c,endPosition:d,coordLength:n})}}function Tp(r,t,e,{startPosition:n,endPosition:i,coordLength:s}){if(!r.triangles)return;let o=n*s,a=i*s,c=r.positions.subarray(o,a),l=e[0],u=e.slice(1).map(d=>(d-l)/s),h=ja(c,u,s,t);for(let d=0,p=h.length;d<p;++d)r.triangles.push(n+h[d])}function Va(r,t){let e={};for(let n in r)e[n]={value:r[n],size:t};return e}function Fp(r,t,e,n){let i={shape:"binary-feature-collection",points:{...r,positions:{value:r.positions,size:n},globalFeatureIds:{value:r.globalFeatureIds,size:1},featureIds:{value:r.featureIds,size:1},numericProps:Va(r.numericProps,1)},lines:{...t,positions:{value:t.positions,size:n},pathIndices:{value:t.pathIndices,size:1},globalFeatureIds:{value:t.globalFeatureIds,size:1},featureIds:{value:t.featureIds,size:1},numericProps:Va(t.numericProps,1)},polygons:{...e,positions:{value:e.positions,size:n},polygonIndices:{value:e.polygonIndices,size:1},primitivePolygonIndices:{value:e.primitivePolygonIndices,size:1},globalFeatureIds:{value:e.globalFeatureIds,size:1},featureIds:{value:e.featureIds,size:1},numericProps:Va(e.numericProps,1)}};return i.polygons&&e.triangles&&(i.polygons.triangles={value:new Uint32Array(e.triangles),size:1}),i}function za(r,t,e,n){for(let i in r.numericProps)if(i in t){let s=t[i];r.numericProps[i].fill(s,e,e+n)}}function ka(r,t){let e={};for(let n in r)t.includes(n)||(e[n]=r[n]);return e}function Np(r,t){return t===Array||!Number.isFinite(r)?Array:t===Float64Array||Math.fround(r)!==r?Float64Array:Float32Array}function Tu(r,t={coordLength:2,fixRingWinding:!0}){return r.map(e=>Lp(e,t))}function Ou(r,t,e,n){e.push(t.length),t.push(...r);for(let i=r.length;i<n.coordLength;i++)t.push(0)}function Wa(r,t,e,n){e.push(t.length);for(let i of r){t.push(...i);for(let s=i.length;s<n.coordLength;s++)t.push(0)}}function Du(r,t,e,n,i){let s=0,o=[],a=[];for(let c of r){let l=c.map(d=>d.slice(0,2)),u=Un(l.flat()),h=u<0;i.fixRingWinding&&(s===0&&!h||s>0&&h)&&(c.reverse(),u=-u),o.push(u),Wa(c,t,a,i),s++}s>0&&(n.push(o),e.push(a))}function Lp(r,t){let{geometry:e}=r;if(e.type==="GeometryCollection")throw new Error("GeometryCollection type not supported");let n=[],i=[],s,o;switch(e.type){case"Point":o="Point",Ou(e.coordinates,n,i,t);break;case"MultiPoint":o="Point",e.coordinates.map(a=>Ou(a,n,i,t));break;case"LineString":o="LineString",Wa(e.coordinates,n,i,t);break;case"MultiLineString":o="LineString",e.coordinates.map(a=>Wa(a,n,i,t));break;case"Polygon":o="Polygon",s=[],Du(e.coordinates,n,i,s,t);break;case"MultiPolygon":o="Polygon",s=[],e.coordinates.map(a=>Du(a,n,i,s,t));break;default:throw new Error(`Unknown type: ${o}`)}return{...r,geometry:{type:o,indices:i,data:n,areas:s}}}function Ci(r,t={fixRingWinding:!0,triangulate:!0}){let e=_u(r),n=e.coordLength,{fixRingWinding:i}=t,s=Tu(r,{coordLength:n,fixRingWinding:i});return Au(s,e,{numericPropKeys:t.numericPropKeys,PositionDataType:t.PositionDataType||Float32Array,triangulate:t.triangulate})}var Mp="4.4.0-alpha.18",Ja={dataType:null,batchType:null,name:"GeoJSON",id:"geojson",module:"geojson",version:Mp,worker:!0,extensions:["geojson"],mimeTypes:["application/geo+json"],category:"geometry",text:!0,options:{geojson:{shape:"geojson-table"},json:{shape:"object-row-table",jsonpaths:["$","$.features"]},gis:{format:"geojson"}}},rn={...Ja,parse:Ep,parseTextSync:Fu,parseInBatches:Up};async function Ep(r,t){return Fu(new TextDecoder().decode(r),t)}function Fu(r,t){t={...rn.options,...t},t.geojson={...rn.options.geojson,...t.geojson},t.gis=t.gis||{};let e;try{e=JSON.parse(r)}catch{e={}}let n={shape:"geojson-table",type:"FeatureCollection",features:e?.features||[]};switch(t.gis.format){case"binary":return Ci(n.features);default:return n}}function Up(r,t){t={...rn.options,...t},t.json={...rn.options.json,...t.json},t.geojson={...rn.options.geojson,...t.geojson};let e=yo(r,t);switch(t.gis.format){case"binary":return Cp(e);default:return e}}async function*Cp(r){for await(let t of r)t.data=Ci(t.data),yield t}function Nu(r){let t=r.schema?.fields.findIndex(e=>e.name==="geometry")??-1;if(t>-1)return t;if(_r(r)>0){let e=fo(r,0);for(let n=0;n<lo(r);n++){let i=e?.[n];if(i&&typeof i=="object")return n}}throw new Error("Failed to detect geometry column")}function Lu(r,t,e=[]){let n={};for(let i=0;i<lo(r);++i){let s=r.schema?.fields[i].name;s&&!e.includes(i)&&(n[s]=t[s])}return n}function Mu(r,t,e,n){let i=uo(r,t);if(!i)return;let s=Rp(r,i,e),o=JSON.stringify(s);n.push(o)}function Rp(r,t,e){let n=Lu(r,t,[e]),i=r.schema?.fields[e].name,s=i&&t[i];if(!s)return{type:"Feature",geometry:null,properties:n};if(typeof s=="string")try{s=JSON.parse(s)}catch{throw new Error("Invalid string geometry")}if(typeof s!="object"||typeof s?.type!="string")throw new Error("invalid geometry column value");return s?.type==="Feature"?{...s,properties:n}:{type:"Feature",geometry:s,properties:n}}var vo=class{chunkSize;strings=[];totalLength=0;textEncoder=new TextEncoder;constructor(t){this.chunkSize=t}push(...t){for(let e of t)this.strings.push(e),this.totalLength+=e.length}isFull(){return this.totalLength>=this.chunkSize}getArrayBufferBatch(){return Ea(this.textEncoder.encode(this.getStringBatch()).buffer)}getStringBatch(){let t=this.strings.join("");return this.strings=[],this.totalLength=0,t}};async function*Ga(r,t={}){let e={geojson:{},chunkSize:1e4,...t},n=new vo(e.chunkSize);e.geojson.featureArray||n.push(`{
|
|
23
23
|
`,`"type": "FeatureCollection",
|
|
24
24
|
`,`"features":
|
|
25
25
|
`),n.push("[");let i=e.geojson.geometryColumn,s=!0,o=0;for await(let a of r){let c=o+_r(a);i||(i=i||Nu(a));for(let u=o;u<c;++u)s||n.push(","),n.push(`
|
package/dist/geojson-loader.js
CHANGED
|
@@ -6,7 +6,7 @@ import { geojsonToBinary } from '@loaders.gl/gis';
|
|
|
6
6
|
import { parseJSONInBatches } from "./lib/parsers/parse-json-in-batches.js";
|
|
7
7
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
8
8
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
9
|
-
const VERSION = typeof "4.4.0-alpha.
|
|
9
|
+
const VERSION = typeof "4.4.0-alpha.18" !== 'undefined' ? "4.4.0-alpha.18" : 'latest';
|
|
10
10
|
/**
|
|
11
11
|
* GeoJSON loader
|
|
12
12
|
*/
|
package/dist/geojson-worker.js
CHANGED
|
@@ -14784,7 +14784,7 @@ Char: ${this.c}`;
|
|
|
14784
14784
|
}
|
|
14785
14785
|
|
|
14786
14786
|
// src/geojson-loader.ts
|
|
14787
|
-
var VERSION = true ? "4.4.0-alpha.
|
|
14787
|
+
var VERSION = true ? "4.4.0-alpha.18" : "latest";
|
|
14788
14788
|
var GeoJSONWorkerLoader = {
|
|
14789
14789
|
dataType: null,
|
|
14790
14790
|
batchType: null,
|
package/dist/index.cjs
CHANGED
|
@@ -1113,7 +1113,7 @@ function rebuildJsonObject(batch, data) {
|
|
|
1113
1113
|
}
|
|
1114
1114
|
|
|
1115
1115
|
// dist/json-loader.js
|
|
1116
|
-
var VERSION = true ? "4.4.0-alpha.
|
|
1116
|
+
var VERSION = true ? "4.4.0-alpha.18" : "latest";
|
|
1117
1117
|
var JSONLoader = {
|
|
1118
1118
|
dataType: null,
|
|
1119
1119
|
batchType: null,
|
|
@@ -1196,7 +1196,7 @@ async function* parseNDJSONInBatches(binaryAsyncIterator, options) {
|
|
|
1196
1196
|
}
|
|
1197
1197
|
|
|
1198
1198
|
// dist/ndjson-loader.js
|
|
1199
|
-
var VERSION2 = true ? "4.4.0-alpha.
|
|
1199
|
+
var VERSION2 = true ? "4.4.0-alpha.18" : "latest";
|
|
1200
1200
|
var NDJSONLoader = {
|
|
1201
1201
|
dataType: null,
|
|
1202
1202
|
batchType: null,
|
|
@@ -1248,7 +1248,7 @@ var JSONWriter = {
|
|
|
1248
1248
|
|
|
1249
1249
|
// dist/geojson-loader.js
|
|
1250
1250
|
var import_gis = require("@loaders.gl/gis");
|
|
1251
|
-
var VERSION3 = true ? "4.4.0-alpha.
|
|
1251
|
+
var VERSION3 = true ? "4.4.0-alpha.18" : "latest";
|
|
1252
1252
|
var GeoJSONWorkerLoader = {
|
|
1253
1253
|
dataType: null,
|
|
1254
1254
|
batchType: null,
|
package/dist/json-loader.js
CHANGED
|
@@ -5,7 +5,7 @@ import { parseJSONSync } from "./lib/parsers/parse-json.js";
|
|
|
5
5
|
import { parseJSONInBatches } from "./lib/parsers/parse-json-in-batches.js";
|
|
6
6
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
7
7
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
8
|
-
const VERSION = typeof "4.4.0-alpha.
|
|
8
|
+
const VERSION = typeof "4.4.0-alpha.18" !== 'undefined' ? "4.4.0-alpha.18" : 'latest';
|
|
9
9
|
export const JSONLoader = {
|
|
10
10
|
dataType: null,
|
|
11
11
|
batchType: null,
|
package/dist/ndgeoson-loader.js
CHANGED
|
@@ -5,7 +5,7 @@ import { parseNDJSONSync } from "./lib/parsers/parse-ndjson.js";
|
|
|
5
5
|
import { parseNDJSONInBatches } from "./lib/parsers/parse-ndjson-in-batches.js";
|
|
6
6
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
7
7
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
8
|
-
const VERSION = typeof "4.4.0-alpha.
|
|
8
|
+
const VERSION = typeof "4.4.0-alpha.18" !== 'undefined' ? "4.4.0-alpha.18" : 'latest';
|
|
9
9
|
/** NDGeoJSONLoader */
|
|
10
10
|
export const NDJSONLoader = {
|
|
11
11
|
dataType: null,
|
package/dist/ndjson-loader.js
CHANGED
|
@@ -5,7 +5,7 @@ import { parseNDJSONSync } from "./lib/parsers/parse-ndjson.js";
|
|
|
5
5
|
import { parseNDJSONInBatches } from "./lib/parsers/parse-ndjson-in-batches.js";
|
|
6
6
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
7
7
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
8
|
-
const VERSION = typeof "4.4.0-alpha.
|
|
8
|
+
const VERSION = typeof "4.4.0-alpha.18" !== 'undefined' ? "4.4.0-alpha.18" : 'latest';
|
|
9
9
|
export const NDJSONLoader = {
|
|
10
10
|
dataType: null,
|
|
11
11
|
batchType: null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/json",
|
|
3
|
-
"version": "4.4.0-alpha.
|
|
3
|
+
"version": "4.4.0-alpha.18",
|
|
4
4
|
"description": "Framework-independent loader for JSON and streaming JSON formats",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"build-worker": "esbuild src/workers/geojson-worker.ts --bundle --outfile=dist/geojson-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@loaders.gl/gis": "4.4.0-alpha.
|
|
51
|
-
"@loaders.gl/loader-utils": "4.4.0-alpha.
|
|
52
|
-
"@loaders.gl/schema": "4.4.0-alpha.
|
|
53
|
-
"@loaders.gl/schema-utils": "4.4.0-alpha.
|
|
50
|
+
"@loaders.gl/gis": "4.4.0-alpha.18",
|
|
51
|
+
"@loaders.gl/loader-utils": "4.4.0-alpha.18",
|
|
52
|
+
"@loaders.gl/schema": "4.4.0-alpha.18",
|
|
53
|
+
"@loaders.gl/schema-utils": "4.4.0-alpha.18"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@loaders.gl/core": "4.4.0-alpha.1"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "6f37278ba24a83a68a1a081389eaef2ffac1ff09"
|
|
59
59
|
}
|