@camptocamp/ogc-client
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -5,1 +5,4 @@ export { default as WfsEndpoint } from './wfs/endpoint'; | ||
export { sharedFetch } from './shared/http-utils'; | ||
export { enableFallbackWithoutWorker } from './worker/index'; | ||
import './worker-fallback'; |
import { sendTaskRequest } from './utils'; | ||
/** @type {boolean} */ | ||
let fallbackWithoutWorker = false; | ||
/** | ||
* Call once to disable Worker usage completely | ||
*/ | ||
export function enableFallbackWithoutWorker() { | ||
fallbackWithoutWorker = true; | ||
} | ||
/** @type {Worker} */ | ||
let workerInstance; | ||
/** | ||
* @returns {null|Worker} If null, use fallback without worker! | ||
*/ | ||
function getWorkerInstance() { | ||
if (fallbackWithoutWorker) { | ||
return null; | ||
} | ||
if (!workerInstance) { | ||
workerInstance = new Worker(URL.createObjectURL(new Blob(["function t(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function e(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function r(t){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=t.apply(r,n);function c(t){e(a,o,i,c,u,\"next\",t)}function u(t){e(a,o,i,c,u,\"throw\",t)}c(void 0)}))}}function n(t){return n=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},n(t)}var o={exports:{}};!function(t){var e=function(t){var e,r=Object.prototype,o=r.hasOwnProperty,i=\"function\"==typeof Symbol?Symbol:{},a=i.iterator||\"@@iterator\",c=i.asyncIterator||\"@@asyncIterator\",u=i.toStringTag||\"@@toStringTag\";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},\"\")}catch(t){s=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof d?e:d,i=Object.create(o.prototype),a=new C(n||[]);return i._invoke=function(t,e,r){var n=h;return function(o,i){if(n===v)throw new Error(\"Generator is already running\");if(n===m){if(\"throw\"===o)throw i;return G()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=k(a,r);if(c){if(c===y)continue;return c}}if(\"next\"===r.method)r.sent=r._sent=r.arg;else if(\"throw\"===r.method){if(n===h)throw n=m,r.arg;r.dispatchException(r.arg)}else\"return\"===r.method&&r.abrupt(\"return\",r.arg);n=v;var u=l(t,e,r);if(\"normal\"===u.type){if(n=r.done?m:p,u.arg===y)continue;return{value:u.arg,done:r.done}}\"throw\"===u.type&&(n=m,r.method=\"throw\",r.arg=u.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:\"normal\",arg:t.call(e,r)}}catch(t){return{type:\"throw\",arg:t}}}t.wrap=f;var h=\"suspendedStart\",p=\"suspendedYield\",v=\"executing\",m=\"completed\",y={};function d(){}function g(){}function b(){}var S={};S[a]=function(){return this};var E=Object.getPrototypeOf,O=E&&E(E(T([])));O&&O!==r&&o.call(O,a)&&(S=O);var w=b.prototype=d.prototype=Object.create(S);function P(t){[\"next\",\"throw\",\"return\"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(i,a,c,u){var s=l(t[i],t,a);if(\"throw\"!==s.type){var f=s.arg,h=f.value;return h&&\"object\"===n(h)&&o.call(h,\"__await\")?e.resolve(h.__await).then((function(t){r(\"next\",t,c,u)}),(function(t){r(\"throw\",t,c,u)})):e.resolve(h).then((function(t){f.value=t,c(f)}),(function(t){return r(\"throw\",t,c,u)}))}u(s.arg)}var i;this._invoke=function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}}function k(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,\"throw\"===r.method){if(t.iterator.return&&(r.method=\"return\",r.arg=e,k(t,r),\"throw\"===r.method))return y;r.method=\"throw\",r.arg=new TypeError(\"The iterator does not provide a 'throw' method\")}return y}var o=l(n,t.iterator,r.arg);if(\"throw\"===o.type)return r.method=\"throw\",r.arg=o.arg,r.delegate=null,y;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,\"return\"!==r.method&&(r.method=\"next\",r.arg=e),r.delegate=null,y):i:(r.method=\"throw\",r.arg=new TypeError(\"iterator result is not an object\"),r.delegate=null,y)}function R(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type=\"normal\",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:\"root\"}],t.forEach(R,this),this.reset(!0)}function T(t){if(t){var r=t[a];if(r)return r.call(t);if(\"function\"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n<t.length;)if(o.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}return{next:G}}function G(){return{value:e,done:!0}}return g.prototype=w.constructor=b,b.constructor=g,g.displayName=s(b,u,\"GeneratorFunction\"),t.isGeneratorFunction=function(t){var e=\"function\"==typeof t&&t.constructor;return!!e&&(e===g||\"GeneratorFunction\"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,s(t,u,\"GeneratorFunction\")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},P(x.prototype),x.prototype[c]=function(){return this},t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},P(w),s(w,u,\"Generator\"),w[a]=function(){return this},w.toString=function(){return\"[object Generator]\"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=T,C.prototype={constructor:C,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method=\"next\",this.arg=e,this.tryEntries.forEach(j),!t)for(var r in this)\"t\"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if(\"throw\"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type=\"throw\",c.arg=t,r.next=n,o&&(r.method=\"next\",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if(\"root\"===a.tryLoc)return n(\"end\");if(a.tryLoc<=this.prev){var u=o.call(a,\"catchLoc\"),s=o.call(a,\"finallyLoc\");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw new Error(\"try statement without catch or finally\");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,\"finallyLoc\")&&this.prev<n.finallyLoc){var i=n;break}}i&&(\"break\"===t||\"continue\"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method=\"next\",this.next=i.finallyLoc,y):this.complete(a)},complete:function(t,e){if(\"throw\"===t.type)throw t.arg;return\"break\"===t.type||\"continue\"===t.type?this.next=t.arg:\"return\"===t.type?(this.rval=this.arg=t.arg,this.method=\"return\",this.next=\"end\"):\"normal\"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if(\"throw\"===n.type){var o=n.arg;j(r)}return o}}throw new Error(\"illegal catch attempt\")},delegateYield:function(t,r,n){return this.delegate={iterator:T(t),resultName:r,nextLoc:n},\"next\"===this.method&&(this.arg=e),y}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function(\"r\",\"regeneratorRuntime = r\")(e)}}(o);var i=o.exports;function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?a(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function u(t,e,n){var o=function(){var o=r(i.mark((function r(o){var a,u,s;return i.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if((a=o.data).taskName!==t){r.next=12;break}return r.prev=2,r.next=5,n(a.params);case 5:u=r.sent,r.next=11;break;case 8:r.prev=8,r.t0=r.catch(2),s=r.t0;case 11:e.postMessage(c(c({taskName:t,requestId:a.requestId},u&&{response:u}),s&&{error:s}));case 12:case\"end\":return r.stop()}}),r,null,[[2,8]])})));return function(t){return o.apply(this,arguments)}}();e.addEventListener(\"message\",o)}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function f(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if(\"undefined\"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(t){if(\"string\"==typeof t)return s(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return\"Object\"===r&&t.constructor&&(r=t.constructor.name),\"Map\"===r||\"Set\"===r?Array.from(t):\"Arguments\"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(t)||function(){throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}()}function l(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}function h(t,e){return h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},h(t,e)}function p(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function\");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&h(t,e)}function v(t,e){return!e||\"object\"!==n(e)&&\"function\"!=typeof e?function(t){if(void 0===t)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return t}(t):e}function m(t){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},m(t)}function y(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function d(t,e,r){return d=y()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&h(o,r.prototype),o},d.apply(null,arguments)}function g(t){var e=\"function\"==typeof Map?new Map:void 0;return g=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf(\"[native code]\")))return t;var r;if(\"function\"!=typeof t)throw new TypeError(\"Super expression must either be null or a function\");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return d(t,arguments,m(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),h(n,t)},g(t)}function b(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function S(t,e,r){return e&&b(t.prototype,e),r&&b(t,r),t}var E=function(){function t(e){l(this,t),this.chars=f(e),this.charCount=this.chars.length,this.charIndex=0,this.charsToBytes=new Array(this.charCount),this.multiByteMode=!1,this.string=e;var r=this.chars,n=this.charCount,o=this.charsToBytes;if(n===e.length)for(var i=0;i<n;++i)o[i]=i;else{for(var a=0,c=0;c<n;++c)o[c]=a,a+=r[c].length;this.multiByteMode=!0}}return S(t,[{key:\"isEnd\",get:function(){return this.charIndex>=this.charCount}},{key:\"_charLength\",value:function(t){var e=t.length;return e<2||!this.multiByteMode?e:t.replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g,\"_\").length}},{key:\"advance\",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.charIndex=Math.min(this.charCount,this.charIndex+t)}},{key:\"consume\",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=this.peek(t);return this.advance(t),e}},{key:\"consumeMatch\",value:function(t){if(!t.sticky)throw new Error('`regex` must have a sticky flag (\"y\")');t.lastIndex=this.charsToBytes[this.charIndex];var e=t.exec(this.string);if(null===e)return\"\";var r=e[0];return this.advance(this._charLength(r)),r}},{key:\"consumeMatchFn\",value:function(t){for(var e=this.charIndex;!this.isEnd&&t(this.peek());)this.advance();return this.charIndex>e?this.string.slice(this.charsToBytes[e],this.charsToBytes[this.charIndex]):\"\"}},{key:\"consumeString\",value:function(t){if(this.consumeStringFast(t))return t;if(!this.multiByteMode)return\"\";var e=t.length,r=this._charLength(t);return r!==e&&t===this.peek(r)?(this.advance(r),t):\"\"}},{key:\"consumeStringFast\",value:function(t){if(this.peek()===t[0]){var e=t.length;if(1===e)return this.advance(),t;if(this.peek(e)===t)return this.advance(e),t}return\"\"}},{key:\"consumeUntilMatch\",value:function(t){if(!t.global)throw new Error('`regex` must have a global flag (\"g\")');var e=this.charsToBytes[this.charIndex];t.lastIndex=e;var r=t.exec(this.string);if(null===r||r.index===e)return\"\";var n=this.string.slice(e,r.index);return this.advance(this._charLength(n)),n}},{key:\"consumeUntilString\",value:function(t){var e=this.charIndex,r=this.charsToBytes,n=this.string,o=r[e],i=n.indexOf(t,o);if(i<=0)return\"\";var a=n.slice(o,i);return this.advance(this._charLength(a)),a}},{key:\"peek\",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;if(this.charIndex>=this.charCount)return\"\";if(1===t)return this.chars[this.charIndex];var e=this.charsToBytes,r=this.charIndex;return this.string.slice(e[r],e[r+t])}},{key:\"reset\",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.charIndex=t>=0?Math.min(this.charCount,t):Math.max(0,this.charIndex+t)}}]),t}(),O=E,w={},P=Object.freeze(Object.assign(Object.create(null),{amp:\"&\",apos:\"'\",gt:\">\",lt:\"<\",quot:'\"'}));function x(t){if(k(t))return!0;var e=j(t);return 45===e||46===e||e>=48&&e<=57||183===e||e>=768&&e<=879||e>=8255&&e<=8256}function k(t){var e=j(t);return 58===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function R(t){var e=j(t);return 9===e||10===e||13===e||e>=32&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}function j(t){return t.codePointAt(0)||-1}w.predefinedEntities=P,w.isNameChar=x,w.isNameStartChar=k,w.isNotXmlChar=function(t){return!R(t)},w.isReferenceChar=function(t){return\"#\"===t||x(t)},w.isWhitespace=function(t){var e=j(t);return 32===e||9===e||10===e||13===e},w.isXmlChar=R;var C=function(){function t(){l(this,t),this.parent=null}return S(t,[{key:\"document\",get:function(){return this.parent?this.parent.document:null}},{key:\"isRootNode\",get:function(){return!!this.parent&&this.parent===this.document}},{key:\"preserveWhitespace\",get:function(){return Boolean(this.parent&&this.parent.preserveWhitespace)}},{key:\"type\",get:function(){return\"\"}},{key:\"toJSON\",value:function(){var t={type:this.type};return this.isRootNode&&(t.isRootNode=!0),this.preserveWhitespace&&(t.preserveWhitespace=!0),t}}]),t}();C.TYPE_CDATA=\"cdata\",C.TYPE_COMMENT=\"comment\",C.TYPE_DOCUMENT=\"document\",C.TYPE_ELEMENT=\"element\",C.TYPE_PROCESSING_INSTRUCTION=\"pi\",C.TYPE_TEXT=\"text\";var T=C;function G(t){var e=function(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m(t);if(e){var o=m(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return v(this,r)}}var N=T,F=function(t){p(r,N);var e=G(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:\"\";return l(this,r),(t=e.call(this)).text=n,t}return S(r,[{key:\"type\",get:function(){return N.TYPE_TEXT}},{key:\"toJSON\",value:function(){return Object.assign(N.prototype.toJSON.call(this),{text:this.text})}}]),r}(),L=F;function A(t){var e=function(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m(t);if(e){var o=m(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return v(this,r)}}var I=T,M=L,B=function(t){p(r,M);var e=A(r);function r(){return l(this,r),e.apply(this,arguments)}return S(r,[{key:\"type\",get:function(){return I.TYPE_CDATA}}]),r}(),_=B;function U(t){var e=function(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m(t);if(e){var o=m(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return v(this,r)}}var D=T,W=function(t){p(r,D);var e=U(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:\"\";return l(this,r),(t=e.call(this)).content=n,t}return S(r,[{key:\"type\",get:function(){return D.TYPE_COMMENT}},{key:\"toJSON\",value:function(){return Object.assign(D.prototype.toJSON.call(this),{content:this.content})}}]),r}(),X=W;function Y(t){var e=function(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m(t);if(e){var o=m(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return v(this,r)}}var q=T,J=function(t){p(r,q);var e=Y(r);function r(t){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.create(null),i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return l(this,r),(n=e.call(this)).name=t,n.attributes=o,n.children=i,n}return S(r,[{key:\"isEmpty\",get:function(){return 0===this.children.length}},{key:\"preserveWhitespace\",get:function(){for(var t=this;t instanceof r;){if(\"xml:space\"in t.attributes)return\"preserve\"===t.attributes[\"xml:space\"];t=t.parent}return!1}},{key:\"text\",get:function(){return this.children.map((function(t){return\"text\"in t?t.text:\"\"})).join(\"\")}},{key:\"type\",get:function(){return q.TYPE_ELEMENT}},{key:\"toJSON\",value:function(){return Object.assign(q.prototype.toJSON.call(this),{name:this.name,attributes:this.attributes,children:this.children.map((function(t){return t.toJSON()}))})}}]),r}(),V=J;function $(t){var e=function(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m(t);if(e){var o=m(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return v(this,r)}}var K=V,z=T,H=function(t){p(r,z);var e=$(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return l(this,r),(t=e.call(this)).children=n,t}return S(r,[{key:\"document\",get:function(){return this}},{key:\"root\",get:function(){return this.children.find((function(t){return t instanceof K}))||null}},{key:\"text\",get:function(){return this.children.map((function(t){return\"text\"in t?t.text:\"\"})).join(\"\")}},{key:\"type\",get:function(){return z.TYPE_DOCUMENT}},{key:\"toJSON\",value:function(){return Object.assign(z.prototype.toJSON.call(this),{children:this.children.map((function(t){return t.toJSON()}))})}}]),r}(),Q=H;function Z(t){var e=function(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m(t);if(e){var o=m(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return v(this,r)}}var tt=T,et=function(t){p(r,tt);var e=Z(r);function r(t){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:\"\";return l(this,r),(n=e.call(this)).name=t,n.content=o,n}return S(r,[{key:\"type\",get:function(){return tt.TYPE_PROCESSING_INSTRUCTION}},{key:\"toJSON\",value:function(){return Object.assign(tt.prototype.toJSON.call(this),{name:this.name,content:this.content})}}]),r}(),rt=et;function nt(t,e){var r;if(\"undefined\"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if(\"string\"==typeof t)return ot(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);\"Object\"===r&&t.constructor&&(r=t.constructor.name);if(\"Map\"===r||\"Set\"===r)return Array.from(t);if(\"Arguments\"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ot(t,e)}(t))||e&&t&&\"number\"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}var i,a=!0,c=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function ot(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var it=O,at=w,ct=_,ut=X,st=Q,ft=V,lt=rt,ht=L,pt=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(l(this,t),this.document=new st,this.currentNode=this.document,this.options=r,this.scanner=new it(vt(e)),this.consumeProlog(),this.consumeElement()||this.error(\"Root element is missing or invalid\");this.consumeMisc(););this.scanner.isEnd||this.error(\"Extra content at the end of the document\")}return S(t,[{key:\"addNode\",value:function(t){t.parent=this.currentNode,this.currentNode.children.push(t)}},{key:\"addText\",value:function(t){var e=this.currentNode.children;if(e.length>0){var r=e[e.length-1];if(r instanceof ht)return void(r.text+=t)}this.addNode(new ht(t))}},{key:\"consumeAttributeValue\",value:function(){var t,e=this.scanner,r=e.peek();if('\"'!==r&&\"'\"!==r)return!1;e.advance();var n=!1,o=\"\",i='\"'===r?new RegExp('[^\"&<]+',\"y\"):new RegExp(\"[^'&<]+\",\"y\");t:for(;!e.isEnd;){switch((t=e.consumeMatch(i))&&(this.validateChars(t),o+=t.replace(/[\\t\\r\\n]/g,\" \")),e.peek()){case r:n=!0;break t;case\"&\":o+=this.consumeReference();continue;case\"<\":this.error(\"Unescaped `<` is not allowed in an attribute value\");break;case\"\":this.error(\"Unclosed attribute\")}}return n||this.error(\"Unclosed attribute\"),e.advance(),o}},{key:\"consumeCdataSection\",value:function(){var t=this.scanner;if(!t.consumeStringFast(\"<![CDATA[\"))return!1;var e=t.consumeUntilString(\"]]>\");return this.validateChars(e),t.consumeStringFast(\"]]>\")||this.error(\"Unclosed CDATA section\"),this.options.preserveCdata?this.addNode(new ct(e)):this.addText(e),!0}},{key:\"consumeCharData\",value:function(){var t=this.scanner,e=t.consumeUntilMatch(/<|&|]]>/g);return!!e&&(this.validateChars(e),\"]\"===t.peek()&&\"]]>\"===t.peek(3)&&this.error(\"Element content may not contain the CDATA section close delimiter `]]>`\"),this.addText(e),!0)}},{key:\"consumeComment\",value:function(){var t=this.scanner;if(!t.consumeStringFast(\"\\x3c!--\"))return!1;var e=t.consumeUntilString(\"--\");return this.validateChars(e),t.consumeStringFast(\"--\\x3e\")||(\"--\"===t.peek(2)?this.error(\"The string `--` isn't allowed inside a comment\"):this.error(\"Unclosed comment\")),this.options.preserveComments&&this.addNode(new ut(e.trim())),!0}},{key:\"consumeContentReference\",value:function(){var t=this.consumeReference();return!!t&&(this.addText(t),!0)}},{key:\"consumeDoctypeDeclaration\",value:function(){var t=this.scanner;return!(!t.consumeStringFast(\"<!DOCTYPE\")||!this.consumeWhitespace())&&(t.consumeMatch(new RegExp(\"[^[>]+\",\"y\")),t.consumeMatch(new RegExp(\"\\\\[[\\\\s\\\\S]+?\\\\][\\\\x20\\\\t\\\\r\\\\n]*>\",\"y\"))||t.consumeStringFast(\">\")||this.error(\"Unclosed doctype declaration\"),!0)}},{key:\"consumeElement\",value:function(){var t=this.scanner,e=t.charIndex;if(\"<\"!==t.peek())return!1;t.advance();var r=this.consumeName();if(!r)return t.reset(e),!1;for(var n=Object.create(null);this.consumeWhitespace();){var o=this.consumeName();if(o){var i=this.consumeEqual()&&this.consumeAttributeValue();!1===i&&this.error(\"Attribute value expected\"),o in n&&this.error(\"Duplicate attribute: \".concat(o)),\"xml:space\"===o&&\"default\"!==i&&\"preserve\"!==i&&this.error('Value of the `xml:space` attribute must be \"default\" or \"preserve\"'),n[o]=i}}if(this.options.sortAttributes){for(var a=Object.keys(n).sort(),c=Object.create(null),u=0;u<a.length;++u){var s=a[u];c[s]=n[s]}n=c}var f=Boolean(t.consumeStringFast(\"/>\")),l=new ft(r,n);if(l.parent=this.currentNode,!f){for(t.consumeStringFast(\">\")||this.error(\"Unclosed start tag for element `\".concat(r,\"`\")),this.currentNode=l,this.consumeCharData();this.consumeElement()||this.consumeContentReference()||this.consumeCdataSection()||this.consumeProcessingInstruction()||this.consumeComment();)this.consumeCharData();var h,p=t.charIndex;t.consumeStringFast(\"</\")&&(h=this.consumeName())&&h===r||(t.reset(p),this.error(\"Missing end tag for element \".concat(r))),this.consumeWhitespace(),t.consumeStringFast(\">\")||this.error(\"Unclosed end tag for element \".concat(r)),this.currentNode=l.parent}return this.addNode(l),!0}},{key:\"consumeEqual\",value:function(){return this.consumeWhitespace(),!!this.scanner.consumeStringFast(\"=\")&&(this.consumeWhitespace(),!0)}},{key:\"consumeMisc\",value:function(){return this.consumeComment()||this.consumeProcessingInstruction()||this.consumeWhitespace()}},{key:\"consumeName\",value:function(){return at.isNameStartChar(this.scanner.peek())?this.scanner.consumeMatchFn(at.isNameChar):\"\"}},{key:\"consumeProcessingInstruction\",value:function(){var t=this.scanner,e=t.charIndex;if(!t.consumeStringFast(\"<?\"))return!1;var r=this.consumeName();if(r?\"xml\"===r.toLowerCase()&&(t.reset(e),this.error(\"XML declaration isn't allowed here\")):this.error(\"Invalid processing instruction\"),!this.consumeWhitespace()){if(t.consumeStringFast(\"?>\"))return this.addNode(new lt(r)),!0;this.error(\"Whitespace is required after a processing instruction name\")}var n=t.consumeUntilString(\"?>\");return this.validateChars(n),t.consumeStringFast(\"?>\")||this.error(\"Unterminated processing instruction\"),this.addNode(new lt(r,n)),!0}},{key:\"consumeProlog\",value:function(){var t=this.scanner,e=t.charIndex;for(this.consumeXmlDeclaration();this.consumeMisc(););if(this.consumeDoctypeDeclaration())for(;this.consumeMisc(););return e<t.charIndex}},{key:\"consumeReference\",value:function(){var t=this.scanner;if(\"&\"!==t.peek())return!1;t.advance();var e,r=t.consumeMatchFn(at.isReferenceChar);if(\";\"!==t.consume()&&this.error(\"Unterminated reference (a reference must end with `;`)\"),\"#\"===r[0]){var o=\"x\"===r[1]?parseInt(r.slice(2),16):parseInt(r.slice(1),10);isNaN(o)&&this.error(\"Invalid character reference\"),e=String.fromCodePoint(o),at.isXmlChar(e)||this.error(\"Character reference resolves to an invalid character\")}else if(void 0===(e=at.predefinedEntities[r])){var i=this.options,a=i.ignoreUndefinedEntities,c=i.resolveUndefinedEntity,u=\"&\".concat(r,\";\");if(c){var s=c(u);if(null!=s){var f=n(s);if(\"string\"!==f)throw new TypeError(\"`resolveUndefinedEntity()` must return a string, `null`, or `undefined`, but returned a value of type \".concat(f));return s}}if(a)return u;t.reset(-u.length),this.error(\"Named entity isn't defined: \".concat(u))}return e}},{key:\"consumeSystemLiteral\",value:function(){var t=this.scanner,e=t.consumeStringFast('\"')||t.consumeStringFast(\"'\");if(!e)return!1;var r=t.consumeUntilString(e);return this.validateChars(r),t.consumeStringFast(e)||this.error(\"Missing end quote\"),r}},{key:\"consumeWhitespace\",value:function(){return Boolean(this.scanner.consumeMatchFn(at.isWhitespace))}},{key:\"consumeXmlDeclaration\",value:function(){var t=this.scanner;if(!t.consumeStringFast(\"<?xml\"))return!1;this.consumeWhitespace()||this.error(\"Invalid XML declaration\");var e=Boolean(t.consumeStringFast(\"version\"))&&this.consumeEqual()&&this.consumeSystemLiteral();if(!1===e?this.error(\"XML version is missing or invalid\"):/^1\\.[0-9]+$/.test(e)||this.error(\"Invalid character in version number\"),this.consumeWhitespace()){Boolean(t.consumeStringFast(\"encoding\"))&&this.consumeEqual()&&this.consumeSystemLiteral()&&this.consumeWhitespace();var r=Boolean(t.consumeStringFast(\"standalone\"))&&this.consumeEqual()&&this.consumeSystemLiteral();r&&(\"yes\"!==r&&\"no\"!==r&&this.error('Only \"yes\" and \"no\" are permitted as values of `standalone`'),this.consumeWhitespace())}return t.consumeStringFast(\"?>\")||this.error(\"Invalid or unclosed XML declaration\"),!0}},{key:\"error\",value:function(t){for(var e=this.scanner,r=e.charIndex,n=e.string,o=1,i=\"\",a=1,c=0;c<r;++c){var u=n[c];\"\\n\"===u?(o=1,i=\"\",a+=1):(o+=1,i+=u)}var s=n.indexOf(\"\\n\",r),f=0;(i+=-1===s?n.slice(r):n.slice(r,s)).length>50&&(o<40?i=i.slice(0,50):(f=o-20,i=i.slice(f,o+30)));var l=new Error(\"\".concat(t,\" (line \").concat(a,\", column \").concat(o,\")\\n\")+\" \".concat(i,\"\\n\")+\" \".repeat(o-f+1)+\"^\\n\");throw Object.assign(l,{column:o,excerpt:i,line:a,pos:r}),l}},{key:\"validateChars\",value:function(t){var e,r=0,n=nt(t);try{for(n.s();!(e=n.n()).done;){var o=e.value;at.isNotXmlChar(o)&&(this.scanner.reset(-(f(t).length-r)),this.error(\"Invalid character\")),r+=1}}catch(t){n.e(t)}finally{n.f()}}}]),t}();function vt(t){return\"\\ufeff\"===t[0]&&(t=t.slice(1)),t.replace(/\\r\\n?/g,\"\\n\")}var mt=pt,yt=_,dt=X,gt=Q,bt=V,St=T,Et=rt,Ot=L;function wt(t,e){return new mt(t,e).document}wt.XmlCdata=yt,wt.XmlComment=dt,wt.XmlDocument=gt,wt.XmlElement=bt,wt.XmlNode=St,wt.XmlProcessingInstruction=Et,wt.XmlText=Ot;var Pt=wt;function xt(t){var e=function(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m(t);if(e){var o=m(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return v(this,r)}}var kt=function(t){p(r,g(Error));var e=xt(r);function r(t){return l(this,r),e.call(this,t)}return r}();function Rt(t){return t.children[0]}function jt(t){var e=t.indexOf(\":\");return e>-1?t.substr(e+1):t}function Ct(t){return t.name||\"\"}function Tt(t,e,r){var n=jt(e);return t&&Array.isArray(t.children)?t.children.reduce((function t(e,o){return jt(Ct(o))===n&&e.push(o),r&&Array.isArray(o.children)?[].concat(f(e),f(o.children.reduce(t,[]))):e}),[]):[]}function Gt(t,e,r){return Tt(t,e,r)[0]||null}function Nt(t){return t&&Array.isArray(t.children)?f(t.children.filter((function(t){return\"XmlElement\"===t.constructor.name}))):[]}function Ft(t){var e=t&&Array.isArray(t.children)?t.children.find((function(t){return\"text\"===t.type})):null;return e?e.text:\"\"}function Lt(t,e){return t&&t.attributes[e]||\"\"}var At=function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];l(this,t),this.message=e,this.httpStatus=r,this.isCrossOriginRelated=n};function It(t,e){var r;if(\"undefined\"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if(\"string\"==typeof t)return Mt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);\"Object\"===r&&t.constructor&&(r=t.constructor.name);if(\"Map\"===r||\"Set\"===r)return Array.from(t);if(\"Arguments\"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Mt(t,e)}(t))||e&&t&&\"number\"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}var i,a=!0,c=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function Mt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Bt=new Map;function _t(t){return function(t){if(Bt.has(t))return Bt.get(t);var e=fetch(t);return e.finally((function(){return Bt.delete(t)})),Bt.set(t,e),e}(t).catch((function(){return fetch(t,{method:\"HEAD\",mode:\"no-cors\"}).catch((function(t){throw new At(\"Fetching the document failed either due to network errors or unreachable host, error is: \".concat(t.message),0,!1)})).then((function(){throw new At(\"The document could not be fetched due to CORS limitations\",0,!0)}))})).then(function(){var t=r(i.mark((function t(e){var r;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.text();case 2:if(r=t.sent,e.ok){t.next=5;break}throw new At(\"Received an error with code \".concat(e.status,\": \").concat(r),e.status,!1);case 5:return t.abrupt(\"return\",r);case 6:case\"end\":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()).then((function(t){return function(t){var e=null;try{e=Pt(t)}catch(t){throw new kt(t.message)}return e}(t)}))}function Ut(t,e){var r=t.match(/(https?%3A%2F%2F[^/]+)$/);if(r){var n=r[1],o=Ut(decodeURIComponent(n),e);return t.replace(n,encodeURIComponent(o))}var i,a=new URL(t),c=Object.keys(e),u=c.map((function(t){return t.toLowerCase()})),s=[],f=It(a.searchParams.keys());try{for(f.s();!(i=f.n()).done;){var l=i.value;u.indexOf(l.toLowerCase())>-1&&s.push(l)}}catch(t){f.e(t)}finally{f.f()}return s.map((function(t){return a.searchParams.delete(t)})),c.forEach((function(t){return a.searchParams.set(t,!0===e[t]?\"\":e[t])})),a.toString()}var Dt=[\"EPSG:4046\",\"EPSG:4075\",\"EPSG:4120\",\"EPSG:4122\",\"EPSG:4124\",\"EPSG:4126\",\"EPSG:4149\",\"EPSG:4151\",\"EPSG:4153\",\"EPSG:4155\",\"EPSG:4157\",\"EPSG:4159\",\"EPSG:4161\",\"EPSG:4163\",\"EPSG:4165\",\"EPSG:4167\",\"EPSG:4169\",\"EPSG:4171\",\"EPSG:4173\",\"EPSG:4175\",\"EPSG:4178\",\"EPSG:4180\",\"EPSG:4182\",\"EPSG:4184\",\"EPSG:4188\",\"EPSG:4190\",\"EPSG:4191\",\"EPSG:4196\",\"EPSG:4198\",\"EPSG:4202\",\"EPSG:4210\",\"EPSG:4211\",\"EPSG:4214\",\"EPSG:4226\",\"EPSG:4229\",\"EPSG:4231\",\"EPSG:4233\",\"EPSG:4236\",\"EPSG:4238\",\"EPSG:4240\",\"EPSG:4242\",\"EPSG:4244\",\"EPSG:4246\",\"EPSG:4248\",\"EPSG:4250\",\"EPSG:4252\",\"EPSG:4255\",\"EPSG:4258\",\"EPSG:4261\",\"EPSG:4264\",\"EPSG:4267\",\"EPSG:4270\",\"EPSG:4273\",\"EPSG:4276\",\"EPSG:4279\",\"EPSG:4281\",\"EPSG:4284\",\"EPSG:4286\",\"EPSG:4288\",\"EPSG:4292\",\"EPSG:4295\",\"EPSG:4297\",\"EPSG:4299\",\"EPSG:4302\",\"EPSG:4324\",\"EPSG:4326\"];function Wt(t){return Dt.indexOf(Xt(t))>-1}function Xt(t){if(/^urn:(?:x-)?ogc:def:crs:epsg:/.test(t.toLowerCase())){var e=/([0-9]+)$/.exec(t)[1];return\"EPSG:\".concat(e)}return t}function Yt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function qt(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?Yt(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Jt(t){return Rt(t).attributes.version}function Vt(t){var e=Jt(t);return Tt(Gt(Rt(t),\"Capability\"),\"Layer\").map((function(t){return $t(t,e)}))}function $t(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=\"1.3.0\"===r?\"CRS\":\"SRS\",c=Tt(e,a).map(Ft),u=c.length>0?c:n,s=Tt(e,\"Style\").map(Kt),f=s.length>0?s:o;function l(t){return(Wt(Lt(t,a))&&\"1.3.0\"===r?[\"miny\",\"minx\",\"maxy\",\"maxx\"]:[\"minx\",\"miny\",\"maxx\",\"maxy\"]).map((function(e){return Lt(t,e)}))}var h=Gt(e,\"Attribution\"),p=null!==h?zt(h):i,v=Tt(e,\"Layer\").map((function(t){return $t(t,r,u,f,p)}));return qt({name:Ft(Gt(e,\"Name\")),title:Ft(Gt(e,\"Title\")),abstract:Ft(Gt(e,\"Abstract\")),availableCrs:u,styles:f,attribution:p,boundingBoxes:Tt(e,\"BoundingBox\").reduce((function(e,r){return qt(qt({},e),{},t({},Lt(r,a),l(r)))}),{})},v.length&&{children:v})}function Kt(t){var e=Lt(Gt(Gt(t,\"LegendURL\"),\"OnlineResource\"),\"xlink:href\");return qt({name:Ft(Gt(t,\"Name\")),title:Ft(Gt(t,\"Title\"))},e&&{legendUrl:e})}function zt(t){var e=Lt(Gt(Gt(t,\"LogoURL\"),\"OnlineResource\"),\"xlink:href\"),r=Lt(Gt(t,\"OnlineResource\"),\"xlink:href\"),n=Ft(Gt(t,\"Title\"));return qt(qt(qt({},n&&{title:n}),r&&{url:r}),e&&{logoUrl:e})}function Ht(t){return Rt(t).attributes.version}function Qt(t){var e;if(Ht(t).startsWith(\"1.0\")){var r=Gt(Gt(Gt(Rt(t),\"Capability\"),\"Request\"),\"GetFeature\");e=Nt(Gt(r,\"ResultFormat\")).map(Ct)}else{var n=Tt(Gt(Rt(t),\"OperationsMetadata\"),\"Operation\").find((function(t){return\"GetFeature\"===Lt(t,\"name\")})),o=Tt(n,\"Parameter\").find((function(t){return\"outputFormat\"===Lt(t,\"name\")}));e=Tt(o,\"Value\",!0).map(Ft)}return e}function Zt(t){var e=Ht(t),r=Qt(t);return Tt(Gt(Rt(t),\"FeatureTypeList\"),\"FeatureType\").map((function(t){return function(t,e,r){var n=e.startsWith(\"2.\")?\"CRS\":\"SRS\",o=e.startsWith(\"1.0\")?\"SRS\":\"Default\".concat(n);function i(){var e=Gt(t,\"LatLongBoundingBox\");return[\"minx\",\"miny\",\"maxx\",\"maxy\"].map((function(t){return Lt(e,t)})).map(parseFloat)}function a(){var e=Gt(t,\"WGS84BoundingBox\");return[\"LowerCorner\",\"UpperCorner\"].map((function(t){return Gt(e,t)})).map((function(t){return Ft(t).split(\" \")})).reduce((function(t,e){return[].concat(f(t),f(e))})).map(parseFloat)}var c=e.startsWith(\"1.0\")?[]:Tt(t,\"Other\".concat(n)).map(Ft).map(Xt),u=e.startsWith(\"1.0\")?[]:Tt(Gt(t,\"OutputFormats\"),\"Format\").map(Ft);return{name:Ft(Gt(t,\"Name\")),title:Ft(Gt(t,\"Title\")),abstract:Ft(Gt(t,\"Abstract\")),defaultCrs:Xt(Ft(Gt(t,o))),otherCrs:c,outputFormats:u.length>0?u:r,latLonBoundingBox:e.startsWith(\"1.0\")?i():a()}}(t,e,r)}))}function te(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ee(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?te(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function re(e,r,n){var o,i=Rt(e);if(n.startsWith(\"2.0\"))o=Tt(i,\"member\").map((function(t){return Nt(t)[0]}));else{var a=Gt(i,\"featureMembers\");o=a?Nt(a):Tt(i,\"featureMember\").map((function(t){return Nt(t)[0]}))}var c=\"1.0.0\"===n?\"fid\":\"gml:id\";function u(e){return Nt(e).filter((function(t){return jt(Ct(t))in r.properties})).reduce((function(e,n){var o=jt(Ct(n));return ee(ee({},e),{},t({},o,function(t,e){switch(r.properties[t]){case\"integer\":return parseInt(e);case\"float\":return parseFloat(e);case\"boolean\":return\"true\"===e;default:return e}}(o,Ft(n))))}),{})}return o.map((function(t){return{id:Lt(t,c),properties:u(t)}}))}function ne(e,r,n,o,i,a,c,u,s,f){var l=\"2.0.0\"===r?\"COUNT\":\"MAXFEATURES\",h=t({SERVICE:\"WFS\",REQUEST:\"GetFeature\",VERSION:r},\"2.0.0\"===r?\"TYPENAMES\":\"TYPENAME\",n);if(void 0!==o&&(h.OUTPUTFORMAT=o),void 0!==a&&(h.PROPERTYNAME=a.join(\",\")),c?(h.RESULTTYPE=\"hits\",h[l]=\"1\"):void 0!==i&&(h[l]=i.toString(10)),u&&(h.SRSNAME=u),s){var p=s.join(\",\");h.BBOX=f?\"\".concat(p,\",\").concat(f):p}return Ut(e,h)}u(\"parseWmsCapabilities\",self,(function(t){return _t(t.url).then((function(t){return{info:(e=t,r=Gt(Rt(e),\"Service\"),n=Tt(Gt(r,\"KeywordList\"),\"Keyword\").map(Ft).filter((function(t,e,r){return r.indexOf(t)===e})),{title:Ft(Gt(r,\"Title\")),name:Ft(Gt(r,\"Name\")),abstract:Ft(Gt(r,\"Abstract\")),fees:Ft(Gt(r,\"Fees\")),constraints:Ft(Gt(r,\"AccessConstraints\")),keywords:n}),layers:Vt(t),version:Jt(t)};var e,r,n}))})),u(\"parseWfsCapabilities\",self,(function(t){return _t(t.url).then((function(t){return{info:(e=t,n=Ht(e),o=n.startsWith(\"1.0\")?\"Service\":\"ServiceIdentification\",i=n.startsWith(\"1.0\")?\"Name\":\"ServiceType\",a=Gt(Rt(e),o),r=n.startsWith(\"1.0\")?Ft(Gt(a,\"Keywords\")).split(\",\").map((function(t){return t.trim()})):Tt(Gt(a,\"Keywords\"),\"Keyword\").map(Ft),{title:Ft(Gt(a,\"Title\")),name:Ft(Gt(a,i)),abstract:Ft(Gt(a,\"Abstract\")),fees:Ft(Gt(a,\"Fees\")),constraints:Ft(Gt(a,\"AccessConstraints\")),keywords:r,outputFormats:Qt(e)}),featureTypes:Zt(t),version:Ht(t)};var e,r,n,o,i,a}))})),u(\"queryWfsFeatureTypeDetails\",self,(function(t){var e=t.url,r=t.serviceVersion,n=t.featureTypeFull;return _t(ne(e,r,n.name,void 0,Object.keys(n.properties))).then((function(t){return{props:(e=re(t,n,r),e.reduce((function(t,e){var r=function(r){var n=e.properties[r];r in t||(t[r]={uniqueValues:[]});var o=t[r].uniqueValues.find((function(t){return t.value===n}));o?o.count++:t[r].uniqueValues.push({value:n,count:1})};for(var n in e.properties)r(n);return t}),{}))};var e}))}));\n"], {type: 'application/javascript'})), { | ||
workerInstance = new Worker(URL.createObjectURL(new Blob(["function t(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function e(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function r(t){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=t.apply(r,n);function c(t){e(a,o,i,c,u,\"next\",t)}function u(t){e(a,o,i,c,u,\"throw\",t)}c(void 0)}))}}function n(t){return n=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},n(t)}var o={exports:{}};!function(t){var e=function(t){var e,r=Object.prototype,o=r.hasOwnProperty,i=\"function\"==typeof Symbol?Symbol:{},a=i.iterator||\"@@iterator\",c=i.asyncIterator||\"@@asyncIterator\",u=i.toStringTag||\"@@toStringTag\";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},\"\")}catch(t){s=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof y?e:y,i=Object.create(o.prototype),a=new j(n||[]);return i._invoke=function(t,e,r){var n=h;return function(o,i){if(n===v)throw new Error(\"Generator is already running\");if(n===m){if(\"throw\"===o)throw i;return T()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=k(a,r);if(c){if(c===d)continue;return c}}if(\"next\"===r.method)r.sent=r._sent=r.arg;else if(\"throw\"===r.method){if(n===h)throw n=m,r.arg;r.dispatchException(r.arg)}else\"return\"===r.method&&r.abrupt(\"return\",r.arg);n=v;var u=l(t,e,r);if(\"normal\"===u.type){if(n=r.done?m:p,u.arg===d)continue;return{value:u.arg,done:r.done}}\"throw\"===u.type&&(n=m,r.method=\"throw\",r.arg=u.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:\"normal\",arg:t.call(e,r)}}catch(t){return{type:\"throw\",arg:t}}}t.wrap=f;var h=\"suspendedStart\",p=\"suspendedYield\",v=\"executing\",m=\"completed\",d={};function y(){}function g(){}function b(){}var S={};S[a]=function(){return this};var E=Object.getPrototypeOf,O=E&&E(E(G([])));O&&O!==r&&o.call(O,a)&&(S=O);var w=b.prototype=y.prototype=Object.create(S);function P(t){[\"next\",\"throw\",\"return\"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function r(i,a,c,u){var s=l(t[i],t,a);if(\"throw\"!==s.type){var f=s.arg,h=f.value;return h&&\"object\"===n(h)&&o.call(h,\"__await\")?e.resolve(h.__await).then((function(t){r(\"next\",t,c,u)}),(function(t){r(\"throw\",t,c,u)})):e.resolve(h).then((function(t){f.value=t,c(f)}),(function(t){return r(\"throw\",t,c,u)}))}u(s.arg)}var i;this._invoke=function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}}function k(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,\"throw\"===r.method){if(t.iterator.return&&(r.method=\"return\",r.arg=e,k(t,r),\"throw\"===r.method))return d;r.method=\"throw\",r.arg=new TypeError(\"The iterator does not provide a 'throw' method\")}return d}var o=l(n,t.iterator,r.arg);if(\"throw\"===o.type)return r.method=\"throw\",r.arg=o.arg,r.delegate=null,d;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,\"return\"!==r.method&&(r.method=\"next\",r.arg=e),r.delegate=null,d):i:(r.method=\"throw\",r.arg=new TypeError(\"iterator result is not an object\"),r.delegate=null,d)}function R(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type=\"normal\",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:\"root\"}],t.forEach(R,this),this.reset(!0)}function G(t){if(t){var r=t[a];if(r)return r.call(t);if(\"function\"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n<t.length;)if(o.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}return{next:T}}function T(){return{value:e,done:!0}}return g.prototype=w.constructor=b,b.constructor=g,g.displayName=s(b,u,\"GeneratorFunction\"),t.isGeneratorFunction=function(t){var e=\"function\"==typeof t&&t.constructor;return!!e&&(e===g||\"GeneratorFunction\"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,s(t,u,\"GeneratorFunction\")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},P(x.prototype),x.prototype[c]=function(){return this},t.AsyncIterator=x,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new x(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},P(w),s(w,u,\"Generator\"),w[a]=function(){return this},w.toString=function(){return\"[object Generator]\"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=G,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method=\"next\",this.arg=e,this.tryEntries.forEach(C),!t)for(var r in this)\"t\"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if(\"throw\"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type=\"throw\",c.arg=t,r.next=n,o&&(r.method=\"next\",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if(\"root\"===a.tryLoc)return n(\"end\");if(a.tryLoc<=this.prev){var u=o.call(a,\"catchLoc\"),s=o.call(a,\"finallyLoc\");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw new Error(\"try statement without catch or finally\");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,\"finallyLoc\")&&this.prev<n.finallyLoc){var i=n;break}}i&&(\"break\"===t||\"continue\"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method=\"next\",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,e){if(\"throw\"===t.type)throw t.arg;return\"break\"===t.type||\"continue\"===t.type?this.next=t.arg:\"return\"===t.type?(this.rval=this.arg=t.arg,this.method=\"return\",this.next=\"end\"):\"normal\"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if(\"throw\"===n.type){var o=n.arg;C(r)}return o}}throw new Error(\"illegal catch attempt\")},delegateYield:function(t,r,n){return this.delegate={iterator:G(t),resultName:r,nextLoc:n},\"next\"===this.method&&(this.arg=e),d}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function(\"r\",\"regeneratorRuntime = r\")(e)}}(o);var i=o.exports;function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?a(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function u(t,e,n){var o=\"undefined\"!=typeof WorkerGlobalScope,a=function(){var a=r(i.mark((function r(a){var u,s,f,l,h,p;return i.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(u=a.detail,s=a.data,(f=u||s).taskName!==t){r.next=14;break}return r.prev=3,r.next=6,n(f.params);case 6:l=r.sent,r.next=12;break;case 9:r.prev=9,r.t0=r.catch(3),h=r.t0;case 12:p=c(c({taskName:t,requestId:f.requestId},l&&{response:l}),h&&{error:h}),o?e.postMessage(p):e.dispatchEvent(new CustomEvent(\"ogc-client.response\",{detail:p}));case 14:case\"end\":return r.stop()}}),r,null,[[3,9]])})));return function(t){return a.apply(this,arguments)}}();o?e.addEventListener(\"message\",a):e.addEventListener(\"ogc-client.request\",a)}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function f(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if(\"undefined\"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(t){if(\"string\"==typeof t)return s(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return\"Object\"===r&&t.constructor&&(r=t.constructor.name),\"Map\"===r||\"Set\"===r?Array.from(t):\"Arguments\"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(t)||function(){throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}()}function l(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}function h(t,e){return h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},h(t,e)}function p(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function\");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&h(t,e)}function v(t,e){return!e||\"object\"!==n(e)&&\"function\"!=typeof e?function(t){if(void 0===t)throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");return t}(t):e}function m(t){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},m(t)}function d(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function y(t,e,r){return y=d()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&h(o,r.prototype),o},y.apply(null,arguments)}function g(t){var e=\"function\"==typeof Map?new Map:void 0;return g=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf(\"[native code]\")))return t;var r;if(\"function\"!=typeof t)throw new TypeError(\"Super expression must either be null or a function\");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return y(t,arguments,m(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),h(n,t)},g(t)}function b(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,\"value\"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function S(t,e,r){return e&&b(t.prototype,e),r&&b(t,r),t}var E=function(){function t(e){l(this,t),this.chars=f(e),this.charCount=this.chars.length,this.charIndex=0,this.charsToBytes=new Array(this.charCount),this.multiByteMode=!1,this.string=e;var r=this.chars,n=this.charCount,o=this.charsToBytes;if(n===e.length)for(var i=0;i<n;++i)o[i]=i;else{for(var a=0,c=0;c<n;++c)o[c]=a,a+=r[c].length;this.multiByteMode=!0}}return S(t,[{key:\"isEnd\",get:function(){return this.charIndex>=this.charCount}},{key:\"_charLength\",value:function(t){var e=t.length;return e<2||!this.multiByteMode?e:t.replace(/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g,\"_\").length}},{key:\"advance\",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.charIndex=Math.min(this.charCount,this.charIndex+t)}},{key:\"consume\",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=this.peek(t);return this.advance(t),e}},{key:\"consumeMatch\",value:function(t){if(!t.sticky)throw new Error('`regex` must have a sticky flag (\"y\")');t.lastIndex=this.charsToBytes[this.charIndex];var e=t.exec(this.string);if(null===e)return\"\";var r=e[0];return this.advance(this._charLength(r)),r}},{key:\"consumeMatchFn\",value:function(t){for(var e=this.charIndex;!this.isEnd&&t(this.peek());)this.advance();return this.charIndex>e?this.string.slice(this.charsToBytes[e],this.charsToBytes[this.charIndex]):\"\"}},{key:\"consumeString\",value:function(t){if(this.consumeStringFast(t))return t;if(!this.multiByteMode)return\"\";var e=t.length,r=this._charLength(t);return r!==e&&t===this.peek(r)?(this.advance(r),t):\"\"}},{key:\"consumeStringFast\",value:function(t){if(this.peek()===t[0]){var e=t.length;if(1===e)return this.advance(),t;if(this.peek(e)===t)return this.advance(e),t}return\"\"}},{key:\"consumeUntilMatch\",value:function(t){if(!t.global)throw new Error('`regex` must have a global flag (\"g\")');var e=this.charsToBytes[this.charIndex];t.lastIndex=e;var r=t.exec(this.string);if(null===r||r.index===e)return\"\";var n=this.string.slice(e,r.index);return this.advance(this._charLength(n)),n}},{key:\"consumeUntilString\",value:function(t){var e=this.charIndex,r=this.charsToBytes,n=this.string,o=r[e],i=n.indexOf(t,o);if(i<=0)return\"\";var a=n.slice(o,i);return this.advance(this._charLength(a)),a}},{key:\"peek\",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;if(this.charIndex>=this.charCount)return\"\";if(1===t)return this.chars[this.charIndex];var e=this.charsToBytes,r=this.charIndex;return this.string.slice(e[r],e[r+t])}},{key:\"reset\",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.charIndex=t>=0?Math.min(this.charCount,t):Math.max(0,this.charIndex+t)}}]),t}(),O=E,w={},P=Object.freeze(Object.assign(Object.create(null),{amp:\"&\",apos:\"'\",gt:\">\",lt:\"<\",quot:'\"'}));function x(t){if(k(t))return!0;var e=C(t);return 45===e||46===e||e>=48&&e<=57||183===e||e>=768&&e<=879||e>=8255&&e<=8256}function k(t){var e=C(t);return 58===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function R(t){var e=C(t);return 9===e||10===e||13===e||e>=32&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}function C(t){return t.codePointAt(0)||-1}w.predefinedEntities=P,w.isNameChar=x,w.isNameStartChar=k,w.isNotXmlChar=function(t){return!R(t)},w.isReferenceChar=function(t){return\"#\"===t||x(t)},w.isWhitespace=function(t){var e=C(t);return 32===e||9===e||10===e||13===e},w.isXmlChar=R;var j=function(){function t(){l(this,t),this.parent=null}return S(t,[{key:\"document\",get:function(){return this.parent?this.parent.document:null}},{key:\"isRootNode\",get:function(){return!!this.parent&&this.parent===this.document}},{key:\"preserveWhitespace\",get:function(){return Boolean(this.parent&&this.parent.preserveWhitespace)}},{key:\"type\",get:function(){return\"\"}},{key:\"toJSON\",value:function(){var t={type:this.type};return this.isRootNode&&(t.isRootNode=!0),this.preserveWhitespace&&(t.preserveWhitespace=!0),t}}]),t}();j.TYPE_CDATA=\"cdata\",j.TYPE_COMMENT=\"comment\",j.TYPE_DOCUMENT=\"document\",j.TYPE_ELEMENT=\"element\",j.TYPE_PROCESSING_INSTRUCTION=\"pi\",j.TYPE_TEXT=\"text\";var G=j;function T(t){var e=function(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m(t);if(e){var o=m(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return v(this,r)}}var N=G,F=function(t){p(r,N);var e=T(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:\"\";return l(this,r),(t=e.call(this)).text=n,t}return S(r,[{key:\"type\",get:function(){return N.TYPE_TEXT}},{key:\"toJSON\",value:function(){return Object.assign(N.prototype.toJSON.call(this),{text:this.text})}}]),r}(),L=F;function A(t){var e=function(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m(t);if(e){var o=m(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return v(this,r)}}var I=G,M=L,B=function(t){p(r,M);var e=A(r);function r(){return l(this,r),e.apply(this,arguments)}return S(r,[{key:\"type\",get:function(){return I.TYPE_CDATA}}]),r}(),_=B;function U(t){var e=function(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m(t);if(e){var o=m(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return v(this,r)}}var D=G,W=function(t){p(r,D);var e=U(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:\"\";return l(this,r),(t=e.call(this)).content=n,t}return S(r,[{key:\"type\",get:function(){return D.TYPE_COMMENT}},{key:\"toJSON\",value:function(){return Object.assign(D.prototype.toJSON.call(this),{content:this.content})}}]),r}(),X=W;function Y(t){var e=function(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m(t);if(e){var o=m(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return v(this,r)}}var q=G,J=function(t){p(r,q);var e=Y(r);function r(t){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.create(null),i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return l(this,r),(n=e.call(this)).name=t,n.attributes=o,n.children=i,n}return S(r,[{key:\"isEmpty\",get:function(){return 0===this.children.length}},{key:\"preserveWhitespace\",get:function(){for(var t=this;t instanceof r;){if(\"xml:space\"in t.attributes)return\"preserve\"===t.attributes[\"xml:space\"];t=t.parent}return!1}},{key:\"text\",get:function(){return this.children.map((function(t){return\"text\"in t?t.text:\"\"})).join(\"\")}},{key:\"type\",get:function(){return q.TYPE_ELEMENT}},{key:\"toJSON\",value:function(){return Object.assign(q.prototype.toJSON.call(this),{name:this.name,attributes:this.attributes,children:this.children.map((function(t){return t.toJSON()}))})}}]),r}(),V=J;function $(t){var e=function(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m(t);if(e){var o=m(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return v(this,r)}}var K=V,z=G,H=function(t){p(r,z);var e=$(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return l(this,r),(t=e.call(this)).children=n,t}return S(r,[{key:\"document\",get:function(){return this}},{key:\"root\",get:function(){return this.children.find((function(t){return t instanceof K}))||null}},{key:\"text\",get:function(){return this.children.map((function(t){return\"text\"in t?t.text:\"\"})).join(\"\")}},{key:\"type\",get:function(){return z.TYPE_DOCUMENT}},{key:\"toJSON\",value:function(){return Object.assign(z.prototype.toJSON.call(this),{children:this.children.map((function(t){return t.toJSON()}))})}}]),r}(),Q=H;function Z(t){var e=function(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m(t);if(e){var o=m(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return v(this,r)}}var tt=G,et=function(t){p(r,tt);var e=Z(r);function r(t){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:\"\";return l(this,r),(n=e.call(this)).name=t,n.content=o,n}return S(r,[{key:\"type\",get:function(){return tt.TYPE_PROCESSING_INSTRUCTION}},{key:\"toJSON\",value:function(){return Object.assign(tt.prototype.toJSON.call(this),{name:this.name,content:this.content})}}]),r}(),rt=et;function nt(t,e){var r;if(\"undefined\"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if(\"string\"==typeof t)return ot(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);\"Object\"===r&&t.constructor&&(r=t.constructor.name);if(\"Map\"===r||\"Set\"===r)return Array.from(t);if(\"Arguments\"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ot(t,e)}(t))||e&&t&&\"number\"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}var i,a=!0,c=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function ot(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var it=O,at=w,ct=_,ut=X,st=Q,ft=V,lt=rt,ht=L,pt=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(l(this,t),this.document=new st,this.currentNode=this.document,this.options=r,this.scanner=new it(vt(e)),this.consumeProlog(),this.consumeElement()||this.error(\"Root element is missing or invalid\");this.consumeMisc(););this.scanner.isEnd||this.error(\"Extra content at the end of the document\")}return S(t,[{key:\"addNode\",value:function(t){t.parent=this.currentNode,this.currentNode.children.push(t)}},{key:\"addText\",value:function(t){var e=this.currentNode.children;if(e.length>0){var r=e[e.length-1];if(r instanceof ht)return void(r.text+=t)}this.addNode(new ht(t))}},{key:\"consumeAttributeValue\",value:function(){var t,e=this.scanner,r=e.peek();if('\"'!==r&&\"'\"!==r)return!1;e.advance();var n=!1,o=\"\",i='\"'===r?new RegExp('[^\"&<]+',\"y\"):new RegExp(\"[^'&<]+\",\"y\");t:for(;!e.isEnd;){switch((t=e.consumeMatch(i))&&(this.validateChars(t),o+=t.replace(/[\\t\\r\\n]/g,\" \")),e.peek()){case r:n=!0;break t;case\"&\":o+=this.consumeReference();continue;case\"<\":this.error(\"Unescaped `<` is not allowed in an attribute value\");break;case\"\":this.error(\"Unclosed attribute\")}}return n||this.error(\"Unclosed attribute\"),e.advance(),o}},{key:\"consumeCdataSection\",value:function(){var t=this.scanner;if(!t.consumeStringFast(\"<![CDATA[\"))return!1;var e=t.consumeUntilString(\"]]>\");return this.validateChars(e),t.consumeStringFast(\"]]>\")||this.error(\"Unclosed CDATA section\"),this.options.preserveCdata?this.addNode(new ct(e)):this.addText(e),!0}},{key:\"consumeCharData\",value:function(){var t=this.scanner,e=t.consumeUntilMatch(/<|&|]]>/g);return!!e&&(this.validateChars(e),\"]\"===t.peek()&&\"]]>\"===t.peek(3)&&this.error(\"Element content may not contain the CDATA section close delimiter `]]>`\"),this.addText(e),!0)}},{key:\"consumeComment\",value:function(){var t=this.scanner;if(!t.consumeStringFast(\"\\x3c!--\"))return!1;var e=t.consumeUntilString(\"--\");return this.validateChars(e),t.consumeStringFast(\"--\\x3e\")||(\"--\"===t.peek(2)?this.error(\"The string `--` isn't allowed inside a comment\"):this.error(\"Unclosed comment\")),this.options.preserveComments&&this.addNode(new ut(e.trim())),!0}},{key:\"consumeContentReference\",value:function(){var t=this.consumeReference();return!!t&&(this.addText(t),!0)}},{key:\"consumeDoctypeDeclaration\",value:function(){var t=this.scanner;return!(!t.consumeStringFast(\"<!DOCTYPE\")||!this.consumeWhitespace())&&(t.consumeMatch(new RegExp(\"[^[>]+\",\"y\")),t.consumeMatch(new RegExp(\"\\\\[[\\\\s\\\\S]+?\\\\][\\\\x20\\\\t\\\\r\\\\n]*>\",\"y\"))||t.consumeStringFast(\">\")||this.error(\"Unclosed doctype declaration\"),!0)}},{key:\"consumeElement\",value:function(){var t=this.scanner,e=t.charIndex;if(\"<\"!==t.peek())return!1;t.advance();var r=this.consumeName();if(!r)return t.reset(e),!1;for(var n=Object.create(null);this.consumeWhitespace();){var o=this.consumeName();if(o){var i=this.consumeEqual()&&this.consumeAttributeValue();!1===i&&this.error(\"Attribute value expected\"),o in n&&this.error(\"Duplicate attribute: \".concat(o)),\"xml:space\"===o&&\"default\"!==i&&\"preserve\"!==i&&this.error('Value of the `xml:space` attribute must be \"default\" or \"preserve\"'),n[o]=i}}if(this.options.sortAttributes){for(var a=Object.keys(n).sort(),c=Object.create(null),u=0;u<a.length;++u){var s=a[u];c[s]=n[s]}n=c}var f=Boolean(t.consumeStringFast(\"/>\")),l=new ft(r,n);if(l.parent=this.currentNode,!f){for(t.consumeStringFast(\">\")||this.error(\"Unclosed start tag for element `\".concat(r,\"`\")),this.currentNode=l,this.consumeCharData();this.consumeElement()||this.consumeContentReference()||this.consumeCdataSection()||this.consumeProcessingInstruction()||this.consumeComment();)this.consumeCharData();var h,p=t.charIndex;t.consumeStringFast(\"</\")&&(h=this.consumeName())&&h===r||(t.reset(p),this.error(\"Missing end tag for element \".concat(r))),this.consumeWhitespace(),t.consumeStringFast(\">\")||this.error(\"Unclosed end tag for element \".concat(r)),this.currentNode=l.parent}return this.addNode(l),!0}},{key:\"consumeEqual\",value:function(){return this.consumeWhitespace(),!!this.scanner.consumeStringFast(\"=\")&&(this.consumeWhitespace(),!0)}},{key:\"consumeMisc\",value:function(){return this.consumeComment()||this.consumeProcessingInstruction()||this.consumeWhitespace()}},{key:\"consumeName\",value:function(){return at.isNameStartChar(this.scanner.peek())?this.scanner.consumeMatchFn(at.isNameChar):\"\"}},{key:\"consumeProcessingInstruction\",value:function(){var t=this.scanner,e=t.charIndex;if(!t.consumeStringFast(\"<?\"))return!1;var r=this.consumeName();if(r?\"xml\"===r.toLowerCase()&&(t.reset(e),this.error(\"XML declaration isn't allowed here\")):this.error(\"Invalid processing instruction\"),!this.consumeWhitespace()){if(t.consumeStringFast(\"?>\"))return this.addNode(new lt(r)),!0;this.error(\"Whitespace is required after a processing instruction name\")}var n=t.consumeUntilString(\"?>\");return this.validateChars(n),t.consumeStringFast(\"?>\")||this.error(\"Unterminated processing instruction\"),this.addNode(new lt(r,n)),!0}},{key:\"consumeProlog\",value:function(){var t=this.scanner,e=t.charIndex;for(this.consumeXmlDeclaration();this.consumeMisc(););if(this.consumeDoctypeDeclaration())for(;this.consumeMisc(););return e<t.charIndex}},{key:\"consumeReference\",value:function(){var t=this.scanner;if(\"&\"!==t.peek())return!1;t.advance();var e,r=t.consumeMatchFn(at.isReferenceChar);if(\";\"!==t.consume()&&this.error(\"Unterminated reference (a reference must end with `;`)\"),\"#\"===r[0]){var o=\"x\"===r[1]?parseInt(r.slice(2),16):parseInt(r.slice(1),10);isNaN(o)&&this.error(\"Invalid character reference\"),e=String.fromCodePoint(o),at.isXmlChar(e)||this.error(\"Character reference resolves to an invalid character\")}else if(void 0===(e=at.predefinedEntities[r])){var i=this.options,a=i.ignoreUndefinedEntities,c=i.resolveUndefinedEntity,u=\"&\".concat(r,\";\");if(c){var s=c(u);if(null!=s){var f=n(s);if(\"string\"!==f)throw new TypeError(\"`resolveUndefinedEntity()` must return a string, `null`, or `undefined`, but returned a value of type \".concat(f));return s}}if(a)return u;t.reset(-u.length),this.error(\"Named entity isn't defined: \".concat(u))}return e}},{key:\"consumeSystemLiteral\",value:function(){var t=this.scanner,e=t.consumeStringFast('\"')||t.consumeStringFast(\"'\");if(!e)return!1;var r=t.consumeUntilString(e);return this.validateChars(r),t.consumeStringFast(e)||this.error(\"Missing end quote\"),r}},{key:\"consumeWhitespace\",value:function(){return Boolean(this.scanner.consumeMatchFn(at.isWhitespace))}},{key:\"consumeXmlDeclaration\",value:function(){var t=this.scanner;if(!t.consumeStringFast(\"<?xml\"))return!1;this.consumeWhitespace()||this.error(\"Invalid XML declaration\");var e=Boolean(t.consumeStringFast(\"version\"))&&this.consumeEqual()&&this.consumeSystemLiteral();if(!1===e?this.error(\"XML version is missing or invalid\"):/^1\\.[0-9]+$/.test(e)||this.error(\"Invalid character in version number\"),this.consumeWhitespace()){Boolean(t.consumeStringFast(\"encoding\"))&&this.consumeEqual()&&this.consumeSystemLiteral()&&this.consumeWhitespace();var r=Boolean(t.consumeStringFast(\"standalone\"))&&this.consumeEqual()&&this.consumeSystemLiteral();r&&(\"yes\"!==r&&\"no\"!==r&&this.error('Only \"yes\" and \"no\" are permitted as values of `standalone`'),this.consumeWhitespace())}return t.consumeStringFast(\"?>\")||this.error(\"Invalid or unclosed XML declaration\"),!0}},{key:\"error\",value:function(t){for(var e=this.scanner,r=e.charIndex,n=e.string,o=1,i=\"\",a=1,c=0;c<r;++c){var u=n[c];\"\\n\"===u?(o=1,i=\"\",a+=1):(o+=1,i+=u)}var s=n.indexOf(\"\\n\",r),f=0;(i+=-1===s?n.slice(r):n.slice(r,s)).length>50&&(o<40?i=i.slice(0,50):(f=o-20,i=i.slice(f,o+30)));var l=new Error(\"\".concat(t,\" (line \").concat(a,\", column \").concat(o,\")\\n\")+\" \".concat(i,\"\\n\")+\" \".repeat(o-f+1)+\"^\\n\");throw Object.assign(l,{column:o,excerpt:i,line:a,pos:r}),l}},{key:\"validateChars\",value:function(t){var e,r=0,n=nt(t);try{for(n.s();!(e=n.n()).done;){var o=e.value;at.isNotXmlChar(o)&&(this.scanner.reset(-(f(t).length-r)),this.error(\"Invalid character\")),r+=1}}catch(t){n.e(t)}finally{n.f()}}}]),t}();function vt(t){return\"\\ufeff\"===t[0]&&(t=t.slice(1)),t.replace(/\\r\\n?/g,\"\\n\")}var mt=pt,dt=_,yt=X,gt=Q,bt=V,St=G,Et=rt,Ot=L;function wt(t,e){return new mt(t,e).document}wt.XmlCdata=dt,wt.XmlComment=yt,wt.XmlDocument=gt,wt.XmlElement=bt,wt.XmlNode=St,wt.XmlProcessingInstruction=Et,wt.XmlText=Ot;var Pt=wt;function xt(t){var e=function(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=m(t);if(e){var o=m(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return v(this,r)}}var kt=function(t){p(r,g(Error));var e=xt(r);function r(t){return l(this,r),e.call(this,t)}return r}();function Rt(t){return t.children[0]}function Ct(t){var e=t.indexOf(\":\");return e>-1?t.substr(e+1):t}function jt(t){return t.name||\"\"}function Gt(t,e,r){var n=Ct(e);return t&&Array.isArray(t.children)?t.children.reduce((function t(e,o){return Ct(jt(o))===n&&e.push(o),r&&Array.isArray(o.children)?[].concat(f(e),f(o.children.reduce(t,[]))):e}),[]):[]}function Tt(t,e,r){return Gt(t,e,r)[0]||null}function Nt(t){return t&&Array.isArray(t.children)?f(t.children.filter((function(t){return\"XmlElement\"===t.constructor.name}))):[]}function Ft(t){var e=t&&Array.isArray(t.children)?t.children.find((function(t){return\"text\"===t.type})):null;return e?e.text:\"\"}function Lt(t,e){return t&&t.attributes[e]||\"\"}var At=function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];l(this,t),this.message=e,this.httpStatus=r,this.isCrossOriginRelated=n};function It(t,e){var r;if(\"undefined\"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if(\"string\"==typeof t)return Mt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);\"Object\"===r&&t.constructor&&(r=t.constructor.name);if(\"Map\"===r||\"Set\"===r)return Array.from(t);if(\"Arguments\"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Mt(t,e)}(t))||e&&t&&\"number\"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}var i,a=!0,c=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function Mt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var Bt=new Map;function _t(t){return function(t){if(Bt.has(t))return Bt.get(t);var e=fetch(t);return e.finally((function(){return Bt.delete(t)})),Bt.set(t,e),e}(t).catch((function(){return fetch(t,{method:\"HEAD\",mode:\"no-cors\"}).catch((function(t){throw new At(\"Fetching the document failed either due to network errors or unreachable host, error is: \".concat(t.message),0,!1)})).then((function(){throw new At(\"The document could not be fetched due to CORS limitations\",0,!0)}))})).then(function(){var t=r(i.mark((function t(e){var r;return i.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.text();case 2:if(r=t.sent,e.ok){t.next=5;break}throw new At(\"Received an error with code \".concat(e.status,\": \").concat(r),e.status,!1);case 5:return t.abrupt(\"return\",r);case 6:case\"end\":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()).then((function(t){return function(t){var e=null;try{e=Pt(t)}catch(t){throw new kt(t.message)}return e}(t)}))}function Ut(t,e){var r=t.match(/(https?%3A%2F%2F[^/]+)$/);if(r){var n=r[1],o=Ut(decodeURIComponent(n),e);return t.replace(n,encodeURIComponent(o))}var i,a=new URL(t),c=Object.keys(e),u=c.map((function(t){return t.toLowerCase()})),s=[],f=It(a.searchParams.keys());try{for(f.s();!(i=f.n()).done;){var l=i.value;u.indexOf(l.toLowerCase())>-1&&s.push(l)}}catch(t){f.e(t)}finally{f.f()}return s.map((function(t){return a.searchParams.delete(t)})),c.forEach((function(t){return a.searchParams.set(t,!0===e[t]?\"\":e[t])})),a.toString()}var Dt=[\"EPSG:4046\",\"EPSG:4075\",\"EPSG:4120\",\"EPSG:4122\",\"EPSG:4124\",\"EPSG:4126\",\"EPSG:4149\",\"EPSG:4151\",\"EPSG:4153\",\"EPSG:4155\",\"EPSG:4157\",\"EPSG:4159\",\"EPSG:4161\",\"EPSG:4163\",\"EPSG:4165\",\"EPSG:4167\",\"EPSG:4169\",\"EPSG:4171\",\"EPSG:4173\",\"EPSG:4175\",\"EPSG:4178\",\"EPSG:4180\",\"EPSG:4182\",\"EPSG:4184\",\"EPSG:4188\",\"EPSG:4190\",\"EPSG:4191\",\"EPSG:4196\",\"EPSG:4198\",\"EPSG:4202\",\"EPSG:4210\",\"EPSG:4211\",\"EPSG:4214\",\"EPSG:4226\",\"EPSG:4229\",\"EPSG:4231\",\"EPSG:4233\",\"EPSG:4236\",\"EPSG:4238\",\"EPSG:4240\",\"EPSG:4242\",\"EPSG:4244\",\"EPSG:4246\",\"EPSG:4248\",\"EPSG:4250\",\"EPSG:4252\",\"EPSG:4255\",\"EPSG:4258\",\"EPSG:4261\",\"EPSG:4264\",\"EPSG:4267\",\"EPSG:4270\",\"EPSG:4273\",\"EPSG:4276\",\"EPSG:4279\",\"EPSG:4281\",\"EPSG:4284\",\"EPSG:4286\",\"EPSG:4288\",\"EPSG:4292\",\"EPSG:4295\",\"EPSG:4297\",\"EPSG:4299\",\"EPSG:4302\",\"EPSG:4324\",\"EPSG:4326\"];function Wt(t){return Dt.indexOf(Xt(t))>-1}function Xt(t){if(/^urn:(?:x-)?ogc:def:crs:epsg:/.test(t.toLowerCase())){var e=/([0-9]+)$/.exec(t)[1];return\"EPSG:\".concat(e)}return t}function Yt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function qt(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?Yt(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Jt(t){return Rt(t).attributes.version}function Vt(t){var e=Jt(t);return Gt(Tt(Rt(t),\"Capability\"),\"Layer\").map((function(t){return $t(t,e)}))}function $t(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,a=\"1.3.0\"===r?\"CRS\":\"SRS\",c=Gt(e,a).map(Ft),u=c.length>0?c:n,s=Gt(e,\"Style\").map(Kt),f=s.length>0?s:o;function l(t){return(Wt(Lt(t,a))&&\"1.3.0\"===r?[\"miny\",\"minx\",\"maxy\",\"maxx\"]:[\"minx\",\"miny\",\"maxx\",\"maxy\"]).map((function(e){return Lt(t,e)}))}var h=Tt(e,\"Attribution\"),p=null!==h?zt(h):i,v=Gt(e,\"Layer\").map((function(t){return $t(t,r,u,f,p)}));return qt({name:Ft(Tt(e,\"Name\")),title:Ft(Tt(e,\"Title\")),abstract:Ft(Tt(e,\"Abstract\")),availableCrs:u,styles:f,attribution:p,boundingBoxes:Gt(e,\"BoundingBox\").reduce((function(e,r){return qt(qt({},e),{},t({},Lt(r,a),l(r)))}),{})},v.length&&{children:v})}function Kt(t){var e=Lt(Tt(Tt(t,\"LegendURL\"),\"OnlineResource\"),\"xlink:href\");return qt({name:Ft(Tt(t,\"Name\")),title:Ft(Tt(t,\"Title\"))},e&&{legendUrl:e})}function zt(t){var e=Lt(Tt(Tt(t,\"LogoURL\"),\"OnlineResource\"),\"xlink:href\"),r=Lt(Tt(t,\"OnlineResource\"),\"xlink:href\"),n=Ft(Tt(t,\"Title\"));return qt(qt(qt({},n&&{title:n}),r&&{url:r}),e&&{logoUrl:e})}function Ht(t){return Rt(t).attributes.version}function Qt(t){var e;if(Ht(t).startsWith(\"1.0\")){var r=Tt(Tt(Tt(Rt(t),\"Capability\"),\"Request\"),\"GetFeature\");e=Nt(Tt(r,\"ResultFormat\")).map(jt)}else{var n=Gt(Tt(Rt(t),\"OperationsMetadata\"),\"Operation\").find((function(t){return\"GetFeature\"===Lt(t,\"name\")})),o=Gt(n,\"Parameter\").find((function(t){return\"outputFormat\"===Lt(t,\"name\")}));e=Gt(o,\"Value\",!0).map(Ft)}return e}function Zt(t){var e=Ht(t),r=Qt(t);return Gt(Tt(Rt(t),\"FeatureTypeList\"),\"FeatureType\").map((function(t){return function(t,e,r){var n=e.startsWith(\"2.\")?\"CRS\":\"SRS\",o=e.startsWith(\"1.0\")?\"SRS\":\"Default\".concat(n);function i(){var e=Tt(t,\"LatLongBoundingBox\");return[\"minx\",\"miny\",\"maxx\",\"maxy\"].map((function(t){return Lt(e,t)})).map(parseFloat)}function a(){var e=Tt(t,\"WGS84BoundingBox\");return[\"LowerCorner\",\"UpperCorner\"].map((function(t){return Tt(e,t)})).map((function(t){return Ft(t).split(\" \")})).reduce((function(t,e){return[].concat(f(t),f(e))})).map(parseFloat)}var c=e.startsWith(\"1.0\")?[]:Gt(t,\"Other\".concat(n)).map(Ft).map(Xt),u=e.startsWith(\"1.0\")?[]:Gt(Tt(t,\"OutputFormats\"),\"Format\").map(Ft);return{name:Ft(Tt(t,\"Name\")),title:Ft(Tt(t,\"Title\")),abstract:Ft(Tt(t,\"Abstract\")),defaultCrs:Xt(Ft(Tt(t,o))),otherCrs:c,outputFormats:u.length>0?u:r,latLonBoundingBox:e.startsWith(\"1.0\")?i():a()}}(t,e,r)}))}function te(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ee(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?te(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function re(e,r,n){var o,i=Rt(e);if(n.startsWith(\"2.0\"))o=Gt(i,\"member\").map((function(t){return Nt(t)[0]}));else{var a=Tt(i,\"featureMembers\");o=a?Nt(a):Gt(i,\"featureMember\").map((function(t){return Nt(t)[0]}))}var c=\"1.0.0\"===n?\"fid\":\"gml:id\";function u(e){return Nt(e).filter((function(t){return Ct(jt(t))in r.properties})).reduce((function(e,n){var o=Ct(jt(n));return ee(ee({},e),{},t({},o,function(t,e){switch(r.properties[t]){case\"integer\":return parseInt(e);case\"float\":return parseFloat(e);case\"boolean\":return\"true\"===e;default:return e}}(o,Ft(n))))}),{})}return o.map((function(t){return{id:Lt(t,c),properties:u(t)}}))}function ne(e,r,n,o,i,a,c,u,s,f){var l=\"2.0.0\"===r?\"COUNT\":\"MAXFEATURES\",h=t({SERVICE:\"WFS\",REQUEST:\"GetFeature\",VERSION:r},\"2.0.0\"===r?\"TYPENAMES\":\"TYPENAME\",n);if(void 0!==o&&(h.OUTPUTFORMAT=o),void 0!==a&&(h.PROPERTYNAME=a.join(\",\")),c?(h.RESULTTYPE=\"hits\",h[l]=\"1\"):void 0!==i&&(h[l]=i.toString(10)),u&&(h.SRSNAME=u),s){var p=s.join(\",\");h.BBOX=f?\"\".concat(p,\",\").concat(f):p}return Ut(e,h)}u(\"parseWmsCapabilities\",self,(function(t){return _t(t.url).then((function(t){return{info:(e=t,r=Tt(Rt(e),\"Service\"),n=Gt(Tt(r,\"KeywordList\"),\"Keyword\").map(Ft).filter((function(t,e,r){return r.indexOf(t)===e})),{title:Ft(Tt(r,\"Title\")),name:Ft(Tt(r,\"Name\")),abstract:Ft(Tt(r,\"Abstract\")),fees:Ft(Tt(r,\"Fees\")),constraints:Ft(Tt(r,\"AccessConstraints\")),keywords:n}),layers:Vt(t),version:Jt(t)};var e,r,n}))})),u(\"parseWfsCapabilities\",self,(function(t){return _t(t.url).then((function(t){return{info:(e=t,n=Ht(e),o=n.startsWith(\"1.0\")?\"Service\":\"ServiceIdentification\",i=n.startsWith(\"1.0\")?\"Name\":\"ServiceType\",a=Tt(Rt(e),o),r=n.startsWith(\"1.0\")?Ft(Tt(a,\"Keywords\")).split(\",\").map((function(t){return t.trim()})):Gt(Tt(a,\"Keywords\"),\"Keyword\").map(Ft),{title:Ft(Tt(a,\"Title\")),name:Ft(Tt(a,i)),abstract:Ft(Tt(a,\"Abstract\")),fees:Ft(Tt(a,\"Fees\")),constraints:Ft(Tt(a,\"AccessConstraints\")),keywords:r,outputFormats:Qt(e)}),featureTypes:Zt(t),version:Ht(t)};var e,r,n,o,i,a}))})),u(\"queryWfsFeatureTypeDetails\",self,(function(t){var e=t.url,r=t.serviceVersion,n=t.featureTypeFull;return _t(ne(e,r,n.name,void 0,Object.keys(n.properties))).then((function(t){return{props:(e=re(t,n,r),e.reduce((function(t,e){var r=function(r){var n=e.properties[r];r in t||(t[r]={uniqueValues:[]});var o=t[r].uniqueValues.find((function(t){return t.value===n}));o?o.count++:t[r].uniqueValues.push({value:n,count:1})};for(var n in e.properties)r(n);return t}),{}))};var e}))}));\n"], {type: 'application/javascript'})), { | ||
type: 'module', | ||
@@ -10,0 +26,0 @@ }); |
@@ -19,3 +19,3 @@ import { getUniqueId } from '../shared/id'; | ||
* @param {string} taskName | ||
* @param {Worker} workerInstance | ||
* @param {Worker|null} workerInstance | ||
* @param {Object} params | ||
@@ -27,21 +27,41 @@ * @return {Promise<Object>} | ||
const requestId = getUniqueId(); | ||
workerInstance.postMessage( | ||
/** @type {WorkerRequest} */ { | ||
requestId, | ||
taskName, | ||
params, | ||
} | ||
); | ||
/** @param {WorkerResponse} data */ | ||
const handler = ({ data }) => { | ||
if (data.requestId === requestId) { | ||
workerInstance.removeEventListener('message', handler); | ||
if ('error' in data) { | ||
reject(data.error); | ||
const request = /** @type {WorkerRequest} */ { | ||
requestId, | ||
taskName, | ||
params, | ||
}; | ||
if (workerInstance === null) { | ||
window.dispatchEvent( | ||
new CustomEvent('ogc-client.request', { | ||
detail: request, | ||
}) | ||
); | ||
} else { | ||
workerInstance.postMessage(request); | ||
} | ||
/** | ||
* Workers either with or without a worker | ||
* @param {WorkerResponse} [detail] | ||
* @param {WorkerResponse} [data] | ||
*/ | ||
const handler = ({ detail, data }) => { | ||
const response = detail || data; | ||
if (response.requestId === requestId) { | ||
if (workerInstance === null) { | ||
window.removeEventListener('message', handler); | ||
} else { | ||
resolve(data.response); | ||
workerInstance.removeEventListener('message', handler); | ||
} | ||
if ('error' in response) { | ||
reject(response.error); | ||
} else { | ||
resolve(response.response); | ||
} | ||
} | ||
}; | ||
workerInstance.addEventListener('message', handler); | ||
if (workerInstance === null) { | ||
window.addEventListener('ogc-client.response', handler); | ||
} else { | ||
workerInstance.addEventListener('message', handler); | ||
} | ||
}); | ||
@@ -52,28 +72,43 @@ } | ||
* @param {string} taskName | ||
* @param {DedicatedWorkerGlobalScope} scope | ||
* @param {DedicatedWorkerGlobalScope|Window} scope | ||
* @param {function(params: Object):Promise<Object>} handler | ||
*/ | ||
export function addTaskHandler(taskName, scope, handler) { | ||
const useWorker = typeof WorkerGlobalScope !== 'undefined'; | ||
/** | ||
* @param {WorkerRequest} data | ||
* Workers either with or without a worker | ||
* @param {WorkerRequest} [detail] | ||
* @param {WorkerRequest} [data] | ||
*/ | ||
const eventListener = async ({ data }) => { | ||
if (data.taskName === taskName) { | ||
const eventHandler = async ({ detail, data }) => { | ||
const request = detail || data; | ||
if (request.taskName === taskName) { | ||
let response, error; | ||
try { | ||
response = await handler(data.params); | ||
response = await handler(request.params); | ||
} catch (e) { | ||
error = e; | ||
} | ||
scope.postMessage( | ||
/** @type {WorkerResponse} */ { | ||
taskName, | ||
requestId: data.requestId, | ||
...(response && { response }), | ||
...(error && { error }), | ||
} | ||
); | ||
const message = /** @type {WorkerResponse} */ { | ||
taskName, | ||
requestId: request.requestId, | ||
...(response && { response }), | ||
...(error && { error }), | ||
}; | ||
if (useWorker) { | ||
scope.postMessage(message); | ||
} else { | ||
scope.dispatchEvent( | ||
new CustomEvent('ogc-client.response', { | ||
detail: message, | ||
}) | ||
); | ||
} | ||
} | ||
}; | ||
scope.addEventListener('message', eventListener); | ||
if (useWorker) { | ||
scope.addEventListener('message', eventHandler); | ||
} else { | ||
scope.addEventListener('ogc-client.request', eventHandler); | ||
} | ||
} |
@@ -13,3 +13,3 @@ import { addTaskHandler } from './utils'; | ||
'parseWmsCapabilities', | ||
/** @type {DedicatedWorkerGlobalScope} */ self, | ||
/** @type {DedicatedWorkerGlobalScope|Window} */ self, | ||
/** | ||
@@ -29,3 +29,3 @@ * @param {string} url | ||
'parseWfsCapabilities', | ||
/** @type {DedicatedWorkerGlobalScope} */ self, | ||
/** @type {DedicatedWorkerGlobalScope|Window} */ self, | ||
/** | ||
@@ -45,3 +45,3 @@ * @param {string} url | ||
'queryWfsFeatureTypeDetails', | ||
/** @type {DedicatedWorkerGlobalScope} */ self, | ||
/** @type {DedicatedWorkerGlobalScope|Window} */ self, | ||
/** | ||
@@ -48,0 +48,0 @@ * @param {string} url |
{ | ||
"name": "@camptocamp/ogc-client", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "A pure JS library for interacting with geospatial services.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/dist-node.js", |
@@ -36,2 +36,20 @@ # ogc-client | ||
To use, import API symbols like so: | ||
```js | ||
import { WmsEndpoint, WfsEndpoint } from '@camptocamp/ogc-client'; | ||
``` | ||
Note: if you want to disable web worker usage, for example to solve issues with the `Referer` header on outgoing | ||
requests, use: | ||
```js | ||
import { enableFallbackWithoutWorker } from '@camptocamp/ogc-client'; | ||
enableFallbackWithoutWorker() | ||
``` | ||
All processing will be done on the main thread after this call, including HTTP requests. | ||
### API | ||
@@ -38,0 +56,0 @@ |
@@ -5,1 +5,4 @@ export { default as WfsEndpoint } from './wfs/endpoint'; | ||
export { sharedFetch } from './shared/http-utils'; | ||
export { enableFallbackWithoutWorker } from './worker/index'; | ||
import './worker-fallback'; |
import { sendTaskRequest } from './utils'; | ||
/** @type {boolean} */ | ||
let fallbackWithoutWorker = false; | ||
/** | ||
* Call once to disable Worker usage completely | ||
*/ | ||
export function enableFallbackWithoutWorker() { | ||
fallbackWithoutWorker = true; | ||
} | ||
/** @type {Worker} */ | ||
let workerInstance; | ||
/** | ||
* @returns {null|Worker} If null, use fallback without worker! | ||
*/ | ||
function getWorkerInstance() { | ||
if (fallbackWithoutWorker) { | ||
return null; | ||
} | ||
if (!workerInstance) { | ||
@@ -8,0 +24,0 @@ workerInstance = new Worker('./worker.js', { |
@@ -19,3 +19,3 @@ import { getUniqueId } from '../shared/id'; | ||
* @param {string} taskName | ||
* @param {Worker} workerInstance | ||
* @param {Worker|null} workerInstance | ||
* @param {Object} params | ||
@@ -27,21 +27,41 @@ * @return {Promise<Object>} | ||
const requestId = getUniqueId(); | ||
workerInstance.postMessage( | ||
/** @type {WorkerRequest} */ { | ||
requestId, | ||
taskName, | ||
params, | ||
} | ||
); | ||
/** @param {WorkerResponse} data */ | ||
const handler = ({ data }) => { | ||
if (data.requestId === requestId) { | ||
workerInstance.removeEventListener('message', handler); | ||
if ('error' in data) { | ||
reject(data.error); | ||
const request = /** @type {WorkerRequest} */ { | ||
requestId, | ||
taskName, | ||
params, | ||
}; | ||
if (workerInstance === null) { | ||
window.dispatchEvent( | ||
new CustomEvent('ogc-client.request', { | ||
detail: request, | ||
}) | ||
); | ||
} else { | ||
workerInstance.postMessage(request); | ||
} | ||
/** | ||
* Workers either with or without a worker | ||
* @param {WorkerResponse} [detail] | ||
* @param {WorkerResponse} [data] | ||
*/ | ||
const handler = ({ detail, data }) => { | ||
const response = detail || data; | ||
if (response.requestId === requestId) { | ||
if (workerInstance === null) { | ||
window.removeEventListener('message', handler); | ||
} else { | ||
resolve(data.response); | ||
workerInstance.removeEventListener('message', handler); | ||
} | ||
if ('error' in response) { | ||
reject(response.error); | ||
} else { | ||
resolve(response.response); | ||
} | ||
} | ||
}; | ||
workerInstance.addEventListener('message', handler); | ||
if (workerInstance === null) { | ||
window.addEventListener('ogc-client.response', handler); | ||
} else { | ||
workerInstance.addEventListener('message', handler); | ||
} | ||
}); | ||
@@ -52,28 +72,43 @@ } | ||
* @param {string} taskName | ||
* @param {DedicatedWorkerGlobalScope} scope | ||
* @param {DedicatedWorkerGlobalScope|Window} scope | ||
* @param {function(params: Object):Promise<Object>} handler | ||
*/ | ||
export function addTaskHandler(taskName, scope, handler) { | ||
const useWorker = typeof WorkerGlobalScope !== 'undefined'; | ||
/** | ||
* @param {WorkerRequest} data | ||
* Workers either with or without a worker | ||
* @param {WorkerRequest} [detail] | ||
* @param {WorkerRequest} [data] | ||
*/ | ||
const eventListener = async ({ data }) => { | ||
if (data.taskName === taskName) { | ||
const eventHandler = async ({ detail, data }) => { | ||
const request = detail || data; | ||
if (request.taskName === taskName) { | ||
let response, error; | ||
try { | ||
response = await handler(data.params); | ||
response = await handler(request.params); | ||
} catch (e) { | ||
error = e; | ||
} | ||
scope.postMessage( | ||
/** @type {WorkerResponse} */ { | ||
taskName, | ||
requestId: data.requestId, | ||
...(response && { response }), | ||
...(error && { error }), | ||
} | ||
); | ||
const message = /** @type {WorkerResponse} */ { | ||
taskName, | ||
requestId: request.requestId, | ||
...(response && { response }), | ||
...(error && { error }), | ||
}; | ||
if (useWorker) { | ||
scope.postMessage(message); | ||
} else { | ||
scope.dispatchEvent( | ||
new CustomEvent('ogc-client.response', { | ||
detail: message, | ||
}) | ||
); | ||
} | ||
} | ||
}; | ||
scope.addEventListener('message', eventListener); | ||
if (useWorker) { | ||
scope.addEventListener('message', eventHandler); | ||
} else { | ||
scope.addEventListener('ogc-client.request', eventHandler); | ||
} | ||
} |
@@ -13,3 +13,3 @@ import { addTaskHandler } from './utils'; | ||
'parseWmsCapabilities', | ||
/** @type {DedicatedWorkerGlobalScope} */ self, | ||
/** @type {DedicatedWorkerGlobalScope|Window} */ self, | ||
/** | ||
@@ -29,3 +29,3 @@ * @param {string} url | ||
'parseWfsCapabilities', | ||
/** @type {DedicatedWorkerGlobalScope} */ self, | ||
/** @type {DedicatedWorkerGlobalScope|Window} */ self, | ||
/** | ||
@@ -45,3 +45,3 @@ * @param {string} url | ||
'queryWfsFeatureTypeDetails', | ||
/** @type {DedicatedWorkerGlobalScope} */ self, | ||
/** @type {DedicatedWorkerGlobalScope|Window} */ self, | ||
/** | ||
@@ -48,0 +48,0 @@ * @param {string} url |
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
651972
52
15832
71