map-core-func 0.2.10 → 0.2.11

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,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("maptalks"),e=require("three");function r(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}})),e.default=t,Object.freeze(e)}var n=r(t),i=r(e);function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function s(t,e,r,n,i,o,s){try{var a=t[o](s),u=a.value}catch(t){return void r(t)}a.done?e(u):Promise.resolve(u).then(n,i)}function a(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(t){s(o,n,i,a,u,"next",t)}function u(t){s(o,n,i,a,u,"throw",t)}a(void 0)}))}}function u(t,e,r){return e=y(e),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,m()?Reflect.construct(e,r||[],y(t).constructor):e.apply(t,r))}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e,r){if(m())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var i=new(t.bind.apply(t,n));return r&&b(i,r.prototype),i}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,B(n.key),n)}}function f(t,e,r){return e&&c(t.prototype,e),r&&c(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function p(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=k(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function d(t,e,r){return(e=B(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function g(){return g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=I(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},g.apply(null,arguments)}function y(t){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},y(t)}function v(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&b(t,e)}function m(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(m=function(){return!!t})()}function A(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?A(Object(r),!0).forEach((function(e){d(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function x(){x=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,s=Object.create(o.prototype),a=new k(n||[]);return i(s,"_invoke",{value:S(t,r,a)}),s}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var f="suspendedStart",p="suspendedYield",d="executing",g="completed",y={};function v(){}function m(){}function A(){}var _={};l(_,s,(function(){return this}));var w=Object.getPrototypeOf,b=w&&w(w(P([])));b&&b!==r&&n.call(b,s)&&(_=b);var E=A.prototype=v.prototype=Object.create(_);function I(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function C(t,e){function r(i,o,s,a){var u=c(t[i],t,o);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,s,a)}),(function(t){r("throw",t,s,a)})):e.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,a)}))}a(u.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return o=o?o.then(i,i):i()}})}function S(e,r,n){var i=f;return function(o,s){if(i===d)throw Error("Generator is already running");if(i===g){if("throw"===o)throw s;return{value:t,done:!0}}for(n.method=o,n.arg=s;;){var a=n.delegate;if(a){var u=M(a,n);if(u){if(u===y)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===f)throw i=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=d;var l=c(e,r,n);if("normal"===l.type){if(i=n.done?g:p,l.arg===y)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=g,n.method="throw",n.arg=l.arg)}}}function M(e,r){var n=r.method,i=e.iterator[n];if(i===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,M(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var o=c(i,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;var s=o.arg;return s?s.done?(r[e.resultName]=s.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function B(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(B,this),this.reset(!0)}function P(e){if(e||""===e){var r=e[s];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}throw new TypeError(typeof e+" is not iterable")}return m.prototype=A,i(E,"constructor",{value:A,configurable:!0}),i(A,"constructor",{value:m,configurable:!0}),m.displayName=l(A,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,A):(t.__proto__=A,l(t,u,"GeneratorFunction")),t.prototype=Object.create(E),t},e.awrap=function(t){return{__await:t}},I(C.prototype),l(C.prototype,a,(function(){return this})),e.AsyncIterator=C,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var s=new C(h(t,r,n,i),o);return e.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},I(E),l(E,u,"Generator"),l(E,s,(function(){return this})),l(E,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=P,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(T),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function i(n,i){return a.type="throw",a.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var u=n.call(s,"catchLoc"),l=n.call(s,"finallyLoc");if(u&&l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),T(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:P(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function w(t,e,r,n){return w="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,r,n){var i,o=I(t,e);if(o){if((i=Object.getOwnPropertyDescriptor(o,e)).set)return i.set.call(n,r),!0;if(!i.writable)return!1}if(i=Object.getOwnPropertyDescriptor(n,e)){if(!i.writable)return!1;i.value=r,Object.defineProperty(n,e,i)}else d(n,e,r);return!0},w(t,e,r,n)}function b(t,e){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},b(t,e)}function E(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o,s,a=[],u=!0,l=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(a.push(n.value),a.length!==e);u=!0);}catch(t){l=!0,i=t}finally{try{if(!u&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(l)throw i}}return a}}(t,e)||k(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=y(t)););return t}function C(t,e,r,n){var i=g(y(1&n?t.prototype:t),e,r);return 2&n&&"function"==typeof i?function(t){return i.apply(r,t)}:i}function S(t,e,r,n,i,o){return function(t,e,r,n,i){if(!w(t,e,r,n||t)&&i)throw new TypeError("failed to set property");return r}(y(o?t.prototype:t),e,r,n,i)}function M(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||k(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function T(t){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},T(t)}function k(t,e){if(t){if("string"==typeof t)return o(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}const P=parseInt(i.REVISION.replace("dev",""));function L(t,e,r){return P>109?t.setAttribute(e,r):t.addAttribute(e,r),t}function R(){return i}function D(){return(t=R()).VertexColors?t.VertexColors:2;var t}function O(t,e,r){const n=R();return P>=144?new n.BoxGeometry(t,e,r):n.BoxBufferGeometry?new n.BoxBufferGeometry(t,e,r):n.BoxGeometry?new n.BoxGeometry(t,e,r):void 0}console.log(`maptalks.three log: current three.js version is %c${P}`,"color:red;font-size: 16px;font-weight: bold;");class N extends i.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),L(this,"position",new i.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),L(this,"uv",new i.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix(t){var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==e&&(t.applyToBufferAttribute(e),t.applyToBufferAttribute(r),e.data.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(t){var e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));var r=new i.InstancedInterleavedBuffer(e,6,1);return L(this,"instanceStart",new i.InterleavedBufferAttribute(r,3,0)),L(this,"instanceEnd",new i.InterleavedBufferAttribute(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){var e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));var r=new i.InstancedInterleavedBuffer(e,6,1);return L(this,"instanceColorStart",new i.InterleavedBufferAttribute(r,3,0)),L(this,"instanceColorEnd",new i.InterleavedBufferAttribute(r,3,3)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new i.WireframeGeometry(t.geometry)),this}fromLineSegements(t){var e=t.geometry;return e.isGeometry?this.setPositions(e.vertices):e.isBufferGeometry&&this.setPositions(e.position.array),this}computeBoundingBox(){var t=new i.Box3;null===this.boundingBox&&(this.boundingBox=new i.Box3);var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;void 0!==e&&void 0!==r&&(this.boundingBox.setFromBufferAttribute(e),t.setFromBufferAttribute(r),this.boundingBox.union(t))}computeBoundingSphere(){var t=new i.Vector3;null===this.boundingSphere&&(this.boundingSphere=new i.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,r=this.attributes.instanceEnd;if(void 0!==e&&void 0!==r){var n=this.boundingSphere.center;this.boundingBox.getCenter(n);for(var o=0,s=0,a=e.count;s<a;s++)t.fromBufferAttribute(e,s),o=Math.max(o,n.distanceToSquared(t)),t.fromBufferAttribute(r,s),o=Math.max(o,n.distanceToSquared(t));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}copy(t){return this}}const F={},U={};F.line={linewidth:{value:1},resolution:{value:new i.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},U.line={uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.fog,F.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, opacity );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n\t\t\t#include <premultiplied_alpha_fragment>\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\n\t\t}\n\t\t"};class Q extends i.ShaderMaterial{constructor(t){super({uniforms:i.UniformsUtils.clone(U.line.uniforms),vertexShader:U.line.vertexShader,fragmentShader:U.line.fragmentShader}),this.dashed=!0,this.isLineMaterial=!0,this.type="LineMaterial",Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}}}),this.setValues(t)}}class G extends i.Mesh{constructor(t,e){super(t,e),this.isLineSegments2=!0,this.type="LineSegments2",this.geometry=void 0!==t?t:new N,this.material=void 0!==e?e:new Q({color:16777215*Math.random()})}computeLineDistances(){var t=new i.Vector3,e=new i.Vector3,r=this.geometry,n=r.attributes.instanceStart,o=r.attributes.instanceEnd;if(!n||!o)return this;for(var s=new Float32Array(2*n.data.count),a=0,u=0,l=n.data.count;a<l;a++,u+=2)t.fromBufferAttribute(n,a),e.fromBufferAttribute(o,a),s[u]=0===u?0:s[u-1],s[u+1]=s[u]+t.distanceTo(e);var h=new i.InstancedInterleavedBuffer(s,2,1);return L(r,"instanceDistanceStart",new i.InterleavedBufferAttribute(h,1,0)),L(r,"instanceDistanceEnd",new i.InterleavedBufferAttribute(h,1,1)),this}}class z extends N{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}fromLine(t){var e=t.geometry;return e.isGeometry?this.setPositions(e.vertices):e.isBufferGeometry&&this.setPositions(e.position.array),this}}class j extends G{constructor(t,e){super(t,e),this.isLine2=!0,this.type="Line2",this.geometry=void 0!==t?t:new z,this.material=void 0!==e?e:new Q({color:16777215*Math.random()})}copy(t){return this}}const V={interactive:!0,altitude:0,minZoom:0,maxZoom:30,asynchronous:!1,bloom:!1,pickWeight:-1};function q(){}class H extends(n.Eventable(q)){constructor(t){super(),this.isAdd=!1,this._mouseover=!1,this._visible=!0,this._zoomVisible=!0,this.picked=!1,this.isBaseObject=!0,void 0===t&&(t=n.Util.GUID()),this.id=t}addTo(t){return t&&"ThreeLayer"===t.type?t.addMesh([this]):console.error("layer only support maptalks.ThreeLayer"),this}remove(){const t=this.getLayer();return t&&t.removeMesh([this]),this}getObject3d(){return this.object3d}getId(){return this.id}setId(t){const e=this.getId();return this.id=t,this._fire("idchange",{old:e,new:t,target:this}),this}getType(){return this.type}getOptions(){return this.options}getProperties(){return(this.options||{}).properties}setProperties(t){const e=Object.assign({},this.getProperties());return this.options.properties=t,this._fire("propertieschange",{old:e,new:t,target:this}),this}getLayer(){return this.options.layer}getMap(){const t=this.getLayer();if(t)return t.getMap()}getCenter(){const t=this.getOptions(),{coordinate:e,lineString:r,polygon:i}=t;if(e)return e instanceof n.Coordinate?e:new n.Coordinate(e);{const t=i||r;if(t&&t.getCenter)return t.getCenter()}}getAltitude(){return this.getOptions().altitude}setAltitude(t){if(n.Util.isNumber(t)){const e=this.getLayer().altitudeToVector3(t,t).x;if(this.getObject3d().position.z=e,this.options.altitude=t,this.pickObject3d&&(this.pickObject3d.position.z=e),this._baseObjects&&Array.isArray(this._baseObjects))for(let t=0,r=this._baseObjects.length;t<r;t++)this._baseObjects[t]&&(this._baseObjects[t].getObject3d().position.z=e)}return this}supportHeight(){return this.getOptions().heightEnable}getHeight(){const{height:t}=this.getOptions();return n.Util.isNumber(t)?t:0}setHeight(t){if(!n.Util.isNumber(t)||this._baseObjects||!this.supportHeight())return this;const e=this.getLayer();if(!e)return this;const{geometry:r}=this.getObject3d();if(r instanceof i.BufferGeometry){const{position:n}=r.attributes||{};if(!n)return this;const i=n.array;let o=1/0,s=-1/0;for(let t=0,e=i.length;t<e;t+=3){const e=i[t+2];o=Math.min(e,o),s=Math.max(e,s)}const a=(o+s)/2;let u=e.altitudeToVector3(t,t).x;u=Math.max(u,1e-6);for(let t=0,e=i.length;t<e;t+=3)i[t+2]>a&&(i[t+2]=u);r.attributes.position.needsUpdate=!0,r.computeBoundingBox(),r.computeBoundingSphere(),this.getOptions().height=t}return this}show(){return this._zoomVisible&&(this.getObject3d().visible=!0,this._fire("show")),this._visible=!0,this}hide(){return this.getObject3d().visible=!1,this._fire("hide"),this._visible=!1,this._hideUI(),this}isVisible(){return!!this.getObject3d().visible}getSymbol(){return this.getObject3d().material}setSymbol(t){if(t&&t instanceof i.Material){t.needsUpdate=!0,t.vertexColors=this.getObject3d().material.vertexColors;const e=this.getObject3d().material.clone();this.getObject3d().material=t,this._fire("symbolchange",{old:e,new:t,target:this})}return this}setInfoWindow(t){return this.removeInfoWindow(),this.infoWindow=new n.ui.InfoWindow(t),this.infoWindow.addTo(this),this}getInfoWindow(){return this.infoWindow}openInfoWindow(t){return(t=t||this.getCenter())instanceof n.Coordinate||(t=new n.Coordinate(t)),t&&this.infoWindow&&this.infoWindow.show(t),this}closeInfoWindow(){return this.infoWindow&&this.infoWindow.hide(),this}removeInfoWindow(){return this.infoWindow&&(this.infoWindow.remove(),delete this.infoWindow),this}setToolTip(t,e){return this.removeToolTip(),this.toolTip=new n.ui.ToolTip(t,e),this.toolTip.addTo(this),this}getToolTip(){return this.toolTip}openToolTip(t){return this}closeToolTip(){return this.toolTip&&this.toolTip.hide(),this}removeToolTip(){return this.toolTip&&(this.toolTip.remove(),delete this.toolTip),this}_hideUI(){return this.closeInfoWindow(),this.closeToolTip(),this}animateShow(t={},e){this._showPlayer&&this._showPlayer.cancel(),n.Util.isFunction(t)&&(e=t={});const r=t.duration||1e3,i=t.easing||"out",o=this._showPlayer=n.animation.Animation.animate({scale:1},{duration:r,easing:i},(t=>{const r=t.styles.scale;r>0&&(this.getObject3d().scale.z=r),e&&e(t,r)}));return o.play(),o}getMinZoom(){return this.getOptions().minZoom}getMaxZoom(){return this.getOptions().maxZoom}isAsynchronous(){return this.getOptions().asynchronous}get bloom(){return this.getOptions().bloom}fire(t,e){return this._fire(t,e),this._vt&&this._vt.onSelectMesh&&this._vt.onSelectMesh(t,e),this}config(){return this}setPickObject3d(t){return this.pickObject3d=t,this.pickObject3d.__parent=this,this}getPickObject3d(){return this.pickObject3d}_initOptions(t){return this.options=n.Util.extend({},V,t),this}_createMesh(t,e){return this.object3d=new i.Mesh(t,e),this.object3d.__parent=this,this}_createInstancedMesh(t,e,r){return this.object3d=new i.InstancedMesh(t,e,r),this.object3d.__parent=this,this}_createGroup(){return this.object3d=new i.Group,this.object3d.__parent=this,this}_createLine(t,e){return this.object3d=new i.Line(t,e),this._computeLineDistances(t),this.object3d.__parent=this,this}_createLine2(t,e){return this.object3d=new j(t,e),this.object3d.computeLineDistances(),this.object3d.__parent=this,this}_createPoints(t,e){return this.object3d=new i.Points(t,e),this.object3d.__parent=this,this}_createLineSegments(t,e){return this.object3d=new i.LineSegments(t,e),this._computeLineDistances(t),this.object3d.__parent=this,this}_computeLineDistances(t){const e=t.attributes.position.array,r=t.attributes.position.count,n=new Float32Array(r);n[0]=0;const o=new i.Vector3(0,0,0),s=new i.Vector3(0,0,0);for(let t=1;t<r;t++){const r=3*(t-1);o.x=e[r],o.y=e[r+1],o.z=e[r+2];const i=3*t;s.x=e[i],s.y=e[i+1],s.z=e[i+2];const a=s.distanceTo(o);n[t]=n[t-1]+a}L(t,"lineDistance",new i.BufferAttribute(n,1))}}const W=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"];function Y(t){return t.geometry?t.geometry.type:null}function X(t){const e=Y(t);if(e)for(let t=0,r=W.length;t<r;t++)if(W[t]===e)return!0;return!1}function J(t){const e=Y(t);return!(!e||e!==W[4]&&e!==W[5])}function K(t){const e=Y(t);return!(!e||e!==W[2]&&e!==W[3])}function Z(t){const e=Y(t);return!(!e||e!==W[0]&&e!==W[1])}function $(t){const e=Y(t);return!!(e&&e.indexOf("Multi")>-1)}function tt(t){return t.geometry?t.geometry.coordinates:[]}function et(t,e){const r=Y(t);if(!r||!t.geometry)return null;const i=t.geometry.coordinates;if(!i)return null;let o=0,s=0,a=0;switch(r){case"Point":o=i[0],s=i[1],a++;break;case"MultiPoint":case"LineString":for(let t=0,e=i.length;t<e;t++)o+=i[t][0],s+=i[t][1],a++;break;case"MultiLineString":case"Polygon":for(let t=0,e=i.length;t<e;t++)for(let e=0,r=i[t].length;e<r;e++)o+=i[t][e][0],s+=i[t][e][1],a++;break;case"MultiPolygon":for(let t=0,e=i.length;t<e;t++)for(let e=0,r=i[t].length;e<r;e++)for(let r=0,n=i[t][e].length;r<n;r++)o+=i[t][e][r][0],s+=i[t][e][r][1],a++}const u=o/a,l=s/a;return e?(e.x=u,e.y=l,e):new n.Coordinate(u,l)}function rt(t){const e=Y(t);if(!e||!t.geometry)return null;const r=t.geometry,n=t.properties||{},i=r.coordinates;if(!i)return null;const o=[];let s;switch(e){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}if(s)for(let t=0,e=i.length;t<e;t++)o.push({type:"Feature",geometry:{type:s,coordinates:i[t]},properties:n});else o.push(t);return o}
2
2
  /*!
3
3
  * poly-extrude v0.16.0
4
- */function nt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function it(t,e){return it=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},it(t,e)}function ot(t,e,r){void 0===r&&(r=2);var n,i,o,s=e&&e.length,a=s?e[0]*r:t.length,u=st(t,0,a,r,!0),l=[];if(!u||u.next===u.prev)return l;if(s&&(u=function(t,e,r,n){for(var i=[],o=0,s=e.length;o<s;o++){var a=st(t,e[o]*n,o<s-1?e[o+1]*n:t.length,n,!1);a===a.next&&(a.steiner=!0),i.push(vt(a))}i.sort(pt);for(var u=0;u<i.length;u++)r=dt(i[u],r);return r}(t,e,u,r)),t.length>80*r){n=1/0,i=1/0;for(var h=-1/0,c=-1/0,f=r;f<a;f+=r){var p=t[f],d=t[f+1];p<n&&(n=p),d<i&&(i=d),p>h&&(h=p),d>c&&(c=d)}o=0!==(o=Math.max(h-n,c-i))?32767/o:0}return ut(u,l,r,n,i,o,0),l}function st(t,e,r,n,i){var o;if(i===function(t,e,r,n){for(var i=0,o=e,s=r-n;o<r;o+=n)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}(t,e,r,n)>0)for(var s=e;s<r;s+=n)o=Mt(s/n|0,t[s],t[s+1],o);else for(var a=r-n;a>=e;a-=n)o=Mt(a/n|0,t[a],t[a+1],o);return o&&wt(o,o.next)&&(Bt(o),o=o.next),o}function at(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!wt(n,n.next)&&0!==xt(n.prev,n,n.next))n=n.next;else{if(Bt(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function ut(t,e,r,n,i,o,s){if(t){!s&&o&&function(t,e,r,n){var i=t;do{0===i.z&&(i.z=yt(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r=1;do{var n=t,i=void 0;t=null;var o=null;for(e=0;n;){e++;for(var s=n,a=0,u=0;u<r&&(a++,s=s.nextZ);u++);for(var l=r;a>0||l>0&&s;)0!==a&&(0===l||!s||n.z<=s.z)?(i=n,n=n.nextZ,a--):(i=s,s=s.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=s}o.nextZ=null,r*=2}while(e>1)}(i)}(t,n,i,o);for(var a=t;t.prev!==t.next;){var u=t.prev,l=t.next;if(o?ht(t,n,i,o):lt(t))e.push(u.i,t.i,l.i),Bt(t),t=l.next,a=l.next;else if((t=l)===a){s?1===s?ut(t=ct(at(t),e),e,r,n,i,o,2):2===s&&ft(t,e,r,n,i,o):ut(at(t),e,r,n,i,o,1);break}}}}function lt(t){var e=t.prev,r=t,n=t.next;if(xt(e,r,n)>=0)return!1;for(var i=e.x,o=r.x,s=n.x,a=e.y,u=r.y,l=n.y,h=Math.min(i,o,s),c=Math.min(a,u,l),f=Math.max(i,o,s),p=Math.max(a,u,l),d=n.next;d!==e;){if(d.x>=h&&d.x<=f&&d.y>=c&&d.y<=p&&At(i,a,o,u,s,l,d.x,d.y)&&xt(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function ht(t,e,r,n){var i=t.prev,o=t,s=t.next;if(xt(i,o,s)>=0)return!1;for(var a=i.x,u=o.x,l=s.x,h=i.y,c=o.y,f=s.y,p=Math.min(a,u,l),d=Math.min(h,c,f),g=Math.max(a,u,l),y=Math.max(h,c,f),v=yt(p,d,e,r,n),m=yt(g,y,e,r,n),A=t.prevZ,_=t.nextZ;A&&A.z>=v&&_&&_.z<=m;){if(A.x>=p&&A.x<=g&&A.y>=d&&A.y<=y&&A!==i&&A!==s&&At(a,h,u,c,l,f,A.x,A.y)&&xt(A.prev,A,A.next)>=0)return!1;if(A=A.prevZ,_.x>=p&&_.x<=g&&_.y>=d&&_.y<=y&&_!==i&&_!==s&&At(a,h,u,c,l,f,_.x,_.y)&&xt(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;A&&A.z>=v;){if(A.x>=p&&A.x<=g&&A.y>=d&&A.y<=y&&A!==i&&A!==s&&At(a,h,u,c,l,f,A.x,A.y)&&xt(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;_&&_.z<=m;){if(_.x>=p&&_.x<=g&&_.y>=d&&_.y<=y&&_!==i&&_!==s&&At(a,h,u,c,l,f,_.x,_.y)&&xt(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function ct(t,e){var r=t;do{var n=r.prev,i=r.next.next;!wt(n,i)&&bt(n,r,r.next,i)&&Ct(n,i)&&Ct(i,n)&&(e.push(n.i,r.i,i.i),Bt(r),Bt(r.next),r=t=i),r=r.next}while(r!==t);return at(r)}function ft(t,e,r,n,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&_t(s,a)){var u=St(s,a);return s=at(s,s.next),u=at(u,u.next),ut(s,e,r,n,i,o,0),void ut(u,e,r,n,i,o,0)}a=a.next}s=s.next}while(s!==t)}function pt(t,e){var r=t.x-e.x;0===r&&(0===(r=t.y-e.y)&&(r=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)));return r}function dt(t,e){var r=function(t,e){var r,n=e,i=t.x,o=t.y,s=-1/0;if(wt(t,n))return n;do{if(wt(t,n.next))return n.next;if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>s&&(s=a,r=n.x<n.next.x?n:n.next,a===i))return r}n=n.next}while(n!==e);if(!r)return null;var u=r,l=r.x,h=r.y,c=1/0;n=r;do{if(i>=n.x&&n.x>=l&&i!==n.x&&mt(o<h?i:s,o,l,h,o<h?s:i,o,n.x,n.y)){var f=Math.abs(o-n.y)/(i-n.x);Ct(n,t)&&(f<c||f===c&&(n.x>r.x||n.x===r.x&&gt(r,n)))&&(r=n,c=f)}n=n.next}while(n!==u);return r}(t,e);if(!r)return e;var n=St(r,t);return at(n,n.next),at(r,r.next)}function gt(t,e){return xt(t.prev,t,e.prev)<0&&xt(e.next,t,t.next)<0}function yt(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function vt(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function mt(t,e,r,n,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(n-a)>=(r-s)*(e-a)&&(r-s)*(o-a)>=(i-s)*(n-a)}function At(t,e,r,n,i,o,s,a){return!(t===s&&e===a)&&mt(t,e,r,n,i,o,s,a)}function _t(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&bt(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Ct(t,e)&&Ct(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(xt(t.prev,t,e.prev)||xt(t,e.prev,e))||wt(t,e)&&xt(t.prev,t,t.next)>0&&xt(e.prev,e,e.next)>0)}function xt(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function wt(t,e){return t.x===e.x&&t.y===e.y}function bt(t,e,r,n){var i=It(xt(t,e,r)),o=It(xt(t,e,n)),s=It(xt(r,n,t)),a=It(xt(r,n,e));return i!==o&&s!==a||(!(0!==i||!Et(t,r,e))||(!(0!==o||!Et(t,n,e))||(!(0!==s||!Et(r,t,n))||!(0!==a||!Et(r,e,n)))))}function Et(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function It(t){return t>0?1:t<0?-1:0}function Ct(t,e){return xt(t.prev,t,t.next)<0?xt(t,e,t.next)>=0&&xt(t,t.prev,e)>=0:xt(t,e,t.prev)<0||xt(t,t.next,e)<0}function St(t,e){var r=Tt(t.i,t.x,t.y),n=Tt(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Mt(t,e,r,n){var i=Tt(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Bt(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 Tt(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}var kt=function(){function t(t,e,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=1),this.isQuaternion=!0,this._x=t,this._y=e,this._z=r,this._w=n}t.slerpFlat=function(t,e,r,n,i,o,s){var a=r[n+0],u=r[n+1],l=r[n+2],h=r[n+3],c=i[o+0],f=i[o+1],p=i[o+2],d=i[o+3];if(0===s)return t[e+0]=a,t[e+1]=u,t[e+2]=l,void(t[e+3]=h);if(1===s)return t[e+0]=c,t[e+1]=f,t[e+2]=p,void(t[e+3]=d);if(h!==d||a!==c||u!==f||l!==p){var g=1-s,y=a*c+u*f+l*p+h*d,v=y>=0?1:-1,m=1-y*y;if(m>Number.EPSILON){var A=Math.sqrt(m),_=Math.atan2(A,y*v);g=Math.sin(g*_)/A,s=Math.sin(s*_)/A}var x=s*v;if(a=a*g+c*x,u=u*g+f*x,l=l*g+p*x,h=h*g+d*x,g===1-s){var w=1/Math.sqrt(a*a+u*u+l*l+h*h);a*=w,u*=w,l*=w,h*=w}}t[e]=a,t[e+1]=u,t[e+2]=l,t[e+3]=h},t.multiplyQuaternionsFlat=function(t,e,r,n,i,o){var s=r[n],a=r[n+1],u=r[n+2],l=r[n+3],h=i[o],c=i[o+1],f=i[o+2],p=i[o+3];return t[e]=s*p+l*h+a*f-u*c,t[e+1]=a*p+l*c+u*h-s*f,t[e+2]=u*p+l*f+s*c-a*h,t[e+3]=l*p-s*h-a*c-u*f,t};var e,r,n,i=t.prototype;return i.set=function(t,e,r,n){return this._x=t,this._y=e,this._z=r,this._w=n,this._onChangeCallback(),this},i.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)},i.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},i.setFromEuler=function(t,e){void 0===e&&(e=!0);var r=t._x,n=t._y,i=t._z,o=t._order,s=Math.cos,a=Math.sin,u=s(r/2),l=s(n/2),h=s(i/2),c=a(r/2),f=a(n/2),p=a(i/2);switch(o){case"XYZ":this._x=c*l*h+u*f*p,this._y=u*f*h-c*l*p,this._z=u*l*p+c*f*h,this._w=u*l*h-c*f*p;break;case"YXZ":this._x=c*l*h+u*f*p,this._y=u*f*h-c*l*p,this._z=u*l*p-c*f*h,this._w=u*l*h+c*f*p;break;case"ZXY":this._x=c*l*h-u*f*p,this._y=u*f*h+c*l*p,this._z=u*l*p+c*f*h,this._w=u*l*h-c*f*p;break;case"ZYX":this._x=c*l*h-u*f*p,this._y=u*f*h+c*l*p,this._z=u*l*p-c*f*h,this._w=u*l*h+c*f*p;break;case"YZX":this._x=c*l*h+u*f*p,this._y=u*f*h+c*l*p,this._z=u*l*p-c*f*h,this._w=u*l*h-c*f*p;break;case"XZY":this._x=c*l*h-u*f*p,this._y=u*f*h-c*l*p,this._z=u*l*p+c*f*h,this._w=u*l*h+c*f*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!0===e&&this._onChangeCallback(),this},i.setFromAxisAngle=function(t,e){var r=e/2,n=Math.sin(r);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(r),this._onChangeCallback(),this},i.setFromRotationMatrix=function(t){var e=t.elements,r=e[0],n=e[4],i=e[8],o=e[1],s=e[5],a=e[9],u=e[2],l=e[6],h=e[10],c=r+s+h;if(c>0){var f=.5/Math.sqrt(c+1);this._w=.25/f,this._x=(l-a)*f,this._y=(i-u)*f,this._z=(o-n)*f}else if(r>s&&r>h){var p=2*Math.sqrt(1+r-s-h);this._w=(l-a)/p,this._x=.25*p,this._y=(n+o)/p,this._z=(i+u)/p}else if(s>h){var d=2*Math.sqrt(1+s-r-h);this._w=(i-u)/d,this._x=(n+o)/d,this._y=.25*d,this._z=(a+l)/d}else{var g=2*Math.sqrt(1+h-r-s);this._w=(o-n)/g,this._x=(i+u)/g,this._y=(a+l)/g,this._z=.25*g}return this._onChangeCallback(),this},i.setFromUnitVectors=function(t,e){var r=t.dot(e)+1;return r<Number.EPSILON?(r=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=r):(this._x=0,this._y=-t.z,this._z=t.y,this._w=r)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=r),this.normalize()},i.rotateTowards=function(t,e){var r=this.angleTo(t);if(0===r)return this;var n=Math.min(1,e/r);return this.slerp(t,n),this},i.identity=function(){return this.set(0,0,0,1)},i.invert=function(){return this.conjugate()},i.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},i.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},i.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},i.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},i.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},i.multiply=function(t){return this.multiplyQuaternions(this,t)},i.premultiply=function(t){return this.multiplyQuaternions(t,this)},i.multiplyQuaternions=function(t,e){var r=t._x,n=t._y,i=t._z,o=t._w,s=e._x,a=e._y,u=e._z,l=e._w;return this._x=r*l+o*s+n*u-i*a,this._y=n*l+o*a+i*s-r*u,this._z=i*l+o*u+r*a-n*s,this._w=o*l-r*s-n*a-i*u,this._onChangeCallback(),this},i.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var r=this._x,n=this._y,i=this._z,o=this._w,s=o*t._w+r*t._x+n*t._y+i*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=o,this._x=r,this._y=n,this._z=i,this;var a=1-s*s;if(a<=Number.EPSILON){var u=1-e;return this._w=u*o+e*this._w,this._x=u*r+e*this._x,this._y=u*n+e*this._y,this._z=u*i+e*this._z,this.normalize(),this}var l=Math.sqrt(a),h=Math.atan2(l,s),c=Math.sin((1-e)*h)/l,f=Math.sin(e*h)/l;return this._w=o*c+this._w*f,this._x=r*c+this._x*f,this._y=n*c+this._y*f,this._z=i*c+this._z*f,this._onChangeCallback(),this},i.slerpQuaternions=function(t,e,r){return this.copy(t).slerp(e,r)},i.random=function(){var t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),r=Math.random(),n=Math.sqrt(1-r),i=Math.sqrt(r);return this.set(n*Math.sin(t),n*Math.cos(t),i*Math.sin(e),i*Math.cos(e))},i.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},i.fromArray=function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},i.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},i.fromBufferAttribute=function(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this},i.toJSON=function(){return this.toArray()},i._onChange=function(t){return this._onChangeCallback=t,this},i._onChangeCallback=function(){},e=t,(r=[{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()}}])&&nt(e.prototype,r),n&&nt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Pt=new kt,Lt=function(){function t(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=r}var e=t.prototype;return e.set=function(t,e,r){return void 0===r&&(r=this.z),this.x=t,this.y=e,this.z=r,this},e.clone=function(){return new this.constructor(this.x,this.y,this.z)},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},e.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},e.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},e.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.applyAxisAngle=function(t,e){return this.applyQuaternion(Pt.setFromAxisAngle(t,e))},e.applyMatrix4=function(t){var e=this.x,r=this.y,n=this.z,i=t.elements,o=1/(i[3]*e+i[7]*r+i[11]*n+i[15]);return this.x=(i[0]*e+i[4]*r+i[8]*n+i[12])*o,this.y=(i[1]*e+i[5]*r+i[9]*n+i[13])*o,this.z=(i[2]*e+i[6]*r+i[10]*n+i[14])*o,this},e.applyQuaternion=function(t){var e=this.x,r=this.y,n=this.z,i=t.x,o=t.y,s=t.z,a=t.w,u=a*e+o*n-s*r,l=a*r+s*e-i*n,h=a*n+i*r-o*e,c=-i*e-o*r-s*n;return this.x=u*a+c*-i+l*-s-h*-o,this.y=l*a+c*-o+h*-i-u*-s,this.z=h*a+c*-s+u*-o-l*-i,this},e.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},e.divideScalar=function(t){return this.multiplyScalar(1/t)},e.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},e.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},e.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},e.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},e.clampLength=function(t,e){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(t,Math.min(e,r)))},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.normalize=function(){return this.divideScalar(this.length()||1)},e.setLength=function(t){return this.normalize().multiplyScalar(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var r=t.x,n=t.y,i=t.z,o=e.x,s=e.y,a=e.z;return this.x=n*a-i*s,this.y=i*o-r*a,this.z=r*s-n*o,this},e.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},t}();function Rt(t){let e,r,n=0,i=1;const o=t.length;for(;i<o;)e=r||t[0],r=t[i],n+=(r[0]-e[0])*(r[1]+e[1]),i++;return n>0}function Dt(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function Ot(t,e){const r=e[0],n=e[1],i=e[2],o=Math.sqrt(r*r+n*n+i*i)||1;return t[0]=r/o,t[1]=n/o,t[2]=i/o,t}function Nt(t,e,r){const n=e[0],i=e[1],o=e[2],s=r[0],a=r[1],u=r[2];return t[0]=i*u-o*a,t[1]=o*s-n*u,t[2]=n*a-i*s,t}function Ft(t,e){function r(t,e,r,n){t[0]=e,t[1]=r,t[2]=n}const n=[],i=[],o=[],s=[],a=[],u=[],l=t.length,h=new Float32Array(e.length);let c=0;for(;c<l;){const l=3*t[c],f=3*t[c+1],p=3*t[c+2];r(n,e[l],e[l+1],e[l+2]),r(i,e[f],e[f+1],e[f+2]),r(o,e[p],e[p+1],e[p+2]),Dt(a,o,i),Dt(s,n,i),Nt(u,a,s);for(let t=0;t<3;t++)h[l+t]+=u[t],h[f+t]+=u[t],h[p+t]+=u[t];c+=3}let f=0;const p=h.length;for(;f<p;)r(u,h[f],h[f+1],h[f+2]),Ot(u,u),h[f]=u[0]||0,h[f+1]=u[1]||0,h[f+2]=u[2]||0,f+=3;return h}function Ut(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 e=0,r=0;for(let n=0,i=t.length;n<i;n++){const{position:i,indices:o}=t[n];e+=i.length,r+=o.length}const n={position:new Float32Array(e),normal:new Float32Array(e),uv:new Float32Array(e/3*2),indices:new Uint32Array(r),results:t};let i=0,o=0,s=0,a=0;for(let e=0,r=t.length;e<r;e++){const{position:r,indices:u,normal:l,uv:h}=t[e];n.position.set(r,i),n.normal.set(l,i),n.uv.set(h,a);let c=0;const f=u.length;for(;c<f;){const t=u[c]+o;n.indices[s]=t,s++,c++}a+=h.length,i+=r.length,o+=r.length/3}return n}function Qt(t){return 180*t/Math.PI}function Gt(t){return t/180*Math.PI}function zt(t,e,r,n,i,o){const s=3*r,a=3*n,u=3*i,l=3*o,h=e[s],c=e[s+1],f=e[s+2],p=e[a],d=e[a+1],g=e[a+2],y=e[u],v=e[u+1],m=e[u+2],A=e[l],_=e[l+1],x=e[l+2];let w=t.length-1;Math.abs(c-d)<Math.abs(h-p)?(t[++w]=h,t[++w]=1-f,t[++w]=p,t[++w]=1-g,t[++w]=y,t[++w]=1-m,t[++w]=A,t[++w]=1-x):(t[++w]=c,t[++w]=1-f,t[++w]=d,t[++w]=1-g,t[++w]=v,t[++w]=1-m,t[++w]=_,t[++w]=1-x)}function jt(t,e){e=Object.assign({},{depth:2,top:!0},e);const r=t.map((t=>{for(let e=0,r=t.length;e<r;e++){const r=t[e];Vt(r),0===e?Rt(r)||(t[e]=r.reverse()):Rt(r)&&(t[e]=r.reverse()),qt(r)&&r.splice(r.length-1,1)}const r=function(t,e){const r=function(t){let e=0,r=0;const n=t.length;for(;r<n;)e+=t[r].length,r++;return e}(t),n=t.length,i=[],o=new Float32Array(2*r),s=[],a=[],u=3*r,l=2*r,h=e.depth;let c=0,f=0,p=0;for(let e=0;e<n;e++){const r=t[e];e>0&&i.push(c/2);let n=0;const d=r.length;for(;n<d;){const t=r[n],e=t[0],i=t[1],d=t[2]||0;o[c++]=e,o[c++]=i,s[f]=e,s[f+1]=i,s[f+2]=h+d,s[u+f]=e,s[u+f+1]=i,s[u+f+2]=d,a[p]=e,a[p+1]=i,a[l+p]=e,a[l+p+1]=i,f+=3,p+=2,n++}}return{flatVertices:o,holes:i,points:s,count:r,uv:a}}(t,e);r.polygon=t;return function(t,e,r){const n=[],{count:i}=t,o=r.top;for(let t=0,r=e.length;t<r;t+=3){const s=e[t],a=e[t+1],u=e[t+2];o&&(n[t]=s,n[t+1]=a,n[t+2]=u);let l=r+t;const h=i+s,c=i+a,f=i+u;o||(l=t),n[l]=h,n[l+1]=c,n[l+2]=f}t.indices=n}(r,ot(r.flatVertices,r.holes,2),e),function(t,e){const{points:r,indices:n,polygon:i,uv:o}=t,s=e.depth;let a=r.length-1,u=n.length-1;for(let t=0,e=i.length;t<e;t++){const e=i[t];let l=0;const h=e.length;for(;l<h;){const t=e[l];let i=e[l+1];l===h-1&&(i=e[0]);const c=r.length/3,f=t[0],p=t[1],d=t[2]||0,g=i[0],y=i[1],v=i[2]||0;r[++a]=f,r[++a]=p,r[++a]=d+s,r[++a]=g,r[++a]=y,r[++a]=v+s,r[++a]=f,r[++a]=p,r[++a]=d,r[++a]=g,r[++a]=y,r[++a]=v;const m=c+2,A=c+3,_=c,x=c+1;n[++u]=m,n[++u]=_,n[++u]=A,n[++u]=_,n[++u]=x,n[++u]=A,zt(o,r,m,A,_,x),l++}}}(r,e),r.position=new Float32Array(r.points),r.indices=new Uint32Array(r.indices),r.uv=new Float32Array(r.uv),r.normal=Ft(r.indices,r.position),r})),n=Ut(r);return n.polygons=t,n}function Vt(t){qt(t)||t.push(t[0])}function qt(t){const e=t.length,[r,n]=t[0],[i,o]=t[e-1];return r===i&&n===o}function Ht(t,e){!function(t){t.lineWidth=Math.max(0,t.lineWidth),t.depth=Math.max(0,t.depth),t.sideDepth=Math.max(0,t.sideDepth)}(e=Object.assign({},{depth:2,lineWidth:1,bottomStickGround:!1,pathUV:!1},e));const r=t.map((t=>{const r=function(t,e){let r=e.lineWidth/2;e.isSlope&&(r*=2);const n=[],i=[],o=[],s=t.length;let a=0;for(;a<s;){let e=t[a],u=t[a+1];const l=t[a];a===s-1&&(e=t[s-2],u=t[s-1]);const h=u[1]-e[1],c=u[0]-e[0];let f=0;const p=Qt(Math.atan(h/c));if(0===a||a===s-1)f=p,f-=90;else{const r=t[a-1];Wt.x=r[0]-e[0],Wt.y=r[1]-e[1],Yt.x=u[0]-e[0],Yt.y=u[1]-e[1];f=p-Xt(Wt,Yt)/2}const d=Gt(f),g=l,y=[Math.cos(d)+g[0],Math.sin(d)+g[1]],[v,m]=Kt(e,u,r);let A=Zt(v[0],v[1],g,y),_=Zt(m[0],m[1],g,y);if(!A||!_){const t=n.length,e=n[t-2],r=n[t-1];if(!e||!r)continue;A=[e[0],e[1]],_=[r[0],r[1]]}A[2]=l[2]||0,_[2]=l[2]||0,n.push(A,_),Jt(A,e,u)?(i.push(A),o.push(_)):(i.push(_),o.push(A)),a++}return{offsetPoints:n,leftPoints:i,rightPoints:o,line:t}}(t,e);return r.line=t,function(t,e){const r=e.bottomStickGround,n=e.depth,i=t.depths;let o=n,s=n;i&&(o=i[0],s=i[1]);const{leftPoints:a,rightPoints:u}=t,l=t.line,h=e.pathUV;if(h){!function(t){let e=0;for(let r=0,n=t.length;r<n;r++){const n=t[r],i=t[r+1];if(0===r&&(n.distance=0),n&&i){const[t,r,o]=n,[s,a,u]=i,l=t-s,h=r-a,c=(o||0)-(u||0);e+=Math.sqrt(l*l+h*h+c*c),i.distance=e}}}(l);for(let t=0,e=l.length;t<e;t++)a[t].distance=u[t].distance=l[t].distance}let c=0,f=a.length;const p=[],d=[],g=[];for(;c<f;){const t=3*c,[e,n,i]=a[c];p[t]=e,p[t+1]=n,p[t+2]=o+i;const[d,y,v]=u[c],m=3*f+t;p[m]=d,p[m+1]=y,p[m+2]=s+v;const A=2*f*3+t;p[A]=e,p[A+1]=n,p[A+2]=i,r&&(p[A+2]=0);const _=2*f*3+3*f+t;if(p[_]=d,p[_+1]=y,p[_+2]=v,r&&(p[_+2]=0),h){const t=l[c].distance,e=2*c;g[e]=t,g[e+1]=1;const r=2*f+e;g[r]=t,g[r+1]=0;const n=2*f*2+e;g[n]=t,g[n+1]=1;const i=2*f*2+2*f+e;g[i]=t,g[i+1]=0}c++}if(!h){c=0,f=p.length;let t=g.length-1;for(;c<f;){const e=p[c],r=p[c+1];g[++t]=e,g[++t]=r,c+=3}}c=0,f=a.length;let y=d.length-1;for(;c<f-1;){const t=c,e=c+1,r=t+f,n=e+f;d[++y]=t,d[++y]=r,d[++y]=e,d[++y]=r,d[++y]=n,d[++y]=e;const i=c+2*f,o=i+1,s=i+f,a=o+f;d[++y]=i,d[++y]=s,d[++y]=o,d[++y]=s,d[++y]=a,d[++y]=o,c++}if(t.indices=d,t.points=p,t.uv=g,i)for(f=a.length,c=0;c<f;)a[c].depth=o,u[c].depth=s,c++}(r,e),function(t,e){const{points:r,indices:n,leftPoints:i,rightPoints:o,uv:s}=t,a=e.depth,u=e.bottomStickGround,l=[i,o],h=t.depths,c=e.pathUV,f=e.lineWidth;let p=r.length-1,d=n.length-1,g=s.length-1;function y(t,e){const i=r.length/3,o=h?t.depth:a,l=h?e.depth:a;r[++p]=t[0],r[++p]=t[1],r[++p]=o+t[2],r[++p]=e[0],r[++p]=e[1],r[++p]=l+e[2],r[++p]=t[0],r[++p]=t[1],r[++p]=u?0:t[2],r[++p]=e[0],r[++p]=e[1],r[++p]=u?0:e[2];const y=i+2,v=i+3,m=i,A=i+1;n[++d]=y,n[++d]=m,n[++d]=v,n[++d]=m,n[++d]=A,n[++d]=v,c?(s[++g]=t.distance,s[++g]=o/f,s[++g]=e.distance,s[++g]=l/f,s[++g]=t.distance,s[++g]=0,s[++g]=e.distance,s[++g]=0):zt(s,r,y,v,m,A)}for(let t=0,e=l.length;t<e;t++){let e=l[t];t>0&&(e=e.map((t=>t)),e=e.reverse());let r=0;const n=e.length-1;for(;r<n;){y(e[r],e[r+1]),r++}}const v=i.length,m=[o[0],i[0],i[v-1],o[v-1]];for(let t=0;t<m.length;t+=2){y(m[t],m[t+1])}}(r,e),r.position=new Float32Array(r.points),r.indices=new Uint32Array(r.indices),r.uv=new Float32Array(r.uv),r.normal=Ft(r.indices,r.position),r})),n=Ut(r);return n.lines=t,n}const Wt={x:0,y:0},Yt={x:0,y:0};const Xt=({x:t,y:e},{x:r,y:n})=>{const i=t*r+e*n,o=t*n-e*r;return(Math.atan2(o,i)/Math.PI*180+360)%360};function Jt(t,e,r){const[n,i]=e,[o,s]=r,[a,u]=t;return(i-s)*a+(o-n)*u+n*s-o*i>0}function Kt(t,e,r){const n=e[1]-t[1],i=e[0]-t[0],o=Math.atan2(n,i),s=o+Math.PI/2;let a=Math.cos(s)*r,u=Math.sin(s)*r;const l=[t[0]+a,t[1]+u],h=[e[0]+a,e[1]+u],c=o-Math.PI/2;a=Math.cos(c)*r,u=Math.sin(c)*r;return[[l,h],[[t[0]+a,t[1]+u],[e[0]+a,e[1]+u]]]}function Zt(t,e,r,n){const i=e[0]-t[0],o=e[1]-t[1],s=n[0]-r[0],a=n[1]-r[1];if(0===i&&0===s)return null;if(0===o&&0===a)return null;const u=o/i,l=a/s,h=t[1]-u*t[0],c=r[1]-l*r[0];let f,p;return 0===i?(f=t[0],p=l*f+c):0===s?(f=r[0],p=u*f+h):0===o?(p=t[1],f=(p-c)/l):0===a?(p=r[1],f=(p-h)/u):(f=(c-h)/(u-l),p=u*f+h),[f,p]}var $t=function(){function t(){this.pos=new Lt,this.dir=new Lt,this.right=new Lt,this.up=new Lt,this.dist=0,this.widthScale=1,this.sharp=!1}var e=t.prototype;return e.lerpPathPoints=function(t,e,r){this.pos.lerpVectors(t.pos,e.pos,r),this.dir.lerpVectors(t.dir,e.dir,r),this.up.lerpVectors(t.up,e.up,r),this.right.lerpVectors(t.right,e.right,r),this.dist=(e.dist-t.dist)*r+t.dist,this.widthScale=(e.widthScale-t.widthScale)*r+t.widthScale},e.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}(),te=function(){function t(t,e,r,n,i,o,s,a,u,l,h,c,f,p,d,g){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,r,n,i,o,s,a,u,l,h,c,f,p,d,g)}var e=t.prototype;return e.set=function(t,e,r,n,i,o,s,a,u,l,h,c,f,p,d,g){var y=this.elements;return y[0]=t,y[4]=e,y[8]=r,y[12]=n,y[1]=i,y[5]=o,y[9]=s,y[13]=a,y[2]=u,y[6]=l,y[10]=h,y[14]=c,y[3]=f,y[7]=p,y[11]=d,y[15]=g,this},e.multiply=function(t){return this.multiplyMatrices(this,t)},e.makeRotationAxis=function(t,e){var r=Math.cos(e),n=Math.sin(e),i=1-r,o=t.x,s=t.y,a=t.z,u=i*o,l=i*s;return this.set(u*o+r,u*s-n*a,u*a+n*s,0,u*s+n*a,l*s+r,l*a-n*o,0,u*a-n*s,l*a+n*o,i*a*a+r,0,0,0,0,1),this},e.equals=function(t){for(var e=this.elements,r=t.elements,n=0;n<16;n++)if(e[n]!==r[n])return!1;return!0},t}(),ee=function(){function t(){this.type="Curve",this.arcLengthDivisions=200}var e=t.prototype;return e.getPoint=function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},e.getPointAt=function(t,e){var r=this.getUtoTmapping(t);return this.getPoint(r,e)},e.getPoints=function(t){void 0===t&&(t=5);for(var e=[],r=0;r<=t;r++)e.push(this.getPoint(r/t));return e},e.getLength=function(){var t=this.getLengths();return t[t.length-1]},e.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 e,r=[],n=this.getPoint(0),i=0;r.push(0);for(var o=1;o<=t;o++)i+=(e=this.getPoint(o/t)).distanceTo(n),r.push(i),n=e;return this.cacheArcLengths=r,r},e.getUtoTmapping=function(t,e){var r,n=this.getLengths(),i=0,o=n.length;r=e||t*n[o-1];for(var s,a=0,u=o-1;a<=u;)if((s=n[i=Math.floor(a+(u-a)/2)]-r)<0)a=i+1;else{if(!(s>0)){u=i;break}u=i-1}if(n[i=u]===r)return i/(o-1);var l=n[i];return(i+(r-l)/(n[i+1]-l))/(o-1)},t}();function re(t,e,r,n){return function(t,e){var r=1-t;return r*r*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,r)+function(t,e){return t*t*e}(t,n)}var ne=function(t){var e,r;function n(e,r,n){var i;return void 0===e&&(e=new Lt),void 0===r&&(r=new Lt),void 0===n&&(n=new Lt),(i=t.call(this)||this).isQuadraticBezierCurve3=!0,i.type="QuadraticBezierCurve3",i.v0=e,i.v1=r,i.v2=n,i}return r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,it(e,r),n.prototype.getPoint=function(t,e){void 0===e&&(e=new Lt);var r=e,n=this.v0,i=this.v1,o=this.v2;return r.set(re(t,n.x,i.x,o.x),re(t,n.y,i.y,o.y),re(t,n.z,i.z,o.z)),r},n}(ee),ie=new Lt,oe=new Lt,se=new Lt,ae=new te,ue=new ne;var le=function(){function t(){this.array=[],this.count=0}var e=t.prototype;return e.set=function(t,e,r,n,i){if(void 0===e&&(e=.1),void 0===r&&(r=10),void 0===n&&(n=null),void 0===i&&(i=!1),(t=t.slice(0)).length<2)return console.warn("PathPointList: points length less than 2."),void(this.count=0);i&&!t[0].equals(t[t.length-1])&&t.push((new Lt).copy(t[0]));for(var o=0,s=t.length;o<s;o++)if(0===o)this._start(t[o],t[o+1],n);else if(o===s-1)if(i){this._corner(t[o],t[1],e,r,n);var a=this.array[0].dist;this.array[0].copy(this.array[this.count-1]),this.array[0].dist=a}else this._end(t[o]);else this._corner(t[o],t[o+1],e,r,n)},e.distance=function(){return this.count>0?this.array[this.count-1].dist:0},e._getByIndex=function(t){return this.array[t]||(this.array[t]=new $t),this.array[t]},e._start=function(t,e,r){this.count=0;var n=this._getByIndex(this.count);if(n.pos.copy(t),n.dir.subVectors(e,t),r)n.up.copy(r);else{var i=Number.MAX_VALUE,o=Math.abs(n.dir.x),s=Math.abs(n.dir.y),a=Math.abs(n.dir.z);o<i&&(i=o,n.up.set(1,0,0)),s<i&&(i=s,n.up.set(0,1,0)),a<i&&n.up.set(0,0,1)}n.right.crossVectors(n.dir,n.up).normalize(),n.up.crossVectors(n.right,n.dir).normalize(),n.dist=0,n.widthScale=1,n.sharp=!1,n.dir.normalize(),this.count++},e._end=function(t){var e=this.array[this.count-1],r=this._getByIndex(this.count);r.pos.copy(t),r.dir.subVectors(t,e.pos);var n=r.dir.length();r.dir.normalize(),r.up.copy(e.up);var i=ie.crossVectors(e.dir,r.dir);if(i.length()>Number.EPSILON){i.normalize();var o=Math.acos(Math.min(Math.max(e.dir.dot(r.dir),-1),1));r.up.applyMatrix4(ae.makeRotationAxis(i,o))}r.right.crossVectors(r.dir,r.up).normalize(),r.dist=e.dist+n,r.widthScale=1,r.sharp=!1,this.count++},e._corner=function(t,e,r,n,i){if(r>0&&n>0){for(var o=function(t,e,r,n,i,o){var s=ie.subVectors(e,t),a=oe.subVectors(r,e),u=s.length(),l=a.length();s.normalize(),a.normalize();var h=Math.min(.999999*(i?u/2:u),n);o.v0.copy(e).sub(s.multiplyScalar(h)),o.v1.copy(e);var c=Math.min(l/2*.999999,n);return o.v2.copy(e).add(a.multiplyScalar(c)),o}(this.array[this.count-1].pos,t,e,r,this.count-1==0,ue),s=o.getPoints(n),a=0;a<n;a++)this._sharpCorner(s[a],s[a+1],i,0===a?1:0);s[n].equals(e)||this._sharpCorner(s[n],e,i,2)}else this._sharpCorner(t,e,i,0,!0)},e._sharpCorner=function(t,e,r,n,i){void 0===n&&(n=0),void 0===i&&(i=!1);var o=this.array[this.count-1],s=this._getByIndex(this.count),a=ie.subVectors(t,o.pos),u=oe.subVectors(e,t),l=a.length();if(a.normalize(),u.normalize(),s.pos.copy(t),1===n?s.dir.copy(a):2===n?s.dir.copy(u):(s.dir.addVectors(a,u),s.dir.normalize()),r)1===s.dir.dot(r)?s.right.crossVectors(u,r).normalize():s.right.crossVectors(s.dir,r).normalize(),s.up.crossVectors(s.right,s.dir).normalize();else{s.up.copy(o.up);var h=se.crossVectors(o.dir,s.dir);if(h.length()>Number.EPSILON){h.normalize();var c=Math.acos(Math.min(Math.max(o.dir.dot(s.dir),-1),1));s.up.applyMatrix4(ae.makeRotationAxis(h,c))}s.right.crossVectors(s.dir,s.up).normalize()}s.dist=o.dist+l;var f=a.dot(u);s.widthScale=Math.min(1/Math.sqrt((1+f)/2),1.415)||1,s.sharp=Math.abs(f-1)>.05&&i,this.count++},t}();const he=new Lt(0,0,1),ce=new Lt,fe=new Lt,pe=new Lt,de=new Lt,ge=new Lt,ye=new Lt;function ve(t,e){e=Object.assign({},{lineWidth:1,cornerRadius:0,cornerSplit:10},e);const r=t.map((t=>{const r=function(t){const e=[];for(let r=0,n=t.length;r<n;r++){const n=t[r],[i,o,s]=n,a=new Lt(i,o,s||0);e[r]=a}return e}(t),n=new le;n.set(r,e.cornerRadius,e.cornerSplit,he);const i=function(t,e){const r=e.lineWidth||.1,n=1,i=r/2,o=r,s=t.distance(),a=n*s;let u=0;const l=[],h=[],c=[],f=[];let p=0;if(0===s)return{position:l,normal:h,uv:c,indices:f,count:u};const d=i/o;let g,y=l.length-1,v=h.length-1,m=c.length-1,A=f.length-1;function _(t){const e=0===l.length,r=t.sharp&&!e,n=t.dist/o,s=t.dir,a=t.up,g=t.right;if(ce.copy(g).multiplyScalar(i*t.widthScale),fe.copy(g).multiplyScalar(-i*t.widthScale),ce.add(t.pos),fe.add(t.pos),r){pe.fromArray(l,l.length-6).sub(fe),de.fromArray(l,l.length-3).sub(ce);const t=pe.length()-de.length();let e,r;t>0?(e=pe,r=fe):(e=de,r=ce),ge.copy(e).setLength(Math.abs(t)).add(r);let i=ye.copy(r).sub(ge).normalize().dot(s)*ye.copy(r).sub(ge).length()*2;ye.copy(s).setLength(i).add(ge),t>0?(l[++y]=ge.x,l[++y]=ge.y,l[++y]=ge.z,l[++y]=ce.x,l[++y]=ce.y,l[++y]=ce.z,l[++y]=fe.x,l[++y]=fe.y,l[++y]=fe.z,l[++y]=ce.x,l[++y]=ce.y,l[++y]=ce.z,l[++y]=ye.x,l[++y]=ye.y,l[++y]=ye.z,l[++y]=ce.x,l[++y]=ce.y,l[++y]=ce.z,p+=6,f[++A]=p-6,f[++A]=p-8,f[++A]=p-7,f[++A]=p-6,f[++A]=p-7,f[++A]=p-5,f[++A]=p-4,f[++A]=p-6,f[++A]=p-5,f[++A]=p-2,f[++A]=p-4,f[++A]=p-1,u+=12):(l[++y]=fe.x,l[++y]=fe.y,l[++y]=fe.z,l[++y]=ge.x,l[++y]=ge.y,l[++y]=ge.z,l[++y]=fe.x,l[++y]=fe.y,l[++y]=fe.z,l[++y]=ce.x,l[++y]=ce.y,l[++y]=ce.z,l[++y]=fe.x,l[++y]=fe.y,l[++y]=fe.z,l[++y]=ye.x,l[++y]=ye.y,l[++y]=ye.z,p+=6,f[++A]=p-6,f[++A]=p-8,f[++A]=p-7,f[++A]=p-6,f[++A]=p-7,f[++A]=p-5,f[++A]=p-6,f[++A]=p-5,f[++A]=p-3,f[++A]=p-2,f[++A]=p-3,f[++A]=p-1,u+=12);for(let t=0;t<6;t++)h[++v]=a.x,h[++v]=a.y,h[++v]=a.z;c[++m]=n-d,c[++m]=0,c[++m]=n-d,c[++m]=1,c[++m]=n,c[++m]=0,c[++m]=n,c[++m]=1,c[++m]=n+d,c[++m]=0,c[++m]=n+d,c[++m]=1}else l[++y]=fe.x,l[++y]=fe.y,l[++y]=fe.z,l[++y]=ce.x,l[++y]=ce.y,l[++y]=ce.z,h[++v]=a.x,h[++v]=a.y,h[++v]=a.z,h[++v]=a.x,h[++v]=a.y,h[++v]=a.z,c[++m]=n,c[++m]=0,c[++m]=n,c[++m]=1,p+=2,e||(f[++A]=p-2,f[++A]=p-4,f[++A]=p-3,f[++A]=p-2,f[++A]=p-3,f[++A]=p-1,u+=6)}if(a>0)for(let e=0;e<t.count;e++){const r=t.array[e];if(r.dist>a){const n=t.array[e-1];g=new $t;const i=(a-n.dist)/(r.dist-n.dist);g.lerpPathPoints(n,r,i),_(g);break}_(r)}else g=t.array[0];return{position:l,normal:h,uv:c,indices:f,count:u}}(n,e);return{position:new Float32Array(i.position),indices:new Uint32Array(i.indices),uv:new Float32Array(i.uv),normal:new Float32Array(i.normal),line:t,count:i.count}})),n=Ut(r);return n.lines=t,n}function me(t,e,r={}){return void 0===r[t]&&(r[t]=e.distanceToVector3(t,t).x),r[t]}function Ae(t,e,r={}){return void 0===r[t]&&(r[t]=e.altitudeToVector3(t,t).x),r[t]}function _e(t=[]){let e=0,r=0;const i=t.length;for(let o=0;o<i;o++){const{coordinate:i,lnglat:s,lnglats:a,xy:u,xys:l}=t[o],h=i||s||a||u||l||t[o];let c,f;Array.isArray(h)?(c=h[0],f=h[1]):h instanceof n.Coordinate&&(c=h.x,f=h.y),e+=c,r+=f}return new n.Coordinate(e/i,r/i)}function xe(t,e,r,n){if(void 0===e||"number"!=typeof e||0===e)return 0;let o;o=t instanceof i.BufferGeometry?t.attributes.position.array:Array.isArray(t)||t instanceof Float32Array?t:t.position;let s=0;if(o){n?(void 0===n[e]&&(n[e]=r.altitudeToVector3(e,e).x),s=n[e]):s=r.altitudeToVector3(e,e).x;const t=o.length;if(o[0]instanceof i.Vector3)for(let e=0;e<t;e++)o[e].z+=s;else for(let e=0;e<t;e+=3)o[e+2]+=s}return s}function we(t){const e=t.length;let r=0;for(let n=0;n<e;n++){const{count:e}=t[n].position;r+=e}return new Float32Array(3*r)}new Lt(0,0,1),new Lt;const be=new i.Vector3,Ee=new Map;function Ie(t=[],e){const r=t.length,n=!!e,i=n?3:2,o=new Float64Array(r*i);Ee.clear();for(let s=0;s<r;s++){let r,a;const u=t[s];let l;if(u.x?(r=u.x,a=u.y,l=u.z):(r=u[0],a=u[1],l=u[2]),o[s*i]=r,o[s*i+1]=a,l=l||0,n&&0!==l){if(!Ee.has(l)){const t=e.altitudeToVector3(l,l,null,be).x;Ee.set(l,t)}o[s*i+2]=Ee.get(l)}}return o.buffer}function Ce(t){return(J(t)?t.properties:t.getProperties())||{}}function Se(t){return(K(t)?t.properties:t.getProperties())||{}}const Me=new i.Color("#fff"),Be=new i.Color("#fff");function Te(t,e,r,n,i,o){const s=Pe(t,r,n,i,!1);if(!s)return null;o?(null==o[e]&&(o[e]=r.altitudeToVector3(e,e).x),e=o[e]):e=r.altitudeToVector3(e,e).x;const{position:a,normal:u,uv:l,indices:h}=jt(s,{depth:e});return{position:a,normal:u,uv:l,indices:h}}function ke(t,e,r,n){void 0===n&&(n=0);const o=t.attributes.position.array,s=o.length;let a;if(Be.setStyle(e),Me.setStyle(r),Array.isArray(n)){let t=0;for(let e=0,r=n.length;e<r;e++){const{count:r}=n[e].position;t+=3*r}a=new Float32Array(t)}else a=new Float32Array(o.length);if(Array.isArray(n))for(let t=0,e=n.length;t<e;t++){const{middleZ:e,start:r,end:i}=n[t].position;for(let t=r;t<i;t+=3){o[t+2]>e?(a[t]=Me.r,a[t+1]=Me.g,a[t+2]=Me.b):(a[t]=Be.r,a[t+1]=Be.g,a[t+2]=Be.b)}}else for(let t=0;t<s;t+=3){o[t+2]>n?(a[t]=Me.r,a[t+1]=Me.g,a[t+2]=Me.b):(a[t]=Be.r,a[t+1]=Be.g,a[t+2]=Be.b)}return L(t,"color",new i.BufferAttribute(a,3,!0)),a}function Pe(t,e,r,i,o=!1){if(!t)return null;let s=[];if(t instanceof n.MultiPolygon)s=t.getGeometries().map((n=>Le(n,e,r||t.getCenter(),i,o)));else if(t instanceof n.Polygon){const n=Le(t,e,r||t.getCenter(),i,o);s.push(n)}else if(J(t))if($(t)){const n=rt(t);for(let a=0,u=n.length;a<u;a++)s.push(Le(n[a],e,r||et(t),i,o))}else{const n=Le(t,e,r||et(t),i,o);s.push(n)}return s}function Le(t,e,r,i,o=!1){let s,a,u;if(J(t)){const e=tt(t);s=e[0],a=e.slice(1,e.length),r=r||et(t)}else t instanceof n.Polygon&&(s=t.getShell(),a=t.getHoles(),r=r||t.getCenter());i=i||e.coordinateToVector3(r),u=o?e.coordinatiesToGLFloatArray(s,i).positons2d:e.coordinatiesToGLArray(s,i);const l=[o?u.buffer:u];if(a&&a.length>0)for(let t=0,r=a.length;t<r;t++){let r;r=o?e.coordinatiesToGLFloatArray(a[t],i).positons2d:e.coordinatiesToGLArray(a[t],i),l.push(o?r.buffer:r)}return l}function Re(t){if(!t)return null;let e=[];if(t instanceof n.MultiPolygon)e=t.getGeometries().map((t=>De(t,!1)));else if(t instanceof n.Polygon){const r=De(t,!1);e.push(r)}else if(J(t))if($(t)){const r=rt(t);for(let t=0,n=r.length;t<n;t++)e.push(De(r[t],!0))}else{const r=De(t,!0);e.push(r)}return e}function De(t,e){let r,i;if(e){const e=tt(t);r=e[0],i=e.slice(1,e.length)}else t instanceof n.Polygon&&(r=t.getShell(),i=t.getHoles());const o=[Ie(r)];if(i&&i.length>0)for(let t=0,e=i.length;t<e;t++){const e=Ie(i[t]);o.push(e)}return o}const Oe=new Map,Ne=new i.Vector3;function Fe(t,e,r,o=!0){let s,a,u=[];if(Array.isArray(t)&&t[0]instanceof i.Vector3)u=t;else{Array.isArray(t)&&(t=new n.LineString(t));const i=0;let l,h;X(t)?(l=tt(t),r||(h=et(t))):t instanceof n.LineString&&(l=t.getCoordinates(),r||(h=t.getCenter()));const c=e.coordinateToVector3(r||h);if(o){Oe.clear();for(let t=0,r=l.length;t<r;t++){const r=l[t],n=r.z||r[2]||0;if(!Oe.has(n)){const t=e.altitudeToVector3(n,n,null,Ne).x;Oe.set(n,t)}const o=e.coordinateToVector3(r,i).sub(c);o.z+=Oe.get(n)||0,u.push(o)}}else{const t=e.coordinatiesToGLFloatArray(l,c,!0);s=t.positions,a=t.positons2d}}if(!o)return{positions:s,positionsV:u,positions2d:a,arrayBuffer:s.buffer};a=new Float32Array(2*u.length),s=new Float32Array(3*u.length);for(let t=0,e=u.length;t<e;t++){const e=3*t,r=u[t];s[e]=r.x,s[e+1]=r.y,s[e+2]=r.z;const n=2*t;a[n]=r.x,a[n+1]=r.y}return{positions:s,positionsV:u,positions2d:a,arrayBuffer:s.buffer}}function Ue(t,e,r,n){const i=[],o=[],s=[];let a,u;for(let r=0,l=t.length;r<l;r++){const l=t[r];for(let t=0,r=l.length;t<r;t++){const r=l[t],h=r.join(",").toString();a?(h!==a&&(u=e.coordinateToVector3(r,0).sub(n),i.push(u.x,u.y,u.z),o.push(u),s.push(r)),a=h):(s.push(r),a=h,u=e.coordinateToVector3(r,0).sub(n),i.push(u.x,u.y,u.z),o.push(u))}}return{positions:i,positionsV:o,lnglats:s}}function Qe(t){let e;const r=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];for(let t=0,n=i.length;t<n;t++){const n=i[t],o=n.join(",").toString();e?(o!==e&&r.push(n),e=o):(r.push(n),e=o)}}return r}function Ge(t,e=1,r=1,n,i){const o=Fe(t,n,i).positionsV,s=[];for(let t=0,e=o.length;t<e;t++){const e=o[t];s.push([e.x,e.y,e.z])}const{indices:a,position:u,normal:l,uv:h}=Ht([s],{lineWidth:e,depth:r});return{position:u,normal:l,indices:a,uv:h}}function ze(t,e=1,r=1,n,i){const o=Fe(t,n,i).positionsV,s=[];for(let t=0,e=o.length;t<e;t++){const e=o[t];s.push([e.x,e.y,e.z])}const{indices:a,position:u,normal:l,uv:h}=ve([s],{lineWidth:e,cornerRadius:r});return{position:u,normal:l,indices:a,uv:h}}function je(t){let e,r=[];return t instanceof n.MultiLineString?(r=t.getGeometries(),e=t.getCenter()):t instanceof n.LineString?(r.push(t),e=t.getCenter()):X(t)&&(e=et(t),$(t)?r=rt(t):r.push(t)),{lineStrings:r,center:e}}function Ve(t){const e=new Float32Array(2*t.length-6);let r=0;for(let n=0,i=t.length/3;n<i;n++){const o=t[3*n],s=t[3*n+1],a=t[3*n+2];if(n>0&&n<i-1){const t=3*r;e[t]=o,e[t+1]=s,e[t+2]=a,r++}const u=3*r;e[u]=o,e[u+1]=s,e[u+2]=a,r++}return e}function qe(t){let e=0;const r=t.length;if(1===r)return t[0];for(let n=0;n<r;n++)e+=t[n].length;const n=new Float32Array(e);let i=0;for(let e=0;e<r;e++)n.set(t[e],i),i+=t[e].length;return n}function He(t,e){return t instanceof n.LineString?Ie(t.getCoordinates(),e):K(t)?Ie(t.geometry.coordinates,e):void 0}let We;function Ye(){return We||(We=new i.BufferGeometry,L(We,"position",new i.BufferAttribute(new Float32Array(3),3))),We}let Xe;var Je;function Ke(){return n.worker||console.error("maptalks.worker is not defined,You can't use ThreeVectorTileLayer"),!Je&&Xe&&(Je=new Xe("__maptalks.three__")),Je}function Ze(t,e,r={}){return void 0!==t&&"number"==typeof t&&0!==t?(void 0===r[t]&&(r[t]=e.distanceToVector3(t,t).x),r[t]):0}function $e(t,e,r={}){return void 0!==t&&"number"==typeof t&&0!==t?(void 0===r[t]&&(r[t]=e.altitudeToVector3(t,t).x),r[t]):0}function tr(t,e){return e?Object.assign({},e,t):t||{}}function er(t,e,r,n,i=[],o){const s=r.isMercator();let a,u,l;if(s){const t=r.getMap();a=t.getGLRes(),u=t.getSpatialReference().getTransformation().matrix}e&&(l=r.coordinateToVector3(e));const h=[],c=[],f={},p={},d=t.length;for(let a=0;a<d;a++){const u=t[a];let d=i[a]?i[a]:Se(n[a]);d=tr(d,o),e||(l=r.coordinateToVector3(d.center));let g=d.width||1,y=d.height||1,v=d.cornerRadius||0,m=d.bottomHeight||0;const A=d.parentCenter;g=Ze(g,r,f),v=Ze(v,r,f),y=$e(y,r,p),m=$e(m,r,p);const _=[];for(let t=0,n=u.length;t<n;t++){const n=u[t];let i;i=s?He(n,r):Fe(n,r,A||e,!1).arrayBuffer,c.push(i),_.push(i)}const x={id:d.id,data:_,height:y,width:g,cornerRadius:v,bottomHeight:m};s&&(x.center=[l.x,l.y]),h.push(x)}return{datas:h,transfer:c,glRes:a,matrix:u,center:s?[l.x,l.y]:null}}function rr(t,e,r,n,i=[],o){const s=r.isMercator();let a,u,l;if(s){const t=r.getMap();a=t.getGLRes(),u=t.getSpatialReference().getTransformation().matrix}e&&(l=r.coordinateToVector3(e));const h=[],c=[],f={},p=t.length;for(let a=0;a<p;a++){const u=t[a];let p=i[a]?i[a]:Se(n[a]);p=tr(p,o),e||(l=r.coordinateToVector3(p.center));let d=p.bottomHeight||0;d=$e(d,r,f);const g=[];for(let t=0,n=u.length;t<n;t++){const n=u[t];if(s){const t=He(n,r);c.push(t),g.push(t)}else{const t=Fe(n,r,e,!1).arrayBuffer;c.push(t),g.push(t)}}const y={id:p.id,data:g,bottomHeight:d};s&&(y.center=[l.x,l.y]),h.push(y)}return{datas:h,transfer:c,glRes:a,matrix:u,center:s?[l.x,l.y]:null}}function nr(t){return t.map((t=>t.data))}function ir(t){return t.map((t=>t.option||t.baseObject.getOptions()))}n.worker&&(Xe=class extends n.worker.Actor{test(t,e){this.send(t,null,e)}pushQueue(t={}){const{type:e,data:r,callback:n,layer:i,key:o,center:s,lineStrings:a,options:u,id:l,baseOptions:h}=t;let c;e.indexOf("ExtrudePolygon")>-1?c=function(t=[],e,r,n=[],i){const o=r.isMercator();let s,a,u;if(o){const t=r.getMap();s=t.getGLRes(),a=t.getSpatialReference().getTransformation().matrix}e&&(u=r.coordinateToVector3(e));const l=t.length,h=[],c=[],f={};for(let s=0;s<l;s++){const a=t[s],l=a;let p,d=n[s]?n[s]:Ce(l);d=tr(d,i),e||(u=r.coordinateToVector3(d.center)),p=o?Re(a):Pe(a,r,d.center||e,u,!0);for(let t=0,e=p.length;t<e;t++){const e=p[t];for(let t=0,r=e.length;t<r;t++)c.push(e[t])}let g=d.height||1,y=d.bottomHeight||0;g=$e(g,r,f),y=$e(y,r,f);const v={id:d.id,data:p,height:g,bottomHeight:y};o&&(v.center=[u.x,u.y]),h.push(v),l._properties&&delete l._properties}return{datas:h,transfer:c,glRes:s,matrix:a,center:o?[u.x,u.y]:null}}(r,s,i,u,h):"ExtrudeLines"===e||"Paths"===e?c=er(r,s,i,a,u,h):"Point"===e||("Line"===e||"FatLine"===e||"Lines"===e||"FatLines"===e?c=rr(r,s,i,a,u,h):"ExtrudeLine"===e||"Path"===e?c=er(r,s,i,a,u,h):"Bar"!==e&&"Bars"!==e||(c=function(t){const e=t.length,r=new Float32Array(7*e);let n=0;for(let i=0;i<e;i++){let{center:e,radialSegments:o,radius:s,height:a,altitude:u,id:l}=t[i];e=e||[0,0],r[n]=e[0],r[n+1]=e[1],r[n+2]=o||6,r[n+3]=s||1,r[n+4]=a,r[n+5]=u||0,r[n+6]=l,n+=7}const i=r.buffer;return{datas:i,transfer:[i]}}(r))),c?this.send({type:e,datas:c.datas,glRes:c.glRes,matrix:c.matrix,center:c.center},c.transfer,(function(t,e){t&&console.error(t),e.key=o,e.id=l,n(e)})):console.error(`No processing logic found for type:${e}`)}});class or{constructor(){this.queueMap={},this.tempQueue=[],this.time=this.getCurrentTime(),this.deQueueCount=5,this.resultQueue=[]}getActor(){return Ke()}getCurrentTime(){return n.Util.now()}loop(){this.deQueue()}push(t){return this.tempQueue.push(t),t.id&&(this.queueMap[t.id]=t),this}reset(){return this.time=this.getCurrentTime(),this.tempQueue=[],this}pushResult(t){if(t)return Array.isArray(t)||(t=[t]),t.forEach((t=>{this.resultQueue.push(t)})),this}deQueue(){if(!this.resultQueue.length)return this;const t=this.deQueueCount;return(this.resultQueue.slice(0,t)||[]).forEach((t=>{const{id:e}=t;if(this.queueMap[e]){const{baseObject:r}=this.queueMap[e];if(r&&r._workerLoad){r.getLayer()?r._workerLoad(t):console.warn(r," worker Processing completed but removed from the layer")}delete this.queueMap[e]}})),this.resultQueue.splice(0,t),this}}const sr=new class extends or{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){Ke().pushQueue({type:"ExtrudePolygon",layer:this.tempQueue[0].layer,data:nr(this.tempQueue),options:ir(this.tempQueue),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},ar=new class extends or{loop(){if(this.tempQueue.length){const t=Ke();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"ExtrudePolygons",layer:e.layer,data:e.data,key:e.key,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},ur=new class extends or{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){Ke().pushQueue({type:"ExtrudeLine",layer:this.tempQueue[0].layer,data:nr(this.tempQueue),options:ir(this.tempQueue),lineStrings:this.tempQueue.map((t=>t.lineString)),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},lr=new class extends or{loop(){if(this.tempQueue.length){const t=Ke();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"ExtrudeLines",layer:e.layer,data:e.data,key:e.key,lineStrings:e.lineStrings,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},hr=new class extends or{constructor(){super(),this.deQueueCount=200}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){Ke().pushQueue({type:"Line",layer:this.tempQueue[0].layer,data:nr(this.tempQueue),options:ir(this.tempQueue),lineStrings:this.tempQueue.map((t=>t.lineString)),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},cr=new class extends or{loop(){if(this.tempQueue.length){const t=Ke();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"Lines",layer:e.layer,data:e.data,key:e.key,lineStrings:e.lineStrings,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},fr=new class extends or{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){Ke().pushQueue({type:"FatLine",layer:this.tempQueue[0].layer,data:nr(this.tempQueue),options:ir(this.tempQueue),lineStrings:this.tempQueue.map((t=>t.lineString)),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},pr=new class extends or{loop(){if(this.tempQueue.length){const t=Ke();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"FatLines",layer:e.layer,data:e.data,key:e.key,lineStrings:e.lineStrings,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},dr=new class extends or{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){Ke().pushQueue({type:"Bar",layer:this.tempQueue[0].layer,data:nr(this.tempQueue),options:ir(this.tempQueue),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},gr=new class extends or{constructor(){super(),this.deQueueCount=1}loop(){if(this.tempQueue.length){const t=Ke();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"Bars",layer:e.layer,data:e.data,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},yr=new class extends or{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){Ke().pushQueue({type:"Path",layer:this.tempQueue[0].layer,data:nr(this.tempQueue),options:ir(this.tempQueue),lineStrings:this.tempQueue.map((t=>t.lineString)),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},vr=new class extends or{loop(){if(this.tempQueue.length){const t=Ke();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"Paths",layer:e.layer,data:e.data,key:e.key,lineStrings:e.lineStrings,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},mr={isRunning:!1,tasks:[],addTask:t=>{t&&mr.tasks.push(t)},removeTask:t=>{mr.tasks.splice(mr.tasks.indexOf(t),1)},loop(){sr.loop(),ar.loop(),ur.loop(),lr.loop(),hr.loop(),cr.loop(),fr.loop(),pr.loop(),dr.loop(),gr.loop(),yr.loop(),vr.loop(),mr.tasks.forEach((t=>{t&&t.loop&&t.loop()})),n.Util.requestAnimFrame(mr.loop)},star(){mr.isRunning||(mr.isRunning=!0,mr.loop())}};function Ar(t){const{position:e,normal:r,uv:n,indices:o}=_r(t),s=new i.BufferGeometry,a=new Float32Array(e.length);return a.fill(1,0,e.length),L(s,"color",new i.BufferAttribute(a,3)),L(s,"normal",new i.BufferAttribute(r,3)),L(s,"position",new i.BufferAttribute(e,3)),n&&n.length&&L(s,"uv",new i.BufferAttribute(n,2)),s.setIndex(new i.BufferAttribute(o,1)),s}function _r(t){const e={},r={};for(let n=0;n<t.length;++n){const i=t[n];for(const t in i)void 0===e[t]&&(e[t]=[],r[t]=0),e[t].push(i[t]),r[t]+=i[t].length}const n={};let i=0;const o=new Uint32Array(r.indices);for(const t in e)if("indices"===t){const r=e[t];let n=0;for(let t=0,s=r.length;t<s;t++){const s=r[t];for(let t=0,e=s.length;t<e;t++)o[n]=s[t]+i,n++;i+=e.position[t].length/3}}else{const i=xr(e[t],r[t]);if(!i)return null;n[t]=i}return n.indices=o,n}function xr(t,e){const r=new Float32Array(e);let n=0;for(let e=0;e<t.length;++e)r.set(t[e],n),n+=t[e].length;return r}function wr(t){const{position:e,normal:r,uv:n,indices:o}=t,s=new i.BufferGeometry;return L(s,"normal",new i.BufferAttribute(new Float32Array(r),3)),L(s,"position",new i.BufferAttribute(new Float32Array(e),3)),L(s,"uv",new i.BufferAttribute(new Float32Array(n),2)),s.setIndex(new i.BufferAttribute(new Uint32Array(o),1)),s}function br(t){const e=new i.BufferGeometry;return L(e,"normal",t.getAttribute("normal")),L(e,"position",t.getAttribute("position").clone()),e.setIndex(t.getIndex()),e}let Er;function Ir(){if(!Er){const t=1e-6;Er=O(t,t,t)}return Er}Ir();const Cr=O(1,1,1);Cr.translate(0,0,.5);const Sr=new i.Color("#fff"),Mr=new i.Color("#fff");function Br(t){const{position:e,normal:r,uv:n,indices:o}=function(t,e){e=Object.assign({},{radius:1,height:2,radialSegments:6},e);const r=Math.round(Math.max(4,e.radialSegments));let{radius:n,height:i}=e;const o=360/r/360*Math.PI*2,s=r+1,a=new Float32Array(3*s*2),[u,l]=t;let h=0,c=0;const f=3*s,p=2*s,d=[],g=[];let y=d.length-1;for(let t=-1;t<r;t++){const e=o*t,r=Math.cos(e)*n+u,s=Math.sin(e)*n+l;a[h]=r,a[h+1]=s,a[h+2]=0,a[h+f]=r,a[h+1+f]=s,a[h+2+f]=i;let v=0,m=0;v=.5+r/n/2,m=.5+s/n/2,g[c]=v,g[c+1]=m,g[c+p]=v,g[c+1+p]=m,h+=3,c+=2,t>1&&(d[++y]=0,d[++y]=t-1,d[++y]=t)}h-=3,a[h]=a[0],a[h+1]=a[1],a[h+2]=a[2];const v=a.length;a[v-3]=a[0],a[v-2]=a[1],a[v-1]=i;const m=d.length;y=d.length-1;for(let t=0;t<m;t++){const e=d[t];d[++y]=e+s}const A=new Float32Array(2*(3*s*2-6));let _=-1;h=2*s,c=0,y=d.length-1;let x=g.length-1;for(let t=0,e=a.length/2;t<e-3;t+=3){const e=a[t],r=a[t+1],o=a[t+3],u=a[t+4];A[++_]=e,A[++_]=r,A[++_]=i,A[++_]=o,A[++_]=u,A[++_]=i,A[++_]=e,A[++_]=r,A[++_]=0,A[++_]=o,A[++_]=u,A[++_]=0;const l=h+2,f=h+3,p=h,v=h+1;d[++y]=p,d[++y]=l,d[++y]=v,d[++y]=l,d[++y]=f,d[++y]=v,h+=4;const m=c/s,w=(c+1)/s;g[++x]=m,g[++x]=i/n/2,g[++x]=w,g[++x]=i/n/2,g[++x]=m,g[++x]=0,g[++x]=w,g[++x]=0,c++}const w=new Float32Array(a.length+A.length);w.set(a,0),w.set(A,a.length);const b=Ft(d,w);return{points:a,indices:new Uint32Array(d),position:w,normal:b,uv:new Float32Array(g)}}(t.center||[0,0],t),s=new i.BufferGeometry;return L(s,"normal",new i.BufferAttribute(r,3)),L(s,"position",new i.BufferAttribute(e,3)),L(s,"uv",new i.BufferAttribute(n,2)),s.setIndex(new i.BufferAttribute(o,1)),s}function Tr(t){const e=Object.assign({},t);return e._radius&&(e.radius=e._radius),Br(e)}function kr(t,e,r,n="y",o=0){let s=0;"y"===n?s=1:"z"===n&&(s=2);const a=t.attributes.position.array,u=a.length;Mr.setStyle(e),Sr.setStyle(r);const l=new Float32Array(u);if(Array.isArray(o))for(let t=0,e=o.length;t<e;t++){const{middleZ:e,start:r,end:n}=o[t].position;for(let t=r;t<n;t+=3){a[t+2]>e?(l[t]=Sr.r,l[t+1]=Sr.g,l[t+2]=Sr.b):(l[t]=Mr.r,l[t+1]=Mr.g,l[t+2]=Mr.b)}}else for(let t=0;t<u;t+=3){a[t+s]>o?(l[t]=Sr.r,l[t+1]=Sr.g,l[t+2]=Sr.b):(l[t]=Mr.r,l[t+1]=Mr.g,l[t+2]=Mr.b)}return L(t,"color",new i.BufferAttribute(l,3,!0)),l}function Pr(t){const e=[],r=t.length;let n=0;for(let e=0;e<r;e++){const{color:r}=t[e].attributes;r&&(n+=r.array.length)}const o=new Float32Array(n);let s=0;for(let r=0,n=t.length;r<n;r++){const{color:n,normal:i,position:a,uv:u}=t[r].attributes,l=t[r].index;n&&(o.set(n.array,s),s+=n.array.length),e.push({normal:i.array,uv:u.array,position:a.array,indices:l.array})}const a=Ar(e);o.length&&L(a,"color",new i.BufferAttribute(o,3,!0));for(let e=0,r=t.length;e<r;e++)t[e].dispose();return a}function Lr(){return Cr}const Rr={radius:10,height:100,radialSegments:6,altitude:0,topColor:"",bottomColor:"#2d2f61",heightEnable:!0};class Dr extends H{constructor(t,e,r,i){e=n.Util.extend({},Rr,e,{layer:i,coordinate:t}),super(),this._initOptions(e);const{height:o,radius:s,topColor:a,bottomColor:u,altitude:l,asynchronous:h}=e;let c;if(e.height=i.altitudeToVector3(o,o).x,e.radius=i.distanceToVector3(s,s).x,h){c=Ir();const t=n.Util.GUID();this.getOptions().id=t,dr.push({data:{radius:e.radius,height:e.height,radialSegments:e.radialSegments,id:t},layer:i,id:t,baseObject:this})}else c=Tr(e),a&&(kr(c,u,a,"z",e.height/2),r.vertexColors=D());this._createMesh(c,r);const f=i.altitudeToVector3(l,l).x,p=i.coordinateToVector3(t,f);this.getObject3d().position.copy(p),this.type="Bar"}_workerLoad(t){const e=wr(t),{topColor:r,bottomColor:n,height:i}=this.getOptions(),o=this.getObject3d(),s=o.material;if(r){kr(e,n,r,"z",this.getLayer().altitudeToVector3(i,i).x/2),s.vertexColors=D()}o.geometry=e,o.material.needsUpdate=!0,this._fire("workerload",{target:this})}}function Or(t){const e=[];return t&&t.length&&t.forEach((t=>{t=t instanceof i.Color?t:new i.Color(t),e.push(t.r,t.g,t.b)})),e}const Nr={altitude:0,bottomHeight:0,colors:null};class Fr extends H{constructor(t,e,r,o){e=n.Util.extend({},Nr,e,{layer:o,lineString:t}),super(),this._initOptions(e);const{lineStrings:s,center:a}=je(t),{asynchronous:u}=e;let l;if(u){l=Ye();const r=n.Util.GUID();this.getOptions().id=r,this.getOptions().center=a,hr.push({id:r,data:s,layer:o,key:e.key,lineString:t,baseObject:this})}else{const t=[];for(let e=0,r=s.length;e<r;e++){const r=s[e],{positions:n}=Fe(r,o,a,!1);t.push(Ve(n))}const n=qe(t);l=new i.BufferGeometry,L(l,"position",new i.BufferAttribute(n,3)),xe(l,e.bottomHeight,o);const u=Or(e.colors);u&&u.length&&(L(l,"color",new i.Float32BufferAttribute(u,3)),r.vertexColors=D())}this._createLineSegments(l,r);const{altitude:h}=e,c=o.altitudeToVector3(h,h).x,f=o.coordinateToVector3(a,c);this.getObject3d().position.copy(f),this.type="Line"}_workerLoad(t){const e=new i.BufferGeometry;L(e,"position",new i.BufferAttribute(new Float32Array(t.position),3));const r=Or(this.getOptions().colors),n=this.getObject3d(),o=n.material;r&&r.length&&(L(e,"color",new i.Float32BufferAttribute(r,3)),o.vertexColors=D()),this._computeLineDistances(e),n.geometry=e,n.material.needsUpdate=!0,this._fire("workerload",{target:this})}}const Ur={bottomHeight:0,width:3,height:1,altitude:0,topColor:null,bottomColor:"#2d2f61",heightEnable:!0};class Qr extends H{constructor(t,e,r,i){e=n.Util.extend({},Ur,e,{layer:i,lineString:t}),super(),this._initOptions(e);const{height:o,width:s,bottomColor:a,topColor:u,bottomHeight:l,altitude:h,asynchronous:c}=e,f=i.altitudeToVector3(o,o).x,p=i.distanceToVector3(s,s).x,{lineStrings:d,center:g}=je(t);let y;if(c){y=Ir();const e=n.Util.GUID();this.getOptions().id=e,this.getOptions().center=g,ur.push({id:e,data:d,layer:i,center:g,lineString:t,baseObject:this})}else{const t=[];let e=0;const n={};for(let r=0,o=d.length;r<o;r++){const o=Ge(d[r],p,f,i,g);e=xe(o,l,i,n),t.push(o)}y=Ar(t),u&&(ke(y,a,u,e+f/2),r.vertexColors=D())}this._createMesh(y,r);const v=i.altitudeToVector3(h,h).x,m=i.coordinateToVector3(g,v);this.getObject3d().position.copy(m),this.type="ExtrudeLine"}_workerLoad(t){const e=wr(t),{topColor:r,bottomColor:n,bottomHeight:i,height:o}=this.getOptions(),s=this.getObject3d(),a=s.material;if(r){const t=this.getLayer();ke(e,n,r,t.altitudeToVector3(i,i).x+t.altitudeToVector3(o,o).x/2),a.vertexColors=D()}s.geometry=e,s.material.needsUpdate=!0,this._fire("workerload",{target:this})}}const Gr={altitude:0,height:1,bottomHeight:0,topColor:null,bottomColor:"#2d2f61",heightEnable:!0};class zr extends H{constructor(t,e,r,o){e=n.Util.extend({},Gr,e,{layer:o,polygon:t}),super(),this._initOptions(e);const{height:s,topColor:a,bottomColor:u,altitude:l,bottomHeight:h,asynchronous:c}=e;let f;const p=J(t)?et(t):t.getCenter();if(c){f=Ir();const e=n.Util.GUID();this.getOptions().id=e,this.getOptions().center=p,sr.push({data:t,layer:o,id:e,baseObject:this})}else{f=function(t,e,r,n){const{position:o,normal:s,uv:a,indices:u}=Te(t,e,r,n),l=new Float32Array(o.length);l.fill(1,0,o.length);const h=new i.BufferGeometry;return L(h,"color",new i.BufferAttribute(l,3)),L(h,"normal",new i.BufferAttribute(s,3)),L(h,"position",new i.BufferAttribute(o,3)),L(h,"uv",new i.BufferAttribute(a,2)),h.setIndex(new i.BufferAttribute(u,1)),h}(t,s,o);const e=xe(f,h,o);if(a){ke(f,u,a,e+o.altitudeToVector3(s,s).x/2),r.vertexColors=D()}}this._createMesh(f,r);const d=o.altitudeToVector3(l,l).x,g=o.coordinateToVector3(p,d);this.getObject3d().position.copy(g),this.type="ExtrudePolygon"}_workerLoad(t){const e=wr(t),{topColor:r,bottomColor:n,bottomHeight:i,height:o}=this.getOptions(),s=this.getObject3d(),a=s.material;if(r){const t=this.getLayer();ke(e,n,r,t.altitudeToVector3(i,i).x+t.altitudeToVector3(o,o).x/2),a.vertexColors=D()}s.geometry=e,s.material.needsUpdate=!0,this._fire("workerload",{target:this})}}const jr={altitude:0,coordinate:null};class Vr extends H{constructor(t,e={},r){e.coordinate||(console.warn("coordinate is null,it is important to locate the model"),e.coordinate=r.getMap().getCenter()),e=n.Util.extend({},jr,e,{layer:r,model:t}),super(),this._initOptions(e),this._createGroup(),this.getObject3d().add(t);const{altitude:i,coordinate:o}=e,s=r.altitudeToVector3(i,i).x,a=r.coordinateToVector3(o,s);this.getObject3d().position.copy(a),this.type="Model"}getCoordinates(){const t=this.options.coordinate,e=this.options.altitude,r=new n.Coordinate(t);return r.z=e,r}}const qr=Math.PI/180;function Hr(t){return t*qr}function Wr(t,e){if(!t||!e)return 0;Array.isArray(t)||(t=t.toArray()),Array.isArray(e)||(e=e.toArray());let r=Hr(t[1]);const n=Hr(e[1]),i=r-n,o=Hr(t[0])-Hr(e[0]);return r=2*Math.asin(Math.sqrt(Math.pow(Math.sin(i/2),2)+Math.cos(r)*Math.cos(n)*Math.pow(Math.sin(o/2),2))),r*=6378137,Math.round(1e5*r)/1e5}function Yr(t,e){const{len:r,c1:n,c2:i}=t,o=i[0]-n[0],s=i[1]-n[1],a=e/r;return[n[0]+a*o,n[1]+a*s]}const Xr=1e3;const Jr={trail:5,chunkLength:50,width:2,height:1,speed:1,altitude:0,interactive:!1,heightEnable:!0};class Kr extends H{constructor(t,e,r,o){e=n.Util.extend({},Jr,e,{layer:o,lineString:t}),super(),this._initOptions(e);const{width:s,height:a,altitude:u,speed:l,chunkLength:h,trail:c}=e;let f,p;X(t)?(f=et(t),p=tt(t)):(f=t.getCenter(),p=t);const d=function(t,e=10){e=Math.max(e,.1),Array.isArray(t)||(t=t.getCoordinates().map((t=>t.toArray())));const r=t.length;let n=[],i=0;for(let e=0;e<r-1;e++){const r=Wr(t[e],t[e+1]),o=Math.floor(r);n.push({c1:t[e],len:o,c2:t[e+1]}),i+=o}if(i<=e)return n.map((t=>[t.c1,t.c2]));if(1===n.length&&n[0].len<=e)return[[n[0].c1,n[0].c2]];const o=n.length;let s,a=0,u=0;const l=[];let h=[n[0].c1];for(;a<o;){const{len:t,c2:r}=n[a];if(u+=t,u<e&&(h.push(r),a===o-1&&l.push(h),a++),u===e&&(h.push(r),u=0,l.push(h),h=[r],a++),u>e){const r=t-u+e;s=Yr(n[a],r),h.push(s),l.push(h),u=0,n[a].c1=s,n[a].len=t-r,h=[],h.push(s)}}return l}(p,h),g=o.coordinateToVector3(f),y=new i.BufferGeometry,v=new Float32Array(3e3),m=new Float32Array(3e3),A=new Uint16Array(Xr);L(y,"position",new i.BufferAttribute(v,3)),L(y,"normal",new i.BufferAttribute(m,3)),y.setIndex(new i.BufferAttribute(A,1));const _=o.distanceToVector3(s,s).x,x=o.altitudeToVector3(a,a).x;this._createMesh(y,r);const w=o.altitudeToVector3(u,u).x,b=o.coordinateToVector3(f,w);this.getObject3d().position.copy(b),this._params={index:0,chunkLines:d,geometries:[],layer:o,trail:Math.max(1,c),lineWidth:_,depth:x,speed:Math.min(1,l),idx:0,loaded:!0,center:f,centerPt:g,workerInitCount:0},this._init(this._params),this.type="ExtrudeLineTrail"}_init(t){const{layer:e,trail:r,lineWidth:i,depth:o,chunkLines:s,positionMap:a,centerPt:u,center:l}=t,h=s.length,c=[];if(this.options.asynchronous){t.loaded=!1;const i=n.Util.GUID();for(let t=0;t<h;t++){const o={type:"Feature",geometry:{type:"LineString",coordinates:Qe(s.slice(t,t+r))}},a=`${i}-${t}`,u=n.Util.extend({},this.options);u.parentCenter=l,u.id=a,u.center=l,ur.push({id:a,data:[o],layer:e,center:l,lineString:o,baseObject:this,option:u})}}else for(let t=0;t<h;t++){const n=Ue(s.slice(t,t+r),e,0,u).positionsV;c.push(Ge(n,i,o,e))}}_animation(){const{index:t,geometries:e,speed:r,idx:n,chunkLines:i,trail:o,lineWidth:s,depth:a,loaded:u,layer:l,positionMap:h,centerPt:c}=this._params;if(!u)return;const f=Math.round(t);if(f>n&&f<=i.length-1){this._params.idx++;let t=e[f];if(!t){t=Ge(Ue(i.slice(f,f+o),l,0,c).positionsV,s,a,l),e[f]=t}const r=this.getObject3d();!function(t,e,r,n){const i=e.length;t.attributes.normal.count=i,t.attributes.position.count=i;const o=t.attributes.position.array,s=t.attributes.normal.array;for(let t=0;t<i;t++)o[t]=e[t],s[t]=r[t];t.index.count=n.length;for(let e=0,r=n.length;e<r;e++)t.index.array[e]=n[e]}(r.geometry,t.position,t.normal,t.indices),r.geometry.attributes.position.needsUpdate=!0,r.geometry.attributes.normal.needsUpdate=!0,r.geometry.index.needsUpdate=!0}t>=i.length-1&&(this._params.index=-1,this._params.idx=-1),this._params.index+=r}_workerLoad(t){if(!t)return this;const{id:e,indices:r,position:i,normal:o,uv:s}=t;if(!(e&&r&&i&&o&&s))return;let a=e.split("-")[1];if(a=parseInt(a),n.Util.isNumber(a)){this._params.geometries[a]={indices:new Uint32Array(r),position:new Float32Array(i),uv:new Float32Array(s),normal:new Float32Array(o)},this._params.workerInitCount++}this._params.workerInitCount===this._params.chunkLines.length&&(this._params.loaded=!0,this._fire("workerload",{target:this}))}}const Zr=["click","mousemove","mousedown","mouseup","dblclick","contextmenu"].join(" ").toString(),$r=new i.MeshBasicMaterial;$r.vertexColors=D();const tn=t=>class extends t{_initBaseObjectsEvent(t){if(t&&Array.isArray(t)&&t.length)for(let e=0,r=t.length;e<r;e++){const r=t[e];this._proxyEvent(r)}return this}_proxyEvent(t){t.on("add",(t=>{this._showGeometry(t.target,!0)})),t.on("remove",(t=>{this._showGeometry(t.target,!1)})),t.on("mouseout",(t=>{this._mouseover=!1,this.fire("mouseout",Object.assign({},t,{target:this,selectMesh:this.getSelectMesh?this.getSelectMesh():null}))})),t.on(Zr,(t=>{this.fire(t.type,Object.assign({},t,{target:this,selectMesh:this.getSelectMesh?this.getSelectMesh():null}))}))}_getHideGeometryIndex(t){const e=[];let r=0;for(let n=0,i=this._geometriesAttributes.length;n<i;n++)!0===this._geometriesAttributes[n].hide&&(e.push(n),r+=this._geometriesAttributes[n][t].count);return{indexs:e,count:r}}_updateAttribute(t,e){const{indexs:r}=this._getHideGeometryIndex(e),n=this._geometryCache.attributes[e].array,o=n.length;for(let e=0;e<o;e++)t.array[e]=n[e];let s=NaN;this.getObject3d()instanceof i.LineSegments&&(s=0);for(let n=0;n<r.length;n++){const i=r[n],{start:o,end:a}=this._geometriesAttributes[i][e];for(let e=o;e<a;e++)t.array[e]=s}return this}_showGeometry(t,e){let r;if(t&&(r=t.getOptions().index),null!=r){const t=this._geometriesAttributes[r],{hide:n}=t;if(n===e)return this;t.hide=e;const i=this.getObject3d().geometry;this._updateAttribute(i.attributes.position,"position"),i.attributes.position.needsUpdate=!0,this.isHide=e}return this}getSelectMesh(){const t=this._getIndex();if(null!=t)return{data:this._datas[t],baseObject:this._baseObjects[t]}}_getIndex(t){return null==t&&(t=this.faceIndex||this.index),t}_init(){const t=this.getLayer().getPick();this.on("add",(()=>{t.add(this.pickObject3d)})),this.on("remove",(()=>{t.remove(this.pickObject3d)}))}_setPickObject3d(){if(!this._colorMap)return;const t=this._geometryCache||this.getObject3d().geometry.clone(),e=this.getLayer().getPick(),{_geometriesAttributes:r}=this,n=r.length,o=we(r);let s=0;for(let t=0;t<n;t++){const n=e.getColor(),i=n.getHex();this._colorMap[i]=t;const{count:a}=r[t].position;this._datas[t].colorIndex=i;for(let t=0;t<a;t++)o[s]=n.r,o[s+1]=n.g,o[s+2]=n.b,s+=3}L(t,"color",new i.BufferAttribute(o,3,!0));const a=e.getColor().getHex(),u=new i.Mesh(t,$r);u.position.copy(this.getObject3d().position),u._colorIndex=a,this.setPickObject3d(u)}},en={altitude:0,height:1,bottomHeight:0,topColor:null,bottomColor:"#2d2f61"},rn=new n.Coordinate(0,0);class nn extends(tn(H)){constructor(t,e,r,i){Array.isArray(t)||(t=[t]);const o=t.length;0===o&&console.error("polygons is empty");let s=1/0,a=1/0,u=-1/0,l=-1/0;for(let e=0;e<o;e++){const r=t[e],i=r.getCenter?r.getCenter():et(r,rn);let o,h;Array.isArray(i)?(o=i[0],h=i[1]):i instanceof n.Coordinate&&(o=i.x,h=i.y),s=Math.min(s,o),a=Math.min(a,h),u=Math.max(u,o),l=Math.max(l,h)}const h=new n.Coordinate((s+u)/2,(a+l)/2);e=n.Util.extend({},en,e,{layer:i,polygons:t,coordinate:h});const{topColor:c,bottomColor:f,altitude:p,asynchronous:d}=e;let g;const y=[],v=[];if(super(),d)g=Ir(),ar.push({id:n.Util.GUID(),layer:i,key:e.key,center:h,data:t,baseObject:this,option:e});else{const s=i.coordinateToVector3(h),a=[];let u=0;const l={};for(let r=0;r<o;r++){const o=t[r],c=n.Util.extend({},e,Ce(o)),f=c.height||1,p=c.bottomHeight||0,d=Te(o,f,i,h,s,l);a.push(d);const g=xe(d,p,i,l),{position:y,normal:m,uv:A,indices:_}=d;_.length;const x=y.length/3;m.length,A.length,v[r]={position:{middleZ:g+l[f]/2,count:x,start:u,end:u+3*x},hide:!1},u+=3*x}g=Ar(a),c&&(ke(g,f,c,v),r.vertexColors=D())}this._initOptions(e),this._createMesh(g,r);const m=i.altitudeToVector3(p,p).x,A=i.coordinateToVector3(h,m);this.getObject3d().position.copy(A),this._baseObjects=y,this._datas=t,this._geometriesAttributes=v,this.faceIndex=null,this._geometryCache=br(g),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(y),d||(this._setPickObject3d(),this._init()),this.type="ExtrudePolygons"}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],r=Object.assign({},this.options,J(e)?e.properties:e.getProperties(),{index:t});this._baseObjects[t]=new zr(e,r,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}identify(t){return this.picked}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const r=wr(t);this._geometryCache=br(r);const{topColor:n,bottomColor:i}=this.getOptions(),o=this.getObject3d(),s=o.material;if(n&&(ke(r,i,n,e),s.vertexColors=D()),o.geometry=r,o.material.needsUpdate=!0,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}function on(t,e,r){const n=t.project(r),i=e.width/2,o=e.height/2;return{x:Math.round(n.x*i+i),y:Math.round(-n.y*o+o)}}const sn={altitude:0,height:0,color:null},an=new i.Vector3;class un extends H{constructor(t,e,r,o){e=n.Util.extend({},sn,e,{layer:o,coordinate:t}),super();let{height:s,altitude:a,color:u,size:l}=e;const h=[],c=[];u&&(u=u instanceof i.Color?u:new i.Color(u),c.push(u.r,u.g,u.b));const f=o.altitudeToVector3(s,s).x,p=o.coordinateToVector3(t,f);h.push(0,0,p.z);const d=new i.BufferGeometry;L(d,"position",new i.Float32BufferAttribute(h,3,!0)),c.length&&L(d,"color",new i.Float32BufferAttribute(c,3,!0)),void 0!==l&&L(d,"size",new i.Float32BufferAttribute([l],1,!0)),e.positions=p,this._initOptions(e),this._createPoints(d,r);const g=o.altitudeToVector3(a,a).x,y=new i.Vector3(p.x,p.y,g);this.getObject3d().position.copy(y),this.type="Point"}identify(t){const e=this.getLayer(),r=this.getMap().getSize(),n=this.getLayer().getCamera(),i=this.getOptions().positions,o=this.getOptions().altitude;let s=this.getObject3d().material.size;void 0===s&&(s=this.options.size||1);const a=this.getMap().coordToContainerPoint(t),u=e.altitudeToVector3(o,o).x;an.x=i.x,an.y=i.y,an.z=i.z+u;const l=on(an,r,n);return Math.sqrt(Math.pow(a.x-l.x,2)+Math.pow(a.y-l.y,2))<=s/2}}function ln(t,e){const{minx:r,miny:n,maxx:i,maxy:o}=t,[s,a]=e;return r<=s&&s<=i&&n<=a&&a<=o}class hn{constructor(t,e,r,n){this.minlng=t,this.minlat=e,this.maxlng=r,this.maxlat=n,this.minx=1/0,this.miny=1/0,this.maxx=-1/0,this.maxy=-1/0,this.coordinates=[],this.positions=[],this.indexs=[],this.key=null}updateBBoxPixel(t){let e=1/0,r=1/0,i=-1/0,o=-1/0;const{minlng:s,minlat:a,maxlng:u,maxlat:l}=this;return[[s,a],[s,l],[u,a],[u,l]].map((t=>new n.Coordinate(t))).map((e=>t.coordToContainerPoint(e))).forEach((t=>{e=Math.min(e,t.x),r=Math.min(r,t.y),i=Math.max(i,t.x),o=Math.max(o,t.y)})),this.minx=e,this.miny=r,this.maxx=i,this.maxy=o,this}containsCoordinate(t){let e,r;Array.isArray(t)?(e=t[0],r=t[1]):t instanceof n.Coordinate&&(e=t.x,r=t.y);const{minlng:i,minlat:o,maxlng:s,maxlat:a}=this;return i<=e&&e<=s&&o<=r&&r<=a}isRecCross(t,e){const{x:r,y:n}=t,i={minx:r-e/2,miny:n-e/2,maxx:r+e/2,maxy:n+e/2},{minx:o,miny:s,maxx:a,maxy:u}=i;return!!(ln(this,[o,s])||ln(this,[o,u])||ln(this,[a,s])||ln(this,[a,u])||ln(i,[this.minx,this.miny])||ln(i,[this.minx,this.maxy])||ln(i,[this.maxx,this.miny])||ln(i,[this.maxx,this.maxy]))}static initGrids(t,e,r,n){const i=[],o=(r-t)/30,s=(n-e)/30;let a=t,u=e;for(let r=0;r<30;r++){a=t+r*o;for(let t=0;t<30;t++){u=e+t*s;const n=new hn(a,u,a+o,u+s);n.key=t+"-"+r,i.push(n)}}return{grids:i,averageX:o,averageY:s,ROWS:30,COLS:30}}}const cn={altitude:0},fn=new i.Vector3;function pn(t,e){const r=Math.pow(10,e);return Math.round(t*r)/r}class dn extends(tn(H)){constructor(t,e,r,o){Array.isArray(t)||(t=[t]),e=n.Util.extend({},cn,e,{layer:o,points:t});let s=1/0,a=1/0,u=-1/0,l=-1/0;for(let e=0,r=t.length;e<r;e++){const{coordinate:r}=t[e];let i,o;Array.isArray(r)?(i=r[0],o=r[1]):r instanceof n.Coordinate&&(i=r.x,o=r.y),t[e].coords=[i,o],s=Math.min(s,i),a=Math.min(a,o),u=Math.max(u,i),l=Math.max(l,o)}const h=o.coordinateToVector3([(s+u)/2,(a+l)/2]),{grids:c,averageX:f,averageY:p,ROWS:d,COLS:g}=hn.initGrids(s,a,u,l);c.length;const y=new Float32Array(3*t.length),v=[],m=new Float32Array(3*t.length),A=new Float32Array(t.length),_=[],x=[],w={};let b=0,E=!1,I=!1;const C=new i.Vector3(0,0,0);for(let e=0,r=t.length;e<r;e++){let{coordinate:r,height:n,color:u,size:l,coords:g}=t[e];const _=3*e;u&&(E=!0,u=u instanceof i.Color?u:new i.Color(u),m[_]=u.r,m[_+1]=u.g,m[_+2]=u.b),l&&(I=!0,A[e]=l,b=Math.max(b,l));const S=Ae(n,o,w),M=o.coordinateToVector3(r,S);C.x=M.x,C.y=M.y,C.z=M.z,C.sub(h),y[_]=C.x,y[_+1]=C.y,y[_+2]=C.z,v.push(M),x[e]={position:{count:1,start:3*e,end:3*e+3},hide:!1};let B=pn((g[1]-a)/p,4),T=pn((g[0]-s)/f,4);B-=1,T-=1,B=Math.max(0,B),T=Math.max(0,T),B=Math.ceil(B),T=Math.ceil(T);const k=T*d+B;c[k]&&(c[k].positions.push(M),c[k].indexs.push(e))}const S=new i.BufferGeometry;L(S,"position",new i.BufferAttribute(y,3,!0)),E&&L(S,"color",new i.BufferAttribute(m,3,!0)),I&&L(S,"size",new i.BufferAttribute(A,1,!0)),e.positions=v,super(),this._initOptions(e),this._createPoints(S,r);const M=e.altitude,B=o.altitudeToVector3(M,M).x,T=h.clone();T.z=B,this.getObject3d().position.copy(T),this._baseObjects=_,this._datas=t,this.faceIndex=null,this._geometriesAttributes=x,this._geometryCache=S.clone(),this.isHide=!1,this._initBaseObjectsEvent(_),this._grids=c,this._bindMapEvents(),this.type="Points",this.maxSize=b}_bindMapEvents(){const t=this.getMap(),e="zoomstart zooming zoomend movestart moving moveend pitch rotate";this.on("add",(()=>{this._updateGrids(),t.on(e,this._updateGrids,this)})),this.on("remove",(()=>{t.off(e,this._updateGrids,this)}))}_updateGrids(){const t=this.getMap();this._grids.forEach((e=>{e.indexs.length&&e.updateBBoxPixel(t)}))}getSelectMesh(){const t=this.faceIndex;if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],{coordinate:r,height:n,color:i,size:o}=e;this._baseObjects[t]=new un(r,{height:n,index:t,color:i,size:o},this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}identify(t){const e=this.getLayer(),r=this.getMap().getSize(),n=this.getLayer().getCamera(),i=this.getOptions().altitude,o=this.getMap(),s=e.altitudeToVector3(i,i).x;let a=this.getObject3d().material.size;const u=void 0===a,l=o.coordToContainerPoint(t),h=[];if(this._grids.forEach((t=>{t.indexs.length&&t.isRecCross(l,u?this.maxSize:a)&&h.push(t)})),h.length<1)return!1;for(let t=0,e=h.length;t<e;t++)for(let e=h[t].positions.length-1;e>=0;e--){u&&(a=this._datas[h[t].indexs[e]].size||1);const i=h[t].positions[e];fn.x=i.x,fn.y=i.y,fn.z=i.z+s;const o=on(fn,r,n);if(Math.sqrt(Math.pow(l.x-o.x,2)+Math.pow(l.y-o.y,2))<=a/2)return this.faceIndex=h[t].indexs[e],!0}return!1}}const gn={coordinate:"",radius:10,height:100,radialSegments:6,altitude:0,topColor:"",bottomColor:"#2d2f61"};class yn extends(tn(H)){constructor(t,e,r,o){Array.isArray(t)||(t=[t]);const s=t.length,a=_e(t),u=o.coordinateToVector3(a),l=[],h=[],c=[];let f=0;const p={},d={};let g;super(),e=n.Util.extend({},{altitude:0,layer:o,points:t},gn,e),this._initOptions(e);const y=new i.Vector3;if(e.asynchronous){g=Ir();const r=n.Util.GUID();this.getOptions().id=r;const i=[];for(let r=0;r<s;r++){const s=n.Util.extend({index:r},e,t[r]),{radius:a,radialSegments:l,altitude:h,height:c,coordinate:f}=s,g=me(a,o,p);t[r]._radius=g;const v=Ae(c,o,d),m=Ae(h,o,d),A=o.coordinateToVector3(f,0,y).sub(u);i.push({radialSegments:l,radius:g,height:v,center:[A.x,A.y],altitude:m})}gr.push({id:r,data:i,layer:o,baseObject:this})}else{for(let i=0;i<s;i++){const s=n.Util.extend({index:i},e,t[i]),{radius:a,radialSegments:g,altitude:v,topColor:m,bottomColor:A,height:_,coordinate:x}=s,w=me(a,o,p),b=Ae(_,o,d),E=Ae(v,o,d),I=o.coordinateToVector3(x,0,y).sub(u),C=Tr({radius:w,height:b,radialSegments:g,center:[I.x,I.y]});m&&(kr(C,A,m,"z",b/2),r.vertexColors=D());const S=C.attributes.position.array;for(let t=0,e=S.length;t<e;t+=3)S[t+2]+=E;l.push(C);const M=new Dr(x,s,r,o);h.push(M),C.index.count;const B=C.attributes.position.count;C.attributes.normal.count,C.attributes.uv.count,c[i]={position:{count:B,start:f,end:f+3*B},hide:!1},f+=3*B}g=Pr(l)}this._createMesh(g,r);const v=e.altitude,m=o.altitudeToVector3(v,v).x,A=u.clone();A.z=m,this.getObject3d().position.copy(A),this._baseObjects=h,this._datas=t,this._geometriesAttributes=c,this.faceIndex=null,this._geometryCache=br(g),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(h),e.asynchronous||(this._setPickObject3d(),this._init()),this.type="Bars"}identify(){return this.picked}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],r=Object.assign({},this.options,e,{index:t,asynchronous:!1});this._baseObjects[t]=new Dr(e.coordinate,r,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const r=wr(t);this._geometryCache=br(r);const{topColor:n,bottomColor:i}=this.getOptions(),o=this.getObject3d(),s=o.material;if(n&&(kr(r,i,n,"z",e),s.vertexColors=D()),o.geometry=r,o.material.needsUpdate=!0,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}const vn={width:3,height:1,altitude:0,topColor:null,bottomColor:"#2d2f61"};class mn extends(tn(H)){constructor(t,e,r,i){Array.isArray(t)||(t=[t]);const o=[],s=[],a=t.length;for(let e=0;e<a;e++){const r=je(t[e]);o.push(r.center),s.push(r.lineStrings)}const u=_e(o);e=n.Util.extend({},vn,e,{layer:i,lineStrings:t,coordinate:u});const{altitude:l,topColor:h,bottomColor:c,asynchronous:f}=e;let p;const d=[],g=[];if(super(),f)p=Ir(),lr.push({id:n.Util.GUID(),layer:i,key:e.key,center:u,data:s,lineStrings:t,baseObject:this,option:e});else{const o=[];let l=0;const f={},d={};for(let r=0;r<a;r++){const a=t[r],h=n.Util.extend({},e,Se(a),{index:r}),{height:c,width:p,bottomHeight:y}=h,v=me(p,i,f),m=Ae(c,i,d),A=s[r],_=[];let x=0;for(let t=0,e=A.length;t<e;t++){const e=Ge(A[t],v,m,i,u);x=xe(e,y,i,f),_.push(e)}const w=_r(_);o.push(w);const{position:b,normal:E,indices:I}=w;I.length;const C=b.length/3;E.length,g[r]={position:{middleZ:x+m/2,count:C,start:l,end:l+3*C},hide:!1},l+=3*C}p=Ar(o),h&&(ke(p,c,h,g),r.vertexColors=D())}this._initOptions(e),this._createMesh(p,r);const y=i.altitudeToVector3(l,l).x,v=i.coordinateToVector3(u,y);this.getObject3d().position.copy(v),this._baseObjects=d,this._datas=t,this._geometriesAttributes=g,this.faceIndex=null,this._geometryCache=br(p),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(d),f||(this._setPickObject3d(),this._init()),this.type="ExtrudeLines"}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],r=Object.assign({},this.options,K(e)?e.properties:e.getProperties(),{index:t});this._baseObjects[t]=new Qr(e,r,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}identify(t){return this.picked}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const r=wr(t);this._geometryCache=br(r);const{topColor:n,bottomColor:i,bottomHeight:o,height:s}=this.getOptions(),a=this.getObject3d().material;if(n&&(ke(r,i,n,e),a.vertexColors=D()),this.getObject3d().geometry=r,this.getObject3d().material.needsUpdate=!0,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}const An={altitude:0,colors:null};class _n extends(tn(H)){constructor(t,e,r,o){Array.isArray(t)||(t=[t]);const s=[],a=[],u=t.length;for(let e=0;e<u;e++){const r=je(t[e]);s.push(r.center),a.push(r.lineStrings)}const l=_e(s);e=n.Util.extend({},An,e,{layer:o,lineStrings:t,coordinate:l}),super(),this._initOptions(e);const{asynchronous:h}=e;let c;const f=[],p={};let d=[],g=0,y=[];if(h)c=Ye(),cr.push({id:n.Util.GUID(),layer:o,key:e.key,center:l,data:a,lineStrings:t,baseObject:this,option:e});else{for(let t=0;t<u;t++){const r=a[t];let i=0;for(let t=0,s=r.length;t<s;t++){const s=Se(r[t]),a=n.Util.extend({},e,s),{positions:u}=Fe(r[t],o,l,!1);xe(u,a.bottomHeight,o,p),i+=u.length/3*2-2,y.push(Ve(u))}d[t]={position:{count:i,start:g,end:g+3*i},hide:!1},g+=3*i}const t=qe(y);c=new i.BufferGeometry,L(c,"position",new i.BufferAttribute(t,3))}this._createLineSegments(c,r);const{altitude:v}=e,m=o.altitudeToVector3(v,v).x,A=o.coordinateToVector3(l,m);this.getObject3d().position.copy(A),this._baseObjects=f,this._datas=t,this._geometriesAttributes=d,this.faceIndex=null,this.index=null,this._geometryCache=c.clone(),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(f),h||(this._setPickObject3d(),this._init()),this.type="Lines"}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],r=n.Util.extend({},this.getOptions(),{index:t},K(e)?e.properties:e.getProperties());this._baseObjects[t]=new Fr(e,r,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}_setPickObject3d(){if(!this._colorMap)return;const t=this._geometryCache||this.getObject3d().geometry.clone(),e=this.getLayer().getPick(),{_geometriesAttributes:r}=this,n=r.length,o=we(r);let s=0;for(let t=0;t<n;t++){const n=e.getColor(),i=n.getHex();this._colorMap[i]=t;const{count:a}=r[t].position;this._datas[t].colorIndex=i;for(let t=0;t<a;t++)o[s]=n.r,o[s+1]=n.g,o[s+2]=n.b,s+=3}L(t,"color",new i.BufferAttribute(o,3,!0));const a=this.getObject3d().material.clone();a.color.set("#fff"),a.vertexColors=D();const u=e.getColor().getHex(),l=new i.LineSegments(t,a);l.position.copy(this.getObject3d().position),l._colorIndex=u,this.setPickObject3d(l)}identify(t){return this.picked}_workerLoad(t){const{position:e,geometriesAttributes:r}=t;this._geometriesAttributes=r;const n=new i.BufferGeometry;if(L(n,"position",new i.BufferAttribute(new Float32Array(e),3)),this._computeLineDistances(n),this._geometryCache=n.clone(),this.getObject3d().geometry=n,this.getObject3d().material.needsUpdate=!0,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}const xn=[],wn=[];function bn(){return{waitingQueue:xn,currentQueue:wn}}function En(t,e){for(let r=0,n=t.length;r<n;r++){const n=t[r];if(n){const{key:i,callback:o}=n;if(e===i)return t.splice(r,1),o}}return null}const In=document.createElement("canvas");let Cn;function Sn(t,e=!1){if(Cn)return Cn;const r=In.getContext("2d");return r.clearRect(0,0,256,256),r.save(),Cn=In.toDataURL(),Cn}function Mn(t=1,e=1){let r;return"undefined"==typeof document||(r=document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e)),r}In.width=In.height=256;class Bn extends n.TileLayer{constructor(t,e={}){super(n.Util.GUID(),n.Util.extend({urlTemplate:t},e)),this._opts=null,this._layer=null,this.material=null,this.getMaterial=null,this._baseObjectKeys={},this._loadTiles={},this._add=null,this._layerLaodTime=(new Date).getTime()}isAsynchronous(){return this._opts.worker}getBaseObjects(){const t=this._loadTiles,e=[];for(let r in t){const t=this._baseObjectKeys[r];if(t&&Array.isArray(t)&&t.length)for(let r=0,n=t.length;r<n;r++)e.push(t[r])}return e}onSelectMesh(t,e){}formatBaseObjects(t,e){return[]}loopMessage(t){}getTileData(t){const{key:e,url:r,callback:i,img:o}=t;n.Ajax.getJSON(r,{},(function(t,r){t?(console.error(t),i(e,null,o)):i(e,r,o)}))}_getCurentTileKeys(){const t=this.getTiles().tileGrids||[],e=[],r={};for(let n=0,i=t.length;n<i;n++){const i=t[n].tiles||[];for(let t=0,n=i.length;t<n;t++){const{id:n}=i[t];e.push(n),r[n]=!0}}return{keys:e,keysMap:r}}_isLoad(){const{keys:t}=this._getCurentTileKeys(),e=Object.keys(this._renderer.tilesInView);return t.length===e.length}_layerOnLoad(){const t=(new Date).getTime();if(t-this._layerLaodTime<20)return;this._layerLaodTime=t;const e=this._renderer.tilesInView,r=this._loadTiles,n=this._layer,i=this._baseObjectKeys,o=Object.keys(e).length,s=Object.keys(r).length,a=[];if(o&&s)for(let t in r)e[t]||i[t]&&(i[t]||[]).forEach((t=>{a.push(t)}));if(a.length&&n.removeMesh(a,!1),o&&s)for(let t in e)if(!r[t])if(i[t]){const e=i[t];n.addMesh(e)}else{const{x:e,y:r,z:n}=this._getXYZOfIndex(t);this.getTileUrl(e,r,n)}this._loadTiles=Object.assign({},e),this._diffCache()}_init(){}_workerLoad(t){const e=t.target._img;e.currentCount++,e.currentCount===e.needCount&&(e.src=Sn(e._key,this._opts.debug))}_generateBaseObjects(t,e,r){if(e&&r){const{keysMap:n}=this._getCurentTileKeys();if(!n[t])return void(r.src=Sn(0,this._opts.debug));const i=this.formatBaseObjects(t,e);if(i.length){r.needCount=i.length,r.currentCount=0;for(let e=0,n=i.length;e<n;e++){const n=i[e];n._img=r,n._vt=this,this.isVisible()||n.hide(),this._cachetile(t,n),n.isAsynchronous()||r.currentCount++}this._layer.addMesh(i,!1),r.needCount===r.currentCount&&(r.src=Sn(0,this._opts.debug)),this.isAsynchronous()?i.filter((t=>t.isAsynchronous())).forEach((t=>{t.on("workerload",this._workerLoad,this)})):r.src=Sn(0,this._opts.debug)}else r.src=Sn(0,this._opts.debug);this._loadTiles[t]=!0}else r&&(r.src=Sn(0,this._opts.debug))}_diffCache(){if(Object.keys(this._baseObjectKeys).length>this._renderer.tileCache.max){const t=this._renderer.tileCache.data,e=this._renderer.tilesInView,r=[];for(let n in this._baseObjectKeys)t[n]||e[n]||((this._baseObjectKeys[n]||[]).forEach((t=>{t.isAdd&&r.push(t)})),this._diposeBaseObject(n),delete this._baseObjectKeys[n]);r.length&&this._layer.removeMesh(r,!1)}}_diposeBaseObject(t){const e=this._baseObjectKeys[t];e&&e.length&&e.forEach((t=>{t.getObject3d().geometry.dispose(),t._geometryCache&&t._geometryCache.dispose();const e=t._baseObjects;e&&e.length&&e.forEach((t=>{t.getObject3d().geometry.dispose(),t=null})),t._datas=null,t._geometriesAttributes=null,t._faceMap=null,t._colorMap=null,t.pickObject3d&&t.pickObject3d.geometry.dispose(),t=null}))}_cachetile(t,e){this._baseObjectKeys[t]||(this._baseObjectKeys[t]=[]),this._baseObjectKeys[t].push(e)}_getXYZOfIndex(t){const e=t.indexOf("_")>-1?"_":"-";let[r,n,i]=t.split(e).slice(1,4);return{x:parseInt(n),y:parseInt(r),z:parseInt(i)}}_getTileExtent(t,e,r){const n=this.getMap()._getResolution(r);return this._getTileConfig().getTilePrjExtent(t,e,n)}_getTileLngLatExtent(t,e,r){const i=this._getTileExtent(t,e,r);let o=i.getMax(),s=i.getMin();const a=this.getMap().getProjection();return s=a.unproject(s),o=a.unproject(o),new n.Extent(s,o)}}const Tn={worker:!1};class kn extends Bn{constructor(t,e={},r,i){super(n.Util.GUID(),n.Util.extend({urlTemplate:t},Tn,e)),this._opts=e,this._layer=i,this.getMaterial=r,this._baseObjectKeys={},this._loadTiles={},this._add=null,this._layerLaodTime=(new Date).getTime(),this._init()}formatBaseObjects(t,e){const r=this._opts,o=[],s=this.isAsynchronous();for(let a in e){const u=e[a]||{};let l;if(Array.isArray(u)?l=u:"FeatureCollection"===u.type&&(l=u.features),l&&l.length){const e=[],h=[],c=[];for(let t=0,r=l.length;t<r;t++){const r=l[t];if(J(r))e.push(r);else if(K(r)){const t=rt(r);for(let e=0,r=t.length;e<r;e++)h.push(t[e])}else if(Z(r)){const t=rt(r);for(let e=0,r=t.length;e<r;e++)c.push(n.Util.extend({},t[e].properties,t[e],{coordinate:tt(t[e])}))}}if(e.length){const i=this._getMaterial(a,e,t,u);if(i){const u=this._layer.toExtrudePolygons(e,n.Util.extend({},{topColor:"#fff",layerName:a,asynchronous:s,key:t},r),i);o.push(u)}}if(h.length){const e=this._getMaterial(a,h,t,u);if(e&&(e instanceof i.LineBasicMaterial||e instanceof i.LineDashedMaterial)){const t=this._layer.toLines(h,n.Util.extend({},{layerName:a,asynchronous:s},r),e);o.push(t)}}if(c.length){const e=this._getMaterial(a,c,t,u);if(e&&e instanceof i.PointsMaterial){const t=this._layer.toPoints(c,n.Util.extend({},{layerName:a,asynchronous:s},r),e);o.push(t)}}}}return o}loopMessage(t){const{currentQueue:e}=bn();e.length>0&&this.getTileData(t)}_init(){this.on("layerload",this._layerOnLoad),this.on("add",(()=>{if(!1===this._add){const t=this.getBaseObjects();this._layer.addMesh(t)}this._add=!0,this.intervalId=setInterval((()=>{this._isLoad()&&!this._layer.getMap().isInteracting()&&this.fire("layerload")}),1e3)})),this.on("remove",(()=>{this._add=!1;const t=this.getBaseObjects();this._layer.removeMesh(t),clearInterval(this.intervalId)})),this.on("show",(()=>{this.getBaseObjects().forEach((t=>{t.show()}));for(let t in this._baseObjectKeys){(this._baseObjectKeys[t]||[]).forEach((t=>{t.show()}))}})),this.on("hide",(()=>{this.getBaseObjects().forEach((t=>{t.hide()}));for(let t in this._baseObjectKeys){(this._baseObjectKeys[t]||[]).forEach((t=>{t.hide()}))}})),this.on("renderercreate",(t=>{t.renderer.loadTile=function(t){var e=this.layer.getTileSize(),r=new Image;return r.width=e.width,r.height=e.height,r.onload=this.onTileLoad.bind(this,r,t),r.onerror=this.onTileError.bind(this,r,t),this.loadTileImage(r,t.url,t.id),r},t.renderer.deleteTile=function(t){if(!t||!t.image)return;t.image.onload=null,t.image.onerror=null;!function(t){const e=En(xn,t);e&&e(t)}((t.info||{}).id)},t.renderer.loadTileImage=(t,e,r)=>{t._key=r,function(t,e,r,n,i){const o={key:t,url:e,callback:r,img:n,vt:i};wn.length<10?(wn.push(o),i.loopMessage(o)):xn.push(o)}(r,e,((t,e,r)=>{this._generateBaseObjects(t,e,r),function(t,e){if(En(wn,t),xn.length){wn.push(xn[0]),xn.splice(0,1);const t=wn[wn.length-1];e.loopMessage(t)}}(t,this)}),t,this)}}))}_getMaterial(t,e,r,i){return this.getMaterial&&n.Util.isFunction(this.getMaterial)?this.getMaterial(t,e,r,i):null}}function Pn(t,e,r,n){const{position:o,uv:s,normal:a,indexs:u}=function(t,e,r,n){const i=t/r,o=e/n,s=-t/2,a=e/2,u=-e/2,l=(r+1)*(n+1),h=new Float32Array(3*l),c=new Float32Array(2*l),f=new Float32Array(3*l),p=new Uint32Array(10*l);let d=0,g=0,y=0;for(let l=0;l<=n;l++)for(let v=0;v<=r;v++){const m=s+i*v,A=a-o*l;h[d]=m,h[d+1]=A,h[d+2]=0,f[d]=0,f[d+1]=0,f[d+2]=1;const _=(m-s)/t,x=(A-u)/e;if(c[g]=_,c[g+1]=x,d+=3,g+=2,v<r&&l<n){const t=l*(r+1)+v,e=t+1,n=(r+1)*(l+1)+v,i=n+1;p[y]=t,p[y+1]=n,p[y+2]=e,p[y+3]=n,p[y+4]=i,p[y+5]=e,y+=6}}const v=new Uint32Array(y);for(let t=0,e=v.length;t<e;t++)v[t]=p[t];return{position:h,uv:c,normal:f,indexs:v}}(t,e,r,n),l=new i.BufferGeometry;return L(l,"position",new i.BufferAttribute(o,3)),L(l,"normal",new i.BufferAttribute(a,3)),L(l,"uv",new i.BufferAttribute(s,2)),l.setIndex(new i.BufferAttribute(u,1)),l}const Ln=new i.TextureLoader,Rn=document.createElement("canvas");function Dn(t){if(!t)return null;let e;return"string"==typeof t?(e=new Image,e.src=t):t instanceof HTMLCanvasElement?(e=new Image,e.src=t.toDataURL()):t instanceof Image&&(e=new Image,e.src=t.src,e.crossOrigin=t.crossOrigin),e&&!e.crossOrigin&&(e.crossOrigin="Anonymous"),e}const On=new Map;function Nn(t,e,r,n){if(!e||!r)return;const{imageWidth:o,imageHeight:s,flaserBoundary:a}=n;let u;if(u=t instanceof Uint32Array||t instanceof Uint8ClampedArray?t:function(t,e=256,r=256){Rn.width=e,Rn.height=r;const n=Rn.getContext("2d");return n.drawImage(t,0,0,e,r),n.getImageData(0,0,e,r).data}(t,o,s),!u)return void console.error("image is error type data",t);let l=0,h=0,c=0;const f=new i.Vector3,p=On;for(let t=0,n=u.length;t<n;t+=4){const n=.1*(256*u[t]*256+256*u[t+1]+u[t+2])-1e4;let i=0;if(0!==h&&h+1!==s&&0!==c&&c+1!==o||!a){const t=p.get(n);void 0!==t?i=t:(i=r.altitudeToVector3(n,n,null,f).x,p.set(n,i))}e.attributes.position.array[3*l+2]=i,l++,c++,c===o&&(h++,c=0)}e.attributes.position.needsUpdate=!0}const Fn={interactive:!1,altitude:0,image:null,imageWidth:256,imageHeight:256,texture:null,flaserBoundary:!0,bufferPixel:1};class Un extends H{constructor(t,e,r,i){e=n.Util.extend({},Fn,e,{layer:i,extent:t});const{texture:o,image:s,altitude:a,imageHeight:u,imageWidth:l,flaserBoundary:h,bufferPixel:c}=e;t instanceof n.Extent||(t=new n.Extent(t));const{xmin:f,ymin:p,xmax:d,ymax:g}=t;let y=1/0,v=1/0,m=-1/0,A=-1/0;[[f,p],[f,g],[d,g],[d,p]].forEach((t=>{const e=i.coordinateToVector3(t),{x:r,y:n}=e;y=Math.min(r,y),v=Math.min(n,v),m=Math.max(r,m),A=Math.max(n,A)}));const _=(m-y)/l,x=(A-v)/u;y-=_*c,m+=_*c,v-=x*c,A+=x*c;const w=Math.abs(m-y),b=Math.abs(A-v),E=Dn(s),I=Dn(o),C=Pn(w,b,l-1,u-1);super(),this._initOptions(e),this._createMesh(C,r);const S=i.altitudeToVector3(a,a).x,M=i.coordinateToVector3(t.getCenter(),S);this.getObject3d().position.copy(M),r.transparent=!0,E&&(E.onload=()=>{Nn(E,C,i,{imageWidth:l,imageHeight:u,flaserBoundary:h}),this.fire("dataload",{})},E.onerror=function(){console.error(`not load ${E.src}`),this.fire("dataerror",{})}),I?(r.opacity=0,Ln.load(I.src,(t=>{r.map=t,r.opacity=1,r.needsUpdate=!0,this.fire("textureload",{})}))):r.opacity=1,this.type="Terrain"}updateData(t){return Nn(t,this.getObject3d().geometry,this.getLayer(),this.getOptions()),this.fire("updatedata",{}),this}}const Qn={scale:1,tileDivisor:4};class Gn extends Bn{constructor(t,e={},r,i){super(n.Util.GUID(),n.Util.extend({urlTemplate:t},Qn,e)),this._opts=e,this._layer=i,this.material=r,this._baseObjectKeys={},this._loadTiles={},this._add=null,this._imgQueue={},this._layerLaodTime=(new Date).getTime(),this._init()}isAsynchronous(){return!1}formatBaseObjects(t,e){const r=this.options,n=[],{scale:i,tileDivisor:o}=r,{x:s,y:a,z:u}=this._getXYZOfIndex(t),l=this.getMap().getZoom(),h=this.getTileUrl(s,a,u),[c,f]=this.options.tileSize,p=this._getTileLngLatExtent(s,a,u),d=this.material.clone();if(u+1>=Math.round(l)){const t=new Un(p,{image:e,imageWidth:c/o,imageHeight:f/o,texture:h},d,this._layer);t.getObject3d().scale.set(i,i,1),n.push(t)}return n}loopMessage(t){this.getTileData(t)}_init(){this.on("layerload",this._layerOnLoad),this.on("add",(()=>{if(!1===this._add){const t=this.getBaseObjects();this._layer.addMesh(t)}this._add=!0,this.intervalId=setInterval((()=>{this._isLoad()&&!this._layer.getMap().isInteracting()&&this.fire("layerload")}),1e3)})),this.on("remove",(()=>{this._add=!1;const t=this.getBaseObjects();this._layer.removeMesh(t),clearInterval(this.intervalId)})),this.on("show",(()=>{this.getBaseObjects().forEach((t=>{t.show()}));for(let t in this._baseObjectKeys){(this._baseObjectKeys[t]||[]).forEach((t=>{t.show()}))}})),this.on("hide",(()=>{this.getBaseObjects().forEach((t=>{t.hide()}));for(let t in this._baseObjectKeys){(this._baseObjectKeys[t]||[]).forEach((t=>{t.hide()}))}})),this.on("renderercreate",(t=>{t.renderer.loadTile=function(t){var e=this.layer.getTileSize(),r=new Image;return r.width=e.width,r.height=e.height,r.onload=this.onTileLoad.bind(this,r,t),r.onerror=this.onTileError.bind(this,r,t),this.loadTileImage(r,t.url,t.id),r},t.renderer.deleteTile=t=>{if(!t||!t.image)return;t.image.onload=null,t.image.onerror=null;const e=t.info||{},r=this._imgQueue[e.id];r&&(r.src="",r.onload=null,r.onerror=null,delete this._imgQueue[e.id])},t.renderer.loadTileImage=(t,e,r)=>{t._key=r;const n=new Image;this._imgQueue[r]=n;const i={key:r,url:e,rgbImage:n,callback:(t,e,r)=>{this._generateBaseObjects(t,e,r)},img:t,vt:this};this.loopMessage(i)}}))}}
4
+ */function nt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function it(t,e){return it=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},it(t,e)}function ot(t,e,r){void 0===r&&(r=2);var n,i,o,s=e&&e.length,a=s?e[0]*r:t.length,u=st(t,0,a,r,!0),l=[];if(!u||u.next===u.prev)return l;if(s&&(u=function(t,e,r,n){for(var i=[],o=0,s=e.length;o<s;o++){var a=st(t,e[o]*n,o<s-1?e[o+1]*n:t.length,n,!1);a===a.next&&(a.steiner=!0),i.push(vt(a))}i.sort(pt);for(var u=0;u<i.length;u++)r=dt(i[u],r);return r}(t,e,u,r)),t.length>80*r){n=1/0,i=1/0;for(var h=-1/0,c=-1/0,f=r;f<a;f+=r){var p=t[f],d=t[f+1];p<n&&(n=p),d<i&&(i=d),p>h&&(h=p),d>c&&(c=d)}o=0!==(o=Math.max(h-n,c-i))?32767/o:0}return ut(u,l,r,n,i,o,0),l}function st(t,e,r,n,i){var o;if(i===function(t,e,r,n){for(var i=0,o=e,s=r-n;o<r;o+=n)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}(t,e,r,n)>0)for(var s=e;s<r;s+=n)o=Mt(s/n|0,t[s],t[s+1],o);else for(var a=r-n;a>=e;a-=n)o=Mt(a/n|0,t[a],t[a+1],o);return o&&wt(o,o.next)&&(Bt(o),o=o.next),o}function at(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!wt(n,n.next)&&0!==xt(n.prev,n,n.next))n=n.next;else{if(Bt(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function ut(t,e,r,n,i,o,s){if(t){!s&&o&&function(t,e,r,n){var i=t;do{0===i.z&&(i.z=yt(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r=1;do{var n=t,i=void 0;t=null;var o=null;for(e=0;n;){e++;for(var s=n,a=0,u=0;u<r&&(a++,s=s.nextZ);u++);for(var l=r;a>0||l>0&&s;)0!==a&&(0===l||!s||n.z<=s.z)?(i=n,n=n.nextZ,a--):(i=s,s=s.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=s}o.nextZ=null,r*=2}while(e>1)}(i)}(t,n,i,o);for(var a=t;t.prev!==t.next;){var u=t.prev,l=t.next;if(o?ht(t,n,i,o):lt(t))e.push(u.i,t.i,l.i),Bt(t),t=l.next,a=l.next;else if((t=l)===a){s?1===s?ut(t=ct(at(t),e),e,r,n,i,o,2):2===s&&ft(t,e,r,n,i,o):ut(at(t),e,r,n,i,o,1);break}}}}function lt(t){var e=t.prev,r=t,n=t.next;if(xt(e,r,n)>=0)return!1;for(var i=e.x,o=r.x,s=n.x,a=e.y,u=r.y,l=n.y,h=Math.min(i,o,s),c=Math.min(a,u,l),f=Math.max(i,o,s),p=Math.max(a,u,l),d=n.next;d!==e;){if(d.x>=h&&d.x<=f&&d.y>=c&&d.y<=p&&At(i,a,o,u,s,l,d.x,d.y)&&xt(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function ht(t,e,r,n){var i=t.prev,o=t,s=t.next;if(xt(i,o,s)>=0)return!1;for(var a=i.x,u=o.x,l=s.x,h=i.y,c=o.y,f=s.y,p=Math.min(a,u,l),d=Math.min(h,c,f),g=Math.max(a,u,l),y=Math.max(h,c,f),v=yt(p,d,e,r,n),m=yt(g,y,e,r,n),A=t.prevZ,_=t.nextZ;A&&A.z>=v&&_&&_.z<=m;){if(A.x>=p&&A.x<=g&&A.y>=d&&A.y<=y&&A!==i&&A!==s&&At(a,h,u,c,l,f,A.x,A.y)&&xt(A.prev,A,A.next)>=0)return!1;if(A=A.prevZ,_.x>=p&&_.x<=g&&_.y>=d&&_.y<=y&&_!==i&&_!==s&&At(a,h,u,c,l,f,_.x,_.y)&&xt(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;A&&A.z>=v;){if(A.x>=p&&A.x<=g&&A.y>=d&&A.y<=y&&A!==i&&A!==s&&At(a,h,u,c,l,f,A.x,A.y)&&xt(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;_&&_.z<=m;){if(_.x>=p&&_.x<=g&&_.y>=d&&_.y<=y&&_!==i&&_!==s&&At(a,h,u,c,l,f,_.x,_.y)&&xt(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function ct(t,e){var r=t;do{var n=r.prev,i=r.next.next;!wt(n,i)&&bt(n,r,r.next,i)&&Ct(n,i)&&Ct(i,n)&&(e.push(n.i,r.i,i.i),Bt(r),Bt(r.next),r=t=i),r=r.next}while(r!==t);return at(r)}function ft(t,e,r,n,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&_t(s,a)){var u=St(s,a);return s=at(s,s.next),u=at(u,u.next),ut(s,e,r,n,i,o,0),void ut(u,e,r,n,i,o,0)}a=a.next}s=s.next}while(s!==t)}function pt(t,e){var r=t.x-e.x;0===r&&(0===(r=t.y-e.y)&&(r=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)));return r}function dt(t,e){var r=function(t,e){var r,n=e,i=t.x,o=t.y,s=-1/0;if(wt(t,n))return n;do{if(wt(t,n.next))return n.next;if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>s&&(s=a,r=n.x<n.next.x?n:n.next,a===i))return r}n=n.next}while(n!==e);if(!r)return null;var u=r,l=r.x,h=r.y,c=1/0;n=r;do{if(i>=n.x&&n.x>=l&&i!==n.x&&mt(o<h?i:s,o,l,h,o<h?s:i,o,n.x,n.y)){var f=Math.abs(o-n.y)/(i-n.x);Ct(n,t)&&(f<c||f===c&&(n.x>r.x||n.x===r.x&&gt(r,n)))&&(r=n,c=f)}n=n.next}while(n!==u);return r}(t,e);if(!r)return e;var n=St(r,t);return at(n,n.next),at(r,r.next)}function gt(t,e){return xt(t.prev,t,e.prev)<0&&xt(e.next,t,t.next)<0}function yt(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function vt(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function mt(t,e,r,n,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(n-a)>=(r-s)*(e-a)&&(r-s)*(o-a)>=(i-s)*(n-a)}function At(t,e,r,n,i,o,s,a){return!(t===s&&e===a)&&mt(t,e,r,n,i,o,s,a)}function _t(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&bt(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Ct(t,e)&&Ct(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(xt(t.prev,t,e.prev)||xt(t,e.prev,e))||wt(t,e)&&xt(t.prev,t,t.next)>0&&xt(e.prev,e,e.next)>0)}function xt(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function wt(t,e){return t.x===e.x&&t.y===e.y}function bt(t,e,r,n){var i=It(xt(t,e,r)),o=It(xt(t,e,n)),s=It(xt(r,n,t)),a=It(xt(r,n,e));return i!==o&&s!==a||(!(0!==i||!Et(t,r,e))||(!(0!==o||!Et(t,n,e))||(!(0!==s||!Et(r,t,n))||!(0!==a||!Et(r,e,n)))))}function Et(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function It(t){return t>0?1:t<0?-1:0}function Ct(t,e){return xt(t.prev,t,t.next)<0?xt(t,e,t.next)>=0&&xt(t,t.prev,e)>=0:xt(t,e,t.prev)<0||xt(t,t.next,e)<0}function St(t,e){var r=Tt(t.i,t.x,t.y),n=Tt(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Mt(t,e,r,n){var i=Tt(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Bt(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 Tt(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}var kt=function(){function t(t,e,r,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=1),this.isQuaternion=!0,this._x=t,this._y=e,this._z=r,this._w=n}t.slerpFlat=function(t,e,r,n,i,o,s){var a=r[n+0],u=r[n+1],l=r[n+2],h=r[n+3],c=i[o+0],f=i[o+1],p=i[o+2],d=i[o+3];if(0===s)return t[e+0]=a,t[e+1]=u,t[e+2]=l,void(t[e+3]=h);if(1===s)return t[e+0]=c,t[e+1]=f,t[e+2]=p,void(t[e+3]=d);if(h!==d||a!==c||u!==f||l!==p){var g=1-s,y=a*c+u*f+l*p+h*d,v=y>=0?1:-1,m=1-y*y;if(m>Number.EPSILON){var A=Math.sqrt(m),_=Math.atan2(A,y*v);g=Math.sin(g*_)/A,s=Math.sin(s*_)/A}var x=s*v;if(a=a*g+c*x,u=u*g+f*x,l=l*g+p*x,h=h*g+d*x,g===1-s){var w=1/Math.sqrt(a*a+u*u+l*l+h*h);a*=w,u*=w,l*=w,h*=w}}t[e]=a,t[e+1]=u,t[e+2]=l,t[e+3]=h},t.multiplyQuaternionsFlat=function(t,e,r,n,i,o){var s=r[n],a=r[n+1],u=r[n+2],l=r[n+3],h=i[o],c=i[o+1],f=i[o+2],p=i[o+3];return t[e]=s*p+l*h+a*f-u*c,t[e+1]=a*p+l*c+u*h-s*f,t[e+2]=u*p+l*f+s*c-a*h,t[e+3]=l*p-s*h-a*c-u*f,t};var e,r,n,i=t.prototype;return i.set=function(t,e,r,n){return this._x=t,this._y=e,this._z=r,this._w=n,this._onChangeCallback(),this},i.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)},i.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},i.setFromEuler=function(t,e){void 0===e&&(e=!0);var r=t._x,n=t._y,i=t._z,o=t._order,s=Math.cos,a=Math.sin,u=s(r/2),l=s(n/2),h=s(i/2),c=a(r/2),f=a(n/2),p=a(i/2);switch(o){case"XYZ":this._x=c*l*h+u*f*p,this._y=u*f*h-c*l*p,this._z=u*l*p+c*f*h,this._w=u*l*h-c*f*p;break;case"YXZ":this._x=c*l*h+u*f*p,this._y=u*f*h-c*l*p,this._z=u*l*p-c*f*h,this._w=u*l*h+c*f*p;break;case"ZXY":this._x=c*l*h-u*f*p,this._y=u*f*h+c*l*p,this._z=u*l*p+c*f*h,this._w=u*l*h-c*f*p;break;case"ZYX":this._x=c*l*h-u*f*p,this._y=u*f*h+c*l*p,this._z=u*l*p-c*f*h,this._w=u*l*h+c*f*p;break;case"YZX":this._x=c*l*h+u*f*p,this._y=u*f*h+c*l*p,this._z=u*l*p-c*f*h,this._w=u*l*h-c*f*p;break;case"XZY":this._x=c*l*h-u*f*p,this._y=u*f*h-c*l*p,this._z=u*l*p+c*f*h,this._w=u*l*h+c*f*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!0===e&&this._onChangeCallback(),this},i.setFromAxisAngle=function(t,e){var r=e/2,n=Math.sin(r);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(r),this._onChangeCallback(),this},i.setFromRotationMatrix=function(t){var e=t.elements,r=e[0],n=e[4],i=e[8],o=e[1],s=e[5],a=e[9],u=e[2],l=e[6],h=e[10],c=r+s+h;if(c>0){var f=.5/Math.sqrt(c+1);this._w=.25/f,this._x=(l-a)*f,this._y=(i-u)*f,this._z=(o-n)*f}else if(r>s&&r>h){var p=2*Math.sqrt(1+r-s-h);this._w=(l-a)/p,this._x=.25*p,this._y=(n+o)/p,this._z=(i+u)/p}else if(s>h){var d=2*Math.sqrt(1+s-r-h);this._w=(i-u)/d,this._x=(n+o)/d,this._y=.25*d,this._z=(a+l)/d}else{var g=2*Math.sqrt(1+h-r-s);this._w=(o-n)/g,this._x=(i+u)/g,this._y=(a+l)/g,this._z=.25*g}return this._onChangeCallback(),this},i.setFromUnitVectors=function(t,e){var r=t.dot(e)+1;return r<Number.EPSILON?(r=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=r):(this._x=0,this._y=-t.z,this._z=t.y,this._w=r)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=r),this.normalize()},i.rotateTowards=function(t,e){var r=this.angleTo(t);if(0===r)return this;var n=Math.min(1,e/r);return this.slerp(t,n),this},i.identity=function(){return this.set(0,0,0,1)},i.invert=function(){return this.conjugate()},i.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},i.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},i.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},i.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},i.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},i.multiply=function(t){return this.multiplyQuaternions(this,t)},i.premultiply=function(t){return this.multiplyQuaternions(t,this)},i.multiplyQuaternions=function(t,e){var r=t._x,n=t._y,i=t._z,o=t._w,s=e._x,a=e._y,u=e._z,l=e._w;return this._x=r*l+o*s+n*u-i*a,this._y=n*l+o*a+i*s-r*u,this._z=i*l+o*u+r*a-n*s,this._w=o*l-r*s-n*a-i*u,this._onChangeCallback(),this},i.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var r=this._x,n=this._y,i=this._z,o=this._w,s=o*t._w+r*t._x+n*t._y+i*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=o,this._x=r,this._y=n,this._z=i,this;var a=1-s*s;if(a<=Number.EPSILON){var u=1-e;return this._w=u*o+e*this._w,this._x=u*r+e*this._x,this._y=u*n+e*this._y,this._z=u*i+e*this._z,this.normalize(),this}var l=Math.sqrt(a),h=Math.atan2(l,s),c=Math.sin((1-e)*h)/l,f=Math.sin(e*h)/l;return this._w=o*c+this._w*f,this._x=r*c+this._x*f,this._y=n*c+this._y*f,this._z=i*c+this._z*f,this._onChangeCallback(),this},i.slerpQuaternions=function(t,e,r){return this.copy(t).slerp(e,r)},i.random=function(){var t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),r=Math.random(),n=Math.sqrt(1-r),i=Math.sqrt(r);return this.set(n*Math.sin(t),n*Math.cos(t),i*Math.sin(e),i*Math.cos(e))},i.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},i.fromArray=function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},i.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},i.fromBufferAttribute=function(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this},i.toJSON=function(){return this.toArray()},i._onChange=function(t){return this._onChangeCallback=t,this},i._onChangeCallback=function(){},e=t,(r=[{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()}}])&&nt(e.prototype,r),n&&nt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Pt=new kt,Lt=function(){function t(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=r}var e=t.prototype;return e.set=function(t,e,r){return void 0===r&&(r=this.z),this.x=t,this.y=e,this.z=r,this},e.clone=function(){return new this.constructor(this.x,this.y,this.z)},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},e.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.sub=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},e.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},e.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.applyAxisAngle=function(t,e){return this.applyQuaternion(Pt.setFromAxisAngle(t,e))},e.applyMatrix4=function(t){var e=this.x,r=this.y,n=this.z,i=t.elements,o=1/(i[3]*e+i[7]*r+i[11]*n+i[15]);return this.x=(i[0]*e+i[4]*r+i[8]*n+i[12])*o,this.y=(i[1]*e+i[5]*r+i[9]*n+i[13])*o,this.z=(i[2]*e+i[6]*r+i[10]*n+i[14])*o,this},e.applyQuaternion=function(t){var e=this.x,r=this.y,n=this.z,i=t.x,o=t.y,s=t.z,a=t.w,u=a*e+o*n-s*r,l=a*r+s*e-i*n,h=a*n+i*r-o*e,c=-i*e-o*r-s*n;return this.x=u*a+c*-i+l*-s-h*-o,this.y=l*a+c*-o+h*-i-u*-s,this.z=h*a+c*-s+u*-o-l*-i,this},e.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},e.divideScalar=function(t){return this.multiplyScalar(1/t)},e.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},e.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},e.clamp=function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},e.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},e.clampLength=function(t,e){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(t,Math.min(e,r)))},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.normalize=function(){return this.divideScalar(this.length()||1)},e.setLength=function(t){return this.normalize().multiplyScalar(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var r=t.x,n=t.y,i=t.z,o=e.x,s=e.y,a=e.z;return this.x=n*a-i*s,this.y=i*o-r*a,this.z=r*s-n*o,this},e.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},t}();function Rt(t){let e,r,n=0,i=1;const o=t.length;for(;i<o;)e=r||t[0],r=t[i],n+=(r[0]-e[0])*(r[1]+e[1]),i++;return n>0}function Dt(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function Ot(t,e){const r=e[0],n=e[1],i=e[2],o=Math.sqrt(r*r+n*n+i*i)||1;return t[0]=r/o,t[1]=n/o,t[2]=i/o,t}function Nt(t,e,r){const n=e[0],i=e[1],o=e[2],s=r[0],a=r[1],u=r[2];return t[0]=i*u-o*a,t[1]=o*s-n*u,t[2]=n*a-i*s,t}function Ft(t,e){function r(t,e,r,n){t[0]=e,t[1]=r,t[2]=n}const n=[],i=[],o=[],s=[],a=[],u=[],l=t.length,h=new Float32Array(e.length);let c=0;for(;c<l;){const l=3*t[c],f=3*t[c+1],p=3*t[c+2];r(n,e[l],e[l+1],e[l+2]),r(i,e[f],e[f+1],e[f+2]),r(o,e[p],e[p+1],e[p+2]),Dt(a,o,i),Dt(s,n,i),Nt(u,a,s);for(let t=0;t<3;t++)h[l+t]+=u[t],h[f+t]+=u[t],h[p+t]+=u[t];c+=3}let f=0;const p=h.length;for(;f<p;)r(u,h[f],h[f+1],h[f+2]),Ot(u,u),h[f]=u[0]||0,h[f+1]=u[1]||0,h[f+2]=u[2]||0,f+=3;return h}function Ut(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 e=0,r=0;for(let n=0,i=t.length;n<i;n++){const{position:i,indices:o}=t[n];e+=i.length,r+=o.length}const n={position:new Float32Array(e),normal:new Float32Array(e),uv:new Float32Array(e/3*2),indices:new Uint32Array(r),results:t};let i=0,o=0,s=0,a=0;for(let e=0,r=t.length;e<r;e++){const{position:r,indices:u,normal:l,uv:h}=t[e];n.position.set(r,i),n.normal.set(l,i),n.uv.set(h,a);let c=0;const f=u.length;for(;c<f;){const t=u[c]+o;n.indices[s]=t,s++,c++}a+=h.length,i+=r.length,o+=r.length/3}return n}function Qt(t){return 180*t/Math.PI}function Gt(t){return t/180*Math.PI}function zt(t,e,r,n,i,o){const s=3*r,a=3*n,u=3*i,l=3*o,h=e[s],c=e[s+1],f=e[s+2],p=e[a],d=e[a+1],g=e[a+2],y=e[u],v=e[u+1],m=e[u+2],A=e[l],_=e[l+1],x=e[l+2];let w=t.length-1;Math.abs(c-d)<Math.abs(h-p)?(t[++w]=h,t[++w]=1-f,t[++w]=p,t[++w]=1-g,t[++w]=y,t[++w]=1-m,t[++w]=A,t[++w]=1-x):(t[++w]=c,t[++w]=1-f,t[++w]=d,t[++w]=1-g,t[++w]=v,t[++w]=1-m,t[++w]=_,t[++w]=1-x)}function jt(t,e){e=Object.assign({},{depth:2,top:!0},e);const r=t.map((t=>{for(let e=0,r=t.length;e<r;e++){const r=t[e];Vt(r),0===e?Rt(r)||(t[e]=r.reverse()):Rt(r)&&(t[e]=r.reverse()),qt(r)&&r.splice(r.length-1,1)}const r=function(t,e){const r=function(t){let e=0,r=0;const n=t.length;for(;r<n;)e+=t[r].length,r++;return e}(t),n=t.length,i=[],o=new Float32Array(2*r),s=[],a=[],u=3*r,l=2*r,h=e.depth;let c=0,f=0,p=0;for(let e=0;e<n;e++){const r=t[e];e>0&&i.push(c/2);let n=0;const d=r.length;for(;n<d;){const t=r[n],e=t[0],i=t[1],d=t[2]||0;o[c++]=e,o[c++]=i,s[f]=e,s[f+1]=i,s[f+2]=h+d,s[u+f]=e,s[u+f+1]=i,s[u+f+2]=d,a[p]=e,a[p+1]=i,a[l+p]=e,a[l+p+1]=i,f+=3,p+=2,n++}}return{flatVertices:o,holes:i,points:s,count:r,uv:a}}(t,e);r.polygon=t;return function(t,e,r){const n=[],{count:i}=t,o=r.top;for(let t=0,r=e.length;t<r;t+=3){const s=e[t],a=e[t+1],u=e[t+2];o&&(n[t]=s,n[t+1]=a,n[t+2]=u);let l=r+t;const h=i+s,c=i+a,f=i+u;o||(l=t),n[l]=h,n[l+1]=c,n[l+2]=f}t.indices=n}(r,ot(r.flatVertices,r.holes,2),e),function(t,e){const{points:r,indices:n,polygon:i,uv:o}=t,s=e.depth;let a=r.length-1,u=n.length-1;for(let t=0,e=i.length;t<e;t++){const e=i[t];let l=0;const h=e.length;for(;l<h;){const t=e[l];let i=e[l+1];l===h-1&&(i=e[0]);const c=r.length/3,f=t[0],p=t[1],d=t[2]||0,g=i[0],y=i[1],v=i[2]||0;r[++a]=f,r[++a]=p,r[++a]=d+s,r[++a]=g,r[++a]=y,r[++a]=v+s,r[++a]=f,r[++a]=p,r[++a]=d,r[++a]=g,r[++a]=y,r[++a]=v;const m=c+2,A=c+3,_=c,x=c+1;n[++u]=m,n[++u]=_,n[++u]=A,n[++u]=_,n[++u]=x,n[++u]=A,zt(o,r,m,A,_,x),l++}}}(r,e),r.position=new Float32Array(r.points),r.indices=new Uint32Array(r.indices),r.uv=new Float32Array(r.uv),r.normal=Ft(r.indices,r.position),r})),n=Ut(r);return n.polygons=t,n}function Vt(t){qt(t)||t.push(t[0])}function qt(t){const e=t.length,[r,n]=t[0],[i,o]=t[e-1];return r===i&&n===o}function Ht(t,e){!function(t){t.lineWidth=Math.max(0,t.lineWidth),t.depth=Math.max(0,t.depth),t.sideDepth=Math.max(0,t.sideDepth)}(e=Object.assign({},{depth:2,lineWidth:1,bottomStickGround:!1,pathUV:!1},e));const r=t.map((t=>{const r=function(t,e){let r=e.lineWidth/2;e.isSlope&&(r*=2);const n=[],i=[],o=[],s=t.length;let a=0;for(;a<s;){let e=t[a],u=t[a+1];const l=t[a];a===s-1&&(e=t[s-2],u=t[s-1]);const h=u[1]-e[1],c=u[0]-e[0];let f=0;const p=Qt(Math.atan(h/c));if(0===a||a===s-1)f=p,f-=90;else{const r=t[a-1];Wt.x=r[0]-e[0],Wt.y=r[1]-e[1],Yt.x=u[0]-e[0],Yt.y=u[1]-e[1];f=p-Xt(Wt,Yt)/2}const d=Gt(f),g=l,y=[Math.cos(d)+g[0],Math.sin(d)+g[1]],[v,m]=Kt(e,u,r);let A=Zt(v[0],v[1],g,y),_=Zt(m[0],m[1],g,y);if(!A||!_){const t=n.length,e=n[t-2],r=n[t-1];if(!e||!r)continue;A=[e[0],e[1]],_=[r[0],r[1]]}A[2]=l[2]||0,_[2]=l[2]||0,n.push(A,_),Jt(A,e,u)?(i.push(A),o.push(_)):(i.push(_),o.push(A)),a++}return{offsetPoints:n,leftPoints:i,rightPoints:o,line:t}}(t,e);return r.line=t,function(t,e){const r=e.bottomStickGround,n=e.depth,i=t.depths;let o=n,s=n;i&&(o=i[0],s=i[1]);const{leftPoints:a,rightPoints:u}=t,l=t.line,h=e.pathUV;if(h){!function(t){let e=0;for(let r=0,n=t.length;r<n;r++){const n=t[r],i=t[r+1];if(0===r&&(n.distance=0),n&&i){const[t,r,o]=n,[s,a,u]=i,l=t-s,h=r-a,c=(o||0)-(u||0);e+=Math.sqrt(l*l+h*h+c*c),i.distance=e}}}(l);for(let t=0,e=l.length;t<e;t++)a[t].distance=u[t].distance=l[t].distance}let c=0,f=a.length;const p=[],d=[],g=[];for(;c<f;){const t=3*c,[e,n,i]=a[c];p[t]=e,p[t+1]=n,p[t+2]=o+i;const[d,y,v]=u[c],m=3*f+t;p[m]=d,p[m+1]=y,p[m+2]=s+v;const A=2*f*3+t;p[A]=e,p[A+1]=n,p[A+2]=i,r&&(p[A+2]=0);const _=2*f*3+3*f+t;if(p[_]=d,p[_+1]=y,p[_+2]=v,r&&(p[_+2]=0),h){const t=l[c].distance,e=2*c;g[e]=t,g[e+1]=1;const r=2*f+e;g[r]=t,g[r+1]=0;const n=2*f*2+e;g[n]=t,g[n+1]=1;const i=2*f*2+2*f+e;g[i]=t,g[i+1]=0}c++}if(!h){c=0,f=p.length;let t=g.length-1;for(;c<f;){const e=p[c],r=p[c+1];g[++t]=e,g[++t]=r,c+=3}}c=0,f=a.length;let y=d.length-1;for(;c<f-1;){const t=c,e=c+1,r=t+f,n=e+f;d[++y]=t,d[++y]=r,d[++y]=e,d[++y]=r,d[++y]=n,d[++y]=e;const i=c+2*f,o=i+1,s=i+f,a=o+f;d[++y]=i,d[++y]=s,d[++y]=o,d[++y]=s,d[++y]=a,d[++y]=o,c++}if(t.indices=d,t.points=p,t.uv=g,i)for(f=a.length,c=0;c<f;)a[c].depth=o,u[c].depth=s,c++}(r,e),function(t,e){const{points:r,indices:n,leftPoints:i,rightPoints:o,uv:s}=t,a=e.depth,u=e.bottomStickGround,l=[i,o],h=t.depths,c=e.pathUV,f=e.lineWidth;let p=r.length-1,d=n.length-1,g=s.length-1;function y(t,e){const i=r.length/3,o=h?t.depth:a,l=h?e.depth:a;r[++p]=t[0],r[++p]=t[1],r[++p]=o+t[2],r[++p]=e[0],r[++p]=e[1],r[++p]=l+e[2],r[++p]=t[0],r[++p]=t[1],r[++p]=u?0:t[2],r[++p]=e[0],r[++p]=e[1],r[++p]=u?0:e[2];const y=i+2,v=i+3,m=i,A=i+1;n[++d]=y,n[++d]=m,n[++d]=v,n[++d]=m,n[++d]=A,n[++d]=v,c?(s[++g]=t.distance,s[++g]=o/f,s[++g]=e.distance,s[++g]=l/f,s[++g]=t.distance,s[++g]=0,s[++g]=e.distance,s[++g]=0):zt(s,r,y,v,m,A)}for(let t=0,e=l.length;t<e;t++){let e=l[t];t>0&&(e=e.map((t=>t)),e=e.reverse());let r=0;const n=e.length-1;for(;r<n;){y(e[r],e[r+1]),r++}}const v=i.length,m=[o[0],i[0],i[v-1],o[v-1]];for(let t=0;t<m.length;t+=2){y(m[t],m[t+1])}}(r,e),r.position=new Float32Array(r.points),r.indices=new Uint32Array(r.indices),r.uv=new Float32Array(r.uv),r.normal=Ft(r.indices,r.position),r})),n=Ut(r);return n.lines=t,n}const Wt={x:0,y:0},Yt={x:0,y:0};const Xt=({x:t,y:e},{x:r,y:n})=>{const i=t*r+e*n,o=t*n-e*r;return(Math.atan2(o,i)/Math.PI*180+360)%360};function Jt(t,e,r){const[n,i]=e,[o,s]=r,[a,u]=t;return(i-s)*a+(o-n)*u+n*s-o*i>0}function Kt(t,e,r){const n=e[1]-t[1],i=e[0]-t[0],o=Math.atan2(n,i),s=o+Math.PI/2;let a=Math.cos(s)*r,u=Math.sin(s)*r;const l=[t[0]+a,t[1]+u],h=[e[0]+a,e[1]+u],c=o-Math.PI/2;a=Math.cos(c)*r,u=Math.sin(c)*r;return[[l,h],[[t[0]+a,t[1]+u],[e[0]+a,e[1]+u]]]}function Zt(t,e,r,n){const i=e[0]-t[0],o=e[1]-t[1],s=n[0]-r[0],a=n[1]-r[1];if(0===i&&0===s)return null;if(0===o&&0===a)return null;const u=o/i,l=a/s,h=t[1]-u*t[0],c=r[1]-l*r[0];let f,p;return 0===i?(f=t[0],p=l*f+c):0===s?(f=r[0],p=u*f+h):0===o?(p=t[1],f=(p-c)/l):0===a?(p=r[1],f=(p-h)/u):(f=(c-h)/(u-l),p=u*f+h),[f,p]}var $t=function(){function t(){this.pos=new Lt,this.dir=new Lt,this.right=new Lt,this.up=new Lt,this.dist=0,this.widthScale=1,this.sharp=!1}var e=t.prototype;return e.lerpPathPoints=function(t,e,r){this.pos.lerpVectors(t.pos,e.pos,r),this.dir.lerpVectors(t.dir,e.dir,r),this.up.lerpVectors(t.up,e.up,r),this.right.lerpVectors(t.right,e.right,r),this.dist=(e.dist-t.dist)*r+t.dist,this.widthScale=(e.widthScale-t.widthScale)*r+t.widthScale},e.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}(),te=function(){function t(t,e,r,n,i,o,s,a,u,l,h,c,f,p,d,g){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,r,n,i,o,s,a,u,l,h,c,f,p,d,g)}var e=t.prototype;return e.set=function(t,e,r,n,i,o,s,a,u,l,h,c,f,p,d,g){var y=this.elements;return y[0]=t,y[4]=e,y[8]=r,y[12]=n,y[1]=i,y[5]=o,y[9]=s,y[13]=a,y[2]=u,y[6]=l,y[10]=h,y[14]=c,y[3]=f,y[7]=p,y[11]=d,y[15]=g,this},e.multiply=function(t){return this.multiplyMatrices(this,t)},e.makeRotationAxis=function(t,e){var r=Math.cos(e),n=Math.sin(e),i=1-r,o=t.x,s=t.y,a=t.z,u=i*o,l=i*s;return this.set(u*o+r,u*s-n*a,u*a+n*s,0,u*s+n*a,l*s+r,l*a-n*o,0,u*a-n*s,l*a+n*o,i*a*a+r,0,0,0,0,1),this},e.equals=function(t){for(var e=this.elements,r=t.elements,n=0;n<16;n++)if(e[n]!==r[n])return!1;return!0},t}(),ee=function(){function t(){this.type="Curve",this.arcLengthDivisions=200}var e=t.prototype;return e.getPoint=function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},e.getPointAt=function(t,e){var r=this.getUtoTmapping(t);return this.getPoint(r,e)},e.getPoints=function(t){void 0===t&&(t=5);for(var e=[],r=0;r<=t;r++)e.push(this.getPoint(r/t));return e},e.getLength=function(){var t=this.getLengths();return t[t.length-1]},e.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 e,r=[],n=this.getPoint(0),i=0;r.push(0);for(var o=1;o<=t;o++)i+=(e=this.getPoint(o/t)).distanceTo(n),r.push(i),n=e;return this.cacheArcLengths=r,r},e.getUtoTmapping=function(t,e){var r,n=this.getLengths(),i=0,o=n.length;r=e||t*n[o-1];for(var s,a=0,u=o-1;a<=u;)if((s=n[i=Math.floor(a+(u-a)/2)]-r)<0)a=i+1;else{if(!(s>0)){u=i;break}u=i-1}if(n[i=u]===r)return i/(o-1);var l=n[i];return(i+(r-l)/(n[i+1]-l))/(o-1)},t}();function re(t,e,r,n){return function(t,e){var r=1-t;return r*r*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,r)+function(t,e){return t*t*e}(t,n)}var ne=function(t){var e,r;function n(e,r,n){var i;return void 0===e&&(e=new Lt),void 0===r&&(r=new Lt),void 0===n&&(n=new Lt),(i=t.call(this)||this).isQuadraticBezierCurve3=!0,i.type="QuadraticBezierCurve3",i.v0=e,i.v1=r,i.v2=n,i}return r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,it(e,r),n.prototype.getPoint=function(t,e){void 0===e&&(e=new Lt);var r=e,n=this.v0,i=this.v1,o=this.v2;return r.set(re(t,n.x,i.x,o.x),re(t,n.y,i.y,o.y),re(t,n.z,i.z,o.z)),r},n}(ee),ie=new Lt,oe=new Lt,se=new Lt,ae=new te,ue=new ne;var le=function(){function t(){this.array=[],this.count=0}var e=t.prototype;return e.set=function(t,e,r,n,i){if(void 0===e&&(e=.1),void 0===r&&(r=10),void 0===n&&(n=null),void 0===i&&(i=!1),(t=t.slice(0)).length<2)return console.warn("PathPointList: points length less than 2."),void(this.count=0);i&&!t[0].equals(t[t.length-1])&&t.push((new Lt).copy(t[0]));for(var o=0,s=t.length;o<s;o++)if(0===o)this._start(t[o],t[o+1],n);else if(o===s-1)if(i){this._corner(t[o],t[1],e,r,n);var a=this.array[0].dist;this.array[0].copy(this.array[this.count-1]),this.array[0].dist=a}else this._end(t[o]);else this._corner(t[o],t[o+1],e,r,n)},e.distance=function(){return this.count>0?this.array[this.count-1].dist:0},e._getByIndex=function(t){return this.array[t]||(this.array[t]=new $t),this.array[t]},e._start=function(t,e,r){this.count=0;var n=this._getByIndex(this.count);if(n.pos.copy(t),n.dir.subVectors(e,t),r)n.up.copy(r);else{var i=Number.MAX_VALUE,o=Math.abs(n.dir.x),s=Math.abs(n.dir.y),a=Math.abs(n.dir.z);o<i&&(i=o,n.up.set(1,0,0)),s<i&&(i=s,n.up.set(0,1,0)),a<i&&n.up.set(0,0,1)}n.right.crossVectors(n.dir,n.up).normalize(),n.up.crossVectors(n.right,n.dir).normalize(),n.dist=0,n.widthScale=1,n.sharp=!1,n.dir.normalize(),this.count++},e._end=function(t){var e=this.array[this.count-1],r=this._getByIndex(this.count);r.pos.copy(t),r.dir.subVectors(t,e.pos);var n=r.dir.length();r.dir.normalize(),r.up.copy(e.up);var i=ie.crossVectors(e.dir,r.dir);if(i.length()>Number.EPSILON){i.normalize();var o=Math.acos(Math.min(Math.max(e.dir.dot(r.dir),-1),1));r.up.applyMatrix4(ae.makeRotationAxis(i,o))}r.right.crossVectors(r.dir,r.up).normalize(),r.dist=e.dist+n,r.widthScale=1,r.sharp=!1,this.count++},e._corner=function(t,e,r,n,i){if(r>0&&n>0){for(var o=function(t,e,r,n,i,o){var s=ie.subVectors(e,t),a=oe.subVectors(r,e),u=s.length(),l=a.length();s.normalize(),a.normalize();var h=Math.min(.999999*(i?u/2:u),n);o.v0.copy(e).sub(s.multiplyScalar(h)),o.v1.copy(e);var c=Math.min(l/2*.999999,n);return o.v2.copy(e).add(a.multiplyScalar(c)),o}(this.array[this.count-1].pos,t,e,r,this.count-1==0,ue),s=o.getPoints(n),a=0;a<n;a++)this._sharpCorner(s[a],s[a+1],i,0===a?1:0);s[n].equals(e)||this._sharpCorner(s[n],e,i,2)}else this._sharpCorner(t,e,i,0,!0)},e._sharpCorner=function(t,e,r,n,i){void 0===n&&(n=0),void 0===i&&(i=!1);var o=this.array[this.count-1],s=this._getByIndex(this.count),a=ie.subVectors(t,o.pos),u=oe.subVectors(e,t),l=a.length();if(a.normalize(),u.normalize(),s.pos.copy(t),1===n?s.dir.copy(a):2===n?s.dir.copy(u):(s.dir.addVectors(a,u),s.dir.normalize()),r)1===s.dir.dot(r)?s.right.crossVectors(u,r).normalize():s.right.crossVectors(s.dir,r).normalize(),s.up.crossVectors(s.right,s.dir).normalize();else{s.up.copy(o.up);var h=se.crossVectors(o.dir,s.dir);if(h.length()>Number.EPSILON){h.normalize();var c=Math.acos(Math.min(Math.max(o.dir.dot(s.dir),-1),1));s.up.applyMatrix4(ae.makeRotationAxis(h,c))}s.right.crossVectors(s.dir,s.up).normalize()}s.dist=o.dist+l;var f=a.dot(u);s.widthScale=Math.min(1/Math.sqrt((1+f)/2),1.415)||1,s.sharp=Math.abs(f-1)>.05&&i,this.count++},t}();const he=new Lt(0,0,1),ce=new Lt,fe=new Lt,pe=new Lt,de=new Lt,ge=new Lt,ye=new Lt;function ve(t,e){e=Object.assign({},{lineWidth:1,cornerRadius:0,cornerSplit:10},e);const r=t.map((t=>{const r=function(t){const e=[];for(let r=0,n=t.length;r<n;r++){const n=t[r],[i,o,s]=n,a=new Lt(i,o,s||0);e[r]=a}return e}(t),n=new le;n.set(r,e.cornerRadius,e.cornerSplit,he);const i=function(t,e){const r=e.lineWidth||.1,n=1,i=r/2,o=r,s=t.distance(),a=n*s;let u=0;const l=[],h=[],c=[],f=[];let p=0;if(0===s)return{position:l,normal:h,uv:c,indices:f,count:u};const d=i/o;let g,y=l.length-1,v=h.length-1,m=c.length-1,A=f.length-1;function _(t){const e=0===l.length,r=t.sharp&&!e,n=t.dist/o,s=t.dir,a=t.up,g=t.right;if(ce.copy(g).multiplyScalar(i*t.widthScale),fe.copy(g).multiplyScalar(-i*t.widthScale),ce.add(t.pos),fe.add(t.pos),r){pe.fromArray(l,l.length-6).sub(fe),de.fromArray(l,l.length-3).sub(ce);const t=pe.length()-de.length();let e,r;t>0?(e=pe,r=fe):(e=de,r=ce),ge.copy(e).setLength(Math.abs(t)).add(r);let i=ye.copy(r).sub(ge).normalize().dot(s)*ye.copy(r).sub(ge).length()*2;ye.copy(s).setLength(i).add(ge),t>0?(l[++y]=ge.x,l[++y]=ge.y,l[++y]=ge.z,l[++y]=ce.x,l[++y]=ce.y,l[++y]=ce.z,l[++y]=fe.x,l[++y]=fe.y,l[++y]=fe.z,l[++y]=ce.x,l[++y]=ce.y,l[++y]=ce.z,l[++y]=ye.x,l[++y]=ye.y,l[++y]=ye.z,l[++y]=ce.x,l[++y]=ce.y,l[++y]=ce.z,p+=6,f[++A]=p-6,f[++A]=p-8,f[++A]=p-7,f[++A]=p-6,f[++A]=p-7,f[++A]=p-5,f[++A]=p-4,f[++A]=p-6,f[++A]=p-5,f[++A]=p-2,f[++A]=p-4,f[++A]=p-1,u+=12):(l[++y]=fe.x,l[++y]=fe.y,l[++y]=fe.z,l[++y]=ge.x,l[++y]=ge.y,l[++y]=ge.z,l[++y]=fe.x,l[++y]=fe.y,l[++y]=fe.z,l[++y]=ce.x,l[++y]=ce.y,l[++y]=ce.z,l[++y]=fe.x,l[++y]=fe.y,l[++y]=fe.z,l[++y]=ye.x,l[++y]=ye.y,l[++y]=ye.z,p+=6,f[++A]=p-6,f[++A]=p-8,f[++A]=p-7,f[++A]=p-6,f[++A]=p-7,f[++A]=p-5,f[++A]=p-6,f[++A]=p-5,f[++A]=p-3,f[++A]=p-2,f[++A]=p-3,f[++A]=p-1,u+=12);for(let t=0;t<6;t++)h[++v]=a.x,h[++v]=a.y,h[++v]=a.z;c[++m]=n-d,c[++m]=0,c[++m]=n-d,c[++m]=1,c[++m]=n,c[++m]=0,c[++m]=n,c[++m]=1,c[++m]=n+d,c[++m]=0,c[++m]=n+d,c[++m]=1}else l[++y]=fe.x,l[++y]=fe.y,l[++y]=fe.z,l[++y]=ce.x,l[++y]=ce.y,l[++y]=ce.z,h[++v]=a.x,h[++v]=a.y,h[++v]=a.z,h[++v]=a.x,h[++v]=a.y,h[++v]=a.z,c[++m]=n,c[++m]=0,c[++m]=n,c[++m]=1,p+=2,e||(f[++A]=p-2,f[++A]=p-4,f[++A]=p-3,f[++A]=p-2,f[++A]=p-3,f[++A]=p-1,u+=6)}if(a>0)for(let e=0;e<t.count;e++){const r=t.array[e];if(r.dist>a){const n=t.array[e-1];g=new $t;const i=(a-n.dist)/(r.dist-n.dist);g.lerpPathPoints(n,r,i),_(g);break}_(r)}else g=t.array[0];return{position:l,normal:h,uv:c,indices:f,count:u}}(n,e);return{position:new Float32Array(i.position),indices:new Uint32Array(i.indices),uv:new Float32Array(i.uv),normal:new Float32Array(i.normal),line:t,count:i.count}})),n=Ut(r);return n.lines=t,n}function me(t,e,r={}){return void 0===r[t]&&(r[t]=e.distanceToVector3(t,t).x),r[t]}function Ae(t,e,r={}){return void 0===r[t]&&(r[t]=e.altitudeToVector3(t,t).x),r[t]}function _e(t=[]){let e=0,r=0;const i=t.length;for(let o=0;o<i;o++){const{coordinate:i,lnglat:s,lnglats:a,xy:u,xys:l}=t[o],h=i||s||a||u||l||t[o];let c,f;Array.isArray(h)?(c=h[0],f=h[1]):h instanceof n.Coordinate&&(c=h.x,f=h.y),e+=c,r+=f}return new n.Coordinate(e/i,r/i)}function xe(t,e,r,n){if(void 0===e||"number"!=typeof e||0===e)return 0;let o;o=t instanceof i.BufferGeometry?t.attributes.position.array:Array.isArray(t)||t instanceof Float32Array?t:t.position;let s=0;if(o){n?(void 0===n[e]&&(n[e]=r.altitudeToVector3(e,e).x),s=n[e]):s=r.altitudeToVector3(e,e).x;const t=o.length;if(o[0]instanceof i.Vector3)for(let e=0;e<t;e++)o[e].z+=s;else for(let e=0;e<t;e+=3)o[e+2]+=s}return s}function we(t){const e=t.length;let r=0;for(let n=0;n<e;n++){const{count:e}=t[n].position;r+=e}return new Float32Array(3*r)}new Lt(0,0,1),new Lt;const be=new i.Vector3,Ee=new Map;function Ie(t=[],e){const r=t.length,n=!!e,i=n?3:2,o=new Float64Array(r*i);Ee.clear();for(let s=0;s<r;s++){let r,a;const u=t[s];let l;if(u.x?(r=u.x,a=u.y,l=u.z):(r=u[0],a=u[1],l=u[2]),o[s*i]=r,o[s*i+1]=a,l=l||0,n&&0!==l){if(!Ee.has(l)){const t=e.altitudeToVector3(l,l,null,be).x;Ee.set(l,t)}o[s*i+2]=Ee.get(l)}}return o.buffer}function Ce(t){return(J(t)?t.properties:t.getProperties())||{}}function Se(t){return(K(t)?t.properties:t.getProperties())||{}}const Me=new i.Color("#fff"),Be=new i.Color("#fff");function Te(t,e,r,n,i,o,s){const a=Pe(t,n,i,o,!1);if(!a)return null;s?(null==s[e]&&(s[e]=n.altitudeToVector3(e,e).x),e=s[e]):e=n.altitudeToVector3(e,e).x;const{position:u,normal:l,uv:h,indices:c}=jt(a,{depth:e,top:r});return{position:u,normal:l,uv:h,indices:c}}function ke(t,e,r,n){void 0===n&&(n=0);const o=t.attributes.position.array,s=o.length;let a;if(Be.setStyle(e),Me.setStyle(r),Array.isArray(n)){let t=0;for(let e=0,r=n.length;e<r;e++){const{count:r}=n[e].position;t+=3*r}a=new Float32Array(t)}else a=new Float32Array(o.length);if(Array.isArray(n))for(let t=0,e=n.length;t<e;t++){const{middleZ:e,start:r,end:i}=n[t].position;for(let t=r;t<i;t+=3){o[t+2]>e?(a[t]=Me.r,a[t+1]=Me.g,a[t+2]=Me.b):(a[t]=Be.r,a[t+1]=Be.g,a[t+2]=Be.b)}}else for(let t=0;t<s;t+=3){o[t+2]>n?(a[t]=Me.r,a[t+1]=Me.g,a[t+2]=Me.b):(a[t]=Be.r,a[t+1]=Be.g,a[t+2]=Be.b)}return L(t,"color",new i.BufferAttribute(a,3,!0)),a}function Pe(t,e,r,i,o=!1){if(!t)return null;let s=[];if(t instanceof n.MultiPolygon)s=t.getGeometries().map((n=>Le(n,e,r||t.getCenter(),i,o)));else if(t instanceof n.Polygon){const n=Le(t,e,r||t.getCenter(),i,o);s.push(n)}else if(J(t))if($(t)){const n=rt(t);for(let a=0,u=n.length;a<u;a++)s.push(Le(n[a],e,r||et(t),i,o))}else{const n=Le(t,e,r||et(t),i,o);s.push(n)}return s}function Le(t,e,r,i,o=!1){let s,a,u;if(J(t)){const e=tt(t);s=e[0],a=e.slice(1,e.length),r=r||et(t)}else t instanceof n.Polygon&&(s=t.getShell(),a=t.getHoles(),r=r||t.getCenter());i=i||e.coordinateToVector3(r),u=o?e.coordinatiesToGLFloatArray(s,i).positons2d:e.coordinatiesToGLArray(s,i);const l=[o?u.buffer:u];if(a&&a.length>0)for(let t=0,r=a.length;t<r;t++){let r;r=o?e.coordinatiesToGLFloatArray(a[t],i).positons2d:e.coordinatiesToGLArray(a[t],i),l.push(o?r.buffer:r)}return l}function Re(t){if(!t)return null;let e=[];if(t instanceof n.MultiPolygon)e=t.getGeometries().map((t=>De(t,!1)));else if(t instanceof n.Polygon){const r=De(t,!1);e.push(r)}else if(J(t))if($(t)){const r=rt(t);for(let t=0,n=r.length;t<n;t++)e.push(De(r[t],!0))}else{const r=De(t,!0);e.push(r)}return e}function De(t,e){let r,i;if(e){const e=tt(t);r=e[0],i=e.slice(1,e.length)}else t instanceof n.Polygon&&(r=t.getShell(),i=t.getHoles());const o=[Ie(r)];if(i&&i.length>0)for(let t=0,e=i.length;t<e;t++){const e=Ie(i[t]);o.push(e)}return o}const Oe=new Map,Ne=new i.Vector3;function Fe(t,e,r,o=!0){let s,a,u=[];if(Array.isArray(t)&&t[0]instanceof i.Vector3)u=t;else{Array.isArray(t)&&(t=new n.LineString(t));const i=0;let l,h;X(t)?(l=tt(t),r||(h=et(t))):t instanceof n.LineString&&(l=t.getCoordinates(),r||(h=t.getCenter()));const c=e.coordinateToVector3(r||h);if(o){Oe.clear();for(let t=0,r=l.length;t<r;t++){const r=l[t],n=r.z||r[2]||0;if(!Oe.has(n)){const t=e.altitudeToVector3(n,n,null,Ne).x;Oe.set(n,t)}const o=e.coordinateToVector3(r,i).sub(c);o.z+=Oe.get(n)||0,u.push(o)}}else{const t=e.coordinatiesToGLFloatArray(l,c,!0);s=t.positions,a=t.positons2d}}if(!o)return{positions:s,positionsV:u,positions2d:a,arrayBuffer:s.buffer};a=new Float32Array(2*u.length),s=new Float32Array(3*u.length);for(let t=0,e=u.length;t<e;t++){const e=3*t,r=u[t];s[e]=r.x,s[e+1]=r.y,s[e+2]=r.z;const n=2*t;a[n]=r.x,a[n+1]=r.y}return{positions:s,positionsV:u,positions2d:a,arrayBuffer:s.buffer}}function Ue(t,e,r,n){const i=[],o=[],s=[];let a,u;for(let r=0,l=t.length;r<l;r++){const l=t[r];for(let t=0,r=l.length;t<r;t++){const r=l[t],h=r.join(",").toString();a?(h!==a&&(u=e.coordinateToVector3(r,0).sub(n),i.push(u.x,u.y,u.z),o.push(u),s.push(r)),a=h):(s.push(r),a=h,u=e.coordinateToVector3(r,0).sub(n),i.push(u.x,u.y,u.z),o.push(u))}}return{positions:i,positionsV:o,lnglats:s}}function Qe(t){let e;const r=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];for(let t=0,n=i.length;t<n;t++){const n=i[t],o=n.join(",").toString();e?(o!==e&&r.push(n),e=o):(r.push(n),e=o)}}return r}function Ge(t,e=1,r=1,n=!1,i,o){const s=Fe(t,i,o).positionsV,a=[];for(let t=0,e=s.length;t<e;t++){const e=s[t];a.push([e.x,e.y,e.z])}const{indices:u,position:l,normal:h,uv:c}=Ht([a],{lineWidth:e,depth:r,pathUV:n});return{position:l,normal:h,indices:u,uv:c}}function ze(t,e=1,r=1,n,i){const o=Fe(t,n,i).positionsV,s=[];for(let t=0,e=o.length;t<e;t++){const e=o[t];s.push([e.x,e.y,e.z])}const{indices:a,position:u,normal:l,uv:h}=ve([s],{lineWidth:e,cornerRadius:r});return{position:u,normal:l,indices:a,uv:h}}function je(t){let e,r=[];return t instanceof n.MultiLineString?(r=t.getGeometries(),e=t.getCenter()):t instanceof n.LineString?(r.push(t),e=t.getCenter()):X(t)&&(e=et(t),$(t)?r=rt(t):r.push(t)),{lineStrings:r,center:e}}function Ve(t){const e=new Float32Array(2*t.length-6);let r=0;for(let n=0,i=t.length/3;n<i;n++){const o=t[3*n],s=t[3*n+1],a=t[3*n+2];if(n>0&&n<i-1){const t=3*r;e[t]=o,e[t+1]=s,e[t+2]=a,r++}const u=3*r;e[u]=o,e[u+1]=s,e[u+2]=a,r++}return e}function qe(t){let e=0;const r=t.length;if(1===r)return t[0];for(let n=0;n<r;n++)e+=t[n].length;const n=new Float32Array(e);let i=0;for(let e=0;e<r;e++)n.set(t[e],i),i+=t[e].length;return n}function He(t,e){return t instanceof n.LineString?Ie(t.getCoordinates(),e):K(t)?Ie(t.geometry.coordinates,e):void 0}let We;function Ye(){return We||(We=new i.BufferGeometry,L(We,"position",new i.BufferAttribute(new Float32Array(3),3))),We}let Xe;var Je;function Ke(){return n.worker||console.error("maptalks.worker is not defined,You can't use ThreeVectorTileLayer"),!Je&&Xe&&(Je=new Xe("__maptalks.three__")),Je}function Ze(t,e,r={}){return void 0!==t&&"number"==typeof t&&0!==t?(void 0===r[t]&&(r[t]=e.distanceToVector3(t,t).x),r[t]):0}function $e(t,e,r={}){return void 0!==t&&"number"==typeof t&&0!==t?(void 0===r[t]&&(r[t]=e.altitudeToVector3(t,t).x),r[t]):0}function tr(t,e){return e?Object.assign({},e,t):t||{}}function er(t,e,r,n,i=[],o){const s=r.isMercator();let a,u,l;if(s){const t=r.getMap();a=t.getGLRes(),u=t.getSpatialReference().getTransformation().matrix}e&&(l=r.coordinateToVector3(e));const h=[],c=[],f={},p={},d=t.length;for(let a=0;a<d;a++){const u=t[a];let d=i[a]?i[a]:Se(n[a]);d=tr(d,o),e||(l=r.coordinateToVector3(d.center));let g=d.width||1,y=d.height||1,v=d.cornerRadius||0,m=d.bottomHeight||0;const A=d.pathUV,_=d.parentCenter;g=Ze(g,r,f),v=Ze(v,r,f),y=$e(y,r,p),m=$e(m,r,p);const x=[];for(let t=0,n=u.length;t<n;t++){const n=u[t];let i;i=s?He(n,r):Fe(n,r,_||e,!1).arrayBuffer,c.push(i),x.push(i)}const w={id:d.id,data:x,height:y,width:g,cornerRadius:v,bottomHeight:m,pathUV:A};s&&(w.center=[l.x,l.y]),h.push(w)}return{datas:h,transfer:c,glRes:a,matrix:u,center:s?[l.x,l.y]:null}}function rr(t,e,r,n,i=[],o){const s=r.isMercator();let a,u,l;if(s){const t=r.getMap();a=t.getGLRes(),u=t.getSpatialReference().getTransformation().matrix}e&&(l=r.coordinateToVector3(e));const h=[],c=[],f={},p=t.length;for(let a=0;a<p;a++){const u=t[a];let p=i[a]?i[a]:Se(n[a]);p=tr(p,o),e||(l=r.coordinateToVector3(p.center));let d=p.bottomHeight||0;d=$e(d,r,f);const g=[];for(let t=0,n=u.length;t<n;t++){const n=u[t];if(s){const t=He(n,r);c.push(t),g.push(t)}else{const t=Fe(n,r,e,!1).arrayBuffer;c.push(t),g.push(t)}}const y={id:p.id,data:g,bottomHeight:d};s&&(y.center=[l.x,l.y]),h.push(y)}return{datas:h,transfer:c,glRes:a,matrix:u,center:s?[l.x,l.y]:null}}function nr(t){return t.map((t=>t.data))}function ir(t){return t.map((t=>t.option||t.baseObject.getOptions()))}n.worker&&(Xe=class extends n.worker.Actor{test(t,e){this.send(t,null,e)}pushQueue(t={}){const{type:e,data:r,callback:n,layer:i,key:o,center:s,lineStrings:a,options:u,id:l,baseOptions:h}=t;let c;e.indexOf("ExtrudePolygon")>-1?c=function(t=[],e,r,n=[],i){const o=r.isMercator();let s,a,u;if(o){const t=r.getMap();s=t.getGLRes(),a=t.getSpatialReference().getTransformation().matrix}e&&(u=r.coordinateToVector3(e));const l=t.length,h=[],c=[],f={};for(let s=0;s<l;s++){const a=t[s],l=a;let p,d=n[s]?n[s]:Ce(l);d=tr(d,i),e||(u=r.coordinateToVector3(d.center)),p=o?Re(a):Pe(a,r,d.center||e,u,!0);for(let t=0,e=p.length;t<e;t++){const e=p[t];for(let t=0,r=e.length;t<r;t++)c.push(e[t])}let g=d.height||1,y=d.bottomHeight||0;const v=d.top;g=$e(g,r,f),y=$e(y,r,f);const m={id:d.id,data:p,height:g,bottomHeight:y,top:v};o&&(m.center=[u.x,u.y]),h.push(m),l._properties&&delete l._properties}return{datas:h,transfer:c,glRes:s,matrix:a,center:o?[u.x,u.y]:null}}(r,s,i,u,h):"ExtrudeLines"===e||"Paths"===e?c=er(r,s,i,a,u,h):"Point"===e||("Line"===e||"FatLine"===e||"Lines"===e||"FatLines"===e?c=rr(r,s,i,a,u,h):"ExtrudeLine"===e||"Path"===e?c=er(r,s,i,a,u,h):"Bar"!==e&&"Bars"!==e||(c=function(t){const e=t.length,r=new Float32Array(7*e);let n=0;for(let i=0;i<e;i++){let{center:e,radialSegments:o,radius:s,height:a,altitude:u,id:l}=t[i];e=e||[0,0],r[n]=e[0],r[n+1]=e[1],r[n+2]=o||6,r[n+3]=s||1,r[n+4]=a,r[n+5]=u||0,r[n+6]=l,n+=7}const i=r.buffer;return{datas:i,transfer:[i]}}(r))),c?this.send({type:e,datas:c.datas,glRes:c.glRes,matrix:c.matrix,center:c.center},c.transfer,(function(t,e){t&&console.error(t),e.key=o,e.id=l,n(e)})):console.error(`No processing logic found for type:${e}`)}});class or{constructor(){this.queueMap={},this.tempQueue=[],this.time=this.getCurrentTime(),this.deQueueCount=5,this.resultQueue=[]}getActor(){return Ke()}getCurrentTime(){return n.Util.now()}loop(){this.deQueue()}push(t){return this.tempQueue.push(t),t.id&&(this.queueMap[t.id]=t),this}reset(){return this.time=this.getCurrentTime(),this.tempQueue=[],this}pushResult(t){if(t)return Array.isArray(t)||(t=[t]),t.forEach((t=>{this.resultQueue.push(t)})),this}deQueue(){if(!this.resultQueue.length)return this;const t=this.deQueueCount;return(this.resultQueue.slice(0,t)||[]).forEach((t=>{const{id:e}=t;if(this.queueMap[e]){const{baseObject:r}=this.queueMap[e];if(r&&r._workerLoad){r.getLayer()?r._workerLoad(t):console.warn(r," worker Processing completed but removed from the layer")}delete this.queueMap[e]}})),this.resultQueue.splice(0,t),this}}const sr=new class extends or{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){Ke().pushQueue({type:"ExtrudePolygon",layer:this.tempQueue[0].layer,data:nr(this.tempQueue),options:ir(this.tempQueue),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},ar=new class extends or{loop(){if(this.tempQueue.length){const t=Ke();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"ExtrudePolygons",layer:e.layer,data:e.data,key:e.key,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},ur=new class extends or{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){Ke().pushQueue({type:"ExtrudeLine",layer:this.tempQueue[0].layer,data:nr(this.tempQueue),options:ir(this.tempQueue),lineStrings:this.tempQueue.map((t=>t.lineString)),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},lr=new class extends or{loop(){if(this.tempQueue.length){const t=Ke();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"ExtrudeLines",layer:e.layer,data:e.data,key:e.key,lineStrings:e.lineStrings,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},hr=new class extends or{constructor(){super(),this.deQueueCount=200}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){Ke().pushQueue({type:"Line",layer:this.tempQueue[0].layer,data:nr(this.tempQueue),options:ir(this.tempQueue),lineStrings:this.tempQueue.map((t=>t.lineString)),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},cr=new class extends or{loop(){if(this.tempQueue.length){const t=Ke();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"Lines",layer:e.layer,data:e.data,key:e.key,lineStrings:e.lineStrings,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},fr=new class extends or{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){Ke().pushQueue({type:"FatLine",layer:this.tempQueue[0].layer,data:nr(this.tempQueue),options:ir(this.tempQueue),lineStrings:this.tempQueue.map((t=>t.lineString)),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},pr=new class extends or{loop(){if(this.tempQueue.length){const t=Ke();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"FatLines",layer:e.layer,data:e.data,key:e.key,lineStrings:e.lineStrings,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},dr=new class extends or{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){Ke().pushQueue({type:"Bar",layer:this.tempQueue[0].layer,data:nr(this.tempQueue),options:ir(this.tempQueue),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},gr=new class extends or{constructor(){super(),this.deQueueCount=1}loop(){if(this.tempQueue.length){const t=Ke();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"Bars",layer:e.layer,data:e.data,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},yr=new class extends or{constructor(){super(),this.deQueueCount=100}loop(){if((this.getCurrentTime()-this.time>=32||this.tempQueue.length>=1e3)&&this.tempQueue.length){Ke().pushQueue({type:"Path",layer:this.tempQueue[0].layer,data:nr(this.tempQueue),options:ir(this.tempQueue),lineStrings:this.tempQueue.map((t=>t.lineString)),callback:t=>{this.pushResult(t)}}),this.reset()}super.loop()}},vr=new class extends or{loop(){if(this.tempQueue.length){const t=Ke();this.tempQueue.forEach((e=>{t.pushQueue({id:e.id,type:"Paths",layer:e.layer,data:e.data,key:e.key,lineStrings:e.lineStrings,center:e.center,baseOptions:e.option,callback:t=>{this.pushResult(t)}})})),this.reset()}super.loop()}},mr={isRunning:!1,tasks:[],addTask:t=>{t&&mr.tasks.push(t)},removeTask:t=>{const e=mr.tasks.indexOf(t);e>-1&&mr.tasks.splice(e,1)},loop(){sr.loop(),ar.loop(),ur.loop(),lr.loop(),hr.loop(),cr.loop(),fr.loop(),pr.loop(),dr.loop(),gr.loop(),yr.loop(),vr.loop(),mr.tasks.forEach((t=>{t&&t.loop&&t.loop()})),requestAnimationFrame(mr.loop)},star(){mr.isRunning||(mr.isRunning=!0,mr.loop())}};function Ar(t){const{position:e,normal:r,uv:n,indices:o}=_r(t),s=new i.BufferGeometry,a=new Float32Array(e.length);return a.fill(1,0,e.length),L(s,"color",new i.BufferAttribute(a,3)),L(s,"normal",new i.BufferAttribute(r,3)),L(s,"position",new i.BufferAttribute(e,3)),n&&n.length&&L(s,"uv",new i.BufferAttribute(n,2)),s.setIndex(new i.BufferAttribute(o,1)),s}function _r(t){const e={},r={};for(let n=0;n<t.length;++n){const i=t[n];for(const t in i)void 0===e[t]&&(e[t]=[],r[t]=0),e[t].push(i[t]),r[t]+=i[t].length}const n={};let i=0;const o=new Uint32Array(r.indices);for(const t in e)if("indices"===t){const r=e[t];let n=0;for(let t=0,s=r.length;t<s;t++){const s=r[t];for(let t=0,e=s.length;t<e;t++)o[n]=s[t]+i,n++;i+=e.position[t].length/3}}else{const i=xr(e[t],r[t]);if(!i)return null;n[t]=i}return n.indices=o,n}function xr(t,e){const r=new Float32Array(e);let n=0;for(let e=0;e<t.length;++e)r.set(t[e],n),n+=t[e].length;return r}function wr(t){const{position:e,normal:r,uv:n,indices:o}=t,s=new i.BufferGeometry;return L(s,"normal",new i.BufferAttribute(new Float32Array(r),3)),L(s,"position",new i.BufferAttribute(new Float32Array(e),3)),L(s,"uv",new i.BufferAttribute(new Float32Array(n),2)),s.setIndex(new i.BufferAttribute(new Uint32Array(o),1)),s}function br(t){const e=new i.BufferGeometry;return L(e,"normal",t.getAttribute("normal")),L(e,"position",t.getAttribute("position").clone()),e.setIndex(t.getIndex()),e}let Er;function Ir(){if(!Er){const t=1e-6;Er=O(t,t,t)}return Er}Ir();const Cr=O(1,1,1);Cr.translate(0,0,.5);const Sr=new i.Color("#fff"),Mr=new i.Color("#fff");function Br(t){const{position:e,normal:r,uv:n,indices:o}=function(t,e){e=Object.assign({},{radius:1,height:2,radialSegments:6},e);const r=Math.round(Math.max(4,e.radialSegments));let{radius:n,height:i}=e;const o=360/r/360*Math.PI*2,s=r+1,a=new Float32Array(3*s*2),[u,l]=t;let h=0,c=0;const f=3*s,p=2*s,d=[],g=[];let y=d.length-1;for(let t=-1;t<r;t++){const e=o*t,r=Math.cos(e)*n+u,s=Math.sin(e)*n+l;a[h]=r,a[h+1]=s,a[h+2]=0,a[h+f]=r,a[h+1+f]=s,a[h+2+f]=i;let v=0,m=0;v=.5+r/n/2,m=.5+s/n/2,g[c]=v,g[c+1]=m,g[c+p]=v,g[c+1+p]=m,h+=3,c+=2,t>1&&(d[++y]=0,d[++y]=t-1,d[++y]=t)}h-=3,a[h]=a[0],a[h+1]=a[1],a[h+2]=a[2];const v=a.length;a[v-3]=a[0],a[v-2]=a[1],a[v-1]=i;const m=d.length;y=d.length-1;for(let t=0;t<m;t++){const e=d[t];d[++y]=e+s}const A=new Float32Array(2*(3*s*2-6));let _=-1;h=2*s,c=0,y=d.length-1;let x=g.length-1;for(let t=0,e=a.length/2;t<e-3;t+=3){const e=a[t],r=a[t+1],o=a[t+3],u=a[t+4];A[++_]=e,A[++_]=r,A[++_]=i,A[++_]=o,A[++_]=u,A[++_]=i,A[++_]=e,A[++_]=r,A[++_]=0,A[++_]=o,A[++_]=u,A[++_]=0;const l=h+2,f=h+3,p=h,v=h+1;d[++y]=p,d[++y]=l,d[++y]=v,d[++y]=l,d[++y]=f,d[++y]=v,h+=4;const m=c/s,w=(c+1)/s;g[++x]=m,g[++x]=i/n/2,g[++x]=w,g[++x]=i/n/2,g[++x]=m,g[++x]=0,g[++x]=w,g[++x]=0,c++}const w=new Float32Array(a.length+A.length);w.set(a,0),w.set(A,a.length);const b=Ft(d,w);return{points:a,indices:new Uint32Array(d),position:w,normal:b,uv:new Float32Array(g)}}(t.center||[0,0],t),s=new i.BufferGeometry;return L(s,"normal",new i.BufferAttribute(r,3)),L(s,"position",new i.BufferAttribute(e,3)),L(s,"uv",new i.BufferAttribute(n,2)),s.setIndex(new i.BufferAttribute(o,1)),s}function Tr(t){const e=Object.assign({},t);return e._radius&&(e.radius=e._radius),Br(e)}function kr(t,e,r,n="y",o=0){let s=0;"y"===n?s=1:"z"===n&&(s=2);const a=t.attributes.position.array,u=a.length;Mr.setStyle(e),Sr.setStyle(r);const l=new Float32Array(u);if(Array.isArray(o))for(let t=0,e=o.length;t<e;t++){const{middleZ:e,start:r,end:n}=o[t].position;for(let t=r;t<n;t+=3){a[t+2]>e?(l[t]=Sr.r,l[t+1]=Sr.g,l[t+2]=Sr.b):(l[t]=Mr.r,l[t+1]=Mr.g,l[t+2]=Mr.b)}}else for(let t=0;t<u;t+=3){a[t+s]>o?(l[t]=Sr.r,l[t+1]=Sr.g,l[t+2]=Sr.b):(l[t]=Mr.r,l[t+1]=Mr.g,l[t+2]=Mr.b)}return L(t,"color",new i.BufferAttribute(l,3,!0)),l}function Pr(t){const e=[],r=t.length;let n=0;for(let e=0;e<r;e++){const{color:r}=t[e].attributes;r&&(n+=r.array.length)}const o=new Float32Array(n);let s=0;for(let r=0,n=t.length;r<n;r++){const{color:n,normal:i,position:a,uv:u}=t[r].attributes,l=t[r].index;n&&(o.set(n.array,s),s+=n.array.length),e.push({normal:i.array,uv:u.array,position:a.array,indices:l.array})}const a=Ar(e);o.length&&L(a,"color",new i.BufferAttribute(o,3,!0));for(let e=0,r=t.length;e<r;e++)t[e].dispose();return a}function Lr(){return Cr}const Rr={radius:10,height:100,radialSegments:6,altitude:0,topColor:"",bottomColor:"#2d2f61",heightEnable:!0};class Dr extends H{constructor(t,e,r,i){e=n.Util.extend({},Rr,e,{layer:i,coordinate:t}),super(),this._initOptions(e);const{height:o,radius:s,topColor:a,bottomColor:u,altitude:l,asynchronous:h}=e;let c;if(e.height=i.altitudeToVector3(o,o).x,e.radius=i.distanceToVector3(s,s).x,h){c=Ir();const t=n.Util.GUID();this.getOptions().id=t,dr.push({data:{radius:e.radius,height:e.height,radialSegments:e.radialSegments,id:t},layer:i,id:t,baseObject:this})}else c=Tr(e),a&&(kr(c,u,a,"z",e.height/2),r.vertexColors=D());this._createMesh(c,r);const f=i.altitudeToVector3(l,l).x,p=i.coordinateToVector3(t,f);this.getObject3d().position.copy(p),this.type="Bar"}_workerLoad(t){const e=wr(t),{topColor:r,bottomColor:n,height:i}=this.getOptions(),o=this.getObject3d(),s=o.material;if(r){kr(e,n,r,"z",this.getLayer().altitudeToVector3(i,i).x/2),s.vertexColors=D()}o.geometry=e,o.material.needsUpdate=!0,this._fire("workerload",{target:this})}}function Or(t){const e=[];return t&&t.length&&t.forEach((t=>{t=t instanceof i.Color?t:new i.Color(t),e.push(t.r,t.g,t.b)})),e}const Nr={altitude:0,bottomHeight:0,colors:null};class Fr extends H{constructor(t,e,r,o){e=n.Util.extend({},Nr,e,{layer:o,lineString:t}),super(),this._initOptions(e);const{lineStrings:s,center:a}=je(t),{asynchronous:u}=e;let l;if(u){l=Ye();const r=n.Util.GUID();this.getOptions().id=r,this.getOptions().center=a,hr.push({id:r,data:s,layer:o,key:e.key,lineString:t,baseObject:this})}else{const t=[];for(let e=0,r=s.length;e<r;e++){const r=s[e],{positions:n}=Fe(r,o,a,!1);t.push(Ve(n))}const n=qe(t);l=new i.BufferGeometry,L(l,"position",new i.BufferAttribute(n,3)),xe(l,e.bottomHeight,o);const u=Or(e.colors);u&&u.length&&(L(l,"color",new i.Float32BufferAttribute(u,3)),r.vertexColors=D())}this._createLineSegments(l,r);const{altitude:h}=e,c=o.altitudeToVector3(h,h).x,f=o.coordinateToVector3(a,c);this.getObject3d().position.copy(f),this.type="Line"}_workerLoad(t){const e=new i.BufferGeometry;L(e,"position",new i.BufferAttribute(new Float32Array(t.position),3));const r=Or(this.getOptions().colors),n=this.getObject3d(),o=n.material;r&&r.length&&(L(e,"color",new i.Float32BufferAttribute(r,3)),o.vertexColors=D()),this._computeLineDistances(e),n.geometry=e,n.material.needsUpdate=!0,this._fire("workerload",{target:this})}}const Ur={bottomHeight:0,width:3,height:1,altitude:0,topColor:null,bottomColor:"#2d2f61",heightEnable:!0,pathUV:!1};class Qr extends H{constructor(t,e,r,i){e=n.Util.extend({},Ur,e,{layer:i,lineString:t}),super(),this._initOptions(e);const{height:o,width:s,bottomColor:a,topColor:u,bottomHeight:l,altitude:h,asynchronous:c,pathUV:f}=e,p=i.altitudeToVector3(o,o).x,d=i.distanceToVector3(s,s).x,{lineStrings:g,center:y}=je(t);let v;if(c){v=Ir();const e=n.Util.GUID();this.getOptions().id=e,this.getOptions().center=y,ur.push({id:e,data:g,layer:i,center:y,lineString:t,baseObject:this})}else{const t=[];let e=0;const n={};for(let r=0,o=g.length;r<o;r++){const o=Ge(g[r],d,p,f,i,y);e=xe(o,l,i,n),t.push(o)}v=Ar(t),u&&(ke(v,a,u,e+p/2),r.vertexColors=D())}this._createMesh(v,r);const m=i.altitudeToVector3(h,h).x,A=i.coordinateToVector3(y,m);this.getObject3d().position.copy(A),this.type="ExtrudeLine"}_workerLoad(t){const e=wr(t),{topColor:r,bottomColor:n,bottomHeight:i,height:o}=this.getOptions(),s=this.getObject3d(),a=s.material;if(r){const t=this.getLayer();ke(e,n,r,t.altitudeToVector3(i,i).x+t.altitudeToVector3(o,o).x/2),a.vertexColors=D()}s.geometry=e,s.material.needsUpdate=!0,this._fire("workerload",{target:this})}}const Gr={altitude:0,height:1,bottomHeight:0,topColor:null,bottomColor:"#2d2f61",heightEnable:!0,top:!0};class zr extends H{constructor(t,e,r,o){e=n.Util.extend({},Gr,e,{layer:o,polygon:t}),super(),this._initOptions(e);const{height:s,topColor:a,bottomColor:u,altitude:l,bottomHeight:h,asynchronous:c,top:f}=e;let p;const d=J(t)?et(t):t.getCenter();if(c){p=Ir();const e=n.Util.GUID();this.getOptions().id=e,this.getOptions().center=d,sr.push({data:t,layer:o,id:e,baseObject:this})}else{p=function(t,e,r,n,o){const{position:s,normal:a,uv:u,indices:l}=Te(t,e,r,n,o),h=new Float32Array(s.length);h.fill(1,0,s.length);const c=new i.BufferGeometry;return L(c,"color",new i.BufferAttribute(h,3)),L(c,"normal",new i.BufferAttribute(a,3)),L(c,"position",new i.BufferAttribute(s,3)),L(c,"uv",new i.BufferAttribute(u,2)),c.setIndex(new i.BufferAttribute(l,1)),c}(t,s,f,o);const e=xe(p,h,o);if(a){ke(p,u,a,e+o.altitudeToVector3(s,s).x/2),r.vertexColors=D()}}this._createMesh(p,r);const g=o.altitudeToVector3(l,l).x,y=o.coordinateToVector3(d,g);this.getObject3d().position.copy(y),this.type="ExtrudePolygon"}_workerLoad(t){const e=wr(t),{topColor:r,bottomColor:n,bottomHeight:i,height:o}=this.getOptions(),s=this.getObject3d(),a=s.material;if(r){const t=this.getLayer();ke(e,n,r,t.altitudeToVector3(i,i).x+t.altitudeToVector3(o,o).x/2),a.vertexColors=D()}s.geometry=e,s.material.needsUpdate=!0,this._fire("workerload",{target:this})}}const jr={altitude:0,coordinate:null};class Vr extends H{constructor(t,e={},r){e.coordinate||(console.warn("coordinate is null,it is important to locate the model"),e.coordinate=r.getMap().getCenter()),e=n.Util.extend({},jr,e,{layer:r,model:t}),super(),this._initOptions(e),this._createGroup(),this.getObject3d().add(t);const{altitude:i,coordinate:o}=e,s=r.altitudeToVector3(i,i).x,a=r.coordinateToVector3(o,s);this.getObject3d().position.copy(a),this.type="Model"}getCoordinates(){const t=this.options.coordinate,e=this.options.altitude,r=new n.Coordinate(t);return r.z=e,r}}const qr=Math.PI/180;function Hr(t){return t*qr}function Wr(t,e){if(!t||!e)return 0;Array.isArray(t)||(t=t.toArray()),Array.isArray(e)||(e=e.toArray());let r=Hr(t[1]);const n=Hr(e[1]),i=r-n,o=Hr(t[0])-Hr(e[0]);return r=2*Math.asin(Math.sqrt(Math.pow(Math.sin(i/2),2)+Math.cos(r)*Math.cos(n)*Math.pow(Math.sin(o/2),2))),r*=6378137,Math.round(1e5*r)/1e5}function Yr(t,e){const{len:r,c1:n,c2:i}=t,o=i[0]-n[0],s=i[1]-n[1],a=e/r;return[n[0]+a*o,n[1]+a*s]}const Xr=1e3;const Jr={trail:5,chunkLength:50,width:2,height:1,speed:1,altitude:0,interactive:!1,heightEnable:!0,pathUV:!1};class Kr extends H{constructor(t,e,r,o){e=n.Util.extend({},Jr,e,{layer:o,lineString:t}),super(),this._initOptions(e);const{width:s,height:a,altitude:u,speed:l,chunkLength:h,trail:c,pathUV:f}=e;let p,d;X(t)?(p=et(t),d=tt(t)):(p=t.getCenter(),d=t);const g=function(t,e=10){e=Math.max(e,.1),Array.isArray(t)||(t=t.getCoordinates().map((t=>t.toArray())));const r=t.length;let n=[],i=0;for(let e=0;e<r-1;e++){const r=Wr(t[e],t[e+1]),o=Math.floor(r);n.push({c1:t[e],len:o,c2:t[e+1]}),i+=o}if(i<=e)return n.map((t=>[t.c1,t.c2]));if(1===n.length&&n[0].len<=e)return[[n[0].c1,n[0].c2]];const o=n.length;let s,a=0,u=0;const l=[];let h=[n[0].c1];for(;a<o;){const{len:t,c2:r}=n[a];if(u+=t,u<e&&(h.push(r),a===o-1&&l.push(h),a++),u===e&&(h.push(r),u=0,l.push(h),h=[r],a++),u>e){const r=t-u+e;s=Yr(n[a],r),h.push(s),l.push(h),u=0,n[a].c1=s,n[a].len=t-r,h=[],h.push(s)}}return l}(d,h),y=o.coordinateToVector3(p),v=new i.BufferGeometry,m=new Float32Array(3e3),A=new Float32Array(3e3),_=new Uint16Array(Xr);L(v,"position",new i.BufferAttribute(m,3)),L(v,"normal",new i.BufferAttribute(A,3)),v.setIndex(new i.BufferAttribute(_,1));const x=o.distanceToVector3(s,s).x,w=o.altitudeToVector3(a,a).x;this._createMesh(v,r);const b=o.altitudeToVector3(u,u).x,E=o.coordinateToVector3(p,b);this.getObject3d().position.copy(E),this._params={index:0,chunkLines:g,geometries:[],layer:o,trail:Math.max(1,c),lineWidth:x,depth:w,speed:Math.min(1,l),idx:0,loaded:!0,center:p,centerPt:y,workerInitCount:0,pathUV:f},this._init(this._params),this.type="ExtrudeLineTrail"}_init(t){const{layer:e,trail:r,lineWidth:i,depth:o,chunkLines:s,positionMap:a,centerPt:u,center:l,pathUV:h}=t,c=s.length,f=[];if(this.options.asynchronous){t.loaded=!1;const i=n.Util.GUID();for(let t=0;t<c;t++){const o={type:"Feature",geometry:{type:"LineString",coordinates:Qe(s.slice(t,t+r))}},a=`${i}-${t}`,u=n.Util.extend({},this.options);u.parentCenter=l,u.id=a,u.center=l,ur.push({id:a,data:[o],layer:e,center:l,lineString:o,baseObject:this,option:u})}}else for(let t=0;t<c;t++){const n=Ue(s.slice(t,t+r),e,0,u).positionsV;f.push(Ge(n,i,o,h,e))}}_animation(){const{index:t,geometries:e,speed:r,idx:n,chunkLines:i,trail:o,lineWidth:s,depth:a,loaded:u,layer:l,positionMap:h,centerPt:c,pathUV:f}=this._params;if(!u)return;const p=Math.round(t);if(p>n&&p<=i.length-1){this._params.idx++;let t=e[p];if(!t){t=Ge(Ue(i.slice(p,p+o),l,0,c).positionsV,s,a,f,l),e[p]=t}const r=this.getObject3d();!function(t,e,r,n){const i=e.length;t.attributes.normal.count=i,t.attributes.position.count=i;const o=t.attributes.position.array,s=t.attributes.normal.array;for(let t=0;t<i;t++)o[t]=e[t],s[t]=r[t];t.index.count=n.length;for(let e=0,r=n.length;e<r;e++)t.index.array[e]=n[e]}(r.geometry,t.position,t.normal,t.indices),r.geometry.attributes.position.needsUpdate=!0,r.geometry.attributes.normal.needsUpdate=!0,r.geometry.index.needsUpdate=!0}t>=i.length-1&&(this._params.index=-1,this._params.idx=-1),this._params.index+=r}_workerLoad(t){if(!t)return this;const{id:e,indices:r,position:i,normal:o,uv:s}=t;if(!(e&&r&&i&&o&&s))return;let a=e.split("-")[1];if(a=parseInt(a),n.Util.isNumber(a)){this._params.geometries[a]={indices:new Uint32Array(r),position:new Float32Array(i),uv:new Float32Array(s),normal:new Float32Array(o)},this._params.workerInitCount++}this._params.workerInitCount===this._params.chunkLines.length&&(this._params.loaded=!0,this._fire("workerload",{target:this}))}}const Zr=["click","mousemove","mousedown","mouseup","dblclick","contextmenu"].join(" ").toString(),$r=new i.MeshBasicMaterial;$r.vertexColors=D();const tn=t=>class extends t{_initBaseObjectsEvent(t){if(t&&Array.isArray(t)&&t.length)for(let e=0,r=t.length;e<r;e++){const r=t[e];this._proxyEvent(r)}return this}_proxyEvent(t){t.on("add",(t=>{this._showGeometry(t.target,!0)})),t.on("remove",(t=>{this._showGeometry(t.target,!1)})),t.on("mouseout",(t=>{this._mouseover=!1,this.fire("mouseout",Object.assign({},t,{target:this,selectMesh:this.getSelectMesh?this.getSelectMesh():null}))})),t.on(Zr,(t=>{this.fire(t.type,Object.assign({},t,{target:this,selectMesh:this.getSelectMesh?this.getSelectMesh():null}))}))}_getHideGeometryIndex(t){const e=[];let r=0;for(let n=0,i=this._geometriesAttributes.length;n<i;n++)!0===this._geometriesAttributes[n].hide&&(e.push(n),r+=this._geometriesAttributes[n][t].count);return{indexs:e,count:r}}_updateAttribute(t,e){const{indexs:r}=this._getHideGeometryIndex(e),n=this._geometryCache.attributes[e].array,o=n.length;for(let e=0;e<o;e++)t.array[e]=n[e];let s=NaN;this.getObject3d()instanceof i.LineSegments&&(s=0);for(let n=0;n<r.length;n++){const i=r[n],{start:o,end:a}=this._geometriesAttributes[i][e];for(let e=o;e<a;e++)t.array[e]=s}return this}_showGeometry(t,e){let r;if(t&&(r=t.getOptions().index),null!=r){const t=this._geometriesAttributes[r],{hide:n}=t;if(n===e)return this;t.hide=e;const i=this.getObject3d().geometry;this._updateAttribute(i.attributes.position,"position"),i.attributes.position.needsUpdate=!0,this.isHide=e}return this}getSelectMesh(){const t=this._getIndex();if(null!=t)return{data:this._datas[t],baseObject:this._baseObjects[t]}}_getIndex(t){return null==t&&(t=this.faceIndex||this.index),t}_init(){const t=this.getLayer().getPick();this.on("add",(()=>{t.add(this.pickObject3d)})),this.on("remove",(()=>{t.remove(this.pickObject3d)}))}_setPickObject3d(){if(!this._colorMap)return;const t=this._geometryCache||this.getObject3d().geometry.clone(),e=this.getLayer().getPick(),{_geometriesAttributes:r}=this,n=r.length,o=we(r);let s=0;for(let t=0;t<n;t++){const n=e.getColor(),i=n.getHex();this._colorMap[i]=t;const{count:a}=r[t].position;this._datas[t].colorIndex=i;for(let t=0;t<a;t++)o[s]=n.r,o[s+1]=n.g,o[s+2]=n.b,s+=3}L(t,"color",new i.BufferAttribute(o,3,!0));const a=e.getColor().getHex(),u=new i.Mesh(t,$r);u.position.copy(this.getObject3d().position),u._colorIndex=a,this.setPickObject3d(u)}},en={altitude:0,height:1,bottomHeight:0,topColor:null,bottomColor:"#2d2f61",top:!0},rn=new n.Coordinate(0,0);class nn extends(tn(H)){constructor(t,e,r,i){Array.isArray(t)||(t=[t]);const o=t.length;0===o&&console.error("polygons is empty");let s=1/0,a=1/0,u=-1/0,l=-1/0;for(let e=0;e<o;e++){const r=t[e],i=r.getCenter?r.getCenter():et(r,rn);let o,h;Array.isArray(i)?(o=i[0],h=i[1]):i instanceof n.Coordinate&&(o=i.x,h=i.y),s=Math.min(s,o),a=Math.min(a,h),u=Math.max(u,o),l=Math.max(l,h)}const h=new n.Coordinate((s+u)/2,(a+l)/2);e=n.Util.extend({},en,e,{layer:i,polygons:t,coordinate:h});const{topColor:c,bottomColor:f,altitude:p,asynchronous:d,top:g}=e;let y;const v=[],m=[];if(super(),d)y=Ir(),ar.push({id:n.Util.GUID(),layer:i,key:e.key,center:h,data:t,baseObject:this,option:e});else{const s=i.coordinateToVector3(h),a=[];let u=0;const l={};for(let r=0;r<o;r++){const o=t[r],c=n.Util.extend({},e,Ce(o)),f=c.height||1,p=c.bottomHeight||0,d=Te(o,f,g,i,h,s,l);a.push(d);const y=xe(d,p,i,l),{position:v,normal:A,uv:_,indices:x}=d;x.length;const w=v.length/3;A.length,_.length,m[r]={position:{middleZ:y+l[f]/2,count:w,start:u,end:u+3*w},hide:!1},u+=3*w}y=Ar(a),c&&(ke(y,f,c,m),r.vertexColors=D())}this._initOptions(e),this._createMesh(y,r);const A=i.altitudeToVector3(p,p).x,_=i.coordinateToVector3(h,A);this.getObject3d().position.copy(_),this._baseObjects=v,this._datas=t,this._geometriesAttributes=m,this.faceIndex=null,this._geometryCache=br(y),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(v),d||(this._setPickObject3d(),this._init()),this.type="ExtrudePolygons"}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],r=Object.assign({},this.options,J(e)?e.properties:e.getProperties(),{index:t});this._baseObjects[t]=new zr(e,r,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}identify(t){return this.picked}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const r=wr(t);this._geometryCache=br(r);const{topColor:n,bottomColor:i}=this.getOptions(),o=this.getObject3d(),s=o.material;if(n&&(ke(r,i,n,e),s.vertexColors=D()),o.geometry=r,o.material.needsUpdate=!0,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}function on(t,e,r){const n=t.project(r),i=e.width/2,o=e.height/2;return{x:Math.round(n.x*i+i),y:Math.round(-n.y*o+o)}}const sn={altitude:0,height:0,color:null},an=new i.Vector3;class un extends H{constructor(t,e,r,o){e=n.Util.extend({},sn,e,{layer:o,coordinate:t}),super();let{height:s,altitude:a,color:u,size:l}=e;const h=[],c=[];u&&(u=u instanceof i.Color?u:new i.Color(u),c.push(u.r,u.g,u.b));const f=o.altitudeToVector3(s,s).x,p=o.coordinateToVector3(t,f);h.push(0,0,p.z);const d=new i.BufferGeometry;L(d,"position",new i.Float32BufferAttribute(h,3,!0)),c.length&&L(d,"color",new i.Float32BufferAttribute(c,3,!0)),void 0!==l&&L(d,"size",new i.Float32BufferAttribute([l],1,!0)),e.positions=p,this._initOptions(e),this._createPoints(d,r);const g=o.altitudeToVector3(a,a).x,y=new i.Vector3(p.x,p.y,g);this.getObject3d().position.copy(y),this.type="Point"}identify(t){const e=this.getLayer(),r=this.getMap().getSize(),n=this.getLayer().getCamera(),i=this.getOptions().positions,o=this.getOptions().altitude;let s=this.getObject3d().material.size;void 0===s&&(s=this.options.size||1);const a=this.getMap().coordToContainerPoint(t),u=e.altitudeToVector3(o,o).x;an.x=i.x,an.y=i.y,an.z=i.z+u;const l=on(an,r,n);return Math.sqrt(Math.pow(a.x-l.x,2)+Math.pow(a.y-l.y,2))<=s/2}}function ln(t,e){const{minx:r,miny:n,maxx:i,maxy:o}=t,[s,a]=e;return r<=s&&s<=i&&n<=a&&a<=o}class hn{constructor(t,e,r,n){this.minlng=t,this.minlat=e,this.maxlng=r,this.maxlat=n,this.minx=1/0,this.miny=1/0,this.maxx=-1/0,this.maxy=-1/0,this.coordinates=[],this.positions=[],this.indexs=[],this.key=null}updateBBoxPixel(t){let e=1/0,r=1/0,i=-1/0,o=-1/0;const{minlng:s,minlat:a,maxlng:u,maxlat:l}=this;return[[s,a],[s,l],[u,a],[u,l]].map((t=>new n.Coordinate(t))).map((e=>t.coordToContainerPoint(e))).forEach((t=>{e=Math.min(e,t.x),r=Math.min(r,t.y),i=Math.max(i,t.x),o=Math.max(o,t.y)})),this.minx=e,this.miny=r,this.maxx=i,this.maxy=o,this}containsCoordinate(t){let e,r;Array.isArray(t)?(e=t[0],r=t[1]):t instanceof n.Coordinate&&(e=t.x,r=t.y);const{minlng:i,minlat:o,maxlng:s,maxlat:a}=this;return i<=e&&e<=s&&o<=r&&r<=a}isRecCross(t,e){const{x:r,y:n}=t,i={minx:r-e/2,miny:n-e/2,maxx:r+e/2,maxy:n+e/2},{minx:o,miny:s,maxx:a,maxy:u}=i;return!!(ln(this,[o,s])||ln(this,[o,u])||ln(this,[a,s])||ln(this,[a,u])||ln(i,[this.minx,this.miny])||ln(i,[this.minx,this.maxy])||ln(i,[this.maxx,this.miny])||ln(i,[this.maxx,this.maxy]))}static initGrids(t,e,r,n){const i=[],o=(r-t)/30,s=(n-e)/30;let a=t,u=e;for(let r=0;r<30;r++){a=t+r*o;for(let t=0;t<30;t++){u=e+t*s;const n=new hn(a,u,a+o,u+s);n.key=t+"-"+r,i.push(n)}}return{grids:i,averageX:o,averageY:s,ROWS:30,COLS:30}}}const cn={altitude:0},fn=new i.Vector3;function pn(t,e){const r=Math.pow(10,e);return Math.round(t*r)/r}class dn extends(tn(H)){constructor(t,e,r,o){Array.isArray(t)||(t=[t]),e=n.Util.extend({},cn,e,{layer:o,points:t});let s=1/0,a=1/0,u=-1/0,l=-1/0;for(let e=0,r=t.length;e<r;e++){const{coordinate:r}=t[e];let i,o;Array.isArray(r)?(i=r[0],o=r[1]):r instanceof n.Coordinate&&(i=r.x,o=r.y),t[e].coords=[i,o],s=Math.min(s,i),a=Math.min(a,o),u=Math.max(u,i),l=Math.max(l,o)}const h=o.coordinateToVector3([(s+u)/2,(a+l)/2]),{grids:c,averageX:f,averageY:p,ROWS:d,COLS:g}=hn.initGrids(s,a,u,l);c.length;const y=new Float32Array(3*t.length),v=[],m=new Float32Array(3*t.length),A=new Float32Array(t.length),_=[],x=[],w={};let b=0,E=!1,I=!1;const C=new i.Vector3(0,0,0);for(let e=0,r=t.length;e<r;e++){let{coordinate:r,height:n,color:u,size:l,coords:g}=t[e];const _=3*e;u&&(E=!0,u=u instanceof i.Color?u:new i.Color(u),m[_]=u.r,m[_+1]=u.g,m[_+2]=u.b),l&&(I=!0,A[e]=l,b=Math.max(b,l));const S=Ae(n,o,w),M=o.coordinateToVector3(r,S);C.x=M.x,C.y=M.y,C.z=M.z,C.sub(h),y[_]=C.x,y[_+1]=C.y,y[_+2]=C.z,v.push(M),x[e]={position:{count:1,start:3*e,end:3*e+3},hide:!1};let B=pn((g[1]-a)/p,4),T=pn((g[0]-s)/f,4);B-=1,T-=1,B=Math.max(0,B),T=Math.max(0,T),B=Math.ceil(B),T=Math.ceil(T);const k=T*d+B;c[k]&&(c[k].positions.push(M),c[k].indexs.push(e))}const S=new i.BufferGeometry;L(S,"position",new i.BufferAttribute(y,3,!0)),E&&L(S,"color",new i.BufferAttribute(m,3,!0)),I&&L(S,"size",new i.BufferAttribute(A,1,!0)),e.positions=v,super(),this._initOptions(e),this._createPoints(S,r);const M=e.altitude,B=o.altitudeToVector3(M,M).x,T=h.clone();T.z=B,this.getObject3d().position.copy(T),this._baseObjects=_,this._datas=t,this.faceIndex=null,this._geometriesAttributes=x,this._geometryCache=S.clone(),this.isHide=!1,this._initBaseObjectsEvent(_),this._grids=c,this._bindMapEvents(),this.type="Points",this.maxSize=b}_bindMapEvents(){const t=this.getMap(),e="zoomstart zooming zoomend movestart moving moveend pitch rotate";this.on("add",(()=>{this._updateGrids(),t.on(e,this._updateGrids,this)})),this.on("remove",(()=>{t.off(e,this._updateGrids,this)}))}_updateGrids(){const t=this.getMap();this._grids.forEach((e=>{e.indexs.length&&e.updateBBoxPixel(t)}))}getSelectMesh(){const t=this.faceIndex;if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],{coordinate:r,height:n,color:i,size:o}=e;this._baseObjects[t]=new un(r,{height:n,index:t,color:i,size:o},this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}identify(t){const e=this.getLayer(),r=this.getMap().getSize(),n=this.getLayer().getCamera(),i=this.getOptions().altitude,o=this.getMap(),s=e.altitudeToVector3(i,i).x;let a=this.getObject3d().material.size;const u=void 0===a,l=o.coordToContainerPoint(t),h=[];if(this._grids.forEach((t=>{t.indexs.length&&t.isRecCross(l,u?this.maxSize:a)&&h.push(t)})),h.length<1)return!1;for(let t=0,e=h.length;t<e;t++)for(let e=h[t].positions.length-1;e>=0;e--){u&&(a=this._datas[h[t].indexs[e]].size||1);const i=h[t].positions[e];fn.x=i.x,fn.y=i.y,fn.z=i.z+s;const o=on(fn,r,n);if(Math.sqrt(Math.pow(l.x-o.x,2)+Math.pow(l.y-o.y,2))<=a/2)return this.faceIndex=h[t].indexs[e],!0}return!1}}const gn={coordinate:"",radius:10,height:100,radialSegments:6,altitude:0,topColor:"",bottomColor:"#2d2f61"};class yn extends(tn(H)){constructor(t,e,r,o){Array.isArray(t)||(t=[t]);const s=t.length,a=_e(t),u=o.coordinateToVector3(a),l=[],h=[],c=[];let f=0;const p={},d={};let g;super(),e=n.Util.extend({},{altitude:0,layer:o,points:t},gn,e),this._initOptions(e);const y=new i.Vector3;if(e.asynchronous){g=Ir();const r=n.Util.GUID();this.getOptions().id=r;const i=[];for(let r=0;r<s;r++){const s=n.Util.extend({index:r},e,t[r]),{radius:a,radialSegments:l,altitude:h,height:c,coordinate:f}=s,g=me(a,o,p);t[r]._radius=g;const v=Ae(c,o,d),m=Ae(h,o,d),A=o.coordinateToVector3(f,0,y).sub(u);i.push({radialSegments:l,radius:g,height:v,center:[A.x,A.y],altitude:m})}gr.push({id:r,data:i,layer:o,baseObject:this})}else{for(let i=0;i<s;i++){const s=n.Util.extend({index:i},e,t[i]),{radius:a,radialSegments:g,altitude:v,topColor:m,bottomColor:A,height:_,coordinate:x}=s,w=me(a,o,p),b=Ae(_,o,d),E=Ae(v,o,d),I=o.coordinateToVector3(x,0,y).sub(u),C=Tr({radius:w,height:b,radialSegments:g,center:[I.x,I.y]});m&&(kr(C,A,m,"z",b/2),r.vertexColors=D());const S=C.attributes.position.array;for(let t=0,e=S.length;t<e;t+=3)S[t+2]+=E;l.push(C);const M=new Dr(x,s,r,o);h.push(M),C.index.count;const B=C.attributes.position.count;C.attributes.normal.count,C.attributes.uv.count,c[i]={position:{count:B,start:f,end:f+3*B},hide:!1},f+=3*B}g=Pr(l)}this._createMesh(g,r);const v=e.altitude,m=o.altitudeToVector3(v,v).x,A=u.clone();A.z=m,this.getObject3d().position.copy(A),this._baseObjects=h,this._datas=t,this._geometriesAttributes=c,this.faceIndex=null,this._geometryCache=br(g),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(h),e.asynchronous||(this._setPickObject3d(),this._init()),this.type="Bars"}identify(){return this.picked}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],r=Object.assign({},this.options,e,{index:t,asynchronous:!1});this._baseObjects[t]=new Dr(e.coordinate,r,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const r=wr(t);this._geometryCache=br(r);const{topColor:n,bottomColor:i}=this.getOptions(),o=this.getObject3d(),s=o.material;if(n&&(kr(r,i,n,"z",e),s.vertexColors=D()),o.geometry=r,o.material.needsUpdate=!0,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}const vn={width:3,height:1,altitude:0,topColor:null,bottomColor:"#2d2f61",pathUV:!1};class mn extends(tn(H)){constructor(t,e,r,i){Array.isArray(t)||(t=[t]);const o=[],s=[],a=t.length;for(let e=0;e<a;e++){const r=je(t[e]);o.push(r.center),s.push(r.lineStrings)}const u=_e(o);e=n.Util.extend({},vn,e,{layer:i,lineStrings:t,coordinate:u});const{altitude:l,topColor:h,bottomColor:c,asynchronous:f,pathUV:p}=e;let d;const g=[],y=[];if(super(),f)d=Ir(),lr.push({id:n.Util.GUID(),layer:i,key:e.key,center:u,data:s,lineStrings:t,baseObject:this,option:e});else{const o=[];let l=0;const f={},g={};for(let r=0;r<a;r++){const a=t[r],h=n.Util.extend({},e,Se(a),{index:r}),{height:c,width:d,bottomHeight:v}=h,m=me(d,i,f),A=Ae(c,i,g),_=s[r],x=[];let w=0;for(let t=0,e=_.length;t<e;t++){const e=Ge(_[t],m,A,p,i,u);w=xe(e,v,i,f),x.push(e)}const b=_r(x);o.push(b);const{position:E,normal:I,indices:C}=b;C.length;const S=E.length/3;I.length,y[r]={position:{middleZ:w+A/2,count:S,start:l,end:l+3*S},hide:!1},l+=3*S}d=Ar(o),h&&(ke(d,c,h,y),r.vertexColors=D())}this._initOptions(e),this._createMesh(d,r);const v=i.altitudeToVector3(l,l).x,m=i.coordinateToVector3(u,v);this.getObject3d().position.copy(m),this._baseObjects=g,this._datas=t,this._geometriesAttributes=y,this.faceIndex=null,this._geometryCache=br(d),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(g),f||(this._setPickObject3d(),this._init()),this.type="ExtrudeLines"}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],r=Object.assign({},this.options,K(e)?e.properties:e.getProperties(),{index:t});this._baseObjects[t]=new Qr(e,r,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}identify(t){return this.picked}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const r=wr(t);this._geometryCache=br(r);const{topColor:n,bottomColor:i,bottomHeight:o,height:s}=this.getOptions(),a=this.getObject3d().material;if(n&&(ke(r,i,n,e),a.vertexColors=D()),this.getObject3d().geometry=r,this.getObject3d().material.needsUpdate=!0,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}const An={altitude:0,colors:null};class _n extends(tn(H)){constructor(t,e,r,o){Array.isArray(t)||(t=[t]);const s=[],a=[],u=t.length;for(let e=0;e<u;e++){const r=je(t[e]);s.push(r.center),a.push(r.lineStrings)}const l=_e(s);e=n.Util.extend({},An,e,{layer:o,lineStrings:t,coordinate:l}),super(),this._initOptions(e);const{asynchronous:h}=e;let c;const f=[],p={};let d=[],g=0,y=[];if(h)c=Ye(),cr.push({id:n.Util.GUID(),layer:o,key:e.key,center:l,data:a,lineStrings:t,baseObject:this,option:e});else{for(let t=0;t<u;t++){const r=a[t];let i=0;for(let t=0,s=r.length;t<s;t++){const s=Se(r[t]),a=n.Util.extend({},e,s),{positions:u}=Fe(r[t],o,l,!1);xe(u,a.bottomHeight,o,p),i+=u.length/3*2-2,y.push(Ve(u))}d[t]={position:{count:i,start:g,end:g+3*i},hide:!1},g+=3*i}const t=qe(y);c=new i.BufferGeometry,L(c,"position",new i.BufferAttribute(t,3))}this._createLineSegments(c,r);const{altitude:v}=e,m=o.altitudeToVector3(v,v).x,A=o.coordinateToVector3(l,m);this.getObject3d().position.copy(A),this._baseObjects=f,this._datas=t,this._geometriesAttributes=d,this.faceIndex=null,this.index=null,this._geometryCache=c.clone(),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(f),h||(this._setPickObject3d(),this._init()),this.type="Lines"}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],r=n.Util.extend({},this.getOptions(),{index:t},K(e)?e.properties:e.getProperties());this._baseObjects[t]=new Fr(e,r,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}_setPickObject3d(){if(!this._colorMap)return;const t=this._geometryCache||this.getObject3d().geometry.clone(),e=this.getLayer().getPick(),{_geometriesAttributes:r}=this,n=r.length,o=we(r);let s=0;for(let t=0;t<n;t++){const n=e.getColor(),i=n.getHex();this._colorMap[i]=t;const{count:a}=r[t].position;this._datas[t].colorIndex=i;for(let t=0;t<a;t++)o[s]=n.r,o[s+1]=n.g,o[s+2]=n.b,s+=3}L(t,"color",new i.BufferAttribute(o,3,!0));const a=this.getObject3d().material.clone();a.color.set("#fff"),a.vertexColors=D();const u=e.getColor().getHex(),l=new i.LineSegments(t,a);l.position.copy(this.getObject3d().position),l._colorIndex=u,this.setPickObject3d(l)}identify(t){return this.picked}_workerLoad(t){const{position:e,geometriesAttributes:r}=t;this._geometriesAttributes=r;const n=new i.BufferGeometry;if(L(n,"position",new i.BufferAttribute(new Float32Array(e),3)),this._computeLineDistances(n),this._geometryCache=n.clone(),this.getObject3d().geometry=n,this.getObject3d().material.needsUpdate=!0,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}const xn=[],wn=[];function bn(){return{waitingQueue:xn,currentQueue:wn}}function En(t,e){for(let r=0,n=t.length;r<n;r++){const n=t[r];if(n){const{key:i,callback:o}=n;if(e===i)return t.splice(r,1),o}}return null}const In=document.createElement("canvas");let Cn;function Sn(t,e=!1){if(Cn)return Cn;const r=In.getContext("2d");return r.clearRect(0,0,256,256),r.save(),Cn=In.toDataURL(),Cn}function Mn(t=1,e=1){let r;return"undefined"==typeof document||(r=document.createElement("canvas"),t&&(r.width=t),e&&(r.height=e)),r}In.width=In.height=256;class Bn extends n.TileLayer{constructor(t,e={}){super(n.Util.GUID(),n.Util.extend({urlTemplate:t},e)),this._opts=null,this._layer=null,this.material=null,this.getMaterial=null,this._baseObjectKeys={},this._loadTiles={},this._add=null,this._layerLaodTime=(new Date).getTime()}isAsynchronous(){return this._opts.worker}getBaseObjects(){const t=this._loadTiles,e=[];for(let r in t){const t=this._baseObjectKeys[r];if(t&&Array.isArray(t)&&t.length)for(let r=0,n=t.length;r<n;r++)e.push(t[r])}return e}onSelectMesh(t,e){}formatBaseObjects(t,e){return[]}loopMessage(t){}getTileData(t){const{key:e,url:r,callback:i,img:o}=t;n.Ajax.getJSON(r,{},(function(t,r){t?(console.error(t),i(e,null,o)):i(e,r,o)}))}_getCurentTileKeys(){const t=this.getTiles().tileGrids||[],e=[],r={};for(let n=0,i=t.length;n<i;n++){const i=t[n].tiles||[];for(let t=0,n=i.length;t<n;t++){const{id:n}=i[t];e.push(n),r[n]=!0}}return{keys:e,keysMap:r}}_isLoad(){const{keys:t}=this._getCurentTileKeys(),e=Object.keys(this._renderer.tilesInView);return t.length===e.length}_layerOnLoad(){const t=(new Date).getTime();if(t-this._layerLaodTime<20)return;this._layerLaodTime=t;const e=this._renderer.tilesInView,r=this._loadTiles,n=this._layer,i=this._baseObjectKeys,o=Object.keys(e).length,s=Object.keys(r).length,a=[];if(o&&s)for(let t in r)e[t]||i[t]&&(i[t]||[]).forEach((t=>{a.push(t)}));if(a.length&&n.removeMesh(a,!1),o&&s)for(let t in e)if(!r[t])if(i[t]){const e=i[t];n.addMesh(e)}else{const{x:e,y:r,z:n}=this._getXYZOfIndex(t);this.getTileUrl(e,r,n)}this._loadTiles=Object.assign({},e),this._diffCache()}_init(){}_workerLoad(t){const e=t.target._img;e.currentCount++,e.currentCount===e.needCount&&(e.src=Sn(e._key,this._opts.debug))}_generateBaseObjects(t,e,r){if(e&&r){const{keysMap:n}=this._getCurentTileKeys();if(!n[t])return void(r.src=Sn(0,this._opts.debug));const i=this.formatBaseObjects(t,e);if(i.length){r.needCount=i.length,r.currentCount=0;for(let e=0,n=i.length;e<n;e++){const n=i[e];n._img=r,n._vt=this,this.isVisible()||n.hide(),this._cachetile(t,n),n.isAsynchronous()||r.currentCount++}this._layer.addMesh(i,!1),r.needCount===r.currentCount&&(r.src=Sn(0,this._opts.debug)),this.isAsynchronous()?i.filter((t=>t.isAsynchronous())).forEach((t=>{t.on("workerload",this._workerLoad,this)})):r.src=Sn(0,this._opts.debug)}else r.src=Sn(0,this._opts.debug);this._loadTiles[t]=!0}else r&&(r.src=Sn(0,this._opts.debug))}_diffCache(){if(Object.keys(this._baseObjectKeys).length>this._renderer.tileCache.max){const t=this._renderer.tileCache.data,e=this._renderer.tilesInView,r=[];for(let n in this._baseObjectKeys)t[n]||e[n]||((this._baseObjectKeys[n]||[]).forEach((t=>{t.isAdd&&r.push(t)})),this._diposeBaseObject(n),delete this._baseObjectKeys[n]);r.length&&this._layer.removeMesh(r,!1)}}_diposeBaseObject(t){const e=this._baseObjectKeys[t];e&&e.length&&e.forEach((t=>{t.getObject3d().geometry.dispose(),t._geometryCache&&t._geometryCache.dispose();const e=t._baseObjects;e&&e.length&&e.forEach((t=>{t.getObject3d().geometry.dispose(),t=null})),t._datas=null,t._geometriesAttributes=null,t._faceMap=null,t._colorMap=null,t.pickObject3d&&t.pickObject3d.geometry.dispose(),t=null}))}_cachetile(t,e){this._baseObjectKeys[t]||(this._baseObjectKeys[t]=[]),this._baseObjectKeys[t].push(e)}_getXYZOfIndex(t){const e=t.indexOf("_")>-1?"_":"-";let[r,n,i]=t.split(e).slice(1,4);return{x:parseInt(n),y:parseInt(r),z:parseInt(i)}}_getTileExtent(t,e,r){const n=this.getMap()._getResolution(r);return this._getTileConfig().getTilePrjExtent(t,e,n)}_getTileLngLatExtent(t,e,r){const i=this._getTileExtent(t,e,r);let o=i.getMax(),s=i.getMin();const a=this.getMap().getProjection();return s=a.unproject(s),o=a.unproject(o),new n.Extent(s,o)}}const Tn={worker:!1};class kn extends Bn{constructor(t,e={},r,i){super(n.Util.GUID(),n.Util.extend({urlTemplate:t},Tn,e)),this._opts=e,this._layer=i,this.getMaterial=r,this._baseObjectKeys={},this._loadTiles={},this._add=null,this._layerLaodTime=(new Date).getTime(),this._init()}formatBaseObjects(t,e){const r=this._opts,o=[],s=this.isAsynchronous();for(let a in e){const u=e[a]||{};let l;if(Array.isArray(u)?l=u:"FeatureCollection"===u.type&&(l=u.features),l&&l.length){const e=[],h=[],c=[];for(let t=0,r=l.length;t<r;t++){const r=l[t];if(J(r))e.push(r);else if(K(r)){const t=rt(r);for(let e=0,r=t.length;e<r;e++)h.push(t[e])}else if(Z(r)){const t=rt(r);for(let e=0,r=t.length;e<r;e++)c.push(n.Util.extend({},t[e].properties,t[e],{coordinate:tt(t[e])}))}}if(e.length){const i=this._getMaterial(a,e,t,u);if(i){const u=this._layer.toExtrudePolygons(e,n.Util.extend({},{topColor:"#fff",layerName:a,asynchronous:s,key:t},r),i);o.push(u)}}if(h.length){const e=this._getMaterial(a,h,t,u);if(e&&(e instanceof i.LineBasicMaterial||e instanceof i.LineDashedMaterial)){const t=this._layer.toLines(h,n.Util.extend({},{layerName:a,asynchronous:s},r),e);o.push(t)}}if(c.length){const e=this._getMaterial(a,c,t,u);if(e&&e instanceof i.PointsMaterial){const t=this._layer.toPoints(c,n.Util.extend({},{layerName:a,asynchronous:s},r),e);o.push(t)}}}}return o}loopMessage(t){const{currentQueue:e}=bn();e.length>0&&this.getTileData(t)}_init(){this.on("layerload",this._layerOnLoad),this.on("add",(()=>{if(!1===this._add){const t=this.getBaseObjects();this._layer.addMesh(t)}this._add=!0,this.intervalId=setInterval((()=>{this._isLoad()&&!this._layer.getMap().isInteracting()&&this.fire("layerload")}),1e3)})),this.on("remove",(()=>{this._add=!1;const t=this.getBaseObjects();this._layer.removeMesh(t),clearInterval(this.intervalId)})),this.on("show",(()=>{this.getBaseObjects().forEach((t=>{t.show()}));for(let t in this._baseObjectKeys){(this._baseObjectKeys[t]||[]).forEach((t=>{t.show()}))}})),this.on("hide",(()=>{this.getBaseObjects().forEach((t=>{t.hide()}));for(let t in this._baseObjectKeys){(this._baseObjectKeys[t]||[]).forEach((t=>{t.hide()}))}})),this.on("renderercreate",(t=>{t.renderer.loadTile=function(t){var e=this.layer.getTileSize(),r=new Image;return r.width=e.width,r.height=e.height,r.onload=this.onTileLoad.bind(this,r,t),r.onerror=this.onTileError.bind(this,r,t),this.loadTileImage(r,t.url,t.id),r},t.renderer.deleteTile=function(t){if(!t||!t.image)return;t.image.onload=null,t.image.onerror=null;!function(t){const e=En(xn,t);e&&e(t)}((t.info||{}).id)},t.renderer.loadTileImage=(t,e,r)=>{t._key=r,function(t,e,r,n,i){const o={key:t,url:e,callback:r,img:n,vt:i};wn.length<10?(wn.push(o),i.loopMessage(o)):xn.push(o)}(r,e,((t,e,r)=>{this._generateBaseObjects(t,e,r),function(t,e){if(En(wn,t),xn.length){wn.push(xn[0]),xn.splice(0,1);const t=wn[wn.length-1];e.loopMessage(t)}}(t,this)}),t,this)}}))}_getMaterial(t,e,r,i){return this.getMaterial&&n.Util.isFunction(this.getMaterial)?this.getMaterial(t,e,r,i):null}}function Pn(t,e,r,n){const{position:o,uv:s,normal:a,indexs:u}=function(t,e,r,n){const i=t/r,o=e/n,s=-t/2,a=e/2,u=-e/2,l=(r+1)*(n+1),h=new Float32Array(3*l),c=new Float32Array(2*l),f=new Float32Array(3*l),p=new Uint32Array(10*l);let d=0,g=0,y=0;for(let l=0;l<=n;l++)for(let v=0;v<=r;v++){const m=s+i*v,A=a-o*l;h[d]=m,h[d+1]=A,h[d+2]=0,f[d]=0,f[d+1]=0,f[d+2]=1;const _=(m-s)/t,x=(A-u)/e;if(c[g]=_,c[g+1]=x,d+=3,g+=2,v<r&&l<n){const t=l*(r+1)+v,e=t+1,n=(r+1)*(l+1)+v,i=n+1;p[y]=t,p[y+1]=n,p[y+2]=e,p[y+3]=n,p[y+4]=i,p[y+5]=e,y+=6}}const v=new Uint32Array(y);for(let t=0,e=v.length;t<e;t++)v[t]=p[t];return{position:h,uv:c,normal:f,indexs:v}}(t,e,r,n),l=new i.BufferGeometry;return L(l,"position",new i.BufferAttribute(o,3)),L(l,"normal",new i.BufferAttribute(a,3)),L(l,"uv",new i.BufferAttribute(s,2)),l.setIndex(new i.BufferAttribute(u,1)),l}const Ln=new i.TextureLoader,Rn=document.createElement("canvas");function Dn(t){if(!t)return null;let e;return"string"==typeof t?(e=new Image,e.src=t):t instanceof HTMLCanvasElement?(e=new Image,e.src=t.toDataURL()):t instanceof Image&&(e=new Image,e.src=t.src,e.crossOrigin=t.crossOrigin),e&&!e.crossOrigin&&(e.crossOrigin="Anonymous"),e}const On=new Map;function Nn(t,e,r,n){if(!e||!r)return;const{imageWidth:o,imageHeight:s,flaserBoundary:a}=n;let u;if(u=t instanceof Uint32Array||t instanceof Uint8ClampedArray?t:function(t,e=256,r=256){Rn.width=e,Rn.height=r;const n=Rn.getContext("2d");return n.drawImage(t,0,0,e,r),n.getImageData(0,0,e,r).data}(t,o,s),!u)return void console.error("image is error type data",t);let l=0,h=0,c=0;const f=new i.Vector3,p=On;for(let t=0,n=u.length;t<n;t+=4){const n=.1*(256*u[t]*256+256*u[t+1]+u[t+2])-1e4;let i=0;if(0!==h&&h+1!==s&&0!==c&&c+1!==o||!a){const t=p.get(n);void 0!==t?i=t:(i=r.altitudeToVector3(n,n,null,f).x,p.set(n,i))}e.attributes.position.array[3*l+2]=i,l++,c++,c===o&&(h++,c=0)}e.attributes.position.needsUpdate=!0}const Fn={interactive:!1,altitude:0,image:null,imageWidth:256,imageHeight:256,texture:null,flaserBoundary:!0,bufferPixel:1};class Un extends H{constructor(t,e,r,i){e=n.Util.extend({},Fn,e,{layer:i,extent:t});const{texture:o,image:s,altitude:a,imageHeight:u,imageWidth:l,flaserBoundary:h,bufferPixel:c}=e;t instanceof n.Extent||(t=new n.Extent(t));const{xmin:f,ymin:p,xmax:d,ymax:g}=t;let y=1/0,v=1/0,m=-1/0,A=-1/0;[[f,p],[f,g],[d,g],[d,p]].forEach((t=>{const e=i.coordinateToVector3(t),{x:r,y:n}=e;y=Math.min(r,y),v=Math.min(n,v),m=Math.max(r,m),A=Math.max(n,A)}));const _=(m-y)/l,x=(A-v)/u;y-=_*c,m+=_*c,v-=x*c,A+=x*c;const w=Math.abs(m-y),b=Math.abs(A-v),E=Dn(s),I=Dn(o),C=Pn(w,b,l-1,u-1);super(),this._initOptions(e),this._createMesh(C,r);const S=i.altitudeToVector3(a,a).x,M=i.coordinateToVector3(t.getCenter(),S);this.getObject3d().position.copy(M),r.transparent=!0,E&&(E.onload=()=>{Nn(E,C,i,{imageWidth:l,imageHeight:u,flaserBoundary:h}),this.fire("dataload",{})},E.onerror=function(){console.error(`not load ${E.src}`),this.fire("dataerror",{})}),I?(r.opacity=0,Ln.load(I.src,(t=>{r.map=t,r.opacity=1,r.needsUpdate=!0,this.fire("textureload",{})}))):r.opacity=1,this.type="Terrain"}updateData(t){return Nn(t,this.getObject3d().geometry,this.getLayer(),this.getOptions()),this.fire("updatedata",{}),this}}const Qn={scale:1,tileDivisor:4};class Gn extends Bn{constructor(t,e={},r,i){super(n.Util.GUID(),n.Util.extend({urlTemplate:t},Qn,e)),this._opts=e,this._layer=i,this.material=r,this._baseObjectKeys={},this._loadTiles={},this._add=null,this._imgQueue={},this._layerLaodTime=(new Date).getTime(),this._init()}isAsynchronous(){return!1}formatBaseObjects(t,e){const r=this.options,n=[],{scale:i,tileDivisor:o}=r,{x:s,y:a,z:u}=this._getXYZOfIndex(t),l=this.getMap().getZoom(),h=this.getTileUrl(s,a,u),[c,f]=this.options.tileSize,p=this._getTileLngLatExtent(s,a,u),d=this.material.clone();if(u+1>=Math.round(l)){const t=new Un(p,{image:e,imageWidth:c/o,imageHeight:f/o,texture:h},d,this._layer);t.getObject3d().scale.set(i,i,1),n.push(t)}return n}loopMessage(t){this.getTileData(t)}_init(){this.on("layerload",this._layerOnLoad),this.on("add",(()=>{if(!1===this._add){const t=this.getBaseObjects();this._layer.addMesh(t)}this._add=!0,this.intervalId=setInterval((()=>{this._isLoad()&&!this._layer.getMap().isInteracting()&&this.fire("layerload")}),1e3)})),this.on("remove",(()=>{this._add=!1;const t=this.getBaseObjects();this._layer.removeMesh(t),clearInterval(this.intervalId)})),this.on("show",(()=>{this.getBaseObjects().forEach((t=>{t.show()}));for(let t in this._baseObjectKeys){(this._baseObjectKeys[t]||[]).forEach((t=>{t.show()}))}})),this.on("hide",(()=>{this.getBaseObjects().forEach((t=>{t.hide()}));for(let t in this._baseObjectKeys){(this._baseObjectKeys[t]||[]).forEach((t=>{t.hide()}))}})),this.on("renderercreate",(t=>{t.renderer.loadTile=function(t){var e=this.layer.getTileSize(),r=new Image;return r.width=e.width,r.height=e.height,r.onload=this.onTileLoad.bind(this,r,t),r.onerror=this.onTileError.bind(this,r,t),this.loadTileImage(r,t.url,t.id),r},t.renderer.deleteTile=t=>{if(!t||!t.image)return;t.image.onload=null,t.image.onerror=null;const e=t.info||{},r=this._imgQueue[e.id];r&&(r.src="",r.onload=null,r.onerror=null,delete this._imgQueue[e.id])},t.renderer.loadTileImage=(t,e,r)=>{t._key=r;const n=new Image;this._imgQueue[r]=n;const i={key:r,url:e,rgbImage:n,callback:(t,e,r)=>{this._generateBaseObjects(t,e,r)},img:t,vt:this};this.loopMessage(i)}}))}}
5
5
  /*!
6
6
  * Code from baidu mapv
7
7
  * License: BSD-3
@@ -14,7 +14,7 @@
14
14
  * https://github.com/huiyan-fe/mapv
15
15
  *
16
16
  */
17
- function(t){var e=t/2,r=t+e,n=1e4,i=Mn(2*r,2*r),o=i.getContext("2d");return o.shadowBlur=e,o.shadowColor="black",o.shadowOffsetX=o.shadowOffsetY=n,o.beginPath(),o.arc(r-n,r-n,t,0,2*Math.PI,!0),o.closePath(),o.fill(),i}(r._size||r.size||13),o=i.width/2,s=i.height/2,a=e,u={};for(var l in a.forEach((function(t){var e=void 0===t.count?1:t.count,r=Math.min(1,e/n).toFixed(2);u[r]=u[r]||[],u[r].push(t)})),u)if(!isNaN(l)){var h=u[l];t.beginPath(),r.withoutAlpha||(t.globalAlpha=l),h.forEach((function(e){var r=e.coordinate,a=void 0===e.count?1:e.count;t.globalAlpha=a/n,t.drawImage(i,r[0]-o,r[1]-s)}))}}zn.prototype.setMax=function(t){this.max=t||100},zn.prototype.setMin=function(t){this.min=t||0},zn.prototype.setMaxSize=function(t){this.maxSize=t||35},zn.prototype.setMinSize=function(t){this.minSize=t||0},zn.prototype.initPalette=function(){var t=this.gradient,e=Mn(256,1),r=this.paletteCtx=e.getContext("2d"),n=r.createLinearGradient(0,0,256,1);for(var i in t)n.addColorStop(parseFloat(i),t[i]);r.fillStyle=n,r.fillRect(0,0,256,1)},zn.prototype.getColor=function(t){var e=this.getImageData(t);return"rgba("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]/256+")"},zn.prototype.getImageData=function(t){var e=this.paletteCtx.getImageData(0,0,256,1).data;if(void 0===t)return e;var r=this.max,n=this.min;t>r&&(t=r),t<n&&(t=n);var i=4*Math.floor((t-n)/(r-n)*255);return[e[i],e[i+1],e[i+2],e[i+3]]},zn.prototype.getSize=function(t){var e=this.max,r=this.min,n=this.maxSize,i=this.minSize;return t>e&&(t=e),t<r&&(t=r),e>r?i+(t-r)/(e-r)*(n-i):n},zn.prototype.getLegend=function(t){var e=this.gradient,r=t.width||20,n=t.height||180,i=Mn(r,n),o=i.getContext("2d"),s=o.createLinearGradient(0,n,0,0);for(var a in e)s.addColorStop(parseFloat(a),e[a]);return o.fillStyle=s,o.fillRect(0,0,r,n),i};var Hn={draw:function(t,e,r){if(!(t.canvas.width<=0||t.canvas.height<=0)){var n=r.strength||.3;t.strokeStyle="rgba(0,0,0,"+n+")";var i=Mn(t.canvas.width,t.canvas.height),o=i.getContext("2d");o.scale(devicePixelRatio,devicePixelRatio),r=r||{},t.save();var s=new zn({gradient:r.gradient});if(qn(o,e,r),!r.absolute){var a=o.getImageData(0,0,t.canvas.width,t.canvas.height);jn(a.data,s.getImageData(),r),t.putImageData(a,0,0),t.restore()}s=null,i=null}},drawGray:qn,colorize:jn};const Wn={altitude:0,interactive:!1,min:0,max:100,size:13,gradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},gridScale:.5},Yn=2048;class Xn extends H{constructor(t,e,r,o){Array.isArray(t)||(t=[t]);let s=1/0,a=1/0,u=-1/0,l=-1/0;const h=[];for(let e=0,r=t.length;e<r;e++){const{coordinate:r,lnglat:n,xy:i}=t[e],c=r||n||i;if(!c){console.warn("not find coordinate");continue}const f=o.coordinateToVector3(c);h.push(f);const{x:p,y:d}=f;s=Math.min(s,p),a=Math.min(a,d),u=Math.max(u,p),l=Math.max(l,d)}e=n.Util.extend({},Wn,e,{layer:o,points:t});let{gridScale:c,altitude:f,size:p}=e;const d=Math.abs(u-s),g=Math.abs(l-a),y=Math.max(d*c,g*c);if(y>Yn){console.warn(`gridScale: ${c} it's too big. I hope it's a smaller value,canvas max size is 2048* 2048`);c=Yn/(y/c)}let v=Math.ceil(d*c),m=Math.ceil(g*c);const A=v/d,_=m/g,x=[],w=Math.ceil(2*p);for(let e=0,r=h.length;e<r;e++){const r=h[e];r.x-=s,r.y-=a,r.x*=A,r.y*=_,r.y=m-r.y,r.x+=w,r.y+=w,x.push({coordinate:[r.x,r.y],count:t[e].count})}v+=2*w,m+=2*w;let b=Mn(v,m),E=b.getContext("2d");Hn.drawGray(E,x,e);const I=E.getImageData(0,0,E.canvas.width,E.canvas.height);let C=-1/0;const S=new Float32Array(I.data.length/4),M=new Float32Array(I.data.length/4);for(let t=3,e=I.data.length,r=0;t<e;t+=4){const e=I.data[t];C=Math.max(C,e),M[r]=e,e<=0&&(S[r]=1),r++}const B=new zn({gradient:e.gradient});Hn.colorize(I.data,B.getImageData(),e),b=null,E=null;const T=Pn(d,g,v-1,m-1),k=T.getIndex().array,P=T.attributes.position.array,R=new Float32Array(P.length),O=new Uint32Array(6*P.length),N=new i.Color;let F=0;for(let t=0,e=P.length,r=0,n=k.length,i=0,o=I.data.length,s=0;t<Math.max(e,n,o);t+=3){if(t<e){const e=M[s];e>0&&(P[t+2]=e/C)}if(r<n){const t=k[r],e=k[r+1],n=k[r+2];S[t]&&S[e]&&S[n]||(O[F]=t,O[F+1]=e,O[F+2]=n,F+=3)}if(i<o){const t=`rgb(${I.data[i]},${I.data[i+1]},${I.data[i+2]})`;N.setStyle(t),R[r]=N.r,R[r+1]=N.g,R[r+2]=N.b}r+=3,i+=4,s++}const U=new Uint32Array(F);for(let t=0;t<F;t++)U[t]=O[t];T.setIndex(new i.BufferAttribute(U,1)),L(T,"color",new i.BufferAttribute(R,3,!0)),r.vertexColors=D(),super(),this._initOptions(e),this._createMesh(T,r);const Q=o.altitudeToVector3(f,f).x;this.getObject3d().position.copy(new i.Vector3((s+u)/2,(a+l)/2,Q)),this.type="HeatMap"}}const Jn=new i.Color;let Kn=1;class Zn{constructor(t){this.object3ds=[],this.layer=t,this.camera=t.getCamera(),this.renderer=t.getThreeRenderer(),this.pickingTexture=P>=152?new i.WebGLRenderTarget(1,1,{format:i.RGBAFormat,colorSpace:i.SRGBColorSpace}):new i.WebGLRenderTarget(1,1,{}),this.pickingScene=new i.Scene}getColor(){return Jn.setHex(Kn),Kn++,Jn}add(t){if(t){const e=t._colorIndex;e&&(this.object3ds[e]=t,this.pickingScene.add(t))}return this}remove(t){if(t){const e=t._colorIndex;e&&(this.object3ds[e]=null,this.pickingScene.remove(t))}return this}isEmpty(){if(0===this.pickingScene.children.length)return!0;for(let t=0,e=this.pickingScene.children.length;t<e;t++){const e=this.pickingScene.children[t];if(e){const t=e.__parent;if(t&&!0===t.getOptions().interactive)return!1}}return!0}pick(t){if(!t)return;if(this.isEmpty())return;const{camera:e,renderer:r,pickingTexture:n,pickingScene:i,object3ds:o,layer:s}=this,a=this.pickingScene.children.length;for(let t=0;t<a;t++){const e=this.pickingScene.children[t];e&&e.__parent&&(e.__parent.picked=!1)}const{width:u,height:l}=s._getRenderer().canvas,h=n.width,c=n.height;u===h&&l===c||n.setSize(u,l),r.setRenderTarget(n),r.clear(),e&&e.layers&&this.camera.layers.set(0),r.render(i,e);const f=new Uint8Array(4),{x:p,y:d}=t;let g=window.devicePixelRatio;const y=s.getMap();y&&(g=y.getDevicePixelRatio?y.getDevicePixelRatio():y.options.devicePixelRatio);const v=p*g,m=n.height-d*g;r.readRenderTargetPixels(n,Math.round(v),Math.round(m),1,1,f);const A=f[0]<<16|f[1]<<8|f[2],_=o[A];if(_)_.__parent&&(o[A].__parent.picked=!0);else for(let t=0;t<a;t++){const e=this.pickingScene.children[t];if(e&&e.__parent){const t=e.__parent;if(t._colorMap&&null!=t._colorMap[A]){t.picked=!0,t.index=t._colorMap[A];break}}}r.setRenderTarget(null)}}const $n={bottomHeight:0,altitude:0};class ti extends H{constructor(t,e,r,i){e=n.Util.extend({},$n,e,{layer:i,lineString:t}),super(),this._initOptions(e);const{asynchronous:o}=e,{lineStrings:s,center:a}=je(t),u=new z;let l;if(o){const e=n.Util.GUID();this.getOptions().id=e,this.getOptions().center=a,fr.push({id:e,data:s,lineString:t,center:a,layer:i,baseObject:this})}else{const t=[],r={};for(let n=0,o=s.length;n<o;n++){const o=Fe(s[n],i,a,!1).positions;xe(o,e.bottomHeight,i,r),t.push(Ve(o))}l=qe(t),u.setPositions(l)}this._setMaterialRes(i,r),this._createLine2(u,r);const{altitude:h}=e,c=i.altitudeToVector3(h,h).x,f=i.coordinateToVector3(a,c);this.getObject3d().position.copy(f),o||(this._setPickObject3d(l,r.linewidth),this._init()),this.type="FatLine"}_init(){const t=this.getLayer().getPick();this.on("add",(()=>{t.add(this.pickObject3d)})),this.on("remove",(()=>{t.remove(this.pickObject3d)}))}_setMaterialRes(t,e){const r=t.getMap();if(!r)return this;const n=r.getSize(),i=n.width,o=n.height;e.resolution.set(i,o)}_setPickObject3d(t,e){const r=new z;r.setPositions(t);const n=this.getLayer().getPick().getColor(),i=[];for(let e=0,r=t.length/3;e<r;e++)i.push(n.r,n.g,n.b);r.setColors(i);const o=new Q({color:"#fff",linewidth:e,vertexColors:D()});this._setMaterialRes(this.getLayer(),o);const s=n.getHex(),a=new j(r,o);a.position.copy(this.getObject3d().position),a._colorIndex=s,this.setPickObject3d(a)}identify(t){return this.picked}setSymbol(t){if(t&&t instanceof i.Material){t.needsUpdate=!0;const e=this.getMap().getSize(),r=e.width,n=e.height;t.resolution.set(r,n),this.getObject3d().material=t}return this}_workerLoad(t){const e=new Float32Array(t.position),r=this.getObject3d();if(r.geometry.setPositions(e),r.computeLineDistances(),this._setPickObject3d(e,r.material.linewidth),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}_animation(){const t=this.getLayer();if(!t)return this;[this.getObject3d(),this.getPickObject3d()].forEach((e=>{e&&this._setMaterialRes(t,e.material)}))}}const ei={altitude:0,colors:null};class ri extends(tn(H)){constructor(t,e,r,i){Array.isArray(t)||(t=[t]);const o=[],s=[],a=t.length;for(let e=0;e<a;e++){const r=je(t[e]);o.push(r.center),s.push(r.lineStrings)}const u=_e(o);e=n.Util.extend({},ei,e,{layer:i,lineStrings:t,coordinate:u}),super(),this._initOptions(e);const{asynchronous:l}=e,h=new z,c=[],f={};let p,d,g=[],y=0,v=[];if(l)pr.push({id:n.Util.GUID(),data:s,key:e.key,center:u,layer:i,baseObject:this,lineStrings:t,option:e});else{for(let t=0;t<a;t++){const r=s[t];let o=0;for(let t=0,s=r.length;t<s;t++){const s=Se(r[t]),a=n.Util.extend({},e,s),{positions:l}=Fe(r[t],i,u,!1);xe(l,a.bottomHeight,i,f),o+=l.length/3*2-2,v.push(Ve(l))}g[t]={position:{count:o,start:y,end:y+3*o},instanceStart:{count:o,start:y,end:y+3*o},instanceEnd:{count:o,start:y,end:y+3*o},hide:!1},y+=3*o}p=qe(v),h.setPositions(p)}this._setMaterialRes(i,r),this._createLine2(h,r);const{altitude:m}=e,A=i.altitudeToVector3(m,m).x,_=i.coordinateToVector3(u,A);this.getObject3d().position.copy(_),this._baseObjects=c,this._datas=t,this._geometriesAttributes=g,this.faceIndex=null,this.index=null,this._geometryCache=new z,l||(d=new Float32Array(p),this._geometryCache.setPositions(d)),this._colorMap={},this.isHide=!1,this._initBaseObjectsEvent(c),l||(this._setPickObject3d(d,r.linewidth),this._init()),this.type="FatLines"}_setMaterialRes(t,e){const r=t.getMap();if(!r)return this;const n=r.getSize(),i=n.width,o=n.height;e.resolution.set(i,o)}_setPickObject3d(t,e){if(!this._colorMap)return;const r=this._geometryCache||new z;r.setPositions(t);const n=this.getLayer().getPick(),{_geometriesAttributes:i}=this,o=we(i);let s=0;for(let t=0,e=i.length;t<e;t++){const e=n.getColor(),r=e.getHex();this._colorMap[r]=t;const{count:a}=i[t].position;this._datas[t].colorIndex=r;for(let t=0;t<a;t++)o[s]=e.r,o[s+1]=e.g,o[s+2]=e.b,s+=3}r.setColors(o);const a=new Q({color:"#fff",linewidth:e,vertexColors:D()});this._setMaterialRes(this.getLayer(),a);const u=n.getColor().getHex(),l=new j(r,a);l.position.copy(this.getObject3d().position),l._colorIndex=u,this.setPickObject3d(l)}identify(t){return this.picked}setSymbol(t){if(t&&t instanceof i.Material){t.needsUpdate=!0;const e=this.getMap().getSize(),r=e.width,n=e.height;t.resolution.set(r,n),this.getObject3d().material=t}return this}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],r=n.Util.extend({},this.getOptions(),{index:t},K(e)?e.properties:e.getProperties());this._baseObjects[t]=new ti(e,r,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}_updateAttribute(t,e){const{indexs:r}=this._getHideGeometryIndex(e),n=this._geometryCache.attributes[e].array,i=n.length;for(let e=0;e<i;e++)t.array[e]=n[e];for(let n=0;n<r.length;n++){const i=r[n],{start:o,end:s}=this._geometriesAttributes[i][e];for(let e=o;e<s;e++)t.array[e]=-1e5}return this}_showGeometry(t,e){let r;if(t&&(r=t.getOptions().index),null!=r){const t=this._geometriesAttributes[r],{hide:n}=t;if(n===e)return this;t.hide=e;const i=this.getObject3d().geometry;this._updateAttribute(i.attributes.instanceStart,"instanceStart"),this._updateAttribute(i.attributes.instanceEnd,"instanceEnd"),i.attributes.instanceStart.data.needsUpdate=!0,i.attributes.instanceEnd.data.needsUpdate=!0,this.isHide=e}return this}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const r=this.getObject3d(),n=new Float32Array(t.position),i=new Float32Array(n);if(r.geometry.setPositions(new Float32Array(n)),this._geometryCache.setPositions(i),this._setPickObject3d(i,r.material.linewidth),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}_animation(){const t=this.getLayer();if(!t)return this;[this.getObject3d(),this.getPickObject3d()].forEach((e=>{e&&this._setMaterialRes(t,e.material)}))}}const ni={radius:10,height:100,altitude:0,topColor:"",bottomColor:"#2d2f61",heightEnable:!0};class ii extends H{constructor(t,e,r,i){e=n.Util.extend({},ni,e,{layer:i,coordinate:t}),super(),this._initOptions(e);const{height:o,radius:s,topColor:a,bottomColor:u,altitude:l}=e,h=i.altitudeToVector3(o,o).x,c=i.distanceToVector3(s,s).x,f=Lr().clone();f.scale(2*c,2*c,h),a&&(kr(f,u,a,"z",h/2),r.vertexColors=D()),this._createMesh(f,r);const p=i.altitudeToVector3(l,l).x,d=i.coordinateToVector3(t,p);this.getObject3d().position.copy(d),this.type="Box"}}const oi={radius:10,height:100,altitude:0,topColor:null,bottomColor:"#2d2f61"};class si extends(tn(H)){constructor(t,e,r,i){Array.isArray(t)||(t=[t]);const o=t.length,s=_e(t),a=i.coordinateToVector3(s),u=[],l=[],h=[];let c=0;e=n.Util.extend({},{altitude:0,layer:i,points:t},oi,e);const f={},p={};for(let s=0;s<o;s++){const o=n.Util.extend({index:s},e,t[s]),{radius:d,altitude:g,topColor:y,bottomColor:v,height:m,coordinate:A}=o,_=me(d,i,f),x=Ae(m,i,p),w=Ae(g,i,p),b=Lr().clone();b.scale(2*_,2*_,x),y&&(kr(b,v,y,"z",x/2),r.vertexColors=D());const E=i.coordinateToVector3(A).sub(a),I=b.attributes.position.array;for(let t=0,e=I.length;t<e;t+=3)I[t+2]+=w,I[t]+=E.x,I[t+1]+=E.y,I[t+2]+=E.z;u.push(b);const C=new ii(A,o,r,i);l.push(C),b.index.count;const S=b.attributes.position.count;b.attributes.normal.count,b.attributes.uv.count,h[s]={position:{count:S,start:c,end:c+3*S},hide:!1},c+=3*S}super(),this._initOptions(e);const d=Pr(u);this._createMesh(d,r);const g=e.altitude,y=i.altitudeToVector3(g,g).x,v=a.clone();v.z=y,this.getObject3d().position.copy(v),this._baseObjects=l,this._datas=t,this._geometriesAttributes=h,this.faceIndex=null,this._geometryCache=br(d),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(l),this._setPickObject3d(),this._init(),this.type="Boxs"}identify(t){return this.picked}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function ai(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})})),e}var ui={exports:{}};function li(t,e,r){r=r||2;var n,i,o,s,a,u,l,h=e&&e.length,c=h?e[0]*r:t.length,f=hi(t,0,c,r,!0),p=[];if(!f||f.next===f.prev)return p;if(h&&(f=function(t,e,r,n){var i,o,s,a=[];for(i=0,o=e.length;i<o;i++)(s=hi(t,e[i]*n,i<o-1?e[i+1]*n:t.length,n,!1))===s.next&&(s.steiner=!0),a.push(xi(s));for(a.sort(vi),i=0;i<a.length;i++)r=mi(a[i],r);return r}(t,e,f,r)),t.length>80*r){n=o=t[0],i=s=t[1];for(var d=r;d<c;d+=r)(a=t[d])<n&&(n=a),(u=t[d+1])<i&&(i=u),a>o&&(o=a),u>s&&(s=u);l=0!==(l=Math.max(o-n,s-i))?32767/l:0}return fi(f,p,r,n,i,l,0),p}function hi(t,e,r,n,i){var o,s;if(i===Ri(t,e,r,n)>0)for(o=e;o<r;o+=n)s=ki(o,t[o],t[o+1],s);else for(o=r-n;o>=e;o-=n)s=ki(o,t[o],t[o+1],s);return s&&Ii(s,s.next)&&(Pi(s),s=s.next),s}function ci(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!Ii(n,n.next)&&0!==Ei(n.prev,n,n.next))n=n.next;else{if(Pi(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function fi(t,e,r,n,i,o,s){if(t){!s&&o&&function(t,e,r,n){var i=t;do{0===i.z&&(i.z=_i(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,o,s,a,u,l=1;do{for(r=t,t=null,o=null,s=0;r;){for(s++,n=r,a=0,e=0;e<l&&(a++,n=n.nextZ);e++);for(u=l;a>0||u>0&&n;)0!==a&&(0===u||!n||r.z<=n.z)?(i=r,r=r.nextZ,a--):(i=n,n=n.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,l*=2}while(s>1)}(i)}(t,n,i,o);for(var a,u,l=t;t.prev!==t.next;)if(a=t.prev,u=t.next,o?di(t,n,i,o):pi(t))e.push(a.i/r|0),e.push(t.i/r|0),e.push(u.i/r|0),Pi(t),t=u.next,l=u.next;else if((t=u)===l){s?1===s?fi(t=gi(ci(t),e,r),e,r,n,i,o,2):2===s&&yi(t,e,r,n,i,o):fi(ci(t),e,r,n,i,o,1);break}}}function pi(t){var e=t.prev,r=t,n=t.next;if(Ei(e,r,n)>=0)return!1;for(var i=e.x,o=r.x,s=n.x,a=e.y,u=r.y,l=n.y,h=i<o?i<s?i:s:o<s?o:s,c=a<u?a<l?a:l:u<l?u:l,f=i>o?i>s?i:s:o>s?o:s,p=a>u?a>l?a:l:u>l?u:l,d=n.next;d!==e;){if(d.x>=h&&d.x<=f&&d.y>=c&&d.y<=p&&wi(i,a,o,u,s,l,d.x,d.y)&&Ei(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function di(t,e,r,n){var i=t.prev,o=t,s=t.next;if(Ei(i,o,s)>=0)return!1;for(var a=i.x,u=o.x,l=s.x,h=i.y,c=o.y,f=s.y,p=a<u?a<l?a:l:u<l?u:l,d=h<c?h<f?h:f:c<f?c:f,g=a>u?a>l?a:l:u>l?u:l,y=h>c?h>f?h:f:c>f?c:f,v=_i(p,d,e,r,n),m=_i(g,y,e,r,n),A=t.prevZ,_=t.nextZ;A&&A.z>=v&&_&&_.z<=m;){if(A.x>=p&&A.x<=g&&A.y>=d&&A.y<=y&&A!==i&&A!==s&&wi(a,h,u,c,l,f,A.x,A.y)&&Ei(A.prev,A,A.next)>=0)return!1;if(A=A.prevZ,_.x>=p&&_.x<=g&&_.y>=d&&_.y<=y&&_!==i&&_!==s&&wi(a,h,u,c,l,f,_.x,_.y)&&Ei(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;A&&A.z>=v;){if(A.x>=p&&A.x<=g&&A.y>=d&&A.y<=y&&A!==i&&A!==s&&wi(a,h,u,c,l,f,A.x,A.y)&&Ei(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;_&&_.z<=m;){if(_.x>=p&&_.x<=g&&_.y>=d&&_.y<=y&&_!==i&&_!==s&&wi(a,h,u,c,l,f,_.x,_.y)&&Ei(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function gi(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!Ii(i,o)&&Ci(i,n,n.next,o)&&Bi(i,o)&&Bi(o,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(o.i/r|0),Pi(n),Pi(n.next),n=t=o),n=n.next}while(n!==t);return ci(n)}function yi(t,e,r,n,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&bi(s,a)){var u=Ti(s,a);return s=ci(s,s.next),u=ci(u,u.next),fi(s,e,r,n,i,o,0),void fi(u,e,r,n,i,o,0)}a=a.next}s=s.next}while(s!==t)}function vi(t,e){return t.x-e.x}function mi(t,e){var r=function(t,e){var r,n=e,i=t.x,o=t.y,s=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>s&&(s=a,r=n.x<n.next.x?n:n.next,a===i))return r}n=n.next}while(n!==e);if(!r)return null;var u,l=r,h=r.x,c=r.y,f=1/0;n=r;do{i>=n.x&&n.x>=h&&i!==n.x&&wi(o<c?i:s,o,h,c,o<c?s:i,o,n.x,n.y)&&(u=Math.abs(o-n.y)/(i-n.x),Bi(n,t)&&(u<f||u===f&&(n.x>r.x||n.x===r.x&&Ai(r,n)))&&(r=n,f=u)),n=n.next}while(n!==l);return r}(t,e);if(!r)return e;var n=Ti(r,t);return ci(n,n.next),ci(r,r.next)}function Ai(t,e){return Ei(t.prev,t,e.prev)<0&&Ei(e.next,t,t.next)<0}function _i(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function xi(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function wi(t,e,r,n,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(n-a)>=(r-s)*(e-a)&&(r-s)*(o-a)>=(i-s)*(n-a)}function bi(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Ci(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Bi(t,e)&&Bi(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(Ei(t.prev,t,e.prev)||Ei(t,e.prev,e))||Ii(t,e)&&Ei(t.prev,t,t.next)>0&&Ei(e.prev,e,e.next)>0)}function Ei(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Ii(t,e){return t.x===e.x&&t.y===e.y}function Ci(t,e,r,n){var i=Mi(Ei(t,e,r)),o=Mi(Ei(t,e,n)),s=Mi(Ei(r,n,t)),a=Mi(Ei(r,n,e));return i!==o&&s!==a||(!(0!==i||!Si(t,r,e))||(!(0!==o||!Si(t,n,e))||(!(0!==s||!Si(r,t,n))||!(0!==a||!Si(r,e,n)))))}function Si(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Mi(t){return t>0?1:t<0?-1:0}function Bi(t,e){return Ei(t.prev,t,t.next)<0?Ei(t,e,t.next)>=0&&Ei(t,t.prev,e)>=0:Ei(t,e,t.prev)<0||Ei(t,t.next,e)<0}function Ti(t,e){var r=new Li(t.i,t.x,t.y),n=new Li(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function ki(t,e,r,n){var i=new Li(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Pi(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 Li(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ri(t,e,r,n){for(var i=0,o=e,s=r-n;o<r;o+=n)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}ui.exports=li,ui.exports.default=li,li.deviation=function(t,e,r,n){var i=e&&e.length,o=i?e[0]*r:t.length,s=Math.abs(Ri(t,0,o,r));if(i)for(var a=0,u=e.length;a<u;a++){var l=e[a]*r,h=a<u-1?e[a+1]*r:t.length;s-=Math.abs(Ri(t,l,h,r))}var c=0;for(a=0;a<n.length;a+=3){var f=n[a]*r,p=n[a+1]*r,d=n[a+2]*r;c+=Math.abs((t[f]-t[d])*(t[p+1]-t[f+1])-(t[f]-t[p])*(t[d+1]-t[f+1]))}return 0===s&&0===c?0:Math.abs((c-s)/s)},li.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)r.vertices.push(t[i][o][s]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r};var Di=ui.exports;function Oi(t,e,r){var n=e[0],i=e[1],o=r[0]-n,s=r[1]-i;if(0!==o||0!==s){var a=((t[0]-n)*o+(t[1]-i)*s)/(o*o+s*s);a>1?(n=r[0],i=r[1]):a>0&&(n+=o*a,i+=s*a)}return(o=t[0]-n)*o+(s=t[1]-i)*s}function Ni(t,e,r,n,i){for(var o,s=n,a=e+1;a<r;a++){var u=Oi(t[a],t[e],t[r]);u>s&&(o=a,s=u)}s>n&&(o-e>1&&Ni(t,e,o,n,i),i.push(t[o]),r-o>1&&Ni(t,o,r,n,i))}function Fi(t,e){var r=t.length-1,n=[t[0]];return Ni(t,0,r,e,n),n.push(t[r]),n}function Ui(t,e,r){if(t.length<=2)return t;var n=void 0!==e?e*e:1;return t=r?t:function(t,e){for(var r,n,i,o,s,a=t[0],u=[a],l=1,h=t.length;l<h;l++)r=t[l],i=a,o=void 0,s=void 0,o=(n=r)[0]-i[0],s=n[1]-i[1],o*o+s*s>e&&(u.push(r),a=r);return a!==r&&u.push(r),u}(t,n),t=Fi(t,n)}function Qi(t,e){return t[0]*e[0]+t[1]*e[1]}function Gi(t,e){const r=e[0],n=e[1],i=Math.sqrt(r*r+n*n);return t[0]=r/i,t[1]=n/i,t}function zi(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}function ji(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t}function Vi(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function qi(t,e){const r=e[0],n=e[1],i=e[2],o=Math.sqrt(r*r+n*n+i*i);return t[0]=r/o,t[1]=n/o,t[2]=i/o,t}function Hi(t,e,r){var n=e[0],i=e[1],o=e[2],s=r[0],a=r[1],u=r[2];return t[0]=i*u-o*a,t[1]=o*s-n*u,t[2]=n*a-i*s,t}const Wi=[];function Yi(t,e,r,n){const i=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}(e,r),o=Math.acos(i)*n;return zi(Wi,r,e,-i),function(t,e){const r=e[0],n=e[1],i=e[2],o=Math.sqrt(r*r+n*n+i*i);t[0]=r/o,t[1]=n/o,t[2]=i/o}(Wi,Wi),function(t,e,r){t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r}(t,e,Math.cos(o)),zi(t,t,Wi,Math.sin(o)),t}function Xi(t,e,r,n,i,o,s,a,u,l){const h=s-i,c=a-o,f=(h*(e-o)-c*(t-i))/(c*(r-t)-h*(n-e));return u&&(u[l=l||0]=t+f*(r-t),u[l+1]=e+f*(n-e)),f}function Ji(t,e,r){if(r-e<3)return 0;let n=0;for(let i=2*(r-1),o=2*e;o<2*r;){const e=t[i],r=t[i+1],s=t[o],a=t[o+1];i=o,o+=2,n+=e*a-s*r}return n}function Ki(t,e,r=2){return Di(t,e,r)}const Zi=[],$i=[],to=[];function eo(t,e,r,n,i,o,s,a,u){const l=null!=s;let h,c,f,p=i,d=null;l&&(d=new Uint32Array(n-r));let g=[];for(let i=r;i<n;i++){const y=i===n-1?r:i+1,v=i===r?n-1:i-1,m=t[2*v],A=t[2*v+1],_=t[2*i],x=t[2*i+1],w=t[2*y],b=t[2*y+1];Zi[0]=_-m,Zi[1]=x-A,$i[0]=w-_,$i[1]=b-x,Gi(Zi,Zi),Gi($i,$i),l&&(d[i]=p);let E,I,C=!1;if(a||i!==r)if(a||i!==n-1){ji(to,$i,Zi);const t=to[1];to[1]=-to[0],to[0]=t,Gi(to,to);const r=Qi(to,$i),n=Math.sqrt(1-r*r),i=o*Math.min(10,1/n);if(l&&1/n>s&&o*r<0){const t=_+to[0]*o,r=x+to[1]*o,i=Math.acos(n)/2,s=Math.tan(i)*Math.abs(o);e[2*p]=t+to[1]*s,e[2*p+1]=r-to[0]*s,p++,e[2*p]=t-to[1]*s,e[2*p+1]=r+to[0]*s,p++}else E=_+to[0]*i,I=x+to[1]*i,C=!0;if(C){if(u&&null!=h){const t=Xi(m,A,h,c,_,x,E,I,g,0);t>=-.01&&t<=1.01&&(e[2*f]=E=g[0],e[2*f+1]=I=g[1])}h=e[2*p]=E,c=e[2*p+1]=I,f=p,p++}}else to[0]=Zi[1],to[1]=-Zi[0],Gi(to,to),E=_+to[0]*o,I=x+to[1]*o,C=!0;else to[0]=$i[1],to[1]=-$i[0],Gi(to,to),h=e[2*p]=_+to[0]*o,c=e[2*p+1]=x+to[1]*o,f=p,p++}return d}function ro(t,e,r,n,i){const o=null!=n?[]:new Float32Array(t.length);if(eo(t,o,0,e&&e.length?e[0]:t.length/2,0,r,n,i,!0),e)for(let s=0;s<e.length;s++){const a=e[s];eo(t,o,a,e[s+1]||t.length/2,null!=n?o.length/2:a,r,n,i,!1)}return o}function no(t,e,r,n){for(let i=0;i<Math.floor((n-r)/2);i++)for(let o=0;o<e;o++){const s=(i+r)*e+o,a=(n-i-1)*e+o,u=t[s];t[s]=t[a],t[a]=u}return t}function io(t,e){let r=t.length/2,n=0,i=e&&e.length?e[0]:r;Ji(t,n,i)>0&&no(t,2,n,i);for(let o=1;o<(e?e.length:0)+1;o++)n=e[o-1],i=e[o]||r,Ji(t,n,i)<0&&no(t,2,n,i)}const oo=[[0,0],[1,0],[1,1],[0,0],[1,1],[0,1]];function so(t,e,r){let n=0,i=t[e],o=t[e+1];const s=i,a=o;for(let s=e+2;s<r;s+=2){const e=t[s],r=t[s+1];n+=Math.sqrt((e-i)*(e-i)+(r-o)*(r-o)),i=e,o=r}return n+=Math.sqrt((i-s)*(i-s)+(o-a)*(o-a)),n}function ao(t,{vertices:e,topVertices:r,splittedMap:n,depth:i,rect:o},s,a,u,l){const h=a-s,c=l.smoothBevel?1:2,f=Math.min(i/2,l.bevelSize),p=l.bevelSegments,d=u.vertex,g=u.ringPerimeter,y=Math.max(o.width,o.height,i,g);function v(t){const r=(t+1)%h,n=e[2*t],i=e[2*t+1],o=e[2*r],s=e[2*r+1];return n===o&&i===s}if(f>0){const o=[0,0,1],a=[],l=[0,0,-1],g=[];let m=0,A=new Float32Array(h);for(let _=0;_<2;_++){const x=0===_?i-f:f;for(let i=0;i<=p*c;i++){let w,b,E=0;for(let I=0;I<h;I++){const C=2*(I%h+s),S=n?2*n[C/2]:C;a[0]=e[C]-r[S],a[1]=e[C+1]-r[S+1],a[2]=0;const M=Math.sqrt(a[0]*a[0]+a[1]*a[1]);a[0]/=M,a[1]/=M;const B=(Math.floor(i/c)+i%c)/p;0===_?Yi(g,o,a,B):Yi(g,a,l,B);const T=0===_?B:1-B,k=f*Math.sin(T*Math.PI/2),P=M*Math.cos(T*Math.PI/2),L=f*M/Math.sqrt(k*k+P*P),R=g[0]*L+r[S],D=g[1]*L+r[S+1],O=g[2]*L+x;if(t.position[3*u.vertex]=R,t.position[3*u.vertex+1]=D,t.position[3*u.vertex+2]=O,I>0&&(E+=Math.sqrt((w-R)*(w-R)+(b-D)*(b-D))),i>0||_>0){let e=3*(u.vertex-h),r=t.position[e],n=t.position[e+1],i=t.position[e+2];A[I]+=Math.sqrt((r-R)*(r-R)+(n-D)*(n-D)+(i-O)*(i-O))}if(t.uv[2*u.vertex]=E/y,t.uv[2*u.vertex+1]=A[I]/y,w=R,b=D,u.vertex++,!v(I)&&(c>1&&i%c||1===c&&i>=1))for(let e=0;e<6;e++){const r=(oo[e][0]+I)%h,n=oo[e][1]+m;t.indices[u.index++]=(n-1)*h+r+d}}m++}}}else for(let r=0;r<2;r++){const n=0===r?i-f:f;let o,a,l=0;for(let r=0;r<h;r++){const i=2*(r%h+s),c=e[i],f=e[i+1];t.position[3*u.vertex]=c,t.position[3*u.vertex+1]=f,t.position[3*u.vertex+2]=n,r>0&&(l+=Math.sqrt((o-c)*(o-c)+(a-f)*(a-f))),t.uv[2*u.vertex]=l/y,t.uv[2*u.vertex+1]=n/y,o=c,a=f,u.vertex++}}const m=f>0?p*c+1:1;for(let e=0;e<h;e++)if(!v(e))for(let r=0;r<6;r++){const n=(oo[r][0]+e)%h,i=oo[r][1]+m;t.indices[u.index++]=(i-1)*h+n+d}}function uo({indices:t,topVertices:e,rect:r,depth:n},i,o,s){if(e.length<=4)return;const a=o.vertex,u=t.length;for(let e=0;e<u;e++)i.indices[o.index++]=a+t[e];const l=Math.max(r.width,r.height);for(let t=0;t<(s.excludeBottom?1:2);t++)for(let s=0;s<e.length;s+=2){const a=e[s],u=e[s+1];i.position[3*o.vertex]=a,i.position[3*o.vertex+1]=u,i.position[3*o.vertex+2]=(1-t)*n,i.uv[2*o.vertex]=(a-r.x)/l,i.uv[2*o.vertex+1]=(u-r.y)/l,o.vertex++}if(!s.excludeBottom){const r=e.length/2;for(let e=0;e<u;e+=3)for(let n=0;n<3;n++)i.indices[o.index++]=a+r+t[e+2-n]}}function lo(t,e,r,n){const i=null==r||"auto"===r;if(!0===r)return{vertices:t,holes:e};const o=[],s=e&&[],a=t.length/2,u=[],l=[],h=[];let c=0,f=0;const p=(e?e.length:0)+1;for(let r=0;r<p;r++){0===r?f=e&&e.length?e[0]:a:(c=e[r-1],f=e[r]||a);for(let e=c;e<f;e++){const r=t[2*e],s=t[2*e+1],a=e===f-1?c:e+1,p=t[2*a],d=t[2*a+1];if(i){const i=e===c?f-1:e-1,a=t[2*i],g=t[2*i+1];u[0]=a-r,u[1]=g-s,l[0]=p-r,l[1]=d-s,Gi(u,u),Gi(l,l);1-(.5*Qi(u,l)+.5)>n?(o.push(r,s),h.push(e)):(o.push(r,s,r,s),h.push(e,e))}else o.push(r,s,r,s),h.push(e,e)}r<p-1&&s&&s.push(o.length/2)}return{vertices:new Float32Array(o),splittedMap:h,holes:s}}function ho(t,e){let r=0,n=0;for(let i=0;i<t.length;i++){const{indices:o,vertices:s,splittedMap:a,topVertices:u,depth:l}=t[i],h=Math.min(l/2,e.bevelSize)>0?e.bevelSegments:0,c=t[i].holes||[];r+=o.length*(e.excludeBottom?1:2),n+=u.length/2*(e.excludeBottom?1:2);const f=2+2*h;let p=0,d=0;for(let t=0;t<c.length+1;t++){0===t?d=c.length?c[0]:s.length/2:(p=c[t-1],d=c[t]||s.length/2);r+=6*((a?a[d-1]+1:d)-(a?a[p]:p))*(f-1);const i=d-p;n+=i*f+(e.smoothBevel?0:h*i*2)}}const i={position:new Float32Array(3*n),indices:new(n>65535?Uint32Array:Uint16Array)(r),uv:new Float32Array(2*n)},o={vertex:0,index:0,ringPerimeter:0};for(let r=0;r<t.length;r++)uo(t[r],i,o,e);for(let r=0;r<t.length;r++){const{holes:n,vertices:s}=t[r],a=s.length/2;let u=0,l=n&&n.length?n[0]:a;if(o.ringPerimeter=so(t[r].topVertices,u,l),ao(i,t[r],u,l,o,e),n)for(let s=0;s<n.length;s++)u=n[s],l=n[s+1]||a,o.ringPerimeter=so(t[r].topVertices,u,l),ao(i,t[r],u,l,o,e)}for(let t=0;t<i.uv.length;t++){const e=i.uv[t];e>0&&Math.round(e)===e?i.uv[t]=1:i.uv[t]=e%1}return i.normal=function(t,e){function r(t,e,r,n){t[0]=e,t[1]=r,t[2]=n}const n=[],i=[],o=[],s=[],a=[],u=[],l=t.length,h=new Float32Array(e.length);for(let c=0;c<l;){const l=3*t[c++],f=3*t[c++],p=3*t[c++];r(n,e[l],e[l+1],e[l+2]),r(i,e[f],e[f+1],e[f+2]),r(o,e[p],e[p+1],e[p+2]),Vi(s,n,i),Vi(a,i,o),Hi(u,s,a);for(let t=0;t<3;t++)h[l+t]=h[l+t]+u[t],h[f+t]=h[f+t]+u[t],h[p+t]=h[p+t]+u[t]}for(var c=0;c<h.length;)r(u,h[c],h[c+1],h[c+2]),qi(u,u),h[c++]=u[0],h[c++]=u[1],h[c++]=u[2];return h}(i.indices,i.position),i.boundingRect=t[0]&&t[0].rect,i}function co(t,e){const r=[];for(let n=0;n<t.length;n++){const i=t[n],o=[],s=i.length;let a=i[s-1][0],u=i[s-1][1],l=0;for(let t=0;t<s;t++){let r=i[t][0],n=i[t][1];const s=r-a,h=n-u;l+=Math.sqrt(s*s+h*h),l>e&&(o.push(i[t]),l=0),a=r,u=n}o.length>=3&&r.push(o)}return r.length>0?r:null}function fo(t,e){const r=[];for(let n=0;n<t.length;n++){let i=t[n];i=Ui(i,e,!0),i.length>=3&&r.push(i)}return r.length>0?r:null}function po(t,e){e=Object.assign({},e);const r=[1/0,1/0],n=[-1/0,-1/0];for(let e=0;e<t.length;e++)go(t[e][0],r,n);e.boundingRect=e.boundingRect||{x:r[0],y:r[1],width:n[0]-r[0],height:n[1]-r[1]},function(t){t.depth=t.depth||1,t.bevelSize=t.bevelSize||0,t.bevelSegments=null==t.bevelSegments?2:t.bevelSegments,t.smoothBevel=t.smoothBevel||!1,t.simplify=t.simplify||0,null==t.smoothSide&&(t.smoothSide="auto"),null==t.smoothSideThreshold&&(t.smoothSideThreshold=.9),"number"==typeof t.depth&&(t.bevelSize=Math.min(t.bevelSegments>0?t.bevelSize:0,t.depth/2)),t.bevelSize>0||(t.bevelSegments=0),t.bevelSegments=Math.round(t.bevelSegments);const e=t.boundingRect;if(t.translate=t.translate||[0,0],t.scale=t.scale||[1,1],t.fitRect){let r=null==t.fitRect.x?e.x||0:t.fitRect.x,n=null==t.fitRect.y?e.y||0:t.fitRect.y,i=t.fitRect.width,o=t.fitRect.height;null==i?null!=o?i=o/e.height*e.width:(i=e.width,o=e.height):null==o&&(o=i/e.width*e.height),t.scale=[i/e.width,o/e.height],t.translate=[(r-e.x)*t.scale[0],(n-e.y)*t.scale[1]]}}(e);const i=[],o=e.translate||[0,0],s=e.scale||[1,1],a=e.boundingRect,u={x:a.x*s[0]+o[0],y:a.y*s[1]+o[1],width:a.width*s[0],height:a.height*s[1]},l=Math.min(a.width,a.height)/1e5;for(let r=0;r<t.length;r++){let n=co(t[r],l);if(!n)continue;const a=e.simplify/Math.max(s[0],s[1]);if(a>0&&(n=fo(n,a)),!n)continue;const{vertices:h,holes:c,dimensions:f}=Di.flatten(n);for(let t=0;t<h.length;)h[t]=h[t++]*s[0]+o[0],h[t]=h[t++]*s[1]+o[1];if(io(h,c),2!==f)throw new Error("Only 2D polygon points are supported");const p=e.bevelSize>0?ro(h,c,e.bevelSize,null,!0):h,d=Ki(p,c,f),g=lo(h,c,e.smoothSide,e.smoothSideThreshold);i.push({indices:d,vertices:g.vertices,rawVertices:h,topVertices:p,holes:g.holes,splittedMap:g.splittedMap,rect:u,depth:"function"==typeof e.depth?e.depth(r):e.depth})}return ho(i,e)}function go(t,e,r){for(let n=0;n<t.length;n++)e[0]=Math.min(t[n][0],e[0]),e[1]=Math.min(t[n][1],e[1]),r[0]=Math.max(t[n][0],r[0]),r[1]=Math.max(t[n][1],r[1])}const yo={bottomHeight:0,width:3,cornerRadius:0,altitude:0,topColor:null,bottomColor:"#2d2f61",heightEnable:!0};class vo extends H{constructor(t,e,r,i){e=n.Util.extend({},yo,e,{layer:i,lineString:t}),super(),this._initOptions(e);const{width:o,cornerRadius:s,bottomHeight:a,altitude:u,asynchronous:l}=e,h=i.distanceToVector3(s,s).x,c=i.distanceToVector3(o,o).x,{lineStrings:f,center:p}=je(t);let d;if(l){d=Ir();const e=n.Util.GUID();this.getOptions().id=e,this.getOptions().center=p,yr.push({id:e,data:f,layer:i,center:p,lineString:t,baseObject:this})}else{const t=[],e={};for(let r=0,n=f.length;r<n;r++){const n=ze(f[r],c,h,i,p);xe(n,a,i,e),t.push(n)}d=Ar(t)}this._createMesh(d,r);const g=i.altitudeToVector3(u,u).x,y=i.coordinateToVector3(p,g);this.getObject3d().position.copy(y),this.type="Path"}_workerLoad(t){const e=wr(t);this.getObject3d().geometry=e,this._fire("workerload",{target:this})}}const mo={width:3,cornerRadius:0,altitude:0,topColor:null,bottomColor:"#2d2f61"};class Ao extends(tn(H)){constructor(t,e,r,i){Array.isArray(t)||(t=[t]);const o=[],s=[],a=t.length;for(let e=0;e<a;e++){const r=je(t[e]);o.push(r.center),s.push(r.lineStrings)}const u=_e(o);e=n.Util.extend({},mo,e,{layer:i,lineStrings:t,coordinate:u});const{altitude:l,asynchronous:h}=e;let c;const f=[],p=[];if(super(),h)c=Ir(),vr.push({id:n.Util.GUID(),layer:i,key:e.key,center:u,data:s,lineStrings:t,baseObject:this,option:e});else{const r=[];let o=0;const l={},h={};for(let c=0;c<a;c++){const a=t[c],f=n.Util.extend({},e,Se(a),{index:c}),{cornerRadius:d,width:g,bottomHeight:y}=f,v=me(g,i,l),m=me(d,i,h),A=s[c],_=[];let x=0;for(let t=0,e=A.length;t<e;t++){const e=ze(A[t],v,m,i,u);x=xe(e,y,i,l),_.push(e)}const w=_r(_);r.push(w);const{position:b,normal:E,indices:I}=w;I.length;const C=b.length/3;E.length,p[c]={position:{middleZ:x,count:C,start:o,end:o+3*C},hide:!1},o+=3*C}c=Ar(r)}this._initOptions(e),this._createMesh(c,r);const d=i.altitudeToVector3(l,l).x,g=i.coordinateToVector3(u,d);this.getObject3d().position.copy(g),this._baseObjects=f,this._datas=t,this._geometriesAttributes=p,this.faceIndex=null,this._geometryCache=br(c),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(f),h||(this._setPickObject3d(),this._init()),this.type="Paths"}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],r=Object.assign({},this.options,K(e)?e.properties:e.getProperties(),{index:t});this._baseObjects[t]=new vo(e,r,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}identify(t){return this.picked}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const r=wr(t);if(this._geometryCache=br(r),this.getObject3d().geometry=r,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}const _o=Math.PI/180,xo=[[4e3,220],[2e3,100],[1e3,30],[500,15],[100,5],[50,2],[10,1],[5,.7],[2,.1],[1,.05],[.5,.02],[.4,.01],[.1,.005],[.05,.002],[.01,.001]],wo=["mouseout","mousemove","click","mousedown","mouseup","dblclick","contextmenu","touchstart","touchmove","touchend"],bo=new n.Coordinate(0,0),Eo=new n.Point(0,0),Io=new i.Vector3,Co=new Map,So="__webglFramebuffer",Mo=new i.Vector4;class Bo extends n.CanvasLayer{constructor(t,e){super(t,e),this._animationBaseObjectMap={},this._needsUpdate=!0,this._mousemoveTimeOut=0,this._mousedownTime=0,this._baseObjects=[],this._delayMeshes=[],this._meshes=[],this.type="ThreeLayer"}isMercator(){const t=this.getMap();if(!t)return!1;const e=t.getSpatialReference(),r=e._projection,n=e._resolutions;return!!(r&&"EPSG:3857"===r.code&&n&&n.length&&156543===Math.floor(n[0])&&t.getGLRes)}isRendering(){const t=this.getMap();return!!t&&(t.isInteracting()||t.isAnimating())}prepareToDraw(...t){}draw(t,e,r,n,i,o){this.renderScene(o,this)}drawOnInteracting(t,e,r,n,i,o,s){this.renderScene(s,this)}_transformHeight(t,e){if(!t)return 0;if(0===(e=e||0))return 0;return this.altitudeToVector3(e,e,null,Io).x}coordinateToVector3(t,e=0,r){const o=this.getMap();if(!o)return null;const s=Array.isArray(t);s?(bo.x=t[0],bo.y=t[1]):t instanceof n.Coordinate||(t=new n.Coordinate(t));const a=Lo(o),u=Ro(o,s?bo:t,a,Eo);return r&&(r.x=u.x,r.y=u.y,r.z=e),new i.Vector3(u.x,u.y,e)}coordinatiesToGLFloatArray(t,e,r){const i=this.getMap();if(!i)return null;const o=Lo(i),s=t.length,a=new Float32Array(2*s),u=new Float32Array(3*s);Co.clear();for(let l=0;l<s;l++){let s=t[l];const h=Array.isArray(s);h?(bo.x=s[0],bo.y=s[1]):s instanceof n.Coordinate||(s=new n.Coordinate(s));const c=Ro(i,h?bo:s,o,Eo);c.x-=e.x,c.y-=e.y;const f=2*l;a[f]=c.x,a[f+1]=c.y;const p=s;let d=p.z||p[2]||0;if(r&&!Co.has(d)){const t=this._transformHeight(r,d);Co.set(d,t)}let g=0;r&&(g=Co.get(d)||0);const y=3*l;u[y]=c.x,u[y+1]=c.y,u[y+2]=g}return{positions:u,positons2d:a}}coordinatiesToGLArray(t,e){const r=this.getMap();if(!r)return null;const i=Lo(r),o=t.length,s=new Array(o);for(let a=0;a<o;a++){let o=t[a];const u=Array.isArray(o);u?(bo.x=o[0],bo.y=o[1]):o instanceof n.Coordinate||(o=new n.Coordinate(o));const l=Ro(r,u?bo:o,i,Eo);l.x-=e.x,l.y-=e.y,s[a]=[l.x,l.y]}return s}distanceToVector3(t,e,r){if(0===t&&0===e||!n.Util.isNumber(t)||!n.Util.isNumber(e))return new i.Vector3(0,0,0);const o=this.getMap(),s=Lo(o);let a=r||o.getCenter();a instanceof n.Coordinate||(a=new n.Coordinate(a));const u=o.locate(a,t,e),l=Ro(o,a,s),h=Ro(o,u,s),c=Math.abs(h.x-l.x)*n.Util.sign(t),f=Math.abs(h.y-l.y)*n.Util.sign(e);return new i.Vector3(c,f,0)}altitudeToVector3(t,e,r,o){if(0===t||!n.Util.isNumber(t))return new i.Vector3(0,0,0);const s=this.getMap();if(s.altitudeToPoint){const e=Lo(s);let r=s.altitudeToPoint(t,e);return t<0&&r>0&&(r=-r),o?(o.x=r,o.y=r,o.z=0,o):new i.Vector3(r,r,0)}return this.distanceToVector3(t,t,r)}toShape(t){if(!t)return null;if(t instanceof n.MultiPolygon)return t.getGeometries().map((t=>this.toShape(t)));const e=t.getCenter(),r=this.coordinateToVector3(e),o=t.getShell().map((t=>{const e=this.coordinateToVector3(t).sub(r);return new i.Vector2(e.x,e.y)})),s=new i.Shape(o),a=t.getHoles();return a&&a.length>0&&(s.holes=a.map((t=>{const e=t.map((t=>{const e=this.coordinateToVector3(t).sub(r);return new i.Vector2(e.x,e.y)}));return new i.Shape(e)}))),s}toExtrudeMesh(t,e,r,o){if(!t)return null;if(t instanceof n.MultiPolygon)return t.getGeometries().map((t=>this.toExtrudeMesh(t,e,r,o)));const s=t.getCoordinates();s.forEach((t=>{for(let e=t.length-1;e>=1;e--)t[e].equals(t[e-1])&&t.splice(e,1)})),t.setCoordinates(s);const a=this.toShape(t),u=this.coordinateToVector3(t.getCenter());o=n.Util.isNumber(o)?o:e,o=this.altitudeToVector3(o,o).x;const l=this.altitudeToVector3(e,e).x,h={bevelEnabled:!1,bevelSize:1};h[parseInt(i.REVISION)>=93?"depth":"amount"]=o;const c=new i.ExtrudeGeometry(a,h);let f=c;i.BufferGeometry.prototype.fromGeometry&&(f=new i.BufferGeometry,f.fromGeometry(c));const p=new i.Mesh(f,r);return p.position.set(u.x,u.y,l-o),p}toExtrudePolygon(t,e,r){return new zr(t,e,r,this)}toBar(t,e,r){return new Dr(t,e,r,this)}toLine(t,e,r){return new Fr(t,e,r,this)}toExtrudeLine(t,e,r){return new Qr(t,e,r,this)}toModel(t,e){return new Vr(t,e,this)}toExtrudeLineTrail(t,e,r){return new Kr(t,e,r,this)}toExtrudePolygons(t,e,r){return new nn(t,e,r,this)}toPoint(t,e,r){return new un(t,e,r,this)}toPoints(t,e,r){return new dn(t,e,r,this)}toBars(t,e,r){return new yn(t,e,r,this)}toExtrudeLines(t,e,r){return new mn(t,e,r,this)}toLines(t,e,r){return new _n(t,e,r,this)}toThreeVectorTileLayer(t,e,r){return new kn(t,e,r,this)}toTerrain(t,e,r){return new Un(t,e,r,this)}toTerrainVectorTileLayer(t,e,r){return new Gn(t,e,r,this)}toHeatMap(t,e,r){return new Xn(t,e,r,this)}toFatLine(t,e,r){return new ti(t,e,r,this)}toFatLines(t,e,r){return new ri(t,e,r,this)}toBox(t,e,r){return new ii(t,e,r,this)}toBoxs(t,e,r){return new si(t,e,r,this)}toPath(t,e,r){return new vo(t,e,r,this)}toPaths(t,e,r){return new Ao(t,e,r,this)}getBaseObjects(){return this.getMeshes().filter((t=>t instanceof H))}getMeshes(){const t=this.getScene();if(!t)return[];const e=[];for(let r=0,n=t.children.length;r<n;r++){const n=t.children[r];n instanceof i.Object3D&&!(n instanceof i.Camera)&&e.push(n.__parent||n)}return e}clear(){return this.clearMesh()}clearBaseObjects(){return this.removeMesh(this.getBaseObjects())}clearMesh(){const t=this.getScene();if(!t)return this;for(let e=t.children.length-1;e>=0;e--){const r=t.children[e];if(r instanceof i.Object3D&&!(r instanceof i.Camera)){t.remove(r);const e=r.__parent;e&&e instanceof H&&(e.isAdd=!1,e.options.layer=null,e._fire("remove",{target:e}),delete this._animationBaseObjectMap[r.uuid],e._hideUI())}}return this._meshes=[],this}lookAt(t){const e=this._getRenderer();return e&&e.context.lookAt(t),this}getCamera(){const t=this._getRenderer();return t?t.camera:null}getScene(){const t=this._getRenderer();return t?t.scene:null}renderScene(t,e){const r=this._getRenderer();return r&&(r.clearCanvas(),r.renderScene(t),e||r.setToRedraw()),this}loop(t=!1){const e=this._delayMeshes;if(!e.length)return;const r=this.getMap();if(!r||r.isAnimating()||r.isInteracting())return;const n=this.options.loopRenderCount||50,i=e.slice(0,n);i&&this.addMesh(i,t),e.splice(0,n)}renderPickScene(){const t=this._getRenderer();if(t){const e=t.pick;e&&e.pick(this._containerPoint)}return this}getThreeRenderer(){const t=this._getRenderer();return t?t.context:null}getPick(){const t=this._getRenderer();return t?t.pick:null}delayAddMesh(t){if(!t)return this;Array.isArray(t)||(t=[t]);for(let e=0,r=t.length;e<r;e++)this._delayMeshes.push(t[e]);return this}addMesh(t,e=!0){if(!t)return this;Array.isArray(t)||(t=[t]);const r=this.getScene();if(t.forEach((t=>{t instanceof H?(r.add(t.getObject3d()),t.isAdd||(t.isAdd=!0,t.options.layer=this,t._fire("add",{target:t})),t._animation&&n.Util.isFunction(t._animation)&&(this._animationBaseObjectMap[t.getObject3d().uuid]=t)):t instanceof i.Object3D&&r.add(t);-1===this._meshes.indexOf(t)&&this._meshes.push(t)})),this._zoomend(),e){const t=this._getRenderer();t&&t.setToRedraw()}return this}removeMesh(t,e=!0){if(!t)return this;Array.isArray(t)||(t=[t]);const r=this.getScene();if(t.forEach((t=>{if(t instanceof H){r.remove(t.getObject3d()),t.isAdd&&(t.isAdd=!1,t.options.layer=null,t._fire("remove",{target:t}),t._hideUI()),t._animation&&n.Util.isFunction(t._animation)&&delete this._animationBaseObjectMap[t.getObject3d().uuid];const e=this._delayMeshes;if(e.length)for(let r=0,n=e.length;r<n;r++)if(e[r]===t){e.splice(r,1);break}}else t instanceof i.Object3D&&r.remove(t);for(let e=0,r=this._meshes.length;e<r;e++){const r=this._meshes[e];r&&(r===t&&this._meshes.splice(e,1))}})),e){const t=this._getRenderer();t&&t.setToRedraw()}return this}_initRaycaster(){return this._raycaster||(this._raycaster=new i.Raycaster,this._mouse=new i.Vector2),this}getRaycaster(){return this._raycaster}identify(t,e){if(!t)return console.error("coordinate is null,it should be Coordinate"),[];if(Array.isArray(t)&&(t=new n.Coordinate(t)),!(t instanceof n.Coordinate))return console.error("coordinate type is error,it should be Coordinate"),[];const r=this.getMap().coordToContainerPoint(t);this._containerPoint=r;const{x:o,y:s}=r;this._initRaycaster(),this.fire("identify",{coordinate:t,options:e});const a=this._raycaster,u=this._mouse,l=this.getCamera(),h=this.getScene(),c=this.getMap().getSize();if(!h)return[];const f=c.width,p=c.height;u.x=o/f*2-1,u.y=-s/p*2+1,a.setFromCamera(u,l),a.layers&&a.layers.enableAll&&a.layers.enableAll(),function(t,e){P>113?t.params.Line.threshold=e:t.linePrecision=e}(a,this._getLinePrecision(this.getMap().getResolution()));const d=[],g=[];h.children.forEach((t=>{const e=t.__parent;if(e&&e.getOptions){const r=e;r.getOptions().interactive&&r.isVisible()&&(r.identify&&n.Util.isFunction(r.identify)?g.push(r):d.push(t))}else(t instanceof i.Mesh||t instanceof i.Group)&&d.push(t)}));let y=[];const v=a.intersectObjects(d,!0);v&&Array.isArray(v)&&v.length&&(y=v.map((t=>{let e=t.object;const r=t.instanceId;e=this._recursionMesh(e)||{};const i=e.__parent||e;return i.faceIndex=t.faceIndex,i.index=t.index,i.intersect=t,n.Util.isNumber(r)&&(i.instanceId=r),i}))),this.renderPickScene(),g.length&&g.forEach((e=>{e.identify(t)&&y.push(e)}));const m=y.length;for(let t=0;t<m;t++)if(y[t])for(let e=t+1;e<m;e++)y[t]===y[e]&&y.splice(e,1);let A=y.filter((t=>t instanceof H));A=A.sort(((t,e)=>t.options.pickWeight-e.options.pickWeight)),y.forEach((t=>{t instanceof H||A.push(t)}));const _=(e=n.Util.extend({},e)).count;return n.Util.isNumber(_)&&_>0?A.slice(0,_):y}identifyAtPoint(t,e={}){const r=this.getMap();if(!r)return[];const n=r.containerPointToCoordinate(t);return this.identify(n,e)}_recursionMesh(t){for(;t&&t.parent!==this.getScene();)t=t.parent;return t}_getLinePrecision(t=10){for(let e=0,r=xo.length;e<r;e++){const[r,n]=xo[e];if(t>r)return n}return.01}fireGeoEvent(t,e,r){if(!(t instanceof H))return this;r=r||e.type;const n=this._getEventParams(e),{coordinate:i}=n,o=this.getMap();function s(t,e){e=e||r;const n=t.getInfoWindow();n&&!n._owner&&n.addTo(t);((n?n.options:{}).autoOpenOn||"click")===e&&(o.options.supportPluginEvent||t.openInfoWindow(i),t.fire("showinfowindow",{infoWindow:n}))}if("mousemove"===r){t.fire(r,Object.assign({},n,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null}));const e=t.getToolTip();e&&!e._owner&&e.addTo(t),t.openToolTip(i),s(t)}else"mouseover"===r?t._mouseover||(t.fire("mouseover",Object.assign({},n,{target:t,type:"mouseover",selectMesh:t.getSelectMesh?t.getSelectMesh():null})),t._mouseover=!0,s(t,"mouseover")):"mouseout"===r?t.getSelectMesh?t.isHide||(t._mouseover=!1,t.fire("mouseout",Object.assign({},n,{target:t,type:"mouseout",selectMesh:null})),t.closeToolTip()):(t._mouseover=!1,t.fire("mouseout",Object.assign({},n,{target:t,type:"mouseout"})),t.closeToolTip()):(t.fire(r,Object.assign({},n,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null})),s(t))}_emptyIdentify(t={}){const e=t.domEvent,r=this.getScene();if(!r)return this;const n=this.map||this.getMap();if(!n)return this;const i=n._getEventParams?n._getEventParams(e):this._getEventParams(e);for(let t=0,e=r.children.length;t<e;t++){const e=(r.children[t]||{}).__parent;e&&e.fire("empty",Object.assign({},i,{target:e}))}}_identifyBaseObjectEvents(t){if(!this.options.geometryEvents)return this;const e=this.map||this.getMap();if(e.isInteracting()||!e.options.geometryEvents||e._ignoreEvent(t))return this;const r=t.type,i=e._getEventParams?e._getEventParams(t):this._getEventParams(t);i.type=r;const{type:o,coordinate:s}=i,a=n.Util.now();if(this._mousemoveTimeOut&&"mousemove"===o&&a-this._mousemoveTimeOut<64)return this;this._mousemoveTimeOut=a,"mousedown"!==o&&"touchstart"!==o||(this._mousedownTime=n.Util.now());let u=!1;if("click"===o||"touchend"===o){const t=e.options.clickTimeThreshold||280;u=n.Util.now()-this._mousedownTime<t}if("click"===o&&!u)return this;const l=this.options.identifyCountOnEvent;let h=Math.max(0,n.Util.isNumber(l)?l:0);0===h&&(h=1/0);const c=t=>{const e=[];this._baseObjects&&this._baseObjects.forEach((r=>{let n=!0;t.forEach((t=>{r===t&&(n=!1)})),n&&e.push(r)})),e.forEach((t=>{t&&t instanceof H&&(t.getSelectMesh?t.isHide||(t._mouseover=!1,t.fire("mouseout",Object.assign({},i,{target:t,type:"mouseout",selectMesh:null})),t.closeToolTip()):(t._mouseover=!1,t.fire("mouseout",Object.assign({},i,{target:t,type:"mouseout"})),t.closeToolTip()))}))};if("mouseout"===o)return c([]),this._baseObjects=[],this;const f=this.identify(s,{count:h}),p=this.getScene();if(0===f.length&&p)for(let t=0,e=p.children.length;t<e;t++){const e=(p.children[t]||{}).__parent;e&&e.fire("empty",Object.assign({},i,{target:e}))}function d(t,e){e=e||o;const r=t.getInfoWindow();r&&!r._owner&&r.addTo(t);((r?r.options:{}).autoOpenOn||"click")===e&&(t.openInfoWindow(s),t.fire("showinfowindow",{infoWindow:r}))}if("mousemove"===o?(c(f),f.forEach((t=>{if(t instanceof H){t._mouseover||(t.fire("mouseover",Object.assign({},i,{target:t,type:"mouseover",selectMesh:t.getSelectMesh?t.getSelectMesh():null})),t._mouseover=!0,d(t,"mouseover")),t.fire(o,Object.assign({},i,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null}));const e=t.getToolTip();e&&!e._owner&&e.addTo(t),t.openToolTip(s),d(t)}})),this._baseObjects=f):f.forEach((t=>{t instanceof H&&(t.fire(o,Object.assign({},i,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null})),d(t))})),"touchend"===o&&u){const e=n.Util.extend({},i,{domEvent:t});f.forEach((t=>{t instanceof H&&(t.fire("click",Object.assign({},e,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null})),d(t,"click"))}))}return this}_getEventParams(t){const e=this.getMap(),r={domEvent:t};if(!e)return r;const i=t.touches&&t.touches.length>0?t.touches[0]:t.changedTouches&&t.changedTouches.length>0?t.changedTouches[0]:t;if(i){const t=(0,n.DomUtil.getEventContainerPoint)(i,e._containerDOM);r.coordinate=e.containerPointToCoordinate(t),r.containerPoint=t,r.viewPoint=e.containerPointToViewPoint(t),r.pont2d=e._containerPointToPoint(t)}return r}_zoomend(){const t=this.getScene();if(!t)return;const e=this.getMap().getZoom();t.children.forEach((t=>{const r=t.__parent;if(r&&r.getOptions){const t=r;t.zoomChange&&n.Util.isFunction(t.zoomChange)&&t.zoomChange(e);const i=t.getMinZoom(),o=t.getMaxZoom();e<i||e>o?(t.isVisible()&&(t.getObject3d().visible=!1),t._zoomVisible=!1):i<=e&&e<=o&&(t._visible&&(t.getObject3d().visible=!0),t._zoomVisible=!0)}}))}_getGeometryEventMapPanel(){const t=this.map||this.getMap();return t._panels.allLayers||t._containerDOM}onAdd(){super.onAdd();const t=this.map||this.getMap();if(!t)return this;const e=this._getGeometryEventMapPanel();return this._identifyBaseObjectEventsThis||(this._identifyBaseObjectEventsThis=this._identifyBaseObjectEvents.bind(this)),this._zoomendThis||(this._zoomendThis=this._zoomend.bind(this)),this._emptyIdentifyThis||(this._emptyIdentifyThis=this._emptyIdentify.bind(this)),t.options.supportPluginEvent?this.on("identifyempty",this._emptyIdentifyThis):n.DomUtil.on(e,wo.join(" "),this._identifyBaseObjectEventsThis,this),this._needsUpdate=!0,this._animationBaseObjectMap||(this._animationBaseObjectMap={}),t.on("zooming zoomend",this._zoomendThis,this),this}onRemove(){super.onRemove();const t=this.map||this.getMap();if(!t)return this;const e=this._getGeometryEventMapPanel();return t.options.supportPluginEvent?this.off("identifyempty",this._emptyIdentifyThis):n.DomUtil.off(e,wo.join(" "),this._identifyBaseObjectEventsThis,this),t.off("zooming zoomend",this._zoomendThis,this),this}_addBaseObjectsWhenInit(){return this.addMesh(this._meshes),this}_callbackBaseObjectAnimation(){const t=this;if(t._animationBaseObjectMap)for(const e in t._animationBaseObjectMap){t._animationBaseObjectMap[e]._animation()}return this}_getFovRatio(){const t=this.getMap().getFov();return Math.tan(t/2*_o)}}Bo.mergeOptions({renderer:"gl",doubleBuffer:!1,glOptions:null,geometryEvents:!0,identifyCountOnEvent:0,forceRenderOnZooming:!0,loopRenderCount:50});const To={bloom:!0};class ko extends n.renderer.CanvasLayerRenderer{constructor(){super(...arguments),this._renderTime=0,this._renderTarget=null}getPrepareParams(){return[this.scene,this.camera]}getDrawParams(){return[this.scene,this.camera]}_drawLayer(){super._drawLayer.apply(this,arguments)}hitDetect(){return!1}createCanvas(){super.createCanvas(),this.createContext()}createContext(){if(this.canvas.gl&&this.canvas.gl.wrap)this.gl=this.canvas.gl.wrap();else{const t=this.layer.options.glOptions||{alpha:!0,depth:!0,antialias:!0,stencil:!0,preserveDrawingBuffer:!1};t.preserveDrawingBuffer=!0,this.gl=this.gl||this._createGLContext(this.canvas,t)}this._initThreeRenderer(),this.layer.onCanvasCreate(this.context,this.scene,this.camera)}_initThreeRenderer(){this.matrix4=new i.Matrix4;const t=new i.WebGLRenderer({context:this.gl,alpha:!0});t.autoClear=!1,t.setClearColor(new i.Color(1,1,1),0),t.setSize(this.canvas.width,this.canvas.height),t.clear(),this.context=t;const e=this.scene=new i.Scene,r=this.layer.getMap(),n=r.getFov()*Math.PI/180,o=this.camera=new i.PerspectiveCamera(n,r.width/r.height,r.cameraNear,r.cameraFar);o.matrixAutoUpdate=!1,this._syncCamera(),e.add(o),this.pick=new Zn(this.layer),mr.star(),this.layer._addBaseObjectsWhenInit()}onCanvasCreate(){super.onCanvasCreate()}resizeCanvas(t){if(!this.canvas)return;let e,r=this.getMap();e=t||r.getSize();const i=r.getDevicePixelRatio?r.getDevicePixelRatio():n.Browser.retina?2:1,o=this.canvas,{width:s,height:a,cssWidth:u,cssHeight:l}=n.Util.calCanvasSize(e,i);if(!this.layer._canvas||o.style.width===u&&o.style.height===l||(o.style.width=u,o.style.height=l),o.width===s&&o.height===a)return this;o.width=s,o.height=a,this.context.setSize(o.width,o.height)}clearCanvas(){this.canvas&&this.context.clear()}prepareCanvas(){return this.canvas?this.clearCanvas():this.createCanvas(),this.layer.fire("renderstart",{context:this.context}),null}renderScene(t){if(this.layer._callbackBaseObjectAnimation(),this._syncCamera(),t&&t.renderTarget){const{width:e,height:r}=t.renderTarget.fbo;this._renderTarget?(this._renderTarget.viewport.set(0,0,e,r),this._renderTarget.scissor.set(0,0,e,r)):(this._renderTarget=new i.WebGLRenderTarget(e,r,{depthBuffer:!1}),this.context.setRenderTarget(this._renderTarget),this.context.render(this.scene,this.camera));const n=this.context.properties.get(this._renderTarget),o=n[So];n[So]=t.renderTarget.getFramebuffer(t.renderTarget.fbo),this.context.setRenderTarget(this._renderTarget);const s=1===t.bloom&&t.sceneFilter,a=this.scene.children||[];let u=!1;if(s){const e=t.sceneFilter;u=e(To);for(let t=0,r=a.length;t<r;t++){if(!a[t]||!a[t].layers)continue;const r=a[t].__parent;a[t].bloom=!1,r&&(a[t].bloom=r.bloom);let n=0;(a[t]&&e(a[t])||!r)&&u&&(n=1),a[t].__layer!==n&&(Po(a[t],n),a[t].__layer=n)}}else for(let t=0,e=a.length;t<e;t++)a[t]&&a[t].layers&&0!==a[t].__layer&&(Po(a[t],0),a[t].__layer=0);this.camera.layers.set(u?1:0),this.context.render(this.scene,this.camera),n[So]=o}else{const{width:t,height:e}=this.canvas,r=this.context.getViewport(Mo);r.width===t&&r.height===e||this.context.setViewport(0,0,t,e),this.context.render(this.scene,this.camera)}this.context.setRenderTarget(null),this.completeRender()}remove(){delete this._drawContext,this._renderTarget&&(this._renderTarget.dispose(),delete this._renderTarget),super.remove()}_syncCamera(){const t=this.getMap(),e=this.camera;e.matrix.elements=t.cameraWorldMatrix,e.projectionMatrix.elements=t.projMatrix,this.matrix4.invert?e.projectionMatrixInverse.elements=this.matrix4.copy(e.projectionMatrix).invert().elements:e.projectionMatrixInverse&&(e.projectionMatrixInverse.elements=this.matrix4.getInverse(e.projectionMatrix).elements)}_createGLContext(t,e){const r=["webgl2","webgl","experimental-webgl"];let n=null;for(let i=0;i<r.length;++i){try{n=t.getContext(r[i],e)}catch(t){}if(n)break}return n}}function Po(t,e){if(!t)return;t.layers&&t.layers.set(e);const r=t.children;if(r&&r.length)for(let t=0,n=r.length;t<n;t++)Po(r[t],e)}function Lo(t){return t.getGLRes?t.getGLRes():t.getGLZoom()}function Ro(t,e,r,n){return t.coordToPointAtRes?t.coordToPointAtRes(e,r,n):t.coordinateToPoint(e,r,n)}Bo.registerRenderer("gl",ko),n.registerWorkerAdapter&&(n.registerWorkerAdapter("__maptalks.three__",'(function(t){"use strict";\n/*!\n * poly-extrude v0.16.0\n */function n(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 i(t,n){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},i(t,n)}function e(t,n,i){void 0===i&&(i=2);var e,s,h,a=n&&n.length,u=a?n[0]*i:t.length,c=r(t,0,u,i,!0),x=[];if(!c||c.next===c.prev)return x;if(a&&(c=function(t,n,i,e){for(var s=[],o=0,h=n.length;o<h;o++){var a=r(t,n[o]*e,o<h-1?n[o+1]*e:t.length,e,!1);a===a.next&&(a.steiner=!0),s.push(d(a))}s.sort(l);for(var u=0;u<s.length;u++)i=f(s[u],i);return i}(t,n,c,i)),t.length>80*i){e=1/0,s=1/0;for(var y=-1/0,p=-1/0,v=i;v<u;v+=i){var g=t[v],_=t[v+1];g<e&&(e=g),_<s&&(s=_),g>y&&(y=g),_>p&&(p=_)}h=0!==(h=Math.max(y-e,p-s))?32767/h:0}return o(c,x,i,e,s,h,0),x}function r(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=P(o/e|0,t[o],t[o+1],s);else for(var h=i-e;h>=n;h-=e)s=P(h/e|0,t[h],t[h+1],s);return s&&m(s,s.next)&&(S(s),s=s.next),s}function s(t,n){if(!t)return t;n||(n=t);var i,e=t;do{if(i=!1,e.steiner||!m(e,e.next)&&0!==_(e.prev,e,e.next))e=e.next;else{if(S(e),(e=n=e.prev)===e.next)break;i=!0}}while(i||e!==n);return n}function o(t,n,i,e,r,l,f){if(t){!f&&l&&function(t,n,i,e){var r=t;do{0===r.z&&(r.z=y(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,h=0,a=0;a<i&&(h++,o=o.nextZ);a++);for(var u=i;h>0||u>0&&o;)0!==h&&(0===u||!o||e.z<=o.z)?(r=e,e=e.nextZ,h--):(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,l);for(var x=t;t.prev!==t.next;){var d=t.prev,p=t.next;if(l?a(t,e,r,l):h(t))n.push(d.i,t.i,p.i),S(t),t=p.next,x=p.next;else if((t=p)===x){f?1===f?o(t=u(s(t),n),n,i,e,r,l,2):2===f&&c(t,n,i,e,r,l):o(s(t),n,i,e,r,l,1);break}}}}function h(t){var n=t.prev,i=t,e=t.next;if(_(n,i,e)>=0)return!1;for(var r=n.x,s=i.x,o=e.x,h=n.y,a=i.y,u=e.y,c=Math.min(r,s,o),l=Math.min(h,a,u),f=Math.max(r,s,o),x=Math.max(h,a,u),y=e.next;y!==n;){if(y.x>=c&&y.x<=f&&y.y>=l&&y.y<=x&&v(r,h,s,a,o,u,y.x,y.y)&&_(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function a(t,n,i,e){var r=t.prev,s=t,o=t.next;if(_(r,s,o)>=0)return!1;for(var h=r.x,a=s.x,u=o.x,c=r.y,l=s.y,f=o.y,x=Math.min(h,a,u),d=Math.min(c,l,f),p=Math.max(h,a,u),g=Math.max(c,l,f),m=y(x,d,n,i,e),z=y(p,g,n,i,e),w=t.prevZ,M=t.nextZ;w&&w.z>=m&&M&&M.z<=z;){if(w.x>=x&&w.x<=p&&w.y>=d&&w.y<=g&&w!==r&&w!==o&&v(h,c,a,l,u,f,w.x,w.y)&&_(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,M.x>=x&&M.x<=p&&M.y>=d&&M.y<=g&&M!==r&&M!==o&&v(h,c,a,l,u,f,M.x,M.y)&&_(M.prev,M,M.next)>=0)return!1;M=M.nextZ}for(;w&&w.z>=m;){if(w.x>=x&&w.x<=p&&w.y>=d&&w.y<=g&&w!==r&&w!==o&&v(h,c,a,l,u,f,w.x,w.y)&&_(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;M&&M.z<=z;){if(M.x>=x&&M.x<=p&&M.y>=d&&M.y<=g&&M!==r&&M!==o&&v(h,c,a,l,u,f,M.x,M.y)&&_(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function u(t,n){var i=t;do{var e=i.prev,r=i.next.next;!m(e,r)&&z(e,i,i.next,r)&&b(e,r)&&b(r,e)&&(n.push(e.i,i.i,r.i),S(i),S(i.next),i=t=r),i=i.next}while(i!==t);return s(i)}function c(t,n,i,e,r,h){var a=t;do{for(var u=a.next.next;u!==a.prev;){if(a.i!==u.i&&g(a,u)){var c=A(a,u);return a=s(a,a.next),c=s(c,c.next),o(a,n,i,e,r,h,0),void o(c,n,i,e,r,h,0)}u=u.next}a=a.next}while(a!==t)}function l(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 f(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 h=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=r&&h>o&&(o=h,i=e.x<e.next.x?e:e.next,h===r))return i}e=e.next}while(e!==n);if(!i)return null;var a=i,u=i.x,c=i.y,l=1/0;e=i;do{if(r>=e.x&&e.x>=u&&r!==e.x&&p(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);b(e,t)&&(f<l||f===l&&(e.x>i.x||e.x===i.x&&x(i,e)))&&(i=e,l=f)}e=e.next}while(e!==a);return i}(t,n);if(!i)return n;var e=A(i,t);return s(e,e.next),s(i,i.next)}function x(t,n){return _(t.prev,t,n.prev)<0&&_(n.next,t,t.next)<0}function y(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 d(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 p(t,n,i,e,r,s,o,h){return(r-o)*(n-h)>=(t-o)*(s-h)&&(t-o)*(e-h)>=(i-o)*(n-h)&&(i-o)*(s-h)>=(r-o)*(e-h)}function v(t,n,i,e,r,s,o,h){return!(t===o&&n===h)&&p(t,n,i,e,r,s,o,h)}function g(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&&z(i,i.next,t,n))return!0;i=i.next}while(i!==t);return!1}(t,n)&&(b(t,n)&&b(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)&&(_(t.prev,t,n.prev)||_(t,n.prev,n))||m(t,n)&&_(t.prev,t,t.next)>0&&_(n.prev,n,n.next)>0)}function _(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 z(t,n,i,e){var r=M(_(t,n,i)),s=M(_(t,n,e)),o=M(_(i,e,t)),h=M(_(i,e,n));return r!==s&&o!==h||(!(0!==r||!w(t,i,n))||(!(0!==s||!w(t,e,n))||(!(0!==o||!w(i,t,e))||!(0!==h||!w(i,n,e)))))}function w(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 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 i=C(t.i,t.x,t.y),e=C(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 P(t,n,i,e){var r=C(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 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 C(t,n,i){return{i:t,x:n,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}var k=new(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 h=i[e+0],a=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]=h,t[n+1]=a,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||h!==l||a!==f||u!==x){var d=1-o,p=h*l+a*f+u*x+c*y,v=p>=0?1:-1,g=1-p*p;if(g>Number.EPSILON){var _=Math.sqrt(g),m=Math.atan2(_,p*v);d=Math.sin(d*m)/_,o=Math.sin(o*m)/_}var z=o*v;if(h=h*d+l*z,a=a*d+f*z,u=u*d+x*z,c=c*d+y*z,d===1-o){var w=1/Math.sqrt(h*h+a*a+u*u+c*c);h*=w,a*=w,u*=w,c*=w}}t[n]=h,t[n+1]=a,t[n+2]=u,t[n+3]=c},t.multiplyQuaternionsFlat=function(t,n,i,e,r,s){var o=i[e],h=i[e+1],a=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+h*f-a*l,t[n+1]=h*x+u*l+a*c-o*f,t[n+2]=a*x+u*f+o*l-h*c,t[n+3]=u*x-o*c-h*l-a*f,t};var i,e,r,s=t.prototype;return s.set=function(t,n,i,e){return this._x=t,this._y=n,this._z=i,this._w=e,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 i=t._x,e=t._y,r=t._z,s=t._order,o=Math.cos,h=Math.sin,a=o(i/2),u=o(e/2),c=o(r/2),l=h(i/2),f=h(e/2),x=h(r/2);switch(s){case"XYZ":this._x=l*u*c+a*f*x,this._y=a*f*c-l*u*x,this._z=a*u*x+l*f*c,this._w=a*u*c-l*f*x;break;case"YXZ":this._x=l*u*c+a*f*x,this._y=a*f*c-l*u*x,this._z=a*u*x-l*f*c,this._w=a*u*c+l*f*x;break;case"ZXY":this._x=l*u*c-a*f*x,this._y=a*f*c+l*u*x,this._z=a*u*x+l*f*c,this._w=a*u*c-l*f*x;break;case"ZYX":this._x=l*u*c-a*f*x,this._y=a*f*c+l*u*x,this._z=a*u*x-l*f*c,this._w=a*u*c+l*f*x;break;case"YZX":this._x=l*u*c+a*f*x,this._y=a*f*c+l*u*x,this._z=a*u*x-l*f*c,this._w=a*u*c-l*f*x;break;case"XZY":this._x=l*u*c-a*f*x,this._y=a*f*c-l*u*x,this._z=a*u*x+l*f*c,this._w=a*u*c+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 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},s.setFromRotationMatrix=function(t){var n=t.elements,i=n[0],e=n[4],r=n[8],s=n[1],o=n[5],h=n[9],a=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-h)*f,this._y=(r-a)*f,this._z=(s-e)*f}else if(i>o&&i>c){var x=2*Math.sqrt(1+i-o-c);this._w=(u-h)/x,this._x=.25*x,this._y=(e+s)/x,this._z=(r+a)/x}else if(o>c){var y=2*Math.sqrt(1+o-i-c);this._w=(r-a)/y,this._x=(e+s)/y,this._y=.25*y,this._z=(h+u)/y}else{var d=2*Math.sqrt(1+c-i-o);this._w=(s-e)/d,this._x=(r+a)/d,this._y=(h+u)/d,this._z=.25*d}return this._onChangeCallback(),this},s.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()},s.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},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 i=t._x,e=t._y,r=t._z,s=t._w,o=n._x,h=n._y,a=n._z,u=n._w;return this._x=i*u+s*o+e*a-r*h,this._y=e*u+s*h+r*o-i*a,this._z=r*u+s*a+i*h-e*o,this._w=s*u-i*o-e*h-r*a,this._onChangeCallback(),this},s.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 h=1-o*o;if(h<=Number.EPSILON){var a=1-n;return this._w=a*s+n*this._w,this._x=a*i+n*this._x,this._y=a*e+n*this._y,this._z=a*r+n*this._z,this.normalize(),this}var u=Math.sqrt(h),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},s.slerpQuaternions=function(t,n,i){return this.copy(t).slerp(n,i)},s.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))},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(){},i=t,(e=[{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(i.prototype,e),r&&n(i,r),Object.defineProperty(i,"prototype",{writable:!1}),t}()),Z=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(k.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,h=t.w,a=h*n+s*e-o*i,u=h*i+o*n-r*e,c=h*e+r*i-s*n,l=-r*n-s*i-o*e;return this.x=a*h+l*-r+u*-o-c*-s,this.y=u*h+l*-s+c*-r-a*-o,this.z=c*h+l*-o+a*-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,h=n.z;return this.x=e*h-r*o,this.y=r*s-i*h,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 F(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 V(t,n,i){return t[0]=n[0]-i[0],t[1]=n[1]-i[1],t[2]=n[2]-i[2],t}function L(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],h=i[1],a=i[2];return t[0]=r*a-s*h,t[1]=s*o-e*a,t[2]=e*h-r*o,t}function E(t,n){function i(t,n,i,e){t[0]=n,t[1]=i,t[2]=e}const e=[],r=[],s=[],o=[],h=[],a=[],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]),V(h,s,r),V(o,e,r),q(a,h,o);for(let t=0;t<3;t++)c[u+t]+=a[t],c[f+t]+=a[t],c[x+t]+=a[t];l+=3}let f=0;const x=c.length;for(;f<x;)i(a,c[f],c[f+1],c[f+2]),L(a,a),c[f]=a[0]||0,c[f+1]=a[1]||0,c[f+2]=a[2]||0,f+=3;return c}function I(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,h=0;for(let n=0,i=t.length;n<i;n++){const{position:i,indices:a,normal:u,uv:c}=t[n];e.position.set(i,r),e.normal.set(u,r),e.uv.set(c,h);let l=0;const f=a.length;for(;l<f;){const t=a[l]+s;e.indices[o]=t,o++,l++}h+=c.length,r+=i.length,s+=i.length/3}return e}function O(t){return 180*t/Math.PI}function U(t){return t/180*Math.PI}function N(t,n,i,e,r,s){const o=3*i,h=3*e,a=3*r,u=3*s,c=n[o],l=n[o+1],f=n[o+2],x=n[h],y=n[h+1],d=n[h+2],p=n[a],v=n[a+1],g=n[a+2],_=n[u],m=n[u+1],z=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-d,t[++w]=p,t[++w]=1-g,t[++w]=_,t[++w]=1-z):(t[++w]=l,t[++w]=1-f,t[++w]=y,t[++w]=1-d,t[++w]=v,t[++w]=1-g,t[++w]=m,t[++w]=1-z)}function j(t,n){n=Object.assign({},{depth:2,top:!0},n);const i=t.map((t=>{for(let n=0,i=t.length;n<i;n++){const i=t[n];Q(i),0===n?F(i)||(t[n]=i.reverse()):F(i)&&(t[n]=i.reverse()),R(i)&&i.splice(i.length-1,1)}const i=function(t,n){const i=function(t){let n=0,i=0;const e=t.length;for(;i<e;)n+=t[i].length,i++;return n}(t),e=t.length,r=[],s=new Float32Array(2*i),o=[],h=[],a=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[a+f]=n,o[a+f+1]=r,o[a+f+2]=y,h[x]=n,h[x+1]=r,h[u+x]=n,h[u+x+1]=r,f+=3,x+=2,e++}}return{flatVertices:s,holes:r,points:o,count:i,uv:h}}(t,n);i.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],h=n[t+1],a=n[t+2];s&&(e[t]=o,e[t+1]=h,e[t+2]=a);let u=i+t;const c=r+o,l=r+h,f=r+a;s||(u=t),e[u]=c,e[u+1]=l,e[u+2]=f}t.indices=e}(i,e(i.flatVertices,i.holes,2),n),function(t,n){const{points:i,indices:e,polygon:r,uv:s}=t,o=n.depth;let h=i.length-1,a=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,d=r[0],p=r[1],v=r[2]||0;i[++h]=f,i[++h]=x,i[++h]=y+o,i[++h]=d,i[++h]=p,i[++h]=v+o,i[++h]=f,i[++h]=x,i[++h]=y,i[++h]=d,i[++h]=p,i[++h]=v;const g=l+2,_=l+3,m=l,z=l+1;e[++a]=g,e[++a]=m,e[++a]=_,e[++a]=m,e[++a]=z,e[++a]=_,N(s,i,g,_,m,z),u++}}}(i,n),i.position=new Float32Array(i.points),i.indices=new Uint32Array(i.indices),i.uv=new Float32Array(i.uv),i.normal=E(i.indices,i.position),i})),r=I(i);return r.polygons=t,r}function Q(t){R(t)||t.push(t[0])}function R(t){const n=t.length,[i,e]=t[0],[r,s]=t[n-1];return i===r&&e===s}function W(t,n){!function(t){t.lineWidth=Math.max(0,t.lineWidth),t.depth=Math.max(0,t.depth),t.sideDepth=Math.max(0,t.sideDepth)}(n=Object.assign({},{depth:2,lineWidth:1,bottomStickGround:!1,pathUV:!1},n));const i=t.map((t=>{const i=function(t,n){let i=n.lineWidth/2;n.isSlope&&(i*=2);const e=[],r=[],s=[],o=t.length;let h=0;for(;h<o;){let n=t[h],a=t[h+1];const u=t[h];h===o-1&&(n=t[o-2],a=t[o-1]);const c=a[1]-n[1],l=a[0]-n[0];let f=0;const x=O(Math.atan(c/l));if(0===h||h===o-1)f=x,f-=90;else{const i=t[h-1];B.x=i[0]-n[0],B.y=i[1]-n[1],T.x=a[0]-n[0],T.y=a[1]-n[1];f=x-H(B,T)/2}const y=U(f),d=u,p=[Math.cos(y)+d[0],Math.sin(y)+d[1]],[v,g]=Y(n,a,i);let _=D(v[0],v[1],d,p),m=D(g[0],g[1],d,p);if(!_||!m){const t=e.length,n=e[t-2],i=e[t-1];if(!n||!i)continue;_=[n[0],n[1]],m=[i[0],i[1]]}_[2]=u[2]||0,m[2]=u[2]||0,e.push(_,m),X(_,n,a)?(r.push(_),s.push(m)):(r.push(m),s.push(_)),h++}return{offsetPoints:e,leftPoints:r,rightPoints:s,line:t}}(t,n);return i.line=t,function(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:h,rightPoints:a}=t,u=t.line,c=n.pathUV;if(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,h,a]=r,u=t-o,c=i-h,l=(s||0)-(a||0);n+=Math.sqrt(u*u+c*c+l*l),r.distance=n}}}(u);for(let t=0,n=u.length;t<n;t++)h[t].distance=a[t].distance=u[t].distance}let l=0,f=h.length;const x=[],y=[],d=[];for(;l<f;){const t=3*l,[n,e,r]=h[l];x[t]=n,x[t+1]=e,x[t+2]=s+r;const[y,p,v]=a[l],g=3*f+t;x[g]=y,x[g+1]=p,x[g+2]=o+v;const _=2*f*3+t;x[_]=n,x[_+1]=e,x[_+2]=r,i&&(x[_+2]=0);const m=2*f*3+3*f+t;if(x[m]=y,x[m+1]=p,x[m+2]=v,i&&(x[m+2]=0),c){const t=u[l].distance,n=2*l;d[n]=t,d[n+1]=1;const i=2*f+n;d[i]=t,d[i+1]=0;const e=2*f*2+n;d[e]=t,d[e+1]=1;const r=2*f*2+2*f+n;d[r]=t,d[r+1]=0}l++}if(!c){l=0,f=x.length;let t=d.length-1;for(;l<f;){const n=x[l],i=x[l+1];d[++t]=n,d[++t]=i,l+=3}}l=0,f=h.length;let p=y.length-1;for(;l<f-1;){const t=l,n=l+1,i=t+f,e=n+f;y[++p]=t,y[++p]=i,y[++p]=n,y[++p]=i,y[++p]=e,y[++p]=n;const r=l+2*f,s=r+1,o=r+f,h=s+f;y[++p]=r,y[++p]=o,y[++p]=s,y[++p]=o,y[++p]=h,y[++p]=s,l++}if(t.indices=y,t.points=x,t.uv=d,r)for(f=h.length,l=0;l<f;)h[l].depth=s,a[l].depth=o,l++}(i,n),function(t,n){const{points:i,indices:e,leftPoints:r,rightPoints:s,uv:o}=t,h=n.depth,a=n.bottomStickGround,u=[r,s],c=t.depths,l=n.pathUV,f=n.lineWidth;let x=i.length-1,y=e.length-1,d=o.length-1;function p(t,n){const r=i.length/3,s=c?t.depth:h,u=c?n.depth:h;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]=a?0:t[2],i[++x]=n[0],i[++x]=n[1],i[++x]=a?0:n[2];const p=r+2,v=r+3,g=r,_=r+1;e[++y]=p,e[++y]=g,e[++y]=v,e[++y]=g,e[++y]=_,e[++y]=v,l?(o[++d]=t.distance,o[++d]=s/f,o[++d]=n.distance,o[++d]=u/f,o[++d]=t.distance,o[++d]=0,o[++d]=n.distance,o[++d]=0):N(o,i,p,v,g,_)}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;){p(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){p(g[t],g[t+1])}}(i,n),i.position=new Float32Array(i.points),i.indices=new Uint32Array(i.indices),i.uv=new Float32Array(i.uv),i.normal=E(i.indices,i.position),i})),e=I(i);return e.lines=t,e}const B={x:0,y:0},T={x:0,y:0};const H=({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+360)%360};function X(t,n,i){const[e,r]=n,[s,o]=i,[h,a]=t;return(r-o)*h+(s-e)*a+e*o-s*r>0}function Y(t,n,i){const e=n[1]-t[1],r=n[0]-t[0],s=Math.atan2(e,r),o=s+Math.PI/2;let h=Math.cos(o)*i,a=Math.sin(o)*i;const u=[t[0]+h,t[1]+a],c=[n[0]+h,n[1]+a],l=s-Math.PI/2;h=Math.cos(l)*i,a=Math.sin(l)*i;return[[u,c],[[t[0]+h,t[1]+a],[n[0]+h,n[1]+a]]]}function D(t,n,i,e){const r=n[0]-t[0],s=n[1]-t[1],o=e[0]-i[0],h=e[1]-i[1];if(0===r&&0===o)return null;if(0===s&&0===h)return null;const a=s/r,u=h/o,c=t[1]-a*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=a*f+c):0===s?(x=t[1],f=(x-l)/u):0===h?(x=i[1],f=(x-c)/a):(f=(l-c)/(a-u),x=a*f+c),[f,x]}function G(t,n){n=Object.assign({},{radius:1,height:2,radialSegments:6},n);const i=Math.round(Math.max(4,n.radialSegments));let{radius:e,height:r}=n;e=e,r=r;const s=360/i/360*Math.PI*2,o=i+1,h=new Float32Array(3*o*2),[a,u]=t;let c=0,l=0;const f=3*o,x=2*o,y=[],d=[];let p=y.length-1;for(let t=-1;t<i;t++){const n=s*t,i=Math.cos(n)*e+a,o=Math.sin(n)*e+u;h[c]=i,h[c+1]=o,h[c+2]=0,h[c+f]=i,h[c+1+f]=o,h[c+2+f]=r;let v=0,g=0;v=.5+i/e/2,g=.5+o/e/2,d[l]=v,d[l+1]=g,d[l+x]=v,d[l+1+x]=g,c+=3,l+=2,t>1&&(y[++p]=0,y[++p]=t-1,y[++p]=t)}c-=3,h[c]=h[0],h[c+1]=h[1],h[c+2]=h[2];const v=h.length;h[v-3]=h[0],h[v-2]=h[1],h[v-1]=r;const g=y.length;p=y.length-1;for(let t=0;t<g;t++){const n=y[t];y[++p]=n+o}const _=new Float32Array(2*(3*o*2-6));let m=-1;c=2*o,l=0,p=y.length-1;let z=d.length-1;for(let t=0,n=h.length/2;t<n-3;t+=3){const n=h[t],i=h[t+1],s=h[t+3],a=h[t+4];_[++m]=n,_[++m]=i,_[++m]=r,_[++m]=s,_[++m]=a,_[++m]=r,_[++m]=n,_[++m]=i,_[++m]=0,_[++m]=s,_[++m]=a,_[++m]=0;const u=c+2,f=c+3,x=c,v=c+1;y[++p]=x,y[++p]=u,y[++p]=v,y[++p]=u,y[++p]=f,y[++p]=v,c+=4;const g=l/o,w=(l+1)/o;d[++z]=g,d[++z]=r/e/2,d[++z]=w,d[++z]=r/e/2,d[++z]=g,d[++z]=0,d[++z]=w,d[++z]=0,l++}const w=new Float32Array(h.length+_.length);w.set(h,0),w.set(_,h.length);const M=E(y,w);return{points:h,indices:new Uint32Array(y),position:w,normal:M,uv:new Float32Array(d)}}var J=function(){function t(){this.pos=new Z,this.dir=new Z,this.right=new Z,this.up=new Z,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}(),K=function(){function t(t,n,i,e,r,s,o,h,a,u,c,l,f,x,y,d){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,h,a,u,c,l,f,x,y,d)}var n=t.prototype;return n.set=function(t,n,i,e,r,s,o,h,a,u,c,l,f,x,y,d){var p=this.elements;return p[0]=t,p[4]=n,p[8]=i,p[12]=e,p[1]=r,p[5]=s,p[9]=o,p[13]=h,p[2]=a,p[6]=u,p[10]=c,p[14]=l,p[3]=f,p[7]=x,p[11]=y,p[15]=d,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,h=t.z,a=r*s,u=r*o;return this.set(a*s+i,a*o-e*h,a*h+e*o,0,a*o+e*h,u*o+i,u*h-e*s,0,a*h-e*o,u*h+e*s,r*h*h+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 $(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 tt=function(t){var n,e;function r(n,i,e){var r;return void 0===n&&(n=new Z),void 0===i&&(i=new Z),void 0===e&&(e=new Z),(r=t.call(this)||this).isQuadraticBezierCurve3=!0,r.type="QuadraticBezierCurve3",r.v0=n,r.v1=i,r.v2=e,r}return e=t,(n=r).prototype=Object.create(e.prototype),n.prototype.constructor=n,i(n,e),r.prototype.getPoint=function(t,n){void 0===n&&(n=new Z);var i=n,e=this.v0,r=this.v1,s=this.v2;return i.set($(t,e.x,r.x,s.x),$(t,e.y,r.y,s.y),$(t,e.z,r.z,s.z)),i},r}(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,h=0,a=s-1;h<=a;)if((o=e[r=Math.floor(h+(a-h)/2)]-i)<0)h=r+1;else{if(!(o>0)){a=r;break}a=r-1}if(e[r=a]===i)return r/(s-1);var u=e[r];return(r+(i-u)/(e[r+1]-u))/(s-1)},t}()),nt=new Z,it=new Z,et=new Z,rt=new K,st=new tt;var ot=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 Z).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 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,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 J),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),h=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)),h<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=nt.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(rt.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=nt.subVectors(n,t),h=it.subVectors(i,n),a=o.length(),u=h.length();o.normalize(),h.normalize();var c=Math.min(.999999*(r?a/2:a),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(h.multiplyScalar(l)),s}(this.array[this.count-1].pos,t,n,i,this.count-1==0,st),o=s.getPoints(e),h=0;h<e;h++)this._sharpCorner(o[h],o[h+1],r,0===h?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),h=nt.subVectors(t,s.pos),a=it.subVectors(n,t),u=h.length();if(h.normalize(),a.normalize(),o.pos.copy(t),1===e?o.dir.copy(h):2===e?o.dir.copy(a):(o.dir.addVectors(h,a),o.dir.normalize()),i)1===o.dir.dot(i)?o.right.crossVectors(a,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=et.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(rt.makeRotationAxis(c,l))}o.right.crossVectors(o.dir,o.up).normalize()}o.dist=s.dist+u;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 ht=new Z(0,0,1),at=new Z,ut=new Z,ct=new Z,lt=new Z,ft=new Z,xt=new Z;function yt(t,n){n=Object.assign({},{lineWidth:1,cornerRadius:0,cornerSplit:10},n);const i=t.map((t=>{const i=function(t){const n=[];for(let i=0,e=t.length;i<e;i++){const e=t[i],[r,s,o]=e,h=new Z(r,s,o||0);n[i]=h}return n}(t),e=new ot;e.set(i,n.cornerRadius,n.cornerSplit,ht);const r=function(t,n){const i=n.lineWidth||.1,e=1,r=i/2,s=i,o=t.distance(),h=e*o;let a=0;const u=[],c=[],l=[],f=[];let x=0;if(0===o)return{position:u,normal:c,uv:l,indices:f,count:a};const y=r/s;let d,p=u.length-1,v=c.length-1,g=l.length-1,_=f.length-1;function m(t){const n=0===u.length,i=t.sharp&&!n,e=t.dist/s,o=t.dir,h=t.up,d=t.right;if(at.copy(d).multiplyScalar(r*t.widthScale),ut.copy(d).multiplyScalar(-r*t.widthScale),at.add(t.pos),ut.add(t.pos),i){ct.fromArray(u,u.length-6).sub(ut),lt.fromArray(u,u.length-3).sub(at);const t=ct.length()-lt.length();let n,i;t>0?(n=ct,i=ut):(n=lt,i=at),ft.copy(n).setLength(Math.abs(t)).add(i);let r=xt.copy(i).sub(ft).normalize().dot(o)*xt.copy(i).sub(ft).length()*2;xt.copy(o).setLength(r).add(ft),t>0?(u[++p]=ft.x,u[++p]=ft.y,u[++p]=ft.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.z,u[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.z,u[++p]=xt.x,u[++p]=xt.y,u[++p]=xt.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.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):(u[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=ft.x,u[++p]=ft.y,u[++p]=ft.z,u[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.z,u[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=xt.x,u[++p]=xt.y,u[++p]=xt.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++)c[++v]=h.x,c[++v]=h.y,c[++v]=h.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[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.z,c[++v]=h.x,c[++v]=h.y,c[++v]=h.z,c[++v]=h.x,c[++v]=h.y,c[++v]=h.z,l[++g]=e,l[++g]=0,l[++g]=e,l[++g]=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 i=t.array[n];if(i.dist>h){const e=t.array[n-1];d=new J;const r=(h-e.dist)/(i.dist-e.dist);d.lerpPathPoints(e,i,r),m(d);break}m(i)}else d=t.array[0];return{position:u,normal:c,uv:l,indices:f,count:a}}(e,n);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}})),e=I(i);return e.lines=t,e}new Z(0,0,1),new Z;var dt={x:0,y:0},pt={x:0,y:0};function vt(t,n,i,e){for(var r=t.length,s=0;s<r;s++){var o=t[s].data;n=t[s].center||n;for(var h=0,a=o.length;h<a;h++)for(var u=o[h],c=0,l=u.length;c<l;c++)t[s].data[h][c]=gt(u[c],n,i,e)}}function gt(t,n,i,e,r){for(var s,o=[],h=r?3:2,a=0,u=(s=i?new Float64Array(t):new Float32Array(t)).length;a<u;a+=h){var c=s[a],l=s[a+1],f=s[a+2];if(n&&i&&e){dt.x=c,dt.y=l;var x=kt(dt,pt);dt.x=x.x,dt.y=x.y,c=(x=Zt(e,dt,i,pt)).x,l=x.y,c-=n[0],l-=n[1]}r?o.push([c,l,f]):o.push([c,l])}return o}function _t(t,n){void 0===n&&(n=1);for(var i=t.length,e=[],r=[],s=0,o=0;o<i;o++){var h=void 0;1===n?h=mt(t[o]):2===n?h=zt(t[o]):3===n&&(h=wt(t[o]));var a=t[o].bottomHeight||0,u=h.position;r.push(h);var c=u.length/3;e[o]={position:{middleZ:a+(t[o].height||0)/2,count:c,start:s,end:s+3*c},hide:!1},s+=3*c}var l=bt(r),f=l.position,x=l.normal,y=l.uv,d=l.indices;return{position:f.buffer,normal:x.buffer,uv:y.buffer,indices:d.buffer,geometriesAttributes:e}}function mt(t){var n=t.data,i=t.height,e=t.bottomHeight,r=j(n,{depth:i}),s=r.position,o=r.normal,h=r.uv,a=r.indices;return At(s,e),{position:s,normal:o,uv:h,indices:a}}function zt(t){var n=t.data,i=t.height,e=t.width,r=t.bottomHeight,s=W(n,{lineWidth:e,depth:i}),o=s.position,h=s.normal,a=s.uv,u=s.indices;return At(o,r),{position:o,normal:h,uv:a,indices:u}}function wt(t){var n=t.data,i=t.cornerRadius,e=t.width,r=t.bottomHeight,s=yt(n,{lineWidth:e,cornerRadius:i}),o=s.position,h=s.normal,a=s.uv,u=s.indices;return At(o,r),{position:o,normal:h,uv:a,indices:u}}function Mt(t,n){for(var i=new Float32Array(n),e=0,r=0;r<t.length;++r)i.set(t[r],e),e+=t[r].length;return i}function bt(t){for(var n={},i={},e=0;e<t.length;++e){var r=t[e];for(var s in r)void 0===n[s]&&(n[s]=[],i[s]=0),n[s].push(r[s]),i[s]+=r[s].length}var o={},h=0,a=[];for(var u in n)if("indices"===u)for(var c=n[u],l=0,f=c.length;l<f;l++){for(var x=c[l],y=0,d=x.length;y<d;y++)a.push(x[y]+h);h+=n.position[l].length/3}else{var p=Mt(n[u],i[u]);if(!p)return null;o[u]=p}return o.indices=new Uint32Array(a),o}function At(t,n){if(void 0!==n&&"number"==typeof n&&0!==n)for(var i=0,e=t.length;i<e;i+=3)t[i+2]+=n}function Pt(t){for(var n=[],i=0,e=t.length;i<e;i+=7){var r=t[i],s=t[i+1],o=t[i+2],h=t[i+3],a=t[i+4],u=t[i+5];n.push({radialSegments:o,radius:h,height:a,altitude:u,center:[r,s]})}for(var c=n.length,l=[],f=[],x=0,y=0;y<c;y++){var d=G(n[y].center||[0,0],n[y]),p=d.position;if(n[y].altitude)for(var v=n[y].altitude,g=0,_=p.length;g<_;g+=3)d[g+2]+=v;f.push(d);var m=p.length/3;l[y]={position:{middleZ:n[y].height/2,count:m,start:x,end:x+3*m},hide:!1},x+=3*m}var z=bt(f),w=z.position,M=z.normal,b=z.uv,A=z.indices;return{position:w.buffer,normal:M.buffer,uv:b.buffer,indices:A.buffer,geometriesAttributes:l}}var St=Math.PI/180,Ct=6378137*Math.PI/180;function kt(t,n){var i,e=85.0511287798,r=t.x,s=Math.max(Math.min(e,t.y),-e);i=0===s?0:Math.log(Math.tan((90+s)*St/2))/St;var o=r*Ct,h=i*Ct;return n?(n.x=o,n.y=h,n):{x:o,y:h}}function Zt(t,n,i,e){var r=t[0]*(n.x-t[2])/i,s=-t[1]*(n.y-t[3])/i;return e?(e.x=r,e.y=s,e):{x:r,y:s}}function Ft(t){void 0===t&&(t=[]);for(var n=t.length,i=new Float32Array(3*n),e=0;e<n;e++){var r=t[e],s=3*e;i[s]=r[0],i[s+1]=r[1],i[s+2]=r[2]||0}return i}function Vt(t){for(var n=new Float32Array(2*t.length-6),i=0,e=0,r=t.length/3;e<r;e++){var s=t[3*e],o=t[3*e+1],h=t[3*e+2];if(e>0&&e<r-1){var a=3*i;n[a]=s,n[a+1]=o,n[a+2]=h,i++}var u=3*i;n[u]=s,n[u+1]=o,n[u+2]=h,i++}return n}function Lt(t){var n=0,i=t.length;if(1===i)return t[0];for(var e=0;e<i;e++)n+=t[e].length;for(var r=new Float32Array(n),s=0,o=0;o<i;o++)r.set(t[o],s),s+=t[o].length;return r}t.initialize=function(){},t.onmessage=function(t,n){var i=t.data,e=i.type,r=i.datas,s=i.glRes,o=i.matrix,h=i.center;if("ExtrudePolygons"===e){vt(r,h,s,o);var a=_t(r);n(null,a,[a.position,a.normal,a.uv,a.indices])}else if("ExtrudeLines"===e||"Paths"===e){for(var u=0,c=r.length;u<c;u++)for(var l=0,f=r[u].data.length;l<f;l++)r[u].data[l]=gt(r[u].data[l],r[u].center||h,s,o,!0);var x=_t(r,"ExtrudeLines"===e?2:3);n(null,x,[x.position,x.normal,x.uv,x.indices])}else if("ExtrudePolygon"===e){var y=[],d=[];r.forEach((function(t){var n=[t];vt(n,h,s,o);var i=_t(n),e=i.position,r=i.normal,a=i.uv,u=i.indices;y.push({id:t.id,position:e,normal:r,uv:a,indices:u}),d.push(e,r,a,u)})),n(null,y,d)}else if("Line"===e||"FatLine"===e){for(var p=[],v=[],g=0,_=r.length;g<_;g++){for(var m=[],z=0,w=r[g].data.length;z<w;z++){r[g].data[z]=gt(r[g].data[z],r[g].center||h,s,o,!0);var M=Ft(r[g].data[z]);m.push(Vt(M))}var b=Lt(m);At(b,r[g].bottomHeight),p.push({id:r[g].id,position:b.buffer}),v.push(b.buffer)}n(null,p,v)}else if("Lines"===e||"FatLines"===e){for(var A=0,P=[],S=[],C=0,k=[],Z=0,F=r.length;Z<F;Z++){for(var V=0,L=0,q=r[Z].data.length;L<q;L++){r[Z].data[L]=gt(r[Z].data[L],r[Z].center||h,s,o,!0);var E=Ft(r[Z].data[L]);At(E,r[Z].bottomHeight),V+=E.length/3*2-2,k.push(Vt(E))}var I=V;P[Z]=[A,A+I],A+=I,S[Z]={position:{count:V,start:C,end:C+3*V},hide:!1},"FatLines"===e&&(S[Z].instanceStart={count:V,start:C,end:C+3*V},S[Z].instanceEnd={count:V,start:C,end:C+3*V}),C+=3*V}var O=Lt(k);n(null,{id:r.id,position:O.buffer,geometriesAttributes:S,faceMap:P},[O.buffer])}else if("ExtrudeLine"===e||"Path"===e){for(var U=0,N=r.length;U<N;U++)for(var j=0,Q=r[U].data.length;j<Q;j++)r[U].data[j]=gt(r[U].data[j],r[U].center||h,s,o,!0);var R=[],W=[];r.forEach((function(t){var n=_t([t],"ExtrudeLine"===e?2:3),i=n.position,r=n.normal,s=n.uv,o=n.indices;R.push({id:t.id,position:i,normal:r,uv:s,indices:o}),W.push(i,r,s,o)})),n(null,R,W)}else if("Bar"===e){for(var B=[],T=[],H=(r=new Float32Array(r)).length/7,X=0;X<H;){var Y=r.slice(7*X,7*(X+1)),D=Pt(Y),G=D.position,J=D.normal,K=D.uv,$=D.indices;B.push({id:parseInt(Y[6]),position:G,normal:J,uv:K,indices:$}),T.push(G,J,K,$),X++}n(null,B,T)}else if("Bars"===e){var tt=Pt(r=new Float32Array(r));n(null,tt,[tt.position,tt.normal,tt.uv,tt.indices])}else console.error("No processing logic found for type:"+e)},Object.defineProperty(t,"__esModule",{value:!0})})'),n.registerWorkerAdapter("__maptalks.three.fetchdata__",(function(t){const e=[],r=[];function n(t){t.abort?(r.splice(r.indexOf(t),1),e.length&&(r.push(e[0]),e.splice(0,1),i(r[r.length-1]))):r.length<5?(r.push(t),i(t)):e.push(t)}function i(t){fetch(t.url).then((t=>t.text())).then((e=>{new Blob([e],{type:"application/json"}).arrayBuffer().then((e=>{t.postResponse(null,e,[e]),t.abort=!0,n(t)}))})).catch((e=>{console.error(e),t.abort=!0,n(t)}))}t.initialize=function(){},t.onmessage=function(t,e){n({url:t.data,postResponse:e,abort:!1})}})));var Do=6371008.8,Oo={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:250826616.45599997,kilometers:6371.0088,kilometres:6371.0088,meters:Do,metres:Do,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:3440.069546436285,radians:1,yards:6967335.223679999},No={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Do,yards:1.0936133},Fo={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Uo(t,e,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=e||{},n.geometry=t,n}function Qo(t,e,r){switch(t){case"Point":return Go(e).geometry;case"LineString":return qo(e).geometry;case"Polygon":return jo(e).geometry;case"MultiPoint":return Xo(e).geometry;case"MultiLineString":return Yo(e).geometry;case"MultiPolygon":return Jo(e).geometry;default:throw new Error(t+" is invalid")}}function Go(t,e,r){if(void 0===r&&(r={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!as(t[0])||!as(t[1]))throw new Error("coordinates must contain numbers");return Uo({type:"Point",coordinates:t},e,r)}function zo(t,e,r){return void 0===r&&(r={}),Wo(t.map((function(t){return Go(t,e)})),r)}function jo(t,e,r){void 0===r&&(r={});for(var n=0,i=t;n<i.length;n++){var o=i[n];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return Uo({type:"Polygon",coordinates:t},e,r)}function Vo(t,e,r){return void 0===r&&(r={}),Wo(t.map((function(t){return jo(t,e)})),r)}function qo(t,e,r){if(void 0===r&&(r={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return Uo({type:"LineString",coordinates:t},e,r)}function Ho(t,e,r){return void 0===r&&(r={}),Wo(t.map((function(t){return qo(t,e)})),r)}function Wo(t,e){void 0===e&&(e={});var r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=t,r}function Yo(t,e,r){return void 0===r&&(r={}),Uo({type:"MultiLineString",coordinates:t},e,r)}function Xo(t,e,r){return void 0===r&&(r={}),Uo({type:"MultiPoint",coordinates:t},e,r)}function Jo(t,e,r){return void 0===r&&(r={}),Uo({type:"MultiPolygon",coordinates:t},e,r)}function Ko(t,e,r){return void 0===r&&(r={}),Uo({type:"GeometryCollection",geometries:t},e,r)}function Zo(t,e){if(void 0===e&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r}function $o(t,e){void 0===e&&(e="kilometers");var r=Oo[e];if(!r)throw new Error(e+" units is invalid");return t*r}function ts(t,e){void 0===e&&(e="kilometers");var r=Oo[e];if(!r)throw new Error(e+" units is invalid");return t/r}function es(t,e){return ns(ts(t,e))}function rs(t){var e=t%360;return e<0&&(e+=360),e}function ns(t){return 180*(t%(2*Math.PI))/Math.PI}function is(t){return t%360*Math.PI/180}function os(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return $o(ts(t,e),r)}function ss(t,e,r){if(void 0===e&&(e="meters"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("area must be a positive number");var n=Fo[e];if(!n)throw new Error("invalid original units");var i=Fo[r];if(!i)throw new Error("invalid final units");return t/n*i}function as(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function us(t){return!!t&&t.constructor===Object}function ls(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!as(t))throw new Error("bbox must only contain numbers")}))}function hs(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}var cs=Object.freeze({__proto__:null,earthRadius:Do,factors:Oo,unitsFactors:No,areaFactors:Fo,feature:Uo,geometry:Qo,point:Go,points:zo,polygon:jo,polygons:Vo,lineString:qo,lineStrings:Ho,featureCollection:Wo,multiLineString:Yo,multiPoint:Xo,multiPolygon:Jo,geometryCollection:Ko,round:Zo,radiansToLength:$o,lengthToRadians:ts,lengthToDegrees:es,bearingToAzimuth:rs,radiansToDegrees:ns,degreesToRadians:is,convertLength:os,convertArea:ss,isNumber:as,isObject:us,validateBBox:ls,validateId:hs});function fs(t,e,r){if(null!==t)for(var n,i,o,s,a,u,l,h,c=0,f=0,p=t.type,d="FeatureCollection"===p,g="Feature"===p,y=d?t.features.length:1,v=0;v<y;v++){a=(h=!!(l=d?t.features[v].geometry:g?t.geometry:t)&&"GeometryCollection"===l.type)?l.geometries.length:1;for(var m=0;m<a;m++){var A=0,_=0;if(null!==(s=h?l.geometries[m]:l)){u=s.coordinates;var x=s.type;switch(c=!r||"Polygon"!==x&&"MultiPolygon"!==x?0:1,x){case null:break;case"Point":if(!1===e(u,f,v,A,_))return!1;f++,A++;break;case"LineString":case"MultiPoint":for(n=0;n<u.length;n++){if(!1===e(u[n],f,v,A,_))return!1;f++,"MultiPoint"===x&&A++}"LineString"===x&&A++;break;case"Polygon":case"MultiLineString":for(n=0;n<u.length;n++){for(i=0;i<u[n].length-c;i++){if(!1===e(u[n][i],f,v,A,_))return!1;f++}"MultiLineString"===x&&A++,"Polygon"===x&&_++}"Polygon"===x&&A++;break;case"MultiPolygon":for(n=0;n<u.length;n++){for(_=0,i=0;i<u[n].length;i++){for(o=0;o<u[n][i].length-c;o++){if(!1===e(u[n][i][o],f,v,A,_))return!1;f++}_++}A++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(!1===fs(s.geometries[n],e,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ps(t,e,r,n){var i=r;return fs(t,(function(t,n,o,s,a){i=0===n&&void 0===r?t:e(i,t,n,o,s,a)}),n),i}function ds(t,e){var r;switch(t.type){case"FeatureCollection":for(r=0;r<t.features.length&&!1!==e(t.features[r].properties,r);r++);break;case"Feature":e(t.properties,0)}}function gs(t,e,r){var n=r;return ds(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n}function ys(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var r=0;r<t.features.length&&!1!==e(t.features[r],r);r++);}function vs(t,e,r){var n=r;return ys(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n}function ms(t){var e=[];return fs(t,(function(t){e.push(t)})),e}function As(t,e){var r,n,i,o,s,a,u,l,h,c,f=0,p="FeatureCollection"===t.type,d="Feature"===t.type,g=p?t.features.length:1;for(r=0;r<g;r++){for(a=p?t.features[r].geometry:d?t.geometry:t,l=p?t.features[r].properties:d?t.properties:{},h=p?t.features[r].bbox:d?t.bbox:void 0,c=p?t.features[r].id:d?t.id:void 0,s=(u=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=u?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(o,f,l,h,c))return!1;break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===e(o.geometries[n],f,l,h,c))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,f,l,h,c))return!1;f++}}function _s(t,e,r){var n=r;return As(t,(function(t,i,o,s,a){n=0===i&&void 0===r?t:e(n,t,i,o,s,a)})),n}function xs(t,e){As(t,(function(t,r,n,i,o){var s,a=null===t?null:t.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==e(Uo(t,n,{bbox:i,id:o}),r,0)&&void 0}switch(a){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var u=0;u<t.coordinates.length;u++){var l=t.coordinates[u];if(!1===e(Uo({type:s,coordinates:l},n),r,u))return!1}}))}function ws(t,e,r){var n=r;return xs(t,(function(t,i,o){n=0===i&&0===o&&void 0===r?t:e(n,t,i,o)})),n}function bs(t,e){xs(t,(function(t,r,n){var i=0;if(t.geometry){var o=t.geometry.type;if("Point"!==o&&"MultiPoint"!==o){var s,a=0,u=0,l=0;return!1!==fs(t,(function(o,h,c,f,p){if(void 0===s||r>a||f>u||p>l)return s=o,a=r,u=f,l=p,void(i=0);var d=qo([s,o],t.properties);if(!1===e(d,r,n,p,i))return!1;i++,s=o}))&&void 0}}}))}function Es(t,e,r){var n=r,i=!1;return bs(t,(function(t,o,s,a,u){n=!1===i&&void 0===r?t:e(n,t,o,s,a,u),i=!0})),n}function Is(t,e){if(!t)throw new Error("geojson is required");xs(t,(function(t,r,n){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,r,n,0,0))return!1;break;case"Polygon":for(var s=0;s<o.length;s++)if(!1===e(qo(o[s],t.properties),r,n,s))return!1}}}))}function Cs(t,e,r){var n=r;return Is(t,(function(t,i,o,s){n=0===i&&void 0===r?t:e(n,t,i,o,s)})),n}function Ss(t,e){if(!us(e=e||{}))throw new Error("options is invalid");var r,n=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":n<0&&(n=t.features.length+n),a=a||t.features[n].properties,r=t.features[n].geometry;break;case"Feature":a=a||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var u=r.coordinates;switch(r.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=u.length+s-1),qo([u[s],u[s+1]],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s-1),qo([u[o][s],u[o][s+1]],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s-1),qo([u[i][s],u[i][s+1]],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s-1),qo([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")}function Ms(t,e){if(!us(e=e||{}))throw new Error("options is invalid");var r,n=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":n<0&&(n=t.features.length+n),a=a||t.features[n].properties,r=t.features[n].geometry;break;case"Feature":a=a||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var u=r.coordinates;switch(r.type){case"Point":return Go(u,a,e);case"MultiPoint":return i<0&&(i=u.length+i),Go(u[i],a,e);case"LineString":return s<0&&(s=u.length+s),Go(u[s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),Go(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),Go(u[i][s],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s),Go(u[i][o][s],a,e)}throw new Error("geojson is invalid")}var Bs=Object.freeze({__proto__:null,coordAll:ms,coordEach:fs,coordReduce:ps,featureEach:ys,featureReduce:vs,findPoint:Ms,findSegment:Ss,flattenEach:xs,flattenReduce:ws,geomEach:As,geomReduce:_s,lineEach:Is,lineReduce:Cs,propEach:ds,propReduce:gs,segmentEach:bs,segmentReduce:Es});function Ts(t){var e=[1/0,1/0,-1/0,-1/0];return fs(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}function ks(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Ps(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Ls(t){if(t.length>1&&as(t[0])&&as(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return Ls(t[0]);throw new Error("coordinates must only contain numbers")}function Rs(t,e,r){if(!e||!r)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.type)}function Ds(t,e,r){if(!t)throw new Error("No feature passed");if(!r)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.geometry.type)}function Os(t,e,r){if(!t)throw new Error("No featureCollection passed");if(!r)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+r+", FeatureCollection required");for(var n=0,i=t.features;n<i.length;n++){var o=i[n];if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+o.geometry.type)}}function Ns(t){return"Feature"===t.type?t.geometry:t}function Fs(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":"Feature"===t.type&&null!==t.geometry?t.geometry.type:t.type}Ts.default=Ts;var Us=Object.freeze({__proto__:null,getCoord:ks,getCoords:Ps,containsNumber:Ls,geojsonType:Rs,featureOf:Ds,collectionOf:Os,getGeom:Ns,getType:Fs}),Qs=Object.getOwnPropertySymbols,Gs=Object.prototype.hasOwnProperty,zs=Object.prototype.propertyIsEnumerable;
17
+ function(t){var e=t/2,r=t+e,n=1e4,i=Mn(2*r,2*r),o=i.getContext("2d");return o.shadowBlur=e,o.shadowColor="black",o.shadowOffsetX=o.shadowOffsetY=n,o.beginPath(),o.arc(r-n,r-n,t,0,2*Math.PI,!0),o.closePath(),o.fill(),i}(r._size||r.size||13),o=i.width/2,s=i.height/2,a=e,u={};for(var l in a.forEach((function(t){var e=void 0===t.count?1:t.count,r=Math.min(1,e/n).toFixed(2);u[r]=u[r]||[],u[r].push(t)})),u)if(!isNaN(l)){var h=u[l];t.beginPath(),r.withoutAlpha||(t.globalAlpha=l),h.forEach((function(e){var r=e.coordinate,a=void 0===e.count?1:e.count;t.globalAlpha=a/n,t.drawImage(i,r[0]-o,r[1]-s)}))}}zn.prototype.setMax=function(t){this.max=t||100},zn.prototype.setMin=function(t){this.min=t||0},zn.prototype.setMaxSize=function(t){this.maxSize=t||35},zn.prototype.setMinSize=function(t){this.minSize=t||0},zn.prototype.initPalette=function(){var t=this.gradient,e=Mn(256,1),r=this.paletteCtx=e.getContext("2d"),n=r.createLinearGradient(0,0,256,1);for(var i in t)n.addColorStop(parseFloat(i),t[i]);r.fillStyle=n,r.fillRect(0,0,256,1)},zn.prototype.getColor=function(t){var e=this.getImageData(t);return"rgba("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]/256+")"},zn.prototype.getImageData=function(t){var e=this.paletteCtx.getImageData(0,0,256,1).data;if(void 0===t)return e;var r=this.max,n=this.min;t>r&&(t=r),t<n&&(t=n);var i=4*Math.floor((t-n)/(r-n)*255);return[e[i],e[i+1],e[i+2],e[i+3]]},zn.prototype.getSize=function(t){var e=this.max,r=this.min,n=this.maxSize,i=this.minSize;return t>e&&(t=e),t<r&&(t=r),e>r?i+(t-r)/(e-r)*(n-i):n},zn.prototype.getLegend=function(t){var e=this.gradient,r=t.width||20,n=t.height||180,i=Mn(r,n),o=i.getContext("2d"),s=o.createLinearGradient(0,n,0,0);for(var a in e)s.addColorStop(parseFloat(a),e[a]);return o.fillStyle=s,o.fillRect(0,0,r,n),i};var Hn={draw:function(t,e,r){if(!(t.canvas.width<=0||t.canvas.height<=0)){var n=r.strength||.3;t.strokeStyle="rgba(0,0,0,"+n+")";var i=Mn(t.canvas.width,t.canvas.height),o=i.getContext("2d");o.scale(devicePixelRatio,devicePixelRatio),r=r||{},t.save();var s=new zn({gradient:r.gradient});if(qn(o,e,r),!r.absolute){var a=o.getImageData(0,0,t.canvas.width,t.canvas.height);jn(a.data,s.getImageData(),r),t.putImageData(a,0,0),t.restore()}s=null,i=null}},drawGray:qn,colorize:jn};const Wn={altitude:0,interactive:!1,min:0,max:100,size:13,gradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},gridScale:.5},Yn=2048;class Xn extends H{constructor(t,e,r,o){Array.isArray(t)||(t=[t]);let s=1/0,a=1/0,u=-1/0,l=-1/0;const h=[];for(let e=0,r=t.length;e<r;e++){const{coordinate:r,lnglat:n,xy:i}=t[e],c=r||n||i;if(!c){console.warn("not find coordinate");continue}const f=o.coordinateToVector3(c);h.push(f);const{x:p,y:d}=f;s=Math.min(s,p),a=Math.min(a,d),u=Math.max(u,p),l=Math.max(l,d)}e=n.Util.extend({},Wn,e,{layer:o,points:t});let{gridScale:c,altitude:f,size:p}=e;const d=Math.abs(u-s),g=Math.abs(l-a),y=Math.max(d*c,g*c);if(y>Yn){console.warn(`gridScale: ${c} it's too big. I hope it's a smaller value,canvas max size is 2048* 2048`);c=Yn/(y/c)}let v=Math.ceil(d*c),m=Math.ceil(g*c);const A=v/d,_=m/g,x=[],w=Math.ceil(2*p);for(let e=0,r=h.length;e<r;e++){const r=h[e];r.x-=s,r.y-=a,r.x*=A,r.y*=_,r.y=m-r.y,r.x+=w,r.y+=w,x.push({coordinate:[r.x,r.y],count:t[e].count})}v+=2*w,m+=2*w;let b=Mn(v,m),E=b.getContext("2d");Hn.drawGray(E,x,e);const I=E.getImageData(0,0,E.canvas.width,E.canvas.height);let C=-1/0;const S=new Float32Array(I.data.length/4),M=new Float32Array(I.data.length/4);for(let t=3,e=I.data.length,r=0;t<e;t+=4){const e=I.data[t];C=Math.max(C,e),M[r]=e,e<=0&&(S[r]=1),r++}const B=new zn({gradient:e.gradient});Hn.colorize(I.data,B.getImageData(),e),b=null,E=null;const T=Pn(d,g,v-1,m-1),k=T.getIndex().array,P=T.attributes.position.array,R=new Float32Array(P.length),O=new Uint32Array(6*P.length),N=new i.Color;let F=0;for(let t=0,e=P.length,r=0,n=k.length,i=0,o=I.data.length,s=0;t<Math.max(e,n,o);t+=3){if(t<e){const e=M[s];e>0&&(P[t+2]=e/C)}if(r<n){const t=k[r],e=k[r+1],n=k[r+2];S[t]&&S[e]&&S[n]||(O[F]=t,O[F+1]=e,O[F+2]=n,F+=3)}if(i<o){const t=`rgb(${I.data[i]},${I.data[i+1]},${I.data[i+2]})`;N.setStyle(t),R[r]=N.r,R[r+1]=N.g,R[r+2]=N.b}r+=3,i+=4,s++}const U=new Uint32Array(F);for(let t=0;t<F;t++)U[t]=O[t];T.setIndex(new i.BufferAttribute(U,1)),L(T,"color",new i.BufferAttribute(R,3,!0)),r.vertexColors=D(),super(),this._initOptions(e),this._createMesh(T,r);const Q=o.altitudeToVector3(f,f).x;this.getObject3d().position.copy(new i.Vector3((s+u)/2,(a+l)/2,Q)),this.type="HeatMap"}}const Jn=new i.Color;let Kn=1;class Zn{constructor(t){this.object3ds=[],this.layer=t,this.camera=t.getCamera(),this.renderer=t.getThreeRenderer(),this.pickingTexture=P>=152?new i.WebGLRenderTarget(1,1,{format:i.RGBAFormat,colorSpace:i.SRGBColorSpace}):new i.WebGLRenderTarget(1,1,{}),this.pickingScene=new i.Scene}getColor(){return Jn.setHex(Kn),Kn++,Jn}add(t){if(t){const e=t._colorIndex;e&&(this.object3ds[e]=t,this.pickingScene.add(t))}return this}remove(t){if(t){const e=t._colorIndex;e&&(this.object3ds[e]=null,this.pickingScene.remove(t))}return this}isEmpty(){if(0===this.pickingScene.children.length)return!0;for(let t=0,e=this.pickingScene.children.length;t<e;t++){const e=this.pickingScene.children[t];if(e){const t=e.__parent;if(t&&!0===t.getOptions().interactive)return!1}}return!0}pick(t){if(!t)return;if(this.isEmpty())return;const{camera:e,renderer:r,pickingTexture:n,pickingScene:i,object3ds:o,layer:s}=this,a=this.pickingScene.children.length;for(let t=0;t<a;t++){const e=this.pickingScene.children[t];e&&e.__parent&&(e.__parent.picked=!1)}const{width:u,height:l}=s._getRenderer().canvas,h=n.width,c=n.height;u===h&&l===c||n.setSize(u,l),r.setRenderTarget(n),r.clear(),e&&e.layers&&this.camera.layers.set(0),r.render(i,e);const f=new Uint8Array(4),{x:p,y:d}=t;let g=window.devicePixelRatio;const y=s.getMap();y&&(g=y.getDevicePixelRatio?y.getDevicePixelRatio():y.options.devicePixelRatio);const v=p*g,m=n.height-d*g;r.readRenderTargetPixels(n,Math.round(v),Math.round(m),1,1,f);const A=f[0]<<16|f[1]<<8|f[2],_=o[A];if(_)_.__parent&&(o[A].__parent.picked=!0);else for(let t=0;t<a;t++){const e=this.pickingScene.children[t];if(e&&e.__parent){const t=e.__parent;if(t._colorMap&&null!=t._colorMap[A]){t.picked=!0,t.index=t._colorMap[A];break}}}r.setRenderTarget(null)}}const $n={bottomHeight:0,altitude:0};class ti extends H{constructor(t,e,r,i){e=n.Util.extend({},$n,e,{layer:i,lineString:t}),super(),this._initOptions(e);const{asynchronous:o}=e,{lineStrings:s,center:a}=je(t),u=new z;let l;if(o){const e=n.Util.GUID();this.getOptions().id=e,this.getOptions().center=a,fr.push({id:e,data:s,lineString:t,center:a,layer:i,baseObject:this})}else{const t=[],r={};for(let n=0,o=s.length;n<o;n++){const o=Fe(s[n],i,a,!1).positions;xe(o,e.bottomHeight,i,r),t.push(Ve(o))}l=qe(t),u.setPositions(l)}this._setMaterialRes(i,r),this._createLine2(u,r);const{altitude:h}=e,c=i.altitudeToVector3(h,h).x,f=i.coordinateToVector3(a,c);this.getObject3d().position.copy(f),o||(this._setPickObject3d(l,r.linewidth),this._init()),this.type="FatLine"}_init(){const t=this.getLayer().getPick();this.on("add",(()=>{t.add(this.pickObject3d)})),this.on("remove",(()=>{t.remove(this.pickObject3d)}))}_setMaterialRes(t,e){const r=t.getMap();if(!r)return this;const n=r.getSize(),i=n.width,o=n.height;e.resolution.set(i,o)}_setPickObject3d(t,e){const r=new z;r.setPositions(t);const n=this.getLayer().getPick().getColor(),i=[];for(let e=0,r=t.length/3;e<r;e++)i.push(n.r,n.g,n.b);r.setColors(i);const o=new Q({color:"#fff",linewidth:e,vertexColors:D()});this._setMaterialRes(this.getLayer(),o);const s=n.getHex(),a=new j(r,o);a.position.copy(this.getObject3d().position),a._colorIndex=s,this.setPickObject3d(a)}identify(t){return this.picked}setSymbol(t){if(t&&t instanceof i.Material){t.needsUpdate=!0;const e=this.getMap().getSize(),r=e.width,n=e.height;t.resolution.set(r,n),this.getObject3d().material=t}return this}_workerLoad(t){const e=new Float32Array(t.position),r=this.getObject3d();if(r.geometry.setPositions(e),r.computeLineDistances(),this._setPickObject3d(e,r.material.linewidth),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}_animation(){const t=this.getLayer();if(!t)return this;[this.getObject3d(),this.getPickObject3d()].forEach((e=>{e&&this._setMaterialRes(t,e.material)}))}}const ei={altitude:0,colors:null};class ri extends(tn(H)){constructor(t,e,r,i){Array.isArray(t)||(t=[t]);const o=[],s=[],a=t.length;for(let e=0;e<a;e++){const r=je(t[e]);o.push(r.center),s.push(r.lineStrings)}const u=_e(o);e=n.Util.extend({},ei,e,{layer:i,lineStrings:t,coordinate:u}),super(),this._initOptions(e);const{asynchronous:l}=e,h=new z,c=[],f={};let p,d,g=[],y=0,v=[];if(l)pr.push({id:n.Util.GUID(),data:s,key:e.key,center:u,layer:i,baseObject:this,lineStrings:t,option:e});else{for(let t=0;t<a;t++){const r=s[t];let o=0;for(let t=0,s=r.length;t<s;t++){const s=Se(r[t]),a=n.Util.extend({},e,s),{positions:l}=Fe(r[t],i,u,!1);xe(l,a.bottomHeight,i,f),o+=l.length/3*2-2,v.push(Ve(l))}g[t]={position:{count:o,start:y,end:y+3*o},instanceStart:{count:o,start:y,end:y+3*o},instanceEnd:{count:o,start:y,end:y+3*o},hide:!1},y+=3*o}p=qe(v),h.setPositions(p)}this._setMaterialRes(i,r),this._createLine2(h,r);const{altitude:m}=e,A=i.altitudeToVector3(m,m).x,_=i.coordinateToVector3(u,A);this.getObject3d().position.copy(_),this._baseObjects=c,this._datas=t,this._geometriesAttributes=g,this.faceIndex=null,this.index=null,this._geometryCache=new z,l||(d=new Float32Array(p),this._geometryCache.setPositions(d)),this._colorMap={},this.isHide=!1,this._initBaseObjectsEvent(c),l||(this._setPickObject3d(d,r.linewidth),this._init()),this.type="FatLines"}_setMaterialRes(t,e){const r=t.getMap();if(!r)return this;const n=r.getSize(),i=n.width,o=n.height;e.resolution.set(i,o)}_setPickObject3d(t,e){if(!this._colorMap)return;const r=this._geometryCache||new z;r.setPositions(t);const n=this.getLayer().getPick(),{_geometriesAttributes:i}=this,o=we(i);let s=0;for(let t=0,e=i.length;t<e;t++){const e=n.getColor(),r=e.getHex();this._colorMap[r]=t;const{count:a}=i[t].position;this._datas[t].colorIndex=r;for(let t=0;t<a;t++)o[s]=e.r,o[s+1]=e.g,o[s+2]=e.b,s+=3}r.setColors(o);const a=new Q({color:"#fff",linewidth:e,vertexColors:D()});this._setMaterialRes(this.getLayer(),a);const u=n.getColor().getHex(),l=new j(r,a);l.position.copy(this.getObject3d().position),l._colorIndex=u,this.setPickObject3d(l)}identify(t){return this.picked}setSymbol(t){if(t&&t instanceof i.Material){t.needsUpdate=!0;const e=this.getMap().getSize(),r=e.width,n=e.height;t.resolution.set(r,n),this.getObject3d().material=t}return this}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],r=n.Util.extend({},this.getOptions(),{index:t},K(e)?e.properties:e.getProperties());this._baseObjects[t]=new ti(e,r,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}_updateAttribute(t,e){const{indexs:r}=this._getHideGeometryIndex(e),n=this._geometryCache.attributes[e].array,i=n.length;for(let e=0;e<i;e++)t.array[e]=n[e];for(let n=0;n<r.length;n++){const i=r[n],{start:o,end:s}=this._geometriesAttributes[i][e];for(let e=o;e<s;e++)t.array[e]=-1e5}return this}_showGeometry(t,e){let r;if(t&&(r=t.getOptions().index),null!=r){const t=this._geometriesAttributes[r],{hide:n}=t;if(n===e)return this;t.hide=e;const i=this.getObject3d().geometry;this._updateAttribute(i.attributes.instanceStart,"instanceStart"),this._updateAttribute(i.attributes.instanceEnd,"instanceEnd"),i.attributes.instanceStart.data.needsUpdate=!0,i.attributes.instanceEnd.data.needsUpdate=!0,this.isHide=e}return this}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const r=this.getObject3d(),n=new Float32Array(t.position),i=new Float32Array(n);if(r.geometry.setPositions(new Float32Array(n)),this._geometryCache.setPositions(i),this._setPickObject3d(i,r.material.linewidth),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}_animation(){const t=this.getLayer();if(!t)return this;[this.getObject3d(),this.getPickObject3d()].forEach((e=>{e&&this._setMaterialRes(t,e.material)}))}}const ni={radius:10,height:100,altitude:0,topColor:"",bottomColor:"#2d2f61",heightEnable:!0};class ii extends H{constructor(t,e,r,i){e=n.Util.extend({},ni,e,{layer:i,coordinate:t}),super(),this._initOptions(e);const{height:o,radius:s,topColor:a,bottomColor:u,altitude:l}=e,h=i.altitudeToVector3(o,o).x,c=i.distanceToVector3(s,s).x,f=Lr().clone();f.scale(2*c,2*c,h),a&&(kr(f,u,a,"z",h/2),r.vertexColors=D()),this._createMesh(f,r);const p=i.altitudeToVector3(l,l).x,d=i.coordinateToVector3(t,p);this.getObject3d().position.copy(d),this.type="Box"}}const oi={radius:10,height:100,altitude:0,topColor:null,bottomColor:"#2d2f61"};class si extends(tn(H)){constructor(t,e,r,i){Array.isArray(t)||(t=[t]);const o=t.length,s=_e(t),a=i.coordinateToVector3(s),u=[],l=[],h=[];let c=0;e=n.Util.extend({},{altitude:0,layer:i,points:t},oi,e);const f={},p={};for(let s=0;s<o;s++){const o=n.Util.extend({index:s},e,t[s]),{radius:d,altitude:g,topColor:y,bottomColor:v,height:m,coordinate:A}=o,_=me(d,i,f),x=Ae(m,i,p),w=Ae(g,i,p),b=Lr().clone();b.scale(2*_,2*_,x),y&&(kr(b,v,y,"z",x/2),r.vertexColors=D());const E=i.coordinateToVector3(A).sub(a),I=b.attributes.position.array;for(let t=0,e=I.length;t<e;t+=3)I[t+2]+=w,I[t]+=E.x,I[t+1]+=E.y,I[t+2]+=E.z;u.push(b);const C=new ii(A,o,r,i);l.push(C),b.index.count;const S=b.attributes.position.count;b.attributes.normal.count,b.attributes.uv.count,h[s]={position:{count:S,start:c,end:c+3*S},hide:!1},c+=3*S}super(),this._initOptions(e);const d=Pr(u);this._createMesh(d,r);const g=e.altitude,y=i.altitudeToVector3(g,g).x,v=a.clone();v.z=y,this.getObject3d().position.copy(v),this._baseObjects=l,this._datas=t,this._geometriesAttributes=h,this.faceIndex=null,this._geometryCache=br(d),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(l),this._setPickObject3d(),this._init(),this.type="Boxs"}identify(t){return this.picked}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function ai(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})})),e}var ui={exports:{}};function li(t,e,r){r=r||2;var n,i,o,s,a,u,l,h=e&&e.length,c=h?e[0]*r:t.length,f=hi(t,0,c,r,!0),p=[];if(!f||f.next===f.prev)return p;if(h&&(f=function(t,e,r,n){var i,o,s,a=[];for(i=0,o=e.length;i<o;i++)(s=hi(t,e[i]*n,i<o-1?e[i+1]*n:t.length,n,!1))===s.next&&(s.steiner=!0),a.push(xi(s));for(a.sort(vi),i=0;i<a.length;i++)r=mi(a[i],r);return r}(t,e,f,r)),t.length>80*r){n=o=t[0],i=s=t[1];for(var d=r;d<c;d+=r)(a=t[d])<n&&(n=a),(u=t[d+1])<i&&(i=u),a>o&&(o=a),u>s&&(s=u);l=0!==(l=Math.max(o-n,s-i))?32767/l:0}return fi(f,p,r,n,i,l,0),p}function hi(t,e,r,n,i){var o,s;if(i===Ri(t,e,r,n)>0)for(o=e;o<r;o+=n)s=ki(o,t[o],t[o+1],s);else for(o=r-n;o>=e;o-=n)s=ki(o,t[o],t[o+1],s);return s&&Ii(s,s.next)&&(Pi(s),s=s.next),s}function ci(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!Ii(n,n.next)&&0!==Ei(n.prev,n,n.next))n=n.next;else{if(Pi(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function fi(t,e,r,n,i,o,s){if(t){!s&&o&&function(t,e,r,n){var i=t;do{0===i.z&&(i.z=_i(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,o,s,a,u,l=1;do{for(r=t,t=null,o=null,s=0;r;){for(s++,n=r,a=0,e=0;e<l&&(a++,n=n.nextZ);e++);for(u=l;a>0||u>0&&n;)0!==a&&(0===u||!n||r.z<=n.z)?(i=r,r=r.nextZ,a--):(i=n,n=n.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,l*=2}while(s>1)}(i)}(t,n,i,o);for(var a,u,l=t;t.prev!==t.next;)if(a=t.prev,u=t.next,o?di(t,n,i,o):pi(t))e.push(a.i/r|0),e.push(t.i/r|0),e.push(u.i/r|0),Pi(t),t=u.next,l=u.next;else if((t=u)===l){s?1===s?fi(t=gi(ci(t),e,r),e,r,n,i,o,2):2===s&&yi(t,e,r,n,i,o):fi(ci(t),e,r,n,i,o,1);break}}}function pi(t){var e=t.prev,r=t,n=t.next;if(Ei(e,r,n)>=0)return!1;for(var i=e.x,o=r.x,s=n.x,a=e.y,u=r.y,l=n.y,h=i<o?i<s?i:s:o<s?o:s,c=a<u?a<l?a:l:u<l?u:l,f=i>o?i>s?i:s:o>s?o:s,p=a>u?a>l?a:l:u>l?u:l,d=n.next;d!==e;){if(d.x>=h&&d.x<=f&&d.y>=c&&d.y<=p&&wi(i,a,o,u,s,l,d.x,d.y)&&Ei(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function di(t,e,r,n){var i=t.prev,o=t,s=t.next;if(Ei(i,o,s)>=0)return!1;for(var a=i.x,u=o.x,l=s.x,h=i.y,c=o.y,f=s.y,p=a<u?a<l?a:l:u<l?u:l,d=h<c?h<f?h:f:c<f?c:f,g=a>u?a>l?a:l:u>l?u:l,y=h>c?h>f?h:f:c>f?c:f,v=_i(p,d,e,r,n),m=_i(g,y,e,r,n),A=t.prevZ,_=t.nextZ;A&&A.z>=v&&_&&_.z<=m;){if(A.x>=p&&A.x<=g&&A.y>=d&&A.y<=y&&A!==i&&A!==s&&wi(a,h,u,c,l,f,A.x,A.y)&&Ei(A.prev,A,A.next)>=0)return!1;if(A=A.prevZ,_.x>=p&&_.x<=g&&_.y>=d&&_.y<=y&&_!==i&&_!==s&&wi(a,h,u,c,l,f,_.x,_.y)&&Ei(_.prev,_,_.next)>=0)return!1;_=_.nextZ}for(;A&&A.z>=v;){if(A.x>=p&&A.x<=g&&A.y>=d&&A.y<=y&&A!==i&&A!==s&&wi(a,h,u,c,l,f,A.x,A.y)&&Ei(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;_&&_.z<=m;){if(_.x>=p&&_.x<=g&&_.y>=d&&_.y<=y&&_!==i&&_!==s&&wi(a,h,u,c,l,f,_.x,_.y)&&Ei(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function gi(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!Ii(i,o)&&Ci(i,n,n.next,o)&&Bi(i,o)&&Bi(o,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(o.i/r|0),Pi(n),Pi(n.next),n=t=o),n=n.next}while(n!==t);return ci(n)}function yi(t,e,r,n,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&bi(s,a)){var u=Ti(s,a);return s=ci(s,s.next),u=ci(u,u.next),fi(s,e,r,n,i,o,0),void fi(u,e,r,n,i,o,0)}a=a.next}s=s.next}while(s!==t)}function vi(t,e){return t.x-e.x}function mi(t,e){var r=function(t,e){var r,n=e,i=t.x,o=t.y,s=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var a=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=i&&a>s&&(s=a,r=n.x<n.next.x?n:n.next,a===i))return r}n=n.next}while(n!==e);if(!r)return null;var u,l=r,h=r.x,c=r.y,f=1/0;n=r;do{i>=n.x&&n.x>=h&&i!==n.x&&wi(o<c?i:s,o,h,c,o<c?s:i,o,n.x,n.y)&&(u=Math.abs(o-n.y)/(i-n.x),Bi(n,t)&&(u<f||u===f&&(n.x>r.x||n.x===r.x&&Ai(r,n)))&&(r=n,f=u)),n=n.next}while(n!==l);return r}(t,e);if(!r)return e;var n=Ti(r,t);return ci(n,n.next),ci(r,r.next)}function Ai(t,e){return Ei(t.prev,t,e.prev)<0&&Ei(e.next,t,t.next)<0}function _i(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function xi(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function wi(t,e,r,n,i,o,s,a){return(i-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(n-a)>=(r-s)*(e-a)&&(r-s)*(o-a)>=(i-s)*(n-a)}function bi(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Ci(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Bi(t,e)&&Bi(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(Ei(t.prev,t,e.prev)||Ei(t,e.prev,e))||Ii(t,e)&&Ei(t.prev,t,t.next)>0&&Ei(e.prev,e,e.next)>0)}function Ei(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Ii(t,e){return t.x===e.x&&t.y===e.y}function Ci(t,e,r,n){var i=Mi(Ei(t,e,r)),o=Mi(Ei(t,e,n)),s=Mi(Ei(r,n,t)),a=Mi(Ei(r,n,e));return i!==o&&s!==a||(!(0!==i||!Si(t,r,e))||(!(0!==o||!Si(t,n,e))||(!(0!==s||!Si(r,t,n))||!(0!==a||!Si(r,e,n)))))}function Si(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Mi(t){return t>0?1:t<0?-1:0}function Bi(t,e){return Ei(t.prev,t,t.next)<0?Ei(t,e,t.next)>=0&&Ei(t,t.prev,e)>=0:Ei(t,e,t.prev)<0||Ei(t,t.next,e)<0}function Ti(t,e){var r=new Li(t.i,t.x,t.y),n=new Li(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function ki(t,e,r,n){var i=new Li(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Pi(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 Li(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Ri(t,e,r,n){for(var i=0,o=e,s=r-n;o<r;o+=n)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}ui.exports=li,ui.exports.default=li,li.deviation=function(t,e,r,n){var i=e&&e.length,o=i?e[0]*r:t.length,s=Math.abs(Ri(t,0,o,r));if(i)for(var a=0,u=e.length;a<u;a++){var l=e[a]*r,h=a<u-1?e[a+1]*r:t.length;s-=Math.abs(Ri(t,l,h,r))}var c=0;for(a=0;a<n.length;a+=3){var f=n[a]*r,p=n[a+1]*r,d=n[a+2]*r;c+=Math.abs((t[f]-t[d])*(t[p+1]-t[f+1])-(t[f]-t[p])*(t[d+1]-t[f+1]))}return 0===s&&0===c?0:Math.abs((c-s)/s)},li.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)r.vertices.push(t[i][o][s]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r};var Di=ui.exports;function Oi(t,e,r){var n=e[0],i=e[1],o=r[0]-n,s=r[1]-i;if(0!==o||0!==s){var a=((t[0]-n)*o+(t[1]-i)*s)/(o*o+s*s);a>1?(n=r[0],i=r[1]):a>0&&(n+=o*a,i+=s*a)}return(o=t[0]-n)*o+(s=t[1]-i)*s}function Ni(t,e,r,n,i){for(var o,s=n,a=e+1;a<r;a++){var u=Oi(t[a],t[e],t[r]);u>s&&(o=a,s=u)}s>n&&(o-e>1&&Ni(t,e,o,n,i),i.push(t[o]),r-o>1&&Ni(t,o,r,n,i))}function Fi(t,e){var r=t.length-1,n=[t[0]];return Ni(t,0,r,e,n),n.push(t[r]),n}function Ui(t,e,r){if(t.length<=2)return t;var n=void 0!==e?e*e:1;return t=r?t:function(t,e){for(var r,n,i,o,s,a=t[0],u=[a],l=1,h=t.length;l<h;l++)r=t[l],i=a,o=void 0,s=void 0,o=(n=r)[0]-i[0],s=n[1]-i[1],o*o+s*s>e&&(u.push(r),a=r);return a!==r&&u.push(r),u}(t,n),t=Fi(t,n)}function Qi(t,e){return t[0]*e[0]+t[1]*e[1]}function Gi(t,e){const r=e[0],n=e[1],i=Math.sqrt(r*r+n*n);return t[0]=r/i,t[1]=n/i,t}function zi(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}function ji(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t}function Vi(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function qi(t,e){const r=e[0],n=e[1],i=e[2],o=Math.sqrt(r*r+n*n+i*i);return t[0]=r/o,t[1]=n/o,t[2]=i/o,t}function Hi(t,e,r){var n=e[0],i=e[1],o=e[2],s=r[0],a=r[1],u=r[2];return t[0]=i*u-o*a,t[1]=o*s-n*u,t[2]=n*a-i*s,t}const Wi=[];function Yi(t,e,r,n){const i=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}(e,r),o=Math.acos(i)*n;return zi(Wi,r,e,-i),function(t,e){const r=e[0],n=e[1],i=e[2],o=Math.sqrt(r*r+n*n+i*i);t[0]=r/o,t[1]=n/o,t[2]=i/o}(Wi,Wi),function(t,e,r){t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r}(t,e,Math.cos(o)),zi(t,t,Wi,Math.sin(o)),t}function Xi(t,e,r,n,i,o,s,a,u,l){const h=s-i,c=a-o,f=(h*(e-o)-c*(t-i))/(c*(r-t)-h*(n-e));return u&&(u[l=l||0]=t+f*(r-t),u[l+1]=e+f*(n-e)),f}function Ji(t,e,r){if(r-e<3)return 0;let n=0;for(let i=2*(r-1),o=2*e;o<2*r;){const e=t[i],r=t[i+1],s=t[o],a=t[o+1];i=o,o+=2,n+=e*a-s*r}return n}function Ki(t,e,r=2){return Di(t,e,r)}const Zi=[],$i=[],to=[];function eo(t,e,r,n,i,o,s,a,u){const l=null!=s;let h,c,f,p=i,d=null;l&&(d=new Uint32Array(n-r));let g=[];for(let i=r;i<n;i++){const y=i===n-1?r:i+1,v=i===r?n-1:i-1,m=t[2*v],A=t[2*v+1],_=t[2*i],x=t[2*i+1],w=t[2*y],b=t[2*y+1];Zi[0]=_-m,Zi[1]=x-A,$i[0]=w-_,$i[1]=b-x,Gi(Zi,Zi),Gi($i,$i),l&&(d[i]=p);let E,I,C=!1;if(a||i!==r)if(a||i!==n-1){ji(to,$i,Zi);const t=to[1];to[1]=-to[0],to[0]=t,Gi(to,to);const r=Qi(to,$i),n=Math.sqrt(1-r*r),i=o*Math.min(10,1/n);if(l&&1/n>s&&o*r<0){const t=_+to[0]*o,r=x+to[1]*o,i=Math.acos(n)/2,s=Math.tan(i)*Math.abs(o);e[2*p]=t+to[1]*s,e[2*p+1]=r-to[0]*s,p++,e[2*p]=t-to[1]*s,e[2*p+1]=r+to[0]*s,p++}else E=_+to[0]*i,I=x+to[1]*i,C=!0;if(C){if(u&&null!=h){const t=Xi(m,A,h,c,_,x,E,I,g,0);t>=-.01&&t<=1.01&&(e[2*f]=E=g[0],e[2*f+1]=I=g[1])}h=e[2*p]=E,c=e[2*p+1]=I,f=p,p++}}else to[0]=Zi[1],to[1]=-Zi[0],Gi(to,to),E=_+to[0]*o,I=x+to[1]*o,C=!0;else to[0]=$i[1],to[1]=-$i[0],Gi(to,to),h=e[2*p]=_+to[0]*o,c=e[2*p+1]=x+to[1]*o,f=p,p++}return d}function ro(t,e,r,n,i){const o=null!=n?[]:new Float32Array(t.length);if(eo(t,o,0,e&&e.length?e[0]:t.length/2,0,r,n,i,!0),e)for(let s=0;s<e.length;s++){const a=e[s];eo(t,o,a,e[s+1]||t.length/2,null!=n?o.length/2:a,r,n,i,!1)}return o}function no(t,e,r,n){for(let i=0;i<Math.floor((n-r)/2);i++)for(let o=0;o<e;o++){const s=(i+r)*e+o,a=(n-i-1)*e+o,u=t[s];t[s]=t[a],t[a]=u}return t}function io(t,e){let r=t.length/2,n=0,i=e&&e.length?e[0]:r;Ji(t,n,i)>0&&no(t,2,n,i);for(let o=1;o<(e?e.length:0)+1;o++)n=e[o-1],i=e[o]||r,Ji(t,n,i)<0&&no(t,2,n,i)}const oo=[[0,0],[1,0],[1,1],[0,0],[1,1],[0,1]];function so(t,e,r){let n=0,i=t[e],o=t[e+1];const s=i,a=o;for(let s=e+2;s<r;s+=2){const e=t[s],r=t[s+1];n+=Math.sqrt((e-i)*(e-i)+(r-o)*(r-o)),i=e,o=r}return n+=Math.sqrt((i-s)*(i-s)+(o-a)*(o-a)),n}function ao(t,{vertices:e,topVertices:r,splittedMap:n,depth:i,rect:o},s,a,u,l){const h=a-s,c=l.smoothBevel?1:2,f=Math.min(i/2,l.bevelSize),p=l.bevelSegments,d=u.vertex,g=u.ringPerimeter,y=Math.max(o.width,o.height,i,g);function v(t){const r=(t+1)%h,n=e[2*t],i=e[2*t+1],o=e[2*r],s=e[2*r+1];return n===o&&i===s}if(f>0){const o=[0,0,1],a=[],l=[0,0,-1],g=[];let m=0,A=new Float32Array(h);for(let _=0;_<2;_++){const x=0===_?i-f:f;for(let i=0;i<=p*c;i++){let w,b,E=0;for(let I=0;I<h;I++){const C=2*(I%h+s),S=n?2*n[C/2]:C;a[0]=e[C]-r[S],a[1]=e[C+1]-r[S+1],a[2]=0;const M=Math.sqrt(a[0]*a[0]+a[1]*a[1]);a[0]/=M,a[1]/=M;const B=(Math.floor(i/c)+i%c)/p;0===_?Yi(g,o,a,B):Yi(g,a,l,B);const T=0===_?B:1-B,k=f*Math.sin(T*Math.PI/2),P=M*Math.cos(T*Math.PI/2),L=f*M/Math.sqrt(k*k+P*P),R=g[0]*L+r[S],D=g[1]*L+r[S+1],O=g[2]*L+x;if(t.position[3*u.vertex]=R,t.position[3*u.vertex+1]=D,t.position[3*u.vertex+2]=O,I>0&&(E+=Math.sqrt((w-R)*(w-R)+(b-D)*(b-D))),i>0||_>0){let e=3*(u.vertex-h),r=t.position[e],n=t.position[e+1],i=t.position[e+2];A[I]+=Math.sqrt((r-R)*(r-R)+(n-D)*(n-D)+(i-O)*(i-O))}if(t.uv[2*u.vertex]=E/y,t.uv[2*u.vertex+1]=A[I]/y,w=R,b=D,u.vertex++,!v(I)&&(c>1&&i%c||1===c&&i>=1))for(let e=0;e<6;e++){const r=(oo[e][0]+I)%h,n=oo[e][1]+m;t.indices[u.index++]=(n-1)*h+r+d}}m++}}}else for(let r=0;r<2;r++){const n=0===r?i-f:f;let o,a,l=0;for(let r=0;r<h;r++){const i=2*(r%h+s),c=e[i],f=e[i+1];t.position[3*u.vertex]=c,t.position[3*u.vertex+1]=f,t.position[3*u.vertex+2]=n,r>0&&(l+=Math.sqrt((o-c)*(o-c)+(a-f)*(a-f))),t.uv[2*u.vertex]=l/y,t.uv[2*u.vertex+1]=n/y,o=c,a=f,u.vertex++}}const m=f>0?p*c+1:1;for(let e=0;e<h;e++)if(!v(e))for(let r=0;r<6;r++){const n=(oo[r][0]+e)%h,i=oo[r][1]+m;t.indices[u.index++]=(i-1)*h+n+d}}function uo({indices:t,topVertices:e,rect:r,depth:n},i,o,s){if(e.length<=4)return;const a=o.vertex,u=t.length;for(let e=0;e<u;e++)i.indices[o.index++]=a+t[e];const l=Math.max(r.width,r.height);for(let t=0;t<(s.excludeBottom?1:2);t++)for(let s=0;s<e.length;s+=2){const a=e[s],u=e[s+1];i.position[3*o.vertex]=a,i.position[3*o.vertex+1]=u,i.position[3*o.vertex+2]=(1-t)*n,i.uv[2*o.vertex]=(a-r.x)/l,i.uv[2*o.vertex+1]=(u-r.y)/l,o.vertex++}if(!s.excludeBottom){const r=e.length/2;for(let e=0;e<u;e+=3)for(let n=0;n<3;n++)i.indices[o.index++]=a+r+t[e+2-n]}}function lo(t,e,r,n){const i=null==r||"auto"===r;if(!0===r)return{vertices:t,holes:e};const o=[],s=e&&[],a=t.length/2,u=[],l=[],h=[];let c=0,f=0;const p=(e?e.length:0)+1;for(let r=0;r<p;r++){0===r?f=e&&e.length?e[0]:a:(c=e[r-1],f=e[r]||a);for(let e=c;e<f;e++){const r=t[2*e],s=t[2*e+1],a=e===f-1?c:e+1,p=t[2*a],d=t[2*a+1];if(i){const i=e===c?f-1:e-1,a=t[2*i],g=t[2*i+1];u[0]=a-r,u[1]=g-s,l[0]=p-r,l[1]=d-s,Gi(u,u),Gi(l,l);1-(.5*Qi(u,l)+.5)>n?(o.push(r,s),h.push(e)):(o.push(r,s,r,s),h.push(e,e))}else o.push(r,s,r,s),h.push(e,e)}r<p-1&&s&&s.push(o.length/2)}return{vertices:new Float32Array(o),splittedMap:h,holes:s}}function ho(t,e){let r=0,n=0;for(let i=0;i<t.length;i++){const{indices:o,vertices:s,splittedMap:a,topVertices:u,depth:l}=t[i],h=Math.min(l/2,e.bevelSize)>0?e.bevelSegments:0,c=t[i].holes||[];r+=o.length*(e.excludeBottom?1:2),n+=u.length/2*(e.excludeBottom?1:2);const f=2+2*h;let p=0,d=0;for(let t=0;t<c.length+1;t++){0===t?d=c.length?c[0]:s.length/2:(p=c[t-1],d=c[t]||s.length/2);r+=6*((a?a[d-1]+1:d)-(a?a[p]:p))*(f-1);const i=d-p;n+=i*f+(e.smoothBevel?0:h*i*2)}}const i={position:new Float32Array(3*n),indices:new(n>65535?Uint32Array:Uint16Array)(r),uv:new Float32Array(2*n)},o={vertex:0,index:0,ringPerimeter:0};for(let r=0;r<t.length;r++)uo(t[r],i,o,e);for(let r=0;r<t.length;r++){const{holes:n,vertices:s}=t[r],a=s.length/2;let u=0,l=n&&n.length?n[0]:a;if(o.ringPerimeter=so(t[r].topVertices,u,l),ao(i,t[r],u,l,o,e),n)for(let s=0;s<n.length;s++)u=n[s],l=n[s+1]||a,o.ringPerimeter=so(t[r].topVertices,u,l),ao(i,t[r],u,l,o,e)}for(let t=0;t<i.uv.length;t++){const e=i.uv[t];e>0&&Math.round(e)===e?i.uv[t]=1:i.uv[t]=e%1}return i.normal=function(t,e){function r(t,e,r,n){t[0]=e,t[1]=r,t[2]=n}const n=[],i=[],o=[],s=[],a=[],u=[],l=t.length,h=new Float32Array(e.length);for(let c=0;c<l;){const l=3*t[c++],f=3*t[c++],p=3*t[c++];r(n,e[l],e[l+1],e[l+2]),r(i,e[f],e[f+1],e[f+2]),r(o,e[p],e[p+1],e[p+2]),Vi(s,n,i),Vi(a,i,o),Hi(u,s,a);for(let t=0;t<3;t++)h[l+t]=h[l+t]+u[t],h[f+t]=h[f+t]+u[t],h[p+t]=h[p+t]+u[t]}for(var c=0;c<h.length;)r(u,h[c],h[c+1],h[c+2]),qi(u,u),h[c++]=u[0],h[c++]=u[1],h[c++]=u[2];return h}(i.indices,i.position),i.boundingRect=t[0]&&t[0].rect,i}function co(t,e){const r=[];for(let n=0;n<t.length;n++){const i=t[n],o=[],s=i.length;let a=i[s-1][0],u=i[s-1][1],l=0;for(let t=0;t<s;t++){let r=i[t][0],n=i[t][1];const s=r-a,h=n-u;l+=Math.sqrt(s*s+h*h),l>e&&(o.push(i[t]),l=0),a=r,u=n}o.length>=3&&r.push(o)}return r.length>0?r:null}function fo(t,e){const r=[];for(let n=0;n<t.length;n++){let i=t[n];i=Ui(i,e,!0),i.length>=3&&r.push(i)}return r.length>0?r:null}function po(t,e){e=Object.assign({},e);const r=[1/0,1/0],n=[-1/0,-1/0];for(let e=0;e<t.length;e++)go(t[e][0],r,n);e.boundingRect=e.boundingRect||{x:r[0],y:r[1],width:n[0]-r[0],height:n[1]-r[1]},function(t){t.depth=t.depth||1,t.bevelSize=t.bevelSize||0,t.bevelSegments=null==t.bevelSegments?2:t.bevelSegments,t.smoothBevel=t.smoothBevel||!1,t.simplify=t.simplify||0,null==t.smoothSide&&(t.smoothSide="auto"),null==t.smoothSideThreshold&&(t.smoothSideThreshold=.9),"number"==typeof t.depth&&(t.bevelSize=Math.min(t.bevelSegments>0?t.bevelSize:0,t.depth/2)),t.bevelSize>0||(t.bevelSegments=0),t.bevelSegments=Math.round(t.bevelSegments);const e=t.boundingRect;if(t.translate=t.translate||[0,0],t.scale=t.scale||[1,1],t.fitRect){let r=null==t.fitRect.x?e.x||0:t.fitRect.x,n=null==t.fitRect.y?e.y||0:t.fitRect.y,i=t.fitRect.width,o=t.fitRect.height;null==i?null!=o?i=o/e.height*e.width:(i=e.width,o=e.height):null==o&&(o=i/e.width*e.height),t.scale=[i/e.width,o/e.height],t.translate=[(r-e.x)*t.scale[0],(n-e.y)*t.scale[1]]}}(e);const i=[],o=e.translate||[0,0],s=e.scale||[1,1],a=e.boundingRect,u={x:a.x*s[0]+o[0],y:a.y*s[1]+o[1],width:a.width*s[0],height:a.height*s[1]},l=Math.min(a.width,a.height)/1e5;for(let r=0;r<t.length;r++){let n=co(t[r],l);if(!n)continue;const a=e.simplify/Math.max(s[0],s[1]);if(a>0&&(n=fo(n,a)),!n)continue;const{vertices:h,holes:c,dimensions:f}=Di.flatten(n);for(let t=0;t<h.length;)h[t]=h[t++]*s[0]+o[0],h[t]=h[t++]*s[1]+o[1];if(io(h,c),2!==f)throw new Error("Only 2D polygon points are supported");const p=e.bevelSize>0?ro(h,c,e.bevelSize,null,!0):h,d=Ki(p,c,f),g=lo(h,c,e.smoothSide,e.smoothSideThreshold);i.push({indices:d,vertices:g.vertices,rawVertices:h,topVertices:p,holes:g.holes,splittedMap:g.splittedMap,rect:u,depth:"function"==typeof e.depth?e.depth(r):e.depth})}return ho(i,e)}function go(t,e,r){for(let n=0;n<t.length;n++)e[0]=Math.min(t[n][0],e[0]),e[1]=Math.min(t[n][1],e[1]),r[0]=Math.max(t[n][0],r[0]),r[1]=Math.max(t[n][1],r[1])}const yo={bottomHeight:0,width:3,cornerRadius:0,altitude:0,topColor:null,bottomColor:"#2d2f61",heightEnable:!0};class vo extends H{constructor(t,e,r,i){e=n.Util.extend({},yo,e,{layer:i,lineString:t}),super(),this._initOptions(e);const{width:o,cornerRadius:s,bottomHeight:a,altitude:u,asynchronous:l}=e,h=i.distanceToVector3(s,s).x,c=i.distanceToVector3(o,o).x,{lineStrings:f,center:p}=je(t);let d;if(l){d=Ir();const e=n.Util.GUID();this.getOptions().id=e,this.getOptions().center=p,yr.push({id:e,data:f,layer:i,center:p,lineString:t,baseObject:this})}else{const t=[],e={};for(let r=0,n=f.length;r<n;r++){const n=ze(f[r],c,h,i,p);xe(n,a,i,e),t.push(n)}d=Ar(t)}this._createMesh(d,r);const g=i.altitudeToVector3(u,u).x,y=i.coordinateToVector3(p,g);this.getObject3d().position.copy(y),this.type="Path"}_workerLoad(t){const e=wr(t);this.getObject3d().geometry=e,this._fire("workerload",{target:this})}}const mo={width:3,cornerRadius:0,altitude:0,topColor:null,bottomColor:"#2d2f61"};class Ao extends(tn(H)){constructor(t,e,r,i){Array.isArray(t)||(t=[t]);const o=[],s=[],a=t.length;for(let e=0;e<a;e++){const r=je(t[e]);o.push(r.center),s.push(r.lineStrings)}const u=_e(o);e=n.Util.extend({},mo,e,{layer:i,lineStrings:t,coordinate:u});const{altitude:l,asynchronous:h}=e;let c;const f=[],p=[];if(super(),h)c=Ir(),vr.push({id:n.Util.GUID(),layer:i,key:e.key,center:u,data:s,lineStrings:t,baseObject:this,option:e});else{const r=[];let o=0;const l={},h={};for(let c=0;c<a;c++){const a=t[c],f=n.Util.extend({},e,Se(a),{index:c}),{cornerRadius:d,width:g,bottomHeight:y}=f,v=me(g,i,l),m=me(d,i,h),A=s[c],_=[];let x=0;for(let t=0,e=A.length;t<e;t++){const e=ze(A[t],v,m,i,u);x=xe(e,y,i,l),_.push(e)}const w=_r(_);r.push(w);const{position:b,normal:E,indices:I}=w;I.length;const C=b.length/3;E.length,p[c]={position:{middleZ:x,count:C,start:o,end:o+3*C},hide:!1},o+=3*C}c=Ar(r)}this._initOptions(e),this._createMesh(c,r);const d=i.altitudeToVector3(l,l).x,g=i.coordinateToVector3(u,d);this.getObject3d().position.copy(g),this._baseObjects=f,this._datas=t,this._geometriesAttributes=p,this.faceIndex=null,this._geometryCache=br(c),this.isHide=!1,this._colorMap={},this._initBaseObjectsEvent(f),h||(this._setPickObject3d(),this._init()),this.type="Paths"}getSelectMesh(){const t=this._getIndex();if(null!=t){if(!this._baseObjects[t]){const e=this._datas[t],r=Object.assign({},this.options,K(e)?e.properties:e.getProperties(),{index:t});this._baseObjects[t]=new vo(e,r,this.getObject3d().material,this.getLayer()),this._proxyEvent(this._baseObjects[t])}return{data:this._datas[t],baseObject:this._baseObjects[t]}}}identify(t){return this.picked}_workerLoad(t){const{geometriesAttributes:e}=t;this._geometriesAttributes=e;const r=wr(t);if(this._geometryCache=br(r),this.getObject3d().geometry=r,this._setPickObject3d(),this._init(),this.isAdd){this.getLayer().getPick().add(this.pickObject3d)}this._fire("workerload",{target:this})}}const _o=Math.PI/180,xo=[[4e3,220],[2e3,100],[1e3,30],[500,15],[100,5],[50,2],[10,1],[5,.7],[2,.1],[1,.05],[.5,.02],[.4,.01],[.1,.005],[.05,.002],[.01,.001]],wo=["mouseout","mousemove","click","mousedown","mouseup","dblclick","contextmenu","touchstart","touchmove","touchend"],bo=new n.Coordinate(0,0),Eo=new n.Point(0,0),Io=new i.Vector3,Co=new Map,So="__webglFramebuffer",Mo=new i.Vector4;class Bo extends n.CanvasLayer{constructor(t,e){super(t,e),this._animationBaseObjectMap={},this._needsUpdate=!0,this._mousemoveTimeOut=0,this._mousedownTime=0,this._baseObjects=[],this._delayMeshes=[],this._meshes=[],this.type="ThreeLayer"}isMercator(){const t=this.getMap();if(!t)return!1;const e=t.getSpatialReference(),r=e._projection,n=e._resolutions;return!!(r&&"EPSG:3857"===r.code&&n&&n.length&&156543===Math.floor(n[0])&&t.getGLRes)}isRendering(){const t=this.getMap();return!!t&&(t.isInteracting()||t.isAnimating())}prepareToDraw(...t){}draw(t,e,r,n,i,o){this.renderScene(o,this)}drawOnInteracting(t,e,r,n,i,o,s){this.renderScene(s,this)}_transformHeight(t,e){if(!t)return 0;if(0===(e=e||0))return 0;return this.altitudeToVector3(e,e,null,Io).x}coordinateToVector3(t,e=0,r){const o=this.getMap();if(!o)return null;const s=Array.isArray(t);s?(bo.x=t[0],bo.y=t[1]):t instanceof n.Coordinate||(t=new n.Coordinate(t));const a=Lo(o),u=Ro(o,s?bo:t,a,Eo);return r&&(r.x=u.x,r.y=u.y,r.z=e),new i.Vector3(u.x,u.y,e)}coordinatiesToGLFloatArray(t,e,r){const i=this.getMap();if(!i)return null;const o=Lo(i),s=t.length,a=new Float32Array(2*s),u=new Float32Array(3*s);Co.clear();for(let l=0;l<s;l++){let s=t[l];const h=Array.isArray(s);h?(bo.x=s[0],bo.y=s[1]):s instanceof n.Coordinate||(s=new n.Coordinate(s));const c=Ro(i,h?bo:s,o,Eo);c.x-=e.x,c.y-=e.y;const f=2*l;a[f]=c.x,a[f+1]=c.y;const p=s;let d=p.z||p[2]||0;if(r&&!Co.has(d)){const t=this._transformHeight(r,d);Co.set(d,t)}let g=0;r&&(g=Co.get(d)||0);const y=3*l;u[y]=c.x,u[y+1]=c.y,u[y+2]=g}return{positions:u,positons2d:a}}coordinatiesToGLArray(t,e){const r=this.getMap();if(!r)return null;const i=Lo(r),o=t.length,s=new Array(o);for(let a=0;a<o;a++){let o=t[a];const u=Array.isArray(o);u?(bo.x=o[0],bo.y=o[1]):o instanceof n.Coordinate||(o=new n.Coordinate(o));const l=Ro(r,u?bo:o,i,Eo);l.x-=e.x,l.y-=e.y,s[a]=[l.x,l.y]}return s}distanceToVector3(t,e,r){if(0===t&&0===e||!n.Util.isNumber(t)||!n.Util.isNumber(e))return new i.Vector3(0,0,0);const o=this.getMap(),s=Lo(o);let a=r||o.getCenter();a instanceof n.Coordinate||(a=new n.Coordinate(a));const u=o.locate(a,t,e),l=Ro(o,a,s),h=Ro(o,u,s),c=Math.abs(h.x-l.x)*n.Util.sign(t),f=Math.abs(h.y-l.y)*n.Util.sign(e);return new i.Vector3(c,f,0)}altitudeToVector3(t,e,r,o){if(0===t||!n.Util.isNumber(t))return new i.Vector3(0,0,0);const s=this.getMap();if(s.altitudeToPoint){const e=Lo(s);let r=s.altitudeToPoint(t,e);return t<0&&r>0&&(r=-r),o?(o.x=r,o.y=r,o.z=0,o):new i.Vector3(r,r,0)}return this.distanceToVector3(t,t,r)}toShape(t){if(!t)return null;if(t instanceof n.MultiPolygon)return t.getGeometries().map((t=>this.toShape(t)));const e=t.getCenter(),r=this.coordinateToVector3(e),o=t.getShell().map((t=>{const e=this.coordinateToVector3(t).sub(r);return new i.Vector2(e.x,e.y)})),s=new i.Shape(o),a=t.getHoles();return a&&a.length>0&&(s.holes=a.map((t=>{const e=t.map((t=>{const e=this.coordinateToVector3(t).sub(r);return new i.Vector2(e.x,e.y)}));return new i.Shape(e)}))),s}toExtrudeMesh(t,e,r,o){if(!t)return null;if(t instanceof n.MultiPolygon)return t.getGeometries().map((t=>this.toExtrudeMesh(t,e,r,o)));const s=t.getCoordinates();s.forEach((t=>{for(let e=t.length-1;e>=1;e--)t[e].equals(t[e-1])&&t.splice(e,1)})),t.setCoordinates(s);const a=this.toShape(t),u=this.coordinateToVector3(t.getCenter());o=n.Util.isNumber(o)?o:e,o=this.altitudeToVector3(o,o).x;const l=this.altitudeToVector3(e,e).x,h={bevelEnabled:!1,bevelSize:1};h[parseInt(i.REVISION)>=93?"depth":"amount"]=o;const c=new i.ExtrudeGeometry(a,h);let f=c;i.BufferGeometry.prototype.fromGeometry&&(f=new i.BufferGeometry,f.fromGeometry(c));const p=new i.Mesh(f,r);return p.position.set(u.x,u.y,l-o),p}toExtrudePolygon(t,e,r){return new zr(t,e,r,this)}toBar(t,e,r){return new Dr(t,e,r,this)}toLine(t,e,r){return new Fr(t,e,r,this)}toExtrudeLine(t,e,r){return new Qr(t,e,r,this)}toModel(t,e){return new Vr(t,e,this)}toExtrudeLineTrail(t,e,r){return new Kr(t,e,r,this)}toExtrudePolygons(t,e,r){return new nn(t,e,r,this)}toPoint(t,e,r){return new un(t,e,r,this)}toPoints(t,e,r){return new dn(t,e,r,this)}toBars(t,e,r){return new yn(t,e,r,this)}toExtrudeLines(t,e,r){return new mn(t,e,r,this)}toLines(t,e,r){return new _n(t,e,r,this)}toThreeVectorTileLayer(t,e,r){return new kn(t,e,r,this)}toTerrain(t,e,r){return new Un(t,e,r,this)}toTerrainVectorTileLayer(t,e,r){return new Gn(t,e,r,this)}toHeatMap(t,e,r){return new Xn(t,e,r,this)}toFatLine(t,e,r){return new ti(t,e,r,this)}toFatLines(t,e,r){return new ri(t,e,r,this)}toBox(t,e,r){return new ii(t,e,r,this)}toBoxs(t,e,r){return new si(t,e,r,this)}toPath(t,e,r){return new vo(t,e,r,this)}toPaths(t,e,r){return new Ao(t,e,r,this)}getBaseObjects(){return this.getMeshes().filter((t=>t instanceof H))}getMeshes(){const t=this.getScene();if(!t)return[];const e=[];for(let r=0,n=t.children.length;r<n;r++){const n=t.children[r];n instanceof i.Object3D&&!(n instanceof i.Camera)&&e.push(n.__parent||n)}return e}clear(){return this.clearMesh()}clearBaseObjects(){return this.removeMesh(this.getBaseObjects())}clearMesh(){const t=this.getScene();if(!t)return this;for(let e=t.children.length-1;e>=0;e--){const r=t.children[e];if(r instanceof i.Object3D&&!(r instanceof i.Camera)){t.remove(r);const e=r.__parent;e&&e instanceof H&&(e.isAdd=!1,e.options.layer=null,e._fire("remove",{target:e}),delete this._animationBaseObjectMap[r.uuid],e._hideUI())}}return this._meshes=[],this}lookAt(t){const e=this.getCamera();return e&&e.lookAt&&t&&e.lookAt(t),this}getCamera(){const t=this._getRenderer();return t?t.camera:null}getScene(){const t=this._getRenderer();return t?t.scene:null}renderScene(t,e){const r=this._getRenderer();return r&&(r.clearCanvas(),r.renderScene(t),e||r.setToRedraw()),this}loop(t=!1){const e=this._delayMeshes;if(!e.length)return;const r=this.getMap();if(!r||r.isAnimating()||r.isInteracting())return;const n=this.options.loopRenderCount||50,i=e.slice(0,n);i&&this.addMesh(i,t),e.splice(0,n)}renderPickScene(){const t=this._getRenderer();if(t){const e=t.pick;e&&e.pick(this._containerPoint)}return this}getThreeRenderer(){const t=this._getRenderer();return t?t.context:null}getPick(){const t=this._getRenderer();return t?t.pick:null}delayAddMesh(t){if(!t)return this;Array.isArray(t)||(t=[t]);for(let e=0,r=t.length;e<r;e++)this._delayMeshes.push(t[e]);return this}addMesh(t,e=!0){if(!t)return this;Array.isArray(t)||(t=[t]);const r=this.getScene();if(t.forEach((t=>{t instanceof H?(r.add(t.getObject3d()),t.isAdd||(t.isAdd=!0,t.options.layer=this,t._fire("add",{target:t})),t._animation&&n.Util.isFunction(t._animation)&&(this._animationBaseObjectMap[t.getObject3d().uuid]=t)):t instanceof i.Object3D&&r.add(t);-1===this._meshes.indexOf(t)&&this._meshes.push(t)})),this._zoomend(),e){const t=this._getRenderer();t&&t.setToRedraw()}return this}removeMesh(t,e=!0){if(!t)return this;Array.isArray(t)||(t=[t]);const r=this.getScene();if(t.forEach((t=>{if(t instanceof H){r.remove(t.getObject3d()),t.isAdd&&(t.isAdd=!1,t.options.layer=null,t._fire("remove",{target:t}),t._hideUI()),t._animation&&n.Util.isFunction(t._animation)&&delete this._animationBaseObjectMap[t.getObject3d().uuid];const e=this._delayMeshes;if(e.length)for(let r=0,n=e.length;r<n;r++)if(e[r]===t){e.splice(r,1);break}}else t instanceof i.Object3D&&r.remove(t);for(let e=0,r=this._meshes.length;e<r;e++){const r=this._meshes[e];r&&(r===t&&this._meshes.splice(e,1))}})),e){const t=this._getRenderer();t&&t.setToRedraw()}return this}_initRaycaster(){return this._raycaster||(this._raycaster=new i.Raycaster,this._mouse=new i.Vector2),this}getRaycaster(){return this._raycaster}identify(t,e){if(!t)return console.error("coordinate is null,it should be Coordinate"),[];if(Array.isArray(t)&&(t=new n.Coordinate(t)),!(t instanceof n.Coordinate))return console.error("coordinate type is error,it should be Coordinate"),[];const r=this.getMap().coordToContainerPoint(t);this._containerPoint=r;const{x:o,y:s}=r;this._initRaycaster(),this.fire("identify",{coordinate:t,options:e});const a=this._raycaster,u=this._mouse,l=this.getCamera(),h=this.getScene(),c=this.getMap().getSize();if(!h)return[];const f=c.width,p=c.height;u.x=o/f*2-1,u.y=-s/p*2+1,a.setFromCamera(u,l),a.layers&&a.layers.enableAll&&a.layers.enableAll(),function(t,e){P>113?t.params.Line.threshold=e:t.linePrecision=e}(a,this._getLinePrecision(this.getMap().getResolution()));const d=[],g=[];h.children.forEach((t=>{const e=t.__parent;if(e&&e.getOptions){const r=e;r.getOptions().interactive&&r.isVisible()&&(r.identify&&n.Util.isFunction(r.identify)?g.push(r):d.push(t))}else(t instanceof i.Mesh||t instanceof i.Group)&&d.push(t)}));let y=[];const v=a.intersectObjects(d,!0);v&&Array.isArray(v)&&v.length&&(y=v.map((t=>{let e=t.object;const r=t.instanceId;e=this._recursionMesh(e)||{};const i=e.__parent||e;return i.faceIndex=t.faceIndex,i.index=t.index,i.intersect=t,n.Util.isNumber(r)&&(i.instanceId=r),i}))),this.renderPickScene(),g.length&&g.forEach((e=>{e.identify(t)&&y.push(e)}));const m=y.length;for(let t=0;t<m;t++)if(y[t])for(let e=t+1;e<m;e++)y[t]===y[e]&&y.splice(e,1);let A=y.filter((t=>t instanceof H));A=A.sort(((t,e)=>t.options.pickWeight-e.options.pickWeight)),y.forEach((t=>{t instanceof H||A.push(t)}));const _=(e=n.Util.extend({},e)).count;return n.Util.isNumber(_)&&_>0?A.slice(0,_):y}identifyAtPoint(t,e={}){const r=this.getMap();if(!r)return[];const n=r.containerPointToCoordinate(t);return this.identify(n,e)}_recursionMesh(t){for(;t&&t.parent!==this.getScene();)t=t.parent;return t}_getLinePrecision(t=10){for(let e=0,r=xo.length;e<r;e++){const[r,n]=xo[e];if(t>r)return n}return.01}fireGeoEvent(t,e,r){if(!(t instanceof H))return this;r=r||e.type;const n=this._getEventParams(e),{coordinate:i}=n,o=this.getMap();function s(t,e){e=e||r;const n=t.getInfoWindow();n&&!n._owner&&n.addTo(t);((n?n.options:{}).autoOpenOn||"click")===e&&(o.options.supportPluginEvent||t.openInfoWindow(i),t.fire("showinfowindow",{infoWindow:n}))}if("mousemove"===r){t.fire(r,Object.assign({},n,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null}));const e=t.getToolTip();e&&!e._owner&&e.addTo(t),t.openToolTip(i),s(t)}else"mouseover"===r?t._mouseover||(t.fire("mouseover",Object.assign({},n,{target:t,type:"mouseover",selectMesh:t.getSelectMesh?t.getSelectMesh():null})),t._mouseover=!0,s(t,"mouseover")):"mouseout"===r?t.getSelectMesh?t.isHide||(t._mouseover=!1,t.fire("mouseout",Object.assign({},n,{target:t,type:"mouseout",selectMesh:null})),t.closeToolTip()):(t._mouseover=!1,t.fire("mouseout",Object.assign({},n,{target:t,type:"mouseout"})),t.closeToolTip()):(t.fire(r,Object.assign({},n,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null})),s(t))}_emptyIdentify(t={}){const e=t.domEvent,r=this.getScene();if(!r)return this;const n=this.map||this.getMap();if(!n)return this;const i=n._getEventParams?n._getEventParams(e):this._getEventParams(e);for(let t=0,e=r.children.length;t<e;t++){const e=(r.children[t]||{}).__parent;e&&e.fire("empty",Object.assign({},i,{target:e}))}}_identifyBaseObjectEvents(t){if(!this.options.geometryEvents)return this;const e=this.map||this.getMap();if(e.isInteracting()||!e.options.geometryEvents||e._ignoreEvent(t))return this;const r=t.type,i=e._getEventParams?e._getEventParams(t):this._getEventParams(t);i.type=r;const{type:o,coordinate:s}=i,a=n.Util.now();if(this._mousemoveTimeOut&&"mousemove"===o&&a-this._mousemoveTimeOut<64)return this;this._mousemoveTimeOut=a,"mousedown"!==o&&"touchstart"!==o||(this._mousedownTime=n.Util.now());let u=!1;if("click"===o||"touchend"===o){const t=e.options.clickTimeThreshold||280;u=n.Util.now()-this._mousedownTime<t}if("click"===o&&!u)return this;const l=this.options.identifyCountOnEvent;let h=Math.max(0,n.Util.isNumber(l)?l:0);0===h&&(h=1/0);const c=t=>{const e=[];this._baseObjects&&this._baseObjects.forEach((r=>{let n=!0;t.forEach((t=>{r===t&&(n=!1)})),n&&e.push(r)})),e.forEach((t=>{t&&t instanceof H&&(t.getSelectMesh?t.isHide||(t._mouseover=!1,t.fire("mouseout",Object.assign({},i,{target:t,type:"mouseout",selectMesh:null})),t.closeToolTip()):(t._mouseover=!1,t.fire("mouseout",Object.assign({},i,{target:t,type:"mouseout"})),t.closeToolTip()))}))};if("mouseout"===o)return c([]),this._baseObjects=[],this;const f=this.identify(s,{count:h}),p=this.getScene();if(0===f.length&&p)for(let t=0,e=p.children.length;t<e;t++){const e=(p.children[t]||{}).__parent;e&&e.fire("empty",Object.assign({},i,{target:e}))}function d(t,e){e=e||o;const r=t.getInfoWindow();r&&!r._owner&&r.addTo(t);((r?r.options:{}).autoOpenOn||"click")===e&&(t.openInfoWindow(s),t.fire("showinfowindow",{infoWindow:r}))}if("mousemove"===o?(c(f),f.forEach((t=>{if(t instanceof H){t._mouseover||(t.fire("mouseover",Object.assign({},i,{target:t,type:"mouseover",selectMesh:t.getSelectMesh?t.getSelectMesh():null})),t._mouseover=!0,d(t,"mouseover")),t.fire(o,Object.assign({},i,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null}));const e=t.getToolTip();e&&!e._owner&&e.addTo(t),t.openToolTip(s),d(t)}})),this._baseObjects=f):f.forEach((t=>{t instanceof H&&(t.fire(o,Object.assign({},i,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null})),d(t))})),"touchend"===o&&u){const e=n.Util.extend({},i,{domEvent:t});f.forEach((t=>{t instanceof H&&(t.fire("click",Object.assign({},e,{target:t,selectMesh:t.getSelectMesh?t.getSelectMesh():null})),d(t,"click"))}))}return this}_getEventParams(t){const e=this.getMap(),r={domEvent:t};if(!e)return r;const i=t.touches&&t.touches.length>0?t.touches[0]:t.changedTouches&&t.changedTouches.length>0?t.changedTouches[0]:t;if(i){const t=(0,n.DomUtil.getEventContainerPoint)(i,e._containerDOM);r.coordinate=e.containerPointToCoordinate(t),r.containerPoint=t,r.viewPoint=e.containerPointToViewPoint(t),r.pont2d=e._containerPointToPoint(t)}return r}_zoomend(){const t=this.getScene();if(!t)return;const e=this.getMap().getZoom();t.children.forEach((t=>{const r=t.__parent;if(r&&r.getOptions){const t=r;t.zoomChange&&n.Util.isFunction(t.zoomChange)&&t.zoomChange(e);const i=t.getMinZoom(),o=t.getMaxZoom();e<i||e>o?(t.isVisible()&&(t.getObject3d().visible=!1),t._zoomVisible=!1):i<=e&&e<=o&&(t._visible&&(t.getObject3d().visible=!0),t._zoomVisible=!0)}}))}_getGeometryEventMapPanel(){const t=this.map||this.getMap();return t._panels.allLayers||t._containerDOM}onAdd(){super.onAdd();const t=this.map||this.getMap();if(!t)return this;const e=this._getGeometryEventMapPanel();return this._identifyBaseObjectEventsThis||(this._identifyBaseObjectEventsThis=this._identifyBaseObjectEvents.bind(this)),this._zoomendThis||(this._zoomendThis=this._zoomend.bind(this)),this._emptyIdentifyThis||(this._emptyIdentifyThis=this._emptyIdentify.bind(this)),t.options.supportPluginEvent?this.on("identifyempty",this._emptyIdentifyThis):n.DomUtil.on(e,wo.join(" "),this._identifyBaseObjectEventsThis,this),this._needsUpdate=!0,this._animationBaseObjectMap||(this._animationBaseObjectMap={}),t.on("zooming zoomend",this._zoomendThis,this),this}onRemove(){super.onRemove();const t=this.map||this.getMap();if(!t)return this;const e=this._getGeometryEventMapPanel();return t.options.supportPluginEvent?this.off("identifyempty",this._emptyIdentifyThis):n.DomUtil.off(e,wo.join(" "),this._identifyBaseObjectEventsThis,this),t.off("zooming zoomend",this._zoomendThis,this),this}_addBaseObjectsWhenInit(){return this.addMesh(this._meshes),this}_callbackBaseObjectAnimation(){const t=this;if(t._animationBaseObjectMap)for(const e in t._animationBaseObjectMap){t._animationBaseObjectMap[e]._animation()}return this}_getFovRatio(){const t=this.getMap().getFov();return Math.tan(t/2*_o)}}Bo.mergeOptions({renderer:"gl",doubleBuffer:!1,glOptions:null,geometryEvents:!0,identifyCountOnEvent:0,forceRenderOnZooming:!0,loopRenderCount:50});const To={bloom:!0};class ko extends n.renderer.CanvasLayerRenderer{constructor(){super(...arguments),this._renderTime=0,this._renderTarget=null}getPrepareParams(){return[this.scene,this.camera]}getDrawParams(){return[this.scene,this.camera]}_drawLayer(){super._drawLayer.apply(this,arguments)}hitDetect(){return!1}createCanvas(){super.createCanvas(),this.createContext()}createContext(){if(this.canvas.gl&&this.canvas.gl.wrap)this.gl=this.canvas.gl.wrap();else{const t=this.layer.options.glOptions||{alpha:!0,depth:!0,antialias:!0,stencil:!0,preserveDrawingBuffer:!1};t.preserveDrawingBuffer=!0,this.gl=this.gl||this._createGLContext(this.canvas,t)}this._initThreeRenderer(),this.layer.onCanvasCreate(this.context,this.scene,this.camera)}_initThreeRenderer(){this.matrix4=new i.Matrix4;const t=new i.WebGLRenderer({context:this.gl,alpha:!0});t.autoClear=!1,t.setClearColor(new i.Color(1,1,1),0),t.setSize(this.canvas.width,this.canvas.height),t.clear(),this.context=t;const e=this.scene=new i.Scene,r=this.layer.getMap(),n=r.getFov()*Math.PI/180,o=this.camera=new i.PerspectiveCamera(n,r.width/r.height,r.cameraNear,r.cameraFar);o.matrixAutoUpdate=!1,this._syncCamera(),e.add(o),this.pick=new Zn(this.layer),mr.star(),this.layer._addBaseObjectsWhenInit()}onCanvasCreate(){super.onCanvasCreate()}resizeCanvas(t){if(!this.canvas)return;let e,r=this.getMap();e=t||r.getSize();const i=r.getDevicePixelRatio?r.getDevicePixelRatio():n.Browser.retina?2:1,o=this.canvas,{width:s,height:a,cssWidth:u,cssHeight:l}=n.Util.calCanvasSize(e,i);if(!this.layer._canvas||o.style.width===u&&o.style.height===l||(o.style.width=u,o.style.height=l),o.width===s&&o.height===a)return this;o.width=s,o.height=a,this.context.setSize(o.width,o.height)}clearCanvas(){this.canvas&&this.context.clear()}prepareCanvas(){return this.canvas?this.clearCanvas():this.createCanvas(),this.layer.fire("renderstart",{context:this.context}),null}renderScene(t){if(this.layer._callbackBaseObjectAnimation(),this._syncCamera(),t&&t.renderTarget){const{width:e,height:r}=t.renderTarget.fbo;this._renderTarget?(this._renderTarget.viewport.set(0,0,e,r),this._renderTarget.scissor.set(0,0,e,r)):(this._renderTarget=new i.WebGLRenderTarget(e,r,{depthBuffer:!1}),this.context.setRenderTarget(this._renderTarget),this.context.render(this.scene,this.camera));const n=this.context.properties.get(this._renderTarget),o=n[So];n[So]=t.renderTarget.getFramebuffer(t.renderTarget.fbo),this.context.setRenderTarget(this._renderTarget);const s=1===t.bloom&&t.sceneFilter,a=this.scene.children||[];let u=!1;if(s){const e=t.sceneFilter;u=e(To);for(let t=0,r=a.length;t<r;t++){if(!a[t]||!a[t].layers)continue;const r=a[t].__parent;a[t].bloom=!1,r&&(a[t].bloom=r.bloom);let n=0;(a[t]&&e(a[t])||!r)&&u&&(n=1),a[t].__layer!==n&&(Po(a[t],n),a[t].__layer=n)}}else for(let t=0,e=a.length;t<e;t++)a[t]&&a[t].layers&&0!==a[t].__layer&&(Po(a[t],0),a[t].__layer=0);this.camera.layers.set(u?1:0),this.context.render(this.scene,this.camera),n[So]=o}else{const{width:t,height:e}=this.canvas,r=this.context.getViewport(Mo);r.width===t&&r.height===e||this.context.setViewport(0,0,t,e),this.context.render(this.scene,this.camera)}this.context.setRenderTarget(null),this.completeRender()}remove(){delete this._drawContext,this._renderTarget&&(this._renderTarget.dispose(),delete this._renderTarget),super.remove()}_syncCamera(){const t=this.getMap(),e=this.camera;e.matrix.elements=t.cameraWorldMatrix,e.projectionMatrix.elements=t.projMatrix,this.matrix4.invert?e.projectionMatrixInverse.elements=this.matrix4.copy(e.projectionMatrix).invert().elements:e.projectionMatrixInverse&&(e.projectionMatrixInverse.elements=this.matrix4.getInverse(e.projectionMatrix).elements)}_createGLContext(t,e){const r=["webgl2","webgl","experimental-webgl"];let n=null;for(let i=0;i<r.length;++i){try{n=t.getContext(r[i],e)}catch(t){}if(n)break}return n}}function Po(t,e){if(!t)return;t.layers&&t.layers.set(e);const r=t.children;if(r&&r.length)for(let t=0,n=r.length;t<n;t++)Po(r[t],e)}function Lo(t){return t.getGLRes?t.getGLRes():t.getGLZoom()}function Ro(t,e,r,n){return t.coordToPointAtRes?t.coordToPointAtRes(e,r,n):t.coordinateToPoint(e,r,n)}Bo.registerRenderer("gl",ko),n.registerWorkerAdapter&&(n.registerWorkerAdapter("__maptalks.three__",'(function(t){"use strict";\n/*!\n * poly-extrude v0.16.0\n */function n(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 i(t,n){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},i(t,n)}function e(t,n,i){void 0===i&&(i=2);var e,s,h,a=n&&n.length,u=a?n[0]*i:t.length,c=r(t,0,u,i,!0),x=[];if(!c||c.next===c.prev)return x;if(a&&(c=function(t,n,i,e){for(var s=[],o=0,h=n.length;o<h;o++){var a=r(t,n[o]*e,o<h-1?n[o+1]*e:t.length,e,!1);a===a.next&&(a.steiner=!0),s.push(d(a))}s.sort(l);for(var u=0;u<s.length;u++)i=f(s[u],i);return i}(t,n,c,i)),t.length>80*i){e=1/0,s=1/0;for(var y=-1/0,p=-1/0,v=i;v<u;v+=i){var g=t[v],_=t[v+1];g<e&&(e=g),_<s&&(s=_),g>y&&(y=g),_>p&&(p=_)}h=0!==(h=Math.max(y-e,p-s))?32767/h:0}return o(c,x,i,e,s,h,0),x}function r(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=P(o/e|0,t[o],t[o+1],s);else for(var h=i-e;h>=n;h-=e)s=P(h/e|0,t[h],t[h+1],s);return s&&m(s,s.next)&&(S(s),s=s.next),s}function s(t,n){if(!t)return t;n||(n=t);var i,e=t;do{if(i=!1,e.steiner||!m(e,e.next)&&0!==_(e.prev,e,e.next))e=e.next;else{if(S(e),(e=n=e.prev)===e.next)break;i=!0}}while(i||e!==n);return n}function o(t,n,i,e,r,l,f){if(t){!f&&l&&function(t,n,i,e){var r=t;do{0===r.z&&(r.z=y(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,h=0,a=0;a<i&&(h++,o=o.nextZ);a++);for(var u=i;h>0||u>0&&o;)0!==h&&(0===u||!o||e.z<=o.z)?(r=e,e=e.nextZ,h--):(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,l);for(var x=t;t.prev!==t.next;){var d=t.prev,p=t.next;if(l?a(t,e,r,l):h(t))n.push(d.i,t.i,p.i),S(t),t=p.next,x=p.next;else if((t=p)===x){f?1===f?o(t=u(s(t),n),n,i,e,r,l,2):2===f&&c(t,n,i,e,r,l):o(s(t),n,i,e,r,l,1);break}}}}function h(t){var n=t.prev,i=t,e=t.next;if(_(n,i,e)>=0)return!1;for(var r=n.x,s=i.x,o=e.x,h=n.y,a=i.y,u=e.y,c=Math.min(r,s,o),l=Math.min(h,a,u),f=Math.max(r,s,o),x=Math.max(h,a,u),y=e.next;y!==n;){if(y.x>=c&&y.x<=f&&y.y>=l&&y.y<=x&&v(r,h,s,a,o,u,y.x,y.y)&&_(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function a(t,n,i,e){var r=t.prev,s=t,o=t.next;if(_(r,s,o)>=0)return!1;for(var h=r.x,a=s.x,u=o.x,c=r.y,l=s.y,f=o.y,x=Math.min(h,a,u),d=Math.min(c,l,f),p=Math.max(h,a,u),g=Math.max(c,l,f),m=y(x,d,n,i,e),z=y(p,g,n,i,e),w=t.prevZ,M=t.nextZ;w&&w.z>=m&&M&&M.z<=z;){if(w.x>=x&&w.x<=p&&w.y>=d&&w.y<=g&&w!==r&&w!==o&&v(h,c,a,l,u,f,w.x,w.y)&&_(w.prev,w,w.next)>=0)return!1;if(w=w.prevZ,M.x>=x&&M.x<=p&&M.y>=d&&M.y<=g&&M!==r&&M!==o&&v(h,c,a,l,u,f,M.x,M.y)&&_(M.prev,M,M.next)>=0)return!1;M=M.nextZ}for(;w&&w.z>=m;){if(w.x>=x&&w.x<=p&&w.y>=d&&w.y<=g&&w!==r&&w!==o&&v(h,c,a,l,u,f,w.x,w.y)&&_(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;M&&M.z<=z;){if(M.x>=x&&M.x<=p&&M.y>=d&&M.y<=g&&M!==r&&M!==o&&v(h,c,a,l,u,f,M.x,M.y)&&_(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function u(t,n){var i=t;do{var e=i.prev,r=i.next.next;!m(e,r)&&z(e,i,i.next,r)&&b(e,r)&&b(r,e)&&(n.push(e.i,i.i,r.i),S(i),S(i.next),i=t=r),i=i.next}while(i!==t);return s(i)}function c(t,n,i,e,r,h){var a=t;do{for(var u=a.next.next;u!==a.prev;){if(a.i!==u.i&&g(a,u)){var c=A(a,u);return a=s(a,a.next),c=s(c,c.next),o(a,n,i,e,r,h,0),void o(c,n,i,e,r,h,0)}u=u.next}a=a.next}while(a!==t)}function l(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 f(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 h=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=r&&h>o&&(o=h,i=e.x<e.next.x?e:e.next,h===r))return i}e=e.next}while(e!==n);if(!i)return null;var a=i,u=i.x,c=i.y,l=1/0;e=i;do{if(r>=e.x&&e.x>=u&&r!==e.x&&p(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);b(e,t)&&(f<l||f===l&&(e.x>i.x||e.x===i.x&&x(i,e)))&&(i=e,l=f)}e=e.next}while(e!==a);return i}(t,n);if(!i)return n;var e=A(i,t);return s(e,e.next),s(i,i.next)}function x(t,n){return _(t.prev,t,n.prev)<0&&_(n.next,t,t.next)<0}function y(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 d(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 p(t,n,i,e,r,s,o,h){return(r-o)*(n-h)>=(t-o)*(s-h)&&(t-o)*(e-h)>=(i-o)*(n-h)&&(i-o)*(s-h)>=(r-o)*(e-h)}function v(t,n,i,e,r,s,o,h){return!(t===o&&n===h)&&p(t,n,i,e,r,s,o,h)}function g(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&&z(i,i.next,t,n))return!0;i=i.next}while(i!==t);return!1}(t,n)&&(b(t,n)&&b(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)&&(_(t.prev,t,n.prev)||_(t,n.prev,n))||m(t,n)&&_(t.prev,t,t.next)>0&&_(n.prev,n,n.next)>0)}function _(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 z(t,n,i,e){var r=M(_(t,n,i)),s=M(_(t,n,e)),o=M(_(i,e,t)),h=M(_(i,e,n));return r!==s&&o!==h||(!(0!==r||!w(t,i,n))||(!(0!==s||!w(t,e,n))||(!(0!==o||!w(i,t,e))||!(0!==h||!w(i,n,e)))))}function w(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 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 i=C(t.i,t.x,t.y),e=C(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 P(t,n,i,e){var r=C(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 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 C(t,n,i){return{i:t,x:n,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}var k=new(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 h=i[e+0],a=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]=h,t[n+1]=a,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||h!==l||a!==f||u!==x){var d=1-o,p=h*l+a*f+u*x+c*y,v=p>=0?1:-1,g=1-p*p;if(g>Number.EPSILON){var _=Math.sqrt(g),m=Math.atan2(_,p*v);d=Math.sin(d*m)/_,o=Math.sin(o*m)/_}var z=o*v;if(h=h*d+l*z,a=a*d+f*z,u=u*d+x*z,c=c*d+y*z,d===1-o){var w=1/Math.sqrt(h*h+a*a+u*u+c*c);h*=w,a*=w,u*=w,c*=w}}t[n]=h,t[n+1]=a,t[n+2]=u,t[n+3]=c},t.multiplyQuaternionsFlat=function(t,n,i,e,r,s){var o=i[e],h=i[e+1],a=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+h*f-a*l,t[n+1]=h*x+u*l+a*c-o*f,t[n+2]=a*x+u*f+o*l-h*c,t[n+3]=u*x-o*c-h*l-a*f,t};var i,e,r,s=t.prototype;return s.set=function(t,n,i,e){return this._x=t,this._y=n,this._z=i,this._w=e,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 i=t._x,e=t._y,r=t._z,s=t._order,o=Math.cos,h=Math.sin,a=o(i/2),u=o(e/2),c=o(r/2),l=h(i/2),f=h(e/2),x=h(r/2);switch(s){case"XYZ":this._x=l*u*c+a*f*x,this._y=a*f*c-l*u*x,this._z=a*u*x+l*f*c,this._w=a*u*c-l*f*x;break;case"YXZ":this._x=l*u*c+a*f*x,this._y=a*f*c-l*u*x,this._z=a*u*x-l*f*c,this._w=a*u*c+l*f*x;break;case"ZXY":this._x=l*u*c-a*f*x,this._y=a*f*c+l*u*x,this._z=a*u*x+l*f*c,this._w=a*u*c-l*f*x;break;case"ZYX":this._x=l*u*c-a*f*x,this._y=a*f*c+l*u*x,this._z=a*u*x-l*f*c,this._w=a*u*c+l*f*x;break;case"YZX":this._x=l*u*c+a*f*x,this._y=a*f*c+l*u*x,this._z=a*u*x-l*f*c,this._w=a*u*c-l*f*x;break;case"XZY":this._x=l*u*c-a*f*x,this._y=a*f*c-l*u*x,this._z=a*u*x+l*f*c,this._w=a*u*c+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 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},s.setFromRotationMatrix=function(t){var n=t.elements,i=n[0],e=n[4],r=n[8],s=n[1],o=n[5],h=n[9],a=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-h)*f,this._y=(r-a)*f,this._z=(s-e)*f}else if(i>o&&i>c){var x=2*Math.sqrt(1+i-o-c);this._w=(u-h)/x,this._x=.25*x,this._y=(e+s)/x,this._z=(r+a)/x}else if(o>c){var y=2*Math.sqrt(1+o-i-c);this._w=(r-a)/y,this._x=(e+s)/y,this._y=.25*y,this._z=(h+u)/y}else{var d=2*Math.sqrt(1+c-i-o);this._w=(s-e)/d,this._x=(r+a)/d,this._y=(h+u)/d,this._z=.25*d}return this._onChangeCallback(),this},s.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()},s.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},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 i=t._x,e=t._y,r=t._z,s=t._w,o=n._x,h=n._y,a=n._z,u=n._w;return this._x=i*u+s*o+e*a-r*h,this._y=e*u+s*h+r*o-i*a,this._z=r*u+s*a+i*h-e*o,this._w=s*u-i*o-e*h-r*a,this._onChangeCallback(),this},s.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 h=1-o*o;if(h<=Number.EPSILON){var a=1-n;return this._w=a*s+n*this._w,this._x=a*i+n*this._x,this._y=a*e+n*this._y,this._z=a*r+n*this._z,this.normalize(),this}var u=Math.sqrt(h),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},s.slerpQuaternions=function(t,n,i){return this.copy(t).slerp(n,i)},s.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))},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(){},i=t,(e=[{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(i.prototype,e),r&&n(i,r),Object.defineProperty(i,"prototype",{writable:!1}),t}()),V=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(k.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,h=t.w,a=h*n+s*e-o*i,u=h*i+o*n-r*e,c=h*e+r*i-s*n,l=-r*n-s*i-o*e;return this.x=a*h+l*-r+u*-o-c*-s,this.y=u*h+l*-s+c*-r-a*-o,this.z=c*h+l*-o+a*-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,h=n.z;return this.x=e*h-r*o,this.y=r*s-i*h,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){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 F(t,n,i){return t[0]=n[0]-i[0],t[1]=n[1]-i[1],t[2]=n[2]-i[2],t}function L(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],h=i[1],a=i[2];return t[0]=r*a-s*h,t[1]=s*o-e*a,t[2]=e*h-r*o,t}function E(t,n){function i(t,n,i,e){t[0]=n,t[1]=i,t[2]=e}const e=[],r=[],s=[],o=[],h=[],a=[],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]),F(h,s,r),F(o,e,r),q(a,h,o);for(let t=0;t<3;t++)c[u+t]+=a[t],c[f+t]+=a[t],c[x+t]+=a[t];l+=3}let f=0;const x=c.length;for(;f<x;)i(a,c[f],c[f+1],c[f+2]),L(a,a),c[f]=a[0]||0,c[f+1]=a[1]||0,c[f+2]=a[2]||0,f+=3;return c}function I(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,h=0;for(let n=0,i=t.length;n<i;n++){const{position:i,indices:a,normal:u,uv:c}=t[n];e.position.set(i,r),e.normal.set(u,r),e.uv.set(c,h);let l=0;const f=a.length;for(;l<f;){const t=a[l]+s;e.indices[o]=t,o++,l++}h+=c.length,r+=i.length,s+=i.length/3}return e}function O(t){return 180*t/Math.PI}function U(t){return t/180*Math.PI}function N(t,n,i,e,r,s){const o=3*i,h=3*e,a=3*r,u=3*s,c=n[o],l=n[o+1],f=n[o+2],x=n[h],y=n[h+1],d=n[h+2],p=n[a],v=n[a+1],g=n[a+2],_=n[u],m=n[u+1],z=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-d,t[++w]=p,t[++w]=1-g,t[++w]=_,t[++w]=1-z):(t[++w]=l,t[++w]=1-f,t[++w]=y,t[++w]=1-d,t[++w]=v,t[++w]=1-g,t[++w]=m,t[++w]=1-z)}function j(t,n){n=Object.assign({},{depth:2,top:!0},n);const i=t.map((t=>{for(let n=0,i=t.length;n<i;n++){const i=t[n];Q(i),0===n?Z(i)||(t[n]=i.reverse()):Z(i)&&(t[n]=i.reverse()),R(i)&&i.splice(i.length-1,1)}const i=function(t,n){const i=function(t){let n=0,i=0;const e=t.length;for(;i<e;)n+=t[i].length,i++;return n}(t),e=t.length,r=[],s=new Float32Array(2*i),o=[],h=[],a=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[a+f]=n,o[a+f+1]=r,o[a+f+2]=y,h[x]=n,h[x+1]=r,h[u+x]=n,h[u+x+1]=r,f+=3,x+=2,e++}}return{flatVertices:s,holes:r,points:o,count:i,uv:h}}(t,n);i.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],h=n[t+1],a=n[t+2];s&&(e[t]=o,e[t+1]=h,e[t+2]=a);let u=i+t;const c=r+o,l=r+h,f=r+a;s||(u=t),e[u]=c,e[u+1]=l,e[u+2]=f}t.indices=e}(i,e(i.flatVertices,i.holes,2),n),function(t,n){const{points:i,indices:e,polygon:r,uv:s}=t,o=n.depth;let h=i.length-1,a=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,d=r[0],p=r[1],v=r[2]||0;i[++h]=f,i[++h]=x,i[++h]=y+o,i[++h]=d,i[++h]=p,i[++h]=v+o,i[++h]=f,i[++h]=x,i[++h]=y,i[++h]=d,i[++h]=p,i[++h]=v;const g=l+2,_=l+3,m=l,z=l+1;e[++a]=g,e[++a]=m,e[++a]=_,e[++a]=m,e[++a]=z,e[++a]=_,N(s,i,g,_,m,z),u++}}}(i,n),i.position=new Float32Array(i.points),i.indices=new Uint32Array(i.indices),i.uv=new Float32Array(i.uv),i.normal=E(i.indices,i.position),i})),r=I(i);return r.polygons=t,r}function Q(t){R(t)||t.push(t[0])}function R(t){const n=t.length,[i,e]=t[0],[r,s]=t[n-1];return i===r&&e===s}function W(t,n){!function(t){t.lineWidth=Math.max(0,t.lineWidth),t.depth=Math.max(0,t.depth),t.sideDepth=Math.max(0,t.sideDepth)}(n=Object.assign({},{depth:2,lineWidth:1,bottomStickGround:!1,pathUV:!1},n));const i=t.map((t=>{const i=function(t,n){let i=n.lineWidth/2;n.isSlope&&(i*=2);const e=[],r=[],s=[],o=t.length;let h=0;for(;h<o;){let n=t[h],a=t[h+1];const u=t[h];h===o-1&&(n=t[o-2],a=t[o-1]);const c=a[1]-n[1],l=a[0]-n[0];let f=0;const x=O(Math.atan(c/l));if(0===h||h===o-1)f=x,f-=90;else{const i=t[h-1];B.x=i[0]-n[0],B.y=i[1]-n[1],T.x=a[0]-n[0],T.y=a[1]-n[1];f=x-H(B,T)/2}const y=U(f),d=u,p=[Math.cos(y)+d[0],Math.sin(y)+d[1]],[v,g]=Y(n,a,i);let _=D(v[0],v[1],d,p),m=D(g[0],g[1],d,p);if(!_||!m){const t=e.length,n=e[t-2],i=e[t-1];if(!n||!i)continue;_=[n[0],n[1]],m=[i[0],i[1]]}_[2]=u[2]||0,m[2]=u[2]||0,e.push(_,m),X(_,n,a)?(r.push(_),s.push(m)):(r.push(m),s.push(_)),h++}return{offsetPoints:e,leftPoints:r,rightPoints:s,line:t}}(t,n);return i.line=t,function(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:h,rightPoints:a}=t,u=t.line,c=n.pathUV;if(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,h,a]=r,u=t-o,c=i-h,l=(s||0)-(a||0);n+=Math.sqrt(u*u+c*c+l*l),r.distance=n}}}(u);for(let t=0,n=u.length;t<n;t++)h[t].distance=a[t].distance=u[t].distance}let l=0,f=h.length;const x=[],y=[],d=[];for(;l<f;){const t=3*l,[n,e,r]=h[l];x[t]=n,x[t+1]=e,x[t+2]=s+r;const[y,p,v]=a[l],g=3*f+t;x[g]=y,x[g+1]=p,x[g+2]=o+v;const _=2*f*3+t;x[_]=n,x[_+1]=e,x[_+2]=r,i&&(x[_+2]=0);const m=2*f*3+3*f+t;if(x[m]=y,x[m+1]=p,x[m+2]=v,i&&(x[m+2]=0),c){const t=u[l].distance,n=2*l;d[n]=t,d[n+1]=1;const i=2*f+n;d[i]=t,d[i+1]=0;const e=2*f*2+n;d[e]=t,d[e+1]=1;const r=2*f*2+2*f+n;d[r]=t,d[r+1]=0}l++}if(!c){l=0,f=x.length;let t=d.length-1;for(;l<f;){const n=x[l],i=x[l+1];d[++t]=n,d[++t]=i,l+=3}}l=0,f=h.length;let p=y.length-1;for(;l<f-1;){const t=l,n=l+1,i=t+f,e=n+f;y[++p]=t,y[++p]=i,y[++p]=n,y[++p]=i,y[++p]=e,y[++p]=n;const r=l+2*f,s=r+1,o=r+f,h=s+f;y[++p]=r,y[++p]=o,y[++p]=s,y[++p]=o,y[++p]=h,y[++p]=s,l++}if(t.indices=y,t.points=x,t.uv=d,r)for(f=h.length,l=0;l<f;)h[l].depth=s,a[l].depth=o,l++}(i,n),function(t,n){const{points:i,indices:e,leftPoints:r,rightPoints:s,uv:o}=t,h=n.depth,a=n.bottomStickGround,u=[r,s],c=t.depths,l=n.pathUV,f=n.lineWidth;let x=i.length-1,y=e.length-1,d=o.length-1;function p(t,n){const r=i.length/3,s=c?t.depth:h,u=c?n.depth:h;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]=a?0:t[2],i[++x]=n[0],i[++x]=n[1],i[++x]=a?0:n[2];const p=r+2,v=r+3,g=r,_=r+1;e[++y]=p,e[++y]=g,e[++y]=v,e[++y]=g,e[++y]=_,e[++y]=v,l?(o[++d]=t.distance,o[++d]=s/f,o[++d]=n.distance,o[++d]=u/f,o[++d]=t.distance,o[++d]=0,o[++d]=n.distance,o[++d]=0):N(o,i,p,v,g,_)}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;){p(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){p(g[t],g[t+1])}}(i,n),i.position=new Float32Array(i.points),i.indices=new Uint32Array(i.indices),i.uv=new Float32Array(i.uv),i.normal=E(i.indices,i.position),i})),e=I(i);return e.lines=t,e}const B={x:0,y:0},T={x:0,y:0};const H=({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+360)%360};function X(t,n,i){const[e,r]=n,[s,o]=i,[h,a]=t;return(r-o)*h+(s-e)*a+e*o-s*r>0}function Y(t,n,i){const e=n[1]-t[1],r=n[0]-t[0],s=Math.atan2(e,r),o=s+Math.PI/2;let h=Math.cos(o)*i,a=Math.sin(o)*i;const u=[t[0]+h,t[1]+a],c=[n[0]+h,n[1]+a],l=s-Math.PI/2;h=Math.cos(l)*i,a=Math.sin(l)*i;return[[u,c],[[t[0]+h,t[1]+a],[n[0]+h,n[1]+a]]]}function D(t,n,i,e){const r=n[0]-t[0],s=n[1]-t[1],o=e[0]-i[0],h=e[1]-i[1];if(0===r&&0===o)return null;if(0===s&&0===h)return null;const a=s/r,u=h/o,c=t[1]-a*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=a*f+c):0===s?(x=t[1],f=(x-l)/u):0===h?(x=i[1],f=(x-c)/a):(f=(l-c)/(a-u),x=a*f+c),[f,x]}function G(t,n){n=Object.assign({},{radius:1,height:2,radialSegments:6},n);const i=Math.round(Math.max(4,n.radialSegments));let{radius:e,height:r}=n;e=e,r=r;const s=360/i/360*Math.PI*2,o=i+1,h=new Float32Array(3*o*2),[a,u]=t;let c=0,l=0;const f=3*o,x=2*o,y=[],d=[];let p=y.length-1;for(let t=-1;t<i;t++){const n=s*t,i=Math.cos(n)*e+a,o=Math.sin(n)*e+u;h[c]=i,h[c+1]=o,h[c+2]=0,h[c+f]=i,h[c+1+f]=o,h[c+2+f]=r;let v=0,g=0;v=.5+i/e/2,g=.5+o/e/2,d[l]=v,d[l+1]=g,d[l+x]=v,d[l+1+x]=g,c+=3,l+=2,t>1&&(y[++p]=0,y[++p]=t-1,y[++p]=t)}c-=3,h[c]=h[0],h[c+1]=h[1],h[c+2]=h[2];const v=h.length;h[v-3]=h[0],h[v-2]=h[1],h[v-1]=r;const g=y.length;p=y.length-1;for(let t=0;t<g;t++){const n=y[t];y[++p]=n+o}const _=new Float32Array(2*(3*o*2-6));let m=-1;c=2*o,l=0,p=y.length-1;let z=d.length-1;for(let t=0,n=h.length/2;t<n-3;t+=3){const n=h[t],i=h[t+1],s=h[t+3],a=h[t+4];_[++m]=n,_[++m]=i,_[++m]=r,_[++m]=s,_[++m]=a,_[++m]=r,_[++m]=n,_[++m]=i,_[++m]=0,_[++m]=s,_[++m]=a,_[++m]=0;const u=c+2,f=c+3,x=c,v=c+1;y[++p]=x,y[++p]=u,y[++p]=v,y[++p]=u,y[++p]=f,y[++p]=v,c+=4;const g=l/o,w=(l+1)/o;d[++z]=g,d[++z]=r/e/2,d[++z]=w,d[++z]=r/e/2,d[++z]=g,d[++z]=0,d[++z]=w,d[++z]=0,l++}const w=new Float32Array(h.length+_.length);w.set(h,0),w.set(_,h.length);const M=E(y,w);return{points:h,indices:new Uint32Array(y),position:w,normal:M,uv:new Float32Array(d)}}var J=function(){function t(){this.pos=new V,this.dir=new V,this.right=new V,this.up=new V,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}(),K=function(){function t(t,n,i,e,r,s,o,h,a,u,c,l,f,x,y,d){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,h,a,u,c,l,f,x,y,d)}var n=t.prototype;return n.set=function(t,n,i,e,r,s,o,h,a,u,c,l,f,x,y,d){var p=this.elements;return p[0]=t,p[4]=n,p[8]=i,p[12]=e,p[1]=r,p[5]=s,p[9]=o,p[13]=h,p[2]=a,p[6]=u,p[10]=c,p[14]=l,p[3]=f,p[7]=x,p[11]=y,p[15]=d,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,h=t.z,a=r*s,u=r*o;return this.set(a*s+i,a*o-e*h,a*h+e*o,0,a*o+e*h,u*o+i,u*h-e*s,0,a*h-e*o,u*h+e*s,r*h*h+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 $(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 tt=function(t){var n,e;function r(n,i,e){var r;return void 0===n&&(n=new V),void 0===i&&(i=new V),void 0===e&&(e=new V),(r=t.call(this)||this).isQuadraticBezierCurve3=!0,r.type="QuadraticBezierCurve3",r.v0=n,r.v1=i,r.v2=e,r}return e=t,(n=r).prototype=Object.create(e.prototype),n.prototype.constructor=n,i(n,e),r.prototype.getPoint=function(t,n){void 0===n&&(n=new V);var i=n,e=this.v0,r=this.v1,s=this.v2;return i.set($(t,e.x,r.x,s.x),$(t,e.y,r.y,s.y),$(t,e.z,r.z,s.z)),i},r}(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,h=0,a=s-1;h<=a;)if((o=e[r=Math.floor(h+(a-h)/2)]-i)<0)h=r+1;else{if(!(o>0)){a=r;break}a=r-1}if(e[r=a]===i)return r/(s-1);var u=e[r];return(r+(i-u)/(e[r+1]-u))/(s-1)},t}()),nt=new V,it=new V,et=new V,rt=new K,st=new tt;var ot=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 V).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 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,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 J),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),h=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)),h<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=nt.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(rt.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=nt.subVectors(n,t),h=it.subVectors(i,n),a=o.length(),u=h.length();o.normalize(),h.normalize();var c=Math.min(.999999*(r?a/2:a),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(h.multiplyScalar(l)),s}(this.array[this.count-1].pos,t,n,i,this.count-1==0,st),o=s.getPoints(e),h=0;h<e;h++)this._sharpCorner(o[h],o[h+1],r,0===h?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),h=nt.subVectors(t,s.pos),a=it.subVectors(n,t),u=h.length();if(h.normalize(),a.normalize(),o.pos.copy(t),1===e?o.dir.copy(h):2===e?o.dir.copy(a):(o.dir.addVectors(h,a),o.dir.normalize()),i)1===o.dir.dot(i)?o.right.crossVectors(a,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=et.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(rt.makeRotationAxis(c,l))}o.right.crossVectors(o.dir,o.up).normalize()}o.dist=s.dist+u;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 ht=new V(0,0,1),at=new V,ut=new V,ct=new V,lt=new V,ft=new V,xt=new V;function yt(t,n){n=Object.assign({},{lineWidth:1,cornerRadius:0,cornerSplit:10},n);const i=t.map((t=>{const i=function(t){const n=[];for(let i=0,e=t.length;i<e;i++){const e=t[i],[r,s,o]=e,h=new V(r,s,o||0);n[i]=h}return n}(t),e=new ot;e.set(i,n.cornerRadius,n.cornerSplit,ht);const r=function(t,n){const i=n.lineWidth||.1,e=1,r=i/2,s=i,o=t.distance(),h=e*o;let a=0;const u=[],c=[],l=[],f=[];let x=0;if(0===o)return{position:u,normal:c,uv:l,indices:f,count:a};const y=r/s;let d,p=u.length-1,v=c.length-1,g=l.length-1,_=f.length-1;function m(t){const n=0===u.length,i=t.sharp&&!n,e=t.dist/s,o=t.dir,h=t.up,d=t.right;if(at.copy(d).multiplyScalar(r*t.widthScale),ut.copy(d).multiplyScalar(-r*t.widthScale),at.add(t.pos),ut.add(t.pos),i){ct.fromArray(u,u.length-6).sub(ut),lt.fromArray(u,u.length-3).sub(at);const t=ct.length()-lt.length();let n,i;t>0?(n=ct,i=ut):(n=lt,i=at),ft.copy(n).setLength(Math.abs(t)).add(i);let r=xt.copy(i).sub(ft).normalize().dot(o)*xt.copy(i).sub(ft).length()*2;xt.copy(o).setLength(r).add(ft),t>0?(u[++p]=ft.x,u[++p]=ft.y,u[++p]=ft.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.z,u[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.z,u[++p]=xt.x,u[++p]=xt.y,u[++p]=xt.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.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):(u[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=ft.x,u[++p]=ft.y,u[++p]=ft.z,u[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.z,u[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=xt.x,u[++p]=xt.y,u[++p]=xt.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++)c[++v]=h.x,c[++v]=h.y,c[++v]=h.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[++p]=ut.x,u[++p]=ut.y,u[++p]=ut.z,u[++p]=at.x,u[++p]=at.y,u[++p]=at.z,c[++v]=h.x,c[++v]=h.y,c[++v]=h.z,c[++v]=h.x,c[++v]=h.y,c[++v]=h.z,l[++g]=e,l[++g]=0,l[++g]=e,l[++g]=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 i=t.array[n];if(i.dist>h){const e=t.array[n-1];d=new J;const r=(h-e.dist)/(i.dist-e.dist);d.lerpPathPoints(e,i,r),m(d);break}m(i)}else d=t.array[0];return{position:u,normal:c,uv:l,indices:f,count:a}}(e,n);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}})),e=I(i);return e.lines=t,e}new V(0,0,1),new V;var dt={x:0,y:0},pt={x:0,y:0};function vt(t,n,i,e){for(var r=t.length,s=0;s<r;s++){var o=t[s].data;n=t[s].center||n;for(var h=0,a=o.length;h<a;h++)for(var u=o[h],c=0,l=u.length;c<l;c++)t[s].data[h][c]=gt(u[c],n,i,e)}}function gt(t,n,i,e,r){for(var s,o=[],h=r?3:2,a=0,u=(s=i?new Float64Array(t):new Float32Array(t)).length;a<u;a+=h){var c=s[a],l=s[a+1],f=s[a+2];if(n&&i&&e){dt.x=c,dt.y=l;var x=kt(dt,pt);dt.x=x.x,dt.y=x.y,c=(x=Vt(e,dt,i,pt)).x,l=x.y,c-=n[0],l-=n[1]}r?o.push([c,l,f]):o.push([c,l])}return o}function _t(t,n){void 0===n&&(n=1);for(var i=t.length,e=[],r=[],s=0,o=0;o<i;o++){var h=void 0;1===n?h=mt(t[o]):2===n?h=zt(t[o]):3===n&&(h=wt(t[o]));var a=t[o].bottomHeight||0,u=h.position;r.push(h);var c=u.length/3;e[o]={position:{middleZ:a+(t[o].height||0)/2,count:c,start:s,end:s+3*c},hide:!1},s+=3*c}var l=bt(r),f=l.position,x=l.normal,y=l.uv,d=l.indices;return{position:f.buffer,normal:x.buffer,uv:y.buffer,indices:d.buffer,geometriesAttributes:e}}function mt(t){var n=t.data,i=t.height,e=t.bottomHeight,r=j(n,{depth:i,top:t.top}),s=r.position,o=r.normal,h=r.uv,a=r.indices;return At(s,e),{position:s,normal:o,uv:h,indices:a}}function zt(t){var n=t.data,i=t.height,e=t.width,r=t.bottomHeight,s=W(n,{lineWidth:e,depth:i,pathUV:t.pathUV}),o=s.position,h=s.normal,a=s.uv,u=s.indices;return At(o,r),{position:o,normal:h,uv:a,indices:u}}function wt(t){var n=t.data,i=t.cornerRadius,e=t.width,r=t.bottomHeight,s=yt(n,{lineWidth:e,cornerRadius:i}),o=s.position,h=s.normal,a=s.uv,u=s.indices;return At(o,r),{position:o,normal:h,uv:a,indices:u}}function Mt(t,n){for(var i=new Float32Array(n),e=0,r=0;r<t.length;++r)i.set(t[r],e),e+=t[r].length;return i}function bt(t){for(var n={},i={},e=0;e<t.length;++e){var r=t[e];for(var s in r)void 0===n[s]&&(n[s]=[],i[s]=0),n[s].push(r[s]),i[s]+=r[s].length}var o={},h=0,a=[];for(var u in n)if("indices"===u)for(var c=n[u],l=0,f=c.length;l<f;l++){for(var x=c[l],y=0,d=x.length;y<d;y++)a.push(x[y]+h);h+=n.position[l].length/3}else{var p=Mt(n[u],i[u]);if(!p)return null;o[u]=p}return o.indices=new Uint32Array(a),o}function At(t,n){if(void 0!==n&&"number"==typeof n&&0!==n)for(var i=0,e=t.length;i<e;i+=3)t[i+2]+=n}function Pt(t){for(var n=[],i=0,e=t.length;i<e;i+=7){var r=t[i],s=t[i+1],o=t[i+2],h=t[i+3],a=t[i+4],u=t[i+5];n.push({radialSegments:o,radius:h,height:a,altitude:u,center:[r,s]})}for(var c=n.length,l=[],f=[],x=0,y=0;y<c;y++){var d=G(n[y].center||[0,0],n[y]),p=d.position;if(n[y].altitude)for(var v=n[y].altitude,g=0,_=p.length;g<_;g+=3)d[g+2]+=v;f.push(d);var m=p.length/3;l[y]={position:{middleZ:n[y].height/2,count:m,start:x,end:x+3*m},hide:!1},x+=3*m}var z=bt(f),w=z.position,M=z.normal,b=z.uv,A=z.indices;return{position:w.buffer,normal:M.buffer,uv:b.buffer,indices:A.buffer,geometriesAttributes:l}}var St=Math.PI/180,Ct=6378137*Math.PI/180;function kt(t,n){var i,e=85.0511287798,r=t.x,s=Math.max(Math.min(e,t.y),-e);i=0===s?0:Math.log(Math.tan((90+s)*St/2))/St;var o=r*Ct,h=i*Ct;return n?(n.x=o,n.y=h,n):{x:o,y:h}}function Vt(t,n,i,e){var r=t[0]*(n.x-t[2])/i,s=-t[1]*(n.y-t[3])/i;return e?(e.x=r,e.y=s,e):{x:r,y:s}}function Zt(t){void 0===t&&(t=[]);for(var n=t.length,i=new Float32Array(3*n),e=0;e<n;e++){var r=t[e],s=3*e;i[s]=r[0],i[s+1]=r[1],i[s+2]=r[2]||0}return i}function Ft(t){for(var n=new Float32Array(2*t.length-6),i=0,e=0,r=t.length/3;e<r;e++){var s=t[3*e],o=t[3*e+1],h=t[3*e+2];if(e>0&&e<r-1){var a=3*i;n[a]=s,n[a+1]=o,n[a+2]=h,i++}var u=3*i;n[u]=s,n[u+1]=o,n[u+2]=h,i++}return n}function Lt(t){var n=0,i=t.length;if(1===i)return t[0];for(var e=0;e<i;e++)n+=t[e].length;for(var r=new Float32Array(n),s=0,o=0;o<i;o++)r.set(t[o],s),s+=t[o].length;return r}t.initialize=function(){},t.onmessage=function(t,n){var i=t.data,e=i.type,r=i.datas,s=i.glRes,o=i.matrix,h=i.center;if("ExtrudePolygons"===e){vt(r,h,s,o);var a=_t(r);n(null,a,[a.position,a.normal,a.uv,a.indices])}else if("ExtrudeLines"===e||"Paths"===e){for(var u=0,c=r.length;u<c;u++)for(var l=0,f=r[u].data.length;l<f;l++)r[u].data[l]=gt(r[u].data[l],r[u].center||h,s,o,!0);var x=_t(r,"ExtrudeLines"===e?2:3);n(null,x,[x.position,x.normal,x.uv,x.indices])}else if("ExtrudePolygon"===e){var y=[],d=[];r.forEach((function(t){var n=[t];vt(n,h,s,o);var i=_t(n),e=i.position,r=i.normal,a=i.uv,u=i.indices;y.push({id:t.id,position:e,normal:r,uv:a,indices:u}),d.push(e,r,a,u)})),n(null,y,d)}else if("Line"===e||"FatLine"===e){for(var p=[],v=[],g=0,_=r.length;g<_;g++){for(var m=[],z=0,w=r[g].data.length;z<w;z++){r[g].data[z]=gt(r[g].data[z],r[g].center||h,s,o,!0);var M=Zt(r[g].data[z]);m.push(Ft(M))}var b=Lt(m);At(b,r[g].bottomHeight),p.push({id:r[g].id,position:b.buffer}),v.push(b.buffer)}n(null,p,v)}else if("Lines"===e||"FatLines"===e){for(var A=0,P=[],S=[],C=0,k=[],V=0,Z=r.length;V<Z;V++){for(var F=0,L=0,q=r[V].data.length;L<q;L++){r[V].data[L]=gt(r[V].data[L],r[V].center||h,s,o,!0);var E=Zt(r[V].data[L]);At(E,r[V].bottomHeight),F+=E.length/3*2-2,k.push(Ft(E))}var I=F;P[V]=[A,A+I],A+=I,S[V]={position:{count:F,start:C,end:C+3*F},hide:!1},"FatLines"===e&&(S[V].instanceStart={count:F,start:C,end:C+3*F},S[V].instanceEnd={count:F,start:C,end:C+3*F}),C+=3*F}var O=Lt(k);n(null,{id:r.id,position:O.buffer,geometriesAttributes:S,faceMap:P},[O.buffer])}else if("ExtrudeLine"===e||"Path"===e){for(var U=0,N=r.length;U<N;U++)for(var j=0,Q=r[U].data.length;j<Q;j++)r[U].data[j]=gt(r[U].data[j],r[U].center||h,s,o,!0);var R=[],W=[];r.forEach((function(t){var n=_t([t],"ExtrudeLine"===e?2:3),i=n.position,r=n.normal,s=n.uv,o=n.indices;R.push({id:t.id,position:i,normal:r,uv:s,indices:o}),W.push(i,r,s,o)})),n(null,R,W)}else if("Bar"===e){for(var B=[],T=[],H=(r=new Float32Array(r)).length/7,X=0;X<H;){var Y=r.slice(7*X,7*(X+1)),D=Pt(Y),G=D.position,J=D.normal,K=D.uv,$=D.indices;B.push({id:parseInt(Y[6]),position:G,normal:J,uv:K,indices:$}),T.push(G,J,K,$),X++}n(null,B,T)}else if("Bars"===e){var tt=Pt(r=new Float32Array(r));n(null,tt,[tt.position,tt.normal,tt.uv,tt.indices])}else console.error("No processing logic found for type:"+e)},Object.defineProperty(t,"__esModule",{value:!0})})'),n.registerWorkerAdapter("__maptalks.three.fetchdata__",(function(t){const e=[],r=[];function n(t){t.abort?(r.splice(r.indexOf(t),1),e.length&&(r.push(e[0]),e.splice(0,1),i(r[r.length-1]))):r.length<5?(r.push(t),i(t)):e.push(t)}function i(t){fetch(t.url).then((t=>t.text())).then((e=>{new Blob([e],{type:"application/json"}).arrayBuffer().then((e=>{t.postResponse(null,e,[e]),t.abort=!0,n(t)}))})).catch((e=>{console.error(e),t.abort=!0,n(t)}))}t.initialize=function(){},t.onmessage=function(t,e){n({url:t.data,postResponse:e,abort:!1})}})));var Do=6371008.8,Oo={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:250826616.45599997,kilometers:6371.0088,kilometres:6371.0088,meters:Do,metres:Do,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:3440.069546436285,radians:1,yards:6967335.223679999},No={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Do,yards:1.0936133},Fo={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Uo(t,e,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=e||{},n.geometry=t,n}function Qo(t,e,r){switch(t){case"Point":return Go(e).geometry;case"LineString":return qo(e).geometry;case"Polygon":return jo(e).geometry;case"MultiPoint":return Xo(e).geometry;case"MultiLineString":return Yo(e).geometry;case"MultiPolygon":return Jo(e).geometry;default:throw new Error(t+" is invalid")}}function Go(t,e,r){if(void 0===r&&(r={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!as(t[0])||!as(t[1]))throw new Error("coordinates must contain numbers");return Uo({type:"Point",coordinates:t},e,r)}function zo(t,e,r){return void 0===r&&(r={}),Wo(t.map((function(t){return Go(t,e)})),r)}function jo(t,e,r){void 0===r&&(r={});for(var n=0,i=t;n<i.length;n++){var o=i[n];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return Uo({type:"Polygon",coordinates:t},e,r)}function Vo(t,e,r){return void 0===r&&(r={}),Wo(t.map((function(t){return jo(t,e)})),r)}function qo(t,e,r){if(void 0===r&&(r={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return Uo({type:"LineString",coordinates:t},e,r)}function Ho(t,e,r){return void 0===r&&(r={}),Wo(t.map((function(t){return qo(t,e)})),r)}function Wo(t,e){void 0===e&&(e={});var r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=t,r}function Yo(t,e,r){return void 0===r&&(r={}),Uo({type:"MultiLineString",coordinates:t},e,r)}function Xo(t,e,r){return void 0===r&&(r={}),Uo({type:"MultiPoint",coordinates:t},e,r)}function Jo(t,e,r){return void 0===r&&(r={}),Uo({type:"MultiPolygon",coordinates:t},e,r)}function Ko(t,e,r){return void 0===r&&(r={}),Uo({type:"GeometryCollection",geometries:t},e,r)}function Zo(t,e){if(void 0===e&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r}function $o(t,e){void 0===e&&(e="kilometers");var r=Oo[e];if(!r)throw new Error(e+" units is invalid");return t*r}function ts(t,e){void 0===e&&(e="kilometers");var r=Oo[e];if(!r)throw new Error(e+" units is invalid");return t/r}function es(t,e){return ns(ts(t,e))}function rs(t){var e=t%360;return e<0&&(e+=360),e}function ns(t){return 180*(t%(2*Math.PI))/Math.PI}function is(t){return t%360*Math.PI/180}function os(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return $o(ts(t,e),r)}function ss(t,e,r){if(void 0===e&&(e="meters"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("area must be a positive number");var n=Fo[e];if(!n)throw new Error("invalid original units");var i=Fo[r];if(!i)throw new Error("invalid final units");return t/n*i}function as(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function us(t){return!!t&&t.constructor===Object}function ls(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!as(t))throw new Error("bbox must only contain numbers")}))}function hs(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}var cs=Object.freeze({__proto__:null,earthRadius:Do,factors:Oo,unitsFactors:No,areaFactors:Fo,feature:Uo,geometry:Qo,point:Go,points:zo,polygon:jo,polygons:Vo,lineString:qo,lineStrings:Ho,featureCollection:Wo,multiLineString:Yo,multiPoint:Xo,multiPolygon:Jo,geometryCollection:Ko,round:Zo,radiansToLength:$o,lengthToRadians:ts,lengthToDegrees:es,bearingToAzimuth:rs,radiansToDegrees:ns,degreesToRadians:is,convertLength:os,convertArea:ss,isNumber:as,isObject:us,validateBBox:ls,validateId:hs});function fs(t,e,r){if(null!==t)for(var n,i,o,s,a,u,l,h,c=0,f=0,p=t.type,d="FeatureCollection"===p,g="Feature"===p,y=d?t.features.length:1,v=0;v<y;v++){a=(h=!!(l=d?t.features[v].geometry:g?t.geometry:t)&&"GeometryCollection"===l.type)?l.geometries.length:1;for(var m=0;m<a;m++){var A=0,_=0;if(null!==(s=h?l.geometries[m]:l)){u=s.coordinates;var x=s.type;switch(c=!r||"Polygon"!==x&&"MultiPolygon"!==x?0:1,x){case null:break;case"Point":if(!1===e(u,f,v,A,_))return!1;f++,A++;break;case"LineString":case"MultiPoint":for(n=0;n<u.length;n++){if(!1===e(u[n],f,v,A,_))return!1;f++,"MultiPoint"===x&&A++}"LineString"===x&&A++;break;case"Polygon":case"MultiLineString":for(n=0;n<u.length;n++){for(i=0;i<u[n].length-c;i++){if(!1===e(u[n][i],f,v,A,_))return!1;f++}"MultiLineString"===x&&A++,"Polygon"===x&&_++}"Polygon"===x&&A++;break;case"MultiPolygon":for(n=0;n<u.length;n++){for(_=0,i=0;i<u[n].length;i++){for(o=0;o<u[n][i].length-c;o++){if(!1===e(u[n][i][o],f,v,A,_))return!1;f++}_++}A++}break;case"GeometryCollection":for(n=0;n<s.geometries.length;n++)if(!1===fs(s.geometries[n],e,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ps(t,e,r,n){var i=r;return fs(t,(function(t,n,o,s,a){i=0===n&&void 0===r?t:e(i,t,n,o,s,a)}),n),i}function ds(t,e){var r;switch(t.type){case"FeatureCollection":for(r=0;r<t.features.length&&!1!==e(t.features[r].properties,r);r++);break;case"Feature":e(t.properties,0)}}function gs(t,e,r){var n=r;return ds(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n}function ys(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var r=0;r<t.features.length&&!1!==e(t.features[r],r);r++);}function vs(t,e,r){var n=r;return ys(t,(function(t,i){n=0===i&&void 0===r?t:e(n,t,i)})),n}function ms(t){var e=[];return fs(t,(function(t){e.push(t)})),e}function As(t,e){var r,n,i,o,s,a,u,l,h,c,f=0,p="FeatureCollection"===t.type,d="Feature"===t.type,g=p?t.features.length:1;for(r=0;r<g;r++){for(a=p?t.features[r].geometry:d?t.geometry:t,l=p?t.features[r].properties:d?t.properties:{},h=p?t.features[r].bbox:d?t.bbox:void 0,c=p?t.features[r].id:d?t.id:void 0,s=(u=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=u?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(o,f,l,h,c))return!1;break;case"GeometryCollection":for(n=0;n<o.geometries.length;n++)if(!1===e(o.geometries[n],f,l,h,c))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,f,l,h,c))return!1;f++}}function _s(t,e,r){var n=r;return As(t,(function(t,i,o,s,a){n=0===i&&void 0===r?t:e(n,t,i,o,s,a)})),n}function xs(t,e){As(t,(function(t,r,n,i,o){var s,a=null===t?null:t.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==e(Uo(t,n,{bbox:i,id:o}),r,0)&&void 0}switch(a){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var u=0;u<t.coordinates.length;u++){var l=t.coordinates[u];if(!1===e(Uo({type:s,coordinates:l},n),r,u))return!1}}))}function ws(t,e,r){var n=r;return xs(t,(function(t,i,o){n=0===i&&0===o&&void 0===r?t:e(n,t,i,o)})),n}function bs(t,e){xs(t,(function(t,r,n){var i=0;if(t.geometry){var o=t.geometry.type;if("Point"!==o&&"MultiPoint"!==o){var s,a=0,u=0,l=0;return!1!==fs(t,(function(o,h,c,f,p){if(void 0===s||r>a||f>u||p>l)return s=o,a=r,u=f,l=p,void(i=0);var d=qo([s,o],t.properties);if(!1===e(d,r,n,p,i))return!1;i++,s=o}))&&void 0}}}))}function Es(t,e,r){var n=r,i=!1;return bs(t,(function(t,o,s,a,u){n=!1===i&&void 0===r?t:e(n,t,o,s,a,u),i=!0})),n}function Is(t,e){if(!t)throw new Error("geojson is required");xs(t,(function(t,r,n){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,r,n,0,0))return!1;break;case"Polygon":for(var s=0;s<o.length;s++)if(!1===e(qo(o[s],t.properties),r,n,s))return!1}}}))}function Cs(t,e,r){var n=r;return Is(t,(function(t,i,o,s){n=0===i&&void 0===r?t:e(n,t,i,o,s)})),n}function Ss(t,e){if(!us(e=e||{}))throw new Error("options is invalid");var r,n=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":n<0&&(n=t.features.length+n),a=a||t.features[n].properties,r=t.features[n].geometry;break;case"Feature":a=a||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var u=r.coordinates;switch(r.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=u.length+s-1),qo([u[s],u[s+1]],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s-1),qo([u[o][s],u[o][s+1]],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s-1),qo([u[i][s],u[i][s+1]],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s-1),qo([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")}function Ms(t,e){if(!us(e=e||{}))throw new Error("options is invalid");var r,n=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":n<0&&(n=t.features.length+n),a=a||t.features[n].properties,r=t.features[n].geometry;break;case"Feature":a=a||t.properties,r=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":r=t;break;default:throw new Error("geojson is invalid")}if(null===r)return null;var u=r.coordinates;switch(r.type){case"Point":return Go(u,a,e);case"MultiPoint":return i<0&&(i=u.length+i),Go(u[i],a,e);case"LineString":return s<0&&(s=u.length+s),Go(u[s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),Go(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),Go(u[i][s],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s),Go(u[i][o][s],a,e)}throw new Error("geojson is invalid")}var Bs=Object.freeze({__proto__:null,coordAll:ms,coordEach:fs,coordReduce:ps,featureEach:ys,featureReduce:vs,findPoint:Ms,findSegment:Ss,flattenEach:xs,flattenReduce:ws,geomEach:As,geomReduce:_s,lineEach:Is,lineReduce:Cs,propEach:ds,propReduce:gs,segmentEach:bs,segmentReduce:Es});function Ts(t){var e=[1/0,1/0,-1/0,-1/0];return fs(t,(function(t){e[0]>t[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]<t[0]&&(e[2]=t[0]),e[3]<t[1]&&(e[3]=t[1])})),e}function ks(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Ps(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Ls(t){if(t.length>1&&as(t[0])&&as(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return Ls(t[0]);throw new Error("coordinates must only contain numbers")}function Rs(t,e,r){if(!e||!r)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.type)}function Ds(t,e,r){if(!t)throw new Error("No feature passed");if(!r)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.geometry.type)}function Os(t,e,r){if(!t)throw new Error("No featureCollection passed");if(!r)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+r+", FeatureCollection required");for(var n=0,i=t.features;n<i.length;n++){var o=i[n];if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+o.geometry.type)}}function Ns(t){return"Feature"===t.type?t.geometry:t}function Fs(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":"Feature"===t.type&&null!==t.geometry?t.geometry.type:t.type}Ts.default=Ts;var Us=Object.freeze({__proto__:null,getCoord:ks,getCoords:Ps,containsNumber:Ls,geojsonType:Rs,featureOf:Ds,collectionOf:Os,getGeom:Ns,getType:Fs}),Qs=Object.getOwnPropertySymbols,Gs=Object.prototype.hasOwnProperty,zs=Object.prototype.propertyIsEnumerable;
18
18
  /*
19
19
  object-assign
20
20
  (c) Sindre Sorhus
@@ -186,7 +186,7 @@ Original licenses apply:
186
186
  Custom bundle of @unicode-font-resolver/client v1.0.2 (https://github.com/lojjic/unicode-font-resolver)
187
187
  for use in Troika text rendering.
188
188
  Original MIT license applies
189
- */const hU=oU({name:"FontResolver",dependencies:[function(t,e){const r=Object.create(null),n=Object.create(null);function i(e,i){let o=r[e];o?i(o):n[e]?n[e].push(i):(n[e]=[i],function(e,r){const n=t=>{console.error(`Failure loading font ${e}`,t)};try{const i=new XMLHttpRequest;i.open("get",e,!0),i.responseType="arraybuffer",i.onload=function(){if(i.status>=400)n(new Error(i.statusText));else if(i.status>0)try{const n=t(i.response);n.src=e,r(n)}catch(t){n(t)}},i.onerror=n,i.send()}catch(t){n(t)}}(e,(t=>{t.src=e,r[e]=t,n[e].forEach((e=>e(t))),delete n[e]})))}return function(t,n,{lang:o,fonts:s=[],style:a="normal",weight:u="normal",unicodeFontsURL:l}={}){const h=new Uint8Array(t.length),c=[];t.length||g();const f=new Map,p=[];if("italic"!==a&&(a="normal"),"number"!=typeof u&&(u="bold"===u?700:400),s&&!Array.isArray(s)&&(s=[s]),(s=s.slice().filter((t=>!t.lang||t.lang.test(o))).reverse()).length){const e=1,n=2;let o=0;!function a(u=0){for(let l=u,d=t.length;l<d;l++){const u=t.codePointAt(l);if(o===e&&c[h[l-1]].supportsCodePoint(u)||l>0&&/\s/.test(t[l]))h[l]=h[l-1],o===n&&(p[p.length-1][1]=l);else for(let t=h[l],d=s.length;t<=d;t++)if(t===d){(o===n?p[p.length-1]:p[p.length]=[l,l])[1]=l,o=n}else{h[l]=t;const{src:n,unicodeRange:p}=s[t];if(!p||y(u,p)){const t=r[n];if(!t)return void i(n,(()=>{a(l)}));if(t.supportsCodePoint(u)){let r=f.get(t);"number"!=typeof r&&(r=c.length,c.push(t),f.set(t,r)),h[l]=r,o=e;break}}}u>65535&&l+1<d&&(h[l+1]=h[l],l++,o===n&&(p[p.length-1][1]=l))}d()}()}else p.push([0,t.length-1]),d();function d(){if(p.length){const r=p.map((e=>t.substring(e[0],e[1]+1))).join("\n");e.getFontsForString(r,{lang:o||void 0,style:a,weight:u,dataUrl:l}).then((({fontUrls:t,chars:e})=>{const r=c.length;let n=0;p.forEach((t=>{for(let i=0,o=t[1]-t[0];i<=o;i++)h[t[0]+i]=e[n++]+r;n++}));let o=0;t.forEach(((e,n)=>{i(e,(e=>{c[n+r]=e,++o===t.length&&g()}))}))}))}else g()}function g(){n({chars:h,fonts:c})}function y(t,e){for(let r=0;r<e.length;r++){const[n,i=n]=e[r];if(n<=t&&t<=i)return!0}return!1}}},lU,function(){return function(t){var e=function(){this.buckets=new Map};e.prototype.add=function(t){var e=t>>5;this.buckets.set(e,(this.buckets.get(e)||0)|1<<(31&t))},e.prototype.has=function(t){var e=this.buckets.get(t>>5);return void 0!==e&&!!(e&1<<(31&t))},e.prototype.serialize=function(){var t=[];return this.buckets.forEach((function(e,r){t.push((+r).toString(36)+":"+e.toString(36))})),t.join(",")},e.prototype.deserialize=function(t){var e=this;this.buckets.clear(),t.split(",").forEach((function(t){var r=t.split(":");e.buckets.set(parseInt(r[0],36),parseInt(r[1],36))}))};var r=Math.pow(2,8),n=r-1,i=~n;function o(t){var e=function(t){return t&i}(t).toString(16),n=function(t){return(t&i)+r-1}(t).toString(16);return"codepoint-index/plane"+(t>>16)+"/"+e+"-"+n+".json"}function s(t,e){var r=t&n,i=e.codePointAt(r/6|0);return!!((i=(i||48)-48)&1<<r%6)}function a(t,e){!function(t,e){var r;(r=t,r.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map((function(t){return t.split("-").map((function(t){return parseInt(t.trim(),16)}))}))).forEach((function(t){var r=t[0],n=t[1];void 0===n&&(n=r),e(r,n)}))}(t,(function(t,r){for(var n=t;n<=r;n++)e(n)}))}var u={},l={},h=new WeakMap,c="https://cdn.jsdelivr.net/gh/lojjic/unicode-font-resolver@v1.0.1/packages/data";function f(t){var r=h.get(t);return r||(r=new e,a(t.ranges,(function(t){return r.add(t)})),h.set(t,r)),r}var p,d=new Map;function g(t,e,r){return t[e]?e:t[r]?r:function(t){for(var e in t)return e}(t)}function y(t,e){var r=e;if(!t.includes(r)){r=1/0;for(var n=0;n<t.length;n++)Math.abs(t[n]-e)<Math.abs(r-e)&&(r=t[n])}return r}function v(t){return p||(p=new Set,a("9-D,20,85,A0,1680,2000-200A,2028-202F,205F,3000",(function(t){p.add(t)}))),p.has(t)}return t.CodePointSet=e,t.clearCache=function(){u={},l={}},t.getFontsForString=function(t,e){void 0===e&&(e={});var r,n=e.lang;void 0===n&&(n=/\p{Script=Hangul}/u.test(r=t)?"ko":/\p{Script=Hiragana}|\p{Script=Katakana}/u.test(r)?"ja":"en");var i=e.category;void 0===i&&(i="sans-serif");var a=e.style;void 0===a&&(a="normal");var h=e.weight;void 0===h&&(h=400);var p=(e.dataUrl||c).replace(/\/$/g,""),m=new Map,A=new Uint8Array(t.length),_={},x={},w=new Array(t.length),b=new Map,E=!1;function I(t){var e=d.get(t);return e||(e=fetch(p+"/"+t).then((function(t){if(!t.ok)throw new Error(t.statusText);return t.json().then((function(t){if(!Array.isArray(t)||1!==t[0])throw new Error("Incorrect schema version; need 1, got "+t[0]);return t[1]}))})).catch((function(e){if(p!==c)return E||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+p+'", trying default CDN. '+e.message),E=!0),p=c,d.delete(t),I(t);throw e})),d.set(t,e)),e}for(var C=function(e){var r=t.codePointAt(e),n=o(r);w[e]=n,u[n]||b.has(n)||b.set(n,I(n).then((function(t){u[n]=t}))),r>65535&&(e++,S=e)},S=0;S<t.length;S++)C(S);return Promise.all(b.values()).then((function(){b.clear();for(var e=function(e){var i=t.codePointAt(e),o=null,a=u[w[e]],h=void 0;for(var c in a){var f=x[c];if(void 0===f&&(f=x[c]=new RegExp(c).test(n||"en")),f){for(var p in h=c,a[c])if(s(i,a[c][p])){o=p;break}break}}if(!o)t:for(var d in a)if(d!==h)for(var g in a[d])if(s(i,a[d][g])){o=g;break t}o||(console.debug("No font coverage for U+"+i.toString(16)),o="latin"),w[e]=o,l[o]||b.has(o)||b.set(o,I("font-meta/"+o+".json").then((function(t){l[o]=t}))),i>65535&&(e++,r=e)},r=0;r<t.length;r++)e(r);return Promise.all(b.values())})).then((function(){for(var e,r=null,n=0;n<t.length;n++){var o=t.codePointAt(n);if(r&&(v(o)||f(r).has(o)))A[n]=A[n-1];else{r=l[w[n]];var s=_[r.id];if(!s){var u=r.typeforms,c=g(u,i,"sans-serif"),d=g(u[c],a,"normal"),x=y(null===(e=u[c])||void 0===e?void 0:e[d],h);s=_[r.id]=p+"/font-files/"+r.id+"/"+c+"."+d+"."+x+".woff"}var b=m.get(s);null==b&&(b=m.size,m.set(s,b)),A[n]=b}o>65535&&(n++,A[n]=A[n-1])}return{fontUrls:Array.from(m.keys()),chars:A}}))},Object.defineProperty(t,"__esModule",{value:!0}),t}({})}],init:(t,e,r)=>t(e,r())});const cU=()=>(self.performance||Date).now(),fU=uU();let pU;const dU=[];let gU=0;function yU(){const t=cU();for(;dU.length&&cU()-t<5;)dU.shift()();gU=dU.length?setTimeout(yU,0):0}const vU=(...t)=>new Promise(((e,r)=>{dU.push((()=>{const n=cU();try{fU.webgl.generateIntoCanvas(...t),e({timing:cU()-n})}catch(t){r(t)}})),gU||(gU=setTimeout(yU,0))})),mU=4,AU=2e3,_U={};let xU=0;function wU(t,e,r,n,i,o,s,a,u,l){const h="TroikaTextSDFGenerator_JS_"+xU++%mU;let c=_U[h];return c||(c=_U[h]={workerModule:oU({name:h,workerId:h,dependencies:[uU,cU],init(t,e){const r=t().javascript.generate;return function(...t){const n=e();return{textureData:r(...t),timing:e()-n}}},getTransferables:t=>[t.textureData.buffer]}),requests:0,idleTimer:null}),c.requests++,clearTimeout(c.idleTimer),c.workerModule(t,e,r,n,i,o).then((({textureData:r,timing:n})=>{const i=cU(),o=new Uint8Array(4*r.length);for(let t=0;t<r.length;t++)o[4*t+l]=r[t];return fU.webglUtils.renderImageData(s,o,a,u,t,e,1<<3-l),n+=cU()-i,0==--c.requests&&(c.idleTimer=setTimeout((()=>{!function(t){nU[t]&&nU[t].forEach((function(t){t()})),rU[t]&&(rU[t].terminate(),delete rU[t])}(h)}),AU)),{timing:n}}))}const bU=fU.webglUtils.resizeWebGLCanvasWithoutClearing,EU={defaultFontURL:null,unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048,useWorker:!0},IU=new e.Color;function CU(){return(self.performance||Date).now()}const SU=Object.create(null);function MU(t,r){t=function(t,e){for(let r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}({},t);const n=CU(),{defaultFontURL:i}=EU,o=[];if(i&&o.push({label:"default",src:kU(i)}),t.font&&o.push({label:"user",src:kU(t.font)}),t.font=o,t.text=""+t.text,t.sdfGlyphSize=t.sdfGlyphSize||EU.sdfGlyphSize,t.unicodeFontsURL=t.unicodeFontsURL||EU.unicodeFontsURL,null!=t.colorRanges){let e={};for(let r in t.colorRanges)if(t.colorRanges.hasOwnProperty(r)){let n=t.colorRanges[r];"number"!=typeof n&&(n=IU.set(n).getHex()),e[r]=n}t.colorRanges=e}Object.freeze(t);const{textureWidth:s,sdfExponent:a}=EU,{sdfGlyphSize:u}=t,l=s/u*4;let h=SU[u];if(!h){const t=document.createElement("canvas");t.width=s,t.height=256*u/l,h=SU[u]={glyphCount:0,sdfGlyphSize:u,sdfCanvas:t,sdfTexture:new e.Texture(t,void 0,void 0,void 0,e.LinearFilter,e.LinearFilter),contextLost:!1,glyphsByFont:new Map},h.sdfTexture.generateMipmaps=!1,function(t){const e=t.sdfCanvas;e.addEventListener("webglcontextlost",(e=>{console.log("Context Lost",e),e.preventDefault(),t.contextLost=!0})),e.addEventListener("webglcontextrestored",(e=>{console.log("Context Restored",e),t.contextLost=!1;const r=[];t.glyphsByFont.forEach((e=>{e.forEach((e=>{r.push(BU(e,t,!0))}))})),Promise.all(r).then((()=>{PU(t),t.sdfTexture.needsUpdate=!0}))}))}(h)}const{sdfTexture:c,sdfCanvas:f}=h;RU(t).then((e=>{const{glyphIds:i,glyphFontIndices:o,fontData:p,glyphPositions:d,fontSize:g,timings:y}=e,v=[],m=new Float32Array(4*i.length);let A=0,_=0;const x=CU(),w=p.map((t=>{let e=h.glyphsByFont.get(t.src);return e||h.glyphsByFont.set(t.src,e=new Map),e}));i.forEach(((t,r)=>{const n=o[r],{src:s,unitsPerEm:a}=p[n];let l=w[n].get(t);if(!l){const{path:r,pathBounds:i}=e.glyphData[s][t],o=Math.max(i[2]-i[0],i[3]-i[1])/u*(EU.sdfMargin*u+.5),a=h.glyphCount++,c=[i[0]-o,i[1]-o,i[2]+o,i[3]+o];w[n].set(t,l={path:r,atlasIndex:a,sdfViewBox:c}),v.push(l)}const{sdfViewBox:c}=l,f=d[_++],y=d[_++],x=g/a;m[A++]=f+c[0]*x,m[A++]=y+c[1]*x,m[A++]=f+c[2]*x,m[A++]=y+c[3]*x,i[r]=l.atlasIndex})),y.quads=(y.quads||0)+(CU()-x);const b=CU();y.sdf={};const E=f.height,I=Math.ceil(h.glyphCount/l),C=Math.pow(2,Math.ceil(Math.log2(I*u)));C>E&&(console.info(`Increasing SDF texture size ${E}->${C}`),bU(f,s,C),c.dispose()),Promise.all(v.map((e=>BU(e,h,t.gpuAccelerateSDF).then((({timing:t})=>{y.sdf[e.atlasIndex]=t}))))).then((()=>{v.length&&!h.contextLost&&(PU(h),c.needsUpdate=!0),y.sdfTotal=CU()-b,y.total=CU()-n,r(Object.freeze({parameters:t,sdfTexture:c,sdfGlyphSize:u,sdfExponent:a,glyphBounds:m,glyphAtlasIndices:i,glyphColors:e.glyphColors,caretPositions:e.caretPositions,chunkedBounds:e.chunkedBounds,ascender:e.ascender,descender:e.descender,lineHeight:e.lineHeight,capHeight:e.capHeight,xHeight:e.xHeight,topBaseline:e.topBaseline,blockBounds:e.blockBounds,visibleBounds:e.visibleBounds,timings:e.timings}))}))})),Promise.resolve().then((()=>{h.contextLost||function(t){t._warm||(fU.webgl.isSupported(t),t._warm=!0)}(f)}))}function BU({path:t,atlasIndex:e,sdfViewBox:r},{sdfGlyphSize:n,sdfCanvas:i,contextLost:o},s){if(o)return Promise.resolve({timing:-1});const{textureWidth:a,sdfExponent:u}=EU,l=Math.max(r[2]-r[0],r[3]-r[1]),h=Math.floor(e/4);return function(t,e,r,n,i,o,s,a,u,l,h=!0){return h?vU(t,e,r,n,i,o,s,a,u,l).then(null,(h=>(pU||(console.warn("WebGL SDF generation failed, falling back to JS",h),pU=!0),wU(t,e,r,n,i,o,s,a,u,l)))):wU(t,e,r,n,i,o,s,a,u,l)}(n,n,t,r,l,u,i,h%(a/n)*n,Math.floor(h/(a/n))*n,e%4,s)}let TU;function kU(t){return TU||(TU="undefined"==typeof document?{}:document.createElement("a")),TU.href=t,TU.href}function PU(t){if("function"!=typeof createImageBitmap){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:r}=t,{width:n,height:i}=e,o=t.sdfCanvas.getContext("webgl");let s=r.image.data;s&&s.length===n*i*4||(s=new Uint8Array(n*i*4),r.image={width:n,height:i,data:s},r.flipY=!1,r.isDataTexture=!0),o.readPixels(0,0,n,i,o.RGBA,o.UNSIGNED_BYTE,s)}}const LU=oU({name:"Typesetter",dependencies:[function(t,e){const r=1/0,n=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,i="[^\\S\\u00A0]",o=new RegExp(`${i}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function s({text:s="",font:c,lang:f,sdfGlyphSize:p=64,fontSize:d=400,fontWeight:g=1,fontStyle:y="normal",letterSpacing:v=0,lineHeight:m="normal",maxWidth:A=r,direction:_,textAlign:x="left",textIndent:w=0,whiteSpace:b="normal",overflowWrap:E="normal",anchorX:I=0,anchorY:C=0,metricsOnly:S=!1,unicodeFontsURL:M,preResolvedFonts:B=null,includeCaretPositions:T=!1,chunkedBoundsSize:k=8192,colorRanges:P=null},L){const R=l(),D={fontLoad:0,typesetting:0};s.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),s=s.replace(/\r\n/g,"\n").replace(/\r/g,"\n")),d=+d,v=+v,A=+A,m=m||"normal",w=+w,function({text:e,lang:r,fonts:n,style:i,weight:o,preResolvedFonts:s,unicodeFontsURL:a},u){const l=({chars:t,fonts:e})=>{let r,n;const i=[];for(let o=0;o<t.length;o++)t[o]!==n?(n=t[o],i.push(r={start:o,end:o,fontObj:e[t[o]]})):r.end=o;u(i)};s?l(s):t(e,l,{lang:r,fonts:n,style:i,weight:o,unicodeFontsURL:a})}({text:s,lang:f,style:y,weight:g,fonts:"string"==typeof c?[{src:c}]:c,unicodeFontsURL:M,preResolvedFonts:B},(t=>{D.fontLoad=l()-R;const c=isFinite(A);let f=null,p=null,g=null,y=null,M=null,B=null,O=null,N=null,F=0,U=0,Q="nowrap"!==b;const G=new Map,z=l();let j=w,V=0,q=new h;const H=[q];t.forEach((t=>{const{fontObj:e}=t,{ascender:r,descender:a,unitsPerEm:u,lineGap:l,capHeight:f,xHeight:p}=e;let g=G.get(e);if(!g){const t=d/u,n="normal"===m?(r-a+l)*t:m*d,i=(n-(r-a)*t)/2,o=Math.min(n,(r-a)*t),s=(r+a)/2*t+o/2;g={index:G.size,src:e.src,fontObj:e,fontSizeMult:t,unitsPerEm:u,ascender:r*t,descender:a*t,capHeight:f*t,xHeight:p*t,lineHeight:n,baseline:-i-r*t,caretTop:s,caretBottom:s-o},G.set(e,g)}const{fontSizeMult:y}=g,_=s.slice(t.start,t.end+1);let x,b;e.forEachGlyph(_,d,v,((e,r,a,u)=>{r+=V,u+=t.start,x=r,b=e;const l=s.charAt(u),f=e.advanceWidth*y,p=q.count;let m;if("isEmpty"in e||(e.isWhitespace=!!l&&new RegExp(i).test(l),e.canBreakAfter=!!l&&o.test(l),e.isEmpty=e.xMin===e.xMax||e.yMin===e.yMax||n.test(l)),e.isWhitespace||e.isEmpty||U++,Q&&c&&!e.isWhitespace&&r+f+j>A&&p){if(q.glyphAt(p-1).glyphObj.canBreakAfter)m=new h,j=-r;else for(let t=p;t--;){if(0===t&&"break-word"===E){m=new h,j=-r;break}if(q.glyphAt(t).glyphObj.canBreakAfter){m=q.splitAt(t+1);const e=m.glyphAt(0).x;j-=e;for(let t=m.count;t--;)m.glyphAt(t).x-=e;break}}m&&(q.isSoftWrapped=!0,q=m,H.push(q),F=A)}let _=q.glyphAt(q.count);_.glyphObj=e,_.x=r+j,_.y=a,_.width=f,_.charIndex=u,_.fontData=g,"\n"===l&&(q=new h,H.push(q),j=-(r+f+v*d)+w)})),V=x+b.advanceWidth*y+v*d}));let W=0;H.forEach((t=>{let e=!0;for(let r=t.count;r--;){const n=t.glyphAt(r);e&&!n.glyphObj.isWhitespace&&(t.width=n.x+n.width,t.width>F&&(F=t.width),e=!1);let{lineHeight:i,capHeight:o,xHeight:s,baseline:a}=n.fontData;i>t.lineHeight&&(t.lineHeight=i);const u=a-t.baseline;u<0&&(t.baseline+=u,t.cap+=u,t.ex+=u),t.cap=Math.max(t.cap,t.baseline+o),t.ex=Math.max(t.ex,t.baseline+s)}t.baseline-=W,t.cap-=W,t.ex-=W,W+=t.lineHeight}));let Y=0,X=0;if(I&&("number"==typeof I?Y=-I:"string"==typeof I&&(Y=-F*("left"===I?0:"center"===I?.5:"right"===I?1:a(I)))),C&&("number"==typeof C?X=-C:"string"==typeof C&&(X="top"===C?0:"top-baseline"===C?-H[0].baseline:"top-cap"===C?-H[0].cap:"top-ex"===C?-H[0].ex:"middle"===C?W/2:"bottom"===C?W:"bottom-baseline"===C?-H[H.length-1].baseline:a(C)*W)),!S){const t=e.getEmbeddingLevels(s,_);f=new Uint16Array(U),p=new Uint8Array(U),g=new Float32Array(2*U),y={},O=[r,r,-1/0,-1/0],N=[],T&&(B=new Float32Array(4*s.length)),P&&(M=new Uint8Array(3*U));let n,i,o=0,a=-1,l=-1;if(H.forEach(((h,c)=>{let{count:d,width:v}=h;if(d>0){let c=0;for(let t=d;t--&&h.glyphAt(t).glyphObj.isWhitespace;)c++;let m=0,A=0;if("center"===x)m=(F-v)/2;else if("right"===x)m=F-v;else if("justify"===x&&h.isSoftWrapped){let t=0;for(let e=d-c;e--;)h.glyphAt(e).glyphObj.isWhitespace&&t++;A=(F-v)/t}if(A||m){let t=0;for(let e=0;e<d;e++){let r=h.glyphAt(e);const n=r.glyphObj;r.x+=m+t,0!==A&&n.isWhitespace&&e<d-c&&(t+=A,r.width+=A)}}const _=e.getReorderSegments(s,t,h.glyphAt(0).charIndex,h.glyphAt(h.count-1).charIndex);for(let t=0;t<_.length;t++){const[e,r]=_[t];let n=1/0,i=-1/0;for(let t=0;t<d;t++)if(h.glyphAt(t).charIndex>=e){let e=t,o=t;for(;o<d;o++){let t=h.glyphAt(o);if(t.charIndex>r)break;o<d-c&&(n=Math.min(n,t.x),i=Math.max(i,t.x+t.width))}for(let t=e;t<o;t++){const e=h.glyphAt(t);e.x=i-(e.x+e.width-n)}break}}let w;const b=t=>w=t;for(let c=0;c<d;c++){const d=h.glyphAt(c);w=d.glyphObj;const v=w.index,m=1&t.levels[d.charIndex];if(m){const t=e.getMirroredCharacter(s[d.charIndex]);t&&d.fontData.fontObj.forEachGlyph(t,0,0,b)}if(T){const{charIndex:t,fontData:e}=d,r=d.x+Y,n=d.x+d.width+Y;B[4*t]=m?n:r,B[4*t+1]=m?r:n,B[4*t+2]=h.baseline+e.caretBottom+X,B[4*t+3]=h.baseline+e.caretTop+X;const i=t-a;i>1&&u(B,a,i),a=t}if(P){const{charIndex:t}=d;for(;t>l;)l++,P.hasOwnProperty(l)&&(i=P[l])}if(!w.isWhitespace&&!w.isEmpty){const t=o++,{fontSizeMult:e,src:s,index:a}=d.fontData,u=y[s]||(y[s]={});u[v]||(u[v]={path:w.path,pathBounds:[w.xMin,w.yMin,w.xMax,w.yMax]});const l=d.x+Y,c=d.y+h.baseline+X;g[2*t]=l,g[2*t+1]=c;const m=l+w.xMin*e,A=c+w.yMin*e,_=l+w.xMax*e,x=c+w.yMax*e;m<O[0]&&(O[0]=m),A<O[1]&&(O[1]=A),_>O[2]&&(O[2]=_),x>O[3]&&(O[3]=x),t%k==0&&(n={start:t,end:t,rect:[r,r,-1/0,-1/0]},N.push(n)),n.end++;const b=n.rect;if(m<b[0]&&(b[0]=m),A<b[1]&&(b[1]=A),_>b[2]&&(b[2]=_),x>b[3]&&(b[3]=x),f[t]=v,p[t]=a,P){const e=3*t;M[e]=i>>16&255,M[e+1]=i>>8&255,M[e+2]=255&i}}}}})),B){const t=s.length-a;t>1&&u(B,a,t)}}const J=[];G.forEach((({index:t,src:e,unitsPerEm:r,ascender:n,descender:i,lineHeight:o,capHeight:s,xHeight:a})=>{J[t]={src:e,unitsPerEm:r,ascender:n,descender:i,lineHeight:o,capHeight:s,xHeight:a}})),D.typesetting=l()-z,L({glyphIds:f,glyphFontIndices:p,glyphPositions:g,glyphData:y,fontData:J,caretPositions:B,glyphColors:M,chunkedBounds:N,fontSize:d,topBaseline:X+H[0].baseline,blockBounds:[Y,X-W,Y+F,X],visibleBounds:O,timings:D})}))}function a(t){let e=t.match(/^([\d.]+)%$/),r=e?parseFloat(e[1]):NaN;return isNaN(r)?0:r/100}function u(t,e,r){const n=t[4*e],i=t[4*e+1],o=t[4*e+2],s=t[4*e+3],a=(i-n)/r;for(let i=0;i<r;i++){const r=4*(e+i);t[r]=n+a*i,t[r+1]=n+a*(i+1),t[r+2]=o,t[r+3]=s}}function l(){return(self.performance||Date).now()}function h(){this.data=[]}const c=["glyphObj","x","y","width","charIndex","fontData"];return h.prototype={width:0,lineHeight:0,baseline:0,cap:0,ex:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/c.length)},glyphAt(t){let e=h.flyweight;return e.data=this.data,e.index=t,e},splitAt(t){let e=new h;return e.data=this.data.splice(t*c.length),e}},h.flyweight=c.reduce(((t,e,r,n)=>(Object.defineProperty(t,e,{get(){return this.data[this.index*c.length+r]},set(t){this.data[this.index*c.length+r]=t}}),t)),{data:null,index:0}),{typeset:s,measure:function(t,e){s({...t,metricsOnly:!0},(t=>{const[r,n,i,o]=t.blockBounds;e({width:i-r,height:o-n})}))}}},hU,function(){var t=function(t){var e={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},r={},n={};r.L=1,n[1]="L",Object.keys(e).forEach((function(t,e){r[t]=1<<e+1,n[r[t]]=t})),Object.freeze(r);var i=r.LRI|r.RLI|r.FSI,o=r.L|r.R|r.AL,s=r.B|r.S|r.WS|r.ON|r.FSI|r.LRI|r.RLI|r.PDI,a=r.BN|r.RLE|r.LRE|r.RLO|r.LRO|r.PDF,u=r.S|r.WS|r.B|i|r.PDI|a,l=null;function h(t){return function(){if(!l){l=new Map;var t=function(t){if(e.hasOwnProperty(t)){var n=0;e[t].split(",").forEach((function(e){var i=e.split("+"),o=i[0],s=i[1];o=parseInt(o,36),s=s?parseInt(s,36):0,l.set(n+=o,r[t]);for(var a=0;a<s;a++)l.set(++n,r[t])}))}};for(var n in e)t(n)}}(),l.get(t.codePointAt(0))||r.L}var c,f,p,d="14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",g="6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye";function y(t,e){var r,n=0,i=new Map,o=e&&new Map;return t.split(",").forEach((function t(s){if(-1!==s.indexOf("+"))for(var a=+s;a--;)t(r);else{r=s;var u=s.split(">"),l=u[0],h=u[1];l=String.fromCodePoint(n+=parseInt(l,36)),h=String.fromCodePoint(n+=parseInt(h,36)),i.set(l,h),e&&o.set(h,l)}})),{map:i,reverseMap:o}}function v(){if(!c){var t=y(d,!0),e=t.map,r=t.reverseMap;c=e,f=r,p=y(g,!1).map}}function m(t){return v(),c.get(t)||null}function A(t){return v(),f.get(t)||null}function _(t){return v(),p.get(t)||null}var x=r.L,w=r.R,b=r.EN,E=r.ES,I=r.ET,C=r.AN,S=r.CS,M=r.B,B=r.S,T=r.ON,k=r.BN,P=r.NSM,L=r.AL,R=r.LRO,D=r.RLO,O=r.LRE,N=r.RLE,F=r.PDF,U=r.LRI,Q=r.RLI,G=r.FSI,z=r.PDI;var j;function V(t){return function(){if(!j){var t=y("14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",!0),e=t.map;t.reverseMap.forEach((function(t,r){e.set(r,t)})),j=e}}(),j.get(t)||null}function q(t,e,r,n){var i=t.length;r=Math.max(0,null==r?0:+r),n=Math.min(i-1,null==n?i-1:+n);var o=[];return e.paragraphs.forEach((function(i){var s=Math.max(r,i.start),a=Math.min(n,i.end);if(s<a){for(var l=e.levels.slice(s,a+1),c=a;c>=s&&h(t[c])&u;c--)l[c]=i.level;for(var f=i.level,p=1/0,d=0;d<l.length;d++){var g=l[d];g>f&&(f=g),g<p&&(p=1|g)}for(var y=f;y>=p;y--)for(var v=0;v<l.length;v++)if(l[v]>=y){for(var m=v;v+1<l.length&&l[v+1]>=y;)v++;v>m&&o.push([m+s,v+s])}}})),o}function H(t,e,r,n){for(var i=q(t,e,r,n),o=[],s=0;s<t.length;s++)o[s]=s;return i.forEach((function(t){for(var e=t[0],r=t[1],n=o.slice(e,r+1),i=n.length;i--;)o[r-i]=n[i]})),o}return t.closingToOpeningBracket=A,t.getBidiCharType=h,t.getBidiCharTypeName=function(t){return n[h(t)]},t.getCanonicalBracket=_,t.getEmbeddingLevels=function(t,e){for(var r=new Uint32Array(t.length),n=0;n<t.length;n++)r[n]=h(t[n]);var l=new Map;function c(t,e){var n=r[t];r[t]=e,l.set(n,l.get(n)-1),n&s&&l.set(s,l.get(s)-1),l.set(e,(l.get(e)||0)+1),e&s&&l.set(s,(l.get(s)||0)+1)}for(var f=new Uint8Array(t.length),p=new Map,d=[],g=null,y=0;y<t.length;y++)g||d.push(g={start:y,end:t.length-1,level:"rtl"===e?1:"ltr"===e?0:Ge(y,!1)}),r[y]&M&&(g.end=y,g=null);for(var v=N|O|D|R|i|z|F|M,j=function(t){return t+(1&t?1:2)},V=function(t){return t+(1&t?2:1)},q=0;q<d.length;q++){var H=[{_level:(g=d[q]).level,_override:0,_isolate:0}],W=void 0,Y=0,X=0,J=0;l.clear();for(var K=g.start;K<=g.end;K++){var Z=r[K];if(W=H[H.length-1],l.set(Z,(l.get(Z)||0)+1),Z&s&&l.set(s,(l.get(s)||0)+1),Z&v)if(Z&(N|O)){f[K]=W._level;var $=(Z===N?V:j)(W._level);$<=125&&!Y&&!X?H.push({_level:$,_override:0,_isolate:0}):Y||X++}else if(Z&(D|R)){f[K]=W._level;var tt=(Z===D?V:j)(W._level);tt<=125&&!Y&&!X?H.push({_level:tt,_override:Z&D?w:x,_isolate:0}):Y||X++}else if(Z&i){Z&G&&(Z=1===Ge(K+1,!0)?Q:U),f[K]=W._level,W._override&&c(K,W._override);var et=(Z===Q?V:j)(W._level);et<=125&&0===Y&&0===X?(J++,H.push({_level:et,_override:0,_isolate:1,_isolInitIndex:K})):Y++}else if(Z&z){if(Y>0)Y--;else if(J>0){for(X=0;!H[H.length-1]._isolate;)H.pop();var rt=H[H.length-1]._isolInitIndex;null!=rt&&(p.set(rt,K),p.set(K,rt)),H.pop(),J--}W=H[H.length-1],f[K]=W._level,W._override&&c(K,W._override)}else Z&F?(0===Y&&(X>0?X--:!W._isolate&&H.length>1&&(H.pop(),W=H[H.length-1])),f[K]=W._level):Z&M&&(f[K]=g.level);else f[K]=W._level,W._override&&Z!==k&&c(K,W._override)}for(var nt=[],it=null,ot=g.start;ot<=g.end;ot++){var st=r[ot];if(!(st&a)){var at=f[ot],ut=st&i,lt=st===z;it&&at===it._level?(it._end=ot,it._endsWithIsolInit=ut):nt.push(it={_start:ot,_end:ot,_level:at,_startsWithPDI:lt,_endsWithIsolInit:ut})}}for(var ht=[],ct=0;ct<nt.length;ct++){var ft=nt[ct];if(!ft._startsWithPDI||ft._startsWithPDI&&!p.has(ft._start)){for(var pt=[it=ft],dt=void 0;it&&it._endsWithIsolInit&&null!=(dt=p.get(it._end));)for(var gt=ct+1;gt<nt.length;gt++)if(nt[gt]._start===dt){pt.push(it=nt[gt]);break}for(var yt=[],vt=0;vt<pt.length;vt++)for(var mt=pt[vt],At=mt._start;At<=mt._end;At++)yt.push(At);for(var _t=f[yt[0]],xt=g.level,wt=yt[0]-1;wt>=0;wt--)if(!(r[wt]&a)){xt=f[wt];break}var bt=yt[yt.length-1],Et=f[bt],It=g.level;if(!(r[bt]&i))for(var Ct=bt+1;Ct<=g.end;Ct++)if(!(r[Ct]&a)){It=f[Ct];break}ht.push({_seqIndices:yt,_sosType:Math.max(xt,_t)%2?w:x,_eosType:Math.max(It,Et)%2?w:x})}}for(var St=0;St<ht.length;St++){var Mt=ht[St],Bt=Mt._seqIndices,Tt=Mt._sosType,kt=Mt._eosType,Pt=1&f[Bt[0]]?w:x;if(l.get(P))for(var Lt=0;Lt<Bt.length;Lt++){var Rt=Bt[Lt];if(r[Rt]&P){for(var Dt=Tt,Ot=Lt-1;Ot>=0;Ot--)if(!(r[Bt[Ot]]&a)){Dt=r[Bt[Ot]];break}c(Rt,Dt&(i|z)?T:Dt)}}if(l.get(b))for(var Nt=0;Nt<Bt.length;Nt++){var Ft=Bt[Nt];if(r[Ft]&b)for(var Ut=Nt-1;Ut>=-1;Ut--){var Qt=-1===Ut?Tt:r[Bt[Ut]];if(Qt&o){Qt===L&&c(Ft,C);break}}}if(l.get(L))for(var Gt=0;Gt<Bt.length;Gt++){var zt=Bt[Gt];r[zt]&L&&c(zt,w)}if(l.get(E)||l.get(S))for(var jt=1;jt<Bt.length-1;jt++){var Vt=Bt[jt];if(r[Vt]&(E|S)){for(var qt=0,Ht=0,Wt=jt-1;Wt>=0&&(qt=r[Bt[Wt]])&a;Wt--);for(var Yt=jt+1;Yt<Bt.length&&(Ht=r[Bt[Yt]])&a;Yt++);qt===Ht&&(r[Vt]===E?qt===b:qt&(b|C))&&c(Vt,qt)}}if(l.get(b))for(var Xt=0;Xt<Bt.length;Xt++){var Jt=Bt[Xt];if(r[Jt]&b){for(var Kt=Xt-1;Kt>=0&&r[Bt[Kt]]&(I|a);Kt--)c(Bt[Kt],b);for(Xt++;Xt<Bt.length&&r[Bt[Xt]]&(I|a|b);Xt++)r[Bt[Xt]]!==b&&c(Bt[Xt],b)}}if(l.get(I)||l.get(E)||l.get(S))for(var Zt=0;Zt<Bt.length;Zt++){var $t=Bt[Zt];if(r[$t]&(I|E|S)){c($t,T);for(var te=Zt-1;te>=0&&r[Bt[te]]&a;te--)c(Bt[te],T);for(var ee=Zt+1;ee<Bt.length&&r[Bt[ee]]&a;ee++)c(Bt[ee],T)}}if(l.get(b))for(var re=0,ne=Tt;re<Bt.length;re++){var ie=Bt[re],oe=r[ie];oe&b?ne===x&&c(ie,x):oe&o&&(ne=oe)}if(l.get(s)){for(var se=w|b|C,ae=se|x,ue=[],le=[],he=0;he<Bt.length;he++)if(r[Bt[he]]&s){var ce=t[Bt[he]],fe=void 0;if(null!==m(ce)){if(!(le.length<63))break;le.push({char:ce,seqIndex:he})}else if(null!==(fe=A(ce)))for(var pe=le.length-1;pe>=0;pe--){var de=le[pe].char;if(de===fe||de===A(_(ce))||m(_(de))===ce){ue.push([le[pe].seqIndex,he]),le.length=pe;break}}}ue.sort((function(t,e){return t[0]-e[0]}));for(var ge=0;ge<ue.length;ge++){for(var ye=ue[ge],ve=ye[0],me=ye[1],Ae=!1,_e=0,xe=ve+1;xe<me;xe++){var we=Bt[xe];if(r[we]&ae){Ae=!0;var be=r[we]&se?w:x;if(be===Pt){_e=be;break}}}if(Ae&&!_e){_e=Tt;for(var Ee=ve-1;Ee>=0;Ee--){var Ie=Bt[Ee];if(r[Ie]&ae){var Ce=r[Ie]&se?w:x;_e=Ce!==Pt?Ce:Pt;break}}}if(_e){if(r[Bt[ve]]=r[Bt[me]]=_e,_e!==Pt)for(var Se=ve+1;Se<Bt.length;Se++)if(!(r[Bt[Se]]&a)){h(t[Bt[Se]])&P&&(r[Bt[Se]]=_e);break}if(_e!==Pt)for(var Me=me+1;Me<Bt.length;Me++)if(!(r[Bt[Me]]&a)){h(t[Bt[Me]])&P&&(r[Bt[Me]]=_e);break}}}for(var Be=0;Be<Bt.length;Be++)if(r[Bt[Be]]&s){for(var Te=Be,ke=Be,Pe=Tt,Le=Be-1;Le>=0;Le--){if(!(r[Bt[Le]]&a)){Pe=r[Bt[Le]]&se?w:x;break}Te=Le}for(var Re=kt,De=Be+1;De<Bt.length;De++){if(!(r[Bt[De]]&(s|a))){Re=r[Bt[De]]&se?w:x;break}ke=De}for(var Oe=Te;Oe<=ke;Oe++)r[Bt[Oe]]=Pe===Re?Pe:Pt;Be=ke}}}for(var Ne=g.start;Ne<=g.end;Ne++){var Fe=f[Ne],Ue=r[Ne];if(1&Fe?Ue&(x|b|C)&&f[Ne]++:Ue&w?f[Ne]++:Ue&(C|b)&&(f[Ne]+=2),Ue&a&&(f[Ne]=0===Ne?g.level:f[Ne-1]),Ne===g.end||h(t[Ne])&(B|M))for(var Qe=Ne;Qe>=0&&h(t[Qe])&u;Qe--)f[Qe]=g.level}}return{levels:f,paragraphs:d};function Ge(e,n){for(var o=e;o<t.length;o++){var s=r[o];if(s&(w|L))return 1;if(s&(M|x)||n&&s===z)return 0;if(s&i){var a=ze(o);o=-1===a?t.length:a}}return 0}function ze(e){for(var n=1,o=e+1;o<t.length;o++){var s=r[o];if(s&M)break;if(s&z){if(0==--n)return o}else s&i&&n++}return-1}},t.getMirroredCharacter=V,t.getMirroredCharactersMap=function(t,e,r,n){var i=t.length;r=Math.max(0,null==r?0:+r),n=Math.min(i-1,null==n?i-1:+n);for(var o=new Map,s=r;s<=n;s++)if(1&e[s]){var a=V(t[s]);null!==a&&o.set(s,a)}return o},t.getReorderSegments=q,t.getReorderedIndices=H,t.getReorderedString=function(t,e,r,n){var i=H(t,e,r,n),o=[].concat(t);return i.forEach((function(r,n){o[n]=(1&e.levels[r]?V(t[r]):null)||t[r]})),o.join("")},t.openingToClosingBracket=m,Object.defineProperty(t,"__esModule",{value:!0}),t}({});return t}],init:(t,e,r)=>t(e,r())}),RU=oU({name:"Typesetter",dependencies:[LU],init:t=>function(e){return new Promise((r=>{t.typeset(e,r)}))},getTransferables(t){const e=[];for(let r in t)t[r]&&t[r].buffer&&e.push(t[r].buffer);return e}});RU.onMainThread;const DU={};const OU="aTroikaGlyphIndex";class NU extends e.InstancedBufferGeometry{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new e.Sphere,this.boundingBox=new e.Box3}computeBoundingSphere(){}computeBoundingBox(){}set detail(t){if(t!==this._detail){this._detail=t,("number"!=typeof t||t<1)&&(t=1);let r=function(t){let r=DU[t];return r||(r=DU[t]=new e.PlaneGeometry(1,1,t,t).translate(.5,.5,0)),r}(t);["position","normal","uv"].forEach((t=>{this.attributes[t]=r.attributes[t].clone()})),this.setIndex(r.getIndex().clone())}}get detail(){return this._detail}set curveRadius(t){t!==this._curveRadius&&(this._curveRadius=t,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(t,e,r,n,i){this.updateAttributeData("aTroikaGlyphBounds",t,4),this.updateAttributeData(OU,e,1),this.updateAttributeData("aTroikaGlyphColor",i,3),this._blockBounds=r,this._chunkedBounds=n,this.instanceCount=e.length,this._updateBounds()}_updateBounds(){const t=this._blockBounds;if(t){const{curveRadius:e,boundingBox:r}=this;if(e){const{PI:n,floor:i,min:o,max:s,sin:a,cos:u}=Math,l=n/2,h=2*n,c=Math.abs(e),f=t[0]/c,p=t[2]/c,d=i((f+l)/h)!==i((p+l)/h)?-c:o(a(f)*c,a(p)*c),g=i((f-l)/h)!==i((p-l)/h)?c:s(a(f)*c,a(p)*c),y=i((f+n)/h)!==i((p+n)/h)?2*c:s(c-u(f)*c,c-u(p)*c);r.min.set(d,t[1],e<0?-y:0),r.max.set(g,t[3],e<0?0:y)}else r.min.set(t[0],t[1],0),r.max.set(t[2],t[3],0);r.getBoundingSphere(this.boundingSphere)}}applyClipRect(t){let e=this.getAttribute(OU).count,r=this._chunkedBounds;if(r)for(let n=r.length;n--;){e=r[n].end;let i=r[n].rect;if(i[1]<t.w&&i[3]>t.y&&i[0]<t.z&&i[2]>t.x)break}this.instanceCount=e}updateAttributeData(t,r,n){const i=this.getAttribute(t);r?i&&i.array.length===r.length?(i.array.set(r),i.needsUpdate=!0):(this.setAttribute(t,new e.InstancedBufferAttribute(r,n)),delete this._maxInstanceCount,this.dispose()):i&&this.deleteAttribute(t)}}const FU=new e.MeshBasicMaterial({color:16777215,side:e.DoubleSide,transparent:!0}),UU=8421504,QU=new e.Matrix4,GU=new e.Vector3,zU=new e.Vector3,jU=[],VU=new e.Vector3,qU="+x+y";function HU(t){return Array.isArray(t)?t[0]:t}let WU=()=>{const t=new e.Mesh(new e.PlaneGeometry(1,1),FU);return WU=()=>t,t},YU=()=>{const t=new e.Mesh(new e.PlaneGeometry(1,1,32,1),FU);return YU=()=>t,t};const XU={type:"syncstart"},JU={type:"synccomplete"},KU=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],ZU=KU.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");class $U extends e.Mesh{constructor(){super(new NU,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=UU,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=qU,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(t){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(t):(this._isSyncing=!0,this.dispatchEvent(XU),MU({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},(e=>{this._isSyncing=!1,this._textRenderInfo=e,this.geometry.updateGlyphs(e.glyphBounds,e.glyphAtlasIndices,e.blockBounds,e.chunkedBounds,e.glyphColors);const r=this._queuedSyncs;r&&(this._queuedSyncs=null,this._needsSync=!0,this.sync((()=>{r.forEach((t=>t&&t()))}))),this.dispatchEvent(JU),t&&t()}))))}onBeforeRender(t,e,r,n,i,o){this.sync(),i.isTroikaTextMaterial&&this._prepareForRender(i)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(t){return function(t){const r=HF(t,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new e.Vector2},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new e.Vector4(0,0,0,0)},uTroikaClipRect:{value:new e.Vector4(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new e.Vector2},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new e.Color},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new e.Matrix3},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:"\nuniform vec2 uTroikaSDFTextureSize;\nuniform float uTroikaSDFGlyphSize;\nuniform vec4 uTroikaTotalBounds;\nuniform vec4 uTroikaClipRect;\nuniform mat3 uTroikaOrient;\nuniform bool uTroikaUseGlyphColors;\nuniform float uTroikaEdgeOffset;\nuniform float uTroikaBlurRadius;\nuniform vec2 uTroikaPositionOffset;\nuniform float uTroikaCurveRadius;\nattribute vec4 aTroikaGlyphBounds;\nattribute float aTroikaGlyphIndex;\nattribute vec3 aTroikaGlyphColor;\nvarying vec2 vTroikaGlyphUV;\nvarying vec4 vTroikaTextureUVBounds;\nvarying float vTroikaTextureChannel;\nvarying vec3 vTroikaGlyphColor;\nvarying vec2 vTroikaGlyphDimensions;\n",vertexTransform:"\nvec4 bounds = aTroikaGlyphBounds;\nbounds.xz += uTroikaPositionOffset.x;\nbounds.yw -= uTroikaPositionOffset.y;\n\nvec4 outlineBounds = vec4(\n bounds.xy - uTroikaEdgeOffset - uTroikaBlurRadius,\n bounds.zw + uTroikaEdgeOffset + uTroikaBlurRadius\n);\nvec4 clippedBounds = vec4(\n clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw),\n clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw)\n);\n\nvec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy);\n\nposition.xy = mix(bounds.xy, bounds.zw, clippedXY);\n\nuv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy);\n\nfloat rad = uTroikaCurveRadius;\nif (rad != 0.0) {\n float angle = position.x / rad;\n position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad);\n normal.xz = vec2(sin(angle), cos(angle));\n}\n \nposition = uTroikaOrient * position;\nnormal = uTroikaOrient * normal;\n\nvTroikaGlyphUV = clippedXY.xy;\nvTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]);\n\n\nfloat txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize;\nvec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize;\nvec2 txStartUV = txUvPerSquare * vec2(\n mod(floor(aTroikaGlyphIndex / 4.0), txCols),\n floor(floor(aTroikaGlyphIndex / 4.0) / txCols)\n);\nvTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare);\nvTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0);\n",fragmentDefs:"\nuniform sampler2D uTroikaSDFTexture;\nuniform vec2 uTroikaSDFTextureSize;\nuniform float uTroikaSDFGlyphSize;\nuniform float uTroikaSDFExponent;\nuniform float uTroikaEdgeOffset;\nuniform float uTroikaFillOpacity;\nuniform float uTroikaBlurRadius;\nuniform vec3 uTroikaStrokeColor;\nuniform float uTroikaStrokeWidth;\nuniform float uTroikaStrokeOpacity;\nuniform bool uTroikaSDFDebug;\nvarying vec2 vTroikaGlyphUV;\nvarying vec4 vTroikaTextureUVBounds;\nvarying float vTroikaTextureChannel;\nvarying vec2 vTroikaGlyphDimensions;\n\nfloat troikaSdfValueToSignedDistance(float alpha) {\n // Inverse of exponential encoding in webgl-sdf-generator\n \n float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y);\n float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension;\n float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0);\n return signedDist;\n}\n\nfloat troikaGlyphUvToSdfValue(vec2 glyphUV) {\n vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV);\n vec4 rgba = texture2D(uTroikaSDFTexture, textureUV);\n float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1\n return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a;\n}\n\nfloat troikaGlyphUvToDistance(vec2 uv) {\n return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv));\n}\n\nfloat troikaGetAADist() {\n \n #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\n return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5;\n #else\n return vTroikaGlyphDimensions.x / 64.0;\n #endif\n}\n\nfloat troikaGetFragDistValue() {\n vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize);\n float distance = troikaGlyphUvToDistance(clampedGlyphUV);\n \n // Extrapolate distance when outside bounds:\n distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 : \n length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions);\n\n \n\n return distance;\n}\n\nfloat troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) {\n #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)\n float alpha = step(-distanceOffset, -distance);\n #else\n\n float alpha = smoothstep(\n distanceOffset + aaDist,\n distanceOffset - aaDist,\n distance\n );\n #endif\n\n return alpha;\n}\n",fragmentColorTransform:"\nfloat aaDist = troikaGetAADist();\nfloat fragDistance = troikaGetFragDistValue();\nfloat edgeAlpha = uTroikaSDFDebug ?\n troikaGlyphUvToSdfValue(vTroikaGlyphUV) :\n troikaGetEdgeAlpha(fragDistance, uTroikaEdgeOffset, max(aaDist, uTroikaBlurRadius));\n\n#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL)\nvec4 fillRGBA = gl_FragColor;\nfillRGBA.a *= uTroikaFillOpacity;\nvec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity);\nif (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb;\ngl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep(\n -uTroikaStrokeWidth - aaDist,\n -uTroikaStrokeWidth + aaDist,\n fragDistance\n));\ngl_FragColor.a *= edgeAlpha;\n#endif\n\nif (edgeAlpha == 0.0) {\n discard;\n}\n",customRewriter({vertexShader:t,fragmentShader:e}){let r=/\buniform\s+vec3\s+diffuse\b/;return r.test(e)&&(e=e.replace(r,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),r.test(t)||(t=t.replace(FF,"uniform vec3 diffuse;\n$&\nvTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;\n"))),{vertexShader:t,fragmentShader:e}}});return r.transparent=!0,r.forceSinglePass=!0,Object.defineProperties(r,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),r}(t)}get material(){let t=this._derivedMaterial;const e=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=FU.clone());if(t&&t.isDerivedFrom(e)||(t=this._derivedMaterial=this.createDerivedMaterial(e),e.addEventListener("dispose",(function r(){e.removeEventListener("dispose",r),t.dispose()}))),this.hasOutline()){let e=t._outlineMtl;return e||(e=t._outlineMtl=Object.create(t,{id:{value:t.id+.1}}),e.isTextOutlineMaterial=!0,e.depthWrite=!1,e.map=null,t.addEventListener("dispose",(function r(){t.removeEventListener("dispose",r),e.dispose()}))),[e,t]}return t}set material(t){t&&t.isTroikaTextMaterial?(this._derivedMaterial=t,this._baseMaterial=t.baseMaterial):this._baseMaterial=t}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(t){this.geometry.detail=t}get curveRadius(){return this.geometry.curveRadius}set curveRadius(t){this.geometry.curveRadius=t}get customDepthMaterial(){return HU(this.material).getDepthMaterial()}set customDepthMaterial(t){}get customDistanceMaterial(){return HU(this.material).getDistanceMaterial()}set customDistanceMaterial(t){}_prepareForRender(t){const r=t.isTextOutlineMaterial,n=t.uniforms,i=this.textRenderInfo;if(i){const{sdfTexture:t,blockBounds:e}=i;n.uTroikaSDFTexture.value=t,n.uTroikaSDFTextureSize.value.set(t.image.width,t.image.height),n.uTroikaSDFGlyphSize.value=i.sdfGlyphSize,n.uTroikaSDFExponent.value=i.sdfExponent,n.uTroikaTotalBounds.value.fromArray(e),n.uTroikaUseGlyphColors.value=!r&&!!i.glyphColors;let o,s,a,u=0,l=0,h=0,c=0,f=0;if(r){let{outlineWidth:t,outlineOffsetX:e,outlineOffsetY:r,outlineBlur:n,outlineOpacity:i}=this;u=this._parsePercent(t)||0,l=Math.max(0,this._parsePercent(n)||0),o=i,c=this._parsePercent(e)||0,f=this._parsePercent(r)||0}else h=Math.max(0,this._parsePercent(this.strokeWidth)||0),h&&(a=this.strokeColor,n.uTroikaStrokeColor.value.set(null==a?UU:a),s=this.strokeOpacity,null==s&&(s=1)),o=this.fillOpacity;n.uTroikaEdgeOffset.value=u,n.uTroikaPositionOffset.value.set(c,f),n.uTroikaBlurRadius.value=l,n.uTroikaStrokeWidth.value=h,n.uTroikaStrokeOpacity.value=s,n.uTroikaFillOpacity.value=null==o?1:o,n.uTroikaCurveRadius.value=this.curveRadius||0;let p=this.clipRect;if(p&&Array.isArray(p)&&4===p.length)n.uTroikaClipRect.value.fromArray(p);else{const t=100*(this.fontSize||.1);n.uTroikaClipRect.value.set(e[0]-t,e[1]-t,e[2]+t,e[3]+t)}this.geometry.applyClipRect(n.uTroikaClipRect.value)}n.uTroikaSDFDebug.value=!!this.debugSDF,t.polygonOffset=!!this.depthOffset,t.polygonOffsetFactor=t.polygonOffsetUnits=this.depthOffset||0;const o=r?this.outlineColor||0:this.color;if(null==o)delete t.color;else{const r=t.hasOwnProperty("color")?t.color:t.color=new e.Color;o===r._input&&"object"!=typeof o||r.set(r._input=o)}let s=this.orientation||qU;if(s!==t._orientation){let e=n.uTroikaOrient.value;s=s.replace(/[^-+xyz]/g,"");let r=s!==qU&&s.match(/^([-+])([xyz])([-+])([xyz])$/);if(r){let[,t,n,i,o]=r;GU.set(0,0,0)[n]="-"===t?1:-1,zU.set(0,0,0)[o]="-"===i?-1:1,QU.lookAt(VU,GU.cross(zU),zU),e.setFromMatrix4(QU)}else e.identity();t._orientation=s}}_parsePercent(t){if("string"==typeof t){let e=t.match(/^(-?[\d.]+)%$/),r=e?parseFloat(e[1]):NaN;t=(isNaN(r)?0:r/100)*this.fontSize}return t}localPositionToTextCoords(t,r=new e.Vector2){r.copy(t);const n=this.curveRadius;return n&&(r.x=Math.atan2(t.x,Math.abs(n)-Math.abs(t.z))*Math.abs(n)),r}worldPositionToTextCoords(t,r=new e.Vector2){return GU.copy(t),this.localPositionToTextCoords(this.worldToLocal(GU),r)}raycast(t,e){const{textRenderInfo:r,curveRadius:n}=this;if(r){const i=r.blockBounds,o=n?YU():WU(),s=o.geometry,{position:a,uv:u}=s.attributes;for(let t=0;t<u.count;t++){let e=i[0]+u.getX(t)*(i[2]-i[0]);const r=i[1]+u.getY(t)*(i[3]-i[1]);let o=0;n&&(o=n-Math.cos(e/n)*n,e=Math.sin(e/n)*n),a.setXYZ(t,e,r,o)}s.boundingSphere=this.geometry.boundingSphere,s.boundingBox=this.geometry.boundingBox,o.matrixWorld=this.matrixWorld,o.material.side=this.material.side,jU.length=0,o.raycast(t,jU);for(let t=0;t<jU.length;t++)jU[t].object=this,e.push(jU[t])}}copy(t){const e=this.geometry;return super.copy(t),this.geometry=e,ZU.forEach((e=>{this[e]=t[e]})),this}clone(){return(new this.constructor).copy(this)}}KU.forEach((t=>{const e="_private_"+t;Object.defineProperty($U.prototype,t,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})})),new e.Box3,new e.Color;var tQ={altitude:0,height:0,interactive:!1};H.prototype._createSDFText=function(){return this.object3d=new $U,this.object3d.__parent=this,this};var eQ=function(){function t(e,r,i,o){var s;l(this,t),i=n.Util.extend({},tQ,i,{layer:o}),s=u(this,t);var a=i.altitude;s._initOptions(i),console.log(i,"fffffffff"),s._createSDFText(),s.getObject3d().text=i.text,s.getObject3d().fontSize=i.fontSize,s.getObject3d().color=i.color,s.getObject3d().letterSpacing=i.letterSpacing||0,s.getObject3d().textAlign="center",s.getObject3d().anchorX=i.anchorX||"center",s.getObject3d().anchorY=i.anchorY||"middle",s.getObject3d().renderOrder=i.renderOrder,s.getObject3d().material=r,s.getObject3d().font=i.fontfile;var h=o.distanceToVector3(a,a).x,c=o.coordinateToVector3(e,h);return s.getObject3d().position.copy(c),s}return v(t,H),f(t)}(),rQ=function(){return f((function t(e,r,n){var o=this;l(this,t),0!=e.length?(this.map=n.map,this.threeLayer=n,this.textWidth=r.textWidth||40,this.textHeight=r.textHeight||40,this.beginSizeZoom=r.beginSizeZoom||3,this.endSizeZoom=r.endSizeZoom||12,this.spanSizeZoom=this.endSizeZoom-this.beginSizeZoom,this.stepSize=1/(this.endSizeZoom-this.beginSizeZoom+1),this.textDx=r.textDx||0,this.textDy=r.textDy||0,this.anchorX=r.anchorX,this.anchorY=r.anchorY,this.minZoom=r.pointMinZoom||3,this.maxZoom=r.pointMaxZoom||20,this.fontSize=r.fontSize||.4,this.letterSpacing=r.letterSpacing||0,this.textField=r.textField,this.altitude=r.altitude,this.zoomChangeCallback=r.zoomChangeCallback,this.meshs=[],this.m=this.createBillboardMaterial(new i.MeshBasicMaterial),console.log(e,"77777777777777"),e.forEach((function(t){if(t[o.textField]){console.log(t);var e=new eQ([t.longitude,t.latitude],o.m,{minZoom:o.minZoom,maxZoom:o.maxZoom,text:t[o.textField],color:t.color||"#fff",renderOrder:r.pointOrder||5,fontSize:o.fontSize,letterSpacing:o.letterSpacing,altitude:o.altitude,anchorX:o.anchorX,anchorY:o.anchorY},n);e.zoomChange=function(){o.m.uniforms.cameraToCenterDistance.value=o.map.cameraToCenterDistance,o.m.uniforms.zoomScale.value=76.43702828517625/o.map.getResolution();var t=o._getRate();o.m.uniforms.size.value=[o.textWidth*t,o.textHeight*t],o.m.uniforms.xyOffset.value=[o.textDx*t,o.textDy*t],o.zoomChangeCallback&&o.zoomChangeCallback(e)},o.meshs.push(e)}})),this.dataItems=e,n.addMesh(this.meshs),this._bindMapEvents()):console.error("需要绘制的点位数量为0")}),[{key:"createBillboardMaterial",value:function(t,e){return HF(t,Object.assign({uniforms:{canvasSize:{value:[this.map.width,this.map.height]},cameraToCenterDistance:{type:"f",value:this.map.cameraToCenterDistance},zoomScale:{type:"f",value:76.43702828517625/this.map.getResolution()},size:{value:[this.textWidth*this._getRate(),this.textHeight*this._getRate()]},xyOffset:{value:[this.textDx*this._getRate(),this.textDy*this._getRate()]}},vertexDefs:"\n uniform vec2 canvasSize;\n uniform float cameraToCenterDistance;\n uniform float zoomScale;\n uniform vec2 size;\n uniform vec2 xyOffset;\n ",vertexMainOutro:"\n\n vec2 iconSize = vec2(24, 24);\n vec3 c = position;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);\n float k = gl_Position.w;\n float l = (1. - cameraToCenterDistance / k);\n float m = clamp(.5 + .5 * (1. - l), .0, 4.);\n vec2 A = position.xy;\n A = A * size;\n \n vec2 B = A * 2. / canvasSize;\n gl_Position.xy += B * m * k;\n\n //float C = k / cameraToCenterDistance;\n //vec2 B = A;\n //gl_Position = projectionMatrix * modelViewMatrix * vec4(vec3(B, .0) / zoomScale * C * m, 1.);\n\n\n gl_Position.xy += xyOffset * 2. / canvasSize * k;\n "},e))}},{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom;return(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize}},{key:"_bindMapEvents",value:function(){this.map.on("pitch",this._setSizeOn,this)}},{key:"_setSizeOn",value:function(){this.m.uniforms.cameraToCenterDistance.value=this.map.cameraToCenterDistance}},{key:"show",value:function(){this.meshs.forEach((function(t){t.show()}))}},{key:"hide",value:function(){this.meshs.forEach((function(t){t.hide()}))}},{key:"pointShowHideByCode",value:function(t,e,r){for(var i=1/0,o=1/0,s=-1/0,a=-1/0,u=0;u<this.dataItems.length;u++){var l=this.dataItems[u];t.includes(l.code)?(i=Math.min(i,this.dataItems[u].longitude),o=Math.min(o,this.dataItems[u].latitude),s=Math.max(s,this.dataItems[u].longitude),a=Math.max(a,this.dataItems[u].latitude),l.visibility=1):l.visibility=.1}this.updateByVisibility(),e&&this.map.fitExtent(new n.Extent(i,o,s,a),r||0)}},{key:"updateByVisibility",value:function(){var t=this;this.meshs.forEach((function(e,r){.1===t.dataItems[r].visibility?e.hide():e.show()}))}},{key:"dispose",value:function(){var t,e=this;this.meshs.forEach((function(t){e.threeLayer.removeMesh(t),t.object3d.dispose()})),null===(t=this.m)||void 0===t||t.dispose()}}],[{key:"preloadFont",value:function(t){return new Promise((function(t){!function({font:t,characters:e,sdfGlyphSize:r},n){MU({font:t,sdfGlyphSize:r,text:Array.isArray(e)?e.join("\n"):""+e},n)}({font:"/NotoSerifSC-Regular.otf"},(function(){t()}))}))}}])}(),nQ="__webglFramebuffer",iQ=new i.Vector4,oQ={bloom:!0},sQ=1*i.REVISION>154?Math.PI:1;function aQ(t,e){if(t){t.layers&&t.layers.set(e);var r=t.children;if(r&&r.length)for(var n=0,i=r.length;n<i;n++)aQ(r[n],e)}}ko.prototype.renderScene=function(t){if(this.layer._callbackBaseObjectAnimation(),this._syncCamera(),t&&t.renderTarget){var e=t.renderTarget.fbo,r=e.width,n=e.height;this._renderTarget?(this._renderTarget.viewport.set(0,0,r,n),this._renderTarget.scissor.set(0,0,r,n)):(this._renderTarget=new i.WebGLRenderTarget(r,n,{depthBuffer:!1}),this.context.setRenderTarget(this._renderTarget),this.context.render(this.scene,this.camera));var o=this.context.properties.get(this._renderTarget),s=o[nQ];o[nQ]=t.renderTarget.getFramebuffer(t.renderTarget.fbo),this.context.setRenderTarget(this._renderTarget);var a=1===t.bloom&&t.sceneFilter,u=this.scene.children||[],l=!1;if(a){var h=t.sceneFilter;l=h(oQ);for(var c=0,f=u.length;c<f;c++)if(u[c]&&u[c].layers){var p=u[c].__parent;u[c].bloom=!1,p&&(u[c].bloom=p.bloom);var d=0;(u[c]&&h(u[c])||!p)&&l&&(d=1),u[c].__layer!==d&&(aQ(u[c],d),u[c].__layer=d)}}else for(var g=0,y=u.length;g<y;g++)u[g]&&u[g].layers&&0!==u[g].__layer&&(aQ(u[g],0),u[g].__layer=0);this.camera.layers.set(l?1:0),this.context.render(this.scene,this.camera),o[nQ]=s}else{var v=this.canvas,m=v.width,A=v.height,_=this.context.getViewport(iQ);_.width===m&&_.height===A||this.context.setViewport(0,0,m,A),this.context.render(this.scene,this.camera),this.layer.updateComposer()}this.context.setRenderTarget(null),this.completeRender()},Bo.prototype.initEnvironment=function(t){var e=this.getScene(),r=(new RF).load(t,(function(){r.mapping=i.EquirectangularReflectionMapping,e.environment=r}))},Bo.prototype.initBloom=function(){var t=this.getThreeRenderer(),e=this.getScene(),r=this.getCamera();this.composer=new ON(t,{frameBufferType:i.HalfFloatType}),this.composer.addPass(new mF(e,r))},Bo.prototype.delComposer=function(){var t;null===(t=this.composer)||void 0===t||t.dispose()},Bo.prototype.updateComposer=function(){var t;null===(t=this.composer)||void 0===t||t.render()},Bo.prototype.getComposer=function(){return this.composer},Bo.prototype._recursionMesh=function(t){for(;t&&t.parent!==this.getScene()&&!t.parent.customType;)t=t.parent;return t},Bo.prototype.identify=function(t,e){var r=this;if(!t)return console.error("coordinate is null,it should be Coordinate"),[];if(Array.isArray(t)&&(t=new n.Coordinate(t)),!(t instanceof n.Coordinate))return console.error("coordinate type is error,it should be Coordinate"),[];var o=this.getMap().coordToContainerPoint(t);this._containerPoint=o;var s=o.x,a=o.y;this._initRaycaster(),this.fire("identify",{coordinate:t,options:e});var u=this._raycaster,l=this._mouse,h=this.getCamera(),c=this.getScene(),f=this.getMap().getSize();if(!c)return[];var p=f.width,d=f.height;l.x=s/p*2-1,l.y=-a/d*2+1,u.setFromCamera(l,h),u.layers&&u.layers.enableAll&&u.layers.enableAll(),function(t,e){t.linePrecision=e}(u,this._getLinePrecision(this.getMap().getResolution()));var g=[],y=[];c.children.forEach((function(t){var e=t.__parent;if(e&&e.getOptions){var r=e;r.getOptions().interactive&&r.isVisible()&&(r.identify&&n.Util.isFunction(r.identify)?y.push(r):g.push(t))}else(t instanceof i.Mesh||t instanceof i.Group)&&t.customType&&t.children.forEach((function(t){var e=t.__parent;if(e&&e.getOptions){var r=e;r.getOptions().interactive&&r.isVisible()&&(r.identify&&n.Util.isFunction(r.identify)?y.push(r):g.push(t))}}))}));var v=[],m=u.intersectObjects(g,!0);m&&Array.isArray(m)&&m.length&&(v=m.map((function(t){var e=t.object,i=t.instanceId,o=(e=r._recursionMesh(e)||{}).__parent||e;return o.faceIndex=t.faceIndex,o.index=t.index,o.intersect=t,n.Util.isNumber(i)&&(o.instanceId=i),o}))),this.renderPickScene(),y.length&&y.forEach((function(e){e.identify(t)&&v.push(e)}));for(var A=v.length,_=0;_<A;_++)if(v[_])for(var x=_+1;x<A;x++)v[_]===v[x]&&v.splice(x,1);var w=(e=n.Util.extend({},e)).count;return v.sort((function(t,e){return e.object3d.renderOrder-t.object3d.renderOrder})),n.Util.isNumber(w)&&w>0?v.slice(0,w):v},Bo.prototype._zoomend=function(){var t=this.getScene();if(t){var e=this.getMap().getZoom();t.children.forEach((function(t){if(t.customType)t.children.forEach((function(t){var r=t.__parent;if(r&&r.getOptions){var i=r;i.zoomChange&&n.Util.isFunction(i.zoomChange)&&i.zoomChange(e);var o=i.getMinZoom(),s=i.getMaxZoom();e<o||e>s?(i.isVisible()&&(i.getObject3d().visible=!1),i._zoomVisible=!1):o<=e&&e<=s&&(i._visible&&(i.getObject3d().visible=!0),i._zoomVisible=!0)}}));else{var r=t.__parent;if(r&&r.getOptions){var i=r;i.zoomChange&&n.Util.isFunction(i.zoomChange)&&i.zoomChange(e);var o=i.getMinZoom(),s=i.getMaxZoom();e<o||e>s?(i.isVisible()&&(i.getObject3d().visible=!1),i._zoomVisible=!1):o<=e&&e<=s&&(i._visible&&(i.getObject3d().visible=!0),i._zoomVisible=!0)}}}))}},Bo.prototype.addMesh1=function(t,e){var r=this,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)return this;Array.isArray(t)||(t=[t]);var i=this.getScene(),o=void 0;if(e&&(o=i.getObjectByProperty("customId",e)),t.forEach((function(t){if(t instanceof H){var e;if(o)o.add(t.getObject3d());else console.log("组不存在,销毁创建的对象"),null===(e=t.parent)||void 0===e||e.dispose();t.isAdd||(t.isAdd=!0,t.options.layer=r,t._fire("add",{target:t}))}})),this._zoomend(),n){var s=this._getRenderer();s&&s.setToRedraw()}return this},Bo.prototype.removeMesh1=function(t,e){var r=this,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)return this;Array.isArray(t)||(t=[t]);var s=this.getScene(),a=s.getObjectByProperty("customId",e);if(t.forEach((function(t){if(t instanceof H){a?a.remove(t.getObject3d()):s.remove(t.getObject3d()),t.isAdd&&(t.isAdd=!1,t._fire("remove",{target:t})),t._animation&&n.Util.isFunction(t._animation)&&delete r._animationBaseObjectMap[t.getObject3d().uuid];var e=r._delayMeshes;if(e.length)for(var o=0,u=e.length;o<u;o++)if(e[o]===t){e.splice(o,1);break}}else t instanceof i.Object3D&&s.remove(t)})),o){var u=this._getRenderer();u&&u.setToRedraw()}return this};var uQ=function(){return f((function t(e,r,n){var o=this;l(this,t),this.map=r,this.animationId=null,this.updatables=[];var s=YC();this.threeLayer=new Bo(s,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new i.Clock;var a=function(){o.threeLayer._needsUpdate=!o.threeLayer._needsUpdate,o.threeLayer._needsUpdate&&o.threeLayer.redraw();var t,e=o.clock.getDelta(),r=p(o.updatables);try{for(r.s();!(t=r.n()).done;){t.value.tick(e)}}catch(t){r.e(t)}finally{r.f()}o.statsFlag&&o.stats.update(),o.animationId=requestAnimationFrame(a)};this.threeLayer.prepareToDraw=function(t,e,r){var n=new i.DirectionalLight(16777215);n.position.set(0,-10,10).normalize(),e.add(n),a()},null!=n&&n.groupLayer?this.threeLayer.addTo(n.groupLayer):this.threeLayer.addTo(r),this.groupLayer=null==n?void 0:n.groupLayer,this.layerId=s,this.layerName=e,this.dirty=!1,this.initFlag=!1,this.bloomFlag=(null==n?void 0:n.bloomFlag)||!1,this.bloomStrength=null==n?void 0:n.bloomStrength,this.bloomThreshold=null==n?void 0:n.bloomThreshold,this.bloomRadius=null==n?void 0:n.bloomRadius,this.hdrPath=null==n?void 0:n.hdrPath,this.ambientLightIntensity=(null==n?void 0:n.ambientLightIntensity)||1,this.stats=new TF,this.stats.dom.style.display="none",document.body.appendChild(this.stats.dom),this.statsFlag=!1}),[{key:"createGroup",value:(t=a(x().mark((function t(e){return x().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.threeLayer.getScene()){t.next=4;break}return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 4:if(!0!==this.initFlag){t.next=10;break}return t.next=7,XC(200);case 7:case 13:return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 10:return this.initFlag=!0,t.next=13,this.prepareToDraw();case 14:case"end":return t.stop()}}),t,this)}))),function(e){return t.apply(this,arguments)})},{key:"removeGroup",value:function(t){if(this.threeLayer.getScene()){var e=this.threeLayer.getScene().getObjectByName(t);this.threeLayer.getScene().remove(e)}}},{key:"getIdByName",value:function(t,e){var r=t.getObjectByName(e);return r||(r=new vD(t,e)),r.customId}},{key:"setGroupVisible",value:function(t,e){this.threeLayer.getScene().getObjectByProperty("customId",t).visible=e}},{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=YC();this.threeLayer.setId(t),this.layerId=t}}},{key:"setVisible",value:function(t,e){this.threeLayer&&(!0===t?(this.threeLayer.show(),e&&e()):(this.threeLayer.hide(),e&&e()))}},{key:"prepareToDraw",value:function(){var t=this,e=function(){t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate&&t.threeLayer.redraw();var r,n=t.clock.getDelta(),i=p(t.updatables);try{for(i.s();!(r=i.n()).done;){r.value.tick(n)}}catch(t){i.e(t)}finally{i.f()}t.statsFlag&&t.stats.update(),t.animationId=requestAnimationFrame(e)};return new Promise((function(r){var n=t;t.threeLayer.prepareToDraw=function(t,o,s){n.hdrPath&&this.initEnvironment(n.hdrPath);var a=new i.DirectionalLight(16777215,1*sQ);a.position.set(0,-10,10).normalize(),o.add(a),o.add(new i.AmbientLight(16777215,n.ambientLightIntensity*sQ)),e(),this.initBloom(),r()}}))}},{key:"drawRadar",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new _S(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new _S(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawRadar1",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new xS(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new xS(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawRadar2",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new wS(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new wS(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawRadar3",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new bS(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new bS(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSector",value:function(t,e,r,n){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new CS(t,e,r||{},i.threeLayer,n);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new CS(t,e,r||{},i.threeLayer,n);o(s)}))}))}},{key:"drawRing",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new NF(t,e,r,n||{},o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new NF(t,e,r,n||{},o.threeLayer,i);s(a)}))}))}},{key:"drawSectorImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new TS(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new TS(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawImage",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new vS(t,e,r,n,o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new vS(t,e,r,n,o.threeLayer,i);s(a)}))}))}},{key:"drawShock",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new shockEffect(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new shockEffect(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPoybyHeight",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new LF(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new LF(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawSdfText",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=null;t.length>0?o=new rQ(t,e,n.threeLayer,r):i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=null;t.length>0?o=new rQ(t,e,n.threeLayer,r):i(o)}))}))}},{key:"drawPlaneMarker",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=null;t.length>0?(o=new KS(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=null;t.length>0?(o=new KS(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}))}))}},{key:"draw3dtiles",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new pD(t,e,r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new pD(t,e,r.threeLayer,r);n(i)}))}))}},{key:"createGltfLoadTool",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new yD(t,e.threeLayer);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new yD(t,e.threeLayer);r(n)}))}))}},{key:"drawFbxModel",value:function(t,e,r,n){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new yO(t,e,r,i.threeLayer,n);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new yO(t,e,r,i.threeLayer,n);o(s)}))}))}},{key:"drawRippleWall",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new AO(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new AO(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawWall",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new _O(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new _O(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawRippleWallImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new xO(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new xO(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawBloomLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new EN(t,e,n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new EN(t,e,n.threeLayer,r);i(o)}))}))}},{key:"createBloomClass",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new MF(e.threeLayer,t);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new MF(e.threeLayer,t);r(n)}))}))}},{key:"createOutlineBloom",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new BF(e.threeLayer,t);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new BF(e.threeLayer,t);r(n)}))}))}},{key:"drawPolyline",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new IO(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new IO(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawPolygon",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new vN(t,e,n.threeLayer,r);o.generatePolygon().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new vN(t,e,n.threeLayer,r);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawExtrudePolygon",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new _N(t,e,n.threeLayer,r);o.generatePolygon().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new _N(t,e,n.threeLayer,r);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawLinePlane",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new MO(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new MO(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawVerticalFatLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new KO(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new KO(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawTube",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new nN(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new nN(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPlaneGif",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new tN(t,e,r,n||{},o.threeLayer,o,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new tN(t,e,r,n||{},o.threeLayer,o,i);s(a)}))}))}},{key:"drawTripHeight",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new uN(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new uN(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawTripHeight1",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new lN(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new lN(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawTripLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new hN(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new hN(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawTripLine1",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new cN(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new cN(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawArrow2D",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new bN(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new bN(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"setStateFlag",value:function(){this.statsFlag=!this.statsFlag,this.statsFlag?this.stats.dom.style.display="":this.stats.dom.style.display="none"}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var t=this.threeLayer.getMeshes();this.threeLayer.delComposer(),this.threeLayer.clear(),t.forEach((function(t){}));var e=this.threeLayer.getCamera(),r=this.threeLayer.getScene(),n=this.threeLayer.getPick(),i=n.pickingTexture;n.pickingScene;var o=this.threeLayer.getRenderer();r.remove(e),e=null,r=null,i.dispose(),i=null,this.groupLayer?this.groupLayer.removeLayer(this.threeLayer):(o.context.dispose(),o.context.forceContextLoss(),o.context=null,o.remove(),o=null,this.map.removeLayer(this.threeLayer))}}]);var t}(),lQ=function(){return f((function t(e,r){var n=this;l(this,t),this.map=r,this.animationId=null,this.updatables=[];var o=YC();this.threeLayer=new Bo(o,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new i.Clock;var s=function(){var t;(n.threeLayer._needsUpdate=!n.threeLayer._needsUpdate,n.threeLayer._needsUpdate)&&(null===(t=n.threeLayer)||void 0===t||null===(t=t.getRenderer())||void 0===t||t.clearCanvas(),n.threeLayer.renderScene());var e,r=n.clock.getDelta(),i=p(n.updatables);try{for(i.s();!(e=i.n()).done;){e.value.tick(r)}}catch(t){i.e(t)}finally{i.f()}n.animationId=requestAnimationFrame(s)};this.threeLayer.prepareToDraw=function(t,e,r){var n=new i.DirectionalLight(16777215);n.position.set(0,-10,10).normalize(),e.add(n),s()},this.threeLayer.addTo(r),this.layerId=o,this.layerName=e,this.dirty=!1,this.initFlag=!1}),[{key:"createGroup",value:(t=a(x().mark((function t(e){return x().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.threeLayer.getScene()){t.next=4;break}return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 4:if(!0!==this.initFlag){t.next=10;break}return t.next=7,XC(200);case 7:case 13:return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 10:return this.initFlag=!0,t.next=13,this.prepareToDraw();case 14:case"end":return t.stop()}}),t,this)}))),function(e){return t.apply(this,arguments)})},{key:"removeGroup",value:function(t){if(this.threeLayer.getScene()){var e=this.threeLayer.getScene().getObjectByName(t);this.threeLayer.getScene().remove(e)}}},{key:"getIdByName",value:function(t,e){var r=t.getObjectByName(e);return r||(r=new vD(t,e)),r.customId}},{key:"setGroupVisible",value:function(t,e){this.threeLayer.getScene().getObjectByProperty("customId",t).visible=e}},{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=YC();this.threeLayer.setId(t),this.layerId=t}}},{key:"setVisible",value:function(t,e){this.threeLayer&&(!0===t?(this.threeLayer.show(),e&&e()):(this.threeLayer.hide(),e&&e()))}},{key:"prepareToDraw",value:function(){var t=this,e=function(){var r;(t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate)&&(null===(r=t.threeLayer)||void 0===r||null===(r=r.getRenderer())||void 0===r||r.clearCanvas(),t.threeLayer.renderScene());var n,i=t.clock.getDelta(),o=p(t.updatables);try{for(o.s();!(n=o.n()).done;){n.value.tick(i)}}catch(t){o.e(t)}finally{o.f()}t.animationId=requestAnimationFrame(e)};return new Promise((function(r){t.threeLayer.prepareToDraw=function(t,n,o){var s=new i.DirectionalLight(16777215);s.position.set(0,-10,10).normalize(),n.add(s),n.add(new i.AmbientLight(16777215)),e(),r()}}))}},{key:"drawRadar",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new _S(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new _S(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSector",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new CS(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new CS(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSectorImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new TS(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new TS(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawImage",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new vS(t,e,r,n,o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new vS(t,e,r,n,o.threeLayer,i);s(a)}))}))}},{key:"drawShock",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new LS(t,e||{},r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new LS(t,e||{},r.threeLayer,r);n(i)}))}))}},{key:"drawPlaneMarker",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=null;t.length>0?(o=new KS(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=null;t.length>0?(o=new KS(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}))}))}},{key:"draw3dtiles",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new pD(t,e,r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new pD(t,e,r.threeLayer,r);n(i)}))}))}},{key:"createGltfLoadTool",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new yD(t,e.threeLayer);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new yD(t,e.threeLayer);r(n)}))}))}},{key:"drawFbxModel",value:function(t,e,r,n){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new yO(t,e,r,i.threeLayer,n);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new yO(t,e,r,i.threeLayer,n);o(s)}))}))}},{key:"drawRippleWall",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new AO(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new AO(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawRippleWallImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new xO(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new xO(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawPolyline",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new IO(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new IO(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawPolygon",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new vN(t,e,n.threeLayer,r);o.generatePolygon().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new vN(t,e,n.threeLayer,r);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawLinePlane",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new MO(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new MO(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawVerticalFatLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new KO(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new KO(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawTube",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new nN(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new nN(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPlaneGif",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new tN(t,e,r,n||{},o.threeLayer,o,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new tN(t,e,r,n||{},o.threeLayer,o,i);s(a)}))}))}},{key:"drawTripHeight",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new uN(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new uN(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawTripLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new hN(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new hN(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawArrow2D",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new bN(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new bN(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var t=this.threeLayer.getMeshes();this.threeLayer.clear(),t.forEach((function(t){}));var e=this.threeLayer.getCamera(),r=this.threeLayer.getScene(),n=this.threeLayer.getPick(),i=n.pickingTexture;n.pickingScene;var o=this.threeLayer.getRenderer();r.remove(e),e=null,r=null,i.dispose(),i=null,o.context.dispose(),o.context.forceContextLoss(),o.context=null,o.remove(),o=null,this.map.removeLayer(this.threeLayer)}}]);var t}(),hQ=function(){return f((function t(e,r,i,o){l(this,t),this.map=o,this.geometry=null,this.selectGeometry=null,this.isEndSelect=!1,this.drawTool=new n.DrawTool({mode:e,symbol:{lineColor:i.lineColor||"#E40D56",lineWidth:2,lineDasharray:[5,5],polygonFill:i.polygonFill||"#E40D56",polygonOpacity:.2}}).addTo(this.map).enable(),this._bindEvent(),this._drawEnd=r,this.mode=e,this.toolLayer=new n.VectorLayer(n.Util.GUID(),{geometryEvents:!1,hitDetect:!1}).addTo(this.map),this.geometry&&(this.toolLayer.addGeometry(this.geometry),this._drawEnd&&("Circle"===this.mode?this._drawEnd(this.geometry.getCoordinates(),this.geometry.getRadius()):this._drawEnd(this.geometry.getCoordinates()))),i.zIndex&&this.toolLayer.setZIndex(i.zIndex),this.type="drawTool"}),[{key:"getZIndex",value:function(){this.toolLayer&&this.toolLayer.getZIndex()}},{key:"setZIndex",value:function(t){this.toolLayer&&this.toolLayer.setZIndex(t)}},{key:"selectGeometryByPoint",value:function(){this.map.on("click",this._selectGeometry,this)}},{key:"endSelect",value:function(){this.toolLayer&&this.selectGeometry&&(this._changeSymbol(!1),this.selectGeometry.endEdit(),this.selectGeometry=null),this.map.off("click",this._selectGeometry,this)}},{key:"_selectGeometry",value:function(t){if(this.disableTool(),this.toolLayer){var e=this.toolLayer.identify(t.coordinate);this.selectGeometry&&(this.selectGeometry.endEdit(),this._changeSymbol(!1)),e&&(this.selectGeometry=e[0]),this.selectGeometry&&this._changeSymbol(!0)}}},{key:"_closeMapEvent",value:function(){this.map.off("click",this._selectGeometry,this)}},{key:"_changeSymbol",value:function(t){t?this.selectGeometry.setSymbol({lineColor:"#00ffff",lineWidth:2,lineDasharray:[5,5],polygonFill:"#00ffff",polygonOpacity:.2}):this.selectGeometry.setSymbol({lineColor:"#E40D56",lineWidth:2,lineDasharray:[5,5],polygonFill:"#E40D56",polygonOpacity:.2})}},{key:"deleteGeometry",value:function(){this.toolLayer&&this.selectGeometry&&(this.selectGeometry.endEdit(),this.toolLayer.removeGeometry(this.selectGeometry))}},{key:"undoDrawGeometry",value:function(){if(this.toolLayer){var t=this.toolLayer.getGeometries();if(t.length<1)return;this.toolLayer.removeGeometry(t[t.length-1])}}},{key:"_bindEvent",value:function(){this.drawTool.on("drawend",this.drawEnd,this)}},{key:"_closeEvent",value:function(){this.drawTool.off("drawend",this.drawEnd,this)}},{key:"drawEnd",value:function(t){this.toolLayer&&this.toolLayer.addGeometry(t.geometry),this._drawEnd&&("Circle"===this.mode?this._drawEnd(t.geometry.getCoordinates(),t.geometry.getRadius()):this._drawEnd(t.geometry.getCoordinates())),this.geometry=t.geometry}},{key:"disableTool",value:function(){this.drawTool.disable()}},{key:"clearGeometry",value:function(){this.toolLayer&&this.toolLayer.clear()}},{key:"setMode",value:function(t,e){this._drawEnd&&delete this._drawEnd,this._drawEnd=e,this.drawTool.setMode(t).enable(),this.mode=t}},{key:"startEdit",value:function(){this.disableTool(),this.selectGeometry&&this.selectGeometry.startEdit()}},{key:"endEdit",value:function(t){this.selectGeometry&&(this.selectGeometry.endEdit(),t&&("Circle"===this.mode?t(this.selectGeometry.getCoordinates(),this.geometry.getRadius()):t(this.selectGeometry.getCoordinates())))}},{key:"dispose",value:function(){this.drawTool&&(this._closeEvent(),this.endEdit(),this.disableTool(),delete this.drawTool),this._drawEnd&&delete this._drawEnd,this.geometry&&delete this.geometry,this.selectGeometry&&delete this.selectGeometry,this.map&&this._closeMapEvent(),this.map.removeLayer(this.toolLayer),delete this.toolLayer}}])}();function cQ(){this.PI=3.141592653589793,this.x_PI=52.35987755982988,this.a=6378245,this.ee=.006693421622965943,this.EARTHRADIUS=6370996.81,this.MCBAND=[12890594.86,8362377.87,5591021,3481989.83,1678043.12,0],this.LLBAND=[75,60,45,30,15,0],this.MC2LL=[[1.410526172116255e-8,898305509648872e-20,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,17337981.2],[-7.435856389565537e-9,8983055097726239e-21,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,10260144.86],[-3.030883460898826e-8,898305509983578e-20,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,6856817.37],[-1.981981304930552e-8,8983055099779535e-21,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,4482777.06],[3.09191371068437e-9,8983055096812155e-21,6995724062e-14,23.10934304144901,-.00023663490511,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,2555164.4],[2.890871144776878e-9,8983055095805407e-21,-3.068298e-8,7.47137025468032,-353937994e-14,-.02145144861037,-1234426596e-14,.00010322952773,-323890364e-14,826088.5]],this.LL2MC=[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[.0008277824516172526,111320.7020463578,647795574.6671607,-4082003173.641316,10774905663.51142,-15171875531.51559,12053065338.62167,-5124939663.577472,913311935.9512032,67.5],[.00337398766765,111320.7020202162,4481351.045890365,-23393751.19931662,79682215.47186455,-115964993.2797253,97236711.15602145,-43661946.33752821,8477230.501135234,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837.749470245,992013.7397791013,-1221952.21711287,1340652.697009075,-620943.6990984312,144416.9293806241,37.5],[-.0003441963504368392,111320.7020576856,278.2353980772752,2485758.690035394,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,22.5],[-.0003218135878613132,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]],this._transformlat=function(t,e){var r=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,r+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,r+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3},this._transformlng=function(t,e){var r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,r+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,r+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3},this._out_of_china=function(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271||!1},this._getLoop=function(t,e,r){for(;t>r;)t-=r-e;for(;t<e;)t+=r-e;return t},this._getRange=function(t,e,r){return null!=e&&(t=Math.max(t,e)),null!=r&&(t=Math.min(t,r)),t}}cQ.prototype.BD2GCJ=function(t,e){var r=t-.0065,n=e-.006,i=Math.sqrt(r*r+n*n)-2e-5*Math.sin(n*this.x_PI),o=Math.atan2(n,r)-3e-6*Math.cos(r*this.x_PI);return[i*Math.cos(o),i*Math.sin(o)]},cQ.prototype.GCJ2BD=function(t,e){var r=Math.sqrt(t*t+e*e)+2e-5*Math.sin(e*this.x_PI),n=Math.atan2(e,t)+3e-6*Math.cos(t*this.x_PI);return[r*Math.cos(n)+.0065,r*Math.sin(n)+.006]},cQ.prototype.WGS2GCJ=function(t,e){if(this._out_of_china(t,e))return[t,e];var r=this._transformlat(t-105,e-35),n=this._transformlng(t-105,e-35),i=e/180*this.PI,o=Math.sin(i);o=1-this.ee*o*o;var s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.PI),[t+(n=180*n/(this.a/s*Math.cos(i)*this.PI)),e+r]},cQ.prototype.GCJ2WGS=function(t,e){if(this._out_of_china(t,e))return[t,e];var r=this._transformlat(t-105,e-35),n=this._transformlng(t-105,e-35),i=e/180*this.PI,o=Math.sin(i);o=1-this.ee*o*o;var s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.PI),[2*t-(t+(n=180*n/(this.a/s*Math.cos(i)*this.PI))),2*e-(e+r)]},cQ.prototype.WGS2BD=function(t,e){var r=this.WGS2GCJ(t,e);return r=this.GCJ2BD(r[0],r[1])},cQ.prototype.BD2WGS=function(t,e){var r=this.BD2GCJ(t,e);return r=this.GCJ2WGS(r[0],r[1])},cQ.prototype.BD_MKT2WGS=function(t,e){var r=null;t=Math.abs(t),e=Math.abs(e);for(var n=0;n<this.MCBAND.length;n++)if(e>=this.MCBAND[n]){r=this.MC2LL[n];break}t=r[0]+r[1]*Math.abs(t);var i=Math.abs(e)/r[9];return e=r[2]+r[3]*i+r[4]*i*i+r[5]*i*i*i+r[6]*i*i*i*i+r[7]*i*i*i*i*i+r[8]*i*i*i*i*i*i,[t*=t<0?-1:1,e*=e<0?-1:1]},cQ.prototype.BD_WGS2MKT=function(t,e){var r=null;t=this._getLoop(t,-180,180),e=this._getRange(e,-74,74);for(var n=0;n<this.LLBAND.length;n++)if(e>=this.LLBAND[n]){r=this.LL2MC[n];break}if(null!=r)for(n=this.LLBAND.length-1;n>=0;n--)if(e<=-this.LLBAND[n]){r=this.LL2MC[n];break}t=r[0]+r[1]*Math.abs(t);var i=Math.abs(e)/r[9];return e=r[2]+r[3]*i+r[4]*i*i+r[5]*i*i*i+r[6]*i*i*i*i+r[7]*i*i*i*i*i+r[8]*i*i*i*i*i*i,[t*=t<0?-1:1,e*=e<0?-1:1]};var fQ=function(){return f((function t(e,r,i){l(this,t),this.map=r,this.overlayer=new n.VectorLayer("overLayer",{geometryEvents:!1,hitDetect:!1,forceRenderOnMoving:!0,forceRenderOnRotating:!0,enableSimplify:!1}),this.overlayer.addTo(this.map);var o=new n.MultiPolygon(e,{symbol:{polygonFill:i.color||"#000",polygonOpacity:i.opacity||1,lineWidth:0}});this.overlayer.addGeometry(o)}),[{key:"dispose",value:function(){this.map.removeLayer(this.overlayer),delete this.toolLayer}}])}();
189
+ */const hU=oU({name:"FontResolver",dependencies:[function(t,e){const r=Object.create(null),n=Object.create(null);function i(e,i){let o=r[e];o?i(o):n[e]?n[e].push(i):(n[e]=[i],function(e,r){const n=t=>{console.error(`Failure loading font ${e}`,t)};try{const i=new XMLHttpRequest;i.open("get",e,!0),i.responseType="arraybuffer",i.onload=function(){if(i.status>=400)n(new Error(i.statusText));else if(i.status>0)try{const n=t(i.response);n.src=e,r(n)}catch(t){n(t)}},i.onerror=n,i.send()}catch(t){n(t)}}(e,(t=>{t.src=e,r[e]=t,n[e].forEach((e=>e(t))),delete n[e]})))}return function(t,n,{lang:o,fonts:s=[],style:a="normal",weight:u="normal",unicodeFontsURL:l}={}){const h=new Uint8Array(t.length),c=[];t.length||g();const f=new Map,p=[];if("italic"!==a&&(a="normal"),"number"!=typeof u&&(u="bold"===u?700:400),s&&!Array.isArray(s)&&(s=[s]),(s=s.slice().filter((t=>!t.lang||t.lang.test(o))).reverse()).length){const e=1,n=2;let o=0;!function a(u=0){for(let l=u,d=t.length;l<d;l++){const u=t.codePointAt(l);if(o===e&&c[h[l-1]].supportsCodePoint(u)||l>0&&/\s/.test(t[l]))h[l]=h[l-1],o===n&&(p[p.length-1][1]=l);else for(let t=h[l],d=s.length;t<=d;t++)if(t===d){(o===n?p[p.length-1]:p[p.length]=[l,l])[1]=l,o=n}else{h[l]=t;const{src:n,unicodeRange:p}=s[t];if(!p||y(u,p)){const t=r[n];if(!t)return void i(n,(()=>{a(l)}));if(t.supportsCodePoint(u)){let r=f.get(t);"number"!=typeof r&&(r=c.length,c.push(t),f.set(t,r)),h[l]=r,o=e;break}}}u>65535&&l+1<d&&(h[l+1]=h[l],l++,o===n&&(p[p.length-1][1]=l))}d()}()}else p.push([0,t.length-1]),d();function d(){if(p.length){const r=p.map((e=>t.substring(e[0],e[1]+1))).join("\n");e.getFontsForString(r,{lang:o||void 0,style:a,weight:u,dataUrl:l}).then((({fontUrls:t,chars:e})=>{const r=c.length;let n=0;p.forEach((t=>{for(let i=0,o=t[1]-t[0];i<=o;i++)h[t[0]+i]=e[n++]+r;n++}));let o=0;t.forEach(((e,n)=>{i(e,(e=>{c[n+r]=e,++o===t.length&&g()}))}))}))}else g()}function g(){n({chars:h,fonts:c})}function y(t,e){for(let r=0;r<e.length;r++){const[n,i=n]=e[r];if(n<=t&&t<=i)return!0}return!1}}},lU,function(){return function(t){var e=function(){this.buckets=new Map};e.prototype.add=function(t){var e=t>>5;this.buckets.set(e,(this.buckets.get(e)||0)|1<<(31&t))},e.prototype.has=function(t){var e=this.buckets.get(t>>5);return void 0!==e&&!!(e&1<<(31&t))},e.prototype.serialize=function(){var t=[];return this.buckets.forEach((function(e,r){t.push((+r).toString(36)+":"+e.toString(36))})),t.join(",")},e.prototype.deserialize=function(t){var e=this;this.buckets.clear(),t.split(",").forEach((function(t){var r=t.split(":");e.buckets.set(parseInt(r[0],36),parseInt(r[1],36))}))};var r=Math.pow(2,8),n=r-1,i=~n;function o(t){var e=function(t){return t&i}(t).toString(16),n=function(t){return(t&i)+r-1}(t).toString(16);return"codepoint-index/plane"+(t>>16)+"/"+e+"-"+n+".json"}function s(t,e){var r=t&n,i=e.codePointAt(r/6|0);return!!((i=(i||48)-48)&1<<r%6)}function a(t,e){!function(t,e){var r;(r=t,r.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map((function(t){return t.split("-").map((function(t){return parseInt(t.trim(),16)}))}))).forEach((function(t){var r=t[0],n=t[1];void 0===n&&(n=r),e(r,n)}))}(t,(function(t,r){for(var n=t;n<=r;n++)e(n)}))}var u={},l={},h=new WeakMap,c="https://cdn.jsdelivr.net/gh/lojjic/unicode-font-resolver@v1.0.1/packages/data";function f(t){var r=h.get(t);return r||(r=new e,a(t.ranges,(function(t){return r.add(t)})),h.set(t,r)),r}var p,d=new Map;function g(t,e,r){return t[e]?e:t[r]?r:function(t){for(var e in t)return e}(t)}function y(t,e){var r=e;if(!t.includes(r)){r=1/0;for(var n=0;n<t.length;n++)Math.abs(t[n]-e)<Math.abs(r-e)&&(r=t[n])}return r}function v(t){return p||(p=new Set,a("9-D,20,85,A0,1680,2000-200A,2028-202F,205F,3000",(function(t){p.add(t)}))),p.has(t)}return t.CodePointSet=e,t.clearCache=function(){u={},l={}},t.getFontsForString=function(t,e){void 0===e&&(e={});var r,n=e.lang;void 0===n&&(n=/\p{Script=Hangul}/u.test(r=t)?"ko":/\p{Script=Hiragana}|\p{Script=Katakana}/u.test(r)?"ja":"en");var i=e.category;void 0===i&&(i="sans-serif");var a=e.style;void 0===a&&(a="normal");var h=e.weight;void 0===h&&(h=400);var p=(e.dataUrl||c).replace(/\/$/g,""),m=new Map,A=new Uint8Array(t.length),_={},x={},w=new Array(t.length),b=new Map,E=!1;function I(t){var e=d.get(t);return e||(e=fetch(p+"/"+t).then((function(t){if(!t.ok)throw new Error(t.statusText);return t.json().then((function(t){if(!Array.isArray(t)||1!==t[0])throw new Error("Incorrect schema version; need 1, got "+t[0]);return t[1]}))})).catch((function(e){if(p!==c)return E||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+p+'", trying default CDN. '+e.message),E=!0),p=c,d.delete(t),I(t);throw e})),d.set(t,e)),e}for(var C=function(e){var r=t.codePointAt(e),n=o(r);w[e]=n,u[n]||b.has(n)||b.set(n,I(n).then((function(t){u[n]=t}))),r>65535&&(e++,S=e)},S=0;S<t.length;S++)C(S);return Promise.all(b.values()).then((function(){b.clear();for(var e=function(e){var i=t.codePointAt(e),o=null,a=u[w[e]],h=void 0;for(var c in a){var f=x[c];if(void 0===f&&(f=x[c]=new RegExp(c).test(n||"en")),f){for(var p in h=c,a[c])if(s(i,a[c][p])){o=p;break}break}}if(!o)t:for(var d in a)if(d!==h)for(var g in a[d])if(s(i,a[d][g])){o=g;break t}o||(console.debug("No font coverage for U+"+i.toString(16)),o="latin"),w[e]=o,l[o]||b.has(o)||b.set(o,I("font-meta/"+o+".json").then((function(t){l[o]=t}))),i>65535&&(e++,r=e)},r=0;r<t.length;r++)e(r);return Promise.all(b.values())})).then((function(){for(var e,r=null,n=0;n<t.length;n++){var o=t.codePointAt(n);if(r&&(v(o)||f(r).has(o)))A[n]=A[n-1];else{r=l[w[n]];var s=_[r.id];if(!s){var u=r.typeforms,c=g(u,i,"sans-serif"),d=g(u[c],a,"normal"),x=y(null===(e=u[c])||void 0===e?void 0:e[d],h);s=_[r.id]=p+"/font-files/"+r.id+"/"+c+"."+d+"."+x+".woff"}var b=m.get(s);null==b&&(b=m.size,m.set(s,b)),A[n]=b}o>65535&&(n++,A[n]=A[n-1])}return{fontUrls:Array.from(m.keys()),chars:A}}))},Object.defineProperty(t,"__esModule",{value:!0}),t}({})}],init:(t,e,r)=>t(e,r())});const cU=()=>(self.performance||Date).now(),fU=uU();let pU;const dU=[];let gU=0;function yU(){const t=cU();for(;dU.length&&cU()-t<5;)dU.shift()();gU=dU.length?setTimeout(yU,0):0}const vU=(...t)=>new Promise(((e,r)=>{dU.push((()=>{const n=cU();try{fU.webgl.generateIntoCanvas(...t),e({timing:cU()-n})}catch(t){r(t)}})),gU||(gU=setTimeout(yU,0))})),mU=4,AU=2e3,_U={};let xU=0;function wU(t,e,r,n,i,o,s,a,u,l){const h="TroikaTextSDFGenerator_JS_"+xU++%mU;let c=_U[h];return c||(c=_U[h]={workerModule:oU({name:h,workerId:h,dependencies:[uU,cU],init(t,e){const r=t().javascript.generate;return function(...t){const n=e();return{textureData:r(...t),timing:e()-n}}},getTransferables:t=>[t.textureData.buffer]}),requests:0,idleTimer:null}),c.requests++,clearTimeout(c.idleTimer),c.workerModule(t,e,r,n,i,o).then((({textureData:r,timing:n})=>{const i=cU(),o=new Uint8Array(4*r.length);for(let t=0;t<r.length;t++)o[4*t+l]=r[t];return fU.webglUtils.renderImageData(s,o,a,u,t,e,1<<3-l),n+=cU()-i,0==--c.requests&&(c.idleTimer=setTimeout((()=>{!function(t){nU[t]&&nU[t].forEach((function(t){t()})),rU[t]&&(rU[t].terminate(),delete rU[t])}(h)}),AU)),{timing:n}}))}const bU=fU.webglUtils.resizeWebGLCanvasWithoutClearing,EU={defaultFontURL:null,unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048,useWorker:!0},IU=new e.Color;function CU(){return(self.performance||Date).now()}const SU=Object.create(null);function MU(t,r){t=function(t,e){for(let r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}({},t);const n=CU(),{defaultFontURL:i}=EU,o=[];if(i&&o.push({label:"default",src:kU(i)}),t.font&&o.push({label:"user",src:kU(t.font)}),t.font=o,t.text=""+t.text,t.sdfGlyphSize=t.sdfGlyphSize||EU.sdfGlyphSize,t.unicodeFontsURL=t.unicodeFontsURL||EU.unicodeFontsURL,null!=t.colorRanges){let e={};for(let r in t.colorRanges)if(t.colorRanges.hasOwnProperty(r)){let n=t.colorRanges[r];"number"!=typeof n&&(n=IU.set(n).getHex()),e[r]=n}t.colorRanges=e}Object.freeze(t);const{textureWidth:s,sdfExponent:a}=EU,{sdfGlyphSize:u}=t,l=s/u*4;let h=SU[u];if(!h){const t=document.createElement("canvas");t.width=s,t.height=256*u/l,h=SU[u]={glyphCount:0,sdfGlyphSize:u,sdfCanvas:t,sdfTexture:new e.Texture(t,void 0,void 0,void 0,e.LinearFilter,e.LinearFilter),contextLost:!1,glyphsByFont:new Map},h.sdfTexture.generateMipmaps=!1,function(t){const e=t.sdfCanvas;e.addEventListener("webglcontextlost",(e=>{console.log("Context Lost",e),e.preventDefault(),t.contextLost=!0})),e.addEventListener("webglcontextrestored",(e=>{console.log("Context Restored",e),t.contextLost=!1;const r=[];t.glyphsByFont.forEach((e=>{e.forEach((e=>{r.push(BU(e,t,!0))}))})),Promise.all(r).then((()=>{PU(t),t.sdfTexture.needsUpdate=!0}))}))}(h)}const{sdfTexture:c,sdfCanvas:f}=h;RU(t).then((e=>{const{glyphIds:i,glyphFontIndices:o,fontData:p,glyphPositions:d,fontSize:g,timings:y}=e,v=[],m=new Float32Array(4*i.length);let A=0,_=0;const x=CU(),w=p.map((t=>{let e=h.glyphsByFont.get(t.src);return e||h.glyphsByFont.set(t.src,e=new Map),e}));i.forEach(((t,r)=>{const n=o[r],{src:s,unitsPerEm:a}=p[n];let l=w[n].get(t);if(!l){const{path:r,pathBounds:i}=e.glyphData[s][t],o=Math.max(i[2]-i[0],i[3]-i[1])/u*(EU.sdfMargin*u+.5),a=h.glyphCount++,c=[i[0]-o,i[1]-o,i[2]+o,i[3]+o];w[n].set(t,l={path:r,atlasIndex:a,sdfViewBox:c}),v.push(l)}const{sdfViewBox:c}=l,f=d[_++],y=d[_++],x=g/a;m[A++]=f+c[0]*x,m[A++]=y+c[1]*x,m[A++]=f+c[2]*x,m[A++]=y+c[3]*x,i[r]=l.atlasIndex})),y.quads=(y.quads||0)+(CU()-x);const b=CU();y.sdf={};const E=f.height,I=Math.ceil(h.glyphCount/l),C=Math.pow(2,Math.ceil(Math.log2(I*u)));C>E&&(console.info(`Increasing SDF texture size ${E}->${C}`),bU(f,s,C),c.dispose()),Promise.all(v.map((e=>BU(e,h,t.gpuAccelerateSDF).then((({timing:t})=>{y.sdf[e.atlasIndex]=t}))))).then((()=>{v.length&&!h.contextLost&&(PU(h),c.needsUpdate=!0),y.sdfTotal=CU()-b,y.total=CU()-n,r(Object.freeze({parameters:t,sdfTexture:c,sdfGlyphSize:u,sdfExponent:a,glyphBounds:m,glyphAtlasIndices:i,glyphColors:e.glyphColors,caretPositions:e.caretPositions,chunkedBounds:e.chunkedBounds,ascender:e.ascender,descender:e.descender,lineHeight:e.lineHeight,capHeight:e.capHeight,xHeight:e.xHeight,topBaseline:e.topBaseline,blockBounds:e.blockBounds,visibleBounds:e.visibleBounds,timings:e.timings}))}))})),Promise.resolve().then((()=>{h.contextLost||function(t){t._warm||(fU.webgl.isSupported(t),t._warm=!0)}(f)}))}function BU({path:t,atlasIndex:e,sdfViewBox:r},{sdfGlyphSize:n,sdfCanvas:i,contextLost:o},s){if(o)return Promise.resolve({timing:-1});const{textureWidth:a,sdfExponent:u}=EU,l=Math.max(r[2]-r[0],r[3]-r[1]),h=Math.floor(e/4);return function(t,e,r,n,i,o,s,a,u,l,h=!0){return h?vU(t,e,r,n,i,o,s,a,u,l).then(null,(h=>(pU||(console.warn("WebGL SDF generation failed, falling back to JS",h),pU=!0),wU(t,e,r,n,i,o,s,a,u,l)))):wU(t,e,r,n,i,o,s,a,u,l)}(n,n,t,r,l,u,i,h%(a/n)*n,Math.floor(h/(a/n))*n,e%4,s)}let TU;function kU(t){return TU||(TU="undefined"==typeof document?{}:document.createElement("a")),TU.href=t,TU.href}function PU(t){if("function"!=typeof createImageBitmap){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:r}=t,{width:n,height:i}=e,o=t.sdfCanvas.getContext("webgl");let s=r.image.data;s&&s.length===n*i*4||(s=new Uint8Array(n*i*4),r.image={width:n,height:i,data:s},r.flipY=!1,r.isDataTexture=!0),o.readPixels(0,0,n,i,o.RGBA,o.UNSIGNED_BYTE,s)}}const LU=oU({name:"Typesetter",dependencies:[function(t,e){const r=1/0,n=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,i="[^\\S\\u00A0]",o=new RegExp(`${i}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function s({text:s="",font:c,lang:f,sdfGlyphSize:p=64,fontSize:d=400,fontWeight:g=1,fontStyle:y="normal",letterSpacing:v=0,lineHeight:m="normal",maxWidth:A=r,direction:_,textAlign:x="left",textIndent:w=0,whiteSpace:b="normal",overflowWrap:E="normal",anchorX:I=0,anchorY:C=0,metricsOnly:S=!1,unicodeFontsURL:M,preResolvedFonts:B=null,includeCaretPositions:T=!1,chunkedBoundsSize:k=8192,colorRanges:P=null},L){const R=l(),D={fontLoad:0,typesetting:0};s.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),s=s.replace(/\r\n/g,"\n").replace(/\r/g,"\n")),d=+d,v=+v,A=+A,m=m||"normal",w=+w,function({text:e,lang:r,fonts:n,style:i,weight:o,preResolvedFonts:s,unicodeFontsURL:a},u){const l=({chars:t,fonts:e})=>{let r,n;const i=[];for(let o=0;o<t.length;o++)t[o]!==n?(n=t[o],i.push(r={start:o,end:o,fontObj:e[t[o]]})):r.end=o;u(i)};s?l(s):t(e,l,{lang:r,fonts:n,style:i,weight:o,unicodeFontsURL:a})}({text:s,lang:f,style:y,weight:g,fonts:"string"==typeof c?[{src:c}]:c,unicodeFontsURL:M,preResolvedFonts:B},(t=>{D.fontLoad=l()-R;const c=isFinite(A);let f=null,p=null,g=null,y=null,M=null,B=null,O=null,N=null,F=0,U=0,Q="nowrap"!==b;const G=new Map,z=l();let j=w,V=0,q=new h;const H=[q];t.forEach((t=>{const{fontObj:e}=t,{ascender:r,descender:a,unitsPerEm:u,lineGap:l,capHeight:f,xHeight:p}=e;let g=G.get(e);if(!g){const t=d/u,n="normal"===m?(r-a+l)*t:m*d,i=(n-(r-a)*t)/2,o=Math.min(n,(r-a)*t),s=(r+a)/2*t+o/2;g={index:G.size,src:e.src,fontObj:e,fontSizeMult:t,unitsPerEm:u,ascender:r*t,descender:a*t,capHeight:f*t,xHeight:p*t,lineHeight:n,baseline:-i-r*t,caretTop:s,caretBottom:s-o},G.set(e,g)}const{fontSizeMult:y}=g,_=s.slice(t.start,t.end+1);let x,b;e.forEachGlyph(_,d,v,((e,r,a,u)=>{r+=V,u+=t.start,x=r,b=e;const l=s.charAt(u),f=e.advanceWidth*y,p=q.count;let m;if("isEmpty"in e||(e.isWhitespace=!!l&&new RegExp(i).test(l),e.canBreakAfter=!!l&&o.test(l),e.isEmpty=e.xMin===e.xMax||e.yMin===e.yMax||n.test(l)),e.isWhitespace||e.isEmpty||U++,Q&&c&&!e.isWhitespace&&r+f+j>A&&p){if(q.glyphAt(p-1).glyphObj.canBreakAfter)m=new h,j=-r;else for(let t=p;t--;){if(0===t&&"break-word"===E){m=new h,j=-r;break}if(q.glyphAt(t).glyphObj.canBreakAfter){m=q.splitAt(t+1);const e=m.glyphAt(0).x;j-=e;for(let t=m.count;t--;)m.glyphAt(t).x-=e;break}}m&&(q.isSoftWrapped=!0,q=m,H.push(q),F=A)}let _=q.glyphAt(q.count);_.glyphObj=e,_.x=r+j,_.y=a,_.width=f,_.charIndex=u,_.fontData=g,"\n"===l&&(q=new h,H.push(q),j=-(r+f+v*d)+w)})),V=x+b.advanceWidth*y+v*d}));let W=0;H.forEach((t=>{let e=!0;for(let r=t.count;r--;){const n=t.glyphAt(r);e&&!n.glyphObj.isWhitespace&&(t.width=n.x+n.width,t.width>F&&(F=t.width),e=!1);let{lineHeight:i,capHeight:o,xHeight:s,baseline:a}=n.fontData;i>t.lineHeight&&(t.lineHeight=i);const u=a-t.baseline;u<0&&(t.baseline+=u,t.cap+=u,t.ex+=u),t.cap=Math.max(t.cap,t.baseline+o),t.ex=Math.max(t.ex,t.baseline+s)}t.baseline-=W,t.cap-=W,t.ex-=W,W+=t.lineHeight}));let Y=0,X=0;if(I&&("number"==typeof I?Y=-I:"string"==typeof I&&(Y=-F*("left"===I?0:"center"===I?.5:"right"===I?1:a(I)))),C&&("number"==typeof C?X=-C:"string"==typeof C&&(X="top"===C?0:"top-baseline"===C?-H[0].baseline:"top-cap"===C?-H[0].cap:"top-ex"===C?-H[0].ex:"middle"===C?W/2:"bottom"===C?W:"bottom-baseline"===C?-H[H.length-1].baseline:a(C)*W)),!S){const t=e.getEmbeddingLevels(s,_);f=new Uint16Array(U),p=new Uint8Array(U),g=new Float32Array(2*U),y={},O=[r,r,-1/0,-1/0],N=[],T&&(B=new Float32Array(4*s.length)),P&&(M=new Uint8Array(3*U));let n,i,o=0,a=-1,l=-1;if(H.forEach(((h,c)=>{let{count:d,width:v}=h;if(d>0){let c=0;for(let t=d;t--&&h.glyphAt(t).glyphObj.isWhitespace;)c++;let m=0,A=0;if("center"===x)m=(F-v)/2;else if("right"===x)m=F-v;else if("justify"===x&&h.isSoftWrapped){let t=0;for(let e=d-c;e--;)h.glyphAt(e).glyphObj.isWhitespace&&t++;A=(F-v)/t}if(A||m){let t=0;for(let e=0;e<d;e++){let r=h.glyphAt(e);const n=r.glyphObj;r.x+=m+t,0!==A&&n.isWhitespace&&e<d-c&&(t+=A,r.width+=A)}}const _=e.getReorderSegments(s,t,h.glyphAt(0).charIndex,h.glyphAt(h.count-1).charIndex);for(let t=0;t<_.length;t++){const[e,r]=_[t];let n=1/0,i=-1/0;for(let t=0;t<d;t++)if(h.glyphAt(t).charIndex>=e){let e=t,o=t;for(;o<d;o++){let t=h.glyphAt(o);if(t.charIndex>r)break;o<d-c&&(n=Math.min(n,t.x),i=Math.max(i,t.x+t.width))}for(let t=e;t<o;t++){const e=h.glyphAt(t);e.x=i-(e.x+e.width-n)}break}}let w;const b=t=>w=t;for(let c=0;c<d;c++){const d=h.glyphAt(c);w=d.glyphObj;const v=w.index,m=1&t.levels[d.charIndex];if(m){const t=e.getMirroredCharacter(s[d.charIndex]);t&&d.fontData.fontObj.forEachGlyph(t,0,0,b)}if(T){const{charIndex:t,fontData:e}=d,r=d.x+Y,n=d.x+d.width+Y;B[4*t]=m?n:r,B[4*t+1]=m?r:n,B[4*t+2]=h.baseline+e.caretBottom+X,B[4*t+3]=h.baseline+e.caretTop+X;const i=t-a;i>1&&u(B,a,i),a=t}if(P){const{charIndex:t}=d;for(;t>l;)l++,P.hasOwnProperty(l)&&(i=P[l])}if(!w.isWhitespace&&!w.isEmpty){const t=o++,{fontSizeMult:e,src:s,index:a}=d.fontData,u=y[s]||(y[s]={});u[v]||(u[v]={path:w.path,pathBounds:[w.xMin,w.yMin,w.xMax,w.yMax]});const l=d.x+Y,c=d.y+h.baseline+X;g[2*t]=l,g[2*t+1]=c;const m=l+w.xMin*e,A=c+w.yMin*e,_=l+w.xMax*e,x=c+w.yMax*e;m<O[0]&&(O[0]=m),A<O[1]&&(O[1]=A),_>O[2]&&(O[2]=_),x>O[3]&&(O[3]=x),t%k==0&&(n={start:t,end:t,rect:[r,r,-1/0,-1/0]},N.push(n)),n.end++;const b=n.rect;if(m<b[0]&&(b[0]=m),A<b[1]&&(b[1]=A),_>b[2]&&(b[2]=_),x>b[3]&&(b[3]=x),f[t]=v,p[t]=a,P){const e=3*t;M[e]=i>>16&255,M[e+1]=i>>8&255,M[e+2]=255&i}}}}})),B){const t=s.length-a;t>1&&u(B,a,t)}}const J=[];G.forEach((({index:t,src:e,unitsPerEm:r,ascender:n,descender:i,lineHeight:o,capHeight:s,xHeight:a})=>{J[t]={src:e,unitsPerEm:r,ascender:n,descender:i,lineHeight:o,capHeight:s,xHeight:a}})),D.typesetting=l()-z,L({glyphIds:f,glyphFontIndices:p,glyphPositions:g,glyphData:y,fontData:J,caretPositions:B,glyphColors:M,chunkedBounds:N,fontSize:d,topBaseline:X+H[0].baseline,blockBounds:[Y,X-W,Y+F,X],visibleBounds:O,timings:D})}))}function a(t){let e=t.match(/^([\d.]+)%$/),r=e?parseFloat(e[1]):NaN;return isNaN(r)?0:r/100}function u(t,e,r){const n=t[4*e],i=t[4*e+1],o=t[4*e+2],s=t[4*e+3],a=(i-n)/r;for(let i=0;i<r;i++){const r=4*(e+i);t[r]=n+a*i,t[r+1]=n+a*(i+1),t[r+2]=o,t[r+3]=s}}function l(){return(self.performance||Date).now()}function h(){this.data=[]}const c=["glyphObj","x","y","width","charIndex","fontData"];return h.prototype={width:0,lineHeight:0,baseline:0,cap:0,ex:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/c.length)},glyphAt(t){let e=h.flyweight;return e.data=this.data,e.index=t,e},splitAt(t){let e=new h;return e.data=this.data.splice(t*c.length),e}},h.flyweight=c.reduce(((t,e,r,n)=>(Object.defineProperty(t,e,{get(){return this.data[this.index*c.length+r]},set(t){this.data[this.index*c.length+r]=t}}),t)),{data:null,index:0}),{typeset:s,measure:function(t,e){s({...t,metricsOnly:!0},(t=>{const[r,n,i,o]=t.blockBounds;e({width:i-r,height:o-n})}))}}},hU,function(){var t=function(t){var e={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},r={},n={};r.L=1,n[1]="L",Object.keys(e).forEach((function(t,e){r[t]=1<<e+1,n[r[t]]=t})),Object.freeze(r);var i=r.LRI|r.RLI|r.FSI,o=r.L|r.R|r.AL,s=r.B|r.S|r.WS|r.ON|r.FSI|r.LRI|r.RLI|r.PDI,a=r.BN|r.RLE|r.LRE|r.RLO|r.LRO|r.PDF,u=r.S|r.WS|r.B|i|r.PDI|a,l=null;function h(t){return function(){if(!l){l=new Map;var t=function(t){if(e.hasOwnProperty(t)){var n=0;e[t].split(",").forEach((function(e){var i=e.split("+"),o=i[0],s=i[1];o=parseInt(o,36),s=s?parseInt(s,36):0,l.set(n+=o,r[t]);for(var a=0;a<s;a++)l.set(++n,r[t])}))}};for(var n in e)t(n)}}(),l.get(t.codePointAt(0))||r.L}var c,f,p,d="14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",g="6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye";function y(t,e){var r,n=0,i=new Map,o=e&&new Map;return t.split(",").forEach((function t(s){if(-1!==s.indexOf("+"))for(var a=+s;a--;)t(r);else{r=s;var u=s.split(">"),l=u[0],h=u[1];l=String.fromCodePoint(n+=parseInt(l,36)),h=String.fromCodePoint(n+=parseInt(h,36)),i.set(l,h),e&&o.set(h,l)}})),{map:i,reverseMap:o}}function v(){if(!c){var t=y(d,!0),e=t.map,r=t.reverseMap;c=e,f=r,p=y(g,!1).map}}function m(t){return v(),c.get(t)||null}function A(t){return v(),f.get(t)||null}function _(t){return v(),p.get(t)||null}var x=r.L,w=r.R,b=r.EN,E=r.ES,I=r.ET,C=r.AN,S=r.CS,M=r.B,B=r.S,T=r.ON,k=r.BN,P=r.NSM,L=r.AL,R=r.LRO,D=r.RLO,O=r.LRE,N=r.RLE,F=r.PDF,U=r.LRI,Q=r.RLI,G=r.FSI,z=r.PDI;var j;function V(t){return function(){if(!j){var t=y("14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",!0),e=t.map;t.reverseMap.forEach((function(t,r){e.set(r,t)})),j=e}}(),j.get(t)||null}function q(t,e,r,n){var i=t.length;r=Math.max(0,null==r?0:+r),n=Math.min(i-1,null==n?i-1:+n);var o=[];return e.paragraphs.forEach((function(i){var s=Math.max(r,i.start),a=Math.min(n,i.end);if(s<a){for(var l=e.levels.slice(s,a+1),c=a;c>=s&&h(t[c])&u;c--)l[c]=i.level;for(var f=i.level,p=1/0,d=0;d<l.length;d++){var g=l[d];g>f&&(f=g),g<p&&(p=1|g)}for(var y=f;y>=p;y--)for(var v=0;v<l.length;v++)if(l[v]>=y){for(var m=v;v+1<l.length&&l[v+1]>=y;)v++;v>m&&o.push([m+s,v+s])}}})),o}function H(t,e,r,n){for(var i=q(t,e,r,n),o=[],s=0;s<t.length;s++)o[s]=s;return i.forEach((function(t){for(var e=t[0],r=t[1],n=o.slice(e,r+1),i=n.length;i--;)o[r-i]=n[i]})),o}return t.closingToOpeningBracket=A,t.getBidiCharType=h,t.getBidiCharTypeName=function(t){return n[h(t)]},t.getCanonicalBracket=_,t.getEmbeddingLevels=function(t,e){for(var r=new Uint32Array(t.length),n=0;n<t.length;n++)r[n]=h(t[n]);var l=new Map;function c(t,e){var n=r[t];r[t]=e,l.set(n,l.get(n)-1),n&s&&l.set(s,l.get(s)-1),l.set(e,(l.get(e)||0)+1),e&s&&l.set(s,(l.get(s)||0)+1)}for(var f=new Uint8Array(t.length),p=new Map,d=[],g=null,y=0;y<t.length;y++)g||d.push(g={start:y,end:t.length-1,level:"rtl"===e?1:"ltr"===e?0:Ge(y,!1)}),r[y]&M&&(g.end=y,g=null);for(var v=N|O|D|R|i|z|F|M,j=function(t){return t+(1&t?1:2)},V=function(t){return t+(1&t?2:1)},q=0;q<d.length;q++){var H=[{_level:(g=d[q]).level,_override:0,_isolate:0}],W=void 0,Y=0,X=0,J=0;l.clear();for(var K=g.start;K<=g.end;K++){var Z=r[K];if(W=H[H.length-1],l.set(Z,(l.get(Z)||0)+1),Z&s&&l.set(s,(l.get(s)||0)+1),Z&v)if(Z&(N|O)){f[K]=W._level;var $=(Z===N?V:j)(W._level);$<=125&&!Y&&!X?H.push({_level:$,_override:0,_isolate:0}):Y||X++}else if(Z&(D|R)){f[K]=W._level;var tt=(Z===D?V:j)(W._level);tt<=125&&!Y&&!X?H.push({_level:tt,_override:Z&D?w:x,_isolate:0}):Y||X++}else if(Z&i){Z&G&&(Z=1===Ge(K+1,!0)?Q:U),f[K]=W._level,W._override&&c(K,W._override);var et=(Z===Q?V:j)(W._level);et<=125&&0===Y&&0===X?(J++,H.push({_level:et,_override:0,_isolate:1,_isolInitIndex:K})):Y++}else if(Z&z){if(Y>0)Y--;else if(J>0){for(X=0;!H[H.length-1]._isolate;)H.pop();var rt=H[H.length-1]._isolInitIndex;null!=rt&&(p.set(rt,K),p.set(K,rt)),H.pop(),J--}W=H[H.length-1],f[K]=W._level,W._override&&c(K,W._override)}else Z&F?(0===Y&&(X>0?X--:!W._isolate&&H.length>1&&(H.pop(),W=H[H.length-1])),f[K]=W._level):Z&M&&(f[K]=g.level);else f[K]=W._level,W._override&&Z!==k&&c(K,W._override)}for(var nt=[],it=null,ot=g.start;ot<=g.end;ot++){var st=r[ot];if(!(st&a)){var at=f[ot],ut=st&i,lt=st===z;it&&at===it._level?(it._end=ot,it._endsWithIsolInit=ut):nt.push(it={_start:ot,_end:ot,_level:at,_startsWithPDI:lt,_endsWithIsolInit:ut})}}for(var ht=[],ct=0;ct<nt.length;ct++){var ft=nt[ct];if(!ft._startsWithPDI||ft._startsWithPDI&&!p.has(ft._start)){for(var pt=[it=ft],dt=void 0;it&&it._endsWithIsolInit&&null!=(dt=p.get(it._end));)for(var gt=ct+1;gt<nt.length;gt++)if(nt[gt]._start===dt){pt.push(it=nt[gt]);break}for(var yt=[],vt=0;vt<pt.length;vt++)for(var mt=pt[vt],At=mt._start;At<=mt._end;At++)yt.push(At);for(var _t=f[yt[0]],xt=g.level,wt=yt[0]-1;wt>=0;wt--)if(!(r[wt]&a)){xt=f[wt];break}var bt=yt[yt.length-1],Et=f[bt],It=g.level;if(!(r[bt]&i))for(var Ct=bt+1;Ct<=g.end;Ct++)if(!(r[Ct]&a)){It=f[Ct];break}ht.push({_seqIndices:yt,_sosType:Math.max(xt,_t)%2?w:x,_eosType:Math.max(It,Et)%2?w:x})}}for(var St=0;St<ht.length;St++){var Mt=ht[St],Bt=Mt._seqIndices,Tt=Mt._sosType,kt=Mt._eosType,Pt=1&f[Bt[0]]?w:x;if(l.get(P))for(var Lt=0;Lt<Bt.length;Lt++){var Rt=Bt[Lt];if(r[Rt]&P){for(var Dt=Tt,Ot=Lt-1;Ot>=0;Ot--)if(!(r[Bt[Ot]]&a)){Dt=r[Bt[Ot]];break}c(Rt,Dt&(i|z)?T:Dt)}}if(l.get(b))for(var Nt=0;Nt<Bt.length;Nt++){var Ft=Bt[Nt];if(r[Ft]&b)for(var Ut=Nt-1;Ut>=-1;Ut--){var Qt=-1===Ut?Tt:r[Bt[Ut]];if(Qt&o){Qt===L&&c(Ft,C);break}}}if(l.get(L))for(var Gt=0;Gt<Bt.length;Gt++){var zt=Bt[Gt];r[zt]&L&&c(zt,w)}if(l.get(E)||l.get(S))for(var jt=1;jt<Bt.length-1;jt++){var Vt=Bt[jt];if(r[Vt]&(E|S)){for(var qt=0,Ht=0,Wt=jt-1;Wt>=0&&(qt=r[Bt[Wt]])&a;Wt--);for(var Yt=jt+1;Yt<Bt.length&&(Ht=r[Bt[Yt]])&a;Yt++);qt===Ht&&(r[Vt]===E?qt===b:qt&(b|C))&&c(Vt,qt)}}if(l.get(b))for(var Xt=0;Xt<Bt.length;Xt++){var Jt=Bt[Xt];if(r[Jt]&b){for(var Kt=Xt-1;Kt>=0&&r[Bt[Kt]]&(I|a);Kt--)c(Bt[Kt],b);for(Xt++;Xt<Bt.length&&r[Bt[Xt]]&(I|a|b);Xt++)r[Bt[Xt]]!==b&&c(Bt[Xt],b)}}if(l.get(I)||l.get(E)||l.get(S))for(var Zt=0;Zt<Bt.length;Zt++){var $t=Bt[Zt];if(r[$t]&(I|E|S)){c($t,T);for(var te=Zt-1;te>=0&&r[Bt[te]]&a;te--)c(Bt[te],T);for(var ee=Zt+1;ee<Bt.length&&r[Bt[ee]]&a;ee++)c(Bt[ee],T)}}if(l.get(b))for(var re=0,ne=Tt;re<Bt.length;re++){var ie=Bt[re],oe=r[ie];oe&b?ne===x&&c(ie,x):oe&o&&(ne=oe)}if(l.get(s)){for(var se=w|b|C,ae=se|x,ue=[],le=[],he=0;he<Bt.length;he++)if(r[Bt[he]]&s){var ce=t[Bt[he]],fe=void 0;if(null!==m(ce)){if(!(le.length<63))break;le.push({char:ce,seqIndex:he})}else if(null!==(fe=A(ce)))for(var pe=le.length-1;pe>=0;pe--){var de=le[pe].char;if(de===fe||de===A(_(ce))||m(_(de))===ce){ue.push([le[pe].seqIndex,he]),le.length=pe;break}}}ue.sort((function(t,e){return t[0]-e[0]}));for(var ge=0;ge<ue.length;ge++){for(var ye=ue[ge],ve=ye[0],me=ye[1],Ae=!1,_e=0,xe=ve+1;xe<me;xe++){var we=Bt[xe];if(r[we]&ae){Ae=!0;var be=r[we]&se?w:x;if(be===Pt){_e=be;break}}}if(Ae&&!_e){_e=Tt;for(var Ee=ve-1;Ee>=0;Ee--){var Ie=Bt[Ee];if(r[Ie]&ae){var Ce=r[Ie]&se?w:x;_e=Ce!==Pt?Ce:Pt;break}}}if(_e){if(r[Bt[ve]]=r[Bt[me]]=_e,_e!==Pt)for(var Se=ve+1;Se<Bt.length;Se++)if(!(r[Bt[Se]]&a)){h(t[Bt[Se]])&P&&(r[Bt[Se]]=_e);break}if(_e!==Pt)for(var Me=me+1;Me<Bt.length;Me++)if(!(r[Bt[Me]]&a)){h(t[Bt[Me]])&P&&(r[Bt[Me]]=_e);break}}}for(var Be=0;Be<Bt.length;Be++)if(r[Bt[Be]]&s){for(var Te=Be,ke=Be,Pe=Tt,Le=Be-1;Le>=0;Le--){if(!(r[Bt[Le]]&a)){Pe=r[Bt[Le]]&se?w:x;break}Te=Le}for(var Re=kt,De=Be+1;De<Bt.length;De++){if(!(r[Bt[De]]&(s|a))){Re=r[Bt[De]]&se?w:x;break}ke=De}for(var Oe=Te;Oe<=ke;Oe++)r[Bt[Oe]]=Pe===Re?Pe:Pt;Be=ke}}}for(var Ne=g.start;Ne<=g.end;Ne++){var Fe=f[Ne],Ue=r[Ne];if(1&Fe?Ue&(x|b|C)&&f[Ne]++:Ue&w?f[Ne]++:Ue&(C|b)&&(f[Ne]+=2),Ue&a&&(f[Ne]=0===Ne?g.level:f[Ne-1]),Ne===g.end||h(t[Ne])&(B|M))for(var Qe=Ne;Qe>=0&&h(t[Qe])&u;Qe--)f[Qe]=g.level}}return{levels:f,paragraphs:d};function Ge(e,n){for(var o=e;o<t.length;o++){var s=r[o];if(s&(w|L))return 1;if(s&(M|x)||n&&s===z)return 0;if(s&i){var a=ze(o);o=-1===a?t.length:a}}return 0}function ze(e){for(var n=1,o=e+1;o<t.length;o++){var s=r[o];if(s&M)break;if(s&z){if(0==--n)return o}else s&i&&n++}return-1}},t.getMirroredCharacter=V,t.getMirroredCharactersMap=function(t,e,r,n){var i=t.length;r=Math.max(0,null==r?0:+r),n=Math.min(i-1,null==n?i-1:+n);for(var o=new Map,s=r;s<=n;s++)if(1&e[s]){var a=V(t[s]);null!==a&&o.set(s,a)}return o},t.getReorderSegments=q,t.getReorderedIndices=H,t.getReorderedString=function(t,e,r,n){var i=H(t,e,r,n),o=[].concat(t);return i.forEach((function(r,n){o[n]=(1&e.levels[r]?V(t[r]):null)||t[r]})),o.join("")},t.openingToClosingBracket=m,Object.defineProperty(t,"__esModule",{value:!0}),t}({});return t}],init:(t,e,r)=>t(e,r())}),RU=oU({name:"Typesetter",dependencies:[LU],init:t=>function(e){return new Promise((r=>{t.typeset(e,r)}))},getTransferables(t){const e=[];for(let r in t)t[r]&&t[r].buffer&&e.push(t[r].buffer);return e}});RU.onMainThread;const DU={};const OU="aTroikaGlyphIndex";class NU extends e.InstancedBufferGeometry{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new e.Sphere,this.boundingBox=new e.Box3}computeBoundingSphere(){}computeBoundingBox(){}set detail(t){if(t!==this._detail){this._detail=t,("number"!=typeof t||t<1)&&(t=1);let r=function(t){let r=DU[t];return r||(r=DU[t]=new e.PlaneGeometry(1,1,t,t).translate(.5,.5,0)),r}(t);["position","normal","uv"].forEach((t=>{this.attributes[t]=r.attributes[t].clone()})),this.setIndex(r.getIndex().clone())}}get detail(){return this._detail}set curveRadius(t){t!==this._curveRadius&&(this._curveRadius=t,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(t,e,r,n,i){this.updateAttributeData("aTroikaGlyphBounds",t,4),this.updateAttributeData(OU,e,1),this.updateAttributeData("aTroikaGlyphColor",i,3),this._blockBounds=r,this._chunkedBounds=n,this.instanceCount=e.length,this._updateBounds()}_updateBounds(){const t=this._blockBounds;if(t){const{curveRadius:e,boundingBox:r}=this;if(e){const{PI:n,floor:i,min:o,max:s,sin:a,cos:u}=Math,l=n/2,h=2*n,c=Math.abs(e),f=t[0]/c,p=t[2]/c,d=i((f+l)/h)!==i((p+l)/h)?-c:o(a(f)*c,a(p)*c),g=i((f-l)/h)!==i((p-l)/h)?c:s(a(f)*c,a(p)*c),y=i((f+n)/h)!==i((p+n)/h)?2*c:s(c-u(f)*c,c-u(p)*c);r.min.set(d,t[1],e<0?-y:0),r.max.set(g,t[3],e<0?0:y)}else r.min.set(t[0],t[1],0),r.max.set(t[2],t[3],0);r.getBoundingSphere(this.boundingSphere)}}applyClipRect(t){let e=this.getAttribute(OU).count,r=this._chunkedBounds;if(r)for(let n=r.length;n--;){e=r[n].end;let i=r[n].rect;if(i[1]<t.w&&i[3]>t.y&&i[0]<t.z&&i[2]>t.x)break}this.instanceCount=e}updateAttributeData(t,r,n){const i=this.getAttribute(t);r?i&&i.array.length===r.length?(i.array.set(r),i.needsUpdate=!0):(this.setAttribute(t,new e.InstancedBufferAttribute(r,n)),delete this._maxInstanceCount,this.dispose()):i&&this.deleteAttribute(t)}}const FU=new e.MeshBasicMaterial({color:16777215,side:e.DoubleSide,transparent:!0}),UU=8421504,QU=new e.Matrix4,GU=new e.Vector3,zU=new e.Vector3,jU=[],VU=new e.Vector3,qU="+x+y";function HU(t){return Array.isArray(t)?t[0]:t}let WU=()=>{const t=new e.Mesh(new e.PlaneGeometry(1,1),FU);return WU=()=>t,t},YU=()=>{const t=new e.Mesh(new e.PlaneGeometry(1,1,32,1),FU);return YU=()=>t,t};const XU={type:"syncstart"},JU={type:"synccomplete"},KU=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],ZU=KU.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");class $U extends e.Mesh{constructor(){super(new NU,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=UU,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=qU,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(t){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(t):(this._isSyncing=!0,this.dispatchEvent(XU),MU({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},(e=>{this._isSyncing=!1,this._textRenderInfo=e,this.geometry.updateGlyphs(e.glyphBounds,e.glyphAtlasIndices,e.blockBounds,e.chunkedBounds,e.glyphColors);const r=this._queuedSyncs;r&&(this._queuedSyncs=null,this._needsSync=!0,this.sync((()=>{r.forEach((t=>t&&t()))}))),this.dispatchEvent(JU),t&&t()}))))}onBeforeRender(t,e,r,n,i,o){this.sync(),i.isTroikaTextMaterial&&this._prepareForRender(i)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(t){return function(t){const r=HF(t,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new e.Vector2},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new e.Vector4(0,0,0,0)},uTroikaClipRect:{value:new e.Vector4(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new e.Vector2},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new e.Color},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new e.Matrix3},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:"\nuniform vec2 uTroikaSDFTextureSize;\nuniform float uTroikaSDFGlyphSize;\nuniform vec4 uTroikaTotalBounds;\nuniform vec4 uTroikaClipRect;\nuniform mat3 uTroikaOrient;\nuniform bool uTroikaUseGlyphColors;\nuniform float uTroikaEdgeOffset;\nuniform float uTroikaBlurRadius;\nuniform vec2 uTroikaPositionOffset;\nuniform float uTroikaCurveRadius;\nattribute vec4 aTroikaGlyphBounds;\nattribute float aTroikaGlyphIndex;\nattribute vec3 aTroikaGlyphColor;\nvarying vec2 vTroikaGlyphUV;\nvarying vec4 vTroikaTextureUVBounds;\nvarying float vTroikaTextureChannel;\nvarying vec3 vTroikaGlyphColor;\nvarying vec2 vTroikaGlyphDimensions;\n",vertexTransform:"\nvec4 bounds = aTroikaGlyphBounds;\nbounds.xz += uTroikaPositionOffset.x;\nbounds.yw -= uTroikaPositionOffset.y;\n\nvec4 outlineBounds = vec4(\n bounds.xy - uTroikaEdgeOffset - uTroikaBlurRadius,\n bounds.zw + uTroikaEdgeOffset + uTroikaBlurRadius\n);\nvec4 clippedBounds = vec4(\n clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw),\n clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw)\n);\n\nvec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy);\n\nposition.xy = mix(bounds.xy, bounds.zw, clippedXY);\n\nuv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy);\n\nfloat rad = uTroikaCurveRadius;\nif (rad != 0.0) {\n float angle = position.x / rad;\n position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad);\n normal.xz = vec2(sin(angle), cos(angle));\n}\n \nposition = uTroikaOrient * position;\nnormal = uTroikaOrient * normal;\n\nvTroikaGlyphUV = clippedXY.xy;\nvTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]);\n\n\nfloat txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize;\nvec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize;\nvec2 txStartUV = txUvPerSquare * vec2(\n mod(floor(aTroikaGlyphIndex / 4.0), txCols),\n floor(floor(aTroikaGlyphIndex / 4.0) / txCols)\n);\nvTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare);\nvTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0);\n",fragmentDefs:"\nuniform sampler2D uTroikaSDFTexture;\nuniform vec2 uTroikaSDFTextureSize;\nuniform float uTroikaSDFGlyphSize;\nuniform float uTroikaSDFExponent;\nuniform float uTroikaEdgeOffset;\nuniform float uTroikaFillOpacity;\nuniform float uTroikaBlurRadius;\nuniform vec3 uTroikaStrokeColor;\nuniform float uTroikaStrokeWidth;\nuniform float uTroikaStrokeOpacity;\nuniform bool uTroikaSDFDebug;\nvarying vec2 vTroikaGlyphUV;\nvarying vec4 vTroikaTextureUVBounds;\nvarying float vTroikaTextureChannel;\nvarying vec2 vTroikaGlyphDimensions;\n\nfloat troikaSdfValueToSignedDistance(float alpha) {\n // Inverse of exponential encoding in webgl-sdf-generator\n \n float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y);\n float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension;\n float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0);\n return signedDist;\n}\n\nfloat troikaGlyphUvToSdfValue(vec2 glyphUV) {\n vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV);\n vec4 rgba = texture2D(uTroikaSDFTexture, textureUV);\n float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1\n return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a;\n}\n\nfloat troikaGlyphUvToDistance(vec2 uv) {\n return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv));\n}\n\nfloat troikaGetAADist() {\n \n #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\n return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5;\n #else\n return vTroikaGlyphDimensions.x / 64.0;\n #endif\n}\n\nfloat troikaGetFragDistValue() {\n vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize);\n float distance = troikaGlyphUvToDistance(clampedGlyphUV);\n \n // Extrapolate distance when outside bounds:\n distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 : \n length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions);\n\n \n\n return distance;\n}\n\nfloat troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) {\n #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)\n float alpha = step(-distanceOffset, -distance);\n #else\n\n float alpha = smoothstep(\n distanceOffset + aaDist,\n distanceOffset - aaDist,\n distance\n );\n #endif\n\n return alpha;\n}\n",fragmentColorTransform:"\nfloat aaDist = troikaGetAADist();\nfloat fragDistance = troikaGetFragDistValue();\nfloat edgeAlpha = uTroikaSDFDebug ?\n troikaGlyphUvToSdfValue(vTroikaGlyphUV) :\n troikaGetEdgeAlpha(fragDistance, uTroikaEdgeOffset, max(aaDist, uTroikaBlurRadius));\n\n#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL)\nvec4 fillRGBA = gl_FragColor;\nfillRGBA.a *= uTroikaFillOpacity;\nvec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity);\nif (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb;\ngl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep(\n -uTroikaStrokeWidth - aaDist,\n -uTroikaStrokeWidth + aaDist,\n fragDistance\n));\ngl_FragColor.a *= edgeAlpha;\n#endif\n\nif (edgeAlpha == 0.0) {\n discard;\n}\n",customRewriter({vertexShader:t,fragmentShader:e}){let r=/\buniform\s+vec3\s+diffuse\b/;return r.test(e)&&(e=e.replace(r,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),r.test(t)||(t=t.replace(FF,"uniform vec3 diffuse;\n$&\nvTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;\n"))),{vertexShader:t,fragmentShader:e}}});return r.transparent=!0,r.forceSinglePass=!0,Object.defineProperties(r,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),r}(t)}get material(){let t=this._derivedMaterial;const e=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=FU.clone());if(t&&t.isDerivedFrom(e)||(t=this._derivedMaterial=this.createDerivedMaterial(e),e.addEventListener("dispose",(function r(){e.removeEventListener("dispose",r),t.dispose()}))),this.hasOutline()){let e=t._outlineMtl;return e||(e=t._outlineMtl=Object.create(t,{id:{value:t.id+.1}}),e.isTextOutlineMaterial=!0,e.depthWrite=!1,e.map=null,t.addEventListener("dispose",(function r(){t.removeEventListener("dispose",r),e.dispose()}))),[e,t]}return t}set material(t){t&&t.isTroikaTextMaterial?(this._derivedMaterial=t,this._baseMaterial=t.baseMaterial):this._baseMaterial=t}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(t){this.geometry.detail=t}get curveRadius(){return this.geometry.curveRadius}set curveRadius(t){this.geometry.curveRadius=t}get customDepthMaterial(){return HU(this.material).getDepthMaterial()}set customDepthMaterial(t){}get customDistanceMaterial(){return HU(this.material).getDistanceMaterial()}set customDistanceMaterial(t){}_prepareForRender(t){const r=t.isTextOutlineMaterial,n=t.uniforms,i=this.textRenderInfo;if(i){const{sdfTexture:t,blockBounds:e}=i;n.uTroikaSDFTexture.value=t,n.uTroikaSDFTextureSize.value.set(t.image.width,t.image.height),n.uTroikaSDFGlyphSize.value=i.sdfGlyphSize,n.uTroikaSDFExponent.value=i.sdfExponent,n.uTroikaTotalBounds.value.fromArray(e),n.uTroikaUseGlyphColors.value=!r&&!!i.glyphColors;let o,s,a,u=0,l=0,h=0,c=0,f=0;if(r){let{outlineWidth:t,outlineOffsetX:e,outlineOffsetY:r,outlineBlur:n,outlineOpacity:i}=this;u=this._parsePercent(t)||0,l=Math.max(0,this._parsePercent(n)||0),o=i,c=this._parsePercent(e)||0,f=this._parsePercent(r)||0}else h=Math.max(0,this._parsePercent(this.strokeWidth)||0),h&&(a=this.strokeColor,n.uTroikaStrokeColor.value.set(null==a?UU:a),s=this.strokeOpacity,null==s&&(s=1)),o=this.fillOpacity;n.uTroikaEdgeOffset.value=u,n.uTroikaPositionOffset.value.set(c,f),n.uTroikaBlurRadius.value=l,n.uTroikaStrokeWidth.value=h,n.uTroikaStrokeOpacity.value=s,n.uTroikaFillOpacity.value=null==o?1:o,n.uTroikaCurveRadius.value=this.curveRadius||0;let p=this.clipRect;if(p&&Array.isArray(p)&&4===p.length)n.uTroikaClipRect.value.fromArray(p);else{const t=100*(this.fontSize||.1);n.uTroikaClipRect.value.set(e[0]-t,e[1]-t,e[2]+t,e[3]+t)}this.geometry.applyClipRect(n.uTroikaClipRect.value)}n.uTroikaSDFDebug.value=!!this.debugSDF,t.polygonOffset=!!this.depthOffset,t.polygonOffsetFactor=t.polygonOffsetUnits=this.depthOffset||0;const o=r?this.outlineColor||0:this.color;if(null==o)delete t.color;else{const r=t.hasOwnProperty("color")?t.color:t.color=new e.Color;o===r._input&&"object"!=typeof o||r.set(r._input=o)}let s=this.orientation||qU;if(s!==t._orientation){let e=n.uTroikaOrient.value;s=s.replace(/[^-+xyz]/g,"");let r=s!==qU&&s.match(/^([-+])([xyz])([-+])([xyz])$/);if(r){let[,t,n,i,o]=r;GU.set(0,0,0)[n]="-"===t?1:-1,zU.set(0,0,0)[o]="-"===i?-1:1,QU.lookAt(VU,GU.cross(zU),zU),e.setFromMatrix4(QU)}else e.identity();t._orientation=s}}_parsePercent(t){if("string"==typeof t){let e=t.match(/^(-?[\d.]+)%$/),r=e?parseFloat(e[1]):NaN;t=(isNaN(r)?0:r/100)*this.fontSize}return t}localPositionToTextCoords(t,r=new e.Vector2){r.copy(t);const n=this.curveRadius;return n&&(r.x=Math.atan2(t.x,Math.abs(n)-Math.abs(t.z))*Math.abs(n)),r}worldPositionToTextCoords(t,r=new e.Vector2){return GU.copy(t),this.localPositionToTextCoords(this.worldToLocal(GU),r)}raycast(t,e){const{textRenderInfo:r,curveRadius:n}=this;if(r){const i=r.blockBounds,o=n?YU():WU(),s=o.geometry,{position:a,uv:u}=s.attributes;for(let t=0;t<u.count;t++){let e=i[0]+u.getX(t)*(i[2]-i[0]);const r=i[1]+u.getY(t)*(i[3]-i[1]);let o=0;n&&(o=n-Math.cos(e/n)*n,e=Math.sin(e/n)*n),a.setXYZ(t,e,r,o)}s.boundingSphere=this.geometry.boundingSphere,s.boundingBox=this.geometry.boundingBox,o.matrixWorld=this.matrixWorld,o.material.side=this.material.side,jU.length=0,o.raycast(t,jU);for(let t=0;t<jU.length;t++)jU[t].object=this,e.push(jU[t])}}copy(t){const e=this.geometry;return super.copy(t),this.geometry=e,ZU.forEach((e=>{this[e]=t[e]})),this}clone(){return(new this.constructor).copy(this)}}KU.forEach((t=>{const e="_private_"+t;Object.defineProperty($U.prototype,t,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})})),new e.Box3,new e.Color;var tQ={altitude:0,height:0,interactive:!1};H.prototype._createSDFText=function(){return this.object3d=new $U,this.object3d.__parent=this,this};var eQ=function(){function t(e,r,i,o){var s;l(this,t),i=n.Util.extend({},tQ,i,{layer:o}),s=u(this,t);var a=i.altitude;s._initOptions(i),console.log(i,"fffffffff"),s._createSDFText(),s.getObject3d().text=i.text,s.getObject3d().fontSize=i.fontSize,s.getObject3d().color=i.color,s.getObject3d().letterSpacing=i.letterSpacing||0,s.getObject3d().textAlign="center",s.getObject3d().anchorX=i.anchorX||"center",s.getObject3d().anchorY=i.anchorY||"middle",s.getObject3d().renderOrder=i.renderOrder,s.getObject3d().material=r,s.getObject3d().font=i.fontfile;var h=o.distanceToVector3(a,a).x,c=o.coordinateToVector3(e,h);return s.getObject3d().position.copy(c),s}return v(t,H),f(t)}(),rQ=function(){return f((function t(e,r,n){var o=this;l(this,t),0!=e.length?(this.map=n.map,this.threeLayer=n,this.textWidth=r.textWidth||40,this.textHeight=r.textHeight||40,this.beginSizeZoom=r.beginSizeZoom||3,this.endSizeZoom=r.endSizeZoom||12,this.spanSizeZoom=this.endSizeZoom-this.beginSizeZoom,this.stepSize=1/(this.endSizeZoom-this.beginSizeZoom+1),this.textDx=r.textDx||0,this.textDy=r.textDy||0,this.anchorX=r.anchorX,this.anchorY=r.anchorY,this.minZoom=r.pointMinZoom||3,this.maxZoom=r.pointMaxZoom||20,this.fontSize=r.fontSize||.4,this.letterSpacing=r.letterSpacing||0,this.textField=r.textField,this.altitude=r.altitude,this.zoomChangeCallback=r.zoomChangeCallback,this.meshs=[],this.m=this.createBillboardMaterial(new i.MeshBasicMaterial),console.log(e,"77777777777777"),e.forEach((function(t){if(t[o.textField]){console.log(t);var e=new eQ([t.longitude,t.latitude],o.m,{minZoom:o.minZoom,maxZoom:o.maxZoom,text:t[o.textField],color:t.color||"#fff",renderOrder:r.pointOrder||5,fontSize:o.fontSize,letterSpacing:o.letterSpacing,altitude:o.altitude,anchorX:o.anchorX,anchorY:o.anchorY},n);e.zoomChange=function(){o.m.uniforms.cameraToCenterDistance.value=o.map.cameraToCenterDistance,o.m.uniforms.zoomScale.value=76.43702828517625/o.map.getResolution();var t=o._getRate();o.m.uniforms.size.value=[o.textWidth*t,o.textHeight*t],o.m.uniforms.xyOffset.value=[o.textDx*t,o.textDy*t],o.zoomChangeCallback&&o.zoomChangeCallback(e)},o.meshs.push(e)}})),this.dataItems=e,n.addMesh(this.meshs),this._bindMapEvents()):console.error("需要绘制的点位数量为0")}),[{key:"createBillboardMaterial",value:function(t,e){return HF(t,Object.assign({uniforms:{canvasSize:{value:[this.map.width,this.map.height]},cameraToCenterDistance:{type:"f",value:this.map.cameraToCenterDistance},zoomScale:{type:"f",value:76.43702828517625/this.map.getResolution()},size:{value:[this.textWidth*this._getRate(),this.textHeight*this._getRate()]},xyOffset:{value:[this.textDx*this._getRate(),this.textDy*this._getRate()]}},vertexDefs:"\n uniform vec2 canvasSize;\n uniform float cameraToCenterDistance;\n uniform float zoomScale;\n uniform vec2 size;\n uniform vec2 xyOffset;\n ",vertexMainOutro:"\n\n vec2 iconSize = vec2(24, 24);\n vec3 c = position;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);\n float k = gl_Position.w;\n float l = (1. - cameraToCenterDistance / k);\n float m = clamp(.5 + .5 * (1. - l), .0, 4.);\n vec2 A = position.xy;\n A = A * size;\n \n vec2 B = A * 2. / canvasSize;\n gl_Position.xy += B * m * k;\n\n //float C = k / cameraToCenterDistance;\n //vec2 B = A;\n //gl_Position = projectionMatrix * modelViewMatrix * vec4(vec3(B, .0) / zoomScale * C * m, 1.);\n\n\n gl_Position.xy += xyOffset * 2. / canvasSize * k;\n "},e))}},{key:"_getRate",value:function(){var t=this.map.getZoom()-this.beginSizeZoom;return(t=t>this.spanSizeZoom?this.spanSizeZoom:t)*this.stepSize+this.stepSize}},{key:"_bindMapEvents",value:function(){this.map.on("pitch",this._setSizeOn,this)}},{key:"_setSizeOn",value:function(){this.m.uniforms.cameraToCenterDistance.value=this.map.cameraToCenterDistance}},{key:"show",value:function(){this.meshs.forEach((function(t){t.show()}))}},{key:"hide",value:function(){this.meshs.forEach((function(t){t.hide()}))}},{key:"pointShowHideByCode",value:function(t,e,r){for(var i=1/0,o=1/0,s=-1/0,a=-1/0,u=0;u<this.dataItems.length;u++){var l=this.dataItems[u];t.includes(l.code)?(i=Math.min(i,this.dataItems[u].longitude),o=Math.min(o,this.dataItems[u].latitude),s=Math.max(s,this.dataItems[u].longitude),a=Math.max(a,this.dataItems[u].latitude),l.visibility=1):l.visibility=.1}this.updateByVisibility(),e&&this.map.fitExtent(new n.Extent(i,o,s,a),r||0)}},{key:"updateByVisibility",value:function(){var t=this;this.meshs.forEach((function(e,r){.1===t.dataItems[r].visibility?e.hide():e.show()}))}},{key:"dispose",value:function(){var t,e=this;this.meshs.forEach((function(t){e.threeLayer.removeMesh(t),t.object3d.dispose()})),null===(t=this.m)||void 0===t||t.dispose()}}],[{key:"preloadFont",value:function(t){return new Promise((function(t){!function({font:t,characters:e,sdfGlyphSize:r},n){MU({font:t,sdfGlyphSize:r,text:Array.isArray(e)?e.join("\n"):""+e},n)}({font:"/NotoSerifSC-Regular.otf"},(function(){t()}))}))}}])}(),nQ="__webglFramebuffer",iQ=new i.Vector4,oQ={bloom:!0},sQ=1*i.REVISION>154?Math.PI:1;function aQ(t,e){if(t){t.layers&&t.layers.set(e);var r=t.children;if(r&&r.length)for(var n=0,i=r.length;n<i;n++)aQ(r[n],e)}}ko.prototype.renderScene=function(t){if(this.layer._callbackBaseObjectAnimation(),this._syncCamera(),t&&t.renderTarget){var e=t.renderTarget.fbo,r=e.width,n=e.height;this._renderTarget?(this._renderTarget.viewport.set(0,0,r,n),this._renderTarget.scissor.set(0,0,r,n)):(this._renderTarget=new i.WebGLRenderTarget(r,n,{depthBuffer:!1}),this.context.setRenderTarget(this._renderTarget),this.context.render(this.scene,this.camera));var o=this.context.properties.get(this._renderTarget),s=o[nQ];o[nQ]=t.renderTarget.getFramebuffer(t.renderTarget.fbo),this.context.setRenderTarget(this._renderTarget);var a=1===t.bloom&&t.sceneFilter,u=this.scene.children||[],l=!1;if(a){var h=t.sceneFilter;l=h(oQ);for(var c=0,f=u.length;c<f;c++)if(u[c]&&u[c].layers){var p=u[c].__parent;u[c].bloom=!1,p&&(u[c].bloom=p.bloom);var d=0;(u[c]&&h(u[c])||!p)&&(u[c].customType||l&&(d=1)),u[c].__layer!==d&&(aQ(u[c],d),u[c].__layer=d)}}else for(var g=0,y=u.length;g<y;g++)u[g]&&u[g].layers&&0!==u[g].__layer&&(aQ(u[g],0),u[g].__layer=0);this.camera.layers.set(l?1:0),this.context.render(this.scene,this.camera),o[nQ]=s}else{var v=this.canvas,m=v.width,A=v.height,_=this.context.getViewport(iQ);_.width===m&&_.height===A||this.context.setViewport(0,0,m,A),this.context.render(this.scene,this.camera),this.layer.updateComposer()}this.context.setRenderTarget(null),this.completeRender()},Bo.prototype.initEnvironment=function(t){var e=this.getScene(),r=(new RF).load(t,(function(){r.mapping=i.EquirectangularReflectionMapping,e.environment=r}))},Bo.prototype.initBloom=function(){var t=this.getThreeRenderer(),e=this.getScene(),r=this.getCamera();this.composer=new ON(t,{frameBufferType:i.HalfFloatType}),this.composer.addPass(new mF(e,r))},Bo.prototype.delComposer=function(){var t;null===(t=this.composer)||void 0===t||t.dispose()},Bo.prototype.updateComposer=function(){var t;null===(t=this.composer)||void 0===t||t.render()},Bo.prototype.getComposer=function(){return this.composer},Bo.prototype._recursionMesh=function(t){for(;t&&t.parent!==this.getScene()&&!t.parent.customType;)t=t.parent;return t},Bo.prototype.identify=function(t,e){var r=this;if(!t)return console.error("coordinate is null,it should be Coordinate"),[];if(Array.isArray(t)&&(t=new n.Coordinate(t)),!(t instanceof n.Coordinate))return console.error("coordinate type is error,it should be Coordinate"),[];var o=this.getMap().coordToContainerPoint(t);this._containerPoint=o;var s=o.x,a=o.y;this._initRaycaster(),this.fire("identify",{coordinate:t,options:e});var u=this._raycaster,l=this._mouse,h=this.getCamera(),c=this.getScene(),f=this.getMap().getSize();if(!c)return[];var p=f.width,d=f.height;l.x=s/p*2-1,l.y=-a/d*2+1,u.setFromCamera(l,h),u.layers&&u.layers.enableAll&&u.layers.enableAll(),function(t,e){t.linePrecision=e}(u,this._getLinePrecision(this.getMap().getResolution()));var g=[],y=[];c.children.forEach((function(t){var e=t.__parent;if(e&&e.getOptions){var r=e;r.getOptions().interactive&&r.isVisible()&&(r.identify&&n.Util.isFunction(r.identify)?y.push(r):g.push(t))}else(t instanceof i.Mesh||t instanceof i.Group)&&t.customType&&t.children.forEach((function(t){var e=t.__parent;if(e&&e.getOptions){var r=e;r.getOptions().interactive&&r.isVisible()&&(r.identify&&n.Util.isFunction(r.identify)?y.push(r):g.push(t))}}))}));var v=[],m=u.intersectObjects(g,!0);m&&Array.isArray(m)&&m.length&&(v=m.map((function(t){var e=t.object,i=t.instanceId,o=(e=r._recursionMesh(e)||{}).__parent||e;return o.faceIndex=t.faceIndex,o.index=t.index,o.intersect=t,n.Util.isNumber(i)&&(o.instanceId=i),o}))),this.renderPickScene(),y.length&&y.forEach((function(e){e.identify(t)&&v.push(e)}));for(var A=v.length,_=0;_<A;_++)if(v[_])for(var x=_+1;x<A;x++)v[_]===v[x]&&v.splice(x,1);var w=(e=n.Util.extend({},e)).count;return v.sort((function(t,e){return e.object3d.renderOrder-t.object3d.renderOrder})),n.Util.isNumber(w)&&w>0?v.slice(0,w):v},Bo.prototype._zoomend=function(){var t=this.getScene();if(t){var e=this.getMap().getZoom();t.children.forEach((function(t){if(t.customType)t.children.forEach((function(t){var r=t.__parent;if(r&&r.getOptions){var i=r;i.zoomChange&&n.Util.isFunction(i.zoomChange)&&i.zoomChange(e);var o=i.getMinZoom(),s=i.getMaxZoom();e<o||e>s?(i.isVisible()&&(i.getObject3d().visible=!1),i._zoomVisible=!1):o<=e&&e<=s&&(i._visible&&(i.getObject3d().visible=!0),i._zoomVisible=!0)}}));else{var r=t.__parent;if(r&&r.getOptions){var i=r;i.zoomChange&&n.Util.isFunction(i.zoomChange)&&i.zoomChange(e);var o=i.getMinZoom(),s=i.getMaxZoom();e<o||e>s?(i.isVisible()&&(i.getObject3d().visible=!1),i._zoomVisible=!1):o<=e&&e<=s&&(i._visible&&(i.getObject3d().visible=!0),i._zoomVisible=!0)}}}))}},Bo.prototype.addMesh1=function(t,e){var r=this,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)return this;Array.isArray(t)||(t=[t]);var i=this.getScene(),o=void 0;if(e&&(o=i.getObjectByProperty("customId",e)),t.forEach((function(t){if(t instanceof H){var e;if(o)o.add(t.getObject3d());else console.log("组不存在,销毁创建的对象"),null===(e=t.parent)||void 0===e||e.dispose();t.isAdd||(t.isAdd=!0,t.options.layer=r,t._fire("add",{target:t}))}})),this._zoomend(),n){var s=this._getRenderer();s&&s.setToRedraw()}return this},Bo.prototype.removeMesh1=function(t,e){var r=this,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)return this;Array.isArray(t)||(t=[t]);var s=this.getScene(),a=s.getObjectByProperty("customId",e);if(t.forEach((function(t){if(t instanceof H){a?a.remove(t.getObject3d()):s.remove(t.getObject3d()),t.isAdd&&(t.isAdd=!1,t._fire("remove",{target:t})),t._animation&&n.Util.isFunction(t._animation)&&delete r._animationBaseObjectMap[t.getObject3d().uuid];var e=r._delayMeshes;if(e.length)for(var o=0,u=e.length;o<u;o++)if(e[o]===t){e.splice(o,1);break}}else t instanceof i.Object3D&&s.remove(t)})),o){var u=this._getRenderer();u&&u.setToRedraw()}return this};var uQ=function(){return f((function t(e,r,n){var o=this;l(this,t),this.map=r,this.animationId=null,this.updatables=[];var s=YC();this.threeLayer=new Bo(s,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new i.Clock;var a=function(){o.threeLayer._needsUpdate=!o.threeLayer._needsUpdate,o.threeLayer._needsUpdate&&o.threeLayer.redraw();var t,e=o.clock.getDelta(),r=p(o.updatables);try{for(r.s();!(t=r.n()).done;){t.value.tick(e)}}catch(t){r.e(t)}finally{r.f()}o.statsFlag&&o.stats.update(),o.animationId=requestAnimationFrame(a)};this.threeLayer.prepareToDraw=function(t,e,r){var n=new i.DirectionalLight(16777215);n.position.set(0,-10,10).normalize(),e.add(n),a()},null!=n&&n.groupLayer?this.threeLayer.addTo(n.groupLayer):this.threeLayer.addTo(r),this.groupLayer=null==n?void 0:n.groupLayer,this.layerId=s,this.layerName=e,this.dirty=!1,this.initFlag=!1,this.bloomFlag=(null==n?void 0:n.bloomFlag)||!1,this.bloomStrength=null==n?void 0:n.bloomStrength,this.bloomThreshold=null==n?void 0:n.bloomThreshold,this.bloomRadius=null==n?void 0:n.bloomRadius,this.hdrPath=null==n?void 0:n.hdrPath,this.ambientLightIntensity=(null==n?void 0:n.ambientLightIntensity)||1,this.stats=new TF,this.stats.dom.style.display="none",document.body.appendChild(this.stats.dom),this.statsFlag=!1}),[{key:"createGroup",value:(t=a(x().mark((function t(e){return x().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.threeLayer.getScene()){t.next=4;break}return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 4:if(!0!==this.initFlag){t.next=10;break}return t.next=7,XC(200);case 7:case 13:return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 10:return this.initFlag=!0,t.next=13,this.prepareToDraw();case 14:case"end":return t.stop()}}),t,this)}))),function(e){return t.apply(this,arguments)})},{key:"removeGroup",value:function(t){if(this.threeLayer.getScene()){var e=this.threeLayer.getScene().getObjectByName(t);this.threeLayer.getScene().remove(e)}}},{key:"getIdByName",value:function(t,e){var r=t.getObjectByName(e);return r||(r=new vD(t,e)),r.customId}},{key:"setGroupVisible",value:function(t,e){this.threeLayer.getScene().getObjectByProperty("customId",t).visible=e}},{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=YC();this.threeLayer.setId(t),this.layerId=t}}},{key:"setVisible",value:function(t,e){this.threeLayer&&(!0===t?(this.threeLayer.show(),e&&e()):(this.threeLayer.hide(),e&&e()))}},{key:"prepareToDraw",value:function(){var t=this,e=function(){t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate&&t.threeLayer.redraw();var r,n=t.clock.getDelta(),i=p(t.updatables);try{for(i.s();!(r=i.n()).done;){r.value.tick(n)}}catch(t){i.e(t)}finally{i.f()}t.statsFlag&&t.stats.update(),t.animationId=requestAnimationFrame(e)};return new Promise((function(r){var n=t;t.threeLayer.prepareToDraw=function(t,o,s){n.hdrPath&&this.initEnvironment(n.hdrPath);var a=new i.DirectionalLight(16777215,1*sQ);a.position.set(0,-10,10).normalize(),o.add(a),o.add(new i.AmbientLight(16777215,n.ambientLightIntensity*sQ)),e(),this.initBloom(),r()}}))}},{key:"drawRadar",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new _S(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new _S(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawRadar1",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new xS(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new xS(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawRadar2",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new wS(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new wS(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawRadar3",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new bS(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new bS(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSector",value:function(t,e,r,n){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new CS(t,e,r||{},i.threeLayer,n);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new CS(t,e,r||{},i.threeLayer,n);o(s)}))}))}},{key:"drawRing",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new NF(t,e,r,n||{},o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new NF(t,e,r,n||{},o.threeLayer,i);s(a)}))}))}},{key:"drawSectorImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new TS(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new TS(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawImage",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new vS(t,e,r,n,o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new vS(t,e,r,n,o.threeLayer,i);s(a)}))}))}},{key:"drawShock",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new LS(t,e||{},r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new LS(t,e||{},r.threeLayer,r);n(i)}))}))}},{key:"drawPoybyHeight",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new LF(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new LF(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawSdfText",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=null;t.length>0?o=new rQ(t,e,n.threeLayer,r):i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=null;t.length>0?o=new rQ(t,e,n.threeLayer,r):i(o)}))}))}},{key:"drawPlaneMarker",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=null;t.length>0?(o=new KS(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=null;t.length>0?(o=new KS(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}))}))}},{key:"draw3dtiles",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new pD(t,e,r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new pD(t,e,r.threeLayer,r);n(i)}))}))}},{key:"createGltfLoadTool",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new yD(t,e.threeLayer);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new yD(t,e.threeLayer);r(n)}))}))}},{key:"drawFbxModel",value:function(t,e,r,n){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new yO(t,e,r,i.threeLayer,n);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new yO(t,e,r,i.threeLayer,n);o(s)}))}))}},{key:"drawRippleWall",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new AO(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new AO(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawWall",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new _O(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new _O(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawRippleWallImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new xO(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new xO(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawBloomLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new EN(t,e,n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new EN(t,e,n.threeLayer,r);i(o)}))}))}},{key:"createBloomClass",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new MF(e.threeLayer,t);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new MF(e.threeLayer,t);r(n)}))}))}},{key:"createOutlineBloom",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new BF(e.threeLayer,t);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new BF(e.threeLayer,t);r(n)}))}))}},{key:"drawPolyline",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new IO(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new IO(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawPolygon",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new vN(t,e,n.threeLayer,r);o.generatePolygon().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new vN(t,e,n.threeLayer,r);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawExtrudePolygon",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new _N(t,e,n.threeLayer,r);o.generatePolygon().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new _N(t,e,n.threeLayer,r);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawLinePlane",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new MO(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new MO(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawVerticalFatLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new KO(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new KO(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawTube",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new nN(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new nN(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPlaneGif",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new tN(t,e,r,n||{},o.threeLayer,o,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new tN(t,e,r,n||{},o.threeLayer,o,i);s(a)}))}))}},{key:"drawTripHeight",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new uN(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new uN(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawTripHeight1",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new lN(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new lN(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawTripLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new hN(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new hN(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawTripLine1",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new cN(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new cN(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawArrow2D",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new bN(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new bN(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"setStateFlag",value:function(){this.statsFlag=!this.statsFlag,this.statsFlag?this.stats.dom.style.display="":this.stats.dom.style.display="none"}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var t=this.threeLayer.getMeshes();this.threeLayer.delComposer(),this.threeLayer.clear(),t.forEach((function(t){}));var e=this.threeLayer.getCamera(),r=this.threeLayer.getScene(),n=this.threeLayer.getPick(),i=n.pickingTexture;n.pickingScene;var o=this.threeLayer.getRenderer();r.remove(e),e=null,r=null,i.dispose(),i=null,this.groupLayer?this.groupLayer.removeLayer(this.threeLayer):(o.context.dispose(),o.context.forceContextLoss(),o.context=null,o.remove(),o=null,this.map.removeLayer(this.threeLayer))}}]);var t}(),lQ=function(){return f((function t(e,r){var n=this;l(this,t),this.map=r,this.animationId=null,this.updatables=[];var o=YC();this.threeLayer=new Bo(o,{forceRenderOnMoving:!0,forceRenderOnRotating:!0,identifyCountOnEvent:1}),this.clock=new i.Clock;var s=function(){var t;(n.threeLayer._needsUpdate=!n.threeLayer._needsUpdate,n.threeLayer._needsUpdate)&&(null===(t=n.threeLayer)||void 0===t||null===(t=t.getRenderer())||void 0===t||t.clearCanvas(),n.threeLayer.renderScene());var e,r=n.clock.getDelta(),i=p(n.updatables);try{for(i.s();!(e=i.n()).done;){e.value.tick(r)}}catch(t){i.e(t)}finally{i.f()}n.animationId=requestAnimationFrame(s)};this.threeLayer.prepareToDraw=function(t,e,r){var n=new i.DirectionalLight(16777215);n.position.set(0,-10,10).normalize(),e.add(n),s()},this.threeLayer.addTo(r),this.layerId=o,this.layerName=e,this.dirty=!1,this.initFlag=!1}),[{key:"createGroup",value:(t=a(x().mark((function t(e){return x().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.threeLayer.getScene()){t.next=4;break}return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 4:if(!0!==this.initFlag){t.next=10;break}return t.next=7,XC(200);case 7:case 13:return t.abrupt("return",this.getIdByName(this.threeLayer.getScene(),e));case 10:return this.initFlag=!0,t.next=13,this.prepareToDraw();case 14:case"end":return t.stop()}}),t,this)}))),function(e){return t.apply(this,arguments)})},{key:"removeGroup",value:function(t){if(this.threeLayer.getScene()){var e=this.threeLayer.getScene().getObjectByName(t);this.threeLayer.getScene().remove(e)}}},{key:"getIdByName",value:function(t,e){var r=t.getObjectByName(e);return r||(r=new vD(t,e)),r.customId}},{key:"setGroupVisible",value:function(t,e){this.threeLayer.getScene().getObjectByProperty("customId",t).visible=e}},{key:"getLayerId",value:function(){return this.layerId}},{key:"changeLayerId",value:function(){if(this.threeLayer){var t=YC();this.threeLayer.setId(t),this.layerId=t}}},{key:"setVisible",value:function(t,e){this.threeLayer&&(!0===t?(this.threeLayer.show(),e&&e()):(this.threeLayer.hide(),e&&e()))}},{key:"prepareToDraw",value:function(){var t=this,e=function(){var r;(t.threeLayer._needsUpdate=!t.threeLayer._needsUpdate,t.threeLayer._needsUpdate)&&(null===(r=t.threeLayer)||void 0===r||null===(r=r.getRenderer())||void 0===r||r.clearCanvas(),t.threeLayer.renderScene());var n,i=t.clock.getDelta(),o=p(t.updatables);try{for(o.s();!(n=o.n()).done;){n.value.tick(i)}}catch(t){o.e(t)}finally{o.f()}t.animationId=requestAnimationFrame(e)};return new Promise((function(r){t.threeLayer.prepareToDraw=function(t,n,o){var s=new i.DirectionalLight(16777215);s.position.set(0,-10,10).normalize(),n.add(s),n.add(new i.AmbientLight(16777215)),e(),r()}}))}},{key:"drawRadar",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new _S(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new _S(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSector",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new CS(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new CS(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawSectorImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new TS(t,e,r||{},n.threeLayer,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new TS(t,e,r||{},n.threeLayer,n);i(o)}))}))}},{key:"drawImage",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new vS(t,e,r,n,o.threeLayer,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new vS(t,e,r,n,o.threeLayer,i);s(a)}))}))}},{key:"drawShock",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new LS(t,e||{},r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new LS(t,e||{},r.threeLayer,r);n(i)}))}))}},{key:"drawPlaneMarker",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=null;t.length>0?(o=new KS(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=null;t.length>0?(o=new KS(t,e,n.threeLayer,r)).addPoint().then((function(){i(o)})):i(o)}))}))}},{key:"draw3dtiles",value:function(t,e){var r=this;return new Promise((function(n){if(r.threeLayer.getScene()){var i=new pD(t,e,r.threeLayer,r);n(i)}else r.initFlag=!0,r.prepareToDraw().then((function(){var i=new pD(t,e,r.threeLayer,r);n(i)}))}))}},{key:"createGltfLoadTool",value:function(t){var e=this;return new Promise((function(r){if(e.threeLayer.getScene()){var n=new yD(t,e.threeLayer);r(n)}else e.initFlag=!0,e.prepareToDraw().then((function(){var n=new yD(t,e.threeLayer);r(n)}))}))}},{key:"drawFbxModel",value:function(t,e,r,n){var i=this;return new Promise((function(o){if(i.threeLayer.getScene()){var s=new yO(t,e,r,i.threeLayer,n);o(s)}else i.initFlag=!0,i.prepareToDraw().then((function(){var s=new yO(t,e,r,i.threeLayer,n);o(s)}))}))}},{key:"drawRippleWall",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new AO(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new AO(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawRippleWallImg",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new xO(t,e||{},n.threeLayer,r,n);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new xO(t,e||{},n.threeLayer,r,n);i(o)}))}))}},{key:"drawPolyline",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new IO(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new IO(t,e,n.threeLayer,r);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawPolygon",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new vN(t,e,n.threeLayer,r);o.generatePolygon().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new vN(t,e,n.threeLayer,r);lineObject.generatePolygon().then((function(){i(o)}))}))}))}},{key:"drawLinePlane",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new MO(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new MO(t,e,n.threeLayer,r,n);o.addLine().then((function(){i(o)}))}))}))}},{key:"drawVerticalFatLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new KO(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new KO(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawTube",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new nN(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new nN(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"drawPlaneGif",value:function(t,e,r,n,i){var o=this;return new Promise((function(s){if(o.threeLayer.getScene()){var a=new tN(t,e,r,n||{},o.threeLayer,o,i);s(a)}else o.initFlag=!0,o.prepareToDraw().then((function(){var a=new tN(t,e,r,n||{},o.threeLayer,o,i);s(a)}))}))}},{key:"drawTripHeight",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new uN(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new uN(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawTripLine",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new hN(t,e||{},n.threeLayer,n,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new hN(t,e||{},n.threeLayer,n,r);i(o)}))}))}},{key:"drawArrow2D",value:function(t,e,r){var n=this;return new Promise((function(i){if(n.threeLayer.getScene()){var o=new bN(t,e||{},n.threeLayer,r);i(o)}else n.initFlag=!0,n.prepareToDraw().then((function(){var o=new bN(t,e||{},n.threeLayer,r);i(o)}))}))}},{key:"dispose",value:function(){this.animationId&&cancelAnimationFrame(this.animationId);var t=this.threeLayer.getMeshes();this.threeLayer.clear(),t.forEach((function(t){}));var e=this.threeLayer.getCamera(),r=this.threeLayer.getScene(),n=this.threeLayer.getPick(),i=n.pickingTexture;n.pickingScene;var o=this.threeLayer.getRenderer();r.remove(e),e=null,r=null,i.dispose(),i=null,o.context.dispose(),o.context.forceContextLoss(),o.context=null,o.remove(),o=null,this.map.removeLayer(this.threeLayer)}}]);var t}(),hQ=function(){return f((function t(e,r,i,o){l(this,t),this.map=o,this.geometry=null,this.selectGeometry=null,this.isEndSelect=!1,this.drawTool=new n.DrawTool({mode:e,symbol:{lineColor:i.lineColor||"#E40D56",lineWidth:2,lineDasharray:[5,5],polygonFill:i.polygonFill||"#E40D56",polygonOpacity:.2}}).addTo(this.map).enable(),this._bindEvent(),this._drawEnd=r,this.mode=e,this.toolLayer=new n.VectorLayer(n.Util.GUID(),{geometryEvents:!1,hitDetect:!1}).addTo(this.map),this.geometry&&(this.toolLayer.addGeometry(this.geometry),this._drawEnd&&("Circle"===this.mode?this._drawEnd(this.geometry.getCoordinates(),this.geometry.getRadius()):this._drawEnd(this.geometry.getCoordinates()))),i.zIndex&&this.toolLayer.setZIndex(i.zIndex),this.type="drawTool"}),[{key:"getZIndex",value:function(){this.toolLayer&&this.toolLayer.getZIndex()}},{key:"setZIndex",value:function(t){this.toolLayer&&this.toolLayer.setZIndex(t)}},{key:"selectGeometryByPoint",value:function(){this.map.on("click",this._selectGeometry,this)}},{key:"endSelect",value:function(){this.toolLayer&&this.selectGeometry&&(this._changeSymbol(!1),this.selectGeometry.endEdit(),this.selectGeometry=null),this.map.off("click",this._selectGeometry,this)}},{key:"_selectGeometry",value:function(t){if(this.disableTool(),this.toolLayer){var e=this.toolLayer.identify(t.coordinate);this.selectGeometry&&(this.selectGeometry.endEdit(),this._changeSymbol(!1)),e&&(this.selectGeometry=e[0]),this.selectGeometry&&this._changeSymbol(!0)}}},{key:"_closeMapEvent",value:function(){this.map.off("click",this._selectGeometry,this)}},{key:"_changeSymbol",value:function(t){t?this.selectGeometry.setSymbol({lineColor:"#00ffff",lineWidth:2,lineDasharray:[5,5],polygonFill:"#00ffff",polygonOpacity:.2}):this.selectGeometry.setSymbol({lineColor:"#E40D56",lineWidth:2,lineDasharray:[5,5],polygonFill:"#E40D56",polygonOpacity:.2})}},{key:"deleteGeometry",value:function(){this.toolLayer&&this.selectGeometry&&(this.selectGeometry.endEdit(),this.toolLayer.removeGeometry(this.selectGeometry))}},{key:"undoDrawGeometry",value:function(){if(this.toolLayer){var t=this.toolLayer.getGeometries();if(t.length<1)return;this.toolLayer.removeGeometry(t[t.length-1])}}},{key:"_bindEvent",value:function(){this.drawTool.on("drawend",this.drawEnd,this)}},{key:"_closeEvent",value:function(){this.drawTool.off("drawend",this.drawEnd,this)}},{key:"drawEnd",value:function(t){this.toolLayer&&this.toolLayer.addGeometry(t.geometry),this._drawEnd&&("Circle"===this.mode?this._drawEnd(t.geometry.getCoordinates(),t.geometry.getRadius()):this._drawEnd(t.geometry.getCoordinates())),this.geometry=t.geometry}},{key:"disableTool",value:function(){this.drawTool.disable()}},{key:"clearGeometry",value:function(){this.toolLayer&&this.toolLayer.clear()}},{key:"setMode",value:function(t,e){this._drawEnd&&delete this._drawEnd,this._drawEnd=e,this.drawTool.setMode(t).enable(),this.mode=t}},{key:"startEdit",value:function(){this.disableTool(),this.selectGeometry&&this.selectGeometry.startEdit()}},{key:"endEdit",value:function(t){this.selectGeometry&&(this.selectGeometry.endEdit(),t&&("Circle"===this.mode?t(this.selectGeometry.getCoordinates(),this.geometry.getRadius()):t(this.selectGeometry.getCoordinates())))}},{key:"dispose",value:function(){this.drawTool&&(this._closeEvent(),this.endEdit(),this.disableTool(),delete this.drawTool),this._drawEnd&&delete this._drawEnd,this.geometry&&delete this.geometry,this.selectGeometry&&delete this.selectGeometry,this.map&&this._closeMapEvent(),this.map.removeLayer(this.toolLayer),delete this.toolLayer}}])}();function cQ(){this.PI=3.141592653589793,this.x_PI=52.35987755982988,this.a=6378245,this.ee=.006693421622965943,this.EARTHRADIUS=6370996.81,this.MCBAND=[12890594.86,8362377.87,5591021,3481989.83,1678043.12,0],this.LLBAND=[75,60,45,30,15,0],this.MC2LL=[[1.410526172116255e-8,898305509648872e-20,-1.9939833816331,200.9824383106796,-187.2403703815547,91.6087516669843,-23.38765649603339,2.57121317296198,-.03801003308653,17337981.2],[-7.435856389565537e-9,8983055097726239e-21,-.78625201886289,96.32687599759846,-1.85204757529826,-59.36935905485877,47.40033549296737,-16.50741931063887,2.28786674699375,10260144.86],[-3.030883460898826e-8,898305509983578e-20,.30071316287616,59.74293618442277,7.357984074871,-25.38371002664745,13.45380521110908,-3.29883767235584,.32710905363475,6856817.37],[-1.981981304930552e-8,8983055099779535e-21,.03278182852591,40.31678527705744,.65659298677277,-4.44255534477492,.85341911805263,.12923347998204,-.04625736007561,4482777.06],[3.09191371068437e-9,8983055096812155e-21,6995724062e-14,23.10934304144901,-.00023663490511,-.6321817810242,-.00663494467273,.03430082397953,-.00466043876332,2555164.4],[2.890871144776878e-9,8983055095805407e-21,-3.068298e-8,7.47137025468032,-353937994e-14,-.02145144861037,-1234426596e-14,.00010322952773,-323890364e-14,826088.5]],this.LL2MC=[[-.0015702102444,111320.7020616939,0x60e374c3105a3,-0x24bb4115e2e164,0x5cc55543bb0ae8,-0x7ce070193f3784,0x5e7ca61ddf8150,-0x261a578d8b24d0,0x665d60f3742ca,82.5],[.0008277824516172526,111320.7020463578,647795574.6671607,-4082003173.641316,10774905663.51142,-15171875531.51559,12053065338.62167,-5124939663.577472,913311935.9512032,67.5],[.00337398766765,111320.7020202162,4481351.045890365,-23393751.19931662,79682215.47186455,-115964993.2797253,97236711.15602145,-43661946.33752821,8477230.501135234,52.5],[.00220636496208,111320.7020209128,51751.86112841131,3796837.749470245,992013.7397791013,-1221952.21711287,1340652.697009075,-620943.6990984312,144416.9293806241,37.5],[-.0003441963504368392,111320.7020576856,278.2353980772752,2485758.690035394,6070.750963243378,54821.18345352118,9540.606633304236,-2710.55326746645,1405.483844121726,22.5],[-.0003218135878613132,111320.7020701615,.00369383431289,823725.6402795718,.46104986909093,2351.343141331292,1.58060784298199,8.77738589078284,.37238884252424,7.45]],this._transformlat=function(t,e){var r=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,r+=2*(20*Math.sin(e*this.PI)+40*Math.sin(e/3*this.PI))/3,r+=2*(160*Math.sin(e/12*this.PI)+320*Math.sin(e*this.PI/30))/3},this._transformlng=function(t,e){var r=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return r+=2*(20*Math.sin(6*t*this.PI)+20*Math.sin(2*t*this.PI))/3,r+=2*(20*Math.sin(t*this.PI)+40*Math.sin(t/3*this.PI))/3,r+=2*(150*Math.sin(t/12*this.PI)+300*Math.sin(t/30*this.PI))/3},this._out_of_china=function(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271||!1},this._getLoop=function(t,e,r){for(;t>r;)t-=r-e;for(;t<e;)t+=r-e;return t},this._getRange=function(t,e,r){return null!=e&&(t=Math.max(t,e)),null!=r&&(t=Math.min(t,r)),t}}cQ.prototype.BD2GCJ=function(t,e){var r=t-.0065,n=e-.006,i=Math.sqrt(r*r+n*n)-2e-5*Math.sin(n*this.x_PI),o=Math.atan2(n,r)-3e-6*Math.cos(r*this.x_PI);return[i*Math.cos(o),i*Math.sin(o)]},cQ.prototype.GCJ2BD=function(t,e){var r=Math.sqrt(t*t+e*e)+2e-5*Math.sin(e*this.x_PI),n=Math.atan2(e,t)+3e-6*Math.cos(t*this.x_PI);return[r*Math.cos(n)+.0065,r*Math.sin(n)+.006]},cQ.prototype.WGS2GCJ=function(t,e){if(this._out_of_china(t,e))return[t,e];var r=this._transformlat(t-105,e-35),n=this._transformlng(t-105,e-35),i=e/180*this.PI,o=Math.sin(i);o=1-this.ee*o*o;var s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.PI),[t+(n=180*n/(this.a/s*Math.cos(i)*this.PI)),e+r]},cQ.prototype.GCJ2WGS=function(t,e){if(this._out_of_china(t,e))return[t,e];var r=this._transformlat(t-105,e-35),n=this._transformlng(t-105,e-35),i=e/180*this.PI,o=Math.sin(i);o=1-this.ee*o*o;var s=Math.sqrt(o);return r=180*r/(this.a*(1-this.ee)/(o*s)*this.PI),[2*t-(t+(n=180*n/(this.a/s*Math.cos(i)*this.PI))),2*e-(e+r)]},cQ.prototype.WGS2BD=function(t,e){var r=this.WGS2GCJ(t,e);return r=this.GCJ2BD(r[0],r[1])},cQ.prototype.BD2WGS=function(t,e){var r=this.BD2GCJ(t,e);return r=this.GCJ2WGS(r[0],r[1])},cQ.prototype.BD_MKT2WGS=function(t,e){var r=null;t=Math.abs(t),e=Math.abs(e);for(var n=0;n<this.MCBAND.length;n++)if(e>=this.MCBAND[n]){r=this.MC2LL[n];break}t=r[0]+r[1]*Math.abs(t);var i=Math.abs(e)/r[9];return e=r[2]+r[3]*i+r[4]*i*i+r[5]*i*i*i+r[6]*i*i*i*i+r[7]*i*i*i*i*i+r[8]*i*i*i*i*i*i,[t*=t<0?-1:1,e*=e<0?-1:1]},cQ.prototype.BD_WGS2MKT=function(t,e){var r=null;t=this._getLoop(t,-180,180),e=this._getRange(e,-74,74);for(var n=0;n<this.LLBAND.length;n++)if(e>=this.LLBAND[n]){r=this.LL2MC[n];break}if(null!=r)for(n=this.LLBAND.length-1;n>=0;n--)if(e<=-this.LLBAND[n]){r=this.LL2MC[n];break}t=r[0]+r[1]*Math.abs(t);var i=Math.abs(e)/r[9];return e=r[2]+r[3]*i+r[4]*i*i+r[5]*i*i*i+r[6]*i*i*i*i+r[7]*i*i*i*i*i+r[8]*i*i*i*i*i*i,[t*=t<0?-1:1,e*=e<0?-1:1]};var fQ=function(){return f((function t(e,r,i){l(this,t),this.map=r,this.overlayer=new n.VectorLayer("overLayer",{geometryEvents:!1,hitDetect:!1,forceRenderOnMoving:!0,forceRenderOnRotating:!0,enableSimplify:!1}),this.overlayer.addTo(this.map);var o=new n.MultiPolygon(e,{symbol:{polygonFill:i.color||"#000",polygonOpacity:i.opacity||1,lineWidth:0}});this.overlayer.addGeometry(o)}),[{key:"dispose",value:function(){this.map.removeLayer(this.overlayer),delete this.toolLayer}}])}();
190
190
  /*!
191
191
  * maptalks.animatemarker v0.4.1
192
192
  * LICENSE : MIT