@realsee/five 5.0.0-alpha.186 → 5.0.0-alpha.188
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/assets/search.js +1 -1
- package/docs/classes/five.AnimationFrameLoop.html +1 -1
- package/docs/classes/five.BVH.html +1 -1
- package/docs/classes/five.BVHIntersect.html +1 -1
- package/docs/classes/five.BVHNode.html +1 -1
- package/docs/classes/five.BVHVector3.html +1 -1
- package/docs/classes/five.Camera.html +1 -1
- package/docs/classes/five.Clipper.html +1 -1
- package/docs/classes/five.Five.html +1 -1
- package/docs/classes/five.InternalWebGLRenderer.html +1 -1
- package/docs/classes/five.IntersectMesh.html +1 -1
- package/docs/classes/five.Model.html +1 -1
- package/docs/classes/five.NetworkSubscribe.html +1 -1
- package/docs/classes/five.PBMContainer.html +1 -1
- package/docs/classes/five.PBMGroup.html +1 -1
- package/docs/classes/five.PBMMaterial.html +14 -14
- package/docs/classes/five.PBMMesh.html +1 -1
- package/docs/classes/five.PanoCircleMesh.html +1 -1
- package/docs/classes/five.PanoCircleMeshCustom.html +1 -1
- package/docs/classes/five.PanoCircleMeshSolid.html +1 -1
- package/docs/classes/five.Scene.html +1 -1
- package/docs/classes/five.Subscribe.html +1 -1
- package/docs/classes/five.TextureLoader.html +1 -1
- package/docs/classes/five.Tile3D.html +1 -1
- package/docs/classes/five.Tile3DModel.html +1 -1
- package/docs/classes/five.TileBoundingSphere.html +1 -1
- package/docs/classes/five.TileCacheNode.html +1 -1
- package/docs/classes/five.TileCubeTextureTarget.html +1 -1
- package/docs/classes/five.TileCullingVolume.html +1 -1
- package/docs/classes/five.TileOrientedBoundingBox.html +1 -1
- package/docs/classes/five.TileRequestScheduler.html +1 -1
- package/docs/classes/five.Tileset3D.html +1 -1
- package/docs/classes/five.Tileset3DTraverser.html +1 -1
- package/docs/classes/five.TilesetCache.html +1 -1
- package/docs/classes/five.Work.html +12 -12
- package/docs/classes/five.XRButton.html +1 -1
- package/docs/classes/gltf_loader.DDSLoader.html +1 -1
- package/docs/classes/gltf_loader.DRACOLoader.html +1 -1
- package/docs/classes/gltf_loader.GLTFLoader.html +1 -1
- package/docs/classes/gltf_loader.GLTFObject.html +1 -1
- package/docs/classes/gltf_loader.GLTFParser.html +1 -1
- package/docs/classes/gltf_loader.THREEGLTFLoader.html +1 -1
- package/docs/classes/line.Line.html +1 -1
- package/docs/classes/line.LineGeometry.html +1 -1
- package/docs/classes/line.LineMaterial.html +1 -1
- package/docs/classes/line.LineSegmentsGeometry.html +1 -1
- package/docs/classes/line.THREE_Line2.html +1 -1
- package/docs/classes/line.THREE_LineSegments2.html +1 -1
- package/docs/classes/react.Store.html +1 -1
- package/docs/classes/server.BVH.html +1 -1
- package/docs/classes/server.BVHIntersect.html +1 -1
- package/docs/classes/server.BVHNode.html +1 -1
- package/docs/classes/server.BVHVector3.html +1 -1
- package/docs/classes/server.Model.html +1 -1
- package/docs/classes/server.PBMContainer.html +1 -1
- package/docs/classes/server.PBMGroup.html +1 -1
- package/docs/classes/server.PBMMesh.html +1 -1
- package/docs/classes/sticker.Sticker.html +1 -1
- package/docs/classes/vfx.Airflow.html +1 -1
- package/docs/classes/vfx.Flame.html +1 -1
- package/docs/classes/vfx.Particle.html +1 -1
- package/docs/classes/vfx.SpotLight.html +1 -1
- package/docs/index.html +1 -1
- package/docs/interfaces/five.AddableObject.html +1 -1
- package/docs/interfaces/five.AnimationFrame.html +1 -1
- package/docs/interfaces/five.CameraPose.html +1 -1
- package/docs/interfaces/five.ClipperParameter.html +1 -1
- package/docs/interfaces/five.DepthPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.EventCallback.html +1 -1
- package/docs/interfaces/five.FiveInitArgs.html +1 -1
- package/docs/interfaces/five.FloorplanControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ImageOptions.html +1 -1
- package/docs/interfaces/five.ImageURLMappings.html +1 -1
- package/docs/interfaces/five.ImageURLOptions.html +1 -1
- package/docs/interfaces/five.IntersectMeshInterface.html +1 -1
- package/docs/interfaces/five.Intersection.html +1 -1
- package/docs/interfaces/five.MapviewControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ModelControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.ModelEventCallback.html +1 -1
- package/docs/interfaces/five.MotionKeyframe.html +1 -1
- package/docs/interfaces/five.MovePanoOptions.html +1 -1
- package/docs/interfaces/five.NetworkOptions.html +1 -1
- package/docs/interfaces/five.PBMPanoPicture.html +1 -1
- package/docs/interfaces/five.PBMParameters.html +1 -1
- package/docs/interfaces/five.PanoCircleMeshCustomOptions.html +1 -1
- package/docs/interfaces/five.PanoCircleMeshInterface.html +1 -1
- package/docs/interfaces/five.PanoCircleMeshOptions.html +1 -1
- package/docs/interfaces/five.PanoCircleMeshSolidOptions.html +1 -1
- package/docs/interfaces/five.PanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.PanoramaLikeControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.Pose.html +1 -1
- package/docs/interfaces/five.Scissor.html +1 -1
- package/docs/interfaces/five.State.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.emit.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.hasListener.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.off.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.on.html +1 -1
- package/docs/interfaces/five.SubscribeMixinType.once.html +1 -1
- package/docs/interfaces/five.TextureOptions.html +1 -1
- package/docs/interfaces/five.Tile3DModelLoaderOptions.html +1 -1
- package/docs/interfaces/five.TileBoundingVolume.html +1 -1
- package/docs/interfaces/five.TileContent.html +1 -1
- package/docs/interfaces/five.TileCubeNode.html +1 -1
- package/docs/interfaces/five.TileCubeTree.html +1 -1
- package/docs/interfaces/five.Tileset3dOptions.html +1 -1
- package/docs/interfaces/five.TilesetJSON.html +1 -1
- package/docs/interfaces/five.TilesetJSONNode.html +1 -1
- package/docs/interfaces/five.TopviewControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.VRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/five.WebXRSelectParams.html +1 -1
- package/docs/interfaces/five.WorkCubeImage.html +1 -1
- package/docs/interfaces/five.WorkImage.html +1 -1
- package/docs/interfaces/five.WorkInitial.html +1 -1
- package/docs/interfaces/five.WorkModel.html +6 -6
- package/docs/interfaces/five.WorkModelTiles.html +1 -1
- package/docs/interfaces/five.WorkObserver.html +5 -3
- package/docs/interfaces/five.WorkTile.html +1 -1
- package/docs/interfaces/five.WorkVideo.html +1 -1
- package/docs/interfaces/five.XRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/gltf_loader.DDS.html +1 -1
- package/docs/interfaces/gltf_loader.GLTF.html +1 -1
- package/docs/interfaces/gltf_loader.GLTFReference.html +1 -1
- package/docs/interfaces/gltf_loader.THREEGLTF.html +1 -1
- package/docs/interfaces/react.FiveActionReactCallbacks.html +1 -1
- package/docs/interfaces/react.FiveInjectionTypes.html +1 -1
- package/docs/interfaces/react.PropTypeOfFiveFeatures.html +1 -1
- package/docs/interfaces/server.Intersection.html +1 -1
- package/docs/interfaces/server.ModelEventCallback.html +1 -1
- package/docs/interfaces/sticker.IntersectionLike.html +1 -1
- package/docs/interfaces/vfx.ParticleArgs.html +1 -1
- package/docs/interfaces/vfx.ParticleTweenKeyframe.html +1 -1
- package/docs/interfaces/vue.FiveActionVueCallbacks.html +1 -1
- package/docs/modules/five.SubscribeMixinType.html +1 -1
- package/docs/modules/five.html +2 -2
- package/docs/modules/gltf_loader.html +1 -1
- package/docs/modules/line.html +1 -1
- package/docs/modules/react.html +1 -1
- package/docs/modules/server.html +1 -1
- package/docs/modules/sticker.html +1 -1
- package/docs/modules/vfx.html +1 -1
- package/docs/modules/vue.html +1 -1
- package/docs/modules.html +1 -1
- package/five/index.d.ts +2 -0
- package/five/index.js +5 -5
- package/gltf-loader/index.js +3 -3
- package/line/index.js +3 -3
- package/package.json +1 -1
- package/react/index.js +2 -2
- package/server/index.d.ts +2 -0
- package/server/index.js +4 -4
- package/sticker/index.js +3 -3
- package/umd/five-gltf-loader.js +1 -1
- package/umd/five-line.js +1 -1
- package/umd/five-sticker.js +1 -1
- package/umd/five.js +1 -1
- package/vfx/index.js +2 -2
- package/vue/index.js +2 -2
package/server/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @realsee/five
|
|
3
3
|
*
|
|
4
|
-
* Generated: 2023-03-
|
|
5
|
-
* Version: 5.0.0-alpha.
|
|
4
|
+
* Generated: 2023-03-10
|
|
5
|
+
* Version: 5.0.0-alpha.188
|
|
6
6
|
*
|
|
7
7
|
* Terms:
|
|
8
8
|
* Realsee SDK License Agreement
|
|
@@ -352,6 +352,6 @@
|
|
|
352
352
|
function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},d.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1};
|
|
353
353
|
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */
|
|
354
354
|
var E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function _(t){var e,r,n,i="",o=0;for(e=0;e<t.length&&"="!=t.charAt(e);++e)(n=E.indexOf(t.charAt(e)))<0||(0==o?(i+=b(n>>2),r=3&n,o=1):1==o?(i+=b(r<<2|n>>4),r=15&n,o=2):2==o?(i+=b(r),i+=b(n>>2),r=3&n,o=3):(i+=b(r<<2|n>>4),i+=b(15&n),o=0));return 1==o&&(i+=b(r<<2)),i}
|
|
355
|
-
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */function N(t,e){return new d(t,e)}function C(t,e,r){for(var n="",i=0;n.length<e;)n+=r(String.fromCharCode.apply(String,t.concat([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return n}function I(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function R(t,e,r){for(var n="",i=0;n.length<e;)n+=r(t+String.fromCharCode.apply(String,[(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i])),i+=1;return n}function D(t){return _(function(t){return t.length%4==2?t+="==":t.length%4==3&&(t+="="),(t=t.replace(/-/g,"+")).replace(/_/g,"/")}(t))}function z(t){return decodeURIComponent(function(t){return t.replace(/(..)/g,"%$1")}(t))}function T(t){for(var e="",r=0;r<t.length-1;r+=2)e+=String.fromCharCode(parseInt(t.substr(r,2),16));return e}function O(t){for(var e="",r=0;r<t.length;r++)e+=("0"+t.charCodeAt(r).toString(16)).slice(-2);return e}function
|
|
355
|
+
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */function N(t,e){return new d(t,e)}function C(t,e,r){for(var n="",i=0;n.length<e;)n+=r(String.fromCharCode.apply(String,t.concat([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return n}function I(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function R(t,e,r){for(var n="",i=0;n.length<e;)n+=r(t+String.fromCharCode.apply(String,[(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i])),i+=1;return n}function D(t){return _(function(t){return t.length%4==2?t+="==":t.length%4==3&&(t+="="),(t=t.replace(/-/g,"+")).replace(/_/g,"/")}(t))}function z(t){return decodeURIComponent(function(t){return t.replace(/(..)/g,"%$1")}(t))}function T(t){for(var e="",r=0;r<t.length-1;r+=2)e+=String.fromCharCode(parseInt(t.substr(r,2),16));return e}function O(t){for(var e="",r=0;r<t.length;r++)e+=("0"+t.charCodeAt(r).toString(16)).slice(-2);return e}function H(t){return function(t){var e,r,n="";for(e=0;e+3<=t.length;e+=3)r=parseInt(t.substring(e,e+3),16),n+=E.charAt(r>>6)+E.charAt(63&r);for(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=E.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=E.charAt(r>>2)+E.charAt((3&r)<<4));(3&n.length)>0;)n+="=";return n}(t)}function B(t,e){var r=function(t){var e=H(t).replace(/(.{64})/g,"$1\r\n");return e.replace(/\r\n$/,"")}(t);return"-----BEGIN "+e+"-----\r\n"+r+"\r\n-----END "+e+"-----\r\n"}function q(t,e){if(-1==t.indexOf("-----BEGIN "))throw"can't find PEM header: "+e;return function(t){return _(t.replace(/[^0-9A-Za-z\/+=]*/g,""))}(t=void 0!==e?(t=t.replace(new RegExp("^[^]*-----BEGIN "+e+"-----"),"")).replace(new RegExp("-----END "+e+"-----[^]*$"),""):(t=t.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function k(t){var e="malformed hex value";if(!t.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw e;if(8!=t.length)return 32==t.length?function(t){if(!t.match(/^[0-9A-Fa-f]{32}$/))throw"malformed IPv6 address octet";for(var e=(t=t.toLowerCase()).match(/.{1,4}/g),r=0;r<8;r++)e[r]=e[r].replace(/^0+/,""),""==e[r]&&(e[r]="0");var n=(t=":"+e.join(":")+":").match(/:(0:){2,}/g);if(null===n)return t.slice(1,-1);var i="";for(r=0;r<n.length;r++)n[r].length>i.length&&(i=n[r]);return(t=t.replace(i,"::")).slice(1,-1)}(t):t;try{return parseInt(t.substr(0,2),16)+"."+parseInt(t.substr(2,2),16)+"."+parseInt(t.substr(4,2),16)+"."+parseInt(t.substr(6,2),16)}catch(t){throw e}}function V(t){return!(t.length%2!=0||!t.match(/^[0-9a-f]+$/)&&!t.match(/^[0-9A-F]+$/))}function U(t){return t.length%2==1?"0"+t:t.substr(0,1)>"7"?"00"+t:t}I.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},I.prototype.setPublic=function(t,e){if(this.isPublic=!0,this.isPrivate=!1,"string"!=typeof t)this.n=t,this.e=e;else{if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA public key";this.n=N(t,16),this.e=parseInt(e,16)}},I.prototype.encrypt=function(t){var e=function(t,e){if(e<t.length+11)throw"Message too long for RSA";for(var r=new Array,n=t.length-1;n>=0&&e>0;){var i=t.charCodeAt(n--);i<128?r[--e]=i:i>127&&i<2048?(r[--e]=63&i|128,r[--e]=i>>6|192):(r[--e]=63&i|128,r[--e]=i>>6&63|128,r[--e]=i>>12|224)}r[--e]=0;for(var o=new SecureRandom,s=new Array;e>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);r[--e]=s[0]}return r[--e]=2,r[--e]=0,new d(r)}(t,this.n.bitLength()+7>>3);if(null==e)return null;var r=this.doPublic(e);if(null==r)return null;var n=r.toString(16);return 0==(1&n.length)?n:"0"+n},I.prototype.encryptOAEP=function(t,e,r){var n=function(t,e,r,n){var i=f.crypto.MessageDigest,o=f.crypto.Util,s=null;if(r||(r="sha1"),"string"==typeof r&&(s=i.getCanonicalAlgName(r),n=i.getHashLength(s),r=function(t){return T(o.hashHex(O(t),s))}),t.length+2*n+2>e)throw"Message too long for RSA";var a,u="";for(a=0;a<e-t.length-2*n-2;a+=1)u+="\0";var l=r("")+u+""+t,c=new Array(n);(new SecureRandom).nextBytes(c);var h=C(c,l.length,r),p=[];for(a=0;a<l.length;a+=1)p[a]=l.charCodeAt(a)^h.charCodeAt(a);var v=C(p,c.length,r),y=[0];for(a=0;a<c.length;a+=1)y[a+1]=c[a]^v.charCodeAt(a);return new d(y.concat(p))}(t,this.n.bitLength()+7>>3,e,r);if(null==n)return null;var i=this.doPublic(n);if(null==i)return null;var o=i.toString(16);return 0==(1&o.length)?o:"0"+o},I.prototype.type="RSA",I.prototype.doPrivate=function(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),r=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(r)<0;)e=e.add(this.p);return e.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)},I.prototype.setPrivate=function(t,e,r){if(this.isPrivate=!0,"string"!=typeof t)this.n=t,this.e=e,this.d=r;else{if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA private key";this.n=N(t,16),this.e=parseInt(e,16),this.d=N(r,16)}},I.prototype.setPrivateEx=function(t,e,r,n,i,o,s,a){if(this.isPrivate=!0,this.isPublic=!1,null==t)throw"RSASetPrivateEx N == null";if(null==e)throw"RSASetPrivateEx E == null";if(0==t.length)throw"RSASetPrivateEx N.length == 0";if(0==e.length)throw"RSASetPrivateEx E.length == 0";if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA private key in RSASetPrivateEx";this.n=N(t,16),this.e=parseInt(e,16),this.d=N(r,16),this.p=N(n,16),this.q=N(i,16),this.dmp1=N(o,16),this.dmq1=N(s,16),this.coeff=N(a,16)},I.prototype.decrypt=function(t){if(t.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var e=N(t,16),r=this.doPrivate(e);return null==r?null:
|
|
356
356
|
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ */
|
|
357
|
-
function(t,e){for(var r=t.toByteArray(),n=0;n<r.length&&0==r[n];)++n;if(r.length-n!=e-1||2!=r[n])return null;for(++n;0!=r[n];)if(++n>=r.length)return null;for(var i="";++n<r.length;){var o=255&r[n];o<128?i+=String.fromCharCode(o):o>191&&o<224?(i+=String.fromCharCode((31&o)<<6|63&r[n+1]),++n):(i+=String.fromCharCode((15&o)<<12|(63&r[n+1])<<6|63&r[n+2]),n+=2)}return i}(r,this.n.bitLength()+7>>3)},I.prototype.decryptOAEP=function(t,e,r){if(t.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var n=N(t,16),i=this.doPrivate(n);return null==i?null:function(t,e,r,n){var i=f.crypto.MessageDigest,o=f.crypto.Util,s=null;for(r||(r="sha1"),"string"==typeof r&&(s=i.getCanonicalAlgName(r),n=i.getHashLength(s),r=function(t){return T(o.hashHex(O(t),s))}),t=t.toByteArray(),a=0;a<t.length;a+=1)t[a]&=255;for(;t.length<e;)t.unshift(0);if((t=String.fromCharCode.apply(String,t)).length<2*n+2)throw"Cipher too short";var a,u=t.substr(1,n),l=t.substr(n+1),c=R(l,n,r),h=[];for(a=0;a<u.length;a+=1)h[a]=u.charCodeAt(a)^c.charCodeAt(a);var p=R(String.fromCharCode.apply(String,h),t.length-n,r),d=[];for(a=0;a<l.length;a+=1)d[a]=l.charCodeAt(a)^p.charCodeAt(a);if((d=String.fromCharCode.apply(String,d)).substr(0,n)!==r(""))throw"Hash mismatch";var v=(d=d.substr(n)).indexOf("");if((-1!=v?d.substr(0,v).lastIndexOf("\0"):-1)+1!=v)throw"Malformed data";return d.substr(v+1)}(i,this.n.bitLength()+7>>3,e,r)},void 0!==f.lang&&f.lang||(f.lang={}),f.lang.String=function(){},f.lang.String.isHex=function(t){return V(t)},f.lang.String.isMail=function(t){return null!==t.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};var M=function(t,e,r){return null==r&&(r="0"),t.length>=e?t:new Array(e-t.length+1).join(r)+t};void 0!==f.crypto&&f.crypto||(f.crypto={}),f.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:p.algo.MD5,sha1:p.algo.SHA1,sha224:p.algo.SHA224,sha256:p.algo.SHA256,sha384:p.algo.SHA384,sha512:p.algo.SHA512,ripemd160:p.algo.RIPEMD160},this.hashString=function(t,e){return new f.crypto.MessageDigest({alg:e}).digestString(t)},this.hashHex=function(t,e){return new f.crypto.MessageDigest({alg:e}).digestHex(t)},this.sha1=function(t){return this.hashString(t,"sha1")},this.sha256=function(t){return this.hashString(t,"sha256")},this.sha256Hex=function(t){return this.hashHex(t,"sha256")},this.sha512=function(t){return this.hashString(t,"sha512")},this.sha512Hex=function(t){return this.hashHex(t,"sha512")}},f.crypto.MessageDigest=function(t){this.setAlgAndProvider=function(t,e){if(null!==(t=f.crypto.MessageDigest.getCanonicalAlgName(t))&&void 0===e&&(e=f.crypto.Util.DEFAULTPROVIDER[t]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(t)&&"cryptojs"==e){try{this.md=f.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[t].create()}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=p.enc.Hex.parse(t);this.md.update(e)},this.digest=function(){return this.md.finalize().toString(p.enc.Hex)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}if(-1!=":sha256:".indexOf(t)&&"sjcl"==e){try{this.md=new sjcl.hash.sha256}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=sjcl.codec.hex.toBits(t);this.md.update(e)},this.digest=function(){var t=this.md.finalize();return sjcl.codec.hex.fromBits(t)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(t){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==t&&void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=f.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},f.crypto.MessageDigest.getCanonicalAlgName=function(t){return"string"==typeof t&&(t=(t=t.toLowerCase()).replace(/-/,"")),t},f.crypto.MessageDigest.getHashLength=function(t){var e=f.crypto.MessageDigest,r=e.getCanonicalAlgName(t);if(void 0===e.HASHLENGTH[r])throw"not supported algorithm: "+t;return e.HASHLENGTH[r]},f.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},f.crypto.Signature=function(t){var e=null;if(this._setAlgNames=function(){var t=this.algName.match(/^(.+)with(.+)$/);t&&(this.mdAlgName=t[1].toLowerCase(),this.pubkeyAlgName=t[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(t,e){for(var r="",n=e/4-t.length,i=0;i<n;i++)r+="0";return r+t},this.setAlgAndProvider=function(t,e){if(this._setAlgNames(),"cryptojs/jsrsa"!=e)throw new Error("provider not supported: "+e);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new f.crypto.MessageDigest({alg:this.mdAlgName})}catch(t){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+t)}this.init=function(t,e){var r=null;try{r=void 0===e?G.getKey(t):G.getKey(t,e)}catch(t){throw"init failed:"+t}if(!0===r.isPrivate)this.prvKey=r,this.state="SIGN";else{if(!0!==r.isPublic)throw"init failed.:"+r;this.pubKey=r,this.state="VERIFY"}},this.updateString=function(t){this.md.updateString(t)},this.updateHex=function(t){this.md.updateHex(t)},this.verify=function(t){if(this.sHashHex=this.md.digest(),this.pubKey instanceof I&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,t,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof I&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(t,e){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(t){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(t){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=t,void 0!==t&&(void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov?this.provName=f.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=t.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==t.psssaltlen&&(this.pssSaltLen=t.psssaltlen),void 0!==t.prvkeypem)){if(void 0!==t.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{e=G.getKey(t.prvkeypem);this.init(e)}catch(t){throw"fatal error to load pem private key: "+t}}},f.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040023":"secp521r1","2b81040022":"secp384r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}};var L,K,F,j,Y,Q,Z,W,G=(L=function(t,e,r){return K(p.AES,t,e,r)},K=function(t,e,r,n){var i=p.enc.Hex.parse(e),o=p.enc.Hex.parse(r),s=p.enc.Hex.parse(n),a={};a.key=o,a.iv=s,a.ciphertext=i;var u=t.decrypt(a,o,{iv:s});return p.enc.Hex.stringify(u)},F=function(t,e,r){return j(p.AES,t,e,r)},j=function(t,e,r,n){var i=p.enc.Hex.parse(e),o=p.enc.Hex.parse(r),s=p.enc.Hex.parse(n),a=t.encrypt(i,o,{iv:s}),u=p.enc.Hex.parse(a.toString());return p.enc.Base64.stringify(u)},Y={"AES-256-CBC":{proc:L,eproc:F,keylen:32,ivlen:16},"AES-192-CBC":{proc:L,eproc:F,keylen:24,ivlen:16},"AES-128-CBC":{proc:L,eproc:F,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(t,e,r){return K(p.TripleDES,t,e,r)},eproc:function(t,e,r){return j(p.TripleDES,t,e,r)},keylen:24,ivlen:8},"DES-CBC":{proc:function(t,e,r){return K(p.DES,t,e,r)},eproc:function(t,e,r){return j(p.DES,t,e,r)},keylen:8,ivlen:8}},Q=function(t){var e={},r=t.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));r&&(e.cipher=r[1],e.ivsalt=r[2]);var n=t.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));n&&(e.type=n[1]);var i=-1,o=0;-1!=t.indexOf("\r\n\r\n")&&(i=t.indexOf("\r\n\r\n"),o=2),-1!=t.indexOf("\n\n")&&(i=t.indexOf("\n\n"),o=1);var s=t.indexOf("-----END");if(-1!=i&&-1!=s){var a=t.substring(i+2*o,s-o);a=a.replace(/\s+/g,""),e.data=a}return e},Z=function(t,e,r){for(var n=r.substring(0,16),i=p.enc.Hex.parse(n),o=p.enc.Utf8.parse(e),s=Y[t].keylen+Y[t].ivlen,a="",u=null;;){var l=p.algo.MD5.create();if(null!=u&&l.update(u),l.update(o),l.update(i),u=l.finalize(),(a+=p.enc.Hex.stringify(u)).length>=2*s)break}var c={};return c.keyhex=a.substr(0,2*Y[t].keylen),c.ivhex=a.substr(2*Y[t].keylen,2*Y[t].ivlen),c},W=function(t,e,r,n){var i=p.enc.Base64.parse(t),o=p.enc.Hex.stringify(i);return(0,Y[e].proc)(o,r,n)},{version:"1.0.0",parsePKCS5PEM:function(t){return Q(t)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(t,e,r){return Z(t,e,r)},decryptKeyB64:function(t,e,r,n){return W(t,e,r,n)},getDecryptedKeyHex:function(t,e){var r=Q(t),n=r.cipher,i=r.ivsalt,o=r.data,s=Z(n,e,i).keyhex;return W(o,n,s,i)},getEncryptedPKCS5PEMFromPrvKeyHex:function(t,e,r,n,i){var o="";if(void 0!==n&&null!=n||(n="AES-256-CBC"),void 0===Y[n])throw"KEYUTIL unsupported algorithm: "+n;if(void 0===i||null==i){var s=function(t){var e=p.lib.WordArray.random(t);return p.enc.Hex.stringify(e)}(Y[n].ivlen);i=s.toUpperCase()}var a=function(t,e,r,n){return(0,Y[e].eproc)(t,r,n)}(e,n,Z(n,r,i).keyhex,i);return o="-----BEGIN "+t+" PRIVATE KEY-----\r\n",o+="Proc-Type: 4,ENCRYPTED\r\n",o+="DEK-Info: "+n+","+i+"\r\n",o+="\r\n",o+=a.replace(/(.{64})/g,"$1\r\n"),o+="\r\n-----END "+t+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(t){var e=X,r=e.getChildIdx,n=e.getV,i={},o=r(t,0);if(2!=o.length)throw"malformed format: SEQUENCE(0).items != 2: "+o.length;i.ciphertext=n(t,o[1]);var s=r(t,o[0]);if(2!=s.length)throw"malformed format: SEQUENCE(0.0).items != 2: "+s.length;if("2a864886f70d01050d"!=n(t,s[0]))throw"this only supports pkcs5PBES2";var a=r(t,s[1]);if(2!=s.length)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+a.length;var u=r(t,a[1]);if(2!=u.length)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+u.length;if("2a864886f70d0307"!=n(t,u[0]))throw"this only supports TripleDES";i.encryptionSchemeAlg="TripleDES",i.encryptionSchemeIV=n(t,u[1]);var l=r(t,a[0]);if(2!=l.length)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+l.length;if("2a864886f70d01050c"!=n(t,l[0]))throw"this only supports pkcs5PBKDF2";var c=r(t,l[1]);if(c.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+c.length;i.pbkdf2Salt=n(t,c[0]);var h=n(t,c[1]);try{i.pbkdf2Iter=parseInt(h,16)}catch(t){throw"malformed format pbkdf2Iter: "+h}return i},getPBKDF2KeyHexFromParam:function(t,e){var r=p.enc.Hex.parse(t.pbkdf2Salt),n=t.pbkdf2Iter,i=p.PBKDF2(e,r,{keySize:6,iterations:n});return p.enc.Hex.stringify(i)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(t,e){var r=H(t,"ENCRYPTED PRIVATE KEY"),n=this.parseHexOfEncryptedPKCS8(r),i=G.getPBKDF2KeyHexFromParam(n,e),o={};o.ciphertext=p.enc.Hex.parse(n.ciphertext);var s=p.enc.Hex.parse(i),a=p.enc.Hex.parse(n.encryptionSchemeIV),u=p.TripleDES.decrypt(o,s,{iv:a});return p.enc.Hex.stringify(u)},getKeyFromEncryptedPKCS8PEM:function(t,e){var r=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(t,e);return this.getKeyFromPlainPrivatePKCS8Hex(r)},parsePlainPrivatePKCS8Hex:function(t){var e=X,r=e.getChildIdx,n=e.getV,i={algparam:null};if("30"!=t.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var o=r(t,0);if(o.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=t.substr(o[1],2))throw new Error("malformed PKCS8 private key(code:003)");var s=r(t,o[1]);if(2!=s.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=t.substr(s[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(i.algoid=n(t,s[0]),"06"==t.substr(s[1],2)&&(i.algparam=n(t,s[1])),"04"!=t.substr(o[2],2))throw new Error("malformed PKCS8 private key(code:006)");return i.keyidx=e.getVidx(t,o[2]),i},getKeyFromPlainPrivatePKCS8PEM:function(t){var e=H(t,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(e)},getKeyFromPlainPrivatePKCS8Hex:function(t){var e,r=this.parsePlainPrivatePKCS8Hex(t);if("2a864886f70d010101"==r.algoid)e=new I;else if(f.crypto.DSA&&"2a8648ce380401"==r.algoid)e=new f.crypto.DSA;else{if(!f.crypto.ECDSA||"2a8648ce3d0201"!=r.algoid)throw"unsupported private key algorithm";e=new f.crypto.ECDSA}return e.readPKCS8PrvKeyHex(t),e},_getKeyFromPublicPKCS8Hex:function(t){var e,r=X.getVbyList(t,0,[0,0],"06");if("2a864886f70d010101"===r)e=new I;else if(f.crypto.DSA&&"2a8648ce380401"===r)e=new f.crypto.DSA;else{if(!f.crypto.ECDSA||"2a8648ce3d0201"!==r)throw"unsupported PKCS#8 public key hex";e=new f.crypto.ECDSA}return e.readPKCS8PubKeyHex(t),e},parsePublicRawRSAKeyHex:function(t){var e=X,r=e.getChildIdx,n=e.getV,i={};if("30"!=t.substr(0,2))throw"malformed RSA key(code:001)";var o=r(t,0);if(2!=o.length)throw"malformed RSA key(code:002)";if("02"!=t.substr(o[0],2))throw"malformed RSA key(code:003)";if(i.n=n(t,o[0]),"02"!=t.substr(o[1],2))throw"malformed RSA key(code:004)";return i.e=n(t,o[1]),i},parsePublicPKCS8Hex:function(t){var e=X,r=e.getChildIdx,n=e.getV,i={algparam:null},o=r(t,0);if(2!=o.length)throw"outer DERSequence shall have 2 elements: "+o.length;var s=o[0];if("30"!=t.substr(s,2))throw"malformed PKCS8 public key(code:001)";var a=r(t,s);if(2!=a.length)throw"malformed PKCS8 public key(code:002)";if("06"!=t.substr(a[0],2))throw"malformed PKCS8 public key(code:003)";if(i.algoid=n(t,a[0]),"06"==t.substr(a[1],2)?i.algparam=n(t,a[1]):"30"==t.substr(a[1],2)&&(i.algparam={},i.algparam.p=e.getVbyList(t,a[1],[0],"02"),i.algparam.q=e.getVbyList(t,a[1],[1],"02"),i.algparam.g=e.getVbyList(t,a[1],[2],"02")),"03"!=t.substr(o[1],2))throw"malformed PKCS8 public key(code:004)";return i.key=n(t,o[1]).substr(2),i}});G.getKey=function(t,e,r){var n=(m=X).getChildIdx;m.getV;var i=m.getVbyList,o=f.crypto,s=o.ECDSA,a=o.DSA,u=I,l=H,c=G;if(void 0!==u&&t instanceof u)return t;if(void 0!==s&&t instanceof s)return t;if(void 0!==a&&t instanceof a)return t;if(void 0!==t.curve&&void 0!==t.xy&&void 0===t.d)return new s({pub:t.xy,curve:t.curve});if(void 0!==t.curve&&void 0!==t.d)return new s({prv:t.d,curve:t.curve});if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(R=new u).setPublic(t.n,t.e),R;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.co&&void 0===t.qi)return(R=new u).setPrivateEx(t.n,t.e,t.d,t.p,t.q,t.dp,t.dq,t.co),R;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0===t.p)return(R=new u).setPrivate(t.n,t.e,t.d),R;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0===t.x)return(R=new a).setPublic(t.p,t.q,t.g,t.y),R;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0!==t.x)return(R=new a).setPrivate(t.p,t.q,t.g,t.y,t.x),R;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(R=new u).setPublic(D(t.n),D(t.e)),R;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.qi)return(R=new u).setPrivateEx(D(t.n),D(t.e),D(t.d),D(t.p),D(t.q),D(t.dp),D(t.dq),D(t.qi)),R;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d)return(R=new u).setPrivate(D(t.n),D(t.e),D(t.d)),R;if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0===t.d){var h=(C=new s({curve:t.crv})).ecparams.keylen/4,p="04"+("0000000000"+D(t.x)).slice(-h)+("0000000000"+D(t.y)).slice(-h);return C.setPublicKeyHex(p),C}if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0!==t.d){h=(C=new s({curve:t.crv})).ecparams.keylen/4,p="04"+("0000000000"+D(t.x)).slice(-h)+("0000000000"+D(t.y)).slice(-h);var v=("0000000000"+D(t.d)).slice(-h);return C.setPublicKeyHex(p),C.setPrivateKeyHex(v),C}if("pkcs5prv"===r){var y,g=t,m=X;if(9===(y=n(g,0)).length)(R=new u).readPKCS5PrvKeyHex(g);else if(6===y.length)(R=new a).readPKCS5PrvKeyHex(g);else{if(!(y.length>2&&"04"===g.substr(y[1],2)))throw"unsupported PKCS#1/5 hexadecimal key";(R=new s).readPKCS5PrvKeyHex(g)}return R}if("pkcs8prv"===r)return R=c.getKeyFromPlainPrivatePKCS8Hex(t);if("pkcs8pub"===r)return c._getKeyFromPublicPKCS8Hex(t);if("x509pub"===r)return $.getPublicKeyFromCertHex(t);if(-1!=t.indexOf("-END CERTIFICATE-",0)||-1!=t.indexOf("-END X509 CERTIFICATE-",0)||-1!=t.indexOf("-END TRUSTED CERTIFICATE-",0))return $.getPublicKeyFromCertPEM(t);if(-1!=t.indexOf("-END PUBLIC KEY-")){var b=H(t,"PUBLIC KEY");return c._getKeyFromPublicPKCS8Hex(b)}if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var x=l(t,"RSA PRIVATE KEY");return c.getKey(x,null,"pkcs5prv")}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var w=i(O=l(t,"DSA PRIVATE KEY"),0,[1],"02"),S=i(O,0,[2],"02"),A=i(O,0,[3],"02"),P=i(O,0,[4],"02"),E=i(O,0,[5],"02");return(R=new a).setPrivate(new d(w,16),new d(S,16),new d(A,16),new d(P,16),new d(E,16)),R}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){x=l(t,"EC PRIVATE KEY");return c.getKey(x,null,"pkcs5prv")}if(-1!=t.indexOf("-END PRIVATE KEY-"))return c.getKeyFromPlainPrivatePKCS8PEM(t);if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var _=c.getDecryptedKeyHex(t,e),N=new I;return N.readPKCS5PrvKeyHex(_),N}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var C,R=i(O=c.getDecryptedKeyHex(t,e),0,[1],"04"),z=i(O,0,[2,0],"06"),T=i(O,0,[3,0],"03").substr(2);if(void 0===f.crypto.OID.oidhex2name[z])throw"undefined OID(hex) in KJUR.crypto.OID: "+z;return(C=new s({curve:f.crypto.OID.oidhex2name[z]})).setPublicKeyHex(T),C.setPrivateKeyHex(R),C.isPublic=!1,C}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var O;w=i(O=c.getDecryptedKeyHex(t,e),0,[1],"02"),S=i(O,0,[2],"02"),A=i(O,0,[3],"02"),P=i(O,0,[4],"02"),E=i(O,0,[5],"02");return(R=new a).setPrivate(new d(w,16),new d(S,16),new d(A,16),new d(P,16),new d(E,16)),R}if(-1!=t.indexOf("-END ENCRYPTED PRIVATE KEY-"))return c.getKeyFromEncryptedPKCS8PEM(t,e);throw new Error("not supported argument")},void 0!==f.asn1&&f.asn1||(f.asn1={}),f.asn1.ASN1Util={},f.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",r=parseInt(t.substr(0,2),16),n=(e=Math.floor(r/40)+"."+r%40,""),i=2;i<t.length;i+=2){var o=("00000000"+parseInt(t.substr(i,2),16).toString(2)).slice(-8);if(n+=o.substr(1,7),"0"==o.substr(0,1))e=e+"."+new d(n,2).toString(10),n=""}return e};var X=new function(){};function J(t){for(var e in f.crypto.Util.DIGESTINFOHEAD){var r=f.crypto.Util.DIGESTINFOHEAD[e],n=r.length;if(t.substring(0,n)==r)return[e,t.substring(n)]}return[]}function $(t){var e,r=X,n=r.getChildIdx,i=r.getV,o=r.getTLV,s=r.getVbyList,a=r.getVbyListEx,u=r.getTLVbyList,l=r.getTLVbyListEx,c=r.getIdxbyList,h=r.getIdxbyListEx,p=r.getVidx,d=r.getInt,v=r.oidname,y=r.hextooidstr,g=H;try{e=f.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(t){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var t=u(this.hex,0,[0,0]);if("a0"==t.substr(0,2)){var e=u(t,0,[0]),r=d(e,0);if(r<0||2<r)throw new Error("malformed version field");return this.version=r+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return a(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var t=l(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(t)},this.getAlgorithmIdentifierName=function(t){for(var r in e)if(t===e[r])return r;return v(a(t,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return u(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return u(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var t=s(this.hex,0,[0,4+this.foffset,0]);return t=t.replace(/(..)/g,"%$1"),t=decodeURIComponent(t)},this.getNotAfter=function(){var t=s(this.hex,0,[0,4+this.foffset,1]);return t=t.replace(/(..)/g,"%$1"),t=decodeURIComponent(t)},this.getPublicKeyHex=function(){return r.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return c(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var t=this.getPublicKeyIdx();return c(this.hex,t,[1,0],"30")},this.getPublicKey=function(){return G.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var t=u(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(t)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(t){var e=this.getSignatureAlgorithmField(),r=this.getSignatureValueHex(),n=u(this.hex,0,[0],"30"),i=new f.crypto.Signature({alg:e});return i.init(t),i.updateHex(n),i.verify(r)},this.parseExt=function(t){var e,o,a;if(void 0===t){if(a=this.hex,3!==this.version)return-1;e=c(a,0,[0,7,0],"30"),o=n(a,e)}else{a=H(t);var u=c(a,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=i(a,u))return void(this.aExtInfo=new Array);e=c(a,0,[0,3,0,1,0],"30"),o=n(a,e),this.hex=a}this.aExtInfo=new Array;for(var l=0;l<o.length;l++){var h={critical:!1},f=0;3===n(a,o[l]).length&&(h.critical=!0,f=1),h.oid=r.hextooidstr(s(a,o[l],[0],"06"));var d=c(a,o[l],[1+f]);h.vidx=p(a,d),this.aExtInfo.push(h)}},this.getExtInfo=function(t){var e=this.aExtInfo,r=t;if(t.match(/^[0-9.]+$/)||(r=f.asn1.x509.OID.name2oid(t)),""!==r)for(var n=0;n<e.length;n++)if(e[n].oid===r)return e[n]},this.getExtBasicConstraints=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("basicConstraints");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:"basicConstraints"};if(e&&(n.critical=!0),"3000"===t)return n;if("30030101ff"===t)return n.cA=!0,n;if("30060101ff02"===t.substr(0,12)){var s=i(t,10),a=parseInt(s,16);return n.cA=!0,n.pathLen=a,n}throw new Error("hExtV parse error: "+t)},this.getExtKeyUsage=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("keyUsage");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:"keyUsage"};return e&&(n.critical=!0),n.names=this.getExtKeyUsageString(t).split(","),n},this.getExtKeyUsageBin=function(t){if(void 0===t){var e=this.getExtInfo("keyUsage");if(void 0===e)return"";t=o(this.hex,e.vidx)}if(8!=t.length&&10!=t.length)throw new Error("malformed key usage value: "+t);var r="000000000000000"+parseInt(t.substr(6),16).toString(2);return 8==t.length&&(r=r.slice(-8)),10==t.length&&(r=r.slice(-16)),""==(r=r.replace(/0+$/,""))&&(r="0"),r},this.getExtKeyUsageString=function(t){for(var e=this.getExtKeyUsageBin(t),r=new Array,n=0;n<e.length;n++)"1"==e.substr(n,1)&&r.push($.KEYUSAGE_NAME[n]);return r.join(",")},this.getExtSubjectKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("subjectKeyIdentifier");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:"subjectKeyIdentifier"};e&&(n.critical=!0);var s=i(t,0);return n.kid={hex:s},n},this.getExtAuthorityKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("authorityKeyIdentifier");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var s={extname:"authorityKeyIdentifier"};e&&(s.critical=!0);for(var a=n(t,0),u=0;u<a.length;u++){var l=t.substr(a[u],2);if("80"===l&&(s.kid={hex:i(t,a[u])}),"a1"===l){var c=o(t,a[u]),h=this.getGeneralNames(c);s.issuer=h[0].dn}"82"===l&&(s.sn={hex:i(t,a[u])})}return s},this.getExtExtKeyUsage=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("extKeyUsage");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var s={extname:"extKeyUsage",array:[]};e&&(s.critical=!0);for(var a=n(t,0),u=0;u<a.length;u++)s.array.push(v(i(t,a[u])));return s},this.getExtExtKeyUsageName=function(){var t=this.getExtInfo("extKeyUsage");if(void 0===t)return t;var e=new Array,r=o(this.hex,t.vidx);if(""===r)return e;for(var s=n(r,0),a=0;a<s.length;a++)e.push(v(i(r,s[a])));return e},this.getExtSubjectAltName=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("subjectAltName");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:"subjectAltName",array:[]};return e&&(n.critical=!0),n.array=this.getGeneralNames(t),n},this.getExtIssuerAltName=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("issuerAltName");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:"issuerAltName",array:[]};return e&&(n.critical=!0),n.array=this.getGeneralNames(t),n},this.getGeneralNames=function(t){for(var e=n(t,0),r=[],i=0;i<e.length;i++){var s=this.getGeneralName(o(t,e[i]));void 0!==s&&r.push(s)}return r},this.getGeneralName=function(t){var e=t.substr(0,2),r=i(t,0),n=T(r);return"81"==e?{rfc822:n}:"82"==e?{dns:n}:"86"==e?{uri:n}:"87"==e?{ip:q(r)}:"a4"==e?{dn:this.getX500Name(r)}:void 0},this.getExtSubjectAltName2=function(){var t,e,r,s=this.getExtInfo("subjectAltName");if(void 0===s)return s;for(var a=new Array,u=o(this.hex,s.vidx),l=n(u,0),c=0;c<l.length;c++)r=u.substr(l[c],2),t=i(u,l[c]),"81"===r&&(e=z(t),a.push(["MAIL",e])),"82"===r&&(e=z(t),a.push(["DNS",e])),"84"===r&&(e=$.hex2dn(t,0),a.push(["DN",e])),"86"===r&&(e=z(t),a.push(["URI",e])),"87"===r&&(e=q(t),a.push(["IP",e]));return a},this.getExtCRLDistributionPoints=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("cRLDistributionPoints");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var i={extname:"cRLDistributionPoints",array:[]};e&&(i.critical=!0);for(var s=n(t,0),a=0;a<s.length;a++){var u=o(t,s[a]);i.array.push(this.getDistributionPoint(u))}return i},this.getDistributionPoint=function(t){for(var e={},r=n(t,0),i=0;i<r.length;i++){var s=t.substr(r[i],2),a=o(t,r[i]);"a0"==s&&(e.dpname=this.getDistributionPointName(a))}return e},this.getDistributionPointName=function(t){for(var e={},r=n(t,0),i=0;i<r.length;i++){var s=t.substr(r[i],2),a=o(t,r[i]);"a0"==s&&(e.full=this.getGeneralNames(a))}return e},this.getExtCRLDistributionPointsURI=function(){var t=this.getExtInfo("cRLDistributionPoints");if(void 0===t)return t;for(var e=new Array,r=n(this.hex,t.vidx),i=0;i<r.length;i++)try{var o=z(s(this.hex,r[i],[0,0,0],"86"));e.push(o)}catch(t){}return e},this.getExtAIAInfo=function(){var t=this.getExtInfo("authorityInfoAccess");if(void 0===t)return t;for(var e={ocsp:[],caissuer:[]},r=n(this.hex,t.vidx),i=0;i<r.length;i++){var o=s(this.hex,r[i],[0],"06"),a=s(this.hex,r[i],[1],"86");"2b06010505073001"===o&&e.ocsp.push(z(a)),"2b06010505073002"===o&&e.caissuer.push(z(a))}return e},this.getExtAuthorityInfoAccess=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("authorityInfoAccess");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var i={extname:"authorityInfoAccess",array:[]};e&&(i.critical=!0);for(var u=n(t,0),l=0;l<u.length;l++){var c=a(t,u[l],[0],"06"),h=z(s(t,u[l],[1],"86"));if("2b06010505073001"==c)i.array.push({ocsp:h});else{if("2b06010505073002"!=c)throw new Error("unknown method: "+c);i.array.push({caissuer:h})}}return i},this.getExtCertificatePolicies=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("certificatePolicies");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var i={extname:"certificatePolicies",array:[]};e&&(i.critical=!0);for(var s=n(t,0),a=0;a<s.length;a++){var u=o(t,s[a]),l=this.getPolicyInformation(u);i.array.push(l)}return i},this.getPolicyInformation=function(t){var e={},r=s(t,0,[0],"06");e.policyoid=v(r);var i=h(t,0,[1],"30");if(-1!=i){e.array=[];for(var a=n(t,i),u=0;u<a.length;u++){var l=o(t,a[u]),c=this.getPolicyQualifierInfo(l);e.array.push(c)}}return e},this.getPolicyQualifierInfo=function(t){var e={},r=s(t,0,[0],"06");if("2b06010505070201"===r){var n=a(t,0,[1],"16");e.cps=T(n)}else if("2b06010505070202"===r){var i=u(t,0,[1],"30");e.unotice=this.getUserNotice(i)}return e},this.getUserNotice=function(t){for(var e={},r=n(t,0),i=0;i<r.length;i++){var s=o(t,r[i]);"30"!=s.substr(0,2)&&(e.exptext=this.getDisplayText(s))}return e},this.getDisplayText=function(t){var e={};return e.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[t.substr(0,2)],e.str=T(i(t,0)),e},this.getExtCRLNumber=function(t,e){var r={extname:"cRLNumber"};if(e&&(r.critical=!0),"02"==t.substr(0,2))return r.num={hex:i(t,0)},r;throw new Error("hExtV parse error: "+t)},this.getExtCRLReason=function(t,e){var r={extname:"cRLReason"};if(e&&(r.critical=!0),"0a"==t.substr(0,2))return r.code=parseInt(i(t,0),16),r;throw new Error("hExtV parse error: "+t)},this.getExtOcspNonce=function(t,e){var r={extname:"ocspNonce"};e&&(r.critical=!0);var n=i(t,0);return r.hex=n,r},this.getExtOcspNoCheck=function(t,e){var r={extname:"ocspNoCheck"};return e&&(r.critical=!0),r},this.getExtAdobeTimeStamp=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("adobeTimeStamp");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var i={extname:"adobeTimeStamp"};e&&(i.critical=!0);var s=n(t,0);if(s.length>1){var a=o(t,s[1]),u=this.getGeneralName(a);null!=u.uri&&(i.uri=u.uri)}if(s.length>2){var l=o(t,s[2]);"0101ff"==l&&(i.reqauth=!0),"010100"==l&&(i.reqauth=!1)}return i},this.getX500NameRule=function(t){for(var e=null,r=[],n=0;n<t.length;n++)for(var i=t[n],o=0;o<i.length;o++)r.push(i[o]);for(n=0;n<r.length;n++){var s=r[n],a=s.ds,u=s.value,l=s.type;if("prn"!=a&&"utf8"!=a&&"ia5"!=a)return"mixed";if("ia5"==a){if("CN"!=l)return"mixed";if(f.lang.String.isMail(u))continue;return"mixed"}if("C"==l){if("prn"==a)continue;return"mixed"}if(null==e)e=a;else if(e!==a)return"mixed"}return null==e?"prn":e},this.getX500Name=function(t){var e=this.getX500NameArray(t);return{array:e,str:this.dnarraytostr(e)}},this.getX500NameArray=function(t){for(var e=[],r=n(t,0),i=0;i<r.length;i++)e.push(this.getRDN(o(t,r[i])));return e},this.getRDN=function(t){for(var e=[],r=n(t,0),i=0;i<r.length;i++)e.push(this.getAttrTypeAndValue(o(t,r[i])));return e},this.getAttrTypeAndValue=function(t){var e={type:null,value:null,ds:null},r=n(t,0),i=s(t,r[0],[],"06"),o=s(t,r[1],[]),a=f.asn1.ASN1Util.oidHexToInt(i);return e.type=f.asn1.x509.OID.oid2atype(a),e.ds=this.HEX2STAG[t.substr(r[1],2)],"bmp"!=e.ds?e.value=z(o):e.value=function(t){return t.match(/.{4}/g).map((function(t){var e=parseInt(t.substr(0,2),16),r=parseInt(t.substr(2),16);if(0==e&r<128)return String.fromCharCode(r);if(e<8){var n=128|63&r;return z((192|(7&e)<<3|(192&r)>>6).toString(16)+n.toString(16))}n=128|(15&e)<<2|(192&r)>>6;var i=128|63&r;return z((224|(240&e)>>4).toString(16)+n.toString(16)+i.toString(16))})).join("")}(o),e},this.readCertPEM=function(t){this.readCertHex(g(t))},this.readCertHex=function(t){this.hex=t,this.getVersion();try{c(this.hex,0,[0,7],"a3"),this.parseExt()}catch(t){}},this.getParam=function(){var t={};return t.version=this.getVersion(),t.serial={hex:this.getSerialNumberHex()},t.sigalg=this.getSignatureAlgorithmField(),t.issuer=this.getIssuer(),t.notbefore=this.getNotBefore(),t.notafter=this.getNotAfter(),t.subject=this.getSubject(),t.sbjpubkey=k(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(t.ext=this.getExtParamArray()),t.sighex=this.getSignatureValueHex(),t},this.getExtParamArray=function(t){null==t&&(-1!=h(this.hex,0,[0,"[3]"])&&(t=l(this.hex,0,[0,"[3]",0],"30")));for(var e=[],r=n(t,0),i=0;i<r.length;i++){var s=o(t,r[i]),a=this.getExtParam(s);null!=a&&e.push(a)}return e},this.getExtParam=function(t){var e=n(t,0).length;if(2!=e&&3!=e)throw new Error("wrong number elements in Extension: "+e+" "+t);var r=y(s(t,0,[0],"06")),i=!1;3==e&&"0101ff"==u(t,0,[1])&&(i=!0);var o=u(t,0,[e-1,0]),a=void 0;if("2.5.29.14"==r?a=this.getExtSubjectKeyIdentifier(o,i):"2.5.29.15"==r?a=this.getExtKeyUsage(o,i):"2.5.29.17"==r?a=this.getExtSubjectAltName(o,i):"2.5.29.18"==r?a=this.getExtIssuerAltName(o,i):"2.5.29.19"==r?a=this.getExtBasicConstraints(o,i):"2.5.29.31"==r?a=this.getExtCRLDistributionPoints(o,i):"2.5.29.32"==r?a=this.getExtCertificatePolicies(o,i):"2.5.29.35"==r?a=this.getExtAuthorityKeyIdentifier(o,i):"2.5.29.37"==r?a=this.getExtExtKeyUsage(o,i):"1.3.6.1.5.5.7.1.1"==r?a=this.getExtAuthorityInfoAccess(o,i):"2.5.29.20"==r?a=this.getExtCRLNumber(o,i):"2.5.29.21"==r?a=this.getExtCRLReason(o,i):"1.3.6.1.5.5.7.48.1.2"==r?a=this.getExtOcspNonce(o,i):"1.3.6.1.5.5.7.48.1.5"==r?a=this.getExtOcspNoCheck(o,i):"1.2.840.113583.1.1.9.1"==r&&(a=this.getExtAdobeTimeStamp(o,i)),null!=a)return a;var l={extname:r,extn:o};return i&&(l.critical=!0),l},this.findExt=function(t,e){for(var r=0;r<t.length;r++)if(t[r].extname==e)return t[r];return null},this.dnarraytostr=function(t){return"/"+t.map((function(t){return function(t){return t.map((function(t){return function(t){return t.type+"="+t.value}(t).replace(/\+/,"\\+")})).join("+")}(t).replace(/\//,"\\/")})).join("/")},this.getInfo=function(){var t,e,r,n,i=function(t){for(var e="",r=t.array,n=0;n<r.length;n++){var i=r[n];if(e+=" policy oid: "+i.policyoid+"\n",void 0!==i.array)for(var o=0;o<i.array.length;o++){var s=i.array[o];void 0!==s.cps&&(e+=" cps: "+s.cps+"\n")}}return e},o=function(t){for(var e="",r=t.array,n=0;n<r.length;n++){var i=r[n];try{void 0!==i.dpname.full[0].uri&&(e+=" "+i.dpname.full[0].uri+"\n")}catch(t){}try{void 0!==i.dname.full[0].dn.hex&&(e+=" "+$.hex2dn(i.dpname.full[0].dn.hex)+"\n")}catch(t){}}return e},s=function(t){for(var e="",r=t.array,n=0;n<r.length;n++){var i=r[n];void 0!==i.caissuer&&(e+=" caissuer: "+i.caissuer+"\n"),void 0!==i.ocsp&&(e+=" ocsp: "+i.ocsp+"\n")}return e};if(t="Basic Fields\n",t+=" serial number: "+this.getSerialNumberHex()+"\n",t+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",t+=" issuer: "+this.getIssuerString()+"\n",t+=" notBefore: "+this.getNotBefore()+"\n",t+=" notAfter: "+this.getNotAfter()+"\n",t+=" subject: "+this.getSubjectString()+"\n",t+=" subject public key info: \n",t+=" key algorithm: "+(e=this.getPublicKey()).type+"\n","RSA"===e.type&&(t+=" n="+U(e.n.toString(16)).substr(0,16)+"...\n",t+=" e="+U(e.e.toString(16))+"\n"),null!=(r=this.aExtInfo)){t+="X509v3 Extensions:\n";for(var a=0;a<r.length;a++){var u=r[a],l=f.asn1.x509.OID.oid2name(u.oid);""===l&&(l=u.oid);var c="";if(!0===u.critical&&(c="CRITICAL"),t+=" "+l+" "+c+":\n","basicConstraints"===l){var h=this.getExtBasicConstraints();void 0===h.cA?t+=" {}\n":(t+=" cA=true",void 0!==h.pathLen&&(t+=", pathLen="+h.pathLen),t+="\n")}else if("keyUsage"===l)t+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"===l)t+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"===l){var p=this.getExtAuthorityKeyIdentifier();void 0!==p.kid&&(t+=" kid="+p.kid.hex+"\n")}else{if("extKeyUsage"===l)t+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n";else if("subjectAltName"===l)t+=" "+(n=this.getExtSubjectAltName(),JSON.stringify(n.array).replace(/[\[\]\{\}\"]/g,""))+"\n";else if("cRLDistributionPoints"===l)t+=o(this.getExtCRLDistributionPoints());else if("authorityInfoAccess"===l)t+=s(this.getExtAuthorityInfoAccess());else"certificatePolicies"===l&&(t+=i(this.getExtCertificatePolicies()))}}}return t+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n",t+="signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?this.readCertPEM(t):f.lang.String.isHex(t)&&this.readCertHex(t))}function tt(t){return p.SHA256(t).toString()}X.getLblen=function(t,e){if("8"!=t.substr(e+2,1))return 1;var r=parseInt(t.substr(e+3,1));return 0==r?-1:0<r&&r<10?r+1:-2},X.getL=function(t,e){var r=X.getLblen(t,e);return r<1?"":t.substr(e+2,2*r)},X.getVblen=function(t,e){var r;return""==(r=X.getL(t,e))?-1:("8"===r.substr(0,1)?new d(r.substr(2),16):new d(r,16)).intValue()},X.getVidx=function(t,e){var r=X.getLblen(t,e);return r<0?r:e+2*(r+1)},X.getV=function(t,e){var r=X.getVidx(t,e),n=X.getVblen(t,e);return t.substr(r,2*n)},X.getTLV=function(t,e){return t.substr(e,2)+X.getL(t,e)+X.getV(t,e)},X.getTLVblen=function(t,e){return 2+2*X.getLblen(t,e)+2*X.getVblen(t,e)},X.getNextSiblingIdx=function(t,e){return X.getVidx(t,e)+2*X.getVblen(t,e)},X.getChildIdx=function(t,e){var r,n,i,o=X,s=[];r=o.getVidx(t,e),n=2*o.getVblen(t,e),"03"==t.substr(e,2)&&(r+=2,n-=2),i=0;for(var a=r;i<=n;){var u=o.getTLVblen(t,a);if((i+=u)<=n&&s.push(a),a+=u,i>=n)break}return s},X.getNthChildIdx=function(t,e,r){return X.getChildIdx(t,e)[r]},X.getIdxbyList=function(t,e,r,n){var i,o,s=X;return 0==r.length?void 0!==n&&t.substr(e,2)!==n?-1:e:(i=r.shift())>=(o=s.getChildIdx(t,e)).length?-1:s.getIdxbyList(t,o[i],r,n)},X.getIdxbyListEx=function(t,e,r,n){var i,o,s=X;if(0==r.length)return void 0!==n&&t.substr(e,2)!==n?-1:e;i=r.shift(),o=s.getChildIdx(t,e);for(var a=0,u=0;u<o.length;u++){var l=t.substr(o[u],2);if("number"==typeof i&&!s.isContextTag(l)&&a==i||"string"==typeof i&&s.isContextTag(l,i))return s.getIdxbyListEx(t,o[u],r,n);s.isContextTag(l)||a++}return-1},X.getTLVbyList=function(t,e,r,n){var i=X,o=i.getIdxbyList(t,e,r,n);return-1==o||o>=t.length?null:i.getTLV(t,o)},X.getTLVbyListEx=function(t,e,r,n){var i=X,o=i.getIdxbyListEx(t,e,r,n);return-1==o?null:i.getTLV(t,o)},X.getVbyList=function(t,e,r,n,i){var o,s,a=X;return-1==(o=a.getIdxbyList(t,e,r,n))||o>=t.length?null:(s=a.getV(t,o),!0===i&&(s=s.substr(2)),s)},X.getVbyListEx=function(t,e,r,n,i){var o,s,a=X;return-1==(o=a.getIdxbyListEx(t,e,r,n))?null:(s=a.getV(t,o),"03"==t.substr(o,2)&&!1!==i&&(s=s.substr(2)),s)},X.getInt=function(t,e,r){null==r&&(r=-1);try{var n=t.substr(e,2);if("02"!=n&&"03"!=n)return r;var i=X.getV(t,e);return"02"==n?parseInt(i,16):function(t){try{var e=t.substr(0,2);if("00"==e)return parseInt(t.substr(2),16);var r=parseInt(e,16),n=t.substr(2),i=parseInt(n,16).toString(2);return"0"==i&&(i="00000000"),i=i.slice(0,0-r),parseInt(i,2)}catch(t){return-1}}(i)}catch(t){return r}},X.getOID=function(t,e,r){null==r&&(r=null);try{return"06"!=t.substr(e,2)?r:function(t){if(!V(t))return null;try{var e=[],r=t.substr(0,2),n=parseInt(r,16);e[0]=new String(Math.floor(n/40)),e[1]=new String(n%40);for(var i=t.substr(2),o=[],s=0;s<i.length/2;s++)o.push(parseInt(i.substr(2*s,2),16));var a=[],u="";for(s=0;s<o.length;s++)128&o[s]?u+=M((127&o[s]).toString(2),7):(u+=M((127&o[s]).toString(2),7),a.push(new String(parseInt(u,2))),u="");var l=e.join(".");return a.length>0&&(l=l+"."+a.join(".")),l}catch(t){return null}}(X.getV(t,e))}catch(t){return r}},X.getOIDName=function(t,e,r){null==r&&(r=null);try{var n=X.getOID(t,e,r);if(n==r)return r;var i=f.asn1.x509.OID.oid2name(n);return""==i?n:i}catch(t){return r}},X.getString=function(t,e,r){null==r&&(r=null);try{return T(X.getV(t,e))}catch(t){return r}},X.hextooidstr=function(t){var e=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},r=[],n=t.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var o=t.substr(2),s=[],a=0;a<o.length/2;a++)s.push(parseInt(o.substr(2*a,2),16));var u=[],l="";for(a=0;a<s.length;a++)128&s[a]?l+=e((127&s[a]).toString(2),7):(l+=e((127&s[a]).toString(2),7),u.push(new String(parseInt(l,2))),l="");var c=r.join(".");return u.length>0&&(c=c+"."+u.join(".")),c},X.isContextTag=function(t,e){var r,n;t=t.toLowerCase();try{r=parseInt(t,16)}catch(t){return-1}if(void 0===e)return 128==(192&r);try{return null!=e.match(/^\[[0-9]+\]$/)&&(!((n=parseInt(e.substr(1,e.length-1),10))>31)&&(128==(192&r)&&(31&r)==n))}catch(t){return!1}},X.isASN1HEX=function(t){var e=X;if(t.length%2==1)return!1;var r=e.getVblen(t,0),n=t.substr(0,2),i=e.getL(t,0);return t.length-n.length-i.length==2*r},X.checkStrictDER=function(t,e,r,n,i){var o=X;if(void 0===r){if("string"!=typeof t)throw new Error("not hex string");if(t=t.toLowerCase(),!f.lang.String.isHex(t))throw new Error("not hex string");r=t.length,i=(n=t.length/2)<128?1:Math.ceil(n.toString(16))+1}if(o.getL(t,e).length>2*i)throw new Error("L of TLV too long: idx="+e);var s=o.getVblen(t,e);if(s>n)throw new Error("value of L too long than hex: idx="+e);var a=o.getTLV(t,e),u=a.length-2-o.getL(t,e).length;if(u!==2*s)throw new Error("V string length and L's value not the same:"+u+"/"+2*s);if(0===e&&t.length!=a.length)throw new Error("total length and TLV length unmatch:"+t.length+"!="+a.length);var l=t.substr(e,2);if("02"===l){var c=o.getVidx(t,e);if("00"==t.substr(c,2)&&t.charCodeAt(c+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(l,16)){for(var h=o.getVblen(t,e),p=0,d=o.getChildIdx(t,e),v=0;v<d.length;v++){p+=o.getTLV(t,d[v]).length,o.checkStrictDER(t,d[v],r,n,i)}if(2*h!=p)throw new Error("sum of children's TLV length and L unmatch: "+2*h+"!="+p)}},X.oidname=function(t){var e=f.asn1;f.lang.String.isHex(t)&&(t=e.ASN1Util.oidHexToInt(t));var r=e.x509.OID.oid2name(t);return""===r&&(r=t),r},void 0!==f.asn1&&f.asn1||(f.asn1={}),void 0!==f.asn1.x509&&f.asn1.x509||(f.asn1.x509={}),f.asn1.x509.AlgorithmIdentifier={},f.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},f.asn1.x509.OID=new function(t){this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.name2oidList={sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1"},this.objCache={},this.name2obj=function(t){if(void 0!==this.objCache[t])return this.objCache[t];if(void 0===this.name2oidList[t])throw"Name of ObjectIdentifier not defined: "+t;var e=this.name2oidList[t],r=new f.asn1.DERObjectIdentifier({oid:e});return this.objCache[t]=r,r},this.atype2obj=function(t){if(void 0!==this.objCache[t])return this.objCache[t];var e;if(t.match(/^\d+\.\d+\.[0-9.]+$/))e=t;else if(void 0!==this.atype2oidList[t])e=this.atype2oidList[t];else{if(void 0===this.name2oidList[t])throw"AttributeType name undefined: "+t;e=this.name2oidList[t]}var r=new f.asn1.DERObjectIdentifier({oid:e});return this.objCache[t]=r,r}},f.asn1.x509.OID.oid2name=function(t){var e=f.asn1.x509.OID.name2oidList;for(var r in e)if(e[r]==t)return r;return""},f.asn1.x509.OID.oid2atype=function(t){var e=f.asn1.x509.OID.atype2oidList;for(var r in e)if(e[r]==t)return r;return t},f.asn1.x509.OID.name2oid=function(t){if(t.match(/^[0-9.]+$/))return t;var e=f.asn1.x509.OID.name2oidList;return void 0===e[t]?"":e[t]},I.getPosArrayOfChildrenFromHex=function(t){return X.getChildIdx(t,0)},I.getHexValueArrayOfChildrenFromHex=function(t){var e,r=X.getV,n=r(t,(e=I.getPosArrayOfChildrenFromHex(t))[0]),i=r(t,e[1]),o=r(t,e[2]),s=r(t,e[3]),a=r(t,e[4]),u=r(t,e[5]),l=r(t,e[6]),c=r(t,e[7]),h=r(t,e[8]);return(e=new Array).push(n,i,o,s,a,u,l,c,h),e},I.prototype.readPrivateKeyFromPEMString=function(t){var e=H(t),r=I.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])},I.prototype.readPKCS5PrvKeyHex=function(t){var e=I.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},I.prototype.readPKCS8PrvKeyHex=function(t){var e,r,n,i,o,s,a,u,l=X,c=l.getVbyListEx;if(!1===l.isASN1HEX(t))throw new Error("not ASN.1 hex string");try{e=c(t,0,[2,0,1],"02"),r=c(t,0,[2,0,2],"02"),n=c(t,0,[2,0,3],"02"),i=c(t,0,[2,0,4],"02"),o=c(t,0,[2,0,5],"02"),s=c(t,0,[2,0,6],"02"),a=c(t,0,[2,0,7],"02"),u=c(t,0,[2,0,8],"02")}catch(t){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(e,r,n,i,o,s,a,u)},I.prototype.readPKCS5PubKeyHex=function(t){var e=X,r=e.getV;if(!1===e.isASN1HEX(t))throw new Error("keyHex is not ASN.1 hex string");var n=e.getChildIdx(t,0);if(2!==n.length||"02"!==t.substr(n[0],2)||"02"!==t.substr(n[1],2))throw new Error("wrong hex for PKCS#5 public key");var i=r(t,n[0]),o=r(t,n[1]);this.setPublic(i,o)},I.prototype.readPKCS8PubKeyHex=function(t){var e=X;if(!1===e.isASN1HEX(t))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==e.getTLVbyListEx(t,0,[0,0]))throw new Error("not PKCS8 RSA public key");var r=e.getTLVbyListEx(t,0,[1,0]);this.readPKCS5PubKeyHex(r)},I.prototype.readCertPubKeyHex=function(t,e){var r,n;(r=new $).readCertHex(t),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)},I.prototype.verify=function(t,e){if(null==(e=e.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var r=N(e,16),n=this.n.bitLength();if(r.bitLength()>n)return!1;var i=this.doPublic(r).toString(16);if(i.length+3!=n/4)return!1;var o=J(i.replace(/^1f+00/,""));if(0==o.length)return!1;var s,a=o[0];return o[1]==(s=t,f.crypto.Util.hashString(s,a))},I.prototype.verifyWithMessageHash=function(t,e){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=N(e,16);if(r.bitLength()>this.n.bitLength())return 0;var n=J(this.doPublic(r).toString(16).replace(/^1f+00/,""));return 0!=n.length&&(n[0],n[1]==t)},I.prototype.verifyPSS=function(t,e,r,n){var i=function(t){return f.crypto.Util.hashHex(t,r)}(O(t));return void 0===n&&(n=-1),this.verifyWithMessageHashPSS(i,e,r,n)},I.prototype.verifyWithMessageHashPSS=function(t,e,r,n){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,o=new d(e,16),s=function(t){return f.crypto.Util.hashHex(t,r)},a=T(t),u=a.length,l=this.n.bitLength()-1,c=Math.ceil(l/8);if(-1===n||void 0===n)n=u;else if(-2===n)n=c-u-2;else if(n<-2)throw new Error("invalid salt length");if(c<u+n+2)throw new Error("data too long");var h=this.doPublic(o).toByteArray();for(i=0;i<h.length;i+=1)h[i]&=255;for(;h.length<c;)h.unshift(0);if(188!==h[c-1])throw new Error("encoded message does not end in 0xbc");var p=(h=String.fromCharCode.apply(String,h)).substr(0,c-u-1),v=h.substr(p.length,u),y=65280>>8*c-l&255;if(0!=(p.charCodeAt(0)&y))throw new Error("bits beyond keysize not zero");var g=pss_mgf1_str(v,p.length,s),m=[];for(i=0;i<p.length;i+=1)m[i]=p.charCodeAt(i)^g.charCodeAt(i);m[0]&=~y;var b=c-u-n-2;for(i=0;i<b;i+=1)if(0!==m[i])throw new Error("leftmost octets not zero");if(1!==m[b])throw new Error("0x01 marker not found");return v===T(s(O("\0\0\0\0\0\0\0\0"+a+String.fromCharCode.apply(String,m.slice(-n)))))},I.SALT_LEN_HLEN=-1,I.SALT_LEN_MAX=-2,I.SALT_LEN_RECOVER=-2,$.hex2dn=function(t,e){void 0===e&&(e=0);var r=new $;return X.getTLV(t,e),r.getX500Name(t).str},$.hex2rdn=function(t,e){if(void 0===e&&(e=0),"31"!==t.substr(e,2))throw new Error("malformed RDN");for(var r=new Array,n=X.getChildIdx(t,e),i=0;i<n.length;i++)r.push($.hex2attrTypeValue(t,n[i]));return(r=r.map((function(t){return t.replace("+","\\+")}))).join("+")},$.hex2attrTypeValue=function(t,e){var r=X,n=r.getV;if(void 0===e&&(e=0),"30"!==t.substr(e,2))throw new Error("malformed attribute type and value");var i=r.getChildIdx(t,e);2!==i.length||t.substr(i[0],2);var o=n(t,i[0]),s=f.asn1.ASN1Util.oidHexToInt(o);return f.asn1.x509.OID.oid2atype(s)+"="+T(n(t,i[1]))},$.getPublicKeyFromCertHex=function(t){var e=new $;return e.readCertHex(t),e.getPublicKey()},$.getPublicKeyFromCertPEM=function(t){var e=new $;return e.readCertPEM(t),e.getPublicKey()},$.getPublicKeyInfoPropOfCertPEM=function(t){var e,r,n=X.getVbyList,i={};return i.algparam=null,(e=new $).readCertPEM(t),r=e.getPublicKeyHex(),i.keyhex=n(r,0,[1],"03").substr(2),i.algoid=n(r,0,[0,0],"06"),"2a8648ce3d0201"===i.algoid&&(i.algparam=n(r,0,[0,1],"06")),i},$.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];var et,rt=[(et=new $,et.readCertPEM(function(){var t=113,e=126,r=0,n="";return arguments[r].split(n).map((function(n){return n.charCodeAt(r)>e?n:String.fromCharCode((n.charCodeAt(r)+t)%e)})).join(n)}(":::::ORTV[-PR_aVSVPNaR:::::ZVVS@\tPPNErtNVONtVWNZR}@]nU\0ZaZN=TP`\0T`Vo@Q^ROPbNZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tR]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaNrS=\\QN>Z\tN\\Q^B[QqnS=\b\\QN>Zwp\\Q^B[QqnZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tR]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaPPNvVQ^fWX|gVup[N^ROO^NQttV]NQPPNt|PttVONZU|C\b\\@@e^Xv{[vTtd8`nyO@ebN[bqx=ng?\tS^w@|XAz|qUTwfzn]Bu<qs_ae\\y<}u`eRAoE`_\\s\0r|b{rp_o<oC@o=x\bw_cUUZPApQevD\\FxFoFgE=<sq[p<coqyn>TEpP@aSC_YDU8\0|8TB?c>r\\=rp`pcwP}c\0PP_\\RS\\EPVSy8x`\0?R|NP\tP>}A^VP}Ex\bUZa=syDw}>Ya8wPp[pRnn\brU^dE8U?a\bcW|<FEbbupn^`ZNr\tsof[wA}e{\\z}w[YDQ|dt=wC\tNvbRZ@@U|ZAYpFsabCBB\\`wrqxsYW8uFyWdaWezeUeA_8VoVupvY[TD[OYdpO\bC[wX\\O]=[QRpV\0d`N\0RXt^Z}vEpdC=\bY?=V}?^W\bad|qN@Ww>@PycaqANE]asPcE^OB_VA?>wzeftac\tZ\tguf\bF]DCP?znNYf\tuaYu[`=b|v]Bp=RAS``\\PRDW]_`UXdUg=SuqwVFDeB\tD8{B>\\sPYbEU\tFQXz\0@`zsqgfD\0[WY\bPeZc}\t\0bx?Rfed}BUe|Uo\0y?\bsSXZOSBCgbFqf\0Bs?b?d<VE\\Zzns\\d@?dPvf\\{}_\0Sd[<q_YBY`Ffg=sY>{t<fu]xrFNtZONNTwbQO\\ZO=TN>bqQt^dOOaAFXw=\tPCVxsv?{`a\bvS8YQ[aNsOt[cU`ZRTQNdtOaAFXw=\tPCVxsv?{`a\bvS8YQ[aNZOt[cU_ZROaNQN^U<ZN=TP`\0T`Vo@Q^ROPbNNAVPN^P\0{y\0Bs\\8\0R[z]w??qZP?NpgdenSuvv?>|f_?UpYPcQ\\gCb8zxtSvsOQNg>[\\\0\bx\b_o@8\0g`Z<PyUE`8yu}\\g{@`s`zUgErRtve{YdCvoO@>WFDtABNp\0feUWszpQaEYNAc]^xB[@]BDAN8\b}XA=EnO}Pud8TA\t?yPrVv{\\>E]o`BO^RE^X[W[rEU?x\bf>V\tOUwY=>X[\\E`tW[8}VwpFBQcnrPF}yUtd8<Doe_\b[oOVUep@pYY\0cegY{r\t?\bAbq?ff8}UaXoN_D]_X_8yozYFT`N{`\\{zvu?\bDWT}=_<StX\tNx\0\b\t\0aT=c@ucnWfR[vf>RFxAFV}{N`dN^\\<eawBPxx}quT=|{T_R@Fp^Y<ZevRsWaZ]V\tCVrRVtAAc[\tQp|d|tqoQ=T|XX\t=u\\N8XNCx\\aU>wz\tX<e@Vc?dy\\|^FEq|=p`pBdF@bs^d<]vp\\^TZ\tP\bZ\b\\YNNSZ_\\w^|TsD8db\t_\tY\\o^Cw>Z\0x\\^aN]wWf\bA}\tC^d_{ZC@\by]gY@E\tBFY?OsaqbDcVgQbZeFc\tovtucxnq|<TnuyXRveYFOegCpAs{YTe|>bE<OXsSqCBWD_SVepfvCCUg]z\tZvQ[\0s|U>pFz\b=OwT``fNJJ:::::R[Q-PR_aVSVPNaR:::::")),et)];function nt(t,e){var r=t.getIssuerHex();if(r===t.getSubjectHex())return t.verifySignature(t.getPublicKey());var n=function(t,e){for(var r=0,n=e;r<n.length;r++){var i=n[r];if(i.getSubjectHex()===t)return i}}(r,e);return!!n&&(!1!==t.verifySignature(n.getPublicKey())&&nt(n,e))}function it(t){return t.getIssuerHex()!==t.getSubjectHex()&&nt(t,rt)}!function(t){var e=new $;"string"==typeof t?e.readCertPEM(t):e.readCertHex(t.hex);var r=it(e);rt.push(e)}(function(){var t=113,e=126,r=0,n="";return arguments[r].split(n).map((function(n){return n.charCodeAt(r)>e?n:String.fromCharCode((n.charCodeAt(r)+t)%e)})).join(n)}(":::::ORTV[-PR_aVSVPNaR:::::ZVVTU\tPPONrtNVONtVWNW=_SVw\tVE=ZN=TP`\0T`Vo@Q^ROPbNZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tR]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaNrS=\bZQNAZaN\\aZ\t[QSnS=\b[aNBZQZ\\aZ\t[QSnZVTaZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tRbZOVTN>bRPtYoTyuoz}}f`Bwo?=RQN\\Ot[cONZO>Wyfd\tgdbRaN]Ot[cONZZPRuupz_@feWyZ`bVfWX|gVup[N^xOSugnec|fdyndB{^T}fdB\0ndRf?FZVVPVwN[Otx\0uxvTF=ON^RSNN\\PNtENZVVPPtXPNtRN?=?]q[VD|{\\oyo`oOu}F\tSAe`tn[t\tu\b8^a]qx\bE_^ZN?[QC\0yuOpybY8r\\RPAS=8rUq\0E8>xean^e\bf]Y`XO}{C[Ur^?\0x[SRXvVQ\\CFr}QnAPRQFO=Yw\0_TePCOFV@|N>ROXcDrT<>bW<ssO?NOT{^s]uU\0gS\bBffsfE\0AfDyQEZR`]XBo|Qw}yYdwwTvOFcBndUz^\\{]\tb=^yQYSTQ`]\0?tR{WRUun\\\0bVe_E|VWWV|r\tAo\0\tF`fdzCnRtq\br\t\b8eBp=Z\\TRaadc}@Eub`quuNqAdF\0aUay{}x>tgVz`\t_YBFwu_q?egt8v[o\x008\twTQcrA\t<z{DZoEE^rZTrpaZQzqpBY]^zt8[bQv}yEWw\tXDYQB\0QB\bx_^X]|uEDtPf[n[r_bpB[bE}?ung|bnU|NYOoedY_tvXySZfYPdWV]OE^\bOFwA}<uXoO}_NDz8aonzWOfcv@?>snfqu@FeEx^\\\bVfuO`\\\0tSg]zDU}QrAT|\tOZV|OvpVD<sN@z`<_cSrNCW>?=Au?g_8v{|}}WF>Sr>QBxO\td_D}eBb?Uq^b\t[y}x]}{?P|BQtecTB[pQBW>|p|nfv\0zUxOO}WqwE=<PURZy@X8r\\]u=<pPNRNNn\\OtaO<ZOETPdPT`NTT8RVOQ^^`SuO`gdSp?cyVRg\bo?B=VR[OZO=TN>bqQt^dOO`FyWadZcAD\tpeXybcW@}Qf\\QNsOt[cU`ZRTQNdtOaAFXw=\tPCVxsv?{`a\bvS8YQ[aN]Ot[cU_ZONsEROaNQN^U<ZNTN>bqQ^RNVOOwN[Otx\0uxvTF=ON^SNN\\PNtRNrx\ta[}tP_g8FbD\0^\0qt<f88ufuN]^}]gp\bqYudF88Fas_Ef`\t?^x>X}esa{>\\r?eE]CC_cZ[vQs\t\t>gX[szONg=^pn=<e]nbSz\bZvac\b[w^nA_`vP|@8w[}nQobe=??oRYf{vpRxcC}yCd>8[NDx{Ne\\t8oou=guC>>gvb}ACd\t``Ntq\0yC[Q{|ynpNQqSqzxF<_PFDw<]Bnnu>F<XgU_Zf\\\\A=gu\\codOwQ]oQ<f>gv_pwozwC}xX>C`c]suEdfW?cbeo\b`BbyR@eFTUwSud=t]sS\\onc\tXSq\t{\0DvAVBbnTqEE[QzDyqF`bF}R=Q?VeDo<Vzb\0w}D}NZ\0t}^?OyFP\bVaVNrTNYqe?[NRYTSQby@yzWvT`wQo}y]c_WgxBYCy\tRNRg@NZCaaq8?`\t^`?ryD\t=obzw?E]Ou]n@>bVzqAQT?@_zo@}CxWVTUsAYdNd?{APQr8{P]]AZ>aR\0[D<z?Tr@`u@X|YDwd_<p<>zWE>]\0=X`\b@uucp|^_Qb@uZouTX^o\0\\{PCq{ug8^f[YQAWad8FNqxFQE?ZOo\t}RnO\bsQc\txyccn=nxvs>bDBf\b\bW\\TuTnvAO^U\0QXC>xx8FxRFf<tJ:::::R[Q-PR_aVSVPNaR:::::"));var ot=function(t,e){return ot=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},ot(t,e)};function st(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}ot(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var at=function(){return at=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},at.apply(this,arguments)};function ut(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}var lt,ct,ht,ft,pt=function(){function t(t,e,r){this.x=t,this.y=e,this.z=r}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},t.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},t.prototype.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},t.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},t.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},t.prototype.cross=function(t){var e=this.x,r=this.y,n=this.z;return this.x=r*t.z-n*t.y,this.y=n*t.x-e*t.z,this.z=e*t.y-r*t.x,this},t.prototype.crossVectors=function(t,e){var r=t.x,n=t.y,i=t.z,o=e.x,s=e.y,a=e.z;return this.x=n*a-i*s,this.y=i*o-r*a,this.z=r*s-n*o,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z)},t}(),dt=function(){function t(t,e,r,n){this.extents=t,this.startIndex=e,this.endIndex=r,this.level=n,this.node0=null,this.node1=null}return t.prototype.clearShapes=function(){this.startIndex=-1,this.endIndex=-1},t}(),vt=(lt=new pt(0,0,0),ct=new pt(0,0,0),ht=new pt(0,0,0),ft=new pt(0,0,0),function(t,e,r,n,i,o){ct.subVectors(e,t),ht.subVectors(r,t),ft.crossVectors(ct,ht);var s,a=i.dot(ft);if(a>0){if(o)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}lt.subVectors(n,t);var u=s*i.dot(ht.crossVectors(lt,ht));if(u<0)return null;var l=s*i.dot(ct.cross(lt));if(l<0)return null;if(u+l>a)return null;var c=-s*lt.dot(ft);if(c<0)return null;var h=c/a;return new pt(0,0,0).copy(i).multiplyScalar(h).add(n)}),yt=function(t,e){this.min=t,this.max=e};function gt(t,e,r){var n=new yt(0,0);e.x>=0?(n.min=(r.extents[0]-t.x)*e.x,n.max=(r.extents[3]-t.x)*e.x):(n.min=(r.extents[3]-t.x)*e.x,n.max=(r.extents[0]-t.x)*e.x);var i=new yt(0,0);if(e.y>=0?(i.min=(r.extents[1]-t.y)*e.y,i.max=(r.extents[4]-t.y)*e.y):(i.min=(r.extents[4]-t.y)*e.y,i.max=(r.extents[1]-t.y)*e.y),n.min>i.max||i.min>n.max)return!1;i.min>n.min&&(n.min=i.min),i.max<n.max&&(n.max=i.max);var o=new yt(0,0);return e.z>=0?(o.min=(r.extents[2]-t.z)*e.z,o.max=(r.extents[5]-t.z)*e.z):(o.min=(r.extents[5]-t.z)*e.z,o.max=(r.extents[2]-t.z)*e.z),!(n.min>o.max||o.min>n.max)&&(o.min>n.min&&(n.min=o.min),o.max<n.max&&(n.max=o.max),!(n.max<0))}var mt=[0,0,0,0,0,0];function bt(t,e,r,n,i){if(r>=n)return mt;var o,s=r,a=6*t[s],u=e[a],l=e[a+1],c=e[a+2],h=e[a+3],f=e[a+4],p=e[a+5];for(++s;s<n;s++)(o=e[a=6*t[s]])<u&&(u=o),(o=e[a+1])<l&&(l=o),(o=e[a+2])<c&&(c=o),(o=e[a+3])>h&&(h=o),(o=e[a+4])>f&&(f=o),(o=e[a+5])>p&&(p=o);return[u-i,l-i,c-i,h+i,f+i,p+i]}var xt=function(t,e,r){this.triangle=t,this.triangleIndex=e,this.intersectionPoint=r},wt=function(){function t(t,e){this.trianglesArray=t,this.maxTrianglesPerNode=e;var r,n,i,o,s,a,u=t.length/9,l=new Uint32Array(u),c=new Float32Array(6*u);r=o=t[0],n=s=t[1],i=a=t[2];for(var h=0,f=void 0,p=void 0,d=void 0,v=void 0,y=void 0,g=void 0,m=void 0,b=void 0,x=void 0;h<u;h++)b=6*h,f=v=t[x=9*h],(m=t[x+3])<f?f=m:m>v&&(v=m),(m=t[x+6])<f?f=m:m>v&&(v=m),f<r&&(r=f),v>o&&(o=v),p=y=t[x+1],(m=t[x+4])<p?p=m:m>y&&(y=m),(m=t[x+7])<p?p=m:m>y&&(y=m),p<n&&(n=p),y>s&&(s=y),d=g=t[x+2],(m=t[x+5])<d?d=m:m>g&&(g=m),(m=t[x+8])<d?d=m:m>g&&(g=m),d<i&&(i=d),g>a&&(a=g),l[h]=h,c[b]=f,c[b+1]=p,c[b+2]=d,c[b+3]=v,c[b+4]=y,c[b+5]=g;this.offsetArray=l,this.bboxArray=c,this.rootNode=new dt([r,n,i,o,s,a],0,u,0),this.nodesToSplit=[],u>this.maxTrianglesPerNode&&this.nodesToSplit.push(this.rootNode),this.splitNode()}return t.prototype.splitNode=function(){var t,e=this.offsetArray,r=this.bboxArray,n=this.maxTrianglesPerNode,i=this.nodesToSplit;function o(t){var o=t.startIndex,s=t.endIndex,a=t.extents,u=[0,1,2],l=[a[3]-a[0],a[4]-a[1],a[5]-a[2]];u.sort((function(t,e){return l[e]-l[t]}));for(var c=0;c<3;c++){for(var h=u[c],f=a[h]+a[h+3],p=o,d=s-1,v=null;p<d;)null===v?r[6*e[p]+h]+r[6*e[p]+h+3]<f?p++:v=e[p]:(r[6*e[d]+h]+r[6*e[d]+h+3]>=f||(e[p]=e[d],e[d]=v,v=null,p++),d--);if(!(p<=o)){var y=bt(e,r,o,p,1e-6),g=new dt(y,o,p,t.level+1);t.node0=g,g.endIndex-g.startIndex>n&&i.push(g);var m=bt(e,r,p,s,1e-6),b=new dt(m,p,s,t.level+1);return t.node1=b,b.endIndex-b.startIndex>n&&i.push(b),void t.clearShapes()}}}for(;t=i.shift();)o(t)},t.prototype.intersectRay=function(t,e,r){for(var n=[this.rootNode],i=[],o=[],s=new pt(1/e.x,1/e.y,1/e.z);n.length>0;){var a=n.pop();if(gt(t,s,a)){a.node0&&n.push(a.node0),a.node1&&n.push(a.node1);for(var u=a.startIndex;u<a.endIndex;u++)i.push(this.offsetArray[u])}}for(var l=new pt(0,0,0),c=new pt(0,0,0),h=new pt(0,0,0),f=new pt(t.x,t.y,t.z),p=new pt(e.x,e.y,e.z),d=(u=0,void 0),v=void 0;u<i.length;u++){v=9*(d=i[u]),l.set(this.trianglesArray[v],this.trianglesArray[v+1],this.trianglesArray[v+2]),c.set(this.trianglesArray[v+3],this.trianglesArray[v+3+1],this.trianglesArray[v+3+2]),h.set(this.trianglesArray[v+6],this.trianglesArray[v+6+1],this.trianglesArray[v+6+2]);var y=vt(l,c,h,f,p,r);if(y){var g=new xt([l.clone(),c.clone(),h.clone()],d,y);o.push(g)}}return o},t.prototype.dispose=function(){this.trianglesArray=new Float32Array,this.bboxArray=new Float32Array,this.offsetArray=new Uint32Array,this.rootNode=null,this.nodesToSplit.length=0},t}(),St=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.floorIndex=0,e.needsRender=!0,e}return st(e,t),e}(s.Mesh);function At(t,e){for(var r=0,n=t.children;r<n.length;r++){var i=n[r];!1!==e(i)&&At(i,e)}}function Pt(){}var Et=new s.BoxBufferGeometry(1,1,1,1,1);Et.deleteAttribute("uv"),Et.deleteAttribute("normal"),Et.groups=[],Et.scale(-1,1,1);var _t=new s.ShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\nvarying vec3 worldPosition;\nvoid main() {\n vec4 transform = vec4(position, 1.0);\n worldPosition = (modelMatrix * transform).xyz;\n gl_Position = projectionMatrix * modelViewMatrix * transform;\n}\n",fragmentShader:"\nuniform samplerCube map;\nvarying vec3 worldPosition;\nvoid main() {\n gl_FragColor = textureCube(map, worldPosition);\n}\n",depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:s.NoBlending,lights:!1,toneMapped:!1,fog:!1}),Nt=new s.Scene;Nt.matrixAutoUpdate=!1;var Ct,It=new s.Mesh(Et,_t);function Rt(t,e,r){_t.uniforms.map.value=t;var n=r.autoClear;r.autoClear=!1;var i=new s.CubeCamera(.1,2,e);i.matrixAutoUpdate=!1,i.update(r,Nt),r.autoClear=n,_t.uniforms.map.value=null}It.matrixAutoUpdate=!1,Nt.add(It);var Dt=null!==(Ct=Math.SQRT1_2)&&void 0!==Ct?Ct:Math.sqrt(2),zt={up:new s.Quaternion(Dt,0,0,Dt),down:new s.Quaternion(-Dt,0,0,Dt),left:new s.Quaternion(0,Dt,0,Dt),right:new s.Quaternion(0,-Dt,0,Dt),front:new s.Quaternion(0,0,0,1),back:new s.Quaternion(0,1,0,0)},Tt=function(){var t=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),e=new Float32Array([0,0,1,0,0,1,1,1]),r=new Uint8Array([0,1,2,1,3,2]),n=new s.BufferGeometry;return n.setAttribute("position",new s.BufferAttribute(t,3)),n.setAttribute("uv",new s.BufferAttribute(e,2)),n.setIndex(new s.BufferAttribute(r,1)),n}(),Ot=[];function Bt(t){t.uniforms.map.value=null,Ot.push(t)}var kt,Ht=(kt="$$FIVE_EVENT$$","undefined"==typeof Symbol?"$Symbol<".concat(kt,">$"):Symbol(kt));function qt(t){return t[Ht]||(t[Ht]={}),t[Ht]}var Vt=function(){function t(){}return t.prototype.hasListener=function(t){var e=qt(this);return e&&e[t]&&e[t].length>0},t.prototype.on=function(t,e,r){var n=this,i=qt(this);return i[t]||(i[t]=[]),i[t].push([e,r||!1]),function(){return n.off(t,e)}},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.off=function(t,e){if(void 0!==t){var r,n=qt(this);if(n[t]||(n[t]=[]),void 0!==e){for(var i=0;i<n[t].length&&n[t][i][0]!==e;i++);i<n[t].length&&n[t].splice(i,1)}else n[t].length=0}else(r=this)[Ht]||delete r[Ht]},t.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var n=!1,i=qt(this),o=i[t]||[],s=0,a=o.slice();s<a.length;s++){var u=a[s],l=u[0],c=u[1],h=void 0!==c&&c,f=l.apply(void 0,e);h&&this.off(t,l),!1===f&&(n=!0)}return n},t}(),Ut="undefined"!=typeof performance&&void 0!==performance.timing?performance.timing.navigationStart:Date.now(),Mt="undefined"!=typeof performance?function(){return Ut+performance.now()}:function(){return Date.now()};function Lt(t){Object.freeze(t);var e="function"==typeof t,r=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(t).forEach((function(n){!r.call(t,n)||e&&("caller"===n||"callee"===n||"arguments"===n)||null===t[n]||"object"!=typeof t[n]&&"function"!=typeof t[n]||Object.isFrozen(t[n])||Lt(t[n])})),t}var Kt=/^([^.]+)(\.([^.]+))*$/;function Ft(t,e){return Kt.test(t)&&Kt.test(e)&&function(t,e){if("*"===t)return!0;var r=t.split(".").reverse(),n=e.split(".").reverse();if(r.length<=1)return t===e;for(var i=0;i<r.length;i++)if(r[i]!==n[i])return!1;return!0}(t,e)}var jt=Lt(JSON.parse(function(){var t=113,e=126,r=0,n="";return arguments[r].split(n).map((function(n){return n.charCodeAt(r)>e?n:String.fromCharCode((n.charCodeAt(r)+t)%e)})).join(n)}("h/y|pnyu|/9/xr;p|z/9/yvn{wvn;p|z/9/rnyrr;p|z/9/rnyrr;p{/9/rnyrr;w}/9/uv;p|z/9/uv;p{/9/ywpq{;p|z/9/rnyrr:pq{;p|z/9/rnyrr:pq{;p{/9/pnyp{|qr;vr/j")));!function(t){function e(e,r,n){return t.call(this,"[NETWORK]: request proxy error(type: ".concat(r,", reason: ").concat(n,"): ").concat(e))||this}st(e,t)}(Error),function(t){function e(e,r,n){var i=t.call(this,"[NETWORK]: response error(type: ".concat(r,", status: ").concat(n,"): ").concat(e))||this;return i.httpStatus=n,i}st(e,t)}(Error),function(t){function e(e,r){return t.call(this,"[NETWORK]: request abort(type: ".concat(r,"): ").concat(e))||this}st(e,t)}(Error),function(t){function e(e,r,n){return t.call(this,"[NETWORK]: request timeout(type: ".concat(r,", timeout: ").concat(n,"ms): ").concat(e))||this}st(e,t)}(Error),function(t){function e(e,r,n){return t.call(this,"[NETWORK]: request forbidden(type: ".concat(r,", reason: ").concat(n,"): ").concat(e))||this}st(e,t)}(Error),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}st(e,t)}(Vt);var Yt=function(){if("undefined"!=typeof window){var t=window;return t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(t){return setTimeout(t,16)}}return function(t){return setTimeout(t,16)}}(),Qt=16,Zt=function(){function t(){this.frames=[],this.stoped=!1,this.time=Mt(),this.context=null,this.loop=this.loop.bind(this),this.loop()}return Object.defineProperty(t,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new t),this.sharedInstance},enumerable:!1,configurable:!0}),t.getFrameTime=function(){return Qt},t.prototype.loop=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!this.stoped){var r=Mt(),n=r-this.time;this.time=r;var i=[];Qt=n;for(var o=0,s=this.frames;o<s.length;o++){var a=s[o];if(a.delay>0)a.delay=a.delay-1;else{try{a.callback.apply(a,ut([r,n],t,!1))}catch(t){console.error(t)}a.once&&i.push(a)}}i.length>0&&(this.frames=this.frames.filter((function(t){return-1===i.indexOf(t)}))),this.requestAnimationFrame(this.loop)}},t.prototype.setContext=function(t){this.cancelAnimationFrame(this.requestId),this.context=t,this.requestId=this.requestAnimationFrame(this.loop)},t.prototype.getContext=function(){return this.context},t.prototype.requestAnimationFrame=function(t){return this.context?this.context.requestAnimationFrame(t):Yt(t)},t.prototype.cancelAnimationFrame=function(t){this.context?this.context.cancelAnimationFrame(t):function(t){var e;if("undefined"!=typeof window){var r=window;e=r.cancelAnimationFrame||r.mozCancelAnimationFrame||r.webkitCancelAnimationFrame||r.msCancelAnimationFrame||function(t){return window.clearTimeout(t)}}else e=function(t){return window.clearTimeout(t)};e(t)}(this.loop),this.requestId=null},t.prototype.remove=function(t){var e=this.frames.indexOf(t);e>=0&&this.frames.splice(e,1)},t.prototype.add=function(t,e,r,n){var i=this;void 0===e&&(e=!1),void 0===r&&(r=0),void 0===n&&(n=5);var o={callback:t,once:e,delay:r,order:n};return this.frames.push(o),this.frames.sort((function(t,e){return t.order-e.order})),function(){return i.remove(o)}},t.prototype.disponse=function(){this.stoped=!0,this.frames.length=0},t}(),Wt=[],Gt=0;Zt.shared.add((function(){if(Gt=10,Wt.length)for(var t=0,e=Wt.splice(0,Gt);t<e.length;t++){var r=e[t];Gt--,r()}})),new s.WebGLRenderTarget(1,1),new s.OrthographicCamera(-1,1,1,-1,0,1).matrixAutoUpdate=!1;var Xt=new s.BufferGeometry;Xt.setAttribute("position",new s.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3));var Jt=new s.Mesh(Xt);Jt.matrixAutoUpdate=!1;var $t=new s.Scene;$t.add(Jt),$t.matrixAutoUpdate=!1,new s.RawShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\n void main() {\n gl_Position = vec4(0, 0, 0, 0);\n }\n ",fragmentShader:"\n uniform sampler2D map;\n void main() {\n gl_FragColor = textureCube(map, vec3(0, 0));\n }\n ",depthTest:!1,depthWrite:!1,stencilWrite:!1,colorWrite:!1,blending:s.NoBlending,lights:!1,toneMapped:!1}),new s.RawShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\n void main() {\n gl_Position = vec4(0, 0, 0, 0);\n }\n ",fragmentShader:"\n uniform samplerCube map;\n void main() {\n gl_FragColor = textureCube(map, vec3(0, 0, 0));\n }\n ",depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:s.NoBlending,lights:!1,toneMapped:!1});var te=function(){function t(t,e,r,n,i){this.tileTree=e,this.tileSources=r,this.options=n,this.renderer=i,this.name="",this.needsRender=!1,this.disposed=!1,this.loadedCubeNodes=new Set,this.loadingCubeNodes=new Set,this.baseCubeTexture=null,this._cubeRenderTarget=null,this.textures=[],this.baseCubeTexture=t}return Object.defineProperty(t.prototype,"cubeRenderTarget",{get:function(){return this._cubeRenderTarget},set:function(t){var e,r,n,i,o;if(null===t)throw new Error("cannot set cubeRenderTarget to null.");t.width!==this.options.textureSize&&t.setSize(this.options.textureSize,this.options.textureSize),t.texture.format=null!==(e=this.options.format)&&void 0!==e?e:s.RGBAFormat,t.texture.minFilter=null!==(r=this.options.minFilter)&&void 0!==r?r:s.LinearFilter,t.texture.magFilter=null!==(n=this.options.magFilter)&&void 0!==n?n:s.LinearFilter,t.texture.wrapS=null!==(i=this.options.wrapS)&&void 0!==i?i:s.ClampToEdgeWrapping,t.texture.wrapT=null!==(o=this.options.wrapT)&&void 0!==o?o:s.ClampToEdgeWrapping,this.baseCubeTexture&&(Rt(this.baseCubeTexture,t,this.renderer),this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this._cubeRenderTarget&&Rt(this._cubeRenderTarget.texture,t,this.renderer),this._cubeRenderTarget=t},enumerable:!1,configurable:!0}),t.prototype.requestTile=function(t){var e,r,n,i,o,a,u=this,l=this.tileSources.filter((function(e){return e.level===t.level}))[0];if(l){var c=l.size,h=Math.pow(2,t.level)*t.position.y,f=Math.pow(2,t.level)*t.position.x,p="".concat((null!==(n=null===(r=null===(e=this.options.imageURL)||void 0===e?void 0:e.options)||void 0===r?void 0:r.key)&&void 0!==n?n:"pano.0").replace(/^pano/,"pano_tile"),".").concat(t.face,".").concat(t.level,".").concat(h,".").concat(f),d=at(at({},null!==(o=null===(i=this.options.imageURL)||void 0===i?void 0:i.options)&&void 0!==o?o:{basisLoaderInitialized:!1,key:"unknown"}),{key:p,size:c*t.size===this.options.tileImageSize?void 0:this.options.tileImageSize,quality:void 0,cut:[c*t.position.x,c*t.position.y,c*t.size,c*t.size]});this.loadingCubeNodes.add(t),this.options.textureLoader.loadTexture(l[t.face],{imageURL:{transform:null===(a=this.options.imageURL)||void 0===a?void 0:a.transform,options:at({},d)},format:s.RGBAFormat,viaAjax:!1}).then((function(e){u.disposed?e.body.dispose():(u.textures.push({face:t.face,level:t.level,position:t.position,size:new s.Vector2(t.size,t.size),texture:e.body}),u.loadedCubeNodes.add(t))})).catch(Pt).then((function(){u.disposed||u.loadingCubeNodes.delete(t)}))}else this.loadedCubeNodes.add(t)},t.prototype.update=function(t,e){var r=this;if(!this.disposed){var n=[];At(this.tileTree,(function(i){return!r.loadingCubeNodes.has(i)&&(!(i.level>e)&&(!!t.intersectsBox(i.box)&&(r.loadedCubeNodes.has(i)?void 0:(n.push(i),!1))))}));for(var i=0,o=n;i<o.length;i++){var a=o[i];this.requestTile(a)}if(this.cubeRenderTarget&&this.textures.length){var u=this.textures.splice(0,4);!function(t,e,r){var n=new s.Scene,i=new s.Group;i.scale.set(1,1,-1),n.add(i);for(var o=[],a=0,u=t;a<u.length;a++){var l=u[a],c=Ot.pop()||new s.ShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\nuniform sampler2D map;\nvarying vec2 vUv;\nvoid main() {\n gl_FragColor = texture2D(map, vUv);\n}\n",depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:s.NoBlending,lights:!1,toneMapped:!1,fog:!1});o.push(c),c.uniforms.map.value=l.texture;var h=new s.Group,f=new s.Mesh(Tt,c);f.position.set(l.position.x+l.size.x/2-.5,1-(l.position.y+l.size.y/2)-.5,-.5),f.scale.set(l.size.x,l.size.y,1),h.quaternion.copy(zt[l.face]),h.add(f),i.add(h)}var p=r.autoClear;r.autoClear=!1;var d=new s.CubeCamera(.1,2,e);d.matrixAutoUpdate=!1,d.update(r,n),r.autoClear=p;for(var v=0,y=o;v<y.length;v++)Bt(c=y[v])}(u,this.cubeRenderTarget,this.renderer),this.needsRender=!0;for(var l=0,c=u;l<c.length;l++){c[l].texture.dispose()}}}},Object.defineProperty(t.prototype,"tilePending",{get:function(){return this.loadingCubeNodes.size},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"texture",{get:function(){if(!this._cubeRenderTarget)throw new Error("cubeRenderTarget never set.");return this._cubeRenderTarget.texture},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){if(!this.disposed){this.disposed=!0,this.baseCubeTexture&&(this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this.loadingCubeNodes.clear(),this.loadedCubeNodes.clear();for(var t=0,e=this.textures;t<e.length;t++){e[t].texture.dispose()}this.textures.length=0}},t}(),ee=function(){var t=113,e=126,r=0,n="";return arguments[r].split(n).map((function(n){return n.charCodeAt(r)>e?n:String.fromCharCode((n.charCodeAt(r)+t)%e)})).join(n)}("n\bv{t-rp@-[|znyHn\bv{t-rp@-cvr]|vv|{Hn\bv{t-rpA-|yq]|vv|{H0v{pyqr-Ip|zz|{K0v{pyqr-Il}nlrrK0v{pyqr-I?l}nlrrK0v{pyqr-Ip|y|l}nlrrK0v{pyqr-Iunq|zn}l}nlrrK|vq-znv{56-\n--0v{pyqr-IlrrK--0v{pyqr-I?lrrK--0v{pyqr-Ip|y|lrrK--0v{pyqr-Iortv{{|znylrrK--0v{pyqr-Iqrsny{|znylrrK--rpA-n{s|zrq-J-rpA5}|vv|{9->;=6H--rpA-z]|vv|{-J-z|qrycvrZnv-7-n{s|zrqH--[|zny-J-{|znyv\tr5n{s|zrq[|zny6H--cvr]|vv|{-J-:z]|vv|{;\b\tH--|yq]|vv|{-J-z|qryZnv-7-n{s|zrqH--tyl]|vv|{-J-}|wrpv|{Znv-7-z|qrycvrZnv-7-n{s|zrqH--0v{pyqr-Iunq|zn}lrrK\f"),re=function(){var t=113,e=126,r=0,n="";return arguments[r].split(n).map((function(n){return n.charCodeAt(r)>e?n:String.fromCharCode((n.charCodeAt(r)+t)%e)})).join(n)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=60qrsv{r-aNb-C;?E@>EB?{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznvH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznvH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-rp@-qvssrH{vs|z-rp@-rzvvrH{vs|z-rp@-}rpynH{vs|z-sy|n-uv{v{rH{vs|z-sy|n-r}|rH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-}|trH{vs|z-sy|n-sy||V{qrH0vs-qrsv{rq5b`RlNYYlP\\Y\\_6{vs|z-rp@-z|qryP|y|V{s|H0r{qvs0vs-qrsv{rq5b`Rl]N[\\lcVQR\\6--{vs|z-rp?-}n{|cvqr|lv\trH--{vs|z-znA-}n{|cvqr|lznvH--{vs|z-sy|n-}n{|cvqr|lny}unH--{vs|z-nz}yr?Q-}n{|cvqr|lzn}H0r{qvs0vs-qrsv{rq5b`RlPYV]SY\\\\_6--{vs|z-rp@-sy||V{s|H0r{qvsn\bv{t-rpA-|yq]|vv|{H0vs-qrsv{rq5b`RlPbaR_6--0vs-[bZlPYV]]V[TlN__NflYR[TaU-K-=----{vs|z-rpA-pyv}}r]yn{rNn\bh-[bZlPYV]]V[TlN__NflYR[TaU-jH----{vs|z-sy|n-pyv}}rSy||h[bZlPYV]]V[TlO\\ejH----{vs|z-nz}yr?Q-pyv}}r]yn{rarrH--0r{qvs0r{qvs0vs-[bZlSY\\\\_lP\\b[a-K-=--{vs|z-rp@-ty|onySy||V{s|h[bZlSY\\\\_lP\\b[ajH0r{qvs0v{pyqr-Ip|zz|{K0v{pyqr-I}npxv{tK0v{pyqr-Ip|y|l}nlsntzr{K0v{pyqr-Il}nlsntzr{K0v{pyqr-I?l}nlsntzr{K0v{pyqr-Izn}l}nlsntzr{K0v{pyqr-Iny}unzn}l}nlsntzr{K0v{pyqr-In|zn}l}nlsntzr{K0v{pyqr-Iyvtuzn}l}nlsntzr{K0v{pyqr-Irzvvrzn}l}nlsntzr{K0v{pyqr-Ir{zn}l}nlsntzr{K0v{pyqr-Itnqvr{zn}l}nlsntzr{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-IoqsK0v{pyqr-Iyvtul}nlortv{K0v{pyqr-Iyvtul}u|{tl}nlsntzr{K0v{pyqr-Iunq|zn}l}nlsntzr{Krp?-|P||q5rp@-rp|6-\n--sy|n--J-yr{tu5rp|6H--sy|n-urn-J-np|5rp|;\b-<-6H--sy|n-}uv-J-nn{5rp|;9-rp|;\t6H--r{-rp?5=;B-8-}uv-<-aNb9-urn-<-]V6H\f|vq-znv{56-\n--0vs-qrsv{rq5b`RlNYYlP\\Y\\_6----tylSntP|y|-J-rpA5z|qryP|y|V{s|;9z|qryP|y|V{s|;t9z|qryP|y|V{s|;o9>;=6H----r{H--0r{qvsvs-5q|5cvr]|vv|{9-[|zny6-I-=;=6-\n----qvpnqH--\f--<<前置裁切计算--0vs-qrsv{rq5b`RlPbaR_6----rpA-}yn{rH----s|5-v{-v-J-=H-v-I-[bZlPYV]]V[TlO\\eH-v886\n------o||y-pyv}}rq-J-rH------v{-pr{Sy||V{qr-J-v{5pyv}}rSy||hvj6H------s|-5-v{-w-J-=H-w-I-CH-w-88-6-\n--------sy|n-P||q-J-sy|n5v-7-C-8-w6-<-sy|n5[bZlPYV]]V[TlN__NflYR[TaU6H--------sy|n-\bP||q-J-=;BH--------}yn{r-J-rr?Q5pyv}}r]yn{rarr9-rp?5P||q9-\bP||q6-6H--------pyv}}rq-J-5-q|5-cvr]|vv|{9-}yn{r;\b\t-6-K-}yn{r;-6-33-pyv}}rqH------\f------o||y-v{antrSy||-J-snyrH-------s|5-v{-x-J-=H-x-I-[bZlSY\\\\_lP\\b[aH-x88-6\n--------vs5pr{Sy||V{qr-JJ-x-33-|yq]|vv|{;\b-I-ty|onySy||V{s|hxj;-33-|yq]|vv|{;\b-K-ty|onySy||V{s|hxj;t6-\n----------v{antrSy||-J-rH--------\f------\f------pyv}}rq-J-5pr{Sy||V{qr-JJ-:>-\v\v-v{antrSy||6-33-pyv}}rqH------------vs5pyv}}rq6-\n--------qvpnqH------\f----\f--0r{qvs--<<楼层切割计算--0vs-qrsv{rq5b`RlPYV]SY\\\\_6----vs-5|yq]|vv|{;\b-I-sy||V{s|;-\v\v-|yq]|vv|{;\b-K-sy||V{s|;t6-\n------qvpnqH----\f--0r{qvs--rpA-qvssrP|y|-J-rpA5qvssr;to9-|}npv\b6H--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5rp@5=;=69-rp@5=;=69-rp@5=;=69-rp@5=;=66H--rp@-|nyRzvvr_nqvn{pr-J-rzvvrH--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--0v{pyqr-I{|znylsntzr{lortv{K--0v{pyqr-I{|znylsntzr{lzn}K--0v{pyqr-Irzvvrzn}lsntzr{K--0v{pyqr-Iyvtul}u|{tlsntzr{K--0v{pyqr-Iyvtulsntzr{lortv{K--<<-调整曝光值--vnqvn{pr-J-vnqvn{pr-7-r}|rH--0v{pyqr-Iyvtulsntzr{lzn}K--0v{pyqr-Iyvtulsntzr{lr{qK--0v{pyqr-In|zn}lsntzr{K--<<-减少方向光对模型的影响--rp@-|t|v{tYvtu-J-5rsyrprqYvtu;qvrpQvssr-7-=;?6-8----rsyrprqYvtu;v{qvrpQvssr-8----rsyrprqYvtu;v{qvrp`}rpyn-8----|nyRzvvr_nqvn{prH--<<-修复黑色面片的问题--vs-5|t|v{tYvtu;-K-=;=-\v\v-|t|v{tYvtu;t-K-=;=-\v\v-|t|v{tYvtu;o-K-=;=6-\n----tylSntP|y|-J-rpA5|t|v{tYvtu9-qvssrP|y|;n6H--\f-ryr-\n----tylSntP|y|-J-rpA5OYNPXlP\\Y\\_;\b\t9-qvssrP|y|;n6H--\f--rp@-}n{|=a|crr-J-5|yq]|vv|{;\b\t-:-}n{|=lznvh@j;\b\t6-7-zn@5}n{|=lznv6H--rp@-}n{|>a|crr-J-5|yq]|vv|{;\b\t-:-}n{|>lznvh@j;\b\t6-7-zn@5}n{|>lznv6H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-rrPor5}n{|=lzn}9-}n{|=a|crr6H--rpA-}n{|>P|y|-J-rrPor5}n{|>lzn}9-}n{|>a|crr6H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-rrPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr6;H----}n{|>P|y|;n-J->;=-:-rrPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr6;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv5}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv5}n{|P|y|9-}n{|>P|y|9-zn5=;=9-oynpx]|tr-:-?;=66H--0ryr----}n{|P|y|-J-zv5}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--0vs-qrsv{rq5b`Rl]N[\\lcVQR\\6----rp@-pnzrna|crr-J-|yq]|vv|{;\b\t-:-pnzrn]|vv|{H----rpA-zn}P||q-J-rpA5pnzrna|crr9->;=6-7-}n{|cvqr|lznvH----rp?--J-rp?5------=;B-8-zn}P||q;-<-zn}P||q;\t-<-}n{|cvqr|lv\tr;9------=;B-:-zn}P||q;\b-<-zn}P||q;\t-<-}n{|cvqr|lv\tr;\b----6H----rpA-vqr|P|y|-J-rr?Q5}n{|cvqr|lzn}9-6H----sy|n-znpu-J-5>;=-:-r}5=;=9-zn}P||q;\t66-7-5>;=-:-r}5=;B9-no5;-:-=;B666-7-5>;=-:-r}5=;B9-no5;\b-:-=;B666H----sy|n-ny}un-J-pynz}5=;=9->;=9-B;=-7-5>;=-:-pynz}5qvn{pr59-rp?5=;B9-=;B66-<-=;BB-9-=;=9->;=666H----}n{|P|y|-J-zv5}n{|P|y|9-vqr|P|y|9-znpu-7-ny}un-7-}n{|cvqr|lny}un6H--0r{qvs--0vs-qrsv{rq5b`Rl]N[\\l\\]NPVaf6----tylSntP|y|-J-zv5}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H----tylSntP|y|;n-J-|}npv\bH--0ryr----tylSntP|y|-J-rpA5tylSntP|y|;to9-|}npv\b6H----tylSntP|y|-J-zv5}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--0r{qvs\f"),ne=new s.WebGLCubeRenderTarget(1).texture;ne.name="EMPTY_TEXTURE";var ie=Object.assign({modelAlpha:new s.Uniform(0),progress:new s.Uniform(0),pano0_map:new s.Uniform(ne),pano0_luminanceMap:new s.Uniform(null),pano0_matrix:new s.Uniform(new s.Matrix4),pano1_map:new s.Uniform(ne),pano1_luminanceMap:new s.Uniform(null),pano1_matrix:new s.Uniform(new s.Matrix4),floorIndex:new s.Uniform(-1),floorInfo:new s.Uniform(null),clipperPlanesArray:new s.Uniform(new Float32Array),clipperPlanesTexture:new s.Uniform(null),clipperFloors:new s.Uniform([]),modelColorInfo:new s.Uniform(null),globalFloorInfo:new s.Uniform([])},{exposure:new s.Uniform(1),emissive:new s.Uniform(new s.Color(0)),emissiveMap:new s.Uniform(null),specular:new s.Uniform(new s.Color(1118481)),specularMap:new s.Uniform(null),normalMap:new s.Uniform(null),bumpMap:new s.Uniform(null),shininess:new s.Uniform(30)},s.UniformsUtils.clone(s.UniformsLib.common),s.UniformsUtils.clone(s.UniformsLib.lights)),oe=function(t){function e(e){void 0===e&&(e={});var r,n,i,o,a,u,l,c,h,f=this;f=t.call(this,{vertexShader:ee,fragmentShader:re,uniforms:s.UniformsUtils.clone(ie),defines:{USE_MAP:!0,USE_UV:!0,USE_LUMINANCE:!1,USE_PANO_OPACITY:!1,USE_BLACK_TRANSITION:!1,USE_PANO_VIDEO:!1,USE_ALL_COLOR:!1,USE_CLIPFLOOR:!1,USE_CUTER:!1,NUM_FLOOR_COUNT:0,NUM_CLIPPING_ARRAY_LENGTH:0,NUM_CLIPPING_BOX:0},blending:s.NoBlending,lights:!0})||this;var p=null,d=null;return Object.defineProperties(f,{pano0:{get:function(){return p},set:function(t){p=t,null===t?(this.uniforms.pano0_map.value=ne,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity()):(this.uniforms.pano0_map.value=t.map instanceof te?t.map.texture:t.map,this.uniforms.pano0_luminanceMap.value=t.luminanceMap instanceof te?t.luminanceMap.texture:t.luminanceMap,this.uniforms.pano0_matrix.value.copy(t.matrix));var e=null!==this.uniforms.pano0_luminanceMap.value&&null!==this.uniforms.pano1_luminanceMap.value;this.defines.USE_LUMINANCE!==e&&(this.defines.USE_LUMINANCE=e,this.needsUpdate=!0)}},pano1:{get:function(){return d},set:function(t){d=t,null===t?(this.uniforms.pano1_map.value=ne,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity()):(this.uniforms.pano1_map.value=t.map instanceof te?t.map.texture:t.map,this.uniforms.pano1_luminanceMap.value=t.luminanceMap instanceof te?t.luminanceMap.texture:t.luminanceMap,this.uniforms.pano1_matrix.value.copy(t.matrix));var e=null!==this.uniforms.pano0_luminanceMap.value&&null!==this.uniforms.pano1_luminanceMap.value;this.defines.USE_LUMINANCE!==e&&(this.defines.USE_LUMINANCE=e,this.needsUpdate=!0)}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(t){this.uniforms.modelAlpha.value=t}},progress:{get:function(){return this.uniforms.progress.value},set:function(t){this.uniforms.progress.value=t}},useBlackTransition:{get:function(){return this.defines.USE_BLACK_TRANSITION},set:function(t){this.defines.USE_BLACK_TRANSITION!==t&&(this.defines.USE_BLACK_TRANSITION=t,this.needsUpdate=!0)}},modelColorInfo:{get:function(){return this.uniforms.modelColorInfo.value},set:function(t){this.uniforms.modelColorInfo.value=t;var e=null!==t;this.defines.USE_ALL_COLOR!==e&&(this.defines.USE_ALL_COLOR=e,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t;var e=t<1?s.NormalBlending:s.NoBlending;e!==this.blending&&(this.blending=e,this.needsUpdate=!0)}},floorIndex:{get:function(){return this.uniforms.floorIndex.value},set:function(t){this.uniforms.floorIndex.value=t}},floorInfo:{get:function(){return this.uniforms.floorInfo.value},set:function(t){var e,r=this.defines.USE_CLIPFLOOR;t&&!t.equals(new s.Vector3(0,0,0))?(e=!0,this.uniforms.floorInfo.value=t):(e=!1,this.uniforms.floorInfo.value=null),r!==e&&(this.defines.USE_CLIPFLOOR=e,this.needsUpdate=!0)}},clippers:{get:function(){return this._clippers},set:function(t){this._clippers=t}},clipperPlanesArray:{get:function(){return this.uniforms.clipperPlanesArray.value},set:function(t){var e=!1;if(t instanceof Float32Array&&t.length>0&&t.length%6==0){var r=t.length/4;!0!==this.defines.USE_CUTER&&(this.defines.USE_CUTER=!0,e=!0),this.defines.NUM_CLIPPING_ARRAY_LENGTH!==r&&(this.defines.NUM_CLIPPING_ARRAY_LENGTH=r,e=!0),this.defines.NUM_CLIPPING_BOX!==r/6&&(this.defines.NUM_CLIPPING_BOX=r/6,e=!0),this.uniforms.clipperPlanesArray.value=t;var n=new s.DataTexture(t,r,1,s.RGBAFormat,s.FloatType);n.wrapS=s.ClampToEdgeWrapping,n.wrapT=s.ClampToEdgeWrapping,n.minFilter=s.NearestFilter,n.magFilter=s.NearestFilter,this.uniforms.clipperPlanesTexture.value&&this.uniforms.clipperPlanesTexture.value.dispose(),this.uniforms.clipperPlanesTexture.value=n}else!1!==this.defines.USE_CUTER&&(this.defines.USE_CUTER=!1,e=!0),0!==this.defines.NUM_CLIPPING_ARRAY_LENGTH&&(this.defines.NUM_CLIPPING_ARRAY_LENGTH=0,e=!0),0!==this.defines.NUM_CLIPPING_BOX&&(this.defines.NUM_CLIPPING_BOX=0,e=!0),this.uniforms.clipperPlanesArray.value=new Float32Array,this.uniforms.clipperPlanesTexture.value=null;e&&(this.needsUpdate=!0)}},clipperFloors:{get:function(){return this.uniforms.clipperFloors.value},set:function(t){this.uniforms.clipperFloors.value=t}},globalFloorInfo:{get:function(){return this.uniforms.globalFloorInfo.value},set:function(t){var e=this.defines.NUM_FLOOR_COUNT;t&&e!==t.length&&(this.defines.NUM_FLOOR_COUNT=t.length,this.uniforms.globalFloorInfo.value=t,this.needsUpdate=!0)}}}),f.pano0=null!==(r=e.pano0)&&void 0!==r?r:null,f.pano1=null!==(n=e.pano1)&&void 0!==n?n:null,f.modelAlpha=null!==(i=e.modelAlpha)&&void 0!==i?i:1,f.progress=null!==(o=e.progress)&&void 0!==o?o:0,f.useBlackTransition=null!==(a=e.useBlackTransition)&&void 0!==a&&a,f.modelColorInfo=null!==(u=e.modelColorInfo)&&void 0!==u?u:null,f.opacity=null!==(l=e.opacity)&&void 0!==l?l:1,f.originOpacity=1,f.floorIndex=null!==(c=e.floorIndex)&&void 0!==c?c:-1,f.floorInfo=null!==(h=e.floorInfo)&&void 0!==h?h:null,f.clippers=null,f.clipperPlanesArray=null,f.clipperFloors=null,f.globalFloorInfo=null,f}return st(e,t),e}(s.ShaderMaterial);function se(t){return new Promise((function(e,r){(/^https\:/.test(t)?u.default:a.default).get(t,(function(t){var n=[];t.on("data",(function(t){return n.push(t)})),t.on("end",(function(){e(Buffer.concat(n).buffer)})),t.on("error",(function(t){return r(t)}))})).on("error",(function(t){return r(t)}))}))}const ae=l.Reader,ue=l.util,le=l.roots["@REALSEE/FIVE:five/server/model/proto/pbm.proto"]||(l.roots["@REALSEE/FIVE:five/server/model/proto/pbm.proto"]={}),ce=le.Model=(()=>{function t(t){if(this.chunks=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.chunks=ue.emptyArray,t.prototype.createAt=ue.Long?ue.Long.fromBits(0,0,!0):0,t.prototype.description="",t.decode=function(t,e){t instanceof ae||(t=ae.create(t));let r=void 0===e?t.len:t.pos+e,n=new le.Model;for(;t.pos<r;){let e=t.uint32();switch(e>>>3){case 1:n.chunks&&n.chunks.length||(n.chunks=[]),n.chunks.push(le.Chunk.decode(t,t.uint32()));break;case 2:n.createAt=t.uint64();break;case 3:n.description=t.string();break;default:t.skipType(7&e)}}return n},t})();le.Chunk=(()=>{function t(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.vertices=null,t.prototype.faces=null,t.prototype.name="",t.prototype.texture="",t.decode=function(t,e){t instanceof ae||(t=ae.create(t));let r=void 0===e?t.len:t.pos+e,n=new le.Chunk;for(;t.pos<r;){let e=t.uint32();switch(e>>>3){case 1:n.vertices=le.Vertices.decode(t,t.uint32());break;case 2:n.faces=le.Faces.decode(t,t.uint32());break;case 3:n.name=t.string();break;case 4:n.texture=t.string();break;default:t.skipType(7&e)}}if(!n.hasOwnProperty("vertices"))throw ue.ProtocolError("missing required 'vertices'",{instance:n});if(!n.hasOwnProperty("faces"))throw ue.ProtocolError("missing required 'faces'",{instance:n});if(!n.hasOwnProperty("name"))throw ue.ProtocolError("missing required 'name'",{instance:n});return n},t})(),le.Vertices=(()=>{function t(t){if(this.xyz=[],this.uvs=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.xyz=ue.emptyArray,t.prototype.uvs=ue.emptyArray,t.decode=function(t,e){t instanceof ae||(t=ae.create(t));let r=void 0===e?t.len:t.pos+e,n=new le.Vertices;for(;t.pos<r;){let e=t.uint32();switch(e>>>3){case 1:if(n.xyz&&n.xyz.length||(n.xyz=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.xyz.push(t.float())}else n.xyz.push(t.float());break;case 2:if(n.uvs&&n.uvs.length||(n.uvs=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.uvs.push(t.float())}else n.uvs.push(t.float());break;default:t.skipType(7&e)}}return n},t})(),le.Faces=(()=>{function t(t){if(this.indices=[],this.normals=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.indices=ue.emptyArray,t.prototype.normals=ue.emptyArray,t.decode=function(t,e){t instanceof ae||(t=ae.create(t));let r=void 0===e?t.len:t.pos+e,n=new le.Faces;for(;t.pos<r;){let e=t.uint32();switch(e>>>3){case 1:if(n.indices&&n.indices.length||(n.indices=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.indices.push(t.uint32())}else n.indices.push(t.uint32());break;case 2:if(n.normals&&n.normals.length||(n.normals=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.normals.push(t.float())}else n.normals.push(t.float());break;default:t.skipType(7&e)}}return n},t})();var he=(new s.Matrix4).set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1).elements;function fe(t){var e=t.match(/(group|floor)-?(\d+)/);return e?parseInt(e[2],10):0}function pe(t){var e=t.match(/(chunk)-?(\d+)/);return e?parseInt(e[2],10):0}function de(t){var e,r;return 1e6*fe(t.name)+1e3*pe(t.name)+(e=t.name,(r=e.match(/(sub)-?(\d+)/))?parseInt(r[2],10):0)}function ve(t){for(var e=function(t){for(var e,r,n,i="number"==typeof t.createAt?t.createAt:null===t.createAt||void 0===t.createAt?0:t.createAt.toNumber(),o=null!==(e=t.description)&&void 0!==e?e:"",s=[],a=!0,u=0,l=t.chunks;u<l.length;u++)if(!(rt=l[u]).faces.normals||0===rt.faces.normals.length){a=!1;break}for(var c=t.chunks.sort((function(t,e){return de(t)-de(e)})),h=[],f=0,p=c;f<p.length;f++){var d=fe((rt=p[f]).name);h[d]||(h[d]=[]),h[d].push(rt)}for(var v=0;v<h.length;v++){var y=h[v];if(y)if(a){for(var g=0,m=0;m<y.length;m++)g+=(rt=y[m]).faces.indices.length;for(var b=3*g,x=2*g,w=3*g,S=new ArrayBuffer(4*b+4*x+4*w),A=new Float32Array(S,0,b),P=new Float32Array(S,4*b,x),E=new Float32Array(S,4*b+4*x,w),_=[],N=[1/0,1/0,1/0,-1/0,-1/0,-1/0],C=0,I=0;I<y.length;I++){var R=[1/0,1/0,1/0,-1/0,-1/0,-1/0],D=(rt=y[I]).vertices.xyz,z=rt.vertices.uvs,T=rt.faces.indices,O=rt.faces.normals,B=T.length;for(m=0;m<B;m++){var k=T[m],H=D[3*k],q=D[3*k+1],V=D[3*k+2],U=1/(he[3]*H+he[7]*q+he[11]*V+he[15]),M=(he[0]*H+he[4]*q+he[8]*V+he[12])*U,L=(he[1]*H+he[5]*q+he[9]*V+he[13])*U,K=(he[2]*H+he[6]*q+he[10]*V+he[14])*U;A[3*C+3*m]=M,A[3*C+3*m+1]=L,A[3*C+3*m+2]=K,P[2*C+2*m]=z[2*k],P[2*C+2*m+1]=z[2*k+1];var F=3*Math.floor(m/3),j=O[F],Y=O[F+1],Q=O[F+2],Z=1/(he[3]*j+he[7]*Y+he[11]*Q+he[15]),W=(he[0]*j+he[4]*Y+he[8]*Q+he[12])*Z,G=(he[1]*j+he[5]*Y+he[9]*Q+he[13])*Z,X=(he[2]*j+he[6]*Y+he[10]*Q+he[14])*Z;E[3*C+3*m]=W,E[3*C+3*m+1]=G,E[3*C+3*m+2]=X,M<R[0]&&(R[0]=M),L<R[1]&&(R[1]=L),K<R[2]&&(R[2]=K),M>R[3]&&(R[3]=M),L>R[4]&&(R[4]=L),K>R[5]&&(R[5]=K)}R[0]<N[0]&&(N[0]=R[0]),R[1]<N[1]&&(N[1]=R[1]),R[2]<N[2]&&(N[2]=R[2]),R[3]>N[3]&&(N[3]=R[3]),R[4]>N[4]&&(N[4]=R[4]),R[5]>N[5]&&(N[5]=R[5]),_.push({materialIndex:I,name:rt.name,chunkName:pe(rt.name),start:C,count:rt.faces.indices.length,texture:null!==(r=rt.texture)&&void 0!==r?r:void 0}),C+=B}s.push({createAt:i,description:o,floorIndex:v,vertices:A,uvs:P,indices:null,normals:E,groups:_,extents:N})}else{g=0;var J=0;for(m=0;m<y.length;m++)J+=(rt=y[m]).vertices.xyz.length/3,g+=rt.faces.indices.length;b=3*J,x=2*J,w=3*J;var $=g,tt=(S=new ArrayBuffer(4*b+4*x+4*w+4*$),A=new Float32Array(S,0,b),P=new Float32Array(S,4*b,x),E=new Float32Array(S,4*b+4*x,w),new Uint32Array(S,4*b+4*x+4*w,$)),et=(_=[],N=[1/0,1/0,1/0,-1/0,-1/0,-1/0],0);for(C=0,I=0;I<y.length;I++){R=[1/0,1/0,1/0,-1/0,-1/0,-1/0],D=(rt=y[I]).vertices.xyz,z=rt.vertices.uvs,T=rt.faces.indices;var rt,nt=D.length/3;for(B=T.length,m=0;m<nt;m++)H=D[3*m],q=D[3*m+1],V=D[3*m+2],U=1/(he[3]*H+he[7]*q+he[11]*V+he[15]),M=(he[0]*H+he[4]*q+he[8]*V+he[12])*U,L=(he[1]*H+he[5]*q+he[9]*V+he[13])*U,K=(he[2]*H+he[6]*q+he[10]*V+he[14])*U,A[3*C+3*m]=M,A[3*C+3*m+1]=L,A[3*C+3*m+2]=K,P[2*C+2*m]=z[2*m],P[2*C+2*m+1]=z[2*m+1],M<R[0]&&(R[0]=M),L<R[1]&&(R[1]=L),K<R[2]&&(R[2]=K),M>R[3]&&(R[3]=M),L>R[4]&&(R[4]=L),K>R[5]&&(R[5]=K);for(R[0]<N[0]&&(N[0]=R[0]),R[1]<N[1]&&(N[1]=R[1]),R[2]<N[2]&&(N[2]=R[2]),R[3]>N[3]&&(N[3]=R[3]),R[4]>N[4]&&(N[4]=R[4]),R[5]>N[5]&&(N[5]=R[5]),m=0;m<B;m++)tt[et+m]=C+T[m];_.push({materialIndex:I,name:rt.name,chunkName:pe(rt.name),start:et,count:rt.faces.indices.length,texture:null!==(n=rt.texture)&&void 0!==n?n:void 0}),C+=nt,et+=B}for(m=0;m<g;m+=3){var it,ot,st,at,ut,lt,ct,ht,ft,pt,dt,vt,yt,gt,mt,bt;j=void 0,Y=void 0,Q=void 0,it=3*tt[m],ot=3*tt[m+1],st=3*tt[m+2],at=A[it],ut=A[it+1],lt=A[it+2],ct=A[ot],ht=A[ot+1],ft=A[ot+2],pt=A[st],j=(vt=A[st+1]-ht)*(bt=lt-ft)-(yt=A[st+2]-ft)*(mt=ut-ht),Y=yt*(gt=at-ct)-(dt=pt-ct)*bt,Q=dt*mt-vt*gt,E[it]+=j,E[it+1]+=Y,E[it+2]+=Q,E[ot]+=j,E[ot+1]+=Y,E[ot+2]+=Q,E[st]+=j,E[st+1]+=Y,E[st+2]+=Q}s.push({createAt:i,description:o,floorIndex:v,vertices:A,uvs:P,indices:tt,normals:E,groups:_,extents:N})}}return s}(t),r=0,n="",i=[],o=0,a=e;o<a.length;o++){var u=a[o],l=u.createAt,c=u.description,h=u.floorIndex,f=u.vertices,p=u.uvs,d=u.indices,v=u.normals,y=u.groups,g=u.extents,m=new s.Box3;m.min.x=g[0],m.min.y=g[1],m.min.z=g[2],m.max.x=g[3],m.max.y=g[4],m.max.z=g[5];var b=new s.BufferGeometry;b.setAttribute("position",new s.BufferAttribute(f,3)),b.setAttribute("uv",new s.BufferAttribute(p,2)),b.setAttribute("normal",new s.BufferAttribute(v,3)),d&&b.setIndex(new s.BufferAttribute(d,1)),b.boundingBox=m,b.boundingSphere=m.getBoundingSphere(new s.Sphere);for(var x=0,w=y;x<w.length;x++){var S=w[x];b.addGroup(S.start,S.count,S.materialIndex)}for(var A=[],P=0,E=y;P<E.length;P++){S=E[P];var _=new oe;A.push(_),_.defines.USE_MAP=!1,_.uniforms.diffuse.value=new s.Color(16777215),_.uniforms.floorIndex.value=h}var N=new St(b,A);N.name="model_floor_"+h,N.floorIndex=h,N.userData.createAt=l,N.userData.description=c,r=l,n=c,i.push(N)}return{createAt:r,description:n,objects:i}}var ye={};function ge(t){return Array.prototype.reduce.call(t,(function(t,e,r){return t|e<<8*r}),0)}function me(t){for(var e=new Uint8Array(t),r=ge(e.slice(0,4)),n=[],i=[],o=4+4*r,s=0;s<r;s++)i[s]=ge(e.slice(4+4*s,8+4*s)),n[s]=s===r-1?e.subarray(o,o+i[s]):e.slice(o,o+i[s]),o+=i[s];return Promise.resolve(function(t){for(var e,r=[],n=t.length,i=function(n){var i={data:t[n],offset:0,readByte:function(){return this.data[this.offset++]}},o=i.data.length,s={data:[],offset:0,writeByte:function(t){var e=Math.floor(this.offset/o);this.data[e]||(this.data[e]=new Uint8Array(o)),this.data[e][this.offset%o]=t,this.offset++}};ye.decompressFile(i,s),e=new Uint8Array(s.offset);for(var a=0;a<s.offset;a++)e[a]=s.data[Math.floor(a/o)][a%o];r.push(e)},o=0;o<n;o++)i(o);return r}(n))}ye.OutWindow=function(){this._windowSize=0},ye.OutWindow.prototype.create=function(t){this._buffer&&this._windowSize===t||(this._buffer=[]),this._windowSize=t,this._pos=0,this._streamPos=0},ye.OutWindow.prototype.flush=function(){var t=this._pos-this._streamPos;if(0!==t){for(;t--;)this._stream.writeByte(this._buffer[this._streamPos++]);this._pos>=this._windowSize&&(this._pos=0),this._streamPos=this._pos}},ye.OutWindow.prototype.releaseStream=function(){this.flush(),this._stream=null},ye.OutWindow.prototype.setStream=function(t){this.releaseStream(),this._stream=t},ye.OutWindow.prototype.init=function(t){t||(this._streamPos=0,this._pos=0)},ye.OutWindow.prototype.copyBlock=function(t,e){var r=this._pos-t-1;for(r<0&&(r+=this._windowSize);e--;)r>=this._windowSize&&(r=0),this._buffer[this._pos++]=this._buffer[r++],this._pos>=this._windowSize&&this.flush()},ye.OutWindow.prototype.putByte=function(t){this._buffer[this._pos++]=t,this._pos>=this._windowSize&&this.flush()},ye.OutWindow.prototype.getByte=function(t){var e=this._pos-t-1;return e<0&&(e+=this._windowSize),this._buffer[e]},ye.RangeDecoder=function(){},ye.RangeDecoder.prototype.setStream=function(t){this._stream=t},ye.RangeDecoder.prototype.releaseStream=function(){this._stream=null},ye.RangeDecoder.prototype.init=function(){var t=5;for(this._code=0,this._range=-1;t--;)this._code=this._code<<8|this._stream.readByte()},ye.RangeDecoder.prototype.decodeDirectBits=function(t){for(var e,r=0,n=t;n--;)this._range>>>=1,e=this._code-this._range>>>31,this._code-=this._range&e-1,r=r<<1|1-e,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8);return r},ye.RangeDecoder.prototype.decodeBit=function(t,e){var r=t[e],n=(this._range>>>11)*r;return(2147483648^this._code)<(2147483648^n)?(this._range=n,t[e]+=2048-r>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),0):(this._range-=n,this._code-=n,t[e]-=r>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),1)},ye.initBitModels=function(t,e){for(;e--;)t[e]=1024},ye.BitTreeDecoder=function(t){this._models=[],this._numBitLevels=t},ye.BitTreeDecoder.prototype.init=function(){ye.initBitModels(this._models,1<<this._numBitLevels)},ye.BitTreeDecoder.prototype.decode=function(t){for(var e=1,r=this._numBitLevels;r--;)e=e<<1|t.decodeBit(this._models,e);return e-(1<<this._numBitLevels)},ye.BitTreeDecoder.prototype.reverseDecode=function(t){for(var e,r=1,n=0,i=0;i<this._numBitLevels;++i)r=r<<1|(e=t.decodeBit(this._models,r)),n|=e<<i;return n},ye.reverseDecode2=function(t,e,r,n){for(var i,o=1,s=0,a=0;a<n;++a)o=o<<1|(i=r.decodeBit(t,e+o)),s|=i<<a;return s},ye.LenDecoder=function(){this._choice=[],this._lowCoder=[],this._midCoder=[],this._highCoder=new ye.BitTreeDecoder(8),this._numPosStates=0},ye.LenDecoder.prototype.create=function(t){for(;this._numPosStates<t;++this._numPosStates)this._lowCoder[this._numPosStates]=new ye.BitTreeDecoder(3),this._midCoder[this._numPosStates]=new ye.BitTreeDecoder(3)},ye.LenDecoder.prototype.init=function(){var t=this._numPosStates;for(ye.initBitModels(this._choice,2);t--;)this._lowCoder[t].init(),this._midCoder[t].init();this._highCoder.init()},ye.LenDecoder.prototype.decode=function(t,e){return 0===t.decodeBit(this._choice,0)?this._lowCoder[e].decode(t):0===t.decodeBit(this._choice,1)?8+this._midCoder[e].decode(t):16+this._highCoder.decode(t)},ye.Decoder2=function(){this._decoders=[]},ye.Decoder2.prototype.init=function(){ye.initBitModels(this._decoders,768)},ye.Decoder2.prototype.decodeNormal=function(t){var e=1;do{e=e<<1|t.decodeBit(this._decoders,e)}while(e<256);return 255&e},ye.Decoder2.prototype.decodeWithMatchByte=function(t,e){var r,n,i=1;do{if(r=e>>7&1,e<<=1,i=i<<1|(n=t.decodeBit(this._decoders,(1+r<<8)+i)),r!==n){for(;i<256;)i=i<<1|t.decodeBit(this._decoders,i);break}}while(i<256);return 255&i},ye.LiteralDecoder=function(){},ye.LiteralDecoder.prototype.create=function(t,e){var r;if(!this._coders||this._numPrevBits!==e||this._numPosBits!==t)for(this._numPosBits=t,this._posMask=(1<<t)-1,this._numPrevBits=e,this._coders=[],r=1<<this._numPrevBits+this._numPosBits;r--;)this._coders[r]=new ye.Decoder2},ye.LiteralDecoder.prototype.init=function(){for(var t=1<<this._numPrevBits+this._numPosBits;t--;)this._coders[t].init()},ye.LiteralDecoder.prototype.getDecoder=function(t,e){return this._coders[((t&this._posMask)<<this._numPrevBits)+((255&e)>>>8-this._numPrevBits)]},ye.Decoder=function(){this._outWindow=new ye.OutWindow,this._rangeDecoder=new ye.RangeDecoder,this._isMatchDecoders=[],this._isRepDecoders=[],this._isRepG0Decoders=[],this._isRepG1Decoders=[],this._isRepG2Decoders=[],this._isRep0LongDecoders=[],this._posSlotDecoder=[],this._posDecoders=[],this._posAlignDecoder=new ye.BitTreeDecoder(4),this._lenDecoder=new ye.LenDecoder,this._repLenDecoder=new ye.LenDecoder,this._literalDecoder=new ye.LiteralDecoder,this._dictionarySize=-1,this._dictionarySizeCheck=-1,this._posSlotDecoder[0]=new ye.BitTreeDecoder(6),this._posSlotDecoder[1]=new ye.BitTreeDecoder(6),this._posSlotDecoder[2]=new ye.BitTreeDecoder(6),this._posSlotDecoder[3]=new ye.BitTreeDecoder(6)},ye.Decoder.prototype.setDictionarySize=function(t){return!(t<0)&&(this._dictionarySize!==t&&(this._dictionarySize=t,this._dictionarySizeCheck=Math.max(this._dictionarySize,1),this._outWindow.create(Math.max(this._dictionarySizeCheck,4096))),!0)},ye.Decoder.prototype.setLcLpPb=function(t,e,r){var n=1<<r;return!(t>8||e>4||r>4)&&(this._literalDecoder.create(e,t),this._lenDecoder.create(n),this._repLenDecoder.create(n),this._posStateMask=n-1,!0)},ye.Decoder.prototype.init=function(){var t=4;for(this._outWindow.init(!1),ye.initBitModels(this._isMatchDecoders,192),ye.initBitModels(this._isRep0LongDecoders,192),ye.initBitModels(this._isRepDecoders,12),ye.initBitModels(this._isRepG0Decoders,12),ye.initBitModels(this._isRepG1Decoders,12),ye.initBitModels(this._isRepG2Decoders,12),ye.initBitModels(this._posDecoders,114),this._literalDecoder.init();t--;)this._posSlotDecoder[t].init();this._lenDecoder.init(),this._repLenDecoder.init(),this._posAlignDecoder.init(),this._rangeDecoder.init()},ye.Decoder.prototype.decode=function(t,e,r){var n,i,o,s,a,u,l=0,c=0,h=0,f=0,p=0,d=0,v=0;for(this._rangeDecoder.setStream(t),this._outWindow.setStream(e),this.init();r<0||d<r;)if(n=d&this._posStateMask,0===this._rangeDecoder.decodeBit(this._isMatchDecoders,(l<<4)+n))i=this._literalDecoder.getDecoder(d++,v),v=l>=7?i.decodeWithMatchByte(this._rangeDecoder,this._outWindow.getByte(c)):i.decodeNormal(this._rangeDecoder),this._outWindow.putByte(v),l=l<4?0:l-(l<10?3:6);else{if(1===this._rangeDecoder.decodeBit(this._isRepDecoders,l))o=0,0===this._rangeDecoder.decodeBit(this._isRepG0Decoders,l)?0===this._rangeDecoder.decodeBit(this._isRep0LongDecoders,(l<<4)+n)&&(l=l<7?9:11,o=1):(0===this._rangeDecoder.decodeBit(this._isRepG1Decoders,l)?s=h:(0===this._rangeDecoder.decodeBit(this._isRepG2Decoders,l)?s=f:(s=p,p=f),f=h),h=c,c=s),0===o&&(o=2+this._repLenDecoder.decode(this._rangeDecoder,n),l=l<7?8:11);else if(p=f,f=h,h=c,o=2+this._lenDecoder.decode(this._rangeDecoder,n),l=l<7?7:10,(a=this._posSlotDecoder[o<=5?o-2:3].decode(this._rangeDecoder))>=4){if(c=(2|1&a)<<(u=(a>>1)-1),a<14)c+=ye.reverseDecode2(this._posDecoders,c-a-1,this._rangeDecoder,u);else if(c+=this._rangeDecoder.decodeDirectBits(u-4)<<4,(c+=this._posAlignDecoder.reverseDecode(this._rangeDecoder))<0){if(-1===c)break;return!1}}else c=a;if(c>=d||c>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(c,o),d+=o,v=this._outWindow.getByte(0)}return this._outWindow.flush(),this._outWindow.releaseStream(),this._rangeDecoder.releaseStream(),!0},ye.Decoder.prototype.setDecoderProperties=function(t){var e,r,n,i,o;return!(t.size<5)&&(r=(e=t.readByte())%9,n=(e=~~(e/9))%5,i=~~(e/5),!!this.setLcLpPb(r,n,i)&&(o=t.readByte(),o|=t.readByte()<<8,o|=t.readByte()<<16,o+=16777216*t.readByte(),this.setDictionarySize(o)))},ye.decompress=function(t,e,r,n){var i=new ye.Decoder;if(!i.setDecoderProperties(t))throw"Incorrect stream properties";if(!i.decode(e,r,n))throw"Error in data stream";return!0},ye.decompressFile=function(t,e){var r,n=new ye.Decoder;if(!n.setDecoderProperties(t))throw"Incorrect stream properties";if(r=t.readByte(),r|=t.readByte()<<8,r|=t.readByte()<<16,r+=16777216*t.readByte(),t.readByte(),t.readByte(),t.readByte(),t.readByte(),!n.decode(t,e,r))throw"Error in data stream";return!0};var be=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.floorIndex=0,e.needsRender=!0,e}return st(e,t),e.prototype.disposeGeometry=function(){this.traverse((function(t){t instanceof St&&t.geometry.dispose()}))},e}(s.Group);const xe=l.Reader,we=l.util,Se=l.roots["@REALSEE/FIVE:five/server/model/proto/dome.proto"]||(l.roots["@REALSEE/FIVE:five/server/model/proto/dome.proto"]={}),Ae=Se.Model=(()=>{function t(t){if(this.meshes=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.meshes=we.emptyArray,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Model;for(;t.pos<r;){let e=t.uint32();if(e>>>3==1)n.meshes&&n.meshes.length||(n.meshes=[]),n.meshes.push(Se.Mesh.decode(t,t.uint32()));else t.skipType(7&e)}return n},t})();Se.Mesh=(()=>{function t(t){if(this.chunks=[],this.matrix=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.name="",t.prototype.chunks=we.emptyArray,t.prototype.matrix=we.emptyArray,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Mesh;for(;t.pos<r;){let e=t.uint32();switch(e>>>3){case 1:n.name=t.string();break;case 2:n.chunks&&n.chunks.length||(n.chunks=[]),n.chunks.push(Se.Chunk.decode(t,t.uint32()));break;case 3:n.matrix&&n.matrix.length||(n.matrix=[]),n.matrix.push(Se.Matrix.decode(t,t.uint32()));break;default:t.skipType(7&e)}}if(!n.hasOwnProperty("name"))throw we.ProtocolError("missing required 'name'",{instance:n});return n},t})(),Se.Matrix=(()=>{function t(t){if(this.elements=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.elements=we.emptyArray,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Matrix;for(;t.pos<r;){let e=t.uint32();if(e>>>3==1)if(n.elements&&n.elements.length||(n.elements=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.elements.push(t.float())}else n.elements.push(t.float());else t.skipType(7&e)}return n},t})(),Se.Chunk=(()=>{function t(t){if(this.material=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.geometry=null,t.prototype.material=we.emptyArray,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Chunk;for(;t.pos<r;){let e=t.uint32();switch(e>>>3){case 2:n.geometry=Se.Geometry.decode(t,t.uint32());break;case 3:n.material&&n.material.length||(n.material=[]),n.material.push(Se.Material.decode(t,t.uint32()));break;default:t.skipType(7&e)}}if(!n.hasOwnProperty("geometry"))throw we.ProtocolError("missing required 'geometry'",{instance:n});return n},t})(),Se.Geometry=(()=>{function t(t){if(this.groups=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.position=null,t.prototype.uv=null,t.prototype.uv2=null,t.prototype.normal=null,t.prototype.groups=we.emptyArray,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Geometry;for(;t.pos<r;){let e=t.uint32();switch(e>>>3){case 1:n.position=Se.Position.decode(t,t.uint32());break;case 2:n.uv=Se.UV.decode(t,t.uint32());break;case 3:n.uv2=Se.UV.decode(t,t.uint32());break;case 4:n.normal=Se.Normal.decode(t,t.uint32());break;case 5:n.groups&&n.groups.length||(n.groups=[]),n.groups.push(Se.Group.decode(t,t.uint32()));break;default:t.skipType(7&e)}}if(!n.hasOwnProperty("position"))throw we.ProtocolError("missing required 'position'",{instance:n});if(!n.hasOwnProperty("normal"))throw we.ProtocolError("missing required 'normal'",{instance:n});return n},t})(),Se.Position=(()=>{function t(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.array=we.emptyArray,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Position;for(;t.pos<r;){let e=t.uint32();if(e>>>3==1)if(n.array&&n.array.length||(n.array=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.array.push(t.float())}else n.array.push(t.float());else t.skipType(7&e)}return n},t})(),Se.UV=(()=>{function t(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.array=we.emptyArray,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.UV;for(;t.pos<r;){let e=t.uint32();if(e>>>3==1)if(n.array&&n.array.length||(n.array=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.array.push(t.float())}else n.array.push(t.float());else t.skipType(7&e)}return n},t})(),Se.Normal=(()=>{function t(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.array=we.emptyArray,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Normal;for(;t.pos<r;){let e=t.uint32();if(e>>>3==1)if(n.array&&n.array.length||(n.array=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.array.push(t.float())}else n.array.push(t.float());else t.skipType(7&e)}return n},t})(),Se.Group=(()=>{function t(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.start=0,t.prototype.count=0,t.prototype.materialIndex=0,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Group;for(;t.pos<r;){let e=t.uint32();switch(e>>>3){case 1:n.start=t.uint32();break;case 2:n.count=t.uint32();break;case 3:n.materialIndex=t.uint32();break;default:t.skipType(7&e)}}if(!n.hasOwnProperty("start"))throw we.ProtocolError("missing required 'start'",{instance:n});if(!n.hasOwnProperty("count"))throw we.ProtocolError("missing required 'count'",{instance:n});if(!n.hasOwnProperty("materialIndex"))throw we.ProtocolError("missing required 'materialIndex'",{instance:n});return n},t})(),Se.Material=(()=>{function t(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.kd=null,t.prototype.ks=null,t.prototype.ke=null,t.prototype.mapkd="",t.prototype.mapks="",t.prototype.mapke="",t.prototype.norm="",t.prototype.mapbump="",t.prototype.bump="",t.prototype.mapd="",t.prototype.ns=0,t.prototype.d=0,t.prototype.tr=0,t.prototype.mapkdrepeat="",t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Material;for(;t.pos<r;){let e=t.uint32();switch(e>>>3){case 1:n.kd=Se.Color.decode(t,t.uint32());break;case 2:n.ks=Se.Color.decode(t,t.uint32());break;case 3:n.ke=Se.Color.decode(t,t.uint32());break;case 4:n.mapkd=t.string();break;case 5:n.mapks=t.string();break;case 6:n.mapke=t.string();break;case 7:n.norm=t.string();break;case 8:n.mapbump=t.string();break;case 9:n.bump=t.string();break;case 10:n.mapd=t.string();break;case 11:n.ns=t.float();break;case 12:n.d=t.float();break;case 13:n.tr=t.float();break;case 14:n.mapkdrepeat=t.string();break;default:t.skipType(7&e)}}return n},t})(),Se.Color=(()=>{function t(t){if(this.rgb=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.rgb=we.emptyArray,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Color;for(;t.pos<r;){let e=t.uint32();if(e>>>3==1)if(n.rgb&&n.rgb.length||(n.rgb=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.rgb.push(t.float())}else n.rgb.push(t.float());else t.skipType(7&e)}return n},t})();var Pe={};function Ee(t){var e,r=[];function n(t,e,r){var n=function(t){var e=t.position,r=t.normal,n=t.uv,i=t.uv2,o=t.groups,a=new s.BufferGeometry;return a.setAttribute("position",new s.BufferAttribute(new Float32Array(e.array),3)),r&&a.setAttribute("normal",new s.BufferAttribute(new Float32Array(r.array),3)),n&&a.setAttribute("uv",new s.BufferAttribute(new Float32Array(n.array),2)),i&&a.setAttribute("uv2",new s.BufferAttribute(new Float32Array(i.array),2)),o.forEach((function(t){return a.addGroup(t.start,t.count,t.materialIndex)})),a}(t);n.applyMatrix4(r);var i=new s.Vector3,o=new s.Quaternion,a=new s.Vector3;return r.decompose(i,o,a),a.x*a.y*a.z<0&&n.attributes.normal&&n.attributes.position&&n.attributes.uv&&function(t){for(var e=[0,0,0],r=0;r<t.attributes.normal.array.length/9;r++)e[0]=t.attributes.normal.array[9*r],e[1]=t.attributes.normal.array[9*r+1],e[2]=t.attributes.normal.array[9*r+2],t.attributes.normal.array[9*r]=t.attributes.normal.array[9*r+6],t.attributes.normal.array[9*r+1]=t.attributes.normal.array[9*r+7],t.attributes.normal.array[9*r+2]=t.attributes.normal.array[9*r+8],t.attributes.normal.array[9*r+6]=e[0],t.attributes.normal.array[9*r+7]=e[1],t.attributes.normal.array[9*r+8]=e[2];for(r=0;r<t.attributes.position.array.length/9;r++)e[0]=t.attributes.position.array[9*r],e[1]=t.attributes.position.array[9*r+1],e[2]=t.attributes.position.array[9*r+2],t.attributes.position.array[9*r]=t.attributes.position.array[9*r+6],t.attributes.position.array[9*r+1]=t.attributes.position.array[9*r+7],t.attributes.position.array[9*r+2]=t.attributes.position.array[9*r+8],t.attributes.position.array[9*r+6]=e[0],t.attributes.position.array[9*r+7]=e[1],t.attributes.position.array[9*r+8]=e[2];for(r=0;r<t.attributes.uv.array.length/6;r++)e[0]=t.attributes.uv.array[6*r],e[1]=t.attributes.uv.array[6*r+1],t.attributes.uv.array[6*r]=t.attributes.uv.array[6*r+4],t.attributes.uv.array[6*r+1]=t.attributes.uv.array[6*r+5],t.attributes.uv.array[6*r+4]=e[0],t.attributes.uv.array[6*r+5]=e[1];t.attributes.normal.needsUpdate=!0,t.attributes.position.needsUpdate=!0,t.attributes.uv.needsUpdate=!0}(n),new St(n)}return(e=t,Ae.decode(e).meshes).forEach((function(t){var e=t.name,i=t.chunks,o=t.matrix;"Ceiling"!==e&&"CeilingDrop"!==e&&o.map((function(t){var o,a=new s.Matrix4;if(a.elements=t.elements,1===i.length){var u=i[0],l=u.geometry;u.material;o=n(l,0,a)}else o=new be,i.forEach((function(t,e){var r=t.geometry,i=(t.material,n(r,0,a));i.name="chunk"+e,o.add(i)}));o.floorIndex=0,o.name=e,r.push(o)}))})),{objects:r,createAt:0,description:""}}function _e(){Object.keys(Pe).forEach((function(t){Pe[t].dispose(),delete Pe[t]}))}function Ne(t){return null==t}var Ce=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.needsRender=!0,e}return st(e,t),e.prototype.disposeGeometry=function(){this.traverse((function(t){t instanceof St&&t.geometry.dispose()}))},e}(s.Group),Ie=function(t,e){void 0===e&&(e=1e-4),e=Math.max(e,Number.EPSILON);for(var r={},n=t.getIndex(),i=t.getAttribute("position"),o=n?n.count:i.count,a=0,u=Object.keys(t.attributes),l={},c={},h=[],f=["getX","getY","getZ","getW"],p=0,d=u.length;p<d;p++){l[x=u[p]]=[],(P=t.morphAttributes[x])&&(c[x]=new Array(P.length).fill().map((function(){return[]})))}var v=Math.log10(1/e),y=Math.pow(10,v);for(p=0;p<o;p++){var g=n?n.getX(p):p,m="",b=0;for(d=u.length;b<d;b++)for(var x=u[b],w=(A=t.getAttribute(x)).itemSize,S=0;S<w;S++)m+="".concat(~~(A[f[S]](g)*y),",");if(m in r)h.push(r[m]);else{for(b=0,d=u.length;b<d;b++){x=u[b];var A=t.getAttribute(x),P=t.morphAttributes[x],E=(w=A.itemSize,l[x]),_=c[x];for(S=0;S<w;S++){var N=f[S];if(E.push(A[N](g)),P)for(var C=0,I=P.length;C<I;C++)_[C].push(P[C][N](g))}}r[m]=a,h.push(a),a++}}var R=t.clone();for(p=0,d=u.length;p<d;p++){x=u[p];var D=t.getAttribute(x),z=new D.array.constructor(l[x]);A=new s.BufferAttribute(z,D.itemSize,D.normalized);if(R.setAttribute(x,A),x in c)for(b=0;b<c[x].length;b++){var T=t.morphAttributes[x][b],O=(z=new T.array.constructor(c[x][b]),new s.BufferAttribute(z,T.itemSize,T.normalized));R.morphAttributes[x][b]=O}}return R.setIndex(h),R};function Re(t){var e;return new((e=s.Triangle).bind.apply(e,ut([void 0],t.map((function(t){return new s.Vector3(t.x,t.y,t.z)})),!1)))}var De={at3d:function(t){return Promise.resolve().then((function(){return se(t.file)})).then((function(t){return me(t)})).then((function(t){for(var e,r={chunks:[],createAt:void 0,description:void 0},n=0,i=t;n<i.length;n++){var o=i[n],s=ce.decode(o);s.chunks.length&&((e=r.chunks).push.apply(e,s.chunks),r.createAt=s.createAt,r.description=s.description)}return r})).then((function(t){return ve(t)}))},pbm:function(t){return Promise.resolve().then((function(){return se(t.file)})).then((function(t){var e=new Uint8Array(t);return ce.decode(e)})).then((function(t){return ve(t)}))},dome:function(t){return Promise.resolve().then((function(){return _e()})).then((function(){return se(t.file)})).then((function(t){return Ee(new Uint8Array(t))}))},domez:function(t){return Promise.resolve().then((function(){return _e()})).then((function(){return se(t.file)})).then((function(t){return me(t)})).then((function(t){var e=t.reduce((function(t,e){return t+e.length}),0),r=new Uint8Array(e),n=0;return t.forEach((function(t){r.set(t,n),n+=t.length})),r})).then((function(t){return Ee(t)}))}},ze=function(t){function e(){var e=t.call(this)||this;return e.empty=!1,e.name="model",e.loaded=!1,e.bvhs=[],e.bounding=new s.Box3,e.shownfloor=null,e.floorLength=0,e}return st(e,t),e.prototype.getEdges=function(t){var e;void 0===t&&(t=30/180*Math.PI);for(var r=Math.cos(t),n=[],i=0,o=this.children;i<o.length;i++){var a=o[i];if(a instanceof St){for(var u={},l=["a","b","c"],c=Ie(a.geometry),h=c.getAttribute("position").array,f=(null===(e=c.getIndex())||void 0===e?void 0:e.array)||[],p=[],d=[],v=0,y=h.length;v<y;v+=3)p.push(new s.Vector3(h[v],h[v+1],h[v+2]));for(v=0,y=f.length;v<y;v+=3){var g=f[v],m=f[v+1],b=f[v+2],x=(new s.Vector3).crossVectors(p[m].clone().sub(p[g]),p[b].clone().sub(p[g])).normalize();d.push({a:g,b:m,c:b,normal:x})}for(v=0,y=d.length;v<y;v++)for(var w=d[v],S=0;S<3;S++){var A=w[l[S]],P=w[l[(S+1)%3]],E=[Math.min(A,P),Math.max(A,P)];void 0===u[_=E[0]+"-"+E[1]]?u[_]={index1:E[0],index2:E[1],face1:v}:u[_].face2=v}for(var _ in u){var N=u[_];if(void 0===N.face2||d[N.face1].normal.dot(d[N.face2].normal)<=r){var C=p[N.index1],I=p[N.index2];n.push(new s.Line3(C,I))}}c.dispose(),p.length=0,d.length=0}}return n},e.prototype.hasFloors=function(){return this.hasFloors_()},e.prototype.hasFloors_=function(){var t=[];return this.traverse((function(e){e instanceof St&&(t[e.floorIndex]=!0)})),t.length},e.prototype.show=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=0!==t.length;this.shownfloor=r?t[0]:null,this.needsRender=!0},e.prototype.intersectRaycaster=function(t,e){var r=t.ray,n=r.origin,i=r.direction;if(Ne(e))if(Ne(this.shownfloor)){var o=this.hasFloors();e=[];for(var a=0;a<o;a++)e.push(a)}else e=[this.shownfloor];var u=[],l=[];Array.isArray(e)?l.push.apply(l,e):l.push(e);for(var c=function(e){var r=h.bvhs&&h.bvhs[e];if(r){var o=new pt(n.x,n.y,n.z),a=new pt(i.x,i.y,i.z),l=r.intersectRay(o,a,!0).map((function(t){var e=t.intersectionPoint,r=t.triangle,i=new s.Vector3(e.x,e.y,e.z);return{point:i,face:{normal:Re(r).getNormal(new s.Vector3)},distance:n.distanceTo(i)}}));l.length&&u.push.apply(u,l)}else{var c=[];h.traverse((function(t){t instanceof St&&t.floorIndex===e&&c.push(t)})),(l=t.intersectObjects(c).map((function(t){var e=t.face?{normal:t.face.normal}:void 0;return{point:t.point,face:e,distance:t.distance}}))).length&&u.push.apply(u,l)}},h=this,f=0,p=l;f<p.length;f++){c(p[f])}return u.filter((function(e){var r=e.distance;return r<=t.far&&r>=t.near})).sort((function(t,e){return t.distance-e.distance}))},e.prototype.buildBVH=function(){var t,e=[];this.traverse((function(t){t instanceof St&&(e[t.floorIndex]=e[t.floorIndex]||[],e[t.floorIndex].push(t.geometry))}));var r=e.map((function(t){var e=t.reduce((function(t,e){return t+(e.index?e.index.array.length:e.attributes.position.array.length)}),0),r=new Float32Array(3*e);return t.reduce((function(t,e){for(var n=e.index?e.index.array:null,i=e.attributes.position.array,o=n?n.length:i.length/3,s=0;s<o;s++){var a=3*(t+s),u=n?3*n[s]:3*s;r[a+0]=i[u+0],r[a+1]=i[u+1],r[a+2]=i[u+2]}return t+o}),0),new wt(r,10)}));this.bvhs.length=0,(t=this.bvhs).push.apply(t,r),this.bvhs.loaded=!0,this.emit("bvhLoaded")},e.prototype.load=function(t){var e=this;if(!0===this.loaded)throw new Error("model 只能被 load 一次");var r=De[function(t,e){void 0===e&&(e=[]);var r=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(t);if(r)for(var n=String(r[1]).trim().split("."),i=0,o=e;i<o.length;i++){var s=o[i];if(n.indexOf(s)>=0)return s}}(t.file,Object.keys(De))||""];if(!r)throw new Error("文件类型错误");return r(t).then((function(t){var r=t.createAt,n=t.description,i=t.objects;e.userData.createAt=r,e.userData.description=n,e.bounding.makeEmpty();for(var o=e.originModel=new Ce,s=0,a=i;s<a.length;s++){var u=a[s];u.traverse((function(t){if(t instanceof St){var r=t.geometry;r.boundingBox||r.computeBoundingBox(),r.boundingSphere||r.computeBoundingSphere(),e.bounding.union(r.boundingBox)}})),o.add(u)}e.add(o),e.floorLength=e.hasFloors_(),e.emit("geometryLoaded"),e.emit("loaded"),e.loaded=!0})).catch((function(t){return e.emit("error",t),Promise.reject(t)}))},e.prototype.dispose=function(){for(this.off(),this.disposeGeometry();this.children.length;)this.remove(this.children[0]);this.bvhs.length=0,delete this.bvhs.loaded},e}(be);Object.assign(ze.prototype,{on:Vt.prototype.on,once:Vt.prototype.once,off:Vt.prototype.off,emit:Vt.prototype.emit,hasListener:Vt.prototype.hasListener});function Te(t,e,r){return t<e?e:t>r?r:t}function Oe(t){return 0===t.indexOf("//")||/^[0-9a-z]+\:/i.test(t)}function Be(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=[];t=t.map((function(t){return(null!=t?t:"").trim()})).filter((function(t){return t.length>0&&!/^\/+$/.test(t)}));for(var n=0;n<t.length;n++){var i=0===n,o=n===t.length-1,s=t[n];i||(s=s.replace(/^\/+/,"")),o||(s=s.replace(/\/+$/,"")),r.push(s)}return r.join("/")}function ke(t,e){if(t===e)return!0;if(t&&e&&"object"==typeof t&&"object"==typeof e){if(t.constructor!==e.constructor)return!1;var r,n,i;if(Array.isArray(t)){if((r=t.length)!=e.length)return!1;for(n=r;0!=n--;)if(!ke(t[n],e[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if((r=(i=Object.keys(t)).length)!==Object.keys(e).length)return!1;for(n=r;0!=n--;)if(!Object.prototype.hasOwnProperty.call(e,i[n]))return!1;for(n=r;0!=n--;){var o=i[n];if(!ke(t[o],e[o]))return!1}return!0}return t!=t&&e!=e}function He(t){return"number"==typeof t}var qe=function(){return new Error("Invalid input.")},Ve=function(){return new Error("Invalid certificate.")},Ue=function(){return new Error("Invalid signature.")};function Me(t,e){void 0===e&&(e=!1);var r=typeof t;if("string"===r)return JSON.stringify(t);if(!0===t)return"true";if(!1===t)return"false";if(null===t)return"null";if(t instanceof Array){for(var n="[",i=t.length-1,o=0;o<i;o++)n+=Me(t[o],!1)+",";return i>-1&&(n+=Me(t[o],!1)),n+"]"}if(t instanceof Object){if("function"==typeof t.toJSON)return Me(t.toJSON(),e);var s=Object.keys(t).sort(),a=s.length;for(n="",o=0;o<a;){var u=s[o],l=Me(t[u],!0);void 0!==l&&(o&&""!==n&&(n+=","),n+=JSON.stringify(u)+":"+l),o++}return"{"+n+"}"}switch(r){case"function":case"undefined":return e?void 0:null;case"number":return 0;default:return isFinite(t)?t:null}}function Le(t){return String(Me(t,!1))}function Ke(t){var e,r,n;if(Array.isArray(t)){var i,o,s=void 0;if(t.length<=0)return qe();for(var a=function(e){var r=Ke(t[e]);if(r instanceof Error)return{value:r};if(s){if(s!==r.issuer)return{value:Ve()}}else s=r.issuer;i?r.expire.getTime()<i.getTime()&&(i=r.expire):i=r.expire,o=o?o.filter((function(t){return-1!==r.allowHosts.indexOf(t)})):r.allowHosts},u=0;u<t.length;u++){var l=a(u);if("object"==typeof l)return l.value}return Lt({issuer:s,expire:i,allowHosts:o})}var c=JSON.parse(t),h="undefined"!=typeof location?location.hostname:"",f=Date.now();if("object"!=typeof c)return qe();var p=new Date("string"==typeof c.expire_at&&/^\d+$/.test(c.expire_at)?Number(c.expire_at):c.expire_at),d=Array.isArray(c.allow_hosts)?c.allow_hosts:[];if(0===h.length||/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(h)||jt.filter((function(t){return Ft(t,h)})).length>0){var v=String(null!==(e=c.certificate)&&void 0!==e?e:"");if(v){var y=new $;return y.readCertPEM(v),Lt({issuer:y.getSubjectString(),expire:p,allowHosts:d})}return Lt({issuer:"none",expire:p,allowHosts:d})}var g=String(null!==(r=c.certificate)&&void 0!==r?r:"");if(!g)return Ve();var m=new $;m.readCertPEM(g);var b=String(null!==(n=c._signature)&&void 0!==n?n:"");if(!b)return Ue();var x=Le(function(t,e){for(var r={},n=0,i=Object.keys(t);n<i.length;n++){var o=i[n];-1===e.indexOf(o)&&(r[o]=t[o])}return r}(c,["_signature"]));return!1===function(t,e,r){var n=new $;if("string"==typeof r?n.readCertPEM(r):n.readCertHex(r.hex),!1===it(n))return!1;var i=new I;return i.readCertPubKeyHex(n.hex,6),!!i.verify(t,_(e))}(x,b,m)?Ue():f<p.getTime()?0===d.filter((function(t){return Ft(t,h)})).length?function(t){return new Error("host(".concat(JSON.stringify(t),") is not allowed."))}(h):Lt({issuer:m.getSubjectString(),expire:p,allowHosts:d}):function(t){return new Error("date(".concat(t.toString(),") expired."))}(p)}var Fe=new WeakMap,je=function(){function t(){this.name="",this.workCode="",this.expire=new Date,this.allowHosts=[],this.initial={mode:"Panorama",latitude:0,longitude:0,panoIndex:0,fov:80},this.observers=[],this.boundingBox=new s.Box3,this.issuer="none",this.raw={works:[""],options:""}}return t.prototype.toJSON=function(){return this.raw.works},t.parse=We,t}();function Ye(t){return null==t?"null":Array.isArray(t)?"array":"object"==typeof t?"dict":"value"}function Qe(t,e){var r=Ye(t),n=Ye(e);if("null"===n)return t;if("value"===n)return e;if(n!==r)return JSON.parse(JSON.stringify(e));if("array"===n)for(var i=0;i<e.length;i++)t[i]=Qe(t[i],e[i]);else if("dict"===n)for(var o in e)t[o]=Qe(t[o],e[o]);return t}function Ze(t,e,r){for(var n,i=JSON.stringify(e),o=[],a=0,u=[].concat(t);a<u.length;a++){var l=u[a];l instanceof je?o.push.apply(o,l.raw.works):"string"==typeof l?o.push(l):o.push(JSON.stringify(l))}var c=Ke(o);if(c instanceof Error)return c;e=JSON.parse(i),t=o.map((function(t){return JSON.parse(t)})).reduce((function(t,e){return Qe(t,e)}));var h=new je;if(c instanceof Error)return c;h.issuer=c.issuer,h.expire=c.expire,h.allowHosts=c.allowHosts,h.raw={works:o,options:i};var f=null!==(n=t.base_url)&&void 0!==n?n:"";f&&"/"!==f[f.length-1]&&(f+="/");var p=function(t,e){return 0===t.indexOf(e)},d=function(t,n){var i,o=t;if(!0===e.jsonp){o=t.replace(/([\?\#].*)?$/i,"");var s=tt("".concat(o)).slice(0,7);o="".concat(o,".").concat(s,".jsonp")}if(!0===e.shortPath){var a=o.replace(f,"").split("."),u=null!==(i=a.shift())&&void 0!==i?i:"",l=a.join(".");o=Be(f,tt(u))+(l?"."+l:"")}var c=o.replace(f,"");return e.baseURL&&(o=Be(e.baseURL,c)),r&&r(t,o,c,n),o},v=function(e,r){var n,i,o,s,a,u,l=e;if(!Oe(e)){var c=null!==(u=null!==(s=null!==(i=null===(n=t.panorama)||void 0===n?void 0:n.pano_high_cube_base_url)&&void 0!==i?i:null===(o=t.panorama)||void 0===o?void 0:o.pano_cube_base_url)&&void 0!==s?s:null===(a=t.panorama)||void 0===a?void 0:a.base_url)&&void 0!==u?u:"";c&&(c=Be(c,String(r))),l=Be(c,l)}return Oe(l)||(l=Be(f,l)),p(l,f)||console.warn("".concat(l," is not start with base_url(").concat(f,").")),d(l,"panorama")},y=function(t){var e=t;return Oe(e)||(e=Be(f,t)),p(e,f)||console.warn("".concat(e," is not start with base_url(").concat(f,").")),d(e,"model")},g=function(t,e){void 0===e&&(e="");var r=t;return Oe(r)||(r=Be(e,r)),Oe(r)||(r=Be(f,r)),p(r,f)||console.warn("".concat(r," is not start with base_url(").concat(f,").")),d(r,"texture")};if(c instanceof Error)return c;if(h.workCode=String(t.work_code||t.code||t.vr_code||t.workCode),h.name=String(t.name),c instanceof Error)return c;if(t.model){var m={bvh:!0,async:!1,textureBase:"",textures:[]};"boolean"==typeof e.modelBvh?m.bvh=e.modelBvh:"boolean"==typeof t.model.bvh?m.bvh=t.model.bvh:"boolean"==typeof t.bvh&&(m.bvh=t.bvh),t.model.file?m.file=y(t.model.file):t.model.file_url&&(m.file=y(t.model.file_url)),t.model.textureBase?m.textureBase=g("",t.model.textureBase):t.model.material_base_url?m.textureBase=g("",t.model.material_base_url):m.file&&(m.textureBase=m.file.split("/").slice(0,-1).join("/").replace("/model/","/materials/")),Array.isArray(t.model.textures)?m.textures=t.model.textures.map((function(e){var r,n;return g(e,null!==(n=null!==(r=t.model.textureBase)&&void 0!==r?r:t.model.material_base_url)&&void 0!==n?n:"")})):Array.isArray(t.model.material_textures)&&(m.textures=t.model.material_textures.map((function(e){var r,n;return g(e,null!==(n=null!==(r=t.model.textureBase)&&void 0!==r?r:t.model.material_base_url)&&void 0!==n?n:"")}))),t.model.tiles&&(m.tiles=t.model.tiles),m.file&&(h.model=m)}if(c instanceof Error)return c;if(t.observers&&Array.isArray(t.observers)){var b=[];t.panorama&&(Array.isArray(t.panorama)?b=t.panorama:Array.isArray(t.panorama.list)?b=t.panorama.list:Array.isArray(t.panorama.info)&&(b=t.panorama.info));for(var x=0;x<t.observers.length;x++){var w={},S=t.observers[x];if(!S)break;var A=b[x];if(!A)break;S=Object.assign({},S,A,{active:!1!==S.active&&!1!==A.active}),w.panoIndex=x,w.active=!1!==S.active,w.loadable=!0===S.loadable,w.images={up:v(S.images?S.images.up:S.up,x),down:v(S.images?S.images.down:S.down,x),right:v(S.images?S.images.right:S.right,x),left:v(S.images?S.images.left:S.left,x),front:v(S.images?S.images.front:S.front,x),back:v(S.images?S.images.back:S.back,x)};var P=S.images?S.images.depth:S.depth;P&&(w.images.depth=v(P,x));var E=S.images?S.images.luminance:S.luminance;E&&(w.images.luminance={up:v(E.up,x),down:v(E.down,x),right:v(E.right,x),left:v(E.left,x),front:v(E.front,x),back:v(E.back,x)});var _=S.images?S.images.tiles:S.tiles;if(_){for(var N=[],C=function(t){var e,r=t.match(/\/cube_(\d+)\//);if(r){var n=Number(r[1]);if(0==((e=n)&e-1)&&0!==e)return n}return!1},I=function(t,e){return t.replace(/\/cube_(\d+)\//,(function(){return"/cube_".concat(e,"/")}))},R=0,D=_;R<D.length;R++){var z=D[R];if("number"==typeof z){var T=z,O=C(w.images.front);if(!1===O)continue;if((M=Math.max(O,512*Math.pow(2,T)))>2048){var B=I(w.images.up,M),k=I(w.images.down,M),H=I(w.images.right,M),q=I(w.images.left,M),V=I(w.images.front,M),U=I(w.images.back,M);N.push({level:T,size:M,up:B,down:k,right:H,left:q,front:V,back:U})}else{B=w.images.up,k=w.images.down,H=w.images.right,q=w.images.left,V=w.images.front,U=w.images.back;N.push({level:T,size:M,up:B,down:k,right:H,left:q,front:V,back:U})}}else{var M;if("number"!=typeof(T=z.level))continue;if("number"!=typeof(M=z.size))continue;B=v(z.up,x),k=v(z.down,x),H=v(z.right,x),q=v(z.left,x),V=v(z.front,x),U=v(z.back,x);N.push({level:T,size:M,up:B,down:k,right:H,left:q,front:V,back:U})}}N.sort((function(t,e){return t.level-e.level})),w.images.tiles=N}if(S.position instanceof s.Vector3)w.position=S.position.clone();else{if(!Array.isArray(S.position))break;w.position=(new s.Vector3).fromArray(S.position)}if(S.standingPosition instanceof s.Vector3)w.standingPosition=S.standingPosition.clone();else if(Array.isArray(S.standingPosition))w.standingPosition=(new s.Vector3).fromArray(S.standingPosition);else if(S.standing_position instanceof s.Vector3)w.standingPosition=S.standing_position.clone();else{if(!Array.isArray(S.standing_position))break;w.standingPosition=(new s.Vector3).fromArray(S.standing_position)}if(S.quaternion instanceof s.Quaternion)w.quaternion=S.quaternion.clone();else if(Array.isArray(S.quaternion))w.quaternion=(new s.Quaternion).fromArray(S.quaternion);else{if(!S.quaternion)break;var L=S.quaternion,K=L.x,F=L.y,j=L.z,Y=L.w;w.quaternion=new s.Quaternion(K,F,j,Y)}if(Array.isArray(S.accessibleNodes)?w.accessibleNodes=S.accessibleNodes.slice():Array.isArray(S.accessible_nodes)&&(w.accessibleNodes=S.accessible_nodes.slice()),Array.isArray(S.visibleNodes)?w.visibleNodes=S.visibleNodes.slice():Array.isArray(S.visible_nodes)&&(w.visibleNodes=S.visible_nodes.slice()),He(S.floorIndex)?w.floorIndex=S.floorIndex:He(S.floor_index)?w.floorIndex=S.floor_index:w.floorIndex=0,S.video){var Q={};"string"==typeof S.video.source&&(Q.source=S.video.source),S.video.matrix instanceof s.Matrix4?Q.matrix=S.video.matrix.clone():Array.isArray(S.video.matrix)&&(Q.matrix=(new s.Matrix4).fromArray(S.video.matrix)),S.video.size instanceof s.Vector2?Q.size=S.video.size.clone():Array.isArray(S.video.size)&&(Q.size=(new s.Vector2).fromArray(S.video.size)),Q.source&&Q.matrix&&Q.size&&(w.video=Q)}h.observers[x]=w}}if(c instanceof Error)return c;for(var Z=0,W=h.observers;Z<W.length;Z++){if((w=W[Z]).accessibleNodes)w.accessibleNodes=w.accessibleNodes.filter((function(t){return t<h.observers.length}));else{w.accessibleNodes=[];for(var G=0;G<h.observers.length;G++)h.observers[G]!==w&&w.accessibleNodes.push(G)}if(w.visibleNodes)w.visibleNodes=w.visibleNodes.filter((function(t){return t<h.observers.length}));else{w.visibleNodes=[];for(G=0;G<h.observers.length;G++)h.observers[G]!==w&&w.visibleNodes.push(G)}}if(c instanceof Error)return c;if(t.initial)if("Floorplan"!==t.initial.mode&&"Topview"!==t.initial.mode&&"Panorama"!==t.initial.mode&&"VRPanorama"!==t.initial.mode&&"Model"!==t.initial.mode&&"DepthPanorama"!==t.initial.mode||(h.initial.mode=t.initial.mode),He(t.initial.latitude)&&(h.initial.latitude=t.initial.latitude),He(t.initial.longitude)?h.initial.longitude=t.initial.longitude:He(t.initial.heading)&&(h.initial.longitude=-(360*(t.initial.heading-.25)+90)/180*Math.PI),He(t.initial.fov)&&(h.initial.fov=t.initial.fov),He(t.initial.panoIndex)){var X=h.observers.length>0?h.observers.length-1:0;h.initial.panoIndex=Te(t.initial.panoIndex,0,X)}else if(He(t.initial.pano_index)){X=h.observers.length>0?h.observers.length-1:0;h.initial.panoIndex=Te(t.initial.pano_index,0,X)}else if(He(t.initial.pano)){X=h.observers.length>0?h.observers.length-1:0;h.initial.panoIndex=Te(t.initial.pano,0,X)}if(c instanceof Error)return c;h.boundingBox.makeEmpty();for(var J=0,$=h.observers;J<$.length;J++){w=$[J];h.boundingBox.expandByPoint(w.standingPosition),h.boundingBox.expandByPoint((new s.Vector3).fromArray([w.position.x,2*w.position.y-w.standingPosition.y,w.position.z]))}if(c instanceof Error)return c;var et=Lt(h);return Fe.set(et,{works:o,options:i}),et}function We(t,e,r){"string"==typeof t&&"{"===t.trim()[0]&&(t=JSON.parse(t));var n=Fe.get(t);if(n){if(e&&!ke(JSON.parse(n.options),e))throw new Error("[PARSE FAILED]: work is parsed with different options.");return t}var i=Ze(t,null!=e?e:{},r);if(i instanceof Error)throw new Error("[PARSE FAILED]: "+i.message+"\nError work input:\n"+JSON.stringify(t));return i}exports.BVH=wt,exports.BVHIntersect=xt,exports.BVHNode=dt,exports.BVHVector3=pt,exports.Model=ze,exports.PBMContainer=Ce,exports.PBMGroup=be,exports.PBMMesh=St,exports.Subscribe=Vt,exports.Work=je,exports.parseWork=We;
|
|
357
|
+
function(t,e){for(var r=t.toByteArray(),n=0;n<r.length&&0==r[n];)++n;if(r.length-n!=e-1||2!=r[n])return null;for(++n;0!=r[n];)if(++n>=r.length)return null;for(var i="";++n<r.length;){var o=255&r[n];o<128?i+=String.fromCharCode(o):o>191&&o<224?(i+=String.fromCharCode((31&o)<<6|63&r[n+1]),++n):(i+=String.fromCharCode((15&o)<<12|(63&r[n+1])<<6|63&r[n+2]),n+=2)}return i}(r,this.n.bitLength()+7>>3)},I.prototype.decryptOAEP=function(t,e,r){if(t.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var n=N(t,16),i=this.doPrivate(n);return null==i?null:function(t,e,r,n){var i=f.crypto.MessageDigest,o=f.crypto.Util,s=null;for(r||(r="sha1"),"string"==typeof r&&(s=i.getCanonicalAlgName(r),n=i.getHashLength(s),r=function(t){return T(o.hashHex(O(t),s))}),t=t.toByteArray(),a=0;a<t.length;a+=1)t[a]&=255;for(;t.length<e;)t.unshift(0);if((t=String.fromCharCode.apply(String,t)).length<2*n+2)throw"Cipher too short";var a,u=t.substr(1,n),l=t.substr(n+1),c=R(l,n,r),h=[];for(a=0;a<u.length;a+=1)h[a]=u.charCodeAt(a)^c.charCodeAt(a);var p=R(String.fromCharCode.apply(String,h),t.length-n,r),d=[];for(a=0;a<l.length;a+=1)d[a]=l.charCodeAt(a)^p.charCodeAt(a);if((d=String.fromCharCode.apply(String,d)).substr(0,n)!==r(""))throw"Hash mismatch";var v=(d=d.substr(n)).indexOf("");if((-1!=v?d.substr(0,v).lastIndexOf("\0"):-1)+1!=v)throw"Malformed data";return d.substr(v+1)}(i,this.n.bitLength()+7>>3,e,r)},void 0!==f.lang&&f.lang||(f.lang={}),f.lang.String=function(){},f.lang.String.isHex=function(t){return V(t)},f.lang.String.isMail=function(t){return null!==t.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};var F=function(t,e,r){return null==r&&(r="0"),t.length>=e?t:new Array(e-t.length+1).join(r)+t};void 0!==f.crypto&&f.crypto||(f.crypto={}),f.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:p.algo.MD5,sha1:p.algo.SHA1,sha224:p.algo.SHA224,sha256:p.algo.SHA256,sha384:p.algo.SHA384,sha512:p.algo.SHA512,ripemd160:p.algo.RIPEMD160},this.hashString=function(t,e){return new f.crypto.MessageDigest({alg:e}).digestString(t)},this.hashHex=function(t,e){return new f.crypto.MessageDigest({alg:e}).digestHex(t)},this.sha1=function(t){return this.hashString(t,"sha1")},this.sha256=function(t){return this.hashString(t,"sha256")},this.sha256Hex=function(t){return this.hashHex(t,"sha256")},this.sha512=function(t){return this.hashString(t,"sha512")},this.sha512Hex=function(t){return this.hashHex(t,"sha512")}},f.crypto.MessageDigest=function(t){this.setAlgAndProvider=function(t,e){if(null!==(t=f.crypto.MessageDigest.getCanonicalAlgName(t))&&void 0===e&&(e=f.crypto.Util.DEFAULTPROVIDER[t]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(t)&&"cryptojs"==e){try{this.md=f.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[t].create()}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=p.enc.Hex.parse(t);this.md.update(e)},this.digest=function(){return this.md.finalize().toString(p.enc.Hex)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}if(-1!=":sha256:".indexOf(t)&&"sjcl"==e){try{this.md=new sjcl.hash.sha256}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=sjcl.codec.hex.toBits(t);this.md.update(e)},this.digest=function(){var t=this.md.finalize();return sjcl.codec.hex.fromBits(t)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(t){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==t&&void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=f.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},f.crypto.MessageDigest.getCanonicalAlgName=function(t){return"string"==typeof t&&(t=(t=t.toLowerCase()).replace(/-/,"")),t},f.crypto.MessageDigest.getHashLength=function(t){var e=f.crypto.MessageDigest,r=e.getCanonicalAlgName(t);if(void 0===e.HASHLENGTH[r])throw"not supported algorithm: "+t;return e.HASHLENGTH[r]},f.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},f.crypto.Signature=function(t){var e=null;if(this._setAlgNames=function(){var t=this.algName.match(/^(.+)with(.+)$/);t&&(this.mdAlgName=t[1].toLowerCase(),this.pubkeyAlgName=t[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(t,e){for(var r="",n=e/4-t.length,i=0;i<n;i++)r+="0";return r+t},this.setAlgAndProvider=function(t,e){if(this._setAlgNames(),"cryptojs/jsrsa"!=e)throw new Error("provider not supported: "+e);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new f.crypto.MessageDigest({alg:this.mdAlgName})}catch(t){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+t)}this.init=function(t,e){var r=null;try{r=void 0===e?G.getKey(t):G.getKey(t,e)}catch(t){throw"init failed:"+t}if(!0===r.isPrivate)this.prvKey=r,this.state="SIGN";else{if(!0!==r.isPublic)throw"init failed.:"+r;this.pubKey=r,this.state="VERIFY"}},this.updateString=function(t){this.md.updateString(t)},this.updateHex=function(t){this.md.updateHex(t)},this.verify=function(t){if(this.sHashHex=this.md.digest(),this.pubKey instanceof I&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,t,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof I&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(t,e){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(t){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(t){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=t,void 0!==t&&(void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov?this.provName=f.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=t.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==t.psssaltlen&&(this.pssSaltLen=t.psssaltlen),void 0!==t.prvkeypem)){if(void 0!==t.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{e=G.getKey(t.prvkeypem);this.init(e)}catch(t){throw"fatal error to load pem private key: "+t}}},f.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040023":"secp521r1","2b81040022":"secp384r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}};var M,K,L,j,Y,Q,Z,W,G=(M=function(t,e,r){return K(p.AES,t,e,r)},K=function(t,e,r,n){var i=p.enc.Hex.parse(e),o=p.enc.Hex.parse(r),s=p.enc.Hex.parse(n),a={};a.key=o,a.iv=s,a.ciphertext=i;var u=t.decrypt(a,o,{iv:s});return p.enc.Hex.stringify(u)},L=function(t,e,r){return j(p.AES,t,e,r)},j=function(t,e,r,n){var i=p.enc.Hex.parse(e),o=p.enc.Hex.parse(r),s=p.enc.Hex.parse(n),a=t.encrypt(i,o,{iv:s}),u=p.enc.Hex.parse(a.toString());return p.enc.Base64.stringify(u)},Y={"AES-256-CBC":{proc:M,eproc:L,keylen:32,ivlen:16},"AES-192-CBC":{proc:M,eproc:L,keylen:24,ivlen:16},"AES-128-CBC":{proc:M,eproc:L,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(t,e,r){return K(p.TripleDES,t,e,r)},eproc:function(t,e,r){return j(p.TripleDES,t,e,r)},keylen:24,ivlen:8},"DES-CBC":{proc:function(t,e,r){return K(p.DES,t,e,r)},eproc:function(t,e,r){return j(p.DES,t,e,r)},keylen:8,ivlen:8}},Q=function(t){var e={},r=t.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));r&&(e.cipher=r[1],e.ivsalt=r[2]);var n=t.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));n&&(e.type=n[1]);var i=-1,o=0;-1!=t.indexOf("\r\n\r\n")&&(i=t.indexOf("\r\n\r\n"),o=2),-1!=t.indexOf("\n\n")&&(i=t.indexOf("\n\n"),o=1);var s=t.indexOf("-----END");if(-1!=i&&-1!=s){var a=t.substring(i+2*o,s-o);a=a.replace(/\s+/g,""),e.data=a}return e},Z=function(t,e,r){for(var n=r.substring(0,16),i=p.enc.Hex.parse(n),o=p.enc.Utf8.parse(e),s=Y[t].keylen+Y[t].ivlen,a="",u=null;;){var l=p.algo.MD5.create();if(null!=u&&l.update(u),l.update(o),l.update(i),u=l.finalize(),(a+=p.enc.Hex.stringify(u)).length>=2*s)break}var c={};return c.keyhex=a.substr(0,2*Y[t].keylen),c.ivhex=a.substr(2*Y[t].keylen,2*Y[t].ivlen),c},W=function(t,e,r,n){var i=p.enc.Base64.parse(t),o=p.enc.Hex.stringify(i);return(0,Y[e].proc)(o,r,n)},{version:"1.0.0",parsePKCS5PEM:function(t){return Q(t)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(t,e,r){return Z(t,e,r)},decryptKeyB64:function(t,e,r,n){return W(t,e,r,n)},getDecryptedKeyHex:function(t,e){var r=Q(t),n=r.cipher,i=r.ivsalt,o=r.data,s=Z(n,e,i).keyhex;return W(o,n,s,i)},getEncryptedPKCS5PEMFromPrvKeyHex:function(t,e,r,n,i){var o="";if(void 0!==n&&null!=n||(n="AES-256-CBC"),void 0===Y[n])throw"KEYUTIL unsupported algorithm: "+n;if(void 0===i||null==i){var s=function(t){var e=p.lib.WordArray.random(t);return p.enc.Hex.stringify(e)}(Y[n].ivlen);i=s.toUpperCase()}var a=function(t,e,r,n){return(0,Y[e].eproc)(t,r,n)}(e,n,Z(n,r,i).keyhex,i);return o="-----BEGIN "+t+" PRIVATE KEY-----\r\n",o+="Proc-Type: 4,ENCRYPTED\r\n",o+="DEK-Info: "+n+","+i+"\r\n",o+="\r\n",o+=a.replace(/(.{64})/g,"$1\r\n"),o+="\r\n-----END "+t+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(t){var e=J,r=e.getChildIdx,n=e.getV,i={},o=r(t,0);if(2!=o.length)throw"malformed format: SEQUENCE(0).items != 2: "+o.length;i.ciphertext=n(t,o[1]);var s=r(t,o[0]);if(2!=s.length)throw"malformed format: SEQUENCE(0.0).items != 2: "+s.length;if("2a864886f70d01050d"!=n(t,s[0]))throw"this only supports pkcs5PBES2";var a=r(t,s[1]);if(2!=s.length)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+a.length;var u=r(t,a[1]);if(2!=u.length)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+u.length;if("2a864886f70d0307"!=n(t,u[0]))throw"this only supports TripleDES";i.encryptionSchemeAlg="TripleDES",i.encryptionSchemeIV=n(t,u[1]);var l=r(t,a[0]);if(2!=l.length)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+l.length;if("2a864886f70d01050c"!=n(t,l[0]))throw"this only supports pkcs5PBKDF2";var c=r(t,l[1]);if(c.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+c.length;i.pbkdf2Salt=n(t,c[0]);var h=n(t,c[1]);try{i.pbkdf2Iter=parseInt(h,16)}catch(t){throw"malformed format pbkdf2Iter: "+h}return i},getPBKDF2KeyHexFromParam:function(t,e){var r=p.enc.Hex.parse(t.pbkdf2Salt),n=t.pbkdf2Iter,i=p.PBKDF2(e,r,{keySize:6,iterations:n});return p.enc.Hex.stringify(i)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(t,e){var r=q(t,"ENCRYPTED PRIVATE KEY"),n=this.parseHexOfEncryptedPKCS8(r),i=G.getPBKDF2KeyHexFromParam(n,e),o={};o.ciphertext=p.enc.Hex.parse(n.ciphertext);var s=p.enc.Hex.parse(i),a=p.enc.Hex.parse(n.encryptionSchemeIV),u=p.TripleDES.decrypt(o,s,{iv:a});return p.enc.Hex.stringify(u)},getKeyFromEncryptedPKCS8PEM:function(t,e){var r=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(t,e);return this.getKeyFromPlainPrivatePKCS8Hex(r)},parsePlainPrivatePKCS8Hex:function(t){var e=J,r=e.getChildIdx,n=e.getV,i={algparam:null};if("30"!=t.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var o=r(t,0);if(o.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=t.substr(o[1],2))throw new Error("malformed PKCS8 private key(code:003)");var s=r(t,o[1]);if(2!=s.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=t.substr(s[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(i.algoid=n(t,s[0]),"06"==t.substr(s[1],2)&&(i.algparam=n(t,s[1])),"04"!=t.substr(o[2],2))throw new Error("malformed PKCS8 private key(code:006)");return i.keyidx=e.getVidx(t,o[2]),i},getKeyFromPlainPrivatePKCS8PEM:function(t){var e=q(t,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(e)},getKeyFromPlainPrivatePKCS8Hex:function(t){var e,r=this.parsePlainPrivatePKCS8Hex(t);if("2a864886f70d010101"==r.algoid)e=new I;else if(f.crypto.DSA&&"2a8648ce380401"==r.algoid)e=new f.crypto.DSA;else{if(!f.crypto.ECDSA||"2a8648ce3d0201"!=r.algoid)throw"unsupported private key algorithm";e=new f.crypto.ECDSA}return e.readPKCS8PrvKeyHex(t),e},_getKeyFromPublicPKCS8Hex:function(t){var e,r=J.getVbyList(t,0,[0,0],"06");if("2a864886f70d010101"===r)e=new I;else if(f.crypto.DSA&&"2a8648ce380401"===r)e=new f.crypto.DSA;else{if(!f.crypto.ECDSA||"2a8648ce3d0201"!==r)throw"unsupported PKCS#8 public key hex";e=new f.crypto.ECDSA}return e.readPKCS8PubKeyHex(t),e},parsePublicRawRSAKeyHex:function(t){var e=J,r=e.getChildIdx,n=e.getV,i={};if("30"!=t.substr(0,2))throw"malformed RSA key(code:001)";var o=r(t,0);if(2!=o.length)throw"malformed RSA key(code:002)";if("02"!=t.substr(o[0],2))throw"malformed RSA key(code:003)";if(i.n=n(t,o[0]),"02"!=t.substr(o[1],2))throw"malformed RSA key(code:004)";return i.e=n(t,o[1]),i},parsePublicPKCS8Hex:function(t){var e=J,r=e.getChildIdx,n=e.getV,i={algparam:null},o=r(t,0);if(2!=o.length)throw"outer DERSequence shall have 2 elements: "+o.length;var s=o[0];if("30"!=t.substr(s,2))throw"malformed PKCS8 public key(code:001)";var a=r(t,s);if(2!=a.length)throw"malformed PKCS8 public key(code:002)";if("06"!=t.substr(a[0],2))throw"malformed PKCS8 public key(code:003)";if(i.algoid=n(t,a[0]),"06"==t.substr(a[1],2)?i.algparam=n(t,a[1]):"30"==t.substr(a[1],2)&&(i.algparam={},i.algparam.p=e.getVbyList(t,a[1],[0],"02"),i.algparam.q=e.getVbyList(t,a[1],[1],"02"),i.algparam.g=e.getVbyList(t,a[1],[2],"02")),"03"!=t.substr(o[1],2))throw"malformed PKCS8 public key(code:004)";return i.key=n(t,o[1]).substr(2),i}});G.getKey=function(t,e,r){var n=(m=J).getChildIdx;m.getV;var i=m.getVbyList,o=f.crypto,s=o.ECDSA,a=o.DSA,u=I,l=q,c=G;if(void 0!==u&&t instanceof u)return t;if(void 0!==s&&t instanceof s)return t;if(void 0!==a&&t instanceof a)return t;if(void 0!==t.curve&&void 0!==t.xy&&void 0===t.d)return new s({pub:t.xy,curve:t.curve});if(void 0!==t.curve&&void 0!==t.d)return new s({prv:t.d,curve:t.curve});if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(R=new u).setPublic(t.n,t.e),R;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.co&&void 0===t.qi)return(R=new u).setPrivateEx(t.n,t.e,t.d,t.p,t.q,t.dp,t.dq,t.co),R;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0===t.p)return(R=new u).setPrivate(t.n,t.e,t.d),R;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0===t.x)return(R=new a).setPublic(t.p,t.q,t.g,t.y),R;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0!==t.x)return(R=new a).setPrivate(t.p,t.q,t.g,t.y,t.x),R;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(R=new u).setPublic(D(t.n),D(t.e)),R;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.qi)return(R=new u).setPrivateEx(D(t.n),D(t.e),D(t.d),D(t.p),D(t.q),D(t.dp),D(t.dq),D(t.qi)),R;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d)return(R=new u).setPrivate(D(t.n),D(t.e),D(t.d)),R;if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0===t.d){var h=(C=new s({curve:t.crv})).ecparams.keylen/4,p="04"+("0000000000"+D(t.x)).slice(-h)+("0000000000"+D(t.y)).slice(-h);return C.setPublicKeyHex(p),C}if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0!==t.d){h=(C=new s({curve:t.crv})).ecparams.keylen/4,p="04"+("0000000000"+D(t.x)).slice(-h)+("0000000000"+D(t.y)).slice(-h);var v=("0000000000"+D(t.d)).slice(-h);return C.setPublicKeyHex(p),C.setPrivateKeyHex(v),C}if("pkcs5prv"===r){var y,g=t,m=J;if(9===(y=n(g,0)).length)(R=new u).readPKCS5PrvKeyHex(g);else if(6===y.length)(R=new a).readPKCS5PrvKeyHex(g);else{if(!(y.length>2&&"04"===g.substr(y[1],2)))throw"unsupported PKCS#1/5 hexadecimal key";(R=new s).readPKCS5PrvKeyHex(g)}return R}if("pkcs8prv"===r)return R=c.getKeyFromPlainPrivatePKCS8Hex(t);if("pkcs8pub"===r)return c._getKeyFromPublicPKCS8Hex(t);if("x509pub"===r)return $.getPublicKeyFromCertHex(t);if(-1!=t.indexOf("-END CERTIFICATE-",0)||-1!=t.indexOf("-END X509 CERTIFICATE-",0)||-1!=t.indexOf("-END TRUSTED CERTIFICATE-",0))return $.getPublicKeyFromCertPEM(t);if(-1!=t.indexOf("-END PUBLIC KEY-")){var b=q(t,"PUBLIC KEY");return c._getKeyFromPublicPKCS8Hex(b)}if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var x=l(t,"RSA PRIVATE KEY");return c.getKey(x,null,"pkcs5prv")}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var w=i(O=l(t,"DSA PRIVATE KEY"),0,[1],"02"),S=i(O,0,[2],"02"),A=i(O,0,[3],"02"),P=i(O,0,[4],"02"),E=i(O,0,[5],"02");return(R=new a).setPrivate(new d(w,16),new d(S,16),new d(A,16),new d(P,16),new d(E,16)),R}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){x=l(t,"EC PRIVATE KEY");return c.getKey(x,null,"pkcs5prv")}if(-1!=t.indexOf("-END PRIVATE KEY-"))return c.getKeyFromPlainPrivatePKCS8PEM(t);if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var _=c.getDecryptedKeyHex(t,e),N=new I;return N.readPKCS5PrvKeyHex(_),N}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var C,R=i(O=c.getDecryptedKeyHex(t,e),0,[1],"04"),z=i(O,0,[2,0],"06"),T=i(O,0,[3,0],"03").substr(2);if(void 0===f.crypto.OID.oidhex2name[z])throw"undefined OID(hex) in KJUR.crypto.OID: "+z;return(C=new s({curve:f.crypto.OID.oidhex2name[z]})).setPublicKeyHex(T),C.setPrivateKeyHex(R),C.isPublic=!1,C}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var O;w=i(O=c.getDecryptedKeyHex(t,e),0,[1],"02"),S=i(O,0,[2],"02"),A=i(O,0,[3],"02"),P=i(O,0,[4],"02"),E=i(O,0,[5],"02");return(R=new a).setPrivate(new d(w,16),new d(S,16),new d(A,16),new d(P,16),new d(E,16)),R}if(-1!=t.indexOf("-END ENCRYPTED PRIVATE KEY-"))return c.getKeyFromEncryptedPKCS8PEM(t,e);throw new Error("not supported argument")},void 0!==f.asn1&&f.asn1||(f.asn1={}),f.asn1.ASN1Util={},f.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",r=parseInt(t.substr(0,2),16),n=(e=Math.floor(r/40)+"."+r%40,""),i=2;i<t.length;i+=2){var o=("00000000"+parseInt(t.substr(i,2),16).toString(2)).slice(-8);if(n+=o.substr(1,7),"0"==o.substr(0,1))e=e+"."+new d(n,2).toString(10),n=""}return e};var J=new function(){};function X(t){for(var e in f.crypto.Util.DIGESTINFOHEAD){var r=f.crypto.Util.DIGESTINFOHEAD[e],n=r.length;if(t.substring(0,n)==r)return[e,t.substring(n)]}return[]}function $(t){var e,r=J,n=r.getChildIdx,i=r.getV,o=r.getTLV,s=r.getVbyList,a=r.getVbyListEx,u=r.getTLVbyList,l=r.getTLVbyListEx,c=r.getIdxbyList,h=r.getIdxbyListEx,p=r.getVidx,d=r.getInt,v=r.oidname,y=r.hextooidstr,g=q;try{e=f.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(t){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var t=u(this.hex,0,[0,0]);if("a0"==t.substr(0,2)){var e=u(t,0,[0]),r=d(e,0);if(r<0||2<r)throw new Error("malformed version field");return this.version=r+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return a(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var t=l(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(t)},this.getAlgorithmIdentifierName=function(t){for(var r in e)if(t===e[r])return r;return v(a(t,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return u(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return u(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var t=s(this.hex,0,[0,4+this.foffset,0]);return t=t.replace(/(..)/g,"%$1"),t=decodeURIComponent(t)},this.getNotAfter=function(){var t=s(this.hex,0,[0,4+this.foffset,1]);return t=t.replace(/(..)/g,"%$1"),t=decodeURIComponent(t)},this.getPublicKeyHex=function(){return r.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return c(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var t=this.getPublicKeyIdx();return c(this.hex,t,[1,0],"30")},this.getPublicKey=function(){return G.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var t=u(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(t)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(t){var e=this.getSignatureAlgorithmField(),r=this.getSignatureValueHex(),n=u(this.hex,0,[0],"30"),i=new f.crypto.Signature({alg:e});return i.init(t),i.updateHex(n),i.verify(r)},this.parseExt=function(t){var e,o,a;if(void 0===t){if(a=this.hex,3!==this.version)return-1;e=c(a,0,[0,7,0],"30"),o=n(a,e)}else{a=q(t);var u=c(a,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=i(a,u))return void(this.aExtInfo=new Array);e=c(a,0,[0,3,0,1,0],"30"),o=n(a,e),this.hex=a}this.aExtInfo=new Array;for(var l=0;l<o.length;l++){var h={critical:!1},f=0;3===n(a,o[l]).length&&(h.critical=!0,f=1),h.oid=r.hextooidstr(s(a,o[l],[0],"06"));var d=c(a,o[l],[1+f]);h.vidx=p(a,d),this.aExtInfo.push(h)}},this.getExtInfo=function(t){var e=this.aExtInfo,r=t;if(t.match(/^[0-9.]+$/)||(r=f.asn1.x509.OID.name2oid(t)),""!==r)for(var n=0;n<e.length;n++)if(e[n].oid===r)return e[n]},this.getExtBasicConstraints=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("basicConstraints");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:"basicConstraints"};if(e&&(n.critical=!0),"3000"===t)return n;if("30030101ff"===t)return n.cA=!0,n;if("30060101ff02"===t.substr(0,12)){var s=i(t,10),a=parseInt(s,16);return n.cA=!0,n.pathLen=a,n}throw new Error("hExtV parse error: "+t)},this.getExtKeyUsage=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("keyUsage");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:"keyUsage"};return e&&(n.critical=!0),n.names=this.getExtKeyUsageString(t).split(","),n},this.getExtKeyUsageBin=function(t){if(void 0===t){var e=this.getExtInfo("keyUsage");if(void 0===e)return"";t=o(this.hex,e.vidx)}if(8!=t.length&&10!=t.length)throw new Error("malformed key usage value: "+t);var r="000000000000000"+parseInt(t.substr(6),16).toString(2);return 8==t.length&&(r=r.slice(-8)),10==t.length&&(r=r.slice(-16)),""==(r=r.replace(/0+$/,""))&&(r="0"),r},this.getExtKeyUsageString=function(t){for(var e=this.getExtKeyUsageBin(t),r=new Array,n=0;n<e.length;n++)"1"==e.substr(n,1)&&r.push($.KEYUSAGE_NAME[n]);return r.join(",")},this.getExtSubjectKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("subjectKeyIdentifier");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:"subjectKeyIdentifier"};e&&(n.critical=!0);var s=i(t,0);return n.kid={hex:s},n},this.getExtAuthorityKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("authorityKeyIdentifier");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var s={extname:"authorityKeyIdentifier"};e&&(s.critical=!0);for(var a=n(t,0),u=0;u<a.length;u++){var l=t.substr(a[u],2);if("80"===l&&(s.kid={hex:i(t,a[u])}),"a1"===l){var c=o(t,a[u]),h=this.getGeneralNames(c);s.issuer=h[0].dn}"82"===l&&(s.sn={hex:i(t,a[u])})}return s},this.getExtExtKeyUsage=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("extKeyUsage");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var s={extname:"extKeyUsage",array:[]};e&&(s.critical=!0);for(var a=n(t,0),u=0;u<a.length;u++)s.array.push(v(i(t,a[u])));return s},this.getExtExtKeyUsageName=function(){var t=this.getExtInfo("extKeyUsage");if(void 0===t)return t;var e=new Array,r=o(this.hex,t.vidx);if(""===r)return e;for(var s=n(r,0),a=0;a<s.length;a++)e.push(v(i(r,s[a])));return e},this.getExtSubjectAltName=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("subjectAltName");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:"subjectAltName",array:[]};return e&&(n.critical=!0),n.array=this.getGeneralNames(t),n},this.getExtIssuerAltName=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("issuerAltName");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:"issuerAltName",array:[]};return e&&(n.critical=!0),n.array=this.getGeneralNames(t),n},this.getGeneralNames=function(t){for(var e=n(t,0),r=[],i=0;i<e.length;i++){var s=this.getGeneralName(o(t,e[i]));void 0!==s&&r.push(s)}return r},this.getGeneralName=function(t){var e=t.substr(0,2),r=i(t,0),n=T(r);return"81"==e?{rfc822:n}:"82"==e?{dns:n}:"86"==e?{uri:n}:"87"==e?{ip:k(r)}:"a4"==e?{dn:this.getX500Name(r)}:void 0},this.getExtSubjectAltName2=function(){var t,e,r,s=this.getExtInfo("subjectAltName");if(void 0===s)return s;for(var a=new Array,u=o(this.hex,s.vidx),l=n(u,0),c=0;c<l.length;c++)r=u.substr(l[c],2),t=i(u,l[c]),"81"===r&&(e=z(t),a.push(["MAIL",e])),"82"===r&&(e=z(t),a.push(["DNS",e])),"84"===r&&(e=$.hex2dn(t,0),a.push(["DN",e])),"86"===r&&(e=z(t),a.push(["URI",e])),"87"===r&&(e=k(t),a.push(["IP",e]));return a},this.getExtCRLDistributionPoints=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("cRLDistributionPoints");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var i={extname:"cRLDistributionPoints",array:[]};e&&(i.critical=!0);for(var s=n(t,0),a=0;a<s.length;a++){var u=o(t,s[a]);i.array.push(this.getDistributionPoint(u))}return i},this.getDistributionPoint=function(t){for(var e={},r=n(t,0),i=0;i<r.length;i++){var s=t.substr(r[i],2),a=o(t,r[i]);"a0"==s&&(e.dpname=this.getDistributionPointName(a))}return e},this.getDistributionPointName=function(t){for(var e={},r=n(t,0),i=0;i<r.length;i++){var s=t.substr(r[i],2),a=o(t,r[i]);"a0"==s&&(e.full=this.getGeneralNames(a))}return e},this.getExtCRLDistributionPointsURI=function(){var t=this.getExtInfo("cRLDistributionPoints");if(void 0===t)return t;for(var e=new Array,r=n(this.hex,t.vidx),i=0;i<r.length;i++)try{var o=z(s(this.hex,r[i],[0,0,0],"86"));e.push(o)}catch(t){}return e},this.getExtAIAInfo=function(){var t=this.getExtInfo("authorityInfoAccess");if(void 0===t)return t;for(var e={ocsp:[],caissuer:[]},r=n(this.hex,t.vidx),i=0;i<r.length;i++){var o=s(this.hex,r[i],[0],"06"),a=s(this.hex,r[i],[1],"86");"2b06010505073001"===o&&e.ocsp.push(z(a)),"2b06010505073002"===o&&e.caissuer.push(z(a))}return e},this.getExtAuthorityInfoAccess=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("authorityInfoAccess");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var i={extname:"authorityInfoAccess",array:[]};e&&(i.critical=!0);for(var u=n(t,0),l=0;l<u.length;l++){var c=a(t,u[l],[0],"06"),h=z(s(t,u[l],[1],"86"));if("2b06010505073001"==c)i.array.push({ocsp:h});else{if("2b06010505073002"!=c)throw new Error("unknown method: "+c);i.array.push({caissuer:h})}}return i},this.getExtCertificatePolicies=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("certificatePolicies");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var i={extname:"certificatePolicies",array:[]};e&&(i.critical=!0);for(var s=n(t,0),a=0;a<s.length;a++){var u=o(t,s[a]),l=this.getPolicyInformation(u);i.array.push(l)}return i},this.getPolicyInformation=function(t){var e={},r=s(t,0,[0],"06");e.policyoid=v(r);var i=h(t,0,[1],"30");if(-1!=i){e.array=[];for(var a=n(t,i),u=0;u<a.length;u++){var l=o(t,a[u]),c=this.getPolicyQualifierInfo(l);e.array.push(c)}}return e},this.getPolicyQualifierInfo=function(t){var e={},r=s(t,0,[0],"06");if("2b06010505070201"===r){var n=a(t,0,[1],"16");e.cps=T(n)}else if("2b06010505070202"===r){var i=u(t,0,[1],"30");e.unotice=this.getUserNotice(i)}return e},this.getUserNotice=function(t){for(var e={},r=n(t,0),i=0;i<r.length;i++){var s=o(t,r[i]);"30"!=s.substr(0,2)&&(e.exptext=this.getDisplayText(s))}return e},this.getDisplayText=function(t){var e={};return e.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[t.substr(0,2)],e.str=T(i(t,0)),e},this.getExtCRLNumber=function(t,e){var r={extname:"cRLNumber"};if(e&&(r.critical=!0),"02"==t.substr(0,2))return r.num={hex:i(t,0)},r;throw new Error("hExtV parse error: "+t)},this.getExtCRLReason=function(t,e){var r={extname:"cRLReason"};if(e&&(r.critical=!0),"0a"==t.substr(0,2))return r.code=parseInt(i(t,0),16),r;throw new Error("hExtV parse error: "+t)},this.getExtOcspNonce=function(t,e){var r={extname:"ocspNonce"};e&&(r.critical=!0);var n=i(t,0);return r.hex=n,r},this.getExtOcspNoCheck=function(t,e){var r={extname:"ocspNoCheck"};return e&&(r.critical=!0),r},this.getExtAdobeTimeStamp=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("adobeTimeStamp");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var i={extname:"adobeTimeStamp"};e&&(i.critical=!0);var s=n(t,0);if(s.length>1){var a=o(t,s[1]),u=this.getGeneralName(a);null!=u.uri&&(i.uri=u.uri)}if(s.length>2){var l=o(t,s[2]);"0101ff"==l&&(i.reqauth=!0),"010100"==l&&(i.reqauth=!1)}return i},this.getX500NameRule=function(t){for(var e=null,r=[],n=0;n<t.length;n++)for(var i=t[n],o=0;o<i.length;o++)r.push(i[o]);for(n=0;n<r.length;n++){var s=r[n],a=s.ds,u=s.value,l=s.type;if("prn"!=a&&"utf8"!=a&&"ia5"!=a)return"mixed";if("ia5"==a){if("CN"!=l)return"mixed";if(f.lang.String.isMail(u))continue;return"mixed"}if("C"==l){if("prn"==a)continue;return"mixed"}if(null==e)e=a;else if(e!==a)return"mixed"}return null==e?"prn":e},this.getX500Name=function(t){var e=this.getX500NameArray(t);return{array:e,str:this.dnarraytostr(e)}},this.getX500NameArray=function(t){for(var e=[],r=n(t,0),i=0;i<r.length;i++)e.push(this.getRDN(o(t,r[i])));return e},this.getRDN=function(t){for(var e=[],r=n(t,0),i=0;i<r.length;i++)e.push(this.getAttrTypeAndValue(o(t,r[i])));return e},this.getAttrTypeAndValue=function(t){var e={type:null,value:null,ds:null},r=n(t,0),i=s(t,r[0],[],"06"),o=s(t,r[1],[]),a=f.asn1.ASN1Util.oidHexToInt(i);return e.type=f.asn1.x509.OID.oid2atype(a),e.ds=this.HEX2STAG[t.substr(r[1],2)],"bmp"!=e.ds?e.value=z(o):e.value=function(t){return t.match(/.{4}/g).map((function(t){var e=parseInt(t.substr(0,2),16),r=parseInt(t.substr(2),16);if(0==e&r<128)return String.fromCharCode(r);if(e<8){var n=128|63&r;return z((192|(7&e)<<3|(192&r)>>6).toString(16)+n.toString(16))}n=128|(15&e)<<2|(192&r)>>6;var i=128|63&r;return z((224|(240&e)>>4).toString(16)+n.toString(16)+i.toString(16))})).join("")}(o),e},this.readCertPEM=function(t){this.readCertHex(g(t))},this.readCertHex=function(t){this.hex=t,this.getVersion();try{c(this.hex,0,[0,7],"a3"),this.parseExt()}catch(t){}},this.getParam=function(){var t={};return t.version=this.getVersion(),t.serial={hex:this.getSerialNumberHex()},t.sigalg=this.getSignatureAlgorithmField(),t.issuer=this.getIssuer(),t.notbefore=this.getNotBefore(),t.notafter=this.getNotAfter(),t.subject=this.getSubject(),t.sbjpubkey=B(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(t.ext=this.getExtParamArray()),t.sighex=this.getSignatureValueHex(),t},this.getExtParamArray=function(t){null==t&&(-1!=h(this.hex,0,[0,"[3]"])&&(t=l(this.hex,0,[0,"[3]",0],"30")));for(var e=[],r=n(t,0),i=0;i<r.length;i++){var s=o(t,r[i]),a=this.getExtParam(s);null!=a&&e.push(a)}return e},this.getExtParam=function(t){var e=n(t,0).length;if(2!=e&&3!=e)throw new Error("wrong number elements in Extension: "+e+" "+t);var r=y(s(t,0,[0],"06")),i=!1;3==e&&"0101ff"==u(t,0,[1])&&(i=!0);var o=u(t,0,[e-1,0]),a=void 0;if("2.5.29.14"==r?a=this.getExtSubjectKeyIdentifier(o,i):"2.5.29.15"==r?a=this.getExtKeyUsage(o,i):"2.5.29.17"==r?a=this.getExtSubjectAltName(o,i):"2.5.29.18"==r?a=this.getExtIssuerAltName(o,i):"2.5.29.19"==r?a=this.getExtBasicConstraints(o,i):"2.5.29.31"==r?a=this.getExtCRLDistributionPoints(o,i):"2.5.29.32"==r?a=this.getExtCertificatePolicies(o,i):"2.5.29.35"==r?a=this.getExtAuthorityKeyIdentifier(o,i):"2.5.29.37"==r?a=this.getExtExtKeyUsage(o,i):"1.3.6.1.5.5.7.1.1"==r?a=this.getExtAuthorityInfoAccess(o,i):"2.5.29.20"==r?a=this.getExtCRLNumber(o,i):"2.5.29.21"==r?a=this.getExtCRLReason(o,i):"1.3.6.1.5.5.7.48.1.2"==r?a=this.getExtOcspNonce(o,i):"1.3.6.1.5.5.7.48.1.5"==r?a=this.getExtOcspNoCheck(o,i):"1.2.840.113583.1.1.9.1"==r&&(a=this.getExtAdobeTimeStamp(o,i)),null!=a)return a;var l={extname:r,extn:o};return i&&(l.critical=!0),l},this.findExt=function(t,e){for(var r=0;r<t.length;r++)if(t[r].extname==e)return t[r];return null},this.dnarraytostr=function(t){return"/"+t.map((function(t){return function(t){return t.map((function(t){return function(t){return t.type+"="+t.value}(t).replace(/\+/,"\\+")})).join("+")}(t).replace(/\//,"\\/")})).join("/")},this.getInfo=function(){var t,e,r,n,i=function(t){for(var e="",r=t.array,n=0;n<r.length;n++){var i=r[n];if(e+=" policy oid: "+i.policyoid+"\n",void 0!==i.array)for(var o=0;o<i.array.length;o++){var s=i.array[o];void 0!==s.cps&&(e+=" cps: "+s.cps+"\n")}}return e},o=function(t){for(var e="",r=t.array,n=0;n<r.length;n++){var i=r[n];try{void 0!==i.dpname.full[0].uri&&(e+=" "+i.dpname.full[0].uri+"\n")}catch(t){}try{void 0!==i.dname.full[0].dn.hex&&(e+=" "+$.hex2dn(i.dpname.full[0].dn.hex)+"\n")}catch(t){}}return e},s=function(t){for(var e="",r=t.array,n=0;n<r.length;n++){var i=r[n];void 0!==i.caissuer&&(e+=" caissuer: "+i.caissuer+"\n"),void 0!==i.ocsp&&(e+=" ocsp: "+i.ocsp+"\n")}return e};if(t="Basic Fields\n",t+=" serial number: "+this.getSerialNumberHex()+"\n",t+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",t+=" issuer: "+this.getIssuerString()+"\n",t+=" notBefore: "+this.getNotBefore()+"\n",t+=" notAfter: "+this.getNotAfter()+"\n",t+=" subject: "+this.getSubjectString()+"\n",t+=" subject public key info: \n",t+=" key algorithm: "+(e=this.getPublicKey()).type+"\n","RSA"===e.type&&(t+=" n="+U(e.n.toString(16)).substr(0,16)+"...\n",t+=" e="+U(e.e.toString(16))+"\n"),null!=(r=this.aExtInfo)){t+="X509v3 Extensions:\n";for(var a=0;a<r.length;a++){var u=r[a],l=f.asn1.x509.OID.oid2name(u.oid);""===l&&(l=u.oid);var c="";if(!0===u.critical&&(c="CRITICAL"),t+=" "+l+" "+c+":\n","basicConstraints"===l){var h=this.getExtBasicConstraints();void 0===h.cA?t+=" {}\n":(t+=" cA=true",void 0!==h.pathLen&&(t+=", pathLen="+h.pathLen),t+="\n")}else if("keyUsage"===l)t+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"===l)t+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"===l){var p=this.getExtAuthorityKeyIdentifier();void 0!==p.kid&&(t+=" kid="+p.kid.hex+"\n")}else{if("extKeyUsage"===l)t+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n";else if("subjectAltName"===l)t+=" "+(n=this.getExtSubjectAltName(),JSON.stringify(n.array).replace(/[\[\]\{\}\"]/g,""))+"\n";else if("cRLDistributionPoints"===l)t+=o(this.getExtCRLDistributionPoints());else if("authorityInfoAccess"===l)t+=s(this.getExtAuthorityInfoAccess());else"certificatePolicies"===l&&(t+=i(this.getExtCertificatePolicies()))}}}return t+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n",t+="signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?this.readCertPEM(t):f.lang.String.isHex(t)&&this.readCertHex(t))}function tt(t){return p.SHA256(t).toString()}J.getLblen=function(t,e){if("8"!=t.substr(e+2,1))return 1;var r=parseInt(t.substr(e+3,1));return 0==r?-1:0<r&&r<10?r+1:-2},J.getL=function(t,e){var r=J.getLblen(t,e);return r<1?"":t.substr(e+2,2*r)},J.getVblen=function(t,e){var r;return""==(r=J.getL(t,e))?-1:("8"===r.substr(0,1)?new d(r.substr(2),16):new d(r,16)).intValue()},J.getVidx=function(t,e){var r=J.getLblen(t,e);return r<0?r:e+2*(r+1)},J.getV=function(t,e){var r=J.getVidx(t,e),n=J.getVblen(t,e);return t.substr(r,2*n)},J.getTLV=function(t,e){return t.substr(e,2)+J.getL(t,e)+J.getV(t,e)},J.getTLVblen=function(t,e){return 2+2*J.getLblen(t,e)+2*J.getVblen(t,e)},J.getNextSiblingIdx=function(t,e){return J.getVidx(t,e)+2*J.getVblen(t,e)},J.getChildIdx=function(t,e){var r,n,i,o=J,s=[];r=o.getVidx(t,e),n=2*o.getVblen(t,e),"03"==t.substr(e,2)&&(r+=2,n-=2),i=0;for(var a=r;i<=n;){var u=o.getTLVblen(t,a);if((i+=u)<=n&&s.push(a),a+=u,i>=n)break}return s},J.getNthChildIdx=function(t,e,r){return J.getChildIdx(t,e)[r]},J.getIdxbyList=function(t,e,r,n){var i,o,s=J;return 0==r.length?void 0!==n&&t.substr(e,2)!==n?-1:e:(i=r.shift())>=(o=s.getChildIdx(t,e)).length?-1:s.getIdxbyList(t,o[i],r,n)},J.getIdxbyListEx=function(t,e,r,n){var i,o,s=J;if(0==r.length)return void 0!==n&&t.substr(e,2)!==n?-1:e;i=r.shift(),o=s.getChildIdx(t,e);for(var a=0,u=0;u<o.length;u++){var l=t.substr(o[u],2);if("number"==typeof i&&!s.isContextTag(l)&&a==i||"string"==typeof i&&s.isContextTag(l,i))return s.getIdxbyListEx(t,o[u],r,n);s.isContextTag(l)||a++}return-1},J.getTLVbyList=function(t,e,r,n){var i=J,o=i.getIdxbyList(t,e,r,n);return-1==o||o>=t.length?null:i.getTLV(t,o)},J.getTLVbyListEx=function(t,e,r,n){var i=J,o=i.getIdxbyListEx(t,e,r,n);return-1==o?null:i.getTLV(t,o)},J.getVbyList=function(t,e,r,n,i){var o,s,a=J;return-1==(o=a.getIdxbyList(t,e,r,n))||o>=t.length?null:(s=a.getV(t,o),!0===i&&(s=s.substr(2)),s)},J.getVbyListEx=function(t,e,r,n,i){var o,s,a=J;return-1==(o=a.getIdxbyListEx(t,e,r,n))?null:(s=a.getV(t,o),"03"==t.substr(o,2)&&!1!==i&&(s=s.substr(2)),s)},J.getInt=function(t,e,r){null==r&&(r=-1);try{var n=t.substr(e,2);if("02"!=n&&"03"!=n)return r;var i=J.getV(t,e);return"02"==n?parseInt(i,16):function(t){try{var e=t.substr(0,2);if("00"==e)return parseInt(t.substr(2),16);var r=parseInt(e,16),n=t.substr(2),i=parseInt(n,16).toString(2);return"0"==i&&(i="00000000"),i=i.slice(0,0-r),parseInt(i,2)}catch(t){return-1}}(i)}catch(t){return r}},J.getOID=function(t,e,r){null==r&&(r=null);try{return"06"!=t.substr(e,2)?r:function(t){if(!V(t))return null;try{var e=[],r=t.substr(0,2),n=parseInt(r,16);e[0]=new String(Math.floor(n/40)),e[1]=new String(n%40);for(var i=t.substr(2),o=[],s=0;s<i.length/2;s++)o.push(parseInt(i.substr(2*s,2),16));var a=[],u="";for(s=0;s<o.length;s++)128&o[s]?u+=F((127&o[s]).toString(2),7):(u+=F((127&o[s]).toString(2),7),a.push(new String(parseInt(u,2))),u="");var l=e.join(".");return a.length>0&&(l=l+"."+a.join(".")),l}catch(t){return null}}(J.getV(t,e))}catch(t){return r}},J.getOIDName=function(t,e,r){null==r&&(r=null);try{var n=J.getOID(t,e,r);if(n==r)return r;var i=f.asn1.x509.OID.oid2name(n);return""==i?n:i}catch(t){return r}},J.getString=function(t,e,r){null==r&&(r=null);try{return T(J.getV(t,e))}catch(t){return r}},J.hextooidstr=function(t){var e=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},r=[],n=t.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var o=t.substr(2),s=[],a=0;a<o.length/2;a++)s.push(parseInt(o.substr(2*a,2),16));var u=[],l="";for(a=0;a<s.length;a++)128&s[a]?l+=e((127&s[a]).toString(2),7):(l+=e((127&s[a]).toString(2),7),u.push(new String(parseInt(l,2))),l="");var c=r.join(".");return u.length>0&&(c=c+"."+u.join(".")),c},J.isContextTag=function(t,e){var r,n;t=t.toLowerCase();try{r=parseInt(t,16)}catch(t){return-1}if(void 0===e)return 128==(192&r);try{return null!=e.match(/^\[[0-9]+\]$/)&&(!((n=parseInt(e.substr(1,e.length-1),10))>31)&&(128==(192&r)&&(31&r)==n))}catch(t){return!1}},J.isASN1HEX=function(t){var e=J;if(t.length%2==1)return!1;var r=e.getVblen(t,0),n=t.substr(0,2),i=e.getL(t,0);return t.length-n.length-i.length==2*r},J.checkStrictDER=function(t,e,r,n,i){var o=J;if(void 0===r){if("string"!=typeof t)throw new Error("not hex string");if(t=t.toLowerCase(),!f.lang.String.isHex(t))throw new Error("not hex string");r=t.length,i=(n=t.length/2)<128?1:Math.ceil(n.toString(16))+1}if(o.getL(t,e).length>2*i)throw new Error("L of TLV too long: idx="+e);var s=o.getVblen(t,e);if(s>n)throw new Error("value of L too long than hex: idx="+e);var a=o.getTLV(t,e),u=a.length-2-o.getL(t,e).length;if(u!==2*s)throw new Error("V string length and L's value not the same:"+u+"/"+2*s);if(0===e&&t.length!=a.length)throw new Error("total length and TLV length unmatch:"+t.length+"!="+a.length);var l=t.substr(e,2);if("02"===l){var c=o.getVidx(t,e);if("00"==t.substr(c,2)&&t.charCodeAt(c+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(l,16)){for(var h=o.getVblen(t,e),p=0,d=o.getChildIdx(t,e),v=0;v<d.length;v++){p+=o.getTLV(t,d[v]).length,o.checkStrictDER(t,d[v],r,n,i)}if(2*h!=p)throw new Error("sum of children's TLV length and L unmatch: "+2*h+"!="+p)}},J.oidname=function(t){var e=f.asn1;f.lang.String.isHex(t)&&(t=e.ASN1Util.oidHexToInt(t));var r=e.x509.OID.oid2name(t);return""===r&&(r=t),r},void 0!==f.asn1&&f.asn1||(f.asn1={}),void 0!==f.asn1.x509&&f.asn1.x509||(f.asn1.x509={}),f.asn1.x509.AlgorithmIdentifier={},f.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},f.asn1.x509.OID=new function(t){this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.name2oidList={sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1"},this.objCache={},this.name2obj=function(t){if(void 0!==this.objCache[t])return this.objCache[t];if(void 0===this.name2oidList[t])throw"Name of ObjectIdentifier not defined: "+t;var e=this.name2oidList[t],r=new f.asn1.DERObjectIdentifier({oid:e});return this.objCache[t]=r,r},this.atype2obj=function(t){if(void 0!==this.objCache[t])return this.objCache[t];var e;if(t.match(/^\d+\.\d+\.[0-9.]+$/))e=t;else if(void 0!==this.atype2oidList[t])e=this.atype2oidList[t];else{if(void 0===this.name2oidList[t])throw"AttributeType name undefined: "+t;e=this.name2oidList[t]}var r=new f.asn1.DERObjectIdentifier({oid:e});return this.objCache[t]=r,r}},f.asn1.x509.OID.oid2name=function(t){var e=f.asn1.x509.OID.name2oidList;for(var r in e)if(e[r]==t)return r;return""},f.asn1.x509.OID.oid2atype=function(t){var e=f.asn1.x509.OID.atype2oidList;for(var r in e)if(e[r]==t)return r;return t},f.asn1.x509.OID.name2oid=function(t){if(t.match(/^[0-9.]+$/))return t;var e=f.asn1.x509.OID.name2oidList;return void 0===e[t]?"":e[t]},I.getPosArrayOfChildrenFromHex=function(t){return J.getChildIdx(t,0)},I.getHexValueArrayOfChildrenFromHex=function(t){var e,r=J.getV,n=r(t,(e=I.getPosArrayOfChildrenFromHex(t))[0]),i=r(t,e[1]),o=r(t,e[2]),s=r(t,e[3]),a=r(t,e[4]),u=r(t,e[5]),l=r(t,e[6]),c=r(t,e[7]),h=r(t,e[8]);return(e=new Array).push(n,i,o,s,a,u,l,c,h),e},I.prototype.readPrivateKeyFromPEMString=function(t){var e=q(t),r=I.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])},I.prototype.readPKCS5PrvKeyHex=function(t){var e=I.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},I.prototype.readPKCS8PrvKeyHex=function(t){var e,r,n,i,o,s,a,u,l=J,c=l.getVbyListEx;if(!1===l.isASN1HEX(t))throw new Error("not ASN.1 hex string");try{e=c(t,0,[2,0,1],"02"),r=c(t,0,[2,0,2],"02"),n=c(t,0,[2,0,3],"02"),i=c(t,0,[2,0,4],"02"),o=c(t,0,[2,0,5],"02"),s=c(t,0,[2,0,6],"02"),a=c(t,0,[2,0,7],"02"),u=c(t,0,[2,0,8],"02")}catch(t){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(e,r,n,i,o,s,a,u)},I.prototype.readPKCS5PubKeyHex=function(t){var e=J,r=e.getV;if(!1===e.isASN1HEX(t))throw new Error("keyHex is not ASN.1 hex string");var n=e.getChildIdx(t,0);if(2!==n.length||"02"!==t.substr(n[0],2)||"02"!==t.substr(n[1],2))throw new Error("wrong hex for PKCS#5 public key");var i=r(t,n[0]),o=r(t,n[1]);this.setPublic(i,o)},I.prototype.readPKCS8PubKeyHex=function(t){var e=J;if(!1===e.isASN1HEX(t))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==e.getTLVbyListEx(t,0,[0,0]))throw new Error("not PKCS8 RSA public key");var r=e.getTLVbyListEx(t,0,[1,0]);this.readPKCS5PubKeyHex(r)},I.prototype.readCertPubKeyHex=function(t,e){var r,n;(r=new $).readCertHex(t),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)},I.prototype.verify=function(t,e){if(null==(e=e.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var r=N(e,16),n=this.n.bitLength();if(r.bitLength()>n)return!1;var i=this.doPublic(r).toString(16);if(i.length+3!=n/4)return!1;var o=X(i.replace(/^1f+00/,""));if(0==o.length)return!1;var s,a=o[0];return o[1]==(s=t,f.crypto.Util.hashString(s,a))},I.prototype.verifyWithMessageHash=function(t,e){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=N(e,16);if(r.bitLength()>this.n.bitLength())return 0;var n=X(this.doPublic(r).toString(16).replace(/^1f+00/,""));return 0!=n.length&&(n[0],n[1]==t)},I.prototype.verifyPSS=function(t,e,r,n){var i=function(t){return f.crypto.Util.hashHex(t,r)}(O(t));return void 0===n&&(n=-1),this.verifyWithMessageHashPSS(i,e,r,n)},I.prototype.verifyWithMessageHashPSS=function(t,e,r,n){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,o=new d(e,16),s=function(t){return f.crypto.Util.hashHex(t,r)},a=T(t),u=a.length,l=this.n.bitLength()-1,c=Math.ceil(l/8);if(-1===n||void 0===n)n=u;else if(-2===n)n=c-u-2;else if(n<-2)throw new Error("invalid salt length");if(c<u+n+2)throw new Error("data too long");var h=this.doPublic(o).toByteArray();for(i=0;i<h.length;i+=1)h[i]&=255;for(;h.length<c;)h.unshift(0);if(188!==h[c-1])throw new Error("encoded message does not end in 0xbc");var p=(h=String.fromCharCode.apply(String,h)).substr(0,c-u-1),v=h.substr(p.length,u),y=65280>>8*c-l&255;if(0!=(p.charCodeAt(0)&y))throw new Error("bits beyond keysize not zero");var g=pss_mgf1_str(v,p.length,s),m=[];for(i=0;i<p.length;i+=1)m[i]=p.charCodeAt(i)^g.charCodeAt(i);m[0]&=~y;var b=c-u-n-2;for(i=0;i<b;i+=1)if(0!==m[i])throw new Error("leftmost octets not zero");if(1!==m[b])throw new Error("0x01 marker not found");return v===T(s(O("\0\0\0\0\0\0\0\0"+a+String.fromCharCode.apply(String,m.slice(-n)))))},I.SALT_LEN_HLEN=-1,I.SALT_LEN_MAX=-2,I.SALT_LEN_RECOVER=-2,$.hex2dn=function(t,e){void 0===e&&(e=0);var r=new $;return J.getTLV(t,e),r.getX500Name(t).str},$.hex2rdn=function(t,e){if(void 0===e&&(e=0),"31"!==t.substr(e,2))throw new Error("malformed RDN");for(var r=new Array,n=J.getChildIdx(t,e),i=0;i<n.length;i++)r.push($.hex2attrTypeValue(t,n[i]));return(r=r.map((function(t){return t.replace("+","\\+")}))).join("+")},$.hex2attrTypeValue=function(t,e){var r=J,n=r.getV;if(void 0===e&&(e=0),"30"!==t.substr(e,2))throw new Error("malformed attribute type and value");var i=r.getChildIdx(t,e);2!==i.length||t.substr(i[0],2);var o=n(t,i[0]),s=f.asn1.ASN1Util.oidHexToInt(o);return f.asn1.x509.OID.oid2atype(s)+"="+T(n(t,i[1]))},$.getPublicKeyFromCertHex=function(t){var e=new $;return e.readCertHex(t),e.getPublicKey()},$.getPublicKeyFromCertPEM=function(t){var e=new $;return e.readCertPEM(t),e.getPublicKey()},$.getPublicKeyInfoPropOfCertPEM=function(t){var e,r,n=J.getVbyList,i={};return i.algparam=null,(e=new $).readCertPEM(t),r=e.getPublicKeyHex(),i.keyhex=n(r,0,[1],"03").substr(2),i.algoid=n(r,0,[0,0],"06"),"2a8648ce3d0201"===i.algoid&&(i.algparam=n(r,0,[0,1],"06")),i},$.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];var et,rt=[(et=new $,et.readCertPEM(function(){var t=113,e=126,r=0,n="";return arguments[r].split(n).map((function(n){return n.charCodeAt(r)>e?n:String.fromCharCode((n.charCodeAt(r)+t)%e)})).join(n)}(":::::ORTV[-PR_aVSVPNaR:::::ZVVS@\tPPNErtNVONtVWNZR}@]nU\0ZaZN=TP`\0T`Vo@Q^ROPbNZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tR]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaNrS=\\QN>Z\tN\\Q^B[QqnS=\b\\QN>Zwp\\Q^B[QqnZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tR]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaPPNvVQ^fWX|gVup[N^ROO^NQttV]NQPPNt|PttVONZU|C\b\\@@e^Xv{[vTtd8`nyO@ebN[bqx=ng?\tS^w@|XAz|qUTwfzn]Bu<qs_ae\\y<}u`eRAoE`_\\s\0r|b{rp_o<oC@o=x\bw_cUUZPApQevD\\FxFoFgE=<sq[p<coqyn>TEpP@aSC_YDU8\0|8TB?c>r\\=rp`pcwP}c\0PP_\\RS\\EPVSy8x`\0?R|NP\tP>}A^VP}Ex\bUZa=syDw}>Ya8wPp[pRnn\brU^dE8U?a\bcW|<FEbbupn^`ZNr\tsof[wA}e{\\z}w[YDQ|dt=wC\tNvbRZ@@U|ZAYpFsabCBB\\`wrqxsYW8uFyWdaWezeUeA_8VoVupvY[TD[OYdpO\bC[wX\\O]=[QRpV\0d`N\0RXt^Z}vEpdC=\bY?=V}?^W\bad|qN@Ww>@PycaqANE]asPcE^OB_VA?>wzeftac\tZ\tguf\bF]DCP?znNYf\tuaYu[`=b|v]Bp=RAS``\\PRDW]_`UXdUg=SuqwVFDeB\tD8{B>\\sPYbEU\tFQXz\0@`zsqgfD\0[WY\bPeZc}\t\0bx?Rfed}BUe|Uo\0y?\bsSXZOSBCgbFqf\0Bs?b?d<VE\\Zzns\\d@?dPvf\\{}_\0Sd[<q_YBY`Ffg=sY>{t<fu]xrFNtZONNTwbQO\\ZO=TN>bqQt^dOOaAFXw=\tPCVxsv?{`a\bvS8YQ[aNsOt[cU`ZRTQNdtOaAFXw=\tPCVxsv?{`a\bvS8YQ[aNZOt[cU_ZROaNQN^U<ZN=TP`\0T`Vo@Q^ROPbNNAVPN^P\0{y\0Bs\\8\0R[z]w??qZP?NpgdenSuvv?>|f_?UpYPcQ\\gCb8zxtSvsOQNg>[\\\0\bx\b_o@8\0g`Z<PyUE`8yu}\\g{@`s`zUgErRtve{YdCvoO@>WFDtABNp\0feUWszpQaEYNAc]^xB[@]BDAN8\b}XA=EnO}Pud8TA\t?yPrVv{\\>E]o`BO^RE^X[W[rEU?x\bf>V\tOUwY=>X[\\E`tW[8}VwpFBQcnrPF}yUtd8<Doe_\b[oOVUep@pYY\0cegY{r\t?\bAbq?ff8}UaXoN_D]_X_8yozYFT`N{`\\{zvu?\bDWT}=_<StX\tNx\0\b\t\0aT=c@ucnWfR[vf>RFxAFV}{N`dN^\\<eawBPxx}quT=|{T_R@Fp^Y<ZevRsWaZ]V\tCVrRVtAAc[\tQp|d|tqoQ=T|XX\t=u\\N8XNCx\\aU>wz\tX<e@Vc?dy\\|^FEq|=p`pBdF@bs^d<]vp\\^TZ\tP\bZ\b\\YNNSZ_\\w^|TsD8db\t_\tY\\o^Cw>Z\0x\\^aN]wWf\bA}\tC^d_{ZC@\by]gY@E\tBFY?OsaqbDcVgQbZeFc\tovtucxnq|<TnuyXRveYFOegCpAs{YTe|>bE<OXsSqCBWD_SVepfvCCUg]z\tZvQ[\0s|U>pFz\b=OwT``fNJJ:::::R[Q-PR_aVSVPNaR:::::")),et)];function nt(t,e){var r=t.getIssuerHex();if(r===t.getSubjectHex())return t.verifySignature(t.getPublicKey());var n=function(t,e){for(var r=0,n=e;r<n.length;r++){var i=n[r];if(i.getSubjectHex()===t)return i}}(r,e);return!!n&&(!1!==t.verifySignature(n.getPublicKey())&&nt(n,e))}function it(t){return t.getIssuerHex()!==t.getSubjectHex()&&nt(t,rt)}!function(t){var e=new $;"string"==typeof t?e.readCertPEM(t):e.readCertHex(t.hex);var r=it(e);rt.push(e)}(function(){var t=113,e=126,r=0,n="";return arguments[r].split(n).map((function(n){return n.charCodeAt(r)>e?n:String.fromCharCode((n.charCodeAt(r)+t)%e)})).join(n)}(":::::ORTV[-PR_aVSVPNaR:::::ZVVTU\tPPONrtNVONtVWNW=_SVw\tVE=ZN=TP`\0T`Vo@Q^ROPbNZVTSZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tR]ZN=TN>bRPtTn?bf?FZ_NQtfQc^^YQNq`gdSp?cyZ^P^fQc^^QQNWQ^aRvZPNTP`\0T`Vo@Q^RWN_fapzFqSFwfbOndSnzyuYz[oaNrS=\bZQNAZaN\\aZ\t[QSnS=\b[aNBZQZ\\aZ\t[QSnZVTaZ^P^fQc^^TRWQawR^ZNATN>bRPNU^zc}nzyg\tR^ZNATN>bROU^zc}nzyg\tRbZOVTN>bRPtYoTyuoz}}f`Bwo?=RQN\\Ot[cONZO>Wyfd\tgdbRaN]Ot[cONZZPRuupz_@feWyZ`bVfWX|gVup[N^xOSugnec|fdyndB{^T}fdB\0ndRf?FZVVPVwN[Otx\0uxvTF=ON^RSNN\\PNtENZVVPPtXPNtRN?=?]q[VD|{\\oyo`oOu}F\tSAe`tn[t\tu\b8^a]qx\bE_^ZN?[QC\0yuOpybY8r\\RPAS=8rUq\0E8>xean^e\bf]Y`XO}{C[Ur^?\0x[SRXvVQ\\CFr}QnAPRQFO=Yw\0_TePCOFV@|N>ROXcDrT<>bW<ssO?NOT{^s]uU\0gS\bBffsfE\0AfDyQEZR`]XBo|Qw}yYdwwTvOFcBndUz^\\{]\tb=^yQYSTQ`]\0?tR{WRUun\\\0bVe_E|VWWV|r\tAo\0\tF`fdzCnRtq\br\t\b8eBp=Z\\TRaadc}@Eub`quuNqAdF\0aUay{}x>tgVz`\t_YBFwu_q?egt8v[o\x008\twTQcrA\t<z{DZoEE^rZTrpaZQzqpBY]^zt8[bQv}yEWw\tXDYQB\0QB\bx_^X]|uEDtPf[n[r_bpB[bE}?ung|bnU|NYOoedY_tvXySZfYPdWV]OE^\bOFwA}<uXoO}_NDz8aonzWOfcv@?>snfqu@FeEx^\\\bVfuO`\\\0tSg]zDU}QrAT|\tOZV|OvpVD<sN@z`<_cSrNCW>?=Au?g_8v{|}}WF>Sr>QBxO\td_D}eBb?Uq^b\t[y}x]}{?P|BQtecTB[pQBW>|p|nfv\0zUxOO}WqwE=<PURZy@X8r\\]u=<pPNRNNn\\OtaO<ZOETPdPT`NTT8RVOQ^^`SuO`gdSp?cyVRg\bo?B=VR[OZO=TN>bqQt^dOO`FyWadZcAD\tpeXybcW@}Qf\\QNsOt[cU`ZRTQNdtOaAFXw=\tPCVxsv?{`a\bvS8YQ[aN]Ot[cU_ZONsEROaNQN^U<ZNTN>bqQ^RNVOOwN[Otx\0uxvTF=ON^SNN\\PNtRNrx\ta[}tP_g8FbD\0^\0qt<f88ufuN]^}]gp\bqYudF88Fas_Ef`\t?^x>X}esa{>\\r?eE]CC_cZ[vQs\t\t>gX[szONg=^pn=<e]nbSz\bZvac\b[w^nA_`vP|@8w[}nQobe=??oRYf{vpRxcC}yCd>8[NDx{Ne\\t8oou=guC>>gvb}ACd\t``Ntq\0yC[Q{|ynpNQqSqzxF<_PFDw<]Bnnu>F<XgU_Zf\\\\A=gu\\codOwQ]oQ<f>gv_pwozwC}xX>C`c]suEdfW?cbeo\b`BbyR@eFTUwSud=t]sS\\onc\tXSq\t{\0DvAVBbnTqEE[QzDyqF`bF}R=Q?VeDo<Vzb\0w}D}NZ\0t}^?OyFP\bVaVNrTNYqe?[NRYTSQby@yzWvT`wQo}y]c_WgxBYCy\tRNRg@NZCaaq8?`\t^`?ryD\t=obzw?E]Ou]n@>bVzqAQT?@_zo@}CxWVTUsAYdNd?{APQr8{P]]AZ>aR\0[D<z?Tr@`u@X|YDwd_<p<>zWE>]\0=X`\b@uucp|^_Qb@uZouTX^o\0\\{PCq{ug8^f[YQAWad8FNqxFQE?ZOo\t}RnO\bsQc\txyccn=nxvs>bDBf\b\bW\\TuTnvAO^U\0QXC>xx8FxRFf<tJ:::::R[Q-PR_aVSVPNaR:::::"));var ot=function(t,e){return ot=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},ot(t,e)};function st(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}ot(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var at=function(){return at=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},at.apply(this,arguments)};function ut(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))}var lt,ct,ht,ft,pt=function(){function t(t,e,r){this.x=t,this.y=e,this.z=r}return t.prototype.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},t.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},t.prototype.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},t.prototype.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},t.prototype.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},t.prototype.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},t.prototype.cross=function(t){var e=this.x,r=this.y,n=this.z;return this.x=r*t.z-n*t.y,this.y=n*t.x-e*t.z,this.z=e*t.y-r*t.x,this},t.prototype.crossVectors=function(t,e){var r=t.x,n=t.y,i=t.z,o=e.x,s=e.y,a=e.z;return this.x=n*a-i*s,this.y=i*o-r*a,this.z=r*s-n*o,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z)},t}(),dt=function(){function t(t,e,r,n){this.extents=t,this.startIndex=e,this.endIndex=r,this.level=n,this.node0=null,this.node1=null}return t.prototype.clearShapes=function(){this.startIndex=-1,this.endIndex=-1},t}(),vt=(lt=new pt(0,0,0),ct=new pt(0,0,0),ht=new pt(0,0,0),ft=new pt(0,0,0),function(t,e,r,n,i,o){ct.subVectors(e,t),ht.subVectors(r,t),ft.crossVectors(ct,ht);var s,a=i.dot(ft);if(a>0){if(o)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}lt.subVectors(n,t);var u=s*i.dot(ht.crossVectors(lt,ht));if(u<0)return null;var l=s*i.dot(ct.cross(lt));if(l<0)return null;if(u+l>a)return null;var c=-s*lt.dot(ft);if(c<0)return null;var h=c/a;return new pt(0,0,0).copy(i).multiplyScalar(h).add(n)}),yt=function(t,e){this.min=t,this.max=e};function gt(t,e,r){var n=new yt(0,0);e.x>=0?(n.min=(r.extents[0]-t.x)*e.x,n.max=(r.extents[3]-t.x)*e.x):(n.min=(r.extents[3]-t.x)*e.x,n.max=(r.extents[0]-t.x)*e.x);var i=new yt(0,0);if(e.y>=0?(i.min=(r.extents[1]-t.y)*e.y,i.max=(r.extents[4]-t.y)*e.y):(i.min=(r.extents[4]-t.y)*e.y,i.max=(r.extents[1]-t.y)*e.y),n.min>i.max||i.min>n.max)return!1;i.min>n.min&&(n.min=i.min),i.max<n.max&&(n.max=i.max);var o=new yt(0,0);return e.z>=0?(o.min=(r.extents[2]-t.z)*e.z,o.max=(r.extents[5]-t.z)*e.z):(o.min=(r.extents[5]-t.z)*e.z,o.max=(r.extents[2]-t.z)*e.z),!(n.min>o.max||o.min>n.max)&&(o.min>n.min&&(n.min=o.min),o.max<n.max&&(n.max=o.max),!(n.max<0))}var mt=[0,0,0,0,0,0];function bt(t,e,r,n,i){if(r>=n)return mt;var o,s=r,a=6*t[s],u=e[a],l=e[a+1],c=e[a+2],h=e[a+3],f=e[a+4],p=e[a+5];for(++s;s<n;s++)(o=e[a=6*t[s]])<u&&(u=o),(o=e[a+1])<l&&(l=o),(o=e[a+2])<c&&(c=o),(o=e[a+3])>h&&(h=o),(o=e[a+4])>f&&(f=o),(o=e[a+5])>p&&(p=o);return[u-i,l-i,c-i,h+i,f+i,p+i]}var xt=function(t,e,r){this.triangle=t,this.triangleIndex=e,this.intersectionPoint=r},wt=function(){function t(t,e){this.trianglesArray=t,this.maxTrianglesPerNode=e;var r,n,i,o,s,a,u=t.length/9,l=new Uint32Array(u),c=new Float32Array(6*u);r=o=t[0],n=s=t[1],i=a=t[2];for(var h=0,f=void 0,p=void 0,d=void 0,v=void 0,y=void 0,g=void 0,m=void 0,b=void 0,x=void 0;h<u;h++)b=6*h,f=v=t[x=9*h],(m=t[x+3])<f?f=m:m>v&&(v=m),(m=t[x+6])<f?f=m:m>v&&(v=m),f<r&&(r=f),v>o&&(o=v),p=y=t[x+1],(m=t[x+4])<p?p=m:m>y&&(y=m),(m=t[x+7])<p?p=m:m>y&&(y=m),p<n&&(n=p),y>s&&(s=y),d=g=t[x+2],(m=t[x+5])<d?d=m:m>g&&(g=m),(m=t[x+8])<d?d=m:m>g&&(g=m),d<i&&(i=d),g>a&&(a=g),l[h]=h,c[b]=f,c[b+1]=p,c[b+2]=d,c[b+3]=v,c[b+4]=y,c[b+5]=g;this.offsetArray=l,this.bboxArray=c,this.rootNode=new dt([r,n,i,o,s,a],0,u,0),this.nodesToSplit=[],u>this.maxTrianglesPerNode&&this.nodesToSplit.push(this.rootNode),this.splitNode()}return t.prototype.splitNode=function(){var t,e=this.offsetArray,r=this.bboxArray,n=this.maxTrianglesPerNode,i=this.nodesToSplit;function o(t){var o=t.startIndex,s=t.endIndex,a=t.extents,u=[0,1,2],l=[a[3]-a[0],a[4]-a[1],a[5]-a[2]];u.sort((function(t,e){return l[e]-l[t]}));for(var c=0;c<3;c++){for(var h=u[c],f=a[h]+a[h+3],p=o,d=s-1,v=null;p<d;)null===v?r[6*e[p]+h]+r[6*e[p]+h+3]<f?p++:v=e[p]:(r[6*e[d]+h]+r[6*e[d]+h+3]>=f||(e[p]=e[d],e[d]=v,v=null,p++),d--);if(!(p<=o)){var y=bt(e,r,o,p,1e-6),g=new dt(y,o,p,t.level+1);t.node0=g,g.endIndex-g.startIndex>n&&i.push(g);var m=bt(e,r,p,s,1e-6),b=new dt(m,p,s,t.level+1);return t.node1=b,b.endIndex-b.startIndex>n&&i.push(b),void t.clearShapes()}}}for(;t=i.shift();)o(t)},t.prototype.intersectRay=function(t,e,r){for(var n=[this.rootNode],i=[],o=[],s=new pt(1/e.x,1/e.y,1/e.z);n.length>0;){var a=n.pop();if(gt(t,s,a)){a.node0&&n.push(a.node0),a.node1&&n.push(a.node1);for(var u=a.startIndex;u<a.endIndex;u++)i.push(this.offsetArray[u])}}for(var l=new pt(0,0,0),c=new pt(0,0,0),h=new pt(0,0,0),f=new pt(t.x,t.y,t.z),p=new pt(e.x,e.y,e.z),d=(u=0,void 0),v=void 0;u<i.length;u++){v=9*(d=i[u]),l.set(this.trianglesArray[v],this.trianglesArray[v+1],this.trianglesArray[v+2]),c.set(this.trianglesArray[v+3],this.trianglesArray[v+3+1],this.trianglesArray[v+3+2]),h.set(this.trianglesArray[v+6],this.trianglesArray[v+6+1],this.trianglesArray[v+6+2]);var y=vt(l,c,h,f,p,r);if(y){var g=new xt([l.clone(),c.clone(),h.clone()],d,y);o.push(g)}}return o},t.prototype.dispose=function(){this.trianglesArray=new Float32Array,this.bboxArray=new Float32Array,this.offsetArray=new Uint32Array,this.rootNode=null,this.nodesToSplit.length=0},t}(),St=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.floorIndex=0,e.needsRender=!0,e}return st(e,t),e}(s.Mesh);function At(t,e){for(var r=0,n=t.children;r<n.length;r++){var i=n[r];!1!==e(i)&&At(i,e)}}function Pt(){}var Et=new s.BoxBufferGeometry(1,1,1,1,1);Et.deleteAttribute("uv"),Et.deleteAttribute("normal"),Et.groups=[],Et.scale(-1,1,1);var _t=new s.ShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\nvarying vec3 worldPosition;\nvoid main() {\n vec4 transform = vec4(position, 1.0);\n worldPosition = (modelMatrix * transform).xyz;\n gl_Position = projectionMatrix * modelViewMatrix * transform;\n}\n",fragmentShader:"\nuniform samplerCube map;\nvarying vec3 worldPosition;\nvoid main() {\n gl_FragColor = textureCube(map, worldPosition);\n}\n",depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:s.NoBlending,lights:!1,toneMapped:!1,fog:!1}),Nt=new s.Scene;Nt.matrixAutoUpdate=!1;var Ct,It=new s.Mesh(Et,_t);function Rt(t,e,r){_t.uniforms.map.value=t;var n=r.autoClear;r.autoClear=!1;var i=new s.CubeCamera(.1,2,e);i.matrixAutoUpdate=!1,i.update(r,Nt),r.autoClear=n,_t.uniforms.map.value=null}It.matrixAutoUpdate=!1,Nt.add(It);var Dt=null!==(Ct=Math.SQRT1_2)&&void 0!==Ct?Ct:Math.sqrt(2),zt={up:new s.Quaternion(Dt,0,0,Dt),down:new s.Quaternion(-Dt,0,0,Dt),left:new s.Quaternion(0,Dt,0,Dt),right:new s.Quaternion(0,-Dt,0,Dt),front:new s.Quaternion(0,0,0,1),back:new s.Quaternion(0,1,0,0)},Tt=function(){var t=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),e=new Float32Array([0,0,1,0,0,1,1,1]),r=new Uint8Array([0,1,2,1,3,2]),n=new s.BufferGeometry;return n.setAttribute("position",new s.BufferAttribute(t,3)),n.setAttribute("uv",new s.BufferAttribute(e,2)),n.setIndex(new s.BufferAttribute(r,1)),n}(),Ot=[];function Ht(t){t.uniforms.map.value=null,Ot.push(t)}var Bt,qt=(Bt="$$FIVE_EVENT$$","undefined"==typeof Symbol?"$Symbol<".concat(Bt,">$"):Symbol(Bt));function kt(t){return t[qt]||(t[qt]={}),t[qt]}var Vt=function(){function t(){}return t.prototype.hasListener=function(t){var e=kt(this);return e&&e[t]&&e[t].length>0},t.prototype.on=function(t,e,r){var n=this,i=kt(this);return i[t]||(i[t]=[]),i[t].push([e,r||!1]),function(){return n.off(t,e)}},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.off=function(t,e){if(void 0!==t){var r,n=kt(this);if(n[t]||(n[t]=[]),void 0!==e){for(var i=0;i<n[t].length&&n[t][i][0]!==e;i++);i<n[t].length&&n[t].splice(i,1)}else n[t].length=0}else(r=this)[qt]||delete r[qt]},t.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var n=!1,i=kt(this),o=i[t]||[],s=0,a=o.slice();s<a.length;s++){var u=a[s],l=u[0],c=u[1],h=void 0!==c&&c,f=l.apply(void 0,e);h&&this.off(t,l),!1===f&&(n=!0)}return n},t}(),Ut="undefined"!=typeof performance&&void 0!==performance.timing?performance.timing.navigationStart:Date.now(),Ft="undefined"!=typeof performance?function(){return Ut+performance.now()}:function(){return Date.now()};function Mt(t){Object.freeze(t);var e="function"==typeof t,r=Object.prototype.hasOwnProperty;return Object.getOwnPropertyNames(t).forEach((function(n){!r.call(t,n)||e&&("caller"===n||"callee"===n||"arguments"===n)||null===t[n]||"object"!=typeof t[n]&&"function"!=typeof t[n]||Object.isFrozen(t[n])||Mt(t[n])})),t}var Kt=/^([^.]+)(\.([^.]+))*$/;function Lt(t,e){return Kt.test(t)&&Kt.test(e)&&function(t,e){if("*"===t)return!0;var r=t.split(".").reverse(),n=e.split(".").reverse();if(r.length<=1)return t===e;for(var i=0;i<r.length;i++)if(r[i]!==n[i])return!1;return!0}(t,e)}var jt=Mt(JSON.parse(function(){var t=113,e=126,r=0,n="";return arguments[r].split(n).map((function(n){return n.charCodeAt(r)>e?n:String.fromCharCode((n.charCodeAt(r)+t)%e)})).join(n)}("h/y|pnyu|/9/xr;p|z/9/yvn{wvn;p|z/9/rnyrr;p|z/9/rnyrr;p{/9/rnyrr;w}/9/uv;p|z/9/uv;p{/9/ywpq{;p|z/9/rnyrr:pq{;p|z/9/rnyrr:pq{;p{/9/pnyp{|qr;vr/j")));!function(t){function e(e,r,n){return t.call(this,"[NETWORK]: request proxy error(type: ".concat(r,", reason: ").concat(n,"): ").concat(e))||this}st(e,t)}(Error),function(t){function e(e,r,n){var i=t.call(this,"[NETWORK]: response error(type: ".concat(r,", status: ").concat(n,"): ").concat(e))||this;return i.httpStatus=n,i}st(e,t)}(Error),function(t){function e(e,r){return t.call(this,"[NETWORK]: request abort(type: ".concat(r,"): ").concat(e))||this}st(e,t)}(Error),function(t){function e(e,r,n){return t.call(this,"[NETWORK]: request timeout(type: ".concat(r,", timeout: ").concat(n,"ms): ").concat(e))||this}st(e,t)}(Error),function(t){function e(e,r,n){return t.call(this,"[NETWORK]: request forbidden(type: ".concat(r,", reason: ").concat(n,"): ").concat(e))||this}st(e,t)}(Error),function(t){function e(){return null!==t&&t.apply(this,arguments)||this}st(e,t)}(Vt);var Yt=function(){if("undefined"!=typeof window){var t=window;return t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(t){return setTimeout(t,16)}}return function(t){return setTimeout(t,16)}}(),Qt=16,Zt=function(){function t(){this.frames=[],this.stoped=!1,this.time=Ft(),this.context=null,this.loop=this.loop.bind(this),this.loop()}return Object.defineProperty(t,"shared",{get:function(){return this.sharedInstance||(this.sharedInstance=new t),this.sharedInstance},enumerable:!1,configurable:!0}),t.getFrameTime=function(){return Qt},t.prototype.loop=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!this.stoped){var r=Ft(),n=r-this.time;this.time=r;var i=[];Qt=n;for(var o=0,s=this.frames;o<s.length;o++){var a=s[o];if(a.delay>0)a.delay=a.delay-1;else{try{a.callback.apply(a,ut([r,n],t,!1))}catch(t){console.error(t)}a.once&&i.push(a)}}i.length>0&&(this.frames=this.frames.filter((function(t){return-1===i.indexOf(t)}))),this.requestAnimationFrame(this.loop)}},t.prototype.setContext=function(t){this.cancelAnimationFrame(this.requestId),this.context=t,this.requestId=this.requestAnimationFrame(this.loop)},t.prototype.getContext=function(){return this.context},t.prototype.requestAnimationFrame=function(t){return this.context?this.context.requestAnimationFrame(t):Yt(t)},t.prototype.cancelAnimationFrame=function(t){this.context?this.context.cancelAnimationFrame(t):function(t){var e;if("undefined"!=typeof window){var r=window;e=r.cancelAnimationFrame||r.mozCancelAnimationFrame||r.webkitCancelAnimationFrame||r.msCancelAnimationFrame||function(t){return window.clearTimeout(t)}}else e=function(t){return window.clearTimeout(t)};e(t)}(this.loop),this.requestId=null},t.prototype.remove=function(t){var e=this.frames.indexOf(t);e>=0&&this.frames.splice(e,1)},t.prototype.add=function(t,e,r,n){var i=this;void 0===e&&(e=!1),void 0===r&&(r=0),void 0===n&&(n=5);var o={callback:t,once:e,delay:r,order:n};return this.frames.push(o),this.frames.sort((function(t,e){return t.order-e.order})),function(){return i.remove(o)}},t.prototype.disponse=function(){this.stoped=!0,this.frames.length=0},t}(),Wt=[],Gt=0;Zt.shared.add((function(){if(Gt=10,Wt.length)for(var t=0,e=Wt.splice(0,Gt);t<e.length;t++){var r=e[t];Gt--,r()}})),new s.WebGLRenderTarget(1,1),new s.OrthographicCamera(-1,1,1,-1,0,1).matrixAutoUpdate=!1;var Jt=new s.BufferGeometry;Jt.setAttribute("position",new s.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3));var Xt=new s.Mesh(Jt);Xt.matrixAutoUpdate=!1;var $t=new s.Scene;$t.add(Xt),$t.matrixAutoUpdate=!1,new s.RawShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\n void main() {\n gl_Position = vec4(0, 0, 0, 0);\n }\n ",fragmentShader:"\n uniform sampler2D map;\n void main() {\n gl_FragColor = textureCube(map, vec3(0, 0));\n }\n ",depthTest:!1,depthWrite:!1,stencilWrite:!1,colorWrite:!1,blending:s.NoBlending,lights:!1,toneMapped:!1}),new s.RawShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\n void main() {\n gl_Position = vec4(0, 0, 0, 0);\n }\n ",fragmentShader:"\n uniform samplerCube map;\n void main() {\n gl_FragColor = textureCube(map, vec3(0, 0, 0));\n }\n ",depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:s.NoBlending,lights:!1,toneMapped:!1});var te=function(){function t(t,e,r,n,i){this.tileTree=e,this.tileSources=r,this.options=n,this.renderer=i,this.name="",this.needsRender=!1,this.disposed=!1,this.loadedCubeNodes=new Set,this.loadingCubeNodes=new Set,this.baseCubeTexture=null,this._cubeRenderTarget=null,this.textures=[],this.baseCubeTexture=t}return Object.defineProperty(t.prototype,"cubeRenderTarget",{get:function(){return this._cubeRenderTarget},set:function(t){var e,r,n,i,o;if(null===t)throw new Error("cannot set cubeRenderTarget to null.");t.width!==this.options.textureSize&&t.setSize(this.options.textureSize,this.options.textureSize),t.texture.format=null!==(e=this.options.format)&&void 0!==e?e:s.RGBAFormat,t.texture.minFilter=null!==(r=this.options.minFilter)&&void 0!==r?r:s.LinearFilter,t.texture.magFilter=null!==(n=this.options.magFilter)&&void 0!==n?n:s.LinearFilter,t.texture.wrapS=null!==(i=this.options.wrapS)&&void 0!==i?i:s.ClampToEdgeWrapping,t.texture.wrapT=null!==(o=this.options.wrapT)&&void 0!==o?o:s.ClampToEdgeWrapping,this.baseCubeTexture&&(Rt(this.baseCubeTexture,t,this.renderer),this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this._cubeRenderTarget&&Rt(this._cubeRenderTarget.texture,t,this.renderer),this._cubeRenderTarget=t},enumerable:!1,configurable:!0}),t.prototype.requestTile=function(t){var e,r,n,i,o,a,u=this,l=this.tileSources.filter((function(e){return e.level===t.level}))[0];if(l){var c=l.size,h=Math.pow(2,t.level)*t.position.y,f=Math.pow(2,t.level)*t.position.x,p="".concat((null!==(n=null===(r=null===(e=this.options.imageURL)||void 0===e?void 0:e.options)||void 0===r?void 0:r.key)&&void 0!==n?n:"pano.0").replace(/^pano/,"pano_tile"),".").concat(t.face,".").concat(t.level,".").concat(h,".").concat(f),d=at(at({},null!==(o=null===(i=this.options.imageURL)||void 0===i?void 0:i.options)&&void 0!==o?o:{basisLoaderInitialized:!1,key:"unknown"}),{key:p,size:c*t.size===this.options.tileImageSize?void 0:this.options.tileImageSize,quality:void 0,cut:[c*t.position.x,c*t.position.y,c*t.size,c*t.size]});this.loadingCubeNodes.add(t),this.options.textureLoader.loadTexture(l[t.face],{imageURL:{transform:null===(a=this.options.imageURL)||void 0===a?void 0:a.transform,options:at({},d)},format:s.RGBAFormat,viaAjax:!1}).then((function(e){u.disposed?e.body.dispose():(u.textures.push({face:t.face,level:t.level,position:t.position,size:new s.Vector2(t.size,t.size),texture:e.body}),u.loadedCubeNodes.add(t))})).catch(Pt).then((function(){u.disposed||u.loadingCubeNodes.delete(t)}))}else this.loadedCubeNodes.add(t)},t.prototype.update=function(t,e){var r=this;if(!this.disposed){var n=[];At(this.tileTree,(function(i){return!r.loadingCubeNodes.has(i)&&(!(i.level>e)&&(!!t.intersectsBox(i.box)&&(r.loadedCubeNodes.has(i)?void 0:(n.push(i),!1))))}));for(var i=0,o=n;i<o.length;i++){var a=o[i];this.requestTile(a)}if(this.cubeRenderTarget&&this.textures.length){var u=this.textures.splice(0,4);!function(t,e,r){var n=new s.Scene,i=new s.Group;i.scale.set(1,1,-1),n.add(i);for(var o=[],a=0,u=t;a<u.length;a++){var l=u[a],c=Ot.pop()||new s.ShaderMaterial({uniforms:{map:{value:null}},vertexShader:"\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\nuniform sampler2D map;\nvarying vec2 vUv;\nvoid main() {\n gl_FragColor = texture2D(map, vUv);\n}\n",depthTest:!1,depthWrite:!1,stencilWrite:!1,blending:s.NoBlending,lights:!1,toneMapped:!1,fog:!1});o.push(c),c.uniforms.map.value=l.texture;var h=new s.Group,f=new s.Mesh(Tt,c);f.position.set(l.position.x+l.size.x/2-.5,1-(l.position.y+l.size.y/2)-.5,-.5),f.scale.set(l.size.x,l.size.y,1),h.quaternion.copy(zt[l.face]),h.add(f),i.add(h)}var p=r.autoClear;r.autoClear=!1;var d=new s.CubeCamera(.1,2,e);d.matrixAutoUpdate=!1,d.update(r,n),r.autoClear=p;for(var v=0,y=o;v<y.length;v++)Ht(c=y[v])}(u,this.cubeRenderTarget,this.renderer),this.needsRender=!0;for(var l=0,c=u;l<c.length;l++){c[l].texture.dispose()}}}},Object.defineProperty(t.prototype,"tilePending",{get:function(){return this.loadingCubeNodes.size},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"texture",{get:function(){if(!this._cubeRenderTarget)throw new Error("cubeRenderTarget never set.");return this._cubeRenderTarget.texture},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){if(!this.disposed){this.disposed=!0,this.baseCubeTexture&&(this.baseCubeTexture.dispose(),this.baseCubeTexture=null),this.loadingCubeNodes.clear(),this.loadedCubeNodes.clear();for(var t=0,e=this.textures;t<e.length;t++){e[t].texture.dispose()}this.textures.length=0}},t}(),ee=function(){var t=113,e=126,r=0,n="";return arguments[r].split(n).map((function(n){return n.charCodeAt(r)>e?n:String.fromCharCode((n.charCodeAt(r)+t)%e)})).join(n)}("n\bv{t-rp@-[|znyHn\bv{t-rp@-cvr]|vv|{Hn\bv{t-rpA-|yq]|vv|{H0v{pyqr-Ip|zz|{K0v{pyqr-Il}nlrrK0v{pyqr-I?l}nlrrK0v{pyqr-Ip|y|l}nlrrK0v{pyqr-Iunq|zn}l}nlrrK0vs-qrsv{rq5b`RlPbaR_6--0vs-[bZlPYV]]V[TlN__NflYR[TaU-K-=----{vs|z-sy|n-pyv}}rSy||h[bZlPYV]]V[TlO\\ejH----{vs|z-nz}yr?Q-pyv}}r]yn{rarrH----n\bv{t-sy|n-{rrqPcnyrH--0r{qvs0r{qvs0vs-[bZlSY\\\\_lP\\b[a-K-=--{vs|z-nz}yr?Q-ty|onySy||V{s|arrH0r{qvs|vq-znv{56-\n--0v{pyqr-IlrrK--0v{pyqr-I?lrrK--0v{pyqr-Ip|y|lrrK--0v{pyqr-Iortv{{|znylrrK--0v{pyqr-Iqrsny{|znylrrK--rpA-n{s|zrq-J-rpA5}|vv|{9->;=6H--rpA-z]|vv|{-J-z|qrycvrZnv-7-n{s|zrqH--[|zny-J-{|znyv\tr5n{s|zrq[|zny6H--cvr]|vv|{-J-:z]|vv|{;\b\tH--|yq]|vv|{-J-z|qryZnv-7-n{s|zrqH--tyl]|vv|{-J-}|wrpv|{Znv-7-z|qrycvrZnv-7-n{s|zrqH--<<前置裁切计算--0vs-qrsv{rq5b`RlPbaR_6----{rrqPcnyr-J-=;=H----rpA-}yn{rH----s|5-v{-v-J-=H-v-I-[bZlPYV]]V[TlO\\eH-v886\n------o||y-pyv}}rq-J-rH------v{-pr{Sy||V{qr-J-v{5pyv}}rSy||hvj6H------s|-5-v{-w-J-=H-w-I-CH-w-88-6-\n--------sy|n-P||q-J-sy|n5v-7-C-8-w6-<-sy|n5[bZlPYV]]V[TlN__NflYR[TaU6H--------sy|n-\bP||q-J-=;BH--------}yn{r-J-rr?Q5pyv}}r]yn{rarr9-rp?5P||q9-\bP||q6-6H--------pyv}}rq-J-5-q|5-cvr]|vv|{9-}yn{r;\b\t-6-K-}yn{r;-6-33-pyv}}rqH------\f------rp?-sy||bH------sy||b;-J-5sy|n5pr{Sy||V{qr6-8-=;FFF6-<-sy|n5[bZlSY\\\\_lP\\b[a6H------sy||b;\b-J-=;BH------rpA-lsy||V{s|H------lsy||V{s|-J-rr?Q5ty|onySy||V{s|arr9-sy||b6H------o||y-v{antrSy||-J-|yq]|vv|{;\b-I-lsy||V{s|;-33-|yq]|vv|{;\b-K-lsy||V{s|;tH------------pyv}}rq-J-5pr{Sy||V{qr-JJ-:>-\v\v-v{antrSy||6-33-pyv}}rqH------------vs5pyv}}rq6-\n--------{rrqPcnyr-J->;=H--------ornxH------\f----\f--0r{qvs--0v{pyqr-Iunq|zn}lrrK\f"),re=function(){var t=113,e=126,r=0,n="";return arguments[r].split(n).map((function(n){return n.charCodeAt(r)>e?n:String.fromCharCode((n.charCodeAt(r)+t)%e)})).join(n)}("0qrsv{r-OYNPXlP\\Y\\_-rpA5=;=EC9-=;>=C9-=;>AF9->;=60qrsv{r-aNb-C;?E@>EB?{vs|z-nz}yrPor-}n{|=lzn}H{vs|z-znA-}n{|=lznvH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|=lyzv{n{prZn}H0r{qvs{vs|z-nz}yrPor-}n{|>lzn}H{vs|z-znA-}n{|>lznvH0vs-qrsv{rq5b`RlYbZV[N[PR6--{vs|z-nz}yrPor-}n{|>lyzv{n{prZn}H0r{qvs{vs|z-rp@-qvssrH{vs|z-rp@-rzvvrH{vs|z-rp@-}rpynH{vs|z-sy|n-uv{v{rH{vs|z-sy|n-r}|rH{vs|z-sy|n-|}npv\bH{vs|z-sy|n-z|qryNy}unH{vs|z-sy|n-}|trH{vs|z-sy|n-sy||V{qrH0vs-qrsv{rq5b`RlNYYlP\\Y\\_6{vs|z-rp@-z|qryP|y|V{s|H0r{qvs0vs-qrsv{rq5b`Rl]N[\\lcVQR\\6--{vs|z-rp?-}n{|cvqr|lv\trH--{vs|z-znA-}n{|cvqr|lznvH--{vs|z-sy|n-}n{|cvqr|lny}unH--{vs|z-nz}yr?Q-}n{|cvqr|lzn}H0r{qvs0vs-qrsv{rq5b`RlPYV]SY\\\\_6--{vs|z-rp@-sy||V{s|H0r{qvsn\bv{t-rpA-|yq]|vv|{H0vs-qrsv{rq5b`RlPbaR_6--0vs-[bZlPYV]]V[TlN__NflYR[TaU-K-=----{vs|z-sy|n-pyv}}rSy||h[bZlPYV]]V[TlO\\ejH----{vs|z-nz}yr?Q-pyv}}r]yn{rarrH----n\bv{t-sy|n-{rrqPcnyrH--0r{qvs0r{qvs0vs-[bZlSY\\\\_lP\\b[a-K-=--{vs|z-nz}yr?Q-ty|onySy||V{s|arrH0r{qvs0v{pyqr-Ip|zz|{K0v{pyqr-I}npxv{tK0v{pyqr-Ip|y|l}nlsntzr{K0v{pyqr-Il}nlsntzr{K0v{pyqr-I?l}nlsntzr{K0v{pyqr-Izn}l}nlsntzr{K0v{pyqr-Iny}unzn}l}nlsntzr{K0v{pyqr-In|zn}l}nlsntzr{K0v{pyqr-Iyvtuzn}l}nlsntzr{K0v{pyqr-Irzvvrzn}l}nlsntzr{K0v{pyqr-Ir{zn}l}nlsntzr{K0v{pyqr-Itnqvr{zn}l}nlsntzr{K0v{pyqr-Is|tl}nlsntzr{K0v{pyqr-IoqsK0v{pyqr-Iyvtul}nlortv{K0v{pyqr-Iyvtul}u|{tl}nlsntzr{K0v{pyqr-Iunq|zn}l}nlsntzr{Krp?-|P||q5rp@-rp|6-\n--sy|n--J-yr{tu5rp|6H--sy|n-urn-J-np|5rp|;\b-<-6H--sy|n-}uv-J-nn{5rp|;9-rp|;\t6H--r{-rp?5=;B-8-}uv-<-aNb9-urn-<-]V6H\f|vq-znv{56-\n--0vs-qrsv{rq5b`RlNYYlP\\Y\\_6----tylSntP|y|-J-rpA5z|qryP|y|V{s|;9z|qryP|y|V{s|;t9z|qryP|y|V{s|;o9>;=6H----r{H--0r{qvsvs-5q|5cvr]|vv|{9-[|zny6-I-=;=6-\n----qvpnqH--\f--<<前置裁切计算------0vs-qrsv{rq5b`RlPbaR_6----vs5{rrqPcnyr-K-=;=6\n------rpA-}yn{rH------s|5-v{-v-J-=H-v-I-[bZlPYV]]V[TlO\\eH-v886\n--------o||y-pyv}}rq-J-rH--------v{-pr{Sy||V{qr-J-v{5pyv}}rSy||hvj6H--------s|-5-v{-w-J-=H-w-I-CH-w-88-6-\n----------sy|n-P||q-J-sy|n5v-7-C-8-w6-<-sy|n5[bZlPYV]]V[TlN__NflYR[TaU6H----------sy|n-\bP||q-J-=;BH----------}yn{r-J-rr?Q5pyv}}r]yn{rarr9-rp?5P||q9-\bP||q6-6H----------pyv}}rq-J-5-q|5-cvr]|vv|{9-}yn{r;\b\t-6-K-}yn{r;-6-33-pyv}}rqH--------\f--------rp?-sy||bH--------sy||b;-J-5sy|n5pr{Sy||V{qr6-8-=;FFF6-<-sy|n5[bZlSY\\\\_lP\\b[a6H--------sy||b;\b-J-=;BH--------rpA-lsy||V{s|H--------lsy||V{s|-J-rr?Q5ty|onySy||V{s|arr9-sy||b6H--------o||y-v{antrSy||-J-|yq]|vv|{;\b-I-lsy||V{s|;-33-|yq]|vv|{;\b-K-lsy||V{s|;tH----------------pyv}}rq-J-5pr{Sy||V{qr-JJ-:>-\v\v-v{antrSy||6-33-pyv}}rqH--------vs5pyv}}rq6-\n----------qvpnqH--------\f-----\f----\f--0r{qvs--<<楼层切割计算--0vs-qrsv{rq5b`RlPYV]SY\\\\_6----vs-5|yq]|vv|{;\b-I-sy||V{s|;-\v\v-|yq]|vv|{;\b-K-sy||V{s|;t6-\n------qvpnqH----\f--0r{qvs--rpA-qvssrP|y|-J-rpA5qvssr;to9-|}npv\b6H--_rsyrprqYvtu-rsyrprqYvtu-J-_rsyrprqYvtu5rp@5=;=69-rp@5=;=69-rp@5=;=69-rp@5=;=66H--rp@-|nyRzvvr_nqvn{pr-J-rzvvrH--0v{pyqr-Izn}lsntzr{K--0v{pyqr-Ip|y|lsntzr{K--0v{pyqr-Iny}unzn}lsntzr{K--0v{pyqr-Iny}unrlsntzr{K--0v{pyqr-I}rpynzn}lsntzr{K--0v{pyqr-I{|znylsntzr{lortv{K--0v{pyqr-I{|znylsntzr{lzn}K--0v{pyqr-Irzvvrzn}lsntzr{K--0v{pyqr-Iyvtul}u|{tlsntzr{K--0v{pyqr-Iyvtulsntzr{lortv{K--<<-调整曝光值--vnqvn{pr-J-vnqvn{pr-7-r}|rH--0v{pyqr-Iyvtulsntzr{lzn}K--0v{pyqr-Iyvtulsntzr{lr{qK--0v{pyqr-In|zn}lsntzr{K--<<-减少方向光对模型的影响--rp@-|t|v{tYvtu-J-5rsyrprqYvtu;qvrpQvssr-7-=;?6-8----rsyrprqYvtu;v{qvrpQvssr-8----rsyrprqYvtu;v{qvrp`}rpyn-8----|nyRzvvr_nqvn{prH--<<-修复黑色面片的问题--vs-5|t|v{tYvtu;-K-=;=-\v\v-|t|v{tYvtu;t-K-=;=-\v\v-|t|v{tYvtu;o-K-=;=6-\n----tylSntP|y|-J-rpA5|t|v{tYvtu9-qvssrP|y|;n6H--\f-ryr-\n----tylSntP|y|-J-rpA5OYNPXlP\\Y\\_;\b\t9-qvssrP|y|;n6H--\f--rp@-}n{|=a|crr-J-5|yq]|vv|{;\b\t-:-}n{|=lznvh@j;\b\t6-7-zn@5}n{|=lznv6H--rp@-}n{|>a|crr-J-5|yq]|vv|{;\b\t-:-}n{|>lznvh@j;\b\t6-7-zn@5}n{|>lznv6H--rpA-}n{|P|y|H--rpA-}n{|=P|y|-J-rrPor5}n{|=lzn}9-}n{|=a|crr6H--rpA-}n{|>P|y|-J-rrPor5}n{|>lzn}9-}n{|>a|crr6H--0vs-qrsv{rq5b`RlYbZV[N[PR6----}n{|=P|y|;n-J->;=-:-rrPor5}n{|=lyzv{n{prZn}9-}n{|=a|crr6;H----}n{|>P|y|;n-J->;=-:-rrPor5}n{|>lyzv{n{prZn}9-}n{|>a|crr6;H--0r{qvs--0vs-qrsv{rq5b`RlOYNPXla_N[`VaV\\[6----sy|n-oynpx]|tr-J-np|5:?;=-7-}|tr-8->;=6H----}n{|P|y|-J-zv5}n{|=P|y|9-OYNPXlP\\Y\\_9-zv{5>;=9-oynpx]|tr66H----}n{|P|y|-J-zv5}n{|P|y|9-}n{|>P|y|9-zn5=;=9-oynpx]|tr-:-?;=66H--0ryr----}n{|P|y|-J-zv5}n{|=P|y|9-}n{|>P|y|9-}|tr6H--0r{qvs--0vs-qrsv{rq5b`Rl]N[\\lcVQR\\6----rp@-pnzrna|crr-J-|yq]|vv|{;\b\t-:-pnzrn]|vv|{H----rpA-zn}P||q-J-rpA5pnzrna|crr9->;=6-7-}n{|cvqr|lznvH----rp?--J-rp?5------=;B-8-zn}P||q;-<-zn}P||q;\t-<-}n{|cvqr|lv\tr;9------=;B-:-zn}P||q;\b-<-zn}P||q;\t-<-}n{|cvqr|lv\tr;\b----6H----rpA-vqr|P|y|-J-rr?Q5}n{|cvqr|lzn}9-6H----sy|n-znpu-J-5>;=-:-r}5=;=9-zn}P||q;\t66-7-5>;=-:-r}5=;B9-no5;-:-=;B666-7-5>;=-:-r}5=;B9-no5;\b-:-=;B666H----sy|n-ny}un-J-pynz}5=;=9->;=9-B;=-7-5>;=-:-pynz}5qvn{pr59-rp?5=;B9-=;B66-<-=;BB-9-=;=9->;=666H----}n{|P|y|-J-zv5}n{|P|y|9-vqr|P|y|9-znpu-7-ny}un-7-}n{|cvqr|lny}un6H--0r{qvs--0vs-qrsv{rq5b`Rl]N[\\l\\]NPVaf6----tylSntP|y|-J-zv5}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H----tylSntP|y|;n-J-|}npv\bH--0ryr----tylSntP|y|-J-rpA5tylSntP|y|;to9-|}npv\b6H----tylSntP|y|-J-zv5}n{|P|y|9-tylSntP|y|9-z|qryNy}un6H--0r{qvs\f"),ne=new s.WebGLCubeRenderTarget(1).texture;ne.name="EMPTY_TEXTURE";var ie=Object.assign({modelAlpha:new s.Uniform(0),progress:new s.Uniform(0),pano0_map:new s.Uniform(ne),pano0_luminanceMap:new s.Uniform(null),pano0_matrix:new s.Uniform(new s.Matrix4),pano1_map:new s.Uniform(ne),pano1_luminanceMap:new s.Uniform(null),pano1_matrix:new s.Uniform(new s.Matrix4),floorIndex:new s.Uniform(-1),floorInfo:new s.Uniform(null),clipperPlanesArray:new s.Uniform(new Float32Array),clipperPlanesTexture:new s.Uniform(null),clipperFloors:new s.Uniform([]),modelColorInfo:new s.Uniform(null),globalFloorInfo:new s.Uniform([]),globalFloorInfoTexture:new s.Uniform(null)},{exposure:new s.Uniform(1),emissive:new s.Uniform(new s.Color(0)),emissiveMap:new s.Uniform(null),specular:new s.Uniform(new s.Color(1118481)),specularMap:new s.Uniform(null),normalMap:new s.Uniform(null),bumpMap:new s.Uniform(null),shininess:new s.Uniform(30)},s.UniformsUtils.clone(s.UniformsLib.common),s.UniformsUtils.clone(s.UniformsLib.lights)),oe=function(t){function e(e){void 0===e&&(e={});var r,n,i,o,a,u,l,c,h,f=this;f=t.call(this,{vertexShader:ee,fragmentShader:re,uniforms:s.UniformsUtils.clone(ie),defines:{USE_MAP:!0,USE_UV:!0,USE_LUMINANCE:!1,USE_PANO_OPACITY:!1,USE_BLACK_TRANSITION:!1,USE_PANO_VIDEO:!1,USE_ALL_COLOR:!1,USE_CLIPFLOOR:!1,USE_CUTER:!1,NUM_FLOOR_COUNT:0,NUM_CLIPPING_ARRAY_LENGTH:0,NUM_CLIPPING_BOX:0},blending:s.NoBlending,lights:!0})||this;var p=null,d=null;return Object.defineProperties(f,{pano0:{get:function(){return p},set:function(t){p=t,null===t?(this.uniforms.pano0_map.value=ne,this.uniforms.pano0_luminanceMap.value=null,this.uniforms.pano0_matrix.value.identity()):(this.uniforms.pano0_map.value=t.map instanceof te?t.map.texture:t.map,this.uniforms.pano0_luminanceMap.value=t.luminanceMap instanceof te?t.luminanceMap.texture:t.luminanceMap,this.uniforms.pano0_matrix.value.copy(t.matrix));var e=null!==this.uniforms.pano0_luminanceMap.value&&null!==this.uniforms.pano1_luminanceMap.value;this.defines.USE_LUMINANCE!==e&&(this.defines.USE_LUMINANCE=e,this.needsUpdate=!0)}},pano1:{get:function(){return d},set:function(t){d=t,null===t?(this.uniforms.pano1_map.value=ne,this.uniforms.pano1_luminanceMap.value=null,this.uniforms.pano1_matrix.value.identity()):(this.uniforms.pano1_map.value=t.map instanceof te?t.map.texture:t.map,this.uniforms.pano1_luminanceMap.value=t.luminanceMap instanceof te?t.luminanceMap.texture:t.luminanceMap,this.uniforms.pano1_matrix.value.copy(t.matrix));var e=null!==this.uniforms.pano0_luminanceMap.value&&null!==this.uniforms.pano1_luminanceMap.value;this.defines.USE_LUMINANCE!==e&&(this.defines.USE_LUMINANCE=e,this.needsUpdate=!0)}},modelAlpha:{get:function(){return this.uniforms.modelAlpha.value},set:function(t){this.uniforms.modelAlpha.value=t}},progress:{get:function(){return this.uniforms.progress.value},set:function(t){this.uniforms.progress.value=t}},useBlackTransition:{get:function(){return this.defines.USE_BLACK_TRANSITION},set:function(t){this.defines.USE_BLACK_TRANSITION!==t&&(this.defines.USE_BLACK_TRANSITION=t,this.needsUpdate=!0)}},modelColorInfo:{get:function(){return this.uniforms.modelColorInfo.value},set:function(t){this.uniforms.modelColorInfo.value=t;var e=null!==t;this.defines.USE_ALL_COLOR!==e&&(this.defines.USE_ALL_COLOR=e,this.needsUpdate=!0)}},opacity:{get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t;var e=t<1?s.NormalBlending:s.NoBlending;e!==this.blending&&(this.blending=e,this.needsUpdate=!0)}},floorIndex:{get:function(){return this.uniforms.floorIndex.value},set:function(t){this.uniforms.floorIndex.value=t}},floorInfo:{get:function(){return this.uniforms.floorInfo.value},set:function(t){var e,r=this.defines.USE_CLIPFLOOR;t&&!t.equals(new s.Vector3(0,0,0))?(e=!0,this.uniforms.floorInfo.value=t):(e=!1,this.uniforms.floorInfo.value=null),r!==e&&(this.defines.USE_CLIPFLOOR=e,this.needsUpdate=!0)}},clippers:{get:function(){return this._clippers},set:function(t){this._clippers=t}},clipperPlanesArray:{get:function(){return this.uniforms.clipperPlanesArray.value},set:function(t){var e=!1;if(t instanceof Float32Array&&t.length>0&&t.length%6==0){var r=t.length/4;!0!==this.defines.USE_CUTER&&(this.defines.USE_CUTER=!0,e=!0),this.defines.NUM_CLIPPING_ARRAY_LENGTH!==r&&(this.defines.NUM_CLIPPING_ARRAY_LENGTH=r,e=!0),this.defines.NUM_CLIPPING_BOX!==r/6&&(this.defines.NUM_CLIPPING_BOX=r/6,e=!0),this.uniforms.clipperPlanesArray.value=t;var n=new s.DataTexture(t,r,1,s.RGBAFormat,s.FloatType);n.wrapS=s.ClampToEdgeWrapping,n.wrapT=s.ClampToEdgeWrapping,n.minFilter=s.NearestFilter,n.magFilter=s.NearestFilter,this.uniforms.clipperPlanesTexture.value&&this.uniforms.clipperPlanesTexture.value.dispose(),this.uniforms.clipperPlanesTexture.value=n}else!1!==this.defines.USE_CUTER&&(this.defines.USE_CUTER=!1,e=!0),0!==this.defines.NUM_CLIPPING_ARRAY_LENGTH&&(this.defines.NUM_CLIPPING_ARRAY_LENGTH=0,e=!0),0!==this.defines.NUM_CLIPPING_BOX&&(this.defines.NUM_CLIPPING_BOX=0,e=!0),this.uniforms.clipperPlanesArray.value=new Float32Array,this.uniforms.clipperPlanesTexture.value=null;e&&(this.needsUpdate=!0)}},clipperFloors:{get:function(){return this.uniforms.clipperFloors.value},set:function(t){this.uniforms.clipperFloors.value=t}},globalFloorInfo:{get:function(){return this.uniforms.globalFloorInfo.value},set:function(t){var e=this.defines.NUM_FLOOR_COUNT;if(t&&e!==t.length){this.defines.NUM_FLOOR_COUNT=t.length,this.uniforms.globalFloorInfo.value=t;var r=[];t.forEach((function(t){r.push(t.x),r.push(t.y),r.push(t.z)}));var n=t.length,i=new s.DataTexture(new Float32Array(r),n,1,s.RGBFormat,s.FloatType);i.wrapS=s.ClampToEdgeWrapping,i.wrapT=s.ClampToEdgeWrapping,i.minFilter=s.NearestFilter,i.magFilter=s.NearestFilter,this.uniforms.globalFloorInfoTexture.value&&this.uniforms.globalFloorInfoTexture.value.dispose(),this.uniforms.globalFloorInfoTexture.value=i,this.needsUpdate=!0}}}}),f.pano0=null!==(r=e.pano0)&&void 0!==r?r:null,f.pano1=null!==(n=e.pano1)&&void 0!==n?n:null,f.modelAlpha=null!==(i=e.modelAlpha)&&void 0!==i?i:1,f.progress=null!==(o=e.progress)&&void 0!==o?o:0,f.useBlackTransition=null!==(a=e.useBlackTransition)&&void 0!==a&&a,f.modelColorInfo=null!==(u=e.modelColorInfo)&&void 0!==u?u:null,f.opacity=null!==(l=e.opacity)&&void 0!==l?l:1,f.originOpacity=1,f.floorIndex=null!==(c=e.floorIndex)&&void 0!==c?c:-1,f.floorInfo=null!==(h=e.floorInfo)&&void 0!==h?h:null,f.clippers=null,f.clipperPlanesArray=null,f.clipperFloors=null,f.globalFloorInfo=null,f}return st(e,t),e}(s.ShaderMaterial);function se(t){return new Promise((function(e,r){(/^https\:/.test(t)?u.default:a.default).get(t,(function(t){var n=[];t.on("data",(function(t){return n.push(t)})),t.on("end",(function(){e(Buffer.concat(n).buffer)})),t.on("error",(function(t){return r(t)}))})).on("error",(function(t){return r(t)}))}))}const ae=l.Reader,ue=l.util,le=l.roots["@REALSEE/FIVE:five/server/model/proto/pbm.proto"]||(l.roots["@REALSEE/FIVE:five/server/model/proto/pbm.proto"]={}),ce=le.Model=(()=>{function t(t){if(this.chunks=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.chunks=ue.emptyArray,t.prototype.createAt=ue.Long?ue.Long.fromBits(0,0,!0):0,t.prototype.description="",t.decode=function(t,e){t instanceof ae||(t=ae.create(t));let r=void 0===e?t.len:t.pos+e,n=new le.Model;for(;t.pos<r;){let e=t.uint32();switch(e>>>3){case 1:n.chunks&&n.chunks.length||(n.chunks=[]),n.chunks.push(le.Chunk.decode(t,t.uint32()));break;case 2:n.createAt=t.uint64();break;case 3:n.description=t.string();break;default:t.skipType(7&e)}}return n},t})();le.Chunk=(()=>{function t(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.vertices=null,t.prototype.faces=null,t.prototype.name="",t.prototype.texture="",t.decode=function(t,e){t instanceof ae||(t=ae.create(t));let r=void 0===e?t.len:t.pos+e,n=new le.Chunk;for(;t.pos<r;){let e=t.uint32();switch(e>>>3){case 1:n.vertices=le.Vertices.decode(t,t.uint32());break;case 2:n.faces=le.Faces.decode(t,t.uint32());break;case 3:n.name=t.string();break;case 4:n.texture=t.string();break;default:t.skipType(7&e)}}if(!n.hasOwnProperty("vertices"))throw ue.ProtocolError("missing required 'vertices'",{instance:n});if(!n.hasOwnProperty("faces"))throw ue.ProtocolError("missing required 'faces'",{instance:n});if(!n.hasOwnProperty("name"))throw ue.ProtocolError("missing required 'name'",{instance:n});return n},t})(),le.Vertices=(()=>{function t(t){if(this.xyz=[],this.uvs=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.xyz=ue.emptyArray,t.prototype.uvs=ue.emptyArray,t.decode=function(t,e){t instanceof ae||(t=ae.create(t));let r=void 0===e?t.len:t.pos+e,n=new le.Vertices;for(;t.pos<r;){let e=t.uint32();switch(e>>>3){case 1:if(n.xyz&&n.xyz.length||(n.xyz=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.xyz.push(t.float())}else n.xyz.push(t.float());break;case 2:if(n.uvs&&n.uvs.length||(n.uvs=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.uvs.push(t.float())}else n.uvs.push(t.float());break;default:t.skipType(7&e)}}return n},t})(),le.Faces=(()=>{function t(t){if(this.indices=[],this.normals=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.indices=ue.emptyArray,t.prototype.normals=ue.emptyArray,t.decode=function(t,e){t instanceof ae||(t=ae.create(t));let r=void 0===e?t.len:t.pos+e,n=new le.Faces;for(;t.pos<r;){let e=t.uint32();switch(e>>>3){case 1:if(n.indices&&n.indices.length||(n.indices=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.indices.push(t.uint32())}else n.indices.push(t.uint32());break;case 2:if(n.normals&&n.normals.length||(n.normals=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.normals.push(t.float())}else n.normals.push(t.float());break;default:t.skipType(7&e)}}return n},t})();var he=(new s.Matrix4).set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1).elements;function fe(t){var e=t.match(/(group|floor)-?(\d+)/);return e?parseInt(e[2],10):0}function pe(t){var e=t.match(/(chunk)-?(\d+)/);return e?parseInt(e[2],10):0}function de(t){var e,r;return 1e6*fe(t.name)+1e3*pe(t.name)+(e=t.name,(r=e.match(/(sub)-?(\d+)/))?parseInt(r[2],10):0)}function ve(t){for(var e=function(t){for(var e,r,n,i="number"==typeof t.createAt?t.createAt:null===t.createAt||void 0===t.createAt?0:t.createAt.toNumber(),o=null!==(e=t.description)&&void 0!==e?e:"",s=[],a=!0,u=0,l=t.chunks;u<l.length;u++)if(!(rt=l[u]).faces.normals||0===rt.faces.normals.length){a=!1;break}for(var c=t.chunks.sort((function(t,e){return de(t)-de(e)})),h=[],f=0,p=c;f<p.length;f++){var d=fe((rt=p[f]).name);h[d]||(h[d]=[]),h[d].push(rt)}for(var v=0;v<h.length;v++){var y=h[v];if(y)if(a){for(var g=0,m=0;m<y.length;m++)g+=(rt=y[m]).faces.indices.length;for(var b=3*g,x=2*g,w=3*g,S=new ArrayBuffer(4*b+4*x+4*w),A=new Float32Array(S,0,b),P=new Float32Array(S,4*b,x),E=new Float32Array(S,4*b+4*x,w),_=[],N=[1/0,1/0,1/0,-1/0,-1/0,-1/0],C=0,I=0;I<y.length;I++){var R=[1/0,1/0,1/0,-1/0,-1/0,-1/0],D=(rt=y[I]).vertices.xyz,z=rt.vertices.uvs,T=rt.faces.indices,O=rt.faces.normals,H=T.length;for(m=0;m<H;m++){var B=T[m],q=D[3*B],k=D[3*B+1],V=D[3*B+2],U=1/(he[3]*q+he[7]*k+he[11]*V+he[15]),F=(he[0]*q+he[4]*k+he[8]*V+he[12])*U,M=(he[1]*q+he[5]*k+he[9]*V+he[13])*U,K=(he[2]*q+he[6]*k+he[10]*V+he[14])*U;A[3*C+3*m]=F,A[3*C+3*m+1]=M,A[3*C+3*m+2]=K,P[2*C+2*m]=z[2*B],P[2*C+2*m+1]=z[2*B+1];var L=3*Math.floor(m/3),j=O[L],Y=O[L+1],Q=O[L+2],Z=1/(he[3]*j+he[7]*Y+he[11]*Q+he[15]),W=(he[0]*j+he[4]*Y+he[8]*Q+he[12])*Z,G=(he[1]*j+he[5]*Y+he[9]*Q+he[13])*Z,J=(he[2]*j+he[6]*Y+he[10]*Q+he[14])*Z;E[3*C+3*m]=W,E[3*C+3*m+1]=G,E[3*C+3*m+2]=J,F<R[0]&&(R[0]=F),M<R[1]&&(R[1]=M),K<R[2]&&(R[2]=K),F>R[3]&&(R[3]=F),M>R[4]&&(R[4]=M),K>R[5]&&(R[5]=K)}R[0]<N[0]&&(N[0]=R[0]),R[1]<N[1]&&(N[1]=R[1]),R[2]<N[2]&&(N[2]=R[2]),R[3]>N[3]&&(N[3]=R[3]),R[4]>N[4]&&(N[4]=R[4]),R[5]>N[5]&&(N[5]=R[5]),_.push({materialIndex:I,name:rt.name,chunkName:pe(rt.name),start:C,count:rt.faces.indices.length,texture:null!==(r=rt.texture)&&void 0!==r?r:void 0}),C+=H}s.push({createAt:i,description:o,floorIndex:v,vertices:A,uvs:P,indices:null,normals:E,groups:_,extents:N})}else{g=0;var X=0;for(m=0;m<y.length;m++)X+=(rt=y[m]).vertices.xyz.length/3,g+=rt.faces.indices.length;b=3*X,x=2*X,w=3*X;var $=g,tt=(S=new ArrayBuffer(4*b+4*x+4*w+4*$),A=new Float32Array(S,0,b),P=new Float32Array(S,4*b,x),E=new Float32Array(S,4*b+4*x,w),new Uint32Array(S,4*b+4*x+4*w,$)),et=(_=[],N=[1/0,1/0,1/0,-1/0,-1/0,-1/0],0);for(C=0,I=0;I<y.length;I++){R=[1/0,1/0,1/0,-1/0,-1/0,-1/0],D=(rt=y[I]).vertices.xyz,z=rt.vertices.uvs,T=rt.faces.indices;var rt,nt=D.length/3;for(H=T.length,m=0;m<nt;m++)q=D[3*m],k=D[3*m+1],V=D[3*m+2],U=1/(he[3]*q+he[7]*k+he[11]*V+he[15]),F=(he[0]*q+he[4]*k+he[8]*V+he[12])*U,M=(he[1]*q+he[5]*k+he[9]*V+he[13])*U,K=(he[2]*q+he[6]*k+he[10]*V+he[14])*U,A[3*C+3*m]=F,A[3*C+3*m+1]=M,A[3*C+3*m+2]=K,P[2*C+2*m]=z[2*m],P[2*C+2*m+1]=z[2*m+1],F<R[0]&&(R[0]=F),M<R[1]&&(R[1]=M),K<R[2]&&(R[2]=K),F>R[3]&&(R[3]=F),M>R[4]&&(R[4]=M),K>R[5]&&(R[5]=K);for(R[0]<N[0]&&(N[0]=R[0]),R[1]<N[1]&&(N[1]=R[1]),R[2]<N[2]&&(N[2]=R[2]),R[3]>N[3]&&(N[3]=R[3]),R[4]>N[4]&&(N[4]=R[4]),R[5]>N[5]&&(N[5]=R[5]),m=0;m<H;m++)tt[et+m]=C+T[m];_.push({materialIndex:I,name:rt.name,chunkName:pe(rt.name),start:et,count:rt.faces.indices.length,texture:null!==(n=rt.texture)&&void 0!==n?n:void 0}),C+=nt,et+=H}for(m=0;m<g;m+=3){var it,ot,st,at,ut,lt,ct,ht,ft,pt,dt,vt,yt,gt,mt,bt;j=void 0,Y=void 0,Q=void 0,it=3*tt[m],ot=3*tt[m+1],st=3*tt[m+2],at=A[it],ut=A[it+1],lt=A[it+2],ct=A[ot],ht=A[ot+1],ft=A[ot+2],pt=A[st],j=(vt=A[st+1]-ht)*(bt=lt-ft)-(yt=A[st+2]-ft)*(mt=ut-ht),Y=yt*(gt=at-ct)-(dt=pt-ct)*bt,Q=dt*mt-vt*gt,E[it]+=j,E[it+1]+=Y,E[it+2]+=Q,E[ot]+=j,E[ot+1]+=Y,E[ot+2]+=Q,E[st]+=j,E[st+1]+=Y,E[st+2]+=Q}s.push({createAt:i,description:o,floorIndex:v,vertices:A,uvs:P,indices:tt,normals:E,groups:_,extents:N})}}return s}(t),r=0,n="",i=[],o=0,a=e;o<a.length;o++){var u=a[o],l=u.createAt,c=u.description,h=u.floorIndex,f=u.vertices,p=u.uvs,d=u.indices,v=u.normals,y=u.groups,g=u.extents,m=new s.Box3;m.min.x=g[0],m.min.y=g[1],m.min.z=g[2],m.max.x=g[3],m.max.y=g[4],m.max.z=g[5];var b=new s.BufferGeometry;b.setAttribute("position",new s.BufferAttribute(f,3)),b.setAttribute("uv",new s.BufferAttribute(p,2)),b.setAttribute("normal",new s.BufferAttribute(v,3)),d&&b.setIndex(new s.BufferAttribute(d,1)),b.boundingBox=m,b.boundingSphere=m.getBoundingSphere(new s.Sphere);for(var x=0,w=y;x<w.length;x++){var S=w[x];b.addGroup(S.start,S.count,S.materialIndex)}for(var A=[],P=0,E=y;P<E.length;P++){S=E[P];var _=new oe;A.push(_),_.defines.USE_MAP=!1,_.uniforms.diffuse.value=new s.Color(16777215),_.uniforms.floorIndex.value=h}var N=new St(b,A);N.name="model_floor_"+h,N.floorIndex=h,N.userData.createAt=l,N.userData.description=c,r=l,n=c,i.push(N)}return{createAt:r,description:n,objects:i}}var ye={};function ge(t){return Array.prototype.reduce.call(t,(function(t,e,r){return t|e<<8*r}),0)}function me(t){for(var e=new Uint8Array(t),r=ge(e.slice(0,4)),n=[],i=[],o=4+4*r,s=0;s<r;s++)i[s]=ge(e.slice(4+4*s,8+4*s)),n[s]=s===r-1?e.subarray(o,o+i[s]):e.slice(o,o+i[s]),o+=i[s];return Promise.resolve(function(t){for(var e,r=[],n=t.length,i=function(n){var i={data:t[n],offset:0,readByte:function(){return this.data[this.offset++]}},o=i.data.length,s={data:[],offset:0,writeByte:function(t){var e=Math.floor(this.offset/o);this.data[e]||(this.data[e]=new Uint8Array(o)),this.data[e][this.offset%o]=t,this.offset++}};ye.decompressFile(i,s),e=new Uint8Array(s.offset);for(var a=0;a<s.offset;a++)e[a]=s.data[Math.floor(a/o)][a%o];r.push(e)},o=0;o<n;o++)i(o);return r}(n))}ye.OutWindow=function(){this._windowSize=0},ye.OutWindow.prototype.create=function(t){this._buffer&&this._windowSize===t||(this._buffer=[]),this._windowSize=t,this._pos=0,this._streamPos=0},ye.OutWindow.prototype.flush=function(){var t=this._pos-this._streamPos;if(0!==t){for(;t--;)this._stream.writeByte(this._buffer[this._streamPos++]);this._pos>=this._windowSize&&(this._pos=0),this._streamPos=this._pos}},ye.OutWindow.prototype.releaseStream=function(){this.flush(),this._stream=null},ye.OutWindow.prototype.setStream=function(t){this.releaseStream(),this._stream=t},ye.OutWindow.prototype.init=function(t){t||(this._streamPos=0,this._pos=0)},ye.OutWindow.prototype.copyBlock=function(t,e){var r=this._pos-t-1;for(r<0&&(r+=this._windowSize);e--;)r>=this._windowSize&&(r=0),this._buffer[this._pos++]=this._buffer[r++],this._pos>=this._windowSize&&this.flush()},ye.OutWindow.prototype.putByte=function(t){this._buffer[this._pos++]=t,this._pos>=this._windowSize&&this.flush()},ye.OutWindow.prototype.getByte=function(t){var e=this._pos-t-1;return e<0&&(e+=this._windowSize),this._buffer[e]},ye.RangeDecoder=function(){},ye.RangeDecoder.prototype.setStream=function(t){this._stream=t},ye.RangeDecoder.prototype.releaseStream=function(){this._stream=null},ye.RangeDecoder.prototype.init=function(){var t=5;for(this._code=0,this._range=-1;t--;)this._code=this._code<<8|this._stream.readByte()},ye.RangeDecoder.prototype.decodeDirectBits=function(t){for(var e,r=0,n=t;n--;)this._range>>>=1,e=this._code-this._range>>>31,this._code-=this._range&e-1,r=r<<1|1-e,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8);return r},ye.RangeDecoder.prototype.decodeBit=function(t,e){var r=t[e],n=(this._range>>>11)*r;return(2147483648^this._code)<(2147483648^n)?(this._range=n,t[e]+=2048-r>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),0):(this._range-=n,this._code-=n,t[e]-=r>>>5,0==(4278190080&this._range)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),1)},ye.initBitModels=function(t,e){for(;e--;)t[e]=1024},ye.BitTreeDecoder=function(t){this._models=[],this._numBitLevels=t},ye.BitTreeDecoder.prototype.init=function(){ye.initBitModels(this._models,1<<this._numBitLevels)},ye.BitTreeDecoder.prototype.decode=function(t){for(var e=1,r=this._numBitLevels;r--;)e=e<<1|t.decodeBit(this._models,e);return e-(1<<this._numBitLevels)},ye.BitTreeDecoder.prototype.reverseDecode=function(t){for(var e,r=1,n=0,i=0;i<this._numBitLevels;++i)r=r<<1|(e=t.decodeBit(this._models,r)),n|=e<<i;return n},ye.reverseDecode2=function(t,e,r,n){for(var i,o=1,s=0,a=0;a<n;++a)o=o<<1|(i=r.decodeBit(t,e+o)),s|=i<<a;return s},ye.LenDecoder=function(){this._choice=[],this._lowCoder=[],this._midCoder=[],this._highCoder=new ye.BitTreeDecoder(8),this._numPosStates=0},ye.LenDecoder.prototype.create=function(t){for(;this._numPosStates<t;++this._numPosStates)this._lowCoder[this._numPosStates]=new ye.BitTreeDecoder(3),this._midCoder[this._numPosStates]=new ye.BitTreeDecoder(3)},ye.LenDecoder.prototype.init=function(){var t=this._numPosStates;for(ye.initBitModels(this._choice,2);t--;)this._lowCoder[t].init(),this._midCoder[t].init();this._highCoder.init()},ye.LenDecoder.prototype.decode=function(t,e){return 0===t.decodeBit(this._choice,0)?this._lowCoder[e].decode(t):0===t.decodeBit(this._choice,1)?8+this._midCoder[e].decode(t):16+this._highCoder.decode(t)},ye.Decoder2=function(){this._decoders=[]},ye.Decoder2.prototype.init=function(){ye.initBitModels(this._decoders,768)},ye.Decoder2.prototype.decodeNormal=function(t){var e=1;do{e=e<<1|t.decodeBit(this._decoders,e)}while(e<256);return 255&e},ye.Decoder2.prototype.decodeWithMatchByte=function(t,e){var r,n,i=1;do{if(r=e>>7&1,e<<=1,i=i<<1|(n=t.decodeBit(this._decoders,(1+r<<8)+i)),r!==n){for(;i<256;)i=i<<1|t.decodeBit(this._decoders,i);break}}while(i<256);return 255&i},ye.LiteralDecoder=function(){},ye.LiteralDecoder.prototype.create=function(t,e){var r;if(!this._coders||this._numPrevBits!==e||this._numPosBits!==t)for(this._numPosBits=t,this._posMask=(1<<t)-1,this._numPrevBits=e,this._coders=[],r=1<<this._numPrevBits+this._numPosBits;r--;)this._coders[r]=new ye.Decoder2},ye.LiteralDecoder.prototype.init=function(){for(var t=1<<this._numPrevBits+this._numPosBits;t--;)this._coders[t].init()},ye.LiteralDecoder.prototype.getDecoder=function(t,e){return this._coders[((t&this._posMask)<<this._numPrevBits)+((255&e)>>>8-this._numPrevBits)]},ye.Decoder=function(){this._outWindow=new ye.OutWindow,this._rangeDecoder=new ye.RangeDecoder,this._isMatchDecoders=[],this._isRepDecoders=[],this._isRepG0Decoders=[],this._isRepG1Decoders=[],this._isRepG2Decoders=[],this._isRep0LongDecoders=[],this._posSlotDecoder=[],this._posDecoders=[],this._posAlignDecoder=new ye.BitTreeDecoder(4),this._lenDecoder=new ye.LenDecoder,this._repLenDecoder=new ye.LenDecoder,this._literalDecoder=new ye.LiteralDecoder,this._dictionarySize=-1,this._dictionarySizeCheck=-1,this._posSlotDecoder[0]=new ye.BitTreeDecoder(6),this._posSlotDecoder[1]=new ye.BitTreeDecoder(6),this._posSlotDecoder[2]=new ye.BitTreeDecoder(6),this._posSlotDecoder[3]=new ye.BitTreeDecoder(6)},ye.Decoder.prototype.setDictionarySize=function(t){return!(t<0)&&(this._dictionarySize!==t&&(this._dictionarySize=t,this._dictionarySizeCheck=Math.max(this._dictionarySize,1),this._outWindow.create(Math.max(this._dictionarySizeCheck,4096))),!0)},ye.Decoder.prototype.setLcLpPb=function(t,e,r){var n=1<<r;return!(t>8||e>4||r>4)&&(this._literalDecoder.create(e,t),this._lenDecoder.create(n),this._repLenDecoder.create(n),this._posStateMask=n-1,!0)},ye.Decoder.prototype.init=function(){var t=4;for(this._outWindow.init(!1),ye.initBitModels(this._isMatchDecoders,192),ye.initBitModels(this._isRep0LongDecoders,192),ye.initBitModels(this._isRepDecoders,12),ye.initBitModels(this._isRepG0Decoders,12),ye.initBitModels(this._isRepG1Decoders,12),ye.initBitModels(this._isRepG2Decoders,12),ye.initBitModels(this._posDecoders,114),this._literalDecoder.init();t--;)this._posSlotDecoder[t].init();this._lenDecoder.init(),this._repLenDecoder.init(),this._posAlignDecoder.init(),this._rangeDecoder.init()},ye.Decoder.prototype.decode=function(t,e,r){var n,i,o,s,a,u,l=0,c=0,h=0,f=0,p=0,d=0,v=0;for(this._rangeDecoder.setStream(t),this._outWindow.setStream(e),this.init();r<0||d<r;)if(n=d&this._posStateMask,0===this._rangeDecoder.decodeBit(this._isMatchDecoders,(l<<4)+n))i=this._literalDecoder.getDecoder(d++,v),v=l>=7?i.decodeWithMatchByte(this._rangeDecoder,this._outWindow.getByte(c)):i.decodeNormal(this._rangeDecoder),this._outWindow.putByte(v),l=l<4?0:l-(l<10?3:6);else{if(1===this._rangeDecoder.decodeBit(this._isRepDecoders,l))o=0,0===this._rangeDecoder.decodeBit(this._isRepG0Decoders,l)?0===this._rangeDecoder.decodeBit(this._isRep0LongDecoders,(l<<4)+n)&&(l=l<7?9:11,o=1):(0===this._rangeDecoder.decodeBit(this._isRepG1Decoders,l)?s=h:(0===this._rangeDecoder.decodeBit(this._isRepG2Decoders,l)?s=f:(s=p,p=f),f=h),h=c,c=s),0===o&&(o=2+this._repLenDecoder.decode(this._rangeDecoder,n),l=l<7?8:11);else if(p=f,f=h,h=c,o=2+this._lenDecoder.decode(this._rangeDecoder,n),l=l<7?7:10,(a=this._posSlotDecoder[o<=5?o-2:3].decode(this._rangeDecoder))>=4){if(c=(2|1&a)<<(u=(a>>1)-1),a<14)c+=ye.reverseDecode2(this._posDecoders,c-a-1,this._rangeDecoder,u);else if(c+=this._rangeDecoder.decodeDirectBits(u-4)<<4,(c+=this._posAlignDecoder.reverseDecode(this._rangeDecoder))<0){if(-1===c)break;return!1}}else c=a;if(c>=d||c>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(c,o),d+=o,v=this._outWindow.getByte(0)}return this._outWindow.flush(),this._outWindow.releaseStream(),this._rangeDecoder.releaseStream(),!0},ye.Decoder.prototype.setDecoderProperties=function(t){var e,r,n,i,o;return!(t.size<5)&&(r=(e=t.readByte())%9,n=(e=~~(e/9))%5,i=~~(e/5),!!this.setLcLpPb(r,n,i)&&(o=t.readByte(),o|=t.readByte()<<8,o|=t.readByte()<<16,o+=16777216*t.readByte(),this.setDictionarySize(o)))},ye.decompress=function(t,e,r,n){var i=new ye.Decoder;if(!i.setDecoderProperties(t))throw"Incorrect stream properties";if(!i.decode(e,r,n))throw"Error in data stream";return!0},ye.decompressFile=function(t,e){var r,n=new ye.Decoder;if(!n.setDecoderProperties(t))throw"Incorrect stream properties";if(r=t.readByte(),r|=t.readByte()<<8,r|=t.readByte()<<16,r+=16777216*t.readByte(),t.readByte(),t.readByte(),t.readByte(),t.readByte(),!n.decode(t,e,r))throw"Error in data stream";return!0};var be=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.floorIndex=0,e.needsRender=!0,e}return st(e,t),e.prototype.disposeGeometry=function(){this.traverse((function(t){t instanceof St&&t.geometry.dispose()}))},e}(s.Group);const xe=l.Reader,we=l.util,Se=l.roots["@REALSEE/FIVE:five/server/model/proto/dome.proto"]||(l.roots["@REALSEE/FIVE:five/server/model/proto/dome.proto"]={}),Ae=Se.Model=(()=>{function t(t){if(this.meshes=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.meshes=we.emptyArray,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Model;for(;t.pos<r;){let e=t.uint32();if(e>>>3==1)n.meshes&&n.meshes.length||(n.meshes=[]),n.meshes.push(Se.Mesh.decode(t,t.uint32()));else t.skipType(7&e)}return n},t})();Se.Mesh=(()=>{function t(t){if(this.chunks=[],this.matrix=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.name="",t.prototype.chunks=we.emptyArray,t.prototype.matrix=we.emptyArray,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Mesh;for(;t.pos<r;){let e=t.uint32();switch(e>>>3){case 1:n.name=t.string();break;case 2:n.chunks&&n.chunks.length||(n.chunks=[]),n.chunks.push(Se.Chunk.decode(t,t.uint32()));break;case 3:n.matrix&&n.matrix.length||(n.matrix=[]),n.matrix.push(Se.Matrix.decode(t,t.uint32()));break;default:t.skipType(7&e)}}if(!n.hasOwnProperty("name"))throw we.ProtocolError("missing required 'name'",{instance:n});return n},t})(),Se.Matrix=(()=>{function t(t){if(this.elements=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.elements=we.emptyArray,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Matrix;for(;t.pos<r;){let e=t.uint32();if(e>>>3==1)if(n.elements&&n.elements.length||(n.elements=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.elements.push(t.float())}else n.elements.push(t.float());else t.skipType(7&e)}return n},t})(),Se.Chunk=(()=>{function t(t){if(this.material=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.geometry=null,t.prototype.material=we.emptyArray,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Chunk;for(;t.pos<r;){let e=t.uint32();switch(e>>>3){case 2:n.geometry=Se.Geometry.decode(t,t.uint32());break;case 3:n.material&&n.material.length||(n.material=[]),n.material.push(Se.Material.decode(t,t.uint32()));break;default:t.skipType(7&e)}}if(!n.hasOwnProperty("geometry"))throw we.ProtocolError("missing required 'geometry'",{instance:n});return n},t})(),Se.Geometry=(()=>{function t(t){if(this.groups=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.position=null,t.prototype.uv=null,t.prototype.uv2=null,t.prototype.normal=null,t.prototype.groups=we.emptyArray,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Geometry;for(;t.pos<r;){let e=t.uint32();switch(e>>>3){case 1:n.position=Se.Position.decode(t,t.uint32());break;case 2:n.uv=Se.UV.decode(t,t.uint32());break;case 3:n.uv2=Se.UV.decode(t,t.uint32());break;case 4:n.normal=Se.Normal.decode(t,t.uint32());break;case 5:n.groups&&n.groups.length||(n.groups=[]),n.groups.push(Se.Group.decode(t,t.uint32()));break;default:t.skipType(7&e)}}if(!n.hasOwnProperty("position"))throw we.ProtocolError("missing required 'position'",{instance:n});if(!n.hasOwnProperty("normal"))throw we.ProtocolError("missing required 'normal'",{instance:n});return n},t})(),Se.Position=(()=>{function t(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.array=we.emptyArray,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Position;for(;t.pos<r;){let e=t.uint32();if(e>>>3==1)if(n.array&&n.array.length||(n.array=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.array.push(t.float())}else n.array.push(t.float());else t.skipType(7&e)}return n},t})(),Se.UV=(()=>{function t(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.array=we.emptyArray,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.UV;for(;t.pos<r;){let e=t.uint32();if(e>>>3==1)if(n.array&&n.array.length||(n.array=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.array.push(t.float())}else n.array.push(t.float());else t.skipType(7&e)}return n},t})(),Se.Normal=(()=>{function t(t){if(this.array=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.array=we.emptyArray,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Normal;for(;t.pos<r;){let e=t.uint32();if(e>>>3==1)if(n.array&&n.array.length||(n.array=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.array.push(t.float())}else n.array.push(t.float());else t.skipType(7&e)}return n},t})(),Se.Group=(()=>{function t(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.start=0,t.prototype.count=0,t.prototype.materialIndex=0,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Group;for(;t.pos<r;){let e=t.uint32();switch(e>>>3){case 1:n.start=t.uint32();break;case 2:n.count=t.uint32();break;case 3:n.materialIndex=t.uint32();break;default:t.skipType(7&e)}}if(!n.hasOwnProperty("start"))throw we.ProtocolError("missing required 'start'",{instance:n});if(!n.hasOwnProperty("count"))throw we.ProtocolError("missing required 'count'",{instance:n});if(!n.hasOwnProperty("materialIndex"))throw we.ProtocolError("missing required 'materialIndex'",{instance:n});return n},t})(),Se.Material=(()=>{function t(t){if(t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.kd=null,t.prototype.ks=null,t.prototype.ke=null,t.prototype.mapkd="",t.prototype.mapks="",t.prototype.mapke="",t.prototype.norm="",t.prototype.mapbump="",t.prototype.bump="",t.prototype.mapd="",t.prototype.ns=0,t.prototype.d=0,t.prototype.tr=0,t.prototype.mapkdrepeat="",t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Material;for(;t.pos<r;){let e=t.uint32();switch(e>>>3){case 1:n.kd=Se.Color.decode(t,t.uint32());break;case 2:n.ks=Se.Color.decode(t,t.uint32());break;case 3:n.ke=Se.Color.decode(t,t.uint32());break;case 4:n.mapkd=t.string();break;case 5:n.mapks=t.string();break;case 6:n.mapke=t.string();break;case 7:n.norm=t.string();break;case 8:n.mapbump=t.string();break;case 9:n.bump=t.string();break;case 10:n.mapd=t.string();break;case 11:n.ns=t.float();break;case 12:n.d=t.float();break;case 13:n.tr=t.float();break;case 14:n.mapkdrepeat=t.string();break;default:t.skipType(7&e)}}return n},t})(),Se.Color=(()=>{function t(t){if(this.rgb=[],t)for(let e=Object.keys(t),r=0;r<e.length;++r)null!=t[e[r]]&&(this[e[r]]=t[e[r]])}return t.prototype.rgb=we.emptyArray,t.decode=function(t,e){t instanceof xe||(t=xe.create(t));let r=void 0===e?t.len:t.pos+e,n=new Se.Color;for(;t.pos<r;){let e=t.uint32();if(e>>>3==1)if(n.rgb&&n.rgb.length||(n.rgb=[]),2==(7&e)){let e=t.uint32()+t.pos;for(;t.pos<e;)n.rgb.push(t.float())}else n.rgb.push(t.float());else t.skipType(7&e)}return n},t})();var Pe={};function Ee(t){var e,r=[];function n(t,e,r){var n=function(t){var e=t.position,r=t.normal,n=t.uv,i=t.uv2,o=t.groups,a=new s.BufferGeometry;return a.setAttribute("position",new s.BufferAttribute(new Float32Array(e.array),3)),r&&a.setAttribute("normal",new s.BufferAttribute(new Float32Array(r.array),3)),n&&a.setAttribute("uv",new s.BufferAttribute(new Float32Array(n.array),2)),i&&a.setAttribute("uv2",new s.BufferAttribute(new Float32Array(i.array),2)),o.forEach((function(t){return a.addGroup(t.start,t.count,t.materialIndex)})),a}(t);n.applyMatrix4(r);var i=new s.Vector3,o=new s.Quaternion,a=new s.Vector3;return r.decompose(i,o,a),a.x*a.y*a.z<0&&n.attributes.normal&&n.attributes.position&&n.attributes.uv&&function(t){for(var e=[0,0,0],r=0;r<t.attributes.normal.array.length/9;r++)e[0]=t.attributes.normal.array[9*r],e[1]=t.attributes.normal.array[9*r+1],e[2]=t.attributes.normal.array[9*r+2],t.attributes.normal.array[9*r]=t.attributes.normal.array[9*r+6],t.attributes.normal.array[9*r+1]=t.attributes.normal.array[9*r+7],t.attributes.normal.array[9*r+2]=t.attributes.normal.array[9*r+8],t.attributes.normal.array[9*r+6]=e[0],t.attributes.normal.array[9*r+7]=e[1],t.attributes.normal.array[9*r+8]=e[2];for(r=0;r<t.attributes.position.array.length/9;r++)e[0]=t.attributes.position.array[9*r],e[1]=t.attributes.position.array[9*r+1],e[2]=t.attributes.position.array[9*r+2],t.attributes.position.array[9*r]=t.attributes.position.array[9*r+6],t.attributes.position.array[9*r+1]=t.attributes.position.array[9*r+7],t.attributes.position.array[9*r+2]=t.attributes.position.array[9*r+8],t.attributes.position.array[9*r+6]=e[0],t.attributes.position.array[9*r+7]=e[1],t.attributes.position.array[9*r+8]=e[2];for(r=0;r<t.attributes.uv.array.length/6;r++)e[0]=t.attributes.uv.array[6*r],e[1]=t.attributes.uv.array[6*r+1],t.attributes.uv.array[6*r]=t.attributes.uv.array[6*r+4],t.attributes.uv.array[6*r+1]=t.attributes.uv.array[6*r+5],t.attributes.uv.array[6*r+4]=e[0],t.attributes.uv.array[6*r+5]=e[1];t.attributes.normal.needsUpdate=!0,t.attributes.position.needsUpdate=!0,t.attributes.uv.needsUpdate=!0}(n),new St(n)}return(e=t,Ae.decode(e).meshes).forEach((function(t){var e=t.name,i=t.chunks,o=t.matrix;"Ceiling"!==e&&"CeilingDrop"!==e&&o.map((function(t){var o,a=new s.Matrix4;if(a.elements=t.elements,1===i.length){var u=i[0],l=u.geometry;u.material;o=n(l,0,a)}else o=new be,i.forEach((function(t,e){var r=t.geometry,i=(t.material,n(r,0,a));i.name="chunk"+e,o.add(i)}));o.floorIndex=0,o.name=e,r.push(o)}))})),{objects:r,createAt:0,description:""}}function _e(){Object.keys(Pe).forEach((function(t){Pe[t].dispose(),delete Pe[t]}))}function Ne(t){return null==t}var Ce=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.needsRender=!0,e}return st(e,t),e.prototype.disposeGeometry=function(){this.traverse((function(t){t instanceof St&&t.geometry.dispose()}))},e}(s.Group),Ie=function(t,e){void 0===e&&(e=1e-4),e=Math.max(e,Number.EPSILON);for(var r={},n=t.getIndex(),i=t.getAttribute("position"),o=n?n.count:i.count,a=0,u=Object.keys(t.attributes),l={},c={},h=[],f=["getX","getY","getZ","getW"],p=0,d=u.length;p<d;p++){l[x=u[p]]=[],(P=t.morphAttributes[x])&&(c[x]=new Array(P.length).fill().map((function(){return[]})))}var v=Math.log10(1/e),y=Math.pow(10,v);for(p=0;p<o;p++){var g=n?n.getX(p):p,m="",b=0;for(d=u.length;b<d;b++)for(var x=u[b],w=(A=t.getAttribute(x)).itemSize,S=0;S<w;S++)m+="".concat(~~(A[f[S]](g)*y),",");if(m in r)h.push(r[m]);else{for(b=0,d=u.length;b<d;b++){x=u[b];var A=t.getAttribute(x),P=t.morphAttributes[x],E=(w=A.itemSize,l[x]),_=c[x];for(S=0;S<w;S++){var N=f[S];if(E.push(A[N](g)),P)for(var C=0,I=P.length;C<I;C++)_[C].push(P[C][N](g))}}r[m]=a,h.push(a),a++}}var R=t.clone();for(p=0,d=u.length;p<d;p++){x=u[p];var D=t.getAttribute(x),z=new D.array.constructor(l[x]);A=new s.BufferAttribute(z,D.itemSize,D.normalized);if(R.setAttribute(x,A),x in c)for(b=0;b<c[x].length;b++){var T=t.morphAttributes[x][b],O=(z=new T.array.constructor(c[x][b]),new s.BufferAttribute(z,T.itemSize,T.normalized));R.morphAttributes[x][b]=O}}return R.setIndex(h),R};function Re(t){var e;return new((e=s.Triangle).bind.apply(e,ut([void 0],t.map((function(t){return new s.Vector3(t.x,t.y,t.z)})),!1)))}var De={at3d:function(t){return Promise.resolve().then((function(){return se(t.file)})).then((function(t){return me(t)})).then((function(t){for(var e,r={chunks:[],createAt:void 0,description:void 0},n=0,i=t;n<i.length;n++){var o=i[n],s=ce.decode(o);s.chunks.length&&((e=r.chunks).push.apply(e,s.chunks),r.createAt=s.createAt,r.description=s.description)}return r})).then((function(t){return ve(t)}))},pbm:function(t){return Promise.resolve().then((function(){return se(t.file)})).then((function(t){var e=new Uint8Array(t);return ce.decode(e)})).then((function(t){return ve(t)}))},dome:function(t){return Promise.resolve().then((function(){return _e()})).then((function(){return se(t.file)})).then((function(t){return Ee(new Uint8Array(t))}))},domez:function(t){return Promise.resolve().then((function(){return _e()})).then((function(){return se(t.file)})).then((function(t){return me(t)})).then((function(t){var e=t.reduce((function(t,e){return t+e.length}),0),r=new Uint8Array(e),n=0;return t.forEach((function(t){r.set(t,n),n+=t.length})),r})).then((function(t){return Ee(t)}))}},ze=function(t){function e(){var e=t.call(this)||this;return e.empty=!1,e.name="model",e.loaded=!1,e.bvhs=[],e.bounding=new s.Box3,e.shownfloor=null,e.floorLength=0,e}return st(e,t),e.prototype.getEdges=function(t){var e;void 0===t&&(t=30/180*Math.PI);for(var r=Math.cos(t),n=[],i=0,o=this.children;i<o.length;i++){var a=o[i];if(a instanceof St){for(var u={},l=["a","b","c"],c=Ie(a.geometry),h=c.getAttribute("position").array,f=(null===(e=c.getIndex())||void 0===e?void 0:e.array)||[],p=[],d=[],v=0,y=h.length;v<y;v+=3)p.push(new s.Vector3(h[v],h[v+1],h[v+2]));for(v=0,y=f.length;v<y;v+=3){var g=f[v],m=f[v+1],b=f[v+2],x=(new s.Vector3).crossVectors(p[m].clone().sub(p[g]),p[b].clone().sub(p[g])).normalize();d.push({a:g,b:m,c:b,normal:x})}for(v=0,y=d.length;v<y;v++)for(var w=d[v],S=0;S<3;S++){var A=w[l[S]],P=w[l[(S+1)%3]],E=[Math.min(A,P),Math.max(A,P)];void 0===u[_=E[0]+"-"+E[1]]?u[_]={index1:E[0],index2:E[1],face1:v}:u[_].face2=v}for(var _ in u){var N=u[_];if(void 0===N.face2||d[N.face1].normal.dot(d[N.face2].normal)<=r){var C=p[N.index1],I=p[N.index2];n.push(new s.Line3(C,I))}}c.dispose(),p.length=0,d.length=0}}return n},e.prototype.hasFloors=function(){return this.hasFloors_()},e.prototype.hasFloors_=function(){var t=[];return this.traverse((function(e){e instanceof St&&(t[e.floorIndex]=!0)})),t.length},e.prototype.show=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=0!==t.length;this.shownfloor=r?t[0]:null,this.needsRender=!0},e.prototype.intersectRaycaster=function(t,e){var r=t.ray,n=r.origin,i=r.direction;if(Ne(e))if(Ne(this.shownfloor)){var o=this.hasFloors();e=[];for(var a=0;a<o;a++)e.push(a)}else e=[this.shownfloor];var u=[],l=[];Array.isArray(e)?l.push.apply(l,e):l.push(e);for(var c=function(e){var r=h.bvhs&&h.bvhs[e];if(r){var o=new pt(n.x,n.y,n.z),a=new pt(i.x,i.y,i.z),l=r.intersectRay(o,a,!0).map((function(t){var e=t.intersectionPoint,r=t.triangle,i=new s.Vector3(e.x,e.y,e.z);return{point:i,face:{normal:Re(r).getNormal(new s.Vector3)},distance:n.distanceTo(i)}}));l.length&&u.push.apply(u,l)}else{var c=[];h.traverse((function(t){t instanceof St&&t.floorIndex===e&&c.push(t)})),(l=t.intersectObjects(c).map((function(t){var e=t.face?{normal:t.face.normal}:void 0;return{point:t.point,face:e,distance:t.distance}}))).length&&u.push.apply(u,l)}},h=this,f=0,p=l;f<p.length;f++){c(p[f])}return u.filter((function(e){var r=e.distance;return r<=t.far&&r>=t.near})).sort((function(t,e){return t.distance-e.distance}))},e.prototype.buildBVH=function(){var t,e=[];this.traverse((function(t){t instanceof St&&(e[t.floorIndex]=e[t.floorIndex]||[],e[t.floorIndex].push(t.geometry))}));var r=e.map((function(t){var e=t.reduce((function(t,e){return t+(e.index?e.index.array.length:e.attributes.position.array.length)}),0),r=new Float32Array(3*e);return t.reduce((function(t,e){for(var n=e.index?e.index.array:null,i=e.attributes.position.array,o=n?n.length:i.length/3,s=0;s<o;s++){var a=3*(t+s),u=n?3*n[s]:3*s;r[a+0]=i[u+0],r[a+1]=i[u+1],r[a+2]=i[u+2]}return t+o}),0),new wt(r,10)}));this.bvhs.length=0,(t=this.bvhs).push.apply(t,r),this.bvhs.loaded=!0,this.emit("bvhLoaded")},e.prototype.load=function(t){var e=this;if(!0===this.loaded)throw new Error("model 只能被 load 一次");var r=De[function(t,e){void 0===e&&(e=[]);var r=/([0-9a-z\.\_\-]+)([\?\#].*)?$/i.exec(t);if(r)for(var n=String(r[1]).trim().split("."),i=0,o=e;i<o.length;i++){var s=o[i];if(n.indexOf(s)>=0)return s}}(t.file,Object.keys(De))||""];if(!r)throw new Error("文件类型错误");return r(t).then((function(t){var r=t.createAt,n=t.description,i=t.objects;e.userData.createAt=r,e.userData.description=n,e.bounding.makeEmpty();for(var o=e.originModel=new Ce,s=0,a=i;s<a.length;s++){var u=a[s];u.traverse((function(t){if(t instanceof St){var r=t.geometry;r.boundingBox||r.computeBoundingBox(),r.boundingSphere||r.computeBoundingSphere(),e.bounding.union(r.boundingBox)}})),o.add(u)}e.add(o),e.floorLength=e.hasFloors_(),e.emit("geometryLoaded"),e.emit("loaded"),e.loaded=!0})).catch((function(t){return e.emit("error",t),Promise.reject(t)}))},e.prototype.dispose=function(){for(this.off(),this.disposeGeometry();this.children.length;)this.remove(this.children[0]);this.bvhs.length=0,delete this.bvhs.loaded},e}(be);Object.assign(ze.prototype,{on:Vt.prototype.on,once:Vt.prototype.once,off:Vt.prototype.off,emit:Vt.prototype.emit,hasListener:Vt.prototype.hasListener});function Te(t,e,r){return t<e?e:t>r?r:t}function Oe(t){return 0===t.indexOf("//")||/^[0-9a-z]+\:/i.test(t)}function He(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=[];t=t.map((function(t){return(null!=t?t:"").trim()})).filter((function(t){return t.length>0&&!/^\/+$/.test(t)}));for(var n=0;n<t.length;n++){var i=0===n,o=n===t.length-1,s=t[n];i||(s=s.replace(/^\/+/,"")),o||(s=s.replace(/\/+$/,"")),r.push(s)}return r.join("/")}function Be(t,e){if(t===e)return!0;if(t&&e&&"object"==typeof t&&"object"==typeof e){if(t.constructor!==e.constructor)return!1;var r,n,i;if(Array.isArray(t)){if((r=t.length)!=e.length)return!1;for(n=r;0!=n--;)if(!Be(t[n],e[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if((r=(i=Object.keys(t)).length)!==Object.keys(e).length)return!1;for(n=r;0!=n--;)if(!Object.prototype.hasOwnProperty.call(e,i[n]))return!1;for(n=r;0!=n--;){var o=i[n];if(!Be(t[o],e[o]))return!1}return!0}return t!=t&&e!=e}function qe(t){return"number"==typeof t}var ke=function(){return new Error("Invalid input.")},Ve=function(){return new Error("Invalid certificate.")},Ue=function(){return new Error("Invalid signature.")};function Fe(t,e){void 0===e&&(e=!1);var r=typeof t;if("string"===r)return JSON.stringify(t);if(!0===t)return"true";if(!1===t)return"false";if(null===t)return"null";if(t instanceof Array){for(var n="[",i=t.length-1,o=0;o<i;o++)n+=Fe(t[o],!1)+",";return i>-1&&(n+=Fe(t[o],!1)),n+"]"}if(t instanceof Object){if("function"==typeof t.toJSON)return Fe(t.toJSON(),e);var s=Object.keys(t).sort(),a=s.length;for(n="",o=0;o<a;){var u=s[o],l=Fe(t[u],!0);void 0!==l&&(o&&""!==n&&(n+=","),n+=JSON.stringify(u)+":"+l),o++}return"{"+n+"}"}switch(r){case"function":case"undefined":return e?void 0:null;case"number":return 0;default:return isFinite(t)?t:null}}function Me(t){return String(Fe(t,!1))}function Ke(t){var e,r,n;if(Array.isArray(t)){var i,o,s=void 0;if(t.length<=0)return ke();for(var a=function(e){var r=Ke(t[e]);if(r instanceof Error)return{value:r};if(s){if(s!==r.issuer)return{value:Ve()}}else s=r.issuer;i?r.expire.getTime()<i.getTime()&&(i=r.expire):i=r.expire,o=o?o.filter((function(t){return-1!==r.allowHosts.indexOf(t)})):r.allowHosts},u=0;u<t.length;u++){var l=a(u);if("object"==typeof l)return l.value}return Mt({issuer:s,expire:i,allowHosts:o})}var c=JSON.parse(t),h="undefined"!=typeof location?location.hostname:"",f=Date.now();if("object"!=typeof c)return ke();var p=new Date("string"==typeof c.expire_at&&/^\d+$/.test(c.expire_at)?Number(c.expire_at):c.expire_at),d=Array.isArray(c.allow_hosts)?c.allow_hosts:[];if(0===h.length||/^(([1-9]?\d|1\d\d|2[0-4]\d|25[0-5])(\.(?!$)|$)){4}$/.test(h)||jt.filter((function(t){return Lt(t,h)})).length>0){var v=String(null!==(e=c.certificate)&&void 0!==e?e:"");if(v){var y=new $;return y.readCertPEM(v),Mt({issuer:y.getSubjectString(),expire:p,allowHosts:d})}return Mt({issuer:"none",expire:p,allowHosts:d})}var g=String(null!==(r=c.certificate)&&void 0!==r?r:"");if(!g)return Ve();var m=new $;m.readCertPEM(g);var b=String(null!==(n=c._signature)&&void 0!==n?n:"");if(!b)return Ue();var x=Me(function(t,e){for(var r={},n=0,i=Object.keys(t);n<i.length;n++){var o=i[n];-1===e.indexOf(o)&&(r[o]=t[o])}return r}(c,["_signature"]));return!1===function(t,e,r){var n=new $;if("string"==typeof r?n.readCertPEM(r):n.readCertHex(r.hex),!1===it(n))return!1;var i=new I;return i.readCertPubKeyHex(n.hex,6),!!i.verify(t,_(e))}(x,b,m)?Ue():f<p.getTime()?0===d.filter((function(t){return Lt(t,h)})).length?function(t){return new Error("host(".concat(JSON.stringify(t),") is not allowed."))}(h):Mt({issuer:m.getSubjectString(),expire:p,allowHosts:d}):function(t){return new Error("date(".concat(t.toString(),") expired."))}(p)}var Le=new WeakMap,je=function(){function t(){this.name="",this.workCode="",this.expire=new Date,this.allowHosts=[],this.initial={mode:"Panorama",latitude:0,longitude:0,panoIndex:0,fov:80},this.observers=[],this.boundingBox=new s.Box3,this.issuer="none",this.raw={works:[""],options:""}}return t.prototype.toJSON=function(){return this.raw.works},t.parse=We,t}();function Ye(t){return null==t?"null":Array.isArray(t)?"array":"object"==typeof t?"dict":"value"}function Qe(t,e){var r=Ye(t),n=Ye(e);if("null"===n)return t;if("value"===n)return e;if(n!==r)return JSON.parse(JSON.stringify(e));if("array"===n)for(var i=0;i<e.length;i++)t[i]=Qe(t[i],e[i]);else if("dict"===n)for(var o in e)t[o]=Qe(t[o],e[o]);return t}function Ze(t,e,r){for(var n,i=JSON.stringify(e),o=[],a=0,u=[].concat(t);a<u.length;a++){var l=u[a];l instanceof je?o.push.apply(o,l.raw.works):"string"==typeof l?o.push(l):o.push(JSON.stringify(l))}var c=Ke(o);if(c instanceof Error)return c;e=JSON.parse(i),t=o.map((function(t){return JSON.parse(t)})).reduce((function(t,e){return Qe(t,e)}));var h=new je;if(c instanceof Error)return c;h.issuer=c.issuer,h.expire=c.expire,h.allowHosts=c.allowHosts,h.raw={works:o,options:i};var f=null!==(n=t.base_url)&&void 0!==n?n:"";f&&"/"!==f[f.length-1]&&(f+="/");var p=function(t,e){return 0===t.indexOf(e)},d=function(t,n){var i,o=t;if(!0===e.jsonp){o=t.replace(/([\?\#].*)?$/i,"");var s=tt("".concat(o)).slice(0,7);o="".concat(o,".").concat(s,".jsonp")}if(!0===e.shortPath){var a=o.replace(f,"").split("."),u=null!==(i=a.shift())&&void 0!==i?i:"",l=a.join(".");o=He(f,tt(u))+(l?"."+l:"")}var c=o.replace(f,"");return e.baseURL&&(o=He(e.baseURL,c)),r&&r(t,o,c,n),o},v=function(e,r){var n,i,o,s,a,u,l=e;if(!Oe(e)){var c=null!==(u=null!==(s=null!==(i=null===(n=t.panorama)||void 0===n?void 0:n.pano_high_cube_base_url)&&void 0!==i?i:null===(o=t.panorama)||void 0===o?void 0:o.pano_cube_base_url)&&void 0!==s?s:null===(a=t.panorama)||void 0===a?void 0:a.base_url)&&void 0!==u?u:"";c&&(c=He(c,String(r))),l=He(c,l)}return Oe(l)||(l=He(f,l)),p(l,f)||console.warn("".concat(l," is not start with base_url(").concat(f,").")),d(l,"panorama")},y=function(t){var e=t;return Oe(e)||(e=He(f,t)),p(e,f)||console.warn("".concat(e," is not start with base_url(").concat(f,").")),d(e,"model")},g=function(t,e){void 0===e&&(e="");var r=t;return Oe(r)||(r=He(e,r)),Oe(r)||(r=He(f,r)),p(r,f)||console.warn("".concat(r," is not start with base_url(").concat(f,").")),d(r,"texture")};if(c instanceof Error)return c;if(h.workCode=String(t.work_code||t.code||t.vr_code||t.workCode),h.name=String(t.name),c instanceof Error)return c;if(t.model){var m={bvh:!0,async:!1,textureBase:"",textures:[]};"boolean"==typeof e.modelBvh?m.bvh=e.modelBvh:"boolean"==typeof t.model.bvh?m.bvh=t.model.bvh:"boolean"==typeof t.bvh&&(m.bvh=t.bvh),t.model.file?m.file=y(t.model.file):t.model.file_url&&(m.file=y(t.model.file_url)),t.model.textureBase?m.textureBase=g("",t.model.textureBase):t.model.material_base_url?m.textureBase=g("",t.model.material_base_url):m.file&&(m.textureBase=m.file.split("/").slice(0,-1).join("/").replace("/model/","/materials/")),Array.isArray(t.model.textures)?m.textures=t.model.textures.map((function(e){var r,n;return g(e,null!==(n=null!==(r=t.model.textureBase)&&void 0!==r?r:t.model.material_base_url)&&void 0!==n?n:"")})):Array.isArray(t.model.material_textures)&&(m.textures=t.model.material_textures.map((function(e){var r,n;return g(e,null!==(n=null!==(r=t.model.textureBase)&&void 0!==r?r:t.model.material_base_url)&&void 0!==n?n:"")}))),t.model.tiles&&(m.tiles=t.model.tiles),m.file&&(h.model=m)}if(c instanceof Error)return c;if(t.observers&&Array.isArray(t.observers)){var b=[];t.panorama&&(Array.isArray(t.panorama)?b=t.panorama:Array.isArray(t.panorama.list)?b=t.panorama.list:Array.isArray(t.panorama.info)&&(b=t.panorama.info));for(var x=0;x<t.observers.length;x++){var w={},S=t.observers[x];if(!S)break;var A=b[x];if(!A)break;S=Object.assign({},S,A,{active:!1!==S.active&&!1!==A.active}),w.panoIndex=x,w.active=!1!==S.active,w.loadable=!0===S.loadable,w.derivedId=S.derived_id,w.images={up:v(S.images?S.images.up:S.up,x),down:v(S.images?S.images.down:S.down,x),right:v(S.images?S.images.right:S.right,x),left:v(S.images?S.images.left:S.left,x),front:v(S.images?S.images.front:S.front,x),back:v(S.images?S.images.back:S.back,x)};var P=S.images?S.images.depth:S.depth;P&&(w.images.depth=v(P,x));var E=S.images?S.images.luminance:S.luminance;E&&(w.images.luminance={up:v(E.up,x),down:v(E.down,x),right:v(E.right,x),left:v(E.left,x),front:v(E.front,x),back:v(E.back,x)});var _=S.images?S.images.tiles:S.tiles;if(_){for(var N=[],C=function(t){var e,r=t.match(/\/cube_(\d+)\//);if(r){var n=Number(r[1]);if(0==((e=n)&e-1)&&0!==e)return n}return!1},I=function(t,e){return t.replace(/\/cube_(\d+)\//,(function(){return"/cube_".concat(e,"/")}))},R=0,D=_;R<D.length;R++){var z=D[R];if("number"==typeof z){var T=z,O=C(w.images.front);if(!1===O)continue;if((F=Math.max(O,512*Math.pow(2,T)))>2048){var H=I(w.images.up,F),B=I(w.images.down,F),q=I(w.images.right,F),k=I(w.images.left,F),V=I(w.images.front,F),U=I(w.images.back,F);N.push({level:T,size:F,up:H,down:B,right:q,left:k,front:V,back:U})}else{H=w.images.up,B=w.images.down,q=w.images.right,k=w.images.left,V=w.images.front,U=w.images.back;N.push({level:T,size:F,up:H,down:B,right:q,left:k,front:V,back:U})}}else{var F;if("number"!=typeof(T=z.level))continue;if("number"!=typeof(F=z.size))continue;H=v(z.up,x),B=v(z.down,x),q=v(z.right,x),k=v(z.left,x),V=v(z.front,x),U=v(z.back,x);N.push({level:T,size:F,up:H,down:B,right:q,left:k,front:V,back:U})}}N.sort((function(t,e){return t.level-e.level})),w.images.tiles=N}if(S.position instanceof s.Vector3)w.position=S.position.clone();else{if(!Array.isArray(S.position))break;w.position=(new s.Vector3).fromArray(S.position)}if(S.standingPosition instanceof s.Vector3)w.standingPosition=S.standingPosition.clone();else if(Array.isArray(S.standingPosition))w.standingPosition=(new s.Vector3).fromArray(S.standingPosition);else if(S.standing_position instanceof s.Vector3)w.standingPosition=S.standing_position.clone();else{if(!Array.isArray(S.standing_position))break;w.standingPosition=(new s.Vector3).fromArray(S.standing_position)}if(S.quaternion instanceof s.Quaternion)w.quaternion=S.quaternion.clone();else if(Array.isArray(S.quaternion))w.quaternion=(new s.Quaternion).fromArray(S.quaternion);else{if(!S.quaternion)break;var M=S.quaternion,K=M.x,L=M.y,j=M.z,Y=M.w;w.quaternion=new s.Quaternion(K,L,j,Y)}if(Array.isArray(S.accessibleNodes)?w.accessibleNodes=S.accessibleNodes.slice():Array.isArray(S.accessible_nodes)&&(w.accessibleNodes=S.accessible_nodes.slice()),Array.isArray(S.visibleNodes)?w.visibleNodes=S.visibleNodes.slice():Array.isArray(S.visible_nodes)&&(w.visibleNodes=S.visible_nodes.slice()),qe(S.floorIndex)?w.floorIndex=S.floorIndex:qe(S.floor_index)?w.floorIndex=S.floor_index:w.floorIndex=0,S.video){var Q={};"string"==typeof S.video.source&&(Q.source=S.video.source),S.video.matrix instanceof s.Matrix4?Q.matrix=S.video.matrix.clone():Array.isArray(S.video.matrix)&&(Q.matrix=(new s.Matrix4).fromArray(S.video.matrix)),S.video.size instanceof s.Vector2?Q.size=S.video.size.clone():Array.isArray(S.video.size)&&(Q.size=(new s.Vector2).fromArray(S.video.size)),Q.source&&Q.matrix&&Q.size&&(w.video=Q)}h.observers[x]=w}}if(c instanceof Error)return c;for(var Z=0,W=h.observers;Z<W.length;Z++){if((w=W[Z]).accessibleNodes)w.accessibleNodes=w.accessibleNodes.filter((function(t){return t<h.observers.length}));else{w.accessibleNodes=[];for(var G=0;G<h.observers.length;G++)h.observers[G]!==w&&w.accessibleNodes.push(G)}if(w.visibleNodes)w.visibleNodes=w.visibleNodes.filter((function(t){return t<h.observers.length}));else{w.visibleNodes=[];for(G=0;G<h.observers.length;G++)h.observers[G]!==w&&w.visibleNodes.push(G)}}if(c instanceof Error)return c;if(t.initial)if("Floorplan"!==t.initial.mode&&"Topview"!==t.initial.mode&&"Panorama"!==t.initial.mode&&"VRPanorama"!==t.initial.mode&&"Model"!==t.initial.mode&&"DepthPanorama"!==t.initial.mode||(h.initial.mode=t.initial.mode),qe(t.initial.latitude)&&(h.initial.latitude=t.initial.latitude),qe(t.initial.longitude)?h.initial.longitude=t.initial.longitude:qe(t.initial.heading)&&(h.initial.longitude=-(360*(t.initial.heading-.25)+90)/180*Math.PI),qe(t.initial.fov)&&(h.initial.fov=t.initial.fov),qe(t.initial.panoIndex)){var J=h.observers.length>0?h.observers.length-1:0;h.initial.panoIndex=Te(t.initial.panoIndex,0,J)}else if(qe(t.initial.pano_index)){J=h.observers.length>0?h.observers.length-1:0;h.initial.panoIndex=Te(t.initial.pano_index,0,J)}else if(qe(t.initial.pano)){J=h.observers.length>0?h.observers.length-1:0;h.initial.panoIndex=Te(t.initial.pano,0,J)}if(c instanceof Error)return c;h.boundingBox.makeEmpty();for(var X=0,$=h.observers;X<$.length;X++){w=$[X];h.boundingBox.expandByPoint(w.standingPosition),h.boundingBox.expandByPoint((new s.Vector3).fromArray([w.position.x,2*w.position.y-w.standingPosition.y,w.position.z]))}if(c instanceof Error)return c;var et=Mt(h);return Le.set(et,{works:o,options:i}),et}function We(t,e,r){"string"==typeof t&&"{"===t.trim()[0]&&(t=JSON.parse(t));var n=Le.get(t);if(n){if(e&&!Be(JSON.parse(n.options),e))throw new Error("[PARSE FAILED]: work is parsed with different options.");return t}var i=Ze(t,null!=e?e:{},r);if(i instanceof Error)throw new Error("[PARSE FAILED]: "+i.message+"\nError work input:\n"+JSON.stringify(t));return i}exports.BVH=wt,exports.BVHIntersect=xt,exports.BVHNode=dt,exports.BVHVector3=pt,exports.Model=ze,exports.PBMContainer=Ce,exports.PBMGroup=be,exports.PBMMesh=St,exports.Subscribe=Vt,exports.Work=je,exports.parseWork=We;
|