@loaders.gl/pcd 3.1.0-alpha.3 → 4.0.0-alpha.4

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.
@@ -1,2 +1,832 @@
1
- !function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=19)}([function(t,e){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,r){var n=r(14);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&n(t,e)},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}t.exports=function(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,r){t.exports=r(13)},function(t,e){function r(t,e,r,n,o,i,a){try{var u=t[i](a),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,o)}t.exports=function(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var a=t.apply(e,n);function u(t){r(a,o,i,u,s,"next",t)}function s(t){r(a,o,i,u,s,"throw",t)}u(void 0)}))}},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){function r(e){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(t.exports=r=function(t){return typeof t},t.exports.default=t.exports,t.exports.__esModule=!0):(t.exports=r=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.default=t.exports,t.exports.__esModule=!0),r(e)}t.exports=r,t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){function r(e){return t.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},t.exports.default=t.exports,t.exports.__esModule=!0,r(e)}t.exports=r,t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,r){var n=r(15),o=r(16),i=r(17),a=r(18);t.exports=function(t){return n(t)||o(t)||i(t)||a()},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,r){var n=r(7).default,o=r(4);t.exports=function(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?o(t):e},t.exports.default=t.exports,t.exports.__esModule=!0},,function(t,e,r){var n=function(t){"use strict";var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new O(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return I()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=b(a,r);if(u){if(u===l)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=c(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(t,r,a),i}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var l={};function f(){}function p(){}function d(){}var y={};y[o]=function(){return this};var h=Object.getPrototypeOf,v=h&&h(h(_([])));v&&v!==e&&r.call(v,o)&&(y=v);var m=d.prototype=f.prototype=Object.create(y);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,u){var s=c(t[o],t,i);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,u)}))}u(s.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function b(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=c(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function w(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function _(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:I}}function I(){return{value:void 0,done:!0}}return p.prototype=m.constructor=d,d.constructor=p,p.displayName=u(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(x.prototype),x.prototype[i]=function(){return this},t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(m),u(m,a,"Generator"),m[o]=function(){return this},m.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=_,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(u&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:_(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=n}catch(t){Function("r","regeneratorRuntime = r")(n)}},function(t,e){function r(e,n){return t.exports=r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},t.exports.default=t.exports,t.exports.__esModule=!0,r(e,n)}t.exports=r,t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,r){var n=r(10);t.exports=function(t){if(Array.isArray(t))return n(t)},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,r){var n=r(10);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.default=t.exports,t.exports.__esModule=!0},function(t,e,r){"use strict";r.r(e);var n=r(2),o=r.n(n),i=r(6),a=r.n(i),u=r(5),s=r.n(u),c=r(0),l=r.n(c),f=r(3),p=r.n(f),d=r(7),y=r.n(d);function h(t){return!!t&&(t instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&t instanceof MessagePort||("undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas)))}var v=new Map,m=function(){function t(){l()(this,t)}return p()(t,null,[{key:"onmessage",set:function(t){self.onmessage=function(e){if(g(e)){var r=e.data,n=r.type,o=r.payload;t(n,o)}}}},{key:"addEventListener",value:function(t){var e=v.get(t);e||(e=function(e){if(g(e)){var r=e.data,n=r.type,o=r.payload;t(n,o)}}),self.addEventListener("message",e)}},{key:"removeEventListener",value:function(t){var e=v.get(t);v.delete(t),self.removeEventListener("message",e)}},{key:"postMessage",value:function(t,e){if(self){var r={source:"loaders.gl",type:t,payload:e},n=function t(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,o=n||new Set;if(e){if(h(e))o.add(e);else if(h(e.buffer))o.add(e.buffer);else if(ArrayBuffer.isView(e));else if(r&&"object"===y()(e))for(var i in e)t(e[i],r,o)}else;return void 0===n?Array.from(o):[]}(e);self.postMessage(r,n)}}}]),t}();function g(t){var e=t.type,r=t.data;return"message"===e&&r&&"string"==typeof r.source&&r.source.startsWith("loaders.gl")}function x(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?x(Object(r),!0).forEach((function(e){o()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var w=0;function S(t,e){return new Promise((function(r,n){var o=w++;m.addEventListener((function t(e,i){if(i.id===o)switch(e){case"done":m.removeEventListener(t),r(i.result);break;case"error":m.removeEventListener(t),n(i.error)}}));var i={id:o,input:t,options:e};m.postMessage("process",i)}))}function O(t){return _.apply(this,arguments)}function _(){return(_=a()(s.a.mark((function t(e){var r,n,o,i,a,u,c;return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.loader,n=e.arrayBuffer,o=e.options,i=e.context,!r.parseSync&&!r.parse){t.next=6;break}a=n,u=r.parseSync||r.parse,t.next=13;break;case 6:if(!r.parseTextSync){t.next=12;break}c=new TextDecoder,a=c.decode(n),u=r.parseTextSync,t.next=13;break;case 12:throw new Error("Could not load data with ".concat(r.name," loader"));case 13:return o=b(b({},o),{},{modules:r&&r.options&&r.options.modules||{},worker:!1}),t.next=16,u(a,b({},o),i,r);case 16:return t.abrupt("return",t.sent);case 17:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function I(t){for(var e=1/0,r=1/0,n=1/0,o=-1/0,i=-1/0,a=-1/0,u=t.POSITION?t.POSITION.value:[],s=u&&u.length,c=0;c<s;c+=3){var l=u[c],f=u[c+1],p=u[c+2];e=l<e?l:e,r=f<r?f:r,n=p<n?p:n,o=l>o?l:o,i=f>i?f:i,a=p>a?p:a}return[[e,r,n],[o,i,a]]}var k,T,M,j,L=function(){function t(e,r){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Map;l()(this,t),o()(this,"name",void 0),o()(this,"type",void 0),o()(this,"nullable",void 0),o()(this,"metadata",void 0),this.name=e,this.type=r,this.nullable=n,this.metadata=i}return p()(t,[{key:"typeId",get:function(){return this.type&&this.type.typeId}},{key:"clone",value:function(){return new t(this.name,this.type,this.nullable,this.metadata)}},{key:"compareTo",value:function(t){return this.name===t.name&&this.type===t.type&&this.nullable===t.nullable&&this.metadata===t.metadata}},{key:"toString",value:function(){return"".concat(this.type).concat(this.nullable?", nullable":"").concat(this.metadata?", metadata: ".concat(this.metadata):"")}}]),t}(),E=r(4),F=r.n(E),P=r(1),D=r.n(P),A=r(11),N=r.n(A),z=r(8),U=r.n(z);function B(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=U()(t);if(e){var o=U()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return N()(this,r)}}!function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth"}(k||(k={}));var C=function(){function t(){l()(this,t)}return p()(t,[{key:"typeId",get:function(){return k.NONE}},{key:"compareTo",value:function(t){return this===t}}],[{key:"isNull",value:function(t){return t&&t.typeId===k.Null}},{key:"isInt",value:function(t){return t&&t.typeId===k.Int}},{key:"isFloat",value:function(t){return t&&t.typeId===k.Float}},{key:"isBinary",value:function(t){return t&&t.typeId===k.Binary}},{key:"isUtf8",value:function(t){return t&&t.typeId===k.Utf8}},{key:"isBool",value:function(t){return t&&t.typeId===k.Bool}},{key:"isDecimal",value:function(t){return t&&t.typeId===k.Decimal}},{key:"isDate",value:function(t){return t&&t.typeId===k.Date}},{key:"isTime",value:function(t){return t&&t.typeId===k.Time}},{key:"isTimestamp",value:function(t){return t&&t.typeId===k.Timestamp}},{key:"isInterval",value:function(t){return t&&t.typeId===k.Interval}},{key:"isList",value:function(t){return t&&t.typeId===k.List}},{key:"isStruct",value:function(t){return t&&t.typeId===k.Struct}},{key:"isUnion",value:function(t){return t&&t.typeId===k.Union}},{key:"isFixedSizeBinary",value:function(t){return t&&t.typeId===k.FixedSizeBinary}},{key:"isFixedSizeList",value:function(t){return t&&t.typeId===k.FixedSizeList}},{key:"isMap",value:function(t){return t&&t.typeId===k.Map}},{key:"isDictionary",value:function(t){return t&&t.typeId===k.Dictionary}}]),t}();T=Symbol.toStringTag;var R=function(t){D()(r,t);var e=B(r);function r(t,n){var i;return l()(this,r),i=e.call(this),o()(F()(i),"isSigned",void 0),o()(F()(i),"bitWidth",void 0),i.isSigned=t,i.bitWidth=n,i}return p()(r,[{key:"typeId",get:function(){return k.Int}},{key:T,get:function(){return"Int"}},{key:"toString",value:function(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}}]),r}(C),G=function(t){D()(r,t);var e=B(r);function r(){return l()(this,r),e.call(this,!1,8)}return r}(R),W=32;M=Symbol.toStringTag;var V=function(t){D()(r,t);var e=B(r);function r(t){var n;return l()(this,r),n=e.call(this),o()(F()(n),"precision",void 0),n.precision=t,n}return p()(r,[{key:"typeId",get:function(){return k.Float}},{key:M,get:function(){return"Float"}},{key:"toString",value:function(){return"Float".concat(this.precision)}}]),r}(C),Y=function(t){D()(r,t);var e=B(r);function r(){return l()(this,r),e.call(this,W)}return r}(V);Symbol.toStringTag;Symbol.toStringTag;Symbol.toStringTag;Symbol.toStringTag;j=Symbol.toStringTag;var H=function(t){D()(r,t);var e=B(r);function r(t,n){var i;return l()(this,r),i=e.call(this),o()(F()(i),"listSize",void 0),o()(F()(i),"children",void 0),i.listSize=t,i.children=[n],i}return p()(r,[{key:"typeId",get:function(){return k.FixedSizeList}},{key:"valueType",get:function(){return this.children[0].type}},{key:"valueField",get:function(){return this.children[0]}},{key:j,get:function(){return"FixedSizeList"}},{key:"toString",value:function(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">")}}]),r}(C);Symbol.toStringTag;var $=r(9),J=r.n($);function Z(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return q(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return q(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function q(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var K=function(){function t(e,r){l()(this,t),o()(this,"fields",void 0),o()(this,"metadata",void 0),function(t,e){if(!t)throw new Error(e||"loader assertion failed.")}(Array.isArray(e)),function(t){var e,r={},n=Z(t);try{for(n.s();!(e=n.n()).done;){var o=e.value;r[o.name]&&console.warn("Schema: duplicated field name",o.name,o),r[o.name]=!0}}catch(t){n.e(t)}finally{n.f()}}(e),this.fields=e,this.metadata=r||new Map}return p()(t,[{key:"compareTo",value:function(t){if(this.metadata!==t.metadata)return!1;if(this.fields.length!==t.fields.length)return!1;for(var e=0;e<this.fields.length;++e)if(!this.fields[e].compareTo(t.fields[e]))return!1;return!0}},{key:"select",value:function(){for(var e=Object.create(null),r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];for(var i=0,a=n;i<a.length;i++){var u=a[i];e[u]=!0}var s=this.fields.filter((function(t){return e[t.name]}));return new t(s,this.metadata)}},{key:"selectAt",value:function(){for(var e=this,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];var i=n.map((function(t){return e.fields[t]})).filter(Boolean);return new t(i,this.metadata)}},{key:"assign",value:function(e){var r,n=this.metadata;if(e instanceof t){var o=e;r=o.fields,n=Q(Q(new Map,this.metadata),o.metadata)}else r=e;var i,a=Object.create(null),u=Z(this.fields);try{for(u.s();!(i=u.n()).done;){var s=i.value;a[s.name]=s}}catch(t){u.e(t)}finally{u.f()}var c,l=Z(r);try{for(l.s();!(c=l.n()).done;){var f=c.value;a[f.name]=f}}catch(t){l.e(t)}finally{l.f()}return new t(Object.values(a),n)}}]),t}();function Q(t,e){return new Map([].concat(J()(t||new Map),J()(e||new Map)))}function X(t){var e=(new TextDecoder).decode(t),r=function(t){var e=t.search(/[\r\n]DATA\s(\S*)\s/i),r=/[\r\n]DATA\s(\S*)\s/i.exec(t.substr(e-1)),n={};n.data=r&&r[1],null!==r&&(n.headerLen=(r&&r[0].length)+e);n.str=t.substr(0,n.headerLen),n.str=n.str.replace(/\#.*/gi,""),n.version=/VERSION (.*)/i.exec(n.str),n.fields=/FIELDS (.*)/i.exec(n.str),n.size=/SIZE (.*)/i.exec(n.str),n.type=/TYPE (.*)/i.exec(n.str),n.count=/COUNT (.*)/i.exec(n.str),n.width=/WIDTH (.*)/i.exec(n.str),n.height=/HEIGHT (.*)/i.exec(n.str),n.viewpoint=/VIEWPOINT (.*)/i.exec(n.str),n.points=/POINTS (.*)/i.exec(n.str),null!==n.version&&(n.version=parseFloat(n.version[1]));null!==n.fields&&(n.fields=n.fields[1].split(" "));null!==n.type&&(n.type=n.type[1].split(" "));null!==n.width&&(n.width=parseInt(n.width[1],10));null!==n.height&&(n.height=parseInt(n.height[1],10));null!==n.viewpoint&&(n.viewpoint=n.viewpoint[1]);null!==n.points&&(n.points=parseInt(n.points[1],10));null===n.points&&"number"==typeof n.width&&"number"==typeof n.height&&(n.points=n.width*n.height);null!==n.size&&(n.size=n.size[1].split(" ").map((function(t){return parseInt(t,10)})));if(null!==n.count)n.count=n.count[1].split(" ").map((function(t){return parseInt(t,10)}));else if(n.count=[],null!==n.fields)for(var o=0;o<n.fields.length;o++)n.count.push(1);n.offset={};var i=0;if(null!==n.fields&&null!==n.size)for(var a=0;a<n.fields.length;a++)"ascii"===n.data?n.offset[n.fields[a]]=a:(n.offset[n.fields[a]]=i,i+=n.size[a]);return n.rowSize=i,n}(e),n={};switch(r.data){case"ascii":n=function(t,e){for(var r=[],n=[],o=[],i=t.offset,a=e.substr(t.headerLen).split("\n"),u=0;u<a.length;u++)if(""!==a[u]){var s=a[u].split(" ");if(void 0!==i.x&&(r.push(parseFloat(s[i.x])),r.push(parseFloat(s[i.y])),r.push(parseFloat(s[i.z]))),void 0!==i.rgb){var c=parseFloat(s[i.rgb]),l=new Float32Array([c]),f=new DataView(l.buffer,0);o.push(f.getUint8(0)),o.push(f.getUint8(1)),o.push(f.getUint8(2))}void 0!==i.normal_x&&(n.push(parseFloat(s[i.normal_x])),n.push(parseFloat(s[i.normal_y])),n.push(parseFloat(s[i.normal_z])))}return{position:r,normal:n,color:o}}(r,e);break;case"binary":n=function(t,e){for(var r=[],n=[],o=[],i=new DataView(e,t.headerLen),a=t.offset,u=0,s=0;u<t.points;u++,s+=t.rowSize)void 0!==a.x&&(r.push(i.getFloat32(s+a.x,!0)),r.push(i.getFloat32(s+a.y,!0)),r.push(i.getFloat32(s+a.z,!0))),void 0!==a.rgb&&(o.push(i.getUint8(s+a.rgb+0)),o.push(i.getUint8(s+a.rgb+1)),o.push(i.getUint8(s+a.rgb+2))),void 0!==a.normal_x&&(n.push(i.getFloat32(s+a.normal_x,!0)),n.push(i.getFloat32(s+a.normal_y,!0)),n.push(i.getFloat32(s+a.normal_z,!0)));return{position:r,normal:n,color:o}}(r,t);break;case"binary_compressed":default:throw new Error("PCD: ".concat(r.data," files are not supported"))}var o=function(t,e){if("number"==typeof t.width&&"number"==typeof t.height){return{vertexCount:t.width*t.height,boundingBox:I(e)}}return t}(r,n=function(t){var e={POSITION:{value:new Float32Array(t.position),size:3}};t.normal&&t.normal.length>0&&(e.NORMAL={value:new Float32Array(t.normal),size:3});t.color&&t.color.length>0&&(e.COLOR_0={value:new Uint8Array(t.color),size:3});return e}(n));return{loaderData:{header:r},header:o,schema:function(t,e){var r=t.offset,n=[];return void 0!==r.x&&n.push(new L("POSITION",new H(3,new L("xyz",new Y)),!1)),void 0!==r.normal_x&&n.push(new L("NORMAL",new H(3,new L("xyz",new Y)),!1)),void 0!==r.rgb&&n.push(new L("COLOR_0",new H(3,new L("rgb",new G)),!1)),new K(n,e)}(r,new Map([["mode","0"],["boundingBox",JSON.stringify(o.boundingBox)]])),mode:0,indices:null,attributes:n}}var tt={name:"PCD (Point Cloud Data)",id:"pcd",module:"pcd",version:"3.1.0-alpha.3",worker:!0,extensions:["pcd"],mimeTypes:["text/plain"],options:{pcd:{}}};function et(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function rt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?et(Object(r),!0).forEach((function(e){o()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):et(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var nt,ot,it=rt(rt({},tt),{},{parse:(nt=a()(s.a.mark((function t(e){return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",X(e));case 1:case"end":return t.stop()}}),t)}))),function(t){return nt.apply(this,arguments)}),parseSync:X});ot=it,"undefined"!=typeof self&&(m.onmessage=function(){var t=a()(s.a.mark((function t(e,r){var n,o,i,a,u;return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.t0=e,t.next="process"===t.t0?3:16;break;case 3:return t.prev=3,n=r.input,o=r.options,i=void 0===o?{}:o,t.next=7,O({loader:ot,arrayBuffer:n,options:i,context:{parse:S}});case 7:a=t.sent,m.postMessage("done",{result:a}),t.next=15;break;case 11:t.prev=11,t.t1=t.catch(3),u=t.t1 instanceof Error?t.t1.message:"",m.postMessage("error",{error:u});case 15:return t.abrupt("break",16);case 16:case"end":return t.stop()}}),t,null,[[3,11]])})));return function(e,r){return t.apply(this,arguments)}}())}]);
2
- //# sourceMappingURL=pcd-worker.js.map
1
+ (() => {
2
+ // ../worker-utils/src/lib/worker-utils/get-transfer-list.ts
3
+ function getTransferList(object, recursive = true, transfers) {
4
+ const transfersSet = transfers || new Set();
5
+ if (!object) {
6
+ } else if (isTransferable(object)) {
7
+ transfersSet.add(object);
8
+ } else if (isTransferable(object.buffer)) {
9
+ transfersSet.add(object.buffer);
10
+ } else if (ArrayBuffer.isView(object)) {
11
+ } else if (recursive && typeof object === "object") {
12
+ for (const key in object) {
13
+ getTransferList(object[key], recursive, transfersSet);
14
+ }
15
+ }
16
+ return transfers === void 0 ? Array.from(transfersSet) : [];
17
+ }
18
+ function isTransferable(object) {
19
+ if (!object) {
20
+ return false;
21
+ }
22
+ if (object instanceof ArrayBuffer) {
23
+ return true;
24
+ }
25
+ if (typeof MessagePort !== "undefined" && object instanceof MessagePort) {
26
+ return true;
27
+ }
28
+ if (typeof ImageBitmap !== "undefined" && object instanceof ImageBitmap) {
29
+ return true;
30
+ }
31
+ if (typeof OffscreenCanvas !== "undefined" && object instanceof OffscreenCanvas) {
32
+ return true;
33
+ }
34
+ return false;
35
+ }
36
+
37
+ // ../worker-utils/src/lib/worker-farm/worker-body.ts
38
+ var onMessageWrapperMap = new Map();
39
+ var WorkerBody = class {
40
+ static set onmessage(onMessage) {
41
+ self.onmessage = (message) => {
42
+ if (!isKnownMessage(message)) {
43
+ return;
44
+ }
45
+ const { type, payload } = message.data;
46
+ onMessage(type, payload);
47
+ };
48
+ }
49
+ static addEventListener(onMessage) {
50
+ let onMessageWrapper = onMessageWrapperMap.get(onMessage);
51
+ if (!onMessageWrapper) {
52
+ onMessageWrapper = (message) => {
53
+ if (!isKnownMessage(message)) {
54
+ return;
55
+ }
56
+ const { type, payload } = message.data;
57
+ onMessage(type, payload);
58
+ };
59
+ }
60
+ self.addEventListener("message", onMessageWrapper);
61
+ }
62
+ static removeEventListener(onMessage) {
63
+ const onMessageWrapper = onMessageWrapperMap.get(onMessage);
64
+ onMessageWrapperMap.delete(onMessage);
65
+ self.removeEventListener("message", onMessageWrapper);
66
+ }
67
+ static postMessage(type, payload) {
68
+ if (self) {
69
+ const data = { source: "loaders.gl", type, payload };
70
+ const transferList = getTransferList(payload);
71
+ self.postMessage(data, transferList);
72
+ }
73
+ }
74
+ };
75
+ function isKnownMessage(message) {
76
+ const { type, data } = message;
77
+ return type === "message" && data && typeof data.source === "string" && data.source.startsWith("loaders.gl");
78
+ }
79
+
80
+ // ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
81
+ var requestId = 0;
82
+ function createLoaderWorker(loader) {
83
+ if (typeof self === "undefined") {
84
+ return;
85
+ }
86
+ WorkerBody.onmessage = async (type, payload) => {
87
+ switch (type) {
88
+ case "process":
89
+ try {
90
+ const { input, options = {} } = payload;
91
+ const result = await parseData({
92
+ loader,
93
+ arrayBuffer: input,
94
+ options,
95
+ context: {
96
+ parse: parseOnMainThread
97
+ }
98
+ });
99
+ WorkerBody.postMessage("done", { result });
100
+ } catch (error) {
101
+ const message = error instanceof Error ? error.message : "";
102
+ WorkerBody.postMessage("error", { error: message });
103
+ }
104
+ break;
105
+ default:
106
+ }
107
+ };
108
+ }
109
+ function parseOnMainThread(arrayBuffer, options) {
110
+ return new Promise((resolve, reject) => {
111
+ const id = requestId++;
112
+ const onMessage = (type, payload2) => {
113
+ if (payload2.id !== id) {
114
+ return;
115
+ }
116
+ switch (type) {
117
+ case "done":
118
+ WorkerBody.removeEventListener(onMessage);
119
+ resolve(payload2.result);
120
+ break;
121
+ case "error":
122
+ WorkerBody.removeEventListener(onMessage);
123
+ reject(payload2.error);
124
+ break;
125
+ default:
126
+ }
127
+ };
128
+ WorkerBody.addEventListener(onMessage);
129
+ const payload = { id, input: arrayBuffer, options };
130
+ WorkerBody.postMessage("process", payload);
131
+ });
132
+ }
133
+ async function parseData({ loader, arrayBuffer, options, context }) {
134
+ let data;
135
+ let parser;
136
+ if (loader.parseSync || loader.parse) {
137
+ data = arrayBuffer;
138
+ parser = loader.parseSync || loader.parse;
139
+ } else if (loader.parseTextSync) {
140
+ const textDecoder = new TextDecoder();
141
+ data = textDecoder.decode(arrayBuffer);
142
+ parser = loader.parseTextSync;
143
+ } else {
144
+ throw new Error(`Could not load data with ${loader.name} loader`);
145
+ }
146
+ options = {
147
+ ...options,
148
+ modules: loader && loader.options && loader.options.modules || {},
149
+ worker: false
150
+ };
151
+ return await parser(data, { ...options }, context, loader);
152
+ }
153
+
154
+ // ../schema/src/category/mesh/mesh-utils.ts
155
+ function getMeshBoundingBox(attributes) {
156
+ let minX = Infinity;
157
+ let minY = Infinity;
158
+ let minZ = Infinity;
159
+ let maxX = -Infinity;
160
+ let maxY = -Infinity;
161
+ let maxZ = -Infinity;
162
+ const positions = attributes.POSITION ? attributes.POSITION.value : [];
163
+ const len = positions && positions.length;
164
+ for (let i = 0; i < len; i += 3) {
165
+ const x = positions[i];
166
+ const y = positions[i + 1];
167
+ const z = positions[i + 2];
168
+ minX = x < minX ? x : minX;
169
+ minY = y < minY ? y : minY;
170
+ minZ = z < minZ ? z : minZ;
171
+ maxX = x > maxX ? x : maxX;
172
+ maxY = y > maxY ? y : maxY;
173
+ maxZ = z > maxZ ? z : maxZ;
174
+ }
175
+ return [
176
+ [minX, minY, minZ],
177
+ [maxX, maxY, maxZ]
178
+ ];
179
+ }
180
+
181
+ // ../schema/src/lib/utils/assert.ts
182
+ function assert(condition, message) {
183
+ if (!condition) {
184
+ throw new Error(message || "loader assertion failed.");
185
+ }
186
+ }
187
+
188
+ // ../schema/src/lib/schema/impl/schema.ts
189
+ var Schema = class {
190
+ constructor(fields, metadata) {
191
+ assert(Array.isArray(fields));
192
+ checkNames(fields);
193
+ this.fields = fields;
194
+ this.metadata = metadata || new Map();
195
+ }
196
+ compareTo(other) {
197
+ if (this.metadata !== other.metadata) {
198
+ return false;
199
+ }
200
+ if (this.fields.length !== other.fields.length) {
201
+ return false;
202
+ }
203
+ for (let i = 0; i < this.fields.length; ++i) {
204
+ if (!this.fields[i].compareTo(other.fields[i])) {
205
+ return false;
206
+ }
207
+ }
208
+ return true;
209
+ }
210
+ select(...columnNames) {
211
+ const nameMap = Object.create(null);
212
+ for (const name of columnNames) {
213
+ nameMap[name] = true;
214
+ }
215
+ const selectedFields = this.fields.filter((field) => nameMap[field.name]);
216
+ return new Schema(selectedFields, this.metadata);
217
+ }
218
+ selectAt(...columnIndices) {
219
+ const selectedFields = columnIndices.map((index) => this.fields[index]).filter(Boolean);
220
+ return new Schema(selectedFields, this.metadata);
221
+ }
222
+ assign(schemaOrFields) {
223
+ let fields;
224
+ let metadata = this.metadata;
225
+ if (schemaOrFields instanceof Schema) {
226
+ const otherSchema = schemaOrFields;
227
+ fields = otherSchema.fields;
228
+ metadata = mergeMaps(mergeMaps(new Map(), this.metadata), otherSchema.metadata);
229
+ } else {
230
+ fields = schemaOrFields;
231
+ }
232
+ const fieldMap = Object.create(null);
233
+ for (const field of this.fields) {
234
+ fieldMap[field.name] = field;
235
+ }
236
+ for (const field of fields) {
237
+ fieldMap[field.name] = field;
238
+ }
239
+ const mergedFields = Object.values(fieldMap);
240
+ return new Schema(mergedFields, metadata);
241
+ }
242
+ };
243
+ function checkNames(fields) {
244
+ const usedNames = {};
245
+ for (const field of fields) {
246
+ if (usedNames[field.name]) {
247
+ console.warn("Schema: duplicated field name", field.name, field);
248
+ }
249
+ usedNames[field.name] = true;
250
+ }
251
+ }
252
+ function mergeMaps(m1, m2) {
253
+ return new Map([...m1 || new Map(), ...m2 || new Map()]);
254
+ }
255
+
256
+ // ../schema/src/lib/schema/impl/field.ts
257
+ var Field = class {
258
+ constructor(name, type, nullable = false, metadata = new Map()) {
259
+ this.name = name;
260
+ this.type = type;
261
+ this.nullable = nullable;
262
+ this.metadata = metadata;
263
+ }
264
+ get typeId() {
265
+ return this.type && this.type.typeId;
266
+ }
267
+ clone() {
268
+ return new Field(this.name, this.type, this.nullable, this.metadata);
269
+ }
270
+ compareTo(other) {
271
+ return this.name === other.name && this.type === other.type && this.nullable === other.nullable && this.metadata === other.metadata;
272
+ }
273
+ toString() {
274
+ return `${this.type}${this.nullable ? ", nullable" : ""}${this.metadata ? `, metadata: ${this.metadata}` : ""}`;
275
+ }
276
+ };
277
+
278
+ // ../schema/src/lib/schema/impl/enum.ts
279
+ var Type;
280
+ (function(Type2) {
281
+ Type2[Type2["NONE"] = 0] = "NONE";
282
+ Type2[Type2["Null"] = 1] = "Null";
283
+ Type2[Type2["Int"] = 2] = "Int";
284
+ Type2[Type2["Float"] = 3] = "Float";
285
+ Type2[Type2["Binary"] = 4] = "Binary";
286
+ Type2[Type2["Utf8"] = 5] = "Utf8";
287
+ Type2[Type2["Bool"] = 6] = "Bool";
288
+ Type2[Type2["Decimal"] = 7] = "Decimal";
289
+ Type2[Type2["Date"] = 8] = "Date";
290
+ Type2[Type2["Time"] = 9] = "Time";
291
+ Type2[Type2["Timestamp"] = 10] = "Timestamp";
292
+ Type2[Type2["Interval"] = 11] = "Interval";
293
+ Type2[Type2["List"] = 12] = "List";
294
+ Type2[Type2["Struct"] = 13] = "Struct";
295
+ Type2[Type2["Union"] = 14] = "Union";
296
+ Type2[Type2["FixedSizeBinary"] = 15] = "FixedSizeBinary";
297
+ Type2[Type2["FixedSizeList"] = 16] = "FixedSizeList";
298
+ Type2[Type2["Map"] = 17] = "Map";
299
+ Type2[Type2["Dictionary"] = -1] = "Dictionary";
300
+ Type2[Type2["Int8"] = -2] = "Int8";
301
+ Type2[Type2["Int16"] = -3] = "Int16";
302
+ Type2[Type2["Int32"] = -4] = "Int32";
303
+ Type2[Type2["Int64"] = -5] = "Int64";
304
+ Type2[Type2["Uint8"] = -6] = "Uint8";
305
+ Type2[Type2["Uint16"] = -7] = "Uint16";
306
+ Type2[Type2["Uint32"] = -8] = "Uint32";
307
+ Type2[Type2["Uint64"] = -9] = "Uint64";
308
+ Type2[Type2["Float16"] = -10] = "Float16";
309
+ Type2[Type2["Float32"] = -11] = "Float32";
310
+ Type2[Type2["Float64"] = -12] = "Float64";
311
+ Type2[Type2["DateDay"] = -13] = "DateDay";
312
+ Type2[Type2["DateMillisecond"] = -14] = "DateMillisecond";
313
+ Type2[Type2["TimestampSecond"] = -15] = "TimestampSecond";
314
+ Type2[Type2["TimestampMillisecond"] = -16] = "TimestampMillisecond";
315
+ Type2[Type2["TimestampMicrosecond"] = -17] = "TimestampMicrosecond";
316
+ Type2[Type2["TimestampNanosecond"] = -18] = "TimestampNanosecond";
317
+ Type2[Type2["TimeSecond"] = -19] = "TimeSecond";
318
+ Type2[Type2["TimeMillisecond"] = -20] = "TimeMillisecond";
319
+ Type2[Type2["TimeMicrosecond"] = -21] = "TimeMicrosecond";
320
+ Type2[Type2["TimeNanosecond"] = -22] = "TimeNanosecond";
321
+ Type2[Type2["DenseUnion"] = -23] = "DenseUnion";
322
+ Type2[Type2["SparseUnion"] = -24] = "SparseUnion";
323
+ Type2[Type2["IntervalDayTime"] = -25] = "IntervalDayTime";
324
+ Type2[Type2["IntervalYearMonth"] = -26] = "IntervalYearMonth";
325
+ })(Type || (Type = {}));
326
+
327
+ // ../schema/src/lib/schema/impl/type.ts
328
+ var DataType = class {
329
+ static isNull(x) {
330
+ return x && x.typeId === Type.Null;
331
+ }
332
+ static isInt(x) {
333
+ return x && x.typeId === Type.Int;
334
+ }
335
+ static isFloat(x) {
336
+ return x && x.typeId === Type.Float;
337
+ }
338
+ static isBinary(x) {
339
+ return x && x.typeId === Type.Binary;
340
+ }
341
+ static isUtf8(x) {
342
+ return x && x.typeId === Type.Utf8;
343
+ }
344
+ static isBool(x) {
345
+ return x && x.typeId === Type.Bool;
346
+ }
347
+ static isDecimal(x) {
348
+ return x && x.typeId === Type.Decimal;
349
+ }
350
+ static isDate(x) {
351
+ return x && x.typeId === Type.Date;
352
+ }
353
+ static isTime(x) {
354
+ return x && x.typeId === Type.Time;
355
+ }
356
+ static isTimestamp(x) {
357
+ return x && x.typeId === Type.Timestamp;
358
+ }
359
+ static isInterval(x) {
360
+ return x && x.typeId === Type.Interval;
361
+ }
362
+ static isList(x) {
363
+ return x && x.typeId === Type.List;
364
+ }
365
+ static isStruct(x) {
366
+ return x && x.typeId === Type.Struct;
367
+ }
368
+ static isUnion(x) {
369
+ return x && x.typeId === Type.Union;
370
+ }
371
+ static isFixedSizeBinary(x) {
372
+ return x && x.typeId === Type.FixedSizeBinary;
373
+ }
374
+ static isFixedSizeList(x) {
375
+ return x && x.typeId === Type.FixedSizeList;
376
+ }
377
+ static isMap(x) {
378
+ return x && x.typeId === Type.Map;
379
+ }
380
+ static isDictionary(x) {
381
+ return x && x.typeId === Type.Dictionary;
382
+ }
383
+ get typeId() {
384
+ return Type.NONE;
385
+ }
386
+ compareTo(other) {
387
+ return this === other;
388
+ }
389
+ };
390
+ var Null = class extends DataType {
391
+ get typeId() {
392
+ return Type.Null;
393
+ }
394
+ get [Symbol.toStringTag]() {
395
+ return "Null";
396
+ }
397
+ toString() {
398
+ return "Null";
399
+ }
400
+ };
401
+ var Bool = class extends DataType {
402
+ get typeId() {
403
+ return Type.Bool;
404
+ }
405
+ get [Symbol.toStringTag]() {
406
+ return "Bool";
407
+ }
408
+ toString() {
409
+ return "Bool";
410
+ }
411
+ };
412
+ var Int = class extends DataType {
413
+ constructor(isSigned, bitWidth) {
414
+ super();
415
+ this.isSigned = isSigned;
416
+ this.bitWidth = bitWidth;
417
+ }
418
+ get typeId() {
419
+ return Type.Int;
420
+ }
421
+ get [Symbol.toStringTag]() {
422
+ return "Int";
423
+ }
424
+ toString() {
425
+ return `${this.isSigned ? "I" : "Ui"}nt${this.bitWidth}`;
426
+ }
427
+ };
428
+ var Uint8 = class extends Int {
429
+ constructor() {
430
+ super(false, 8);
431
+ }
432
+ };
433
+ var Precision = {
434
+ HALF: 16,
435
+ SINGLE: 32,
436
+ DOUBLE: 64
437
+ };
438
+ var Float = class extends DataType {
439
+ constructor(precision) {
440
+ super();
441
+ this.precision = precision;
442
+ }
443
+ get typeId() {
444
+ return Type.Float;
445
+ }
446
+ get [Symbol.toStringTag]() {
447
+ return "Float";
448
+ }
449
+ toString() {
450
+ return `Float${this.precision}`;
451
+ }
452
+ };
453
+ var Float32 = class extends Float {
454
+ constructor() {
455
+ super(Precision.SINGLE);
456
+ }
457
+ };
458
+ var Binary = class extends DataType {
459
+ constructor() {
460
+ super();
461
+ }
462
+ get typeId() {
463
+ return Type.Binary;
464
+ }
465
+ toString() {
466
+ return "Binary";
467
+ }
468
+ get [Symbol.toStringTag]() {
469
+ return "Binary";
470
+ }
471
+ };
472
+ var Utf8 = class extends DataType {
473
+ get typeId() {
474
+ return Type.Utf8;
475
+ }
476
+ get [Symbol.toStringTag]() {
477
+ return "Utf8";
478
+ }
479
+ toString() {
480
+ return "Utf8";
481
+ }
482
+ };
483
+ var DateUnit = {
484
+ DAY: 0,
485
+ MILLISECOND: 1
486
+ };
487
+ var Date = class extends DataType {
488
+ constructor(unit) {
489
+ super();
490
+ this.unit = unit;
491
+ }
492
+ get typeId() {
493
+ return Type.Date;
494
+ }
495
+ get [Symbol.toStringTag]() {
496
+ return "Date";
497
+ }
498
+ toString() {
499
+ return `Date${(this.unit + 1) * 32}<${DateUnit[this.unit]}>`;
500
+ }
501
+ };
502
+ var TimeUnit = {
503
+ SECOND: 1,
504
+ MILLISECOND: 1e3,
505
+ MICROSECOND: 1e6,
506
+ NANOSECOND: 1e9
507
+ };
508
+ var Time = class extends DataType {
509
+ constructor(unit, bitWidth) {
510
+ super();
511
+ this.unit = unit;
512
+ this.bitWidth = bitWidth;
513
+ }
514
+ get typeId() {
515
+ return Type.Time;
516
+ }
517
+ toString() {
518
+ return `Time${this.bitWidth}<${TimeUnit[this.unit]}>`;
519
+ }
520
+ get [Symbol.toStringTag]() {
521
+ return "Time";
522
+ }
523
+ };
524
+ var Timestamp = class extends DataType {
525
+ constructor(unit, timezone = null) {
526
+ super();
527
+ this.unit = unit;
528
+ this.timezone = timezone;
529
+ }
530
+ get typeId() {
531
+ return Type.Timestamp;
532
+ }
533
+ get [Symbol.toStringTag]() {
534
+ return "Timestamp";
535
+ }
536
+ toString() {
537
+ return `Timestamp<${TimeUnit[this.unit]}${this.timezone ? `, ${this.timezone}` : ""}>`;
538
+ }
539
+ };
540
+ var IntervalUnit = {
541
+ DAY_TIME: 0,
542
+ YEAR_MONTH: 1
543
+ };
544
+ var Interval = class extends DataType {
545
+ constructor(unit) {
546
+ super();
547
+ this.unit = unit;
548
+ }
549
+ get typeId() {
550
+ return Type.Interval;
551
+ }
552
+ get [Symbol.toStringTag]() {
553
+ return "Interval";
554
+ }
555
+ toString() {
556
+ return `Interval<${IntervalUnit[this.unit]}>`;
557
+ }
558
+ };
559
+ var FixedSizeList = class extends DataType {
560
+ constructor(listSize, child) {
561
+ super();
562
+ this.listSize = listSize;
563
+ this.children = [child];
564
+ }
565
+ get typeId() {
566
+ return Type.FixedSizeList;
567
+ }
568
+ get valueType() {
569
+ return this.children[0].type;
570
+ }
571
+ get valueField() {
572
+ return this.children[0];
573
+ }
574
+ get [Symbol.toStringTag]() {
575
+ return "FixedSizeList";
576
+ }
577
+ toString() {
578
+ return `FixedSizeList[${this.listSize}]<${this.valueType}>`;
579
+ }
580
+ };
581
+ var Struct = class extends DataType {
582
+ constructor(children) {
583
+ super();
584
+ this.children = children;
585
+ }
586
+ get typeId() {
587
+ return Type.Struct;
588
+ }
589
+ toString() {
590
+ return `Struct<{${this.children.map((f) => `${f.name}:${f.type}`).join(", ")}}>`;
591
+ }
592
+ get [Symbol.toStringTag]() {
593
+ return "Struct";
594
+ }
595
+ };
596
+
597
+ // src/lib/get-pcd-schema.ts
598
+ function getPCDSchema(PCDheader, metadata) {
599
+ const offset = PCDheader.offset;
600
+ const fields = [];
601
+ if (offset.x !== void 0) {
602
+ fields.push(new Field("POSITION", new FixedSizeList(3, new Field("xyz", new Float32())), false));
603
+ }
604
+ if (offset.normal_x !== void 0) {
605
+ fields.push(new Field("NORMAL", new FixedSizeList(3, new Field("xyz", new Float32())), false));
606
+ }
607
+ if (offset.rgb !== void 0) {
608
+ fields.push(new Field("COLOR_0", new FixedSizeList(3, new Field("rgb", new Uint8())), false));
609
+ }
610
+ return new Schema(fields, metadata);
611
+ }
612
+
613
+ // src/lib/parse-pcd.ts
614
+ var LITTLE_ENDIAN = true;
615
+ function parsePCD(data) {
616
+ const textData = new TextDecoder().decode(data);
617
+ const pcdHeader = parsePCDHeader(textData);
618
+ let attributes = {};
619
+ switch (pcdHeader.data) {
620
+ case "ascii":
621
+ attributes = parsePCDASCII(pcdHeader, textData);
622
+ break;
623
+ case "binary":
624
+ attributes = parsePCDBinary(pcdHeader, data);
625
+ break;
626
+ case "binary_compressed":
627
+ default:
628
+ throw new Error(`PCD: ${pcdHeader.data} files are not supported`);
629
+ }
630
+ attributes = getMeshAttributes(attributes);
631
+ const header = getMeshHeader(pcdHeader, attributes);
632
+ const metadata = new Map([
633
+ ["mode", "0"],
634
+ ["boundingBox", JSON.stringify(header.boundingBox)]
635
+ ]);
636
+ const schema = getPCDSchema(pcdHeader, metadata);
637
+ return {
638
+ loaderData: {
639
+ header: pcdHeader
640
+ },
641
+ header,
642
+ schema,
643
+ mode: 0,
644
+ indices: null,
645
+ attributes
646
+ };
647
+ }
648
+ function getMeshHeader(pcdHeader, attributes) {
649
+ if (typeof pcdHeader.width === "number" && typeof pcdHeader.height === "number") {
650
+ const pointCount = pcdHeader.width * pcdHeader.height;
651
+ return {
652
+ vertexCount: pointCount,
653
+ boundingBox: getMeshBoundingBox(attributes)
654
+ };
655
+ }
656
+ return pcdHeader;
657
+ }
658
+ function getMeshAttributes(attributes) {
659
+ const normalizedAttributes = {
660
+ POSITION: {
661
+ value: new Float32Array(attributes.position),
662
+ size: 3
663
+ }
664
+ };
665
+ if (attributes.normal && attributes.normal.length > 0) {
666
+ normalizedAttributes.NORMAL = {
667
+ value: new Float32Array(attributes.normal),
668
+ size: 3
669
+ };
670
+ }
671
+ if (attributes.color && attributes.color.length > 0) {
672
+ normalizedAttributes.COLOR_0 = {
673
+ value: new Uint8Array(attributes.color),
674
+ size: 3
675
+ };
676
+ }
677
+ return normalizedAttributes;
678
+ }
679
+ function parsePCDHeader(data) {
680
+ const result1 = data.search(/[\r\n]DATA\s(\S*)\s/i);
681
+ const result2 = /[\r\n]DATA\s(\S*)\s/i.exec(data.substr(result1 - 1));
682
+ const pcdHeader = {};
683
+ pcdHeader.data = result2 && result2[1];
684
+ if (result2 !== null) {
685
+ pcdHeader.headerLen = (result2 && result2[0].length) + result1;
686
+ }
687
+ pcdHeader.str = data.substr(0, pcdHeader.headerLen);
688
+ pcdHeader.str = pcdHeader.str.replace(/\#.*/gi, "");
689
+ pcdHeader.version = /VERSION (.*)/i.exec(pcdHeader.str);
690
+ pcdHeader.fields = /FIELDS (.*)/i.exec(pcdHeader.str);
691
+ pcdHeader.size = /SIZE (.*)/i.exec(pcdHeader.str);
692
+ pcdHeader.type = /TYPE (.*)/i.exec(pcdHeader.str);
693
+ pcdHeader.count = /COUNT (.*)/i.exec(pcdHeader.str);
694
+ pcdHeader.width = /WIDTH (.*)/i.exec(pcdHeader.str);
695
+ pcdHeader.height = /HEIGHT (.*)/i.exec(pcdHeader.str);
696
+ pcdHeader.viewpoint = /VIEWPOINT (.*)/i.exec(pcdHeader.str);
697
+ pcdHeader.points = /POINTS (.*)/i.exec(pcdHeader.str);
698
+ if (pcdHeader.version !== null) {
699
+ pcdHeader.version = parseFloat(pcdHeader.version[1]);
700
+ }
701
+ if (pcdHeader.fields !== null) {
702
+ pcdHeader.fields = pcdHeader.fields[1].split(" ");
703
+ }
704
+ if (pcdHeader.type !== null) {
705
+ pcdHeader.type = pcdHeader.type[1].split(" ");
706
+ }
707
+ if (pcdHeader.width !== null) {
708
+ pcdHeader.width = parseInt(pcdHeader.width[1], 10);
709
+ }
710
+ if (pcdHeader.height !== null) {
711
+ pcdHeader.height = parseInt(pcdHeader.height[1], 10);
712
+ }
713
+ if (pcdHeader.viewpoint !== null) {
714
+ pcdHeader.viewpoint = pcdHeader.viewpoint[1];
715
+ }
716
+ if (pcdHeader.points !== null) {
717
+ pcdHeader.points = parseInt(pcdHeader.points[1], 10);
718
+ }
719
+ if (pcdHeader.points === null && typeof pcdHeader.width === "number" && typeof pcdHeader.height === "number") {
720
+ pcdHeader.points = pcdHeader.width * pcdHeader.height;
721
+ }
722
+ if (pcdHeader.size !== null) {
723
+ pcdHeader.size = pcdHeader.size[1].split(" ").map((x) => parseInt(x, 10));
724
+ }
725
+ if (pcdHeader.count !== null) {
726
+ pcdHeader.count = pcdHeader.count[1].split(" ").map((x) => parseInt(x, 10));
727
+ } else {
728
+ pcdHeader.count = [];
729
+ if (pcdHeader.fields !== null) {
730
+ for (let i = 0; i < pcdHeader.fields.length; i++) {
731
+ pcdHeader.count.push(1);
732
+ }
733
+ }
734
+ }
735
+ pcdHeader.offset = {};
736
+ let sizeSum = 0;
737
+ if (pcdHeader.fields !== null && pcdHeader.size !== null) {
738
+ for (let i = 0; i < pcdHeader.fields.length; i++) {
739
+ if (pcdHeader.data === "ascii") {
740
+ pcdHeader.offset[pcdHeader.fields[i]] = i;
741
+ } else {
742
+ pcdHeader.offset[pcdHeader.fields[i]] = sizeSum;
743
+ sizeSum += pcdHeader.size[i];
744
+ }
745
+ }
746
+ }
747
+ pcdHeader.rowSize = sizeSum;
748
+ return pcdHeader;
749
+ }
750
+ function parsePCDASCII(pcdHeader, textData) {
751
+ const position = [];
752
+ const normal = [];
753
+ const color = [];
754
+ const offset = pcdHeader.offset;
755
+ const pcdData = textData.substr(pcdHeader.headerLen);
756
+ const lines = pcdData.split("\n");
757
+ for (let i = 0; i < lines.length; i++) {
758
+ if (lines[i] !== "") {
759
+ const line = lines[i].split(" ");
760
+ if (offset.x !== void 0) {
761
+ position.push(parseFloat(line[offset.x]));
762
+ position.push(parseFloat(line[offset.y]));
763
+ position.push(parseFloat(line[offset.z]));
764
+ }
765
+ if (offset.rgb !== void 0) {
766
+ const floatValue = parseFloat(line[offset.rgb]);
767
+ const binaryColor = new Float32Array([floatValue]);
768
+ const dataview = new DataView(binaryColor.buffer, 0);
769
+ color.push(dataview.getUint8(0));
770
+ color.push(dataview.getUint8(1));
771
+ color.push(dataview.getUint8(2));
772
+ }
773
+ if (offset.normal_x !== void 0) {
774
+ normal.push(parseFloat(line[offset.normal_x]));
775
+ normal.push(parseFloat(line[offset.normal_y]));
776
+ normal.push(parseFloat(line[offset.normal_z]));
777
+ }
778
+ }
779
+ }
780
+ return { position, normal, color };
781
+ }
782
+ function parsePCDBinary(pcdHeader, data) {
783
+ const position = [];
784
+ const normal = [];
785
+ const color = [];
786
+ const dataview = new DataView(data, pcdHeader.headerLen);
787
+ const offset = pcdHeader.offset;
788
+ for (let i = 0, row = 0; i < pcdHeader.points; i++, row += pcdHeader.rowSize) {
789
+ if (offset.x !== void 0) {
790
+ position.push(dataview.getFloat32(row + offset.x, LITTLE_ENDIAN));
791
+ position.push(dataview.getFloat32(row + offset.y, LITTLE_ENDIAN));
792
+ position.push(dataview.getFloat32(row + offset.z, LITTLE_ENDIAN));
793
+ }
794
+ if (offset.rgb !== void 0) {
795
+ color.push(dataview.getUint8(row + offset.rgb + 0));
796
+ color.push(dataview.getUint8(row + offset.rgb + 1));
797
+ color.push(dataview.getUint8(row + offset.rgb + 2));
798
+ }
799
+ if (offset.normal_x !== void 0) {
800
+ normal.push(dataview.getFloat32(row + offset.normal_x, LITTLE_ENDIAN));
801
+ normal.push(dataview.getFloat32(row + offset.normal_y, LITTLE_ENDIAN));
802
+ normal.push(dataview.getFloat32(row + offset.normal_z, LITTLE_ENDIAN));
803
+ }
804
+ }
805
+ return { position, normal, color };
806
+ }
807
+
808
+ // src/pcd-loader.ts
809
+ var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
810
+ var PCDLoader = {
811
+ name: "PCD (Point Cloud Data)",
812
+ id: "pcd",
813
+ module: "pcd",
814
+ version: VERSION,
815
+ worker: true,
816
+ extensions: ["pcd"],
817
+ mimeTypes: ["text/plain"],
818
+ options: {
819
+ pcd: {}
820
+ }
821
+ };
822
+
823
+ // src/index.ts
824
+ var PCDLoader2 = {
825
+ ...PCDLoader,
826
+ parse: async (arrayBuffer) => parsePCD(arrayBuffer),
827
+ parseSync: parsePCD
828
+ };
829
+
830
+ // src/workers/pcd-worker.ts
831
+ createLoaderWorker(PCDLoader2);
832
+ })();