@aibee/owlly-navigation 1.0.32 → 1.0.33

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.
@@ -6,7 +6,7 @@
6
6
  * @author Alexander Milevski <info@w8r.name>
7
7
  * @license MIT
8
8
  * @preserve
9
- */var r=function e(n,r){t(this,e),this.next=null,this.key=n,this.data=r,this.left=null,this.right=null};function i(t,e){return t>e?1:t<e?-1:0}function o(t,e,n){for(var i=new r(null,null),o=i,s=i;;){var a=n(t,e.key);if(a<0){if(null===e.left)break;if(n(t,e.left.key)<0){var u=e.left;if(e.left=u.right,u.right=e,null===(e=u).left)break}s.left=e,s=e,e=e.left}else{if(!(a>0))break;if(null===e.right)break;if(n(t,e.right.key)>0){var c=e.right;if(e.right=c.left,c.left=e,null===(e=c).right)break}o.right=e,o=e,e=e.right}}return o.right=e.left,s.left=e.right,e.left=i.right,e.right=i.left,e}function s(t,e,n,i){var s=new r(t,e);if(null===n)return s.left=s.right=null,s;var a=i(t,(n=o(t,n,i)).key);return a<0?(s.left=n.left,s.right=n,n.left=null):a>=0&&(s.right=n.right,s.left=n,n.right=null),s}function a(t,e,n){var r=null,i=null;if(e){var s=n((e=o(t,e,n)).key,t);0===s?(r=e.left,i=e.right):s<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)}return{left:r,right:i}}function u(t,e,n,r,i){if(t){r("".concat(e).concat(n?"└── ":"├── ").concat(i(t),"\n"));var o=e+(n?" ":"│ ");t.left&&u(t.left,o,!1,r,i),t.right&&u(t.right,o,!0,r,i)}}var c=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i;t(this,e),this._root=null,this._size=0,this._comparator=n}return n(e,[{key:"insert",value:function(t,e){return this._size++,this._root=s(t,e,this._root,this._comparator)}},{key:"add",value:function(t,e){var n=new r(t,e);null===this._root&&(n.left=n.right=null,this._size++,this._root=n);var i=this._comparator,s=o(t,this._root,i),a=i(t,s.key);return 0===a?this._root=s:(a<0?(n.left=s.left,n.right=s,s.left=null):a>0&&(n.right=s.right,n.left=s,s.right=null),this._size++,this._root=n),this._root}},{key:"remove",value:function(t){this._root=this._remove(t,this._root,this._comparator)}},{key:"_remove",value:function(t,e,n){var r;return null===e?null:0===n(t,(e=o(t,e,n)).key)?(null===e.left?r=e.right:(r=o(t,e.left,n)).right=e.right,this._size--,r):e}},{key:"pop",value:function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=o(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null}},{key:"findStatic",value:function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return e;e=r<0?e.left:e.right}return null}},{key:"find",value:function(t){return this._root&&(this._root=o(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root}},{key:"contains",value:function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return!0;e=r<0?e.left:e.right}return!1}},{key:"forEach",value:function(t,e){for(var n=this._root,r=[],i=!1;!i;)null!==n?(r.push(n),n=n.left):0!==r.length?(n=r.pop(),t.call(e,n),n=n.right):i=!0;return this}},{key:"range",value:function(t,e,n,r){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&n.call(r,s))return this;s=s.right}return this}},{key:"keys",value:function(){var t=[];return this.forEach((function(e){var n=e.key;return t.push(n)})),t}},{key:"values",value:function(){var t=[];return this.forEach((function(e){var n=e.data;return t.push(n)})),t}},{key:"min",value:function(){return this._root?this.minNode(this._root).key:null}},{key:"max",value:function(){return this._root?this.maxNode(this._root).key:null}},{key:"minNode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._root;if(t)for(;t.left;)t=t.left;return t}},{key:"maxNode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._root;if(t)for(;t.right;)t=t.right;return t}},{key:"at",value:function(t){for(var e=this._root,n=!1,r=0,i=[];!n;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),r===t)return e;r++,e=e.right}else n=!0;return null}},{key:"next",value:function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?(n=e,e=e.left):e=e.right}return n}},{key:"prev",value:function(t){var e=this._root,n=null;if(null!==t.left){for(n=t.left;n.right;)n=n.right;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?e=e.left:(n=e,e=e.right)}return n}},{key:"clear",value:function(){return this._root=null,this._size=0,this}},{key:"toList",value:function(){return function(t){for(var e=t,n=[],i=!1,o=new r(null,null),s=o;!i;)e?(n.push(e),e=e.left):n.length>0?e=(e=s=s.next=n.pop()).right:i=!0;return s.next=null,o.next}(this._root)}},{key:"load",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.length,i=this._comparator;if(n&&d(t,e,0,r-1,i),null===this._root)this._root=l(t,e,0,r),this._size=r;else{var o=f(this.toList(),h(t,e),i);r=this._size+r,this._root=p({head:o},0,r)}return this}},{key:"isEmpty",value:function(){return null===this._root}},{key:"toString",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return String(t.key)},e=[];return u(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")}},{key:"update",value:function(t,e,n){var r=this._comparator,i=a(t,this._root,r),u=i.left,c=i.right;r(t,e)<0?c=s(e,n,c,r):u=s(e,n,u,r),this._root=function(t,e,n){return null===e?t:(null===t||((e=o(t.key,e,n)).left=t),e)}(u,c,r)}},{key:"split",value:function(t){return a(t,this._root,this._comparator)}},{key:"size",get:function(){return this._size}},{key:"root",get:function(){return this._root}}]),e}();function l(t,e,n,i){var o=i-n;if(o>0){var s=n+Math.floor(o/2),a=t[s],u=e[s],c=new r(a,u);return c.left=l(t,e,n,s),c.right=l(t,e,s+1,i),c}return null}function h(t,e){for(var n=new r(null,null),i=n,o=0;o<t.length;o++)i=i.next=new r(t[o],e[o]);return i.next=null,n.next}function p(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),o=p(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=p(t,i+1,n),s}return null}function f(t,e,n){for(var i=new r(null,null),o=i,s=t,a=e;null!==s&&null!==a;)n(s.key,a.key)<0?(o.next=s,s=s.next):(o.next=a,a=a.next),o=o.next;return null!==s?o.next=s:null!==a&&(o.next=a),i.next}function d(t,e,n,r,i){if(!(n>=r)){for(var o=t[n+r>>1],s=n-1,a=r+1;;){do{s++}while(i(t[s],o)<0);do{a--}while(i(t[a],o)>0);if(s>=a)break;var u=t[s];t[s]=t[a],t[a]=u,u=e[s],e[s]=e[a],e[a]=u}d(t,e,n,a,i),d(t,e,a+1,r,i)}}var g=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},m=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var n=t.ll.x<e.ll.x?e.ll.x:t.ll.x,r=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:n,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:r,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},v=Number.EPSILON;void 0===v&&(v=Math.pow(2,-52));var y=v*v,x=function(t,e){if(-v<t&&t<v&&-v<e&&e<v)return 0;var n=t-e;return n*n<y*t*e?0:t<e?-1:1},b=function(){function e(){t(this,e),this.reset()}return n(e,[{key:"reset",value:function(){this.xRounder=new _,this.yRounder=new _}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),e}(),_=function(){function e(){t(this,e),this.tree=new c,this.round(0)}return n(e,[{key:"round",value:function(t){var e=this.tree.add(t),n=this.tree.prev(e);if(null!==n&&0===x(e.key,n.key))return this.tree.remove(t),n.key;var r=this.tree.next(e);return null!==r&&0===x(e.key,r.key)?(this.tree.remove(t),r.key):t}}]),e}(),w=new b,M=function(t,e){return t.x*e.y-t.y*e.x},E=function(t,e){return t.x*e.x+t.y*e.y},S=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y},o=M(r,i);return x(o,0)},A=function(t){return Math.sqrt(E(t,t))},C=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return E(i,r)/A(i)/A(r)},T=function(t,e,n){return 0===e.y?null:{x:t.x+e.x/e.y*(n-t.y),y:n}},P=function(t,e,n){return 0===e.x?null:{x:n,y:t.y+e.y/e.x*(n-t.x)}},I=function(){function e(n,r){t(this,e),void 0===n.events?n.events=[this]:n.events.push(this),this.point=n,this.isLeft=r}return n(e,null,[{key:"compare",value:function(t,n){var r=e.comparePoints(t.point,n.point);return 0!==r?r:(t.point!==n.point&&t.link(n),t.isLeft!==n.isLeft?t.isLeft?1:-1:R.compare(t.segment,n.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),n(e,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,n=0,r=e.length;n<r;n++){var i=e[n];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var n=this.point.events[e];if(void 0===n.segment.consumedBy)for(var r=e+1;r<t;r++){var i=this.point.events[r];void 0===i.consumedBy&&n.otherSE.point.events===i.otherSE.point.events&&n.segment.consume(i.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,n=this.point.events.length;e<n;e++){var r=this.point.events[e];r!==this&&!r.segment.ringOut&&r.segment.isInResult()&&t.push(r)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,n=new Map,r=function(r){var i,o,s,a,u,c=r.otherSE;n.set(r,{sine:(i=e.point,o=t.point,s=c.point,a={x:o.x-i.x,y:o.y-i.y},u={x:s.x-i.x,y:s.y-i.y},M(u,a)/A(u)/A(a)),cosine:C(e.point,t.point,c.point)})};return function(t,e){n.has(t)||r(t),n.has(e)||r(e);var i=n.get(t),o=i.sine,s=i.cosine,a=n.get(e),u=a.sine,c=a.cosine;return o>=0&&u>=0?s<c?1:s>c?-1:0:o<0&&u<0?s<c?-1:s>c?1:0:u<o?-1:u>o?1:0}}}]),e}(),L=0,R=function(){function e(n,r,i,o){t(this,e),this.id=++L,this.leftSE=n,n.segment=this,n.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=n,this.rings=i,this.windings=o}return n(e,null,[{key:"compare",value:function(t,e){var n=t.leftSE.point.x,r=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<n)return 1;if(i<r)return-1;var s=t.leftSE.point.y,a=e.leftSE.point.y,u=t.rightSE.point.y,c=e.rightSE.point.y;if(n<r){if(a<s&&a<u)return 1;if(a>s&&a>u)return-1;var l=t.comparePoint(e.leftSE.point);if(l<0)return 1;if(l>0)return-1;var h=e.comparePoint(t.rightSE.point);return 0!==h?h:-1}if(n>r){if(s<a&&s<c)return-1;if(s>a&&s>c)return 1;var p=e.comparePoint(t.leftSE.point);if(0!==p)return p;var f=t.comparePoint(e.rightSE.point);return f<0?1:f>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){var d=e.comparePoint(t.rightSE.point);if(0!==d)return d}if(i>o){var g=t.comparePoint(e.rightSE.point);if(g<0)return 1;if(g>0)return-1}if(i!==o){var m=u-s,v=i-n,y=c-a,x=o-r;if(m>v&&y<x)return 1;if(m<v&&y>x)return-1}return i>o?1:i<o||u<c?-1:u>c?1:t.id<e.id?-1:t.id>e.id?1:0}}]),n(e,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,n=this.rightSE.point,r=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x<e.x?1:-1;var i=(t.y-e.y)/r.y,o=e.x+i*r.x;if(t.x===o)return 0;var s=(t.x-e.x)/r.x,a=e.y+s*r.y;return t.y===a?0:t.y<a?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),n=t.bbox(),r=m(e,n);if(null===r)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,u=g(e,s)&&0===this.comparePoint(s),c=g(n,i)&&0===t.comparePoint(i),l=g(e,a)&&0===this.comparePoint(a),h=g(n,o)&&0===t.comparePoint(o);if(c&&u)return h&&!l?o:!h&&l?a:null;if(c)return l&&i.x===a.x&&i.y===a.y?null:i;if(u)return h&&o.x===s.x&&o.y===s.y?null:s;if(h&&l)return null;if(h)return o;if(l)return a;var p=function(t,e,n,r){if(0===e.x)return P(n,r,t.x);if(0===r.x)return P(t,e,n.x);if(0===e.y)return T(n,r,t.y);if(0===r.y)return T(t,e,n.y);var i=M(e,r);if(0==i)return null;var o={x:n.x-t.x,y:n.y-t.y},s=M(o,e)/i,a=M(o,r)/i;return{x:(t.x+a*e.x+(n.x+s*r.x))/2,y:(t.y+a*e.y+(n.y+s*r.y))/2}}(i,this.vector(),s,t.vector());return null===p?null:g(r,p)?w.round(p.x,p.y):null}},{key:"split",value:function(t){var n=[],r=void 0!==t.events,i=new I(t,!0),o=new I(t,!1),s=this.rightSE;this.replaceRightSE(o),n.push(o),n.push(i);var a=new e(i,s,this.rings.slice(),this.windings.slice());return I.comparePoints(a.leftSE.point,a.rightSE.point)>0&&a.swapEvents(),I.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),o.checkForConsuming()),n}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,n=this.windings.length;e<n;e++)this.windings[e]*=-1}},{key:"consume",value:function(t){for(var n=this,r=t;n.consumedBy;)n=n.consumedBy;for(;r.consumedBy;)r=r.consumedBy;var i=e.compare(n,r);if(0!==i){if(i>0){var o=n;n=r,r=o}if(n.prev===r){var s=n;n=r,r=s}for(var a=0,u=r.rings.length;a<u;a++){var c=r.rings[a],l=r.windings[a],h=n.rings.indexOf(c);-1===h?(n.rings.push(c),n.windings.push(l)):n.windings[h]+=l}r.rings=null,r.windings=null,r.consumedBy=n,r.leftSE.consumedBy=n.leftSE,r.rightSE.consumedBy=n.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],a=this.windings[i],u=e.indexOf(s);-1===u?(e.push(s),n.push(a)):n[u]+=a}for(var c=[],l=[],h=0,p=e.length;h<p;h++)if(0!==n[h]){var f=e[h],d=f.poly;if(-1===l.indexOf(d))if(f.isExterior)c.push(d);else{-1===l.indexOf(d)&&l.push(d);var g=c.indexOf(f.poly);-1!==g&&c.splice(g,1)}}for(var m=0,v=c.length;m<v;m++){var y=c[m].multiPoly;-1===r.indexOf(y)&&r.push(y)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(U.type){case"union":var n=0===t.length,r=0===e.length;this._isInResult=n!==r;break;case"intersection":var i,o;t.length<e.length?(i=t.length,o=e.length):(i=e.length,o=t.length),this._isInResult=o===U.numMultiPolys&&i<o;break;case"xor":var s=Math.abs(t.length-e.length);this._isInResult=s%2==1;break;case"difference":var a=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=a(t)!==a(e);break;default:throw new Error("Unrecognized operation type found ".concat(U.type))}return this._isInResult}}],[{key:"fromRing",value:function(t,n,r){var i,o,s,a=I.comparePoints(t,n);if(a<0)i=t,o=n,s=1;else{if(!(a>0))throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));i=n,o=t,s=-1}return new e(new I(i,!0),new I(o,!1),[r],[s])}}]),e}(),O=function(){function e(n,r,i){if(t(this,e),!Array.isArray(n)||0===n.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=i,this.segments=[],"number"!=typeof n[0][0]||"number"!=typeof n[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var o=w.round(n[0][0],n[0][1]);this.bbox={ll:{x:o.x,y:o.y},ur:{x:o.x,y:o.y}};for(var s=o,a=1,u=n.length;a<u;a++){if("number"!=typeof n[a][0]||"number"!=typeof n[a][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var c=w.round(n[a][0],n[a][1]);c.x===s.x&&c.y===s.y||(this.segments.push(R.fromRing(s,c,this)),c.x<this.bbox.ll.x&&(this.bbox.ll.x=c.x),c.y<this.bbox.ll.y&&(this.bbox.ll.y=c.y),c.x>this.bbox.ur.x&&(this.bbox.ur.x=c.x),c.y>this.bbox.ur.y&&(this.bbox.ur.y=c.y),s=c)}o.x===s.x&&o.y===s.y||this.segments.push(R.fromRing(s,o,this))}return n(e,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.segments.length;e<n;e++){var r=this.segments[e];t.push(r.leftSE),t.push(r.rightSE)}return t}}]),e}(),D=function(){function e(n,r){if(t(this,e),!Array.isArray(n))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new O(n[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var i=1,o=n.length;i<o;i++){var s=new O(n[i],this,!1);s.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.interiorRings.push(s)}this.multiPoly=r}return n(e,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,n=this.interiorRings.length;e<n;e++)for(var r=this.interiorRings[e].getSweepEvents(),i=0,o=r.length;i<o;i++)t.push(r[i]);return t}}]),e}(),B=function(){function e(n,r){if(t(this,e),!Array.isArray(n))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof n[0][0][0]&&(n=[n])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var i=0,o=n.length;i<o;i++){var s=new D(n[i],this);s.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.polys.push(s)}this.isSubject=r}return n(e,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.polys.length;e<n;e++)for(var r=this.polys[e].getSweepEvents(),i=0,o=r.length;i<o;i++)t.push(r[i]);return t}}]),e}(),F=function(){function e(n){t(this,e),this.events=n;for(var r=0,i=n.length;r<i;r++)n[r].segment.ringOut=this;this.poly=null}return n(e,null,[{key:"factory",value:function(t){for(var n=[],r=0,i=t.length;r<i;r++){var o=t[r];if(o.isInResult()&&!o.ringOut){for(var s=null,a=o.leftSE,u=o.rightSE,c=[a],l=a.point,h=[];s=a,a=u,c.push(a),a.point!==l;)for(;;){var p=a.getAvailableLinkedEvents();if(0===p.length){var f=c[0].point,d=c[c.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(f.x,",")+" ".concat(f.y,"]. Last matching segment found ends at")+" [".concat(d.x,", ").concat(d.y,"]."))}if(1===p.length){u=p[0].otherSE;break}for(var g=null,m=0,v=h.length;m<v;m++)if(h[m].point===a.point){g=m;break}if(null===g){h.push({index:c.length,point:a.point});var y=a.getLeftmostComparator(s);u=p.sort(y)[0].otherSE;break}var x=h.splice(g)[0],b=c.splice(x.index);b.unshift(b[0].otherSE),n.push(new e(b.reverse()))}n.push(new e(c))}}return n}}]),n(e,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],n=1,r=this.events.length-1;n<r;n++){var i=this.events[n].point,o=this.events[n+1].point;0!==S(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],a=e[1];0===S(s,t,a)&&e.shift(),e.push(e[0]);for(var u=this.isExteriorRing()?1:-1,c=this.isExteriorRing()?0:e.length-1,l=this.isExteriorRing()?e.length:-1,h=[],p=c;p!=l;p+=u)h.push([e[p].x,e[p].y]);return h}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,n=this.events.length;e<n;e++){var r=this.events[e];I.compare(t,r)>0&&(t=r)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),e}(),N=function(){function e(n){t(this,e),this.exteriorRing=n,n.poly=this,this.interiorRings=[]}return n(e,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,n=this.interiorRings.length;e<n;e++){var r=this.interiorRings[e].getGeom();null!==r&&t.push(r)}return t}}]),e}(),k=function(){function e(n){t(this,e),this.rings=n,this.polys=this._composePolys(n)}return n(e,[{key:"getGeom",value:function(){for(var t=[],e=0,n=this.polys.length;e<n;e++){var r=this.polys[e].getGeom();null!==r&&t.push(r)}return t}},{key:"_composePolys",value:function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];if(!i.poly)if(i.isExteriorRing())e.push(new N(i));else{var o=i.enclosingRing();o.poly||e.push(new N(o)),o.poly.addInterior(i)}}return e}}]),e}(),G=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:R.compare;t(this,e),this.queue=n,this.tree=new c(r),this.segments=[]}return n(e,[{key:"process",value:function(t){var e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;var r=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!r)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=r,o=r,s=void 0,a=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===a;)null===(o=this.tree.next(o))?a=null:void 0===o.key.consumedBy&&(a=o.key);if(t.isLeft){var u=null;if(s){var c=s.getIntersection(e);if(null!==c&&(e.isAnEndpoint(c)||(u=c),!s.isAnEndpoint(c)))for(var l=this._splitSafely(s,c),h=0,p=l.length;h<p;h++)n.push(l[h])}var f=null;if(a){var d=a.getIntersection(e);if(null!==d&&(e.isAnEndpoint(d)||(f=d),!a.isAnEndpoint(d)))for(var g=this._splitSafely(a,d),m=0,v=g.length;m<v;m++)n.push(g[m])}if(null!==u||null!==f){var y=null;y=null===u?f:null===f||I.comparePoints(u,f)<=0?u:f,this.queue.remove(e.rightSE),n.push(e.rightSE);for(var x=e.split(y),b=0,_=x.length;b<_;b++)n.push(x[b])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&a){var w=s.getIntersection(a);if(null!==w){if(!s.isAnEndpoint(w))for(var M=this._splitSafely(s,w),E=0,S=M.length;E<S;E++)n.push(M[E]);if(!a.isAnEndpoint(w))for(var A=this._splitSafely(a,w),C=0,T=A.length;C<T;C++)n.push(A[C])}}this.tree.remove(e)}return n}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var n=t.rightSE;this.queue.remove(n);var r=t.split(e);return r.push(n),void 0===t.consumedBy&&this.tree.insert(t),r}}]),e}(),U=new(function(){function e(){t(this,e)}return n(e,[{key:"run",value:function(t,e,n){U.type=t,w.reset();for(var r=[new B(e,!0)],i=0,o=n.length;i<o;i++)r.push(new B(n[i],!1));if(U.numMultiPolys=r.length,"difference"===U.type)for(var s=r[0],a=1;a<r.length;)null!==m(r[a].bbox,s.bbox)?a++:r.splice(a,1);if("intersection"===U.type)for(var u=0,l=r.length;u<l;u++)for(var h=r[u],p=u+1,f=r.length;p<f;p++)if(null===m(h.bbox,r[p].bbox))return[];for(var d=new c(I.compare),g=0,v=r.length;g<v;g++)for(var y=r[g].getSweepEvents(),x=0,b=y.length;x<b;x++)d.insert(y[x]);for(var _=new G(d),M=d.size,E=d.pop();E;){var S=E.key;if(d.size===M){var A=S.segment;throw new Error("Unable to pop() ".concat(S.isLeft?"left":"right"," SweepEvent ")+"[".concat(S.point.x,", ").concat(S.point.y,"] from segment #").concat(A.id," ")+"[".concat(A.leftSE.point.x,", ").concat(A.leftSE.point.y,"] -> ")+"[".concat(A.rightSE.point.x,", ").concat(A.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}for(var C=_.process(S),T=0,P=C.length;T<P;T++){var L=C[T];void 0===L.consumedBy&&d.insert(L)}M=d.size,E=d.pop()}w.reset();var R=F.factory(_.segments);return new k(R).getGeom()}}]),e}());return{union:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return U.run("union",t,n)},intersection:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return U.run("intersection",t,n)},xor:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return U.run("xor",t,n)},difference:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return U.run("difference",t,n)}}}()},"3Eq5":function(t,e,n){"use strict";var r=n("We1y"),i=n("cjT7");t.exports=function(t,e){var n=t[e];return i(n)?void 0:r(n)}},"3MOf":function(t,e,n){"use strict";var r=n("rpNk").IteratorPrototype,i=n("fHMY"),o=n("XGwC"),s=n("1E5z"),a=n("P4y1"),u=function(){return this};t.exports=function(t,e,n,c){var l=e+" Iterator";return t.prototype=i(r,{next:o(+!c,n)}),s(t,l,!1,!0),a[l]=u,t}},"3bBZ":function(t,e,n){"use strict";var r=n("z+kr"),i=n("/byt"),o=n("eFrH"),s=n("4mDm"),a=n("kRJp"),u=n("1E5z"),c=n("tiKp")("iterator"),l=s.values,h=function(t,e){if(t){if(t[c]!==l)try{a(t,c,l)}catch(e){t[c]=l}if(u(t,e,!0),i[e])for(var n in s)if(t[n]!==s[n])try{a(t,n,s[n])}catch(e){t[n]=s[n]}}};for(var p in i)h(r[p]&&r[p].prototype,p);h(o,"DOMTokenList")},"469k":function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("8LQ0"),a=n("/OYL"),u=n("RUZL"),c=n("13ei"),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype._sceneFunc=function(t){var e=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();t.beginPath(),t.moveTo(0,0-n);for(var i=1;i<2*r;i++){var o=i%2==0?n:e,s=o*Math.sin(i*Math.PI/r),a=-1*o*Math.cos(i*Math.PI/r);t.lineTo(s,a)}t.closePath(),t.fillStrokeShape(this)},e.prototype.getWidth=function(){return 2*this.outerRadius()},e.prototype.getHeight=function(){return 2*this.outerRadius()},e.prototype.setWidth=function(t){this.outerRadius(t/2)},e.prototype.setHeight=function(t){this.outerRadius(t/2)},e}(a.Shape);e.Star=l,l.prototype.className="Star",l.prototype._centroid=!0,l.prototype._attrsAffectingSize=["innerRadius","outerRadius"],c._registerNode(l),s.Factory.addGetterSetter(l,"numPoints",5,u.getNumberValidator()),s.Factory.addGetterSetter(l,"innerRadius",0,u.getNumberValidator()),s.Factory.addGetterSetter(l,"outerRadius",0,u.getNumberValidator()),o.Collection.mapMethods(l)},"4Brf":function(t,e,n){"use strict";var r=n("I+eb"),i=n("g6v/"),o=n("z+kr"),s=n("4zBA"),a=n("Gi26"),u=n("Fib7"),c=n("OpvP"),l=n("V37c"),h=n("7dAM"),p=n("6JNq"),f=o.Symbol,d=f&&f.prototype;if(i&&u(f)&&(!("description"in d)||void 0!==f().description)){var g={},m=function(){var t=arguments.length<1||void 0===arguments[0]?void 0:l(arguments[0]),e=c(d,this)?new f(t):void 0===t?f():f(t);return""===t&&(g[e]=!0),e};p(m,f),m.prototype=d,d.constructor=m;var v="Symbol(description detection)"===String(f("description detection")),y=s(d.valueOf),x=s(d.toString),b=/^Symbol\((.*)\)[^)]+$/,_=s("".replace),w=s("".slice);h(d,"description",{configurable:!0,get:function(){var t=y(this);if(a(g,t))return"";var e=x(t),n=v?w(e,7,-1):_(e,b,"$1");return""===n?void 0:n}}),r({global:!0,constructor:!0,forced:!0},{Symbol:m})}},"4GWN":function(t,e,n){"use strict";var r=n("Qo9l"),i=n("Gi26"),o=n("5Tg+"),s=n("m/L8").f;t.exports=function(t){var e=r.Symbol||(r.Symbol={});i(e,t)||s(e,t,{value:o.f(t)})}},"4WOD":function(t,e,n){"use strict";var r=n("Gi26"),i=n("Fib7"),o=n("ewvW"),s=n("93I0"),a=n("4Xet"),u=s("IE_PROTO"),c=Object,l=c.prototype;t.exports=a?c.getPrototypeOf:function(t){var e=o(t);if(r(e,u))return e[u];var n=e.constructor;return i(n)&&e instanceof n?n.prototype:e instanceof c?l:null}},"4Xet":function(t,e,n){"use strict";var r=n("0Dky");t.exports=!r((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},"4mDm":function(t,e,n){"use strict";var r=n("/GqU"),i=n("RNIs"),o=n("P4y1"),s=n("afO8"),a=n("m/L8").f,u=n("xtKg"),c=n("R1RC"),l=n("xDBR"),h=n("g6v/"),p=s.set,f=s.getterFor("Array Iterator");t.exports=u(Array,"Array",(function(t,e){p(this,{type:"Array Iterator",target:r(t),index:0,kind:e})}),(function(){var t=f(this),e=t.target,n=t.index++;if(!e||n>=e.length)return t.target=null,c(void 0,!0);switch(t.kind){case"keys":return c(n,!1);case"values":return c(e[n],!1)}return c([n,e[n]],!1)}),"values");var d=o.Arguments=o.Array;if(i("keys"),i("values"),i("entries"),!l&&h&&"values"!==d.name)try{a(d,"name",{value:"values"})}catch(t){}},"4mfi":function(t,e,n){"use strict";var r=n("4zBA"),i=n("6LWA"),o=n("Fib7"),s=n("xrYK"),a=n("V37c"),u=r([].push);t.exports=function(t){if(o(t))return t;if(i(t)){for(var e=t.length,n=[],r=0;r<e;r++){var c=t[r];"string"==typeof c?u(n,c):"number"!=typeof c&&"Number"!==s(c)&&"String"!==s(c)||u(n,a(c))}var l=n.length,h=!0;return function(t,e){if(h)return h=!1,e;if(i(this))return e;for(var r=0;r<l;r++)if(n[r]===t)return e}}}},"4zBA":function(t,e,n){"use strict";var r=n("QNWe"),i=Function.prototype,o=i.call,s=r&&i.bind.bind(o,o);t.exports=r?s:function(t){return function(){return o.apply(t,arguments)}}},"5DmW":function(t,e,n){"use strict";var r=n("I+eb"),i=n("0Dky"),o=n("/GqU"),s=n("Bs8V").f,a=n("g6v/");r({target:"Object",stat:!0,forced:!a||i((function(){s(1)})),sham:!a},{getOwnPropertyDescriptor:function(t,e){return s(o(t),e)}})},"5LDq":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("8LQ0"),i=n("SXH2"),o=n("nLhi"),s=n("RUZL");e.Emboss=function(t){var e=10*this.embossStrength(),n=255*this.embossWhiteLevel(),r=this.embossDirection(),i=this.embossBlend(),s=0,a=0,u=t.data,c=t.width,l=t.height,h=4*c,p=l;switch(r){case"top-left":s=-1,a=-1;break;case"top":s=-1,a=0;break;case"top-right":s=-1,a=1;break;case"right":s=0,a=1;break;case"bottom-right":s=1,a=1;break;case"bottom":s=1,a=0;break;case"bottom-left":s=1,a=-1;break;case"left":s=0,a=-1;break;default:o.Util.error("Unknown emboss direction: "+r)}do{var f=(p-1)*h,d=s;p+d<1&&(d=0),p+d>l&&(d=0);var g=(p-1+d)*c*4,m=c;do{var v=f+4*(m-1),y=a;m+y<1&&(y=0),m+y>c&&(y=0);var x=g+4*(m-1+y),b=u[v]-u[x],_=u[v+1]-u[x+1],w=u[v+2]-u[x+2],M=b,E=M>0?M:-M;if((_>0?_:-_)>E&&(M=_),(w>0?w:-w)>E&&(M=w),M*=e,i){var S=u[v]+M,A=u[v+1]+M,C=u[v+2]+M;u[v]=S>255?255:S<0?0:S,u[v+1]=A>255?255:A<0?0:A,u[v+2]=C>255?255:C<0?0:C}else{var T=n-M;T<0?T=0:T>255&&(T=255),u[v]=u[v+1]=u[v+2]=T}}while(--m)}while(--p)},r.Factory.addGetterSetter(i.Node,"embossStrength",.5,s.getNumberValidator(),r.Factory.afterSetFilter),r.Factory.addGetterSetter(i.Node,"embossWhiteLevel",.5,s.getNumberValidator(),r.Factory.afterSetFilter),r.Factory.addGetterSetter(i.Node,"embossDirection","top-left",null,r.Factory.afterSetFilter),r.Factory.addGetterSetter(i.Node,"embossBlend",!1,null,r.Factory.afterSetFilter)},"5Tg+":function(t,e,n){"use strict";var r=n("tiKp");e.f=r},"5Yz+":function(t,e,n){"use strict";var r=n("K6Rb"),i=n("/GqU"),o=n("WSbT"),s=n("B/qT"),a=n("pkCn"),u=Math.min,c=[].lastIndexOf,l=!!c&&1/[1].lastIndexOf(1,-0)<0,h=a("lastIndexOf"),p=l||!h;t.exports=p?function(t){if(l)return r(c,this,arguments)||0;var e=i(this),n=s(e);if(0===n)return-1;var a=n-1;for(arguments.length>1&&(a=u(a,o(arguments[1]))),a<0&&(a=n+a);a>=0;a--)if(a in e&&e[a]===t)return a||0;return-1}:c},"5mdu":function(t,e,n){"use strict";t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},"5oMp":function(t,e,n){"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},"5s+n":function(t,e,n){"use strict";n("Xn6M"),n("FOUG"),n("zJiX"),n("NSnw"),n("8itv"),n("cUmr")},"66Qi":function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("8LQ0"),a=n("6mFz"),u=n("13ei"),c=n("9lVk"),l=n("35O5"),h=n("13ei"),p=n("fSr5"),f=["mouseenter","mousedown","mousemove","mouseup","mouseout","touchstart","touchmove","touchend","mouseover","wheel","contextmenu","pointerdown","pointermove","pointerup","pointercancel","lostpointercapture"],d=f.length;function g(t,e){t.content.addEventListener(e,(function(n){t["_"+e](n)}),!1)}function m(t){return void 0===t&&(t={}),(t.clipFunc||t.clipWidth||t.clipHeight)&&o.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),t}e.stages=[];var v=function(t){function n(n){var r=t.call(this,m(n))||this;return r._pointerPositions=[],r._changedPointerPositions=[],r._buildDOM(),r._bindContentEvents(),e.stages.push(r),r.on("widthChange.konva heightChange.konva",r._resizeDOM),r.on("visibleChange.konva",r._checkVisibility),r.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",(function(){m(r.attrs)})),r._checkVisibility(),r}return i(n,t),n.prototype._validateAdd=function(t){var e="Layer"===t.getType(),n="FastLayer"===t.getType();e||n||o.Util.throw("You may only add layers to the stage.")},n.prototype._checkVisibility=function(){if(this.content){var t=this.visible()?"":"none";this.content.style.display=t}},n.prototype.setContainer=function(t){if("string"==typeof t){if("."===t.charAt(0)){var e=t.slice(1);t=document.getElementsByClassName(e)[0]}else{var n;n="#"!==t.charAt(0)?t:t.slice(1),t=document.getElementById(n)}if(!t)throw"Can not find container in document with id "+n}return this._setAttr("container",t),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),t.appendChild(this.content)),this},n.prototype.shouldDrawHit=function(){return!0},n.prototype.clear=function(){var t,e=this.children,n=e.length;for(t=0;t<n;t++)e[t].clear();return this},n.prototype.clone=function(t){return t||(t={}),t.container=document.createElement("div"),a.Container.prototype.clone.call(this,t)},n.prototype.destroy=function(){t.prototype.destroy.call(this);var n=this.content;n&&o.Util._isInDocument(n)&&this.container().removeChild(n);var r=e.stages.indexOf(this);return r>-1&&e.stages.splice(r,1),this},n.prototype.getPointerPosition=function(){var t=this._pointerPositions[0]||this._changedPointerPositions[0];return t?{x:t.x,y:t.y}:(o.Util.warn("Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);"),null)},n.prototype._getPointerById=function(t){return this._pointerPositions.find((function(e){return e.id===t}))},n.prototype.getPointersPositions=function(){return this._pointerPositions},n.prototype.getStage=function(){return this},n.prototype.getContent=function(){return this.content},n.prototype._toKonvaCanvas=function(t){var e=(t=t||{}).x||0,n=t.y||0,r=new c.SceneCanvas({width:t.width||this.width(),height:t.height||this.height(),pixelRatio:t.pixelRatio||1}),i=r.getContext()._context,o=this.children;return(e||n)&&i.translate(-1*e,-1*n),o.each((function(r){if(r.isVisible()){var o=r._toKonvaCanvas(t);i.drawImage(o._canvas,e,n,o.getWidth()/o.getPixelRatio(),o.getHeight()/o.getPixelRatio())}})),r},n.prototype.getIntersection=function(t,e){if(!t)return null;var n,r,i=this.children;for(n=i.length-1;n>=0;n--)if(r=i[n].getIntersection(t,e))return r;return null},n.prototype._resizeDOM=function(){var t=this.width(),e=this.height();this.content&&(this.content.style.width=t+"px",this.content.style.height=e+"px"),this.bufferCanvas.setSize(t,e),this.bufferHitCanvas.setSize(t,e),this.children.each((function(n){n.setSize({width:t,height:e}),n.draw()}))},n.prototype.add=function(e){if(arguments.length>1){for(var n=0;n<arguments.length;n++)this.add(arguments[n]);return this}t.prototype.add.call(this,e);var r=this.children.length;return r>5&&o.Util.warn("The stage has "+r+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e._setCanvasSize(this.width(),this.height()),e.draw(),u.Konva.isBrowser&&this.content.appendChild(e.canvas._canvas),this},n.prototype.getParent=function(){return null},n.prototype.getLayer=function(){return null},n.prototype.hasPointerCapture=function(t){return p.hasPointerCapture(t,this)},n.prototype.setPointerCapture=function(t){p.setPointerCapture(t,this)},n.prototype.releaseCapture=function(t){p.releaseCapture(t,this)},n.prototype.getLayers=function(){return this.getChildren()},n.prototype._bindContentEvents=function(){if(u.Konva.isBrowser)for(var t=0;t<d;t++)g(this,f[t])},n.prototype._mouseenter=function(t){this.setPointersPositions(t),this._fire("mouseenter",{evt:t,target:this,currentTarget:this})},n.prototype._mouseover=function(t){this.setPointersPositions(t),this._fire("contentMouseover",{evt:t}),this._fire("mouseover",{evt:t,target:this,currentTarget:this})},n.prototype._mouseout=function(t){this.setPointersPositions(t);var e=this.targetShape,n=!l.DD.isDragging||u.Konva.hitOnDragEnabled;e&&n?(e._fireAndBubble("mouseout",{evt:t}),e._fireAndBubble("mouseleave",{evt:t}),this._fire("mouseleave",{evt:t,target:this,currentTarget:this}),this.targetShape=null):n&&(this._fire("mouseleave",{evt:t,target:this,currentTarget:this}),this._fire("mouseout",{evt:t,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[],this._fire("contentMouseout",{evt:t})},n.prototype._mousemove=function(t){if(u.Konva.UA.ieMobile)return this._touchmove(t);this.setPointersPositions(t);var e,n=o.Util._getFirstPointerId(t),r=!l.DD.isDragging||u.Konva.hitOnDragEnabled;if(r){if((e=this.getIntersection(this.getPointerPosition()))&&e.isListening()){var i=!this.targetShape||this.targetShape!==e;r&&i?(this.targetShape&&(this.targetShape._fireAndBubble("mouseout",{evt:t,pointerId:n},e),this.targetShape._fireAndBubble("mouseleave",{evt:t,pointerId:n},e)),e._fireAndBubble("mouseover",{evt:t,pointerId:n},this.targetShape),e._fireAndBubble("mouseenter",{evt:t,pointerId:n},this.targetShape),e._fireAndBubble("mousemove",{evt:t,pointerId:n}),this.targetShape=e):e._fireAndBubble("mousemove",{evt:t,pointerId:n})}else this.targetShape&&r&&(this.targetShape._fireAndBubble("mouseout",{evt:t,pointerId:n}),this.targetShape._fireAndBubble("mouseleave",{evt:t,pointerId:n}),this._fire("mouseover",{evt:t,target:this,currentTarget:this,pointerId:n}),this.targetShape=null),this._fire("mousemove",{evt:t,target:this,currentTarget:this,pointerId:n});this._fire("contentMousemove",{evt:t})}t.cancelable&&t.preventDefault()},n.prototype._mousedown=function(t){if(u.Konva.UA.ieMobile)return this._touchstart(t);this.setPointersPositions(t);var e=o.Util._getFirstPointerId(t),n=this.getIntersection(this.getPointerPosition());l.DD.justDragged=!1,u.Konva.listenClickTap=!0,n&&n.isListening()?(this.clickStartShape=n,n._fireAndBubble("mousedown",{evt:t,pointerId:e})):this._fire("mousedown",{evt:t,target:this,currentTarget:this,pointerId:e}),this._fire("contentMousedown",{evt:t})},n.prototype._mouseup=function(t){if(u.Konva.UA.ieMobile)return this._touchend(t);this.setPointersPositions(t);var e=o.Util._getFirstPointerId(t),n=this.getIntersection(this.getPointerPosition()),r=this.clickStartShape,i=this.clickEndShape,s=!1;u.Konva.inDblClickWindow?(s=!0,clearTimeout(this.dblTimeout)):l.DD.justDragged||(u.Konva.inDblClickWindow=!0,clearTimeout(this.dblTimeout)),this.dblTimeout=setTimeout((function(){u.Konva.inDblClickWindow=!1}),u.Konva.dblClickWindow),n&&n.isListening()?(this.clickEndShape=n,n._fireAndBubble("mouseup",{evt:t,pointerId:e}),u.Konva.listenClickTap&&r&&r._id===n._id&&(n._fireAndBubble("click",{evt:t,pointerId:e}),s&&i&&i===n&&n._fireAndBubble("dblclick",{evt:t,pointerId:e}))):(this._fire("mouseup",{evt:t,target:this,currentTarget:this,pointerId:e}),u.Konva.listenClickTap&&this._fire("click",{evt:t,target:this,currentTarget:this,pointerId:e}),s&&this._fire("dblclick",{evt:t,target:this,currentTarget:this,pointerId:e})),this._fire("contentMouseup",{evt:t}),u.Konva.listenClickTap&&(this._fire("contentClick",{evt:t}),s&&this._fire("contentDblclick",{evt:t})),u.Konva.listenClickTap=!1,t.cancelable&&t.preventDefault()},n.prototype._contextmenu=function(t){this.setPointersPositions(t);var e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble("contextmenu",{evt:t}):this._fire("contextmenu",{evt:t,target:this,currentTarget:this}),this._fire("contentContextmenu",{evt:t})},n.prototype._touchstart=function(t){var e=this;this.setPointersPositions(t);var n=!1;this._changedPointerPositions.forEach((function(r){var i=e.getIntersection(r);u.Konva.listenClickTap=!0,l.DD.justDragged=!1,i&&i.isListening()&&(u.Konva.captureTouchEventsEnabled&&i.setPointerCapture(r.id),e.tapStartShape=i,i._fireAndBubble("touchstart",{evt:t,pointerId:r.id},e),n=!0,i.isListening()&&i.preventDefault()&&t.cancelable&&t.preventDefault())})),n||this._fire("touchstart",{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),this._fire("contentTouchstart",{evt:t})},n.prototype._touchmove=function(t){var e=this;if(this.setPointersPositions(t),!l.DD.isDragging||u.Konva.hitOnDragEnabled){var n=!1,r={};this._changedPointerPositions.forEach((function(i){var o=p.getCapturedShape(i.id)||e.getIntersection(i);o&&o.isListening()&&(r[o._id]||(r[o._id]=!0,o._fireAndBubble("touchmove",{evt:t,pointerId:i.id}),n=!0,o.isListening()&&o.preventDefault()&&t.cancelable&&t.preventDefault()))})),n||this._fire("touchmove",{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),this._fire("contentTouchmove",{evt:t})}l.DD.isDragging&&l.DD.node.preventDefault()&&t.cancelable&&t.preventDefault()},n.prototype._touchend=function(t){var e=this;this.setPointersPositions(t);var n=this.clickEndShape,r=!1;u.Konva.inDblClickWindow?(r=!0,clearTimeout(this.dblTimeout)):l.DD.justDragged||(u.Konva.inDblClickWindow=!0,clearTimeout(this.dblTimeout)),this.dblTimeout=setTimeout((function(){u.Konva.inDblClickWindow=!1}),u.Konva.dblClickWindow);var i=!1,o={},s=!1,a=!1;this._changedPointerPositions.forEach((function(c){var l=p.getCapturedShape(c.id)||e.getIntersection(c);l&&l.releaseCapture(c.id),l&&l.isListening()&&(o[l._id]||(o[l._id]=!0,e.clickEndShape=l,l._fireAndBubble("touchend",{evt:t,pointerId:c.id}),i=!0,u.Konva.listenClickTap&&l===e.tapStartShape&&(s=!0,l._fireAndBubble("tap",{evt:t,pointerId:c.id}),r&&n&&n===l&&(a=!0,l._fireAndBubble("dbltap",{evt:t,pointerId:c.id}))),l.isListening()&&l.preventDefault()&&t.cancelable&&t.preventDefault()))})),i||this._fire("touchend",{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),u.Konva.listenClickTap&&!s&&this._fire("tap",{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),r&&!a&&this._fire("dbltap",{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),this._fire("contentTouchend",{evt:t}),u.Konva.listenClickTap&&(this._fire("contentTap",{evt:t}),r&&this._fire("contentDbltap",{evt:t})),u.Konva.listenClickTap=!1},n.prototype._wheel=function(t){this.setPointersPositions(t);var e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble("wheel",{evt:t}):this._fire("wheel",{evt:t,target:this,currentTarget:this}),this._fire("contentWheel",{evt:t})},n.prototype._pointerdown=function(t){if(u.Konva._pointerEventsEnabled){this.setPointersPositions(t);var e=p.getCapturedShape(t.pointerId)||this.getIntersection(this.getPointerPosition());e&&e._fireAndBubble("pointerdown",p.createEvent(t))}},n.prototype._pointermove=function(t){if(u.Konva._pointerEventsEnabled){this.setPointersPositions(t);var e=p.getCapturedShape(t.pointerId)||this.getIntersection(this.getPointerPosition());e&&e._fireAndBubble("pointermove",p.createEvent(t))}},n.prototype._pointerup=function(t){if(u.Konva._pointerEventsEnabled){this.setPointersPositions(t);var e=p.getCapturedShape(t.pointerId)||this.getIntersection(this.getPointerPosition());e&&e._fireAndBubble("pointerup",p.createEvent(t)),p.releaseCapture(t.pointerId)}},n.prototype._pointercancel=function(t){if(u.Konva._pointerEventsEnabled){this.setPointersPositions(t);var e=p.getCapturedShape(t.pointerId)||this.getIntersection(this.getPointerPosition());e&&e._fireAndBubble("pointerup",p.createEvent(t)),p.releaseCapture(t.pointerId)}},n.prototype._lostpointercapture=function(t){p.releaseCapture(t.pointerId)},n.prototype.setPointersPositions=function(t){var e=this,n=this._getContentPosition(),r=null,i=null;void 0!==(t=t||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],o.Collection.prototype.each.call(t.touches,(function(t){e._pointerPositions.push({id:t.identifier,x:(t.clientX-n.left)/n.scaleX,y:(t.clientY-n.top)/n.scaleY})})),o.Collection.prototype.each.call(t.changedTouches||t.touches,(function(t){e._changedPointerPositions.push({id:t.identifier,x:(t.clientX-n.left)/n.scaleX,y:(t.clientY-n.top)/n.scaleY})}))):(r=(t.clientX-n.left)/n.scaleX,i=(t.clientY-n.top)/n.scaleY,this.pointerPos={x:r,y:i},this._pointerPositions=[{x:r,y:i,id:o.Util._getFirstPointerId(t)}],this._changedPointerPositions=[{x:r,y:i,id:o.Util._getFirstPointerId(t)}])},n.prototype._setPointerPosition=function(t){o.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(t)},n.prototype._getContentPosition=function(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var t=this.content.getBoundingClientRect();return{top:t.top,left:t.left,scaleX:t.width/this.content.clientWidth||1,scaleY:t.height/this.content.clientHeight||1}},n.prototype._buildDOM=function(){if(this.bufferCanvas=new c.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new c.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),u.Konva.isBrowser){var t=this.container();if(!t)throw"Stage has no container. A container is required.";t.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),t.appendChild(this.content),this._resizeDOM()}},n.prototype.cache=function(){return o.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this},n.prototype.clearCache=function(){return this},n.prototype.batchDraw=function(){return this.children.each((function(t){t.batchDraw()})),this},n}(a.Container);e.Stage=v,v.prototype.nodeType="Stage",h._registerNode(v),s.Factory.addGetterSetter(v,"container")},"67WC":function(t,e,n){"use strict";var r,i,o,s=n("SxGu"),a=n("g6v/"),u=n("z+kr"),c=n("Fib7"),l=n("hh1v"),h=n("Gi26"),p=n("9d/t"),f=n("DVFp"),d=n("kRJp"),g=n("yy0I"),m=n("7dAM"),v=n("OpvP"),y=n("4WOD"),x=n("0rvr"),b=n("tiKp"),_=n("kOOl"),w=n("afO8"),M=w.enforce,E=w.get,S=u.Int8Array,A=S&&S.prototype,C=u.Uint8ClampedArray,T=C&&C.prototype,P=S&&y(S),I=A&&y(A),L=Object.prototype,R=u.TypeError,O=b("toStringTag"),D=_("TYPED_ARRAY_TAG"),B=s&&!!x&&"Opera"!==p(u.opera),F=!1,N={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},k={BigInt64Array:8,BigUint64Array:8},G=function(t){var e=y(t);if(l(e)){var n=E(e);return n&&h(n,"TypedArrayConstructor")?n.TypedArrayConstructor:G(e)}},U=function(t){if(!l(t))return!1;var e=p(t);return h(N,e)||h(k,e)};for(r in N)(o=(i=u[r])&&i.prototype)?M(o).TypedArrayConstructor=i:B=!1;for(r in k)(o=(i=u[r])&&i.prototype)&&(M(o).TypedArrayConstructor=i);if((!B||!c(P)||P===Function.prototype)&&(P=function(){throw new R("Incorrect invocation")},B))for(r in N)u[r]&&x(u[r],P);if((!B||!I||I===L)&&(I=P.prototype,B))for(r in N)u[r]&&x(u[r].prototype,I);if(B&&y(T)!==I&&x(T,I),a&&!h(I,O))for(r in F=!0,m(I,O,{configurable:!0,get:function(){return l(this)?this[D]:void 0}}),N)u[r]&&d(u[r],D,r);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:B,TYPED_ARRAY_TAG:F&&D,aTypedArray:function(t){if(U(t))return t;throw new R("Target is not a typed array")},aTypedArrayConstructor:function(t){if(c(t)&&(!x||v(P,t)))return t;throw new R(f(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,e,n,r){if(a){if(n)for(var i in N){var o=u[i];if(o&&h(o.prototype,t))try{delete o.prototype[t]}catch(n){try{o.prototype[t]=e}catch(t){}}}I[t]&&!n||g(I,t,n?e:B&&A[t]||e,r)}},exportTypedArrayStaticMethod:function(t,e,n){var r,i;if(a){if(x){if(n)for(r in N)if((i=u[r])&&h(i,t))try{delete i[t]}catch(t){}if(P[t]&&!n)return;try{return g(P,t,n?e:B&&P[t]||e)}catch(t){}}for(r in N)!(i=u[r])||i[t]&&!n||g(i,t,e)}},getTypedArrayConstructor:G,isView:function(t){if(!l(t))return!1;var e=p(t);return"DataView"===e||h(N,e)||h(k,e)},isTypedArray:U,TypedArray:P,TypedArrayPrototype:I}},"68E8":function(t,e,n){"use strict";var r=n("tdvT");t.exports=/ipad|iphone|ipod/i.test(r)&&"undefined"!=typeof Pebble},"6JNq":function(t,e,n){"use strict";var r=n("Gi26"),i=n("Vu81"),o=n("Bs8V"),s=n("m/L8");t.exports=function(t,e,n){for(var a=i(e),u=s.f,c=o.f,l=0;l<a.length;l++){var h=a[l];r(t,h)||n&&r(n,h)||u(t,h,c(e,h))}}},"6LWA":function(t,e,n){"use strict";var r=n("xrYK");t.exports=Array.isArray||function(t){return"Array"===r(t)}},"6R/c":function(t,e,n){"use strict";var r=n("67WC"),i=n("TWQb").indexOf,o=r.aTypedArray;(0,r.exportTypedArrayMethod)("indexOf",(function(t){return i(o(this),t,arguments.length>1?arguments[1]:void 0)}))},"6VoE":function(t,e,n){"use strict";var r=n("tiKp"),i=n("P4y1"),o=r("iterator"),s=Array.prototype;t.exports=function(t){return void 0!==t&&(i.Array===t||s[o]===t)}},"6cQw":function(t,e,n){"use strict";var r=n("I+eb"),i=n("0GbY"),o=n("K6Rb"),s=n("xluM"),a=n("4zBA"),u=n("0Dky"),c=n("Fib7"),l=n("2bX/"),h=n("82ph"),p=n("4mfi"),f=n("BPiQ"),d=String,g=i("JSON","stringify"),m=a(/./.exec),v=a("".charAt),y=a("".charCodeAt),x=a("".replace),b=a(1..toString),_=/[\uD800-\uDFFF]/g,w=/^[\uD800-\uDBFF]$/,M=/^[\uDC00-\uDFFF]$/,E=!f||u((function(){var t=i("Symbol")("stringify detection");return"[null]"!==g([t])||"{}"!==g({a:t})||"{}"!==g(Object(t))})),S=u((function(){return'"\\udf06\\ud834"'!==g("\udf06\ud834")||'"\\udead"'!==g("\udead")})),A=function(t,e){var n=h(arguments),r=p(e);if(c(r)||void 0!==t&&!l(t))return n[1]=function(t,e){if(c(r)&&(e=s(r,this,d(t),e)),!l(e))return e},o(g,null,n)},C=function(t,e,n){var r=v(n,e-1),i=v(n,e+1);return m(w,t)&&!m(M,i)||m(M,t)&&!m(w,r)?"\\u"+b(y(t,0),16):t};g&&r({target:"JSON",stat:!0,arity:3,forced:E||S},{stringify:function(t,e,n){var r=h(arguments),i=o(E?A:g,null,r);return S&&"string"==typeof i?x(i,_,C):i}})},"6mFz":function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("8LQ0"),a=n("SXH2"),u=n("35O5"),c=n("RUZL"),l=n("13ei"),h=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.children=new o.Collection,e}return i(e,t),e.prototype.getChildren=function(t){if(!t)return this.children;var e=new o.Collection;return this.children.each((function(n){t(n)&&e.push(n)})),e},e.prototype.hasChildren=function(){return this.getChildren().length>0},e.prototype.removeChildren=function(){for(var t,e=0;e<this.children.length;e++)(t=this.children[e]).parent=null,t.index=0,t.remove();return this.children=new o.Collection,this},e.prototype.destroyChildren=function(){for(var t,e=0;e<this.children.length;e++)(t=this.children[e]).parent=null,t.index=0,t.destroy();return this.children=new o.Collection,this},e.prototype.add=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(arguments.length>1){for(var n=0;n<arguments.length;n++)this.add(arguments[n]);return this}var r=t[0];if(r.getParent())return r.moveTo(this),this;var i=this.children;return this._validateAdd(r),r._clearCaches(),r.index=i.length,r.parent=this,i.push(r),this._fire("add",{child:r}),this},e.prototype.destroy=function(){return this.hasChildren()&&this.destroyChildren(),t.prototype.destroy.call(this),this},e.prototype.find=function(t){return this._generalFind(t,!1)},e.prototype.get=function(t){return o.Util.warn("collection.get() method is deprecated. Please use collection.find() instead."),this.find(t)},e.prototype.findOne=function(t){var e=this._generalFind(t,!0);return e.length>0?e[0]:void 0},e.prototype._generalFind=function(t,e){var n=[];return this._descendants((function(r){var i=r._isMatch(t);return i&&n.push(r),!(!i||!e)})),o.Collection.toCollection(n)},e.prototype._descendants=function(t){for(var e=0;e<this.children.length;e++){var n=this.children[e];if(t(n))return!0;if(n.hasChildren()&&n._descendants(t))return!0}return!1},e.prototype.toObject=function(){var t=a.Node.prototype.toObject.call(this);t.children=[];for(var e=this.getChildren(),n=e.length,r=0;r<n;r++){var i=e[r];t.children.push(i.toObject())}return t},e.prototype._getDescendants=function(t){for(var e=[],n=t.length,r=0;r<n;r++){var i=t[r];this.isAncestorOf(i)&&e.push(i)}return e},e.prototype.isAncestorOf=function(t){for(var e=t.getParent();e;){if(e._id===this._id)return!0;e=e.getParent()}return!1},e.prototype.clone=function(t){var e=a.Node.prototype.clone.call(this,t);return this.getChildren().each((function(t){e.add(t.clone())})),e},e.prototype.getAllIntersections=function(t){var e=[];return this.find("Shape").each((function(n){n.isVisible()&&n.intersects(t)&&e.push(n)})),e},e.prototype._setChildrenIndices=function(){this.children.each((function(t,e){t.index=e}))},e.prototype.drawScene=function(t,e,n){var r=this.getLayer(),i=t||r&&r.getCanvas(),o=i&&i.getContext(),s=this._getCanvasCache(),a=s&&s.scene;return(this.isVisible()||n)&&(!n&&a?(o.save(),r._applyTransform(this,o,e),this._drawCachedSceneCanvas(o),o.restore()):this._drawChildren(i,"drawScene",e,!1,n,n)),this},e.prototype.drawHit=function(t,e,n){var r=this.getLayer(),i=t||r&&r.hitCanvas,o=i&&i.getContext(),s=this._getCanvasCache(),a=s&&s.hit;return(this.shouldDrawHit(i)||n)&&(!n&&a?(o.save(),r._applyTransform(this,o,e),this._drawCachedHitCanvas(o),o.restore()):this._drawChildren(i,"drawHit",e,!1,n,n)),this},e.prototype._drawChildren=function(t,e,n,r,i,o){var s,a,u=this.getLayer(),c=t&&t.getContext(),l=this.clipWidth(),h=this.clipHeight(),p=this.clipFunc(),f=l&&h||p;if(f&&u){c.save();var d=this.getAbsoluteTransform(n),g=d.getMatrix();c.transform(g[0],g[1],g[2],g[3],g[4],g[5]),c.beginPath(),p?p.call(this,c,this):(s=this.clipX(),a=this.clipY(),c.rect(s,a,l,h)),c.clip(),g=d.copy().invert().getMatrix(),c.transform(g[0],g[1],g[2],g[3],g[4],g[5])}var m="source-over"!==this.globalCompositeOperation()&&!o&&"drawScene"===e;m&&u&&(c.save(),c._applyGlobalCompositeOperation(this)),this.children.each((function(o){o[e](t,n,r,i)})),m&&u&&c.restore(),f&&u&&c.restore()},e.prototype.shouldDrawHit=function(t){if(t&&t.isCache)return!0;var e=this.getLayer(),n=!1;u.DD._dragElements.forEach((function(t){"dragging"===t.dragStatus&&t.node.getLayer()===e&&(n=!0)}));var r=!l.Konva.hitOnDragEnabled&&n;return e&&e.hitGraphEnabled()&&this.isVisible()&&!r},e.prototype.getClientRect=function(t){var e,n,r,i,o=(t=t||{}).skipTransform,s=t.relativeTo,a={x:1/0,y:1/0,width:0,height:0},u=this;this.children.each((function(o){if(o.visible()){var s=o.getClientRect({relativeTo:u,skipShadow:t.skipShadow,skipStroke:t.skipStroke});0===s.width&&0===s.height||(void 0===e?(e=s.x,n=s.y,r=s.x+s.width,i=s.y+s.height):(e=Math.min(e,s.x),n=Math.min(n,s.y),r=Math.max(r,s.x+s.width),i=Math.max(i,s.y+s.height)))}}));for(var c=this.find("Shape"),l=!1,h=0;h<c.length;h++){if(c[h]._isVisible(this)){l=!0;break}}return a=l&&void 0!==e?{x:e,y:n,width:r-e,height:i-n}:{x:0,y:0,width:0,height:0},o?a:this._transformedRect(a,s)},e}(a.Node);e.Container=h,s.Factory.addComponentsGetterSetter(h,"clip",["x","y","width","height"]),s.Factory.addGetterSetter(h,"clipX",void 0,c.getNumberValidator()),s.Factory.addGetterSetter(h,"clipY",void 0,c.getNumberValidator()),s.Factory.addGetterSetter(h,"clipWidth",void 0,c.getNumberValidator()),s.Factory.addGetterSetter(h,"clipHeight",void 0,c.getNumberValidator()),s.Factory.addGetterSetter(h,"clipFunc"),o.Collection.mapMethods(h)},"6oOd":function(t,e,n){"use strict";var r=n("tdvT").match(/AppleWebKit\/(\d+)\./);t.exports=!!r&&+r[1]},"6sUC":function(t,e,n){"use strict";var r=n("hh1v"),i=Math.floor;t.exports=Number.isInteger||function(t){return!r(t)&&isFinite(t)&&i(t)===t}},"7+zs":function(t,e,n){"use strict";var r=n("Gi26"),i=n("yy0I"),o=n("UesL"),s=n("tiKp")("toPrimitive"),a=Date.prototype;r(a,s)||i(a,s,o)},"7IeV":function(t,e,n){"use strict";var r=n("tdvT");t.exports=/web0s(?!.*chrome)/i.test(r)},"7T3k":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("13ei"),i=r.glob.performance&&r.glob.performance.now?function(){return r.glob.performance.now()}:function(){return(new Date).getTime()},o=function(){function t(e,n){this.id=t.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:i(),frameRate:0},this.func=e,this.setLayers(n)}return t.prototype.setLayers=function(t){var e=[];return e=t?t.length>0?t:[t]:[],this.layers=e,this},t.prototype.getLayers=function(){return this.layers},t.prototype.addLayer=function(t){var e,n=this.layers,r=n.length;for(e=0;e<r;e++)if(n[e]._id===t._id)return!1;return this.layers.push(t),!0},t.prototype.isRunning=function(){var e,n=t.animations,r=n.length;for(e=0;e<r;e++)if(n[e].id===this.id)return!0;return!1},t.prototype.start=function(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=i(),t._addAnimation(this),this},t.prototype.stop=function(){return t._removeAnimation(this),this},t.prototype._updateFrameObject=function(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff},t._addAnimation=function(t){this.animations.push(t),this._handleAnimation()},t._removeAnimation=function(t){var e,n=t.id,r=this.animations,i=r.length;for(e=0;e<i;e++)if(r[e].id===n){this.animations.splice(e,1);break}},t._runFrames=function(){var t,e,n,r,o,s,a,u,c={},l=this.animations;for(r=0;r<l.length;r++)if(e=(t=l[r]).layers,n=t.func,t._updateFrameObject(i()),s=e.length,!n||!1!==n.call(t,t.frame))for(o=0;o<s;o++)void 0!==(a=e[o])._id&&(c[a._id]=a);for(u in c)c.hasOwnProperty(u)&&c[u].draw()},t._animationLoop=function(){var e=t;e.animations.length?(e._runFrames(),requestAnimationFrame(e._animationLoop)):e.animRunning=!1},t._handleAnimation=function(){this.animRunning||(this.animRunning=!0,requestAnimationFrame(this._animationLoop))},t.animations=[],t.animIdCounter=0,t.animRunning=!1,t}();e.Animation=o},"7dAM":function(t,e,n){"use strict";var r=n("E9LY"),i=n("m/L8");t.exports=function(t,e,n){return n.get&&r(n.get,e,{getter:!0}),n.set&&r(n.set,e,{setter:!0}),i.f(t,e,n)}},"81y5":function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("6mFz"),a=n("13ei"),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype._validateAdd=function(t){var e=t.getType();"Group"!==e&&"Shape"!==e&&o.Util.throw("You may only add groups and shapes to groups.")},e}(s.Container);e.Group=u,u.prototype.nodeType="Group",a._registerNode(u),o.Collection.mapMethods(u)},"82ph":function(t,e,n){"use strict";var r=n("4zBA");t.exports=r([].slice)},"8GlL":function(t,e,n){"use strict";var r=n("We1y"),i=TypeError,o=function(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw new i("Bad Promise constructor");e=t,n=r})),this.resolve=r(e),this.reject=r(n)};t.exports.f=function(t){return new o(t)}},"8LQ0":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("nLhi"),i=n("RUZL");e.Factory={addGetterSetter:function(t,e,n,r,i){this.addGetter(t,e,n),this.addSetter(t,e,r,i),this.addOverloadedGetterSetter(t,e)},addGetter:function(t,e,n){var i="get"+r.Util._capitalize(e);t.prototype[i]=t.prototype[i]||function(){var t=this.attrs[e];return void 0===t?n:t}},addSetter:function(t,n,i,o){var s="set"+r.Util._capitalize(n);t.prototype[s]||e.Factory.overWriteSetter(t,n,i,o)},overWriteSetter:function(t,e,n,i){var o="set"+r.Util._capitalize(e);t.prototype[o]=function(t){return n&&null!=t&&(t=n.call(this,t,e)),this._setAttr(e,t),i&&i.call(this),this}},addComponentsGetterSetter:function(t,e,n,o,s){var a,u,c=n.length,l=r.Util._capitalize,h="get"+l(e),p="set"+l(e);t.prototype[h]=function(){var t={};for(a=0;a<c;a++)t[u=n[a]]=this.getAttr(e+l(u));return t};var f=i.getComponentValidator(n);t.prototype[p]=function(t){var n,r=this.attrs[e];for(n in o&&(t=o.call(this,t)),f&&f.call(this,t,e),t)t.hasOwnProperty(n)&&this._setAttr(e+l(n),t[n]);return this._fireChangeEvent(e,r,t),s&&s.call(this),this},this.addOverloadedGetterSetter(t,e)},addOverloadedGetterSetter:function(t,e){var n=r.Util._capitalize(e),i="set"+n,o="get"+n;t.prototype[e]=function(){return arguments.length?(this[i](arguments[0]),this):this[o]()}},addDeprecatedGetterSetter:function(t,e,n,i){r.Util.error("Adding deprecated "+e);var o="get"+r.Util._capitalize(e),s=e+" property is deprecated and will be removed soon. Look at Konva change log for more information.";t.prototype[o]=function(){r.Util.error(s);var t=this.attrs[e];return void 0===t?n:t},this.addSetter(t,e,i,(function(){r.Util.error(s)})),this.addOverloadedGetterSetter(t,e)},backCompat:function(t,e){r.Util.each(e,(function(e,n){var i=t.prototype[n],o="get"+r.Util._capitalize(e),s="set"+r.Util._capitalize(e);function a(){i.apply(this,arguments),r.Util.error('"'+e+'" method is deprecated and will be removed soon. Use ""'+n+'" instead.')}t.prototype[e]=a,t.prototype[o]=a,t.prototype[s]=a}))},afterSetFilter:function(){this._filterUpToDate=!1}}},"8YOa":function(t,e,n){"use strict";var r=n("I+eb"),i=n("4zBA"),o=n("0BK2"),s=n("hh1v"),a=n("Gi26"),u=n("m/L8").f,c=n("JBy8"),l=n("BX/b"),h=n("T63f"),p=n("kOOl"),f=n("uy83"),d=!1,g=p("meta"),m=0,v=function(t){u(t,g,{value:{objectID:"O"+m++,weakData:{}}})},y=t.exports={enable:function(){y.enable=function(){},d=!0;var t=c.f,e=i([].splice),n={};n[g]=1,t(n).length&&(c.f=function(n){for(var r=t(n),i=0,o=r.length;i<o;i++)if(r[i]===g){e(r,i,1);break}return r},r({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:l.f}))},fastKey:function(t,e){if(!s(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!a(t,g)){if(!h(t))return"F";if(!e)return"E";v(t)}return t[g].objectID},getWeakData:function(t,e){if(!a(t,g)){if(!h(t))return!0;if(!e)return!1;v(t)}return t[g].weakData},onFreeze:function(t){return f&&d&&h(t)&&!a(t,g)&&v(t),t}};o[g]=!0},"8itv":function(t,e,n){"use strict";var r=n("I+eb"),i=n("8GlL");r({target:"Promise",stat:!0,forced:n("Rzhe").CONSTRUCTOR},{reject:function(t){var e=i.f(this);return(0,e.reject)(t),e.promise}})},"8oxB":function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,c=[],l=!1,h=-1;function p(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&f())}function f(){if(!l){var t=a(p);l=!0;for(var e=c.length;e;){for(u=c,c=[];++h<e;)u&&u[h].run();h=-1,e=c.length}u=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function g(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new d(t,e)),1!==c.length||l||a(f)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},"90hW":function(t,e,n){"use strict";t.exports=Math.sign||function(t){var e=+t;return 0===e||e!=e?e:e<0?-1:1}},"93I0":function(t,e,n){"use strict";var r=n("VpIT"),i=n("kOOl"),o=r("keys");t.exports=function(t){return o[t]||(o[t]=i(t))}},"9JVa":function(t,e,n){"use strict";var r=n("wE6v"),i=TypeError;t.exports=function(t){var e=r(t,"number");if("number"==typeof e)throw new i("Can't convert number to bigint");return BigInt(e)}},"9d/t":function(t,e,n){"use strict";var r=n("AO7/"),i=n("Fib7"),o=n("xrYK"),s=n("tiKp")("toStringTag"),a=Object,u="Arguments"===o(function(){return arguments}());t.exports=r?o:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=a(t),s))?n:u?o(e):"Object"===(r=o(e))&&i(e.callee)?"Arguments":r}},"9lVk":function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o,s=n("nLhi"),a=n("xSfM"),u=n("13ei"),c=n("8LQ0"),l=n("RUZL");var h=function(){function t(t){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var e=(t||{}).pixelRatio||u.Konva.pixelRatio||function(){if(o)return o;var t=s.Util.createCanvasElement().getContext("2d");return o=(u.Konva._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)}();this.pixelRatio=e,this._canvas=s.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}return t.prototype.getContext=function(){return this.context},t.prototype.getPixelRatio=function(){return this.pixelRatio},t.prototype.setPixelRatio=function(t){var e=this.pixelRatio;this.pixelRatio=t,this.setSize(this.getWidth()/e,this.getHeight()/e)},t.prototype.setWidth=function(t){this.width=this._canvas.width=t*this.pixelRatio,this._canvas.style.width=t+"px";var e=this.pixelRatio;this.getContext()._context.scale(e,e)},t.prototype.setHeight=function(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";var e=this.pixelRatio;this.getContext()._context.scale(e,e)},t.prototype.getWidth=function(){return this.width},t.prototype.getHeight=function(){return this.height},t.prototype.setSize=function(t,e){this.setWidth(t||0),this.setHeight(e||0)},t.prototype.toDataURL=function(t,e){try{return this._canvas.toDataURL(t,e)}catch(t){try{return this._canvas.toDataURL()}catch(t){return s.Util.error("Unable to get data URL. "+t.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}},t}();e.Canvas=h,c.Factory.addGetterSetter(h,"pixelRatio",void 0,l.getNumberValidator());var p=function(t){function e(e){void 0===e&&(e={width:0,height:0});var n=t.call(this,e)||this;return n.context=new a.SceneContext(n),n.setSize(e.width,e.height),n}return i(e,t),e}(h);e.SceneCanvas=p;var f=function(t){function e(e){void 0===e&&(e={width:0,height:0});var n=t.call(this,e)||this;return n.hitCanvas=!0,n.context=new a.HitContext(n),n.setSize(e.width,e.height),n}return i(e,t),e}(h);e.HitCanvas=f},"9rSQ":function(t,e,n){"use strict";var r=n("xTJ+");function i(){this.handlers=[]}i.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},i.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},i.prototype.forEach=function(t){r.forEach(this.handlers,(function(e){null!==e&&t(e)}))},t.exports=i},"9wk+":function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r};Object.defineProperty(e,"__esModule",{value:!0});var s=n("nLhi"),a=n("8LQ0"),u=n("/OYL"),c=n("RUZL"),l=n("13ei"),h=function(t){function e(e){var n=t.call(this,e)||this;return n.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",(function(){this._clearCache("tensionPoints")})),n}return i(e,t),e.prototype._sceneFunc=function(t){var e,n,r,i=this.points(),o=i.length,s=this.tension(),a=this.closed(),u=this.bezier();if(o){if(t.beginPath(),t.moveTo(i[0],i[1]),0!==s&&o>4){for(n=(e=this.getTensionPoints()).length,r=a?0:4,a||t.quadraticCurveTo(e[0],e[1],e[2],e[3]);r<n-2;)t.bezierCurveTo(e[r++],e[r++],e[r++],e[r++],e[r++],e[r++]);a||t.quadraticCurveTo(e[n-2],e[n-1],i[o-2],i[o-1])}else if(u)for(r=2;r<o;)t.bezierCurveTo(i[r++],i[r++],i[r++],i[r++],i[r++],i[r++]);else for(r=2;r<o;r+=2)t.lineTo(i[r],i[r+1]);a?(t.closePath(),t.fillStrokeShape(this)):t.strokeShape(this)}},e.prototype.getTensionPoints=function(){return this._getCache("tensionPoints",this._getTensionPoints)},e.prototype._getTensionPoints=function(){return this.closed()?this._getTensionPointsClosed():s.Util._expandPoints(this.points(),this.tension())},e.prototype._getTensionPointsClosed=function(){var t=this.points(),e=t.length,n=this.tension(),r=s.Util._getControlPoints(t[e-2],t[e-1],t[0],t[1],t[2],t[3],n),i=s.Util._getControlPoints(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],n),o=s.Util._expandPoints(t,n);return[r[2],r[3]].concat(o).concat([i[0],i[1],t[e-2],t[e-1],i[2],i[3],r[0],r[1],t[0],t[1]])},e.prototype.getWidth=function(){return this.getSelfRect().width},e.prototype.getHeight=function(){return this.getSelfRect().height},e.prototype.getSelfRect=function(){var t=this.points();if(t.length<4)return{x:t[0]||0,y:t[1]||0,width:0,height:0};for(var e,n,r=(t=0!==this.tension()?o([t[0],t[1]],this._getTensionPoints(),[t[t.length-2],t[t.length-1]]):this.points())[0],i=t[0],s=t[1],a=t[1],u=0;u<t.length/2;u++)e=t[2*u],n=t[2*u+1],r=Math.min(r,e),i=Math.max(i,e),s=Math.min(s,n),a=Math.max(a,n);return{x:r,y:s,width:i-r,height:a-s}},e}(u.Shape);e.Line=h,h.prototype.className="Line",h.prototype._attrsAffectingSize=["points","bezier","tension"],l._registerNode(h),a.Factory.addGetterSetter(h,"closed",!1),a.Factory.addGetterSetter(h,"bezier",!1),a.Factory.addGetterSetter(h,"tension",0,c.getNumberValidator()),a.Factory.addGetterSetter(h,"points",[],c.getNumberArrayValidator()),s.Collection.mapMethods(h)},A2ZE:function(t,e,n){"use strict";var r=n("RiVN"),i=n("We1y"),o=n("QNWe"),s=r(r.bind);t.exports=function(t,e){return i(t),void 0===e?t:o?s(t,e):function(){return t.apply(e,arguments)}}},AJTl:function(t,e,n){"use strict";var r,i=n("uy83"),o=n("z+kr"),s=n("4zBA"),a=n("aWRN"),u=n("8YOa"),c=n("bWFh"),l=n("rKzb"),h=n("hh1v"),p=n("afO8").enforce,f=n("0Dky"),d=n("zc4i"),g=Object,m=Array.isArray,v=g.isExtensible,y=g.isFrozen,x=g.isSealed,b=g.freeze,_=g.seal,w=!o.ActiveXObject&&"ActiveXObject"in o,M=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},E=c("WeakMap",M,l),S=E.prototype,A=s(S.set);if(d)if(w){r=l.getConstructor(M,"WeakMap",!0),u.enable();var C=s(S.delete),T=s(S.has),P=s(S.get);a(S,{delete:function(t){if(h(t)&&!v(t)){var e=p(this);return e.frozen||(e.frozen=new r),C(this,t)||e.frozen.delete(t)}return C(this,t)},has:function(t){if(h(t)&&!v(t)){var e=p(this);return e.frozen||(e.frozen=new r),T(this,t)||e.frozen.has(t)}return T(this,t)},get:function(t){if(h(t)&&!v(t)){var e=p(this);return e.frozen||(e.frozen=new r),T(this,t)?P(this,t):e.frozen.get(t)}return P(this,t)},set:function(t,e){if(h(t)&&!v(t)){var n=p(this);n.frozen||(n.frozen=new r),T(this,t)?A(this,t,e):n.frozen.set(t,e)}else A(this,t,e);return this}})}else i&&f((function(){var t=b([]);return A(new E,t,1),!y(t)}))&&a(S,{set:function(t,e){var n;return m(t)&&(y(t)?n=b:x(t)&&(n=_)),A(this,t,e),n&&n(t),this}})},"AO7/":function(t,e,n){"use strict";var r={};r[n("tiKp")("toStringTag")]="z",t.exports="[object z]"===String(r)},AbTg:function(t,e,n){"use strict";var r=function(){this.head=null,this.tail=null};r.prototype={add:function(t){var e={item:t,next:null},n=this.tail;n?n.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}},t.exports=r},"B/qT":function(t,e,n){"use strict";var r=n("UMSQ");t.exports=function(t){return r(t.length)}},BPiQ:function(t,e,n){"use strict";var r=n("EhIz"),i=n("0Dky"),o=n("z+kr").String;t.exports=!!Object.getOwnPropertySymbols&&!i((function(){var t=Symbol("symbol detection");return!o(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},BTho:function(t,e,n){"use strict";var r=n("4zBA"),i=n("We1y"),o=n("hh1v"),s=n("Gi26"),a=n("82ph"),u=n("QNWe"),c=Function,l=r([].concat),h=r([].join),p={},f=function(t,e,n){if(!s(p,e)){for(var r=[],i=0;i<e;i++)r[i]="a["+i+"]";p[e]=c("C,a","return new C("+h(r,",")+")")}return p[e](t,n)};t.exports=u?c.bind:function(t){var e=i(this),n=e.prototype,r=a(arguments,1),s=function(){var n=l(r,a(arguments));return this instanceof s?f(e,n.length,n):e.apply(t,n)};return o(n)&&(s.prototype=n),s}},"BX/b":function(t,e,n){"use strict";var r=n("xrYK"),i=n("/GqU"),o=n("JBy8").f,s=n("82ph"),a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return a&&"Window"===r(t)?function(t){try{return o(t)}catch(t){return s(a)}}(t):o(i(t))}},Bs8V:function(t,e,n){"use strict";var r=n("g6v/"),i=n("xluM"),o=n("0eef"),s=n("XGwC"),a=n("/GqU"),u=n("oEtG"),c=n("Gi26"),l=n("DPsx"),h=Object.getOwnPropertyDescriptor;e.f=r?h:function(t,e){if(t=a(t),e=u(e),l)try{return h(t,e)}catch(t){}if(c(t,e))return s(!i(o.f,t,e),t[e])}},Bvic:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("nLhi"),i=n("7T3k"),o=n("SXH2"),s=n("13ei"),a={node:1,duration:1,easing:1,onFinish:1,yoyo:1},u=0,c=["fill","stroke","shadowColor"],l=function(){function t(t,e,n,r,i,o,s){this.prop=t,this.propFunc=e,this.begin=r,this._pos=r,this.duration=o,this._change=0,this.prevPos=0,this.yoyo=s,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=i-this.begin,this.pause()}return t.prototype.fire=function(t){var e=this[t];e&&e()},t.prototype.setTime=function(t){t>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():t<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=t,this.update())},t.prototype.getTime=function(){return this._time},t.prototype.setPosition=function(t){this.prevPos=this._pos,this.propFunc(t),this._pos=t},t.prototype.getPosition=function(t){return void 0===t&&(t=this._time),this.func(t,this.begin,this._change,this.duration)},t.prototype.play=function(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")},t.prototype.reverse=function(){this.state=3,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")},t.prototype.seek=function(t){this.pause(),this._time=t,this.update(),this.fire("onSeek")},t.prototype.reset=function(){this.pause(),this._time=0,this.update(),this.fire("onReset")},t.prototype.finish=function(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")},t.prototype.update=function(){this.setPosition(this.getPosition(this._time))},t.prototype.onEnterFrame=function(){var t=this.getTimer()-this._startTime;2===this.state?this.setTime(t):3===this.state&&this.setTime(this.duration-t)},t.prototype.pause=function(){this.state=1,this.fire("onPause")},t.prototype.getTimer=function(){return(new Date).getTime()},t}(),h=function(){function t(n){var o,c,h=this,p=n.node,f=p._id,d=n.easing||e.Easings.Linear,g=!!n.yoyo;o=void 0===n.duration?.3:0===n.duration?.001:n.duration,this.node=p,this._id=u++;var m=p.getLayer()||(p instanceof s.Konva.Stage?p.getLayers():null);for(c in m||r.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new i.Animation((function(){h.tween.onEnterFrame()}),m),this.tween=new l(c,(function(t){h._tweenFunc(t)}),d,0,1,1e3*o,g),this._addListeners(),t.attrs[f]||(t.attrs[f]={}),t.attrs[f][this._id]||(t.attrs[f][this._id]={}),t.tweens[f]||(t.tweens[f]={}),n)void 0===a[c]&&this._addAttr(c,n[c]);this.reset(),this.onFinish=n.onFinish,this.onReset=n.onReset}return t.prototype._addAttr=function(e,n){var i,o,s,a,u,l,h,p,f=this.node,d=f._id;if((s=t.tweens[d][e])&&delete t.attrs[d][s][e],i=f.getAttr(e),r.Util._isArray(n))if(o=[],u=Math.max(n.length,i.length),"points"===e&&n.length!==i.length&&(n.length>i.length?(h=i,i=r.Util._prepareArrayForTween(i,n,f.closed())):(l=n,n=r.Util._prepareArrayForTween(n,i,f.closed()))),0===e.indexOf("fill"))for(a=0;a<u;a++)if(a%2==0)o.push(n[a]-i[a]);else{var g=r.Util.colorToRGBA(i[a]);p=r.Util.colorToRGBA(n[a]),i[a]=g,o.push({r:p.r-g.r,g:p.g-g.g,b:p.b-g.b,a:p.a-g.a})}else for(a=0;a<u;a++)o.push(n[a]-i[a]);else-1!==c.indexOf(e)?(i=r.Util.colorToRGBA(i),o={r:(p=r.Util.colorToRGBA(n)).r-i.r,g:p.g-i.g,b:p.b-i.b,a:p.a-i.a}):o=n-i;t.attrs[d][this._id][e]={start:i,diff:o,end:n,trueEnd:l,trueStart:h},t.tweens[d][e]=this._id},t.prototype._tweenFunc=function(e){var n,i,o,s,a,u,l,h,p=this.node,f=t.attrs[p._id][this._id];for(n in f){if(o=(i=f[n]).start,s=i.diff,h=i.end,r.Util._isArray(o))if(a=[],l=Math.max(o.length,h.length),0===n.indexOf("fill"))for(u=0;u<l;u++)u%2==0?a.push((o[u]||0)+s[u]*e):a.push("rgba("+Math.round(o[u].r+s[u].r*e)+","+Math.round(o[u].g+s[u].g*e)+","+Math.round(o[u].b+s[u].b*e)+","+(o[u].a+s[u].a*e)+")");else for(u=0;u<l;u++)a.push((o[u]||0)+s[u]*e);else a=-1!==c.indexOf(n)?"rgba("+Math.round(o.r+s.r*e)+","+Math.round(o.g+s.g*e)+","+Math.round(o.b+s.b*e)+","+(o.a+s.a*e)+")":o+s*e;p.setAttr(n,a)}},t.prototype._addListeners=function(){var e=this;this.tween.onPlay=function(){e.anim.start()},this.tween.onReverse=function(){e.anim.start()},this.tween.onPause=function(){e.anim.stop()},this.tween.onFinish=function(){var n=e.node,r=t.attrs[n._id][e._id];r.points&&r.points.trueEnd&&n.setAttr("points",r.points.trueEnd),e.onFinish&&e.onFinish.call(e)},this.tween.onReset=function(){var n=e.node,r=t.attrs[n._id][e._id];r.points&&r.points.trueStart&&n.points(r.points.trueStart),e.onReset&&e.onReset()}},t.prototype.play=function(){return this.tween.play(),this},t.prototype.reverse=function(){return this.tween.reverse(),this},t.prototype.reset=function(){return this.tween.reset(),this},t.prototype.seek=function(t){return this.tween.seek(1e3*t),this},t.prototype.pause=function(){return this.tween.pause(),this},t.prototype.finish=function(){return this.tween.finish(),this},t.prototype.destroy=function(){var e,n=this.node._id,r=this._id,i=t.tweens[n];for(e in this.pause(),i)delete t.tweens[n][e];delete t.attrs[n][r]},t.attrs={},t.tweens={},t}();e.Tween=h,o.Node.prototype.to=function(t){var e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()},new h(t).play()},e.Easings={BackEaseIn:function(t,e,n,r){var i=1.70158;return n*(t/=r)*t*((i+1)*t-i)+e},BackEaseOut:function(t,e,n,r){var i=1.70158;return n*((t=t/r-1)*t*((i+1)*t+i)+1)+e},BackEaseInOut:function(t,e,n,r){var i=1.70158;return(t/=r/2)<1?n/2*(t*t*((1+(i*=1.525))*t-i))+e:n/2*((t-=2)*t*((1+(i*=1.525))*t+i)+2)+e},ElasticEaseIn:function(t,e,n,r,i,o){var s=0;return 0===t?e:1==(t/=r)?e+n:(o||(o=.3*r),!i||i<Math.abs(n)?(i=n,s=o/4):s=o/(2*Math.PI)*Math.asin(n/i),-i*Math.pow(2,10*(t-=1))*Math.sin((t*r-s)*(2*Math.PI)/o)+e)},ElasticEaseOut:function(t,e,n,r,i,o){var s=0;return 0===t?e:1==(t/=r)?e+n:(o||(o=.3*r),!i||i<Math.abs(n)?(i=n,s=o/4):s=o/(2*Math.PI)*Math.asin(n/i),i*Math.pow(2,-10*t)*Math.sin((t*r-s)*(2*Math.PI)/o)+n+e)},ElasticEaseInOut:function(t,e,n,r,i,o){var s=0;return 0===t?e:2==(t/=r/2)?e+n:(o||(o=r*(.3*1.5)),!i||i<Math.abs(n)?(i=n,s=o/4):s=o/(2*Math.PI)*Math.asin(n/i),t<1?i*Math.pow(2,10*(t-=1))*Math.sin((t*r-s)*(2*Math.PI)/o)*-.5+e:i*Math.pow(2,-10*(t-=1))*Math.sin((t*r-s)*(2*Math.PI)/o)*.5+n+e)},BounceEaseOut:function(t,e,n,r){return(t/=r)<1/2.75?n*(7.5625*t*t)+e:t<2/2.75?n*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?n*(7.5625*(t-=2.25/2.75)*t+.9375)+e:n*(7.5625*(t-=2.625/2.75)*t+.984375)+e},BounceEaseIn:function(t,n,r,i){return r-e.Easings.BounceEaseOut(i-t,0,r,i)+n},BounceEaseInOut:function(t,n,r,i){return t<i/2?.5*e.Easings.BounceEaseIn(2*t,0,r,i)+n:.5*e.Easings.BounceEaseOut(2*t-i,0,r,i)+.5*r+n},EaseIn:function(t,e,n,r){return n*(t/=r)*t+e},EaseOut:function(t,e,n,r){return-n*(t/=r)*(t-2)+e},EaseInOut:function(t,e,n,r){return(t/=r/2)<1?n/2*t*t+e:-n/2*(--t*(t-2)-1)+e},StrongEaseIn:function(t,e,n,r){return n*(t/=r)*t*t*t*t+e},StrongEaseOut:function(t,e,n,r){return n*((t=t/r-1)*t*t*t*t+1)+e},StrongEaseInOut:function(t,e,n,r){return(t/=r/2)<1?n/2*t*t*t*t*t+e:n/2*((t-=2)*t*t*t*t+2)+e},Linear:function(t,e,n,r){return n*t/r+e}}},C0Ia:function(t,e,n){"use strict";var r=n("6LWA"),i=n("aO6C"),o=n("hh1v"),s=n("tiKp")("species"),a=Array;t.exports=function(t){var e;return r(t)&&(e=t.constructor,(i(e)&&(e===a||r(e.prototype))||o(e)&&null===(e=e[s]))&&(e=void 0)),void 0===e?a:e}},C0Od:function(t,e,n){"use strict";var r=n("BPiQ");t.exports=r&&!!Symbol.for&&!!Symbol.keyFor},CDr4:function(t,e,n){"use strict";var r=n("DVFp"),i=TypeError;t.exports=function(t,e){if(!delete t[e])throw new i("Cannot delete property "+r(e)+" of "+r(t))}},CgaS:function(t,e,n){"use strict";var r=n("xTJ+"),i=n("MLWZ"),o=n("9rSQ"),s=n("UnBK"),a=n("SntB");function u(t){this.defaults=t,this.interceptors={request:new o,response:new o}}u.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=[s,void 0],n=Promise.resolve(t);for(this.interceptors.request.forEach((function(t){e.unshift(t.fulfilled,t.rejected)})),this.interceptors.response.forEach((function(t){e.push(t.fulfilled,t.rejected)}));e.length;)n=n.then(e.shift(),e.shift());return n},u.prototype.getUri=function(t){return t=a(this.defaults,t),i(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(t){u.prototype[t]=function(e,n){return this.request(r.merge(n||{},{method:t,url:e}))}})),r.forEach(["post","put","patch"],(function(t){u.prototype[t]=function(e,n,i){return this.request(r.merge(i||{},{method:t,url:e,data:n}))}})),t.exports=u},CyXQ:function(t,e,n){"use strict";var r=n("WSbT"),i=n("UMSQ"),o=RangeError;t.exports=function(t){if(void 0===t)return 0;var e=r(t),n=i(e);if(e!==n)throw new o("Wrong length or index");return n}},"D/Vs":function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("6mFz"),a=n("8LQ0"),u=n("1q+a"),c=n("9lVk"),l=n("/OYL"),h=n("RUZL"),p=n("13ei"),f=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],d=f.length,g=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.hitCanvas=new c.HitCanvas({pixelRatio:1}),e}return i(e,t),e.prototype._setCanvasSize=function(t,e){this.canvas.setSize(t,e),this.hitCanvas.setSize(t,e),this._checkSmooth()},e.prototype._validateAdd=function(t){var e=t.getType();"Group"!==e&&"Shape"!==e&&o.Util.throw("You may only add groups and shapes to a layer.")},e.prototype.getIntersection=function(t,e){var n,r,i,o;if(!this.hitGraphEnabled()||!this.isVisible())return null;for(var s=1,a=!1;;){for(r=0;r<d;r++){if(i=f[r],(o=(n=this._getIntersection({x:t.x+i.x*s,y:t.y+i.y*s})).shape)&&e)return o.findAncestor(e,!0);if(o)return o;if(a=!!n.antialiased,!n.antialiased)break}if(!a)return null;s+=1}},e.prototype._getIntersection=function(t){var e,n,r=this.hitCanvas.pixelRatio,i=this.hitCanvas.context.getImageData(Math.round(t.x*r),Math.round(t.y*r),1,1).data,s=i[3];return 255===s?(e=o.Util._rgbToHex(i[0],i[1],i[2]),(n=l.shapes["#"+e])?{shape:n}:{antialiased:!0}):s>0?{antialiased:!0}:{}},e.prototype.drawScene=function(t,e){var n=this.getLayer(),r=t||n&&n.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),s.Container.prototype.drawScene.call(this,r,e),this._fire("draw",{node:this}),this},e.prototype.drawHit=function(t,e){var n=this.getLayer(),r=t||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),s.Container.prototype.drawHit.call(this,r,e),this},e.prototype.clear=function(t){return u.BaseLayer.prototype.clear.call(this,t),this.getHitCanvas().getContext().clear(t),this},e.prototype.enableHitGraph=function(){return this.hitGraphEnabled(!0),this},e.prototype.disableHitGraph=function(){return this.hitGraphEnabled(!1),this},e.prototype.toggleHitCanvas=function(){if(this.parent){var t=this.parent;!!this.hitCanvas._canvas.parentNode?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}},e.prototype.setSize=function(e){var n=e.width,r=e.height;return t.prototype.setSize.call(this,{width:n,height:r}),this.hitCanvas.setSize(n,r),this},e}(u.BaseLayer);e.Layer=g,g.prototype.nodeType="Layer",p._registerNode(g),a.Factory.addGetterSetter(g,"hitGraphEnabled",!0,h.getBooleanValidator()),o.Collection.mapMethods(g)},"D3+e":function(t,e,n){!function(){"use strict";var e=n("2As9"),r=function(t){this.curves=[],this._3d=!1,t&&(this.curves=t,this._3d=this.curves[0]._3d)};r.prototype={valueOf:function(){return this.toString()},toString:function(){return"["+this.curves.map((function(t){return e.pointsToString(t.points)})).join(", ")+"]"},addCurve:function(t){this.curves.push(t),this._3d=this._3d||t._3d},length:function(){return this.curves.map((function(t){return t.length()})).reduce((function(t,e){return t+e}))},curve:function(t){return this.curves[t]},bbox:function(){for(var t=this.curves,n=t[0].bbox(),r=1;r<t.length;r++)e.expandbox(n,t[r].bbox());return n},offset:function(t){var e=[];return this.curves.forEach((function(n){e=e.concat(n.offset(t))})),new r(e)}},t.exports=r}()},DEfu:function(t,e,n){"use strict";var r=n("z+kr");n("1E5z")(r.JSON,"JSON",!0)},DPsx:function(t,e,n){"use strict";var r=n("g6v/"),i=n("0Dky"),o=n("zBJ4");t.exports=!r&&!i((function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},DVFp:function(t,e,n){"use strict";var r=String;t.exports=function(t){try{return r(t)}catch(t){return"Object"}}},DfZB:function(t,e,n){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},E6bK:function(t,e,n){"use strict";var r=Math.round;t.exports=function(t){var e=r(t);return e<0?0:e>255?255:255&e}},E9LY:function(t,e,n){"use strict";var r=n("4zBA"),i=n("0Dky"),o=n("Fib7"),s=n("Gi26"),a=n("g6v/"),u=n("Xnc8").CONFIGURABLE,c=n("iSVu"),l=n("afO8"),h=l.enforce,p=l.get,f=String,d=Object.defineProperty,g=r("".slice),m=r("".replace),v=r([].join),y=a&&!i((function(){return 8!==d((function(){}),"length",{value:8}).length})),x=String(String).split("String"),b=t.exports=function(t,e,n){"Symbol("===g(f(e),0,7)&&(e="["+m(f(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!s(t,"name")||u&&t.name!==e)&&(a?d(t,"name",{value:e,configurable:!0}):t.name=e),y&&n&&s(n,"arity")&&t.length!==n.arity&&d(t,"length",{value:n.arity});try{n&&s(n,"constructor")&&n.constructor?a&&d(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var r=h(t);return s(r,"source")||(r.source=v(x,"string"==typeof e?e:"")),t};Function.prototype.toString=b((function(){return o(this)&&p(this).source||c(this)}),"toString")},EHx7:function(t,e,n){"use strict";var r=n("0Dky"),i=n("z+kr").RegExp;t.exports=r((function(){var t=i("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")}))},ENF9:function(t,e,n){"use strict";n("AJTl")},EhIz:function(t,e,n){"use strict";var r,i,o=n("z+kr"),s=n("tdvT"),a=o.process,u=o.Deno,c=a&&a.versions||u&&u.version,l=c&&c.v8;l&&(i=(r=l.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!i&&s&&(!(r=s.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=s.match(/Chrome\/(\d+)/))&&(i=+r[1]),t.exports=i},"Ei/z":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("8LQ0"),i=n("SXH2"),o=n("RUZL");e.Threshold=function(t){var e,n=255*this.threshold(),r=t.data,i=r.length;for(e=0;e<i;e+=1)r[e]=r[e]<n?0:255},r.Factory.addGetterSetter(i.Node,"threshold",.5,o.getNumberValidator(),r.Factory.afterSetFilter)},ExoC:function(t,e,n){"use strict";n("I+eb")({target:"Object",stat:!0},{setPrototypeOf:n("0rvr")})},F4B0:function(t,e,n){var r,i,o,s,a,u,c,l,h,p,f,d,m,v,y,x;o="undefined"!=typeof window?window:this,u="hasOwnProperty",c=/[\.\/]/,l=/\s*,\s*/,h=function(t,e){return t-e},p={n:{}},f=function(){for(var t=0,e=this.length;t<e;t++)if(void 0!==this[t])return this[t]},d=function(){for(var t=this.length;--t;)if(void 0!==this[t])return this[t]},m=Object.prototype.toString,v=String,y=Array.isArray||function(t){return t instanceof Array||"[object Array]"==m.call(t)},(x=function(t,e){var n,r=a,i=Array.prototype.slice.call(arguments,2),o=x.listeners(t),u=0,c=[],l={},p=[],g=s;p.firstDefined=f,p.lastDefined=d,s=t,a=0;for(var m=0,v=o.length;m<v;m++)"zIndex"in o[m]&&(c.push(o[m].zIndex),o[m].zIndex<0&&(l[o[m].zIndex]=o[m]));for(c.sort(h);c[u]<0;)if(n=l[c[u++]],p.push(n.apply(e,i)),a)return a=r,p;for(m=0;m<v;m++)if("zIndex"in(n=o[m]))if(n.zIndex==c[u]){if(p.push(n.apply(e,i)),a)break;do{if((n=l[c[++u]])&&p.push(n.apply(e,i)),a)break}while(n)}else l[n.zIndex]=n;else if(p.push(n.apply(e,i)),a)break;return a=r,s=g,p})._events=p,x.listeners=function(t){var e,n,r,i,o,s,a,u,l=y(t)?t:t.split(c),h=p,f=[h],d=[];for(i=0,o=l.length;i<o;i++){for(u=[],s=0,a=f.length;s<a;s++)for(n=[(h=f[s].n)[l[i]],h["*"]],r=2;r--;)(e=n[r])&&(u.push(e),d=d.concat(e.f||[]));f=u}return d},x.separator=function(t){t?(t="["+(t=v(t).replace(/(?=[\.\^\]\[\-])/g,"\\"))+"]",c=new RegExp(t)):c=/[\.\/]/},x.on=function(t,e){if("function"!=typeof e)return function(){};for(var n=y(t)?y(t[0])?t:[t]:v(t).split(l),r=0,i=n.length;r<i;r++)!function(t){for(var n,r=y(t)?t:v(t).split(c),i=p,o=0,s=r.length;o<s;o++)i=(i=i.n).hasOwnProperty(r[o])&&i[r[o]]||(i[r[o]]={n:{}});for(i.f=i.f||[],o=0,s=i.f.length;o<s;o++)if(i.f[o]==e){n=!0;break}!n&&i.f.push(e)}(n[r]);return function(t){+t==+t&&(e.zIndex=+t)}},x.f=function(t){var e=[].slice.call(arguments,1);return function(){x.apply(null,[t,null].concat(e).concat([].slice.call(arguments,0)))}},x.stop=function(){a=1},x.nt=function(t){var e=y(s)?s.join("."):s;return t?new RegExp("(?:\\.|\\/|^)"+t+"(?:\\.|\\/|$)").test(e):e},x.nts=function(){return y(s)?s:s.split(c)},x.off=x.unbind=function(t,e){if(t){var n=y(t)?y(t[0])?t:[t]:v(t).split(l);if(n.length>1)for(var r=0,i=n.length;r<i;r++)x.off(n[r],e);else{n=y(t)?t:v(t).split(c);var o,s,a,h,f,d=[p],g=[];for(r=0,i=n.length;r<i;r++)for(h=0;h<d.length;h+=a.length-2){if(a=[h,1],o=d[h].n,"*"!=n[r])o[n[r]]&&(a.push(o[n[r]]),g.unshift({n:o,name:n[r]}));else for(s in o)o[u](s)&&(a.push(o[s]),g.unshift({n:o,name:s}));d.splice.apply(d,a)}for(r=0,i=d.length;r<i;r++)for(o=d[r];o.n;){if(e){if(o.f){for(h=0,f=o.f.length;h<f;h++)if(o.f[h]==e){o.f.splice(h,1);break}!o.f.length&&delete o.f}for(s in o.n)if(o.n[u](s)&&o.n[s].f){var m=o.n[s].f;for(h=0,f=m.length;h<f;h++)if(m[h]==e){m.splice(h,1);break}!m.length&&delete o.n[s].f}}else for(s in delete o.f,o.n)o.n[u](s)&&o.n[s].f&&delete o.n[s].f;o=o.n}t:for(r=0,i=g.length;r<i;r++){for(s in(o=g[r]).n[o.name].f)continue t;for(s in o.n[o.name].n)continue t;delete o.n[o.name]}}}else x._events=p={n:{}}},x.once=function(t,e){var n=function(){return x.off(t,n),e.apply(this,arguments)};return x.on(t,n)},x.version="0.5.4",x.toString=function(){return"You are running Eve 0.5.4"},o.eve=x,r=function(){return x}.apply(e,[]),function(n,o){void 0===(i=function(t){return function(t,e){var n=function(e){var n,r={},i=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||t.msRequestAnimationFrame||function(t){return setTimeout(t,16,(new Date).getTime()),!0},o=Array.isArray||function(t){return t instanceof Array||"[object Array]"==Object.prototype.toString.call(t)},s=0,a="M"+(+new Date).toString(36),u=Date.now||function(){return+new Date},c=function(t){var e=this;if(null==t)return e.s;var n=e.s-t;e.b+=e.dur*n,e.B+=e.dur*n,e.s=t},l=function(t){if(null==t)return this.spd;this.spd=t},h=function(t){var e=this;if(null==t)return e.dur;e.s=e.s*t/e.dur,e.dur=t},p=function(){var t=this;delete r[t.id],t.update(),e("mina.stop."+t.id,t)},f=function(){var t=this;t.pdif||(delete r[t.id],t.update(),t.pdif=t.get()-t.b)},d=function(){var t=this;t.pdif&&(t.b=t.get()-t.pdif,delete t.pdif,r[t.id]=t,m())},g=function(){var t,e=this;if(o(e.start)){t=[];for(var n=0,r=e.start.length;n<r;n++)t[n]=+e.start[n]+(e.end[n]-e.start[n])*e.easing(e.s)}else t=+e.start+(e.end-e.start)*e.easing(e.s);e.set(t)},m=function(t){if(t){var o=0;for(var s in r)if(r.hasOwnProperty(s)){var a=r[s],u=a.get();o++,a.s=(u-a.b)/(a.dur/a.spd),a.s>=1&&(delete r[s],a.s=1,o--,function(t){setTimeout((function(){e("mina.finish."+t.id,t)}))}(a)),a.update()}n=!!o&&i(m)}else n||(n=i(m))},v=function(t,e,n,i,o,u,y){var x={id:a+(s++).toString(36),start:t,end:e,b:n,s:0,dur:i-n,spd:1,get:o,set:u,easing:y||v.linear,status:c,speed:l,duration:h,stop:p,pause:f,resume:d,update:g};r[x.id]=x;var b,_=0;for(b in r)if(r.hasOwnProperty(b)&&2==++_)break;return 1==_&&m(),x};return v.time=u,v.getById=function(t){return r[t]||null},v.linear=function(t){return t},v.easeout=function(t){return Math.pow(t,1.7)},v.easein=function(t){return Math.pow(t,.48)},v.easeinout=function(t){if(1==t)return 1;if(0==t)return 0;var e=.48-t/1.04,n=Math.sqrt(.1734+e*e),r=n-e,i=-n-e,o=Math.pow(Math.abs(r),1/3)*(r<0?-1:1)+Math.pow(Math.abs(i),1/3)*(i<0?-1:1)+.5;return 3*(1-o)*o*o+o*o*o},v.backin=function(t){if(1==t)return 1;var e=1.70158;return t*t*((e+1)*t-e)},v.backout=function(t){if(0==t)return 0;var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},v.elastic=function(t){return t==!!t?t:Math.pow(2,-10*t)*Math.sin((t-.075)*(2*Math.PI)/.3)+1},v.bounce=function(t){var e=7.5625,n=2.75;return t<1/n?e*t*t:t<2/n?e*(t-=1.5/n)*t+.75:t<2.5/n?e*(t-=2.25/n)*t+.9375:e*(t-=2.625/n)*t+.984375},t.mina=v,v}(void 0===e?function(){}:e),r=function(t){function n(t,e){if(t){if(t.nodeType)return X(t);if(I(t,"array")&&n.set)return n.set.apply(n,t);if(t instanceof V)return t;if(null==e)try{return X(t=r.doc.querySelector(String(t)))}catch(t){return null}}return new q(t=null==t?"100%":t,e=null==e?"100%":e)}n.version="0.5.1",n.toString=function(){return"Snap v"+this.version},n._={};var r={win:t.window,doc:t.window.document};n._.glob=r;var i,o,s="hasOwnProperty",a=String,u=parseFloat,c=parseInt,l=Math,h=l.max,p=l.min,f=l.abs,d=(l.pow,l.PI),m=(l.round,Object.prototype.toString),v=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?%?)\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?%?)\s*\))\s*$/i,y=(n._.separator=/[,\s]+/,/[\s]*,[\s]*/),x={hs:1,rg:1},b=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?[\s]*)+)/gi,_=/([rstm])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?[\s]*)+)/gi,w=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\s]*,?[\s]*/gi,M=0,E="S"+(+new Date).toString(36),S=function(t){return(t&&t.type?t.type:"")+E+(M++).toString(36)},A="http://www.w3.org/1999/xlink",C="http://www.w3.org/2000/svg",T={};n.url=function(t){return"url('#"+t+"')"};function P(t,e){if(e){if("#text"==t&&(t=r.doc.createTextNode(e.text||e["#text"]||"")),"#comment"==t&&(t=r.doc.createComment(e.text||e["#text"]||"")),"string"==typeof t&&(t=P(t)),"string"==typeof e)return 1==t.nodeType?"xlink:"==e.substring(0,6)?t.getAttributeNS(A,e.substring(6)):"xml:"==e.substring(0,4)?t.getAttributeNS(C,e.substring(4)):t.getAttribute(e):"text"==e?t.nodeValue:null;if(1==t.nodeType){for(var n in e)if(e[s](n)){var i=a(e[n]);i?"xlink:"==n.substring(0,6)?t.setAttributeNS(A,n.substring(6),i):"xml:"==n.substring(0,4)?t.setAttributeNS(C,n.substring(4),i):t.setAttribute(n,i):t.removeAttribute(n)}}else"text"in e&&(t.nodeValue=e.text)}else t=r.doc.createElementNS(C,t);return t}function I(t,e){return"finite"==(e=a.prototype.toLowerCase.call(e))?isFinite(t):!("array"!=e||!(t instanceof Array||Array.isArray&&Array.isArray(t)))||("null"==e&&null===t||e==typeof t&&null!==t||"object"==e&&t===Object(t)||m.call(t).slice(8,-1).toLowerCase()==e)}function L(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return t.push(t.splice(n,1)[0])}function R(t,e,n){return function r(){var i=Array.prototype.slice.call(arguments,0),o=i.join("␀"),a=r.cache=r.cache||{},u=r.count=r.count||[];return a[s](o)?(L(u,o),n?n(a[o]):a[o]):(u.length>=1e3&&delete a[u.shift()],u.push(o),a[o]=t.apply(e,i),n?n(a[o]):a[o])}}function O(t){return t%360*d/180}n._.$=P,n._.id=S,n.format=(i=/\{([^\}]+)\}/g,o=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,function(t,e){return a(t).replace(i,(function(t,n){return function(t,e,n){var r=n;return e.replace(o,(function(t,e,n,i,o){e=e||i,r&&(e in r&&(r=r[e]),"function"==typeof r&&o&&(r=r()))})),r=(null==r||r==n?t:r)+""}(t,n,e)}))}),n._.clone=function t(e){if("function"==typeof e||Object(e)!==e)return e;var n=new e.constructor;for(var r in e)e[s](r)&&(n[r]=t(e[r]));return n},n._.cacher=R,n.rad=O,n.deg=function(t){return 180*t/d%360},n.sin=function(t){return l.sin(n.rad(t))},n.tan=function(t){return l.tan(n.rad(t))},n.cos=function(t){return l.cos(n.rad(t))},n.asin=function(t){return n.deg(l.asin(t))},n.acos=function(t){return n.deg(l.acos(t))},n.atan=function(t){return n.deg(l.atan(t))},n.atan2=function(t){return n.deg(l.atan2(t))},n.angle=function t(e,n,r,i,o,s){if(null==o){var a=e-r,u=n-i;return a||u?(180+180*l.atan2(-u,-a)/d+360)%360:0}return t(e,n,o,s)-t(r,i,o,s)},n.len=function(t,e,r,i){return Math.sqrt(n.len2(t,e,r,i))},n.len2=function(t,e,n,r){return(t-n)*(t-n)+(e-r)*(e-r)},n.closestPoint=function(t,e,n){function r(t){var r=t.x-e,i=t.y-n;return r*r+i*i}for(var i,o,s,a,u=t.node,c=u.getTotalLength(),l=c/u.pathSegList.numberOfItems*.125,h=1/0,p=0;p<=c;p+=l)(a=r(s=u.getPointAtLength(p)))<h&&(i=s,o=p,h=a);for(l*=.5;l>.5;){var f,d,g,m,v,y;(g=o-l)>=0&&(v=r(f=u.getPointAtLength(g)))<h?(i=f,o=g,h=v):(m=o+l)<=c&&(y=r(d=u.getPointAtLength(m)))<h?(i=d,o=m,h=y):l*=.5}return i={x:i.x,y:i.y,length:o,distance:Math.sqrt(h)}},n.is=I,n.snapTo=function(t,e,n){if(n=I(n,"finite")?n:10,I(t,"array")){for(var r=t.length;r--;)if(f(t[r]-e)<=n)return t[r]}else{var i=e%(t=+t);if(i<n)return e-i;if(i>t-n)return e-i+t}return e},n.getRGB=R((function(t){if(!t||(t=a(t)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:N};if("none"==t)return{r:-1,g:-1,b:-1,hex:"none",toString:N};if(!x[s](t.toLowerCase().substring(0,2))&&"#"!=t.charAt()&&(t=D(t)),!t)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:N};var e,r,i,o,f,d,g=t.match(v);return g?(g[2]&&(i=c(g[2].substring(5),16),r=c(g[2].substring(3,5),16),e=c(g[2].substring(1,3),16)),g[3]&&(i=c((f=g[3].charAt(3))+f,16),r=c((f=g[3].charAt(2))+f,16),e=c((f=g[3].charAt(1))+f,16)),g[4]&&(d=g[4].split(y),e=u(d[0]),"%"==d[0].slice(-1)&&(e*=2.55),r=u(d[1]),"%"==d[1].slice(-1)&&(r*=2.55),i=u(d[2]),"%"==d[2].slice(-1)&&(i*=2.55),"rgba"==g[1].toLowerCase().slice(0,4)&&(o=u(d[3])),d[3]&&"%"==d[3].slice(-1)&&(o/=100)),g[5]?(d=g[5].split(y),e=u(d[0]),"%"==d[0].slice(-1)&&(e/=100),r=u(d[1]),"%"==d[1].slice(-1)&&(r/=100),i=u(d[2]),"%"==d[2].slice(-1)&&(i/=100),("deg"==d[0].slice(-3)||"°"==d[0].slice(-1))&&(e/=360),"hsba"==g[1].toLowerCase().slice(0,4)&&(o=u(d[3])),d[3]&&"%"==d[3].slice(-1)&&(o/=100),n.hsb2rgb(e,r,i,o)):g[6]?(d=g[6].split(y),e=u(d[0]),"%"==d[0].slice(-1)&&(e/=100),r=u(d[1]),"%"==d[1].slice(-1)&&(r/=100),i=u(d[2]),"%"==d[2].slice(-1)&&(i/=100),("deg"==d[0].slice(-3)||"°"==d[0].slice(-1))&&(e/=360),"hsla"==g[1].toLowerCase().slice(0,4)&&(o=u(d[3])),d[3]&&"%"==d[3].slice(-1)&&(o/=100),n.hsl2rgb(e,r,i,o)):(e=p(l.round(e),255),r=p(l.round(r),255),i=p(l.round(i),255),o=p(h(o,0),1),(g={r:e,g:r,b:i,toString:N}).hex="#"+(16777216|i|r<<8|e<<16).toString(16).slice(1),g.opacity=I(o,"finite")?o:1,g)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:N}}),n),n.hsb=R((function(t,e,r){return n.hsb2rgb(t,e,r).hex})),n.hsl=R((function(t,e,r){return n.hsl2rgb(t,e,r).hex})),n.rgb=R((function(t,e,n,r){if(I(r,"finite")){var i=l.round;return"rgba("+[i(t),i(e),i(n),+r.toFixed(2)]+")"}return"#"+(16777216|n|e<<8|t<<16).toString(16).slice(1)}));var D=function(t){var e=r.doc.getElementsByTagName("head")[0]||r.doc.getElementsByTagName("svg")[0],n="rgb(255, 0, 0)";return(D=R((function(t){if("red"==t.toLowerCase())return n;e.style.color=n,e.style.color=t;var i=r.doc.defaultView.getComputedStyle(e,"").getPropertyValue("color");return i==n?null:i})))(t)},B=function(){return"hsb("+[this.h,this.s,this.b]+")"},F=function(){return"hsl("+[this.h,this.s,this.l]+")"},N=function(){return 1==this.opacity||null==this.opacity?this.hex:"rgba("+[this.r,this.g,this.b,this.opacity]+")"},k=function(t,e,r){if(null==e&&I(t,"object")&&"r"in t&&"g"in t&&"b"in t&&(r=t.b,e=t.g,t=t.r),null==e&&I(t,string)){var i=n.getRGB(t);t=i.r,e=i.g,r=i.b}return(t>1||e>1||r>1)&&(t/=255,e/=255,r/=255),[t,e,r]},G=function(t,e,r,i){var o={r:t=l.round(255*t),g:e=l.round(255*e),b:r=l.round(255*r),opacity:I(i,"finite")?i:1,hex:n.rgb(t,e,r),toString:N};return I(i,"finite")&&(o.opacity=i),o};n.color=function(t){var e;return I(t,"object")&&"h"in t&&"s"in t&&"b"in t?(e=n.hsb2rgb(t),t.r=e.r,t.g=e.g,t.b=e.b,t.opacity=1,t.hex=e.hex):I(t,"object")&&"h"in t&&"s"in t&&"l"in t?(e=n.hsl2rgb(t),t.r=e.r,t.g=e.g,t.b=e.b,t.opacity=1,t.hex=e.hex):(I(t,"string")&&(t=n.getRGB(t)),I(t,"object")&&"r"in t&&"g"in t&&"b"in t&&!("error"in t)?(e=n.rgb2hsl(t),t.h=e.h,t.s=e.s,t.l=e.l,e=n.rgb2hsb(t),t.v=e.b):((t={hex:"none"}).r=t.g=t.b=t.h=t.s=t.v=t.l=-1,t.error=1)),t.toString=N,t},n.hsb2rgb=function(t,e,n,r){var i,o,s,a,u;return I(t,"object")&&"h"in t&&"s"in t&&"b"in t&&(n=t.b,e=t.s,r=t.o,t=t.h),a=(u=n*e)*(1-f((t=(t*=360)%360/60)%2-1)),i=o=s=n-u,G(i+=[u,a,0,0,a,u][t=~~t],o+=[a,u,u,a,0,0][t],s+=[0,0,a,u,u,a][t],r)},n.hsl2rgb=function(t,e,n,r){var i,o,s,a,u;return I(t,"object")&&"h"in t&&"s"in t&&"l"in t&&(n=t.l,e=t.s,t=t.h),(t>1||e>1||n>1)&&(t/=360,e/=100,n/=100),a=(u=2*e*(n<.5?n:1-n))*(1-f((t=(t*=360)%360/60)%2-1)),i=o=s=n-u/2,G(i+=[u,a,0,0,a,u][t=~~t],o+=[a,u,u,a,0,0][t],s+=[0,0,a,u,u,a][t],r)},n.rgb2hsb=function(t,e,n){var r,i;return t=(n=k(t,e,n))[0],e=n[1],n=n[2],{h:((0==(i=(r=h(t,e,n))-p(t,e,n))?null:r==t?(e-n)/i:r==e?(n-t)/i+2:(t-e)/i+4)+360)%6*60/360,s:0==i?0:i/r,b:r,toString:B}},n.rgb2hsl=function(t,e,n){var r,i,o,s;return t=(n=k(t,e,n))[0],e=n[1],n=n[2],r=((i=h(t,e,n))+(o=p(t,e,n)))/2,{h:((0==(s=i-o)?null:i==t?(e-n)/s:i==e?(n-t)/s+2:(t-e)/s+4)+360)%6*60/360,s:0==s?0:r<.5?s/(2*r):s/(2-2*r),l:r,toString:F}},n.parsePathString=function(t){if(!t)return null;var e=n.path(t);if(e.arr)return n.path.clone(e.arr);var r={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},i=[];return I(t,"array")&&I(t[0],"array")&&(i=n.path.clone(t)),i.length||a(t).replace(b,(function(t,e,n){var o=[],s=e.toLowerCase();if(n.replace(w,(function(t,e){e&&o.push(+e)})),"m"==s&&o.length>2&&(i.push([e].concat(o.splice(0,2))),s="l",e="m"==e?"l":"L"),"o"==s&&1==o.length&&i.push([e,o[0]]),"r"==s)i.push([e].concat(o));else for(;o.length>=r[s]&&(i.push([e].concat(o.splice(0,r[s]))),r[s]););})),i.toString=n.path.toString,e.arr=n.path.clone(i),i};var U=n.parseTransformString=function(t){if(!t)return null;var e=[];return I(t,"array")&&I(t[0],"array")&&(e=n.path.clone(t)),e.length||a(t).replace(_,(function(t,n,r){var i=[];n.toLowerCase();r.replace(w,(function(t,e){e&&i.push(+e)})),e.push([n].concat(i))})),e.toString=n.path.toString,e};n._.svgTransform2string=function(t){var e=[];return t=t.replace(/(?:^|\s)(\w+)\(([^)]+)\)/g,(function(t,n,r){return r=r.split(/\s*,\s*|\s+/),"rotate"==n&&1==r.length&&r.push(0,0),"scale"==n&&(r.length>2?r=r.slice(0,2):2==r.length&&r.push(0,0),1==r.length&&r.push(r[0],0,0)),"skewX"==n?e.push(["m",1,0,l.tan(O(r[0])),1,0,0]):"skewY"==n?e.push(["m",1,l.tan(O(r[0])),0,1,0,0]):e.push([n.charAt(0)].concat(r)),t})),e},n._.rgTransform=/^[a-z][\s]*-?\.?\d/i,n._.transform2matrix=function(t,e){var r=U(t),i=new n.Matrix;if(r)for(var o=0,s=r.length;o<s;o++){var u,c,l,h,p,f=r[o],d=f.length,g=a(f[0]).toLowerCase(),m=f[0]!=g,v=m?i.invert():0;"t"==g&&2==d?i.translate(f[1],0):"t"==g&&3==d?m?(u=v.x(0,0),c=v.y(0,0),l=v.x(f[1],f[2]),h=v.y(f[1],f[2]),i.translate(l-u,h-c)):i.translate(f[1],f[2]):"r"==g?2==d?(p=p||e,i.rotate(f[1],p.x+p.width/2,p.y+p.height/2)):4==d&&(m?(l=v.x(f[2],f[3]),h=v.y(f[2],f[3]),i.rotate(f[1],l,h)):i.rotate(f[1],f[2],f[3])):"s"==g?2==d||3==d?(p=p||e,i.scale(f[1],f[d-1],p.x+p.width/2,p.y+p.height/2)):4==d?m?(l=v.x(f[2],f[3]),h=v.y(f[2],f[3]),i.scale(f[1],f[1],l,h)):i.scale(f[1],f[1],f[2],f[3]):5==d&&(m?(l=v.x(f[3],f[4]),h=v.y(f[3],f[4]),i.scale(f[1],f[2],l,h)):i.scale(f[1],f[2],f[3],f[4])):"m"==g&&7==d&&i.add(f[1],f[2],f[3],f[4],f[5],f[6])}return i},n._unit2px=function(t,e,n){var r=z(t).node,i={},o=r.querySelector(".svg---mgr");o||(o=P("rect"),P(o,{x:-9e9,y:-9e9,width:10,height:10,class:"svg---mgr",fill:"none"}),r.appendChild(o));function s(t){if(null==t)return"";if(t==+t)return t;P(o,{width:t});try{return o.getBBox().width}catch(t){return 0}}function a(t){if(null==t)return"";if(t==+t)return t;P(o,{height:t});try{return o.getBBox().height}catch(t){return 0}}function u(r,o){null==e?i[r]=o(t.attr(r)||0):r==e&&(i=o(null==n?t.attr(r)||0:n))}switch(t.type){case"rect":u("rx",s),u("ry",a);case"image":u("width",s),u("height",a);case"text":u("x",s),u("y",a);break;case"circle":u("cx",s),u("cy",a),u("r",s);break;case"ellipse":u("cx",s),u("cy",a),u("rx",s),u("ry",a);break;case"line":u("x1",s),u("x2",s),u("y1",a),u("y2",a);break;case"marker":u("refX",s),u("markerWidth",s),u("refY",a),u("markerHeight",a);break;case"radialGradient":u("fx",s),u("fy",a);break;case"tspan":u("dx",s),u("dy",a);break;default:u(e,s)}return r.removeChild(o),i};r.doc.contains||r.doc.compareDocumentPosition;function z(t){return t.node.ownerSVGElement&&X(t.node.ownerSVGElement)||n.select("svg")}function H(t){I(t,"array")||(t=Array.prototype.slice.call(arguments,0));for(var e=0,n=0,r=this.node;this[e];)delete this[e++];for(e=0;e<t.length;e++)"set"==t[e].type?t[e].forEach((function(t){r.appendChild(t.node)})):r.appendChild(t[e].node);var i=r.childNodes;for(e=0;e<i.length;e++)this[n++]=X(i[e]);return this}function V(t){if(t.snap in T)return T[t.snap];var e;try{e=t.ownerSVGElement}catch(t){}this.node=t,e&&(this.paper=new q(e)),this.type=t.tagName||t.nodeName;var n=this.id=S(this);if(this.anims={},this._={transform:[]},t.snap=n,T[n]=this,"g"==this.type&&(this.add=H),this.type in{g:1,mask:1,pattern:1,symbol:1})for(var r in q.prototype)q.prototype[s](r)&&(this[r]=q.prototype[r])}function j(t){this.node=t}function W(t,e){var n=P(t);return e.appendChild(n),X(n)}function q(t,e){var n,i,o,a=q.prototype;if(t&&t.tagName&&"svg"==t.tagName.toLowerCase()){if(t.snap in T)return T[t.snap];var u=t.ownerDocument;for(var c in n=new V(t),i=t.getElementsByTagName("desc")[0],o=t.getElementsByTagName("defs")[0],i||((i=P("desc")).appendChild(u.createTextNode("Created with Snap")),n.node.appendChild(i)),o||(o=P("defs"),n.node.appendChild(o)),n.defs=o,a)a[s](c)&&(n[c]=a[c]);n.paper=n.root=n}else P((n=W("svg",r.doc.body)).node,{height:e,version:1.1,width:t,xmlns:C});return n}function X(t){return t?t instanceof V||t instanceof j?t:t.tagName&&"svg"==t.tagName.toLowerCase()?new q(t):t.tagName&&"object"==t.tagName.toLowerCase()&&"image/svg+xml"==t.type?new q(t.contentDocument.getElementsByTagName("svg")[0]):new V(t):t}n._.getSomeDefs=function(t){var e=t.node.ownerSVGElement&&X(t.node.ownerSVGElement)||t.node.parentNode&&X(t.node.parentNode)||n.select("svg")||n(0,0),r=e.select("defs"),i=null!=r&&r.node;return i||(i=W("defs",e.node).node),i},n._.getSomeSVG=z,n.select=function(t){return t=a(t).replace(/([^\\]):/g,"$1\\:"),X(r.doc.querySelector(t))},n.selectAll=function(t){for(var e=r.doc.querySelectorAll(t),i=(n.set||Array)(),o=0;o<e.length;o++)i.push(X(e[o]));return i},setInterval((function(){for(var t in T)if(T[s](t)){var e=T[t],n=e.node;("svg"!=e.type&&!n.ownerSVGElement||"svg"==e.type&&(!n.parentNode||"ownerSVGElement"in n.parentNode&&!n.ownerSVGElement))&&delete T[t]}}),1e4),V.prototype.attr=function(t,n){var r=this,i=r.node;if(!t){if(1!=i.nodeType)return{text:i.nodeValue};for(var o=i.attributes,a={},u=0,c=o.length;u<c;u++)a[o[u].nodeName]=o[u].nodeValue;return a}if(I(t,"string")){if(!(arguments.length>1))return e("snap.util.getattr."+t,r).firstDefined();var l={};l[t]=n,t=l}for(var h in t)t[s](h)&&e("snap.util.attr."+h,r,t[h]);return r},n.parse=function(t){var e=r.doc.createDocumentFragment(),n=!0,i=r.doc.createElement("div");if((t=a(t)).match(/^\s*<\s*svg(?:\s|>)/)||(t="<svg>"+t+"</svg>",n=!1),i.innerHTML=t,t=i.getElementsByTagName("svg")[0])if(n)e=t;else for(;t.firstChild;)e.appendChild(t.firstChild);return new j(e)},n.fragment=function(){for(var t=Array.prototype.slice.call(arguments,0),e=r.doc.createDocumentFragment(),i=0,o=t.length;i<o;i++){var s=t[i];s.node&&s.node.nodeType&&e.appendChild(s.node),s.nodeType&&e.appendChild(s),"string"==typeof s&&e.appendChild(n.parse(s).node)}return new j(e)},n._.make=W,n._.wrap=X,q.prototype.el=function(t,e){var n=W(t,this.node);return e&&n.attr(e),n},V.prototype.children=function(){for(var t=[],e=this.node.childNodes,r=0,i=e.length;r<i;r++)t[r]=n(e[r]);return t},V.prototype.toJSON=function(){var t=[];return function t(e,n){for(var r=0,i=e.length;r<i;r++){var o={type:e[r].type,attr:e[r].attr()},s=e[r].children();n.push(o),s.length&&t(s,o.childNodes=[])}}([this],t),t[0]},e.on("snap.util.getattr",(function(){var t=e.nt(),n=(t=t.substring(t.lastIndexOf(".")+1)).replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()}));return Y[s](n)?this.node.ownerDocument.defaultView.getComputedStyle(this.node,null).getPropertyValue(n):P(this.node,t)}));var Y={"alignment-baseline":0,"baseline-shift":0,clip:0,"clip-path":0,"clip-rule":0,color:0,"color-interpolation":0,"color-interpolation-filters":0,"color-profile":0,"color-rendering":0,cursor:0,direction:0,display:0,"dominant-baseline":0,"enable-background":0,fill:0,"fill-opacity":0,"fill-rule":0,filter:0,"flood-color":0,"flood-opacity":0,font:0,"font-family":0,"font-size":0,"font-size-adjust":0,"font-stretch":0,"font-style":0,"font-variant":0,"font-weight":0,"glyph-orientation-horizontal":0,"glyph-orientation-vertical":0,"image-rendering":0,kerning:0,"letter-spacing":0,"lighting-color":0,marker:0,"marker-end":0,"marker-mid":0,"marker-start":0,mask:0,opacity:0,overflow:0,"pointer-events":0,"shape-rendering":0,"stop-color":0,"stop-opacity":0,stroke:0,"stroke-dasharray":0,"stroke-dashoffset":0,"stroke-linecap":0,"stroke-linejoin":0,"stroke-miterlimit":0,"stroke-opacity":0,"stroke-width":0,"text-anchor":0,"text-decoration":0,"text-rendering":0,"unicode-bidi":0,visibility:0,"word-spacing":0,"writing-mode":0};e.on("snap.util.attr",(function(t){var n=e.nt(),r={};r[n=n.substring(n.lastIndexOf(".")+1)]=t;var i=n.replace(/-(\w)/gi,(function(t,e){return e.toUpperCase()})),o=n.replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()}));Y[s](o)?this.node.style[i]=null==t?"":t:P(this.node,r)})),q.prototype,n.ajax=function(t,n,r,i){var o=new XMLHttpRequest,s=S();if(o){if(I(n,"function"))i=r,r=n,n=null;else if(I(n,"object")){var a=[];for(var u in n)n.hasOwnProperty(u)&&a.push(encodeURIComponent(u)+"="+encodeURIComponent(n[u]));n=a.join("&")}return o.open(n?"POST":"GET",t,!0),n&&(o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.setRequestHeader("Content-type","application/x-www-form-urlencoded")),r&&(e.once("snap.ajax."+s+".0",r),e.once("snap.ajax."+s+".200",r),e.once("snap.ajax."+s+".304",r)),o.onreadystatechange=function(){4==o.readyState&&(e("snap.ajax."+s+"."+o.status,i,o),e.off("snap.ajax."+s+".0"),e.off("snap.ajax."+s+".200"),e.off("snap.ajax."+s+".304"))},4==o.readyState?o:(o.send(n),o)}},n.load=function(t,e,r){n.ajax(t,(function(t){var i=n.parse(t.responseText);r?e.call(r,i):e(i)}))};return n.getElementByPoint=function(t,e){this.canvas;var n,i,o,s,a,u,c,l=r.doc.elementFromPoint(t,e);if(r.win.opera&&"svg"==l.tagName){var h=(i=(n=l).getBoundingClientRect(),o=n.ownerDocument,s=o.body,a=o.documentElement,u=a.clientTop||s.clientTop||0,c=a.clientLeft||s.clientLeft||0,{y:i.top+(g.win.pageYOffset||a.scrollTop||s.scrollTop)-u,x:i.left+(g.win.pageXOffset||a.scrollLeft||s.scrollLeft)-c}),p=l.createSVGRect();p.x=t-h.x,p.y=e-h.y,p.width=p.height=1;var f=l.getIntersectionList(p,null);f.length&&(l=f[f.length-1])}return l?X(l):null},n.plugin=function(t){t(n,V,q,r,j)},r.win.Snap=n,n}(t||this);return r.plugin((function(n,r,i,o,s){var a=r.prototype,u=n.is,c=String,l=n._unit2px,h=n._.$,p=n._.make,f=n._.getSomeDefs,d="hasOwnProperty",g=n._.wrap;a.getBBox=function(t){if("tspan"==this.type)return n._.box(this.node.getClientRects().item(0));if(!n.Matrix||!n.path)return this.node.getBBox();var e=this,r=new n.Matrix;if(e.removed)return n._.box();for(;"use"==e.type;)if(t||(r=r.add(e.transform().localMatrix.translate(e.attr("x")||0,e.attr("y")||0))),e.original)e=e.original;else{var i=e.attr("xlink:href");e=e.original=e.node.ownerDocument.getElementById(i.substring(i.indexOf("#")+1))}var o=e._,s=n.path.get[e.type]||n.path.get.deflt;try{return t?(o.bboxwt=s?n.path.getBBox(e.realPath=s(e)):n._.box(e.node.getBBox()),n._.box(o.bboxwt)):(e.realPath=s(e),e.matrix=e.transform().localMatrix,o.bbox=n.path.getBBox(n.path.map(e.realPath,r.add(e.matrix))),n._.box(o.bbox))}catch(t){return n._.box()}};var m=function(){return this.string};function v(t,e){if(null==e){var r=!0;if(!(e="linearGradient"==t.type||"radialGradient"==t.type?t.node.getAttribute("gradientTransform"):"pattern"==t.type?t.node.getAttribute("patternTransform"):t.node.getAttribute("transform")))return new n.Matrix;e=n._.svgTransform2string(e)}else e=n._.rgTransform.test(e)?c(e).replace(/\.{3}|\u2026/g,t._.transform||""):n._.svgTransform2string(e),u(e,"array")&&(e=n.path?n.path.toString.call(e):c(e)),t._.transform=e;var i=n._.transform2matrix(e,t.getBBox(1));if(r)return i;t.matrix=i}a.transform=function(t){var e=this._;if(null==t){for(var r,i=this,o=new n.Matrix(this.node.getCTM()),s=v(this),a=[s],u=new n.Matrix,l=s.toTransformString(),p=c(s)==c(this.matrix)?c(e.transform):l;"svg"!=i.type&&(i=i.parent());)a.push(v(i));for(r=a.length;r--;)u.add(a[r]);return{string:p,globalMatrix:o,totalMatrix:u,localMatrix:s,diffMatrix:o.clone().add(s.invert()),global:o.toTransformString(),total:u.toTransformString(),local:l,toString:m}}return t instanceof n.Matrix?(this.matrix=t,this._.transform=t.toTransformString()):v(this,t),this.node&&("linearGradient"==this.type||"radialGradient"==this.type?h(this.node,{gradientTransform:this.matrix}):"pattern"==this.type?h(this.node,{patternTransform:this.matrix}):h(this.node,{transform:this.matrix})),this},a.parent=function(){return g(this.node.parentNode)},a.append=a.add=function(t){if(t){if("set"==t.type){var e=this;return t.forEach((function(t){e.add(t)})),this}t=g(t),this.node.appendChild(t.node),t.paper=this.paper}return this},a.appendTo=function(t){return t&&(t=g(t)).append(this),this},a.prepend=function(t){if(t){if("set"==t.type){var e,n=this;return t.forEach((function(t){e?e.after(t):n.prepend(t),e=t})),this}var r=(t=g(t)).parent();this.node.insertBefore(t.node,this.node.firstChild),this.add&&this.add(),t.paper=this.paper,this.parent()&&this.parent().add(),r&&r.add()}return this},a.prependTo=function(t){return(t=g(t)).prepend(this),this},a.before=function(t){if("set"==t.type){var e=this;return t.forEach((function(t){var n=t.parent();e.node.parentNode.insertBefore(t.node,e.node),n&&n.add()})),this.parent().add(),this}var n=(t=g(t)).parent();return this.node.parentNode.insertBefore(t.node,this.node),this.parent()&&this.parent().add(),n&&n.add(),t.paper=this.paper,this},a.after=function(t){var e=(t=g(t)).parent();return this.node.nextSibling?this.node.parentNode.insertBefore(t.node,this.node.nextSibling):this.node.parentNode.appendChild(t.node),this.parent()&&this.parent().add(),e&&e.add(),t.paper=this.paper,this},a.insertBefore=function(t){t=g(t);var e=this.parent();return t.node.parentNode.insertBefore(this.node,t.node),this.paper=t.paper,e&&e.add(),t.parent()&&t.parent().add(),this},a.insertAfter=function(t){t=g(t);var e=this.parent();return t.node.parentNode.insertBefore(this.node,t.node.nextSibling),this.paper=t.paper,e&&e.add(),t.parent()&&t.parent().add(),this},a.remove=function(){var t=this.parent();return this.node.parentNode&&this.node.parentNode.removeChild(this.node),delete this.paper,this.removed=!0,t&&t.add(),this},a.select=function(t){return g(this.node.querySelector(t))},a.selectAll=function(t){for(var e=this.node.querySelectorAll(t),r=(n.set||Array)(),i=0;i<e.length;i++)r.push(g(e[i]));return r},a.asPX=function(t,e){return null==e&&(e=this.attr(t)),+l(this,t,e)},a.use=function(){var t,e=this.node.id;return e||(e=this.id,h(this.node,{id:e})),t="linearGradient"==this.type||"radialGradient"==this.type||"pattern"==this.type?p(this.type,this.node.parentNode):p("use",this.node.parentNode),h(t.node,{"xlink:href":"#"+e}),t.original=this,t},a.clone=function(){var t=g(this.node.cloneNode(!0));return h(t.node,"id")&&h(t.node,{id:t.id}),function(t){var e,r=t.selectAll("*"),i=/^\s*url\(("|'|)(.*)\1\)\s*$/,o=[],s={};function a(t,e){var r=h(t.node,e);(r=(r=r&&r.match(i))&&r[2])&&"#"==r.charAt()&&(r=r.substring(1))&&(s[r]=(s[r]||[]).concat((function(r){var i={};i[e]=n.url(r),h(t.node,i)})))}function u(t){var e=h(t.node,"xlink:href");e&&"#"==e.charAt()&&(e=e.substring(1))&&(s[e]=(s[e]||[]).concat((function(e){t.attr("xlink:href","#"+e)})))}for(var c=0,l=r.length;c<l;c++){a(e=r[c],"fill"),a(e,"stroke"),a(e,"filter"),a(e,"mask"),a(e,"clip-path"),u(e);var p=h(e.node,"id");p&&(h(e.node,{id:e.id}),o.push({old:p,id:e.id}))}for(c=0,l=o.length;c<l;c++){var f=s[o[c].old];if(f)for(var d=0,g=f.length;d<g;d++)f[d](o[c].id)}}(t),t.insertAfter(this),t},a.toDefs=function(){return f(this).appendChild(this.node),this},a.pattern=a.toPattern=function(t,e,n,r){var i=p("pattern",f(this));return null==t&&(t=this.getBBox()),u(t,"object")&&"x"in t&&(e=t.y,n=t.width,r=t.height,t=t.x),h(i.node,{x:t,y:e,width:n,height:r,patternUnits:"userSpaceOnUse",id:i.id,viewBox:[t,e,n,r].join(" ")}),i.node.appendChild(this.node),i},a.marker=function(t,e,n,r,i,o){var s=p("marker",f(this));return null==t&&(t=this.getBBox()),u(t,"object")&&"x"in t&&(e=t.y,n=t.width,r=t.height,i=t.refX||t.cx,o=t.refY||t.cy,t=t.x),h(s.node,{viewBox:[t,e,n,r].join(" "),markerWidth:n,markerHeight:r,orient:"auto",refX:i||0,refY:o||0,id:s.id}),s.node.appendChild(this.node),s};var y={};function x(t){return function(){var e=t?"<"+this.type:"",n=this.node.attributes,r=this.node.childNodes;if(t)for(var i=0,o=n.length;i<o;i++)e+=" "+n[i].name+'="'+n[i].value.replace(/"/g,'\\"')+'"';if(r.length){for(t&&(e+=">"),i=0,o=r.length;i<o;i++)3==r[i].nodeType?e+=r[i].nodeValue:1==r[i].nodeType&&(e+=g(r[i]).toString());t&&(e+="</"+this.type+">")}else t&&(e+="/>");return e}}a.data=function(t,r){var i=y[this.id]=y[this.id]||{};if(0==arguments.length)return e("snap.data.get."+this.id,this,i,null),i;if(1==arguments.length){if(n.is(t,"object")){for(var o in t)t[d](o)&&this.data(o,t[o]);return this}return e("snap.data.get."+this.id,this,i[t],t),i[t]}return i[t]=r,e("snap.data.set."+this.id,this,r,t),this},a.removeData=function(t){return null==t?y[this.id]={}:y[this.id]&&delete y[this.id][t],this},a.outerSVG=a.toString=x(1),a.innerSVG=x(),a.toDataURL=function(){if(t&&t.btoa){var e=this.getBBox(),r=n.format('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="{width}" height="{height}" viewBox="{x} {y} {width} {height}">{contents}</svg>',{x:+e.x.toFixed(3),y:+e.y.toFixed(3),width:+e.width.toFixed(3),height:+e.height.toFixed(3),contents:this.outerSVG()});return"data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(r)))}},s.prototype.select=a.select,s.prototype.selectAll=a.selectAll})),r.plugin((function(t,r,i,o,s){var a=r.prototype,u=t.is,c=String,l="hasOwnProperty";function h(t,e,n){return function(r){var i=r.slice(t,e);return 1==i.length&&(i=i[0]),n?n(i):i}}var p=function(t,e,r,i){"function"!=typeof r||r.length||(i=r,r=n.linear),this.attr=t,this.dur=e,r&&(this.easing=r),i&&(this.callback=i)};t._.Animation=p,t.animation=function(t,e,n,r){return new p(t,e,n,r)},a.inAnim=function(){var t=[];for(var e in this.anims)this.anims[l](e)&&function(e){t.push({anim:new p(e._attrs,e.dur,e.easing,e._callback),mina:e,curStatus:e.status(),status:function(t){return e.status(t)},stop:function(){e.stop()}})}(this.anims[e]);return t},t.animate=function(t,r,i,o,s,a){"function"!=typeof s||s.length||(a=s,s=n.linear);var u=n.time(),c=n(t,r,u,u+o,n.time,i,s);return a&&e.once("mina.finish."+c.id,a),c},a.stop=function(){for(var t=this.inAnim(),e=0,n=t.length;e<n;e++)t[e].stop();return this},a.animate=function(t,r,i,o){"function"!=typeof i||i.length||(o=i,i=n.linear),t instanceof p&&(o=t.callback,i=t.easing,r=t.dur,t=t.attr);var s,a,f,d,g=[],m=[],v={},y=this;for(var x in t)if(t[l](x)){y.equal?(s=(d=y.equal(x,c(t[x]))).from,a=d.to,f=d.f):(s=+y.attr(x),a=+t[x]);var b=u(s,"array")?s.length:1;v[x]=h(g.length,g.length+b,f),g=g.concat(s),m=m.concat(a)}var _=n.time(),w=n(g,m,_,_+r,n.time,(function(t){var e={};for(var n in v)v[l](n)&&(e[n]=v[n](t));y.attr(e)}),i);return y.anims[w.id]=w,w._attrs=t,w._callback=o,e("snap.animcreated."+y.id,w),e.once("mina.finish."+w.id,(function(){e.off("mina.*."+w.id),delete y.anims[w.id],o&&o.call(y)})),e.once("mina.stop."+w.id,(function(){e.off("mina.*."+w.id),delete y.anims[w.id]})),y}})),r.plugin((function(t,e,n,r,i){var o=Object.prototype.toString,s=String,a=Math;function u(t,e,n,r,i,s){if(null==e&&"[object SVGMatrix]"==o.call(t))return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.e=t.e,void(this.f=t.f);null!=t?(this.a=+t,this.b=+e,this.c=+n,this.d=+r,this.e=+i,this.f=+s):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}!function(e){function n(t){return t[0]*t[0]+t[1]*t[1]}function r(t){var e=a.sqrt(n(t));t[0]&&(t[0]/=e),t[1]&&(t[1]/=e)}e.add=function(t,e,n,r,i,o){if(t&&t instanceof u)return this.add(t.a,t.b,t.c,t.d,t.e,t.f);var s=t*this.a+e*this.c,a=t*this.b+e*this.d;return this.e+=i*this.a+o*this.c,this.f+=i*this.b+o*this.d,this.c=n*this.a+r*this.c,this.d=n*this.b+r*this.d,this.a=s,this.b=a,this},u.prototype.multLeft=function(t,e,n,r,i,o){if(t&&t instanceof u)return this.multLeft(t.a,t.b,t.c,t.d,t.e,t.f);var s=t*this.a+n*this.b,a=t*this.c+n*this.d,c=t*this.e+n*this.f+i;return this.b=e*this.a+r*this.b,this.d=e*this.c+r*this.d,this.f=e*this.e+r*this.f+o,this.a=s,this.c=a,this.e=c,this},e.invert=function(){var t=this,e=t.a*t.d-t.b*t.c;return new u(t.d/e,-t.b/e,-t.c/e,t.a/e,(t.c*t.f-t.d*t.e)/e,(t.b*t.e-t.a*t.f)/e)},e.clone=function(){return new u(this.a,this.b,this.c,this.d,this.e,this.f)},e.translate=function(t,e){return this.e+=t*this.a+e*this.c,this.f+=t*this.b+e*this.d,this},e.scale=function(t,e,n,r){return null==e&&(e=t),(n||r)&&this.translate(n,r),this.a*=t,this.b*=t,this.c*=e,this.d*=e,(n||r)&&this.translate(-n,-r),this},e.rotate=function(e,n,r){e=t.rad(e),n=n||0,r=r||0;var i=+a.cos(e).toFixed(9),o=+a.sin(e).toFixed(9);return this.add(i,o,-o,i,n,r),this.add(1,0,0,1,-n,-r)},e.skewX=function(t){return this.skew(t,0)},e.skewY=function(t){return this.skew(0,t)},e.skew=function(e,n){e=e||0,n=n||0,e=t.rad(e),n=t.rad(n);var r=a.tan(e).toFixed(9),i=a.tan(n).toFixed(9);return this.add(1,i,r,1,0,0)},e.x=function(t,e){return t*this.a+e*this.c+this.e},e.y=function(t,e){return t*this.b+e*this.d+this.f},e.get=function(t){return+this[s.fromCharCode(97+t)].toFixed(4)},e.toString=function(){return"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")"},e.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},e.determinant=function(){return this.a*this.d-this.b*this.c},e.split=function(){var e={};e.dx=this.e,e.dy=this.f;var i=[[this.a,this.b],[this.c,this.d]];e.scalex=a.sqrt(n(i[0])),r(i[0]),e.shear=i[0][0]*i[1][0]+i[0][1]*i[1][1],i[1]=[i[1][0]-i[0][0]*e.shear,i[1][1]-i[0][1]*e.shear],e.scaley=a.sqrt(n(i[1])),r(i[1]),e.shear/=e.scaley,this.determinant()<0&&(e.scalex=-e.scalex);var o=i[0][1],s=i[1][1];return s<0?(e.rotate=t.deg(a.acos(s)),o<0&&(e.rotate=360-e.rotate)):e.rotate=t.deg(a.asin(o)),e.isSimple=!(+e.shear.toFixed(9)||e.scalex.toFixed(9)!=e.scaley.toFixed(9)&&e.rotate),e.isSuperSimple=!+e.shear.toFixed(9)&&e.scalex.toFixed(9)==e.scaley.toFixed(9)&&!e.rotate,e.noRotation=!+e.shear.toFixed(9)&&!e.rotate,e},e.toTransformString=function(t){var e=t||this.split();return+e.shear.toFixed(9)?"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]:(e.scalex=+e.scalex.toFixed(4),e.scaley=+e.scaley.toFixed(4),e.rotate=+e.rotate.toFixed(4),(e.dx||e.dy?"t"+[+e.dx.toFixed(4),+e.dy.toFixed(4)]:"")+(e.rotate?"r"+[+e.rotate.toFixed(4),0,0]:"")+(1!=e.scalex||1!=e.scaley?"s"+[e.scalex,e.scaley,0,0]:""))}}(u.prototype),t.Matrix=u,t.matrix=function(t,e,n,r,i,o){return new u(t,e,n,r,i,o)}})),r.plugin((function(t,n,r,i,o){var s,a=t._.make,u=t._.wrap,c=t.is,l=t._.getSomeDefs,h=/^url\((['"]?)([^)]+)\1\)$/,p=t._.$,f=t.url,d=String,g=t._.separator;function m(r){return function(i){if(e.stop(),i instanceof o&&1==i.node.childNodes.length&&("radialGradient"==i.node.firstChild.tagName||"linearGradient"==i.node.firstChild.tagName||"pattern"==i.node.firstChild.tagName)&&(i=i.node.firstChild,l(this).appendChild(i),i=u(i)),i instanceof n)if("radialGradient"==i.type||"linearGradient"==i.type||"pattern"==i.type){i.node.id||p(i.node,{id:i.id});var s=f(i.node.id)}else s=i.attr(r);else if((s=t.color(i)).error){var a=t(l(this).ownerSVGElement).gradient(i);a?(a.node.id||p(a.node,{id:a.id}),s=f(a.node.id)):s=i}else s=d(s);var c={};c[r]=s,p(this.node,c),this.node.style[r]=""}}t.deurl=function(t){var e=String(t).match(h);return e?e[2]:t},e.on("snap.util.attr.mask",(function(t){if(t instanceof n||t instanceof o){if(e.stop(),t instanceof o&&1==t.node.childNodes.length&&(t=t.node.firstChild,l(this).appendChild(t),t=u(t)),"mask"==t.type)var r=t;else(r=a("mask",l(this))).node.appendChild(t.node);!r.node.id&&p(r.node,{id:r.id}),p(this.node,{mask:f(r.id)})}})),s=function(t){if(t instanceof n||t instanceof o){e.stop();for(var r,i=t.node;i;){if("clipPath"===i.nodeName){r=new n(i);break}if("svg"===i.nodeName){r=void 0;break}i=i.parentNode}r||((r=a("clipPath",l(this))).node.appendChild(t.node),!r.node.id&&p(r.node,{id:r.id})),p(this.node,{"clip-path":f(r.node.id||r.id)})}},e.on("snap.util.attr.clip",s),e.on("snap.util.attr.clip-path",s),e.on("snap.util.attr.clipPath",s),e.on("snap.util.attr.fill",m("fill")),e.on("snap.util.attr.stroke",m("stroke"));var v=/^([lr])(?:\(([^)]*)\))?(.*)$/i;function y(t){e.stop(),t==+t&&(t+="px"),this.node.style.fontSize=t}function x(){return e.stop(),this.node.style.fontSize}e.on("snap.util.grad.parse",(function(t){var e=(t=d(t)).match(v);if(!e)return null;var n=e[1],r=e[2],i=e[3];1==(r=r.split(/\s*,\s*/).map((function(t){return+t==t?+t:t}))).length&&0==r[0]&&(r=[]);var o=(i=(i=i.split("-")).map((function(t){var e={color:(t=t.split(":"))[0]};return t[1]&&(e.offset=parseFloat(t[1])),e}))).length,s=0,a=0;function u(t,e){for(var n=(e-s)/(t-a),r=a;r<t;r++)i[r].offset=+(+s+n*(r-a)).toFixed(2);a=t,s=e}o--;for(var c=0;c<o;c++)"offset"in i[c]&&u(c,i[c].offset);return i[o].offset=i[o].offset||100,u(o,i[o].offset),{type:n,params:r,stops:i}})),e.on("snap.util.attr.d",(function(n){e.stop(),c(n,"array")&&c(n[0],"array")&&(n=t.path.toString.call(n)),(n=d(n)).match(/[ruo]/i)&&(n=t.path.toAbsolute(n)),p(this.node,{d:n})}))(-1),e.on("snap.util.attr.#text",(function(t){e.stop(),t=d(t);for(var n=i.doc.createTextNode(t);this.node.firstChild;)this.node.removeChild(this.node.firstChild);this.node.appendChild(n)}))(-1),e.on("snap.util.attr.path",(function(t){e.stop(),this.attr({d:t})}))(-1),e.on("snap.util.attr.class",(function(t){e.stop(),this.node.className.baseVal=t}))(-1),e.on("snap.util.attr.viewBox",(function(t){var n;n=c(t,"object")&&"x"in t?[t.x,t.y,t.width,t.height].join(" "):c(t,"array")?t.join(" "):t,p(this.node,{viewBox:n}),e.stop()}))(-1),e.on("snap.util.attr.transform",(function(t){this.transform(t),e.stop()}))(-1),e.on("snap.util.attr.r",(function(t){"rect"==this.type&&(e.stop(),p(this.node,{rx:t,ry:t}))}))(-1),e.on("snap.util.attr.textpath",(function(t){if(e.stop(),"text"==this.type){var r,i,o;if(!t&&this.textPath){for(i=this.textPath;i.node.firstChild;)this.node.appendChild(i.node.firstChild);return i.remove(),void delete this.textPath}if(c(t,"string")){var s=l(this),a=u(s.parentNode).path(t);s.appendChild(a.node),r=a.id,a.attr({id:r})}else(t=u(t))instanceof n&&((r=t.attr("id"))||(r=t.id,t.attr({id:r})));if(r)if(i=this.textPath,o=this.node,i)i.attr({"xlink:href":"#"+r});else{for(i=p("textPath",{"xlink:href":"#"+r});o.firstChild;)i.appendChild(o.firstChild);o.appendChild(i),this.textPath=u(i)}}}))(-1),e.on("snap.util.attr.text",(function(t){if("text"==this.type){for(var n=this.node,r=function(t){var e=p("tspan");if(c(t,"array"))for(var n=0;n<t.length;n++)e.appendChild(r(t[n]));else e.appendChild(i.doc.createTextNode(t));return e.normalize&&e.normalize(),e};n.firstChild;)n.removeChild(n.firstChild);for(var o=r(t);o.firstChild;)n.appendChild(o.firstChild)}e.stop()}))(-1),e.on("snap.util.attr.fontSize",y)(-1),e.on("snap.util.attr.font-size",y)(-1),e.on("snap.util.getattr.transform",(function(){return e.stop(),this.transform()}))(-1),e.on("snap.util.getattr.textpath",(function(){return e.stop(),this.textPath}))(-1),function(){function n(n){return function(){e.stop();var r=i.doc.defaultView.getComputedStyle(this.node,null).getPropertyValue("marker-"+n);return"none"==r?r:t(i.doc.getElementById(r.match(h)[1]))}}function r(t){return function(n){e.stop();var r="marker"+t.charAt(0).toUpperCase()+t.substring(1);if(""!=n&&n){if("marker"==n.type){var i=n.node.id;return i||p(n.node,{id:n.id}),void(this.node.style[r]=f(i))}}else this.node.style[r]="none"}}e.on("snap.util.getattr.marker-end",n("end"))(-1),e.on("snap.util.getattr.markerEnd",n("end"))(-1),e.on("snap.util.getattr.marker-start",n("start"))(-1),e.on("snap.util.getattr.markerStart",n("start"))(-1),e.on("snap.util.getattr.marker-mid",n("mid"))(-1),e.on("snap.util.getattr.markerMid",n("mid"))(-1),e.on("snap.util.attr.marker-end",r("end"))(-1),e.on("snap.util.attr.markerEnd",r("end"))(-1),e.on("snap.util.attr.marker-start",r("start"))(-1),e.on("snap.util.attr.markerStart",r("start"))(-1),e.on("snap.util.attr.marker-mid",r("mid"))(-1),e.on("snap.util.attr.markerMid",r("mid"))(-1)}(),e.on("snap.util.getattr.r",(function(){if("rect"==this.type&&p(this.node,"rx")==p(this.node,"ry"))return e.stop(),p(this.node,"rx")}))(-1),e.on("snap.util.getattr.text",(function(){if("text"==this.type||"tspan"==this.type){e.stop();var t=function t(e){for(var n=[],r=e.childNodes,i=0,o=r.length;i<o;i++){var s=r[i];3==s.nodeType&&n.push(s.nodeValue),"tspan"==s.tagName&&(1==s.childNodes.length&&3==s.firstChild.nodeType?n.push(s.firstChild.nodeValue):n.push(t(s)))}return n}(this.node);return 1==t.length?t[0]:t}}))(-1),e.on("snap.util.getattr.#text",(function(){return this.node.textContent}))(-1),e.on("snap.util.getattr.fill",(function(n){if(!n){e.stop();var r=e("snap.util.getattr.fill",this,!0).firstDefined();return t(t.deurl(r))||r}}))(-1),e.on("snap.util.getattr.stroke",(function(n){if(!n){e.stop();var r=e("snap.util.getattr.stroke",this,!0).firstDefined();return t(t.deurl(r))||r}}))(-1),e.on("snap.util.getattr.viewBox",(function(){e.stop();var n=p(this.node,"viewBox");return n?(n=n.split(g),t._.box(+n[0],+n[1],+n[2],+n[3])):void 0}))(-1),e.on("snap.util.getattr.points",(function(){var t=p(this.node,"points");return e.stop(),t?t.split(g):void 0}))(-1),e.on("snap.util.getattr.path",(function(){var t=p(this.node,"d");return e.stop(),t}))(-1),e.on("snap.util.getattr.class",(function(){return this.node.className.baseVal}))(-1),e.on("snap.util.getattr.fontSize",x)(-1),e.on("snap.util.getattr.font-size",x)(-1)})),r.plugin((function(t,e,n,r,i){var o=/\S+/g,s=String,a=e.prototype;a.addClass=function(t){var e,n,r,i=s(t||"").match(o)||[],a=this.node,u=a.className.baseVal,c=u.match(o)||[];if(i.length){for(e=0;n=i[e++];)~c.indexOf(n)||c.push(n);u!=(r=c.join(" "))&&(a.className.baseVal=r)}return this},a.removeClass=function(t){var e,n,r,i,a=s(t||"").match(o)||[],u=this.node,c=u.className.baseVal,l=c.match(o)||[];if(l.length){for(e=0;r=a[e++];)~(n=l.indexOf(r))&&l.splice(n,1);c!=(i=l.join(" "))&&(u.className.baseVal=i)}return this},a.hasClass=function(t){return!!~(this.node.className.baseVal.match(o)||[]).indexOf(t)},a.toggleClass=function(t,e){if(null!=e)return e?this.addClass(t):this.removeClass(t);var n,r,i,s,a=(t||"").match(o)||[],u=this.node,c=u.className.baseVal,l=c.match(o)||[];for(n=0;i=a[n++];)~(r=l.indexOf(i))?l.splice(r,1):l.push(i);return c!=(s=l.join(" "))&&(u.className.baseVal=s),this}})),r.plugin((function(t,n,r,i,o){var s={"+":function(t,e){return t+e},"-":function(t,e){return t-e},"/":function(t,e){return t/e},"*":function(t,e){return t*e}},a=String,u=/[a-z]+$/i,c=/^\s*([+\-\/*])\s*=\s*([\d.eE+\-]+)\s*([^\d\s]+)?\s*$/;function l(t){return t}function h(t){return function(e){return+e.toFixed(3)+t}}e.on("snap.util.attr",(function(t){var n=a(t).match(c);if(n){var r=e.nt(),i=r.substring(r.lastIndexOf(".")+1),o=this.attr(i),l={};e.stop();var h=n[3]||"",p=o.match(u),f=s[n[1]];if(p&&p==h?t=f(parseFloat(o),+n[2]):(o=this.asPX(i),t=f(this.asPX(i),this.asPX(i,n[2]+h))),isNaN(o)||isNaN(t))return;l[i]=t,this.attr(l)}}))(-10),e.on("snap.util.equal",(function(t,n){var r=a(this.attr(t)||""),i=a(n).match(c);if(i){e.stop();var o=i[3]||"",p=r.match(u),f=s[i[1]];return p&&p==o?{from:parseFloat(r),to:f(parseFloat(r),+i[2]),f:h(p)}:{from:r=this.asPX(t),to:f(r,this.asPX(t,i[2]+o)),f:l}}}))(-10)})),r.plugin((function(n,r,i,o,s){var a=i.prototype,u=n.is;a.rect=function(t,e,n,r,i,o){var s;return null==o&&(o=i),u(t,"object")&&"[object Object]"==t?s=t:null!=t&&(s={x:t,y:e,width:n,height:r},null!=i&&(s.rx=i,s.ry=o)),this.el("rect",s)},a.circle=function(t,e,n){var r;return u(t,"object")&&"[object Object]"==t?r=t:null!=t&&(r={cx:t,cy:e,r:n}),this.el("circle",r)};var c=function(){function t(){this.parentNode.removeChild(this)}return function(e,n){var r=o.doc.createElement("img"),i=o.doc.body;r.style.cssText="position:absolute;left:-9999em;top:-9999em",r.onload=function(){n.call(r),r.onload=r.onerror=null,i.removeChild(r)},r.onerror=t,i.appendChild(r),r.src=e}}();a.image=function(t,e,r,i,o){var s=this.el("image");if(u(t,"object")&&"src"in t)s.attr(t);else if(null!=t){var a={"xlink:href":t,preserveAspectRatio:"none"};null!=e&&null!=r&&(a.x=e,a.y=r),null!=i&&null!=o?(a.width=i,a.height=o):c(t,(function(){n._.$(s.node,{width:this.offsetWidth,height:this.offsetHeight})})),n._.$(s.node,a)}return s},a.ellipse=function(t,e,n,r){var i;return u(t,"object")&&"[object Object]"==t?i=t:null!=t&&(i={cx:t,cy:e,rx:n,ry:r}),this.el("ellipse",i)},a.path=function(t){var e;return u(t,"object")&&!u(t,"array")?e=t:t&&(e={d:t}),this.el("path",e)},a.group=a.g=function(t){var e=this.el("g");return 1==arguments.length&&t&&!t.type?e.attr(t):arguments.length&&e.add(Array.prototype.slice.call(arguments,0)),e},a.svg=function(t,e,n,r,i,o,s,a){var c={};return u(t,"object")&&null==e?c=t:(null!=t&&(c.x=t),null!=e&&(c.y=e),null!=n&&(c.width=n),null!=r&&(c.height=r),null!=i&&null!=o&&null!=s&&null!=a&&(c.viewBox=[i,o,s,a])),this.el("svg",c)},a.mask=function(t){var e=this.el("mask");return 1==arguments.length&&t&&!t.type?e.attr(t):arguments.length&&e.add(Array.prototype.slice.call(arguments,0)),e},a.ptrn=function(t,e,n,r,i,o,s,a){if(u(t,"object"))var c=t;else c={patternUnits:"userSpaceOnUse"},t&&(c.x=t),e&&(c.y=e),null!=n&&(c.width=n),null!=r&&(c.height=r),c.viewBox=null!=i&&null!=o&&null!=s&&null!=a?[i,o,s,a]:[t||0,e||0,n||0,r||0];return this.el("pattern",c)},a.use=function(t){return null!=t?(t instanceof r&&(t.attr("id")||t.attr({id:n._.id(t)}),t=t.attr("id")),"#"==String(t).charAt()&&(t=t.substring(1)),this.el("use",{"xlink:href":"#"+t})):r.prototype.use.call(this)},a.symbol=function(t,e,n,r){var i={};return null!=t&&null!=e&&null!=n&&null!=r&&(i.viewBox=[t,e,n,r]),this.el("symbol",i)},a.text=function(t,e,n){var r={};return u(t,"object")?r=t:null!=t&&(r={x:t,y:e,text:n||""}),this.el("text",r)},a.line=function(t,e,n,r){var i={};return u(t,"object")?i=t:null!=t&&(i={x1:t,x2:n,y1:e,y2:r}),this.el("line",i)},a.polyline=function(t){arguments.length>1&&(t=Array.prototype.slice.call(arguments,0));var e={};return u(t,"object")&&!u(t,"array")?e=t:null!=t&&(e={points:t}),this.el("polyline",e)},a.polygon=function(t){arguments.length>1&&(t=Array.prototype.slice.call(arguments,0));var e={};return u(t,"object")&&!u(t,"array")?e=t:null!=t&&(e={points:t}),this.el("polygon",e)},function(){var r=n._.$;function i(){return this.selectAll("stop")}function o(t,e){var i=r("stop"),o={offset:+e+"%"};t=n.color(t),o["stop-color"]=t.hex,t.opacity<1&&(o["stop-opacity"]=t.opacity),r(i,o);for(var s,a=this.stops(),u=0;u<a.length;u++){if(parseFloat(a[u].attr("offset"))>e){this.node.insertBefore(i,a[u].node),s=!0;break}}return s||this.node.appendChild(i),this}function s(){if("linearGradient"==this.type){var t=r(this.node,"x1")||0,e=r(this.node,"x2")||1,i=r(this.node,"y1")||0,o=r(this.node,"y2")||0;return n._.box(t,i,math.abs(e-t),math.abs(o-i))}var s=this.node.cx||.5,a=this.node.cy||.5,u=this.node.r||0;return n._.box(s-u,a-u,2*u,2*u)}function u(t){var r=t,i=this.stops();if("string"==typeof t&&(r=e("snap.util.grad.parse",null,"l(0,0,0,1)"+t).firstDefined().stops),n.is(r,"array")){for(var o=0;o<i.length;o++)if(r[o]){var s=n.color(r[o].color),a={offset:r[o].offset+"%"};a["stop-color"]=s.hex,s.opacity<1&&(a["stop-opacity"]=s.opacity),i[o].attr(a)}else i[o].remove();for(o=i.length;o<r.length;o++)this.addStop(r[o].color,r[o].offset);return this}}function c(t,e,a,c,l){var h=n._.make("linearGradient",t);return h.stops=i,h.addStop=o,h.getBBox=s,h.setStops=u,null!=e&&r(h.node,{x1:e,y1:a,x2:c,y2:l}),h}function l(t,e,a,u,c,l){var h=n._.make("radialGradient",t);return h.stops=i,h.addStop=o,h.getBBox=s,null!=e&&r(h.node,{cx:e,cy:a,r:u}),null!=c&&null!=l&&r(h.node,{fx:c,fy:l}),h}a.gradient=function(t){return function(t,n){var i,o=e("snap.util.grad.parse",null,n).firstDefined();if(!o)return null;o.params.unshift(t),i="l"==o.type.toLowerCase()?c.apply(0,o.params):l.apply(0,o.params),o.type!=o.type.toLowerCase()&&r(i.node,{gradientUnits:"userSpaceOnUse"});for(var s=o.stops,a=s.length,u=0;u<a;u++){var h=s[u];i.addStop(h.color,h.offset)}return i}(this.defs,t)},a.gradientLinear=function(t,e,n,r){return c(this.defs,t,e,n,r)},a.gradientRadial=function(t,e,n,r,i){return l(this.defs,t,e,n,r,i)},a.toString=function(){var t,e=this.node.ownerDocument,r=e.createDocumentFragment(),i=e.createElement("div"),o=this.node.cloneNode(!0);return r.appendChild(i),i.appendChild(o),n._.$(o,{xmlns:"http://www.w3.org/2000/svg"}),t=i.innerHTML,r.removeChild(r.firstChild),t},a.toDataURL=function(){if(t&&t.btoa)return"data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(this)))},a.clear=function(){for(var t,e=this.node.firstChild;e;)t=e.nextSibling,"defs"!=e.tagName?e.parentNode.removeChild(e):a.clear.call({node:e}),e=t}}()})),r.plugin((function(t,e,n,r){var i=e.prototype,o=t.is,s=t._.clone,a=/,?([a-z]),?/gi,u=parseFloat,c=Math,l=c.PI,h=c.min,p=c.max,f=c.pow,d=c.abs;function g(t){var e=g.ps=g.ps||{};return e[t]?e[t].sleep=100:e[t]={sleep:100},setTimeout((function(){for(var n in e)e.hasOwnProperty(n)&&n!=t&&(e[n].sleep--,!e[n].sleep&&delete e[n])})),e[t]}function m(t,e,n,r){return null==t&&(t=e=n=r=0),null==e&&(e=t.y,n=t.width,r=t.height,t=t.x),{x:t,y:e,width:n,w:n,height:r,h:r,x2:t+n,y2:e+r,cx:t+n/2,cy:e+r/2,r1:c.min(n,r)/2,r2:c.max(n,r)/2,r0:c.sqrt(n*n+r*r)/2,path:D(t,e,n,r),vb:[t,e,n,r].join(" ")}}function v(){return this.join(",").replace(a,"$1")}function y(t){var e=s(t);return e.toString=v,e}function x(t,e,n,r,i,o,s,a,u){return null==u?P(t,e,n,r,i,o,s,a):E(t,e,n,r,i,o,s,a,function(t,e,n,r,i,o,s,a,u){if(u<0||P(t,e,n,r,i,o,s,a)<u)return;var c,l=.5,h=1-l;c=P(t,e,n,r,i,o,s,a,h);for(;d(c-u)>.01;)c=P(t,e,n,r,i,o,s,a,h+=(c<u?1:-1)*(l/=2));return h}(t,e,n,r,i,o,s,a,u))}function b(n,r){function i(t){return+(+t).toFixed(3)}return t._.cacher((function(t,o,s){t instanceof e&&(t=t.attr("d"));for(var a,u,c,l,h,p="",f={},d=0,g=0,m=(t=V(t)).length;g<m;g++){if("M"==(c=t[g])[0])a=+c[1],u=+c[2];else{if(d+(l=x(a,u,c[1],c[2],c[3],c[4],c[5],c[6]))>o){if(r&&!f.start){if(p+=["C"+i((h=x(a,u,c[1],c[2],c[3],c[4],c[5],c[6],o-d)).start.x),i(h.start.y),i(h.m.x),i(h.m.y),i(h.x),i(h.y)],s)return p;f.start=p,p=["M"+i(h.x),i(h.y)+"C"+i(h.n.x),i(h.n.y),i(h.end.x),i(h.end.y),i(c[5]),i(c[6])].join(),d+=l,a=+c[5],u=+c[6];continue}if(!n&&!r)return h=x(a,u,c[1],c[2],c[3],c[4],c[5],c[6],o-d)}d+=l,a=+c[5],u=+c[6]}p+=c.shift()+c}return f.end=p,h=n?d:r?f:E(a,u,c[0],c[1],c[2],c[3],c[4],c[5],1)}),null,t._.clone)}var _=b(1),w=b(),M=b(0,1);function E(t,e,n,r,i,o,s,a,u){var h=1-u,p=f(h,3),d=f(h,2),g=u*u,m=g*u,v=t+2*u*(n-t)+g*(i-2*n+t),y=e+2*u*(r-e)+g*(o-2*r+e),x=n+2*u*(i-n)+g*(s-2*i+n),b=r+2*u*(o-r)+g*(a-2*o+r);return{x:p*t+3*d*u*n+3*h*u*u*i+m*s,y:p*e+3*d*u*r+3*h*u*u*o+m*a,m:{x:v,y:y},n:{x:x,y:b},start:{x:h*t+u*n,y:h*e+u*r},end:{x:h*i+u*s,y:h*o+u*a},alpha:90-180*c.atan2(v-x,y-b)/l}}function S(e,n,r,i,o,s,a,u){t.is(e,"array")||(e=[e,n,r,i,o,s,a,u]);var c=H.apply(null,e);return m(c.min.x,c.min.y,c.max.x-c.min.x,c.max.y-c.min.y)}function A(t,e,n){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function C(t,e){return t=m(t),A(e=m(e),t.x,t.y)||A(e,t.x2,t.y)||A(e,t.x,t.y2)||A(e,t.x2,t.y2)||A(t,e.x,e.y)||A(t,e.x2,e.y)||A(t,e.x,e.y2)||A(t,e.x2,e.y2)||(t.x<e.x2&&t.x>e.x||e.x<t.x2&&e.x>t.x)&&(t.y<e.y2&&t.y>e.y||e.y<t.y2&&e.y>t.y)}function T(t,e,n,r,i){return t*(t*(-3*e+9*n-9*r+3*i)+6*e-12*n+6*r)-3*e+3*n}function P(t,e,n,r,i,o,s,a,u){null==u&&(u=1);for(var l=(u=u>1?1:u<0?0:u)/2,h=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],f=0,d=0;d<12;d++){var g=l*h[d]+l,m=T(g,t,n,i,s),v=T(g,e,r,o,a),y=m*m+v*v;f+=p[d]*c.sqrt(y)}return l*f}function I(t,e,n,r,i,o,s,a){if(!(p(t,n)<h(i,s)||h(t,n)>p(i,s)||p(e,r)<h(o,a)||h(e,r)>p(o,a))){var u=(t-n)*(o-a)-(e-r)*(i-s);if(u){var c=((t*r-e*n)*(i-s)-(t-n)*(i*a-o*s))/u,l=((t*r-e*n)*(o-a)-(e-r)*(i*a-o*s))/u,f=+c.toFixed(2),d=+l.toFixed(2);if(!(f<+h(t,n).toFixed(2)||f>+p(t,n).toFixed(2)||f<+h(i,s).toFixed(2)||f>+p(i,s).toFixed(2)||d<+h(e,r).toFixed(2)||d>+p(e,r).toFixed(2)||d<+h(o,a).toFixed(2)||d>+p(o,a).toFixed(2)))return{x:c,y:l}}}}function L(t,e,n){if(!C(S(t),S(e)))return n?0:[];for(var r=~~(P.apply(0,t)/8),i=~~(P.apply(0,e)/8),o=[],s=[],a={},u=n?0:[],c=0;c<r+1;c++){var l=E.apply(0,t.concat(c/r));o.push({x:l.x,y:l.y,t:c/r})}for(c=0;c<i+1;c++)l=E.apply(0,e.concat(c/i)),s.push({x:l.x,y:l.y,t:c/i});for(c=0;c<r;c++)for(var h=0;h<i;h++){var p=o[c],f=o[c+1],g=s[h],m=s[h+1],v=d(f.x-p.x)<.001?"y":"x",y=d(m.x-g.x)<.001?"y":"x",x=I(p.x,p.y,f.x,f.y,g.x,g.y,m.x,m.y);if(x){if(a[x.x.toFixed(4)]==x.y.toFixed(4))continue;a[x.x.toFixed(4)]=x.y.toFixed(4);var b=p.t+d((x[v]-p[v])/(f[v]-p[v]))*(f.t-p.t),_=g.t+d((x[y]-g[y])/(m[y]-g[y]))*(m.t-g.t);b>=0&&b<=1&&_>=0&&_<=1&&(n?u++:u.push({x:x.x,y:x.y,t1:b,t2:_}))}}return u}function R(t,e,n){t=V(t),e=V(e);for(var r,i,o,s,a,u,c,l,h,p,f=n?0:[],d=0,g=t.length;d<g;d++){var m=t[d];if("M"==m[0])r=a=m[1],i=u=m[2];else{"C"==m[0]?(h=[r,i].concat(m.slice(1)),r=h[6],i=h[7]):(h=[r,i,r,i,a,u,a,u],r=a,i=u);for(var v=0,y=e.length;v<y;v++){var x=e[v];if("M"==x[0])o=c=x[1],s=l=x[2];else{"C"==x[0]?(p=[o,s].concat(x.slice(1)),o=p[6],s=p[7]):(p=[o,s,o,s,c,l,c,l],o=c,s=l);var b=L(h,p,n);if(n)f+=b;else{for(var _=0,w=b.length;_<w;_++)b[_].segment1=d,b[_].segment2=v,b[_].bez1=h,b[_].bez2=p;f=f.concat(b)}}}}}return f}function O(t){var e=g(t);if(e.bbox)return s(e.bbox);if(!t)return m();for(var n,r=0,i=0,o=[],a=[],u=0,c=(t=V(t)).length;u<c;u++)if("M"==(n=t[u])[0])r=n[1],i=n[2],o.push(r),a.push(i);else{var l=H(r,i,n[1],n[2],n[3],n[4],n[5],n[6]);o=o.concat(l.min.x,l.max.x),a=a.concat(l.min.y,l.max.y),r=n[5],i=n[6]}var f=h.apply(0,o),d=h.apply(0,a),v=m(f,d,p.apply(0,o)-f,p.apply(0,a)-d);return e.bbox=s(v),v}function D(t,e,n,r,i){if(i)return[["M",+t+ +i,e],["l",n-2*i,0],["a",i,i,0,0,1,i,i],["l",0,r-2*i],["a",i,i,0,0,1,-i,i],["l",2*i-n,0],["a",i,i,0,0,1,-i,-i],["l",0,2*i-r],["a",i,i,0,0,1,i,-i],["z"]];var o=[["M",t,e],["l",n,0],["l",0,r],["l",-n,0],["z"]];return o.toString=v,o}function B(t,e,n,r,i){if(null==i&&null==r&&(r=n),t=+t,e=+e,n=+n,r=+r,null!=i)var o=Math.PI/180,s=t+n*Math.cos(-r*o),a=t+n*Math.cos(-i*o),u=[["M",s,e+n*Math.sin(-r*o)],["A",n,n,0,+(i-r>180),0,a,e+n*Math.sin(-i*o)]];else u=[["M",t,e],["m",0,-r],["a",n,r,0,1,1,0,2*r],["a",n,r,0,1,1,0,-2*r],["z"]];return u.toString=v,u}var F=t._unit2px,N={path:function(t){return t.attr("path")},circle:function(t){var e=F(t);return B(e.cx,e.cy,e.r)},ellipse:function(t){var e=F(t);return B(e.cx||0,e.cy||0,e.rx,e.ry)},rect:function(t){var e=F(t);return D(e.x||0,e.y||0,e.width,e.height,e.rx,e.ry)},image:function(t){var e=F(t);return D(e.x||0,e.y||0,e.width,e.height)},line:function(t){return"M"+[t.attr("x1")||0,t.attr("y1")||0,t.attr("x2"),t.attr("y2")]},polyline:function(t){return"M"+t.attr("points")},polygon:function(t){return"M"+t.attr("points")+"z"},deflt:function(t){var e=t.node.getBBox();return D(e.x,e.y,e.width,e.height)}};function k(e){var n=g(e);if(n.abs)return y(n.abs);if(o(e,"array")&&o(e&&e[0],"array")||(e=t.parsePathString(e)),!e||!e.length)return[["M",0,0]];var r,i=[],s=0,a=0,u=0,c=0,l=0;"M"==e[0][0]&&(u=s=+e[0][1],c=a=+e[0][2],l++,i[0]=["M",s,a]);for(var h,p,f=3==e.length&&"M"==e[0][0]&&"R"==e[1][0].toUpperCase()&&"Z"==e[2][0].toUpperCase(),d=l,m=e.length;d<m;d++){if(i.push(h=[]),(r=(p=e[d])[0])!=r.toUpperCase())switch(h[0]=r.toUpperCase(),h[0]){case"A":h[1]=p[1],h[2]=p[2],h[3]=p[3],h[4]=p[4],h[5]=p[5],h[6]=+p[6]+s,h[7]=+p[7]+a;break;case"V":h[1]=+p[1]+a;break;case"H":h[1]=+p[1]+s;break;case"R":for(var x=[s,a].concat(p.slice(1)),b=2,_=x.length;b<_;b++)x[b]=+x[b]+s,x[++b]=+x[b]+a;i.pop(),i=i.concat(j(x,f));break;case"O":i.pop(),(x=B(s,a,p[1],p[2])).push(x[0]),i=i.concat(x);break;case"U":i.pop(),i=i.concat(B(s,a,p[1],p[2],p[3])),h=["U"].concat(i[i.length-1].slice(-2));break;case"M":u=+p[1]+s,c=+p[2]+a;default:for(b=1,_=p.length;b<_;b++)h[b]=+p[b]+(b%2?s:a)}else if("R"==r)x=[s,a].concat(p.slice(1)),i.pop(),i=i.concat(j(x,f)),h=["R"].concat(p.slice(-2));else if("O"==r)i.pop(),(x=B(s,a,p[1],p[2])).push(x[0]),i=i.concat(x);else if("U"==r)i.pop(),i=i.concat(B(s,a,p[1],p[2],p[3])),h=["U"].concat(i[i.length-1].slice(-2));else for(var w=0,M=p.length;w<M;w++)h[w]=p[w];if("O"!=(r=r.toUpperCase()))switch(h[0]){case"Z":s=+u,a=+c;break;case"H":s=h[1];break;case"V":a=h[1];break;case"M":u=h[h.length-2],c=h[h.length-1];default:s=h[h.length-2],a=h[h.length-1]}}return i.toString=v,n.abs=y(i),i}function G(t,e,n,r){return[t,e,n,r,n,r]}function U(t,e,n,r,i,o){return[1/3*t+2/3*n,1/3*e+2/3*r,1/3*i+2/3*n,1/3*o+2/3*r,i,o]}function z(e,n,r,i,o,s,a,u,h,p){var f,g=120*l/180,m=l/180*(+o||0),v=[],y=t._.cacher((function(t,e,n){return{x:t*c.cos(n)-e*c.sin(n),y:t*c.sin(n)+e*c.cos(n)}}));if(!r||!i)return[e,n,u,h,u,h];if(p)C=p[0],T=p[1],S=p[2],A=p[3];else{e=(f=y(e,n,-m)).x,n=f.y,u=(f=y(u,h,-m)).x,h=f.y;c.cos(l/180*o),c.sin(l/180*o);var x=(e-u)/2,b=(n-h)/2,_=x*x/(r*r)+b*b/(i*i);_>1&&(r*=_=c.sqrt(_),i*=_);var w=r*r,M=i*i,E=(s==a?-1:1)*c.sqrt(d((w*M-w*b*b-M*x*x)/(w*b*b+M*x*x))),S=E*r*b/i+(e+u)/2,A=E*-i*x/r+(n+h)/2,C=c.asin(((n-A)/i).toFixed(9)),T=c.asin(((h-A)/i).toFixed(9));(C=e<S?l-C:C)<0&&(C=2*l+C),(T=u<S?l-T:T)<0&&(T=2*l+T),a&&C>T&&(C-=2*l),!a&&T>C&&(T-=2*l)}var P=T-C;if(d(P)>g){var I=T,L=u,R=h;T=C+g*(a&&T>C?1:-1),v=z(u=S+r*c.cos(T),h=A+i*c.sin(T),r,i,o,0,a,L,R,[T,I,S,A])}P=T-C;var O=c.cos(C),D=c.sin(C),B=c.cos(T),F=c.sin(T),N=c.tan(P/4),k=4/3*r*N,G=4/3*i*N,U=[e,n],H=[e+k*D,n-G*O],V=[u+k*F,h-G*B],j=[u,h];if(H[0]=2*U[0]-H[0],H[1]=2*U[1]-H[1],p)return[H,V,j].concat(v);for(var W=[],q=0,X=(v=[H,V,j].concat(v).join().split(",")).length;q<X;q++)W[q]=q%2?y(v[q-1],v[q],m).y:y(v[q],v[q+1],m).x;return W}function H(t,e,n,r,i,o,s,a){for(var u,l,f,g,m,v,y,x,b=[],_=[[],[]],w=0;w<2;++w)if(0==w?(l=6*t-12*n+6*i,u=-3*t+9*n-9*i+3*s,f=3*n-3*t):(l=6*e-12*r+6*o,u=-3*e+9*r-9*o+3*a,f=3*r-3*e),d(u)<1e-12){if(d(l)<1e-12)continue;0<(g=-f/l)&&g<1&&b.push(g)}else y=l*l-4*f*u,x=c.sqrt(y),y<0||(0<(m=(-l+x)/(2*u))&&m<1&&b.push(m),0<(v=(-l-x)/(2*u))&&v<1&&b.push(v));for(var M,E=b.length,S=E;E--;)M=1-(g=b[E]),_[0][E]=M*M*M*t+3*M*M*g*n+3*M*g*g*i+g*g*g*s,_[1][E]=M*M*M*e+3*M*M*g*r+3*M*g*g*o+g*g*g*a;return _[0][S]=t,_[1][S]=e,_[0][S+1]=s,_[1][S+1]=a,_[0].length=_[1].length=S+2,{min:{x:h.apply(0,_[0]),y:h.apply(0,_[1])},max:{x:p.apply(0,_[0]),y:p.apply(0,_[1])}}}function V(t,e){var n=!e&&g(t);if(!e&&n.curve)return y(n.curve);for(var r=k(t),i=e&&k(e),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a=function(t,e,n){var r,i;if(!t)return["C",e.x,e.y,e.x,e.y,e.x,e.y];switch(!(t[0]in{T:1,Q:1})&&(e.qx=e.qy=null),t[0]){case"M":e.X=t[1],e.Y=t[2];break;case"A":t=["C"].concat(z.apply(0,[e.x,e.y].concat(t.slice(1))));break;case"S":"C"==n||"S"==n?(r=2*e.x-e.bx,i=2*e.y-e.by):(r=e.x,i=e.y),t=["C",r,i].concat(t.slice(1));break;case"T":"Q"==n||"T"==n?(e.qx=2*e.x-e.qx,e.qy=2*e.y-e.qy):(e.qx=e.x,e.qy=e.y),t=["C"].concat(U(e.x,e.y,e.qx,e.qy,t[1],t[2]));break;case"Q":e.qx=t[1],e.qy=t[2],t=["C"].concat(U(e.x,e.y,t[1],t[2],t[3],t[4]));break;case"L":t=["C"].concat(G(e.x,e.y,t[1],t[2]));break;case"H":t=["C"].concat(G(e.x,e.y,t[1],e.y));break;case"V":t=["C"].concat(G(e.x,e.y,e.x,t[1]));break;case"Z":t=["C"].concat(G(e.x,e.y,e.X,e.Y))}return t},c=function(t,e){if(t[e].length>7){t[e].shift();for(var n=t[e];n.length;)h[e]="A",i&&(f[e]="A"),t.splice(e++,0,["C"].concat(n.splice(0,6)));t.splice(e,1),x=p(r.length,i&&i.length||0)}},l=function(t,e,n,o,s){t&&e&&"M"==t[s][0]&&"M"!=e[s][0]&&(e.splice(s,0,["M",o.x,o.y]),n.bx=0,n.by=0,n.x=t[s][1],n.y=t[s][2],x=p(r.length,i&&i.length||0))},h=[],f=[],d="",m="",v=0,x=p(r.length,i&&i.length||0);v<x;v++){r[v]&&(d=r[v][0]),"C"!=d&&(h[v]=d,v&&(m=h[v-1])),r[v]=a(r[v],o,m),"A"!=h[v]&&"C"==d&&(h[v]="C"),c(r,v),i&&(i[v]&&(d=i[v][0]),"C"!=d&&(f[v]=d,v&&(m=f[v-1])),i[v]=a(i[v],s,m),"A"!=f[v]&&"C"==d&&(f[v]="C"),c(i,v)),l(r,i,o,s,v),l(i,r,s,o,v);var b=r[v],_=i&&i[v],w=b.length,M=i&&_.length;o.x=b[w-2],o.y=b[w-1],o.bx=u(b[w-4])||o.x,o.by=u(b[w-3])||o.y,s.bx=i&&(u(_[M-4])||s.x),s.by=i&&(u(_[M-3])||s.y),s.x=i&&_[M-2],s.y=i&&_[M-1]}return i||(n.curve=y(r)),i?[r,i]:r}function j(t,e){for(var n=[],r=0,i=t.length;i-2*!e>r;r+=2){var o=[{x:+t[r-2],y:+t[r-1]},{x:+t[r],y:+t[r+1]},{x:+t[r+2],y:+t[r+3]},{x:+t[r+4],y:+t[r+5]}];e?r?i-4==r?o[3]={x:+t[0],y:+t[1]}:i-2==r&&(o[2]={x:+t[0],y:+t[1]},o[3]={x:+t[2],y:+t[3]}):o[0]={x:+t[i-2],y:+t[i-1]}:i-4==r?o[3]=o[2]:r||(o[0]={x:+t[r],y:+t[r+1]}),n.push(["C",(-o[0].x+6*o[1].x+o[2].x)/6,(-o[0].y+6*o[1].y+o[2].y)/6,(o[1].x+6*o[2].x-o[3].x)/6,(o[1].y+6*o[2].y-o[3].y)/6,o[2].x,o[2].y])}return n}t.path=g,t.path.getTotalLength=_,t.path.getPointAtLength=w,t.path.getSubpath=function(t,e,n){if(this.getTotalLength(t)-n<1e-6)return M(t,e).end;var r=M(t,n,1);return e?M(r,e).end:r},i.getTotalLength=function(){if(this.node.getTotalLength)return this.node.getTotalLength()},i.getPointAtLength=function(t){return w(this.attr("d"),t)},i.getSubpath=function(e,n){return t.path.getSubpath(this.attr("d"),e,n)},t._.box=m,t.path.findDotsAtSegment=E,t.path.bezierBBox=S,t.path.isPointInsideBBox=A,t.closest=function(e,n,r,i){for(var o=100,s=m(e-o/2,n-o/2,o,o),a=[],u=r[0].hasOwnProperty("x")?function(t){return{x:r[t].x,y:r[t].y}}:function(t){return{x:r[t],y:i[t]}},c=0;o<=1e6&&!c;){for(var l=0,h=r.length;l<h;l++){var p=u(l);if(A(s,p.x,p.y)){c++,a.push(p);break}}c||(s=m(e-(o*=2)/2,n-o/2,o,o))}if(1e6!=o){var f,d=1/0;for(l=0,h=a.length;l<h;l++){var g=t.len(e,n,a[l].x,a[l].y);d>g&&(d=g,a[l].len=g,f=a[l])}return f}},t.path.isBBoxIntersect=C,t.path.intersection=function(t,e){return R(t,e)},t.path.intersectionNumber=function(t,e){return R(t,e,1)},t.path.isPointInside=function(t,e,n){var r=O(t);return A(r,e,n)&&R(t,[["M",e,n],["H",r.x2+10]],1)%2==1},t.path.getBBox=O,t.path.get=N,t.path.toRelative=function(e){var n=g(e),r=String.prototype.toLowerCase;if(n.rel)return y(n.rel);t.is(e,"array")&&t.is(e&&e[0],"array")||(e=t.parsePathString(e));var i=[],o=0,s=0,a=0,u=0,c=0;"M"==e[0][0]&&(a=o=e[0][1],u=s=e[0][2],c++,i.push(["M",o,s]));for(var l=c,h=e.length;l<h;l++){var p=i[l]=[],f=e[l];if(f[0]!=r.call(f[0]))switch(p[0]=r.call(f[0]),p[0]){case"a":p[1]=f[1],p[2]=f[2],p[3]=f[3],p[4]=f[4],p[5]=f[5],p[6]=+(f[6]-o).toFixed(3),p[7]=+(f[7]-s).toFixed(3);break;case"v":p[1]=+(f[1]-s).toFixed(3);break;case"m":a=f[1],u=f[2];default:for(var d=1,m=f.length;d<m;d++)p[d]=+(f[d]-(d%2?o:s)).toFixed(3)}else{p=i[l]=[],"m"==f[0]&&(a=f[1]+o,u=f[2]+s);for(var x=0,b=f.length;x<b;x++)i[l][x]=f[x]}var _=i[l].length;switch(i[l][0]){case"z":o=a,s=u;break;case"h":o+=+i[l][_-1];break;case"v":s+=+i[l][_-1];break;default:o+=+i[l][_-2],s+=+i[l][_-1]}}return i.toString=v,n.rel=y(i),i},t.path.toAbsolute=k,t.path.toCubic=V,t.path.map=function(t,e){if(!e)return t;var n,r,i,o,s,a,u;for(i=0,s=(t=V(t)).length;i<s;i++)for(o=1,a=(u=t[i]).length;o<a;o+=2)n=e.x(u[o],u[o+1]),r=e.y(u[o],u[o+1]),u[o]=n,u[o+1]=r;return t},t.path.toString=v,t.path.clone=y})),r.plugin((function(t,r,i,o){var s=Math.max,a=Math.min,u=function(t){if(this.items=[],this.bindings={},this.length=0,this.type="set",t)for(var e=0,n=t.length;e<n;e++)t[e]&&(this[this.items.length]=this.items[this.items.length]=t[e],this.length++)},c=u.prototype;c.push=function(){for(var t,e,n=0,r=arguments.length;n<r;n++)(t=arguments[n])&&(this[e=this.items.length]=this.items[e]=t,this.length++);return this},c.pop=function(){return this.length&&delete this[this.length--],this.items.pop()},c.forEach=function(t,e){for(var n=0,r=this.items.length;n<r;n++)if(!1===t.call(e,this.items[n],n))return this;return this},c.animate=function(r,i,o,s){"function"!=typeof o||o.length||(s=o,o=n.linear),r instanceof t._.Animation&&(s=r.callback,o=r.easing,i=o.dur,r=r.attr);var a=arguments;if(t.is(r,"array")&&t.is(a[a.length-1],"array"))var u=!0;var c,l=function(){c?this.b=c:c=this.b},h=0,p=this,f=s&&function(){++h==p.length&&s.call(this)};return this.forEach((function(t,n){e.once("snap.animcreated."+t.id,l),u?a[n]&&t.animate.apply(t,a[n]):t.animate(r,i,o,f)}))},c.remove=function(){for(;this.length;)this.pop().remove();return this},c.bind=function(t,e,n){var r={};if("function"==typeof e)this.bindings[t]=e;else{var i=n||t;this.bindings[t]=function(t){r[i]=t,e.attr(r)}}return this},c.attr=function(t){var e={};for(var n in t)this.bindings[n]?this.bindings[n](t[n]):e[n]=t[n];for(var r=0,i=this.items.length;r<i;r++)this.items[r].attr(e);return this},c.clear=function(){for(;this.length;)this.pop()},c.splice=function(t,e,n){t=t<0?s(this.length+t,0):t,e=s(0,a(this.length-t,e));var r,i=[],o=[],c=[];for(r=2;r<arguments.length;r++)c.push(arguments[r]);for(r=0;r<e;r++)o.push(this[t+r]);for(;r<this.length-t;r++)i.push(this[t+r]);var l=c.length;for(r=0;r<l+i.length;r++)this.items[t+r]=this[t+r]=r<l?c[r]:i[r-l];for(r=this.items.length=this.length-=e-l;this[r];)delete this[r++];return new u(o)},c.exclude=function(t){for(var e=0,n=this.length;e<n;e++)if(this[e]==t)return this.splice(e,1),!0;return!1},c.insertAfter=function(t){for(var e=this.items.length;e--;)this.items[e].insertAfter(t);return this},c.getBBox=function(){for(var t=[],e=[],n=[],r=[],i=this.items.length;i--;)if(!this.items[i].removed){var o=this.items[i].getBBox();t.push(o.x),e.push(o.y),n.push(o.x+o.width),r.push(o.y+o.height)}return{x:t=a.apply(0,t),y:e=a.apply(0,e),x2:n=s.apply(0,n),y2:r=s.apply(0,r),width:n-t,height:r-e,cx:t+(n-t)/2,cy:e+(r-e)/2}},c.clone=function(t){t=new u;for(var e=0,n=this.items.length;e<n;e++)t.push(this.items[e].clone());return t},c.toString=function(){return"Snap‘s set"},c.type="set",t.Set=u,t.set=function(){var t=new u;return arguments.length&&t.push.apply(t,Array.prototype.slice.call(arguments,0)),t}})),r.plugin((function(t,n,r,i){var o={},s=/[%a-z]+$/i,a=String;function u(t){var e=t[0];switch(e.toLowerCase()){case"t":return[e,0,0];case"m":return[e,1,0,0,1,0,0];case"r":return 4==t.length?[e,0,t[2],t[3]]:[e,0];case"s":return 5==t.length?[e,1,1,t[3],t[4]]:3==t.length?[e,1,1]:[e,1]}}function c(t){return t}function l(t){return t.join(" ")}function h(e){return t.rgb(e[0],e[1],e[2],e[3])}function p(t){var e,n,r,i,o,s,a=0,u=[];for(e=0,n=t.length;e<n;e++){for(o="[",s=['"'+t[e][0]+'"'],r=1,i=t[e].length;r<i;r++)s[r]="val["+a+++"]";o+=s+"]",u[e]=o}return Function("val","return Snap.path.toString.call(["+u+"])")}function f(t){for(var e=[],n=0,r=t.length;n<r;n++)for(var i=1,o=t[n].length;i<o;i++)e.push(t[n][i]);return e}function d(t){return isFinite(t)}o.stroke=o.fill="colour",n.prototype.equal=function(t,n){return e("snap.util.equal",this,t,n).firstDefined()},e.on("snap.util.equal",(function(e,n){var r,i,g=a(this.attr(e)||""),m=this;if("colour"==o[e])return r=t.color(g),i=t.color(n),{from:[r.r,r.g,r.b,r.opacity],to:[i.r,i.g,i.b,i.opacity],f:h};if("viewBox"==e)return{from:r=this.attr(e).vb.split(" ").map(Number),to:i=n.split(" ").map(Number),f:l};if("transform"==e||"gradientTransform"==e||"patternTransform"==e)return"string"==typeof n&&(n=a(n).replace(/\.{3}|\u2026/g,g)),function(e,n,r){e=e||new t.Matrix,n=n||new t.Matrix,e=t.parseTransformString(e.toTransformString())||[],n=t.parseTransformString(n.toTransformString())||[];for(var i,o,s,a,c=Math.max(e.length,n.length),l=[],h=[],d=0;d<c;d++){if(s=e[d]||u(n[d]),a=n[d]||u(s),s[0]!=a[0]||"r"==s[0].toLowerCase()&&(s[2]!=a[2]||s[3]!=a[3])||"s"==s[0].toLowerCase()&&(s[3]!=a[3]||s[4]!=a[4])){e=t._.transform2matrix(e,r()),n=t._.transform2matrix(n,r()),l=[["m",e.a,e.b,e.c,e.d,e.e,e.f]],h=[["m",n.a,n.b,n.c,n.d,n.e,n.f]];break}for(l[d]=[],h[d]=[],i=0,o=Math.max(s.length,a.length);i<o;i++)i in s&&(l[d][i]=s[i]),i in a&&(h[d][i]=a[i])}return{from:f(l),to:f(h),f:p(l)}}(g=this.matrix,n=t._.rgTransform.test(n)?t._.transform2matrix(n,this.getBBox()):t._.transform2matrix(t._.svgTransform2string(n),this.getBBox()),(function(){return m.getBBox(1)}));if("d"==e||"path"==e)return{from:f((r=t.path.toCubic(g,n))[0]),to:f(r[1]),f:p(r[0])};if("points"==e)return{from:r=a(g).split(t._.separator),to:i=a(n).split(t._.separator),f:function(t){return t}};if(d(g)&&d(n))return{from:parseFloat(g),to:parseFloat(n),f:c};var v,y,x,b=g.match(s),_=a(n).match(s);return b&&(y=b,x=_,t.is(y,"array")&&t.is(x,"array")&&y.toString()==x.toString())?{from:parseFloat(g),to:parseFloat(n),f:(v=b,function(t){return+t.toFixed(3)+v})}:{from:this.asPX(e),to:this.asPX(e,n),f:c}}))})),r.plugin((function(t,n,r,i){for(var o=n.prototype,s=("createTouch"in i.doc),a=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","touchstart","touchmove","touchend","touchcancel"],u={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},c=function(t,e){var n="y"==t?"scrollTop":"scrollLeft",r=e&&e.node?e.node.ownerDocument:i.doc;return r[n in r.documentElement?"documentElement":"body"][n]},l=function(){return this.originalEvent.preventDefault()},h=function(){return this.originalEvent.stopPropagation()},p=function(t,e,n,r){var i=s&&u[e]?u[e]:e,o=function(i){var o=c("y",r),a=c("x",r);if(s&&u.hasOwnProperty(e))for(var p=0,f=i.targetTouches&&i.targetTouches.length;p<f;p++)if(i.targetTouches[p].target==t||t.contains(i.targetTouches[p].target)){var d=i;(i=i.targetTouches[p]).originalEvent=d,i.preventDefault=l,i.stopPropagation=h;break}var g=i.clientX+a,m=i.clientY+o;return n.call(r,i,g,m)};return e!==i&&t.addEventListener(e,o,!1),t.addEventListener(i,o,!1),function(){return e!==i&&t.removeEventListener(e,o,!1),t.removeEventListener(i,o,!1),!0}},f=[],d=function(t){for(var n,r=t.clientX,i=t.clientY,o=c("y"),a=c("x"),u=f.length;u--;){if(n=f[u],s){for(var l,h=t.touches&&t.touches.length;h--;)if((l=t.touches[h]).identifier==n.el._drag.id||n.el.node.contains(l.target)){r=l.clientX,i=l.clientY,(t.originalEvent?t.originalEvent:t).preventDefault();break}}else t.preventDefault();var p=n.el.node;p.nextSibling,p.parentNode,p.style.display;r+=a,i+=o,e("snap.drag.move."+n.el.id,n.move_scope||n.el,r-n.el._drag.x,i-n.el._drag.y,r,i,t)}},g=function(n){t.unmousemove(d).unmouseup(g);for(var r,i=f.length;i--;)(r=f[i]).el._drag={},e("snap.drag.end."+r.el.id,r.end_scope||r.start_scope||r.move_scope||r.el,n),e.off("snap.drag.*."+r.el.id);f=[]},m=a.length;m--;)!function(e){t[e]=o[e]=function(n,r){if(t.is(n,"function"))this.events=this.events||[],this.events.push({name:e,f:n,unbind:p(this.node||document,e,n,r||this)});else for(var i=0,o=this.events.length;i<o;i++)if(this.events[i].name==e)try{this.events[i].f.call(this)}catch(t){}return this},t["un"+e]=o["un"+e]=function(t){for(var n=this.events||[],r=n.length;r--;)if(n[r].name==e&&(n[r].f==t||!t))return n[r].unbind(),n.splice(r,1),!n.length&&delete this.events,this;return this}}(a[m]);o.hover=function(t,e,n,r){return this.mouseover(t,n).mouseout(e,r||n)},o.unhover=function(t,e){return this.unmouseover(t).unmouseout(e)};var v=[];o.drag=function(n,r,i,o,s,a){var u,c=this;if(!arguments.length)return c.drag((function(t,e){this.attr({transform:u+(u?"T":"t")+[t,e]})}),(function(){u=this.transform().local}));function l(u,l,h){(u.originalEvent||u).preventDefault(),c._drag.x=l,c._drag.y=h,c._drag.id=u.identifier,!f.length&&t.mousemove(d).mouseup(g),f.push({el:c,move_scope:o,start_scope:s,end_scope:a}),r&&e.on("snap.drag.start."+c.id,r),n&&e.on("snap.drag.move."+c.id,n),i&&e.on("snap.drag.end."+c.id,i),e("snap.drag.start."+c.id,s||o||c,l,h,u)}function h(t,n,r){e("snap.draginit."+c.id,c,t,n,r)}return e.on("snap.draginit."+c.id,l),c._drag={},v.push({el:c,start:l,init:h}),c.mousedown(h),c},o.undrag=function(){for(var n=v.length;n--;)v[n].el==this&&(this.unmousedown(v[n].init),v.splice(n,1),e.unbind("snap.drag.*."+this.id),e.unbind("snap.draginit."+this.id));return!v.length&&t.unmousemove(d).unmouseup(g),this}})),r.plugin((function(t,n,r,i){n.prototype;var o=r.prototype,s=/^\s*url\((.+)\)/,a=String,u=t._.$;t.filter={},o.filter=function(e){var r=this;"svg"!=r.type&&(r=r.paper);var i=t.parse(a(e)),o=t._.id(),s=(r.node.offsetWidth,r.node.offsetHeight,u("filter"));return u(s,{id:o,filterUnits:"userSpaceOnUse"}),s.appendChild(i.node),r.defs.appendChild(s),new n(s)},e.on("snap.util.getattr.filter",(function(){e.stop();var n=u(this.node,"filter");if(n){var r=a(n).match(s);return r&&t.select(r[1])}})),e.on("snap.util.attr.filter",(function(r){if(r instanceof n&&"filter"==r.type){e.stop();var i=r.node.id;i||(u(r.node,{id:r.id}),i=r.id),u(this.node,{filter:t.url(i)})}r&&"none"!=r||(e.stop(),this.node.removeAttribute("filter"))})),t.filter.blur=function(e,n){null==e&&(e=2);var r=null==n?e:[e,n];return t.format('<feGaussianBlur stdDeviation="{def}"/>',{def:r})},t.filter.blur.toString=function(){return this()},t.filter.shadow=function(e,n,r,i,o){return null==o&&(null==i?(o=r,r=4,i="#000"):(o=i,i=r,r=4)),null==r&&(r=4),null==o&&(o=1),null==e&&(e=0,n=2),null==n&&(n=e),i=t.color(i),t.format('<feGaussianBlur in="SourceAlpha" stdDeviation="{blur}"/><feOffset dx="{dx}" dy="{dy}" result="offsetblur"/><feFlood flood-color="{color}"/><feComposite in2="offsetblur" operator="in"/><feComponentTransfer><feFuncA type="linear" slope="{opacity}"/></feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge>',{color:i,dx:e,dy:n,blur:r,opacity:o})},t.filter.shadow.toString=function(){return this()},t.filter.grayscale=function(e){return null==e&&(e=1),t.format('<feColorMatrix type="matrix" values="{a} {b} {c} 0 0 {d} {e} {f} 0 0 {g} {b} {h} 0 0 0 0 0 1 0"/>',{a:.2126+.7874*(1-e),b:.7152-.7152*(1-e),c:.0722-.0722*(1-e),d:.2126-.2126*(1-e),e:.7152+.2848*(1-e),f:.0722-.0722*(1-e),g:.2126-.2126*(1-e),h:.0722+.9278*(1-e)})},t.filter.grayscale.toString=function(){return this()},t.filter.sepia=function(e){return null==e&&(e=1),t.format('<feColorMatrix type="matrix" values="{a} {b} {c} 0 0 {d} {e} {f} 0 0 {g} {h} {i} 0 0 0 0 0 1 0"/>',{a:.393+.607*(1-e),b:.769-.769*(1-e),c:.189-.189*(1-e),d:.349-.349*(1-e),e:.686+.314*(1-e),f:.168-.168*(1-e),g:.272-.272*(1-e),h:.534-.534*(1-e),i:.131+.869*(1-e)})},t.filter.sepia.toString=function(){return this()},t.filter.saturate=function(e){return null==e&&(e=1),t.format('<feColorMatrix type="saturate" values="{amount}"/>',{amount:1-e})},t.filter.saturate.toString=function(){return this()},t.filter.hueRotate=function(e){return e=e||0,t.format('<feColorMatrix type="hueRotate" values="{angle}"/>',{angle:e})},t.filter.hueRotate.toString=function(){return this()},t.filter.invert=function(e){return null==e&&(e=1),t.format('<feComponentTransfer><feFuncR type="table" tableValues="{amount} {amount2}"/><feFuncG type="table" tableValues="{amount} {amount2}"/><feFuncB type="table" tableValues="{amount} {amount2}"/></feComponentTransfer>',{amount:e,amount2:1-e})},t.filter.invert.toString=function(){return this()},t.filter.brightness=function(e){return null==e&&(e=1),t.format('<feComponentTransfer><feFuncR type="linear" slope="{amount}"/><feFuncG type="linear" slope="{amount}"/><feFuncB type="linear" slope="{amount}"/></feComponentTransfer>',{amount:e})},t.filter.brightness.toString=function(){return this()},t.filter.contrast=function(e){return null==e&&(e=1),t.format('<feComponentTransfer><feFuncR type="linear" slope="{amount}" intercept="{amount2}"/><feFuncG type="linear" slope="{amount}" intercept="{amount2}"/><feFuncB type="linear" slope="{amount}" intercept="{amount2}"/></feComponentTransfer>',{amount:e,amount2:.5-e/2})},t.filter.contrast.toString=function(){return this()}})),r.plugin((function(t,e,n,r,i){var o=t._.box,s=t.is,a=/^[^a-z]*([tbmlrc])/i,u=function(){return"T"+this.dx+","+this.dy};e.prototype.getAlign=function(t,e){null==e&&s(t,"string")&&(e=t,t=null);var n=(t=t||this.paper).getBBox?t.getBBox():o(t),r=this.getBBox(),i={};switch(e=(e=e&&e.match(a))?e[1].toLowerCase():"c"){case"t":i.dx=0,i.dy=n.y-r.y;break;case"b":i.dx=0,i.dy=n.y2-r.y2;break;case"m":i.dx=0,i.dy=n.cy-r.cy;break;case"l":i.dx=n.x-r.x,i.dy=0;break;case"r":i.dx=n.x2-r.x2,i.dy=0;break;default:i.dx=n.cx-r.cx,i.dy=0}return i.toString=u,i},e.prototype.align=function(t,e){return this.transform("..."+this.getAlign(t,e))}})),r.plugin((function(e,n,r,i){function o(t){t=t.split(/(?=#)/);var e=new String(t[5]);return e[50]=t[0],e[100]=t[1],e[200]=t[2],e[300]=t[3],e[400]=t[4],e[500]=t[5],e[600]=t[6],e[700]=t[7],e[800]=t[8],e[900]=t[9],t[10]&&(e.A100=t[10],e.A200=t[11],e.A400=t[12],e.A700=t[13]),e}e.mui={},e.flat={},e.mui.red=o("#ffebee#ffcdd2#ef9a9a#e57373#ef5350#f44336#e53935#d32f2f#c62828#b71c1c#ff8a80#ff5252#ff1744#d50000"),e.mui.pink=o("#FCE4EC#F8BBD0#F48FB1#F06292#EC407A#E91E63#D81B60#C2185B#AD1457#880E4F#FF80AB#FF4081#F50057#C51162"),e.mui.purple=o("#F3E5F5#E1BEE7#CE93D8#BA68C8#AB47BC#9C27B0#8E24AA#7B1FA2#6A1B9A#4A148C#EA80FC#E040FB#D500F9#AA00FF"),e.mui.deeppurple=o("#EDE7F6#D1C4E9#B39DDB#9575CD#7E57C2#673AB7#5E35B1#512DA8#4527A0#311B92#B388FF#7C4DFF#651FFF#6200EA"),e.mui.indigo=o("#E8EAF6#C5CAE9#9FA8DA#7986CB#5C6BC0#3F51B5#3949AB#303F9F#283593#1A237E#8C9EFF#536DFE#3D5AFE#304FFE"),e.mui.blue=o("#E3F2FD#BBDEFB#90CAF9#64B5F6#64B5F6#2196F3#1E88E5#1976D2#1565C0#0D47A1#82B1FF#448AFF#2979FF#2962FF"),e.mui.lightblue=o("#E1F5FE#B3E5FC#81D4FA#4FC3F7#29B6F6#03A9F4#039BE5#0288D1#0277BD#01579B#80D8FF#40C4FF#00B0FF#0091EA"),e.mui.cyan=o("#E0F7FA#B2EBF2#80DEEA#4DD0E1#26C6DA#00BCD4#00ACC1#0097A7#00838F#006064#84FFFF#18FFFF#00E5FF#00B8D4"),e.mui.teal=o("#E0F2F1#B2DFDB#80CBC4#4DB6AC#26A69A#009688#00897B#00796B#00695C#004D40#A7FFEB#64FFDA#1DE9B6#00BFA5"),e.mui.green=o("#E8F5E9#C8E6C9#A5D6A7#81C784#66BB6A#4CAF50#43A047#388E3C#2E7D32#1B5E20#B9F6CA#69F0AE#00E676#00C853"),e.mui.lightgreen=o("#F1F8E9#DCEDC8#C5E1A5#AED581#9CCC65#8BC34A#7CB342#689F38#558B2F#33691E#CCFF90#B2FF59#76FF03#64DD17"),e.mui.lime=o("#F9FBE7#F0F4C3#E6EE9C#DCE775#D4E157#CDDC39#C0CA33#AFB42B#9E9D24#827717#F4FF81#EEFF41#C6FF00#AEEA00"),e.mui.yellow=o("#FFFDE7#FFF9C4#FFF59D#FFF176#FFEE58#FFEB3B#FDD835#FBC02D#F9A825#F57F17#FFFF8D#FFFF00#FFEA00#FFD600"),e.mui.amber=o("#FFF8E1#FFECB3#FFE082#FFD54F#FFCA28#FFC107#FFB300#FFA000#FF8F00#FF6F00#FFE57F#FFD740#FFC400#FFAB00"),e.mui.orange=o("#FFF3E0#FFE0B2#FFCC80#FFB74D#FFA726#FF9800#FB8C00#F57C00#EF6C00#E65100#FFD180#FFAB40#FF9100#FF6D00"),e.mui.deeporange=o("#FBE9E7#FFCCBC#FFAB91#FF8A65#FF7043#FF5722#F4511E#E64A19#D84315#BF360C#FF9E80#FF6E40#FF3D00#DD2C00"),e.mui.brown=o("#EFEBE9#D7CCC8#BCAAA4#A1887F#8D6E63#795548#6D4C41#5D4037#4E342E#3E2723"),e.mui.grey=o("#FAFAFA#F5F5F5#EEEEEE#E0E0E0#BDBDBD#9E9E9E#757575#616161#424242#212121"),e.mui.bluegrey=o("#ECEFF1#CFD8DC#B0BEC5#90A4AE#78909C#607D8B#546E7A#455A64#37474F#263238"),e.flat.turquoise="#1abc9c",e.flat.greensea="#16a085",e.flat.sunflower="#f1c40f",e.flat.orange="#f39c12",e.flat.emerland="#2ecc71",e.flat.nephritis="#27ae60",e.flat.carrot="#e67e22",e.flat.pumpkin="#d35400",e.flat.peterriver="#3498db",e.flat.belizehole="#2980b9",e.flat.alizarin="#e74c3c",e.flat.pomegranate="#c0392b",e.flat.amethyst="#9b59b6",e.flat.wisteria="#8e44ad",e.flat.clouds="#ecf0f1",e.flat.silver="#bdc3c7",e.flat.wetasphalt="#34495e",e.flat.midnightblue="#2c3e50",e.flat.concrete="#95a5a6",e.flat.asbestos="#7f8c8d",e.importMUIColors=function(){for(var n in e.mui)e.mui.hasOwnProperty(n)&&(t[n]=e.mui[n])}})),r}(n,t)}.apply(e,[r]))||(t.exports=i)}(window||this)},F4ds:function(t,e,n){"use strict";var r=n("hh1v");t.exports=function(t){return r(t)||null===t}},F8JR:function(t,e,n){"use strict";var r=n("tycR").forEach,i=n("pkCn")("forEach");t.exports=i?[].forEach:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}},FF6l:function(t,e,n){"use strict";var r=n("ewvW"),i=n("I8vh"),o=n("B/qT"),s=n("CDr4"),a=Math.min;t.exports=[].copyWithin||function(t,e){var n=r(this),u=o(n),c=i(t,u),l=i(e,u),h=arguments.length>2?arguments[2]:void 0,p=a((void 0===h?u:i(h,u))-l,u-c),f=1;for(l<c&&c<l+p&&(f=-1,l+=p-1,c+=p-1);p-- >0;)l in n?n[c]=n[l]:s(n,c),c+=f,l+=f;return n}},FOUG:function(t,e,n){"use strict";var r=n("I+eb"),i=n("xluM"),o=n("We1y"),s=n("8GlL"),a=n("5mdu"),u=n("ImZN");r({target:"Promise",stat:!0,forced:n("Xu1c")},{all:function(t){var e=this,n=s.f(e),r=n.resolve,c=n.reject,l=a((function(){var n=o(e.resolve),s=[],a=0,l=1;u(t,(function(t){var o=a++,u=!1;l++,i(n,e,t).then((function(t){u||(u=!0,s[o]=t,--l||r(s))}),c)})),--l||r(s)}));return l.error&&c(l.value),n.promise}})},FXpK:function(t,e,n){"use strict";var r=n("z+kr"),i=n("g6v/"),o=Object.getOwnPropertyDescriptor;t.exports=function(t){if(!i)return r[t];var e=o(r,t);return e&&e.value}},FZtP:function(t,e,n){"use strict";var r=n("z+kr"),i=n("/byt"),o=n("eFrH"),s=n("F8JR"),a=n("kRJp"),u=function(t){if(t&&t.forEach!==s)try{a(t,"forEach",s)}catch(e){t.forEach=s}};for(var c in i)i[c]&&u(r[c]&&r[c].prototype);u(o)},Fib7:function(t,e,n){"use strict";var r="object"==typeof document&&document.all;t.exports=void 0===r&&void 0!==r?function(t){return"function"==typeof t||t===r}:function(t){return"function"==typeof t}},"Fwt+":function(t,e,n){"use strict";var r=n("67WC"),i=n("UMSQ"),o=n("I8vh"),s=r.aTypedArray,a=r.getTypedArrayConstructor;(0,r.exportTypedArrayMethod)("subarray",(function(t,e){var n=s(this),r=n.length,u=o(t,r);return new(a(n))(n.buffer,n.byteOffset+u*n.BYTES_PER_ELEMENT,i((void 0===e?r:o(e,r))-u))}))},"G+Rx":function(t,e,n){"use strict";var r=n("0GbY");t.exports=r("document","documentElement")},"G9h+":function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("8LQ0"),a=n("9wk+"),u=n("RUZL"),c=n("13ei"),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype._sceneFunc=function(e){t.prototype._sceneFunc.call(this,e);var n=2*Math.PI,r=this.points(),i=r,o=0!==this.tension()&&r.length>4;o&&(i=this.getTensionPoints());var s,a,u=r.length;o?(s=r[u-2]-(i[i.length-2]+i[i.length-4])/2,a=r[u-1]-(i[i.length-1]+i[i.length-3])/2):(s=r[u-2]-r[u-4],a=r[u-1]-r[u-3]);var c=(Math.atan2(a,s)+n)%n,l=this.pointerLength(),h=this.pointerWidth();e.save(),e.beginPath(),e.translate(r[u-2],r[u-1]),e.rotate(c),e.moveTo(0,0),e.lineTo(-l,h/2),e.lineTo(-l,-h/2),e.closePath(),e.restore(),this.pointerAtBeginning()&&(e.save(),e.translate(r[0],r[1]),o?(s=(i[0]+i[2])/2-r[0],a=(i[1]+i[3])/2-r[1]):(s=r[2]-r[0],a=r[3]-r[1]),e.rotate((Math.atan2(-a,-s)+n)%n),e.moveTo(0,0),e.lineTo(-l,h/2),e.lineTo(-l,-h/2),e.closePath(),e.restore());var p=this.dashEnabled();p&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),p&&(this.attrs.dashEnabled=!0)},e.prototype.getSelfRect=function(){var e=t.prototype.getSelfRect.call(this),n=this.pointerWidth()/2;return{x:e.x-n,y:e.y-n,width:e.width+2*n,height:e.height+2*n}},e}(a.Line);e.Arrow=l,l.prototype.className="Arrow",c._registerNode(l),s.Factory.addGetterSetter(l,"pointerLength",10,u.getNumberValidator()),s.Factory.addGetterSetter(l,"pointerWidth",10,u.getNumberValidator()),s.Factory.addGetterSetter(l,"pointerAtBeginning",!1),o.Collection.mapMethods(l)},GC2F:function(t,e,n){"use strict";var r=n("+M1K"),i=RangeError;t.exports=function(t,e){var n=r(t);if(n%e)throw new i("Wrong offset");return n}},GarU:function(t,e,n){"use strict";var r=n("OpvP"),i=TypeError;t.exports=function(t,e){if(r(e,t))return t;throw new i("Incorrect invocation")}},Gi26:function(t,e,n){"use strict";var r=n("4zBA"),i=n("ewvW"),o=r({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return o(i(t),e)}},GrlX:function(t,e,n){var r=n("T016"),i=n("JRS9"),o=Object.hasOwnProperty,s=Object.create(null);for(var a in r)o.call(r,a)&&(s[r[a]]=a);var u=t.exports={to:{},get:{}};function c(t,e,n){return Math.min(Math.max(e,t),n)}function l(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}u.get=function(t){var e,n;switch(t.substring(0,3).toLowerCase()){case"hsl":e=u.get.hsl(t),n="hsl";break;case"hwb":e=u.get.hwb(t),n="hwb";break;default:e=u.get.rgb(t),n="rgb"}return e?{model:n,value:e}:null},u.get.rgb=function(t){if(!t)return null;var e,n,i,s=[0,0,0,1];if(e=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(i=e[2],e=e[1],n=0;n<3;n++){var a=2*n;s[n]=parseInt(e.slice(a,a+2),16)}i&&(s[3]=parseInt(i,16)/255)}else if(e=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=(e=e[1])[3],n=0;n<3;n++)s[n]=parseInt(e[n]+e[n],16);i&&(s[3]=parseInt(i+i,16)/255)}else if(e=t.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(n=0;n<3;n++)s[n]=parseInt(e[n+1],0);e[4]&&(e[5]?s[3]=.01*parseFloat(e[4]):s[3]=parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(e=t.match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:o.call(r,e[1])?((s=r[e[1]])[3]=1,s):null:null;for(n=0;n<3;n++)s[n]=Math.round(2.55*parseFloat(e[n+1]));e[4]&&(e[5]?s[3]=.01*parseFloat(e[4]):s[3]=parseFloat(e[4]))}for(n=0;n<3;n++)s[n]=c(s[n],0,255);return s[3]=c(s[3],0,1),s},u.get.hsl=function(t){if(!t)return null;var e=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,c(parseFloat(e[2]),0,100),c(parseFloat(e[3]),0,100),c(isNaN(n)?1:n,0,1)]}return null},u.get.hwb=function(t){if(!t)return null;var e=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,c(parseFloat(e[2]),0,100),c(parseFloat(e[3]),0,100),c(isNaN(n)?1:n,0,1)]}return null},u.to.hex=function(){var t=i(arguments);return"#"+l(t[0])+l(t[1])+l(t[2])+(t[3]<1?l(Math.round(255*t[3])):"")},u.to.rgb=function(){var t=i(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},u.to.rgb.percent=function(){var t=i(arguments),e=Math.round(t[0]/255*100),n=Math.round(t[1]/255*100),r=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+n+"%, "+r+"%)":"rgba("+e+"%, "+n+"%, "+r+"%, "+t[3]+")"},u.to.hsl=function(){var t=i(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},u.to.hwb=function(){var t=i(arguments),e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},u.to.keyword=function(t){return s[t.slice(0,3)]}},GuuD:function(t,e){t.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}},HEmn:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("8LQ0"),i=n("SXH2"),o=n("nLhi"),s=n("RUZL");e.Kaleidoscope=function(t){var e,n,r,i,s,a,u,c,l,h=t.width,p=t.height,f=Math.round(this.kaleidoscopePower()),d=Math.round(this.kaleidoscopeAngle()),g=Math.floor(h*(d%360)/360);if(!(f<1)){var m=o.Util.createCanvasElement();m.width=h,m.height=p;var v=m.getContext("2d").getImageData(0,0,h,p);!function(t,e,n){var r,i,o,s,a=t.data,u=e.data,c=t.width,l=t.height,h=n.polarCenterX||c/2,p=n.polarCenterY||l/2,f=0,d=0,g=0,m=0,v=Math.sqrt(h*h+p*p);i=c-h,o=l-p,v=(s=Math.sqrt(i*i+o*o))>v?s:v;var y,x,b,_,w=l,M=c,E=360/M*Math.PI/180;for(x=0;x<M;x+=1)for(b=Math.sin(x*E),_=Math.cos(x*E),y=0;y<w;y+=1)i=Math.floor(h+v*y/w*_),f=a[(r=4*((o=Math.floor(p+v*y/w*b))*c+i))+0],d=a[r+1],g=a[r+2],m=a[r+3],u[(r=4*(x+y*c))+0]=f,u[r+1]=d,u[r+2]=g,u[r+3]=m}(t,v,{polarCenterX:h/2,polarCenterY:p/2});for(var y=h/Math.pow(2,f);y<=8;)y*=2,f-=1;var x=y=Math.ceil(y),b=0,_=x,w=1;for(g+y>h&&(b=x,_=0,w=-1),n=0;n<p;n+=1)for(e=b;e!==_;e+=w)c=4*(h*n+Math.round(e+g)%h),i=v.data[c+0],s=v.data[c+1],a=v.data[c+2],u=v.data[c+3],l=4*(h*n+e),v.data[l+0]=i,v.data[l+1]=s,v.data[l+2]=a,v.data[l+3]=u;for(n=0;n<p;n+=1)for(x=Math.floor(y),r=0;r<f;r+=1){for(e=0;e<x+1;e+=1)c=4*(h*n+e),i=v.data[c+0],s=v.data[c+1],a=v.data[c+2],u=v.data[c+3],l=4*(h*n+2*x-e-1),v.data[l+0]=i,v.data[l+1]=s,v.data[l+2]=a,v.data[l+3]=u;x*=2}!function(t,e,n){var r,i,o,s,a,u,c=t.data,l=e.data,h=t.width,p=t.height,f=n.polarCenterX||h/2,d=n.polarCenterY||p/2,g=0,m=0,v=0,y=0,x=Math.sqrt(f*f+d*d);i=h-f,o=p-d,x=(u=Math.sqrt(i*i+o*o))>x?u:x;var b,_,w,M=p,E=h,S=n.polarRotation||0;for(i=0;i<h;i+=1)for(o=0;o<p;o+=1)s=i-f,a=o-d,b=Math.sqrt(s*s+a*a)*M/x,_=(_=(180*Math.atan2(a,s)/Math.PI+360+S)%360)*E/360,w=Math.floor(_),g=c[(r=4*(Math.floor(b)*h+w))+0],m=c[r+1],v=c[r+2],y=c[r+3],l[(r=4*(o*h+i))+0]=g,l[r+1]=m,l[r+2]=v,l[r+3]=y}(v,t,{polarRotation:0})}},r.Factory.addGetterSetter(i.Node,"kaleidoscopePower",2,s.getNumberValidator(),r.Factory.afterSetFilter),r.Factory.addGetterSetter(i.Node,"kaleidoscopeAngle",0,s.getNumberValidator(),r.Factory.afterSetFilter)},HFnK:function(t,e,n){"use strict";n("bWFh")("Set",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),n("ZWaQ"))},HH4o:function(t,e,n){"use strict";var r=n("tiKp")("iterator"),i=!1;try{var o=0,s={next:function(){return{done:!!o++}},return:function(){i=!0}};s[r]=function(){return this},Array.from(s,(function(){throw 2}))}catch(t){}t.exports=function(t,e){try{if(!e&&!i)return!1}catch(t){return!1}var n=!1;try{var o={};o[r]=function(){return{next:function(){return{done:n=!0}}}},t(o)}catch(t){}return n}},HSsa:function(t,e,n){"use strict";t.exports=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return t.apply(e,n)}}},HVe1:function(t,e,n){"use strict";var r=n("I+eb"),i=n("z+kr"),o=n("IMxJ")(i.setTimeout,!0);r({global:!0,bind:!0,forced:i.setTimeout!==o},{setTimeout:o})},HYAF:function(t,e,n){"use strict";var r=n("cjT7"),i=TypeError;t.exports=function(t){if(r(t))throw new i("Can't call method on "+t);return t}},Hd5f:function(t,e,n){"use strict";var r=n("0Dky"),i=n("tiKp"),o=n("EhIz"),s=i("species");t.exports=function(t){return o>=51||!r((function(){var e=[];return(e.constructor={})[s]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}},HyF4:function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("8LQ0"),a=n("/OYL"),u=n("RUZL"),c=n("13ei"),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype._sceneFunc=function(t){t.beginPath(),t.arc(0,0,this.radius(),0,2*Math.PI,!1),t.closePath(),t.fillStrokeShape(this)},e.prototype.getWidth=function(){return 2*this.radius()},e.prototype.getHeight=function(){return 2*this.radius()},e.prototype.setWidth=function(t){this.radius()!==t/2&&this.radius(t/2)},e.prototype.setHeight=function(t){this.radius()!==t/2&&this.radius(t/2)},e}(a.Shape);e.Circle=l,l.prototype._centroid=!0,l.prototype.className="Circle",l.prototype._attrsAffectingSize=["radius"],c._registerNode(l),s.Factory.addGetterSetter(l,"radius",0,u.getNumberValidator()),o.Collection.mapMethods(l)},"I+eb":function(t,e,n){"use strict";var r=n("z+kr"),i=n("Bs8V").f,o=n("kRJp"),s=n("yy0I"),a=n("Y3Q8"),u=n("6JNq"),c=n("lMq5");t.exports=function(t,e){var n,l,h,p,f,d=t.target,g=t.global,m=t.stat;if(n=g?r:m?r[d]||a(d,{}):r[d]&&r[d].prototype)for(l in e){if(p=e[l],h=t.dontCallGetSet?(f=i(n,l))&&f.value:n[l],!c(g?l:d+(m?".":"#")+l,t.forced)&&void 0!==h){if(typeof p==typeof h)continue;u(p,h)}(t.sham||h&&h.sham)&&o(p,"sham",!0),s(n,l,p,t)}}},I8vh:function(t,e,n){"use strict";var r=n("WSbT"),i=Math.max,o=Math.min;t.exports=function(t,e){var n=r(t);return n<0?i(n+e,0):o(n,e)}},I9xj:function(t,e,n){"use strict";n("1E5z")(Math,"Math",!0)},IBMq:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("8LQ0"),i=n("SXH2"),o=n("RUZL");e.Posterize=function(t){var e,n=Math.round(254*this.levels())+1,r=t.data,i=r.length,o=255/n;for(e=0;e<i;e+=1)r[e]=Math.floor(r[e]/o)*o},r.Factory.addGetterSetter(i.Node,"levels",.5,o.getNumberValidator(),r.Factory.afterSetFilter)},IMxJ:function(t,e,n){"use strict";var r,i=n("z+kr"),o=n("K6Rb"),s=n("Fib7"),a=n("hVj3"),u=n("tdvT"),c=n("82ph"),l=n("1tal"),h=i.Function,p=/MSIE .\./.test(u)||"BUN"===a&&((r=i.Bun.version.split(".")).length<3||"0"===r[0]&&(r[1]<3||"3"===r[1]&&"0"===r[2]));t.exports=function(t,e){var n=e?2:1;return p?function(r,i){var a=l(arguments.length,1)>n,u=s(r)?r:h(r),p=a?c(arguments,n):[],f=a?function(){o(u,this,p)}:u;return e?t(f,i):t(f)}:t}},IZzc:function(t,e,n){"use strict";var r=n("z+kr"),i=n("RiVN"),o=n("0Dky"),s=n("We1y"),a=n("rdv8"),u=n("67WC"),c=n("P34a"),l=n("mfQh"),h=n("EhIz"),p=n("6oOd"),f=u.aTypedArray,d=u.exportTypedArrayMethod,g=r.Uint16Array,m=g&&i(g.prototype.sort),v=!(!m||o((function(){m(new g(2),null)}))&&o((function(){m(new g(2),{})}))),y=!!m&&!o((function(){if(h)return h<74;if(c)return c<67;if(l)return!0;if(p)return p<602;var t,e,n=new g(516),r=Array(516);for(t=0;t<516;t++)e=t%4,n[t]=515-t,r[t]=t-2*e+3;for(m(n,(function(t,e){return(t/4|0)-(e/4|0)})),t=0;t<516;t++)if(n[t]!==r[t])return!0}));d("sort",(function(t){return void 0!==t&&s(t),y?m(this,t):a(f(this),function(t){return function(e,n){return void 0!==t?+t(e,n)||0:n!=n?-1:e!=e?1:0===e&&0===n?1/e>0&&1/n<0?1:-1:e>n}}(t))}),!y||v)},ImZN:function(t,e,n){"use strict";var r=n("A2ZE"),i=n("xluM"),o=n("glrk"),s=n("DVFp"),a=n("6VoE"),u=n("B/qT"),c=n("OpvP"),l=n("mh/w"),h=n("NaFW"),p=n("KmKo"),f=TypeError,d=function(t,e){this.stopped=t,this.result=e},g=d.prototype;t.exports=function(t,e,n){var m,v,y,x,b,_,w,M=n&&n.that,E=!(!n||!n.AS_ENTRIES),S=!(!n||!n.IS_RECORD),A=!(!n||!n.IS_ITERATOR),C=!(!n||!n.INTERRUPTED),T=r(e,M),P=function(t){return m&&p(m,"normal",t),new d(!0,t)},I=function(t){return E?(o(t),C?T(t[0],t[1],P):T(t[0],t[1])):C?T(t,P):T(t)};if(S)m=t.iterator;else if(A)m=t;else{if(!(v=h(t)))throw new f(s(t)+" is not iterable");if(a(v)){for(y=0,x=u(t);x>y;y++)if((b=I(t[y]))&&c(g,b))return b;return new d(!1)}m=l(t,v)}for(_=S?t.next:m.next;!(w=i(_,m)).done;){try{b=I(w.value)}catch(t){p(m,"throw",t)}if("object"==typeof b&&b&&c(g,b))return b}return new d(!1)}},Ipqb:function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("8LQ0"),a=n("/OYL"),u=n("RUZL"),c=n("13ei"),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype._useBufferCanvas=function(){return!(!this.hasShadow()&&1===this.getAbsoluteOpacity()||!this.hasStroke()||!this.getStage())},e.prototype._sceneFunc=function(t){var e,n,r,i=this.width(),o=this.height(),s=this.image();s&&(e=this.cropWidth(),n=this.cropHeight(),r=e&&n?[s,this.cropX(),this.cropY(),e,n,0,0,i,o]:[s,0,0,i,o]),(this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,i,o),t.closePath(),t.fillStrokeShape(this)),s&&t.drawImage.apply(t,r)},e.prototype._hitFunc=function(t){var e=this.width(),n=this.height();t.beginPath(),t.rect(0,0,e,n),t.closePath(),t.fillStrokeShape(this)},e.prototype.getWidth=function(){var t,e=this.image();return null!=(t=this.attrs.width)?t:e?e.width:0},e.prototype.getHeight=function(){var t,e=this.image();return null!=(t=this.attrs.height)?t:e?e.height:0},e.fromURL=function(t,n){var r=o.Util.createImageElement();r.onload=function(){var t=new e({image:r});n(t)},r.crossOrigin="Anonymous",r.src=t},e}(a.Shape);e.Image=l,l.prototype.className="Image",c._registerNode(l),s.Factory.addGetterSetter(l,"image"),s.Factory.addComponentsGetterSetter(l,"crop",["x","y","width","height"]),s.Factory.addGetterSetter(l,"cropX",0,u.getNumberValidator()),s.Factory.addGetterSetter(l,"cropY",0,u.getNumberValidator()),s.Factory.addGetterSetter(l,"cropWidth",0,u.getNumberValidator()),s.Factory.addGetterSetter(l,"cropHeight",0,u.getNumberValidator()),o.Collection.mapMethods(l)},IrXD:function(t,e,n){"use strict";(function(t){var n,r={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-r.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*r.Bounce.In(2*t):.5*r.Bounce.Out(2*t-1)+.5}}},i="undefined"==typeof self&&void 0!==t&&t.hrtime?function(){var e=t.hrtime();return 1e3*e[0]+e[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()},o=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=i()),void 0===e&&(e=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var o=this._tweens[n[r]],s=!e;o&&!1===o.update(t,s)&&!e&&delete this._tweens[n[r]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},t}(),s={Linear:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=s.Utils.Linear;return e<0?o(t[0],t[1],r):e>1?o(t[n],t[n-1],n-r):o(t[i],t[i+1>n?n:i+1],r-i)},Bezier:function(t,e){for(var n=0,r=t.length-1,i=Math.pow,o=s.Utils.Bernstein,a=0;a<=r;a++)n+=i(1-e,r-a)*i(e,a)*t[a]*o(r,a);return n},CatmullRom:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=s.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(i=Math.floor(r=n*(1+e))),o(t[(i-1+n)%n],t[i],t[(i+1)%n],t[(i+2)%n],r-i)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-r)-t[0]):e>1?t[n]-(o(t[n],t[n],t[n-1],t[n-1],r-n)-t[n]):o(t[i?i-1:0],t[i],t[n<i+1?n:i+1],t[n<i+2?n:i+2],r-i)},Utils:{Linear:function(t,e,n){return(e-t)*n+t},Bernstein:function(t,e){var n=s.Utils.Factorial;return n(t)/n(e)/n(t-e)},Factorial:(n=[1],function(t){var e=1;if(n[t])return n[t];for(var r=t;r>1;r--)e*=r;return n[t]=e,e}),CatmullRom:function(t,e,n,r,i){var o=.5*(n-t),s=.5*(r-e),a=i*i;return(2*e-2*n+o+s)*(i*a)+(-3*e+3*n-2*o-s)*a+o*i+e}}},a=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),u=new o,c=function(){function t(t,e){void 0===e&&(e=u),this._object=t,this._group=e,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=r.Linear.None,this._interpolationFunction=s.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=a.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.to=function(t,e){return this._valuesEnd=Object.create(t),void 0!==e&&(this._duration=e),this},t.prototype.duration=function(t){return this._duration=t,this},t.prototype.start=function(t){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var e in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(e),this._valuesStart[e]=this._valuesStartRepeat[e];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==t?"string"==typeof t?i()+parseFloat(t):t:i(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},t.prototype._setupProperties=function(t,e,n,r){for(var i in n){var o=t[i],s=Array.isArray(o),a=s?"array":typeof o,u=!s&&Array.isArray(n[i]);if("undefined"!==a&&"function"!==a){if(u){var c=n[i];if(0===c.length)continue;c=c.map(this._handleRelativeValue.bind(this,o)),n[i]=[o].concat(c)}if("object"!==a&&!s||!o||u)void 0===e[i]&&(e[i]=o),s||(e[i]*=1),r[i]=u?n[i].slice().reverse():e[i]||0;else{for(var l in e[i]=s?[]:{},o)e[i][l]=o[l];r[i]=s?[]:{},this._setupProperties(o,e[i],n[i],r[i])}}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},t.prototype.pause=function(t){return void 0===t&&(t=i()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this)),this},t.prototype.resume=function(t){return void 0===t&&(t=i()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},t.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},t.prototype.group=function(t){return this._group=t,this},t.prototype.delay=function(t){return this._delayTime=t,this},t.prototype.repeat=function(t){return this._initialRepeat=t,this._repeat=t,this},t.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},t.prototype.yoyo=function(t){return this._yoyo=t,this},t.prototype.easing=function(t){return this._easingFunction=t,this},t.prototype.interpolation=function(t){return this._interpolationFunction=t,this},t.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},t.prototype.onStart=function(t){return this._onStartCallback=t,this},t.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},t.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},t.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},t.prototype.onStop=function(t){return this._onStopCallback=t,this},t.prototype.update=function(t,e){if(void 0===t&&(t=i()),void 0===e&&(e=!0),this._isPaused)return!0;var n,r,o=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>o)return!1;e&&this.start(t)}if(this._goToEnd=!1,t<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),r=(t-this._startTime)/this._duration,r=0===this._duration||r>1?1:r;var s=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,s),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),1===r){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var a=0,u=this._chainedTweens.length;a<u;a++)this._chainedTweens[a].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(t,e,n,r){for(var i in n)if(void 0!==e[i]){var o=e[i]||0,s=n[i],a=Array.isArray(t[i]),u=Array.isArray(s);!a&&u?t[i]=this._interpolationFunction(s,r):"object"==typeof s&&s?this._updateProperties(t[i],o,s,r):"number"==typeof(s=this._handleRelativeValue(o,s))&&(t[i]=o+(s-o)*r)}},t.prototype._handleRelativeValue=function(t,e){return"string"!=typeof e?e:"+"===e.charAt(0)||"-"===e.charAt(0)?t+parseFloat(e):parseFloat(e)},t.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],n=this._valuesEnd[t];this._valuesStartRepeat[t]="string"==typeof n?this._valuesStartRepeat[t]+parseFloat(n):this._valuesEnd[t],this._valuesEnd[t]=e},t}(),l=a.nextId,h=u,p=h.getAll.bind(h),f=h.removeAll.bind(h),d=h.add.bind(h),g=h.remove.bind(h),m=h.update.bind(h),v={Easing:r,Group:o,Interpolation:s,now:i,Sequence:a,nextId:l,Tween:c,VERSION:"18.6.4",getAll:p,removeAll:f,add:d,remove:g,update:m};e.a=v}).call(this,n("8oxB"))},J14m:function(t,e,n){"use strict";n.r(e),n.d(e,"config",(function(){return m})),n.d(e,"LogUtil",(function(){return g})),n.d(e,"LogLevel",(function(){return d})),n.d(e,"CbType",(function(){return LM})),n.d(e,"OwllyVR",(function(){return RM})),n.d(e,"BasePlugin",(function(){return Q_})),n.d(e,"VideoPlugin",(function(){return Dw})),n.d(e,"Label3dPlugin",(function(){return Qw})),n.d(e,"Label2dPlugin",(function(){return pM})),n.d(e,"Label2dEventName",(function(){return hM}));var r={};n.r(r),n.d(r,"ACESFilmicToneMapping",(function(){return vt})),n.d(r,"AddEquation",(function(){return U})),n.d(r,"AddOperation",(function(){return pt})),n.d(r,"AdditiveAnimationBlendMode",(function(){return un})),n.d(r,"AdditiveBlending",(function(){return F})),n.d(r,"AlphaFormat",(function(){return Qt})),n.d(r,"AlwaysDepth",(function(){return rt})),n.d(r,"AlwaysStencilFunc",(function(){return Gn})),n.d(r,"AmbientLight",(function(){return Fh})),n.d(r,"AmbientLightProbe",(function(){return ip})),n.d(r,"AnimationClip",(function(){return Nl})),n.d(r,"AnimationLoader",(function(){return Wl})),n.d(r,"AnimationMixer",(function(){return Bp})),n.d(r,"AnimationObjectGroup",(function(){return Op})),n.d(r,"AnimationUtils",(function(){return El})),n.d(r,"ArcCurve",(function(){return $l})),n.d(r,"ArrayCamera",(function(){return Za})),n.d(r,"ArrowHelper",(function(){return Sf})),n.d(r,"Audio",(function(){return gp})),n.d(r,"AudioAnalyser",(function(){return _p})),n.d(r,"AudioContext",(function(){return ep})),n.d(r,"AudioListener",(function(){return dp})),n.d(r,"AudioLoader",(function(){return np})),n.d(r,"AxesHelper",(function(){return Af})),n.d(r,"AxisHelper",(function(){return Sd})),n.d(r,"BackSide",(function(){return I})),n.d(r,"BasicDepthPacking",(function(){return bn})),n.d(r,"BasicShadowMap",(function(){return S})),n.d(r,"BinaryTextureLoader",(function(){return Id})),n.d(r,"Bone",(function(){return Fu})),n.d(r,"BooleanKeyframeTrack",(function(){return Il})),n.d(r,"BoundingBoxHelper",(function(){return Ad})),n.d(r,"Box2",(function(){return Wp})),n.d(r,"Box3",(function(){return gr})),n.d(r,"Box3Helper",(function(){return bf})),n.d(r,"BoxBufferGeometry",(function(){return Io})),n.d(r,"BoxGeometry",(function(){return Io})),n.d(r,"BoxHelper",(function(){return xf})),n.d(r,"BufferAttribute",(function(){return Hi})),n.d(r,"BufferGeometry",(function(){return co})),n.d(r,"BufferGeometryLoader",(function(){return jh})),n.d(r,"ByteType",(function(){return Ut})),n.d(r,"Cache",(function(){return Gl})),n.d(r,"Camera",(function(){return Bo})),n.d(r,"CameraHelper",(function(){return mf})),n.d(r,"CanvasRenderer",(function(){return Rd})),n.d(r,"CanvasTexture",(function(){return hc})),n.d(r,"CatmullRomCurve3",(function(){return oh})),n.d(r,"CineonToneMapping",(function(){return mt})),n.d(r,"CircleBufferGeometry",(function(){return fc})),n.d(r,"CircleGeometry",(function(){return fc})),n.d(r,"ClampToEdgeWrapping",(function(){return Ct})),n.d(r,"Clock",(function(){return up})),n.d(r,"Color",(function(){return ki})),n.d(r,"ColorKeyframeTrack",(function(){return Ll})),n.d(r,"CompressedTexture",(function(){return lc})),n.d(r,"CompressedTextureLoader",(function(){return ql})),n.d(r,"ConeBufferGeometry",(function(){return gc})),n.d(r,"ConeGeometry",(function(){return gc})),n.d(r,"CubeCamera",(function(){return No})),n.d(r,"CubeReflectionMapping",(function(){return bt})),n.d(r,"CubeRefractionMapping",(function(){return _t})),n.d(r,"CubeTexture",(function(){return ko})),n.d(r,"CubeTextureLoader",(function(){return Yl})),n.d(r,"CubeUVReflectionMapping",(function(){return Et})),n.d(r,"CubeUVRefractionMapping",(function(){return St})),n.d(r,"CubicBezierCurve",(function(){return ch})),n.d(r,"CubicBezierCurve3",(function(){return lh})),n.d(r,"CubicInterpolant",(function(){return Al})),n.d(r,"CullFaceBack",(function(){return w})),n.d(r,"CullFaceFront",(function(){return M})),n.d(r,"CullFaceFrontBack",(function(){return E})),n.d(r,"CullFaceNone",(function(){return _})),n.d(r,"Curve",(function(){return Ql})),n.d(r,"CurvePath",(function(){return vh})),n.d(r,"CustomBlending",(function(){return G})),n.d(r,"CustomToneMapping",(function(){return yt})),n.d(r,"CylinderBufferGeometry",(function(){return dc})),n.d(r,"CylinderGeometry",(function(){return dc})),n.d(r,"Cylindrical",(function(){return Vp})),n.d(r,"DataTexture",(function(){return Uo})),n.d(r,"DataTexture2DArray",(function(){return ls})),n.d(r,"DataTexture3D",(function(){return hs})),n.d(r,"DataTextureLoader",(function(){return Jl})),n.d(r,"DataUtils",(function(){return Pf})),n.d(r,"DecrementStencilOp",(function(){return Tn})),n.d(r,"DecrementWrapStencilOp",(function(){return In})),n.d(r,"DefaultLoadingManager",(function(){return zl})),n.d(r,"DepthFormat",(function(){return re})),n.d(r,"DepthStencilFormat",(function(){return ie})),n.d(r,"DepthTexture",(function(){return pc})),n.d(r,"DirectionalLight",(function(){return Bh})),n.d(r,"DirectionalLightHelper",(function(){return ff})),n.d(r,"DiscreteInterpolant",(function(){return Tl})),n.d(r,"DodecahedronBufferGeometry",(function(){return vc})),n.d(r,"DodecahedronGeometry",(function(){return vc})),n.d(r,"DoubleSide",(function(){return L})),n.d(r,"DstAlphaFactor",(function(){return Q})),n.d(r,"DstColorFactor",(function(){return $})),n.d(r,"DynamicBufferAttribute",(function(){return gd})),n.d(r,"DynamicCopyUsage",(function(){return Xn})),n.d(r,"DynamicDrawUsage",(function(){return zn})),n.d(r,"DynamicReadUsage",(function(){return jn})),n.d(r,"EdgesGeometry",(function(){return wc})),n.d(r,"EdgesHelper",(function(){return Cd})),n.d(r,"EllipseCurve",(function(){return Zl})),n.d(r,"EqualDepth",(function(){return st})),n.d(r,"EqualStencilFunc",(function(){return Dn})),n.d(r,"EquirectangularReflectionMapping",(function(){return wt})),n.d(r,"EquirectangularRefractionMapping",(function(){return Mt})),n.d(r,"Euler",(function(){return $r})),n.d(r,"EventDispatcher",(function(){return Qn})),n.d(r,"ExtrudeBufferGeometry",(function(){return Qc})),n.d(r,"ExtrudeGeometry",(function(){return Qc})),n.d(r,"FaceColors",(function(){return id})),n.d(r,"FileLoader",(function(){return jl})),n.d(r,"FlatShading",(function(){return R})),n.d(r,"Float16BufferAttribute",(function(){return Ki})),n.d(r,"Float32Attribute",(function(){return Md})),n.d(r,"Float32BufferAttribute",(function(){return Qi})),n.d(r,"Float64Attribute",(function(){return Ed})),n.d(r,"Float64BufferAttribute",(function(){return Zi})),n.d(r,"FloatType",(function(){return Wt})),n.d(r,"Fog",(function(){return su})),n.d(r,"FogExp2",(function(){return ou})),n.d(r,"Font",(function(){return Qh})),n.d(r,"FontLoader",(function(){return $h})),n.d(r,"FrontSide",(function(){return P})),n.d(r,"Frustum",(function(){return Vo})),n.d(r,"GLBufferAttribute",(function(){return kp})),n.d(r,"GLSL1",(function(){return Jn})),n.d(r,"GLSL3",(function(){return Kn})),n.d(r,"GammaEncoding",(function(){return dn})),n.d(r,"GreaterDepth",(function(){return ut})),n.d(r,"GreaterEqualDepth",(function(){return at})),n.d(r,"GreaterEqualStencilFunc",(function(){return kn})),n.d(r,"GreaterStencilFunc",(function(){return Fn})),n.d(r,"GridHelper",(function(){return uf})),n.d(r,"Group",(function(){return $a})),n.d(r,"HalfFloatType",(function(){return qt})),n.d(r,"HemisphereLight",(function(){return _h})),n.d(r,"HemisphereLightHelper",(function(){return af})),n.d(r,"HemisphereLightProbe",(function(){return rp})),n.d(r,"IcosahedronBufferGeometry",(function(){return $c})),n.d(r,"IcosahedronGeometry",(function(){return $c})),n.d(r,"ImageBitmapLoader",(function(){return Jh})),n.d(r,"ImageLoader",(function(){return Xl})),n.d(r,"ImageUtils",(function(){return ir})),n.d(r,"ImmediateRenderObject",(function(){return Jp})),n.d(r,"IncrementStencilOp",(function(){return Cn})),n.d(r,"IncrementWrapStencilOp",(function(){return Pn})),n.d(r,"InstancedBufferAttribute",(function(){return Vh})),n.d(r,"InstancedBufferGeometry",(function(){return Hh})),n.d(r,"InstancedInterleavedBuffer",(function(){return Np})),n.d(r,"InstancedMesh",(function(){return ju})),n.d(r,"Int16Attribute",(function(){return xd})),n.d(r,"Int16BufferAttribute",(function(){return qi})),n.d(r,"Int32Attribute",(function(){return _d})),n.d(r,"Int32BufferAttribute",(function(){return Yi})),n.d(r,"Int8Attribute",(function(){return md})),n.d(r,"Int8BufferAttribute",(function(){return Vi})),n.d(r,"IntType",(function(){return Vt})),n.d(r,"InterleavedBuffer",(function(){return uu})),n.d(r,"InterleavedBufferAttribute",(function(){return lu})),n.d(r,"Interpolant",(function(){return Sl})),n.d(r,"InterpolateDiscrete",(function(){return tn})),n.d(r,"InterpolateLinear",(function(){return en})),n.d(r,"InterpolateSmooth",(function(){return nn})),n.d(r,"InvertStencilOp",(function(){return Ln})),n.d(r,"JSONLoader",(function(){return Od})),n.d(r,"KeepStencilOp",(function(){return Sn})),n.d(r,"KeyframeTrack",(function(){return Pl})),n.d(r,"LOD",(function(){return Pu})),n.d(r,"LatheBufferGeometry",(function(){return tl})),n.d(r,"LatheGeometry",(function(){return tl})),n.d(r,"Layers",(function(){return ti})),n.d(r,"LensFlare",(function(){return Bd})),n.d(r,"LessDepth",(function(){return it})),n.d(r,"LessEqualDepth",(function(){return ot})),n.d(r,"LessEqualStencilFunc",(function(){return Bn})),n.d(r,"LessStencilFunc",(function(){return On})),n.d(r,"Light",(function(){return bh})),n.d(r,"LightProbe",(function(){return Gh})),n.d(r,"Line",(function(){return Qu})),n.d(r,"Line3",(function(){return Yp})),n.d(r,"LineBasicMaterial",(function(){return Wu})),n.d(r,"LineCurve",(function(){return hh})),n.d(r,"LineCurve3",(function(){return ph})),n.d(r,"LineDashedMaterial",(function(){return wl})),n.d(r,"LineLoop",(function(){return ec})),n.d(r,"LinePieces",(function(){return nd})),n.d(r,"LineSegments",(function(){return tc})),n.d(r,"LineStrip",(function(){return ed})),n.d(r,"LinearEncoding",(function(){return pn})),n.d(r,"LinearFilter",(function(){return Dt})),n.d(r,"LinearInterpolant",(function(){return Cl})),n.d(r,"LinearMipMapLinearFilter",(function(){return kt})),n.d(r,"LinearMipMapNearestFilter",(function(){return Ft})),n.d(r,"LinearMipmapLinearFilter",(function(){return Nt})),n.d(r,"LinearMipmapNearestFilter",(function(){return Bt})),n.d(r,"LinearToneMapping",(function(){return dt})),n.d(r,"Loader",(function(){return Hl})),n.d(r,"LoaderUtils",(function(){return zh})),n.d(r,"LoadingManager",(function(){return Ul})),n.d(r,"LogLuvEncoding",(function(){return mn})),n.d(r,"LoopOnce",(function(){return Qe})),n.d(r,"LoopPingPong",(function(){return $e})),n.d(r,"LoopRepeat",(function(){return Ze})),n.d(r,"LuminanceAlphaFormat",(function(){return ee})),n.d(r,"LuminanceFormat",(function(){return te})),n.d(r,"MOUSE",(function(){return x})),n.d(r,"Material",(function(){return Li})),n.d(r,"MaterialLoader",(function(){return Uh})),n.d(r,"Math",(function(){return tr})),n.d(r,"MathUtils",(function(){return tr})),n.d(r,"Matrix3",(function(){return nr})),n.d(r,"Matrix4",(function(){return Vr})),n.d(r,"MaxEquation",(function(){return j})),n.d(r,"Mesh",(function(){return To})),n.d(r,"MeshBasicMaterial",(function(){return Gi})),n.d(r,"MeshDepthMaterial",(function(){return qa})),n.d(r,"MeshDistanceMaterial",(function(){return Xa})),n.d(r,"MeshFaceMaterial",(function(){return sd})),n.d(r,"MeshLambertMaterial",(function(){return bl})),n.d(r,"MeshMatcapMaterial",(function(){return _l})),n.d(r,"MeshNormalMaterial",(function(){return xl})),n.d(r,"MeshPhongMaterial",(function(){return vl})),n.d(r,"MeshPhysicalMaterial",(function(){return ml})),n.d(r,"MeshStandardMaterial",(function(){return gl})),n.d(r,"MeshToonMaterial",(function(){return yl})),n.d(r,"MinEquation",(function(){return V})),n.d(r,"MirroredRepeatWrapping",(function(){return Tt})),n.d(r,"MixOperation",(function(){return ht})),n.d(r,"MultiMaterial",(function(){return ad})),n.d(r,"MultiplyBlending",(function(){return k})),n.d(r,"MultiplyOperation",(function(){return lt})),n.d(r,"NearestFilter",(function(){return Pt})),n.d(r,"NearestMipMapLinearFilter",(function(){return Ot})),n.d(r,"NearestMipMapNearestFilter",(function(){return Lt})),n.d(r,"NearestMipmapLinearFilter",(function(){return Rt})),n.d(r,"NearestMipmapNearestFilter",(function(){return It})),n.d(r,"NeverDepth",(function(){return nt})),n.d(r,"NeverStencilFunc",(function(){return Rn})),n.d(r,"NoBlending",(function(){return D})),n.d(r,"NoColors",(function(){return rd})),n.d(r,"NoToneMapping",(function(){return ft})),n.d(r,"NormalAnimationBlendMode",(function(){return an})),n.d(r,"NormalBlending",(function(){return B})),n.d(r,"NotEqualDepth",(function(){return ct})),n.d(r,"NotEqualStencilFunc",(function(){return Nn})),n.d(r,"NumberKeyframeTrack",(function(){return Rl})),n.d(r,"Object3D",(function(){return di})),n.d(r,"ObjectLoader",(function(){return Wh})),n.d(r,"ObjectSpaceNormalMap",(function(){return Mn})),n.d(r,"OctahedronBufferGeometry",(function(){return el})),n.d(r,"OctahedronGeometry",(function(){return el})),n.d(r,"OneFactor",(function(){return q})),n.d(r,"OneMinusDstAlphaFactor",(function(){return Z})),n.d(r,"OneMinusDstColorFactor",(function(){return tt})),n.d(r,"OneMinusSrcAlphaFactor",(function(){return K})),n.d(r,"OneMinusSrcColorFactor",(function(){return Y})),n.d(r,"OrthographicCamera",(function(){return Oh})),n.d(r,"PCFShadowMap",(function(){return A})),n.d(r,"PCFSoftShadowMap",(function(){return C})),n.d(r,"PMREMGenerator",(function(){return qf})),n.d(r,"ParametricBufferGeometry",(function(){return nl})),n.d(r,"ParametricGeometry",(function(){return nl})),n.d(r,"Particle",(function(){return cd})),n.d(r,"ParticleBasicMaterial",(function(){return pd})),n.d(r,"ParticleSystem",(function(){return ld})),n.d(r,"ParticleSystemMaterial",(function(){return fd})),n.d(r,"Path",(function(){return yh})),n.d(r,"PerspectiveCamera",(function(){return Fo})),n.d(r,"Plane",(function(){return yi})),n.d(r,"PlaneBufferGeometry",(function(){return qo})),n.d(r,"PlaneGeometry",(function(){return qo})),n.d(r,"PlaneHelper",(function(){return _f})),n.d(r,"PointCloud",(function(){return ud})),n.d(r,"PointCloudMaterial",(function(){return hd})),n.d(r,"PointLight",(function(){return Rh})),n.d(r,"PointLightHelper",(function(){return nf})),n.d(r,"Points",(function(){return ac})),n.d(r,"PointsMaterial",(function(){return nc})),n.d(r,"PolarGridHelper",(function(){return cf})),n.d(r,"PolyhedronBufferGeometry",(function(){return mc})),n.d(r,"PolyhedronGeometry",(function(){return mc})),n.d(r,"PositionalAudio",(function(){return bp})),n.d(r,"PropertyBinding",(function(){return Rp})),n.d(r,"PropertyMixer",(function(){return wp})),n.d(r,"QuadraticBezierCurve",(function(){return fh})),n.d(r,"QuadraticBezierCurve3",(function(){return dh})),n.d(r,"Quaternion",(function(){return hr})),n.d(r,"QuaternionKeyframeTrack",(function(){return Dl})),n.d(r,"QuaternionLinearInterpolant",(function(){return Ol})),n.d(r,"REVISION",(function(){return y})),n.d(r,"RGBADepthPacking",(function(){return _n})),n.d(r,"RGBAFormat",(function(){return $t})),n.d(r,"RGBAIntegerFormat",(function(){return le})),n.d(r,"RGBA_ASTC_10x10_Format",(function(){return Oe})),n.d(r,"RGBA_ASTC_10x5_Format",(function(){return Ie})),n.d(r,"RGBA_ASTC_10x6_Format",(function(){return Le})),n.d(r,"RGBA_ASTC_10x8_Format",(function(){return Re})),n.d(r,"RGBA_ASTC_12x10_Format",(function(){return De})),n.d(r,"RGBA_ASTC_12x12_Format",(function(){return Be})),n.d(r,"RGBA_ASTC_4x4_Format",(function(){return we})),n.d(r,"RGBA_ASTC_5x4_Format",(function(){return Me})),n.d(r,"RGBA_ASTC_5x5_Format",(function(){return Ee})),n.d(r,"RGBA_ASTC_6x5_Format",(function(){return Se})),n.d(r,"RGBA_ASTC_6x6_Format",(function(){return Ae})),n.d(r,"RGBA_ASTC_8x5_Format",(function(){return Ce})),n.d(r,"RGBA_ASTC_8x6_Format",(function(){return Te})),n.d(r,"RGBA_ASTC_8x8_Format",(function(){return Pe})),n.d(r,"RGBA_BPTC_Format",(function(){return Fe})),n.d(r,"RGBA_ETC2_EAC_Format",(function(){return _e})),n.d(r,"RGBA_PVRTC_2BPPV1_Format",(function(){return ye})),n.d(r,"RGBA_PVRTC_4BPPV1_Format",(function(){return ve})),n.d(r,"RGBA_S3TC_DXT1_Format",(function(){return pe})),n.d(r,"RGBA_S3TC_DXT3_Format",(function(){return fe})),n.d(r,"RGBA_S3TC_DXT5_Format",(function(){return de})),n.d(r,"RGBDEncoding",(function(){return xn})),n.d(r,"RGBEEncoding",(function(){return gn})),n.d(r,"RGBEFormat",(function(){return ne})),n.d(r,"RGBFormat",(function(){return Zt})),n.d(r,"RGBIntegerFormat",(function(){return ce})),n.d(r,"RGBM16Encoding",(function(){return yn})),n.d(r,"RGBM7Encoding",(function(){return vn})),n.d(r,"RGB_ETC1_Format",(function(){return xe})),n.d(r,"RGB_ETC2_Format",(function(){return be})),n.d(r,"RGB_PVRTC_2BPPV1_Format",(function(){return me})),n.d(r,"RGB_PVRTC_4BPPV1_Format",(function(){return ge})),n.d(r,"RGB_S3TC_DXT1_Format",(function(){return he})),n.d(r,"RGFormat",(function(){return ae})),n.d(r,"RGIntegerFormat",(function(){return ue})),n.d(r,"RawShaderMaterial",(function(){return dl})),n.d(r,"Ray",(function(){return Hr})),n.d(r,"Raycaster",(function(){return Gp})),n.d(r,"RectAreaLight",(function(){return Nh})),n.d(r,"RedFormat",(function(){return oe})),n.d(r,"RedIntegerFormat",(function(){return se})),n.d(r,"ReinhardToneMapping",(function(){return gt})),n.d(r,"RepeatWrapping",(function(){return At})),n.d(r,"ReplaceStencilOp",(function(){return An})),n.d(r,"ReverseSubtractEquation",(function(){return H})),n.d(r,"RingBufferGeometry",(function(){return rl})),n.d(r,"RingGeometry",(function(){return rl})),n.d(r,"SRGB8_ALPHA8_ASTC_10x10_Format",(function(){return Ye})),n.d(r,"SRGB8_ALPHA8_ASTC_10x5_Format",(function(){return We})),n.d(r,"SRGB8_ALPHA8_ASTC_10x6_Format",(function(){return qe})),n.d(r,"SRGB8_ALPHA8_ASTC_10x8_Format",(function(){return Xe})),n.d(r,"SRGB8_ALPHA8_ASTC_12x10_Format",(function(){return Je})),n.d(r,"SRGB8_ALPHA8_ASTC_12x12_Format",(function(){return Ke})),n.d(r,"SRGB8_ALPHA8_ASTC_4x4_Format",(function(){return Ne})),n.d(r,"SRGB8_ALPHA8_ASTC_5x4_Format",(function(){return ke})),n.d(r,"SRGB8_ALPHA8_ASTC_5x5_Format",(function(){return Ge})),n.d(r,"SRGB8_ALPHA8_ASTC_6x5_Format",(function(){return Ue})),n.d(r,"SRGB8_ALPHA8_ASTC_6x6_Format",(function(){return ze})),n.d(r,"SRGB8_ALPHA8_ASTC_8x5_Format",(function(){return He})),n.d(r,"SRGB8_ALPHA8_ASTC_8x6_Format",(function(){return Ve})),n.d(r,"SRGB8_ALPHA8_ASTC_8x8_Format",(function(){return je})),n.d(r,"Scene",(function(){return au})),n.d(r,"SceneUtils",(function(){return Dd})),n.d(r,"ShaderChunk",(function(){return Xo})),n.d(r,"ShaderLib",(function(){return Jo})),n.d(r,"ShaderMaterial",(function(){return Do})),n.d(r,"ShadowMaterial",(function(){return fl})),n.d(r,"Shape",(function(){return xh})),n.d(r,"ShapeBufferGeometry",(function(){return il})),n.d(r,"ShapeGeometry",(function(){return il})),n.d(r,"ShapePath",(function(){return Kh})),n.d(r,"ShapeUtils",(function(){return Yc})),n.d(r,"ShortType",(function(){return zt})),n.d(r,"Skeleton",(function(){return Gu})),n.d(r,"SkeletonHelper",(function(){return ef})),n.d(r,"SkinnedMesh",(function(){return Bu})),n.d(r,"SmoothShading",(function(){return O})),n.d(r,"Sphere",(function(){return Dr})),n.d(r,"SphereBufferGeometry",(function(){return ol})),n.d(r,"SphereGeometry",(function(){return ol})),n.d(r,"Spherical",(function(){return Hp})),n.d(r,"SphericalHarmonics3",(function(){return kh})),n.d(r,"SplineCurve",(function(){return gh})),n.d(r,"SpotLight",(function(){return Ch})),n.d(r,"SpotLightHelper",(function(){return Qp})),n.d(r,"Sprite",(function(){return Su})),n.d(r,"SpriteMaterial",(function(){return hu})),n.d(r,"SrcAlphaFactor",(function(){return J})),n.d(r,"SrcAlphaSaturateFactor",(function(){return et})),n.d(r,"SrcColorFactor",(function(){return X})),n.d(r,"StaticCopyUsage",(function(){return qn})),n.d(r,"StaticDrawUsage",(function(){return Un})),n.d(r,"StaticReadUsage",(function(){return Vn})),n.d(r,"StereoCamera",(function(){return ap})),n.d(r,"StreamCopyUsage",(function(){return Yn})),n.d(r,"StreamDrawUsage",(function(){return Hn})),n.d(r,"StreamReadUsage",(function(){return Wn})),n.d(r,"StringKeyframeTrack",(function(){return Bl})),n.d(r,"SubtractEquation",(function(){return z})),n.d(r,"SubtractiveBlending",(function(){return N})),n.d(r,"TOUCH",(function(){return b})),n.d(r,"TangentSpaceNormalMap",(function(){return wn})),n.d(r,"TetrahedronBufferGeometry",(function(){return sl})),n.d(r,"TetrahedronGeometry",(function(){return sl})),n.d(r,"TextBufferGeometry",(function(){return al})),n.d(r,"TextGeometry",(function(){return al})),n.d(r,"Texture",(function(){return sr})),n.d(r,"TextureLoader",(function(){return Kl})),n.d(r,"TorusBufferGeometry",(function(){return ul})),n.d(r,"TorusGeometry",(function(){return ul})),n.d(r,"TorusKnotBufferGeometry",(function(){return cl})),n.d(r,"TorusKnotGeometry",(function(){return cl})),n.d(r,"Triangle",(function(){return Pi})),n.d(r,"TriangleFanDrawMode",(function(){return hn})),n.d(r,"TriangleStripDrawMode",(function(){return ln})),n.d(r,"TrianglesDrawMode",(function(){return cn})),n.d(r,"TubeBufferGeometry",(function(){return ll})),n.d(r,"TubeGeometry",(function(){return ll})),n.d(r,"UVMapping",(function(){return xt})),n.d(r,"Uint16Attribute",(function(){return bd})),n.d(r,"Uint16BufferAttribute",(function(){return Xi})),n.d(r,"Uint32Attribute",(function(){return wd})),n.d(r,"Uint32BufferAttribute",(function(){return Ji})),n.d(r,"Uint8Attribute",(function(){return vd})),n.d(r,"Uint8BufferAttribute",(function(){return ji})),n.d(r,"Uint8ClampedAttribute",(function(){return yd})),n.d(r,"Uint8ClampedBufferAttribute",(function(){return Wi})),n.d(r,"Uniform",(function(){return Fp})),n.d(r,"UniformsLib",(function(){return Yo})),n.d(r,"UniformsUtils",(function(){return Oo})),n.d(r,"UnsignedByteType",(function(){return Gt})),n.d(r,"UnsignedInt248Type",(function(){return Kt})),n.d(r,"UnsignedIntType",(function(){return jt})),n.d(r,"UnsignedShort4444Type",(function(){return Xt})),n.d(r,"UnsignedShort5551Type",(function(){return Yt})),n.d(r,"UnsignedShort565Type",(function(){return Jt})),n.d(r,"UnsignedShortType",(function(){return Ht})),n.d(r,"VSMShadowMap",(function(){return T})),n.d(r,"Vector2",(function(){return er})),n.d(r,"Vector3",(function(){return pr})),n.d(r,"Vector4",(function(){return ur})),n.d(r,"VectorKeyframeTrack",(function(){return Fl})),n.d(r,"Vertex",(function(){return dd})),n.d(r,"VertexColors",(function(){return od})),n.d(r,"VideoTexture",(function(){return cc})),n.d(r,"WebGL1Renderer",(function(){return iu})),n.d(r,"WebGLCubeRenderTarget",(function(){return Go})),n.d(r,"WebGLMultisampleRenderTarget",(function(){return lr})),n.d(r,"WebGLRenderTarget",(function(){return cr})),n.d(r,"WebGLRenderTargetCube",(function(){return Ld})),n.d(r,"WebGLRenderer",(function(){return ru})),n.d(r,"WebGLUtils",(function(){return Qa})),n.d(r,"WireframeGeometry",(function(){return hl})),n.d(r,"WireframeHelper",(function(){return Td})),n.d(r,"WrapAroundEnding",(function(){return sn})),n.d(r,"XHRLoader",(function(){return Pd})),n.d(r,"ZeroCurvatureEnding",(function(){return rn})),n.d(r,"ZeroFactor",(function(){return W})),n.d(r,"ZeroSlopeEnding",(function(){return on})),n.d(r,"ZeroStencilOp",(function(){return En})),n.d(r,"sRGBEncoding",(function(){return fn}));var i={};n.r(i),n.d(i,"create",(function(){return og})),n.d(i,"clone",(function(){return sg})),n.d(i,"copy",(function(){return ag})),n.d(i,"fromValues",(function(){return ug})),n.d(i,"set",(function(){return cg})),n.d(i,"identity",(function(){return lg})),n.d(i,"transpose",(function(){return hg})),n.d(i,"invert",(function(){return pg})),n.d(i,"adjoint",(function(){return fg})),n.d(i,"determinant",(function(){return dg})),n.d(i,"multiply",(function(){return gg})),n.d(i,"translate",(function(){return mg})),n.d(i,"scale",(function(){return vg})),n.d(i,"rotate",(function(){return yg})),n.d(i,"rotateX",(function(){return xg})),n.d(i,"rotateY",(function(){return bg})),n.d(i,"rotateZ",(function(){return _g})),n.d(i,"fromTranslation",(function(){return wg})),n.d(i,"fromScaling",(function(){return Mg})),n.d(i,"fromRotation",(function(){return Eg})),n.d(i,"fromXRotation",(function(){return Sg})),n.d(i,"fromYRotation",(function(){return Ag})),n.d(i,"fromZRotation",(function(){return Cg})),n.d(i,"fromRotationTranslation",(function(){return Tg})),n.d(i,"fromQuat2",(function(){return Pg})),n.d(i,"getTranslation",(function(){return Ig})),n.d(i,"getScaling",(function(){return Lg})),n.d(i,"getRotation",(function(){return Rg})),n.d(i,"fromRotationTranslationScale",(function(){return Og})),n.d(i,"fromRotationTranslationScaleOrigin",(function(){return Dg})),n.d(i,"fromQuat",(function(){return Bg})),n.d(i,"frustum",(function(){return Fg})),n.d(i,"perspectiveNO",(function(){return Ng})),n.d(i,"perspective",(function(){return kg})),n.d(i,"perspectiveZO",(function(){return Gg})),n.d(i,"perspectiveFromFieldOfView",(function(){return Ug})),n.d(i,"orthoNO",(function(){return zg})),n.d(i,"ortho",(function(){return Hg})),n.d(i,"orthoZO",(function(){return Vg})),n.d(i,"lookAt",(function(){return jg})),n.d(i,"targetTo",(function(){return Wg})),n.d(i,"str",(function(){return qg})),n.d(i,"frob",(function(){return Xg})),n.d(i,"add",(function(){return Yg})),n.d(i,"subtract",(function(){return Jg})),n.d(i,"multiplyScalar",(function(){return Kg})),n.d(i,"multiplyScalarAndAdd",(function(){return Qg})),n.d(i,"exactEquals",(function(){return Zg})),n.d(i,"equals",(function(){return $g})),n.d(i,"mul",(function(){return tm})),n.d(i,"sub",(function(){return em}));var o={};n.r(o),n.d(o,"create",(function(){return nm})),n.d(o,"clone",(function(){return rm})),n.d(o,"fromValues",(function(){return im})),n.d(o,"copy",(function(){return om})),n.d(o,"set",(function(){return sm})),n.d(o,"add",(function(){return am})),n.d(o,"subtract",(function(){return um})),n.d(o,"multiply",(function(){return cm})),n.d(o,"divide",(function(){return lm})),n.d(o,"ceil",(function(){return hm})),n.d(o,"floor",(function(){return pm})),n.d(o,"min",(function(){return fm})),n.d(o,"max",(function(){return dm})),n.d(o,"round",(function(){return gm})),n.d(o,"scale",(function(){return mm})),n.d(o,"scaleAndAdd",(function(){return vm})),n.d(o,"distance",(function(){return ym})),n.d(o,"squaredDistance",(function(){return xm})),n.d(o,"length",(function(){return bm})),n.d(o,"squaredLength",(function(){return _m})),n.d(o,"negate",(function(){return wm})),n.d(o,"inverse",(function(){return Mm})),n.d(o,"normalize",(function(){return Em})),n.d(o,"dot",(function(){return Sm})),n.d(o,"cross",(function(){return Am})),n.d(o,"lerp",(function(){return Cm})),n.d(o,"random",(function(){return Tm})),n.d(o,"transformMat2",(function(){return Pm})),n.d(o,"transformMat2d",(function(){return Im})),n.d(o,"transformMat3",(function(){return Lm})),n.d(o,"transformMat4",(function(){return Rm})),n.d(o,"rotate",(function(){return Om})),n.d(o,"angle",(function(){return Dm})),n.d(o,"zero",(function(){return Bm})),n.d(o,"str",(function(){return Fm})),n.d(o,"exactEquals",(function(){return Nm})),n.d(o,"equals",(function(){return km})),n.d(o,"len",(function(){return Um})),n.d(o,"sub",(function(){return zm})),n.d(o,"mul",(function(){return Hm})),n.d(o,"div",(function(){return Vm})),n.d(o,"dist",(function(){return jm})),n.d(o,"sqrDist",(function(){return Wm})),n.d(o,"sqrLen",(function(){return qm})),n.d(o,"forEach",(function(){return Xm}));var s={};n.r(s),n.d(s,"create",(function(){return Ym})),n.d(s,"clone",(function(){return Jm})),n.d(s,"length",(function(){return Km})),n.d(s,"fromValues",(function(){return Qm})),n.d(s,"copy",(function(){return Zm})),n.d(s,"set",(function(){return $m})),n.d(s,"add",(function(){return tv})),n.d(s,"subtract",(function(){return ev})),n.d(s,"multiply",(function(){return nv})),n.d(s,"divide",(function(){return rv})),n.d(s,"ceil",(function(){return iv})),n.d(s,"floor",(function(){return ov})),n.d(s,"min",(function(){return sv})),n.d(s,"max",(function(){return av})),n.d(s,"round",(function(){return uv})),n.d(s,"scale",(function(){return cv})),n.d(s,"scaleAndAdd",(function(){return lv})),n.d(s,"distance",(function(){return hv})),n.d(s,"squaredDistance",(function(){return pv})),n.d(s,"squaredLength",(function(){return fv})),n.d(s,"negate",(function(){return dv})),n.d(s,"inverse",(function(){return gv})),n.d(s,"normalize",(function(){return mv})),n.d(s,"dot",(function(){return vv})),n.d(s,"cross",(function(){return yv})),n.d(s,"lerp",(function(){return xv})),n.d(s,"hermite",(function(){return bv})),n.d(s,"bezier",(function(){return _v})),n.d(s,"random",(function(){return wv})),n.d(s,"transformMat4",(function(){return Mv})),n.d(s,"transformMat3",(function(){return Ev})),n.d(s,"transformQuat",(function(){return Sv})),n.d(s,"rotateX",(function(){return Av})),n.d(s,"rotateY",(function(){return Cv})),n.d(s,"rotateZ",(function(){return Tv})),n.d(s,"angle",(function(){return Pv})),n.d(s,"zero",(function(){return Iv})),n.d(s,"str",(function(){return Lv})),n.d(s,"exactEquals",(function(){return Rv})),n.d(s,"equals",(function(){return Ov})),n.d(s,"sub",(function(){return Dv})),n.d(s,"mul",(function(){return Bv})),n.d(s,"div",(function(){return Fv})),n.d(s,"dist",(function(){return Nv})),n.d(s,"sqrDist",(function(){return kv})),n.d(s,"len",(function(){return Gv})),n.d(s,"sqrLen",(function(){return Uv})),n.d(s,"forEach",(function(){return zv}));var a={};n.r(a),n.d(a,"create",(function(){return Hv})),n.d(a,"clone",(function(){return Vv})),n.d(a,"fromValues",(function(){return jv})),n.d(a,"copy",(function(){return Wv})),n.d(a,"set",(function(){return qv})),n.d(a,"add",(function(){return Xv})),n.d(a,"subtract",(function(){return Yv})),n.d(a,"multiply",(function(){return Jv})),n.d(a,"divide",(function(){return Kv})),n.d(a,"ceil",(function(){return Qv})),n.d(a,"floor",(function(){return Zv})),n.d(a,"min",(function(){return $v})),n.d(a,"max",(function(){return ty})),n.d(a,"round",(function(){return ey})),n.d(a,"scale",(function(){return ny})),n.d(a,"scaleAndAdd",(function(){return ry})),n.d(a,"distance",(function(){return iy})),n.d(a,"squaredDistance",(function(){return oy})),n.d(a,"length",(function(){return sy})),n.d(a,"squaredLength",(function(){return ay})),n.d(a,"negate",(function(){return uy})),n.d(a,"inverse",(function(){return cy})),n.d(a,"normalize",(function(){return ly})),n.d(a,"dot",(function(){return hy})),n.d(a,"cross",(function(){return py})),n.d(a,"lerp",(function(){return fy})),n.d(a,"random",(function(){return dy})),n.d(a,"transformMat4",(function(){return gy})),n.d(a,"transformQuat",(function(){return my})),n.d(a,"zero",(function(){return vy})),n.d(a,"str",(function(){return yy})),n.d(a,"exactEquals",(function(){return xy})),n.d(a,"equals",(function(){return by})),n.d(a,"sub",(function(){return wy})),n.d(a,"mul",(function(){return My})),n.d(a,"div",(function(){return Ey})),n.d(a,"dist",(function(){return Sy})),n.d(a,"sqrDist",(function(){return Ay})),n.d(a,"len",(function(){return Cy})),n.d(a,"sqrLen",(function(){return Ty})),n.d(a,"forEach",(function(){return Py}));n("pNMO"),n("4Brf"),n("0oug"),n("gXIK"),n("4mDm"),n("7+zs"),n("qePV"),n("07d7"),n("PKPk"),n("3bBZ");function u(t){return(u="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})(t)}function c(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,f(r.key),r)}}function l(t,e,n){return e&&c(t.prototype,e),n&&c(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function p(t,e,n){return(e=f(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function f(t){var e=function(t,e){if("object"!=u(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==u(e)?e:e+""}var d=l((function t(){h(this,t)}));p(d,"NONE",0),p(d,"ERROR",1),p(d,"WARN",2),p(d,"LOG",3);var g=function(){return l((function t(){h(this,t)}),null,[{key:"log",value:function(){var t;this.level>=d.LOG&&(t=console).log.apply(t,arguments)}},{key:"warn",value:function(){var t;this.level>=d.WARN&&(t=console).warn.apply(t,arguments)}},{key:"error",value:function(){var t;this.level>=d.ERROR&&(t=console).error.apply(t,arguments)}},{key:"time",value:function(t){this.level>=d.LOG&&console.time(t)}},{key:"timeEnd",value:function(t){this.level>=d.LOG&&console.timeEnd(t)}}])}();p(g,"level",d.NONE);var m={oVersion:"1.0.2",name:"common-h5",label:"通用h5",mode:"on-line",sendToAndroid:!1,moveClick:!1,templePath:0,updateDate:"21-09-27",defaultVisibleRadius:50,rotate:{scale:45,distance:4},logLevel:d.LOG,cbLog:!1,initStore:!0,model:{show:!0},ui:{playBtn:!1,img360:!1},camera:{fov:90,zoomScale:-1},move:{auto:!0,speed:10,moveLevel:0,stayLevel:2,jump:!0,jumpTo:!0,jumpDistance:20,startMove:!1,beginFovAnimation:!0,firstLookback:!0},emitPointerPosition:!1,path:{color:5949690,expendLength:2,width:.6,heightOffset:-1,viewDistance:20,minViewDistance:4,fixedViewDistance:!1,simplify:!0,maxTurningDegree:175,rotateCount:1},useTile:!0,tileLevelMax:2,tileResizeFirst:!1,tile:{levels:[.5,.9,2],textPixel:512,imgTextPixel:2048,useLowTextureURLsOnly:!1,useSuper:!1},vrFormat:null,moveDataFormat:null,setUp:null,debug:{test:!0,testDatas:[],showVersion:0},healthCheck:{use:!1,url:"https://robot-vr.aibee.cn/v1/health",thresholdValue:1e3,frequency:2e3},api:{listPanoramasUrl:"https://nav.aibee.cn/aether-walker/vr/list-panoramas"}};g.level=m.logLevel;n("tjZM"),n("lEou"),n("ma9I"),n("pjDv"),n("2B1R"),n("+2oP"),n("pDQq"),n("sMBO"),n("DEfu"),n("Tskq"),n("I9xj"),n("NBAS"),n("tkto"),n("ExoC"),n("5s+n"),n("YGK4"),n("TFPT"),n("FZtP"),n("R5XZ");var v=n("IrXD");
9
+ */var r=function e(n,r){t(this,e),this.next=null,this.key=n,this.data=r,this.left=null,this.right=null};function i(t,e){return t>e?1:t<e?-1:0}function o(t,e,n){for(var i=new r(null,null),o=i,s=i;;){var a=n(t,e.key);if(a<0){if(null===e.left)break;if(n(t,e.left.key)<0){var u=e.left;if(e.left=u.right,u.right=e,null===(e=u).left)break}s.left=e,s=e,e=e.left}else{if(!(a>0))break;if(null===e.right)break;if(n(t,e.right.key)>0){var c=e.right;if(e.right=c.left,c.left=e,null===(e=c).right)break}o.right=e,o=e,e=e.right}}return o.right=e.left,s.left=e.right,e.left=i.right,e.right=i.left,e}function s(t,e,n,i){var s=new r(t,e);if(null===n)return s.left=s.right=null,s;var a=i(t,(n=o(t,n,i)).key);return a<0?(s.left=n.left,s.right=n,n.left=null):a>=0&&(s.right=n.right,s.left=n,n.right=null),s}function a(t,e,n){var r=null,i=null;if(e){var s=n((e=o(t,e,n)).key,t);0===s?(r=e.left,i=e.right):s<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)}return{left:r,right:i}}function u(t,e,n,r,i){if(t){r("".concat(e).concat(n?"└── ":"├── ").concat(i(t),"\n"));var o=e+(n?" ":"│ ");t.left&&u(t.left,o,!1,r,i),t.right&&u(t.right,o,!0,r,i)}}var c=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i;t(this,e),this._root=null,this._size=0,this._comparator=n}return n(e,[{key:"insert",value:function(t,e){return this._size++,this._root=s(t,e,this._root,this._comparator)}},{key:"add",value:function(t,e){var n=new r(t,e);null===this._root&&(n.left=n.right=null,this._size++,this._root=n);var i=this._comparator,s=o(t,this._root,i),a=i(t,s.key);return 0===a?this._root=s:(a<0?(n.left=s.left,n.right=s,s.left=null):a>0&&(n.right=s.right,n.left=s,s.right=null),this._size++,this._root=n),this._root}},{key:"remove",value:function(t){this._root=this._remove(t,this._root,this._comparator)}},{key:"_remove",value:function(t,e,n){var r;return null===e?null:0===n(t,(e=o(t,e,n)).key)?(null===e.left?r=e.right:(r=o(t,e.left,n)).right=e.right,this._size--,r):e}},{key:"pop",value:function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=o(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null}},{key:"findStatic",value:function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return e;e=r<0?e.left:e.right}return null}},{key:"find",value:function(t){return this._root&&(this._root=o(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root}},{key:"contains",value:function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return!0;e=r<0?e.left:e.right}return!1}},{key:"forEach",value:function(t,e){for(var n=this._root,r=[],i=!1;!i;)null!==n?(r.push(n),n=n.left):0!==r.length?(n=r.pop(),t.call(e,n),n=n.right):i=!0;return this}},{key:"range",value:function(t,e,n,r){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&n.call(r,s))return this;s=s.right}return this}},{key:"keys",value:function(){var t=[];return this.forEach((function(e){var n=e.key;return t.push(n)})),t}},{key:"values",value:function(){var t=[];return this.forEach((function(e){var n=e.data;return t.push(n)})),t}},{key:"min",value:function(){return this._root?this.minNode(this._root).key:null}},{key:"max",value:function(){return this._root?this.maxNode(this._root).key:null}},{key:"minNode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._root;if(t)for(;t.left;)t=t.left;return t}},{key:"maxNode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._root;if(t)for(;t.right;)t=t.right;return t}},{key:"at",value:function(t){for(var e=this._root,n=!1,r=0,i=[];!n;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),r===t)return e;r++,e=e.right}else n=!0;return null}},{key:"next",value:function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?(n=e,e=e.left):e=e.right}return n}},{key:"prev",value:function(t){var e=this._root,n=null;if(null!==t.left){for(n=t.left;n.right;)n=n.right;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?e=e.left:(n=e,e=e.right)}return n}},{key:"clear",value:function(){return this._root=null,this._size=0,this}},{key:"toList",value:function(){return function(t){for(var e=t,n=[],i=!1,o=new r(null,null),s=o;!i;)e?(n.push(e),e=e.left):n.length>0?e=(e=s=s.next=n.pop()).right:i=!0;return s.next=null,o.next}(this._root)}},{key:"load",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.length,i=this._comparator;if(n&&d(t,e,0,r-1,i),null===this._root)this._root=l(t,e,0,r),this._size=r;else{var o=f(this.toList(),h(t,e),i);r=this._size+r,this._root=p({head:o},0,r)}return this}},{key:"isEmpty",value:function(){return null===this._root}},{key:"toString",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return String(t.key)},e=[];return u(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")}},{key:"update",value:function(t,e,n){var r=this._comparator,i=a(t,this._root,r),u=i.left,c=i.right;r(t,e)<0?c=s(e,n,c,r):u=s(e,n,u,r),this._root=function(t,e,n){return null===e?t:(null===t||((e=o(t.key,e,n)).left=t),e)}(u,c,r)}},{key:"split",value:function(t){return a(t,this._root,this._comparator)}},{key:"size",get:function(){return this._size}},{key:"root",get:function(){return this._root}}]),e}();function l(t,e,n,i){var o=i-n;if(o>0){var s=n+Math.floor(o/2),a=t[s],u=e[s],c=new r(a,u);return c.left=l(t,e,n,s),c.right=l(t,e,s+1,i),c}return null}function h(t,e){for(var n=new r(null,null),i=n,o=0;o<t.length;o++)i=i.next=new r(t[o],e[o]);return i.next=null,n.next}function p(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),o=p(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=p(t,i+1,n),s}return null}function f(t,e,n){for(var i=new r(null,null),o=i,s=t,a=e;null!==s&&null!==a;)n(s.key,a.key)<0?(o.next=s,s=s.next):(o.next=a,a=a.next),o=o.next;return null!==s?o.next=s:null!==a&&(o.next=a),i.next}function d(t,e,n,r,i){if(!(n>=r)){for(var o=t[n+r>>1],s=n-1,a=r+1;;){do{s++}while(i(t[s],o)<0);do{a--}while(i(t[a],o)>0);if(s>=a)break;var u=t[s];t[s]=t[a],t[a]=u,u=e[s],e[s]=e[a],e[a]=u}d(t,e,n,a,i),d(t,e,a+1,r,i)}}var g=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},m=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var n=t.ll.x<e.ll.x?e.ll.x:t.ll.x,r=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:n,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:r,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},v=Number.EPSILON;void 0===v&&(v=Math.pow(2,-52));var y=v*v,x=function(t,e){if(-v<t&&t<v&&-v<e&&e<v)return 0;var n=t-e;return n*n<y*t*e?0:t<e?-1:1},b=function(){function e(){t(this,e),this.reset()}return n(e,[{key:"reset",value:function(){this.xRounder=new _,this.yRounder=new _}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),e}(),_=function(){function e(){t(this,e),this.tree=new c,this.round(0)}return n(e,[{key:"round",value:function(t){var e=this.tree.add(t),n=this.tree.prev(e);if(null!==n&&0===x(e.key,n.key))return this.tree.remove(t),n.key;var r=this.tree.next(e);return null!==r&&0===x(e.key,r.key)?(this.tree.remove(t),r.key):t}}]),e}(),w=new b,M=function(t,e){return t.x*e.y-t.y*e.x},E=function(t,e){return t.x*e.x+t.y*e.y},S=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y},o=M(r,i);return x(o,0)},A=function(t){return Math.sqrt(E(t,t))},C=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return E(i,r)/A(i)/A(r)},T=function(t,e,n){return 0===e.y?null:{x:t.x+e.x/e.y*(n-t.y),y:n}},P=function(t,e,n){return 0===e.x?null:{x:n,y:t.y+e.y/e.x*(n-t.x)}},I=function(){function e(n,r){t(this,e),void 0===n.events?n.events=[this]:n.events.push(this),this.point=n,this.isLeft=r}return n(e,null,[{key:"compare",value:function(t,n){var r=e.comparePoints(t.point,n.point);return 0!==r?r:(t.point!==n.point&&t.link(n),t.isLeft!==n.isLeft?t.isLeft?1:-1:R.compare(t.segment,n.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),n(e,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,n=0,r=e.length;n<r;n++){var i=e[n];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var n=this.point.events[e];if(void 0===n.segment.consumedBy)for(var r=e+1;r<t;r++){var i=this.point.events[r];void 0===i.consumedBy&&n.otherSE.point.events===i.otherSE.point.events&&n.segment.consume(i.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,n=this.point.events.length;e<n;e++){var r=this.point.events[e];r!==this&&!r.segment.ringOut&&r.segment.isInResult()&&t.push(r)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,n=new Map,r=function(r){var i,o,s,a,u,c=r.otherSE;n.set(r,{sine:(i=e.point,o=t.point,s=c.point,a={x:o.x-i.x,y:o.y-i.y},u={x:s.x-i.x,y:s.y-i.y},M(u,a)/A(u)/A(a)),cosine:C(e.point,t.point,c.point)})};return function(t,e){n.has(t)||r(t),n.has(e)||r(e);var i=n.get(t),o=i.sine,s=i.cosine,a=n.get(e),u=a.sine,c=a.cosine;return o>=0&&u>=0?s<c?1:s>c?-1:0:o<0&&u<0?s<c?-1:s>c?1:0:u<o?-1:u>o?1:0}}}]),e}(),L=0,R=function(){function e(n,r,i,o){t(this,e),this.id=++L,this.leftSE=n,n.segment=this,n.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=n,this.rings=i,this.windings=o}return n(e,null,[{key:"compare",value:function(t,e){var n=t.leftSE.point.x,r=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<n)return 1;if(i<r)return-1;var s=t.leftSE.point.y,a=e.leftSE.point.y,u=t.rightSE.point.y,c=e.rightSE.point.y;if(n<r){if(a<s&&a<u)return 1;if(a>s&&a>u)return-1;var l=t.comparePoint(e.leftSE.point);if(l<0)return 1;if(l>0)return-1;var h=e.comparePoint(t.rightSE.point);return 0!==h?h:-1}if(n>r){if(s<a&&s<c)return-1;if(s>a&&s>c)return 1;var p=e.comparePoint(t.leftSE.point);if(0!==p)return p;var f=t.comparePoint(e.rightSE.point);return f<0?1:f>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){var d=e.comparePoint(t.rightSE.point);if(0!==d)return d}if(i>o){var g=t.comparePoint(e.rightSE.point);if(g<0)return 1;if(g>0)return-1}if(i!==o){var m=u-s,v=i-n,y=c-a,x=o-r;if(m>v&&y<x)return 1;if(m<v&&y>x)return-1}return i>o?1:i<o||u<c?-1:u>c?1:t.id<e.id?-1:t.id>e.id?1:0}}]),n(e,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,n=this.rightSE.point,r=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x<e.x?1:-1;var i=(t.y-e.y)/r.y,o=e.x+i*r.x;if(t.x===o)return 0;var s=(t.x-e.x)/r.x,a=e.y+s*r.y;return t.y===a?0:t.y<a?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),n=t.bbox(),r=m(e,n);if(null===r)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,u=g(e,s)&&0===this.comparePoint(s),c=g(n,i)&&0===t.comparePoint(i),l=g(e,a)&&0===this.comparePoint(a),h=g(n,o)&&0===t.comparePoint(o);if(c&&u)return h&&!l?o:!h&&l?a:null;if(c)return l&&i.x===a.x&&i.y===a.y?null:i;if(u)return h&&o.x===s.x&&o.y===s.y?null:s;if(h&&l)return null;if(h)return o;if(l)return a;var p=function(t,e,n,r){if(0===e.x)return P(n,r,t.x);if(0===r.x)return P(t,e,n.x);if(0===e.y)return T(n,r,t.y);if(0===r.y)return T(t,e,n.y);var i=M(e,r);if(0==i)return null;var o={x:n.x-t.x,y:n.y-t.y},s=M(o,e)/i,a=M(o,r)/i;return{x:(t.x+a*e.x+(n.x+s*r.x))/2,y:(t.y+a*e.y+(n.y+s*r.y))/2}}(i,this.vector(),s,t.vector());return null===p?null:g(r,p)?w.round(p.x,p.y):null}},{key:"split",value:function(t){var n=[],r=void 0!==t.events,i=new I(t,!0),o=new I(t,!1),s=this.rightSE;this.replaceRightSE(o),n.push(o),n.push(i);var a=new e(i,s,this.rings.slice(),this.windings.slice());return I.comparePoints(a.leftSE.point,a.rightSE.point)>0&&a.swapEvents(),I.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),o.checkForConsuming()),n}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,n=this.windings.length;e<n;e++)this.windings[e]*=-1}},{key:"consume",value:function(t){for(var n=this,r=t;n.consumedBy;)n=n.consumedBy;for(;r.consumedBy;)r=r.consumedBy;var i=e.compare(n,r);if(0!==i){if(i>0){var o=n;n=r,r=o}if(n.prev===r){var s=n;n=r,r=s}for(var a=0,u=r.rings.length;a<u;a++){var c=r.rings[a],l=r.windings[a],h=n.rings.indexOf(c);-1===h?(n.rings.push(c),n.windings.push(l)):n.windings[h]+=l}r.rings=null,r.windings=null,r.consumedBy=n,r.leftSE.consumedBy=n.leftSE,r.rightSE.consumedBy=n.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],a=this.windings[i],u=e.indexOf(s);-1===u?(e.push(s),n.push(a)):n[u]+=a}for(var c=[],l=[],h=0,p=e.length;h<p;h++)if(0!==n[h]){var f=e[h],d=f.poly;if(-1===l.indexOf(d))if(f.isExterior)c.push(d);else{-1===l.indexOf(d)&&l.push(d);var g=c.indexOf(f.poly);-1!==g&&c.splice(g,1)}}for(var m=0,v=c.length;m<v;m++){var y=c[m].multiPoly;-1===r.indexOf(y)&&r.push(y)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(U.type){case"union":var n=0===t.length,r=0===e.length;this._isInResult=n!==r;break;case"intersection":var i,o;t.length<e.length?(i=t.length,o=e.length):(i=e.length,o=t.length),this._isInResult=o===U.numMultiPolys&&i<o;break;case"xor":var s=Math.abs(t.length-e.length);this._isInResult=s%2==1;break;case"difference":var a=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=a(t)!==a(e);break;default:throw new Error("Unrecognized operation type found ".concat(U.type))}return this._isInResult}}],[{key:"fromRing",value:function(t,n,r){var i,o,s,a=I.comparePoints(t,n);if(a<0)i=t,o=n,s=1;else{if(!(a>0))throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));i=n,o=t,s=-1}return new e(new I(i,!0),new I(o,!1),[r],[s])}}]),e}(),O=function(){function e(n,r,i){if(t(this,e),!Array.isArray(n)||0===n.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=i,this.segments=[],"number"!=typeof n[0][0]||"number"!=typeof n[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var o=w.round(n[0][0],n[0][1]);this.bbox={ll:{x:o.x,y:o.y},ur:{x:o.x,y:o.y}};for(var s=o,a=1,u=n.length;a<u;a++){if("number"!=typeof n[a][0]||"number"!=typeof n[a][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var c=w.round(n[a][0],n[a][1]);c.x===s.x&&c.y===s.y||(this.segments.push(R.fromRing(s,c,this)),c.x<this.bbox.ll.x&&(this.bbox.ll.x=c.x),c.y<this.bbox.ll.y&&(this.bbox.ll.y=c.y),c.x>this.bbox.ur.x&&(this.bbox.ur.x=c.x),c.y>this.bbox.ur.y&&(this.bbox.ur.y=c.y),s=c)}o.x===s.x&&o.y===s.y||this.segments.push(R.fromRing(s,o,this))}return n(e,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.segments.length;e<n;e++){var r=this.segments[e];t.push(r.leftSE),t.push(r.rightSE)}return t}}]),e}(),D=function(){function e(n,r){if(t(this,e),!Array.isArray(n))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new O(n[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var i=1,o=n.length;i<o;i++){var s=new O(n[i],this,!1);s.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.interiorRings.push(s)}this.multiPoly=r}return n(e,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,n=this.interiorRings.length;e<n;e++)for(var r=this.interiorRings[e].getSweepEvents(),i=0,o=r.length;i<o;i++)t.push(r[i]);return t}}]),e}(),B=function(){function e(n,r){if(t(this,e),!Array.isArray(n))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof n[0][0][0]&&(n=[n])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var i=0,o=n.length;i<o;i++){var s=new D(n[i],this);s.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.polys.push(s)}this.isSubject=r}return n(e,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.polys.length;e<n;e++)for(var r=this.polys[e].getSweepEvents(),i=0,o=r.length;i<o;i++)t.push(r[i]);return t}}]),e}(),F=function(){function e(n){t(this,e),this.events=n;for(var r=0,i=n.length;r<i;r++)n[r].segment.ringOut=this;this.poly=null}return n(e,null,[{key:"factory",value:function(t){for(var n=[],r=0,i=t.length;r<i;r++){var o=t[r];if(o.isInResult()&&!o.ringOut){for(var s=null,a=o.leftSE,u=o.rightSE,c=[a],l=a.point,h=[];s=a,a=u,c.push(a),a.point!==l;)for(;;){var p=a.getAvailableLinkedEvents();if(0===p.length){var f=c[0].point,d=c[c.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(f.x,",")+" ".concat(f.y,"]. Last matching segment found ends at")+" [".concat(d.x,", ").concat(d.y,"]."))}if(1===p.length){u=p[0].otherSE;break}for(var g=null,m=0,v=h.length;m<v;m++)if(h[m].point===a.point){g=m;break}if(null===g){h.push({index:c.length,point:a.point});var y=a.getLeftmostComparator(s);u=p.sort(y)[0].otherSE;break}var x=h.splice(g)[0],b=c.splice(x.index);b.unshift(b[0].otherSE),n.push(new e(b.reverse()))}n.push(new e(c))}}return n}}]),n(e,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],n=1,r=this.events.length-1;n<r;n++){var i=this.events[n].point,o=this.events[n+1].point;0!==S(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],a=e[1];0===S(s,t,a)&&e.shift(),e.push(e[0]);for(var u=this.isExteriorRing()?1:-1,c=this.isExteriorRing()?0:e.length-1,l=this.isExteriorRing()?e.length:-1,h=[],p=c;p!=l;p+=u)h.push([e[p].x,e[p].y]);return h}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,n=this.events.length;e<n;e++){var r=this.events[e];I.compare(t,r)>0&&(t=r)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),e}(),N=function(){function e(n){t(this,e),this.exteriorRing=n,n.poly=this,this.interiorRings=[]}return n(e,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,n=this.interiorRings.length;e<n;e++){var r=this.interiorRings[e].getGeom();null!==r&&t.push(r)}return t}}]),e}(),k=function(){function e(n){t(this,e),this.rings=n,this.polys=this._composePolys(n)}return n(e,[{key:"getGeom",value:function(){for(var t=[],e=0,n=this.polys.length;e<n;e++){var r=this.polys[e].getGeom();null!==r&&t.push(r)}return t}},{key:"_composePolys",value:function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];if(!i.poly)if(i.isExteriorRing())e.push(new N(i));else{var o=i.enclosingRing();o.poly||e.push(new N(o)),o.poly.addInterior(i)}}return e}}]),e}(),G=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:R.compare;t(this,e),this.queue=n,this.tree=new c(r),this.segments=[]}return n(e,[{key:"process",value:function(t){var e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;var r=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!r)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=r,o=r,s=void 0,a=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===a;)null===(o=this.tree.next(o))?a=null:void 0===o.key.consumedBy&&(a=o.key);if(t.isLeft){var u=null;if(s){var c=s.getIntersection(e);if(null!==c&&(e.isAnEndpoint(c)||(u=c),!s.isAnEndpoint(c)))for(var l=this._splitSafely(s,c),h=0,p=l.length;h<p;h++)n.push(l[h])}var f=null;if(a){var d=a.getIntersection(e);if(null!==d&&(e.isAnEndpoint(d)||(f=d),!a.isAnEndpoint(d)))for(var g=this._splitSafely(a,d),m=0,v=g.length;m<v;m++)n.push(g[m])}if(null!==u||null!==f){var y=null;y=null===u?f:null===f||I.comparePoints(u,f)<=0?u:f,this.queue.remove(e.rightSE),n.push(e.rightSE);for(var x=e.split(y),b=0,_=x.length;b<_;b++)n.push(x[b])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&a){var w=s.getIntersection(a);if(null!==w){if(!s.isAnEndpoint(w))for(var M=this._splitSafely(s,w),E=0,S=M.length;E<S;E++)n.push(M[E]);if(!a.isAnEndpoint(w))for(var A=this._splitSafely(a,w),C=0,T=A.length;C<T;C++)n.push(A[C])}}this.tree.remove(e)}return n}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var n=t.rightSE;this.queue.remove(n);var r=t.split(e);return r.push(n),void 0===t.consumedBy&&this.tree.insert(t),r}}]),e}(),U=new(function(){function e(){t(this,e)}return n(e,[{key:"run",value:function(t,e,n){U.type=t,w.reset();for(var r=[new B(e,!0)],i=0,o=n.length;i<o;i++)r.push(new B(n[i],!1));if(U.numMultiPolys=r.length,"difference"===U.type)for(var s=r[0],a=1;a<r.length;)null!==m(r[a].bbox,s.bbox)?a++:r.splice(a,1);if("intersection"===U.type)for(var u=0,l=r.length;u<l;u++)for(var h=r[u],p=u+1,f=r.length;p<f;p++)if(null===m(h.bbox,r[p].bbox))return[];for(var d=new c(I.compare),g=0,v=r.length;g<v;g++)for(var y=r[g].getSweepEvents(),x=0,b=y.length;x<b;x++)d.insert(y[x]);for(var _=new G(d),M=d.size,E=d.pop();E;){var S=E.key;if(d.size===M){var A=S.segment;throw new Error("Unable to pop() ".concat(S.isLeft?"left":"right"," SweepEvent ")+"[".concat(S.point.x,", ").concat(S.point.y,"] from segment #").concat(A.id," ")+"[".concat(A.leftSE.point.x,", ").concat(A.leftSE.point.y,"] -> ")+"[".concat(A.rightSE.point.x,", ").concat(A.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}for(var C=_.process(S),T=0,P=C.length;T<P;T++){var L=C[T];void 0===L.consumedBy&&d.insert(L)}M=d.size,E=d.pop()}w.reset();var R=F.factory(_.segments);return new k(R).getGeom()}}]),e}());return{union:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return U.run("union",t,n)},intersection:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return U.run("intersection",t,n)},xor:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return U.run("xor",t,n)},difference:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return U.run("difference",t,n)}}}()},"3Eq5":function(t,e,n){"use strict";var r=n("We1y"),i=n("cjT7");t.exports=function(t,e){var n=t[e];return i(n)?void 0:r(n)}},"3MOf":function(t,e,n){"use strict";var r=n("rpNk").IteratorPrototype,i=n("fHMY"),o=n("XGwC"),s=n("1E5z"),a=n("P4y1"),u=function(){return this};t.exports=function(t,e,n,c){var l=e+" Iterator";return t.prototype=i(r,{next:o(+!c,n)}),s(t,l,!1,!0),a[l]=u,t}},"3bBZ":function(t,e,n){"use strict";var r=n("z+kr"),i=n("/byt"),o=n("eFrH"),s=n("4mDm"),a=n("kRJp"),u=n("1E5z"),c=n("tiKp")("iterator"),l=s.values,h=function(t,e){if(t){if(t[c]!==l)try{a(t,c,l)}catch(e){t[c]=l}if(u(t,e,!0),i[e])for(var n in s)if(t[n]!==s[n])try{a(t,n,s[n])}catch(e){t[n]=s[n]}}};for(var p in i)h(r[p]&&r[p].prototype,p);h(o,"DOMTokenList")},"469k":function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("8LQ0"),a=n("/OYL"),u=n("RUZL"),c=n("13ei"),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype._sceneFunc=function(t){var e=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();t.beginPath(),t.moveTo(0,0-n);for(var i=1;i<2*r;i++){var o=i%2==0?n:e,s=o*Math.sin(i*Math.PI/r),a=-1*o*Math.cos(i*Math.PI/r);t.lineTo(s,a)}t.closePath(),t.fillStrokeShape(this)},e.prototype.getWidth=function(){return 2*this.outerRadius()},e.prototype.getHeight=function(){return 2*this.outerRadius()},e.prototype.setWidth=function(t){this.outerRadius(t/2)},e.prototype.setHeight=function(t){this.outerRadius(t/2)},e}(a.Shape);e.Star=l,l.prototype.className="Star",l.prototype._centroid=!0,l.prototype._attrsAffectingSize=["innerRadius","outerRadius"],c._registerNode(l),s.Factory.addGetterSetter(l,"numPoints",5,u.getNumberValidator()),s.Factory.addGetterSetter(l,"innerRadius",0,u.getNumberValidator()),s.Factory.addGetterSetter(l,"outerRadius",0,u.getNumberValidator()),o.Collection.mapMethods(l)},"4Brf":function(t,e,n){"use strict";var r=n("I+eb"),i=n("g6v/"),o=n("z+kr"),s=n("4zBA"),a=n("Gi26"),u=n("Fib7"),c=n("OpvP"),l=n("V37c"),h=n("7dAM"),p=n("6JNq"),f=o.Symbol,d=f&&f.prototype;if(i&&u(f)&&(!("description"in d)||void 0!==f().description)){var g={},m=function(){var t=arguments.length<1||void 0===arguments[0]?void 0:l(arguments[0]),e=c(d,this)?new f(t):void 0===t?f():f(t);return""===t&&(g[e]=!0),e};p(m,f),m.prototype=d,d.constructor=m;var v="Symbol(description detection)"===String(f("description detection")),y=s(d.valueOf),x=s(d.toString),b=/^Symbol\((.*)\)[^)]+$/,_=s("".replace),w=s("".slice);h(d,"description",{configurable:!0,get:function(){var t=y(this);if(a(g,t))return"";var e=x(t),n=v?w(e,7,-1):_(e,b,"$1");return""===n?void 0:n}}),r({global:!0,constructor:!0,forced:!0},{Symbol:m})}},"4GWN":function(t,e,n){"use strict";var r=n("Qo9l"),i=n("Gi26"),o=n("5Tg+"),s=n("m/L8").f;t.exports=function(t){var e=r.Symbol||(r.Symbol={});i(e,t)||s(e,t,{value:o.f(t)})}},"4WOD":function(t,e,n){"use strict";var r=n("Gi26"),i=n("Fib7"),o=n("ewvW"),s=n("93I0"),a=n("4Xet"),u=s("IE_PROTO"),c=Object,l=c.prototype;t.exports=a?c.getPrototypeOf:function(t){var e=o(t);if(r(e,u))return e[u];var n=e.constructor;return i(n)&&e instanceof n?n.prototype:e instanceof c?l:null}},"4Xet":function(t,e,n){"use strict";var r=n("0Dky");t.exports=!r((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},"4mDm":function(t,e,n){"use strict";var r=n("/GqU"),i=n("RNIs"),o=n("P4y1"),s=n("afO8"),a=n("m/L8").f,u=n("xtKg"),c=n("R1RC"),l=n("xDBR"),h=n("g6v/"),p=s.set,f=s.getterFor("Array Iterator");t.exports=u(Array,"Array",(function(t,e){p(this,{type:"Array Iterator",target:r(t),index:0,kind:e})}),(function(){var t=f(this),e=t.target,n=t.index++;if(!e||n>=e.length)return t.target=null,c(void 0,!0);switch(t.kind){case"keys":return c(n,!1);case"values":return c(e[n],!1)}return c([n,e[n]],!1)}),"values");var d=o.Arguments=o.Array;if(i("keys"),i("values"),i("entries"),!l&&h&&"values"!==d.name)try{a(d,"name",{value:"values"})}catch(t){}},"4mfi":function(t,e,n){"use strict";var r=n("4zBA"),i=n("6LWA"),o=n("Fib7"),s=n("xrYK"),a=n("V37c"),u=r([].push);t.exports=function(t){if(o(t))return t;if(i(t)){for(var e=t.length,n=[],r=0;r<e;r++){var c=t[r];"string"==typeof c?u(n,c):"number"!=typeof c&&"Number"!==s(c)&&"String"!==s(c)||u(n,a(c))}var l=n.length,h=!0;return function(t,e){if(h)return h=!1,e;if(i(this))return e;for(var r=0;r<l;r++)if(n[r]===t)return e}}}},"4zBA":function(t,e,n){"use strict";var r=n("QNWe"),i=Function.prototype,o=i.call,s=r&&i.bind.bind(o,o);t.exports=r?s:function(t){return function(){return o.apply(t,arguments)}}},"5DmW":function(t,e,n){"use strict";var r=n("I+eb"),i=n("0Dky"),o=n("/GqU"),s=n("Bs8V").f,a=n("g6v/");r({target:"Object",stat:!0,forced:!a||i((function(){s(1)})),sham:!a},{getOwnPropertyDescriptor:function(t,e){return s(o(t),e)}})},"5LDq":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("8LQ0"),i=n("SXH2"),o=n("nLhi"),s=n("RUZL");e.Emboss=function(t){var e=10*this.embossStrength(),n=255*this.embossWhiteLevel(),r=this.embossDirection(),i=this.embossBlend(),s=0,a=0,u=t.data,c=t.width,l=t.height,h=4*c,p=l;switch(r){case"top-left":s=-1,a=-1;break;case"top":s=-1,a=0;break;case"top-right":s=-1,a=1;break;case"right":s=0,a=1;break;case"bottom-right":s=1,a=1;break;case"bottom":s=1,a=0;break;case"bottom-left":s=1,a=-1;break;case"left":s=0,a=-1;break;default:o.Util.error("Unknown emboss direction: "+r)}do{var f=(p-1)*h,d=s;p+d<1&&(d=0),p+d>l&&(d=0);var g=(p-1+d)*c*4,m=c;do{var v=f+4*(m-1),y=a;m+y<1&&(y=0),m+y>c&&(y=0);var x=g+4*(m-1+y),b=u[v]-u[x],_=u[v+1]-u[x+1],w=u[v+2]-u[x+2],M=b,E=M>0?M:-M;if((_>0?_:-_)>E&&(M=_),(w>0?w:-w)>E&&(M=w),M*=e,i){var S=u[v]+M,A=u[v+1]+M,C=u[v+2]+M;u[v]=S>255?255:S<0?0:S,u[v+1]=A>255?255:A<0?0:A,u[v+2]=C>255?255:C<0?0:C}else{var T=n-M;T<0?T=0:T>255&&(T=255),u[v]=u[v+1]=u[v+2]=T}}while(--m)}while(--p)},r.Factory.addGetterSetter(i.Node,"embossStrength",.5,s.getNumberValidator(),r.Factory.afterSetFilter),r.Factory.addGetterSetter(i.Node,"embossWhiteLevel",.5,s.getNumberValidator(),r.Factory.afterSetFilter),r.Factory.addGetterSetter(i.Node,"embossDirection","top-left",null,r.Factory.afterSetFilter),r.Factory.addGetterSetter(i.Node,"embossBlend",!1,null,r.Factory.afterSetFilter)},"5Tg+":function(t,e,n){"use strict";var r=n("tiKp");e.f=r},"5Yz+":function(t,e,n){"use strict";var r=n("K6Rb"),i=n("/GqU"),o=n("WSbT"),s=n("B/qT"),a=n("pkCn"),u=Math.min,c=[].lastIndexOf,l=!!c&&1/[1].lastIndexOf(1,-0)<0,h=a("lastIndexOf"),p=l||!h;t.exports=p?function(t){if(l)return r(c,this,arguments)||0;var e=i(this),n=s(e);if(0===n)return-1;var a=n-1;for(arguments.length>1&&(a=u(a,o(arguments[1]))),a<0&&(a=n+a);a>=0;a--)if(a in e&&e[a]===t)return a||0;return-1}:c},"5mdu":function(t,e,n){"use strict";t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},"5oMp":function(t,e,n){"use strict";t.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}},"5s+n":function(t,e,n){"use strict";n("Xn6M"),n("FOUG"),n("zJiX"),n("NSnw"),n("8itv"),n("cUmr")},"66Qi":function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("8LQ0"),a=n("6mFz"),u=n("13ei"),c=n("9lVk"),l=n("35O5"),h=n("13ei"),p=n("fSr5"),f=["mouseenter","mousedown","mousemove","mouseup","mouseout","touchstart","touchmove","touchend","mouseover","wheel","contextmenu","pointerdown","pointermove","pointerup","pointercancel","lostpointercapture"],d=f.length;function g(t,e){t.content.addEventListener(e,(function(n){t["_"+e](n)}),!1)}function m(t){return void 0===t&&(t={}),(t.clipFunc||t.clipWidth||t.clipHeight)&&o.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),t}e.stages=[];var v=function(t){function n(n){var r=t.call(this,m(n))||this;return r._pointerPositions=[],r._changedPointerPositions=[],r._buildDOM(),r._bindContentEvents(),e.stages.push(r),r.on("widthChange.konva heightChange.konva",r._resizeDOM),r.on("visibleChange.konva",r._checkVisibility),r.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",(function(){m(r.attrs)})),r._checkVisibility(),r}return i(n,t),n.prototype._validateAdd=function(t){var e="Layer"===t.getType(),n="FastLayer"===t.getType();e||n||o.Util.throw("You may only add layers to the stage.")},n.prototype._checkVisibility=function(){if(this.content){var t=this.visible()?"":"none";this.content.style.display=t}},n.prototype.setContainer=function(t){if("string"==typeof t){if("."===t.charAt(0)){var e=t.slice(1);t=document.getElementsByClassName(e)[0]}else{var n;n="#"!==t.charAt(0)?t:t.slice(1),t=document.getElementById(n)}if(!t)throw"Can not find container in document with id "+n}return this._setAttr("container",t),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),t.appendChild(this.content)),this},n.prototype.shouldDrawHit=function(){return!0},n.prototype.clear=function(){var t,e=this.children,n=e.length;for(t=0;t<n;t++)e[t].clear();return this},n.prototype.clone=function(t){return t||(t={}),t.container=document.createElement("div"),a.Container.prototype.clone.call(this,t)},n.prototype.destroy=function(){t.prototype.destroy.call(this);var n=this.content;n&&o.Util._isInDocument(n)&&this.container().removeChild(n);var r=e.stages.indexOf(this);return r>-1&&e.stages.splice(r,1),this},n.prototype.getPointerPosition=function(){var t=this._pointerPositions[0]||this._changedPointerPositions[0];return t?{x:t.x,y:t.y}:(o.Util.warn("Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);"),null)},n.prototype._getPointerById=function(t){return this._pointerPositions.find((function(e){return e.id===t}))},n.prototype.getPointersPositions=function(){return this._pointerPositions},n.prototype.getStage=function(){return this},n.prototype.getContent=function(){return this.content},n.prototype._toKonvaCanvas=function(t){var e=(t=t||{}).x||0,n=t.y||0,r=new c.SceneCanvas({width:t.width||this.width(),height:t.height||this.height(),pixelRatio:t.pixelRatio||1}),i=r.getContext()._context,o=this.children;return(e||n)&&i.translate(-1*e,-1*n),o.each((function(r){if(r.isVisible()){var o=r._toKonvaCanvas(t);i.drawImage(o._canvas,e,n,o.getWidth()/o.getPixelRatio(),o.getHeight()/o.getPixelRatio())}})),r},n.prototype.getIntersection=function(t,e){if(!t)return null;var n,r,i=this.children;for(n=i.length-1;n>=0;n--)if(r=i[n].getIntersection(t,e))return r;return null},n.prototype._resizeDOM=function(){var t=this.width(),e=this.height();this.content&&(this.content.style.width=t+"px",this.content.style.height=e+"px"),this.bufferCanvas.setSize(t,e),this.bufferHitCanvas.setSize(t,e),this.children.each((function(n){n.setSize({width:t,height:e}),n.draw()}))},n.prototype.add=function(e){if(arguments.length>1){for(var n=0;n<arguments.length;n++)this.add(arguments[n]);return this}t.prototype.add.call(this,e);var r=this.children.length;return r>5&&o.Util.warn("The stage has "+r+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e._setCanvasSize(this.width(),this.height()),e.draw(),u.Konva.isBrowser&&this.content.appendChild(e.canvas._canvas),this},n.prototype.getParent=function(){return null},n.prototype.getLayer=function(){return null},n.prototype.hasPointerCapture=function(t){return p.hasPointerCapture(t,this)},n.prototype.setPointerCapture=function(t){p.setPointerCapture(t,this)},n.prototype.releaseCapture=function(t){p.releaseCapture(t,this)},n.prototype.getLayers=function(){return this.getChildren()},n.prototype._bindContentEvents=function(){if(u.Konva.isBrowser)for(var t=0;t<d;t++)g(this,f[t])},n.prototype._mouseenter=function(t){this.setPointersPositions(t),this._fire("mouseenter",{evt:t,target:this,currentTarget:this})},n.prototype._mouseover=function(t){this.setPointersPositions(t),this._fire("contentMouseover",{evt:t}),this._fire("mouseover",{evt:t,target:this,currentTarget:this})},n.prototype._mouseout=function(t){this.setPointersPositions(t);var e=this.targetShape,n=!l.DD.isDragging||u.Konva.hitOnDragEnabled;e&&n?(e._fireAndBubble("mouseout",{evt:t}),e._fireAndBubble("mouseleave",{evt:t}),this._fire("mouseleave",{evt:t,target:this,currentTarget:this}),this.targetShape=null):n&&(this._fire("mouseleave",{evt:t,target:this,currentTarget:this}),this._fire("mouseout",{evt:t,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[],this._fire("contentMouseout",{evt:t})},n.prototype._mousemove=function(t){if(u.Konva.UA.ieMobile)return this._touchmove(t);this.setPointersPositions(t);var e,n=o.Util._getFirstPointerId(t),r=!l.DD.isDragging||u.Konva.hitOnDragEnabled;if(r){if((e=this.getIntersection(this.getPointerPosition()))&&e.isListening()){var i=!this.targetShape||this.targetShape!==e;r&&i?(this.targetShape&&(this.targetShape._fireAndBubble("mouseout",{evt:t,pointerId:n},e),this.targetShape._fireAndBubble("mouseleave",{evt:t,pointerId:n},e)),e._fireAndBubble("mouseover",{evt:t,pointerId:n},this.targetShape),e._fireAndBubble("mouseenter",{evt:t,pointerId:n},this.targetShape),e._fireAndBubble("mousemove",{evt:t,pointerId:n}),this.targetShape=e):e._fireAndBubble("mousemove",{evt:t,pointerId:n})}else this.targetShape&&r&&(this.targetShape._fireAndBubble("mouseout",{evt:t,pointerId:n}),this.targetShape._fireAndBubble("mouseleave",{evt:t,pointerId:n}),this._fire("mouseover",{evt:t,target:this,currentTarget:this,pointerId:n}),this.targetShape=null),this._fire("mousemove",{evt:t,target:this,currentTarget:this,pointerId:n});this._fire("contentMousemove",{evt:t})}t.cancelable&&t.preventDefault()},n.prototype._mousedown=function(t){if(u.Konva.UA.ieMobile)return this._touchstart(t);this.setPointersPositions(t);var e=o.Util._getFirstPointerId(t),n=this.getIntersection(this.getPointerPosition());l.DD.justDragged=!1,u.Konva.listenClickTap=!0,n&&n.isListening()?(this.clickStartShape=n,n._fireAndBubble("mousedown",{evt:t,pointerId:e})):this._fire("mousedown",{evt:t,target:this,currentTarget:this,pointerId:e}),this._fire("contentMousedown",{evt:t})},n.prototype._mouseup=function(t){if(u.Konva.UA.ieMobile)return this._touchend(t);this.setPointersPositions(t);var e=o.Util._getFirstPointerId(t),n=this.getIntersection(this.getPointerPosition()),r=this.clickStartShape,i=this.clickEndShape,s=!1;u.Konva.inDblClickWindow?(s=!0,clearTimeout(this.dblTimeout)):l.DD.justDragged||(u.Konva.inDblClickWindow=!0,clearTimeout(this.dblTimeout)),this.dblTimeout=setTimeout((function(){u.Konva.inDblClickWindow=!1}),u.Konva.dblClickWindow),n&&n.isListening()?(this.clickEndShape=n,n._fireAndBubble("mouseup",{evt:t,pointerId:e}),u.Konva.listenClickTap&&r&&r._id===n._id&&(n._fireAndBubble("click",{evt:t,pointerId:e}),s&&i&&i===n&&n._fireAndBubble("dblclick",{evt:t,pointerId:e}))):(this._fire("mouseup",{evt:t,target:this,currentTarget:this,pointerId:e}),u.Konva.listenClickTap&&this._fire("click",{evt:t,target:this,currentTarget:this,pointerId:e}),s&&this._fire("dblclick",{evt:t,target:this,currentTarget:this,pointerId:e})),this._fire("contentMouseup",{evt:t}),u.Konva.listenClickTap&&(this._fire("contentClick",{evt:t}),s&&this._fire("contentDblclick",{evt:t})),u.Konva.listenClickTap=!1,t.cancelable&&t.preventDefault()},n.prototype._contextmenu=function(t){this.setPointersPositions(t);var e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble("contextmenu",{evt:t}):this._fire("contextmenu",{evt:t,target:this,currentTarget:this}),this._fire("contentContextmenu",{evt:t})},n.prototype._touchstart=function(t){var e=this;this.setPointersPositions(t);var n=!1;this._changedPointerPositions.forEach((function(r){var i=e.getIntersection(r);u.Konva.listenClickTap=!0,l.DD.justDragged=!1,i&&i.isListening()&&(u.Konva.captureTouchEventsEnabled&&i.setPointerCapture(r.id),e.tapStartShape=i,i._fireAndBubble("touchstart",{evt:t,pointerId:r.id},e),n=!0,i.isListening()&&i.preventDefault()&&t.cancelable&&t.preventDefault())})),n||this._fire("touchstart",{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),this._fire("contentTouchstart",{evt:t})},n.prototype._touchmove=function(t){var e=this;if(this.setPointersPositions(t),!l.DD.isDragging||u.Konva.hitOnDragEnabled){var n=!1,r={};this._changedPointerPositions.forEach((function(i){var o=p.getCapturedShape(i.id)||e.getIntersection(i);o&&o.isListening()&&(r[o._id]||(r[o._id]=!0,o._fireAndBubble("touchmove",{evt:t,pointerId:i.id}),n=!0,o.isListening()&&o.preventDefault()&&t.cancelable&&t.preventDefault()))})),n||this._fire("touchmove",{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),this._fire("contentTouchmove",{evt:t})}l.DD.isDragging&&l.DD.node.preventDefault()&&t.cancelable&&t.preventDefault()},n.prototype._touchend=function(t){var e=this;this.setPointersPositions(t);var n=this.clickEndShape,r=!1;u.Konva.inDblClickWindow?(r=!0,clearTimeout(this.dblTimeout)):l.DD.justDragged||(u.Konva.inDblClickWindow=!0,clearTimeout(this.dblTimeout)),this.dblTimeout=setTimeout((function(){u.Konva.inDblClickWindow=!1}),u.Konva.dblClickWindow);var i=!1,o={},s=!1,a=!1;this._changedPointerPositions.forEach((function(c){var l=p.getCapturedShape(c.id)||e.getIntersection(c);l&&l.releaseCapture(c.id),l&&l.isListening()&&(o[l._id]||(o[l._id]=!0,e.clickEndShape=l,l._fireAndBubble("touchend",{evt:t,pointerId:c.id}),i=!0,u.Konva.listenClickTap&&l===e.tapStartShape&&(s=!0,l._fireAndBubble("tap",{evt:t,pointerId:c.id}),r&&n&&n===l&&(a=!0,l._fireAndBubble("dbltap",{evt:t,pointerId:c.id}))),l.isListening()&&l.preventDefault()&&t.cancelable&&t.preventDefault()))})),i||this._fire("touchend",{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),u.Konva.listenClickTap&&!s&&this._fire("tap",{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),r&&!a&&this._fire("dbltap",{evt:t,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),this._fire("contentTouchend",{evt:t}),u.Konva.listenClickTap&&(this._fire("contentTap",{evt:t}),r&&this._fire("contentDbltap",{evt:t})),u.Konva.listenClickTap=!1},n.prototype._wheel=function(t){this.setPointersPositions(t);var e=this.getIntersection(this.getPointerPosition());e&&e.isListening()?e._fireAndBubble("wheel",{evt:t}):this._fire("wheel",{evt:t,target:this,currentTarget:this}),this._fire("contentWheel",{evt:t})},n.prototype._pointerdown=function(t){if(u.Konva._pointerEventsEnabled){this.setPointersPositions(t);var e=p.getCapturedShape(t.pointerId)||this.getIntersection(this.getPointerPosition());e&&e._fireAndBubble("pointerdown",p.createEvent(t))}},n.prototype._pointermove=function(t){if(u.Konva._pointerEventsEnabled){this.setPointersPositions(t);var e=p.getCapturedShape(t.pointerId)||this.getIntersection(this.getPointerPosition());e&&e._fireAndBubble("pointermove",p.createEvent(t))}},n.prototype._pointerup=function(t){if(u.Konva._pointerEventsEnabled){this.setPointersPositions(t);var e=p.getCapturedShape(t.pointerId)||this.getIntersection(this.getPointerPosition());e&&e._fireAndBubble("pointerup",p.createEvent(t)),p.releaseCapture(t.pointerId)}},n.prototype._pointercancel=function(t){if(u.Konva._pointerEventsEnabled){this.setPointersPositions(t);var e=p.getCapturedShape(t.pointerId)||this.getIntersection(this.getPointerPosition());e&&e._fireAndBubble("pointerup",p.createEvent(t)),p.releaseCapture(t.pointerId)}},n.prototype._lostpointercapture=function(t){p.releaseCapture(t.pointerId)},n.prototype.setPointersPositions=function(t){var e=this,n=this._getContentPosition(),r=null,i=null;void 0!==(t=t||window.event).touches?(this._pointerPositions=[],this._changedPointerPositions=[],o.Collection.prototype.each.call(t.touches,(function(t){e._pointerPositions.push({id:t.identifier,x:(t.clientX-n.left)/n.scaleX,y:(t.clientY-n.top)/n.scaleY})})),o.Collection.prototype.each.call(t.changedTouches||t.touches,(function(t){e._changedPointerPositions.push({id:t.identifier,x:(t.clientX-n.left)/n.scaleX,y:(t.clientY-n.top)/n.scaleY})}))):(r=(t.clientX-n.left)/n.scaleX,i=(t.clientY-n.top)/n.scaleY,this.pointerPos={x:r,y:i},this._pointerPositions=[{x:r,y:i,id:o.Util._getFirstPointerId(t)}],this._changedPointerPositions=[{x:r,y:i,id:o.Util._getFirstPointerId(t)}])},n.prototype._setPointerPosition=function(t){o.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(t)},n.prototype._getContentPosition=function(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var t=this.content.getBoundingClientRect();return{top:t.top,left:t.left,scaleX:t.width/this.content.clientWidth||1,scaleY:t.height/this.content.clientHeight||1}},n.prototype._buildDOM=function(){if(this.bufferCanvas=new c.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new c.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),u.Konva.isBrowser){var t=this.container();if(!t)throw"Stage has no container. A container is required.";t.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),t.appendChild(this.content),this._resizeDOM()}},n.prototype.cache=function(){return o.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this},n.prototype.clearCache=function(){return this},n.prototype.batchDraw=function(){return this.children.each((function(t){t.batchDraw()})),this},n}(a.Container);e.Stage=v,v.prototype.nodeType="Stage",h._registerNode(v),s.Factory.addGetterSetter(v,"container")},"67WC":function(t,e,n){"use strict";var r,i,o,s=n("SxGu"),a=n("g6v/"),u=n("z+kr"),c=n("Fib7"),l=n("hh1v"),h=n("Gi26"),p=n("9d/t"),f=n("DVFp"),d=n("kRJp"),g=n("yy0I"),m=n("7dAM"),v=n("OpvP"),y=n("4WOD"),x=n("0rvr"),b=n("tiKp"),_=n("kOOl"),w=n("afO8"),M=w.enforce,E=w.get,S=u.Int8Array,A=S&&S.prototype,C=u.Uint8ClampedArray,T=C&&C.prototype,P=S&&y(S),I=A&&y(A),L=Object.prototype,R=u.TypeError,O=b("toStringTag"),D=_("TYPED_ARRAY_TAG"),B=s&&!!x&&"Opera"!==p(u.opera),F=!1,N={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},k={BigInt64Array:8,BigUint64Array:8},G=function(t){var e=y(t);if(l(e)){var n=E(e);return n&&h(n,"TypedArrayConstructor")?n.TypedArrayConstructor:G(e)}},U=function(t){if(!l(t))return!1;var e=p(t);return h(N,e)||h(k,e)};for(r in N)(o=(i=u[r])&&i.prototype)?M(o).TypedArrayConstructor=i:B=!1;for(r in k)(o=(i=u[r])&&i.prototype)&&(M(o).TypedArrayConstructor=i);if((!B||!c(P)||P===Function.prototype)&&(P=function(){throw new R("Incorrect invocation")},B))for(r in N)u[r]&&x(u[r],P);if((!B||!I||I===L)&&(I=P.prototype,B))for(r in N)u[r]&&x(u[r].prototype,I);if(B&&y(T)!==I&&x(T,I),a&&!h(I,O))for(r in F=!0,m(I,O,{configurable:!0,get:function(){return l(this)?this[D]:void 0}}),N)u[r]&&d(u[r],D,r);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:B,TYPED_ARRAY_TAG:F&&D,aTypedArray:function(t){if(U(t))return t;throw new R("Target is not a typed array")},aTypedArrayConstructor:function(t){if(c(t)&&(!x||v(P,t)))return t;throw new R(f(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,e,n,r){if(a){if(n)for(var i in N){var o=u[i];if(o&&h(o.prototype,t))try{delete o.prototype[t]}catch(n){try{o.prototype[t]=e}catch(t){}}}I[t]&&!n||g(I,t,n?e:B&&A[t]||e,r)}},exportTypedArrayStaticMethod:function(t,e,n){var r,i;if(a){if(x){if(n)for(r in N)if((i=u[r])&&h(i,t))try{delete i[t]}catch(t){}if(P[t]&&!n)return;try{return g(P,t,n?e:B&&P[t]||e)}catch(t){}}for(r in N)!(i=u[r])||i[t]&&!n||g(i,t,e)}},getTypedArrayConstructor:G,isView:function(t){if(!l(t))return!1;var e=p(t);return"DataView"===e||h(N,e)||h(k,e)},isTypedArray:U,TypedArray:P,TypedArrayPrototype:I}},"68E8":function(t,e,n){"use strict";var r=n("tdvT");t.exports=/ipad|iphone|ipod/i.test(r)&&"undefined"!=typeof Pebble},"6JNq":function(t,e,n){"use strict";var r=n("Gi26"),i=n("Vu81"),o=n("Bs8V"),s=n("m/L8");t.exports=function(t,e,n){for(var a=i(e),u=s.f,c=o.f,l=0;l<a.length;l++){var h=a[l];r(t,h)||n&&r(n,h)||u(t,h,c(e,h))}}},"6LWA":function(t,e,n){"use strict";var r=n("xrYK");t.exports=Array.isArray||function(t){return"Array"===r(t)}},"6R/c":function(t,e,n){"use strict";var r=n("67WC"),i=n("TWQb").indexOf,o=r.aTypedArray;(0,r.exportTypedArrayMethod)("indexOf",(function(t){return i(o(this),t,arguments.length>1?arguments[1]:void 0)}))},"6VoE":function(t,e,n){"use strict";var r=n("tiKp"),i=n("P4y1"),o=r("iterator"),s=Array.prototype;t.exports=function(t){return void 0!==t&&(i.Array===t||s[o]===t)}},"6cQw":function(t,e,n){"use strict";var r=n("I+eb"),i=n("0GbY"),o=n("K6Rb"),s=n("xluM"),a=n("4zBA"),u=n("0Dky"),c=n("Fib7"),l=n("2bX/"),h=n("82ph"),p=n("4mfi"),f=n("BPiQ"),d=String,g=i("JSON","stringify"),m=a(/./.exec),v=a("".charAt),y=a("".charCodeAt),x=a("".replace),b=a(1..toString),_=/[\uD800-\uDFFF]/g,w=/^[\uD800-\uDBFF]$/,M=/^[\uDC00-\uDFFF]$/,E=!f||u((function(){var t=i("Symbol")("stringify detection");return"[null]"!==g([t])||"{}"!==g({a:t})||"{}"!==g(Object(t))})),S=u((function(){return'"\\udf06\\ud834"'!==g("\udf06\ud834")||'"\\udead"'!==g("\udead")})),A=function(t,e){var n=h(arguments),r=p(e);if(c(r)||void 0!==t&&!l(t))return n[1]=function(t,e){if(c(r)&&(e=s(r,this,d(t),e)),!l(e))return e},o(g,null,n)},C=function(t,e,n){var r=v(n,e-1),i=v(n,e+1);return m(w,t)&&!m(M,i)||m(M,t)&&!m(w,r)?"\\u"+b(y(t,0),16):t};g&&r({target:"JSON",stat:!0,arity:3,forced:E||S},{stringify:function(t,e,n){var r=h(arguments),i=o(E?A:g,null,r);return S&&"string"==typeof i?x(i,_,C):i}})},"6mFz":function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("8LQ0"),a=n("SXH2"),u=n("35O5"),c=n("RUZL"),l=n("13ei"),h=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.children=new o.Collection,e}return i(e,t),e.prototype.getChildren=function(t){if(!t)return this.children;var e=new o.Collection;return this.children.each((function(n){t(n)&&e.push(n)})),e},e.prototype.hasChildren=function(){return this.getChildren().length>0},e.prototype.removeChildren=function(){for(var t,e=0;e<this.children.length;e++)(t=this.children[e]).parent=null,t.index=0,t.remove();return this.children=new o.Collection,this},e.prototype.destroyChildren=function(){for(var t,e=0;e<this.children.length;e++)(t=this.children[e]).parent=null,t.index=0,t.destroy();return this.children=new o.Collection,this},e.prototype.add=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(arguments.length>1){for(var n=0;n<arguments.length;n++)this.add(arguments[n]);return this}var r=t[0];if(r.getParent())return r.moveTo(this),this;var i=this.children;return this._validateAdd(r),r._clearCaches(),r.index=i.length,r.parent=this,i.push(r),this._fire("add",{child:r}),this},e.prototype.destroy=function(){return this.hasChildren()&&this.destroyChildren(),t.prototype.destroy.call(this),this},e.prototype.find=function(t){return this._generalFind(t,!1)},e.prototype.get=function(t){return o.Util.warn("collection.get() method is deprecated. Please use collection.find() instead."),this.find(t)},e.prototype.findOne=function(t){var e=this._generalFind(t,!0);return e.length>0?e[0]:void 0},e.prototype._generalFind=function(t,e){var n=[];return this._descendants((function(r){var i=r._isMatch(t);return i&&n.push(r),!(!i||!e)})),o.Collection.toCollection(n)},e.prototype._descendants=function(t){for(var e=0;e<this.children.length;e++){var n=this.children[e];if(t(n))return!0;if(n.hasChildren()&&n._descendants(t))return!0}return!1},e.prototype.toObject=function(){var t=a.Node.prototype.toObject.call(this);t.children=[];for(var e=this.getChildren(),n=e.length,r=0;r<n;r++){var i=e[r];t.children.push(i.toObject())}return t},e.prototype._getDescendants=function(t){for(var e=[],n=t.length,r=0;r<n;r++){var i=t[r];this.isAncestorOf(i)&&e.push(i)}return e},e.prototype.isAncestorOf=function(t){for(var e=t.getParent();e;){if(e._id===this._id)return!0;e=e.getParent()}return!1},e.prototype.clone=function(t){var e=a.Node.prototype.clone.call(this,t);return this.getChildren().each((function(t){e.add(t.clone())})),e},e.prototype.getAllIntersections=function(t){var e=[];return this.find("Shape").each((function(n){n.isVisible()&&n.intersects(t)&&e.push(n)})),e},e.prototype._setChildrenIndices=function(){this.children.each((function(t,e){t.index=e}))},e.prototype.drawScene=function(t,e,n){var r=this.getLayer(),i=t||r&&r.getCanvas(),o=i&&i.getContext(),s=this._getCanvasCache(),a=s&&s.scene;return(this.isVisible()||n)&&(!n&&a?(o.save(),r._applyTransform(this,o,e),this._drawCachedSceneCanvas(o),o.restore()):this._drawChildren(i,"drawScene",e,!1,n,n)),this},e.prototype.drawHit=function(t,e,n){var r=this.getLayer(),i=t||r&&r.hitCanvas,o=i&&i.getContext(),s=this._getCanvasCache(),a=s&&s.hit;return(this.shouldDrawHit(i)||n)&&(!n&&a?(o.save(),r._applyTransform(this,o,e),this._drawCachedHitCanvas(o),o.restore()):this._drawChildren(i,"drawHit",e,!1,n,n)),this},e.prototype._drawChildren=function(t,e,n,r,i,o){var s,a,u=this.getLayer(),c=t&&t.getContext(),l=this.clipWidth(),h=this.clipHeight(),p=this.clipFunc(),f=l&&h||p;if(f&&u){c.save();var d=this.getAbsoluteTransform(n),g=d.getMatrix();c.transform(g[0],g[1],g[2],g[3],g[4],g[5]),c.beginPath(),p?p.call(this,c,this):(s=this.clipX(),a=this.clipY(),c.rect(s,a,l,h)),c.clip(),g=d.copy().invert().getMatrix(),c.transform(g[0],g[1],g[2],g[3],g[4],g[5])}var m="source-over"!==this.globalCompositeOperation()&&!o&&"drawScene"===e;m&&u&&(c.save(),c._applyGlobalCompositeOperation(this)),this.children.each((function(o){o[e](t,n,r,i)})),m&&u&&c.restore(),f&&u&&c.restore()},e.prototype.shouldDrawHit=function(t){if(t&&t.isCache)return!0;var e=this.getLayer(),n=!1;u.DD._dragElements.forEach((function(t){"dragging"===t.dragStatus&&t.node.getLayer()===e&&(n=!0)}));var r=!l.Konva.hitOnDragEnabled&&n;return e&&e.hitGraphEnabled()&&this.isVisible()&&!r},e.prototype.getClientRect=function(t){var e,n,r,i,o=(t=t||{}).skipTransform,s=t.relativeTo,a={x:1/0,y:1/0,width:0,height:0},u=this;this.children.each((function(o){if(o.visible()){var s=o.getClientRect({relativeTo:u,skipShadow:t.skipShadow,skipStroke:t.skipStroke});0===s.width&&0===s.height||(void 0===e?(e=s.x,n=s.y,r=s.x+s.width,i=s.y+s.height):(e=Math.min(e,s.x),n=Math.min(n,s.y),r=Math.max(r,s.x+s.width),i=Math.max(i,s.y+s.height)))}}));for(var c=this.find("Shape"),l=!1,h=0;h<c.length;h++){if(c[h]._isVisible(this)){l=!0;break}}return a=l&&void 0!==e?{x:e,y:n,width:r-e,height:i-n}:{x:0,y:0,width:0,height:0},o?a:this._transformedRect(a,s)},e}(a.Node);e.Container=h,s.Factory.addComponentsGetterSetter(h,"clip",["x","y","width","height"]),s.Factory.addGetterSetter(h,"clipX",void 0,c.getNumberValidator()),s.Factory.addGetterSetter(h,"clipY",void 0,c.getNumberValidator()),s.Factory.addGetterSetter(h,"clipWidth",void 0,c.getNumberValidator()),s.Factory.addGetterSetter(h,"clipHeight",void 0,c.getNumberValidator()),s.Factory.addGetterSetter(h,"clipFunc"),o.Collection.mapMethods(h)},"6oOd":function(t,e,n){"use strict";var r=n("tdvT").match(/AppleWebKit\/(\d+)\./);t.exports=!!r&&+r[1]},"6sUC":function(t,e,n){"use strict";var r=n("hh1v"),i=Math.floor;t.exports=Number.isInteger||function(t){return!r(t)&&isFinite(t)&&i(t)===t}},"7+zs":function(t,e,n){"use strict";var r=n("Gi26"),i=n("yy0I"),o=n("UesL"),s=n("tiKp")("toPrimitive"),a=Date.prototype;r(a,s)||i(a,s,o)},"7IeV":function(t,e,n){"use strict";var r=n("tdvT");t.exports=/web0s(?!.*chrome)/i.test(r)},"7T3k":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("13ei"),i=r.glob.performance&&r.glob.performance.now?function(){return r.glob.performance.now()}:function(){return(new Date).getTime()},o=function(){function t(e,n){this.id=t.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:i(),frameRate:0},this.func=e,this.setLayers(n)}return t.prototype.setLayers=function(t){var e=[];return e=t?t.length>0?t:[t]:[],this.layers=e,this},t.prototype.getLayers=function(){return this.layers},t.prototype.addLayer=function(t){var e,n=this.layers,r=n.length;for(e=0;e<r;e++)if(n[e]._id===t._id)return!1;return this.layers.push(t),!0},t.prototype.isRunning=function(){var e,n=t.animations,r=n.length;for(e=0;e<r;e++)if(n[e].id===this.id)return!0;return!1},t.prototype.start=function(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=i(),t._addAnimation(this),this},t.prototype.stop=function(){return t._removeAnimation(this),this},t.prototype._updateFrameObject=function(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff},t._addAnimation=function(t){this.animations.push(t),this._handleAnimation()},t._removeAnimation=function(t){var e,n=t.id,r=this.animations,i=r.length;for(e=0;e<i;e++)if(r[e].id===n){this.animations.splice(e,1);break}},t._runFrames=function(){var t,e,n,r,o,s,a,u,c={},l=this.animations;for(r=0;r<l.length;r++)if(e=(t=l[r]).layers,n=t.func,t._updateFrameObject(i()),s=e.length,!n||!1!==n.call(t,t.frame))for(o=0;o<s;o++)void 0!==(a=e[o])._id&&(c[a._id]=a);for(u in c)c.hasOwnProperty(u)&&c[u].draw()},t._animationLoop=function(){var e=t;e.animations.length?(e._runFrames(),requestAnimationFrame(e._animationLoop)):e.animRunning=!1},t._handleAnimation=function(){this.animRunning||(this.animRunning=!0,requestAnimationFrame(this._animationLoop))},t.animations=[],t.animIdCounter=0,t.animRunning=!1,t}();e.Animation=o},"7dAM":function(t,e,n){"use strict";var r=n("E9LY"),i=n("m/L8");t.exports=function(t,e,n){return n.get&&r(n.get,e,{getter:!0}),n.set&&r(n.set,e,{setter:!0}),i.f(t,e,n)}},"81y5":function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("6mFz"),a=n("13ei"),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype._validateAdd=function(t){var e=t.getType();"Group"!==e&&"Shape"!==e&&o.Util.throw("You may only add groups and shapes to groups.")},e}(s.Container);e.Group=u,u.prototype.nodeType="Group",a._registerNode(u),o.Collection.mapMethods(u)},"82ph":function(t,e,n){"use strict";var r=n("4zBA");t.exports=r([].slice)},"8GlL":function(t,e,n){"use strict";var r=n("We1y"),i=TypeError,o=function(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw new i("Bad Promise constructor");e=t,n=r})),this.resolve=r(e),this.reject=r(n)};t.exports.f=function(t){return new o(t)}},"8LQ0":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("nLhi"),i=n("RUZL");e.Factory={addGetterSetter:function(t,e,n,r,i){this.addGetter(t,e,n),this.addSetter(t,e,r,i),this.addOverloadedGetterSetter(t,e)},addGetter:function(t,e,n){var i="get"+r.Util._capitalize(e);t.prototype[i]=t.prototype[i]||function(){var t=this.attrs[e];return void 0===t?n:t}},addSetter:function(t,n,i,o){var s="set"+r.Util._capitalize(n);t.prototype[s]||e.Factory.overWriteSetter(t,n,i,o)},overWriteSetter:function(t,e,n,i){var o="set"+r.Util._capitalize(e);t.prototype[o]=function(t){return n&&null!=t&&(t=n.call(this,t,e)),this._setAttr(e,t),i&&i.call(this),this}},addComponentsGetterSetter:function(t,e,n,o,s){var a,u,c=n.length,l=r.Util._capitalize,h="get"+l(e),p="set"+l(e);t.prototype[h]=function(){var t={};for(a=0;a<c;a++)t[u=n[a]]=this.getAttr(e+l(u));return t};var f=i.getComponentValidator(n);t.prototype[p]=function(t){var n,r=this.attrs[e];for(n in o&&(t=o.call(this,t)),f&&f.call(this,t,e),t)t.hasOwnProperty(n)&&this._setAttr(e+l(n),t[n]);return this._fireChangeEvent(e,r,t),s&&s.call(this),this},this.addOverloadedGetterSetter(t,e)},addOverloadedGetterSetter:function(t,e){var n=r.Util._capitalize(e),i="set"+n,o="get"+n;t.prototype[e]=function(){return arguments.length?(this[i](arguments[0]),this):this[o]()}},addDeprecatedGetterSetter:function(t,e,n,i){r.Util.error("Adding deprecated "+e);var o="get"+r.Util._capitalize(e),s=e+" property is deprecated and will be removed soon. Look at Konva change log for more information.";t.prototype[o]=function(){r.Util.error(s);var t=this.attrs[e];return void 0===t?n:t},this.addSetter(t,e,i,(function(){r.Util.error(s)})),this.addOverloadedGetterSetter(t,e)},backCompat:function(t,e){r.Util.each(e,(function(e,n){var i=t.prototype[n],o="get"+r.Util._capitalize(e),s="set"+r.Util._capitalize(e);function a(){i.apply(this,arguments),r.Util.error('"'+e+'" method is deprecated and will be removed soon. Use ""'+n+'" instead.')}t.prototype[e]=a,t.prototype[o]=a,t.prototype[s]=a}))},afterSetFilter:function(){this._filterUpToDate=!1}}},"8YOa":function(t,e,n){"use strict";var r=n("I+eb"),i=n("4zBA"),o=n("0BK2"),s=n("hh1v"),a=n("Gi26"),u=n("m/L8").f,c=n("JBy8"),l=n("BX/b"),h=n("T63f"),p=n("kOOl"),f=n("uy83"),d=!1,g=p("meta"),m=0,v=function(t){u(t,g,{value:{objectID:"O"+m++,weakData:{}}})},y=t.exports={enable:function(){y.enable=function(){},d=!0;var t=c.f,e=i([].splice),n={};n[g]=1,t(n).length&&(c.f=function(n){for(var r=t(n),i=0,o=r.length;i<o;i++)if(r[i]===g){e(r,i,1);break}return r},r({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:l.f}))},fastKey:function(t,e){if(!s(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!a(t,g)){if(!h(t))return"F";if(!e)return"E";v(t)}return t[g].objectID},getWeakData:function(t,e){if(!a(t,g)){if(!h(t))return!0;if(!e)return!1;v(t)}return t[g].weakData},onFreeze:function(t){return f&&d&&h(t)&&!a(t,g)&&v(t),t}};o[g]=!0},"8itv":function(t,e,n){"use strict";var r=n("I+eb"),i=n("8GlL");r({target:"Promise",stat:!0,forced:n("Rzhe").CONSTRUCTOR},{reject:function(t){var e=i.f(this);return(0,e.reject)(t),e.promise}})},"8oxB":function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var u,c=[],l=!1,h=-1;function p(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&f())}function f(){if(!l){var t=a(p);l=!0;for(var e=c.length;e;){for(u=c,c=[];++h<e;)u&&u[h].run();h=-1,e=c.length}u=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function g(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new d(t,e)),1!==c.length||l||a(f)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},"90hW":function(t,e,n){"use strict";t.exports=Math.sign||function(t){var e=+t;return 0===e||e!=e?e:e<0?-1:1}},"93I0":function(t,e,n){"use strict";var r=n("VpIT"),i=n("kOOl"),o=r("keys");t.exports=function(t){return o[t]||(o[t]=i(t))}},"9JVa":function(t,e,n){"use strict";var r=n("wE6v"),i=TypeError;t.exports=function(t){var e=r(t,"number");if("number"==typeof e)throw new i("Can't convert number to bigint");return BigInt(e)}},"9d/t":function(t,e,n){"use strict";var r=n("AO7/"),i=n("Fib7"),o=n("xrYK"),s=n("tiKp")("toStringTag"),a=Object,u="Arguments"===o(function(){return arguments}());t.exports=r?o:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=a(t),s))?n:u?o(e):"Object"===(r=o(e))&&i(e.callee)?"Arguments":r}},"9lVk":function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o,s=n("nLhi"),a=n("xSfM"),u=n("13ei"),c=n("8LQ0"),l=n("RUZL");var h=function(){function t(t){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;var e=(t||{}).pixelRatio||u.Konva.pixelRatio||function(){if(o)return o;var t=s.Util.createCanvasElement().getContext("2d");return o=(u.Konva._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)}();this.pixelRatio=e,this._canvas=s.Util.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}return t.prototype.getContext=function(){return this.context},t.prototype.getPixelRatio=function(){return this.pixelRatio},t.prototype.setPixelRatio=function(t){var e=this.pixelRatio;this.pixelRatio=t,this.setSize(this.getWidth()/e,this.getHeight()/e)},t.prototype.setWidth=function(t){this.width=this._canvas.width=t*this.pixelRatio,this._canvas.style.width=t+"px";var e=this.pixelRatio;this.getContext()._context.scale(e,e)},t.prototype.setHeight=function(t){this.height=this._canvas.height=t*this.pixelRatio,this._canvas.style.height=t+"px";var e=this.pixelRatio;this.getContext()._context.scale(e,e)},t.prototype.getWidth=function(){return this.width},t.prototype.getHeight=function(){return this.height},t.prototype.setSize=function(t,e){this.setWidth(t||0),this.setHeight(e||0)},t.prototype.toDataURL=function(t,e){try{return this._canvas.toDataURL(t,e)}catch(t){try{return this._canvas.toDataURL()}catch(t){return s.Util.error("Unable to get data URL. "+t.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}},t}();e.Canvas=h,c.Factory.addGetterSetter(h,"pixelRatio",void 0,l.getNumberValidator());var p=function(t){function e(e){void 0===e&&(e={width:0,height:0});var n=t.call(this,e)||this;return n.context=new a.SceneContext(n),n.setSize(e.width,e.height),n}return i(e,t),e}(h);e.SceneCanvas=p;var f=function(t){function e(e){void 0===e&&(e={width:0,height:0});var n=t.call(this,e)||this;return n.hitCanvas=!0,n.context=new a.HitContext(n),n.setSize(e.width,e.height),n}return i(e,t),e}(h);e.HitCanvas=f},"9rSQ":function(t,e,n){"use strict";var r=n("xTJ+");function i(){this.handlers=[]}i.prototype.use=function(t,e){return this.handlers.push({fulfilled:t,rejected:e}),this.handlers.length-1},i.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},i.prototype.forEach=function(t){r.forEach(this.handlers,(function(e){null!==e&&t(e)}))},t.exports=i},"9wk+":function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r};Object.defineProperty(e,"__esModule",{value:!0});var s=n("nLhi"),a=n("8LQ0"),u=n("/OYL"),c=n("RUZL"),l=n("13ei"),h=function(t){function e(e){var n=t.call(this,e)||this;return n.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",(function(){this._clearCache("tensionPoints")})),n}return i(e,t),e.prototype._sceneFunc=function(t){var e,n,r,i=this.points(),o=i.length,s=this.tension(),a=this.closed(),u=this.bezier();if(o){if(t.beginPath(),t.moveTo(i[0],i[1]),0!==s&&o>4){for(n=(e=this.getTensionPoints()).length,r=a?0:4,a||t.quadraticCurveTo(e[0],e[1],e[2],e[3]);r<n-2;)t.bezierCurveTo(e[r++],e[r++],e[r++],e[r++],e[r++],e[r++]);a||t.quadraticCurveTo(e[n-2],e[n-1],i[o-2],i[o-1])}else if(u)for(r=2;r<o;)t.bezierCurveTo(i[r++],i[r++],i[r++],i[r++],i[r++],i[r++]);else for(r=2;r<o;r+=2)t.lineTo(i[r],i[r+1]);a?(t.closePath(),t.fillStrokeShape(this)):t.strokeShape(this)}},e.prototype.getTensionPoints=function(){return this._getCache("tensionPoints",this._getTensionPoints)},e.prototype._getTensionPoints=function(){return this.closed()?this._getTensionPointsClosed():s.Util._expandPoints(this.points(),this.tension())},e.prototype._getTensionPointsClosed=function(){var t=this.points(),e=t.length,n=this.tension(),r=s.Util._getControlPoints(t[e-2],t[e-1],t[0],t[1],t[2],t[3],n),i=s.Util._getControlPoints(t[e-4],t[e-3],t[e-2],t[e-1],t[0],t[1],n),o=s.Util._expandPoints(t,n);return[r[2],r[3]].concat(o).concat([i[0],i[1],t[e-2],t[e-1],i[2],i[3],r[0],r[1],t[0],t[1]])},e.prototype.getWidth=function(){return this.getSelfRect().width},e.prototype.getHeight=function(){return this.getSelfRect().height},e.prototype.getSelfRect=function(){var t=this.points();if(t.length<4)return{x:t[0]||0,y:t[1]||0,width:0,height:0};for(var e,n,r=(t=0!==this.tension()?o([t[0],t[1]],this._getTensionPoints(),[t[t.length-2],t[t.length-1]]):this.points())[0],i=t[0],s=t[1],a=t[1],u=0;u<t.length/2;u++)e=t[2*u],n=t[2*u+1],r=Math.min(r,e),i=Math.max(i,e),s=Math.min(s,n),a=Math.max(a,n);return{x:r,y:s,width:i-r,height:a-s}},e}(u.Shape);e.Line=h,h.prototype.className="Line",h.prototype._attrsAffectingSize=["points","bezier","tension"],l._registerNode(h),a.Factory.addGetterSetter(h,"closed",!1),a.Factory.addGetterSetter(h,"bezier",!1),a.Factory.addGetterSetter(h,"tension",0,c.getNumberValidator()),a.Factory.addGetterSetter(h,"points",[],c.getNumberArrayValidator()),s.Collection.mapMethods(h)},A2ZE:function(t,e,n){"use strict";var r=n("RiVN"),i=n("We1y"),o=n("QNWe"),s=r(r.bind);t.exports=function(t,e){return i(t),void 0===e?t:o?s(t,e):function(){return t.apply(e,arguments)}}},AJTl:function(t,e,n){"use strict";var r,i=n("uy83"),o=n("z+kr"),s=n("4zBA"),a=n("aWRN"),u=n("8YOa"),c=n("bWFh"),l=n("rKzb"),h=n("hh1v"),p=n("afO8").enforce,f=n("0Dky"),d=n("zc4i"),g=Object,m=Array.isArray,v=g.isExtensible,y=g.isFrozen,x=g.isSealed,b=g.freeze,_=g.seal,w=!o.ActiveXObject&&"ActiveXObject"in o,M=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},E=c("WeakMap",M,l),S=E.prototype,A=s(S.set);if(d)if(w){r=l.getConstructor(M,"WeakMap",!0),u.enable();var C=s(S.delete),T=s(S.has),P=s(S.get);a(S,{delete:function(t){if(h(t)&&!v(t)){var e=p(this);return e.frozen||(e.frozen=new r),C(this,t)||e.frozen.delete(t)}return C(this,t)},has:function(t){if(h(t)&&!v(t)){var e=p(this);return e.frozen||(e.frozen=new r),T(this,t)||e.frozen.has(t)}return T(this,t)},get:function(t){if(h(t)&&!v(t)){var e=p(this);return e.frozen||(e.frozen=new r),T(this,t)?P(this,t):e.frozen.get(t)}return P(this,t)},set:function(t,e){if(h(t)&&!v(t)){var n=p(this);n.frozen||(n.frozen=new r),T(this,t)?A(this,t,e):n.frozen.set(t,e)}else A(this,t,e);return this}})}else i&&f((function(){var t=b([]);return A(new E,t,1),!y(t)}))&&a(S,{set:function(t,e){var n;return m(t)&&(y(t)?n=b:x(t)&&(n=_)),A(this,t,e),n&&n(t),this}})},"AO7/":function(t,e,n){"use strict";var r={};r[n("tiKp")("toStringTag")]="z",t.exports="[object z]"===String(r)},AbTg:function(t,e,n){"use strict";var r=function(){this.head=null,this.tail=null};r.prototype={add:function(t){var e={item:t,next:null},n=this.tail;n?n.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}},t.exports=r},"B/qT":function(t,e,n){"use strict";var r=n("UMSQ");t.exports=function(t){return r(t.length)}},BPiQ:function(t,e,n){"use strict";var r=n("EhIz"),i=n("0Dky"),o=n("z+kr").String;t.exports=!!Object.getOwnPropertySymbols&&!i((function(){var t=Symbol("symbol detection");return!o(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},BTho:function(t,e,n){"use strict";var r=n("4zBA"),i=n("We1y"),o=n("hh1v"),s=n("Gi26"),a=n("82ph"),u=n("QNWe"),c=Function,l=r([].concat),h=r([].join),p={},f=function(t,e,n){if(!s(p,e)){for(var r=[],i=0;i<e;i++)r[i]="a["+i+"]";p[e]=c("C,a","return new C("+h(r,",")+")")}return p[e](t,n)};t.exports=u?c.bind:function(t){var e=i(this),n=e.prototype,r=a(arguments,1),s=function(){var n=l(r,a(arguments));return this instanceof s?f(e,n.length,n):e.apply(t,n)};return o(n)&&(s.prototype=n),s}},"BX/b":function(t,e,n){"use strict";var r=n("xrYK"),i=n("/GqU"),o=n("JBy8").f,s=n("82ph"),a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return a&&"Window"===r(t)?function(t){try{return o(t)}catch(t){return s(a)}}(t):o(i(t))}},Bs8V:function(t,e,n){"use strict";var r=n("g6v/"),i=n("xluM"),o=n("0eef"),s=n("XGwC"),a=n("/GqU"),u=n("oEtG"),c=n("Gi26"),l=n("DPsx"),h=Object.getOwnPropertyDescriptor;e.f=r?h:function(t,e){if(t=a(t),e=u(e),l)try{return h(t,e)}catch(t){}if(c(t,e))return s(!i(o.f,t,e),t[e])}},Bvic:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("nLhi"),i=n("7T3k"),o=n("SXH2"),s=n("13ei"),a={node:1,duration:1,easing:1,onFinish:1,yoyo:1},u=0,c=["fill","stroke","shadowColor"],l=function(){function t(t,e,n,r,i,o,s){this.prop=t,this.propFunc=e,this.begin=r,this._pos=r,this.duration=o,this._change=0,this.prevPos=0,this.yoyo=s,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=i-this.begin,this.pause()}return t.prototype.fire=function(t){var e=this[t];e&&e()},t.prototype.setTime=function(t){t>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():t<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=t,this.update())},t.prototype.getTime=function(){return this._time},t.prototype.setPosition=function(t){this.prevPos=this._pos,this.propFunc(t),this._pos=t},t.prototype.getPosition=function(t){return void 0===t&&(t=this._time),this.func(t,this.begin,this._change,this.duration)},t.prototype.play=function(){this.state=2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")},t.prototype.reverse=function(){this.state=3,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")},t.prototype.seek=function(t){this.pause(),this._time=t,this.update(),this.fire("onSeek")},t.prototype.reset=function(){this.pause(),this._time=0,this.update(),this.fire("onReset")},t.prototype.finish=function(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")},t.prototype.update=function(){this.setPosition(this.getPosition(this._time))},t.prototype.onEnterFrame=function(){var t=this.getTimer()-this._startTime;2===this.state?this.setTime(t):3===this.state&&this.setTime(this.duration-t)},t.prototype.pause=function(){this.state=1,this.fire("onPause")},t.prototype.getTimer=function(){return(new Date).getTime()},t}(),h=function(){function t(n){var o,c,h=this,p=n.node,f=p._id,d=n.easing||e.Easings.Linear,g=!!n.yoyo;o=void 0===n.duration?.3:0===n.duration?.001:n.duration,this.node=p,this._id=u++;var m=p.getLayer()||(p instanceof s.Konva.Stage?p.getLayers():null);for(c in m||r.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new i.Animation((function(){h.tween.onEnterFrame()}),m),this.tween=new l(c,(function(t){h._tweenFunc(t)}),d,0,1,1e3*o,g),this._addListeners(),t.attrs[f]||(t.attrs[f]={}),t.attrs[f][this._id]||(t.attrs[f][this._id]={}),t.tweens[f]||(t.tweens[f]={}),n)void 0===a[c]&&this._addAttr(c,n[c]);this.reset(),this.onFinish=n.onFinish,this.onReset=n.onReset}return t.prototype._addAttr=function(e,n){var i,o,s,a,u,l,h,p,f=this.node,d=f._id;if((s=t.tweens[d][e])&&delete t.attrs[d][s][e],i=f.getAttr(e),r.Util._isArray(n))if(o=[],u=Math.max(n.length,i.length),"points"===e&&n.length!==i.length&&(n.length>i.length?(h=i,i=r.Util._prepareArrayForTween(i,n,f.closed())):(l=n,n=r.Util._prepareArrayForTween(n,i,f.closed()))),0===e.indexOf("fill"))for(a=0;a<u;a++)if(a%2==0)o.push(n[a]-i[a]);else{var g=r.Util.colorToRGBA(i[a]);p=r.Util.colorToRGBA(n[a]),i[a]=g,o.push({r:p.r-g.r,g:p.g-g.g,b:p.b-g.b,a:p.a-g.a})}else for(a=0;a<u;a++)o.push(n[a]-i[a]);else-1!==c.indexOf(e)?(i=r.Util.colorToRGBA(i),o={r:(p=r.Util.colorToRGBA(n)).r-i.r,g:p.g-i.g,b:p.b-i.b,a:p.a-i.a}):o=n-i;t.attrs[d][this._id][e]={start:i,diff:o,end:n,trueEnd:l,trueStart:h},t.tweens[d][e]=this._id},t.prototype._tweenFunc=function(e){var n,i,o,s,a,u,l,h,p=this.node,f=t.attrs[p._id][this._id];for(n in f){if(o=(i=f[n]).start,s=i.diff,h=i.end,r.Util._isArray(o))if(a=[],l=Math.max(o.length,h.length),0===n.indexOf("fill"))for(u=0;u<l;u++)u%2==0?a.push((o[u]||0)+s[u]*e):a.push("rgba("+Math.round(o[u].r+s[u].r*e)+","+Math.round(o[u].g+s[u].g*e)+","+Math.round(o[u].b+s[u].b*e)+","+(o[u].a+s[u].a*e)+")");else for(u=0;u<l;u++)a.push((o[u]||0)+s[u]*e);else a=-1!==c.indexOf(n)?"rgba("+Math.round(o.r+s.r*e)+","+Math.round(o.g+s.g*e)+","+Math.round(o.b+s.b*e)+","+(o.a+s.a*e)+")":o+s*e;p.setAttr(n,a)}},t.prototype._addListeners=function(){var e=this;this.tween.onPlay=function(){e.anim.start()},this.tween.onReverse=function(){e.anim.start()},this.tween.onPause=function(){e.anim.stop()},this.tween.onFinish=function(){var n=e.node,r=t.attrs[n._id][e._id];r.points&&r.points.trueEnd&&n.setAttr("points",r.points.trueEnd),e.onFinish&&e.onFinish.call(e)},this.tween.onReset=function(){var n=e.node,r=t.attrs[n._id][e._id];r.points&&r.points.trueStart&&n.points(r.points.trueStart),e.onReset&&e.onReset()}},t.prototype.play=function(){return this.tween.play(),this},t.prototype.reverse=function(){return this.tween.reverse(),this},t.prototype.reset=function(){return this.tween.reset(),this},t.prototype.seek=function(t){return this.tween.seek(1e3*t),this},t.prototype.pause=function(){return this.tween.pause(),this},t.prototype.finish=function(){return this.tween.finish(),this},t.prototype.destroy=function(){var e,n=this.node._id,r=this._id,i=t.tweens[n];for(e in this.pause(),i)delete t.tweens[n][e];delete t.attrs[n][r]},t.attrs={},t.tweens={},t}();e.Tween=h,o.Node.prototype.to=function(t){var e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()},new h(t).play()},e.Easings={BackEaseIn:function(t,e,n,r){var i=1.70158;return n*(t/=r)*t*((i+1)*t-i)+e},BackEaseOut:function(t,e,n,r){var i=1.70158;return n*((t=t/r-1)*t*((i+1)*t+i)+1)+e},BackEaseInOut:function(t,e,n,r){var i=1.70158;return(t/=r/2)<1?n/2*(t*t*((1+(i*=1.525))*t-i))+e:n/2*((t-=2)*t*((1+(i*=1.525))*t+i)+2)+e},ElasticEaseIn:function(t,e,n,r,i,o){var s=0;return 0===t?e:1==(t/=r)?e+n:(o||(o=.3*r),!i||i<Math.abs(n)?(i=n,s=o/4):s=o/(2*Math.PI)*Math.asin(n/i),-i*Math.pow(2,10*(t-=1))*Math.sin((t*r-s)*(2*Math.PI)/o)+e)},ElasticEaseOut:function(t,e,n,r,i,o){var s=0;return 0===t?e:1==(t/=r)?e+n:(o||(o=.3*r),!i||i<Math.abs(n)?(i=n,s=o/4):s=o/(2*Math.PI)*Math.asin(n/i),i*Math.pow(2,-10*t)*Math.sin((t*r-s)*(2*Math.PI)/o)+n+e)},ElasticEaseInOut:function(t,e,n,r,i,o){var s=0;return 0===t?e:2==(t/=r/2)?e+n:(o||(o=r*(.3*1.5)),!i||i<Math.abs(n)?(i=n,s=o/4):s=o/(2*Math.PI)*Math.asin(n/i),t<1?i*Math.pow(2,10*(t-=1))*Math.sin((t*r-s)*(2*Math.PI)/o)*-.5+e:i*Math.pow(2,-10*(t-=1))*Math.sin((t*r-s)*(2*Math.PI)/o)*.5+n+e)},BounceEaseOut:function(t,e,n,r){return(t/=r)<1/2.75?n*(7.5625*t*t)+e:t<2/2.75?n*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?n*(7.5625*(t-=2.25/2.75)*t+.9375)+e:n*(7.5625*(t-=2.625/2.75)*t+.984375)+e},BounceEaseIn:function(t,n,r,i){return r-e.Easings.BounceEaseOut(i-t,0,r,i)+n},BounceEaseInOut:function(t,n,r,i){return t<i/2?.5*e.Easings.BounceEaseIn(2*t,0,r,i)+n:.5*e.Easings.BounceEaseOut(2*t-i,0,r,i)+.5*r+n},EaseIn:function(t,e,n,r){return n*(t/=r)*t+e},EaseOut:function(t,e,n,r){return-n*(t/=r)*(t-2)+e},EaseInOut:function(t,e,n,r){return(t/=r/2)<1?n/2*t*t+e:-n/2*(--t*(t-2)-1)+e},StrongEaseIn:function(t,e,n,r){return n*(t/=r)*t*t*t*t+e},StrongEaseOut:function(t,e,n,r){return n*((t=t/r-1)*t*t*t*t+1)+e},StrongEaseInOut:function(t,e,n,r){return(t/=r/2)<1?n/2*t*t*t*t*t+e:n/2*((t-=2)*t*t*t*t+2)+e},Linear:function(t,e,n,r){return n*t/r+e}}},C0Ia:function(t,e,n){"use strict";var r=n("6LWA"),i=n("aO6C"),o=n("hh1v"),s=n("tiKp")("species"),a=Array;t.exports=function(t){var e;return r(t)&&(e=t.constructor,(i(e)&&(e===a||r(e.prototype))||o(e)&&null===(e=e[s]))&&(e=void 0)),void 0===e?a:e}},C0Od:function(t,e,n){"use strict";var r=n("BPiQ");t.exports=r&&!!Symbol.for&&!!Symbol.keyFor},CDr4:function(t,e,n){"use strict";var r=n("DVFp"),i=TypeError;t.exports=function(t,e){if(!delete t[e])throw new i("Cannot delete property "+r(e)+" of "+r(t))}},CgaS:function(t,e,n){"use strict";var r=n("xTJ+"),i=n("MLWZ"),o=n("9rSQ"),s=n("UnBK"),a=n("SntB");function u(t){this.defaults=t,this.interceptors={request:new o,response:new o}}u.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=[s,void 0],n=Promise.resolve(t);for(this.interceptors.request.forEach((function(t){e.unshift(t.fulfilled,t.rejected)})),this.interceptors.response.forEach((function(t){e.push(t.fulfilled,t.rejected)}));e.length;)n=n.then(e.shift(),e.shift());return n},u.prototype.getUri=function(t){return t=a(this.defaults,t),i(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(t){u.prototype[t]=function(e,n){return this.request(r.merge(n||{},{method:t,url:e}))}})),r.forEach(["post","put","patch"],(function(t){u.prototype[t]=function(e,n,i){return this.request(r.merge(i||{},{method:t,url:e,data:n}))}})),t.exports=u},CyXQ:function(t,e,n){"use strict";var r=n("WSbT"),i=n("UMSQ"),o=RangeError;t.exports=function(t){if(void 0===t)return 0;var e=r(t),n=i(e);if(e!==n)throw new o("Wrong length or index");return n}},"D/Vs":function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("6mFz"),a=n("8LQ0"),u=n("1q+a"),c=n("9lVk"),l=n("/OYL"),h=n("RUZL"),p=n("13ei"),f=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],d=f.length,g=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.hitCanvas=new c.HitCanvas({pixelRatio:1}),e}return i(e,t),e.prototype._setCanvasSize=function(t,e){this.canvas.setSize(t,e),this.hitCanvas.setSize(t,e),this._checkSmooth()},e.prototype._validateAdd=function(t){var e=t.getType();"Group"!==e&&"Shape"!==e&&o.Util.throw("You may only add groups and shapes to a layer.")},e.prototype.getIntersection=function(t,e){var n,r,i,o;if(!this.hitGraphEnabled()||!this.isVisible())return null;for(var s=1,a=!1;;){for(r=0;r<d;r++){if(i=f[r],(o=(n=this._getIntersection({x:t.x+i.x*s,y:t.y+i.y*s})).shape)&&e)return o.findAncestor(e,!0);if(o)return o;if(a=!!n.antialiased,!n.antialiased)break}if(!a)return null;s+=1}},e.prototype._getIntersection=function(t){var e,n,r=this.hitCanvas.pixelRatio,i=this.hitCanvas.context.getImageData(Math.round(t.x*r),Math.round(t.y*r),1,1).data,s=i[3];return 255===s?(e=o.Util._rgbToHex(i[0],i[1],i[2]),(n=l.shapes["#"+e])?{shape:n}:{antialiased:!0}):s>0?{antialiased:!0}:{}},e.prototype.drawScene=function(t,e){var n=this.getLayer(),r=t||n&&n.getCanvas();return this._fire("beforeDraw",{node:this}),this.clearBeforeDraw()&&r.getContext().clear(),s.Container.prototype.drawScene.call(this,r,e),this._fire("draw",{node:this}),this},e.prototype.drawHit=function(t,e){var n=this.getLayer(),r=t||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),s.Container.prototype.drawHit.call(this,r,e),this},e.prototype.clear=function(t){return u.BaseLayer.prototype.clear.call(this,t),this.getHitCanvas().getContext().clear(t),this},e.prototype.enableHitGraph=function(){return this.hitGraphEnabled(!0),this},e.prototype.disableHitGraph=function(){return this.hitGraphEnabled(!1),this},e.prototype.toggleHitCanvas=function(){if(this.parent){var t=this.parent;!!this.hitCanvas._canvas.parentNode?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}},e.prototype.setSize=function(e){var n=e.width,r=e.height;return t.prototype.setSize.call(this,{width:n,height:r}),this.hitCanvas.setSize(n,r),this},e}(u.BaseLayer);e.Layer=g,g.prototype.nodeType="Layer",p._registerNode(g),a.Factory.addGetterSetter(g,"hitGraphEnabled",!0,h.getBooleanValidator()),o.Collection.mapMethods(g)},"D3+e":function(t,e,n){!function(){"use strict";var e=n("2As9"),r=function(t){this.curves=[],this._3d=!1,t&&(this.curves=t,this._3d=this.curves[0]._3d)};r.prototype={valueOf:function(){return this.toString()},toString:function(){return"["+this.curves.map((function(t){return e.pointsToString(t.points)})).join(", ")+"]"},addCurve:function(t){this.curves.push(t),this._3d=this._3d||t._3d},length:function(){return this.curves.map((function(t){return t.length()})).reduce((function(t,e){return t+e}))},curve:function(t){return this.curves[t]},bbox:function(){for(var t=this.curves,n=t[0].bbox(),r=1;r<t.length;r++)e.expandbox(n,t[r].bbox());return n},offset:function(t){var e=[];return this.curves.forEach((function(n){e=e.concat(n.offset(t))})),new r(e)}},t.exports=r}()},DEfu:function(t,e,n){"use strict";var r=n("z+kr");n("1E5z")(r.JSON,"JSON",!0)},DPsx:function(t,e,n){"use strict";var r=n("g6v/"),i=n("0Dky"),o=n("zBJ4");t.exports=!r&&!i((function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},DVFp:function(t,e,n){"use strict";var r=String;t.exports=function(t){try{return r(t)}catch(t){return"Object"}}},DfZB:function(t,e,n){"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},E6bK:function(t,e,n){"use strict";var r=Math.round;t.exports=function(t){var e=r(t);return e<0?0:e>255?255:255&e}},E9LY:function(t,e,n){"use strict";var r=n("4zBA"),i=n("0Dky"),o=n("Fib7"),s=n("Gi26"),a=n("g6v/"),u=n("Xnc8").CONFIGURABLE,c=n("iSVu"),l=n("afO8"),h=l.enforce,p=l.get,f=String,d=Object.defineProperty,g=r("".slice),m=r("".replace),v=r([].join),y=a&&!i((function(){return 8!==d((function(){}),"length",{value:8}).length})),x=String(String).split("String"),b=t.exports=function(t,e,n){"Symbol("===g(f(e),0,7)&&(e="["+m(f(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!s(t,"name")||u&&t.name!==e)&&(a?d(t,"name",{value:e,configurable:!0}):t.name=e),y&&n&&s(n,"arity")&&t.length!==n.arity&&d(t,"length",{value:n.arity});try{n&&s(n,"constructor")&&n.constructor?a&&d(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var r=h(t);return s(r,"source")||(r.source=v(x,"string"==typeof e?e:"")),t};Function.prototype.toString=b((function(){return o(this)&&p(this).source||c(this)}),"toString")},EHx7:function(t,e,n){"use strict";var r=n("0Dky"),i=n("z+kr").RegExp;t.exports=r((function(){var t=i("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")}))},ENF9:function(t,e,n){"use strict";n("AJTl")},EhIz:function(t,e,n){"use strict";var r,i,o=n("z+kr"),s=n("tdvT"),a=o.process,u=o.Deno,c=a&&a.versions||u&&u.version,l=c&&c.v8;l&&(i=(r=l.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!i&&s&&(!(r=s.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=s.match(/Chrome\/(\d+)/))&&(i=+r[1]),t.exports=i},"Ei/z":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("8LQ0"),i=n("SXH2"),o=n("RUZL");e.Threshold=function(t){var e,n=255*this.threshold(),r=t.data,i=r.length;for(e=0;e<i;e+=1)r[e]=r[e]<n?0:255},r.Factory.addGetterSetter(i.Node,"threshold",.5,o.getNumberValidator(),r.Factory.afterSetFilter)},ExoC:function(t,e,n){"use strict";n("I+eb")({target:"Object",stat:!0},{setPrototypeOf:n("0rvr")})},F4B0:function(t,e,n){var r,i,o,s,a,u,c,l,h,p,f,d,m,v,y,x;o="undefined"!=typeof window?window:this,u="hasOwnProperty",c=/[\.\/]/,l=/\s*,\s*/,h=function(t,e){return t-e},p={n:{}},f=function(){for(var t=0,e=this.length;t<e;t++)if(void 0!==this[t])return this[t]},d=function(){for(var t=this.length;--t;)if(void 0!==this[t])return this[t]},m=Object.prototype.toString,v=String,y=Array.isArray||function(t){return t instanceof Array||"[object Array]"==m.call(t)},(x=function(t,e){var n,r=a,i=Array.prototype.slice.call(arguments,2),o=x.listeners(t),u=0,c=[],l={},p=[],g=s;p.firstDefined=f,p.lastDefined=d,s=t,a=0;for(var m=0,v=o.length;m<v;m++)"zIndex"in o[m]&&(c.push(o[m].zIndex),o[m].zIndex<0&&(l[o[m].zIndex]=o[m]));for(c.sort(h);c[u]<0;)if(n=l[c[u++]],p.push(n.apply(e,i)),a)return a=r,p;for(m=0;m<v;m++)if("zIndex"in(n=o[m]))if(n.zIndex==c[u]){if(p.push(n.apply(e,i)),a)break;do{if((n=l[c[++u]])&&p.push(n.apply(e,i)),a)break}while(n)}else l[n.zIndex]=n;else if(p.push(n.apply(e,i)),a)break;return a=r,s=g,p})._events=p,x.listeners=function(t){var e,n,r,i,o,s,a,u,l=y(t)?t:t.split(c),h=p,f=[h],d=[];for(i=0,o=l.length;i<o;i++){for(u=[],s=0,a=f.length;s<a;s++)for(n=[(h=f[s].n)[l[i]],h["*"]],r=2;r--;)(e=n[r])&&(u.push(e),d=d.concat(e.f||[]));f=u}return d},x.separator=function(t){t?(t="["+(t=v(t).replace(/(?=[\.\^\]\[\-])/g,"\\"))+"]",c=new RegExp(t)):c=/[\.\/]/},x.on=function(t,e){if("function"!=typeof e)return function(){};for(var n=y(t)?y(t[0])?t:[t]:v(t).split(l),r=0,i=n.length;r<i;r++)!function(t){for(var n,r=y(t)?t:v(t).split(c),i=p,o=0,s=r.length;o<s;o++)i=(i=i.n).hasOwnProperty(r[o])&&i[r[o]]||(i[r[o]]={n:{}});for(i.f=i.f||[],o=0,s=i.f.length;o<s;o++)if(i.f[o]==e){n=!0;break}!n&&i.f.push(e)}(n[r]);return function(t){+t==+t&&(e.zIndex=+t)}},x.f=function(t){var e=[].slice.call(arguments,1);return function(){x.apply(null,[t,null].concat(e).concat([].slice.call(arguments,0)))}},x.stop=function(){a=1},x.nt=function(t){var e=y(s)?s.join("."):s;return t?new RegExp("(?:\\.|\\/|^)"+t+"(?:\\.|\\/|$)").test(e):e},x.nts=function(){return y(s)?s:s.split(c)},x.off=x.unbind=function(t,e){if(t){var n=y(t)?y(t[0])?t:[t]:v(t).split(l);if(n.length>1)for(var r=0,i=n.length;r<i;r++)x.off(n[r],e);else{n=y(t)?t:v(t).split(c);var o,s,a,h,f,d=[p],g=[];for(r=0,i=n.length;r<i;r++)for(h=0;h<d.length;h+=a.length-2){if(a=[h,1],o=d[h].n,"*"!=n[r])o[n[r]]&&(a.push(o[n[r]]),g.unshift({n:o,name:n[r]}));else for(s in o)o[u](s)&&(a.push(o[s]),g.unshift({n:o,name:s}));d.splice.apply(d,a)}for(r=0,i=d.length;r<i;r++)for(o=d[r];o.n;){if(e){if(o.f){for(h=0,f=o.f.length;h<f;h++)if(o.f[h]==e){o.f.splice(h,1);break}!o.f.length&&delete o.f}for(s in o.n)if(o.n[u](s)&&o.n[s].f){var m=o.n[s].f;for(h=0,f=m.length;h<f;h++)if(m[h]==e){m.splice(h,1);break}!m.length&&delete o.n[s].f}}else for(s in delete o.f,o.n)o.n[u](s)&&o.n[s].f&&delete o.n[s].f;o=o.n}t:for(r=0,i=g.length;r<i;r++){for(s in(o=g[r]).n[o.name].f)continue t;for(s in o.n[o.name].n)continue t;delete o.n[o.name]}}}else x._events=p={n:{}}},x.once=function(t,e){var n=function(){return x.off(t,n),e.apply(this,arguments)};return x.on(t,n)},x.version="0.5.4",x.toString=function(){return"You are running Eve 0.5.4"},o.eve=x,r=function(){return x}.apply(e,[]),function(n,o){void 0===(i=function(t){return function(t,e){var n=function(e){var n,r={},i=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||t.msRequestAnimationFrame||function(t){return setTimeout(t,16,(new Date).getTime()),!0},o=Array.isArray||function(t){return t instanceof Array||"[object Array]"==Object.prototype.toString.call(t)},s=0,a="M"+(+new Date).toString(36),u=Date.now||function(){return+new Date},c=function(t){var e=this;if(null==t)return e.s;var n=e.s-t;e.b+=e.dur*n,e.B+=e.dur*n,e.s=t},l=function(t){if(null==t)return this.spd;this.spd=t},h=function(t){var e=this;if(null==t)return e.dur;e.s=e.s*t/e.dur,e.dur=t},p=function(){var t=this;delete r[t.id],t.update(),e("mina.stop."+t.id,t)},f=function(){var t=this;t.pdif||(delete r[t.id],t.update(),t.pdif=t.get()-t.b)},d=function(){var t=this;t.pdif&&(t.b=t.get()-t.pdif,delete t.pdif,r[t.id]=t,m())},g=function(){var t,e=this;if(o(e.start)){t=[];for(var n=0,r=e.start.length;n<r;n++)t[n]=+e.start[n]+(e.end[n]-e.start[n])*e.easing(e.s)}else t=+e.start+(e.end-e.start)*e.easing(e.s);e.set(t)},m=function(t){if(t){var o=0;for(var s in r)if(r.hasOwnProperty(s)){var a=r[s],u=a.get();o++,a.s=(u-a.b)/(a.dur/a.spd),a.s>=1&&(delete r[s],a.s=1,o--,function(t){setTimeout((function(){e("mina.finish."+t.id,t)}))}(a)),a.update()}n=!!o&&i(m)}else n||(n=i(m))},v=function(t,e,n,i,o,u,y){var x={id:a+(s++).toString(36),start:t,end:e,b:n,s:0,dur:i-n,spd:1,get:o,set:u,easing:y||v.linear,status:c,speed:l,duration:h,stop:p,pause:f,resume:d,update:g};r[x.id]=x;var b,_=0;for(b in r)if(r.hasOwnProperty(b)&&2==++_)break;return 1==_&&m(),x};return v.time=u,v.getById=function(t){return r[t]||null},v.linear=function(t){return t},v.easeout=function(t){return Math.pow(t,1.7)},v.easein=function(t){return Math.pow(t,.48)},v.easeinout=function(t){if(1==t)return 1;if(0==t)return 0;var e=.48-t/1.04,n=Math.sqrt(.1734+e*e),r=n-e,i=-n-e,o=Math.pow(Math.abs(r),1/3)*(r<0?-1:1)+Math.pow(Math.abs(i),1/3)*(i<0?-1:1)+.5;return 3*(1-o)*o*o+o*o*o},v.backin=function(t){if(1==t)return 1;var e=1.70158;return t*t*((e+1)*t-e)},v.backout=function(t){if(0==t)return 0;var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},v.elastic=function(t){return t==!!t?t:Math.pow(2,-10*t)*Math.sin((t-.075)*(2*Math.PI)/.3)+1},v.bounce=function(t){var e=7.5625,n=2.75;return t<1/n?e*t*t:t<2/n?e*(t-=1.5/n)*t+.75:t<2.5/n?e*(t-=2.25/n)*t+.9375:e*(t-=2.625/n)*t+.984375},t.mina=v,v}(void 0===e?function(){}:e),r=function(t){function n(t,e){if(t){if(t.nodeType)return X(t);if(I(t,"array")&&n.set)return n.set.apply(n,t);if(t instanceof V)return t;if(null==e)try{return X(t=r.doc.querySelector(String(t)))}catch(t){return null}}return new q(t=null==t?"100%":t,e=null==e?"100%":e)}n.version="0.5.1",n.toString=function(){return"Snap v"+this.version},n._={};var r={win:t.window,doc:t.window.document};n._.glob=r;var i,o,s="hasOwnProperty",a=String,u=parseFloat,c=parseInt,l=Math,h=l.max,p=l.min,f=l.abs,d=(l.pow,l.PI),m=(l.round,Object.prototype.toString),v=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?%?)\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?%?)\s*\))\s*$/i,y=(n._.separator=/[,\s]+/,/[\s]*,[\s]*/),x={hs:1,rg:1},b=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?[\s]*)+)/gi,_=/([rstm])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?[\s]*)+)/gi,w=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\s]*,?[\s]*/gi,M=0,E="S"+(+new Date).toString(36),S=function(t){return(t&&t.type?t.type:"")+E+(M++).toString(36)},A="http://www.w3.org/1999/xlink",C="http://www.w3.org/2000/svg",T={};n.url=function(t){return"url('#"+t+"')"};function P(t,e){if(e){if("#text"==t&&(t=r.doc.createTextNode(e.text||e["#text"]||"")),"#comment"==t&&(t=r.doc.createComment(e.text||e["#text"]||"")),"string"==typeof t&&(t=P(t)),"string"==typeof e)return 1==t.nodeType?"xlink:"==e.substring(0,6)?t.getAttributeNS(A,e.substring(6)):"xml:"==e.substring(0,4)?t.getAttributeNS(C,e.substring(4)):t.getAttribute(e):"text"==e?t.nodeValue:null;if(1==t.nodeType){for(var n in e)if(e[s](n)){var i=a(e[n]);i?"xlink:"==n.substring(0,6)?t.setAttributeNS(A,n.substring(6),i):"xml:"==n.substring(0,4)?t.setAttributeNS(C,n.substring(4),i):t.setAttribute(n,i):t.removeAttribute(n)}}else"text"in e&&(t.nodeValue=e.text)}else t=r.doc.createElementNS(C,t);return t}function I(t,e){return"finite"==(e=a.prototype.toLowerCase.call(e))?isFinite(t):!("array"!=e||!(t instanceof Array||Array.isArray&&Array.isArray(t)))||("null"==e&&null===t||e==typeof t&&null!==t||"object"==e&&t===Object(t)||m.call(t).slice(8,-1).toLowerCase()==e)}function L(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return t.push(t.splice(n,1)[0])}function R(t,e,n){return function r(){var i=Array.prototype.slice.call(arguments,0),o=i.join("␀"),a=r.cache=r.cache||{},u=r.count=r.count||[];return a[s](o)?(L(u,o),n?n(a[o]):a[o]):(u.length>=1e3&&delete a[u.shift()],u.push(o),a[o]=t.apply(e,i),n?n(a[o]):a[o])}}function O(t){return t%360*d/180}n._.$=P,n._.id=S,n.format=(i=/\{([^\}]+)\}/g,o=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,function(t,e){return a(t).replace(i,(function(t,n){return function(t,e,n){var r=n;return e.replace(o,(function(t,e,n,i,o){e=e||i,r&&(e in r&&(r=r[e]),"function"==typeof r&&o&&(r=r()))})),r=(null==r||r==n?t:r)+""}(t,n,e)}))}),n._.clone=function t(e){if("function"==typeof e||Object(e)!==e)return e;var n=new e.constructor;for(var r in e)e[s](r)&&(n[r]=t(e[r]));return n},n._.cacher=R,n.rad=O,n.deg=function(t){return 180*t/d%360},n.sin=function(t){return l.sin(n.rad(t))},n.tan=function(t){return l.tan(n.rad(t))},n.cos=function(t){return l.cos(n.rad(t))},n.asin=function(t){return n.deg(l.asin(t))},n.acos=function(t){return n.deg(l.acos(t))},n.atan=function(t){return n.deg(l.atan(t))},n.atan2=function(t){return n.deg(l.atan2(t))},n.angle=function t(e,n,r,i,o,s){if(null==o){var a=e-r,u=n-i;return a||u?(180+180*l.atan2(-u,-a)/d+360)%360:0}return t(e,n,o,s)-t(r,i,o,s)},n.len=function(t,e,r,i){return Math.sqrt(n.len2(t,e,r,i))},n.len2=function(t,e,n,r){return(t-n)*(t-n)+(e-r)*(e-r)},n.closestPoint=function(t,e,n){function r(t){var r=t.x-e,i=t.y-n;return r*r+i*i}for(var i,o,s,a,u=t.node,c=u.getTotalLength(),l=c/u.pathSegList.numberOfItems*.125,h=1/0,p=0;p<=c;p+=l)(a=r(s=u.getPointAtLength(p)))<h&&(i=s,o=p,h=a);for(l*=.5;l>.5;){var f,d,g,m,v,y;(g=o-l)>=0&&(v=r(f=u.getPointAtLength(g)))<h?(i=f,o=g,h=v):(m=o+l)<=c&&(y=r(d=u.getPointAtLength(m)))<h?(i=d,o=m,h=y):l*=.5}return i={x:i.x,y:i.y,length:o,distance:Math.sqrt(h)}},n.is=I,n.snapTo=function(t,e,n){if(n=I(n,"finite")?n:10,I(t,"array")){for(var r=t.length;r--;)if(f(t[r]-e)<=n)return t[r]}else{var i=e%(t=+t);if(i<n)return e-i;if(i>t-n)return e-i+t}return e},n.getRGB=R((function(t){if(!t||(t=a(t)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:N};if("none"==t)return{r:-1,g:-1,b:-1,hex:"none",toString:N};if(!x[s](t.toLowerCase().substring(0,2))&&"#"!=t.charAt()&&(t=D(t)),!t)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:N};var e,r,i,o,f,d,g=t.match(v);return g?(g[2]&&(i=c(g[2].substring(5),16),r=c(g[2].substring(3,5),16),e=c(g[2].substring(1,3),16)),g[3]&&(i=c((f=g[3].charAt(3))+f,16),r=c((f=g[3].charAt(2))+f,16),e=c((f=g[3].charAt(1))+f,16)),g[4]&&(d=g[4].split(y),e=u(d[0]),"%"==d[0].slice(-1)&&(e*=2.55),r=u(d[1]),"%"==d[1].slice(-1)&&(r*=2.55),i=u(d[2]),"%"==d[2].slice(-1)&&(i*=2.55),"rgba"==g[1].toLowerCase().slice(0,4)&&(o=u(d[3])),d[3]&&"%"==d[3].slice(-1)&&(o/=100)),g[5]?(d=g[5].split(y),e=u(d[0]),"%"==d[0].slice(-1)&&(e/=100),r=u(d[1]),"%"==d[1].slice(-1)&&(r/=100),i=u(d[2]),"%"==d[2].slice(-1)&&(i/=100),("deg"==d[0].slice(-3)||"°"==d[0].slice(-1))&&(e/=360),"hsba"==g[1].toLowerCase().slice(0,4)&&(o=u(d[3])),d[3]&&"%"==d[3].slice(-1)&&(o/=100),n.hsb2rgb(e,r,i,o)):g[6]?(d=g[6].split(y),e=u(d[0]),"%"==d[0].slice(-1)&&(e/=100),r=u(d[1]),"%"==d[1].slice(-1)&&(r/=100),i=u(d[2]),"%"==d[2].slice(-1)&&(i/=100),("deg"==d[0].slice(-3)||"°"==d[0].slice(-1))&&(e/=360),"hsla"==g[1].toLowerCase().slice(0,4)&&(o=u(d[3])),d[3]&&"%"==d[3].slice(-1)&&(o/=100),n.hsl2rgb(e,r,i,o)):(e=p(l.round(e),255),r=p(l.round(r),255),i=p(l.round(i),255),o=p(h(o,0),1),(g={r:e,g:r,b:i,toString:N}).hex="#"+(16777216|i|r<<8|e<<16).toString(16).slice(1),g.opacity=I(o,"finite")?o:1,g)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:N}}),n),n.hsb=R((function(t,e,r){return n.hsb2rgb(t,e,r).hex})),n.hsl=R((function(t,e,r){return n.hsl2rgb(t,e,r).hex})),n.rgb=R((function(t,e,n,r){if(I(r,"finite")){var i=l.round;return"rgba("+[i(t),i(e),i(n),+r.toFixed(2)]+")"}return"#"+(16777216|n|e<<8|t<<16).toString(16).slice(1)}));var D=function(t){var e=r.doc.getElementsByTagName("head")[0]||r.doc.getElementsByTagName("svg")[0],n="rgb(255, 0, 0)";return(D=R((function(t){if("red"==t.toLowerCase())return n;e.style.color=n,e.style.color=t;var i=r.doc.defaultView.getComputedStyle(e,"").getPropertyValue("color");return i==n?null:i})))(t)},B=function(){return"hsb("+[this.h,this.s,this.b]+")"},F=function(){return"hsl("+[this.h,this.s,this.l]+")"},N=function(){return 1==this.opacity||null==this.opacity?this.hex:"rgba("+[this.r,this.g,this.b,this.opacity]+")"},k=function(t,e,r){if(null==e&&I(t,"object")&&"r"in t&&"g"in t&&"b"in t&&(r=t.b,e=t.g,t=t.r),null==e&&I(t,string)){var i=n.getRGB(t);t=i.r,e=i.g,r=i.b}return(t>1||e>1||r>1)&&(t/=255,e/=255,r/=255),[t,e,r]},G=function(t,e,r,i){var o={r:t=l.round(255*t),g:e=l.round(255*e),b:r=l.round(255*r),opacity:I(i,"finite")?i:1,hex:n.rgb(t,e,r),toString:N};return I(i,"finite")&&(o.opacity=i),o};n.color=function(t){var e;return I(t,"object")&&"h"in t&&"s"in t&&"b"in t?(e=n.hsb2rgb(t),t.r=e.r,t.g=e.g,t.b=e.b,t.opacity=1,t.hex=e.hex):I(t,"object")&&"h"in t&&"s"in t&&"l"in t?(e=n.hsl2rgb(t),t.r=e.r,t.g=e.g,t.b=e.b,t.opacity=1,t.hex=e.hex):(I(t,"string")&&(t=n.getRGB(t)),I(t,"object")&&"r"in t&&"g"in t&&"b"in t&&!("error"in t)?(e=n.rgb2hsl(t),t.h=e.h,t.s=e.s,t.l=e.l,e=n.rgb2hsb(t),t.v=e.b):((t={hex:"none"}).r=t.g=t.b=t.h=t.s=t.v=t.l=-1,t.error=1)),t.toString=N,t},n.hsb2rgb=function(t,e,n,r){var i,o,s,a,u;return I(t,"object")&&"h"in t&&"s"in t&&"b"in t&&(n=t.b,e=t.s,r=t.o,t=t.h),a=(u=n*e)*(1-f((t=(t*=360)%360/60)%2-1)),i=o=s=n-u,G(i+=[u,a,0,0,a,u][t=~~t],o+=[a,u,u,a,0,0][t],s+=[0,0,a,u,u,a][t],r)},n.hsl2rgb=function(t,e,n,r){var i,o,s,a,u;return I(t,"object")&&"h"in t&&"s"in t&&"l"in t&&(n=t.l,e=t.s,t=t.h),(t>1||e>1||n>1)&&(t/=360,e/=100,n/=100),a=(u=2*e*(n<.5?n:1-n))*(1-f((t=(t*=360)%360/60)%2-1)),i=o=s=n-u/2,G(i+=[u,a,0,0,a,u][t=~~t],o+=[a,u,u,a,0,0][t],s+=[0,0,a,u,u,a][t],r)},n.rgb2hsb=function(t,e,n){var r,i;return t=(n=k(t,e,n))[0],e=n[1],n=n[2],{h:((0==(i=(r=h(t,e,n))-p(t,e,n))?null:r==t?(e-n)/i:r==e?(n-t)/i+2:(t-e)/i+4)+360)%6*60/360,s:0==i?0:i/r,b:r,toString:B}},n.rgb2hsl=function(t,e,n){var r,i,o,s;return t=(n=k(t,e,n))[0],e=n[1],n=n[2],r=((i=h(t,e,n))+(o=p(t,e,n)))/2,{h:((0==(s=i-o)?null:i==t?(e-n)/s:i==e?(n-t)/s+2:(t-e)/s+4)+360)%6*60/360,s:0==s?0:r<.5?s/(2*r):s/(2-2*r),l:r,toString:F}},n.parsePathString=function(t){if(!t)return null;var e=n.path(t);if(e.arr)return n.path.clone(e.arr);var r={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},i=[];return I(t,"array")&&I(t[0],"array")&&(i=n.path.clone(t)),i.length||a(t).replace(b,(function(t,e,n){var o=[],s=e.toLowerCase();if(n.replace(w,(function(t,e){e&&o.push(+e)})),"m"==s&&o.length>2&&(i.push([e].concat(o.splice(0,2))),s="l",e="m"==e?"l":"L"),"o"==s&&1==o.length&&i.push([e,o[0]]),"r"==s)i.push([e].concat(o));else for(;o.length>=r[s]&&(i.push([e].concat(o.splice(0,r[s]))),r[s]););})),i.toString=n.path.toString,e.arr=n.path.clone(i),i};var U=n.parseTransformString=function(t){if(!t)return null;var e=[];return I(t,"array")&&I(t[0],"array")&&(e=n.path.clone(t)),e.length||a(t).replace(_,(function(t,n,r){var i=[];n.toLowerCase();r.replace(w,(function(t,e){e&&i.push(+e)})),e.push([n].concat(i))})),e.toString=n.path.toString,e};n._.svgTransform2string=function(t){var e=[];return t=t.replace(/(?:^|\s)(\w+)\(([^)]+)\)/g,(function(t,n,r){return r=r.split(/\s*,\s*|\s+/),"rotate"==n&&1==r.length&&r.push(0,0),"scale"==n&&(r.length>2?r=r.slice(0,2):2==r.length&&r.push(0,0),1==r.length&&r.push(r[0],0,0)),"skewX"==n?e.push(["m",1,0,l.tan(O(r[0])),1,0,0]):"skewY"==n?e.push(["m",1,l.tan(O(r[0])),0,1,0,0]):e.push([n.charAt(0)].concat(r)),t})),e},n._.rgTransform=/^[a-z][\s]*-?\.?\d/i,n._.transform2matrix=function(t,e){var r=U(t),i=new n.Matrix;if(r)for(var o=0,s=r.length;o<s;o++){var u,c,l,h,p,f=r[o],d=f.length,g=a(f[0]).toLowerCase(),m=f[0]!=g,v=m?i.invert():0;"t"==g&&2==d?i.translate(f[1],0):"t"==g&&3==d?m?(u=v.x(0,0),c=v.y(0,0),l=v.x(f[1],f[2]),h=v.y(f[1],f[2]),i.translate(l-u,h-c)):i.translate(f[1],f[2]):"r"==g?2==d?(p=p||e,i.rotate(f[1],p.x+p.width/2,p.y+p.height/2)):4==d&&(m?(l=v.x(f[2],f[3]),h=v.y(f[2],f[3]),i.rotate(f[1],l,h)):i.rotate(f[1],f[2],f[3])):"s"==g?2==d||3==d?(p=p||e,i.scale(f[1],f[d-1],p.x+p.width/2,p.y+p.height/2)):4==d?m?(l=v.x(f[2],f[3]),h=v.y(f[2],f[3]),i.scale(f[1],f[1],l,h)):i.scale(f[1],f[1],f[2],f[3]):5==d&&(m?(l=v.x(f[3],f[4]),h=v.y(f[3],f[4]),i.scale(f[1],f[2],l,h)):i.scale(f[1],f[2],f[3],f[4])):"m"==g&&7==d&&i.add(f[1],f[2],f[3],f[4],f[5],f[6])}return i},n._unit2px=function(t,e,n){var r=z(t).node,i={},o=r.querySelector(".svg---mgr");o||(o=P("rect"),P(o,{x:-9e9,y:-9e9,width:10,height:10,class:"svg---mgr",fill:"none"}),r.appendChild(o));function s(t){if(null==t)return"";if(t==+t)return t;P(o,{width:t});try{return o.getBBox().width}catch(t){return 0}}function a(t){if(null==t)return"";if(t==+t)return t;P(o,{height:t});try{return o.getBBox().height}catch(t){return 0}}function u(r,o){null==e?i[r]=o(t.attr(r)||0):r==e&&(i=o(null==n?t.attr(r)||0:n))}switch(t.type){case"rect":u("rx",s),u("ry",a);case"image":u("width",s),u("height",a);case"text":u("x",s),u("y",a);break;case"circle":u("cx",s),u("cy",a),u("r",s);break;case"ellipse":u("cx",s),u("cy",a),u("rx",s),u("ry",a);break;case"line":u("x1",s),u("x2",s),u("y1",a),u("y2",a);break;case"marker":u("refX",s),u("markerWidth",s),u("refY",a),u("markerHeight",a);break;case"radialGradient":u("fx",s),u("fy",a);break;case"tspan":u("dx",s),u("dy",a);break;default:u(e,s)}return r.removeChild(o),i};r.doc.contains||r.doc.compareDocumentPosition;function z(t){return t.node.ownerSVGElement&&X(t.node.ownerSVGElement)||n.select("svg")}function H(t){I(t,"array")||(t=Array.prototype.slice.call(arguments,0));for(var e=0,n=0,r=this.node;this[e];)delete this[e++];for(e=0;e<t.length;e++)"set"==t[e].type?t[e].forEach((function(t){r.appendChild(t.node)})):r.appendChild(t[e].node);var i=r.childNodes;for(e=0;e<i.length;e++)this[n++]=X(i[e]);return this}function V(t){if(t.snap in T)return T[t.snap];var e;try{e=t.ownerSVGElement}catch(t){}this.node=t,e&&(this.paper=new q(e)),this.type=t.tagName||t.nodeName;var n=this.id=S(this);if(this.anims={},this._={transform:[]},t.snap=n,T[n]=this,"g"==this.type&&(this.add=H),this.type in{g:1,mask:1,pattern:1,symbol:1})for(var r in q.prototype)q.prototype[s](r)&&(this[r]=q.prototype[r])}function j(t){this.node=t}function W(t,e){var n=P(t);return e.appendChild(n),X(n)}function q(t,e){var n,i,o,a=q.prototype;if(t&&t.tagName&&"svg"==t.tagName.toLowerCase()){if(t.snap in T)return T[t.snap];var u=t.ownerDocument;for(var c in n=new V(t),i=t.getElementsByTagName("desc")[0],o=t.getElementsByTagName("defs")[0],i||((i=P("desc")).appendChild(u.createTextNode("Created with Snap")),n.node.appendChild(i)),o||(o=P("defs"),n.node.appendChild(o)),n.defs=o,a)a[s](c)&&(n[c]=a[c]);n.paper=n.root=n}else P((n=W("svg",r.doc.body)).node,{height:e,version:1.1,width:t,xmlns:C});return n}function X(t){return t?t instanceof V||t instanceof j?t:t.tagName&&"svg"==t.tagName.toLowerCase()?new q(t):t.tagName&&"object"==t.tagName.toLowerCase()&&"image/svg+xml"==t.type?new q(t.contentDocument.getElementsByTagName("svg")[0]):new V(t):t}n._.getSomeDefs=function(t){var e=t.node.ownerSVGElement&&X(t.node.ownerSVGElement)||t.node.parentNode&&X(t.node.parentNode)||n.select("svg")||n(0,0),r=e.select("defs"),i=null!=r&&r.node;return i||(i=W("defs",e.node).node),i},n._.getSomeSVG=z,n.select=function(t){return t=a(t).replace(/([^\\]):/g,"$1\\:"),X(r.doc.querySelector(t))},n.selectAll=function(t){for(var e=r.doc.querySelectorAll(t),i=(n.set||Array)(),o=0;o<e.length;o++)i.push(X(e[o]));return i},setInterval((function(){for(var t in T)if(T[s](t)){var e=T[t],n=e.node;("svg"!=e.type&&!n.ownerSVGElement||"svg"==e.type&&(!n.parentNode||"ownerSVGElement"in n.parentNode&&!n.ownerSVGElement))&&delete T[t]}}),1e4),V.prototype.attr=function(t,n){var r=this,i=r.node;if(!t){if(1!=i.nodeType)return{text:i.nodeValue};for(var o=i.attributes,a={},u=0,c=o.length;u<c;u++)a[o[u].nodeName]=o[u].nodeValue;return a}if(I(t,"string")){if(!(arguments.length>1))return e("snap.util.getattr."+t,r).firstDefined();var l={};l[t]=n,t=l}for(var h in t)t[s](h)&&e("snap.util.attr."+h,r,t[h]);return r},n.parse=function(t){var e=r.doc.createDocumentFragment(),n=!0,i=r.doc.createElement("div");if((t=a(t)).match(/^\s*<\s*svg(?:\s|>)/)||(t="<svg>"+t+"</svg>",n=!1),i.innerHTML=t,t=i.getElementsByTagName("svg")[0])if(n)e=t;else for(;t.firstChild;)e.appendChild(t.firstChild);return new j(e)},n.fragment=function(){for(var t=Array.prototype.slice.call(arguments,0),e=r.doc.createDocumentFragment(),i=0,o=t.length;i<o;i++){var s=t[i];s.node&&s.node.nodeType&&e.appendChild(s.node),s.nodeType&&e.appendChild(s),"string"==typeof s&&e.appendChild(n.parse(s).node)}return new j(e)},n._.make=W,n._.wrap=X,q.prototype.el=function(t,e){var n=W(t,this.node);return e&&n.attr(e),n},V.prototype.children=function(){for(var t=[],e=this.node.childNodes,r=0,i=e.length;r<i;r++)t[r]=n(e[r]);return t},V.prototype.toJSON=function(){var t=[];return function t(e,n){for(var r=0,i=e.length;r<i;r++){var o={type:e[r].type,attr:e[r].attr()},s=e[r].children();n.push(o),s.length&&t(s,o.childNodes=[])}}([this],t),t[0]},e.on("snap.util.getattr",(function(){var t=e.nt(),n=(t=t.substring(t.lastIndexOf(".")+1)).replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()}));return Y[s](n)?this.node.ownerDocument.defaultView.getComputedStyle(this.node,null).getPropertyValue(n):P(this.node,t)}));var Y={"alignment-baseline":0,"baseline-shift":0,clip:0,"clip-path":0,"clip-rule":0,color:0,"color-interpolation":0,"color-interpolation-filters":0,"color-profile":0,"color-rendering":0,cursor:0,direction:0,display:0,"dominant-baseline":0,"enable-background":0,fill:0,"fill-opacity":0,"fill-rule":0,filter:0,"flood-color":0,"flood-opacity":0,font:0,"font-family":0,"font-size":0,"font-size-adjust":0,"font-stretch":0,"font-style":0,"font-variant":0,"font-weight":0,"glyph-orientation-horizontal":0,"glyph-orientation-vertical":0,"image-rendering":0,kerning:0,"letter-spacing":0,"lighting-color":0,marker:0,"marker-end":0,"marker-mid":0,"marker-start":0,mask:0,opacity:0,overflow:0,"pointer-events":0,"shape-rendering":0,"stop-color":0,"stop-opacity":0,stroke:0,"stroke-dasharray":0,"stroke-dashoffset":0,"stroke-linecap":0,"stroke-linejoin":0,"stroke-miterlimit":0,"stroke-opacity":0,"stroke-width":0,"text-anchor":0,"text-decoration":0,"text-rendering":0,"unicode-bidi":0,visibility:0,"word-spacing":0,"writing-mode":0};e.on("snap.util.attr",(function(t){var n=e.nt(),r={};r[n=n.substring(n.lastIndexOf(".")+1)]=t;var i=n.replace(/-(\w)/gi,(function(t,e){return e.toUpperCase()})),o=n.replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()}));Y[s](o)?this.node.style[i]=null==t?"":t:P(this.node,r)})),q.prototype,n.ajax=function(t,n,r,i){var o=new XMLHttpRequest,s=S();if(o){if(I(n,"function"))i=r,r=n,n=null;else if(I(n,"object")){var a=[];for(var u in n)n.hasOwnProperty(u)&&a.push(encodeURIComponent(u)+"="+encodeURIComponent(n[u]));n=a.join("&")}return o.open(n?"POST":"GET",t,!0),n&&(o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.setRequestHeader("Content-type","application/x-www-form-urlencoded")),r&&(e.once("snap.ajax."+s+".0",r),e.once("snap.ajax."+s+".200",r),e.once("snap.ajax."+s+".304",r)),o.onreadystatechange=function(){4==o.readyState&&(e("snap.ajax."+s+"."+o.status,i,o),e.off("snap.ajax."+s+".0"),e.off("snap.ajax."+s+".200"),e.off("snap.ajax."+s+".304"))},4==o.readyState?o:(o.send(n),o)}},n.load=function(t,e,r){n.ajax(t,(function(t){var i=n.parse(t.responseText);r?e.call(r,i):e(i)}))};return n.getElementByPoint=function(t,e){this.canvas;var n,i,o,s,a,u,c,l=r.doc.elementFromPoint(t,e);if(r.win.opera&&"svg"==l.tagName){var h=(i=(n=l).getBoundingClientRect(),o=n.ownerDocument,s=o.body,a=o.documentElement,u=a.clientTop||s.clientTop||0,c=a.clientLeft||s.clientLeft||0,{y:i.top+(g.win.pageYOffset||a.scrollTop||s.scrollTop)-u,x:i.left+(g.win.pageXOffset||a.scrollLeft||s.scrollLeft)-c}),p=l.createSVGRect();p.x=t-h.x,p.y=e-h.y,p.width=p.height=1;var f=l.getIntersectionList(p,null);f.length&&(l=f[f.length-1])}return l?X(l):null},n.plugin=function(t){t(n,V,q,r,j)},r.win.Snap=n,n}(t||this);return r.plugin((function(n,r,i,o,s){var a=r.prototype,u=n.is,c=String,l=n._unit2px,h=n._.$,p=n._.make,f=n._.getSomeDefs,d="hasOwnProperty",g=n._.wrap;a.getBBox=function(t){if("tspan"==this.type)return n._.box(this.node.getClientRects().item(0));if(!n.Matrix||!n.path)return this.node.getBBox();var e=this,r=new n.Matrix;if(e.removed)return n._.box();for(;"use"==e.type;)if(t||(r=r.add(e.transform().localMatrix.translate(e.attr("x")||0,e.attr("y")||0))),e.original)e=e.original;else{var i=e.attr("xlink:href");e=e.original=e.node.ownerDocument.getElementById(i.substring(i.indexOf("#")+1))}var o=e._,s=n.path.get[e.type]||n.path.get.deflt;try{return t?(o.bboxwt=s?n.path.getBBox(e.realPath=s(e)):n._.box(e.node.getBBox()),n._.box(o.bboxwt)):(e.realPath=s(e),e.matrix=e.transform().localMatrix,o.bbox=n.path.getBBox(n.path.map(e.realPath,r.add(e.matrix))),n._.box(o.bbox))}catch(t){return n._.box()}};var m=function(){return this.string};function v(t,e){if(null==e){var r=!0;if(!(e="linearGradient"==t.type||"radialGradient"==t.type?t.node.getAttribute("gradientTransform"):"pattern"==t.type?t.node.getAttribute("patternTransform"):t.node.getAttribute("transform")))return new n.Matrix;e=n._.svgTransform2string(e)}else e=n._.rgTransform.test(e)?c(e).replace(/\.{3}|\u2026/g,t._.transform||""):n._.svgTransform2string(e),u(e,"array")&&(e=n.path?n.path.toString.call(e):c(e)),t._.transform=e;var i=n._.transform2matrix(e,t.getBBox(1));if(r)return i;t.matrix=i}a.transform=function(t){var e=this._;if(null==t){for(var r,i=this,o=new n.Matrix(this.node.getCTM()),s=v(this),a=[s],u=new n.Matrix,l=s.toTransformString(),p=c(s)==c(this.matrix)?c(e.transform):l;"svg"!=i.type&&(i=i.parent());)a.push(v(i));for(r=a.length;r--;)u.add(a[r]);return{string:p,globalMatrix:o,totalMatrix:u,localMatrix:s,diffMatrix:o.clone().add(s.invert()),global:o.toTransformString(),total:u.toTransformString(),local:l,toString:m}}return t instanceof n.Matrix?(this.matrix=t,this._.transform=t.toTransformString()):v(this,t),this.node&&("linearGradient"==this.type||"radialGradient"==this.type?h(this.node,{gradientTransform:this.matrix}):"pattern"==this.type?h(this.node,{patternTransform:this.matrix}):h(this.node,{transform:this.matrix})),this},a.parent=function(){return g(this.node.parentNode)},a.append=a.add=function(t){if(t){if("set"==t.type){var e=this;return t.forEach((function(t){e.add(t)})),this}t=g(t),this.node.appendChild(t.node),t.paper=this.paper}return this},a.appendTo=function(t){return t&&(t=g(t)).append(this),this},a.prepend=function(t){if(t){if("set"==t.type){var e,n=this;return t.forEach((function(t){e?e.after(t):n.prepend(t),e=t})),this}var r=(t=g(t)).parent();this.node.insertBefore(t.node,this.node.firstChild),this.add&&this.add(),t.paper=this.paper,this.parent()&&this.parent().add(),r&&r.add()}return this},a.prependTo=function(t){return(t=g(t)).prepend(this),this},a.before=function(t){if("set"==t.type){var e=this;return t.forEach((function(t){var n=t.parent();e.node.parentNode.insertBefore(t.node,e.node),n&&n.add()})),this.parent().add(),this}var n=(t=g(t)).parent();return this.node.parentNode.insertBefore(t.node,this.node),this.parent()&&this.parent().add(),n&&n.add(),t.paper=this.paper,this},a.after=function(t){var e=(t=g(t)).parent();return this.node.nextSibling?this.node.parentNode.insertBefore(t.node,this.node.nextSibling):this.node.parentNode.appendChild(t.node),this.parent()&&this.parent().add(),e&&e.add(),t.paper=this.paper,this},a.insertBefore=function(t){t=g(t);var e=this.parent();return t.node.parentNode.insertBefore(this.node,t.node),this.paper=t.paper,e&&e.add(),t.parent()&&t.parent().add(),this},a.insertAfter=function(t){t=g(t);var e=this.parent();return t.node.parentNode.insertBefore(this.node,t.node.nextSibling),this.paper=t.paper,e&&e.add(),t.parent()&&t.parent().add(),this},a.remove=function(){var t=this.parent();return this.node.parentNode&&this.node.parentNode.removeChild(this.node),delete this.paper,this.removed=!0,t&&t.add(),this},a.select=function(t){return g(this.node.querySelector(t))},a.selectAll=function(t){for(var e=this.node.querySelectorAll(t),r=(n.set||Array)(),i=0;i<e.length;i++)r.push(g(e[i]));return r},a.asPX=function(t,e){return null==e&&(e=this.attr(t)),+l(this,t,e)},a.use=function(){var t,e=this.node.id;return e||(e=this.id,h(this.node,{id:e})),t="linearGradient"==this.type||"radialGradient"==this.type||"pattern"==this.type?p(this.type,this.node.parentNode):p("use",this.node.parentNode),h(t.node,{"xlink:href":"#"+e}),t.original=this,t},a.clone=function(){var t=g(this.node.cloneNode(!0));return h(t.node,"id")&&h(t.node,{id:t.id}),function(t){var e,r=t.selectAll("*"),i=/^\s*url\(("|'|)(.*)\1\)\s*$/,o=[],s={};function a(t,e){var r=h(t.node,e);(r=(r=r&&r.match(i))&&r[2])&&"#"==r.charAt()&&(r=r.substring(1))&&(s[r]=(s[r]||[]).concat((function(r){var i={};i[e]=n.url(r),h(t.node,i)})))}function u(t){var e=h(t.node,"xlink:href");e&&"#"==e.charAt()&&(e=e.substring(1))&&(s[e]=(s[e]||[]).concat((function(e){t.attr("xlink:href","#"+e)})))}for(var c=0,l=r.length;c<l;c++){a(e=r[c],"fill"),a(e,"stroke"),a(e,"filter"),a(e,"mask"),a(e,"clip-path"),u(e);var p=h(e.node,"id");p&&(h(e.node,{id:e.id}),o.push({old:p,id:e.id}))}for(c=0,l=o.length;c<l;c++){var f=s[o[c].old];if(f)for(var d=0,g=f.length;d<g;d++)f[d](o[c].id)}}(t),t.insertAfter(this),t},a.toDefs=function(){return f(this).appendChild(this.node),this},a.pattern=a.toPattern=function(t,e,n,r){var i=p("pattern",f(this));return null==t&&(t=this.getBBox()),u(t,"object")&&"x"in t&&(e=t.y,n=t.width,r=t.height,t=t.x),h(i.node,{x:t,y:e,width:n,height:r,patternUnits:"userSpaceOnUse",id:i.id,viewBox:[t,e,n,r].join(" ")}),i.node.appendChild(this.node),i},a.marker=function(t,e,n,r,i,o){var s=p("marker",f(this));return null==t&&(t=this.getBBox()),u(t,"object")&&"x"in t&&(e=t.y,n=t.width,r=t.height,i=t.refX||t.cx,o=t.refY||t.cy,t=t.x),h(s.node,{viewBox:[t,e,n,r].join(" "),markerWidth:n,markerHeight:r,orient:"auto",refX:i||0,refY:o||0,id:s.id}),s.node.appendChild(this.node),s};var y={};function x(t){return function(){var e=t?"<"+this.type:"",n=this.node.attributes,r=this.node.childNodes;if(t)for(var i=0,o=n.length;i<o;i++)e+=" "+n[i].name+'="'+n[i].value.replace(/"/g,'\\"')+'"';if(r.length){for(t&&(e+=">"),i=0,o=r.length;i<o;i++)3==r[i].nodeType?e+=r[i].nodeValue:1==r[i].nodeType&&(e+=g(r[i]).toString());t&&(e+="</"+this.type+">")}else t&&(e+="/>");return e}}a.data=function(t,r){var i=y[this.id]=y[this.id]||{};if(0==arguments.length)return e("snap.data.get."+this.id,this,i,null),i;if(1==arguments.length){if(n.is(t,"object")){for(var o in t)t[d](o)&&this.data(o,t[o]);return this}return e("snap.data.get."+this.id,this,i[t],t),i[t]}return i[t]=r,e("snap.data.set."+this.id,this,r,t),this},a.removeData=function(t){return null==t?y[this.id]={}:y[this.id]&&delete y[this.id][t],this},a.outerSVG=a.toString=x(1),a.innerSVG=x(),a.toDataURL=function(){if(t&&t.btoa){var e=this.getBBox(),r=n.format('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="{width}" height="{height}" viewBox="{x} {y} {width} {height}">{contents}</svg>',{x:+e.x.toFixed(3),y:+e.y.toFixed(3),width:+e.width.toFixed(3),height:+e.height.toFixed(3),contents:this.outerSVG()});return"data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(r)))}},s.prototype.select=a.select,s.prototype.selectAll=a.selectAll})),r.plugin((function(t,r,i,o,s){var a=r.prototype,u=t.is,c=String,l="hasOwnProperty";function h(t,e,n){return function(r){var i=r.slice(t,e);return 1==i.length&&(i=i[0]),n?n(i):i}}var p=function(t,e,r,i){"function"!=typeof r||r.length||(i=r,r=n.linear),this.attr=t,this.dur=e,r&&(this.easing=r),i&&(this.callback=i)};t._.Animation=p,t.animation=function(t,e,n,r){return new p(t,e,n,r)},a.inAnim=function(){var t=[];for(var e in this.anims)this.anims[l](e)&&function(e){t.push({anim:new p(e._attrs,e.dur,e.easing,e._callback),mina:e,curStatus:e.status(),status:function(t){return e.status(t)},stop:function(){e.stop()}})}(this.anims[e]);return t},t.animate=function(t,r,i,o,s,a){"function"!=typeof s||s.length||(a=s,s=n.linear);var u=n.time(),c=n(t,r,u,u+o,n.time,i,s);return a&&e.once("mina.finish."+c.id,a),c},a.stop=function(){for(var t=this.inAnim(),e=0,n=t.length;e<n;e++)t[e].stop();return this},a.animate=function(t,r,i,o){"function"!=typeof i||i.length||(o=i,i=n.linear),t instanceof p&&(o=t.callback,i=t.easing,r=t.dur,t=t.attr);var s,a,f,d,g=[],m=[],v={},y=this;for(var x in t)if(t[l](x)){y.equal?(s=(d=y.equal(x,c(t[x]))).from,a=d.to,f=d.f):(s=+y.attr(x),a=+t[x]);var b=u(s,"array")?s.length:1;v[x]=h(g.length,g.length+b,f),g=g.concat(s),m=m.concat(a)}var _=n.time(),w=n(g,m,_,_+r,n.time,(function(t){var e={};for(var n in v)v[l](n)&&(e[n]=v[n](t));y.attr(e)}),i);return y.anims[w.id]=w,w._attrs=t,w._callback=o,e("snap.animcreated."+y.id,w),e.once("mina.finish."+w.id,(function(){e.off("mina.*."+w.id),delete y.anims[w.id],o&&o.call(y)})),e.once("mina.stop."+w.id,(function(){e.off("mina.*."+w.id),delete y.anims[w.id]})),y}})),r.plugin((function(t,e,n,r,i){var o=Object.prototype.toString,s=String,a=Math;function u(t,e,n,r,i,s){if(null==e&&"[object SVGMatrix]"==o.call(t))return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.e=t.e,void(this.f=t.f);null!=t?(this.a=+t,this.b=+e,this.c=+n,this.d=+r,this.e=+i,this.f=+s):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}!function(e){function n(t){return t[0]*t[0]+t[1]*t[1]}function r(t){var e=a.sqrt(n(t));t[0]&&(t[0]/=e),t[1]&&(t[1]/=e)}e.add=function(t,e,n,r,i,o){if(t&&t instanceof u)return this.add(t.a,t.b,t.c,t.d,t.e,t.f);var s=t*this.a+e*this.c,a=t*this.b+e*this.d;return this.e+=i*this.a+o*this.c,this.f+=i*this.b+o*this.d,this.c=n*this.a+r*this.c,this.d=n*this.b+r*this.d,this.a=s,this.b=a,this},u.prototype.multLeft=function(t,e,n,r,i,o){if(t&&t instanceof u)return this.multLeft(t.a,t.b,t.c,t.d,t.e,t.f);var s=t*this.a+n*this.b,a=t*this.c+n*this.d,c=t*this.e+n*this.f+i;return this.b=e*this.a+r*this.b,this.d=e*this.c+r*this.d,this.f=e*this.e+r*this.f+o,this.a=s,this.c=a,this.e=c,this},e.invert=function(){var t=this,e=t.a*t.d-t.b*t.c;return new u(t.d/e,-t.b/e,-t.c/e,t.a/e,(t.c*t.f-t.d*t.e)/e,(t.b*t.e-t.a*t.f)/e)},e.clone=function(){return new u(this.a,this.b,this.c,this.d,this.e,this.f)},e.translate=function(t,e){return this.e+=t*this.a+e*this.c,this.f+=t*this.b+e*this.d,this},e.scale=function(t,e,n,r){return null==e&&(e=t),(n||r)&&this.translate(n,r),this.a*=t,this.b*=t,this.c*=e,this.d*=e,(n||r)&&this.translate(-n,-r),this},e.rotate=function(e,n,r){e=t.rad(e),n=n||0,r=r||0;var i=+a.cos(e).toFixed(9),o=+a.sin(e).toFixed(9);return this.add(i,o,-o,i,n,r),this.add(1,0,0,1,-n,-r)},e.skewX=function(t){return this.skew(t,0)},e.skewY=function(t){return this.skew(0,t)},e.skew=function(e,n){e=e||0,n=n||0,e=t.rad(e),n=t.rad(n);var r=a.tan(e).toFixed(9),i=a.tan(n).toFixed(9);return this.add(1,i,r,1,0,0)},e.x=function(t,e){return t*this.a+e*this.c+this.e},e.y=function(t,e){return t*this.b+e*this.d+this.f},e.get=function(t){return+this[s.fromCharCode(97+t)].toFixed(4)},e.toString=function(){return"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")"},e.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},e.determinant=function(){return this.a*this.d-this.b*this.c},e.split=function(){var e={};e.dx=this.e,e.dy=this.f;var i=[[this.a,this.b],[this.c,this.d]];e.scalex=a.sqrt(n(i[0])),r(i[0]),e.shear=i[0][0]*i[1][0]+i[0][1]*i[1][1],i[1]=[i[1][0]-i[0][0]*e.shear,i[1][1]-i[0][1]*e.shear],e.scaley=a.sqrt(n(i[1])),r(i[1]),e.shear/=e.scaley,this.determinant()<0&&(e.scalex=-e.scalex);var o=i[0][1],s=i[1][1];return s<0?(e.rotate=t.deg(a.acos(s)),o<0&&(e.rotate=360-e.rotate)):e.rotate=t.deg(a.asin(o)),e.isSimple=!(+e.shear.toFixed(9)||e.scalex.toFixed(9)!=e.scaley.toFixed(9)&&e.rotate),e.isSuperSimple=!+e.shear.toFixed(9)&&e.scalex.toFixed(9)==e.scaley.toFixed(9)&&!e.rotate,e.noRotation=!+e.shear.toFixed(9)&&!e.rotate,e},e.toTransformString=function(t){var e=t||this.split();return+e.shear.toFixed(9)?"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]:(e.scalex=+e.scalex.toFixed(4),e.scaley=+e.scaley.toFixed(4),e.rotate=+e.rotate.toFixed(4),(e.dx||e.dy?"t"+[+e.dx.toFixed(4),+e.dy.toFixed(4)]:"")+(e.rotate?"r"+[+e.rotate.toFixed(4),0,0]:"")+(1!=e.scalex||1!=e.scaley?"s"+[e.scalex,e.scaley,0,0]:""))}}(u.prototype),t.Matrix=u,t.matrix=function(t,e,n,r,i,o){return new u(t,e,n,r,i,o)}})),r.plugin((function(t,n,r,i,o){var s,a=t._.make,u=t._.wrap,c=t.is,l=t._.getSomeDefs,h=/^url\((['"]?)([^)]+)\1\)$/,p=t._.$,f=t.url,d=String,g=t._.separator;function m(r){return function(i){if(e.stop(),i instanceof o&&1==i.node.childNodes.length&&("radialGradient"==i.node.firstChild.tagName||"linearGradient"==i.node.firstChild.tagName||"pattern"==i.node.firstChild.tagName)&&(i=i.node.firstChild,l(this).appendChild(i),i=u(i)),i instanceof n)if("radialGradient"==i.type||"linearGradient"==i.type||"pattern"==i.type){i.node.id||p(i.node,{id:i.id});var s=f(i.node.id)}else s=i.attr(r);else if((s=t.color(i)).error){var a=t(l(this).ownerSVGElement).gradient(i);a?(a.node.id||p(a.node,{id:a.id}),s=f(a.node.id)):s=i}else s=d(s);var c={};c[r]=s,p(this.node,c),this.node.style[r]=""}}t.deurl=function(t){var e=String(t).match(h);return e?e[2]:t},e.on("snap.util.attr.mask",(function(t){if(t instanceof n||t instanceof o){if(e.stop(),t instanceof o&&1==t.node.childNodes.length&&(t=t.node.firstChild,l(this).appendChild(t),t=u(t)),"mask"==t.type)var r=t;else(r=a("mask",l(this))).node.appendChild(t.node);!r.node.id&&p(r.node,{id:r.id}),p(this.node,{mask:f(r.id)})}})),s=function(t){if(t instanceof n||t instanceof o){e.stop();for(var r,i=t.node;i;){if("clipPath"===i.nodeName){r=new n(i);break}if("svg"===i.nodeName){r=void 0;break}i=i.parentNode}r||((r=a("clipPath",l(this))).node.appendChild(t.node),!r.node.id&&p(r.node,{id:r.id})),p(this.node,{"clip-path":f(r.node.id||r.id)})}},e.on("snap.util.attr.clip",s),e.on("snap.util.attr.clip-path",s),e.on("snap.util.attr.clipPath",s),e.on("snap.util.attr.fill",m("fill")),e.on("snap.util.attr.stroke",m("stroke"));var v=/^([lr])(?:\(([^)]*)\))?(.*)$/i;function y(t){e.stop(),t==+t&&(t+="px"),this.node.style.fontSize=t}function x(){return e.stop(),this.node.style.fontSize}e.on("snap.util.grad.parse",(function(t){var e=(t=d(t)).match(v);if(!e)return null;var n=e[1],r=e[2],i=e[3];1==(r=r.split(/\s*,\s*/).map((function(t){return+t==t?+t:t}))).length&&0==r[0]&&(r=[]);var o=(i=(i=i.split("-")).map((function(t){var e={color:(t=t.split(":"))[0]};return t[1]&&(e.offset=parseFloat(t[1])),e}))).length,s=0,a=0;function u(t,e){for(var n=(e-s)/(t-a),r=a;r<t;r++)i[r].offset=+(+s+n*(r-a)).toFixed(2);a=t,s=e}o--;for(var c=0;c<o;c++)"offset"in i[c]&&u(c,i[c].offset);return i[o].offset=i[o].offset||100,u(o,i[o].offset),{type:n,params:r,stops:i}})),e.on("snap.util.attr.d",(function(n){e.stop(),c(n,"array")&&c(n[0],"array")&&(n=t.path.toString.call(n)),(n=d(n)).match(/[ruo]/i)&&(n=t.path.toAbsolute(n)),p(this.node,{d:n})}))(-1),e.on("snap.util.attr.#text",(function(t){e.stop(),t=d(t);for(var n=i.doc.createTextNode(t);this.node.firstChild;)this.node.removeChild(this.node.firstChild);this.node.appendChild(n)}))(-1),e.on("snap.util.attr.path",(function(t){e.stop(),this.attr({d:t})}))(-1),e.on("snap.util.attr.class",(function(t){e.stop(),this.node.className.baseVal=t}))(-1),e.on("snap.util.attr.viewBox",(function(t){var n;n=c(t,"object")&&"x"in t?[t.x,t.y,t.width,t.height].join(" "):c(t,"array")?t.join(" "):t,p(this.node,{viewBox:n}),e.stop()}))(-1),e.on("snap.util.attr.transform",(function(t){this.transform(t),e.stop()}))(-1),e.on("snap.util.attr.r",(function(t){"rect"==this.type&&(e.stop(),p(this.node,{rx:t,ry:t}))}))(-1),e.on("snap.util.attr.textpath",(function(t){if(e.stop(),"text"==this.type){var r,i,o;if(!t&&this.textPath){for(i=this.textPath;i.node.firstChild;)this.node.appendChild(i.node.firstChild);return i.remove(),void delete this.textPath}if(c(t,"string")){var s=l(this),a=u(s.parentNode).path(t);s.appendChild(a.node),r=a.id,a.attr({id:r})}else(t=u(t))instanceof n&&((r=t.attr("id"))||(r=t.id,t.attr({id:r})));if(r)if(i=this.textPath,o=this.node,i)i.attr({"xlink:href":"#"+r});else{for(i=p("textPath",{"xlink:href":"#"+r});o.firstChild;)i.appendChild(o.firstChild);o.appendChild(i),this.textPath=u(i)}}}))(-1),e.on("snap.util.attr.text",(function(t){if("text"==this.type){for(var n=this.node,r=function(t){var e=p("tspan");if(c(t,"array"))for(var n=0;n<t.length;n++)e.appendChild(r(t[n]));else e.appendChild(i.doc.createTextNode(t));return e.normalize&&e.normalize(),e};n.firstChild;)n.removeChild(n.firstChild);for(var o=r(t);o.firstChild;)n.appendChild(o.firstChild)}e.stop()}))(-1),e.on("snap.util.attr.fontSize",y)(-1),e.on("snap.util.attr.font-size",y)(-1),e.on("snap.util.getattr.transform",(function(){return e.stop(),this.transform()}))(-1),e.on("snap.util.getattr.textpath",(function(){return e.stop(),this.textPath}))(-1),function(){function n(n){return function(){e.stop();var r=i.doc.defaultView.getComputedStyle(this.node,null).getPropertyValue("marker-"+n);return"none"==r?r:t(i.doc.getElementById(r.match(h)[1]))}}function r(t){return function(n){e.stop();var r="marker"+t.charAt(0).toUpperCase()+t.substring(1);if(""!=n&&n){if("marker"==n.type){var i=n.node.id;return i||p(n.node,{id:n.id}),void(this.node.style[r]=f(i))}}else this.node.style[r]="none"}}e.on("snap.util.getattr.marker-end",n("end"))(-1),e.on("snap.util.getattr.markerEnd",n("end"))(-1),e.on("snap.util.getattr.marker-start",n("start"))(-1),e.on("snap.util.getattr.markerStart",n("start"))(-1),e.on("snap.util.getattr.marker-mid",n("mid"))(-1),e.on("snap.util.getattr.markerMid",n("mid"))(-1),e.on("snap.util.attr.marker-end",r("end"))(-1),e.on("snap.util.attr.markerEnd",r("end"))(-1),e.on("snap.util.attr.marker-start",r("start"))(-1),e.on("snap.util.attr.markerStart",r("start"))(-1),e.on("snap.util.attr.marker-mid",r("mid"))(-1),e.on("snap.util.attr.markerMid",r("mid"))(-1)}(),e.on("snap.util.getattr.r",(function(){if("rect"==this.type&&p(this.node,"rx")==p(this.node,"ry"))return e.stop(),p(this.node,"rx")}))(-1),e.on("snap.util.getattr.text",(function(){if("text"==this.type||"tspan"==this.type){e.stop();var t=function t(e){for(var n=[],r=e.childNodes,i=0,o=r.length;i<o;i++){var s=r[i];3==s.nodeType&&n.push(s.nodeValue),"tspan"==s.tagName&&(1==s.childNodes.length&&3==s.firstChild.nodeType?n.push(s.firstChild.nodeValue):n.push(t(s)))}return n}(this.node);return 1==t.length?t[0]:t}}))(-1),e.on("snap.util.getattr.#text",(function(){return this.node.textContent}))(-1),e.on("snap.util.getattr.fill",(function(n){if(!n){e.stop();var r=e("snap.util.getattr.fill",this,!0).firstDefined();return t(t.deurl(r))||r}}))(-1),e.on("snap.util.getattr.stroke",(function(n){if(!n){e.stop();var r=e("snap.util.getattr.stroke",this,!0).firstDefined();return t(t.deurl(r))||r}}))(-1),e.on("snap.util.getattr.viewBox",(function(){e.stop();var n=p(this.node,"viewBox");return n?(n=n.split(g),t._.box(+n[0],+n[1],+n[2],+n[3])):void 0}))(-1),e.on("snap.util.getattr.points",(function(){var t=p(this.node,"points");return e.stop(),t?t.split(g):void 0}))(-1),e.on("snap.util.getattr.path",(function(){var t=p(this.node,"d");return e.stop(),t}))(-1),e.on("snap.util.getattr.class",(function(){return this.node.className.baseVal}))(-1),e.on("snap.util.getattr.fontSize",x)(-1),e.on("snap.util.getattr.font-size",x)(-1)})),r.plugin((function(t,e,n,r,i){var o=/\S+/g,s=String,a=e.prototype;a.addClass=function(t){var e,n,r,i=s(t||"").match(o)||[],a=this.node,u=a.className.baseVal,c=u.match(o)||[];if(i.length){for(e=0;n=i[e++];)~c.indexOf(n)||c.push(n);u!=(r=c.join(" "))&&(a.className.baseVal=r)}return this},a.removeClass=function(t){var e,n,r,i,a=s(t||"").match(o)||[],u=this.node,c=u.className.baseVal,l=c.match(o)||[];if(l.length){for(e=0;r=a[e++];)~(n=l.indexOf(r))&&l.splice(n,1);c!=(i=l.join(" "))&&(u.className.baseVal=i)}return this},a.hasClass=function(t){return!!~(this.node.className.baseVal.match(o)||[]).indexOf(t)},a.toggleClass=function(t,e){if(null!=e)return e?this.addClass(t):this.removeClass(t);var n,r,i,s,a=(t||"").match(o)||[],u=this.node,c=u.className.baseVal,l=c.match(o)||[];for(n=0;i=a[n++];)~(r=l.indexOf(i))?l.splice(r,1):l.push(i);return c!=(s=l.join(" "))&&(u.className.baseVal=s),this}})),r.plugin((function(t,n,r,i,o){var s={"+":function(t,e){return t+e},"-":function(t,e){return t-e},"/":function(t,e){return t/e},"*":function(t,e){return t*e}},a=String,u=/[a-z]+$/i,c=/^\s*([+\-\/*])\s*=\s*([\d.eE+\-]+)\s*([^\d\s]+)?\s*$/;function l(t){return t}function h(t){return function(e){return+e.toFixed(3)+t}}e.on("snap.util.attr",(function(t){var n=a(t).match(c);if(n){var r=e.nt(),i=r.substring(r.lastIndexOf(".")+1),o=this.attr(i),l={};e.stop();var h=n[3]||"",p=o.match(u),f=s[n[1]];if(p&&p==h?t=f(parseFloat(o),+n[2]):(o=this.asPX(i),t=f(this.asPX(i),this.asPX(i,n[2]+h))),isNaN(o)||isNaN(t))return;l[i]=t,this.attr(l)}}))(-10),e.on("snap.util.equal",(function(t,n){var r=a(this.attr(t)||""),i=a(n).match(c);if(i){e.stop();var o=i[3]||"",p=r.match(u),f=s[i[1]];return p&&p==o?{from:parseFloat(r),to:f(parseFloat(r),+i[2]),f:h(p)}:{from:r=this.asPX(t),to:f(r,this.asPX(t,i[2]+o)),f:l}}}))(-10)})),r.plugin((function(n,r,i,o,s){var a=i.prototype,u=n.is;a.rect=function(t,e,n,r,i,o){var s;return null==o&&(o=i),u(t,"object")&&"[object Object]"==t?s=t:null!=t&&(s={x:t,y:e,width:n,height:r},null!=i&&(s.rx=i,s.ry=o)),this.el("rect",s)},a.circle=function(t,e,n){var r;return u(t,"object")&&"[object Object]"==t?r=t:null!=t&&(r={cx:t,cy:e,r:n}),this.el("circle",r)};var c=function(){function t(){this.parentNode.removeChild(this)}return function(e,n){var r=o.doc.createElement("img"),i=o.doc.body;r.style.cssText="position:absolute;left:-9999em;top:-9999em",r.onload=function(){n.call(r),r.onload=r.onerror=null,i.removeChild(r)},r.onerror=t,i.appendChild(r),r.src=e}}();a.image=function(t,e,r,i,o){var s=this.el("image");if(u(t,"object")&&"src"in t)s.attr(t);else if(null!=t){var a={"xlink:href":t,preserveAspectRatio:"none"};null!=e&&null!=r&&(a.x=e,a.y=r),null!=i&&null!=o?(a.width=i,a.height=o):c(t,(function(){n._.$(s.node,{width:this.offsetWidth,height:this.offsetHeight})})),n._.$(s.node,a)}return s},a.ellipse=function(t,e,n,r){var i;return u(t,"object")&&"[object Object]"==t?i=t:null!=t&&(i={cx:t,cy:e,rx:n,ry:r}),this.el("ellipse",i)},a.path=function(t){var e;return u(t,"object")&&!u(t,"array")?e=t:t&&(e={d:t}),this.el("path",e)},a.group=a.g=function(t){var e=this.el("g");return 1==arguments.length&&t&&!t.type?e.attr(t):arguments.length&&e.add(Array.prototype.slice.call(arguments,0)),e},a.svg=function(t,e,n,r,i,o,s,a){var c={};return u(t,"object")&&null==e?c=t:(null!=t&&(c.x=t),null!=e&&(c.y=e),null!=n&&(c.width=n),null!=r&&(c.height=r),null!=i&&null!=o&&null!=s&&null!=a&&(c.viewBox=[i,o,s,a])),this.el("svg",c)},a.mask=function(t){var e=this.el("mask");return 1==arguments.length&&t&&!t.type?e.attr(t):arguments.length&&e.add(Array.prototype.slice.call(arguments,0)),e},a.ptrn=function(t,e,n,r,i,o,s,a){if(u(t,"object"))var c=t;else c={patternUnits:"userSpaceOnUse"},t&&(c.x=t),e&&(c.y=e),null!=n&&(c.width=n),null!=r&&(c.height=r),c.viewBox=null!=i&&null!=o&&null!=s&&null!=a?[i,o,s,a]:[t||0,e||0,n||0,r||0];return this.el("pattern",c)},a.use=function(t){return null!=t?(t instanceof r&&(t.attr("id")||t.attr({id:n._.id(t)}),t=t.attr("id")),"#"==String(t).charAt()&&(t=t.substring(1)),this.el("use",{"xlink:href":"#"+t})):r.prototype.use.call(this)},a.symbol=function(t,e,n,r){var i={};return null!=t&&null!=e&&null!=n&&null!=r&&(i.viewBox=[t,e,n,r]),this.el("symbol",i)},a.text=function(t,e,n){var r={};return u(t,"object")?r=t:null!=t&&(r={x:t,y:e,text:n||""}),this.el("text",r)},a.line=function(t,e,n,r){var i={};return u(t,"object")?i=t:null!=t&&(i={x1:t,x2:n,y1:e,y2:r}),this.el("line",i)},a.polyline=function(t){arguments.length>1&&(t=Array.prototype.slice.call(arguments,0));var e={};return u(t,"object")&&!u(t,"array")?e=t:null!=t&&(e={points:t}),this.el("polyline",e)},a.polygon=function(t){arguments.length>1&&(t=Array.prototype.slice.call(arguments,0));var e={};return u(t,"object")&&!u(t,"array")?e=t:null!=t&&(e={points:t}),this.el("polygon",e)},function(){var r=n._.$;function i(){return this.selectAll("stop")}function o(t,e){var i=r("stop"),o={offset:+e+"%"};t=n.color(t),o["stop-color"]=t.hex,t.opacity<1&&(o["stop-opacity"]=t.opacity),r(i,o);for(var s,a=this.stops(),u=0;u<a.length;u++){if(parseFloat(a[u].attr("offset"))>e){this.node.insertBefore(i,a[u].node),s=!0;break}}return s||this.node.appendChild(i),this}function s(){if("linearGradient"==this.type){var t=r(this.node,"x1")||0,e=r(this.node,"x2")||1,i=r(this.node,"y1")||0,o=r(this.node,"y2")||0;return n._.box(t,i,math.abs(e-t),math.abs(o-i))}var s=this.node.cx||.5,a=this.node.cy||.5,u=this.node.r||0;return n._.box(s-u,a-u,2*u,2*u)}function u(t){var r=t,i=this.stops();if("string"==typeof t&&(r=e("snap.util.grad.parse",null,"l(0,0,0,1)"+t).firstDefined().stops),n.is(r,"array")){for(var o=0;o<i.length;o++)if(r[o]){var s=n.color(r[o].color),a={offset:r[o].offset+"%"};a["stop-color"]=s.hex,s.opacity<1&&(a["stop-opacity"]=s.opacity),i[o].attr(a)}else i[o].remove();for(o=i.length;o<r.length;o++)this.addStop(r[o].color,r[o].offset);return this}}function c(t,e,a,c,l){var h=n._.make("linearGradient",t);return h.stops=i,h.addStop=o,h.getBBox=s,h.setStops=u,null!=e&&r(h.node,{x1:e,y1:a,x2:c,y2:l}),h}function l(t,e,a,u,c,l){var h=n._.make("radialGradient",t);return h.stops=i,h.addStop=o,h.getBBox=s,null!=e&&r(h.node,{cx:e,cy:a,r:u}),null!=c&&null!=l&&r(h.node,{fx:c,fy:l}),h}a.gradient=function(t){return function(t,n){var i,o=e("snap.util.grad.parse",null,n).firstDefined();if(!o)return null;o.params.unshift(t),i="l"==o.type.toLowerCase()?c.apply(0,o.params):l.apply(0,o.params),o.type!=o.type.toLowerCase()&&r(i.node,{gradientUnits:"userSpaceOnUse"});for(var s=o.stops,a=s.length,u=0;u<a;u++){var h=s[u];i.addStop(h.color,h.offset)}return i}(this.defs,t)},a.gradientLinear=function(t,e,n,r){return c(this.defs,t,e,n,r)},a.gradientRadial=function(t,e,n,r,i){return l(this.defs,t,e,n,r,i)},a.toString=function(){var t,e=this.node.ownerDocument,r=e.createDocumentFragment(),i=e.createElement("div"),o=this.node.cloneNode(!0);return r.appendChild(i),i.appendChild(o),n._.$(o,{xmlns:"http://www.w3.org/2000/svg"}),t=i.innerHTML,r.removeChild(r.firstChild),t},a.toDataURL=function(){if(t&&t.btoa)return"data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(this)))},a.clear=function(){for(var t,e=this.node.firstChild;e;)t=e.nextSibling,"defs"!=e.tagName?e.parentNode.removeChild(e):a.clear.call({node:e}),e=t}}()})),r.plugin((function(t,e,n,r){var i=e.prototype,o=t.is,s=t._.clone,a=/,?([a-z]),?/gi,u=parseFloat,c=Math,l=c.PI,h=c.min,p=c.max,f=c.pow,d=c.abs;function g(t){var e=g.ps=g.ps||{};return e[t]?e[t].sleep=100:e[t]={sleep:100},setTimeout((function(){for(var n in e)e.hasOwnProperty(n)&&n!=t&&(e[n].sleep--,!e[n].sleep&&delete e[n])})),e[t]}function m(t,e,n,r){return null==t&&(t=e=n=r=0),null==e&&(e=t.y,n=t.width,r=t.height,t=t.x),{x:t,y:e,width:n,w:n,height:r,h:r,x2:t+n,y2:e+r,cx:t+n/2,cy:e+r/2,r1:c.min(n,r)/2,r2:c.max(n,r)/2,r0:c.sqrt(n*n+r*r)/2,path:D(t,e,n,r),vb:[t,e,n,r].join(" ")}}function v(){return this.join(",").replace(a,"$1")}function y(t){var e=s(t);return e.toString=v,e}function x(t,e,n,r,i,o,s,a,u){return null==u?P(t,e,n,r,i,o,s,a):E(t,e,n,r,i,o,s,a,function(t,e,n,r,i,o,s,a,u){if(u<0||P(t,e,n,r,i,o,s,a)<u)return;var c,l=.5,h=1-l;c=P(t,e,n,r,i,o,s,a,h);for(;d(c-u)>.01;)c=P(t,e,n,r,i,o,s,a,h+=(c<u?1:-1)*(l/=2));return h}(t,e,n,r,i,o,s,a,u))}function b(n,r){function i(t){return+(+t).toFixed(3)}return t._.cacher((function(t,o,s){t instanceof e&&(t=t.attr("d"));for(var a,u,c,l,h,p="",f={},d=0,g=0,m=(t=V(t)).length;g<m;g++){if("M"==(c=t[g])[0])a=+c[1],u=+c[2];else{if(d+(l=x(a,u,c[1],c[2],c[3],c[4],c[5],c[6]))>o){if(r&&!f.start){if(p+=["C"+i((h=x(a,u,c[1],c[2],c[3],c[4],c[5],c[6],o-d)).start.x),i(h.start.y),i(h.m.x),i(h.m.y),i(h.x),i(h.y)],s)return p;f.start=p,p=["M"+i(h.x),i(h.y)+"C"+i(h.n.x),i(h.n.y),i(h.end.x),i(h.end.y),i(c[5]),i(c[6])].join(),d+=l,a=+c[5],u=+c[6];continue}if(!n&&!r)return h=x(a,u,c[1],c[2],c[3],c[4],c[5],c[6],o-d)}d+=l,a=+c[5],u=+c[6]}p+=c.shift()+c}return f.end=p,h=n?d:r?f:E(a,u,c[0],c[1],c[2],c[3],c[4],c[5],1)}),null,t._.clone)}var _=b(1),w=b(),M=b(0,1);function E(t,e,n,r,i,o,s,a,u){var h=1-u,p=f(h,3),d=f(h,2),g=u*u,m=g*u,v=t+2*u*(n-t)+g*(i-2*n+t),y=e+2*u*(r-e)+g*(o-2*r+e),x=n+2*u*(i-n)+g*(s-2*i+n),b=r+2*u*(o-r)+g*(a-2*o+r);return{x:p*t+3*d*u*n+3*h*u*u*i+m*s,y:p*e+3*d*u*r+3*h*u*u*o+m*a,m:{x:v,y:y},n:{x:x,y:b},start:{x:h*t+u*n,y:h*e+u*r},end:{x:h*i+u*s,y:h*o+u*a},alpha:90-180*c.atan2(v-x,y-b)/l}}function S(e,n,r,i,o,s,a,u){t.is(e,"array")||(e=[e,n,r,i,o,s,a,u]);var c=H.apply(null,e);return m(c.min.x,c.min.y,c.max.x-c.min.x,c.max.y-c.min.y)}function A(t,e,n){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function C(t,e){return t=m(t),A(e=m(e),t.x,t.y)||A(e,t.x2,t.y)||A(e,t.x,t.y2)||A(e,t.x2,t.y2)||A(t,e.x,e.y)||A(t,e.x2,e.y)||A(t,e.x,e.y2)||A(t,e.x2,e.y2)||(t.x<e.x2&&t.x>e.x||e.x<t.x2&&e.x>t.x)&&(t.y<e.y2&&t.y>e.y||e.y<t.y2&&e.y>t.y)}function T(t,e,n,r,i){return t*(t*(-3*e+9*n-9*r+3*i)+6*e-12*n+6*r)-3*e+3*n}function P(t,e,n,r,i,o,s,a,u){null==u&&(u=1);for(var l=(u=u>1?1:u<0?0:u)/2,h=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],f=0,d=0;d<12;d++){var g=l*h[d]+l,m=T(g,t,n,i,s),v=T(g,e,r,o,a),y=m*m+v*v;f+=p[d]*c.sqrt(y)}return l*f}function I(t,e,n,r,i,o,s,a){if(!(p(t,n)<h(i,s)||h(t,n)>p(i,s)||p(e,r)<h(o,a)||h(e,r)>p(o,a))){var u=(t-n)*(o-a)-(e-r)*(i-s);if(u){var c=((t*r-e*n)*(i-s)-(t-n)*(i*a-o*s))/u,l=((t*r-e*n)*(o-a)-(e-r)*(i*a-o*s))/u,f=+c.toFixed(2),d=+l.toFixed(2);if(!(f<+h(t,n).toFixed(2)||f>+p(t,n).toFixed(2)||f<+h(i,s).toFixed(2)||f>+p(i,s).toFixed(2)||d<+h(e,r).toFixed(2)||d>+p(e,r).toFixed(2)||d<+h(o,a).toFixed(2)||d>+p(o,a).toFixed(2)))return{x:c,y:l}}}}function L(t,e,n){if(!C(S(t),S(e)))return n?0:[];for(var r=~~(P.apply(0,t)/8),i=~~(P.apply(0,e)/8),o=[],s=[],a={},u=n?0:[],c=0;c<r+1;c++){var l=E.apply(0,t.concat(c/r));o.push({x:l.x,y:l.y,t:c/r})}for(c=0;c<i+1;c++)l=E.apply(0,e.concat(c/i)),s.push({x:l.x,y:l.y,t:c/i});for(c=0;c<r;c++)for(var h=0;h<i;h++){var p=o[c],f=o[c+1],g=s[h],m=s[h+1],v=d(f.x-p.x)<.001?"y":"x",y=d(m.x-g.x)<.001?"y":"x",x=I(p.x,p.y,f.x,f.y,g.x,g.y,m.x,m.y);if(x){if(a[x.x.toFixed(4)]==x.y.toFixed(4))continue;a[x.x.toFixed(4)]=x.y.toFixed(4);var b=p.t+d((x[v]-p[v])/(f[v]-p[v]))*(f.t-p.t),_=g.t+d((x[y]-g[y])/(m[y]-g[y]))*(m.t-g.t);b>=0&&b<=1&&_>=0&&_<=1&&(n?u++:u.push({x:x.x,y:x.y,t1:b,t2:_}))}}return u}function R(t,e,n){t=V(t),e=V(e);for(var r,i,o,s,a,u,c,l,h,p,f=n?0:[],d=0,g=t.length;d<g;d++){var m=t[d];if("M"==m[0])r=a=m[1],i=u=m[2];else{"C"==m[0]?(h=[r,i].concat(m.slice(1)),r=h[6],i=h[7]):(h=[r,i,r,i,a,u,a,u],r=a,i=u);for(var v=0,y=e.length;v<y;v++){var x=e[v];if("M"==x[0])o=c=x[1],s=l=x[2];else{"C"==x[0]?(p=[o,s].concat(x.slice(1)),o=p[6],s=p[7]):(p=[o,s,o,s,c,l,c,l],o=c,s=l);var b=L(h,p,n);if(n)f+=b;else{for(var _=0,w=b.length;_<w;_++)b[_].segment1=d,b[_].segment2=v,b[_].bez1=h,b[_].bez2=p;f=f.concat(b)}}}}}return f}function O(t){var e=g(t);if(e.bbox)return s(e.bbox);if(!t)return m();for(var n,r=0,i=0,o=[],a=[],u=0,c=(t=V(t)).length;u<c;u++)if("M"==(n=t[u])[0])r=n[1],i=n[2],o.push(r),a.push(i);else{var l=H(r,i,n[1],n[2],n[3],n[4],n[5],n[6]);o=o.concat(l.min.x,l.max.x),a=a.concat(l.min.y,l.max.y),r=n[5],i=n[6]}var f=h.apply(0,o),d=h.apply(0,a),v=m(f,d,p.apply(0,o)-f,p.apply(0,a)-d);return e.bbox=s(v),v}function D(t,e,n,r,i){if(i)return[["M",+t+ +i,e],["l",n-2*i,0],["a",i,i,0,0,1,i,i],["l",0,r-2*i],["a",i,i,0,0,1,-i,i],["l",2*i-n,0],["a",i,i,0,0,1,-i,-i],["l",0,2*i-r],["a",i,i,0,0,1,i,-i],["z"]];var o=[["M",t,e],["l",n,0],["l",0,r],["l",-n,0],["z"]];return o.toString=v,o}function B(t,e,n,r,i){if(null==i&&null==r&&(r=n),t=+t,e=+e,n=+n,r=+r,null!=i)var o=Math.PI/180,s=t+n*Math.cos(-r*o),a=t+n*Math.cos(-i*o),u=[["M",s,e+n*Math.sin(-r*o)],["A",n,n,0,+(i-r>180),0,a,e+n*Math.sin(-i*o)]];else u=[["M",t,e],["m",0,-r],["a",n,r,0,1,1,0,2*r],["a",n,r,0,1,1,0,-2*r],["z"]];return u.toString=v,u}var F=t._unit2px,N={path:function(t){return t.attr("path")},circle:function(t){var e=F(t);return B(e.cx,e.cy,e.r)},ellipse:function(t){var e=F(t);return B(e.cx||0,e.cy||0,e.rx,e.ry)},rect:function(t){var e=F(t);return D(e.x||0,e.y||0,e.width,e.height,e.rx,e.ry)},image:function(t){var e=F(t);return D(e.x||0,e.y||0,e.width,e.height)},line:function(t){return"M"+[t.attr("x1")||0,t.attr("y1")||0,t.attr("x2"),t.attr("y2")]},polyline:function(t){return"M"+t.attr("points")},polygon:function(t){return"M"+t.attr("points")+"z"},deflt:function(t){var e=t.node.getBBox();return D(e.x,e.y,e.width,e.height)}};function k(e){var n=g(e);if(n.abs)return y(n.abs);if(o(e,"array")&&o(e&&e[0],"array")||(e=t.parsePathString(e)),!e||!e.length)return[["M",0,0]];var r,i=[],s=0,a=0,u=0,c=0,l=0;"M"==e[0][0]&&(u=s=+e[0][1],c=a=+e[0][2],l++,i[0]=["M",s,a]);for(var h,p,f=3==e.length&&"M"==e[0][0]&&"R"==e[1][0].toUpperCase()&&"Z"==e[2][0].toUpperCase(),d=l,m=e.length;d<m;d++){if(i.push(h=[]),(r=(p=e[d])[0])!=r.toUpperCase())switch(h[0]=r.toUpperCase(),h[0]){case"A":h[1]=p[1],h[2]=p[2],h[3]=p[3],h[4]=p[4],h[5]=p[5],h[6]=+p[6]+s,h[7]=+p[7]+a;break;case"V":h[1]=+p[1]+a;break;case"H":h[1]=+p[1]+s;break;case"R":for(var x=[s,a].concat(p.slice(1)),b=2,_=x.length;b<_;b++)x[b]=+x[b]+s,x[++b]=+x[b]+a;i.pop(),i=i.concat(j(x,f));break;case"O":i.pop(),(x=B(s,a,p[1],p[2])).push(x[0]),i=i.concat(x);break;case"U":i.pop(),i=i.concat(B(s,a,p[1],p[2],p[3])),h=["U"].concat(i[i.length-1].slice(-2));break;case"M":u=+p[1]+s,c=+p[2]+a;default:for(b=1,_=p.length;b<_;b++)h[b]=+p[b]+(b%2?s:a)}else if("R"==r)x=[s,a].concat(p.slice(1)),i.pop(),i=i.concat(j(x,f)),h=["R"].concat(p.slice(-2));else if("O"==r)i.pop(),(x=B(s,a,p[1],p[2])).push(x[0]),i=i.concat(x);else if("U"==r)i.pop(),i=i.concat(B(s,a,p[1],p[2],p[3])),h=["U"].concat(i[i.length-1].slice(-2));else for(var w=0,M=p.length;w<M;w++)h[w]=p[w];if("O"!=(r=r.toUpperCase()))switch(h[0]){case"Z":s=+u,a=+c;break;case"H":s=h[1];break;case"V":a=h[1];break;case"M":u=h[h.length-2],c=h[h.length-1];default:s=h[h.length-2],a=h[h.length-1]}}return i.toString=v,n.abs=y(i),i}function G(t,e,n,r){return[t,e,n,r,n,r]}function U(t,e,n,r,i,o){return[1/3*t+2/3*n,1/3*e+2/3*r,1/3*i+2/3*n,1/3*o+2/3*r,i,o]}function z(e,n,r,i,o,s,a,u,h,p){var f,g=120*l/180,m=l/180*(+o||0),v=[],y=t._.cacher((function(t,e,n){return{x:t*c.cos(n)-e*c.sin(n),y:t*c.sin(n)+e*c.cos(n)}}));if(!r||!i)return[e,n,u,h,u,h];if(p)C=p[0],T=p[1],S=p[2],A=p[3];else{e=(f=y(e,n,-m)).x,n=f.y,u=(f=y(u,h,-m)).x,h=f.y;c.cos(l/180*o),c.sin(l/180*o);var x=(e-u)/2,b=(n-h)/2,_=x*x/(r*r)+b*b/(i*i);_>1&&(r*=_=c.sqrt(_),i*=_);var w=r*r,M=i*i,E=(s==a?-1:1)*c.sqrt(d((w*M-w*b*b-M*x*x)/(w*b*b+M*x*x))),S=E*r*b/i+(e+u)/2,A=E*-i*x/r+(n+h)/2,C=c.asin(((n-A)/i).toFixed(9)),T=c.asin(((h-A)/i).toFixed(9));(C=e<S?l-C:C)<0&&(C=2*l+C),(T=u<S?l-T:T)<0&&(T=2*l+T),a&&C>T&&(C-=2*l),!a&&T>C&&(T-=2*l)}var P=T-C;if(d(P)>g){var I=T,L=u,R=h;T=C+g*(a&&T>C?1:-1),v=z(u=S+r*c.cos(T),h=A+i*c.sin(T),r,i,o,0,a,L,R,[T,I,S,A])}P=T-C;var O=c.cos(C),D=c.sin(C),B=c.cos(T),F=c.sin(T),N=c.tan(P/4),k=4/3*r*N,G=4/3*i*N,U=[e,n],H=[e+k*D,n-G*O],V=[u+k*F,h-G*B],j=[u,h];if(H[0]=2*U[0]-H[0],H[1]=2*U[1]-H[1],p)return[H,V,j].concat(v);for(var W=[],q=0,X=(v=[H,V,j].concat(v).join().split(",")).length;q<X;q++)W[q]=q%2?y(v[q-1],v[q],m).y:y(v[q],v[q+1],m).x;return W}function H(t,e,n,r,i,o,s,a){for(var u,l,f,g,m,v,y,x,b=[],_=[[],[]],w=0;w<2;++w)if(0==w?(l=6*t-12*n+6*i,u=-3*t+9*n-9*i+3*s,f=3*n-3*t):(l=6*e-12*r+6*o,u=-3*e+9*r-9*o+3*a,f=3*r-3*e),d(u)<1e-12){if(d(l)<1e-12)continue;0<(g=-f/l)&&g<1&&b.push(g)}else y=l*l-4*f*u,x=c.sqrt(y),y<0||(0<(m=(-l+x)/(2*u))&&m<1&&b.push(m),0<(v=(-l-x)/(2*u))&&v<1&&b.push(v));for(var M,E=b.length,S=E;E--;)M=1-(g=b[E]),_[0][E]=M*M*M*t+3*M*M*g*n+3*M*g*g*i+g*g*g*s,_[1][E]=M*M*M*e+3*M*M*g*r+3*M*g*g*o+g*g*g*a;return _[0][S]=t,_[1][S]=e,_[0][S+1]=s,_[1][S+1]=a,_[0].length=_[1].length=S+2,{min:{x:h.apply(0,_[0]),y:h.apply(0,_[1])},max:{x:p.apply(0,_[0]),y:p.apply(0,_[1])}}}function V(t,e){var n=!e&&g(t);if(!e&&n.curve)return y(n.curve);for(var r=k(t),i=e&&k(e),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a=function(t,e,n){var r,i;if(!t)return["C",e.x,e.y,e.x,e.y,e.x,e.y];switch(!(t[0]in{T:1,Q:1})&&(e.qx=e.qy=null),t[0]){case"M":e.X=t[1],e.Y=t[2];break;case"A":t=["C"].concat(z.apply(0,[e.x,e.y].concat(t.slice(1))));break;case"S":"C"==n||"S"==n?(r=2*e.x-e.bx,i=2*e.y-e.by):(r=e.x,i=e.y),t=["C",r,i].concat(t.slice(1));break;case"T":"Q"==n||"T"==n?(e.qx=2*e.x-e.qx,e.qy=2*e.y-e.qy):(e.qx=e.x,e.qy=e.y),t=["C"].concat(U(e.x,e.y,e.qx,e.qy,t[1],t[2]));break;case"Q":e.qx=t[1],e.qy=t[2],t=["C"].concat(U(e.x,e.y,t[1],t[2],t[3],t[4]));break;case"L":t=["C"].concat(G(e.x,e.y,t[1],t[2]));break;case"H":t=["C"].concat(G(e.x,e.y,t[1],e.y));break;case"V":t=["C"].concat(G(e.x,e.y,e.x,t[1]));break;case"Z":t=["C"].concat(G(e.x,e.y,e.X,e.Y))}return t},c=function(t,e){if(t[e].length>7){t[e].shift();for(var n=t[e];n.length;)h[e]="A",i&&(f[e]="A"),t.splice(e++,0,["C"].concat(n.splice(0,6)));t.splice(e,1),x=p(r.length,i&&i.length||0)}},l=function(t,e,n,o,s){t&&e&&"M"==t[s][0]&&"M"!=e[s][0]&&(e.splice(s,0,["M",o.x,o.y]),n.bx=0,n.by=0,n.x=t[s][1],n.y=t[s][2],x=p(r.length,i&&i.length||0))},h=[],f=[],d="",m="",v=0,x=p(r.length,i&&i.length||0);v<x;v++){r[v]&&(d=r[v][0]),"C"!=d&&(h[v]=d,v&&(m=h[v-1])),r[v]=a(r[v],o,m),"A"!=h[v]&&"C"==d&&(h[v]="C"),c(r,v),i&&(i[v]&&(d=i[v][0]),"C"!=d&&(f[v]=d,v&&(m=f[v-1])),i[v]=a(i[v],s,m),"A"!=f[v]&&"C"==d&&(f[v]="C"),c(i,v)),l(r,i,o,s,v),l(i,r,s,o,v);var b=r[v],_=i&&i[v],w=b.length,M=i&&_.length;o.x=b[w-2],o.y=b[w-1],o.bx=u(b[w-4])||o.x,o.by=u(b[w-3])||o.y,s.bx=i&&(u(_[M-4])||s.x),s.by=i&&(u(_[M-3])||s.y),s.x=i&&_[M-2],s.y=i&&_[M-1]}return i||(n.curve=y(r)),i?[r,i]:r}function j(t,e){for(var n=[],r=0,i=t.length;i-2*!e>r;r+=2){var o=[{x:+t[r-2],y:+t[r-1]},{x:+t[r],y:+t[r+1]},{x:+t[r+2],y:+t[r+3]},{x:+t[r+4],y:+t[r+5]}];e?r?i-4==r?o[3]={x:+t[0],y:+t[1]}:i-2==r&&(o[2]={x:+t[0],y:+t[1]},o[3]={x:+t[2],y:+t[3]}):o[0]={x:+t[i-2],y:+t[i-1]}:i-4==r?o[3]=o[2]:r||(o[0]={x:+t[r],y:+t[r+1]}),n.push(["C",(-o[0].x+6*o[1].x+o[2].x)/6,(-o[0].y+6*o[1].y+o[2].y)/6,(o[1].x+6*o[2].x-o[3].x)/6,(o[1].y+6*o[2].y-o[3].y)/6,o[2].x,o[2].y])}return n}t.path=g,t.path.getTotalLength=_,t.path.getPointAtLength=w,t.path.getSubpath=function(t,e,n){if(this.getTotalLength(t)-n<1e-6)return M(t,e).end;var r=M(t,n,1);return e?M(r,e).end:r},i.getTotalLength=function(){if(this.node.getTotalLength)return this.node.getTotalLength()},i.getPointAtLength=function(t){return w(this.attr("d"),t)},i.getSubpath=function(e,n){return t.path.getSubpath(this.attr("d"),e,n)},t._.box=m,t.path.findDotsAtSegment=E,t.path.bezierBBox=S,t.path.isPointInsideBBox=A,t.closest=function(e,n,r,i){for(var o=100,s=m(e-o/2,n-o/2,o,o),a=[],u=r[0].hasOwnProperty("x")?function(t){return{x:r[t].x,y:r[t].y}}:function(t){return{x:r[t],y:i[t]}},c=0;o<=1e6&&!c;){for(var l=0,h=r.length;l<h;l++){var p=u(l);if(A(s,p.x,p.y)){c++,a.push(p);break}}c||(s=m(e-(o*=2)/2,n-o/2,o,o))}if(1e6!=o){var f,d=1/0;for(l=0,h=a.length;l<h;l++){var g=t.len(e,n,a[l].x,a[l].y);d>g&&(d=g,a[l].len=g,f=a[l])}return f}},t.path.isBBoxIntersect=C,t.path.intersection=function(t,e){return R(t,e)},t.path.intersectionNumber=function(t,e){return R(t,e,1)},t.path.isPointInside=function(t,e,n){var r=O(t);return A(r,e,n)&&R(t,[["M",e,n],["H",r.x2+10]],1)%2==1},t.path.getBBox=O,t.path.get=N,t.path.toRelative=function(e){var n=g(e),r=String.prototype.toLowerCase;if(n.rel)return y(n.rel);t.is(e,"array")&&t.is(e&&e[0],"array")||(e=t.parsePathString(e));var i=[],o=0,s=0,a=0,u=0,c=0;"M"==e[0][0]&&(a=o=e[0][1],u=s=e[0][2],c++,i.push(["M",o,s]));for(var l=c,h=e.length;l<h;l++){var p=i[l]=[],f=e[l];if(f[0]!=r.call(f[0]))switch(p[0]=r.call(f[0]),p[0]){case"a":p[1]=f[1],p[2]=f[2],p[3]=f[3],p[4]=f[4],p[5]=f[5],p[6]=+(f[6]-o).toFixed(3),p[7]=+(f[7]-s).toFixed(3);break;case"v":p[1]=+(f[1]-s).toFixed(3);break;case"m":a=f[1],u=f[2];default:for(var d=1,m=f.length;d<m;d++)p[d]=+(f[d]-(d%2?o:s)).toFixed(3)}else{p=i[l]=[],"m"==f[0]&&(a=f[1]+o,u=f[2]+s);for(var x=0,b=f.length;x<b;x++)i[l][x]=f[x]}var _=i[l].length;switch(i[l][0]){case"z":o=a,s=u;break;case"h":o+=+i[l][_-1];break;case"v":s+=+i[l][_-1];break;default:o+=+i[l][_-2],s+=+i[l][_-1]}}return i.toString=v,n.rel=y(i),i},t.path.toAbsolute=k,t.path.toCubic=V,t.path.map=function(t,e){if(!e)return t;var n,r,i,o,s,a,u;for(i=0,s=(t=V(t)).length;i<s;i++)for(o=1,a=(u=t[i]).length;o<a;o+=2)n=e.x(u[o],u[o+1]),r=e.y(u[o],u[o+1]),u[o]=n,u[o+1]=r;return t},t.path.toString=v,t.path.clone=y})),r.plugin((function(t,r,i,o){var s=Math.max,a=Math.min,u=function(t){if(this.items=[],this.bindings={},this.length=0,this.type="set",t)for(var e=0,n=t.length;e<n;e++)t[e]&&(this[this.items.length]=this.items[this.items.length]=t[e],this.length++)},c=u.prototype;c.push=function(){for(var t,e,n=0,r=arguments.length;n<r;n++)(t=arguments[n])&&(this[e=this.items.length]=this.items[e]=t,this.length++);return this},c.pop=function(){return this.length&&delete this[this.length--],this.items.pop()},c.forEach=function(t,e){for(var n=0,r=this.items.length;n<r;n++)if(!1===t.call(e,this.items[n],n))return this;return this},c.animate=function(r,i,o,s){"function"!=typeof o||o.length||(s=o,o=n.linear),r instanceof t._.Animation&&(s=r.callback,o=r.easing,i=o.dur,r=r.attr);var a=arguments;if(t.is(r,"array")&&t.is(a[a.length-1],"array"))var u=!0;var c,l=function(){c?this.b=c:c=this.b},h=0,p=this,f=s&&function(){++h==p.length&&s.call(this)};return this.forEach((function(t,n){e.once("snap.animcreated."+t.id,l),u?a[n]&&t.animate.apply(t,a[n]):t.animate(r,i,o,f)}))},c.remove=function(){for(;this.length;)this.pop().remove();return this},c.bind=function(t,e,n){var r={};if("function"==typeof e)this.bindings[t]=e;else{var i=n||t;this.bindings[t]=function(t){r[i]=t,e.attr(r)}}return this},c.attr=function(t){var e={};for(var n in t)this.bindings[n]?this.bindings[n](t[n]):e[n]=t[n];for(var r=0,i=this.items.length;r<i;r++)this.items[r].attr(e);return this},c.clear=function(){for(;this.length;)this.pop()},c.splice=function(t,e,n){t=t<0?s(this.length+t,0):t,e=s(0,a(this.length-t,e));var r,i=[],o=[],c=[];for(r=2;r<arguments.length;r++)c.push(arguments[r]);for(r=0;r<e;r++)o.push(this[t+r]);for(;r<this.length-t;r++)i.push(this[t+r]);var l=c.length;for(r=0;r<l+i.length;r++)this.items[t+r]=this[t+r]=r<l?c[r]:i[r-l];for(r=this.items.length=this.length-=e-l;this[r];)delete this[r++];return new u(o)},c.exclude=function(t){for(var e=0,n=this.length;e<n;e++)if(this[e]==t)return this.splice(e,1),!0;return!1},c.insertAfter=function(t){for(var e=this.items.length;e--;)this.items[e].insertAfter(t);return this},c.getBBox=function(){for(var t=[],e=[],n=[],r=[],i=this.items.length;i--;)if(!this.items[i].removed){var o=this.items[i].getBBox();t.push(o.x),e.push(o.y),n.push(o.x+o.width),r.push(o.y+o.height)}return{x:t=a.apply(0,t),y:e=a.apply(0,e),x2:n=s.apply(0,n),y2:r=s.apply(0,r),width:n-t,height:r-e,cx:t+(n-t)/2,cy:e+(r-e)/2}},c.clone=function(t){t=new u;for(var e=0,n=this.items.length;e<n;e++)t.push(this.items[e].clone());return t},c.toString=function(){return"Snap‘s set"},c.type="set",t.Set=u,t.set=function(){var t=new u;return arguments.length&&t.push.apply(t,Array.prototype.slice.call(arguments,0)),t}})),r.plugin((function(t,n,r,i){var o={},s=/[%a-z]+$/i,a=String;function u(t){var e=t[0];switch(e.toLowerCase()){case"t":return[e,0,0];case"m":return[e,1,0,0,1,0,0];case"r":return 4==t.length?[e,0,t[2],t[3]]:[e,0];case"s":return 5==t.length?[e,1,1,t[3],t[4]]:3==t.length?[e,1,1]:[e,1]}}function c(t){return t}function l(t){return t.join(" ")}function h(e){return t.rgb(e[0],e[1],e[2],e[3])}function p(t){var e,n,r,i,o,s,a=0,u=[];for(e=0,n=t.length;e<n;e++){for(o="[",s=['"'+t[e][0]+'"'],r=1,i=t[e].length;r<i;r++)s[r]="val["+a+++"]";o+=s+"]",u[e]=o}return Function("val","return Snap.path.toString.call(["+u+"])")}function f(t){for(var e=[],n=0,r=t.length;n<r;n++)for(var i=1,o=t[n].length;i<o;i++)e.push(t[n][i]);return e}function d(t){return isFinite(t)}o.stroke=o.fill="colour",n.prototype.equal=function(t,n){return e("snap.util.equal",this,t,n).firstDefined()},e.on("snap.util.equal",(function(e,n){var r,i,g=a(this.attr(e)||""),m=this;if("colour"==o[e])return r=t.color(g),i=t.color(n),{from:[r.r,r.g,r.b,r.opacity],to:[i.r,i.g,i.b,i.opacity],f:h};if("viewBox"==e)return{from:r=this.attr(e).vb.split(" ").map(Number),to:i=n.split(" ").map(Number),f:l};if("transform"==e||"gradientTransform"==e||"patternTransform"==e)return"string"==typeof n&&(n=a(n).replace(/\.{3}|\u2026/g,g)),function(e,n,r){e=e||new t.Matrix,n=n||new t.Matrix,e=t.parseTransformString(e.toTransformString())||[],n=t.parseTransformString(n.toTransformString())||[];for(var i,o,s,a,c=Math.max(e.length,n.length),l=[],h=[],d=0;d<c;d++){if(s=e[d]||u(n[d]),a=n[d]||u(s),s[0]!=a[0]||"r"==s[0].toLowerCase()&&(s[2]!=a[2]||s[3]!=a[3])||"s"==s[0].toLowerCase()&&(s[3]!=a[3]||s[4]!=a[4])){e=t._.transform2matrix(e,r()),n=t._.transform2matrix(n,r()),l=[["m",e.a,e.b,e.c,e.d,e.e,e.f]],h=[["m",n.a,n.b,n.c,n.d,n.e,n.f]];break}for(l[d]=[],h[d]=[],i=0,o=Math.max(s.length,a.length);i<o;i++)i in s&&(l[d][i]=s[i]),i in a&&(h[d][i]=a[i])}return{from:f(l),to:f(h),f:p(l)}}(g=this.matrix,n=t._.rgTransform.test(n)?t._.transform2matrix(n,this.getBBox()):t._.transform2matrix(t._.svgTransform2string(n),this.getBBox()),(function(){return m.getBBox(1)}));if("d"==e||"path"==e)return{from:f((r=t.path.toCubic(g,n))[0]),to:f(r[1]),f:p(r[0])};if("points"==e)return{from:r=a(g).split(t._.separator),to:i=a(n).split(t._.separator),f:function(t){return t}};if(d(g)&&d(n))return{from:parseFloat(g),to:parseFloat(n),f:c};var v,y,x,b=g.match(s),_=a(n).match(s);return b&&(y=b,x=_,t.is(y,"array")&&t.is(x,"array")&&y.toString()==x.toString())?{from:parseFloat(g),to:parseFloat(n),f:(v=b,function(t){return+t.toFixed(3)+v})}:{from:this.asPX(e),to:this.asPX(e,n),f:c}}))})),r.plugin((function(t,n,r,i){for(var o=n.prototype,s=("createTouch"in i.doc),a=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup","touchstart","touchmove","touchend","touchcancel"],u={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},c=function(t,e){var n="y"==t?"scrollTop":"scrollLeft",r=e&&e.node?e.node.ownerDocument:i.doc;return r[n in r.documentElement?"documentElement":"body"][n]},l=function(){return this.originalEvent.preventDefault()},h=function(){return this.originalEvent.stopPropagation()},p=function(t,e,n,r){var i=s&&u[e]?u[e]:e,o=function(i){var o=c("y",r),a=c("x",r);if(s&&u.hasOwnProperty(e))for(var p=0,f=i.targetTouches&&i.targetTouches.length;p<f;p++)if(i.targetTouches[p].target==t||t.contains(i.targetTouches[p].target)){var d=i;(i=i.targetTouches[p]).originalEvent=d,i.preventDefault=l,i.stopPropagation=h;break}var g=i.clientX+a,m=i.clientY+o;return n.call(r,i,g,m)};return e!==i&&t.addEventListener(e,o,!1),t.addEventListener(i,o,!1),function(){return e!==i&&t.removeEventListener(e,o,!1),t.removeEventListener(i,o,!1),!0}},f=[],d=function(t){for(var n,r=t.clientX,i=t.clientY,o=c("y"),a=c("x"),u=f.length;u--;){if(n=f[u],s){for(var l,h=t.touches&&t.touches.length;h--;)if((l=t.touches[h]).identifier==n.el._drag.id||n.el.node.contains(l.target)){r=l.clientX,i=l.clientY,(t.originalEvent?t.originalEvent:t).preventDefault();break}}else t.preventDefault();var p=n.el.node;p.nextSibling,p.parentNode,p.style.display;r+=a,i+=o,e("snap.drag.move."+n.el.id,n.move_scope||n.el,r-n.el._drag.x,i-n.el._drag.y,r,i,t)}},g=function(n){t.unmousemove(d).unmouseup(g);for(var r,i=f.length;i--;)(r=f[i]).el._drag={},e("snap.drag.end."+r.el.id,r.end_scope||r.start_scope||r.move_scope||r.el,n),e.off("snap.drag.*."+r.el.id);f=[]},m=a.length;m--;)!function(e){t[e]=o[e]=function(n,r){if(t.is(n,"function"))this.events=this.events||[],this.events.push({name:e,f:n,unbind:p(this.node||document,e,n,r||this)});else for(var i=0,o=this.events.length;i<o;i++)if(this.events[i].name==e)try{this.events[i].f.call(this)}catch(t){}return this},t["un"+e]=o["un"+e]=function(t){for(var n=this.events||[],r=n.length;r--;)if(n[r].name==e&&(n[r].f==t||!t))return n[r].unbind(),n.splice(r,1),!n.length&&delete this.events,this;return this}}(a[m]);o.hover=function(t,e,n,r){return this.mouseover(t,n).mouseout(e,r||n)},o.unhover=function(t,e){return this.unmouseover(t).unmouseout(e)};var v=[];o.drag=function(n,r,i,o,s,a){var u,c=this;if(!arguments.length)return c.drag((function(t,e){this.attr({transform:u+(u?"T":"t")+[t,e]})}),(function(){u=this.transform().local}));function l(u,l,h){(u.originalEvent||u).preventDefault(),c._drag.x=l,c._drag.y=h,c._drag.id=u.identifier,!f.length&&t.mousemove(d).mouseup(g),f.push({el:c,move_scope:o,start_scope:s,end_scope:a}),r&&e.on("snap.drag.start."+c.id,r),n&&e.on("snap.drag.move."+c.id,n),i&&e.on("snap.drag.end."+c.id,i),e("snap.drag.start."+c.id,s||o||c,l,h,u)}function h(t,n,r){e("snap.draginit."+c.id,c,t,n,r)}return e.on("snap.draginit."+c.id,l),c._drag={},v.push({el:c,start:l,init:h}),c.mousedown(h),c},o.undrag=function(){for(var n=v.length;n--;)v[n].el==this&&(this.unmousedown(v[n].init),v.splice(n,1),e.unbind("snap.drag.*."+this.id),e.unbind("snap.draginit."+this.id));return!v.length&&t.unmousemove(d).unmouseup(g),this}})),r.plugin((function(t,n,r,i){n.prototype;var o=r.prototype,s=/^\s*url\((.+)\)/,a=String,u=t._.$;t.filter={},o.filter=function(e){var r=this;"svg"!=r.type&&(r=r.paper);var i=t.parse(a(e)),o=t._.id(),s=(r.node.offsetWidth,r.node.offsetHeight,u("filter"));return u(s,{id:o,filterUnits:"userSpaceOnUse"}),s.appendChild(i.node),r.defs.appendChild(s),new n(s)},e.on("snap.util.getattr.filter",(function(){e.stop();var n=u(this.node,"filter");if(n){var r=a(n).match(s);return r&&t.select(r[1])}})),e.on("snap.util.attr.filter",(function(r){if(r instanceof n&&"filter"==r.type){e.stop();var i=r.node.id;i||(u(r.node,{id:r.id}),i=r.id),u(this.node,{filter:t.url(i)})}r&&"none"!=r||(e.stop(),this.node.removeAttribute("filter"))})),t.filter.blur=function(e,n){null==e&&(e=2);var r=null==n?e:[e,n];return t.format('<feGaussianBlur stdDeviation="{def}"/>',{def:r})},t.filter.blur.toString=function(){return this()},t.filter.shadow=function(e,n,r,i,o){return null==o&&(null==i?(o=r,r=4,i="#000"):(o=i,i=r,r=4)),null==r&&(r=4),null==o&&(o=1),null==e&&(e=0,n=2),null==n&&(n=e),i=t.color(i),t.format('<feGaussianBlur in="SourceAlpha" stdDeviation="{blur}"/><feOffset dx="{dx}" dy="{dy}" result="offsetblur"/><feFlood flood-color="{color}"/><feComposite in2="offsetblur" operator="in"/><feComponentTransfer><feFuncA type="linear" slope="{opacity}"/></feComponentTransfer><feMerge><feMergeNode/><feMergeNode in="SourceGraphic"/></feMerge>',{color:i,dx:e,dy:n,blur:r,opacity:o})},t.filter.shadow.toString=function(){return this()},t.filter.grayscale=function(e){return null==e&&(e=1),t.format('<feColorMatrix type="matrix" values="{a} {b} {c} 0 0 {d} {e} {f} 0 0 {g} {b} {h} 0 0 0 0 0 1 0"/>',{a:.2126+.7874*(1-e),b:.7152-.7152*(1-e),c:.0722-.0722*(1-e),d:.2126-.2126*(1-e),e:.7152+.2848*(1-e),f:.0722-.0722*(1-e),g:.2126-.2126*(1-e),h:.0722+.9278*(1-e)})},t.filter.grayscale.toString=function(){return this()},t.filter.sepia=function(e){return null==e&&(e=1),t.format('<feColorMatrix type="matrix" values="{a} {b} {c} 0 0 {d} {e} {f} 0 0 {g} {h} {i} 0 0 0 0 0 1 0"/>',{a:.393+.607*(1-e),b:.769-.769*(1-e),c:.189-.189*(1-e),d:.349-.349*(1-e),e:.686+.314*(1-e),f:.168-.168*(1-e),g:.272-.272*(1-e),h:.534-.534*(1-e),i:.131+.869*(1-e)})},t.filter.sepia.toString=function(){return this()},t.filter.saturate=function(e){return null==e&&(e=1),t.format('<feColorMatrix type="saturate" values="{amount}"/>',{amount:1-e})},t.filter.saturate.toString=function(){return this()},t.filter.hueRotate=function(e){return e=e||0,t.format('<feColorMatrix type="hueRotate" values="{angle}"/>',{angle:e})},t.filter.hueRotate.toString=function(){return this()},t.filter.invert=function(e){return null==e&&(e=1),t.format('<feComponentTransfer><feFuncR type="table" tableValues="{amount} {amount2}"/><feFuncG type="table" tableValues="{amount} {amount2}"/><feFuncB type="table" tableValues="{amount} {amount2}"/></feComponentTransfer>',{amount:e,amount2:1-e})},t.filter.invert.toString=function(){return this()},t.filter.brightness=function(e){return null==e&&(e=1),t.format('<feComponentTransfer><feFuncR type="linear" slope="{amount}"/><feFuncG type="linear" slope="{amount}"/><feFuncB type="linear" slope="{amount}"/></feComponentTransfer>',{amount:e})},t.filter.brightness.toString=function(){return this()},t.filter.contrast=function(e){return null==e&&(e=1),t.format('<feComponentTransfer><feFuncR type="linear" slope="{amount}" intercept="{amount2}"/><feFuncG type="linear" slope="{amount}" intercept="{amount2}"/><feFuncB type="linear" slope="{amount}" intercept="{amount2}"/></feComponentTransfer>',{amount:e,amount2:.5-e/2})},t.filter.contrast.toString=function(){return this()}})),r.plugin((function(t,e,n,r,i){var o=t._.box,s=t.is,a=/^[^a-z]*([tbmlrc])/i,u=function(){return"T"+this.dx+","+this.dy};e.prototype.getAlign=function(t,e){null==e&&s(t,"string")&&(e=t,t=null);var n=(t=t||this.paper).getBBox?t.getBBox():o(t),r=this.getBBox(),i={};switch(e=(e=e&&e.match(a))?e[1].toLowerCase():"c"){case"t":i.dx=0,i.dy=n.y-r.y;break;case"b":i.dx=0,i.dy=n.y2-r.y2;break;case"m":i.dx=0,i.dy=n.cy-r.cy;break;case"l":i.dx=n.x-r.x,i.dy=0;break;case"r":i.dx=n.x2-r.x2,i.dy=0;break;default:i.dx=n.cx-r.cx,i.dy=0}return i.toString=u,i},e.prototype.align=function(t,e){return this.transform("..."+this.getAlign(t,e))}})),r.plugin((function(e,n,r,i){function o(t){t=t.split(/(?=#)/);var e=new String(t[5]);return e[50]=t[0],e[100]=t[1],e[200]=t[2],e[300]=t[3],e[400]=t[4],e[500]=t[5],e[600]=t[6],e[700]=t[7],e[800]=t[8],e[900]=t[9],t[10]&&(e.A100=t[10],e.A200=t[11],e.A400=t[12],e.A700=t[13]),e}e.mui={},e.flat={},e.mui.red=o("#ffebee#ffcdd2#ef9a9a#e57373#ef5350#f44336#e53935#d32f2f#c62828#b71c1c#ff8a80#ff5252#ff1744#d50000"),e.mui.pink=o("#FCE4EC#F8BBD0#F48FB1#F06292#EC407A#E91E63#D81B60#C2185B#AD1457#880E4F#FF80AB#FF4081#F50057#C51162"),e.mui.purple=o("#F3E5F5#E1BEE7#CE93D8#BA68C8#AB47BC#9C27B0#8E24AA#7B1FA2#6A1B9A#4A148C#EA80FC#E040FB#D500F9#AA00FF"),e.mui.deeppurple=o("#EDE7F6#D1C4E9#B39DDB#9575CD#7E57C2#673AB7#5E35B1#512DA8#4527A0#311B92#B388FF#7C4DFF#651FFF#6200EA"),e.mui.indigo=o("#E8EAF6#C5CAE9#9FA8DA#7986CB#5C6BC0#3F51B5#3949AB#303F9F#283593#1A237E#8C9EFF#536DFE#3D5AFE#304FFE"),e.mui.blue=o("#E3F2FD#BBDEFB#90CAF9#64B5F6#64B5F6#2196F3#1E88E5#1976D2#1565C0#0D47A1#82B1FF#448AFF#2979FF#2962FF"),e.mui.lightblue=o("#E1F5FE#B3E5FC#81D4FA#4FC3F7#29B6F6#03A9F4#039BE5#0288D1#0277BD#01579B#80D8FF#40C4FF#00B0FF#0091EA"),e.mui.cyan=o("#E0F7FA#B2EBF2#80DEEA#4DD0E1#26C6DA#00BCD4#00ACC1#0097A7#00838F#006064#84FFFF#18FFFF#00E5FF#00B8D4"),e.mui.teal=o("#E0F2F1#B2DFDB#80CBC4#4DB6AC#26A69A#009688#00897B#00796B#00695C#004D40#A7FFEB#64FFDA#1DE9B6#00BFA5"),e.mui.green=o("#E8F5E9#C8E6C9#A5D6A7#81C784#66BB6A#4CAF50#43A047#388E3C#2E7D32#1B5E20#B9F6CA#69F0AE#00E676#00C853"),e.mui.lightgreen=o("#F1F8E9#DCEDC8#C5E1A5#AED581#9CCC65#8BC34A#7CB342#689F38#558B2F#33691E#CCFF90#B2FF59#76FF03#64DD17"),e.mui.lime=o("#F9FBE7#F0F4C3#E6EE9C#DCE775#D4E157#CDDC39#C0CA33#AFB42B#9E9D24#827717#F4FF81#EEFF41#C6FF00#AEEA00"),e.mui.yellow=o("#FFFDE7#FFF9C4#FFF59D#FFF176#FFEE58#FFEB3B#FDD835#FBC02D#F9A825#F57F17#FFFF8D#FFFF00#FFEA00#FFD600"),e.mui.amber=o("#FFF8E1#FFECB3#FFE082#FFD54F#FFCA28#FFC107#FFB300#FFA000#FF8F00#FF6F00#FFE57F#FFD740#FFC400#FFAB00"),e.mui.orange=o("#FFF3E0#FFE0B2#FFCC80#FFB74D#FFA726#FF9800#FB8C00#F57C00#EF6C00#E65100#FFD180#FFAB40#FF9100#FF6D00"),e.mui.deeporange=o("#FBE9E7#FFCCBC#FFAB91#FF8A65#FF7043#FF5722#F4511E#E64A19#D84315#BF360C#FF9E80#FF6E40#FF3D00#DD2C00"),e.mui.brown=o("#EFEBE9#D7CCC8#BCAAA4#A1887F#8D6E63#795548#6D4C41#5D4037#4E342E#3E2723"),e.mui.grey=o("#FAFAFA#F5F5F5#EEEEEE#E0E0E0#BDBDBD#9E9E9E#757575#616161#424242#212121"),e.mui.bluegrey=o("#ECEFF1#CFD8DC#B0BEC5#90A4AE#78909C#607D8B#546E7A#455A64#37474F#263238"),e.flat.turquoise="#1abc9c",e.flat.greensea="#16a085",e.flat.sunflower="#f1c40f",e.flat.orange="#f39c12",e.flat.emerland="#2ecc71",e.flat.nephritis="#27ae60",e.flat.carrot="#e67e22",e.flat.pumpkin="#d35400",e.flat.peterriver="#3498db",e.flat.belizehole="#2980b9",e.flat.alizarin="#e74c3c",e.flat.pomegranate="#c0392b",e.flat.amethyst="#9b59b6",e.flat.wisteria="#8e44ad",e.flat.clouds="#ecf0f1",e.flat.silver="#bdc3c7",e.flat.wetasphalt="#34495e",e.flat.midnightblue="#2c3e50",e.flat.concrete="#95a5a6",e.flat.asbestos="#7f8c8d",e.importMUIColors=function(){for(var n in e.mui)e.mui.hasOwnProperty(n)&&(t[n]=e.mui[n])}})),r}(n,t)}.apply(e,[r]))||(t.exports=i)}(window||this)},F4ds:function(t,e,n){"use strict";var r=n("hh1v");t.exports=function(t){return r(t)||null===t}},F8JR:function(t,e,n){"use strict";var r=n("tycR").forEach,i=n("pkCn")("forEach");t.exports=i?[].forEach:function(t){return r(this,t,arguments.length>1?arguments[1]:void 0)}},FF6l:function(t,e,n){"use strict";var r=n("ewvW"),i=n("I8vh"),o=n("B/qT"),s=n("CDr4"),a=Math.min;t.exports=[].copyWithin||function(t,e){var n=r(this),u=o(n),c=i(t,u),l=i(e,u),h=arguments.length>2?arguments[2]:void 0,p=a((void 0===h?u:i(h,u))-l,u-c),f=1;for(l<c&&c<l+p&&(f=-1,l+=p-1,c+=p-1);p-- >0;)l in n?n[c]=n[l]:s(n,c),c+=f,l+=f;return n}},FOUG:function(t,e,n){"use strict";var r=n("I+eb"),i=n("xluM"),o=n("We1y"),s=n("8GlL"),a=n("5mdu"),u=n("ImZN");r({target:"Promise",stat:!0,forced:n("Xu1c")},{all:function(t){var e=this,n=s.f(e),r=n.resolve,c=n.reject,l=a((function(){var n=o(e.resolve),s=[],a=0,l=1;u(t,(function(t){var o=a++,u=!1;l++,i(n,e,t).then((function(t){u||(u=!0,s[o]=t,--l||r(s))}),c)})),--l||r(s)}));return l.error&&c(l.value),n.promise}})},FXpK:function(t,e,n){"use strict";var r=n("z+kr"),i=n("g6v/"),o=Object.getOwnPropertyDescriptor;t.exports=function(t){if(!i)return r[t];var e=o(r,t);return e&&e.value}},FZtP:function(t,e,n){"use strict";var r=n("z+kr"),i=n("/byt"),o=n("eFrH"),s=n("F8JR"),a=n("kRJp"),u=function(t){if(t&&t.forEach!==s)try{a(t,"forEach",s)}catch(e){t.forEach=s}};for(var c in i)i[c]&&u(r[c]&&r[c].prototype);u(o)},Fib7:function(t,e,n){"use strict";var r="object"==typeof document&&document.all;t.exports=void 0===r&&void 0!==r?function(t){return"function"==typeof t||t===r}:function(t){return"function"==typeof t}},"Fwt+":function(t,e,n){"use strict";var r=n("67WC"),i=n("UMSQ"),o=n("I8vh"),s=r.aTypedArray,a=r.getTypedArrayConstructor;(0,r.exportTypedArrayMethod)("subarray",(function(t,e){var n=s(this),r=n.length,u=o(t,r);return new(a(n))(n.buffer,n.byteOffset+u*n.BYTES_PER_ELEMENT,i((void 0===e?r:o(e,r))-u))}))},"G+Rx":function(t,e,n){"use strict";var r=n("0GbY");t.exports=r("document","documentElement")},"G9h+":function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("8LQ0"),a=n("9wk+"),u=n("RUZL"),c=n("13ei"),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype._sceneFunc=function(e){t.prototype._sceneFunc.call(this,e);var n=2*Math.PI,r=this.points(),i=r,o=0!==this.tension()&&r.length>4;o&&(i=this.getTensionPoints());var s,a,u=r.length;o?(s=r[u-2]-(i[i.length-2]+i[i.length-4])/2,a=r[u-1]-(i[i.length-1]+i[i.length-3])/2):(s=r[u-2]-r[u-4],a=r[u-1]-r[u-3]);var c=(Math.atan2(a,s)+n)%n,l=this.pointerLength(),h=this.pointerWidth();e.save(),e.beginPath(),e.translate(r[u-2],r[u-1]),e.rotate(c),e.moveTo(0,0),e.lineTo(-l,h/2),e.lineTo(-l,-h/2),e.closePath(),e.restore(),this.pointerAtBeginning()&&(e.save(),e.translate(r[0],r[1]),o?(s=(i[0]+i[2])/2-r[0],a=(i[1]+i[3])/2-r[1]):(s=r[2]-r[0],a=r[3]-r[1]),e.rotate((Math.atan2(-a,-s)+n)%n),e.moveTo(0,0),e.lineTo(-l,h/2),e.lineTo(-l,-h/2),e.closePath(),e.restore());var p=this.dashEnabled();p&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),p&&(this.attrs.dashEnabled=!0)},e.prototype.getSelfRect=function(){var e=t.prototype.getSelfRect.call(this),n=this.pointerWidth()/2;return{x:e.x-n,y:e.y-n,width:e.width+2*n,height:e.height+2*n}},e}(a.Line);e.Arrow=l,l.prototype.className="Arrow",c._registerNode(l),s.Factory.addGetterSetter(l,"pointerLength",10,u.getNumberValidator()),s.Factory.addGetterSetter(l,"pointerWidth",10,u.getNumberValidator()),s.Factory.addGetterSetter(l,"pointerAtBeginning",!1),o.Collection.mapMethods(l)},GC2F:function(t,e,n){"use strict";var r=n("+M1K"),i=RangeError;t.exports=function(t,e){var n=r(t);if(n%e)throw new i("Wrong offset");return n}},GarU:function(t,e,n){"use strict";var r=n("OpvP"),i=TypeError;t.exports=function(t,e){if(r(e,t))return t;throw new i("Incorrect invocation")}},Gi26:function(t,e,n){"use strict";var r=n("4zBA"),i=n("ewvW"),o=r({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return o(i(t),e)}},GrlX:function(t,e,n){var r=n("T016"),i=n("JRS9"),o=Object.hasOwnProperty,s=Object.create(null);for(var a in r)o.call(r,a)&&(s[r[a]]=a);var u=t.exports={to:{},get:{}};function c(t,e,n){return Math.min(Math.max(e,t),n)}function l(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}u.get=function(t){var e,n;switch(t.substring(0,3).toLowerCase()){case"hsl":e=u.get.hsl(t),n="hsl";break;case"hwb":e=u.get.hwb(t),n="hwb";break;default:e=u.get.rgb(t),n="rgb"}return e?{model:n,value:e}:null},u.get.rgb=function(t){if(!t)return null;var e,n,i,s=[0,0,0,1];if(e=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(i=e[2],e=e[1],n=0;n<3;n++){var a=2*n;s[n]=parseInt(e.slice(a,a+2),16)}i&&(s[3]=parseInt(i,16)/255)}else if(e=t.match(/^#([a-f0-9]{3,4})$/i)){for(i=(e=e[1])[3],n=0;n<3;n++)s[n]=parseInt(e[n]+e[n],16);i&&(s[3]=parseInt(i+i,16)/255)}else if(e=t.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(n=0;n<3;n++)s[n]=parseInt(e[n+1],0);e[4]&&(e[5]?s[3]=.01*parseFloat(e[4]):s[3]=parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(e=t.match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:o.call(r,e[1])?((s=r[e[1]])[3]=1,s):null:null;for(n=0;n<3;n++)s[n]=Math.round(2.55*parseFloat(e[n+1]));e[4]&&(e[5]?s[3]=.01*parseFloat(e[4]):s[3]=parseFloat(e[4]))}for(n=0;n<3;n++)s[n]=c(s[n],0,255);return s[3]=c(s[3],0,1),s},u.get.hsl=function(t){if(!t)return null;var e=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,c(parseFloat(e[2]),0,100),c(parseFloat(e[3]),0,100),c(isNaN(n)?1:n,0,1)]}return null},u.get.hwb=function(t){if(!t)return null;var e=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,c(parseFloat(e[2]),0,100),c(parseFloat(e[3]),0,100),c(isNaN(n)?1:n,0,1)]}return null},u.to.hex=function(){var t=i(arguments);return"#"+l(t[0])+l(t[1])+l(t[2])+(t[3]<1?l(Math.round(255*t[3])):"")},u.to.rgb=function(){var t=i(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},u.to.rgb.percent=function(){var t=i(arguments),e=Math.round(t[0]/255*100),n=Math.round(t[1]/255*100),r=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+n+"%, "+r+"%)":"rgba("+e+"%, "+n+"%, "+r+"%, "+t[3]+")"},u.to.hsl=function(){var t=i(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},u.to.hwb=function(){var t=i(arguments),e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},u.to.keyword=function(t){return s[t.slice(0,3)]}},GuuD:function(t,e){t.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}},HEmn:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("8LQ0"),i=n("SXH2"),o=n("nLhi"),s=n("RUZL");e.Kaleidoscope=function(t){var e,n,r,i,s,a,u,c,l,h=t.width,p=t.height,f=Math.round(this.kaleidoscopePower()),d=Math.round(this.kaleidoscopeAngle()),g=Math.floor(h*(d%360)/360);if(!(f<1)){var m=o.Util.createCanvasElement();m.width=h,m.height=p;var v=m.getContext("2d").getImageData(0,0,h,p);!function(t,e,n){var r,i,o,s,a=t.data,u=e.data,c=t.width,l=t.height,h=n.polarCenterX||c/2,p=n.polarCenterY||l/2,f=0,d=0,g=0,m=0,v=Math.sqrt(h*h+p*p);i=c-h,o=l-p,v=(s=Math.sqrt(i*i+o*o))>v?s:v;var y,x,b,_,w=l,M=c,E=360/M*Math.PI/180;for(x=0;x<M;x+=1)for(b=Math.sin(x*E),_=Math.cos(x*E),y=0;y<w;y+=1)i=Math.floor(h+v*y/w*_),f=a[(r=4*((o=Math.floor(p+v*y/w*b))*c+i))+0],d=a[r+1],g=a[r+2],m=a[r+3],u[(r=4*(x+y*c))+0]=f,u[r+1]=d,u[r+2]=g,u[r+3]=m}(t,v,{polarCenterX:h/2,polarCenterY:p/2});for(var y=h/Math.pow(2,f);y<=8;)y*=2,f-=1;var x=y=Math.ceil(y),b=0,_=x,w=1;for(g+y>h&&(b=x,_=0,w=-1),n=0;n<p;n+=1)for(e=b;e!==_;e+=w)c=4*(h*n+Math.round(e+g)%h),i=v.data[c+0],s=v.data[c+1],a=v.data[c+2],u=v.data[c+3],l=4*(h*n+e),v.data[l+0]=i,v.data[l+1]=s,v.data[l+2]=a,v.data[l+3]=u;for(n=0;n<p;n+=1)for(x=Math.floor(y),r=0;r<f;r+=1){for(e=0;e<x+1;e+=1)c=4*(h*n+e),i=v.data[c+0],s=v.data[c+1],a=v.data[c+2],u=v.data[c+3],l=4*(h*n+2*x-e-1),v.data[l+0]=i,v.data[l+1]=s,v.data[l+2]=a,v.data[l+3]=u;x*=2}!function(t,e,n){var r,i,o,s,a,u,c=t.data,l=e.data,h=t.width,p=t.height,f=n.polarCenterX||h/2,d=n.polarCenterY||p/2,g=0,m=0,v=0,y=0,x=Math.sqrt(f*f+d*d);i=h-f,o=p-d,x=(u=Math.sqrt(i*i+o*o))>x?u:x;var b,_,w,M=p,E=h,S=n.polarRotation||0;for(i=0;i<h;i+=1)for(o=0;o<p;o+=1)s=i-f,a=o-d,b=Math.sqrt(s*s+a*a)*M/x,_=(_=(180*Math.atan2(a,s)/Math.PI+360+S)%360)*E/360,w=Math.floor(_),g=c[(r=4*(Math.floor(b)*h+w))+0],m=c[r+1],v=c[r+2],y=c[r+3],l[(r=4*(o*h+i))+0]=g,l[r+1]=m,l[r+2]=v,l[r+3]=y}(v,t,{polarRotation:0})}},r.Factory.addGetterSetter(i.Node,"kaleidoscopePower",2,s.getNumberValidator(),r.Factory.afterSetFilter),r.Factory.addGetterSetter(i.Node,"kaleidoscopeAngle",0,s.getNumberValidator(),r.Factory.afterSetFilter)},HFnK:function(t,e,n){"use strict";n("bWFh")("Set",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),n("ZWaQ"))},HH4o:function(t,e,n){"use strict";var r=n("tiKp")("iterator"),i=!1;try{var o=0,s={next:function(){return{done:!!o++}},return:function(){i=!0}};s[r]=function(){return this},Array.from(s,(function(){throw 2}))}catch(t){}t.exports=function(t,e){try{if(!e&&!i)return!1}catch(t){return!1}var n=!1;try{var o={};o[r]=function(){return{next:function(){return{done:n=!0}}}},t(o)}catch(t){}return n}},HSsa:function(t,e,n){"use strict";t.exports=function(t,e){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return t.apply(e,n)}}},HVe1:function(t,e,n){"use strict";var r=n("I+eb"),i=n("z+kr"),o=n("IMxJ")(i.setTimeout,!0);r({global:!0,bind:!0,forced:i.setTimeout!==o},{setTimeout:o})},HYAF:function(t,e,n){"use strict";var r=n("cjT7"),i=TypeError;t.exports=function(t){if(r(t))throw new i("Can't call method on "+t);return t}},Hd5f:function(t,e,n){"use strict";var r=n("0Dky"),i=n("tiKp"),o=n("EhIz"),s=i("species");t.exports=function(t){return o>=51||!r((function(){var e=[];return(e.constructor={})[s]=function(){return{foo:1}},1!==e[t](Boolean).foo}))}},HyF4:function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("8LQ0"),a=n("/OYL"),u=n("RUZL"),c=n("13ei"),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype._sceneFunc=function(t){t.beginPath(),t.arc(0,0,this.radius(),0,2*Math.PI,!1),t.closePath(),t.fillStrokeShape(this)},e.prototype.getWidth=function(){return 2*this.radius()},e.prototype.getHeight=function(){return 2*this.radius()},e.prototype.setWidth=function(t){this.radius()!==t/2&&this.radius(t/2)},e.prototype.setHeight=function(t){this.radius()!==t/2&&this.radius(t/2)},e}(a.Shape);e.Circle=l,l.prototype._centroid=!0,l.prototype.className="Circle",l.prototype._attrsAffectingSize=["radius"],c._registerNode(l),s.Factory.addGetterSetter(l,"radius",0,u.getNumberValidator()),o.Collection.mapMethods(l)},"I+eb":function(t,e,n){"use strict";var r=n("z+kr"),i=n("Bs8V").f,o=n("kRJp"),s=n("yy0I"),a=n("Y3Q8"),u=n("6JNq"),c=n("lMq5");t.exports=function(t,e){var n,l,h,p,f,d=t.target,g=t.global,m=t.stat;if(n=g?r:m?r[d]||a(d,{}):r[d]&&r[d].prototype)for(l in e){if(p=e[l],h=t.dontCallGetSet?(f=i(n,l))&&f.value:n[l],!c(g?l:d+(m?".":"#")+l,t.forced)&&void 0!==h){if(typeof p==typeof h)continue;u(p,h)}(t.sham||h&&h.sham)&&o(p,"sham",!0),s(n,l,p,t)}}},I8vh:function(t,e,n){"use strict";var r=n("WSbT"),i=Math.max,o=Math.min;t.exports=function(t,e){var n=r(t);return n<0?i(n+e,0):o(n,e)}},I9xj:function(t,e,n){"use strict";n("1E5z")(Math,"Math",!0)},IBMq:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("8LQ0"),i=n("SXH2"),o=n("RUZL");e.Posterize=function(t){var e,n=Math.round(254*this.levels())+1,r=t.data,i=r.length,o=255/n;for(e=0;e<i;e+=1)r[e]=Math.floor(r[e]/o)*o},r.Factory.addGetterSetter(i.Node,"levels",.5,o.getNumberValidator(),r.Factory.afterSetFilter)},IMxJ:function(t,e,n){"use strict";var r,i=n("z+kr"),o=n("K6Rb"),s=n("Fib7"),a=n("hVj3"),u=n("tdvT"),c=n("82ph"),l=n("1tal"),h=i.Function,p=/MSIE .\./.test(u)||"BUN"===a&&((r=i.Bun.version.split(".")).length<3||"0"===r[0]&&(r[1]<3||"3"===r[1]&&"0"===r[2]));t.exports=function(t,e){var n=e?2:1;return p?function(r,i){var a=l(arguments.length,1)>n,u=s(r)?r:h(r),p=a?c(arguments,n):[],f=a?function(){o(u,this,p)}:u;return e?t(f,i):t(f)}:t}},IZzc:function(t,e,n){"use strict";var r=n("z+kr"),i=n("RiVN"),o=n("0Dky"),s=n("We1y"),a=n("rdv8"),u=n("67WC"),c=n("P34a"),l=n("mfQh"),h=n("EhIz"),p=n("6oOd"),f=u.aTypedArray,d=u.exportTypedArrayMethod,g=r.Uint16Array,m=g&&i(g.prototype.sort),v=!(!m||o((function(){m(new g(2),null)}))&&o((function(){m(new g(2),{})}))),y=!!m&&!o((function(){if(h)return h<74;if(c)return c<67;if(l)return!0;if(p)return p<602;var t,e,n=new g(516),r=Array(516);for(t=0;t<516;t++)e=t%4,n[t]=515-t,r[t]=t-2*e+3;for(m(n,(function(t,e){return(t/4|0)-(e/4|0)})),t=0;t<516;t++)if(n[t]!==r[t])return!0}));d("sort",(function(t){return void 0!==t&&s(t),y?m(this,t):a(f(this),function(t){return function(e,n){return void 0!==t?+t(e,n)||0:n!=n?-1:e!=e?1:0===e&&0===n?1/e>0&&1/n<0?1:-1:e>n}}(t))}),!y||v)},ImZN:function(t,e,n){"use strict";var r=n("A2ZE"),i=n("xluM"),o=n("glrk"),s=n("DVFp"),a=n("6VoE"),u=n("B/qT"),c=n("OpvP"),l=n("mh/w"),h=n("NaFW"),p=n("KmKo"),f=TypeError,d=function(t,e){this.stopped=t,this.result=e},g=d.prototype;t.exports=function(t,e,n){var m,v,y,x,b,_,w,M=n&&n.that,E=!(!n||!n.AS_ENTRIES),S=!(!n||!n.IS_RECORD),A=!(!n||!n.IS_ITERATOR),C=!(!n||!n.INTERRUPTED),T=r(e,M),P=function(t){return m&&p(m,"normal",t),new d(!0,t)},I=function(t){return E?(o(t),C?T(t[0],t[1],P):T(t[0],t[1])):C?T(t,P):T(t)};if(S)m=t.iterator;else if(A)m=t;else{if(!(v=h(t)))throw new f(s(t)+" is not iterable");if(a(v)){for(y=0,x=u(t);x>y;y++)if((b=I(t[y]))&&c(g,b))return b;return new d(!1)}m=l(t,v)}for(_=S?t.next:m.next;!(w=i(_,m)).done;){try{b=I(w.value)}catch(t){p(m,"throw",t)}if("object"==typeof b&&b&&c(g,b))return b}return new d(!1)}},Ipqb:function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("8LQ0"),a=n("/OYL"),u=n("RUZL"),c=n("13ei"),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype._useBufferCanvas=function(){return!(!this.hasShadow()&&1===this.getAbsoluteOpacity()||!this.hasStroke()||!this.getStage())},e.prototype._sceneFunc=function(t){var e,n,r,i=this.width(),o=this.height(),s=this.image();s&&(e=this.cropWidth(),n=this.cropHeight(),r=e&&n?[s,this.cropX(),this.cropY(),e,n,0,0,i,o]:[s,0,0,i,o]),(this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,i,o),t.closePath(),t.fillStrokeShape(this)),s&&t.drawImage.apply(t,r)},e.prototype._hitFunc=function(t){var e=this.width(),n=this.height();t.beginPath(),t.rect(0,0,e,n),t.closePath(),t.fillStrokeShape(this)},e.prototype.getWidth=function(){var t,e=this.image();return null!=(t=this.attrs.width)?t:e?e.width:0},e.prototype.getHeight=function(){var t,e=this.image();return null!=(t=this.attrs.height)?t:e?e.height:0},e.fromURL=function(t,n){var r=o.Util.createImageElement();r.onload=function(){var t=new e({image:r});n(t)},r.crossOrigin="Anonymous",r.src=t},e}(a.Shape);e.Image=l,l.prototype.className="Image",c._registerNode(l),s.Factory.addGetterSetter(l,"image"),s.Factory.addComponentsGetterSetter(l,"crop",["x","y","width","height"]),s.Factory.addGetterSetter(l,"cropX",0,u.getNumberValidator()),s.Factory.addGetterSetter(l,"cropY",0,u.getNumberValidator()),s.Factory.addGetterSetter(l,"cropWidth",0,u.getNumberValidator()),s.Factory.addGetterSetter(l,"cropHeight",0,u.getNumberValidator()),o.Collection.mapMethods(l)},IrXD:function(t,e,n){"use strict";(function(t){var n,r={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-r.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*r.Bounce.In(2*t):.5*r.Bounce.Out(2*t-1)+.5}}},i="undefined"==typeof self&&void 0!==t&&t.hrtime?function(){var e=t.hrtime();return 1e3*e[0]+e[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()},o=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=i()),void 0===e&&(e=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var r=0;r<n.length;r++){var o=this._tweens[n[r]],s=!e;o&&!1===o.update(t,s)&&!e&&delete this._tweens[n[r]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},t}(),s={Linear:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=s.Utils.Linear;return e<0?o(t[0],t[1],r):e>1?o(t[n],t[n-1],n-r):o(t[i],t[i+1>n?n:i+1],r-i)},Bezier:function(t,e){for(var n=0,r=t.length-1,i=Math.pow,o=s.Utils.Bernstein,a=0;a<=r;a++)n+=i(1-e,r-a)*i(e,a)*t[a]*o(r,a);return n},CatmullRom:function(t,e){var n=t.length-1,r=n*e,i=Math.floor(r),o=s.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(i=Math.floor(r=n*(1+e))),o(t[(i-1+n)%n],t[i],t[(i+1)%n],t[(i+2)%n],r-i)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-r)-t[0]):e>1?t[n]-(o(t[n],t[n],t[n-1],t[n-1],r-n)-t[n]):o(t[i?i-1:0],t[i],t[n<i+1?n:i+1],t[n<i+2?n:i+2],r-i)},Utils:{Linear:function(t,e,n){return(e-t)*n+t},Bernstein:function(t,e){var n=s.Utils.Factorial;return n(t)/n(e)/n(t-e)},Factorial:(n=[1],function(t){var e=1;if(n[t])return n[t];for(var r=t;r>1;r--)e*=r;return n[t]=e,e}),CatmullRom:function(t,e,n,r,i){var o=.5*(n-t),s=.5*(r-e),a=i*i;return(2*e-2*n+o+s)*(i*a)+(-3*e+3*n-2*o-s)*a+o*i+e}}},a=function(){function t(){}return t.nextId=function(){return t._nextId++},t._nextId=0,t}(),u=new o,c=function(){function t(t,e){void 0===e&&(e=u),this._object=t,this._group=e,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=r.Linear.None,this._interpolationFunction=s.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=a.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.to=function(t,e){return this._valuesEnd=Object.create(t),void 0!==e&&(this._duration=e),this},t.prototype.duration=function(t){return this._duration=t,this},t.prototype.start=function(t){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var e in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(e),this._valuesStart[e]=this._valuesStartRepeat[e];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==t?"string"==typeof t?i()+parseFloat(t):t:i(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},t.prototype._setupProperties=function(t,e,n,r){for(var i in n){var o=t[i],s=Array.isArray(o),a=s?"array":typeof o,u=!s&&Array.isArray(n[i]);if("undefined"!==a&&"function"!==a){if(u){var c=n[i];if(0===c.length)continue;c=c.map(this._handleRelativeValue.bind(this,o)),n[i]=[o].concat(c)}if("object"!==a&&!s||!o||u)void 0===e[i]&&(e[i]=o),s||(e[i]*=1),r[i]=u?n[i].slice().reverse():e[i]||0;else{for(var l in e[i]=s?[]:{},o)e[i][l]=o[l];r[i]=s?[]:{},this._setupProperties(o,e[i],n[i],r[i])}}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},t.prototype.pause=function(t){return void 0===t&&(t=i()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=t,this._group&&this._group.remove(this)),this},t.prototype.resume=function(t){return void 0===t&&(t=i()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},t.prototype.stopChainedTweens=function(){for(var t=0,e=this._chainedTweens.length;t<e;t++)this._chainedTweens[t].stop();return this},t.prototype.group=function(t){return this._group=t,this},t.prototype.delay=function(t){return this._delayTime=t,this},t.prototype.repeat=function(t){return this._initialRepeat=t,this._repeat=t,this},t.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},t.prototype.yoyo=function(t){return this._yoyo=t,this},t.prototype.easing=function(t){return this._easingFunction=t,this},t.prototype.interpolation=function(t){return this._interpolationFunction=t,this},t.prototype.chain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return this._chainedTweens=t,this},t.prototype.onStart=function(t){return this._onStartCallback=t,this},t.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},t.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},t.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},t.prototype.onStop=function(t){return this._onStopCallback=t,this},t.prototype.update=function(t,e){if(void 0===t&&(t=i()),void 0===e&&(e=!0),this._isPaused)return!0;var n,r,o=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(t>o)return!1;e&&this.start(t)}if(this._goToEnd=!1,t<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),r=(t-this._startTime)/this._duration,r=0===this._duration||r>1?1:r;var s=this._easingFunction(r);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,s),this._onUpdateCallback&&this._onUpdateCallback(this._object,r),1===r){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var a=0,u=this._chainedTweens.length;a<u;a++)this._chainedTweens[a].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(t,e,n,r){for(var i in n)if(void 0!==e[i]){var o=e[i]||0,s=n[i],a=Array.isArray(t[i]),u=Array.isArray(s);!a&&u?t[i]=this._interpolationFunction(s,r):"object"==typeof s&&s?this._updateProperties(t[i],o,s,r):"number"==typeof(s=this._handleRelativeValue(o,s))&&(t[i]=o+(s-o)*r)}},t.prototype._handleRelativeValue=function(t,e){return"string"!=typeof e?e:"+"===e.charAt(0)||"-"===e.charAt(0)?t+parseFloat(e):parseFloat(e)},t.prototype._swapEndStartRepeatValues=function(t){var e=this._valuesStartRepeat[t],n=this._valuesEnd[t];this._valuesStartRepeat[t]="string"==typeof n?this._valuesStartRepeat[t]+parseFloat(n):this._valuesEnd[t],this._valuesEnd[t]=e},t}(),l=a.nextId,h=u,p=h.getAll.bind(h),f=h.removeAll.bind(h),d=h.add.bind(h),g=h.remove.bind(h),m=h.update.bind(h),v={Easing:r,Group:o,Interpolation:s,now:i,Sequence:a,nextId:l,Tween:c,VERSION:"18.6.4",getAll:p,removeAll:f,add:d,remove:g,update:m};e.a=v}).call(this,n("8oxB"))},J14m:function(t,e,n){"use strict";n.r(e),n.d(e,"config",(function(){return m})),n.d(e,"LogUtil",(function(){return g})),n.d(e,"LogLevel",(function(){return d})),n.d(e,"CbType",(function(){return LM})),n.d(e,"OwllyVR",(function(){return RM})),n.d(e,"BasePlugin",(function(){return Q_})),n.d(e,"VideoPlugin",(function(){return Dw})),n.d(e,"Label3dPlugin",(function(){return Qw})),n.d(e,"Label2dPlugin",(function(){return pM})),n.d(e,"Label2dEventName",(function(){return hM}));var r={};n.r(r),n.d(r,"ACESFilmicToneMapping",(function(){return vt})),n.d(r,"AddEquation",(function(){return U})),n.d(r,"AddOperation",(function(){return pt})),n.d(r,"AdditiveAnimationBlendMode",(function(){return un})),n.d(r,"AdditiveBlending",(function(){return F})),n.d(r,"AlphaFormat",(function(){return Qt})),n.d(r,"AlwaysDepth",(function(){return rt})),n.d(r,"AlwaysStencilFunc",(function(){return Gn})),n.d(r,"AmbientLight",(function(){return Fh})),n.d(r,"AmbientLightProbe",(function(){return ip})),n.d(r,"AnimationClip",(function(){return Nl})),n.d(r,"AnimationLoader",(function(){return Wl})),n.d(r,"AnimationMixer",(function(){return Bp})),n.d(r,"AnimationObjectGroup",(function(){return Op})),n.d(r,"AnimationUtils",(function(){return El})),n.d(r,"ArcCurve",(function(){return $l})),n.d(r,"ArrayCamera",(function(){return Za})),n.d(r,"ArrowHelper",(function(){return Sf})),n.d(r,"Audio",(function(){return gp})),n.d(r,"AudioAnalyser",(function(){return _p})),n.d(r,"AudioContext",(function(){return ep})),n.d(r,"AudioListener",(function(){return dp})),n.d(r,"AudioLoader",(function(){return np})),n.d(r,"AxesHelper",(function(){return Af})),n.d(r,"AxisHelper",(function(){return Sd})),n.d(r,"BackSide",(function(){return I})),n.d(r,"BasicDepthPacking",(function(){return bn})),n.d(r,"BasicShadowMap",(function(){return S})),n.d(r,"BinaryTextureLoader",(function(){return Id})),n.d(r,"Bone",(function(){return Fu})),n.d(r,"BooleanKeyframeTrack",(function(){return Il})),n.d(r,"BoundingBoxHelper",(function(){return Ad})),n.d(r,"Box2",(function(){return Wp})),n.d(r,"Box3",(function(){return gr})),n.d(r,"Box3Helper",(function(){return bf})),n.d(r,"BoxBufferGeometry",(function(){return Io})),n.d(r,"BoxGeometry",(function(){return Io})),n.d(r,"BoxHelper",(function(){return xf})),n.d(r,"BufferAttribute",(function(){return Hi})),n.d(r,"BufferGeometry",(function(){return co})),n.d(r,"BufferGeometryLoader",(function(){return jh})),n.d(r,"ByteType",(function(){return Ut})),n.d(r,"Cache",(function(){return Gl})),n.d(r,"Camera",(function(){return Bo})),n.d(r,"CameraHelper",(function(){return mf})),n.d(r,"CanvasRenderer",(function(){return Rd})),n.d(r,"CanvasTexture",(function(){return hc})),n.d(r,"CatmullRomCurve3",(function(){return oh})),n.d(r,"CineonToneMapping",(function(){return mt})),n.d(r,"CircleBufferGeometry",(function(){return fc})),n.d(r,"CircleGeometry",(function(){return fc})),n.d(r,"ClampToEdgeWrapping",(function(){return Ct})),n.d(r,"Clock",(function(){return up})),n.d(r,"Color",(function(){return ki})),n.d(r,"ColorKeyframeTrack",(function(){return Ll})),n.d(r,"CompressedTexture",(function(){return lc})),n.d(r,"CompressedTextureLoader",(function(){return ql})),n.d(r,"ConeBufferGeometry",(function(){return gc})),n.d(r,"ConeGeometry",(function(){return gc})),n.d(r,"CubeCamera",(function(){return No})),n.d(r,"CubeReflectionMapping",(function(){return bt})),n.d(r,"CubeRefractionMapping",(function(){return _t})),n.d(r,"CubeTexture",(function(){return ko})),n.d(r,"CubeTextureLoader",(function(){return Yl})),n.d(r,"CubeUVReflectionMapping",(function(){return Et})),n.d(r,"CubeUVRefractionMapping",(function(){return St})),n.d(r,"CubicBezierCurve",(function(){return ch})),n.d(r,"CubicBezierCurve3",(function(){return lh})),n.d(r,"CubicInterpolant",(function(){return Al})),n.d(r,"CullFaceBack",(function(){return w})),n.d(r,"CullFaceFront",(function(){return M})),n.d(r,"CullFaceFrontBack",(function(){return E})),n.d(r,"CullFaceNone",(function(){return _})),n.d(r,"Curve",(function(){return Ql})),n.d(r,"CurvePath",(function(){return vh})),n.d(r,"CustomBlending",(function(){return G})),n.d(r,"CustomToneMapping",(function(){return yt})),n.d(r,"CylinderBufferGeometry",(function(){return dc})),n.d(r,"CylinderGeometry",(function(){return dc})),n.d(r,"Cylindrical",(function(){return Vp})),n.d(r,"DataTexture",(function(){return Uo})),n.d(r,"DataTexture2DArray",(function(){return ls})),n.d(r,"DataTexture3D",(function(){return hs})),n.d(r,"DataTextureLoader",(function(){return Jl})),n.d(r,"DataUtils",(function(){return Pf})),n.d(r,"DecrementStencilOp",(function(){return Tn})),n.d(r,"DecrementWrapStencilOp",(function(){return In})),n.d(r,"DefaultLoadingManager",(function(){return zl})),n.d(r,"DepthFormat",(function(){return re})),n.d(r,"DepthStencilFormat",(function(){return ie})),n.d(r,"DepthTexture",(function(){return pc})),n.d(r,"DirectionalLight",(function(){return Bh})),n.d(r,"DirectionalLightHelper",(function(){return ff})),n.d(r,"DiscreteInterpolant",(function(){return Tl})),n.d(r,"DodecahedronBufferGeometry",(function(){return vc})),n.d(r,"DodecahedronGeometry",(function(){return vc})),n.d(r,"DoubleSide",(function(){return L})),n.d(r,"DstAlphaFactor",(function(){return Q})),n.d(r,"DstColorFactor",(function(){return $})),n.d(r,"DynamicBufferAttribute",(function(){return gd})),n.d(r,"DynamicCopyUsage",(function(){return Xn})),n.d(r,"DynamicDrawUsage",(function(){return zn})),n.d(r,"DynamicReadUsage",(function(){return jn})),n.d(r,"EdgesGeometry",(function(){return wc})),n.d(r,"EdgesHelper",(function(){return Cd})),n.d(r,"EllipseCurve",(function(){return Zl})),n.d(r,"EqualDepth",(function(){return st})),n.d(r,"EqualStencilFunc",(function(){return Dn})),n.d(r,"EquirectangularReflectionMapping",(function(){return wt})),n.d(r,"EquirectangularRefractionMapping",(function(){return Mt})),n.d(r,"Euler",(function(){return $r})),n.d(r,"EventDispatcher",(function(){return Qn})),n.d(r,"ExtrudeBufferGeometry",(function(){return Qc})),n.d(r,"ExtrudeGeometry",(function(){return Qc})),n.d(r,"FaceColors",(function(){return id})),n.d(r,"FileLoader",(function(){return jl})),n.d(r,"FlatShading",(function(){return R})),n.d(r,"Float16BufferAttribute",(function(){return Ki})),n.d(r,"Float32Attribute",(function(){return Md})),n.d(r,"Float32BufferAttribute",(function(){return Qi})),n.d(r,"Float64Attribute",(function(){return Ed})),n.d(r,"Float64BufferAttribute",(function(){return Zi})),n.d(r,"FloatType",(function(){return Wt})),n.d(r,"Fog",(function(){return su})),n.d(r,"FogExp2",(function(){return ou})),n.d(r,"Font",(function(){return Qh})),n.d(r,"FontLoader",(function(){return $h})),n.d(r,"FrontSide",(function(){return P})),n.d(r,"Frustum",(function(){return Vo})),n.d(r,"GLBufferAttribute",(function(){return kp})),n.d(r,"GLSL1",(function(){return Jn})),n.d(r,"GLSL3",(function(){return Kn})),n.d(r,"GammaEncoding",(function(){return dn})),n.d(r,"GreaterDepth",(function(){return ut})),n.d(r,"GreaterEqualDepth",(function(){return at})),n.d(r,"GreaterEqualStencilFunc",(function(){return kn})),n.d(r,"GreaterStencilFunc",(function(){return Fn})),n.d(r,"GridHelper",(function(){return uf})),n.d(r,"Group",(function(){return $a})),n.d(r,"HalfFloatType",(function(){return qt})),n.d(r,"HemisphereLight",(function(){return _h})),n.d(r,"HemisphereLightHelper",(function(){return af})),n.d(r,"HemisphereLightProbe",(function(){return rp})),n.d(r,"IcosahedronBufferGeometry",(function(){return $c})),n.d(r,"IcosahedronGeometry",(function(){return $c})),n.d(r,"ImageBitmapLoader",(function(){return Jh})),n.d(r,"ImageLoader",(function(){return Xl})),n.d(r,"ImageUtils",(function(){return ir})),n.d(r,"ImmediateRenderObject",(function(){return Jp})),n.d(r,"IncrementStencilOp",(function(){return Cn})),n.d(r,"IncrementWrapStencilOp",(function(){return Pn})),n.d(r,"InstancedBufferAttribute",(function(){return Vh})),n.d(r,"InstancedBufferGeometry",(function(){return Hh})),n.d(r,"InstancedInterleavedBuffer",(function(){return Np})),n.d(r,"InstancedMesh",(function(){return ju})),n.d(r,"Int16Attribute",(function(){return xd})),n.d(r,"Int16BufferAttribute",(function(){return qi})),n.d(r,"Int32Attribute",(function(){return _d})),n.d(r,"Int32BufferAttribute",(function(){return Yi})),n.d(r,"Int8Attribute",(function(){return md})),n.d(r,"Int8BufferAttribute",(function(){return Vi})),n.d(r,"IntType",(function(){return Vt})),n.d(r,"InterleavedBuffer",(function(){return uu})),n.d(r,"InterleavedBufferAttribute",(function(){return lu})),n.d(r,"Interpolant",(function(){return Sl})),n.d(r,"InterpolateDiscrete",(function(){return tn})),n.d(r,"InterpolateLinear",(function(){return en})),n.d(r,"InterpolateSmooth",(function(){return nn})),n.d(r,"InvertStencilOp",(function(){return Ln})),n.d(r,"JSONLoader",(function(){return Od})),n.d(r,"KeepStencilOp",(function(){return Sn})),n.d(r,"KeyframeTrack",(function(){return Pl})),n.d(r,"LOD",(function(){return Pu})),n.d(r,"LatheBufferGeometry",(function(){return tl})),n.d(r,"LatheGeometry",(function(){return tl})),n.d(r,"Layers",(function(){return ti})),n.d(r,"LensFlare",(function(){return Bd})),n.d(r,"LessDepth",(function(){return it})),n.d(r,"LessEqualDepth",(function(){return ot})),n.d(r,"LessEqualStencilFunc",(function(){return Bn})),n.d(r,"LessStencilFunc",(function(){return On})),n.d(r,"Light",(function(){return bh})),n.d(r,"LightProbe",(function(){return Gh})),n.d(r,"Line",(function(){return Qu})),n.d(r,"Line3",(function(){return Yp})),n.d(r,"LineBasicMaterial",(function(){return Wu})),n.d(r,"LineCurve",(function(){return hh})),n.d(r,"LineCurve3",(function(){return ph})),n.d(r,"LineDashedMaterial",(function(){return wl})),n.d(r,"LineLoop",(function(){return ec})),n.d(r,"LinePieces",(function(){return nd})),n.d(r,"LineSegments",(function(){return tc})),n.d(r,"LineStrip",(function(){return ed})),n.d(r,"LinearEncoding",(function(){return pn})),n.d(r,"LinearFilter",(function(){return Dt})),n.d(r,"LinearInterpolant",(function(){return Cl})),n.d(r,"LinearMipMapLinearFilter",(function(){return kt})),n.d(r,"LinearMipMapNearestFilter",(function(){return Ft})),n.d(r,"LinearMipmapLinearFilter",(function(){return Nt})),n.d(r,"LinearMipmapNearestFilter",(function(){return Bt})),n.d(r,"LinearToneMapping",(function(){return dt})),n.d(r,"Loader",(function(){return Hl})),n.d(r,"LoaderUtils",(function(){return zh})),n.d(r,"LoadingManager",(function(){return Ul})),n.d(r,"LogLuvEncoding",(function(){return mn})),n.d(r,"LoopOnce",(function(){return Qe})),n.d(r,"LoopPingPong",(function(){return $e})),n.d(r,"LoopRepeat",(function(){return Ze})),n.d(r,"LuminanceAlphaFormat",(function(){return ee})),n.d(r,"LuminanceFormat",(function(){return te})),n.d(r,"MOUSE",(function(){return x})),n.d(r,"Material",(function(){return Li})),n.d(r,"MaterialLoader",(function(){return Uh})),n.d(r,"Math",(function(){return tr})),n.d(r,"MathUtils",(function(){return tr})),n.d(r,"Matrix3",(function(){return nr})),n.d(r,"Matrix4",(function(){return Vr})),n.d(r,"MaxEquation",(function(){return j})),n.d(r,"Mesh",(function(){return To})),n.d(r,"MeshBasicMaterial",(function(){return Gi})),n.d(r,"MeshDepthMaterial",(function(){return qa})),n.d(r,"MeshDistanceMaterial",(function(){return Xa})),n.d(r,"MeshFaceMaterial",(function(){return sd})),n.d(r,"MeshLambertMaterial",(function(){return bl})),n.d(r,"MeshMatcapMaterial",(function(){return _l})),n.d(r,"MeshNormalMaterial",(function(){return xl})),n.d(r,"MeshPhongMaterial",(function(){return vl})),n.d(r,"MeshPhysicalMaterial",(function(){return ml})),n.d(r,"MeshStandardMaterial",(function(){return gl})),n.d(r,"MeshToonMaterial",(function(){return yl})),n.d(r,"MinEquation",(function(){return V})),n.d(r,"MirroredRepeatWrapping",(function(){return Tt})),n.d(r,"MixOperation",(function(){return ht})),n.d(r,"MultiMaterial",(function(){return ad})),n.d(r,"MultiplyBlending",(function(){return k})),n.d(r,"MultiplyOperation",(function(){return lt})),n.d(r,"NearestFilter",(function(){return Pt})),n.d(r,"NearestMipMapLinearFilter",(function(){return Ot})),n.d(r,"NearestMipMapNearestFilter",(function(){return Lt})),n.d(r,"NearestMipmapLinearFilter",(function(){return Rt})),n.d(r,"NearestMipmapNearestFilter",(function(){return It})),n.d(r,"NeverDepth",(function(){return nt})),n.d(r,"NeverStencilFunc",(function(){return Rn})),n.d(r,"NoBlending",(function(){return D})),n.d(r,"NoColors",(function(){return rd})),n.d(r,"NoToneMapping",(function(){return ft})),n.d(r,"NormalAnimationBlendMode",(function(){return an})),n.d(r,"NormalBlending",(function(){return B})),n.d(r,"NotEqualDepth",(function(){return ct})),n.d(r,"NotEqualStencilFunc",(function(){return Nn})),n.d(r,"NumberKeyframeTrack",(function(){return Rl})),n.d(r,"Object3D",(function(){return di})),n.d(r,"ObjectLoader",(function(){return Wh})),n.d(r,"ObjectSpaceNormalMap",(function(){return Mn})),n.d(r,"OctahedronBufferGeometry",(function(){return el})),n.d(r,"OctahedronGeometry",(function(){return el})),n.d(r,"OneFactor",(function(){return q})),n.d(r,"OneMinusDstAlphaFactor",(function(){return Z})),n.d(r,"OneMinusDstColorFactor",(function(){return tt})),n.d(r,"OneMinusSrcAlphaFactor",(function(){return K})),n.d(r,"OneMinusSrcColorFactor",(function(){return Y})),n.d(r,"OrthographicCamera",(function(){return Oh})),n.d(r,"PCFShadowMap",(function(){return A})),n.d(r,"PCFSoftShadowMap",(function(){return C})),n.d(r,"PMREMGenerator",(function(){return qf})),n.d(r,"ParametricBufferGeometry",(function(){return nl})),n.d(r,"ParametricGeometry",(function(){return nl})),n.d(r,"Particle",(function(){return cd})),n.d(r,"ParticleBasicMaterial",(function(){return pd})),n.d(r,"ParticleSystem",(function(){return ld})),n.d(r,"ParticleSystemMaterial",(function(){return fd})),n.d(r,"Path",(function(){return yh})),n.d(r,"PerspectiveCamera",(function(){return Fo})),n.d(r,"Plane",(function(){return yi})),n.d(r,"PlaneBufferGeometry",(function(){return qo})),n.d(r,"PlaneGeometry",(function(){return qo})),n.d(r,"PlaneHelper",(function(){return _f})),n.d(r,"PointCloud",(function(){return ud})),n.d(r,"PointCloudMaterial",(function(){return hd})),n.d(r,"PointLight",(function(){return Rh})),n.d(r,"PointLightHelper",(function(){return nf})),n.d(r,"Points",(function(){return ac})),n.d(r,"PointsMaterial",(function(){return nc})),n.d(r,"PolarGridHelper",(function(){return cf})),n.d(r,"PolyhedronBufferGeometry",(function(){return mc})),n.d(r,"PolyhedronGeometry",(function(){return mc})),n.d(r,"PositionalAudio",(function(){return bp})),n.d(r,"PropertyBinding",(function(){return Rp})),n.d(r,"PropertyMixer",(function(){return wp})),n.d(r,"QuadraticBezierCurve",(function(){return fh})),n.d(r,"QuadraticBezierCurve3",(function(){return dh})),n.d(r,"Quaternion",(function(){return hr})),n.d(r,"QuaternionKeyframeTrack",(function(){return Dl})),n.d(r,"QuaternionLinearInterpolant",(function(){return Ol})),n.d(r,"REVISION",(function(){return y})),n.d(r,"RGBADepthPacking",(function(){return _n})),n.d(r,"RGBAFormat",(function(){return $t})),n.d(r,"RGBAIntegerFormat",(function(){return le})),n.d(r,"RGBA_ASTC_10x10_Format",(function(){return Oe})),n.d(r,"RGBA_ASTC_10x5_Format",(function(){return Ie})),n.d(r,"RGBA_ASTC_10x6_Format",(function(){return Le})),n.d(r,"RGBA_ASTC_10x8_Format",(function(){return Re})),n.d(r,"RGBA_ASTC_12x10_Format",(function(){return De})),n.d(r,"RGBA_ASTC_12x12_Format",(function(){return Be})),n.d(r,"RGBA_ASTC_4x4_Format",(function(){return we})),n.d(r,"RGBA_ASTC_5x4_Format",(function(){return Me})),n.d(r,"RGBA_ASTC_5x5_Format",(function(){return Ee})),n.d(r,"RGBA_ASTC_6x5_Format",(function(){return Se})),n.d(r,"RGBA_ASTC_6x6_Format",(function(){return Ae})),n.d(r,"RGBA_ASTC_8x5_Format",(function(){return Ce})),n.d(r,"RGBA_ASTC_8x6_Format",(function(){return Te})),n.d(r,"RGBA_ASTC_8x8_Format",(function(){return Pe})),n.d(r,"RGBA_BPTC_Format",(function(){return Fe})),n.d(r,"RGBA_ETC2_EAC_Format",(function(){return _e})),n.d(r,"RGBA_PVRTC_2BPPV1_Format",(function(){return ye})),n.d(r,"RGBA_PVRTC_4BPPV1_Format",(function(){return ve})),n.d(r,"RGBA_S3TC_DXT1_Format",(function(){return pe})),n.d(r,"RGBA_S3TC_DXT3_Format",(function(){return fe})),n.d(r,"RGBA_S3TC_DXT5_Format",(function(){return de})),n.d(r,"RGBDEncoding",(function(){return xn})),n.d(r,"RGBEEncoding",(function(){return gn})),n.d(r,"RGBEFormat",(function(){return ne})),n.d(r,"RGBFormat",(function(){return Zt})),n.d(r,"RGBIntegerFormat",(function(){return ce})),n.d(r,"RGBM16Encoding",(function(){return yn})),n.d(r,"RGBM7Encoding",(function(){return vn})),n.d(r,"RGB_ETC1_Format",(function(){return xe})),n.d(r,"RGB_ETC2_Format",(function(){return be})),n.d(r,"RGB_PVRTC_2BPPV1_Format",(function(){return me})),n.d(r,"RGB_PVRTC_4BPPV1_Format",(function(){return ge})),n.d(r,"RGB_S3TC_DXT1_Format",(function(){return he})),n.d(r,"RGFormat",(function(){return ae})),n.d(r,"RGIntegerFormat",(function(){return ue})),n.d(r,"RawShaderMaterial",(function(){return dl})),n.d(r,"Ray",(function(){return Hr})),n.d(r,"Raycaster",(function(){return Gp})),n.d(r,"RectAreaLight",(function(){return Nh})),n.d(r,"RedFormat",(function(){return oe})),n.d(r,"RedIntegerFormat",(function(){return se})),n.d(r,"ReinhardToneMapping",(function(){return gt})),n.d(r,"RepeatWrapping",(function(){return At})),n.d(r,"ReplaceStencilOp",(function(){return An})),n.d(r,"ReverseSubtractEquation",(function(){return H})),n.d(r,"RingBufferGeometry",(function(){return rl})),n.d(r,"RingGeometry",(function(){return rl})),n.d(r,"SRGB8_ALPHA8_ASTC_10x10_Format",(function(){return Ye})),n.d(r,"SRGB8_ALPHA8_ASTC_10x5_Format",(function(){return We})),n.d(r,"SRGB8_ALPHA8_ASTC_10x6_Format",(function(){return qe})),n.d(r,"SRGB8_ALPHA8_ASTC_10x8_Format",(function(){return Xe})),n.d(r,"SRGB8_ALPHA8_ASTC_12x10_Format",(function(){return Je})),n.d(r,"SRGB8_ALPHA8_ASTC_12x12_Format",(function(){return Ke})),n.d(r,"SRGB8_ALPHA8_ASTC_4x4_Format",(function(){return Ne})),n.d(r,"SRGB8_ALPHA8_ASTC_5x4_Format",(function(){return ke})),n.d(r,"SRGB8_ALPHA8_ASTC_5x5_Format",(function(){return Ge})),n.d(r,"SRGB8_ALPHA8_ASTC_6x5_Format",(function(){return Ue})),n.d(r,"SRGB8_ALPHA8_ASTC_6x6_Format",(function(){return ze})),n.d(r,"SRGB8_ALPHA8_ASTC_8x5_Format",(function(){return He})),n.d(r,"SRGB8_ALPHA8_ASTC_8x6_Format",(function(){return Ve})),n.d(r,"SRGB8_ALPHA8_ASTC_8x8_Format",(function(){return je})),n.d(r,"Scene",(function(){return au})),n.d(r,"SceneUtils",(function(){return Dd})),n.d(r,"ShaderChunk",(function(){return Xo})),n.d(r,"ShaderLib",(function(){return Jo})),n.d(r,"ShaderMaterial",(function(){return Do})),n.d(r,"ShadowMaterial",(function(){return fl})),n.d(r,"Shape",(function(){return xh})),n.d(r,"ShapeBufferGeometry",(function(){return il})),n.d(r,"ShapeGeometry",(function(){return il})),n.d(r,"ShapePath",(function(){return Kh})),n.d(r,"ShapeUtils",(function(){return Yc})),n.d(r,"ShortType",(function(){return zt})),n.d(r,"Skeleton",(function(){return Gu})),n.d(r,"SkeletonHelper",(function(){return ef})),n.d(r,"SkinnedMesh",(function(){return Bu})),n.d(r,"SmoothShading",(function(){return O})),n.d(r,"Sphere",(function(){return Dr})),n.d(r,"SphereBufferGeometry",(function(){return ol})),n.d(r,"SphereGeometry",(function(){return ol})),n.d(r,"Spherical",(function(){return Hp})),n.d(r,"SphericalHarmonics3",(function(){return kh})),n.d(r,"SplineCurve",(function(){return gh})),n.d(r,"SpotLight",(function(){return Ch})),n.d(r,"SpotLightHelper",(function(){return Qp})),n.d(r,"Sprite",(function(){return Su})),n.d(r,"SpriteMaterial",(function(){return hu})),n.d(r,"SrcAlphaFactor",(function(){return J})),n.d(r,"SrcAlphaSaturateFactor",(function(){return et})),n.d(r,"SrcColorFactor",(function(){return X})),n.d(r,"StaticCopyUsage",(function(){return qn})),n.d(r,"StaticDrawUsage",(function(){return Un})),n.d(r,"StaticReadUsage",(function(){return Vn})),n.d(r,"StereoCamera",(function(){return ap})),n.d(r,"StreamCopyUsage",(function(){return Yn})),n.d(r,"StreamDrawUsage",(function(){return Hn})),n.d(r,"StreamReadUsage",(function(){return Wn})),n.d(r,"StringKeyframeTrack",(function(){return Bl})),n.d(r,"SubtractEquation",(function(){return z})),n.d(r,"SubtractiveBlending",(function(){return N})),n.d(r,"TOUCH",(function(){return b})),n.d(r,"TangentSpaceNormalMap",(function(){return wn})),n.d(r,"TetrahedronBufferGeometry",(function(){return sl})),n.d(r,"TetrahedronGeometry",(function(){return sl})),n.d(r,"TextBufferGeometry",(function(){return al})),n.d(r,"TextGeometry",(function(){return al})),n.d(r,"Texture",(function(){return sr})),n.d(r,"TextureLoader",(function(){return Kl})),n.d(r,"TorusBufferGeometry",(function(){return ul})),n.d(r,"TorusGeometry",(function(){return ul})),n.d(r,"TorusKnotBufferGeometry",(function(){return cl})),n.d(r,"TorusKnotGeometry",(function(){return cl})),n.d(r,"Triangle",(function(){return Pi})),n.d(r,"TriangleFanDrawMode",(function(){return hn})),n.d(r,"TriangleStripDrawMode",(function(){return ln})),n.d(r,"TrianglesDrawMode",(function(){return cn})),n.d(r,"TubeBufferGeometry",(function(){return ll})),n.d(r,"TubeGeometry",(function(){return ll})),n.d(r,"UVMapping",(function(){return xt})),n.d(r,"Uint16Attribute",(function(){return bd})),n.d(r,"Uint16BufferAttribute",(function(){return Xi})),n.d(r,"Uint32Attribute",(function(){return wd})),n.d(r,"Uint32BufferAttribute",(function(){return Ji})),n.d(r,"Uint8Attribute",(function(){return vd})),n.d(r,"Uint8BufferAttribute",(function(){return ji})),n.d(r,"Uint8ClampedAttribute",(function(){return yd})),n.d(r,"Uint8ClampedBufferAttribute",(function(){return Wi})),n.d(r,"Uniform",(function(){return Fp})),n.d(r,"UniformsLib",(function(){return Yo})),n.d(r,"UniformsUtils",(function(){return Oo})),n.d(r,"UnsignedByteType",(function(){return Gt})),n.d(r,"UnsignedInt248Type",(function(){return Kt})),n.d(r,"UnsignedIntType",(function(){return jt})),n.d(r,"UnsignedShort4444Type",(function(){return Xt})),n.d(r,"UnsignedShort5551Type",(function(){return Yt})),n.d(r,"UnsignedShort565Type",(function(){return Jt})),n.d(r,"UnsignedShortType",(function(){return Ht})),n.d(r,"VSMShadowMap",(function(){return T})),n.d(r,"Vector2",(function(){return er})),n.d(r,"Vector3",(function(){return pr})),n.d(r,"Vector4",(function(){return ur})),n.d(r,"VectorKeyframeTrack",(function(){return Fl})),n.d(r,"Vertex",(function(){return dd})),n.d(r,"VertexColors",(function(){return od})),n.d(r,"VideoTexture",(function(){return cc})),n.d(r,"WebGL1Renderer",(function(){return iu})),n.d(r,"WebGLCubeRenderTarget",(function(){return Go})),n.d(r,"WebGLMultisampleRenderTarget",(function(){return lr})),n.d(r,"WebGLRenderTarget",(function(){return cr})),n.d(r,"WebGLRenderTargetCube",(function(){return Ld})),n.d(r,"WebGLRenderer",(function(){return ru})),n.d(r,"WebGLUtils",(function(){return Qa})),n.d(r,"WireframeGeometry",(function(){return hl})),n.d(r,"WireframeHelper",(function(){return Td})),n.d(r,"WrapAroundEnding",(function(){return sn})),n.d(r,"XHRLoader",(function(){return Pd})),n.d(r,"ZeroCurvatureEnding",(function(){return rn})),n.d(r,"ZeroFactor",(function(){return W})),n.d(r,"ZeroSlopeEnding",(function(){return on})),n.d(r,"ZeroStencilOp",(function(){return En})),n.d(r,"sRGBEncoding",(function(){return fn}));var i={};n.r(i),n.d(i,"create",(function(){return og})),n.d(i,"clone",(function(){return sg})),n.d(i,"copy",(function(){return ag})),n.d(i,"fromValues",(function(){return ug})),n.d(i,"set",(function(){return cg})),n.d(i,"identity",(function(){return lg})),n.d(i,"transpose",(function(){return hg})),n.d(i,"invert",(function(){return pg})),n.d(i,"adjoint",(function(){return fg})),n.d(i,"determinant",(function(){return dg})),n.d(i,"multiply",(function(){return gg})),n.d(i,"translate",(function(){return mg})),n.d(i,"scale",(function(){return vg})),n.d(i,"rotate",(function(){return yg})),n.d(i,"rotateX",(function(){return xg})),n.d(i,"rotateY",(function(){return bg})),n.d(i,"rotateZ",(function(){return _g})),n.d(i,"fromTranslation",(function(){return wg})),n.d(i,"fromScaling",(function(){return Mg})),n.d(i,"fromRotation",(function(){return Eg})),n.d(i,"fromXRotation",(function(){return Sg})),n.d(i,"fromYRotation",(function(){return Ag})),n.d(i,"fromZRotation",(function(){return Cg})),n.d(i,"fromRotationTranslation",(function(){return Tg})),n.d(i,"fromQuat2",(function(){return Pg})),n.d(i,"getTranslation",(function(){return Ig})),n.d(i,"getScaling",(function(){return Lg})),n.d(i,"getRotation",(function(){return Rg})),n.d(i,"fromRotationTranslationScale",(function(){return Og})),n.d(i,"fromRotationTranslationScaleOrigin",(function(){return Dg})),n.d(i,"fromQuat",(function(){return Bg})),n.d(i,"frustum",(function(){return Fg})),n.d(i,"perspectiveNO",(function(){return Ng})),n.d(i,"perspective",(function(){return kg})),n.d(i,"perspectiveZO",(function(){return Gg})),n.d(i,"perspectiveFromFieldOfView",(function(){return Ug})),n.d(i,"orthoNO",(function(){return zg})),n.d(i,"ortho",(function(){return Hg})),n.d(i,"orthoZO",(function(){return Vg})),n.d(i,"lookAt",(function(){return jg})),n.d(i,"targetTo",(function(){return Wg})),n.d(i,"str",(function(){return qg})),n.d(i,"frob",(function(){return Xg})),n.d(i,"add",(function(){return Yg})),n.d(i,"subtract",(function(){return Jg})),n.d(i,"multiplyScalar",(function(){return Kg})),n.d(i,"multiplyScalarAndAdd",(function(){return Qg})),n.d(i,"exactEquals",(function(){return Zg})),n.d(i,"equals",(function(){return $g})),n.d(i,"mul",(function(){return tm})),n.d(i,"sub",(function(){return em}));var o={};n.r(o),n.d(o,"create",(function(){return nm})),n.d(o,"clone",(function(){return rm})),n.d(o,"fromValues",(function(){return im})),n.d(o,"copy",(function(){return om})),n.d(o,"set",(function(){return sm})),n.d(o,"add",(function(){return am})),n.d(o,"subtract",(function(){return um})),n.d(o,"multiply",(function(){return cm})),n.d(o,"divide",(function(){return lm})),n.d(o,"ceil",(function(){return hm})),n.d(o,"floor",(function(){return pm})),n.d(o,"min",(function(){return fm})),n.d(o,"max",(function(){return dm})),n.d(o,"round",(function(){return gm})),n.d(o,"scale",(function(){return mm})),n.d(o,"scaleAndAdd",(function(){return vm})),n.d(o,"distance",(function(){return ym})),n.d(o,"squaredDistance",(function(){return xm})),n.d(o,"length",(function(){return bm})),n.d(o,"squaredLength",(function(){return _m})),n.d(o,"negate",(function(){return wm})),n.d(o,"inverse",(function(){return Mm})),n.d(o,"normalize",(function(){return Em})),n.d(o,"dot",(function(){return Sm})),n.d(o,"cross",(function(){return Am})),n.d(o,"lerp",(function(){return Cm})),n.d(o,"random",(function(){return Tm})),n.d(o,"transformMat2",(function(){return Pm})),n.d(o,"transformMat2d",(function(){return Im})),n.d(o,"transformMat3",(function(){return Lm})),n.d(o,"transformMat4",(function(){return Rm})),n.d(o,"rotate",(function(){return Om})),n.d(o,"angle",(function(){return Dm})),n.d(o,"zero",(function(){return Bm})),n.d(o,"str",(function(){return Fm})),n.d(o,"exactEquals",(function(){return Nm})),n.d(o,"equals",(function(){return km})),n.d(o,"len",(function(){return Um})),n.d(o,"sub",(function(){return zm})),n.d(o,"mul",(function(){return Hm})),n.d(o,"div",(function(){return Vm})),n.d(o,"dist",(function(){return jm})),n.d(o,"sqrDist",(function(){return Wm})),n.d(o,"sqrLen",(function(){return qm})),n.d(o,"forEach",(function(){return Xm}));var s={};n.r(s),n.d(s,"create",(function(){return Ym})),n.d(s,"clone",(function(){return Jm})),n.d(s,"length",(function(){return Km})),n.d(s,"fromValues",(function(){return Qm})),n.d(s,"copy",(function(){return Zm})),n.d(s,"set",(function(){return $m})),n.d(s,"add",(function(){return tv})),n.d(s,"subtract",(function(){return ev})),n.d(s,"multiply",(function(){return nv})),n.d(s,"divide",(function(){return rv})),n.d(s,"ceil",(function(){return iv})),n.d(s,"floor",(function(){return ov})),n.d(s,"min",(function(){return sv})),n.d(s,"max",(function(){return av})),n.d(s,"round",(function(){return uv})),n.d(s,"scale",(function(){return cv})),n.d(s,"scaleAndAdd",(function(){return lv})),n.d(s,"distance",(function(){return hv})),n.d(s,"squaredDistance",(function(){return pv})),n.d(s,"squaredLength",(function(){return fv})),n.d(s,"negate",(function(){return dv})),n.d(s,"inverse",(function(){return gv})),n.d(s,"normalize",(function(){return mv})),n.d(s,"dot",(function(){return vv})),n.d(s,"cross",(function(){return yv})),n.d(s,"lerp",(function(){return xv})),n.d(s,"hermite",(function(){return bv})),n.d(s,"bezier",(function(){return _v})),n.d(s,"random",(function(){return wv})),n.d(s,"transformMat4",(function(){return Mv})),n.d(s,"transformMat3",(function(){return Ev})),n.d(s,"transformQuat",(function(){return Sv})),n.d(s,"rotateX",(function(){return Av})),n.d(s,"rotateY",(function(){return Cv})),n.d(s,"rotateZ",(function(){return Tv})),n.d(s,"angle",(function(){return Pv})),n.d(s,"zero",(function(){return Iv})),n.d(s,"str",(function(){return Lv})),n.d(s,"exactEquals",(function(){return Rv})),n.d(s,"equals",(function(){return Ov})),n.d(s,"sub",(function(){return Dv})),n.d(s,"mul",(function(){return Bv})),n.d(s,"div",(function(){return Fv})),n.d(s,"dist",(function(){return Nv})),n.d(s,"sqrDist",(function(){return kv})),n.d(s,"len",(function(){return Gv})),n.d(s,"sqrLen",(function(){return Uv})),n.d(s,"forEach",(function(){return zv}));var a={};n.r(a),n.d(a,"create",(function(){return Hv})),n.d(a,"clone",(function(){return Vv})),n.d(a,"fromValues",(function(){return jv})),n.d(a,"copy",(function(){return Wv})),n.d(a,"set",(function(){return qv})),n.d(a,"add",(function(){return Xv})),n.d(a,"subtract",(function(){return Yv})),n.d(a,"multiply",(function(){return Jv})),n.d(a,"divide",(function(){return Kv})),n.d(a,"ceil",(function(){return Qv})),n.d(a,"floor",(function(){return Zv})),n.d(a,"min",(function(){return $v})),n.d(a,"max",(function(){return ty})),n.d(a,"round",(function(){return ey})),n.d(a,"scale",(function(){return ny})),n.d(a,"scaleAndAdd",(function(){return ry})),n.d(a,"distance",(function(){return iy})),n.d(a,"squaredDistance",(function(){return oy})),n.d(a,"length",(function(){return sy})),n.d(a,"squaredLength",(function(){return ay})),n.d(a,"negate",(function(){return uy})),n.d(a,"inverse",(function(){return cy})),n.d(a,"normalize",(function(){return ly})),n.d(a,"dot",(function(){return hy})),n.d(a,"cross",(function(){return py})),n.d(a,"lerp",(function(){return fy})),n.d(a,"random",(function(){return dy})),n.d(a,"transformMat4",(function(){return gy})),n.d(a,"transformQuat",(function(){return my})),n.d(a,"zero",(function(){return vy})),n.d(a,"str",(function(){return yy})),n.d(a,"exactEquals",(function(){return xy})),n.d(a,"equals",(function(){return by})),n.d(a,"sub",(function(){return wy})),n.d(a,"mul",(function(){return My})),n.d(a,"div",(function(){return Ey})),n.d(a,"dist",(function(){return Sy})),n.d(a,"sqrDist",(function(){return Ay})),n.d(a,"len",(function(){return Cy})),n.d(a,"sqrLen",(function(){return Ty})),n.d(a,"forEach",(function(){return Py}));n("pNMO"),n("4Brf"),n("0oug"),n("gXIK"),n("4mDm"),n("7+zs"),n("qePV"),n("07d7"),n("PKPk"),n("3bBZ");function u(t){return(u="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})(t)}function c(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,f(r.key),r)}}function l(t,e,n){return e&&c(t.prototype,e),n&&c(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function p(t,e,n){return(e=f(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function f(t){var e=function(t,e){if("object"!=u(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==u(e)?e:e+""}var d=l((function t(){h(this,t)}));p(d,"NONE",0),p(d,"ERROR",1),p(d,"WARN",2),p(d,"LOG",3);var g=function(){return l((function t(){h(this,t)}),null,[{key:"log",value:function(){var t;this.level>=d.LOG&&(t=console).log.apply(t,arguments)}},{key:"warn",value:function(){var t;this.level>=d.WARN&&(t=console).warn.apply(t,arguments)}},{key:"error",value:function(){var t;this.level>=d.ERROR&&(t=console).error.apply(t,arguments)}},{key:"time",value:function(t){this.level>=d.LOG&&console.time(t)}},{key:"timeEnd",value:function(t){this.level>=d.LOG&&console.timeEnd(t)}}])}();p(g,"level",d.NONE);var m={oVersion:"1.0.2",name:"common-h5",label:"通用h5",mode:"on-line",sendToAndroid:!1,moveClick:!1,templePath:0,updateDate:"21-09-27",defaultVisibleRadius:50,rotate:{scale:45,distance:4},logLevel:d.LOG,cbLog:!1,initStore:!0,model:{show:!0},ui:{playBtn:!1,img360:!1},camera:{fov:90,zoomScale:-1},move:{auto:!0,speed:10,moveLevel:0,stayLevel:2,jump:!0,jumpTo:!0,jumpDistance:20,startMove:!1,beginFovAnimation:!0,firstLookback:!0},emitPointerPosition:!1,path:{color:5949690,expendLength:2,width:.6,heightOffset:-1,viewDistance:20,minViewDistance:4,fixedViewDistance:!1,simplify:!0,maxTurningDegree:175,rotateCount:1},useTile:!0,tileLevelMax:2,tileResizeFirst:!1,tile:{levels:[.5,.9,2],textPixel:512,imgTextPixel:2048,useLowTextureURLsOnly:!1,useSuper:!1},vrFormat:null,moveDataFormat:null,setUp:null,debug:{test:!0,testDatas:[],showVersion:0},healthCheck:{use:!1,url:"https://robot-vr.aibee.cn/v1/health",thresholdValue:1e3,frequency:2e3},api:{listPanoramasUrl:"https://nav.aibee.cn/aether-walker/vr/list-panoramas"}};g.level=m.logLevel;n("tjZM"),n("lEou"),n("ma9I"),n("pjDv"),n("2B1R"),n("+2oP"),n("pDQq"),n("sMBO"),n("DEfu"),n("Tskq"),n("I9xj"),n("NBAS"),n("tkto"),n("ExoC"),n("5s+n"),n("JfAA"),n("YGK4"),n("TFPT"),n("FZtP"),n("R5XZ");var v=n("IrXD");
10
10
  /**
11
11
  * @license
12
12
  * Copyright 2010-2021 Three.js Authors
@@ -73,7 +73,7 @@ class ob{static readHeader(t,e){String.fromCharCode(e.getUint8(0),e.getUint8(1),
73
73
  Copyright (c) 2013 aaharu
74
74
  This software is released under the MIT License.
75
75
  https://raw.github.com/aaharu/gifken/master/LICENSE
76
- */var ub=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};class cb extends eg{constructor(t,e,n){super(),this.frames=[],this.labelID=t,this.initialized=!1,this.needUpdate=!1,this.isEditingInView=new Map,this.currentPID=-1,this.movedToNewPanorama=!0,this.outOfRange=!0,this.currentDisplayTime=0,this.frameIndex=0,this.tileDispDuration=60,this.hidden=!1;const{THREE:r}=Nd.getInstance(),{width:i,height:o,depthTest:s}=n||{};this.width=i||.1,this.height=o||.1,this.depthTest=s||!1;const a=new r.PlaneBufferGeometry(this.width,this.height);this.uniforms={map:{type:"t",value:null},blendColor:{type:"v4",value:new r.Vector4(0,0,0,0)},opacity:{value:1}},this.material=new r.ShaderMaterial({transparent:!0,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",fragmentShader:"\n uniform sampler2D map;\n uniform vec4 blendColor;\n uniform float opacity;\n varying vec2 vUv;\n void main(){\n vec4 texColor = texture2D(map, vUv);\n gl_FragColor = vec4((texColor * (1.0 - blendColor.a) + blendColor * blendColor.a).rgb, texColor.a) * vec4(1, 1, 1, opacity);\n }",uniforms:this.uniforms,depthTest:this.depthTest,depthWrite:!1,name:"placeable2DMaterial",side:r.DoubleSide}),this.labelMesh=new r.Mesh(a,this.material),this.labelMesh.renderOrder=400,this.add(this.labelMesh),this.imgElement=document.createElement("div"),this.imgElement.style.pointerEvents="none",this.imgElement.innerHTML=`<div><img width=50px height=50px src="${e}"></div>`,this.cssObject=new eb(this.imgElement),this.add(this.cssObject),this.viewConfigurations=new Map,this.eventListeners={onMoveToPanorama:(t,e)=>{this.updateCurrentBindingPanorama(t,e)},onPositionChanged:(t,e,n)=>{if(e!==this)return;const{visible:r}=this.getViewConfigurationByPanoramaId(n,this.currentPID);this.updateViewConfigurationByPanoramaId(n,this.currentPID,{visible:r,position:t})}},kd.on(Ud.MOVE_TO_PANORAMA,this.eventListeners.onMoveToPanorama),kd.on(zd.ELEMENT_POSITION_UPDATED,this.eventListeners.onPositionChanged),e&&this.load(e)}load(t){return ub(this,void 0,void 0,(function*(){this.initialized=!1;const e=t.search(/\.gif$/),{THREE:n}=Nd.getInstance();if(e>0){const e=new XMLHttpRequest;e.open("GET",t,!0),e.responseType="arraybuffer",e.onload=()=>ub(this,void 0,void 0,(function*(){let t;t=e.response,this.gif=ab.parse(t),t.toString().indexOf("ArrayBuffer")>0&&(t=new Uint8Array(t)),this.gif.split(!0).forEach(t=>ub(this,void 0,void 0,(function*(){const e=new Image,r=class{static writeToBlob(t){if("function"==typeof Blob)return new Blob(t,{type:"image/gif"});throw new Error("writeToBlob is browser-only function")}static writeToDataUrl(t){let e="";return t.forEach(t=>{const n=[];for(let e=0,r=t.byteLength;e<r;++e)n.push(t[e]);e+=String.fromCharCode.apply(null,n)}),"data:image/gif;base64,"+btoa(e)}}.writeToBlob(t.writeToArrayBuffer());e.src=URL.createObjectURL(r),e.onload=()=>ub(this,void 0,void 0,(function*(){if(this.frames.push(e),this.gif.frames.length===this.frames.length){this.frameIndex=0,this.currentDisplayTime=(new Date).getTime();const t=new n.PlaneBufferGeometry(this.width,this.height);this.gifCanvas=document.createElement("canvas"),this.gifCanvas.width=this.gif.width,this.gifCanvas.height=this.gif.height,this.gifContext=this.gifCanvas.getContext("2d"),this.gifContext&&this.gifContext.drawImage(this.frames[this.frameIndex],0,0,this.gif.width,this.gif.height),this.giftexture=new n.Texture(this.gifCanvas),this.giftexture.needsUpdate=!0,this.gifMaterial=new n.MeshBasicMaterial({map:this.giftexture,transparent:!0,side:n.DoubleSide}),this.gifLabelMesh=new n.Mesh(t,this.gifMaterial),this.add(this.gifLabelMesh),this.needUpdate=!0,this.emit(Ud.ELEMENT_LOADED,this)}}))})))})),e.send()}else(new n.TextureLoader).load(t,t=>{this.uniforms.map.value=t,this.needUpdate=!0,this.emit(Ud.ELEMENT_LOADED,this)})}))}drawCanvas(){this.gifContext&&(this.gifContext.clearRect(0,0,this.gif.width,this.gif.height),this.gifContext.drawImage(this.frames[this.frameIndex],0,0,this.gif.width,this.gif.height),this.giftexture.needsUpdate=!0,this.needUpdate=!0)}update(){const t=new tg(this);if(this.initialized||(this.initialized=!0,t.needUpdate=!0),this.needUpdate&&(t.needUpdate=!0,this.needUpdate=!1),null!==this.gifLabelMesh){const t=(new Date).getTime();t-this.currentDisplayTime>=this.tileDispDuration&&(this.currentDisplayTime=t,this.frameIndex+=1,this.frameIndex>=this.frames.length&&(this.frameIndex=0),this.drawCanvas())}return this.initialized&&!this.parent&&(t.shouldPlaceElement=!0),t}dispose(){const t=this.uniforms.map.value;t&&t.dispose(),kd.off(Ud.MOVE_TO_PANORAMA,this.eventListeners.onMoveToPanorama),kd.off(zd.ELEMENT_POSITION_UPDATED,this.eventListeners.onPositionChanged),this.imgElement=null,this.cssObject.dispatchEvent({type:"remove"}),this.remove(this.cssObject),this.cssObject=null,super.dispose()}addViewConfiguration(t){const e={targetView:t.targetView,faceToCamera:t.faceToCamera,keepZOnFaceToCamera:t.keepZOnFaceToCamera,showDom:!1,showMesh:!0,visibleScope:5},n=this.viewConfigurations.get(t.targetView);n&&(e.visibilities=n.visibilities,e.positions=n.positions,void 0===e.faceToCamera&&(e.faceToCamera=n.faceToCamera),void 0===e.keepZOnFaceToCamera&&(e.keepZOnFaceToCamera=n.keepZOnFaceToCamera),e.showDom=n.showDom,e.showMesh=n.showMesh,e.visibleScope=n.visibleScope),void 0!==t.showDom&&(e.showDom=t.showDom),void 0!==t.showMesh&&(e.showMesh=t.showMesh),void 0!==t.visibleScope&&(e.visibleScope=t.visibleScope),t.visibilities&&(e.visibilities||(e.visibilities=new Map),t.visibilities.forEach(t=>{e.visibilities.set(t.pid,t.visible)})),t.positions&&(e.positions||(e.positions=new Map),t.positions.forEach(t=>{e.positions.set(t.pid,t.position)})),this.viewConfigurations.set(e.targetView,e)}setEditingMode(t,e){this.isEditingInView.set(t,e),this.needUpdate=!0}isEditing(t){return!!this.isEditingInView.get(t)}setSize(t,e){const{THREE:n}=Nd.getInstance();this.width=t,this.height=e;const r=new n.PlaneBufferGeometry(t,e);this.labelMesh.geometry=r}getSize(){return[this.width,this.height]}setDomCSS(t,e,n){if(this.imgElement){const r=this.imgElement.getElementsByTagName("img")[0];let i;i=n?`${n};width:${t.toString()}px;height:${e.toString()}px;`:`width:${t.toString()}px;height:${e.toString()}px;`,r.style.cssText=i,this.width=t,this.height=e,this.isDomElement=!0}}getViewConfigurationByPanoramaId(t,e){const n=this.viewConfigurations.get(t);if(!n)throw new Error("Cannot find view configuration");const r=n.positions.has(e)?n.positions.get(e):n.positions.get(-1);return{visible:n.visibilities.has(e)?n.visibilities.get(e):n.visibilities.get(-1),position:r}}updateViewConfigurationByPanoramaId(t,e,{visible:n,position:r}){const i=this.viewConfigurations.get(t);if(!i)throw new Error("Cannot find view configuration");void 0!==r&&i.positions.set(e,r),void 0!==n&&i.visibilities.set(e,n),this.needUpdate=!0}updateCurrentBindingPanorama(t,e){this.currentPID=t,this.movedToNewPanorama=!0,this.currentPanoramaPosition=e?e.clone():null}setHidden(t){this.hidden=t}}var lb=n("WVt+");class hb{static GetVersion(t,e){let n=window.navigator.userAgent.match(t);return n=n?n[1].split(e):[],{major:parseInt(n[0],10)||0,minor:parseInt(n[1],10)||0,patch:parseInt(n[2],10)||0}}static DetectWeChat(){const t=window.navigator.userAgent.toLowerCase();return!!t&&"micromessenger"===t.toString()}static DetectIOS(){return this.DetectIPhone()||this.DetectIPad()||this.DetectIPod()}static DetectIPad(){const{userAgent:t}=window.navigator;return/iPad/.test(t)}static DetectIPod(){const{userAgent:t}=window.navigator;return/iPod/.test(t)}static DetectIPhone(){const{userAgent:t}=window.navigator;return/iPhone/.test(t)}static DetectAndroid(){return-1!==window.navigator.userAgent.indexOf("Android")}static DetectAndroidMobile(){const{userAgent:t}=window.navigator;return this.DetectAndroid()&&-1!==t.indexOf("Mobile")}}class pb{static getLineCross(t,e,n,r){const i=Math.min(n.x,r.x)>Math.max(t.x,e.x),o=Math.min(n.y,r.y)>Math.max(t.y,e.y),s=Math.min(t.x,e.x)>Math.max(n.x,r.x),a=Math.min(t.y,e.y)>Math.max(n.y,r.y);if(i||o||s||a)return!1;const u=(t,e)=>t.x*e.y-t.y*e.x;return((t,e,n,r)=>{let i={x:t.x-n.x,y:n.y-t.y},o={x:e.x-n.x,y:e.y-n.y},s={x:r.x-n.x,y:r.y-n.y};const a=u(i,s)*u(o,s);return i={x:n.x-t.x,y:n.y-t.y},o={x:r.x-t.x,y:r.y-t.y},s={x:e.x-t.x,y:e.y-t.y},!!(a<=0&&u(i,s)*u(o,s)<=0)})(t,e,n,r)}static calcTurning(t,e=[2,20]){const n=t.length;if(n<2)return[];const r=[],i=(t,e)=>{const{x:n,y:r}=t,{x:i,y:o}=e,s=n*i+r*o,a=n*o-r*i,u=Math.atan2(a,s)/Math.PI*180;return Math.round(u+360)%360};let o=!1,s=0,a=[0,0],u=[0,0],c=[0,0],l=0,h=0;for(let p=1;p<n-1;p++){const n=t[p-1],f=t[p],d=t[p+1],g=i({x:d[0]-f[0],y:d[1]-f[1]},{x:f[0]-n[0],y:f[1]-n[1]}),m=g>=e[0]&&g<=e[1]||g>=360-e[1]&&g<=360-e[0];!o&&m?(o=!0,u=f,s+=g,l=p):o&&m?s+=g:o&&!m?(s+=g,h=p,c=f,a=[(u[0]+c[0])/2,(u[1]+c[1])/2],r.push({point:a,angle:s%360,startTPoint:u,endTPoint:c,startIndex:l,endIndex:h}),o=!1):o||m||(l=h=0,s=0,a=[0,0],u=[0,0],c=[0,0])}return o&&(c=t[n-1],a=[(u[0]+c[0])/2,(u[1]+c[1])/2],r.push({point:a,angle:s%360,startTPoint:u,endTPoint:c,startIndex:l,endIndex:h}),o=!1),r}static chunk(t,e){if(t.length<=0||e<=0)return t;const n=[];for(let r=0;r<t.length;r+=e)n.push(t.slice(r,r+e));return n}}let fb={};function db(){return fb.textPixel||512}function gb(){return fb.imgTextPixel||2048}db(),gb();function mb(t,e,n){return`${t}-${e}-${n}`}const vb=[{normal:new r.Vector3(0,0,1),trans:new r.Vector3(0,0,.5),euler:new r.Euler(0,Math.PI/2,-Math.PI/2),face:0,flipX:!1,flipY:!1,revers:!1},{normal:new r.Vector3(0,0,1),trans:new r.Vector3(0,0,.5),euler:new r.Euler(0,-Math.PI/2,-Math.PI/2),face:1,flipX:!0,flipY:!0,revers:!1},{normal:new r.Vector3(0,0,1),trans:new r.Vector3(0,0,.5),face:2,flipX:!1,flipY:!1,revers:!1},{normal:new r.Vector3(0,0,1),trans:new r.Vector3(0,0,-.5),face:3,flipX:!1,flipY:!0,revers:!0},{normal:new r.Vector3(0,0,1),trans:new r.Vector3(0,0,-.5),euler:new r.Euler(Math.PI/2,0,0),face:4,flipX:!1,flipY:!0,revers:!0},{normal:new r.Vector3(0,0,1),trans:new r.Vector3(0,0,-.5),euler:new r.Euler(-Math.PI/2,0,0),face:5,flipX:!0,flipY:!1,revers:!0}];function yb(t,e,n,r,i){const{THREE:o}=Nd.getInstance(),s=[],a=new o.Vector3(-.5,-.5,0),u=Math.pow(2,t),c=1/u;let l=e%u,h=Math.floor(e/u);n||(l=u-1-l,h=u-1-h),r&&(h=u-1-h),i&&(l=u-1-l);const p=a.x+l*c,f=a.y+h*c,d=p,g=f+c,m=p+c,v=f+c,y=p+c,x=f;return s.push(new o.Vector3(p,f,0)),s.push(new o.Vector3(d,g,0)),s.push(new o.Vector3(m,v,0)),s.push(new o.Vector3(y,x,0)),s}class xb{constructor(t,e,n,r,i,o,s){this.offLineLevel=-1,this.pfid=t,this.textureIndex=e,this.level=n,this.index=r,this.isInCamera=!1,this.rootUrl=i||"",this.offLineLevel=null==o?-1:o,this.offLineRootUrl=s||""}get id(){return mb(this.pfid,this.level,this.index)}get originVertices(){let t=this._originVertices;if(!t){const e=10*this.pfid%10-1,n=vb[e],{revers:r,flipX:i,flipY:o}=n;t=this._originVertices=yb(this.level,this.index,r,i,o)}return t}inCamera(t,e){const{THREE:n}=Nd.getInstance(),r=this.originVertices,i=new n.Vector3(0,0,0);i.applyMatrix4(t),i.project(e),this.centerDis=i.length();for(let n=0;n<r.length;n++){const i=r[n].clone();if(i.applyMatrix4(t),i.project(e),i.x>-1&&i.x<1&&i.y>-1&&i.y<1&&i.z>-1&&i.z<1)return!0}return!1}get targetTid(){return Math.floor(this.pfid)}}class bb{static getXY(t,e){return{x:t%e,y:Math.floor(t/e)}}static getSegment(t){return Math.pow(2,t)}static getCount(t){const e=bb.getSegment(t);return e*e}static getImageInfo2(t,e,n,r){const i=bb.getSegment(n),o=gb()/i;let{x:s,y:a}=bb.getXY(e,i);s=i-1-s,a=i-1-a;return{id:`${t}-${n}-${s}-${a}`,url:`${r}?x-bce-process=image${`/crop,x_${o*s},y_${o*a},w_${o},h_${o}`}${`/resize,m_lfit,w_${db()},h_${db()}`}`}}static getImageInfo(t){const{pfid:e,index:n,level:r,rootUrl:i,offLineLevel:o,offLineRootUrl:s}=t,a=bb.getSegment(r),u=gb()/a;let{x:c,y:l}=bb.getXY(n,a);c=a-1-c,l=a-1-l;let h="";if(r<=o)h=`${s}_${r}_${n}.jpg`;else{const t=`/crop,x_${u*c},y_${u*l},w_${u},h_${u}`,e=`/resize,m_lfit,w_${db()},h_${db()}`;h=`${i}?x-bce-process=image${bb.resizeFirst?`/resize,m_lfit,w_${gb()},h_${gb()}`:""}${t}${e}`}return{id:`${e}-${r}-${c}-${l}`,url:h}}static antiShake(t,e){let n;return(...r)=>{n&&clearTimeout(n),n=setTimeout(()=>{t(...r),n=null},e)}}static throttle(t,e){let n;return(...r)=>{n||(n=setTimeout(()=>{t(...r),n=null},e))}}}bb.updateTextureMax=1,bb.levelMin=0,bb.levelMax=2,bb.resizeFirst=!1,bb.getTileInfoId=mb,bb.getVertices=yb;class _b extends eg{constructor(t,e={width:.3}){super(),this.initialized=!1,this.ready=!0,this.points=[],this.distances=[],this.currentMoveIndex=0,this.options=Object.assign({textureMode:"repeat"},e),e.animateSpeed||(this.options.animateSpeed=.01),"tail"===e.textureMode&&this.createTailArrow(),this.renderPixelLine=e.renderPixelLine||!1,this.init(t)}calcPoints(t,e=.3){const{THREE:n}=Nd.getInstance(),r=t.length;if(r<2)return[];const i=[],o=t.map(t=>[t[0],t[1]]);for(let t=0;t<r;t++){const s=new n.Vector2(...o[t]),a=0===t?null:new n.Vector2(...o[t-1]),u=t===r-1?null:new n.Vector2(...o[t+1]),c=a?(new n.Vector2).subVectors(s,a).normalize():null,l=u?(new n.Vector2).subVectors(u,s).normalize():null,h=l&&c?(new n.Vector2).addVectors(l,c).normalize():null,p=0===t?new n.Vector2(-l.y,l.x):t===r-1?new n.Vector2(-c.y,c.x):new n.Vector2(-h.y,h.x),f=(new n.Vector2).addVectors(s,p.clone().multiplyScalar(-e)),d=(new n.Vector2).addVectors(s,p.clone().multiplyScalar(e));i.push([f.x,f.y,0],[d.x,d.y,0],[p.x,p.y,0])}return i}createTailArrow(){const{THREE:t}=Nd.getInstance(),e=this.options.textureUrl;(new r.TextureLoader).load(e,e=>{const n=this.options.width||.3,r=this.options.strokeWidth?n+2*this.options.strokeWidth:this.options.width,i=this.options.textureSize?this.options.textureSize[0]:r,o=this.options.textureSize?this.options.textureSize[1]:i,s=new t.PlaneGeometry(i,o),a=this.options.color?this.options.color:16777215,u=new t.MeshBasicMaterial({color:a,map:e,transparent:!0,opacity:1,depthTest:!1});u.needsUpdate=!0;const c=new t.Mesh(s,u);c.renderOrder=2,this.tailArrow=c,this.tailArrow.visible=!1,this.add(this.tailArrow)})}orgPoints(t,e=.3){const n=e>1?.01:e,{THREE:r}=Nd.getInstance(),i=t.length,o=this.calcPoints(t,n).map(t=>new r.Vector3(...t)),s=pb.chunk(o,3),a=t.map((t,e)=>({point:t,normal:[s[e][2].x,s[e][2].y],scale:1})),u=t.map(t=>[t[0],t[1]]),c=pb.calcTurning(u);if(!c.length)return a;const l=c.map(e=>{const{startIndex:o,endIndex:a,angle:u}=e,c=u>180?1:0,l=s[o-1][c],h=s[o-1][c],p=(new r.Vector3).subVectors(h,l).normalize().multiplyScalar(n),f=(new r.Vector3).addVectors(h,p),d=(new r.Vector3).subVectors(l,p),g=s[a+1][c],m=i>a+2?s[a+2][c]:s[a][c],v=(new r.Vector3).subVectors(m,g).normalize().multiplyScalar(n),y=(new r.Vector3).addVectors(m,v),x=(new r.Vector3).subVectors(g,v),b=lb.lineString([[d.x,d.y],[l.x,l.y],[h.x,h.y],[f.x,f.y]]),_=lb.lineString([[x.x,x.y],[g.x,g.y],[m.x,m.y],[y.x,y.y]]),w=lb.lineIntersect(b,_);if(!w.features[0])return null;const M=w.features[0].geometry.coordinates,E=new r.Vector2(t[a][0]-t[o-1][0],t[a][1]-t[o-1][1]).normalize().multiplyScalar(n),S=[M[0]-E.x,M[1]-E.y],A=[M[0]+E.x,M[1]+E.y],C=u>180?E.normalize().multiplyScalar(-1):E.normalize().multiplyScalar(1),T=[M[0]-C.y*n,M[1]+C.x*n],P=[M[0]+C.y*n,M[1]-C.x*n],I=lb.featureCollection([lb.point(S),lb.point(P),lb.point(A),lb.point(T),lb.point(S)]);return{hull:lb.convex(I),intersectCrd:M,startIndex:o,endIndex:a}});let h=0,p=0,f=!1;for(;p<i&&l[h];){const[t,e]=s[p],n=l[h].hull,i=l[h].intersectCrd,o=l[h+1]?l[h+1].intersectCrd:null,u=l[h+1]?l[h+1].hull:null,c=lb.booleanWithin(lb.point([t.x,t.y]),n),d=lb.booleanWithin(lb.point([e.x,e.y]),n),g=c||d;if(g&&c){f=!0;const n=new r.Vector3(...i,0);let s=e;o&&u&&lb.booleanWithin(lb.point([e.x,e.y]),u)&&(s=new r.Vector3(o[0],o[1],o[2]));const c=(new r.Vector3).subVectors(e,t).length(),l=(new r.Vector3).subVectors(s,new r.Vector3(n.x,n.y,0)).length(),h=(new r.Vector3).subVectors(s,new r.Vector3(n.x,n.y,0)).normalize();a.splice(p,1,{point:[(n.x+s.x)/2,(n.y+s.y)/2,0],scale:l/c,normal:[h.x,h.y]})}else if(g&&d){f=!0;const n=new r.Vector3(...i,0);let s=t;o&&u&&lb.booleanWithin(lb.point([t.x,t.y]),u)&&(s=new r.Vector3(o[0],o[1],o[2]));const c=(new r.Vector3).subVectors(e,t).length(),l=(new r.Vector3).subVectors(s,new r.Vector3(n.x,n.y,0)).length(),h=(new r.Vector3).subVectors(new r.Vector3(n.x,n.y,0),s).normalize();a.splice(p,1,{point:[(n.x+s.x)/2,(n.y+s.y)/2,0],scale:l/c,normal:[h.x,h.y]})}else f&&(p--,f=!1,h++);p++}return a}init(t){const{THREE:e}=Nd.getInstance(),n=t,r=(this.options.strokeWidth||0)+(this.options.width?this.options.width:.3)/2,i=this.orgPoints(n,r);this.orgedPoints=i,this.points=[];if(n.length>1){const[t,r,i,o]=[n[0],n[1],n[n.length-2],n[n.length-1]],s=new e.Vector3(...t),a=new e.Vector3(...r),u=(new e.Vector3).subVectors(s,a).normalize().multiplyScalar(.05*s.distanceTo(a)),c=s.clone().add(u),l=new e.Vector3(...i),h=new e.Vector3(...o),p=(new e.Vector3).subVectors(l,h).normalize().multiplyScalar(.05*s.distanceTo(a)),f=h.clone().sub(p),d=this.orgedPoints[0],g=this.orgedPoints[this.orgedPoints.length-1];this.orgedPoints.unshift({point:[c.x,c.y,c.z],normal:d.normal,scale:1}),this.orgedPoints.push({point:[f.x,f.y,f.z],normal:g.normal,scale:1}),this.points.push([c.x,c.y,c.z]),this.points.push(...n),this.points.push([f.x,f.y,f.z])}this.distances=[-.1];for(let t=1,n=this.points.length,r=new e.Vector3(...this.points[0]),i=new e.Vector3;t<n;t+=1)i.set(...this.points[t]),this.distances.push(1===t?0:this.distances[t-1]+i.distanceTo(r)),r.copy(i);this.bufferGeometry=new e.BufferGeometry;let[o,s,a]=this.points[0],u=0;const c=[];for(let t=0;t<this.orgedPoints.length;t+=1){const[e,n,r]=this.orgedPoints[t].point,[i,l]=this.orgedPoints[t].normal,h=this.orgedPoints[t].scale;let p=e-o,f=n-s,d=r-a;const g=Math.sqrt(p*p+f*f+d*d);p/=g,f/=g,d/=g,u+=3*g,this.options.strokeWidth?(c.push(e,n,r,-2,u,this.distances[t],i,l,h),c.push(e,n,r,-1,u,this.distances[t],i,l,h),c.push(e,n,r,1,u,this.distances[t],i,l,h),c.push(e,n,r,2,u,this.distances[t],i,l,h)):(c.push(e,n,r,-1,u,this.distances[t],i,l,h),c.push(e,n,r,1,u,this.distances[t],i,l,h)),o=e,s=n,a=r}const l=new Float32Array(c),h=this.options.strokeWidth?4:2,p=new e.InterleavedBuffer(l,9),f=new e.InterleavedBufferAttribute(p,4,0,!1);this.bufferGeometry.setAttribute("last",f);const d=new e.InterleavedBufferAttribute(p,4,9*h,!1);this.bufferGeometry.setAttribute("current",d);const g=new e.InterleavedBufferAttribute(p,4,9*h*2,!1);this.bufferGeometry.setAttribute("next",g);const m=new e.InterleavedBufferAttribute(p,1,9*h+4,!1);this.bufferGeometry.setAttribute("texoff",m);const v=new e.InterleavedBufferAttribute(p,1,9*h+5,!1);this.bufferGeometry.setAttribute("progress",v);const y=new e.InterleavedBufferAttribute(p,2,9*h+6,!1);this.bufferGeometry.setAttribute("normalVec",y);const x=new e.InterleavedBufferAttribute(p,1,9*h+8,!1);this.bufferGeometry.setAttribute("normalScale",x);const b=new e.InterleavedBuffer(l.slice(9*h,c.length-9*h),9),_=new e.InterleavedBufferAttribute(b,4,0);this.bufferGeometry.setAttribute("position",_),this.bufferGeometry.computeBoundingBox(),this.bufferGeometry.computeBoundingSphere(),this.bufferGeometry.computeVertexNormals();let w=[];if(this.options.strokeWidth){const t=[0,1,4,1,4,5,1,2,5,2,5,6,2,3,6,3,6,7];for(let e=4;e<c.length/9-8;e+=4){const n=e/4-1,r=t.map(t=>t+4*n);w=[...w,...r]}}else for(let t=2;t<c.length/9-4;t+=2)w.push(t-2,t-1,t),w.push(t,t-1,t+1);this.bufferGeometry.setIndex(w);const M=new e.Vector2(1,1),E=this.options.color?new $d.a(this.options.color):new $d.a("rgb(255, 255, 255)").alpha(0),S=this.options.strokeColor?new $d.a(this.options.strokeColor):new $d.a("rgb(255, 255, 255)").alpha(0);if(this.uniforms={stripTexture:{type:"t",value:null},fillColor:{type:"v4",value:new e.Vector4(E.red()/255,E.green()/255,E.blue()/255,E.alpha())},strokeColor:{type:"v4",value:new e.Vector4(S.red()/255,S.green()/255,S.blue()/255,S.alpha())},width:{type:"f",value:this.options.width||.3},strokeWidth:{type:"f",value:this.options.strokeWidth||.1},renderPixelLine:{type:"f",value:this.renderPixelLine?1:0},fillOpacity:{type:"f",value:this.options.fillOpacity||.8},resolution:{type:"v2",value:M},currentDistance:{type:"f",value:this.options.current||0},texOffset:{type:"f",value:0},fullLength:{type:"f",value:this.distances[this.distances.length-1]},viewDistance:{type:"f",value:null===this.options.viewDistance||void 0===this.options.viewDistance?15:this.options.viewDistance},gradientDistance:{type:"f",value:this.options.gradientDistance||4},gradientEnabled:{value:this.options.gradientEnabled||!1}},this.material=new e.ShaderMaterial({fragmentShader:_b.FragmentShader,vertexShader:_b.VertexShader,uniforms:this.uniforms,depthTest:!1,side:e.DoubleSide,wireframe:!1,transparent:!0,opacity:1,blending:e.NormalBlending,blendEquation:e.AddEquation,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor}),this.options.textureUrl&&"repeat"===this.options.textureMode)(new e.TextureLoader).load(this.options.textureUrl,t=>{t.wrapS=e.RepeatWrapping,t.wrapT=e.RepeatWrapping,t.generateMipmaps=!0,this.uniforms.stripTexture.value=t,this.needsUpdate=!0});else if(this.options.textureUrl&&"tail"===this.options.textureMode){const t=this.distances[this.distances.length-1];this.updateTailArrowPos(t)}this.mesh=new e.Mesh(this.bufferGeometry,this.material),this.mesh.renderOrder=1e3,this.add(this.mesh)}setContainer(t){jd.GetEnv()!==Fd.Miniapp&&this.resize(t.clientWidth,t.clientHeight)}resize(t,e){if(this.viewWidth===t&&this.viewHeight===e)return;const n=new r.Vector2(t,e);this.uniforms.resolution.value=n,this.needsUpdate=!0,this.viewWidth=t,this.viewHeight=e}getBestView(t,e,n){let r=this.getPointOnDistance(e+.2).point,i=t;const{THREE:o}=Nd.getInstance();let s=e+1;for(;s<e+10;s+=1){const t=this.getPointOnDistance(s),e=(new o.Vector3).subVectors(t.point,r),n=(new o.Vector3).subVectors(r,i);if(o.MathUtils.radToDeg(e.angleTo(n))>30){r=this.getPointOnDistance(s+.5).point,i=t.point;break}}let a=0;for(let t=s;t<n;t++){const n=this.getPointOnDistance(t),s=(new o.Vector3).subVectors(n.point,r),u=(new o.Vector3).subVectors(r,i),c=o.MathUtils.radToDeg(s.angleTo(u));if(c>32&&t-e>10){a=t;break}if(c>20&&t-e>15){a=t;break}}return a-e}getPointOnDistance(t){const{THREE:e}=Nd.getInstance();let n=0;const{distances:r,points:i}=this;let o=i.length-1,s=-1;for(;n<o-1;)if(s=Math.floor((n+o)/2),r[s]>t)o=s;else{if(!(r[s]<t)){n=s;break}n=s}if(s=n,s>-1){const n=new e.Vector3(...this.points[s]);if(s===this.points.length-1||t<=0)return{point:n,index:s+1};const r=this.distances[s],i=new e.Vector3(...this.points[s+1]),o=this.distances[s+1]-r,a=i.clone().sub(n);return{point:n.clone().add(a.multiplyScalar((t-r)/o)),index:s+1}}throw new Error("Cannot find point on distance "+t)}getNearestPoint(t,e=0){const{THREE:n}=Nd.getInstance(),r=this.distances[this.distances.length-1];let i,o,s,a,u,c,l=8,h=new n.Vector3,p=0,f=1/0,d=-1;for(let n,i,o=e;o<=r;o+=l)n=this.getPointOnDistance(o),i=t.distanceTo(n.point),i<f&&(h=n.point,p=o,f=i,d=n.index);for(l/=2;l>.1;)s=p-l,u=t.distanceTo(i=this.getPointOnDistance(s).point),a=p+l,c=t.distanceTo(o=this.getPointOnDistance(a).point),s>=0&&u<f?(h=i,p=s,f=u):a<=r&&c<f?(h=o,p=a,f=c):l/=2;return{point:h,distance:p,index:d}}getPathWithScope(t,e){if(t>=e){const t=this.getPointOnDistance(e).point;return[[t.x,t.y,0]]}let n=this.distances.length-1,r=0;for(;n>=0&&this.distances[n]>t;)n-=1;for(;r<this.distances.length&&this.distances[r]<e;)r+=1;const i=this.getPointOnDistance(t).point,o=this.getPointOnDistance(e).point;return[[i.x,i.y,0],...this.points.slice(n+1,r-n-1),[o.x,o.y,0]]}getPathBaseStartPoint(t){const e=this.getPointOnDistance(t).point;for(let n=0;n<this.distances.length;n+=1)if(this.distances[n]>t)return[[e.x,e.y,0],...this.points.slice(n)];return this.points.slice(this.distances.length-1)}update(){const t=new tg(this);return!this.initialized&&this.ready?(this.initialized=!0,t.needUpdate=!0):this.needsUpdate&&(t.needUpdate=!0,this.needsUpdate=!1),this.options.animateEnabled&&(this.uniforms.texOffset.value-=this.options.animateSpeed,t.needUpdate=!0),this.initialized&&!this.parent&&(t.shouldPlaceElement=!0),t}dispose(){this.parentOverlay&&this.parentOverlay.removePath(this),super.dispose(),this.remove(this.mesh),this.material.dispose(),this.bufferGeometry.dispose()}setCurrent(t){this.uniforms.currentDistance.value=t,this.needsUpdate=!0}getLength(){return this.distances[this.distances.length-1]}setCurrentIndex(t){this.currentMoveIndex=t;const e=this.distances[t+1];this.uniforms.currentDistance.value=e,this.needsUpdate=!0}getCurrent(){return this.uniforms.currentDistance.value}getCurrentIndex(){return this.currentMoveIndex}setViewDistance(t){this.uniforms.viewDistance.value=t;const e=t+this.uniforms.currentDistance.value;if(this.options.textureUrl&&"tail"===this.options.textureMode){if(!this.tailArrow)return void setTimeout(()=>{this.setViewDistance(t)},1e3);this.updateTailArrowPos(e)}}updateTailArrowPos(t){if(!this.tailArrow)return void setTimeout(()=>{this.updateTailArrowPos(t)},1e3);this.tailArrow.visible=!0;const{index:e}=this.getPointOnDistance(t),n=this.orgedPoints[e],r=n.point[0],i=n.point[1],o=n.point[2],s=[-n.normal[1],n.normal[0]],a=Math.atan2(s[1],s[0])+Math.PI/2;this.tailArrow.position.set(r,i,o),this.tailArrow.rotation.z=a,this.needsUpdate=!0}setWidth(t){this.uniforms.width.value!==t&&(this.uniforms.width.value=t,this.needsUpdate=!0)}setColor(t){if(null==t)return;const e=new $d.a(t),n=this.uniforms.fillColor.value,{THREE:r}=Nd.getInstance(),i=new r.Vector4(e.red(),e.green(),e.blue(),e.alpha());i.equals(n)||(this.uniforms.fillColor.value=i,this.needsUpdate=!0)}getViewDistance(){return this.uniforms.viewDistance.value}setParentOverlay(t){this.parentOverlay=t}}_b.VertexShader="\n attribute vec4 last, current, next;\n attribute vec2 normalVec;\n attribute float normalScale;\n attribute float texoff;\n attribute float progress;\n\n varying vec2 texcoord;\n varying float vProgress;\n varying float isBorder;\n\n uniform float width;\n uniform float texOffset;\n uniform float strokeWidth;\n uniform float renderPixelLine;\n uniform vec2 resolution;\n\n float pi = 3.141592653589793;\n float fwidth = width;\n float swidth = strokeWidth;\n\n vec4 transform(vec3 coord){\n return projectionMatrix * modelViewMatrix * vec4(coord, 1.0);\n }\n\n vec2 project(vec4 device) {\n vec3 device_normal = device.xyz / device.w;\n vec2 clip_pos = (device_normal * 0.5 + 0.5).xy;\n return clip_pos * resolution;\n }\n\n vec4 unproject(vec2 screen, float z, float w) {\n vec2 clip_pos = screen / resolution;\n vec2 device_normal = clip_pos * 2.0 - 1.0;\n return vec4(device_normal * w, z, w);\n }\n\n // 计算系数: 0,0,0 到 0,1,0 对应的屏幕坐标距离 越大, coefficient越大\n float calcCoefficient() {\n vec3 p1 = vec3(0, 0, 0);\n vec2 sp1 = project(transform(p1.xyz));\n vec3 p2 = vec3(0, 1, 0);\n vec2 sp2 = project(transform(p2.xyz));\n // 计算屏幕坐标的距离\n float dist = distance(sp1, sp2);\n return dist * 10.0 / width;\n }\n\n void main(){\n vec2 sLast; // screenLast\n vec2 sNext; // screenNext\n vec2 sCurrent; // screenCurrent\n vec2 normal1; // normal1\n vec2 normal2; // normal2\n vec2 normal; // 当前normal\n vec4 dCurrent; //\n\n float coefficient = 10.0;\n float off = 1.0;\n if (current.w < 0.0 ) {\n off = -1.0;\n }\n vec4 position = vec4(0, 0, 0, 0);\n vec3 pos;\n\n float offsetW = fwidth / 2.0 * normalScale;\n isBorder = -1.0;\n if (abs(current.w) > 1.0) {\n offsetW = swidth + (fwidth / 2.0) * normalScale;\n isBorder = 1.0;\n }\n if (renderPixelLine < 1.0) {\n // 3d 中\n vec2 dir = vec2(normalVec.x, normalVec.y)*off;\n float factor = 0.6 / fwidth * 0.2;\n pos = vec3(current.xy + dir * offsetW, 0.0);\n texcoord = vec2(off*0.5+0.5, texoff * factor + texOffset);\n vProgress = progress;\n gl_Position = transform(pos);\n } else {\n // vec2 dir = vec2(normalVec.x, normalVec.y)*off;\n // pos = vec3(current.xy + dir * offsetW, 0.0);\n // texcoord = vec2(off*0.5+0.5, texoff*0.2 + texOffset);\n // vProgress = progress;\n // gl_Position = transform(pos);\n\n coefficient = calcCoefficient();\n sLast = project(transform(last.xyz)); // last的屏幕坐标\n sNext = project(transform(next.xyz)); // next的屏幕坐标\n\n dCurrent = transform(current.xyz);\n sCurrent = project(dCurrent); // current的屏幕坐标\n\n normal1 = normalize(sLast - sCurrent);\n vec2 normal2 = normalize(sCurrent - sNext);\n normal = normalize(normal1 + normal2);\n texcoord = vec2(off*0.5+0.5, texoff* 0.03 * coefficient + texOffset);\n vProgress = progress;\n\n vec2 dir = vec2(-normal.y, normal.x) * off;\n float cosAngle = abs(dot(dir, -normal1)); // cos 45 基本 为 0.79 得到的是弧度值\n float x = 90.0 - acos(cosAngle) * 180.0 / pi; // 得到角度 90 - x 则为需要 20 / length = cos(x)\n float divideBy = cos(x / 180.0 * pi);\n if (abs(divideBy) < 0.6) {\n float positiveNum = divideBy > 0.0 ? 1.0 : -1.0;\n divideBy = 0.6 * positiveNum;\n }\n pos = vec3((sCurrent + offsetW / divideBy * dir).xy, 0.0);\n position = unproject(pos.xy, 0.0, 1.0);\n gl_Position = position;\n }\n\n // texcoord = vec2(off*0.5+0.5, texoff* 0.03 * coefficient + texOffset);\n // vProgress = progress;\n\n // vec2 dir = vec2(-normal.y, normal.x) * off;\n // float cosAngle = abs(dot(dir, -normal1)); // cos 45 基本 为 0.79 得到的是弧度值\n // float x = 90.0 - acos(cosAngle) * 180.0 / pi; // 得到角度 90 - x 则为需要 20 / length = cos(x)\n // float divideBy = cos(x / 180.0 * pi);\n\n // vec4 position = vec4(0, 0, 0, 0);\n // vec3 pos;\n\n // if (renderPixelLine < 1.0) {\n // pos = current.xyz + vec3(dir * offsetW, 0.0);\n // position = transform(pos);\n // } else {\n // // 计算 dir 和 normal1 的夹角 , 要 叠加的长度 是 offsetW * dir\n // pos = vec3((sCurrent + offsetW / divideBy * dir).xy, 0.0);\n // position = unproject(pos.xy, 0.0, 1.0);\n // }\n\n // gl_Position = position;\n }\n ",_b.FragmentShader="\n uniform sampler2D stripTexture;\n uniform float currentDistance;\n uniform float fullLength;\n uniform float viewDistance;\n uniform float gradientDistance;\n uniform vec4 fillColor;\n uniform vec4 strokeColor;\n uniform bool gradientEnabled;\n uniform float renderPixelLine;\n uniform float fillOpacity;\n\n varying vec2 texcoord;\n varying float vProgress;\n varying float isBorder;\n\n float opacity = 1.0;\n\n void main(){\n vec4 texColor = texture2D(stripTexture, texcoord);\n\n float alpha = fillOpacity;\n float cur = currentDistance;\n float grad = gradientDistance;\n float view = viewDistance;\n\n if (gradientEnabled) {\n if (vProgress < cur) {\n alpha = 0.0;\n } else {\n if (vProgress > cur + view) {\n alpha = 0.0;\n } else {\n if (fullLength <= cur + view) {\n view = fullLength - cur;\n if (view < 2.0 * grad) {\n grad = view * 0.5;\n }\n }\n\n if (vProgress > cur + grad) {\n alpha = fillOpacity;\n if (vProgress > cur + view - grad) {\n alpha = abs(cur + view - vProgress) / grad * fillOpacity;\n }\n } else {\n alpha = abs(vProgress - cur) / grad * fillOpacity;\n }\n }\n }\n } else if (renderPixelLine == 1.0) {\n if (vProgress < cur) {\n alpha = 0.0;\n }\n }\n if (isBorder > -0.99) {\n gl_FragColor = vec4(strokeColor.rgb, opacity * alpha * strokeColor.a);\n } else {\n gl_FragColor = vec4((fillColor * (1.0 - texColor.a) + texColor * texColor.a).rgb, opacity * alpha * (fillColor.a * (1.0 - texColor.a) + texColor.a));\n }\n }\n ";class wb{constructor(t,e){this.values=new Map,this.capacity=t,this.totalCost=0,this.costCallback=e}get(t,e){let n;return this.values.has(t)?(n=this.values.get(t),n&&(this.values.delete(t),this.values.set(t,n))):e&&(n=e(t),n&&this.put(t,n)),n}put(t,e,n,r=!1){let i=!1;if(this.totalCost>=this.capacity){if(r)return i;const t=this.values.keys().next().value,e=this.values.get(t);if(e){const r=void 0===this.costCallback?1:this.costCallback(e);this.totalCost-=r,n&&n(t,e),this.values.delete(t)}i=!0}if(this.values.has(t)){let n=1;const r=this.values.get(t);r&&this.costCallback&&(n=this.costCallback(r));const i=void 0===this.costCallback?1:this.costCallback(e);this.values.set(t,e),this.totalCost+=i-n}else{this.values.set(t,e);const n=void 0===this.costCallback?1:this.costCallback(e);this.totalCost+=n}return i}recycle(t,e){let n=!1;const r=this.values.get(t);if(r){n=!0;const i=void 0===this.costCallback?1:this.costCallback(r);this.totalCost-=i,e&&e(t,r),this.values.delete(t)}return n}clear(t){this.values.forEach((e,n)=>{e&&t(n,e)}),this.totalCost=0,this.values.clear()}getCapacity(){return this.capacity}getTotalCost(){return this.totalCost}}var Mb=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};class Eb{constructor(t){const{THREE:e}=Nd.getInstance();this.textureLoader=new e.TextureLoader,this.textureCache=new wb(t),this.workingTasks=new Map}static disposeAll(){this.hdFaceTexturesCache.dispose(),this.ldFaceTexturesCache.dispose()}static get hdFaceTexturesCache(){return Eb.sharedHdFaceTextureCache||(Eb.sharedHdFaceTextureCache=new Eb(32)),Eb.sharedHdFaceTextureCache}static get ldFaceTexturesCache(){return Eb.sharedLdFaceTextureCache||(Eb.sharedLdFaceTextureCache=new Eb(32)),Eb.sharedLdFaceTextureCache}dispose(){this.textureCache.clear((t,e)=>{e.dispose()})}loadTexture(t,e=!0){return Mb(this,void 0,void 0,(function*(){const n=this.textureCache.get(t);if(n)return n;let r=this.workingTasks.get(t);return r||(r=new Promise((n,r)=>{this.textureLoader.load(t,r=>{this.textureCache.put(t,r,(t,e)=>{e.dispose()},!e),this.workingTasks.delete(t),n(r)},()=>{},e=>{kd.emit("error",`Loading '${t}' failed.`),this.workingTasks.delete(t),r(e)})}),this.workingTasks.set(t,r)),r}))}preloadTextures(t,e){return Mb(this,void 0,void 0,(function*(){const n=e>t.length?t.length:e,r=t.map((t,n)=>{if(t)return this.loadTexture(t,n<e)}),i=[];for(let t=0;t<n;t+=1){const e=r[t];e&&i.push(e)}return Promise.all(i)}))}recycleTexture(t){return this.textureCache.recycle(t,(t,e)=>{e.dispose()})}getCapacity(){return this.textureCache.getCapacity()}getTotalCost(){return this.textureCache.getTotalCost()}}var Sb=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};class Ab{constructor(t){this.cubeTextureCache=new wb(t),this.workingTasks=new Map}static disposeAll(){this.sharedInstance.dispose()}dispose(){this.cubeTextureCache.clear((t,e)=>{e.dispose()})}loadCubeTexture(t,e,n){return Sb(this,void 0,void 0,(function*(){const r=this.cubeTextureCache.get(t[0]);if(r)return r;const{THREE:i}=Nd.getInstance();let o=this.workingTasks.get(t[0]);return o||(o=new Promise(r=>Sb(this,void 0,void 0,(function*(){const o=(yield Eb.ldFaceTexturesCache.preloadTextures(t,t.length)).map(t=>t.image),s=new i.CubeTexture(o);s.needsUpdate=!0,!0===n&&t.forEach(t=>{Eb.ldFaceTexturesCache.recycleTexture(t)}),this.cubeTextureCache.put(t[0],s,(t,e)=>{e.dispose()},!e),this.workingTasks.delete(t[0]),r(s)}))),this.workingTasks.set(t[0],o)),o}))}preloadCubeTextures(t,e,n){return Sb(this,void 0,void 0,(function*(){const r=e>t.length?t.length:e,i=t.map((t,e)=>{if(t)return n?this.loadCubeTexture(t,e<r,n[e]):this.loadCubeTexture(t,e<r)}),o=[];for(let t=0;t<r;t+=1){const e=i[t];e&&o.push(e)}return Promise.all(o)}))}recycleCubeTexture(t){this.cubeTextureCache.recycle(t[0],(t,e)=>{e.dispose()})}getCapacity(){return this.cubeTextureCache.getCapacity()}}Ab.sharedInstance=new Ab(3);var Cb=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};class Tb extends eg{constructor(t,e,n,r,i=[],o,s,a,u,c,l=!1){super();const{THREE:h}=Nd.getInstance();this.pid=t,this.seqID=e,this.highTextureURLs=o||[],this.textureURLs=n,this.useLowTextureURLsOnly=!!s,this.tiledTextureURLRoot=a,this.neighborPanoramaIDs=i,this.viewConfigurations=new Map,this.panoViews=new Set,this.initialized=!1,this.needsUpdate=!1,this.legacyMode=l;const p=new h.BoxBufferGeometry(2,2,2);this.wireFrame=new h.LineSegments(new h.EdgesGeometry(p),new h.LineBasicMaterial({color:16711680})),this.wireFrame.material.visible=!1,this.wireFrame.renderOrder=100,this.add(this.wireFrame);const f=new h.SphereBufferGeometry(1,60,40);if(f.scale(1,-1,1),f.rotateY(-90*Math.PI/180),this.sphereMesh=new h.Mesh(f),this.sphereMesh.visible=!1,this.sphereMesh.renderOrder=150,this.add(this.sphereMesh),this.isPlayingVideo=!1,this.videoCanvas=null,this.videoContentType="mp4",this.legacyMode){const t="\n varying vec3 v_position;\n void main(){\n v_position = position;\n v_position.y = v_position.y * -1.0;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",e="\n uniform samplerCube tCube;\n varying vec3 v_position;\n void main(){\n gl_FragColor = textureCube(tCube, v_position);\n }",n={tCube:{type:"t",value:null}};this.uniforms=n,this.material=new h.ShaderMaterial({fragmentShader:e,vertexShader:t,uniforms:n,depthTest:!1,side:h.BackSide}),this.skyBox=new h.Mesh(new h.SphereBufferGeometry(2,32,32)),this.skyBox.frustumCulled=!1,this.skyBox.material=this.material,this.skyBox.renderOrder=100,this.add(this.skyBox),this.updateTexture()}else{const t="\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",e="\n uniform sampler2D tFaceTexture;\n uniform vec2 uvScalar;\n uniform vec2 uvOffset;\n uniform vec4 blendColor;\n varying vec2 vUv;\n void main(){\n vec2 UV = vUv * uvScalar + uvOffset;\n vec4 texColor = texture2D(tFaceTexture, vec2(UV.s, 1.0 - UV.t));\n gl_FragColor = (1.0 - blendColor.a) * texColor + blendColor.a * blendColor;\n // gl_FragColor = vec4(vUv, 0.0, 1.0);\n }";[this.faceGridRows,this.faceGridCols]=r;const n=2/r[1],i=2/r[0];this.faceGridsStates=[],this.faceGridTextureCacheKeys=[],this.panoViews=new Set,this.faceGridsMaterials=[],this.faceGridsUniformses=[],this.skyBoxFaceGrids=[],this.gridCenters=[];for(let o=0;o<6;o++){const s=[],a=[],u=[],c=[],l=[],p=[];for(let o=0;o<r[0];o++){const f=[];for(let p=0;p<r[1];p++){const d=o*r[1]+p;s[d]=0,a[d]="",u[d]={tFaceTexture:{type:"t",value:null},uvScalar:{type:"v2",value:new h.Vector2(1,1)},uvOffset:{type:"v2",value:new h.Vector2(0,0)},blendColor:{type:"v4",value:new h.Vector4(0,0,0,0)}},c[d]=new h.ShaderMaterial({fragmentShader:e,vertexShader:t,uniforms:u[d],depthTest:!1,side:h.BackSide});const g=new h.PlaneBufferGeometry(n,i),m=new h.Mesh(g,c[d]);l[d]=m,m.visible=!0,m.frustumCulled=!1,m.material=c[d],m.renderOrder=100,this.add(m),f[p]=new h.Vector4(0,0,0,1)}p[o]=f}this.faceGridsStates[o]=s,this.faceGridTextureCacheKeys[o]=a,this.faceGridsUniformses[o]=u,this.faceGridsMaterials[o]=c,this.skyBoxFaceGrids[o]=l,this.gridCenters[o]=p}const o=new h.Matrix4,s=new h.Matrix4;for(let t=0;t<r[0];t++)for(let e=0;e<r[1];e++){const s=t*r[1]+e;for(let r=0;r<6;r++)o.makeTranslation(n/2-1+n*e,i/2-1+i*t,0),this.skyBoxFaceGrids[r][s].applyMatrix4(o),this.gridCenters[r][t][e].applyMatrix4(o)}for(let t=0;t<r[0];t++)for(let e=0;e<r[1];e++){const n=t*r[1]+e;o.makeTranslation(1,0,0),s.makeRotationY(Math.PI/2),this.skyBoxFaceGrids[0][n].applyMatrix4(s),this.skyBoxFaceGrids[0][n].applyMatrix4(o),this.gridCenters[0][t][e].applyMatrix4(s).applyMatrix4(o),o.makeTranslation(-1,0,0),s.makeRotationY(-Math.PI/2),this.skyBoxFaceGrids[1][n].applyMatrix4(s),this.skyBoxFaceGrids[1][n].applyMatrix4(o),this.gridCenters[1][t][e].applyMatrix4(s).applyMatrix4(o),o.makeTranslation(0,-1,0),s.makeRotationX(Math.PI/2),this.skyBoxFaceGrids[2][n].applyMatrix4(s),this.skyBoxFaceGrids[2][n].applyMatrix4(o),this.gridCenters[2][t][e].applyMatrix4(s).applyMatrix4(o),o.makeTranslation(0,1,0),s.makeRotationX(-Math.PI/2),this.skyBoxFaceGrids[3][n].applyMatrix4(s),this.skyBoxFaceGrids[3][n].applyMatrix4(o),this.gridCenters[3][t][e].applyMatrix4(s).applyMatrix4(o),o.makeTranslation(0,0,1),s.makeTranslation(0,0,0),this.skyBoxFaceGrids[4][n].applyMatrix4(s),this.skyBoxFaceGrids[4][n].applyMatrix4(o),this.gridCenters[4][t][e].applyMatrix4(s).applyMatrix4(o),o.makeTranslation(0,0,-1),s.makeRotationY(Math.PI),this.skyBoxFaceGrids[5][n].applyMatrix4(s),this.skyBoxFaceGrids[5][n].applyMatrix4(o),this.gridCenters[5][t][e].applyMatrix4(s).applyMatrix4(o)}}u&&this.position.copy(u),c&&this.quaternion.copy(c),this.baseQuaternion=(new h.Quaternion).copy(this.quaternion),this.additionalQuaternion=new h.Quaternion;const d=this.quaternion._onChangeCallback;this.quaternion._onChange(()=>{d();if((new h.Quaternion).multiplyQuaternions(this.baseQuaternion,this.additionalQuaternion).equals(this.quaternion))return;this.baseQuaternion=this.quaternion.clone();const{x:t,y:e,z:n,w:r}=(new h.Quaternion).multiplyQuaternions(this.baseQuaternion,this.additionalQuaternion);this.quaternion.set(t,e,n,r),this.needsUpdate=!0});const g=this.rotation._onChangeCallback;this.rotation._onChange(()=>{g();const t=this.additionalQuaternion.clone().invert();this.baseQuaternion=this.quaternion.clone().multiply(t)}),this.eventListeners={onPanoramaSelected:t=>{this.isSelected=t===this,this.isSelected&&this.emit(Ud.PANORAMA_SELECTED,this.pid)},onEnded:()=>{}},kd.on(zd.ELEMENT_SELECTED,this.eventListeners.onPanoramaSelected)}setTexture(t){this.uniforms.tCube.value=t,this.needsUpdate=!0,this.panoramaLoaded||this.emit(Ud.DID_LOAD_PANORAMA,this.pid),this.panoramaLoaded=!0}pauseVideo(){if("ts"===this.videoContentType)this.mpegVideoPlayer&&this.mpegVideoPlayer.pause();else{const t="pano_vid_"+this.pid;if(this.video=this.video||document.getElementById(t),!this.video)return;this.video.pause()}}resumeVideo(){return Cb(this,void 0,void 0,(function*(){if("ts"===this.videoContentType)this.mpegVideoPlayer&&this.mpegVideoPlayer.play();else{const t="pano_vid_"+this.pid;if(this.video=this.video||document.getElementById(t),!this.video)return;yield this.video.play()}}))}stopVideo(){if(this.sphereMesh.visible=!1,"ts"===this.videoContentType){this.mpegVideoPlayer&&(this.mpegVideoPlayer.stop(),this.mpegVideoPlayer.destroy(),this.mpegVideoPlayer=null);const t=this.sphereMesh.material.map;t&&t.dispose(),this.sphereMesh.material.dispose(),this.videoCanvas=null}else{const t="pano_vid_"+this.pid;this.video=this.video||document.getElementById(t);const e=this.sphereMesh.material.map;e&&e.dispose(),this.sphereMesh.material.dispose(),this.video&&(this.video.pause(),this.video.removeAttribute("src"),this.video.load(),this.video=null)}this.eventListeners.onEnded&&this.eventListeners.onEnded(),this.isPlayingVideo=!1,this.needsUpdate=!0}playVideo(t,e,n,r="mp4",i=[2048,2048]){const{onReadyToPlay:o,onEnded:s,onPrepareToPlay:a}=n||{};this.videoContentType=r;const{THREE:u}=Nd.getInstance();if(this.eventListeners.onEnded=s||(()=>{}),"ts"!==this.videoContentType){const n="pano_vid_"+this.pid;this.video=document.getElementById(n),this.video||(this.video=document.createElement("video"),this.video.id=n,this.video.setAttribute("webkit-playsinline","true"),this.video.setAttribute("x5-playsinline","true"),this.video.setAttribute("playsinline","true"),this.video.setAttribute("crossorigin","anonymous")),this.video.src=t,this.video.loop=!!e,this.video.addEventListener("playing",()=>{this.sphereMesh.visible=!0,this.needsUpdate=!0,o&&o(this.video),this.isPlayingVideo=!0}),this.video.addEventListener("ended",()=>{this.stopVideo()}),this.video.addEventListener("play",()=>{this.needsUpdate=!0,a&&a(this.video)}),this.video.play();const r=new u.VideoTexture(this.video);return r.needsUpdate=!0,this.sphereMesh.material=new u.MeshBasicMaterial({map:r,transparent:!1,depthTest:!1,depthWrite:!1}),this.video}{if(!JSMpeg||!JSMpeg.Player)throw new Error("JSMpeg is needed. Please get JSMpeg from https://github.com/phoboslab/jsmpeg");this.videoCanvas||(this.videoCanvas=document.createElement("canvas"),[this.videoCanvas.width,this.videoCanvas.height]=i),this.mpegVideoPlayer=new JSMpeg.Player(t,{canvas:this.videoCanvas,loop:e,autoplay:!1,disableGl:!1,onSourceEstablished:()=>{this.needsUpdate=!0,a&&a()},onPlay:()=>{this.sphereMesh.visible=!0,this.needsUpdate=!0,o&&o(),this.isPlayingVideo=!0},onPause:()=>{},onStalled:()=>{},onEnded:()=>{this.stopVideo()},chunkSize:8388608,videoBufferSize:4194304,decodeFirstFrame:!1,preserveDrawingBuffer:!1});const n=new u.CanvasTexture(this.videoCanvas);n.needsUpdate=!0,hb.DetectIOS()&&(n.flipY=!1),this.sphereMesh.material=new u.MeshBasicMaterial({map:n,transparent:!1,depthTest:!1,depthWrite:!1}),this.mpegVideoPlayer.source.established=!1,this.mpegVideoPlayer.source.loadedSize=0,this.mpegVideoPlayer.demuxer.startTime=0,this.mpegVideoPlayer.demuxer.currentTime=0,this.mpegVideoPlayer.demuxer.bits=null,this.mpegVideoPlayer.demuxer.leftoverBytes=null,this.mpegVideoPlayer.audioOut.resetEnqueuedTime(),this.mpegVideoPlayer.audioOut.unlock(),this.mpegVideoPlayer.seek(0),this.mpegVideoPlayer.play()}return null}getIntersectedTiles(t){if(!t)return{hdTiles:[],ldTiles:[]};const{THREE:e}=Nd.getInstance();this.updateMatrixWorld(),t.updateMatrixWorld();const n=t.position.clone(),r=this.gridCenters.map(t=>t.map(t=>t.map(t=>{const r=t.clone().applyMatrix4(this.matrixWorld);return new e.Vector3(r.x,r.y,r.z).sub(n).normalize()}))),i=new e.Vector3(0,0,-1).applyQuaternion(t.quaternion),o=[],s=[],a=Math.SQRT1_2;for(let t=0;t<6;t++)for(let e=0;e<this.faceGridRows;e++)for(let n=0;n<this.faceGridCols;n++){const u=r[t][e][n].dot(i);u>=a?o.push([t,e,n,u]):s.push([t,e,n,u])}return this.isPlayingVideo?{hdTiles:[],ldTiles:s}:{hdTiles:o,ldTiles:s}}setFaceTexture(t,e,n,r){const{THREE:i}=Nd.getInstance(),o=t[0],s=t[1],a=t[2],u=s*this.faceGridCols+a;this.faceGridsUniformses[o][u].tFaceTexture.value=e;const{uvScalar:c,uvOffset:l,blendColor:h}=n||{};this.faceGridsUniformses[o][u].uvScalar.value=c||new i.Vector2(1,1),this.faceGridsUniformses[o][u].uvOffset.value=l||new i.Vector2(0,0),this.faceGridsUniformses[o][u].blendColor.value=h||new i.Vector4(0,0,0,0),r&&(this.faceGridTextureCacheKeys[o][u]=r),this.needsUpdate=!0}updateTexture(t){return Cb(this,void 0,void 0,(function*(){if(this.legacyMode){t&&(this.textureURLs=t);const e=yield Ab.sharedInstance.loadCubeTexture(this.textureURLs);this.setTexture(e)}else{for(let t=0;t<6;t++)for(let e=this.faceGridCols*this.faceGridRows-1;e>=0;e--)this.faceGridsStates[t][e]=0;t&&(this.highTextureURLs=t,this.textureURLs=t)}this.needsUpdate=!0}))}updateHDGridTextures(t){return Cb(this,void 0,void 0,(function*(){if(this.useLowTextureURLsOnly)return[];const{THREE:e}=Nd.getInstance();if(this.tiledTextureURLRoot){const e=["r","l","t","d","f","b"],n=t.map(t=>`${this.tiledTextureURLRoot}${this.seqID}_${e[t[0]]}_${t[1]}-${t[2]}`),r=yield Eb.hdFaceTexturesCache.preloadTextures(n,t.length);for(let e=t.length-1;e>=0;e--)this.setFaceTexture(t[e],r[e],void 0,n[e]);return r}if(!this.highTextureURLs.length)return[];const n=t.map(t=>""+this.highTextureURLs[t[0]]),r=yield Eb.hdFaceTexturesCache.preloadTextures(n,t.length),i=new e.Vector2(1/this.faceGridCols,1/this.faceGridRows);for(let o=t.length-1;o>=0;o--){const s=new e.Vector2(i.x*t[o][2],i.y*t[o][1]);this.setFaceTexture(t[o],r[o],{uvScalar:i,uvOffset:s},n[o])}return r}))}updateLDGridTextures(t){return Cb(this,void 0,void 0,(function*(){const{THREE:e}=Nd.getInstance(),n=t.map(t=>""+this.textureURLs[t[0]]),r=yield Eb.ldFaceTexturesCache.preloadTextures(n,t.length),i=new e.Vector2(1/this.faceGridCols,1/this.faceGridRows);for(let o=t.length-1;o>=0;o--){const s=new e.Vector2(i.x*t[o][2],i.y*t[o][1]);this.setFaceTexture(t[o],r[o],{uvScalar:i,uvOffset:s},n[o])}return r}))}updateFaceGridsTextures(t,e){return Cb(this,void 0,void 0,(function*(){this.panoramaLoaded||this.emit(Ud.WILL_LOAD_PANORAMA,this.pid);const n=[];t.forEach(t=>{2!==this.faceGridsStates[t[0]][this.faceGridCols*t[1]+t[2]]&&n.push(t)}),yield this.updateLDGridTextures(n);const r=[];e.forEach(t=>{1!==this.faceGridsStates[t[0]][this.faceGridCols*t[1]+t[2]]&&r.push(t)}),yield this.updateLDGridTextures(r);for(let t=0;t<6;t++)for(let e=this.faceGridRows*this.faceGridCols-1;e>=0;e--)this.faceGridsStates[t][e]=0;t.forEach(t=>{this.faceGridsStates[t[0]][this.faceGridCols*t[1]+t[2]]=2}),e.forEach(t=>{this.faceGridsStates[t[0]][this.faceGridCols*t[1]+t[2]]=1}),this.updateHDGridTextures(n),this.panoramaLoaded||this.emit(Ud.DID_LOAD_PANORAMA,this.pid),this.panoramaLoaded=!0}))}setUseLowTexturesOnly(t){this.useLowTextureURLsOnly=t}isUseLowTexturesOnly(){return this.useLowTextureURLsOnly}dispose(){super.dispose(),this.faceGridsMaterials&&this.faceGridsMaterials.forEach(t=>{t.forEach(t=>{t.dispose()})}),this.skyBoxFaceGrids&&this.skyBoxFaceGrids.forEach(t=>{t.forEach(t=>{t.geometry&&t.geometry.dispose()})}),this.stopVideo(),this.eventListeners.onEnded&&(this.eventListeners.onEnded=null),this.sphereMesh&&this.sphereMesh.material&&this.sphereMesh.material.dispose(),this.initialized=!1,kd.off(zd.ELEMENT_SELECTED,this.eventListeners.onPanoramaSelected)}update(){const t=new tg(this);return this.initialized?(this.needsUpdate||this.isPlayingVideo)&&(t.needUpdate=!0,this.isPlayingVideo&&this.videoCanvas&&this.sphereMesh.material.map&&(this.sphereMesh.material.map.needsUpdate=!0),this.needsUpdate=!1):(this.initialized=!0,t.needUpdate=!0),this.initialized&&!this.parent&&(t.shouldPlaceElement=!0),t}setAdditionalRotationInEuler(t,e,n){const{THREE:r}=Nd.getInstance();this.additionalQuaternion.setFromEuler(new r.Euler(t,e,n));const{x:i,y:o,z:s,w:a}=this.baseQuaternion.clone().multiply(this.additionalQuaternion);return this.quaternion.set(i,o,s,a),this.needsUpdate=!0,this.additionalQuaternion.clone()}setAdditionalRotationInQuaternion(t,e,n,r){const{THREE:i}=Nd.getInstance();this.additionalQuaternion.set(t,e,n,r);const{x:o,y:s,z:a,w:u}=this.baseQuaternion.clone().multiply(this.additionalQuaternion);return this.quaternion.set(o,s,a,u),this.needsUpdate=!0,(new i.Euler).setFromQuaternion(this.additionalQuaternion)}addViewConfiguration(t){const e=this.viewConfigurations.get(t.targetView),n=Object.assign(Object.assign({},e),t);this.viewConfigurations.set(t.targetView,n),this.needsUpdate=!0}}var Pb,Ib=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};!function(t){t[t.AlwaysHide=0]="AlwaysHide",t[t.AlwaysShow=1]="AlwaysShow",t[t.Editing=2]="Editing",t[t.Show=3]="Show"}(Pb||(Pb={}));class Lb extends eg{constructor(t,e,n){super();const{THREE:r}=Nd.getInstance();this.initialized=!1;const{modelElement:i,groundParams:o,indicatorImageURL:s,invisibleIndicatorImageURL:a,indicatorWidth:u,indicatorHeight:c,indicatorPositionMap:l,globalScale:h}=e||{globalScale:1};this.currentPanoramaID=-1,this.panoramaMap=new Map,this.indicatorMap=new Map,this.indicatorVisibilityMap=new Map,this.indicatorHiddenMap=new Map,this.indicatorPositionMap=l||new Map,this.inSightIndicators=[],this.indicatorWidth=u||2*Lb.IndicatorRadius,this.indicatorHeight=c||2*Lb.IndicatorRadius,this.maxWorldDistance=13,this.globalScale=h||1,this.group=new r.Group,this.add(this.group),this.viewConfigurations=new Map,this.eventListeners={onFloorModelLoaded:t=>{t===this.modelElement&&this.updateIndicatorsPositions()}},this.groundParams=o,this.bindModelElement(i);const p=["varying vec2 vUv;","void main(){"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),f=["uniform sampler2D map;","uniform float opacity;","uniform vec4 blendColor;","varying vec2 vUv;","void main(){"," vec4 texColor = texture2D(map, vUv);"," gl_FragColor = vec4((texColor * (1.0 - blendColor.a) + blendColor * blendColor.a).rgb, texColor.a * opacity);","}"].join("\n");let d,g,m;this.indicatorShaderUniforms={map:{type:"t",value:null},blendColor:{type:"v4",value:new r.Vector4(0,0,0,0)},opacity:{value:1}},this.invisibleIndicatorShaderUniforms={map:{type:"t",value:null},blendColor:{type:"v4",value:new r.Vector4(1,0,0,.5)},opacity:{value:1}},this.indicatorMaterials=new Map,s?(g=new r.PlaneBufferGeometry(this.indicatorWidth,this.indicatorHeight),d=new r.ShaderMaterial({transparent:!0,vertexShader:p,fragmentShader:f,uniforms:this.indicatorShaderUniforms,side:r.DoubleSide,depthTest:!1,depthWrite:!1,name:"indicatorMaterial"}),this.indicatorImageURL=s,(new r.TextureLoader).load(s,t=>{this.indicatorShaderUniforms.map.value=t})):(g=new r.CircleGeometry(this.indicatorWidth/2,32),d=new r.MeshBasicMaterial({transparent:!0}),d.side=r.DoubleSide,d.depthTest=!1,d.depthWrite=!1,d.color=new r.Color(16777215));const v=a||s;v?(m=new r.ShaderMaterial({transparent:!0,vertexShader:p,fragmentShader:f,uniforms:this.invisibleIndicatorShaderUniforms,side:r.DoubleSide,depthTest:!1,depthWrite:!1,name:"invisibleIndicatorMaterial"}),(new r.TextureLoader).load(v,t=>{this.invisibleIndicatorShaderUniforms.map.value=t})):(m=new r.MeshBasicMaterial,m.side=r.DoubleSide,m.depthTest=!1,m.depthWrite=!1,m.color=new r.Color(16711680));const y=new r.Mesh(g,d);this.setIndicatorMeshPrototype(y),this.setIndicatorMaterial(d,Pb.Editing,!0),this.setIndicatorMaterial(m,Pb.Editing,!1),this.setIndicatorMaterial(d,Pb.Show,!0),this.panoramaDatas=new Map,t.forEach(t=>{this.panoramaDatas.set(t.pid,t)}),this.panoramaCreatingTasks=new Map,!0===n&&t.forEach(t=>{this.getPanoramaByPID(t.pid)}),this.modelElement instanceof Yx&&this.modelElement.isModelLoaded()&&this.updateIndicatorsPositions(),kd.on(zd.ELEMENT_LOADED,this.eventListeners.onFloorModelLoaded),this.initialized=!1,this.needUpdate=!1}dispose(t){super.dispose(),kd.off(zd.ELEMENT_LOADED,this.eventListeners.onFloorModelLoaded),this.panoramaMap&&(this.panoramaMap.forEach(e=>{this.group.remove(e),t!==e.pid&&Ab.sharedInstance.recycleCubeTexture(e.textureURLs),e.dispose()}),this.panoramaMap.clear()),this.indicatorMap&&(this.indicatorMap.forEach(t=>{this.group.remove(t)}),this.indicatorMap.clear()),this.boundBox&&(this.group.remove(this.boundBox),this.boundBox.geometry.dispose()),this.remove(this.group)}update(){const t=new tg(this);if(this.initialized)if(this.needUpdate){this.getPIDPositionMap(this.inSightIndicators).forEach((t,e)=>{if(!this.indicatorPositionMap.get(e)&&(this.groundParams||this.modelElement instanceof Yx)){let n;if(this.groundParams&&this.groundParams.groundPlane)n=Yx.intersectWithGroundPlane(t,this.groundParams);else{n=this.modelElement.intersectGround(t)}n&&this.indicatorPositionMap.set(e,n)}}),this.inSightIndicators.forEach(t=>{let e=this.indicatorMap.get(t);if(!e){e=this.indicatorMeshPrototype.clone(),this.indicatorMap.set(t,e),this.group.add(e);const n=this.panoramaDatas.get(t);n&&n.position&&e.position.copy(n.position)}const n=this.indicatorPositionMap.get(t);n&&e.position.copy(n)}),this.needUpdate=!1,t.needUpdate=!0}else this.panoramaMap.forEach(e=>{e.update().needUpdate&&(t.needUpdate=!0)});else this.initialized=!0,t.needUpdate=!0;return this.initialized&&!this.parent&&(t.shouldPlaceElement=!0),t}bindModelElement(t){t&&(this.modelElement=t),this.boundBox&&(this.group.remove(this.boundBox),this.boundBox=null),this.getModelBoundBox()}static getBoundBox(t){if(!t)return null;const{THREE:e}=Nd.getInstance(),n=(new e.Box3).setFromObject(t),r=n.getSize(new e.Vector3),i=Math.max(r.x,r.y,r.z),o=new e.Mesh(new e.BoxBufferGeometry(i,i,i));return o.position.copy(n.max.clone().add(n.min).multiplyScalar(.5)),o}getModelBoundBox(){this.boundBox||(this.boundBox=Lb.getBoundBox(this.modelElement),this.boundBox&&(this.boundBox.visible=!0,this.boundBox.frustumCulled=!1,this.boundBox.renderOrder=100,this.group.add(this.boundBox)))}setBoundBoxAppearance(t){this.getModelBoundBox(),this.boundBox&&(this.boundBox.material=t,this.needUpdate=!0)}setBoundBoxVisible(t){this.boundBox&&(this.boundBox.visible=t)}presentPanorama(t,e,n){return Ib(this,void 0,void 0,(function*(){t.legacyMode||(yield t.updateFaceGridsTextures(e,n),this.needUpdate=!0)}))}presentPanoramaOfPID(t,e,n){return Ib(this,void 0,void 0,(function*(){const r=yield this.getPanoramaByPID(t);r&&(yield this.presentPanorama(r,e,n)),this.currentPanoramaID=t,this.emit(Ud.PANORAMA_PRESENTED,t)}))}preloadCubeTexturesOfPIDs(t,e){return Ib(this,void 0,void 0,(function*(){const n=t.map(t=>{const e=this.panoramaDatas.get(t);if(e)return e.textureURLs});return Ab.sharedInstance.preloadCubeTextures(n,e)}))}visibleRadiusOfView(t){if(!t)return Lb.DefaultVisibleRadius;const e=this.viewConfigurations.get(t);return e&&e.visibleRadius?e.visibleRadius:Lb.DefaultVisibleRadius}allPanoramas(){return Ib(this,void 0,void 0,(function*(){const t=Array.from(this.panoramaMap.values()),e=yield Promise.all(Array.from(this.panoramaCreatingTasks.values()));return t.concat(e)}))}getAllPanoramas(){return Ib(this,void 0,void 0,(function*(){return this.initializePanoramasIfNecessary("all")}))}panoramaIDsAround(t,e){const n=this.panoramaDatas.get(t);if(!n||!n.position)return null;const r=[t],i=this.visibleRadiusOfView(e);return n.neighbourPanoramaIDs.map(t=>this.panoramaDatas.get(t)).forEach(t=>{if(t&&t.position){n.position.distanceTo(t.position)<=i&&r.push(t.pid)}}),r}presentPanoramaAround(t,e,n,r){return Ib(this,void 0,void 0,(function*(){this.panoramaIDsAround(t,r)&&(yield this.presentPanoramaOfPID(t,e,n))}))}getPIDPositionMap(t){const e=new Map;return t.forEach(t=>{const n=this.panoramaDatas.get(t);n&&e.set(t,n.position)}),e}getIndicatorPosition(t){return this.indicatorPositionMap.get(t)}presentPanoramaIndicators(t){if(!this.modelElement)return;this.inSightIndicators=[];const{THREE:e}=Nd.getInstance();t.forEach((t,n)=>{if(this.groundParams||this.modelElement instanceof Yx){if(!this.indicatorPositionMap.get(n)){let r;if(this.groundParams&&this.groundParams.groundPlane)r=Yx.intersectWithGroundPlane(t,this.groundParams);else{r=this.modelElement.intersectGround(t)}r&&this.indicatorPositionMap.set(n,r.add(new e.Vector3(0,0,Lb.IndicatorOffsetZ)))}}this.inSightIndicators.push(n)}),this.needUpdate=!0}updateIndicatorsPositions(){return Ib(this,void 0,void 0,(function*(){const{THREE:t}=Nd.getInstance();this.panoramaMap.forEach((e,n)=>{if(this.indicatorPositionMap.get(n))return;const{position:r}=e;let i;if(this.groundParams&&this.groundParams.groundPlane)i=Yx.intersectWithGroundPlane(r,this.groundParams);else{i=this.modelElement.intersectGround(r)}i&&this.indicatorPositionMap.set(n,i.add(new t.Vector3(0,0,Lb.IndicatorOffsetZ)))});const e=yield this.getPIDPositionMap(this.inSightIndicators);this.presentPanoramaIndicators(e)}))}presentPanoramaIndicatorsAround(t,e){return Ib(this,void 0,void 0,(function*(){const n=this.panoramaIDsAround(t,e);if(n){const t=yield this.getPIDPositionMap(n);this.presentPanoramaIndicators(t)}}))}getIndicatorVisibility(t){const e=this.indicatorVisibilityMap.get(t);return void 0===e||e}setIndicatorVisibility(t,e){let n;void 0===e?(n=[],this.indicatorMap.forEach((t,e)=>{n.push(e)})):n=Array.isArray(e)?e:[e],n.forEach(e=>{this.indicatorVisibilityMap.set(e,t);const n=this.indicatorMap.get(e);n&&(this.group.remove(n),this.indicatorMap.delete(e))}),this.needUpdate=!0}setIndicatorHidden(t,e){let n;void 0===e?(n=[],this.indicatorMap.forEach((t,e)=>{n.push(e)})):n=Array.isArray(e)?e:[e],n.forEach(e=>{this.indicatorHiddenMap.set(e,t);const n=this.indicatorMap.get(e);n&&(this.group.remove(n),this.indicatorMap.delete(e))}),this.needUpdate=!0}intersectIndicators(t,e){let n=[];const r=e.normalize(),i=Math.min(this.indicatorHeight,this.indicatorWidth)/2;return this.indicatorMap.forEach((e,o)=>{const s=e.position;if(Number.isNaN(s.x))return;const a=s.clone().sub(t),u=a.dot(r);if(u>0){const t=r.clone().multiplyScalar(u),e=a.sub(t).length();e<=i&&n.push({pid:o,distance:e})}}),n.length>0?(n=n.sort((t,e)=>t.distance<e.distance?-1:t.distance>e.distance?1:0),n[0].pid):-1}intersectIndicatorsOnScreen(t,e,{screenWidth:n,screenHeight:r},i){const o=Array.from(this.indicatorMap),s=o.map(([,t])=>t),a=ky.getMouseIntersectionOnScreen(s,t,{screenWidth:n,screenHeight:r},e,i,s,this.maxWorldDistance);if(a){const t=o.find(([,t])=>t===a);if(t)return t[0]}return-1}putPanorama(t){const e=this.panoramaMap.get(t.pid);e&&(this.group.remove(e),e.dispose()),this.panoramaMap.set(t.pid,t),this.group.add(t),this.needUpdate=!0}initializePanoramasIfNecessary(t){return Ib(this,void 0,void 0,(function*(){let e=[];if(Array.isArray(t))e=t;else if("all"===t)e=Array.from(this.panoramaDatas.keys());else{const n=t;e.push(n);const r=new Set;r.add(n);const i=[n];for(;i.length>0;){const t=i.splice(0,1)[0],n=this.panoramaDatas.get(t);n&&n.neighbourPanoramaIDs.forEach(t=>{r.has(t)||(r.add(t),i.push(t),e.push(t))})}}const n=e.map(t=>this.getPanoramaByPID(t));return Promise.all(n)}))}getPanoramaByPID(t){return Ib(this,void 0,void 0,(function*(){const e=this.panoramaMap.get(t);if(e)return e;const n=this.panoramaCreatingTasks.get(t);if(n)return n;const r=this.panoramaDatas.get(t);if(!r)return;const i=new Promise(t=>{const e=new Tb(r.pid,r.seqID,r.textureURLs,[2,2],r.neighbourPanoramaIDs,r.highTextureURLs,r.useLowTextureURLsOnly,r.tiledTextureURLRoot,r.position,r.quaternion,!!r.legacyMode);e.scale.set(this.globalScale,this.globalScale,this.globalScale),this.putPanorama(e),this.panoramaCreatingTasks.delete(r.pid),t(e)});return this.panoramaCreatingTasks.set(r.pid,i),i}))}getPanoramaByPIDInstant(t){return this.panoramaMap.get(t)||null}getNeghbourPanoClosestToRay(t){if(-1===this.currentPanoramaID)return-1;const e=this.panoramaMap.get(this.currentPanoramaID);if(!e)return-1;if(!e.neighborPanoramaIDs||0===e.neighborPanoramaIDs.length)return-1;const n=t.clone().normalize();let r=-1,i=-1;return e.neighborPanoramaIDs.forEach(t=>{const o=this.panoramaMap.get(t);if(!o)return;const s=o.position.clone().sub(e.position).normalize().dot(n);s>r&&(r=s,i=t)}),r>=Math.cos(12*Math.PI/180)?i:-1}updateIndicatorGeometry(){const{THREE:t}=Nd.getInstance();let e;e=this.indicatorImageURL?new t.PlaneBufferGeometry(this.indicatorWidth,this.indicatorHeight):new t.CircleGeometry(this.indicatorWidth/2,32);const n=new Set;Array.from(this.indicatorMap).forEach(([,t])=>{n.add(t.geometry),t.geometry=e}),Array.from(n).forEach(t=>{t.dispose()}),this.indicatorMeshPrototype.geometry=e;const r=new t.Mesh(e,this.indicatorMeshPrototype.material);this.setIndicatorMeshPrototype(r)}setIndicatorSize(t,e){this.indicatorWidth=t,this.indicatorHeight=e,this.updateIndicatorGeometry()}setIndicatorImageURL(t){const{THREE:e}=Nd.getInstance();(new e.TextureLoader).load(t,n=>{const r=["varying vec2 vUv;","void main(){"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),i=["uniform sampler2D map;","uniform float opacity;","uniform vec4 blendColor;","varying vec2 vUv;","void main(){"," vec4 texColor = texture2D(map, vUv);"," gl_FragColor = vec4((texColor * (1.0 - blendColor.a) + blendColor * blendColor.a).rgb, texColor.a * opacity);","}"].join("\n");let o=this.getIndicatorMaterial(Pb.Editing,!0),s=new e.ShaderMaterial({transparent:!0,vertexShader:r,fragmentShader:i,uniforms:this.indicatorShaderUniforms,side:e.DoubleSide,depthTest:!1,depthWrite:!1,name:"indicatorMaterial"});this.setIndicatorMaterial(s,Pb.Editing,!0),o.dispose(),o=this.getIndicatorMaterial(Pb.Show,!0),this.setIndicatorMaterial(s,Pb.Show,!0),o.dispose(),s=new e.ShaderMaterial({transparent:!0,vertexShader:r,fragmentShader:i,uniforms:this.invisibleIndicatorShaderUniforms,side:e.DoubleSide,depthTest:!1,depthWrite:!1,name:"invisibleIndicatorMaterial"}),this.indicatorShaderUniforms.map.value=n,this.invisibleIndicatorShaderUniforms.map.value=n,this.setIndicatorMaterial(s,Pb.Editing,!1),this.indicatorImageURL||this.setIndicatorMeshPrototype(new e.Mesh(new e.PlaneBufferGeometry(this.indicatorWidth,this.indicatorHeight),s)),this.indicatorImageURL=t,this.needUpdate=!0,this.updateIndicatorGeometry()})}getIndicatorSize(){return[this.indicatorWidth,this.indicatorHeight]}setIndicatorMeshPrototype(t){this.indicatorMeshPrototype=t,this.panoramaMap.forEach((t,e)=>{const n=this.indicatorMap.get(e);n&&(this.group.remove(n),this.indicatorMap.delete(e))}),t.renderOrder=300,this.needUpdate=!0}setIndicatorMaterial(t,e,n){let r=this.indicatorMaterials.get(e);r||(r=new Map,this.indicatorMaterials.set(e,r)),r.set(n,t),this.needUpdate=!0}getIndicatorMaterial(t,e){let n=this.indicatorMaterials.get(t);return n||(n=new Map,this.indicatorMaterials.set(t,n)),n.get(e)}addGroupViewConfiguration(t){const e=this.viewConfigurations.get(t.targetView);e&&(void 0===t.showBoundBox&&void 0!==e.showBoundBox&&(t.showBoundBox=e.showBoundBox),void 0===t.visibleRadius&&void 0!==e.visibleRadius&&(t.visibleRadius=e.visibleRadius),void 0===t.indicatorDisplayMode&&void 0!==e.indicatorDisplayMode&&(t.indicatorDisplayMode=e.indicatorDisplayMode)),this.viewConfigurations.set(t.targetView,t),this.needUpdate=!0}addViewConfiguration(t){return Ib(this,void 0,void 0,(function*(){(yield this.allPanoramas()).forEach(e=>{e.addViewConfiguration(t)})}))}setMaxWorldDistance(t){this.maxWorldDistance=t}}Lb.DefaultVisibleRadius=10,Lb.IndicatorRadius=.1,Lb.IndicatorOffsetZ=.1;r.Vector3;r.CameraHelper;var Rb=function(){function t(t){Hl.call(this,t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(t){return new o(t)})),this.register((function(t){return new a(t)})),this.register((function(t){return new u(t)})),this.register((function(t){return new s(t)})),this.register((function(t){return new r(t)})),this.register((function(t){return new c(t)}))}function e(){var t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}t.prototype=Object.assign(Object.create(Hl.prototype),{constructor:t,load:function(t,e,n,r){var i,o=this;i=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:zh.extractUrlBase(t),this.manager.itemStart(t);var s=function(e){r?r(e):console.error(e),o.manager.itemError(t),o.manager.itemEnd(t)},a=new jl(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(n){try{o.parse(n,i,(function(n){e(n),o.manager.itemEnd(t)}),s)}catch(t){s(t)}}),n,s)},setDRACOLoader:function(t){return this.dracoLoader=t,this},setDDSLoader:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')},setKTX2Loader:function(t){return this.ktx2Loader=t,this},setMeshoptDecoder:function(t){return this.meshoptDecoder=t,this},register:function(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this},unregister:function(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this},parse:function(t,e,r,o){var s,a={},u={};if("string"==typeof t)s=t;else if(zh.decodeText(new Uint8Array(t,0,4))===l){try{a[n.KHR_BINARY_GLTF]=new f(t)}catch(t){return void(o&&o(t))}s=a[n.KHR_BINARY_GLTF].content}else s=zh.decodeText(new Uint8Array(t));var c=JSON.parse(s);if(void 0===c.asset||c.asset.version[0]<2)o&&o(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var h=new j(c,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});h.fileLoader.setRequestHeader(this.requestHeader);for(var p=0;p<this.pluginCallbacks.length;p++){var m=this.pluginCallbacks[p](h);u[m.name]=m,a[m.name]=!0}if(c.extensionsUsed)for(p=0;p<c.extensionsUsed.length;++p){var x=c.extensionsUsed[p],b=c.extensionsRequired||[];switch(x){case n.KHR_MATERIALS_UNLIT:a[x]=new i;break;case n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:a[x]=new v;break;case n.KHR_DRACO_MESH_COMPRESSION:a[x]=new d(c,this.dracoLoader);break;case n.KHR_TEXTURE_TRANSFORM:a[x]=new g;break;case n.KHR_MESH_QUANTIZATION:a[x]=new y;break;default:b.indexOf(x)>=0&&void 0===u[x]&&console.warn('THREE.GLTFLoader: Unknown extension "'+x+'".')}}h.setExtensions(a),h.setPlugins(u),h.parse(r,o)}}});var n={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};function r(t){this.parser=t,this.name=n.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}function i(){this.name=n.KHR_MATERIALS_UNLIT}function o(t){this.parser=t,this.name=n.KHR_MATERIALS_CLEARCOAT}function s(t){this.parser=t,this.name=n.KHR_MATERIALS_TRANSMISSION}function a(t){this.parser=t,this.name=n.KHR_TEXTURE_BASISU}function u(t){this.parser=t,this.name=n.EXT_TEXTURE_WEBP,this.isSupported=null}function c(t){this.name=n.EXT_MESHOPT_COMPRESSION,this.parser=t}r.prototype._markDefs=function(){for(var t=this.parser,e=this.parser.json.nodes||[],n=0,r=e.length;n<r;n++){var i=e[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&t._addNodeRef(this.cache,i.extensions[this.name].light)}},r.prototype._loadLight=function(t){var e=this.parser,n="light:"+t,r=e.cache.get(n);if(r)return r;var i,o=e.json,s=((o.extensions&&o.extensions[this.name]||{}).lights||[])[t],a=new ki(16777215);void 0!==s.color&&a.fromArray(s.color);var u=void 0!==s.range?s.range:0;switch(s.type){case"directional":(i=new Bh(a)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new Rh(a)).distance=u;break;case"spot":(i=new Ch(a)).distance=u,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,i.angle=s.spot.outerConeAngle,i.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return i.position.set(0,0,0),i.decay=2,void 0!==s.intensity&&(i.intensity=s.intensity),i.name=e.createUniqueName(s.name||"light_"+t),r=Promise.resolve(i),e.cache.add(n,r),r},r.prototype.createNodeAttachment=function(t){var e=this,n=this.parser,r=n.json.nodes[t],i=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===i?null:this._loadLight(i).then((function(t){return n._getNodeRef(e.cache,i,t)}))},i.prototype.getMaterialType=function(){return Gi},i.prototype.extendParams=function(t,e,n){var r=[];t.color=new ki(1,1,1),t.opacity=1;var i=e.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){var o=i.baseColorFactor;t.color.fromArray(o),t.opacity=o[3]}void 0!==i.baseColorTexture&&r.push(n.assignTexture(t,"map",i.baseColorTexture))}return Promise.all(r)},o.prototype.getMaterialType=function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ml:null},o.prototype.extendMaterialParams=function(t,e){var n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],o=r.extensions[this.name];if(void 0!==o.clearcoatFactor&&(e.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&i.push(n.assignTexture(e,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(e.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&i.push(n.assignTexture(e,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(i.push(n.assignTexture(e,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){var s=o.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new er(s,-s)}return Promise.all(i)},s.prototype.getMaterialType=function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ml:null},s.prototype.extendMaterialParams=function(t,e){var n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],o=r.extensions[this.name];return void 0!==o.transmissionFactor&&(e.transmission=o.transmissionFactor),void 0!==o.transmissionTexture&&i.push(n.assignTexture(e,"transmissionMap",o.transmissionTexture)),Promise.all(i)},a.prototype.loadTexture=function(t){var e=this.parser,n=e.json,r=n.textures[t];if(!r.extensions||!r.extensions[this.name])return null;var i=r.extensions[this.name],o=n.images[i.source],s=e.options.ktx2Loader;if(!s){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,o,s)},u.prototype.loadTexture=function(t){var e=this.name,n=this.parser,r=n.json,i=r.textures[t];if(!i.extensions||!i.extensions[e])return null;var o=i.extensions[e],s=r.images[o.source],a=n.textureLoader;if(s.uri){var u=n.options.manager.getHandler(s.uri);null!==u&&(a=u)}return this.detectSupport().then((function(i){if(i)return n.loadTextureImage(t,s,a);if(r.extensionsRequired&&r.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(t)}))},u.prototype.detectSupport=function(){return this.isSupported||(this.isSupported=new Promise((function(t){var e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported},c.prototype.loadBufferView=function(t){var e=this.parser.json,n=e.bufferViews[t];if(n.extensions&&n.extensions[this.name]){var r=n.extensions[this.name],i=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([i,o.ready]).then((function(t){var e=r.byteOffset||0,n=r.byteLength||0,i=r.count,s=r.byteStride,a=new ArrayBuffer(i*s),u=new Uint8Array(t[0],e,n);return o.decodeGltfBuffer(new Uint8Array(a),i,s,u,r.mode,r.filter),a}))}return null};var l="glTF",h=1313821514,p=5130562;function f(t){this.name=n.KHR_BINARY_GLTF,this.content=null,this.body=null;var e=new DataView(t,0,12);if(this.header={magic:zh.decodeText(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==l)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var r=this.header.length-12,i=new DataView(t,12),o=0;o<r;){var s=i.getUint32(o,!0);o+=4;var a=i.getUint32(o,!0);if(o+=4,a===h){var u=new Uint8Array(t,12+o,s);this.content=zh.decodeText(u)}else if(a===p){var c=12+o;this.body=t.slice(c,c+s)}o+=s}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function d(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=n.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}function g(){this.name=n.KHR_TEXTURE_TRANSFORM}function m(t){gl.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var e=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),n=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),r=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),i=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),o=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor;"].join("\n"),s={specular:{value:(new ki).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=s,this.onBeforeCompile=function(t){for(var a in s)t.uniforms[a]=s[a];t.fragmentShader=t.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",e).replace("#include <metalnessmap_pars_fragment>",n).replace("#include <roughnessmap_fragment>",r).replace("#include <metalnessmap_fragment>",i).replace("#include <lights_physical_fragment>",o)},Object.defineProperties(this,{specular:{get:function(){return s.specular.value},set:function(t){s.specular.value=t}},specularMap:{get:function(){return s.specularMap.value},set:function(t){s.specularMap.value=t,t?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return s.glossiness.value},set:function(t){s.glossiness.value=t}},glossinessMap:{get:function(){return s.glossinessMap.value},set:function(t){s.glossinessMap.value=t,t?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(t)}function v(){return{name:n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return m},extendParams:function(t,e,n){var r=e.extensions[this.name];t.color=new ki(1,1,1),t.opacity=1;var i=[];if(Array.isArray(r.diffuseFactor)){var o=r.diffuseFactor;t.color.fromArray(o),t.opacity=o[3]}if(void 0!==r.diffuseTexture&&i.push(n.assignTexture(t,"map",r.diffuseTexture)),t.emissive=new ki(0,0,0),t.glossiness=void 0!==r.glossinessFactor?r.glossinessFactor:1,t.specular=new ki(1,1,1),Array.isArray(r.specularFactor)&&t.specular.fromArray(r.specularFactor),void 0!==r.specularGlossinessTexture){var s=r.specularGlossinessTexture;i.push(n.assignTexture(t,"glossinessMap",s)),i.push(n.assignTexture(t,"specularMap",s))}return Promise.all(i)},createMaterial:function(t){var e=new m(t);return e.fog=!0,e.color=t.color,e.map=void 0===t.map?null:t.map,e.lightMap=null,e.lightMapIntensity=1,e.aoMap=void 0===t.aoMap?null:t.aoMap,e.aoMapIntensity=1,e.emissive=t.emissive,e.emissiveIntensity=1,e.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,e.bumpMap=void 0===t.bumpMap?null:t.bumpMap,e.bumpScale=1,e.normalMap=void 0===t.normalMap?null:t.normalMap,e.normalMapType=wn,t.normalScale&&(e.normalScale=t.normalScale),e.displacementMap=null,e.displacementScale=1,e.displacementBias=0,e.specularMap=void 0===t.specularMap?null:t.specularMap,e.specular=t.specular,e.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,e.glossiness=t.glossiness,e.alphaMap=null,e.envMap=void 0===t.envMap?null:t.envMap,e.envMapIntensity=1,e.refractionRatio=.98,e}}}function y(){this.name=n.KHR_MESH_QUANTIZATION}function x(t,e,n,r){Sl.call(this,t,e,n,r)}d.prototype.decodePrimitive=function(t,e){var n=this.json,r=this.dracoLoader,i=t.extensions[this.name].bufferView,o=t.extensions[this.name].attributes,s={},a={},u={};for(var c in o){var l=O[c]||c.toLowerCase();s[l]=o[c]}for(c in t.attributes){l=O[c]||c.toLowerCase();if(void 0!==o[c]){var h=n.accessors[t.attributes[c]],p=C[h.componentType];u[l]=p,a[l]=!0===h.normalized}}return e.getDependency("bufferView",i).then((function(t){return new Promise((function(e){r.decodeDracoFile(t,(function(t){for(var n in t.attributes){var r=t.attributes[n],i=a[n];void 0!==i&&(r.normalized=i)}e(t)}),s,u)}))}))},g.prototype.extendTexture=function(t,e){return t=t.clone(),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),void 0!==e.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),t.needsUpdate=!0,t},m.prototype=Object.create(gl.prototype),m.prototype.constructor=m,m.prototype.copy=function(t){return gl.prototype.copy.call(this,t),this.specularMap=t.specularMap,this.specular.copy(t.specular),this.glossinessMap=t.glossinessMap,this.glossiness=t.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},x.prototype=Object.create(Sl.prototype),x.prototype.constructor=x,x.prototype.copySampleValue_=function(t){for(var e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=t*r*3+r,o=0;o!==r;o++)e[o]=n[i+o];return e},x.prototype.beforeStart_=x.prototype.copySampleValue_,x.prototype.afterEnd_=x.prototype.copySampleValue_,x.prototype.interpolate_=function(t,e,n,r){for(var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=2*s,u=3*s,c=r-e,l=(n-e)/c,h=l*l,p=h*l,f=t*u,d=f-u,g=-2*p+3*h,m=p-h,v=1-g,y=m-h+l,x=0;x!==s;x++){var b=o[d+x+s],_=o[d+x+a]*c,w=o[f+x+s],M=o[f+x]*c;i[x]=v*b+y*_+g*w+m*M}return i};var b=0,_=1,w=2,M=3,E=4,S=5,A=6,C={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},T={9728:Pt,9729:Dt,9984:It,9985:Bt,9986:Rt,9987:Nt},I={33071:Ct,33648:Tt,10497:At},R={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},O={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},D={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},B={CUBICSPLINE:void 0,LINEAR:en,STEP:tn},F="OPAQUE",N="MASK",k="BLEND";function G(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}function U(t,e,n){for(var r in n.extensions)void 0===t[r]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[r]=n.extensions[r])}function z(t,e){void 0!==e.extras&&("object"==typeof e.extras?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function H(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(var n=0,r=e.weights.length;n<r;n++)t.morphTargetInfluences[n]=e.weights[n];if(e.extras&&Array.isArray(e.extras.targetNames)){var i=e.extras.targetNames;if(t.morphTargetInfluences.length===i.length){t.morphTargetDictionary={};for(n=0,r=i.length;n<r;n++)t.morphTargetDictionary[i[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function V(t){for(var e="",n=Object.keys(t).sort(),r=0,i=n.length;r<i;r++)e+=n[r]+":"+t[n[r]]+";";return e}function j(t,n){this.json=t||{},this.extensions={},this.plugins={},this.options=n||{},this.cache=new e,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.nodeNamesUsed={},"undefined"!=typeof createImageBitmap&&!1===/Firefox/.test(navigator.userAgent)?this.textureLoader=new Jh(this.options.manager):this.textureLoader=new Kl(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new jl(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function W(t,e,n){var r=e.attributes,i=[];function o(e,r){return n.getDependency("accessor",e).then((function(e){t.setAttribute(r,e)}))}for(var s in r){var a=O[s]||s.toLowerCase();a in t.attributes||i.push(o(r[s],a))}if(void 0!==e.indices&&!t.index){var u=n.getDependency("accessor",e.indices).then((function(e){t.setIndex(e)}));i.push(u)}return z(t,e),function(t,e,n){var r=e.attributes,i=new gr;if(void 0!==r.POSITION){var o=(f=n.json.accessors[r.POSITION]).min,s=f.max;if(void 0!==o&&void 0!==s){i.set(new pr(o[0],o[1],o[2]),new pr(s[0],s[1],s[2]));var a=e.targets;if(void 0!==a){for(var u=new pr,c=new pr,l=0,h=a.length;l<h;l++){var p=a[l];if(void 0!==p.POSITION){var f;o=(f=n.json.accessors[p.POSITION]).min,s=f.max;void 0!==o&&void 0!==s?(c.setX(Math.max(Math.abs(o[0]),Math.abs(s[0]))),c.setY(Math.max(Math.abs(o[1]),Math.abs(s[1]))),c.setZ(Math.max(Math.abs(o[2]),Math.abs(s[2]))),u.max(c)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(u)}t.boundingBox=i;var d=new Dr;i.getCenter(d.center),d.radius=i.min.distanceTo(i.max)/2,t.boundingSphere=d}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(t,e,n),Promise.all(i).then((function(){return void 0!==e.targets?function(t,e,n){for(var r=!1,i=!1,o=0,s=e.length;o<s;o++){if(void 0!==(c=e[o]).POSITION&&(r=!0),void 0!==c.NORMAL&&(i=!0),r&&i)break}if(!r&&!i)return Promise.resolve(t);var a=[],u=[];for(o=0,s=e.length;o<s;o++){var c=e[o];if(r){var l=void 0!==c.POSITION?n.getDependency("accessor",c.POSITION):t.attributes.position;a.push(l)}if(i){l=void 0!==c.NORMAL?n.getDependency("accessor",c.NORMAL):t.attributes.normal;u.push(l)}}return Promise.all([Promise.all(a),Promise.all(u)]).then((function(e){var n=e[0],o=e[1];return r&&(t.morphAttributes.position=n),i&&(t.morphAttributes.normal=o),t.morphTargetsRelative=!0,t}))}(t,e.targets,n):t}))}function q(t,e){var n=t.getIndex();if(null===n){var r=[],i=t.getAttribute("position");if(void 0===i)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(var o=0;o<i.count;o++)r.push(o);t.setIndex(r),n=t.getIndex()}var s=n.count-2,a=[];if(e===hn)for(o=1;o<=s;o++)a.push(n.getX(0)),a.push(n.getX(o)),a.push(n.getX(o+1));else for(o=0;o<s;o++)o%2==0?(a.push(n.getX(o)),a.push(n.getX(o+1)),a.push(n.getX(o+2))):(a.push(n.getX(o+2)),a.push(n.getX(o+1)),a.push(n.getX(o)));a.length/3!==s&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var u=t.clone();return u.setIndex(a),u}return j.prototype.setExtensions=function(t){this.extensions=t},j.prototype.setPlugins=function(t){this.plugins=t},j.prototype.parse=function(t,e){var n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll((function(t){return t._markDefs&&t._markDefs()})),Promise.all(this._invokeAll((function(t){return t.beforeRoot&&t.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(e){var o={scene:e[0][r.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:r.asset,parser:n,userData:{}};U(i,o,r),z(o,r),Promise.all(n._invokeAll((function(t){return t.afterRoot&&t.afterRoot(o)}))).then((function(){t(o)}))})).catch(e)},j.prototype._markDefs=function(){for(var t=this.json.nodes||[],e=this.json.skins||[],n=this.json.meshes||[],r=0,i=e.length;r<i;r++)for(var o=e[r].joints,s=0,a=o.length;s<a;s++)t[o[s]].isBone=!0;for(var u=0,c=t.length;u<c;u++){var l=t[u];void 0!==l.mesh&&(this._addNodeRef(this.meshCache,l.mesh),void 0!==l.skin&&(n[l.mesh].isSkinnedMesh=!0)),void 0!==l.camera&&this._addNodeRef(this.cameraCache,l.camera)}},j.prototype._addNodeRef=function(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)},j.prototype._getNodeRef=function(t,e,n){if(t.refs[e]<=1)return n;var r=n.clone();return r.name+="_instance_"+t.uses[e]++,r},j.prototype._invokeOne=function(t){var e=Object.values(this.plugins);e.push(this);for(var n=0;n<e.length;n++){var r=t(e[n]);if(r)return r}},j.prototype._invokeAll=function(t){var e=Object.values(this.plugins);e.unshift(this);for(var n=[],r=0;r<e.length;r++){var i=t(e[r]);i&&n.push(i)}return n},j.prototype.getDependency=function(t,e){var n=t+":"+e,r=this.cache.get(n);if(!r){switch(t){case"scene":r=this.loadScene(e);break;case"node":r=this.loadNode(e);break;case"mesh":r=this._invokeOne((function(t){return t.loadMesh&&t.loadMesh(e)}));break;case"accessor":r=this.loadAccessor(e);break;case"bufferView":r=this._invokeOne((function(t){return t.loadBufferView&&t.loadBufferView(e)}));break;case"buffer":r=this.loadBuffer(e);break;case"material":r=this._invokeOne((function(t){return t.loadMaterial&&t.loadMaterial(e)}));break;case"texture":r=this._invokeOne((function(t){return t.loadTexture&&t.loadTexture(e)}));break;case"skin":r=this.loadSkin(e);break;case"animation":r=this.loadAnimation(e);break;case"camera":r=this.loadCamera(e);break;default:throw new Error("Unknown type: "+t)}this.cache.add(n,r)}return r},j.prototype.getDependencies=function(t){var e=this.cache.get(t);if(!e){var n=this,r=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(r.map((function(e,r){return n.getDependency(t,r)}))),this.cache.add(t,e)}return e},j.prototype.loadBuffer=function(t){var e=this.json.buffers[t],r=this.fileLoader;if(e.type&&"arraybuffer"!==e.type)throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(void 0===e.uri&&0===t)return Promise.resolve(this.extensions[n.KHR_BINARY_GLTF].body);var i=this.options;return new Promise((function(t,n){r.load(G(e.uri,i.path),t,void 0,(function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))}))}))},j.prototype.loadBufferView=function(t){var e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then((function(t){var n=e.byteLength||0,r=e.byteOffset||0;return t.slice(r,r+n)}))},j.prototype.loadAccessor=function(t){var e=this,n=this.json,r=this.json.accessors[t];if(void 0===r.bufferView&&void 0===r.sparse)return Promise.resolve(null);var i=[];return void 0!==r.bufferView?i.push(this.getDependency("bufferView",r.bufferView)):i.push(null),void 0!==r.sparse&&(i.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(i).then((function(t){var i,o=t[0],s=R[r.type],a=C[r.componentType],u=a.BYTES_PER_ELEMENT,c=u*s,l=r.byteOffset||0,h=void 0!==r.bufferView?n.bufferViews[r.bufferView].byteStride:void 0,p=!0===r.normalized;if(h&&h!==c){var f=Math.floor(l/h),d="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+f+":"+r.count,g=e.cache.get(d);g||(g=new uu(new a(o,f*h,r.count*h/u),h/u),e.cache.add(d,g)),i=new lu(g,s,l%h/u,p)}else i=new Hi(null===o?new a(r.count*s):new a(o,l,r.count*s),s,p);if(void 0!==r.sparse){var m=R.SCALAR,v=C[r.sparse.indices.componentType],y=r.sparse.indices.byteOffset||0,x=r.sparse.values.byteOffset||0,b=new v(t[1],y,r.sparse.count*m),_=new a(t[2],x,r.sparse.count*s);null!==o&&(i=new Hi(i.array.slice(),i.itemSize,i.normalized));for(var w=0,M=b.length;w<M;w++){var E=b[w];if(i.setX(E,_[w*s]),s>=2&&i.setY(E,_[w*s+1]),s>=3&&i.setZ(E,_[w*s+2]),s>=4&&i.setW(E,_[w*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return i}))},j.prototype.loadTexture=function(t){var e=this.json,n=this.options,r=e.textures[t],i=e.images[r.source],o=this.textureLoader;if(i.uri){var s=n.manager.getHandler(i.uri);null!==s&&(o=s)}return this.loadTextureImage(t,i,o)},j.prototype.loadTextureImage=function(t,e,n){var r=this,i=this.json,o=this.options,s=i.textures[t],a=self.URL||self.webkitURL,u=e.uri,c=!1,l=!0;if("image/jpeg"===e.mimeType&&(l=!1),void 0!==e.bufferView)u=r.getDependency("bufferView",e.bufferView).then((function(t){if("image/png"===e.mimeType){var n=new DataView(t,25,1).getUint8(0,!1);l=6===n||4===n||3===n}c=!0;var r=new Blob([t],{type:e.mimeType});return u=a.createObjectURL(r)}));else if(void 0===e.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");return Promise.resolve(u).then((function(t){return new Promise((function(e,r){var i=e;!0===n.isImageBitmapLoader&&(i=function(t){e(new hc(t))}),n.load(G(t,o.path),i,void 0,r)}))})).then((function(e){!0===c&&a.revokeObjectURL(u),e.flipY=!1,s.name&&(e.name=s.name),l||(e.format=Zt);var n=(i.samplers||{})[s.sampler]||{};return e.magFilter=T[n.magFilter]||Dt,e.minFilter=T[n.minFilter]||Nt,e.wrapS=I[n.wrapS]||At,e.wrapT=I[n.wrapT]||At,r.associations.set(e,{type:"textures",index:t}),e}))},j.prototype.assignTexture=function(t,e,r){var i=this;return this.getDependency("texture",r.index).then((function(o){if(void 0===r.texCoord||0==r.texCoord||"aoMap"===e&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+e+" not yet supported."),i.extensions[n.KHR_TEXTURE_TRANSFORM]){var s=void 0!==r.extensions?r.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;if(s){var a=i.associations.get(o);o=i.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(o,s),i.associations.set(o,a)}}t[e]=o}))},j.prototype.assignFinalMaterial=function(t){var e=t.geometry,n=t.material,r=void 0!==e.attributes.tangent,i=void 0!==e.attributes.color,o=void 0===e.attributes.normal,s=!0===t.isSkinnedMesh,a=Object.keys(e.morphAttributes).length>0,u=a&&void 0!==e.morphAttributes.normal;if(t.isPoints){var c="PointsMaterial:"+n.uuid,l=this.cache.get(c);l||(l=new nc,Li.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(c,l)),n=l}else if(t.isLine){c="LineBasicMaterial:"+n.uuid;var h=this.cache.get(c);h||(h=new Wu,Li.prototype.copy.call(h,n),h.color.copy(n.color),this.cache.add(c,h)),n=h}if(r||i||o||s||a){c="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(c+="specular-glossiness:"),s&&(c+="skinning:"),r&&(c+="vertex-tangents:"),i&&(c+="vertex-colors:"),o&&(c+="flat-shading:"),a&&(c+="morph-targets:"),u&&(c+="morph-normals:");var p=this.cache.get(c);p||(p=n.clone(),s&&(p.skinning=!0),i&&(p.vertexColors=!0),o&&(p.flatShading=!0),a&&(p.morphTargets=!0),u&&(p.morphNormals=!0),r&&(p.vertexTangents=!0,p.normalScale&&(p.normalScale.y*=-1),p.clearcoatNormalScale&&(p.clearcoatNormalScale.y*=-1)),this.cache.add(c,p),this.associations.set(p,this.associations.get(n))),n=p}n.aoMap&&void 0===e.attributes.uv2&&void 0!==e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv),t.material=n},j.prototype.getMaterialType=function(){return gl},j.prototype.loadMaterial=function(t){var e,r=this,i=this.json,o=this.extensions,s=i.materials[t],a={},u=s.extensions||{},c=[];if(u[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var l=o[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];e=l.getMaterialType(),c.push(l.extendParams(a,s,r))}else if(u[n.KHR_MATERIALS_UNLIT]){var h=o[n.KHR_MATERIALS_UNLIT];e=h.getMaterialType(),c.push(h.extendParams(a,s,r))}else{var p=s.pbrMetallicRoughness||{};if(a.color=new ki(1,1,1),a.opacity=1,Array.isArray(p.baseColorFactor)){var f=p.baseColorFactor;a.color.fromArray(f),a.opacity=f[3]}void 0!==p.baseColorTexture&&c.push(r.assignTexture(a,"map",p.baseColorTexture)),a.metalness=void 0!==p.metallicFactor?p.metallicFactor:1,a.roughness=void 0!==p.roughnessFactor?p.roughnessFactor:1,void 0!==p.metallicRoughnessTexture&&(c.push(r.assignTexture(a,"metalnessMap",p.metallicRoughnessTexture)),c.push(r.assignTexture(a,"roughnessMap",p.metallicRoughnessTexture))),e=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),c.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,a)}))))}!0===s.doubleSided&&(a.side=L);var d=s.alphaMode||F;return d===k?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===N&&(a.alphaTest=void 0!==s.alphaCutoff?s.alphaCutoff:.5)),void 0!==s.normalTexture&&e!==Gi&&(c.push(r.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new er(1,-1),void 0!==s.normalTexture.scale&&a.normalScale.set(s.normalTexture.scale,-s.normalTexture.scale)),void 0!==s.occlusionTexture&&e!==Gi&&(c.push(r.assignTexture(a,"aoMap",s.occlusionTexture)),void 0!==s.occlusionTexture.strength&&(a.aoMapIntensity=s.occlusionTexture.strength)),void 0!==s.emissiveFactor&&e!==Gi&&(a.emissive=(new ki).fromArray(s.emissiveFactor)),void 0!==s.emissiveTexture&&e!==Gi&&c.push(r.assignTexture(a,"emissiveMap",s.emissiveTexture)),Promise.all(c).then((function(){var i;return i=e===m?o[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(a):new e(a),s.name&&(i.name=s.name),i.map&&(i.map.encoding=fn),i.emissiveMap&&(i.emissiveMap.encoding=fn),z(i,s),r.associations.set(i,{type:"materials",index:t}),s.extensions&&U(o,i,s),i}))},j.prototype.createUniqueName=function(t){for(var e=Rp.sanitizeNodeName(t||""),n=e,r=1;this.nodeNamesUsed[n];++r)n=e+"_"+r;return this.nodeNamesUsed[n]=!0,n},j.prototype.loadGeometries=function(t){var e=this,r=this.extensions,i=this.primitiveCache;function o(t){return r[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then((function(n){return W(n,t,e)}))}for(var s,a,u=[],c=0,l=t.length;c<l;c++){var h,p=t[c],f=(a=void 0,(a=(s=p).extensions&&s.extensions[n.KHR_DRACO_MESH_COMPRESSION])?"draco:"+a.bufferView+":"+a.indices+":"+V(a.attributes):s.indices+":"+V(s.attributes)+":"+s.mode),d=i[f];if(d)u.push(d.promise);else h=p.extensions&&p.extensions[n.KHR_DRACO_MESH_COMPRESSION]?o(p):W(new co,p,e),i[f]={primitive:p,promise:h},u.push(h)}return Promise.all(u)},j.prototype.loadMesh=function(t){for(var e,n=this,r=this.json,i=this.extensions,o=r.meshes[t],s=o.primitives,a=[],u=0,c=s.length;u<c;u++){var l=void 0===s[u].material?(void 0===(e=this.cache).DefaultMaterial&&(e.DefaultMaterial=new gl({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:P})),e.DefaultMaterial):this.getDependency("material",s[u].material);a.push(l)}return a.push(n.loadGeometries(s)),Promise.all(a).then((function(e){for(var r=e.slice(0,e.length-1),a=e[e.length-1],u=[],c=0,l=a.length;c<l;c++){var h,p=a[c],f=s[c],d=r[c];if(f.mode===E||f.mode===S||f.mode===A||void 0===f.mode)!0!==(h=!0===o.isSkinnedMesh?new Bu(p,d):new To(p,d)).isSkinnedMesh||h.geometry.attributes.skinWeight.normalized||h.normalizeSkinWeights(),f.mode===S?h.geometry=q(h.geometry,ln):f.mode===A&&(h.geometry=q(h.geometry,hn));else if(f.mode===_)h=new tc(p,d);else if(f.mode===M)h=new Qu(p,d);else if(f.mode===w)h=new ec(p,d);else{if(f.mode!==b)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);h=new ac(p,d)}Object.keys(h.geometry.morphAttributes).length>0&&H(h,o),h.name=n.createUniqueName(o.name||"mesh_"+t),z(h,o),f.extensions&&U(i,h,f),n.assignFinalMaterial(h),u.push(h)}if(1===u.length)return u[0];var g=new $a;for(c=0,l=u.length;c<l;c++)g.add(u[c]);return g}))},j.prototype.loadCamera=function(t){var e,n=this.json.cameras[t],r=n[n.type];if(r)return"perspective"===n.type?e=new Fo(tr.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===n.type&&(e=new Oh(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),z(e,n),Promise.resolve(e);console.warn("THREE.GLTFLoader: Missing camera parameters.")},j.prototype.loadSkin=function(t){var e=this.json.skins[t],n={joints:e.joints};return void 0===e.inverseBindMatrices?Promise.resolve(n):this.getDependency("accessor",e.inverseBindMatrices).then((function(t){return n.inverseBindMatrices=t,n}))},j.prototype.loadAnimation=function(t){for(var e=this.json.animations[t],n=[],r=[],i=[],o=[],s=[],a=0,u=e.channels.length;a<u;a++){var c=e.channels[a],l=e.samplers[c.sampler],h=c.target,p=void 0!==h.node?h.node:h.id,f=void 0!==e.parameters?e.parameters[l.input]:l.input,d=void 0!==e.parameters?e.parameters[l.output]:l.output;n.push(this.getDependency("node",p)),r.push(this.getDependency("accessor",f)),i.push(this.getDependency("accessor",d)),o.push(l),s.push(h)}return Promise.all([Promise.all(n),Promise.all(r),Promise.all(i),Promise.all(o),Promise.all(s)]).then((function(n){for(var r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],u=[],c=0,l=r.length;c<l;c++){var h=r[c],p=i[c],f=o[c],d=s[c],g=a[c];if(void 0!==h){var m;switch(h.updateMatrix(),h.matrixAutoUpdate=!0,D[g.path]){case D.weights:m=Rl;break;case D.rotation:m=Dl;break;case D.position:case D.scale:default:m=Fl}var v=h.name?h.name:h.uuid,y=void 0!==d.interpolation?B[d.interpolation]:en,b=[];D[g.path]===D.weights?h.traverse((function(t){!0===t.isMesh&&t.morphTargetInfluences&&b.push(t.name?t.name:t.uuid)})):b.push(v);var _=f.array;if(f.normalized){var w;if(_.constructor===Int8Array)w=1/127;else if(_.constructor===Uint8Array)w=1/255;else if(_.constructor==Int16Array)w=1/32767;else{if(_.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");w=1/65535}for(var M=new Float32Array(_.length),E=0,S=_.length;E<S;E++)M[E]=_[E]*w;_=M}for(E=0,S=b.length;E<S;E++){var A=new m(b[E]+"."+D[g.path],p.array,_,y);"CUBICSPLINE"===d.interpolation&&(A.createInterpolant=function(t){return new x(this.times,this.values,this.getValueSize()/3,t)},A.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(A)}}}var C=e.name?e.name:"animation_"+t;return new Nl(C,void 0,u)}))},j.prototype.loadNode=function(t){var e,n=this.json,r=this.extensions,i=this,o=n.nodes[t],s=o.name?i.createUniqueName(o.name):"";return(e=[],void 0!==o.mesh&&e.push(i.getDependency("mesh",o.mesh).then((function(t){var e=i._getNodeRef(i.meshCache,o.mesh,t);return void 0!==o.weights&&e.traverse((function(t){if(t.isMesh)for(var e=0,n=o.weights.length;e<n;e++)t.morphTargetInfluences[e]=o.weights[e]})),e}))),void 0!==o.camera&&e.push(i.getDependency("camera",o.camera).then((function(t){return i._getNodeRef(i.cameraCache,o.camera,t)}))),i._invokeAll((function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)})).forEach((function(t){e.push(t)})),Promise.all(e)).then((function(e){var n;if((n=!0===o.isBone?new Fu:e.length>1?new $a:1===e.length?e[0]:new di)!==e[0])for(var a=0,u=e.length;a<u;a++)n.add(e[a]);if(o.name&&(n.userData.name=o.name,n.name=s),z(n,o),o.extensions&&U(r,n,o),void 0!==o.matrix){var c=new Vr;c.fromArray(o.matrix),n.applyMatrix4(c)}else void 0!==o.translation&&n.position.fromArray(o.translation),void 0!==o.rotation&&n.quaternion.fromArray(o.rotation),void 0!==o.scale&&n.scale.fromArray(o.scale);return i.associations.set(n,{type:"nodes",index:t}),n}))},j.prototype.loadScene=function(){function t(e,n,r,i){var o=r.nodes[e];return i.getDependency("node",e).then((function(t){return void 0===o.skin?t:i.getDependency("skin",o.skin).then((function(t){for(var n=[],r=0,o=(e=t).joints.length;r<o;r++)n.push(i.getDependency("node",e.joints[r]));return Promise.all(n)})).then((function(n){return t.traverse((function(t){if(t.isMesh){for(var r=[],i=[],o=0,s=n.length;o<s;o++){var a=n[o];if(a){r.push(a);var u=new Vr;void 0!==e.inverseBindMatrices&&u.fromArray(e.inverseBindMatrices.array,16*o),i.push(u)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[o])}t.bind(new Gu(r,i),t.matrixWorld)}})),t}));var e})).then((function(e){n.add(e);var s=[];if(o.children)for(var a=o.children,u=0,c=a.length;u<c;u++){var l=a[u];s.push(t(l,e,r,i))}return Promise.all(s)}))}return function(e){var n=this.json,r=this.extensions,i=this.json.scenes[e],o=new $a;i.name&&(o.name=this.createUniqueName(i.name)),z(o,i),i.extensions&&U(r,o,i);for(var s=i.nodes||[],a=[],u=0,c=s.length;u<c;u++)a.push(t(s[u],o,n,this));return Promise.all(a).then((function(){return o}))}}(),t}();class Ob extends eg{constructor(t,e,n){super(),this.reloadTimes=1;const{THREE:r}=Nd.getInstance();this.options=e||{},this.meshes=[],this.meshMaterials=[],this.group=new r.Group,this.add(this.group),t&&this.load(t,0,n),this.initialized=!1,this.loaded=!1}load(t,e=0,n){this.initialized=!1,this.loaded=!1;const r=new Rb;n&&r.setMeshoptDecoder(n);const{THREE:i}=Nd.getInstance();r.load(t,t=>{this.add(t.scene),this.group.add(t.scene),this.loaded=!0,this.initialized=!0,this.needUpdate=!0,t.scene.traverse(t=>{t instanceof i.Mesh&&(this.meshes.push(t),this.meshMaterials.push(t.material))}),this.setOptions(this.options),this.emit(Ud.ELEMENT_LOADED,this)},void 0,r=>{const i=e+1;i>this.reloadTimes?this.emit(Ud.ELEMENT_LOADED_ERROR,this,r):this.load(t,i,n)})}setOptions(t){const{THREE:e}=Nd.getInstance();this.meshes.forEach(e=>{t.renderOrder&&(e.renderOrder=t.renderOrder)}),this.meshMaterials.forEach(n=>{n.depthTest=!!t.depthTest,n.transparent=!!t.transparent,t.fillColor&&(n.color=new e.Color(t.fillColor))}),this.options=Object.assign(Object.assign({},t),this.options)}setSacle(t){this.meshes.forEach(e=>{e.geometry.scale(t,t,t)}),this.needUpdate=!0}setOnCurrentViewChanged(t){this.eventListeners={onCurrentViewChanged:t}}update(){const t=new tg(this);return!this.initialized&&this.loaded&&(this.initialized=!0,t.needUpdate=!0),this.initialized&&!this.parent&&(t.shouldPlaceElement=!0),t}dispose(){super.dispose(),ky.dispose(this,!0)}}class Db extends eg{constructor(t){super(),this.domElement=t,this.wrapper=document.createElement("div"),this.wrapper.appendChild(this.domElement),this.cssObject=new eb(this.wrapper),this.add(this.cssObject),this.up.set(0,0,1),this.initialzed=!0,this.visibleRadius=1/0}setWrapperCSSClass(t){this.wrapper.className=t}setWrapperDomID(t){this.wrapper.id=t}update(){const t=new tg(this);return this.initialzed&&(t.shouldPlaceElement=!0,this.initialzed=!1),this.needUpdate&&(t.needUpdate=!0,this.needUpdate=!1),t}}class Bb extends Db{constructor(){super(document.createElement("div"));const{THREE:t}=Nd.getInstance();this.boundingBox=document.createElement("div"),this.textElement=document.createElement("div"),this.imageElement=document.createElement("img"),this.textPositionInfo={anchor:"center",offsetX:0,offsetY:0},this.imagePositionInfo={anchor:"center",offsetX:0,offsetY:0},this.imageElement.setAttribute("draggable","false"),this.textElement.style.cssText="\n position: absolute;\n transform: translate(-50%, -50%);\n white-space: nowrap;\n border-style: solid;\n border-width: 0;\n border-color: white;\n line-height: 1.5;\n ",this.imageElement.style.cssText="\n position: absolute;\n transform: translate(-50%, -50%);\n ",this.boundingBox.style.cssText="\n position: absolute;\n transform: translate(-50%, -50%);\n display: none;\n border-style: solid;\n border-width: 2px;\n border-color: red;\n border-radius: 4px;\n pointer-events: none;\n ",this.status="idle",this.mouseStart=new t.Vector2,this.mouseEnd=new t.Vector2,this.listeners={onImageLoaded:()=>{this.onImageLoaded()},onMouseDown:t=>{this.onMouseDown(t)},onMouseMove:t=>{this.onMouseMove(t)},onMouseUp:t=>{this.onMouseUp(t)},onTouchStart:t=>{this.onTouchStart(t)},onTouchMove:t=>{this.onTouchMove(t)},onTouchEnd:t=>{this.onTouchEnd(t)}},this.registerListeners(),this.domElement.appendChild(this.imageElement),this.domElement.appendChild(this.textElement),this.domElement.appendChild(this.boundingBox),this.calcBBoxNextFrame=!0}updateTextTransform(){const{offsetX:t,offsetY:e,anchor:n}=this.textPositionInfo,{x:r,y:i}=Bb.ANCHOR_MAP[n];this.textElement.style.transform=`translate(${r}, ${i}) translate(${t}px, ${e}px)`}updateImageTransform(){const{offsetX:t,offsetY:e,anchor:n}=this.imagePositionInfo,{x:r,y:i}=Bb.ANCHOR_MAP[n];this.imageElement.style.transform=`translate(${r}, ${i}) translate(${t}px, ${e}px)`}calcBBox(){if(!this.visible||"none"===this.boundingBox.style.display)return;const t=this.domElement.getBoundingClientRect(),e=this.textElement.getBoundingClientRect(),n=this.imageElement.getBoundingClientRect(),{left:r,right:i,top:o,bottom:s}=e,{left:a,right:u,top:c,bottom:l}=n,h=[],{THREE:p}=Nd.getInstance();"none"!==this.textElement.style.display&&(h.push(new p.Vector2(r,o)),h.push(new p.Vector2(i,s))),"none"!==this.imageElement.style.display&&(h.push(new p.Vector2(a,c)),h.push(new p.Vector2(u,l)));let f=0,d=0,g=0,m=0;if(h.length){const e=(new p.Box2).setFromPoints(h),{x:n,y:r}=t;f=e.max.x-e.min.x+12,d=e.max.y-e.min.y+12,g=e.min.x-n-6,m=e.min.y-r-6}this.boundingBox.style.transform=`translate(${g}px, ${m}px)`,this.boundingBox.style.width=f+"px",this.boundingBox.style.height=d+"px"}registerListeners(){this.imageElement.addEventListener("load",this.listeners.onImageLoaded),this.imageElement.addEventListener("pointerdown",this.listeners.onMouseDown),this.imageElement.addEventListener("touchstart",this.listeners.onTouchStart),this.imageElement.addEventListener("touchmove",this.listeners.onTouchMove),this.imageElement.addEventListener("touchend",this.listeners.onTouchEnd),this.textElement.addEventListener("pointerdown",this.listeners.onMouseDown),this.textElement.addEventListener("touchstart",this.listeners.onTouchStart),this.textElement.addEventListener("touchmove",this.listeners.onTouchMove),this.textElement.addEventListener("touchend",this.listeners.onTouchEnd)}unregisterListeners(){this.imageElement.removeEventListener("load",this.listeners.onImageLoaded),this.imageElement.removeEventListener("pointerdown",this.listeners.onMouseDown),this.imageElement.removeEventListener("touchstart",this.listeners.onTouchStart),this.imageElement.removeEventListener("touchmove",this.listeners.onTouchMove),this.imageElement.removeEventListener("touchend",this.listeners.onTouchEnd),this.textElement.removeEventListener("pointerdown",this.listeners.onMouseDown),this.textElement.removeEventListener("touchstart",this.listeners.onTouchStart),this.textElement.removeEventListener("touchmove",this.listeners.onTouchMove),this.textElement.removeEventListener("touchend",this.listeners.onTouchEnd)}onImageLoaded(){""===this.imageElement.style.width&&(this.imageElement.style.width=this.imageElement.width+"px"),""===this.imageElement.style.height&&(this.imageElement.style.height=this.imageElement.height+"px"),this.calcBBoxNextFrame=!0}onMouseDown(t){"idle"===this.status&&"mouse"===t.pointerType&&0===t.button&&(this.mouseStart.set(t.clientX,t.clientY),this.emit(Ud.LABEL_DOWN,this,null,0),this.imageElement.ownerDocument.addEventListener("pointermove",this.listeners.onMouseMove),this.imageElement.ownerDocument.addEventListener("pointerup",this.listeners.onMouseUp),this.status="down")}onMouseMove(t){"down"===this.status&&"mouse"===t.pointerType&&0===t.button&&(this.status="move")}onMouseUp(t){"idle"!==this.status&&"mouse"===t.pointerType&&(this.mouseEnd.set(t.clientX,t.clientY),("down"===this.status||this.mouseStart.distanceToSquared(this.mouseEnd)<100)&&this.emit(Ud.ELEMENT_SELECTED,this,null,0),this.imageElement.ownerDocument.removeEventListener("pointermove",this.listeners.onMouseMove),this.imageElement.ownerDocument.removeEventListener("pointerup",this.listeners.onMouseUp),this.status="idle")}onTouchStart(t){"idle"!==this.status||t.touches.length>1||(this.mouseStart.set(t.touches[0].pageX,t.touches[0].pageY),this.emit(Ud.LABEL_DOWN,this,null,0),this.status="down")}onTouchMove(t){"down"!==this.status||t.touches.length>1||(this.status="move")}onTouchEnd(t){"idle"!==this.status&&(this.mouseEnd.set(t.changedTouches[0].pageX,t.changedTouches[0].pageY),("down"===this.status||this.mouseStart.distanceToSquared(this.mouseEnd)<100)&&this.emit(Ud.ELEMENT_SELECTED,this,null,0),this.status="idle")}setAttributes({labelAttrs:t,imageAttrs:e,textAttrs:n}){void 0!==t&&this.setLabelAttrs(t),void 0!==e&&this.setImageAttrs(e),void 0!==n&&this.setTextAttrs(n)}setLabelAttrs(t){void 0!==t.position&&this.setPosition(t.position),void 0!==t.visible&&this.setVisible(t.visible),void 0!==t.bBoxVisible&&this.setBBoxVisible(t.bBoxVisible),void 0!==t.bBoxBorderWidth&&this.setBBoxBorderWidth(t.bBoxBorderWidth),void 0!==t.bBoxBorderColor&&this.setBBoxBorderColor(t.bBoxBorderColor)}setPosition(t){this.position.copy(t),this.needUpdate=!0}setVisible(t){this.visible=t,this.cssObject.visible=t,this.needUpdate=!0}setBBoxVisible(t){this.boundingBox.style.display=t?"block":"none",t&&(this.calcBBoxNextFrame=!0)}setBBoxBorderWidth(t){this.boundingBox.style.borderWidth=t+"px"}setBBoxBorderColor(t){this.boundingBox.style.borderColor=t}setImageAttrs(t){void 0!==t.src&&this.setImageSource(t.src),void 0!==t.visible&&this.setImageVisible(t.visible),void 0!==t.size&&this.setImageSize(t.size.width,t.size.height),void 0!==t.anchor&&this.setImageAnchor(t.anchor),void 0!==t.offset&&this.setImageOffset(t.offset.x,t.offset.y)}setImageVisible(t){this.imageElement.style.display=t?"block":"none"}setImageSource(t){this.imageElement.src=t}setImageSize(t,e){this.imageElement.style.height=e+"px",this.imageElement.style.width=t+"px",this.calcBBoxNextFrame=!0}setImageAnchor(t){this.imagePositionInfo.anchor=t,this.updateImageTransform(),this.calcBBoxNextFrame=!0}setImageOffset(t,e){this.imagePositionInfo.offsetX=t,this.imagePositionInfo.offsetY=e,this.updateImageTransform(),this.calcBBoxNextFrame=!0}setTextAttrs(t){void 0!==t.content&&this.setTextContent(t.content),void 0!==t.visible&&this.setTextVisible(t.visible),void 0!==t.fontSize&&this.setTextFontSize(t.fontSize),void 0!==t.color&&this.setTextColor(t.color),void 0!==t.padding&&this.setTextPadding(t.padding),void 0!==t.anchor&&this.setTextAnchor(t.anchor),void 0!==t.offset&&this.setTextOffset(t.offset.x,t.offset.y),void 0!==t.align&&this.setTextAlign(t.align),void 0!==t.borderWidth&&this.setTextBorderWidth(t.borderWidth),void 0!==t.borderColor&&this.setTextBorderColor(t.borderColor),void 0!==t.borderRadius&&this.setTextBorderRadius(t.borderRadius),void 0!==t.backgroundColor&&this.setTextBackgroundColor(t.backgroundColor)}setTextVisible(t){this.textElement.style.display=t?"block":"none",this.calcBBoxNextFrame=!0}setTextContent(t){this.textElement.innerText=t,this.calcBBoxNextFrame=!0}setTextFontSize(t){this.textElement.style.fontSize=t+"px",this.calcBBoxNextFrame=!0}setTextColor(t){this.textElement.style.color=t}setTextPadding(t){const e={left:0,right:0,top:0,bottom:0};void 0!==t.left&&(e.left=t.left),void 0!==t.right&&(e.right=t.right),void 0!==t.top&&(e.top=t.top),void 0!==t.bottom&&(e.bottom=t.bottom);const{left:n,right:r,top:i,bottom:o}=e;this.textElement.style.padding=`${i}px ${r}px ${o}px ${n}px`,this.calcBBoxNextFrame=!0}setTextAnchor(t){this.textPositionInfo.anchor=t,this.updateTextTransform(),this.calcBBoxNextFrame=!0}setTextOffset(t,e){this.textPositionInfo.offsetX=t,this.textPositionInfo.offsetY=e,this.updateTextTransform(),this.calcBBoxNextFrame=!0}setTextBorderWidth(t){this.textElement.style.borderWidth=t+"px",this.calcBBoxNextFrame=!0}setTextAlign(t){this.textElement.style.textAlign=t}setTextBorderColor(t){this.textElement.style.borderColor=t}setTextBorderRadius(t){this.textElement.style.borderRadius=t+"px"}setTextBackgroundColor(t){this.textElement.style.backgroundColor=t}setLabelID(t){this.labelID=t}update(){const t=new tg(this);return this.needCalcBBox&&this.calcBBox(),this.needCalcBBox=!1,this.calcBBoxNextFrame&&(this.needCalcBBox=!0),this.calcBBoxNextFrame=!1,this.initialzed&&(t.shouldPlaceElement=!0,this.initialzed=!1),this.needUpdate&&(t.needUpdate=!0,this.needUpdate=!1),t}dispose(){this.unregisterListeners(),this.domElement.removeChild(this.boundingBox),this.domElement.removeChild(this.textElement),this.domElement.removeChild(this.imageElement),super.dispose()}}Bb.ANCHOR_MAP={center:{x:"-50%",y:"-50%"},left:{x:"0",y:"-50%"},right:{x:"-100%",y:"-50%"},top:{x:"-50%",y:"0"},bottom:{x:"-50%",y:"-100%"},topleft:{x:"0",y:"0"},topright:{x:"-100%",y:"0"},bottomleft:{x:"0",y:"-100%"},bottomright:{x:"-100%",y:"-100%"}};class Fb{constructor(t){const{THREE:e}=Nd.getInstance();this.count=0,this.playSet=new Set,this.playing=!1,this.listeners={onPlaying:()=>{this.playing=!0},onPaused:()=>{this.playing=!1}};const n=document.createElement("video");n.setAttribute("webkit-playsinline","true"),n.setAttribute("x5-playsinline","true"),n.setAttribute("playsinline","true"),n.setAttribute("crossOrigin","anonymous"),n.setAttribute("autoplay","false"),n.setAttribute("muted","true"),n.muted=!0,n.src=t,n.loop=!0,n.volume=0,n.addEventListener("playing",this.listeners.onPlaying),n.addEventListener("pause",this.listeners.onPaused),this.video=n,this.texture=new e.VideoTexture(this.video)}play(t){this.playSet.size<1&&this.video.play(),t&&this.playSet.add(t)}pause(t){t&&this.playSet.delete(t),0===this.playSet.size&&this.video.pause()}destroy(){this.texture&&this.texture.dispose(),this.video&&(this.video.removeEventListener("playing",this.listeners.onPlaying),this.video.removeEventListener("pause",this.listeners.onPaused),this.video.pause(),this.video.removeAttribute("src"),this.video.load())}}class Nb extends eg{constructor(t){super(),Nb.Videos||(Nb.Videos=new Map),this.initialized=!1,this.up.set(0,0,1),this.visible=!1,this.videoVisible=!1,t&&this.setVideoSrc(t)}static RemoveVideo(t){if(!Nb.Videos.has(t))return;const e=Nb.Videos.get(t);e.count-1==0?(e.destroy(),Nb.Videos.delete(t)):(e.count-=1,Nb.Videos.set(t,e))}static AddVideo(t){if(!Nb.Videos.has(t)){const e=new Fb(t);Nb.Videos.set(t,e)}const e=Nb.Videos.get(t);return e.count+=1,e}createVideoPlane(){const{THREE:t}=Nd.getInstance(),e=new t.PlaneBufferGeometry(1.6,.9),n=new t.MeshBasicMaterial({map:this.video.texture,side:t.DoubleSide,transparent:!1,depthTest:!1,depthWrite:!1});this.videoPlane=new t.Mesh(e,n),this.add(this.videoPlane),this.initialized=!0,this.videoVisible=!0}setVideoSrc(t){const e=Nb.AddVideo(t);this.video&&(this.videoPlane.material.map=null,Nb.RemoveVideo(this.video.video.src)),this.video=e,this.videoPlane&&this.videoPlane.material&&(this.videoPlane.material.map=this.video.texture),this.videoPlane||this.createVideoPlane()}setVideoVisible(t){this.videoVisible=t}setVideoSize(t,e){if(!this.videoPlane)return;const{THREE:n}=Nd.getInstance(),{geometry:r}=this.videoPlane,i=new n.PlaneBufferGeometry(t,e);this.videoPlane.geometry=i,r.dispose()}play(t){this.video&&(this.video.play(t),this.videoPlane.renderOrder=150)}stop(t){this.video&&(this.video.pause(t),this.videoPlane.renderOrder=1)}update(){const t=new tg(this);return this.initialized&&!this.parent&&(t.shouldPlaceElement=!0,t.needUpdate=!0),this.visible=this.videoVisible&&this.video&&this.video.playing,this.visible&&(t.needUpdate=!0),t}dispose(){this.video&&Nb.RemoveVideo(this.video.video.src),super.dispose(),ky.dispose(this,!0)}}class kb extends Qd{init(t,e=t.container){this.container=e,this.parent=t;const{clientWidth:n,clientHeight:r}=this.container;this.renderer=new nb,this.renderer.setSize(n,r),this.renderer.domElement.style.position="absolute",this.renderer.domElement.style.top="0",this.renderer.domElement.style.userSelect="none",this.container.appendChild(this.renderer.domElement)}resize(t,e){this.renderer.setSize(t,e)}setRenderOrder(t){this.renderer.domElement.style.setProperty("z-index",""+t)}update(){return!1}render(){this.parent.camera&&this.renderer.render(this.parent.stage.scene,this.parent.camera)}dispose(){this.container.removeChild(this.renderer.domElement),this.renderer=null,this.container=null}}var Gb,Ub,zb,Hb=function(t,e){for(var n=new $a,r=0,i=e.length;r<i;r++)n.add(new To(t,e[r]));return n};!function(t){t[t.IDLE=0]="IDLE",t[t.DOWN=1]="DOWN",t[t.MOVE=2]="MOVE"}(Gb||(Gb={}));class Vb extends Qd{constructor(t){if(super(),this.needRender=!1,jd.GetEnv()===Fd.Miniapp){if(!t)throw Error("poi-overlay need a offscreenCanvas");Vb.canvas=t}else Vb.canvas||(Vb.canvas=document.createElement("canvas"));const e=jd.GetGlobalDPR();Vb.canvas.width=500*e,Vb.canvas.height=500*e,Vb.ctx=Vb.canvas.getContext("2d")}init(t){const{THREE:e}=Nd.getInstance();this.rectMap=new Map,this.parent=t,this.scene=new e.Scene;const n=t.getViewWidth(),i=t.getViewHeight();this.renderCamera=new r.OrthographicCamera(-n/2,n/2,i/2,-i/2,.1,1e3),this.renderCamera.up.set(0,1,0),this.renderCamera.position.set(0,0,50),this.renderCamera.lookAt(0,0,0),this.camera=this.parent.camera,this.renderer=this.parent.renderer,this.pois=new Set,this.enabled=!0,this.orderPois=ky.debounce(this.orderPoisByLevel.bind(this),50),this.listeners={pointerDown:t=>{this.onPointerDown(t)},pointerUp:t=>{this.onPointerUp(t)},touchStart:t=>{this.onTouchStart(t)},touchEnd:t=>{this.onTouchEnd(t)}},this.mouseState=Gb.IDLE,this.mousePositionBuffer=new e.Vector2,this.parent.on(zd.MOUSE_DOWN,this.listeners.pointerDown),this.parent.on(zd.MOUSE_UP,this.listeners.pointerUp),this.parent.on(zd.TOUCH_START,this.listeners.touchStart),this.parent.on(zd.TOUCH_END,this.listeners.touchEnd)}update(){return!(!this.renderThisFrame&&!Array.from(this.pois).reduce((t,e)=>e.update()||t,!1))&&(this.renderThisFrame=!1,this.needRender=!0,!0)}forceRenderInThisFrame(){this.renderThisFrame=!0}render(){if(!this.enabled)return;const{THREE:t}=Nd.getInstance(),e=new t.Frustum;e.setFromProjectionMatrix((new t.Matrix4).multiplyMatrices(this.parent.camera.projectionMatrix,this.parent.camera.matrixWorldInverse));const n=this.parent.getViewWidth(),r=this.parent.getViewHeight();if((new t.Euler).setFromQuaternion(this.parent.camera.quaternion,"ZYX"),this.checkUpdate(),this.needRender||this.renderThisFrame){this.rectMap.clear();const t=[];this.pois.forEach(i=>{i.draw();const{isInFrustum:o}=i.calcPosAndSize(e,n/2,r/2);o&&t.push(i)}),this.recalculateVisibilities(t),Array.from(this.pois).forEach((t,e)=>{t.updatePosition(n/2,r/2,e)}),this.renderer.clearDepth(),this.renderer.render(this.scene,this.renderCamera)}this.renderThisFrame=!1,this.needRender=!1}orderPoisByLevel(){const t=Array.from(this.pois);t.sort((t,e)=>t.getLevel()-e.getLevel()),this.pois=new Set(t),this.renderThisFrame=!0}recalculateVisibilities(t){const e=[];let n=!0;Array.from(t).sort((t,e)=>e.collision?-1:e.getLevel()-t.getLevel()).forEach(t=>{const{xMin:r,yMin:i,xMax:o,yMax:s}=t.getBoundingRect();if(!t.collision)return t.setHidden(!1),e.push([r,o,i,s]),void(n=!1);const{xMin:a,yMin:u,xMax:c,yMax:l}=t.getOuterRect();if(n)return e.push([r,o,i,s]),n=!1,void t.setHidden(!1);if(!e.some(([t,e,n,a])=>!(o<t||r>e)&&!(s<n||i>a)))e.push([r,o,i,s]),t.setHidden(!1);else if("outer"===t.collisionMode)t.setHidden(!0);else if("icon"===t.collisionMode||"label"===t.collisionMode){!e.some(([t,e,n,r])=>!(c<t||a>e)&&!(l<n||u>r))?(e.push([r,o,i,s]),t.setHidden(!0,!0)):t.setHidden(!0)}})}checkUpdate(){const{THREE:t}=Nd.getInstance();if(this.renderThisFrame)return;if(Array.from(this.pois).some(t=>t.update()))return void(this.renderThisFrame=!0);const{camera:e}=this.parent,{quaternion:n,position:r,zoom:i,up:o}=e,s=r.clone(),a=n.clone(),u=i;if(!this.prevPosition)return this.prevPosition=s.clone(),this.prevQuaternion=a.clone(),this.prevZoom=u,void(this.renderThisFrame=!0);const c=(new t.Quaternion).setFromUnitVectors(o,new t.Vector3(0,1,0)),l=new t.Vector3(0,0,-1).applyQuaternion(this.prevQuaternion);l.applyQuaternion(c);const h=new t.Spherical;h.setFromVector3(l);const p=(new t.Quaternion).setFromUnitVectors(o,new t.Vector3(0,1,0)),f=new t.Vector3(0,0,-1).applyQuaternion(a);f.applyQuaternion(p);const d=new t.Spherical;if(d.setFromVector3(f),Math.abs(h.phi*(180/Math.PI)-d.phi*(180/Math.PI))+Math.abs(h.theta*(180/Math.PI)-d.theta*(180/Math.PI))>1e-4)return this.prevPosition=s.clone(),this.prevQuaternion=a.clone(),this.prevZoom=u,void(this.renderThisFrame=!0);const g=this.parent.getViewWidth(),m=this.parent.getViewHeight(),v=s.clone().project(e),y=(v.x-1)/2*g,x=(1-v.y)/2*m;v.set(y,x,0);const b=this.prevPosition.clone().project(e),_=(b.x-1)/2*g,w=(1-b.y)/2*m;return b.set(_,w,0),v.distanceTo(b)>1e-4||this.prevZoom!==u&&Math.abs((u-this.prevZoom)/u)>1e-4||Math.abs((this.prevZoom-u)/this.prevZoom)>1e-4?(this.prevPosition=s.clone(),this.prevQuaternion=a.clone(),this.prevZoom=u,void(this.renderThisFrame=!0)):void(this.renderThisFrame=!1)}dispose(){this.parent.off(zd.MOUSE_DOWN,this.listeners.pointerDown),this.parent.off(zd.MOUSE_UP,this.listeners.pointerUp),this.parent.off(zd.TOUCH_START,this.listeners.touchStart),this.parent.off(zd.TOUCH_END,this.listeners.touchEnd),this.clearPoi(),Vb.canvas&&(Vb.canvas.remove(),Vb.canvas=null),Vb.ctx&&(Vb.ctx=null)}onPointerDown(t){const{clientX:e,clientY:n}=t,[i,o]=this.parent.getViewOffset(),s=e-i,a=n-o;let u=null;Array.from(this.rectMap).some(([t,e])=>{const{xMin:n,yMin:i,xMax:o,yMax:c}=t;return!!new r.Box2(new r.Vector2(n,i),new r.Vector2(o,c)).containsPoint(new r.Vector2(s,a))&&(u=e,!0)}),u&&this.onNodePointerDown(u,s,a,t.button)}onPointerUp(t){const{THREE:e}=Nd.getInstance(),{clientX:n,clientY:r}=t,[i,o]=this.parent.getViewOffset(),s=n-i,a=r-o,u=new e.Vector2(s,a).distanceToSquared(this.mousePositionBuffer);this.emit(Ud.POI_UP,this.eventTarget,t.button),this.mouseState===Gb.DOWN&&u<100&&this.emit(Ud.POI_CLICKED,this.eventTarget,t.button),this.mouseState=Gb.IDLE}onTouchStart(t){const{clientX:e,clientY:n}=t.touches[0],[i,o]=this.parent.getViewOffset(),s=e-i,a=n-o;let u=null;Array.from(this.rectMap).some(([t,e])=>{const{xMin:n,yMin:i,xMax:o,yMax:c}=t;return!!new r.Box2(new r.Vector2(n,i),new r.Vector2(o,c)).containsPoint(new r.Vector2(s,a))&&(u=e,!0)}),u&&this.onNodePointerDown(u,s,a,0)}onTouchEnd(t){const{THREE:e}=Nd.getInstance(),{clientX:n,clientY:r}=t.changedTouches[0],[i,o]=this.parent.getViewOffset(),s=n-i,a=r-o,u=new e.Vector2(s,a).distanceToSquared(this.mousePositionBuffer);this.emit(Ud.POI_UP,this.eventTarget,0),this.mouseState===Gb.DOWN&&u<100&&this.emit(Ud.POI_CLICKED,this.eventTarget,0),this.mouseState=Gb.IDLE}onNodePointerDown(t,e,n,r=0){this.mouseState===Gb.IDLE&&(this.mouseState=Gb.DOWN,this.mousePositionBuffer.set(e,n),this.eventTarget=t,this.emit(Ud.POI_DOWN,t,r))}createPoi(t){const e=new jb;if(e.setParent(this),this.renderThisFrame=!0,e.setPosition(t),!this.pois)throw Error("poiOverlay need bind a view, use view.addOverlay()");return this.pois.add(e),this.scene.add(e.group),e}setRectMap(t,e){this.rectMap.set(t,e)}removePoi(t){this.pois.delete(t),this.scene.remove(t.group),t.dispose(),this.renderThisFrame=!0}clearPoi(){Array.from(this.pois).forEach(t=>{this.scene.remove(t.group)}),this.pois.clear(),this.renderThisFrame=!0}setVisibility(t){this.visible=t,this.enabled=t}setEnabled(t){this.enabled=t}resize(t,e){this.updateCameraAspect(t,e),this.renderThisFrame=!0}updateCameraAspect(t,e){const n=t,r=e;this.renderCamera.left=-n/2,this.renderCamera.right=n/2,this.renderCamera.top=r/2,this.renderCamera.bottom=-r/2,this.renderCamera.updateProjectionMatrix()}}Vb.canvas=document.createElement("canvas"),Vb.ctx=Vb.canvas.getContext("2d");class jb{constructor(t){this._renderThisFrame=!1;const{THREE:e}=Nd.getInstance();this.dpr=jd.GetGlobalDPR(),this.isFlipY=!1,this.position=t||new e.Vector3,this.group=new r.Group,this.textVisibility=!0,this.iconVisibility=!0,this.iconInCircle=!1,this.iconCircleOptions={width:0,color:"#ffffff"},this.textPosInfo={anchor:"center",offsetX:0,offsetY:0,anchorOffsetX:0,anchorOffsetY:0},this.iconPosInfo={anchor:"center",offsetX:0,offsetY:0,anchorOffsetX:0,anchorOffsetY:0},this.level=1,this.isInFrustum=!1,this.animationEnabled=!1,this.text=null,this.icon=null,this.rect=null,this.boundingBox=null,this.overlapArea={x:0,y:0},this.visible=!0,this.hide=!1,this.subHide=!1,this.rotation=0,this.autoRotation=!1,this.collision=!0,this.collisionMode="outer",this.iconRect={xMin:0,yMin:0,xMax:0,yMax:0},this.textRect={xMin:0,yMin:0,xMax:0,yMax:0},this.boundingRect={xMin:0,yMin:0,xMax:0,yMax:0},this.outerRect={xMin:0,yMin:0,xMax:0,yMax:0},this.visibilityAnimation={anim:null,from:1,to:1,current:1},this.text=null,this.textWidth=0,this.textHeight=0,this.icon=null,this.iconOptions={size:[20,20],src:null},this.labelOptions={fontSize:12,padding:0,content:null},this.rectOptions={width:0,height:0,fill:16711680,opacity:.5,offsetX:0,offsetY:0},this.visiblePartWhenCollision="none",this.subAreaOpacity=1,this.abandonedAreaOpacity=1,this.screenPosition={x:0,y:0},this.labelOpacity=1,this.iconOpacity=1}set renderThisFrame(t){this._renderThisFrame=t}get renderThisFrame(){return this._renderThisFrame}dispose(){this.group&&ky.dispose(this.group,!0),this.parent=null,this.iconCircleMaterial=null,this.iconMaterial=null,this.textMaterial=null,this.icon=null,this.rect=null,this.boundingBox=null,this.group=null}setParent(t){this.parent=t}setPosition(t,e=1e-4){t.distanceTo(this.position)<e||(this.position.copy(t),this.renderThisFrame=!0)}setOpacity(t=this.labelOpacity,e=this.iconOpacity){this.labelOpacity=t,this.iconOpacity=e}setRotation(t,e=1e-4){Math.abs(t-this.rotation)<e||(this.group.rotateZ(t-this.rotation),this.rotation=t,this.renderThisFrame=!0)}setCollision(t){this.collision=t,this.renderThisFrame=!0}setCollisionMode(t){this.collisionMode=t,this.renderThisFrame=!0}setLabelVisibility(t){this.textVisibility=t,this.renderThisFrame=!0}setIconVisiblity(t){this.iconVisibility=t,this.renderThisFrame=!0}setHideModeWhenCollision(t){"all"===t?this.setVisiblePartWhenCollision("none"):"none"===t?this.setVisiblePartWhenCollision("all"):this.setVisiblePartWhenCollision(t)}setVisiblePartWhenCollision(t){this.visiblePartWhenCollision=t}setCollisionOverlap(t,e){this.overlapArea={x:t,y:e},this.renderThisFrame=!0}setLevel(t,e=!1){this.level=t,this.renderThisFrame=!0,this.parent.orderPois(e)}getLevel(){return this.level}setVisibility(t){this.visible!==t&&(this.renderThisFrame=!0),this.visible=t}setHidden(t,e=!1){if(this.animationEnabled){const n=t?e?.5:0:1;if(this.visibilityAnimation.anim&&n===this.visibilityAnimation.to)return;if(!this.visibilityAnimation.anim&&t===this.hide&&e===this.subHide)return;this.visibilityAnimation.anim&&(this.visibilityAnimation.anim.stop(),this.visibilityAnimation.anim=null);const r={subAreaOpacity:this.subAreaOpacity,abandonedAreaOpacity:this.abandonedAreaOpacity},i={subAreaOpacity:0,abandonedAreaOpacity:0};t?e?(i.subAreaOpacity=1,i.abandonedAreaOpacity=0):(i.subAreaOpacity=0,i.abandonedAreaOpacity=0):(i.subAreaOpacity=1,i.abandonedAreaOpacity=1);let o=[];const s=[];switch(this.visiblePartWhenCollision){case"all":this.text&&o.push(this.textMaterial),this.icon&&(o.push(this.iconMaterial),this.iconCircleMaterial&&this.iconCircleMaterial.visible&&o.push(this.iconCircleMaterial));break;case"none":this.text&&s.push(this.textMaterial),this.icon&&(s.push(this.iconMaterial),this.iconCircleMaterial&&this.iconCircleMaterial.visible&&s.push(this.iconCircleMaterial));break;case"label":o=[this.textMaterial,this.rectMaterial],this.text&&o.push(this.textMaterial),this.icon&&(s.push(this.iconMaterial),this.iconCircleMaterial&&this.iconCircleMaterial.visible&&s.push(this.iconCircleMaterial));break;case"icon":this.text&&s.push(this.textMaterial),this.icon&&(o.push(this.iconMaterial),this.iconCircleMaterial&&this.iconCircleMaterial.visible&&o.push(this.iconCircleMaterial))}this.visibilityAnimation.from=this.visibilityAnimation.current,this.visibilityAnimation.to=t?e?.5:0:1;const a=300;this.visibilityAnimation.anim=new v.a.Tween(r).to(i,a).onUpdate(t=>{this.subAreaOpacity=t.subAreaOpacity,this.abandonedAreaOpacity=t.abandonedAreaOpacity,o.forEach(e=>{e.opacity=t.subAreaOpacity}),s.forEach(e=>{e.opacity=t.abandonedAreaOpacity})}).start().onComplete(()=>{this.visibilityAnimation.anim=null,this.visibilityAnimation.from=null,this.visibilityAnimation.current=null,this.visibilityAnimation.to=null,this.hide=t,this.subHide=e})}else this.hide===t&&this.subHide===e||(this.hide=t,this.subHide=e,this.renderThisFrame=!0)}setRect(t){this.withRect=t,this.renderThisFrame=!0}setRectDefSize(t,e){this.rectOptions.width=t,this.rectOptions.height=e,this.renderThisFrame=!0}setRectFill(t){this.rectOptions.fill=t,this.renderThisFrame=!0}setRectOffset(t=0,e=0){this.rectOptions.offsetX=t,this.rectOptions.offsetY=e,this.renderThisFrame=!0}setIconImage(t){this.iconOptions&&this.iconOptions.src===t||(this.iconOptions.src=t,this.clearIcon(),this.renderThisFrame=!0)}setIconSize(t,e){this.iconSize=[t,e],this.iconOptions.size=[t,e],this.renderThisFrame=!0}setIconShowInCircle(t,e){this.iconInCircle=!0,this.iconCircleOptions={width:t,color:e}}drawIcon(){const{src:t,size:e}=this.iconOptions;if(t&&(!this.icon||!this.group.getObjectByName("poi_icon")||!!this.iconInCircle!=!!this.iconCircleMaterial))if(jb.ImageMaterialMap.has(t))if("dealing"===jb.ImageMaterialMap.get(t))this.renderThisFrame=!0;else{this.icon&&this.group.remove(this.icon),this.iconMaterial=jb.ImageMaterialMap.get(t).clone(),this.iconMaterial.opacity=this.iconOpacity;const{width:n,color:i}=this.iconCircleOptions,o=n&&this.iconInCircle;o&&(this.iconCircleMaterial=new r.MeshBasicMaterial({color:i,transparent:!0,opacity:this.iconOpacity}));const s=o?[this.iconCircleMaterial,this.iconMaterial]:[this.iconMaterial],a=o?new r.CircleGeometry(e[0]/2,30):new r.PlaneGeometry(e[0],e[1]),u=Hb(a,s);this.icon=u,this.icon&&(this.icon.children.length>1&&this.icon.children[1].scale.set(e[0]/(n+e[0]),e[0]/(n+e[0]),1),this.icon.renderOrder=3,this.icon.name="poi_icon",this.group.add(this.icon),this.renderThisFrame=!0)}else{jb.ImageMaterialMap.set(t,"dealing");(new r.TextureLoader).load(t,e=>{e.needsUpdate=!0,e.magFilter=r.LinearFilter,e.minFilter=r.NearestFilter,e.flipY=this.isFlipY;const n=new r.MeshBasicMaterial({map:e,transparent:!0,opacity:this.iconOpacity});n.needsUpdate=!0,n.visible=!0,jb.ImageMaterialMap.set(t,n)})}}clearIcon(){this.icon&&(this.group&&this.group.remove(this.icon),this.icon.children.forEach(t=>{t.geometry&&t.geometry.dispose()}),this.iconMaterial&&(this.iconMaterial.dispose(),this.iconMaterial=null),this.iconCircleMaterial&&(this.iconCircleMaterial.dispose(),this.iconCircleMaterial=null),this.icon=null)}setIconAnchor(t){this.iconPosInfo.anchor=t,this.renderThisFrame=!0}setIconFlipY(t){this.isFlipY=t}setIconOffset(t,e){this.iconPosInfo.anchorOffsetX=t,this.iconPosInfo.anchorOffsetY=e,this.renderThisFrame=!0}setFontSize(t){this.labelOptions.fontSize=t,this.renderThisFrame=!0}setFontPadding(t){this.labelOptions.padding=t,this.renderThisFrame=!0}setLabelText(t){this.labelOptions.content=t,this.renderThisFrame=!0}drawText(){if(!this.labelOptions.content)return;if(this.group.getObjectByName("poi_text"))return;const t=this.dpr,{fontSize:e,padding:n,content:i}=this.labelOptions;Vb.ctx.font=e*t+"px sans-serif",Vb.ctx.fillStyle="black";const o=Vb.ctx.measureText(i),s=Math.ceil(o.width)+10+2*n,a=(e+5+2*n)*t;this.textWidth=s/t,this.textHeight=a/t,this.setRectDefSize(this.textWidth,this.textHeight),Vb.ctx.clearRect(0,0,s,a),Vb.ctx.fillText(i,n*t,(e+n)*t);const u=Vb.ctx.getImageData(0,0,s,a);this.textMaterial=new r.MeshBasicMaterial({transparent:!0,map:new r.DataTexture(Uint8Array.from(u.data),s,a,r.RGBAFormat),side:r.DoubleSide,opacity:this.labelOpacity}),this.text=new r.Mesh(new r.PlaneGeometry(this.textWidth,this.textHeight),this.textMaterial),this.text.material.map.flipY=!0,this.text.material.map.flipX=!0,this.text.material.map.needsUpdate=!0,this.text.material.map.magFilter=r.LinearFilter,this.text.material.visible=!0,this.text.name="poi_text",this.text.renderOrder=4;const{offsetX:c,offsetY:l}=this.recalcOffset(this.textWidth,this.textHeight,this.textPosInfo.anchor,this.textPosInfo.anchorOffsetX,this.textPosInfo.anchorOffsetY);this.textPosInfo.offsetX=c,this.textPosInfo.offsetY=l,this.group.add(this.text)}recalcOffset(t,e,n,r,i){let o=0,s=0;switch(n){case"center":o=r,s=i;break;case"left":o=t/2+r,s=i;break;case"right":o=-t/2+r,s=i;break;case"top":o=r,s=-e/2+i;break;case"bottom":o=r,s=e/2+i;break;case"topleft":o=t/2+r,s=-e/2+i;break;case"topright":o=-t/2+r,s=-e/2+i;break;case"bottomleft":o=t/2+r,s=e/2+i;break;case"bottomright":o=-t/2+r,s=e/2+i}return{offsetX:o,offsetY:s}}setLabelAnchor(t){this.textPosInfo.anchor=t,this.renderThisFrame=!0}setLabelOffset(t,e){this.textPosInfo.anchorOffsetX=t,this.textPosInfo.anchorOffsetY=e,this.renderThisFrame=!0}getLabelAnchor(){return this.textPosInfo.anchor}getLabelOffset(){const{anchorOffsetX:t,anchorOffsetY:e}=this.textPosInfo;return{x:t,y:e}}calcBoundingSize(){const t=this.screenPosition,e=this.textPosInfo.offsetX,n=this.textPosInfo.offsetY,r=this.iconPosInfo.offsetX,i=this.iconPosInfo.offsetY,o={xMin:this.text?t.x-this.textWidth/2+e:t.x,xMax:this.text?t.x+this.textWidth/2+e:t.x,yMin:this.text?t.y-this.textHeight/2-n:t.y,yMax:this.text?t.y+this.textHeight/2-n:t.y},s={xMin:this.icon?t.x-this.iconOptions.size[0]/2+r:t.x,xMax:this.icon?t.x+this.iconOptions.size[0]/2+r:t.x,yMin:this.icon?t.y-this.iconOptions.size[1]/2-i:t.y,yMax:this.icon?t.y+this.iconOptions.size[1]/2-i:t.y};let a=Math.max(s.xMax,o.xMax),u=Math.min(s.xMin,o.xMin),c=Math.max(s.yMax,o.yMax),l=Math.min(s.yMin,o.yMin);this.iconRect={xMin:this.icon?t.x-this.iconOptions.size[0]/2+r:t.x,xMax:this.icon?t.x+this.iconOptions.size[0]/2+r:t.x,yMin:this.icon?t.y-this.iconOptions.size[1]/2-i:t.y,yMax:this.icon?t.y+this.iconOptions.size[1]/2-i:t.y},this.textRect={xMin:this.text?t.x-this.textWidth/2+e:t.x,xMax:this.text?t.x+this.textWidth/2+e:t.x,yMin:this.text?t.y-this.textHeight/2-n:t.y,yMax:this.text?t.y+this.textHeight/2-n:t.y},this.outerRect={xMax:a,xMin:u,yMax:c,yMin:l},"icon"===this.collisionMode?(a=s.xMax,u=s.xMin,c=s.yMax,l=s.yMin):"label"===this.collisionMode&&(a=o.xMax,u=o.xMin,c=o.yMax,l=o.yMin),this.boundingRect.xMax=a,this.boundingRect.yMax=c,this.boundingRect.xMin=u,this.boundingRect.yMin=l}drawRect(){if(!this.withRect||!this.labelOptions.content)return;if(this.rect&&this.group.getObjectByName("poi_rect"))return;this.rect=new r.Group;const t=this.rectOptions.width||this.textWidth,e=this.rectOptions.height||this.textHeight,n=[0+t/2-10,0+e/2],i=[0+t/2,0+e/2-10],o=[0+t/2,0-e/2+10],s=[0+t/2-10,0-e/2],a=[0-t/2+10,0-e/2],u=[0-t/2,0-e/2+10],c=[0-t/2,0+e/2-10],l=[0-t/2+10,0+e/2],h=new r.Shape;h.moveTo(n[0],n[1]),h.bezierCurveTo(n[0],n[1],0+t/2,0+e/2,i[0],i[1]),h.moveTo(o[0],o[1]),h.bezierCurveTo(o[0],o[1],0+t/2,0-e/2,s[0],s[1]),h.moveTo(a[0],a[1]),h.bezierCurveTo(a[0],a[1],0-t/2,0-e/2,u[0],u[1]),h.moveTo(c[0],c[1]),h.bezierCurveTo(c[0],c[1],0-t/2,0+e/2,l[0],l[1]),h.moveTo(n[0],n[1]);const p=new r.ShapeGeometry(h),f=new r.MeshBasicMaterial({color:255,transparent:!0,opacity:.5});this.rectMaterial=f;const d=new r.Mesh(p,f);h.autoClose=!0;const g=h.getPoints(),m=(new r.BufferGeometry).setFromPoints(g),v=new r.Line(m,new r.LineBasicMaterial({color:16711680}));v.position.set(0,0,0),this.rect.add(d),this.rect.add(v),this.rect.renderOrder=2,this.rect.name="poi_rect",this.group.add(this.rect)}drawBoundingBox(){if(!this.withBoundingBox)return;if(this.group.getObjectByName("poi_bounding_rect"))return;if(0===this.outerRect.xMin&&0===this.outerRect.xMax)return;const{xMax:t,yMax:e,xMin:n,yMin:i}=this.outerRect;this.boundingBox=new r.Group;const o=t-n,s=e-i,a=[0+o/2-10,0+s/2],u=[0+o/2,0+s/2-10],c=[0+o/2,0-s/2+10],l=[0+o/2-10,0-s/2],h=[0-o/2+10,0-s/2],p=[0-o/2,0-s/2+10],f=[0-o/2,0+s/2-10],d=[0-o/2+10,0+s/2],g=new r.Shape;g.moveTo(a[0],a[1]),g.bezierCurveTo(a[0],a[1],0+o/2,0+s/2,u[0],u[1]),g.moveTo(c[0],c[1]),g.bezierCurveTo(c[0],c[1],0+o/2,0-s/2,l[0],l[1]),g.moveTo(h[0],h[1]),g.bezierCurveTo(h[0],h[1],0-o/2,0-s/2,p[0],p[1]),g.moveTo(f[0],f[1]),g.bezierCurveTo(f[0],f[1],0-o/2,0+s/2,d[0],d[1]),g.moveTo(a[0],a[1]);const m=new r.ShapeGeometry(g),v=new r.MeshBasicMaterial({color:16711680,transparent:!0,opacity:.5}),y=new r.Mesh(m,v);g.autoClose=!0;const x=g.getPoints(),b=(new r.BufferGeometry).setFromPoints(x),_=new r.Line(b,new r.LineBasicMaterial({color:16711680,linewidth:2}));_.position.set(0,0,0),this.boundingBox.name="poi_bounding_rect",this.boundingBox.add(y),this.boundingBox.add(_),this.boundingBox.renderOrder=0,this.group.add(this.boundingBox)}setBoundingBox(){this.withBoundingBox=!0}getBoundingRect(){const{x:t,y:e}=this.overlapArea,{xMin:n,yMin:r,xMax:i,yMax:o}=this.boundingRect;return{xMin:n+t,yMin:r+e,xMax:i-t,yMax:o-e}}getOuterRect(){const{x:t,y:e}=this.overlapArea,{xMin:n,yMin:r,xMax:i,yMax:o}=this.outerRect;return{xMin:n+t,yMin:r+e,xMax:i-t,yMax:o-e}}setAnimationEnabled(t){this.animationEnabled=t}calcPoiRotation(t){return this.autoRotation?t+this.rotation:this.rotation}getVisibility(){return this.visible}calcPosAndSize(t,e,n){if(!this.parent)return{isInFrustum:this.isInFrustum};let r=this.visible&&t.containsPoint(this.position);if(r){const t=this.position.clone().project(this.parent.camera);this.screenPosition={x:(t.x+1)*e,y:(1-t.y)*n},this.calcBoundingSize(),(this.outerRect.xMin<0||this.outerRect.xMax>2*e||this.outerRect.yMin<0||this.outerRect.yMax>2*n)&&(r=!1)}return this.isInFrustum=r,{isInFrustum:this.isInFrustum}}draw(){this.drawText(),this.drawIcon(),this.drawRect(),this.drawBoundingBox()}updatePosition(t,e,n){if(!this.group)return;if(!this.isInFrustum)return this.hide=!0,this.subHide=!1,void(this.group.visible=!1);if(this.group.visible=this.visible,!this.visible)return;const i=this.textPosInfo.offsetX,o=this.textPosInfo.offsetY,s=this.iconPosInfo.offsetX,a=this.iconPosInfo.offsetY,u=1e-4*n;if(this.group.position.set(this.screenPosition.x-t,e-this.screenPosition.y,u),this.text&&this.text.position.set(i,o,0),this.rect&&this.rect.position.set(i,o,0),this.icon&&this.icon.position.set(s,a,0),this.boundingBox){const t=(this.outerRect.xMax+this.outerRect.xMin)/2,e=(this.outerRect.yMax+this.outerRect.yMin)/2;this.boundingBox.position.set(t-this.screenPosition.x,this.screenPosition.y-e,0)}const c=this.visibilityAnimation.anim,l=!!c||!c&&(!this.hide||this.subHide);if(this.group.visible=l,l&&(!c||!this.animationEnabled)){let t=[],e=[];switch(this.visiblePartWhenCollision){case"all":t=[this.group],e=[];break;case"none":t=[],e=[this.group];break;case"label":t=[],this.text&&t.push(this.text),this.rect&&t.push(this.rect),this.icon&&e.push(this.icon);break;case"icon":this.icon&&t.push(this.icon),this.text&&e.push(this.text),this.rect&&e.push(this.rect);break;default:t=[],e=[this.group]}this.subHide?(t.forEach(t=>{t.visible=!0,t instanceof r.Group&&t.children.forEach(t=>{t.visible=!0})}),e.forEach(t=>{t.visible=!1,t instanceof r.Group&&t.children.forEach(t=>{t.visible=!1})})):this.hide||(t.forEach(t=>{t.visible=!0,t instanceof r.Group&&t.children.forEach(t=>{t.visible=!0})}),e.forEach(t=>{t.visible=!0,t instanceof r.Group&&t.children.forEach(t=>{t.visible=!0})})),this.icon&&!this.iconVisibility&&(this.icon.visible=!1),this.text&&!this.textVisibility&&(this.text.visible=!1)}l&&(this.subHide?this.parent&&("icon"===this.visiblePartWhenCollision?this.parent.setRectMap(this.iconRect,this):this.parent.setRectMap(this.textRect,this)):this.parent&&(this.parent.setRectMap(this.textRect,this),this.parent.setRectMap(this.iconRect,this)))}update(){const t=this.renderThisFrame||this.isInFrustum&&!!this.iconOptions.src&&!this.icon;return this.renderThisFrame=!1,t}setPoiId(t){this.poiId=t}}jb.ImageMaterialMap=new Map,jb.ImageMaterialMap=new Map;!function(t){t[t.IDLE=0]="IDLE",t[t.DOWN=1]="DOWN",t[t.MOVE=2]="MOVE"}(Ub||(Ub={}));!function(t){t[t.IDLE=0]="IDLE",t[t.DOWN=1]="DOWN",t[t.MOVE=2]="MOVE"}(zb||(zb={}));class Wb extends Qd{constructor(t){if(super(),this.needRender=!1,jd.GetEnv()===Fd.Miniapp){if(!t)throw Error("poi-overlay need a offscreenCanvas");Wb.canvas=t}else Wb.canvas||(Wb.canvas=document.createElement("canvas"));const e=jd.GetGlobalDPR();Wb.canvas.width=500*e,Wb.canvas.height=500*e,Wb.ctx=Wb.canvas.getContext("2d")}init(t){const{THREE:e}=Nd.getInstance();this.rectMap=new Map,this.parent=t,this.scene=t.stage.scene;const n=t.getViewWidth(),i=t.getViewHeight();this.renderCamera=new r.OrthographicCamera(-n/2,n/2,i/2,-i/2,.1,1e3),this.renderCamera.up.set(0,1,0),this.renderCamera.position.set(0,0,50),this.renderCamera.lookAt(0,0,0),this.camera=this.parent.camera,this.renderer=this.parent.renderer,this.pois=new Set,this.enabled=!0,this.orderPois=ky.debounce(this.orderPoisByLevel.bind(this),50),this.listeners={pointerDown:t=>{this.onPointerDown(t)},pointerUp:t=>{this.onPointerUp(t)},touchStart:t=>{this.onTouchStart(t)},touchEnd:t=>{this.onTouchEnd(t)}},this.mouseState=zb.IDLE,this.mousePositionBuffer=new e.Vector2,this.parent.on(zd.MOUSE_DOWN,this.listeners.pointerDown),this.parent.on(zd.MOUSE_UP,this.listeners.pointerUp),this.parent.on(zd.TOUCH_START,this.listeners.touchStart),this.parent.on(zd.TOUCH_END,this.listeners.touchEnd)}update(){return!(!this.renderThisFrame&&!Array.from(this.pois).reduce((t,e)=>e.update()||t,!1))&&(this.renderThisFrame=!1,this.needRender=!0,!0)}forceRenderInThisFrame(){this.renderThisFrame=!0}render(){if(!this.enabled)return;const{THREE:t}=Nd.getInstance(),e=new t.Frustum;e.setFromProjectionMatrix((new t.Matrix4).multiplyMatrices(this.parent.camera.projectionMatrix,this.parent.camera.matrixWorldInverse));const n=this.parent.getViewWidth(),r=this.parent.getViewHeight(),i=new t.Euler;if(i.setFromQuaternion(this.parent.camera.quaternion,"ZYX"),this.checkUpdate(),this.needRender||this.renderThisFrame){this.rectMap.clear();const t=[];this.pois.forEach(i=>{i.draw();const{isInFrustum:o}=i.calcPosAndSize(e,n/2,r/2);o&&t.push(i)}),this.recalculateVisibilities(t),Array.from(this.pois).forEach(t=>{t.updatePosition(i,this.parent.camera.zoom)})}this.renderThisFrame=!1,this.needRender=!1}orderPoisByLevel(){const t=Array.from(this.pois);t.sort((t,e)=>t.getLevel()-e.getLevel()),this.pois=new Set(t),this.renderThisFrame=!0}recalculateVisibilities(t){const e=[];let n=!0;Array.from(t).sort((t,e)=>e.collision?-1:e.getLevel()-t.getLevel()).forEach(t=>{const{xMin:r,yMin:i,xMax:o,yMax:s}=t.getBoundingRect();if(!t.collision)return t.setHidden(!1),e.push([r,o,i,s]),void(n=!1);const{xMin:a,yMin:u,xMax:c,yMax:l}=t.getOuterRect();if(n)return e.push([r,o,i,s]),n=!1,void t.setHidden(!1);if(!e.some(([t,e,n,a])=>!(o<t||r>e)&&!(s<n||i>a)))e.push([r,o,i,s]),t.setHidden(!1);else if("outer"===t.collisionMode)t.setHidden(!0);else if("icon"===t.collisionMode||"label"===t.collisionMode){!e.some(([t,e,n,r])=>!(c<t||a>e)&&!(l<n||u>r))?(e.push([r,o,i,s]),t.setHidden(!0,!0)):t.setHidden(!0)}})}checkUpdate(){const{THREE:t}=Nd.getInstance();if(this.renderThisFrame)return;if(Array.from(this.pois).some(t=>t.update()))return void(this.renderThisFrame=!0);const{camera:e}=this.parent,{quaternion:n,position:r,zoom:i,up:o}=e,s=r.clone(),a=n.clone(),u=i;if(!this.prevPosition)return this.prevPosition=s.clone(),this.prevQuaternion=a.clone(),this.prevZoom=u,void(this.renderThisFrame=!0);const c=(new t.Quaternion).setFromUnitVectors(o,new t.Vector3(0,1,0)),l=new t.Vector3(0,0,-1).applyQuaternion(this.prevQuaternion);l.applyQuaternion(c);const h=new t.Spherical;h.setFromVector3(l);const p=(new t.Quaternion).setFromUnitVectors(o,new t.Vector3(0,1,0)),f=new t.Vector3(0,0,-1).applyQuaternion(a);f.applyQuaternion(p);const d=new t.Spherical;if(d.setFromVector3(f),Math.abs(h.phi*(180/Math.PI)-d.phi*(180/Math.PI))+Math.abs(h.theta*(180/Math.PI)-d.theta*(180/Math.PI))>1e-4)return this.prevPosition=s.clone(),this.prevQuaternion=a.clone(),this.prevZoom=u,void(this.renderThisFrame=!0);const g=this.parent.getViewWidth(),m=this.parent.getViewHeight(),v=s.clone().project(e),y=(v.x-1)/2*g,x=(1-v.y)/2*m;v.set(y,x,0);const b=this.prevPosition.clone().project(e),_=(b.x-1)/2*g,w=(1-b.y)/2*m;return b.set(_,w,0),v.distanceTo(b)>1e-4||this.prevZoom!==u&&Math.abs((u-this.prevZoom)/u)>1e-4||Math.abs((this.prevZoom-u)/this.prevZoom)>1e-4?(this.prevPosition=s.clone(),this.prevQuaternion=a.clone(),this.prevZoom=u,void(this.renderThisFrame=!0)):void(this.renderThisFrame=!1)}dispose(){this.parent.off(zd.MOUSE_DOWN,this.listeners.pointerDown),this.parent.off(zd.MOUSE_UP,this.listeners.pointerUp),this.parent.off(zd.TOUCH_START,this.listeners.touchStart),this.parent.off(zd.TOUCH_END,this.listeners.touchEnd),this.clearPoi(),Wb.canvas&&(Wb.canvas.remove(),Wb.canvas=null),Wb.ctx&&(Wb.ctx=null)}onPointerDown(t){const{clientX:e,clientY:n}=t,[i,o]=this.parent.getViewOffset(),s=e-i,a=n-o;let u=null;Array.from(this.rectMap).some(([t,e])=>{const{xMin:n,yMin:i,xMax:o,yMax:c}=t;return!!new r.Box2(new r.Vector2(n,i),new r.Vector2(o,c)).containsPoint(new r.Vector2(s,a))&&(u=e,!0)}),u&&this.onNodePointerDown(u,s,a,t.button)}onPointerUp(t){const{THREE:e}=Nd.getInstance(),{clientX:n,clientY:r}=t,[i,o]=this.parent.getViewOffset(),s=n-i,a=r-o,u=new e.Vector2(s,a).distanceToSquared(this.mousePositionBuffer);this.emit(Ud.POI_UP,this.eventTarget,t.button),this.mouseState===zb.DOWN&&u<100&&this.emit(Ud.POI_CLICKED,this.eventTarget,t.button),this.mouseState=zb.IDLE}onTouchStart(t){const{clientX:e,clientY:n}=t.touches[0],[i,o]=this.parent.getViewOffset(),s=e-i,a=n-o;let u=null;Array.from(this.rectMap).some(([t,e])=>{const{xMin:n,yMin:i,xMax:o,yMax:c}=t;return!!new r.Box2(new r.Vector2(n,i),new r.Vector2(o,c)).containsPoint(new r.Vector2(s,a))&&(u=e,!0)}),u&&this.onNodePointerDown(u,s,a,0)}onTouchEnd(t){const{THREE:e}=Nd.getInstance(),{clientX:n,clientY:r}=t.changedTouches[0],[i,o]=this.parent.getViewOffset(),s=n-i,a=r-o,u=new e.Vector2(s,a).distanceToSquared(this.mousePositionBuffer);this.emit(Ud.POI_UP,this.eventTarget,0),this.mouseState===zb.DOWN&&u<100&&this.emit(Ud.POI_CLICKED,this.eventTarget,0),this.mouseState=zb.IDLE}onNodePointerDown(t,e,n,r=0){this.mouseState===zb.IDLE&&(this.mouseState=zb.DOWN,this.mousePositionBuffer.set(e,n),this.eventTarget=t,this.emit(Ud.POI_DOWN,t,r))}createPoi(t){const e=new qb;if(e.setParent(this),this.renderThisFrame=!0,e.setPosition(t),!this.pois)throw Error("poiOverlay need bind a view, use view.addOverlay()");return this.pois.add(e),this.scene.add(e.group),e}setRectMap(t,e){this.rectMap.set(t,e)}removePoi(t){this.pois.delete(t),this.scene.remove(t.group),t.dispose(),this.renderThisFrame=!0}clearPoi(){Array.from(this.pois).forEach(t=>{this.scene.remove(t.group)}),this.pois.clear(),this.renderThisFrame=!0}setVisibility(t){this.visible=t,this.enabled=t}setEnabled(t){this.enabled=t}resize(t,e){this.updateCameraAspect(t,e),this.renderThisFrame=!0}updateCameraAspect(t,e){const n=t,r=e;this.renderCamera.left=-n/2,this.renderCamera.right=n/2,this.renderCamera.top=r/2,this.renderCamera.bottom=-r/2,this.renderCamera.updateProjectionMatrix()}}class qb{constructor(t){this._renderThisFrame=!1;const{THREE:e}=Nd.getInstance();this.dpr=jd.GetGlobalDPR(),this.isFlipY=!1,this.position=t||new e.Vector3,this.group=new r.Group,this.textVisibility=!0,this.iconVisibility=!0,this.iconInCircle=!1,this.iconCircleOptions={width:0,color:"#ffffff"},this.textPosInfo={anchor:"center",offsetX:0,offsetY:0,anchorOffsetX:0,anchorOffsetY:0},this.iconPosInfo={anchor:"center",offsetX:0,offsetY:0,anchorOffsetX:0,anchorOffsetY:0},this.level=1,this.isInFrustum=!1,this.animationEnabled=!1,this.text=null,this.icon=null,this.rect=null,this.boundingBox=null,this.overlapArea={x:0,y:0},this.visible=!0,this.hide=!1,this.subHide=!1,this.rotation=0,this.autoRotation=!1,this.collision=!0,this.collisionMode="outer",this.iconRect={xMin:0,yMin:0,xMax:0,yMax:0},this.textRect={xMin:0,yMin:0,xMax:0,yMax:0},this.boundingRect={xMin:0,yMin:0,xMax:0,yMax:0},this.outerRect={xMin:0,yMin:0,xMax:0,yMax:0},this.visibilityAnimation={anim:null,from:1,to:1,current:1},this.text=null,this.textWidth=0,this.textHeight=0,this.icon=null,this.iconOptions={size:[20,20],src:null},this.labelOptions={fontSize:12,padding:0,content:null},this.rectOptions={width:0,height:0,fill:16711680,opacity:.5,offsetX:0,offsetY:0},this.visiblePartWhenCollision="none",this.subAreaOpacity=1,this.abandonedAreaOpacity=1,this.screenPosition={x:0,y:0},this.labelOpacity=1,this.iconOpacity=1}set renderThisFrame(t){this._renderThisFrame=t}get renderThisFrame(){return this._renderThisFrame}dispose(){this.group&&ky.dispose(this.group,!0),this.parent=null,this.iconCircleMaterial=null,this.iconMaterial=null,this.textMaterial=null,this.icon=null,this.rect=null,this.boundingBox=null,this.group=null}setParent(t){this.parent=t}setPosition(t,e=1e-4){t.distanceTo(this.position)<e||(this.position.copy(t),this.group&&this.group.position.copy(t),this.renderThisFrame=!0)}setOpacity(t=this.labelOpacity,e=this.iconOpacity){this.labelOpacity=t,this.iconOpacity=e,this.textMaterial&&(this.textMaterial.opacity=t),this.iconMaterial&&(this.iconMaterial.opacity=e),this.renderThisFrame=!0}setRotation(t,e=1e-4){Math.abs(t-this.rotation)<e||(this.group.rotateZ(t-this.rotation),this.rotation=t,this.renderThisFrame=!0)}setCollision(t){this.collision=t,this.renderThisFrame=!0}setCollisionMode(t){this.collisionMode=t,this.renderThisFrame=!0}setLabelVisibility(t){this.textVisibility=t,this.renderThisFrame=!0}setIconVisiblity(t){this.iconVisibility=t,this.renderThisFrame=!0}setHideModeWhenCollision(t){"all"===t?this.setVisiblePartWhenCollision("none"):"none"===t?this.setVisiblePartWhenCollision("all"):this.setVisiblePartWhenCollision(t)}setVisiblePartWhenCollision(t){this.visiblePartWhenCollision=t}setCollisionOverlap(t,e){this.overlapArea={x:t,y:e},this.renderThisFrame=!0}setLevel(t,e=!1){this.level=t,this.renderThisFrame=!0,this.parent.orderPois(e)}getLevel(){return this.level}setVisibility(t){this.visible!==t&&(this.renderThisFrame=!0),this.visible=t}setHidden(t,e=!1){if(this.animationEnabled){const n=t?e?.5:0:1;if(this.visibilityAnimation.anim&&n===this.visibilityAnimation.to)return;if(!this.visibilityAnimation.anim&&t===this.hide&&e===this.subHide)return;this.visibilityAnimation.anim&&(this.visibilityAnimation.anim.stop(),this.visibilityAnimation.anim=null);const r={subAreaOpacity:this.subAreaOpacity,abandonedAreaOpacity:this.abandonedAreaOpacity},i={subAreaOpacity:0,abandonedAreaOpacity:0};t?e?(i.subAreaOpacity=1,i.abandonedAreaOpacity=0):(i.subAreaOpacity=0,i.abandonedAreaOpacity=0):(i.subAreaOpacity=1,i.abandonedAreaOpacity=1);let o=[];const s=[];switch(this.visiblePartWhenCollision){case"all":this.text&&o.push(this.textMaterial),this.icon&&(o.push(this.iconMaterial),this.iconCircleMaterial&&this.iconCircleMaterial.visible&&o.push(this.iconCircleMaterial));break;case"none":this.text&&s.push(this.textMaterial),this.icon&&(s.push(this.iconMaterial),this.iconCircleMaterial&&this.iconCircleMaterial.visible&&s.push(this.iconCircleMaterial));break;case"label":o=[this.textMaterial,this.rectMaterial],this.text&&o.push(this.textMaterial),this.icon&&(s.push(this.iconMaterial),this.iconCircleMaterial&&this.iconCircleMaterial.visible&&s.push(this.iconCircleMaterial));break;case"icon":this.text&&s.push(this.textMaterial),this.icon&&(o.push(this.iconMaterial),this.iconCircleMaterial&&this.iconCircleMaterial.visible&&o.push(this.iconCircleMaterial))}this.visibilityAnimation.from=this.visibilityAnimation.current,this.visibilityAnimation.to=t?e?.5:0:1;const a=300;this.visibilityAnimation.anim=new v.a.Tween(r).to(i,a).onUpdate(t=>{this.subAreaOpacity=t.subAreaOpacity,this.abandonedAreaOpacity=t.abandonedAreaOpacity,o.forEach(e=>{e.opacity=t.subAreaOpacity}),s.forEach(e=>{e.opacity=t.abandonedAreaOpacity})}).start().onComplete(()=>{this.visibilityAnimation.anim=null,this.visibilityAnimation.from=null,this.visibilityAnimation.current=null,this.visibilityAnimation.to=null,this.hide=t,this.subHide=e})}else this.hide===t&&this.subHide===e||(this.hide=t,this.subHide=e,this.renderThisFrame=!0)}setRect(t){this.withRect=t,this.renderThisFrame=!0}setRectDefSize(t,e){this.rectOptions.width=t,this.rectOptions.height=e,this.renderThisFrame=!0}setRectFill(t){this.rectOptions.fill=t,this.renderThisFrame=!0}setRectOffset(t=0,e=0){this.rectOptions.offsetX=t,this.rectOptions.offsetY=e,this.renderThisFrame=!0}setIconImage(t){this.iconOptions&&this.iconOptions.src===t||(this.iconOptions.src=t,this.clearIcon(),this.renderThisFrame=!0)}setIconSize(t,e){this.iconSize=[t,e],this.iconOptions.size=[t,e],this.renderThisFrame=!0}setIconShowInCircle(t,e){this.iconInCircle=!0,this.iconCircleOptions={width:t,color:e}}drawIcon(){const{src:t,size:e}=this.iconOptions;if(t&&(!this.icon||!this.group.getObjectByName("poi_icon")||!!this.iconInCircle!=!!this.iconCircleMaterial))if(qb.ImageMaterialMap.has(t))if("dealing"===qb.ImageMaterialMap.get(t))this.renderThisFrame=!0;else{this.icon&&this.group.remove(this.icon),this.iconMaterial=qb.ImageMaterialMap.get(t).clone(),this.iconMaterial.opacity=this.iconOpacity;const{width:n,color:i}=this.iconCircleOptions,o=n&&this.iconInCircle;o&&(this.iconCircleMaterial=new r.MeshBasicMaterial({color:i,transparent:!0,opacity:this.iconOpacity}));const s=o?[this.iconCircleMaterial,this.iconMaterial]:[this.iconMaterial],a=o?new r.CircleGeometry(e[0]/2,30):new r.PlaneGeometry(e[0],e[1]),u=Hb(a,s);this.icon=u,this.icon&&(this.icon.children.length>1&&this.icon.children[1].scale.set(e[0]/(n+e[0]),e[0]/(n+e[0]),1),this.icon.renderOrder=3,this.icon.name="poi_icon",this.group.add(this.icon),this.renderThisFrame=!0)}else{qb.ImageMaterialMap.set(t,"dealing");(new r.TextureLoader).load(t,e=>{e.needsUpdate=!0,e.magFilter=r.LinearFilter,e.flipY=this.isFlipY;const n=new r.MeshBasicMaterial({map:e,transparent:!0,opacity:this.iconOpacity});n.needsUpdate=!0,n.visible=!0,qb.ImageMaterialMap.set(t,n)})}}clearIcon(){this.icon&&(this.group&&this.group.remove(this.icon),this.icon.children.forEach(t=>{t.geometry&&t.geometry.dispose()}),this.iconMaterial&&(this.iconMaterial.dispose(),this.iconMaterial=null),this.iconCircleMaterial&&(this.iconCircleMaterial.dispose(),this.iconCircleMaterial=null),this.icon=null)}setIconAnchor(t){this.iconPosInfo.anchor=t,this.renderThisFrame=!0}setIconFlipY(t){this.isFlipY=t}setIconOffset(t,e){this.iconPosInfo.anchorOffsetX=t,this.iconPosInfo.anchorOffsetY=e,this.renderThisFrame=!0}setFontSize(t){this.labelOptions.fontSize=t,this.renderThisFrame=!0}setFontPadding(t){this.labelOptions.padding=t,this.renderThisFrame=!0}setLabelText(t){this.labelOptions.content=t,this.renderThisFrame=!0}drawText(){if(!this.labelOptions.content)return;if(this.group.getObjectByName("poi_text"))return;const t=this.dpr,{fontSize:e,padding:n,content:i}=this.labelOptions;Wb.ctx.font=e*t+"px sans-serif",Wb.ctx.fillStyle="black";const o=Wb.ctx.measureText(i),s=Math.ceil(o.width)+10+2*n,a=(e+5+2*n)*t;this.textWidth=s/t,this.textHeight=a/t,this.setRectDefSize(this.textWidth,this.textHeight),Wb.ctx.clearRect(0,0,s,a),Wb.ctx.fillText(i,n*t,(e+n)*t);const u=Wb.ctx.getImageData(0,0,s,a);this.textMaterial=new r.MeshBasicMaterial({transparent:!0,map:new r.DataTexture(Uint8Array.from(u.data),s,a,r.RGBAFormat),side:r.DoubleSide,opacity:this.labelOpacity}),this.text=new r.Mesh(new r.PlaneGeometry(this.textWidth,this.textHeight),this.textMaterial),this.text.material.map.flipY=!0,this.text.material.map.flipX=!0,this.text.material.map.needsUpdate=!0,this.text.material.map.magFilter=r.LinearFilter,this.text.material.visible=!0,this.text.name="poi_text",this.text.renderOrder=4;const{offsetX:c,offsetY:l}=this.recalcOffset(this.textWidth,this.textHeight,this.textPosInfo.anchor,this.textPosInfo.anchorOffsetX,this.textPosInfo.anchorOffsetY);this.textPosInfo.offsetX=c,this.textPosInfo.offsetY=l,this.group.add(this.text)}recalcOffset(t,e,n,r,i){let o=0,s=0;switch(n){case"center":o=r,s=i;break;case"left":o=t/2+r,s=i;break;case"right":o=-t/2+r,s=i;break;case"top":o=r,s=-e/2+i;break;case"bottom":o=r,s=e/2+i;break;case"topleft":o=t/2+r,s=-e/2+i;break;case"topright":o=-t/2+r,s=-e/2+i;break;case"bottomleft":o=t/2+r,s=e/2+i;break;case"bottomright":o=-t/2+r,s=e/2+i}return{offsetX:o,offsetY:s}}setLabelAnchor(t){this.textPosInfo.anchor=t,this.renderThisFrame=!0}setLabelOffset(t,e){this.textPosInfo.anchorOffsetX=t,this.textPosInfo.anchorOffsetY=e,this.renderThisFrame=!0}getLabelAnchor(){return this.textPosInfo.anchor}getLabelOffset(){const{anchorOffsetX:t,anchorOffsetY:e}=this.textPosInfo;return{x:t,y:e}}calcBoundingSize(){const t=this.screenPosition,e=this.textPosInfo.offsetX,n=this.textPosInfo.offsetY,r=this.iconPosInfo.offsetX,i=this.iconPosInfo.offsetY,o={xMin:this.text?t.x-this.textWidth/2+e:t.x,xMax:this.text?t.x+this.textWidth/2+e:t.x,yMin:this.text?t.y-this.textHeight/2-n:t.y,yMax:this.text?t.y+this.textHeight/2-n:t.y},s={xMin:this.icon?t.x-this.iconOptions.size[0]/2+r:t.x,xMax:this.icon?t.x+this.iconOptions.size[0]/2+r:t.x,yMin:this.icon?t.y-this.iconOptions.size[1]/2-i:t.y,yMax:this.icon?t.y+this.iconOptions.size[1]/2-i:t.y};let a=Math.max(s.xMax,o.xMax),u=Math.min(s.xMin,o.xMin),c=Math.max(s.yMax,o.yMax),l=Math.min(s.yMin,o.yMin);this.iconRect={xMin:this.icon?t.x-this.iconOptions.size[0]/2+r:t.x,xMax:this.icon?t.x+this.iconOptions.size[0]/2+r:t.x,yMin:this.icon?t.y-this.iconOptions.size[1]/2-i:t.y,yMax:this.icon?t.y+this.iconOptions.size[1]/2-i:t.y},this.textRect={xMin:this.text?t.x-this.textWidth/2+e:t.x,xMax:this.text?t.x+this.textWidth/2+e:t.x,yMin:this.text?t.y-this.textHeight/2-n:t.y,yMax:this.text?t.y+this.textHeight/2-n:t.y},this.outerRect={xMax:a,xMin:u,yMax:c,yMin:l},"icon"===this.collisionMode?(a=s.xMax,u=s.xMin,c=s.yMax,l=s.yMin):"label"===this.collisionMode&&(a=o.xMax,u=o.xMin,c=o.yMax,l=o.yMin),this.boundingRect.xMax=a,this.boundingRect.yMax=c,this.boundingRect.xMin=u,this.boundingRect.yMin=l}drawRect(){if(!this.withRect||!this.labelOptions.content)return;if(this.rect&&this.group.getObjectByName("poi_rect"))return;this.rect=new r.Group;const t=this.rectOptions.width||this.textWidth,e=this.rectOptions.height||this.textHeight,n=[0+t/2-10,0+e/2],i=[0+t/2,0+e/2-10],o=[0+t/2,0-e/2+10],s=[0+t/2-10,0-e/2],a=[0-t/2+10,0-e/2],u=[0-t/2,0-e/2+10],c=[0-t/2,0+e/2-10],l=[0-t/2+10,0+e/2],h=new r.Shape;h.moveTo(n[0],n[1]),h.bezierCurveTo(n[0],n[1],0+t/2,0+e/2,i[0],i[1]),h.moveTo(o[0],o[1]),h.bezierCurveTo(o[0],o[1],0+t/2,0-e/2,s[0],s[1]),h.moveTo(a[0],a[1]),h.bezierCurveTo(a[0],a[1],0-t/2,0-e/2,u[0],u[1]),h.moveTo(c[0],c[1]),h.bezierCurveTo(c[0],c[1],0-t/2,0+e/2,l[0],l[1]),h.moveTo(n[0],n[1]);const p=new r.ShapeGeometry(h),f=new r.MeshBasicMaterial({color:255,transparent:!0,opacity:.5});this.rectMaterial=f;const d=new r.Mesh(p,f);h.autoClose=!0;const g=h.getPoints(),m=(new r.BufferGeometry).setFromPoints(g),v=new r.Line(m,new r.LineBasicMaterial({color:16711680}));v.position.set(0,0,0),this.rect.add(d),this.rect.add(v),this.rect.renderOrder=2,this.rect.name="poi_rect",this.group.add(this.rect)}drawBoundingBox(){if(!this.withBoundingBox)return;if(this.group.getObjectByName("poi_bounding_rect"))return;if(0===this.outerRect.xMin&&0===this.outerRect.xMax)return;const{xMax:t,yMax:e,xMin:n,yMin:i}=this.outerRect;this.boundingBox=new r.Group;const o=t-n,s=e-i,a=[0+o/2-10,0+s/2],u=[0+o/2,0+s/2-10],c=[0+o/2,0-s/2+10],l=[0+o/2-10,0-s/2],h=[0-o/2+10,0-s/2],p=[0-o/2,0-s/2+10],f=[0-o/2,0+s/2-10],d=[0-o/2+10,0+s/2],g=new r.Shape;g.moveTo(a[0],a[1]),g.bezierCurveTo(a[0],a[1],0+o/2,0+s/2,u[0],u[1]),g.moveTo(c[0],c[1]),g.bezierCurveTo(c[0],c[1],0+o/2,0-s/2,l[0],l[1]),g.moveTo(h[0],h[1]),g.bezierCurveTo(h[0],h[1],0-o/2,0-s/2,p[0],p[1]),g.moveTo(f[0],f[1]),g.bezierCurveTo(f[0],f[1],0-o/2,0+s/2,d[0],d[1]),g.moveTo(a[0],a[1]);const m=new r.ShapeGeometry(g),v=new r.MeshBasicMaterial({color:16711680,transparent:!0,opacity:.5}),y=new r.Mesh(m,v);g.autoClose=!0;const x=g.getPoints(),b=(new r.BufferGeometry).setFromPoints(x),_=new r.Line(b,new r.LineBasicMaterial({color:16711680,linewidth:2}));_.position.set(0,0,0),this.boundingBox.name="poi_bounding_rect",this.boundingBox.add(y),this.boundingBox.add(_),this.boundingBox.renderOrder=0,this.group.add(this.boundingBox)}setBoundingBox(){this.withBoundingBox=!0}getBoundingRect(){const{x:t,y:e}=this.overlapArea,{xMin:n,yMin:r,xMax:i,yMax:o}=this.boundingRect;return{xMin:n+t,yMin:r+e,xMax:i-t,yMax:o-e}}getOuterRect(){const{x:t,y:e}=this.overlapArea,{xMin:n,yMin:r,xMax:i,yMax:o}=this.outerRect;return{xMin:n+t,yMin:r+e,xMax:i-t,yMax:o-e}}setAnimationEnabled(t){this.animationEnabled=t}calcPoiRotation(t){return this.autoRotation?t+this.rotation:this.rotation}getVisibility(){return this.visible}calcPosAndSize(t,e,n){if(!this.parent)return{isInFrustum:this.isInFrustum};let r=this.visible&&t.containsPoint(this.position);if(r){const t=this.position.clone().project(this.parent.camera);this.screenPosition={x:(t.x+1)*e,y:(1-t.y)*n},this.calcBoundingSize(),(this.outerRect.xMin<0||this.outerRect.xMax>2*e||this.outerRect.yMin<0||this.outerRect.yMax>2*n)&&(r=!1)}return this.isInFrustum=r,{isInFrustum:this.isInFrustum}}draw(){this.drawText(),this.drawIcon(),this.drawRect(),this.drawBoundingBox()}updatePosition(t,e){if(!this.group)return;if(!this.isInFrustum)return this.hide=!0,this.subHide=!1,void(this.group.visible=!1);if(this.group.visible=this.visible,!this.visible)return;const n=this.textPosInfo.offsetX,i=this.textPosInfo.offsetY,o=this.iconPosInfo.offsetX,s=this.iconPosInfo.offsetY,a=(new pr).copy(this.position);if(a.z+=this.iconSize[1]/2,this.group.position.copy(a),this.group.rotation.copy(t),this.group.scale.copy(new pr(1/e,1/e,1)),e<1?a.z+=this.iconSize[1]*(1-e)/2:a.z-=this.iconSize[1]*(1-1/e)/2,this.group.position.copy(a),this.text&&this.text.position.set(n,i,0),this.rect&&this.rect.position.set(n,i,0),this.icon&&this.icon.position.set(o,s,0),this.boundingBox){const t=(this.outerRect.xMax+this.outerRect.xMin)/2,e=(this.outerRect.yMax+this.outerRect.yMin)/2;this.boundingBox.position.set(t-this.screenPosition.x,this.screenPosition.y-e,0)}const u=this.visibilityAnimation.anim,c=!!u||!u&&(!this.hide||this.subHide);if(this.group.visible=c,c&&(!u||!this.animationEnabled)){let t=[],e=[];switch(this.visiblePartWhenCollision){case"all":t=[this.group],e=[];break;case"none":t=[],e=[this.group];break;case"label":t=[],this.text&&t.push(this.text),this.rect&&t.push(this.rect),this.icon&&e.push(this.icon);break;case"icon":this.icon&&t.push(this.icon),this.text&&e.push(this.text),this.rect&&e.push(this.rect);break;default:t=[],e=[this.group]}this.subHide?(t.forEach(t=>{t.visible=!0,t instanceof r.Group&&t.children.forEach(t=>{t.visible=!0})}),e.forEach(t=>{t.visible=!1,t instanceof r.Group&&t.children.forEach(t=>{t.visible=!1})})):this.hide||(t.forEach(t=>{t.visible=!0,t instanceof r.Group&&t.children.forEach(t=>{t.visible=!0})}),e.forEach(t=>{t.visible=!0,t instanceof r.Group&&t.children.forEach(t=>{t.visible=!0})})),this.icon&&!this.iconVisibility&&(this.icon.visible=!1),this.text&&!this.textVisibility&&(this.text.visible=!1)}c&&(this.subHide?this.parent&&("icon"===this.visiblePartWhenCollision?this.parent.setRectMap(this.iconRect,this):this.parent.setRectMap(this.textRect,this)):this.parent&&(this.parent.setRectMap(this.textRect,this),this.parent.setRectMap(this.iconRect,this)))}update(){const t=this.renderThisFrame||this.isInFrustum&&!!this.iconOptions.src&&!this.icon;return this.renderThisFrame=!1,t}setPoiId(t){this.poiId=t}}qb.ImageMaterialMap=new Map,qb.ImageMaterialMap=new Map;class Xb extends Gd{constructor(){super(),Wd.GetSharedInstance().registerController(this)}unbind(){this.dispose()}dispose(){this.eventMap.clear(),Wd.GetSharedInstance().unregisterController(this)}}var Yb,Jb=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};!function(t){t[t.IDLE=0]="IDLE",t[t.ROTATE=1]="ROTATE",t[t.ORBIT=2]="ORBIT",t[t.PAN=3]="PAN",t[t.DOLLY=4]="DOLLY",t[t.TOUCH_ROTATE=5]="TOUCH_ROTATE",t[t.TOUCH_ORBIT=6]="TOUCH_ORBIT",t[t.TOUCH_PAN=7]="TOUCH_PAN",t[t.TOUCH_DOLLY_ROTATE=8]="TOUCH_DOLLY_ROTATE",t[t.TOUCH_DOLLY_PAN=9]="TOUCH_DOLLY_PAN",t[t.TOUCH_MAP=10]="TOUCH_MAP"}(Yb||(Yb={}));class Kb extends Xb{constructor(t){super();const{THREE:e}=Nd.getInstance();this.eventListeners={onMouseDown:t=>{this.onMouseDown(t)},onMouseMove:t=>{this.onMouseMove(t)},onMouseUp:t=>{this.onMouseUp(t)},onMouseWheel:t=>{this.onMouseWheel(t)},onTouchStart:t=>{this.onTouchStart(t)},onTouchMove:t=>{this.onTouchMove(t)},onTouchEnd:t=>{this.onTouchEnd(t)},onContextMenu:t=>{this.onContextMenu(t)}},this.state=Yb.IDLE,this.enabled=!0,this.target=new e.Vector3,this.lastTick=Date.now(),this.enableDamping=!1,this.dampingFactor=0,this.mouseButtons={LEFT:e.MOUSE.ROTATE,MIDDLE:e.MOUSE.DOLLY,RIGHT:e.MOUSE.PAN},this.touches={ONE:e.TOUCH.ROTATE,TWO:e.TOUCH.DOLLY_PAN},this.boundaryEnabled=!1,this.boundary=new e.Box3(new e.Vector3(-1/0,-1/0,-1/0),new e.Vector3(1/0,1/0,1/0)),this.touchCenter=new e.Vector2,this.inertiaFactor=1,this.enableRotate=!0,this.rotateMode="self",this.rotateSpeed=1,this.rotateStart=new e.Vector2,this.rotateEnd=new e.Vector2,this.rotateDelta=new e.Vector2,this.rotateLineStart=new e.Vector2,this.rotateLineEnd=new e.Vector2,this.rotateInertiaDirection=new e.Vector2,this.rotateInertiaEnabled=!0,this.rotateInertiaBase=0,this.rotateInertia=0,this.rotateInertiaType="normal",this.spherical=new e.Spherical,this.sphericalDelta=new e.Spherical,this.maxSpherical=new e.Spherical(1,1/0,1/0),this.minSpherical=new e.Spherical(1,-1/0,-1/0),this.lastQuaternion=new e.Quaternion,this.enableZoom=!0,this.dollyStart=new e.Vector2,this.dollyEnd=new e.Vector2,this.zoomMode="zoom",this.zoomDelta=0,this.zoomRange={min:1,max:10},this.fovRange={min:60,max:90},this.zoomInertiaEnabled=!0,this.zoomInertiaBase=0,this.zoomInertia=0,this.zoomScale=1,this.enablePan=!0,this.panStart=new e.Vector2,this.panDelta=new e.Vector2,this.panEnd=new e.Vector2,this.panOffset=new e.Vector3,this.panSpeed=1,this.screenSpacePanning=!0,this.lastPosition=new e.Vector3,this.panInertiaDirection=new e.Vector2,this.panInertiaEnabled=!0,this.panInertiaBase=0,this.panInertia=0,this.mouseXY=new e.Vector2,this.bindView(t)}registerEvents(){this.bindingView&&(this.bindingView.on(zd.MOUSE_DOWN,this.eventListeners.onMouseDown),this.bindingView.on(zd.MOUSE_MOVE,this.eventListeners.onMouseMove),this.bindingView.on(zd.MOUSE_UP,this.eventListeners.onMouseUp),this.bindingView.on(zd.MOUSE_WHEEL,this.eventListeners.onMouseWheel),this.bindingView.on(zd.TOUCH_START,this.eventListeners.onTouchStart),this.bindingView.on(zd.TOUCH_MOVE,this.eventListeners.onTouchMove),this.bindingView.on(zd.TOUCH_END,this.eventListeners.onTouchEnd),this.bindingView.on(zd.CONTEXT_MENU,this.eventListeners.onContextMenu))}unregisterEvents(){this.bindingView&&(this.bindingView.off(zd.MOUSE_DOWN,this.eventListeners.onMouseDown),this.bindingView.off(zd.MOUSE_MOVE,this.eventListeners.onMouseMove),this.bindingView.off(zd.MOUSE_UP,this.eventListeners.onMouseUp),this.bindingView.off(zd.MOUSE_WHEEL,this.eventListeners.onMouseWheel),this.bindingView.off(zd.TOUCH_START,this.eventListeners.onTouchStart),this.bindingView.off(zd.TOUCH_MOVE,this.eventListeners.onTouchMove),this.bindingView.off(zd.TOUCH_END,this.eventListeners.onTouchEnd),this.bindingView.off(zd.CONTEXT_MENU,this.eventListeners.onContextMenu))}onMouseDown(t){let e;switch(t.preventDefault(),t.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT}switch(e){case r.MOUSE.ROTATE:this.enableRotate&&(this.state=Yb.ROTATE);break;case r.MOUSE.PAN:this.enablePan&&(this.state=Yb.PAN);break;case r.MOUSE.DOLLY:this.enableZoom&&(this.state=Yb.DOLLY);break;default:this.state=Yb.IDLE}switch(this.state){case Yb.ROTATE:this.handleMouseDownRotate(t);break;case Yb.PAN:this.handleMouseDownPan(t);break;case Yb.DOLLY:this.handleMouseDownDolly(t)}this.state!==Yb.IDLE&&(this.bindingView&&(this.bindingView.on(zd.MOUSE_MOVE,this.eventListeners.onMouseMove),this.bindingView.on(zd.MOUSE_UP,this.eventListeners.onMouseUp)),this.panInertiaBase=0,this.rotateInertiaBase=0,this.zoomInertiaBase=0)}onMouseMove(t){switch(t.preventDefault(),this.state){case Yb.ROTATE:this.handleMouseMoveSelfRotate(t);break;case Yb.PAN:this.handleMouseMovePan(t);break;case Yb.DOLLY:this.handleMouseMoveDolly(t)}}onMouseUp(t){switch(t.preventDefault(),this.bindingView&&(this.bindingView.off(zd.MOUSE_MOVE,this.eventListeners.onMouseMove),this.bindingView.off(zd.MOUSE_UP,this.eventListeners.onMouseUp)),this.state){case Yb.ROTATE:this.handleUpRotate();break;case Yb.PAN:this.handleUpPan()}this.state=Yb.IDLE}onMouseWheel(t){!this.enableZoom||this.state!==Yb.IDLE&&this.state!==Yb.ROTATE||(t.preventDefault(),t.stopPropagation(),this.handleMouseWheel(t))}onContextMenu(t){t.preventDefault()}onTouchStart(t){switch(jd.GetEnv()!==Fd.Miniapp&&t.preventDefault(),this.timeStart=t.timeStamp,t.touches.length){case 1:switch(this.touches.ONE){case r.TOUCH.PAN:this.enablePan&&(this.state=Yb.TOUCH_PAN);break;case r.TOUCH.ROTATE:this.enableRotate&&(this.state=Yb.TOUCH_ROTATE);break;default:this.state=Yb.IDLE}break;case 2:switch(this.touchCenter.set((t.touches[0].clientX+t.touches[1].clientX)/2,(t.touches[0].clientY+t.touches[1].clientY)/2),this.touches.TWO){case r.TOUCH.DOLLY_PAN:this.state=Yb.TOUCH_DOLLY_PAN;break;case r.TOUCH.DOLLY_ROTATE:this.state=Yb.TOUCH_DOLLY_ROTATE;break;case"map":this.state=Yb.TOUCH_MAP;break;default:this.state=Yb.IDLE}break;default:this.state=Yb.IDLE}switch(this.state){case Yb.TOUCH_PAN:this.handleTouchStartPan(t);break;case Yb.TOUCH_ROTATE:this.handleTouchStartRotate(t);break;case Yb.TOUCH_DOLLY_ROTATE:this.handleTouchStartDollyRotate(t);break;case Yb.TOUCH_DOLLY_PAN:this.handleTouchStartDollyPan(t);break;case Yb.TOUCH_MAP:this.handleTouchStartMap(t)}this.state!==Yb.IDLE&&(this.bindingView&&(this.bindingView.on(zd.MOUSE_MOVE,this.eventListeners.onMouseMove),this.bindingView.on(zd.MOUSE_UP,this.eventListeners.onMouseUp)),this.panInertiaBase=0,this.rotateInertiaBase=0,this.zoomInertiaBase=0)}onTouchMove(t){switch(jd.GetEnv()!==Fd.Miniapp&&t.preventDefault(),2===t.touches.length&&this.touchCenter.set((t.touches[0].clientX+t.touches[1].clientX)/2,(t.touches[0].clientY+t.touches[1].clientY)/2),this.state){case Yb.TOUCH_PAN:this.handleTouchMovePan(t);break;case Yb.TOUCH_ROTATE:this.handleTouchMoveSelfRotate(t);break;case Yb.TOUCH_DOLLY_ROTATE:this.handleTouchMoveDollyRotate(t);break;case Yb.TOUCH_DOLLY_PAN:this.handleTouchMoveDollyPan(t);break;case Yb.TOUCH_MAP:this.handleTouchMoveAll(t)}this.timeEnd=this.timeStart,this.timeStart=t.timeStamp}onTouchEnd(t){switch(jd.GetEnv()!==Fd.Miniapp&&t.preventDefault(),this.state){case Yb.TOUCH_ROTATE:case Yb.TOUCH_DOLLY_ROTATE:this.handleUpRotate();break;case Yb.TOUCH_PAN:case Yb.TOUCH_DOLLY_PAN:this.handleUpPan();break;case Yb.TOUCH_MAP:this.handleUpAll()}this.state=Yb.IDLE}handleMouseDownRotate(t){this.handleDownRotate(t.offsetX,t.offsetY)}handleMouseMoveSelfRotate(t){this.handleMoveRotate(t.offsetX,t.offsetY)}handleTouchStartRotate(t){if(1===t.touches.length)this.handleDownRotate(t.touches[0].clientX,t.touches[0].clientY);else if(this.state===Yb.TOUCH_MAP){const e=(t.touches[1].clientY-t.touches[0].clientY)/(t.touches[1].clientX-t.touches[0].clientX),n=t.touches[0].clientY-e*t.touches[0].clientX;this.rotateLineStart.set(e,n)}else{const e=.5*(t.touches[0].clientX+t.touches[1].clientX),n=.5*(t.touches[0].clientY+t.touches[1].clientY);this.handleDownRotate(e,n)}}handleTouchMoveSelfRotate(t){if(this.bindingView)if(1===t.touches.length)this.handleMoveRotate(t.touches[0].clientX,t.touches[0].clientY);else if(this.state===Yb.TOUCH_MAP){const e=(t.touches[1].clientY-t.touches[0].clientY)/(t.touches[1].clientX-t.touches[0].clientX),n=t.touches[0].clientY-e*t.touches[0].clientX;if(this.rotateLineEnd.set(e,n),Number.isFinite(this.rotateLineEnd.x)&&Number.isFinite(this.rotateLineStart.x)){const t=(this.rotateLineStart.y-this.rotateLineEnd.y)/(this.rotateLineEnd.x-this.rotateLineStart.x),r=e*t+n;if(Number.isFinite(t)&&Number.isFinite(r)){let e=Math.atan(this.rotateLineEnd.x)-Math.atan(this.rotateLineStart.x);if(Math.PI-Math.abs(e)<.5&&(e=-Math.sign(e)*(Math.PI-Math.abs(e))),Math.abs(e)>.01){const n=this.rotateLineStart.clone().set(this.bindingView.getViewWidth()/2,this.bindingView.getViewHeight()/2),i=this.rotateLineStart.clone().set(t,r),o=n.clone().rotateAround(i,e).sub(n);this.handlePanDelta(o.x,o.y),this.rotateDelta.set(e,0),this.handleRotateSphericalDelta(this.rotateDelta.x,this.rotateDelta.y)}}}this.rotateLineStart.copy(this.rotateLineEnd)}else{const e=.5*(t.touches[0].clientX+t.touches[1].clientX),n=.5*(t.touches[0].clientY+t.touches[1].clientY);this.handleMoveRotate(e,n)}}handleDownRotate(t,e){this.rotateStart.set(t,e)}handleMoveRotate(t,e){this.rotateEnd.set(t,e),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed),this.handleRotateDelta(this.rotateDelta.x,this.rotateDelta.y),this.rotateStart.copy(this.rotateEnd)}handleRotateDelta(t,e){if(!this.bindingView)return;const n=this.bindingView.getViewHeight(),r="self"===this.rotateMode?-1:1;let i=1;if(this.camera.isPerspectiveCamera){const t=this.camera;i*=t.fov/t.zoom/360}this.handleRotateSphericalDelta(2*-r*Math.PI*t/n*i,-2*Math.PI*e/n*i)}handleRotateSphericalDelta(t,e){this.sphericalDelta.theta+=t,this.sphericalDelta.phi+=e}handleUpRotate(){if(!this.rotateInertiaEnabled||!this.bindingView)return;const t=this.timeStart-this.timeEnd;if(this.state===Yb.TOUCH_MAP){this.rotateInertiaType="map";const e=this.rotateDelta.x/t;Number.isFinite(e)&&e>.001&&(this.rotateInertiaBase=this.rotateDelta.x/10,this.rotateInertiaDuration=0,this.rotateInertia=this.rotateInertiaBase)}else{this.rotateInertiaType="normal";const e=this.rotateDelta.length()*this.rotateSpeed/t,n=1e3*e/this.bindingView.getViewWidth()*.6;if(0===t||!Number.isFinite(e))return;Number.isFinite(e)&&e>.3&&(this.rotateInertiaBase=e*n*this.inertiaFactor,this.rotateInertiaDuration=0,this.rotateInertiaDirection=this.rotateDelta.clone().normalize(),this.rotateInertia=this.rotateInertiaBase)}}handleMouseDownPan(t){this.handleDownPan(t.offsetX,t.offsetY)}handleMouseMovePan(t){this.handleMovePan(t.offsetX,t.offsetY)}handleTouchStartPan(t){if(1===t.touches.length)this.handleDownPan(t.touches[0].clientX,t.touches[0].clientY);else{const e=.5*(t.touches[0].clientX+t.touches[1].clientX),n=.5*(t.touches[0].clientY+t.touches[1].clientY);this.handleDownPan(e,n)}}handleTouchMovePan(t){if(1===t.touches.length)this.handleMovePan(t.touches[0].clientX,t.touches[0].clientY);else{const e=.5*(t.touches[0].clientX+t.touches[1].clientX),n=.5*(t.touches[0].clientY+t.touches[1].clientY);this.handleMovePan(e,n)}}handleDownPan(t,e){this.panStart.set(t,e)}handleMovePan(t,e){this.panEnd.set(t,e),this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(this.panSpeed),this.handlePanDelta(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}handlePanDelta(t,e){if(!this.bindingView)return;const{THREE:n}=Nd.getInstance(),r=new n.Vector3,i=this.bindingView.getViewWidth(),o=this.bindingView.getViewHeight();let s=0,a=0;if(this.camera.isPerspectiveCamera){const n=this.camera;r.subVectors(this.target,this.camera.position);let i=r.length();i*=Math.tan(n.fov/2*Math.PI/180),s=2*t*i/o,a=2*e*i/o}else{const n=this.camera;s=t*(n.right-n.left)/n.zoom/i,a=e*(n.top-n.bottom)/n.zoom/o}r.setFromMatrixColumn(this.camera.matrix,0),r.multiplyScalar(-s),this.panOffset.add(r),this.screenSpacePanning?r.setFromMatrixColumn(this.camera.matrix,1):(r.setFromMatrixColumn(this.camera.matrix,0),r.crossVectors(this.camera.up,r)),r.multiplyScalar(a),this.panOffset.add(r)}handleUpPan(){if(!this.panInertiaEnabled)return;const t=this.timeStart-this.timeEnd,e=10*this.panDelta.length()*this.panSpeed/t;0!==t&&Number.isFinite(e)&&Number.isFinite(e)&&e>1&&(this.panInertiaBase=e*this.inertiaFactor,this.panInertiaDuration=0,this.panInertiaDirection=this.panDelta.clone().normalize(),this.panInertia=this.panInertiaBase)}handleMouseWheel(t){this.zoomDelta=t.deltaY/67,this.mouseXY.set(t.offsetX,t.offsetY)}handleZoom(t){if(Math.abs(t)<1e-4)return;let e=0,n=null;if(this.followMouse&&(n=ky.getHorizontalPlaneCoordinate3({x:this.mouseXY.x,y:this.mouseXY.y},this.bindingView,this.camera)),t*=this.zoomScale,"zoom"===this.zoomMode){const n=Math.min(Math.max(this.camera.zoom*(1+t),this.zoomRange.min),this.zoomRange.max);e=n-this.camera.zoom,this.camera.zoom=n}else if(this.camera.isPerspectiveCamera){const e=this.camera;e.fov=Math.min(Math.max(e.fov+66.67*t,this.fovRange.min),this.fovRange.max)}if(this.camera.updateProjectionMatrix(),this.needUpdate=!0,this.emit(Ud.CAMERA_ZOOM,this.zoomMode,"zoom"===this.zoomMode?this.camera.zoom:this.camera.fov,this),this.followMouse&&e&&this.bindingView){const t=ky.getHorizontalPlaneCoordinate3({x:this.mouseXY.x,y:this.mouseXY.y},this.bindingView,this.camera);if(n&&t){const e=t.clone().sub(n);this.setCameraPosition(this.camera.position.clone().sub(e),!0)}}}handleUpZoom(){if(!this.zoomInertiaEnabled)return;const t=this.timeStart-this.timeEnd,e=this.zoomDelta/t;0!==t&&Number.isFinite(e)&&Math.abs(e)>.001&&(this.zoomInertiaBase=e*this.inertiaFactor*2,this.zoomInertiaDuration=0,this.zoomInertia=this.zoomInertiaBase)}handleMouseDownDolly(t){this.dollyStart.set(t.offsetX,t.offsetY)}handleMouseMoveDolly(t){this.dollyEnd.set(t.offsetX,t.offsetY);const e=-Math.sign(this.dollyEnd.y-this.dollyStart.y),n=this.dollyStart.distanceTo(this.dollyEnd),r=this.bindingView.getViewWidth(),i=this.bindingView.getViewHeight(),o=Math.sqrt(Math.pow(r,2)+Math.pow(i,2)),s=n/o;this.zoomDelta=e*Math.floor(s*o)*jd.GetGlobalDPR(),this.dollyStart.copy(this.dollyEnd)}handleTouchStartDolly(t){const e=t.touches[0].clientX-t.touches[1].clientX,n=t.touches[0].clientY-t.touches[1].clientY,r=Math.sqrt(e*e+n*n);this.dollyStart.set(0,r)}handleTouchMoveDolly(t){if(!this.bindingView)return;const e=t.touches[0].clientX-t.touches[1].clientX,n=t.touches[0].clientY-t.touches[1].clientY,r=Math.sqrt(e*e+n*n);this.dollyEnd.set(0,r);const i=this.bindingView.canvas.clientWidth,o=this.bindingView.canvas.clientHeight,s=Math.sqrt(Math.pow(i,2)+Math.pow(o,2)),a=(r-this.dollyStart.y)/s;this.zoomDelta=-a;let u=1+Math.abs(this.zoomDelta);this.zoomDelta>0&&(u=1/u),this.zoomDelta=u-1,this.zoomDelta*=2;const c=this.touchCenter.clone().set(this.bindingView.getViewWidth()/2,this.bindingView.getViewHeight()/2),l=this.touchCenter.clone().sub(c).multiplyScalar(-this.zoomDelta);this.mouseXY.set(this.touchCenter.x,this.touchCenter.y),this.zoomDelta*=jd.GetGlobalDPR(),this.handlePanDelta(l.x,l.y),this.dollyStart.copy(this.dollyEnd)}handleTouchStartDollyRotate(t){this.enableZoom&&this.handleTouchStartDolly(t),this.enableRotate&&this.handleTouchStartRotate(t)}handleTouchMoveDollyRotate(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enableRotate&&this.handleTouchMoveSelfRotate(t)}handleTouchStartDollyPan(t){this.enableZoom&&this.handleTouchStartDolly(t),this.enablePan&&this.handleTouchStartPan(t)}handleTouchMoveDollyPan(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enablePan&&this.handleTouchMovePan(t)}handleTouchStartMap(t){this.enableZoom&&this.handleTouchStartDolly(t),this.enablePan&&this.handleTouchStartPan(t),this.enableRotate&&this.handleTouchStartRotate(t)}handleTouchMoveAll(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enablePan&&this.handleTouchMovePan(t),this.enableRotate&&this.handleTouchMoveSelfRotate(t)}handleUpAll(){this.handleUpZoom(),this.handleUpPan(),this.handleUpRotate()}resetVectors(){this.panInertiaBase=0,this.panInertia=0,this.panDelta.set(0,0),this.rotateInertiaBase=0,this.rotateInertia=0,this.rotateDelta.set(0,0)}moveCameraTo(t,e=1e3,n){return Jb(this,void 0,void 0,(function*(){return new Promise(r=>{const{THREE:i}=Nd.getInstance(),o=this.camera.position.clone(),s=new i.Vector3,a=n||{};new v.a.Tween({progress:0}).to({progress:1},e).easing(v.a.Easing.Quadratic.InOut).onUpdate(({progress:e})=>{s.lerpVectors(o,t,e),this.camera.position.copy(s),a.onUpdate&&a.onUpdate(e),this.needUpdate=!0}).onComplete(()=>{r()}).start()})}))}setCameraPosition(t,e=!0){const{THREE:n}=Nd.getInstance(),r=(new n.Vector3).subVectors(this.target,this.camera.position);this.camera.position.copy(t),e&&this.target.copy(t.clone().add(r)),this.needUpdate=!0}getCameraPosition(){return this.camera.position.clone()}setCameraLookAt(t,e=!1){const{THREE:n}=Nd.getInstance(),r=(new n.Vector3).subVectors(this.camera.position,this.target);this.target.copy(t),e&&this.camera.position.copy(t.clone().add(r)),this.camera.lookAt(t),this.needUpdate=!0}getCameraTarget(){return this.target.clone()}setCameraLookAtVector(t,e=1){this.setCameraLookAt(this.camera.position.clone().add(t.normalize().multiplyScalar(e)))}setDampingEnabled(t){this.enableDamping=t}setDampingFactor(t){this.dampingFactor=t}getDampingFactor(){return this.dampingFactor}setZoomEnabled(t){this.enableZoom=t}setZoomMode(t){if(this.camera.isOrthographicCamera&&"fov"===t)throw new Error("[BasicController] Cannot use fov zoom mode for OrthographicCamera");this.zoomMode=t}setFovRange(t,e){if(this.fovRange.min=t,this.fovRange.max=e,!this.camera.isPerspectiveCamera)return;const n=this.camera;n.fov=Math.min(Math.max(n.fov,this.fovRange.min),this.fovRange.max),n.updateProjectionMatrix(),this.needUpdate=!0}setFov(t){if(!this.camera.isPerspectiveCamera)return;const e=this.camera;e.fov=Math.min(Math.max(t,this.fovRange.min),this.fovRange.max),e.updateProjectionMatrix(),this.needUpdate=!0}getFov(){return this.camera.isPerspectiveCamera?this.camera.fov:null}setZoomRange(t,e){this.zoomRange.min=t,this.zoomRange.max=e,this.camera.zoom=Math.min(Math.max(this.camera.zoom,this.zoomRange.min),this.zoomRange.max),this.camera.updateProjectionMatrix(),this.needUpdate=!0}setZoom(t){this.camera.zoom=Math.min(Math.max(t,this.zoomRange.min),this.zoomRange.max),this.camera.updateProjectionMatrix(),this.needUpdate=!0}getZoom(){return this.camera.zoom}setZoomInertiaEnabled(t){this.zoomInertiaEnabled=t}setRotateEnabled(t){this.enableRotate=t}setRotateMode(t){this.rotateMode=t}setRotateSpeed(t){this.rotateSpeed=t}getRotateSpeed(){return this.rotateSpeed}setRotateInertiaEnabled(t){this.rotateInertiaEnabled=t}setAzimuthAngle(t){const{THREE:e}=Nd.getInstance(),n=(new e.Quaternion).setFromUnitVectors(this.camera.up,new e.Vector3(0,1,0)),r=n.clone().invert(),i=(new e.Vector3).subVectors(this.target,this.camera.position);"orbit"===this.rotateMode&&i.multiplyScalar(-1),i.applyQuaternion(n),this.spherical.setFromVector3(i),this.spherical.theta=t,this.spherical.makeSafe(),i.setFromSpherical(this.spherical),i.applyQuaternion(r),"self"===this.rotateMode?this.target.copy(this.camera.position.clone().add(i)):this.camera.position.copy(this.target.clone().add(i)),this.camera.lookAt(this.target),this.needUpdate=!0}getAzimuthAngle(){return this.spherical.theta}setPolarAngle(t){const{THREE:e}=Nd.getInstance(),n=(new e.Quaternion).setFromUnitVectors(this.camera.up,new e.Vector3(0,1,0)),r=n.clone().invert(),i=(new e.Vector3).subVectors(this.target,this.camera.position);"orbit"===this.rotateMode&&i.multiplyScalar(-1),i.applyQuaternion(n),this.spherical.setFromVector3(i),this.spherical.phi=t,this.spherical.makeSafe(),i.setFromSpherical(this.spherical),i.applyQuaternion(r),"self"===this.rotateMode?this.target.copy(this.camera.position.clone().add(i)):this.camera.position.copy(this.target.clone().add(i)),this.camera.lookAt(this.target),this.needUpdate=!0}getPolarAngle(){return this.spherical.phi}setAzimuthRange(t,e){this.minSpherical.theta=t,this.maxSpherical.theta=e}setPolarRange(t,e){this.minSpherical.phi=t,this.maxSpherical.phi=e}setPanInertiaEnabled(t){this.panInertiaEnabled=t}setInertiaFactor(t){this.inertiaFactor=t}setPanEnabled(t){this.enablePan=t}setScreenSpacePanning(t){this.screenSpacePanning=t}setMouseButtons(t){this.mouseButtons=t}setTouches(t){this.touches=t}setBoundaryEnabled(t){this.boundaryEnabled=t}setBoundary(t,e){this.boundary.set(t,e)}setEnabled(t){t!==this.enabled&&(this.enabled=t,t?this.registerEvents():(this.unregisterEvents(),this.resetVectors()))}getEnabled(){return this.enabled}bindView(t){if(this.unbindView(),!t.container&&!t.canvas)throw new Error("View needed initialized with an HTML container or Canvas");if(!t.camera)throw new Error("[BasicController] View for basic controller should have a camera.");if(!t.camera.isPerspectiveCamera&&!t.camera.isOrthographicCamera)throw new Error("[BasicController] Only supports PerspectiveCamera or OrthographicCamera.");const{THREE:e}=Nd.getInstance();this.camera=t.camera,this.bindingView=t,this.target=new e.Vector3(0,0,-1).applyQuaternion(this.camera.quaternion),this.registerEvents()}update(){const t=Date.now(),e=t-this.lastTick;this.lastTick=t;const{THREE:n}=Nd.getInstance(),r=(new n.Quaternion).setFromUnitVectors(this.camera.up,new n.Vector3(0,1,0)),i=r.clone().invert(),o=(new n.Vector3).subVectors(this.target,this.camera.position);if("orbit"===this.rotateMode&&o.multiplyScalar(-1),Math.abs(this.zoomInertiaBase)>0&&this.zoomInertiaDuration<600){this.handleZoom(this.zoomInertia);const t=this.zoomInertiaDuration/600;this.zoomInertia=this.zoomInertiaBase*Math.pow(1-t,2),this.zoomInertia=Math.max(0,Math.abs(this.zoomInertia))*Math.sign(this.zoomInertia),this.zoomInertiaDuration+=e}if(this.panInertiaBase>0&&this.panInertiaDuration<600){const{x:t,y:n}=this.panInertiaDirection;this.handlePanDelta(t*this.panInertia,n*this.panInertia);const r=this.panInertiaDuration/600;this.panInertia=this.panInertiaBase*Math.pow(1-r,2),this.panInertia=Math.max(0,this.panInertia),this.panInertiaDuration+=e}if(this.rotateInertiaBase>0&&this.rotateInertiaDuration<600){if("normal"===this.rotateInertiaType){const{x:t,y:e}=this.rotateInertiaDirection;this.handleRotateDelta(t*this.rotateInertia,e*this.rotateInertia)}else this.handleRotateSphericalDelta(this.rotateInertia,0);const t=this.rotateInertiaDuration/600;this.rotateInertia=this.rotateInertiaBase*Math.pow(1-t,2),this.rotateInertia=Math.max(0,this.rotateInertia),this.rotateInertiaDuration+=e}o.applyQuaternion(r),this.spherical.setFromVector3(o);const s=this.sphericalDelta.clone();let{zoomDelta:a}=this;this.enableDamping&&(s.theta*=this.dampingFactor,s.phi*=this.dampingFactor,a*=this.dampingFactor),this.spherical.theta+=s.theta,this.spherical.phi+=s.phi;let{theta:u}=this.minSpherical,{theta:c}=this.maxSpherical;const l=2*Math.PI;return Number.isFinite(u)&&Number.isFinite(c)&&(u<-Math.PI?u+=l:u>Math.PI&&(u-=l),c<-Math.PI?c+=l:c>Math.PI&&(c-=l),this.spherical.theta=u<c?Math.max(u,Math.min(c,this.spherical.theta)):this.spherical.theta>(u+c)/2?Math.max(u,this.spherical.theta):Math.min(c,this.spherical.theta)),this.spherical.phi=Math.max(this.minSpherical.phi,Math.min(this.maxSpherical.phi,this.spherical.phi)),this.spherical.makeSafe(),o.setFromSpherical(this.spherical),o.applyQuaternion(i),this.handleZoom(a),this.enableDamping?"self"===this.rotateMode?this.camera.position.addScaledVector(this.panOffset,this.dampingFactor):this.target.addScaledVector(this.panOffset,this.dampingFactor):"self"===this.rotateMode?this.camera.position.add(this.panOffset):this.target.add(this.panOffset),this.boundaryEnabled&&("self"===this.rotateMode?(this.camera.position.x=Math.min(this.boundary.max.x,Math.max(this.boundary.min.x,this.camera.position.x)),this.camera.position.y=Math.min(this.boundary.max.y,Math.max(this.boundary.min.y,this.camera.position.y)),this.camera.position.z=Math.min(this.boundary.max.z,Math.max(this.boundary.min.z,this.camera.position.z))):(this.target.x=Math.min(this.boundary.max.x,Math.max(this.boundary.min.x,this.target.x)),this.target.y=Math.min(this.boundary.max.y,Math.max(this.boundary.min.y,this.target.y)),this.target.z=Math.min(this.boundary.max.z,Math.max(this.boundary.min.z,this.target.z)))),"self"===this.rotateMode?this.target.copy(this.camera.position.clone().add(o)):this.camera.position.copy(this.target.clone().add(o)),this.camera.lookAt(this.target),this.enableDamping?(this.sphericalDelta.theta*=1-this.dampingFactor,this.sphericalDelta.phi*=1-this.dampingFactor,this.panOffset.multiplyScalar(1-this.dampingFactor),this.zoomDelta*=1-this.dampingFactor):(this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0),this.zoomDelta=0),!!(this.needUpdate||this.lastPosition.distanceToSquared(this.camera.position)>1e-6||8*(1-this.lastQuaternion.dot(this.camera.quaternion))>1e-6)&&(this.lastPosition.copy(this.camera.position),this.lastQuaternion.copy(this.camera.quaternion),this.needUpdate=!1,this.emit(Ud.CAMERA_CHANGED,this.camera.position.clone(),this.camera.quaternion.clone(),this),!0)}unbind(){this.dispose(),this.unbindView()}unbindView(){this.unregisterEvents(),this.bindingView=null}}r.InstancedBufferGeometry;r.ShaderMaterial;r.Mesh;var Qb=n("vDqi"),Zb=n.n(Qb);function $b(t){return($b="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})(t)}function t_(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t_=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof m?e:m,s=Object.create(o.prototype),a=new P(r||[]);return i(s,"_invoke",{value:S(t,n,a)}),s}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",f="executing",d="completed",g={};function m(){}function v(){}function y(){}var x={};c(x,s,(function(){return this}));var b=Object.getPrototypeOf,_=b&&b(b(I([])));_&&_!==n&&r.call(_,s)&&(x=_);var w=y.prototype=m.prototype=Object.create(x);function M(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,o,s,a){var u=h(t[i],t,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==$b(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(l).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(u.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function S(e,n,r){var i=p;return function(o,s){if(i===f)throw Error("Generator is already running");if(i===d){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var u=A(a,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===p)throw i=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=f;var c=h(e,n,r);if("normal"===c.type){if(i=r.done?d:"suspendedYield",c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=d,r.method="throw",r.arg=c.arg)}}}function A(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,A(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=h(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function I(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError($b(e)+" is not iterable")}return v.prototype=y,i(w,"constructor",{value:y,configurable:!0}),i(y,"constructor",{value:v,configurable:!0}),v.displayName=c(y,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,c(t,u,"GeneratorFunction")),t.prototype=Object.create(w),t},e.awrap=function(t){return{__await:t}},M(E.prototype),c(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new E(l(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},M(w),c(w,u,"Generator"),c(w,s,(function(){return this})),c(w,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=I,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var u=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;T(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:I(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function e_(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function n_(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){e_(o,r,i,s,a,"next",t)}function a(t){e_(o,r,i,s,a,"throw",t)}s(void 0)}))}}function r_(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,i_(r.key),r)}}function i_(t){var e=function(t,e){if("object"!=$b(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=$b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==$b(e)?e:e+""}var o_=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},e=null,n=[{key:"axiosGet",value:(o=n_(t_().mark((function t(e,n){return t_().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){Zb.a.get(e,n).then((function(e){t(e.data)})).catch((function(e){t(null)}))})));case 1:case"end":return t.stop()}}),t)}))),function(t,e){return o.apply(this,arguments)})},{key:"axiosPost",value:(i=n_(t_().mark((function t(e,n,r){return t_().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){Zb.a.post(e,n,r).then((function(e){t(e.data)})).catch((function(e){t(null)}))})));case 1:case"end":return t.stop()}}),t)}))),function(t,e,n){return i.apply(this,arguments)})},{key:"xhrGet",value:(r=n_(t_().mark((function t(e,n){return t_().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){var r=new XMLHttpRequest;r.onreadyStateChange=function(){if(4===r.readystate)try{304===r.status||r.status>=200&&r.status<300?console.log("type: success, result: ",r.responseText):(console.log("type: error, errCode:",r.status),t(null))}catch(e){console.log("增加异常捕获"),t(null)}},r.open("GET",e,!0),r.ontimeout=function(){console.log("超时处理"),t(null)},r.onload=n_(t_().mark((function e(){var i;return t_().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=r.response,n&&(i=JSON.parse(i)),t(i);case 3:case"end":return e.stop()}}),e)}))),r.onerror=function(){t(null)},r.send()})));case 1:case"end":return t.stop()}}),t)}))),function(t,e){return r.apply(this,arguments)})},{key:"xhrPost",value:function(t,e,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1e3;return new Promise((function(s){if(!i)return s(null);var a=function(){setTimeout((function(){return s(r.xhrPost(t,e,n,--i,o+=1e3))}),o)},u=new XMLHttpRequest;u.onreadyStateChange=function(){if(4===u.readystate)try{304===u.status||u.status>=200&&u.status<300?console.log("type: success, result: ",u.responseText):(console.log("type: error, errCode:",u.status),s(null))}catch(t){console.log("增加异常捕获"),s(null)}else a()},u.open("POST",t,!0),u.setRequestHeader("content-type","application/x-www-form-urlencoded"),u.timeout=42e3,u.ontimeout=function(){console.log("超时处理"),a()},u.onload=n_(t_().mark((function t(){var e;return t_().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=u.responseText,n&&(e=JSON.parse(e)),s(e);case 3:case"end":return t.stop()}}),t)}))),u.onerror=function(){a()},u.send(JSON.stringify(e))}))}}],e&&r_(t.prototype,e),n&&r_(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r,i,o}();function s_(t){return(s_="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})(t)}function a_(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,u_(r.key),r)}}function u_(t){var e=function(t,e){if("object"!=s_(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=s_(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==s_(e)?e:e+""}var c_=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return e=t,r=[{key:"getAngle",value:function(e,n,r){var i=e.clone().sub(n).normalize(),o=n.clone().sub(r).normalize();return t.getAngleByVector(i,o)}},{key:"getAngleByVector",value:function(t,e){return Math.acos(e.dot(t))/Math.PI*180}},{key:"getAngleByVector2",value:function(t,e){if(t.equals(e))return 0;if(t.equals(e.clone().multiplyScalar(-1)))return 180;var n=Math.acos(e.dot(t))/Math.PI*180;return t.clone().cross(e).z>0?n:n+180}}],(n=null)&&a_(e.prototype,n),r&&a_(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();class l_ extends eg{constructor(t,e,n){super(),this.offLineTextureLevel=-1,this.face=t,this.flipX=e||!1,this.flipY=n||!1,this.textureMap=new Map,this.needsUpdate=!1;const i=this.uniforms={mTexture0:{type:"t",value:null},mTexture1:{type:"t",value:null},mTexture2:{type:"t",value:null},mTexture3:{type:"t",value:null},mTexture4:{type:"t",value:null},mTexture5:{type:"t",value:null},mTexture6:{type:"t",value:null},mTexture7:{type:"t",value:null},mTexture8:{type:"t",value:null},mTexture9:{type:"t",value:null},mTexture10:{type:"t",value:null},mTexture11:{type:"t",value:null},mTexture12:{type:"t",value:null},mTexture13:{type:"t",value:null},mTexture14:{type:"t",value:null},mTexture15:{type:"t",value:null},uvMax:{type:"i",value:0},flipX:{type:"b",value:!1},flipY:{type:"b",value:!1},black:{type:"b",value:!1}},{THREE:o}=Nd.getInstance(),s=new o.ShaderMaterial({fragmentShader:"\n uniform sampler2D mTexture0;\n uniform sampler2D mTexture1;\n uniform sampler2D mTexture2;\n uniform sampler2D mTexture3;\n uniform sampler2D mTexture4;\n uniform sampler2D mTexture5;\n uniform sampler2D mTexture6;\n uniform sampler2D mTexture7;\n uniform sampler2D mTexture8;\n uniform sampler2D mTexture9;\n uniform sampler2D mTexture10;\n uniform sampler2D mTexture11;\n uniform sampler2D mTexture12;\n uniform sampler2D mTexture13;\n uniform sampler2D mTexture14;\n uniform sampler2D mTexture15;\n\n uniform int uvMax;\n varying vec3 vUv;\n uniform bool black;\n\n int modi(int x, int y) {\n int result = x - ((x / y) * y);\n return result < 0 ? result + y : result;\n }\n\n float modf(float x, float y){\n float result = x - y * floor(x/y);\n return result < 0.0 ? result + y : result;\n }\n\n int getInt(float value) {\n // 添加边界检查\n if (value < 0.0) return 0;\n if (value > float(0x7FFFFFFF)) return 0x7FFFFFFF;\n\n float m = modf(value, 1.0);\n return m < 1.0 && m > 0.6 ? int(value) + 1 : int(value);\n }\n\n vec4 getSample(int index, vec2 uv) {\n if (index == 0) return texture2D(mTexture0, uv);\n if (index == 1) return texture2D(mTexture1, uv);\n if (index == 2) return texture2D(mTexture2, uv);\n if (index == 3) return texture2D(mTexture3, uv);\n if (index == 4) return texture2D(mTexture4, uv);\n if (index == 5) return texture2D(mTexture5, uv);\n if (index == 6) return texture2D(mTexture6, uv);\n if (index == 7) return texture2D(mTexture7, uv);\n if (index == 8) return texture2D(mTexture8, uv);\n if (index == 9) return texture2D(mTexture9, uv);\n if (index == 10) return texture2D(mTexture10, uv);\n if (index == 11) return texture2D(mTexture11, uv);\n if (index == 12) return texture2D(mTexture12, uv);\n if (index == 13) return texture2D(mTexture13, uv);\n if (index == 14) return texture2D(mTexture14, uv);\n if (index == 15) return texture2D(mTexture15, uv);\n return vec4(0.0, 0.0, 0.0, 1.0); // 默认返回透明黑色\n }\n\n vec2 getUv(vec2 uvs, int pos){\n // 严格的边界保护\n float min2 = 1.0 / 4096.0;\n float max2 = 1.0 - min2;\n vec2 clampedUvs = clamp(uvs, vec2(min2), vec2(max2));\n\n vec2 tuv = clampedUvs / 4.0;\n int x = modi(pos, 4);\n int y = pos / 4;\n\n float segment = 1.0 / 4.0;\n vec2 base = vec2(float(x) * segment, float(y) * segment);\n\n // 添加额外的边界检查\n return clamp(tuv + base, vec2(0.0), vec2(1.0));\n }\n\n void main(){\n vec2 tuv = vUv.xy;\n int indexPos = getInt(vUv.z);\n int index = indexPos / 100;\n int pos = modi(indexPos, 100);\n tuv = getUv(tuv, pos);\n gl_FragColor = getSample(index, tuv);\n }",vertexShader:"\n attribute vec3 uvi;\n varying vec3 vUv;\n uniform bool flipX;\n uniform bool flipY;\n\n void main(){\n vUv = uvi;\n bool useCanvas = false;\n if(flipX){\n vUv.x = 1.0-vUv.x;\n }\n if(flipY){\n vUv.y = 1.0-vUv.y;\n }\n if(useCanvas){\n vUv.y = 1.0-vUv.y;\n }\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",uniforms:i,depthTest:!1,side:r.BackSide,transparent:!1}),a=new o.BufferGeometry;this.planeGeometry=a;const u=this.plane=new o.Mesh(a,s);u.visible=!0,u.frustumCulled=!1,u.material=s,u.renderOrder=100,this.add(u)}updatePfid(t,e){this.pfid!==t&&(this.pfid=t),this.level=e}setTexturesUniforms(t,e){this.uniforms.uvMax.value=t,e.forEach((t,e)=>{this.uniforms["mTexture"+e].value=t}),this.uniforms.flipX.value=this.flipX,this.uniforms.flipY.value=this.flipY,0!==this.face&&(this.uniforms.black.value=!0),this.needsUpdate=!0}updateTextures(t,e){this.setTexturesUniforms(t.length,t),this.updateInfos(e)}updateInfos(t){this.textureMap=t;const e=Array.from(this.textureMap.values());e.sort((t,e)=>t.level-e.level);const n=this.revers,r=this.planeGeometry,i=[],o=[],s=[],a=[],u=(t,e)=>{const r=t.level,u=t.textureIndex,c=t.index;bb.getVertices(r,c,n,this.flipX,this.flipY).forEach(t=>{i.push(t.x,t.y,t.z)}),o.push(0,0,1),o.push(0,0,1),o.push(0,0,1),o.push(0,0,1),a.push(0,0,u),a.push(0,1,u),a.push(1,1,u),a.push(1,0,u);const l=4*e;n?(s.push(l+1,l+2,l),s.push(l+2,l+3,l)):(s.push(l,l+2,l+1),s.push(l,l+3,l+2))};for(let t=0;t<e.length;t++)u(e[t],t);const{THREE:c}=Nd.getInstance();r.setAttribute("position",new c.Float32BufferAttribute(i,3)),r.setAttribute("normal",new c.Float32BufferAttribute(o,3)),r.setAttribute("uvi",new c.Float32BufferAttribute(a,3)),r.setIndex(s)}udpateInCamera(t){const{textureMap:e,pfid:n,level:r,textureRootUrl:i,offLineTextureLevel:o,offLineTextureRootUrl:s}=this,a=[];if(t.camera){this.textureMap.forEach(t=>{t.level>r&&(t.willIsInCamera=!1,t.willIsInCamera!==t.isInCamera&&(t.isInCamera=t.willIsInCamera,a.push(t)))});const u=bb.getCount(this.level);for(let c=0;c<u;c++){const u=bb.getTileInfoId(n,r,c),l=e.get(u)||new xb(n,0,r,c,i,o,s);l.willIsInCamera=l.inCamera(this.matrixWorld,t.camera),l.willIsInCamera!==l.isInCamera&&(l.isInCamera=l.willIsInCamera,a.push(l))}}return a}update(){const t=new tg(this);return this.initialized?this.needsUpdate&&(t.needUpdate=!0,this.plane.material.uniformsNeedUpdate=!0):(this.initialized=!0,t.needUpdate=!0),this.initialized&&!this.parent&&(t.shouldPlaceElement=!0),t}renderOnce(){this.updateInfos(this.textureMap)}}const h_=[];class p_{static setPlanesVisible(t){h_.forEach(e=>{e.visible=t})}static getPlanesByMatrix(t,e,n,r,i){return p_.getCubeMatrix().map((o,s)=>{let a=h_[s];const{face:u,revers:c,flipX:l,flipY:h}=vb[s];a||(a=h_[s]=new l_(u,l,h),a.revers=c||!1,a.applyMatrix4(o)),a.level=e;const p=t+(u+1)/10;return a.pfid=p,a.level=0,a.textureRootUrl=n[s],i&&(a.offLineTextureRootUrl=i[s]),null!=r&&(a.offLineTextureLevel=r),a})}static getCubeMatrix(){const{THREE:t}=Nd.getInstance();if(!p_.cubeMatrix){const e=[],n=new t.Matrix4;for(let r=0;r<vb.length;r++){const i=vb[r],{trans:o,euler:s}=i,a=new t.Matrix4;s&&a.multiply(n.makeRotationFromEuler(s)),a.multiply(n.makeTranslation(o.x,o.y,o.z)),a.multiplyScalar(2);const u=new t.Euler(Math.PI/2,0,0);a.premultiply(n.makeRotationFromEuler(u)),e[r]=a}p_.cubeMatrix=e}return p_.cubeMatrix}}var f_=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};let d_;class g_ extends eg{constructor(t,e,n,r=[],i,o,s,a,u){super(),this.level=0,this.levelMax=0,this.offLineTextureLevel=-1,this.pid=t,this.seqID=e,this.textureURLs=n,this.levelMax=i,this.neighborPanoramaIDs=r,this.offLinTextureUrls=o||[],null!=s&&(this.offLineTextureLevel=s),this.initialized=!1,this.mounted=!1,this.needsUpdate=!1,this.tilePlanes=[],this.isPlayingVideo=!1,this.videoCanvas=null,this.videoContentType="mp4",this.setTransform(a,u)}linkLineBox(t){const{THREE:e}=Nd.getInstance(),n=new e.BoxBufferGeometry(t,t,t);this.wireFrame=new e.LineSegments(new e.EdgesGeometry(n),new e.LineBasicMaterial({color:16711680})),this.wireFrame.material.visible=!1,this.wireFrame.renderOrder=100,this.add(this.wireFrame)}linkShere(){const{THREE:t}=Nd.getInstance();if(!d_){const e=new t.SphereBufferGeometry(1,60,40);e.scale(1,-1,1),e.rotateY(-90*Math.PI/180),d_=new t.Mesh(e),d_.visible=!1,d_.renderOrder=150}return d_}mount(){p_.setPlanesVisible(!0),this.tilePlanes=p_.getPlanesByMatrix(this.pid,this.level,this.textureURLs,this.offLineTextureLevel,this.offLinTextureUrls),this.tilePlanes.forEach(t=>{this.add(t),t.visible=!0}),this.sphereMesh=this.linkShere(),this.linkLineBox(2),this.add(this.sphereMesh),this.mounted=!0,this.emit(Ud.DID_LOAD_PANORAMA,this.pid)}unMount(){p_.setPlanesVisible(!1),this.tilePlanes.forEach(t=>{this.remove(t)}),this.tilePlanes=[],this.sphereMesh&&(this.remove(),this.sphereMesh=null),this.mounted=!1}updateLevel(t){const e=Math.min(t,this.levelMax);this.level!==e&&(this.level=e,this.tilePlanes&&this.tilePlanes.forEach(t=>{t.level=e}))}getPreTextureInfos(){const t=[];return vb.forEach((e,n)=>{const{face:r}=e,{level:i,textureURLs:o,offLineTextureLevel:s,offLinTextureUrls:a}=this,u=this.pid+(r+1)/10,c=bb.getCount(this.level);for(let e=0;e<c;e++){const r=new xb(u,0,i,e,o[n],s,a[n]);0===i&&(r.frize=!0),t.push(r)}}),t}setTransform(t,e){t&&this.position.copy(t),e&&this.quaternion.copy(e);const{THREE:n}=Nd.getInstance();this.baseQuaternion=(new n.Quaternion).copy(this.quaternion),this.additionalQuaternion=new n.Quaternion;const r=this.quaternion._onChangeCallback;this.quaternion._onChange(()=>{r();if((new n.Quaternion).multiplyQuaternions(this.baseQuaternion,this.additionalQuaternion).equals(this.quaternion))return;this.baseQuaternion=this.quaternion.clone();const{x:t,y:e,z:i,w:o}=(new n.Quaternion).multiplyQuaternions(this.baseQuaternion,this.additionalQuaternion);this.quaternion.set(t,e,i,o),this.needsUpdate=!0});const i=this.rotation._onChangeCallback;this.rotation._onChange(()=>{i();const t=this.additionalQuaternion.clone().invert();this.baseQuaternion=this.quaternion.clone().multiply(t)}),this.eventListeners={onPanoramaSelected:t=>{this.isSelected=t===this,this.isSelected&&this.emit(Ud.PANORAMA_SELECTED,this.pid)},onEnded:()=>{}},kd.on(zd.ELEMENT_SELECTED,this.eventListeners.onPanoramaSelected)}pauseVideo(){if("ts"===this.videoContentType)this.mpegVideoPlayer&&this.mpegVideoPlayer.pause();else{const t="pano_vid_"+this.pid;if(this.video=this.video||document.getElementById(t),!this.video)return;this.video.pause()}}resumeVideo(){return f_(this,void 0,void 0,(function*(){if("ts"===this.videoContentType)this.mpegVideoPlayer&&this.mpegVideoPlayer.play();else{const t="pano_vid_"+this.pid;if(this.video=this.video||document.getElementById(t),!this.video)return;yield this.video.play()}}))}stopVideo(){if(this.sphereMesh){if(this.sphereMesh.visible=!1,"ts"===this.videoContentType){this.mpegVideoPlayer&&(this.mpegVideoPlayer.stop(),this.mpegVideoPlayer.destroy(),this.mpegVideoPlayer=null);const t=this.sphereMesh.material.map;t&&t.dispose(),this.sphereMesh.material.dispose(),this.videoCanvas=null}else{const t="pano_vid_"+this.pid;this.video=this.video||document.getElementById(t);const e=this.sphereMesh.material.map;e&&e.dispose(),this.sphereMesh.material.dispose(),this.video&&(this.video.pause(),this.video.removeAttribute("src"),this.video.load(),this.video=null)}this.eventListeners.onEnded&&this.eventListeners.onEnded(),this.isPlayingVideo=!1,this.needsUpdate=!0}}playVideo(t,e,n,r="mp4",i=[2048,2048]){if(!this.sphereMesh)return null;const{THREE:o}=Nd.getInstance(),{onReadyToPlay:s,onEnded:a,onPrepareToPlay:u}=n||{};if(this.videoContentType=r,this.eventListeners.onEnded=a||(()=>{}),"ts"!==this.videoContentType){const n="pano_vid_"+this.pid;this.video=document.getElementById(n),this.video||(this.video=document.createElement("video"),this.video.id=n,this.video.setAttribute("webkit-playsinline","true"),this.video.setAttribute("x5-playsinline","true"),this.video.setAttribute("playsinline","true"),this.video.setAttribute("crossorigin","anonymous")),this.video.src=t,this.video.loop=!!e,this.video.addEventListener("playing",()=>{this.sphereMesh&&(this.sphereMesh.visible=!0),this.needsUpdate=!0,s&&s(this.video),this.isPlayingVideo=!0}),this.video.addEventListener("ended",()=>{this.stopVideo()}),this.video.addEventListener("play",()=>{this.needsUpdate=!0,u&&u(this.video)}),this.video.play();const r=new o.VideoTexture(this.video);return r.needsUpdate=!0,this.sphereMesh.material=new o.MeshBasicMaterial({map:r,transparent:!1,depthTest:!1,depthWrite:!1}),this.video}{if(!JSMpeg||!JSMpeg.Player)throw new Error("JSMpeg is needed. Please get JSMpeg from https://github.com/phoboslab/jsmpeg");this.videoCanvas||(this.videoCanvas=document.createElement("canvas"),[this.videoCanvas.width,this.videoCanvas.height]=i),this.mpegVideoPlayer=new JSMpeg.Player(t,{canvas:this.videoCanvas,loop:e,autoplay:!1,disableGl:!1,onSourceEstablished:()=>{this.needsUpdate=!0,u&&u()},onPlay:()=>{this.sphereMesh&&(this.sphereMesh.visible=!0),this.needsUpdate=!0,s&&s(),this.isPlayingVideo=!0},onPause:()=>{},onStalled:()=>{},onEnded:()=>{this.stopVideo()},chunkSize:8388608,videoBufferSize:4194304,decodeFirstFrame:!1,preserveDrawingBuffer:!1});const n=new o.CanvasTexture(this.videoCanvas);n.needsUpdate=!0,hb.DetectIOS()&&(n.flipY=!1),this.sphereMesh.material=new o.MeshBasicMaterial({map:n,transparent:!1,depthTest:!1,depthWrite:!1}),this.mpegVideoPlayer.source.established=!1,this.mpegVideoPlayer.source.loadedSize=0,this.mpegVideoPlayer.demuxer.startTime=0,this.mpegVideoPlayer.demuxer.currentTime=0,this.mpegVideoPlayer.demuxer.bits=null,this.mpegVideoPlayer.demuxer.leftoverBytes=null,this.mpegVideoPlayer.audioOut.resetEnqueuedTime(),this.mpegVideoPlayer.audioOut.unlock(),this.mpegVideoPlayer.seek(0),this.mpegVideoPlayer.play()}return null}setUseLowTexturesOnly(t){this.useLowTextureURLsOnly=t}isUseLowTexturesOnly(){return this.useLowTextureURLsOnly}dispose(){super.dispose(),this.mounted&&this.unMount(),this.initialized=!1,kd.off(zd.ELEMENT_SELECTED,this.eventListeners.onPanoramaSelected)}update(){const t=new tg(this);return this.initialized?(this.needsUpdate||this.isPlayingVideo)&&(t.needUpdate=!0,this.sphereMesh&&this.isPlayingVideo&&this.videoCanvas&&this.sphereMesh.material.map&&(this.sphereMesh.material.map.needsUpdate=!0),this.needsUpdate=!1):(this.initialized=!0,t.needUpdate=!0),this.initialized&&!this.parent&&(t.shouldPlaceElement=!0),t}setAdditionalRotationInEuler(t,e,n){const{THREE:r}=Nd.getInstance();this.additionalQuaternion.setFromEuler(new r.Euler(t,e,n));const{x:i,y:o,z:s,w:a}=this.baseQuaternion.clone().multiply(this.additionalQuaternion);return this.quaternion.set(i,o,s,a),this.needsUpdate=!0,this.additionalQuaternion.clone()}setAdditionalRotationInQuaternion(t,e,n,r){const{THREE:i}=Nd.getInstance();this.additionalQuaternion.set(t,e,n,r);const{x:o,y:s,z:a,w:u}=this.baseQuaternion.clone().multiply(this.additionalQuaternion);return this.quaternion.set(o,s,a,u),this.needsUpdate=!0,(new i.Euler).setFromQuaternion(this.additionalQuaternion)}getBox(){return{size:2,matrix:this.matrix}}}var m_=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};class v_{}v_.TEXTURE_UPDATE="texture.update";class y_ extends Xb{constructor(){super(),this.textures=[],this.textureInfoIds=[],this.addingMap=new Map,this.deletingMap=new Map,this.loadingMap=new Map,this.loadedMap=new Map,this.loadedImageDataMap=new Map,this.textureMap=new Map,this.loadedImageDataMap2=new Map,this.context2ds=[]}get ctx(){if(!this._ctx){const t=this.getNewContext2d(db());t&&(this._ctx=t)}return this._ctx}getNewContext2d(t){const e=document.createElement("canvas");e.width=t,e.height=t;return e.getContext("2d")}getContext2d(t){let e=this.context2ds[t];if(!e){const n=this.getNewContext2d(4*db());n&&(e=this.context2ds[t]=n)}return e}bindView(t){this.view=t}addTexture(t){const e=t.id;this.textureMap.has(e)?this.deletingMap.has(e)&&this.deletingMap.delete(e):this.loadingMap.has(e)?this.loadingMap.set(e,t):this.loadedMap.has(e)?this.loadedMap.set(e,t):this.addingMap.set(e,t)}getCubeTextureByPid(t){const e=[],{loadedImageDataMap:n,loadedImageDataMap2:r}=this;vb.forEach(r=>{const i=bb.getTileInfoId(t+(r.face+1)/10,0,0);{const t=n.get(i);t&&e.push(t)}});const{THREE:i}=Nd.getInstance();if(6===e.length){const t=new i.CubeTexture(e);return t.needsUpdate=!0,t}return null}initTextures(t){return m_(this,void 0,void 0,(function*(){const e=new Map;for(let n=0;n<t.length;n++){const r=t[n],i=r.id;this.addingMap.has(i)?(e.set(i,r),this.addingMap.delete(i)):this.deletingMap.has(i)?(e.set(i,r),this.deletingMap.delete(i)):this.textureMap.has(i)||e.set(i,r)}let n=1;if(e.size&&(n=yield this.initTexturesAsync(e)),n)for(;e.size;){const t=[],n=[];this.updateTextures(t,n,e)&&this.emit(v_.TEXTURE_UPDATE,t,n)}return n}))}deteteTextureMap(t,e){t.forEach(t=>{this.deleteTexture(t,e)})}deleteTexture(t,e){const n=t.id;this.deletingMap.has(n)||(this.addingMap.has(n)?this.addingMap.delete(n):this.loadingMap.has(n)?this.loadingMap.delete(n):this.loadedMap.has(n)?(this.loadedMap.delete(n),this.loadedImageDataMap.delete(n)):this.textureMap.has(n)&&(t.time=0,!e&&t.frize||this.deletingMap.set(n,t)))}getTextureInfos(){const t=[];for(let e=0;e<this.textures.length;e++){const n=this.textureInfoIds[e];for(let e=0;e<n.length;e++)if(n[e]){const r=this.textureMap.get(n[e]);r&&t.push(r)}}return t}loadTexturesAsync(){return m_(this,void 0,void 0,(function*(){if(!this.loading){const{addingMap:t,loadingMap:e,loadedMap:n,loadedImageDataMap:r,loadedImageDataMap2:i}=this,o=Array.from(t);for(o.sort((t,e)=>t[1].centerDis-e[1].centerDis);o[0];){const i=o.shift();if(!i)continue;const s=i[0];if(s&&i){const i=t.get(s);if(i){t.delete(s),e.set(s,i);const o=bb.getImageInfo(i);{const t=yield this.loadImgAsync(o.url);t&&e.has(s)&&(e.delete(s),n.set(s,i),r.set(s,t))}}}}this.loading=!1}}))}initTexturesAsync(t){return m_(this,void 0,void 0,(function*(){return new Promise(e=>{const{loadedImageDataMap:n,loadedImageDataMap2:r}=this,i=Array.from(t.keys()),o=i.length;o<1&&e();let s=0;const a=()=>{s++,s>=o&&e(1)},u=()=>{e(0)};for(let e=0;e<o;e++){const r=i[e],o=t.get(r);if(o){const t=bb.getImageInfo(o).url;this.loadImgAsync(t).then(t=>{n.set(r,t),a()}).catch(u)}}})}))}deleteTexturesByPid(t,e){const n=t+".",{textureInfoIds:r,textureMap:i,addingMap:o,deletingMap:s,loadedImageDataMap:a,loadedMap:u,loadingMap:c}=this;i.forEach((t,o)=>{if(o.startsWith(n)&&(e||!t.frize)){const{x:e,y:n}=bb.getXY(t.textureIndex,100);delete r[n][e],i.delete(o),a.has(o)&&this.loadedImageDataMap.delete(o)}}),o.forEach((t,r)=>{r.startsWith(n)&&(!e&&t.frize||o.delete(r))}),s.forEach((t,r)=>{r.startsWith(n)&&(!e&&t.frize||s.delete(r))}),u.forEach((t,r)=>{r.startsWith(n)&&(!e&&t.frize||(u.delete(r),a.delete(r)))}),c.forEach((t,r)=>{r.startsWith(n)&&(!e&&t.frize||c.delete(r))})}updateTextures(t,e,n){const{loadedMap:r,deletingMap:i,textureInfoIds:o,textures:s,loadedImageDataMap:a,loadedImageDataMap2:u}=this,c=n||r,{maxIndex:l,create:h}=this.testEmptyMaxCount(o,i,c);if(-1===l)return!1;h&&(s[l]=this.createMergeTexture()),i.forEach((t,n)=>{const{x:r,y:i}=bb.getXY(t.textureIndex,100);i===l&&(this.textureMap.delete(n),delete o[i][r],e.push(t))}),e.forEach(t=>{i.delete(t.id)});let p=o[l];p||(p=o[l]=[]);const f=Array.from(c);f.sort((t,e)=>t[1].centerDis-e[1].centerDis);let d=0;for(let e=0;e<16&&f[0];e++){if(!p[e]){if(d>=bb.updateTextureMax&&!n)break;const[r,i]=f.shift();c.delete(r),i.textureIndex=100*l+e,p[e]=r,this.textureMap.set(r,i),t.push(i);{const t=a.get(r);this.updateMergeTexture(s[l],t,e),i.frize||a.delete(r)}d++}}return t.length>0||e.length>0}testEmptyMaxCount(t,e,n){if(!e.size&&!n.size)return{maxIndex:-1,maxCount:0,create:!1};const r=[],i=t.length;for(let t=0;t<i;t++)r[t]=0;const o=Array.from(r);e&&e.forEach(t=>{if(t.time>1800){const{y:e}=bb.getXY(t.textureIndex,100);o[e]++}});for(let e=0;e<i;e++){const n=t[e];for(let t=0;t<16;t++)n[t]&&r[e]++}const s=r.map((t,e)=>16-t+(o[e]||0)),a=n.size;let u=0,c=0;for(let t=0;t<s.length;t++){const e=s[t],n=o[t];if(a){if(u>=bb.updateTextureMax||u>=a)break;e>u&&(u=e,c=t)}else n>u&&(u=n,c=t)}let l=!1;if(0===u)if(c=t.length,c>=16){let t;e.forEach(e=>{(!t||t.time>e.time)&&(t=e)}),t?(c=bb.getXY(t.textureIndex,100).y,u=1):(c=-1,u=0)}else 0===a?(c=-1,u=0,l=!1):(u=16,l=!0);return{maxIndex:c,maxCount:u,create:l}}createMergeTexture(){const{THREE:t}=Nd.getInstance(),e=db(),n=new Uint8Array(e*e*4*4*4);return new t.DataTexture(n,4*e,4*e)}createCanvasTexture(t){const{THREE:e}=Nd.getInstance(),n=this.getContext2d(t);return new e.Texture(n.canvas)}updateCanvasTexture(t,e,n,r){const{x:i,y:o}=bb.getXY(r,4),s=db();e.drawImage(n,i*s,(3-o)*s),t.needsUpdate=!0}updateMergeTexture(t,e,n){const r=t.image.data,i=e.data,{x:o,y:s}=bb.getXY(n,4),a=db(),u=4*a*4,c=4*a,l=s*u*a+o*c;for(let t=0;t<a;t++)for(let e=0;e<a;e++){const n=l+t*u+4*e,o=t*c+4*e;r[n]=i[o],r[n+1]=i[o+1],r[n+2]=i[o+2],r[n+3]=i[o+3]}t.needsUpdate=!0}updateMergeTexture2(t,e,n,r){const i=t.image.data,o=n.image.data,{x:s,y:a}=bb.getXY(e,4),{x:u,y:c}=bb.getXY(r,4),l=db(),h=4*l*4,p=4*l,f=a*h*l+s*p,d=c*h*l+u*p;for(let t=0;t<l;t++)for(let e=0;e<l;e++){const n=f+t*h+4*e,r=d+t*h+4*e;i[n]=o[r],i[n+1]=o[r+1],i[n+2]=o[r+2],i[n+3]=o[r+3]}t.needsUpdate=!0}loadImgAsync(t){const e=new Image;e.setAttribute("crossOrigin","anonymous");const{ctx:n}=this;return new Promise((r,i)=>{e.onload=()=>{n.drawImage(e,0,0);const t=db(),i=n.getImageData(0,0,t,t);r(i)},e.onerror=()=>{i()},e.src=t})}loadImgAsync2(t){const e=new Image;return e.setAttribute("crossOrigin","anonymous"),new Promise((n,r)=>{e.onload=()=>{n(e)},e.onerror=()=>{r()},e.src=t})}updateDeletingTextures(){const{deletingMap:t}=this;t.forEach(t=>{t.time++})}formatTextures(t){const{textureInfoIds:e,textureMap:n,textures:r,loadedImageDataMap2:i}=this,o=e.length;let s,a=0,u=o-1,c=0,l=16,h=-1,p=!1;for(;a<u;)if(s){if(p)break;if(!e[a][c]){e[a][c]=s,delete e[u][l];const i=n.get(s);i&&(t.push(i),i.textureIndex=100*a+c,this.updateMergeTexture2(r[a],c,r[u],l),-1===h?h=a:h!==a&&(p=!0)),s=void 0}c++,c>=16&&(a++,c=0)}else l--,l<0&&(u--,l=16),s=e[u][l];if(u<o-1){e.splice(u+1,o-1-u);r.splice(u+1,o-1-u);0}return 0!==t.length}update(){this.loadTexturesAsync(),this.updateDeletingTextures();const t=[],e=[];let n=this.updateTextures(t,e);return n||(n=this.formatTextures(t)),n&&this.emit(v_.TEXTURE_UPDATE,t,e),n}static get instance(){return this.__instance||(this.__instance=new y_),this.__instance}}var x_,b_=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};!function(t){t[t.AlwaysHide=0]="AlwaysHide",t[t.AlwaysShow=1]="AlwaysShow",t[t.Editing=2]="Editing",t[t.Show=3]="Show"}(x_||(x_={}));class __ extends eg{constructor(t,e){super(),this.initialized=!1;const{modelElement:n,groundParams:r,indicatorImageURL:i,invisibleIndicatorImageURL:o,indicatorWidth:s,indicatorHeight:a,indicatorPositionMap:u,globalScale:c,showInvisible:l}=e||{globalScale:1},{THREE:h}=Nd.getInstance();this.currentPanoramaID=-1,this.panoramaMap=new Map,this.indicatorMap=new Map,this.indicatorVisibilityMap=new Map,this.indicatorHiddenMap=new Map,this.indicatorPositionMap=u||new Map,this.inSightIndicators=[],this.indicatorWidth=s||2*__.IndicatorRadius,this.indicatorHeight=a||2*__.IndicatorRadius,this.maxWorldDistance=13,this.globalScale=c||1,this.showInvisible=l||!1,this.group=new h.Group,this.add(this.group),this.viewConfigurations=new Map,this.eventListeners={onFloorModelLoaded:t=>{t===this.modelElement&&this.updateIndicatorsPositions()}},this.groundParams=r,this.bindModelElement(n),this.initIndicator(i,o),this.initPanoramas(t),this.initIndicatorPosition(),kd.on(zd.ELEMENT_LOADED,this.eventListeners.onFloorModelLoaded),this.initialized=!1,this.needUpdate=!1}initPanoramas(t){this.panoramaDatas=new Map,t.forEach(t=>{this.panoramaDatas.set(t.pid,t)}),t.forEach(t=>{const e=new g_(t.pid,t.seqID,t.useLowTextureURLsOnly?t.textureURLs||t.highTextureURLs:t.highTextureURLs||t.textureURLs,t.neighbourPanoramaIDs,t.useLowTextureURLsOnly?1:2,t.offLineTextureUrls,t.offLineTextureLevel,t.position,t.quaternion);e.scale.set(this.globalScale,this.globalScale,this.globalScale),this.putPanorama(e)})}initIndicatorPosition(){this.modelElement instanceof Yx&&this.modelElement.isModelLoaded()&&this.updateIndicatorsPositions()}updateLevelMax(t){this.panoramaMap&&this.panoramaMap.forEach(e=>{e.levelMax=t})}dispose(t){super.dispose(),kd.off(zd.ELEMENT_LOADED,this.eventListeners.onFloorModelLoaded),this.panoramaMap&&(this.panoramaMap.forEach(e=>{this.group.remove(e),t!==e.pid&&Ab.sharedInstance.recycleCubeTexture(e.textureURLs),e.dispose()}),this.panoramaMap.clear()),this.indicatorMap&&(this.indicatorMap.forEach(t=>{this.group.remove(t)}),this.indicatorMap.clear()),this.boundBox&&(this.group.remove(this.boundBox),this.boundBox.geometry.dispose(),this.boundBox=null),this.remove(this.group)}initIndicator(t,e){const{THREE:n}=Nd.getInstance(),i="\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",o="\n uniform sampler2D map;\n uniform float opacity;\n uniform vec4 blendColor;\n varying vec2 vUv;\n void main(){\n vec4 texColor = texture2D(map, vUv);\n gl_FragColor = vec4((texColor * (1.0 - blendColor.a) + blendColor * blendColor.a).rgb, texColor.a * opacity);\n }\n ";let s,a,u;this.indicatorShaderUniforms={map:{type:"t",value:null},blendColor:{type:"v4",value:new n.Vector4(0,0,0,0)},opacity:{value:1}},this.invisibleIndicatorShaderUniforms={map:{type:"t",value:null},blendColor:{type:"v4",value:new n.Vector4(1,0,0,.5)},opacity:{value:1}},this.indicatorMaterials=new Map,t?(a=new n.PlaneBufferGeometry(this.indicatorWidth,this.indicatorHeight),s=new n.ShaderMaterial({transparent:!0,vertexShader:i,fragmentShader:o,uniforms:this.indicatorShaderUniforms,side:r.DoubleSide,depthTest:!1,depthWrite:!1,name:"indicatorMaterial"}),this.indicatorImageURL=t,(new n.TextureLoader).load(t,t=>{this.indicatorShaderUniforms.map.value=t})):(a=new n.CircleGeometry(this.indicatorWidth/2,32),s=new n.MeshBasicMaterial({transparent:!0}),s.side=r.DoubleSide,s.depthTest=!1,s.depthWrite=!1,s.color=new n.Color(16777215));const c=e||t;c?(u=new n.ShaderMaterial({transparent:!0,vertexShader:i,fragmentShader:o,uniforms:this.invisibleIndicatorShaderUniforms,side:r.DoubleSide,depthTest:!1,depthWrite:!1,name:"invisibleIndicatorMaterial"}),(new n.TextureLoader).load(c,t=>{this.invisibleIndicatorShaderUniforms.map.value=t})):(u=new n.MeshBasicMaterial,u.side=r.DoubleSide,u.depthTest=!1,u.depthWrite=!1,u.color=new n.Color(16711680));const l=new n.Mesh(a,s);this.setIndicatorMeshPrototype(l),this.setIndicatorMaterial(s,x_.Editing,!0),this.setIndicatorMaterial(u,x_.Editing,!1),this.setIndicatorMaterial(s,x_.Show,!0)}updateIndicators(){this.getPIDPositionMap(this.inSightIndicators).forEach((t,e)=>{if(!this.indicatorPositionMap.get(e)&&(this.groundParams||this.modelElement instanceof Yx)){let n;if(this.groundParams&&this.groundParams.groundPlane)n=Yx.intersectWithGroundPlane(t,this.groundParams);else{n=this.modelElement.intersectGround(t)}n&&this.indicatorPositionMap.set(e,n)}}),this.inSightIndicators.forEach(t=>{let e=this.indicatorMap.get(t);if(!e){e=this.indicatorMeshPrototype.clone(),this.indicatorMap.set(t,e),this.group.add(e);const n=this.panoramaDatas.get(t);n&&n.position&&e.position.copy(n.position)}const n=this.indicatorPositionMap.get(t);n&&e.position.copy(n)})}update(){const t=new tg(this);if(this.initialized){if(this.needUpdate)this.updateIndicators(),this.needUpdate=!1,t.needUpdate=!0;else if(this.currentPanorama){this.currentPanorama.update().needUpdate&&(t.needUpdate=!0)}}else this.initialized=!0,t.needUpdate=!0;return this.initialized&&!this.parent&&(t.shouldPlaceElement=!0),t}bindModelElement(t){t&&(this.modelElement=t),this.boundBox&&(this.group.remove(this.boundBox),this.boundBox=null),this.getModelBoundBox()}static getBoundBox(t){if(!t)return null;const{THREE:e}=Nd.getInstance(),n=(new e.Box3).setFromObject(t),r=n.getSize(new e.Vector3),i=Math.max(r.x,r.y,r.z),o=new e.Mesh(new e.BoxBufferGeometry(i,i,i));return o.position.copy(n.max.clone().add(n.min).multiplyScalar(.5)),o}getModelBoundBox(){this.boundBox||(this.boundBox=__.getBoundBox(this.modelElement),this.boundBox&&(this.boundBox.visible=!0,this.boundBox.frustumCulled=!1,this.boundBox.renderOrder=100,this.group.add(this.boundBox)))}setBoundBoxAppearance(t){this.getModelBoundBox(),this.boundBox&&(this.boundBox.material=t,this.needUpdate=!0)}setBoundBoxVisible(t){this.boundBox&&(this.boundBox.visible=t)}presentPanorama(t){return b_(this,void 0,void 0,(function*(){return yield this.initTexturesByPanorama(t)}))}initTexturesByPanorama(t){return b_(this,void 0,void 0,(function*(){t.updateLevel(0);const e=t.getPreTextureInfos();return yield y_.instance.initTextures(e)}))}presentPanoramaOfPID(t){return b_(this,void 0,void 0,(function*(){const e=this.getPanoramaByPID(t);let n=1;return e&&(n=yield this.presentPanorama(e)),n&&(this.currentPanoramaID=t,this.currentPanorama=e,this.emit(Ud.PANORAMA_PRESENTED,t)),n}))}visibleRadiusOfView(t){if(!t)return __.DefaultVisibleRadius;const e=this.viewConfigurations.get(t);return e&&e.visibleRadius?e.visibleRadius:__.DefaultVisibleRadius}panoramaIDsAround(t,e){const n=this.panoramaDatas.get(t);if(!n||!n.position)return null;const r=[t],i=this.visibleRadiusOfView(e);return n.neighbourPanoramaIDs.map(t=>this.panoramaDatas.get(t)).forEach(t=>{if(t&&t.position){const e=n.position.distanceTo(t.position);(this.showInvisible||t.visible)&&e<=i&&r.push(t.pid)}}),r}presentPanoramaAround(t,e){return b_(this,void 0,void 0,(function*(){let n=1;return this.panoramaIDsAround(t,e)&&(n=yield this.presentPanoramaOfPID(t)),n}))}getPIDPositionMap(t){const e=new Map;return t.forEach(t=>{const n=this.panoramaDatas.get(t);n&&e.set(t,n.position)}),e}getIndicatorPosition(t){return this.indicatorPositionMap.get(t)}presentPanoramaIndicators(t){if(!this.modelElement)return;const{THREE:e}=Nd.getInstance();this.inSightIndicators=[],t.forEach((t,n)=>{if(this.groundParams||this.modelElement instanceof Yx){if(!this.indicatorPositionMap.get(n)){let r;if(this.groundParams&&this.groundParams.groundPlane)r=Yx.intersectWithGroundPlane(t,this.groundParams);else{r=this.modelElement.intersectGround(t)}r&&this.indicatorPositionMap.set(n,r.add(new e.Vector3(0,0,__.IndicatorOffsetZ)))}}this.inSightIndicators.push(n)}),this.needUpdate=!0}updateIndicatorsPositions(){return b_(this,void 0,void 0,(function*(){const{THREE:t}=Nd.getInstance();this.panoramaMap.forEach((e,n)=>{if(this.indicatorPositionMap.get(n))return;const{position:r}=e;let i;if(this.groundParams&&this.groundParams.groundPlane)i=Yx.intersectWithGroundPlane(r,this.groundParams);else{i=this.modelElement.intersectGround(r)}i&&this.indicatorPositionMap.set(n,i.add(new t.Vector3(0,0,__.IndicatorOffsetZ)))});const e=yield this.getPIDPositionMap(this.inSightIndicators);this.presentPanoramaIndicators(e)}))}presentPanoramaIndicatorsAround(t,e){return b_(this,void 0,void 0,(function*(){const n=this.panoramaIDsAround(t,e);if(n){const t=yield this.getPIDPositionMap(n);this.presentPanoramaIndicators(t)}}))}getIndicatorVisibility(t){const e=this.indicatorVisibilityMap.get(t);return void 0===e||e}setIndicatorVisibility(t,e){let n;void 0===e?(n=[],this.indicatorMap.forEach((t,e)=>{n.push(e)})):n=Array.isArray(e)?e:[e],n.forEach(e=>{this.indicatorVisibilityMap.set(e,t);const n=this.indicatorMap.get(e);n&&(this.group.remove(n),this.indicatorMap.delete(e))}),this.needUpdate=!0}setIndicatorHidden(t,e){let n;void 0===e?(n=[],this.indicatorMap.forEach((t,e)=>{n.push(e)})):n=Array.isArray(e)?e:[e],n.forEach(e=>{this.indicatorHiddenMap.set(e,t);const n=this.indicatorMap.get(e);n&&(this.group.remove(n),this.indicatorMap.delete(e))}),this.needUpdate=!0}intersectIndicators(t,e){let n=[];const r=e.normalize(),i=Math.min(this.indicatorHeight,this.indicatorWidth)/2;return this.indicatorMap.forEach((e,o)=>{const s=e.position;if(Number.isNaN(s.x))return;const a=s.clone().sub(t),u=a.dot(r);if(u>0){const t=r.clone().multiplyScalar(u),e=a.sub(t).length();e<=i&&n.push({pid:o,distance:e})}}),n.length>0?(n=n.sort((t,e)=>t.distance<e.distance?-1:t.distance>e.distance?1:0),n[0].pid):-1}intersectIndicatorsOnScreen(t,e,{screenWidth:n,screenHeight:r},i){const o=Array.from(this.indicatorMap),s=o.map(([,t])=>t),a=ky.getMouseIntersectionOnScreen(s,t,{screenWidth:n,screenHeight:r},e,i,s,this.maxWorldDistance);if(a){const t=o.find(([,t])=>t===a);if(t)return t[0]}return-1}putPanorama(t){const e=this.panoramaMap.get(t.pid);e&&(this.group.remove(e),e.dispose()),this.panoramaMap.set(t.pid,t),this.group.add(t),this.needUpdate=!0}initializePanoramasIfNecessary(t){return b_(this,void 0,void 0,(function*(){let e=[];if(Array.isArray(t))e=t;else if("all"===t)e=Array.from(this.panoramaDatas.keys());else{const n=t;e.push(n);const r=new Set;r.add(n);const i=[n];for(;i.length>0;){const t=i.splice(0,1)[0],n=this.panoramaDatas.get(t);n&&n.neighbourPanoramaIDs.forEach(t=>{r.has(t)||(r.add(t),i.push(t),e.push(t))})}}const n=e.map(t=>this.getPanoramaByPID(t));return Promise.all(n)}))}getPanoramaByPID(t){const e=this.panoramaMap.get(t);if(e)return e;const n=this.panoramaDatas.get(t);if(!n)return;const r=new g_(n.pid,n.seqID,n.useLowTextureURLsOnly?n.textureURLs||n.highTextureURLs:n.highTextureURLs||n.textureURLs,n.neighbourPanoramaIDs,n.useLowTextureURLsOnly?1:2,n.offLineTextureUrls,n.offLineTextureLevel,n.position,n.quaternion);return r.scale.set(this.globalScale,this.globalScale,this.globalScale),this.putPanorama(r),r}getPanoramaByPIDInstant(t){return this.panoramaMap.get(t)||null}getNeghbourPanoClosestToRay(t){if(-1===this.currentPanoramaID)return-1;const e=this.panoramaMap.get(this.currentPanoramaID);if(!e)return-1;if(!e.neighborPanoramaIDs||0===e.neighborPanoramaIDs.length)return-1;const n=t.clone().normalize();let r=-1,i=-1;return e.neighborPanoramaIDs.forEach(t=>{const o=this.panoramaMap.get(t);if(!o)return;const s=o.position.clone().sub(e.position).normalize().dot(n);s>r&&(r=s,i=t)}),r>=Math.cos(12*Math.PI/180)?i:-1}updateIndicatorGeometry(){const{THREE:t}=Nd.getInstance();let e;e=this.indicatorImageURL?new t.PlaneBufferGeometry(this.indicatorWidth,this.indicatorHeight):new t.CircleGeometry(this.indicatorWidth/2,32);const n=new Set;Array.from(this.indicatorMap).forEach(([,t])=>{n.add(t.geometry),t.geometry=e}),Array.from(n).forEach(t=>{t.dispose()}),this.indicatorMeshPrototype.geometry=e;const r=new t.Mesh(e,this.indicatorMeshPrototype.material);this.setIndicatorMeshPrototype(r)}setIndicatorSize(t,e){this.indicatorWidth=t,this.indicatorHeight=e,this.updateIndicatorGeometry()}setIndicatorImageURL(t){const{THREE:e}=Nd.getInstance();(new e.TextureLoader).load(t,n=>{const i="\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",o="\n uniform sampler2D map;\n uniform float opacity;\n uniform vec4 blendColor;\n varying vec2 vUv;\n void main(){\n vec4 texColor = texture2D(map, vUv);\n gl_FragColor = vec4((texColor * (1.0 - blendColor.a) + blendColor * blendColor.a).rgb, texColor.a * opacity);\n }\n ";let s=this.getIndicatorMaterial(x_.Editing,!0),a=new e.ShaderMaterial({transparent:!0,vertexShader:i,fragmentShader:o,uniforms:this.indicatorShaderUniforms,side:r.DoubleSide,depthTest:!1,depthWrite:!1,name:"indicatorMaterial"});this.setIndicatorMaterial(a,x_.Editing,!0),s.dispose(),s=this.getIndicatorMaterial(x_.Show,!0),this.setIndicatorMaterial(a,x_.Show,!0),s.dispose(),a=new e.ShaderMaterial({transparent:!0,vertexShader:i,fragmentShader:o,uniforms:this.invisibleIndicatorShaderUniforms,side:r.DoubleSide,depthTest:!1,depthWrite:!1,name:"invisibleIndicatorMaterial"}),this.indicatorShaderUniforms.map.value=n,this.invisibleIndicatorShaderUniforms.map.value=n,this.setIndicatorMaterial(a,x_.Editing,!1),this.indicatorImageURL||this.setIndicatorMeshPrototype(new e.Mesh(new e.PlaneBufferGeometry(this.indicatorWidth,this.indicatorHeight),a)),this.indicatorImageURL=t,this.needUpdate=!0,this.updateIndicatorGeometry()})}getIndicatorSize(){return[this.indicatorWidth,this.indicatorHeight]}setIndicatorMeshPrototype(t){this.indicatorMeshPrototype=t,this.panoramaMap.forEach((t,e)=>{const n=this.indicatorMap.get(e);n&&(this.group.remove(n),this.indicatorMap.delete(e))}),t.renderOrder=300,this.needUpdate=!0}setIndicatorMaterial(t,e,n){let r=this.indicatorMaterials.get(e);r||(r=new Map,this.indicatorMaterials.set(e,r)),r.set(n,t),this.needUpdate=!0}getIndicatorMaterial(t,e){let n=this.indicatorMaterials.get(t);return n||(n=new Map,this.indicatorMaterials.set(t,n)),n.get(e)}addGroupViewConfiguration(t){const e=this.viewConfigurations.get(t.targetView);e&&(void 0===t.showBoundBox&&void 0!==e.showBoundBox&&(t.showBoundBox=e.showBoundBox),void 0===t.visibleRadius&&void 0!==e.visibleRadius&&(t.visibleRadius=e.visibleRadius),void 0===t.indicatorDisplayMode&&void 0!==e.indicatorDisplayMode&&(t.indicatorDisplayMode=e.indicatorDisplayMode)),this.viewConfigurations.set(t.targetView,t),this.needUpdate=!0}setMaxWorldDistance(t){this.maxWorldDistance=t}}__.DefaultVisibleRadius=10,__.IndicatorRadius=.1,__.IndicatorOffsetZ=.1;class w_{static getModelVS(){return"\n uniform vec3 pano0Position;\n uniform mat4 pano0Matrix;\n uniform vec3 pano1Position;\n uniform mat4 pano1Matrix;\n\n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n\n void main() {\n\n vec4 worldPosition = modelMatrix * vec4(position, 1.0);\n\n vec3 positionLocalToPanoCenter0 = worldPosition.xyz - pano0Position;\n vWorldPosition0 = (vec4(positionLocalToPanoCenter0, 1.0) * pano0Matrix).xyz;\n vWorldPosition0.y *= -1.0;\n\n vec3 positionLocalToPanoCenter1 = worldPosition.xyz - pano1Position;\n vWorldPosition1 = (vec4(positionLocalToPanoCenter1, 1.0) * pano1Matrix).xyz;\n vWorldPosition1.y *= -1.0;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }"}static getInstantTranslationVS(){return"\n uniform mat4 matrixT;\n\n uniform vec3 pano0Position;\n uniform mat4 pano0Matrix;\n uniform vec3 pano1Position;\n uniform mat4 pano1Matrix;\n\n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n\n void main() {\n\n vec4 worldPosition = modelMatrix * vec4(position, 1.0);\n vec4 worldPosition0 = matrixT * worldPosition;\n\n vec3 positionLocalToPanoCenter1 = worldPosition.xyz - pano1Position;\n vWorldPosition1 = (vec4(positionLocalToPanoCenter1, 1.0) * pano1Matrix).xyz;\n vWorldPosition1.y *= -1.0;\n\n vec3 positionLocalToPanoCenter0 = worldPosition0.xyz - pano0Position;\n vWorldPosition0 = (vec4(positionLocalToPanoCenter0, 1.0) * pano0Matrix).xyz;\n vWorldPosition0.y *= -1.0;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }"}static getModelFS(){return"\n uniform float weight0;\n uniform float weight1;\n\n uniform samplerCube pano0Map;\n\n uniform samplerCube pano1Map;\n\n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n\n void main() {\n vec3 cp0 = vWorldPosition0.xyz;\n vec3 cp1 = vWorldPosition1.xyz;\n vec4 colorFromPano0 = textureCube( pano0Map, cp0);\n vec4 colorFromPano1 = textureCube( pano1Map, cp1);\n\n vec4 colorFromPanos;\n // 'colorFromPanos = mix(colorFromPano0, colorFromPano1, progress);\n colorFromPanos = colorFromPano0 * weight0 + colorFromPano1 * weight1;\n gl_FragColor = vec4(colorFromPanos.rgb, 1.0);\n }"}static debugModelVS(){return"\n uniform vec2 xRange;\n uniform vec2 yRange;\n uniform vec2 zRange;\n varying vec4 vColor;\n\n void main() {\n float x = (position.x - xRange.x) / xRange.y;\n float y = (position.y - yRange.x) / yRange.y;\n float z = (position.z - zRange.x) / zRange.y;\n vColor = vec4(x, y, z, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }"}static debugModelFS(){return"\n varying vec4 vColor;\n\n void main() {\n gl_FragColor = vColor;\n }"}static createModelUniforms(){const{THREE:t}=Nd.getInstance();return{weight0:{type:"f",value:0},weight1:{type:"f",value:0},pano0Map:{type:"t",value:null},pano0Position:{type:"v3",value:new t.Vector3},pano0Matrix:{type:"m4",value:new t.Matrix4},pano1Map:{type:"t",value:null},pano1Position:{type:"v3",value:new t.Vector3},pano1Matrix:{type:"m4",value:new t.Matrix4}}}static createInstantTranslationUniforms(){const{THREE:t}=Nd.getInstance();return{weight0:{type:"f",value:0},weight1:{type:"f",value:0},pano0Map:{type:"t",value:null},pano0Position:{type:"v3",value:new t.Vector3},pano0Matrix:{type:"m4",value:new t.Matrix4},pano1Map:{type:"t",value:null},pano1Position:{type:"v3",value:new t.Vector3},pano1Matrix:{type:"m4",value:new t.Matrix4},matrixT:{type:"m4",value:new t.Matrix4}}}static getModelMeshInElement(t){let e;const{THREE:n}=Nd.getInstance();return t instanceof n.Mesh?t:(t&&t.traverse(t=>{t instanceof n.Mesh&&(e=t)}),e)}}var M_=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};class E_ extends Xb{constructor(t,e,n,r){super(),this.levels=[1,1.5,3],this.levelMax=2;const{THREE:i}=Nd.getInstance();this.planeMap=new Map,this.showModel=void 0===r||r,this.levelMap=new Map,this.isAnimating=!1,this.touches={s:[new i.Vector2,new i.Vector2],c:[new i.Vector2,new i.Vector2],state:"idle",dist:0,fov:60},e&&(this.panoramaGroups=e instanceof __?[e]:e,this.panoramaGroups.length>0&&(this.curPanoramaGroup=this.panoramaGroups[0])),n&&(this.basicController=n),this.pid2GroupMap=new Map,this.eventListeners={onTextureUpdate:(t,e)=>{this.updatePanoramaTextureInfos(t,e)},onMouseDown:t=>{this.onMouseDown(t)},onMouseMove:t=>{this.onMouseMove(t)},onMouseUp:t=>{this.onMouseUp(t)},onMouseWheel:t=>{this.onMouseWheel(t)},onTouchStart:t=>{this.onTouchStart(t)},onTouchMove:t=>{this.onTouchMove(t)},onTouchEnd:t=>{this.onTouchEnd(t)}},t&&this.bindView(t),this.raycaster=new i.Raycaster,this.onScreenDetectRadius=1e3,this.moveOnClick=!0,this.handlePanoramaUpdate=bb.throttle(t=>{this.updatePlaneInCamera(t)},100),this.handlePanoramaLevel=bb.throttle(()=>{this.updateLevel()},200),y_.instance.on(v_.TEXTURE_UPDATE,this.eventListeners.onTextureUpdate);const o=void 0===r?this.showModel:!0===r;this.panoramaGroups.forEach(t=>{const e=E_.getModelMesh(t);this.setModelAppearance(t.modelElement,o,void 0,e)})}setEnabled(t){t!==this.enabled&&(this.enabled=t,t?this.registerEvents():this.unregisterEvents())}registerEvents(){this.view&&(this.view.on(zd.MOUSE_DOWN,this.eventListeners.onMouseDown),this.view.on(zd.MOUSE_MOVE,this.eventListeners.onMouseMove),this.view.on(zd.MOUSE_UP,this.eventListeners.onMouseUp),this.view.on(zd.MOUSE_WHEEL,this.eventListeners.onMouseWheel),this.view.on(zd.TOUCH_START,this.eventListeners.onTouchStart),this.view.on(zd.TOUCH_MOVE,this.eventListeners.onTouchMove),this.view.on(zd.TOUCH_END,this.eventListeners.onTouchEnd))}unregisterEvents(){this.view&&(this.view.off(zd.MOUSE_DOWN,this.eventListeners.onMouseDown),this.view.off(zd.MOUSE_MOVE,this.eventListeners.onMouseMove),this.view.off(zd.MOUSE_UP,this.eventListeners.onMouseUp),this.view.off(zd.MOUSE_WHEEL,this.eventListeners.onMouseWheel),this.view.off(zd.TOUCH_START,this.eventListeners.onTouchStart),this.view.off(zd.TOUCH_MOVE,this.eventListeners.onTouchMove),this.view.off(zd.TOUCH_END,this.eventListeners.onTouchEnd))}onMouseDown(t){const{THREE:e}=Nd.getInstance();this.touches.s[0]=new e.Vector2(t.clientX,t.clientY),this.touches.state="down"}onMouseMove(t){const{THREE:e}=Nd.getInstance();if(this.touches.c[0]=new e.Vector2(t.clientX,t.clientY),"down"===this.touches.state&&this.touches.c[0].distanceToSquared(this.touches.s[0])>100&&(this.touches.state="move"),this.raycaster&&this.captureMove){const{clientWidth:n,clientHeight:r}=this.view.container,{left:i,top:o}=this.view.container.getBoundingClientRect(),s=t.clientX-i,a=t.clientY-o;if(this.raycaster.setFromCamera({x:s,y:a},this.view.camera),this.curPanoramaGroup){let t;t=this.onScreenDetectRadius>0&&this.view.camera?this.curPanoramaGroup.intersectIndicatorsOnScreen(new e.Vector2(s,a),this.onScreenDetectRadius,{screenWidth:n,screenHeight:r},this.view.camera):this.curPanoramaGroup.intersectIndicators(this.raycaster.ray.origin,this.raycaster.ray.direction),t>-1&&this.emit(Ud.PANORAMA_HOVER,t,this.curPanoramaGroup.getIndicatorPosition(t))}}"move"===this.touches.state&&this.onMouseDrag()}onMouseUp(t){return M_(this,void 0,void 0,(function*(){const{THREE:e}=Nd.getInstance();if("down"===this.touches.state){const{clientWidth:n,clientHeight:r}=this.view.container,{left:i,top:o}=this.view.container.getBoundingClientRect(),s=t.clientX-i,a=t.clientY-o;if(this.raycaster&&(this.raycaster.setFromCamera({x:s,y:a},this.view.camera),this.onScreenDetectRadius&&this.curPanoramaGroup)){let i;i=this.view.camera?this.curPanoramaGroup.intersectIndicatorsOnScreen(new e.Vector2(s,a),this.onScreenDetectRadius,{screenWidth:n,screenHeight:r},this.view.camera):this.curPanoramaGroup.intersectIndicators(this.raycaster.ray.origin,this.raycaster.ray.direction),-1!==i&&(this.emit(Ud.CLICK_PANORAMA,i,t),0===t.button&&this.moveOnClick&&this.curPanoramaGroup.currentPanoramaID!==i&&(yield this.moveToPanorama(i,{interval:1e3,fadeInOut:!1})))}}this.touches.state="idle"}))}onMouseWheel(t){t.preventDefault(),this.handlePanoramaLevel()}onTouchStart(t){const{THREE:e}=Nd.getInstance(),n=t.touches.length,r=t.targetTouches.length;for(let r=0;r<Math.min(n,2);r++){const n=t.touches[r];this.touches.s[r]=new e.Vector2(n.clientX,n.clientY)}this.touches.state="down",r>1&&this.view.camera instanceof e.PerspectiveCamera&&(this.touches.state="zoom",this.touches.dist=this.touches.s[0].distanceTo(this.touches.s[1]),this.touches.fov=this.view.camera.fov)}onTouchMove(t){const{THREE:e}=Nd.getInstance();if(!(this.view.camera&&this.view.camera instanceof e.PerspectiveCamera))return;if("idle"===this.touches.state)return;t.preventDefault(),t.stopPropagation();const n=t.touches.length;for(let r=0;r<Math.min(n,2);r++){const n=t.touches[r];this.touches.c[r]=new e.Vector2(n.clientX,n.clientY)}"down"===this.touches.state&&this.touches.c[0].distanceToSquared(this.touches.s[0])>100?this.touches.state="move":"zoom"===this.touches.state&&this.handlePanoramaLevel(),"move"===this.touches.state&&this.onMouseDrag()}onTouchEnd(t){return M_(this,void 0,void 0,(function*(){if("idle"===this.touches.state)return;const{THREE:e}=Nd.getInstance();if("down"===this.touches.state&&this.view.renderer){const n=new e.Vector2(this.touches.s[0].x,this.touches.s[0].y),{clientWidth:r,clientHeight:i}=this.view.container,{left:o,top:s}=this.view.container.getBoundingClientRect(),a=n.x-o,u=n.y-s;if(this.raycaster.setFromCamera({x:a,y:u},this.view.camera),this.curPanoramaGroup){let n;n=this.onScreenDetectRadius>0&&this.view.camera?this.curPanoramaGroup.intersectIndicatorsOnScreen(new e.Vector2(a,u),this.onScreenDetectRadius,{screenWidth:r,screenHeight:i},this.view.camera):this.curPanoramaGroup.intersectIndicators(this.raycaster.ray.origin,this.raycaster.ray.direction),-1!==n&&(this.emit(Ud.CLICK_PANORAMA,n,t),this.moveOnClick&&this.curPanoramaGroup.currentPanoramaID!==n&&(yield this.moveToPanorama(n,{interval:1e3,showModel:!0,fadeInOut:!1})))}}this.touches.state="idle"}))}setLevels(t){this.levels=t}updateLevel(){if(!this.curPanorama)return;const{THREE:t}=Nd.getInstance(),e=this.view;if(e.camera){const{levels:n,levelMax:r}=this,{y:i}=(new t.Vector3).setFromMatrixScale(e.camera.projectionMatrix);let o=0,s=!1;for(let t=0;t<n.length;t++)if(i<n[t]){o=t,s=!0;break}s||(o=n.length),o>r&&(o=r);const a=this.curPanorama.levelMax;o>a&&(o=a),this.curPanorama.updateLevel(o),this.planeNeedUpdate=!0}}updateLevelMax(t){if(t!==this.levelMax){this.levelMax=t;for(let e=0;e<this.panoramaGroups.length;e++){this.panoramaGroups[e].updateLevelMax(t)}}}onMouseDrag(){this.planeNeedUpdate=!0}bindView(t){this.view=t,this.container=t.container,this.setEnabled(!0)}lookFromPanorama(t,e,n,r){return M_(this,void 0,void 0,(function*(){const i=yield this.showPanorama(t,{lookDirection:e,showModel:n,preInitPanoramasStrategy:r});i&&this.emit(Ud.MOVE_TO_PANORAMA,t,i?i.position:null,this.panoramaGroupChanged),this.panoramaGroupChanged=!1}))}showPanorama(t,e){return M_(this,void 0,void 0,(function*(){const{lookDirection:n,target:r,showModel:i,preInitPanoramasStrategy:o}=e||{},{pano:s,panoramaGroup:a}=this.getPanoramaOfPID(t);if(a){if(this.curPanoramaGroup!==a&&(this.panoramaGroupChanged=!0),this.curPanoramaGroup=a,a.modelElement&&this.setModelAppearance(a.modelElement,!1,void 0),o&&a.initializePanoramasIfNecessary(o),a.panoramaIDsAround(t),a.presentPanoramaIndicatorsAround(t,this.view),s){n?this.setCameraLookAt(s.position,n):r&&this.setCameraLookAt(s.position,r.clone().sub(s.position)),this.emit(Ud.WILL_LOAD_PANORAMA,s.pid),this.curPanorama&&this.panoramaUnmount(this.curPanorama),this.curPanorama=s,this.panoramaMount(this.curPanorama);if(!(yield a.presentPanoramaAround(t,this.view)))return;if(this.updateLevel(),void 0===i||!0===i){const t=this.getModelMaterial(),e=t.uniforms;e.pano0Matrix.value=s.matrix,e.pano0Position.value=s.position,e.pano1Matrix.value=s.matrix,e.pano1Position.value=s.position,e.weight0.value=1,e.weight1.value=0;const n=y_.instance.getCubeTextureByPid(s.pid);[e.pano0Map.value,e.pano1Map.value]=[n,n],this.setModelAppearance(a.modelElement,!0,t)}}return s}}))}setCameraLookAt(t,e){let n;const{THREE:r}=Nd.getInstance();n=e?e.clone().normalize():this.view.camera?this.view.camera.getWorldDirection(new r.Vector3(0,0,-1)):new r.Vector3(1,0,0);const i=n.multiplyScalar(E_.DirectionVectorScalar).add(t);this.setCameraPose(i,t)}getPanoramaOfPID(t){const e=this.pid2GroupMap.get(t);if(e){return{pano:e.getPanoramaByPID(t),panoramaGroup:e}}for(let e=0;e<this.panoramaGroups.length;e++){const n=this.panoramaGroups[e],r=n.getPanoramaByPID(t);if(r)return this.pid2GroupMap.set(t,n),{pano:r,panoramaGroup:n}}return{}}setCaptureMove(t){this.captureMove=t}moveToPanorama(t,e){return M_(this,void 0,void 0,(function*(){const n=e||{};return this.moveInPath([t],{queueIfBusy:!1,lookAtTargets:n.lookAtTarget,toDirections:n.toDirection,intervals:n.interval,fovs:n.fov,fadeInOuts:n.fadeInOut,easings:n.easing,freeRotation:!n.lookAtTarget,showModel:n.showModel})}))}moveToPanoramaSync(t,e){return M_(this,void 0,void 0,(function*(){const n=e||{};return this.moveInPath([t],{queueIfBusy:!0,lookAtTargets:n.lookAtTarget,toDirections:n.toDirection,intervals:n.interval,fovs:n.fov,fadeInOuts:n.fadeInOut,easings:n.easing,freeRotation:!n.lookAtTarget,showModel:n.showModel})}))}static getModelMesh(t){if(t&&t.modelElement)return w_.getModelMeshInElement(t.modelElement)}getModelMaterial(){if(this.modelMaterial)return this.modelMaterial;const{THREE:t}=Nd.getInstance(),e=w_.createModelUniforms();return this.modelMaterial=new t.ShaderMaterial({side:t.DoubleSide,vertexShader:w_.getModelVS(),fragmentShader:w_.getModelFS(),uniforms:e,name:"modelMaterial"}),this.modelMaterial}preloadCubeTexturesOfPIDs(t,e,n){return M_(this,void 0,void 0,(function*(){const r=t.map(t=>this.getPanoramaOfPID(t)).map(({pano:t})=>{if(t)return t.textureURLs});return Ab.sharedInstance.preloadCubeTextures(r,e,n)}))}getInstantTranslationMaterial(){if(this.instantTranslationMaterial)return this.instantTranslationMaterial;const{THREE:t}=Nd.getInstance(),e=w_.createInstantTranslationUniforms();return this.instantTranslationMaterial=new t.ShaderMaterial({side:t.DoubleSide,vertexShader:w_.getInstantTranslationVS(),fragmentShader:w_.getModelFS(),uniforms:e,name:"instantTranslationMaterial"}),this.instantTranslationMaterial}setModelAppearance(t,e,n,r){if(t)if(t.visible=e,t instanceof Yx)n&&t.addMeshMaterial(n);else{let e=r;e||(e=w_.getModelMeshInElement(t)),e&&n&&(e.material=n)}}moveInPath(t,e){return M_(this,void 0,void 0,(function*(){if(0===t.length)return;const{THREE:n}=Nd.getInstance(),r=[];t.map(t=>this.getPanoramaOfPID(t)).forEach(t=>{t.pano&&r.push(t.pano.position.clone())});const{toDirections:i,lookAtTargets:o,intervals:s,fovs:a,easings:u,fadeInOuts:c,queueIfBusy:l,showModel:h,freeRotation:p,rotateDelays:f}=e||{},d=void 0===h?this.showModel:!0===h;let g,m,v,y,x=-1,b=!1;const _=Ab.sharedInstance.getCapacity();let w,M,E;const S=t=>t,A=t=>t<.25?0:t>.75?1:2*(t-.25);let C;Array.isArray(c)?C=c.map(t=>t?A:S):!0===c&&(C=A),yield this.moveCameraInPath(r,{queueIfBusy:l,toDirections:i,lookAtTargets:o,intervals:s,fovs:a,easings:u,progressTransforms:C,freeRotation:p,rotateDelays:f,beforeAllMoves:()=>M_(this,void 0,void 0,(function*(){x=this.curPanoramaGroup?this.curPanoramaGroup.currentPanoramaID:-1,g=this.getModelMaterial(),m=g.uniforms,t.length>1&&this.emit(Ud.PATH_MOVEMENT_START,t)})),onOneMoveStart:(e,r,i,o,s,a)=>M_(this,void 0,void 0,(function*(){if(y=t[e],w=this.getPanoramaOfPID(x),M=this.getPanoramaOfPID(y),!(w.pano&&M.pano&&w.panoramaGroup&&M.panoramaGroup))return!1;w.modelMesh=E_.getModelMesh(w.panoramaGroup),M.modelMesh=E_.getModelMesh(M.panoramaGroup);const u=[x],l=new Set;l.add(x);for(let n=e;u.length<_&&n<t.length;n+=1)l.has(t[n])||(l.add(t[n]),u.push(t[n]));this.emit(Ud.WILL_MOVE_TO_PANORAMA,y,M.pano?M.pano.position:null);if(!(yield w.panoramaGroup.presentPanoramaAround(M.pano.pid,this.view)))return a.loadedError=!0,!1;if(this.emit(Ud.DID_LOAD_PANORAMA,M.pano.pid),x===y)return!1;Array.isArray(c)?c.length>e?b=c[e]:c.length>0&&(b=c[c.length-1]):c&&(b=c);const h=w.panoramaGroup!==M.panoramaGroup;if(h?(g=this.getInstantTranslationMaterial(),m=g.uniforms):(g=this.getModelMaterial(),m=g.uniforms),!h&&!d){const t=M.pano.position.distanceTo(w.pano.position),e=new n.BoxGeometry(5,2*(w.pano.position.z+.93),4*t);E=new n.Mesh(e,g),E.position.copy(w.pano.position),E.up.set(0,0,1),E.lookAt(M.pano.position),M.panoramaGroup.add(E)}if([M].forEach(({panoramaGroup:t,modelMesh:e})=>{e&&t&&(v=e.material,w.panoramaGroup===M.panoramaGroup?this.setModelAppearance(t.modelElement,d,g,e):this.setModelAppearance(t.modelElement,!1,g,e),t.setBoundBoxAppearance(g),t.addGroupViewConfiguration({targetView:this.view,showBoundBox:!0}))}),h){let t=new n.Vector3(0,1,0);this.view.camera&&(t=this.view.camera.up);const e=(new n.Matrix4).lookAt(i,r,t),a=(new n.Matrix4).lookAt(s,o,t);m.matrixT.value=e.multiply((new n.Matrix4).copy(a).invert())}m.pano0Matrix.value=w.pano.matrix,m.pano0Position.value=w.pano.position,m.pano1Matrix.value=M.pano.matrix,m.pano1Position.value=M.pano.position,m.weight0.value=1,m.weight1.value=0;const p=y_.instance.getCubeTextureByPid(w.pano.pid),f=y_.instance.getCubeTextureByPid(M.pano.pid);return m.pano0Map.value=p,m.pano1Map.value=f,this.panoramaUnmount(w.pano),h})),onOneMoveUpdate:(t,e)=>{if(x===y)return;w.panoramaGroup!==M.panoramaGroup?e<.5?(m.weight0.value=1-2*e,m.weight1.value=0):(m.weight1.value=2*e-1,m.weight0.value=0):b?e<.25?(m.weight0.value=1-4*e,m.weight1.value=0):e>.75?(m.weight1.value=4*e-3,m.weight0.value=0):(m.weight1.value=0,m.weight0.value=0):(m.weight0.value=1-e,m.weight1.value=e)},onOneMoveComplete:e=>M_(this,void 0,void 0,(function*(){w.modelMesh&&w.panoramaGroup&&w.panoramaGroup!==M.panoramaGroup&&(d||this.setModelAppearance(w.panoramaGroup.modelElement,!1,v,w.modelMesh),w.panoramaGroup.addGroupViewConfiguration({targetView:this.view,showBoundBox:!1})),M.panoramaGroup.remove(E),M.pano&&(this.curPanorama=M.pano,this.panoramaMount(this.curPanorama),this.updateCurPanoramTextureInfo(),this.updateLevel()),this.emit(Ud.MOVE_TO_PANORAMA,y,M.pano?M.pano.position:null,w.panoramaGroup!==M.panoramaGroup),this.panoramaGroupChanged=!1,e<t.length-1&&(x=t[e])})),afterAllMoves:()=>M_(this,void 0,void 0,(function*(){M.panoramaGroup.presentPanoramaIndicatorsAround(y,this.view),x!==y&&M&&w&&(M.modelMesh&&M.panoramaGroup&&(d||this.setModelAppearance(M.panoramaGroup.modelElement,!1,v,M.modelMesh),M.panoramaGroup.addGroupViewConfiguration({targetView:this.view,showBoundBox:!1})),M.panoramaGroup&&(this.curPanoramaGroup=M.panoramaGroup)),t.length>1&&this.emit(Ud.PATH_MOVEMENT_COMPLETED,t)}))})}))}moveCameraInPath(t,e){return M_(this,void 0,void 0,(function*(){if(!t||0===t.length)return;const{THREE:n}=Nd.getInstance(),{queueIfBusy:r=!1}=e||{};if(!r){if(this.isAnimating)return;this.isAnimating=!0}for(;this.translatePromise;)yield this.translatePromise;const i=new Promise(i=>M_(this,void 0,void 0,(function*(){const{beforeAllMoves:o,onOneMoveStart:s,onOneMoveUpdate:a,onOneMoveComplete:u,afterAllMoves:c}=e||{};let l=0;const h=()=>new Promise((r,i)=>M_(this,void 0,void 0,(function*(){if(!this.view.camera||this.cancelAnimation)return i(),void(this.cancelAnimation=!1);const{toDirections:o,lookAtTargets:c,intervals:h,fovs:p,easings:f,progressTransforms:d,freeRotation:g,rotateDelays:m}=e||{},y=this.basicController.getCameraTarget(),x=t[l],b=x.clone().sub(y);let _=x.clone();Array.isArray(c)?c.length>l?_=c[l].clone():c.length>0&&(_=c[c.length-1].clone()):c instanceof n.Vector3&&(_=c.clone());let w=0;m&&(Array.isArray(m)?m.length>l?w=m[l]:m.length>0&&(w=m[m.length-1]):w=m||0),c||!o?_.distanceToSquared(x)<1e-6?_=this.basicController.getCameraTarget().sub(this.view.camera.position):_.sub(x):Array.isArray(o)?o.length>l?_=o[l]:o.length>0&&(_=o[o.length-1]):o instanceof n.Vector3&&(_=o),_.normalize();const M=this.basicController.getCameraTarget().sub(this.view.camera.position).normalize(),E=(new n.Quaternion).setFromUnitVectors(this.view.camera.up,new n.Vector3(0,1,0)),S=E.clone().invert();M.applyQuaternion(E),_.applyQuaternion(E);const A=(new n.Spherical).setFromVector3(M),C=(new n.Spherical).setFromVector3(_),T=A.theta-C.theta;M.applyQuaternion(S),_.applyQuaternion(S);let P=60,I=60;if(this.view.camera instanceof n.PerspectiveCamera){const t=this.view.camera;I=t.fov,P=t.fov,Array.isArray(p)?p.length>l?P=p[l]:p.length>0&&(P=p[p.length-1]):p&&(P=p)}let L=1e3;Array.isArray(h)?h.length>l?L=h[l]:h.length>0&&(L=h[h.length-1]):h&&(L=h);let R,O=v.a.Easing.Linear.None;Array.isArray(f)?f.length>l?O=f[l]:f.length>0&&(O=f[f.length-1]):"function"==typeof f?O=f:0===l?(O=v.a.Easing.Quadratic.Out,l===t.length-1&&(O=v.a.Easing.Quadratic.InOut)):l===t.length-1&&(O=v.a.Easing.Quadratic.In),Array.isArray(d)?d.length>l?R=d[l]:d.length>0&&(R=d[d.length-1]):d&&(R=d);const D=x,B=_.clone().multiplyScalar(E_.DirectionVectorScalar).add(D),F=y,N=M.clone().multiplyScalar(E_.DirectionVectorScalar).add(F);let k=!1;if(s){const t={loadedError:!1};if(k=yield s(l,F,N,D,B,t),t.loadedError)return this.cancelAnimation=!0,void r()}const G=A.theta,U=Math.abs(T)>Math.PI?C.theta+Math.sign(T)*Math.PI*2:C.theta,z=A.phi,H=C.phi;new v.a.Tween({timer:0}).to({timer:L},L).easing(O).onStart(()=>{let t=k?B:N;const e=k?D:F;if(g){this.basicController.update();const n=this.basicController.getCameraTarget(),r=this.basicController.getCameraPosition();t=n.sub(r).normalize().multiplyScalar(E_.DirectionVectorScalar).add(e)}this.setCameraPose(t,e),this.renderThisFrame()}).onUpdate(({timer:t})=>{const e=t/L;let r=(t-w)/(L-w);r=O(Math.max(Math.min(r,1),0));const i=G+(U-G)*r,o=z+(H-z)*r,s=R?R(e):e;if(!k){const t=new n.Spherical(1,o,Math.abs(i)>Math.PI?i-Math.sign(i)*Math.PI*2:i);t.makeSafe();const e=(new n.Vector3).setFromSpherical(t).applyQuaternion(S),r=y.clone().addScaledVector(b,s);this.basicController.update();const a=this.basicController.getCameraTarget(),u=this.basicController.getCameraPosition(),c=a.sub(u).normalize(),l=M.clone().normalize(),h=c.distanceToSquared(l),p=(g&&h>1e-4?c:e).multiplyScalar(E_.DirectionVectorScalar).add(r);this.setCameraPose(p,r)}const u=I+s*(P-I);this.setFOV(u),a&&a(l,e,s),this.renderThisFrame()}).onComplete(()=>M_(this,void 0,void 0,(function*(){if(!k){const t=x;this.basicController.update();const e=this.basicController.getCameraTarget(),n=this.basicController.getCameraPosition(),r=e.sub(n).normalize(),i=(g?r:_).clone().multiplyScalar(E_.DirectionVectorScalar).add(t);this.setCameraPose(i,t)}this.renderThisFrame(),u&&(yield u(l)),r()}))).start()})));for(o&&(yield o());l<t.length&&!this.cancelAnimation;){const t=h();yield t,l+=1}this.cancelAnimation||c&&(yield c()),this.cancelAnimation=!1,this.translatePromise=void 0,r||(this.isAnimating=!1),i()})));this.translatePromise=i,yield i}))}setFOV(t){this.basicController&&(this.basicController.setFov(t),this.renderFrame=!0)}setFOVRange(t,e){this.basicController&&(this.basicController.setFovRange(t,e),this.renderFrame=!0)}setCameraPose(t,e,n=!0){this.basicController.setCameraPosition(t,!1),n&&this.basicController.setCameraLookAt(e),this.renderThisFrame()}renderThisFrame(){this.renderFrame||(this.renderFrame=!0)}deletePlane(t){this.planeMap.delete(t)}updatePanoramaTextureInfos(t,e){const n=new Map;for(let e=0;e<t.length;e++){const r=t[e].pfid;n.has(r)||n.set(r,new Map)}for(let t=0;t<e.length;t++){const r=e[t].pfid;n.has(r)||n.set(r,new Map)}this.updateCurPanoramTextureInfo(n)}updateCurPanoramTextureInfo(t){const{curPanorama:e}=this;if(e){const{textures:n,textureMap:r}=y_.instance,{tilePlanes:i}=e;let o;t?o=t:(o=new Map,i.forEach(t=>{o.set(t.pfid,new Map)})),r.forEach((t,e)=>{const{pfid:n}=t,r=o.get(n);r&&r.set(e,t)}),i.forEach(t=>{const{pfid:e}=t,r=o.get(e);r&&t.updateTextures(n,r)})}}deleteTextureInfos(t){t.tilePlanes.forEach(t=>{const{textureMap:e}=t;e.forEach(t=>{y_.instance.deleteTexture(t)})})}disposeTextureInfos(t){t&&t.tilePlanes.forEach(t=>{const e=t.textureMap;y_.instance.deteteTextureMap(e,!0)})}updateTexture(){return y_.instance.update()}updatePlaneInCamera(t){if(!this.curPanorama)return;const e=[];this.curPanorama.tilePlanes.forEach(n=>{const r=n.udpateInCamera(t);e.push(...r)});for(let t=0;t<e.length;t++){const n=e[t];n.isInCamera?y_.instance.addTexture(n):y_.instance.deleteTexture(n)}}panoramaeUpdate(t){return this.handlePanoramaUpdate(t)}update(){let t=!1;return(this.updateTexture()||this.planeNeedUpdate||this.renderFrame)&&(t=!0,this.renderFrame=!1),this.planeNeedUpdate&&(this.view&&this.panoramaeUpdate(this.view),this.planeNeedUpdate=!1),t}panoramaMount(t){t.mount(),this.emit(Ud.DID_LOAD_PANORAMA,t.pid)}panoramaUnmount(t){t.unMount(),y_.instance.deleteTexturesByPid(t.pid,!0)}dispose(){this.planeMap.clear(),this.setEnabled(!1),y_.instance.off(v_.TEXTURE_UPDATE,this.eventListeners.onTextureUpdate),this.curPanorama&&this.panoramaUnmount(this.curPanorama),this.modelMaterial&&this.modelMaterial.dispose(),this.instantTranslationMaterial&&this.instantTranslationMaterial.dispose(),Eb.disposeAll(),Ab.disposeAll(),super.dispose()}}E_.DirectionVectorScalar=-1e-4;n("wZ/5"),n("rOQg"),n("tCCV"),n("XMab"),n("moxL"),n("qXVe"),n("c162"),n("waxf"),n("0TkE"),n("Onu3"),n("1dYe"),n("gvgV"),n("6R/c"),n("YL0P"),n("X5Zq"),n("MoCz"),n("P8wP"),n("ypFw"),n("JaFt"),n("zSZm"),n("PF2M"),n("KVSy"),n("ZJ55"),n("IZzc"),n("Fwt+"),n("s5qe"),n("cvf0");function S_(t){return(S_="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})(t)}var A_=function(){var t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),e=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if("object"!==("undefined"==typeof WebAssembly?"undefined":S_(WebAssembly)))return{supported:!1};var n,r="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB";WebAssembly.validate(t)&&(r="B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",console.log("Warning: meshopt_decoder is using experimental SIMD support"));var i=WebAssembly.instantiate(function(t){for(var n=new Uint8Array(t.length),r=0;r<t.length;++r){var i=t.charCodeAt(r);n[r]=i>96?i-71:i>64?i-65:i>47?i+4:i>46?63:62}var o=0;for(r=0;r<t.length;++r)n[o++]=n[r]<60?e[n[r]]:64*(n[r]-60)+n[++r];return n.buffer.slice(0,o)}(r),{}).then((function(t){(n=t.instance).exports.__wasm_call_ctors()}));function o(t,e,r,i,o,s){var a=n.exports.sbrk,u=r+3&-4,c=a(u*i),l=a(o.length),h=new Uint8Array(n.exports.memory.buffer);h.set(o,l);var p=t(c,r,i,l,o.length);if(0==p&&s&&s(c,u,i),e.set(h.subarray(c,c+r*i)),a(c-a(0)),0!=p)throw new Error("Malformed buffer data: ".concat(p))}var s={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},a={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:i,supported:!0,decodeVertexBuffer:function(t,e,r,i,a){o(n.exports.meshopt_decodeVertexBuffer,t,e,r,i,n.exports[s[a]])},decodeIndexBuffer:function(t,e,r,i){o(n.exports.meshopt_decodeIndexBuffer,t,e,r,i)},decodeIndexSequence:function(t,e,r,i){o(n.exports.meshopt_decodeIndexSequence,t,e,r,i)},decodeGltfBuffer:function(t,e,r,i,u,c){o(n.exports[a[u]],t,e,r,i,n.exports[s[c]])}}}();n("SuFq");function C_(t){return(C_="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})(t)}function T_(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,P_(r.key),r)}}function P_(t){var e=function(t,e){if("object"!=C_(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=C_(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==C_(e)?e:e+""}var I_=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.events=new Map},(e=[{key:"on",value:function(t,e){if("function"==typeof e){var n=this.events.get(t)||new Set;n.add(e),this.events.set(t,n)}}},{key:"off",value:function(t,e){var n=this.events.get(t);null==n||n.delete(e)}},{key:"emit",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];var i=this.events.get(t);i&&i.forEach((function(t){"function"==typeof t&&t.apply(void 0,n)}))}},{key:"offAll",value:function(){this.events.clear()}}])&&T_(t.prototype,e),n&&T_(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function L_(t){return(L_="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})(t)}function R_(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */R_=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof m?e:m,s=Object.create(o.prototype),a=new P(r||[]);return i(s,"_invoke",{value:S(t,n,a)}),s}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",f="executing",d="completed",g={};function m(){}function v(){}function y(){}var x={};c(x,s,(function(){return this}));var b=Object.getPrototypeOf,_=b&&b(b(I([])));_&&_!==n&&r.call(_,s)&&(x=_);var w=y.prototype=m.prototype=Object.create(x);function M(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,o,s,a){var u=h(t[i],t,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==L_(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(l).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(u.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function S(e,n,r){var i=p;return function(o,s){if(i===f)throw Error("Generator is already running");if(i===d){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var u=A(a,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===p)throw i=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=f;var c=h(e,n,r);if("normal"===c.type){if(i=r.done?d:"suspendedYield",c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=d,r.method="throw",r.arg=c.arg)}}}function A(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,A(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=h(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function I(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(L_(e)+" is not iterable")}return v.prototype=y,i(w,"constructor",{value:y,configurable:!0}),i(y,"constructor",{value:v,configurable:!0}),v.displayName=c(y,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,c(t,u,"GeneratorFunction")),t.prototype=Object.create(w),t},e.awrap=function(t){return{__await:t}},M(E.prototype),c(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new E(l(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},M(w),c(w,u,"Generator"),c(w,s,(function(){return this})),c(w,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=I,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var u=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;T(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:I(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function O_(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function D_(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){O_(o,r,i,s,a,"next",t)}function a(t){O_(o,r,i,s,a,"throw",t)}s(void 0)}))}}function B_(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function F_(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,k_(r.key),r)}}function N_(t,e,n){return e&&F_(t.prototype,e),n&&F_(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function k_(t){var e=function(t,e){if("object"!=L_(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=L_(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==L_(e)?e:e+""}function G_(t,e,n){return e=U_(e),function(t,e){if(e&&("object"==L_(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}()?Reflect.construct(e,n||[],U_(t).constructor):e.apply(t,n))}function U_(t){return(U_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function z_(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&H_(t,e)}function H_(t,e){return(H_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var V_=function(t){function e(){var t;return B_(this,e),(t=G_(this,e)).url=m.healthCheck.url||"https://robot-vr.aibee.cn/v1/health",t.thresholdValue=m.healthCheck.thresholdValue||300,t.timer=void 0,t}return z_(e,t),N_(e,[{key:"healthCheck",value:(r=D_(R_().mark((function t(){var e,n;return R_().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,e=this.url,n=this.thresholdValue,t.next=4,Zb()(e,{timeout:n});case 4:this.status=!0,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),this.status=!1;case 10:case"end":return t.stop()}}),t,this,[[0,7]])}))),function(){return r.apply(this,arguments)})},{key:"start",value:(n=D_(R_().mark((function t(){var e=this;return R_().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.healthCheck();case 2:return t.next=4,new Promise((function(t){return e.timer=setTimeout(t,m.healthCheck.frequency)}));case 4:return t.abrupt("return",this.start());case 5:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"stop",value:function(){this.timer&&(clearTimeout(this.timer),this.timer=void 0)}}]);var n,r}(function(t){function e(){var t;return B_(this,e),(t=G_(this,e))._status=!1,t.eventName="change-net-status",t}return z_(e,t),N_(e,[{key:"status",get:function(){return this._status},set:function(t){var e=!!t;e!==this._status&&this.emit(this.eventName,e),this._status=e}}])}(I_));function j_(t){return(j_="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})(t)}function W_(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,J_(r.key),r)}}function q_(t,e,n){return e=X_(e),function(t,e){if(e&&("object"==j_(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}()?Reflect.construct(e,n||[],X_(t).constructor):e.apply(t,n))}function X_(t){return(X_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Y_(t,e){return(Y_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function J_(t){var e=function(t,e){if("object"!=j_(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=j_(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==j_(e)?e:e+""}var K_,Q_=function(t){function e(){var t,n,r,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),t=q_(this,e),n=t,i=null,(r=J_(r="owllyVr"))in n?Object.defineProperty(n,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[r]=i,t.name=Object.getPrototypeOf(t).constructor.name,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Y_(t,e)}(e,t),n=e,(r=[{key:"registry",value:function(t){this.owllyVr=t}},{key:"dispose",value:function(){this.owllyVr=null}}])&&W_(n.prototype,r),i&&W_(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(I_);n("5DmW"),n("XUE8"),n("rB9j"),n("JfAA"),n("ENF9");class Z_ extends r.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const{THREE:t}=Nd.getInstance(),e=new t.MeshBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,side:t.DoubleSide,fog:!1,toneMapped:!1}),n=new t.LineBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,linewidth:1,fog:!1,toneMapped:!1}),r=e.clone();r.opacity=.15;const i=e.clone();i.opacity=.33;const o=e.clone();o.color.set(16711680);const s=e.clone();s.color.set(65280);const a=e.clone();a.color.set(255);const u=e.clone();u.opacity=.25;const c=u.clone();c.color.set(16776960);const l=u.clone();l.color.set(65535);const h=u.clone();h.color.set(16711935);e.clone().color.set(16776960);const p=n.clone();p.color.set(16711680);const f=n.clone();f.color.set(65280);const d=n.clone();d.color.set(255);const g=n.clone();g.color.set(65535);const m=n.clone();m.color.set(16711935);const v=n.clone();v.color.set(16776960);const y=n.clone();y.color.set(7895160);const x=v.clone();x.opacity=.25;const b=new t.CylinderGeometry(0,.05,.2,12,1,!1),_=new t.BoxGeometry(.125,.125,.125),w=new t.BufferGeometry;w.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,0,0],3));const M=function(e,n){const r=new t.BufferGeometry,i=[];for(let t=0;t<=64*n;++t)i.push(0,Math.cos(t/32*Math.PI)*e,Math.sin(t/32*Math.PI)*e);return r.setAttribute("position",new t.Float32BufferAttribute(i,3)),r},E={X:[[new t.Mesh(b,o),[1,0,0],[0,0,-Math.PI/2],null,"fwd"],[new t.Mesh(b,o),[1,0,0],[0,0,Math.PI/2],null,"bwd"],[new t.Line(w,p)]],Y:[[new t.Mesh(b,s),[0,1,0],null,null,"fwd"],[new t.Mesh(b,s),[0,1,0],[Math.PI,0,0],null,"bwd"],[new t.Line(w,f),null,[0,0,Math.PI/2]]],Z:[[new t.Mesh(b,a),[0,0,1],[Math.PI/2,0,0],null,"fwd"],[new t.Mesh(b,a),[0,0,1],[-Math.PI/2,0,0],null,"bwd"],[new t.Line(w,d),null,[0,-Math.PI/2,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.1,0),u.clone()),[0,0,0],[0,0,0]]],XY:[[new t.Mesh(new t.PlaneGeometry(.295,.295),c.clone()),[.15,.15,0]],[new t.Line(w,v),[.18,.3,0],null,[.125,1,1]],[new t.Line(w,v),[.3,.18,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new t.Mesh(new t.PlaneGeometry(.295,.295),l.clone()),[0,.15,.15],[0,Math.PI/2,0]],[new t.Line(w,g),[0,.18,.3],[0,0,Math.PI/2],[.125,1,1]],[new t.Line(w,g),[0,.3,.18],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new t.Mesh(new t.PlaneGeometry(.295,.295),h.clone()),[.15,0,.15],[-Math.PI/2,0,0]],[new t.Line(w,m),[.18,0,.3],null,[.125,1,1]],[new t.Line(w,m),[.3,0,.18],[0,-Math.PI/2,0],[.125,1,1]]]},S={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,1,4,1,!1),r),[.6,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,1,4,1,!1),r),[0,.6,0]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,1,4,1,!1),r),[0,0,.6],[Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.2,0),r)]],XY:[[new t.Mesh(new t.PlaneGeometry(.4,.4),r),[.2,.2,0]]],YZ:[[new t.Mesh(new t.PlaneGeometry(.4,.4),r),[0,.2,.2],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.PlaneGeometry(.4,.4),r),[.2,0,.2],[-Math.PI/2,0,0]]]},A={START:[[new t.Mesh(new t.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],END:[[new t.Mesh(new t.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],DELTA:[[new t.Line(function(){const e=new t.BufferGeometry;return e.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,1,1],3)),e}(),i),null,null,null,"helper"]],X:[[new t.Line(w,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(w,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(w,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},C={X:[[new t.Line(M(1,.5),p)],[new t.Mesh(new t.OctahedronGeometry(.04,0),o),[0,0,.99],null,[1,3,1]]],Y:[[new t.Line(M(1,.5),f),null,[0,0,-Math.PI/2]],[new t.Mesh(new t.OctahedronGeometry(.04,0),s),[0,0,.99],null,[3,1,1]]],Z:[[new t.Line(M(1,.5),d),null,[0,Math.PI/2,0]],[new t.Mesh(new t.OctahedronGeometry(.04,0),a),[.99,0,0],null,[1,3,1]]],E:[[new t.Line(M(1.25,1),x),null,[0,Math.PI/2,0]],[new t.Mesh(new t.CylinderGeometry(.03,0,.15,4,1,!1),x),[1.17,0,0],[0,0,-Math.PI/2],[1,1,.001]],[new t.Mesh(new t.CylinderGeometry(.03,0,.15,4,1,!1),x),[-1.17,0,0],[0,0,Math.PI/2],[1,1,.001]],[new t.Mesh(new t.CylinderGeometry(.03,0,.15,4,1,!1),x),[0,-1.17,0],[Math.PI,0,0],[1,1,.001]],[new t.Mesh(new t.CylinderGeometry(.03,0,.15,4,1,!1),x),[0,1.17,0],[0,0,0],[1,1,.001]]],XYZE:[[new t.Line(M(1,1),y),null,[0,Math.PI/2,0]]]},T={AXIS:[[new t.Line(w,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},P={X:[[new t.Mesh(new t.TorusGeometry(1,.1,4,24),r),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new t.Mesh(new t.TorusGeometry(1,.1,4,24),r),[0,0,0],[Math.PI/2,0,0]]],Z:[[new t.Mesh(new t.TorusGeometry(1,.1,4,24),r),[0,0,0],[0,0,-Math.PI/2]]],E:[[new t.Mesh(new t.TorusGeometry(1.25,.1,2,24),r)]],XYZE:[[new t.Mesh(new t.SphereGeometry(.7,10,8),r)]]},I={X:[[new t.Mesh(_,o),[.8,0,0],[0,0,-Math.PI/2]],[new t.Line(w,p),null,null,[.8,1,1]]],Y:[[new t.Mesh(_,s),[0,.8,0]],[new t.Line(w,f),null,[0,0,Math.PI/2],[.8,1,1]]],Z:[[new t.Mesh(_,a),[0,0,.8],[Math.PI/2,0,0]],[new t.Line(w,d),null,[0,-Math.PI/2,0],[.8,1,1]]],XY:[[new t.Mesh(_,c),[.85,.85,0],null,[2,2,.2]],[new t.Line(w,v),[.855,.98,0],null,[.125,1,1]],[new t.Line(w,v),[.98,.855,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new t.Mesh(_,l),[0,.85,.85],null,[.2,2,2]],[new t.Line(w,g),[0,.855,.98],[0,0,Math.PI/2],[.125,1,1]],[new t.Line(w,g),[0,.98,.855],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new t.Mesh(_,h),[.85,0,.85],null,[2,.2,2]],[new t.Line(w,m),[.855,0,.98],null,[.125,1,1]],[new t.Line(w,m),[.98,0,.855],[0,-Math.PI/2,0],[.125,1,1]]],XYZX:[[new t.Mesh(new t.BoxGeometry(.125,.125,.125),u.clone()),[1.1,0,0]]],XYZY:[[new t.Mesh(new t.BoxGeometry(.125,.125,.125),u.clone()),[0,1.1,0]]],XYZZ:[[new t.Mesh(new t.BoxGeometry(.125,.125,.125),u.clone()),[0,0,1.1]]]},L={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,.8,4,1,!1),r),[.5,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,.8,4,1,!1),r),[0,.5,0]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,.8,4,1,!1),r),[0,0,.5],[Math.PI/2,0,0]]],XY:[[new t.Mesh(_,r),[.85,.85,0],null,[3,3,.2]]],YZ:[[new t.Mesh(_,r),[0,.85,.85],null,[.2,3,3]]],XZ:[[new t.Mesh(_,r),[.85,0,.85],null,[3,.2,3]]],XYZX:[[new t.Mesh(new t.BoxGeometry(.2,.2,.2),r),[1.1,0,0]]],XYZY:[[new t.Mesh(new t.BoxGeometry(.2,.2,.2),r),[0,1.1,0]]],XYZZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.2),r),[0,0,1.1]]]},R={X:[[new t.Line(w,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(w,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(w,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},O=function(e){const n=new t.Object3D;for(const t in e)for(let r=e[t].length;r--;){const i=e[t][r][0].clone(),o=e[t][r][1],s=e[t][r][2],a=e[t][r][3],u=e[t][r][4];i.name=t,i.tag=u,o&&i.position.set(o[0],o[1],o[2]),s&&i.rotation.set(s[0],s[1],s[2]),a&&i.scale.set(a[0],a[1],a[2]),i.updateMatrix();const c=i.geometry.clone();c.applyMatrix4(i.matrix),i.geometry=c,i.renderOrder=1/0,i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),n.add(i)}return n},D=new t.Vector3(0,0,0),B=new t.Euler,F=new t.Vector3(0,1,0),N=new t.Vector3(0,0,0),k=new t.Matrix4,G=new t.Quaternion,U=new t.Quaternion,z=new t.Quaternion,H=new t.Vector3(1,0,0),V=new t.Vector3(0,1,0),j=new t.Vector3(0,0,1);this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=O(E)),this.add(this.gizmo.rotate=O(C)),this.add(this.gizmo.scale=O(I)),this.add(this.picker.translate=O(S)),this.add(this.picker.rotate=O(P)),this.add(this.picker.scale=O(L)),this.add(this.helper.translate=O(A)),this.add(this.helper.rotate=O(T)),this.add(this.helper.scale=O(R)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1,this.updateMatrixWorld=function(){let{space:e}=this;"scale"===this.mode&&(e="local");const n="local"===e?this.worldQuaternion:z;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode;let r=[];r=r.concat(this.picker[this.mode].children),r=r.concat(this.gizmo[this.mode].children),r=r.concat(this.helper[this.mode].children);for(let e=0;e<r.length;e++){const i=r[e];let o;if(i.visible=!0,i.rotation.set(0,0,0),i.position.copy(this.worldPosition),this.camera.isOrthographicCamera){const t=this.camera;o=(t.top-t.bottom)/t.zoom}else{const t=this.camera;o=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*t.fov/360)/t.zoom,7)}if(i.scale.set(1,1,1).multiplyScalar(o*this.size/7),"helper"!==i.tag){if(i.quaternion.copy(n),"translate"===this.mode||"scale"===this.mode){const t=.99,e=.2,r=0;"X"!==i.name&&"XYZX"!==i.name||Math.abs(F.copy(H).applyQuaternion(n).dot(this.eye))>t&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),"Y"!==i.name&&"XYZY"!==i.name||Math.abs(F.copy(V).applyQuaternion(n).dot(this.eye))>t&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),"Z"!==i.name&&"XYZZ"!==i.name||Math.abs(F.copy(j).applyQuaternion(n).dot(this.eye))>t&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),"XY"===i.name&&Math.abs(F.copy(j).applyQuaternion(n).dot(this.eye))<e&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),"YZ"===i.name&&Math.abs(F.copy(H).applyQuaternion(n).dot(this.eye))<e&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),"XZ"===i.name&&Math.abs(F.copy(V).applyQuaternion(n).dot(this.eye))<e&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),-1!==i.name.search("X")&&(F.copy(H).applyQuaternion(n).dot(this.eye)<r?"fwd"===i.tag?i.visible=!1:i.scale.x*=-1:"bwd"===i.tag&&(i.visible=!1)),-1!==i.name.search("Y")&&(F.copy(V).applyQuaternion(n).dot(this.eye)<r?"fwd"===i.tag?i.visible=!1:i.scale.y*=-1:"bwd"===i.tag&&(i.visible=!1)),-1!==i.name.search("Z")&&(F.copy(j).applyQuaternion(n).dot(this.eye)<r?"fwd"===i.tag?i.visible=!1:i.scale.z*=-1:"bwd"===i.tag&&(i.visible=!1))}else"rotate"===this.mode&&(U.copy(n),F.copy(this.eye).applyQuaternion(G.copy(n).invert()),-1!==i.name.search("E")&&i.quaternion.setFromRotationMatrix(k.lookAt(this.eye,N,V)),"X"===i.name&&(G.setFromAxisAngle(H,Math.atan2(-F.y,F.z)),G.multiplyQuaternions(U,G),i.quaternion.copy(G)),"Y"===i.name&&(G.setFromAxisAngle(V,Math.atan2(F.x,F.z)),G.multiplyQuaternions(U,G),i.quaternion.copy(G)),"Z"===i.name&&(G.setFromAxisAngle(j,Math.atan2(F.y,F.x)),G.multiplyQuaternions(U,G),i.quaternion.copy(G)));i.visible=i.visible&&(-1===i.name.indexOf("X")||this.showX),i.visible=i.visible&&(-1===i.name.indexOf("Y")||this.showY),i.visible=i.visible&&(-1===i.name.indexOf("Z")||this.showZ),i.visible=i.visible&&(-1===i.name.indexOf("E")||this.showX&&this.showY&&this.showZ),i.material._opacity=i.material._opacity||i.material.opacity,i.material._color=i.material._color||i.material.color.clone(),i.material.color.copy(i.material._color),i.material.opacity=i.material._opacity,this.enabled?this.axis&&(i.name===this.axis||this.axis.split("").some(t=>i.name===t)?(i.material.opacity=1,i.material.color.lerp(new t.Color(1,1,1),.5)):(i.material.opacity*=.25,i.material.color.lerp(new t.Color(1,1,1),.5))):(i.material.opacity*=.5,i.material.color.lerp(new t.Color(1,1,1),.5))}else i.visible=!1,"AXIS"===i.name?(i.position.copy(this.worldPositionStart),i.visible=!!this.axis,"X"===this.axis&&(G.setFromEuler(B.set(0,0,0)),i.quaternion.copy(n).multiply(G),Math.abs(F.copy(H).applyQuaternion(n).dot(this.eye))>.9&&(i.visible=!1)),"Y"===this.axis&&(G.setFromEuler(B.set(0,0,Math.PI/2)),i.quaternion.copy(n).multiply(G),Math.abs(F.copy(V).applyQuaternion(n).dot(this.eye))>.9&&(i.visible=!1)),"Z"===this.axis&&(G.setFromEuler(B.set(0,Math.PI/2,0)),i.quaternion.copy(n).multiply(G),Math.abs(F.copy(j).applyQuaternion(n).dot(this.eye))>.9&&(i.visible=!1)),"XYZE"===this.axis&&(G.setFromEuler(B.set(0,Math.PI/2,0)),F.copy(this.rotationAxis),i.quaternion.setFromRotationMatrix(k.lookAt(N,F,V)),i.quaternion.multiply(G),i.visible=this.dragging),"E"===this.axis&&(i.visible=!1)):"START"===i.name?(i.position.copy(this.worldPositionStart),i.visible=this.dragging):"END"===i.name?(i.position.copy(this.worldPosition),i.visible=this.dragging):"DELTA"===i.name?(i.position.copy(this.worldPositionStart),i.quaternion.copy(this.worldQuaternionStart),D.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),D.applyQuaternion(this.worldQuaternionStart.clone().invert()),i.scale.copy(D),i.visible=this.dragging):(i.quaternion.copy(n),this.dragging?i.position.copy(this.worldPositionStart):i.position.copy(this.worldPosition),this.axis&&(i.visible=-1!==this.axis.search(i.name)))}t.Object3D.prototype.updateMatrixWorld.call(this)}}}class $_ extends r.Mesh{constructor(){super(new(Nd.getInstance().THREE.PlaneGeometry)(1e5,1e5,2,2),new(Nd.getInstance().THREE.MeshBasicMaterial)({visible:!1,wireframe:!0,side:Nd.getInstance().THREE.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0;const{THREE:t}=Nd.getInstance(),e=new t.Vector3(1,0,0),n=new t.Vector3(0,1,0),r=new t.Vector3(0,0,1),i=new t.Vector3,o=new t.Vector3,s=new t.Vector3,a=new t.Matrix4,u=new t.Quaternion;this.updateMatrixWorld=function(){let{space:c}=this;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(c="local"),e.set(1,0,0).applyQuaternion("local"===c?this.worldQuaternion:u),n.set(0,1,0).applyQuaternion("local"===c?this.worldQuaternion:u),r.set(0,0,1).applyQuaternion("local"===c?this.worldQuaternion:u),s.copy(n),this.mode){case"translate":case"scale":switch(this.axis){case"X":s.copy(this.eye).cross(e),o.copy(e).cross(s);break;case"Y":s.copy(this.eye).cross(n),o.copy(n).cross(s);break;case"Z":s.copy(this.eye).cross(r),o.copy(r).cross(s);break;case"XY":o.copy(r);break;case"YZ":o.copy(e);break;case"XZ":s.copy(r),o.copy(n);break;case"XYZ":case"E":o.set(0,0,0)}break;case"rotate":default:o.set(0,0,0)}0===o.length()?this.quaternion.copy(this.cameraQuaternion):(a.lookAt(i.set(0,0,0),o,s),this.quaternion.setFromRotationMatrix(a)),t.Object3D.prototype.updateMatrixWorld.call(this)}}}class tw extends r.Object3D{constructor(t,e){super(),void 0===e&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),e=document),this.visible=!1,this.domElement=e;const n=new Z_;this.add(n);const r=new $_;this.add(r);const i=this,o={type:"change"},s={type:"mouseDown"},a={type:"mouseUp",mode:i.mode},u={type:"objectChange"};function c(t,e){let s=e;Object.defineProperty(i,t,{get:()=>void 0!==s?s:e,set(e){s!==e&&(s=e,r[t]=e,n[t]=e,i.dispatchEvent({type:t+"-changed",value:e}),i.dispatchEvent(o))}}),i[t]=e,r[t]=e,n[t]=e}const{THREE:l}=Nd.getInstance();function h(t,e,n){const r=e.intersectObject(t,!0);for(let t=0;t<r.length;t++)if(r[t].object.visible||n)return r[t];return!1}c("camera",t),c("object",void 0),c("enabled",!0),c("axis",null),c("mode","translate"),c("translationSnap",null),c("rotationSnap",null),c("scaleSnap",null),c("space","world"),c("size",1),c("dragging",!1),c("showX",!0),c("showY",!0),c("showZ",!0);const p=new l.Raycaster,f=new l.Vector3,d=new l.Vector3,g=new l.Quaternion,m={X:new l.Vector3(1,0,0),Y:new l.Vector3(0,1,0),Z:new l.Vector3(0,0,1)},v=new l.Vector3,y=new l.Vector3,x=new l.Vector3,b=new l.Vector3,_=new l.Vector3,w=new l.Vector3;let M=0;const E=new l.Vector3,S=new l.Quaternion,A=new l.Vector3,C=new l.Vector3,T=new l.Quaternion,P=new l.Quaternion,I=new l.Vector3,L=new l.Vector3,R=new l.Quaternion,O=new l.Vector3,D=new l.Vector3,B=new l.Quaternion,F=new l.Quaternion,N=new l.Vector3,k=new l.Vector3,G=new l.Vector3,U=new l.Quaternion,z=new l.Vector3;function H(t){if(i.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:t.button};const n=t.changedTouches?t.changedTouches[0]:t,r=e.getBoundingClientRect();return{x:(n.clientX-r.left)/r.width*2-1,y:-(n.clientY-r.top)/r.height*2+1,button:t.button}}function V(t){if(i.enabled)switch(t.pointerType){case"mouse":case"pen":i.pointerHover(H(t))}}function j(t){i.enabled&&i.pointerMove(H(t))}function W(t){i.enabled&&(i.domElement.style.touchAction="none",i.domElement.ownerDocument.addEventListener("pointermove",j),i.pointerHover(H(t)),i.pointerDown(H(t)))}function q(t){i.enabled&&(i.domElement.style.touchAction="",i.domElement.ownerDocument.removeEventListener("pointermove",j),i.pointerUp(H(t)))}c("worldPosition",D),c("worldPositionStart",L),c("worldQuaternion",B),c("worldQuaternionStart",R),c("cameraPosition",E),c("cameraQuaternion",S),c("pointStart",v),c("pointEnd",y),c("rotationAxis",b),c("rotationAngle",M),c("eye",k),e.addEventListener("pointerdown",W),e.addEventListener("pointermove",V),i.domElement.ownerDocument.addEventListener("pointerup",q),this.dispose=function(){e.removeEventListener("pointerdown",W),e.removeEventListener("pointermove",V),i.domElement.ownerDocument.removeEventListener("pointermove",j),i.domElement.ownerDocument.removeEventListener("pointerup",q),this.traverse(t=>{t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()}),i.domElement=null},this.attach=function(t){return this.object=t,this.visible=!0,this},this.detach=function(){return this.object=void 0,this.visible=!1,this.axis=null,this},this.updateMatrixWorld=function(){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(C,T,I),this.object.matrixWorld.decompose(D,B,N),P.copy(T).invert(),F.copy(B).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(E,S,A),k.copy(E).sub(D).normalize(),l.Object3D.prototype.updateMatrixWorld.call(this)},this.pointerHover=function(t){if(void 0===this.object||!0===this.dragging)return;p.setFromCamera(t,this.camera);const e=h(n.picker[this.mode],p);this.axis=e?e.object.name:null},this.pointerDown=function(t){if(void 0!==this.object&&!0!==this.dragging&&0===t.button&&null!==this.axis){p.setFromCamera(t,this.camera);const e=h(r,p,!0);if(e){let{space:t}=this;if("scale"===this.mode?t="local":"E"!==this.axis&&"XYZE"!==this.axis&&"XYZ"!==this.axis||(t="world"),"local"===t&&"rotate"===this.mode){const t=this.rotationSnap;"X"===this.axis&&t&&(this.object.rotation.x=Math.round(this.object.rotation.x/t)*t),"Y"===this.axis&&t&&(this.object.rotation.y=Math.round(this.object.rotation.y/t)*t),"Z"===this.axis&&t&&(this.object.rotation.z=Math.round(this.object.rotation.z/t)*t)}this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),G.copy(this.object.position),U.copy(this.object.quaternion),z.copy(this.object.scale),this.object.matrixWorld.decompose(L,R,O),v.copy(e.point).sub(L)}this.dragging=!0,s.mode=this.mode,this.dispatchEvent(s)}},this.pointerMove=function(t){const{axis:e}=this,{mode:n}=this,{object:i}=this;let{space:s}=this;if("scale"===n?s="local":"E"!==e&&"XYZE"!==e&&"XYZ"!==e||(s="world"),void 0===i||null===e||!1===this.dragging||-1!==t.button)return;p.setFromCamera(t,this.camera);const a=h(r,p,!0);if(a){if(y.copy(a.point).sub(L),"translate"===n)x.copy(y).sub(v),"local"===s&&"XYZ"!==e&&x.applyQuaternion(F),-1===e.indexOf("X")&&(x.x=0),-1===e.indexOf("Y")&&(x.y=0),-1===e.indexOf("Z")&&(x.z=0),"local"===s&&"XYZ"!==e?x.applyQuaternion(U).divide(I):x.applyQuaternion(P).divide(I),i.position.copy(x).add(G),this.translationSnap&&("local"===s&&(i.position.applyQuaternion(g.copy(U).invert()),-1!==e.search("X")&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),-1!==e.search("Y")&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),-1!==e.search("Z")&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(U)),"world"===s&&(i.parent&&i.position.add(f.setFromMatrixPosition(i.parent.matrixWorld)),-1!==e.search("X")&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),-1!==e.search("Y")&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),-1!==e.search("Z")&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(f.setFromMatrixPosition(i.parent.matrixWorld))));else if("scale"===n){if(-1!==e.search("XYZ")){let t=y.length()/v.length();y.dot(v)<0&&(t*=-1),d.set(t,t,t)}else f.copy(v),d.copy(y),f.applyQuaternion(F),d.applyQuaternion(F),d.divide(f),-1===e.search("X")&&(d.x=1),-1===e.search("Y")&&(d.y=1),-1===e.search("Z")&&(d.z=1);i.scale.copy(z).multiply(d),this.scaleSnap&&(-1!==e.search("X")&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==e.search("Y")&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==e.search("Z")&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if("rotate"===n){x.copy(y).sub(v);const t=20/D.distanceTo(f.setFromMatrixPosition(this.camera.matrixWorld));"E"===e?(b.copy(k),M=y.angleTo(v),_.copy(v).normalize(),w.copy(y).normalize(),M*=w.cross(_).dot(k)<0?1:-1):"XYZE"===e?(b.copy(x).cross(k).normalize(),M=x.dot(f.copy(b).cross(this.eye))*t):"X"!==e&&"Y"!==e&&"Z"!==e||(b.copy(m[e]),f.copy(m[e]),"local"===s&&f.applyQuaternion(B),M=x.dot(f.cross(k).normalize())*t),this.rotationSnap&&(M=Math.round(M/this.rotationSnap)*this.rotationSnap),this.rotationAngle=M,"local"===s&&"E"!==e&&"XYZE"!==e?(i.quaternion.copy(U),i.quaternion.multiply(g.setFromAxisAngle(b,M)).normalize()):(b.applyQuaternion(P),i.quaternion.copy(g.setFromAxisAngle(b,M)),i.quaternion.multiply(U).normalize())}this.dispatchEvent(o),this.dispatchEvent(u)}},this.pointerUp=function(t){0===t.button&&(this.dragging&&null!==this.axis&&(a.mode=this.mode,this.dispatchEvent(a)),this.dragging=!1,this.axis=null)},this.getMode=function(){return i.mode},this.setMode=function(t){i.mode=t},this.setTranslationSnap=function(t){i.translationSnap=t},this.setScaleSnap=function(t){i.scaleSnap=t},this.setRotationSnap=function(t){i.rotationSnap=t},this.setSize=function(t){i.size=t},this.setSpace=function(t){i.space=t},this.update=function(){console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}}}!function(t){t[t.IDLE=0]="IDLE",t[t.DOWN=1]="DOWN",t[t.MOVE=2]="MOVE"}(K_||(K_={}));class ew extends tw{constructor(t,e,n){super(e,n),this.bindingView=t,this.visibilityMap=new Map,this.pointerDownSuper=this.pointerDown,this.pointerHoverSuper=this.pointerHover,this.pointerMoveSuper=this.pointerMove,this.pointerUpSuper=this.pointerUp,this.disposeSuper=this.dispose,this.pointerDown=function(t){const{showX:e,showY:n,showZ:r}=this,{showX:i,showY:o,showZ:s}=this.visibilityMap.get(this.bindingView);this.showX=i,this.showY=o,this.showZ=s,this.object&&this.object.parent&&this.updateMatrixWorld(),this.pointerDownSuper(t),this.showX=e,this.showY=n,this.showZ=r,this.object&&this.object.parent&&this.updateMatrixWorld()},this.pointerHover=function(t){const{showX:e,showY:n,showZ:r}=this,{showX:i,showY:o,showZ:s}=this.visibilityMap.get(this.bindingView);this.showX=i,this.showY=o,this.showZ=s,this.object&&this.object.parent&&this.updateMatrixWorld(),this.pointerHoverSuper(t),this.showX=e,this.showY=n,this.showZ=r,this.object&&this.object.parent&&this.updateMatrixWorld()},this.pointerMove=function(t){const{showX:e,showY:n,showZ:r}=this,{showX:i,showY:o,showZ:s}=this.visibilityMap.get(this.bindingView);this.showX=i,this.showY=o,this.showZ=s,this.object&&this.object.parent&&this.updateMatrixWorld(),this.pointerMoveSuper(t),this.showX=e,this.showY=n,this.showZ=r,this.object&&this.object.parent&&this.updateMatrixWorld()},this.pointerUp=function(t){const{showX:e,showY:n,showZ:r}=this,{showX:i,showY:o,showZ:s}=this.visibilityMap.get(this.bindingView);this.showX=i,this.showY=o,this.showZ=s,this.object&&this.object.parent&&this.updateMatrixWorld(),this.pointerUpSuper(t),this.showX=e,this.showY=n,this.showZ=r,this.object&&this.object.parent&&this.updateMatrixWorld()},this.dispose=function(){this.visibilityMap.clear(),this.disposeSuper()}}updateViewVisibilitySettings(t,e){e?this.visibilityMap.set(e,t):this.visibilityMap.forEach((e,n)=>{this.visibilityMap.set(n,t)})}getViewVisibilitySettings(t){return this.visibilityMap.get(t)}removeViewVisibilitySettings(t){this.visibilityMap.delete(t)}}class nw extends Xb{constructor(t){super();const{THREE:e}=Nd.getInstance();this.mouseState=K_.IDLE,this.mouseEventHandlers={onPointerDown:t=>{this.onPointerDown(t)},onPointerMove:t=>{this.onPointerMove(t)},onPointerUp:t=>{this.onPointerUp(t)}},this.touchEventHandlers={onTouchStart:t=>{this.onTouchStart(t)},onTouchMove:t=>{this.onTouchMove(t)},onTouchEnd:()=>{this.onTouchEnd()}},this.selectableElements=new Set,this.selectableElementsOnScreen=new Set,this.elementResponseDistance2D=30,this.elementWorldDetectionDistance=-1,this.onScreenElementWorldDetectionDistance=13,this.mousePositionBuffer=new e.Vector2,this.detectOnMove=!1,this.bindView(t)}registerPointerEvents(t){t.addEventListener("pointerdown",this.mouseEventHandlers.onPointerDown),t.addEventListener("pointermove",this.mouseEventHandlers.onPointerMove),t.addEventListener("pointerup",this.mouseEventHandlers.onPointerUp),t.addEventListener("touchstart",this.touchEventHandlers.onTouchStart),t.addEventListener("touchmove",this.touchEventHandlers.onTouchMove),t.addEventListener("touchend",this.touchEventHandlers.onTouchEnd)}unregisterPointerEvents(t){t.removeEventListener("pointerdown",this.mouseEventHandlers.onPointerDown),t.removeEventListener("pointermove",this.mouseEventHandlers.onPointerMove),t.removeEventListener("pointerup",this.mouseEventHandlers.onPointerUp),t.removeEventListener("touchstart",this.touchEventHandlers.onTouchStart),t.removeEventListener("touchmove",this.touchEventHandlers.onTouchMove),t.removeEventListener("touchend",this.touchEventHandlers.onTouchEnd)}snapActiveElement(t,e,n,r){if("snap"!==this.controlMode||!this.activeElement||!this.snapToObject)return!1;const{THREE:i}=Nd.getInstance(),o=new i.Raycaster;o.setFromCamera({x:2*t/n-1,y:1-2*e/r},this.view.camera);const s=o.intersectObject(this.snapToObject,!0);return s&&s.length>0&&(s.sort((t,e)=>t.distance-e.distance),this.activeElement.position.copy(s[0].point),this.emit(Ud.ELEMENT_POSITION_UPDATED,this.activeElement.position.clone(),this.activeElement,this.view)),!0}onPointerDown(t){if("mouse"!==t.pointerType)return;this.mouseState=K_.DOWN,this.button=t.button;const{clientX:e,clientY:n}=t,{clientWidth:r,clientHeight:i}=this.view.container,{left:o,top:s}=this.view.container.getBoundingClientRect(),a=e-o,u=n-s,{THREE:c}=Nd.getInstance();if(this.mousePositionBuffer.set(a,u),"collision"===this.controlMode){const t=new c.Raycaster;if(t.setFromCamera({x:2*a/r-1,y:1-2*u/i},this.view.camera),this.snapToObject instanceof Yx){const e=this.snapToObject.intersectRay(t.ray.origin,t.ray.direction,!0);if(e&&e.length){const n=e[0],r={distance:n.intersectionPoint.distanceTo(t.ray.origin),point:n.intersectionPoint,object:this.snapToObject};this.selectedElement=this.snapToObject,this.selectedElementIntersection=r}}else{const e=t.intersectObject(this.snapToObject,!0);e&&e.length>0&&(e.sort((t,e)=>t.distance-e.distance),this.selectedElement=this.snapToObject,[this.selectedElementIntersection]=e)}}if(this.snapActiveElement(a,u,r,i))return;let l=Array.from(this.selectableElementsOnScreen);const h=new Map;l.forEach(t=>{if(t instanceof cb&&t.isDomElement){const e=t.getSize();h.set(t,[e[0],e[1]])}});const p=ky.getMouseIntersectionOnScreen(l,{x:a,y:u},{screenWidth:r,screenHeight:i},2*this.elementResponseDistance2D,this.view.camera,l,this.onScreenElementWorldDetectionDistance,h);if(p&&p instanceof eg)return this.mouseState=K_.DOWN,this.selectedElement=p,void(this.selectedElementIntersection=ky.getMouseIntersection([p],{x:2*a/r-1,y:1-2*u/i},this.view.camera,l,this.elementWorldDetectionDistance));l=Array.from(this.selectableElements);const f=ky.getMouseIntersection(l,{x:2*a/r-1,y:1-2*u/i},this.view.camera,l,this.elementWorldDetectionDistance);f&&f.object instanceof eg&&(this.mouseState=K_.DOWN,this.selectedElement=f.object,this.selectedElementIntersection=f)}onPointerMove(t){if("mouse"!==t.pointerType)return;if(this.mouseState!==K_.DOWN&&this.mouseState!==K_.MOVE&&!this.detectOnMove)return;const{clientX:e,clientY:n}=t,{clientWidth:r,clientHeight:i}=this.view.container,{left:o,top:s}=this.view.container.getBoundingClientRect(),a=e-o,u=n-s,{THREE:c}=Nd.getInstance(),l=new c.Vector2(a,u).distanceToSquared(this.mousePositionBuffer);if(this.mouseState===K_.DOWN&&l>100&&(this.mouseState=K_.MOVE),this.snapActiveElement(a,u,r,i),"collision"===this.controlMode&&(this.mouseState===K_.MOVE||this.detectOnMove)){const t=new c.Raycaster;if(t.setFromCamera({x:2*a/r-1,y:1-2*u/i},this.view.camera),this.snapToObject instanceof Yx){const e=this.snapToObject.intersectRay(t.ray.origin,t.ray.direction,!0);if(e&&e.length){const n=e[0],r={distance:n.intersectionPoint.distanceTo(t.ray.origin),point:n.intersectionPoint,object:this.snapToObject};this.emit(Ud.ELEMENT_SELECTED,this.snapToObject,r)}}else{const e=t.intersectObject(this.snapToObject,!0);e&&e.length>0&&(e.sort((t,e)=>t.distance-e.distance),this.emit(Ud.ELEMENT_SELECTED,this.snapToObject,e[0]))}}}onPointerUp(t){"mouse"!==t.pointerType||this.transformActivated||(this.mouseState===K_.DOWN&&this.emit(Ud.ELEMENT_SELECTED,this.selectedElement,this.selectedElementIntersection,this.button),this.mouseState=K_.IDLE,this.selectedElement=null,this.selectedElementIntersection=null)}onTouchStart(t){this.mouseState=K_.DOWN;const{clientX:e,clientY:n}=t.touches[0],{clientWidth:r,clientHeight:i}=this.view.container,{left:o,top:s}=this.view.container.getBoundingClientRect(),a=e-o,u=n-s;if(this.mousePositionBuffer.set(a,u),this.snapActiveElement(a,u,r,i))return;let c=Array.from(this.selectableElementsOnScreen);const l=new Map;c.forEach(t=>{if(t instanceof cb&&t.isDomElement){const e=t.getSize();l.set(t,[e[0],e[1]])}});const h=ky.getMouseIntersectionOnScreen(c,{x:a,y:u},{screenWidth:r,screenHeight:i},2*this.elementResponseDistance2D,this.view.camera,c,this.onScreenElementWorldDetectionDistance,l);if(h&&h instanceof eg)return this.mouseState=K_.DOWN,this.selectedElement=h,void(this.selectedElementIntersection=ky.getMouseIntersection([h],{x:2*a/r-1,y:1-2*u/i},this.view.camera,c,this.elementWorldDetectionDistance));c=Array.from(this.selectableElements);const p=ky.getMouseIntersection(c,{x:2*a/r-1,y:1-2*u/i},this.view.camera,c,this.elementWorldDetectionDistance);p&&p.object instanceof eg&&(this.mouseState=K_.DOWN,this.selectedElement=p.object,this.selectedElementIntersection=p)}onTouchMove(t){if(this.mouseState!==K_.DOWN)return;const{clientX:e,clientY:n}=t.touches[0],{clientWidth:r,clientHeight:i}=this.view.container,{left:o,top:s}=this.view.container.getBoundingClientRect(),a=e-o,u=n-s,{THREE:c}=Nd.getInstance();new c.Vector2(a,u).distanceToSquared(this.mousePositionBuffer)>100&&(this.mouseState=K_.MOVE),this.snapActiveElement(a,u,r,i)}onTouchEnd(){this.mouseState===K_.DOWN&&this.emit(Ud.ELEMENT_SELECTED,this.selectedElement,this.selectedElementIntersection),this.mouseState=K_.IDLE,this.selectedElement=null,this.selectedElementIntersection=null}unbind(){super.unbind(),this.scene.remove(this.transformControl),this.transformControl.dispose(),this.unregisterPointerEvents(this.view.container)}update(){const t=!!this.renderFrame;return this.renderFrame=!1,t}bindView(t){if(!t.camera||!t.renderer)throw new Error("No Camera or Renderer found in view");this.view=t,this.transformControl=new ew(t,t.camera,t.container),this.transformControl.addEventListener("objectChange",()=>{this.emit(zd.ELEMENT_POSITION_UPDATED,this.activeElement.position.clone(),this.activeElement,this.view)}),this.transformControl.addEventListener("change",()=>{this.renderFrame=!0}),this.transformControl.addEventListener("mouseUp",()=>{const t=this.controlMode;"translate"===t?this.emit(Ud.ELEMENT_POSITION_UPDATED,this.activeElement.position.clone(),this.activeElement):"rotate"===t&&this.emit(Ud.ELEMENT_POSE_UPDATED,this.activeElement.quaternion.clone(),this.activeElement),this.transformActivated=!1,this.emit(Ud.TRANSFORM_DEACTIVATED)}),this.transformControl.addEventListener("mouseDown",()=>{this.transformActivated=!0,this.emit(Ud.TRANSFORM_ACTIVATED)}),this.registerPointerEvents(t.container),this.controlMode=this.transformControl.getMode(),this.transformControl.updateViewVisibilitySettings({showX:!0,showY:!0,showZ:!0},t)}renderingViewChanged(t){const e=this.transformControl.getViewVisibilitySettings(t)||this.transformControl.getViewVisibilitySettings(this.view);if(!e)return;const{showX:n,showY:r,showZ:i}=e;this.transformControl.showX=n,this.transformControl.showY=r,this.transformControl.showZ=i}initWithScene(t){this.scene=t,this.scene.add(this.transformControl)}attach(t){this.activeElement&&this.transformControl.detach(),this.activeElement=t,this.transformControl.attach(this.activeElement)}detach(){this.setMode("translate"),this.mouseState=K_.IDLE,this.transformControl.detach()}getMode(){return this.controlMode}setMode(t,e,n=!1){this.controlMode=t,"snap"===t||"collision"===t?e&&(this.snapToObject=e,this.transformControl.detach()):(this.activeElement&&this.transformControl.attach(this.activeElement),this.transformControl.setMode(t)),this.detectOnMove=n}setSize(t){this.transformControl.setSize(t)}setStickVisibility(t,e,n,r){this.transformControl.updateViewVisibilitySettings({showX:t,showY:e,showZ:n},r)}setTransitionSnap(t){this.transformControl.setTranslationSnap(t)}setRotationSnap(t){this.transformControl.setRotationSnap(t)}setEnabled(t){this.transformControl.enabled=t,t?(this.unregisterPointerEvents(this.view.container),this.registerPointerEvents(this.view.container)):this.unregisterPointerEvents(this.view.container)}bindElement(t,e){!0===e?Array.isArray(t)?t.forEach(t=>{this.selectableElementsOnScreen.add(t)}):this.selectableElementsOnScreen.add(t):Array.isArray(t)?t.forEach(t=>{this.selectableElements.add(t)}):this.selectableElements.add(t)}unbindElement(t){Array.isArray(t)?t.forEach(t=>{t===this.activeElement&&this.detach(),this.selectableElements.delete(t),this.selectableElementsOnScreen.delete(t)}):(t===this.activeElement&&this.detach(),this.selectableElements.delete(t),this.selectableElementsOnScreen.delete(t))}set2DElementDetectionRadius(t){this.elementResponseDistance2D=t}setElementWorldDetectionDistance(t){this.elementWorldDetectionDistance=t}setOnScreenElementWorldDetectionDistance(t){this.onScreenElementWorldDetectionDistance=t}}var rw=n("LvDl");function iw(t){return(iw="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})(t)}function ow(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,sw(r.key),r)}}function sw(t){var e=function(t,e){if("object"!=iw(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=iw(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==iw(e)?e:e+""}var aw=function(){return function(t,e,n){return e&&ow(t.prototype,e),n&&ow(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n){var r,i,o,s=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=this,i="onElementSelected",o=Object(rw.throttle)((function(t){t&&(s.onLabelSelected(t),s.parent.onElementSelected(t))}),300,{trailing:!1}),(i=sw(i))in r?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o,this.vr=e,this.parent=n}),[{key:"createLabel",value:function(t){var e;this.registryLabelEvent(t),null===(e=this.parent.transformController)||void 0===e||e.bindElement(t)}},{key:"registryLabelEvent",value:function(t){t.on(Ud.ELEMENT_SELECTED,this.onElementSelected)}},{key:"unRegistryLabelEvent",value:function(t){t.off(Ud.ELEMENT_SELECTED,this.onElementSelected)}},{key:"onLabelSelected",value:function(t){var e=this,n=this.vr.tilePanoCtl.moveOnClick;this.vr.setMoveClick(!1),t.rafTimer=setTimeout((function(){t.rafTimer=null,e.vr.setMoveClick(n)}),200)}},{key:"getTransformController",value:function(){this.vr.view.parent.unregisterEvents();var t=new nw(this.vr.view);return t.setOnScreenElementWorldDetectionDistance(-1),this.vr.stage.bindController(t),this.parent.transformController=t,t.on(Ud.ELEMENT_SELECTED,this.onElementSelected),this.vr.view.parent.registerEvents(),t}},{key:"disposeTransformController",value:function(){this.parent.transformController.off(Ud.ELEMENT_SELECTED,this.onElementSelected),this.vr.stage.disposeController(this.parent.transformController),this.parent.transformController.unbind(),this.parent.transformController=null}},{key:"disposeLabel",value:function(t){var e;null===(e=this.parent.transformController)||void 0===e||e.unbindElement(t),this.vr.stage.disposeElement(t),t.rafTimer&&window.clearTimeout(t.rafTimer),t.rafTimer=null,this.unRegistryLabelEvent(t)}}])}();function uw(t){return(uw="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})(t)}function cw(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function lw(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,yw(r.key),r)}}function hw(t,e,n){return e=gw(e),function(t,e){if(e&&("object"==uw(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}()?Reflect.construct(e,n||[],gw(t).constructor):e.apply(t,n))}function pw(t,e,n,r){var i=fw(gw(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof i?function(t){return i.apply(n,t)}:i}function fw(){return(fw="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=dw(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(null,arguments)}function dw(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=gw(t)););return t}function gw(t){return(gw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function mw(t,e){return(mw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function vw(t,e,n){return(e=yw(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function yw(t){var e=function(t,e){if("object"!=uw(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=uw(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==uw(e)?e:e+""}var xw=function(t){function e(){var t;cw(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return vw(t=hw(this,e,[].concat(r)),"labelUtil",null),vw(t,"transformController",null),vw(t,"updateLabel",(function(){})),vw(t,"onOwllyVrInit",(function(){})),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&mw(t,e)}(e,t),n=e,(r=[{key:"registry",value:function(t){pw(e,"registry",this,3)([t]),this.registryOwllyVrEvent(),this.labelUtil=new aw(t,this)}},{key:"registryOwllyVrEvent",value:function(){var t=this.owllyVr;t.registerCb(LM.OnPanorama,this.updateLabel),t.registerCb(LM.OnInit,this.onOwllyVrInit)}},{key:"unRegistryOwllyVrEvent",value:function(){var t=this.owllyVr;t.unRegisterCb(LM.OnPanorama,this.updateLabel),t.unRegisterCb(LM.OnInit,this.onOwllyVrInit)}},{key:"dispose",value:function(){this.unRegistryOwllyVrEvent(),pw(e,"dispose",this,3)([]),this.labelUtil=null,this.offAll()}}])&&lw(n.prototype,r),i&&lw(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(Q_);function bw(t){return(bw="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})(t)}function _w(t){return function(t){if(Array.isArray(t))return ww(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return ww(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ww(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ww(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Mw(t,e,n){return e=Aw(e),function(t,e){if(e&&("object"==bw(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}()?Reflect.construct(e,n||[],Aw(t).constructor):e.apply(t,n))}function Ew(){return(Ew="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=Sw(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(null,arguments)}function Sw(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Aw(t)););return t}function Aw(t){return(Aw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Cw(t,e){return(Cw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Tw(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Rw(r.key),r)}}function Pw(t,e,n){return e&&Tw(t.prototype,e),n&&Tw(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Iw(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Lw(t,e,n){return(e=Rw(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Rw(t){var e=function(t,e){if("object"!=bw(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=bw(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==bw(e)?e:e+""}var Ow=Pw((function t(){Iw(this,t)}));Lw(Ow,"onLabel","onLabel");var Dw=function(t){function e(){var t;return Iw(this,e),Lw(t=Mw(this,e),"onOwllyVrInit",(function(){t.labelUtil.getTransformController()})),Lw(t,"setVideoPlayStatus",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.owllyVr.curPid;t.videoMap.forEach((function(t,n){t.visiblePidSet.has(e)?(t.setVideoVisible(!0),t.play(n)):t.stop(n)}))})),Lw(t,"updateLabel",(function(e){t.setVideoPlayStatus(e)})),Lw(t,"onElementSelected",(function(e){var n=t.videoToIdMap.get(e);t.emit(Ow.onLabel,n)})),t.name="video",t.videoMap=new Map,t.videoToIdMap=new WeakMap,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Cw(t,e)}(e,t),Pw(e,[{key:"add",value:function(t){var e,n=t.id,r=(t.pid,t.videoUrl),i=t.position,o=t.pose,s=t.visiblePoints,a=t.imgWidth,u=void 0===a?80:a,c=t.imgHeight,l=void 0===c?80:c,h=new Nb(r);this.owllyVr.stage.bindElement(h),this.labelUtil.createLabel(h),h.position.set(i[0],i[1],i[2]),(e=h.quaternion).set.apply(e,_w(o)),h.setVideoSize(u/100,l/100),h.visiblePidSet=new Set(s),this.videoMap.set(n,h),this.videoToIdMap.set(h,n),this.setVideoPlayStatus()}},{key:"remove",value:function(t){var e=this.videoMap.get(t);e&&this.labelUtil.disposeLabel(e)}},{key:"clear",value:function(){var t=this;this.videoMap.forEach((function(e){t.labelUtil.disposeLabel(e)})),this.videoMap.clear()}},{key:"dispose",value:function(){var t,n,r,i,o;this.labelUtil.disposeTransformController(),this.clear(),(t=e,n="dispose",r=this,o=Ew(Aw(1&(i=3)?t.prototype:t),n,r),2&i&&"function"==typeof o?function(t){return o.apply(r,t)}:o)([])}}])}(xw);n("yq1k"),n("JTJg");function Bw(t){return(Bw="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})(t)}function Fw(t){return function(t){if(Array.isArray(t))return Gw(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||kw(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Nw(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=kw(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function kw(t,e){if(t){if("string"==typeof t)return Gw(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gw(t,e):void 0}}function Gw(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Uw(t,e,n){return e=Vw(e),function(t,e){if(e&&("object"==Bw(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}()?Reflect.construct(e,n||[],Vw(t).constructor):e.apply(t,n))}function zw(){return(zw="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=Hw(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(null,arguments)}function Hw(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Vw(t)););return t}function Vw(t){return(Vw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function jw(t,e){return(jw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Ww(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Jw(r.key),r)}}function qw(t,e,n){return e&&Ww(t.prototype,e),n&&Ww(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Xw(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Yw(t,e,n){return(e=Jw(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Jw(t){var e=function(t,e){if("object"!=Bw(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Bw(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Bw(e)?e:e+""}var Kw=qw((function t(){Xw(this,t)}));Yw(Kw,"onLabel","onLabel");var Qw=function(t){function e(){var t;return Xw(this,e),Yw(t=Uw(this,e),"onOwllyVrInit",(function(){t.labelUtil.getTransformController()})),Yw(t,"onElementSelected",(function(e){var n=e.labelID;t.emit(Kw.onLabel,n)})),Yw(t,"updateLabel",(function(e){t.clear();var n=t.pidLabel3dDataMap.get(e);n&&n.forEach((function(n){var r=n.visiblePoints,i=n.id,o=n.imgUrl,s=n.size,a=n.position,u=n.quaternion,c=n.lookAtCamera;t.add(r,i,o,s,a,u,c,e)}))})),t.name="label3d",t.pidLabel3dDataMap=new Map,t.label3dId2PidMap=new Map,t.label3dMap=new Map,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jw(t,e)}(e,t),qw(e,[{key:"add",value:function(t,e,n,r,i,o){var s=arguments.length>6&&void 0!==arguments[6]&&arguments[6],a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.owllyVr.curPid,u=this.pidLabel3dDataMap,c=this.label3dId2PidMap,l=this.owllyVr,h=this.label3dMap,p=l.stage;if(!h.get(e)){var f=this.create(t,e,n,r,i,o,s),d={visiblePoints:t,id:e,imgUrl:n,size:r,position:i,quaternion:o,lookAtCamera:s};c.set(e,t);var g,m=Nw(t);try{for(m.s();!(g=m.n()).done;){var v=g.value,y=u.get(v);y||(y=new Map,u.set(v,y)),y.set(e,d)}}catch(t){m.e(t)}finally{m.f()}t.includes(a)&&(p.bindElement(f),this.labelUtil.createLabel(f),h.set(e,f))}}},{key:"create",value:function(t,e,n,r,i,o){var s,a,u=arguments.length>6&&void 0!==arguments[6]&&arguments[6],c=new cb(e,n,{width:r[0],height:r[1]});(c.up.set(0,0,1),o)&&(a=c.quaternion).set.apply(a,Fw(o));return(s=c.position).set.apply(s,Fw(i)),c.addViewConfiguration({targetView:this.view,positions:t.map((function(t){return{pid:t,position:i}})),visibilities:t.map((function(t){return{pid:t,visible:!0}})),faceToCamera:u,keepZOnFaceToCamera:!0,visibleScope:15,showDom:!1,showMesh:!0}),c}},{key:"remove",value:function(t){var e=this.label3dMap,n=this.pidLabel3dDataMap,r=this.label3dId2PidMap;if(r.has(t)){var i=r.get(t);r.delete(t);var o,s=Nw(i);try{for(s.s();!(o=s.n()).done;){var a=o.value,u=n.get(a);u&&u.delete(t)}}catch(t){s.e(t)}finally{s.f()}}if(e.has(t)){var c=e.get(t);this.labelUtil.disposeLabel(c),e.delete(t)}}},{key:"clear",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.label3dMap,r=this.pidLabel3dDataMap,i=this.label3dId2PidMap,o=Nw(n.values());try{for(o.s();!(t=o.n()).done;){var s=t.value;this.labelUtil.disposeLabel(s)}}catch(t){o.e(t)}finally{o.f()}n.clear(),e&&(r.clear(),i.clear())}},{key:"dispose",value:function(){var t,n,r,i,o;this.clear(!0),this.labelUtil.disposeTransformController(),(t=e,n="dispose",r=this,o=zw(Vw(1&(i=3)?t.prototype:t),n,r),2&i&&"function"==typeof o?function(t){return o.apply(r,t)}:o)([])}}])}(xw);function Zw(t){return(Zw="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})(t)}function $w(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return tM(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tM(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function tM(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function eM(t,e,n){return e=iM(e),function(t,e){if(e&&("object"==Zw(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}()?Reflect.construct(e,n||[],iM(t).constructor):e.apply(t,n))}function nM(){return(nM="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=rM(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(null,arguments)}function rM(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=iM(t)););return t}function iM(t){return(iM=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function oM(t,e){return(oM=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function sM(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,lM(r.key),r)}}function aM(t,e,n){return e&&sM(t.prototype,e),n&&sM(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function uM(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cM(t,e,n){return(e=lM(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lM(t){var e=function(t,e){if("object"!=Zw(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Zw(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Zw(e)?e:e+""}var hM=aM((function t(){uM(this,t)}));cM(hM,"onLabel","onLabel");var pM=function(t){function e(t){var n;return uM(this,e),cM(n=eM(this,e,[t]),"label2DOverlay",null),cM(n,"onOwllyVrInit",(function(){n.label2DOverlay=new kb,n.owllyVr.view.addOverlay(n.label2DOverlay)})),cM(n,"onElementSelected",(function(t){var e,r=t.labelId,i=t.pid,o=null===(e=n.pidLabel2dDataMap.get("".concat(i)))||void 0===e?void 0:e.get(r);n.owllyVr.callBack(LM.OnLabel,r,o.attrsParams),n.emit(hM.onLabel,r,o.attrsParams)})),cM(n,"updateLabel",(function(t){n.clear();var e=n.pidLabel2dDataMap.get("".concat(t));e&&e.forEach((function(t){var e=t.pid,r=t.id,i=t.attrsParams;n.add(e,r,i,e)}))})),n.name="label2d",n.pidLabel2dDataMap=new Map,n.label2dId2PidMap=new Map,n.label2dMap=new Map,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&oM(t,e)}(e,t),aM(e,[{key:"create",value:function(t,e,n){var r=new Bb;return n.textAttrs&&(n.textAttrs.fontSize=n.textAttrs.fontSize||12),r.setAttributes(n),r.setTextFontSize(n.textAttrs.fontSize),r.labelId=e,r.setLabelID(e),r.pid=t,r.setVisible(!0),r}},{key:"add",value:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.owllyVr.curPid,i=this.pidLabel2dDataMap,o=this.label2dId2PidMap;if(n){var s=n.position;s&&(n.position=new pr(s.x,s.y,s.z))}var a={pid:t,id:e,attrsParams:n},u=i.get("".concat(t));if(u||(u=new Map,i.set("".concat(t),u)),o.set(e,t),u.set(e,a),r===t){var c=this.create(t,e,n);this.label2dMap.set(e,c),this.owllyVr.stage.bindElement(c),this.labelUtil.createLabel(c)}}},{key:"remove",value:function(t){var e=this.label2dMap,n=this.label2dId2PidMap,r=this.pidLabel2dDataMap;if(n.has(t)){var i=n.get(t);n.delete(t);var o=r.get("".concat(i));o&&o.delete(t)}if(e.has(t)){var s=e.get(t);this.labelUtil.disposeLabel(s),e.delete(t)}}},{key:"clear",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.label2dMap,r=this.pidLabel2dDataMap,i=this.label2dId2PidMap,o=$w(n.values());try{for(o.s();!(t=o.n()).done;){var s=t.value;this.labelUtil.disposeLabel(s)}}catch(t){o.e(t)}finally{o.f()}n.clear(),e&&(r.clear(),i.clear())}},{key:"removeOverlay",value:function(){this.label2DOverlay&&(this.owllyVr.view.removeOverlay(this.label2DOverlay),this.label2DOverlay=null)}},{key:"dispose",value:function(){var t,n,r,i,o;this.removeOverlay(),this.clear(!0),(t=e,n="dispose",r=this,o=nM(iM(1&(i=3)?t.prototype:t),n,r),2&i&&"function"==typeof o?function(t){return o.apply(r,t)}:o)([])}}])}(xw);function fM(t){return(fM="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})(t)}function dM(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */dM=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof m?e:m,s=Object.create(o.prototype),a=new P(r||[]);return i(s,"_invoke",{value:S(t,n,a)}),s}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",f="executing",d="completed",g={};function m(){}function v(){}function y(){}var x={};c(x,s,(function(){return this}));var b=Object.getPrototypeOf,_=b&&b(b(I([])));_&&_!==n&&r.call(_,s)&&(x=_);var w=y.prototype=m.prototype=Object.create(x);function M(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,o,s,a){var u=h(t[i],t,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==fM(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(l).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(u.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function S(e,n,r){var i=p;return function(o,s){if(i===f)throw Error("Generator is already running");if(i===d){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var u=A(a,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===p)throw i=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=f;var c=h(e,n,r);if("normal"===c.type){if(i=r.done?d:"suspendedYield",c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=d,r.method="throw",r.arg=c.arg)}}}function A(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,A(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=h(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function I(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(fM(e)+" is not iterable")}return v.prototype=y,i(w,"constructor",{value:y,configurable:!0}),i(y,"constructor",{value:v,configurable:!0}),v.displayName=c(y,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,c(t,u,"GeneratorFunction")),t.prototype=Object.create(w),t},e.awrap=function(t){return{__await:t}},M(E.prototype),c(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new E(l(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},M(w),c(w,u,"Generator"),c(w,s,(function(){return this})),c(w,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=I,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var u=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;T(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:I(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function gM(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function mM(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){gM(o,r,i,s,a,"next",t)}function a(t){gM(o,r,i,s,a,"throw",t)}s(void 0)}))}}function vM(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,_M(r.key),r)}}function yM(t,e,n){return e&&vM(t.prototype,e),n&&vM(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function xM(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function bM(t,e,n){return(e=_M(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _M(t){var e=function(t,e){if("object"!=fM(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=fM(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==fM(e)?e:e+""}var wM=pr,MM=er,EM=hr,SM=Vr,AM=qo,CM=To,TM=Gi,PM=L,IM=sr;!function(t,e={}){Nd.getInstance().setThreeInstance(t),e&&e.konva&&Nd.getInstance().setKonvaInstance(e.konva)}(r);var LM=yM((function t(){xM(this,t)}));bM(LM,"OnInit","onInit"),bM(LM,"OnMoveReady","onMoveReady"),bM(LM,"OnSwitch","onSwitch"),bM(LM,"OnStep","onStep"),bM(LM,"OnRoll","onRoll"),bM(LM,"OnDestroy","onDestroy"),bM(LM,"OnSelected","onSelected"),bM(LM,"OnMoveStart","onMoveStart"),bM(LM,"OnMoveEnd","onMoveEnd"),bM(LM,"OnPanorama","onPanorama"),bM(LM,"OnLoading","onLoading"),bM(LM,"OnChangeFloor","onChangeFloor"),bM(LM,"OnTitle","onTitle"),bM(LM,"OnLabel","onLabel"),bM(LM,"OnError","onError"),bM(LM,"OnGisPos","onGisPos"),bM(LM,"OnPointerMove","onPointerMove");var RM=function(){function t(e){var n,r=this;xM(this,t),bM(this,"container",void 0),bM(this,"loadingElement",void 0),bM(this,"topTile",void 0),bM(this,"pathLine",null),bM(this,"store2PanoDataMap",new Map),bM(this,"panoDataMap",new Map),bM(this,"trans2T3MtxMap",new Map),bM(this,"gisAlignMap",new Map),bM(this,"coordinateMap",new Map),bM(this,"sceneDataMap",new Map),bM(this,"intersectionsMapMap",new Map),bM(this,"cbsMap",new Map),bM(this,"stage",void 0),bM(this,"view",void 0),bM(this,"screen",void 0),bM(this,"basicCtl",void 0),bM(this,"curSceneData",void 0),bM(this,"curPanoData",void 0),bM(this,"floorModel",void 0),bM(this,"tilePanoCtl",void 0),bM(this,"panoGroup",void 0),bM(this,"pathColor",void 0),bM(this,"pathWidth",void 0),bM(this,"pathLineViewDistance",void 0),bM(this,"pathImage","imgs/arrow.png"),bM(this,"curStepIndex",-1),bM(this,"sceneFov",void 0),bM(this,"indicatorImageURL","/imgs/pointer.png"),bM(this,"targetStepIndex",-1),bM(this,"stepMoving",!1),bM(this,"stepJumping",!1),bM(this,"stepJumpMax",0),bM(this,"changingFloor",!1),bM(this,"moveDataSteps",[]),bM(this,"moveDataPanoramas",[]),bM(this,"pathMap",new Map),bM(this,"pathDataMap",new Map),bM(this,"pano2IdnexMap",new Map),bM(this,"curStoreIndex",0),bM(this,"store2MovePanosMap",new Map),bM(this,"targetPid",-1),bM(this,"targetPos",null),bM(this,"targetLookParam",null),bM(this,"moveReady",!1),bM(this,"moveClick",!1),bM(this,"stepStopResolve",null),bM(this,"resMode",""),bM(this,"offlinePath",""),bM(this,"timeScale",1),bM(this,"modelMap",new Map),bM(this,"modelCache",!0),bM(this,"floorModelResolve",void 0),bM(this,"waitModel",void 0),bM(this,"initFlooring",!1),bM(this,"fixedViewDistance",!1),bM(this,"pathStartPoint",null),bM(this,"pathEndArrow",null),bM(this,"tileLevelMax",2),bM(this,"moveToBackShowImage",!0),bM(this,"plugins",new Set),bM(this,"rf",void 0),bM(this,"onPointerMove",(function(t){if(m.emitPointerPosition){var e=t.clientX,n=t.clientY,i=r.container,o=i.clientWidth,s=i.clientHeight,a=r.container.getBoundingClientRect(),u=e-a.left,c=n-a.top,l=new Gp;l.setFromCamera({x:2*u/o-1,y:1-2*c/s},r.view.camera);var h=r.floorModel.intersectRay(l.ray.origin,l.ray.direction,!0);if(h&&h.length){var p=h[0];null!=p&&p.intersectionPoint&&r.callBack(LM.OnPointerMove,p.intersectionPoint)}}})),bM(this,"animate",(function(t){r.animate&&(r.rf=requestAnimationFrame(r.animate)),v.a.update(t)})),bM(this,"lastOnRollStr",""),this.container=e,this.pathColor=m.path.color,this.pathWidth=m.path.width,this.pathLineViewDistance=m.path.viewDistance,this.sceneFov=m.camera.fov,null!=m.tileLevelMax&&(this.tileLevelMax=m.tileLevelMax),!1===m.move.moveBackShowImage&&(this.moveToBackShowImage=!1),m.tile&&(m.tile.textPixel||m.tile.imgTextPixel)&&(n=m.tile,fb=Object.assign(Object.assign({},fb),n)),this.createNetMonitor(),this.use(Qw),this.use(pM),this.registryContainerEvent()}return yM(t,[{key:"use",value:function(t){var e=t;"function"==typeof t&&(e=new t),this.plugins.add(e),this.registryPlugin(e)}},{key:"registryPlugin",value:function(t){t.registry(this),this["$plugin_".concat(t.name)]=t}},{key:"createNetMonitor",value:function(){var t;null!==(t=m.healthCheck)&&void 0!==t&&t.use&&(this.netMonitor=new V_,this.netMonitor.start(),this.netMonitor.on(this.netMonitor.eventName,(function(t){console.log(t)})))}},{key:"registryContainerEvent",value:function(){this.container.addEventListener("pointermove",this.onPointerMove)}},{key:"unRegistryContainerEvent",value:function(){this.container.removeEventListener("pointermove",this.onPointerMove)}},{key:"sleepByNetStatusCheck",value:(k=mM(dM().mark((function t(){var e;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e=this.netMonitor).status){t.next=4;break}return t.next=4,e.healthCheck();case 4:if(!e.status){t.next=6;break}return t.abrupt("return");case 6:return t.next=8,new Promise((function(t){var n=function(r){r&&t(),e.off(e.eventName,n)};e.on(e.eventName,n)}));case 8:case"end":return t.stop()}}),t,this)}))),function(){return k.apply(this,arguments)})},{key:"showLoading",value:function(t){g.log("------loading show------------------",t),t?(this.container.style.opacity=0,this.callBack(LM.OnLoading,t)):(this.container.style.opacity=1,this.callBack(LM.OnLoading,t))}},{key:"setLoading",value:function(t){this.loadingElement=t}},{key:"enableDebug",value:function(t){g.level=t?d.LOG:d.NONE}},{key:"waitSecond",value:(N=mM(dM().mark((function t(){var e,n=arguments;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=n.length>0&&void 0!==n[0]?n[0]:1,t.next=3,this.waitAWhile(1e3*e);case 3:case"end":return t.stop()}}),t,this)}))),function(){return N.apply(this,arguments)})},{key:"waitAWhile",value:(F=mM(dM().mark((function t(){var e,n=arguments;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=n.length>0&&void 0!==n[0]?n[0]:1e3,t.abrupt("return",new Promise((function(t){setTimeout((function(){t("resolved")}),e)})));case 2:case"end":return t.stop()}}),t)}))),function(){return F.apply(this,arguments)})},{key:"processCoordinate",value:function(t,e){var n=this;t&&e&&(t=t instanceof Array?t:[t],e=e instanceof Array?e:[e],t.forEach((function(t,r){var i=e[r];i&&n.coordinateMap.set(t,i)})))}},{key:"trans2T3Vector",value:function(t,e,n,r){r=r||0;var i=this.trans2T3MtxMap.get(t);if(null!=i){var o=new wM(e,n,0);return o.applyMatrix4(i),o.z=r,o}var s=this.coordinateMap.get(t);if(s){var a=s.width,u=s.height,c=s.scale,l=s.theta,h=(e-a*s.x_ratio)/c,p=(n-u*s.y_ratio)/c,f=h*Math.cos(l)+p*Math.sin(l),d=h*Math.sin(l)-p*Math.cos(l);return new wM(f,d,r)}return null}},{key:"getVRData",value:(B=mM(dM().mark((function t(e){var n,r;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=null,!e){t.next=18;break}if("off-line"!==this.resMode){t.next=11;break}return t.next=5,o_.xhrGet("".concat(this.offlinePath).concat(e,".json"),!0);case 5:return r=t.sent,t.next=8,o_.xhrGet(r.jsonPath,!0);case 8:n=t.sent,t.next=18;break;case 11:return t.next=13,o_.xhrPost(m.api.listPanoramasUrl,{store_id:e,use_super:m.tile.useSuper},!0);case 13:if(null!==(n=t.sent)||!this.netMonitor){t.next=18;break}return t.next=17,this.sleepByNetStatusCheck();case 17:return t.abrupt("return",this.getVRData(e));case 18:return t.abrupt("return",n);case 19:case"end":return t.stop()}}),t,this)}))),function(t){return B.apply(this,arguments)})},{key:"getVRIntersectionsData",value:(D=mM(dM().mark((function t(e){var n,r,i,o,s;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.intersectionsMapMap.has(e)){t.next=14;break}return n=this.sceneDataMap.get(e),r=n.intersectionsPath||"".concat(m.VRHost||"https://vr.aibee.cn","/robot-vr/navigation/list-ground-intersections/").concat(e),t.next=5,o_.xhrGet(r,!0);case 5:if((i=t.sent)||!this.netMonitor){t.next=10;break}return t.next=9,this.sleepByNetStatusCheck();case 9:return t.abrupt("return",this.getVRIntersectionsData(e));case 10:o=i.data,s=new Map,o.forEach((function(t){var e=t.panorama_id,n=t.pos_x,r=t.pos_y,i=t.pos_z;s.set(e,new wM(n,r,i))})),this.intersectionsMapMap.set(e,s);case 14:return t.abrupt("return",this.intersectionsMapMap.get(e));case 15:case"end":return t.stop()}}),t,this)}))),function(t){return D.apply(this,arguments)})},{key:"createLabel2d",value:function(t,e,n){return this.$plugin_label2d.create(t,e,n)}},{key:"addLabel2d",value:function(t,e,n){return this.$plugin_label2d.add(t,e,n)}},{key:"createLabel3d",value:function(t,e,n,r,i,o){var s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return this.$plugin_label3d.create(t,e,n,r,i,o,s)}},{key:"addLabel3d",value:function(t,e,n,r,i,o){var s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return this.$plugin_label3d.add(t,e,n,r,i,o,s)}},{key:"removeLabel3d",value:function(t){return this.$plugin_label3d.remove(t)}},{key:"removeLabel2d",value:function(t){return this.$plugin_label2d.remove(t)}},{key:"cleanLabel2d",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.$plugin_label2d.clear(t)}},{key:"cleanLabel3d",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.$plugin_label3d.clear(t)}},{key:"cleanLabel",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.cleanLabel2d(t),this.cleanLabel3d(t)}},{key:"registerCb",value:function(t,e){var n=this.cbsMap.get(t);n||(n=[],this.cbsMap.set(t,n)),n.push(e)}},{key:"unRegisterCb",value:function(t,e){var n=this.cbsMap.get(t);if(n){var r=n.indexOf(e);r>-1&&n.splice(r,1)}}},{key:"cleanCb",value:function(t){t?this.cbsMap.delete(t):this.cbsMap.clear()}},{key:"callBack",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];if(this.cbsMap.has(t)){var i=this.cbsMap.get(t);m.cbLog,i.forEach((function(t){t.apply(void 0,n)}))}}},{key:"updateTitle",value:function(t){this.callBack(LM.OnTitle,t)}},{key:"process2T3Matrix",value:function(t,e){var n=this;if(t&&e){var r=t instanceof Array;e=r?e:[e],(t=r?t:[t]).forEach((function(t,r){var i=e[r];i&&n.trans2T3MtxMap.set(t,(new SM).fromArray(i))}))}}},{key:"getPanoramaData",value:function(t,e){var n=this.store2PanoDataMap,r=this.panoDataMap;if(n.has(t))return n.get(t);var i=e.map((function(e){var n=e.panorama_images,r=e.panorama_images_low,i=e.tile_image_level,o=e.tile_images,s=e.seq_id,a=e.visible_panorama_seq_ids,u=e.coordinate,c=u.panorama_id,l=u.direction_w,h=u.direction_x,p=u.direction_y,f=u.direction_z,d=u.position_x,g=u.position_y,v=u.position_z,y=e.visible,x=JSON.parse(r),b=JSON.parse(o);return{storeId:t,pid:c,seqID:s,textureURLs:x,visible:y,offLineTextureUrls:b,offLineTextureLevel:i,highTextureURLs:JSON.parse(n),useLowTextureURLsOnly:m.tile.useLowTextureURLsOnly,neighbourPanoramaIDs:a,position:new wM(d,g,v),quaternion:new EM(h,p,f,l)}}));return n.set(t,i),i.forEach((function(t){r.set(t.pid,t);var e=t.neighbourPanoramaIDs.map((function(t){return i[t].pid}));t.neighbourPanoramaIDs=e})),i}},{key:"showChangeFloor",value:(O=mM(dM().mark((function t(e){var n,r,i;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this.view,!e||this.changeFloor){t.next=10;break}return this.changingFloor=!0,r=n.renderer.domElement,i=r.toDataURL("image/jpeg",.95),this.callBack(LM.OnChangeFloor,e,i),t.next=8,this.waitAWhile(200);case 8:t.next=11;break;case 10:!e&&this.changingFloor&&(this.changeFloor=!1,this.callBack(LM.OnChangeFloor,e));case 11:case"end":return t.stop()}}),t,this)}))),function(t){return O.apply(this,arguments)})},{key:"setPixelRatio",value:function(t){var e=this.view;e&&e.renderer.setPixelRatio(t)}},{key:"setFov",value:function(t){this.sceneFov=t,this.basicCtl&&this.basicCtl.setFov(t)}},{key:"setFovRange",value:function(t,e){this.basicCtl&&this.basicCtl.setFovRange(t,e)}},{key:"getPIDByPos",value:function(t,e,n){var r=this.store2PanoDataMap.get(t),i=null,o=this.trans2T3Vector(t,e,n),s=-1;return r.forEach((function(t){if(t.visible){var e=o.distanceTo(t.position);i?e<s&&(i=t,s=e):(i=t,s=e)}})),s>20&&g.warn("位置点距离全景点过远, distance = ".concat(s)),i.pid}},{key:"getPIDByGis",value:function(t,e,n){var r=this.gisAlignMap;if(r.has(t)){var i,o,s=r.get(t),a=null,u=new MM(e,n),c=-1;return s.forEach((function(t,e){var n=t.gis,r=t.pos,s=u.distanceTo(n);(!a||s<c)&&(c=s,a=e,i=r,o=n)})),{target:a,distance:c,pos:i,gis:o}}return{target:0}}},{key:"getPathPoints",value:function(){var t=this.pathLine,e=this.moveDataSteps,n=[],r=[];if(t){for(var i,o=0,s=t.getCurrent()+t.getViewDistance(),a=0;a<e.length;a++){var u=e[a];if(i&&i.store_id!=u.store_id||o+u.distance>s)break;o+=u.distance,n.push(u.pos3),r.push(u.distance),i=u}var c=t.getPointOnDistance(s).point;r.push(c.distanceTo(n[n.length-1])),n.push(c)}return{points:n,distances:r}}},{key:"lookPathPoints",value:(R=mM(dM().mark((function t(){var e,n,r,i,o,s,a,u,c,l,h,p,f,d;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.tilePanoCtl,n=this.timeScale,r=this.panoDataMap,i=this.moveDataSteps,o=this.curPid,s=this.curStepIndex,a=this.getPathPoints(),u=a.points,c=a.distances,s<0&&(o=i[0].curPid),l=r.get(o),h=l.position,p=u.map((function(t){var e=t.clone().sub(h);return e.z=0,e})),f=u.map((function(){return o})),d=c.map((function(t){return 200*t*n})),t.next=11,e.moveInPath(f,{intervals:d,toDirections:p,fovs:this.sceneFov,showModel:!1});case 11:case"end":return t.stop()}}),t,this)}))),function(){return R.apply(this,arguments)})},{key:"lookatPathEnd",value:(L=mM(dM().mark((function t(){var e,n,r,i,o,s,a,u,c,l,h;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.tilePanoCtl,n=this.pathLine,r=this.panoDataMap,i=this.moveDataSteps,o=this.curPid,this.curStepIndex<0&&(o=i[0].curPid),s=n.getCurrent(),a=n.getViewDistance(),u=s+a,c=n.getPointOnDistance(u).point,l=r.get(o),h=l.position,c.sub(new wM(h.x,h.y,0)).normalize(),t.next=12,e.moveInPath([o],{intervals:2e3,toDirections:c,fovs:this.sceneFov,showModel:!1});case 12:case"end":return t.stop()}}),t,this)}))),function(){return L.apply(this,arguments)})},{key:"initStage",value:function(){var t=this.stage,e=this.container;if(null==t&&(requestAnimationFrame(this.animate),this.initEvent(),bb.resizeFirst=m.tileResizeFirst,t=this.stage=new Xd,e)){var n=this.screen=new Yd(e,{preserveDrawingBuffer:!0,eventOnContainer:!0}),r=this.view=new Kd(n);t.bindView(r);var i=this.basicCtl=new Kb(r),o=null!=m.camera.zoomScale?m.camera.zoomScale:-1;hb.DetectAndroid()&&(o*=-1),i.zoomScale=o,t.bindController(i),i.setZoomMode("fov"),this.setFovRange(Math.min(10,this.sceneFov),Math.max(this.sceneFov,90)),this.setFov(this.sceneFov),this.callBack(LM.OnInit)}}},{key:"setPath",value:function(e,n,r,i,o){var s=this,a=this.stage,u=this.pathColor,c=this.pathWidth,l=this.pathLine;null==i&&(i=u),null==o&&(o=c),l&&a.disposeElement(l);var h=t.SmoothPath(e);if((l=this.pathLine=new _b(h,{textureUrl:n,color:parseInt(i),current:0,viewDistance:8,gradientDistance:5,gradientEnabled:!0,width:o})).setCurrent(0),l.position.z=r,a.bindElement(l),m.path.startPoint&&e.length>1){var p=new AM(1.5*o,1.5*o),f=new Image,d=new TM({color:i,depthTest:!1,transparent:!0}),g=new CM(p,d);g.renderOrder=10001,g.opacity=0,g.position.set(e[0].x,e[0].y,r),this.stage.scene.add(g),f.onload=function(){var t=new IM(f);t.needsUpdate=!0,d.map=t,d.needsUpdate=!0,g.opacity=1},f.onerror=function(){s.callBack(LM.OnError,"start-point img load error【".concat(f.src,"】"))},f.src="textures/start-point.png",this.pathStartPoint=g}if(m.path.endArrow)if(m.path.endArrow3d){var v=new Ob("model/end_arrow_static.glb",{depthTest:!1,renderOrder:10002},A_);this.stage.bindElement(v),this.pathEndArrow=v}else{var y=2*o;m.path.endArrowWidth&&(y=m.path.endArrowWidth);var x=new AM(2*y,y),b=new Image,_=new TM({color:i,depthTest:!1,transparent:!0,side:PM}),w=new CM(x,_);w.renderOrder=10002,w.opacity=0,w.rotation.set(Math.PI/2,0,0),w.position.set(e[0].x,e[0].y,r+y),this.stage.scene.add(w),b.onload=function(){var t=new IM(b);t.needsUpdate=!0,_.map=t,_.needsUpdate=!0,w.opacity=1},b.onerror=function(){s.callBack(LM.OnError,"arror img load error【".concat(b.src,"】"))},b.src="textures/end-arrow.png",this.pathEndArrow=w}}},{key:"getArrowAngleByDir",value:function(t,e){var n=new wM(1,0,0),r=new wM(t.x,t.y,0).normalize(),i=n.clone().angleTo(r),o=n.clone().dot(r),s=Math.acos(o),a=n.clone().angleTo(t),u=n.clone().cross(r);return g.log("getArrowAngleByDir",r,t,i,s,a,u),u.z<0?-i+Math.PI:i+Math.PI}},{key:"updatePathByPid",value:function(t){var e=this.pathLine,n=this.view,r=this.getTargetDistanceByPid(t,this.pathLineViewDistance),i=Math.min(r/2,4),o=e.getNearestPoint(n.camera.position).distance;e.setCurrent(o),e.setViewDistance(r),e.uniforms.gradientDistance.value=i}},{key:"dispose",value:(I=mM(dM().mark((function t(e){var n,r,i,o,s,a,u;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this.stage,r=this.panoGroup,i=this.floorModel,o=this.pathLine,s=this.tilePanoCtl,a=this.modelCache,u=this.netMonitor,this.cleanLabel(),i&&(a?n.unbindElement(i):n.disposeElement(i),this.floorModel=null),e&&(this.modelMap.forEach((function(t){t.dispose()})),this.modelMap.clear(),u&&(u.offAll(),this.netMonitor=null)),r&&(n.disposeElement(r),this.panoGroup=null),o&&(n.disposeElement(o),this.pathLine=null),!s){t.next=11;break}return t.next=9,n.disposeController(s);case 9:s.dispose(),this.tilePanoCtl=null;case 11:this.pathEndArrow&&(this.pathEndArrow.opacity=0,n.scene.remove(this.pathEndArrow),ky.dispose(this.pathEndArrow),this.pathEndArrow=null),this.pathStartPoint&&(this.pathStartPoint.opacity=0,n.scene.remove(this.pathStartPoint),ky.dispose(this.pathStartPoint),this.pathStartPoint=null);case 13:case"end":return t.stop()}}),t,this)}))),function(t){return I.apply(this,arguments)})},{key:"modelLoad",value:(P=mM(dM().mark((function t(e){var n=this;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){var r=new Yx(e);n.floorModelResolve=function(){var i=mM(dM().mark((function i(o,s){return dM().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(s){i.next=2;break}return i.abrupt("return",t(r));case 2:return n.waitModel=null,r.dispose(),i.next=6,n.sleepByNetStatusCheck();case 6:t(n.modelLoad(e));case 7:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}(),n.waitModel=r})));case 1:case"end":return t.stop()}}),t)}))),function(t){return P.apply(this,arguments)})},{key:"preFloorModels",value:(T=mM(dM().mark((function t(){var e,n;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.modelCache){t.next=9;break}e=Array.from(this.sceneDataMap.keys()),n=0;case 3:if(!(n<e.length)){t.next=9;break}return t.next=6,this.getFloorModel(e[n]);case 6:n++,t.next=3;break;case 9:case"end":return t.stop()}}),t,this)}))),function(){return T.apply(this,arguments)})},{key:"getFloorModel",value:(C=mM(dM().mark((function t(e){var n,r,i,o,s;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this.sceneDataMap,r=this.modelCache,i=this.modelMap,o=n.get(e),!r){t.next=17;break}if(!i.has(e)){t.next=7;break}s=i.get(e),t.next=15;break;case 7:if(null==o||!o.modelPath){t.next=14;break}return t.next=10,this.modelLoad(o.modelPath);case 10:s=t.sent,i.set(e,s),t.next=15;break;case 14:return t.abrupt("return",null);case 15:t.next=20;break;case 17:return t.next=19,this.modelLoad(o.modelPath);case 19:s=t.sent;case 20:return t.abrupt("return",s);case 21:case"end":return t.stop()}}),t,this)}))),function(t){return C.apply(this,arguments)})},{key:"initFloorVR",value:(A=mM(dM().mark((function t(e,n,r,i,o,s,a){var u,c,l,h,p,f,d,v,y,x,b,_,w,M;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!i){t.next=5;break}return t.next=3,this.showChangeFloor(!0);case 3:t.next=7;break;case 5:return t.next=7,this.showLoading(!0);case 7:return u=Math.min(m.move.stayLevel,this.tileLevelMax),this.tilePanoCtl&&(u=this.tilePanoCtl.levelMax),t.next=11,this.dispose();case 11:return g.time("floor model load"),c=this.stage,l=this.view,h=this.basicCtl,p=this.panoDataMap,f=this.timeScale,this.curSceneData=this.sceneDataMap.get(e),t.next=16,this.getFloorModel(e);case 16:return(d=this.floorModel=t.sent)?c.bindElement(d):this.callBack(LM.OnError,"model load error,storeId【".concat(e,"】")),g.timeEnd("floor model load"),v=this.getPanoramaData(e),g.time("indicator panoGroup init"),t.next=23,this.getVRIntersectionsData(e);case 23:if(y=t.sent,m.defaultVisibleRadius&&(__.DefaultVisibleRadius=m.defaultVisibleRadius),x=this.panoGroup=new __(v,{modelElement:d,groundParams:{downDirection:new wM(0,0,-1)},indicatorImageURL:this.indicatorImageURL,indicatorPositionMap:y}),c.bindElement(x),g.timeEnd("indicator panoGroup init"),b=this.tilePanoCtl=new E_(l,x,h),m.tile&&m.tile.levels&&b.setLevels(m.tile.levels),c.bindController(b),b.moveOnClick=this.moveClick,b.showModel=m.model.show,b.updateLevelMax(Math.min(u,this.tileLevelMax)),(_=this.curPanoData=p.get(n))||this.callBack(LM.OnError,"get pano data error ,panoId【".concat(n,"】")),(w=r)||(w=new wM(1,0,0)).applyQuaternion(_.quaternion),g.log("initFloor lookat Dir ",w),s&&h.setFov(2*this.sceneFov/3),!o){t.next=64;break}return M=w.clone().multiplyScalar(-1),g.time("lookFromPanorama"),b.updateLevelMax(Math.min(m.move.moveLevel,this.tileLevelMax)),t.next=46,b.lookFromPanorama(n,M,!0);case 46:if(g.timeEnd("lookFromPanorama"),g.timeEnd("displayShow"),a&&a(),!i){t.next=54;break}return t.next=52,this.showChangeFloor(!1);case 52:t.next=55;break;case 54:this.showLoading(!1);case 55:if(!s){t.next=60;break}return t.next=58,this.waitAWhile(500);case 58:return t.next=60,b.moveInPath([n],{intervals:2e3*f,toDirections:M,fovs:this.sceneFov,showModel:m.model.show});case 60:b.updateLevelMax(Math.min(u,this.tileLevelMax)),b.updateLevel(),t.next=74;break;case 64:return t.next=66,b.lookFromPanorama(n,w,!0);case 66:if(a&&a(),!i){t.next=72;break}return t.next=70,this.showChangeFloor(!1);case 70:t.next=73;break;case 72:this.showLoading(!1);case 73:g.log("==============");case 74:return t.next=76,this.waitAWhile(1e3);case 76:g.log("initFloorVR",b.levelMax);case 77:case"end":return t.stop()}}),t,this)}))),function(t,e,n,r,i,o,s){return A.apply(this,arguments)})},{key:"updatePathByPathPid",value:function(t,e){var n=this.pathMap,r=this.pathImage,i=n.get(t);this.setPath(i,r,m.path.heightOffset),this.updatePathByPid(e)}},{key:"getVRDataList",value:(S=mM(dM().mark((function t(e){var n,r,i,o,s,a;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=this.sceneDataMap,r=[],e instanceof Array?r=e:r.push(e),i=0;case 4:if(!(i<r.length)){t.next=17;break}if(o=r[i],!n.has(o)){t.next=8;break}return t.abrupt("continue",14);case 8:return g.time("store request "+o),t.next=11,this.getVRData(o);case 11:s=t.sent,g.timeEnd("store request "+o),s&&(a=s.data,n.set(o,a),this.getPanoramaData(o,a.panorama_list));case 14:i++,t.next=4;break;case 17:return t.abrupt("return",n);case 18:case"end":return t.stop()}}),t,this)}))),function(t){return S.apply(this,arguments)})},{key:"getNextStepIndexByDistance",value:function(t,e){for(var n=this.moveDataSteps,r=0,i=t+1,o=n[i],s=n[t];o;){if(r+=o.distance,s.store_id!=o.store_id||r>e){s.store_id!=o.store_id&&i--;break}o=n[++i]}return i}},{key:"getSameFloorStepsByIndex",value:function(t){var e=[],n=this.moveDataSteps,r=n[t];e.push(new MM(r.pos3.x,r.pos3.y));for(var i=t+1;i<n.length;i++){var o=n[i];if(r.store_id!==o.store_id)break;r=o,e.push(new MM(r.pos3.x,r.pos3.y))}for(var s=t-1;s>0;s--){var a=n[s];if(r.store_id!==a.store_id)break;r=a,e.splice(0,0,new MM(r.pos3.x,r.pos3.y))}return e}},{key:"expendPath",value:function(t,e){var n=t.length;if(n>1){var r=t[n-2],i=t[n-1],o=i.clone().sub(r).normalize().multiplyScalar(e).add(i);t.push(o)}}},{key:"getNextStepDirectionByIndexDistance",value:function(t){var e,n=this.moveDataSteps,r=n[t],i=n[t+1],o=this.getNextStepIndexByDistance(t,m.rotate.distance+r.distance);if(o!=t+1){var s=n[o];s&&(e=s.pos3.clone().sub(i.pos3).normalize())}return e}},{key:"getTargetDistanceByIndex",value:function(t,e,n){for(var r,i=this.moveDataSteps,o=i[t],s=o.distance,a=[],u=[],c=o,l=t+1;l<i.length;l++){if(r=i[l],o.store_id!=r.store_id||0!=r.rotateTime&&!n||!(s<e)){o.store_id!=r.store_id?s-=c.distance:r.rotateTime>0&&(s+=4);break}s+=r.distance,a.push(r.distance),u.push(r.rotateTime),c=r}var h=c.pos3.clone().add(c.moveDir.clone().multiplyScalar(c.distance-(s-e)));return s>e&&(s=e),{distance:s,step:r,pos:h}}},{key:"getPathDistance",value:function(t,e){var n=this.pathLine.getNearestPoint(t,e).distance;return n<m.path.changeDistance&&(n=0),n}},{key:"updatePathByIndex",value:function(t,e,n){var r=this,i=this.pathLine,o=(this.view,this.pathLineViewDistance),s=this.moveDataSteps,a=this.pathStartPoint,u=this.pathEndArrow,c=this.getTargetDistanceByIndex(t,o,m.path.fixedViewDistance);g.log("target",c);var l=c.distance,h=s[t],p=s[t-1];p&&p.store_id!=h.store_id&&(p=null);var f=i.getCurrent(),d=p?i.getNearestPoint(p.pos3,f).distance:0,y=i.getNearestPoint(h.pos3,d).distance,x=0;if(y<m.path.changeDistance&&(x=y,y=0),e){var b=i.getViewDistance();x+=y-d,l=this.getTargetDistanceByIndex(t,o,this.fixedViewDistance).distance+x;var _=Math.min(l/2,4),w=i.uniforms.gradientDistance.value;new v.a.Tween({viewDist:b,gradDist:w,distance:d}).to({viewDist:l,gradDist:_,distance:y},n).onUpdate((function(t){var e=t.viewDist,n=t.gradDist,r=t.distance;i&&(i.setCurrent(r),i.setViewDistance(e),i.uniforms.gradientDistance.value=n)})).onComplete((function(){a&&a.position.set(h.pos3.x,h.pos3.y,a.position.z),u&&(u.rotation.set(u.rotation.x,r.getArrowAngleByDir(c.step.moveDir),0),u.position.set(c.pos.x,c.pos.y,u.position.z),g.log("pathEndArrow",u,u.rotation,u.position))})).start()}else{var M=Math.min(l/2,4);if(l+=x,this.fixedViewDistance&&(l=o),i.setCurrent(y),i.setViewDistance(l),i.uniforms.gradientDistance.value=M,a&&a.position.set(h.pos3.x,h.pos3.y,a.position.z),u){for(var E=0,S=c.pos,A=c.step.moveDir,C=t;C<c.step.index;C++){var T=s[C];if(T.rotateTime>0&&++E>=2){S=T.pos3,A=T.moveDir;break}}u.rotation.set(u.rotation.x,this.getArrowAngleByDir(A),0);var P=new MM(A.x,A.y).normalize();P.rotateAround(new MM(0,0),Math.PI/2),P.multiplyScalar(1.5*this.pathWidth),u.position.set(S.x+P.x,S.y+P.y,u.position.z)}}}},{key:"moveStep",value:(E=mM(dM().mark((function t(e){var n,r,i,o,s,a,u,c,l,h,p,f,d,v,y,x,b,_,w,M,E,S,A,C=this,T=arguments;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=!(T.length>1&&void 0!==T[1])||T[1],r=this.moveDataSteps,i=this.tilePanoCtl,o=this.curStepIndex,s=this.timeScale,a=this.pathImage,g.log("moveStep",e,n),c=(u=r)[e],l=n?c:u[e+1],h=n?u[e+1]:u[e+2],n?u[e-1]:u[e],p=u[o],f=!0,d=!1,v=!1,!l){t.next=48;break}if(y=!0,p.store_id!=l.store_id&&(d=!0),x=null,b=c.rotateTime,_=c.moveDir,l.single&&(x=l.dir),w=l.moveDir,h&&l.store_id!=h.store_id&&(v=!0),!i){t.next=48;break}if(M=1e3*c.duration,p.pano_id==l.pano_id&&(y=!1,b||(f=!1)),!d){t.next=32;break}return g.log("换层",l.store_id),t.next=28,this.initFloorVR(l.store_id,l.pano_id,x||w,!0,!1,!1,(function(){if(!l.single){var t=C.getSameFloorStepsByIndex(e+1);C.expendPath(t,m.path.expendLength),C.setPath(t,a,m.path.heightOffset),C.updatePathByIndex(e)}}));case 28:M=0,this.callBack(LM.OnSwitch,l.floor),t.next=42;break;case 32:if(M<2e3&&(M=2e3),E=M>b?M:b,S=M-(1e3+.3*b),S*=s,E*=s,A=this.pathLine,this.view,A&&y&&this.updatePathByIndex(e,!0,E),!f){t.next=42;break}return t.next=42,i.moveInPath([l.pano_id],{intervals:E,toDirections:x||(!b||v?_:w),fovs:this.sceneFov,rotateDelays:S,showModel:m.model.show});case 42:h||this.pathLine.setViewDistance(0),this.updateTitle(l.show_text),this.curStepIndex=n?e:e+1,this.callBack(LM.OnStep,this.curStepIndex),this.curPid=l.pano_id,this.curPanoData=l;case 48:case"end":return t.stop()}}),t,this)}))),function(t){return E.apply(this,arguments)})},{key:"moveIndex",value:(M=mM(dM().mark((function t(e,n){return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.moveReady){t.next=2;break}return t.abrupt("return");case 2:if(null==n&&(n=m.move.auto),!this.stepMoving){t.next=7;break}this.targetStepIndex=e,t.next=16;break;case 7:if(this.callBack(LM.OnMoveStart),!n){t.next=13;break}return t.next=11,this.autoMoveStep(e);case 11:t.next=15;break;case 13:return t.next=15,this.moveOneStep(e);case 15:this.callBack(LM.OnMoveEnd);case 16:case"end":return t.stop()}}),t,this)}))),function(t,e){return M.apply(this,arguments)})},{key:"formatMoveSteps",value:function(t){for(var e,n,r=t.data.steps,i=r.length-2;i>=0;i--)""==r[i].pano_id||""!=r[i+1].pano_id&&"0"!=r[i+1].pano_id?""==r[i+1].pano_id||""!=r[i].pano_id&&"0"!=r[i].pano_id||(r[i].pano_id=r[i+1].pano_id):r[i+1].pano_id=r[i].pano_id;for(var o,s="",a=0,u=0;u<r.length;u++){var c=r[u],l=c.model_id,h=c.x,p=c.y;c.distance=0,c.index=u,c.pano_id=Number(c.pano_id),c.store_id=c.model_id,c.pos3=this.trans2T3Vector(l,h,p,.1),c.pos3||this.callBack(LM.OnError,"step commpute pos3 error step.pano_id ".concat(c.pano_id,", step.index ").concat(u)),c.rotateTime=0;var f=this.panoDataMap.get(c.pano_id);if(f){var d=f.quaternion;c.dir=new wM(1,0,0).applyQuaternion(d)}else c.dir=new wM(1,0,0),this.callBack(LM.OnError,"cont't find panoData by id, ".concat(c.pano_id,", index, ").concat(u)),g.error("cont't find panoData by id = ",c.pano_id,"index = ",u);e&&(e.moveDir=c.pos3.clone().sub(e.pos3).normalize(),e.distance=e.pos3.distanceTo(c.pos3),e.duration=e.distance/m.move.speed,c.moveDir=e.moveDir.clone(),c.store_id!=s&&(0===a?e.single=!0:e.moveDir=n.moveDir.clone())),n=e,e=c,s!=c.store_id?(s=c.store_id,a=0):a++}0===a&&(r[r.length-1].single=!0);for(var v=1;v<r.length;v++){var y=r[v-1],x=r[v];if(x.store_id==y.store_id){var b=c_.getAngleByVector(y.moveDir,x.moveDir);b>20&&(x.rotateTime=b/m.rotate.scale*1e3)}!o||o.pano_id!=y.pano_id||y.rotateTime?o=y:o.sameNext=v}this.moveDataSteps=r}},{key:"stopMove",value:(w=mM(dM().mark((function t(){var e=this;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){e.isMoving()?e.stepStopResolve=t:t()})));case 1:case"end":return t.stop()}}),t)}))),function(){return w.apply(this,arguments)})},{key:"isMoving",value:function(){return this.stepMoving||this.stepJumping||this.initFlooring||this.panoramaMoving}},{key:"waitStopMove",value:(_=mM(dM().mark((function t(){return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.stopMove();case 2:this.targetIndex=-1,this.stepMoving=!1,this.stepJumping=!1,this.stepStopResolve=null,this.panoramaMoving=!1,this.updateTitle(""),this.tilePanoCtl&&(this.tilePanoCtl.updateLevelMax(Math.min(m.move.stayLevel,this.tileLevelMax)),this.tilePanoCtl.updateLevel());case 9:case"end":return t.stop()}}),t,this)}))),function(){return _.apply(this,arguments)})},{key:"setMoveSteps",value:(b=mM(dM().mark((function t(e,n){var r,i,o,s,a,u,c,l,h=this;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return g.time("displayShow"),t.next=3,this.waitStopMove();case 3:if(this.moveReady=!1,g.log("----------setMoveData--------------"),g.time("setMoveData time"),g.time("json pase"),"string"==typeof e&&(e=JSON.parse(e)),g.timeEnd("json pase"),g.time("store request"),this.stepMoving=!1,!(r=e.data.coordinate_3d_params)){t.next=17;break}return r.forEach((function(t){h.coordinateMap.set(t.model_id,t)})),i=r.map((function(t){return t.model_id})),t.next=17,this.getVRDataList(i);case 17:if(g.timeEnd("store request"),g.time("formatMoveSteps"),this.formatMoveSteps(e),g.timeEnd("formatMoveSteps"),o=this.moveDataSteps,s=this.curSceneData,a=this.pathImage,o.length){t.next=25;break}return g.error("empty move steps"),t.abrupt("return");case 25:if(u=this.curStepIndex=0,g.timeEnd("setMoveData time"),g.time("setMoveData time2"),c=o[u],l=function(){var t=h.getSameFloorStepsByIndex(u);g.log(t),h.expendPath(t,m.path.expendLength),h.setPath(t,a,m.path.heightOffset),h.updatePathByIndex(u,m.path.initLineDistance)},s&&s.store_id==c.model_id){t.next=39;break}return this.initFlooring=!0,this.curPid=c.pano_id,t.next=36,this.initFloorVR(c.model_id,c.pano_id,c.moveDir,!1,n,m.move.beginFovAnimation,l);case 36:this.initFlooring=!1,t.next=40;break;case 39:l();case 40:g.timeEnd("setMoveData time2"),this.moveReady=!0,this.callBack(LM.OnMoveReady);case 43:case"end":return t.stop()}}),t,this)}))),function(t,e){return b.apply(this,arguments)})},{key:"moveEndIndex",value:(x=mM(dM().mark((function t(){var e;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.moveDataSteps.length-1,t.next=3,this.moveIndex(e);case 3:case"end":return t.stop()}}),t,this)}))),function(){return x.apply(this,arguments)})},{key:"moveToFirstShowTextStep",value:(y=mM(dM().mark((function t(){var e,n;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=this.moveDataSteps,n=0;case 2:if(!(n<e.length)){t.next=9;break}if(!e[n].show_text){t.next=6;break}return t.abrupt("break",9);case 6:n++,t.next=2;break;case 9:return t.next=11,this.moveIndex(n);case 11:case"end":return t.stop()}}),t,this)}))),function(){return y.apply(this,arguments)})},{key:"showFirstShowText",value:(f=mM(dM().mark((function t(e){var n,r,i;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e){t.next=4;break}this.updateTitle(e),t.next=14;break;case 4:n=this.moveDataSteps,r=0;case 6:if(!(r<n.length)){t.next=14;break}if(!(i=n[r]).show_text){t.next=11;break}return this.updateTitle(i.show_text),t.abrupt("break",14);case 11:r++,t.next=6;break;case 14:case"end":return t.stop()}}),t,this)}))),function(t){return f.apply(this,arguments)})},{key:"moveOneStep",value:(p=mM(dM().mark((function t(e){var n,r;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.stepMoving=!0,t.next=3,this.moveStep(e);case 3:if(!(this.targetStepIndex>-1)){t.next=17;break}if(n=this.targetStepIndex,this.targetStepIndex=-1,n!=e){t.next=8;break}return t.abrupt("return");case 8:if(!(r=e===n-1)){t.next=12;break}return t.next=12,this.showChangeFloor(!0);case 12:return t.next=14,this.moveStep(n);case 14:if(!r){t.next=17;break}return t.next=17,this.showChangeFloor(!1);case 17:this.stepMoving=!1;case 18:case"end":return t.stop()}}),t,this)}))),function(t){return p.apply(this,arguments)})},{key:"autoMoveStep",value:(h=mM(dM().mark((function t(e){var n,r,i;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.stepJumping){t.next=3;break}return t.next=3,this.waitStopMove();case 3:if(this.tilePanoCtl.updateLevelMax(Math.min(m.move.moveLevel,this.tileLevelMax)),!(e<this.curStepIndex)){t.next=12;break}return t.next=7,this.autoJump(e);case 7:return this.tilePanoCtl.updateLevelMax(Math.min(m.move.stayLevel,this.tileLevelMax)),this.tilePanoCtl.updateLevel(),this.callBack(LM.OnMoveEnd),this.stepMoving=!1,t.abrupt("return");case 12:if(!this.stepStopResolve){t.next=16;break}return this.stepStopResolve(),g.log("autoMoveStep=========stepStopResolve"),t.abrupt("return");case 16:this.stepMoving=!0,n=e,r=this.curStepIndex;case 19:if(!(r<=n)){t.next=30;break}if(r==n-1&&this.tilePanoCtl.updateLevelMax(Math.min(m.move.stayLevel,this.tileLevelMax)),!this.stepStopResolve){t.next=23;break}return t.abrupt("break",30);case 23:return t.next=25,this.moveStep(r);case 25:if(!(this.targetStepIndex>-1)){t.next=27;break}return t.abrupt("break",30);case 27:r++,t.next=19;break;case 30:if(!this.stepStopResolve){t.next=33;break}return this.stepStopResolve(),t.abrupt("return");case 33:if(!(this.targetStepIndex>-1)){t.next=43;break}if(i=this.targetStepIndex,this.targetStepIndex=-1,i===this.curStepIndex+1){t.next=39;break}return t.next=39,this.autoJump(i);case 39:return t.next=41,this.autoMoveStep(i);case 41:t.next=46;break;case 43:this.tilePanoCtl.updateLevelMax(Math.min(m.move.stayLevel,this.tileLevelMax)),this.tilePanoCtl.updateLevel(),this.stepMoving=!1;case 46:case"end":return t.stop()}}),t,this)}))),function(t){return h.apply(this,arguments)})},{key:"autoJump",value:(l=mM(dM().mark((function t(e){var n,r,i,o,s,a;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.stepJumping=!0,n=this.moveDataSteps,r=this.curStepIndex,!m.move.jump){t.next=38;break}if(i=n[r],o=n[e],s=0,!(e>r)||m.move.jumpTo){t.next=30;break}a=r+1;case 8:if(!(a<e)){t.next=28;break}if(!this.stepStopResolve){t.next=11;break}return t.abrupt("break",28);case 11:if(i=n[a],!n[a+1]){t.next=23;break}if(!(i.store_id!==o.store_id||i.rotateTime||s+i.distance>=m.move.jumpDistance)){t.next=20;break}return t.next=17,this.moveStep(a);case 17:s=0,t.next=23;break;case 20:g.error("jump step",a),s+=i.distance,g.log(s);case 23:if(-1==this.targetStepIndex){t.next=25;break}return t.abrupt("break",28);case 25:a++,t.next=8;break;case 28:t.next=36;break;case 30:return t.next=32,this.showChangeFloor(!0);case 32:return t.next=34,this.moveStep(e,!0);case 34:return t.next=36,this.showChangeFloor(!1);case 36:t.next=40;break;case 38:return t.next=40,this.moveStep(e);case 40:this.stepJumping=!1;case 41:case"end":return t.stop()}}),t,this)}))),function(t){return l.apply(this,arguments)})},{key:"destroyPlugins",value:function(){this.plugins.forEach((function(t){return t.dispose()})),this.plugins.clear()}},{key:"destroy",value:(c=mM(dM().mark((function t(e){var n;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,this.rf&&window.cancelAnimationFrame(this.rf),v.a.removeAll(),kd.hub.eventMap.clear(),t.next=6,this.dispose(!0);case 6:this.disposeEvent(),this.updateTitle(""),this.destroyPlugins(),this.stage.disposeView(this.view),this.screen.dispose(),this.callBack(LM.OnDestroy),e&&this.cleanCb(),this.stepJumping=!1,this.stepMoving=!1,this.stage.dispose(),(n=this.container.getElementsByTagName("canvas")).length&&Array.from(n).forEach((function(t){t.remove()})),this.unRegistryContainerEvent(),this.stage=null,this.container=null,t.next=26;break;case 23:t.prev=23,t.t0=t.catch(0),console.log("destroy error",t.t0);case 26:case"end":return t.stop()}}),t,this,[[0,23]])}))),function(t){return c.apply(this,arguments)})},{key:"getPosByPID",value:function(t){var e=this.panoDataMap;return e.has(t)?e.get(t).position:null}},{key:"deleteRepeate",value:function(t){return Array.from(new Set(t))}},{key:"formatMovePanormas",value:function(t,e){var n=this,r=this.pathMap,i=this.panoDataMap,o=this.store2MovePanosMap,s=this.pano2IdnexMap,a=this.pathDataMap;o.clear(),r.clear(),s.clear(),a.clear();var u=0;t.forEach((function(t,c){var l=t.path,h=(t.store_id,t.pano_ids),p=l.map((function(t){return new wM(t.x,e?-t.y:t.y,0)})),f=n.deleteRepeate(h);t.pano_ids=f;var d=f.map((function(t,e){var r=i.get(t);return r||n.callBack(LM.OnError,"get pano data error, pano_id ".concat(t)),s.set(t,{tIndex:u,index:e}),u++,r.pathIndex=c,r}));if(1===p.length&&d[0]){var g=d[0].quaternion,v=new wM(1,0,0);v.applyQuaternion(g),v.multiplyScalar(.1),p.push(p[0].clone().add(v))}o.set(c,d),r.set(c,p);var y,x=0,b=[];if(h.length)for(var _=0;_<p.length;_++){var w={},M=p[_];w.pos=M.clone();var E=p[_+1],S=d[x],A=d[x+1],C=null;if(S.pds&&A&&A.position.distanceTo(M)<S.position.distanceTo(M)?(C=A,x++):C=S,E)w.moveDir=new wM(E.x-M.x,E.y-M.y,0),w.distance=w.moveDir.length(),w.moveDir.normalize(),w.duration=w.distance/m.move.speed;else{var T=b[_-1];T&&(w.moveDir=T.moveDir.clone(),w.distance=0,w.duration=0)}w.index=_,C.pds||(C.pds=[]),C.pds.push(w),b.push(w)}a.set(c,b);for(var P=0;P<b.length;P++){var I=b[P],L=b[P+1];if(I.rotateTime=0,L){var R=c_.getAngleByVector(I.moveDir,L.moveDir);R>20&&(I.rotateTime=R/m.rotate.scale*1e3)}}d.forEach((function(t){var n=t.pds;t.rotate=!1,t.ny=e,n||(n=t.pds=[]).push({distance:0,moveDir:y.moveDir.clone(),pos:y.pos.clone(),duration:0,index:y.index}),n.forEach((function(e){e.rotateTime&&(t.rotate=!0),y=e}))}))})),this.moveDataPanoramas=t}},{key:"getPanoSelfDirByPid",value:function(t){var e=this.panoDataMap.get(t).quaternion,n=new wM(1,0,0);return n.applyQuaternion(e),n}},{key:"getCurPanoSelfDir",value:function(){var t=this.tilePanoCtl.curPanorama,e=t.children[3].matrixWorld,n=new EM,r=new wM,i=new wM;return e.decompose(r,n,i),{euler:(new $r).setFromQuaternion(n),euler2:(new $r).setFromQuaternion(t.quaternion.clone().multiply((new EM).setFromEuler(new $r(Math.PI/2,0,0))))}}},{key:"getEulerByquaternion",value:function(t){var e=t.direction_w,n=t.direction_x,r=t.direction_y,i=t.direction_z,o=new EM(n,r,i,e);return o.multiply((new EM).setFromEuler(new $r(Math.PI/2,0,0))),(new $r).setFromQuaternion(o)}},{key:"getDirByQue2",value:function(t){var e=t._w,n=t._x,r=t._y,i=t._z,o=new EM(n,r,i,e),s=(new $r).setFromQuaternion(o),a=new di;a.quaternion.copy(o);var u=(new SM).makeRotationFromEuler(new $r(Math.PI/2,0,0));return a.matrix.multiply(u),{euler:a.rotation,dir:s}}},{key:"getPanoByVector",value:function(t,e){if(!e.length)return null;for(var n=e[0],r=t.distanceTo(n.position),i=1;i<e.length;i++){var o=e[i],s=t.distanceTo(o.position);s<r&&(n=o,r=s)}return n}},{key:"getPositionByPId",value:function(t){var e=this.panoDataMap.get(t);if(e)return e.position}},{key:"setMovePanoramas",value:(u=mM(dM().mark((function t(e){var n,r,i,o,s,a,u,c,l,h,p,f,d,g,v,y,x,b,_=arguments;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=_.length>1&&void 0!==_[1]&&_[1],r=_.length>2?_[2]:void 0,i=_.length>3?_[3]:void 0,t.next=5,this.waitStopMove();case 5:return"string"==typeof e&&(e=JSON.parse(e)),o=[],e.forEach((function(t){o.push(t.store_id)})),t.next=10,this.getVRDataList(o);case 10:return this.formatMovePanormas(e,n),this.curStoreIndex=0,s=this.moveDataPanoramas,a=this.store2MovePanosMap,u=this.pathMap,c=this.pathImage,l=this.panoDataMap,h=s[this.curStoreIndex],p=h.store_id,f=a.get(this.curStoreIndex),d=f[0],g=d.pid,v=d.pds,this.curPid=g,this.curPanoData=d,y=v[v.length-1].moveDir.clone(),i&&(i.addDir&&y.add(new wM(i.addDir.x,i.addDir.y,i.addDir.z)),i.dir&&(y=new wM(i.dir.x,i.dir.y,i.dir.z)),i.target&&(x=l.get(g),y=new wM(i.target.x,i.target.y,i.target.z).sub(x.position).normalize())),t.next=24,this.initFloorVR(p,g,y,r);case 24:b=u.get(this.curStoreIndex),this.setPath(b,c,m.path.heightOffset),this.updatePathByPid(g);case 27:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"jumpToPanorama",value:(a=mM(dM().mark((function t(e,n){var r,i,o,s,a,u,c,l,h,p,f,d;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.curPid,i=this.panoDataMap,o=this.pano2IdnexMap,s=this.store2MovePanosMap,a=this.stepJumpMax,u=i.get(r),c=i.get(e),l=o.get(r).index,h=o.get(e).index,p=s.get(c.pathIndex),!n){t.next=11;break}if(!(--h<0)){t.next=10;break}return t.abrupt("return");case 10:e=p[h].pid;case 11:if(!m.move.jump){t.next=46;break}if(!(u.storeId!==c.storeId||a&&h-l>a)){t.next=21;break}return t.next=15,this.showChangeFloor(!0);case 15:return t.next=17,this.movePanoramaStep(e);case 17:return t.next=19,this.showChangeFloor(!1);case 19:t.next=46;break;case 21:if(!(l>h)){t.next=32;break}if(!this.moveToBackShowImage){t.next=25;break}return t.next=25,this.showChangeFloor(!0);case 25:return t.next=27,this.movePanoramaStep(e);case 27:if(!this.moveToBackShowImage){t.next=30;break}return t.next=30,this.showChangeFloor(!1);case 30:t.next=46;break;case 32:f=l+1;case 33:if(!(f<=h)){t.next=46;break}if(-1==this.targetPid){t.next=36;break}return t.abrupt("break",46);case 36:if(u=p[f],d=p[f+1],!(u.rotate||d&&d.rotate)){t.next=41;break}return t.next=41,this.movePanoramaStep(u.pid);case 41:if(!this.stepStopResolve){t.next=43;break}return t.abrupt("break",46);case 43:f++,t.next=33;break;case 46:case"end":return t.stop()}}),t,this)}))),function(t,e){return a.apply(this,arguments)})},{key:"setMoveClick",value:function(t){if(this.moveClick!==t){this.moveClick=t;var e=this.tilePanoCtl;e&&(e.moveOnClick=t)}}},{key:"jumpToPanoramaWithoutPath",value:(s=mM(dM().mark((function t(e,n,r){var i,o,s,a,u;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getVRDataList(e);case 2:if(i=this.panoDataMap.get(this.curPid),o=this.panoDataMap.get(n),i||this.callBack(LM.OnError),a=(s=r||{}).dir,u=s.target,a?a=new pr(a.x,a.y,a.z):u&&(a=new pr(u.x,u.y,u.z).sub(u.data.position)),i&&o.storeId===i.storeId){t.next=12;break}return t.next=10,this.initFloorVR(e,n,a,!!i);case 10:t.next=18;break;case 12:return t.next=14,this.showChangeFloor(!0);case 14:return t.next=16,this.moveToPanoramWithoutPath(n,r);case 16:return t.next=18,this.showChangeFloor(!1);case 18:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return s.apply(this,arguments)})},{key:"jumpToPanoramaWithCustomerData",value:(o=mM(dM().mark((function t(e,n,r){var i,o,s,a,u,c;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e&&(this.sceneDataMap.set("customer",e),i=e.data,this.getPanoramaData("customer",i.panorama_list)),o=this.panoDataMap.get(this.curPid),s=this.panoDataMap.get(n),o||this.callBack(LM.OnError),u=(a=r||{}).dir,c=a.target,u?u=new pr(u.x,u.y,u.z):c&&(u=new pr(c.x,c.y,c.z).sub(c.data.position)),o&&s.storeId===o.storeId){t.next=11;break}return t.next=9,this.initFloorVR("customer",n,u,!!o);case 9:t.next=17;break;case 11:return t.next=13,this.showChangeFloor(!0);case 13:return t.next=15,this.moveToPanoramWithoutPath(n,r);case 15:return t.next=17,this.showChangeFloor(!1);case 17:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return o.apply(this,arguments)})},{key:"getTargetDistanceByPid",value:function(t,e){for(var n,r=this.panoDataMap,i=this.store2MovePanosMap,o=this.pano2IdnexMap,s=r.get(t),a=o.get(t).index,u=i.get(s.pathIndex),c=!1,l=0,h=a;h<u.length;h++){for(var p=u[h].pds,f=0;f<p.length;f++){var d=p[f];if(l+d.distance>e)break;if(d.rotateTime){c=!0;break}l+=d.distance}if(c)break}c&&(l+=null!==(n=m.path.rotateCount)&&void 0!==n?n:1);return l>=e&&(l=e),Math.max(m.path.minViewDistance,l)}},{key:"getMergeMoveDir",value:function(t){for(var e=t[0].moveDir.clone(),n=1;n<t.length;n++)e.add(t[n].moveDir);return e.normalize(),e}},{key:"getClosestPd",value:function(t,e,n){var r=e[0];if(n)return e[e.length-1];for(var i=t.distanceTo(r.pos),o=1;o<e.length;o++){var s=e[o],a=t.distanceTo(s.pos);a<i&&(i=a,r=s,o)}return r}},{key:"movePanoramaStep",value:(i=mM(dM().mark((function t(e,n,r){var i,o,s,a,u,c,l,h,p,f,d,y,x,b,_,w,M,E,S,A,C,T,P,I,L,R,O,D,B,F,N,k;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(g.log("movePanoramaStep",e,n),i=this.panoDataMap,o=this.curPid,s=this.pathMap,a=this.tilePanoCtl,u=this.timeScale,c=this.pathImage,l=i.get(e)){t.next=6;break}return g.error("pid not exist"),t.abrupt("return");case 6:if(p=(h=r=r||{}).dir,f=h.addDir,d=h.target,y=h.fov,x=h.lookEnd,b=i.get(o),_=l.storeId,w=l.pathIndex,M=l.pds,E=n?new wM(n.x,l.ny?-n.y:n.y,0):l.position,l.position&&g.log("distance",E.distanceTo(l.position),l.position),S=this.getClosestPd(E,M,x),A=S.rotateTime,C=S.moveDir,p?C=new wM(p.x,p.y,p.z).normalize():f&&(C=C.clone().add(new wM(f.x,f.y,f.z)).normalize()),d&&(C=new wM(d.x,d.y,d.z).sub(l.position).normalize()),g.log("moveDir",C),T=!1,b.storeId!=_&&(T=!0),P=!1,o!==e&&(P=!0),L=(I=2e3)-(1e3+.3*A),L*=u,I*=u,!T){t.next=36;break}return t.next=30,this.initFloorVR(_,e,C,!0);case 30:R=s.get(w),this.setPath(R,c,m.path.heightOffset),this.updatePathByPid(e),this.callBack(LM.OnSwitch,_),t.next=38;break;case 36:O=this.pathLine,D=this.view,P&&(B=O.getViewDistance(),F=this.getTargetDistanceByPid(e,this.pathLineViewDistance),N=Math.min(F/2,4),k=O.uniforms.gradientDistance.value,new v.a.Tween({viewDist:B,gradDist:k}).to({viewDist:F,gradDist:N},I).onUpdate((function(t){var e=t.viewDist,n=t.gradDist;if(O){var r=O.getNearestPoint(D.camera.position).distance;O.setCurrent(r),O.setViewDistance(e),O.uniforms.gradientDistance.value=n}})).start());case 38:return t.next=40,a.moveInPath([e],{intervals:I,toDirections:C,fovs:null==y?this.sceneFov:y,rotateDelays:L,showModel:m.model.show});case 40:this.curPid=e;case 41:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return i.apply(this,arguments)})},{key:"moveToPanorama",value:(r=mM(dM().mark((function t(e,n,r){var i,o,s,a,u;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=this.panoramaMoving,o=this.curPid,i){t.next=29;break}if(this.panoramaMoving=!0,e==o){t.next=10;break}return t.next=6,this.jumpToPanorama(e,!0);case 6:if(!this.stepStopResolve){t.next=8;break}return t.abrupt("return",this.stepStopResolve());case 8:t.next=15;break;case 10:if(!m.move.jumpSame){t.next=15;break}if(this.panoramaMoving=!1,!this.stepStopResolve){t.next=14;break}return t.abrupt("return",this.stepStopResolve());case 14:return t.abrupt("return");case 15:return t.next=17,this.movePanoramaStep(e,n,r);case 17:if(this.panoramaMoving=!1,s=this.targetPid,a=this.targetPos,u=this.targetLookParam,-1!=s&&(this.targetPid=-1,this.targetDir=null),!this.stepStopResolve){t.next=24;break}return t.abrupt("return",this.stepStopResolve());case 24:if(-1==s){t.next=27;break}return t.next=27,this.moveToPanorama(s,a,u);case 27:t.next=32;break;case 29:this.targetPid=e,this.targetPos=n,this.targetLookParam=r;case 32:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return r.apply(this,arguments)})},{key:"moveToPanoramWithoutPath",value:(n=mM(dM().mark((function t(e,n){var r,i,o,s,a,u,c;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=(r=n||{}).dir,o=r.target,s=r.fov,a=r.time,u={},i&&(u.toDirections=new wM(i.x,i.y,i.z)),o&&(u.lookAtTargets=new wM(o.x,o.y,o.z)),s&&(u.fovs=s),u.intervals=a||1e3,(c=this.pano2IdnexMap.get(this.curPid))&&this.pano2IdnexMap.set(e,{index:c.index}),t.next=10,this.tilePanoCtl.moveInPath([e],u);case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return n.apply(this,arguments)})},{key:"getPidByIndex",value:function(t){for(var e=this.moveDataPanoramas,n=0,r=-1,i=0;i<e.length;i++){var o=e[i];if(t<n+o.pano_ids.length){r=o.pano_ids[t-n];break}n+=o.pano_ids.length}return r}},{key:"moveToPanoramaByIndex",value:(e=mM(dM().mark((function t(e){var n;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!((n=this.getPidByIndex(e))>-1)){t.next=4;break}return t.next=4,this.moveToPanorama(n);case 4:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"onPanoramaCameraChanged",value:function(t,e){try{var n=this.moveDataSteps,r=this.curStepIndex,i=new EM(e.x,e.y,e.z,e.w),o=new wM(1,0,0).applyQuaternion(i),s={type:"CameraChanged",position:t,quaternion:e,dir:o},a=new wM(o.x,o.y,0).normalize(),u=new MM(1,0,0),c=c_.getAngleByVector2(a,u);n&&r&&n[r]&&(s.floor=n[r].floor,s.data=e),s=JSON.stringify(s),this.lastOnRollStr!=s&&(this.callBack(LM.OnRoll,s,c),this.lastOnRollStr=s)}catch(t){}}},{key:"onSelected",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];this.callBack.apply(this,[LM.OnSelected].concat(e))}},{key:"initEvent",value:function(){var t=this;this.handleElementLoaded=function(e,n){t.waitModel===e&&t.floorModelResolve&&(t.floorModelResolve(e,n),t.floorModelResolve=null,t.waitModel=null)},kd.on(Ud.ELEMENT_LOADED,this.handleElementLoaded),kd.on(Ud.ELEMENT_LOADED_ERROR,this.handleElementLoaded),this.handleSelected=function(){t.onSelected.apply(t,arguments)},kd.on(Ud.ELEMENT_SELECTED,this.handleSelected),this.handleOnPanoramaCameraChanged=function(){t.onPanoramaCameraChanged.apply(t,arguments)},kd.on(Ud.CAMERA_CHANGED,this.handleOnPanoramaCameraChanged),this.handleMoveToPano=function(e){g.log("handleMoveToPano",e),t.curPid=e,t.callBack(LM.OnPanorama,e);var n=t.panoDataMap.get(e),r=t.gisAlignMap.get(n.storeId);if(r){var i=r.get(e);i&&t.callBack(LM.OnGisPos,i.gis)}},kd.on(Ud.MOVE_TO_PANORAMA,this.handleMoveToPano)}},{key:"disposeEvent",value:function(){kd.off(Ud.ELEMENT_LOADED,this.handleElementLoaded),kd.off(Ud.ELEMENT_SELECTED,this.handleSelected),kd.off(Ud.CAMERA_CHANGED,this.handleOnPanoramaCameraChanged),kd.off(Ud.MOVE_TO_PANORAMA,this.handleMoveToPano)}},{key:"setTouchesEnabled",value:function(t){this.basicCtl&&this.basicCtl.setTouchesEnabled(t),this.tilePanoCtl&&this.tilePanoCtl.setTouchesEnabled(t)}},{key:"onWindowResize",value:function(t,e){this.stage&&this.stage.onWindowResize(t,e)}},{key:"getNowDirection",value:function(){if(this.basicCtl)return this.basicCtl.target.clone().sub(this.basicCtl.camera.position).normalize()}}],[{key:"SmoothPath",value:function(t){var e=[];t.forEach((function(t){e.push([t.x,t.y,0])}));var n,r=[];if(e.forEach((function(t){r.push({x:t[0],y:t[1]})})),m.path.simplify){var i=m.path.maxTurningDegree||170,o=Kx.simplify(r,!1,!0,5,i);n=Kx.smoothPath(o.map((function(t){return[t.x,t.y]})))}else n=Kx.smoothPath(r.map((function(t){return[t.x,t.y]})));var s=[];return n.forEach((function(t){s.push([t[0],t[1],0])})),s}}]);var e,n,r,i,o,s,a,u,c,l,h,p,f,y,x,b,_,w,M,E,S,A,C,T,P,I,L,R,O,D,B,F,N,k}()},JBy8:function(t,e,n){"use strict";var r=n("yoRg"),i=n("eDl+").concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},JEQr:function(t,e,n){"use strict";(function(e){var r=n("xTJ+"),i=n("yK9s"),o={"Content-Type":"application/x-www-form-urlencoded"};function s(t,e){!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var a,u={adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==e&&"[object process]"===Object.prototype.toString.call(e))&&(a=n("tQ2B")),a),transformRequest:[function(t,e){return i(e,"Accept"),i(e,"Content-Type"),r.isFormData(t)||r.isArrayBuffer(t)||r.isBuffer(t)||r.isStream(t)||r.isFile(t)||r.isBlob(t)?t:r.isArrayBufferView(t)?t.buffer:r.isURLSearchParams(t)?(s(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):r.isObject(t)?(s(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return t>=200&&t<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],(function(t){u.headers[t]={}})),r.forEach(["post","put","patch"],(function(t){u.headers[t]=r.merge(o)})),t.exports=u}).call(this,n("8oxB"))},JRS9:function(t,e,n){"use strict";var r=n("uPr3"),i=Array.prototype.concat,o=Array.prototype.slice,s=t.exports=function(t){for(var e=[],n=0,s=t.length;n<s;n++){var a=t[n];r(a)?e=i.call(e,o.call(a)):e.push(a)}return e};s.wrap=function(t){return function(){return t(s(arguments))}}},JTJg:function(t,e,n){"use strict";var r=n("I+eb"),i=n("4zBA"),o=n("WjRb"),s=n("HYAF"),a=n("V37c"),u=n("qxPZ"),c=i("".indexOf);r({target:"String",proto:!0,forced:!u("includes")},{includes:function(t){return!!~c(a(s(this)),a(o(t)),arguments.length>1?arguments[1]:void 0)}})},JaFt:function(t,e,n){"use strict";var r=n("67WC"),i=n("1Y/n").right,o=r.aTypedArray;(0,r.exportTypedArrayMethod)("reduceRight",(function(t){var e=arguments.length;return i(o(this),t,e,e>1?arguments[1]:void 0)}))},JfAA:function(t,e,n){"use strict";var r=n("Xnc8").PROPER,i=n("yy0I"),o=n("glrk"),s=n("V37c"),a=n("0Dky"),u=n("kNi0"),c=RegExp.prototype,l=c.toString,h=a((function(){return"/a/b"!==l.call({source:"a",flags:"b"})})),p=r&&"toString"!==l.name;(h||p)&&i(c,"toString",(function(){var t=o(this);return"/"+s(t.source)+"/"+s(u(t))}),{unsafe:!0})},JiZb:function(t,e,n){"use strict";var r=n("0GbY"),i=n("7dAM"),o=n("tiKp"),s=n("g6v/"),a=o("species");t.exports=function(t){var e=r(t);s&&e&&!e[a]&&i(e,a,{configurable:!0,get:function(){return this}})}},JsjR:function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("8LQ0"),a=n("/OYL"),u=n("RUZL"),c=n("13ei"),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype._sceneFunc=function(t){var e,n,r,i=this.sides(),o=this.radius();for(t.beginPath(),t.moveTo(0,0-o),e=1;e<i;e++)n=o*Math.sin(2*e*Math.PI/i),r=-1*o*Math.cos(2*e*Math.PI/i),t.lineTo(n,r);t.closePath(),t.fillStrokeShape(this)},e.prototype.getWidth=function(){return 2*this.radius()},e.prototype.getHeight=function(){return 2*this.radius()},e.prototype.setWidth=function(t){this.radius(t/2)},e.prototype.setHeight=function(t){this.radius(t/2)},e}(a.Shape);e.RegularPolygon=l,l.prototype.className="RegularPolygon",l.prototype._centroid=!0,l.prototype._attrsAffectingSize=["radius"],c._registerNode(l),s.Factory.addGetterSetter(l,"radius",0,u.getNumberValidator()),s.Factory.addGetterSetter(l,"sides",0,u.getNumberValidator()),o.Collection.mapMethods(l)},K6Rb:function(t,e,n){"use strict";var r=n("QNWe"),i=Function.prototype,o=i.apply,s=i.call;t.exports="object"==typeof Reflect&&Reflect.apply||(r?s.bind(o):function(){return s.apply(o,arguments)})},KVSy:function(t,e,n){"use strict";var r=n("67WC"),i=n("0Dky"),o=n("82ph"),s=r.aTypedArray,a=r.getTypedArrayConstructor;(0,r.exportTypedArrayMethod)("slice",(function(t,e){for(var n=o(s(this),t,e),r=a(this),i=0,u=n.length,c=new r(u);u>i;)c[i]=n[i++];return c}),i((function(){new Int8Array(1).slice()})))},"KgF/":function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("8LQ0"),a=n("/OYL"),u=n("jBiz"),c=n("VBTO"),l=n("RUZL"),h=n("13ei");function p(t){t.fillText(this.partialText,0,0)}function f(t){t.strokeText(this.partialText,0,0)}var d=function(t){function e(e){var n=t.call(this,e)||this;return n.dummyCanvas=o.Util.createCanvasElement(),n.dataArray=[],n.dataArray=u.Path.parsePathData(n.attrs.data),n.on("dataChange.konva",(function(){this.dataArray=u.Path.parsePathData(this.attrs.data),this._setTextData()})),n.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva",n._setTextData),e&&e.getKerning&&(o.Util.warn('getKerning TextPath API is deprecated. Please use "kerningFunc" instead.'),n.kerningFunc(e.getKerning)),n._setTextData(),n}return i(e,t),e.prototype._sceneFunc=function(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var e=this.textDecoration(),n=this.fill(),r=this.fontSize(),i=this.glyphInfo;"underline"===e&&t.beginPath();for(var o=0;o<i.length;o++){t.save();var s=i[o].p0;t.translate(s.x,s.y),t.rotate(i[o].rotation),this.partialText=i[o].text,t.fillStrokeShape(this),"underline"===e&&(0===o&&t.moveTo(0,r/2+1),t.lineTo(r,r/2+1)),t.restore()}"underline"===e&&(t.strokeStyle=n,t.lineWidth=r/20,t.stroke()),t.restore()},e.prototype._hitFunc=function(t){t.beginPath();var e=this.glyphInfo;if(e.length>=1){var n=e[0].p0;t.moveTo(n.x,n.y)}for(var r=0;r<e.length;r++){var i=e[r].p1;t.lineTo(i.x,i.y)}t.setAttr("lineWidth",this.fontSize()),t.setAttr("strokeStyle",this.colorKey),t.stroke()},e.prototype.getTextWidth=function(){return this.textWidth},e.prototype.getTextHeight=function(){return o.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight},e.prototype.setText=function(t){return c.Text.prototype.setText.call(this,t)},e.prototype._getContextFont=function(){return c.Text.prototype._getContextFont.call(this)},e.prototype._getTextSize=function(t){var e=this.dummyCanvas.getContext("2d");e.save(),e.font=this._getContextFont();var n=e.measureText(t);return e.restore(),{width:n.width,height:parseInt(this.attrs.fontSize,10)}},e.prototype._setTextData=function(){var t=this,e=this._getTextSize(this.attrs.text),n=this.letterSpacing(),r=this.align(),i=this.kerningFunc();this.textWidth=e.width,this.textHeight=e.height;var o=Math.max(this.textWidth+((this.attrs.text||"").length-1)*n,0);this.glyphInfo=[];for(var s=0,a=0;a<t.dataArray.length;a++)t.dataArray[a].pathLength>0&&(s+=t.dataArray[a].pathLength);var c=0;"center"===r&&(c=Math.max(0,s/2-o/2)),"right"===r&&(c=Math.max(0,s-o));for(var l,h,p,f=this.text().split(""),d=this.text().split(" ").length-1,g=-1,m=0,v=function(){m=0;for(var e=t.dataArray,n=g+1;n<e.length;n++){if(e[n].pathLength>0)return g=n,e[n];"M"===e[n].command&&(l={x:e[n].points[0],y:e[n].points[1]})}return{}},y=function(e){var i=t._getTextSize(e).width+n;" "===e&&"justify"===r&&(i+=(s-o)/d);var a=0,c=0;for(h=void 0;Math.abs(i-a)/i>.01&&c<25;){c++;for(var f=a;void 0===p;)(p=v())&&f+p.pathLength<i&&(f+=p.pathLength,p=void 0);if(p==={}||void 0===l)return;var g=!1;switch(p.command){case"L":u.Path.getLineLength(l.x,l.y,p.points[0],p.points[1])>i?h=u.Path.getPointOnLine(i,l.x,l.y,p.points[0],p.points[1],l.x,l.y):p=void 0;break;case"A":var y=p.points[4],x=p.points[5],b=p.points[4]+x;0===m?m=y+1e-8:i>a?m+=Math.PI/180*x/Math.abs(x):m-=Math.PI/360*x/Math.abs(x),(x<0&&m<b||x>=0&&m>b)&&(m=b,g=!0),h=u.Path.getPointOnEllipticalArc(p.points[0],p.points[1],p.points[2],p.points[3],m,p.points[6]);break;case"C":0===m?m=i>p.pathLength?1e-8:i/p.pathLength:i>a?m+=(i-a)/p.pathLength:m-=(a-i)/p.pathLength,m>1&&(m=1,g=!0),h=u.Path.getPointOnCubicBezier(m,p.start.x,p.start.y,p.points[0],p.points[1],p.points[2],p.points[3],p.points[4],p.points[5]);break;case"Q":0===m?m=i/p.pathLength:i>a?m+=(i-a)/p.pathLength:m-=(a-i)/p.pathLength,m>1&&(m=1,g=!0),h=u.Path.getPointOnQuadraticBezier(m,p.start.x,p.start.y,p.points[0],p.points[1],p.points[2],p.points[3])}void 0!==h&&(a=u.Path.getLineLength(l.x,l.y,h.x,h.y)),g&&(g=!1,p=void 0)}},x=c/(t._getTextSize("C").width+n)-1,b=0;b<x&&(y("C"),void 0!==l&&void 0!==h);b++)l=h;for(var _=0;_<f.length&&(y(f[_]),void 0!==l&&void 0!==h);_++){var w=u.Path.getLineLength(l.x,l.y,h.x,h.y),M=0;if(i)try{M=i(f[_-1],f[_])*this.fontSize()}catch(t){M=0}l.x+=M,h.x+=M,this.textWidth+=M;var E=u.Path.getPointOnLine(M+w/2,l.x,l.y,h.x,h.y),S=Math.atan2(h.y-l.y,h.x-l.x);this.glyphInfo.push({transposeX:E.x,transposeY:E.y,text:f[_],rotation:S,p0:l,p1:h}),l=h}},e.prototype.getSelfRect=function(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};var t=[];this.glyphInfo.forEach((function(e){t.push(e.p0.x),t.push(e.p0.y),t.push(e.p1.x),t.push(e.p1.y)}));for(var e,n,r=t[0]||0,i=t[0]||0,o=t[1]||0,s=t[1]||0,a=0;a<t.length/2;a++)e=t[2*a],n=t[2*a+1],r=Math.min(r,e),i=Math.max(i,e),o=Math.min(o,n),s=Math.max(s,n);var u=this.fontSize();return{x:r-u/2,y:o-u/2,width:i-r+u,height:s-o+u}},e}(a.Shape);e.TextPath=d,d.prototype._fillFunc=p,d.prototype._strokeFunc=f,d.prototype._fillFuncHit=p,d.prototype._strokeFuncHit=f,d.prototype.className="TextPath",d.prototype._attrsAffectingSize=["text","fontSize","data"],h._registerNode(d),s.Factory.addGetterSetter(d,"data"),s.Factory.addGetterSetter(d,"fontFamily","Arial"),s.Factory.addGetterSetter(d,"fontSize",12,l.getNumberValidator()),s.Factory.addGetterSetter(d,"fontStyle","normal"),s.Factory.addGetterSetter(d,"align","left"),s.Factory.addGetterSetter(d,"letterSpacing",0,l.getNumberValidator()),s.Factory.addGetterSetter(d,"textBaseline","middle"),s.Factory.addGetterSetter(d,"fontVariant","normal"),s.Factory.addGetterSetter(d,"text",""),s.Factory.addGetterSetter(d,"textDecoration",null),s.Factory.addGetterSetter(d,"kerningFunc",null),o.Collection.mapMethods(d)},KmKo:function(t,e,n){"use strict";var r=n("xluM"),i=n("glrk"),o=n("3Eq5");t.exports=function(t,e,n){var s,a;i(t);try{if(!(s=o(t,"return"))){if("throw"===e)throw n;return n}s=r(s,t)}catch(t){a=!0,s=t}if("throw"===e)throw n;if(a)throw s;return i(s),n}},L7LI:function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("6mFz"),a=n("1q+a"),u=n("13ei"),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype._validateAdd=function(t){"Shape"!==t.getType()&&o.Util.throw("You may only add shapes to a fast layer.")},e.prototype._setCanvasSize=function(t,e){this.canvas.setSize(t,e),this._checkSmooth()},e.prototype.hitGraphEnabled=function(){return!1},e.prototype.drawScene=function(t){var e=this.getLayer(),n=t||e&&e.getCanvas();return this.clearBeforeDraw()&&n.getContext().clear(),s.Container.prototype.drawScene.call(this,n),this},e.prototype.draw=function(){return this.drawScene(),this},e}(a.BaseLayer);e.FastLayer=c,c.prototype.nodeType="FastLayer",u._registerNode(c),o.Collection.mapMethods(c)},LKj3:function(t,e,n){"use strict";var r=n("I+eb"),i=n("z+kr"),o=n("IMxJ")(i.setInterval,!0);r({global:!0,bind:!0,forced:i.setInterval!==o},{setInterval:o})},LPSS:function(t,e,n){"use strict";var r,i,o,s,a=n("z+kr"),u=n("K6Rb"),c=n("A2ZE"),l=n("Fib7"),h=n("Gi26"),p=n("0Dky"),f=n("G+Rx"),d=n("82ph"),g=n("zBJ4"),m=n("1tal"),v=n("UsjB"),y=n("mtxD"),x=a.setImmediate,b=a.clearImmediate,_=a.process,w=a.Dispatch,M=a.Function,E=a.MessageChannel,S=a.String,A=0,C={};p((function(){r=a.location}));var T=function(t){if(h(C,t)){var e=C[t];delete C[t],e()}},P=function(t){return function(){T(t)}},I=function(t){T(t.data)},L=function(t){a.postMessage(S(t),r.protocol+"//"+r.host)};x&&b||(x=function(t){m(arguments.length,1);var e=l(t)?t:M(t),n=d(arguments,1);return C[++A]=function(){u(e,void 0,n)},i(A),A},b=function(t){delete C[t]},y?i=function(t){_.nextTick(P(t))}:w&&w.now?i=function(t){w.now(P(t))}:E&&!v?(s=(o=new E).port2,o.port1.onmessage=I,i=c(s.postMessage,s)):a.addEventListener&&l(a.postMessage)&&!a.importScripts&&r&&"file:"!==r.protocol&&!p(L)?(i=L,a.addEventListener("message",I,!1)):i="onreadystatechange"in g("script")?function(t){f.appendChild(g("script")).onreadystatechange=function(){f.removeChild(this),T(t)}}:function(t){setTimeout(P(t),0)}),t.exports={set:x,clear:b}},"LRa+":function(t,e,n){!function(){"use strict";var e=Math.abs,r=Math.min,i=Math.max,o=Math.cos,s=Math.sin,a=Math.acos,u=Math.sqrt,c=Math.PI,l={x:0,y:0,z:0},h=n("2As9"),p=n("D3+e"),f=function(t){var n=t&&t.forEach?t:[].slice.call(arguments),r=!1;if("object"==typeof n[0]){r=n.length;var i=[];n.forEach((function(t){["x","y","z"].forEach((function(e){void 0!==t[e]&&i.push(t[e])}))})),n=i}var o=!1,s=n.length;if(r){if(r>4){if(1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");o=!0}}else if(6!==s&&8!==s&&9!==s&&12!==s&&1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");var a=!o&&(9===s||12===s)||t&&t[0]&&void 0!==t[0].z;this._3d=a;for(var u=[],c=0,l=a?3:2;c<s;c+=l){var p={x:n[c],y:n[c+1]};a&&(p.z=n[c+2]),u.push(p)}this.order=u.length-1,this.points=u;var f=["x","y"];a&&f.push("z"),this.dims=f,this.dimlen=f.length,function(t){for(var n=t.order,r=t.points,i=h.align(r,{p1:r[0],p2:r[n]}),o=0;o<i.length;o++)if(e(i[o].y)>1e-4)return void(t._linear=!1);t._linear=!0}(this),this._t1=0,this._t2=1,this.update()},d=n("TDvD");function g(t,e,n,r,i){void 0===i&&(i=.5);var o=h.projectionratio(i,t),s=1-o,a={x:o*e.x+s*r.x,y:o*e.y+s*r.y},u=h.abcratio(i,t);return{A:{x:n.x+(n.x-a.x)/u,y:n.y+(n.y-a.y)/u},B:n,C:a}}f.SVGtoBeziers=function(t){return d(f,t)},f.quadraticFromPoints=function(t,e,n,r){if(void 0===r&&(r=.5),0===r)return new f(e,e,n);if(1===r)return new f(t,e,e);var i=g(2,t,e,n,r);return new f(t,i.A,n)},f.cubicFromPoints=function(t,e,n,r,i){void 0===r&&(r=.5);var o=g(3,t,e,n,r);void 0===i&&(i=h.dist(e,o.C));var s=i*(1-r)/r,a=h.dist(t,n),u=(n.x-t.x)/a,c=(n.y-t.y)/a,l=i*u,p=i*c,d=s*u,m=s*c,v=e.x-l,y=e.y-p,x=e.x+d,b=e.y+m,_=o.A,w=_.x+(v-_.x)/(1-r),M=_.y+(y-_.y)/(1-r),E=_.x+(x-_.x)/r,S=_.y+(b-_.y)/r,A={x:t.x+(w-t.x)/r,y:t.y+(M-t.y)/r},C={x:n.x+(E-n.x)/(1-r),y:n.y+(S-n.y)/(1-r)};return new f(t,A,C,n)};var m=function(){return h};f.getUtils=m,f.PolyBezier=p,f.prototype={getUtils:m,valueOf:function(){return this.toString()},toString:function(){return h.pointsToString(this.points)},toSVG:function(t){if(this._3d)return!1;for(var e=this.points,n=["M",e[0].x,e[0].y,2===this.order?"Q":"C"],r=1,i=e.length;r<i;r++)n.push(e[r].x),n.push(e[r].y);return n.join(" ")},setRatios:function(t){if(t.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=t,this._lut=[]},verify:function(){var t=this.coordDigest();t!==this._print&&(this._print=t,this.update())},coordDigest:function(){return this.points.map((function(t,e){return""+e+t.x+t.y+(t.z?t.z:0)})).join("")},update:function(t){this._lut=[],this.dpoints=h.derive(this.points,this._3d),this.computedirection()},computedirection:function(){var t=this.points,e=h.angle(t[0],t[this.order],t[1]);this.clockwise=e>0},length:function(){return h.length(this.derivative.bind(this))},_lut:[],getLUT:function(t){if(this.verify(),t=t||100,this._lut.length===t)return this._lut;this._lut=[],t--;for(var e=0;e<=t;e++)this._lut.push(this.compute(e/t));return this._lut},on:function(t,e){e=e||5;for(var n,r=this.getLUT(),i=[],o=0,s=0;s<r.length;s++)n=r[s],h.dist(n,t)<e&&(i.push(n),o+=s/r.length);return!!i.length&&o/i.length},project:function(t){var e,n,r,i,o=this.getLUT(),s=o.length-1,a=h.closest(o,t),u=a.mdist,c=a.mpos,l=(c+1)/s,p=.1/s;for(u+=1,e=n=(c-1)/s;n<l+p;n+=p)r=this.compute(n),(i=h.dist(t,r))<u&&(u=i,e=n);return(r=this.compute(e)).t=e,r.d=u,r},get:function(t){return this.compute(t)},point:function(t){return this.points[t]},compute:function(t){return this.ratios?h.computeWithRatios(t,this.points,this.ratios,this._3d):h.compute(t,this.points,this._3d,this.ratios)},raise:function(){for(var t,e,n=this.points,r=[n[0]],i=n.length,o=1;o<i;o++)t=n[o],e=n[o-1],r[o]={x:(i-o)/i*t.x+o/i*e.x,y:(i-o)/i*t.y+o/i*e.y};return r[i]=n[i-1],new f(r)},derivative:function(t){var e,n,r=1-t,i=0,o=this.dpoints[0];2===this.order&&(o=[o[0],o[1],l],e=r,n=t),3===this.order&&(e=r*r,n=r*t*2,i=t*t);var s={x:e*o[0].x+n*o[1].x+i*o[2].x,y:e*o[0].y+n*o[1].y+i*o[2].y};return this._3d&&(s.z=e*o[0].z+n*o[1].z+i*o[2].z),s},curvature:function(t){return h.curvature(t,this.points,this._3d)},inflections:function(){return h.inflections(this.points)},normal:function(t){return this._3d?this.__normal3(t):this.__normal2(t)},__normal2:function(t){var e=this.derivative(t),n=u(e.x*e.x+e.y*e.y);return{x:-e.y/n,y:e.x/n}},__normal3:function(t){var e=this.derivative(t),n=this.derivative(t+.01),r=u(e.x*e.x+e.y*e.y+e.z*e.z),i=u(n.x*n.x+n.y*n.y+n.z*n.z);e.x/=r,e.y/=r,e.z/=r,n.x/=i,n.y/=i,n.z/=i;var o={x:n.y*e.z-n.z*e.y,y:n.z*e.x-n.x*e.z,z:n.x*e.y-n.y*e.x},s=u(o.x*o.x+o.y*o.y+o.z*o.z);o.x/=s,o.y/=s,o.z/=s;var a=[o.x*o.x,o.x*o.y-o.z,o.x*o.z+o.y,o.x*o.y+o.z,o.y*o.y,o.y*o.z-o.x,o.x*o.z-o.y,o.y*o.z+o.x,o.z*o.z];return{x:a[0]*e.x+a[1]*e.y+a[2]*e.z,y:a[3]*e.x+a[4]*e.y+a[5]*e.z,z:a[6]*e.x+a[7]*e.y+a[8]*e.z}},hull:function(t){var e,n=this.points,r=[],i=[],o=0,s=0,a=0;for(i[o++]=n[0],i[o++]=n[1],i[o++]=n[2],3===this.order&&(i[o++]=n[3]);n.length>1;){for(r=[],s=0,a=n.length-1;s<a;s++)e=h.lerp(t,n[s],n[s+1]),i[o++]=e,r.push(e);n=r}return i},split:function(t,e){if(0===t&&e)return this.split(e).left;if(1===e)return this.split(t).right;var n=this.hull(t),r={left:2===this.order?new f([n[0],n[3],n[5]]):new f([n[0],n[4],n[7],n[9]]),right:2===this.order?new f([n[5],n[4],n[2]]):new f([n[9],n[8],n[6],n[3]]),span:n};return r.left._t1=h.map(0,0,1,this._t1,this._t2),r.left._t2=h.map(t,0,1,this._t1,this._t2),r.right._t1=h.map(t,0,1,this._t1,this._t2),r.right._t2=h.map(1,0,1,this._t1,this._t2),e?(e=h.map(e,t,1,0,1),r.right.split(e).left):r},extrema:function(){var t,e,n=this.dims,r={},i=[];return n.forEach(function(n){e=function(t){return t[n]},t=this.dpoints[0].map(e),r[n]=h.droots(t),3===this.order&&(t=this.dpoints[1].map(e),r[n]=r[n].concat(h.droots(t))),r[n]=r[n].filter((function(t){return t>=0&&t<=1})),i=i.concat(r[n].sort(h.numberSort))}.bind(this)),i=i.sort(h.numberSort).filter((function(t,e){return i.indexOf(t)===e})),r.values=i,r},bbox:function(){var t=this.extrema(),e={};return this.dims.forEach(function(n){e[n]=h.getminmax(this,n,t[n])}.bind(this)),e},overlaps:function(t){var e=this.bbox(),n=t.bbox();return h.bboxoverlap(e,n)},offset:function(t,e){if(void 0!==e){var n=this.get(t),r=this.normal(t),i={c:n,n:r,x:n.x+r.x*e,y:n.y+r.y*e};return this._3d&&(i.z=n.z+r.z*e),i}if(this._linear){var o=this.normal(0),s=this.points.map((function(e){var n={x:e.x+t*o.x,y:e.y+t*o.y};return e.z&&r.z&&(n.z=e.z+t*o.z),n}));return[new f(s)]}return this.reduce().map((function(e){return e._linear?e.offset(t)[0]:e.scale(t)}))},simple:function(){if(3===this.order){var t=h.angle(this.points[0],this.points[3],this.points[1]),n=h.angle(this.points[0],this.points[3],this.points[2]);if(t>0&&n<0||t<0&&n>0)return!1}var r=this.normal(0),i=this.normal(1),o=r.x*i.x+r.y*i.y;return this._3d&&(o+=r.z*i.z),e(a(o))<c/3},reduce:function(){var t,n,r=0,i=0,o=[],s=[],a=this.extrema().values;for(-1===a.indexOf(0)&&(a=[0].concat(a)),-1===a.indexOf(1)&&a.push(1),r=a[0],t=1;t<a.length;t++)i=a[t],(n=this.split(r,i))._t1=r,n._t2=i,o.push(n),r=i;return o.forEach((function(t){for(r=0,i=0;i<=1;)for(i=r+.01;i<=1.01;i+=.01)if(!(n=t.split(r,i)).simple()){if(e(r-(i-=.01))<.01)return[];(n=t.split(r,i))._t1=h.map(r,0,1,t._t1,t._t2),n._t2=h.map(i,0,1,t._t1,t._t2),s.push(n),r=i;break}r<1&&((n=t.split(r,1))._t1=h.map(r,0,1,t._t1,t._t2),n._t2=t._t2,s.push(n))})),s},scale:function(t){var e=this.order,n=!1;if("function"==typeof t&&(n=t),n&&2===e)return this.raise().scale(n);var r=this.clockwise,i=n?n(0):t,o=n?n(1):t,s=[this.offset(0,10),this.offset(1,10)],a=h.lli4(s[0],s[0].c,s[1],s[1].c);if(!a)throw new Error("cannot scale this curve. Try reducing it first.");var c=this.points,l=[];return[0,1].forEach(function(t){var n=l[t*e]=h.copy(c[t*e]);n.x+=(t?o:i)*s[t].n.x,n.y+=(t?o:i)*s[t].n.y}.bind(this)),n?([0,1].forEach(function(i){if(2!==this.order||!i){var o=c[i+1],s={x:o.x-a.x,y:o.y-a.y},h=n?n((i+1)/e):t;n&&!r&&(h=-h);var p=u(s.x*s.x+s.y*s.y);s.x/=p,s.y/=p,l[i+1]={x:o.x+h*s.x,y:o.y+h*s.y}}}.bind(this)),new f(l)):([0,1].forEach(function(t){if(2!==this.order||!t){var n=l[t*e],r=this.derivative(t),i={x:n.x+r.x,y:n.y+r.y};l[t+1]=h.lli4(n,i,a,c[t+1])}}.bind(this)),new f(l))},outline:function(t,e,n,r){e=void 0===e?t:e;var i,o=this.reduce(),s=o.length,a=[],u=[],c=0,l=this.length(),f=void 0!==n&&void 0!==r;function d(t,e,n,r,i){return function(o){var s=r/n,a=(r+i)/n,u=e-t;return h.map(o,0,1,t+s*u,t+a*u)}}o.forEach((function(i){w=i.length(),f?(a.push(i.scale(d(t,n,l,c,w))),u.push(i.scale(d(-e,-r,l,c,w)))):(a.push(i.scale(t)),u.push(i.scale(-e))),c+=w})),u=u.map((function(t){return(i=t.points)[3]?t.points=[i[3],i[2],i[1],i[0]]:t.points=[i[2],i[1],i[0]],t})).reverse();var g=a[0].points[0],m=a[s-1].points[a[s-1].points.length-1],v=u[s-1].points[u[s-1].points.length-1],y=u[0].points[0],x=h.makeline(v,g),b=h.makeline(m,y),_=[x].concat(a).concat([b]).concat(u),w=_.length;return new p(_)},outlineshapes:function(t,e,n){e=e||t;for(var r=this.outline(t,e).curves,i=[],o=1,s=r.length;o<s/2;o++){var a=h.makeshape(r[o],r[s-o],n);a.startcap.virtual=o>1,a.endcap.virtual=o<s/2-1,i.push(a)}return i},intersects:function(t,e){return t?t.p1&&t.p2?this.lineIntersects(t):(t instanceof f&&(t=t.reduce()),this.curveintersects(this.reduce(),t,e)):this.selfintersects(e)},lineIntersects:function(t){var e=r(t.p1.x,t.p2.x),n=r(t.p1.y,t.p2.y),o=i(t.p1.x,t.p2.x),s=i(t.p1.y,t.p2.y),a=this;return h.roots(this.points,t).filter((function(t){var r=a.get(t);return h.between(r.x,e,o)&&h.between(r.y,n,s)}))},selfintersects:function(t){var e,n,r,i,o=this.reduce(),s=o.length-2,a=[];for(e=0;e<s;e++)r=o.slice(e,e+1),i=o.slice(e+2),n=this.curveintersects(r,i,t),a=a.concat(n);return a},curveintersects:function(t,e,n){var r=[];t.forEach((function(t){e.forEach((function(e){t.overlaps(e)&&r.push({left:t,right:e})}))}));var i=[];return r.forEach((function(t){var e=h.pairiteration(t.left,t.right,n);e.length>0&&(i=i.concat(e))})),i},arcs:function(t){t=t||.5;return this._iterate(t,[])},_error:function(t,n,r,i){var o=(i-r)/4,s=this.get(r+o),a=this.get(i-o),u=h.dist(t,n),c=h.dist(t,s),l=h.dist(t,a);return e(c-u)+e(l-u)},_iterate:function(t,e){var n,r=0,i=1;do{n=0,i=1;var a,u,c,l,p,f=this.get(r),d=!1,g=!1,m=i,v=1;do{if(g=d,l=c,m=(r+i)/2,a=this.get(m),u=this.get(i),(c=h.getccenter(f,a,u)).interval={start:r,end:i},d=this._error(c,f,r,i)<=t,(p=g&&!d)||(v=i),d){if(i>=1){if(c.interval.end=v=1,l=c,i>1){var y={x:c.x+c.r*o(c.e),y:c.y+c.r*s(c.e)};c.e+=h.angle({x:c.x,y:c.y},y,this.get(1))}break}i+=(i-r)/2}else i=m}while(!p&&n++<100);if(n>=100)break;l=l||c,e.push(l),r=v}while(i<1);return e}},t.exports=f}()},LYNF:function(t,e,n){"use strict";var r=n("OH9c");t.exports=function(t,e,n,i,o){var s=new Error(t);return r(s,e,n,i,o)}},Lmem:function(t,e,n){"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},LvDl:function(t,e,n){(function(t,r){var i;
76
+ */var ub=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};class cb extends eg{constructor(t,e,n){super(),this.frames=[],this.labelID=t,this.initialized=!1,this.needUpdate=!1,this.isEditingInView=new Map,this.currentPID=-1,this.movedToNewPanorama=!0,this.outOfRange=!0,this.currentDisplayTime=0,this.frameIndex=0,this.tileDispDuration=60,this.hidden=!1;const{THREE:r}=Nd.getInstance(),{width:i,height:o,depthTest:s}=n||{};this.width=i||.1,this.height=o||.1,this.depthTest=s||!1;const a=new r.PlaneBufferGeometry(this.width,this.height);this.uniforms={map:{type:"t",value:null},blendColor:{type:"v4",value:new r.Vector4(0,0,0,0)},opacity:{value:1}},this.material=new r.ShaderMaterial({transparent:!0,vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",fragmentShader:"\n uniform sampler2D map;\n uniform vec4 blendColor;\n uniform float opacity;\n varying vec2 vUv;\n void main(){\n vec4 texColor = texture2D(map, vUv);\n gl_FragColor = vec4((texColor * (1.0 - blendColor.a) + blendColor * blendColor.a).rgb, texColor.a) * vec4(1, 1, 1, opacity);\n }",uniforms:this.uniforms,depthTest:this.depthTest,depthWrite:!1,name:"placeable2DMaterial",side:r.DoubleSide}),this.labelMesh=new r.Mesh(a,this.material),this.labelMesh.renderOrder=400,this.add(this.labelMesh),this.imgElement=document.createElement("div"),this.imgElement.style.pointerEvents="none",this.imgElement.innerHTML=`<div><img width=50px height=50px src="${e}"></div>`,this.cssObject=new eb(this.imgElement),this.add(this.cssObject),this.viewConfigurations=new Map,this.eventListeners={onMoveToPanorama:(t,e)=>{this.updateCurrentBindingPanorama(t,e)},onPositionChanged:(t,e,n)=>{if(e!==this)return;const{visible:r}=this.getViewConfigurationByPanoramaId(n,this.currentPID);this.updateViewConfigurationByPanoramaId(n,this.currentPID,{visible:r,position:t})}},kd.on(Ud.MOVE_TO_PANORAMA,this.eventListeners.onMoveToPanorama),kd.on(zd.ELEMENT_POSITION_UPDATED,this.eventListeners.onPositionChanged),e&&this.load(e)}load(t){return ub(this,void 0,void 0,(function*(){this.initialized=!1;const e=t.search(/\.gif$/),{THREE:n}=Nd.getInstance();if(e>0){const e=new XMLHttpRequest;e.open("GET",t,!0),e.responseType="arraybuffer",e.onload=()=>ub(this,void 0,void 0,(function*(){let t;t=e.response,this.gif=ab.parse(t),t.toString().indexOf("ArrayBuffer")>0&&(t=new Uint8Array(t)),this.gif.split(!0).forEach(t=>ub(this,void 0,void 0,(function*(){const e=new Image,r=class{static writeToBlob(t){if("function"==typeof Blob)return new Blob(t,{type:"image/gif"});throw new Error("writeToBlob is browser-only function")}static writeToDataUrl(t){let e="";return t.forEach(t=>{const n=[];for(let e=0,r=t.byteLength;e<r;++e)n.push(t[e]);e+=String.fromCharCode.apply(null,n)}),"data:image/gif;base64,"+btoa(e)}}.writeToBlob(t.writeToArrayBuffer());e.src=URL.createObjectURL(r),e.onload=()=>ub(this,void 0,void 0,(function*(){if(this.frames.push(e),this.gif.frames.length===this.frames.length){this.frameIndex=0,this.currentDisplayTime=(new Date).getTime();const t=new n.PlaneBufferGeometry(this.width,this.height);this.gifCanvas=document.createElement("canvas"),this.gifCanvas.width=this.gif.width,this.gifCanvas.height=this.gif.height,this.gifContext=this.gifCanvas.getContext("2d"),this.gifContext&&this.gifContext.drawImage(this.frames[this.frameIndex],0,0,this.gif.width,this.gif.height),this.giftexture=new n.Texture(this.gifCanvas),this.giftexture.needsUpdate=!0,this.gifMaterial=new n.MeshBasicMaterial({map:this.giftexture,transparent:!0,side:n.DoubleSide}),this.gifLabelMesh=new n.Mesh(t,this.gifMaterial),this.add(this.gifLabelMesh),this.needUpdate=!0,this.emit(Ud.ELEMENT_LOADED,this)}}))})))})),e.send()}else(new n.TextureLoader).load(t,t=>{this.uniforms.map.value=t,this.needUpdate=!0,this.emit(Ud.ELEMENT_LOADED,this)})}))}drawCanvas(){this.gifContext&&(this.gifContext.clearRect(0,0,this.gif.width,this.gif.height),this.gifContext.drawImage(this.frames[this.frameIndex],0,0,this.gif.width,this.gif.height),this.giftexture.needsUpdate=!0,this.needUpdate=!0)}update(){const t=new tg(this);if(this.initialized||(this.initialized=!0,t.needUpdate=!0),this.needUpdate&&(t.needUpdate=!0,this.needUpdate=!1),null!==this.gifLabelMesh){const t=(new Date).getTime();t-this.currentDisplayTime>=this.tileDispDuration&&(this.currentDisplayTime=t,this.frameIndex+=1,this.frameIndex>=this.frames.length&&(this.frameIndex=0),this.drawCanvas())}return this.initialized&&!this.parent&&(t.shouldPlaceElement=!0),t}dispose(){const t=this.uniforms.map.value;t&&t.dispose(),kd.off(Ud.MOVE_TO_PANORAMA,this.eventListeners.onMoveToPanorama),kd.off(zd.ELEMENT_POSITION_UPDATED,this.eventListeners.onPositionChanged),this.imgElement=null,this.cssObject.dispatchEvent({type:"remove"}),this.remove(this.cssObject),this.cssObject=null,super.dispose()}addViewConfiguration(t){const e={targetView:t.targetView,faceToCamera:t.faceToCamera,keepZOnFaceToCamera:t.keepZOnFaceToCamera,showDom:!1,showMesh:!0,visibleScope:5},n=this.viewConfigurations.get(t.targetView);n&&(e.visibilities=n.visibilities,e.positions=n.positions,void 0===e.faceToCamera&&(e.faceToCamera=n.faceToCamera),void 0===e.keepZOnFaceToCamera&&(e.keepZOnFaceToCamera=n.keepZOnFaceToCamera),e.showDom=n.showDom,e.showMesh=n.showMesh,e.visibleScope=n.visibleScope),void 0!==t.showDom&&(e.showDom=t.showDom),void 0!==t.showMesh&&(e.showMesh=t.showMesh),void 0!==t.visibleScope&&(e.visibleScope=t.visibleScope),t.visibilities&&(e.visibilities||(e.visibilities=new Map),t.visibilities.forEach(t=>{e.visibilities.set(t.pid,t.visible)})),t.positions&&(e.positions||(e.positions=new Map),t.positions.forEach(t=>{e.positions.set(t.pid,t.position)})),this.viewConfigurations.set(e.targetView,e)}setEditingMode(t,e){this.isEditingInView.set(t,e),this.needUpdate=!0}isEditing(t){return!!this.isEditingInView.get(t)}setSize(t,e){const{THREE:n}=Nd.getInstance();this.width=t,this.height=e;const r=new n.PlaneBufferGeometry(t,e);this.labelMesh.geometry=r}getSize(){return[this.width,this.height]}setDomCSS(t,e,n){if(this.imgElement){const r=this.imgElement.getElementsByTagName("img")[0];let i;i=n?`${n};width:${t.toString()}px;height:${e.toString()}px;`:`width:${t.toString()}px;height:${e.toString()}px;`,r.style.cssText=i,this.width=t,this.height=e,this.isDomElement=!0}}getViewConfigurationByPanoramaId(t,e){const n=this.viewConfigurations.get(t);if(!n)throw new Error("Cannot find view configuration");const r=n.positions.has(e)?n.positions.get(e):n.positions.get(-1);return{visible:n.visibilities.has(e)?n.visibilities.get(e):n.visibilities.get(-1),position:r}}updateViewConfigurationByPanoramaId(t,e,{visible:n,position:r}){const i=this.viewConfigurations.get(t);if(!i)throw new Error("Cannot find view configuration");void 0!==r&&i.positions.set(e,r),void 0!==n&&i.visibilities.set(e,n),this.needUpdate=!0}updateCurrentBindingPanorama(t,e){this.currentPID=t,this.movedToNewPanorama=!0,this.currentPanoramaPosition=e?e.clone():null}setHidden(t){this.hidden=t}}var lb=n("WVt+");class hb{static GetVersion(t,e){let n=window.navigator.userAgent.match(t);return n=n?n[1].split(e):[],{major:parseInt(n[0],10)||0,minor:parseInt(n[1],10)||0,patch:parseInt(n[2],10)||0}}static DetectWeChat(){const t=window.navigator.userAgent.toLowerCase();return!!t&&"micromessenger"===t.toString()}static DetectIOS(){return this.DetectIPhone()||this.DetectIPad()||this.DetectIPod()}static DetectIPad(){const{userAgent:t}=window.navigator;return/iPad/.test(t)}static DetectIPod(){const{userAgent:t}=window.navigator;return/iPod/.test(t)}static DetectIPhone(){const{userAgent:t}=window.navigator;return/iPhone/.test(t)}static DetectAndroid(){return-1!==window.navigator.userAgent.indexOf("Android")}static DetectAndroidMobile(){const{userAgent:t}=window.navigator;return this.DetectAndroid()&&-1!==t.indexOf("Mobile")}}class pb{static getLineCross(t,e,n,r){const i=Math.min(n.x,r.x)>Math.max(t.x,e.x),o=Math.min(n.y,r.y)>Math.max(t.y,e.y),s=Math.min(t.x,e.x)>Math.max(n.x,r.x),a=Math.min(t.y,e.y)>Math.max(n.y,r.y);if(i||o||s||a)return!1;const u=(t,e)=>t.x*e.y-t.y*e.x;return((t,e,n,r)=>{let i={x:t.x-n.x,y:n.y-t.y},o={x:e.x-n.x,y:e.y-n.y},s={x:r.x-n.x,y:r.y-n.y};const a=u(i,s)*u(o,s);return i={x:n.x-t.x,y:n.y-t.y},o={x:r.x-t.x,y:r.y-t.y},s={x:e.x-t.x,y:e.y-t.y},!!(a<=0&&u(i,s)*u(o,s)<=0)})(t,e,n,r)}static calcTurning(t,e=[2,20]){const n=t.length;if(n<2)return[];const r=[],i=(t,e)=>{const{x:n,y:r}=t,{x:i,y:o}=e,s=n*i+r*o,a=n*o-r*i,u=Math.atan2(a,s)/Math.PI*180;return Math.round(u+360)%360};let o=!1,s=0,a=[0,0],u=[0,0],c=[0,0],l=0,h=0;for(let p=1;p<n-1;p++){const n=t[p-1],f=t[p],d=t[p+1],g=i({x:d[0]-f[0],y:d[1]-f[1]},{x:f[0]-n[0],y:f[1]-n[1]}),m=g>=e[0]&&g<=e[1]||g>=360-e[1]&&g<=360-e[0];!o&&m?(o=!0,u=f,s+=g,l=p):o&&m?s+=g:o&&!m?(s+=g,h=p,c=f,a=[(u[0]+c[0])/2,(u[1]+c[1])/2],r.push({point:a,angle:s%360,startTPoint:u,endTPoint:c,startIndex:l,endIndex:h}),o=!1):o||m||(l=h=0,s=0,a=[0,0],u=[0,0],c=[0,0])}return o&&(c=t[n-1],a=[(u[0]+c[0])/2,(u[1]+c[1])/2],r.push({point:a,angle:s%360,startTPoint:u,endTPoint:c,startIndex:l,endIndex:h}),o=!1),r}static chunk(t,e){if(t.length<=0||e<=0)return t;const n=[];for(let r=0;r<t.length;r+=e)n.push(t.slice(r,r+e));return n}}let fb={};function db(){return fb.textPixel||512}function gb(){return fb.imgTextPixel||2048}db(),gb();function mb(t,e,n){return`${t}-${e}-${n}`}const vb=[{normal:new r.Vector3(0,0,1),trans:new r.Vector3(0,0,.5),euler:new r.Euler(0,Math.PI/2,-Math.PI/2),face:0,flipX:!1,flipY:!1,revers:!1},{normal:new r.Vector3(0,0,1),trans:new r.Vector3(0,0,.5),euler:new r.Euler(0,-Math.PI/2,-Math.PI/2),face:1,flipX:!0,flipY:!0,revers:!1},{normal:new r.Vector3(0,0,1),trans:new r.Vector3(0,0,.5),face:2,flipX:!1,flipY:!1,revers:!1},{normal:new r.Vector3(0,0,1),trans:new r.Vector3(0,0,-.5),face:3,flipX:!1,flipY:!0,revers:!0},{normal:new r.Vector3(0,0,1),trans:new r.Vector3(0,0,-.5),euler:new r.Euler(Math.PI/2,0,0),face:4,flipX:!1,flipY:!0,revers:!0},{normal:new r.Vector3(0,0,1),trans:new r.Vector3(0,0,-.5),euler:new r.Euler(-Math.PI/2,0,0),face:5,flipX:!0,flipY:!1,revers:!0}];function yb(t,e,n,r,i){const{THREE:o}=Nd.getInstance(),s=[],a=new o.Vector3(-.5,-.5,0),u=Math.pow(2,t),c=1/u;let l=e%u,h=Math.floor(e/u);n||(l=u-1-l,h=u-1-h),r&&(h=u-1-h),i&&(l=u-1-l);const p=a.x+l*c,f=a.y+h*c,d=p,g=f+c,m=p+c,v=f+c,y=p+c,x=f;return s.push(new o.Vector3(p,f,0)),s.push(new o.Vector3(d,g,0)),s.push(new o.Vector3(m,v,0)),s.push(new o.Vector3(y,x,0)),s}class xb{constructor(t,e,n,r,i,o,s){this.offLineLevel=-1,this.pfid=t,this.textureIndex=e,this.level=n,this.index=r,this.isInCamera=!1,this.rootUrl=i||"",this.offLineLevel=null==o?-1:o,this.offLineRootUrl=s||""}get id(){return mb(this.pfid,this.level,this.index)}get originVertices(){let t=this._originVertices;if(!t){const e=10*this.pfid%10-1,n=vb[e],{revers:r,flipX:i,flipY:o}=n;t=this._originVertices=yb(this.level,this.index,r,i,o)}return t}inCamera(t,e){const{THREE:n}=Nd.getInstance(),r=this.originVertices,i=new n.Vector3(0,0,0);i.applyMatrix4(t),i.project(e),this.centerDis=i.length();for(let n=0;n<r.length;n++){const i=r[n].clone();if(i.applyMatrix4(t),i.project(e),i.x>-1&&i.x<1&&i.y>-1&&i.y<1&&i.z>-1&&i.z<1)return!0}return!1}get targetTid(){return Math.floor(this.pfid)}}class bb{static getXY(t,e){return{x:t%e,y:Math.floor(t/e)}}static getSegment(t){return Math.pow(2,t)}static getCount(t){const e=bb.getSegment(t);return e*e}static getImageInfo2(t,e,n,r){const i=bb.getSegment(n),o=gb()/i;let{x:s,y:a}=bb.getXY(e,i);s=i-1-s,a=i-1-a;return{id:`${t}-${n}-${s}-${a}`,url:`${r}?x-bce-process=image${`/crop,x_${o*s},y_${o*a},w_${o},h_${o}`}${`/resize,m_lfit,w_${db()},h_${db()}`}`}}static getImageInfo(t){const{pfid:e,index:n,level:r,rootUrl:i,offLineLevel:o,offLineRootUrl:s}=t,a=bb.getSegment(r),u=gb()/a;let{x:c,y:l}=bb.getXY(n,a);c=a-1-c,l=a-1-l;let h="";if(r<=o)h=`${s}_${r}_${n}.jpg`;else{const t=`/crop,x_${u*c},y_${u*l},w_${u},h_${u}`,e=`/resize,m_lfit,w_${db()},h_${db()}`;h=`${i}?x-bce-process=image${bb.resizeFirst?`/resize,m_lfit,w_${gb()},h_${gb()}`:""}${t}${e}`}return{id:`${e}-${r}-${c}-${l}`,url:h}}static antiShake(t,e){let n;return(...r)=>{n&&clearTimeout(n),n=setTimeout(()=>{t(...r),n=null},e)}}static throttle(t,e){let n;return(...r)=>{n||(n=setTimeout(()=>{t(...r),n=null},e))}}}bb.updateTextureMax=1,bb.levelMin=0,bb.levelMax=2,bb.resizeFirst=!1,bb.getTileInfoId=mb,bb.getVertices=yb;class _b extends eg{constructor(t,e={width:.3}){super(),this.initialized=!1,this.ready=!0,this.points=[],this.distances=[],this.currentMoveIndex=0,this.options=Object.assign({textureMode:"repeat"},e),e.animateSpeed||(this.options.animateSpeed=.01),"tail"===e.textureMode&&this.createTailArrow(),this.renderPixelLine=e.renderPixelLine||!1,this.init(t)}calcPoints(t,e=.3){const{THREE:n}=Nd.getInstance(),r=t.length;if(r<2)return[];const i=[],o=t.map(t=>[t[0],t[1]]);for(let t=0;t<r;t++){const s=new n.Vector2(...o[t]),a=0===t?null:new n.Vector2(...o[t-1]),u=t===r-1?null:new n.Vector2(...o[t+1]),c=a?(new n.Vector2).subVectors(s,a).normalize():null,l=u?(new n.Vector2).subVectors(u,s).normalize():null,h=l&&c?(new n.Vector2).addVectors(l,c).normalize():null,p=0===t?new n.Vector2(-l.y,l.x):t===r-1?new n.Vector2(-c.y,c.x):new n.Vector2(-h.y,h.x),f=(new n.Vector2).addVectors(s,p.clone().multiplyScalar(-e)),d=(new n.Vector2).addVectors(s,p.clone().multiplyScalar(e));i.push([f.x,f.y,0],[d.x,d.y,0],[p.x,p.y,0])}return i}createTailArrow(){const{THREE:t}=Nd.getInstance(),e=this.options.textureUrl;(new r.TextureLoader).load(e,e=>{const n=this.options.width||.3,r=this.options.strokeWidth?n+2*this.options.strokeWidth:this.options.width,i=this.options.textureSize?this.options.textureSize[0]:r,o=this.options.textureSize?this.options.textureSize[1]:i,s=new t.PlaneGeometry(i,o),a=this.options.color?this.options.color:16777215,u=new t.MeshBasicMaterial({color:a,map:e,transparent:!0,opacity:1,depthTest:!1});u.needsUpdate=!0;const c=new t.Mesh(s,u);c.renderOrder=2,this.tailArrow=c,this.tailArrow.visible=!1,this.add(this.tailArrow)})}orgPoints(t,e=.3){const n=e>1?.01:e,{THREE:r}=Nd.getInstance(),i=t.length,o=this.calcPoints(t,n).map(t=>new r.Vector3(...t)),s=pb.chunk(o,3),a=t.map((t,e)=>({point:t,normal:[s[e][2].x,s[e][2].y],scale:1})),u=t.map(t=>[t[0],t[1]]),c=pb.calcTurning(u);if(!c.length)return a;const l=c.map(e=>{const{startIndex:o,endIndex:a,angle:u}=e,c=u>180?1:0,l=s[o-1][c],h=s[o-1][c],p=(new r.Vector3).subVectors(h,l).normalize().multiplyScalar(n),f=(new r.Vector3).addVectors(h,p),d=(new r.Vector3).subVectors(l,p),g=s[a+1][c],m=i>a+2?s[a+2][c]:s[a][c],v=(new r.Vector3).subVectors(m,g).normalize().multiplyScalar(n),y=(new r.Vector3).addVectors(m,v),x=(new r.Vector3).subVectors(g,v),b=lb.lineString([[d.x,d.y],[l.x,l.y],[h.x,h.y],[f.x,f.y]]),_=lb.lineString([[x.x,x.y],[g.x,g.y],[m.x,m.y],[y.x,y.y]]),w=lb.lineIntersect(b,_);if(!w.features[0])return null;const M=w.features[0].geometry.coordinates,E=new r.Vector2(t[a][0]-t[o-1][0],t[a][1]-t[o-1][1]).normalize().multiplyScalar(n),S=[M[0]-E.x,M[1]-E.y],A=[M[0]+E.x,M[1]+E.y],C=u>180?E.normalize().multiplyScalar(-1):E.normalize().multiplyScalar(1),T=[M[0]-C.y*n,M[1]+C.x*n],P=[M[0]+C.y*n,M[1]-C.x*n],I=lb.featureCollection([lb.point(S),lb.point(P),lb.point(A),lb.point(T),lb.point(S)]);return{hull:lb.convex(I),intersectCrd:M,startIndex:o,endIndex:a}});let h=0,p=0,f=!1;for(;p<i&&l[h];){const[t,e]=s[p],n=l[h].hull,i=l[h].intersectCrd,o=l[h+1]?l[h+1].intersectCrd:null,u=l[h+1]?l[h+1].hull:null,c=lb.booleanWithin(lb.point([t.x,t.y]),n),d=lb.booleanWithin(lb.point([e.x,e.y]),n),g=c||d;if(g&&c){f=!0;const n=new r.Vector3(...i,0);let s=e;o&&u&&lb.booleanWithin(lb.point([e.x,e.y]),u)&&(s=new r.Vector3(o[0],o[1],o[2]));const c=(new r.Vector3).subVectors(e,t).length(),l=(new r.Vector3).subVectors(s,new r.Vector3(n.x,n.y,0)).length(),h=(new r.Vector3).subVectors(s,new r.Vector3(n.x,n.y,0)).normalize();a.splice(p,1,{point:[(n.x+s.x)/2,(n.y+s.y)/2,0],scale:l/c,normal:[h.x,h.y]})}else if(g&&d){f=!0;const n=new r.Vector3(...i,0);let s=t;o&&u&&lb.booleanWithin(lb.point([t.x,t.y]),u)&&(s=new r.Vector3(o[0],o[1],o[2]));const c=(new r.Vector3).subVectors(e,t).length(),l=(new r.Vector3).subVectors(s,new r.Vector3(n.x,n.y,0)).length(),h=(new r.Vector3).subVectors(new r.Vector3(n.x,n.y,0),s).normalize();a.splice(p,1,{point:[(n.x+s.x)/2,(n.y+s.y)/2,0],scale:l/c,normal:[h.x,h.y]})}else f&&(p--,f=!1,h++);p++}return a}init(t){const{THREE:e}=Nd.getInstance(),n=t,r=(this.options.strokeWidth||0)+(this.options.width?this.options.width:.3)/2,i=this.orgPoints(n,r);this.orgedPoints=i,this.points=[];if(n.length>1){const[t,r,i,o]=[n[0],n[1],n[n.length-2],n[n.length-1]],s=new e.Vector3(...t),a=new e.Vector3(...r),u=(new e.Vector3).subVectors(s,a).normalize().multiplyScalar(.05*s.distanceTo(a)),c=s.clone().add(u),l=new e.Vector3(...i),h=new e.Vector3(...o),p=(new e.Vector3).subVectors(l,h).normalize().multiplyScalar(.05*s.distanceTo(a)),f=h.clone().sub(p),d=this.orgedPoints[0],g=this.orgedPoints[this.orgedPoints.length-1];this.orgedPoints.unshift({point:[c.x,c.y,c.z],normal:d.normal,scale:1}),this.orgedPoints.push({point:[f.x,f.y,f.z],normal:g.normal,scale:1}),this.points.push([c.x,c.y,c.z]),this.points.push(...n),this.points.push([f.x,f.y,f.z])}this.distances=[-.1];for(let t=1,n=this.points.length,r=new e.Vector3(...this.points[0]),i=new e.Vector3;t<n;t+=1)i.set(...this.points[t]),this.distances.push(1===t?0:this.distances[t-1]+i.distanceTo(r)),r.copy(i);this.bufferGeometry=new e.BufferGeometry;let[o,s,a]=this.points[0],u=0;const c=[];for(let t=0;t<this.orgedPoints.length;t+=1){const[e,n,r]=this.orgedPoints[t].point,[i,l]=this.orgedPoints[t].normal,h=this.orgedPoints[t].scale;let p=e-o,f=n-s,d=r-a;const g=Math.sqrt(p*p+f*f+d*d);p/=g,f/=g,d/=g,u+=3*g,this.options.strokeWidth?(c.push(e,n,r,-2,u,this.distances[t],i,l,h),c.push(e,n,r,-1,u,this.distances[t],i,l,h),c.push(e,n,r,1,u,this.distances[t],i,l,h),c.push(e,n,r,2,u,this.distances[t],i,l,h)):(c.push(e,n,r,-1,u,this.distances[t],i,l,h),c.push(e,n,r,1,u,this.distances[t],i,l,h)),o=e,s=n,a=r}const l=new Float32Array(c),h=this.options.strokeWidth?4:2,p=new e.InterleavedBuffer(l,9),f=new e.InterleavedBufferAttribute(p,4,0,!1);this.bufferGeometry.setAttribute("last",f);const d=new e.InterleavedBufferAttribute(p,4,9*h,!1);this.bufferGeometry.setAttribute("current",d);const g=new e.InterleavedBufferAttribute(p,4,9*h*2,!1);this.bufferGeometry.setAttribute("next",g);const m=new e.InterleavedBufferAttribute(p,1,9*h+4,!1);this.bufferGeometry.setAttribute("texoff",m);const v=new e.InterleavedBufferAttribute(p,1,9*h+5,!1);this.bufferGeometry.setAttribute("progress",v);const y=new e.InterleavedBufferAttribute(p,2,9*h+6,!1);this.bufferGeometry.setAttribute("normalVec",y);const x=new e.InterleavedBufferAttribute(p,1,9*h+8,!1);this.bufferGeometry.setAttribute("normalScale",x);const b=new e.InterleavedBuffer(l.slice(9*h,c.length-9*h),9),_=new e.InterleavedBufferAttribute(b,4,0);this.bufferGeometry.setAttribute("position",_),this.bufferGeometry.computeBoundingBox(),this.bufferGeometry.computeBoundingSphere(),this.bufferGeometry.computeVertexNormals();let w=[];if(this.options.strokeWidth){const t=[0,1,4,1,4,5,1,2,5,2,5,6,2,3,6,3,6,7];for(let e=4;e<c.length/9-8;e+=4){const n=e/4-1,r=t.map(t=>t+4*n);w=[...w,...r]}}else for(let t=2;t<c.length/9-4;t+=2)w.push(t-2,t-1,t),w.push(t,t-1,t+1);this.bufferGeometry.setIndex(w);const M=new e.Vector2(1,1),E=this.options.color?new $d.a(this.options.color):new $d.a("rgb(255, 255, 255)").alpha(0),S=this.options.strokeColor?new $d.a(this.options.strokeColor):new $d.a("rgb(255, 255, 255)").alpha(0);if(this.uniforms={stripTexture:{type:"t",value:null},fillColor:{type:"v4",value:new e.Vector4(E.red()/255,E.green()/255,E.blue()/255,E.alpha())},strokeColor:{type:"v4",value:new e.Vector4(S.red()/255,S.green()/255,S.blue()/255,S.alpha())},width:{type:"f",value:this.options.width||.3},strokeWidth:{type:"f",value:this.options.strokeWidth||.1},renderPixelLine:{type:"f",value:this.renderPixelLine?1:0},fillOpacity:{type:"f",value:this.options.fillOpacity||.8},resolution:{type:"v2",value:M},currentDistance:{type:"f",value:this.options.current||0},texOffset:{type:"f",value:0},fullLength:{type:"f",value:this.distances[this.distances.length-1]},viewDistance:{type:"f",value:null===this.options.viewDistance||void 0===this.options.viewDistance?15:this.options.viewDistance},gradientDistance:{type:"f",value:this.options.gradientDistance||4},gradientEnabled:{value:this.options.gradientEnabled||!1}},this.material=new e.ShaderMaterial({fragmentShader:_b.FragmentShader,vertexShader:_b.VertexShader,uniforms:this.uniforms,depthTest:!1,side:e.DoubleSide,wireframe:!1,transparent:!0,opacity:1,blending:e.NormalBlending,blendEquation:e.AddEquation,blendSrc:e.SrcAlphaFactor,blendDst:e.OneMinusSrcAlphaFactor}),this.options.textureUrl&&"repeat"===this.options.textureMode)(new e.TextureLoader).load(this.options.textureUrl,t=>{t.wrapS=e.RepeatWrapping,t.wrapT=e.RepeatWrapping,t.generateMipmaps=!0,this.uniforms.stripTexture.value=t,this.needsUpdate=!0});else if(this.options.textureUrl&&"tail"===this.options.textureMode){const t=this.distances[this.distances.length-1];this.updateTailArrowPos(t)}this.mesh=new e.Mesh(this.bufferGeometry,this.material),this.mesh.renderOrder=1e3,this.add(this.mesh)}setContainer(t){jd.GetEnv()!==Fd.Miniapp&&this.resize(t.clientWidth,t.clientHeight)}resize(t,e){if(this.viewWidth===t&&this.viewHeight===e)return;const n=new r.Vector2(t,e);this.uniforms.resolution.value=n,this.needsUpdate=!0,this.viewWidth=t,this.viewHeight=e}getBestView(t,e,n){let r=this.getPointOnDistance(e+.2).point,i=t;const{THREE:o}=Nd.getInstance();let s=e+1;for(;s<e+10;s+=1){const t=this.getPointOnDistance(s),e=(new o.Vector3).subVectors(t.point,r),n=(new o.Vector3).subVectors(r,i);if(o.MathUtils.radToDeg(e.angleTo(n))>30){r=this.getPointOnDistance(s+.5).point,i=t.point;break}}let a=0;for(let t=s;t<n;t++){const n=this.getPointOnDistance(t),s=(new o.Vector3).subVectors(n.point,r),u=(new o.Vector3).subVectors(r,i),c=o.MathUtils.radToDeg(s.angleTo(u));if(c>32&&t-e>10){a=t;break}if(c>20&&t-e>15){a=t;break}}return a-e}getPointOnDistance(t){const{THREE:e}=Nd.getInstance();let n=0;const{distances:r,points:i}=this;let o=i.length-1,s=-1;for(;n<o-1;)if(s=Math.floor((n+o)/2),r[s]>t)o=s;else{if(!(r[s]<t)){n=s;break}n=s}if(s=n,s>-1){const n=new e.Vector3(...this.points[s]);if(s===this.points.length-1||t<=0)return{point:n,index:s+1};const r=this.distances[s],i=new e.Vector3(...this.points[s+1]),o=this.distances[s+1]-r,a=i.clone().sub(n);return{point:n.clone().add(a.multiplyScalar((t-r)/o)),index:s+1}}throw new Error("Cannot find point on distance "+t)}getNearestPoint(t,e=0){const{THREE:n}=Nd.getInstance(),r=this.distances[this.distances.length-1];let i,o,s,a,u,c,l=8,h=new n.Vector3,p=0,f=1/0,d=-1;for(let n,i,o=e;o<=r;o+=l)n=this.getPointOnDistance(o),i=t.distanceTo(n.point),i<f&&(h=n.point,p=o,f=i,d=n.index);for(l/=2;l>.1;)s=p-l,u=t.distanceTo(i=this.getPointOnDistance(s).point),a=p+l,c=t.distanceTo(o=this.getPointOnDistance(a).point),s>=0&&u<f?(h=i,p=s,f=u):a<=r&&c<f?(h=o,p=a,f=c):l/=2;return{point:h,distance:p,index:d}}getPathWithScope(t,e){if(t>=e){const t=this.getPointOnDistance(e).point;return[[t.x,t.y,0]]}let n=this.distances.length-1,r=0;for(;n>=0&&this.distances[n]>t;)n-=1;for(;r<this.distances.length&&this.distances[r]<e;)r+=1;const i=this.getPointOnDistance(t).point,o=this.getPointOnDistance(e).point;return[[i.x,i.y,0],...this.points.slice(n+1,r-n-1),[o.x,o.y,0]]}getPathBaseStartPoint(t){const e=this.getPointOnDistance(t).point;for(let n=0;n<this.distances.length;n+=1)if(this.distances[n]>t)return[[e.x,e.y,0],...this.points.slice(n)];return this.points.slice(this.distances.length-1)}update(){const t=new tg(this);return!this.initialized&&this.ready?(this.initialized=!0,t.needUpdate=!0):this.needsUpdate&&(t.needUpdate=!0,this.needsUpdate=!1),this.options.animateEnabled&&(this.uniforms.texOffset.value-=this.options.animateSpeed,t.needUpdate=!0),this.initialized&&!this.parent&&(t.shouldPlaceElement=!0),t}dispose(){this.parentOverlay&&this.parentOverlay.removePath(this),super.dispose(),this.remove(this.mesh),this.material.dispose(),this.bufferGeometry.dispose()}setCurrent(t){this.uniforms.currentDistance.value=t,this.needsUpdate=!0}getLength(){return this.distances[this.distances.length-1]}setCurrentIndex(t){this.currentMoveIndex=t;const e=this.distances[t+1];this.uniforms.currentDistance.value=e,this.needsUpdate=!0}getCurrent(){return this.uniforms.currentDistance.value}getCurrentIndex(){return this.currentMoveIndex}setViewDistance(t){this.uniforms.viewDistance.value=t;const e=t+this.uniforms.currentDistance.value;if(this.options.textureUrl&&"tail"===this.options.textureMode){if(!this.tailArrow)return void setTimeout(()=>{this.setViewDistance(t)},1e3);this.updateTailArrowPos(e)}}updateTailArrowPos(t){if(!this.tailArrow)return void setTimeout(()=>{this.updateTailArrowPos(t)},1e3);this.tailArrow.visible=!0;const{index:e}=this.getPointOnDistance(t),n=this.orgedPoints[e],r=n.point[0],i=n.point[1],o=n.point[2],s=[-n.normal[1],n.normal[0]],a=Math.atan2(s[1],s[0])+Math.PI/2;this.tailArrow.position.set(r,i,o),this.tailArrow.rotation.z=a,this.needsUpdate=!0}setWidth(t){this.uniforms.width.value!==t&&(this.uniforms.width.value=t,this.needsUpdate=!0)}setColor(t){if(null==t)return;const e=new $d.a(t),n=this.uniforms.fillColor.value,{THREE:r}=Nd.getInstance(),i=new r.Vector4(e.red(),e.green(),e.blue(),e.alpha());i.equals(n)||(this.uniforms.fillColor.value=i,this.needsUpdate=!0)}getViewDistance(){return this.uniforms.viewDistance.value}setParentOverlay(t){this.parentOverlay=t}}_b.VertexShader="\n attribute vec4 last, current, next;\n attribute vec2 normalVec;\n attribute float normalScale;\n attribute float texoff;\n attribute float progress;\n\n varying vec2 texcoord;\n varying float vProgress;\n varying float isBorder;\n\n uniform float width;\n uniform float texOffset;\n uniform float strokeWidth;\n uniform float renderPixelLine;\n uniform vec2 resolution;\n\n float pi = 3.141592653589793;\n float fwidth = width;\n float swidth = strokeWidth;\n\n vec4 transform(vec3 coord){\n return projectionMatrix * modelViewMatrix * vec4(coord, 1.0);\n }\n\n vec2 project(vec4 device) {\n vec3 device_normal = device.xyz / device.w;\n vec2 clip_pos = (device_normal * 0.5 + 0.5).xy;\n return clip_pos * resolution;\n }\n\n vec4 unproject(vec2 screen, float z, float w) {\n vec2 clip_pos = screen / resolution;\n vec2 device_normal = clip_pos * 2.0 - 1.0;\n return vec4(device_normal * w, z, w);\n }\n\n // 计算系数: 0,0,0 到 0,1,0 对应的屏幕坐标距离 越大, coefficient越大\n float calcCoefficient() {\n vec3 p1 = vec3(0, 0, 0);\n vec2 sp1 = project(transform(p1.xyz));\n vec3 p2 = vec3(0, 1, 0);\n vec2 sp2 = project(transform(p2.xyz));\n // 计算屏幕坐标的距离\n float dist = distance(sp1, sp2);\n return dist * 10.0 / width;\n }\n\n void main(){\n vec2 sLast; // screenLast\n vec2 sNext; // screenNext\n vec2 sCurrent; // screenCurrent\n vec2 normal1; // normal1\n vec2 normal2; // normal2\n vec2 normal; // 当前normal\n vec4 dCurrent; //\n\n float coefficient = 10.0;\n float off = 1.0;\n if (current.w < 0.0 ) {\n off = -1.0;\n }\n vec4 position = vec4(0, 0, 0, 0);\n vec3 pos;\n\n float offsetW = fwidth / 2.0 * normalScale;\n isBorder = -1.0;\n if (abs(current.w) > 1.0) {\n offsetW = swidth + (fwidth / 2.0) * normalScale;\n isBorder = 1.0;\n }\n if (renderPixelLine < 1.0) {\n // 3d 中\n vec2 dir = vec2(normalVec.x, normalVec.y)*off;\n float factor = 0.6 / fwidth * 0.2;\n pos = vec3(current.xy + dir * offsetW, 0.0);\n texcoord = vec2(off*0.5+0.5, texoff * factor + texOffset);\n vProgress = progress;\n gl_Position = transform(pos);\n } else {\n // vec2 dir = vec2(normalVec.x, normalVec.y)*off;\n // pos = vec3(current.xy + dir * offsetW, 0.0);\n // texcoord = vec2(off*0.5+0.5, texoff*0.2 + texOffset);\n // vProgress = progress;\n // gl_Position = transform(pos);\n\n coefficient = calcCoefficient();\n sLast = project(transform(last.xyz)); // last的屏幕坐标\n sNext = project(transform(next.xyz)); // next的屏幕坐标\n\n dCurrent = transform(current.xyz);\n sCurrent = project(dCurrent); // current的屏幕坐标\n\n normal1 = normalize(sLast - sCurrent);\n vec2 normal2 = normalize(sCurrent - sNext);\n normal = normalize(normal1 + normal2);\n texcoord = vec2(off*0.5+0.5, texoff* 0.03 * coefficient + texOffset);\n vProgress = progress;\n\n vec2 dir = vec2(-normal.y, normal.x) * off;\n float cosAngle = abs(dot(dir, -normal1)); // cos 45 基本 为 0.79 得到的是弧度值\n float x = 90.0 - acos(cosAngle) * 180.0 / pi; // 得到角度 90 - x 则为需要 20 / length = cos(x)\n float divideBy = cos(x / 180.0 * pi);\n if (abs(divideBy) < 0.6) {\n float positiveNum = divideBy > 0.0 ? 1.0 : -1.0;\n divideBy = 0.6 * positiveNum;\n }\n pos = vec3((sCurrent + offsetW / divideBy * dir).xy, 0.0);\n position = unproject(pos.xy, 0.0, 1.0);\n gl_Position = position;\n }\n\n // texcoord = vec2(off*0.5+0.5, texoff* 0.03 * coefficient + texOffset);\n // vProgress = progress;\n\n // vec2 dir = vec2(-normal.y, normal.x) * off;\n // float cosAngle = abs(dot(dir, -normal1)); // cos 45 基本 为 0.79 得到的是弧度值\n // float x = 90.0 - acos(cosAngle) * 180.0 / pi; // 得到角度 90 - x 则为需要 20 / length = cos(x)\n // float divideBy = cos(x / 180.0 * pi);\n\n // vec4 position = vec4(0, 0, 0, 0);\n // vec3 pos;\n\n // if (renderPixelLine < 1.0) {\n // pos = current.xyz + vec3(dir * offsetW, 0.0);\n // position = transform(pos);\n // } else {\n // // 计算 dir 和 normal1 的夹角 , 要 叠加的长度 是 offsetW * dir\n // pos = vec3((sCurrent + offsetW / divideBy * dir).xy, 0.0);\n // position = unproject(pos.xy, 0.0, 1.0);\n // }\n\n // gl_Position = position;\n }\n ",_b.FragmentShader="\n uniform sampler2D stripTexture;\n uniform float currentDistance;\n uniform float fullLength;\n uniform float viewDistance;\n uniform float gradientDistance;\n uniform vec4 fillColor;\n uniform vec4 strokeColor;\n uniform bool gradientEnabled;\n uniform float renderPixelLine;\n uniform float fillOpacity;\n\n varying vec2 texcoord;\n varying float vProgress;\n varying float isBorder;\n\n float opacity = 1.0;\n\n void main(){\n vec4 texColor = texture2D(stripTexture, texcoord);\n\n float alpha = fillOpacity;\n float cur = currentDistance;\n float grad = gradientDistance;\n float view = viewDistance;\n\n if (gradientEnabled) {\n if (vProgress < cur) {\n alpha = 0.0;\n } else {\n if (vProgress > cur + view) {\n alpha = 0.0;\n } else {\n if (fullLength <= cur + view) {\n view = fullLength - cur;\n if (view < 2.0 * grad) {\n grad = view * 0.5;\n }\n }\n\n if (vProgress > cur + grad) {\n alpha = fillOpacity;\n if (vProgress > cur + view - grad) {\n alpha = abs(cur + view - vProgress) / grad * fillOpacity;\n }\n } else {\n alpha = abs(vProgress - cur) / grad * fillOpacity;\n }\n }\n }\n } else if (renderPixelLine == 1.0) {\n if (vProgress < cur) {\n alpha = 0.0;\n }\n }\n if (isBorder > -0.99) {\n gl_FragColor = vec4(strokeColor.rgb, opacity * alpha * strokeColor.a);\n } else {\n gl_FragColor = vec4((fillColor * (1.0 - texColor.a) + texColor * texColor.a).rgb, opacity * alpha * (fillColor.a * (1.0 - texColor.a) + texColor.a));\n }\n }\n ";class wb{constructor(t,e){this.values=new Map,this.capacity=t,this.totalCost=0,this.costCallback=e}get(t,e){let n;return this.values.has(t)?(n=this.values.get(t),n&&(this.values.delete(t),this.values.set(t,n))):e&&(n=e(t),n&&this.put(t,n)),n}put(t,e,n,r=!1){let i=!1;if(this.totalCost>=this.capacity){if(r)return i;const t=this.values.keys().next().value,e=this.values.get(t);if(e){const r=void 0===this.costCallback?1:this.costCallback(e);this.totalCost-=r,n&&n(t,e),this.values.delete(t)}i=!0}if(this.values.has(t)){let n=1;const r=this.values.get(t);r&&this.costCallback&&(n=this.costCallback(r));const i=void 0===this.costCallback?1:this.costCallback(e);this.values.set(t,e),this.totalCost+=i-n}else{this.values.set(t,e);const n=void 0===this.costCallback?1:this.costCallback(e);this.totalCost+=n}return i}recycle(t,e){let n=!1;const r=this.values.get(t);if(r){n=!0;const i=void 0===this.costCallback?1:this.costCallback(r);this.totalCost-=i,e&&e(t,r),this.values.delete(t)}return n}clear(t){this.values.forEach((e,n)=>{e&&t(n,e)}),this.totalCost=0,this.values.clear()}getCapacity(){return this.capacity}getTotalCost(){return this.totalCost}}var Mb=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};class Eb{constructor(t){const{THREE:e}=Nd.getInstance();this.textureLoader=new e.TextureLoader,this.textureCache=new wb(t),this.workingTasks=new Map}static disposeAll(){this.hdFaceTexturesCache.dispose(),this.ldFaceTexturesCache.dispose()}static get hdFaceTexturesCache(){return Eb.sharedHdFaceTextureCache||(Eb.sharedHdFaceTextureCache=new Eb(32)),Eb.sharedHdFaceTextureCache}static get ldFaceTexturesCache(){return Eb.sharedLdFaceTextureCache||(Eb.sharedLdFaceTextureCache=new Eb(32)),Eb.sharedLdFaceTextureCache}dispose(){this.textureCache.clear((t,e)=>{e.dispose()})}loadTexture(t,e=!0){return Mb(this,void 0,void 0,(function*(){const n=this.textureCache.get(t);if(n)return n;let r=this.workingTasks.get(t);return r||(r=new Promise((n,r)=>{this.textureLoader.load(t,r=>{this.textureCache.put(t,r,(t,e)=>{e.dispose()},!e),this.workingTasks.delete(t),n(r)},()=>{},e=>{kd.emit("error",`Loading '${t}' failed.`),this.workingTasks.delete(t),r(e)})}),this.workingTasks.set(t,r)),r}))}preloadTextures(t,e){return Mb(this,void 0,void 0,(function*(){const n=e>t.length?t.length:e,r=t.map((t,n)=>{if(t)return this.loadTexture(t,n<e)}),i=[];for(let t=0;t<n;t+=1){const e=r[t];e&&i.push(e)}return Promise.all(i)}))}recycleTexture(t){return this.textureCache.recycle(t,(t,e)=>{e.dispose()})}getCapacity(){return this.textureCache.getCapacity()}getTotalCost(){return this.textureCache.getTotalCost()}}var Sb=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};class Ab{constructor(t){this.cubeTextureCache=new wb(t),this.workingTasks=new Map}static disposeAll(){this.sharedInstance.dispose()}dispose(){this.cubeTextureCache.clear((t,e)=>{e.dispose()})}loadCubeTexture(t,e,n){return Sb(this,void 0,void 0,(function*(){const r=this.cubeTextureCache.get(t[0]);if(r)return r;const{THREE:i}=Nd.getInstance();let o=this.workingTasks.get(t[0]);return o||(o=new Promise(r=>Sb(this,void 0,void 0,(function*(){const o=(yield Eb.ldFaceTexturesCache.preloadTextures(t,t.length)).map(t=>t.image),s=new i.CubeTexture(o);s.needsUpdate=!0,!0===n&&t.forEach(t=>{Eb.ldFaceTexturesCache.recycleTexture(t)}),this.cubeTextureCache.put(t[0],s,(t,e)=>{e.dispose()},!e),this.workingTasks.delete(t[0]),r(s)}))),this.workingTasks.set(t[0],o)),o}))}preloadCubeTextures(t,e,n){return Sb(this,void 0,void 0,(function*(){const r=e>t.length?t.length:e,i=t.map((t,e)=>{if(t)return n?this.loadCubeTexture(t,e<r,n[e]):this.loadCubeTexture(t,e<r)}),o=[];for(let t=0;t<r;t+=1){const e=i[t];e&&o.push(e)}return Promise.all(o)}))}recycleCubeTexture(t){this.cubeTextureCache.recycle(t[0],(t,e)=>{e.dispose()})}getCapacity(){return this.cubeTextureCache.getCapacity()}}Ab.sharedInstance=new Ab(3);var Cb=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};class Tb extends eg{constructor(t,e,n,r,i=[],o,s,a,u,c,l=!1){super();const{THREE:h}=Nd.getInstance();this.pid=t,this.seqID=e,this.highTextureURLs=o||[],this.textureURLs=n,this.useLowTextureURLsOnly=!!s,this.tiledTextureURLRoot=a,this.neighborPanoramaIDs=i,this.viewConfigurations=new Map,this.panoViews=new Set,this.initialized=!1,this.needsUpdate=!1,this.legacyMode=l;const p=new h.BoxBufferGeometry(2,2,2);this.wireFrame=new h.LineSegments(new h.EdgesGeometry(p),new h.LineBasicMaterial({color:16711680})),this.wireFrame.material.visible=!1,this.wireFrame.renderOrder=100,this.add(this.wireFrame);const f=new h.SphereBufferGeometry(1,60,40);if(f.scale(1,-1,1),f.rotateY(-90*Math.PI/180),this.sphereMesh=new h.Mesh(f),this.sphereMesh.visible=!1,this.sphereMesh.renderOrder=150,this.add(this.sphereMesh),this.isPlayingVideo=!1,this.videoCanvas=null,this.videoContentType="mp4",this.legacyMode){const t="\n varying vec3 v_position;\n void main(){\n v_position = position;\n v_position.y = v_position.y * -1.0;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",e="\n uniform samplerCube tCube;\n varying vec3 v_position;\n void main(){\n gl_FragColor = textureCube(tCube, v_position);\n }",n={tCube:{type:"t",value:null}};this.uniforms=n,this.material=new h.ShaderMaterial({fragmentShader:e,vertexShader:t,uniforms:n,depthTest:!1,side:h.BackSide}),this.skyBox=new h.Mesh(new h.SphereBufferGeometry(2,32,32)),this.skyBox.frustumCulled=!1,this.skyBox.material=this.material,this.skyBox.renderOrder=100,this.add(this.skyBox),this.updateTexture()}else{const t="\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }",e="\n uniform sampler2D tFaceTexture;\n uniform vec2 uvScalar;\n uniform vec2 uvOffset;\n uniform vec4 blendColor;\n varying vec2 vUv;\n void main(){\n vec2 UV = vUv * uvScalar + uvOffset;\n vec4 texColor = texture2D(tFaceTexture, vec2(UV.s, 1.0 - UV.t));\n gl_FragColor = (1.0 - blendColor.a) * texColor + blendColor.a * blendColor;\n // gl_FragColor = vec4(vUv, 0.0, 1.0);\n }";[this.faceGridRows,this.faceGridCols]=r;const n=2/r[1],i=2/r[0];this.faceGridsStates=[],this.faceGridTextureCacheKeys=[],this.panoViews=new Set,this.faceGridsMaterials=[],this.faceGridsUniformses=[],this.skyBoxFaceGrids=[],this.gridCenters=[];for(let o=0;o<6;o++){const s=[],a=[],u=[],c=[],l=[],p=[];for(let o=0;o<r[0];o++){const f=[];for(let p=0;p<r[1];p++){const d=o*r[1]+p;s[d]=0,a[d]="",u[d]={tFaceTexture:{type:"t",value:null},uvScalar:{type:"v2",value:new h.Vector2(1,1)},uvOffset:{type:"v2",value:new h.Vector2(0,0)},blendColor:{type:"v4",value:new h.Vector4(0,0,0,0)}},c[d]=new h.ShaderMaterial({fragmentShader:e,vertexShader:t,uniforms:u[d],depthTest:!1,side:h.BackSide});const g=new h.PlaneBufferGeometry(n,i),m=new h.Mesh(g,c[d]);l[d]=m,m.visible=!0,m.frustumCulled=!1,m.material=c[d],m.renderOrder=100,this.add(m),f[p]=new h.Vector4(0,0,0,1)}p[o]=f}this.faceGridsStates[o]=s,this.faceGridTextureCacheKeys[o]=a,this.faceGridsUniformses[o]=u,this.faceGridsMaterials[o]=c,this.skyBoxFaceGrids[o]=l,this.gridCenters[o]=p}const o=new h.Matrix4,s=new h.Matrix4;for(let t=0;t<r[0];t++)for(let e=0;e<r[1];e++){const s=t*r[1]+e;for(let r=0;r<6;r++)o.makeTranslation(n/2-1+n*e,i/2-1+i*t,0),this.skyBoxFaceGrids[r][s].applyMatrix4(o),this.gridCenters[r][t][e].applyMatrix4(o)}for(let t=0;t<r[0];t++)for(let e=0;e<r[1];e++){const n=t*r[1]+e;o.makeTranslation(1,0,0),s.makeRotationY(Math.PI/2),this.skyBoxFaceGrids[0][n].applyMatrix4(s),this.skyBoxFaceGrids[0][n].applyMatrix4(o),this.gridCenters[0][t][e].applyMatrix4(s).applyMatrix4(o),o.makeTranslation(-1,0,0),s.makeRotationY(-Math.PI/2),this.skyBoxFaceGrids[1][n].applyMatrix4(s),this.skyBoxFaceGrids[1][n].applyMatrix4(o),this.gridCenters[1][t][e].applyMatrix4(s).applyMatrix4(o),o.makeTranslation(0,-1,0),s.makeRotationX(Math.PI/2),this.skyBoxFaceGrids[2][n].applyMatrix4(s),this.skyBoxFaceGrids[2][n].applyMatrix4(o),this.gridCenters[2][t][e].applyMatrix4(s).applyMatrix4(o),o.makeTranslation(0,1,0),s.makeRotationX(-Math.PI/2),this.skyBoxFaceGrids[3][n].applyMatrix4(s),this.skyBoxFaceGrids[3][n].applyMatrix4(o),this.gridCenters[3][t][e].applyMatrix4(s).applyMatrix4(o),o.makeTranslation(0,0,1),s.makeTranslation(0,0,0),this.skyBoxFaceGrids[4][n].applyMatrix4(s),this.skyBoxFaceGrids[4][n].applyMatrix4(o),this.gridCenters[4][t][e].applyMatrix4(s).applyMatrix4(o),o.makeTranslation(0,0,-1),s.makeRotationY(Math.PI),this.skyBoxFaceGrids[5][n].applyMatrix4(s),this.skyBoxFaceGrids[5][n].applyMatrix4(o),this.gridCenters[5][t][e].applyMatrix4(s).applyMatrix4(o)}}u&&this.position.copy(u),c&&this.quaternion.copy(c),this.baseQuaternion=(new h.Quaternion).copy(this.quaternion),this.additionalQuaternion=new h.Quaternion;const d=this.quaternion._onChangeCallback;this.quaternion._onChange(()=>{d();if((new h.Quaternion).multiplyQuaternions(this.baseQuaternion,this.additionalQuaternion).equals(this.quaternion))return;this.baseQuaternion=this.quaternion.clone();const{x:t,y:e,z:n,w:r}=(new h.Quaternion).multiplyQuaternions(this.baseQuaternion,this.additionalQuaternion);this.quaternion.set(t,e,n,r),this.needsUpdate=!0});const g=this.rotation._onChangeCallback;this.rotation._onChange(()=>{g();const t=this.additionalQuaternion.clone().invert();this.baseQuaternion=this.quaternion.clone().multiply(t)}),this.eventListeners={onPanoramaSelected:t=>{this.isSelected=t===this,this.isSelected&&this.emit(Ud.PANORAMA_SELECTED,this.pid)},onEnded:()=>{}},kd.on(zd.ELEMENT_SELECTED,this.eventListeners.onPanoramaSelected)}setTexture(t){this.uniforms.tCube.value=t,this.needsUpdate=!0,this.panoramaLoaded||this.emit(Ud.DID_LOAD_PANORAMA,this.pid),this.panoramaLoaded=!0}pauseVideo(){if("ts"===this.videoContentType)this.mpegVideoPlayer&&this.mpegVideoPlayer.pause();else{const t="pano_vid_"+this.pid;if(this.video=this.video||document.getElementById(t),!this.video)return;this.video.pause()}}resumeVideo(){return Cb(this,void 0,void 0,(function*(){if("ts"===this.videoContentType)this.mpegVideoPlayer&&this.mpegVideoPlayer.play();else{const t="pano_vid_"+this.pid;if(this.video=this.video||document.getElementById(t),!this.video)return;yield this.video.play()}}))}stopVideo(){if(this.sphereMesh.visible=!1,"ts"===this.videoContentType){this.mpegVideoPlayer&&(this.mpegVideoPlayer.stop(),this.mpegVideoPlayer.destroy(),this.mpegVideoPlayer=null);const t=this.sphereMesh.material.map;t&&t.dispose(),this.sphereMesh.material.dispose(),this.videoCanvas=null}else{const t="pano_vid_"+this.pid;this.video=this.video||document.getElementById(t);const e=this.sphereMesh.material.map;e&&e.dispose(),this.sphereMesh.material.dispose(),this.video&&(this.video.pause(),this.video.removeAttribute("src"),this.video.load(),this.video=null)}this.eventListeners.onEnded&&this.eventListeners.onEnded(),this.isPlayingVideo=!1,this.needsUpdate=!0}playVideo(t,e,n,r="mp4",i=[2048,2048]){const{onReadyToPlay:o,onEnded:s,onPrepareToPlay:a}=n||{};this.videoContentType=r;const{THREE:u}=Nd.getInstance();if(this.eventListeners.onEnded=s||(()=>{}),"ts"!==this.videoContentType){const n="pano_vid_"+this.pid;this.video=document.getElementById(n),this.video||(this.video=document.createElement("video"),this.video.id=n,this.video.setAttribute("webkit-playsinline","true"),this.video.setAttribute("x5-playsinline","true"),this.video.setAttribute("playsinline","true"),this.video.setAttribute("crossorigin","anonymous")),this.video.src=t,this.video.loop=!!e,this.video.addEventListener("playing",()=>{this.sphereMesh.visible=!0,this.needsUpdate=!0,o&&o(this.video),this.isPlayingVideo=!0}),this.video.addEventListener("ended",()=>{this.stopVideo()}),this.video.addEventListener("play",()=>{this.needsUpdate=!0,a&&a(this.video)}),this.video.play();const r=new u.VideoTexture(this.video);return r.needsUpdate=!0,this.sphereMesh.material=new u.MeshBasicMaterial({map:r,transparent:!1,depthTest:!1,depthWrite:!1}),this.video}{if(!JSMpeg||!JSMpeg.Player)throw new Error("JSMpeg is needed. Please get JSMpeg from https://github.com/phoboslab/jsmpeg");this.videoCanvas||(this.videoCanvas=document.createElement("canvas"),[this.videoCanvas.width,this.videoCanvas.height]=i),this.mpegVideoPlayer=new JSMpeg.Player(t,{canvas:this.videoCanvas,loop:e,autoplay:!1,disableGl:!1,onSourceEstablished:()=>{this.needsUpdate=!0,a&&a()},onPlay:()=>{this.sphereMesh.visible=!0,this.needsUpdate=!0,o&&o(),this.isPlayingVideo=!0},onPause:()=>{},onStalled:()=>{},onEnded:()=>{this.stopVideo()},chunkSize:8388608,videoBufferSize:4194304,decodeFirstFrame:!1,preserveDrawingBuffer:!1});const n=new u.CanvasTexture(this.videoCanvas);n.needsUpdate=!0,hb.DetectIOS()&&(n.flipY=!1),this.sphereMesh.material=new u.MeshBasicMaterial({map:n,transparent:!1,depthTest:!1,depthWrite:!1}),this.mpegVideoPlayer.source.established=!1,this.mpegVideoPlayer.source.loadedSize=0,this.mpegVideoPlayer.demuxer.startTime=0,this.mpegVideoPlayer.demuxer.currentTime=0,this.mpegVideoPlayer.demuxer.bits=null,this.mpegVideoPlayer.demuxer.leftoverBytes=null,this.mpegVideoPlayer.audioOut.resetEnqueuedTime(),this.mpegVideoPlayer.audioOut.unlock(),this.mpegVideoPlayer.seek(0),this.mpegVideoPlayer.play()}return null}getIntersectedTiles(t){if(!t)return{hdTiles:[],ldTiles:[]};const{THREE:e}=Nd.getInstance();this.updateMatrixWorld(),t.updateMatrixWorld();const n=t.position.clone(),r=this.gridCenters.map(t=>t.map(t=>t.map(t=>{const r=t.clone().applyMatrix4(this.matrixWorld);return new e.Vector3(r.x,r.y,r.z).sub(n).normalize()}))),i=new e.Vector3(0,0,-1).applyQuaternion(t.quaternion),o=[],s=[],a=Math.SQRT1_2;for(let t=0;t<6;t++)for(let e=0;e<this.faceGridRows;e++)for(let n=0;n<this.faceGridCols;n++){const u=r[t][e][n].dot(i);u>=a?o.push([t,e,n,u]):s.push([t,e,n,u])}return this.isPlayingVideo?{hdTiles:[],ldTiles:s}:{hdTiles:o,ldTiles:s}}setFaceTexture(t,e,n,r){const{THREE:i}=Nd.getInstance(),o=t[0],s=t[1],a=t[2],u=s*this.faceGridCols+a;this.faceGridsUniformses[o][u].tFaceTexture.value=e;const{uvScalar:c,uvOffset:l,blendColor:h}=n||{};this.faceGridsUniformses[o][u].uvScalar.value=c||new i.Vector2(1,1),this.faceGridsUniformses[o][u].uvOffset.value=l||new i.Vector2(0,0),this.faceGridsUniformses[o][u].blendColor.value=h||new i.Vector4(0,0,0,0),r&&(this.faceGridTextureCacheKeys[o][u]=r),this.needsUpdate=!0}updateTexture(t){return Cb(this,void 0,void 0,(function*(){if(this.legacyMode){t&&(this.textureURLs=t);const e=yield Ab.sharedInstance.loadCubeTexture(this.textureURLs);this.setTexture(e)}else{for(let t=0;t<6;t++)for(let e=this.faceGridCols*this.faceGridRows-1;e>=0;e--)this.faceGridsStates[t][e]=0;t&&(this.highTextureURLs=t,this.textureURLs=t)}this.needsUpdate=!0}))}updateHDGridTextures(t){return Cb(this,void 0,void 0,(function*(){if(this.useLowTextureURLsOnly)return[];const{THREE:e}=Nd.getInstance();if(this.tiledTextureURLRoot){const e=["r","l","t","d","f","b"],n=t.map(t=>`${this.tiledTextureURLRoot}${this.seqID}_${e[t[0]]}_${t[1]}-${t[2]}`),r=yield Eb.hdFaceTexturesCache.preloadTextures(n,t.length);for(let e=t.length-1;e>=0;e--)this.setFaceTexture(t[e],r[e],void 0,n[e]);return r}if(!this.highTextureURLs.length)return[];const n=t.map(t=>""+this.highTextureURLs[t[0]]),r=yield Eb.hdFaceTexturesCache.preloadTextures(n,t.length),i=new e.Vector2(1/this.faceGridCols,1/this.faceGridRows);for(let o=t.length-1;o>=0;o--){const s=new e.Vector2(i.x*t[o][2],i.y*t[o][1]);this.setFaceTexture(t[o],r[o],{uvScalar:i,uvOffset:s},n[o])}return r}))}updateLDGridTextures(t){return Cb(this,void 0,void 0,(function*(){const{THREE:e}=Nd.getInstance(),n=t.map(t=>""+this.textureURLs[t[0]]),r=yield Eb.ldFaceTexturesCache.preloadTextures(n,t.length),i=new e.Vector2(1/this.faceGridCols,1/this.faceGridRows);for(let o=t.length-1;o>=0;o--){const s=new e.Vector2(i.x*t[o][2],i.y*t[o][1]);this.setFaceTexture(t[o],r[o],{uvScalar:i,uvOffset:s},n[o])}return r}))}updateFaceGridsTextures(t,e){return Cb(this,void 0,void 0,(function*(){this.panoramaLoaded||this.emit(Ud.WILL_LOAD_PANORAMA,this.pid);const n=[];t.forEach(t=>{2!==this.faceGridsStates[t[0]][this.faceGridCols*t[1]+t[2]]&&n.push(t)}),yield this.updateLDGridTextures(n);const r=[];e.forEach(t=>{1!==this.faceGridsStates[t[0]][this.faceGridCols*t[1]+t[2]]&&r.push(t)}),yield this.updateLDGridTextures(r);for(let t=0;t<6;t++)for(let e=this.faceGridRows*this.faceGridCols-1;e>=0;e--)this.faceGridsStates[t][e]=0;t.forEach(t=>{this.faceGridsStates[t[0]][this.faceGridCols*t[1]+t[2]]=2}),e.forEach(t=>{this.faceGridsStates[t[0]][this.faceGridCols*t[1]+t[2]]=1}),this.updateHDGridTextures(n),this.panoramaLoaded||this.emit(Ud.DID_LOAD_PANORAMA,this.pid),this.panoramaLoaded=!0}))}setUseLowTexturesOnly(t){this.useLowTextureURLsOnly=t}isUseLowTexturesOnly(){return this.useLowTextureURLsOnly}dispose(){super.dispose(),this.faceGridsMaterials&&this.faceGridsMaterials.forEach(t=>{t.forEach(t=>{t.dispose()})}),this.skyBoxFaceGrids&&this.skyBoxFaceGrids.forEach(t=>{t.forEach(t=>{t.geometry&&t.geometry.dispose()})}),this.stopVideo(),this.eventListeners.onEnded&&(this.eventListeners.onEnded=null),this.sphereMesh&&this.sphereMesh.material&&this.sphereMesh.material.dispose(),this.initialized=!1,kd.off(zd.ELEMENT_SELECTED,this.eventListeners.onPanoramaSelected)}update(){const t=new tg(this);return this.initialized?(this.needsUpdate||this.isPlayingVideo)&&(t.needUpdate=!0,this.isPlayingVideo&&this.videoCanvas&&this.sphereMesh.material.map&&(this.sphereMesh.material.map.needsUpdate=!0),this.needsUpdate=!1):(this.initialized=!0,t.needUpdate=!0),this.initialized&&!this.parent&&(t.shouldPlaceElement=!0),t}setAdditionalRotationInEuler(t,e,n){const{THREE:r}=Nd.getInstance();this.additionalQuaternion.setFromEuler(new r.Euler(t,e,n));const{x:i,y:o,z:s,w:a}=this.baseQuaternion.clone().multiply(this.additionalQuaternion);return this.quaternion.set(i,o,s,a),this.needsUpdate=!0,this.additionalQuaternion.clone()}setAdditionalRotationInQuaternion(t,e,n,r){const{THREE:i}=Nd.getInstance();this.additionalQuaternion.set(t,e,n,r);const{x:o,y:s,z:a,w:u}=this.baseQuaternion.clone().multiply(this.additionalQuaternion);return this.quaternion.set(o,s,a,u),this.needsUpdate=!0,(new i.Euler).setFromQuaternion(this.additionalQuaternion)}addViewConfiguration(t){const e=this.viewConfigurations.get(t.targetView),n=Object.assign(Object.assign({},e),t);this.viewConfigurations.set(t.targetView,n),this.needsUpdate=!0}}var Pb,Ib=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};!function(t){t[t.AlwaysHide=0]="AlwaysHide",t[t.AlwaysShow=1]="AlwaysShow",t[t.Editing=2]="Editing",t[t.Show=3]="Show"}(Pb||(Pb={}));class Lb extends eg{constructor(t,e,n){super();const{THREE:r}=Nd.getInstance();this.initialized=!1;const{modelElement:i,groundParams:o,indicatorImageURL:s,invisibleIndicatorImageURL:a,indicatorWidth:u,indicatorHeight:c,indicatorPositionMap:l,globalScale:h}=e||{globalScale:1};this.currentPanoramaID=-1,this.panoramaMap=new Map,this.indicatorMap=new Map,this.indicatorVisibilityMap=new Map,this.indicatorHiddenMap=new Map,this.indicatorPositionMap=l||new Map,this.inSightIndicators=[],this.indicatorWidth=u||2*Lb.IndicatorRadius,this.indicatorHeight=c||2*Lb.IndicatorRadius,this.maxWorldDistance=13,this.globalScale=h||1,this.group=new r.Group,this.add(this.group),this.viewConfigurations=new Map,this.eventListeners={onFloorModelLoaded:t=>{t===this.modelElement&&this.updateIndicatorsPositions()}},this.groundParams=o,this.bindModelElement(i);const p=["varying vec2 vUv;","void main(){"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),f=["uniform sampler2D map;","uniform float opacity;","uniform vec4 blendColor;","varying vec2 vUv;","void main(){"," vec4 texColor = texture2D(map, vUv);"," gl_FragColor = vec4((texColor * (1.0 - blendColor.a) + blendColor * blendColor.a).rgb, texColor.a * opacity);","}"].join("\n");let d,g,m;this.indicatorShaderUniforms={map:{type:"t",value:null},blendColor:{type:"v4",value:new r.Vector4(0,0,0,0)},opacity:{value:1}},this.invisibleIndicatorShaderUniforms={map:{type:"t",value:null},blendColor:{type:"v4",value:new r.Vector4(1,0,0,.5)},opacity:{value:1}},this.indicatorMaterials=new Map,s?(g=new r.PlaneBufferGeometry(this.indicatorWidth,this.indicatorHeight),d=new r.ShaderMaterial({transparent:!0,vertexShader:p,fragmentShader:f,uniforms:this.indicatorShaderUniforms,side:r.DoubleSide,depthTest:!1,depthWrite:!1,name:"indicatorMaterial"}),this.indicatorImageURL=s,(new r.TextureLoader).load(s,t=>{this.indicatorShaderUniforms.map.value=t})):(g=new r.CircleGeometry(this.indicatorWidth/2,32),d=new r.MeshBasicMaterial({transparent:!0}),d.side=r.DoubleSide,d.depthTest=!1,d.depthWrite=!1,d.color=new r.Color(16777215));const v=a||s;v?(m=new r.ShaderMaterial({transparent:!0,vertexShader:p,fragmentShader:f,uniforms:this.invisibleIndicatorShaderUniforms,side:r.DoubleSide,depthTest:!1,depthWrite:!1,name:"invisibleIndicatorMaterial"}),(new r.TextureLoader).load(v,t=>{this.invisibleIndicatorShaderUniforms.map.value=t})):(m=new r.MeshBasicMaterial,m.side=r.DoubleSide,m.depthTest=!1,m.depthWrite=!1,m.color=new r.Color(16711680));const y=new r.Mesh(g,d);this.setIndicatorMeshPrototype(y),this.setIndicatorMaterial(d,Pb.Editing,!0),this.setIndicatorMaterial(m,Pb.Editing,!1),this.setIndicatorMaterial(d,Pb.Show,!0),this.panoramaDatas=new Map,t.forEach(t=>{this.panoramaDatas.set(t.pid,t)}),this.panoramaCreatingTasks=new Map,!0===n&&t.forEach(t=>{this.getPanoramaByPID(t.pid)}),this.modelElement instanceof Yx&&this.modelElement.isModelLoaded()&&this.updateIndicatorsPositions(),kd.on(zd.ELEMENT_LOADED,this.eventListeners.onFloorModelLoaded),this.initialized=!1,this.needUpdate=!1}dispose(t){super.dispose(),kd.off(zd.ELEMENT_LOADED,this.eventListeners.onFloorModelLoaded),this.panoramaMap&&(this.panoramaMap.forEach(e=>{this.group.remove(e),t!==e.pid&&Ab.sharedInstance.recycleCubeTexture(e.textureURLs),e.dispose()}),this.panoramaMap.clear()),this.indicatorMap&&(this.indicatorMap.forEach(t=>{this.group.remove(t)}),this.indicatorMap.clear()),this.boundBox&&(this.group.remove(this.boundBox),this.boundBox.geometry.dispose()),this.remove(this.group)}update(){const t=new tg(this);if(this.initialized)if(this.needUpdate){this.getPIDPositionMap(this.inSightIndicators).forEach((t,e)=>{if(!this.indicatorPositionMap.get(e)&&(this.groundParams||this.modelElement instanceof Yx)){let n;if(this.groundParams&&this.groundParams.groundPlane)n=Yx.intersectWithGroundPlane(t,this.groundParams);else{n=this.modelElement.intersectGround(t)}n&&this.indicatorPositionMap.set(e,n)}}),this.inSightIndicators.forEach(t=>{let e=this.indicatorMap.get(t);if(!e){e=this.indicatorMeshPrototype.clone(),this.indicatorMap.set(t,e),this.group.add(e);const n=this.panoramaDatas.get(t);n&&n.position&&e.position.copy(n.position)}const n=this.indicatorPositionMap.get(t);n&&e.position.copy(n)}),this.needUpdate=!1,t.needUpdate=!0}else this.panoramaMap.forEach(e=>{e.update().needUpdate&&(t.needUpdate=!0)});else this.initialized=!0,t.needUpdate=!0;return this.initialized&&!this.parent&&(t.shouldPlaceElement=!0),t}bindModelElement(t){t&&(this.modelElement=t),this.boundBox&&(this.group.remove(this.boundBox),this.boundBox=null),this.getModelBoundBox()}static getBoundBox(t){if(!t)return null;const{THREE:e}=Nd.getInstance(),n=(new e.Box3).setFromObject(t),r=n.getSize(new e.Vector3),i=Math.max(r.x,r.y,r.z),o=new e.Mesh(new e.BoxBufferGeometry(i,i,i));return o.position.copy(n.max.clone().add(n.min).multiplyScalar(.5)),o}getModelBoundBox(){this.boundBox||(this.boundBox=Lb.getBoundBox(this.modelElement),this.boundBox&&(this.boundBox.visible=!0,this.boundBox.frustumCulled=!1,this.boundBox.renderOrder=100,this.group.add(this.boundBox)))}setBoundBoxAppearance(t){this.getModelBoundBox(),this.boundBox&&(this.boundBox.material=t,this.needUpdate=!0)}setBoundBoxVisible(t){this.boundBox&&(this.boundBox.visible=t)}presentPanorama(t,e,n){return Ib(this,void 0,void 0,(function*(){t.legacyMode||(yield t.updateFaceGridsTextures(e,n),this.needUpdate=!0)}))}presentPanoramaOfPID(t,e,n){return Ib(this,void 0,void 0,(function*(){const r=yield this.getPanoramaByPID(t);r&&(yield this.presentPanorama(r,e,n)),this.currentPanoramaID=t,this.emit(Ud.PANORAMA_PRESENTED,t)}))}preloadCubeTexturesOfPIDs(t,e){return Ib(this,void 0,void 0,(function*(){const n=t.map(t=>{const e=this.panoramaDatas.get(t);if(e)return e.textureURLs});return Ab.sharedInstance.preloadCubeTextures(n,e)}))}visibleRadiusOfView(t){if(!t)return Lb.DefaultVisibleRadius;const e=this.viewConfigurations.get(t);return e&&e.visibleRadius?e.visibleRadius:Lb.DefaultVisibleRadius}allPanoramas(){return Ib(this,void 0,void 0,(function*(){const t=Array.from(this.panoramaMap.values()),e=yield Promise.all(Array.from(this.panoramaCreatingTasks.values()));return t.concat(e)}))}getAllPanoramas(){return Ib(this,void 0,void 0,(function*(){return this.initializePanoramasIfNecessary("all")}))}panoramaIDsAround(t,e){const n=this.panoramaDatas.get(t);if(!n||!n.position)return null;const r=[t],i=this.visibleRadiusOfView(e);return n.neighbourPanoramaIDs.map(t=>this.panoramaDatas.get(t)).forEach(t=>{if(t&&t.position){n.position.distanceTo(t.position)<=i&&r.push(t.pid)}}),r}presentPanoramaAround(t,e,n,r){return Ib(this,void 0,void 0,(function*(){this.panoramaIDsAround(t,r)&&(yield this.presentPanoramaOfPID(t,e,n))}))}getPIDPositionMap(t){const e=new Map;return t.forEach(t=>{const n=this.panoramaDatas.get(t);n&&e.set(t,n.position)}),e}getIndicatorPosition(t){return this.indicatorPositionMap.get(t)}presentPanoramaIndicators(t){if(!this.modelElement)return;this.inSightIndicators=[];const{THREE:e}=Nd.getInstance();t.forEach((t,n)=>{if(this.groundParams||this.modelElement instanceof Yx){if(!this.indicatorPositionMap.get(n)){let r;if(this.groundParams&&this.groundParams.groundPlane)r=Yx.intersectWithGroundPlane(t,this.groundParams);else{r=this.modelElement.intersectGround(t)}r&&this.indicatorPositionMap.set(n,r.add(new e.Vector3(0,0,Lb.IndicatorOffsetZ)))}}this.inSightIndicators.push(n)}),this.needUpdate=!0}updateIndicatorsPositions(){return Ib(this,void 0,void 0,(function*(){const{THREE:t}=Nd.getInstance();this.panoramaMap.forEach((e,n)=>{if(this.indicatorPositionMap.get(n))return;const{position:r}=e;let i;if(this.groundParams&&this.groundParams.groundPlane)i=Yx.intersectWithGroundPlane(r,this.groundParams);else{i=this.modelElement.intersectGround(r)}i&&this.indicatorPositionMap.set(n,i.add(new t.Vector3(0,0,Lb.IndicatorOffsetZ)))});const e=yield this.getPIDPositionMap(this.inSightIndicators);this.presentPanoramaIndicators(e)}))}presentPanoramaIndicatorsAround(t,e){return Ib(this,void 0,void 0,(function*(){const n=this.panoramaIDsAround(t,e);if(n){const t=yield this.getPIDPositionMap(n);this.presentPanoramaIndicators(t)}}))}getIndicatorVisibility(t){const e=this.indicatorVisibilityMap.get(t);return void 0===e||e}setIndicatorVisibility(t,e){let n;void 0===e?(n=[],this.indicatorMap.forEach((t,e)=>{n.push(e)})):n=Array.isArray(e)?e:[e],n.forEach(e=>{this.indicatorVisibilityMap.set(e,t);const n=this.indicatorMap.get(e);n&&(this.group.remove(n),this.indicatorMap.delete(e))}),this.needUpdate=!0}setIndicatorHidden(t,e){let n;void 0===e?(n=[],this.indicatorMap.forEach((t,e)=>{n.push(e)})):n=Array.isArray(e)?e:[e],n.forEach(e=>{this.indicatorHiddenMap.set(e,t);const n=this.indicatorMap.get(e);n&&(this.group.remove(n),this.indicatorMap.delete(e))}),this.needUpdate=!0}intersectIndicators(t,e){let n=[];const r=e.normalize(),i=Math.min(this.indicatorHeight,this.indicatorWidth)/2;return this.indicatorMap.forEach((e,o)=>{const s=e.position;if(Number.isNaN(s.x))return;const a=s.clone().sub(t),u=a.dot(r);if(u>0){const t=r.clone().multiplyScalar(u),e=a.sub(t).length();e<=i&&n.push({pid:o,distance:e})}}),n.length>0?(n=n.sort((t,e)=>t.distance<e.distance?-1:t.distance>e.distance?1:0),n[0].pid):-1}intersectIndicatorsOnScreen(t,e,{screenWidth:n,screenHeight:r},i){const o=Array.from(this.indicatorMap),s=o.map(([,t])=>t),a=ky.getMouseIntersectionOnScreen(s,t,{screenWidth:n,screenHeight:r},e,i,s,this.maxWorldDistance);if(a){const t=o.find(([,t])=>t===a);if(t)return t[0]}return-1}putPanorama(t){const e=this.panoramaMap.get(t.pid);e&&(this.group.remove(e),e.dispose()),this.panoramaMap.set(t.pid,t),this.group.add(t),this.needUpdate=!0}initializePanoramasIfNecessary(t){return Ib(this,void 0,void 0,(function*(){let e=[];if(Array.isArray(t))e=t;else if("all"===t)e=Array.from(this.panoramaDatas.keys());else{const n=t;e.push(n);const r=new Set;r.add(n);const i=[n];for(;i.length>0;){const t=i.splice(0,1)[0],n=this.panoramaDatas.get(t);n&&n.neighbourPanoramaIDs.forEach(t=>{r.has(t)||(r.add(t),i.push(t),e.push(t))})}}const n=e.map(t=>this.getPanoramaByPID(t));return Promise.all(n)}))}getPanoramaByPID(t){return Ib(this,void 0,void 0,(function*(){const e=this.panoramaMap.get(t);if(e)return e;const n=this.panoramaCreatingTasks.get(t);if(n)return n;const r=this.panoramaDatas.get(t);if(!r)return;const i=new Promise(t=>{const e=new Tb(r.pid,r.seqID,r.textureURLs,[2,2],r.neighbourPanoramaIDs,r.highTextureURLs,r.useLowTextureURLsOnly,r.tiledTextureURLRoot,r.position,r.quaternion,!!r.legacyMode);e.scale.set(this.globalScale,this.globalScale,this.globalScale),this.putPanorama(e),this.panoramaCreatingTasks.delete(r.pid),t(e)});return this.panoramaCreatingTasks.set(r.pid,i),i}))}getPanoramaByPIDInstant(t){return this.panoramaMap.get(t)||null}getNeghbourPanoClosestToRay(t){if(-1===this.currentPanoramaID)return-1;const e=this.panoramaMap.get(this.currentPanoramaID);if(!e)return-1;if(!e.neighborPanoramaIDs||0===e.neighborPanoramaIDs.length)return-1;const n=t.clone().normalize();let r=-1,i=-1;return e.neighborPanoramaIDs.forEach(t=>{const o=this.panoramaMap.get(t);if(!o)return;const s=o.position.clone().sub(e.position).normalize().dot(n);s>r&&(r=s,i=t)}),r>=Math.cos(12*Math.PI/180)?i:-1}updateIndicatorGeometry(){const{THREE:t}=Nd.getInstance();let e;e=this.indicatorImageURL?new t.PlaneBufferGeometry(this.indicatorWidth,this.indicatorHeight):new t.CircleGeometry(this.indicatorWidth/2,32);const n=new Set;Array.from(this.indicatorMap).forEach(([,t])=>{n.add(t.geometry),t.geometry=e}),Array.from(n).forEach(t=>{t.dispose()}),this.indicatorMeshPrototype.geometry=e;const r=new t.Mesh(e,this.indicatorMeshPrototype.material);this.setIndicatorMeshPrototype(r)}setIndicatorSize(t,e){this.indicatorWidth=t,this.indicatorHeight=e,this.updateIndicatorGeometry()}setIndicatorImageURL(t){const{THREE:e}=Nd.getInstance();(new e.TextureLoader).load(t,n=>{const r=["varying vec2 vUv;","void main(){"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),i=["uniform sampler2D map;","uniform float opacity;","uniform vec4 blendColor;","varying vec2 vUv;","void main(){"," vec4 texColor = texture2D(map, vUv);"," gl_FragColor = vec4((texColor * (1.0 - blendColor.a) + blendColor * blendColor.a).rgb, texColor.a * opacity);","}"].join("\n");let o=this.getIndicatorMaterial(Pb.Editing,!0),s=new e.ShaderMaterial({transparent:!0,vertexShader:r,fragmentShader:i,uniforms:this.indicatorShaderUniforms,side:e.DoubleSide,depthTest:!1,depthWrite:!1,name:"indicatorMaterial"});this.setIndicatorMaterial(s,Pb.Editing,!0),o.dispose(),o=this.getIndicatorMaterial(Pb.Show,!0),this.setIndicatorMaterial(s,Pb.Show,!0),o.dispose(),s=new e.ShaderMaterial({transparent:!0,vertexShader:r,fragmentShader:i,uniforms:this.invisibleIndicatorShaderUniforms,side:e.DoubleSide,depthTest:!1,depthWrite:!1,name:"invisibleIndicatorMaterial"}),this.indicatorShaderUniforms.map.value=n,this.invisibleIndicatorShaderUniforms.map.value=n,this.setIndicatorMaterial(s,Pb.Editing,!1),this.indicatorImageURL||this.setIndicatorMeshPrototype(new e.Mesh(new e.PlaneBufferGeometry(this.indicatorWidth,this.indicatorHeight),s)),this.indicatorImageURL=t,this.needUpdate=!0,this.updateIndicatorGeometry()})}getIndicatorSize(){return[this.indicatorWidth,this.indicatorHeight]}setIndicatorMeshPrototype(t){this.indicatorMeshPrototype=t,this.panoramaMap.forEach((t,e)=>{const n=this.indicatorMap.get(e);n&&(this.group.remove(n),this.indicatorMap.delete(e))}),t.renderOrder=300,this.needUpdate=!0}setIndicatorMaterial(t,e,n){let r=this.indicatorMaterials.get(e);r||(r=new Map,this.indicatorMaterials.set(e,r)),r.set(n,t),this.needUpdate=!0}getIndicatorMaterial(t,e){let n=this.indicatorMaterials.get(t);return n||(n=new Map,this.indicatorMaterials.set(t,n)),n.get(e)}addGroupViewConfiguration(t){const e=this.viewConfigurations.get(t.targetView);e&&(void 0===t.showBoundBox&&void 0!==e.showBoundBox&&(t.showBoundBox=e.showBoundBox),void 0===t.visibleRadius&&void 0!==e.visibleRadius&&(t.visibleRadius=e.visibleRadius),void 0===t.indicatorDisplayMode&&void 0!==e.indicatorDisplayMode&&(t.indicatorDisplayMode=e.indicatorDisplayMode)),this.viewConfigurations.set(t.targetView,t),this.needUpdate=!0}addViewConfiguration(t){return Ib(this,void 0,void 0,(function*(){(yield this.allPanoramas()).forEach(e=>{e.addViewConfiguration(t)})}))}setMaxWorldDistance(t){this.maxWorldDistance=t}}Lb.DefaultVisibleRadius=10,Lb.IndicatorRadius=.1,Lb.IndicatorOffsetZ=.1;r.Vector3;r.CameraHelper;var Rb=function(){function t(t){Hl.call(this,t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(t){return new o(t)})),this.register((function(t){return new a(t)})),this.register((function(t){return new u(t)})),this.register((function(t){return new s(t)})),this.register((function(t){return new r(t)})),this.register((function(t){return new c(t)}))}function e(){var t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}t.prototype=Object.assign(Object.create(Hl.prototype),{constructor:t,load:function(t,e,n,r){var i,o=this;i=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:zh.extractUrlBase(t),this.manager.itemStart(t);var s=function(e){r?r(e):console.error(e),o.manager.itemError(t),o.manager.itemEnd(t)},a=new jl(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(n){try{o.parse(n,i,(function(n){e(n),o.manager.itemEnd(t)}),s)}catch(t){s(t)}}),n,s)},setDRACOLoader:function(t){return this.dracoLoader=t,this},setDDSLoader:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')},setKTX2Loader:function(t){return this.ktx2Loader=t,this},setMeshoptDecoder:function(t){return this.meshoptDecoder=t,this},register:function(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this},unregister:function(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this},parse:function(t,e,r,o){var s,a={},u={};if("string"==typeof t)s=t;else if(zh.decodeText(new Uint8Array(t,0,4))===l){try{a[n.KHR_BINARY_GLTF]=new f(t)}catch(t){return void(o&&o(t))}s=a[n.KHR_BINARY_GLTF].content}else s=zh.decodeText(new Uint8Array(t));var c=JSON.parse(s);if(void 0===c.asset||c.asset.version[0]<2)o&&o(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var h=new j(c,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});h.fileLoader.setRequestHeader(this.requestHeader);for(var p=0;p<this.pluginCallbacks.length;p++){var m=this.pluginCallbacks[p](h);u[m.name]=m,a[m.name]=!0}if(c.extensionsUsed)for(p=0;p<c.extensionsUsed.length;++p){var x=c.extensionsUsed[p],b=c.extensionsRequired||[];switch(x){case n.KHR_MATERIALS_UNLIT:a[x]=new i;break;case n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:a[x]=new v;break;case n.KHR_DRACO_MESH_COMPRESSION:a[x]=new d(c,this.dracoLoader);break;case n.KHR_TEXTURE_TRANSFORM:a[x]=new g;break;case n.KHR_MESH_QUANTIZATION:a[x]=new y;break;default:b.indexOf(x)>=0&&void 0===u[x]&&console.warn('THREE.GLTFLoader: Unknown extension "'+x+'".')}}h.setExtensions(a),h.setPlugins(u),h.parse(r,o)}}});var n={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};function r(t){this.parser=t,this.name=n.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}function i(){this.name=n.KHR_MATERIALS_UNLIT}function o(t){this.parser=t,this.name=n.KHR_MATERIALS_CLEARCOAT}function s(t){this.parser=t,this.name=n.KHR_MATERIALS_TRANSMISSION}function a(t){this.parser=t,this.name=n.KHR_TEXTURE_BASISU}function u(t){this.parser=t,this.name=n.EXT_TEXTURE_WEBP,this.isSupported=null}function c(t){this.name=n.EXT_MESHOPT_COMPRESSION,this.parser=t}r.prototype._markDefs=function(){for(var t=this.parser,e=this.parser.json.nodes||[],n=0,r=e.length;n<r;n++){var i=e[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&t._addNodeRef(this.cache,i.extensions[this.name].light)}},r.prototype._loadLight=function(t){var e=this.parser,n="light:"+t,r=e.cache.get(n);if(r)return r;var i,o=e.json,s=((o.extensions&&o.extensions[this.name]||{}).lights||[])[t],a=new ki(16777215);void 0!==s.color&&a.fromArray(s.color);var u=void 0!==s.range?s.range:0;switch(s.type){case"directional":(i=new Bh(a)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new Rh(a)).distance=u;break;case"spot":(i=new Ch(a)).distance=u,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,i.angle=s.spot.outerConeAngle,i.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return i.position.set(0,0,0),i.decay=2,void 0!==s.intensity&&(i.intensity=s.intensity),i.name=e.createUniqueName(s.name||"light_"+t),r=Promise.resolve(i),e.cache.add(n,r),r},r.prototype.createNodeAttachment=function(t){var e=this,n=this.parser,r=n.json.nodes[t],i=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===i?null:this._loadLight(i).then((function(t){return n._getNodeRef(e.cache,i,t)}))},i.prototype.getMaterialType=function(){return Gi},i.prototype.extendParams=function(t,e,n){var r=[];t.color=new ki(1,1,1),t.opacity=1;var i=e.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){var o=i.baseColorFactor;t.color.fromArray(o),t.opacity=o[3]}void 0!==i.baseColorTexture&&r.push(n.assignTexture(t,"map",i.baseColorTexture))}return Promise.all(r)},o.prototype.getMaterialType=function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ml:null},o.prototype.extendMaterialParams=function(t,e){var n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],o=r.extensions[this.name];if(void 0!==o.clearcoatFactor&&(e.clearcoat=o.clearcoatFactor),void 0!==o.clearcoatTexture&&i.push(n.assignTexture(e,"clearcoatMap",o.clearcoatTexture)),void 0!==o.clearcoatRoughnessFactor&&(e.clearcoatRoughness=o.clearcoatRoughnessFactor),void 0!==o.clearcoatRoughnessTexture&&i.push(n.assignTexture(e,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),void 0!==o.clearcoatNormalTexture&&(i.push(n.assignTexture(e,"clearcoatNormalMap",o.clearcoatNormalTexture)),void 0!==o.clearcoatNormalTexture.scale)){var s=o.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new er(s,-s)}return Promise.all(i)},s.prototype.getMaterialType=function(t){var e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ml:null},s.prototype.extendMaterialParams=function(t,e){var n=this.parser,r=n.json.materials[t];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();var i=[],o=r.extensions[this.name];return void 0!==o.transmissionFactor&&(e.transmission=o.transmissionFactor),void 0!==o.transmissionTexture&&i.push(n.assignTexture(e,"transmissionMap",o.transmissionTexture)),Promise.all(i)},a.prototype.loadTexture=function(t){var e=this.parser,n=e.json,r=n.textures[t];if(!r.extensions||!r.extensions[this.name])return null;var i=r.extensions[this.name],o=n.images[i.source],s=e.options.ktx2Loader;if(!s){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,o,s)},u.prototype.loadTexture=function(t){var e=this.name,n=this.parser,r=n.json,i=r.textures[t];if(!i.extensions||!i.extensions[e])return null;var o=i.extensions[e],s=r.images[o.source],a=n.textureLoader;if(s.uri){var u=n.options.manager.getHandler(s.uri);null!==u&&(a=u)}return this.detectSupport().then((function(i){if(i)return n.loadTextureImage(t,s,a);if(r.extensionsRequired&&r.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(t)}))},u.prototype.detectSupport=function(){return this.isSupported||(this.isSupported=new Promise((function(t){var e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported},c.prototype.loadBufferView=function(t){var e=this.parser.json,n=e.bufferViews[t];if(n.extensions&&n.extensions[this.name]){var r=n.extensions[this.name],i=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([i,o.ready]).then((function(t){var e=r.byteOffset||0,n=r.byteLength||0,i=r.count,s=r.byteStride,a=new ArrayBuffer(i*s),u=new Uint8Array(t[0],e,n);return o.decodeGltfBuffer(new Uint8Array(a),i,s,u,r.mode,r.filter),a}))}return null};var l="glTF",h=1313821514,p=5130562;function f(t){this.name=n.KHR_BINARY_GLTF,this.content=null,this.body=null;var e=new DataView(t,0,12);if(this.header={magic:zh.decodeText(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==l)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var r=this.header.length-12,i=new DataView(t,12),o=0;o<r;){var s=i.getUint32(o,!0);o+=4;var a=i.getUint32(o,!0);if(o+=4,a===h){var u=new Uint8Array(t,12+o,s);this.content=zh.decodeText(u)}else if(a===p){var c=12+o;this.body=t.slice(c,c+s)}o+=s}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}function d(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=n.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}function g(){this.name=n.KHR_TEXTURE_TRANSFORM}function m(t){gl.call(this),this.isGLTFSpecularGlossinessMaterial=!0;var e=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),n=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),r=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\ttexelSpecular = sRGBToLinear( texelSpecular );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),i=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),o=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor;"].join("\n"),s={specular:{value:(new ki).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=s,this.onBeforeCompile=function(t){for(var a in s)t.uniforms[a]=s[a];t.fragmentShader=t.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",e).replace("#include <metalnessmap_pars_fragment>",n).replace("#include <roughnessmap_fragment>",r).replace("#include <metalnessmap_fragment>",i).replace("#include <lights_physical_fragment>",o)},Object.defineProperties(this,{specular:{get:function(){return s.specular.value},set:function(t){s.specular.value=t}},specularMap:{get:function(){return s.specularMap.value},set:function(t){s.specularMap.value=t,t?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return s.glossiness.value},set:function(t){s.glossiness.value=t}},glossinessMap:{get:function(){return s.glossinessMap.value},set:function(t){s.glossinessMap.value=t,t?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(t)}function v(){return{name:n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return m},extendParams:function(t,e,n){var r=e.extensions[this.name];t.color=new ki(1,1,1),t.opacity=1;var i=[];if(Array.isArray(r.diffuseFactor)){var o=r.diffuseFactor;t.color.fromArray(o),t.opacity=o[3]}if(void 0!==r.diffuseTexture&&i.push(n.assignTexture(t,"map",r.diffuseTexture)),t.emissive=new ki(0,0,0),t.glossiness=void 0!==r.glossinessFactor?r.glossinessFactor:1,t.specular=new ki(1,1,1),Array.isArray(r.specularFactor)&&t.specular.fromArray(r.specularFactor),void 0!==r.specularGlossinessTexture){var s=r.specularGlossinessTexture;i.push(n.assignTexture(t,"glossinessMap",s)),i.push(n.assignTexture(t,"specularMap",s))}return Promise.all(i)},createMaterial:function(t){var e=new m(t);return e.fog=!0,e.color=t.color,e.map=void 0===t.map?null:t.map,e.lightMap=null,e.lightMapIntensity=1,e.aoMap=void 0===t.aoMap?null:t.aoMap,e.aoMapIntensity=1,e.emissive=t.emissive,e.emissiveIntensity=1,e.emissiveMap=void 0===t.emissiveMap?null:t.emissiveMap,e.bumpMap=void 0===t.bumpMap?null:t.bumpMap,e.bumpScale=1,e.normalMap=void 0===t.normalMap?null:t.normalMap,e.normalMapType=wn,t.normalScale&&(e.normalScale=t.normalScale),e.displacementMap=null,e.displacementScale=1,e.displacementBias=0,e.specularMap=void 0===t.specularMap?null:t.specularMap,e.specular=t.specular,e.glossinessMap=void 0===t.glossinessMap?null:t.glossinessMap,e.glossiness=t.glossiness,e.alphaMap=null,e.envMap=void 0===t.envMap?null:t.envMap,e.envMapIntensity=1,e.refractionRatio=.98,e}}}function y(){this.name=n.KHR_MESH_QUANTIZATION}function x(t,e,n,r){Sl.call(this,t,e,n,r)}d.prototype.decodePrimitive=function(t,e){var n=this.json,r=this.dracoLoader,i=t.extensions[this.name].bufferView,o=t.extensions[this.name].attributes,s={},a={},u={};for(var c in o){var l=O[c]||c.toLowerCase();s[l]=o[c]}for(c in t.attributes){l=O[c]||c.toLowerCase();if(void 0!==o[c]){var h=n.accessors[t.attributes[c]],p=C[h.componentType];u[l]=p,a[l]=!0===h.normalized}}return e.getDependency("bufferView",i).then((function(t){return new Promise((function(e){r.decodeDracoFile(t,(function(t){for(var n in t.attributes){var r=t.attributes[n],i=a[n];void 0!==i&&(r.normalized=i)}e(t)}),s,u)}))}))},g.prototype.extendTexture=function(t,e){return t=t.clone(),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),void 0!==e.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),t.needsUpdate=!0,t},m.prototype=Object.create(gl.prototype),m.prototype.constructor=m,m.prototype.copy=function(t){return gl.prototype.copy.call(this,t),this.specularMap=t.specularMap,this.specular.copy(t.specular),this.glossinessMap=t.glossinessMap,this.glossiness=t.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this},x.prototype=Object.create(Sl.prototype),x.prototype.constructor=x,x.prototype.copySampleValue_=function(t){for(var e=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=t*r*3+r,o=0;o!==r;o++)e[o]=n[i+o];return e},x.prototype.beforeStart_=x.prototype.copySampleValue_,x.prototype.afterEnd_=x.prototype.copySampleValue_,x.prototype.interpolate_=function(t,e,n,r){for(var i=this.resultBuffer,o=this.sampleValues,s=this.valueSize,a=2*s,u=3*s,c=r-e,l=(n-e)/c,h=l*l,p=h*l,f=t*u,d=f-u,g=-2*p+3*h,m=p-h,v=1-g,y=m-h+l,x=0;x!==s;x++){var b=o[d+x+s],_=o[d+x+a]*c,w=o[f+x+s],M=o[f+x]*c;i[x]=v*b+y*_+g*w+m*M}return i};var b=0,_=1,w=2,M=3,E=4,S=5,A=6,C={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},T={9728:Pt,9729:Dt,9984:It,9985:Bt,9986:Rt,9987:Nt},I={33071:Ct,33648:Tt,10497:At},R={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},O={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},D={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},B={CUBICSPLINE:void 0,LINEAR:en,STEP:tn},F="OPAQUE",N="MASK",k="BLEND";function G(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}function U(t,e,n){for(var r in n.extensions)void 0===t[r]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[r]=n.extensions[r])}function z(t,e){void 0!==e.extras&&("object"==typeof e.extras?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function H(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(var n=0,r=e.weights.length;n<r;n++)t.morphTargetInfluences[n]=e.weights[n];if(e.extras&&Array.isArray(e.extras.targetNames)){var i=e.extras.targetNames;if(t.morphTargetInfluences.length===i.length){t.morphTargetDictionary={};for(n=0,r=i.length;n<r;n++)t.morphTargetDictionary[i[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function V(t){for(var e="",n=Object.keys(t).sort(),r=0,i=n.length;r<i;r++)e+=n[r]+":"+t[n[r]]+";";return e}function j(t,n){this.json=t||{},this.extensions={},this.plugins={},this.options=n||{},this.cache=new e,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.nodeNamesUsed={},"undefined"!=typeof createImageBitmap&&!1===/Firefox/.test(navigator.userAgent)?this.textureLoader=new Jh(this.options.manager):this.textureLoader=new Kl(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new jl(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function W(t,e,n){var r=e.attributes,i=[];function o(e,r){return n.getDependency("accessor",e).then((function(e){t.setAttribute(r,e)}))}for(var s in r){var a=O[s]||s.toLowerCase();a in t.attributes||i.push(o(r[s],a))}if(void 0!==e.indices&&!t.index){var u=n.getDependency("accessor",e.indices).then((function(e){t.setIndex(e)}));i.push(u)}return z(t,e),function(t,e,n){var r=e.attributes,i=new gr;if(void 0!==r.POSITION){var o=(f=n.json.accessors[r.POSITION]).min,s=f.max;if(void 0!==o&&void 0!==s){i.set(new pr(o[0],o[1],o[2]),new pr(s[0],s[1],s[2]));var a=e.targets;if(void 0!==a){for(var u=new pr,c=new pr,l=0,h=a.length;l<h;l++){var p=a[l];if(void 0!==p.POSITION){var f;o=(f=n.json.accessors[p.POSITION]).min,s=f.max;void 0!==o&&void 0!==s?(c.setX(Math.max(Math.abs(o[0]),Math.abs(s[0]))),c.setY(Math.max(Math.abs(o[1]),Math.abs(s[1]))),c.setZ(Math.max(Math.abs(o[2]),Math.abs(s[2]))),u.max(c)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(u)}t.boundingBox=i;var d=new Dr;i.getCenter(d.center),d.radius=i.min.distanceTo(i.max)/2,t.boundingSphere=d}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(t,e,n),Promise.all(i).then((function(){return void 0!==e.targets?function(t,e,n){for(var r=!1,i=!1,o=0,s=e.length;o<s;o++){if(void 0!==(c=e[o]).POSITION&&(r=!0),void 0!==c.NORMAL&&(i=!0),r&&i)break}if(!r&&!i)return Promise.resolve(t);var a=[],u=[];for(o=0,s=e.length;o<s;o++){var c=e[o];if(r){var l=void 0!==c.POSITION?n.getDependency("accessor",c.POSITION):t.attributes.position;a.push(l)}if(i){l=void 0!==c.NORMAL?n.getDependency("accessor",c.NORMAL):t.attributes.normal;u.push(l)}}return Promise.all([Promise.all(a),Promise.all(u)]).then((function(e){var n=e[0],o=e[1];return r&&(t.morphAttributes.position=n),i&&(t.morphAttributes.normal=o),t.morphTargetsRelative=!0,t}))}(t,e.targets,n):t}))}function q(t,e){var n=t.getIndex();if(null===n){var r=[],i=t.getAttribute("position");if(void 0===i)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(var o=0;o<i.count;o++)r.push(o);t.setIndex(r),n=t.getIndex()}var s=n.count-2,a=[];if(e===hn)for(o=1;o<=s;o++)a.push(n.getX(0)),a.push(n.getX(o)),a.push(n.getX(o+1));else for(o=0;o<s;o++)o%2==0?(a.push(n.getX(o)),a.push(n.getX(o+1)),a.push(n.getX(o+2))):(a.push(n.getX(o+2)),a.push(n.getX(o+1)),a.push(n.getX(o)));a.length/3!==s&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var u=t.clone();return u.setIndex(a),u}return j.prototype.setExtensions=function(t){this.extensions=t},j.prototype.setPlugins=function(t){this.plugins=t},j.prototype.parse=function(t,e){var n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll((function(t){return t._markDefs&&t._markDefs()})),Promise.all(this._invokeAll((function(t){return t.beforeRoot&&t.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(e){var o={scene:e[0][r.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:r.asset,parser:n,userData:{}};U(i,o,r),z(o,r),Promise.all(n._invokeAll((function(t){return t.afterRoot&&t.afterRoot(o)}))).then((function(){t(o)}))})).catch(e)},j.prototype._markDefs=function(){for(var t=this.json.nodes||[],e=this.json.skins||[],n=this.json.meshes||[],r=0,i=e.length;r<i;r++)for(var o=e[r].joints,s=0,a=o.length;s<a;s++)t[o[s]].isBone=!0;for(var u=0,c=t.length;u<c;u++){var l=t[u];void 0!==l.mesh&&(this._addNodeRef(this.meshCache,l.mesh),void 0!==l.skin&&(n[l.mesh].isSkinnedMesh=!0)),void 0!==l.camera&&this._addNodeRef(this.cameraCache,l.camera)}},j.prototype._addNodeRef=function(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)},j.prototype._getNodeRef=function(t,e,n){if(t.refs[e]<=1)return n;var r=n.clone();return r.name+="_instance_"+t.uses[e]++,r},j.prototype._invokeOne=function(t){var e=Object.values(this.plugins);e.push(this);for(var n=0;n<e.length;n++){var r=t(e[n]);if(r)return r}},j.prototype._invokeAll=function(t){var e=Object.values(this.plugins);e.unshift(this);for(var n=[],r=0;r<e.length;r++){var i=t(e[r]);i&&n.push(i)}return n},j.prototype.getDependency=function(t,e){var n=t+":"+e,r=this.cache.get(n);if(!r){switch(t){case"scene":r=this.loadScene(e);break;case"node":r=this.loadNode(e);break;case"mesh":r=this._invokeOne((function(t){return t.loadMesh&&t.loadMesh(e)}));break;case"accessor":r=this.loadAccessor(e);break;case"bufferView":r=this._invokeOne((function(t){return t.loadBufferView&&t.loadBufferView(e)}));break;case"buffer":r=this.loadBuffer(e);break;case"material":r=this._invokeOne((function(t){return t.loadMaterial&&t.loadMaterial(e)}));break;case"texture":r=this._invokeOne((function(t){return t.loadTexture&&t.loadTexture(e)}));break;case"skin":r=this.loadSkin(e);break;case"animation":r=this.loadAnimation(e);break;case"camera":r=this.loadCamera(e);break;default:throw new Error("Unknown type: "+t)}this.cache.add(n,r)}return r},j.prototype.getDependencies=function(t){var e=this.cache.get(t);if(!e){var n=this,r=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(r.map((function(e,r){return n.getDependency(t,r)}))),this.cache.add(t,e)}return e},j.prototype.loadBuffer=function(t){var e=this.json.buffers[t],r=this.fileLoader;if(e.type&&"arraybuffer"!==e.type)throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(void 0===e.uri&&0===t)return Promise.resolve(this.extensions[n.KHR_BINARY_GLTF].body);var i=this.options;return new Promise((function(t,n){r.load(G(e.uri,i.path),t,void 0,(function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))}))}))},j.prototype.loadBufferView=function(t){var e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then((function(t){var n=e.byteLength||0,r=e.byteOffset||0;return t.slice(r,r+n)}))},j.prototype.loadAccessor=function(t){var e=this,n=this.json,r=this.json.accessors[t];if(void 0===r.bufferView&&void 0===r.sparse)return Promise.resolve(null);var i=[];return void 0!==r.bufferView?i.push(this.getDependency("bufferView",r.bufferView)):i.push(null),void 0!==r.sparse&&(i.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(i).then((function(t){var i,o=t[0],s=R[r.type],a=C[r.componentType],u=a.BYTES_PER_ELEMENT,c=u*s,l=r.byteOffset||0,h=void 0!==r.bufferView?n.bufferViews[r.bufferView].byteStride:void 0,p=!0===r.normalized;if(h&&h!==c){var f=Math.floor(l/h),d="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+f+":"+r.count,g=e.cache.get(d);g||(g=new uu(new a(o,f*h,r.count*h/u),h/u),e.cache.add(d,g)),i=new lu(g,s,l%h/u,p)}else i=new Hi(null===o?new a(r.count*s):new a(o,l,r.count*s),s,p);if(void 0!==r.sparse){var m=R.SCALAR,v=C[r.sparse.indices.componentType],y=r.sparse.indices.byteOffset||0,x=r.sparse.values.byteOffset||0,b=new v(t[1],y,r.sparse.count*m),_=new a(t[2],x,r.sparse.count*s);null!==o&&(i=new Hi(i.array.slice(),i.itemSize,i.normalized));for(var w=0,M=b.length;w<M;w++){var E=b[w];if(i.setX(E,_[w*s]),s>=2&&i.setY(E,_[w*s+1]),s>=3&&i.setZ(E,_[w*s+2]),s>=4&&i.setW(E,_[w*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return i}))},j.prototype.loadTexture=function(t){var e=this.json,n=this.options,r=e.textures[t],i=e.images[r.source],o=this.textureLoader;if(i.uri){var s=n.manager.getHandler(i.uri);null!==s&&(o=s)}return this.loadTextureImage(t,i,o)},j.prototype.loadTextureImage=function(t,e,n){var r=this,i=this.json,o=this.options,s=i.textures[t],a=self.URL||self.webkitURL,u=e.uri,c=!1,l=!0;if("image/jpeg"===e.mimeType&&(l=!1),void 0!==e.bufferView)u=r.getDependency("bufferView",e.bufferView).then((function(t){if("image/png"===e.mimeType){var n=new DataView(t,25,1).getUint8(0,!1);l=6===n||4===n||3===n}c=!0;var r=new Blob([t],{type:e.mimeType});return u=a.createObjectURL(r)}));else if(void 0===e.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");return Promise.resolve(u).then((function(t){return new Promise((function(e,r){var i=e;!0===n.isImageBitmapLoader&&(i=function(t){e(new hc(t))}),n.load(G(t,o.path),i,void 0,r)}))})).then((function(e){!0===c&&a.revokeObjectURL(u),e.flipY=!1,s.name&&(e.name=s.name),l||(e.format=Zt);var n=(i.samplers||{})[s.sampler]||{};return e.magFilter=T[n.magFilter]||Dt,e.minFilter=T[n.minFilter]||Nt,e.wrapS=I[n.wrapS]||At,e.wrapT=I[n.wrapT]||At,r.associations.set(e,{type:"textures",index:t}),e}))},j.prototype.assignTexture=function(t,e,r){var i=this;return this.getDependency("texture",r.index).then((function(o){if(void 0===r.texCoord||0==r.texCoord||"aoMap"===e&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+e+" not yet supported."),i.extensions[n.KHR_TEXTURE_TRANSFORM]){var s=void 0!==r.extensions?r.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;if(s){var a=i.associations.get(o);o=i.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(o,s),i.associations.set(o,a)}}t[e]=o}))},j.prototype.assignFinalMaterial=function(t){var e=t.geometry,n=t.material,r=void 0!==e.attributes.tangent,i=void 0!==e.attributes.color,o=void 0===e.attributes.normal,s=!0===t.isSkinnedMesh,a=Object.keys(e.morphAttributes).length>0,u=a&&void 0!==e.morphAttributes.normal;if(t.isPoints){var c="PointsMaterial:"+n.uuid,l=this.cache.get(c);l||(l=new nc,Li.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(c,l)),n=l}else if(t.isLine){c="LineBasicMaterial:"+n.uuid;var h=this.cache.get(c);h||(h=new Wu,Li.prototype.copy.call(h,n),h.color.copy(n.color),this.cache.add(c,h)),n=h}if(r||i||o||s||a){c="ClonedMaterial:"+n.uuid+":";n.isGLTFSpecularGlossinessMaterial&&(c+="specular-glossiness:"),s&&(c+="skinning:"),r&&(c+="vertex-tangents:"),i&&(c+="vertex-colors:"),o&&(c+="flat-shading:"),a&&(c+="morph-targets:"),u&&(c+="morph-normals:");var p=this.cache.get(c);p||(p=n.clone(),s&&(p.skinning=!0),i&&(p.vertexColors=!0),o&&(p.flatShading=!0),a&&(p.morphTargets=!0),u&&(p.morphNormals=!0),r&&(p.vertexTangents=!0,p.normalScale&&(p.normalScale.y*=-1),p.clearcoatNormalScale&&(p.clearcoatNormalScale.y*=-1)),this.cache.add(c,p),this.associations.set(p,this.associations.get(n))),n=p}n.aoMap&&void 0===e.attributes.uv2&&void 0!==e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv),t.material=n},j.prototype.getMaterialType=function(){return gl},j.prototype.loadMaterial=function(t){var e,r=this,i=this.json,o=this.extensions,s=i.materials[t],a={},u=s.extensions||{},c=[];if(u[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var l=o[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];e=l.getMaterialType(),c.push(l.extendParams(a,s,r))}else if(u[n.KHR_MATERIALS_UNLIT]){var h=o[n.KHR_MATERIALS_UNLIT];e=h.getMaterialType(),c.push(h.extendParams(a,s,r))}else{var p=s.pbrMetallicRoughness||{};if(a.color=new ki(1,1,1),a.opacity=1,Array.isArray(p.baseColorFactor)){var f=p.baseColorFactor;a.color.fromArray(f),a.opacity=f[3]}void 0!==p.baseColorTexture&&c.push(r.assignTexture(a,"map",p.baseColorTexture)),a.metalness=void 0!==p.metallicFactor?p.metallicFactor:1,a.roughness=void 0!==p.roughnessFactor?p.roughnessFactor:1,void 0!==p.metallicRoughnessTexture&&(c.push(r.assignTexture(a,"metalnessMap",p.metallicRoughnessTexture)),c.push(r.assignTexture(a,"roughnessMap",p.metallicRoughnessTexture))),e=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),c.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,a)}))))}!0===s.doubleSided&&(a.side=L);var d=s.alphaMode||F;return d===k?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===N&&(a.alphaTest=void 0!==s.alphaCutoff?s.alphaCutoff:.5)),void 0!==s.normalTexture&&e!==Gi&&(c.push(r.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new er(1,-1),void 0!==s.normalTexture.scale&&a.normalScale.set(s.normalTexture.scale,-s.normalTexture.scale)),void 0!==s.occlusionTexture&&e!==Gi&&(c.push(r.assignTexture(a,"aoMap",s.occlusionTexture)),void 0!==s.occlusionTexture.strength&&(a.aoMapIntensity=s.occlusionTexture.strength)),void 0!==s.emissiveFactor&&e!==Gi&&(a.emissive=(new ki).fromArray(s.emissiveFactor)),void 0!==s.emissiveTexture&&e!==Gi&&c.push(r.assignTexture(a,"emissiveMap",s.emissiveTexture)),Promise.all(c).then((function(){var i;return i=e===m?o[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(a):new e(a),s.name&&(i.name=s.name),i.map&&(i.map.encoding=fn),i.emissiveMap&&(i.emissiveMap.encoding=fn),z(i,s),r.associations.set(i,{type:"materials",index:t}),s.extensions&&U(o,i,s),i}))},j.prototype.createUniqueName=function(t){for(var e=Rp.sanitizeNodeName(t||""),n=e,r=1;this.nodeNamesUsed[n];++r)n=e+"_"+r;return this.nodeNamesUsed[n]=!0,n},j.prototype.loadGeometries=function(t){var e=this,r=this.extensions,i=this.primitiveCache;function o(t){return r[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then((function(n){return W(n,t,e)}))}for(var s,a,u=[],c=0,l=t.length;c<l;c++){var h,p=t[c],f=(a=void 0,(a=(s=p).extensions&&s.extensions[n.KHR_DRACO_MESH_COMPRESSION])?"draco:"+a.bufferView+":"+a.indices+":"+V(a.attributes):s.indices+":"+V(s.attributes)+":"+s.mode),d=i[f];if(d)u.push(d.promise);else h=p.extensions&&p.extensions[n.KHR_DRACO_MESH_COMPRESSION]?o(p):W(new co,p,e),i[f]={primitive:p,promise:h},u.push(h)}return Promise.all(u)},j.prototype.loadMesh=function(t){for(var e,n=this,r=this.json,i=this.extensions,o=r.meshes[t],s=o.primitives,a=[],u=0,c=s.length;u<c;u++){var l=void 0===s[u].material?(void 0===(e=this.cache).DefaultMaterial&&(e.DefaultMaterial=new gl({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:P})),e.DefaultMaterial):this.getDependency("material",s[u].material);a.push(l)}return a.push(n.loadGeometries(s)),Promise.all(a).then((function(e){for(var r=e.slice(0,e.length-1),a=e[e.length-1],u=[],c=0,l=a.length;c<l;c++){var h,p=a[c],f=s[c],d=r[c];if(f.mode===E||f.mode===S||f.mode===A||void 0===f.mode)!0!==(h=!0===o.isSkinnedMesh?new Bu(p,d):new To(p,d)).isSkinnedMesh||h.geometry.attributes.skinWeight.normalized||h.normalizeSkinWeights(),f.mode===S?h.geometry=q(h.geometry,ln):f.mode===A&&(h.geometry=q(h.geometry,hn));else if(f.mode===_)h=new tc(p,d);else if(f.mode===M)h=new Qu(p,d);else if(f.mode===w)h=new ec(p,d);else{if(f.mode!==b)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);h=new ac(p,d)}Object.keys(h.geometry.morphAttributes).length>0&&H(h,o),h.name=n.createUniqueName(o.name||"mesh_"+t),z(h,o),f.extensions&&U(i,h,f),n.assignFinalMaterial(h),u.push(h)}if(1===u.length)return u[0];var g=new $a;for(c=0,l=u.length;c<l;c++)g.add(u[c]);return g}))},j.prototype.loadCamera=function(t){var e,n=this.json.cameras[t],r=n[n.type];if(r)return"perspective"===n.type?e=new Fo(tr.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===n.type&&(e=new Oh(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),z(e,n),Promise.resolve(e);console.warn("THREE.GLTFLoader: Missing camera parameters.")},j.prototype.loadSkin=function(t){var e=this.json.skins[t],n={joints:e.joints};return void 0===e.inverseBindMatrices?Promise.resolve(n):this.getDependency("accessor",e.inverseBindMatrices).then((function(t){return n.inverseBindMatrices=t,n}))},j.prototype.loadAnimation=function(t){for(var e=this.json.animations[t],n=[],r=[],i=[],o=[],s=[],a=0,u=e.channels.length;a<u;a++){var c=e.channels[a],l=e.samplers[c.sampler],h=c.target,p=void 0!==h.node?h.node:h.id,f=void 0!==e.parameters?e.parameters[l.input]:l.input,d=void 0!==e.parameters?e.parameters[l.output]:l.output;n.push(this.getDependency("node",p)),r.push(this.getDependency("accessor",f)),i.push(this.getDependency("accessor",d)),o.push(l),s.push(h)}return Promise.all([Promise.all(n),Promise.all(r),Promise.all(i),Promise.all(o),Promise.all(s)]).then((function(n){for(var r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],u=[],c=0,l=r.length;c<l;c++){var h=r[c],p=i[c],f=o[c],d=s[c],g=a[c];if(void 0!==h){var m;switch(h.updateMatrix(),h.matrixAutoUpdate=!0,D[g.path]){case D.weights:m=Rl;break;case D.rotation:m=Dl;break;case D.position:case D.scale:default:m=Fl}var v=h.name?h.name:h.uuid,y=void 0!==d.interpolation?B[d.interpolation]:en,b=[];D[g.path]===D.weights?h.traverse((function(t){!0===t.isMesh&&t.morphTargetInfluences&&b.push(t.name?t.name:t.uuid)})):b.push(v);var _=f.array;if(f.normalized){var w;if(_.constructor===Int8Array)w=1/127;else if(_.constructor===Uint8Array)w=1/255;else if(_.constructor==Int16Array)w=1/32767;else{if(_.constructor!==Uint16Array)throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");w=1/65535}for(var M=new Float32Array(_.length),E=0,S=_.length;E<S;E++)M[E]=_[E]*w;_=M}for(E=0,S=b.length;E<S;E++){var A=new m(b[E]+"."+D[g.path],p.array,_,y);"CUBICSPLINE"===d.interpolation&&(A.createInterpolant=function(t){return new x(this.times,this.values,this.getValueSize()/3,t)},A.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(A)}}}var C=e.name?e.name:"animation_"+t;return new Nl(C,void 0,u)}))},j.prototype.loadNode=function(t){var e,n=this.json,r=this.extensions,i=this,o=n.nodes[t],s=o.name?i.createUniqueName(o.name):"";return(e=[],void 0!==o.mesh&&e.push(i.getDependency("mesh",o.mesh).then((function(t){var e=i._getNodeRef(i.meshCache,o.mesh,t);return void 0!==o.weights&&e.traverse((function(t){if(t.isMesh)for(var e=0,n=o.weights.length;e<n;e++)t.morphTargetInfluences[e]=o.weights[e]})),e}))),void 0!==o.camera&&e.push(i.getDependency("camera",o.camera).then((function(t){return i._getNodeRef(i.cameraCache,o.camera,t)}))),i._invokeAll((function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)})).forEach((function(t){e.push(t)})),Promise.all(e)).then((function(e){var n;if((n=!0===o.isBone?new Fu:e.length>1?new $a:1===e.length?e[0]:new di)!==e[0])for(var a=0,u=e.length;a<u;a++)n.add(e[a]);if(o.name&&(n.userData.name=o.name,n.name=s),z(n,o),o.extensions&&U(r,n,o),void 0!==o.matrix){var c=new Vr;c.fromArray(o.matrix),n.applyMatrix4(c)}else void 0!==o.translation&&n.position.fromArray(o.translation),void 0!==o.rotation&&n.quaternion.fromArray(o.rotation),void 0!==o.scale&&n.scale.fromArray(o.scale);return i.associations.set(n,{type:"nodes",index:t}),n}))},j.prototype.loadScene=function(){function t(e,n,r,i){var o=r.nodes[e];return i.getDependency("node",e).then((function(t){return void 0===o.skin?t:i.getDependency("skin",o.skin).then((function(t){for(var n=[],r=0,o=(e=t).joints.length;r<o;r++)n.push(i.getDependency("node",e.joints[r]));return Promise.all(n)})).then((function(n){return t.traverse((function(t){if(t.isMesh){for(var r=[],i=[],o=0,s=n.length;o<s;o++){var a=n[o];if(a){r.push(a);var u=new Vr;void 0!==e.inverseBindMatrices&&u.fromArray(e.inverseBindMatrices.array,16*o),i.push(u)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[o])}t.bind(new Gu(r,i),t.matrixWorld)}})),t}));var e})).then((function(e){n.add(e);var s=[];if(o.children)for(var a=o.children,u=0,c=a.length;u<c;u++){var l=a[u];s.push(t(l,e,r,i))}return Promise.all(s)}))}return function(e){var n=this.json,r=this.extensions,i=this.json.scenes[e],o=new $a;i.name&&(o.name=this.createUniqueName(i.name)),z(o,i),i.extensions&&U(r,o,i);for(var s=i.nodes||[],a=[],u=0,c=s.length;u<c;u++)a.push(t(s[u],o,n,this));return Promise.all(a).then((function(){return o}))}}(),t}();class Ob extends eg{constructor(t,e,n){super(),this.reloadTimes=1;const{THREE:r}=Nd.getInstance();this.options=e||{},this.meshes=[],this.meshMaterials=[],this.group=new r.Group,this.add(this.group),t&&this.load(t,0,n),this.initialized=!1,this.loaded=!1}load(t,e=0,n){this.initialized=!1,this.loaded=!1;const r=new Rb;n&&r.setMeshoptDecoder(n);const{THREE:i}=Nd.getInstance();r.load(t,t=>{this.add(t.scene),this.group.add(t.scene),this.loaded=!0,this.initialized=!0,this.needUpdate=!0,t.scene.traverse(t=>{t instanceof i.Mesh&&(this.meshes.push(t),this.meshMaterials.push(t.material))}),this.setOptions(this.options),this.emit(Ud.ELEMENT_LOADED,this)},void 0,r=>{const i=e+1;i>this.reloadTimes?this.emit(Ud.ELEMENT_LOADED_ERROR,this,r):this.load(t,i,n)})}setOptions(t){const{THREE:e}=Nd.getInstance();this.meshes.forEach(e=>{t.renderOrder&&(e.renderOrder=t.renderOrder)}),this.meshMaterials.forEach(n=>{n.depthTest=!!t.depthTest,n.transparent=!!t.transparent,t.fillColor&&(n.color=new e.Color(t.fillColor))}),this.options=Object.assign(Object.assign({},t),this.options)}setSacle(t){this.meshes.forEach(e=>{e.geometry.scale(t,t,t)}),this.needUpdate=!0}setOnCurrentViewChanged(t){this.eventListeners={onCurrentViewChanged:t}}update(){const t=new tg(this);return!this.initialized&&this.loaded&&(this.initialized=!0,t.needUpdate=!0),this.initialized&&!this.parent&&(t.shouldPlaceElement=!0),t}dispose(){super.dispose(),ky.dispose(this,!0)}}class Db extends eg{constructor(t){super(),this.domElement=t,this.wrapper=document.createElement("div"),this.wrapper.appendChild(this.domElement),this.cssObject=new eb(this.wrapper),this.add(this.cssObject),this.up.set(0,0,1),this.initialzed=!0,this.visibleRadius=1/0}setWrapperCSSClass(t){this.wrapper.className=t}setWrapperDomID(t){this.wrapper.id=t}update(){const t=new tg(this);return this.initialzed&&(t.shouldPlaceElement=!0,this.initialzed=!1),this.needUpdate&&(t.needUpdate=!0,this.needUpdate=!1),t}}class Bb extends Db{constructor(){super(document.createElement("div"));const{THREE:t}=Nd.getInstance();this.boundingBox=document.createElement("div"),this.textElement=document.createElement("div"),this.imageElement=document.createElement("img"),this.textPositionInfo={anchor:"center",offsetX:0,offsetY:0},this.imagePositionInfo={anchor:"center",offsetX:0,offsetY:0},this.imageElement.setAttribute("draggable","false"),this.textElement.style.cssText="\n position: absolute;\n transform: translate(-50%, -50%);\n white-space: nowrap;\n border-style: solid;\n border-width: 0;\n border-color: white;\n line-height: 1.5;\n ",this.imageElement.style.cssText="\n position: absolute;\n transform: translate(-50%, -50%);\n ",this.boundingBox.style.cssText="\n position: absolute;\n transform: translate(-50%, -50%);\n display: none;\n border-style: solid;\n border-width: 2px;\n border-color: red;\n border-radius: 4px;\n pointer-events: none;\n ",this.status="idle",this.mouseStart=new t.Vector2,this.mouseEnd=new t.Vector2,this.listeners={onImageLoaded:()=>{this.onImageLoaded()},onMouseDown:t=>{this.onMouseDown(t)},onMouseMove:t=>{this.onMouseMove(t)},onMouseUp:t=>{this.onMouseUp(t)},onTouchStart:t=>{this.onTouchStart(t)},onTouchMove:t=>{this.onTouchMove(t)},onTouchEnd:t=>{this.onTouchEnd(t)}},this.registerListeners(),this.domElement.appendChild(this.imageElement),this.domElement.appendChild(this.textElement),this.domElement.appendChild(this.boundingBox),this.calcBBoxNextFrame=!0}updateTextTransform(){const{offsetX:t,offsetY:e,anchor:n}=this.textPositionInfo,{x:r,y:i}=Bb.ANCHOR_MAP[n];this.textElement.style.transform=`translate(${r}, ${i}) translate(${t}px, ${e}px)`}updateImageTransform(){const{offsetX:t,offsetY:e,anchor:n}=this.imagePositionInfo,{x:r,y:i}=Bb.ANCHOR_MAP[n];this.imageElement.style.transform=`translate(${r}, ${i}) translate(${t}px, ${e}px)`}calcBBox(){if(!this.visible||"none"===this.boundingBox.style.display)return;const t=this.domElement.getBoundingClientRect(),e=this.textElement.getBoundingClientRect(),n=this.imageElement.getBoundingClientRect(),{left:r,right:i,top:o,bottom:s}=e,{left:a,right:u,top:c,bottom:l}=n,h=[],{THREE:p}=Nd.getInstance();"none"!==this.textElement.style.display&&(h.push(new p.Vector2(r,o)),h.push(new p.Vector2(i,s))),"none"!==this.imageElement.style.display&&(h.push(new p.Vector2(a,c)),h.push(new p.Vector2(u,l)));let f=0,d=0,g=0,m=0;if(h.length){const e=(new p.Box2).setFromPoints(h),{x:n,y:r}=t;f=e.max.x-e.min.x+12,d=e.max.y-e.min.y+12,g=e.min.x-n-6,m=e.min.y-r-6}this.boundingBox.style.transform=`translate(${g}px, ${m}px)`,this.boundingBox.style.width=f+"px",this.boundingBox.style.height=d+"px"}registerListeners(){this.imageElement.addEventListener("load",this.listeners.onImageLoaded),this.imageElement.addEventListener("pointerdown",this.listeners.onMouseDown),this.imageElement.addEventListener("touchstart",this.listeners.onTouchStart),this.imageElement.addEventListener("touchmove",this.listeners.onTouchMove),this.imageElement.addEventListener("touchend",this.listeners.onTouchEnd),this.textElement.addEventListener("pointerdown",this.listeners.onMouseDown),this.textElement.addEventListener("touchstart",this.listeners.onTouchStart),this.textElement.addEventListener("touchmove",this.listeners.onTouchMove),this.textElement.addEventListener("touchend",this.listeners.onTouchEnd)}unregisterListeners(){this.imageElement.removeEventListener("load",this.listeners.onImageLoaded),this.imageElement.removeEventListener("pointerdown",this.listeners.onMouseDown),this.imageElement.removeEventListener("touchstart",this.listeners.onTouchStart),this.imageElement.removeEventListener("touchmove",this.listeners.onTouchMove),this.imageElement.removeEventListener("touchend",this.listeners.onTouchEnd),this.textElement.removeEventListener("pointerdown",this.listeners.onMouseDown),this.textElement.removeEventListener("touchstart",this.listeners.onTouchStart),this.textElement.removeEventListener("touchmove",this.listeners.onTouchMove),this.textElement.removeEventListener("touchend",this.listeners.onTouchEnd)}onImageLoaded(){""===this.imageElement.style.width&&(this.imageElement.style.width=this.imageElement.width+"px"),""===this.imageElement.style.height&&(this.imageElement.style.height=this.imageElement.height+"px"),this.calcBBoxNextFrame=!0}onMouseDown(t){"idle"===this.status&&"mouse"===t.pointerType&&0===t.button&&(this.mouseStart.set(t.clientX,t.clientY),this.emit(Ud.LABEL_DOWN,this,null,0),this.imageElement.ownerDocument.addEventListener("pointermove",this.listeners.onMouseMove),this.imageElement.ownerDocument.addEventListener("pointerup",this.listeners.onMouseUp),this.status="down")}onMouseMove(t){"down"===this.status&&"mouse"===t.pointerType&&0===t.button&&(this.status="move")}onMouseUp(t){"idle"!==this.status&&"mouse"===t.pointerType&&(this.mouseEnd.set(t.clientX,t.clientY),("down"===this.status||this.mouseStart.distanceToSquared(this.mouseEnd)<100)&&this.emit(Ud.ELEMENT_SELECTED,this,null,0),this.imageElement.ownerDocument.removeEventListener("pointermove",this.listeners.onMouseMove),this.imageElement.ownerDocument.removeEventListener("pointerup",this.listeners.onMouseUp),this.status="idle")}onTouchStart(t){"idle"!==this.status||t.touches.length>1||(this.mouseStart.set(t.touches[0].pageX,t.touches[0].pageY),this.emit(Ud.LABEL_DOWN,this,null,0),this.status="down")}onTouchMove(t){"down"!==this.status||t.touches.length>1||(this.status="move")}onTouchEnd(t){"idle"!==this.status&&(this.mouseEnd.set(t.changedTouches[0].pageX,t.changedTouches[0].pageY),("down"===this.status||this.mouseStart.distanceToSquared(this.mouseEnd)<100)&&this.emit(Ud.ELEMENT_SELECTED,this,null,0),this.status="idle")}setAttributes({labelAttrs:t,imageAttrs:e,textAttrs:n}){void 0!==t&&this.setLabelAttrs(t),void 0!==e&&this.setImageAttrs(e),void 0!==n&&this.setTextAttrs(n)}setLabelAttrs(t){void 0!==t.position&&this.setPosition(t.position),void 0!==t.visible&&this.setVisible(t.visible),void 0!==t.bBoxVisible&&this.setBBoxVisible(t.bBoxVisible),void 0!==t.bBoxBorderWidth&&this.setBBoxBorderWidth(t.bBoxBorderWidth),void 0!==t.bBoxBorderColor&&this.setBBoxBorderColor(t.bBoxBorderColor)}setPosition(t){this.position.copy(t),this.needUpdate=!0}setVisible(t){this.visible=t,this.cssObject.visible=t,this.needUpdate=!0}setBBoxVisible(t){this.boundingBox.style.display=t?"block":"none",t&&(this.calcBBoxNextFrame=!0)}setBBoxBorderWidth(t){this.boundingBox.style.borderWidth=t+"px"}setBBoxBorderColor(t){this.boundingBox.style.borderColor=t}setImageAttrs(t){void 0!==t.src&&this.setImageSource(t.src),void 0!==t.visible&&this.setImageVisible(t.visible),void 0!==t.size&&this.setImageSize(t.size.width,t.size.height),void 0!==t.anchor&&this.setImageAnchor(t.anchor),void 0!==t.offset&&this.setImageOffset(t.offset.x,t.offset.y)}setImageVisible(t){this.imageElement.style.display=t?"block":"none"}setImageSource(t){this.imageElement.src=t}setImageSize(t,e){this.imageElement.style.height=e+"px",this.imageElement.style.width=t+"px",this.calcBBoxNextFrame=!0}setImageAnchor(t){this.imagePositionInfo.anchor=t,this.updateImageTransform(),this.calcBBoxNextFrame=!0}setImageOffset(t,e){this.imagePositionInfo.offsetX=t,this.imagePositionInfo.offsetY=e,this.updateImageTransform(),this.calcBBoxNextFrame=!0}setTextAttrs(t){void 0!==t.content&&this.setTextContent(t.content),void 0!==t.visible&&this.setTextVisible(t.visible),void 0!==t.fontSize&&this.setTextFontSize(t.fontSize),void 0!==t.color&&this.setTextColor(t.color),void 0!==t.padding&&this.setTextPadding(t.padding),void 0!==t.anchor&&this.setTextAnchor(t.anchor),void 0!==t.offset&&this.setTextOffset(t.offset.x,t.offset.y),void 0!==t.align&&this.setTextAlign(t.align),void 0!==t.borderWidth&&this.setTextBorderWidth(t.borderWidth),void 0!==t.borderColor&&this.setTextBorderColor(t.borderColor),void 0!==t.borderRadius&&this.setTextBorderRadius(t.borderRadius),void 0!==t.backgroundColor&&this.setTextBackgroundColor(t.backgroundColor)}setTextVisible(t){this.textElement.style.display=t?"block":"none",this.calcBBoxNextFrame=!0}setTextContent(t){this.textElement.innerText=t,this.calcBBoxNextFrame=!0}setTextFontSize(t){this.textElement.style.fontSize=t+"px",this.calcBBoxNextFrame=!0}setTextColor(t){this.textElement.style.color=t}setTextPadding(t){const e={left:0,right:0,top:0,bottom:0};void 0!==t.left&&(e.left=t.left),void 0!==t.right&&(e.right=t.right),void 0!==t.top&&(e.top=t.top),void 0!==t.bottom&&(e.bottom=t.bottom);const{left:n,right:r,top:i,bottom:o}=e;this.textElement.style.padding=`${i}px ${r}px ${o}px ${n}px`,this.calcBBoxNextFrame=!0}setTextAnchor(t){this.textPositionInfo.anchor=t,this.updateTextTransform(),this.calcBBoxNextFrame=!0}setTextOffset(t,e){this.textPositionInfo.offsetX=t,this.textPositionInfo.offsetY=e,this.updateTextTransform(),this.calcBBoxNextFrame=!0}setTextBorderWidth(t){this.textElement.style.borderWidth=t+"px",this.calcBBoxNextFrame=!0}setTextAlign(t){this.textElement.style.textAlign=t}setTextBorderColor(t){this.textElement.style.borderColor=t}setTextBorderRadius(t){this.textElement.style.borderRadius=t+"px"}setTextBackgroundColor(t){this.textElement.style.backgroundColor=t}setLabelID(t){this.labelID=t}update(){const t=new tg(this);return this.needCalcBBox&&this.calcBBox(),this.needCalcBBox=!1,this.calcBBoxNextFrame&&(this.needCalcBBox=!0),this.calcBBoxNextFrame=!1,this.initialzed&&(t.shouldPlaceElement=!0,this.initialzed=!1),this.needUpdate&&(t.needUpdate=!0,this.needUpdate=!1),t}dispose(){this.unregisterListeners(),this.domElement.removeChild(this.boundingBox),this.domElement.removeChild(this.textElement),this.domElement.removeChild(this.imageElement),super.dispose()}}Bb.ANCHOR_MAP={center:{x:"-50%",y:"-50%"},left:{x:"0",y:"-50%"},right:{x:"-100%",y:"-50%"},top:{x:"-50%",y:"0"},bottom:{x:"-50%",y:"-100%"},topleft:{x:"0",y:"0"},topright:{x:"-100%",y:"0"},bottomleft:{x:"0",y:"-100%"},bottomright:{x:"-100%",y:"-100%"}};class Fb{constructor(t){const{THREE:e}=Nd.getInstance();this.count=0,this.playSet=new Set,this.playing=!1,this.listeners={onPlaying:()=>{this.playing=!0},onPaused:()=>{this.playing=!1}};const n=document.createElement("video");n.setAttribute("webkit-playsinline","true"),n.setAttribute("x5-playsinline","true"),n.setAttribute("playsinline","true"),n.setAttribute("crossOrigin","anonymous"),n.setAttribute("autoplay","false"),n.setAttribute("muted","true"),n.muted=!0,n.src=t,n.loop=!0,n.volume=0,n.addEventListener("playing",this.listeners.onPlaying),n.addEventListener("pause",this.listeners.onPaused),this.video=n,this.texture=new e.VideoTexture(this.video)}play(t){this.playSet.size<1&&this.video.play(),t&&this.playSet.add(t)}pause(t){t&&this.playSet.delete(t),0===this.playSet.size&&this.video.pause()}destroy(){this.texture&&this.texture.dispose(),this.video&&(this.video.removeEventListener("playing",this.listeners.onPlaying),this.video.removeEventListener("pause",this.listeners.onPaused),this.video.pause(),this.video.removeAttribute("src"),this.video.load())}}class Nb extends eg{constructor(t){super(),Nb.Videos||(Nb.Videos=new Map),this.initialized=!1,this.up.set(0,0,1),this.visible=!1,this.videoVisible=!1,t&&this.setVideoSrc(t)}static RemoveVideo(t){if(!Nb.Videos.has(t))return;const e=Nb.Videos.get(t);e.count-1==0?(e.destroy(),Nb.Videos.delete(t)):(e.count-=1,Nb.Videos.set(t,e))}static AddVideo(t){if(!Nb.Videos.has(t)){const e=new Fb(t);Nb.Videos.set(t,e)}const e=Nb.Videos.get(t);return e.count+=1,e}createVideoPlane(){const{THREE:t}=Nd.getInstance(),e=new t.PlaneBufferGeometry(1.6,.9),n=new t.MeshBasicMaterial({map:this.video.texture,side:t.DoubleSide,transparent:!1,depthTest:!1,depthWrite:!1});this.videoPlane=new t.Mesh(e,n),this.add(this.videoPlane),this.initialized=!0,this.videoVisible=!0}setVideoSrc(t){const e=Nb.AddVideo(t);this.video&&(this.videoPlane.material.map=null,Nb.RemoveVideo(this.video.video.src)),this.video=e,this.videoPlane&&this.videoPlane.material&&(this.videoPlane.material.map=this.video.texture),this.videoPlane||this.createVideoPlane()}setVideoVisible(t){this.videoVisible=t}setVideoSize(t,e){if(!this.videoPlane)return;const{THREE:n}=Nd.getInstance(),{geometry:r}=this.videoPlane,i=new n.PlaneBufferGeometry(t,e);this.videoPlane.geometry=i,r.dispose()}play(t){this.video&&(this.video.play(t),this.videoPlane.renderOrder=150)}stop(t){this.video&&(this.video.pause(t),this.videoPlane.renderOrder=1)}update(){const t=new tg(this);return this.initialized&&!this.parent&&(t.shouldPlaceElement=!0,t.needUpdate=!0),this.visible=this.videoVisible&&this.video&&this.video.playing,this.visible&&(t.needUpdate=!0),t}dispose(){this.video&&Nb.RemoveVideo(this.video.video.src),super.dispose(),ky.dispose(this,!0)}}class kb extends Qd{init(t,e=t.container){this.container=e,this.parent=t;const{clientWidth:n,clientHeight:r}=this.container;this.renderer=new nb,this.renderer.setSize(n,r),this.renderer.domElement.style.position="absolute",this.renderer.domElement.style.top="0",this.renderer.domElement.style.userSelect="none",this.container.appendChild(this.renderer.domElement)}resize(t,e){this.renderer.setSize(t,e)}setRenderOrder(t){this.renderer.domElement.style.setProperty("z-index",""+t)}update(){return!1}render(){this.parent.camera&&this.renderer.render(this.parent.stage.scene,this.parent.camera)}dispose(){this.container.removeChild(this.renderer.domElement),this.renderer=null,this.container=null}}var Gb,Ub,zb,Hb=function(t,e){for(var n=new $a,r=0,i=e.length;r<i;r++)n.add(new To(t,e[r]));return n};!function(t){t[t.IDLE=0]="IDLE",t[t.DOWN=1]="DOWN",t[t.MOVE=2]="MOVE"}(Gb||(Gb={}));class Vb extends Qd{constructor(t){if(super(),this.needRender=!1,jd.GetEnv()===Fd.Miniapp){if(!t)throw Error("poi-overlay need a offscreenCanvas");Vb.canvas=t}else Vb.canvas||(Vb.canvas=document.createElement("canvas"));const e=jd.GetGlobalDPR();Vb.canvas.width=500*e,Vb.canvas.height=500*e,Vb.ctx=Vb.canvas.getContext("2d")}init(t){const{THREE:e}=Nd.getInstance();this.rectMap=new Map,this.parent=t,this.scene=new e.Scene;const n=t.getViewWidth(),i=t.getViewHeight();this.renderCamera=new r.OrthographicCamera(-n/2,n/2,i/2,-i/2,.1,1e3),this.renderCamera.up.set(0,1,0),this.renderCamera.position.set(0,0,50),this.renderCamera.lookAt(0,0,0),this.camera=this.parent.camera,this.renderer=this.parent.renderer,this.pois=new Set,this.enabled=!0,this.orderPois=ky.debounce(this.orderPoisByLevel.bind(this),50),this.listeners={pointerDown:t=>{this.onPointerDown(t)},pointerUp:t=>{this.onPointerUp(t)},touchStart:t=>{this.onTouchStart(t)},touchEnd:t=>{this.onTouchEnd(t)}},this.mouseState=Gb.IDLE,this.mousePositionBuffer=new e.Vector2,this.parent.on(zd.MOUSE_DOWN,this.listeners.pointerDown),this.parent.on(zd.MOUSE_UP,this.listeners.pointerUp),this.parent.on(zd.TOUCH_START,this.listeners.touchStart),this.parent.on(zd.TOUCH_END,this.listeners.touchEnd)}update(){return!(!this.renderThisFrame&&!Array.from(this.pois).reduce((t,e)=>e.update()||t,!1))&&(this.renderThisFrame=!1,this.needRender=!0,!0)}forceRenderInThisFrame(){this.renderThisFrame=!0}render(){if(!this.enabled)return;const{THREE:t}=Nd.getInstance(),e=new t.Frustum;e.setFromProjectionMatrix((new t.Matrix4).multiplyMatrices(this.parent.camera.projectionMatrix,this.parent.camera.matrixWorldInverse));const n=this.parent.getViewWidth(),r=this.parent.getViewHeight();if((new t.Euler).setFromQuaternion(this.parent.camera.quaternion,"ZYX"),this.checkUpdate(),this.needRender||this.renderThisFrame){this.rectMap.clear();const t=[];this.pois.forEach(i=>{i.draw();const{isInFrustum:o}=i.calcPosAndSize(e,n/2,r/2);o&&t.push(i)}),this.recalculateVisibilities(t),Array.from(this.pois).forEach((t,e)=>{t.updatePosition(n/2,r/2,e)}),this.renderer.clearDepth(),this.renderer.render(this.scene,this.renderCamera)}this.renderThisFrame=!1,this.needRender=!1}orderPoisByLevel(){const t=Array.from(this.pois);t.sort((t,e)=>t.getLevel()-e.getLevel()),this.pois=new Set(t),this.renderThisFrame=!0}recalculateVisibilities(t){const e=[];let n=!0;Array.from(t).sort((t,e)=>e.collision?-1:e.getLevel()-t.getLevel()).forEach(t=>{const{xMin:r,yMin:i,xMax:o,yMax:s}=t.getBoundingRect();if(!t.collision)return t.setHidden(!1),e.push([r,o,i,s]),void(n=!1);const{xMin:a,yMin:u,xMax:c,yMax:l}=t.getOuterRect();if(n)return e.push([r,o,i,s]),n=!1,void t.setHidden(!1);if(!e.some(([t,e,n,a])=>!(o<t||r>e)&&!(s<n||i>a)))e.push([r,o,i,s]),t.setHidden(!1);else if("outer"===t.collisionMode)t.setHidden(!0);else if("icon"===t.collisionMode||"label"===t.collisionMode){!e.some(([t,e,n,r])=>!(c<t||a>e)&&!(l<n||u>r))?(e.push([r,o,i,s]),t.setHidden(!0,!0)):t.setHidden(!0)}})}checkUpdate(){const{THREE:t}=Nd.getInstance();if(this.renderThisFrame)return;if(Array.from(this.pois).some(t=>t.update()))return void(this.renderThisFrame=!0);const{camera:e}=this.parent,{quaternion:n,position:r,zoom:i,up:o}=e,s=r.clone(),a=n.clone(),u=i;if(!this.prevPosition)return this.prevPosition=s.clone(),this.prevQuaternion=a.clone(),this.prevZoom=u,void(this.renderThisFrame=!0);const c=(new t.Quaternion).setFromUnitVectors(o,new t.Vector3(0,1,0)),l=new t.Vector3(0,0,-1).applyQuaternion(this.prevQuaternion);l.applyQuaternion(c);const h=new t.Spherical;h.setFromVector3(l);const p=(new t.Quaternion).setFromUnitVectors(o,new t.Vector3(0,1,0)),f=new t.Vector3(0,0,-1).applyQuaternion(a);f.applyQuaternion(p);const d=new t.Spherical;if(d.setFromVector3(f),Math.abs(h.phi*(180/Math.PI)-d.phi*(180/Math.PI))+Math.abs(h.theta*(180/Math.PI)-d.theta*(180/Math.PI))>1e-4)return this.prevPosition=s.clone(),this.prevQuaternion=a.clone(),this.prevZoom=u,void(this.renderThisFrame=!0);const g=this.parent.getViewWidth(),m=this.parent.getViewHeight(),v=s.clone().project(e),y=(v.x-1)/2*g,x=(1-v.y)/2*m;v.set(y,x,0);const b=this.prevPosition.clone().project(e),_=(b.x-1)/2*g,w=(1-b.y)/2*m;return b.set(_,w,0),v.distanceTo(b)>1e-4||this.prevZoom!==u&&Math.abs((u-this.prevZoom)/u)>1e-4||Math.abs((this.prevZoom-u)/this.prevZoom)>1e-4?(this.prevPosition=s.clone(),this.prevQuaternion=a.clone(),this.prevZoom=u,void(this.renderThisFrame=!0)):void(this.renderThisFrame=!1)}dispose(){this.parent.off(zd.MOUSE_DOWN,this.listeners.pointerDown),this.parent.off(zd.MOUSE_UP,this.listeners.pointerUp),this.parent.off(zd.TOUCH_START,this.listeners.touchStart),this.parent.off(zd.TOUCH_END,this.listeners.touchEnd),this.clearPoi(),Vb.canvas&&(Vb.canvas.remove(),Vb.canvas=null),Vb.ctx&&(Vb.ctx=null)}onPointerDown(t){const{clientX:e,clientY:n}=t,[i,o]=this.parent.getViewOffset(),s=e-i,a=n-o;let u=null;Array.from(this.rectMap).some(([t,e])=>{const{xMin:n,yMin:i,xMax:o,yMax:c}=t;return!!new r.Box2(new r.Vector2(n,i),new r.Vector2(o,c)).containsPoint(new r.Vector2(s,a))&&(u=e,!0)}),u&&this.onNodePointerDown(u,s,a,t.button)}onPointerUp(t){const{THREE:e}=Nd.getInstance(),{clientX:n,clientY:r}=t,[i,o]=this.parent.getViewOffset(),s=n-i,a=r-o,u=new e.Vector2(s,a).distanceToSquared(this.mousePositionBuffer);this.emit(Ud.POI_UP,this.eventTarget,t.button),this.mouseState===Gb.DOWN&&u<100&&this.emit(Ud.POI_CLICKED,this.eventTarget,t.button),this.mouseState=Gb.IDLE}onTouchStart(t){const{clientX:e,clientY:n}=t.touches[0],[i,o]=this.parent.getViewOffset(),s=e-i,a=n-o;let u=null;Array.from(this.rectMap).some(([t,e])=>{const{xMin:n,yMin:i,xMax:o,yMax:c}=t;return!!new r.Box2(new r.Vector2(n,i),new r.Vector2(o,c)).containsPoint(new r.Vector2(s,a))&&(u=e,!0)}),u&&this.onNodePointerDown(u,s,a,0)}onTouchEnd(t){const{THREE:e}=Nd.getInstance(),{clientX:n,clientY:r}=t.changedTouches[0],[i,o]=this.parent.getViewOffset(),s=n-i,a=r-o,u=new e.Vector2(s,a).distanceToSquared(this.mousePositionBuffer);this.emit(Ud.POI_UP,this.eventTarget,0),this.mouseState===Gb.DOWN&&u<100&&this.emit(Ud.POI_CLICKED,this.eventTarget,0),this.mouseState=Gb.IDLE}onNodePointerDown(t,e,n,r=0){this.mouseState===Gb.IDLE&&(this.mouseState=Gb.DOWN,this.mousePositionBuffer.set(e,n),this.eventTarget=t,this.emit(Ud.POI_DOWN,t,r))}createPoi(t){const e=new jb;if(e.setParent(this),this.renderThisFrame=!0,e.setPosition(t),!this.pois)throw Error("poiOverlay need bind a view, use view.addOverlay()");return this.pois.add(e),this.scene.add(e.group),e}setRectMap(t,e){this.rectMap.set(t,e)}removePoi(t){this.pois.delete(t),this.scene.remove(t.group),t.dispose(),this.renderThisFrame=!0}clearPoi(){Array.from(this.pois).forEach(t=>{this.scene.remove(t.group)}),this.pois.clear(),this.renderThisFrame=!0}setVisibility(t){this.visible=t,this.enabled=t}setEnabled(t){this.enabled=t}resize(t,e){this.updateCameraAspect(t,e),this.renderThisFrame=!0}updateCameraAspect(t,e){const n=t,r=e;this.renderCamera.left=-n/2,this.renderCamera.right=n/2,this.renderCamera.top=r/2,this.renderCamera.bottom=-r/2,this.renderCamera.updateProjectionMatrix()}}Vb.canvas=document.createElement("canvas"),Vb.ctx=Vb.canvas.getContext("2d");class jb{constructor(t){this._renderThisFrame=!1;const{THREE:e}=Nd.getInstance();this.dpr=jd.GetGlobalDPR(),this.isFlipY=!1,this.position=t||new e.Vector3,this.group=new r.Group,this.textVisibility=!0,this.iconVisibility=!0,this.iconInCircle=!1,this.iconCircleOptions={width:0,color:"#ffffff"},this.textPosInfo={anchor:"center",offsetX:0,offsetY:0,anchorOffsetX:0,anchorOffsetY:0},this.iconPosInfo={anchor:"center",offsetX:0,offsetY:0,anchorOffsetX:0,anchorOffsetY:0},this.level=1,this.isInFrustum=!1,this.animationEnabled=!1,this.text=null,this.icon=null,this.rect=null,this.boundingBox=null,this.overlapArea={x:0,y:0},this.visible=!0,this.hide=!1,this.subHide=!1,this.rotation=0,this.autoRotation=!1,this.collision=!0,this.collisionMode="outer",this.iconRect={xMin:0,yMin:0,xMax:0,yMax:0},this.textRect={xMin:0,yMin:0,xMax:0,yMax:0},this.boundingRect={xMin:0,yMin:0,xMax:0,yMax:0},this.outerRect={xMin:0,yMin:0,xMax:0,yMax:0},this.visibilityAnimation={anim:null,from:1,to:1,current:1},this.text=null,this.textWidth=0,this.textHeight=0,this.icon=null,this.iconOptions={size:[20,20],src:null},this.labelOptions={fontSize:12,padding:0,content:null},this.rectOptions={width:0,height:0,fill:16711680,opacity:.5,offsetX:0,offsetY:0},this.visiblePartWhenCollision="none",this.subAreaOpacity=1,this.abandonedAreaOpacity=1,this.screenPosition={x:0,y:0},this.labelOpacity=1,this.iconOpacity=1}set renderThisFrame(t){this._renderThisFrame=t}get renderThisFrame(){return this._renderThisFrame}dispose(){this.group&&ky.dispose(this.group,!0),this.parent=null,this.iconCircleMaterial=null,this.iconMaterial=null,this.textMaterial=null,this.icon=null,this.rect=null,this.boundingBox=null,this.group=null}setParent(t){this.parent=t}setPosition(t,e=1e-4){t.distanceTo(this.position)<e||(this.position.copy(t),this.renderThisFrame=!0)}setOpacity(t=this.labelOpacity,e=this.iconOpacity){this.labelOpacity=t,this.iconOpacity=e}setRotation(t,e=1e-4){Math.abs(t-this.rotation)<e||(this.group.rotateZ(t-this.rotation),this.rotation=t,this.renderThisFrame=!0)}setCollision(t){this.collision=t,this.renderThisFrame=!0}setCollisionMode(t){this.collisionMode=t,this.renderThisFrame=!0}setLabelVisibility(t){this.textVisibility=t,this.renderThisFrame=!0}setIconVisiblity(t){this.iconVisibility=t,this.renderThisFrame=!0}setHideModeWhenCollision(t){"all"===t?this.setVisiblePartWhenCollision("none"):"none"===t?this.setVisiblePartWhenCollision("all"):this.setVisiblePartWhenCollision(t)}setVisiblePartWhenCollision(t){this.visiblePartWhenCollision=t}setCollisionOverlap(t,e){this.overlapArea={x:t,y:e},this.renderThisFrame=!0}setLevel(t,e=!1){this.level=t,this.renderThisFrame=!0,this.parent.orderPois(e)}getLevel(){return this.level}setVisibility(t){this.visible!==t&&(this.renderThisFrame=!0),this.visible=t}setHidden(t,e=!1){if(this.animationEnabled){const n=t?e?.5:0:1;if(this.visibilityAnimation.anim&&n===this.visibilityAnimation.to)return;if(!this.visibilityAnimation.anim&&t===this.hide&&e===this.subHide)return;this.visibilityAnimation.anim&&(this.visibilityAnimation.anim.stop(),this.visibilityAnimation.anim=null);const r={subAreaOpacity:this.subAreaOpacity,abandonedAreaOpacity:this.abandonedAreaOpacity},i={subAreaOpacity:0,abandonedAreaOpacity:0};t?e?(i.subAreaOpacity=1,i.abandonedAreaOpacity=0):(i.subAreaOpacity=0,i.abandonedAreaOpacity=0):(i.subAreaOpacity=1,i.abandonedAreaOpacity=1);let o=[];const s=[];switch(this.visiblePartWhenCollision){case"all":this.text&&o.push(this.textMaterial),this.icon&&(o.push(this.iconMaterial),this.iconCircleMaterial&&this.iconCircleMaterial.visible&&o.push(this.iconCircleMaterial));break;case"none":this.text&&s.push(this.textMaterial),this.icon&&(s.push(this.iconMaterial),this.iconCircleMaterial&&this.iconCircleMaterial.visible&&s.push(this.iconCircleMaterial));break;case"label":o=[this.textMaterial,this.rectMaterial],this.text&&o.push(this.textMaterial),this.icon&&(s.push(this.iconMaterial),this.iconCircleMaterial&&this.iconCircleMaterial.visible&&s.push(this.iconCircleMaterial));break;case"icon":this.text&&s.push(this.textMaterial),this.icon&&(o.push(this.iconMaterial),this.iconCircleMaterial&&this.iconCircleMaterial.visible&&o.push(this.iconCircleMaterial))}this.visibilityAnimation.from=this.visibilityAnimation.current,this.visibilityAnimation.to=t?e?.5:0:1;const a=300;this.visibilityAnimation.anim=new v.a.Tween(r).to(i,a).onUpdate(t=>{this.subAreaOpacity=t.subAreaOpacity,this.abandonedAreaOpacity=t.abandonedAreaOpacity,o.forEach(e=>{e.opacity=t.subAreaOpacity}),s.forEach(e=>{e.opacity=t.abandonedAreaOpacity})}).start().onComplete(()=>{this.visibilityAnimation.anim=null,this.visibilityAnimation.from=null,this.visibilityAnimation.current=null,this.visibilityAnimation.to=null,this.hide=t,this.subHide=e})}else this.hide===t&&this.subHide===e||(this.hide=t,this.subHide=e,this.renderThisFrame=!0)}setRect(t){this.withRect=t,this.renderThisFrame=!0}setRectDefSize(t,e){this.rectOptions.width=t,this.rectOptions.height=e,this.renderThisFrame=!0}setRectFill(t){this.rectOptions.fill=t,this.renderThisFrame=!0}setRectOffset(t=0,e=0){this.rectOptions.offsetX=t,this.rectOptions.offsetY=e,this.renderThisFrame=!0}setIconImage(t){this.iconOptions&&this.iconOptions.src===t||(this.iconOptions.src=t,this.clearIcon(),this.renderThisFrame=!0)}setIconSize(t,e){this.iconSize=[t,e],this.iconOptions.size=[t,e],this.renderThisFrame=!0}setIconShowInCircle(t,e){this.iconInCircle=!0,this.iconCircleOptions={width:t,color:e}}drawIcon(){const{src:t,size:e}=this.iconOptions;if(t&&(!this.icon||!this.group.getObjectByName("poi_icon")||!!this.iconInCircle!=!!this.iconCircleMaterial))if(jb.ImageMaterialMap.has(t))if("dealing"===jb.ImageMaterialMap.get(t))this.renderThisFrame=!0;else{this.icon&&this.group.remove(this.icon),this.iconMaterial=jb.ImageMaterialMap.get(t).clone(),this.iconMaterial.opacity=this.iconOpacity;const{width:n,color:i}=this.iconCircleOptions,o=n&&this.iconInCircle;o&&(this.iconCircleMaterial=new r.MeshBasicMaterial({color:i,transparent:!0,opacity:this.iconOpacity}));const s=o?[this.iconCircleMaterial,this.iconMaterial]:[this.iconMaterial],a=o?new r.CircleGeometry(e[0]/2,30):new r.PlaneGeometry(e[0],e[1]),u=Hb(a,s);this.icon=u,this.icon&&(this.icon.children.length>1&&this.icon.children[1].scale.set(e[0]/(n+e[0]),e[0]/(n+e[0]),1),this.icon.renderOrder=3,this.icon.name="poi_icon",this.group.add(this.icon),this.renderThisFrame=!0)}else{jb.ImageMaterialMap.set(t,"dealing");(new r.TextureLoader).load(t,e=>{e.needsUpdate=!0,e.magFilter=r.LinearFilter,e.minFilter=r.NearestFilter,e.flipY=this.isFlipY;const n=new r.MeshBasicMaterial({map:e,transparent:!0,opacity:this.iconOpacity});n.needsUpdate=!0,n.visible=!0,jb.ImageMaterialMap.set(t,n)})}}clearIcon(){this.icon&&(this.group&&this.group.remove(this.icon),this.icon.children.forEach(t=>{t.geometry&&t.geometry.dispose()}),this.iconMaterial&&(this.iconMaterial.dispose(),this.iconMaterial=null),this.iconCircleMaterial&&(this.iconCircleMaterial.dispose(),this.iconCircleMaterial=null),this.icon=null)}setIconAnchor(t){this.iconPosInfo.anchor=t,this.renderThisFrame=!0}setIconFlipY(t){this.isFlipY=t}setIconOffset(t,e){this.iconPosInfo.anchorOffsetX=t,this.iconPosInfo.anchorOffsetY=e,this.renderThisFrame=!0}setFontSize(t){this.labelOptions.fontSize=t,this.renderThisFrame=!0}setFontPadding(t){this.labelOptions.padding=t,this.renderThisFrame=!0}setLabelText(t){this.labelOptions.content=t,this.renderThisFrame=!0}drawText(){if(!this.labelOptions.content)return;if(this.group.getObjectByName("poi_text"))return;const t=this.dpr,{fontSize:e,padding:n,content:i}=this.labelOptions;Vb.ctx.font=e*t+"px sans-serif",Vb.ctx.fillStyle="black";const o=Vb.ctx.measureText(i),s=Math.ceil(o.width)+10+2*n,a=(e+5+2*n)*t;this.textWidth=s/t,this.textHeight=a/t,this.setRectDefSize(this.textWidth,this.textHeight),Vb.ctx.clearRect(0,0,s,a),Vb.ctx.fillText(i,n*t,(e+n)*t);const u=Vb.ctx.getImageData(0,0,s,a);this.textMaterial=new r.MeshBasicMaterial({transparent:!0,map:new r.DataTexture(Uint8Array.from(u.data),s,a,r.RGBAFormat),side:r.DoubleSide,opacity:this.labelOpacity}),this.text=new r.Mesh(new r.PlaneGeometry(this.textWidth,this.textHeight),this.textMaterial),this.text.material.map.flipY=!0,this.text.material.map.flipX=!0,this.text.material.map.needsUpdate=!0,this.text.material.map.magFilter=r.LinearFilter,this.text.material.visible=!0,this.text.name="poi_text",this.text.renderOrder=4;const{offsetX:c,offsetY:l}=this.recalcOffset(this.textWidth,this.textHeight,this.textPosInfo.anchor,this.textPosInfo.anchorOffsetX,this.textPosInfo.anchorOffsetY);this.textPosInfo.offsetX=c,this.textPosInfo.offsetY=l,this.group.add(this.text)}recalcOffset(t,e,n,r,i){let o=0,s=0;switch(n){case"center":o=r,s=i;break;case"left":o=t/2+r,s=i;break;case"right":o=-t/2+r,s=i;break;case"top":o=r,s=-e/2+i;break;case"bottom":o=r,s=e/2+i;break;case"topleft":o=t/2+r,s=-e/2+i;break;case"topright":o=-t/2+r,s=-e/2+i;break;case"bottomleft":o=t/2+r,s=e/2+i;break;case"bottomright":o=-t/2+r,s=e/2+i}return{offsetX:o,offsetY:s}}setLabelAnchor(t){this.textPosInfo.anchor=t,this.renderThisFrame=!0}setLabelOffset(t,e){this.textPosInfo.anchorOffsetX=t,this.textPosInfo.anchorOffsetY=e,this.renderThisFrame=!0}getLabelAnchor(){return this.textPosInfo.anchor}getLabelOffset(){const{anchorOffsetX:t,anchorOffsetY:e}=this.textPosInfo;return{x:t,y:e}}calcBoundingSize(){const t=this.screenPosition,e=this.textPosInfo.offsetX,n=this.textPosInfo.offsetY,r=this.iconPosInfo.offsetX,i=this.iconPosInfo.offsetY,o={xMin:this.text?t.x-this.textWidth/2+e:t.x,xMax:this.text?t.x+this.textWidth/2+e:t.x,yMin:this.text?t.y-this.textHeight/2-n:t.y,yMax:this.text?t.y+this.textHeight/2-n:t.y},s={xMin:this.icon?t.x-this.iconOptions.size[0]/2+r:t.x,xMax:this.icon?t.x+this.iconOptions.size[0]/2+r:t.x,yMin:this.icon?t.y-this.iconOptions.size[1]/2-i:t.y,yMax:this.icon?t.y+this.iconOptions.size[1]/2-i:t.y};let a=Math.max(s.xMax,o.xMax),u=Math.min(s.xMin,o.xMin),c=Math.max(s.yMax,o.yMax),l=Math.min(s.yMin,o.yMin);this.iconRect={xMin:this.icon?t.x-this.iconOptions.size[0]/2+r:t.x,xMax:this.icon?t.x+this.iconOptions.size[0]/2+r:t.x,yMin:this.icon?t.y-this.iconOptions.size[1]/2-i:t.y,yMax:this.icon?t.y+this.iconOptions.size[1]/2-i:t.y},this.textRect={xMin:this.text?t.x-this.textWidth/2+e:t.x,xMax:this.text?t.x+this.textWidth/2+e:t.x,yMin:this.text?t.y-this.textHeight/2-n:t.y,yMax:this.text?t.y+this.textHeight/2-n:t.y},this.outerRect={xMax:a,xMin:u,yMax:c,yMin:l},"icon"===this.collisionMode?(a=s.xMax,u=s.xMin,c=s.yMax,l=s.yMin):"label"===this.collisionMode&&(a=o.xMax,u=o.xMin,c=o.yMax,l=o.yMin),this.boundingRect.xMax=a,this.boundingRect.yMax=c,this.boundingRect.xMin=u,this.boundingRect.yMin=l}drawRect(){if(!this.withRect||!this.labelOptions.content)return;if(this.rect&&this.group.getObjectByName("poi_rect"))return;this.rect=new r.Group;const t=this.rectOptions.width||this.textWidth,e=this.rectOptions.height||this.textHeight,n=[0+t/2-10,0+e/2],i=[0+t/2,0+e/2-10],o=[0+t/2,0-e/2+10],s=[0+t/2-10,0-e/2],a=[0-t/2+10,0-e/2],u=[0-t/2,0-e/2+10],c=[0-t/2,0+e/2-10],l=[0-t/2+10,0+e/2],h=new r.Shape;h.moveTo(n[0],n[1]),h.bezierCurveTo(n[0],n[1],0+t/2,0+e/2,i[0],i[1]),h.moveTo(o[0],o[1]),h.bezierCurveTo(o[0],o[1],0+t/2,0-e/2,s[0],s[1]),h.moveTo(a[0],a[1]),h.bezierCurveTo(a[0],a[1],0-t/2,0-e/2,u[0],u[1]),h.moveTo(c[0],c[1]),h.bezierCurveTo(c[0],c[1],0-t/2,0+e/2,l[0],l[1]),h.moveTo(n[0],n[1]);const p=new r.ShapeGeometry(h),f=new r.MeshBasicMaterial({color:255,transparent:!0,opacity:.5});this.rectMaterial=f;const d=new r.Mesh(p,f);h.autoClose=!0;const g=h.getPoints(),m=(new r.BufferGeometry).setFromPoints(g),v=new r.Line(m,new r.LineBasicMaterial({color:16711680}));v.position.set(0,0,0),this.rect.add(d),this.rect.add(v),this.rect.renderOrder=2,this.rect.name="poi_rect",this.group.add(this.rect)}drawBoundingBox(){if(!this.withBoundingBox)return;if(this.group.getObjectByName("poi_bounding_rect"))return;if(0===this.outerRect.xMin&&0===this.outerRect.xMax)return;const{xMax:t,yMax:e,xMin:n,yMin:i}=this.outerRect;this.boundingBox=new r.Group;const o=t-n,s=e-i,a=[0+o/2-10,0+s/2],u=[0+o/2,0+s/2-10],c=[0+o/2,0-s/2+10],l=[0+o/2-10,0-s/2],h=[0-o/2+10,0-s/2],p=[0-o/2,0-s/2+10],f=[0-o/2,0+s/2-10],d=[0-o/2+10,0+s/2],g=new r.Shape;g.moveTo(a[0],a[1]),g.bezierCurveTo(a[0],a[1],0+o/2,0+s/2,u[0],u[1]),g.moveTo(c[0],c[1]),g.bezierCurveTo(c[0],c[1],0+o/2,0-s/2,l[0],l[1]),g.moveTo(h[0],h[1]),g.bezierCurveTo(h[0],h[1],0-o/2,0-s/2,p[0],p[1]),g.moveTo(f[0],f[1]),g.bezierCurveTo(f[0],f[1],0-o/2,0+s/2,d[0],d[1]),g.moveTo(a[0],a[1]);const m=new r.ShapeGeometry(g),v=new r.MeshBasicMaterial({color:16711680,transparent:!0,opacity:.5}),y=new r.Mesh(m,v);g.autoClose=!0;const x=g.getPoints(),b=(new r.BufferGeometry).setFromPoints(x),_=new r.Line(b,new r.LineBasicMaterial({color:16711680,linewidth:2}));_.position.set(0,0,0),this.boundingBox.name="poi_bounding_rect",this.boundingBox.add(y),this.boundingBox.add(_),this.boundingBox.renderOrder=0,this.group.add(this.boundingBox)}setBoundingBox(){this.withBoundingBox=!0}getBoundingRect(){const{x:t,y:e}=this.overlapArea,{xMin:n,yMin:r,xMax:i,yMax:o}=this.boundingRect;return{xMin:n+t,yMin:r+e,xMax:i-t,yMax:o-e}}getOuterRect(){const{x:t,y:e}=this.overlapArea,{xMin:n,yMin:r,xMax:i,yMax:o}=this.outerRect;return{xMin:n+t,yMin:r+e,xMax:i-t,yMax:o-e}}setAnimationEnabled(t){this.animationEnabled=t}calcPoiRotation(t){return this.autoRotation?t+this.rotation:this.rotation}getVisibility(){return this.visible}calcPosAndSize(t,e,n){if(!this.parent)return{isInFrustum:this.isInFrustum};let r=this.visible&&t.containsPoint(this.position);if(r){const t=this.position.clone().project(this.parent.camera);this.screenPosition={x:(t.x+1)*e,y:(1-t.y)*n},this.calcBoundingSize(),(this.outerRect.xMin<0||this.outerRect.xMax>2*e||this.outerRect.yMin<0||this.outerRect.yMax>2*n)&&(r=!1)}return this.isInFrustum=r,{isInFrustum:this.isInFrustum}}draw(){this.drawText(),this.drawIcon(),this.drawRect(),this.drawBoundingBox()}updatePosition(t,e,n){if(!this.group)return;if(!this.isInFrustum)return this.hide=!0,this.subHide=!1,void(this.group.visible=!1);if(this.group.visible=this.visible,!this.visible)return;const i=this.textPosInfo.offsetX,o=this.textPosInfo.offsetY,s=this.iconPosInfo.offsetX,a=this.iconPosInfo.offsetY,u=1e-4*n;if(this.group.position.set(this.screenPosition.x-t,e-this.screenPosition.y,u),this.text&&this.text.position.set(i,o,0),this.rect&&this.rect.position.set(i,o,0),this.icon&&this.icon.position.set(s,a,0),this.boundingBox){const t=(this.outerRect.xMax+this.outerRect.xMin)/2,e=(this.outerRect.yMax+this.outerRect.yMin)/2;this.boundingBox.position.set(t-this.screenPosition.x,this.screenPosition.y-e,0)}const c=this.visibilityAnimation.anim,l=!!c||!c&&(!this.hide||this.subHide);if(this.group.visible=l,l&&(!c||!this.animationEnabled)){let t=[],e=[];switch(this.visiblePartWhenCollision){case"all":t=[this.group],e=[];break;case"none":t=[],e=[this.group];break;case"label":t=[],this.text&&t.push(this.text),this.rect&&t.push(this.rect),this.icon&&e.push(this.icon);break;case"icon":this.icon&&t.push(this.icon),this.text&&e.push(this.text),this.rect&&e.push(this.rect);break;default:t=[],e=[this.group]}this.subHide?(t.forEach(t=>{t.visible=!0,t instanceof r.Group&&t.children.forEach(t=>{t.visible=!0})}),e.forEach(t=>{t.visible=!1,t instanceof r.Group&&t.children.forEach(t=>{t.visible=!1})})):this.hide||(t.forEach(t=>{t.visible=!0,t instanceof r.Group&&t.children.forEach(t=>{t.visible=!0})}),e.forEach(t=>{t.visible=!0,t instanceof r.Group&&t.children.forEach(t=>{t.visible=!0})})),this.icon&&!this.iconVisibility&&(this.icon.visible=!1),this.text&&!this.textVisibility&&(this.text.visible=!1)}l&&(this.subHide?this.parent&&("icon"===this.visiblePartWhenCollision?this.parent.setRectMap(this.iconRect,this):this.parent.setRectMap(this.textRect,this)):this.parent&&(this.parent.setRectMap(this.textRect,this),this.parent.setRectMap(this.iconRect,this)))}update(){const t=this.renderThisFrame||this.isInFrustum&&!!this.iconOptions.src&&!this.icon;return this.renderThisFrame=!1,t}setPoiId(t){this.poiId=t}}jb.ImageMaterialMap=new Map,jb.ImageMaterialMap=new Map;!function(t){t[t.IDLE=0]="IDLE",t[t.DOWN=1]="DOWN",t[t.MOVE=2]="MOVE"}(Ub||(Ub={}));!function(t){t[t.IDLE=0]="IDLE",t[t.DOWN=1]="DOWN",t[t.MOVE=2]="MOVE"}(zb||(zb={}));class Wb extends Qd{constructor(t){if(super(),this.needRender=!1,jd.GetEnv()===Fd.Miniapp){if(!t)throw Error("poi-overlay need a offscreenCanvas");Wb.canvas=t}else Wb.canvas||(Wb.canvas=document.createElement("canvas"));const e=jd.GetGlobalDPR();Wb.canvas.width=500*e,Wb.canvas.height=500*e,Wb.ctx=Wb.canvas.getContext("2d")}init(t){const{THREE:e}=Nd.getInstance();this.rectMap=new Map,this.parent=t,this.scene=t.stage.scene;const n=t.getViewWidth(),i=t.getViewHeight();this.renderCamera=new r.OrthographicCamera(-n/2,n/2,i/2,-i/2,.1,1e3),this.renderCamera.up.set(0,1,0),this.renderCamera.position.set(0,0,50),this.renderCamera.lookAt(0,0,0),this.camera=this.parent.camera,this.renderer=this.parent.renderer,this.pois=new Set,this.enabled=!0,this.orderPois=ky.debounce(this.orderPoisByLevel.bind(this),50),this.listeners={pointerDown:t=>{this.onPointerDown(t)},pointerUp:t=>{this.onPointerUp(t)},touchStart:t=>{this.onTouchStart(t)},touchEnd:t=>{this.onTouchEnd(t)}},this.mouseState=zb.IDLE,this.mousePositionBuffer=new e.Vector2,this.parent.on(zd.MOUSE_DOWN,this.listeners.pointerDown),this.parent.on(zd.MOUSE_UP,this.listeners.pointerUp),this.parent.on(zd.TOUCH_START,this.listeners.touchStart),this.parent.on(zd.TOUCH_END,this.listeners.touchEnd)}update(){return!(!this.renderThisFrame&&!Array.from(this.pois).reduce((t,e)=>e.update()||t,!1))&&(this.renderThisFrame=!1,this.needRender=!0,!0)}forceRenderInThisFrame(){this.renderThisFrame=!0}render(){if(!this.enabled)return;const{THREE:t}=Nd.getInstance(),e=new t.Frustum;e.setFromProjectionMatrix((new t.Matrix4).multiplyMatrices(this.parent.camera.projectionMatrix,this.parent.camera.matrixWorldInverse));const n=this.parent.getViewWidth(),r=this.parent.getViewHeight(),i=new t.Euler;if(i.setFromQuaternion(this.parent.camera.quaternion,"ZYX"),this.checkUpdate(),this.needRender||this.renderThisFrame){this.rectMap.clear();const t=[];this.pois.forEach(i=>{i.draw();const{isInFrustum:o}=i.calcPosAndSize(e,n/2,r/2);o&&t.push(i)}),this.recalculateVisibilities(t),Array.from(this.pois).forEach(t=>{t.updatePosition(i,this.parent.camera.zoom)})}this.renderThisFrame=!1,this.needRender=!1}orderPoisByLevel(){const t=Array.from(this.pois);t.sort((t,e)=>t.getLevel()-e.getLevel()),this.pois=new Set(t),this.renderThisFrame=!0}recalculateVisibilities(t){const e=[];let n=!0;Array.from(t).sort((t,e)=>e.collision?-1:e.getLevel()-t.getLevel()).forEach(t=>{const{xMin:r,yMin:i,xMax:o,yMax:s}=t.getBoundingRect();if(!t.collision)return t.setHidden(!1),e.push([r,o,i,s]),void(n=!1);const{xMin:a,yMin:u,xMax:c,yMax:l}=t.getOuterRect();if(n)return e.push([r,o,i,s]),n=!1,void t.setHidden(!1);if(!e.some(([t,e,n,a])=>!(o<t||r>e)&&!(s<n||i>a)))e.push([r,o,i,s]),t.setHidden(!1);else if("outer"===t.collisionMode)t.setHidden(!0);else if("icon"===t.collisionMode||"label"===t.collisionMode){!e.some(([t,e,n,r])=>!(c<t||a>e)&&!(l<n||u>r))?(e.push([r,o,i,s]),t.setHidden(!0,!0)):t.setHidden(!0)}})}checkUpdate(){const{THREE:t}=Nd.getInstance();if(this.renderThisFrame)return;if(Array.from(this.pois).some(t=>t.update()))return void(this.renderThisFrame=!0);const{camera:e}=this.parent,{quaternion:n,position:r,zoom:i,up:o}=e,s=r.clone(),a=n.clone(),u=i;if(!this.prevPosition)return this.prevPosition=s.clone(),this.prevQuaternion=a.clone(),this.prevZoom=u,void(this.renderThisFrame=!0);const c=(new t.Quaternion).setFromUnitVectors(o,new t.Vector3(0,1,0)),l=new t.Vector3(0,0,-1).applyQuaternion(this.prevQuaternion);l.applyQuaternion(c);const h=new t.Spherical;h.setFromVector3(l);const p=(new t.Quaternion).setFromUnitVectors(o,new t.Vector3(0,1,0)),f=new t.Vector3(0,0,-1).applyQuaternion(a);f.applyQuaternion(p);const d=new t.Spherical;if(d.setFromVector3(f),Math.abs(h.phi*(180/Math.PI)-d.phi*(180/Math.PI))+Math.abs(h.theta*(180/Math.PI)-d.theta*(180/Math.PI))>1e-4)return this.prevPosition=s.clone(),this.prevQuaternion=a.clone(),this.prevZoom=u,void(this.renderThisFrame=!0);const g=this.parent.getViewWidth(),m=this.parent.getViewHeight(),v=s.clone().project(e),y=(v.x-1)/2*g,x=(1-v.y)/2*m;v.set(y,x,0);const b=this.prevPosition.clone().project(e),_=(b.x-1)/2*g,w=(1-b.y)/2*m;return b.set(_,w,0),v.distanceTo(b)>1e-4||this.prevZoom!==u&&Math.abs((u-this.prevZoom)/u)>1e-4||Math.abs((this.prevZoom-u)/this.prevZoom)>1e-4?(this.prevPosition=s.clone(),this.prevQuaternion=a.clone(),this.prevZoom=u,void(this.renderThisFrame=!0)):void(this.renderThisFrame=!1)}dispose(){this.parent.off(zd.MOUSE_DOWN,this.listeners.pointerDown),this.parent.off(zd.MOUSE_UP,this.listeners.pointerUp),this.parent.off(zd.TOUCH_START,this.listeners.touchStart),this.parent.off(zd.TOUCH_END,this.listeners.touchEnd),this.clearPoi(),Wb.canvas&&(Wb.canvas.remove(),Wb.canvas=null),Wb.ctx&&(Wb.ctx=null)}onPointerDown(t){const{clientX:e,clientY:n}=t,[i,o]=this.parent.getViewOffset(),s=e-i,a=n-o;let u=null;Array.from(this.rectMap).some(([t,e])=>{const{xMin:n,yMin:i,xMax:o,yMax:c}=t;return!!new r.Box2(new r.Vector2(n,i),new r.Vector2(o,c)).containsPoint(new r.Vector2(s,a))&&(u=e,!0)}),u&&this.onNodePointerDown(u,s,a,t.button)}onPointerUp(t){const{THREE:e}=Nd.getInstance(),{clientX:n,clientY:r}=t,[i,o]=this.parent.getViewOffset(),s=n-i,a=r-o,u=new e.Vector2(s,a).distanceToSquared(this.mousePositionBuffer);this.emit(Ud.POI_UP,this.eventTarget,t.button),this.mouseState===zb.DOWN&&u<100&&this.emit(Ud.POI_CLICKED,this.eventTarget,t.button),this.mouseState=zb.IDLE}onTouchStart(t){const{clientX:e,clientY:n}=t.touches[0],[i,o]=this.parent.getViewOffset(),s=e-i,a=n-o;let u=null;Array.from(this.rectMap).some(([t,e])=>{const{xMin:n,yMin:i,xMax:o,yMax:c}=t;return!!new r.Box2(new r.Vector2(n,i),new r.Vector2(o,c)).containsPoint(new r.Vector2(s,a))&&(u=e,!0)}),u&&this.onNodePointerDown(u,s,a,0)}onTouchEnd(t){const{THREE:e}=Nd.getInstance(),{clientX:n,clientY:r}=t.changedTouches[0],[i,o]=this.parent.getViewOffset(),s=n-i,a=r-o,u=new e.Vector2(s,a).distanceToSquared(this.mousePositionBuffer);this.emit(Ud.POI_UP,this.eventTarget,0),this.mouseState===zb.DOWN&&u<100&&this.emit(Ud.POI_CLICKED,this.eventTarget,0),this.mouseState=zb.IDLE}onNodePointerDown(t,e,n,r=0){this.mouseState===zb.IDLE&&(this.mouseState=zb.DOWN,this.mousePositionBuffer.set(e,n),this.eventTarget=t,this.emit(Ud.POI_DOWN,t,r))}createPoi(t){const e=new qb;if(e.setParent(this),this.renderThisFrame=!0,e.setPosition(t),!this.pois)throw Error("poiOverlay need bind a view, use view.addOverlay()");return this.pois.add(e),this.scene.add(e.group),e}setRectMap(t,e){this.rectMap.set(t,e)}removePoi(t){this.pois.delete(t),this.scene.remove(t.group),t.dispose(),this.renderThisFrame=!0}clearPoi(){Array.from(this.pois).forEach(t=>{this.scene.remove(t.group)}),this.pois.clear(),this.renderThisFrame=!0}setVisibility(t){this.visible=t,this.enabled=t}setEnabled(t){this.enabled=t}resize(t,e){this.updateCameraAspect(t,e),this.renderThisFrame=!0}updateCameraAspect(t,e){const n=t,r=e;this.renderCamera.left=-n/2,this.renderCamera.right=n/2,this.renderCamera.top=r/2,this.renderCamera.bottom=-r/2,this.renderCamera.updateProjectionMatrix()}}class qb{constructor(t){this._renderThisFrame=!1;const{THREE:e}=Nd.getInstance();this.dpr=jd.GetGlobalDPR(),this.isFlipY=!1,this.position=t||new e.Vector3,this.group=new r.Group,this.textVisibility=!0,this.iconVisibility=!0,this.iconInCircle=!1,this.iconCircleOptions={width:0,color:"#ffffff"},this.textPosInfo={anchor:"center",offsetX:0,offsetY:0,anchorOffsetX:0,anchorOffsetY:0},this.iconPosInfo={anchor:"center",offsetX:0,offsetY:0,anchorOffsetX:0,anchorOffsetY:0},this.level=1,this.isInFrustum=!1,this.animationEnabled=!1,this.text=null,this.icon=null,this.rect=null,this.boundingBox=null,this.overlapArea={x:0,y:0},this.visible=!0,this.hide=!1,this.subHide=!1,this.rotation=0,this.autoRotation=!1,this.collision=!0,this.collisionMode="outer",this.iconRect={xMin:0,yMin:0,xMax:0,yMax:0},this.textRect={xMin:0,yMin:0,xMax:0,yMax:0},this.boundingRect={xMin:0,yMin:0,xMax:0,yMax:0},this.outerRect={xMin:0,yMin:0,xMax:0,yMax:0},this.visibilityAnimation={anim:null,from:1,to:1,current:1},this.text=null,this.textWidth=0,this.textHeight=0,this.icon=null,this.iconOptions={size:[20,20],src:null},this.labelOptions={fontSize:12,padding:0,content:null},this.rectOptions={width:0,height:0,fill:16711680,opacity:.5,offsetX:0,offsetY:0},this.visiblePartWhenCollision="none",this.subAreaOpacity=1,this.abandonedAreaOpacity=1,this.screenPosition={x:0,y:0},this.labelOpacity=1,this.iconOpacity=1}set renderThisFrame(t){this._renderThisFrame=t}get renderThisFrame(){return this._renderThisFrame}dispose(){this.group&&ky.dispose(this.group,!0),this.parent=null,this.iconCircleMaterial=null,this.iconMaterial=null,this.textMaterial=null,this.icon=null,this.rect=null,this.boundingBox=null,this.group=null}setParent(t){this.parent=t}setPosition(t,e=1e-4){t.distanceTo(this.position)<e||(this.position.copy(t),this.group&&this.group.position.copy(t),this.renderThisFrame=!0)}setOpacity(t=this.labelOpacity,e=this.iconOpacity){this.labelOpacity=t,this.iconOpacity=e,this.textMaterial&&(this.textMaterial.opacity=t),this.iconMaterial&&(this.iconMaterial.opacity=e),this.renderThisFrame=!0}setRotation(t,e=1e-4){Math.abs(t-this.rotation)<e||(this.group.rotateZ(t-this.rotation),this.rotation=t,this.renderThisFrame=!0)}setCollision(t){this.collision=t,this.renderThisFrame=!0}setCollisionMode(t){this.collisionMode=t,this.renderThisFrame=!0}setLabelVisibility(t){this.textVisibility=t,this.renderThisFrame=!0}setIconVisiblity(t){this.iconVisibility=t,this.renderThisFrame=!0}setHideModeWhenCollision(t){"all"===t?this.setVisiblePartWhenCollision("none"):"none"===t?this.setVisiblePartWhenCollision("all"):this.setVisiblePartWhenCollision(t)}setVisiblePartWhenCollision(t){this.visiblePartWhenCollision=t}setCollisionOverlap(t,e){this.overlapArea={x:t,y:e},this.renderThisFrame=!0}setLevel(t,e=!1){this.level=t,this.renderThisFrame=!0,this.parent.orderPois(e)}getLevel(){return this.level}setVisibility(t){this.visible!==t&&(this.renderThisFrame=!0),this.visible=t}setHidden(t,e=!1){if(this.animationEnabled){const n=t?e?.5:0:1;if(this.visibilityAnimation.anim&&n===this.visibilityAnimation.to)return;if(!this.visibilityAnimation.anim&&t===this.hide&&e===this.subHide)return;this.visibilityAnimation.anim&&(this.visibilityAnimation.anim.stop(),this.visibilityAnimation.anim=null);const r={subAreaOpacity:this.subAreaOpacity,abandonedAreaOpacity:this.abandonedAreaOpacity},i={subAreaOpacity:0,abandonedAreaOpacity:0};t?e?(i.subAreaOpacity=1,i.abandonedAreaOpacity=0):(i.subAreaOpacity=0,i.abandonedAreaOpacity=0):(i.subAreaOpacity=1,i.abandonedAreaOpacity=1);let o=[];const s=[];switch(this.visiblePartWhenCollision){case"all":this.text&&o.push(this.textMaterial),this.icon&&(o.push(this.iconMaterial),this.iconCircleMaterial&&this.iconCircleMaterial.visible&&o.push(this.iconCircleMaterial));break;case"none":this.text&&s.push(this.textMaterial),this.icon&&(s.push(this.iconMaterial),this.iconCircleMaterial&&this.iconCircleMaterial.visible&&s.push(this.iconCircleMaterial));break;case"label":o=[this.textMaterial,this.rectMaterial],this.text&&o.push(this.textMaterial),this.icon&&(s.push(this.iconMaterial),this.iconCircleMaterial&&this.iconCircleMaterial.visible&&s.push(this.iconCircleMaterial));break;case"icon":this.text&&s.push(this.textMaterial),this.icon&&(o.push(this.iconMaterial),this.iconCircleMaterial&&this.iconCircleMaterial.visible&&o.push(this.iconCircleMaterial))}this.visibilityAnimation.from=this.visibilityAnimation.current,this.visibilityAnimation.to=t?e?.5:0:1;const a=300;this.visibilityAnimation.anim=new v.a.Tween(r).to(i,a).onUpdate(t=>{this.subAreaOpacity=t.subAreaOpacity,this.abandonedAreaOpacity=t.abandonedAreaOpacity,o.forEach(e=>{e.opacity=t.subAreaOpacity}),s.forEach(e=>{e.opacity=t.abandonedAreaOpacity})}).start().onComplete(()=>{this.visibilityAnimation.anim=null,this.visibilityAnimation.from=null,this.visibilityAnimation.current=null,this.visibilityAnimation.to=null,this.hide=t,this.subHide=e})}else this.hide===t&&this.subHide===e||(this.hide=t,this.subHide=e,this.renderThisFrame=!0)}setRect(t){this.withRect=t,this.renderThisFrame=!0}setRectDefSize(t,e){this.rectOptions.width=t,this.rectOptions.height=e,this.renderThisFrame=!0}setRectFill(t){this.rectOptions.fill=t,this.renderThisFrame=!0}setRectOffset(t=0,e=0){this.rectOptions.offsetX=t,this.rectOptions.offsetY=e,this.renderThisFrame=!0}setIconImage(t){this.iconOptions&&this.iconOptions.src===t||(this.iconOptions.src=t,this.clearIcon(),this.renderThisFrame=!0)}setIconSize(t,e){this.iconSize=[t,e],this.iconOptions.size=[t,e],this.renderThisFrame=!0}setIconShowInCircle(t,e){this.iconInCircle=!0,this.iconCircleOptions={width:t,color:e}}drawIcon(){const{src:t,size:e}=this.iconOptions;if(t&&(!this.icon||!this.group.getObjectByName("poi_icon")||!!this.iconInCircle!=!!this.iconCircleMaterial))if(qb.ImageMaterialMap.has(t))if("dealing"===qb.ImageMaterialMap.get(t))this.renderThisFrame=!0;else{this.icon&&this.group.remove(this.icon),this.iconMaterial=qb.ImageMaterialMap.get(t).clone(),this.iconMaterial.opacity=this.iconOpacity;const{width:n,color:i}=this.iconCircleOptions,o=n&&this.iconInCircle;o&&(this.iconCircleMaterial=new r.MeshBasicMaterial({color:i,transparent:!0,opacity:this.iconOpacity}));const s=o?[this.iconCircleMaterial,this.iconMaterial]:[this.iconMaterial],a=o?new r.CircleGeometry(e[0]/2,30):new r.PlaneGeometry(e[0],e[1]),u=Hb(a,s);this.icon=u,this.icon&&(this.icon.children.length>1&&this.icon.children[1].scale.set(e[0]/(n+e[0]),e[0]/(n+e[0]),1),this.icon.renderOrder=3,this.icon.name="poi_icon",this.group.add(this.icon),this.renderThisFrame=!0)}else{qb.ImageMaterialMap.set(t,"dealing");(new r.TextureLoader).load(t,e=>{e.needsUpdate=!0,e.magFilter=r.LinearFilter,e.flipY=this.isFlipY;const n=new r.MeshBasicMaterial({map:e,transparent:!0,opacity:this.iconOpacity});n.needsUpdate=!0,n.visible=!0,qb.ImageMaterialMap.set(t,n)})}}clearIcon(){this.icon&&(this.group&&this.group.remove(this.icon),this.icon.children.forEach(t=>{t.geometry&&t.geometry.dispose()}),this.iconMaterial&&(this.iconMaterial.dispose(),this.iconMaterial=null),this.iconCircleMaterial&&(this.iconCircleMaterial.dispose(),this.iconCircleMaterial=null),this.icon=null)}setIconAnchor(t){this.iconPosInfo.anchor=t,this.renderThisFrame=!0}setIconFlipY(t){this.isFlipY=t}setIconOffset(t,e){this.iconPosInfo.anchorOffsetX=t,this.iconPosInfo.anchorOffsetY=e,this.renderThisFrame=!0}setFontSize(t){this.labelOptions.fontSize=t,this.renderThisFrame=!0}setFontPadding(t){this.labelOptions.padding=t,this.renderThisFrame=!0}setLabelText(t){this.labelOptions.content=t,this.renderThisFrame=!0}drawText(){if(!this.labelOptions.content)return;if(this.group.getObjectByName("poi_text"))return;const t=this.dpr,{fontSize:e,padding:n,content:i}=this.labelOptions;Wb.ctx.font=e*t+"px sans-serif",Wb.ctx.fillStyle="black";const o=Wb.ctx.measureText(i),s=Math.ceil(o.width)+10+2*n,a=(e+5+2*n)*t;this.textWidth=s/t,this.textHeight=a/t,this.setRectDefSize(this.textWidth,this.textHeight),Wb.ctx.clearRect(0,0,s,a),Wb.ctx.fillText(i,n*t,(e+n)*t);const u=Wb.ctx.getImageData(0,0,s,a);this.textMaterial=new r.MeshBasicMaterial({transparent:!0,map:new r.DataTexture(Uint8Array.from(u.data),s,a,r.RGBAFormat),side:r.DoubleSide,opacity:this.labelOpacity}),this.text=new r.Mesh(new r.PlaneGeometry(this.textWidth,this.textHeight),this.textMaterial),this.text.material.map.flipY=!0,this.text.material.map.flipX=!0,this.text.material.map.needsUpdate=!0,this.text.material.map.magFilter=r.LinearFilter,this.text.material.visible=!0,this.text.name="poi_text",this.text.renderOrder=4;const{offsetX:c,offsetY:l}=this.recalcOffset(this.textWidth,this.textHeight,this.textPosInfo.anchor,this.textPosInfo.anchorOffsetX,this.textPosInfo.anchorOffsetY);this.textPosInfo.offsetX=c,this.textPosInfo.offsetY=l,this.group.add(this.text)}recalcOffset(t,e,n,r,i){let o=0,s=0;switch(n){case"center":o=r,s=i;break;case"left":o=t/2+r,s=i;break;case"right":o=-t/2+r,s=i;break;case"top":o=r,s=-e/2+i;break;case"bottom":o=r,s=e/2+i;break;case"topleft":o=t/2+r,s=-e/2+i;break;case"topright":o=-t/2+r,s=-e/2+i;break;case"bottomleft":o=t/2+r,s=e/2+i;break;case"bottomright":o=-t/2+r,s=e/2+i}return{offsetX:o,offsetY:s}}setLabelAnchor(t){this.textPosInfo.anchor=t,this.renderThisFrame=!0}setLabelOffset(t,e){this.textPosInfo.anchorOffsetX=t,this.textPosInfo.anchorOffsetY=e,this.renderThisFrame=!0}getLabelAnchor(){return this.textPosInfo.anchor}getLabelOffset(){const{anchorOffsetX:t,anchorOffsetY:e}=this.textPosInfo;return{x:t,y:e}}calcBoundingSize(){const t=this.screenPosition,e=this.textPosInfo.offsetX,n=this.textPosInfo.offsetY,r=this.iconPosInfo.offsetX,i=this.iconPosInfo.offsetY,o={xMin:this.text?t.x-this.textWidth/2+e:t.x,xMax:this.text?t.x+this.textWidth/2+e:t.x,yMin:this.text?t.y-this.textHeight/2-n:t.y,yMax:this.text?t.y+this.textHeight/2-n:t.y},s={xMin:this.icon?t.x-this.iconOptions.size[0]/2+r:t.x,xMax:this.icon?t.x+this.iconOptions.size[0]/2+r:t.x,yMin:this.icon?t.y-this.iconOptions.size[1]/2-i:t.y,yMax:this.icon?t.y+this.iconOptions.size[1]/2-i:t.y};let a=Math.max(s.xMax,o.xMax),u=Math.min(s.xMin,o.xMin),c=Math.max(s.yMax,o.yMax),l=Math.min(s.yMin,o.yMin);this.iconRect={xMin:this.icon?t.x-this.iconOptions.size[0]/2+r:t.x,xMax:this.icon?t.x+this.iconOptions.size[0]/2+r:t.x,yMin:this.icon?t.y-this.iconOptions.size[1]/2-i:t.y,yMax:this.icon?t.y+this.iconOptions.size[1]/2-i:t.y},this.textRect={xMin:this.text?t.x-this.textWidth/2+e:t.x,xMax:this.text?t.x+this.textWidth/2+e:t.x,yMin:this.text?t.y-this.textHeight/2-n:t.y,yMax:this.text?t.y+this.textHeight/2-n:t.y},this.outerRect={xMax:a,xMin:u,yMax:c,yMin:l},"icon"===this.collisionMode?(a=s.xMax,u=s.xMin,c=s.yMax,l=s.yMin):"label"===this.collisionMode&&(a=o.xMax,u=o.xMin,c=o.yMax,l=o.yMin),this.boundingRect.xMax=a,this.boundingRect.yMax=c,this.boundingRect.xMin=u,this.boundingRect.yMin=l}drawRect(){if(!this.withRect||!this.labelOptions.content)return;if(this.rect&&this.group.getObjectByName("poi_rect"))return;this.rect=new r.Group;const t=this.rectOptions.width||this.textWidth,e=this.rectOptions.height||this.textHeight,n=[0+t/2-10,0+e/2],i=[0+t/2,0+e/2-10],o=[0+t/2,0-e/2+10],s=[0+t/2-10,0-e/2],a=[0-t/2+10,0-e/2],u=[0-t/2,0-e/2+10],c=[0-t/2,0+e/2-10],l=[0-t/2+10,0+e/2],h=new r.Shape;h.moveTo(n[0],n[1]),h.bezierCurveTo(n[0],n[1],0+t/2,0+e/2,i[0],i[1]),h.moveTo(o[0],o[1]),h.bezierCurveTo(o[0],o[1],0+t/2,0-e/2,s[0],s[1]),h.moveTo(a[0],a[1]),h.bezierCurveTo(a[0],a[1],0-t/2,0-e/2,u[0],u[1]),h.moveTo(c[0],c[1]),h.bezierCurveTo(c[0],c[1],0-t/2,0+e/2,l[0],l[1]),h.moveTo(n[0],n[1]);const p=new r.ShapeGeometry(h),f=new r.MeshBasicMaterial({color:255,transparent:!0,opacity:.5});this.rectMaterial=f;const d=new r.Mesh(p,f);h.autoClose=!0;const g=h.getPoints(),m=(new r.BufferGeometry).setFromPoints(g),v=new r.Line(m,new r.LineBasicMaterial({color:16711680}));v.position.set(0,0,0),this.rect.add(d),this.rect.add(v),this.rect.renderOrder=2,this.rect.name="poi_rect",this.group.add(this.rect)}drawBoundingBox(){if(!this.withBoundingBox)return;if(this.group.getObjectByName("poi_bounding_rect"))return;if(0===this.outerRect.xMin&&0===this.outerRect.xMax)return;const{xMax:t,yMax:e,xMin:n,yMin:i}=this.outerRect;this.boundingBox=new r.Group;const o=t-n,s=e-i,a=[0+o/2-10,0+s/2],u=[0+o/2,0+s/2-10],c=[0+o/2,0-s/2+10],l=[0+o/2-10,0-s/2],h=[0-o/2+10,0-s/2],p=[0-o/2,0-s/2+10],f=[0-o/2,0+s/2-10],d=[0-o/2+10,0+s/2],g=new r.Shape;g.moveTo(a[0],a[1]),g.bezierCurveTo(a[0],a[1],0+o/2,0+s/2,u[0],u[1]),g.moveTo(c[0],c[1]),g.bezierCurveTo(c[0],c[1],0+o/2,0-s/2,l[0],l[1]),g.moveTo(h[0],h[1]),g.bezierCurveTo(h[0],h[1],0-o/2,0-s/2,p[0],p[1]),g.moveTo(f[0],f[1]),g.bezierCurveTo(f[0],f[1],0-o/2,0+s/2,d[0],d[1]),g.moveTo(a[0],a[1]);const m=new r.ShapeGeometry(g),v=new r.MeshBasicMaterial({color:16711680,transparent:!0,opacity:.5}),y=new r.Mesh(m,v);g.autoClose=!0;const x=g.getPoints(),b=(new r.BufferGeometry).setFromPoints(x),_=new r.Line(b,new r.LineBasicMaterial({color:16711680,linewidth:2}));_.position.set(0,0,0),this.boundingBox.name="poi_bounding_rect",this.boundingBox.add(y),this.boundingBox.add(_),this.boundingBox.renderOrder=0,this.group.add(this.boundingBox)}setBoundingBox(){this.withBoundingBox=!0}getBoundingRect(){const{x:t,y:e}=this.overlapArea,{xMin:n,yMin:r,xMax:i,yMax:o}=this.boundingRect;return{xMin:n+t,yMin:r+e,xMax:i-t,yMax:o-e}}getOuterRect(){const{x:t,y:e}=this.overlapArea,{xMin:n,yMin:r,xMax:i,yMax:o}=this.outerRect;return{xMin:n+t,yMin:r+e,xMax:i-t,yMax:o-e}}setAnimationEnabled(t){this.animationEnabled=t}calcPoiRotation(t){return this.autoRotation?t+this.rotation:this.rotation}getVisibility(){return this.visible}calcPosAndSize(t,e,n){if(!this.parent)return{isInFrustum:this.isInFrustum};let r=this.visible&&t.containsPoint(this.position);if(r){const t=this.position.clone().project(this.parent.camera);this.screenPosition={x:(t.x+1)*e,y:(1-t.y)*n},this.calcBoundingSize(),(this.outerRect.xMin<0||this.outerRect.xMax>2*e||this.outerRect.yMin<0||this.outerRect.yMax>2*n)&&(r=!1)}return this.isInFrustum=r,{isInFrustum:this.isInFrustum}}draw(){this.drawText(),this.drawIcon(),this.drawRect(),this.drawBoundingBox()}updatePosition(t,e){if(!this.group)return;if(!this.isInFrustum)return this.hide=!0,this.subHide=!1,void(this.group.visible=!1);if(this.group.visible=this.visible,!this.visible)return;const n=this.textPosInfo.offsetX,i=this.textPosInfo.offsetY,o=this.iconPosInfo.offsetX,s=this.iconPosInfo.offsetY,a=(new pr).copy(this.position);if(a.z+=this.iconSize[1]/2,this.group.position.copy(a),this.group.rotation.copy(t),this.group.scale.copy(new pr(1/e,1/e,1)),e<1?a.z+=this.iconSize[1]*(1-e)/2:a.z-=this.iconSize[1]*(1-1/e)/2,this.group.position.copy(a),this.text&&this.text.position.set(n,i,0),this.rect&&this.rect.position.set(n,i,0),this.icon&&this.icon.position.set(o,s,0),this.boundingBox){const t=(this.outerRect.xMax+this.outerRect.xMin)/2,e=(this.outerRect.yMax+this.outerRect.yMin)/2;this.boundingBox.position.set(t-this.screenPosition.x,this.screenPosition.y-e,0)}const u=this.visibilityAnimation.anim,c=!!u||!u&&(!this.hide||this.subHide);if(this.group.visible=c,c&&(!u||!this.animationEnabled)){let t=[],e=[];switch(this.visiblePartWhenCollision){case"all":t=[this.group],e=[];break;case"none":t=[],e=[this.group];break;case"label":t=[],this.text&&t.push(this.text),this.rect&&t.push(this.rect),this.icon&&e.push(this.icon);break;case"icon":this.icon&&t.push(this.icon),this.text&&e.push(this.text),this.rect&&e.push(this.rect);break;default:t=[],e=[this.group]}this.subHide?(t.forEach(t=>{t.visible=!0,t instanceof r.Group&&t.children.forEach(t=>{t.visible=!0})}),e.forEach(t=>{t.visible=!1,t instanceof r.Group&&t.children.forEach(t=>{t.visible=!1})})):this.hide||(t.forEach(t=>{t.visible=!0,t instanceof r.Group&&t.children.forEach(t=>{t.visible=!0})}),e.forEach(t=>{t.visible=!0,t instanceof r.Group&&t.children.forEach(t=>{t.visible=!0})})),this.icon&&!this.iconVisibility&&(this.icon.visible=!1),this.text&&!this.textVisibility&&(this.text.visible=!1)}c&&(this.subHide?this.parent&&("icon"===this.visiblePartWhenCollision?this.parent.setRectMap(this.iconRect,this):this.parent.setRectMap(this.textRect,this)):this.parent&&(this.parent.setRectMap(this.textRect,this),this.parent.setRectMap(this.iconRect,this)))}update(){const t=this.renderThisFrame||this.isInFrustum&&!!this.iconOptions.src&&!this.icon;return this.renderThisFrame=!1,t}setPoiId(t){this.poiId=t}}qb.ImageMaterialMap=new Map,qb.ImageMaterialMap=new Map;class Xb extends Gd{constructor(){super(),Wd.GetSharedInstance().registerController(this)}unbind(){this.dispose()}dispose(){this.eventMap.clear(),Wd.GetSharedInstance().unregisterController(this)}}var Yb,Jb=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};!function(t){t[t.IDLE=0]="IDLE",t[t.ROTATE=1]="ROTATE",t[t.ORBIT=2]="ORBIT",t[t.PAN=3]="PAN",t[t.DOLLY=4]="DOLLY",t[t.TOUCH_ROTATE=5]="TOUCH_ROTATE",t[t.TOUCH_ORBIT=6]="TOUCH_ORBIT",t[t.TOUCH_PAN=7]="TOUCH_PAN",t[t.TOUCH_DOLLY_ROTATE=8]="TOUCH_DOLLY_ROTATE",t[t.TOUCH_DOLLY_PAN=9]="TOUCH_DOLLY_PAN",t[t.TOUCH_MAP=10]="TOUCH_MAP"}(Yb||(Yb={}));class Kb extends Xb{constructor(t){super();const{THREE:e}=Nd.getInstance();this.eventListeners={onMouseDown:t=>{this.onMouseDown(t)},onMouseMove:t=>{this.onMouseMove(t)},onMouseUp:t=>{this.onMouseUp(t)},onMouseWheel:t=>{this.onMouseWheel(t)},onTouchStart:t=>{this.onTouchStart(t)},onTouchMove:t=>{this.onTouchMove(t)},onTouchEnd:t=>{this.onTouchEnd(t)},onContextMenu:t=>{this.onContextMenu(t)}},this.state=Yb.IDLE,this.enabled=!0,this.target=new e.Vector3,this.lastTick=Date.now(),this.enableDamping=!1,this.dampingFactor=0,this.mouseButtons={LEFT:e.MOUSE.ROTATE,MIDDLE:e.MOUSE.DOLLY,RIGHT:e.MOUSE.PAN},this.touches={ONE:e.TOUCH.ROTATE,TWO:e.TOUCH.DOLLY_PAN},this.boundaryEnabled=!1,this.boundary=new e.Box3(new e.Vector3(-1/0,-1/0,-1/0),new e.Vector3(1/0,1/0,1/0)),this.touchCenter=new e.Vector2,this.inertiaFactor=1,this.enableRotate=!0,this.rotateMode="self",this.rotateSpeed=1,this.rotateStart=new e.Vector2,this.rotateEnd=new e.Vector2,this.rotateDelta=new e.Vector2,this.rotateLineStart=new e.Vector2,this.rotateLineEnd=new e.Vector2,this.rotateInertiaDirection=new e.Vector2,this.rotateInertiaEnabled=!0,this.rotateInertiaBase=0,this.rotateInertia=0,this.rotateInertiaType="normal",this.spherical=new e.Spherical,this.sphericalDelta=new e.Spherical,this.maxSpherical=new e.Spherical(1,1/0,1/0),this.minSpherical=new e.Spherical(1,-1/0,-1/0),this.lastQuaternion=new e.Quaternion,this.enableZoom=!0,this.dollyStart=new e.Vector2,this.dollyEnd=new e.Vector2,this.zoomMode="zoom",this.zoomDelta=0,this.zoomRange={min:1,max:10},this.fovRange={min:60,max:90},this.zoomInertiaEnabled=!0,this.zoomInertiaBase=0,this.zoomInertia=0,this.zoomScale=1,this.enablePan=!0,this.panStart=new e.Vector2,this.panDelta=new e.Vector2,this.panEnd=new e.Vector2,this.panOffset=new e.Vector3,this.panSpeed=1,this.screenSpacePanning=!0,this.lastPosition=new e.Vector3,this.panInertiaDirection=new e.Vector2,this.panInertiaEnabled=!0,this.panInertiaBase=0,this.panInertia=0,this.mouseXY=new e.Vector2,this.bindView(t)}registerEvents(){this.bindingView&&(this.bindingView.on(zd.MOUSE_DOWN,this.eventListeners.onMouseDown),this.bindingView.on(zd.MOUSE_MOVE,this.eventListeners.onMouseMove),this.bindingView.on(zd.MOUSE_UP,this.eventListeners.onMouseUp),this.bindingView.on(zd.MOUSE_WHEEL,this.eventListeners.onMouseWheel),this.bindingView.on(zd.TOUCH_START,this.eventListeners.onTouchStart),this.bindingView.on(zd.TOUCH_MOVE,this.eventListeners.onTouchMove),this.bindingView.on(zd.TOUCH_END,this.eventListeners.onTouchEnd),this.bindingView.on(zd.CONTEXT_MENU,this.eventListeners.onContextMenu))}unregisterEvents(){this.bindingView&&(this.bindingView.off(zd.MOUSE_DOWN,this.eventListeners.onMouseDown),this.bindingView.off(zd.MOUSE_MOVE,this.eventListeners.onMouseMove),this.bindingView.off(zd.MOUSE_UP,this.eventListeners.onMouseUp),this.bindingView.off(zd.MOUSE_WHEEL,this.eventListeners.onMouseWheel),this.bindingView.off(zd.TOUCH_START,this.eventListeners.onTouchStart),this.bindingView.off(zd.TOUCH_MOVE,this.eventListeners.onTouchMove),this.bindingView.off(zd.TOUCH_END,this.eventListeners.onTouchEnd),this.bindingView.off(zd.CONTEXT_MENU,this.eventListeners.onContextMenu))}onMouseDown(t){let e;switch(t.preventDefault(),t.button){case 0:e=this.mouseButtons.LEFT;break;case 1:e=this.mouseButtons.MIDDLE;break;case 2:e=this.mouseButtons.RIGHT}switch(e){case r.MOUSE.ROTATE:this.enableRotate&&(this.state=Yb.ROTATE);break;case r.MOUSE.PAN:this.enablePan&&(this.state=Yb.PAN);break;case r.MOUSE.DOLLY:this.enableZoom&&(this.state=Yb.DOLLY);break;default:this.state=Yb.IDLE}switch(this.state){case Yb.ROTATE:this.handleMouseDownRotate(t);break;case Yb.PAN:this.handleMouseDownPan(t);break;case Yb.DOLLY:this.handleMouseDownDolly(t)}this.state!==Yb.IDLE&&(this.bindingView&&(this.bindingView.on(zd.MOUSE_MOVE,this.eventListeners.onMouseMove),this.bindingView.on(zd.MOUSE_UP,this.eventListeners.onMouseUp)),this.panInertiaBase=0,this.rotateInertiaBase=0,this.zoomInertiaBase=0)}onMouseMove(t){switch(t.preventDefault(),this.state){case Yb.ROTATE:this.handleMouseMoveSelfRotate(t);break;case Yb.PAN:this.handleMouseMovePan(t);break;case Yb.DOLLY:this.handleMouseMoveDolly(t)}}onMouseUp(t){switch(t.preventDefault(),this.bindingView&&(this.bindingView.off(zd.MOUSE_MOVE,this.eventListeners.onMouseMove),this.bindingView.off(zd.MOUSE_UP,this.eventListeners.onMouseUp)),this.state){case Yb.ROTATE:this.handleUpRotate();break;case Yb.PAN:this.handleUpPan()}this.state=Yb.IDLE}onMouseWheel(t){!this.enableZoom||this.state!==Yb.IDLE&&this.state!==Yb.ROTATE||(t.preventDefault(),t.stopPropagation(),this.handleMouseWheel(t))}onContextMenu(t){t.preventDefault()}onTouchStart(t){switch(jd.GetEnv()!==Fd.Miniapp&&t.preventDefault(),this.timeStart=t.timeStamp,t.touches.length){case 1:switch(this.touches.ONE){case r.TOUCH.PAN:this.enablePan&&(this.state=Yb.TOUCH_PAN);break;case r.TOUCH.ROTATE:this.enableRotate&&(this.state=Yb.TOUCH_ROTATE);break;default:this.state=Yb.IDLE}break;case 2:switch(this.touchCenter.set((t.touches[0].clientX+t.touches[1].clientX)/2,(t.touches[0].clientY+t.touches[1].clientY)/2),this.touches.TWO){case r.TOUCH.DOLLY_PAN:this.state=Yb.TOUCH_DOLLY_PAN;break;case r.TOUCH.DOLLY_ROTATE:this.state=Yb.TOUCH_DOLLY_ROTATE;break;case"map":this.state=Yb.TOUCH_MAP;break;default:this.state=Yb.IDLE}break;default:this.state=Yb.IDLE}switch(this.state){case Yb.TOUCH_PAN:this.handleTouchStartPan(t);break;case Yb.TOUCH_ROTATE:this.handleTouchStartRotate(t);break;case Yb.TOUCH_DOLLY_ROTATE:this.handleTouchStartDollyRotate(t);break;case Yb.TOUCH_DOLLY_PAN:this.handleTouchStartDollyPan(t);break;case Yb.TOUCH_MAP:this.handleTouchStartMap(t)}this.state!==Yb.IDLE&&(this.bindingView&&(this.bindingView.on(zd.MOUSE_MOVE,this.eventListeners.onMouseMove),this.bindingView.on(zd.MOUSE_UP,this.eventListeners.onMouseUp)),this.panInertiaBase=0,this.rotateInertiaBase=0,this.zoomInertiaBase=0)}onTouchMove(t){switch(jd.GetEnv()!==Fd.Miniapp&&t.preventDefault(),2===t.touches.length&&this.touchCenter.set((t.touches[0].clientX+t.touches[1].clientX)/2,(t.touches[0].clientY+t.touches[1].clientY)/2),this.state){case Yb.TOUCH_PAN:this.handleTouchMovePan(t);break;case Yb.TOUCH_ROTATE:this.handleTouchMoveSelfRotate(t);break;case Yb.TOUCH_DOLLY_ROTATE:this.handleTouchMoveDollyRotate(t);break;case Yb.TOUCH_DOLLY_PAN:this.handleTouchMoveDollyPan(t);break;case Yb.TOUCH_MAP:this.handleTouchMoveAll(t)}this.timeEnd=this.timeStart,this.timeStart=t.timeStamp}onTouchEnd(t){switch(jd.GetEnv()!==Fd.Miniapp&&t.preventDefault(),this.state){case Yb.TOUCH_ROTATE:case Yb.TOUCH_DOLLY_ROTATE:this.handleUpRotate();break;case Yb.TOUCH_PAN:case Yb.TOUCH_DOLLY_PAN:this.handleUpPan();break;case Yb.TOUCH_MAP:this.handleUpAll()}this.state=Yb.IDLE}handleMouseDownRotate(t){this.handleDownRotate(t.offsetX,t.offsetY)}handleMouseMoveSelfRotate(t){this.handleMoveRotate(t.offsetX,t.offsetY)}handleTouchStartRotate(t){if(1===t.touches.length)this.handleDownRotate(t.touches[0].clientX,t.touches[0].clientY);else if(this.state===Yb.TOUCH_MAP){const e=(t.touches[1].clientY-t.touches[0].clientY)/(t.touches[1].clientX-t.touches[0].clientX),n=t.touches[0].clientY-e*t.touches[0].clientX;this.rotateLineStart.set(e,n)}else{const e=.5*(t.touches[0].clientX+t.touches[1].clientX),n=.5*(t.touches[0].clientY+t.touches[1].clientY);this.handleDownRotate(e,n)}}handleTouchMoveSelfRotate(t){if(this.bindingView)if(1===t.touches.length)this.handleMoveRotate(t.touches[0].clientX,t.touches[0].clientY);else if(this.state===Yb.TOUCH_MAP){const e=(t.touches[1].clientY-t.touches[0].clientY)/(t.touches[1].clientX-t.touches[0].clientX),n=t.touches[0].clientY-e*t.touches[0].clientX;if(this.rotateLineEnd.set(e,n),Number.isFinite(this.rotateLineEnd.x)&&Number.isFinite(this.rotateLineStart.x)){const t=(this.rotateLineStart.y-this.rotateLineEnd.y)/(this.rotateLineEnd.x-this.rotateLineStart.x),r=e*t+n;if(Number.isFinite(t)&&Number.isFinite(r)){let e=Math.atan(this.rotateLineEnd.x)-Math.atan(this.rotateLineStart.x);if(Math.PI-Math.abs(e)<.5&&(e=-Math.sign(e)*(Math.PI-Math.abs(e))),Math.abs(e)>.01){const n=this.rotateLineStart.clone().set(this.bindingView.getViewWidth()/2,this.bindingView.getViewHeight()/2),i=this.rotateLineStart.clone().set(t,r),o=n.clone().rotateAround(i,e).sub(n);this.handlePanDelta(o.x,o.y),this.rotateDelta.set(e,0),this.handleRotateSphericalDelta(this.rotateDelta.x,this.rotateDelta.y)}}}this.rotateLineStart.copy(this.rotateLineEnd)}else{const e=.5*(t.touches[0].clientX+t.touches[1].clientX),n=.5*(t.touches[0].clientY+t.touches[1].clientY);this.handleMoveRotate(e,n)}}handleDownRotate(t,e){this.rotateStart.set(t,e)}handleMoveRotate(t,e){this.rotateEnd.set(t,e),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed),this.handleRotateDelta(this.rotateDelta.x,this.rotateDelta.y),this.rotateStart.copy(this.rotateEnd)}handleRotateDelta(t,e){if(!this.bindingView)return;const n=this.bindingView.getViewHeight(),r="self"===this.rotateMode?-1:1;let i=1;if(this.camera.isPerspectiveCamera){const t=this.camera;i*=t.fov/t.zoom/360}this.handleRotateSphericalDelta(2*-r*Math.PI*t/n*i,-2*Math.PI*e/n*i)}handleRotateSphericalDelta(t,e){this.sphericalDelta.theta+=t,this.sphericalDelta.phi+=e}handleUpRotate(){if(!this.rotateInertiaEnabled||!this.bindingView)return;const t=this.timeStart-this.timeEnd;if(this.state===Yb.TOUCH_MAP){this.rotateInertiaType="map";const e=this.rotateDelta.x/t;Number.isFinite(e)&&e>.001&&(this.rotateInertiaBase=this.rotateDelta.x/10,this.rotateInertiaDuration=0,this.rotateInertia=this.rotateInertiaBase)}else{this.rotateInertiaType="normal";const e=this.rotateDelta.length()*this.rotateSpeed/t,n=1e3*e/this.bindingView.getViewWidth()*.6;if(0===t||!Number.isFinite(e))return;Number.isFinite(e)&&e>.3&&(this.rotateInertiaBase=e*n*this.inertiaFactor,this.rotateInertiaDuration=0,this.rotateInertiaDirection=this.rotateDelta.clone().normalize(),this.rotateInertia=this.rotateInertiaBase)}}handleMouseDownPan(t){this.handleDownPan(t.offsetX,t.offsetY)}handleMouseMovePan(t){this.handleMovePan(t.offsetX,t.offsetY)}handleTouchStartPan(t){if(1===t.touches.length)this.handleDownPan(t.touches[0].clientX,t.touches[0].clientY);else{const e=.5*(t.touches[0].clientX+t.touches[1].clientX),n=.5*(t.touches[0].clientY+t.touches[1].clientY);this.handleDownPan(e,n)}}handleTouchMovePan(t){if(1===t.touches.length)this.handleMovePan(t.touches[0].clientX,t.touches[0].clientY);else{const e=.5*(t.touches[0].clientX+t.touches[1].clientX),n=.5*(t.touches[0].clientY+t.touches[1].clientY);this.handleMovePan(e,n)}}handleDownPan(t,e){this.panStart.set(t,e)}handleMovePan(t,e){this.panEnd.set(t,e),this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(this.panSpeed),this.handlePanDelta(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}handlePanDelta(t,e){if(!this.bindingView)return;const{THREE:n}=Nd.getInstance(),r=new n.Vector3,i=this.bindingView.getViewWidth(),o=this.bindingView.getViewHeight();let s=0,a=0;if(this.camera.isPerspectiveCamera){const n=this.camera;r.subVectors(this.target,this.camera.position);let i=r.length();i*=Math.tan(n.fov/2*Math.PI/180),s=2*t*i/o,a=2*e*i/o}else{const n=this.camera;s=t*(n.right-n.left)/n.zoom/i,a=e*(n.top-n.bottom)/n.zoom/o}r.setFromMatrixColumn(this.camera.matrix,0),r.multiplyScalar(-s),this.panOffset.add(r),this.screenSpacePanning?r.setFromMatrixColumn(this.camera.matrix,1):(r.setFromMatrixColumn(this.camera.matrix,0),r.crossVectors(this.camera.up,r)),r.multiplyScalar(a),this.panOffset.add(r)}handleUpPan(){if(!this.panInertiaEnabled)return;const t=this.timeStart-this.timeEnd,e=10*this.panDelta.length()*this.panSpeed/t;0!==t&&Number.isFinite(e)&&Number.isFinite(e)&&e>1&&(this.panInertiaBase=e*this.inertiaFactor,this.panInertiaDuration=0,this.panInertiaDirection=this.panDelta.clone().normalize(),this.panInertia=this.panInertiaBase)}handleMouseWheel(t){this.zoomDelta=t.deltaY/67,this.mouseXY.set(t.offsetX,t.offsetY)}handleZoom(t){if(Math.abs(t)<1e-4)return;let e=0,n=null;if(this.followMouse&&(n=ky.getHorizontalPlaneCoordinate3({x:this.mouseXY.x,y:this.mouseXY.y},this.bindingView,this.camera)),t*=this.zoomScale,"zoom"===this.zoomMode){const n=Math.min(Math.max(this.camera.zoom*(1+t),this.zoomRange.min),this.zoomRange.max);e=n-this.camera.zoom,this.camera.zoom=n}else if(this.camera.isPerspectiveCamera){const e=this.camera;e.fov=Math.min(Math.max(e.fov+66.67*t,this.fovRange.min),this.fovRange.max)}if(this.camera.updateProjectionMatrix(),this.needUpdate=!0,this.emit(Ud.CAMERA_ZOOM,this.zoomMode,"zoom"===this.zoomMode?this.camera.zoom:this.camera.fov,this),this.followMouse&&e&&this.bindingView){const t=ky.getHorizontalPlaneCoordinate3({x:this.mouseXY.x,y:this.mouseXY.y},this.bindingView,this.camera);if(n&&t){const e=t.clone().sub(n);this.setCameraPosition(this.camera.position.clone().sub(e),!0)}}}handleUpZoom(){if(!this.zoomInertiaEnabled)return;const t=this.timeStart-this.timeEnd,e=this.zoomDelta/t;0!==t&&Number.isFinite(e)&&Math.abs(e)>.001&&(this.zoomInertiaBase=e*this.inertiaFactor*2,this.zoomInertiaDuration=0,this.zoomInertia=this.zoomInertiaBase)}handleMouseDownDolly(t){this.dollyStart.set(t.offsetX,t.offsetY)}handleMouseMoveDolly(t){this.dollyEnd.set(t.offsetX,t.offsetY);const e=-Math.sign(this.dollyEnd.y-this.dollyStart.y),n=this.dollyStart.distanceTo(this.dollyEnd),r=this.bindingView.getViewWidth(),i=this.bindingView.getViewHeight(),o=Math.sqrt(Math.pow(r,2)+Math.pow(i,2)),s=n/o;this.zoomDelta=e*Math.floor(s*o)*jd.GetGlobalDPR(),this.dollyStart.copy(this.dollyEnd)}handleTouchStartDolly(t){const e=t.touches[0].clientX-t.touches[1].clientX,n=t.touches[0].clientY-t.touches[1].clientY,r=Math.sqrt(e*e+n*n);this.dollyStart.set(0,r)}handleTouchMoveDolly(t){if(!this.bindingView)return;const e=t.touches[0].clientX-t.touches[1].clientX,n=t.touches[0].clientY-t.touches[1].clientY,r=Math.sqrt(e*e+n*n);this.dollyEnd.set(0,r);const i=this.bindingView.canvas.clientWidth,o=this.bindingView.canvas.clientHeight,s=Math.sqrt(Math.pow(i,2)+Math.pow(o,2)),a=(r-this.dollyStart.y)/s;this.zoomDelta=-a;let u=1+Math.abs(this.zoomDelta);this.zoomDelta>0&&(u=1/u),this.zoomDelta=u-1,this.zoomDelta*=2;const c=this.touchCenter.clone().set(this.bindingView.getViewWidth()/2,this.bindingView.getViewHeight()/2),l=this.touchCenter.clone().sub(c).multiplyScalar(-this.zoomDelta);this.mouseXY.set(this.touchCenter.x,this.touchCenter.y),this.zoomDelta*=jd.GetGlobalDPR(),this.handlePanDelta(l.x,l.y),this.dollyStart.copy(this.dollyEnd)}handleTouchStartDollyRotate(t){this.enableZoom&&this.handleTouchStartDolly(t),this.enableRotate&&this.handleTouchStartRotate(t)}handleTouchMoveDollyRotate(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enableRotate&&this.handleTouchMoveSelfRotate(t)}handleTouchStartDollyPan(t){this.enableZoom&&this.handleTouchStartDolly(t),this.enablePan&&this.handleTouchStartPan(t)}handleTouchMoveDollyPan(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enablePan&&this.handleTouchMovePan(t)}handleTouchStartMap(t){this.enableZoom&&this.handleTouchStartDolly(t),this.enablePan&&this.handleTouchStartPan(t),this.enableRotate&&this.handleTouchStartRotate(t)}handleTouchMoveAll(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enablePan&&this.handleTouchMovePan(t),this.enableRotate&&this.handleTouchMoveSelfRotate(t)}handleUpAll(){this.handleUpZoom(),this.handleUpPan(),this.handleUpRotate()}resetVectors(){this.panInertiaBase=0,this.panInertia=0,this.panDelta.set(0,0),this.rotateInertiaBase=0,this.rotateInertia=0,this.rotateDelta.set(0,0)}moveCameraTo(t,e=1e3,n){return Jb(this,void 0,void 0,(function*(){return new Promise(r=>{const{THREE:i}=Nd.getInstance(),o=this.camera.position.clone(),s=new i.Vector3,a=n||{};new v.a.Tween({progress:0}).to({progress:1},e).easing(v.a.Easing.Quadratic.InOut).onUpdate(({progress:e})=>{s.lerpVectors(o,t,e),this.camera.position.copy(s),a.onUpdate&&a.onUpdate(e),this.needUpdate=!0}).onComplete(()=>{r()}).start()})}))}setCameraPosition(t,e=!0){const{THREE:n}=Nd.getInstance(),r=(new n.Vector3).subVectors(this.target,this.camera.position);this.camera.position.copy(t),e&&this.target.copy(t.clone().add(r)),this.needUpdate=!0}getCameraPosition(){return this.camera.position.clone()}setCameraLookAt(t,e=!1){const{THREE:n}=Nd.getInstance(),r=(new n.Vector3).subVectors(this.camera.position,this.target);this.target.copy(t),e&&this.camera.position.copy(t.clone().add(r)),this.camera.lookAt(t),this.needUpdate=!0}getCameraTarget(){return this.target.clone()}setCameraLookAtVector(t,e=1){this.setCameraLookAt(this.camera.position.clone().add(t.normalize().multiplyScalar(e)))}setDampingEnabled(t){this.enableDamping=t}setDampingFactor(t){this.dampingFactor=t}getDampingFactor(){return this.dampingFactor}setZoomEnabled(t){this.enableZoom=t}setZoomMode(t){if(this.camera.isOrthographicCamera&&"fov"===t)throw new Error("[BasicController] Cannot use fov zoom mode for OrthographicCamera");this.zoomMode=t}setFovRange(t,e){if(this.fovRange.min=t,this.fovRange.max=e,!this.camera.isPerspectiveCamera)return;const n=this.camera;n.fov=Math.min(Math.max(n.fov,this.fovRange.min),this.fovRange.max),n.updateProjectionMatrix(),this.needUpdate=!0}setFov(t){if(!this.camera.isPerspectiveCamera)return;const e=this.camera;e.fov=Math.min(Math.max(t,this.fovRange.min),this.fovRange.max),e.updateProjectionMatrix(),this.needUpdate=!0}getFov(){return this.camera.isPerspectiveCamera?this.camera.fov:null}setZoomRange(t,e){this.zoomRange.min=t,this.zoomRange.max=e,this.camera.zoom=Math.min(Math.max(this.camera.zoom,this.zoomRange.min),this.zoomRange.max),this.camera.updateProjectionMatrix(),this.needUpdate=!0}setZoom(t){this.camera.zoom=Math.min(Math.max(t,this.zoomRange.min),this.zoomRange.max),this.camera.updateProjectionMatrix(),this.needUpdate=!0}getZoom(){return this.camera.zoom}setZoomInertiaEnabled(t){this.zoomInertiaEnabled=t}setRotateEnabled(t){this.enableRotate=t}setRotateMode(t){this.rotateMode=t}setRotateSpeed(t){this.rotateSpeed=t}getRotateSpeed(){return this.rotateSpeed}setRotateInertiaEnabled(t){this.rotateInertiaEnabled=t}setAzimuthAngle(t){const{THREE:e}=Nd.getInstance(),n=(new e.Quaternion).setFromUnitVectors(this.camera.up,new e.Vector3(0,1,0)),r=n.clone().invert(),i=(new e.Vector3).subVectors(this.target,this.camera.position);"orbit"===this.rotateMode&&i.multiplyScalar(-1),i.applyQuaternion(n),this.spherical.setFromVector3(i),this.spherical.theta=t,this.spherical.makeSafe(),i.setFromSpherical(this.spherical),i.applyQuaternion(r),"self"===this.rotateMode?this.target.copy(this.camera.position.clone().add(i)):this.camera.position.copy(this.target.clone().add(i)),this.camera.lookAt(this.target),this.needUpdate=!0}getAzimuthAngle(){return this.spherical.theta}setPolarAngle(t){const{THREE:e}=Nd.getInstance(),n=(new e.Quaternion).setFromUnitVectors(this.camera.up,new e.Vector3(0,1,0)),r=n.clone().invert(),i=(new e.Vector3).subVectors(this.target,this.camera.position);"orbit"===this.rotateMode&&i.multiplyScalar(-1),i.applyQuaternion(n),this.spherical.setFromVector3(i),this.spherical.phi=t,this.spherical.makeSafe(),i.setFromSpherical(this.spherical),i.applyQuaternion(r),"self"===this.rotateMode?this.target.copy(this.camera.position.clone().add(i)):this.camera.position.copy(this.target.clone().add(i)),this.camera.lookAt(this.target),this.needUpdate=!0}getPolarAngle(){return this.spherical.phi}setAzimuthRange(t,e){this.minSpherical.theta=t,this.maxSpherical.theta=e}setPolarRange(t,e){this.minSpherical.phi=t,this.maxSpherical.phi=e}setPanInertiaEnabled(t){this.panInertiaEnabled=t}setInertiaFactor(t){this.inertiaFactor=t}setPanEnabled(t){this.enablePan=t}setScreenSpacePanning(t){this.screenSpacePanning=t}setMouseButtons(t){this.mouseButtons=t}setTouches(t){this.touches=t}setBoundaryEnabled(t){this.boundaryEnabled=t}setBoundary(t,e){this.boundary.set(t,e)}setEnabled(t){t!==this.enabled&&(this.enabled=t,t?this.registerEvents():(this.unregisterEvents(),this.resetVectors()))}getEnabled(){return this.enabled}bindView(t){if(this.unbindView(),!t.container&&!t.canvas)throw new Error("View needed initialized with an HTML container or Canvas");if(!t.camera)throw new Error("[BasicController] View for basic controller should have a camera.");if(!t.camera.isPerspectiveCamera&&!t.camera.isOrthographicCamera)throw new Error("[BasicController] Only supports PerspectiveCamera or OrthographicCamera.");const{THREE:e}=Nd.getInstance();this.camera=t.camera,this.bindingView=t,this.target=new e.Vector3(0,0,-1).applyQuaternion(this.camera.quaternion),this.registerEvents()}update(){const t=Date.now(),e=t-this.lastTick;this.lastTick=t;const{THREE:n}=Nd.getInstance(),r=(new n.Quaternion).setFromUnitVectors(this.camera.up,new n.Vector3(0,1,0)),i=r.clone().invert(),o=(new n.Vector3).subVectors(this.target,this.camera.position);if("orbit"===this.rotateMode&&o.multiplyScalar(-1),Math.abs(this.zoomInertiaBase)>0&&this.zoomInertiaDuration<600){this.handleZoom(this.zoomInertia);const t=this.zoomInertiaDuration/600;this.zoomInertia=this.zoomInertiaBase*Math.pow(1-t,2),this.zoomInertia=Math.max(0,Math.abs(this.zoomInertia))*Math.sign(this.zoomInertia),this.zoomInertiaDuration+=e}if(this.panInertiaBase>0&&this.panInertiaDuration<600){const{x:t,y:n}=this.panInertiaDirection;this.handlePanDelta(t*this.panInertia,n*this.panInertia);const r=this.panInertiaDuration/600;this.panInertia=this.panInertiaBase*Math.pow(1-r,2),this.panInertia=Math.max(0,this.panInertia),this.panInertiaDuration+=e}if(this.rotateInertiaBase>0&&this.rotateInertiaDuration<600){if("normal"===this.rotateInertiaType){const{x:t,y:e}=this.rotateInertiaDirection;this.handleRotateDelta(t*this.rotateInertia,e*this.rotateInertia)}else this.handleRotateSphericalDelta(this.rotateInertia,0);const t=this.rotateInertiaDuration/600;this.rotateInertia=this.rotateInertiaBase*Math.pow(1-t,2),this.rotateInertia=Math.max(0,this.rotateInertia),this.rotateInertiaDuration+=e}o.applyQuaternion(r),this.spherical.setFromVector3(o);const s=this.sphericalDelta.clone();let{zoomDelta:a}=this;this.enableDamping&&(s.theta*=this.dampingFactor,s.phi*=this.dampingFactor,a*=this.dampingFactor),this.spherical.theta+=s.theta,this.spherical.phi+=s.phi;let{theta:u}=this.minSpherical,{theta:c}=this.maxSpherical;const l=2*Math.PI;return Number.isFinite(u)&&Number.isFinite(c)&&(u<-Math.PI?u+=l:u>Math.PI&&(u-=l),c<-Math.PI?c+=l:c>Math.PI&&(c-=l),this.spherical.theta=u<c?Math.max(u,Math.min(c,this.spherical.theta)):this.spherical.theta>(u+c)/2?Math.max(u,this.spherical.theta):Math.min(c,this.spherical.theta)),this.spherical.phi=Math.max(this.minSpherical.phi,Math.min(this.maxSpherical.phi,this.spherical.phi)),this.spherical.makeSafe(),o.setFromSpherical(this.spherical),o.applyQuaternion(i),this.handleZoom(a),this.enableDamping?"self"===this.rotateMode?this.camera.position.addScaledVector(this.panOffset,this.dampingFactor):this.target.addScaledVector(this.panOffset,this.dampingFactor):"self"===this.rotateMode?this.camera.position.add(this.panOffset):this.target.add(this.panOffset),this.boundaryEnabled&&("self"===this.rotateMode?(this.camera.position.x=Math.min(this.boundary.max.x,Math.max(this.boundary.min.x,this.camera.position.x)),this.camera.position.y=Math.min(this.boundary.max.y,Math.max(this.boundary.min.y,this.camera.position.y)),this.camera.position.z=Math.min(this.boundary.max.z,Math.max(this.boundary.min.z,this.camera.position.z))):(this.target.x=Math.min(this.boundary.max.x,Math.max(this.boundary.min.x,this.target.x)),this.target.y=Math.min(this.boundary.max.y,Math.max(this.boundary.min.y,this.target.y)),this.target.z=Math.min(this.boundary.max.z,Math.max(this.boundary.min.z,this.target.z)))),"self"===this.rotateMode?this.target.copy(this.camera.position.clone().add(o)):this.camera.position.copy(this.target.clone().add(o)),this.camera.lookAt(this.target),this.enableDamping?(this.sphericalDelta.theta*=1-this.dampingFactor,this.sphericalDelta.phi*=1-this.dampingFactor,this.panOffset.multiplyScalar(1-this.dampingFactor),this.zoomDelta*=1-this.dampingFactor):(this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0),this.zoomDelta=0),!!(this.needUpdate||this.lastPosition.distanceToSquared(this.camera.position)>1e-6||8*(1-this.lastQuaternion.dot(this.camera.quaternion))>1e-6)&&(this.lastPosition.copy(this.camera.position),this.lastQuaternion.copy(this.camera.quaternion),this.needUpdate=!1,this.emit(Ud.CAMERA_CHANGED,this.camera.position.clone(),this.camera.quaternion.clone(),this),!0)}unbind(){this.dispose(),this.unbindView()}unbindView(){this.unregisterEvents(),this.bindingView=null}}r.InstancedBufferGeometry;r.ShaderMaterial;r.Mesh;var Qb=n("vDqi"),Zb=n.n(Qb);function $b(t){return($b="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})(t)}function t_(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t_=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof m?e:m,s=Object.create(o.prototype),a=new P(r||[]);return i(s,"_invoke",{value:S(t,n,a)}),s}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",f="executing",d="completed",g={};function m(){}function v(){}function y(){}var x={};c(x,s,(function(){return this}));var b=Object.getPrototypeOf,_=b&&b(b(I([])));_&&_!==n&&r.call(_,s)&&(x=_);var w=y.prototype=m.prototype=Object.create(x);function M(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,o,s,a){var u=h(t[i],t,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==$b(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(l).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(u.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function S(e,n,r){var i=p;return function(o,s){if(i===f)throw Error("Generator is already running");if(i===d){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var u=A(a,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===p)throw i=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=f;var c=h(e,n,r);if("normal"===c.type){if(i=r.done?d:"suspendedYield",c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=d,r.method="throw",r.arg=c.arg)}}}function A(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,A(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=h(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function I(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError($b(e)+" is not iterable")}return v.prototype=y,i(w,"constructor",{value:y,configurable:!0}),i(y,"constructor",{value:v,configurable:!0}),v.displayName=c(y,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,c(t,u,"GeneratorFunction")),t.prototype=Object.create(w),t},e.awrap=function(t){return{__await:t}},M(E.prototype),c(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new E(l(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},M(w),c(w,u,"Generator"),c(w,s,(function(){return this})),c(w,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=I,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var u=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;T(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:I(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function e_(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function n_(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){e_(o,r,i,s,a,"next",t)}function a(t){e_(o,r,i,s,a,"throw",t)}s(void 0)}))}}function r_(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,i_(r.key),r)}}function i_(t){var e=function(t,e){if("object"!=$b(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=$b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==$b(e)?e:e+""}var o_=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},e=null,n=[{key:"axiosGet",value:(o=n_(t_().mark((function t(e,n){return t_().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){Zb.a.get(e,n).then((function(e){t(e.data)})).catch((function(e){t(null)}))})));case 1:case"end":return t.stop()}}),t)}))),function(t,e){return o.apply(this,arguments)})},{key:"axiosPost",value:(i=n_(t_().mark((function t(e,n,r){return t_().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){Zb.a.post(e,n,r).then((function(e){t(e.data)})).catch((function(e){t(null)}))})));case 1:case"end":return t.stop()}}),t)}))),function(t,e,n){return i.apply(this,arguments)})},{key:"xhrGet",value:(r=n_(t_().mark((function t(e,n){return t_().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){var r=new XMLHttpRequest;r.onreadyStateChange=function(){if(4===r.readystate)try{304===r.status||r.status>=200&&r.status<300?console.log("type: success, result: ",r.responseText):(console.log("type: error, errCode:",r.status),t(null))}catch(e){console.log("增加异常捕获"),t(null)}},r.open("GET",e,!0),r.ontimeout=function(){console.log("超时处理"),t(null)},r.onload=n_(t_().mark((function e(){var i;return t_().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=r.response,n&&(i=JSON.parse(i)),t(i);case 3:case"end":return e.stop()}}),e)}))),r.onerror=function(){t(null)},r.send()})));case 1:case"end":return t.stop()}}),t)}))),function(t,e){return r.apply(this,arguments)})},{key:"xhrPost",value:function(t,e,n){var r=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1e3;return new Promise((function(s){if(!i)return s(null);var a=function(){setTimeout((function(){return s(r.xhrPost(t,e,n,--i,o+=1e3))}),o)},u=new XMLHttpRequest;u.onreadyStateChange=function(){if(4===u.readystate)try{304===u.status||u.status>=200&&u.status<300?console.log("type: success, result: ",u.responseText):(console.log("type: error, errCode:",u.status),s(null))}catch(t){console.log("增加异常捕获"),s(null)}else a()},u.open("POST",t,!0),u.setRequestHeader("content-type","application/x-www-form-urlencoded"),u.timeout=42e3,u.ontimeout=function(){console.log("超时处理"),a()},u.onload=n_(t_().mark((function t(){var e;return t_().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=u.responseText,n&&(e=JSON.parse(e)),s(e);case 3:case"end":return t.stop()}}),t)}))),u.onerror=function(){a()},u.send(JSON.stringify(e))}))}}],e&&r_(t.prototype,e),n&&r_(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r,i,o}();function s_(t){return(s_="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})(t)}function a_(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,u_(r.key),r)}}function u_(t){var e=function(t,e){if("object"!=s_(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=s_(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==s_(e)?e:e+""}var c_=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return e=t,r=[{key:"getAngle",value:function(e,n,r){var i=e.clone().sub(n).normalize(),o=n.clone().sub(r).normalize();return t.getAngleByVector(i,o)}},{key:"getAngleByVector",value:function(t,e){return Math.acos(e.dot(t))/Math.PI*180}},{key:"getAngleByVector2",value:function(t,e){if(t.equals(e))return 0;if(t.equals(e.clone().multiplyScalar(-1)))return 180;var n=Math.acos(e.dot(t))/Math.PI*180;return t.clone().cross(e).z>0?n:n+180}}],(n=null)&&a_(e.prototype,n),r&&a_(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();class l_ extends eg{constructor(t,e,n){super(),this.offLineTextureLevel=-1,this.face=t,this.flipX=e||!1,this.flipY=n||!1,this.textureMap=new Map,this.needsUpdate=!1;const i=this.uniforms={mTexture0:{type:"t",value:null},mTexture1:{type:"t",value:null},mTexture2:{type:"t",value:null},mTexture3:{type:"t",value:null},mTexture4:{type:"t",value:null},mTexture5:{type:"t",value:null},mTexture6:{type:"t",value:null},mTexture7:{type:"t",value:null},mTexture8:{type:"t",value:null},mTexture9:{type:"t",value:null},mTexture10:{type:"t",value:null},mTexture11:{type:"t",value:null},mTexture12:{type:"t",value:null},mTexture13:{type:"t",value:null},mTexture14:{type:"t",value:null},mTexture15:{type:"t",value:null},uvMax:{type:"i",value:0},flipX:{type:"b",value:!1},flipY:{type:"b",value:!1},black:{type:"b",value:!1}},{THREE:o}=Nd.getInstance(),s=new o.ShaderMaterial({fragmentShader:"\n uniform sampler2D mTexture0;\n uniform sampler2D mTexture1;\n uniform sampler2D mTexture2;\n uniform sampler2D mTexture3;\n uniform sampler2D mTexture4;\n uniform sampler2D mTexture5;\n uniform sampler2D mTexture6;\n uniform sampler2D mTexture7;\n uniform sampler2D mTexture8;\n uniform sampler2D mTexture9;\n uniform sampler2D mTexture10;\n uniform sampler2D mTexture11;\n uniform sampler2D mTexture12;\n uniform sampler2D mTexture13;\n uniform sampler2D mTexture14;\n uniform sampler2D mTexture15;\n\n uniform int uvMax;\n varying vec3 vUv;\n uniform bool black;\n\n int modi(int x, int y) {\n int result = x - ((x / y) * y);\n return result < 0 ? result + y : result;\n }\n\n float modf(float x, float y){\n float result = x - y * floor(x/y);\n return result < 0.0 ? result + y : result;\n }\n\n int getInt(float value) {\n // 添加边界检查\n if (value < 0.0) return 0;\n if (value > float(0x7FFFFFFF)) return 0x7FFFFFFF;\n\n float m = modf(value, 1.0);\n return m < 1.0 && m > 0.6 ? int(value) + 1 : int(value);\n }\n\n vec4 getSample(int index, vec2 uv) {\n if (index == 0) return texture2D(mTexture0, uv);\n if (index == 1) return texture2D(mTexture1, uv);\n if (index == 2) return texture2D(mTexture2, uv);\n if (index == 3) return texture2D(mTexture3, uv);\n if (index == 4) return texture2D(mTexture4, uv);\n if (index == 5) return texture2D(mTexture5, uv);\n if (index == 6) return texture2D(mTexture6, uv);\n if (index == 7) return texture2D(mTexture7, uv);\n if (index == 8) return texture2D(mTexture8, uv);\n if (index == 9) return texture2D(mTexture9, uv);\n if (index == 10) return texture2D(mTexture10, uv);\n if (index == 11) return texture2D(mTexture11, uv);\n if (index == 12) return texture2D(mTexture12, uv);\n if (index == 13) return texture2D(mTexture13, uv);\n if (index == 14) return texture2D(mTexture14, uv);\n if (index == 15) return texture2D(mTexture15, uv);\n return vec4(0.0, 0.0, 0.0, 1.0); // 默认返回透明黑色\n }\n\n vec2 getUv(vec2 uvs, int pos){\n // 严格的边界保护\n float min2 = 1.0 / 4096.0;\n float max2 = 1.0 - min2;\n vec2 clampedUvs = clamp(uvs, vec2(min2), vec2(max2));\n\n vec2 tuv = clampedUvs / 4.0;\n int x = modi(pos, 4);\n int y = pos / 4;\n\n float segment = 1.0 / 4.0;\n vec2 base = vec2(float(x) * segment, float(y) * segment);\n\n // 添加额外的边界检查\n return clamp(tuv + base, vec2(0.0), vec2(1.0));\n }\n\n void main(){\n vec2 tuv = vUv.xy;\n int indexPos = getInt(vUv.z);\n int index = indexPos / 100;\n int pos = modi(indexPos, 100);\n tuv = getUv(tuv, pos);\n gl_FragColor = getSample(index, tuv);\n }",vertexShader:"\n attribute vec3 uvi;\n varying vec3 vUv;\n uniform bool flipX;\n uniform bool flipY;\n\n void main(){\n vUv = uvi;\n bool useCanvas = false;\n if(flipX){\n vUv.x = 1.0-vUv.x;\n }\n if(flipY){\n vUv.y = 1.0-vUv.y;\n }\n if(useCanvas){\n vUv.y = 1.0-vUv.y;\n }\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",uniforms:i,depthTest:!1,side:r.BackSide,transparent:!1}),a=new o.BufferGeometry;this.planeGeometry=a;const u=this.plane=new o.Mesh(a,s);u.visible=!0,u.frustumCulled=!1,u.material=s,u.renderOrder=100,this.add(u)}updatePfid(t,e){this.pfid!==t&&(this.pfid=t),this.level=e}setTexturesUniforms(t,e){this.uniforms.uvMax.value=t,e.forEach((t,e)=>{this.uniforms["mTexture"+e].value=t}),this.uniforms.flipX.value=this.flipX,this.uniforms.flipY.value=this.flipY,0!==this.face&&(this.uniforms.black.value=!0),this.needsUpdate=!0}updateTextures(t,e){this.setTexturesUniforms(t.length,t),this.updateInfos(e)}updateInfos(t){this.textureMap=t;const e=Array.from(this.textureMap.values());e.sort((t,e)=>t.level-e.level);const n=this.revers,r=this.planeGeometry,i=[],o=[],s=[],a=[],u=(t,e)=>{const r=t.level,u=t.textureIndex,c=t.index;bb.getVertices(r,c,n,this.flipX,this.flipY).forEach(t=>{i.push(t.x,t.y,t.z)}),o.push(0,0,1),o.push(0,0,1),o.push(0,0,1),o.push(0,0,1),a.push(0,0,u),a.push(0,1,u),a.push(1,1,u),a.push(1,0,u);const l=4*e;n?(s.push(l+1,l+2,l),s.push(l+2,l+3,l)):(s.push(l,l+2,l+1),s.push(l,l+3,l+2))};for(let t=0;t<e.length;t++)u(e[t],t);const{THREE:c}=Nd.getInstance();r.setAttribute("position",new c.Float32BufferAttribute(i,3)),r.setAttribute("normal",new c.Float32BufferAttribute(o,3)),r.setAttribute("uvi",new c.Float32BufferAttribute(a,3)),r.setIndex(s)}udpateInCamera(t){const{textureMap:e,pfid:n,level:r,textureRootUrl:i,offLineTextureLevel:o,offLineTextureRootUrl:s}=this,a=[];if(t.camera){this.textureMap.forEach(t=>{t.level>r&&(t.willIsInCamera=!1,t.willIsInCamera!==t.isInCamera&&(t.isInCamera=t.willIsInCamera,a.push(t)))});const u=bb.getCount(this.level);for(let c=0;c<u;c++){const u=bb.getTileInfoId(n,r,c),l=e.get(u)||new xb(n,0,r,c,i,o,s);l.willIsInCamera=l.inCamera(this.matrixWorld,t.camera),l.willIsInCamera!==l.isInCamera&&(l.isInCamera=l.willIsInCamera,a.push(l))}}return a}update(){const t=new tg(this);return this.initialized?this.needsUpdate&&(t.needUpdate=!0,this.plane.material.uniformsNeedUpdate=!0):(this.initialized=!0,t.needUpdate=!0),this.initialized&&!this.parent&&(t.shouldPlaceElement=!0),t}renderOnce(){this.updateInfos(this.textureMap)}}const h_=[];class p_{static setPlanesVisible(t){h_.forEach(e=>{e.visible=t})}static getPlanesByMatrix(t,e,n,r,i){return p_.getCubeMatrix().map((o,s)=>{let a=h_[s];const{face:u,revers:c,flipX:l,flipY:h}=vb[s];a||(a=h_[s]=new l_(u,l,h),a.revers=c||!1,a.applyMatrix4(o)),a.level=e;const p=t+(u+1)/10;return a.pfid=p,a.level=0,a.textureRootUrl=n[s],i&&(a.offLineTextureRootUrl=i[s]),null!=r&&(a.offLineTextureLevel=r),a})}static getCubeMatrix(){const{THREE:t}=Nd.getInstance();if(!p_.cubeMatrix){const e=[],n=new t.Matrix4;for(let r=0;r<vb.length;r++){const i=vb[r],{trans:o,euler:s}=i,a=new t.Matrix4;s&&a.multiply(n.makeRotationFromEuler(s)),a.multiply(n.makeTranslation(o.x,o.y,o.z)),a.multiplyScalar(2);const u=new t.Euler(Math.PI/2,0,0);a.premultiply(n.makeRotationFromEuler(u)),e[r]=a}p_.cubeMatrix=e}return p_.cubeMatrix}}var f_=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};let d_;class g_ extends eg{constructor(t,e,n,r=[],i,o,s,a,u){super(),this.level=0,this.levelMax=0,this.offLineTextureLevel=-1,this.pid=t,this.seqID=e,this.textureURLs=n,this.levelMax=i,this.neighborPanoramaIDs=r,this.offLinTextureUrls=o||[],null!=s&&(this.offLineTextureLevel=s),this.initialized=!1,this.mounted=!1,this.needsUpdate=!1,this.tilePlanes=[],this.isPlayingVideo=!1,this.videoCanvas=null,this.videoContentType="mp4",this.setTransform(a,u)}linkLineBox(t){const{THREE:e}=Nd.getInstance(),n=new e.BoxBufferGeometry(t,t,t);this.wireFrame=new e.LineSegments(new e.EdgesGeometry(n),new e.LineBasicMaterial({color:16711680})),this.wireFrame.material.visible=!1,this.wireFrame.renderOrder=100,this.add(this.wireFrame)}linkShere(){const{THREE:t}=Nd.getInstance();if(!d_){const e=new t.SphereBufferGeometry(1,60,40);e.scale(1,-1,1),e.rotateY(-90*Math.PI/180),d_=new t.Mesh(e),d_.visible=!1,d_.renderOrder=150}return d_}mount(){p_.setPlanesVisible(!0),this.tilePlanes=p_.getPlanesByMatrix(this.pid,this.level,this.textureURLs,this.offLineTextureLevel,this.offLinTextureUrls),this.tilePlanes.forEach(t=>{this.add(t),t.visible=!0}),this.sphereMesh=this.linkShere(),this.linkLineBox(2),this.add(this.sphereMesh),this.mounted=!0,this.emit(Ud.DID_LOAD_PANORAMA,this.pid)}unMount(){p_.setPlanesVisible(!1),this.tilePlanes.forEach(t=>{this.remove(t)}),this.tilePlanes=[],this.sphereMesh&&(this.remove(),this.sphereMesh=null),this.mounted=!1}updateLevel(t){const e=Math.min(t,this.levelMax);this.level!==e&&(this.level=e,this.tilePlanes&&this.tilePlanes.forEach(t=>{t.level=e}))}getPreTextureInfos(){const t=[];return vb.forEach((e,n)=>{const{face:r}=e,{level:i,textureURLs:o,offLineTextureLevel:s,offLinTextureUrls:a}=this,u=this.pid+(r+1)/10,c=bb.getCount(this.level);for(let e=0;e<c;e++){const r=new xb(u,0,i,e,o[n],s,a[n]);0===i&&(r.frize=!0),t.push(r)}}),t}setTransform(t,e){t&&this.position.copy(t),e&&this.quaternion.copy(e);const{THREE:n}=Nd.getInstance();this.baseQuaternion=(new n.Quaternion).copy(this.quaternion),this.additionalQuaternion=new n.Quaternion;const r=this.quaternion._onChangeCallback;this.quaternion._onChange(()=>{r();if((new n.Quaternion).multiplyQuaternions(this.baseQuaternion,this.additionalQuaternion).equals(this.quaternion))return;this.baseQuaternion=this.quaternion.clone();const{x:t,y:e,z:i,w:o}=(new n.Quaternion).multiplyQuaternions(this.baseQuaternion,this.additionalQuaternion);this.quaternion.set(t,e,i,o),this.needsUpdate=!0});const i=this.rotation._onChangeCallback;this.rotation._onChange(()=>{i();const t=this.additionalQuaternion.clone().invert();this.baseQuaternion=this.quaternion.clone().multiply(t)}),this.eventListeners={onPanoramaSelected:t=>{this.isSelected=t===this,this.isSelected&&this.emit(Ud.PANORAMA_SELECTED,this.pid)},onEnded:()=>{}},kd.on(zd.ELEMENT_SELECTED,this.eventListeners.onPanoramaSelected)}pauseVideo(){if("ts"===this.videoContentType)this.mpegVideoPlayer&&this.mpegVideoPlayer.pause();else{const t="pano_vid_"+this.pid;if(this.video=this.video||document.getElementById(t),!this.video)return;this.video.pause()}}resumeVideo(){return f_(this,void 0,void 0,(function*(){if("ts"===this.videoContentType)this.mpegVideoPlayer&&this.mpegVideoPlayer.play();else{const t="pano_vid_"+this.pid;if(this.video=this.video||document.getElementById(t),!this.video)return;yield this.video.play()}}))}stopVideo(){if(this.sphereMesh){if(this.sphereMesh.visible=!1,"ts"===this.videoContentType){this.mpegVideoPlayer&&(this.mpegVideoPlayer.stop(),this.mpegVideoPlayer.destroy(),this.mpegVideoPlayer=null);const t=this.sphereMesh.material.map;t&&t.dispose(),this.sphereMesh.material.dispose(),this.videoCanvas=null}else{const t="pano_vid_"+this.pid;this.video=this.video||document.getElementById(t);const e=this.sphereMesh.material.map;e&&e.dispose(),this.sphereMesh.material.dispose(),this.video&&(this.video.pause(),this.video.removeAttribute("src"),this.video.load(),this.video=null)}this.eventListeners.onEnded&&this.eventListeners.onEnded(),this.isPlayingVideo=!1,this.needsUpdate=!0}}playVideo(t,e,n,r="mp4",i=[2048,2048]){if(!this.sphereMesh)return null;const{THREE:o}=Nd.getInstance(),{onReadyToPlay:s,onEnded:a,onPrepareToPlay:u}=n||{};if(this.videoContentType=r,this.eventListeners.onEnded=a||(()=>{}),"ts"!==this.videoContentType){const n="pano_vid_"+this.pid;this.video=document.getElementById(n),this.video||(this.video=document.createElement("video"),this.video.id=n,this.video.setAttribute("webkit-playsinline","true"),this.video.setAttribute("x5-playsinline","true"),this.video.setAttribute("playsinline","true"),this.video.setAttribute("crossorigin","anonymous")),this.video.src=t,this.video.loop=!!e,this.video.addEventListener("playing",()=>{this.sphereMesh&&(this.sphereMesh.visible=!0),this.needsUpdate=!0,s&&s(this.video),this.isPlayingVideo=!0}),this.video.addEventListener("ended",()=>{this.stopVideo()}),this.video.addEventListener("play",()=>{this.needsUpdate=!0,u&&u(this.video)}),this.video.play();const r=new o.VideoTexture(this.video);return r.needsUpdate=!0,this.sphereMesh.material=new o.MeshBasicMaterial({map:r,transparent:!1,depthTest:!1,depthWrite:!1}),this.video}{if(!JSMpeg||!JSMpeg.Player)throw new Error("JSMpeg is needed. Please get JSMpeg from https://github.com/phoboslab/jsmpeg");this.videoCanvas||(this.videoCanvas=document.createElement("canvas"),[this.videoCanvas.width,this.videoCanvas.height]=i),this.mpegVideoPlayer=new JSMpeg.Player(t,{canvas:this.videoCanvas,loop:e,autoplay:!1,disableGl:!1,onSourceEstablished:()=>{this.needsUpdate=!0,u&&u()},onPlay:()=>{this.sphereMesh&&(this.sphereMesh.visible=!0),this.needsUpdate=!0,s&&s(),this.isPlayingVideo=!0},onPause:()=>{},onStalled:()=>{},onEnded:()=>{this.stopVideo()},chunkSize:8388608,videoBufferSize:4194304,decodeFirstFrame:!1,preserveDrawingBuffer:!1});const n=new o.CanvasTexture(this.videoCanvas);n.needsUpdate=!0,hb.DetectIOS()&&(n.flipY=!1),this.sphereMesh.material=new o.MeshBasicMaterial({map:n,transparent:!1,depthTest:!1,depthWrite:!1}),this.mpegVideoPlayer.source.established=!1,this.mpegVideoPlayer.source.loadedSize=0,this.mpegVideoPlayer.demuxer.startTime=0,this.mpegVideoPlayer.demuxer.currentTime=0,this.mpegVideoPlayer.demuxer.bits=null,this.mpegVideoPlayer.demuxer.leftoverBytes=null,this.mpegVideoPlayer.audioOut.resetEnqueuedTime(),this.mpegVideoPlayer.audioOut.unlock(),this.mpegVideoPlayer.seek(0),this.mpegVideoPlayer.play()}return null}setUseLowTexturesOnly(t){this.useLowTextureURLsOnly=t}isUseLowTexturesOnly(){return this.useLowTextureURLsOnly}dispose(){super.dispose(),this.mounted&&this.unMount(),this.initialized=!1,kd.off(zd.ELEMENT_SELECTED,this.eventListeners.onPanoramaSelected)}update(){const t=new tg(this);return this.initialized?(this.needsUpdate||this.isPlayingVideo)&&(t.needUpdate=!0,this.sphereMesh&&this.isPlayingVideo&&this.videoCanvas&&this.sphereMesh.material.map&&(this.sphereMesh.material.map.needsUpdate=!0),this.needsUpdate=!1):(this.initialized=!0,t.needUpdate=!0),this.initialized&&!this.parent&&(t.shouldPlaceElement=!0),t}setAdditionalRotationInEuler(t,e,n){const{THREE:r}=Nd.getInstance();this.additionalQuaternion.setFromEuler(new r.Euler(t,e,n));const{x:i,y:o,z:s,w:a}=this.baseQuaternion.clone().multiply(this.additionalQuaternion);return this.quaternion.set(i,o,s,a),this.needsUpdate=!0,this.additionalQuaternion.clone()}setAdditionalRotationInQuaternion(t,e,n,r){const{THREE:i}=Nd.getInstance();this.additionalQuaternion.set(t,e,n,r);const{x:o,y:s,z:a,w:u}=this.baseQuaternion.clone().multiply(this.additionalQuaternion);return this.quaternion.set(o,s,a,u),this.needsUpdate=!0,(new i.Euler).setFromQuaternion(this.additionalQuaternion)}getBox(){return{size:2,matrix:this.matrix}}}var m_=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};class v_{}v_.TEXTURE_UPDATE="texture.update";class y_ extends Xb{constructor(){super(),this.textures=[],this.textureInfoIds=[],this.addingMap=new Map,this.deletingMap=new Map,this.loadingMap=new Map,this.loadedMap=new Map,this.loadedImageDataMap=new Map,this.textureMap=new Map,this.loadedImageDataMap2=new Map,this.context2ds=[]}get ctx(){if(!this._ctx){const t=this.getNewContext2d(db());t&&(this._ctx=t)}return this._ctx}getNewContext2d(t){const e=document.createElement("canvas");e.width=t,e.height=t;return e.getContext("2d")}getContext2d(t){let e=this.context2ds[t];if(!e){const n=this.getNewContext2d(4*db());n&&(e=this.context2ds[t]=n)}return e}bindView(t){this.view=t}addTexture(t){const e=t.id;this.textureMap.has(e)?this.deletingMap.has(e)&&this.deletingMap.delete(e):this.loadingMap.has(e)?this.loadingMap.set(e,t):this.loadedMap.has(e)?this.loadedMap.set(e,t):this.addingMap.set(e,t)}getCubeTextureByPid(t){const e=[],{loadedImageDataMap:n,loadedImageDataMap2:r}=this;vb.forEach(r=>{const i=bb.getTileInfoId(t+(r.face+1)/10,0,0);{const t=n.get(i);t&&e.push(t)}});const{THREE:i}=Nd.getInstance();if(6===e.length){const t=new i.CubeTexture(e);return t.needsUpdate=!0,t}return null}initTextures(t){return m_(this,void 0,void 0,(function*(){const e=new Map;for(let n=0;n<t.length;n++){const r=t[n],i=r.id;this.addingMap.has(i)?(e.set(i,r),this.addingMap.delete(i)):this.deletingMap.has(i)?(e.set(i,r),this.deletingMap.delete(i)):this.textureMap.has(i)||e.set(i,r)}let n=1;if(e.size&&(n=yield this.initTexturesAsync(e)),n)for(;e.size;){const t=[],n=[];this.updateTextures(t,n,e)&&this.emit(v_.TEXTURE_UPDATE,t,n)}return n}))}deteteTextureMap(t,e){t.forEach(t=>{this.deleteTexture(t,e)})}deleteTexture(t,e){const n=t.id;this.deletingMap.has(n)||(this.addingMap.has(n)?this.addingMap.delete(n):this.loadingMap.has(n)?this.loadingMap.delete(n):this.loadedMap.has(n)?(this.loadedMap.delete(n),this.loadedImageDataMap.delete(n)):this.textureMap.has(n)&&(t.time=0,!e&&t.frize||this.deletingMap.set(n,t)))}getTextureInfos(){const t=[];for(let e=0;e<this.textures.length;e++){const n=this.textureInfoIds[e];for(let e=0;e<n.length;e++)if(n[e]){const r=this.textureMap.get(n[e]);r&&t.push(r)}}return t}loadTexturesAsync(){return m_(this,void 0,void 0,(function*(){if(!this.loading){const{addingMap:t,loadingMap:e,loadedMap:n,loadedImageDataMap:r,loadedImageDataMap2:i}=this,o=Array.from(t);for(o.sort((t,e)=>t[1].centerDis-e[1].centerDis);o[0];){const i=o.shift();if(!i)continue;const s=i[0];if(s&&i){const i=t.get(s);if(i){t.delete(s),e.set(s,i);const o=bb.getImageInfo(i);{const t=yield this.loadImgAsync(o.url);t&&e.has(s)&&(e.delete(s),n.set(s,i),r.set(s,t))}}}}this.loading=!1}}))}initTexturesAsync(t){return m_(this,void 0,void 0,(function*(){return new Promise(e=>{const{loadedImageDataMap:n,loadedImageDataMap2:r}=this,i=Array.from(t.keys()),o=i.length;o<1&&e();let s=0;const a=()=>{s++,s>=o&&e(1)},u=()=>{e(0)};for(let e=0;e<o;e++){const r=i[e],o=t.get(r);if(o){const t=bb.getImageInfo(o).url;this.loadImgAsync(t).then(t=>{n.set(r,t),a()}).catch(u)}}})}))}deleteTexturesByPid(t,e){const n=t+".",{textureInfoIds:r,textureMap:i,addingMap:o,deletingMap:s,loadedImageDataMap:a,loadedMap:u,loadingMap:c}=this;i.forEach((t,o)=>{if(o.startsWith(n)&&(e||!t.frize)){const{x:e,y:n}=bb.getXY(t.textureIndex,100);delete r[n][e],i.delete(o),a.has(o)&&this.loadedImageDataMap.delete(o)}}),o.forEach((t,r)=>{r.startsWith(n)&&(!e&&t.frize||o.delete(r))}),s.forEach((t,r)=>{r.startsWith(n)&&(!e&&t.frize||s.delete(r))}),u.forEach((t,r)=>{r.startsWith(n)&&(!e&&t.frize||(u.delete(r),a.delete(r)))}),c.forEach((t,r)=>{r.startsWith(n)&&(!e&&t.frize||c.delete(r))})}updateTextures(t,e,n){const{loadedMap:r,deletingMap:i,textureInfoIds:o,textures:s,loadedImageDataMap:a,loadedImageDataMap2:u}=this,c=n||r,{maxIndex:l,create:h}=this.testEmptyMaxCount(o,i,c);if(-1===l)return!1;h&&(s[l]=this.createMergeTexture()),i.forEach((t,n)=>{const{x:r,y:i}=bb.getXY(t.textureIndex,100);i===l&&(this.textureMap.delete(n),delete o[i][r],e.push(t))}),e.forEach(t=>{i.delete(t.id)});let p=o[l];p||(p=o[l]=[]);const f=Array.from(c);f.sort((t,e)=>t[1].centerDis-e[1].centerDis);let d=0;for(let e=0;e<16&&f[0];e++){if(!p[e]){if(d>=bb.updateTextureMax&&!n)break;const[r,i]=f.shift();c.delete(r),i.textureIndex=100*l+e,p[e]=r,this.textureMap.set(r,i),t.push(i);{const t=a.get(r);this.updateMergeTexture(s[l],t,e),i.frize||a.delete(r)}d++}}return t.length>0||e.length>0}testEmptyMaxCount(t,e,n){if(!e.size&&!n.size)return{maxIndex:-1,maxCount:0,create:!1};const r=[],i=t.length;for(let t=0;t<i;t++)r[t]=0;const o=Array.from(r);e&&e.forEach(t=>{if(t.time>1800){const{y:e}=bb.getXY(t.textureIndex,100);o[e]++}});for(let e=0;e<i;e++){const n=t[e];for(let t=0;t<16;t++)n[t]&&r[e]++}const s=r.map((t,e)=>16-t+(o[e]||0)),a=n.size;let u=0,c=0;for(let t=0;t<s.length;t++){const e=s[t],n=o[t];if(a){if(u>=bb.updateTextureMax||u>=a)break;e>u&&(u=e,c=t)}else n>u&&(u=n,c=t)}let l=!1;if(0===u)if(c=t.length,c>=16){let t;e.forEach(e=>{(!t||t.time>e.time)&&(t=e)}),t?(c=bb.getXY(t.textureIndex,100).y,u=1):(c=-1,u=0)}else 0===a?(c=-1,u=0,l=!1):(u=16,l=!0);return{maxIndex:c,maxCount:u,create:l}}createMergeTexture(){const{THREE:t}=Nd.getInstance(),e=db(),n=new Uint8Array(e*e*4*4*4);return new t.DataTexture(n,4*e,4*e)}createCanvasTexture(t){const{THREE:e}=Nd.getInstance(),n=this.getContext2d(t);return new e.Texture(n.canvas)}updateCanvasTexture(t,e,n,r){const{x:i,y:o}=bb.getXY(r,4),s=db();e.drawImage(n,i*s,(3-o)*s),t.needsUpdate=!0}updateMergeTexture(t,e,n){const r=t.image.data,i=e.data,{x:o,y:s}=bb.getXY(n,4),a=db(),u=4*a*4,c=4*a,l=s*u*a+o*c;for(let t=0;t<a;t++)for(let e=0;e<a;e++){const n=l+t*u+4*e,o=t*c+4*e;r[n]=i[o],r[n+1]=i[o+1],r[n+2]=i[o+2],r[n+3]=i[o+3]}t.needsUpdate=!0}updateMergeTexture2(t,e,n,r){const i=t.image.data,o=n.image.data,{x:s,y:a}=bb.getXY(e,4),{x:u,y:c}=bb.getXY(r,4),l=db(),h=4*l*4,p=4*l,f=a*h*l+s*p,d=c*h*l+u*p;for(let t=0;t<l;t++)for(let e=0;e<l;e++){const n=f+t*h+4*e,r=d+t*h+4*e;i[n]=o[r],i[n+1]=o[r+1],i[n+2]=o[r+2],i[n+3]=o[r+3]}t.needsUpdate=!0}loadImgAsync(t){const e=new Image;e.setAttribute("crossOrigin","anonymous");const{ctx:n}=this;return new Promise((r,i)=>{e.onload=()=>{n.drawImage(e,0,0);const t=db(),i=n.getImageData(0,0,t,t);r(i)},e.onerror=()=>{i()},e.src=t})}loadImgAsync2(t){const e=new Image;return e.setAttribute("crossOrigin","anonymous"),new Promise((n,r)=>{e.onload=()=>{n(e)},e.onerror=()=>{r()},e.src=t})}updateDeletingTextures(){const{deletingMap:t}=this;t.forEach(t=>{t.time++})}formatTextures(t){const{textureInfoIds:e,textureMap:n,textures:r,loadedImageDataMap2:i}=this,o=e.length;let s,a=0,u=o-1,c=0,l=16,h=-1,p=!1;for(;a<u;)if(s){if(p)break;if(!e[a][c]){e[a][c]=s,delete e[u][l];const i=n.get(s);i&&(t.push(i),i.textureIndex=100*a+c,this.updateMergeTexture2(r[a],c,r[u],l),-1===h?h=a:h!==a&&(p=!0)),s=void 0}c++,c>=16&&(a++,c=0)}else l--,l<0&&(u--,l=16),s=e[u][l];if(u<o-1){e.splice(u+1,o-1-u);r.splice(u+1,o-1-u);0}return 0!==t.length}update(){this.loadTexturesAsync(),this.updateDeletingTextures();const t=[],e=[];let n=this.updateTextures(t,e);return n||(n=this.formatTextures(t)),n&&this.emit(v_.TEXTURE_UPDATE,t,e),n}static get instance(){return this.__instance||(this.__instance=new y_),this.__instance}}var x_,b_=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};!function(t){t[t.AlwaysHide=0]="AlwaysHide",t[t.AlwaysShow=1]="AlwaysShow",t[t.Editing=2]="Editing",t[t.Show=3]="Show"}(x_||(x_={}));class __ extends eg{constructor(t,e){super(),this.initialized=!1;const{modelElement:n,groundParams:r,indicatorImageURL:i,invisibleIndicatorImageURL:o,indicatorWidth:s,indicatorHeight:a,indicatorPositionMap:u,globalScale:c,showInvisible:l}=e||{globalScale:1},{THREE:h}=Nd.getInstance();this.currentPanoramaID=-1,this.panoramaMap=new Map,this.indicatorMap=new Map,this.indicatorVisibilityMap=new Map,this.indicatorHiddenMap=new Map,this.indicatorPositionMap=u||new Map,this.inSightIndicators=[],this.indicatorWidth=s||2*__.IndicatorRadius,this.indicatorHeight=a||2*__.IndicatorRadius,this.maxWorldDistance=13,this.globalScale=c||1,this.showInvisible=l||!1,this.group=new h.Group,this.add(this.group),this.viewConfigurations=new Map,this.eventListeners={onFloorModelLoaded:t=>{t===this.modelElement&&this.updateIndicatorsPositions()}},this.groundParams=r,this.bindModelElement(n),this.initIndicator(i,o),this.initPanoramas(t),this.initIndicatorPosition(),kd.on(zd.ELEMENT_LOADED,this.eventListeners.onFloorModelLoaded),this.initialized=!1,this.needUpdate=!1}initPanoramas(t){this.panoramaDatas=new Map,t.forEach(t=>{this.panoramaDatas.set(t.pid,t)}),t.forEach(t=>{const e=new g_(t.pid,t.seqID,t.useLowTextureURLsOnly?t.textureURLs||t.highTextureURLs:t.highTextureURLs||t.textureURLs,t.neighbourPanoramaIDs,t.useLowTextureURLsOnly?1:2,t.offLineTextureUrls,t.offLineTextureLevel,t.position,t.quaternion);e.scale.set(this.globalScale,this.globalScale,this.globalScale),this.putPanorama(e)})}initIndicatorPosition(){this.modelElement instanceof Yx&&this.modelElement.isModelLoaded()&&this.updateIndicatorsPositions()}updateLevelMax(t){this.panoramaMap&&this.panoramaMap.forEach(e=>{e.levelMax=t})}dispose(t){super.dispose(),kd.off(zd.ELEMENT_LOADED,this.eventListeners.onFloorModelLoaded),this.panoramaMap&&(this.panoramaMap.forEach(e=>{this.group.remove(e),t!==e.pid&&Ab.sharedInstance.recycleCubeTexture(e.textureURLs),e.dispose()}),this.panoramaMap.clear()),this.indicatorMap&&(this.indicatorMap.forEach(t=>{this.group.remove(t)}),this.indicatorMap.clear()),this.boundBox&&(this.group.remove(this.boundBox),this.boundBox.geometry.dispose(),this.boundBox=null),this.remove(this.group)}initIndicator(t,e){const{THREE:n}=Nd.getInstance(),i="\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",o="\n uniform sampler2D map;\n uniform float opacity;\n uniform vec4 blendColor;\n varying vec2 vUv;\n void main(){\n vec4 texColor = texture2D(map, vUv);\n gl_FragColor = vec4((texColor * (1.0 - blendColor.a) + blendColor * blendColor.a).rgb, texColor.a * opacity);\n }\n ";let s,a,u;this.indicatorShaderUniforms={map:{type:"t",value:null},blendColor:{type:"v4",value:new n.Vector4(0,0,0,0)},opacity:{value:1}},this.invisibleIndicatorShaderUniforms={map:{type:"t",value:null},blendColor:{type:"v4",value:new n.Vector4(1,0,0,.5)},opacity:{value:1}},this.indicatorMaterials=new Map,t?(a=new n.PlaneBufferGeometry(this.indicatorWidth,this.indicatorHeight),s=new n.ShaderMaterial({transparent:!0,vertexShader:i,fragmentShader:o,uniforms:this.indicatorShaderUniforms,side:r.DoubleSide,depthTest:!1,depthWrite:!1,name:"indicatorMaterial"}),this.indicatorImageURL=t,(new n.TextureLoader).load(t,t=>{this.indicatorShaderUniforms.map.value=t})):(a=new n.CircleGeometry(this.indicatorWidth/2,32),s=new n.MeshBasicMaterial({transparent:!0}),s.side=r.DoubleSide,s.depthTest=!1,s.depthWrite=!1,s.color=new n.Color(16777215));const c=e||t;c?(u=new n.ShaderMaterial({transparent:!0,vertexShader:i,fragmentShader:o,uniforms:this.invisibleIndicatorShaderUniforms,side:r.DoubleSide,depthTest:!1,depthWrite:!1,name:"invisibleIndicatorMaterial"}),(new n.TextureLoader).load(c,t=>{this.invisibleIndicatorShaderUniforms.map.value=t})):(u=new n.MeshBasicMaterial,u.side=r.DoubleSide,u.depthTest=!1,u.depthWrite=!1,u.color=new n.Color(16711680));const l=new n.Mesh(a,s);this.setIndicatorMeshPrototype(l),this.setIndicatorMaterial(s,x_.Editing,!0),this.setIndicatorMaterial(u,x_.Editing,!1),this.setIndicatorMaterial(s,x_.Show,!0)}updateIndicators(){this.getPIDPositionMap(this.inSightIndicators).forEach((t,e)=>{if(!this.indicatorPositionMap.get(e)&&(this.groundParams||this.modelElement instanceof Yx)){let n;if(this.groundParams&&this.groundParams.groundPlane)n=Yx.intersectWithGroundPlane(t,this.groundParams);else{n=this.modelElement.intersectGround(t)}n&&this.indicatorPositionMap.set(e,n)}}),this.inSightIndicators.forEach(t=>{let e=this.indicatorMap.get(t);if(!e){e=this.indicatorMeshPrototype.clone(),this.indicatorMap.set(t,e),this.group.add(e);const n=this.panoramaDatas.get(t);n&&n.position&&e.position.copy(n.position)}const n=this.indicatorPositionMap.get(t);n&&e.position.copy(n)})}update(){const t=new tg(this);if(this.initialized){if(this.needUpdate)this.updateIndicators(),this.needUpdate=!1,t.needUpdate=!0;else if(this.currentPanorama){this.currentPanorama.update().needUpdate&&(t.needUpdate=!0)}}else this.initialized=!0,t.needUpdate=!0;return this.initialized&&!this.parent&&(t.shouldPlaceElement=!0),t}bindModelElement(t){t&&(this.modelElement=t),this.boundBox&&(this.group.remove(this.boundBox),this.boundBox=null),this.getModelBoundBox()}static getBoundBox(t){if(!t)return null;const{THREE:e}=Nd.getInstance(),n=(new e.Box3).setFromObject(t),r=n.getSize(new e.Vector3),i=Math.max(r.x,r.y,r.z),o=new e.Mesh(new e.BoxBufferGeometry(i,i,i));return o.position.copy(n.max.clone().add(n.min).multiplyScalar(.5)),o}getModelBoundBox(){this.boundBox||(this.boundBox=__.getBoundBox(this.modelElement),this.boundBox&&(this.boundBox.visible=!0,this.boundBox.frustumCulled=!1,this.boundBox.renderOrder=100,this.group.add(this.boundBox)))}setBoundBoxAppearance(t){this.getModelBoundBox(),this.boundBox&&(this.boundBox.material=t,this.needUpdate=!0)}setBoundBoxVisible(t){this.boundBox&&(this.boundBox.visible=t)}presentPanorama(t){return b_(this,void 0,void 0,(function*(){return yield this.initTexturesByPanorama(t)}))}initTexturesByPanorama(t){return b_(this,void 0,void 0,(function*(){t.updateLevel(0);const e=t.getPreTextureInfos();return yield y_.instance.initTextures(e)}))}presentPanoramaOfPID(t){return b_(this,void 0,void 0,(function*(){const e=this.getPanoramaByPID(t);let n=1;return e&&(n=yield this.presentPanorama(e)),n&&(this.currentPanoramaID=t,this.currentPanorama=e,this.emit(Ud.PANORAMA_PRESENTED,t)),n}))}visibleRadiusOfView(t){if(!t)return __.DefaultVisibleRadius;const e=this.viewConfigurations.get(t);return e&&e.visibleRadius?e.visibleRadius:__.DefaultVisibleRadius}panoramaIDsAround(t,e){const n=this.panoramaDatas.get(t);if(!n||!n.position)return null;const r=[t],i=this.visibleRadiusOfView(e);return n.neighbourPanoramaIDs.map(t=>this.panoramaDatas.get(t)).forEach(t=>{if(t&&t.position){const e=n.position.distanceTo(t.position);(this.showInvisible||t.visible)&&e<=i&&r.push(t.pid)}}),r}presentPanoramaAround(t,e){return b_(this,void 0,void 0,(function*(){let n=1;return this.panoramaIDsAround(t,e)&&(n=yield this.presentPanoramaOfPID(t)),n}))}getPIDPositionMap(t){const e=new Map;return t.forEach(t=>{const n=this.panoramaDatas.get(t);n&&e.set(t,n.position)}),e}getIndicatorPosition(t){return this.indicatorPositionMap.get(t)}presentPanoramaIndicators(t){if(!this.modelElement)return;const{THREE:e}=Nd.getInstance();this.inSightIndicators=[],t.forEach((t,n)=>{if(this.groundParams||this.modelElement instanceof Yx){if(!this.indicatorPositionMap.get(n)){let r;if(this.groundParams&&this.groundParams.groundPlane)r=Yx.intersectWithGroundPlane(t,this.groundParams);else{r=this.modelElement.intersectGround(t)}r&&this.indicatorPositionMap.set(n,r.add(new e.Vector3(0,0,__.IndicatorOffsetZ)))}}this.inSightIndicators.push(n)}),this.needUpdate=!0}updateIndicatorsPositions(){return b_(this,void 0,void 0,(function*(){const{THREE:t}=Nd.getInstance();this.panoramaMap.forEach((e,n)=>{if(this.indicatorPositionMap.get(n))return;const{position:r}=e;let i;if(this.groundParams&&this.groundParams.groundPlane)i=Yx.intersectWithGroundPlane(r,this.groundParams);else{i=this.modelElement.intersectGround(r)}i&&this.indicatorPositionMap.set(n,i.add(new t.Vector3(0,0,__.IndicatorOffsetZ)))});const e=yield this.getPIDPositionMap(this.inSightIndicators);this.presentPanoramaIndicators(e)}))}presentPanoramaIndicatorsAround(t,e){return b_(this,void 0,void 0,(function*(){const n=this.panoramaIDsAround(t,e);if(n){const t=yield this.getPIDPositionMap(n);this.presentPanoramaIndicators(t)}}))}getIndicatorVisibility(t){const e=this.indicatorVisibilityMap.get(t);return void 0===e||e}setIndicatorVisibility(t,e){let n;void 0===e?(n=[],this.indicatorMap.forEach((t,e)=>{n.push(e)})):n=Array.isArray(e)?e:[e],n.forEach(e=>{this.indicatorVisibilityMap.set(e,t);const n=this.indicatorMap.get(e);n&&(this.group.remove(n),this.indicatorMap.delete(e))}),this.needUpdate=!0}setIndicatorHidden(t,e){let n;void 0===e?(n=[],this.indicatorMap.forEach((t,e)=>{n.push(e)})):n=Array.isArray(e)?e:[e],n.forEach(e=>{this.indicatorHiddenMap.set(e,t);const n=this.indicatorMap.get(e);n&&(this.group.remove(n),this.indicatorMap.delete(e))}),this.needUpdate=!0}intersectIndicators(t,e){let n=[];const r=e.normalize(),i=Math.min(this.indicatorHeight,this.indicatorWidth)/2;return this.indicatorMap.forEach((e,o)=>{const s=e.position;if(Number.isNaN(s.x))return;const a=s.clone().sub(t),u=a.dot(r);if(u>0){const t=r.clone().multiplyScalar(u),e=a.sub(t).length();e<=i&&n.push({pid:o,distance:e})}}),n.length>0?(n=n.sort((t,e)=>t.distance<e.distance?-1:t.distance>e.distance?1:0),n[0].pid):-1}intersectIndicatorsOnScreen(t,e,{screenWidth:n,screenHeight:r},i){const o=Array.from(this.indicatorMap),s=o.map(([,t])=>t),a=ky.getMouseIntersectionOnScreen(s,t,{screenWidth:n,screenHeight:r},e,i,s,this.maxWorldDistance);if(a){const t=o.find(([,t])=>t===a);if(t)return t[0]}return-1}putPanorama(t){const e=this.panoramaMap.get(t.pid);e&&(this.group.remove(e),e.dispose()),this.panoramaMap.set(t.pid,t),this.group.add(t),this.needUpdate=!0}initializePanoramasIfNecessary(t){return b_(this,void 0,void 0,(function*(){let e=[];if(Array.isArray(t))e=t;else if("all"===t)e=Array.from(this.panoramaDatas.keys());else{const n=t;e.push(n);const r=new Set;r.add(n);const i=[n];for(;i.length>0;){const t=i.splice(0,1)[0],n=this.panoramaDatas.get(t);n&&n.neighbourPanoramaIDs.forEach(t=>{r.has(t)||(r.add(t),i.push(t),e.push(t))})}}const n=e.map(t=>this.getPanoramaByPID(t));return Promise.all(n)}))}getPanoramaByPID(t){const e=this.panoramaMap.get(t);if(e)return e;const n=this.panoramaDatas.get(t);if(!n)return;const r=new g_(n.pid,n.seqID,n.useLowTextureURLsOnly?n.textureURLs||n.highTextureURLs:n.highTextureURLs||n.textureURLs,n.neighbourPanoramaIDs,n.useLowTextureURLsOnly?1:2,n.offLineTextureUrls,n.offLineTextureLevel,n.position,n.quaternion);return r.scale.set(this.globalScale,this.globalScale,this.globalScale),this.putPanorama(r),r}getPanoramaByPIDInstant(t){return this.panoramaMap.get(t)||null}getNeghbourPanoClosestToRay(t){if(-1===this.currentPanoramaID)return-1;const e=this.panoramaMap.get(this.currentPanoramaID);if(!e)return-1;if(!e.neighborPanoramaIDs||0===e.neighborPanoramaIDs.length)return-1;const n=t.clone().normalize();let r=-1,i=-1;return e.neighborPanoramaIDs.forEach(t=>{const o=this.panoramaMap.get(t);if(!o)return;const s=o.position.clone().sub(e.position).normalize().dot(n);s>r&&(r=s,i=t)}),r>=Math.cos(12*Math.PI/180)?i:-1}updateIndicatorGeometry(){const{THREE:t}=Nd.getInstance();let e;e=this.indicatorImageURL?new t.PlaneBufferGeometry(this.indicatorWidth,this.indicatorHeight):new t.CircleGeometry(this.indicatorWidth/2,32);const n=new Set;Array.from(this.indicatorMap).forEach(([,t])=>{n.add(t.geometry),t.geometry=e}),Array.from(n).forEach(t=>{t.dispose()}),this.indicatorMeshPrototype.geometry=e;const r=new t.Mesh(e,this.indicatorMeshPrototype.material);this.setIndicatorMeshPrototype(r)}setIndicatorSize(t,e){this.indicatorWidth=t,this.indicatorHeight=e,this.updateIndicatorGeometry()}setIndicatorImageURL(t){const{THREE:e}=Nd.getInstance();(new e.TextureLoader).load(t,n=>{const i="\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",o="\n uniform sampler2D map;\n uniform float opacity;\n uniform vec4 blendColor;\n varying vec2 vUv;\n void main(){\n vec4 texColor = texture2D(map, vUv);\n gl_FragColor = vec4((texColor * (1.0 - blendColor.a) + blendColor * blendColor.a).rgb, texColor.a * opacity);\n }\n ";let s=this.getIndicatorMaterial(x_.Editing,!0),a=new e.ShaderMaterial({transparent:!0,vertexShader:i,fragmentShader:o,uniforms:this.indicatorShaderUniforms,side:r.DoubleSide,depthTest:!1,depthWrite:!1,name:"indicatorMaterial"});this.setIndicatorMaterial(a,x_.Editing,!0),s.dispose(),s=this.getIndicatorMaterial(x_.Show,!0),this.setIndicatorMaterial(a,x_.Show,!0),s.dispose(),a=new e.ShaderMaterial({transparent:!0,vertexShader:i,fragmentShader:o,uniforms:this.invisibleIndicatorShaderUniforms,side:r.DoubleSide,depthTest:!1,depthWrite:!1,name:"invisibleIndicatorMaterial"}),this.indicatorShaderUniforms.map.value=n,this.invisibleIndicatorShaderUniforms.map.value=n,this.setIndicatorMaterial(a,x_.Editing,!1),this.indicatorImageURL||this.setIndicatorMeshPrototype(new e.Mesh(new e.PlaneBufferGeometry(this.indicatorWidth,this.indicatorHeight),a)),this.indicatorImageURL=t,this.needUpdate=!0,this.updateIndicatorGeometry()})}getIndicatorSize(){return[this.indicatorWidth,this.indicatorHeight]}setIndicatorMeshPrototype(t){this.indicatorMeshPrototype=t,this.panoramaMap.forEach((t,e)=>{const n=this.indicatorMap.get(e);n&&(this.group.remove(n),this.indicatorMap.delete(e))}),t.renderOrder=300,this.needUpdate=!0}setIndicatorMaterial(t,e,n){let r=this.indicatorMaterials.get(e);r||(r=new Map,this.indicatorMaterials.set(e,r)),r.set(n,t),this.needUpdate=!0}getIndicatorMaterial(t,e){let n=this.indicatorMaterials.get(t);return n||(n=new Map,this.indicatorMaterials.set(t,n)),n.get(e)}addGroupViewConfiguration(t){const e=this.viewConfigurations.get(t.targetView);e&&(void 0===t.showBoundBox&&void 0!==e.showBoundBox&&(t.showBoundBox=e.showBoundBox),void 0===t.visibleRadius&&void 0!==e.visibleRadius&&(t.visibleRadius=e.visibleRadius),void 0===t.indicatorDisplayMode&&void 0!==e.indicatorDisplayMode&&(t.indicatorDisplayMode=e.indicatorDisplayMode)),this.viewConfigurations.set(t.targetView,t),this.needUpdate=!0}setMaxWorldDistance(t){this.maxWorldDistance=t}}__.DefaultVisibleRadius=10,__.IndicatorRadius=.1,__.IndicatorOffsetZ=.1;class w_{static getModelVS(){return"\n uniform vec3 pano0Position;\n uniform mat4 pano0Matrix;\n uniform vec3 pano1Position;\n uniform mat4 pano1Matrix;\n\n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n\n void main() {\n\n vec4 worldPosition = modelMatrix * vec4(position, 1.0);\n\n vec3 positionLocalToPanoCenter0 = worldPosition.xyz - pano0Position;\n vWorldPosition0 = (vec4(positionLocalToPanoCenter0, 1.0) * pano0Matrix).xyz;\n vWorldPosition0.y *= -1.0;\n\n vec3 positionLocalToPanoCenter1 = worldPosition.xyz - pano1Position;\n vWorldPosition1 = (vec4(positionLocalToPanoCenter1, 1.0) * pano1Matrix).xyz;\n vWorldPosition1.y *= -1.0;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }"}static getInstantTranslationVS(){return"\n uniform mat4 matrixT;\n\n uniform vec3 pano0Position;\n uniform mat4 pano0Matrix;\n uniform vec3 pano1Position;\n uniform mat4 pano1Matrix;\n\n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n\n void main() {\n\n vec4 worldPosition = modelMatrix * vec4(position, 1.0);\n vec4 worldPosition0 = matrixT * worldPosition;\n\n vec3 positionLocalToPanoCenter1 = worldPosition.xyz - pano1Position;\n vWorldPosition1 = (vec4(positionLocalToPanoCenter1, 1.0) * pano1Matrix).xyz;\n vWorldPosition1.y *= -1.0;\n\n vec3 positionLocalToPanoCenter0 = worldPosition0.xyz - pano0Position;\n vWorldPosition0 = (vec4(positionLocalToPanoCenter0, 1.0) * pano0Matrix).xyz;\n vWorldPosition0.y *= -1.0;\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }"}static getModelFS(){return"\n uniform float weight0;\n uniform float weight1;\n\n uniform samplerCube pano0Map;\n\n uniform samplerCube pano1Map;\n\n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n\n void main() {\n vec3 cp0 = vWorldPosition0.xyz;\n vec3 cp1 = vWorldPosition1.xyz;\n vec4 colorFromPano0 = textureCube( pano0Map, cp0);\n vec4 colorFromPano1 = textureCube( pano1Map, cp1);\n\n vec4 colorFromPanos;\n // 'colorFromPanos = mix(colorFromPano0, colorFromPano1, progress);\n colorFromPanos = colorFromPano0 * weight0 + colorFromPano1 * weight1;\n gl_FragColor = vec4(colorFromPanos.rgb, 1.0);\n }"}static debugModelVS(){return"\n uniform vec2 xRange;\n uniform vec2 yRange;\n uniform vec2 zRange;\n varying vec4 vColor;\n\n void main() {\n float x = (position.x - xRange.x) / xRange.y;\n float y = (position.y - yRange.x) / yRange.y;\n float z = (position.z - zRange.x) / zRange.y;\n vColor = vec4(x, y, z, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }"}static debugModelFS(){return"\n varying vec4 vColor;\n\n void main() {\n gl_FragColor = vColor;\n }"}static createModelUniforms(){const{THREE:t}=Nd.getInstance();return{weight0:{type:"f",value:0},weight1:{type:"f",value:0},pano0Map:{type:"t",value:null},pano0Position:{type:"v3",value:new t.Vector3},pano0Matrix:{type:"m4",value:new t.Matrix4},pano1Map:{type:"t",value:null},pano1Position:{type:"v3",value:new t.Vector3},pano1Matrix:{type:"m4",value:new t.Matrix4}}}static createInstantTranslationUniforms(){const{THREE:t}=Nd.getInstance();return{weight0:{type:"f",value:0},weight1:{type:"f",value:0},pano0Map:{type:"t",value:null},pano0Position:{type:"v3",value:new t.Vector3},pano0Matrix:{type:"m4",value:new t.Matrix4},pano1Map:{type:"t",value:null},pano1Position:{type:"v3",value:new t.Vector3},pano1Matrix:{type:"m4",value:new t.Matrix4},matrixT:{type:"m4",value:new t.Matrix4}}}static getModelMeshInElement(t){let e;const{THREE:n}=Nd.getInstance();return t instanceof n.Mesh?t:(t&&t.traverse(t=>{t instanceof n.Mesh&&(e=t)}),e)}}var M_=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))};class E_ extends Xb{constructor(t,e,n,r){super(),this.levels=[1,1.5,3],this.levelMax=2;const{THREE:i}=Nd.getInstance();this.planeMap=new Map,this.showModel=void 0===r||r,this.levelMap=new Map,this.isAnimating=!1,this.touches={s:[new i.Vector2,new i.Vector2],c:[new i.Vector2,new i.Vector2],state:"idle",dist:0,fov:60},e&&(this.panoramaGroups=e instanceof __?[e]:e,this.panoramaGroups.length>0&&(this.curPanoramaGroup=this.panoramaGroups[0])),n&&(this.basicController=n),this.pid2GroupMap=new Map,this.eventListeners={onTextureUpdate:(t,e)=>{this.updatePanoramaTextureInfos(t,e)},onMouseDown:t=>{this.onMouseDown(t)},onMouseMove:t=>{this.onMouseMove(t)},onMouseUp:t=>{this.onMouseUp(t)},onMouseWheel:t=>{this.onMouseWheel(t)},onTouchStart:t=>{this.onTouchStart(t)},onTouchMove:t=>{this.onTouchMove(t)},onTouchEnd:t=>{this.onTouchEnd(t)}},t&&this.bindView(t),this.raycaster=new i.Raycaster,this.onScreenDetectRadius=1e3,this.moveOnClick=!0,this.handlePanoramaUpdate=bb.throttle(t=>{this.updatePlaneInCamera(t)},100),this.handlePanoramaLevel=bb.throttle(()=>{this.updateLevel()},200),y_.instance.on(v_.TEXTURE_UPDATE,this.eventListeners.onTextureUpdate);const o=void 0===r?this.showModel:!0===r;this.panoramaGroups.forEach(t=>{const e=E_.getModelMesh(t);this.setModelAppearance(t.modelElement,o,void 0,e)})}setEnabled(t){t!==this.enabled&&(this.enabled=t,t?this.registerEvents():this.unregisterEvents())}registerEvents(){this.view&&(this.view.on(zd.MOUSE_DOWN,this.eventListeners.onMouseDown),this.view.on(zd.MOUSE_MOVE,this.eventListeners.onMouseMove),this.view.on(zd.MOUSE_UP,this.eventListeners.onMouseUp),this.view.on(zd.MOUSE_WHEEL,this.eventListeners.onMouseWheel),this.view.on(zd.TOUCH_START,this.eventListeners.onTouchStart),this.view.on(zd.TOUCH_MOVE,this.eventListeners.onTouchMove),this.view.on(zd.TOUCH_END,this.eventListeners.onTouchEnd))}unregisterEvents(){this.view&&(this.view.off(zd.MOUSE_DOWN,this.eventListeners.onMouseDown),this.view.off(zd.MOUSE_MOVE,this.eventListeners.onMouseMove),this.view.off(zd.MOUSE_UP,this.eventListeners.onMouseUp),this.view.off(zd.MOUSE_WHEEL,this.eventListeners.onMouseWheel),this.view.off(zd.TOUCH_START,this.eventListeners.onTouchStart),this.view.off(zd.TOUCH_MOVE,this.eventListeners.onTouchMove),this.view.off(zd.TOUCH_END,this.eventListeners.onTouchEnd))}onMouseDown(t){const{THREE:e}=Nd.getInstance();this.touches.s[0]=new e.Vector2(t.clientX,t.clientY),this.touches.state="down"}onMouseMove(t){const{THREE:e}=Nd.getInstance();if(this.touches.c[0]=new e.Vector2(t.clientX,t.clientY),"down"===this.touches.state&&this.touches.c[0].distanceToSquared(this.touches.s[0])>100&&(this.touches.state="move"),this.raycaster&&this.captureMove){const{clientWidth:n,clientHeight:r}=this.view.container,{left:i,top:o}=this.view.container.getBoundingClientRect(),s=t.clientX-i,a=t.clientY-o;if(this.raycaster.setFromCamera({x:s,y:a},this.view.camera),this.curPanoramaGroup){let t;t=this.onScreenDetectRadius>0&&this.view.camera?this.curPanoramaGroup.intersectIndicatorsOnScreen(new e.Vector2(s,a),this.onScreenDetectRadius,{screenWidth:n,screenHeight:r},this.view.camera):this.curPanoramaGroup.intersectIndicators(this.raycaster.ray.origin,this.raycaster.ray.direction),t>-1&&this.emit(Ud.PANORAMA_HOVER,t,this.curPanoramaGroup.getIndicatorPosition(t))}}"move"===this.touches.state&&this.onMouseDrag()}onMouseUp(t){return M_(this,void 0,void 0,(function*(){const{THREE:e}=Nd.getInstance();if("down"===this.touches.state){const{clientWidth:n,clientHeight:r}=this.view.container,{left:i,top:o}=this.view.container.getBoundingClientRect(),s=t.clientX-i,a=t.clientY-o;if(this.raycaster&&(this.raycaster.setFromCamera({x:s,y:a},this.view.camera),this.onScreenDetectRadius&&this.curPanoramaGroup)){let i;i=this.view.camera?this.curPanoramaGroup.intersectIndicatorsOnScreen(new e.Vector2(s,a),this.onScreenDetectRadius,{screenWidth:n,screenHeight:r},this.view.camera):this.curPanoramaGroup.intersectIndicators(this.raycaster.ray.origin,this.raycaster.ray.direction),-1!==i&&(this.emit(Ud.CLICK_PANORAMA,i,t),0===t.button&&this.moveOnClick&&this.curPanoramaGroup.currentPanoramaID!==i&&(yield this.moveToPanorama(i,{interval:1e3,fadeInOut:!1})))}}this.touches.state="idle"}))}onMouseWheel(t){t.preventDefault(),this.handlePanoramaLevel()}onTouchStart(t){const{THREE:e}=Nd.getInstance(),n=t.touches.length,r=t.targetTouches.length;for(let r=0;r<Math.min(n,2);r++){const n=t.touches[r];this.touches.s[r]=new e.Vector2(n.clientX,n.clientY)}this.touches.state="down",r>1&&this.view.camera instanceof e.PerspectiveCamera&&(this.touches.state="zoom",this.touches.dist=this.touches.s[0].distanceTo(this.touches.s[1]),this.touches.fov=this.view.camera.fov)}onTouchMove(t){const{THREE:e}=Nd.getInstance();if(!(this.view.camera&&this.view.camera instanceof e.PerspectiveCamera))return;if("idle"===this.touches.state)return;t.preventDefault(),t.stopPropagation();const n=t.touches.length;for(let r=0;r<Math.min(n,2);r++){const n=t.touches[r];this.touches.c[r]=new e.Vector2(n.clientX,n.clientY)}"down"===this.touches.state&&this.touches.c[0].distanceToSquared(this.touches.s[0])>100?this.touches.state="move":"zoom"===this.touches.state&&this.handlePanoramaLevel(),"move"===this.touches.state&&this.onMouseDrag()}onTouchEnd(t){return M_(this,void 0,void 0,(function*(){if("idle"===this.touches.state)return;const{THREE:e}=Nd.getInstance();if("down"===this.touches.state&&this.view.renderer){const n=new e.Vector2(this.touches.s[0].x,this.touches.s[0].y),{clientWidth:r,clientHeight:i}=this.view.container,{left:o,top:s}=this.view.container.getBoundingClientRect(),a=n.x-o,u=n.y-s;if(this.raycaster.setFromCamera({x:a,y:u},this.view.camera),this.curPanoramaGroup){let n;n=this.onScreenDetectRadius>0&&this.view.camera?this.curPanoramaGroup.intersectIndicatorsOnScreen(new e.Vector2(a,u),this.onScreenDetectRadius,{screenWidth:r,screenHeight:i},this.view.camera):this.curPanoramaGroup.intersectIndicators(this.raycaster.ray.origin,this.raycaster.ray.direction),-1!==n&&(this.emit(Ud.CLICK_PANORAMA,n,t),this.moveOnClick&&this.curPanoramaGroup.currentPanoramaID!==n&&(yield this.moveToPanorama(n,{interval:1e3,showModel:!0,fadeInOut:!1})))}}this.touches.state="idle"}))}setLevels(t){this.levels=t}updateLevel(){if(!this.curPanorama)return;const{THREE:t}=Nd.getInstance(),e=this.view;if(e.camera){const{levels:n,levelMax:r}=this,{y:i}=(new t.Vector3).setFromMatrixScale(e.camera.projectionMatrix);let o=0,s=!1;for(let t=0;t<n.length;t++)if(i<n[t]){o=t,s=!0;break}s||(o=n.length),o>r&&(o=r);const a=this.curPanorama.levelMax;o>a&&(o=a),this.curPanorama.updateLevel(o),this.planeNeedUpdate=!0}}updateLevelMax(t){if(t!==this.levelMax){this.levelMax=t;for(let e=0;e<this.panoramaGroups.length;e++){this.panoramaGroups[e].updateLevelMax(t)}}}onMouseDrag(){this.planeNeedUpdate=!0}bindView(t){this.view=t,this.container=t.container,this.setEnabled(!0)}lookFromPanorama(t,e,n,r){return M_(this,void 0,void 0,(function*(){const i=yield this.showPanorama(t,{lookDirection:e,showModel:n,preInitPanoramasStrategy:r});i&&this.emit(Ud.MOVE_TO_PANORAMA,t,i?i.position:null,this.panoramaGroupChanged),this.panoramaGroupChanged=!1}))}showPanorama(t,e){return M_(this,void 0,void 0,(function*(){const{lookDirection:n,target:r,showModel:i,preInitPanoramasStrategy:o}=e||{},{pano:s,panoramaGroup:a}=this.getPanoramaOfPID(t);if(a){if(this.curPanoramaGroup!==a&&(this.panoramaGroupChanged=!0),this.curPanoramaGroup=a,a.modelElement&&this.setModelAppearance(a.modelElement,!1,void 0),o&&a.initializePanoramasIfNecessary(o),a.panoramaIDsAround(t),a.presentPanoramaIndicatorsAround(t,this.view),s){n?this.setCameraLookAt(s.position,n):r&&this.setCameraLookAt(s.position,r.clone().sub(s.position)),this.emit(Ud.WILL_LOAD_PANORAMA,s.pid),this.curPanorama&&this.panoramaUnmount(this.curPanorama),this.curPanorama=s,this.panoramaMount(this.curPanorama);if(!(yield a.presentPanoramaAround(t,this.view)))return;if(this.updateLevel(),void 0===i||!0===i){const t=this.getModelMaterial(),e=t.uniforms;e.pano0Matrix.value=s.matrix,e.pano0Position.value=s.position,e.pano1Matrix.value=s.matrix,e.pano1Position.value=s.position,e.weight0.value=1,e.weight1.value=0;const n=y_.instance.getCubeTextureByPid(s.pid);[e.pano0Map.value,e.pano1Map.value]=[n,n],this.setModelAppearance(a.modelElement,!0,t)}}return s}}))}setCameraLookAt(t,e){let n;const{THREE:r}=Nd.getInstance();n=e?e.clone().normalize():this.view.camera?this.view.camera.getWorldDirection(new r.Vector3(0,0,-1)):new r.Vector3(1,0,0);const i=n.multiplyScalar(E_.DirectionVectorScalar).add(t);this.setCameraPose(i,t)}getPanoramaOfPID(t){const e=this.pid2GroupMap.get(t);if(e){return{pano:e.getPanoramaByPID(t),panoramaGroup:e}}for(let e=0;e<this.panoramaGroups.length;e++){const n=this.panoramaGroups[e],r=n.getPanoramaByPID(t);if(r)return this.pid2GroupMap.set(t,n),{pano:r,panoramaGroup:n}}return{}}setCaptureMove(t){this.captureMove=t}moveToPanorama(t,e){return M_(this,void 0,void 0,(function*(){const n=e||{};return this.moveInPath([t],{queueIfBusy:!1,lookAtTargets:n.lookAtTarget,toDirections:n.toDirection,intervals:n.interval,fovs:n.fov,fadeInOuts:n.fadeInOut,easings:n.easing,freeRotation:!n.lookAtTarget,showModel:n.showModel})}))}moveToPanoramaSync(t,e){return M_(this,void 0,void 0,(function*(){const n=e||{};return this.moveInPath([t],{queueIfBusy:!0,lookAtTargets:n.lookAtTarget,toDirections:n.toDirection,intervals:n.interval,fovs:n.fov,fadeInOuts:n.fadeInOut,easings:n.easing,freeRotation:!n.lookAtTarget,showModel:n.showModel})}))}static getModelMesh(t){if(t&&t.modelElement)return w_.getModelMeshInElement(t.modelElement)}getModelMaterial(){if(this.modelMaterial)return this.modelMaterial;const{THREE:t}=Nd.getInstance(),e=w_.createModelUniforms();return this.modelMaterial=new t.ShaderMaterial({side:t.DoubleSide,vertexShader:w_.getModelVS(),fragmentShader:w_.getModelFS(),uniforms:e,name:"modelMaterial"}),this.modelMaterial}preloadCubeTexturesOfPIDs(t,e,n){return M_(this,void 0,void 0,(function*(){const r=t.map(t=>this.getPanoramaOfPID(t)).map(({pano:t})=>{if(t)return t.textureURLs});return Ab.sharedInstance.preloadCubeTextures(r,e,n)}))}getInstantTranslationMaterial(){if(this.instantTranslationMaterial)return this.instantTranslationMaterial;const{THREE:t}=Nd.getInstance(),e=w_.createInstantTranslationUniforms();return this.instantTranslationMaterial=new t.ShaderMaterial({side:t.DoubleSide,vertexShader:w_.getInstantTranslationVS(),fragmentShader:w_.getModelFS(),uniforms:e,name:"instantTranslationMaterial"}),this.instantTranslationMaterial}setModelAppearance(t,e,n,r){if(t)if(t.visible=e,t instanceof Yx)n&&t.addMeshMaterial(n);else{let e=r;e||(e=w_.getModelMeshInElement(t)),e&&n&&(e.material=n)}}moveInPath(t,e){return M_(this,void 0,void 0,(function*(){if(0===t.length)return;const{THREE:n}=Nd.getInstance(),r=[];t.map(t=>this.getPanoramaOfPID(t)).forEach(t=>{t.pano&&r.push(t.pano.position.clone())});const{toDirections:i,lookAtTargets:o,intervals:s,fovs:a,easings:u,fadeInOuts:c,queueIfBusy:l,showModel:h,freeRotation:p,rotateDelays:f}=e||{},d=void 0===h?this.showModel:!0===h;let g,m,v,y,x=-1,b=!1;const _=Ab.sharedInstance.getCapacity();let w,M,E;const S=t=>t,A=t=>t<.25?0:t>.75?1:2*(t-.25);let C;Array.isArray(c)?C=c.map(t=>t?A:S):!0===c&&(C=A),yield this.moveCameraInPath(r,{queueIfBusy:l,toDirections:i,lookAtTargets:o,intervals:s,fovs:a,easings:u,progressTransforms:C,freeRotation:p,rotateDelays:f,beforeAllMoves:()=>M_(this,void 0,void 0,(function*(){x=this.curPanoramaGroup?this.curPanoramaGroup.currentPanoramaID:-1,g=this.getModelMaterial(),m=g.uniforms,t.length>1&&this.emit(Ud.PATH_MOVEMENT_START,t)})),onOneMoveStart:(e,r,i,o,s,a)=>M_(this,void 0,void 0,(function*(){if(y=t[e],w=this.getPanoramaOfPID(x),M=this.getPanoramaOfPID(y),!(w.pano&&M.pano&&w.panoramaGroup&&M.panoramaGroup))return!1;w.modelMesh=E_.getModelMesh(w.panoramaGroup),M.modelMesh=E_.getModelMesh(M.panoramaGroup);const u=[x],l=new Set;l.add(x);for(let n=e;u.length<_&&n<t.length;n+=1)l.has(t[n])||(l.add(t[n]),u.push(t[n]));this.emit(Ud.WILL_MOVE_TO_PANORAMA,y,M.pano?M.pano.position:null);if(!(yield w.panoramaGroup.presentPanoramaAround(M.pano.pid,this.view)))return a.loadedError=!0,!1;if(this.emit(Ud.DID_LOAD_PANORAMA,M.pano.pid),x===y)return!1;Array.isArray(c)?c.length>e?b=c[e]:c.length>0&&(b=c[c.length-1]):c&&(b=c);const h=w.panoramaGroup!==M.panoramaGroup;if(h?(g=this.getInstantTranslationMaterial(),m=g.uniforms):(g=this.getModelMaterial(),m=g.uniforms),!h&&!d){const t=M.pano.position.distanceTo(w.pano.position),e=new n.BoxGeometry(5,2*(w.pano.position.z+.93),4*t);E=new n.Mesh(e,g),E.position.copy(w.pano.position),E.up.set(0,0,1),E.lookAt(M.pano.position),M.panoramaGroup.add(E)}if([M].forEach(({panoramaGroup:t,modelMesh:e})=>{e&&t&&(v=e.material,w.panoramaGroup===M.panoramaGroup?this.setModelAppearance(t.modelElement,d,g,e):this.setModelAppearance(t.modelElement,!1,g,e),t.setBoundBoxAppearance(g),t.addGroupViewConfiguration({targetView:this.view,showBoundBox:!0}))}),h){let t=new n.Vector3(0,1,0);this.view.camera&&(t=this.view.camera.up);const e=(new n.Matrix4).lookAt(i,r,t),a=(new n.Matrix4).lookAt(s,o,t);m.matrixT.value=e.multiply((new n.Matrix4).copy(a).invert())}m.pano0Matrix.value=w.pano.matrix,m.pano0Position.value=w.pano.position,m.pano1Matrix.value=M.pano.matrix,m.pano1Position.value=M.pano.position,m.weight0.value=1,m.weight1.value=0;const p=y_.instance.getCubeTextureByPid(w.pano.pid),f=y_.instance.getCubeTextureByPid(M.pano.pid);return m.pano0Map.value=p,m.pano1Map.value=f,this.panoramaUnmount(w.pano),h})),onOneMoveUpdate:(t,e)=>{if(x===y)return;w.panoramaGroup!==M.panoramaGroup?e<.5?(m.weight0.value=1-2*e,m.weight1.value=0):(m.weight1.value=2*e-1,m.weight0.value=0):b?e<.25?(m.weight0.value=1-4*e,m.weight1.value=0):e>.75?(m.weight1.value=4*e-3,m.weight0.value=0):(m.weight1.value=0,m.weight0.value=0):(m.weight0.value=1-e,m.weight1.value=e)},onOneMoveComplete:e=>M_(this,void 0,void 0,(function*(){w.modelMesh&&w.panoramaGroup&&w.panoramaGroup!==M.panoramaGroup&&(d||this.setModelAppearance(w.panoramaGroup.modelElement,!1,v,w.modelMesh),w.panoramaGroup.addGroupViewConfiguration({targetView:this.view,showBoundBox:!1})),M.panoramaGroup.remove(E),M.pano&&(this.curPanorama=M.pano,this.panoramaMount(this.curPanorama),this.updateCurPanoramTextureInfo(),this.updateLevel()),this.emit(Ud.MOVE_TO_PANORAMA,y,M.pano?M.pano.position:null,w.panoramaGroup!==M.panoramaGroup),this.panoramaGroupChanged=!1,e<t.length-1&&(x=t[e])})),afterAllMoves:()=>M_(this,void 0,void 0,(function*(){M.panoramaGroup.presentPanoramaIndicatorsAround(y,this.view),x!==y&&M&&w&&(M.modelMesh&&M.panoramaGroup&&(d||this.setModelAppearance(M.panoramaGroup.modelElement,!1,v,M.modelMesh),M.panoramaGroup.addGroupViewConfiguration({targetView:this.view,showBoundBox:!1})),M.panoramaGroup&&(this.curPanoramaGroup=M.panoramaGroup)),t.length>1&&this.emit(Ud.PATH_MOVEMENT_COMPLETED,t)}))})}))}moveCameraInPath(t,e){return M_(this,void 0,void 0,(function*(){if(!t||0===t.length)return;const{THREE:n}=Nd.getInstance(),{queueIfBusy:r=!1}=e||{};if(!r){if(this.isAnimating)return;this.isAnimating=!0}for(;this.translatePromise;)yield this.translatePromise;const i=new Promise(i=>M_(this,void 0,void 0,(function*(){const{beforeAllMoves:o,onOneMoveStart:s,onOneMoveUpdate:a,onOneMoveComplete:u,afterAllMoves:c}=e||{};let l=0;const h=()=>new Promise((r,i)=>M_(this,void 0,void 0,(function*(){if(!this.view.camera||this.cancelAnimation)return i(),void(this.cancelAnimation=!1);const{toDirections:o,lookAtTargets:c,intervals:h,fovs:p,easings:f,progressTransforms:d,freeRotation:g,rotateDelays:m}=e||{},y=this.basicController.getCameraTarget(),x=t[l],b=x.clone().sub(y);let _=x.clone();Array.isArray(c)?c.length>l?_=c[l].clone():c.length>0&&(_=c[c.length-1].clone()):c instanceof n.Vector3&&(_=c.clone());let w=0;m&&(Array.isArray(m)?m.length>l?w=m[l]:m.length>0&&(w=m[m.length-1]):w=m||0),c||!o?_.distanceToSquared(x)<1e-6?_=this.basicController.getCameraTarget().sub(this.view.camera.position):_.sub(x):Array.isArray(o)?o.length>l?_=o[l]:o.length>0&&(_=o[o.length-1]):o instanceof n.Vector3&&(_=o),_.normalize();const M=this.basicController.getCameraTarget().sub(this.view.camera.position).normalize(),E=(new n.Quaternion).setFromUnitVectors(this.view.camera.up,new n.Vector3(0,1,0)),S=E.clone().invert();M.applyQuaternion(E),_.applyQuaternion(E);const A=(new n.Spherical).setFromVector3(M),C=(new n.Spherical).setFromVector3(_),T=A.theta-C.theta;M.applyQuaternion(S),_.applyQuaternion(S);let P=60,I=60;if(this.view.camera instanceof n.PerspectiveCamera){const t=this.view.camera;I=t.fov,P=t.fov,Array.isArray(p)?p.length>l?P=p[l]:p.length>0&&(P=p[p.length-1]):p&&(P=p)}let L=1e3;Array.isArray(h)?h.length>l?L=h[l]:h.length>0&&(L=h[h.length-1]):h&&(L=h);let R,O=v.a.Easing.Linear.None;Array.isArray(f)?f.length>l?O=f[l]:f.length>0&&(O=f[f.length-1]):"function"==typeof f?O=f:0===l?(O=v.a.Easing.Quadratic.Out,l===t.length-1&&(O=v.a.Easing.Quadratic.InOut)):l===t.length-1&&(O=v.a.Easing.Quadratic.In),Array.isArray(d)?d.length>l?R=d[l]:d.length>0&&(R=d[d.length-1]):d&&(R=d);const D=x,B=_.clone().multiplyScalar(E_.DirectionVectorScalar).add(D),F=y,N=M.clone().multiplyScalar(E_.DirectionVectorScalar).add(F);let k=!1;if(s){const t={loadedError:!1};if(k=yield s(l,F,N,D,B,t),t.loadedError)return this.cancelAnimation=!0,void r()}const G=A.theta,U=Math.abs(T)>Math.PI?C.theta+Math.sign(T)*Math.PI*2:C.theta,z=A.phi,H=C.phi;new v.a.Tween({timer:0}).to({timer:L},L).easing(O).onStart(()=>{let t=k?B:N;const e=k?D:F;if(g){this.basicController.update();const n=this.basicController.getCameraTarget(),r=this.basicController.getCameraPosition();t=n.sub(r).normalize().multiplyScalar(E_.DirectionVectorScalar).add(e)}this.setCameraPose(t,e),this.renderThisFrame()}).onUpdate(({timer:t})=>{const e=t/L;let r=(t-w)/(L-w);r=O(Math.max(Math.min(r,1),0));const i=G+(U-G)*r,o=z+(H-z)*r,s=R?R(e):e;if(!k){const t=new n.Spherical(1,o,Math.abs(i)>Math.PI?i-Math.sign(i)*Math.PI*2:i);t.makeSafe();const e=(new n.Vector3).setFromSpherical(t).applyQuaternion(S),r=y.clone().addScaledVector(b,s);this.basicController.update();const a=this.basicController.getCameraTarget(),u=this.basicController.getCameraPosition(),c=a.sub(u).normalize(),l=M.clone().normalize(),h=c.distanceToSquared(l),p=(g&&h>1e-4?c:e).multiplyScalar(E_.DirectionVectorScalar).add(r);this.setCameraPose(p,r)}const u=I+s*(P-I);this.setFOV(u),a&&a(l,e,s),this.renderThisFrame()}).onComplete(()=>M_(this,void 0,void 0,(function*(){if(!k){const t=x;this.basicController.update();const e=this.basicController.getCameraTarget(),n=this.basicController.getCameraPosition(),r=e.sub(n).normalize(),i=(g?r:_).clone().multiplyScalar(E_.DirectionVectorScalar).add(t);this.setCameraPose(i,t)}this.renderThisFrame(),u&&(yield u(l)),r()}))).start()})));for(o&&(yield o());l<t.length&&!this.cancelAnimation;){const t=h();yield t,l+=1}this.cancelAnimation||c&&(yield c()),this.cancelAnimation=!1,this.translatePromise=void 0,r||(this.isAnimating=!1),i()})));this.translatePromise=i,yield i}))}setFOV(t){this.basicController&&(this.basicController.setFov(t),this.renderFrame=!0)}setFOVRange(t,e){this.basicController&&(this.basicController.setFovRange(t,e),this.renderFrame=!0)}setCameraPose(t,e,n=!0){this.basicController.setCameraPosition(t,!1),n&&this.basicController.setCameraLookAt(e),this.renderThisFrame()}renderThisFrame(){this.renderFrame||(this.renderFrame=!0)}deletePlane(t){this.planeMap.delete(t)}updatePanoramaTextureInfos(t,e){const n=new Map;for(let e=0;e<t.length;e++){const r=t[e].pfid;n.has(r)||n.set(r,new Map)}for(let t=0;t<e.length;t++){const r=e[t].pfid;n.has(r)||n.set(r,new Map)}this.updateCurPanoramTextureInfo(n)}updateCurPanoramTextureInfo(t){const{curPanorama:e}=this;if(e){const{textures:n,textureMap:r}=y_.instance,{tilePlanes:i}=e;let o;t?o=t:(o=new Map,i.forEach(t=>{o.set(t.pfid,new Map)})),r.forEach((t,e)=>{const{pfid:n}=t,r=o.get(n);r&&r.set(e,t)}),i.forEach(t=>{const{pfid:e}=t,r=o.get(e);r&&t.updateTextures(n,r)})}}deleteTextureInfos(t){t.tilePlanes.forEach(t=>{const{textureMap:e}=t;e.forEach(t=>{y_.instance.deleteTexture(t)})})}disposeTextureInfos(t){t&&t.tilePlanes.forEach(t=>{const e=t.textureMap;y_.instance.deteteTextureMap(e,!0)})}updateTexture(){return y_.instance.update()}updatePlaneInCamera(t){if(!this.curPanorama)return;const e=[];this.curPanorama.tilePlanes.forEach(n=>{const r=n.udpateInCamera(t);e.push(...r)});for(let t=0;t<e.length;t++){const n=e[t];n.isInCamera?y_.instance.addTexture(n):y_.instance.deleteTexture(n)}}panoramaeUpdate(t){return this.handlePanoramaUpdate(t)}update(){let t=!1;return(this.updateTexture()||this.planeNeedUpdate||this.renderFrame)&&(t=!0,this.renderFrame=!1),this.planeNeedUpdate&&(this.view&&this.panoramaeUpdate(this.view),this.planeNeedUpdate=!1),t}panoramaMount(t){t.mount(),this.emit(Ud.DID_LOAD_PANORAMA,t.pid)}panoramaUnmount(t){t.unMount(),y_.instance.deleteTexturesByPid(t.pid,!0)}dispose(){this.planeMap.clear(),this.setEnabled(!1),y_.instance.off(v_.TEXTURE_UPDATE,this.eventListeners.onTextureUpdate),this.curPanorama&&this.panoramaUnmount(this.curPanorama),this.modelMaterial&&this.modelMaterial.dispose(),this.instantTranslationMaterial&&this.instantTranslationMaterial.dispose(),Eb.disposeAll(),Ab.disposeAll(),super.dispose()}}E_.DirectionVectorScalar=-1e-4;n("wZ/5"),n("rOQg"),n("tCCV"),n("XMab"),n("moxL"),n("qXVe"),n("c162"),n("waxf"),n("0TkE"),n("Onu3"),n("1dYe"),n("gvgV"),n("6R/c"),n("YL0P"),n("X5Zq"),n("MoCz"),n("P8wP"),n("ypFw"),n("JaFt"),n("zSZm"),n("PF2M"),n("KVSy"),n("ZJ55"),n("IZzc"),n("Fwt+"),n("s5qe"),n("cvf0");function S_(t){return(S_="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})(t)}var A_=function(){var t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),e=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if("object"!==("undefined"==typeof WebAssembly?"undefined":S_(WebAssembly)))return{supported:!1};var n,r="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB";WebAssembly.validate(t)&&(r="B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",console.log("Warning: meshopt_decoder is using experimental SIMD support"));var i=WebAssembly.instantiate(function(t){for(var n=new Uint8Array(t.length),r=0;r<t.length;++r){var i=t.charCodeAt(r);n[r]=i>96?i-71:i>64?i-65:i>47?i+4:i>46?63:62}var o=0;for(r=0;r<t.length;++r)n[o++]=n[r]<60?e[n[r]]:64*(n[r]-60)+n[++r];return n.buffer.slice(0,o)}(r),{}).then((function(t){(n=t.instance).exports.__wasm_call_ctors()}));function o(t,e,r,i,o,s){var a=n.exports.sbrk,u=r+3&-4,c=a(u*i),l=a(o.length),h=new Uint8Array(n.exports.memory.buffer);h.set(o,l);var p=t(c,r,i,l,o.length);if(0==p&&s&&s(c,u,i),e.set(h.subarray(c,c+r*i)),a(c-a(0)),0!=p)throw new Error("Malformed buffer data: ".concat(p))}var s={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},a={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:i,supported:!0,decodeVertexBuffer:function(t,e,r,i,a){o(n.exports.meshopt_decodeVertexBuffer,t,e,r,i,n.exports[s[a]])},decodeIndexBuffer:function(t,e,r,i){o(n.exports.meshopt_decodeIndexBuffer,t,e,r,i)},decodeIndexSequence:function(t,e,r,i){o(n.exports.meshopt_decodeIndexSequence,t,e,r,i)},decodeGltfBuffer:function(t,e,r,i,u,c){o(n.exports[a[u]],t,e,r,i,n.exports[s[c]])}}}();n("SuFq");function C_(t){return(C_="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})(t)}function T_(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,P_(r.key),r)}}function P_(t){var e=function(t,e){if("object"!=C_(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=C_(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==C_(e)?e:e+""}var I_=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.events=new Map},(e=[{key:"on",value:function(t,e){if("function"==typeof e){var n=this.events.get(t)||new Set;n.add(e),this.events.set(t,n)}}},{key:"off",value:function(t,e){var n=this.events.get(t);null==n||n.delete(e)}},{key:"emit",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];var i=this.events.get(t);i&&i.forEach((function(t){"function"==typeof t&&t.apply(void 0,n)}))}},{key:"offAll",value:function(){this.events.clear()}}])&&T_(t.prototype,e),n&&T_(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function L_(t){return(L_="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})(t)}function R_(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */R_=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof m?e:m,s=Object.create(o.prototype),a=new P(r||[]);return i(s,"_invoke",{value:S(t,n,a)}),s}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",f="executing",d="completed",g={};function m(){}function v(){}function y(){}var x={};c(x,s,(function(){return this}));var b=Object.getPrototypeOf,_=b&&b(b(I([])));_&&_!==n&&r.call(_,s)&&(x=_);var w=y.prototype=m.prototype=Object.create(x);function M(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,o,s,a){var u=h(t[i],t,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==L_(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(l).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(u.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function S(e,n,r){var i=p;return function(o,s){if(i===f)throw Error("Generator is already running");if(i===d){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var u=A(a,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===p)throw i=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=f;var c=h(e,n,r);if("normal"===c.type){if(i=r.done?d:"suspendedYield",c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=d,r.method="throw",r.arg=c.arg)}}}function A(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,A(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=h(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function I(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(L_(e)+" is not iterable")}return v.prototype=y,i(w,"constructor",{value:y,configurable:!0}),i(y,"constructor",{value:v,configurable:!0}),v.displayName=c(y,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,c(t,u,"GeneratorFunction")),t.prototype=Object.create(w),t},e.awrap=function(t){return{__await:t}},M(E.prototype),c(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new E(l(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},M(w),c(w,u,"Generator"),c(w,s,(function(){return this})),c(w,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=I,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var u=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;T(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:I(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function O_(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function D_(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){O_(o,r,i,s,a,"next",t)}function a(t){O_(o,r,i,s,a,"throw",t)}s(void 0)}))}}function B_(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function F_(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,k_(r.key),r)}}function N_(t,e,n){return e&&F_(t.prototype,e),n&&F_(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function k_(t){var e=function(t,e){if("object"!=L_(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=L_(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==L_(e)?e:e+""}function G_(t,e,n){return e=U_(e),function(t,e){if(e&&("object"==L_(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}()?Reflect.construct(e,n||[],U_(t).constructor):e.apply(t,n))}function U_(t){return(U_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function z_(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&H_(t,e)}function H_(t,e){return(H_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}var V_=function(t){function e(){var t;return B_(this,e),(t=G_(this,e)).url=m.healthCheck.url||"https://robot-vr.aibee.cn/v1/health",t.thresholdValue=m.healthCheck.thresholdValue||300,t.timer=void 0,t}return z_(e,t),N_(e,[{key:"healthCheck",value:(r=D_(R_().mark((function t(){var e,n;return R_().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,e=this.url,n=this.thresholdValue,t.next=4,Zb()(e,{timeout:n});case 4:this.status=!0,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),this.status=!1;case 10:case"end":return t.stop()}}),t,this,[[0,7]])}))),function(){return r.apply(this,arguments)})},{key:"start",value:(n=D_(R_().mark((function t(){var e=this;return R_().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.healthCheck();case 2:return t.next=4,new Promise((function(t){return e.timer=setTimeout(t,m.healthCheck.frequency)}));case 4:return t.abrupt("return",this.start());case 5:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"stop",value:function(){this.timer&&(clearTimeout(this.timer),this.timer=void 0)}}]);var n,r}(function(t){function e(){var t;return B_(this,e),(t=G_(this,e))._status=!1,t.eventName="change-net-status",t}return z_(e,t),N_(e,[{key:"status",get:function(){return this._status},set:function(t){var e=!!t;e!==this._status&&this.emit(this.eventName,e),this._status=e}}])}(I_));function j_(t){return(j_="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})(t)}function W_(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,J_(r.key),r)}}function q_(t,e,n){return e=X_(e),function(t,e){if(e&&("object"==j_(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}()?Reflect.construct(e,n||[],X_(t).constructor):e.apply(t,n))}function X_(t){return(X_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Y_(t,e){return(Y_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function J_(t){var e=function(t,e){if("object"!=j_(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=j_(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==j_(e)?e:e+""}var K_,Q_=function(t){function e(){var t,n,r,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),t=q_(this,e),n=t,i=null,(r=J_(r="owllyVr"))in n?Object.defineProperty(n,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[r]=i,t.name=Object.getPrototypeOf(t).constructor.name,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Y_(t,e)}(e,t),n=e,(r=[{key:"registry",value:function(t){this.owllyVr=t}},{key:"dispose",value:function(){this.owllyVr=null}}])&&W_(n.prototype,r),i&&W_(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(I_);n("5DmW"),n("XUE8"),n("rB9j"),n("ENF9");class Z_ extends r.Object3D{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const{THREE:t}=Nd.getInstance(),e=new t.MeshBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,side:t.DoubleSide,fog:!1,toneMapped:!1}),n=new t.LineBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,linewidth:1,fog:!1,toneMapped:!1}),r=e.clone();r.opacity=.15;const i=e.clone();i.opacity=.33;const o=e.clone();o.color.set(16711680);const s=e.clone();s.color.set(65280);const a=e.clone();a.color.set(255);const u=e.clone();u.opacity=.25;const c=u.clone();c.color.set(16776960);const l=u.clone();l.color.set(65535);const h=u.clone();h.color.set(16711935);e.clone().color.set(16776960);const p=n.clone();p.color.set(16711680);const f=n.clone();f.color.set(65280);const d=n.clone();d.color.set(255);const g=n.clone();g.color.set(65535);const m=n.clone();m.color.set(16711935);const v=n.clone();v.color.set(16776960);const y=n.clone();y.color.set(7895160);const x=v.clone();x.opacity=.25;const b=new t.CylinderGeometry(0,.05,.2,12,1,!1),_=new t.BoxGeometry(.125,.125,.125),w=new t.BufferGeometry;w.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,0,0],3));const M=function(e,n){const r=new t.BufferGeometry,i=[];for(let t=0;t<=64*n;++t)i.push(0,Math.cos(t/32*Math.PI)*e,Math.sin(t/32*Math.PI)*e);return r.setAttribute("position",new t.Float32BufferAttribute(i,3)),r},E={X:[[new t.Mesh(b,o),[1,0,0],[0,0,-Math.PI/2],null,"fwd"],[new t.Mesh(b,o),[1,0,0],[0,0,Math.PI/2],null,"bwd"],[new t.Line(w,p)]],Y:[[new t.Mesh(b,s),[0,1,0],null,null,"fwd"],[new t.Mesh(b,s),[0,1,0],[Math.PI,0,0],null,"bwd"],[new t.Line(w,f),null,[0,0,Math.PI/2]]],Z:[[new t.Mesh(b,a),[0,0,1],[Math.PI/2,0,0],null,"fwd"],[new t.Mesh(b,a),[0,0,1],[-Math.PI/2,0,0],null,"bwd"],[new t.Line(w,d),null,[0,-Math.PI/2,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.1,0),u.clone()),[0,0,0],[0,0,0]]],XY:[[new t.Mesh(new t.PlaneGeometry(.295,.295),c.clone()),[.15,.15,0]],[new t.Line(w,v),[.18,.3,0],null,[.125,1,1]],[new t.Line(w,v),[.3,.18,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new t.Mesh(new t.PlaneGeometry(.295,.295),l.clone()),[0,.15,.15],[0,Math.PI/2,0]],[new t.Line(w,g),[0,.18,.3],[0,0,Math.PI/2],[.125,1,1]],[new t.Line(w,g),[0,.3,.18],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new t.Mesh(new t.PlaneGeometry(.295,.295),h.clone()),[.15,0,.15],[-Math.PI/2,0,0]],[new t.Line(w,m),[.18,0,.3],null,[.125,1,1]],[new t.Line(w,m),[.3,0,.18],[0,-Math.PI/2,0],[.125,1,1]]]},S={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,1,4,1,!1),r),[.6,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,1,4,1,!1),r),[0,.6,0]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,1,4,1,!1),r),[0,0,.6],[Math.PI/2,0,0]]],XYZ:[[new t.Mesh(new t.OctahedronGeometry(.2,0),r)]],XY:[[new t.Mesh(new t.PlaneGeometry(.4,.4),r),[.2,.2,0]]],YZ:[[new t.Mesh(new t.PlaneGeometry(.4,.4),r),[0,.2,.2],[0,Math.PI/2,0]]],XZ:[[new t.Mesh(new t.PlaneGeometry(.4,.4),r),[.2,0,.2],[-Math.PI/2,0,0]]]},A={START:[[new t.Mesh(new t.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],END:[[new t.Mesh(new t.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],DELTA:[[new t.Line(function(){const e=new t.BufferGeometry;return e.setAttribute("position",new t.Float32BufferAttribute([0,0,0,1,1,1],3)),e}(),i),null,null,null,"helper"]],X:[[new t.Line(w,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(w,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(w,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},C={X:[[new t.Line(M(1,.5),p)],[new t.Mesh(new t.OctahedronGeometry(.04,0),o),[0,0,.99],null,[1,3,1]]],Y:[[new t.Line(M(1,.5),f),null,[0,0,-Math.PI/2]],[new t.Mesh(new t.OctahedronGeometry(.04,0),s),[0,0,.99],null,[3,1,1]]],Z:[[new t.Line(M(1,.5),d),null,[0,Math.PI/2,0]],[new t.Mesh(new t.OctahedronGeometry(.04,0),a),[.99,0,0],null,[1,3,1]]],E:[[new t.Line(M(1.25,1),x),null,[0,Math.PI/2,0]],[new t.Mesh(new t.CylinderGeometry(.03,0,.15,4,1,!1),x),[1.17,0,0],[0,0,-Math.PI/2],[1,1,.001]],[new t.Mesh(new t.CylinderGeometry(.03,0,.15,4,1,!1),x),[-1.17,0,0],[0,0,Math.PI/2],[1,1,.001]],[new t.Mesh(new t.CylinderGeometry(.03,0,.15,4,1,!1),x),[0,-1.17,0],[Math.PI,0,0],[1,1,.001]],[new t.Mesh(new t.CylinderGeometry(.03,0,.15,4,1,!1),x),[0,1.17,0],[0,0,0],[1,1,.001]]],XYZE:[[new t.Line(M(1,1),y),null,[0,Math.PI/2,0]]]},T={AXIS:[[new t.Line(w,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},P={X:[[new t.Mesh(new t.TorusGeometry(1,.1,4,24),r),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new t.Mesh(new t.TorusGeometry(1,.1,4,24),r),[0,0,0],[Math.PI/2,0,0]]],Z:[[new t.Mesh(new t.TorusGeometry(1,.1,4,24),r),[0,0,0],[0,0,-Math.PI/2]]],E:[[new t.Mesh(new t.TorusGeometry(1.25,.1,2,24),r)]],XYZE:[[new t.Mesh(new t.SphereGeometry(.7,10,8),r)]]},I={X:[[new t.Mesh(_,o),[.8,0,0],[0,0,-Math.PI/2]],[new t.Line(w,p),null,null,[.8,1,1]]],Y:[[new t.Mesh(_,s),[0,.8,0]],[new t.Line(w,f),null,[0,0,Math.PI/2],[.8,1,1]]],Z:[[new t.Mesh(_,a),[0,0,.8],[Math.PI/2,0,0]],[new t.Line(w,d),null,[0,-Math.PI/2,0],[.8,1,1]]],XY:[[new t.Mesh(_,c),[.85,.85,0],null,[2,2,.2]],[new t.Line(w,v),[.855,.98,0],null,[.125,1,1]],[new t.Line(w,v),[.98,.855,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new t.Mesh(_,l),[0,.85,.85],null,[.2,2,2]],[new t.Line(w,g),[0,.855,.98],[0,0,Math.PI/2],[.125,1,1]],[new t.Line(w,g),[0,.98,.855],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new t.Mesh(_,h),[.85,0,.85],null,[2,.2,2]],[new t.Line(w,m),[.855,0,.98],null,[.125,1,1]],[new t.Line(w,m),[.98,0,.855],[0,-Math.PI/2,0],[.125,1,1]]],XYZX:[[new t.Mesh(new t.BoxGeometry(.125,.125,.125),u.clone()),[1.1,0,0]]],XYZY:[[new t.Mesh(new t.BoxGeometry(.125,.125,.125),u.clone()),[0,1.1,0]]],XYZZ:[[new t.Mesh(new t.BoxGeometry(.125,.125,.125),u.clone()),[0,0,1.1]]]},L={X:[[new t.Mesh(new t.CylinderGeometry(.2,0,.8,4,1,!1),r),[.5,0,0],[0,0,-Math.PI/2]]],Y:[[new t.Mesh(new t.CylinderGeometry(.2,0,.8,4,1,!1),r),[0,.5,0]]],Z:[[new t.Mesh(new t.CylinderGeometry(.2,0,.8,4,1,!1),r),[0,0,.5],[Math.PI/2,0,0]]],XY:[[new t.Mesh(_,r),[.85,.85,0],null,[3,3,.2]]],YZ:[[new t.Mesh(_,r),[0,.85,.85],null,[.2,3,3]]],XZ:[[new t.Mesh(_,r),[.85,0,.85],null,[3,.2,3]]],XYZX:[[new t.Mesh(new t.BoxGeometry(.2,.2,.2),r),[1.1,0,0]]],XYZY:[[new t.Mesh(new t.BoxGeometry(.2,.2,.2),r),[0,1.1,0]]],XYZZ:[[new t.Mesh(new t.BoxGeometry(.2,.2,.2),r),[0,0,1.1]]]},R={X:[[new t.Line(w,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new t.Line(w,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new t.Line(w,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},O=function(e){const n=new t.Object3D;for(const t in e)for(let r=e[t].length;r--;){const i=e[t][r][0].clone(),o=e[t][r][1],s=e[t][r][2],a=e[t][r][3],u=e[t][r][4];i.name=t,i.tag=u,o&&i.position.set(o[0],o[1],o[2]),s&&i.rotation.set(s[0],s[1],s[2]),a&&i.scale.set(a[0],a[1],a[2]),i.updateMatrix();const c=i.geometry.clone();c.applyMatrix4(i.matrix),i.geometry=c,i.renderOrder=1/0,i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),n.add(i)}return n},D=new t.Vector3(0,0,0),B=new t.Euler,F=new t.Vector3(0,1,0),N=new t.Vector3(0,0,0),k=new t.Matrix4,G=new t.Quaternion,U=new t.Quaternion,z=new t.Quaternion,H=new t.Vector3(1,0,0),V=new t.Vector3(0,1,0),j=new t.Vector3(0,0,1);this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=O(E)),this.add(this.gizmo.rotate=O(C)),this.add(this.gizmo.scale=O(I)),this.add(this.picker.translate=O(S)),this.add(this.picker.rotate=O(P)),this.add(this.picker.scale=O(L)),this.add(this.helper.translate=O(A)),this.add(this.helper.rotate=O(T)),this.add(this.helper.scale=O(R)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1,this.updateMatrixWorld=function(){let{space:e}=this;"scale"===this.mode&&(e="local");const n="local"===e?this.worldQuaternion:z;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode;let r=[];r=r.concat(this.picker[this.mode].children),r=r.concat(this.gizmo[this.mode].children),r=r.concat(this.helper[this.mode].children);for(let e=0;e<r.length;e++){const i=r[e];let o;if(i.visible=!0,i.rotation.set(0,0,0),i.position.copy(this.worldPosition),this.camera.isOrthographicCamera){const t=this.camera;o=(t.top-t.bottom)/t.zoom}else{const t=this.camera;o=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*t.fov/360)/t.zoom,7)}if(i.scale.set(1,1,1).multiplyScalar(o*this.size/7),"helper"!==i.tag){if(i.quaternion.copy(n),"translate"===this.mode||"scale"===this.mode){const t=.99,e=.2,r=0;"X"!==i.name&&"XYZX"!==i.name||Math.abs(F.copy(H).applyQuaternion(n).dot(this.eye))>t&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),"Y"!==i.name&&"XYZY"!==i.name||Math.abs(F.copy(V).applyQuaternion(n).dot(this.eye))>t&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),"Z"!==i.name&&"XYZZ"!==i.name||Math.abs(F.copy(j).applyQuaternion(n).dot(this.eye))>t&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),"XY"===i.name&&Math.abs(F.copy(j).applyQuaternion(n).dot(this.eye))<e&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),"YZ"===i.name&&Math.abs(F.copy(H).applyQuaternion(n).dot(this.eye))<e&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),"XZ"===i.name&&Math.abs(F.copy(V).applyQuaternion(n).dot(this.eye))<e&&(i.scale.set(1e-10,1e-10,1e-10),i.visible=!1),-1!==i.name.search("X")&&(F.copy(H).applyQuaternion(n).dot(this.eye)<r?"fwd"===i.tag?i.visible=!1:i.scale.x*=-1:"bwd"===i.tag&&(i.visible=!1)),-1!==i.name.search("Y")&&(F.copy(V).applyQuaternion(n).dot(this.eye)<r?"fwd"===i.tag?i.visible=!1:i.scale.y*=-1:"bwd"===i.tag&&(i.visible=!1)),-1!==i.name.search("Z")&&(F.copy(j).applyQuaternion(n).dot(this.eye)<r?"fwd"===i.tag?i.visible=!1:i.scale.z*=-1:"bwd"===i.tag&&(i.visible=!1))}else"rotate"===this.mode&&(U.copy(n),F.copy(this.eye).applyQuaternion(G.copy(n).invert()),-1!==i.name.search("E")&&i.quaternion.setFromRotationMatrix(k.lookAt(this.eye,N,V)),"X"===i.name&&(G.setFromAxisAngle(H,Math.atan2(-F.y,F.z)),G.multiplyQuaternions(U,G),i.quaternion.copy(G)),"Y"===i.name&&(G.setFromAxisAngle(V,Math.atan2(F.x,F.z)),G.multiplyQuaternions(U,G),i.quaternion.copy(G)),"Z"===i.name&&(G.setFromAxisAngle(j,Math.atan2(F.y,F.x)),G.multiplyQuaternions(U,G),i.quaternion.copy(G)));i.visible=i.visible&&(-1===i.name.indexOf("X")||this.showX),i.visible=i.visible&&(-1===i.name.indexOf("Y")||this.showY),i.visible=i.visible&&(-1===i.name.indexOf("Z")||this.showZ),i.visible=i.visible&&(-1===i.name.indexOf("E")||this.showX&&this.showY&&this.showZ),i.material._opacity=i.material._opacity||i.material.opacity,i.material._color=i.material._color||i.material.color.clone(),i.material.color.copy(i.material._color),i.material.opacity=i.material._opacity,this.enabled?this.axis&&(i.name===this.axis||this.axis.split("").some(t=>i.name===t)?(i.material.opacity=1,i.material.color.lerp(new t.Color(1,1,1),.5)):(i.material.opacity*=.25,i.material.color.lerp(new t.Color(1,1,1),.5))):(i.material.opacity*=.5,i.material.color.lerp(new t.Color(1,1,1),.5))}else i.visible=!1,"AXIS"===i.name?(i.position.copy(this.worldPositionStart),i.visible=!!this.axis,"X"===this.axis&&(G.setFromEuler(B.set(0,0,0)),i.quaternion.copy(n).multiply(G),Math.abs(F.copy(H).applyQuaternion(n).dot(this.eye))>.9&&(i.visible=!1)),"Y"===this.axis&&(G.setFromEuler(B.set(0,0,Math.PI/2)),i.quaternion.copy(n).multiply(G),Math.abs(F.copy(V).applyQuaternion(n).dot(this.eye))>.9&&(i.visible=!1)),"Z"===this.axis&&(G.setFromEuler(B.set(0,Math.PI/2,0)),i.quaternion.copy(n).multiply(G),Math.abs(F.copy(j).applyQuaternion(n).dot(this.eye))>.9&&(i.visible=!1)),"XYZE"===this.axis&&(G.setFromEuler(B.set(0,Math.PI/2,0)),F.copy(this.rotationAxis),i.quaternion.setFromRotationMatrix(k.lookAt(N,F,V)),i.quaternion.multiply(G),i.visible=this.dragging),"E"===this.axis&&(i.visible=!1)):"START"===i.name?(i.position.copy(this.worldPositionStart),i.visible=this.dragging):"END"===i.name?(i.position.copy(this.worldPosition),i.visible=this.dragging):"DELTA"===i.name?(i.position.copy(this.worldPositionStart),i.quaternion.copy(this.worldQuaternionStart),D.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),D.applyQuaternion(this.worldQuaternionStart.clone().invert()),i.scale.copy(D),i.visible=this.dragging):(i.quaternion.copy(n),this.dragging?i.position.copy(this.worldPositionStart):i.position.copy(this.worldPosition),this.axis&&(i.visible=-1!==this.axis.search(i.name)))}t.Object3D.prototype.updateMatrixWorld.call(this)}}}class $_ extends r.Mesh{constructor(){super(new(Nd.getInstance().THREE.PlaneGeometry)(1e5,1e5,2,2),new(Nd.getInstance().THREE.MeshBasicMaterial)({visible:!1,wireframe:!0,side:Nd.getInstance().THREE.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0;const{THREE:t}=Nd.getInstance(),e=new t.Vector3(1,0,0),n=new t.Vector3(0,1,0),r=new t.Vector3(0,0,1),i=new t.Vector3,o=new t.Vector3,s=new t.Vector3,a=new t.Matrix4,u=new t.Quaternion;this.updateMatrixWorld=function(){let{space:c}=this;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(c="local"),e.set(1,0,0).applyQuaternion("local"===c?this.worldQuaternion:u),n.set(0,1,0).applyQuaternion("local"===c?this.worldQuaternion:u),r.set(0,0,1).applyQuaternion("local"===c?this.worldQuaternion:u),s.copy(n),this.mode){case"translate":case"scale":switch(this.axis){case"X":s.copy(this.eye).cross(e),o.copy(e).cross(s);break;case"Y":s.copy(this.eye).cross(n),o.copy(n).cross(s);break;case"Z":s.copy(this.eye).cross(r),o.copy(r).cross(s);break;case"XY":o.copy(r);break;case"YZ":o.copy(e);break;case"XZ":s.copy(r),o.copy(n);break;case"XYZ":case"E":o.set(0,0,0)}break;case"rotate":default:o.set(0,0,0)}0===o.length()?this.quaternion.copy(this.cameraQuaternion):(a.lookAt(i.set(0,0,0),o,s),this.quaternion.setFromRotationMatrix(a)),t.Object3D.prototype.updateMatrixWorld.call(this)}}}class tw extends r.Object3D{constructor(t,e){super(),void 0===e&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),e=document),this.visible=!1,this.domElement=e;const n=new Z_;this.add(n);const r=new $_;this.add(r);const i=this,o={type:"change"},s={type:"mouseDown"},a={type:"mouseUp",mode:i.mode},u={type:"objectChange"};function c(t,e){let s=e;Object.defineProperty(i,t,{get:()=>void 0!==s?s:e,set(e){s!==e&&(s=e,r[t]=e,n[t]=e,i.dispatchEvent({type:t+"-changed",value:e}),i.dispatchEvent(o))}}),i[t]=e,r[t]=e,n[t]=e}const{THREE:l}=Nd.getInstance();function h(t,e,n){const r=e.intersectObject(t,!0);for(let t=0;t<r.length;t++)if(r[t].object.visible||n)return r[t];return!1}c("camera",t),c("object",void 0),c("enabled",!0),c("axis",null),c("mode","translate"),c("translationSnap",null),c("rotationSnap",null),c("scaleSnap",null),c("space","world"),c("size",1),c("dragging",!1),c("showX",!0),c("showY",!0),c("showZ",!0);const p=new l.Raycaster,f=new l.Vector3,d=new l.Vector3,g=new l.Quaternion,m={X:new l.Vector3(1,0,0),Y:new l.Vector3(0,1,0),Z:new l.Vector3(0,0,1)},v=new l.Vector3,y=new l.Vector3,x=new l.Vector3,b=new l.Vector3,_=new l.Vector3,w=new l.Vector3;let M=0;const E=new l.Vector3,S=new l.Quaternion,A=new l.Vector3,C=new l.Vector3,T=new l.Quaternion,P=new l.Quaternion,I=new l.Vector3,L=new l.Vector3,R=new l.Quaternion,O=new l.Vector3,D=new l.Vector3,B=new l.Quaternion,F=new l.Quaternion,N=new l.Vector3,k=new l.Vector3,G=new l.Vector3,U=new l.Quaternion,z=new l.Vector3;function H(t){if(i.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:t.button};const n=t.changedTouches?t.changedTouches[0]:t,r=e.getBoundingClientRect();return{x:(n.clientX-r.left)/r.width*2-1,y:-(n.clientY-r.top)/r.height*2+1,button:t.button}}function V(t){if(i.enabled)switch(t.pointerType){case"mouse":case"pen":i.pointerHover(H(t))}}function j(t){i.enabled&&i.pointerMove(H(t))}function W(t){i.enabled&&(i.domElement.style.touchAction="none",i.domElement.ownerDocument.addEventListener("pointermove",j),i.pointerHover(H(t)),i.pointerDown(H(t)))}function q(t){i.enabled&&(i.domElement.style.touchAction="",i.domElement.ownerDocument.removeEventListener("pointermove",j),i.pointerUp(H(t)))}c("worldPosition",D),c("worldPositionStart",L),c("worldQuaternion",B),c("worldQuaternionStart",R),c("cameraPosition",E),c("cameraQuaternion",S),c("pointStart",v),c("pointEnd",y),c("rotationAxis",b),c("rotationAngle",M),c("eye",k),e.addEventListener("pointerdown",W),e.addEventListener("pointermove",V),i.domElement.ownerDocument.addEventListener("pointerup",q),this.dispose=function(){e.removeEventListener("pointerdown",W),e.removeEventListener("pointermove",V),i.domElement.ownerDocument.removeEventListener("pointermove",j),i.domElement.ownerDocument.removeEventListener("pointerup",q),this.traverse(t=>{t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()}),i.domElement=null},this.attach=function(t){return this.object=t,this.visible=!0,this},this.detach=function(){return this.object=void 0,this.visible=!1,this.axis=null,this},this.updateMatrixWorld=function(){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(C,T,I),this.object.matrixWorld.decompose(D,B,N),P.copy(T).invert(),F.copy(B).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(E,S,A),k.copy(E).sub(D).normalize(),l.Object3D.prototype.updateMatrixWorld.call(this)},this.pointerHover=function(t){if(void 0===this.object||!0===this.dragging)return;p.setFromCamera(t,this.camera);const e=h(n.picker[this.mode],p);this.axis=e?e.object.name:null},this.pointerDown=function(t){if(void 0!==this.object&&!0!==this.dragging&&0===t.button&&null!==this.axis){p.setFromCamera(t,this.camera);const e=h(r,p,!0);if(e){let{space:t}=this;if("scale"===this.mode?t="local":"E"!==this.axis&&"XYZE"!==this.axis&&"XYZ"!==this.axis||(t="world"),"local"===t&&"rotate"===this.mode){const t=this.rotationSnap;"X"===this.axis&&t&&(this.object.rotation.x=Math.round(this.object.rotation.x/t)*t),"Y"===this.axis&&t&&(this.object.rotation.y=Math.round(this.object.rotation.y/t)*t),"Z"===this.axis&&t&&(this.object.rotation.z=Math.round(this.object.rotation.z/t)*t)}this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),G.copy(this.object.position),U.copy(this.object.quaternion),z.copy(this.object.scale),this.object.matrixWorld.decompose(L,R,O),v.copy(e.point).sub(L)}this.dragging=!0,s.mode=this.mode,this.dispatchEvent(s)}},this.pointerMove=function(t){const{axis:e}=this,{mode:n}=this,{object:i}=this;let{space:s}=this;if("scale"===n?s="local":"E"!==e&&"XYZE"!==e&&"XYZ"!==e||(s="world"),void 0===i||null===e||!1===this.dragging||-1!==t.button)return;p.setFromCamera(t,this.camera);const a=h(r,p,!0);if(a){if(y.copy(a.point).sub(L),"translate"===n)x.copy(y).sub(v),"local"===s&&"XYZ"!==e&&x.applyQuaternion(F),-1===e.indexOf("X")&&(x.x=0),-1===e.indexOf("Y")&&(x.y=0),-1===e.indexOf("Z")&&(x.z=0),"local"===s&&"XYZ"!==e?x.applyQuaternion(U).divide(I):x.applyQuaternion(P).divide(I),i.position.copy(x).add(G),this.translationSnap&&("local"===s&&(i.position.applyQuaternion(g.copy(U).invert()),-1!==e.search("X")&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),-1!==e.search("Y")&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),-1!==e.search("Z")&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(U)),"world"===s&&(i.parent&&i.position.add(f.setFromMatrixPosition(i.parent.matrixWorld)),-1!==e.search("X")&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),-1!==e.search("Y")&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),-1!==e.search("Z")&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(f.setFromMatrixPosition(i.parent.matrixWorld))));else if("scale"===n){if(-1!==e.search("XYZ")){let t=y.length()/v.length();y.dot(v)<0&&(t*=-1),d.set(t,t,t)}else f.copy(v),d.copy(y),f.applyQuaternion(F),d.applyQuaternion(F),d.divide(f),-1===e.search("X")&&(d.x=1),-1===e.search("Y")&&(d.y=1),-1===e.search("Z")&&(d.z=1);i.scale.copy(z).multiply(d),this.scaleSnap&&(-1!==e.search("X")&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==e.search("Y")&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==e.search("Z")&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if("rotate"===n){x.copy(y).sub(v);const t=20/D.distanceTo(f.setFromMatrixPosition(this.camera.matrixWorld));"E"===e?(b.copy(k),M=y.angleTo(v),_.copy(v).normalize(),w.copy(y).normalize(),M*=w.cross(_).dot(k)<0?1:-1):"XYZE"===e?(b.copy(x).cross(k).normalize(),M=x.dot(f.copy(b).cross(this.eye))*t):"X"!==e&&"Y"!==e&&"Z"!==e||(b.copy(m[e]),f.copy(m[e]),"local"===s&&f.applyQuaternion(B),M=x.dot(f.cross(k).normalize())*t),this.rotationSnap&&(M=Math.round(M/this.rotationSnap)*this.rotationSnap),this.rotationAngle=M,"local"===s&&"E"!==e&&"XYZE"!==e?(i.quaternion.copy(U),i.quaternion.multiply(g.setFromAxisAngle(b,M)).normalize()):(b.applyQuaternion(P),i.quaternion.copy(g.setFromAxisAngle(b,M)),i.quaternion.multiply(U).normalize())}this.dispatchEvent(o),this.dispatchEvent(u)}},this.pointerUp=function(t){0===t.button&&(this.dragging&&null!==this.axis&&(a.mode=this.mode,this.dispatchEvent(a)),this.dragging=!1,this.axis=null)},this.getMode=function(){return i.mode},this.setMode=function(t){i.mode=t},this.setTranslationSnap=function(t){i.translationSnap=t},this.setScaleSnap=function(t){i.scaleSnap=t},this.setRotationSnap=function(t){i.rotationSnap=t},this.setSize=function(t){i.size=t},this.setSpace=function(t){i.space=t},this.update=function(){console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}}}!function(t){t[t.IDLE=0]="IDLE",t[t.DOWN=1]="DOWN",t[t.MOVE=2]="MOVE"}(K_||(K_={}));class ew extends tw{constructor(t,e,n){super(e,n),this.bindingView=t,this.visibilityMap=new Map,this.pointerDownSuper=this.pointerDown,this.pointerHoverSuper=this.pointerHover,this.pointerMoveSuper=this.pointerMove,this.pointerUpSuper=this.pointerUp,this.disposeSuper=this.dispose,this.pointerDown=function(t){const{showX:e,showY:n,showZ:r}=this,{showX:i,showY:o,showZ:s}=this.visibilityMap.get(this.bindingView);this.showX=i,this.showY=o,this.showZ=s,this.object&&this.object.parent&&this.updateMatrixWorld(),this.pointerDownSuper(t),this.showX=e,this.showY=n,this.showZ=r,this.object&&this.object.parent&&this.updateMatrixWorld()},this.pointerHover=function(t){const{showX:e,showY:n,showZ:r}=this,{showX:i,showY:o,showZ:s}=this.visibilityMap.get(this.bindingView);this.showX=i,this.showY=o,this.showZ=s,this.object&&this.object.parent&&this.updateMatrixWorld(),this.pointerHoverSuper(t),this.showX=e,this.showY=n,this.showZ=r,this.object&&this.object.parent&&this.updateMatrixWorld()},this.pointerMove=function(t){const{showX:e,showY:n,showZ:r}=this,{showX:i,showY:o,showZ:s}=this.visibilityMap.get(this.bindingView);this.showX=i,this.showY=o,this.showZ=s,this.object&&this.object.parent&&this.updateMatrixWorld(),this.pointerMoveSuper(t),this.showX=e,this.showY=n,this.showZ=r,this.object&&this.object.parent&&this.updateMatrixWorld()},this.pointerUp=function(t){const{showX:e,showY:n,showZ:r}=this,{showX:i,showY:o,showZ:s}=this.visibilityMap.get(this.bindingView);this.showX=i,this.showY=o,this.showZ=s,this.object&&this.object.parent&&this.updateMatrixWorld(),this.pointerUpSuper(t),this.showX=e,this.showY=n,this.showZ=r,this.object&&this.object.parent&&this.updateMatrixWorld()},this.dispose=function(){this.visibilityMap.clear(),this.disposeSuper()}}updateViewVisibilitySettings(t,e){e?this.visibilityMap.set(e,t):this.visibilityMap.forEach((e,n)=>{this.visibilityMap.set(n,t)})}getViewVisibilitySettings(t){return this.visibilityMap.get(t)}removeViewVisibilitySettings(t){this.visibilityMap.delete(t)}}class nw extends Xb{constructor(t){super();const{THREE:e}=Nd.getInstance();this.mouseState=K_.IDLE,this.mouseEventHandlers={onPointerDown:t=>{this.onPointerDown(t)},onPointerMove:t=>{this.onPointerMove(t)},onPointerUp:t=>{this.onPointerUp(t)}},this.touchEventHandlers={onTouchStart:t=>{this.onTouchStart(t)},onTouchMove:t=>{this.onTouchMove(t)},onTouchEnd:()=>{this.onTouchEnd()}},this.selectableElements=new Set,this.selectableElementsOnScreen=new Set,this.elementResponseDistance2D=30,this.elementWorldDetectionDistance=-1,this.onScreenElementWorldDetectionDistance=13,this.mousePositionBuffer=new e.Vector2,this.detectOnMove=!1,this.bindView(t)}registerPointerEvents(t){t.addEventListener("pointerdown",this.mouseEventHandlers.onPointerDown),t.addEventListener("pointermove",this.mouseEventHandlers.onPointerMove),t.addEventListener("pointerup",this.mouseEventHandlers.onPointerUp),t.addEventListener("touchstart",this.touchEventHandlers.onTouchStart),t.addEventListener("touchmove",this.touchEventHandlers.onTouchMove),t.addEventListener("touchend",this.touchEventHandlers.onTouchEnd)}unregisterPointerEvents(t){t.removeEventListener("pointerdown",this.mouseEventHandlers.onPointerDown),t.removeEventListener("pointermove",this.mouseEventHandlers.onPointerMove),t.removeEventListener("pointerup",this.mouseEventHandlers.onPointerUp),t.removeEventListener("touchstart",this.touchEventHandlers.onTouchStart),t.removeEventListener("touchmove",this.touchEventHandlers.onTouchMove),t.removeEventListener("touchend",this.touchEventHandlers.onTouchEnd)}snapActiveElement(t,e,n,r){if("snap"!==this.controlMode||!this.activeElement||!this.snapToObject)return!1;const{THREE:i}=Nd.getInstance(),o=new i.Raycaster;o.setFromCamera({x:2*t/n-1,y:1-2*e/r},this.view.camera);const s=o.intersectObject(this.snapToObject,!0);return s&&s.length>0&&(s.sort((t,e)=>t.distance-e.distance),this.activeElement.position.copy(s[0].point),this.emit(Ud.ELEMENT_POSITION_UPDATED,this.activeElement.position.clone(),this.activeElement,this.view)),!0}onPointerDown(t){if("mouse"!==t.pointerType)return;this.mouseState=K_.DOWN,this.button=t.button;const{clientX:e,clientY:n}=t,{clientWidth:r,clientHeight:i}=this.view.container,{left:o,top:s}=this.view.container.getBoundingClientRect(),a=e-o,u=n-s,{THREE:c}=Nd.getInstance();if(this.mousePositionBuffer.set(a,u),"collision"===this.controlMode){const t=new c.Raycaster;if(t.setFromCamera({x:2*a/r-1,y:1-2*u/i},this.view.camera),this.snapToObject instanceof Yx){const e=this.snapToObject.intersectRay(t.ray.origin,t.ray.direction,!0);if(e&&e.length){const n=e[0],r={distance:n.intersectionPoint.distanceTo(t.ray.origin),point:n.intersectionPoint,object:this.snapToObject};this.selectedElement=this.snapToObject,this.selectedElementIntersection=r}}else{const e=t.intersectObject(this.snapToObject,!0);e&&e.length>0&&(e.sort((t,e)=>t.distance-e.distance),this.selectedElement=this.snapToObject,[this.selectedElementIntersection]=e)}}if(this.snapActiveElement(a,u,r,i))return;let l=Array.from(this.selectableElementsOnScreen);const h=new Map;l.forEach(t=>{if(t instanceof cb&&t.isDomElement){const e=t.getSize();h.set(t,[e[0],e[1]])}});const p=ky.getMouseIntersectionOnScreen(l,{x:a,y:u},{screenWidth:r,screenHeight:i},2*this.elementResponseDistance2D,this.view.camera,l,this.onScreenElementWorldDetectionDistance,h);if(p&&p instanceof eg)return this.mouseState=K_.DOWN,this.selectedElement=p,void(this.selectedElementIntersection=ky.getMouseIntersection([p],{x:2*a/r-1,y:1-2*u/i},this.view.camera,l,this.elementWorldDetectionDistance));l=Array.from(this.selectableElements);const f=ky.getMouseIntersection(l,{x:2*a/r-1,y:1-2*u/i},this.view.camera,l,this.elementWorldDetectionDistance);f&&f.object instanceof eg&&(this.mouseState=K_.DOWN,this.selectedElement=f.object,this.selectedElementIntersection=f)}onPointerMove(t){if("mouse"!==t.pointerType)return;if(this.mouseState!==K_.DOWN&&this.mouseState!==K_.MOVE&&!this.detectOnMove)return;const{clientX:e,clientY:n}=t,{clientWidth:r,clientHeight:i}=this.view.container,{left:o,top:s}=this.view.container.getBoundingClientRect(),a=e-o,u=n-s,{THREE:c}=Nd.getInstance(),l=new c.Vector2(a,u).distanceToSquared(this.mousePositionBuffer);if(this.mouseState===K_.DOWN&&l>100&&(this.mouseState=K_.MOVE),this.snapActiveElement(a,u,r,i),"collision"===this.controlMode&&(this.mouseState===K_.MOVE||this.detectOnMove)){const t=new c.Raycaster;if(t.setFromCamera({x:2*a/r-1,y:1-2*u/i},this.view.camera),this.snapToObject instanceof Yx){const e=this.snapToObject.intersectRay(t.ray.origin,t.ray.direction,!0);if(e&&e.length){const n=e[0],r={distance:n.intersectionPoint.distanceTo(t.ray.origin),point:n.intersectionPoint,object:this.snapToObject};this.emit(Ud.ELEMENT_SELECTED,this.snapToObject,r)}}else{const e=t.intersectObject(this.snapToObject,!0);e&&e.length>0&&(e.sort((t,e)=>t.distance-e.distance),this.emit(Ud.ELEMENT_SELECTED,this.snapToObject,e[0]))}}}onPointerUp(t){"mouse"!==t.pointerType||this.transformActivated||(this.mouseState===K_.DOWN&&this.emit(Ud.ELEMENT_SELECTED,this.selectedElement,this.selectedElementIntersection,this.button),this.mouseState=K_.IDLE,this.selectedElement=null,this.selectedElementIntersection=null)}onTouchStart(t){this.mouseState=K_.DOWN;const{clientX:e,clientY:n}=t.touches[0],{clientWidth:r,clientHeight:i}=this.view.container,{left:o,top:s}=this.view.container.getBoundingClientRect(),a=e-o,u=n-s;if(this.mousePositionBuffer.set(a,u),this.snapActiveElement(a,u,r,i))return;let c=Array.from(this.selectableElementsOnScreen);const l=new Map;c.forEach(t=>{if(t instanceof cb&&t.isDomElement){const e=t.getSize();l.set(t,[e[0],e[1]])}});const h=ky.getMouseIntersectionOnScreen(c,{x:a,y:u},{screenWidth:r,screenHeight:i},2*this.elementResponseDistance2D,this.view.camera,c,this.onScreenElementWorldDetectionDistance,l);if(h&&h instanceof eg)return this.mouseState=K_.DOWN,this.selectedElement=h,void(this.selectedElementIntersection=ky.getMouseIntersection([h],{x:2*a/r-1,y:1-2*u/i},this.view.camera,c,this.elementWorldDetectionDistance));c=Array.from(this.selectableElements);const p=ky.getMouseIntersection(c,{x:2*a/r-1,y:1-2*u/i},this.view.camera,c,this.elementWorldDetectionDistance);p&&p.object instanceof eg&&(this.mouseState=K_.DOWN,this.selectedElement=p.object,this.selectedElementIntersection=p)}onTouchMove(t){if(this.mouseState!==K_.DOWN)return;const{clientX:e,clientY:n}=t.touches[0],{clientWidth:r,clientHeight:i}=this.view.container,{left:o,top:s}=this.view.container.getBoundingClientRect(),a=e-o,u=n-s,{THREE:c}=Nd.getInstance();new c.Vector2(a,u).distanceToSquared(this.mousePositionBuffer)>100&&(this.mouseState=K_.MOVE),this.snapActiveElement(a,u,r,i)}onTouchEnd(){this.mouseState===K_.DOWN&&this.emit(Ud.ELEMENT_SELECTED,this.selectedElement,this.selectedElementIntersection),this.mouseState=K_.IDLE,this.selectedElement=null,this.selectedElementIntersection=null}unbind(){super.unbind(),this.scene.remove(this.transformControl),this.transformControl.dispose(),this.unregisterPointerEvents(this.view.container)}update(){const t=!!this.renderFrame;return this.renderFrame=!1,t}bindView(t){if(!t.camera||!t.renderer)throw new Error("No Camera or Renderer found in view");this.view=t,this.transformControl=new ew(t,t.camera,t.container),this.transformControl.addEventListener("objectChange",()=>{this.emit(zd.ELEMENT_POSITION_UPDATED,this.activeElement.position.clone(),this.activeElement,this.view)}),this.transformControl.addEventListener("change",()=>{this.renderFrame=!0}),this.transformControl.addEventListener("mouseUp",()=>{const t=this.controlMode;"translate"===t?this.emit(Ud.ELEMENT_POSITION_UPDATED,this.activeElement.position.clone(),this.activeElement):"rotate"===t&&this.emit(Ud.ELEMENT_POSE_UPDATED,this.activeElement.quaternion.clone(),this.activeElement),this.transformActivated=!1,this.emit(Ud.TRANSFORM_DEACTIVATED)}),this.transformControl.addEventListener("mouseDown",()=>{this.transformActivated=!0,this.emit(Ud.TRANSFORM_ACTIVATED)}),this.registerPointerEvents(t.container),this.controlMode=this.transformControl.getMode(),this.transformControl.updateViewVisibilitySettings({showX:!0,showY:!0,showZ:!0},t)}renderingViewChanged(t){const e=this.transformControl.getViewVisibilitySettings(t)||this.transformControl.getViewVisibilitySettings(this.view);if(!e)return;const{showX:n,showY:r,showZ:i}=e;this.transformControl.showX=n,this.transformControl.showY=r,this.transformControl.showZ=i}initWithScene(t){this.scene=t,this.scene.add(this.transformControl)}attach(t){this.activeElement&&this.transformControl.detach(),this.activeElement=t,this.transformControl.attach(this.activeElement)}detach(){this.setMode("translate"),this.mouseState=K_.IDLE,this.transformControl.detach()}getMode(){return this.controlMode}setMode(t,e,n=!1){this.controlMode=t,"snap"===t||"collision"===t?e&&(this.snapToObject=e,this.transformControl.detach()):(this.activeElement&&this.transformControl.attach(this.activeElement),this.transformControl.setMode(t)),this.detectOnMove=n}setSize(t){this.transformControl.setSize(t)}setStickVisibility(t,e,n,r){this.transformControl.updateViewVisibilitySettings({showX:t,showY:e,showZ:n},r)}setTransitionSnap(t){this.transformControl.setTranslationSnap(t)}setRotationSnap(t){this.transformControl.setRotationSnap(t)}setEnabled(t){this.transformControl.enabled=t,t?(this.unregisterPointerEvents(this.view.container),this.registerPointerEvents(this.view.container)):this.unregisterPointerEvents(this.view.container)}bindElement(t,e){!0===e?Array.isArray(t)?t.forEach(t=>{this.selectableElementsOnScreen.add(t)}):this.selectableElementsOnScreen.add(t):Array.isArray(t)?t.forEach(t=>{this.selectableElements.add(t)}):this.selectableElements.add(t)}unbindElement(t){Array.isArray(t)?t.forEach(t=>{t===this.activeElement&&this.detach(),this.selectableElements.delete(t),this.selectableElementsOnScreen.delete(t)}):(t===this.activeElement&&this.detach(),this.selectableElements.delete(t),this.selectableElementsOnScreen.delete(t))}set2DElementDetectionRadius(t){this.elementResponseDistance2D=t}setElementWorldDetectionDistance(t){this.elementWorldDetectionDistance=t}setOnScreenElementWorldDetectionDistance(t){this.onScreenElementWorldDetectionDistance=t}}var rw=n("LvDl");function iw(t){return(iw="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})(t)}function ow(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,sw(r.key),r)}}function sw(t){var e=function(t,e){if("object"!=iw(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=iw(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==iw(e)?e:e+""}var aw=function(){return function(t,e,n){return e&&ow(t.prototype,e),n&&ow(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}((function t(e,n){var r,i,o,s=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),r=this,i="onElementSelected",o=Object(rw.throttle)((function(t){t&&(s.onLabelSelected(t),s.parent.onElementSelected(t))}),300,{trailing:!1}),(i=sw(i))in r?Object.defineProperty(r,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[i]=o,this.vr=e,this.parent=n}),[{key:"createLabel",value:function(t){var e;this.registryLabelEvent(t),null===(e=this.parent.transformController)||void 0===e||e.bindElement(t)}},{key:"registryLabelEvent",value:function(t){t.on(Ud.ELEMENT_SELECTED,this.onElementSelected)}},{key:"unRegistryLabelEvent",value:function(t){t.off(Ud.ELEMENT_SELECTED,this.onElementSelected)}},{key:"onLabelSelected",value:function(t){var e=this,n=this.vr.tilePanoCtl.moveOnClick;this.vr.setMoveClick(!1),t.rafTimer=setTimeout((function(){t.rafTimer=null,e.vr.setMoveClick(n)}),200)}},{key:"getTransformController",value:function(){this.vr.view.parent.unregisterEvents();var t=new nw(this.vr.view);return t.setOnScreenElementWorldDetectionDistance(-1),this.vr.stage.bindController(t),this.parent.transformController=t,t.on(Ud.ELEMENT_SELECTED,this.onElementSelected),this.vr.view.parent.registerEvents(),t}},{key:"disposeTransformController",value:function(){this.parent.transformController.off(Ud.ELEMENT_SELECTED,this.onElementSelected),this.vr.stage.disposeController(this.parent.transformController),this.parent.transformController.unbind(),this.parent.transformController=null}},{key:"disposeLabel",value:function(t){var e;null===(e=this.parent.transformController)||void 0===e||e.unbindElement(t),this.vr.stage.disposeElement(t),t.rafTimer&&window.clearTimeout(t.rafTimer),t.rafTimer=null,this.unRegistryLabelEvent(t)}}])}();function uw(t){return(uw="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})(t)}function cw(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function lw(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,yw(r.key),r)}}function hw(t,e,n){return e=gw(e),function(t,e){if(e&&("object"==uw(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}()?Reflect.construct(e,n||[],gw(t).constructor):e.apply(t,n))}function pw(t,e,n,r){var i=fw(gw(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof i?function(t){return i.apply(n,t)}:i}function fw(){return(fw="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=dw(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(null,arguments)}function dw(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=gw(t)););return t}function gw(t){return(gw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function mw(t,e){return(mw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function vw(t,e,n){return(e=yw(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function yw(t){var e=function(t,e){if("object"!=uw(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=uw(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==uw(e)?e:e+""}var xw=function(t){function e(){var t;cw(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return vw(t=hw(this,e,[].concat(r)),"labelUtil",null),vw(t,"transformController",null),vw(t,"updateLabel",(function(){})),vw(t,"onOwllyVrInit",(function(){})),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&mw(t,e)}(e,t),n=e,(r=[{key:"registry",value:function(t){pw(e,"registry",this,3)([t]),this.registryOwllyVrEvent(),this.labelUtil=new aw(t,this)}},{key:"registryOwllyVrEvent",value:function(){var t=this.owllyVr;t.registerCb(LM.OnPanorama,this.updateLabel),t.registerCb(LM.OnInit,this.onOwllyVrInit)}},{key:"unRegistryOwllyVrEvent",value:function(){var t=this.owllyVr;t.unRegisterCb(LM.OnPanorama,this.updateLabel),t.unRegisterCb(LM.OnInit,this.onOwllyVrInit)}},{key:"dispose",value:function(){this.unRegistryOwllyVrEvent(),pw(e,"dispose",this,3)([]),this.labelUtil=null,this.offAll()}}])&&lw(n.prototype,r),i&&lw(n,i),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i}(Q_);function bw(t){return(bw="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})(t)}function _w(t){return function(t){if(Array.isArray(t))return ww(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return ww(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ww(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ww(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Mw(t,e,n){return e=Aw(e),function(t,e){if(e&&("object"==bw(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}()?Reflect.construct(e,n||[],Aw(t).constructor):e.apply(t,n))}function Ew(){return(Ew="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=Sw(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(null,arguments)}function Sw(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Aw(t)););return t}function Aw(t){return(Aw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Cw(t,e){return(Cw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Tw(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Rw(r.key),r)}}function Pw(t,e,n){return e&&Tw(t.prototype,e),n&&Tw(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Iw(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Lw(t,e,n){return(e=Rw(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Rw(t){var e=function(t,e){if("object"!=bw(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=bw(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==bw(e)?e:e+""}var Ow=Pw((function t(){Iw(this,t)}));Lw(Ow,"onLabel","onLabel");var Dw=function(t){function e(){var t;return Iw(this,e),Lw(t=Mw(this,e),"onOwllyVrInit",(function(){t.labelUtil.getTransformController()})),Lw(t,"setVideoPlayStatus",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.owllyVr.curPid;t.videoMap.forEach((function(t,n){t.visiblePidSet.has(e)?(t.setVideoVisible(!0),t.play(n)):t.stop(n)}))})),Lw(t,"updateLabel",(function(e){t.setVideoPlayStatus(e)})),Lw(t,"onElementSelected",(function(e){var n=t.videoToIdMap.get(e);t.emit(Ow.onLabel,n)})),t.name="video",t.videoMap=new Map,t.videoToIdMap=new WeakMap,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Cw(t,e)}(e,t),Pw(e,[{key:"add",value:function(t){var e,n=t.id,r=(t.pid,t.videoUrl),i=t.position,o=t.pose,s=t.visiblePoints,a=t.imgWidth,u=void 0===a?80:a,c=t.imgHeight,l=void 0===c?80:c,h=new Nb(r);this.owllyVr.stage.bindElement(h),this.labelUtil.createLabel(h),h.position.set(i[0],i[1],i[2]),(e=h.quaternion).set.apply(e,_w(o)),h.setVideoSize(u/100,l/100),h.visiblePidSet=new Set(s),this.videoMap.set(n,h),this.videoToIdMap.set(h,n),this.setVideoPlayStatus()}},{key:"remove",value:function(t){var e=this.videoMap.get(t);e&&this.labelUtil.disposeLabel(e)}},{key:"clear",value:function(){var t=this;this.videoMap.forEach((function(e){t.labelUtil.disposeLabel(e)})),this.videoMap.clear()}},{key:"dispose",value:function(){var t,n,r,i,o;this.labelUtil.disposeTransformController(),this.clear(),(t=e,n="dispose",r=this,o=Ew(Aw(1&(i=3)?t.prototype:t),n,r),2&i&&"function"==typeof o?function(t){return o.apply(r,t)}:o)([])}}])}(xw);n("yq1k"),n("JTJg");function Bw(t){return(Bw="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})(t)}function Fw(t){return function(t){if(Array.isArray(t))return Gw(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||kw(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Nw(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=kw(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function kw(t,e){if(t){if("string"==typeof t)return Gw(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gw(t,e):void 0}}function Gw(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Uw(t,e,n){return e=Vw(e),function(t,e){if(e&&("object"==Bw(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}()?Reflect.construct(e,n||[],Vw(t).constructor):e.apply(t,n))}function zw(){return(zw="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=Hw(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(null,arguments)}function Hw(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=Vw(t)););return t}function Vw(t){return(Vw=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function jw(t,e){return(jw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function Ww(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Jw(r.key),r)}}function qw(t,e,n){return e&&Ww(t.prototype,e),n&&Ww(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Xw(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Yw(t,e,n){return(e=Jw(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Jw(t){var e=function(t,e){if("object"!=Bw(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Bw(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Bw(e)?e:e+""}var Kw=qw((function t(){Xw(this,t)}));Yw(Kw,"onLabel","onLabel");var Qw=function(t){function e(){var t;return Xw(this,e),Yw(t=Uw(this,e),"onOwllyVrInit",(function(){t.labelUtil.getTransformController()})),Yw(t,"onElementSelected",(function(e){var n=e.labelID;t.emit(Kw.onLabel,n)})),Yw(t,"updateLabel",(function(e){t.clear();var n=t.pidLabel3dDataMap.get(e);n&&n.forEach((function(n){var r=n.visiblePoints,i=n.id,o=n.imgUrl,s=n.size,a=n.position,u=n.quaternion,c=n.lookAtCamera;t.add(r,i,o,s,a,u,c,e)}))})),t.name="label3d",t.pidLabel3dDataMap=new Map,t.label3dId2PidMap=new Map,t.label3dMap=new Map,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jw(t,e)}(e,t),qw(e,[{key:"add",value:function(t,e,n,r,i,o){var s=arguments.length>6&&void 0!==arguments[6]&&arguments[6],a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.owllyVr.curPid,u=this.pidLabel3dDataMap,c=this.label3dId2PidMap,l=this.owllyVr,h=this.label3dMap,p=l.stage;if(!h.get(e)){var f=this.create(t,e,n,r,i,o,s),d={visiblePoints:t,id:e,imgUrl:n,size:r,position:i,quaternion:o,lookAtCamera:s};c.set(e,t);var g,m=Nw(t);try{for(m.s();!(g=m.n()).done;){var v=g.value,y=u.get(v);y||(y=new Map,u.set(v,y)),y.set(e,d)}}catch(t){m.e(t)}finally{m.f()}t.includes(a)&&(p.bindElement(f),this.labelUtil.createLabel(f),h.set(e,f))}}},{key:"create",value:function(t,e,n,r,i,o){var s,a,u=arguments.length>6&&void 0!==arguments[6]&&arguments[6],c=new cb(e,n,{width:r[0],height:r[1]});(c.up.set(0,0,1),o)&&(a=c.quaternion).set.apply(a,Fw(o));return(s=c.position).set.apply(s,Fw(i)),c.addViewConfiguration({targetView:this.view,positions:t.map((function(t){return{pid:t,position:i}})),visibilities:t.map((function(t){return{pid:t,visible:!0}})),faceToCamera:u,keepZOnFaceToCamera:!0,visibleScope:15,showDom:!1,showMesh:!0}),c}},{key:"remove",value:function(t){var e=this.label3dMap,n=this.pidLabel3dDataMap,r=this.label3dId2PidMap;if(r.has(t)){var i=r.get(t);r.delete(t);var o,s=Nw(i);try{for(s.s();!(o=s.n()).done;){var a=o.value,u=n.get(a);u&&u.delete(t)}}catch(t){s.e(t)}finally{s.f()}}if(e.has(t)){var c=e.get(t);this.labelUtil.disposeLabel(c),e.delete(t)}}},{key:"clear",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.label3dMap,r=this.pidLabel3dDataMap,i=this.label3dId2PidMap,o=Nw(n.values());try{for(o.s();!(t=o.n()).done;){var s=t.value;this.labelUtil.disposeLabel(s)}}catch(t){o.e(t)}finally{o.f()}n.clear(),e&&(r.clear(),i.clear())}},{key:"dispose",value:function(){var t,n,r,i,o;this.clear(!0),this.labelUtil.disposeTransformController(),(t=e,n="dispose",r=this,o=zw(Vw(1&(i=3)?t.prototype:t),n,r),2&i&&"function"==typeof o?function(t){return o.apply(r,t)}:o)([])}}])}(xw);function Zw(t){return(Zw="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})(t)}function $w(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return tM(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tM(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function tM(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function eM(t,e,n){return e=iM(e),function(t,e){if(e&&("object"==Zw(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,function(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return function(){return!!t}()}()?Reflect.construct(e,n||[],iM(t).constructor):e.apply(t,n))}function nM(){return(nM="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=rM(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(null,arguments)}function rM(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=iM(t)););return t}function iM(t){return(iM=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function oM(t,e){return(oM=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function sM(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,lM(r.key),r)}}function aM(t,e,n){return e&&sM(t.prototype,e),n&&sM(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function uM(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cM(t,e,n){return(e=lM(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lM(t){var e=function(t,e){if("object"!=Zw(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Zw(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Zw(e)?e:e+""}var hM=aM((function t(){uM(this,t)}));cM(hM,"onLabel","onLabel");var pM=function(t){function e(t){var n;return uM(this,e),cM(n=eM(this,e,[t]),"label2DOverlay",null),cM(n,"onOwllyVrInit",(function(){n.label2DOverlay=new kb,n.owllyVr.view.addOverlay(n.label2DOverlay)})),cM(n,"onElementSelected",(function(t){var e,r=t.labelId,i=t.pid,o=null===(e=n.pidLabel2dDataMap.get("".concat(i)))||void 0===e?void 0:e.get(r);n.owllyVr.callBack(LM.OnLabel,r,o.attrsParams),n.emit(hM.onLabel,r,o.attrsParams)})),cM(n,"updateLabel",(function(t){n.clear();var e=n.pidLabel2dDataMap.get("".concat(t));e&&e.forEach((function(t){var e=t.pid,r=t.id,i=t.attrsParams;n.add(e,r,i,e)}))})),n.name="label2d",n.pidLabel2dDataMap=new Map,n.label2dId2PidMap=new Map,n.label2dMap=new Map,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&oM(t,e)}(e,t),aM(e,[{key:"create",value:function(t,e,n){var r=new Bb;return n.textAttrs&&(n.textAttrs.fontSize=n.textAttrs.fontSize||12),r.setAttributes(n),r.setTextFontSize(n.textAttrs.fontSize),r.labelId=e,r.setLabelID(e),r.pid=t,r.setVisible(!0),r}},{key:"add",value:function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.owllyVr.curPid,i=this.pidLabel2dDataMap,o=this.label2dId2PidMap;if(n){var s=n.position;s&&(n.position=new pr(s.x,s.y,s.z))}var a={pid:t,id:e,attrsParams:n},u=i.get("".concat(t));if(u||(u=new Map,i.set("".concat(t),u)),o.set(e,t),u.set(e,a),r===t){var c=this.create(t,e,n);this.label2dMap.set(e,c),this.owllyVr.stage.bindElement(c),this.labelUtil.createLabel(c)}}},{key:"remove",value:function(t){var e=this.label2dMap,n=this.label2dId2PidMap,r=this.pidLabel2dDataMap;if(n.has(t)){var i=n.get(t);n.delete(t);var o=r.get("".concat(i));o&&o.delete(t)}if(e.has(t)){var s=e.get(t);this.labelUtil.disposeLabel(s),e.delete(t)}}},{key:"clear",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.label2dMap,r=this.pidLabel2dDataMap,i=this.label2dId2PidMap,o=$w(n.values());try{for(o.s();!(t=o.n()).done;){var s=t.value;this.labelUtil.disposeLabel(s)}}catch(t){o.e(t)}finally{o.f()}n.clear(),e&&(r.clear(),i.clear())}},{key:"removeOverlay",value:function(){this.label2DOverlay&&(this.owllyVr.view.removeOverlay(this.label2DOverlay),this.label2DOverlay=null)}},{key:"dispose",value:function(){var t,n,r,i,o;this.removeOverlay(),this.clear(!0),(t=e,n="dispose",r=this,o=nM(iM(1&(i=3)?t.prototype:t),n,r),2&i&&"function"==typeof o?function(t){return o.apply(r,t)}:o)([])}}])}(xw);function fM(t){return(fM="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})(t)}function dM(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */dM=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof m?e:m,s=Object.create(o.prototype),a=new P(r||[]);return i(s,"_invoke",{value:S(t,n,a)}),s}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p="suspendedStart",f="executing",d="completed",g={};function m(){}function v(){}function y(){}var x={};c(x,s,(function(){return this}));var b=Object.getPrototypeOf,_=b&&b(b(I([])));_&&_!==n&&r.call(_,s)&&(x=_);var w=y.prototype=m.prototype=Object.create(x);function M(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,o,s,a){var u=h(t[i],t,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==fM(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(l).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(u.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function S(e,n,r){var i=p;return function(o,s){if(i===f)throw Error("Generator is already running");if(i===d){if("throw"===o)throw s;return{value:t,done:!0}}for(r.method=o,r.arg=s;;){var a=r.delegate;if(a){var u=A(a,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===p)throw i=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=f;var c=h(e,n,r);if("normal"===c.type){if(i=r.done?d:"suspendedYield",c.arg===g)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=d,r.method="throw",r.arg=c.arg)}}}function A(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,A(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=h(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var s=o.arg;return s?s.done?(n[e.resultName]=s.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function I(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(fM(e)+" is not iterable")}return v.prototype=y,i(w,"constructor",{value:y,configurable:!0}),i(y,"constructor",{value:v,configurable:!0}),v.displayName=c(y,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,c(t,u,"GeneratorFunction")),t.prototype=Object.create(w),t},e.awrap=function(t){return{__await:t}},M(E.prototype),c(E.prototype,a,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var s=new E(l(t,n,r,i),o);return e.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},M(w),c(w,u,"Generator"),c(w,s,(function(){return this})),c(w,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=I,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return a.type="throw",a.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var u=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;T(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:I(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}function gM(t,e,n,r,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(r,i)}function mM(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){gM(o,r,i,s,a,"next",t)}function a(t){gM(o,r,i,s,a,"throw",t)}s(void 0)}))}}function vM(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,_M(r.key),r)}}function yM(t,e,n){return e&&vM(t.prototype,e),n&&vM(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function xM(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function bM(t,e,n){return(e=_M(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _M(t){var e=function(t,e){if("object"!=fM(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=fM(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==fM(e)?e:e+""}var wM=pr,MM=er,EM=hr,SM=Vr,AM=qo,CM=To,TM=Gi,PM=L,IM=sr;!function(t,e={}){Nd.getInstance().setThreeInstance(t),e&&e.konva&&Nd.getInstance().setKonvaInstance(e.konva)}(r);var LM=yM((function t(){xM(this,t)}));bM(LM,"OnInit","onInit"),bM(LM,"OnMoveReady","onMoveReady"),bM(LM,"OnSwitch","onSwitch"),bM(LM,"OnStep","onStep"),bM(LM,"OnRoll","onRoll"),bM(LM,"OnDestroy","onDestroy"),bM(LM,"OnSelected","onSelected"),bM(LM,"OnMoveStart","onMoveStart"),bM(LM,"OnMoveEnd","onMoveEnd"),bM(LM,"OnPanorama","onPanorama"),bM(LM,"OnLoading","onLoading"),bM(LM,"OnChangeFloor","onChangeFloor"),bM(LM,"OnTitle","onTitle"),bM(LM,"OnLabel","onLabel"),bM(LM,"OnError","onError"),bM(LM,"OnGisPos","onGisPos"),bM(LM,"OnPointerMove","onPointerMove");var RM=function(){function t(e){var n,r=this;xM(this,t),bM(this,"container",void 0),bM(this,"loadingElement",void 0),bM(this,"topTile",void 0),bM(this,"pathLine",null),bM(this,"store2PanoDataMap",new Map),bM(this,"panoDataMap",new Map),bM(this,"trans2T3MtxMap",new Map),bM(this,"gisAlignMap",new Map),bM(this,"coordinateMap",new Map),bM(this,"sceneDataMap",new Map),bM(this,"intersectionsMapMap",new Map),bM(this,"cbsMap",new Map),bM(this,"stage",void 0),bM(this,"view",void 0),bM(this,"screen",void 0),bM(this,"basicCtl",void 0),bM(this,"curSceneData",void 0),bM(this,"curPanoData",void 0),bM(this,"floorModel",void 0),bM(this,"tilePanoCtl",void 0),bM(this,"panoGroup",void 0),bM(this,"pathColor",void 0),bM(this,"pathWidth",void 0),bM(this,"pathLineViewDistance",void 0),bM(this,"pathImage","imgs/arrow.png"),bM(this,"curStepIndex",-1),bM(this,"sceneFov",void 0),bM(this,"indicatorImageURL","/imgs/pointer.png"),bM(this,"targetStepIndex",-1),bM(this,"stepMoving",!1),bM(this,"stepJumping",!1),bM(this,"stepJumpMax",0),bM(this,"changingFloor",!1),bM(this,"moveDataSteps",[]),bM(this,"moveDataPanoramas",[]),bM(this,"pathMap",new Map),bM(this,"pathDataMap",new Map),bM(this,"pano2IdnexMap",new Map),bM(this,"curStoreIndex",0),bM(this,"store2MovePanosMap",new Map),bM(this,"targetPid",-1),bM(this,"targetPos",null),bM(this,"targetLookParam",null),bM(this,"moveReady",!1),bM(this,"moveClick",!1),bM(this,"stepStopResolve",null),bM(this,"resMode",""),bM(this,"offlinePath",""),bM(this,"timeScale",1),bM(this,"modelMap",new Map),bM(this,"modelCache",!0),bM(this,"floorModelResolve",void 0),bM(this,"waitModel",void 0),bM(this,"initFlooring",!1),bM(this,"fixedViewDistance",!1),bM(this,"pathStartPoint",null),bM(this,"pathEndArrow",null),bM(this,"tileLevelMax",2),bM(this,"moveToBackShowImage",!0),bM(this,"plugins",new Set),bM(this,"rf",void 0),bM(this,"onPointerMove",(function(t){if(m.emitPointerPosition){var e=t.clientX,n=t.clientY,i=r.container,o=i.clientWidth,s=i.clientHeight,a=r.container.getBoundingClientRect(),u=e-a.left,c=n-a.top,l=new Gp;l.setFromCamera({x:2*u/o-1,y:1-2*c/s},r.view.camera);var h=r.floorModel.intersectRay(l.ray.origin,l.ray.direction,!0);if(h&&h.length){var p=h[0];null!=p&&p.intersectionPoint&&r.callBack(LM.OnPointerMove,p.intersectionPoint)}}})),bM(this,"animate",(function(t){r.animate&&(r.rf=requestAnimationFrame(r.animate)),v.a.update(t)})),bM(this,"lastOnRollStr",""),this.container=e,this.pathColor=m.path.color,this.pathWidth=m.path.width,this.pathLineViewDistance=m.path.viewDistance,this.sceneFov=m.camera.fov,null!=m.tileLevelMax&&(this.tileLevelMax=m.tileLevelMax),!1===m.move.moveBackShowImage&&(this.moveToBackShowImage=!1),m.tile&&(m.tile.textPixel||m.tile.imgTextPixel)&&(n=m.tile,fb=Object.assign(Object.assign({},fb),n)),this.createNetMonitor(),this.use(Qw),this.use(pM),this.registryContainerEvent()}return yM(t,[{key:"use",value:function(t){var e=t;"function"==typeof t&&(e=new t),this.plugins.add(e),this.registryPlugin(e)}},{key:"registryPlugin",value:function(t){t.registry(this),this["$plugin_".concat(t.name)]=t}},{key:"createNetMonitor",value:function(){var t;null!==(t=m.healthCheck)&&void 0!==t&&t.use&&(this.netMonitor=new V_,this.netMonitor.start(),this.netMonitor.on(this.netMonitor.eventName,(function(t){console.log(t)})))}},{key:"registryContainerEvent",value:function(){this.container.addEventListener("pointermove",this.onPointerMove)}},{key:"unRegistryContainerEvent",value:function(){this.container.removeEventListener("pointermove",this.onPointerMove)}},{key:"sleepByNetStatusCheck",value:(k=mM(dM().mark((function t(){var e;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e=this.netMonitor).status){t.next=4;break}return t.next=4,e.healthCheck();case 4:if(!e.status){t.next=6;break}return t.abrupt("return");case 6:return t.next=8,new Promise((function(t){var n=function(r){r&&t(),e.off(e.eventName,n)};e.on(e.eventName,n)}));case 8:case"end":return t.stop()}}),t,this)}))),function(){return k.apply(this,arguments)})},{key:"showLoading",value:function(t){g.log("------loading show------------------",t),t?(this.container.style.opacity=0,this.callBack(LM.OnLoading,t)):(this.container.style.opacity=1,this.callBack(LM.OnLoading,t))}},{key:"setLoading",value:function(t){this.loadingElement=t}},{key:"enableDebug",value:function(t){g.level=t?d.LOG:d.NONE}},{key:"waitSecond",value:(N=mM(dM().mark((function t(){var e,n=arguments;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=n.length>0&&void 0!==n[0]?n[0]:1,t.next=3,this.waitAWhile(1e3*e);case 3:case"end":return t.stop()}}),t,this)}))),function(){return N.apply(this,arguments)})},{key:"waitAWhile",value:(F=mM(dM().mark((function t(){var e,n=arguments;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=n.length>0&&void 0!==n[0]?n[0]:1e3,t.abrupt("return",new Promise((function(t){setTimeout((function(){t("resolved")}),e)})));case 2:case"end":return t.stop()}}),t)}))),function(){return F.apply(this,arguments)})},{key:"processCoordinate",value:function(t,e){var n=this;t&&e&&(t=t instanceof Array?t:[t],e=e instanceof Array?e:[e],t.forEach((function(t,r){var i=e[r];i&&n.coordinateMap.set(t,i)})))}},{key:"trans2T3Vector",value:function(t,e,n,r){r=r||0;var i=this.trans2T3MtxMap.get(t);if(null!=i){var o=new wM(e,n,0);return o.applyMatrix4(i),o.z=r,o}var s=this.coordinateMap.get(t);if(s){var a=s.width,u=s.height,c=s.scale,l=s.theta,h=(e-a*s.x_ratio)/c,p=(n-u*s.y_ratio)/c,f=h*Math.cos(l)+p*Math.sin(l),d=h*Math.sin(l)-p*Math.cos(l);return new wM(f,d,r)}return null}},{key:"getVRData",value:(B=mM(dM().mark((function t(e){var n,r;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=null,!e){t.next=18;break}if("off-line"!==this.resMode){t.next=11;break}return t.next=5,o_.xhrGet("".concat(this.offlinePath).concat(e,".json"),!0);case 5:return r=t.sent,t.next=8,o_.xhrGet(r.jsonPath,!0);case 8:n=t.sent,t.next=18;break;case 11:return t.next=13,o_.xhrPost(m.api.listPanoramasUrl,{store_id:e,use_super:m.tile.useSuper},!0);case 13:if(null!==(n=t.sent)||!this.netMonitor){t.next=18;break}return t.next=17,this.sleepByNetStatusCheck();case 17:return t.abrupt("return",this.getVRData(e));case 18:return t.abrupt("return",n);case 19:case"end":return t.stop()}}),t,this)}))),function(t){return B.apply(this,arguments)})},{key:"getVRIntersectionsData",value:(D=mM(dM().mark((function t(e){var n,r,i,o,s;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.intersectionsMapMap.has(e)){t.next=14;break}return n=this.sceneDataMap.get(e),r=n.intersectionsPath||"".concat(m.VRHost||"https://vr.aibee.cn","/robot-vr/navigation/list-ground-intersections/").concat(e),t.next=5,o_.xhrGet(r,!0);case 5:if((i=t.sent)||!this.netMonitor){t.next=10;break}return t.next=9,this.sleepByNetStatusCheck();case 9:return t.abrupt("return",this.getVRIntersectionsData(e));case 10:o=i.data,s=new Map,o.forEach((function(t){var e=t.panorama_id,n=t.pos_x,r=t.pos_y,i=t.pos_z;s.set(e,new wM(n,r,i))})),this.intersectionsMapMap.set(e,s);case 14:return t.abrupt("return",this.intersectionsMapMap.get(e));case 15:case"end":return t.stop()}}),t,this)}))),function(t){return D.apply(this,arguments)})},{key:"createLabel2d",value:function(t,e,n){return this.$plugin_label2d.create(t,e,n)}},{key:"addLabel2d",value:function(t,e,n){return this.$plugin_label2d.add(t,e,n)}},{key:"createLabel3d",value:function(t,e,n,r,i,o){var s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return this.$plugin_label3d.create(t,e,n,r,i,o,s)}},{key:"addLabel3d",value:function(t,e,n,r,i,o){var s=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return this.$plugin_label3d.add(t,e,n,r,i,o,s)}},{key:"removeLabel3d",value:function(t){return this.$plugin_label3d.remove(t)}},{key:"removeLabel2d",value:function(t){return this.$plugin_label2d.remove(t)}},{key:"cleanLabel2d",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.$plugin_label2d.clear(t)}},{key:"cleanLabel3d",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.$plugin_label3d.clear(t)}},{key:"cleanLabel",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.cleanLabel2d(t),this.cleanLabel3d(t)}},{key:"registerCb",value:function(t,e){var n=this.cbsMap.get(t);n||(n=[],this.cbsMap.set(t,n)),n.push(e)}},{key:"unRegisterCb",value:function(t,e){var n=this.cbsMap.get(t);if(n){var r=n.indexOf(e);r>-1&&n.splice(r,1)}}},{key:"cleanCb",value:function(t){t?this.cbsMap.delete(t):this.cbsMap.clear()}},{key:"callBack",value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];if(this.cbsMap.has(t)){var i=this.cbsMap.get(t);m.cbLog,i.forEach((function(t){t.apply(void 0,n)}))}}},{key:"updateTitle",value:function(t){this.callBack(LM.OnTitle,t)}},{key:"process2T3Matrix",value:function(t,e){var n=this;if(t&&e){var r=t instanceof Array;e=r?e:[e],(t=r?t:[t]).forEach((function(t,r){var i=e[r];i&&n.trans2T3MtxMap.set(t,(new SM).fromArray(i))}))}}},{key:"getPanoramaData",value:function(t,e){var n=this.store2PanoDataMap,r=this.panoDataMap;if(n.has(t))return n.get(t);var i=e.map((function(e){var n=e.panorama_images,r=e.panorama_images_low,i=e.tile_image_level,o=e.tile_images,s=e.seq_id,a=e.visible_panorama_seq_ids,u=e.coordinate,c=u.panorama_id,l=u.direction_w,h=u.direction_x,p=u.direction_y,f=u.direction_z,d=u.position_x,g=u.position_y,v=u.position_z,y=e.visible,x=JSON.parse(r),b=JSON.parse(o);return{storeId:t,pid:c,seqID:s,textureURLs:x,visible:y,offLineTextureUrls:b,offLineTextureLevel:i,highTextureURLs:JSON.parse(n),useLowTextureURLsOnly:m.tile.useLowTextureURLsOnly,neighbourPanoramaIDs:a,position:new wM(d,g,v),quaternion:new EM(h,p,f,l)}}));return n.set(t,i),i.forEach((function(t){r.set(t.pid,t);var e=t.neighbourPanoramaIDs.map((function(t){return i[t].pid}));t.neighbourPanoramaIDs=e})),i}},{key:"showChangeFloor",value:(O=mM(dM().mark((function t(e){var n,r,i;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this.view,!e||this.changeFloor){t.next=10;break}return this.changingFloor=!0,r=n.renderer.domElement,i=r.toDataURL("image/jpeg",.95),this.callBack(LM.OnChangeFloor,e,i),t.next=8,this.waitAWhile(200);case 8:t.next=11;break;case 10:!e&&this.changingFloor&&(this.changeFloor=!1,this.callBack(LM.OnChangeFloor,e));case 11:case"end":return t.stop()}}),t,this)}))),function(t){return O.apply(this,arguments)})},{key:"setPixelRatio",value:function(t){var e=this.view;e&&e.renderer.setPixelRatio(t)}},{key:"setFov",value:function(t){this.sceneFov=t,this.basicCtl&&this.basicCtl.setFov(t)}},{key:"setFovRange",value:function(t,e){this.basicCtl&&this.basicCtl.setFovRange(t,e)}},{key:"getPIDByPos",value:function(t,e,n){var r=this.store2PanoDataMap.get(t),i=null,o=this.trans2T3Vector(t,e,n),s=-1;return r.forEach((function(t){if(t.visible){var e=o.distanceTo(t.position);i?e<s&&(i=t,s=e):(i=t,s=e)}})),s>20&&g.warn("位置点距离全景点过远, distance = ".concat(s)),i.pid}},{key:"getPIDByGis",value:function(t,e,n){var r=this.gisAlignMap;if(r.has(t)){var i,o,s=r.get(t),a=null,u=new MM(e,n),c=-1;return s.forEach((function(t,e){var n=t.gis,r=t.pos,s=u.distanceTo(n);(!a||s<c)&&(c=s,a=e,i=r,o=n)})),{target:a,distance:c,pos:i,gis:o}}return{target:0}}},{key:"getPathPoints",value:function(){var t=this.pathLine,e=this.moveDataSteps,n=[],r=[];if(t){for(var i,o=0,s=t.getCurrent()+t.getViewDistance(),a=0;a<e.length;a++){var u=e[a];if(i&&i.store_id!=u.store_id||o+u.distance>s)break;o+=u.distance,n.push(u.pos3),r.push(u.distance),i=u}var c=t.getPointOnDistance(s).point;r.push(c.distanceTo(n[n.length-1])),n.push(c)}return{points:n,distances:r}}},{key:"lookPathPoints",value:(R=mM(dM().mark((function t(){var e,n,r,i,o,s,a,u,c,l,h,p,f,d;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.tilePanoCtl,n=this.timeScale,r=this.panoDataMap,i=this.moveDataSteps,o=this.curPid,s=this.curStepIndex,a=this.getPathPoints(),u=a.points,c=a.distances,s<0&&(o=i[0].curPid),l=r.get(o),h=l.position,p=u.map((function(t){var e=t.clone().sub(h);return e.z=0,e})),f=u.map((function(){return o})),d=c.map((function(t){return 200*t*n})),t.next=11,e.moveInPath(f,{intervals:d,toDirections:p,fovs:this.sceneFov,showModel:!1});case 11:case"end":return t.stop()}}),t,this)}))),function(){return R.apply(this,arguments)})},{key:"lookatPathEnd",value:(L=mM(dM().mark((function t(){var e,n,r,i,o,s,a,u,c,l,h;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.tilePanoCtl,n=this.pathLine,r=this.panoDataMap,i=this.moveDataSteps,o=this.curPid,this.curStepIndex<0&&(o=i[0].curPid),s=n.getCurrent(),a=n.getViewDistance(),u=s+a,c=n.getPointOnDistance(u).point,l=r.get(o),h=l.position,c.sub(new wM(h.x,h.y,0)).normalize(),t.next=12,e.moveInPath([o],{intervals:2e3,toDirections:c,fovs:this.sceneFov,showModel:!1});case 12:case"end":return t.stop()}}),t,this)}))),function(){return L.apply(this,arguments)})},{key:"initStage",value:function(){var t=this.stage,e=this.container;if(null==t&&(requestAnimationFrame(this.animate),this.initEvent(),bb.resizeFirst=m.tileResizeFirst,t=this.stage=new Xd,e)){var n=this.screen=new Yd(e,{preserveDrawingBuffer:!0,eventOnContainer:!0}),r=this.view=new Kd(n);t.bindView(r);var i=this.basicCtl=new Kb(r),o=null!=m.camera.zoomScale?m.camera.zoomScale:-1;hb.DetectAndroid()&&(o*=-1),i.zoomScale=o,t.bindController(i),i.setZoomMode("fov"),this.setFovRange(Math.min(10,this.sceneFov),Math.max(this.sceneFov,90)),this.setFov(this.sceneFov),this.callBack(LM.OnInit)}}},{key:"setPath",value:function(e,n,r,i,o){var s=this,a=this.stage,u=this.pathColor,c=this.pathWidth,l=this.pathLine;null==i&&(i=u),null==o&&(o=c),l&&a.disposeElement(l);var h=t.SmoothPath(e);if((l=this.pathLine=new _b(h,{textureUrl:n,color:parseInt(i),current:0,viewDistance:8,gradientDistance:5,gradientEnabled:!0,width:o})).setCurrent(0),l.position.z=r,a.bindElement(l),m.path.startPoint&&e.length>1){var p=new AM(1.5*o,1.5*o),f=new Image,d=new TM({color:i,depthTest:!1,transparent:!0}),g=new CM(p,d);g.renderOrder=10001,g.opacity=0,g.position.set(e[0].x,e[0].y,r),this.stage.scene.add(g),f.onload=function(){var t=new IM(f);t.needsUpdate=!0,d.map=t,d.needsUpdate=!0,g.opacity=1},f.onerror=function(){s.callBack(LM.OnError,"start-point img load error【".concat(f.src,"】"))},f.src="textures/start-point.png",this.pathStartPoint=g}if(m.path.endArrow)if(m.path.endArrow3d){var v=new Ob("model/end_arrow_static.glb",{depthTest:!1,renderOrder:10002},A_);this.stage.bindElement(v),this.pathEndArrow=v}else{var y=2*o;m.path.endArrowWidth&&(y=m.path.endArrowWidth);var x=new AM(2*y,y),b=new Image,_=new TM({color:i,depthTest:!1,transparent:!0,side:PM}),w=new CM(x,_);w.renderOrder=10002,w.opacity=0,w.rotation.set(Math.PI/2,0,0),w.position.set(e[0].x,e[0].y,r+y),this.stage.scene.add(w),b.onload=function(){var t=new IM(b);t.needsUpdate=!0,_.map=t,_.needsUpdate=!0,w.opacity=1},b.onerror=function(){s.callBack(LM.OnError,"arror img load error【".concat(b.src,"】"))},b.src="textures/end-arrow.png",this.pathEndArrow=w}}},{key:"getArrowAngleByDir",value:function(t,e){var n=new wM(1,0,0),r=new wM(t.x,t.y,0).normalize(),i=n.clone().angleTo(r),o=n.clone().dot(r),s=Math.acos(o),a=n.clone().angleTo(t),u=n.clone().cross(r);return g.log("getArrowAngleByDir",r,t,i,s,a,u),u.z<0?-i+Math.PI:i+Math.PI}},{key:"updatePathByPid",value:function(t){var e=this.pathLine,n=this.view,r=this.getTargetDistanceByPid(t,this.pathLineViewDistance),i=Math.min(r/2,4),o=e.getNearestPoint(n.camera.position).distance;e.setCurrent(o),e.setViewDistance(r),e.uniforms.gradientDistance.value=i}},{key:"dispose",value:(I=mM(dM().mark((function t(e){var n,r,i,o,s,a,u;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this.stage,r=this.panoGroup,i=this.floorModel,o=this.pathLine,s=this.tilePanoCtl,a=this.modelCache,u=this.netMonitor,this.cleanLabel(),i&&(a?n.unbindElement(i):n.disposeElement(i),this.floorModel=null),e&&(this.modelMap.forEach((function(t){t.dispose()})),this.modelMap.clear(),u&&(u.offAll(),this.netMonitor=null)),r&&(n.disposeElement(r),this.panoGroup=null),o&&(n.disposeElement(o),this.pathLine=null),!s){t.next=11;break}return t.next=9,n.disposeController(s);case 9:s.dispose(),this.tilePanoCtl=null;case 11:this.pathEndArrow&&(this.pathEndArrow.opacity=0,n.scene.remove(this.pathEndArrow),ky.dispose(this.pathEndArrow),this.pathEndArrow=null),this.pathStartPoint&&(this.pathStartPoint.opacity=0,n.scene.remove(this.pathStartPoint),ky.dispose(this.pathStartPoint),this.pathStartPoint=null);case 13:case"end":return t.stop()}}),t,this)}))),function(t){return I.apply(this,arguments)})},{key:"modelLoad",value:(P=mM(dM().mark((function t(e){var n=this;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){var r=new Yx(e);n.floorModelResolve=function(){var i=mM(dM().mark((function i(o,s){return dM().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(s){i.next=2;break}return i.abrupt("return",t(r));case 2:return n.waitModel=null,r.dispose(),i.next=6,n.sleepByNetStatusCheck();case 6:t(n.modelLoad(e));case 7:case"end":return i.stop()}}),i)})));return function(t,e){return i.apply(this,arguments)}}(),n.waitModel=r})));case 1:case"end":return t.stop()}}),t)}))),function(t){return P.apply(this,arguments)})},{key:"preFloorModels",value:(T=mM(dM().mark((function t(){var e,n;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.modelCache){t.next=9;break}e=Array.from(this.sceneDataMap.keys()),n=0;case 3:if(!(n<e.length)){t.next=9;break}return t.next=6,this.getFloorModel(e[n]);case 6:n++,t.next=3;break;case 9:case"end":return t.stop()}}),t,this)}))),function(){return T.apply(this,arguments)})},{key:"getFloorModel",value:(C=mM(dM().mark((function t(e){var n,r,i,o,s;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this.sceneDataMap,r=this.modelCache,i=this.modelMap,o=n.get(e),!r){t.next=17;break}if(!i.has(e)){t.next=7;break}s=i.get(e),t.next=15;break;case 7:if(null==o||!o.modelPath){t.next=14;break}return t.next=10,this.modelLoad(o.modelPath);case 10:s=t.sent,i.set(e,s),t.next=15;break;case 14:return t.abrupt("return",null);case 15:t.next=20;break;case 17:return t.next=19,this.modelLoad(o.modelPath);case 19:s=t.sent;case 20:return t.abrupt("return",s);case 21:case"end":return t.stop()}}),t,this)}))),function(t){return C.apply(this,arguments)})},{key:"initFloorVR",value:(A=mM(dM().mark((function t(e,n,r,i,o,s,a){var u,c,l,h,p,f,d,v,y,x,b,_,w,M;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!i){t.next=5;break}return t.next=3,this.showChangeFloor(!0);case 3:t.next=7;break;case 5:return t.next=7,this.showLoading(!0);case 7:return u=Math.min(m.move.stayLevel,this.tileLevelMax),this.tilePanoCtl&&(u=this.tilePanoCtl.levelMax),t.next=11,this.dispose();case 11:return g.time("floor model load"),c=this.stage,l=this.view,h=this.basicCtl,p=this.panoDataMap,f=this.timeScale,this.curSceneData=this.sceneDataMap.get(e),t.next=16,this.getFloorModel(e);case 16:return(d=this.floorModel=t.sent)?c.bindElement(d):this.callBack(LM.OnError,"model load error,storeId【".concat(e,"】")),g.timeEnd("floor model load"),v=this.getPanoramaData(e),g.time("indicator panoGroup init"),t.next=23,this.getVRIntersectionsData(e);case 23:if(y=t.sent,m.defaultVisibleRadius&&(__.DefaultVisibleRadius=m.defaultVisibleRadius),x=this.panoGroup=new __(v,{modelElement:d,groundParams:{downDirection:new wM(0,0,-1)},indicatorImageURL:this.indicatorImageURL,indicatorPositionMap:y}),c.bindElement(x),g.timeEnd("indicator panoGroup init"),b=this.tilePanoCtl=new E_(l,x,h),m.tile&&m.tile.levels&&b.setLevels(m.tile.levels),c.bindController(b),b.moveOnClick=this.moveClick,b.showModel=m.model.show,b.updateLevelMax(Math.min(u,this.tileLevelMax)),(_=this.curPanoData=p.get(n))||this.callBack(LM.OnError,"get pano data error ,panoId【".concat(n,"】")),(w=r)||(w=new wM(1,0,0)).applyQuaternion(_.quaternion),g.log("initFloor lookat Dir ",w),s&&h.setFov(2*this.sceneFov/3),!o){t.next=64;break}return M=w.clone().multiplyScalar(-1),g.time("lookFromPanorama"),b.updateLevelMax(Math.min(m.move.moveLevel,this.tileLevelMax)),t.next=46,b.lookFromPanorama(n,M,!0);case 46:if(g.timeEnd("lookFromPanorama"),g.timeEnd("displayShow"),a&&a(),!i){t.next=54;break}return t.next=52,this.showChangeFloor(!1);case 52:t.next=55;break;case 54:this.showLoading(!1);case 55:if(!s){t.next=60;break}return t.next=58,this.waitAWhile(500);case 58:return t.next=60,b.moveInPath([n],{intervals:2e3*f,toDirections:M,fovs:this.sceneFov,showModel:m.model.show});case 60:b.updateLevelMax(Math.min(u,this.tileLevelMax)),b.updateLevel(),t.next=74;break;case 64:return t.next=66,b.lookFromPanorama(n,w,!0);case 66:if(a&&a(),!i){t.next=72;break}return t.next=70,this.showChangeFloor(!1);case 70:t.next=73;break;case 72:this.showLoading(!1);case 73:g.log("==============");case 74:return t.next=76,this.waitAWhile(1e3);case 76:g.log("initFloorVR",b.levelMax);case 77:case"end":return t.stop()}}),t,this)}))),function(t,e,n,r,i,o,s){return A.apply(this,arguments)})},{key:"updatePathByPathPid",value:function(t,e){var n=this.pathMap,r=this.pathImage,i=n.get(t);this.setPath(i,r,m.path.heightOffset),this.updatePathByPid(e)}},{key:"getVRDataList",value:(S=mM(dM().mark((function t(e){var n,r,i,o,s,a;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=this.sceneDataMap,r=[],e instanceof Array?r=e:r.push(e),i=0;case 4:if(!(i<r.length)){t.next=17;break}if(o=r[i],!n.has(o)){t.next=8;break}return t.abrupt("continue",14);case 8:return g.time("store request "+o),t.next=11,this.getVRData(o);case 11:s=t.sent,g.timeEnd("store request "+o),s&&(a=s.data,n.set(o,a),this.getPanoramaData(o,a.panorama_list));case 14:i++,t.next=4;break;case 17:return t.abrupt("return",n);case 18:case"end":return t.stop()}}),t,this)}))),function(t){return S.apply(this,arguments)})},{key:"getNextStepIndexByDistance",value:function(t,e){for(var n=this.moveDataSteps,r=0,i=t+1,o=n[i],s=n[t];o;){if(r+=o.distance,s.store_id!=o.store_id||r>e){s.store_id!=o.store_id&&i--;break}o=n[++i]}return i}},{key:"getSameFloorStepsByIndex",value:function(t){var e=[],n=this.moveDataSteps,r=n[t];e.push(new MM(r.pos3.x,r.pos3.y));for(var i=t+1;i<n.length;i++){var o=n[i];if(r.store_id!==o.store_id)break;r=o,e.push(new MM(r.pos3.x,r.pos3.y))}for(var s=t-1;s>0;s--){var a=n[s];if(r.store_id!==a.store_id)break;r=a,e.splice(0,0,new MM(r.pos3.x,r.pos3.y))}return e}},{key:"expendPath",value:function(t,e){var n=t.length;if(n>1){var r=t[n-2],i=t[n-1],o=i.clone().sub(r).normalize().multiplyScalar(e).add(i);t.push(o)}}},{key:"getNextStepDirectionByIndexDistance",value:function(t){var e,n=this.moveDataSteps,r=n[t],i=n[t+1],o=this.getNextStepIndexByDistance(t,m.rotate.distance+r.distance);if(o!=t+1){var s=n[o];s&&(e=s.pos3.clone().sub(i.pos3).normalize())}return e}},{key:"getTargetDistanceByIndex",value:function(t,e,n){for(var r,i=this.moveDataSteps,o=i[t],s=o.distance,a=[],u=[],c=o,l=t+1;l<i.length;l++){if(r=i[l],o.store_id!=r.store_id||0!=r.rotateTime&&!n||!(s<e)){o.store_id!=r.store_id?s-=c.distance:r.rotateTime>0&&(s+=4);break}s+=r.distance,a.push(r.distance),u.push(r.rotateTime),c=r}var h=c.pos3.clone().add(c.moveDir.clone().multiplyScalar(c.distance-(s-e)));return s>e&&(s=e),{distance:s,step:r,pos:h}}},{key:"getPathDistance",value:function(t,e){var n=this.pathLine.getNearestPoint(t,e).distance;return n<m.path.changeDistance&&(n=0),n}},{key:"updatePathByIndex",value:function(t,e,n){var r=this,i=this.pathLine,o=(this.view,this.pathLineViewDistance),s=this.moveDataSteps,a=this.pathStartPoint,u=this.pathEndArrow,c=this.getTargetDistanceByIndex(t,o,m.path.fixedViewDistance);g.log("target",c);var l=c.distance,h=s[t],p=s[t-1];p&&p.store_id!=h.store_id&&(p=null);var f=i.getCurrent(),d=p?i.getNearestPoint(p.pos3,f).distance:0,y=i.getNearestPoint(h.pos3,d).distance,x=0;if(y<m.path.changeDistance&&(x=y,y=0),e){var b=i.getViewDistance();x+=y-d,l=this.getTargetDistanceByIndex(t,o,this.fixedViewDistance).distance+x;var _=Math.min(l/2,4),w=i.uniforms.gradientDistance.value;new v.a.Tween({viewDist:b,gradDist:w,distance:d}).to({viewDist:l,gradDist:_,distance:y},n).onUpdate((function(t){var e=t.viewDist,n=t.gradDist,r=t.distance;i&&(i.setCurrent(r),i.setViewDistance(e),i.uniforms.gradientDistance.value=n)})).onComplete((function(){a&&a.position.set(h.pos3.x,h.pos3.y,a.position.z),u&&(u.rotation.set(u.rotation.x,r.getArrowAngleByDir(c.step.moveDir),0),u.position.set(c.pos.x,c.pos.y,u.position.z),g.log("pathEndArrow",u,u.rotation,u.position))})).start()}else{var M=Math.min(l/2,4);if(l+=x,this.fixedViewDistance&&(l=o),i.setCurrent(y),i.setViewDistance(l),i.uniforms.gradientDistance.value=M,a&&a.position.set(h.pos3.x,h.pos3.y,a.position.z),u){for(var E=0,S=c.pos,A=c.step.moveDir,C=t;C<c.step.index;C++){var T=s[C];if(T.rotateTime>0&&++E>=2){S=T.pos3,A=T.moveDir;break}}u.rotation.set(u.rotation.x,this.getArrowAngleByDir(A),0);var P=new MM(A.x,A.y).normalize();P.rotateAround(new MM(0,0),Math.PI/2),P.multiplyScalar(1.5*this.pathWidth),u.position.set(S.x+P.x,S.y+P.y,u.position.z)}}}},{key:"moveStep",value:(E=mM(dM().mark((function t(e){var n,r,i,o,s,a,u,c,l,h,p,f,d,v,y,x,b,_,w,M,E,S,A,C=this,T=arguments;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=!(T.length>1&&void 0!==T[1])||T[1],r=this.moveDataSteps,i=this.tilePanoCtl,o=this.curStepIndex,s=this.timeScale,a=this.pathImage,g.log("moveStep",e,n),c=(u=r)[e],l=n?c:u[e+1],h=n?u[e+1]:u[e+2],n?u[e-1]:u[e],p=u[o],f=!0,d=!1,v=!1,!l){t.next=48;break}if(y=!0,p.store_id!=l.store_id&&(d=!0),x=null,b=c.rotateTime,_=c.moveDir,l.single&&(x=l.dir),w=l.moveDir,h&&l.store_id!=h.store_id&&(v=!0),!i){t.next=48;break}if(M=1e3*c.duration,p.pano_id==l.pano_id&&(y=!1,b||(f=!1)),!d){t.next=32;break}return g.log("换层",l.store_id),t.next=28,this.initFloorVR(l.store_id,l.pano_id,x||w,!0,!1,!1,(function(){if(!l.single){var t=C.getSameFloorStepsByIndex(e+1);C.expendPath(t,m.path.expendLength),C.setPath(t,a,m.path.heightOffset),C.updatePathByIndex(e)}}));case 28:M=0,this.callBack(LM.OnSwitch,l.floor),t.next=42;break;case 32:if(M<2e3&&(M=2e3),E=M>b?M:b,S=M-(1e3+.3*b),S*=s,E*=s,A=this.pathLine,this.view,A&&y&&this.updatePathByIndex(e,!0,E),!f){t.next=42;break}return t.next=42,i.moveInPath([l.pano_id],{intervals:E,toDirections:x||(!b||v?_:w),fovs:this.sceneFov,rotateDelays:S,showModel:m.model.show});case 42:h||this.pathLine.setViewDistance(0),this.updateTitle(l.show_text),this.curStepIndex=n?e:e+1,this.callBack(LM.OnStep,this.curStepIndex),this.curPid=l.pano_id,this.curPanoData=l;case 48:case"end":return t.stop()}}),t,this)}))),function(t){return E.apply(this,arguments)})},{key:"moveIndex",value:(M=mM(dM().mark((function t(e,n){return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.moveReady){t.next=2;break}return t.abrupt("return");case 2:if(null==n&&(n=m.move.auto),!this.stepMoving){t.next=7;break}this.targetStepIndex=e,t.next=16;break;case 7:if(this.callBack(LM.OnMoveStart),!n){t.next=13;break}return t.next=11,this.autoMoveStep(e);case 11:t.next=15;break;case 13:return t.next=15,this.moveOneStep(e);case 15:this.callBack(LM.OnMoveEnd);case 16:case"end":return t.stop()}}),t,this)}))),function(t,e){return M.apply(this,arguments)})},{key:"formatMoveSteps",value:function(t){for(var e,n,r=t.data.steps,i=r.length-2;i>=0;i--)""==r[i].pano_id||""!=r[i+1].pano_id&&"0"!=r[i+1].pano_id?""==r[i+1].pano_id||""!=r[i].pano_id&&"0"!=r[i].pano_id||(r[i].pano_id=r[i+1].pano_id):r[i+1].pano_id=r[i].pano_id;for(var o,s="",a=0,u=0;u<r.length;u++){var c=r[u],l=c.model_id,h=c.x,p=c.y;c.distance=0,c.index=u,c.pano_id=Number(c.pano_id),c.store_id=c.model_id,c.pos3=this.trans2T3Vector(l,h,p,.1),c.pos3||this.callBack(LM.OnError,"step commpute pos3 error step.pano_id ".concat(c.pano_id,", step.index ").concat(u)),c.rotateTime=0;var f=this.panoDataMap.get(c.pano_id);if(f){var d=f.quaternion;c.dir=new wM(1,0,0).applyQuaternion(d)}else c.dir=new wM(1,0,0),this.callBack(LM.OnError,"cont't find panoData by id, ".concat(c.pano_id,", index, ").concat(u)),g.error("cont't find panoData by id = ",c.pano_id,"index = ",u);e&&(e.moveDir=c.pos3.clone().sub(e.pos3).normalize(),e.distance=e.pos3.distanceTo(c.pos3),e.duration=e.distance/m.move.speed,c.moveDir=e.moveDir.clone(),c.store_id!=s&&(0===a?e.single=!0:e.moveDir=n.moveDir.clone())),n=e,e=c,s!=c.store_id?(s=c.store_id,a=0):a++}0===a&&(r[r.length-1].single=!0);for(var v=1;v<r.length;v++){var y=r[v-1],x=r[v];if(x.store_id==y.store_id){var b=c_.getAngleByVector(y.moveDir,x.moveDir);b>20&&(x.rotateTime=b/m.rotate.scale*1e3)}!o||o.pano_id!=y.pano_id||y.rotateTime?o=y:o.sameNext=v}this.moveDataSteps=r}},{key:"stopMove",value:(w=mM(dM().mark((function t(){var e=this;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t){e.isMoving()?e.stepStopResolve=t:t()})));case 1:case"end":return t.stop()}}),t)}))),function(){return w.apply(this,arguments)})},{key:"isMoving",value:function(){return this.stepMoving||this.stepJumping||this.initFlooring||this.panoramaMoving}},{key:"waitStopMove",value:(_=mM(dM().mark((function t(){return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.stopMove();case 2:this.targetIndex=-1,this.stepMoving=!1,this.stepJumping=!1,this.stepStopResolve=null,this.panoramaMoving=!1,this.updateTitle(""),this.tilePanoCtl&&(this.tilePanoCtl.updateLevelMax(Math.min(m.move.stayLevel,this.tileLevelMax)),this.tilePanoCtl.updateLevel());case 9:case"end":return t.stop()}}),t,this)}))),function(){return _.apply(this,arguments)})},{key:"setMoveSteps",value:(b=mM(dM().mark((function t(e,n){var r,i,o,s,a,u,c,l,h=this;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return g.time("displayShow"),t.next=3,this.waitStopMove();case 3:if(this.moveReady=!1,g.log("----------setMoveData--------------"),g.time("setMoveData time"),g.time("json pase"),"string"==typeof e&&(e=JSON.parse(e)),g.timeEnd("json pase"),g.time("store request"),this.stepMoving=!1,!(r=e.data.coordinate_3d_params)){t.next=17;break}return r.forEach((function(t){h.coordinateMap.set(t.model_id,t)})),i=r.map((function(t){return t.model_id})),t.next=17,this.getVRDataList(i);case 17:if(g.timeEnd("store request"),g.time("formatMoveSteps"),this.formatMoveSteps(e),g.timeEnd("formatMoveSteps"),o=this.moveDataSteps,s=this.curSceneData,a=this.pathImage,o.length){t.next=25;break}return g.error("empty move steps"),t.abrupt("return");case 25:if(u=this.curStepIndex=0,g.timeEnd("setMoveData time"),g.time("setMoveData time2"),c=o[u],l=function(){var t=h.getSameFloorStepsByIndex(u);g.log(t),h.expendPath(t,m.path.expendLength),h.setPath(t,a,m.path.heightOffset),h.updatePathByIndex(u,m.path.initLineDistance)},s&&s.store_id==c.model_id){t.next=39;break}return this.initFlooring=!0,this.curPid=c.pano_id,t.next=36,this.initFloorVR(c.model_id,c.pano_id,c.moveDir,!1,n,m.move.beginFovAnimation,l);case 36:this.initFlooring=!1,t.next=40;break;case 39:l();case 40:g.timeEnd("setMoveData time2"),this.moveReady=!0,this.callBack(LM.OnMoveReady);case 43:case"end":return t.stop()}}),t,this)}))),function(t,e){return b.apply(this,arguments)})},{key:"moveEndIndex",value:(x=mM(dM().mark((function t(){var e;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=this.moveDataSteps.length-1,t.next=3,this.moveIndex(e);case 3:case"end":return t.stop()}}),t,this)}))),function(){return x.apply(this,arguments)})},{key:"moveToFirstShowTextStep",value:(y=mM(dM().mark((function t(){var e,n;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=this.moveDataSteps,n=0;case 2:if(!(n<e.length)){t.next=9;break}if(!e[n].show_text){t.next=6;break}return t.abrupt("break",9);case 6:n++,t.next=2;break;case 9:return t.next=11,this.moveIndex(n);case 11:case"end":return t.stop()}}),t,this)}))),function(){return y.apply(this,arguments)})},{key:"showFirstShowText",value:(f=mM(dM().mark((function t(e){var n,r,i;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e){t.next=4;break}this.updateTitle(e),t.next=14;break;case 4:n=this.moveDataSteps,r=0;case 6:if(!(r<n.length)){t.next=14;break}if(!(i=n[r]).show_text){t.next=11;break}return this.updateTitle(i.show_text),t.abrupt("break",14);case 11:r++,t.next=6;break;case 14:case"end":return t.stop()}}),t,this)}))),function(t){return f.apply(this,arguments)})},{key:"moveOneStep",value:(p=mM(dM().mark((function t(e){var n,r;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.stepMoving=!0,t.next=3,this.moveStep(e);case 3:if(!(this.targetStepIndex>-1)){t.next=17;break}if(n=this.targetStepIndex,this.targetStepIndex=-1,n!=e){t.next=8;break}return t.abrupt("return");case 8:if(!(r=e===n-1)){t.next=12;break}return t.next=12,this.showChangeFloor(!0);case 12:return t.next=14,this.moveStep(n);case 14:if(!r){t.next=17;break}return t.next=17,this.showChangeFloor(!1);case 17:this.stepMoving=!1;case 18:case"end":return t.stop()}}),t,this)}))),function(t){return p.apply(this,arguments)})},{key:"autoMoveStep",value:(h=mM(dM().mark((function t(e){var n,r,i;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.stepJumping){t.next=3;break}return t.next=3,this.waitStopMove();case 3:if(this.tilePanoCtl.updateLevelMax(Math.min(m.move.moveLevel,this.tileLevelMax)),!(e<this.curStepIndex)){t.next=12;break}return t.next=7,this.autoJump(e);case 7:return this.tilePanoCtl.updateLevelMax(Math.min(m.move.stayLevel,this.tileLevelMax)),this.tilePanoCtl.updateLevel(),this.callBack(LM.OnMoveEnd),this.stepMoving=!1,t.abrupt("return");case 12:if(!this.stepStopResolve){t.next=16;break}return this.stepStopResolve(),g.log("autoMoveStep=========stepStopResolve"),t.abrupt("return");case 16:this.stepMoving=!0,n=e,r=this.curStepIndex;case 19:if(!(r<=n)){t.next=30;break}if(r==n-1&&this.tilePanoCtl.updateLevelMax(Math.min(m.move.stayLevel,this.tileLevelMax)),!this.stepStopResolve){t.next=23;break}return t.abrupt("break",30);case 23:return t.next=25,this.moveStep(r);case 25:if(!(this.targetStepIndex>-1)){t.next=27;break}return t.abrupt("break",30);case 27:r++,t.next=19;break;case 30:if(!this.stepStopResolve){t.next=33;break}return this.stepStopResolve(),t.abrupt("return");case 33:if(!(this.targetStepIndex>-1)){t.next=43;break}if(i=this.targetStepIndex,this.targetStepIndex=-1,i===this.curStepIndex+1){t.next=39;break}return t.next=39,this.autoJump(i);case 39:return t.next=41,this.autoMoveStep(i);case 41:t.next=46;break;case 43:this.tilePanoCtl.updateLevelMax(Math.min(m.move.stayLevel,this.tileLevelMax)),this.tilePanoCtl.updateLevel(),this.stepMoving=!1;case 46:case"end":return t.stop()}}),t,this)}))),function(t){return h.apply(this,arguments)})},{key:"autoJump",value:(l=mM(dM().mark((function t(e){var n,r,i,o,s,a;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.stepJumping=!0,n=this.moveDataSteps,r=this.curStepIndex,!m.move.jump){t.next=38;break}if(i=n[r],o=n[e],s=0,!(e>r)||m.move.jumpTo){t.next=30;break}a=r+1;case 8:if(!(a<e)){t.next=28;break}if(!this.stepStopResolve){t.next=11;break}return t.abrupt("break",28);case 11:if(i=n[a],!n[a+1]){t.next=23;break}if(!(i.store_id!==o.store_id||i.rotateTime||s+i.distance>=m.move.jumpDistance)){t.next=20;break}return t.next=17,this.moveStep(a);case 17:s=0,t.next=23;break;case 20:g.error("jump step",a),s+=i.distance,g.log(s);case 23:if(-1==this.targetStepIndex){t.next=25;break}return t.abrupt("break",28);case 25:a++,t.next=8;break;case 28:t.next=36;break;case 30:return t.next=32,this.showChangeFloor(!0);case 32:return t.next=34,this.moveStep(e,!0);case 34:return t.next=36,this.showChangeFloor(!1);case 36:t.next=40;break;case 38:return t.next=40,this.moveStep(e);case 40:this.stepJumping=!1;case 41:case"end":return t.stop()}}),t,this)}))),function(t){return l.apply(this,arguments)})},{key:"destroyPlugins",value:function(){this.plugins.forEach((function(t){return t.dispose()})),this.plugins.clear()}},{key:"destroy",value:(c=mM(dM().mark((function t(e){var n;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,this.rf&&window.cancelAnimationFrame(this.rf),v.a.removeAll(),kd.hub.eventMap.clear(),t.next=6,this.dispose(!0);case 6:this.disposeEvent(),this.updateTitle(""),this.destroyPlugins(),this.stage.disposeView(this.view),this.screen.dispose(),this.callBack(LM.OnDestroy),e&&this.cleanCb(),this.stepJumping=!1,this.stepMoving=!1,this.stage.dispose(),(n=this.container.getElementsByTagName("canvas")).length&&Array.from(n).forEach((function(t){t.remove()})),this.unRegistryContainerEvent(),this.stage=null,this.container=null,t.next=26;break;case 23:t.prev=23,t.t0=t.catch(0),console.log("destroy error",t.t0);case 26:case"end":return t.stop()}}),t,this,[[0,23]])}))),function(t){return c.apply(this,arguments)})},{key:"getPosByPID",value:function(t){var e=this.panoDataMap;return e.has(t)?e.get(t).position:null}},{key:"deleteRepeate",value:function(t){return Array.from(new Set(t))}},{key:"formatMovePanormas",value:function(t,e){var n=this,r=this.pathMap,i=this.panoDataMap,o=this.store2MovePanosMap,s=this.pano2IdnexMap,a=this.pathDataMap;o.clear(),r.clear(),s.clear(),a.clear();var u=0;t.forEach((function(t,c){var l=t.path,h=(t.store_id,t.pano_ids),p=l.map((function(t){return new wM(t.x,e?-t.y:t.y,0)})),f=n.deleteRepeate(h);t.pano_ids=f;var d=f.map((function(t,e){var r=i.get(t);return r||n.callBack(LM.OnError,"get pano data error, pano_id ".concat(t)),s.set(t,{tIndex:u,index:e}),u++,r.pathIndex=c,r}));if(1===p.length&&d[0]){var g=d[0].quaternion,v=new wM(1,0,0);v.applyQuaternion(g),v.multiplyScalar(.1),p.push(p[0].clone().add(v))}o.set(c,d),r.set(c,p);var y,x=0,b=[];if(h.length)for(var _=0;_<p.length;_++){var w={},M=p[_];w.pos=M.clone();var E=p[_+1],S=d[x],A=d[x+1],C=null;if(S.pds&&A&&A.position.distanceTo(M)<S.position.distanceTo(M)?(C=A,x++):C=S,E)w.moveDir=new wM(E.x-M.x,E.y-M.y,0),w.distance=w.moveDir.length(),w.moveDir.normalize(),w.duration=w.distance/m.move.speed;else{var T=b[_-1];T&&(w.moveDir=T.moveDir.clone(),w.distance=0,w.duration=0)}w.index=_,C.pds||(C.pds=[]),C.pds.push(w),b.push(w)}a.set(c,b);for(var P=0;P<b.length;P++){var I=b[P],L=b[P+1];if(I.rotateTime=0,L){var R=c_.getAngleByVector(I.moveDir,L.moveDir);R>20&&(I.rotateTime=R/m.rotate.scale*1e3)}}d.forEach((function(t){var n=t.pds;t.rotate=!1,t.ny=e,n||(n=t.pds=[]).push({distance:0,moveDir:y.moveDir.clone(),pos:y.pos.clone(),duration:0,index:y.index}),n.forEach((function(e){e.rotateTime&&(t.rotate=!0),y=e}))}))})),this.moveDataPanoramas=t}},{key:"getPanoSelfDirByPid",value:function(t){var e=this.panoDataMap.get(t).quaternion,n=new wM(1,0,0);return n.applyQuaternion(e),n}},{key:"getCurPanoSelfDir",value:function(){var t=this.tilePanoCtl.curPanorama,e=t.children[3].matrixWorld,n=new EM,r=new wM,i=new wM;return e.decompose(r,n,i),{euler:(new $r).setFromQuaternion(n),euler2:(new $r).setFromQuaternion(t.quaternion.clone().multiply((new EM).setFromEuler(new $r(Math.PI/2,0,0))))}}},{key:"getEulerByquaternion",value:function(t){var e=t.direction_w,n=t.direction_x,r=t.direction_y,i=t.direction_z,o=new EM(n,r,i,e);return o.multiply((new EM).setFromEuler(new $r(Math.PI/2,0,0))),(new $r).setFromQuaternion(o)}},{key:"getDirByQue2",value:function(t){var e=t._w,n=t._x,r=t._y,i=t._z,o=new EM(n,r,i,e),s=(new $r).setFromQuaternion(o),a=new di;a.quaternion.copy(o);var u=(new SM).makeRotationFromEuler(new $r(Math.PI/2,0,0));return a.matrix.multiply(u),{euler:a.rotation,dir:s}}},{key:"getPanoByVector",value:function(t,e){if(!e.length)return null;for(var n=e[0],r=t.distanceTo(n.position),i=1;i<e.length;i++){var o=e[i],s=t.distanceTo(o.position);s<r&&(n=o,r=s)}return n}},{key:"getPositionByPId",value:function(t){var e=this.panoDataMap.get(t);if(e)return e.position}},{key:"setMovePanoramas",value:(u=mM(dM().mark((function t(e){var n,r,i,o,s,a,u,c,l,h,p,f,d,g,v,y,x,b,_=arguments;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=_.length>1&&void 0!==_[1]&&_[1],r=_.length>2?_[2]:void 0,i=_.length>3?_[3]:void 0,t.next=5,this.waitStopMove();case 5:return"string"==typeof e&&(e=JSON.parse(e)),o=[],e.forEach((function(t){o.push(t.store_id)})),t.next=10,this.getVRDataList(o);case 10:return this.formatMovePanormas(e,n),this.curStoreIndex=0,s=this.moveDataPanoramas,a=this.store2MovePanosMap,u=this.pathMap,c=this.pathImage,l=this.panoDataMap,h=s[this.curStoreIndex],p=h.store_id,f=a.get(this.curStoreIndex),d=f[0],g=d.pid,v=d.pds,this.curPid=g,this.curPanoData=d,y=v[v.length-1].moveDir.clone(),i&&(i.addDir&&y.add(new wM(i.addDir.x,i.addDir.y,i.addDir.z)),i.dir&&(y=new wM(i.dir.x,i.dir.y,i.dir.z)),i.target&&(x=l.get(g),y=new wM(i.target.x,i.target.y,i.target.z).sub(x.position).normalize())),t.next=24,this.initFloorVR(p,g,y,r);case 24:b=u.get(this.curStoreIndex),this.setPath(b,c,m.path.heightOffset),this.updatePathByPid(g);case 27:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"jumpToPanorama",value:(a=mM(dM().mark((function t(e,n){var r,i,o,s,a,u,c,l,h,p,f,d;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.curPid,i=this.panoDataMap,o=this.pano2IdnexMap,s=this.store2MovePanosMap,a=this.stepJumpMax,u=i.get(r),c=i.get(e),l=o.get(r).index,h=o.get(e).index,p=s.get(c.pathIndex),!n){t.next=11;break}if(!(--h<0)){t.next=10;break}return t.abrupt("return");case 10:e=p[h].pid;case 11:if(!m.move.jump){t.next=46;break}if(!(u.storeId!==c.storeId||a&&h-l>a)){t.next=21;break}return t.next=15,this.showChangeFloor(!0);case 15:return t.next=17,this.movePanoramaStep(e);case 17:return t.next=19,this.showChangeFloor(!1);case 19:t.next=46;break;case 21:if(!(l>h)){t.next=32;break}if(!this.moveToBackShowImage){t.next=25;break}return t.next=25,this.showChangeFloor(!0);case 25:return t.next=27,this.movePanoramaStep(e);case 27:if(!this.moveToBackShowImage){t.next=30;break}return t.next=30,this.showChangeFloor(!1);case 30:t.next=46;break;case 32:f=l+1;case 33:if(!(f<=h)){t.next=46;break}if(-1==this.targetPid){t.next=36;break}return t.abrupt("break",46);case 36:if(u=p[f],d=p[f+1],!(u.rotate||d&&d.rotate)){t.next=41;break}return t.next=41,this.movePanoramaStep(u.pid);case 41:if(!this.stepStopResolve){t.next=43;break}return t.abrupt("break",46);case 43:f++,t.next=33;break;case 46:case"end":return t.stop()}}),t,this)}))),function(t,e){return a.apply(this,arguments)})},{key:"setMoveClick",value:function(t){if(this.moveClick!==t){this.moveClick=t;var e=this.tilePanoCtl;e&&(e.moveOnClick=t)}}},{key:"jumpToPanoramaWithoutPath",value:(s=mM(dM().mark((function t(e,n,r){var i,o,s,a,u;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getVRDataList(e);case 2:if(i=this.panoDataMap.get(this.curPid),o=this.panoDataMap.get(n),i||this.callBack(LM.OnError),a=(s=r||{}).dir,u=s.target,a?a=new pr(a.x,a.y,a.z):u&&(a=new pr(u.x,u.y,u.z).sub(u.data.position)),i&&o.storeId===i.storeId){t.next=12;break}return t.next=10,this.initFloorVR(e,n,a,!!i);case 10:t.next=18;break;case 12:return t.next=14,this.showChangeFloor(!0);case 14:return t.next=16,this.moveToPanoramWithoutPath(n,r);case 16:return t.next=18,this.showChangeFloor(!1);case 18:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return s.apply(this,arguments)})},{key:"jumpToPanoramaWithCustomerData",value:(o=mM(dM().mark((function t(e,n,r){var i,o,s,a,u,c,l;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i="customer"+Math.random().toString(36).substring(2),e&&(this.sceneDataMap.set(i,e),o=e.data,this.getPanoramaData(i,o.panorama_list)),s=this.panoDataMap.get(this.curPid),a=this.panoDataMap.get(n),s||this.callBack(LM.OnError),c=(u=r||{}).dir,l=u.target,c?c=new pr(c.x,c.y,c.z):l&&(c=new pr(l.x,l.y,l.z).sub(l.data.position)),s&&a.storeId===s.storeId){t.next=12;break}return t.next=10,this.initFloorVR(i,n,c,!!s);case 10:t.next=18;break;case 12:return t.next=14,this.showChangeFloor(!0);case 14:return t.next=16,this.moveToPanoramWithoutPath(n,r);case 16:return t.next=18,this.showChangeFloor(!1);case 18:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return o.apply(this,arguments)})},{key:"getTargetDistanceByPid",value:function(t,e){for(var n,r=this.panoDataMap,i=this.store2MovePanosMap,o=this.pano2IdnexMap,s=r.get(t),a=o.get(t).index,u=i.get(s.pathIndex),c=!1,l=0,h=a;h<u.length;h++){for(var p=u[h].pds,f=0;f<p.length;f++){var d=p[f];if(l+d.distance>e)break;if(d.rotateTime){c=!0;break}l+=d.distance}if(c)break}c&&(l+=null!==(n=m.path.rotateCount)&&void 0!==n?n:1);return l>=e&&(l=e),Math.max(m.path.minViewDistance,l)}},{key:"getMergeMoveDir",value:function(t){for(var e=t[0].moveDir.clone(),n=1;n<t.length;n++)e.add(t[n].moveDir);return e.normalize(),e}},{key:"getClosestPd",value:function(t,e,n){var r=e[0];if(n)return e[e.length-1];for(var i=t.distanceTo(r.pos),o=1;o<e.length;o++){var s=e[o],a=t.distanceTo(s.pos);a<i&&(i=a,r=s,o)}return r}},{key:"movePanoramaStep",value:(i=mM(dM().mark((function t(e,n,r){var i,o,s,a,u,c,l,h,p,f,d,y,x,b,_,w,M,E,S,A,C,T,P,I,L,R,O,D,B,F,N,k;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(g.log("movePanoramaStep",e,n),i=this.panoDataMap,o=this.curPid,s=this.pathMap,a=this.tilePanoCtl,u=this.timeScale,c=this.pathImage,l=i.get(e)){t.next=6;break}return g.error("pid not exist"),t.abrupt("return");case 6:if(p=(h=r=r||{}).dir,f=h.addDir,d=h.target,y=h.fov,x=h.lookEnd,b=i.get(o),_=l.storeId,w=l.pathIndex,M=l.pds,E=n?new wM(n.x,l.ny?-n.y:n.y,0):l.position,l.position&&g.log("distance",E.distanceTo(l.position),l.position),S=this.getClosestPd(E,M,x),A=S.rotateTime,C=S.moveDir,p?C=new wM(p.x,p.y,p.z).normalize():f&&(C=C.clone().add(new wM(f.x,f.y,f.z)).normalize()),d&&(C=new wM(d.x,d.y,d.z).sub(l.position).normalize()),g.log("moveDir",C),T=!1,b.storeId!=_&&(T=!0),P=!1,o!==e&&(P=!0),L=(I=2e3)-(1e3+.3*A),L*=u,I*=u,!T){t.next=36;break}return t.next=30,this.initFloorVR(_,e,C,!0);case 30:R=s.get(w),this.setPath(R,c,m.path.heightOffset),this.updatePathByPid(e),this.callBack(LM.OnSwitch,_),t.next=38;break;case 36:O=this.pathLine,D=this.view,P&&(B=O.getViewDistance(),F=this.getTargetDistanceByPid(e,this.pathLineViewDistance),N=Math.min(F/2,4),k=O.uniforms.gradientDistance.value,new v.a.Tween({viewDist:B,gradDist:k}).to({viewDist:F,gradDist:N},I).onUpdate((function(t){var e=t.viewDist,n=t.gradDist;if(O){var r=O.getNearestPoint(D.camera.position).distance;O.setCurrent(r),O.setViewDistance(e),O.uniforms.gradientDistance.value=n}})).start());case 38:return t.next=40,a.moveInPath([e],{intervals:I,toDirections:C,fovs:null==y?this.sceneFov:y,rotateDelays:L,showModel:m.model.show});case 40:this.curPid=e;case 41:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return i.apply(this,arguments)})},{key:"moveToPanorama",value:(r=mM(dM().mark((function t(e,n,r){var i,o,s,a,u;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=this.panoramaMoving,o=this.curPid,i){t.next=29;break}if(this.panoramaMoving=!0,e==o){t.next=10;break}return t.next=6,this.jumpToPanorama(e,!0);case 6:if(!this.stepStopResolve){t.next=8;break}return t.abrupt("return",this.stepStopResolve());case 8:t.next=15;break;case 10:if(!m.move.jumpSame){t.next=15;break}if(this.panoramaMoving=!1,!this.stepStopResolve){t.next=14;break}return t.abrupt("return",this.stepStopResolve());case 14:return t.abrupt("return");case 15:return t.next=17,this.movePanoramaStep(e,n,r);case 17:if(this.panoramaMoving=!1,s=this.targetPid,a=this.targetPos,u=this.targetLookParam,-1!=s&&(this.targetPid=-1,this.targetDir=null),!this.stepStopResolve){t.next=24;break}return t.abrupt("return",this.stepStopResolve());case 24:if(-1==s){t.next=27;break}return t.next=27,this.moveToPanorama(s,a,u);case 27:t.next=32;break;case 29:this.targetPid=e,this.targetPos=n,this.targetLookParam=r;case 32:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return r.apply(this,arguments)})},{key:"moveToPanoramWithoutPath",value:(n=mM(dM().mark((function t(e,n){var r,i,o,s,a,u,c;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=(r=n||{}).dir,o=r.target,s=r.fov,a=r.time,u={},i&&(u.toDirections=new wM(i.x,i.y,i.z)),o&&(u.lookAtTargets=new wM(o.x,o.y,o.z)),s&&(u.fovs=s),u.intervals=a||1e3,(c=this.pano2IdnexMap.get(this.curPid))&&this.pano2IdnexMap.set(e,{index:c.index}),t.next=10,this.tilePanoCtl.moveInPath([e],u);case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return n.apply(this,arguments)})},{key:"getPidByIndex",value:function(t){for(var e=this.moveDataPanoramas,n=0,r=-1,i=0;i<e.length;i++){var o=e[i];if(t<n+o.pano_ids.length){r=o.pano_ids[t-n];break}n+=o.pano_ids.length}return r}},{key:"moveToPanoramaByIndex",value:(e=mM(dM().mark((function t(e){var n;return dM().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!((n=this.getPidByIndex(e))>-1)){t.next=4;break}return t.next=4,this.moveToPanorama(n);case 4:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"onPanoramaCameraChanged",value:function(t,e){try{var n=this.moveDataSteps,r=this.curStepIndex,i=new EM(e.x,e.y,e.z,e.w),o=new wM(1,0,0).applyQuaternion(i),s={type:"CameraChanged",position:t,quaternion:e,dir:o},a=new wM(o.x,o.y,0).normalize(),u=new MM(1,0,0),c=c_.getAngleByVector2(a,u);n&&r&&n[r]&&(s.floor=n[r].floor,s.data=e),s=JSON.stringify(s),this.lastOnRollStr!=s&&(this.callBack(LM.OnRoll,s,c),this.lastOnRollStr=s)}catch(t){}}},{key:"onSelected",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];this.callBack.apply(this,[LM.OnSelected].concat(e))}},{key:"initEvent",value:function(){var t=this;this.handleElementLoaded=function(e,n){t.waitModel===e&&t.floorModelResolve&&(t.floorModelResolve(e,n),t.floorModelResolve=null,t.waitModel=null)},kd.on(Ud.ELEMENT_LOADED,this.handleElementLoaded),kd.on(Ud.ELEMENT_LOADED_ERROR,this.handleElementLoaded),this.handleSelected=function(){t.onSelected.apply(t,arguments)},kd.on(Ud.ELEMENT_SELECTED,this.handleSelected),this.handleOnPanoramaCameraChanged=function(){t.onPanoramaCameraChanged.apply(t,arguments)},kd.on(Ud.CAMERA_CHANGED,this.handleOnPanoramaCameraChanged),this.handleMoveToPano=function(e){g.log("handleMoveToPano",e),t.curPid=e,t.callBack(LM.OnPanorama,e);var n=t.panoDataMap.get(e),r=t.gisAlignMap.get(n.storeId);if(r){var i=r.get(e);i&&t.callBack(LM.OnGisPos,i.gis)}},kd.on(Ud.MOVE_TO_PANORAMA,this.handleMoveToPano)}},{key:"disposeEvent",value:function(){kd.off(Ud.ELEMENT_LOADED,this.handleElementLoaded),kd.off(Ud.ELEMENT_SELECTED,this.handleSelected),kd.off(Ud.CAMERA_CHANGED,this.handleOnPanoramaCameraChanged),kd.off(Ud.MOVE_TO_PANORAMA,this.handleMoveToPano)}},{key:"setTouchesEnabled",value:function(t){this.basicCtl&&this.basicCtl.setTouchesEnabled(t),this.tilePanoCtl&&this.tilePanoCtl.setTouchesEnabled(t)}},{key:"onWindowResize",value:function(t,e){this.stage&&this.stage.onWindowResize(t,e)}},{key:"getNowDirection",value:function(){if(this.basicCtl)return this.basicCtl.target.clone().sub(this.basicCtl.camera.position).normalize()}}],[{key:"SmoothPath",value:function(t){var e=[];t.forEach((function(t){e.push([t.x,t.y,0])}));var n,r=[];if(e.forEach((function(t){r.push({x:t[0],y:t[1]})})),m.path.simplify){var i=m.path.maxTurningDegree||170,o=Kx.simplify(r,!1,!0,5,i);n=Kx.smoothPath(o.map((function(t){return[t.x,t.y]})))}else n=Kx.smoothPath(r.map((function(t){return[t.x,t.y]})));var s=[];return n.forEach((function(t){s.push([t[0],t[1],0])})),s}}]);var e,n,r,i,o,s,a,u,c,l,h,p,f,y,x,b,_,w,M,E,S,A,C,T,P,I,L,R,O,D,B,F,N,k}()},JBy8:function(t,e,n){"use strict";var r=n("yoRg"),i=n("eDl+").concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,i)}},JEQr:function(t,e,n){"use strict";(function(e){var r=n("xTJ+"),i=n("yK9s"),o={"Content-Type":"application/x-www-form-urlencoded"};function s(t,e){!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var a,u={adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==e&&"[object process]"===Object.prototype.toString.call(e))&&(a=n("tQ2B")),a),transformRequest:[function(t,e){return i(e,"Accept"),i(e,"Content-Type"),r.isFormData(t)||r.isArrayBuffer(t)||r.isBuffer(t)||r.isStream(t)||r.isFile(t)||r.isBlob(t)?t:r.isArrayBufferView(t)?t.buffer:r.isURLSearchParams(t)?(s(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):r.isObject(t)?(s(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(t){return t>=200&&t<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],(function(t){u.headers[t]={}})),r.forEach(["post","put","patch"],(function(t){u.headers[t]=r.merge(o)})),t.exports=u}).call(this,n("8oxB"))},JRS9:function(t,e,n){"use strict";var r=n("uPr3"),i=Array.prototype.concat,o=Array.prototype.slice,s=t.exports=function(t){for(var e=[],n=0,s=t.length;n<s;n++){var a=t[n];r(a)?e=i.call(e,o.call(a)):e.push(a)}return e};s.wrap=function(t){return function(){return t(s(arguments))}}},JTJg:function(t,e,n){"use strict";var r=n("I+eb"),i=n("4zBA"),o=n("WjRb"),s=n("HYAF"),a=n("V37c"),u=n("qxPZ"),c=i("".indexOf);r({target:"String",proto:!0,forced:!u("includes")},{includes:function(t){return!!~c(a(s(this)),a(o(t)),arguments.length>1?arguments[1]:void 0)}})},JaFt:function(t,e,n){"use strict";var r=n("67WC"),i=n("1Y/n").right,o=r.aTypedArray;(0,r.exportTypedArrayMethod)("reduceRight",(function(t){var e=arguments.length;return i(o(this),t,e,e>1?arguments[1]:void 0)}))},JfAA:function(t,e,n){"use strict";var r=n("Xnc8").PROPER,i=n("yy0I"),o=n("glrk"),s=n("V37c"),a=n("0Dky"),u=n("kNi0"),c=RegExp.prototype,l=c.toString,h=a((function(){return"/a/b"!==l.call({source:"a",flags:"b"})})),p=r&&"toString"!==l.name;(h||p)&&i(c,"toString",(function(){var t=o(this);return"/"+s(t.source)+"/"+s(u(t))}),{unsafe:!0})},JiZb:function(t,e,n){"use strict";var r=n("0GbY"),i=n("7dAM"),o=n("tiKp"),s=n("g6v/"),a=o("species");t.exports=function(t){var e=r(t);s&&e&&!e[a]&&i(e,a,{configurable:!0,get:function(){return this}})}},JsjR:function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("8LQ0"),a=n("/OYL"),u=n("RUZL"),c=n("13ei"),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype._sceneFunc=function(t){var e,n,r,i=this.sides(),o=this.radius();for(t.beginPath(),t.moveTo(0,0-o),e=1;e<i;e++)n=o*Math.sin(2*e*Math.PI/i),r=-1*o*Math.cos(2*e*Math.PI/i),t.lineTo(n,r);t.closePath(),t.fillStrokeShape(this)},e.prototype.getWidth=function(){return 2*this.radius()},e.prototype.getHeight=function(){return 2*this.radius()},e.prototype.setWidth=function(t){this.radius(t/2)},e.prototype.setHeight=function(t){this.radius(t/2)},e}(a.Shape);e.RegularPolygon=l,l.prototype.className="RegularPolygon",l.prototype._centroid=!0,l.prototype._attrsAffectingSize=["radius"],c._registerNode(l),s.Factory.addGetterSetter(l,"radius",0,u.getNumberValidator()),s.Factory.addGetterSetter(l,"sides",0,u.getNumberValidator()),o.Collection.mapMethods(l)},K6Rb:function(t,e,n){"use strict";var r=n("QNWe"),i=Function.prototype,o=i.apply,s=i.call;t.exports="object"==typeof Reflect&&Reflect.apply||(r?s.bind(o):function(){return s.apply(o,arguments)})},KVSy:function(t,e,n){"use strict";var r=n("67WC"),i=n("0Dky"),o=n("82ph"),s=r.aTypedArray,a=r.getTypedArrayConstructor;(0,r.exportTypedArrayMethod)("slice",(function(t,e){for(var n=o(s(this),t,e),r=a(this),i=0,u=n.length,c=new r(u);u>i;)c[i]=n[i++];return c}),i((function(){new Int8Array(1).slice()})))},"KgF/":function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("8LQ0"),a=n("/OYL"),u=n("jBiz"),c=n("VBTO"),l=n("RUZL"),h=n("13ei");function p(t){t.fillText(this.partialText,0,0)}function f(t){t.strokeText(this.partialText,0,0)}var d=function(t){function e(e){var n=t.call(this,e)||this;return n.dummyCanvas=o.Util.createCanvasElement(),n.dataArray=[],n.dataArray=u.Path.parsePathData(n.attrs.data),n.on("dataChange.konva",(function(){this.dataArray=u.Path.parsePathData(this.attrs.data),this._setTextData()})),n.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva",n._setTextData),e&&e.getKerning&&(o.Util.warn('getKerning TextPath API is deprecated. Please use "kerningFunc" instead.'),n.kerningFunc(e.getKerning)),n._setTextData(),n}return i(e,t),e.prototype._sceneFunc=function(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var e=this.textDecoration(),n=this.fill(),r=this.fontSize(),i=this.glyphInfo;"underline"===e&&t.beginPath();for(var o=0;o<i.length;o++){t.save();var s=i[o].p0;t.translate(s.x,s.y),t.rotate(i[o].rotation),this.partialText=i[o].text,t.fillStrokeShape(this),"underline"===e&&(0===o&&t.moveTo(0,r/2+1),t.lineTo(r,r/2+1)),t.restore()}"underline"===e&&(t.strokeStyle=n,t.lineWidth=r/20,t.stroke()),t.restore()},e.prototype._hitFunc=function(t){t.beginPath();var e=this.glyphInfo;if(e.length>=1){var n=e[0].p0;t.moveTo(n.x,n.y)}for(var r=0;r<e.length;r++){var i=e[r].p1;t.lineTo(i.x,i.y)}t.setAttr("lineWidth",this.fontSize()),t.setAttr("strokeStyle",this.colorKey),t.stroke()},e.prototype.getTextWidth=function(){return this.textWidth},e.prototype.getTextHeight=function(){return o.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight},e.prototype.setText=function(t){return c.Text.prototype.setText.call(this,t)},e.prototype._getContextFont=function(){return c.Text.prototype._getContextFont.call(this)},e.prototype._getTextSize=function(t){var e=this.dummyCanvas.getContext("2d");e.save(),e.font=this._getContextFont();var n=e.measureText(t);return e.restore(),{width:n.width,height:parseInt(this.attrs.fontSize,10)}},e.prototype._setTextData=function(){var t=this,e=this._getTextSize(this.attrs.text),n=this.letterSpacing(),r=this.align(),i=this.kerningFunc();this.textWidth=e.width,this.textHeight=e.height;var o=Math.max(this.textWidth+((this.attrs.text||"").length-1)*n,0);this.glyphInfo=[];for(var s=0,a=0;a<t.dataArray.length;a++)t.dataArray[a].pathLength>0&&(s+=t.dataArray[a].pathLength);var c=0;"center"===r&&(c=Math.max(0,s/2-o/2)),"right"===r&&(c=Math.max(0,s-o));for(var l,h,p,f=this.text().split(""),d=this.text().split(" ").length-1,g=-1,m=0,v=function(){m=0;for(var e=t.dataArray,n=g+1;n<e.length;n++){if(e[n].pathLength>0)return g=n,e[n];"M"===e[n].command&&(l={x:e[n].points[0],y:e[n].points[1]})}return{}},y=function(e){var i=t._getTextSize(e).width+n;" "===e&&"justify"===r&&(i+=(s-o)/d);var a=0,c=0;for(h=void 0;Math.abs(i-a)/i>.01&&c<25;){c++;for(var f=a;void 0===p;)(p=v())&&f+p.pathLength<i&&(f+=p.pathLength,p=void 0);if(p==={}||void 0===l)return;var g=!1;switch(p.command){case"L":u.Path.getLineLength(l.x,l.y,p.points[0],p.points[1])>i?h=u.Path.getPointOnLine(i,l.x,l.y,p.points[0],p.points[1],l.x,l.y):p=void 0;break;case"A":var y=p.points[4],x=p.points[5],b=p.points[4]+x;0===m?m=y+1e-8:i>a?m+=Math.PI/180*x/Math.abs(x):m-=Math.PI/360*x/Math.abs(x),(x<0&&m<b||x>=0&&m>b)&&(m=b,g=!0),h=u.Path.getPointOnEllipticalArc(p.points[0],p.points[1],p.points[2],p.points[3],m,p.points[6]);break;case"C":0===m?m=i>p.pathLength?1e-8:i/p.pathLength:i>a?m+=(i-a)/p.pathLength:m-=(a-i)/p.pathLength,m>1&&(m=1,g=!0),h=u.Path.getPointOnCubicBezier(m,p.start.x,p.start.y,p.points[0],p.points[1],p.points[2],p.points[3],p.points[4],p.points[5]);break;case"Q":0===m?m=i/p.pathLength:i>a?m+=(i-a)/p.pathLength:m-=(a-i)/p.pathLength,m>1&&(m=1,g=!0),h=u.Path.getPointOnQuadraticBezier(m,p.start.x,p.start.y,p.points[0],p.points[1],p.points[2],p.points[3])}void 0!==h&&(a=u.Path.getLineLength(l.x,l.y,h.x,h.y)),g&&(g=!1,p=void 0)}},x=c/(t._getTextSize("C").width+n)-1,b=0;b<x&&(y("C"),void 0!==l&&void 0!==h);b++)l=h;for(var _=0;_<f.length&&(y(f[_]),void 0!==l&&void 0!==h);_++){var w=u.Path.getLineLength(l.x,l.y,h.x,h.y),M=0;if(i)try{M=i(f[_-1],f[_])*this.fontSize()}catch(t){M=0}l.x+=M,h.x+=M,this.textWidth+=M;var E=u.Path.getPointOnLine(M+w/2,l.x,l.y,h.x,h.y),S=Math.atan2(h.y-l.y,h.x-l.x);this.glyphInfo.push({transposeX:E.x,transposeY:E.y,text:f[_],rotation:S,p0:l,p1:h}),l=h}},e.prototype.getSelfRect=function(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};var t=[];this.glyphInfo.forEach((function(e){t.push(e.p0.x),t.push(e.p0.y),t.push(e.p1.x),t.push(e.p1.y)}));for(var e,n,r=t[0]||0,i=t[0]||0,o=t[1]||0,s=t[1]||0,a=0;a<t.length/2;a++)e=t[2*a],n=t[2*a+1],r=Math.min(r,e),i=Math.max(i,e),o=Math.min(o,n),s=Math.max(s,n);var u=this.fontSize();return{x:r-u/2,y:o-u/2,width:i-r+u,height:s-o+u}},e}(a.Shape);e.TextPath=d,d.prototype._fillFunc=p,d.prototype._strokeFunc=f,d.prototype._fillFuncHit=p,d.prototype._strokeFuncHit=f,d.prototype.className="TextPath",d.prototype._attrsAffectingSize=["text","fontSize","data"],h._registerNode(d),s.Factory.addGetterSetter(d,"data"),s.Factory.addGetterSetter(d,"fontFamily","Arial"),s.Factory.addGetterSetter(d,"fontSize",12,l.getNumberValidator()),s.Factory.addGetterSetter(d,"fontStyle","normal"),s.Factory.addGetterSetter(d,"align","left"),s.Factory.addGetterSetter(d,"letterSpacing",0,l.getNumberValidator()),s.Factory.addGetterSetter(d,"textBaseline","middle"),s.Factory.addGetterSetter(d,"fontVariant","normal"),s.Factory.addGetterSetter(d,"text",""),s.Factory.addGetterSetter(d,"textDecoration",null),s.Factory.addGetterSetter(d,"kerningFunc",null),o.Collection.mapMethods(d)},KmKo:function(t,e,n){"use strict";var r=n("xluM"),i=n("glrk"),o=n("3Eq5");t.exports=function(t,e,n){var s,a;i(t);try{if(!(s=o(t,"return"))){if("throw"===e)throw n;return n}s=r(s,t)}catch(t){a=!0,s=t}if("throw"===e)throw n;if(a)throw s;return i(s),n}},L7LI:function(t,e,n){"use strict";var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var o=n("nLhi"),s=n("6mFz"),a=n("1q+a"),u=n("13ei"),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype._validateAdd=function(t){"Shape"!==t.getType()&&o.Util.throw("You may only add shapes to a fast layer.")},e.prototype._setCanvasSize=function(t,e){this.canvas.setSize(t,e),this._checkSmooth()},e.prototype.hitGraphEnabled=function(){return!1},e.prototype.drawScene=function(t){var e=this.getLayer(),n=t||e&&e.getCanvas();return this.clearBeforeDraw()&&n.getContext().clear(),s.Container.prototype.drawScene.call(this,n),this},e.prototype.draw=function(){return this.drawScene(),this},e}(a.BaseLayer);e.FastLayer=c,c.prototype.nodeType="FastLayer",u._registerNode(c),o.Collection.mapMethods(c)},LKj3:function(t,e,n){"use strict";var r=n("I+eb"),i=n("z+kr"),o=n("IMxJ")(i.setInterval,!0);r({global:!0,bind:!0,forced:i.setInterval!==o},{setInterval:o})},LPSS:function(t,e,n){"use strict";var r,i,o,s,a=n("z+kr"),u=n("K6Rb"),c=n("A2ZE"),l=n("Fib7"),h=n("Gi26"),p=n("0Dky"),f=n("G+Rx"),d=n("82ph"),g=n("zBJ4"),m=n("1tal"),v=n("UsjB"),y=n("mtxD"),x=a.setImmediate,b=a.clearImmediate,_=a.process,w=a.Dispatch,M=a.Function,E=a.MessageChannel,S=a.String,A=0,C={};p((function(){r=a.location}));var T=function(t){if(h(C,t)){var e=C[t];delete C[t],e()}},P=function(t){return function(){T(t)}},I=function(t){T(t.data)},L=function(t){a.postMessage(S(t),r.protocol+"//"+r.host)};x&&b||(x=function(t){m(arguments.length,1);var e=l(t)?t:M(t),n=d(arguments,1);return C[++A]=function(){u(e,void 0,n)},i(A),A},b=function(t){delete C[t]},y?i=function(t){_.nextTick(P(t))}:w&&w.now?i=function(t){w.now(P(t))}:E&&!v?(s=(o=new E).port2,o.port1.onmessage=I,i=c(s.postMessage,s)):a.addEventListener&&l(a.postMessage)&&!a.importScripts&&r&&"file:"!==r.protocol&&!p(L)?(i=L,a.addEventListener("message",I,!1)):i="onreadystatechange"in g("script")?function(t){f.appendChild(g("script")).onreadystatechange=function(){f.removeChild(this),T(t)}}:function(t){setTimeout(P(t),0)}),t.exports={set:x,clear:b}},"LRa+":function(t,e,n){!function(){"use strict";var e=Math.abs,r=Math.min,i=Math.max,o=Math.cos,s=Math.sin,a=Math.acos,u=Math.sqrt,c=Math.PI,l={x:0,y:0,z:0},h=n("2As9"),p=n("D3+e"),f=function(t){var n=t&&t.forEach?t:[].slice.call(arguments),r=!1;if("object"==typeof n[0]){r=n.length;var i=[];n.forEach((function(t){["x","y","z"].forEach((function(e){void 0!==t[e]&&i.push(t[e])}))})),n=i}var o=!1,s=n.length;if(r){if(r>4){if(1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");o=!0}}else if(6!==s&&8!==s&&9!==s&&12!==s&&1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");var a=!o&&(9===s||12===s)||t&&t[0]&&void 0!==t[0].z;this._3d=a;for(var u=[],c=0,l=a?3:2;c<s;c+=l){var p={x:n[c],y:n[c+1]};a&&(p.z=n[c+2]),u.push(p)}this.order=u.length-1,this.points=u;var f=["x","y"];a&&f.push("z"),this.dims=f,this.dimlen=f.length,function(t){for(var n=t.order,r=t.points,i=h.align(r,{p1:r[0],p2:r[n]}),o=0;o<i.length;o++)if(e(i[o].y)>1e-4)return void(t._linear=!1);t._linear=!0}(this),this._t1=0,this._t2=1,this.update()},d=n("TDvD");function g(t,e,n,r,i){void 0===i&&(i=.5);var o=h.projectionratio(i,t),s=1-o,a={x:o*e.x+s*r.x,y:o*e.y+s*r.y},u=h.abcratio(i,t);return{A:{x:n.x+(n.x-a.x)/u,y:n.y+(n.y-a.y)/u},B:n,C:a}}f.SVGtoBeziers=function(t){return d(f,t)},f.quadraticFromPoints=function(t,e,n,r){if(void 0===r&&(r=.5),0===r)return new f(e,e,n);if(1===r)return new f(t,e,e);var i=g(2,t,e,n,r);return new f(t,i.A,n)},f.cubicFromPoints=function(t,e,n,r,i){void 0===r&&(r=.5);var o=g(3,t,e,n,r);void 0===i&&(i=h.dist(e,o.C));var s=i*(1-r)/r,a=h.dist(t,n),u=(n.x-t.x)/a,c=(n.y-t.y)/a,l=i*u,p=i*c,d=s*u,m=s*c,v=e.x-l,y=e.y-p,x=e.x+d,b=e.y+m,_=o.A,w=_.x+(v-_.x)/(1-r),M=_.y+(y-_.y)/(1-r),E=_.x+(x-_.x)/r,S=_.y+(b-_.y)/r,A={x:t.x+(w-t.x)/r,y:t.y+(M-t.y)/r},C={x:n.x+(E-n.x)/(1-r),y:n.y+(S-n.y)/(1-r)};return new f(t,A,C,n)};var m=function(){return h};f.getUtils=m,f.PolyBezier=p,f.prototype={getUtils:m,valueOf:function(){return this.toString()},toString:function(){return h.pointsToString(this.points)},toSVG:function(t){if(this._3d)return!1;for(var e=this.points,n=["M",e[0].x,e[0].y,2===this.order?"Q":"C"],r=1,i=e.length;r<i;r++)n.push(e[r].x),n.push(e[r].y);return n.join(" ")},setRatios:function(t){if(t.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=t,this._lut=[]},verify:function(){var t=this.coordDigest();t!==this._print&&(this._print=t,this.update())},coordDigest:function(){return this.points.map((function(t,e){return""+e+t.x+t.y+(t.z?t.z:0)})).join("")},update:function(t){this._lut=[],this.dpoints=h.derive(this.points,this._3d),this.computedirection()},computedirection:function(){var t=this.points,e=h.angle(t[0],t[this.order],t[1]);this.clockwise=e>0},length:function(){return h.length(this.derivative.bind(this))},_lut:[],getLUT:function(t){if(this.verify(),t=t||100,this._lut.length===t)return this._lut;this._lut=[],t--;for(var e=0;e<=t;e++)this._lut.push(this.compute(e/t));return this._lut},on:function(t,e){e=e||5;for(var n,r=this.getLUT(),i=[],o=0,s=0;s<r.length;s++)n=r[s],h.dist(n,t)<e&&(i.push(n),o+=s/r.length);return!!i.length&&o/i.length},project:function(t){var e,n,r,i,o=this.getLUT(),s=o.length-1,a=h.closest(o,t),u=a.mdist,c=a.mpos,l=(c+1)/s,p=.1/s;for(u+=1,e=n=(c-1)/s;n<l+p;n+=p)r=this.compute(n),(i=h.dist(t,r))<u&&(u=i,e=n);return(r=this.compute(e)).t=e,r.d=u,r},get:function(t){return this.compute(t)},point:function(t){return this.points[t]},compute:function(t){return this.ratios?h.computeWithRatios(t,this.points,this.ratios,this._3d):h.compute(t,this.points,this._3d,this.ratios)},raise:function(){for(var t,e,n=this.points,r=[n[0]],i=n.length,o=1;o<i;o++)t=n[o],e=n[o-1],r[o]={x:(i-o)/i*t.x+o/i*e.x,y:(i-o)/i*t.y+o/i*e.y};return r[i]=n[i-1],new f(r)},derivative:function(t){var e,n,r=1-t,i=0,o=this.dpoints[0];2===this.order&&(o=[o[0],o[1],l],e=r,n=t),3===this.order&&(e=r*r,n=r*t*2,i=t*t);var s={x:e*o[0].x+n*o[1].x+i*o[2].x,y:e*o[0].y+n*o[1].y+i*o[2].y};return this._3d&&(s.z=e*o[0].z+n*o[1].z+i*o[2].z),s},curvature:function(t){return h.curvature(t,this.points,this._3d)},inflections:function(){return h.inflections(this.points)},normal:function(t){return this._3d?this.__normal3(t):this.__normal2(t)},__normal2:function(t){var e=this.derivative(t),n=u(e.x*e.x+e.y*e.y);return{x:-e.y/n,y:e.x/n}},__normal3:function(t){var e=this.derivative(t),n=this.derivative(t+.01),r=u(e.x*e.x+e.y*e.y+e.z*e.z),i=u(n.x*n.x+n.y*n.y+n.z*n.z);e.x/=r,e.y/=r,e.z/=r,n.x/=i,n.y/=i,n.z/=i;var o={x:n.y*e.z-n.z*e.y,y:n.z*e.x-n.x*e.z,z:n.x*e.y-n.y*e.x},s=u(o.x*o.x+o.y*o.y+o.z*o.z);o.x/=s,o.y/=s,o.z/=s;var a=[o.x*o.x,o.x*o.y-o.z,o.x*o.z+o.y,o.x*o.y+o.z,o.y*o.y,o.y*o.z-o.x,o.x*o.z-o.y,o.y*o.z+o.x,o.z*o.z];return{x:a[0]*e.x+a[1]*e.y+a[2]*e.z,y:a[3]*e.x+a[4]*e.y+a[5]*e.z,z:a[6]*e.x+a[7]*e.y+a[8]*e.z}},hull:function(t){var e,n=this.points,r=[],i=[],o=0,s=0,a=0;for(i[o++]=n[0],i[o++]=n[1],i[o++]=n[2],3===this.order&&(i[o++]=n[3]);n.length>1;){for(r=[],s=0,a=n.length-1;s<a;s++)e=h.lerp(t,n[s],n[s+1]),i[o++]=e,r.push(e);n=r}return i},split:function(t,e){if(0===t&&e)return this.split(e).left;if(1===e)return this.split(t).right;var n=this.hull(t),r={left:2===this.order?new f([n[0],n[3],n[5]]):new f([n[0],n[4],n[7],n[9]]),right:2===this.order?new f([n[5],n[4],n[2]]):new f([n[9],n[8],n[6],n[3]]),span:n};return r.left._t1=h.map(0,0,1,this._t1,this._t2),r.left._t2=h.map(t,0,1,this._t1,this._t2),r.right._t1=h.map(t,0,1,this._t1,this._t2),r.right._t2=h.map(1,0,1,this._t1,this._t2),e?(e=h.map(e,t,1,0,1),r.right.split(e).left):r},extrema:function(){var t,e,n=this.dims,r={},i=[];return n.forEach(function(n){e=function(t){return t[n]},t=this.dpoints[0].map(e),r[n]=h.droots(t),3===this.order&&(t=this.dpoints[1].map(e),r[n]=r[n].concat(h.droots(t))),r[n]=r[n].filter((function(t){return t>=0&&t<=1})),i=i.concat(r[n].sort(h.numberSort))}.bind(this)),i=i.sort(h.numberSort).filter((function(t,e){return i.indexOf(t)===e})),r.values=i,r},bbox:function(){var t=this.extrema(),e={};return this.dims.forEach(function(n){e[n]=h.getminmax(this,n,t[n])}.bind(this)),e},overlaps:function(t){var e=this.bbox(),n=t.bbox();return h.bboxoverlap(e,n)},offset:function(t,e){if(void 0!==e){var n=this.get(t),r=this.normal(t),i={c:n,n:r,x:n.x+r.x*e,y:n.y+r.y*e};return this._3d&&(i.z=n.z+r.z*e),i}if(this._linear){var o=this.normal(0),s=this.points.map((function(e){var n={x:e.x+t*o.x,y:e.y+t*o.y};return e.z&&r.z&&(n.z=e.z+t*o.z),n}));return[new f(s)]}return this.reduce().map((function(e){return e._linear?e.offset(t)[0]:e.scale(t)}))},simple:function(){if(3===this.order){var t=h.angle(this.points[0],this.points[3],this.points[1]),n=h.angle(this.points[0],this.points[3],this.points[2]);if(t>0&&n<0||t<0&&n>0)return!1}var r=this.normal(0),i=this.normal(1),o=r.x*i.x+r.y*i.y;return this._3d&&(o+=r.z*i.z),e(a(o))<c/3},reduce:function(){var t,n,r=0,i=0,o=[],s=[],a=this.extrema().values;for(-1===a.indexOf(0)&&(a=[0].concat(a)),-1===a.indexOf(1)&&a.push(1),r=a[0],t=1;t<a.length;t++)i=a[t],(n=this.split(r,i))._t1=r,n._t2=i,o.push(n),r=i;return o.forEach((function(t){for(r=0,i=0;i<=1;)for(i=r+.01;i<=1.01;i+=.01)if(!(n=t.split(r,i)).simple()){if(e(r-(i-=.01))<.01)return[];(n=t.split(r,i))._t1=h.map(r,0,1,t._t1,t._t2),n._t2=h.map(i,0,1,t._t1,t._t2),s.push(n),r=i;break}r<1&&((n=t.split(r,1))._t1=h.map(r,0,1,t._t1,t._t2),n._t2=t._t2,s.push(n))})),s},scale:function(t){var e=this.order,n=!1;if("function"==typeof t&&(n=t),n&&2===e)return this.raise().scale(n);var r=this.clockwise,i=n?n(0):t,o=n?n(1):t,s=[this.offset(0,10),this.offset(1,10)],a=h.lli4(s[0],s[0].c,s[1],s[1].c);if(!a)throw new Error("cannot scale this curve. Try reducing it first.");var c=this.points,l=[];return[0,1].forEach(function(t){var n=l[t*e]=h.copy(c[t*e]);n.x+=(t?o:i)*s[t].n.x,n.y+=(t?o:i)*s[t].n.y}.bind(this)),n?([0,1].forEach(function(i){if(2!==this.order||!i){var o=c[i+1],s={x:o.x-a.x,y:o.y-a.y},h=n?n((i+1)/e):t;n&&!r&&(h=-h);var p=u(s.x*s.x+s.y*s.y);s.x/=p,s.y/=p,l[i+1]={x:o.x+h*s.x,y:o.y+h*s.y}}}.bind(this)),new f(l)):([0,1].forEach(function(t){if(2!==this.order||!t){var n=l[t*e],r=this.derivative(t),i={x:n.x+r.x,y:n.y+r.y};l[t+1]=h.lli4(n,i,a,c[t+1])}}.bind(this)),new f(l))},outline:function(t,e,n,r){e=void 0===e?t:e;var i,o=this.reduce(),s=o.length,a=[],u=[],c=0,l=this.length(),f=void 0!==n&&void 0!==r;function d(t,e,n,r,i){return function(o){var s=r/n,a=(r+i)/n,u=e-t;return h.map(o,0,1,t+s*u,t+a*u)}}o.forEach((function(i){w=i.length(),f?(a.push(i.scale(d(t,n,l,c,w))),u.push(i.scale(d(-e,-r,l,c,w)))):(a.push(i.scale(t)),u.push(i.scale(-e))),c+=w})),u=u.map((function(t){return(i=t.points)[3]?t.points=[i[3],i[2],i[1],i[0]]:t.points=[i[2],i[1],i[0]],t})).reverse();var g=a[0].points[0],m=a[s-1].points[a[s-1].points.length-1],v=u[s-1].points[u[s-1].points.length-1],y=u[0].points[0],x=h.makeline(v,g),b=h.makeline(m,y),_=[x].concat(a).concat([b]).concat(u),w=_.length;return new p(_)},outlineshapes:function(t,e,n){e=e||t;for(var r=this.outline(t,e).curves,i=[],o=1,s=r.length;o<s/2;o++){var a=h.makeshape(r[o],r[s-o],n);a.startcap.virtual=o>1,a.endcap.virtual=o<s/2-1,i.push(a)}return i},intersects:function(t,e){return t?t.p1&&t.p2?this.lineIntersects(t):(t instanceof f&&(t=t.reduce()),this.curveintersects(this.reduce(),t,e)):this.selfintersects(e)},lineIntersects:function(t){var e=r(t.p1.x,t.p2.x),n=r(t.p1.y,t.p2.y),o=i(t.p1.x,t.p2.x),s=i(t.p1.y,t.p2.y),a=this;return h.roots(this.points,t).filter((function(t){var r=a.get(t);return h.between(r.x,e,o)&&h.between(r.y,n,s)}))},selfintersects:function(t){var e,n,r,i,o=this.reduce(),s=o.length-2,a=[];for(e=0;e<s;e++)r=o.slice(e,e+1),i=o.slice(e+2),n=this.curveintersects(r,i,t),a=a.concat(n);return a},curveintersects:function(t,e,n){var r=[];t.forEach((function(t){e.forEach((function(e){t.overlaps(e)&&r.push({left:t,right:e})}))}));var i=[];return r.forEach((function(t){var e=h.pairiteration(t.left,t.right,n);e.length>0&&(i=i.concat(e))})),i},arcs:function(t){t=t||.5;return this._iterate(t,[])},_error:function(t,n,r,i){var o=(i-r)/4,s=this.get(r+o),a=this.get(i-o),u=h.dist(t,n),c=h.dist(t,s),l=h.dist(t,a);return e(c-u)+e(l-u)},_iterate:function(t,e){var n,r=0,i=1;do{n=0,i=1;var a,u,c,l,p,f=this.get(r),d=!1,g=!1,m=i,v=1;do{if(g=d,l=c,m=(r+i)/2,a=this.get(m),u=this.get(i),(c=h.getccenter(f,a,u)).interval={start:r,end:i},d=this._error(c,f,r,i)<=t,(p=g&&!d)||(v=i),d){if(i>=1){if(c.interval.end=v=1,l=c,i>1){var y={x:c.x+c.r*o(c.e),y:c.y+c.r*s(c.e)};c.e+=h.angle({x:c.x,y:c.y},y,this.get(1))}break}i+=(i-r)/2}else i=m}while(!p&&n++<100);if(n>=100)break;l=l||c,e.push(l),r=v}while(i<1);return e}},t.exports=f}()},LYNF:function(t,e,n){"use strict";var r=n("OH9c");t.exports=function(t,e,n,i,o){var s=new Error(t);return r(s,e,n,i,o)}},Lmem:function(t,e,n){"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},LvDl:function(t,e,n){(function(t,r){var i;
77
77
  /**
78
78
  * @license
79
79
  * Lodash <https://lodash.com/>