@loaders.gl/pcd 4.4.0-alpha.1 → 4.4.0-alpha.2
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 +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/pcd-loader.js +1 -1
- package/dist/pcd-worker.js +1 -1
- package/package.json +6 -6
package/dist/dist.min.js
CHANGED
|
@@ -14,7 +14,7 @@ return true;`)}function Ou(r){return typeof r!="bigint"?me(r):`${me(r)}n`}functi
|
|
|
14
14
|
${this.toArray().join(`,
|
|
15
15
|
`)}
|
|
16
16
|
]`}concat(...t){let e=this.schema,i=this.data.concat(t.flatMap(({data:n})=>n));return new rt(e,i.map(n=>new $(e,n)))}slice(t,e){let i=this.schema;[t,e]=Ni({length:this.numRows},t,e);let n=Qn(this.data,this._offsets,t,e);return new rt(i,n.map(s=>new $(i,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let e=this.data.map(i=>i.children[t]);if(e.length===0){let{type:i}=this.schema.fields[t],n=O({type:i,length:0,nullCount:0});e.push(n._changeLengthAndBackfillNullBitmap(this.numRows))}return new N(e)}return null}setChild(t,e){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(n=>n.name===t),e)}setChildAt(t,e){let i=this.schema,n=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new N([O({type:new ht,length:this.numRows})]));let s=i.fields.slice(),o=s[t].clone({type:e.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[s[t],a[t]]=[o,e],[i,n]=Ds(i,a)}return new rt(i,n)}select(t){let e=this.schema.fields.reduce((i,n,s)=>i.set(n.name,s),new Map);return this.selectAt(t.map(i=>e.get(i)).filter(i=>i>-1))}selectAt(t){let e=this.schema.selectAt(t),i=this.batches.map(n=>n.selectAt(t));return new rt(e,i)}assign(t){let e=this.schema.fields,[i,n]=t.schema.fields.reduce((a,c,l)=>{let[d,h]=a,x=e.findIndex(g=>g.name===c.name);return~x?h[x]=l:d.push(l),a},[[],[]]),s=this.schema.assign(t.schema),o=[...e.map((a,c)=>[c,n[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...i.map(a=>t.getChildAt(a))].filter(Boolean);return new rt(...Ds(s,o))}};pc=Symbol.toStringTag;rt[pc]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=ci(Ei),r.get=ci(st.getVisitFn(u.Struct)),r.set=ts(mt.getVisitFn(u.Struct)),r.indexOf=es(Ir.getVisitFn(u.Struct)),"Table"))(rt.prototype);var yc,$=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof R))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=O({nullCount:0,type:new j(this.schema.fields),children:this.schema.fields.map(e=>O({type:e.type,nullCount:0}))})]=t,!(this.data instanceof E))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=mc(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:i,children:n,length:s}=Object.keys(e).reduce((c,l,d)=>(c.children[d]=e[l],c.length=Math.max(c.length,e[l].length),c.fields[d]=F.new({name:l,type:e[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new R(i),a=O({type:new j(i),length:s,children:n,nullCount:0});[this.schema,this.data]=mc(o,a.children,s);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=gc(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 st.visit(this.data,t)}at(t){return this.get(gr(t,this.numRows))}set(t,e){return mt.visit(this.data,t,e)}indexOf(t,e){return Ir.visit(this.data,t,e)}[Symbol.iterator](){return li.visit(new N([this.data]))}toArray(){return[...this]}concat(...t){return new rt(this.schema,[this,...t])}slice(t,e){let[i]=new N([this.data]).slice(t,e).data;return new $(this.schema,i)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(i=>i.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new N([this.data.children[t]]):null}setChild(t,e){var i;return this.setChildAt((i=this.schema.fields)===null||i===void 0?void 0:i.findIndex(n=>n.name===t),e)}setChildAt(t,e){let i=this.schema,n=this.data;if(t>-1&&t<this.numCols){e||(e=new N([O({type:new ht,length:this.numRows})]));let s=i.fields.slice(),o=n.children.slice(),a=s[t].clone({type:e.type});[s[t],o[t]]=[a,e.data[0]],i=new R(s,new Map(this.schema.metadata)),n=O({type:new j(s),children:o})}return new $(i,n)}select(t){let e=this.schema.select(t),i=new j(e.fields),n=[];for(let s of t){let o=this.schema.fields.findIndex(a=>a.name===s);~o&&(n[o]=this.data.children[o])}return new $(e,O({type:i,length:this.numRows,children:n}))}selectAt(t){let e=this.schema.selectAt(t),i=t.map(s=>this.data.children[s]).filter(Boolean),n=O({type:new j(e.fields),length:this.numRows,children:i});return new $(e,n)}};yc=Symbol.toStringTag;$[yc]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))($.prototype);function mc(r,t,e=t.reduce((i,n)=>Math.max(i,n.length),0)){var i;let n=[...r.fields],s=[...t],o=(e+63&-64)>>3;for(let[a,c]of r.fields.entries()){let l=t[a];(!l||l.length!==e)&&(n[a]=c.clone({nullable:!0}),s[a]=(i=l?._changeLengthAndBackfillNullBitmap(e))!==null&&i!==void 0?i:O({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(n),O({type:new j(n),length:e,children:s})]}function gc(r,t,e=new Map){var i,n;if(((i=r?.length)!==null&&i!==void 0?i:0)>0&&r?.length===t?.length)for(let s=-1,o=r.length;++s<o;){let{type:a}=r[s],c=t[s];for(let l of[c,...((n=c?.dictionary)===null||n===void 0?void 0:n.data)||[]])gc(a.children,l?.children,e);if(f.isDictionary(a)){let{id:l}=a;if(!e.has(l))c?.dictionary&&e.set(l,c.dictionary);else if(e.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return e}var Mr=class extends ${constructor(t){let e=t.fields.map(n=>O({type:n.type})),i=O({type:new j(t.fields),nullCount:0,children:e});super(t,i)}};var it=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new it).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new it).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):P.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):C.NONE}header(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){let i=this.bb.__offset(this.bb_pos,12);return i?(e||new Z).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,P.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,C.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,i,n,s,o){return it.startMessage(t),it.addVersion(t,e),it.addHeaderType(t,i),it.addHeader(t,n),it.addBodyLength(t,s),it.addCustomMetadata(t,o),it.endMessage(t)}};var Ao=class extends b{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return Oe.startNull(e),Oe.endNull(e)}visitInt(t,e){return lt.startInt(e),lt.addBitWidth(e,t.bitWidth),lt.addIsSigned(e,t.isSigned),lt.endInt(e)}visitFloat(t,e){return Lt.startFloatingPoint(e),Lt.addPrecision(e,t.precision),Lt.endFloatingPoint(e)}visitBinary(t,e){return Be.startBinary(e),Be.endBinary(e)}visitLargeBinary(t,e){return De.startLargeBinary(e),De.endLargeBinary(e)}visitBool(t,e){return xe.startBool(e),xe.endBool(e)}visitUtf8(t,e){return Me.startUtf8(e),Me.endUtf8(e)}visitLargeUtf8(t,e){return Ae.startLargeUtf8(e),Ae.endLargeUtf8(e)}visitDecimal(t,e){return ut.startDecimal(e),ut.addScale(e,t.scale),ut.addPrecision(e,t.precision),ut.addBitWidth(e,t.bitWidth),ut.endDecimal(e)}visitDate(t,e){return Ot.startDate(e),Ot.addUnit(e,t.unit),Ot.endDate(e)}visitTime(t,e){return bt.startTime(e),bt.addUnit(e,t.unit),bt.addBitWidth(e,t.bitWidth),bt.endTime(e)}visitTimestamp(t,e){let i=t.timezone&&e.createString(t.timezone)||void 0;return _t.startTimestamp(e),_t.addUnit(e,t.unit),i!==void 0&&_t.addTimezone(e,i),_t.endTimestamp(e)}visitInterval(t,e){return Ut.startInterval(e),Ut.addUnit(e,t.unit),Ut.endInterval(e)}visitDuration(t,e){return Ft.startDuration(e),Ft.addUnit(e,t.unit),Ft.endDuration(e)}visitList(t,e){return Te.startList(e),Te.endList(e)}visitStruct(t,e){return Fe.startStruct_(e),Fe.endStruct_(e)}visitUnion(t,e){dt.startTypeIdsVector(e,t.typeIds.length);let i=dt.createTypeIdsVector(e,t.typeIds);return dt.startUnion(e),dt.addMode(e,t.mode),dt.addTypeIds(e,i),dt.endUnion(e)}visitDictionary(t,e){let i=this.visit(t.indices,e);return Zt.startDictionaryEncoding(e),Zt.addId(e,BigInt(t.id)),Zt.addIsOrdered(e,t.isOrdered),i!==void 0&&Zt.addIndexType(e,i),Zt.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return Mt.startFixedSizeBinary(e),Mt.addByteWidth(e,t.byteWidth),Mt.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Nt.startFixedSizeList(e),Nt.addListSize(e,t.listSize),Nt.endFixedSizeList(e)}visitMap(t,e){return Et.startMap(e),Et.addKeysSorted(e,t.keysSorted),Et.endMap(e)}},As=new Ao;function vc(r,t=new Map){return new R(ju(r,t),Ts(r.metadata),t)}function To(r){return new yt(r.count,Sc(r.columns),Bc(r.columns))}function Ic(r){return new Yt(To(r.data),r.id,r.isDelta)}function ju(r,t){return(r.fields||[]).filter(Boolean).map(e=>F.fromJSON(e,t))}function bc(r,t){return(r.children||[]).filter(Boolean).map(e=>F.fromJSON(e,t))}function Sc(r){return(r||[]).reduce((t,e)=>[...t,new ce(e.count,Wu(e.VALIDITY)),...Sc(e.children)],[])}function Bc(r,t=[]){for(let e=-1,i=(r||[]).length;++e<i;){let n=r[e];n.VALIDITY&&t.push(new $t(t.length,n.VALIDITY.length)),n.TYPE_ID&&t.push(new $t(t.length,n.TYPE_ID.length)),n.OFFSET&&t.push(new $t(t.length,n.OFFSET.length)),n.DATA&&t.push(new $t(t.length,n.DATA.length)),t=Bc(n.children,t)}return t}function Wu(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function xc(r,t){let e,i,n,s,o,a;return!t||!(s=r.dictionary)?(o=wc(r,bc(r,t)),n=new F(r.name,o,r.nullable,Ts(r.metadata))):t.has(e=s.id)?(i=(i=s.indexType)?_c(i):new Ht,a=new Pt(t.get(e),i,e,s.isOrdered),n=new F(r.name,a,r.nullable,Ts(r.metadata))):(i=(i=s.indexType)?_c(i):new Ht,t.set(e,o=wc(r,bc(r,t))),a=new Pt(o,i,e,s.isOrdered),n=new F(r.name,a,r.nullable,Ts(r.metadata))),n||null}function Ts(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function _c(r){return new et(r.isSigned,r.bitWidth)}function wc(r,t){let e=r.type.name;switch(e){case"NONE":return new ht;case"null":return new ht;case"binary":return new re;case"largebinary":return new Ne;case"utf8":return new ie;case"largeutf8":return new Le;case"bool":return new ne;case"list":return new Vt((t||[])[0]);case"struct":return new j(t||[]);case"struct_":return new j(t||[])}switch(e){case"int":{let i=r.type;return new et(i.isSigned,i.bitWidth)}case"floatingpoint":{let i=r.type;return new Ct(W[i.precision])}case"decimal":{let i=r.type;return new se(i.scale,i.precision,i.bitWidth)}case"date":{let i=r.type;return new Kt(X[i.unit])}case"time":{let i=r.type;return new xt(p[i.unit],i.bitWidth)}case"timestamp":{let i=r.type;return new Dt(p[i.unit],i.timezone)}case"interval":{let i=r.type;return new Xt(tt[i.unit])}case"duration":{let i=r.type;return new Ue(p[i.unit])}case"union":{let i=r.type,[n,...s]=(i.mode+"").toLowerCase(),o=n.toUpperCase()+s.join("");return new oe(G[o],i.typeIds||[],t||[])}case"fixedsizebinary":{let i=r.type;return new Ee(i.byteWidth)}case"fixedsizelist":{let i=r.type;return new wt(i.listSize,(t||[])[0])}case"map":{let i=r.type;return new zt((t||[])[0],i.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var $u=Pe,Yu=Bt,at=class{static fromJSON(t,e){let i=new at(0,P.V5,e);return i._createHeader=Gu(t,e),i}static decode(t){t=new Yu(B(t));let e=it.getRootAsMessage(t),i=e.bodyLength(),n=e.version(),s=e.headerType(),o=new at(i,n,s);return o._createHeader=Ju(e,s),o}static encode(t){let e=new $u,i=-1;return t.isSchema()?i=R.encode(e,t.header()):t.isRecordBatch()?i=yt.encode(e,t.header()):t.isDictionaryBatch()&&(i=Yt.encode(e,t.header())),it.startMessage(e),it.addVersion(e,P.V5),it.addHeader(e,i),it.addHeaderType(e,t.headerType),it.addBodyLength(e,BigInt(t.bodyLength)),it.finishMessageBuffer(e,it.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof R)return new at(0,P.V5,C.Schema,t);if(t instanceof yt)return new at(e,P.V5,C.RecordBatch,t);if(t instanceof Yt)return new at(e,P.V5,C.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===C.Schema}isRecordBatch(){return this.headerType===C.RecordBatch}isDictionaryBatch(){return this.headerType===C.DictionaryBatch}constructor(t,e,i,n){this._version=e,this._headerType=i,this.body=new Uint8Array(0),n&&(this._createHeader=()=>n),this._bodyLength=V(t)}},yt=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,e,i){this._nodes=e,this._buffers=i,this._length=V(t)}},Yt=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,i=!1){this._data=t,this._isDelta=i,this._id=V(e)}},$t=class{constructor(t,e){this.offset=V(t),this.length=V(e)}},ce=class{constructor(t,e){this.length=V(t),this.nullCount=V(e)}};function Gu(r,t){return()=>{switch(t){case C.Schema:return R.fromJSON(r);case C.RecordBatch:return yt.fromJSON(r);case C.DictionaryBatch:return Yt.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${C[t]}, type: ${t} }`)}}function Ju(r,t){return()=>{switch(t){case C.Schema:return R.decode(r.header(new Q),new Map,r.version());case C.RecordBatch:return yt.decode(r.header(new gt),r.version());case C.DictionaryBatch:return Yt.decode(r.header(new ee),r.version())}throw new Error(`Unrecognized Message type: { name: ${C[t]}, type: ${t} }`)}}F.encode=nd;F.decode=rd;F.fromJSON=xc;R.encode=id;R.decode=Zu;R.fromJSON=vc;yt.encode=sd;yt.decode=Hu;yt.fromJSON=To;Yt.encode=od;Yt.decode=Ku;Yt.fromJSON=Ic;ce.encode=ad;ce.decode=qu;$t.encode=cd;$t.decode=Xu;function Zu(r,t=new Map,e=P.V5){let i=ed(r,t);return new R(i,Os(r),t,e)}function Hu(r,t=P.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new yt(r.length(),Qu(r),td(r,t))}function Ku(r,t=P.V5){return new Yt(yt.decode(r.data(),t),r.id(),r.isDelta())}function Xu(r){return new $t(r.offset(),r.length())}function qu(r){return new ce(r.length(),r.nullCount())}function Qu(r){let t=[];for(let e,i=-1,n=-1,s=r.nodesLength();++i<s;)(e=r.nodes(i))&&(t[++n]=ce.decode(e));return t}function td(r,t){let e=[];for(let i,n=-1,s=-1,o=r.buffersLength();++n<o;)(i=r.buffers(n))&&(t<P.V4&&(i.bb_pos+=8*(n+1)),e[++s]=$t.decode(i));return e}function ed(r,t){let e=[];for(let i,n=-1,s=-1,o=r.fieldsLength();++n<o;)(i=r.fields(n))&&(e[++s]=F.decode(i,t));return e}function Dc(r,t){let e=[];for(let i,n=-1,s=-1,o=r.childrenLength();++n<o;)(i=r.children(n))&&(e[++s]=F.decode(i,t));return e}function rd(r,t){let e,i,n,s,o,a;return!t||!(a=r.dictionary())?(n=Tc(r,Dc(r,t)),i=new F(r.name(),n,r.nullable(),Os(r))):t.has(e=V(a.id()))?(s=(s=a.indexType())?Ac(s):new Ht,o=new Pt(t.get(e),s,e,a.isOrdered()),i=new F(r.name(),o,r.nullable(),Os(r))):(s=(s=a.indexType())?Ac(s):new Ht,t.set(e,n=Tc(r,Dc(r,t))),o=new Pt(n,s,e,a.isOrdered()),i=new F(r.name(),o,r.nullable(),Os(r))),i||null}function Os(r){let t=new Map;if(r)for(let e,i,n=-1,s=Math.trunc(r.customMetadataLength());++n<s;)(e=r.customMetadata(n))&&(i=e.key())!=null&&t.set(i,e.value());return t}function Ac(r){return new et(r.isSigned(),r.bitWidth())}function Tc(r,t){let e=r.typeType();switch(e){case J.NONE:return new ht;case J.Null:return new ht;case J.Binary:return new re;case J.LargeBinary:return new Ne;case J.Utf8:return new ie;case J.LargeUtf8:return new Le;case J.Bool:return new ne;case J.List:return new Vt((t||[])[0]);case J.Struct_:return new j(t||[])}switch(e){case J.Int:{let i=r.type(new lt);return new et(i.isSigned(),i.bitWidth())}case J.FloatingPoint:{let i=r.type(new Lt);return new Ct(i.precision())}case J.Decimal:{let i=r.type(new ut);return new se(i.scale(),i.precision(),i.bitWidth())}case J.Date:{let i=r.type(new Ot);return new Kt(i.unit())}case J.Time:{let i=r.type(new bt);return new xt(i.unit(),i.bitWidth())}case J.Timestamp:{let i=r.type(new _t);return new Dt(i.unit(),i.timezone())}case J.Interval:{let i=r.type(new Ut);return new Xt(i.unit())}case J.Duration:{let i=r.type(new Ft);return new Ue(i.unit())}case J.Union:{let i=r.type(new dt);return new oe(i.mode(),i.typeIdsArray()||[],t||[])}case J.FixedSizeBinary:{let i=r.type(new Mt);return new Ee(i.byteWidth())}case J.FixedSizeList:{let i=r.type(new Nt);return new wt(i.listSize(),(t||[])[0])}case J.Map:{let i=r.type(new Et);return new zt((t||[])[0],i.keysSorted())}}throw new Error(`Unrecognized type: "${J[e]}" (${e})`)}function id(r,t){let e=t.fields.map(s=>F.encode(r,s));Q.startFieldsVector(r,e.length);let i=Q.createFieldsVector(r,e),n=t.metadata&&t.metadata.size>0?Q.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{let a=r.createString(`${s}`),c=r.createString(`${o}`);return Z.startKeyValue(r),Z.addKey(r,a),Z.addValue(r,c),Z.endKeyValue(r)})):-1;return Q.startSchema(r),Q.addFields(r,i),Q.addEndianness(r,ld?Qe.Little:Qe.Big),n!==-1&&Q.addCustomMetadata(r,n),Q.endSchema(r)}function nd(r,t){let e=-1,i=-1,n=-1,s=t.type,o=t.typeId;f.isDictionary(s)?(o=s.dictionary.typeId,n=As.visit(s,r),i=As.visit(s.dictionary,r)):i=As.visit(s,r);let a=(s.children||[]).map(d=>F.encode(r,d)),c=nt.createChildrenVector(r,a),l=t.metadata&&t.metadata.size>0?nt.createCustomMetadataVector(r,[...t.metadata].map(([d,h])=>{let x=r.createString(`${d}`),g=r.createString(`${h}`);return Z.startKeyValue(r),Z.addKey(r,x),Z.addValue(r,g),Z.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),nt.startField(r),nt.addType(r,i),nt.addTypeType(r,o),nt.addChildren(r,c),nt.addNullable(r,!!t.nullable),e!==-1&&nt.addName(r,e),n!==-1&&nt.addDictionary(r,n),l!==-1&&nt.addCustomMetadata(r,l),nt.endField(r)}function sd(r,t){let e=t.nodes||[],i=t.buffers||[];gt.startNodesVector(r,e.length);for(let o of e.slice().reverse())ce.encode(r,o);let n=r.endVector();gt.startBuffersVector(r,i.length);for(let o of i.slice().reverse())$t.encode(r,o);let s=r.endVector();return gt.startRecordBatch(r),gt.addLength(r,BigInt(t.length)),gt.addNodes(r,n),gt.addBuffers(r,s),gt.endRecordBatch(r)}function od(r,t){let e=yt.encode(r,t.data);return ee.startDictionaryBatch(r),ee.addId(r,BigInt(t.id)),ee.addIsDelta(r,t.isDelta),ee.addData(r,e),ee.endDictionaryBatch(r)}function ad(r,t){return kr.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function cd(r,t){return Pr.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var ld=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var Fo=r=>`Expected ${C[r]} Message in stream, but was null or length 0.`,Mo=r=>`Header pointer of flatbuffer-encoded ${C[r]} Message is null or length 0.`,Oc=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,Fc=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,bi=class{constructor(t){this.source=t instanceof Ve?t:new Ve(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?H:t.value===-1&&(t=this.readMetadataLength()).done?H:(t=this.readMetadata(t.value)).done?H:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Fo(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=B(this.source.read(t));if(e.byteLength<t)throw new Error(Fc(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=C.Schema,i=this.readMessage(e),n=i?.header();if(t&&!n)throw new Error(Mo(e));return n}readMetadataLength(){let t=this.source.read(Fs),e=t&&new Bt(t),i=e?.readInt32(0)||0;return{done:i===0,value:i}}readMetadata(t){let e=this.source.read(t);if(!e)return H;if(e.byteLength<t)throw new Error(Oc(t,e.byteLength));return{done:!1,value:at.decode(e)}}},un=class{constructor(t,e){this.source=t instanceof jt?t:vn(t)?new nr(t,e):new jt(t)}[Symbol.asyncIterator](){return this}next(){return m(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?H:t.value===-1&&(t=yield this.readMetadataLength()).done?H:(t=yield this.readMetadata(t.value)).done?H: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 e;if((e=yield this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Fo(t));return e.value})}readMessageBody(t){return m(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=B(yield this.source.read(t));if(e.byteLength<t)throw new Error(Fc(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(){return m(this,arguments,void 0,function*(t=!1){let e=C.Schema,i=yield this.readMessage(e),n=i?.header();if(t&&!n)throw new Error(Mo(e));return n})}readMetadataLength(){return m(this,void 0,void 0,function*(){let t=yield this.source.read(Fs),e=t&&new Bt(t),i=e?.readInt32(0)||0;return{done:i===0,value:i}})}readMetadata(t){return m(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return H;if(e.byteLength<t)throw new Error(Oc(t,e.byteLength));return{done:!1,value:at.decode(e)}})}},dn=class extends bi{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Ri?t:new Ri(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:at.fromJSON(t.schema,C.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:at.fromJSON(e,C.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:at.fromJSON(e,C.RecordBatch)}}return this._body=[],H}readMessageBody(t){return e(this._body);function e(i){return(i||[]).reduce((n,s)=>[...n,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...e(s.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Fo(t));return e.value}readSchema(){let t=C.Schema,e=this.readMessage(t),i=e?.header();if(!e||!i)throw new Error(Mo(t));return i}},Fs=4,Oo="ARROW1",_i=new Uint8Array(Oo.length);for(let r=0;r<Oo.length;r+=1)_i[r]=Oo.codePointAt(r);function Ms(r,t=0){for(let e=-1,i=_i.length;++e<i;)if(_i[e]!==r[t+e])return!1;return!0}var wi=_i.length,No=wi+Fs,Mc=wi*2+Fs;var Tt=class extends Br{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 e=this._impl.open(t);return ue(e)?e.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 pt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return pt.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,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof Tt?t:_n(t)?dd(t):vn(t)?pd(t):ue(t)?(()=>m(this,void 0,void 0,function*(){return yield Tt.from(yield t)}))():In(t)||Bi(t)||Bn(t)||Qt(t)?fd(new jt(t)):hd(new Ve(t))}static readAll(t){return t instanceof Tt?t.isSync()?Nc(t):Lc(t):_n(t)||ArrayBuffer.isView(t)||de(t)||wn(t)?Nc(t):Lc(t)}},He=class extends Tt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Gt(this,arguments,function*(){yield L(yield*Vr(le(this[Symbol.iterator]())))})}},Nr=class extends Tt{constructor(t){super(t),this._impl=t}readAll(){return m(this,void 0,void 0,function*(){var t,e,i,n;let s=new Array;try{for(var o=!0,a=le(this),c;c=yield a.next(),t=c.done,!t;o=!0){n=c.value,o=!1;let l=n;s.push(l)}}catch(l){e={error:l}}finally{try{!o&&!t&&(i=a.return)&&(yield i.call(a))}finally{if(e)throw e.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Lr=class extends He{constructor(t){super(t),this._impl=t}},Ns=class extends Nr{constructor(t){super(t),this._impl=t}},Ls=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,e){let i=this._loadVectors(t,e,this.schema.fields),n=O({type:new j(this.schema.fields),length:t.length,children:i});return new $(this.schema,n)}_loadDictionaryBatch(t,e){let{id:i,isDelta:n}=t,{dictionaries:s,schema:o}=this,a=s.get(i),c=o.dictionaries.get(i),l=this._loadVectors(t.data,e,[c]);return(a&&n?a.concat(new N(l)):new N(l)).memoize()}_loadVectors(t,e,i){return new zi(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}},vi=class extends Ls{constructor(t,e){super(e),this._reader=_n(t)?new dn(this._handle=t):new bi(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=Uc(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):H}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):H}next(){if(this.closed)return H;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),n=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,n)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),n=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(i,n);this.dictionaries.set(i.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Mr(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Ii=class extends Ls{constructor(t,e){super(e),this._reader=new un(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=Uc(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):H})}return(t){return m(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):H})}next(){return m(this,void 0,void 0,function*(){if(this.closed)return H;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let i=t.header(),n=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(i,n)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let i=t.header(),n=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(i,n);this.dictionaries.set(i.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Mr(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return m(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Us=class extends vi{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,e){super(t instanceof Ci?t:new Ci(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();let i=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(i&&this._handle.seek(i.offset)){let n=this._reader.readMessage(C.RecordBatch);if(n?.isRecordBatch()){let s=n.header(),o=this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var e;let i=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(i&&this._handle.seek(i.offset)){let n=this._reader.readMessage(C.DictionaryBatch);if(n?.isDictionaryBatch()){let s=n.header(),o=this._reader.readMessageBody(n.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){let{_handle:t}=this,e=t.size-No,i=t.readInt32(e),n=t.readAt(e-i,i);return We.decode(n)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let i=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(this._recordBatchIndex);if(i&&this._handle.seek(i.offset))return this._reader.readMessage(t)}return null}},Lo=class extends Ii{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,...e){let i=typeof e[0]!="number"?e.shift():void 0,n=e[0]instanceof Map?e.shift():void 0;super(t instanceof nr?t:new nr(t,i),n)}isFile(){return!0}isAsync(){return!0}open(t){let e=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 e.open.call(this,t)})}readRecordBatch(t){return m(this,void 0,void 0,function*(){var e;if(this.closed)return null;this._footer||(yield this.open());let i=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(i&&(yield this._handle.seek(i.offset))){let n=yield this._reader.readMessage(C.RecordBatch);if(n?.isRecordBatch()){let s=n.header(),o=yield this._reader.readMessageBody(n.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){return m(this,void 0,void 0,function*(){var e;let i=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(i&&(yield this._handle.seek(i.offset))){let n=yield this._reader.readMessage(C.DictionaryBatch);if(n?.isDictionaryBatch()){let s=n.header(),o=yield this._reader.readMessageBody(n.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return m(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-No,i=yield t.readInt32(e),n=yield t.readAt(e-i,i);return We.decode(n)})}_readNextMessageAndValidate(t){return m(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}},Uo=class extends vi{constructor(t,e){super(t,e)}_loadVectors(t,e,i){return new ns(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(i)}};function Uc(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*Nc(r){let t=Tt.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Lc(r){return Gt(this,arguments,function*(){let e=yield L(Tt.from(r));try{if(!(yield L(e.open({autoDestroy:!1}))).closed)do yield yield L(e);while(!(yield L(e.reset().open())).closed)}finally{yield L(e.cancel())}})}function dd(r){return new He(new Uo(r))}function hd(r){let t=r.peek(wi+7&-8);return t&&t.byteLength>=4?Ms(t)?new Lr(new Us(r.read())):new He(new vi(r)):new He(new vi(function*(){}()))}function fd(r){return m(this,void 0,void 0,function*(){let t=yield r.peek(wi+7&-8);return t&&t.byteLength>=4?Ms(t)?new Lr(new Us(yield r.read())):new Nr(new Ii(r)):new Nr(new Ii(function(){return Gt(this,arguments,function*(){})}()))})}function pd(r){return m(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new nr(r,t);return t>=Mc&&Ms(yield e.readAt(0,wi+7&-8))?new Ns(new Lo(e)):new Nr(new Ii(e))})}var K=class extends b{static assemble(...t){let e=n=>n.flatMap(s=>Array.isArray(s)?e(s):s instanceof $?s.data.children:s.data),i=new K;return i.visitMany(e(t)),i}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof N)return this.visitMany(t.data),this;let{type:e}=t;if(!f.isDictionary(e)){let{length:i}=t;if(i>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(f.isUnion(e))this.nodes.push(new ce(i,0));else{let{nullCount:n}=t;f.isNull(e)||we.call(this,n<=0?new Uint8Array(0):_r(t.offset,i,t.nullBitmap)),this.nodes.push(new ce(i,n))}}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 we(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new $t(this._byteLength,t)),this._byteLength+=t,this}function md(r){var t;let{type:e,length:i,typeIds:n,valueOffsets:s}=r;if(we.call(this,n),e.mode===G.Sparse)return Eo.call(this,r);if(e.mode===G.Dense){if(r.offset<=0)return we.call(this,s),Eo.call(this,r);{let o=new Int32Array(i),a=Object.create(null),c=Object.create(null);for(let l,d,h=-1;++h<i;)(l=n[h])!==void 0&&((d=a[l])===void 0&&(d=a[l]=s[h]),o[h]=s[h]-d,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);we.call(this,o),this.visitMany(r.children.map((l,d)=>{let h=e.typeIds[d],x=a[h],g=c[h];return l.slice(x,Math.min(i,g))}))}}return this}function yd(r){let t;return r.nullCount>=r.length?we.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?we.call(this,_r(r.offset,r.length,t)):we.call(this,wr(r.values))}function Ke(r){return we.call(this,r.values.subarray(0,r.length*r.stride))}function Es(r){let{length:t,values:e,valueOffsets:i}=r,n=V(i[0]),s=V(i[t]),o=Math.min(s-n,e.byteLength-n);return we.call(this,Dn(-n,t+1,i)),we.call(this,e.subarray(n,n+o)),this}function Ro(r){let{length:t,valueOffsets:e}=r;if(e){let{[0]:i,[t]:n}=e;return we.call(this,Dn(-i,t+1,e)),this.visit(r.children[0].slice(i,n-i))}return this.visit(r.children[0])}function Eo(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}K.prototype.visitBool=yd;K.prototype.visitInt=Ke;K.prototype.visitFloat=Ke;K.prototype.visitUtf8=Es;K.prototype.visitLargeUtf8=Es;K.prototype.visitBinary=Es;K.prototype.visitLargeBinary=Es;K.prototype.visitFixedSizeBinary=Ke;K.prototype.visitDate=Ke;K.prototype.visitTimestamp=Ke;K.prototype.visitTime=Ke;K.prototype.visitDecimal=Ke;K.prototype.visitList=Ro;K.prototype.visitStruct=Eo;K.prototype.visitUnion=md;K.prototype.visitInterval=Ke;K.prototype.visitDuration=Ke;K.prototype.visitFixedSizeList=Ro;K.prototype.visitMap=Ro;var Ur=class extends Br{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Ce,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,St(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return ue(t)?t.then(e=>this.writeAll(e)):Qt(t)?Vo(this,t):Co(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,e=null){return t===this._sink||t instanceof Ce?this._sink=t:(this._sink=new Ce,t&&Ko(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Xo(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,(!e||!Fr(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof rt&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof $&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!Fr(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof $?t instanceof Mr||this._writeRecordBatch(t):t instanceof rt?this.writeAll(t.batches):de(t)&&this.writeAll(t)}_writeMessage(t,e=8){let i=e-1,n=at.encode(t),s=n.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+i&~i,c=a-s-o;return t.headerType===C.RecordBatch?this._recordBatchBlocks.push(new _e(a,t.bodyLength,this._position)):t.headerType===C.DictionaryBatch&&this._dictionaryBlocks.push(new _e(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(n),this._writePadding(c)}_write(t){if(this._started){let e=B(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.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(_i)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:i,bufferRegions:n,buffers:s}=K.assemble(t),o=new yt(t.numRows,i,n),a=at.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,i=!1){let{byteLength:n,nodes:s,bufferRegions:o,buffers:a}=K.assemble(new N([t])),c=new yt(t.length,s,o),l=new Yt(c,e,i),d=at.from(l,n);return this._writeMessage(d)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,i,n;for(let s=-1,o=t.length;++s<o;)(e=t[s])&&(i=e.byteLength)>0&&(this._write(e),(n=(i+7&-8)-i)>0&&this._writePadding(n));return this}_writeDictionaries(t){var e,i;for(let[n,s]of t.dictionaries){let o=(e=s?.data)!==null&&e!==void 0?e:[],a=this._seenDictionaries.get(n),c=(i=this._dictionaryDeltaOffsets.get(n))!==null&&i!==void 0?i:0;if(!a||a.data[0]!==o[0])for(let[l,d]of o.entries())this._writeDictionaryBatch(d,n,l>0);else if(c<o.length)for(let l of o.slice(c))this._writeDictionaryBatch(l,n,!0);this._seenDictionaries.set(n,s),this._dictionaryDeltaOffsets.set(n,o.length)}return this}},Er=class extends Ur{static writeAll(t,e){let i=new Er(e);return ue(t)?t.then(n=>i.writeAll(n)):Qt(t)?Vo(i,t):Co(i,t)}},Rr=class extends Ur{static writeAll(t){let e=new Rr;return ue(t)?t.then(i=>e.writeAll(i)):Qt(t)?Vo(e,t):Co(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,e,i=!1){if(!i&&this._seenDictionaries.has(e))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,e,i)}_writeFooter(t){let e=We.encode(new We(t,P.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function Co(r,t){let e=t;t instanceof rt&&(e=t.batches,r.reset(void 0,t.schema));for(let i of e)r.write(i);return r.finish()}function Vo(r,t){return m(this,void 0,void 0,function*(){var e,i,n,s,o,a,c;try{for(e=!0,i=le(t);n=yield i.next(),s=n.done,!s;e=!0){c=n.value,e=!1;let l=c;r.write(l)}}catch(l){o={error:l}}finally{try{!e&&!s&&(a=i.return)&&(yield a.call(i))}finally{if(o)throw o.error}}return r.finish()})}function Ec(r,t){if(Qt(r))return bd(r,t);if(de(r))return gd(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function gd(r,t){let e=null,i=t?.type==="bytes"||!1,n=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){s(o,e||(e=r[Symbol.iterator]()))},pull(o){e?s(o,e):o.close()},cancel(){(e?.return&&e.return()||!0)&&(e=null)}}),Object.assign({highWaterMark:i?n:void 0},t));function s(o,a){let c,l=null,d=o.desiredSize||null;for(;!(l=a.next(i?d:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=B(l.value))&&(d!=null&&i&&(d=d-c.byteLength+1),l.value=c),o.enqueue(l.value),d!=null&&--d<=0)return;o.close()}}function bd(r,t){let e=null,i=t?.type==="bytes"||!1,n=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 s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return m(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return m(this,void 0,void 0,function*(){(e?.return&&(yield e.return())||!0)&&(e=null)})}}),Object.assign({highWaterMark:i?n:void 0},t));function s(o,a){return m(this,void 0,void 0,function*(){let c,l=null,d=o.desiredSize||null;for(;!(l=yield a.next(i?d:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=B(l.value))&&(d!=null&&i&&(d=d-c.byteLength+1),l.value=c),o.enqueue(l.value),d!=null&&--d<=0)return;o.close()})}}function Vc(r){return new zo(r)}var zo=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:i,["queueingStrategy"]:n="count"}=t,s=Zo(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Dr(s),this._getSize=n!=="bytes"?Rc:Cc;let{["highWaterMark"]:o=n==="bytes"?Math.pow(2,14):1e3}=Object.assign({},e),{["highWaterMark"]:a=n==="bytes"?Math.pow(2,14):1e3}=Object.assign({},i);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:o,size:n!=="bytes"?Rc:Cc}),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:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let e=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-e}_maybeFlush(t,e){e!=null&&(this._bufferedSize>=e.desiredSize&&++this._numChunks&&this._enqueue(e,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(e,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(e,null)))}_enqueue(t,e){this._bufferedSize=0,this._controller=null,e==null?t.close():t.enqueue(e)}},Rc=r=>{var t;return(t=r?.length)!==null&&t!==void 0?t:0},Cc=r=>{var t;return(t=r?.byteLength)!==null&&t!==void 0?t:0};function Rs(r,t){let e=new Ce,i=null,n=new ReadableStream({cancel(){return m(this,void 0,void 0,function*(){yield e.close()})},start(a){return m(this,void 0,void 0,function*(){yield o(a,i||(i=yield s()))})},pull(a){return m(this,void 0,void 0,function*(){i?yield o(a,i):a.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:n};function s(){return m(this,void 0,void 0,function*(){return yield(yield Tt.from(e)).open(t)})}function o(a,c){return m(this,void 0,void 0,function*(){let l=a.desiredSize,d=null;for(;!(d=yield c.next()).done;)if(a.enqueue(d.value),l!=null&&--l<=0)return;a.close()})}}function Cs(r,t){let e=new this(r),i=new jt(e),n=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 s(o)})},start(o){return m(this,void 0,void 0,function*(){yield s(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,r),readable:n};function s(o){return m(this,void 0,void 0,function*(){let a=null,c=o.desiredSize;for(;a=yield i.read(c||null);)if(o.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;o.close()})}}var Ad=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Xs),Io),po),qs),$s),fo),Js),{compareSchemas:Fr,compareFields:hc,compareTypes:fc});pt.toDOMStream=Ec;q.throughDOM=Vc;Tt.throughDOM=Rs;Lr.throughDOM=Rs;He.throughDOM=Rs;Ur.throughDOM=Cs;Rr.throughDOM=Cs;Er.throughDOM=Cs;function zc(r){return new R(r.fields.map(t=>hn(t)),Pc(r.metadata))}function Pc(r){return r?new Map(Object.entries(r)):new Map}function hn(r){return new F(r.name,ko(r.type),r.nullable,Pc(r.metadata))}function ko(r){if(typeof r=="object")switch(r.type){case"decimal":return new se(r.precision,r.scale,r.bitWidth);case"map":let t=r.children.map(n=>hn(n));return new zt(t,r.keysSorted);case"list":let e=hn(r.children[0]);return new Vt(e);case"fixed-size-list":let i=hn(r.children[0]);return new wt(r.listSize,i);case"struct":return t=r.children.map(n=>hn(n)),new j(t);default:throw new Error("array type not supported")}switch(r){case"null":return new ht;case"binary":return new re;case"bool":return new ne;case"int8":return new ar;case"int16":return new cr;case"int32":return new Ht;case"int64":return new lr;case"uint8":return new ur;case"uint16":return new dr;case"uint32":return new hr;case"uint64":return new fr;case"float16":return new pr;case"float32":return new mr;case"float64":return new yr;case"utf8":return new ie;case"date-day":return new Yr;case"date-millisecond":return new Gr;case"time-second":return new Jr;case"time-millisecond":return new Zr;case"time-microsecond":return new Hr;case"time-nanosecond":return new Kr;case"timestamp-second":return new Xr;case"timestamp-millisecond":return new qr;case"timestamp-microsecond":return new Qr;case"timestamp-nanosecond":return new ti;case"interval-daytime":return new ei;case"interval-yearmonth":return new ri;default:throw new Error("array type not supported")}}function jo(r){let t=1/0,e=1/0,i=1/0,n=-1/0,s=-1/0,o=-1/0,a=r.POSITION?r.POSITION.value:[],c=a&&a.length;for(let l=0;l<c;l+=3){let d=a[l],h=a[l+1],x=a[l+2];t=d<t?d:t,e=h<e?h:e,i=x<i?x:i,n=d>n?d:n,s=h>s?h:s,o=x>o?x:o}return[[t,e,i],[n,s,o]]}function kc(r,t){let e=Td(r,t),i=e.children[0].type,n={[Rt.DATA]:r},s=new E(i,0,r.length,0,n);return new E(e,0,r.length/t,0,void 0,[s])}function Td(r,t){let{type:e}=Go(r),i=ko(e);return new wt(t,new F("value",i))}function Wo(r,t){switch(t){case"columnar-table":return Od(r);case"arrow-table":return Fd(r);default:throw new Error(t)}}function Od(r){let t={};for(let[e,i]of Object.entries(r.attributes))t[e]=i.value;return{shape:"columnar-table",schema:r.schema,data:t}}function Fd(r,t){let{schema:e}=r,i=zc(e),n=[];for(let d in r.attributes){let h=r.attributes[d],{value:x,size:g=1}=h,Y=kc(x,g);n.push(Y)}let s=new j(i.fields),o=n[0].length,a=new E(s,0,o,0,void 0,n),c=new $(i,a),l=new rt([c]);return{shape:"arrow-table",schema:e,data:l}}function jc(r,t){let e=r.length,i=new Uint8Array(t),n=0,s=0,o,a,c;do if(o=r[n++],o<1<<5){if(o++,s+o>t)throw new Error("Output buffer is not large enough");if(n+o>e)throw new Error("Invalid compressed data");do i[s++]=r[n++];while(--o)}else{if(a=o>>5,c=s-((o&31)<<8)-1,n>=e)throw new Error("Invalid compressed data");if(a===7&&(a+=r[n++],n>=e))throw new Error("Invalid compressed data");if(c-=r[n++],s+a+2>t)throw new Error("Output buffer is not large enough");if(c<0)throw new Error("Invalid compressed data");if(c>=s)throw new Error("Invalid compressed data");do i[s++]=i[c++];while(--a+2)}while(n<e);return i}function Wc(r,t){let e=[];for(let i of Object.keys(r.offset))switch(i){case"x":e.push({name:"POSITION",type:{type:"fixed-size-list",listSize:3,children:[{name:"xyz",type:"float32"}]},metadata:{attribute:"POSITION"}});break;case"y":case"z":break;case"normal_x":e.push({name:"NORMAL",type:{type:"fixed-size-list",listSize:3,children:[{name:"xyz",type:"float32"}]},metadata:{attribute:"NORMAL"}});break;case"normal_y":case"normal_z":break;case"rgb":e.push({name:"COLOR_0",type:{type:"fixed-size-list",listSize:3,children:[{name:"rgb",type:"uint8"}]},metadata:{attribute:"COLOR"}});break;default:}return{fields:e,metadata:t}}var It=!0;function fn(r){let t=new TextDecoder().decode(r),e=Ld(t),i={};switch(e.data){case"ascii":i=Ud(e,t);break;case"binary":i=Ed(e,r);break;case"binary_compressed":i=Rd(e,r);break;default:throw new Error(`PCD: ${e.data} files are not supported`)}i=Nd(i);let n=Md(e,i),s=Object.fromEntries([["topology","point-list"],["mode","0"],["boundingBox",JSON.stringify(n.boundingBox)]]),o=Wc(e,s);return{loader:"pcd",loaderData:e,header:n,schema:o,topology:"point-list",mode:0,attributes:i}}function Md(r,t){return typeof r.width=="number"&&typeof r.height=="number"?{vertexCount:r.width*r.height,boundingBox:jo(t)}:{vertexCount:r.vertexCount,boundingBox:r.boundingBox}}function Nd(r){let t={POSITION:{value:new Float32Array(r.position),size:3}};return r.normal&&r.normal.length>0&&(t.NORMAL={value:new Float32Array(r.normal),size:3}),r.color&&r.color.length>0&&(t.COLOR_0={value:new Uint8Array(r.color),size:3}),r.intensity&&r.intensity.length>0&&(t.COLOR_0={value:new Uint8Array(r.color),size:3}),r.label&&r.label.length>0&&(t.COLOR_0={value:new Uint8Array(r.label),size:3}),t}function Ld(r){let t=r.search(/[\r\n]DATA\s(\S*)\s/i),e=/[\r\n]DATA\s(\S*)\s/i.exec(r.substr(t-1)),i={};if(i.data=e&&e[1],e!==null&&(i.headerLen=(e&&e[0].length)+t),i.str=r.substr(0,i.headerLen),i.str=i.str.replace(/\#.*/gi,""),i.version=/VERSION (.*)/i.exec(i.str),i.fields=/FIELDS (.*)/i.exec(i.str),i.size=/SIZE (.*)/i.exec(i.str),i.type=/TYPE (.*)/i.exec(i.str),i.count=/COUNT (.*)/i.exec(i.str),i.width=/WIDTH (.*)/i.exec(i.str),i.height=/HEIGHT (.*)/i.exec(i.str),i.viewpoint=/VIEWPOINT (.*)/i.exec(i.str),i.points=/POINTS (.*)/i.exec(i.str),i.version!==null&&(i.version=parseFloat(i.version[1])),i.fields!==null&&(i.fields=i.fields[1].split(" ")),i.type!==null&&(i.type=i.type[1].split(" ")),i.width!==null&&(i.width=parseInt(i.width[1],10)),i.height!==null&&(i.height=parseInt(i.height[1],10)),i.viewpoint!==null&&(i.viewpoint=i.viewpoint[1]),i.points!==null&&(i.points=parseInt(i.points[1],10)),i.points===null&&typeof i.width=="number"&&typeof i.height=="number"&&(i.points=i.width*i.height),i.size!==null&&(i.size=i.size[1].split(" ").map(s=>parseInt(s,10))),i.count!==null)i.count=i.count[1].split(" ").map(s=>parseInt(s,10));else if(i.count=[],i.fields!==null)for(let s=0;s<i.fields.length;s++)i.count.push(1);i.offset={};let n=0;if(i.fields!==null&&i.size!==null)for(let s=0;s<i.fields.length;s++)i.data==="ascii"?i.offset[i.fields[s]]=s:(i.offset[i.fields[s]]=n,n+=i.size[s]);return i.rowSize=n,i}function Ud(r,t){let e=[],i=[],n=[],s=[],o=[],a=r.offset,l=t.substr(r.headerLen).split(`
|
|
17
|
-
`);for(let d=0;d<l.length;d++)if(l[d]!==""){let h=l[d].split(" ");if(a.x!==void 0&&(e.push(parseFloat(h[a.x])),e.push(parseFloat(h[a.y])),e.push(parseFloat(h[a.z]))),a.rgb!==void 0){let x=parseFloat(h[a.rgb]),g=new Float32Array([x]),Y=new DataView(g.buffer,0);n.push(Y.getUint8(0)),n.push(Y.getUint8(1)),n.push(Y.getUint8(2))}a.normal_x!==void 0&&(i.push(parseFloat(h[a.normal_x])),i.push(parseFloat(h[a.normal_y])),i.push(parseFloat(h[a.normal_z]))),a.intensity!==void 0&&s.push(parseFloat(h[a.intensity])),a.label!==void 0&&o.push(parseInt(h[a.label]))}return{position:e,normal:i,color:n}}function Ed(r,t){let e=[],i=[],n=[],s=[],o=[],a=new DataView(t,r.headerLen),c=r.offset;for(let l=0,d=0;l<r.points;l++,d+=r.rowSize)c.x!==void 0&&(e.push(a.getFloat32(d+c.x,It)),e.push(a.getFloat32(d+c.y,It)),e.push(a.getFloat32(d+c.z,It))),c.rgb!==void 0&&(n.push(a.getUint8(d+c.rgb+0)),n.push(a.getUint8(d+c.rgb+1)),n.push(a.getUint8(d+c.rgb+2))),c.normal_x!==void 0&&(i.push(a.getFloat32(d+c.normal_x,It)),i.push(a.getFloat32(d+c.normal_y,It)),i.push(a.getFloat32(d+c.normal_z,It))),c.intensity!==void 0&&s.push(a.getFloat32(d+c.intensity,It)),c.label!==void 0&&o.push(a.getInt32(d+c.label,It));return{position:e,normal:i,color:n,intensity:s,label:o}}function Rd(r,t){let e=[],i=[],n=[],s=[],o=[],a=new Uint32Array(t.slice(r.headerLen,r.headerLen+8)),c=a[0],l=a[1],d=jc(new Uint8Array(t,r.headerLen+8,c),l),h=new DataView(d.buffer),x=r.offset;for(let g=0;g<r.points;g++){if(x.x!==void 0&&(e.push(h.getFloat32(r.points*x.x+r.size[0]*g,It)),e.push(h.getFloat32(r.points*x.y+r.size[1]*g,It)),e.push(h.getFloat32(r.points*x.z+r.size[2]*g,It))),x.rgb!==void 0&&(n.push(h.getUint8(r.points*x.rgb+r.size[3]*g+0)/255),n.push(h.getUint8(r.points*x.rgb+r.size[3]*g+1)/255),n.push(h.getUint8(r.points*x.rgb+r.size[3]*g+2)/255)),x.normal_x!==void 0&&(i.push(h.getFloat32(r.points*x.normal_x+r.size[4]*g,It)),i.push(h.getFloat32(r.points*x.normal_y+r.size[5]*g,It)),i.push(h.getFloat32(r.points*x.normal_z+r.size[6]*g,It))),x.intensity!==void 0){let Y=r.fields.indexOf("intensity");s.push(h.getFloat32(r.points*x.intensity+r.size[Y]*g,It))}if(x.label!==void 0){let Y=r.fields.indexOf("label");o.push(h.getInt32(r.points*x.label+r.size[Y]*g,It))}}return{position:e,normal:i,color:n,intensity:s,label:o}}var $c={name:"PCD (Point Cloud Data)",id:"pcd",module:"pcd",extensions:["pcd"],mimeTypes:["text/plain"],category:"pointcloud",text:!0,binary:!0};var Cd="4.4.0-alpha.
|
|
17
|
+
`);for(let d=0;d<l.length;d++)if(l[d]!==""){let h=l[d].split(" ");if(a.x!==void 0&&(e.push(parseFloat(h[a.x])),e.push(parseFloat(h[a.y])),e.push(parseFloat(h[a.z]))),a.rgb!==void 0){let x=parseFloat(h[a.rgb]),g=new Float32Array([x]),Y=new DataView(g.buffer,0);n.push(Y.getUint8(0)),n.push(Y.getUint8(1)),n.push(Y.getUint8(2))}a.normal_x!==void 0&&(i.push(parseFloat(h[a.normal_x])),i.push(parseFloat(h[a.normal_y])),i.push(parseFloat(h[a.normal_z]))),a.intensity!==void 0&&s.push(parseFloat(h[a.intensity])),a.label!==void 0&&o.push(parseInt(h[a.label]))}return{position:e,normal:i,color:n}}function Ed(r,t){let e=[],i=[],n=[],s=[],o=[],a=new DataView(t,r.headerLen),c=r.offset;for(let l=0,d=0;l<r.points;l++,d+=r.rowSize)c.x!==void 0&&(e.push(a.getFloat32(d+c.x,It)),e.push(a.getFloat32(d+c.y,It)),e.push(a.getFloat32(d+c.z,It))),c.rgb!==void 0&&(n.push(a.getUint8(d+c.rgb+0)),n.push(a.getUint8(d+c.rgb+1)),n.push(a.getUint8(d+c.rgb+2))),c.normal_x!==void 0&&(i.push(a.getFloat32(d+c.normal_x,It)),i.push(a.getFloat32(d+c.normal_y,It)),i.push(a.getFloat32(d+c.normal_z,It))),c.intensity!==void 0&&s.push(a.getFloat32(d+c.intensity,It)),c.label!==void 0&&o.push(a.getInt32(d+c.label,It));return{position:e,normal:i,color:n,intensity:s,label:o}}function Rd(r,t){let e=[],i=[],n=[],s=[],o=[],a=new Uint32Array(t.slice(r.headerLen,r.headerLen+8)),c=a[0],l=a[1],d=jc(new Uint8Array(t,r.headerLen+8,c),l),h=new DataView(d.buffer),x=r.offset;for(let g=0;g<r.points;g++){if(x.x!==void 0&&(e.push(h.getFloat32(r.points*x.x+r.size[0]*g,It)),e.push(h.getFloat32(r.points*x.y+r.size[1]*g,It)),e.push(h.getFloat32(r.points*x.z+r.size[2]*g,It))),x.rgb!==void 0&&(n.push(h.getUint8(r.points*x.rgb+r.size[3]*g+0)/255),n.push(h.getUint8(r.points*x.rgb+r.size[3]*g+1)/255),n.push(h.getUint8(r.points*x.rgb+r.size[3]*g+2)/255)),x.normal_x!==void 0&&(i.push(h.getFloat32(r.points*x.normal_x+r.size[4]*g,It)),i.push(h.getFloat32(r.points*x.normal_y+r.size[5]*g,It)),i.push(h.getFloat32(r.points*x.normal_z+r.size[6]*g,It))),x.intensity!==void 0){let Y=r.fields.indexOf("intensity");s.push(h.getFloat32(r.points*x.intensity+r.size[Y]*g,It))}if(x.label!==void 0){let Y=r.fields.indexOf("label");o.push(h.getInt32(r.points*x.label+r.size[Y]*g,It))}}return{position:e,normal:i,color:n,intensity:s,label:o}}var $c={name:"PCD (Point Cloud Data)",id:"pcd",module:"pcd",extensions:["pcd"],mimeTypes:["text/plain"],category:"pointcloud",text:!0,binary:!0};var Cd="4.4.0-alpha.1",pn={...$c,dataType:null,batchType:null,version:Cd,worker:!0,options:{pcd:{}}},Yc={...pn,parse:async r=>fn(r),parseSync:fn};var Gc={...pn,dataType:null,batchType:null,worker:!1,parse:async r=>{let t=fn(r);return Wo(t,"arrow-table")}};return el(mn);})();
|
|
18
18
|
/** Parse compressed PCD data in in binary_compressed form ( https://pointclouds.org/documentation/tutorials/pcd_file_format.html)
|
|
19
19
|
* from https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/PCDLoader.js
|
|
20
20
|
* @license MIT (http://opensource.org/licenses/MIT)
|
package/dist/index.cjs
CHANGED
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.js", "lib/parse-pcd.js", "lib/decompress-lzf.js", "lib/get-pcd-schema.js", "pcd-format.js", "pcd-loader.js", "pcd-arrow-loader.js"],
|
|
4
|
-
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nexport { PCDWorkerLoader, PCDLoader } from \"./pcd-loader.js\";\nexport { PCDArrowLoader } from \"./pcd-arrow-loader.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { getMeshBoundingBox } from '@loaders.gl/schema-utils';\nimport { decompressLZF } from \"./decompress-lzf.js\";\nimport { getPCDSchema } from \"./get-pcd-schema.js\";\nconst LITTLE_ENDIAN = true;\n/**\n *\n * @param data\n * @returns\n */\nexport function parsePCD(data) {\n // parse header (always ascii format)\n const textData = new TextDecoder().decode(data);\n const pcdHeader = parsePCDHeader(textData);\n let attributes = {};\n // parse data\n switch (pcdHeader.data) {\n case 'ascii':\n attributes = parsePCDASCII(pcdHeader, textData);\n break;\n case 'binary':\n attributes = parsePCDBinary(pcdHeader, data);\n break;\n case 'binary_compressed':\n attributes = parsePCDBinaryCompressed(pcdHeader, data);\n break;\n default:\n throw new Error(`PCD: ${pcdHeader.data} files are not supported`);\n }\n attributes = getMeshAttributes(attributes);\n const header = getMeshHeader(pcdHeader, attributes);\n const schemaMetadata = Object.fromEntries([\n ['topology', 'point-list'],\n ['mode', '0'],\n ['boundingBox', JSON.stringify(header.boundingBox)]\n ]);\n const schema = getPCDSchema(pcdHeader, schemaMetadata);\n return {\n loader: 'pcd',\n loaderData: pcdHeader,\n header,\n schema,\n topology: 'point-list',\n mode: 0, // POINTS (deprecated)\n attributes\n };\n}\n// Create a header that contains common data for PointCloud category loaders\nfunction getMeshHeader(pcdHeader, attributes) {\n if (typeof pcdHeader.width === 'number' && typeof pcdHeader.height === 'number') {\n const pointCount = pcdHeader.width * pcdHeader.height; // Supports \"organized\" point sets\n return {\n vertexCount: pointCount,\n boundingBox: getMeshBoundingBox(attributes)\n };\n }\n return {\n vertexCount: pcdHeader.vertexCount,\n boundingBox: pcdHeader.boundingBox\n };\n}\n/**\n * @param attributes\n * @returns Normalized attributes\n */\nfunction getMeshAttributes(attributes) {\n const normalizedAttributes = {\n POSITION: {\n // Binary PCD is only 32 bit\n value: new Float32Array(attributes.position),\n size: 3\n }\n };\n if (attributes.normal && attributes.normal.length > 0) {\n normalizedAttributes.NORMAL = {\n value: new Float32Array(attributes.normal),\n size: 3\n };\n }\n if (attributes.color && attributes.color.length > 0) {\n // TODO - RGBA\n normalizedAttributes.COLOR_0 = {\n value: new Uint8Array(attributes.color),\n size: 3\n };\n }\n if (attributes.intensity && attributes.intensity.length > 0) {\n // TODO - RGBA\n normalizedAttributes.COLOR_0 = {\n value: new Uint8Array(attributes.color),\n size: 3\n };\n }\n if (attributes.label && attributes.label.length > 0) {\n // TODO - RGBA\n normalizedAttributes.COLOR_0 = {\n value: new Uint8Array(attributes.label),\n size: 3\n };\n }\n return normalizedAttributes;\n}\n/**\n * Incoming data parsing\n * @param data\n * @returns Header\n */\n/* eslint-disable complexity, max-statements */\nfunction parsePCDHeader(data) {\n const result1 = data.search(/[\\r\\n]DATA\\s(\\S*)\\s/i);\n const result2 = /[\\r\\n]DATA\\s(\\S*)\\s/i.exec(data.substr(result1 - 1));\n const pcdHeader = {};\n pcdHeader.data = result2 && result2[1];\n if (result2 !== null) {\n pcdHeader.headerLen = (result2 && result2[0].length) + result1;\n }\n pcdHeader.str = data.substr(0, pcdHeader.headerLen);\n // remove comments\n pcdHeader.str = pcdHeader.str.replace(/\\#.*/gi, '');\n // parse\n pcdHeader.version = /VERSION (.*)/i.exec(pcdHeader.str);\n pcdHeader.fields = /FIELDS (.*)/i.exec(pcdHeader.str);\n pcdHeader.size = /SIZE (.*)/i.exec(pcdHeader.str);\n pcdHeader.type = /TYPE (.*)/i.exec(pcdHeader.str);\n pcdHeader.count = /COUNT (.*)/i.exec(pcdHeader.str);\n pcdHeader.width = /WIDTH (.*)/i.exec(pcdHeader.str);\n pcdHeader.height = /HEIGHT (.*)/i.exec(pcdHeader.str);\n pcdHeader.viewpoint = /VIEWPOINT (.*)/i.exec(pcdHeader.str);\n pcdHeader.points = /POINTS (.*)/i.exec(pcdHeader.str);\n // evaluate\n if (pcdHeader.version !== null) {\n pcdHeader.version = parseFloat(pcdHeader.version[1]);\n }\n if (pcdHeader.fields !== null) {\n pcdHeader.fields = pcdHeader.fields[1].split(' ');\n }\n if (pcdHeader.type !== null) {\n pcdHeader.type = pcdHeader.type[1].split(' ');\n }\n if (pcdHeader.width !== null) {\n pcdHeader.width = parseInt(pcdHeader.width[1], 10);\n }\n if (pcdHeader.height !== null) {\n pcdHeader.height = parseInt(pcdHeader.height[1], 10);\n }\n if (pcdHeader.viewpoint !== null) {\n pcdHeader.viewpoint = pcdHeader.viewpoint[1];\n }\n if (pcdHeader.points !== null) {\n pcdHeader.points = parseInt(pcdHeader.points[1], 10);\n }\n if (pcdHeader.points === null &&\n typeof pcdHeader.width === 'number' &&\n typeof pcdHeader.height === 'number') {\n pcdHeader.points = pcdHeader.width * pcdHeader.height;\n }\n if (pcdHeader.size !== null) {\n pcdHeader.size = pcdHeader.size[1].split(' ').map((x) => parseInt(x, 10));\n }\n if (pcdHeader.count !== null) {\n pcdHeader.count = pcdHeader.count[1].split(' ').map((x) => parseInt(x, 10));\n }\n else {\n pcdHeader.count = [];\n if (pcdHeader.fields !== null) {\n for (let i = 0; i < pcdHeader.fields.length; i++) {\n pcdHeader.count.push(1);\n }\n }\n }\n pcdHeader.offset = {};\n let sizeSum = 0;\n if (pcdHeader.fields !== null && pcdHeader.size !== null) {\n for (let i = 0; i < pcdHeader.fields.length; i++) {\n if (pcdHeader.data === 'ascii') {\n pcdHeader.offset[pcdHeader.fields[i]] = i;\n }\n else {\n pcdHeader.offset[pcdHeader.fields[i]] = sizeSum;\n sizeSum += pcdHeader.size[i];\n }\n }\n }\n // for binary only\n pcdHeader.rowSize = sizeSum;\n return pcdHeader;\n}\n/**\n * @param pcdHeader\n * @param textData\n * @returns [attributes]\n */\n// eslint-enable-next-line complexity, max-statements\nfunction parsePCDASCII(pcdHeader, textData) {\n const position = [];\n const normal = [];\n const color = [];\n const intensity = [];\n const label = [];\n const offset = pcdHeader.offset;\n const pcdData = textData.substr(pcdHeader.headerLen);\n const lines = pcdData.split('\\n');\n for (let i = 0; i < lines.length; i++) {\n if (lines[i] !== '') {\n const line = lines[i].split(' ');\n if (offset.x !== undefined) {\n position.push(parseFloat(line[offset.x]));\n position.push(parseFloat(line[offset.y]));\n position.push(parseFloat(line[offset.z]));\n }\n if (offset.rgb !== undefined) {\n const floatValue = parseFloat(line[offset.rgb]);\n const binaryColor = new Float32Array([floatValue]);\n const dataview = new DataView(binaryColor.buffer, 0);\n color.push(dataview.getUint8(0));\n color.push(dataview.getUint8(1));\n color.push(dataview.getUint8(2));\n // TODO - handle alpha channel / RGBA?\n }\n if (offset.normal_x !== undefined) {\n normal.push(parseFloat(line[offset.normal_x]));\n normal.push(parseFloat(line[offset.normal_y]));\n normal.push(parseFloat(line[offset.normal_z]));\n }\n if (offset.intensity !== undefined) {\n intensity.push(parseFloat(line[offset.intensity]));\n }\n if (offset.label !== undefined) {\n label.push(parseInt(line[offset.label]));\n }\n }\n }\n return { position, normal, color };\n}\n/**\n * @param pcdHeader\n * @param data\n * @returns [attributes]\n */\nfunction parsePCDBinary(pcdHeader, data) {\n const position = [];\n const normal = [];\n const color = [];\n const intensity = [];\n const label = [];\n const dataview = new DataView(data, pcdHeader.headerLen);\n const offset = pcdHeader.offset;\n for (let i = 0, row = 0; i < pcdHeader.points; i++, row += pcdHeader.rowSize) {\n if (offset.x !== undefined) {\n position.push(dataview.getFloat32(row + offset.x, LITTLE_ENDIAN));\n position.push(dataview.getFloat32(row + offset.y, LITTLE_ENDIAN));\n position.push(dataview.getFloat32(row + offset.z, LITTLE_ENDIAN));\n }\n if (offset.rgb !== undefined) {\n color.push(dataview.getUint8(row + offset.rgb + 0));\n color.push(dataview.getUint8(row + offset.rgb + 1));\n color.push(dataview.getUint8(row + offset.rgb + 2));\n }\n if (offset.normal_x !== undefined) {\n normal.push(dataview.getFloat32(row + offset.normal_x, LITTLE_ENDIAN));\n normal.push(dataview.getFloat32(row + offset.normal_y, LITTLE_ENDIAN));\n normal.push(dataview.getFloat32(row + offset.normal_z, LITTLE_ENDIAN));\n }\n if (offset.intensity !== undefined) {\n intensity.push(dataview.getFloat32(row + offset.intensity, LITTLE_ENDIAN));\n }\n if (offset.label !== undefined) {\n label.push(dataview.getInt32(row + offset.label, LITTLE_ENDIAN));\n }\n }\n return { position, normal, color, intensity, label };\n}\n/** Parse compressed PCD data in in binary_compressed form ( https://pointclouds.org/documentation/tutorials/pcd_file_format.html)\n * from https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/PCDLoader.js\n * @license MIT (http://opensource.org/licenses/MIT)\n * @param pcdHeader\n * @param data\n * @returns [attributes]\n */\n// eslint-enable-next-line complexity, max-statements\nfunction parsePCDBinaryCompressed(pcdHeader, data) {\n const position = [];\n const normal = [];\n const color = [];\n const intensity = [];\n const label = [];\n const sizes = new Uint32Array(data.slice(pcdHeader.headerLen, pcdHeader.headerLen + 8));\n const compressedSize = sizes[0];\n const decompressedSize = sizes[1];\n const decompressed = decompressLZF(new Uint8Array(data, pcdHeader.headerLen + 8, compressedSize), decompressedSize);\n const dataview = new DataView(decompressed.buffer);\n const offset = pcdHeader.offset;\n for (let i = 0; i < pcdHeader.points; i++) {\n if (offset.x !== undefined) {\n position.push(dataview.getFloat32(pcdHeader.points * offset.x + pcdHeader.size[0] * i, LITTLE_ENDIAN));\n position.push(dataview.getFloat32(pcdHeader.points * offset.y + pcdHeader.size[1] * i, LITTLE_ENDIAN));\n position.push(dataview.getFloat32(pcdHeader.points * offset.z + pcdHeader.size[2] * i, LITTLE_ENDIAN));\n }\n if (offset.rgb !== undefined) {\n color.push(dataview.getUint8(pcdHeader.points * offset.rgb + pcdHeader.size[3] * i + 0) / 255.0);\n color.push(dataview.getUint8(pcdHeader.points * offset.rgb + pcdHeader.size[3] * i + 1) / 255.0);\n color.push(dataview.getUint8(pcdHeader.points * offset.rgb + pcdHeader.size[3] * i + 2) / 255.0);\n }\n if (offset.normal_x !== undefined) {\n normal.push(dataview.getFloat32(pcdHeader.points * offset.normal_x + pcdHeader.size[4] * i, LITTLE_ENDIAN));\n normal.push(dataview.getFloat32(pcdHeader.points * offset.normal_y + pcdHeader.size[5] * i, LITTLE_ENDIAN));\n normal.push(dataview.getFloat32(pcdHeader.points * offset.normal_z + pcdHeader.size[6] * i, LITTLE_ENDIAN));\n }\n if (offset.intensity !== undefined) {\n const intensityIndex = pcdHeader.fields.indexOf('intensity');\n intensity.push(dataview.getFloat32(pcdHeader.points * offset.intensity + pcdHeader.size[intensityIndex] * i, LITTLE_ENDIAN));\n }\n if (offset.label !== undefined) {\n const labelIndex = pcdHeader.fields.indexOf('label');\n label.push(dataview.getInt32(pcdHeader.points * offset.label + pcdHeader.size[labelIndex] * i, LITTLE_ENDIAN));\n }\n }\n return {\n position,\n normal,\n color,\n intensity,\n label\n };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://gitlab.com/taketwo/three-pcd-loader/blob/master/decompress-lzf.js\n/* eslint-disable */\n/**\n * @param inData\n * @param outLength\n * @returns\n */\nexport function decompressLZF(inData, outLength) {\n const inLength = inData.length;\n const outData = new Uint8Array(outLength);\n let inPtr = 0;\n let outPtr = 0;\n let ctrl;\n let len;\n let ref;\n do {\n ctrl = inData[inPtr++];\n if (ctrl < 1 << 5) {\n ctrl++;\n if (outPtr + ctrl > outLength) {\n throw new Error('Output buffer is not large enough');\n }\n if (inPtr + ctrl > inLength) {\n throw new Error('Invalid compressed data');\n }\n do {\n outData[outPtr++] = inData[inPtr++];\n } while (--ctrl);\n }\n else {\n len = ctrl >> 5;\n ref = outPtr - ((ctrl & 0x1f) << 8) - 1;\n if (inPtr >= inLength) {\n throw new Error('Invalid compressed data');\n }\n if (len === 7) {\n len += inData[inPtr++];\n if (inPtr >= inLength) {\n throw new Error('Invalid compressed data');\n }\n }\n ref -= inData[inPtr++];\n if (outPtr + len + 2 > outLength) {\n throw new Error('Output buffer is not large enough');\n }\n if (ref < 0) {\n throw new Error('Invalid compressed data');\n }\n if (ref >= outPtr) {\n throw new Error('Invalid compressed data');\n }\n do {\n outData[outPtr++] = outData[ref++];\n } while (--len + 2);\n }\n } while (inPtr < inLength);\n return outData;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * Gets schema from PCD header\n * @param PCDheader\n * @param metadata\n * @returns Schema\n */\nexport function getPCDSchema(PCDheader, metadata) {\n const fields = [];\n for (const key of Object.keys(PCDheader.offset)) {\n switch (key) {\n case 'x':\n fields.push({\n name: 'POSITION',\n type: { type: 'fixed-size-list', listSize: 3, children: [{ name: 'xyz', type: 'float32' }] },\n metadata: { attribute: 'POSITION' }\n });\n break;\n case 'y':\n case 'z':\n // ignore\n break;\n case 'normal_x':\n fields.push({\n name: 'NORMAL',\n type: { type: 'fixed-size-list', listSize: 3, children: [{ name: 'xyz', type: 'float32' }] },\n metadata: { attribute: 'NORMAL' }\n });\n break;\n case 'normal_y':\n case 'normal_z':\n // ignore\n break;\n case 'rgb':\n fields.push({\n name: 'COLOR_0',\n type: { type: 'fixed-size-list', listSize: 3, children: [{ name: 'rgb', type: 'uint8' }] },\n metadata: { attribute: 'COLOR' }\n });\n break;\n default:\n // TODO - push fields\n }\n }\n return { fields, metadata };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * PCD (Point Cloud Data) file format\n */\nexport const PCDFormat = {\n name: 'PCD (Point Cloud Data)',\n id: 'pcd',\n module: 'pcd',\n extensions: ['pcd'],\n mimeTypes: ['text/plain'],\n category: 'pointcloud',\n text: true,\n binary: true\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { parsePCD } from \"./lib/parse-pcd.js\";\nimport { PCDFormat } from \"./pcd-format.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.4.0-alpha.0\" !== 'undefined' ? \"4.4.0-alpha.0\" : 'latest';\n/**\n * Worker loader for PCD - Point Cloud Data\n */\nexport const PCDWorkerLoader = {\n ...PCDFormat,\n dataType: null,\n batchType: null,\n version: VERSION,\n worker: true,\n options: {\n pcd: {}\n }\n};\n/**\n * Loader for PCD - Point Cloud Data\n */\nexport const PCDLoader = {\n ...PCDWorkerLoader,\n parse: async (arrayBuffer) => parsePCD(arrayBuffer),\n parseSync: parsePCD\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { PCDWorkerLoader } from \"./pcd-loader.js\";\nimport { convertMeshToTable } from '@loaders.gl/schema-utils';\nimport { parsePCD } from \"./lib/parse-pcd.js\";\n/**\n * Worker loader for PCD - Point Cloud Data\n */\nexport const PCDArrowLoader = {\n ...PCDWorkerLoader,\n dataType: null,\n batchType: null,\n worker: false,\n parse: async (arrayBuffer) => {\n const mesh = parsePCD(arrayBuffer);\n const arrowTable = convertMeshToTable(mesh, 'arrow-table');\n return arrowTable;\n }\n};\n"],
|
|
4
|
+
"sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright vis.gl contributors\nexport { PCDWorkerLoader, PCDLoader } from \"./pcd-loader.js\";\nexport { PCDArrowLoader } from \"./pcd-arrow-loader.js\";\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { getMeshBoundingBox } from '@loaders.gl/schema-utils';\nimport { decompressLZF } from \"./decompress-lzf.js\";\nimport { getPCDSchema } from \"./get-pcd-schema.js\";\nconst LITTLE_ENDIAN = true;\n/**\n *\n * @param data\n * @returns\n */\nexport function parsePCD(data) {\n // parse header (always ascii format)\n const textData = new TextDecoder().decode(data);\n const pcdHeader = parsePCDHeader(textData);\n let attributes = {};\n // parse data\n switch (pcdHeader.data) {\n case 'ascii':\n attributes = parsePCDASCII(pcdHeader, textData);\n break;\n case 'binary':\n attributes = parsePCDBinary(pcdHeader, data);\n break;\n case 'binary_compressed':\n attributes = parsePCDBinaryCompressed(pcdHeader, data);\n break;\n default:\n throw new Error(`PCD: ${pcdHeader.data} files are not supported`);\n }\n attributes = getMeshAttributes(attributes);\n const header = getMeshHeader(pcdHeader, attributes);\n const schemaMetadata = Object.fromEntries([\n ['topology', 'point-list'],\n ['mode', '0'],\n ['boundingBox', JSON.stringify(header.boundingBox)]\n ]);\n const schema = getPCDSchema(pcdHeader, schemaMetadata);\n return {\n loader: 'pcd',\n loaderData: pcdHeader,\n header,\n schema,\n topology: 'point-list',\n mode: 0, // POINTS (deprecated)\n attributes\n };\n}\n// Create a header that contains common data for PointCloud category loaders\nfunction getMeshHeader(pcdHeader, attributes) {\n if (typeof pcdHeader.width === 'number' && typeof pcdHeader.height === 'number') {\n const pointCount = pcdHeader.width * pcdHeader.height; // Supports \"organized\" point sets\n return {\n vertexCount: pointCount,\n boundingBox: getMeshBoundingBox(attributes)\n };\n }\n return {\n vertexCount: pcdHeader.vertexCount,\n boundingBox: pcdHeader.boundingBox\n };\n}\n/**\n * @param attributes\n * @returns Normalized attributes\n */\nfunction getMeshAttributes(attributes) {\n const normalizedAttributes = {\n POSITION: {\n // Binary PCD is only 32 bit\n value: new Float32Array(attributes.position),\n size: 3\n }\n };\n if (attributes.normal && attributes.normal.length > 0) {\n normalizedAttributes.NORMAL = {\n value: new Float32Array(attributes.normal),\n size: 3\n };\n }\n if (attributes.color && attributes.color.length > 0) {\n // TODO - RGBA\n normalizedAttributes.COLOR_0 = {\n value: new Uint8Array(attributes.color),\n size: 3\n };\n }\n if (attributes.intensity && attributes.intensity.length > 0) {\n // TODO - RGBA\n normalizedAttributes.COLOR_0 = {\n value: new Uint8Array(attributes.color),\n size: 3\n };\n }\n if (attributes.label && attributes.label.length > 0) {\n // TODO - RGBA\n normalizedAttributes.COLOR_0 = {\n value: new Uint8Array(attributes.label),\n size: 3\n };\n }\n return normalizedAttributes;\n}\n/**\n * Incoming data parsing\n * @param data\n * @returns Header\n */\n/* eslint-disable complexity, max-statements */\nfunction parsePCDHeader(data) {\n const result1 = data.search(/[\\r\\n]DATA\\s(\\S*)\\s/i);\n const result2 = /[\\r\\n]DATA\\s(\\S*)\\s/i.exec(data.substr(result1 - 1));\n const pcdHeader = {};\n pcdHeader.data = result2 && result2[1];\n if (result2 !== null) {\n pcdHeader.headerLen = (result2 && result2[0].length) + result1;\n }\n pcdHeader.str = data.substr(0, pcdHeader.headerLen);\n // remove comments\n pcdHeader.str = pcdHeader.str.replace(/\\#.*/gi, '');\n // parse\n pcdHeader.version = /VERSION (.*)/i.exec(pcdHeader.str);\n pcdHeader.fields = /FIELDS (.*)/i.exec(pcdHeader.str);\n pcdHeader.size = /SIZE (.*)/i.exec(pcdHeader.str);\n pcdHeader.type = /TYPE (.*)/i.exec(pcdHeader.str);\n pcdHeader.count = /COUNT (.*)/i.exec(pcdHeader.str);\n pcdHeader.width = /WIDTH (.*)/i.exec(pcdHeader.str);\n pcdHeader.height = /HEIGHT (.*)/i.exec(pcdHeader.str);\n pcdHeader.viewpoint = /VIEWPOINT (.*)/i.exec(pcdHeader.str);\n pcdHeader.points = /POINTS (.*)/i.exec(pcdHeader.str);\n // evaluate\n if (pcdHeader.version !== null) {\n pcdHeader.version = parseFloat(pcdHeader.version[1]);\n }\n if (pcdHeader.fields !== null) {\n pcdHeader.fields = pcdHeader.fields[1].split(' ');\n }\n if (pcdHeader.type !== null) {\n pcdHeader.type = pcdHeader.type[1].split(' ');\n }\n if (pcdHeader.width !== null) {\n pcdHeader.width = parseInt(pcdHeader.width[1], 10);\n }\n if (pcdHeader.height !== null) {\n pcdHeader.height = parseInt(pcdHeader.height[1], 10);\n }\n if (pcdHeader.viewpoint !== null) {\n pcdHeader.viewpoint = pcdHeader.viewpoint[1];\n }\n if (pcdHeader.points !== null) {\n pcdHeader.points = parseInt(pcdHeader.points[1], 10);\n }\n if (pcdHeader.points === null &&\n typeof pcdHeader.width === 'number' &&\n typeof pcdHeader.height === 'number') {\n pcdHeader.points = pcdHeader.width * pcdHeader.height;\n }\n if (pcdHeader.size !== null) {\n pcdHeader.size = pcdHeader.size[1].split(' ').map((x) => parseInt(x, 10));\n }\n if (pcdHeader.count !== null) {\n pcdHeader.count = pcdHeader.count[1].split(' ').map((x) => parseInt(x, 10));\n }\n else {\n pcdHeader.count = [];\n if (pcdHeader.fields !== null) {\n for (let i = 0; i < pcdHeader.fields.length; i++) {\n pcdHeader.count.push(1);\n }\n }\n }\n pcdHeader.offset = {};\n let sizeSum = 0;\n if (pcdHeader.fields !== null && pcdHeader.size !== null) {\n for (let i = 0; i < pcdHeader.fields.length; i++) {\n if (pcdHeader.data === 'ascii') {\n pcdHeader.offset[pcdHeader.fields[i]] = i;\n }\n else {\n pcdHeader.offset[pcdHeader.fields[i]] = sizeSum;\n sizeSum += pcdHeader.size[i];\n }\n }\n }\n // for binary only\n pcdHeader.rowSize = sizeSum;\n return pcdHeader;\n}\n/**\n * @param pcdHeader\n * @param textData\n * @returns [attributes]\n */\n// eslint-enable-next-line complexity, max-statements\nfunction parsePCDASCII(pcdHeader, textData) {\n const position = [];\n const normal = [];\n const color = [];\n const intensity = [];\n const label = [];\n const offset = pcdHeader.offset;\n const pcdData = textData.substr(pcdHeader.headerLen);\n const lines = pcdData.split('\\n');\n for (let i = 0; i < lines.length; i++) {\n if (lines[i] !== '') {\n const line = lines[i].split(' ');\n if (offset.x !== undefined) {\n position.push(parseFloat(line[offset.x]));\n position.push(parseFloat(line[offset.y]));\n position.push(parseFloat(line[offset.z]));\n }\n if (offset.rgb !== undefined) {\n const floatValue = parseFloat(line[offset.rgb]);\n const binaryColor = new Float32Array([floatValue]);\n const dataview = new DataView(binaryColor.buffer, 0);\n color.push(dataview.getUint8(0));\n color.push(dataview.getUint8(1));\n color.push(dataview.getUint8(2));\n // TODO - handle alpha channel / RGBA?\n }\n if (offset.normal_x !== undefined) {\n normal.push(parseFloat(line[offset.normal_x]));\n normal.push(parseFloat(line[offset.normal_y]));\n normal.push(parseFloat(line[offset.normal_z]));\n }\n if (offset.intensity !== undefined) {\n intensity.push(parseFloat(line[offset.intensity]));\n }\n if (offset.label !== undefined) {\n label.push(parseInt(line[offset.label]));\n }\n }\n }\n return { position, normal, color };\n}\n/**\n * @param pcdHeader\n * @param data\n * @returns [attributes]\n */\nfunction parsePCDBinary(pcdHeader, data) {\n const position = [];\n const normal = [];\n const color = [];\n const intensity = [];\n const label = [];\n const dataview = new DataView(data, pcdHeader.headerLen);\n const offset = pcdHeader.offset;\n for (let i = 0, row = 0; i < pcdHeader.points; i++, row += pcdHeader.rowSize) {\n if (offset.x !== undefined) {\n position.push(dataview.getFloat32(row + offset.x, LITTLE_ENDIAN));\n position.push(dataview.getFloat32(row + offset.y, LITTLE_ENDIAN));\n position.push(dataview.getFloat32(row + offset.z, LITTLE_ENDIAN));\n }\n if (offset.rgb !== undefined) {\n color.push(dataview.getUint8(row + offset.rgb + 0));\n color.push(dataview.getUint8(row + offset.rgb + 1));\n color.push(dataview.getUint8(row + offset.rgb + 2));\n }\n if (offset.normal_x !== undefined) {\n normal.push(dataview.getFloat32(row + offset.normal_x, LITTLE_ENDIAN));\n normal.push(dataview.getFloat32(row + offset.normal_y, LITTLE_ENDIAN));\n normal.push(dataview.getFloat32(row + offset.normal_z, LITTLE_ENDIAN));\n }\n if (offset.intensity !== undefined) {\n intensity.push(dataview.getFloat32(row + offset.intensity, LITTLE_ENDIAN));\n }\n if (offset.label !== undefined) {\n label.push(dataview.getInt32(row + offset.label, LITTLE_ENDIAN));\n }\n }\n return { position, normal, color, intensity, label };\n}\n/** Parse compressed PCD data in in binary_compressed form ( https://pointclouds.org/documentation/tutorials/pcd_file_format.html)\n * from https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/PCDLoader.js\n * @license MIT (http://opensource.org/licenses/MIT)\n * @param pcdHeader\n * @param data\n * @returns [attributes]\n */\n// eslint-enable-next-line complexity, max-statements\nfunction parsePCDBinaryCompressed(pcdHeader, data) {\n const position = [];\n const normal = [];\n const color = [];\n const intensity = [];\n const label = [];\n const sizes = new Uint32Array(data.slice(pcdHeader.headerLen, pcdHeader.headerLen + 8));\n const compressedSize = sizes[0];\n const decompressedSize = sizes[1];\n const decompressed = decompressLZF(new Uint8Array(data, pcdHeader.headerLen + 8, compressedSize), decompressedSize);\n const dataview = new DataView(decompressed.buffer);\n const offset = pcdHeader.offset;\n for (let i = 0; i < pcdHeader.points; i++) {\n if (offset.x !== undefined) {\n position.push(dataview.getFloat32(pcdHeader.points * offset.x + pcdHeader.size[0] * i, LITTLE_ENDIAN));\n position.push(dataview.getFloat32(pcdHeader.points * offset.y + pcdHeader.size[1] * i, LITTLE_ENDIAN));\n position.push(dataview.getFloat32(pcdHeader.points * offset.z + pcdHeader.size[2] * i, LITTLE_ENDIAN));\n }\n if (offset.rgb !== undefined) {\n color.push(dataview.getUint8(pcdHeader.points * offset.rgb + pcdHeader.size[3] * i + 0) / 255.0);\n color.push(dataview.getUint8(pcdHeader.points * offset.rgb + pcdHeader.size[3] * i + 1) / 255.0);\n color.push(dataview.getUint8(pcdHeader.points * offset.rgb + pcdHeader.size[3] * i + 2) / 255.0);\n }\n if (offset.normal_x !== undefined) {\n normal.push(dataview.getFloat32(pcdHeader.points * offset.normal_x + pcdHeader.size[4] * i, LITTLE_ENDIAN));\n normal.push(dataview.getFloat32(pcdHeader.points * offset.normal_y + pcdHeader.size[5] * i, LITTLE_ENDIAN));\n normal.push(dataview.getFloat32(pcdHeader.points * offset.normal_z + pcdHeader.size[6] * i, LITTLE_ENDIAN));\n }\n if (offset.intensity !== undefined) {\n const intensityIndex = pcdHeader.fields.indexOf('intensity');\n intensity.push(dataview.getFloat32(pcdHeader.points * offset.intensity + pcdHeader.size[intensityIndex] * i, LITTLE_ENDIAN));\n }\n if (offset.label !== undefined) {\n const labelIndex = pcdHeader.fields.indexOf('label');\n label.push(dataview.getInt32(pcdHeader.points * offset.label + pcdHeader.size[labelIndex] * i, LITTLE_ENDIAN));\n }\n }\n return {\n position,\n normal,\n color,\n intensity,\n label\n };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n// Forked from https://gitlab.com/taketwo/three-pcd-loader/blob/master/decompress-lzf.js\n/* eslint-disable */\n/**\n * @param inData\n * @param outLength\n * @returns\n */\nexport function decompressLZF(inData, outLength) {\n const inLength = inData.length;\n const outData = new Uint8Array(outLength);\n let inPtr = 0;\n let outPtr = 0;\n let ctrl;\n let len;\n let ref;\n do {\n ctrl = inData[inPtr++];\n if (ctrl < 1 << 5) {\n ctrl++;\n if (outPtr + ctrl > outLength) {\n throw new Error('Output buffer is not large enough');\n }\n if (inPtr + ctrl > inLength) {\n throw new Error('Invalid compressed data');\n }\n do {\n outData[outPtr++] = inData[inPtr++];\n } while (--ctrl);\n }\n else {\n len = ctrl >> 5;\n ref = outPtr - ((ctrl & 0x1f) << 8) - 1;\n if (inPtr >= inLength) {\n throw new Error('Invalid compressed data');\n }\n if (len === 7) {\n len += inData[inPtr++];\n if (inPtr >= inLength) {\n throw new Error('Invalid compressed data');\n }\n }\n ref -= inData[inPtr++];\n if (outPtr + len + 2 > outLength) {\n throw new Error('Output buffer is not large enough');\n }\n if (ref < 0) {\n throw new Error('Invalid compressed data');\n }\n if (ref >= outPtr) {\n throw new Error('Invalid compressed data');\n }\n do {\n outData[outPtr++] = outData[ref++];\n } while (--len + 2);\n }\n } while (inPtr < inLength);\n return outData;\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * Gets schema from PCD header\n * @param PCDheader\n * @param metadata\n * @returns Schema\n */\nexport function getPCDSchema(PCDheader, metadata) {\n const fields = [];\n for (const key of Object.keys(PCDheader.offset)) {\n switch (key) {\n case 'x':\n fields.push({\n name: 'POSITION',\n type: { type: 'fixed-size-list', listSize: 3, children: [{ name: 'xyz', type: 'float32' }] },\n metadata: { attribute: 'POSITION' }\n });\n break;\n case 'y':\n case 'z':\n // ignore\n break;\n case 'normal_x':\n fields.push({\n name: 'NORMAL',\n type: { type: 'fixed-size-list', listSize: 3, children: [{ name: 'xyz', type: 'float32' }] },\n metadata: { attribute: 'NORMAL' }\n });\n break;\n case 'normal_y':\n case 'normal_z':\n // ignore\n break;\n case 'rgb':\n fields.push({\n name: 'COLOR_0',\n type: { type: 'fixed-size-list', listSize: 3, children: [{ name: 'rgb', type: 'uint8' }] },\n metadata: { attribute: 'COLOR' }\n });\n break;\n default:\n // TODO - push fields\n }\n }\n return { fields, metadata };\n}\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n/**\n * PCD (Point Cloud Data) file format\n */\nexport const PCDFormat = {\n name: 'PCD (Point Cloud Data)',\n id: 'pcd',\n module: 'pcd',\n extensions: ['pcd'],\n mimeTypes: ['text/plain'],\n category: 'pointcloud',\n text: true,\n binary: true\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { parsePCD } from \"./lib/parse-pcd.js\";\nimport { PCDFormat } from \"./pcd-format.js\";\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof \"4.4.0-alpha.1\" !== 'undefined' ? \"4.4.0-alpha.1\" : 'latest';\n/**\n * Worker loader for PCD - Point Cloud Data\n */\nexport const PCDWorkerLoader = {\n ...PCDFormat,\n dataType: null,\n batchType: null,\n version: VERSION,\n worker: true,\n options: {\n pcd: {}\n }\n};\n/**\n * Loader for PCD - Point Cloud Data\n */\nexport const PCDLoader = {\n ...PCDWorkerLoader,\n parse: async (arrayBuffer) => parsePCD(arrayBuffer),\n parseSync: parsePCD\n};\n", "// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\nimport { PCDWorkerLoader } from \"./pcd-loader.js\";\nimport { convertMeshToTable } from '@loaders.gl/schema-utils';\nimport { parsePCD } from \"./lib/parse-pcd.js\";\n/**\n * Worker loader for PCD - Point Cloud Data\n */\nexport const PCDArrowLoader = {\n ...PCDWorkerLoader,\n dataType: null,\n batchType: null,\n worker: false,\n parse: async (arrayBuffer) => {\n const mesh = parsePCD(arrayBuffer);\n const arrowTable = convertMeshToTable(mesh, 'arrow-table');\n return arrowTable;\n }\n};\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,0BAAmC;;;ACO5B,SAAS,cAAc,QAAQ,WAAW;AAC7C,QAAM,WAAW,OAAO;AACxB,QAAM,UAAU,IAAI,WAAW,SAAS;AACxC,MAAI,QAAQ;AACZ,MAAI,SAAS;AACb,MAAI;AACJ,MAAI;AACJ,MAAI;AACJ,KAAG;AACC,WAAO,OAAO,OAAO;AACrB,QAAI,OAAO,KAAK,GAAG;AACf;AACA,UAAI,SAAS,OAAO,WAAW;AAC3B,cAAM,IAAI,MAAM,mCAAmC;A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H,OAAO,OAAO,gBAAgB,SAAS,WAAW;AAAA,EAClD,WAAW;AACf;;;ACxBA,IAAAA,uBAAmC;AAK5B,IAAM,iBAAiB;AAAA,EAC1B,GAAG;AAAA,EACH,UAAU;AAAA,EACV,WAAW;AAAA,EACX,QAAQ;AAAA,EACR,OAAO,OAAO,gBAAgB;AAC1B,UAAM,OAAO,SAAS,WAAW;AACjC,UAAM,iBAAa,yCAAmB,MAAM,aAAa;AACzD,WAAO;AAAA,EACX;AACJ;",
|
|
6
6
|
"names": ["import_schema_utils"]
|
|
7
7
|
}
|
package/dist/pcd-loader.js
CHANGED
|
@@ -5,7 +5,7 @@ import { parsePCD } from "./lib/parse-pcd.js";
|
|
|
5
5
|
import { PCDFormat } from "./pcd-format.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.1" !== 'undefined' ? "4.4.0-alpha.1" : 'latest';
|
|
9
9
|
/**
|
|
10
10
|
* Worker loader for PCD - Point Cloud Data
|
|
11
11
|
*/
|
package/dist/pcd-worker.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/pcd",
|
|
3
|
-
"version": "4.4.0-alpha.
|
|
3
|
+
"version": "4.4.0-alpha.2",
|
|
4
4
|
"description": "Framework-independent loader for the PCD format",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"build-worker": "esbuild src/workers/pcd-worker.ts --bundle --outfile=dist/pcd-worker.js --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@loaders.gl/loader-utils": "4.4.0-alpha.
|
|
46
|
-
"@loaders.gl/schema": "4.4.0-alpha.
|
|
47
|
-
"@loaders.gl/schema-utils": "4.4.0-alpha.
|
|
45
|
+
"@loaders.gl/loader-utils": "4.4.0-alpha.2",
|
|
46
|
+
"@loaders.gl/schema": "4.4.0-alpha.2",
|
|
47
|
+
"@loaders.gl/schema-utils": "4.4.0-alpha.2"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@loaders.gl/core": "4.4.0-alpha.
|
|
50
|
+
"@loaders.gl/core": "4.4.0-alpha.1"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "3d9fed050eabdc0812ddf2f4d5fb9914a34ee0c2"
|
|
53
53
|
}
|