@soonspacejs/plugin-soonbuilder-loader 2.6.23 → 2.6.24
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/dist/index.d.ts +1 -1
- package/dist/index.esm.js +16 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -1 +1,16 @@
|
|
|
1
|
-
class t{constructor(t){this.ssp=t,this.treeData=[],this.modelData=[]}async load(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{xmlToJson:i,isArray:s,isObject:l}=this.ssp.utils,o=e?`${t}/FileInfo.xml`:t;this.fileInfo=await i(o);const r=o.split("FileInfo.xml")[0],a=this.fileInfo.folder._attributes.name;this.sceneInfo=await i(`${r}${a}.xml`);const{Project:{Building:{Floors:n,SpaceInfo:u,ObjectHierarchy:c}}}=this.sceneInfo,h=async t=>{var e,i,o;const{_attributes:a,FileSource:n}=t,{id:u,name:h}=a,{name:d}=n._attributes,p={id:u,name:h,url:this._pathModeChange(r,d),children:[],userData:t};this._pushModelData(p);const f=await this.ssp.loadModelToGroup({id:`${p.id}_group`},[p]);if(!f)return;let _=null;if(s(c.Entity))_=c.Entity.find((t=>{let{_attributes:{id:e,type:i}}=t;return"Floor"===i&&e===u}));else if(l(c.Entity)){const{id:t,type:e}=c.Entity._attributes;t===u&&"Floor"===e&&(_=c.Entity)}if(!_)return;let b=null;if(s(_.Entity)?b=_.Entity.filter((t=>{let{_attributes:{type:e}}=t;return"FACILITY"===e})):l(c.Entity)&&"FACILITY"===_.Entity._attributes.type&&(b=_.Entity),b){for(let t=0;t<b.length;t++){const{id:s,longname:l,visible:a,position:n,eular:u,scale:c}=Object.assign(Object.assign({},b[t]._attributes),null!==(i=null===(e=b[t].Properties)||void 0===e?void 0:e._attributes)&&void 0!==i?i:{}),h={id:s,name:l,url:this._pathModeChange(r,`/${l}.sbm`),visible:this._text2Bool(a),position:this._text2IVector3(n),rotation:this._text2IVector3(u),scale:this._text2IVector3(c),userData:b[t]},d=await this.ssp.loadModel(h);d&&(this.ssp.addObject(d,f),this._pushModelData(h),null===(o=p.children)||void 0===o||o.push(h))}this.treeData.push(p)}};if(s(n.Floor))for(let t=0;t<n.Floor.length;t++)await h(n.Floor[t]);else l(n.Floor)&&await h(n.Floor)}_pushModelData(t){this.modelData.find((e=>{let{url:i}=e;return i===t.url}))||this.modelData.push(t)}_text2IVector3(t){const e=t.split(", ");return{x:Number(e[0]),y:Number(e[1]),z:Number(e[2])}}_text2Bool(t){return"True"===t}_pathModeChange(t,e){const i=t+e;if(i.includes("://")){const t=i.split("://");return t[0]+"://"+t[1].replace("\\","/").replace("./","/").replace("//","/")}return i.replace("\\","/").replace("./","/").replace("//","/")}}export{t as default};
|
|
1
|
+
import*as t from"three";import{Vector3 as e,Scene as r,Matrix4 as n,Quaternion as i,Euler as o,PerspectiveCamera as s,GLBufferAttribute as a,InterleavedBufferAttribute as u,BufferAttribute as h,Box3 as c,Vector4 as f,TextureLoader as l,Float32BufferAttribute as p}from"three";import"three/examples/jsm/loaders/RGBELoader.js";import"three/examples/jsm/exporters/GLTFExporter.js";import"three/examples/jsm/environments/RoomEnvironment.js";import"three/examples/jsm/libs/stats.module.js";import"three/examples/jsm/objects/Sky.js";import{deinterleaveGeometry as d}from"three/examples/jsm/utils/BufferGeometryUtils.js";import{WorkerPool as v}from"three/examples/jsm/utils/WorkerPool.js";import{MeshBVH as g}from"three-mesh-bvh";var y="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function m(){throw new Error("setTimeout has not been defined")}function b(){throw new Error("clearTimeout has not been defined")}var w=m,S=b;function E(t){if(w===setTimeout)return setTimeout(t,0);if((w===m||!w)&&setTimeout)return w=setTimeout,setTimeout(t,0);try{return w(t,0)}catch(e){try{return w.call(null,t,0)}catch(e){return w.call(this,t,0)}}}"function"==typeof y.setTimeout&&(w=setTimeout),"function"==typeof y.clearTimeout&&(S=clearTimeout);var _,T=[],I=!1,D=-1;function O(){I&&_&&(I=!1,_.length?T=_.concat(T):D=-1,T.length&&x())}function x(){if(!I){var t=E(O);I=!0;for(var e=T.length;e;){for(_=T,T=[];++D<e;)_&&_[D].run();D=-1,e=T.length}_=null,I=!1,function(t){if(S===clearTimeout)return clearTimeout(t);if((S===b||!S)&&clearTimeout)return S=clearTimeout,clearTimeout(t);try{S(t)}catch(e){try{return S.call(null,t)}catch(e){return S.call(this,t)}}}(t)}}function j(t,e){this.fun=t,this.array=e}j.prototype.run=function(){this.fun.apply(null,this.array)};function R(){}var P=R,A=R,B=R,N=R,M=R,V=R,C=R;var L=y.performance||{},F=L.now||L.mozNow||L.msNow||L.oNow||L.webkitNow||function(){return(new Date).getTime()};var q=new Date;var k={nextTick:function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];T.push(new j(t,e)),1!==T.length||I||E(x)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:P,addListener:A,once:B,off:N,removeListener:M,removeAllListeners:V,emit:C,binding:function(t){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(t){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(t){var e=.001*F.call(L),r=Math.floor(e),n=Math.floor(e%1*1e9);return t&&(r-=t[0],(n-=t[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-q)/1e3}},H="undefined"==typeof self&&void 0!==k&&k.hrtime?function(){var t=k.hrtime();return 1e3*t[0]+t[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},U=new(function(){function t(){this._tweens={},this._tweensAddedDuringUpdate={}}return t.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map((function(e){return t._tweens[e]}))},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},t.prototype.remove=function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},t.prototype.update=function(t,e){void 0===t&&(t=H()),void 0===e&&(e=!1);var r=Object.keys(this._tweens);if(0===r.length)return!1;for(;r.length>0;){this._tweensAddedDuringUpdate={};for(var n=0;n<r.length;n++){var i=this._tweens[r[n]],o=!e;i&&!1===i.update(t,o)&&!e&&delete this._tweens[r[n]]}r=Object.keys(this._tweensAddedDuringUpdate)}return!0},t}());U.getAll.bind(U),U.removeAll.bind(U),U.add.bind(U),U.remove.bind(U),U.update.bind(U),new e,new e,new e;var z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function G(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var r=function t(){if(this instanceof t){var r=[null];return r.push.apply(r,arguments),new(Function.bind.apply(e,r))}return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var n=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,n.get?n:{enumerable:!0,get:function(){return t[e]}})})),r}var K={},W={},Z=function(t,e){return Z=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])},Z(t,e)};var Y=function(){return Y=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},Y.apply(this,arguments)};var $=Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]};function X(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Q(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,o=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function J(t){return this instanceof J?(this.v=t,this):new J(t)}var tt=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};var et=Object.freeze({__proto__:null,get __assign(){return Y},__asyncDelegator:function(t){var e,r;return e={},n("next"),n("throw",(function(t){throw t})),n("return"),e[Symbol.iterator]=function(){return this},e;function n(n,i){e[n]=t[n]?function(e){return(r=!r)?{value:J(t[n](e)),done:!1}:i?i(e):e}:i}},__asyncGenerator:function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(t,e||[]),o=[];return n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n;function s(t){i[t]&&(n[t]=function(e){return new Promise((function(r,n){o.push([t,e,r,n])>1||a(t,e)}))})}function a(t,e){try{(r=i[t](e)).value instanceof J?Promise.resolve(r.value.v).then(u,h):c(o[0][2],r)}catch(t){c(o[0][3],t)}var r}function u(t){a("next",t)}function h(t){a("throw",t)}function c(t,e){t(e),o.shift(),o.length&&a(o[0][0],o[0][1])}},__asyncValues:function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=X(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise((function(n,i){(function(t,e,r,n){Promise.resolve(n).then((function(e){t({value:e,done:r})}),e)})(n,i,(e=t[r](e)).done,e.value)}))}}},__await:J,__awaiter:function(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))},__classPrivateFieldGet:function(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)},__classPrivateFieldIn:function(t,e){if(null===e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof t?e===t:t.has(e)},__classPrivateFieldSet:function(t,e,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(t,r):i?i.value=r:e.set(t,r),r},__createBinding:$,__decorate:function(t,e,r,n){var i,o=arguments.length,s=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,r,s):i(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s},__esDecorate:function(t,e,r,n,i,o){function s(t){if(void 0!==t&&"function"!=typeof t)throw new TypeError("Function expected");return t}for(var a,u=n.kind,h="getter"===u?"get":"setter"===u?"set":"value",c=!e&&t?n.static?t:t.prototype:null,f=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),l=!1,p=r.length-1;p>=0;p--){var d={};for(var v in n)d[v]="access"===v?{}:n[v];for(var v in n.access)d.access[v]=n.access[v];d.addInitializer=function(t){if(l)throw new TypeError("Cannot add initializers after decoration has completed");o.push(s(t||null))};var g=(0,r[p])("accessor"===u?{get:f.get,set:f.set}:f[h],d);if("accessor"===u){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(a=s(g.get))&&(f.get=a),(a=s(g.set))&&(f.set=a),(a=s(g.init))&&i.push(a)}else(a=s(g))&&("field"===u?i.push(a):f[h]=a)}c&&Object.defineProperty(c,n.name,f),l=!0},__exportStar:function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||$(e,t,r)},__extends:function(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}Z(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},__generator:function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},__importDefault:function(t){return t&&t.__esModule?t:{default:t}},__importStar:function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&$(e,t,r);return tt(e,t),e},__makeTemplateObject:function(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t},__metadata:function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param:function(t,e){return function(r,n){e(r,n,t)}},__propKey:function(t){return"symbol"==typeof t?t:"".concat(t)},__read:Q,__rest:function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r},__runInitializers:function(t,e,r){for(var n=arguments.length>2,i=0;i<e.length;i++)r=n?e[i].call(t,r):e[i].call(t);return n?r:void 0},__setFunctionName:function(t,e,r){return"symbol"==typeof e&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})},__spread:function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Q(arguments[e]));return t},__spreadArray:function(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))},__spreadArrays:function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),i=0;for(e=0;e<r;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,i++)n[i]=o[s];return n},__values:X}),rt=G(et),nt={},it={},ot={},st={};Object.defineProperty(st,"__esModule",{value:!0});var at=function(){function t(e,r){if(void 0===r&&(r=null),this.nonEmpty=!1,e||r){if(!e)throw new Error("Parameter head cannot be null.");this.head=e,this.tail=r||t.NIL,this.nonEmpty=!0}else{if(t.NIL)throw new Error("Parameters head and tail are null. Use the NIL element instead.");this.nonEmpty=!1}}return Object.defineProperty(t.prototype,"length",{get:function(){if(!this.nonEmpty)return 0;if(this.tail===t.NIL)return 1;for(var e=0,r=this;r.nonEmpty;)++e,r=r.tail;return e},enumerable:!0,configurable:!0}),t.prototype.prepend=function(e){return new t(e,this)},t.prototype.append=function(e){if(!e)return this;if(!this.nonEmpty)return new t(e);if(this.tail===t.NIL)return new t(e).prepend(this.head);for(var r=new t(this.head),n=r,i=this.tail;i.nonEmpty;)n=n.tail=new t(i.head),i=i.tail;return n.tail=new t(e),r},t.prototype.insertWithPriority=function(e){if(!this.nonEmpty)return new t(e);var r=e.priority;if(r>this.head.priority)return this.prepend(e);for(var n=new t(this.head),i=n,o=this.tail;o.nonEmpty;){if(r>o.head.priority)return i.tail=o.prepend(e),n;i=i.tail=new t(o.head),o=o.tail}return i.tail=new t(e),n},t.prototype.filterNot=function(e){if(!this.nonEmpty||null==e)return this;if(e===this.head.listener)return this.tail;for(var r=new t(this.head),n=r,i=this.tail;i.nonEmpty;){if(i.head.listener===e)return n.tail=i.tail,r;n=n.tail=new t(i.head),i=i.tail}return this},t.prototype.contains=function(t){if(!this.nonEmpty)return!1;for(var e=this;e.nonEmpty;){if(e.head.listener===t)return!0;e=e.tail}return!1},t.prototype.find=function(t){if(!this.nonEmpty)return null;for(var e=this;e.nonEmpty;){if(e.head.listener===t)return e.head;e=e.tail}return null},t.prototype.toString=function(){for(var t="",e=this;e.nonEmpty;)t+=e.head+" -> ",e=e.tail;return"[List "+(t+="NIL")+"]"},t.NIL=new t(null,null),t}();st.SlotList=at;var ut={};Object.defineProperty(ut,"__esModule",{value:!0});var ht=function(){function t(t,e,r,n){void 0===r&&(r=!1),void 0===n&&(n=0),this._enabled=!0,this._once=!1,this._priority=0,this._listener=t,this._once=r,this._signal=e,this._priority=n,this.verifyListener(t)}return t.prototype.execute0=function(){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,this._params):this._listener())},t.prototype.execute1=function(t){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,[t].concat(this._params)):this._listener(t))},t.prototype.execute=function(t){if(this._enabled){this._once&&this.remove(),this._params&&this._params.length&&(t=t.concat(this._params));var e=t.length;0===e?this._listener():1===e?this._listener(t[0]):2===e?this._listener(t[0],t[1]):3===e?this._listener(t[0],t[1],t[2]):this._listener.apply(null,t)}},Object.defineProperty(t.prototype,"listener",{get:function(){return this._listener},set:function(t){if(null==t)throw new Error("Given listener is null.\nDid you want to set enabled to false instead?");this.verifyListener(t),this._listener=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"once",{get:function(){return this._once},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return this._priority},enumerable:!0,configurable:!0}),t.prototype.toString=function(){return"[Slot listener: "+this._listener+", once: "+this._once+", priority: "+this._priority+", enabled: "+this._enabled+"]"},Object.defineProperty(t.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this._enabled=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"params",{get:function(){return this._params},set:function(t){this._params=t},enumerable:!0,configurable:!0}),t.prototype.remove=function(){this._signal.remove(this._listener)},t.prototype.verifyListener=function(t){if(null==t)throw new Error("Given listener is null.");if(null==this._signal)throw new Error("Internal signal reference has not been set yet.")},t}();ut.Slot=ht,Object.defineProperty(ot,"__esModule",{value:!0});var ct=st,ft=ut,lt=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.slots=ct.SlotList.NIL,this.valueClasses=1===t.length&&t[0]instanceof Array?t[0]:t}return Object.defineProperty(t.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(t){this._valueClasses=t?t.slice():[];for(var e=this._valueClasses.length;e--;)if(!(this._valueClasses[e]instanceof Object))throw new Error("Invalid valueClasses argument: item at index "+e+" should be a Class but was:<"+this._valueClasses[e]+">."+this._valueClasses[e])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numListeners",{get:function(){return this.slots.length},enumerable:!0,configurable:!0}),t.prototype.addOnce=function(t){return this.registerListener(t,!0)},t.prototype.remove=function(t){var e=this.slots.find(t);return e?(this.slots=this.slots.filterNot(t),e):null},t.prototype.removeAll=function(){this.slots=ct.SlotList.NIL},t.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._valueClasses.length,n=t.length;if(n<r)throw new Error("Incorrect number of arguments. Expected at least "+r+" but received "+n+".");for(var i=0;i<r;i++)if(!(null===t[i]||t[i]instanceof this._valueClasses[i]||t[i].constructor===this._valueClasses[i]))throw new Error("Value object <"+t[i]+"> is not an instance of <"+this._valueClasses[i]+">.");var o=this.slots;if(o.nonEmpty)for(;o.nonEmpty;)o.head.execute(t),o=o.tail},t.prototype.registerListener=function(t,e){if(void 0===e&&(e=!1),this.registrationPossible(t,e)){var r=new ft.Slot(t,this,e);return this.slots=this.slots.prepend(r),r}return this.slots.find(t)},t.prototype.registrationPossible=function(t,e){if(!this.slots.nonEmpty)return!0;var r=this.slots.find(t);if(!r)return!0;if(r.once!==e)throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.");return!1},t}();ot.OnceSignal=lt,Object.defineProperty(it,"__esModule",{value:!0});var pt=rt,dt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return pt.__extends(e,t),e.prototype.add=function(t){return this.registerListener(t)},e}(ot.OnceSignal);it.Signal=dt,Object.defineProperty(nt,"__esModule",{value:!0});var vt=rt,gt=ut,yt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return vt.__extends(e,t),e.prototype.addWithPriority=function(t,e){return void 0===e&&(e=0),this.registerListenerWithPriority(t,!1,e)},e.prototype.addOnceWithPriority=function(t,e){return void 0===e&&(e=0),this.registerListenerWithPriority(t,!0,e)},e.prototype.registerListener=function(t,e){return void 0===e&&(e=!1),this.registerListenerWithPriority(t,e)},e.prototype.registerListenerWithPriority=function(t,e,r){if(void 0===r&&(r=0),this.registrationPossible(t,e)){var n=new gt.Slot(t,this,e,r);return this.slots=this.slots.insertWithPriority(n),n}return this.slots.find(t)},e}(it.Signal);nt.PrioritySignal=yt,Object.defineProperty(W,"__esModule",{value:!0});var mt=rt,bt=function(t){function e(e){void 0===e&&(e=null);for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=this;return r=1===r.length&&r[0]instanceof Array?r[0]:r,(i=t.call(this,r)||this)._target=e,i}return mt.__extends(e,t),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},set:function(t){t!==this._target&&(this.removeAll(),this._target=t)},enumerable:!0,configurable:!0}),e.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._valueClasses.length,n=t.length;if(n<r)throw new Error("Incorrect number of arguments. Expected at least "+r+" but received "+n+".");for(var i=0;i<r;i++)if(null!==t[i]&&t[i].constructor!==this._valueClasses[i])throw new Error("Value object <"+t[i]+"> is not an instance of <"+this._valueClasses[i]+">.");var o=t[0];o&&(o.target&&(o=o.clone(),t[0]=o),o.target=this.target,o.currentTarget=this.target,o.signal=this);for(var s=this.slots;s.nonEmpty;)s.head.execute(t),s=s.tail;if(o&&o.bubbles)for(var a=this.target;a&&a.hasOwnProperty("parent")&&(null===(a=a.parent).onEventBubbled||(o.currentTarget=a,a.onEventBubbled(o))););},e}(nt.PrioritySignal);W.DeluxeSignal=bt;var wt={};Object.defineProperty(wt,"__esModule",{value:!0});var St=function(){function t(t){void 0===t&&(t=!1),this._bubbles=t}return Object.defineProperty(t.prototype,"signal",{get:function(){return this._signal},set:function(t){this._signal=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"target",{get:function(){return this._target},set:function(t){this._target=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"currentTarget",{get:function(){return this._currentTarget},set:function(t){this._currentTarget=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bubbles",{get:function(){return this._bubbles},set:function(t){this._bubbles=t},enumerable:!0,configurable:!0}),t.prototype.clone=function(){return new t(this._bubbles)},t}();wt.GenericEvent=St;var Et={};Object.defineProperty(Et,"__esModule",{value:!0}),Et.IOnceSignal=Symbol("IOnceSignal");var _t={};Object.defineProperty(_t,"__esModule",{value:!0}),_t.IPrioritySignal=Symbol("IPrioritySignal");var Tt={};Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.ISignal=Symbol("ISignal");var It={};Object.defineProperty(It,"__esModule",{value:!0}),It.ISlot=Symbol("ISlot");var Dt={};Object.defineProperty(Dt,"__esModule",{value:!0});var Ot=ut,xt=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.valueClasses=1===t.length&&t[0]instanceof Array?t[0]:t}return Object.defineProperty(t.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(t){this._valueClasses=t?t.slice():[];for(var e=this._valueClasses.length;e--;)if("function"!=typeof this._valueClasses[e])throw new Error("Invalid valueClasses argument: item at index "+e+" should be a Class but was:<"+this._valueClasses[e]+"'>."+this._valueClasses[e])},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"numListeners",{get:function(){return this.slot?1:0},enumerable:!0,configurable:!0}),t.prototype.add=function(t){return this.registerListener(t)},t.prototype.addOnce=function(t){return this.registerListener(t,!0)},t.prototype.remove=function(t){if(this.slot&&this.slot.listener===t){var e=this.slot;return this.slot=null,e}return null},t.prototype.removeAll=function(){this.slot&&this.slot.remove()},t.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._valueClasses.length,n=t.length;if(n<r)throw new Error("Incorrect number of arguments. Expected at least "+r+" but received "+n+".");for(var i=0;i<r;i++)if(!(null===t[i]||t[i]instanceof this._valueClasses[i]||t[i].constructor===this._valueClasses[i]))throw new Error("Value object <"+t[i]+"> is not an instance of <"+this._valueClasses[i]+">.");this.slot&&this.slot.execute(t)},t.prototype.registerListener=function(t,e){if(void 0===e&&(e=!1),this.slot)throw new Error("You cannot add or addOnce with a listener already added, remove the current listener first.");return this.slot=new Ot.Slot(t,this,e)},t}();Dt.MonoSignal=xt;var jt={};Object.defineProperty(jt,"__esModule",{value:!0});var Rt=rt,Pt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Rt.__extends(e,t),e.prototype.addOnce=function(e){var r=t.prototype.addOnce.call(this,e);return this.isDispatched&&(r.execute(this.valueObjects),r.remove()),r},e.prototype.dispatch=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(this.isDispatched)throw new Error("You cannot dispatch() a Promise more than once");this.isDispatched=!0,this.valueObjects=e,t.prototype.dispatch.apply(this,e)},e}(ot.OnceSignal);jt.Promise=Pt,Object.defineProperty(K,"__esModule",{value:!0});var At=W;K.DeluxeSignal=At.DeluxeSignal;var Bt=wt;K.GenericEvent=Bt.GenericEvent;var Nt=Et;K.IOnceSignal=Nt.IOnceSignal;var Mt=_t;K.IPrioritySignal=Mt.IPrioritySignal;var Vt=Tt;K.ISignal=Vt.ISignal;var Ct=It;K.ISlot=Ct.ISlot;var Lt=Dt;K.MonoSignal=Lt.MonoSignal;var Ft=ot;K.OnceSignal=Ft.OnceSignal;var qt=nt;K.PrioritySignal=qt.PrioritySignal;var kt=jt;K.Promise=kt.Promise;var Ht=it;K.Signal=Ht.Signal;var Ut=ut;K.Slot=Ut.Slot;var zt=st;function Gt(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}K.SlotList=zt.SlotList;var Kt={};({get exports(){return Kt},set exports(t){Kt=t}}).exports=function t(e,r,n){function i(s,a){if(!r[s]){if(!e[s]){if(!a&&Gt)return Gt(s);if(o)return o(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var h=r[s]={exports:{}};e[s][0].call(h.exports,(function(t){var r=e[s][1][t];return i(r||t)}),h,h.exports,t,e,r,n)}return r[s].exports}for(var o=Gt,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(t,e,r){(function(t){var r,n,i=t.MutationObserver||t.WebKitMutationObserver;if(i){var o=0,s=new i(c),a=t.document.createTextNode("");s.observe(a,{characterData:!0}),r=function(){a.data=o=++o%2}}else if(t.setImmediate||void 0===t.MessageChannel)r="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){c(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(c,0)};else{var u=new t.MessageChannel;u.port1.onmessage=c,r=function(){u.port2.postMessage(0)}}var h=[];function c(){var t,e;n=!0;for(var r=h.length;r;){for(e=h,h=[],t=-1;++t<r;)e[t]();r=h.length}n=!1}function f(t){1!==h.push(t)||n||r()}e.exports=f}).call(this,void 0!==z?z:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(t,e,r){var n=t(1);function i(){}var o={},s=["REJECTED"],a=["FULFILLED"],u=["PENDING"];function h(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,t!==i&&p(this,t)}function c(t,e,r){this.promise=t,"function"==typeof e&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function f(t,e,r){n((function(){var n;try{n=e(r)}catch(e){return o.reject(t,e)}n===t?o.reject(t,new TypeError("Cannot resolve promise with itself")):o.resolve(t,n)}))}function l(t){var e=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof e)return function(){e.apply(t,arguments)}}function p(t,e){var r=!1;function n(e){r||(r=!0,o.reject(t,e))}function i(e){r||(r=!0,o.resolve(t,e))}function s(){e(i,n)}var a=d(s);"error"===a.status&&n(a.value)}function d(t,e){var r={};try{r.value=t(e),r.status="success"}catch(t){r.status="error",r.value=t}return r}function v(t){return t instanceof this?t:o.resolve(new this(i),t)}function g(t){var e=new this(i);return o.reject(e,t)}function y(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var r=t.length,n=!1;if(!r)return this.resolve([]);for(var s=new Array(r),a=0,u=-1,h=new this(i);++u<r;)c(t[u],u);return h;function c(t,i){function u(t){s[i]=t,++a!==r||n||(n=!0,o.resolve(h,s))}e.resolve(t).then(u,(function(t){n||(n=!0,o.reject(h,t))}))}}function m(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var r=t.length,n=!1;if(!r)return this.resolve([]);for(var s=-1,a=new this(i);++s<r;)u(t[s]);return a;function u(t){e.resolve(t).then((function(t){n||(n=!0,o.resolve(a,t))}),(function(t){n||(n=!0,o.reject(a,t))}))}}e.exports=h,h.prototype.catch=function(t){return this.then(null,t)},h.prototype.then=function(t,e){if("function"!=typeof t&&this.state===a||"function"!=typeof e&&this.state===s)return this;var r=new this.constructor(i);return this.state!==u?f(r,this.state===a?t:e,this.outcome):this.queue.push(new c(r,t,e)),r},c.prototype.callFulfilled=function(t){o.resolve(this.promise,t)},c.prototype.otherCallFulfilled=function(t){f(this.promise,this.onFulfilled,t)},c.prototype.callRejected=function(t){o.reject(this.promise,t)},c.prototype.otherCallRejected=function(t){f(this.promise,this.onRejected,t)},o.resolve=function(t,e){var r=d(l,e);if("error"===r.status)return o.reject(t,r.value);var n=r.value;if(n)p(t,n);else{t.state=a,t.outcome=e;for(var i=-1,s=t.queue.length;++i<s;)t.queue[i].callFulfilled(e)}return t},o.reject=function(t,e){t.state=s,t.outcome=e;for(var r=-1,n=t.queue.length;++r<n;)t.queue[r].callRejected(e);return t},h.resolve=v,h.reject=g,h.all=y,h.race=m},{1:1}],3:[function(t,e,r){(function(e){"function"!=typeof e.Promise&&(e.Promise=t(2))}).call(this,void 0!==z?z:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(t,e,r){var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(t){return}}var s=o();function a(){try{if(!s||!s.open)return!1;var t="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),e="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!t||e)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(t){return!1}}function u(t,e){t=t||[],e=e||{};try{return new Blob(t,e)}catch(i){if("TypeError"!==i.name)throw i;for(var r=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),n=0;n<t.length;n+=1)r.append(t[n]);return r.getBlob(e.type)}}"undefined"==typeof Promise&&t(3);var h=Promise;function c(t,e){e&&t.then((function(t){e(null,t)}),(function(t){e(t)}))}function f(t,e,r){"function"==typeof e&&t.then(e),"function"==typeof r&&t.catch(r)}function l(t){return"string"!=typeof t&&(console.warn(t+" used as a key, but it is not a string."),t=String(t)),t}function p(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var d="local-forage-detect-blob-support",v=void 0,g={},y=Object.prototype.toString,m="readonly",b="readwrite";function w(t){for(var e=t.length,r=new ArrayBuffer(e),n=new Uint8Array(r),i=0;i<e;i++)n[i]=t.charCodeAt(i);return r}function S(t){return new h((function(e){var r=t.transaction(d,b),n=u([""]);r.objectStore(d).put(n,"key"),r.onabort=function(t){t.preventDefault(),t.stopPropagation(),e(!1)},r.oncomplete=function(){var t=navigator.userAgent.match(/Chrome\/(\d+)/),r=navigator.userAgent.match(/Edge\//);e(r||!t||parseInt(t[1],10)>=43)}})).catch((function(){return!1}))}function E(t){return"boolean"==typeof v?h.resolve(v):S(t).then((function(t){return v=t}))}function _(t){var e=g[t.name],r={};r.promise=new h((function(t,e){r.resolve=t,r.reject=e})),e.deferredOperations.push(r),e.dbReady?e.dbReady=e.dbReady.then((function(){return r.promise})):e.dbReady=r.promise}function T(t){var e=g[t.name].deferredOperations.pop();if(e)return e.resolve(),e.promise}function I(t,e){var r=g[t.name].deferredOperations.pop();if(r)return r.reject(e),r.promise}function D(t,e){return new h((function(r,n){if(g[t.name]=g[t.name]||V(),t.db){if(!e)return r(t.db);_(t),t.db.close()}var i=[t.name];e&&i.push(t.version);var o=s.open.apply(s,i);e&&(o.onupgradeneeded=function(e){var r=o.result;try{r.createObjectStore(t.storeName),e.oldVersion<=1&&r.createObjectStore(d)}catch(r){if("ConstraintError"!==r.name)throw r;console.warn('The database "'+t.name+'" has been upgraded from version '+e.oldVersion+" to version "+e.newVersion+', but the storage "'+t.storeName+'" already exists.')}}),o.onerror=function(t){t.preventDefault(),n(o.error)},o.onsuccess=function(){r(o.result),T(t)}}))}function O(t){return D(t,!1)}function x(t){return D(t,!0)}function j(t,e){if(!t.db)return!0;var r=!t.db.objectStoreNames.contains(t.storeName),n=t.version<t.db.version,i=t.version>t.db.version;if(n&&(t.version!==e&&console.warn('The database "'+t.name+"\" can't be downgraded from version "+t.db.version+" to version "+t.version+"."),t.version=t.db.version),i||r){if(r){var o=t.db.version+1;o>t.version&&(t.version=o)}return!0}return!1}function R(t){return new h((function(e,r){var n=new FileReader;n.onerror=r,n.onloadend=function(r){var n=btoa(r.target.result||"");e({__local_forage_encoded_blob:!0,data:n,type:t.type})},n.readAsBinaryString(t)}))}function P(t){return u([w(atob(t.data))],{type:t.type})}function A(t){return t&&t.__local_forage_encoded_blob}function B(t){var e=this,r=e._initReady().then((function(){var t=g[e._dbInfo.name];if(t&&t.dbReady)return t.dbReady}));return f(r,t,t),r}function N(t){_(t);for(var e=g[t.name],r=e.forages,n=0;n<r.length;n++){var i=r[n];i._dbInfo.db&&(i._dbInfo.db.close(),i._dbInfo.db=null)}return t.db=null,O(t).then((function(e){return t.db=e,j(t)?x(t):e})).then((function(n){t.db=e.db=n;for(var i=0;i<r.length;i++)r[i]._dbInfo.db=n})).catch((function(e){throw I(t,e),e}))}function M(t,e,r,n){void 0===n&&(n=1);try{var i=t.db.transaction(t.storeName,e);r(null,i)}catch(i){if(n>0&&(!t.db||"InvalidStateError"===i.name||"NotFoundError"===i.name))return h.resolve().then((function(){if(!t.db||"NotFoundError"===i.name&&!t.db.objectStoreNames.contains(t.storeName)&&t.version<=t.db.version)return t.db&&(t.version=t.db.version+1),x(t)})).then((function(){return N(t).then((function(){M(t,e,r,n-1)}))})).catch(r);r(i)}}function V(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function C(t){var e=this,r={db:null};if(t)for(var n in t)r[n]=t[n];var i=g[r.name];i||(i=V(),g[r.name]=i),i.forages.push(e),e._initReady||(e._initReady=e.ready,e.ready=B);var o=[];function s(){return h.resolve()}for(var a=0;a<i.forages.length;a++){var u=i.forages[a];u!==e&&o.push(u._initReady().catch(s))}var c=i.forages.slice(0);return h.all(o).then((function(){return r.db=i.db,O(r)})).then((function(t){return r.db=t,j(r,e._defaultConfig.version)?x(r):t})).then((function(t){r.db=i.db=t,e._dbInfo=r;for(var n=0;n<c.length;n++){var o=c[n];o!==e&&(o._dbInfo.db=r.db,o._dbInfo.version=r.version)}}))}function L(t,e){var r=this;t=l(t);var n=new h((function(e,n){r.ready().then((function(){M(r._dbInfo,m,(function(i,o){if(i)return n(i);try{var s=o.objectStore(r._dbInfo.storeName).get(t);s.onsuccess=function(){var t=s.result;void 0===t&&(t=null),A(t)&&(t=P(t)),e(t)},s.onerror=function(){n(s.error)}}catch(t){n(t)}}))})).catch(n)}));return c(n,e),n}function F(t,e){var r=this,n=new h((function(e,n){r.ready().then((function(){M(r._dbInfo,m,(function(i,o){if(i)return n(i);try{var s=o.objectStore(r._dbInfo.storeName).openCursor(),a=1;s.onsuccess=function(){var r=s.result;if(r){var n=r.value;A(n)&&(n=P(n));var i=t(n,r.key,a++);void 0!==i?e(i):r.continue()}else e()},s.onerror=function(){n(s.error)}}catch(t){n(t)}}))})).catch(n)}));return c(n,e),n}function q(t,e,r){var n=this;t=l(t);var i=new h((function(r,i){var o;n.ready().then((function(){return o=n._dbInfo,"[object Blob]"===y.call(e)?E(o.db).then((function(t){return t?e:R(e)})):e})).then((function(e){M(n._dbInfo,b,(function(o,s){if(o)return i(o);try{var a=s.objectStore(n._dbInfo.storeName);null===e&&(e=void 0);var u=a.put(e,t);s.oncomplete=function(){void 0===e&&(e=null),r(e)},s.onabort=s.onerror=function(){var t=u.error?u.error:u.transaction.error;i(t)}}catch(t){i(t)}}))})).catch(i)}));return c(i,r),i}function k(t,e){var r=this;t=l(t);var n=new h((function(e,n){r.ready().then((function(){M(r._dbInfo,b,(function(i,o){if(i)return n(i);try{var s=o.objectStore(r._dbInfo.storeName).delete(t);o.oncomplete=function(){e()},o.onerror=function(){n(s.error)},o.onabort=function(){var t=s.error?s.error:s.transaction.error;n(t)}}catch(t){n(t)}}))})).catch(n)}));return c(n,e),n}function H(t){var e=this,r=new h((function(t,r){e.ready().then((function(){M(e._dbInfo,b,(function(n,i){if(n)return r(n);try{var o=i.objectStore(e._dbInfo.storeName).clear();i.oncomplete=function(){t()},i.onabort=i.onerror=function(){var t=o.error?o.error:o.transaction.error;r(t)}}catch(t){r(t)}}))})).catch(r)}));return c(r,t),r}function U(t){var e=this,r=new h((function(t,r){e.ready().then((function(){M(e._dbInfo,m,(function(n,i){if(n)return r(n);try{var o=i.objectStore(e._dbInfo.storeName).count();o.onsuccess=function(){t(o.result)},o.onerror=function(){r(o.error)}}catch(t){r(t)}}))})).catch(r)}));return c(r,t),r}function z(t,e){var r=this,n=new h((function(e,n){t<0?e(null):r.ready().then((function(){M(r._dbInfo,m,(function(i,o){if(i)return n(i);try{var s=o.objectStore(r._dbInfo.storeName),a=!1,u=s.openKeyCursor();u.onsuccess=function(){var r=u.result;r?0===t||a?e(r.key):(a=!0,r.advance(t)):e(null)},u.onerror=function(){n(u.error)}}catch(t){n(t)}}))})).catch(n)}));return c(n,e),n}function G(t){var e=this,r=new h((function(t,r){e.ready().then((function(){M(e._dbInfo,m,(function(n,i){if(n)return r(n);try{var o=i.objectStore(e._dbInfo.storeName).openKeyCursor(),s=[];o.onsuccess=function(){var e=o.result;e?(s.push(e.key),e.continue()):t(s)},o.onerror=function(){r(o.error)}}catch(t){r(t)}}))})).catch(r)}));return c(r,t),r}function K(t,e){e=p.apply(this,arguments);var r=this.config();(t="function"!=typeof t&&t||{}).name||(t.name=t.name||r.name,t.storeName=t.storeName||r.storeName);var n,i=this;if(t.name){var o=t.name===r.name&&i._dbInfo.db?h.resolve(i._dbInfo.db):O(t).then((function(e){var r=g[t.name],n=r.forages;r.db=e;for(var i=0;i<n.length;i++)n[i]._dbInfo.db=e;return e}));n=t.storeName?o.then((function(e){if(e.objectStoreNames.contains(t.storeName)){var r=e.version+1;_(t);var n=g[t.name],i=n.forages;e.close();for(var o=0;o<i.length;o++){var a=i[o];a._dbInfo.db=null,a._dbInfo.version=r}var u=new h((function(e,n){var i=s.open(t.name,r);i.onerror=function(t){i.result.close(),n(t)},i.onupgradeneeded=function(){i.result.deleteObjectStore(t.storeName)},i.onsuccess=function(){var t=i.result;t.close(),e(t)}}));return u.then((function(t){n.db=t;for(var e=0;e<i.length;e++){var r=i[e];r._dbInfo.db=t,T(r._dbInfo)}})).catch((function(e){throw(I(t,e)||h.resolve()).catch((function(){})),e}))}})):o.then((function(e){_(t);var r=g[t.name],n=r.forages;e.close();for(var i=0;i<n.length;i++)n[i]._dbInfo.db=null;var o=new h((function(e,r){var n=s.deleteDatabase(t.name);n.onerror=n.onblocked=function(t){var e=n.result;e&&e.close(),r(t)},n.onsuccess=function(){var t=n.result;t&&t.close(),e(t)}}));return o.then((function(t){r.db=t;for(var e=0;e<n.length;e++)T(n[e]._dbInfo)})).catch((function(e){throw(I(t,e)||h.resolve()).catch((function(){})),e}))}))}else n=h.reject("Invalid arguments");return c(n,e),n}var W={_driver:"asyncStorage",_initStorage:C,_support:a(),iterate:F,getItem:L,setItem:q,removeItem:k,clear:H,length:U,key:z,keys:G,dropInstance:K};function Z(){return"function"==typeof openDatabase}var Y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$="~~local_forage_type~",X=/^~~local_forage_type~([^~]+)~/,Q="__lfsc__:",J=Q.length,tt="arbf",et="blob",rt="si08",nt="ui08",it="uic8",ot="si16",st="si32",at="ur16",ut="ui32",ht="fl32",ct="fl64",ft=J+tt.length,lt=Object.prototype.toString;function pt(t){var e,r,n,i,o,s=.75*t.length,a=t.length,u=0;"="===t[t.length-1]&&(s--,"="===t[t.length-2]&&s--);var h=new ArrayBuffer(s),c=new Uint8Array(h);for(e=0;e<a;e+=4)r=Y.indexOf(t[e]),n=Y.indexOf(t[e+1]),i=Y.indexOf(t[e+2]),o=Y.indexOf(t[e+3]),c[u++]=r<<2|n>>4,c[u++]=(15&n)<<4|i>>2,c[u++]=(3&i)<<6|63&o;return h}function dt(t){var e,r=new Uint8Array(t),n="";for(e=0;e<r.length;e+=3)n+=Y[r[e]>>2],n+=Y[(3&r[e])<<4|r[e+1]>>4],n+=Y[(15&r[e+1])<<2|r[e+2]>>6],n+=Y[63&r[e+2]];return r.length%3==2?n=n.substring(0,n.length-1)+"=":r.length%3==1&&(n=n.substring(0,n.length-2)+"=="),n}function vt(t,e){var r="";if(t&&(r=lt.call(t)),t&&("[object ArrayBuffer]"===r||t.buffer&&"[object ArrayBuffer]"===lt.call(t.buffer))){var n,i=Q;t instanceof ArrayBuffer?(n=t,i+=tt):(n=t.buffer,"[object Int8Array]"===r?i+=rt:"[object Uint8Array]"===r?i+=nt:"[object Uint8ClampedArray]"===r?i+=it:"[object Int16Array]"===r?i+=ot:"[object Uint16Array]"===r?i+=at:"[object Int32Array]"===r?i+=st:"[object Uint32Array]"===r?i+=ut:"[object Float32Array]"===r?i+=ht:"[object Float64Array]"===r?i+=ct:e(new Error("Failed to get type for BinaryArray"))),e(i+dt(n))}else if("[object Blob]"===r){var o=new FileReader;o.onload=function(){var r=$+t.type+"~"+dt(this.result);e(Q+et+r)},o.readAsArrayBuffer(t)}else try{e(JSON.stringify(t))}catch(r){console.error("Couldn't convert value into a JSON string: ",t),e(null,r)}}function gt(t){if(t.substring(0,J)!==Q)return JSON.parse(t);var e,r=t.substring(ft),n=t.substring(J,ft);if(n===et&&X.test(r)){var i=r.match(X);e=i[1],r=r.substring(i[0].length)}var o=pt(r);switch(n){case tt:return o;case et:return u([o],{type:e});case rt:return new Int8Array(o);case nt:return new Uint8Array(o);case it:return new Uint8ClampedArray(o);case ot:return new Int16Array(o);case at:return new Uint16Array(o);case st:return new Int32Array(o);case ut:return new Uint32Array(o);case ht:return new Float32Array(o);case ct:return new Float64Array(o);default:throw new Error("Unkown type: "+n)}}var yt={serialize:vt,deserialize:gt,stringToBuffer:pt,bufferToString:dt};function mt(t,e,r,n){t.executeSql("CREATE TABLE IF NOT EXISTS "+e.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],r,n)}function bt(t){var e=this,r={db:null};if(t)for(var n in t)r[n]="string"!=typeof t[n]?t[n].toString():t[n];var i=new h((function(t,n){try{r.db=openDatabase(r.name,String(r.version),r.description,r.size)}catch(t){return n(t)}r.db.transaction((function(i){mt(i,r,(function(){e._dbInfo=r,t()}),(function(t,e){n(e)}))}),n)}));return r.serializer=yt,i}function wt(t,e,r,n,i,o){t.executeSql(r,n,i,(function(t,s){s.code===s.SYNTAX_ERR?t.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[e.storeName],(function(t,a){a.rows.length?o(t,s):mt(t,e,(function(){t.executeSql(r,n,i,o)}),o)}),o):o(t,s)}),o)}function St(t,e){var r=this;t=l(t);var n=new h((function(e,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){wt(r,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[t],(function(t,r){var n=r.rows.length?r.rows.item(0).value:null;n&&(n=i.serializer.deserialize(n)),e(n)}),(function(t,e){n(e)}))}))})).catch(n)}));return c(n,e),n}function Et(t,e){var r=this,n=new h((function(e,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){wt(r,i,"SELECT * FROM "+i.storeName,[],(function(r,n){for(var o=n.rows,s=o.length,a=0;a<s;a++){var u=o.item(a),h=u.value;if(h&&(h=i.serializer.deserialize(h)),void 0!==(h=t(h,u.key,a+1)))return void e(h)}e()}),(function(t,e){n(e)}))}))})).catch(n)}));return c(n,e),n}function _t(t,e,r,n){var i=this;t=l(t);var o=new h((function(o,s){i.ready().then((function(){void 0===e&&(e=null);var a=e,u=i._dbInfo;u.serializer.serialize(e,(function(e,h){h?s(h):u.db.transaction((function(r){wt(r,u,"INSERT OR REPLACE INTO "+u.storeName+" (key, value) VALUES (?, ?)",[t,e],(function(){o(a)}),(function(t,e){s(e)}))}),(function(e){if(e.code===e.QUOTA_ERR){if(n>0)return void o(_t.apply(i,[t,a,r,n-1]));s(e)}}))}))})).catch(s)}));return c(o,r),o}function Tt(t,e,r){return _t.apply(this,[t,e,r,1])}function It(t,e){var r=this;t=l(t);var n=new h((function(e,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){wt(r,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[t],(function(){e()}),(function(t,e){n(e)}))}))})).catch(n)}));return c(n,e),n}function Dt(t){var e=this,r=new h((function(t,r){e.ready().then((function(){var n=e._dbInfo;n.db.transaction((function(e){wt(e,n,"DELETE FROM "+n.storeName,[],(function(){t()}),(function(t,e){r(e)}))}))})).catch(r)}));return c(r,t),r}function Ot(t){var e=this,r=new h((function(t,r){e.ready().then((function(){var n=e._dbInfo;n.db.transaction((function(e){wt(e,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],(function(e,r){var n=r.rows.item(0).c;t(n)}),(function(t,e){r(e)}))}))})).catch(r)}));return c(r,t),r}function xt(t,e){var r=this,n=new h((function(e,n){r.ready().then((function(){var i=r._dbInfo;i.db.transaction((function(r){wt(r,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[t+1],(function(t,r){var n=r.rows.length?r.rows.item(0).key:null;e(n)}),(function(t,e){n(e)}))}))})).catch(n)}));return c(n,e),n}function jt(t){var e=this,r=new h((function(t,r){e.ready().then((function(){var n=e._dbInfo;n.db.transaction((function(e){wt(e,n,"SELECT key FROM "+n.storeName,[],(function(e,r){for(var n=[],i=0;i<r.rows.length;i++)n.push(r.rows.item(i).key);t(n)}),(function(t,e){r(e)}))}))})).catch(r)}));return c(r,t),r}function Rt(t){return new h((function(e,r){t.transaction((function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(r,n){for(var i=[],o=0;o<n.rows.length;o++)i.push(n.rows.item(o).name);e({db:t,storeNames:i})}),(function(t,e){r(e)}))}),(function(t){r(t)}))}))}function Pt(t,e){e=p.apply(this,arguments);var r=this.config();(t="function"!=typeof t&&t||{}).name||(t.name=t.name||r.name,t.storeName=t.storeName||r.storeName);var n,i=this;return n=t.name?new h((function(e){var n;n=t.name===r.name?i._dbInfo.db:openDatabase(t.name,"","",0),t.storeName?e({db:n,storeNames:[t.storeName]}):e(Rt(n))})).then((function(t){return new h((function(e,r){t.db.transaction((function(n){function i(t){return new h((function(e,r){n.executeSql("DROP TABLE IF EXISTS "+t,[],(function(){e()}),(function(t,e){r(e)}))}))}for(var o=[],s=0,a=t.storeNames.length;s<a;s++)o.push(i(t.storeNames[s]));h.all(o).then((function(){e()})).catch((function(t){r(t)}))}),(function(t){r(t)}))}))})):h.reject("Invalid arguments"),c(n,e),n}var At={_driver:"webSQLStorage",_initStorage:bt,_support:Z(),iterate:Et,getItem:St,setItem:Tt,removeItem:It,clear:Dt,length:Ot,key:xt,keys:jt,dropInstance:Pt};function Bt(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(t){return!1}}function Nt(t,e){var r=t.name+"/";return t.storeName!==e.storeName&&(r+=t.storeName+"/"),r}function Mt(){var t="_localforage_support_test";try{return localStorage.setItem(t,!0),localStorage.removeItem(t),!1}catch(t){return!0}}function Vt(){return!Mt()||localStorage.length>0}function Ct(t){var e=this,r={};if(t)for(var n in t)r[n]=t[n];return r.keyPrefix=Nt(t,e._defaultConfig),Vt()?(e._dbInfo=r,r.serializer=yt,h.resolve()):h.reject()}function Lt(t){var e=this,r=e.ready().then((function(){for(var t=e._dbInfo.keyPrefix,r=localStorage.length-1;r>=0;r--){var n=localStorage.key(r);0===n.indexOf(t)&&localStorage.removeItem(n)}}));return c(r,t),r}function Ft(t,e){var r=this;t=l(t);var n=r.ready().then((function(){var e=r._dbInfo,n=localStorage.getItem(e.keyPrefix+t);return n&&(n=e.serializer.deserialize(n)),n}));return c(n,e),n}function qt(t,e){var r=this,n=r.ready().then((function(){for(var e=r._dbInfo,n=e.keyPrefix,i=n.length,o=localStorage.length,s=1,a=0;a<o;a++){var u=localStorage.key(a);if(0===u.indexOf(n)){var h=localStorage.getItem(u);if(h&&(h=e.serializer.deserialize(h)),void 0!==(h=t(h,u.substring(i),s++)))return h}}}));return c(n,e),n}function kt(t,e){var r=this,n=r.ready().then((function(){var e,n=r._dbInfo;try{e=localStorage.key(t)}catch(t){e=null}return e&&(e=e.substring(n.keyPrefix.length)),e}));return c(n,e),n}function Ht(t){var e=this,r=e.ready().then((function(){for(var t=e._dbInfo,r=localStorage.length,n=[],i=0;i<r;i++){var o=localStorage.key(i);0===o.indexOf(t.keyPrefix)&&n.push(o.substring(t.keyPrefix.length))}return n}));return c(r,t),r}function Ut(t){var e=this.keys().then((function(t){return t.length}));return c(e,t),e}function zt(t,e){var r=this;t=l(t);var n=r.ready().then((function(){var e=r._dbInfo;localStorage.removeItem(e.keyPrefix+t)}));return c(n,e),n}function Gt(t,e,r){var n=this;t=l(t);var i=n.ready().then((function(){void 0===e&&(e=null);var r=e;return new h((function(i,o){var s=n._dbInfo;s.serializer.serialize(e,(function(e,n){if(n)o(n);else try{localStorage.setItem(s.keyPrefix+t,e),i(r)}catch(t){"QuotaExceededError"!==t.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==t.name||o(t),o(t)}}))}))}));return c(i,r),i}function Kt(t,e){if(e=p.apply(this,arguments),!(t="function"!=typeof t&&t||{}).name){var r=this.config();t.name=t.name||r.name,t.storeName=t.storeName||r.storeName}var n,i=this;return n=t.name?new h((function(e){t.storeName?e(Nt(t,i._defaultConfig)):e(t.name+"/")})).then((function(t){for(var e=localStorage.length-1;e>=0;e--){var r=localStorage.key(e);0===r.indexOf(t)&&localStorage.removeItem(r)}})):h.reject("Invalid arguments"),c(n,e),n}var Wt={_driver:"localStorageWrapper",_initStorage:Ct,_support:Bt(),iterate:qt,getItem:Ft,setItem:Gt,removeItem:zt,clear:Lt,length:Ut,key:kt,keys:Ht,dropInstance:Kt},Zt=function(t,e){return t===e||"number"==typeof t&&"number"==typeof e&&isNaN(t)&&isNaN(e)},Yt=function(t,e){for(var r=t.length,n=0;n<r;){if(Zt(t[n],e))return!0;n++}return!1},$t=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},Xt={},Qt={},Jt={INDEXEDDB:W,WEBSQL:At,LOCALSTORAGE:Wt},te=[Jt.INDEXEDDB._driver,Jt.WEBSQL._driver,Jt.LOCALSTORAGE._driver],ee=["dropInstance"],re=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ee),ne={description:"",driver:te.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ie(t,e){t[e]=function(){var r=arguments;return t.ready().then((function(){return t[e].apply(t,r)}))}}function oe(){for(var t=1;t<arguments.length;t++){var e=arguments[t];if(e)for(var r in e)e.hasOwnProperty(r)&&($t(e[r])?arguments[0][r]=e[r].slice():arguments[0][r]=e[r])}return arguments[0]}var se=function(){function t(e){for(var r in i(this,t),Jt)if(Jt.hasOwnProperty(r)){var n=Jt[r],o=n._driver;this[r]=o,Xt[o]||this.defineDriver(n)}this._defaultConfig=oe({},ne),this._config=oe({},this._defaultConfig,e),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return t.prototype.config=function(t){if("object"===(void 0===t?"undefined":n(t))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var e in t){if("storeName"===e&&(t[e]=t[e].replace(/\W/g,"_")),"version"===e&&"number"!=typeof t[e])return new Error("Database version must be a number.");this._config[e]=t[e]}return!("driver"in t)||!t.driver||this.setDriver(this._config.driver)}return"string"==typeof t?this._config[t]:this._config},t.prototype.defineDriver=function(t,e,r){var n=new h((function(e,r){try{var n=t._driver,i=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!t._driver)return void r(i);for(var o=re.concat("_initStorage"),s=0,a=o.length;s<a;s++){var u=o[s];if((!Yt(ee,u)||t[u])&&"function"!=typeof t[u])return void r(i)}var f=function(){for(var e=function(t){return function(){var e=new Error("Method "+t+" is not implemented by the current driver"),r=h.reject(e);return c(r,arguments[arguments.length-1]),r}},r=0,n=ee.length;r<n;r++){var i=ee[r];t[i]||(t[i]=e(i))}};f();var l=function(r){Xt[n]&&console.info("Redefining LocalForage driver: "+n),Xt[n]=t,Qt[n]=r,e()};"_support"in t?t._support&&"function"==typeof t._support?t._support().then(l,r):l(!!t._support):l(!0)}catch(t){r(t)}}));return f(n,e,r),n},t.prototype.driver=function(){return this._driver||null},t.prototype.getDriver=function(t,e,r){var n=Xt[t]?h.resolve(Xt[t]):h.reject(new Error("Driver not found."));return f(n,e,r),n},t.prototype.getSerializer=function(t){var e=h.resolve(yt);return f(e,t),e},t.prototype.ready=function(t){var e=this,r=e._driverSet.then((function(){return null===e._ready&&(e._ready=e._initDriver()),e._ready}));return f(r,t,t),r},t.prototype.setDriver=function(t,e,r){var n=this;$t(t)||(t=[t]);var i=this._getSupportedDrivers(t);function o(){n._config.driver=n.driver()}function s(t){return n._extend(t),o(),n._ready=n._initStorage(n._config),n._ready}function a(t){return function(){var e=0;function r(){for(;e<t.length;){var i=t[e];return e++,n._dbInfo=null,n._ready=null,n.getDriver(i).then(s).catch(r)}o();var a=new Error("No available storage method found.");return n._driverSet=h.reject(a),n._driverSet}return r()}}var u=null!==this._driverSet?this._driverSet.catch((function(){return h.resolve()})):h.resolve();return this._driverSet=u.then((function(){var t=i[0];return n._dbInfo=null,n._ready=null,n.getDriver(t).then((function(t){n._driver=t._driver,o(),n._wrapLibraryMethodsWithReady(),n._initDriver=a(i)}))})).catch((function(){o();var t=new Error("No available storage method found.");return n._driverSet=h.reject(t),n._driverSet})),f(this._driverSet,e,r),this._driverSet},t.prototype.supports=function(t){return!!Qt[t]},t.prototype._extend=function(t){oe(this,t)},t.prototype._getSupportedDrivers=function(t){for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r];this.supports(i)&&e.push(i)}return e},t.prototype._wrapLibraryMethodsWithReady=function(){for(var t=0,e=re.length;t<e;t++)ie(this,re[t])},t.prototype.createInstance=function(e){return new t(e)},t}(),ae=new se;e.exports=ae},{3:3}]},{},[4])(4);(new r).name="Scene",new e,new n,new n,new e,new e,new e,new i,new e,new n,new n;const Wt=new n,Zt=(t,e)=>{const r=Wt.clone(),n=Wt.clone(),i=Wt.clone();r.makeRotationY(t),n.makeRotationX(e);const s=new o;return i.multiplyMatrices(r,n),s.setFromRotationMatrix(i),s},Yt=Zt(-Math.PI/2,-Math.PI/4),$t=Zt(Math.PI/2,-Math.PI/4),Xt=Zt(-Math.PI/4,-Math.PI/4),Qt=Zt(Math.PI/4,-Math.PI/4),Jt=Zt(1.25*Math.PI,-Math.PI/4),te=Zt(.75*Math.PI,-Math.PI/4);new o(0,-Math.PI/2,0),new o(0,Math.PI/2,0),new o(0,0,0),new o(0,Math.PI,0),new o(-Math.PI/2,0,0),new o(Math.PI/2,0,0),new o(-Math.PI/4,0,0),new o(Math.PI/4,Math.PI,0),new o(Yt.x,Yt.y,Yt.z),new o($t.x,$t.y,$t.z),new o(Xt.x,Xt.y,Xt.z),new o(Qt.x,Qt.y,Qt.z),new o(Jt.x,Jt.y,Jt.z),new o(te.x,te.y,te.z);const ee=new e,re=new s(50,1,.1,5e5);re.position.set(500,1e3,500),re.lookAt(ee.set(0,0,0)),re.name="Camera";new class{constructor(){this.workerPool=new v(4)}generate(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{workerPool:r}=this;return new Promise(((n,i)=>{if(t.attributes.position instanceof a)throw new Error("GenerateMeshBVHWorker: GLBufferAttribute are not supported for the geometry attributes.");d(t);const o=t.index?t.index.array:null,s=t.attributes.position.array;r.postMessage({index:o,position:s,options:Object.assign(Object.assign({},e),{onProgress:null,includedProgressCallback:Boolean(e.onProgress),groups:[...t.groups]})}).then((r=>{const{data:o}=r;if(o)if(o.error)i(new Error(o.error));else if(o.serialized){const{serialized:r,position:i}=o,s=g.deserialize(r,t,{setIndex:!1}),a=Object.assign({setBoundingBox:!1},e);if(t.attributes.position instanceof u?t.attributes.position.data.array=i:t.attributes.position instanceof h&&(t.attributes.position.array=i),t.index)t.index.array=r.index;else{const e=new h(r.index,1,!1);t.setIndex(e)}a.setBoundingBox&&(t.boundingBox=s.getBoundingBox(new c)),n(s)}else e.onProgress&&e.onProgress(o.progress)}))}))}dispose(){this.workerPool.dispose()}};var ne;navigator.userAgent.toLowerCase().includes("mac"),function(t){t[t.NONE=-1]="NONE",t[t.ROTATE=0]="ROTATE",t[t.ZOOM=1]="ZOOM",t[t.PAN=2]="PAN"}(ne||(ne={})),new e,new e,new e,new e,new e,new e,new e,new DOMRect;var ie="0123456789abcdefghijklmnopqrstuvwxyz";function oe(t){return ie.charAt(t)}function se(t,e){return t&e}function ae(t,e){return t|e}function ue(t,e){return t^e}function he(t,e){return t&~e}function ce(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function fe(t){for(var e=0;0!=t;)t&=t-1,++e;return e}var le,pe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",de="=";function ve(t){var e,r,n="";for(e=0;e+3<=t.length;e+=3)r=parseInt(t.substring(e,e+3),16),n+=pe.charAt(r>>6)+pe.charAt(63&r);for(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=pe.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=pe.charAt(r>>2)+pe.charAt((3&r)<<4));(3&n.length)>0;)n+=de;return n}var ge,ye=function(t){var e;if(void 0===le){var r="0123456789ABCDEF",n=" \f\n\r\t \u2028\u2029";for(le={},e=0;e<16;++e)le[r.charAt(e)]=e;for(r=r.toLowerCase(),e=10;e<16;++e)le[r.charAt(e)]=e;for(e=0;e<n.length;++e)le[n.charAt(e)]=-1}var i=[],o=0,s=0;for(e=0;e<t.length;++e){var a=t.charAt(e);if("="==a)break;if(-1!=(a=le[a])){if(void 0===a)throw new Error("Illegal character at offset "+e);o|=a,++s>=2?(i[i.length]=o,o=0,s=0):o<<=4}}if(s)throw new Error("Hex encoding incomplete: 4 bits missing");return i},me={decode:function(t){var e;if(void 0===ge){var r="= \f\n\r\t \u2028\u2029";for(ge=Object.create(null),e=0;e<64;++e)ge["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)]=e;for(ge["-"]=62,ge._=63,e=0;e<r.length;++e)ge[r.charAt(e)]=-1}var n=[],i=0,o=0;for(e=0;e<t.length;++e){var s=t.charAt(e);if("="==s)break;if(-1!=(s=ge[s])){if(void 0===s)throw new Error("Illegal character at offset "+e);i|=s,++o>=4?(n[n.length]=i>>16,n[n.length]=i>>8&255,n[n.length]=255&i,i=0,o=0):i<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:n[n.length]=i>>10;break;case 3:n[n.length]=i>>16,n[n.length]=i>>8&255}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var e=me.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw new Error("RegExp out of sync");t=e[2]}return me.decode(t)}},be=1e13,we=function(){function t(t){this.buf=[+t||0]}return t.prototype.mulAdd=function(t,e){var r,n,i=this.buf,o=i.length;for(r=0;r<o;++r)(n=i[r]*t+e)<be?e=0:n-=(e=0|n/be)*be,i[r]=n;e>0&&(i[r]=e)},t.prototype.sub=function(t){var e,r,n=this.buf,i=n.length;for(e=0;e<i;++e)(r=n[e]-t)<0?(r+=be,t=1):t=0,n[e]=r;for(;0===n[n.length-1];)n.pop()},t.prototype.toString=function(t){if(10!=(t||10))throw new Error("only base 10 is supported");for(var e=this.buf,r=e[e.length-1].toString(),n=e.length-2;n>=0;--n)r+=(be+e[n]).toString().substring(1);return r},t.prototype.valueOf=function(){for(var t=this.buf,e=0,r=t.length-1;r>=0;--r)e=e*be+t[r];return e},t.prototype.simplify=function(){var t=this.buf;return 1==t.length?t[0]:this},t}(),Se="…",Ee=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,_e=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Te(t,e){return t.length>e&&(t=t.substring(0,e)+Se),t}var Ie,De=function(){function t(e,r){this.hexDigits="0123456789ABCDEF",e instanceof t?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=r)}return t.prototype.get=function(t){if(void 0===t&&(t=this.pos++),t>=this.enc.length)throw new Error("Requesting byte offset ".concat(t," on a stream of length ").concat(this.enc.length));return"string"==typeof this.enc?this.enc.charCodeAt(t):this.enc[t]},t.prototype.hexByte=function(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)},t.prototype.hexDump=function(t,e,r){for(var n="",i=t;i<e;++i)if(n+=this.hexByte(this.get(i)),!0!==r)switch(15&i){case 7:n+=" ";break;case 15:n+="\n";break;default:n+=" "}return n},t.prototype.isASCII=function(t,e){for(var r=t;r<e;++r){var n=this.get(r);if(n<32||n>176)return!1}return!0},t.prototype.parseStringISO=function(t,e){for(var r="",n=t;n<e;++n)r+=String.fromCharCode(this.get(n));return r},t.prototype.parseStringUTF=function(t,e){for(var r="",n=t;n<e;){var i=this.get(n++);r+=i<128?String.fromCharCode(i):i>191&&i<224?String.fromCharCode((31&i)<<6|63&this.get(n++)):String.fromCharCode((15&i)<<12|(63&this.get(n++))<<6|63&this.get(n++))}return r},t.prototype.parseStringBMP=function(t,e){for(var r,n,i="",o=t;o<e;)r=this.get(o++),n=this.get(o++),i+=String.fromCharCode(r<<8|n);return i},t.prototype.parseTime=function(t,e,r){var n=this.parseStringISO(t,e),i=(r?Ee:_e).exec(n);return i?(r&&(i[1]=+i[1],i[1]+=+i[1]<70?2e3:1900),n=i[1]+"-"+i[2]+"-"+i[3]+" "+i[4],i[5]&&(n+=":"+i[5],i[6]&&(n+=":"+i[6],i[7]&&(n+="."+i[7]))),i[8]&&(n+=" UTC","Z"!=i[8]&&(n+=i[8],i[9]&&(n+=":"+i[9]))),n):"Unrecognized time: "+n},t.prototype.parseInteger=function(t,e){for(var r,n=this.get(t),i=n>127,o=i?255:0,s="";n==o&&++t<e;)n=this.get(t);if(0===(r=e-t))return i?-1:0;if(r>4){for(s=n,r<<=3;0==(128&(+s^o));)s=+s<<1,--r;s="("+r+" bit)\n"}i&&(n-=256);for(var a=new we(n),u=t+1;u<e;++u)a.mulAdd(256,this.get(u));return s+a.toString()},t.prototype.parseBitString=function(t,e,r){for(var n=this.get(t),i="("+((e-t-1<<3)-n)+" bit)\n",o="",s=t+1;s<e;++s){for(var a=this.get(s),u=s==e-1?n:0,h=7;h>=u;--h)o+=a>>h&1?"1":"0";if(o.length>r)return i+Te(o,r)}return i+o},t.prototype.parseOctetString=function(t,e,r){if(this.isASCII(t,e))return Te(this.parseStringISO(t,e),r);var n=e-t,i="("+n+" byte)\n";n>(r/=2)&&(e=t+r);for(var o=t;o<e;++o)i+=this.hexByte(this.get(o));return n>r&&(i+=Se),i},t.prototype.parseOID=function(t,e,r){for(var n="",i=new we,o=0,s=t;s<e;++s){var a=this.get(s);if(i.mulAdd(128,127&a),o+=7,!(128&a)){if(""===n)if((i=i.simplify())instanceof we)i.sub(80),n="2."+i.toString();else{var u=i<80?i<40?0:1:2;n=u+"."+(i-40*u)}else n+="."+i.toString();if(n.length>r)return Te(n,r);i=new we,o=0}}return o>0&&(n+=".incomplete"),n},t}(),Oe=function(){function t(t,e,r,n,i){if(!(n instanceof xe))throw new Error("Invalid tag value.");this.stream=t,this.header=e,this.length=r,this.tag=n,this.sub=i}return t.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},t.prototype.content=function(t){if(void 0===this.tag)return null;void 0===t&&(t=1/0);var e=this.posContent(),r=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+r,t);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(e)?"false":"true";case 2:return this.stream.parseInteger(e,e+r);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+r,t);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+r,t);case 6:return this.stream.parseOID(e,e+r,t);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return Te(this.stream.parseStringUTF(e,e+r),t);case 18:case 19:case 20:case 21:case 22:case 26:return Te(this.stream.parseStringISO(e,e+r),t);case 30:return Te(this.stream.parseStringBMP(e,e+r),t);case 23:case 24:return this.stream.parseTime(e,e+r,23==this.tag.tagNumber)}return null},t.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},t.prototype.toPrettyString=function(t){void 0===t&&(t="");var e=t+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(e+=" (encapsulates)"),e+="\n",null!==this.sub){t+=" ";for(var r=0,n=this.sub.length;r<n;++r)e+=this.sub[r].toPrettyString(t)}return e},t.prototype.posStart=function(){return this.stream.pos},t.prototype.posContent=function(){return this.stream.pos+this.header},t.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},t.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},t.decodeLength=function(t){var e=t.get(),r=127&e;if(r==e)return r;if(r>6)throw new Error("Length over 48 bits not supported at position "+(t.pos-1));if(0===r)return null;e=0;for(var n=0;n<r;++n)e=256*e+t.get();return e},t.prototype.getHexStringValue=function(){var t=this.toHexString(),e=2*this.header,r=2*this.length;return t.substr(e,r)},t.decode=function(e){var r;r=e instanceof De?e:new De(e,0);var n=new De(r),i=new xe(r),o=t.decodeLength(r),s=r.pos,a=s-n.pos,u=null,h=function(){var e=[];if(null!==o){for(var n=s+o;r.pos<n;)e[e.length]=t.decode(r);if(r.pos!=n)throw new Error("Content size is not correct for container starting at offset "+s)}else try{for(;;){var i=t.decode(r);if(i.tag.isEOC())break;e[e.length]=i}o=s-r.pos}catch(t){throw new Error("Exception while decoding undefined length content: "+t)}return e};if(i.tagConstructed)u=h();else if(i.isUniversal()&&(3==i.tagNumber||4==i.tagNumber))try{if(3==i.tagNumber&&0!=r.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");u=h();for(var c=0;c<u.length;++c)if(u[c].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(t){u=null}if(null===u){if(null===o)throw new Error("We can't skip over an invalid tag with undefined length at offset "+s);r.pos=s+Math.abs(o)}return new t(n,a,o,i,u)},t}(),xe=function(){function t(t){var e=t.get();if(this.tagClass=e>>6,this.tagConstructed=0!=(32&e),this.tagNumber=31&e,31==this.tagNumber){var r=new we;do{e=t.get(),r.mulAdd(128,127&e)}while(128&e);this.tagNumber=r.simplify()}}return t.prototype.isUniversal=function(){return 0===this.tagClass},t.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},t}(),je=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Re=(1<<26)/je[je.length-1],Pe=function(){function t(t,e,r){null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}return t.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,n=(1<<e)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%e;if(s-- >0)for(a<this.DB&&(r=this[s]>>a)>0&&(i=!0,o=oe(r));s>=0;)a<e?(r=(this[s]&(1<<a)-1)<<e-a,r|=this[--s]>>(a+=this.DB-e)):(r=this[s]>>(a-=e)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=oe(r));return i?o:"0"},t.prototype.negate=function(){var e=Ve();return t.ZERO.subTo(this,e),e},t.prototype.abs=function(){return this.s<0?this.negate():this},t.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0},t.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+ze(this[this.t-1]^this.s&this.DM)},t.prototype.mod=function(e){var r=Ve();return this.abs().divRemTo(e,null,r),this.s<0&&r.compareTo(t.ZERO)>0&&e.subTo(r,r),r},t.prototype.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new Be(e):new Ne(e),this.exp(t,r)},t.prototype.clone=function(){var t=Ve();return this.copyTo(t),t},t.prototype.intValue=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]},t.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},t.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},t.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},t.prototype.toByteArray=function(){var t=this.t,e=[];e[0]=this.s;var r,n=this.DB-t*this.DB%8,i=0;if(t-- >0)for(n<this.DB&&(r=this[t]>>n)!=(this.s&this.DM)>>n&&(e[i++]=r|this.s<<this.DB-n);t>=0;)n<8?(r=(this[t]&(1<<n)-1)<<8-n,r|=this[--t]>>(n+=this.DB-8)):(r=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(e[i++]=r);return e},t.prototype.equals=function(t){return 0==this.compareTo(t)},t.prototype.min=function(t){return this.compareTo(t)<0?this:t},t.prototype.max=function(t){return this.compareTo(t)>0?this:t},t.prototype.and=function(t){var e=Ve();return this.bitwiseTo(t,se,e),e},t.prototype.or=function(t){var e=Ve();return this.bitwiseTo(t,ae,e),e},t.prototype.xor=function(t){var e=Ve();return this.bitwiseTo(t,ue,e),e},t.prototype.andNot=function(t){var e=Ve();return this.bitwiseTo(t,he,e),e},t.prototype.not=function(){for(var t=Ve(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},t.prototype.shiftLeft=function(t){var e=Ve();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},t.prototype.shiftRight=function(t){var e=Ve();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},t.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+ce(this[t]);return this.s<0?this.t*this.DB:-1},t.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=fe(this[r]^e);return t},t.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)},t.prototype.setBit=function(t){return this.changeBit(t,ae)},t.prototype.clearBit=function(t){return this.changeBit(t,he)},t.prototype.flipBit=function(t){return this.changeBit(t,ue)},t.prototype.add=function(t){var e=Ve();return this.addTo(t,e),e},t.prototype.subtract=function(t){var e=Ve();return this.subTo(t,e),e},t.prototype.multiply=function(t){var e=Ve();return this.multiplyTo(t,e),e},t.prototype.divide=function(t){var e=Ve();return this.divRemTo(t,e,null),e},t.prototype.remainder=function(t){var e=Ve();return this.divRemTo(t,null,e),e},t.prototype.divideAndRemainder=function(t){var e=Ve(),r=Ve();return this.divRemTo(t,e,r),[e,r]},t.prototype.modPow=function(t,e){var r,n,i=t.bitLength(),o=Ue(1);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new Be(e):e.isEven()?new Me(e):new Ne(e);var s=[],a=3,u=r-1,h=(1<<r)-1;if(s[1]=n.convert(this),r>1){var c=Ve();for(n.sqrTo(s[1],c);a<=h;)s[a]=Ve(),n.mulTo(c,s[a-2],s[a]),a+=2}var f,l,p=t.t-1,d=!0,v=Ve();for(i=ze(t[p])-1;p>=0;){for(i>=u?f=t[p]>>i-u&h:(f=(t[p]&(1<<i+1)-1)<<u-i,p>0&&(f|=t[p-1]>>this.DB+i-u)),a=r;0==(1&f);)f>>=1,--a;if((i-=a)<0&&(i+=this.DB,--p),d)s[f].copyTo(o),d=!1;else{for(;a>1;)n.sqrTo(o,v),n.sqrTo(v,o),a-=2;a>0?n.sqrTo(o,v):(l=o,o=v,v=l),n.mulTo(v,s[f],o)}for(;p>=0&&0==(t[p]&1<<i);)n.sqrTo(o,v),l=o,o=v,v=l,--i<0&&(i=this.DB-1,--p)}return n.revert(o)},t.prototype.modInverse=function(e){var r=e.isEven();if(this.isEven()&&r||0==e.signum())return t.ZERO;for(var n=e.clone(),i=this.clone(),o=Ue(1),s=Ue(0),a=Ue(0),u=Ue(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),r?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(e,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;i.isEven();)i.rShiftTo(1,i),r?(a.isEven()&&u.isEven()||(a.addTo(this,a),u.subTo(e,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);n.compareTo(i)>=0?(n.subTo(i,n),r&&o.subTo(a,o),s.subTo(u,s)):(i.subTo(n,i),r&&a.subTo(o,a),u.subTo(s,u))}return 0!=i.compareTo(t.ONE)?t.ZERO:u.compareTo(e)>=0?u.subtract(e):u.signum()<0?(u.addTo(e,u),u.signum()<0?u.add(e):u):u},t.prototype.pow=function(t){return this.exp(t,new Ae)},t.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var i=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(i<o&&(o=i),o>0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},t.prototype.isProbablePrime=function(t){var e,r=this.abs();if(1==r.t&&r[0]<=je[je.length-1]){for(e=0;e<je.length;++e)if(r[0]==je[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<je.length;){for(var n=je[e],i=e+1;i<je.length&&n<Re;)n*=je[i++];for(n=r.modInt(n);e<i;)if(n%je[e++]==0)return!1}return r.millerRabin(t)},t.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},t.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},t.prototype.fromString=function(e,r){var n;if(16==r)n=4;else if(8==r)n=3;else if(256==r)n=8;else if(2==r)n=1;else if(32==r)n=5;else{if(4!=r)return void this.fromRadix(e,r);n=2}this.t=0,this.s=0;for(var i=e.length,o=!1,s=0;--i>=0;){var a=8==n?255&+e[i]:He(e,i);a<0?"-"==e.charAt(i)&&(o=!0):(o=!1,0==s?this[this.t++]=a:s+n>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,(s+=n)>=this.DB&&(s-=this.DB))}8==n&&0!=(128&+e[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&t.ZERO.subTo(this,this)},t.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},t.prototype.dlShiftTo=function(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s},t.prototype.drShiftTo=function(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s},t.prototype.lShiftTo=function(t,e){for(var r=t%this.DB,n=this.DB-r,i=(1<<n)-1,o=Math.floor(t/this.DB),s=this.s<<r&this.DM,a=this.t-1;a>=0;--a)e[a+o+1]=this[a]>>n|s,s=(this[a]&i)<<r;for(a=o-1;a>=0;--a)e[a]=0;e[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()},t.prototype.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var n=t%this.DB,i=this.DB-n,o=(1<<n)-1;e[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)e[s-r-1]|=(this[s]&o)<<i,e[s-r]=this[s]>>n;n>0&&(e[this.t-r-1]|=(this.s&o)<<i),e.t=this.t-r,e.clamp()}},t.prototype.subTo=function(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]-t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n-=t[r],e[r++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()},t.prototype.multiplyTo=function(e,r){var n=this.abs(),i=e.abs(),o=n.t;for(r.t=o+i.t;--o>=0;)r[o]=0;for(o=0;o<i.t;++o)r[o+n.t]=n.am(0,i[o],r,o,0,n.t);r.s=0,r.clamp(),this.s!=e.s&&t.ZERO.subTo(r,r)},t.prototype.squareTo=function(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t[r]=0;for(r=0;r<e.t-1;++r){var n=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,n,e.t-r-1))>=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()},t.prototype.divRemTo=function(e,r,n){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t<i.t)return null!=r&&r.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=Ve());var s=Ve(),a=this.s,u=e.s,h=this.DB-ze(i[i.t-1]);h>0?(i.lShiftTo(h,s),o.lShiftTo(h,n)):(i.copyTo(s),o.copyTo(n));var c=s.t,f=s[c-1];if(0!=f){var l=f*(1<<this.F1)+(c>1?s[c-2]>>this.F2:0),p=this.FV/l,d=(1<<this.F1)/l,v=1<<this.F2,g=n.t,y=g-c,m=null==r?Ve():r;for(s.dlShiftTo(y,m),n.compareTo(m)>=0&&(n[n.t++]=1,n.subTo(m,n)),t.ONE.dlShiftTo(c,m),m.subTo(s,s);s.t<c;)s[s.t++]=0;for(;--y>=0;){var b=n[--g]==f?this.DM:Math.floor(n[g]*p+(n[g-1]+v)*d);if((n[g]+=s.am(0,b,n,y,0,c))<b)for(s.dlShiftTo(y,m),n.subTo(m,n);n[g]<--b;)n.subTo(m,n)}null!=r&&(n.drShiftTo(c,r),a!=u&&t.ZERO.subTo(r,r)),n.t=c,n.clamp(),h>0&&n.rShiftTo(h,n),a<0&&t.ZERO.subTo(n,n)}}},t.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},t.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},t.prototype.exp=function(e,r){if(e>4294967295||e<1)return t.ONE;var n=Ve(),i=Ve(),o=r.convert(this),s=ze(e)-1;for(o.copyTo(n);--s>=0;)if(r.sqrTo(n,i),(e&1<<s)>0)r.mulTo(i,o,n);else{var a=n;n=i,i=a}return r.revert(n)},t.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},t.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=Ue(r),i=Ve(),o=Ve(),s="";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(t)+s},t.prototype.fromRadix=function(e,r){this.fromInt(0),null==r&&(r=10);for(var n=this.chunkSize(r),i=Math.pow(r,n),o=!1,s=0,a=0,u=0;u<e.length;++u){var h=He(e,u);h<0?"-"==e.charAt(u)&&0==this.signum()&&(o=!0):(a=r*a+h,++s>=n&&(this.dMultiply(i),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(r,s)),this.dAddOffset(a,0)),o&&t.ZERO.subTo(this,this)},t.prototype.fromNumber=function(e,r,n){if("number"==typeof r)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),ae,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(r);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(t.ONE.shiftLeft(e-1),this);else{var i=[],o=7&e;i.length=1+(e>>3),r.nextBytes(i),o>0?i[0]&=(1<<o)-1:i[0]=0,this.fromString(i,256)}},t.prototype.bitwiseTo=function(t,e,r){var n,i,o=Math.min(t.t,this.t);for(n=0;n<o;++n)r[n]=e(this[n],t[n]);if(t.t<this.t){for(i=t.s&this.DM,n=o;n<this.t;++n)r[n]=e(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<t.t;++n)r[n]=e(i,t[n]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()},t.prototype.changeBit=function(e,r){var n=t.ONE.shiftLeft(e);return this.bitwiseTo(n,r,n),n},t.prototype.addTo=function(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]+t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n+=t[r],e[r++]=n&this.DM,n>>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[r++]=n:n<-1&&(e[r++]=this.DV+n),e.t=r,e.clamp()},t.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},t.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},t.prototype.multiplyLowerTo=function(t,e,r){var n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r[--n]=0;for(var i=r.t-this.t;n<i;++n)r[n+this.t]=this.am(0,t[n],r,n,0,this.t);for(i=Math.min(t.t,e);n<i;++n)this.am(0,t[n],r,n,0,e-n);r.clamp()},t.prototype.multiplyUpperTo=function(t,e,r){--e;var n=r.t=this.t+t.t-e;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)r[this.t+n-e]=this.am(e-n,t[n],r,0,0,this.t+n-e);r.clamp(),r.drShiftTo(1,r)},t.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0==e)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t;return r},t.prototype.millerRabin=function(e){var r=this.subtract(t.ONE),n=r.getLowestSetBit();if(n<=0)return!1;var i=r.shiftRight(n);(e=e+1>>1)>je.length&&(e=je.length);for(var o=Ve(),s=0;s<e;++s){o.fromInt(je[Math.floor(Math.random()*je.length)]);var a=o.modPow(i,this);if(0!=a.compareTo(t.ONE)&&0!=a.compareTo(r)){for(var u=1;u++<n&&0!=a.compareTo(r);)if(0==(a=a.modPowInt(2,this)).compareTo(t.ONE))return!1;if(0!=a.compareTo(r))return!1}}return!0},t.prototype.square=function(){var t=Ve();return this.squareTo(t),t},t.prototype.gcda=function(t,e){var r=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(r.compareTo(n)<0){var i=r;r=n,n=i}var o=r.getLowestSetBit(),s=n.getLowestSetBit();if(s<0)e(r);else{o<s&&(s=o),s>0&&(r.rShiftTo(s,r),n.rShiftTo(s,n));var a=function(){(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),r.compareTo(n)>=0?(r.subTo(n,r),r.rShiftTo(1,r)):(n.subTo(r,n),n.rShiftTo(1,n)),r.signum()>0?setTimeout(a,0):(s>0&&n.lShiftTo(s,n),setTimeout((function(){e(n)}),0))};setTimeout(a,10)}},t.prototype.fromNumberAsync=function(e,r,n,i){if("number"==typeof r)if(e<2)this.fromInt(1);else{this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),ae,this),this.isEven()&&this.dAddOffset(1,0);var o=this,s=function(){o.dAddOffset(2,0),o.bitLength()>e&&o.subTo(t.ONE.shiftLeft(e-1),o),o.isProbablePrime(r)?setTimeout((function(){i()}),0):setTimeout(s,0)};setTimeout(s,0)}else{var a=[],u=7&e;a.length=1+(e>>3),r.nextBytes(a),u>0?a[0]&=(1<<u)-1:a[0]=0,this.fromString(a,256)}},t}(),Ae=function(){function t(){}return t.prototype.convert=function(t){return t},t.prototype.revert=function(t){return t},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},t.prototype.sqrTo=function(t,e){t.squareTo(e)},t}(),Be=function(){function t(t){this.m=t}return t.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),Ne=function(){function t(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}return t.prototype.convert=function(t){var e=Ve();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(Pe.ZERO)>0&&this.m.subTo(e,e),e},t.prototype.revert=function(t){var e=Ve();return t.copyTo(e),this.reduce(e),e},t.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=32767&t[e],n=r*this.mpl+((r*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),Me=function(){function t(t){this.m=t,this.r2=Ve(),this.q3=Ve(),Pe.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}return t.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=Ve();return t.copyTo(e),this.reduce(e),e},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}();function Ve(){return new Pe(null)}function Ce(t,e){return new Pe(t,e)}var Le="undefined"!=typeof navigator;Le&&"Microsoft Internet Explorer"==navigator.appName?(Pe.prototype.am=function(t,e,r,n,i,o){for(var s=32767&e,a=e>>15;--o>=0;){var u=32767&this[t],h=this[t++]>>15,c=a*u+h*s;i=((u=s*u+((32767&c)<<15)+r[n]+(1073741823&i))>>>30)+(c>>>15)+a*h+(i>>>30),r[n++]=1073741823&u}return i},Ie=30):Le&&"Netscape"!=navigator.appName?(Pe.prototype.am=function(t,e,r,n,i,o){for(;--o>=0;){var s=e*this[t++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=67108863&s}return i},Ie=26):(Pe.prototype.am=function(t,e,r,n,i,o){for(var s=16383&e,a=e>>14;--o>=0;){var u=16383&this[t],h=this[t++]>>14,c=a*u+h*s;i=((u=s*u+((16383&c)<<14)+r[n]+i)>>28)+(c>>14)+a*h,r[n++]=268435455&u}return i},Ie=28),Pe.prototype.DB=Ie,Pe.prototype.DM=(1<<Ie)-1,Pe.prototype.DV=1<<Ie;Pe.prototype.FV=Math.pow(2,52),Pe.prototype.F1=52-Ie,Pe.prototype.F2=2*Ie-52;var Fe,qe,ke=[];for(Fe="0".charCodeAt(0),qe=0;qe<=9;++qe)ke[Fe++]=qe;for(Fe="a".charCodeAt(0),qe=10;qe<36;++qe)ke[Fe++]=qe;for(Fe="A".charCodeAt(0),qe=10;qe<36;++qe)ke[Fe++]=qe;function He(t,e){var r=ke[t.charCodeAt(e)];return null==r?-1:r}function Ue(t){var e=Ve();return e.fromInt(t),e}function ze(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}Pe.ZERO=Ue(0),Pe.ONE=Ue(1);var Ge=function(){function t(){this.i=0,this.j=0,this.S=[]}return t.prototype.init=function(t){var e,r,n;for(e=0;e<256;++e)this.S[e]=e;for(r=0,e=0;e<256;++e)r=r+this.S[e]+t[e%t.length]&255,n=this.S[e],this.S[e]=this.S[r],this.S[r]=n;this.i=0,this.j=0},t.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]},t}();var Ke,We,Ze=256,Ye=null;if(null==Ye){Ye=[],We=0;var $e=void 0;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues){var Xe=new Uint32Array(256);for(window.crypto.getRandomValues(Xe),$e=0;$e<Xe.length;++$e)Ye[We++]=255&Xe[$e]}var Qe=0,Je=function(t){if((Qe=Qe||0)>=256||We>=Ze)window.removeEventListener?window.removeEventListener("mousemove",Je,!1):window.detachEvent&&window.detachEvent("onmousemove",Je);else try{var e=t.x+t.y;Ye[We++]=255&e,Qe+=1}catch(t){}};"undefined"!=typeof window&&(window.addEventListener?window.addEventListener("mousemove",Je,!1):window.attachEvent&&window.attachEvent("onmousemove",Je))}function tr(){if(null==Ke){for(Ke=new Ge;We<Ze;){var t=Math.floor(65536*Math.random());Ye[We++]=255&t}for(Ke.init(Ye),We=0;We<Ye.length;++We)Ye[We]=0;We=0}return Ke.next()}var er=function(){function t(){}return t.prototype.nextBytes=function(t){for(var e=0;e<t.length;++e)t[e]=tr()},t}();var rr=function(){function t(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return t.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},t.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)},t.prototype.setPublic=function(t,e){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=Ce(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},t.prototype.encrypt=function(t){var e=this.n.bitLength()+7>>3,r=function(t,e){if(e<t.length+11)return console.error("Message too long for RSA"),null;for(var r=[],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 er,s=[];e>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);r[--e]=s[0]}return r[--e]=2,r[--e]=0,new Pe(r)}(t,e);if(null==r)return null;var n=this.doPublic(r);if(null==n)return null;for(var i=n.toString(16),o=i.length,s=0;s<2*e-o;s++)i="0"+i;return i},t.prototype.setPrivate=function(t,e,r){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=Ce(t,16),this.e=parseInt(e,16),this.d=Ce(r,16)):console.error("Invalid RSA private key")},t.prototype.setPrivateEx=function(t,e,r,n,i,o,s,a){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=Ce(t,16),this.e=parseInt(e,16),this.d=Ce(r,16),this.p=Ce(n,16),this.q=Ce(i,16),this.dmp1=Ce(o,16),this.dmq1=Ce(s,16),this.coeff=Ce(a,16)):console.error("Invalid RSA private key")},t.prototype.generate=function(t,e){var r=new er,n=t>>1;this.e=parseInt(e,16);for(var i=new Pe(e,16);;){for(;this.p=new Pe(t-n,1,r),0!=this.p.subtract(Pe.ONE).gcd(i).compareTo(Pe.ONE)||!this.p.isProbablePrime(10););for(;this.q=new Pe(n,1,r),0!=this.q.subtract(Pe.ONE).gcd(i).compareTo(Pe.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var s=this.p.subtract(Pe.ONE),a=this.q.subtract(Pe.ONE),u=s.multiply(a);if(0==u.gcd(i).compareTo(Pe.ONE)){this.n=this.p.multiply(this.q),this.d=i.modInverse(u),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}},t.prototype.decrypt=function(t){var e=Ce(t,16),r=this.doPrivate(e);return null==r?null:function(t,e){var r=t.toByteArray(),n=0;for(;n<r.length&&0==r[n];)++n;if(r.length-n!=e-1||2!=r[n])return null;++n;for(;0!=r[n];)if(++n>=r.length)return null;var i="";for(;++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)},t.prototype.generateAsync=function(t,e,r){var n=new er,i=t>>1;this.e=parseInt(e,16);var o=new Pe(e,16),s=this,a=function(){var e=function(){if(s.p.compareTo(s.q)<=0){var t=s.p;s.p=s.q,s.q=t}var e=s.p.subtract(Pe.ONE),n=s.q.subtract(Pe.ONE),i=e.multiply(n);0==i.gcd(o).compareTo(Pe.ONE)?(s.n=s.p.multiply(s.q),s.d=o.modInverse(i),s.dmp1=s.d.mod(e),s.dmq1=s.d.mod(n),s.coeff=s.q.modInverse(s.p),setTimeout((function(){r()}),0)):setTimeout(a,0)},u=function(){s.q=Ve(),s.q.fromNumberAsync(i,1,n,(function(){s.q.subtract(Pe.ONE).gcda(o,(function(t){0==t.compareTo(Pe.ONE)&&s.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(u,0)}))}))},h=function(){s.p=Ve(),s.p.fromNumberAsync(t-i,1,n,(function(){s.p.subtract(Pe.ONE).gcda(o,(function(t){0==t.compareTo(Pe.ONE)&&s.p.isProbablePrime(10)?setTimeout(u,0):setTimeout(h,0)}))}))};setTimeout(h,0)};setTimeout(a,0)},t.prototype.sign=function(t,e,r){var n=function(t,e){if(e<t.length+22)return console.error("Message too long for RSA"),null;for(var r=e-t.length-6,n="",i=0;i<r;i+=2)n+="ff";return Ce("0001"+n+"00"+t,16)}((nr[r]||"")+e(t).toString(),this.n.bitLength()/4);if(null==n)return null;var i=this.doPrivate(n);if(null==i)return null;var o=i.toString(16);return 0==(1&o.length)?o:"0"+o},t.prototype.verify=function(t,e,r){var n=Ce(e,16),i=this.doPublic(n);return null==i?null:function(t){for(var e in nr)if(nr.hasOwnProperty(e)){var r=nr[e],n=r.length;if(t.substr(0,n)==r)return t.substr(n)}return t}
|
|
2
|
+
/*!
|
|
3
|
+
Copyright (c) 2011, Yahoo! Inc. All rights reserved.
|
|
4
|
+
Code licensed under the BSD License:
|
|
5
|
+
http://developer.yahoo.com/yui/license.html
|
|
6
|
+
version: 2.9.0
|
|
7
|
+
*/(i.toString(16).replace(/^1f+00/,""))==r(t).toString()},t}();var nr={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};var ir={};ir.lang={extend:function(t,e,r){if(!e||!t)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var n=function(){};if(n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e),r){var i;for(i in r)t.prototype[i]=r[i];var o=function(){},s=["toString","valueOf"];try{/MSIE/.test(navigator.userAgent)&&(o=function(t,e){for(i=0;i<s.length;i+=1){var r=s[i],n=e[r];"function"==typeof n&&n!=Object.prototype[r]&&(t[r]=n)}})}catch(t){}o(t.prototype,r)}}};
|
|
8
|
+
/**
|
|
9
|
+
* @fileOverview
|
|
10
|
+
* @name asn1-1.0.js
|
|
11
|
+
* @author Kenji Urushima kenji.urushima@gmail.com
|
|
12
|
+
* @version asn1 1.0.13 (2017-Jun-02)
|
|
13
|
+
* @since jsrsasign 2.1
|
|
14
|
+
* @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
|
|
15
|
+
*/
|
|
16
|
+
var or={};void 0!==or.asn1&&or.asn1||(or.asn1={}),or.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var e=t.toString(16);if("-"!=e.substr(0,1))e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e);else{var r=e.substr(1).length;r%2==1?r+=1:e.match(/^[0-7]/)||(r+=2);for(var n="",i=0;i<r;i++)n+="f";e=new Pe(n,16).xor(t).add(Pe.ONE).toString(16).replace(/^-/,"")}return e},this.getPEMStringFromHex=function(t,e){return hextopem(t,e)},this.newObject=function(t){var e=or.asn1,r=e.DERBoolean,n=e.DERInteger,i=e.DERBitString,o=e.DEROctetString,s=e.DERNull,a=e.DERObjectIdentifier,u=e.DEREnumerated,h=e.DERUTF8String,c=e.DERNumericString,f=e.DERPrintableString,l=e.DERTeletexString,p=e.DERIA5String,d=e.DERUTCTime,v=e.DERGeneralizedTime,g=e.DERSequence,y=e.DERSet,m=e.DERTaggedObject,b=e.ASN1Util.newObject,w=Object.keys(t);if(1!=w.length)throw"key of param shall be only one.";var S=w[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+S+":"))throw"undefined key: "+S;if("bool"==S)return new r(t[S]);if("int"==S)return new n(t[S]);if("bitstr"==S)return new i(t[S]);if("octstr"==S)return new o(t[S]);if("null"==S)return new s(t[S]);if("oid"==S)return new a(t[S]);if("enum"==S)return new u(t[S]);if("utf8str"==S)return new h(t[S]);if("numstr"==S)return new c(t[S]);if("prnstr"==S)return new f(t[S]);if("telstr"==S)return new l(t[S]);if("ia5str"==S)return new p(t[S]);if("utctime"==S)return new d(t[S]);if("gentime"==S)return new v(t[S]);if("seq"==S){for(var E=t[S],_=[],T=0;T<E.length;T++){var I=b(E[T]);_.push(I)}return new g({array:_})}if("set"==S){for(E=t[S],_=[],T=0;T<E.length;T++){I=b(E[T]);_.push(I)}return new y({array:_})}if("tag"==S){var D=t[S];if("[object Array]"===Object.prototype.toString.call(D)&&3==D.length){var O=b(D[2]);return new m({tag:D[0],explicit:D[1],obj:O})}var x={};if(void 0!==D.explicit&&(x.explicit=D.explicit),void 0!==D.tag&&(x.tag=D.tag),void 0===D.obj)throw"obj shall be specified for 'tag'.";return x.obj=b(D.obj),new m(x)}},this.jsonToASN1HEX=function(t){return this.newObject(t).getEncodedHex()}},or.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 Pe(n,2).toString(10),n=""}return e},or.asn1.ASN1Util.oidIntToHex=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=new Pe(t,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var o="",s=0;s<i;s++)o+="0";n=o+n;for(s=0;s<n.length-1;s+=7){var a=n.substr(s,7);s!=n.length-7&&(a="1"+a),r+=e(parseInt(a,2))}return r};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var n="",i=t.split("."),o=40*parseInt(i[0])+parseInt(i[1]);n+=e(o),i.splice(0,2);for(var s=0;s<i.length;s++)n+=r(i[s]);return n},or.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+"".length+",v="+this.hV;var t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var r=e.length/2;if(r>15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+r).toString(16)+e},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},or.asn1.DERAbstractString=function(t){or.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},ir.lang.extend(or.asn1.DERAbstractString,or.asn1.ASN1Object),or.asn1.DERAbstractTime=function(t){or.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){return utc=t.getTime()+6e4*t.getTimezoneOffset(),new Date(utc)},this.formatDate=function(t,e,r){var n=this.zeroPadding,i=this.localDateToUTC(t),o=String(i.getFullYear());"utc"==e&&(o=o.substr(2,2));var s=o+n(String(i.getMonth()+1),2)+n(String(i.getDate()),2)+n(String(i.getHours()),2)+n(String(i.getMinutes()),2)+n(String(i.getSeconds()),2);if(!0===r){var a=i.getMilliseconds();if(0!=a){var u=n(String(a),3);s=s+"."+(u=u.replace(/[0]+$/,""))}}return s+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(t)},this.setByDateValue=function(t,e,r,n,i,o){var s=new Date(Date.UTC(t,e-1,r,n,i,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},ir.lang.extend(or.asn1.DERAbstractTime,or.asn1.ASN1Object),or.asn1.DERAbstractStructured=function(t){or.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},ir.lang.extend(or.asn1.DERAbstractStructured,or.asn1.ASN1Object),or.asn1.DERBoolean=function(){or.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},ir.lang.extend(or.asn1.DERBoolean,or.asn1.ASN1Object),or.asn1.DERInteger=function(t){or.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=or.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new Pe(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},ir.lang.extend(or.asn1.DERInteger,or.asn1.ASN1Object),or.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=or.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}or.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;var r="0"+t;this.hTLV=null,this.isModified=!0,this.hV=r+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0);for(var r=0;r<=e;r++)t+="0";var n="";for(r=0;r<t.length-1;r+=8){var i=t.substr(r,8),o=parseInt(i,2).toString(16);1==o.length&&(o="0"+o),n+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+e+n},this.setByBooleanArray=function(t){for(var e="",r=0;r<t.length;r++)1==t[r]?e+="1":e+="0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},ir.lang.extend(or.asn1.DERBitString,or.asn1.ASN1Object),or.asn1.DEROctetString=function(t){if(void 0!==t&&void 0!==t.obj){var e=or.asn1.ASN1Util.newObject(t.obj);t.hex=e.getEncodedHex()}or.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},ir.lang.extend(or.asn1.DEROctetString,or.asn1.DERAbstractString),or.asn1.DERNull=function(){or.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},ir.lang.extend(or.asn1.DERNull,or.asn1.ASN1Object),or.asn1.DERObjectIdentifier=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=new Pe(t,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var o="",s=0;s<i;s++)o+="0";n=o+n;for(s=0;s<n.length-1;s+=7){var a=n.substr(s,7);s!=n.length-7&&(a="1"+a),r+=e(parseInt(a,2))}return r};or.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var n="",i=t.split("."),o=40*parseInt(i[0])+parseInt(i[1]);n+=e(o),i.splice(0,2);for(var s=0;s<i.length;s++)n+=r(i[s]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=n},this.setValueName=function(t){var e=or.asn1.x509.OID.name2oid(t);if(""===e)throw"DERObjectIdentifier oidName undefined: "+t;this.setValueOidString(e)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t):void 0!==t.oid?this.setValueOidString(t.oid):void 0!==t.hex?this.setValueHex(t.hex):void 0!==t.name&&this.setValueName(t.name))},ir.lang.extend(or.asn1.DERObjectIdentifier,or.asn1.ASN1Object),or.asn1.DEREnumerated=function(t){or.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=or.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new Pe(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},ir.lang.extend(or.asn1.DEREnumerated,or.asn1.ASN1Object),or.asn1.DERUTF8String=function(t){or.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},ir.lang.extend(or.asn1.DERUTF8String,or.asn1.DERAbstractString),or.asn1.DERNumericString=function(t){or.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},ir.lang.extend(or.asn1.DERNumericString,or.asn1.DERAbstractString),or.asn1.DERPrintableString=function(t){or.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},ir.lang.extend(or.asn1.DERPrintableString,or.asn1.DERAbstractString),or.asn1.DERTeletexString=function(t){or.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},ir.lang.extend(or.asn1.DERTeletexString,or.asn1.DERAbstractString),or.asn1.DERIA5String=function(t){or.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},ir.lang.extend(or.asn1.DERIA5String,or.asn1.DERAbstractString),or.asn1.DERUTCTime=function(t){or.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{12}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date))},ir.lang.extend(or.asn1.DERUTCTime,or.asn1.DERAbstractTime),or.asn1.DERGeneralizedTime=function(t){or.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{14}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date),!0===t.millis&&(this.withMillis=!0))},ir.lang.extend(or.asn1.DERGeneralizedTime,or.asn1.DERAbstractTime),or.asn1.DERSequence=function(t){or.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++){t+=this.asn1Array[e].getEncodedHex()}return this.hV=t,this.hV}},ir.lang.extend(or.asn1.DERSequence,or.asn1.DERAbstractStructured),or.asn1.DERSet=function(t){or.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var r=this.asn1Array[e];t.push(r.getEncodedHex())}return 1==this.sortFlag&&t.sort(),this.hV=t.join(""),this.hV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},ir.lang.extend(or.asn1.DERSet,or.asn1.DERAbstractStructured),or.asn1.DERTaggedObject=function(t){or.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,r){this.hT=e,this.isExplicit=t,this.asn1Object=r,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=r.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.tag&&(this.hT=t.tag),void 0!==t.explicit&&(this.isExplicit=t.explicit),void 0!==t.obj&&(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},ir.lang.extend(or.asn1.DERTaggedObject,or.asn1.ASN1Object);var sr,ar,ur=function(){var t=function(e,r){return t=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])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();!function(t){function e(r){var n=t.call(this)||this;return r&&("string"==typeof r?n.parseKey(r):(e.hasPrivateKeyProperty(r)||e.hasPublicKeyProperty(r))&&n.parsePropertiesFrom(r)),n}ur(e,t),e.prototype.parseKey=function(t){try{var e=0,r=0,n=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t)?ye(t):me.unarmor(t),i=Oe.decode(n);if(3===i.sub.length&&(i=i.sub[2].sub[0]),9===i.sub.length){e=i.sub[1].getHexStringValue(),this.n=Ce(e,16),r=i.sub[2].getHexStringValue(),this.e=parseInt(r,16);var o=i.sub[3].getHexStringValue();this.d=Ce(o,16);var s=i.sub[4].getHexStringValue();this.p=Ce(s,16);var a=i.sub[5].getHexStringValue();this.q=Ce(a,16);var u=i.sub[6].getHexStringValue();this.dmp1=Ce(u,16);var h=i.sub[7].getHexStringValue();this.dmq1=Ce(h,16);var c=i.sub[8].getHexStringValue();this.coeff=Ce(c,16)}else{if(2!==i.sub.length)return!1;if(i.sub[0].sub){var f=i.sub[1].sub[0];e=f.sub[0].getHexStringValue(),this.n=Ce(e,16),r=f.sub[1].getHexStringValue(),this.e=parseInt(r,16)}else e=i.sub[0].getHexStringValue(),this.n=Ce(e,16),r=i.sub[1].getHexStringValue(),this.e=parseInt(r,16)}return!0}catch(t){return!1}},e.prototype.getPrivateBaseKey=function(){var t={array:[new or.asn1.DERInteger({int:0}),new or.asn1.DERInteger({bigint:this.n}),new or.asn1.DERInteger({int:this.e}),new or.asn1.DERInteger({bigint:this.d}),new or.asn1.DERInteger({bigint:this.p}),new or.asn1.DERInteger({bigint:this.q}),new or.asn1.DERInteger({bigint:this.dmp1}),new or.asn1.DERInteger({bigint:this.dmq1}),new or.asn1.DERInteger({bigint:this.coeff})]};return new or.asn1.DERSequence(t).getEncodedHex()},e.prototype.getPrivateBaseKeyB64=function(){return ve(this.getPrivateBaseKey())},e.prototype.getPublicBaseKey=function(){var t=new or.asn1.DERSequence({array:[new or.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new or.asn1.DERNull]}),e=new or.asn1.DERSequence({array:[new or.asn1.DERInteger({bigint:this.n}),new or.asn1.DERInteger({int:this.e})]}),r=new or.asn1.DERBitString({hex:"00"+e.getEncodedHex()});return new or.asn1.DERSequence({array:[t,r]}).getEncodedHex()},e.prototype.getPublicBaseKeyB64=function(){return ve(this.getPublicBaseKey())},e.wordwrap=function(t,e){if(!t)return t;var r="(.{1,"+(e=e||64)+"})( +|$\n?)|(.{1,"+e+"})";return t.match(RegExp(r,"g")).join("\n")},e.prototype.getPrivateKey=function(){var t="-----BEGIN RSA PRIVATE KEY-----\n";return t+=e.wordwrap(this.getPrivateBaseKeyB64())+"\n",t+="-----END RSA PRIVATE KEY-----"},e.prototype.getPublicKey=function(){var t="-----BEGIN PUBLIC KEY-----\n";return t+=e.wordwrap(this.getPublicBaseKeyB64())+"\n",t+="-----END PUBLIC KEY-----"},e.hasPublicKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")},e.hasPrivateKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")},e.prototype.parsePropertiesFrom=function(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)}}(rr),void 0!==k&&(null===(sr=k.env)||void 0===sr||sr.npm_package_version),new t.Vector4,new f,new l,function(t){t.sbm="SBM",t.sbmx="SBMX",t.dat="DAT",t.glb="GLB",t.gltf="GLTF",t.fbx="FBX"}(ar||(ar={})),new p([0,0,1,0,1,1,1,1,0,1,0,0],2);class hr{constructor(t){this.ssp=t,this.treeData=[],this.modelData=[]}async load(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{xmlToJson:r,isArray:n,isObject:i}=this.ssp.utils,o=e?`${t}/FileInfo.xml`:t;this.fileInfo=await r(o);const s=o.split("FileInfo.xml")[0],a=this.fileInfo.folder._attributes.name;this.sceneInfo=await r(`${s}${a}.xml`);const{Project:{Building:{Floors:u,SpaceInfo:h,ObjectHierarchy:c}}}=this.sceneInfo,f=async t=>{var e,r,o;const{_attributes:a,FileSource:u}=t,{id:h,name:f}=a,{name:l}=u._attributes,p={id:h,name:f,format:ar.sbm,url:this._pathModeChange(s,l),children:[],userData:t};this._pushModelData(p);const d=await this.ssp.loadModelToGroup({id:`${p.id}_group`},[p]);if(!d)return;let v=null;if(n(c.Entity))v=c.Entity.find((t=>{let{_attributes:{id:e,type:r}}=t;return"Floor"===r&&e===h}));else if(i(c.Entity)){const{id:t,type:e}=c.Entity._attributes;t===h&&"Floor"===e&&(v=c.Entity)}if(!v)return;let g=null;if(n(v.Entity)?g=v.Entity.filter((t=>{let{_attributes:{type:e}}=t;return"FACILITY"===e})):i(c.Entity)&&"FACILITY"===v.Entity._attributes.type&&(g=v.Entity),g){for(let t=0;t<g.length;t++){const{id:n,longname:i,visible:a,position:u,eular:h,scale:c}=Object.assign(Object.assign({},g[t]._attributes),null!==(r=null===(e=g[t].Properties)||void 0===e?void 0:e._attributes)&&void 0!==r?r:{}),f={id:n,name:i,format:ar.sbm,url:this._pathModeChange(s,`/${i}.sbm`),visible:this._text2Bool(a),position:this._text2IVector3(u),rotation:this._text2IVector3(h),scale:this._text2IVector3(c),userData:g[t]},l=await this.ssp.loadModel(f);l&&(this.ssp.addObject(l,d),this._pushModelData(f),null===(o=p.children)||void 0===o||o.push(f))}this.treeData.push(p)}};if(n(u.Floor))for(let t=0;t<u.Floor.length;t++)await f(u.Floor[t]);else i(u.Floor)&&await f(u.Floor)}_pushModelData(t){this.modelData.find((e=>{let{url:r}=e;return r===t.url}))||this.modelData.push(t)}_text2IVector3(t){const e=t.split(", ");return{x:Number(e[0]),y:Number(e[1]),z:Number(e[2])}}_text2Bool(t){return"True"===t}_pathModeChange(t,e){const r=t+e;if(r.includes("://")){const t=r.split("://");return t[0]+"://"+t[1].replace("\\","/").replace("./","/").replace("//","/")}return r.replace("\\","/").replace("./","/").replace("//","/")}}export{hr as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soonspacejs/plugin-soonbuilder-loader",
|
|
3
3
|
"pluginName": "SoonbuilderLoaderPlugin",
|
|
4
|
-
"version": "2.6.
|
|
4
|
+
"version": "2.6.24",
|
|
5
5
|
"description": "soonbuilder-loader plugin for SoonSpace.js",
|
|
6
6
|
"main": "dist/index.esm.js",
|
|
7
7
|
"module": "dist/index.esm.js",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
],
|
|
14
14
|
"author": "xuek",
|
|
15
15
|
"license": "UNLICENSED",
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "2a6e43d98bc9469aead8a79640c06e785c0fa5fe",
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"soonspacejs": "2.6.
|
|
18
|
+
"soonspacejs": "2.6.24"
|
|
19
19
|
}
|
|
20
20
|
}
|