poly-extrude 0.21.0 → 0.22.0

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.
@@ -1,4 +1,4 @@
1
1
  /*!
2
- * poly-extrude v0.21.0
2
+ * poly-extrude v0.22.0
3
3
  */
4
- !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).polyextrude=t.polyextrude||{})}(this,(function(t){"use strict";function n(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function e(t,n){return e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},e(t,n)}function i(t,n,e){void 0===e&&(e=2);var i,s,h,a=n&&n.length,c=a?n[0]*e:t.length,u=r(t,0,c,e,!0),x=[];if(!u||u.next===u.prev)return x;if(a&&(u=function(t,n,e,i){for(var s=[],o=0,h=n.length;o<h;o++){var a=r(t,n[o]*i,o<h-1?n[o+1]*i:t.length,i,!1);a===a.next&&(a.steiner=!0),s.push(p(a))}s.sort(l);for(var c=0;c<s.length;c++)e=f(s[c],e);return e}(t,n,u,e)),t.length>80*e){i=1/0,s=1/0;for(var y=-1/0,d=-1/0,g=e;g<c;g+=e){var v=t[g],_=t[g+1];v<i&&(i=v),_<s&&(s=_),v>y&&(y=v),_>d&&(d=_)}h=0!==(h=Math.max(y-i,d-s))?32767/h:0}return o(u,x,e,i,s,h,0),x}function r(t,n,e,i,r){var s;if(r===function(t,n,e,i){for(var r=0,s=n,o=e-i;s<e;s+=i)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}(t,n,e,i)>0)for(var o=n;o<e;o+=i)s=P(o/i|0,t[o],t[o+1],s);else for(var h=e-i;h>=n;h-=i)s=P(h/i|0,t[h],t[h+1],s);return s&&z(s,s.next)&&(S(s),s=s.next),s}function s(t,n){if(!t)return t;n||(n=t);var e,i=t;do{if(e=!1,i.steiner||!z(i,i.next)&&0!==_(i.prev,i,i.next))i=i.next;else{if(S(i),(i=n=i.prev)===i.next)break;e=!0}}while(e||i!==n);return n}function o(t,n,e,i,r,l,f){if(t){!f&&l&&function(t,n,e,i){var r=t;do{0===r.z&&(r.z=y(r.x,r.y,n,e,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var n,e=1;do{var i=t,r=void 0;t=null;var s=null;for(n=0;i;){n++;for(var o=i,h=0,a=0;a<e&&(h++,o=o.nextZ);a++);for(var c=e;h>0||c>0&&o;)0!==h&&(0===c||!o||i.z<=o.z)?(r=i,i=i.nextZ,h--):(r=o,o=o.nextZ,c--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=o}s.nextZ=null,e*=2}while(n>1)}(r)}(t,i,r,l);for(var x=t;t.prev!==t.next;){var p=t.prev,d=t.next;if(l?a(t,i,r,l):h(t))n.push(p.i,t.i,d.i),S(t),t=d.next,x=d.next;else if((t=d)===x){f?1===f?o(t=c(s(t),n),n,e,i,r,l,2):2===f&&u(t,n,e,i,r,l):o(s(t),n,e,i,r,l,1);break}}}}function h(t){var n=t.prev,e=t,i=t.next;if(_(n,e,i)>=0)return!1;for(var r=n.x,s=e.x,o=i.x,h=n.y,a=e.y,c=i.y,u=Math.min(r,s,o),l=Math.min(h,a,c),f=Math.max(r,s,o),x=Math.max(h,a,c),y=i.next;y!==n;){if(y.x>=u&&y.x<=f&&y.y>=l&&y.y<=x&&g(r,h,s,a,o,c,y.x,y.y)&&_(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function a(t,n,e,i){var r=t.prev,s=t,o=t.next;if(_(r,s,o)>=0)return!1;for(var h=r.x,a=s.x,c=o.x,u=r.y,l=s.y,f=o.y,x=Math.min(h,a,c),p=Math.min(u,l,f),d=Math.max(h,a,c),v=Math.max(u,l,f),z=y(x,p,n,e,i),m=y(d,v,n,e,i),w=t.prevZ,M=t.nextZ;w&&w.z>=z&&M&&M.z<=m;){if(w.x>=x&&w.x<=d&&w.y>=p&&w.y<=v&&w!==r&&w!==o&&g(h,u,a,l,c,f,w.x,w.y)&&_(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,M.x>=x&&M.x<=d&&M.y>=p&&M.y<=v&&M!==r&&M!==o&&g(h,u,a,l,c,f,M.x,M.y)&&_(M.prev,M,M.next)>=0)return!1;M=M.nextZ}for(;w&&w.z>=z;){if(w.x>=x&&w.x<=d&&w.y>=p&&w.y<=v&&w!==r&&w!==o&&g(h,u,a,l,c,f,w.x,w.y)&&_(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;M&&M.z<=m;){if(M.x>=x&&M.x<=d&&M.y>=p&&M.y<=v&&M!==r&&M!==o&&g(h,u,a,l,c,f,M.x,M.y)&&_(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function c(t,n){var e=t;do{var i=e.prev,r=e.next.next;!z(i,r)&&m(i,e,e.next,r)&&b(i,r)&&b(r,i)&&(n.push(i.i,e.i,r.i),S(e),S(e.next),e=t=r),e=e.next}while(e!==t);return s(e)}function u(t,n,e,i,r,h){var a=t;do{for(var c=a.next.next;c!==a.prev;){if(a.i!==c.i&&v(a,c)){var u=A(a,c);return a=s(a,a.next),u=s(u,u.next),o(a,n,e,i,r,h,0),void o(u,n,e,i,r,h,0)}c=c.next}a=a.next}while(a!==t)}function l(t,n){var e=t.x-n.x;0===e&&(0===(e=t.y-n.y)&&(e=(t.next.y-t.y)/(t.next.x-t.x)-(n.next.y-n.y)/(n.next.x-n.x)));return e}function f(t,n){var e=function(t,n){var e,i=n,r=t.x,s=t.y,o=-1/0;if(z(t,i))return i;do{if(z(t,i.next))return i.next;if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){var h=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(h<=r&&h>o&&(o=h,e=i.x<i.next.x?i:i.next,h===r))return e}i=i.next}while(i!==n);if(!e)return null;var a=e,c=e.x,u=e.y,l=1/0;i=e;do{if(r>=i.x&&i.x>=c&&r!==i.x&&d(s<u?r:o,s,c,u,s<u?o:r,s,i.x,i.y)){var f=Math.abs(s-i.y)/(r-i.x);b(i,t)&&(f<l||f===l&&(i.x>e.x||i.x===e.x&&x(e,i)))&&(e=i,l=f)}i=i.next}while(i!==a);return e}(t,n);if(!e)return n;var i=A(e,t);return s(i,i.next),s(e,e.next)}function x(t,n){return _(t.prev,t,n.prev)<0&&_(n.next,t,t.next)<0}function y(t,n,e,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-e)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-i)*r|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function p(t){var n=t,e=t;do{(n.x<e.x||n.x===e.x&&n.y<e.y)&&(e=n),n=n.next}while(n!==t);return e}function d(t,n,e,i,r,s,o,h){return(r-o)*(n-h)>=(t-o)*(s-h)&&(t-o)*(i-h)>=(e-o)*(n-h)&&(e-o)*(s-h)>=(r-o)*(i-h)}function g(t,n,e,i,r,s,o,h){return!(t===o&&n===h)&&d(t,n,e,i,r,s,o,h)}function v(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==n.i&&e.next.i!==n.i&&m(e,e.next,t,n))return!0;e=e.next}while(e!==t);return!1}(t,n)&&(b(t,n)&&b(n,t)&&function(t,n){var e=t,i=!1,r=(t.x+n.x)/2,s=(t.y+n.y)/2;do{e.y>s!=e.next.y>s&&e.next.y!==e.y&&r<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next}while(e!==t);return i}(t,n)&&(_(t.prev,t,n.prev)||_(t,n.prev,n))||z(t,n)&&_(t.prev,t,t.next)>0&&_(n.prev,n,n.next)>0)}function _(t,n,e){return(n.y-t.y)*(e.x-n.x)-(n.x-t.x)*(e.y-n.y)}function z(t,n){return t.x===n.x&&t.y===n.y}function m(t,n,e,i){var r=M(_(t,n,e)),s=M(_(t,n,i)),o=M(_(e,i,t)),h=M(_(e,i,n));return r!==s&&o!==h||(!(0!==r||!w(t,e,n))||(!(0!==s||!w(t,i,n))||(!(0!==o||!w(e,t,i))||!(0!==h||!w(e,n,i)))))}function w(t,n,e){return n.x<=Math.max(t.x,e.x)&&n.x>=Math.min(t.x,e.x)&&n.y<=Math.max(t.y,e.y)&&n.y>=Math.min(t.y,e.y)}function M(t){return t>0?1:t<0?-1:0}function b(t,n){return _(t.prev,t,t.next)<0?_(t,n,t.next)>=0&&_(t,t.prev,n)>=0:_(t,n,t.prev)<0||_(t,t.next,n)<0}function A(t,n){var e=k(t.i,t.x,t.y),i=k(n.i,n.x,n.y),r=t.next,s=n.prev;return t.next=n,n.prev=t,e.next=r,r.prev=e,i.next=e,e.prev=i,s.next=i,i.prev=s,i}function P(t,n,e,i){var r=k(t,n,e);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function S(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function k(t,n,e){return{i:t,x:n,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}var C=new(function(){function t(t,n,e,i){void 0===t&&(t=0),void 0===n&&(n=0),void 0===e&&(e=0),void 0===i&&(i=1),this.isQuaternion=!0,this._x=t,this._y=n,this._z=e,this._w=i}t.slerpFlat=function(t,n,e,i,r,s,o){var h=e[i+0],a=e[i+1],c=e[i+2],u=e[i+3],l=r[s+0],f=r[s+1],x=r[s+2],y=r[s+3];if(0===o)return t[n+0]=h,t[n+1]=a,t[n+2]=c,void(t[n+3]=u);if(1===o)return t[n+0]=l,t[n+1]=f,t[n+2]=x,void(t[n+3]=y);if(u!==y||h!==l||a!==f||c!==x){var p=1-o,d=h*l+a*f+c*x+u*y,g=d>=0?1:-1,v=1-d*d;if(v>Number.EPSILON){var _=Math.sqrt(v),z=Math.atan2(_,d*g);p=Math.sin(p*z)/_,o=Math.sin(o*z)/_}var m=o*g;if(h=h*p+l*m,a=a*p+f*m,c=c*p+x*m,u=u*p+y*m,p===1-o){var w=1/Math.sqrt(h*h+a*a+c*c+u*u);h*=w,a*=w,c*=w,u*=w}}t[n]=h,t[n+1]=a,t[n+2]=c,t[n+3]=u},t.multiplyQuaternionsFlat=function(t,n,e,i,r,s){var o=e[i],h=e[i+1],a=e[i+2],c=e[i+3],u=r[s],l=r[s+1],f=r[s+2],x=r[s+3];return t[n]=o*x+c*u+h*f-a*l,t[n+1]=h*x+c*l+a*u-o*f,t[n+2]=a*x+c*f+o*l-h*u,t[n+3]=c*x-o*u-h*l-a*f,t};var e,i,r,s=t.prototype;return s.set=function(t,n,e,i){return this._x=t,this._y=n,this._z=e,this._w=i,this._onChangeCallback(),this},s.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)},s.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},s.setFromEuler=function(t,n){void 0===n&&(n=!0);var e=t._x,i=t._y,r=t._z,s=t._order,o=Math.cos,h=Math.sin,a=o(e/2),c=o(i/2),u=o(r/2),l=h(e/2),f=h(i/2),x=h(r/2);switch(s){case"XYZ":this._x=l*c*u+a*f*x,this._y=a*f*u-l*c*x,this._z=a*c*x+l*f*u,this._w=a*c*u-l*f*x;break;case"YXZ":this._x=l*c*u+a*f*x,this._y=a*f*u-l*c*x,this._z=a*c*x-l*f*u,this._w=a*c*u+l*f*x;break;case"ZXY":this._x=l*c*u-a*f*x,this._y=a*f*u+l*c*x,this._z=a*c*x+l*f*u,this._w=a*c*u-l*f*x;break;case"ZYX":this._x=l*c*u-a*f*x,this._y=a*f*u+l*c*x,this._z=a*c*x-l*f*u,this._w=a*c*u+l*f*x;break;case"YZX":this._x=l*c*u+a*f*x,this._y=a*f*u+l*c*x,this._z=a*c*x-l*f*u,this._w=a*c*u-l*f*x;break;case"XZY":this._x=l*c*u-a*f*x,this._y=a*f*u-l*c*x,this._z=a*c*x+l*f*u,this._w=a*c*u+l*f*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!0===n&&this._onChangeCallback(),this},s.setFromAxisAngle=function(t,n){var e=n/2,i=Math.sin(e);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(e),this._onChangeCallback(),this},s.setFromRotationMatrix=function(t){var n=t.elements,e=n[0],i=n[4],r=n[8],s=n[1],o=n[5],h=n[9],a=n[2],c=n[6],u=n[10],l=e+o+u;if(l>0){var f=.5/Math.sqrt(l+1);this._w=.25/f,this._x=(c-h)*f,this._y=(r-a)*f,this._z=(s-i)*f}else if(e>o&&e>u){var x=2*Math.sqrt(1+e-o-u);this._w=(c-h)/x,this._x=.25*x,this._y=(i+s)/x,this._z=(r+a)/x}else if(o>u){var y=2*Math.sqrt(1+o-e-u);this._w=(r-a)/y,this._x=(i+s)/y,this._y=.25*y,this._z=(h+c)/y}else{var p=2*Math.sqrt(1+u-e-o);this._w=(s-i)/p,this._x=(r+a)/p,this._y=(h+c)/p,this._z=.25*p}return this._onChangeCallback(),this},s.setFromUnitVectors=function(t,n){var e=t.dot(n)+1;return e<Number.EPSILON?(e=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=e):(this._x=0,this._y=-t.z,this._z=t.y,this._w=e)):(this._x=t.y*n.z-t.z*n.y,this._y=t.z*n.x-t.x*n.z,this._z=t.x*n.y-t.y*n.x,this._w=e),this.normalize()},s.rotateTowards=function(t,n){var e=this.angleTo(t);if(0===e)return this;var i=Math.min(1,n/e);return this.slerp(t,i),this},s.identity=function(){return this.set(0,0,0,1)},s.invert=function(){return this.conjugate()},s.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},s.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},s.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},s.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},s.normalize=function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},s.multiply=function(t){return this.multiplyQuaternions(this,t)},s.premultiply=function(t){return this.multiplyQuaternions(t,this)},s.multiplyQuaternions=function(t,n){var e=t._x,i=t._y,r=t._z,s=t._w,o=n._x,h=n._y,a=n._z,c=n._w;return this._x=e*c+s*o+i*a-r*h,this._y=i*c+s*h+r*o-e*a,this._z=r*c+s*a+e*h-i*o,this._w=s*c-e*o-i*h-r*a,this._onChangeCallback(),this},s.slerp=function(t,n){if(0===n)return this;if(1===n)return this.copy(t);var e=this._x,i=this._y,r=this._z,s=this._w,o=s*t._w+e*t._x+i*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=s,this._x=e,this._y=i,this._z=r,this;var h=1-o*o;if(h<=Number.EPSILON){var a=1-n;return this._w=a*s+n*this._w,this._x=a*e+n*this._x,this._y=a*i+n*this._y,this._z=a*r+n*this._z,this.normalize(),this}var c=Math.sqrt(h),u=Math.atan2(c,o),l=Math.sin((1-n)*u)/c,f=Math.sin(n*u)/c;return this._w=s*l+this._w*f,this._x=e*l+this._x*f,this._y=i*l+this._y*f,this._z=r*l+this._z*f,this._onChangeCallback(),this},s.slerpQuaternions=function(t,n,e){return this.copy(t).slerp(n,e)},s.random=function(){var t=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),e=Math.random(),i=Math.sqrt(1-e),r=Math.sqrt(e);return this.set(i*Math.sin(t),i*Math.cos(t),r*Math.sin(n),r*Math.cos(n))},s.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},s.fromArray=function(t,n){return void 0===n&&(n=0),this._x=t[n],this._y=t[n+1],this._z=t[n+2],this._w=t[n+3],this._onChangeCallback(),this},s.toArray=function(t,n){return void 0===t&&(t=[]),void 0===n&&(n=0),t[n]=this._x,t[n+1]=this._y,t[n+2]=this._z,t[n+3]=this._w,t},s.fromBufferAttribute=function(t,n){return this._x=t.getX(n),this._y=t.getY(n),this._z=t.getZ(n),this._w=t.getW(n),this._onChangeCallback(),this},s.toJSON=function(){return this.toArray()},s._onChange=function(t){return this._onChangeCallback=t,this},s._onChangeCallback=function(){},e=t,(i=[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}])&&n(e.prototype,i),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),t}()),F=function(){function t(t,n,e){void 0===t&&(t=0),void 0===n&&(n=0),void 0===e&&(e=0),this.x=t,this.y=n,this.z=e}var n=t.prototype;return n.set=function(t,n,e){return void 0===e&&(e=this.z),this.x=t,this.y=n,this.z=e,this},n.clone=function(){return new this.constructor(this.x,this.y,this.z)},n.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},n.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},n.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},n.addVectors=function(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this.z=t.z+n.z,this},n.addScaledVector=function(t,n){return this.x+=t.x*n,this.y+=t.y*n,this.z+=t.z*n,this},n.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},n.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},n.subVectors=function(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this.z=t.z-n.z,this},n.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},n.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.multiplyVectors=function(t,n){return this.x=t.x*n.x,this.y=t.y*n.y,this.z=t.z*n.z,this},n.applyAxisAngle=function(t,n){return this.applyQuaternion(C.setFromAxisAngle(t,n))},n.applyMatrix4=function(t){var n=this.x,e=this.y,i=this.z,r=t.elements,s=1/(r[3]*n+r[7]*e+r[11]*i+r[15]);return this.x=(r[0]*n+r[4]*e+r[8]*i+r[12])*s,this.y=(r[1]*n+r[5]*e+r[9]*i+r[13])*s,this.z=(r[2]*n+r[6]*e+r[10]*i+r[14])*s,this},n.applyQuaternion=function(t){var n=this.x,e=this.y,i=this.z,r=t.x,s=t.y,o=t.z,h=t.w,a=h*n+s*i-o*e,c=h*e+o*n-r*i,u=h*i+r*e-s*n,l=-r*n-s*e-o*i;return this.x=a*h+l*-r+c*-o-u*-s,this.y=c*h+l*-s+u*-r-a*-o,this.z=u*h+l*-o+a*-s-c*-r,this},n.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},n.divideScalar=function(t){return this.multiplyScalar(1/t)},n.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},n.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},n.clamp=function(t,n){return this.x=Math.max(t.x,Math.min(n.x,this.x)),this.y=Math.max(t.y,Math.min(n.y,this.y)),this.z=Math.max(t.z,Math.min(n.z,this.z)),this},n.clampScalar=function(t,n){return this.x=Math.max(t,Math.min(n,this.x)),this.y=Math.max(t,Math.min(n,this.y)),this.z=Math.max(t,Math.min(n,this.z)),this},n.clampLength=function(t,n){var e=this.length();return this.divideScalar(e||1).multiplyScalar(Math.max(t,Math.min(n,e)))},n.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},n.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},n.normalize=function(){return this.divideScalar(this.length()||1)},n.setLength=function(t){return this.normalize().multiplyScalar(t)},n.lerp=function(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this.z+=(t.z-this.z)*n,this},n.lerpVectors=function(t,n,e){return this.x=t.x+(n.x-t.x)*e,this.y=t.y+(n.y-t.y)*e,this.z=t.z+(n.z-t.z)*e,this},n.cross=function(t){return this.crossVectors(this,t)},n.crossVectors=function(t,n){var e=t.x,i=t.y,r=t.z,s=n.x,o=n.y,h=n.z;return this.x=i*h-r*o,this.y=r*s-e*h,this.z=e*o-i*s,this},n.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},n.fromArray=function(t,n){return void 0===n&&(n=0),this.x=t[n],this.y=t[n+1],this.z=t[n+2],this},n.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},t}();function V(t,n){let e=t.length-1;for(let i=0,r=n.length;i<r;i++)t[++e]=n[i]}function O(t){let n,e,i=0,r=1;const s=t.length;for(;r<s;)n=e||t[0],e=t[r],i+=(e[0]-n[0])*(e[1]+n[1]),r++;return i>0}function Z(t){L(t)||t.push(t[0])}function L(t){const n=t.length,[e,i]=t[0],[r,s]=t[n-1];return e===r&&i===s}function q(t){let n=0,e=0;const i=t.length;for(;e<i;)n+=t[e].length,e++;return n}function I(t,n){n=n||[1/0,1/0,-1/0,-1/0];for(let e=0,i=t.length;e<i;e++){const i=t[e];if(Array.isArray(i[0][0]))I(i,n);else for(let t=0,e=i.length;t<e;t++){const e=i[t],[r,s]=e;n[0]=Math.min(n[0],r),n[1]=Math.min(n[1],s),n[2]=Math.max(n[2],r),n[3]=Math.max(n[3],s)}}return n}function U(t,n){for(let e=0,i=t.length;e<i;e++){const i=t[e];Z(i),0===e?O(i)||(t[e]=i.reverse()):O(i)&&(t[e]=i.reverse()),n&&L(i)&&i.splice(i.length-1,1)}}function j(t,n,e){return t[0]=n[0]-e[0],t[1]=n[1]-e[1],t[2]=n[2]-e[2],t}function E(t,n){const e=n[0],i=n[1],r=n[2],s=Math.sqrt(e*e+i*i+r*r)||1;return t[0]=e/s,t[1]=i/s,t[2]=r/s,t}function N(t,n,e){const i=n[0],r=n[1],s=n[2],o=e[0],h=e[1],a=e[2];return t[0]=r*a-s*h,t[1]=s*o-i*a,t[2]=i*h-r*o,t}function R(t,n){function e(t,n,e,i){t[0]=n,t[1]=e,t[2]=i}const i=[],r=[],s=[],o=[],h=[],a=[],c=t.length,u=new Float32Array(n.length);let l=0;for(;l<c;){const c=3*t[l],f=3*t[l+1],x=3*t[l+2];e(i,n[c],n[c+1],n[c+2]),e(r,n[f],n[f+1],n[f+2]),e(s,n[x],n[x+1],n[x+2]),j(h,s,r),j(o,i,r),N(a,h,o);for(let t=0;t<3;t++)u[c+t]+=a[t],u[f+t]+=a[t],u[x+t]+=a[t];l+=3}let f=0;const x=u.length;for(;f<x;)e(a,u[f],u[f+1],u[f+2]),E(a,a),u[f]=a[0]||0,u[f+1]=a[1]||0,u[f+2]=a[2]||0,f+=3;return u}function T(t){if(1===t.length){return{position:t[0].position,normal:t[0].normal,uv:t[0].uv,indices:t[0].indices,results:t}}let n=0,e=0;for(let i=0,r=t.length;i<r;i++){const{position:r,indices:s}=t[i];n+=r.length,e+=s.length}const i={position:new Float32Array(n),normal:new Float32Array(n),uv:new Float32Array(n/3*2),indices:new Uint32Array(e),results:t};let r=0,s=0,o=0,h=0;for(let n=0,e=t.length;n<e;n++){const{position:e,indices:a,normal:c,uv:u}=t[n];i.position.set(e,r),i.normal.set(c,r),i.uv.set(u,h);let l=0;const f=a.length;for(;l<f;){const t=a[l]+s;i.indices[o]=t,o++,l++}h+=u.length,r+=e.length,s+=e.length/3}return i}function Q(t){return 180*t/Math.PI}function W(t){return t/180*Math.PI}function X(t,n,e,i,r,s){const o=3*e,h=3*i,a=3*r,c=3*s,u=n[o],l=n[o+1],f=n[o+2],x=n[h],y=n[h+1],p=n[h+2],d=n[a],g=n[a+1],v=n[a+2],_=n[c],z=n[c+1],m=n[c+2];let w=t.length-1;Math.abs(l-y)<Math.abs(u-x)?(t[++w]=u,t[++w]=1-f,t[++w]=x,t[++w]=1-p,t[++w]=d,t[++w]=1-v,t[++w]=_,t[++w]=1-m):(t[++w]=l,t[++w]=1-f,t[++w]=y,t[++w]=1-p,t[++w]=g,t[++w]=1-v,t[++w]=z,t[++w]=1-m)}function B(t){const n=[];for(let e=0,i=t.length;e<i;e++){const i=t[e],[r,s,o]=i,h=new F(r,s,o||0);n[e]=h}return n}function Y(t){t.lineWidth=Math.max(0,t.lineWidth),t.depth=Math.max(0,t.depth),t.sideDepth=Math.max(0,t.sideDepth)}function D(t,n){const e=n.bottomStickGround,i=n.depth,r=t.depths;let s=i,o=i;r&&(s=r[0],o=r[1]);const{leftPoints:h,rightPoints:a}=t,c=t.line,u=n.pathUV;let l=c;if(h.length>l.length&&(l=h),u){!function(t){let n=0;for(let e=0,i=t.length;e<i;e++){const i=t[e],r=t[e+1];if(0===e&&(i.distance=0),i&&r){const[t,e,s]=i,[o,h,a]=r,c=t-o,u=e-h,l=(s||0)-(a||0);n+=Math.sqrt(c*c+u*u+l*l),r.distance=n}}}(l);for(let t=0,n=l.length;t<n;t++)h[t].distance=a[t].distance=l[t].distance}let f=0,x=h.length;const y=[],p=[],d=[];for(;f<x;){const t=3*f,[n,i,r]=h[f];y[t]=n,y[t+1]=i,y[t+2]=s+r;const[c,p,g]=a[f],v=3*x+t;y[v]=c,y[v+1]=p,y[v+2]=o+g;const _=2*x*3+t;y[_]=n,y[_+1]=i,y[_+2]=r,e&&(y[_+2]=0);const z=2*x*3+3*x+t;if(y[z]=c,y[z+1]=p,y[z+2]=g,e&&(y[z+2]=0),u){let t=l[f].distance;const n=2*f;d[n]=t,d[n+1]=1;const e=2*x+n;d[e]=t,d[e+1]=0;const i=2*x*2+n;d[i]=t,d[i+1]=1;const r=2*x*2+2*x+n;d[r]=t,d[r+1]=0}f++}if(!u){f=0,x=y.length;let t=d.length-1;for(;f<x;){const n=y[f],e=y[f+1];d[++t]=n,d[++t]=e,f+=3}}f=0,x=h.length;let g=p.length-1;for(;f<x-1;){const t=f,n=f+1,e=t+x,i=n+x;p[++g]=t,p[++g]=e,p[++g]=n,p[++g]=e,p[++g]=i,p[++g]=n;const r=f+2*x,s=r+1,o=r+x,h=s+x;p[++g]=r,p[++g]=o,p[++g]=s,p[++g]=o,p[++g]=h,p[++g]=s,f++}if(t.indices=p,t.points=y,t.uv=d,r)for(x=h.length,f=0;f<x;)h[f].depth=s,a[f].depth=o,f++}function G(t,n){const{points:e,indices:i,leftPoints:r,rightPoints:s,uv:o}=t,h=n.depth,a=n.bottomStickGround,c=[r,s],u=t.depths,l=n.pathUV,f=n.lineWidth;let x=e.length-1,y=i.length-1,p=o.length-1;function d(t,n){const r=e.length/3,s=u?t.depth:h,c=u?n.depth:h;e[++x]=t[0],e[++x]=t[1],e[++x]=s+t[2],e[++x]=n[0],e[++x]=n[1],e[++x]=c+n[2],e[++x]=t[0],e[++x]=t[1],e[++x]=a?0:t[2],e[++x]=n[0],e[++x]=n[1],e[++x]=a?0:n[2];const d=r+2,g=r+3,v=r,_=r+1;i[++y]=d,i[++y]=v,i[++y]=g,i[++y]=v,i[++y]=_,i[++y]=g,l?(o[++p]=t.distance,o[++p]=s/f,o[++p]=n.distance,o[++p]=c/f,o[++p]=t.distance,o[++p]=0,o[++p]=n.distance,o[++p]=0):X(o,e,d,g,v,_)}for(let t=0,n=c.length;t<n;t++){let n=c[t];t>0&&(n=n.map((t=>t)),n=n.reverse());let e=0;const i=n.length-1;for(;e<i;){d(n[e],n[e+1]),e++}}const g=r.length,v=[s[0],r[0],r[g-1],s[g-1]];for(let t=0;t<v.length;t+=2){d(v[t],v[t+1])}}const H={x:0,y:0},J={x:0,y:0};function K(t,n){let e=(n=Object.assign({},{lineWidth:1,cutCorner:!1},n)).lineWidth/2;n.isSlope&&(e*=2);const{cutCorner:i}=n,r=[],s=[],o=[],h=t.length,a=()=>{const t=s.length;if(t){s.push(s[t-1]),o.push(o[t-1]);const n=r.length;r.push(r[n-2],r[n-1])}};let c,u,l,f=0;for(;f<h;){let n,x=t[f],y=t[f+1];const p=x;if(c&&$(c,p)){a(),f++;continue}let d=!1;if(f===h-1){if(x=t[h-2],y=t[h-1],$(x,y))for(let n=t.indexOf(x);n>=0;n--){const e=t[n];if(!$(e,p)){x=e;break}}}else{if($(x,y))for(let n=t.indexOf(y);n<h;n++){const e=t[n];if(!$(e,p)){y=e;break}}if($(x,y)){d=!0;for(let n=t.indexOf(x);n>=0;n--){const e=t[n];if(!$(e,p)){x=e;break}}}}if($(x,y)){console.error("not find next vertex:index:",f,t),a(),f++;continue}let g=y[1]-x[1],v=y[0]-x[0],_=0;const z=Q(Math.atan2(g,v));if(0===f||f===h-1||d)_=z-90;else{if(n=t[f-1],$(n,y)||$(n,x))for(let e=t.indexOf(y);e>=0;e--){const i=t[e];if(!$(i,y)&&!$(i,x)){n=i;break}}if($(n,y)||$(n,x)||$(x,y)){console.error("not find pre vertex:index:",f,t),a(),f++;continue}const e=x[1]-n[1],i=x[0]-n[0],r=Q(Math.atan2(e,i));if(Math.abs(Math.abs(r-z)-180)<=1e-4)_=z-90;else{H.x=n[0]-x[0],H.y=n[1]-x[1],J.x=y[0]-x[0],J.y=y[1]-x[1],(0===H.x&&0===H.y||0===J.x&&0===J.y)&&console.error("has repeat vertex,the index:",f);const t=tt(H,J);_=Math.abs(t)<=1?z-90:z-t/2}}const m=W(_),w=p,M=[Math.cos(m)+w[0],Math.sin(m)+w[1]],[b,A]=it(x,y,e);if(!b||!A){console.error("translateLine line eror,the index:",f,t),f++;continue}let P=rt(b[0],b[1],w,M),S=rt(A[0],A[1],w,M);if(!P||!S){console.error("not find Intersection,the index:",f,t);const n=r.length,e=r[n-2],i=r[n-1];if(!e||!i){f++;continue}P=[e[0],e[1]],S=[i[0],i[1]]}P[2]=p[2]||0,S[2]=p[2]||0,r.push(P,S);let k=!1;if(i){const t=2*e;(nt(p,P)>t||nt(p,S)>t)&&(k=!0)}if(k&&n&&u&&l){let t=P;nt(P,n)<nt(S,n)&&(t=S);const i=t[1]-p[1],r=t[0]-p[0],h=Math.atan2(i,r)/Math.PI*180,a=W(h),c=Math.cos(a)*e+p[0],f=Math.sin(a)*e+p[1],d=[c,f],g=W(h+90),v=[Math.cos(g)+c,Math.sin(g)+f];let _=u,z=b,m=s,w=o;et(t,x,y)||(_=l,z=A,m=o,w=s);let M=rt(_[0],_[1],d,v),k=rt(z[0],z[1],d,v);M[2]=p[2]||0,k[2]=p[2]||0;const C=t===P?S:P;m.push(M,k),w.push(C,[...C])}else et(P,x,y)?(s.push(P),o.push(S)):(s.push(S),o.push(P));u=b,l=A,c=p,f++}return{offsetPoints:r,leftPoints:s,rightPoints:o,line:t}}function $(t,n){return t[0]===n[0]&&t[1]===n[1]}const tt=({x:t,y:n},{x:e,y:i})=>{const r=t*e+n*i,s=t*i-n*e;return Math.atan2(s,r)/Math.PI*180};function nt(t,n){const e=n[0]-t[0],i=n[1]-t[1];return Math.sqrt(e*e+i*i)}function et(t,n,e){const[i,r]=n,[s,o]=e,[h,a]=t;return(r-o)*h+(s-i)*a+i*o-s*r>0}function it(t,n,e){const i=n[1]-t[1],r=n[0]-t[0];if(0===i&&0===r)return null;const s=Math.atan2(i,r),o=s+Math.PI/2;let h=Math.cos(o)*e,a=Math.sin(o)*e;const c=[t[0]+h,t[1]+a],u=[n[0]+h,n[1]+a],l=s-Math.PI/2;h=Math.cos(l)*e,a=Math.sin(l)*e;return[[c,u],[[t[0]+h,t[1]+a],[n[0]+h,n[1]+a]]]}function rt(t,n,e,i){const r=n[0]-t[0],s=n[1]-t[1],o=i[0]-e[0],h=i[1]-e[1];if(0===r&&0===o)return null;if(0===s&&0===h)return null;const a=s/r,c=h/o,u=t[1]-a*t[0],l=e[1]-c*e[0];let f,x;return 0===r?(f=t[0],x=c*f+l):0===o?(f=e[0],x=a*f+u):0===s?(x=t[1],f=(x-l)/c):0===h?(x=e[1],f=(x-u)/a):(f=(l-u)/(a-c),x=a*f+u),[f,x]}var st=function(){function t(){this.pos=new F,this.dir=new F,this.right=new F,this.up=new F,this.dist=0,this.widthScale=1,this.sharp=!1}var n=t.prototype;return n.lerpPathPoints=function(t,n,e){this.pos.lerpVectors(t.pos,n.pos,e),this.dir.lerpVectors(t.dir,n.dir,e),this.up.lerpVectors(t.up,n.up,e),this.right.lerpVectors(t.right,n.right,e),this.dist=(n.dist-t.dist)*e+t.dist,this.widthScale=(n.widthScale-t.widthScale)*e+t.widthScale},n.copy=function(t){this.pos.copy(t.pos),this.dir.copy(t.dir),this.up.copy(t.up),this.right.copy(t.right),this.dist=t.dist,this.widthScale=t.widthScale},t}(),ot=function(){function t(t,n,e,i,r,s,o,h,a,c,u,l,f,x,y,p){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,n,e,i,r,s,o,h,a,c,u,l,f,x,y,p)}var n=t.prototype;return n.set=function(t,n,e,i,r,s,o,h,a,c,u,l,f,x,y,p){var d=this.elements;return d[0]=t,d[4]=n,d[8]=e,d[12]=i,d[1]=r,d[5]=s,d[9]=o,d[13]=h,d[2]=a,d[6]=c,d[10]=u,d[14]=l,d[3]=f,d[7]=x,d[11]=y,d[15]=p,this},n.multiply=function(t){return this.multiplyMatrices(this,t)},n.makeRotationAxis=function(t,n){var e=Math.cos(n),i=Math.sin(n),r=1-e,s=t.x,o=t.y,h=t.z,a=r*s,c=r*o;return this.set(a*s+e,a*o-i*h,a*h+i*o,0,a*o+i*h,c*o+e,c*h-i*s,0,a*h-i*o,c*h+i*s,r*h*h+e,0,0,0,0,1),this},n.equals=function(t){for(var n=this.elements,e=t.elements,i=0;i<16;i++)if(n[i]!==e[i])return!1;return!0},t}(),ht=function(){function t(){this.type="Curve",this.arcLengthDivisions=200}var n=t.prototype;return n.getPoint=function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},n.getPointAt=function(t,n){var e=this.getUtoTmapping(t);return this.getPoint(e,n)},n.getPoints=function(t){void 0===t&&(t=5);for(var n=[],e=0;e<=t;e++)n.push(this.getPoint(e/t));return n},n.getLength=function(){var t=this.getLengths();return t[t.length-1]},n.getLengths=function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var n,e=[],i=this.getPoint(0),r=0;e.push(0);for(var s=1;s<=t;s++)r+=(n=this.getPoint(s/t)).distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e},n.getUtoTmapping=function(t,n){var e,i=this.getLengths(),r=0,s=i.length;e=n||t*i[s-1];for(var o,h=0,a=s-1;h<=a;)if((o=i[r=Math.floor(h+(a-h)/2)]-e)<0)h=r+1;else{if(!(o>0)){a=r;break}a=r-1}if(i[r=a]===e)return r/(s-1);var c=i[r];return(r+(e-c)/(i[r+1]-c))/(s-1)},t}();function at(t,n,e,i){return function(t,n){var e=1-t;return e*e*n}(t,n)+function(t,n){return 2*(1-t)*t*n}(t,e)+function(t,n){return t*t*n}(t,i)}var ct=function(t){var n,i;function r(n,e,i){var r;return void 0===n&&(n=new F),void 0===e&&(e=new F),void 0===i&&(i=new F),(r=t.call(this)||this).isQuadraticBezierCurve3=!0,r.type="QuadraticBezierCurve3",r.v0=n,r.v1=e,r.v2=i,r}return i=t,(n=r).prototype=Object.create(i.prototype),n.prototype.constructor=n,e(n,i),r.prototype.getPoint=function(t,n){void 0===n&&(n=new F);var e=n,i=this.v0,r=this.v1,s=this.v2;return e.set(at(t,i.x,r.x,s.x),at(t,i.y,r.y,s.y),at(t,i.z,r.z,s.z)),e},r}(ht),ut=new F,lt=new F,ft=new F,xt=new ot,yt=new ct;var pt=function(){function t(){this.array=[],this.count=0}var n=t.prototype;return n.set=function(t,n,e,i,r){if(void 0===n&&(n=.1),void 0===e&&(e=10),void 0===i&&(i=null),void 0===r&&(r=!1),(t=t.slice(0)).length<2)return console.warn("PathPointList: points length less than 2."),void(this.count=0);r&&!t[0].equals(t[t.length-1])&&t.push((new F).copy(t[0]));for(var s=0,o=t.length;s<o;s++)if(0===s)this._start(t[s],t[s+1],i);else if(s===o-1)if(r){this._corner(t[s],t[1],n,e,i);var h=this.array[0].dist;this.array[0].copy(this.array[this.count-1]),this.array[0].dist=h}else this._end(t[s]);else this._corner(t[s],t[s+1],n,e,i)},n.distance=function(){return this.count>0?this.array[this.count-1].dist:0},n._getByIndex=function(t){return this.array[t]||(this.array[t]=new st),this.array[t]},n._start=function(t,n,e){this.count=0;var i=this._getByIndex(this.count);if(i.pos.copy(t),i.dir.subVectors(n,t),e)i.up.copy(e);else{var r=Number.MAX_VALUE,s=Math.abs(i.dir.x),o=Math.abs(i.dir.y),h=Math.abs(i.dir.z);s<r&&(r=s,i.up.set(1,0,0)),o<r&&(r=o,i.up.set(0,1,0)),h<r&&i.up.set(0,0,1)}i.right.crossVectors(i.dir,i.up).normalize(),i.up.crossVectors(i.right,i.dir).normalize(),i.dist=0,i.widthScale=1,i.sharp=!1,i.dir.normalize(),this.count++},n._end=function(t){var n=this.array[this.count-1],e=this._getByIndex(this.count);e.pos.copy(t),e.dir.subVectors(t,n.pos);var i=e.dir.length();e.dir.normalize(),e.up.copy(n.up);var r=ut.crossVectors(n.dir,e.dir);if(r.length()>Number.EPSILON){r.normalize();var s=Math.acos(Math.min(Math.max(n.dir.dot(e.dir),-1),1));e.up.applyMatrix4(xt.makeRotationAxis(r,s))}e.right.crossVectors(e.dir,e.up).normalize(),e.dist=n.dist+i,e.widthScale=1,e.sharp=!1,this.count++},n._corner=function(t,n,e,i,r){if(e>0&&i>0){for(var s=function(t,n,e,i,r,s){var o=ut.subVectors(n,t),h=lt.subVectors(e,n),a=o.length(),c=h.length();o.normalize(),h.normalize();var u=Math.min(.999999*(r?a/2:a),i);s.v0.copy(n).sub(o.multiplyScalar(u)),s.v1.copy(n);var l=Math.min(c/2*.999999,i);return s.v2.copy(n).add(h.multiplyScalar(l)),s}(this.array[this.count-1].pos,t,n,e,this.count-1==0,yt),o=s.getPoints(i),h=0;h<i;h++)this._sharpCorner(o[h],o[h+1],r,0===h?1:0);o[i].equals(n)||this._sharpCorner(o[i],n,r,2)}else this._sharpCorner(t,n,r,0,!0)},n._sharpCorner=function(t,n,e,i,r){void 0===i&&(i=0),void 0===r&&(r=!1);var s=this.array[this.count-1],o=this._getByIndex(this.count),h=ut.subVectors(t,s.pos),a=lt.subVectors(n,t),c=h.length();if(h.normalize(),a.normalize(),o.pos.copy(t),1===i?o.dir.copy(h):2===i?o.dir.copy(a):(o.dir.addVectors(h,a),o.dir.normalize()),e)1===o.dir.dot(e)?o.right.crossVectors(a,e).normalize():o.right.crossVectors(o.dir,e).normalize(),o.up.crossVectors(o.right,o.dir).normalize();else{o.up.copy(s.up);var u=ft.crossVectors(s.dir,o.dir);if(u.length()>Number.EPSILON){u.normalize();var l=Math.acos(Math.min(Math.max(s.dir.dot(o.dir),-1),1));o.up.applyMatrix4(xt.makeRotationAxis(u,l))}o.right.crossVectors(o.dir,o.up).normalize()}o.dist=s.dist+c;var f=h.dot(a);o.widthScale=Math.min(1/Math.sqrt((1+f)/2),1.415)||1,o.sharp=Math.abs(f-1)>.05&&r,this.count++},t}();const dt=new F(0,0,1),gt=new F,vt=new F,_t=new F,zt=new F,mt=new F,wt=new F;const Mt=new F(0,0,1),bt=new F;const At=new F(0,0,1),Pt=new F;function St(t,n){const[e,i]=t,[r,s]=n,o=s-i,h=r-e;return Math.atan2(o,h)}const kt=new F(0,0,0);function Ct(t,n){if(t.x===n.x)return t.y===n.y?null:{x:t.x};var e=(n.y-t.y)/(n.x-t.x);return{a:e,b:t.y-e*t.x}}function Ft(t,n,e){const i=n.x-t.x,r=n.y-t.y,s=Math.sqrt(i*i+r*r),o=e.x-t.x,h=e.y-t.y,a=Math.sqrt(o*o+h*h)/s,c=n.z-t.z;return t.z+c*a}function Vt(t,n,e,i){var r=Ct(t,n),s=Ct(e,i);if(null===r||null===s)return null;if(r.hasOwnProperty("x")){if(s.hasOwnProperty("x"))return null;const e={x:r.x,y:s.a*r.x+s.b,z:0};return e.z=Ft(t,n,e),e}if(s.hasOwnProperty("x")){const e={x:s.x,y:r.a*s.x+r.b,z:0};return e.z=Ft(t,n,e),e}if(r.a===s.a)return null;var o=(s.b-r.b)/(r.a-s.a);const h={x:o,y:r.a*o+r.b,z:0};return h.z=Ft(t,n,h),h}function Ot(t,n,e){return{x:t.x+n*Math.cos(e),y:t.y+n*Math.sin(e),z:t.z||0}}function Zt(t,n,e){return function(t,n,e){if(t.offsetAngle===n.offsetAngle)return[t.offset[1]];const i=qt(t.offset,n.offset);if(i*e>0&&i*qt(t.offset,[t.offset[0],n.offset[1]])>0)return[Vt(t.offset[0],t.offset[1],n.offset[0],n.offset[1])];var r=[],s=t.original[1],o=e>0,h=o?n.offsetAngle:t.offsetAngle,a=o?t.offsetAngle:n.offsetAngle;a<h&&(a+=2*Math.PI);for(var c=Math.PI/8,u=h;u<a;u+=c)r.push(Ot(s,e,u));return r.push(Ot(s,e,a)),o?r.reverse():r}(t,n,e).filter((function(t){return t}))}function Lt(t){return{x:t[1].x-t[0].x,y:t[1].y-t[0].y}}function qt(t,n){const e=Lt(t),i=Lt(n);return Math.atan2(e.x*i.y-e.y*i.x,e.x*i.x+e.y*i.y)}function It(t,n){var e=function(t,n){var e=[];for(let r=1,s=t.length;r<s;r++){let s=t[r-1],o=t[r];const[h,a,c]=s,[u,l,f]=o;if(h!==u||a!==l){s={x:h,y:a,z:c||0},o={x:u,y:l,z:f||0};var i=Math.atan2(s.y-o.y,s.x-o.x)-Math.PI/2;e.push({offsetAngle:i,original:[s,o],offset:[Ot(s,n,i),Ot(o,n,i)]})}}return e}(t,n.offset);return function(t,n){var e=[],i=t[0],r=t[t.length-1];if(i&&r){e.push(i.offset[0]);for(let i=1,r=t.length;i<r;i++)V(e,Zt(t[i-1],t[i],n));e.push(r.offset[1])}return e}(e,n.offset)}t.cylinder=function(t,n){const e=Object.assign({},{radius:1,height:2,radialSegments:6},n),i=Math.round(Math.max(4,e.radialSegments));let{radius:r,height:s}=e;const o=360/i/360*Math.PI*2,h=i+1,a=new Float32Array(3*h*2),[c,u]=t;let l=0,f=0;const x=3*h,y=2*h,p=[],d=[];let g=p.length-1;for(let t=-1;t<i;t++){const n=o*t,e=Math.cos(n)*r+c,i=Math.sin(n)*r+u;a[l]=e,a[l+1]=i,a[l+2]=0,a[l+x]=e,a[l+1+x]=i,a[l+2+x]=s;let h=0,v=0;h=.5+e/r/2,v=.5+i/r/2,d[f]=h,d[f+1]=v,d[f+y]=h,d[f+1+y]=v,l+=3,f+=2,t>1&&(p[++g]=0,p[++g]=t-1,p[++g]=t)}l-=3,a[l]=a[0],a[l+1]=a[1],a[l+2]=a[2];const v=a.length;a[v-3]=a[0],a[v-2]=a[1],a[v-1]=s;const _=p.length;g=p.length-1;for(let t=0;t<_;t++){const n=p[t];p[++g]=n+h}const z=new Float32Array(2*(3*h*2-6));let m=-1;l=2*h,f=0,g=p.length-1;let w=d.length-1;for(let t=0,n=a.length/2;t<n-3;t+=3){const n=a[t],e=a[t+1],i=a[t+3],o=a[t+4];z[++m]=n,z[++m]=e,z[++m]=s,z[++m]=i,z[++m]=o,z[++m]=s,z[++m]=n,z[++m]=e,z[++m]=0,z[++m]=i,z[++m]=o,z[++m]=0;const c=l+2,u=l+3,x=l,y=l+1;p[++g]=x,p[++g]=c,p[++g]=y,p[++g]=c,p[++g]=u,p[++g]=y,l+=4;const v=f/h,_=(f+1)/h;d[++w]=v,d[++w]=s/r/2,d[++w]=_,d[++w]=s/r/2,d[++w]=v,d[++w]=0,d[++w]=_,d[++w]=0,f++}const M=new Float32Array(a.length+z.length);M.set(a,0),M.set(z,a.length);const b=R(p,M);return{points:a,indices:new Uint32Array(p),position:M,normal:b,uv:new Float32Array(d)}},t.expandLine=K,t.expandPaths=function(t,n){const e=Object.assign({},{lineWidth:1,cornerRadius:0,cornerSplit:10},n),i=t.map((t=>{const n=B(t),i=new pt;i.set(n,e.cornerRadius,e.cornerSplit,dt);const r=function(t,n){const e=n.lineWidth||.1,i=1,r=e/2,s=e,o=t.distance(),h=i*o;let a=0;const c=[],u=[],l=[],f=[];let x=0;if(0===o)return{position:c,normal:u,uv:l,indices:f,count:a};const y=r/s;let p,d=c.length-1,g=u.length-1,v=l.length-1,_=f.length-1;function z(t){const n=0===c.length,e=t.sharp&&!n,i=t.dist/s,o=t.dir,h=t.up,p=t.right;if(gt.copy(p).multiplyScalar(r*t.widthScale),vt.copy(p).multiplyScalar(-r*t.widthScale),gt.add(t.pos),vt.add(t.pos),e){_t.fromArray(c,c.length-6).sub(vt),zt.fromArray(c,c.length-3).sub(gt);const t=_t.length()-zt.length();let n,e;t>0?(n=_t,e=vt):(n=zt,e=gt),mt.copy(n).setLength(Math.abs(t)).add(e);let r=wt.copy(e).sub(mt).normalize().dot(o)*wt.copy(e).sub(mt).length()*2;wt.copy(o).setLength(r).add(mt),t>0?(c[++d]=mt.x,c[++d]=mt.y,c[++d]=mt.z,c[++d]=gt.x,c[++d]=gt.y,c[++d]=gt.z,c[++d]=vt.x,c[++d]=vt.y,c[++d]=vt.z,c[++d]=gt.x,c[++d]=gt.y,c[++d]=gt.z,c[++d]=wt.x,c[++d]=wt.y,c[++d]=wt.z,c[++d]=gt.x,c[++d]=gt.y,c[++d]=gt.z,x+=6,f[++_]=x-6,f[++_]=x-8,f[++_]=x-7,f[++_]=x-6,f[++_]=x-7,f[++_]=x-5,f[++_]=x-4,f[++_]=x-6,f[++_]=x-5,f[++_]=x-2,f[++_]=x-4,f[++_]=x-1,a+=12):(c[++d]=vt.x,c[++d]=vt.y,c[++d]=vt.z,c[++d]=mt.x,c[++d]=mt.y,c[++d]=mt.z,c[++d]=vt.x,c[++d]=vt.y,c[++d]=vt.z,c[++d]=gt.x,c[++d]=gt.y,c[++d]=gt.z,c[++d]=vt.x,c[++d]=vt.y,c[++d]=vt.z,c[++d]=wt.x,c[++d]=wt.y,c[++d]=wt.z,x+=6,f[++_]=x-6,f[++_]=x-8,f[++_]=x-7,f[++_]=x-6,f[++_]=x-7,f[++_]=x-5,f[++_]=x-6,f[++_]=x-5,f[++_]=x-3,f[++_]=x-2,f[++_]=x-3,f[++_]=x-1,a+=12);for(let t=0;t<6;t++)u[++g]=h.x,u[++g]=h.y,u[++g]=h.z;l[++v]=i-y,l[++v]=0,l[++v]=i-y,l[++v]=1,l[++v]=i,l[++v]=0,l[++v]=i,l[++v]=1,l[++v]=i+y,l[++v]=0,l[++v]=i+y,l[++v]=1}else c[++d]=vt.x,c[++d]=vt.y,c[++d]=vt.z,c[++d]=gt.x,c[++d]=gt.y,c[++d]=gt.z,u[++g]=h.x,u[++g]=h.y,u[++g]=h.z,u[++g]=h.x,u[++g]=h.y,u[++g]=h.z,l[++v]=i,l[++v]=0,l[++v]=i,l[++v]=1,x+=2,n||(f[++_]=x-2,f[++_]=x-4,f[++_]=x-3,f[++_]=x-2,f[++_]=x-3,f[++_]=x-1,a+=6)}if(h>0)for(let n=0;n<t.count;n++){const e=t.array[n];if(e.dist>h){const i=t.array[n-1];p=new st;const r=(h-i.dist)/(e.dist-i.dist);p.lerpPathPoints(i,e,r),z(p);break}z(e)}else p=t.array[0];return{position:c,normal:u,uv:l,indices:f,count:a}}(i,e);return{position:new Float32Array(r.position),indices:new Uint32Array(r.indices),uv:new Float32Array(r.uv),normal:new Float32Array(r.normal),line:t,count:r.count}})),r=T(i);return r.lines=t,r},t.expandTubes=function(t,n){const e=Object.assign({},{radius:1,cornerSplit:0,radialSegments:8,startRad:-Math.PI/4},n),i=t.map((t=>{const n=B(t),i=new pt;i.set(n,0,e.cornerSplit,Mt);const r=function(t,n){const e=Math.max(n.radius||1,1e-8),i=void 0!==n.progress?n.progress:1,r=Math.max(3,n.radialSegments||8),s=n.startRad||0,o=2*e*Math.PI,h=t.distance(),a=i*h;if(0===a)return null;let c=0;const u=[],l=[],f=[],x=[];let y=0,p=-1,d=-1,g=-1,v=-1;function _(t,n,e){const i=0===u.length,r=t.dist/o;for(let i=0;i<=e;i++){let o=i;o===e&&(o=0),bt.copy(t.up).applyAxisAngle(t.dir,s+2*Math.PI*o/e).normalize();const h=n*t.widthScale;u[++p]=t.pos.x+bt.x*h,u[++p]=t.pos.y+bt.y*h,u[++p]=t.pos.z+bt.z*h,l[++d]=bt.x,l[++d]=bt.y,l[++d]=bt.z,f[++g]=r,f[++g]=i/e,y++}if(!i){const t=y-2*(e+1),n=y-(e+1);for(let i=0;i<e;i++)x[++v]=n+i,x[++v]=t+i,x[++v]=t+i+1,x[++v]=n+i,x[++v]=t+i+1,x[++v]=n+i+1,c+=6}}if(a>0)for(let n=0;n<t.count;n++){const i=t.array[n];if(i.dist>a){const s=t.array[n-1],o=new st,h=(a-s.dist)/(i.dist-s.dist);o.lerpPathPoints(s,i,h),_(o,e,r);break}_(i,e,r)}return{points:u,normal:l,uv:f,indices:x,count:c}}(i,e);return r.line=t,r.position=new Float32Array(r.points),r.indices=new Uint32Array(r.indices),r.uv=new Float32Array(r.uv),r.normal=new Float32Array(r.normal),r})),r=T(i);return r.lines=t,r},t.extrudePolygons=function(t,n){const e=Object.assign({},{depth:2,top:!0},n),r=t.map((t=>{U(t,!0);const n=function(t,n){const e=q(t),i=t.length,r=[],s=new Float32Array(2*e),o=[],h=[],a=3*e,c=2*e,u=n.depth;let l=0,f=0,x=0;for(let n=0;n<i;n++){const e=t[n];n>0&&r.push(l/2);let i=0;const y=e.length;for(;i<y;){const t=e[i],n=t[0],r=t[1],y=t[2]||0;s[l++]=n,s[l++]=r,o[f]=n,o[f+1]=r,o[f+2]=u+y,o[a+f]=n,o[a+f+1]=r,o[a+f+2]=y,h[x]=n,h[x+1]=r,h[c+x]=n,h[c+x+1]=r,f+=3,x+=2,i++}}return{flatVertices:s,holes:r,points:o,count:e,uv:h}}(t,e);n.polygon=t;return function(t,n,e){const i=[],{count:r}=t,s=e.top;for(let t=0,e=n.length;t<e;t+=3){const o=n[t],h=n[t+1],a=n[t+2];s&&(i[t]=o,i[t+1]=h,i[t+2]=a);let c=e+t;const u=r+o,l=r+h,f=r+a;s||(c=t),i[c]=u,i[c+1]=l,i[c+2]=f}t.indices=i}(n,i(n.flatVertices,n.holes,2),e),function(t,n){const{points:e,indices:i,polygon:r,uv:s}=t,o=n.depth;let h=e.length-1,a=i.length-1;for(let t=0,n=r.length;t<n;t++){const n=r[t];let c=0;const u=n.length;for(;c<u;){const t=n[c];let r=n[c+1];c===u-1&&(r=n[0]);const l=e.length/3,f=t[0],x=t[1],y=t[2]||0,p=r[0],d=r[1],g=r[2]||0;e[++h]=f,e[++h]=x,e[++h]=y+o,e[++h]=p,e[++h]=d,e[++h]=g+o,e[++h]=f,e[++h]=x,e[++h]=y,e[++h]=p,e[++h]=d,e[++h]=g;const v=l+2,_=l+3,z=l,m=l+1;i[++a]=v,i[++a]=z,i[++a]=_,i[++a]=z,i[++a]=m,i[++a]=_,X(s,e,v,_,z,m),c++}}}(n,e),n.position=new Float32Array(n.points),n.indices=new Uint32Array(n.indices),n.uv=new Float32Array(n.uv),n.normal=R(n.indices,n.position),n})),s=T(r);return s.polygons=t,s},t.extrudePolygonsOnPath=function(t,n){const e=Object.assign({},{openEnd:!1,openEndUV:!0,polygonRotation:0},n),{extrudePath:r,openEnd:s}=e;if(!r||!Array.isArray(r)||r.length<2)return console.error("extrudePath is error:",r),null;const o=I(t),[h,a,c,u]=o,l=[(h+c)/2,(a+u)/2];e.center=l,e.bbox=o;const f=B(r),x=new pt;x.set(f,0,e.cornerSplit,At);const y=t.map((t=>{U(t,!1);const n=function(t,n,e){const i=function(t,n){const{center:e,polygonRotation:i}=n,[r,s]=e,o=[];return t.forEach(((t,n)=>{const h=[];let a,c=0;for(let n=0,o=t.length;n<o;n++){const o=t[n],u=o[0],l=o[1],f=u-r,x=l-s;let y=0;if(n>0){const t=a[0]-u,n=a[1]-l;y=Math.sqrt(t*t+n*n)+c,c=y}h[n]={distance:y,radius:Math.sqrt(f*f+x*x),angle:-St(e,o)+i},a=o}o[n]={ring:h,ringLen:c}})),o}(n,e),r=[],s=[],o=[],h=[];let a=0,c=-1,u=-1,l=-1,f=-1;const x=[],y=[];function p(t,n,e,i,p){const d=t.dist/e,g=n.length;for(let h=0;h<g;h++){const f=n[h];if(!f)continue;const v=h===g-1,_=f.angle,z=f.radius,m=f.distance;Pt.copy(t.up).applyAxisAngle(t.dir,_).normalize();const w=kt.copy(t.up);w.applyAxisAngle(t.dir,_),w.x*=z,w.y*=z,w.z*=z;const M=t.pos.x+w.x,b=t.pos.y+w.y,A=t.pos.z+w.z;if(r[++c]=M,r[++c]=b,r[++c]=A,s[++u]=Pt.x,s[++u]=Pt.y,s[++u]=Pt.z,o[++l]=d,o[++l]=m/e,a++,i&&!v){let t=x.length-1;x[++t]=M,x[++t]=b,x[++t]=A}if(p&&!v){let t=y.length-1;y[++t]=M,y[++t]=b,y[++t]=A}}if(!i){const t=a-2*g,n=a-g;for(let e=0;e<g-1;e++)h[++f]=n+e,h[++f]=t+e,h[++f]=t+e+1,h[++f]=n+e,h[++f]=t+e+1,h[++f]=n+e+1}}const d=i[0].ringLen;return i.forEach((n=>{for(let e=0;e<t.count;e++){const i=t.array[e],{ring:r,ringLen:s}=n;p(i,r,s,0===e,e===t.count-1)}})),{points:r,normal:s,uv:o,indices:h,startPoints:x,endPoints:y,polygonLen:d}}(x,t,e);return s||function(t,n,e){const{openEndUV:r}=e;for(let t=0,e=n.length;t<e;t++){const e=n[t];L(e)&&e.splice(e.length-1,1)}const s=q(n),o=[],h=[];let a=-1;for(let t=0,e=n.length;t<e;t++){const e=n[t];t>0&&h.push(o.length/2);for(let t=0,n=e.length;t<n;t++){const n=e[t];o[++a]=n[0],o[++a]=n[1]}}const c=i(o,h,2),{points:u,normal:l,uv:f,indices:x,startPoints:y,endPoints:p,polygonLen:d}=t;a=0;let g=0;const v=[],_=[],z=[],m=[];for(let t=0;t<s;t++){const n=3*t,e=y[n],i=y[n+1],s=y[n+2];v[a]=e,v[a+1]=i,v[a+2]=s,r?(_[g]=i/d,_[g+1]=s/d):(_[g]=0,_[g+1]=0);const o=p[n],h=p[n+1],c=p[n+2];z[a]=o,z[a+1]=h,z[a+2]=c,r?(m[g]=h/d,m[g+1]=c/d):(m[g]=0,m[g+1]=0),a+=3,g+=2}const w=u.length/3,M=[];for(let t=0,n=c.length;t<n;t++)M[t]=c[t]+w,M[t+n]=c[t]+w+s;const b=R(c,v),A=R(c,z);V(u,v),V(u,z),V(f,_),V(f,m),V(l,b),V(l,A),V(x,M)}(n,t,e),n.polygon=t,n.position=new Float32Array(n.points),n.indices=new Uint32Array(n.indices),n.uv=new Float32Array(n.uv),n.normal=new Float32Array(n.normal),n})),p=T(y);return p.polygons=t,p},t.extrudePolylines=function(t,n){const e=Object.assign({},{depth:2,lineWidth:1,bottomStickGround:!1,pathUV:!1},n);Y(e);const i=t.map((t=>{const n=K(t,e);return n.line=t,D(n,e),G(n,e),n.position=new Float32Array(n.points),n.indices=new Uint32Array(n.indices),n.uv=new Float32Array(n.uv),n.normal=R(n.indices,n.position),n})),r=T(i);return r.lines=t,r},t.extrudeSlopes=function(t,n){const e=Object.assign({},{depth:2,lineWidth:1,side:"left",sideDepth:0,bottomStickGround:!1,pathUV:!1,isSlope:!0},n);Y(e);const{depth:i,side:r,sideDepth:s}=e,o=t.map((t=>{const n=K(t,e);n.line=t;const{leftPoints:o,rightPoints:h}=n,a={line:t};let c;for(let n=0,e=t.length;n<e;n++)t[n][2]=t[n][2]||0;return"left"===r?(a.leftPoints=o,a.rightPoints=t,c=[s,i]):(a.leftPoints=t,a.rightPoints=h,c=[i,s]),a.depths=c,D(a,e),G(a,e),a.position=new Float32Array(a.points),a.indices=new Uint32Array(a.indices),a.uv=new Float32Array(a.uv),a.normal=R(a.indices,a.position),a})),h=T(o);return h.lines=t,h},t.isClockwise=O,t.leftOnLine=et,t.merge=T,t.plane=function(t,n,e,i){const r=t/(e=Math.max(1,e)),s=n/(i=Math.max(1,i)),o=-t/2,h=n/2,a=-n/2,c=(e+1)*(i+1),u=new Float32Array(3*c),l=new Float32Array(2*c),f=new Float32Array(3*c),x=new Uint32Array(10*c);let y=0,p=0,d=0;for(let c=0;c<=i;c++)for(let g=0;g<=e;g++){const v=o+r*g,_=h-s*c;u[y]=v,u[y+1]=_,u[y+2]=0,f[y]=0,f[y+1]=0,f[y+2]=1;const z=(v-o)/t,m=(_-a)/n;if(l[p]=z,l[p+1]=m,y+=3,p+=2,g<e&&c<i){const t=c*(e+1)+g,n=t+1,i=(e+1)*(c+1)+g,r=i+1;x[d]=t,x[d+1]=i,x[d+2]=n,x[d+3]=i,x[d+4]=r,x[d+5]=n,d+=6}}const g=new Uint32Array(d);for(let t=0,n=g.length;t<n;t++)g[t]=x[t];return{position:u,uv:l,normal:f,indices:g}},t.polygons=function(t,n={}){const e=Object.assign({},n),r=t.map((t=>{U(t,!0);const n=function(t,n={}){const e=[],r=[];let s=-1,o=-1,h=-1;const a=[],c=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];n>0&&r.push(e.length/2);for(let t=0,n=i.length;t<n;t++){const n=i[t];e[++s]=n[0],e[++s]=n[1],a[++o]=n[0],a[++o]=n[1],a[++o]=n[2]||0,c[++h]=n[0],c[++h]=n[1]}}const u=i(e,r,2);return{normal:R(u,a),uv:c,points:a,indices:u}}(t,e);return n.polygon=t,n.position=new Float32Array(n.points),n.indices=new Uint32Array(n.indices),n.uv=new Float32Array(n.uv),n.normal=new Float32Array(n.normal),n})),s=T(r);return s.polygons=t,s},t.polylineOffset=function(t,n){if(0===(n=Object.assign({offset:0},n)).offset)return t;const e=It(t,n),i=[];for(let t=0,n=e.length;t<n;t++){const n=e[t];if(!n)continue;const{x:r,y:s,z:o}=n;i.push([r,s,o])}return i},Object.defineProperty(t,"__esModule",{value:!0})}));
4
+ !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).polyextrude=t.polyextrude||{})}(this,(function(n){"use strict";function i(t,n){for(var i=0;i<n.length;i++){var e=n[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}function e(t,n,e){return n&&i(t.prototype,n),e&&i(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function r(t,n){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},r(t,n)}function s(t,n){(null==n||n>t.length)&&(n=t.length);for(var i=0,e=new Array(n);i<n;i++)e[i]=t[i];return e}function o(t,n){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,n){if(t){if("string"==typeof t)return s(t,n);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?s(t,n):void 0}}(t))||n&&t&&"number"==typeof t.length){i&&(t=i);var e=0;return function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function a(t,n,i){void 0===i&&(i=2);var e,r,s,o=n&&n.length,a=o?n[0]*i:t.length,u=h(t,0,a,i,!0),l=[];if(!u||u.next===u.prev)return l;if(o&&(u=function(t,n,i,e){for(var r=[],s=0,o=n.length;s<o;s++){var a=h(t,n[s]*e,s<o-1?n[s+1]*e:t.length,e,!1);a===a.next&&(a.steiner=!0),r.push(m(a))}r.sort(p);for(var u=0;u<r.length;u++)i=d(r[u],i);return i}(t,n,u,i)),t.length>80*i){e=1/0,r=1/0;for(var f=-1/0,x=-1/0,y=i;y<a;y+=i){var v=t[y],g=t[y+1];v<e&&(e=v),g<r&&(r=g),v>f&&(f=v),g>x&&(x=g)}s=0!==(s=Math.max(f-e,x-r))?32767/s:0}return c(u,l,i,e,r,s,0),l}function h(t,n,i,e,r){var s;if(r===function(t,n,i,e){for(var r=0,s=n,o=i-e;s<i;s+=e)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}(t,n,i,e)>0)for(var o=n;o<i;o+=e)s=C(o/e|0,t[o],t[o+1],s);else for(var a=i-e;a>=n;a-=e)s=C(a/e|0,t[a],t[a+1],s);return s&&M(s,s.next)&&(E(s),s=s.next),s}function u(t,n){if(!t)return t;n||(n=t);var i,e=t;do{if(i=!1,e.steiner||!M(e,e.next)&&0!==b(e.prev,e,e.next))e=e.next;else{if(E(e),(e=n=e.prev)===e.next)break;i=!0}}while(i||e!==n);return n}function c(t,n,i,e,r,s,o){if(t){!o&&s&&function(t,n,i,e){var r=t;do{0===r.z&&(r.z=g(r.x,r.y,n,i,e)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var n,i=1;do{var e=t,r=void 0;t=null;var s=null;for(n=0;e;){n++;for(var o=e,a=0,h=0;h<i&&(a++,o=o.nextZ);h++);for(var u=i;a>0||u>0&&o;)0!==a&&(0===u||!o||e.z<=o.z)?(r=e,e=e.nextZ,a--):(r=o,o=o.nextZ,u--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;e=o}s.nextZ=null,i*=2}while(n>1)}(r)}(t,e,r,s);for(var a=t;t.prev!==t.next;){var h=t.prev,p=t.next;if(s?f(t,e,r,s):l(t))n.push(h.i,t.i,p.i),E(t),t=p.next,a=p.next;else if((t=p)===a){o?1===o?c(t=x(u(t),n),n,i,e,r,s,2):2===o&&y(t,n,i,e,r,s):c(u(t),n,i,e,r,s,1);break}}}}function l(t){var n=t.prev,i=t,e=t.next;if(b(n,i,e)>=0)return!1;for(var r=n.x,s=i.x,o=e.x,a=n.y,h=i.y,u=e.y,c=Math.min(r,s,o),l=Math.min(a,h,u),f=Math.max(r,s,o),x=Math.max(a,h,u),y=e.next;y!==n;){if(y.x>=c&&y.x<=f&&y.y>=l&&y.y<=x&&_(r,a,s,h,o,u,y.x,y.y)&&b(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function f(t,n,i,e){var r=t.prev,s=t,o=t.next;if(b(r,s,o)>=0)return!1;for(var a=r.x,h=s.x,u=o.x,c=r.y,l=s.y,f=o.y,x=Math.min(a,h,u),y=Math.min(c,l,f),p=Math.max(a,h,u),d=Math.max(c,l,f),v=g(x,y,n,i,e),m=g(p,d,n,i,e),z=t.prevZ,w=t.nextZ;z&&z.z>=v&&w&&w.z<=m;){if(z.x>=x&&z.x<=p&&z.y>=y&&z.y<=d&&z!==r&&z!==o&&_(a,c,h,l,u,f,z.x,z.y)&&b(z.prev,z,z.next)>=0)return!1;if(z=z.prevZ,w.x>=x&&w.x<=p&&w.y>=y&&w.y<=d&&w!==r&&w!==o&&_(a,c,h,l,u,f,w.x,w.y)&&b(w.prev,w,w.next)>=0)return!1;w=w.nextZ}for(;z&&z.z>=v;){if(z.x>=x&&z.x<=p&&z.y>=y&&z.y<=d&&z!==r&&z!==o&&_(a,c,h,l,u,f,z.x,z.y)&&b(z.prev,z,z.next)>=0)return!1;z=z.prevZ}for(;w&&w.z<=m;){if(w.x>=x&&w.x<=p&&w.y>=y&&w.y<=d&&w!==r&&w!==o&&_(a,c,h,l,u,f,w.x,w.y)&&b(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function x(t,n){var i=t;do{var e=i.prev,r=i.next.next;!M(e,r)&&A(e,i,i.next,r)&&k(e,r)&&k(r,e)&&(n.push(e.i,i.i,r.i),E(i),E(i.next),i=t=r),i=i.next}while(i!==t);return u(i)}function y(t,n,i,e,r,s){var o=t;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&w(o,a)){var h=O(o,a);return o=u(o,o.next),h=u(h,h.next),c(o,n,i,e,r,s,0),void c(h,n,i,e,r,s,0)}a=a.next}o=o.next}while(o!==t)}function p(t,n){var i=t.x-n.x;0===i&&(0===(i=t.y-n.y)&&(i=(t.next.y-t.y)/(t.next.x-t.x)-(n.next.y-n.y)/(n.next.x-n.x)));return i}function d(t,n){var i=function(t,n){var i,e=n,r=t.x,s=t.y,o=-1/0;if(M(t,e))return e;do{if(M(t,e.next))return e.next;if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=r&&a>o&&(o=a,i=e.x<e.next.x?e:e.next,a===r))return i}e=e.next}while(e!==n);if(!i)return null;var h=i,u=i.x,c=i.y,l=1/0;e=i;do{if(r>=e.x&&e.x>=u&&r!==e.x&&z(s<c?r:o,s,u,c,s<c?o:r,s,e.x,e.y)){var f=Math.abs(s-e.y)/(r-e.x);k(e,t)&&(f<l||f===l&&(e.x>i.x||e.x===i.x&&v(i,e)))&&(i=e,l=f)}e=e.next}while(e!==h);return i}(t,n);if(!i)return n;var e=O(i,t);return u(e,e.next),u(i,i.next)}function v(t,n){return b(t.prev,t,n.prev)<0&&b(n.next,t,t.next)<0}function g(t,n,i,e,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-e)*r|0)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function m(t){var n=t,i=t;do{(n.x<i.x||n.x===i.x&&n.y<i.y)&&(i=n),n=n.next}while(n!==t);return i}function z(t,n,i,e,r,s,o,a){return(r-o)*(n-a)>=(t-o)*(s-a)&&(t-o)*(e-a)>=(i-o)*(n-a)&&(i-o)*(s-a)>=(r-o)*(e-a)}function _(t,n,i,e,r,s,o,a){return!(t===o&&n===a)&&z(t,n,i,e,r,s,o,a)}function w(t,n){return t.next.i!==n.i&&t.prev.i!==n.i&&!function(t,n){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==n.i&&i.next.i!==n.i&&A(i,i.next,t,n))return!0;i=i.next}while(i!==t);return!1}(t,n)&&(k(t,n)&&k(n,t)&&function(t,n){var i=t,e=!1,r=(t.x+n.x)/2,s=(t.y+n.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(e=!e),i=i.next}while(i!==t);return e}(t,n)&&(b(t.prev,t,n.prev)||b(t,n.prev,n))||M(t,n)&&b(t.prev,t,t.next)>0&&b(n.prev,n,n.next)>0)}function b(t,n,i){return(n.y-t.y)*(i.x-n.x)-(n.x-t.x)*(i.y-n.y)}function M(t,n){return t.x===n.x&&t.y===n.y}function A(t,n,i,e){var r=P(b(t,n,i)),s=P(b(t,n,e)),o=P(b(i,e,t)),a=P(b(i,e,n));return r!==s&&o!==a||(!(0!==r||!S(t,i,n))||(!(0!==s||!S(t,e,n))||(!(0!==o||!S(i,t,e))||!(0!==a||!S(i,n,e)))))}function S(t,n,i){return n.x<=Math.max(t.x,i.x)&&n.x>=Math.min(t.x,i.x)&&n.y<=Math.max(t.y,i.y)&&n.y>=Math.min(t.y,i.y)}function P(t){return t>0?1:t<0?-1:0}function k(t,n){return b(t.prev,t,t.next)<0?b(t,n,t.next)>=0&&b(t,t.prev,n)>=0:b(t,n,t.prev)<0||b(t,t.next,n)<0}function O(t,n){var i=F(t.i,t.x,t.y),e=F(n.i,n.x,n.y),r=t.next,s=n.prev;return t.next=n,n.prev=t,i.next=r,r.prev=i,e.next=i,i.prev=e,s.next=e,e.prev=s,e}function C(t,n,i,e){var r=F(t,n,i);return e?(r.next=e.next,r.prev=e,e.next.prev=r,e.next=r):(r.prev=r,r.next=r),r}function E(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function F(t,n,i){return{i:t,x:n,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}var V=function(){function t(t,n,i,e){void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),void 0===e&&(e=1),this.isQuaternion=!0,this._x=t,this._y=n,this._z=i,this._w=e}t.slerpFlat=function(t,n,i,e,r,s,o){var a=i[e+0],h=i[e+1],u=i[e+2],c=i[e+3],l=r[s+0],f=r[s+1],x=r[s+2],y=r[s+3];if(0===o)return t[n+0]=a,t[n+1]=h,t[n+2]=u,void(t[n+3]=c);if(1===o)return t[n+0]=l,t[n+1]=f,t[n+2]=x,void(t[n+3]=y);if(c!==y||a!==l||h!==f||u!==x){var p=1-o,d=a*l+h*f+u*x+c*y,v=d>=0?1:-1,g=1-d*d;if(g>Number.EPSILON){var m=Math.sqrt(g),z=Math.atan2(m,d*v);p=Math.sin(p*z)/m,o=Math.sin(o*z)/m}var _=o*v;if(a=a*p+l*_,h=h*p+f*_,u=u*p+x*_,c=c*p+y*_,p===1-o){var w=1/Math.sqrt(a*a+h*h+u*u+c*c);a*=w,h*=w,u*=w,c*=w}}t[n]=a,t[n+1]=h,t[n+2]=u,t[n+3]=c},t.multiplyQuaternionsFlat=function(t,n,i,e,r,s){var o=i[e],a=i[e+1],h=i[e+2],u=i[e+3],c=r[s],l=r[s+1],f=r[s+2],x=r[s+3];return t[n]=o*x+u*c+a*f-h*l,t[n+1]=a*x+u*l+h*c-o*f,t[n+2]=h*x+u*f+o*l-a*c,t[n+3]=u*x-o*c-a*l-h*f,t};var n=t.prototype;return n.set=function(t,n,i,e){return this._x=t,this._y=n,this._z=i,this._w=e,this._onChangeCallback(),this},n.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)},n.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},n.setFromEuler=function(t,n){void 0===n&&(n=!0);var i=t._x,e=t._y,r=t._z,s=t._order,o=Math.cos,a=Math.sin,h=o(i/2),u=o(e/2),c=o(r/2),l=a(i/2),f=a(e/2),x=a(r/2);switch(s){case"XYZ":this._x=l*u*c+h*f*x,this._y=h*f*c-l*u*x,this._z=h*u*x+l*f*c,this._w=h*u*c-l*f*x;break;case"YXZ":this._x=l*u*c+h*f*x,this._y=h*f*c-l*u*x,this._z=h*u*x-l*f*c,this._w=h*u*c+l*f*x;break;case"ZXY":this._x=l*u*c-h*f*x,this._y=h*f*c+l*u*x,this._z=h*u*x+l*f*c,this._w=h*u*c-l*f*x;break;case"ZYX":this._x=l*u*c-h*f*x,this._y=h*f*c+l*u*x,this._z=h*u*x-l*f*c,this._w=h*u*c+l*f*x;break;case"YZX":this._x=l*u*c+h*f*x,this._y=h*f*c+l*u*x,this._z=h*u*x-l*f*c,this._w=h*u*c-l*f*x;break;case"XZY":this._x=l*u*c-h*f*x,this._y=h*f*c-l*u*x,this._z=h*u*x+l*f*c,this._w=h*u*c+l*f*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!0===n&&this._onChangeCallback(),this},n.setFromAxisAngle=function(t,n){var i=n/2,e=Math.sin(i);return this._x=t.x*e,this._y=t.y*e,this._z=t.z*e,this._w=Math.cos(i),this._onChangeCallback(),this},n.setFromRotationMatrix=function(t){var n=t.elements,i=n[0],e=n[4],r=n[8],s=n[1],o=n[5],a=n[9],h=n[2],u=n[6],c=n[10],l=i+o+c;if(l>0){var f=.5/Math.sqrt(l+1);this._w=.25/f,this._x=(u-a)*f,this._y=(r-h)*f,this._z=(s-e)*f}else if(i>o&&i>c){var x=2*Math.sqrt(1+i-o-c);this._w=(u-a)/x,this._x=.25*x,this._y=(e+s)/x,this._z=(r+h)/x}else if(o>c){var y=2*Math.sqrt(1+o-i-c);this._w=(r-h)/y,this._x=(e+s)/y,this._y=.25*y,this._z=(a+u)/y}else{var p=2*Math.sqrt(1+c-i-o);this._w=(s-e)/p,this._x=(r+h)/p,this._y=(a+u)/p,this._z=.25*p}return this._onChangeCallback(),this},n.setFromUnitVectors=function(t,n){var i=t.dot(n)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*n.z-t.z*n.y,this._y=t.z*n.x-t.x*n.z,this._z=t.x*n.y-t.y*n.x,this._w=i),this.normalize()},n.rotateTowards=function(t,n){var i=this.angleTo(t);if(0===i)return this;var e=Math.min(1,n/i);return this.slerp(t,e),this},n.identity=function(){return this.set(0,0,0,1)},n.invert=function(){return this.conjugate()},n.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},n.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},n.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},n.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},n.normalize=function(){var t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},n.multiply=function(t){return this.multiplyQuaternions(this,t)},n.premultiply=function(t){return this.multiplyQuaternions(t,this)},n.multiplyQuaternions=function(t,n){var i=t._x,e=t._y,r=t._z,s=t._w,o=n._x,a=n._y,h=n._z,u=n._w;return this._x=i*u+s*o+e*h-r*a,this._y=e*u+s*a+r*o-i*h,this._z=r*u+s*h+i*a-e*o,this._w=s*u-i*o-e*a-r*h,this._onChangeCallback(),this},n.slerp=function(t,n){if(0===n)return this;if(1===n)return this.copy(t);var i=this._x,e=this._y,r=this._z,s=this._w,o=s*t._w+i*t._x+e*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=s,this._x=i,this._y=e,this._z=r,this;var a=1-o*o;if(a<=Number.EPSILON){var h=1-n;return this._w=h*s+n*this._w,this._x=h*i+n*this._x,this._y=h*e+n*this._y,this._z=h*r+n*this._z,this.normalize(),this}var u=Math.sqrt(a),c=Math.atan2(u,o),l=Math.sin((1-n)*c)/u,f=Math.sin(n*c)/u;return this._w=s*l+this._w*f,this._x=i*l+this._x*f,this._y=e*l+this._y*f,this._z=r*l+this._z*f,this._onChangeCallback(),this},n.slerpQuaternions=function(t,n,i){return this.copy(t).slerp(n,i)},n.random=function(){var t=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),i=Math.random(),e=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(e*Math.sin(t),e*Math.cos(t),r*Math.sin(n),r*Math.cos(n))},n.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},n.fromArray=function(t,n){return void 0===n&&(n=0),this._x=t[n],this._y=t[n+1],this._z=t[n+2],this._w=t[n+3],this._onChangeCallback(),this},n.toArray=function(t,n){return void 0===t&&(t=[]),void 0===n&&(n=0),t[n]=this._x,t[n+1]=this._y,t[n+2]=this._z,t[n+3]=this._w,t},n.fromBufferAttribute=function(t,n){return this._x=t.getX(n),this._y=t.getY(n),this._z=t.getZ(n),this._w=t.getW(n),this._onChangeCallback(),this},n.toJSON=function(){return this.toArray()},n._onChange=function(t){return this._onChangeCallback=t,this},n._onChangeCallback=function(){},e(t,[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}]),t}(),j=new V,I=function(){function t(t,n,i){void 0===t&&(t=0),void 0===n&&(n=0),void 0===i&&(i=0),this.x=t,this.y=n,this.z=i}var n=t.prototype;return n.set=function(t,n,i){return void 0===i&&(i=this.z),this.x=t,this.y=n,this.z=i,this},n.clone=function(){return new this.constructor(this.x,this.y,this.z)},n.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},n.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},n.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},n.addVectors=function(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this.z=t.z+n.z,this},n.addScaledVector=function(t,n){return this.x+=t.x*n,this.y+=t.y*n,this.z+=t.z*n,this},n.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},n.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},n.subVectors=function(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this.z=t.z-n.z,this},n.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},n.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},n.multiplyVectors=function(t,n){return this.x=t.x*n.x,this.y=t.y*n.y,this.z=t.z*n.z,this},n.applyAxisAngle=function(t,n){return this.applyQuaternion(j.setFromAxisAngle(t,n))},n.applyMatrix4=function(t){var n=this.x,i=this.y,e=this.z,r=t.elements,s=1/(r[3]*n+r[7]*i+r[11]*e+r[15]);return this.x=(r[0]*n+r[4]*i+r[8]*e+r[12])*s,this.y=(r[1]*n+r[5]*i+r[9]*e+r[13])*s,this.z=(r[2]*n+r[6]*i+r[10]*e+r[14])*s,this},n.applyQuaternion=function(t){var n=this.x,i=this.y,e=this.z,r=t.x,s=t.y,o=t.z,a=t.w,h=a*n+s*e-o*i,u=a*i+o*n-r*e,c=a*e+r*i-s*n,l=-r*n-s*i-o*e;return this.x=h*a+l*-r+u*-o-c*-s,this.y=u*a+l*-s+c*-r-h*-o,this.z=c*a+l*-o+h*-s-u*-r,this},n.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},n.divideScalar=function(t){return this.multiplyScalar(1/t)},n.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},n.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},n.clamp=function(t,n){return this.x=Math.max(t.x,Math.min(n.x,this.x)),this.y=Math.max(t.y,Math.min(n.y,this.y)),this.z=Math.max(t.z,Math.min(n.z,this.z)),this},n.clampScalar=function(t,n){return this.x=Math.max(t,Math.min(n,this.x)),this.y=Math.max(t,Math.min(n,this.y)),this.z=Math.max(t,Math.min(n,this.z)),this},n.clampLength=function(t,n){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(n,i)))},n.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},n.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},n.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},n.normalize=function(){return this.divideScalar(this.length()||1)},n.setLength=function(t){return this.normalize().multiplyScalar(t)},n.lerp=function(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this.z+=(t.z-this.z)*n,this},n.lerpVectors=function(t,n,i){return this.x=t.x+(n.x-t.x)*i,this.y=t.y+(n.y-t.y)*i,this.z=t.z+(n.z-t.z)*i,this},n.cross=function(t){return this.crossVectors(this,t)},n.crossVectors=function(t,n){var i=t.x,e=t.y,r=t.z,s=n.x,o=n.y,a=n.z;return this.x=e*a-r*o,this.y=r*s-i*a,this.z=i*o-e*s,this},n.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},n.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},n.fromArray=function(t,n){return void 0===n&&(n=0),this.x=t[n],this.y=t[n+1],this.z=t[n+2],this},n.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},t}();function Z(t,n){let i=t.length-1;for(let e=0,r=n.length;e<r;e++)t[++i]=n[e]}function L(t){let n,i,e=0,r=1;const s=t.length;for(;r<s;)n=i||t[0],i=t[r],e+=(i[0]-n[0])*(i[1]+n[1]),r++;return e>0}function q(t){U(t)||t.push(t[0])}function U(t){const n=t.length,[i,e]=t[0],[r,s]=t[n-1];return i===r&&e===s}function T(t){let n=0,i=0;const e=t.length;for(;i<e;)n+=t[i].length,i++;return n}function N(t,n){n=n||[1/0,1/0,-1/0,-1/0];for(let i=0,e=t.length;i<e;i++){const e=t[i];if(Array.isArray(e[0][0]))N(e,n);else for(let t=0,i=e.length;t<i;t++){const i=e[t],[r,s]=i;n[0]=Math.min(n[0],r),n[1]=Math.min(n[1],s),n[2]=Math.max(n[2],r),n[3]=Math.max(n[3],s)}}return n}function B(t,n){for(let i=0,e=t.length;i<e;i++){const e=t[i];q(e),0===i?L(e)||(t[i]=e.reverse()):L(e)&&(t[i]=e.reverse()),n&&U(e)&&e.splice(e.length-1,1)}}function R(t,n,i){return t[0]=n[0]-i[0],t[1]=n[1]-i[1],t[2]=n[2]-i[2],t}function W(t,n){const i=n[0],e=n[1],r=n[2],s=Math.sqrt(i*i+e*e+r*r)||1;return t[0]=i/s,t[1]=e/s,t[2]=r/s,t}function Q(t,n,i){const e=n[0],r=n[1],s=n[2],o=i[0],a=i[1],h=i[2];return t[0]=r*h-s*a,t[1]=s*o-e*h,t[2]=e*a-r*o,t}function D(t,n){function i(t,n,i,e){t[0]=n,t[1]=i,t[2]=e}const e=[],r=[],s=[],o=[],a=[],h=[],u=t.length,c=new Float32Array(n.length);let l=0;for(;l<u;){const u=3*t[l],f=3*t[l+1],x=3*t[l+2];i(e,n[u],n[u+1],n[u+2]),i(r,n[f],n[f+1],n[f+2]),i(s,n[x],n[x+1],n[x+2]),R(a,s,r),R(o,e,r),Q(h,a,o);for(let t=0;t<3;t++)c[u+t]+=h[t],c[f+t]+=h[t],c[x+t]+=h[t];l+=3}let f=0;const x=c.length;for(;f<x;)i(h,c[f],c[f+1],c[f+2]),W(h,h),c[f]=h[0]||0,c[f+1]=h[1]||0,c[f+2]=h[2]||0,f+=3;return c}function X(t){if(1===t.length){return{position:t[0].position,normal:t[0].normal,uv:t[0].uv,indices:t[0].indices,results:t}}let n=0,i=0;for(let e=0,r=t.length;e<r;e++){const{position:r,indices:s}=t[e];n+=r.length,i+=s.length}const e={position:new Float32Array(n),normal:new Float32Array(n),uv:new Float32Array(n/3*2),indices:new Uint32Array(i),results:t};let r=0,s=0,o=0,a=0;for(let n=0,i=t.length;n<i;n++){const{position:i,indices:h,normal:u,uv:c}=t[n];e.position.set(i,r),e.normal.set(u,r),e.uv.set(c,a);let l=0;const f=h.length;for(;l<f;){const t=h[l]+s;e.indices[o]=t,o++,l++}a+=c.length,r+=i.length,s+=i.length/3}return e}function G(t){return 180*t/Math.PI}function Y(t){return t/180*Math.PI}function J(t,n,i,e,r,s){const o=3*i,a=3*e,h=3*r,u=3*s,c=n[o],l=n[o+1],f=n[o+2],x=n[a],y=n[a+1],p=n[a+2],d=n[h],v=n[h+1],g=n[h+2],m=n[u],z=n[u+1],_=n[u+2];let w=t.length-1;Math.abs(l-y)<Math.abs(c-x)?(t[++w]=c,t[++w]=1-f,t[++w]=x,t[++w]=1-p,t[++w]=d,t[++w]=1-g,t[++w]=m,t[++w]=1-_):(t[++w]=l,t[++w]=1-f,t[++w]=y,t[++w]=1-p,t[++w]=v,t[++w]=1-g,t[++w]=z,t[++w]=1-_)}function H(t){const n=[];for(let i=0,e=t.length;i<e;i++){const e=t[i],[r,s,o]=e,a=new I(r,s,o||0);n[i]=a}return n}function $(t,n){return t[0]===n[0]&&t[1]===n[1]}function K(t,n){const i=n[0]-t[0],e=n[1]-t[1];return Math.sqrt(i*i+e*e)}function tt(t){t.lineWidth=Math.max(0,t.lineWidth),t.depth=Math.max(0,t.depth),t.sideDepth=Math.max(0,t.sideDepth)}function nt(t,n){const i=n.bottomStickGround,e=n.depth,r=t.depths;let s=e,o=e;r&&(s=r[0],o=r[1]);const{leftPoints:a,rightPoints:h}=t,u=t.line,c=n.pathUV;let l=u;if(a.length>l.length&&(l=a),c){!function(t){let n=0;for(let i=0,e=t.length;i<e;i++){const e=t[i],r=t[i+1];if(0===i&&(e.distance=0),e&&r){const[t,i,s]=e,[o,a,h]=r,u=t-o,c=i-a,l=(s||0)-(h||0);n+=Math.sqrt(u*u+c*c+l*l),r.distance=n}}}(l);for(let t=0,n=l.length;t<n;t++)a[t].distance=h[t].distance=l[t].distance}let f=0,x=a.length;const y=[],p=[],d=[];for(;f<x;){const t=3*f,[n,e,r]=a[f];y[t]=n,y[t+1]=e,y[t+2]=s+r;const[u,p,v]=h[f],g=3*x+t;y[g]=u,y[g+1]=p,y[g+2]=o+v;const m=2*x*3+t;y[m]=n,y[m+1]=e,y[m+2]=r,i&&(y[m+2]=0);const z=2*x*3+3*x+t;if(y[z]=u,y[z+1]=p,y[z+2]=v,i&&(y[z+2]=0),c){let t=l[f].distance;const n=2*f;d[n]=t,d[n+1]=1;const i=2*x+n;d[i]=t,d[i+1]=0;const e=2*x*2+n;d[e]=t,d[e+1]=1;const r=2*x*2+2*x+n;d[r]=t,d[r+1]=0}f++}if(!c){f=0,x=y.length;let t=d.length-1;for(;f<x;){const n=y[f],i=y[f+1];d[++t]=n,d[++t]=i,f+=3}}f=0,x=a.length;let v=p.length-1;for(;f<x-1;){const t=f,n=f+1,i=t+x,e=n+x;p[++v]=t,p[++v]=i,p[++v]=n,p[++v]=i,p[++v]=e,p[++v]=n;const r=f+2*x,s=r+1,o=r+x,a=s+x;p[++v]=r,p[++v]=o,p[++v]=s,p[++v]=o,p[++v]=a,p[++v]=s,f++}if(t.indices=p,t.points=y,t.uv=d,r)for(x=a.length,f=0;f<x;)a[f].depth=s,h[f].depth=o,f++}function it(t,n){const{points:i,indices:e,leftPoints:r,rightPoints:s,uv:o}=t,a=n.depth,h=n.bottomStickGround,u=[r,s],c=t.depths,l=n.pathUV,f=n.lineWidth;let x=i.length-1,y=e.length-1,p=o.length-1;function d(t,n){const r=i.length/3,s=c?t.depth:a,u=c?n.depth:a;i[++x]=t[0],i[++x]=t[1],i[++x]=s+t[2],i[++x]=n[0],i[++x]=n[1],i[++x]=u+n[2],i[++x]=t[0],i[++x]=t[1],i[++x]=h?0:t[2],i[++x]=n[0],i[++x]=n[1],i[++x]=h?0:n[2];const d=r+2,v=r+3,g=r,m=r+1;e[++y]=d,e[++y]=g,e[++y]=v,e[++y]=g,e[++y]=m,e[++y]=v,l?(o[++p]=t.distance,o[++p]=s/f,o[++p]=n.distance,o[++p]=u/f,o[++p]=t.distance,o[++p]=0,o[++p]=n.distance,o[++p]=0):J(o,i,d,v,g,m)}for(let t=0,n=u.length;t<n;t++){let n=u[t];t>0&&(n=n.map((t=>t)),n=n.reverse());let i=0;const e=n.length-1;for(;i<e;){d(n[i],n[i+1]),i++}}const v=r.length,g=[s[0],r[0],r[v-1],s[v-1]];for(let t=0;t<g.length;t+=2){d(g[t],g[t+1])}}const et={x:0,y:0},rt={x:0,y:0};function st(t,n){let i=(n=Object.assign({},{lineWidth:1,cutCorner:!1},n)).lineWidth/2;n.isSlope&&(i*=2);const{cutCorner:e}=n,r=[],s=[],o=[],a=t.length,h=()=>{const t=s.length;if(t){s.push(s[t-1]),o.push(o[t-1]);const n=r.length;r.push(r[n-2],r[n-1])}};let u,c,l,f=0;for(;f<a;){let n,x=t[f],y=t[f+1];const p=x;if(u&&$(u,p)){h(),f++;continue}let d=!1;if(f===a-1){if(x=t[a-2],y=t[a-1],$(x,y))for(let n=t.indexOf(x);n>=0;n--){const i=t[n];if(!$(i,p)){x=i;break}}}else{if($(x,y))for(let n=t.indexOf(y);n<a;n++){const i=t[n];if(!$(i,p)){y=i;break}}if($(x,y)){d=!0;for(let n=t.indexOf(x);n>=0;n--){const i=t[n];if(!$(i,p)){x=i;break}}}}if($(x,y)){console.error("not find next vertex:index:",f,t),h(),f++;continue}let v=y[1]-x[1],g=y[0]-x[0],m=0;const z=G(Math.atan2(v,g));if(0===f||f===a-1||d)m=z-90;else{if(n=t[f-1],$(n,y)||$(n,x))for(let i=t.indexOf(y);i>=0;i--){const e=t[i];if(!$(e,y)&&!$(e,x)){n=e;break}}if($(n,y)||$(n,x)||$(x,y)){console.error("not find pre vertex:index:",f,t),h(),f++;continue}const i=x[1]-n[1],e=x[0]-n[0],r=G(Math.atan2(i,e));if(Math.abs(Math.abs(r-z)-180)<=1e-4)m=z-90;else{et.x=n[0]-x[0],et.y=n[1]-x[1],rt.x=y[0]-x[0],rt.y=y[1]-x[1],(0===et.x&&0===et.y||0===rt.x&&0===rt.y)&&console.error("has repeat vertex,the index:",f);const t=ot(et,rt);m=Math.abs(t)<=1?z-90:z-t/2}}const _=Y(m),w=p,b=[Math.cos(_)+w[0],Math.sin(_)+w[1]],[M,A]=ht(x,y,i);if(!M||!A){console.error("translateLine line eror,the index:",f,t),f++;continue}let S=ut(M[0],M[1],w,b),P=ut(A[0],A[1],w,b);if(!S||!P){console.error("not find Intersection,the index:",f,t);const n=r.length,i=r[n-2],e=r[n-1];if(!i||!e){f++;continue}S=[i[0],i[1]],P=[e[0],e[1]]}S[2]=p[2]||0,P[2]=p[2]||0,r.push(S,P);let k=!1;if(e){const t=2*i;(K(p,S)>t||K(p,P)>t)&&(k=!0)}if(k&&n&&c&&l){let t=S;K(S,n)<K(P,n)&&(t=P);const e=t[1]-p[1],r=t[0]-p[0],a=Math.atan2(e,r)/Math.PI*180,h=Y(a),u=Math.cos(h)*i+p[0],f=Math.sin(h)*i+p[1],d=[u,f],v=Y(a+90),g=[Math.cos(v)+u,Math.sin(v)+f];let m=c,z=M,_=s,w=o;at(t,x,y)||(m=l,z=A,_=o,w=s);let b=ut(m[0],m[1],d,g),k=ut(z[0],z[1],d,g);b[2]=p[2]||0,k[2]=p[2]||0;const O=t===S?P:S;_.push(b,k),w.push(O,[...O])}else at(S,x,y)?(s.push(S),o.push(P)):(s.push(P),o.push(S));c=M,l=A,u=p,f++}return{offsetPoints:r,leftPoints:s,rightPoints:o,line:t}}const ot=({x:t,y:n},{x:i,y:e})=>{const r=t*i+n*e,s=t*e-n*i;return Math.atan2(s,r)/Math.PI*180};function at(t,n,i){const[e,r]=n,[s,o]=i,[a,h]=t;return(r-o)*a+(s-e)*h+e*o-s*r>0}function ht(t,n,i){const e=n[1]-t[1],r=n[0]-t[0];if(0===e&&0===r)return null;const s=Math.atan2(e,r),o=s+Math.PI/2;let a=Math.cos(o)*i,h=Math.sin(o)*i;const u=[t[0]+a,t[1]+h],c=[n[0]+a,n[1]+h],l=s-Math.PI/2;a=Math.cos(l)*i,h=Math.sin(l)*i;return[[u,c],[[t[0]+a,t[1]+h],[n[0]+a,n[1]+h]]]}function ut(t,n,i,e){const r=n[0]-t[0],s=n[1]-t[1],o=e[0]-i[0],a=e[1]-i[1];if(0===r&&0===o)return null;if(0===s&&0===a)return null;const h=s/r,u=a/o,c=t[1]-h*t[0],l=i[1]-u*i[0];let f,x;return 0===r?(f=t[0],x=u*f+l):0===o?(f=i[0],x=h*f+c):0===s?(x=t[1],f=(x-l)/u):0===a?(x=i[1],f=(x-c)/h):(f=(l-c)/(h-u),x=h*f+c),[f,x]}var ct=function(){function t(){this.pos=new I,this.dir=new I,this.right=new I,this.up=new I,this.dist=0,this.widthScale=1,this.sharp=!1}var n=t.prototype;return n.lerpPathPoints=function(t,n,i){this.pos.lerpVectors(t.pos,n.pos,i),this.dir.lerpVectors(t.dir,n.dir,i),this.up.lerpVectors(t.up,n.up,i),this.right.lerpVectors(t.right,n.right,i),this.dist=(n.dist-t.dist)*i+t.dist,this.widthScale=(n.widthScale-t.widthScale)*i+t.widthScale},n.copy=function(t){this.pos.copy(t.pos),this.dir.copy(t.dir),this.up.copy(t.up),this.right.copy(t.right),this.dist=t.dist,this.widthScale=t.widthScale},t}(),lt=function(){function t(t,n,i,e,r,s,o,a,h,u,c,l,f,x,y,p){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,n,i,e,r,s,o,a,h,u,c,l,f,x,y,p)}var n=t.prototype;return n.set=function(t,n,i,e,r,s,o,a,h,u,c,l,f,x,y,p){var d=this.elements;return d[0]=t,d[4]=n,d[8]=i,d[12]=e,d[1]=r,d[5]=s,d[9]=o,d[13]=a,d[2]=h,d[6]=u,d[10]=c,d[14]=l,d[3]=f,d[7]=x,d[11]=y,d[15]=p,this},n.multiply=function(t){return this.multiplyMatrices(this,t)},n.makeRotationAxis=function(t,n){var i=Math.cos(n),e=Math.sin(n),r=1-i,s=t.x,o=t.y,a=t.z,h=r*s,u=r*o;return this.set(h*s+i,h*o-e*a,h*a+e*o,0,h*o+e*a,u*o+i,u*a-e*s,0,h*a-e*o,u*a+e*s,r*a*a+i,0,0,0,0,1),this},n.equals=function(t){for(var n=this.elements,i=t.elements,e=0;e<16;e++)if(n[e]!==i[e])return!1;return!0},t}();function ft(t,n,i,e){return function(t,n){var i=1-t;return i*i*n}(t,n)+function(t,n){return 2*(1-t)*t*n}(t,i)+function(t,n){return t*t*n}(t,e)}var xt=function(t){var n,i;function e(n,i,e){var r;return void 0===n&&(n=new I),void 0===i&&(i=new I),void 0===e&&(e=new I),(r=t.call(this)||this).isQuadraticBezierCurve3=!0,r.type="QuadraticBezierCurve3",r.v0=n,r.v1=i,r.v2=e,r}return i=t,(n=e).prototype=Object.create(i.prototype),n.prototype.constructor=n,r(n,i),e.prototype.getPoint=function(t,n){void 0===n&&(n=new I);var i=n,e=this.v0,r=this.v1,s=this.v2;return i.set(ft(t,e.x,r.x,s.x),ft(t,e.y,r.y,s.y),ft(t,e.z,r.z,s.z)),i},e}(function(){function t(){this.type="Curve",this.arcLengthDivisions=200}var n=t.prototype;return n.getPoint=function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},n.getPointAt=function(t,n){var i=this.getUtoTmapping(t);return this.getPoint(i,n)},n.getPoints=function(t){void 0===t&&(t=5);for(var n=[],i=0;i<=t;i++)n.push(this.getPoint(i/t));return n},n.getLength=function(){var t=this.getLengths();return t[t.length-1]},n.getLengths=function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var n,i=[],e=this.getPoint(0),r=0;i.push(0);for(var s=1;s<=t;s++)r+=(n=this.getPoint(s/t)).distanceTo(e),i.push(r),e=n;return this.cacheArcLengths=i,i},n.getUtoTmapping=function(t,n){var i,e=this.getLengths(),r=0,s=e.length;i=n||t*e[s-1];for(var o,a=0,h=s-1;a<=h;)if((o=e[r=Math.floor(a+(h-a)/2)]-i)<0)a=r+1;else{if(!(o>0)){h=r;break}h=r-1}if(e[r=h]===i)return r/(s-1);var u=e[r];return(r+(i-u)/(e[r+1]-u))/(s-1)},t}()),yt=new I,pt=new I,dt=new I,vt=new lt,gt=new xt;var mt=function(){function t(){this.array=[],this.count=0}var n=t.prototype;return n.set=function(t,n,i,e,r){if(void 0===n&&(n=.1),void 0===i&&(i=10),void 0===e&&(e=null),void 0===r&&(r=!1),(t=t.slice(0)).length<2)return console.warn("PathPointList: points length less than 2."),void(this.count=0);r&&!t[0].equals(t[t.length-1])&&t.push((new I).copy(t[0]));for(var s=0,o=t.length;s<o;s++)if(0===s)this._start(t[s],t[s+1],e);else if(s===o-1)if(r){this._corner(t[s],t[1],n,i,e);var a=this.array[0].dist;this.array[0].copy(this.array[this.count-1]),this.array[0].dist=a}else this._end(t[s]);else this._corner(t[s],t[s+1],n,i,e)},n.distance=function(){return this.count>0?this.array[this.count-1].dist:0},n._getByIndex=function(t){return this.array[t]||(this.array[t]=new ct),this.array[t]},n._start=function(t,n,i){this.count=0;var e=this._getByIndex(this.count);if(e.pos.copy(t),e.dir.subVectors(n,t),i)e.up.copy(i);else{var r=Number.MAX_VALUE,s=Math.abs(e.dir.x),o=Math.abs(e.dir.y),a=Math.abs(e.dir.z);s<r&&(r=s,e.up.set(1,0,0)),o<r&&(r=o,e.up.set(0,1,0)),a<r&&e.up.set(0,0,1)}e.right.crossVectors(e.dir,e.up).normalize(),e.up.crossVectors(e.right,e.dir).normalize(),e.dist=0,e.widthScale=1,e.sharp=!1,e.dir.normalize(),this.count++},n._end=function(t){var n=this.array[this.count-1],i=this._getByIndex(this.count);i.pos.copy(t),i.dir.subVectors(t,n.pos);var e=i.dir.length();i.dir.normalize(),i.up.copy(n.up);var r=yt.crossVectors(n.dir,i.dir);if(r.length()>Number.EPSILON){r.normalize();var s=Math.acos(Math.min(Math.max(n.dir.dot(i.dir),-1),1));i.up.applyMatrix4(vt.makeRotationAxis(r,s))}i.right.crossVectors(i.dir,i.up).normalize(),i.dist=n.dist+e,i.widthScale=1,i.sharp=!1,this.count++},n._corner=function(t,n,i,e,r){if(i>0&&e>0){for(var s=function(t,n,i,e,r,s){var o=yt.subVectors(n,t),a=pt.subVectors(i,n),h=o.length(),u=a.length();o.normalize(),a.normalize();var c=Math.min(.999999*(r?h/2:h),e);s.v0.copy(n).sub(o.multiplyScalar(c)),s.v1.copy(n);var l=Math.min(u/2*.999999,e);return s.v2.copy(n).add(a.multiplyScalar(l)),s}(this.array[this.count-1].pos,t,n,i,this.count-1==0,gt),o=s.getPoints(e),a=0;a<e;a++)this._sharpCorner(o[a],o[a+1],r,0===a?1:0);o[e].equals(n)||this._sharpCorner(o[e],n,r,2)}else this._sharpCorner(t,n,r,0,!0)},n._sharpCorner=function(t,n,i,e,r){void 0===e&&(e=0),void 0===r&&(r=!1);var s=this.array[this.count-1],o=this._getByIndex(this.count),a=yt.subVectors(t,s.pos),h=pt.subVectors(n,t),u=a.length();if(a.normalize(),h.normalize(),o.pos.copy(t),1===e?o.dir.copy(a):2===e?o.dir.copy(h):(o.dir.addVectors(a,h),o.dir.normalize()),i)1===o.dir.dot(i)?o.right.crossVectors(h,i).normalize():o.right.crossVectors(o.dir,i).normalize(),o.up.crossVectors(o.right,o.dir).normalize();else{o.up.copy(s.up);var c=dt.crossVectors(s.dir,o.dir);if(c.length()>Number.EPSILON){c.normalize();var l=Math.acos(Math.min(Math.max(s.dir.dot(o.dir),-1),1));o.up.applyMatrix4(vt.makeRotationAxis(c,l))}o.right.crossVectors(o.dir,o.up).normalize()}o.dist=s.dist+u;var f=a.dot(h);o.widthScale=Math.min(1/Math.sqrt((1+f)/2),1.415)||1,o.sharp=Math.abs(f-1)>.05&&r,this.count++},t}();const zt=new I(0,0,1),_t=new I,wt=new I,bt=new I,Mt=new I,At=new I,St=new I;const Pt=new I(0,0,1),kt=new I;const Ot=new I(0,0,1),Ct=new I;function Et(t,n){const[i,e]=t,[r,s]=n,o=s-e,a=r-i;return Math.atan2(o,a)}const Ft=new I(0,0,0);var Vt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,It=Object.getOwnPropertyNames,Zt=Object.prototype.hasOwnProperty,Lt=function(t){return function(n,i){return t&&t.get(n)||(i=function(t,n,i,e){if(n&&"object"==typeof n||"function"==typeof n)for(var r,s=function(){var s=r.value;Zt.call(t,s)||!i&&"default"===s||Vt(t,s,{get:function(){return n[s]},enumerable:!(e=jt(n,s))||e.enumerable})},a=o(It(n));!(r=a()).done;)s();return t}(Vt({},"__esModule",{value:!0}),n,1),t&&t.set(n,i),i)}}("undefined"!=typeof WeakMap?new WeakMap:0),qt={};!function(t,n){for(var i in n)Vt(t,i,{get:n[i],enumerable:!0})}(qt,{Bezier:function(){return cn}});var Ut=Math.abs,Tt=Math.cos,Nt=Math.sin,Bt=Math.acos,Rt=Math.atan2,Wt=Math.sqrt,Qt=Math.pow;function Dt(t){return t<0?-Qt(-t,1/3):Qt(t,1/3)}var Xt=Math.PI,Gt=2*Xt,Yt=Xt/2,Jt=Number.MAX_SAFE_INTEGER||9007199254740991,Ht=Number.MIN_SAFE_INTEGER||-9007199254740991,$t={x:0,y:0,z:0},Kt={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(t,n){var i=n(t),e=i.x*i.x+i.y*i.y;return void 0!==i.z&&(e+=i.z*i.z),Wt(e)},compute:function(t,n,i){if(0===t)return n[0].t=0,n[0];var e=n.length-1;if(1===t)return n[e].t=1,n[e];var r=1-t,s=n;if(0===e)return n[0].t=t,n[0];if(1===e){var o={x:r*s[0].x+t*s[1].x,y:r*s[0].y+t*s[1].y,t:t};return i&&(o.z=r*s[0].z+t*s[1].z),o}if(e<4){var a,h,u,c=r*r,l=t*t,f=0;2===e?(s=[s[0],s[1],s[2],$t],a=c,h=r*t*2,u=l):3===e&&(a=c*r,h=c*t*3,u=r*l*3,f=t*l);var x={x:a*s[0].x+h*s[1].x+u*s[2].x+f*s[3].x,y:a*s[0].y+h*s[1].y+u*s[2].y+f*s[3].y,t:t};return i&&(x.z=a*s[0].z+h*s[1].z+u*s[2].z+f*s[3].z),x}for(var y=JSON.parse(JSON.stringify(n));y.length>1;){for(var p=0;p<y.length-1;p++)y[p]={x:y[p].x+(y[p+1].x-y[p].x)*t,y:y[p].y+(y[p+1].y-y[p].y)*t},void 0!==y[p].z&&(y[p].z=y[p].z+(y[p+1].z-y[p].z)*t);y.splice(y.length-1,1)}return y[0].t=t,y[0]},computeWithRatios:function(t,n,i,e){var r,s=1-t,o=i,a=n,h=o[0],u=o[1],c=o[2],l=o[3];return h*=s,u*=t,2===a.length?(r=h+u,{x:(h*a[0].x+u*a[1].x)/r,y:(h*a[0].y+u*a[1].y)/r,z:!!e&&(h*a[0].z+u*a[1].z)/r,t:t}):(h*=s,u*=2*s,c*=t*t,3===a.length?(r=h+u+c,{x:(h*a[0].x+u*a[1].x+c*a[2].x)/r,y:(h*a[0].y+u*a[1].y+c*a[2].y)/r,z:!!e&&(h*a[0].z+u*a[1].z+c*a[2].z)/r,t:t}):(h*=s,u*=1.5*s,c*=3*s,l*=t*t*t,4===a.length?(r=h+u+c+l,{x:(h*a[0].x+u*a[1].x+c*a[2].x+l*a[3].x)/r,y:(h*a[0].y+u*a[1].y+c*a[2].y+l*a[3].y)/r,z:!!e&&(h*a[0].z+u*a[1].z+c*a[2].z+l*a[3].z)/r,t:t}):void 0))},derive:function(t,n){for(var i=[],e=t,r=e.length,s=r-1;r>1;r--,s--){for(var o,a=[],h=0;h<s;h++)o={x:s*(e[h+1].x-e[h].x),y:s*(e[h+1].y-e[h].y)},n&&(o.z=s*(e[h+1].z-e[h].z)),a.push(o);i.push(a),e=a}return i},between:function(t,n,i){return n<=t&&t<=i||Kt.approximately(t,n)||Kt.approximately(t,i)},approximately:function(t,n,i){return Ut(t-n)<=(i||1e-6)},length:function(t){for(var n,i=Kt.Tvalues.length,e=0,r=0;r<i;r++)n=.5*Kt.Tvalues[r]+.5,e+=Kt.Cvalues[r]*Kt.arcfn(n,t);return.5*e},map:function(t,n,i,e,r){return e+(r-e)*((t-n)/(i-n))},lerp:function(t,n,i){var e={x:n.x+t*(i.x-n.x),y:n.y+t*(i.y-n.y)};return void 0!==n.z&&void 0!==i.z&&(e.z=n.z+t*(i.z-n.z)),e},pointToString:function(t){var n=t.x+"/"+t.y;return void 0!==t.z&&(n+="/"+t.z),n},pointsToString:function(t){return"["+t.map(Kt.pointToString).join(", ")+"]"},copy:function(t){return JSON.parse(JSON.stringify(t))},angle:function(t,n,i){var e=n.x-t.x,r=n.y-t.y,s=i.x-t.x,o=i.y-t.y;return Rt(e*o-r*s,e*s+r*o)},round:function(t,n){var i=""+t,e=i.indexOf(".");return parseFloat(i.substring(0,e+1+n))},dist:function(t,n){var i=t.x-n.x,e=t.y-n.y;return Wt(i*i+e*e)},closest:function(t,n){var i,e,r=Qt(2,63);return t.forEach((function(t,s){(e=Kt.dist(n,t))<r&&(r=e,i=s)})),{mdist:r,mpos:i}},abcratio:function(t,n){if(2!==n&&3!==n)return!1;if(void 0===t)t=.5;else if(0===t||1===t)return t;var i=Qt(t,n)+Qt(1-t,n);return Ut((i-1)/i)},projectionratio:function(t,n){if(2!==n&&3!==n)return!1;if(void 0===t)t=.5;else if(0===t||1===t)return t;var i=Qt(1-t,n);return i/(Qt(t,n)+i)},lli8:function(t,n,i,e,r,s,o,a){var h=(t-i)*(s-a)-(n-e)*(r-o);return 0!=h&&{x:((t*e-n*i)*(r-o)-(t-i)*(r*a-s*o))/h,y:((t*e-n*i)*(s-a)-(n-e)*(r*a-s*o))/h}},lli4:function(t,n,i,e){var r=t.x,s=t.y,o=n.x,a=n.y,h=i.x,u=i.y,c=e.x,l=e.y;return Kt.lli8(r,s,o,a,h,u,c,l)},lli:function(t,n){return Kt.lli4(t,t.c,n,n.c)},makeline:function(t,n){return new cn(t.x,t.y,(t.x+n.x)/2,(t.y+n.y)/2,n.x,n.y)},findbbox:function(t){var n=Jt,i=Jt,e=Ht,r=Ht;return t.forEach((function(t){var s=t.bbox();n>s.x.min&&(n=s.x.min),i>s.y.min&&(i=s.y.min),e<s.x.max&&(e=s.x.max),r<s.y.max&&(r=s.y.max)})),{x:{min:n,mid:(n+e)/2,max:e,size:e-n},y:{min:i,mid:(i+r)/2,max:r,size:r-i}}},shapeintersections:function(t,n,i,e,r){if(!Kt.bboxoverlap(n,e))return[];var s=[],o=[t.startcap,t.forward,t.back,t.endcap],a=[i.startcap,i.forward,i.back,i.endcap];return o.forEach((function(n){n.virtual||a.forEach((function(e){if(!e.virtual){var o=n.intersects(e,r);o.length>0&&(o.c1=n,o.c2=e,o.s1=t,o.s2=i,s.push(o))}}))})),s},makeshape:function(t,n,i){var e=n.points.length,r=t.points.length,s=Kt.makeline(n.points[e-1],t.points[0]),o=Kt.makeline(t.points[r-1],n.points[0]),a={startcap:s,forward:t,back:n,endcap:o,bbox:Kt.findbbox([s,t,n,o]),intersections:function(t){return Kt.shapeintersections(a,a.bbox,t,t.bbox,i)}};return a},getminmax:function(t,n,i){if(!i)return{min:0,max:0};var e,r,s=Jt,o=Ht;-1===i.indexOf(0)&&(i=[0].concat(i)),-1===i.indexOf(1)&&i.push(1);for(var a=0,h=i.length;a<h;a++)e=i[a],(r=t.get(e))[n]<s&&(s=r[n]),r[n]>o&&(o=r[n]);return{min:s,mid:(s+o)/2,max:o,size:o-s}},align:function(t,n){var i=n.p1.x,e=n.p1.y,r=-Rt(n.p2.y-e,n.p2.x-i);return t.map((function(t){return{x:(t.x-i)*Tt(r)-(t.y-e)*Nt(r),y:(t.x-i)*Nt(r)+(t.y-e)*Tt(r)}}))},roots:function(t,n){n=n||{p1:{x:0,y:0},p2:{x:1,y:0}};var i=t.length-1,e=Kt.align(t,n),r=function(t){return 0<=t&&t<=1};if(2===i){var s=e[0].y,o=e[1].y,a=e[2].y,h=s-2*o+a;if(0!==h){var u=-Wt(o*o-s*a),c=-s+o;return[-(u+c)/h,-(-u+c)/h].filter(r)}return o!==a&&0===h?[(2*o-a)/(2*o-2*a)].filter(r):[]}var l=e[0].y,f=e[1].y,x=e[2].y,y=3*f-l-3*x+e[3].y,p=3*l-6*f+3*x,d=-3*l+3*f,v=l;if(Kt.approximately(y,0)){if(Kt.approximately(p,0))return Kt.approximately(d,0)?[]:[-v/d].filter(r);var g=Wt(d*d-4*p*v),m=2*p;return[(g-d)/m,(-d-g)/m].filter(r)}var z,_=(3*(d/=y)-(p/=y)*p)/3,w=_/3,b=(2*p*p*p-9*p*d+27*(v/=y))/27,M=b/2,A=M*M+w*w*w;if(A<0){var S=-_/3,P=Wt(S*S*S),k=-b/(2*P),O=Bt(k<-1?-1:k>1?1:k),C=2*Dt(P);return[C*Tt(O/3)-p/3,C*Tt((O+Gt)/3)-p/3,C*Tt((O+2*Gt)/3)-p/3].filter(r)}if(0===A)return[2*(z=M<0?Dt(-M):-Dt(M))-p/3,-z-p/3].filter(r);var E=Wt(A);return[(z=Dt(-M+E))-Dt(M+E)-p/3].filter(r)},droots:function(t){if(3===t.length){var n=t[0],i=t[1],e=t[2],r=n-2*i+e;if(0!==r){var s=-Wt(i*i-n*e),o=-n+i;return[-(s+o)/r,-(-s+o)/r]}return i!==e&&0===r?[(2*i-e)/(2*(i-e))]:[]}if(2===t.length){var a=t[0],h=t[1];return a!==h?[a/(a-h)]:[]}return[]},curvature:function(t,n,i,e,r){var s,o,a,h,u,c,l=Kt.compute(t,n),f=Kt.compute(t,i),x=l.x*l.x+l.y*l.y;if(e?(s=Wt(Qt(l.y*f.z-f.y*l.z,2)+Qt(l.z*f.x-f.z*l.x,2)+Qt(l.x*f.y-f.x*l.y,2)),o=Qt(x+l.z*l.z,1.5)):(s=l.x*f.y-l.y*f.x,o=Qt(x,1.5)),0===s||0===o)return{k:0,r:0};if(u=s/o,c=o/s,!r){var y=Kt.curvature(t-.001,n,i,e,!0).k,p=Kt.curvature(t+.001,n,i,e,!0).k;h=(p-u+(u-y))/2,a=(Ut(p-u)+Ut(u-y))/2}return{k:u,r:c,dk:h,adk:a}},inflections:function(t){if(t.length<4)return[];var n=Kt.align(t,{p1:t[0],p2:t.slice(-1)[0]}),i=n[2].x*n[1].y,e=n[3].x*n[1].y,r=n[1].x*n[2].y,s=18*(-3*i+2*e+3*r-n[3].x*n[2].y),o=18*(3*i-e-3*r),a=18*(r-i);if(Kt.approximately(s,0)){if(!Kt.approximately(o,0)){var h=-a/o;if(0<=h&&h<=1)return[h]}return[]}var u=2*s;if(Kt.approximately(u,0))return[];var c=o*o-4*s*a;if(c<0)return[];var l=Math.sqrt(c);return[(l-o)/u,-(o+l)/u].filter((function(t){return 0<=t&&t<=1}))},bboxoverlap:function(t,n){for(var i,e,r,s,o=["x","y"],a=o.length,h=0;h<a;h++)if(e=t[i=o[h]].mid,r=n[i].mid,s=(t[i].size+n[i].size)/2,Ut(e-r)>=s)return!1;return!0},expandbox:function(t,n){n.x.min<t.x.min&&(t.x.min=n.x.min),n.y.min<t.y.min&&(t.y.min=n.y.min),n.z&&n.z.min<t.z.min&&(t.z.min=n.z.min),n.x.max>t.x.max&&(t.x.max=n.x.max),n.y.max>t.y.max&&(t.y.max=n.y.max),n.z&&n.z.max>t.z.max&&(t.z.max=n.z.max),t.x.mid=(t.x.min+t.x.max)/2,t.y.mid=(t.y.min+t.y.max)/2,t.z&&(t.z.mid=(t.z.min+t.z.max)/2),t.x.size=t.x.max-t.x.min,t.y.size=t.y.max-t.y.min,t.z&&(t.z.size=t.z.max-t.z.min)},pairiteration:function(t,n,i){var e=t.bbox(),r=n.bbox(),s=1e5,o=i||.5;if(e.x.size+e.y.size<o&&r.x.size+r.y.size<o)return[(s*(t._t1+t._t2)/2|0)/s+"/"+(s*(n._t1+n._t2)/2|0)/s];var a=t.split(.5),h=n.split(.5),u=[{left:a.left,right:h.left},{left:a.left,right:h.right},{left:a.right,right:h.right},{left:a.right,right:h.left}];u=u.filter((function(t){return Kt.bboxoverlap(t.left.bbox(),t.right.bbox())}));var c=[];return 0===u.length?c:(u.forEach((function(t){c=c.concat(Kt.pairiteration(t.left,t.right,o))})),c=c.filter((function(t,n){return c.indexOf(t)===n})))},getccenter:function(t,n,i){var e,r=n.x-t.x,s=n.y-t.y,o=i.x-n.x,a=i.y-n.y,h=r*Tt(Yt)-s*Nt(Yt),u=r*Nt(Yt)+s*Tt(Yt),c=o*Tt(Yt)-a*Nt(Yt),l=o*Nt(Yt)+a*Tt(Yt),f=(t.x+n.x)/2,x=(t.y+n.y)/2,y=(n.x+i.x)/2,p=(n.y+i.y)/2,d=f+h,v=x+u,g=y+c,m=p+l,z=Kt.lli8(f,x,d,v,y,p,g,m),_=Kt.dist(z,t),w=Rt(t.y-z.y,t.x-z.x),b=Rt(n.y-z.y,n.x-z.x),M=Rt(i.y-z.y,i.x-z.x);return w<M?((w>b||b>M)&&(w+=Gt),w>M&&(e=M,M=w,w=e)):M<b&&b<w?(e=M,M=w,w=e):M+=Gt,z.s=w,z.e=M,z.r=_,z},numberSort:function(t,n){return t-n}},tn=function(){function t(t){this.curves=[],this._3d=!1,t&&(this.curves=t,this._3d=this.curves[0]._3d)}var n=t.prototype;return n.valueOf=function(){return this.toString()},n.toString=function(){return"["+this.curves.map((function(t){return Kt.pointsToString(t.points)})).join(", ")+"]"},n.addCurve=function(t){this.curves.push(t),this._3d=this._3d||t._3d},n.length=function(){return this.curves.map((function(t){return t.length()})).reduce((function(t,n){return t+n}))},n.curve=function(t){return this.curves[t]},n.bbox=function(){for(var t=this.curves,n=t[0].bbox(),i=1;i<t.length;i++)Kt.expandbox(n,t[i].bbox());return n},n.offset=function(n){var i=[];return this.curves.forEach((function(t){i.push.apply(i,t.offset(n))})),new t(i)},t}(),nn=Math.abs,en=Math.min,rn=Math.max,sn=Math.cos,on=Math.sin,an=Math.acos,hn=Math.sqrt,un=Math.PI,cn=function(){function n(t){var n=t&&t.forEach?t:Array.from(arguments).slice(),i=!1;if("object"==typeof n[0]){i=n.length;var e=[];n.forEach((function(t){["x","y","z"].forEach((function(n){void 0!==t[n]&&e.push(t[n])}))})),n=e}var r=!1,s=n.length;if(i){if(i>4){if(1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");r=!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");for(var o=this._3d=!r&&(9===s||12===s)||t&&t[0]&&void 0!==t[0].z,a=this.points=[],h=0,u=o?3:2;h<s;h+=u){var c={x:n[h],y:n[h+1]};o&&(c.z=n[h+2]),a.push(c)}var l=this.order=a.length-1,f=this.dims=["x","y"];o&&f.push("z"),this.dimlen=f.length;var x=Kt.align(a,{p1:a[0],p2:a[l]}),y=Kt.dist(a[0],a[l]);this._linear=x.reduce((function(t,n){return t+nn(n.y)}),0)<y/50,this._lut=[],this._t1=0,this._t2=1,this.update()}n.quadraticFromPoints=function(t,i,e,r){if(void 0===r&&(r=.5),0===r)return new n(i,i,e);if(1===r)return new n(t,i,i);var s=n.getABC(2,t,i,e,r);return new n(t,s.A,e)},n.cubicFromPoints=function(t,i,e,r,s){void 0===r&&(r=.5);var o=n.getABC(3,t,i,e,r);void 0===s&&(s=Kt.dist(i,o.C));var a=s*(1-r)/r,h=Kt.dist(t,e),u=(e.x-t.x)/h,c=(e.y-t.y)/h,l=s*u,f=s*c,x=a*u,y=a*c,p=i.x-l,d=i.y-f,v=i.x+x,g=i.y+y,m=o.A,z=m.x+(p-m.x)/(1-r),_=m.y+(d-m.y)/(1-r),w=m.x+(v-m.x)/r,b=m.y+(g-m.y)/r;return new n(t,{x:t.x+(z-t.x)/r,y:t.y+(_-t.y)/r},{x:e.x+(w-e.x)/(1-r),y:e.y+(b-e.y)/(1-r)},e)},n.getUtils=function(){return Kt};var i=n.prototype;return i.getUtils=function(){return n.getUtils()},i.valueOf=function(){return this.toString()},i.toString=function(){return Kt.pointsToString(this.points)},i.toSVG=function(){if(this._3d)return!1;for(var t=this.points,n=["M",t[0].x,t[0].y,2===this.order?"Q":"C"],i=1,e=t.length;i<e;i++)n.push(t[i].x),n.push(t[i].y);return n.join(" ")},i.setRatios=function(t){if(t.length!==this.points.length)throw new Error("incorrect number of ratio values");this.ratios=t,this._lut=[]},i.verify=function(){var t=this.coordDigest();t!==this._print&&(this._print=t,this.update())},i.coordDigest=function(){return this.points.map((function(t,n){return""+n+t.x+t.y+(t.z?t.z:0)})).join("")},i.update=function(){this._lut=[],this.dpoints=Kt.derive(this.points,this._3d),this.computedirection()},i.computedirection=function(){var t=this.points,n=Kt.angle(t[0],t[this.order],t[1]);this.clockwise=n>0},i.length=function(){return Kt.length(this.derivative.bind(this))},n.getABC=function(t,n,i,e,r){void 0===t&&(t=2),void 0===r&&(r=.5);var s=Kt.projectionratio(r,t),o=1-s,a={x:s*n.x+o*e.x,y:s*n.y+o*e.y},h=Kt.abcratio(r,t);return{A:{x:i.x+(i.x-a.x)/h,y:i.y+(i.y-a.y)/h},B:i,C:a,S:n,E:e}},i.getABC=function(t,i){i=i||this.get(t);var e=this.points[0],r=this.points[this.order];return n.getABC(this.order,e,i,r,t)},i.getLUT=function(t){if(this.verify(),t=t||100,this._lut.length===t+1)return this._lut;this._lut=[],t++,this._lut=[];for(var n,i,e=0;e<t;e++)i=e/(t-1),(n=this.compute(i)).t=i,this._lut.push(n);return this._lut},i.on=function(n,i){i=i||5;for(var e,r=this.getLUT(),s=[],o=0;o<r.length;o++)e=r[o],Kt.dist(e,n)<i&&(s.push(e),o/r.length);return!!s.length&&(t/=s.length)},i.project=function(t){var n,i,e=this.getLUT(),r=e.length-1,s=Kt.closest(e,t),o=s.mpos,a=(o-1)/r,h=(o+1)/r,u=.1/r,c=s.mdist,l=a,f=l;for(c+=1;l<h+u;l+=u)n=this.compute(l),(i=Kt.dist(t,n))<c&&(c=i,f=l);return f=f<0?0:f>1?1:f,(n=this.compute(f)).t=f,n.d=c,n},i.get=function(t){return this.compute(t)},i.point=function(t){return this.points[t]},i.compute=function(t){return this.ratios?Kt.computeWithRatios(t,this.points,this.ratios,this._3d):Kt.compute(t,this.points,this._3d,this.ratios)},i.raise=function(){for(var t,i,e=this.points,r=[e[0]],s=e.length,o=1;o<s;o++)t=e[o],i=e[o-1],r[o]={x:(s-o)/s*t.x+o/s*i.x,y:(s-o)/s*t.y+o/s*i.y};return r[s]=e[s-1],new n(r)},i.derivative=function(t){return Kt.compute(t,this.dpoints[0],this._3d)},i.dderivative=function(t){return Kt.compute(t,this.dpoints[1],this._3d)},i.align=function(){var t=this.points;return new n(Kt.align(t,{p1:t[0],p2:t[t.length-1]}))},i.curvature=function(t){return Kt.curvature(t,this.dpoints[0],this.dpoints[1],this._3d)},i.inflections=function(){return Kt.inflections(this.points)},i.normal=function(t){return this._3d?this.__normal3(t):this.__normal2(t)},i.__normal2=function(t){var n=this.derivative(t),i=hn(n.x*n.x+n.y*n.y);return{t:t,x:-n.y/i,y:n.x/i}},i.__normal3=function(t){var n=this.derivative(t),i=this.derivative(t+.01),e=hn(n.x*n.x+n.y*n.y+n.z*n.z),r=hn(i.x*i.x+i.y*i.y+i.z*i.z);n.x/=e,n.y/=e,n.z/=e,i.x/=r,i.y/=r,i.z/=r;var s={x:i.y*n.z-i.z*n.y,y:i.z*n.x-i.x*n.z,z:i.x*n.y-i.y*n.x},o=hn(s.x*s.x+s.y*s.y+s.z*s.z);s.x/=o,s.y/=o,s.z/=o;var a=[s.x*s.x,s.x*s.y-s.z,s.x*s.z+s.y,s.x*s.y+s.z,s.y*s.y,s.y*s.z-s.x,s.x*s.z-s.y,s.y*s.z+s.x,s.z*s.z];return{t:t,x:a[0]*n.x+a[1]*n.y+a[2]*n.z,y:a[3]*n.x+a[4]*n.y+a[5]*n.z,z:a[6]*n.x+a[7]*n.y+a[8]*n.z}},i.hull=function(t){var n=this.points,i=[],e=[],r=0;for(e[r++]=n[0],e[r++]=n[1],e[r++]=n[2],3===this.order&&(e[r++]=n[3]);n.length>1;){i=[];for(var s,o=0,a=n.length-1;o<a;o++)s=Kt.lerp(t,n[o],n[o+1]),e[r++]=s,i.push(s);n=i}return e},i.split=function(t,i){if(0===t&&i)return this.split(i).left;if(1===i)return this.split(t).right;var e=this.hull(t),r={left:2===this.order?new n([e[0],e[3],e[5]]):new n([e[0],e[4],e[7],e[9]]),right:2===this.order?new n([e[5],e[4],e[2]]):new n([e[9],e[8],e[6],e[3]]),span:e};return r.left._t1=Kt.map(0,0,1,this._t1,this._t2),r.left._t2=Kt.map(t,0,1,this._t1,this._t2),r.right._t1=Kt.map(t,0,1,this._t1,this._t2),r.right._t2=Kt.map(1,0,1,this._t1,this._t2),i?(i=Kt.map(i,t,1,0,1),r.right.split(i).left):r},i.extrema=function(){var t={},n=[];return this.dims.forEach(function(i){var e=function(t){return t[i]},r=this.dpoints[0].map(e);t[i]=Kt.droots(r),3===this.order&&(r=this.dpoints[1].map(e),t[i]=t[i].concat(Kt.droots(r))),t[i]=t[i].filter((function(t){return t>=0&&t<=1})),n=n.concat(t[i].sort(Kt.numberSort))}.bind(this)),t.values=n.sort(Kt.numberSort).filter((function(t,i){return n.indexOf(t)===i})),t},i.bbox=function(){var t=this.extrema(),n={};return this.dims.forEach(function(i){n[i]=Kt.getminmax(this,i,t[i])}.bind(this)),n},i.overlaps=function(t){var n=this.bbox(),i=t.bbox();return Kt.bboxoverlap(n,i)},i.offset=function(t,i){if(void 0!==i){var e=this.get(t),r=this.normal(t),s={c:e,n:r,x:e.x+r.x*i,y:e.y+r.y*i};return this._3d&&(s.z=e.z+r.z*i),s}if(this._linear){var o=this.normal(0),a=this.points.map((function(n){var i={x:n.x+t*o.x,y:n.y+t*o.y};return n.z&&o.z&&(i.z=n.z+t*o.z),i}));return[new n(a)]}return this.reduce().map((function(n){return n._linear?n.offset(t)[0]:n.scale(t)}))},i.simple=function(){if(3===this.order){var t=Kt.angle(this.points[0],this.points[3],this.points[1]),n=Kt.angle(this.points[0],this.points[3],this.points[2]);if(t>0&&n<0||t<0&&n>0)return!1}var i=this.normal(0),e=this.normal(1),r=i.x*e.x+i.y*e.y;return this._3d&&(r+=i.z*e.z),nn(an(r))<un/3},i.reduce=function(){var t,n,i=0,e=0,r=.01,s=[],o=[],a=this.extrema().values;for(-1===a.indexOf(0)&&(a=[0].concat(a)),-1===a.indexOf(1)&&a.push(1),i=a[0],t=1;t<a.length;t++)e=a[t],(n=this.split(i,e))._t1=i,n._t2=e,s.push(n),i=e;return s.forEach((function(t){for(i=0,e=0;e<=1;)for(e=i+r;e<=1.01;e+=r)if(!(n=t.split(i,e)).simple()){if(nn(i-(e-=r))<r)return[];(n=t.split(i,e))._t1=Kt.map(i,0,1,t._t1,t._t2),n._t2=Kt.map(e,0,1,t._t1,t._t2),o.push(n),i=e;break}i<1&&((n=t.split(i,1))._t1=Kt.map(i,0,1,t._t1,t._t2),n._t2=t._t2,o.push(n))})),o},i.translate=function(t,i,e){e="number"==typeof e?e:i;var r=this.order,s=this.points.map((function(t,n){return(1-n/r)*i+n/r*e}));return new n(this.points.map((function(n,i){return{x:n.x+t.x*s[i],y:n.y+t.y*s[i]}})))},i.scale=function(t){var i=this,e=this.order,r=!1;if("function"==typeof t&&(r=t),r&&2===e)return this.raise().scale(r);var s=this.clockwise,o=this.points;if(this._linear)return this.translate(this.normal(0),r?r(0):t,r?r(1):t);var a=r?r(0):t,h=r?r(1):t,u=[this.offset(0,10),this.offset(1,10)],c=[],l=Kt.lli4(u[0],u[0].c,u[1],u[1].c);if(!l)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach((function(t){var n=c[t*e]=Kt.copy(o[t*e]);n.x+=(t?h:a)*u[t].n.x,n.y+=(t?h:a)*u[t].n.y})),r?([0,1].forEach((function(n){if(2!==e||!n){var i=o[n+1],a={x:i.x-l.x,y:i.y-l.y},h=r?r((n+1)/e):t;r&&!s&&(h=-h);var u=hn(a.x*a.x+a.y*a.y);a.x/=u,a.y/=u,c[n+1]={x:i.x+h*a.x,y:i.y+h*a.y}}})),new n(c)):([0,1].forEach((function(t){if(2!==e||!t){var n=c[t*e],r=i.derivative(t),s={x:n.x+r.x,y:n.y+r.y};c[t+1]=Kt.lli4(n,s,l,o[t+1])}})),new n(c))},i.outline=function(t,i,e,r){if(i=void 0===i?t:i,this._linear){var s,o,a=this.normal(0),h=this.points[0],u=this.points[this.points.length-1];void 0===e&&(e=t,r=i),s={x:h.x+a.x*t,y:h.y+a.y*t},o={x:u.x+a.x*e,y:u.y+a.y*e};var c=[s,{x:(s.x+o.x)/2,y:(s.y+o.y)/2},o];s={x:h.x-a.x*i,y:h.y-a.y*i};var l=[o={x:u.x-a.x*r,y:u.y-a.y*r},{x:(s.x+o.x)/2,y:(s.y+o.y)/2},s],f=Kt.makeline(l[2],c[0]),x=Kt.makeline(c[2],l[0]),y=[f,new n(c),x,new n(l)];return new tn(y)}var p,d=this.reduce(),v=d.length,g=[],m=[],z=0,_=this.length(),w=void 0!==e&&void 0!==r;function b(t,n,i,e,r){return function(s){var o=e/i,a=(e+r)/i,h=n-t;return Kt.map(s,0,1,t+o*h,t+a*h)}}d.forEach((function(n){var s=n.length();w?(g.push(n.scale(b(t,e,_,z,s))),m.push(n.scale(b(-i,-r,_,z,s)))):(g.push(n.scale(t)),m.push(n.scale(-i))),z+=s})),m=m.map((function(t){return(p=t.points)[3]?t.points=[p[3],p[2],p[1],p[0]]:t.points=[p[2],p[1],p[0]],t})).reverse();var M=g[0].points[0],A=g[v-1].points[g[v-1].points.length-1],S=m[v-1].points[m[v-1].points.length-1],P=m[0].points[0],k=Kt.makeline(S,M),O=Kt.makeline(A,P),C=[k].concat(g).concat([O]).concat(m);return new tn(C)},i.outlineshapes=function(t,n,i){n=n||t;for(var e=this.outline(t,n).curves,r=[],s=1,o=e.length;s<o/2;s++){var a=Kt.makeshape(e[s],e[o-s],i);a.startcap.virtual=s>1,a.endcap.virtual=s<o/2-1,r.push(a)}return r},i.intersects=function(t,i){return t?t.p1&&t.p2?this.lineIntersects(t):(t instanceof n&&(t=t.reduce()),this.curveintersects(this.reduce(),t,i)):this.selfintersects(i)},i.lineIntersects=function(t){var n=this,i=en(t.p1.x,t.p2.x),e=en(t.p1.y,t.p2.y),r=rn(t.p1.x,t.p2.x),s=rn(t.p1.y,t.p2.y);return Kt.roots(this.points,t).filter((function(t){var o=n.get(t);return Kt.between(o.x,i,r)&&Kt.between(o.y,e,s)}))},i.selfintersects=function(t){for(var n,i,e,r=this.reduce(),s=r.length-2,o=[],a=0;a<s;a++)i=r.slice(a,a+1),e=r.slice(a+2),n=this.curveintersects(i,e,t),o.push.apply(o,n);return o},i.curveintersects=function(t,n,i){var e=[];t.forEach((function(t){n.forEach((function(n){t.overlaps(n)&&e.push({left:t,right:n})}))}));var r=[];return e.forEach((function(t){var n=Kt.pairiteration(t.left,t.right,i);n.length>0&&(r=r.concat(n))})),r},i.arcs=function(t){return t=t||.5,this._iterate(t,[])},i._error=function(t,n,i,e){var r=(e-i)/4,s=this.get(i+r),o=this.get(e-r),a=Kt.dist(t,n),h=Kt.dist(t,s),u=Kt.dist(t,o);return nn(h-a)+nn(u-a)},i._iterate=function(t,n){var i,e=0,r=1;do{i=0,r=1;var s=this.get(e),o=void 0,a=void 0,h=void 0,u=void 0,c=!1,l=!1,f=void 0,x=r,y=1;do{if(l=c,u=h,x=(e+r)/2,o=this.get(x),a=this.get(r),(h=Kt.getccenter(s,o,a)).interval={start:e,end:r},c=this._error(h,s,e,r)<=t,(f=l&&!c)||(y=r),c){if(r>=1){if(h.interval.end=y=1,u=h,r>1){var p={x:h.x+h.r*sn(h.e),y:h.y+h.r*on(h.e)};h.e+=Kt.angle({x:h.x,y:h.y},p,this.get(1))}break}r+=(r-e)/2}else r=x}while(!f&&i++<100);if(i>=100)break;u=u||h,n.push(u),e=y}while(r<1);return n},e(n,null,[{key:"PolyBezier",get:function(){return tn}}]),n}(),ln=Lt(qt);function fn(t,n){if(t.x===n.x)return t.y===n.y?null:{x:t.x};var i=(n.y-t.y)/(n.x-t.x);return{a:i,b:t.y-i*t.x}}function xn(t,n,i){const e=n.x-t.x,r=n.y-t.y,s=Math.sqrt(e*e+r*r),o=i.x-t.x,a=i.y-t.y,h=Math.sqrt(o*o+a*a)/s,u=n.z-t.z;return t.z+u*h}function yn(t,n,i,e){var r=fn(t,n),s=fn(i,e);if(null===r||null===s)return null;if(r.hasOwnProperty("x")){if(s.hasOwnProperty("x"))return null;const i={x:r.x,y:s.a*r.x+s.b,z:0};return i.z=xn(t,n,i),i}if(s.hasOwnProperty("x")){const i={x:s.x,y:r.a*s.x+r.b,z:0};return i.z=xn(t,n,i),i}if(r.a===s.a)return null;var o=(s.b-r.b)/(r.a-s.a);const a={x:o,y:r.a*o+r.b,z:0};return a.z=xn(t,n,a),a}function pn(t,n,i){return{x:t.x+n*Math.cos(i),y:t.y+n*Math.sin(i),z:t.z||0}}function dn(t,n,i){return function(t,n,i){if(t.offsetAngle===n.offsetAngle)return[t.offset[1]];const e=gn(t.offset,n.offset);if(e*i>0&&e*gn(t.offset,[t.offset[0],n.offset[1]])>0)return[yn(t.offset[0],t.offset[1],n.offset[0],n.offset[1])];var r=[],s=t.original[1],o=i>0,a=o?n.offsetAngle:t.offsetAngle,h=o?t.offsetAngle:n.offsetAngle;h<a&&(h+=2*Math.PI);for(var u=Math.PI/8,c=a;c<h;c+=u)r.push(pn(s,i,c));return r.push(pn(s,i,h)),o?r.reverse():r}(t,n,i).filter((function(t){return t}))}function vn(t){return{x:t[1].x-t[0].x,y:t[1].y-t[0].y}}function gn(t,n){const i=vn(t),e=vn(n);return Math.atan2(i.x*e.y-i.y*e.x,i.x*e.x+i.y*e.y)}function mn(t,n){return function(t,n){var i=[],e=t[0],r=t[t.length-1];if(e&&r){i.push(e.offset[0]);for(let e=1,r=t.length;e<r;e++)Z(i,dn(t[e-1],t[e],n));i.push(r.offset[1])}return i}(function(t,n){var i=[];for(let r=1,s=t.length;r<s;r++){let s=t[r-1],o=t[r];const[a,h,u]=s,[c,l,f]=o;if(a!==c||h!==l){s={x:a,y:h,z:u||0},o={x:c,y:l,z:f||0};var e=Math.atan2(s.y-o.y,s.x-o.x)-Math.PI/2;i.push({offsetAngle:e,original:[s,o],offset:[pn(s,n,e),pn(o,n,e)]})}}return i}(t,n.offset),n.offset)}n.cylinder=function(t,n){const i=Object.assign({},{radius:1,height:2,radialSegments:6},n),e=Math.round(Math.max(4,i.radialSegments));let{radius:r,height:s}=i;const o=360/e/360*Math.PI*2,a=e+1,h=new Float32Array(3*a*2),[u,c]=t;let l=0,f=0;const x=3*a,y=2*a,p=[],d=[];let v=p.length-1;for(let t=-1;t<e;t++){const n=o*t,i=Math.cos(n)*r+u,e=Math.sin(n)*r+c;h[l]=i,h[l+1]=e,h[l+2]=0,h[l+x]=i,h[l+1+x]=e,h[l+2+x]=s;let a=0,g=0;a=.5+i/r/2,g=.5+e/r/2,d[f]=a,d[f+1]=g,d[f+y]=a,d[f+1+y]=g,l+=3,f+=2,t>1&&(p[++v]=0,p[++v]=t-1,p[++v]=t)}l-=3,h[l]=h[0],h[l+1]=h[1],h[l+2]=h[2];const g=h.length;h[g-3]=h[0],h[g-2]=h[1],h[g-1]=s;const m=p.length;v=p.length-1;for(let t=0;t<m;t++){const n=p[t];p[++v]=n+a}const z=new Float32Array(2*(3*a*2-6));let _=-1;l=2*a,f=0,v=p.length-1;let w=d.length-1;for(let t=0,n=h.length/2;t<n-3;t+=3){const n=h[t],i=h[t+1],e=h[t+3],o=h[t+4];z[++_]=n,z[++_]=i,z[++_]=s,z[++_]=e,z[++_]=o,z[++_]=s,z[++_]=n,z[++_]=i,z[++_]=0,z[++_]=e,z[++_]=o,z[++_]=0;const u=l+2,c=l+3,x=l,y=l+1;p[++v]=x,p[++v]=u,p[++v]=y,p[++v]=u,p[++v]=c,p[++v]=y,l+=4;const g=f/a,m=(f+1)/a;d[++w]=g,d[++w]=s/r/2,d[++w]=m,d[++w]=s/r/2,d[++w]=g,d[++w]=0,d[++w]=m,d[++w]=0,f++}const b=new Float32Array(h.length+z.length);b.set(h,0),b.set(z,h.length);const M=D(p,b);return{points:h,indices:new Uint32Array(p),position:b,normal:M,uv:new Float32Array(d)}},n.expandLine=st,n.expandPaths=function(t,n){const i=Object.assign({},{lineWidth:1,cornerRadius:0,cornerSplit:10},n),e=t.map((t=>{const n=H(t),e=new mt;e.set(n,i.cornerRadius,i.cornerSplit,zt);const r=function(t,n){const i=n.lineWidth||.1,e=1,r=i/2,s=i,o=t.distance(),a=e*o;let h=0;const u=[],c=[],l=[],f=[];let x=0;if(0===o)return{position:u,normal:c,uv:l,indices:f,count:h};const y=r/s;let p,d=u.length-1,v=c.length-1,g=l.length-1,m=f.length-1;function z(t){const n=0===u.length,i=t.sharp&&!n,e=t.dist/s,o=t.dir,a=t.up,p=t.right;if(_t.copy(p).multiplyScalar(r*t.widthScale),wt.copy(p).multiplyScalar(-r*t.widthScale),_t.add(t.pos),wt.add(t.pos),i){bt.fromArray(u,u.length-6).sub(wt),Mt.fromArray(u,u.length-3).sub(_t);const t=bt.length()-Mt.length();let n,i;t>0?(n=bt,i=wt):(n=Mt,i=_t),At.copy(n).setLength(Math.abs(t)).add(i);let r=St.copy(i).sub(At).normalize().dot(o)*St.copy(i).sub(At).length()*2;St.copy(o).setLength(r).add(At),t>0?(u[++d]=At.x,u[++d]=At.y,u[++d]=At.z,u[++d]=_t.x,u[++d]=_t.y,u[++d]=_t.z,u[++d]=wt.x,u[++d]=wt.y,u[++d]=wt.z,u[++d]=_t.x,u[++d]=_t.y,u[++d]=_t.z,u[++d]=St.x,u[++d]=St.y,u[++d]=St.z,u[++d]=_t.x,u[++d]=_t.y,u[++d]=_t.z,x+=6,f[++m]=x-6,f[++m]=x-8,f[++m]=x-7,f[++m]=x-6,f[++m]=x-7,f[++m]=x-5,f[++m]=x-4,f[++m]=x-6,f[++m]=x-5,f[++m]=x-2,f[++m]=x-4,f[++m]=x-1,h+=12):(u[++d]=wt.x,u[++d]=wt.y,u[++d]=wt.z,u[++d]=At.x,u[++d]=At.y,u[++d]=At.z,u[++d]=wt.x,u[++d]=wt.y,u[++d]=wt.z,u[++d]=_t.x,u[++d]=_t.y,u[++d]=_t.z,u[++d]=wt.x,u[++d]=wt.y,u[++d]=wt.z,u[++d]=St.x,u[++d]=St.y,u[++d]=St.z,x+=6,f[++m]=x-6,f[++m]=x-8,f[++m]=x-7,f[++m]=x-6,f[++m]=x-7,f[++m]=x-5,f[++m]=x-6,f[++m]=x-5,f[++m]=x-3,f[++m]=x-2,f[++m]=x-3,f[++m]=x-1,h+=12);for(let t=0;t<6;t++)c[++v]=a.x,c[++v]=a.y,c[++v]=a.z;l[++g]=e-y,l[++g]=0,l[++g]=e-y,l[++g]=1,l[++g]=e,l[++g]=0,l[++g]=e,l[++g]=1,l[++g]=e+y,l[++g]=0,l[++g]=e+y,l[++g]=1}else u[++d]=wt.x,u[++d]=wt.y,u[++d]=wt.z,u[++d]=_t.x,u[++d]=_t.y,u[++d]=_t.z,c[++v]=a.x,c[++v]=a.y,c[++v]=a.z,c[++v]=a.x,c[++v]=a.y,c[++v]=a.z,l[++g]=e,l[++g]=0,l[++g]=e,l[++g]=1,x+=2,n||(f[++m]=x-2,f[++m]=x-4,f[++m]=x-3,f[++m]=x-2,f[++m]=x-3,f[++m]=x-1,h+=6)}if(a>0)for(let n=0;n<t.count;n++){const i=t.array[n];if(i.dist>a){const e=t.array[n-1];p=new ct;const r=(a-e.dist)/(i.dist-e.dist);p.lerpPathPoints(e,i,r),z(p);break}z(i)}else p=t.array[0];return{position:u,normal:c,uv:l,indices:f,count:h}}(e,i);return{position:new Float32Array(r.position),indices:new Uint32Array(r.indices),uv:new Float32Array(r.uv),normal:new Float32Array(r.normal),line:t,count:r.count}})),r=X(e);return r.lines=t,r},n.expandTubes=function(t,n){const i=Object.assign({},{radius:1,cornerSplit:0,radialSegments:8,startRad:-Math.PI/4},n),e=t.map((t=>{const n=H(t),e=new mt;e.set(n,0,i.cornerSplit,Pt);const r=function(t,n){const i=Math.max(n.radius||1,1e-8),e=void 0!==n.progress?n.progress:1,r=Math.max(3,n.radialSegments||8),s=n.startRad||0,o=2*i*Math.PI,a=t.distance(),h=e*a;if(0===h)return null;let u=0;const c=[],l=[],f=[],x=[];let y=0,p=-1,d=-1,v=-1,g=-1;function m(t,n,i){const e=0===c.length,r=t.dist/o;for(let e=0;e<=i;e++){let o=e;o===i&&(o=0),kt.copy(t.up).applyAxisAngle(t.dir,s+2*Math.PI*o/i).normalize();const a=n*t.widthScale;c[++p]=t.pos.x+kt.x*a,c[++p]=t.pos.y+kt.y*a,c[++p]=t.pos.z+kt.z*a,l[++d]=kt.x,l[++d]=kt.y,l[++d]=kt.z,f[++v]=r,f[++v]=e/i,y++}if(!e){const t=y-2*(i+1),n=y-(i+1);for(let e=0;e<i;e++)x[++g]=n+e,x[++g]=t+e,x[++g]=t+e+1,x[++g]=n+e,x[++g]=t+e+1,x[++g]=n+e+1,u+=6}}if(h>0)for(let n=0;n<t.count;n++){const e=t.array[n];if(e.dist>h){const s=t.array[n-1],o=new ct,a=(h-s.dist)/(e.dist-s.dist);o.lerpPathPoints(s,e,a),m(o,i,r);break}m(e,i,r)}return{points:c,normal:l,uv:f,indices:x,count:u}}(e,i);return r.line=t,r.position=new Float32Array(r.points),r.indices=new Uint32Array(r.indices),r.uv=new Float32Array(r.uv),r.normal=new Float32Array(r.normal),r})),r=X(e);return r.lines=t,r},n.extrudePolygons=function(t,n){const i=Object.assign({},{depth:2,top:!0},n),e=t.map((t=>{B(t,!0);const n=function(t,n){const i=T(t),e=t.length,r=[],s=new Float32Array(2*i),o=[],a=[],h=3*i,u=2*i,c=n.depth;let l=0,f=0,x=0;for(let n=0;n<e;n++){const i=t[n];n>0&&r.push(l/2);let e=0;const y=i.length;for(;e<y;){const t=i[e],n=t[0],r=t[1],y=t[2]||0;s[l++]=n,s[l++]=r,o[f]=n,o[f+1]=r,o[f+2]=c+y,o[h+f]=n,o[h+f+1]=r,o[h+f+2]=y,a[x]=n,a[x+1]=r,a[u+x]=n,a[u+x+1]=r,f+=3,x+=2,e++}}return{flatVertices:s,holes:r,points:o,count:i,uv:a}}(t,i);n.polygon=t;return function(t,n,i){const e=[],{count:r}=t,s=i.top;for(let t=0,i=n.length;t<i;t+=3){const o=n[t],a=n[t+1],h=n[t+2];s&&(e[t]=o,e[t+1]=a,e[t+2]=h);let u=i+t;const c=r+o,l=r+a,f=r+h;s||(u=t),e[u]=c,e[u+1]=l,e[u+2]=f}t.indices=e}(n,a(n.flatVertices,n.holes,2),i),function(t,n){const{points:i,indices:e,polygon:r,uv:s}=t,o=n.depth;let a=i.length-1,h=e.length-1;for(let t=0,n=r.length;t<n;t++){const n=r[t];let u=0;const c=n.length;for(;u<c;){const t=n[u];let r=n[u+1];u===c-1&&(r=n[0]);const l=i.length/3,f=t[0],x=t[1],y=t[2]||0,p=r[0],d=r[1],v=r[2]||0;i[++a]=f,i[++a]=x,i[++a]=y+o,i[++a]=p,i[++a]=d,i[++a]=v+o,i[++a]=f,i[++a]=x,i[++a]=y,i[++a]=p,i[++a]=d,i[++a]=v;const g=l+2,m=l+3,z=l,_=l+1;e[++h]=g,e[++h]=z,e[++h]=m,e[++h]=z,e[++h]=_,e[++h]=m,J(s,i,g,m,z,_),u++}}}(n,i),n.position=new Float32Array(n.points),n.indices=new Uint32Array(n.indices),n.uv=new Float32Array(n.uv),n.normal=D(n.indices,n.position),n})),r=X(e);return r.polygons=t,r},n.extrudePolygonsOnPath=function(t,n){const i=Object.assign({},{openEnd:!1,openEndUV:!0,polygonRotation:0},n),{extrudePath:e,openEnd:r}=i;if(!e||!Array.isArray(e)||e.length<2)return console.error("extrudePath is error:",e),null;const s=N(t),[o,h,u,c]=s,l=[(o+u)/2,(h+c)/2];i.center=l,i.bbox=s;const f=H(e),x=new mt;x.set(f,0,i.cornerSplit,Ot);const y=t.map((t=>{B(t,!1);const n=function(t,n,i){const e=function(t,n){const{center:i,polygonRotation:e}=n,[r,s]=i,o=[];return t.forEach(((t,n)=>{const a=[];let h,u=0;for(let n=0,o=t.length;n<o;n++){const o=t[n],c=o[0],l=o[1],f=c-r,x=l-s;let y=0;if(n>0){const t=h[0]-c,n=h[1]-l;y=Math.sqrt(t*t+n*n)+u,u=y}a[n]={distance:y,radius:Math.sqrt(f*f+x*x),angle:-Et(i,o)+e},h=o}o[n]={ring:a,ringLen:u}})),o}(n,i),r=[],s=[],o=[],a=[];let h=0,u=-1,c=-1,l=-1,f=-1;const x=[],y=[];function p(t,n,i,e,p){const d=t.dist/i,v=n.length;for(let a=0;a<v;a++){const f=n[a];if(!f)continue;const g=a===v-1,m=f.angle,z=f.radius,_=f.distance;Ct.copy(t.up).applyAxisAngle(t.dir,m).normalize();const w=Ft.copy(t.up);w.applyAxisAngle(t.dir,m),w.x*=z,w.y*=z,w.z*=z;const b=t.pos.x+w.x,M=t.pos.y+w.y,A=t.pos.z+w.z;if(r[++u]=b,r[++u]=M,r[++u]=A,s[++c]=Ct.x,s[++c]=Ct.y,s[++c]=Ct.z,o[++l]=d,o[++l]=_/i,h++,e&&!g){let t=x.length-1;x[++t]=b,x[++t]=M,x[++t]=A}if(p&&!g){let t=y.length-1;y[++t]=b,y[++t]=M,y[++t]=A}}if(!e){const t=h-2*v,n=h-v;for(let i=0;i<v-1;i++)a[++f]=n+i,a[++f]=t+i,a[++f]=t+i+1,a[++f]=n+i,a[++f]=t+i+1,a[++f]=n+i+1}}const d=e[0].ringLen;return e.forEach((n=>{for(let i=0;i<t.count;i++){const e=t.array[i],{ring:r,ringLen:s}=n;p(e,r,s,0===i,i===t.count-1)}})),{points:r,normal:s,uv:o,indices:a,startPoints:x,endPoints:y,polygonLen:d}}(x,t,i);return r||function(t,n,i){const{openEndUV:e}=i;for(let t=0,i=n.length;t<i;t++){const i=n[t];U(i)&&i.splice(i.length-1,1)}const r=T(n),s=[],o=[];let h=-1;for(let t=0,i=n.length;t<i;t++){const i=n[t];t>0&&o.push(s.length/2);for(let t=0,n=i.length;t<n;t++){const n=i[t];s[++h]=n[0],s[++h]=n[1]}}const u=a(s,o,2),{points:c,normal:l,uv:f,indices:x,startPoints:y,endPoints:p,polygonLen:d}=t;h=0;let v=0;const g=[],m=[],z=[],_=[];for(let t=0;t<r;t++){const n=3*t,i=y[n],r=y[n+1],s=y[n+2];g[h]=i,g[h+1]=r,g[h+2]=s,e?(m[v]=r/d,m[v+1]=s/d):(m[v]=0,m[v+1]=0);const o=p[n],a=p[n+1],u=p[n+2];z[h]=o,z[h+1]=a,z[h+2]=u,e?(_[v]=a/d,_[v+1]=u/d):(_[v]=0,_[v+1]=0),h+=3,v+=2}const w=c.length/3,b=[];for(let t=0,n=u.length;t<n;t++)b[t]=u[t]+w,b[t+n]=u[t]+w+r;const M=D(u,g),A=D(u,z);Z(c,g),Z(c,z),Z(f,m),Z(f,_),Z(l,M),Z(l,A),Z(x,b)}(n,t,i),n.polygon=t,n.position=new Float32Array(n.points),n.indices=new Uint32Array(n.indices),n.uv=new Float32Array(n.uv),n.normal=new Float32Array(n.normal),n})),p=X(y);return p.polygons=t,p},n.extrudePolylines=function(t,n){const i=Object.assign({},{depth:2,lineWidth:1,bottomStickGround:!1,pathUV:!1},n);tt(i);const e=t.map((t=>{const n=st(t,i);return n.line=t,nt(n,i),it(n,i),n.position=new Float32Array(n.points),n.indices=new Uint32Array(n.indices),n.uv=new Float32Array(n.uv),n.normal=D(n.indices,n.position),n})),r=X(e);return r.lines=t,r},n.extrudeSlopes=function(t,n){const i=Object.assign({},{depth:2,lineWidth:1,side:"left",sideDepth:0,bottomStickGround:!1,pathUV:!1,isSlope:!0},n);tt(i);const{depth:e,side:r,sideDepth:s}=i,o=t.map((t=>{const n=st(t,i);n.line=t;const{leftPoints:o,rightPoints:a}=n,h={line:t};let u;for(let n=0,i=t.length;n<i;n++)t[n][2]=t[n][2]||0;return"left"===r?(h.leftPoints=o,h.rightPoints=t,u=[s,e]):(h.leftPoints=t,h.rightPoints=a,u=[e,s]),h.depths=u,nt(h,i),it(h,i),h.position=new Float32Array(h.points),h.indices=new Uint32Array(h.indices),h.uv=new Float32Array(h.uv),h.normal=D(h.indices,h.position),h})),a=X(o);return a.lines=t,a},n.isClockwise=L,n.leftOnLine=at,n.merge=X,n.plane=function(t,n,i,e){const r=t/(i=Math.max(1,i)),s=n/(e=Math.max(1,e)),o=-t/2,a=n/2,h=-n/2,u=(i+1)*(e+1),c=new Float32Array(3*u),l=new Float32Array(2*u),f=new Float32Array(3*u),x=new Uint32Array(10*u);let y=0,p=0,d=0;for(let u=0;u<=e;u++)for(let v=0;v<=i;v++){const g=o+r*v,m=a-s*u;c[y]=g,c[y+1]=m,c[y+2]=0,f[y]=0,f[y+1]=0,f[y+2]=1;const z=(g-o)/t,_=(m-h)/n;if(l[p]=z,l[p+1]=_,y+=3,p+=2,v<i&&u<e){const t=u*(i+1)+v,n=t+1,e=(i+1)*(u+1)+v,r=e+1;x[d]=t,x[d+1]=e,x[d+2]=n,x[d+3]=e,x[d+4]=r,x[d+5]=n,d+=6}}const v=new Uint32Array(d);for(let t=0,n=v.length;t<n;t++)v[t]=x[t];return{position:c,uv:l,normal:f,indices:v}},n.polygons=function(t,n={}){const i=Object.assign({},n),e=t.map((t=>{B(t,!0);const n=function(t,n={}){const i=[],e=[];let r=-1,s=-1,o=-1;const h=[],u=[];for(let n=0,a=t.length;n<a;n++){const a=t[n];n>0&&e.push(i.length/2);for(let t=0,n=a.length;t<n;t++){const n=a[t];i[++r]=n[0],i[++r]=n[1],h[++s]=n[0],h[++s]=n[1],h[++s]=n[2]||0,u[++o]=n[0],u[++o]=n[1]}}const c=a(i,e,2);return{normal:D(c,h),uv:u,points:h,indices:c}}(t,i);return n.polygon=t,n.position=new Float32Array(n.points),n.indices=new Uint32Array(n.indices),n.uv=new Float32Array(n.uv),n.normal=new Float32Array(n.normal),n})),r=X(e);return r.polygons=t,r},n.polylineOffset=function(t,n){if(0===(n=Object.assign({offset:0},n)).offset)return t;const i=mn(t,n),e=[];for(let t=0,n=i.length;t<n;t++){const n=i[t];if(!n)continue;const{x:r,y:s,z:o}=n;e.push([r,s,o])}return e},n.polylineRound=function(t,n){if(0===(n=Object.assign({roundSize:0,steps:10},n)).roundSize)return t;if(!t||t.length<3)return t;const i=t.length,{roundSize:e,steps:r}=n,s=[t[0]];let o=t[0];for(let n=1;n<i;n++){const i=t[n-1],a=t[n],h=t[n+1];if($(o,a))continue;if(!h)continue;const u=K(a,i),c=K(a,h);if(u<e||c<e){o=a,s.push(a);continue}const l=a[0]-i[0],f=a[1]-i[1],x=h[0]-a[0],y=h[1]-a[1],p=(u-e)/u,d=e/c,v={x:i[0]+p*l,y:i[1]+p*f},g={x:a[0]+d*x,y:a[1]+d*y},m=new ln.Bezier([v,{x:a[0],y:a[1]},g]).getLUT(r);for(let t=0,n=m.length;t<n;t++){const n=m[t];s.push([n.x,n.y])}o=a}return s.push(t[i-1]),s},Object.defineProperty(n,"__esModule",{value:!0})}));