var decodeMmtf=function(){"use strict";function r(r){return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}function t(r){return new Int8Array(r.buffer,r.byteOffset,r.byteLength)}function n(r,t){var n,e,o,i=(r.byteOffset,r.byteLength);for(t||(t=new Int16Array(i/2)),n=0,e=0,o=i/2;o>n;++n,e+=2)t[n]=r[e]<<8^r[e+1]<<0;return t}function e(r,t){var n,e,o,i=(r.byteOffset,r.byteLength);for(t||(t=new Int32Array(i/4)),n=0,e=0,o=i/4;o>n;++n,e+=4)t[n]=r[e]<<24^r[e+1]<<16^r[e+2]<<8^r[e+3]<<0;return t}function o(r){return new Int32Array(r.buffer,r.byteOffset,r.byteLength/4)}function i(r,t,n){var e=r.length,o=1/t;n||(n=new Float32Array(e));for(var i=0;e>i;++i)n[i]=r[i]*o;return n}function a(r,t){var n,e;if(!t){var o=0;for(n=0,e=r.length;e>n;n+=2)o+=r[n+1];t=new r.constructor(o)}var i=0;for(n=0,e=r.length;e>n;n+=2)for(var a=r[n],u=r[n+1],s=0;u>s;++s)t[i]=a,i+=1;return t}function u(r){for(var t=1,n=r.length;n>t;++t)r[t]+=r[t-1];return r}function s(r,t,n){var e=r.length/2+t.length;n||(n=new Int32Array(e));for(var o=0,i=0,a=0,u=r.length;u>a;a+=2){var s=r[a],f=r[a+1];n[o]=s,0!==a&&(n[o]+=n[o-1]),o+=1;for(var c=0;f>c;++c)n[o]=n[o-1]+t[i],o+=1,i+=1}return n}function f(r,t,a,u){var f=r.length/4/2+t.length/2;u||(u=new Float32Array(f));var c=o(u),d=s(e(r),n(t),c);return i(d,a,u)}function c(r,t,n){var u=n?o(n):void 0,s=a(e(r),u);return i(s,t,n)}function d(n,o){function i(r){return s?-1===s.indexOf(r):!0}o=o||{};var s=o.ignoreFields,d=(n.numBonds||0,n.numAtoms||0),l=n.groupTypeList.length/4,v=n.chainIdList.length/4,L=n.chainsPerModel.length,g={numGroups:l,numChains:v,numModels:L};["mmtfVersion","mmtfProducer","unitCell","spaceGroup","structureId","title","depositionDate","releaseDate","experimentalMethods","resolution","rFree","rWork","bioAssemblyList","entityList","groupList","numBonds","numAtoms","groupsPerChain","chainsPerModel"].forEach(function(r){void 0!==n[r]&&(g[r]=n[r])});var y="bondAtomList";n[y]&&i(y)&&(g[y]=e(n[y]));var h="bondOrderList";n[h]&&i(h)&&(g[h]=r(n[h])),g.xCoordList=f(n.xCoordBig,n.xCoordSmall,1e3),g.yCoordList=f(n.yCoordBig,n.yCoordSmall,1e3),g.zCoordList=f(n.zCoordBig,n.zCoordSmall,1e3);var m="bFactorList",b="bFactorBig",p="bFactorSmall";n[b]&&n[p]&&i(m)&&(g[m]=f(n[b],n[p],100));var A="atomIdList";n[A]&&i(A)&&(g[A]=u(a(e(n[A]))));var C="altLocList";n[C]&&i(C)&&(g[C]=a(e(n[C]),new Uint8Array(d)));var I="occupancyList";n[I]&&i(I)&&(g[I]=c(n[I],100)),g.groupIdList=u(a(e(n.groupIdList))),g.groupTypeList=e(n.groupTypeList);var w="secStructList";n[w]&&i(w)&&(g[w]=t(n[w]));var F="insCodeList";n[F]&&i(F)&&(g[F]=a(e(n[F]),new Uint8Array(l)));var O="sequenceIndexList";n[O]&&i(O)&&(g[O]=u(a(e(n[O])))),g.chainIdList=r(n.chainIdList);var x="chainNameList";return n[x]&&i(x)&&(g[x]=r(n[x])),g}return d}();