@navaramap/worker 0.0.1 → 0.0.2

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,6 +1,6 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@navaramap/engine`),require(`@navaramap/engine-worker`)):typeof define==`function`&&define.amd?define([`exports`,`@navaramap/engine`,`@navaramap/engine-worker`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.NavaraWorker={},e._navaramap_engine,e._navaramap_engine_worker))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e},d=(e,t,n)=>(n=e==null?{}:r(s(e)),u(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e));n=d(n,1);var f=!0,p=`Invariant failed`;function m(e,t){if(!e){if(f)throw Error(p);var n=typeof t==`function`?t():t,r=n?`${p}: ${n}`:p;throw Error(r)}}var h=l(((e,t)=>{t.exports={}})),g=l(((e,t)=>{var n=function(e){return e!==void 0&&e.versions!=null&&e.versions.node!=null&&e+``==`[object process]`};t.exports.isNode=n,t.exports.platform=typeof process<`u`&&n(process)?`node`:`browser`;var r=t.exports.platform===`node`&&h();t.exports.isMainThread=t.exports.platform===`node`?(!r||r.isMainThread)&&!process.connected:typeof Window<`u`,t.exports.cpus=t.exports.platform===`browser`?self.navigator.hardwareConcurrency:h().cpus().length})),_=l((e=>{function t(e,a){var o=this;if(!(this instanceof t))throw SyntaxError(`Constructor must be called with the new operator`);if(typeof e!=`function`)throw SyntaxError(`Function parameter handler(resolve, reject) missing`);var s=[],c=[];this.resolved=!1,this.rejected=!1,this.pending=!0,this[Symbol.toStringTag]=`Promise`;var l=function(e,t){s.push(e),c.push(t)};this.then=function(e,r){return new t(function(t,i){var a=e?n(e,t,i):t,o=r?n(r,t,i):i;l(a,o)},o)};var u=function(e){return o.resolved=!0,o.rejected=!1,o.pending=!1,s.forEach(function(t){t(e)}),l=function(t,n){t(e)},u=d=function(){},o},d=function(e){return o.resolved=!1,o.rejected=!0,o.pending=!1,c.forEach(function(t){t(e)}),l=function(t,n){n(e)},u=d=function(){},o};this.cancel=function(){return a?a.cancel():d(new r),o},this.timeout=function(e){if(a)a.timeout(e);else{var t=setTimeout(function(){d(new i(`Promise timed out after `+e+` ms`))},e);o.always(function(){clearTimeout(t)})}return o},e(function(e){u(e)},function(e){d(e)})}function n(e,t,n){return function(r){try{var i=e(r);i&&typeof i.then==`function`&&typeof i.catch==`function`?i.then(t,n):t(i)}catch(e){n(e)}}}t.prototype.catch=function(e){return this.then(null,e)},t.prototype.always=function(e){return this.then(e,e)},t.prototype.finally=function(e){let n=this,r=function(){return new t(e=>e()).then(e).then(()=>n)};return this.then(r,r)},t.all=function(e){return new t(function(t,n){var r=e.length,i=[];r?e.forEach(function(e,a){e.then(function(e){i[a]=e,r--,r==0&&t(i)},function(e){r=0,n(e)})}):t(i)})},t.defer=function(){var e={};return e.promise=new t(function(t,n){e.resolve=t,e.reject=n}),e};function r(e){this.message=e||`promise cancelled`,this.stack=Error().stack}r.prototype=Error(),r.prototype.constructor=Error,r.prototype.name=`CancellationError`,t.CancellationError=r;function i(e){this.message=e||`timeout exceeded`,this.stack=Error().stack}i.prototype=Error(),i.prototype.constructor=Error,i.prototype.name=`TimeoutError`,t.TimeoutError=i,e.Promise=t})),v=l((e=>{e.validateOptions=function(e,t,n){if(e){var r=e?Object.keys(e):[],i=r.find(e=>!t.includes(e));if(i)throw Error(`Object "`+n+`" contains an unknown option "`+i+`"`);var a=t.find(e=>Object.prototype[e]&&!r.includes(e));if(a)throw Error(`Object "`+n+`" contains an inherited option "`+a+`" which is not defined in the object itself but in its prototype. Only plain objects are allowed. Please remove the option from the prototype or override it with a value "undefined".`);return e}},e.workerOptsNames=[`credentials`,`name`,`type`],e.forkOptsNames=[`cwd`,`detached`,`env`,`execPath`,`execArgv`,`gid`,`serialization`,`signal`,`killSignal`,`silent`,`stdio`,`uid`,`windowsVerbatimArguments`,`timeout`],e.workerThreadOptsNames=[`argv`,`env`,`eval`,`execArgv`,`stdin`,`stdout`,`stderr`,`workerData`,`trackUnmanagedFds`,`transferList`,`resourceLimits`,`name`]})),ee=l(((e,t)=>{t.exports=`!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).worker=n()}(this,(function(){"use strict";function e(n){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(n)}function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t={};var r=function(e,n){this.message=e,this.transfer=n},o={};function i(e,n){var t=this;if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if("function"!=typeof e)throw new SyntaxError("Function parameter handler(resolve, reject) missing");var r=[],o=[];this.resolved=!1,this.rejected=!1,this.pending=!0,this[Symbol.toStringTag]="Promise";var a=function(e,n){r.push(e),o.push(n)};this.then=function(e,n){return new i((function(t,r){var o=e?s(e,t,r):t,i=n?s(n,t,r):r;a(o,i)}),t)};var f=function(e){return t.resolved=!0,t.rejected=!1,t.pending=!1,r.forEach((function(n){n(e)})),a=function(n,t){n(e)},f=d=function(){},t},d=function(e){return t.resolved=!1,t.rejected=!0,t.pending=!1,o.forEach((function(n){n(e)})),a=function(n,t){t(e)},f=d=function(){},t};this.cancel=function(){return n?n.cancel():d(new u),t},this.timeout=function(e){if(n)n.timeout(e);else{var r=setTimeout((function(){d(new c("Promise timed out after "+e+" ms"))}),e);t.always((function(){clearTimeout(r)}))}return t},e((function(e){f(e)}),(function(e){d(e)}))}function s(e,n,t){return function(r){try{var o=e(r);o&&"function"==typeof o.then&&"function"==typeof o.catch?o.then(n,t):n(o)}catch(e){t(e)}}}function u(e){this.message=e||"promise cancelled",this.stack=(new Error).stack}function c(e){this.message=e||"timeout exceeded",this.stack=(new Error).stack}return i.prototype.catch=function(e){return this.then(null,e)},i.prototype.always=function(e){return this.then(e,e)},i.prototype.finally=function(e){var n=this,t=function(){return new i((function(e){return e()})).then(e).then((function(){return n}))};return this.then(t,t)},i.all=function(e){return new i((function(n,t){var r=e.length,o=[];r?e.forEach((function(e,i){e.then((function(e){o[i]=e,0==--r&&n(o)}),(function(e){r=0,t(e)}))})):n(o)}))},i.defer=function(){var e={};return e.promise=new i((function(n,t){e.resolve=n,e.reject=t})),e},u.prototype=new Error,u.prototype.constructor=Error,u.prototype.name="CancellationError",i.CancellationError=u,c.prototype=new Error,c.prototype.constructor=Error,c.prototype.name="TimeoutError",i.TimeoutError=c,o.Promise=i,function(n){var t=r,i=o.Promise,s="__workerpool-cleanup__",u={exit:function(){}},c={addAbortListener:function(e){u.abortListeners.push(e)},emit:u.emit};if("undefined"!=typeof self&&"function"==typeof postMessage&&"function"==typeof addEventListener)u.on=function(e,n){addEventListener(e,(function(e){n(e.data)}))},u.send=function(e,n){n?postMessage(e,n):postMessage(e)};else{if("undefined"==typeof process)throw new Error("Script must be executed as a worker");var a;try{a=require("worker_threads")}catch(n){if("object"!==e(n)||null===n||"MODULE_NOT_FOUND"!==n.code)throw n}if(a&&null!==a.parentPort){var f=a.parentPort;u.send=f.postMessage.bind(f),u.on=f.on.bind(f),u.exit=process.exit.bind(process)}else u.on=process.on.bind(process),u.send=function(e){process.send(e)},u.on("disconnect",(function(){process.exit(1)})),u.exit=process.exit.bind(process)}function d(e){return e&&e.toJSON?JSON.parse(JSON.stringify(e)):JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)))}function l(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}u.methods={},u.methods.run=function(e,n){var t=new Function("return ("+e+").apply(this, arguments);");return t.worker=c,t.apply(t,n)},u.methods.methods=function(){return Object.keys(u.methods)},u.terminationHandler=void 0,u.abortListenerTimeout=1e3,u.abortListeners=[],u.terminateAndExit=function(e){var n=function(){u.exit(e)};if(!u.terminationHandler)return n();var t=u.terminationHandler(e);return l(t)?(t.then(n,n),t):(n(),new i((function(e,n){n(new Error("Worker terminating"))})))},u.cleanup=function(e){if(!u.abortListeners.length)return u.send({id:e,method:s,error:d(new Error("Worker terminating"))}),new i((function(e){e()}));var n,t=u.abortListeners.map((function(e){return e()})),r=new i((function(e,t){n=setTimeout((function(){t(new Error("Timeout occured waiting for abort handler, killing worker"))}),u.abortListenerTimeout)})),o=i.all(t).then((function(){clearTimeout(n),u.abortListeners.length||(u.abortListeners=[])}),(function(){clearTimeout(n),u.exit()}));return new i((function(e,n){o.then(e,n),r.then(e,n)})).then((function(){u.send({id:e,method:s,error:null})}),(function(n){u.send({id:e,method:s,error:n?d(n):null})}))};var p=null;u.on("message",(function(e){if("__workerpool-terminate__"===e)return u.terminateAndExit(0);if(e.method===s)return u.cleanup(e.id);try{var n=u.methods[e.method];if(!n)throw new Error('Unknown method "'+e.method+'"');p=e.id;var r=n.apply(n,e.params);l(r)?r.then((function(n){n instanceof t?u.send({id:e.id,result:n.message,error:null},n.transfer):u.send({id:e.id,result:n,error:null}),p=null})).catch((function(n){u.send({id:e.id,result:null,error:d(n)}),p=null})):(r instanceof t?u.send({id:e.id,result:r.message,error:null},r.transfer):u.send({id:e.id,result:r,error:null}),p=null)}catch(n){u.send({id:e.id,result:null,error:d(n)})}})),u.register=function(e,n){if(e)for(var t in e)e.hasOwnProperty(t)&&(u.methods[t]=e[t],u.methods[t].worker=c);n&&(u.terminationHandler=n.onTerminate,u.abortListenerTimeout=n.abortListenerTimeout||1e3),u.send("ready")},u.emit=function(e){if(p){if(e instanceof t)return void u.send({id:p,isEvent:!0,payload:e.message},e.transfer);u.send({id:p,isEvent:!0,payload:e})}},n.add=u.register,n.emit=u.emit}(t),n(t)}));
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@navaramap/engine"),require("@navaramap/engine-worker")):typeof define==`function`&&define.amd?define([`exports`,`@navaramap/engine`,`@navaramap/engine-worker`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.NavaraWorker={},e._navaramap_engine,e._navaramap_engine_worker))})(this,function(e,t,n){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e},d=(e,t,n)=>(n=e==null?{}:r(s(e)),u(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e));n=d(n,1);var f=`Invariant failed`;function p(e,t){if(!e)throw Error(f)}var m=l(((e,t)=>{t.exports={}})),h=l(((e,t)=>{var n=function(e){return e!==void 0&&e.versions!=null&&e.versions.node!=null&&e+``==`[object process]`};t.exports.isNode=n,t.exports.platform=typeof process<`u`&&n(process)?`node`:`browser`;var r=t.exports.platform===`node`&&m();t.exports.isMainThread=t.exports.platform===`node`?(!r||r.isMainThread)&&!process.connected:typeof Window<`u`,t.exports.cpus=t.exports.platform===`browser`?self.navigator.hardwareConcurrency:m().cpus().length})),g=l((e=>{function t(e,a){var o=this;if(!(this instanceof t))throw SyntaxError(`Constructor must be called with the new operator`);if(typeof e!=`function`)throw SyntaxError(`Function parameter handler(resolve, reject) missing`);var s=[],c=[];this.resolved=!1,this.rejected=!1,this.pending=!0,this[Symbol.toStringTag]=`Promise`;var l=function(e,t){s.push(e),c.push(t)};this.then=function(e,r){return new t(function(t,i){var a=e?n(e,t,i):t,o=r?n(r,t,i):i;l(a,o)},o)};var u=function(e){return o.resolved=!0,o.rejected=!1,o.pending=!1,s.forEach(function(t){t(e)}),l=function(t,n){t(e)},u=d=function(){},o},d=function(e){return o.resolved=!1,o.rejected=!0,o.pending=!1,c.forEach(function(t){t(e)}),l=function(t,n){n(e)},u=d=function(){},o};this.cancel=function(){return a?a.cancel():d(new r),o},this.timeout=function(e){if(a)a.timeout(e);else{var t=setTimeout(function(){d(new i(`Promise timed out after `+e+` ms`))},e);o.always(function(){clearTimeout(t)})}return o},e(function(e){u(e)},function(e){d(e)})}function n(e,t,n){return function(r){try{var i=e(r);i&&typeof i.then==`function`&&typeof i.catch==`function`?i.then(t,n):t(i)}catch(e){n(e)}}}t.prototype.catch=function(e){return this.then(null,e)},t.prototype.always=function(e){return this.then(e,e)},t.prototype.finally=function(e){let n=this,r=function(){return new t(e=>e()).then(e).then(()=>n)};return this.then(r,r)},t.all=function(e){return new t(function(t,n){var r=e.length,i=[];r?e.forEach(function(e,a){e.then(function(e){i[a]=e,r--,r==0&&t(i)},function(e){r=0,n(e)})}):t(i)})},t.defer=function(){var e={};return e.promise=new t(function(t,n){e.resolve=t,e.reject=n}),e};function r(e){this.message=e||`promise cancelled`,this.stack=Error().stack}r.prototype=Error(),r.prototype.constructor=Error,r.prototype.name=`CancellationError`,t.CancellationError=r;function i(e){this.message=e||`timeout exceeded`,this.stack=Error().stack}i.prototype=Error(),i.prototype.constructor=Error,i.prototype.name=`TimeoutError`,t.TimeoutError=i,e.Promise=t})),_=l((e=>{e.validateOptions=function(e,t,n){if(e){var r=e?Object.keys(e):[],i=r.find(e=>!t.includes(e));if(i)throw Error(`Object "`+n+`" contains an unknown option "`+i+`"`);var a=t.find(e=>Object.prototype[e]&&!r.includes(e));if(a)throw Error(`Object "`+n+`" contains an inherited option "`+a+`" which is not defined in the object itself but in its prototype. Only plain objects are allowed. Please remove the option from the prototype or override it with a value "undefined".`);return e}},e.workerOptsNames=[`credentials`,`name`,`type`],e.forkOptsNames=[`cwd`,`detached`,`env`,`execPath`,`execArgv`,`gid`,`serialization`,`signal`,`killSignal`,`silent`,`stdio`,`uid`,`windowsVerbatimArguments`,`timeout`],e.workerThreadOptsNames=[`argv`,`env`,`eval`,`execArgv`,`stdin`,`stdout`,`stderr`,`workerData`,`trackUnmanagedFds`,`transferList`,`resourceLimits`,`name`]})),v=l(((e,t)=>{t.exports=`!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).worker=n()}(this,function(){"use strict";function e(n){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(n)}function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t={};var r=function(e,n){this.message=e,this.transfer=n},o={};function i(e,n){var t=this;if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if("function"!=typeof e)throw new SyntaxError("Function parameter handler(resolve, reject) missing");var r=[],o=[];this.resolved=!1,this.rejected=!1,this.pending=!0,this[Symbol.toStringTag]="Promise";var a=function(e,n){r.push(e),o.push(n)};this.then=function(e,n){return new i(function(t,r){var o=e?s(e,t,r):t,i=n?s(n,t,r):r;a(o,i)},t)};var f=function(e){return t.resolved=!0,t.rejected=!1,t.pending=!1,r.forEach(function(n){n(e)}),a=function(n,t){n(e)},f=d=function(){},t},d=function(e){return t.resolved=!1,t.rejected=!0,t.pending=!1,o.forEach(function(n){n(e)}),a=function(n,t){t(e)},f=d=function(){},t};this.cancel=function(){return n?n.cancel():d(new u),t},this.timeout=function(e){if(n)n.timeout(e);else{var r=setTimeout(function(){d(new c("Promise timed out after "+e+" ms"))},e);t.always(function(){clearTimeout(r)})}return t},e(function(e){f(e)},function(e){d(e)})}function s(e,n,t){return function(r){try{var o=e(r);o&&"function"==typeof o.then&&"function"==typeof o.catch?o.then(n,t):n(o)}catch(e){t(e)}}}function u(e){this.message=e||"promise cancelled",this.stack=(new Error).stack}function c(e){this.message=e||"timeout exceeded",this.stack=(new Error).stack}return i.prototype.catch=function(e){return this.then(null,e)},i.prototype.always=function(e){return this.then(e,e)},i.prototype.finally=function(e){var n=this,t=function(){return new i(function(e){return e()}).then(e).then(function(){return n})};return this.then(t,t)},i.all=function(e){return new i(function(n,t){var r=e.length,o=[];r?e.forEach(function(e,i){e.then(function(e){o[i]=e,0==--r&&n(o)},function(e){r=0,t(e)})}):n(o)})},i.defer=function(){var e={};return e.promise=new i(function(n,t){e.resolve=n,e.reject=t}),e},u.prototype=new Error,u.prototype.constructor=Error,u.prototype.name="CancellationError",i.CancellationError=u,c.prototype=new Error,c.prototype.constructor=Error,c.prototype.name="TimeoutError",i.TimeoutError=c,o.Promise=i,function(n){var t=r,i=o.Promise,s="__workerpool-cleanup__",u={exit:function(){}},c={addAbortListener:function(e){u.abortListeners.push(e)},emit:u.emit};if("undefined"!=typeof self&&"function"==typeof postMessage&&"function"==typeof addEventListener)u.on=function(e,n){addEventListener(e,function(e){n(e.data)})},u.send=function(e,n){n?postMessage(e,n):postMessage(e)};else{if("undefined"==typeof process)throw new Error("Script must be executed as a worker");var a;try{a=require("worker_threads")}catch(n){if("object"!==e(n)||null===n||"MODULE_NOT_FOUND"!==n.code)throw n}if(a&&null!==a.parentPort){var f=a.parentPort;u.send=f.postMessage.bind(f),u.on=f.on.bind(f),u.exit=process.exit.bind(process)}else u.on=process.on.bind(process),u.send=function(e){process.send(e)},u.on("disconnect",function(){process.exit(1)}),u.exit=process.exit.bind(process)}function d(e){return e&&e.toJSON?JSON.parse(JSON.stringify(e)):JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)))}function l(e){return e&&"function"==typeof e.then&&"function"==typeof e.catch}u.methods={},u.methods.run=function(e,n){var t=new Function("return ("+e+").apply(this, arguments);");return t.worker=c,t.apply(t,n)},u.methods.methods=function(){return Object.keys(u.methods)},u.terminationHandler=void 0,u.abortListenerTimeout=1e3,u.abortListeners=[],u.terminateAndExit=function(e){var n=function(){u.exit(e)};if(!u.terminationHandler)return n();var t=u.terminationHandler(e);return l(t)?(t.then(n,n),t):(n(),new i(function(e,n){n(new Error("Worker terminating"))}))},u.cleanup=function(e){if(!u.abortListeners.length)return u.send({id:e,method:s,error:d(new Error("Worker terminating"))}),new i(function(e){e()});var n,t=u.abortListeners.map(function(e){return e()}),r=new i(function(e,t){n=setTimeout(function(){t(new Error("Timeout occurred waiting for abort handler, killing worker"))},u.abortListenerTimeout)}),o=i.all(t).then(function(){clearTimeout(n),u.abortListeners.length&&(u.abortListeners=[])},function(){clearTimeout(n),u.exit()});return new i(function(e,n){o.then(e,n),r.then(e,n)}).then(function(){u.send({id:e,method:s,error:null})},function(n){u.send({id:e,method:s,error:n?d(n):null})})};var p=null;u.on("message",function(e){if("__workerpool-terminate__"===e)return u.terminateAndExit(0);if(e.method===s)return u.cleanup(e.id);try{var n=u.methods[e.method];if(!n)throw new Error('Unknown method "'+e.method+'"');p=e.id;var r=n.apply(n,e.params);l(r)?r.then(function(n){n instanceof t?u.send({id:e.id,result:n.message,error:null},n.transfer):u.send({id:e.id,result:n,error:null}),p=null}).catch(function(n){u.send({id:e.id,result:null,error:d(n)}),p=null}):(r instanceof t?u.send({id:e.id,result:r.message,error:null},r.transfer):u.send({id:e.id,result:r,error:null}),p=null)}catch(n){u.send({id:e.id,result:null,error:d(n)})}}),u.register=function(e,n){if(e)for(var t in e)e.hasOwnProperty(t)&&(u.methods[t]=e[t],u.methods[t].worker=c);n&&(u.terminationHandler=n.onTerminate,u.abortListenerTimeout=n.abortListenerTimeout||1e3),u.send("ready")},u.emit=function(e){if(p){if(e instanceof t)return void u.send({id:p,isEvent:!0,payload:e.message},e.transfer);u.send({id:p,isEvent:!0,payload:e})}},n.add=u.register,n.emit=u.emit}(t),n(t)});
2
2
  //# sourceMappingURL=worker.min.js.map
3
- `})),y=l(((e,t)=>{var{Promise:n}=_(),r=g(),{validateOptions:i,forkOptsNames:a,workerThreadOptsNames:o,workerOptsNames:s}=v(),c=`__workerpool-terminate__`,l=`__workerpool-cleanup__`;function u(){var e=f();if(!e)throw Error(`WorkerPool: workerType = 'thread' is not supported, Node >= 11.7.0 required`);return e}function d(){if(typeof Worker!=`function`&&(typeof Worker!=`object`||typeof Worker.prototype.constructor!=`function`))throw Error(`WorkerPool: Web Workers not supported`)}function f(){try{return h()}catch(e){if(typeof e==`object`&&e&&e.code===`MODULE_NOT_FOUND`)return null;throw e}}function p(){if(r.platform===`browser`){if(typeof Blob>`u`)throw Error(`Blob not supported by the browser`);if(!window.URL||typeof window.URL.createObjectURL!=`function`)throw Error(`URL.createObjectURL not supported by the browser`);var e=new Blob([ee()],{type:`text/javascript`});return window.URL.createObjectURL(e)}else return __dirname+`/worker.js`}function m(e,t){if(t.workerType===`web`)return d(),y(e,t.workerOpts,Worker);if(t.workerType===`thread`)return n=u(),b(e,n,t);if(t.workerType===`process`||!t.workerType)return x(e,S(t),h());if(r.platform===`browser`)return d(),y(e,t.workerOpts,Worker);var n=f();return n?b(e,n,t):x(e,S(t),h())}function y(e,t,n){i(t,s,`workerOpts`);var r=new n(e,t);return r.isBrowserWorker=!0,r.on=function(e,t){this.addEventListener(e,function(e){t(e.data)})},r.send=function(e,t){this.postMessage(e,t)},r}function b(e,t,n){i(n?.workerThreadOpts,o,`workerThreadOpts`);var r=new t.Worker(e,{stdout:n?.emitStdStreams??!1,stderr:n?.emitStdStreams??!1,...n?.workerThreadOpts});return r.isWorkerThread=!0,r.send=function(e,t){this.postMessage(e,t)},r.kill=function(){return this.terminate(),!0},r.disconnect=function(){this.terminate()},n?.emitStdStreams&&(r.stdout.on(`data`,e=>r.emit(`stdout`,e)),r.stderr.on(`data`,e=>r.emit(`stderr`,e))),r}function x(e,t,n){i(t.forkOpts,a,`forkOpts`);var r=n.fork(e,t.forkArgs,t.forkOpts),o=r.send;return r.send=function(e){return o.call(r,e)},t.emitStdStreams&&(r.stdout.on(`data`,e=>r.emit(`stdout`,e)),r.stderr.on(`data`,e=>r.emit(`stderr`,e))),r.isChildProcess=!0,r}function S(e){e||={};var t=process.execArgv.join(` `),n=t.indexOf(`--inspect`)!==-1,r=t.indexOf(`--debug-brk`)!==-1,i=[];return n&&(i.push(`--inspect=`+e.debugPort),r&&i.push(`--debug-brk`)),process.execArgv.forEach(function(e){e.indexOf(`--max-old-space-size`)>-1&&i.push(e)}),Object.assign({},e,{forkArgs:e.forkArgs,forkOpts:Object.assign({},e.forkOpts,{execArgv:(e.forkOpts&&e.forkOpts.execArgv||[]).concat(i),stdio:e.emitStdStreams?`pipe`:void 0})})}function C(e){for(var t=Error(``),n=Object.keys(e),r=0;r<n.length;r++)t[n[r]]=e[n[r]];return t}function w(e,t){Object.values(e.processing).forEach(e=>e?.options?.on(t)),Object.values(e.tracking).forEach(e=>e?.options?.on(t))}function T(e,t){var n=this,r=t||{};this.script=e||p(),this.worker=m(this.script,r),this.debugPort=r.debugPort,this.forkOpts=r.forkOpts,this.forkArgs=r.forkArgs,this.workerOpts=r.workerOpts,this.workerThreadOpts=r.workerThreadOpts,this.workerTerminateTimeout=r.workerTerminateTimeout,e||(this.worker.ready=!0),this.requestQueue=[],this.worker.on(`stdout`,function(e){w(n,{stdout:e.toString()})}),this.worker.on(`stderr`,function(e){w(n,{stderr:e.toString()})}),this.worker.on(`message`,function(e){if(!n.terminated)if(typeof e==`string`&&e===`ready`)n.worker.ready=!0,a();else{var t=e.id,r=n.processing[t];if(r!==void 0)e.isEvent?r.options&&typeof r.options.on==`function`&&r.options.on(e.payload):(delete n.processing[t],n.terminating===!0&&n.terminate(),e.error?r.resolver.reject(C(e.error)):r.resolver.resolve(e.result));else{var r=n.tracking[t];r!==void 0&&e.isEvent&&r.options&&typeof r.options.on==`function`&&r.options.on(e.payload)}if(e.method===l){var i=n.tracking[e.id];i!==void 0&&(e.error?(clearTimeout(i.timeoutId),i.resolver.reject(C(e.error))):(n.tracking&&clearTimeout(i.timeoutId),i.resolver.reject(new te(i.error)))),delete n.tracking[t]}}});function i(e){for(var t in n.terminated=!0,n.processing)n.processing[t]!==void 0&&n.processing[t].resolver.reject(e);n.processing=Object.create(null)}function a(){for(let e of n.requestQueue.splice(0))n.worker.send(e.message,e.transfer)}var o=this.worker;this.worker.on(`error`,function(e){i(new E(`Workerpool Worker error: `+(e&&e.message?e.message:String(e||`Unknown worker error`)),e))}),this.worker.on(`exit`,function(e,t){var r=`Workerpool Worker terminated Unexpectedly
3
+ `})),y=l(((e,t)=>{var{Promise:n}=g(),r=h(),{validateOptions:i,forkOptsNames:a,workerThreadOptsNames:o,workerOptsNames:s}=_(),c=`__workerpool-terminate__`,l=`__workerpool-cleanup__`;function u(){var e=f();if(!e)throw Error(`WorkerPool: workerType = 'thread' is not supported, Node >= 11.7.0 required`);return e}function d(){if(typeof Worker!=`function`&&(typeof Worker!=`object`||typeof Worker.prototype.constructor!=`function`))throw Error(`WorkerPool: Web Workers not supported`)}function f(){try{return m()}catch(e){if(typeof e==`object`&&e&&e.code===`MODULE_NOT_FOUND`)return null;throw e}}function p(){if(r.platform===`browser`){if(typeof Blob>`u`)throw Error(`Blob not supported by the browser`);if(!window.URL||typeof window.URL.createObjectURL!=`function`)throw Error(`URL.createObjectURL not supported by the browser`);var e=new Blob([v()],{type:`text/javascript`});return window.URL.createObjectURL(e)}else return __dirname+`/worker.js`}function y(e,t){if(t.workerType===`web`)return d(),b(e,t.workerOpts,Worker);if(t.workerType===`thread`)return n=u(),x(e,n,t);if(t.workerType===`process`||!t.workerType)return S(e,C(t),m());if(r.platform===`browser`)return d(),b(e,t.workerOpts,Worker);var n=f();return n?x(e,n,t):S(e,C(t),m())}function b(e,t,n){i(t,s,`workerOpts`);var r=new n(e,t);return r.isBrowserWorker=!0,r.on=function(e,t){this.addEventListener(e,function(e){t(e.data)})},r.send=function(e,t){this.postMessage(e,t)},r}function x(e,t,n){i(n?.workerThreadOpts,o,`workerThreadOpts`);var r=new t.Worker(e,{stdout:n?.emitStdStreams??!1,stderr:n?.emitStdStreams??!1,...n?.workerThreadOpts});return r.isWorkerThread=!0,r.send=function(e,t){this.postMessage(e,t)},r.kill=function(){return this.terminate(),!0},r.disconnect=function(){this.terminate()},n?.emitStdStreams&&(r.stdout.on(`data`,e=>r.emit(`stdout`,e)),r.stderr.on(`data`,e=>r.emit(`stderr`,e))),r}function S(e,t,n){i(t.forkOpts,a,`forkOpts`);var r=n.fork(e,t.forkArgs,t.forkOpts),o=r.send;return r.send=function(e){return o.call(r,e)},t.emitStdStreams&&(r.stdout.on(`data`,e=>r.emit(`stdout`,e)),r.stderr.on(`data`,e=>r.emit(`stderr`,e))),r.isChildProcess=!0,r}function C(e){e||={};var t=process.execArgv.join(` `),n=t.indexOf(`--inspect`)!==-1,r=t.indexOf(`--debug-brk`)!==-1,i=[];return n&&(i.push(`--inspect=`+e.debugPort),r&&i.push(`--debug-brk`)),process.execArgv.forEach(function(e){e.indexOf(`--max-old-space-size`)>-1&&i.push(e)}),Object.assign({},e,{forkArgs:e.forkArgs,forkOpts:Object.assign({},e.forkOpts,{execArgv:(e.forkOpts&&e.forkOpts.execArgv||[]).concat(i),stdio:e.emitStdStreams?`pipe`:void 0})})}function w(e){for(var t=Error(``),n=Object.keys(e),r=0;r<n.length;r++)t[n[r]]=e[n[r]];return t}function T(e,t){Object.values(e.processing).forEach(e=>e?.options?.on(t)),Object.values(e.tracking).forEach(e=>e?.options?.on(t))}function E(e,t){var n=this,r=t||{};this.script=e||p(),this.worker=y(this.script,r),this.debugPort=r.debugPort,this.forkOpts=r.forkOpts,this.forkArgs=r.forkArgs,this.workerOpts=r.workerOpts,this.workerThreadOpts=r.workerThreadOpts,this.workerTerminateTimeout=r.workerTerminateTimeout,e||(this.worker.ready=!0),this.requestQueue=[],this.worker.on(`stdout`,function(e){T(n,{stdout:e.toString()})}),this.worker.on(`stderr`,function(e){T(n,{stderr:e.toString()})}),this.worker.on(`message`,function(e){if(!n.terminated)if(typeof e==`string`&&e===`ready`)n.worker.ready=!0,a();else{var t=e.id,r=n.processing[t];if(r!==void 0)e.isEvent?r.options&&typeof r.options.on==`function`&&r.options.on(e.payload):(delete n.processing[t],n.terminating===!0&&n.terminate(),e.error?r.resolver.reject(w(e.error)):r.resolver.resolve(e.result));else{var r=n.tracking[t];r!==void 0&&e.isEvent&&r.options&&typeof r.options.on==`function`&&r.options.on(e.payload)}if(e.method===l){var i=n.tracking[e.id];i!==void 0&&(e.error?(clearTimeout(i.timeoutId),i.resolver.reject(w(e.error))):(n.tracking&&clearTimeout(i.timeoutId),i.resolver.reject(new ee(i.error)))),delete n.tracking[t]}}});function i(e){for(var t in n.terminated=!0,n.processing)n.processing[t]!==void 0&&n.processing[t].resolver.reject(e);n.processing=Object.create(null)}function a(){for(let e of n.requestQueue.splice(0))n.worker.send(e.message,e.transfer)}var o=this.worker;this.worker.on(`error`,function(e){i(new D(`Workerpool Worker error: `+(e&&e.message?e.message:String(e||`Unknown worker error`)),e))}),this.worker.on(`exit`,function(e,t){var r=`Workerpool Worker terminated Unexpectedly
4
4
  `;r+=" exitCode: `"+e+`\`
5
5
  `,r+=" signalCode: `"+t+`\`
6
6
  `,r+=" workerpool.script: `"+n.script+`\`
@@ -8,4 +8,4 @@
8
8
  `,r+=" spawnfile: `"+o.spawnfile+`\`
9
9
  `,r+=" stdout: `"+o.stdout+`\`
10
10
  `,r+=" stderr: `"+o.stderr+`\`
11
- `,i(new E(r))}),this.processing=Object.create(null),this.tracking=Object.create(null),this.terminating=!1,this.terminated=!1,this.cleaning=!1,this.terminationHandler=null,this.lastId=0}T.prototype.methods=function(){return this.exec(`methods`)},T.prototype.exec=function(e,t,r,i){r||=n.defer();var a=++this.lastId;this.processing[a]={id:a,resolver:r,options:i};var o={message:{id:a,method:e,params:t},transfer:i&&i.transfer};this.terminated?r.reject(new E(`Worker is terminated`)):this.worker.ready?this.worker.send(o.message,o.transfer):this.requestQueue.push(o);var s=this;return r.promise.catch(function(e){if(e instanceof n.CancellationError||e instanceof n.TimeoutError)return s.tracking[a]={id:a,resolver:n.defer(),options:i,error:e},delete s.processing[a],s.tracking[a].resolver.promise=s.tracking[a].resolver.promise.catch(function(e){if(delete s.tracking[a],e instanceof te)throw e.error;return s.terminateAndNotify(!0).then(function(){throw e},function(e){throw e})}),s.worker.send({id:a,method:l}),s.tracking[a].timeoutId=setTimeout(function(){s.tracking[a].resolver.reject(e)},s.workerTerminateTimeout),s.tracking[a].resolver.promise;throw e})},T.prototype.busy=function(){return this.cleaning||Object.keys(this.processing).length>0},T.prototype.terminate=function(e,t){var n=this;if(e){for(var r in this.processing)this.processing[r]!==void 0&&this.processing[r].resolver.reject(Error(`Worker terminated`));this.processing=Object.create(null)}for(var i of Object.values(n.tracking))clearTimeout(i.timeoutId),i.resolver.reject(Error(`Worker Terminating`));if(n.tracking=Object.create(null),typeof t==`function`&&(this.terminationHandler=t),this.busy())this.terminating=!0;else{var a=function(e){if(n.terminated=!0,n.cleaning=!1,n.worker!=null&&n.worker.removeAllListeners&&n.worker.removeAllListeners(`message`),n.worker=null,n.terminating=!1,n.terminationHandler)n.terminationHandler(e,n);else if(e)throw e};if(this.worker)if(typeof this.worker.kill==`function`){if(this.worker.killed){a(Error(`worker already killed!`));return}var o=setTimeout(function(){n.worker&&n.worker.kill()},this.workerTerminateTimeout);this.worker.once(`exit`,function(){clearTimeout(o),n.worker&&(n.worker.killed=!0),a()}),this.worker.ready?this.worker.send(c):this.requestQueue.push({message:c}),this.cleaning=!0;return}else if(typeof this.worker.terminate==`function`)this.worker.terminate(),this.worker.killed=!0;else throw Error(`Failed to terminate worker`);a()}},T.prototype.terminateAndNotify=function(e,t){var r=n.defer();return t&&r.promise.timeout(t),this.terminate(e,function(e,t){e?r.reject(e):r.resolve(t)}),r.promise};function te(e){this.error=e,this.stack=Error().stack}var E=class extends Error{constructor(e,t){super(e||`worker terminated`),this.cause=t}};t.exports=T,t.exports._tryRequireWorkerThreads=f,t.exports._setupProcessWorker=x,t.exports._setupBrowserWorker=y,t.exports._setupWorkerThreadWorker=b,t.exports.ensureWorkerThreads=u,t.exports.TerminateError=E})),b=l(((e,t)=>{function n(){this.tasks=[]}n.prototype.push=function(e){this.tasks.push(e)},n.prototype.pop=function(){return this.tasks.shift()},n.prototype.size=function(){return this.tasks.length},n.prototype.contains=function(e){return this.tasks.includes(e)},n.prototype.clear=function(){this.tasks.length=0};function r(){this.tasks=[]}r.prototype.push=function(e){this.tasks.push(e)},r.prototype.pop=function(){return this.tasks.pop()},r.prototype.size=function(){return this.tasks.length},r.prototype.contains=function(e){return this.tasks.includes(e)},r.prototype.clear=function(){this.tasks.length=0},t.exports={FIFOQueue:n,LIFOQueue:r}})),x=l(((e,t)=>{var n=65535;t.exports=r;function r(){this.ports=Object.create(null),this.length=0}r.prototype.nextAvailableStartingAt=function(e){for(;this.ports[e]===!0;)e++;if(e>=n)throw Error(`WorkerPool debug port limit reached: `+e+`>= `+n);return this.ports[e]=!0,this.length++,e},r.prototype.releasePort=function(e){delete this.ports[e],this.length--}})),S=l(((e,t)=>{var{Promise:n}=_(),r=y(),i=g(),{FIFOQueue:a,LIFOQueue:o}=b(),s=new(x());function c(e,t){typeof e==`string`?this.script=e||null:(this.script=null,t=e),this.workers=[],this.taskQueue=this._createQueue(t&&t.queueStrategy||`fifo`),t||={},this.forkArgs=Object.freeze(t.forkArgs||[]),this.forkOpts=Object.freeze(t.forkOpts||{}),this.workerOpts=Object.freeze(t.workerOpts||{}),this.workerThreadOpts=Object.freeze(t.workerThreadOpts||{}),this.debugPortStart=t.debugPortStart||43210,this.nodeWorker=t.nodeWorker,this.workerType=t.workerType||t.nodeWorker||`auto`,this.maxQueueSize=t.maxQueueSize||1/0,this.workerTerminateTimeout=t.workerTerminateTimeout||1e3,this.onCreateWorker=t.onCreateWorker||(()=>null),this.onTerminateWorker=t.onTerminateWorker||(()=>null),this.emitStdStreams=t.emitStdStreams||!1,t&&`maxWorkers`in t?(l(t.maxWorkers),this.maxWorkers=t.maxWorkers):this.maxWorkers=Math.max((i.cpus||4)-1,1),t&&`minWorkers`in t&&(t.minWorkers===`max`?this.minWorkers=this.maxWorkers:(u(t.minWorkers),this.minWorkers=t.minWorkers,this.maxWorkers=Math.max(this.minWorkers,this.maxWorkers)),this._ensureMinWorkers()),this._boundNext=this._next.bind(this),this.workerType===`thread`&&r.ensureWorkerThreads()}c.prototype.exec=function(e,t,r){if(t&&!Array.isArray(t))throw TypeError(`Array expected as argument "params"`);if(typeof e==`string`){var i=n.defer();if(this.taskQueue.size()>=this.maxQueueSize)throw Error(`Max queue size of `+this.maxQueueSize+` reached`);var a={method:e,params:t,resolver:i,timeout:null,options:r};this.taskQueue.push(a);var o=i.promise.timeout,s=this.taskQueue;return i.promise.timeout=function(e){return s.contains(a)?(a.timeout=e,i.promise):o.call(i.promise,e)},this._next(),i.promise}else if(typeof e==`function`)return this.exec(`run`,[String(e),t],r);else throw TypeError(`Function or string expected as argument "method"`)},c.prototype.proxy=function(){if(arguments.length>0)throw Error(`No arguments expected`);var e=this;return this.exec(`methods`).then(function(t){var n={};return t.forEach(function(t){n[t]=function(){return e.exec(t,Array.prototype.slice.call(arguments))}}),n})},c.prototype._next=function(){if(this.taskQueue.size()>0){var e=this._getWorker();if(e){var t=this,n=this.taskQueue.pop();if(n.resolver.promise.pending){var r=e.exec(n.method,n.params,n.resolver,n.options).then(t._boundNext).catch(function(){if(e.terminated)return t._removeWorker(e)}).then(function(){t._next()});typeof n.timeout==`number`&&r.timeout(n.timeout)}else t._next()}}},c.prototype._getWorker=function(){for(var e=this.workers,t=0;t<e.length;t++){var n=e[t];if(n.busy()===!1)return n}return e.length<this.maxWorkers?(n=this._createWorkerHandler(),e.push(n),n):null},c.prototype._removeWorker=function(e){var t=this;return s.releasePort(e.debugPort),this._removeWorkerFromList(e),this._ensureMinWorkers(),new n(function(n,r){e.terminate(!1,function(i){t.onTerminateWorker({forkArgs:e.forkArgs,forkOpts:e.forkOpts,workerThreadOpts:e.workerThreadOpts,script:e.script}),i?r(i):n(e)})})},c.prototype._removeWorkerFromList=function(e){var t=this.workers.indexOf(e);t!==-1&&this.workers.splice(t,1)},c.prototype.terminate=function(e,t){for(var r=this,i=this.taskQueue;i.size()>0;){var a=i.pop();if(a)a.resolver.reject(Error(`Pool terminated`));else break}i.clear();var o=function(e){s.releasePort(e.debugPort),this._removeWorkerFromList(e)}.bind(this),c=[];return this.workers.slice().forEach(function(n){var i=n.terminateAndNotify(e,t).then(o).always(function(){r.onTerminateWorker({forkArgs:n.forkArgs,forkOpts:n.forkOpts,workerThreadOpts:n.workerThreadOpts,script:n.script})});c.push(i)}),n.all(c)},c.prototype.stats=function(){var e=this.workers.length,t=this.workers.filter(function(e){return e.busy()}).length;return{totalWorkers:e,busyWorkers:t,idleWorkers:e-t,pendingTasks:this.taskQueue.size(),activeTasks:t}},c.prototype._ensureMinWorkers=function(){if(this.minWorkers)for(var e=this.workers.length;e<this.minWorkers;e++)this.workers.push(this._createWorkerHandler())},c.prototype._createWorkerHandler=function(){let e=this.onCreateWorker({forkArgs:this.forkArgs,forkOpts:this.forkOpts,workerOpts:this.workerOpts,workerThreadOpts:this.workerThreadOpts,script:this.script})||{};return new r(e.script||this.script,{forkArgs:e.forkArgs||this.forkArgs,forkOpts:e.forkOpts||this.forkOpts,workerOpts:e.workerOpts||this.workerOpts,workerThreadOpts:e.workerThreadOpts||this.workerThreadOpts,debugPort:s.nextAvailableStartingAt(this.debugPortStart),workerType:this.workerType,workerTerminateTimeout:this.workerTerminateTimeout,emitStdStreams:this.emitStdStreams})},c.prototype._createQueue=function(e){if(typeof e==`string`)switch(e){case`fifo`:return new a;case`lifo`:return new o;default:throw Error(`Unknown queue strategy: `+e)}if(!e)throw Error(`Queue strategy cannot be null or undefined`);for(var t=[`push`,`pop`,`size`,`contains`,`clear`],n=0;n<t.length;n++){var r=t[n];if(typeof e[r]!=`function`)throw Error(`Queue strategy must implement method: `+r)}return e};function l(e){if(!d(e)||!f(e)||e<1)throw TypeError(`Option maxWorkers must be an integer number >= 1`)}function u(e){if(!d(e)||!f(e)||e<0)throw TypeError(`Option minWorkers must be an integer number >= 0`)}function d(e){return typeof e==`number`}function f(e){return Math.round(e)==e}t.exports=c})),C=l(((e,t)=>{function n(e,t){this.message=e,this.transfer=t}t.exports=n})),w=l((e=>{var t=C(),n=_().Promise,r=`__workerpool-terminate__`,i=`__workerpool-cleanup__`,a=1e3,o={exit:function(){}},s={addAbortListener:function(e){o.abortListeners.push(e)},emit:o.emit};if(typeof self<`u`&&typeof postMessage==`function`&&typeof addEventListener==`function`)o.on=function(e,t){addEventListener(e,function(e){t(e.data)})},o.send=function(e,t){t?postMessage(e,t):postMessage(e)};else if(typeof process<`u`){var c;try{c=h()}catch(e){if(!(typeof e==`object`&&e&&e.code===`MODULE_NOT_FOUND`))throw e}if(c&&c.parentPort!==null){var l=c.parentPort;o.send=l.postMessage.bind(l),o.on=l.on.bind(l),o.exit=process.exit.bind(process)}else o.on=process.on.bind(process),o.send=function(e){process.send(e)},o.on(`disconnect`,function(){process.exit(1)}),o.exit=process.exit.bind(process)}else throw Error(`Script must be executed as a worker`);function u(e){return e&&e.toJSON?JSON.parse(JSON.stringify(e)):JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)))}function d(e){return e&&typeof e.then==`function`&&typeof e.catch==`function`}o.methods={},o.methods.run=function(e,t){var n=Function(`return (`+e+`).apply(this, arguments);`);return n.worker=s,n.apply(n,t)},o.methods.methods=function(){return Object.keys(o.methods)},o.terminationHandler=void 0,o.abortListenerTimeout=a,o.abortListeners=[],o.terminateAndExit=function(e){var t=function(){o.exit(e)};if(!o.terminationHandler)return t();var r=o.terminationHandler(e);return d(r)?(r.then(t,t),r):(t(),new n(function(e,t){t(Error(`Worker terminating`))}))},o.cleanup=function(e){if(!o.abortListeners.length)return o.send({id:e,method:i,error:u(Error(`Worker terminating`))}),new n(function(e){e()});var t=function(){o.exit()},r=function(){o.abortListeners.length||(o.abortListeners=[])};let a=o.abortListeners.map(e=>e()),s,c=new n((e,t)=>{s=setTimeout(function(){t(Error(`Timeout occured waiting for abort handler, killing worker`))},o.abortListenerTimeout)}),l=n.all(a).then(function(){clearTimeout(s),r()},function(){clearTimeout(s),t()});return new n(function(e,t){l.then(e,t),c.then(e,t)}).then(function(){o.send({id:e,method:i,error:null})},function(t){o.send({id:e,method:i,error:t?u(t):null})})};var f=null;o.on(`message`,function(e){if(e===r)return o.terminateAndExit(0);if(e.method===i)return o.cleanup(e.id);try{var n=o.methods[e.method];if(n){f=e.id;var a=n.apply(n,e.params);d(a)?a.then(function(n){n instanceof t?o.send({id:e.id,result:n.message,error:null},n.transfer):o.send({id:e.id,result:n,error:null}),f=null}).catch(function(t){o.send({id:e.id,result:null,error:u(t)}),f=null}):(a instanceof t?o.send({id:e.id,result:a.message,error:null},a.transfer):o.send({id:e.id,result:a,error:null}),f=null)}else throw Error(`Unknown method "`+e.method+`"`)}catch(t){o.send({id:e.id,result:null,error:u(t)})}}),o.register=function(e,t){if(e)for(var n in e)e.hasOwnProperty(n)&&(o.methods[n]=e[n],o.methods[n].worker=s);t&&(o.terminationHandler=t.onTerminate,o.abortListenerTimeout=t.abortListenerTimeout||a),o.send(`ready`)},o.emit=function(e){if(f){if(e instanceof t){o.send({id:f,isEvent:!0,payload:e.message},e.transfer);return}o.send({id:f,isEvent:!0,payload:e})}},e!==void 0&&(e.add=o.register,e.emit=o.emit)})),T=d(l((e=>{var{platform:t,isMainThread:n,cpus:r}=g(),{TerminateError:i}=y();function a(e,t){return new(S())(e,t)}e.pool=a;function o(e,t){w().add(e,t)}e.worker=o;var{Promise:s}=_();e.Transfer=C()}))(),1),te=5e3,E=3e4,ne=e=>T.pool(e,{maxWorkers:1,minWorkers:0,workerTerminateTimeout:E,workerOpts:{type:void 0}}),re=class{url;maxWorkerHeapBytes;slots;idleSweepTimer;terminated=!1;constructor(e,t,n){m(t>0,`maxWorkers must be a positive number.`),this.url=e,this.maxWorkerHeapBytes=n?.maxWorkerHeapBytes??268435456,this.slots=Array.from({length:t},()=>({pool:ne(e),tasksSinceSpawn:0,inflight:0,draining:!1,probing:!1,lastHeapBytes:void 0}))}exec(e,t,n){let r=this.pickSlot();r.inflight++;try{return r.pool.exec(e,t,n).then(e=>(this.onSettled(r),e)).catch(e=>{throw this.onSettled(r),e})}catch(e){throw this.onSettled(r),e}}warmUp(){let[e,...t]=this.slots;return this.warmSlot(e).then(()=>{for(let e of t)this.warmSlot(e).catch(()=>void 0)},e=>{if(t.length===0)throw e;return Promise.any(t.map(e=>this.warmSlot(e))).then(()=>void 0)})}canAcceptTasks(){return this.slots.some(e=>!e.draining)}stats(){let e={totalWorkers:0,busyWorkers:0,idleWorkers:0,pendingTasks:0,activeTasks:0,tasksSinceSpawn:0};for(let t of this.slots){let n=t.pool.stats();e.totalWorkers+=n.totalWorkers,e.busyWorkers+=n.busyWorkers,e.idleWorkers+=n.idleWorkers,e.pendingTasks+=n.pendingTasks,e.activeTasks+=n.activeTasks,e.tasksSinceSpawn+=t.tasksSinceSpawn}return e}heapStats(){let e=this.slots.map(e=>e.lastHeapBytes);return{perSlot:e,totalBytes:e.reduce((e,t)=>e+(t??0),0),maxWorkerHeapBytes:this.maxWorkerHeapBytes}}probeHeap(){if(!this.terminated)for(let e of this.slots)e.draining||this.probeSlot(e)}terminate(){this.idleSweepTimer!==void 0&&(clearTimeout(this.idleSweepTimer),this.idleSweepTimer=void 0),this.terminated=!0;for(let e of this.slots)e.pool.terminate()}pickSlot(){let e=this.slots.filter(e=>!e.draining);return(e.length>0?e:this.slots).reduce((e,t)=>t.inflight<e.inflight?t:e)}onSettled(e){e.inflight--,!this.terminated&&(e.tasksSinceSpawn++,e.tasksSinceSpawn>=128&&(e.draining=!0),e.draining&&e.inflight===0?this.recycleSlot(e):e.draining||this.probeSlot(e),this.armIdleSweep())}recycleSlot(e){e.pool.terminate(),e.pool=ne(this.url),e.tasksSinceSpawn=0,e.draining=!1,e.lastHeapBytes=void 0,this.warmSlot(e).catch(()=>void 0)}warmSlot(e){e.inflight++;let t=()=>{e.inflight--,!this.terminated&&e.draining&&e.inflight===0&&this.recycleSlot(e)};return new Promise((n,r)=>{try{e.pool.exec(`warmUp`).then(()=>{t(),n()}).catch(e=>{t(),r(e)})}catch(e){t(),r(e)}})}probeSlot(e){if(e.probing)return;e.probing=!0,e.inflight++;let t=t=>{e.probing=!1,e.inflight--,!this.terminated&&(t&&(e.draining=!0),e.draining&&e.inflight===0&&this.recycleSlot(e))};try{e.pool.exec(`getWasmMemoryUsage`).then(n=>{typeof n==`number`&&(e.lastHeapBytes=n),t(typeof n==`number`&&n>=this.maxWorkerHeapBytes)}).catch(()=>{t(!0)})}catch{t(!0)}}armIdleSweep(){this.idleSweepTimer!==void 0&&clearTimeout(this.idleSweepTimer),this.idleSweepTimer=setTimeout(()=>{this.idleSweepTimer=void 0;for(let e of this.slots)e.tasksSinceSpawn>0&&e.inflight===0&&this.recycleSlot(e)},te)}};function ie(e){return e!=null}var ae=class{x;y;z;constructor(e){this.x=e.x,this.y=e.y,this.z=e.z}},oe=class{vertices;uvs;indices;heights;max_height;min_height;rtc_translation;normals;skirt_vertices;skirt_uvs;skirt_indices;skirt_normals;watermask;constructor(e){this.vertices=e.transferVertices(),this.uvs=e.transferUvs(),this.indices=e.transferIndices(),this.heights=e.transferHeights(),this.max_height=e.max_height,this.min_height=e.min_height,this.rtc_translation=e.rtc_translation?new ae(e.rtc_translation):void 0,e.hasNormals()&&(this.normals=e.transferNormals()),e.hasSkirt()&&(this.skirt_vertices=e.transferSkirtVertices(),this.skirt_uvs=e.transferSkirtUvs(),this.skirt_indices=e.transferSkirtIndices(),this.skirt_normals=e.transferSkirtNormals()),e.hasWatermask()&&(this.watermask=e.transferWatermask())}transferVertices(){throw Error()}transferUvs(){throw Error()}transferIndices(){throw Error()}transferHeights(){throw Error()}transferNormals(){throw Error()}transferSkirtVertices(){throw Error()}transferSkirtUvs(){throw Error()}transferSkirtIndices(){throw Error()}transferSkirtNormals(){throw Error()}transferWatermask(){throw Error()}hasSkirt(){return this.skirt_vertices!==void 0&&this.skirt_uvs!==void 0&&this.skirt_indices!==void 0}hasNormals(){return this.normals!==void 0}hasWatermask(){return this.watermask!==void 0}},se=class{east;north;south;west;constructor(e){this.east=e.east,this.north=e.north,this.south=e.south,this.west=e.west}},ce=class{extent;position_3d_high;position_3d_high_size;position_3d_low;position_3d_low_size;position;position_size;normal;normal_size;scale_normal_and_cap;scale_normal_and_cap_size;batch_id;batch_id_size;batch_index;batch_index_size;indices;rtc_translation;outline_position;outline_position_size;outline_scale_normal_and_cap;outline_scale_normal_and_cap_size;outline_skip_indices;outline_batch_index;outline_batch_index_size;constructor(e){let t=e.extent;this.extent=t?new se(t):void 0,this.position_3d_high=e.position_3d_high()?.slice(),this.position_3d_high_size=e.position_3d_high_size(),this.position_3d_low=e.position_3d_low()?.slice(),this.position_3d_low_size=e.position_3d_low_size(),this.position=e.position()?.slice(),this.position_size=e.position_size(),this.normal=e.normal()?.slice(),this.normal_size=e.normal_size(),this.scale_normal_and_cap=e.scale_normal_and_cap()?.slice(),this.scale_normal_and_cap_size=e.scale_normal_and_cap_size(),this.batch_id=e.batch_id()?.slice(),this.batch_id_size=e.batch_id_size(),this.batch_index=e.batch_index()?.slice(),this.batch_index_size=e.batch_index_size(),this.indices=e.indices().slice(),this.rtc_translation=e.rtc_translation?new ae(e.rtc_translation):void 0;let n=e.outline();n&&(this.outline_position=n.position()?.slice(),this.outline_position_size=n.position_size(),this.outline_scale_normal_and_cap=n.scale_normal_and_cap()?.slice(),this.outline_scale_normal_and_cap_size=n.scale_normal_and_cap_size(),this.outline_skip_indices=n.skip_indices()?.slice(),this.outline_batch_index=n.batch_index()?.slice(),this.outline_batch_index_size=n.batch_index_size(),n.free())}},le=class{extent;position;position_size;position_high;position_high_size;position_low;position_low_size;start;start_size;start_high;start_high_size;start_low;start_low_size;forward_offset;forward_offset_size;end_high;end_high_size;end_low;end_low_size;start_normals;start_normals_size;end_normal_and_texture_coordinate_normalization_x;end_normal_and_texture_coordinate_normalization_x_size;right_normal_and_texture_coordinate_normalization_y;right_normal_and_texture_coordinate_normalization_y_size;batch_id;batch_id_size;batch_index;batch_index_size;indices;constructor(e){let t=e.extent;this.extent=t?new se(t):void 0,this.position=e.position().slice(),this.position_size=e.position_size(),this.position_high=e.position_high()?.slice(),this.position_high_size=e.position_high_size(),this.position_low=e.position_low()?.slice(),this.position_low_size=e.position_low_size(),this.start=e.start()?.slice(),this.start_size=e.start_size(),this.start_high=e.start_high()?.slice(),this.start_high_size=e.start_high_size(),this.start_low=e.start_low()?.slice(),this.start_low_size=e.start_low_size(),this.forward_offset=e.forward_offset()?.slice(),this.forward_offset_size=e.forward_offset_size(),this.end_high=e.end_high()?.slice(),this.end_high_size=e.end_high_size(),this.end_low=e.end_low()?.slice(),this.end_low_size=e.end_low_size(),this.start_normals=e.start_normals()?.slice(),this.start_normals_size=e.start_normals_size(),this.end_normal_and_texture_coordinate_normalization_x=e.end_normal_and_texture_coordinate_normalization_x()?.slice(),this.end_normal_and_texture_coordinate_normalization_x_size=e.end_normal_and_texture_coordinate_normalization_x_size(),this.right_normal_and_texture_coordinate_normalization_y=e.right_normal_and_texture_coordinate_normalization_y().slice(),this.right_normal_and_texture_coordinate_normalization_y_size=e.right_normal_and_texture_coordinate_normalization_y_size(),this.batch_id=e.batch_id()?.slice(),this.batch_id_size=e.batch_id_size(),this.batch_index=e.batch_index()?.slice(),this.batch_index_size=e.batch_index_size(),this.indices=e.indices().slice()}};function ue(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function de(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function fe(e){let t,n,r;e.length===2?(t=e===ue||e===de?e:pe,n=e,r=e):(t=ue,n=(t,n)=>ue(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<0?i=t+1:a=t}while(i<a)}return i}function a(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<=0?i=t+1:a=t}while(i<a)}return i}function o(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function pe(){return 0}function me(e){return e===null?NaN:+e}var he=fe(ue);he.right,he.left,fe(me).center;var ge={value:()=>{}};function _e(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new ve(n)}function ve(e){this._=e}function ye(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}ve.prototype=_e.prototype={constructor:ve,on:function(e,t){var n=this._,r=ye(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=be(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=xe(n[i],e.name,t);else if(t==null)for(i in n)n[i]=xe(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ve(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function be(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function xe(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=ge,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Se={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function Ce(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),Se.hasOwnProperty(t)?{space:Se[t],local:e}:e}function we(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function Te(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ee(e){var t=Ce(e);return(t.local?Te:we)(t)}function De(){}function Oe(e){return e==null?De:function(){return this.querySelector(e)}}function ke(e){typeof e!=`function`&&(e=Oe(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new O(r,this._parents)}function Ae(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function je(){return[]}function Me(e){return e==null?je:function(){return this.querySelectorAll(e)}}function Ne(e){return function(){return Ae(e.apply(this,arguments))}}function Pe(e){e=typeof e==`function`?Ne(e):Me(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new O(r,i)}function Fe(e){return function(){return this.matches(e)}}function Ie(e){return function(t){return t.matches(e)}}var Le=Array.prototype.find;function Re(e){return function(){return Le.call(this.children,e)}}function ze(){return this.firstElementChild}function Be(e){return this.select(e==null?ze:Re(typeof e==`function`?e:Ie(e)))}var Ve=Array.prototype.filter;function He(){return Array.from(this.children)}function Ue(e){return function(){return Ve.call(this.children,e)}}function We(e){return this.selectAll(e==null?He:Ue(typeof e==`function`?e:Ie(e)))}function Ge(e){typeof e!=`function`&&(e=Fe(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new O(r,this._parents)}function Ke(e){return Array(e.length)}function qe(){return new O(this._enter||this._groups.map(Ke),this._parents)}function Je(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Je.prototype={constructor:Je,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Ye(e){return function(){return e}}function Xe(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new Je(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function Ze(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new Je(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function Qe(e){return e.__data__}function $e(e,t){if(!arguments.length)return Array.from(this,Qe);var n=t?Ze:Xe,r=this._parents,i=this._groups;typeof e!=`function`&&(e=Ye(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=et(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,ee,y;_<m;++_)if(ee=h[_]){for(_>=v&&(v=_+1);!(y=g[v])&&++v<m;);ee._next=y||null}}return o=new O(o,r),o._enter=s,o._exit=c,o}function et(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function tt(){return new O(this._exit||this._groups.map(Ke),this._parents)}function nt(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function rt(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new O(s,this._parents)}function it(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function at(e){e||=ot;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new O(i,this._parents).order()}function ot(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function st(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ct(){return Array.from(this)}function lt(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function ut(){let e=0;for(let t of this)++e;return e}function dt(){return!this.node()}function ft(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function pt(e){return function(){this.removeAttribute(e)}}function mt(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ht(e,t){return function(){this.setAttribute(e,t)}}function gt(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function _t(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function vt(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function yt(e,t){var n=Ce(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?mt:pt:typeof t==`function`?n.local?vt:_t:n.local?gt:ht)(n,t))}function bt(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function xt(e){return function(){this.style.removeProperty(e)}}function St(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Ct(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function wt(e,t,n){return arguments.length>1?this.each((t==null?xt:typeof t==`function`?Ct:St)(e,t,n??``)):D(this.node(),e)}function D(e,t){return e.style.getPropertyValue(t)||bt(e).getComputedStyle(e,null).getPropertyValue(t)}function Tt(e){return function(){delete this[e]}}function Et(e,t){return function(){this[e]=t}}function Dt(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Ot(e,t){return arguments.length>1?this.each((t==null?Tt:typeof t==`function`?Dt:Et)(e,t)):this.node()[e]}function kt(e){return e.trim().split(/^|\s+/)}function At(e){return e.classList||new jt(e)}function jt(e){this._node=e,this._names=kt(e.getAttribute(`class`)||``)}jt.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function Mt(e,t){for(var n=At(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function Nt(e,t){for(var n=At(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Pt(e){return function(){Mt(this,e)}}function Ft(e){return function(){Nt(this,e)}}function It(e,t){return function(){(t.apply(this,arguments)?Mt:Nt)(this,e)}}function Lt(e,t){var n=kt(e+``);if(arguments.length<2){for(var r=At(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?It:t?Pt:Ft)(n,t))}function Rt(){this.textContent=``}function zt(e){return function(){this.textContent=e}}function Bt(e){return function(){this.textContent=e.apply(this,arguments)??``}}function Vt(e){return arguments.length?this.each(e==null?Rt:(typeof e==`function`?Bt:zt)(e)):this.node().textContent}function Ht(){this.innerHTML=``}function Ut(e){return function(){this.innerHTML=e}}function Wt(e){return function(){this.innerHTML=e.apply(this,arguments)??``}}function Gt(e){return arguments.length?this.each(e==null?Ht:(typeof e==`function`?Wt:Ut)(e)):this.node().innerHTML}function Kt(){this.nextSibling&&this.parentNode.appendChild(this)}function qt(){return this.each(Kt)}function Jt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Yt(){return this.each(Jt)}function Xt(e){var t=typeof e==`function`?e:Ee(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Zt(){return null}function Qt(e,t){var n=typeof e==`function`?e:Ee(e),r=t==null?Zt:typeof t==`function`?t:Oe(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function $t(){var e=this.parentNode;e&&e.removeChild(this)}function en(){return this.each($t)}function tn(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function nn(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function rn(e){return this.select(e?nn:tn)}function an(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function on(e){return function(t){e.call(this,t,this.__data__)}}function sn(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function cn(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function ln(e,t,n){return function(){var r=this.__on,i,a=on(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function un(e,t,n){var r=sn(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?ln:cn,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function dn(e,t,n){var r=bt(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function fn(e,t){return function(){return dn(this,e,t)}}function pn(e,t){return function(){return dn(this,e,t.apply(this,arguments))}}function mn(e,t){return this.each((typeof t==`function`?pn:fn)(e,t))}function*hn(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var gn=[null];function O(e,t){this._groups=e,this._parents=t}function k(){return new O([[document.documentElement]],gn)}function _n(){return this}O.prototype=k.prototype={constructor:O,select:ke,selectAll:Pe,selectChild:Be,selectChildren:We,filter:Ge,data:$e,enter:qe,exit:tt,join:nt,merge:rt,selection:_n,order:it,sort:at,call:st,nodes:ct,node:lt,size:ut,empty:dt,each:ft,attr:yt,style:wt,property:Ot,classed:Lt,text:Vt,html:Gt,raise:qt,lower:Yt,append:Xt,insert:Qt,remove:en,clone:rn,datum:an,on:un,dispatch:mn,[Symbol.iterator]:hn};function vn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function yn(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function A(){}var j=.7,bn=1/j,M=`\\s*([+-]?\\d+)\\s*`,N=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,P=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,xn=/^#([0-9a-f]{3,8})$/,Sn=RegExp(`^rgb\\(${M},${M},${M}\\)$`),Cn=RegExp(`^rgb\\(${P},${P},${P}\\)$`),wn=RegExp(`^rgba\\(${M},${M},${M},${N}\\)$`),Tn=RegExp(`^rgba\\(${P},${P},${P},${N}\\)$`),En=RegExp(`^hsl\\(${N},${P},${P}\\)$`),Dn=RegExp(`^hsla\\(${N},${P},${P},${N}\\)$`),On={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};vn(A,F,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:kn,formatHex:kn,formatHex8:An,formatHsl:jn,formatRgb:Mn,toString:Mn});function kn(){return this.rgb().formatHex()}function An(){return this.rgb().formatHex8()}function jn(){return Vn(this).formatHsl()}function Mn(){return this.rgb().formatRgb()}function F(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=xn.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Nn(t):n===3?new I(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Pn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Pn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Sn.exec(e))?new I(t[1],t[2],t[3],1):(t=Cn.exec(e))?new I(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=wn.exec(e))?Pn(t[1],t[2],t[3],t[4]):(t=Tn.exec(e))?Pn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=En.exec(e))?Bn(t[1],t[2]/100,t[3]/100,1):(t=Dn.exec(e))?Bn(t[1],t[2]/100,t[3]/100,t[4]):On.hasOwnProperty(e)?Nn(On[e]):e===`transparent`?new I(NaN,NaN,NaN,0):null}function Nn(e){return new I(e>>16&255,e>>8&255,e&255,1)}function Pn(e,t,n,r){return r<=0&&(e=t=n=NaN),new I(e,t,n,r)}function Fn(e){return e instanceof A||(e=F(e)),e?(e=e.rgb(),new I(e.r,e.g,e.b,e.opacity)):new I}function In(e,t,n,r){return arguments.length===1?Fn(e):new I(e,t,n,r??1)}function I(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}vn(I,In,yn(A,{brighter(e){return e=e==null?bn:bn**+e,new I(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?j:j**+e,new I(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new I(R(this.r),R(this.g),R(this.b),L(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ln,formatHex:Ln,formatHex8:Rn,formatRgb:zn,toString:zn}));function Ln(){return`#${z(this.r)}${z(this.g)}${z(this.b)}`}function Rn(){return`#${z(this.r)}${z(this.g)}${z(this.b)}${z((isNaN(this.opacity)?1:this.opacity)*255)}`}function zn(){let e=L(this.opacity);return`${e===1?`rgb(`:`rgba(`}${R(this.r)}, ${R(this.g)}, ${R(this.b)}${e===1?`)`:`, ${e})`}`}function L(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function R(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function z(e){return e=R(e),(e<16?`0`:``)+e.toString(16)}function Bn(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new B(e,t,n,r)}function Vn(e){if(e instanceof B)return new B(e.h,e.s,e.l,e.opacity);if(e instanceof A||(e=F(e)),!e)return new B;if(e instanceof B)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new B(o,s,c,e.opacity)}function Hn(e,t,n,r){return arguments.length===1?Vn(e):new B(e,t,n,r??1)}function B(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}vn(B,Hn,yn(A,{brighter(e){return e=e==null?bn:bn**+e,new B(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?j:j**+e,new B(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new I(Gn(e>=240?e-240:e+120,i,r),Gn(e,i,r),Gn(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new B(Un(this.h),Wn(this.s),Wn(this.l),L(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=L(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Un(this.h)}, ${Wn(this.s)*100}%, ${Wn(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Un(e){return e=(e||0)%360,e<0?e+360:e}function Wn(e){return Math.max(0,Math.min(1,e||0))}function Gn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Kn=e=>()=>e;function qn(e,t){return function(n){return e+n*t}}function Jn(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Yn(e){return(e=+e)==1?Xn:function(t,n){return n-t?Jn(t,n,e):Kn(isNaN(t)?n:t)}}function Xn(e,t){var n=t-e;return n?qn(e,n):Kn(isNaN(e)?t:e)}var Zn=(function e(t){var n=Yn(t);function r(e,t){var r=n((e=In(e)).r,(t=In(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Xn(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function V(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Qn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$n=new RegExp(Qn.source,`g`);function er(e){return function(){return e}}function tr(e){return function(t){return e(t)+``}}function nr(e,t){var n=Qn.lastIndex=$n.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Qn.exec(e))&&(i=$n.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:V(r,i)})),n=$n.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?tr(c[0].x):er(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}var rr=180/Math.PI,ir={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ar(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*rr,skewX:Math.atan(c)*rr,scaleX:o,scaleY:s}}var or;function sr(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?ir:ar(t.a,t.b,t.c,t.d,t.e,t.f)}function cr(e){return e==null||(or||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),or.setAttribute(`transform`,e),!(e=or.transform.baseVal.consolidate()))?ir:(e=e.matrix,ar(e.a,e.b,e.c,e.d,e.e,e.f))}function lr(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:V(e,i)},{i:c-2,x:V(r,a)})}else (i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:V(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:V(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:V(e,n)},{i:s-2,x:V(t,r)})}else (n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var ur=lr(sr,`px, `,`px)`,`deg)`),dr=lr(cr,`, `,`)`,`)`),H=0,fr=0,pr=0,mr=1e3,hr,U,gr=0,W=0,_r=0,G=typeof performance==`object`&&performance.now?performance:Date,vr=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function yr(){return W||=(vr(br),G.now()+_r)}function br(){W=0}function xr(){this._call=this._time=this._next=null}xr.prototype=Sr.prototype={constructor:xr,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?yr():+n)+(t==null?0:+t),!this._next&&U!==this&&(U?U._next=this:hr=this,U=this),this._call=e,this._time=n,Dr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Dr())}};function Sr(e,t,n){var r=new xr;return r.restart(e,t,n),r}function Cr(){yr(),++H;for(var e=hr,t;e;)(t=W-e._time)>=0&&e._call.call(void 0,t),e=e._next;--H}function wr(){W=(gr=G.now())+_r,H=fr=0;try{Cr()}finally{H=0,Er(),W=0}}function Tr(){var e=G.now(),t=e-gr;t>mr&&(_r-=t,gr=e)}function Er(){for(var e,t=hr,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:hr=n);U=e,Dr(r)}function Dr(e){H||(fr&&=clearTimeout(fr),e-W>24?(e<1/0&&(fr=setTimeout(wr,e-G.now()-_r)),pr&&=clearInterval(pr)):(pr||=(gr=G.now(),setInterval(Tr,mr)),H=1,vr(wr)))}function Or(e,t,n){var r=new xr;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var kr=_e(`start`,`end`,`cancel`,`interrupt`),Ar=[];function jr(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Nr(e,n,{name:t,index:r,group:i,on:kr,tween:Ar,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function Mr(e,t){var n=q(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function K(e,t){var n=q(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function q(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Nr(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Sr(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return Or(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(Or(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function Pr(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function Fr(e){return this.each(function(){Pr(this,e)})}function Ir(e,t){var n,r;return function(){var i=K(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Lr(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=K(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function Rr(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=q(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?Ir:Lr)(n,e,t))}function zr(e,t,n){var r=e._id;return e.each(function(){var e=K(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return q(e,r).value[t]}}function Br(e,t){var n;return(typeof t==`number`?V:t instanceof F?Zn:(n=F(t))?(t=n,Zn):nr)(e,t)}function Vr(e){return function(){this.removeAttribute(e)}}function Hr(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ur(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function Wr(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Gr(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Kr(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function qr(e,t){var n=Ce(e),r=n===`transform`?dr:Br;return this.attrTween(e,typeof t==`function`?(n.local?Kr:Gr)(n,r,zr(this,`attr.`+e,t)):t==null?(n.local?Hr:Vr)(n):(n.local?Wr:Ur)(n,r,t))}function Jr(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Yr(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Xr(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Yr(e,i)),n}return i._value=t,i}function Zr(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Jr(e,i)),n}return i._value=t,i}function Qr(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=Ce(e);return this.tween(n,(r.local?Xr:Zr)(r,t))}function $r(e,t){return function(){Mr(this,e).delay=+t.apply(this,arguments)}}function ei(e,t){return t=+t,function(){Mr(this,e).delay=t}}function ti(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?$r:ei)(t,e)):q(this.node(),t).delay}function ni(e,t){return function(){K(this,e).duration=+t.apply(this,arguments)}}function ri(e,t){return t=+t,function(){K(this,e).duration=t}}function ii(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?ni:ri)(t,e)):q(this.node(),t).duration}function ai(e,t){if(typeof t!=`function`)throw Error();return function(){K(this,e).ease=t}}function oi(e){var t=this._id;return arguments.length?this.each(ai(t,e)):q(this.node(),t).ease}function si(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();K(this,e).ease=n}}function ci(e){if(typeof e!=`function`)throw Error();return this.each(si(this._id,e))}function li(e){typeof e!=`function`&&(e=Fe(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new J(r,this._parents,this._name,this._id)}function ui(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new J(o,this._parents,this._name,this._id)}function di(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function fi(e,t,n){var r,i,a=di(t)?Mr:K;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function pi(e,t){var n=this._id;return arguments.length<2?q(this.node(),n).on.on(e):this.each(fi(n,e,t))}function mi(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function hi(){return this.on(`end.remove`,mi(this._id))}function gi(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Oe(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,jr(l[f],t,n,f,l,q(u,n)));return new J(a,this._parents,t,n)}function _i(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Me(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=q(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&jr(p,t,n,h,f,m);a.push(f),o.push(u)}return new J(a,o,t,n)}var vi=k.prototype.constructor;function yi(){return new vi(this._groups,this._parents)}function bi(e,t){var n,r,i;return function(){var a=D(this,e),o=(this.style.removeProperty(e),D(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function xi(e){return function(){this.style.removeProperty(e)}}function Si(e,t,n){var r,i=n+``,a;return function(){var o=D(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function Ci(e,t,n){var r,i,a;return function(){var o=D(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),D(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function wi(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=K(this,e),l=c.on,u=c.value[a]==null?s||=xi(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function Ti(e,t,n){var r=(e+=``)==`transform`?ur:Br;return t==null?this.styleTween(e,bi(e,r)).on(`end.style.`+e,xi(e)):typeof t==`function`?this.styleTween(e,Ci(e,r,zr(this,`style.`+e,t))).each(wi(this._id,e)):this.styleTween(e,Si(e,r,t),n).on(`end.style.`+e,null)}function Ei(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Di(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Ei(e,a,n)),r}return a._value=t,a}function Oi(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,Di(e,t,n??``))}function ki(e){return function(){this.textContent=e}}function Ai(e){return function(){this.textContent=e(this)??``}}function ji(e){return this.tween(`text`,typeof e==`function`?Ai(zr(this,`text`,e)):ki(e==null?``:e+``))}function Mi(e){return function(t){this.textContent=e.call(this,t)}}function Ni(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Mi(r)),t}return r._value=e,r}function Pi(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,Ni(e))}function Fi(){for(var e=this._name,t=this._id,n=zi(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=q(c,t);jr(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new J(r,this._parents,e,n)}function Ii(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=K(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var Li=0;function J(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Ri(e){return k().transition(e)}function zi(){return++Li}var Y=k.prototype;J.prototype=Ri.prototype={constructor:J,select:gi,selectAll:_i,selectChild:Y.selectChild,selectChildren:Y.selectChildren,filter:li,merge:ui,selection:yi,transition:Fi,call:Y.call,nodes:Y.nodes,node:Y.node,size:Y.size,empty:Y.empty,each:Y.each,on:pi,attr:qr,attrTween:Qr,style:Ti,styleTween:Oi,text:ji,textTween:Pi,remove:hi,tween:Rr,delay:ti,duration:ii,ease:oi,easeVarying:ci,end:Ii,[Symbol.iterator]:Y[Symbol.iterator]};function Bi(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Vi={time:null,delay:0,duration:250,ease:Bi};function Hi(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Ui(e){var t,n;e instanceof J?(t=e._id,e=e._name):(t=zi(),(n=Vi).time=yr(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&jr(c,e,t,l,o,n||Hi(c,t));return new J(r,this._parents,e,t)}k.prototype.interrupt=Fr,k.prototype.transition=Ui;var{abs:Wi,max:Gi,min:Ki}=Math;[`w`,`e`].map(qi),[`n`,`s`].map(qi),[`n`,`w`,`e`,`s`,`nw`,`ne`,`sw`,`se`].map(qi);function qi(e){return{type:e}}function Ji(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function Yi(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Xi(e){return e=Yi(Math.abs(e)),e?e[1]:NaN}function Zi(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function Qi(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var $i=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ea(e){if(!(t=$i.exec(e)))throw Error(`invalid format: `+e);var t;return new ta({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}ea.prototype=ta.prototype;function ta(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}ta.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function na(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var ra;function ia(e,t){var n=Yi(e,t);if(!n)return e+``;var r=n[0],i=n[1],a=i-(ra=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+Yi(e,Math.max(0,t+a-1))[0]}function aa(e,t){var n=Yi(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var oa={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:Ji,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>aa(e*100,t),r:aa,s:ia,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function sa(e){return e}var ca=Array.prototype.map,la=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function ua(e){var t=e.grouping===void 0||e.thousands===void 0?sa:Zi(ca.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?sa:Qi(ca.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e){e=ea(e);var l=e.fill,u=e.align,d=e.sign,f=e.symbol,p=e.zero,m=e.width,h=e.comma,g=e.precision,_=e.trim,v=e.type;v===`n`?(h=!0,v=`g`):oa[v]||(g===void 0&&(g=12),_=!0,v=`g`),(p||l===`0`&&u===`=`)&&(p=!0,l=`0`,u=`=`);var ee=f===`$`?n:f===`#`&&/[boxX]/.test(v)?`0`+v.toLowerCase():``,y=f===`$`?r:/[%p]/.test(v)?o:``,b=oa[v],x=/[defgprs%]/.test(v);g=g===void 0?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g));function S(e){var n=ee,r=y,o,f,S;if(v===`c`)r=b(e)+r,e=``;else{e=+e;var C=e<0||1/e<0;if(e=isNaN(e)?c:b(Math.abs(e),g),_&&(e=na(e)),C&&+e==0&&d!==`+`&&(C=!1),n=(C?d===`(`?d:s:d===`-`||d===`(`?``:d)+n,r=(v===`s`?la[8+ra/3]:``)+r+(C&&d===`(`?`)`:``),x){for(o=-1,f=e.length;++o<f;)if(S=e.charCodeAt(o),48>S||S>57){r=(S===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}h&&!p&&(e=t(e,1/0));var w=n.length+e.length+r.length,T=w<m?Array(m-w+1).join(l):``;switch(h&&p&&(e=t(T+e,T.length?m-r.length:1/0),T=``),u){case`<`:e=n+e+r+T;break;case`=`:e=n+T+e+r;break;case`^`:e=T.slice(0,w=T.length>>1)+n+e+r+T.slice(w);break;default:e=T+n+e+r;break}return a(e)}return S.toString=function(){return e+``},S}function u(e,t){var n=l((e=ea(e),e.type=`f`,e)),r=Math.max(-8,Math.min(8,Math.floor(Xi(t)/3)))*3,i=10**-r,a=la[8+r/3];return function(e){return n(i*e)+a}}return{format:l,formatPrefix:u}}var da;fa({thousands:`,`,grouping:[3],currency:[`$`,``]});function fa(e){return da=ua(e),da.format,da.formatPrefix,da}function X(e,t,n){this.k=e,this.x=t,this.y=n}X.prototype={constructor:X,scale:function(e){return e===1?this:new X(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new X(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var pa=new X(1,0,0);ma.prototype=X.prototype;function ma(e){for(;!e.__zoom;)if(!(e=e.parentNode))return pa;return e.__zoom}function ha(e){let t=new ce(e);return{result:t,transfers:[t.batch_id?.buffer,t.batch_index?.buffer,t.normal?.buffer,t.position_3d_high?.buffer,t.position_3d_low?.buffer,t.position?.buffer,t.scale_normal_and_cap?.buffer,t.indices.buffer,t.outline_position?.buffer,t.outline_scale_normal_and_cap?.buffer,t.outline_skip_indices?.buffer,t.outline_batch_index?.buffer].filter(ie)}}function Z(e){return new n.TransferableTile(ga(e.coords),e.max_height,e.min_height,e.cached_mesh_handle?_a(e.cached_mesh_handle):void 0)}function ga(e){return new n.TileXYZ(e.x,e.y,e.z)}function _a(e){return new n.CachedMeshHandle(e.vertices,e.indices,e.uvs,e.heights)}function va(e){return new n.UpsamplableTerrainGeometry(e.uvs,e.indices,e.heights,e.normals,e.watermask)}function ya(e){return new n.ExtentRadianF32(e.west,e.south,e.east,e.north)}function ba(e){return new n.PolygonMaterial(e.show,e.castShadow,e.receiveShadow,e.color,e.clampToGround,e.tiled,e.height,e.extrudedHeight,e.wireframe,e.outline,e.perPositionHeight,e.__internal__)}function xa(e){let t=new n.TransferablePolygonBatchedFeature(e.crs,e.length);return t.setOuterRing(e.outer_ring.length,t=>{t.set(e.outer_ring)}),t.setOuterRingSizes(e.outer_ring_sizes.length,t=>{t.set(e.outer_ring_sizes)}),t.setHoles(e.holes.length,t=>{t.set(e.holes)}),t.setHolesSizes(e.holes_sizes.length,t=>{t.set(e.holes_sizes)}),t.setHolesTotalSizes(e.holes_total_sizes.length,t=>{t.set(e.holes_total_sizes)}),t.setHolesBoundaries(e.holes_boundaries.length,t=>{t.set(e.holes_boundaries)}),t.setExpectedWindingOrders(e.expected_winding_orders.length,t=>{t.set(e.expected_winding_orders)}),t.setBatchIds(e.batch_ids.length,t=>{t.set(e.batch_ids)}),t.setBatchIndices(e.batch_indices.length,t=>{t.set(e.batch_indices)}),t}var Sa;async function Q(){return Sa??=(0,n.default)(),Sa}async function Ca(){if(!Sa)return 0;let{memory:e}=await Sa;return e.buffer.byteLength}async function wa(e,t,r,i){await Q();let a=(0,n.constructPolygonBatchedFeature)(xa(e),ba(t),r,i?ya(i):void 0);if(!a)return;let{result:o,transfers:s}=ha(a);return a.free(),$(o,s)}function Ta(e){let t=new le(e);return{result:t,transfers:[t.position.buffer,t.position_high?.buffer,t.position_low?.buffer,t.start?.buffer,t.start_high?.buffer,t.start_low?.buffer,t.end_high?.buffer,t.end_low?.buffer,t.start_normals?.buffer,t.forward_offset?.buffer,t.end_normal_and_texture_coordinate_normalization_x?.buffer,t.right_normal_and_texture_coordinate_normalization_y.buffer,t.batch_id?.buffer,t.batch_index?.buffer,t.indices.buffer].filter(ie)}}function Ea(e){return new n.PolylineMaterial(e.show,e.castShadow,e.receiveShadow,e.color,e.clampToGround,e.tiled,e.height,e.width,e.maxWidth,e.__internal__)}function Da(e){let t=new n.TransferablePolylineBatchedFeature(e.crs,e.length);return t.setPoints(e.points.length,t=>{t.set(e.points)}),t.setPointsSizes(e.points_sizes.length,t=>{t.set(e.points_sizes)}),t.setBatchIds(e.batch_ids.length,t=>{t.set(e.batch_ids)}),t.setBatchIndices(e.batch_indices.length,t=>{t.set(e.batch_indices)}),t}async function Oa(e,t,r){await Q();let i=(0,n.constructPolylineBatchedFeature)(Da(e),Ea(t),r);if(!i)return;let{result:a,transfers:o}=Ta(i);return i.free(),$(a,o)}function ka(e){let t=new oe(e),n=[t.vertices.buffer,t.uvs.buffer,t.indices.buffer,t.heights.buffer];return t.normals&&n.push(t.normals.buffer),t.skirt_vertices&&n.push(t.skirt_vertices.buffer),t.skirt_uvs&&n.push(t.skirt_uvs.buffer),t.skirt_indices&&n.push(t.skirt_indices.buffer),t.skirt_normals&&n.push(t.skirt_normals.buffer),t.watermask&&n.push(t.watermask.buffer),{result:t,transfers:n}}async function Aa(e,t,r,i,a,o){await Q();let s=(0,n.constructQuantizedMeshTerrainMesh)(e,Z(t),r,i,a,o),{result:c,transfers:l}=ka(s);return s.free(),$({result:c},[...l])}function ja(e){return new n.TransferableRasterDEMData(new n.ElevationDecoder(e.decoder.r_scaler,e.decoder.g_scaler,e.decoder.b_scaler,e.decoder.offset,e.decoder.max_offset,e.decoder.min_offset,e.decoder.boundary,e.decoder.epsilon))}async function Ma(e,t,r,i,a,o){await Q();let s=i+1,c=n.TransferableMartini.fromSize(s),l=(0,n.constructTerrainMesh)(e,Z(t),ja(r),c,a,o),{result:u,transfers:d}=ka(l);return l.free(),$({result:u},[...d])}async function Na(e){let t=await createImageBitmap(e);try{let e=new OffscreenCanvas(t.width,t.height).getContext(`2d`);if(e===null)throw Error(`failed to get context of canvas`);e.drawImage(t,0,0);let n=e.getImageData(0,0,t.width,t.height).data;return $(n,[n.buffer])}finally{t.close()}}async function Pa(e,t){try{let n=t.getContext(`2d`);if(n===null)throw Error(`failed to get context of canvas`);return n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height).data}finally{e.close()}}async function Fa(e,t,r,i,a,o,s){await Q();let c=(0,n.parseMvtTile)(e,t,r,i,a?ya(a):void 0,o,s),l,u,d,f,p;try{l=c.f64_stream(),u=c.f32_stream(),d=c.u32_stream(),f=c.u8_stream(),p=c.meta()}finally{c.free()}return $({f64_stream:l,f32_stream:u,u32_stream:d,u8_stream:f,meta:p},[l.buffer,u.buffer,d.buffer,f.buffer])}async function Ia(e,t,r,i,a,o,s){await Q();let c=(0,n.upsampleQuantizedMeshTerrainMesh)(Z(e),Z(t),va(r),i,a,o,s),{result:l,transfers:u}=ka(c);return c.free(),$(l,u)}async function La(e,t,r,i,a,o,s){await Q();let c=(0,n.upsampleTerrainMesh)(Z(e),Z(t),ja(r),va(i),a,o,s),{result:l,transfers:u}=ka(c);return c.free(),$(l,u)}async function Ra(){await Q()}var za={constructTerrainMesh:Ma,constructQuantizedMeshTerrainMesh:Aa,upsampleTerrainMesh:La,upsampleQuantizedMeshTerrainMesh:Ia,getImageDataFromImageBitmap:Pa,getImageDataFromBlob:Na,constructPolygonBatchedFeature:wa,constructPolylineBatchedFeature:Oa,parseMvtTile:Fa,warmUp:Ra,getWasmMemoryUsage:Ca},$=(e,t)=>new T.Transfer(e,t),Ba=!1,Va=(...e)=>(Ba||=(T.worker(za),Ha(),!0),T.worker(...e));function Ha(){za.warmUp.worker?.addAbortListener(async()=>{})}var{initializeWorkerPool:Ua,terminateWorkerPool:Wa,warmUpWorkerPool:Ga,worker:Ka,workerPoolStats:qa,workerPoolHeapStats:Ja,probeWorkerPoolHeap:Ya}=(()=>{let e;return{initializeWorkerPool:(t,n,r)=>{if(e)throw Error(`Worker pool has already been initialized.`);e={pool:new re(t,n.total,r),manager:n}},terminateWorkerPool:()=>{e&&=(e.pool.terminate(),void 0)},warmUpWorkerPool:()=>(m(e,`initializeWorkerPool() must be invoked first.`),e.pool.warmUp()),worker:()=>(m(e,`initializeWorkerPool() must be invoked first.`),{pool:e.pool,manager:e.manager}),workerPoolStats:()=>e?.pool.stats(),workerPoolHeapStats:()=>e?.pool.heapStats(),probeWorkerPoolHeap:()=>e?.pool.probeHeap()}})(),Xa=()=>{let{pool:e,manager:t}=Ka();return t.canIncrement()&&e.canAcceptTasks()};function Za(e,t,n){let{pool:r,manager:i}=Ka();i.increment();try{return r.exec(e,t,n).then(e=>(i.decrement(),e)).catch(e=>{throw i.decrement(),e})}catch(e){throw i.decrement(),e}}e.canWorkerProcessImmediately=Xa,e.createConcurrencyManager=e=>{let t=0,n=()=>t!==e,r=()=>t!==0;return{total:e,actives:()=>t,idles:()=>e-t,increment:()=>{n()&&t++},decrement:()=>{r()&&t--},canIncrement:n,canDecrement:r,reset:()=>{t=0}}},e.initializeWorkerPool=Ua,e.probeWorkerPoolHeap=Ya,e.queueTask=Za,e.registerTasks=Va,e.terminateWorkerPool=Wa,e.transfer=$,e.warmUpWorkerPool=Ga,e.workerPoolHeapStats=Ja,e.workerPoolStats=qa});
11
+ `,i(new D(r))}),this.processing=Object.create(null),this.tracking=Object.create(null),this.terminating=!1,this.terminated=!1,this.cleaning=!1,this.terminationHandler=null,this.lastId=0}E.prototype.methods=function(){return this.exec(`methods`)},E.prototype.exec=function(e,t,r,i){r||=n.defer();var a=++this.lastId;this.processing[a]={id:a,resolver:r,options:i};var o={message:{id:a,method:e,params:t},transfer:i&&i.transfer};this.terminated?r.reject(new D(`Worker is terminated`)):this.worker.ready?this.worker.send(o.message,o.transfer):this.requestQueue.push(o);var s=this;return r.promise.catch(function(e){if(e instanceof n.CancellationError||e instanceof n.TimeoutError)return s.tracking[a]={id:a,resolver:n.defer(),options:i,error:e},delete s.processing[a],s.tracking[a].resolver.promise=s.tracking[a].resolver.promise.catch(function(e){if(delete s.tracking[a],e instanceof ee)throw e.error;return s.terminateAndNotify(!0).then(function(){throw e},function(e){throw e})}),s.worker.send({id:a,method:l}),s.tracking[a].timeoutId=setTimeout(function(){s.tracking[a].resolver.reject(e)},s.workerTerminateTimeout),s.tracking[a].resolver.promise;throw e})},E.prototype.busy=function(){return this.cleaning||Object.keys(this.processing).length>0||Object.keys(this.tracking).length>0},E.prototype.terminate=function(e,t){var n=this;if(e){for(var r in this.processing)this.processing[r]!==void 0&&this.processing[r].resolver.reject(Error(`Worker terminated`));this.processing=Object.create(null)}for(var i of Object.values(n.tracking))clearTimeout(i.timeoutId),i.resolver.reject(Error(`Worker Terminating`));if(n.tracking=Object.create(null),typeof t==`function`&&(this.terminationHandler=t),this.busy())this.terminating=!0;else{var a=function(e){if(n.terminated=!0,n.cleaning=!1,n.worker!=null&&n.worker.removeAllListeners&&n.worker.removeAllListeners(`message`),n.worker=null,n.terminating=!1,n.terminationHandler)n.terminationHandler(e,n);else if(e)throw e};if(this.worker)if(typeof this.worker.kill==`function`){if(this.worker.killed){a(Error(`worker already killed!`));return}var o=setTimeout(function(){n.worker&&n.worker.kill()},this.workerTerminateTimeout);this.worker.once(`exit`,function(){clearTimeout(o),n.worker&&(n.worker.killed=!0),a()}),this.worker.ready?this.worker.send(c):this.requestQueue.push({message:c}),this.cleaning=!0;return}else if(typeof this.worker.terminate==`function`)this.worker.terminate(),this.worker.killed=!0;else throw Error(`Failed to terminate worker`);a()}},E.prototype.terminateAndNotify=function(e,t){var r=n.defer();return t&&r.promise.timeout(t),this.terminate(e,function(e,t){e?r.reject(e):r.resolve(t)}),r.promise};function ee(e){this.error=e,this.stack=Error().stack}var D=class extends Error{constructor(e,t){super(e||`worker terminated`),this.cause=t}};t.exports=E,t.exports._tryRequireWorkerThreads=f,t.exports._setupProcessWorker=S,t.exports._setupBrowserWorker=b,t.exports._setupWorkerThreadWorker=x,t.exports.ensureWorkerThreads=u,t.exports.TerminateError=D})),b=l(((e,t)=>{function n(){this.tasks=[]}n.prototype.push=function(e){this.tasks.push(e)},n.prototype.pop=function(){return this.tasks.shift()},n.prototype.size=function(){return this.tasks.length},n.prototype.contains=function(e){return this.tasks.includes(e)},n.prototype.clear=function(){this.tasks.length=0};function r(){this.tasks=[]}r.prototype.push=function(e){this.tasks.push(e)},r.prototype.pop=function(){return this.tasks.pop()},r.prototype.size=function(){return this.tasks.length},r.prototype.contains=function(e){return this.tasks.includes(e)},r.prototype.clear=function(){this.tasks.length=0},t.exports={FIFOQueue:n,LIFOQueue:r}})),x=l(((e,t)=>{t.exports=n;function n(){this.ports=Object.create(null),this.length=0}n.prototype.nextAvailableStartingAt=function(e){for(;this.ports[e]===!0;)e++;if(e>=65535)throw Error(`WorkerPool debug port limit reached: `+e+`>= 65535`);return this.ports[e]=!0,this.length++,e},n.prototype.releasePort=function(e){delete this.ports[e],this.length--}})),S=l(((e,t)=>{var{Promise:n}=g(),r=y(),i=h(),{FIFOQueue:a,LIFOQueue:o}=b(),s=new(x());function c(e,t){typeof e==`string`?this.script=e||null:(this.script=null,t=e),this.workers=[],this.taskQueue=this._createQueue(t&&t.queueStrategy||`fifo`),t||={},this.forkArgs=Object.freeze(t.forkArgs||[]),this.forkOpts=Object.freeze(t.forkOpts||{}),this.workerOpts=Object.freeze(t.workerOpts||{}),this.workerThreadOpts=Object.freeze(t.workerThreadOpts||{}),this.debugPortStart=t.debugPortStart||43210,this.nodeWorker=t.nodeWorker,this.workerType=t.workerType||t.nodeWorker||`auto`,this.maxQueueSize=t.maxQueueSize||1/0,this.workerTerminateTimeout=t.workerTerminateTimeout||1e3,this.onCreateWorker=t.onCreateWorker||(()=>null),this.onTerminateWorker=t.onTerminateWorker||(()=>null),this.emitStdStreams=t.emitStdStreams||!1,t&&`maxWorkers`in t?(l(t.maxWorkers),this.maxWorkers=t.maxWorkers):this.maxWorkers=Math.max((i.cpus||4)-1,1),t&&`minWorkers`in t&&(t.minWorkers===`max`?this.minWorkers=this.maxWorkers:(u(t.minWorkers),this.minWorkers=t.minWorkers,this.maxWorkers=Math.max(this.minWorkers,this.maxWorkers)),this._ensureMinWorkers()),this._boundNext=this._next.bind(this),this.workerType===`thread`&&r.ensureWorkerThreads()}c.prototype.exec=function(e,t,r){if(t&&!Array.isArray(t))throw TypeError(`Array expected as argument "params"`);if(typeof e==`string`){var i=n.defer();if(this.taskQueue.size()>=this.maxQueueSize)throw Error(`Max queue size of `+this.maxQueueSize+` reached`);var a={method:e,params:t,resolver:i,timeout:null,options:r};this.taskQueue.push(a);var o=i.promise.timeout,s=this.taskQueue;return i.promise.timeout=function(e){return s.contains(a)?(a.timeout=e,i.promise):o.call(i.promise,e)},this._next(),i.promise}else if(typeof e==`function`)return this.exec(`run`,[String(e),t],r);else throw TypeError(`Function or string expected as argument "method"`)},c.prototype.proxy=function(){if(arguments.length>0)throw Error(`No arguments expected`);var e=this;return this.exec(`methods`).then(function(t){var n={};return t.forEach(function(t){n[t]=function(){return e.exec(t,Array.prototype.slice.call(arguments))}}),n})},c.prototype._next=function(){if(this.taskQueue.size()>0){var e=this._getWorker();if(e){var t=this,n=this.taskQueue.pop();if(n.resolver.promise.pending){var r=e.exec(n.method,n.params,n.resolver,n.options).then(t._boundNext).catch(function(){if(e.terminated)return t._removeWorker(e)}).then(function(){t._next()});typeof n.timeout==`number`&&r.timeout(n.timeout)}else t._next()}}},c.prototype._getWorker=function(){for(var e=this.workers,t=0;t<e.length;t++){var n=e[t];if(n.busy()===!1)return n}return e.length<this.maxWorkers?(n=this._createWorkerHandler(),e.push(n),n):null},c.prototype._removeWorker=function(e){var t=this;return s.releasePort(e.debugPort),this._removeWorkerFromList(e),this._ensureMinWorkers(),new n(function(n,r){e.terminate(!1,function(i){t.onTerminateWorker({forkArgs:e.forkArgs,forkOpts:e.forkOpts,workerThreadOpts:e.workerThreadOpts,script:e.script}),i?r(i):n(e)})})},c.prototype._removeWorkerFromList=function(e){var t=this.workers.indexOf(e);t!==-1&&this.workers.splice(t,1)},c.prototype.terminate=function(e,t){for(var r=this,i=this.taskQueue;i.size()>0;){var a=i.pop();if(a)a.resolver.reject(Error(`Pool terminated`));else break}i.clear();var o=function(e){s.releasePort(e.debugPort),this._removeWorkerFromList(e)}.bind(this),c=[];return this.workers.slice().forEach(function(n){var i=n.terminateAndNotify(e,t).then(o).always(function(){r.onTerminateWorker({forkArgs:n.forkArgs,forkOpts:n.forkOpts,workerThreadOpts:n.workerThreadOpts,script:n.script})});c.push(i)}),n.all(c)},c.prototype.stats=function(){var e=this.workers.length,t=this.workers.filter(function(e){return e.busy()}).length;return{totalWorkers:e,busyWorkers:t,idleWorkers:e-t,pendingTasks:this.taskQueue.size(),activeTasks:t}},c.prototype._ensureMinWorkers=function(){if(this.minWorkers)for(var e=this.workers.length;e<this.minWorkers;e++)this.workers.push(this._createWorkerHandler())},c.prototype._createWorkerHandler=function(){let e=this.onCreateWorker({forkArgs:this.forkArgs,forkOpts:this.forkOpts,workerOpts:this.workerOpts,workerThreadOpts:this.workerThreadOpts,script:this.script})||{};return new r(e.script||this.script,{forkArgs:e.forkArgs||this.forkArgs,forkOpts:e.forkOpts||this.forkOpts,workerOpts:e.workerOpts||this.workerOpts,workerThreadOpts:e.workerThreadOpts||this.workerThreadOpts,debugPort:s.nextAvailableStartingAt(this.debugPortStart),workerType:this.workerType,workerTerminateTimeout:this.workerTerminateTimeout,emitStdStreams:this.emitStdStreams})},c.prototype._createQueue=function(e){if(typeof e==`string`)switch(e){case`fifo`:return new a;case`lifo`:return new o;default:throw Error(`Unknown queue strategy: `+e)}if(!e)throw Error(`Queue strategy cannot be null or undefined`);for(var t=[`push`,`pop`,`size`,`contains`,`clear`],n=0;n<t.length;n++){var r=t[n];if(typeof e[r]!=`function`)throw Error(`Queue strategy must implement method: `+r)}return e};function l(e){if(!d(e)||!f(e)||e<1)throw TypeError(`Option maxWorkers must be an integer number >= 1`)}function u(e){if(!d(e)||!f(e)||e<0)throw TypeError(`Option minWorkers must be an integer number >= 0`)}function d(e){return typeof e==`number`}function f(e){return Math.round(e)==e}t.exports=c})),C=l(((e,t)=>{function n(e,t){this.message=e,this.transfer=t}t.exports=n})),w=l((e=>{var t=C(),n=g().Promise,r=`__workerpool-terminate__`,i=`__workerpool-cleanup__`,a=1e3,o={exit:function(){}},s={addAbortListener:function(e){o.abortListeners.push(e)},emit:o.emit};if(typeof self<`u`&&typeof postMessage==`function`&&typeof addEventListener==`function`)o.on=function(e,t){addEventListener(e,function(e){t(e.data)})},o.send=function(e,t){t?postMessage(e,t):postMessage(e)};else if(typeof process<`u`){var c;try{c=m()}catch(e){if(!(typeof e==`object`&&e&&e.code===`MODULE_NOT_FOUND`))throw e}if(c&&c.parentPort!==null){var l=c.parentPort;o.send=l.postMessage.bind(l),o.on=l.on.bind(l),o.exit=process.exit.bind(process)}else o.on=process.on.bind(process),o.send=function(e){process.send(e)},o.on(`disconnect`,function(){process.exit(1)}),o.exit=process.exit.bind(process)}else throw Error(`Script must be executed as a worker`);function u(e){return e&&e.toJSON?JSON.parse(JSON.stringify(e)):JSON.parse(JSON.stringify(e,Object.getOwnPropertyNames(e)))}function d(e){return e&&typeof e.then==`function`&&typeof e.catch==`function`}o.methods={},o.methods.run=function(e,t){var n=Function(`return (`+e+`).apply(this, arguments);`);return n.worker=s,n.apply(n,t)},o.methods.methods=function(){return Object.keys(o.methods)},o.terminationHandler=void 0,o.abortListenerTimeout=a,o.abortListeners=[],o.terminateAndExit=function(e){var t=function(){o.exit(e)};if(!o.terminationHandler)return t();var r=o.terminationHandler(e);return d(r)?(r.then(t,t),r):(t(),new n(function(e,t){t(Error(`Worker terminating`))}))},o.cleanup=function(e){if(!o.abortListeners.length)return o.send({id:e,method:i,error:u(Error(`Worker terminating`))}),new n(function(e){e()});var t=function(){o.exit()},r=function(){o.abortListeners.length&&(o.abortListeners=[])};let a=o.abortListeners.map(e=>e()),s,c=new n((e,t)=>{s=setTimeout(function(){t(Error(`Timeout occurred waiting for abort handler, killing worker`))},o.abortListenerTimeout)}),l=n.all(a).then(function(){clearTimeout(s),r()},function(){clearTimeout(s),t()});return new n(function(e,t){l.then(e,t),c.then(e,t)}).then(function(){o.send({id:e,method:i,error:null})},function(t){o.send({id:e,method:i,error:t?u(t):null})})};var f=null;o.on(`message`,function(e){if(e===r)return o.terminateAndExit(0);if(e.method===i)return o.cleanup(e.id);try{var n=o.methods[e.method];if(n){f=e.id;var a=n.apply(n,e.params);d(a)?a.then(function(n){n instanceof t?o.send({id:e.id,result:n.message,error:null},n.transfer):o.send({id:e.id,result:n,error:null}),f=null}).catch(function(t){o.send({id:e.id,result:null,error:u(t)}),f=null}):(a instanceof t?o.send({id:e.id,result:a.message,error:null},a.transfer):o.send({id:e.id,result:a,error:null}),f=null)}else throw Error(`Unknown method "`+e.method+`"`)}catch(t){o.send({id:e.id,result:null,error:u(t)})}}),o.register=function(e,t){if(e)for(var n in e)e.hasOwnProperty(n)&&(o.methods[n]=e[n],o.methods[n].worker=s);t&&(o.terminationHandler=t.onTerminate,o.abortListenerTimeout=t.abortListenerTimeout||a),o.send(`ready`)},o.emit=function(e){if(f){if(e instanceof t){o.send({id:f,isEvent:!0,payload:e.message},e.transfer);return}o.send({id:f,isEvent:!0,payload:e})}},e!==void 0&&(e.add=o.register,e.emit=o.emit)})),T=d(l((e=>{var{platform:t,isMainThread:n,cpus:r}=h(),{TerminateError:i}=y();function a(e,t){return new(S())(e,t)}e.pool=a;function o(e,t){w().add(e,t)}e.worker=o;var{Promise:s}=g();e.Transfer=C()}))(),1),E=5e3,ee=3e4,D=e=>T.pool(e,{maxWorkers:1,minWorkers:0,workerTerminateTimeout:ee,workerOpts:{type:void 0}}),te=class{url;maxWorkerHeapBytes;slots;idleSweepTimer;terminated=!1;constructor(e,t,n){p(t>0,`maxWorkers must be a positive number.`),this.url=e,this.maxWorkerHeapBytes=n?.maxWorkerHeapBytes??268435456,this.slots=Array.from({length:t},()=>({pool:D(e),tasksSinceSpawn:0,inflight:0,draining:!1,probing:!1,lastHeapBytes:void 0}))}exec(e,t,n){let r=this.pickSlot();r.inflight++;try{return r.pool.exec(e,t,n).then(e=>(this.onSettled(r),e)).catch(e=>{throw this.onSettled(r),e})}catch(e){throw this.onSettled(r),e}}warmUp(){let[e,...t]=this.slots;return this.warmSlot(e).then(()=>{for(let e of t)this.warmSlot(e).catch(()=>void 0)},e=>{if(t.length===0)throw e;return Promise.any(t.map(e=>this.warmSlot(e))).then(()=>void 0)})}canAcceptTasks(){return this.slots.some(e=>!e.draining)}stats(){let e={totalWorkers:0,busyWorkers:0,idleWorkers:0,pendingTasks:0,activeTasks:0,tasksSinceSpawn:0};for(let t of this.slots){let n=t.pool.stats();e.totalWorkers+=n.totalWorkers,e.busyWorkers+=n.busyWorkers,e.idleWorkers+=n.idleWorkers,e.pendingTasks+=n.pendingTasks,e.activeTasks+=n.activeTasks,e.tasksSinceSpawn+=t.tasksSinceSpawn}return e}heapStats(){let e=this.slots.map(e=>e.lastHeapBytes);return{perSlot:e,totalBytes:e.reduce((e,t)=>e+(t??0),0),maxWorkerHeapBytes:this.maxWorkerHeapBytes}}probeHeap(){if(!this.terminated)for(let e of this.slots)e.draining||this.probeSlot(e)}terminate(){this.idleSweepTimer!==void 0&&(clearTimeout(this.idleSweepTimer),this.idleSweepTimer=void 0),this.terminated=!0;for(let e of this.slots)e.pool.terminate()}pickSlot(){let e=this.slots.filter(e=>!e.draining);return(e.length>0?e:this.slots).reduce((e,t)=>t.inflight<e.inflight?t:e)}onSettled(e){e.inflight--,!this.terminated&&(e.tasksSinceSpawn++,e.tasksSinceSpawn>=128&&(e.draining=!0),e.draining&&e.inflight===0?this.recycleSlot(e):e.draining||this.probeSlot(e),this.armIdleSweep())}recycleSlot(e){e.pool.terminate(),e.pool=D(this.url),e.tasksSinceSpawn=0,e.draining=!1,e.lastHeapBytes=void 0,this.warmSlot(e).catch(()=>void 0)}warmSlot(e){e.inflight++;let t=()=>{e.inflight--,!this.terminated&&e.draining&&e.inflight===0&&this.recycleSlot(e)};return new Promise((n,r)=>{try{e.pool.exec(`warmUp`).then(()=>{t(),n()}).catch(e=>{t(),r(e)})}catch(e){t(),r(e)}})}probeSlot(e){if(e.probing)return;e.probing=!0,e.inflight++;let t=t=>{e.probing=!1,e.inflight--,!this.terminated&&(t&&(e.draining=!0),e.draining&&e.inflight===0&&this.recycleSlot(e))};try{e.pool.exec(`getWasmMemoryUsage`).then(n=>{typeof n==`number`&&(e.lastHeapBytes=n),t(typeof n==`number`&&n>=this.maxWorkerHeapBytes)}).catch(()=>{t(!0)})}catch{t(!0)}}armIdleSweep(){this.idleSweepTimer!==void 0&&clearTimeout(this.idleSweepTimer),this.idleSweepTimer=setTimeout(()=>{this.idleSweepTimer=void 0;for(let e of this.slots)e.tasksSinceSpawn>0&&e.inflight===0&&this.recycleSlot(e)},E)}};function ne(e){return e!=null}var re=class{x;y;z;constructor(e){this.x=e.x,this.y=e.y,this.z=e.z}},ie=class{vertices;uvs;indices;heights;max_height;min_height;rtc_translation;normals;skirt_vertices;skirt_uvs;skirt_indices;skirt_normals;watermask;constructor(e){this.vertices=e.transferVertices(),this.uvs=e.transferUvs(),this.indices=e.transferIndices(),this.heights=e.transferHeights(),this.max_height=e.max_height,this.min_height=e.min_height,this.rtc_translation=e.rtc_translation?new re(e.rtc_translation):void 0,e.hasNormals()&&(this.normals=e.transferNormals()),e.hasSkirt()&&(this.skirt_vertices=e.transferSkirtVertices(),this.skirt_uvs=e.transferSkirtUvs(),this.skirt_indices=e.transferSkirtIndices(),this.skirt_normals=e.transferSkirtNormals()),e.hasWatermask()&&(this.watermask=e.transferWatermask())}transferVertices(){throw Error()}transferUvs(){throw Error()}transferIndices(){throw Error()}transferHeights(){throw Error()}transferNormals(){throw Error()}transferSkirtVertices(){throw Error()}transferSkirtUvs(){throw Error()}transferSkirtIndices(){throw Error()}transferSkirtNormals(){throw Error()}transferWatermask(){throw Error()}hasSkirt(){return this.skirt_vertices!==void 0&&this.skirt_uvs!==void 0&&this.skirt_indices!==void 0}hasNormals(){return this.normals!==void 0}hasWatermask(){return this.watermask!==void 0}},ae=class{east;north;south;west;constructor(e){this.east=e.east,this.north=e.north,this.south=e.south,this.west=e.west}},oe=class{extent;position_3d_high;position_3d_high_size;position_3d_low;position_3d_low_size;position;position_size;normal;normal_size;scale_normal_and_cap;scale_normal_and_cap_size;batch_id;batch_id_size;batch_index;batch_index_size;indices;rtc_translation;outline_position;outline_position_size;outline_scale_normal_and_cap;outline_scale_normal_and_cap_size;outline_skip_indices;outline_batch_index;outline_batch_index_size;constructor(e){let t=e.extent;this.extent=t?new ae(t):void 0,this.position_3d_high=e.position_3d_high()?.slice(),this.position_3d_high_size=e.position_3d_high_size(),this.position_3d_low=e.position_3d_low()?.slice(),this.position_3d_low_size=e.position_3d_low_size(),this.position=e.position()?.slice(),this.position_size=e.position_size(),this.normal=e.normal()?.slice(),this.normal_size=e.normal_size(),this.scale_normal_and_cap=e.scale_normal_and_cap()?.slice(),this.scale_normal_and_cap_size=e.scale_normal_and_cap_size(),this.batch_id=e.batch_id()?.slice(),this.batch_id_size=e.batch_id_size(),this.batch_index=e.batch_index()?.slice(),this.batch_index_size=e.batch_index_size(),this.indices=e.indices().slice(),this.rtc_translation=e.rtc_translation?new re(e.rtc_translation):void 0;let n=e.outline();n&&(this.outline_position=n.position()?.slice(),this.outline_position_size=n.position_size(),this.outline_scale_normal_and_cap=n.scale_normal_and_cap()?.slice(),this.outline_scale_normal_and_cap_size=n.scale_normal_and_cap_size(),this.outline_skip_indices=n.skip_indices()?.slice(),this.outline_batch_index=n.batch_index()?.slice(),this.outline_batch_index_size=n.batch_index_size(),n.free())}},se=class{extent;position;position_size;position_high;position_high_size;position_low;position_low_size;start;start_size;start_high;start_high_size;start_low;start_low_size;forward_offset;forward_offset_size;end_high;end_high_size;end_low;end_low_size;start_normals;start_normals_size;end_normal_and_texture_coordinate_normalization_x;end_normal_and_texture_coordinate_normalization_x_size;right_normal_and_texture_coordinate_normalization_y;right_normal_and_texture_coordinate_normalization_y_size;batch_id;batch_id_size;batch_index;batch_index_size;indices;constructor(e){let t=e.extent;this.extent=t?new ae(t):void 0,this.position=e.position().slice(),this.position_size=e.position_size(),this.position_high=e.position_high()?.slice(),this.position_high_size=e.position_high_size(),this.position_low=e.position_low()?.slice(),this.position_low_size=e.position_low_size(),this.start=e.start()?.slice(),this.start_size=e.start_size(),this.start_high=e.start_high()?.slice(),this.start_high_size=e.start_high_size(),this.start_low=e.start_low()?.slice(),this.start_low_size=e.start_low_size(),this.forward_offset=e.forward_offset()?.slice(),this.forward_offset_size=e.forward_offset_size(),this.end_high=e.end_high()?.slice(),this.end_high_size=e.end_high_size(),this.end_low=e.end_low()?.slice(),this.end_low_size=e.end_low_size(),this.start_normals=e.start_normals()?.slice(),this.start_normals_size=e.start_normals_size(),this.end_normal_and_texture_coordinate_normalization_x=e.end_normal_and_texture_coordinate_normalization_x()?.slice(),this.end_normal_and_texture_coordinate_normalization_x_size=e.end_normal_and_texture_coordinate_normalization_x_size(),this.right_normal_and_texture_coordinate_normalization_y=e.right_normal_and_texture_coordinate_normalization_y().slice(),this.right_normal_and_texture_coordinate_normalization_y_size=e.right_normal_and_texture_coordinate_normalization_y_size(),this.batch_id=e.batch_id()?.slice(),this.batch_id_size=e.batch_id_size(),this.batch_index=e.batch_index()?.slice(),this.batch_index_size=e.batch_index_size(),this.indices=e.indices().slice()}};function ce(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function le(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ue(e){let t,n,r;e.length===2?(t=e===ce||e===le?e:de,n=e,r=e):(t=ce,n=(t,n)=>ce(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<0?i=t+1:a=t}while(i<a)}return i}function a(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<=0?i=t+1:a=t}while(i<a)}return i}function o(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function de(){return 0}function fe(e){return e===null?NaN:+e}var pe=ue(ce);pe.right,pe.left,ue(fe).center;var me={value:()=>{}};function he(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new ge(n)}function ge(e){this._=e}function _e(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}ge.prototype=he.prototype={constructor:ge,on:function(e,t){var n=this._,r=_e(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=ve(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=ye(n[i],e.name,t);else if(t==null)for(i in n)n[i]=ye(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ge(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function ve(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function ye(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=me,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var be={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function xe(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),be.hasOwnProperty(t)?{space:be[t],local:e}:e}function Se(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function Ce(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function we(e){var t=xe(e);return(t.local?Ce:Se)(t)}function Te(){}function Ee(e){return e==null?Te:function(){return this.querySelector(e)}}function De(e){typeof e!=`function`&&(e=Ee(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new k(r,this._parents)}function Oe(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ke(){return[]}function Ae(e){return e==null?ke:function(){return this.querySelectorAll(e)}}function je(e){return function(){return Oe(e.apply(this,arguments))}}function Me(e){e=typeof e==`function`?je(e):Ae(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new k(r,i)}function Ne(e){return function(){return this.matches(e)}}function Pe(e){return function(t){return t.matches(e)}}var Fe=Array.prototype.find;function Ie(e){return function(){return Fe.call(this.children,e)}}function Le(){return this.firstElementChild}function Re(e){return this.select(e==null?Le:Ie(typeof e==`function`?e:Pe(e)))}var ze=Array.prototype.filter;function Be(){return Array.from(this.children)}function Ve(e){return function(){return ze.call(this.children,e)}}function He(e){return this.selectAll(e==null?Be:Ve(typeof e==`function`?e:Pe(e)))}function Ue(e){typeof e!=`function`&&(e=Ne(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new k(r,this._parents)}function We(e){return Array(e.length)}function Ge(){return new k(this._enter||this._groups.map(We),this._parents)}function Ke(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ke.prototype={constructor:Ke,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function qe(e){return function(){return e}}function Je(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new Ke(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function Ye(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new Ke(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function Xe(e){return e.__data__}function Ze(e,t){if(!arguments.length)return Array.from(this,Xe);var n=t?Ye:Je,r=this._parents,i=this._groups;typeof e!=`function`&&(e=qe(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=Qe(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new k(o,r),o._enter=s,o._exit=c,o}function Qe(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function $e(){return new k(this._exit||this._groups.map(We),this._parents)}function et(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function tt(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new k(s,this._parents)}function nt(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function rt(e){e||=it;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new k(i,this._parents).order()}function it(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function at(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ot(){return Array.from(this)}function st(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function ct(){let e=0;for(let t of this)++e;return e}function lt(){return!this.node()}function ut(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function dt(e){return function(){this.removeAttribute(e)}}function ft(e){return function(){this.removeAttributeNS(e.space,e.local)}}function pt(e,t){return function(){this.setAttribute(e,t)}}function mt(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ht(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function gt(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function _t(e,t){var n=xe(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?ft:dt:typeof t==`function`?n.local?gt:ht:n.local?mt:pt)(n,t))}function vt(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function yt(e){return function(){this.style.removeProperty(e)}}function bt(e,t,n){return function(){this.style.setProperty(e,t,n)}}function xt(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function St(e,t,n){return arguments.length>1?this.each((t==null?yt:typeof t==`function`?xt:bt)(e,t,n??``)):O(this.node(),e)}function O(e,t){return e.style.getPropertyValue(t)||vt(e).getComputedStyle(e,null).getPropertyValue(t)}function Ct(e){return function(){delete this[e]}}function wt(e,t){return function(){this[e]=t}}function Tt(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Et(e,t){return arguments.length>1?this.each((t==null?Ct:typeof t==`function`?Tt:wt)(e,t)):this.node()[e]}function Dt(e){return e.trim().split(/^|\s+/)}function Ot(e){return e.classList||new kt(e)}function kt(e){this._node=e,this._names=Dt(e.getAttribute(`class`)||``)}kt.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function At(e,t){for(var n=Ot(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function jt(e,t){for(var n=Ot(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Mt(e){return function(){At(this,e)}}function Nt(e){return function(){jt(this,e)}}function Pt(e,t){return function(){(t.apply(this,arguments)?At:jt)(this,e)}}function Ft(e,t){var n=Dt(e+``);if(arguments.length<2){for(var r=Ot(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?Pt:t?Mt:Nt)(n,t))}function It(){this.textContent=``}function Lt(e){return function(){this.textContent=e}}function Rt(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function zt(e){return arguments.length?this.each(e==null?It:(typeof e==`function`?Rt:Lt)(e)):this.node().textContent}function Bt(){this.innerHTML=``}function Vt(e){return function(){this.innerHTML=e}}function Ht(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function Ut(e){return arguments.length?this.each(e==null?Bt:(typeof e==`function`?Ht:Vt)(e)):this.node().innerHTML}function Wt(){this.nextSibling&&this.parentNode.appendChild(this)}function Gt(){return this.each(Wt)}function Kt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function qt(){return this.each(Kt)}function Jt(e){var t=typeof e==`function`?e:we(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Yt(){return null}function Xt(e,t){var n=typeof e==`function`?e:we(e),r=t==null?Yt:typeof t==`function`?t:Ee(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Zt(){var e=this.parentNode;e&&e.removeChild(this)}function Qt(){return this.each(Zt)}function $t(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function en(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function tn(e){return this.select(e?en:$t)}function nn(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function rn(e){return function(t){e.call(this,t,this.__data__)}}function an(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function on(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function sn(e,t,n){return function(){var r=this.__on,i,a=rn(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function cn(e,t,n){var r=an(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?sn:on,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function ln(e,t,n){var r=vt(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function un(e,t){return function(){return ln(this,e,t)}}function dn(e,t){return function(){return ln(this,e,t.apply(this,arguments))}}function fn(e,t){return this.each((typeof t==`function`?dn:un)(e,t))}function*pn(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var mn=[null];function k(e,t){this._groups=e,this._parents=t}function A(){return new k([[document.documentElement]],mn)}function hn(){return this}k.prototype=A.prototype={constructor:k,select:De,selectAll:Me,selectChild:Re,selectChildren:He,filter:Ue,data:Ze,enter:Ge,exit:$e,join:et,merge:tt,selection:hn,order:nt,sort:rt,call:at,nodes:ot,node:st,size:ct,empty:lt,each:ut,attr:_t,style:St,property:Et,classed:Ft,text:zt,html:Ut,raise:Gt,lower:qt,append:Jt,insert:Xt,remove:Qt,clone:tn,datum:nn,on:cn,dispatch:fn,[Symbol.iterator]:pn};function gn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function _n(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function j(){}var M=.7,vn=1/M,N=`\\s*([+-]?\\d+)\\s*`,P=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,F=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,yn=/^#([0-9a-f]{3,8})$/,bn=RegExp(`^rgb\\(${N},${N},${N}\\)$`),xn=RegExp(`^rgb\\(${F},${F},${F}\\)$`),Sn=RegExp(`^rgba\\(${N},${N},${N},${P}\\)$`),Cn=RegExp(`^rgba\\(${F},${F},${F},${P}\\)$`),wn=RegExp(`^hsl\\(${P},${F},${F}\\)$`),Tn=RegExp(`^hsla\\(${P},${F},${F},${P}\\)$`),En={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};gn(j,I,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Dn,formatHex:Dn,formatHex8:On,formatHsl:kn,formatRgb:An,toString:An});function Dn(){return this.rgb().formatHex()}function On(){return this.rgb().formatHex8()}function kn(){return Bn(this).formatHsl()}function An(){return this.rgb().formatRgb()}function I(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=yn.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?jn(t):n===3?new L(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Mn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Mn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=bn.exec(e))?new L(t[1],t[2],t[3],1):(t=xn.exec(e))?new L(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Sn.exec(e))?Mn(t[1],t[2],t[3],t[4]):(t=Cn.exec(e))?Mn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=wn.exec(e))?zn(t[1],t[2]/100,t[3]/100,1):(t=Tn.exec(e))?zn(t[1],t[2]/100,t[3]/100,t[4]):En.hasOwnProperty(e)?jn(En[e]):e===`transparent`?new L(NaN,NaN,NaN,0):null}function jn(e){return new L(e>>16&255,e>>8&255,e&255,1)}function Mn(e,t,n,r){return r<=0&&(e=t=n=NaN),new L(e,t,n,r)}function Nn(e){return e instanceof j||(e=I(e)),e?(e=e.rgb(),new L(e.r,e.g,e.b,e.opacity)):new L}function Pn(e,t,n,r){return arguments.length===1?Nn(e):new L(e,t,n,r??1)}function L(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}gn(L,Pn,_n(j,{brighter(e){return e=e==null?vn:vn**+e,new L(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?M:M**+e,new L(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new L(R(this.r),R(this.g),R(this.b),Rn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Fn,formatHex:Fn,formatHex8:In,formatRgb:Ln,toString:Ln}));function Fn(){return`#${z(this.r)}${z(this.g)}${z(this.b)}`}function In(){return`#${z(this.r)}${z(this.g)}${z(this.b)}${z((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ln(){let e=Rn(this.opacity);return`${e===1?`rgb(`:`rgba(`}${R(this.r)}, ${R(this.g)}, ${R(this.b)}${e===1?`)`:`, ${e})`}`}function Rn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function R(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function z(e){return e=R(e),(e<16?`0`:``)+e.toString(16)}function zn(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new B(e,t,n,r)}function Bn(e){if(e instanceof B)return new B(e.h,e.s,e.l,e.opacity);if(e instanceof j||(e=I(e)),!e)return new B;if(e instanceof B)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new B(o,s,c,e.opacity)}function Vn(e,t,n,r){return arguments.length===1?Bn(e):new B(e,t,n,r??1)}function B(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}gn(B,Vn,_n(j,{brighter(e){return e=e==null?vn:vn**+e,new B(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?M:M**+e,new B(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new L(Wn(e>=240?e-240:e+120,i,r),Wn(e,i,r),Wn(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new B(Hn(this.h),Un(this.s),Un(this.l),Rn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Rn(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Hn(this.h)}, ${Un(this.s)*100}%, ${Un(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Hn(e){return e=(e||0)%360,e<0?e+360:e}function Un(e){return Math.max(0,Math.min(1,e||0))}function Wn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Gn=e=>()=>e;function Kn(e,t){return function(n){return e+n*t}}function qn(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Jn(e){return(e=+e)==1?Yn:function(t,n){return n-t?qn(t,n,e):Gn(isNaN(t)?n:t)}}function Yn(e,t){var n=t-e;return n?Kn(e,n):Gn(isNaN(e)?t:e)}var Xn=(function e(t){var n=Jn(t);function r(e,t){var r=n((e=Pn(e)).r,(t=Pn(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Yn(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function V(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Zn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Qn=new RegExp(Zn.source,`g`);function $n(e){return function(){return e}}function er(e){return function(t){return e(t)+``}}function tr(e,t){var n=Zn.lastIndex=Qn.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Zn.exec(e))&&(i=Qn.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:V(r,i)})),n=Qn.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?er(c[0].x):$n(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}var nr=180/Math.PI,rr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ir(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*nr,skewX:Math.atan(c)*nr,scaleX:o,scaleY:s}}var ar;function or(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?rr:ir(t.a,t.b,t.c,t.d,t.e,t.f)}function sr(e){return e==null||(ar||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),ar.setAttribute(`transform`,e),!(e=ar.transform.baseVal.consolidate()))?rr:(e=e.matrix,ir(e.a,e.b,e.c,e.d,e.e,e.f))}function cr(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:V(e,i)},{i:c-2,x:V(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:V(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:V(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:V(e,n)},{i:s-2,x:V(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var lr=cr(or,`px, `,`px)`,`deg)`),ur=cr(sr,`, `,`)`,`)`),H=0,dr=0,fr=0,pr=1e3,mr,U,hr=0,W=0,gr=0,G=typeof performance==`object`&&performance.now?performance:Date,_r=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function vr(){return W||=(_r(yr),G.now()+gr)}function yr(){W=0}function br(){this._call=this._time=this._next=null}br.prototype=xr.prototype={constructor:br,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?vr():+n)+(t==null?0:+t),!this._next&&U!==this&&(U?U._next=this:mr=this,U=this),this._call=e,this._time=n,Er()},stop:function(){this._call&&(this._call=null,this._time=1/0,Er())}};function xr(e,t,n){var r=new br;return r.restart(e,t,n),r}function Sr(){vr(),++H;for(var e=mr,t;e;)(t=W-e._time)>=0&&e._call.call(void 0,t),e=e._next;--H}function Cr(){W=(hr=G.now())+gr,H=dr=0;try{Sr()}finally{H=0,Tr(),W=0}}function wr(){var e=G.now(),t=e-hr;t>pr&&(gr-=t,hr=e)}function Tr(){for(var e,t=mr,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:mr=n);U=e,Er(r)}function Er(e){H||(dr&&=clearTimeout(dr),e-W>24?(e<1/0&&(dr=setTimeout(Cr,e-G.now()-gr)),fr&&=clearInterval(fr)):(fr||=(hr=G.now(),setInterval(wr,pr)),H=1,_r(Cr)))}function Dr(e,t,n){var r=new br;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var Or=he(`start`,`end`,`cancel`,`interrupt`),kr=[];function Ar(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Mr(e,n,{name:t,index:r,group:i,on:Or,tween:kr,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function jr(e,t){var n=q(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function K(e,t){var n=q(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function q(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Mr(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=xr(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return Dr(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(Dr(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function Nr(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function Pr(e){return this.each(function(){Nr(this,e)})}function Fr(e,t){var n,r;return function(){var i=K(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Ir(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=K(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function Lr(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=q(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?Fr:Ir)(n,e,t))}function Rr(e,t,n){var r=e._id;return e.each(function(){var e=K(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return q(e,r).value[t]}}function zr(e,t){var n;return(typeof t==`number`?V:t instanceof I?Xn:(n=I(t))?(t=n,Xn):tr)(e,t)}function Br(e){return function(){this.removeAttribute(e)}}function Vr(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Hr(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function Ur(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Wr(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Gr(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Kr(e,t){var n=xe(e),r=n===`transform`?ur:zr;return this.attrTween(e,typeof t==`function`?(n.local?Gr:Wr)(n,r,Rr(this,`attr.`+e,t)):t==null?(n.local?Vr:Br)(n):(n.local?Ur:Hr)(n,r,t))}function qr(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Jr(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Yr(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Jr(e,i)),n}return i._value=t,i}function Xr(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&qr(e,i)),n}return i._value=t,i}function Zr(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=xe(e);return this.tween(n,(r.local?Yr:Xr)(r,t))}function Qr(e,t){return function(){jr(this,e).delay=+t.apply(this,arguments)}}function $r(e,t){return t=+t,function(){jr(this,e).delay=t}}function ei(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Qr:$r)(t,e)):q(this.node(),t).delay}function ti(e,t){return function(){K(this,e).duration=+t.apply(this,arguments)}}function ni(e,t){return t=+t,function(){K(this,e).duration=t}}function ri(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?ti:ni)(t,e)):q(this.node(),t).duration}function ii(e,t){if(typeof t!=`function`)throw Error();return function(){K(this,e).ease=t}}function ai(e){var t=this._id;return arguments.length?this.each(ii(t,e)):q(this.node(),t).ease}function oi(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();K(this,e).ease=n}}function si(e){if(typeof e!=`function`)throw Error();return this.each(oi(this._id,e))}function ci(e){typeof e!=`function`&&(e=Ne(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new J(r,this._parents,this._name,this._id)}function li(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new J(o,this._parents,this._name,this._id)}function ui(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function di(e,t,n){var r,i,a=ui(t)?jr:K;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function fi(e,t){var n=this._id;return arguments.length<2?q(this.node(),n).on.on(e):this.each(di(n,e,t))}function pi(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function mi(){return this.on(`end.remove`,pi(this._id))}function hi(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Ee(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,Ar(l[f],t,n,f,l,q(u,n)));return new J(a,this._parents,t,n)}function gi(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=Ae(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=q(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&Ar(p,t,n,h,f,m);a.push(f),o.push(u)}return new J(a,o,t,n)}var _i=A.prototype.constructor;function vi(){return new _i(this._groups,this._parents)}function yi(e,t){var n,r,i;return function(){var a=O(this,e),o=(this.style.removeProperty(e),O(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function bi(e){return function(){this.style.removeProperty(e)}}function xi(e,t,n){var r,i=n+``,a;return function(){var o=O(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function Si(e,t,n){var r,i,a;return function(){var o=O(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),O(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function Ci(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=K(this,e),l=c.on,u=c.value[a]==null?s||=bi(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function wi(e,t,n){var r=(e+=``)==`transform`?lr:zr;return t==null?this.styleTween(e,yi(e,r)).on(`end.style.`+e,bi(e)):typeof t==`function`?this.styleTween(e,Si(e,r,Rr(this,`style.`+e,t))).each(Ci(this._id,e)):this.styleTween(e,xi(e,r,t),n).on(`end.style.`+e,null)}function Ti(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Ei(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&Ti(e,a,n)),r}return a._value=t,a}function Di(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,Ei(e,t,n??``))}function Oi(e){return function(){this.textContent=e}}function ki(e){return function(){var t=e(this);this.textContent=t??``}}function Ai(e){return this.tween(`text`,typeof e==`function`?ki(Rr(this,`text`,e)):Oi(e==null?``:e+``))}function ji(e){return function(t){this.textContent=e.call(this,t)}}function Mi(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&ji(r)),t}return r._value=e,r}function Ni(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,Mi(e))}function Pi(){for(var e=this._name,t=this._id,n=Ri(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=q(c,t);Ar(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new J(r,this._parents,e,n)}function Fi(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=K(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var Ii=0;function J(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Li(e){return A().transition(e)}function Ri(){return++Ii}var Y=A.prototype;J.prototype=Li.prototype={constructor:J,select:hi,selectAll:gi,selectChild:Y.selectChild,selectChildren:Y.selectChildren,filter:ci,merge:li,selection:vi,transition:Pi,call:Y.call,nodes:Y.nodes,node:Y.node,size:Y.size,empty:Y.empty,each:Y.each,on:fi,attr:Kr,attrTween:Zr,style:wi,styleTween:Di,text:Ai,textTween:Ni,remove:mi,tween:Lr,delay:ei,duration:ri,ease:ai,easeVarying:si,end:Fi,[Symbol.iterator]:Y[Symbol.iterator]};function zi(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Bi={time:null,delay:0,duration:250,ease:zi};function Vi(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Hi(e){var t,n;e instanceof J?(t=e._id,e=e._name):(t=Ri(),(n=Bi).time=vr(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&Ar(c,e,t,l,o,n||Vi(c,t));return new J(r,this._parents,e,t)}A.prototype.interrupt=Pr,A.prototype.transition=Hi;var{abs:Ui,max:Wi,min:Gi}=Math;[`w`,`e`].map(Ki),[`n`,`s`].map(Ki),[`n`,`w`,`e`,`s`,`nw`,`ne`,`sw`,`se`].map(Ki);function Ki(e){return{type:e}}function qi(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function Ji(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Yi(e){return e=Ji(Math.abs(e)),e?e[1]:NaN}function Xi(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function Zi(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var Qi=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $i(e){if(!(t=Qi.exec(e)))throw Error(`invalid format: `+e);var t;return new ea({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}$i.prototype=ea.prototype;function ea(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}ea.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function ta(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var na;function ra(e,t){var n=Ji(e,t);if(!n)return na=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(na=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+Ji(e,Math.max(0,t+a-1))[0]}function ia(e,t){var n=Ji(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var aa={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:qi,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>ia(e*100,t),r:ia,s:ra,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function oa(e){return e}var sa=Array.prototype.map,ca=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function la(e){var t=e.grouping===void 0||e.thousands===void 0?oa:Xi(sa.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?oa:Zi(sa.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=$i(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):aa[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=aa[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=ta(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&na!==void 0?ca[8+na/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++o<l;)if(p=e.charCodeAt(o),48>p||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T<h?Array(h-T+1).join(u):``;switch(g&&m&&(e=t(E+e,E.length?h-r.length:1/0),E=``),d){case`<`:e=n+e+r+E;break;case`=`:e=n+E+e+r;break;case`^`:e=E.slice(0,T=E.length>>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(Yi(t)/3)))*3,r=10**-n,i=l((e=$i(e),e.type=`f`,e),{suffix:ca[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var ua;da({thousands:`,`,grouping:[3],currency:[`$`,``]});function da(e){return ua=la(e),ua.format,ua.formatPrefix,ua}function X(e,t,n){this.k=e,this.x=t,this.y=n}X.prototype={constructor:X,scale:function(e){return e===1?this:new X(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new X(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var fa=new X(1,0,0);pa.prototype=X.prototype;function pa(e){for(;!e.__zoom;)if(!(e=e.parentNode))return fa;return e.__zoom}function ma(e){let t=new oe(e);return{result:t,transfers:[t.batch_id?.buffer,t.batch_index?.buffer,t.normal?.buffer,t.position_3d_high?.buffer,t.position_3d_low?.buffer,t.position?.buffer,t.scale_normal_and_cap?.buffer,t.indices.buffer,t.outline_position?.buffer,t.outline_scale_normal_and_cap?.buffer,t.outline_skip_indices?.buffer,t.outline_batch_index?.buffer].filter(ne)}}function Z(e){return new n.TransferableTile(ha(e.coords),e.max_height,e.min_height,e.cached_mesh_handle?ga(e.cached_mesh_handle):void 0)}function ha(e){return new n.TileXYZ(e.x,e.y,e.z)}function ga(e){return new n.CachedMeshHandle(e.vertices,e.indices,e.uvs,e.heights)}function _a(e){return new n.UpsamplableTerrainGeometry(e.uvs,e.indices,e.heights,e.normals,e.watermask)}function va(e){return new n.ExtentRadianF32(e.west,e.south,e.east,e.north)}function ya(e){return new n.PolygonMaterial(e.show,e.castShadow,e.receiveShadow,e.color,e.clampToGround,e.tiled,e.height,e.extrudedHeight,e.wireframe,e.outline,e.perPositionHeight,e.__internal__)}function ba(e){let t=new n.TransferablePolygonBatchedFeature(e.crs,e.length);return t.setOuterRing(e.outer_ring.length,t=>{t.set(e.outer_ring)}),t.setOuterRingSizes(e.outer_ring_sizes.length,t=>{t.set(e.outer_ring_sizes)}),t.setHoles(e.holes.length,t=>{t.set(e.holes)}),t.setHolesSizes(e.holes_sizes.length,t=>{t.set(e.holes_sizes)}),t.setHolesTotalSizes(e.holes_total_sizes.length,t=>{t.set(e.holes_total_sizes)}),t.setHolesBoundaries(e.holes_boundaries.length,t=>{t.set(e.holes_boundaries)}),t.setExpectedWindingOrders(e.expected_winding_orders.length,t=>{t.set(e.expected_winding_orders)}),t.setBatchIds(e.batch_ids.length,t=>{t.set(e.batch_ids)}),t.setBatchIndices(e.batch_indices.length,t=>{t.set(e.batch_indices)}),t}var xa;async function Q(){return xa??=(0,n.default)(),xa}async function Sa(){if(!xa)return 0;let{memory:e}=await xa;return e.buffer.byteLength}async function Ca(e,t,r,i){await Q();let a=(0,n.constructPolygonBatchedFeature)(ba(e),ya(t),r,i?va(i):void 0);if(!a)return;let{result:o,transfers:s}=ma(a);return a.free(),$(o,s)}function wa(e){let t=new se(e);return{result:t,transfers:[t.position.buffer,t.position_high?.buffer,t.position_low?.buffer,t.start?.buffer,t.start_high?.buffer,t.start_low?.buffer,t.end_high?.buffer,t.end_low?.buffer,t.start_normals?.buffer,t.forward_offset?.buffer,t.end_normal_and_texture_coordinate_normalization_x?.buffer,t.right_normal_and_texture_coordinate_normalization_y.buffer,t.batch_id?.buffer,t.batch_index?.buffer,t.indices.buffer].filter(ne)}}function Ta(e){return new n.PolylineMaterial(e.show,e.castShadow,e.receiveShadow,e.color,e.clampToGround,e.tiled,e.height,e.width,e.maxWidth,e.__internal__)}function Ea(e){let t=new n.TransferablePolylineBatchedFeature(e.crs,e.length);return t.setPoints(e.points.length,t=>{t.set(e.points)}),t.setPointsSizes(e.points_sizes.length,t=>{t.set(e.points_sizes)}),t.setBatchIds(e.batch_ids.length,t=>{t.set(e.batch_ids)}),t.setBatchIndices(e.batch_indices.length,t=>{t.set(e.batch_indices)}),t}async function Da(e,t,r){await Q();let i=(0,n.constructPolylineBatchedFeature)(Ea(e),Ta(t),r);if(!i)return;let{result:a,transfers:o}=wa(i);return i.free(),$(a,o)}function Oa(e){let t=new ie(e),n=[t.vertices.buffer,t.uvs.buffer,t.indices.buffer,t.heights.buffer];return t.normals&&n.push(t.normals.buffer),t.skirt_vertices&&n.push(t.skirt_vertices.buffer),t.skirt_uvs&&n.push(t.skirt_uvs.buffer),t.skirt_indices&&n.push(t.skirt_indices.buffer),t.skirt_normals&&n.push(t.skirt_normals.buffer),t.watermask&&n.push(t.watermask.buffer),{result:t,transfers:n}}async function ka(e,t,r,i,a,o){await Q();let s=(0,n.constructQuantizedMeshTerrainMesh)(e,Z(t),r,i,a,o),{result:c,transfers:l}=Oa(s);return s.free(),$({result:c},[...l])}function Aa(e){return new n.TransferableRasterDEMData(new n.ElevationDecoder(e.decoder.r_scaler,e.decoder.g_scaler,e.decoder.b_scaler,e.decoder.offset,e.decoder.max_offset,e.decoder.min_offset,e.decoder.boundary,e.decoder.epsilon))}async function ja(e,t,r,i,a,o){await Q();let s=i+1,c=n.TransferableMartini.fromSize(s),l=(0,n.constructTerrainMesh)(e,Z(t),Aa(r),c,a,o),{result:u,transfers:d}=Oa(l);return l.free(),$({result:u},[...d])}async function Ma(e){let t=await createImageBitmap(e);try{let e=new OffscreenCanvas(t.width,t.height).getContext(`2d`);if(e===null)throw Error(`failed to get context of canvas`);e.drawImage(t,0,0);let n=e.getImageData(0,0,t.width,t.height).data;return $(n,[n.buffer])}finally{t.close()}}async function Na(e,t){try{let n=t.getContext(`2d`);if(n===null)throw Error(`failed to get context of canvas`);return n.drawImage(e,0,0),n.getImageData(0,0,e.width,e.height).data}finally{e.close()}}async function Pa(e,t,r,i,a,o,s){await Q();let c=(0,n.parseMvtTile)(e,t,r,i,a?va(a):void 0,o,s),l,u,d,f,p;try{l=c.f64_stream(),u=c.f32_stream(),d=c.u32_stream(),f=c.u8_stream(),p=c.meta()}finally{c.free()}return $({f64_stream:l,f32_stream:u,u32_stream:d,u8_stream:f,meta:p},[l.buffer,u.buffer,d.buffer,f.buffer])}async function Fa(e,t,r,i,a,o,s){await Q();let c=(0,n.upsampleQuantizedMeshTerrainMesh)(Z(e),Z(t),_a(r),i,a,o,s),{result:l,transfers:u}=Oa(c);return c.free(),$(l,u)}async function Ia(e,t,r,i,a,o,s){await Q();let c=(0,n.upsampleTerrainMesh)(Z(e),Z(t),Aa(r),_a(i),a,o,s),{result:l,transfers:u}=Oa(c);return c.free(),$(l,u)}async function La(){await Q()}var Ra={constructTerrainMesh:ja,constructQuantizedMeshTerrainMesh:ka,upsampleTerrainMesh:Ia,upsampleQuantizedMeshTerrainMesh:Fa,getImageDataFromImageBitmap:Na,getImageDataFromBlob:Ma,constructPolygonBatchedFeature:Ca,constructPolylineBatchedFeature:Da,parseMvtTile:Pa,warmUp:La,getWasmMemoryUsage:Sa},$=(e,t)=>new T.Transfer(e,t),za=!1,Ba=(...e)=>(za||=(T.worker(Ra),Va(),!0),T.worker(...e));function Va(){Ra.warmUp.worker?.addAbortListener(async()=>{})}var{initializeWorkerPool:Ha,terminateWorkerPool:Ua,warmUpWorkerPool:Wa,worker:Ga,workerPoolStats:Ka,workerPoolHeapStats:qa,probeWorkerPoolHeap:Ja}=(()=>{let e;return{initializeWorkerPool:(t,n,r)=>{if(e)throw Error(`Worker pool has already been initialized.`);e={pool:new te(t,n.total,r),manager:n}},terminateWorkerPool:()=>{e&&=(e.pool.terminate(),void 0)},warmUpWorkerPool:()=>(p(e,`initializeWorkerPool() must be invoked first.`),e.pool.warmUp()),worker:()=>(p(e,`initializeWorkerPool() must be invoked first.`),{pool:e.pool,manager:e.manager}),workerPoolStats:()=>e?.pool.stats(),workerPoolHeapStats:()=>e?.pool.heapStats(),probeWorkerPoolHeap:()=>e?.pool.probeHeap()}})(),Ya=()=>{let{pool:e,manager:t}=Ga();return t.canIncrement()&&e.canAcceptTasks()};function Xa(e,t,n){let{pool:r,manager:i}=Ga();i.increment();try{return r.exec(e,t,n).then(e=>(i.decrement(),e)).catch(e=>{throw i.decrement(),e})}catch(e){throw i.decrement(),e}}e.canWorkerProcessImmediately=Ya,e.createConcurrencyManager=e=>{let t=0,n=()=>t!==e,r=()=>t!==0;return{total:e,actives:()=>t,idles:()=>e-t,increment:()=>{n()&&t++},decrement:()=>{r()&&t--},canIncrement:n,canDecrement:r,reset:()=>{t=0}}},e.initializeWorkerPool=Ha,e.probeWorkerPoolHeap=Ja,e.queueTask=Xa,e.registerTasks=Ba,e.terminateWorkerPool=Ua,e.transfer=$,e.warmUpWorkerPool=Wa,e.workerPoolHeapStats=qa,e.workerPoolStats=Ka});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@navaramap/worker",
3
3
  "type": "module",
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
5
5
  "main": "dist/index.umd.cjs",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -19,9 +19,9 @@
19
19
  "access": "public"
20
20
  },
21
21
  "dependencies": {
22
- "workerpool": "10.0.1",
23
- "@navaramap/core": "0.0.1",
24
- "@navaramap/engine-worker": "0.0.1"
22
+ "workerpool": "10.0.3",
23
+ "@navaramap/core": "0.0.2",
24
+ "@navaramap/engine-worker": "0.0.2"
25
25
  },
26
26
  "scripts": {
27
27
  "type-check": "tsc && tsc -p tsconfig.node.json",
package/src/pool.test.ts CHANGED
@@ -64,24 +64,15 @@ it("should increment and decrement concurrency when the promise is resolved", as
64
64
  it("should increment and decrement concurrency when the promise is rejected", async () => {
65
65
  workPoolExecStates.states.reject = true;
66
66
 
67
- const promise = queueTask("test" as any);
68
- try {
69
- await promise;
70
- expect.fail("Expect that this case throws an error");
71
- } catch {
72
- expect(incrementFnMock).toHaveBeenCalledOnce();
73
- expect(manager.actives()).toBe(0);
74
- }
67
+ await expect(queueTask("test" as any)).rejects.toBeUndefined();
68
+ expect(incrementFnMock).toHaveBeenCalledOnce();
69
+ expect(manager.actives()).toBe(0);
75
70
  });
76
71
 
77
72
  it("should increment and decrement concurrency when the function throws an error before returning the promise", async () => {
78
73
  workPoolExecStates.states.rejectBeforePromise = true;
79
74
 
80
- try {
81
- queueTask("test" as any);
82
- expect.fail("Expect that this case throws an error");
83
- } catch {
84
- expect(incrementFnMock).toHaveBeenCalledOnce();
85
- expect(manager.actives()).toBe(0);
86
- }
75
+ expect(() => queueTask("test" as any)).toThrow();
76
+ expect(incrementFnMock).toHaveBeenCalledOnce();
77
+ expect(manager.actives()).toBe(0);
87
78
  });