bimland/dist/Cesium/Workers/pbf-2b242707.js

2 lines
10 KiB
JavaScript
Raw Permalink Normal View History

2023-07-26 17:04:38 +08:00
define(["exports"],(function(t){"use strict";var i=function(t,i,r,e,s){var n,o,h=8*s-e-1,a=(1<<h)-1,u=a>>1,f=-7,p=r?s-1:0,d=r?-1:1,c=t[i+p];for(p+=d,n=c&(1<<-f)-1,c>>=-f,f+=h;f>0;n=256*n+t[i+p],p+=d,f-=8);for(o=n&(1<<-f)-1,n>>=-f,f+=e;f>0;o=256*o+t[i+p],p+=d,f-=8);if(0===n)n=1-u;else{if(n===a)return o?NaN:1/0*(c?-1:1);o+=Math.pow(2,e),n-=u}return(c?-1:1)*o*Math.pow(2,n-e)},r=function(t,i,r,e,s,n){var o,h,a,u=8*n-s-1,f=(1<<u)-1,p=f>>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,c=e?0:n-1,l=e?1:-1,w=i<0||0===i&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(h=isNaN(i)?1:0,o=f):(o=Math.floor(Math.log(i)/Math.LN2),i*(a=Math.pow(2,-o))<1&&(o--,a*=2),(i+=o+p>=1?d/a:d*Math.pow(2,1-p))*a>=2&&(o++,a/=2),o+p>=f?(h=0,o=f):o+p>=1?(h=(i*a-1)*Math.pow(2,s),o+=p):(h=i*Math.pow(2,p-1)*Math.pow(2,s),o=0));s>=8;t[r+c]=255&h,c+=l,h/=256,s-=8);for(o=o<<s|h,u+=s;u>0;t[r+c]=255&o,c+=l,o/=256,u-=8);t[r+c-l]|=128*w};function e(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}e.Varint=0,e.Fixed64=1,e.Bytes=2,e.Fixed32=5;var s=4294967296,n=1/s;function o(t){return t.type===e.Bytes?t.readVarint()+t.pos:t.pos+1}function h(t,i,r){return r?4294967296*i+(t>>>0):4294967296*(i>>>0)+(t>>>0)}function a(t,i,r){var e=i<=16383?1:i<=2097151?2:i<=268435455?3:Math.ceil(Math.log(i)/(7*Math.LN2));r.realloc(e);for(var s=r.pos-1;s>=t;s--)r.buf[s+e]=r.buf[s]}function u(t,i){for(var r=0;r<t.length;r++)i.writeVarint(t[r])}function f(t,i){for(var r=0;r<t.length;r++)i.writeSVarint(t[r])}function p(t,i){for(var r=0;r<t.length;r++)i.writeFloat(t[r])}function d(t,i){for(var r=0;r<t.length;r++)i.writeDouble(t[r])}function c(t,i){for(var r=0;r<t.length;r++)i.writeBoolean(t[r])}function l(t,i){for(var r=0;r<t.length;r++)i.writeFixed32(t[r])}function w(t,i){for(var r=0;r<t.length;r++)i.writeSFixed32(t[r])}function F(t,i){for(var r=0;r<t.length;r++)i.writeFixed64(t[r])}function b(t,i){for(var r=0;r<t.length;r++)i.writeSFixed64(t[r])}function g(t,i){return(t[i]|t[i+1]<<8|t[i+2]<<16)+16777216*t[i+3]}function v(t,i,r){t[r]=i,t[r+1]=i>>>8,t[r+2]=i>>>16,t[r+3]=i>>>24}function x(t,i){return(t[i]|t[i+1]<<8|t[i+2]<<16)+(t[i+3]<<24)}e.prototype={destroy:function(){this.buf=null},readFields:function(t,i,r){for(r=r||this.length;this.pos<r;){var e=this.readVarint(),s=e>>3,n=this.pos;this.type=7&e,t(s,i,this),this.pos===n&&this.skip(e)}return i},readMessage:function(t,i){return this.readFields(t,i,this.readVarint()+this.pos)},readFixed32:function(){var t=g(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=x(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=g(this.buf,this.pos)+g(this.buf,this.pos+4)*s;return this.pos+=8,t},readSFixed64:function(){var t=g(this.buf,this.pos)+x(this.buf,this.pos+4)*s;return this.pos+=8,t},readFloat:function(){var t=i(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=i(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var i,r,e=this.buf;return i=127&(r=e[this.pos++]),r<128?i:(i|=(127&(r=e[this.pos++]))<<7,r<128?i:(i|=(127&(r=e[this.pos++]))<<14,r<128?i:(i|=(127&(r=e[this.pos++]))<<21,r<128?i:function(t,i,r){var e,s,n=r.buf;if(s=n[r.pos++],e=(112&s)>>4,s<128)return h(t,e,i);if(s=n[r.pos++],e|=(127&s)<<3,s<128)return h(t,e,i);if(s=n[r.pos++],e|=(127&s)<<10,s<128)return h(t,e,i);if(s=n[r.pos++],e|=(127&s)<<17,s<128)return h(t,e,i);if(s=n[r.pos++],e|=(127&s)<<24,s<128)return h(t,e,i);if(s=n[r.pos++],e|=(1&s)<<31,s<128)return h(t,e,i);throw new Error("Expected varint not more than 10 bytes")}(i|=(15&(r=e[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,i=function(t,i,r){var e="",s=i;for(;s<r;){var n,o,h,a=t[s],u=null,f=a>239?4:a>223?3:a>191?2:1;if(s+f>r)break;1===f?a<128&&(u=a):2===f?128==(192&(n=t[s+1]))&&(u=(31&a)<<6|63&n)<=127&&(u=null):3===f?(n=t[s+1],o=t[s+2],128==(192&n)&&128==(1