UNPKG

@hoff97/tensor-js

Version:

PyTorch like deep learning inferrence library

1 lines 446 kB
!function(e){function t(t){for(var n,i,s=t[0],a=t[1],o=0,u=[];o<s.length;o++)i=s[o],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&u.push(r[i][0]),r[i]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(h&&h(t);u.length;)u.shift()()}var n={},r={0:0};var i={};var s={24:function(){return{"./rust_wasm_tensor_bg.js":{__wbindgen_object_drop_ref:function(e){return n[23].exports.O(e)},__wbg_length_2db20e5652f1eb59:function(e){return n[23].exports.r(e)},__wbg_length_2a79df4e680048d5:function(e){return n[23].exports.q(e)},__wbg_length_e77849dd07b0e4b5:function(e){return n[23].exports.x(e)},__wbg_length_3a5138f465b971ad:function(e){return n[23].exports.s(e)},__wbg_length_59a5d4644faa0c8c:function(e){return n[23].exports.t(e)},__wbg_length_5e510700137b465e:function(e){return n[23].exports.u(e)},__wbg_length_c190c5ddaeb6db96:function(e){return n[23].exports.w(e)},__wbg_length_ad7b05b022ac71bd:function(e){return n[23].exports.v(e)},__wbg_newwithlength_d117d423ff97cefd:function(e){return n[23].exports.E(e)},__wbg_getindex_69c7c7394025c68f:function(e,t){return n[23].exports.j(e,t)},__wbg_setindex_9c30de03e0b63fdc:function(e,t,r){return n[23].exports.J(e,t,r)},__wbg_newwithlength_c34ef880a456cd52:function(e){return n[23].exports.D(e)},__wbg_getindex_6ef64e03d06e1433:function(e,t){return n[23].exports.m(e,t)},__wbg_setindex_85a180ecd90fa77d:function(e,t,r){return n[23].exports.H(e,t,r)},__wbg_newwithlength_f0f91f2b998757ae:function(e){return n[23].exports.F(e)},__wbg_getindex_6d504eac07f5787d:function(e,t){return n[23].exports.k(e,t)},__wbg_setindex_770ea561df838dfe:function(e,t,r){return n[23].exports.G(e,t,r)},__wbg_newwithlength_19241666d161c55f:function(e){return n[23].exports.z(e)},__wbg_getindex_1605a359263ce318:function(e,t){return n[23].exports.i(e,t)},__wbg_setindex_f68392bef584e583:function(e,t,r){return n[23].exports.N(e,t,r)},__wbg_newwithlength_2ea208e350120be9:function(e){return n[23].exports.A(e)},__wbg_getindex_f868a054f8e08cd0:function(e,t){return n[23].exports.p(e,t)},__wbg_setindex_da0bc122908c83e4:function(e,t,r){return n[23].exports.M(e,t,r)},__wbg_newwithlength_03e1fd5aaabeaa27:function(e){return n[23].exports.y(e)},__wbg_getindex_6ecb10d23c5ae363:function(e,t){return n[23].exports.l(e,t)},__wbg_setindex_a0672c0ab2aa3b1c:function(e,t,r){return n[23].exports.K(e,t,r)},__wbg_newwithlength_b7a8efa36e1aa3c3:function(e){return n[23].exports.C(e)},__wbg_getindex_8ea1aa1211e70399:function(e,t){return n[23].exports.n(e,t)},__wbg_setindex_b2937886c6ce1d95:function(e,t,r){return n[23].exports.L(e,t,r)},__wbg_newwithlength_b7182b9981406137:function(e){return n[23].exports.B(e)},__wbg_getindex_b144d325ab1e7a8e:function(e,t){return n[23].exports.o(e,t)},__wbg_setindex_928183e1dc113d65:function(e,t,r){return n[23].exports.I(e,t,r)},__wbindgen_throw:function(e,t){return n[23].exports.P(e,t)}}}}};function a(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.e=function(e){var t=[],n=r[e];if(0!==n)if(n)t.push(n[2]);else{var o=new Promise((function(t,i){n=r[e]=[t,i]}));t.push(n[2]=o);var u,l=document.createElement("script");l.charset="utf-8",l.timeout=120,a.nc&&l.setAttribute("nonce",a.nc),l.src=function(e){return a.p+""+e+".bundle.js"}(e);var h=new Error;u=function(t){l.onerror=l.onload=null,clearTimeout(c);var n=r[e];if(0!==n){if(n){var i=t&&("load"===t.type?"missing":t.type),s=t&&t.target&&t.target.src;h.message="Loading chunk "+e+" failed.\n("+i+": "+s+")",h.name="ChunkLoadError",h.type=i,h.request=s,n[1](h)}r[e]=void 0}};var c=setTimeout((function(){u({type:"timeout",target:l})}),12e4);l.onerror=l.onload=u,document.head.appendChild(l)}return({1:[24]}[e]||[]).forEach((function(e){var n=i[e];if(n)t.push(n);else{var r,o=s[e](),u=fetch(a.p+""+{24:"47b4335c2759457fb551"}[e]+".module.wasm");if(o instanceof Promise&&"function"==typeof WebAssembly.compileStreaming)r=Promise.all([WebAssembly.compileStreaming(u),o]).then((function(e){return WebAssembly.instantiate(e[0],e[1])}));else if("function"==typeof WebAssembly.instantiateStreaming)r=WebAssembly.instantiateStreaming(u,o);else{r=u.then((function(e){return e.arrayBuffer()})).then((function(e){return WebAssembly.instantiate(e,o)}))}t.push(i[e]=r.then((function(t){return a.w[e]=(t.instance||t).exports})))}})),Promise.all(t)},a.m=e,a.c=n,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(n,r,function(t){return e[t]}.bind(null,r));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a.oe=function(e){throw console.error(e),e},a.w={};var o=window.webpackJsonp=window.webpackJsonp||[],u=o.push.bind(o);o.push=t,o=o.slice();for(var l=0;l<o.length;l++)t(o[l]);var h=u;a(a.s=22)}([function(e,t){e.exports=r;var n=null;try{n=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function r(e,t,n){this.low=0|e,this.high=0|t,this.unsigned=!!n}function i(e){return!0===(e&&e.__isLong__)}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0}),r.isLong=i;var s={},a={};function o(e,t){var n,r,i;return t?(i=0<=(e>>>=0)&&e<256)&&(r=a[e])?r:(n=l(e,(0|e)<0?-1:0,!0),i&&(a[e]=n),n):(i=-128<=(e|=0)&&e<128)&&(r=s[e])?r:(n=l(e,e<0?-1:0,!1),i&&(s[e]=n),n)}function u(e,t){if(isNaN(e))return t?w:y;if(t){if(e<0)return w;if(e>=d)return A}else{if(e<=-m)return k;if(e+1>=m)return S}return e<0?u(-e,t).neg():l(e%f|0,e/f|0,t)}function l(e,t,n){return new r(e,t,n)}r.fromInt=o,r.fromNumber=u,r.fromBits=l;var h=Math.pow;function c(e,t,n){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return y;if("number"==typeof t?(n=t,t=!1):t=!!t,(n=n||10)<2||36<n)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===r)return c(e.substring(1),t,n).neg();for(var i=u(h(n,8)),s=y,a=0;a<e.length;a+=8){var o=Math.min(8,e.length-a),l=parseInt(e.substring(a,a+o),n);if(o<8){var p=u(h(n,o));s=s.mul(p).add(u(l))}else s=(s=s.mul(i)).add(u(l))}return s.unsigned=t,s}function p(e,t){return"number"==typeof e?u(e,t):"string"==typeof e?c(e,t):l(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}r.fromString=c,r.fromValue=p;var f=4294967296,d=f*f,m=d/2,g=o(1<<24),y=o(0);r.ZERO=y;var w=o(0,!0);r.UZERO=w;var v=o(1);r.ONE=v;var b=o(1,!0);r.UONE=b;var x=o(-1);r.NEG_ONE=x;var S=l(-1,2147483647,!1);r.MAX_VALUE=S;var A=l(-1,-1,!0);r.MAX_UNSIGNED_VALUE=A;var k=l(0,-2147483648,!1);r.MIN_VALUE=k;var T=r.prototype;T.toInt=function(){return this.unsigned?this.low>>>0:this.low},T.toNumber=function(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)},T.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(k)){var t=u(e),n=this.div(t),r=n.mul(t).sub(this);return n.toString(e)+r.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=u(h(e,6),this.unsigned),s=this,a="";;){var o=s.div(i),l=(s.sub(o.mul(i)).toInt()>>>0).toString(e);if((s=o).isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},T.getHighBits=function(){return this.high},T.getHighBitsUnsigned=function(){return this.high>>>0},T.getLowBits=function(){return this.low},T.getLowBitsUnsigned=function(){return this.low>>>0},T.getNumBitsAbs=function(){if(this.isNegative())return this.eq(k)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},T.isZero=function(){return 0===this.high&&0===this.low},T.eqz=T.isZero,T.isNegative=function(){return!this.unsigned&&this.high<0},T.isPositive=function(){return this.unsigned||this.high>=0},T.isOdd=function(){return 1==(1&this.low)},T.isEven=function(){return 0==(1&this.low)},T.equals=function(e){return i(e)||(e=p(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},T.eq=T.equals,T.notEquals=function(e){return!this.eq(e)},T.neq=T.notEquals,T.ne=T.notEquals,T.lessThan=function(e){return this.comp(e)<0},T.lt=T.lessThan,T.lessThanOrEqual=function(e){return this.comp(e)<=0},T.lte=T.lessThanOrEqual,T.le=T.lessThanOrEqual,T.greaterThan=function(e){return this.comp(e)>0},T.gt=T.greaterThan,T.greaterThanOrEqual=function(e){return this.comp(e)>=0},T.gte=T.greaterThanOrEqual,T.ge=T.greaterThanOrEqual,T.compare=function(e){if(i(e)||(e=p(e)),this.eq(e))return 0;var t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},T.comp=T.compare,T.negate=function(){return!this.unsigned&&this.eq(k)?k:this.not().add(v)},T.neg=T.negate,T.add=function(e){i(e)||(e=p(e));var t=this.high>>>16,n=65535&this.high,r=this.low>>>16,s=65535&this.low,a=e.high>>>16,o=65535&e.high,u=e.low>>>16,h=0,c=0,f=0,d=0;return f+=(d+=s+(65535&e.low))>>>16,c+=(f+=r+u)>>>16,h+=(c+=n+o)>>>16,h+=t+a,l((f&=65535)<<16|(d&=65535),(h&=65535)<<16|(c&=65535),this.unsigned)},T.subtract=function(e){return i(e)||(e=p(e)),this.add(e.neg())},T.sub=T.subtract,T.multiply=function(e){if(this.isZero())return y;if(i(e)||(e=p(e)),n)return l(n.mul(this.low,this.high,e.low,e.high),n.get_high(),this.unsigned);if(e.isZero())return y;if(this.eq(k))return e.isOdd()?k:y;if(e.eq(k))return this.isOdd()?k:y;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(g)&&e.lt(g))return u(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,r=65535&this.high,s=this.low>>>16,a=65535&this.low,o=e.high>>>16,h=65535&e.high,c=e.low>>>16,f=65535&e.low,d=0,m=0,w=0,v=0;return w+=(v+=a*f)>>>16,m+=(w+=s*f)>>>16,w&=65535,m+=(w+=a*c)>>>16,d+=(m+=r*f)>>>16,m&=65535,d+=(m+=s*c)>>>16,m&=65535,d+=(m+=a*h)>>>16,d+=t*f+r*c+s*h+a*o,l((w&=65535)<<16|(v&=65535),(d&=65535)<<16|(m&=65535),this.unsigned)},T.mul=T.multiply,T.divide=function(e){if(i(e)||(e=p(e)),e.isZero())throw Error("division by zero");var t,r,s;if(n)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?l((this.unsigned?n.div_u:n.div_s)(this.low,this.high,e.low,e.high),n.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?w:y;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return w;if(e.gt(this.shru(1)))return b;s=w}else{if(this.eq(k))return e.eq(v)||e.eq(x)?k:e.eq(k)?v:(t=this.shr(1).div(e).shl(1)).eq(y)?e.isNegative()?v:x:(r=this.sub(e.mul(t)),s=t.add(r.div(e)));if(e.eq(k))return this.unsigned?w:y;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=y}for(r=this;r.gte(e);){t=Math.max(1,Math.floor(r.toNumber()/e.toNumber()));for(var a=Math.ceil(Math.log(t)/Math.LN2),o=a<=48?1:h(2,a-48),c=u(t),f=c.mul(e);f.isNegative()||f.gt(r);)f=(c=u(t-=o,this.unsigned)).mul(e);c.isZero()&&(c=v),s=s.add(c),r=r.sub(f)}return s},T.div=T.divide,T.modulo=function(e){return i(e)||(e=p(e)),n?l((this.unsigned?n.rem_u:n.rem_s)(this.low,this.high,e.low,e.high),n.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},T.mod=T.modulo,T.rem=T.modulo,T.not=function(){return l(~this.low,~this.high,this.unsigned)},T.and=function(e){return i(e)||(e=p(e)),l(this.low&e.low,this.high&e.high,this.unsigned)},T.or=function(e){return i(e)||(e=p(e)),l(this.low|e.low,this.high|e.high,this.unsigned)},T.xor=function(e){return i(e)||(e=p(e)),l(this.low^e.low,this.high^e.high,this.unsigned)},T.shiftLeft=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):l(0,this.low<<e-32,this.unsigned)},T.shl=T.shiftLeft,T.shiftRight=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):l(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},T.shr=T.shiftRight,T.shiftRightUnsigned=function(e){if(i(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?l(this.low>>>e|t<<32-e,t>>>e,this.unsigned):l(32===e?t:t>>>e-32,0,this.unsigned)},T.shru=T.shiftRightUnsigned,T.shr_u=T.shiftRightUnsigned,T.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},T.toUnsigned=function(){return this.unsigned?this:l(this.low,this.high,!0)},T.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},T.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},T.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},r.fromBytes=function(e,t,n){return n?r.fromBytesLE(e,t):r.fromBytesBE(e,t)},r.fromBytesLE=function(e,t){return new r(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},r.fromBytesBE=function(e,t){return new r(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},function(e,t,n){"use strict";(function(e){var r=t;function i(e,t,n){for(var r=Object.keys(t),i=0;i<r.length;++i)void 0!==e[r[i]]&&n||(e[r[i]]=t[r[i]]);return e}function s(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&i(this,n)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}r.asPromise=n(9),r.base64=n(10),r.EventEmitter=n(11),r.float=n(12),r.inquire=n(13),r.utf8=n(14),r.pool=n(15),r.LongBits=n(16),r.isNode=Boolean(void 0!==e&&e&&e.process&&e.process.versions&&e.process.versions.node),r.global=r.isNode&&e||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"==typeof e||e instanceof String},r.isObject=function(e){return e&&"object"==typeof e},r.isset=r.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!=typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"==typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){var n=r.LongBits.fromHash(e);return r.Long?r.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))},r.merge=i,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=s,r.ProtocolError=s("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;n>-1;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}}).call(this,n(8))},function(e,t,n){"use strict";e.exports=c;var r,i=n(1),s=i.LongBits,a=i.base64,o=i.utf8;function u(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function l(){}function h(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function c(){this.len=0,this.head=new u(l,0,0),this.tail=this.head,this.states=null}var p=function(){return i.Buffer?function(){return(c.create=function(){return new r})()}:function(){return new c}};function f(e,t,n){t[n]=255&e}function d(e,t){this.len=e,this.next=void 0,this.val=t}function m(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function g(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}c.create=p(),c.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(c.alloc=i.pool(c.alloc,i.Array.prototype.subarray)),c.prototype._push=function(e,t,n){return this.tail=this.tail.next=new u(e,t,n),this.len+=t,this},d.prototype=Object.create(u.prototype),d.prototype.fn=function(e,t,n){for(;e>127;)t[n++]=127&e|128,e>>>=7;t[n]=e},c.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new d((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},c.prototype.int32=function(e){return e<0?this._push(m,10,s.fromNumber(e)):this.uint32(e)},c.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},c.prototype.uint64=function(e){var t=s.from(e);return this._push(m,t.length(),t)},c.prototype.int64=c.prototype.uint64,c.prototype.sint64=function(e){var t=s.from(e).zzEncode();return this._push(m,t.length(),t)},c.prototype.bool=function(e){return this._push(f,1,e?1:0)},c.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},c.prototype.sfixed32=c.prototype.fixed32,c.prototype.fixed64=function(e){var t=s.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},c.prototype.sfixed64=c.prototype.fixed64,c.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},c.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var y=i.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};c.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var n=c.alloc(t=a.length(e));a.decode(e,n,0),e=n}return this.uint32(t)._push(y,t,e)},c.prototype.string=function(e){var t=o.length(e);return t?this.uint32(t)._push(o.write,t,e):this._push(f,1,0)},c.prototype.fork=function(){return this.states=new h(this),this.head=this.tail=new u(l,0,0),this.len=0,this},c.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new u(l,0,0),this.len=0),this},c.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},c.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},c._configure=function(e){r=e,c.create=p(),r._configure()}},function(e,t,n){"use strict";e.exports=u;var r,i=n(1),s=i.LongBits,a=i.utf8;function o(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function u(e){this.buf=e,this.pos=0,this.len=e.length}var l,h="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new u(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new u(e);throw Error("illegal buffer")},c=function(){return i.Buffer?function(e){return(u.create=function(e){return i.Buffer.isBuffer(e)?new r(e):h(e)})(e)}:h};function p(){var e=new s(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw o(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw o(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function f(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function d(){if(this.pos+8>this.len)throw o(this,8);return new s(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}u.create=c(),u.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,u.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return l;if((this.pos+=5)>this.len)throw this.pos=this.len,o(this,10);return l}),u.prototype.int32=function(){return 0|this.uint32()},u.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},u.prototype.bool=function(){return 0!==this.uint32()},u.prototype.fixed32=function(){if(this.pos+4>this.len)throw o(this,4);return f(this.buf,this.pos+=4)},u.prototype.sfixed32=function(){if(this.pos+4>this.len)throw o(this,4);return 0|f(this.buf,this.pos+=4)},u.prototype.float=function(){if(this.pos+4>this.len)throw o(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},u.prototype.double=function(){if(this.pos+8>this.len)throw o(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},u.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw o(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},u.prototype.string=function(){var e=this.bytes();return a.read(e,0,e.length)},u.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw o(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw o(this)}while(128&this.buf[this.pos++]);return this},u.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},u._configure=function(e){r=e,u.create=c(),r._configure();var t=i.Long?"toLong":"toNumber";i.merge(u.prototype,{int64:function(){return p.call(this)[t](!1)},uint64:function(){return p.call(this)[t](!0)},sint64:function(){return p.call(this).zzDecode()[t](!1)},fixed64:function(){return d.call(this)[t](!0)},sfixed64:function(){return d.call(this)[t](!1)}})}},function(e,t,n){e.exports=function(){"use strict";var e=function(e){return e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof Float64Array||e instanceof Uint8ClampedArray},t=function(e,t){for(var n=Object.keys(t),r=0;r<n.length;++r)e[n[r]]=t[n[r]];return e};function n(e){var t=new Error("(regl) "+e);throw console.error(t),t}function r(e,t){e||n(t)}function i(e){return e?": "+e:""}function s(e,t){switch(t){case"number":return"number"==typeof e;case"object":return"object"==typeof e;case"string":return"string"==typeof e;case"boolean":return"boolean"==typeof e;case"function":return"function"==typeof e;case"undefined":return void 0===e;case"symbol":return"symbol"==typeof e}}function a(e,t,r){t.indexOf(e)<0&&n("invalid value"+i(r)+". must be one of: "+t)}var o=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function u(e,t){for(e+="";e.length<t;)e=" "+e;return e}function l(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function h(e,t){this.number=e,this.line=t,this.errors=[]}function c(e,t,n){this.file=e,this.line=t,this.message=n}function p(){var e=new Error,t=(e.stack||e).toString(),n=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(t);if(n)return n[1];var r=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(t);return r?r[1]:"unknown"}function f(){var e=new Error,t=(e.stack||e).toString(),n=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(t);if(n)return n[1];var r=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(t);return r?r[1]:"unknown"}function d(e,t){var n,r=e.split("\n"),i=1,s=0,a={unknown:new l,0:new l};a.unknown.name=a[0].name=t||p(),a.unknown.lines.push(new h(0,""));for(var o=0;o<r.length;++o){var u=r[o],c=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(u);if(c)switch(c[1]){case"line":var f=/(\d+)(\s+\d+)?/.exec(c[2]);f&&(i=0|f[1],f[2]&&((s=0|f[2])in a||(a[s]=new l)));break;case"define":var d=/SHADER_NAME(_B64)?\s+(.*)$/.exec(c[2]);d&&(a[s].name=d[1]?(n=d[2],"undefined"!=typeof atob?atob(n):"base64:"+n):d[2])}a[s].lines.push(new h(i++,u))}return Object.keys(a).forEach((function(e){var t=a[e];t.lines.forEach((function(e){t.index[e.number]=e}))})),a}function m(e){e._commandRef=p()}function g(e,t){var r=f();n(e+" in command "+(t||p())+("unknown"===r?"":" called from "+r))}function y(e,t,n,r){s(e,t)||g("invalid parameter type"+i(n)+". expected "+t+", got "+typeof e,r||p())}var w={};function v(e,t){return 32820===e||32819===e||33635===e?2:34042===e?4:w[e]*t}function b(e){return!(e&e-1||!e)}w[5120]=w[5121]=1,w[5122]=w[5123]=w[36193]=w[33635]=w[32819]=w[32820]=2,w[5124]=w[5125]=w[5126]=w[34042]=4;var x=t(r,{optional:function(e){e()},raise:n,commandRaise:g,command:function(e,t,n){e||g(t,n||p())},parameter:function(e,t,r){e in t||n("unknown parameter ("+e+")"+i(r)+". possible values: "+Object.keys(t).join())},commandParameter:function(e,t,n,r){e in t||g("unknown parameter ("+e+")"+i(n)+". possible values: "+Object.keys(t).join(),r||p())},constructor:function(e){Object.keys(e).forEach((function(e){o.indexOf(e)<0&&n('invalid regl constructor argument "'+e+'". must be one of '+o)}))},type:function(e,t,r){s(e,t)||n("invalid parameter type"+i(r)+". expected "+t+", got "+typeof e)},commandType:y,isTypedArray:function(t,r){e(t)||n("invalid parameter type"+i(r)+". must be a typed array")},nni:function(e,t){e>=0&&(0|e)===e||n("invalid parameter type, ("+e+")"+i(t)+". must be a nonnegative integer")},oneOf:a,shaderError:function(e,t,n,i,s){if(!e.getShaderParameter(t,e.COMPILE_STATUS)){var a=e.getShaderInfoLog(t),o=i===e.FRAGMENT_SHADER?"fragment":"vertex";y(n,"string",o+" shader source must be a string",s);var l=d(n,s),h=function(e){var t=[];return e.split("\n").forEach((function(e){if(!(e.length<5)){var n=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(e);n?t.push(new c(0|n[1],0|n[2],n[3].trim())):e.length>0&&t.push(new c("unknown",0,e))}})),t}(a);!function(e,t){t.forEach((function(t){var n=e[t.file];if(n){var r=n.index[t.line];if(r)return r.errors.push(t),void(n.hasErrors=!0)}e.unknown.hasErrors=!0,e.unknown.lines[0].errors.push(t)}))}(l,h),Object.keys(l).forEach((function(e){var t=l[e];if(t.hasErrors){var n=[""],r=[""];i("file number "+e+": "+t.name+"\n","color:red;text-decoration:underline;font-weight:bold"),t.lines.forEach((function(e){if(e.errors.length>0){i(u(e.number,4)+"| ","background-color:yellow; font-weight:bold"),i(e.line+"\n","color:red; background-color:yellow; font-weight:bold");var t=0;e.errors.forEach((function(n){var r=n.message,s=/^\s*'(.*)'\s*:\s*(.*)$/.exec(r);if(s){var a=s[1];switch(r=s[2],a){case"assign":a="="}t=Math.max(e.line.indexOf(a,t),0)}else t=0;i(u("| ",6)),i(u("^^^",t+3)+"\n","font-weight:bold"),i(u("| ",6)),i(r+"\n","font-weight:bold")})),i(u("| ",6)+"\n")}else i(u(e.number,4)+"| "),i(e.line+"\n","color:red")})),"undefined"==typeof document||window.chrome?console.log(n.join("")):(r[0]=n.join("%c"),console.log.apply(console,r))}function i(e,t){n.push(e),r.push(t||"")}})),r.raise("Error compiling "+o+" shader, "+l[0].name)}},linkError:function(e,t,n,i,s){if(!e.getProgramParameter(t,e.LINK_STATUS)){var a=e.getProgramInfoLog(t),o=d(n,s),u='Error linking program with vertex shader, "'+d(i,s)[0].name+'", and fragment shader "'+o[0].name+'"';"undefined"!=typeof document?console.log("%c"+u+"\n%c"+a,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(u+"\n"+a),r.raise(u)}},callSite:f,saveCommandRef:m,saveDrawInfo:function(e,t,n,r){function i(e){return e?r.id(e):0}function s(e,t){Object.keys(t).forEach((function(t){e[r.id(t)]=!0}))}m(e),e._fragId=i(e.static.frag),e._vertId=i(e.static.vert);var a=e._uniformSet={};s(a,t.static),s(a,t.dynamic);var o=e._attributeSet={};s(o,n.static),s(o,n.dynamic),e._hasCount="count"in e.static||"count"in e.dynamic||"elements"in e.static||"elements"in e.dynamic},framebufferFormat:function(e,t,n){e.texture?a(e.texture._texture.internalformat,t,"unsupported texture format for attachment"):a(e.renderbuffer._renderbuffer.format,n,"unsupported renderbuffer format for attachment")},guessCommand:p,texture2D:function(e,t,n){var i,s=t.width,a=t.height,o=t.channels;r(s>0&&s<=n.maxTextureSize&&a>0&&a<=n.maxTextureSize,"invalid texture shape"),33071===e.wrapS&&33071===e.wrapT||r(b(s)&&b(a),"incompatible wrap mode for texture, both width and height must be power of 2"),1===t.mipmask?1!==s&&1!==a&&r(9984!==e.minFilter&&9986!==e.minFilter&&9985!==e.minFilter&&9987!==e.minFilter,"min filter requires mipmap"):(r(b(s)&&b(a),"texture must be a square power of 2 to support mipmapping"),r(t.mipmask===(s<<1)-1,"missing or incomplete mipmap data")),5126===t.type&&(n.extensions.indexOf("oes_texture_float_linear")<0&&r(9728===e.minFilter&&9728===e.magFilter,"filter not supported, must enable oes_texture_float_linear"),r(!e.genMipmaps,"mipmap generation not supported with float textures"));var u=t.images;for(i=0;i<16;++i)if(u[i]){var l=s>>i,h=a>>i;r(t.mipmask&1<<i,"missing mipmap data");var c=u[i];if(r(c.width===l&&c.height===h,"invalid shape for mip images"),r(c.format===t.format&&c.internalformat===t.internalformat&&c.type===t.type,"incompatible type for mip image"),c.compressed);else if(c.data){var p=Math.ceil(v(c.type,o)*l/c.unpackAlignment)*c.unpackAlignment;r(c.data.byteLength===p*h,"invalid data for image, buffer size is inconsistent with image format")}else c.element||c.copy}else e.genMipmaps||r(0==(t.mipmask&1<<i),"extra mipmap data");t.compressed&&r(!e.genMipmaps,"mipmap generation for compressed images not supported")},textureCube:function(e,t,n,i){var s=e.width,a=e.height,o=e.channels;r(s>0&&s<=i.maxTextureSize&&a>0&&a<=i.maxTextureSize,"invalid texture shape"),r(s===a,"cube map must be square"),r(33071===t.wrapS&&33071===t.wrapT,"wrap mode not supported by cube map");for(var u=0;u<n.length;++u){var l=n[u];r(l.width===s&&l.height===a,"inconsistent cube map face shape"),t.genMipmaps&&(r(!l.compressed,"can not generate mipmap for compressed textures"),r(1===l.mipmask,"can not specify mipmaps and generate mipmaps"));for(var h=l.images,c=0;c<16;++c){var p=h[c];if(p){var f=s>>c,d=a>>c;r(l.mipmask&1<<c,"missing mipmap data"),r(p.width===f&&p.height===d,"invalid shape for mip images"),r(p.format===e.format&&p.internalformat===e.internalformat&&p.type===e.type,"incompatible type for mip image"),p.compressed||(p.data?r(p.data.byteLength===f*d*Math.max(v(p.type,o),p.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):p.element||p.copy)}}}}}),S=0;function A(e,t){this.id=S++,this.type=e,this.data=t}function k(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function T(e){return"["+function e(t){if(0===t.length)return[];var n=t.charAt(0),r=t.charAt(t.length-1);if(t.length>1&&n===r&&('"'===n||"'"===n))return['"'+k(t.substr(1,t.length-2))+'"'];var i=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(t);if(i)return e(t.substr(0,i.index)).concat(e(i[1])).concat(e(t.substr(i.index+i[0].length)));var s=t.split(".");if(1===s.length)return['"'+k(t)+'"'];for(var a=[],o=0;o<s.length;++o)a=a.concat(e(s[o]));return a}(e).join("][")+"]"}var D={DynamicVariable:A,define:function(e,t){return new A(e,T(t+""))},isDynamic:function(e){return"function"==typeof e&&!e._reglType||e instanceof A},unbox:function e(t,n){return"function"==typeof t?new A(0,t):"number"==typeof t||"boolean"==typeof t?new A(5,t):Array.isArray(t)?new A(6,t.map((function(t,r){return e(t,n+"["+r+"]")}))):t instanceof A?t:void x(!1,"invalid option type in uniform "+n)},accessor:T},O={next:"function"==typeof requestAnimationFrame?function(e){return requestAnimationFrame(e)}:function(e){return setTimeout(e,16)},cancel:"function"==typeof cancelAnimationFrame?function(e){return cancelAnimationFrame(e)}:clearTimeout},P="undefined"!=typeof performance&&performance.now?function(){return performance.now()}:function(){return+new Date};function _(e){return"string"==typeof e?e.split():(x(Array.isArray(e),"invalid extension array"),e)}function I(e){return"string"==typeof e?(x("undefined"!=typeof document,"not supported outside of DOM"),document.querySelector(e)):e}function E(e){var n,r,i,s,a,o=e||{},u={},l=[],h=[],c="undefined"==typeof window?1:window.devicePixelRatio,p=!1,f=function(e){e&&x.raise(e)},d=function(){};if("string"==typeof o?(x("undefined"!=typeof document,"selector queries only supported in DOM enviroments"),n=document.querySelector(o),x(n,"invalid query string for element")):"object"==typeof o?"string"==typeof(a=o).nodeName&&"function"==typeof a.appendChild&&"function"==typeof a.getBoundingClientRect?n=o:function(e){return"function"==typeof e.drawArrays||"function"==typeof e.drawElements}(o)?i=(s=o).canvas:(x.constructor(o),"gl"in o?s=o.gl:"canvas"in o?i=I(o.canvas):"container"in o&&(r=I(o.container)),"attributes"in o&&(u=o.attributes,x.type(u,"object","invalid context attributes")),"extensions"in o&&(l=_(o.extensions)),"optionalExtensions"in o&&(h=_(o.optionalExtensions)),"onDone"in o&&(x.type(o.onDone,"function","invalid or missing onDone callback"),f=o.onDone),"profile"in o&&(p=!!o.profile),"pixelRatio"in o&&(c=+o.pixelRatio,x(c>0,"invalid pixel ratio"))):x.raise("invalid arguments to regl"),n&&("canvas"===n.nodeName.toLowerCase()?i=n:r=n),!s){if(!i){x("undefined"!=typeof document,"must manually specify webgl context outside of DOM environments");var m=function(e,n,r){var i,s=document.createElement("canvas");function a(){var n=window.innerWidth,i=window.innerHeight;if(e!==document.body){var a=e.getBoundingClientRect();n=a.right-a.left,i=a.bottom-a.top}s.width=r*n,s.height=r*i,t(s.style,{width:n+"px",height:i+"px"})}return t(s.style,{border:0,margin:0,padding:0,top:0,left:0}),e.appendChild(s),e===document.body&&(s.style.position="absolute",t(e.style,{margin:0,padding:0})),e!==document.body&&"function"==typeof ResizeObserver?(i=new ResizeObserver((function(){setTimeout(a)}))).observe(e):window.addEventListener("resize",a,!1),a(),{canvas:s,onDestroy:function(){i?i.disconnect():window.removeEventListener("resize",a),e.removeChild(s)}}}(r||document.body,0,c);if(!m)return null;i=m.canvas,d=m.onDestroy}void 0===u.premultipliedAlpha&&(u.premultipliedAlpha=!0),s=function(e,t){function n(n){try{return e.getContext(n,t)}catch(e){return null}}return n("webgl")||n("experimental-webgl")||n("webgl-experimental")}(i,u)}return s?{gl:s,canvas:i,container:r,extensions:l,optionalExtensions:h,pixelRatio:c,profile:p,onDone:f,onDestroy:d}:(d(),f("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function V(e,t){for(var n=Array(e),r=0;r<e;++r)n[r]=t(r);return n}function M(e){var t,n;return t=(e>65535)<<4,t|=n=((e>>>=t)>255)<<3,t|=n=((e>>>=n)>15)<<2,(t|=n=((e>>>=n)>3)<<1)|(e>>>=n)>>1}function $(){var e=V(8,(function(){return[]}));function t(t){var n=function(e){for(var t=16;t<=1<<28;t*=16)if(e<=t)return t;return 0}(t),r=e[M(n)>>2];return r.length>0?r.pop():new ArrayBuffer(n)}function n(t){e[M(t.byteLength)>>2].push(t)}return{alloc:t,free:n,allocType:function(e,n){var r=null;switch(e){case 5120:r=new Int8Array(t(n),0,n);break;case 5121:r=new Uint8Array(t(n),0,n);break;case 5122:r=new Int16Array(t(2*n),0,n);break;case 5123:r=new Uint16Array(t(2*n),0,n);break;case 5124:r=new Int32Array(t(4*n),0,n);break;case 5125:r=new Uint32Array(t(4*n),0,n);break;case 5126:r=new Float32Array(t(4*n),0,n);break;default:return null}return r.length!==n?r.subarray(0,n):r},freeType:function(e){n(e.buffer)}}}var C=$();function j(t){return!!t&&"object"==typeof t&&Array.isArray(t.shape)&&Array.isArray(t.stride)&&"number"==typeof t.offset&&t.shape.length===t.stride.length&&(Array.isArray(t.data)||e(t.data))}C.zero=$();var N=function(e){return Object.keys(e).map((function(t){return e[t]}))},z={shape:function(e){for(var t=[],n=e;n.length;n=n[0])t.push(n.length);return t},flatten:function(e,t,n,r){var i=1;if(t.length)for(var s=0;s<t.length;++s)i*=t[s];else i=0;var a=r||C.allocType(n,i);switch(t.length){case 0:break;case 1:!function(e,t,n){for(var r=0;r<t;++r)n[r]=e[r]}(e,t[0],a);break;case 2:!function(e,t,n,r){for(var i=0,s=0;s<t;++s)for(var a=e[s],o=0;o<n;++o)r[i++]=a[o]}(e,t[0],t[1],a);break;case 3:L(e,t[0],t[1],t[2],a,0);break;default:!function e(t,n,r,i,s){for(var a=1,o=r+1;o<n.length;++o)a*=n[o];var u=n[r];if(n.length-r==4){var l=n[r+1],h=n[r+2],c=n[r+3];for(o=0;o<u;++o)L(t[o],l,h,c,i,s),s+=a}else for(o=0;o<u;++o)e(t[o],n,r+1,i,s),s+=a}(e,t,0,a,0)}return a}};function L(e,t,n,r,i,s){for(var a=s,o=0;o<t;++o)for(var u=e[o],l=0;l<n;++l)for(var h=u[l],c=0;c<r;++c)i[a++]=h[c]}var B={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},R={int8:5120,int16:5122,int32:5124,uint8:5121,uint16:5123,uint32:5125,float:5126,float32:5126},G={dynamic:35048,stream:35040,static:35044},X=z.flatten,U=z.shape,F=[];function W(e){return 0|B[Object.prototype.toString.call(e)]}function q(e,t){for(var n=0;n<t.length;++n)e[n]=t[n]}function H(e,t,n,r,i,s,a){for(var o=0,u=0;u<n;++u)for(var l=0;l<r;++l)e[o++]=t[i*u+s*l+a]}F[5120]=1,F[5122]=2,F[5124]=4,F[5121]=1,F[5123]=2,F[5125]=4,F[5126]=4;var J={points:0,point:0,lines:1,line:1,triangles:4,triangle:4,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},Q=new Float32Array(1),Z=new Uint32Array(Q.buffer);function Y(e){for(var t=C.allocType(5123,e.length),n=0;n<e.length;++n)if(isNaN(e[n]))t[n]=65535;else if(e[n]===1/0)t[n]=31744;else if(e[n]===-1/0)t[n]=64512;else{Q[0]=e[n];var r=Z[0],i=r>>>31<<15,s=(r<<1>>>24)-127,a=r>>13&1023;if(s<-24)t[n]=i;else if(s<-14){var o=-14-s;t[n]=i+(a+1024>>o)}else t[n]=s>15?i+31744:i+(s+15<<10)+a}return t}function K(t){return Array.isArray(t)||e(t)}var ee=function(e){return!(e&e-1||!e)},te=[9984,9986,9985,9987],ne=[0,6409,6410,6407,6408],re={};function ie(e){return"[object "+e+"]"}re[6409]=re[6406]=re[6402]=1,re[34041]=re[6410]=2,re[6407]=re[35904]=3,re[6408]=re[35906]=4;var se=ie("HTMLCanvasElement"),ae=ie("OffscreenCanvas"),oe=ie("CanvasRenderingContext2D"),ue=ie("ImageBitmap"),le=ie("HTMLImageElement"),he=ie("HTMLVideoElement"),ce=Object.keys(B).concat([se,ae,oe,ue,le,he]),pe=[];pe[5121]=1,pe[5126]=4,pe[36193]=2,pe[5123]=2,pe[5125]=4;var fe=[];function de(e){return Array.isArray(e)&&(0===e.length||"number"==typeof e[0])}function me(e){return!!Array.isArray(e)&&!(0===e.length||!K(e[0]))}function ge(e){return Object.prototype.toString.call(e)}function ye(e){return ge(e)===se}function we(e){return ge(e)===ae}function ve(e){if(!e)return!1;var t=ge(e);return ce.indexOf(t)>=0||de(e)||me(e)||j(e)}function be(e){return 0|B[Object.prototype.toString.call(e)]}function xe(e,t){return C.allocType(36193===e.type?5126:e.type,t)}function Se(e,t){36193===e.type?(e.data=Y(t),C.freeType(t)):e.data=t}function Ae(e,t,n,r,i,s){var a;if(a=void 0!==fe[e]?fe[e]:re[e]*pe[t],s&&(a*=6),i){for(var o=0,u=n;u>=1;)o+=a*u*u,u/=2;return o}return a*n*r}function ke(n,r,i,s,a,o,u){var l={"don't care":4352,"dont care":4352,nice:4354,fast:4353},h={repeat:10497,clamp:33071,mirror:33648},c={nearest:9728,linear:9729},p=t({mipmap:9987,"nearest mipmap nearest":9984,"linear mipmap nearest":9985,"nearest mipmap linear":9986,"linear mipmap linear":9987},c),f={none:0,browser:37444},d={uint8:5121,rgba4:32819,rgb565:33635,"rgb5 a1":32820},m={alpha:6406,luminance:6409,"luminance alpha":6410,rgb:6407,rgba:6408,rgba4:32854,"rgb5 a1":32855,rgb565:36194},g={};r.ext_srgb&&(m.srgb=35904,m.srgba=35906),r.oes_texture_float&&(d.float32=d.float=5126),r.oes_texture_half_float&&(d.float16=d["half float"]=36193),r.webgl_depth_texture&&(t(m,{depth:6402,"depth stencil":34041}),t(d,{uint16:5123,uint32:5125,"depth stencil":34042})),r.webgl_compressed_texture_s3tc&&t(g,{"rgb s3tc dxt1":33776,"rgba s3tc dxt1":33777,"rgba s3tc dxt3":33778,"rgba s3tc dxt5":33779}),r.webgl_compressed_texture_atc&&t(g,{"rgb atc":35986,"rgba atc explicit alpha":35987,"rgba atc interpolated alpha":34798}),r.webgl_compressed_texture_pvrtc&&t(g,{"rgb pvrtc 4bppv1":35840,"rgb pvrtc 2bppv1":35841,"rgba pvrtc 4bppv1":35842,"rgba pvrtc 2bppv1":35843}),r.webgl_compressed_texture_etc1&&(g["rgb etc1"]=36196);var y=Array.prototype.slice.call(n.getParameter(34467));Object.keys(g).forEach((function(e){var t=g[e];y.indexOf(t)>=0&&(m[e]=t)}));var w=Object.keys(m);i.textureFormats=w;var v=[];Object.keys(m).forEach((function(e){var t=m[e];v[t]=e}));var b=[];Object.keys(d).forEach((function(e){var t=d[e];b[t]=e}));var S=[];Object.keys(c).forEach((function(e){S[c[e]]=e}));var A=[];Object.keys(p).forEach((function(e){var t=p[e];A[t]=e}));var k=[];Object.keys(h).forEach((function(e){k[h[e]]=e}));var T=w.reduce((function(e,t){var n=m[t];return 6409===n||6406===n||6409===n||6410===n||6402===n||34041===n||r.ext_srgb&&(35904===n||35906===n)?e[n]=n:32855===n||t.indexOf("rgba")>=0?e[n]=6408:e[n]=6407,e}),{});function D(){this.internalformat=6408,this.format=6408,this.type=5121,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=37444,this.width=0,this.height=0,this.channels=0}function O(e,t){e.internalformat=t.internalformat,e.format=t.format,e.type=t.type,e.compressed=t.compressed,e.premultiplyAlpha=t.premultiplyAlpha,e.flipY=t.flipY,e.unpackAlignment=t.unpackAlignment,e.colorSpace=t.colorSpace,e.width=t.width,e.height=t.height,e.channels=t.channels}function P(e,t){if("object"==typeof t&&t){if("premultiplyAlpha"in t&&(x.type(t.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),e.premultiplyAlpha=t.premultiplyAlpha),"flipY"in t&&(x.type(t.flipY,"boolean","invalid texture flip"),e.flipY=t.flipY),"alignment"in t&&(x.oneOf(t.alignment,[1,2,4,8],"invalid texture unpack alignment"),e.unpackAlignment=t.alignment),"colorSpace"in t&&(x.parameter(t.colorSpace,f,"invalid colorSpace"),e.colorSpace=f[t.colorSpace]),"type"in t){var n=t.type;x(r.oes_texture_float||!("float"===n||"float32"===n),"you must enable the OES_texture_float extension in order to use floating point textures."),x(r.oes_texture_half_float||!("half float"===n||"float16"===n),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),x(r.webgl_depth_texture||!("uint16"===n||"uint32"===n||"depth stencil"===n),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),x.parameter(n,d,"invalid texture type"),e.type=d[n]}var s=e.width,a=e.height,o=e.channels,u=!1;"shape"in t?(x(Array.isArray(t.shape)&&t.shape.length>=2,"shape must be an array"),s=t.shape[0],a=t.shape[1],3===t.shape.length&&(o=t.shape[2],x(o>0&&o<=4,"invalid number of channels"),u=!0),x(s>=0&&s<=i.maxTextureSize,"invalid width"),x(a>=0&&a<=i.maxTextureSize,"invalid height")):("radius"in t&&(s=a=t.radius,x(s>=0&&s<=i.maxTextureSize,"invalid radius")),"width"in t&&(s=t.width,x(s>=0&&s<=i.maxTextureSize,"invalid width")),"height"in t&&(a=t.height,x(a>=0&&a<=i.maxTextureSize,"invalid height")),"channels"in t&&(o=t.channels,x(o>0&&o<=4,"invalid number of channels"),u=!0)),e.width=0|s,e.height=0|a,e.channels=0|o;var l=!1;if("format"in t){var h=t.format;x(r.webgl_depth_texture||!("depth"===h||"depth stencil"===h),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),x.parameter(h,m,"invalid texture format");var c=e.internalformat=m[h];e.format=T[c],h in d&&("type"in t||(e.type=d[h])),h in g&&(e.compressed=!0),l=!0}!u&&l?e.channels=re[e.format]:u&&!l?e.channels!==ne[e.format]&&(e.format=e.internalformat=ne[e.channels]):l&&u&&x(e.channels===re[e.format],"number of channels inconsistent with specified format")}}function _(e){n.pixelStorei(37440,e.flipY),n.pixelStorei(37441,e.premultiplyAlpha),n.pixelStorei(37443,e.colorSpace),n.pixelStorei(3317,e.unpackAlignment)}function I(){D.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function E(t,n){var r=null;if(ve(n)?r=n:n&&(x.type(n,"object","invalid pixel data type"),P(t,n),"x"in n&&(t.xOffset=0|n.x),"y"in n&&(t.yOffset=0|n.y),ve(n.data)&&(r=n.data)),x(!t.compressed||r instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),n.copy){x(!r,"can not specify copy and data field for the same texture");var s=a.viewportWidth,o=a.viewportHeight;t.width=t.width||s-t.xOffset,t.height=t.height||o-t.yOffset,t.needsCopy=!0,x(t.xOffset>=0&&t.xOffset<s&&t.yOffset>=0&&t.yOffset<o&&t.width>0&&t.width<=s&&t.height>0&&t.height<=o,"copy texture read out of bounds")}else if(r){if(e(r))t.channels=t.channels||4,t.data=r,"type"in n||5121!==t.type||(t.type=be(r));else if(de(r))t.channels=t.channels||4,function(e,t){var n=t.length;switch(e.type){case 5121:case 5123:case 5125:case 5126:var r=C.allocType(e.type,n);r.set(t),e.data=r;break;case 36193:e.data=Y(t);break;default:x.raise("unsupported texture type, must specify a typed array")}}(t,r),t.alignment=1,t.needsFree=!0;else if(j(r)){var u=r.data;Array.isArray(u)||5121!==t.type||(t.type=be(u));var l,h,c,p,f,d,m=r.shape,g=r.stride;3===m.length?(c=m[2],d=g[2]):(x(2===m.length,"invalid ndarray pixel data, must be 2 or 3D"),c=1,d=1),l=m[0],h=m[1],p=g[0],f=g[1],t.alignment=1,t.width=l,t.height=h,t.channels=c,t.format=t.internalformat=ne[c],t.needsFree=!0,function(e,t,n,r,i,s){for(var a=e.width,o=e.height,u=e.channels,l=xe(e,a*o*u),h=0,c=0;c<o;++c)for(var p=0;p<a;++p)for(var f=0;f<u;++f)l[h++]=t[n*p+r*c+i*f+s];Se(e,l)}(t,u,p,f,d,r.offset)}else if(ye(r)||we(r)||ge(r)===oe)ye(r)||we(r)?t.element=r:t.element=r.canvas,t.width=t.element.width,t.height=t.element.height,t.channels=4;else if(function(e){return ge(e)===ue}(r))t.element=r,t.width=r.width,t.height=r.height,t.channels=4;else if(function(e){return ge(e)===le}(r))t.element=r,t.width=r.naturalWidth,t.height=r.naturalHeight,t.channels=4;else if(function(e){return ge(e)===he}(r))t.element=r,t.width=r.videoWidth,t.height=r.videoHeight,t.channels=4;else if(me(r)){var y=t.width||r[0].length,w=t.height||r.length,v=t.channels;v=K(r[0][0])?v||r[0][0].length:v||1;for(var b=z.shape(r),S=1,A=0;A<b.length;++A)S*=b[A];var k=xe(t,S);z.flatten(r,b,"",k),Se(t,k),t.alignment=1,t.width=y,t.height=w,t.channels=v,t.format=t.internalformat=ne[v],t.needsFree=!0}}else t.width=t.width||1,t.height=t.height||1,t.channels=t.channels||4;5126===t.type?x(i.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):36193===t.type&&x(i.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function V(e,t,r){var i=e.element,a=e.data,o=e.internalformat,u=e.format,l=e.type,h=e.width,c=e.height;_(e),i?n.texImage2D(t,r,u,u,l,i):e.compressed?n.compressedTexImage2D(t,r,o,h,c,0,a):e.needsCopy?(s(),n.copyTexImage2D(t,r,u,e.xOffset,e.yOffset,h,c,0)):n.texImage2D(t,r,u,h,c,0,u,l,a||null)}function M(e,t,r,i,a){var o=e.element,u=e.data,l=e.internalformat,h=e.format,c=e.type,p=e.width,f=e.height;_(e),o?n.texSubImage2D(t,a,r,i,h,c,o):e.compressed?n.compressedTexSubImage2D(t,a,r,i,l,p,f,u):e.needsCopy?(s(),n.copyTexSubImage2D(t,a,r,i,e.xOffset,e.yOffset,p,f)):n.texSubImage2D(t,a,r,i,p,f,h,c,u)}var $=[];function L(){return $.pop()||new I}function B(e){e.needsFree&&C.freeType(e.data),I.call(e),$.push(e)}function R(){D.call(this),this.genMipmaps=!1,this.mipmapHint=4352,this.mipmask=0,this.images=Array(16)}function G(e,t,n){var r=e.images[0]=L();e.mipmask=1,r.width=e.width=t,r.height=e.height=n,r.channels=e.channels=4}function X(e,t){var n=null;if(ve(t))O(n=e.images[0]=L(),e),E(n,t),e.mipmask=1;else if(P(e,t),Array.isArray(t.mipmap))for(var r=t.mipmap,i=0;i<r.length;++i)O(n=e.images[i]=L(),e),n.width>>=i,n.height>>=i,E(n,r[i]),e.mipmask|=1<<i;else O(n=e.images[0]=L