ol-wfst 3.0.4 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -67
- package/LICENSE.md +21 -0
- package/README.md +548 -173
- package/dist/@enums.d.ts +5 -0
- package/dist/@enums.d.ts.map +1 -1
- package/dist/@types.d.ts +163 -0
- package/dist/@types.d.ts.map +1 -0
- package/dist/Geoserver.d.ts +260 -0
- package/dist/Geoserver.d.ts.map +1 -0
- package/dist/WfsLayer.d.ts +40 -0
- package/dist/WfsLayer.d.ts.map +1 -0
- package/dist/WmsLayer.d.ts +48 -0
- package/dist/WmsLayer.d.ts.map +1 -0
- package/dist/css/ol-wfst.bootstrap5.css +364 -481
- package/dist/css/ol-wfst.bootstrap5.min.css +1 -1
- package/dist/css/ol-wfst.css +22 -18
- package/dist/css/ol-wfst.min.css +1 -1
- package/dist/defaults.d.ts +4 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/modules/EditControlChanges.d.ts +18 -0
- package/dist/modules/EditControlChanges.d.ts.map +1 -0
- package/dist/modules/EditFieldsModal.d.ts +18 -0
- package/dist/modules/EditFieldsModal.d.ts.map +1 -0
- package/dist/modules/EditOverlay.d.ts +7 -0
- package/dist/modules/EditOverlay.d.ts.map +1 -0
- package/dist/modules/LayersControl.d.ts +35 -0
- package/dist/modules/LayersControl.d.ts.map +1 -0
- package/dist/modules/Modes/WfsSource.d.ts +60 -0
- package/dist/modules/Modes/WfsSource.d.ts.map +1 -0
- package/dist/modules/Modes/WmsSource.d.ts +82 -0
- package/dist/modules/Modes/WmsSource.d.ts.map +1 -0
- package/dist/modules/Modes/baseLayer.d.ts +62 -0
- package/dist/modules/Modes/baseLayer.d.ts.map +1 -0
- package/dist/modules/Modes/baseSource.d.ts +103 -0
- package/dist/modules/Modes/baseSource.d.ts.map +1 -0
- package/dist/modules/Uploads.d.ts +47 -0
- package/dist/modules/Uploads.d.ts.map +1 -0
- package/dist/modules/editLayer.d.ts +4 -0
- package/dist/modules/editLayer.d.ts.map +1 -0
- package/dist/modules/errors.d.ts +11 -0
- package/dist/modules/errors.d.ts.map +1 -0
- package/dist/modules/helpers.d.ts +7 -0
- package/dist/modules/helpers.d.ts.map +1 -0
- package/dist/{assets → modules}/i18n/en.d.ts +0 -0
- package/dist/modules/i18n/en.d.ts.map +1 -0
- package/dist/{assets → modules}/i18n/es.d.ts +0 -0
- package/dist/modules/i18n/es.d.ts.map +1 -0
- package/dist/modules/i18n/index.d.ts +15 -0
- package/dist/modules/i18n/index.d.ts.map +1 -0
- package/dist/{assets → modules}/i18n/zh.d.ts +0 -0
- package/dist/modules/i18n/zh.d.ts.map +1 -0
- package/dist/modules/loading.d.ts +3 -0
- package/dist/modules/loading.d.ts.map +1 -0
- package/dist/modules/state.d.ts +22 -0
- package/dist/modules/state.d.ts.map +1 -0
- package/dist/modules/styleFunction.d.ts +13 -0
- package/dist/modules/styleFunction.d.ts.map +1 -0
- package/dist/myPragma.d.ts +2 -0
- package/dist/myPragma.d.ts.map +1 -0
- package/dist/ol-wfst.d.ts +89 -315
- package/dist/ol-wfst.d.ts.map +1 -1
- package/dist/ol-wfst.js +6368 -5113
- package/dist/ol-wfst.js.map +1 -1
- package/dist/ol-wfst.min.js +1 -15
- package/dist/ol-wfst.min.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/lib/@enums.d.ts +5 -0
- package/lib/@enums.d.ts.map +1 -1
- package/lib/@types.d.ts +163 -0
- package/lib/@types.d.ts.map +1 -0
- package/lib/Geoserver.d.ts +260 -0
- package/lib/Geoserver.d.ts.map +1 -0
- package/lib/WfsLayer.d.ts +40 -0
- package/lib/WfsLayer.d.ts.map +1 -0
- package/lib/WmsLayer.d.ts +48 -0
- package/lib/WmsLayer.d.ts.map +1 -0
- package/lib/defaults.d.ts +4 -0
- package/lib/defaults.d.ts.map +1 -0
- package/lib/index-es.js +3008 -0
- package/lib/index-es.js.map +1 -0
- package/lib/modules/EditControlChanges.d.ts +18 -0
- package/lib/modules/EditControlChanges.d.ts.map +1 -0
- package/lib/modules/EditFieldsModal.d.ts +18 -0
- package/lib/modules/EditFieldsModal.d.ts.map +1 -0
- package/lib/modules/EditOverlay.d.ts +7 -0
- package/lib/modules/EditOverlay.d.ts.map +1 -0
- package/lib/modules/LayersControl.d.ts +35 -0
- package/lib/modules/LayersControl.d.ts.map +1 -0
- package/lib/modules/Modes/WfsSource.d.ts +60 -0
- package/lib/modules/Modes/WfsSource.d.ts.map +1 -0
- package/lib/modules/Modes/WmsSource.d.ts +82 -0
- package/lib/modules/Modes/WmsSource.d.ts.map +1 -0
- package/lib/modules/Modes/baseLayer.d.ts +62 -0
- package/lib/modules/Modes/baseLayer.d.ts.map +1 -0
- package/lib/modules/Modes/baseSource.d.ts +103 -0
- package/lib/modules/Modes/baseSource.d.ts.map +1 -0
- package/lib/modules/Uploads.d.ts +47 -0
- package/lib/modules/Uploads.d.ts.map +1 -0
- package/lib/modules/editLayer.d.ts +4 -0
- package/lib/modules/editLayer.d.ts.map +1 -0
- package/lib/modules/errors.d.ts +11 -0
- package/lib/modules/errors.d.ts.map +1 -0
- package/lib/modules/helpers.d.ts +7 -0
- package/lib/modules/helpers.d.ts.map +1 -0
- package/lib/{assets → modules}/i18n/en.d.ts +0 -0
- package/lib/modules/i18n/en.d.ts.map +1 -0
- package/lib/{assets → modules}/i18n/es.d.ts +0 -0
- package/lib/modules/i18n/es.d.ts.map +1 -0
- package/lib/modules/i18n/index.d.ts +15 -0
- package/lib/modules/i18n/index.d.ts.map +1 -0
- package/lib/{assets → modules}/i18n/zh.d.ts +0 -0
- package/lib/modules/i18n/zh.d.ts.map +1 -0
- package/lib/modules/loading.d.ts +3 -0
- package/lib/modules/loading.d.ts.map +1 -0
- package/lib/modules/state.d.ts +22 -0
- package/lib/modules/state.d.ts.map +1 -0
- package/lib/modules/styleFunction.d.ts +13 -0
- package/lib/modules/styleFunction.d.ts.map +1 -0
- package/lib/myPragma.d.ts +2 -0
- package/lib/myPragma.d.ts.map +1 -0
- package/lib/ol-wfst.d.ts +89 -315
- package/lib/ol-wfst.d.ts.map +1 -1
- package/lib/style/css/ol-gisify.css +22 -18
- package/lib/style/css/ol-wfst.bootstrap5.css +364 -481
- package/lib/style/scss/_variables.scss +17 -0
- package/lib/style/scss/ol-wfst.scss +31 -28
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +71 -70
- package/dist/assets/i18n/en.d.ts.map +0 -1
- package/dist/assets/i18n/es.d.ts.map +0 -1
- package/dist/assets/i18n/index.d.ts +0 -4
- package/dist/assets/i18n/index.d.ts.map +0 -1
- package/dist/assets/i18n/zh.d.ts.map +0 -1
- package/lib/assets/i18n/en.d.ts.map +0 -1
- package/lib/assets/i18n/es.d.ts.map +0 -1
- package/lib/assets/i18n/index.d.ts +0 -4
- package/lib/assets/i18n/index.d.ts.map +0 -1
- package/lib/assets/i18n/zh.d.ts.map +0 -1
- package/lib/ol-wfst.js +0 -2259
- package/lib/ol-wfst.js.map +0 -1
package/dist/ol-wfst.min.js
CHANGED
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("ol/geom"),require("ol/style"),require("ol/control"),require("ol/interaction"),require("ol/format"),require("ol/layer"),require("ol/source"),require("ol/loadingstrategy"),require("ol/geom/Polygon"),require("ol/extent"),require("ol/events/condition"),require("ol/proj"),require("ol/Observable")):"function"==typeof define&&define.amd?define(["ol/geom","ol/style","ol/control","ol/interaction","ol/format","ol/layer","ol/source","ol/loadingstrategy","ol/geom/Polygon","ol/extent","ol/events/condition","ol/proj","ol/Observable"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Wfst=t(e.ol.geom,e.ol.style,e.ol.control,e.ol.interaction,e.ol.format,e.ol.layer,e.ol.source,e.ol.loadingstrategy,e.ol.geom.Polygon,e.ol.extent,e.ol.events.condition,e.ol.proj,e.ol.Observable)}(this,(function(e,t,o,i,n,s,r,a,l,c,d,h,u){"use strict";
|
|
2
|
-
/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted.
|
|
7
|
-
|
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */function p(e,t,o,i){return new(o||(o=Promise))((function(n,s){function r(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(r,a)}l((i=i.apply(e,t||[])).next())}))}var f=2,m=3,y=0;var _,g=(_=function(e,t){return(_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}_(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),v=function(e){function t(t){var o=this,i="Assertion failed. See https://openlayers.org/en/"+("v"+"6.12.0".split("-")[0])+"/doc/errors/#"+t+" for details.";return(o=e.call(this,i)||this).code=t,o.name="AssertionError",o.message=i,o}return g(t,e),t}(Error),b=function(){function e(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}return e.prototype.preventDefault=function(){this.defaultPrevented=!0},e.prototype.stopPropagation=function(){this.propagationStopped=!0},e}(),w="propertychange",E=function(){function e(){this.disposed=!1}return e.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposeInternal())},e.prototype.disposeInternal=function(){},e}();function L(){}var S="function"==typeof Object.assign?Object.assign:function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var o=Object(e),i=1,n=arguments.length;i<n;++i){var s=arguments[i];if(null!=s)for(var r in s)s.hasOwnProperty(r)&&(o[r]=s[r])}return o};function F(e){for(var t in e)delete e[t]}var C=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])})(t,o)};return function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function i(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(i.prototype=o.prototype,new i)}}(),T=function(e){function t(t){var o=e.call(this)||this;return o.eventTarget_=t,o.pendingRemovals_=null,o.dispatching_=null,o.listeners_=null,o}return C(t,e),t.prototype.addEventListener=function(e,t){if(e&&t){var o=this.listeners_||(this.listeners_={}),i=o[e]||(o[e]=[]);-1===i.indexOf(t)&&i.push(t)}},t.prototype.dispatchEvent=function(e){var t="string"==typeof e?new b(e):e,o=t.type;t.target||(t.target=this.eventTarget_||this);var i,n=this.listeners_&&this.listeners_[o];if(n){var s=this.dispatching_||(this.dispatching_={}),r=this.pendingRemovals_||(this.pendingRemovals_={});o in s||(s[o]=0,r[o]=0),++s[o];for(var a=0,l=n.length;a<l;++a)if(!1===(i="handleEvent"in n[a]?n[a].handleEvent(t):n[a].call(this,t))||t.propagationStopped){i=!1;break}if(--s[o],0===s[o]){var c=r[o];for(delete r[o];c--;)this.removeEventListener(o,L);delete s[o]}return i}},t.prototype.disposeInternal=function(){this.listeners_&&F(this.listeners_)},t.prototype.getListeners=function(e){return this.listeners_&&this.listeners_[e]||void 0},t.prototype.hasListener=function(e){return!!this.listeners_&&(e?e in this.listeners_:Object.keys(this.listeners_).length>0)},t.prototype.removeEventListener=function(e,t){var o=this.listeners_&&this.listeners_[e];if(o){var i=o.indexOf(t);-1!==i&&(this.pendingRemovals_&&e in this.pendingRemovals_?(o[i]=L,++this.pendingRemovals_[e]):(o.splice(i,1),0===o.length&&delete this.listeners_[e]))}},t}(E),M="change";function O(e,t,o,i,n){if(i&&i!==e&&(o=o.bind(i)),n){var s=o;o=function(){e.removeEventListener(t,o),s.apply(this,arguments)}}var r={target:e,type:t,listener:o};return e.addEventListener(t,o),r}function P(e,t,o,i){return O(e,t,o,i,!0)}function k(e){e&&e.target&&(e.target.removeEventListener(e.type,e.listener),F(e))}var x=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])})(t,o)};return function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function i(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(i.prototype=o.prototype,new i)}}(),j=function(e){function t(){var t=e.call(this)||this;return t.on=t.onInternal,t.once=t.onceInternal,t.un=t.unInternal,t.revision_=0,t}return x(t,e),t.prototype.changed=function(){++this.revision_,this.dispatchEvent(M)},t.prototype.getRevision=function(){return this.revision_},t.prototype.onInternal=function(e,t){if(Array.isArray(e)){for(var o=e.length,i=new Array(o),n=0;n<o;++n)i[n]=O(this,e[n],t);return i}return O(this,e,t)},t.prototype.onceInternal=function(e,t){var o;if(Array.isArray(e)){var i=e.length;o=new Array(i);for(var n=0;n<i;++n)o[n]=P(this,e[n],t)}else o=P(this,e,t);return t.ol_key=o,o},t.prototype.unInternal=function(e,t){var o=t.ol_key;if(o)!function(e){if(Array.isArray(e))for(var t=0,o=e.length;t<o;++t)k(e[t]);else k(e)}(o);else if(Array.isArray(e))for(var i=0,n=e.length;i<n;++i)this.removeEventListener(e[i],t);else this.removeEventListener(e,t)},t}(T);j.prototype.on,j.prototype.once,j.prototype.un;var G=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])})(t,o)};return function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function i(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(i.prototype=o.prototype,new i)}}(),N=function(e){function t(t,o,i){var n=e.call(this,t)||this;return n.key=o,n.oldValue=i,n}return G(t,e),t}(b),A=function(e){function t(t){var o,i=e.call(this)||this;return i.on,i.once,i.un,(o=i).ol_uid||(o.ol_uid=String(++y)),i.values_=null,void 0!==t&&i.setProperties(t),i}return G(t,e),t.prototype.get=function(e){var t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t},t.prototype.getKeys=function(){return this.values_&&Object.keys(this.values_)||[]},t.prototype.getProperties=function(){return this.values_&&S({},this.values_)||{}},t.prototype.hasProperties=function(){return!!this.values_},t.prototype.notify=function(e,t){var o;o="change:"+e,this.dispatchEvent(new N(o,e,t)),o=w,this.dispatchEvent(new N(o,e,t))},t.prototype.addChangeListener=function(e,t){this.addEventListener("change:"+e,t)},t.prototype.removeChangeListener=function(e,t){this.removeEventListener("change:"+e,t)},t.prototype.set=function(e,t,o){var i=this.values_||(this.values_={});if(o)i[e]=t;else{var n=i[e];i[e]=t,n!==t&&this.notify(e,n)}},t.prototype.setProperties=function(e,t){for(var o in e)this.set(o,e[o],t)},t.prototype.applyProperties=function(e){e.values_&&S(this.values_||(this.values_={}),e.values_)},t.prototype.unset=function(e,t){if(this.values_&&e in this.values_){var o=this.values_[e];delete this.values_[e],function(e){var t;for(t in e)return!1;return!t}(this.values_)&&(this.values_=null),t||this.notify(e,o)}},t}(j),I="add",q="remove",D=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])})(t,o)};return function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function i(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(i.prototype=o.prototype,new i)}}(),z="length",$=function(e){function t(t,o,i){var n=e.call(this,t)||this;return n.element=o,n.index=i,n}return D(t,e),t}(b),R=function(e){function t(t,o){var i=e.call(this)||this;i.on,i.once,i.un;var n=o||{};if(i.unique_=!!n.unique,i.array_=t||[],i.unique_)for(var s=0,r=i.array_.length;s<r;++s)i.assertUnique_(i.array_[s],s);return i.updateLength_(),i}return D(t,e),t.prototype.clear=function(){for(;this.getLength()>0;)this.pop()},t.prototype.extend=function(e){for(var t=0,o=e.length;t<o;++t)this.push(e[t]);return this},t.prototype.forEach=function(e){for(var t=this.array_,o=0,i=t.length;o<i;++o)e(t[o],o,t)},t.prototype.getArray=function(){return this.array_},t.prototype.item=function(e){return this.array_[e]},t.prototype.getLength=function(){return this.get(z)},t.prototype.insertAt=function(e,t){this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new $(I,t,e))},t.prototype.pop=function(){return this.removeAt(this.getLength()-1)},t.prototype.push=function(e){this.unique_&&this.assertUnique_(e);var t=this.getLength();return this.insertAt(t,e),this.getLength()},t.prototype.remove=function(e){for(var t=this.array_,o=0,i=t.length;o<i;++o)if(t[o]===e)return this.removeAt(o)},t.prototype.removeAt=function(e){var t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new $(q,t,e)),t},t.prototype.setAt=function(e,t){var o=this.getLength();if(e<o){this.unique_&&this.assertUnique_(t,e);var i=this.array_[e];this.array_[e]=t,this.dispatchEvent(new $(q,i,e)),this.dispatchEvent(new $(I,t,e))}else{for(var n=o;n<e;++n)this.insertAt(n,void 0);this.insertAt(e,t)}},t.prototype.updateLength_=function(){this.set(z,this.array_.length)},t.prototype.assertUnique_=function(e,t){for(var o=0,i=this.array_.length;o<i;++o)if(this.array_[o]===e&&o!==t)throw new v(58)},t}(A);var V=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])})(t,o)};return function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function i(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(i.prototype=o.prototype,new i)}}(),H=function(e){function t(t){var o=e.call(this)||this;if(o.on,o.once,o.un,o.id_=void 0,o.geometryName_="geometry",o.style_=null,o.styleFunction_=void 0,o.geometryChangeKey_=null,o.addChangeListener(o.geometryName_,o.handleGeometryChanged_),t)if("function"==typeof t.getSimplifiedGeometry){var i=t;o.setGeometry(i)}else{var n=t;o.setProperties(n)}return o}return V(t,e),t.prototype.clone=function(){var e=new t(this.hasProperties()?this.getProperties():null);e.setGeometryName(this.getGeometryName());var o=this.getGeometry();o&&e.setGeometry(o.clone());var i=this.getStyle();return i&&e.setStyle(i),e},t.prototype.getGeometry=function(){return this.get(this.geometryName_)},t.prototype.getId=function(){return this.id_},t.prototype.getGeometryName=function(){return this.geometryName_},t.prototype.getStyle=function(){return this.style_},t.prototype.getStyleFunction=function(){return this.styleFunction_},t.prototype.handleGeometryChange_=function(){this.changed()},t.prototype.handleGeometryChanged_=function(){this.geometryChangeKey_&&(k(this.geometryChangeKey_),this.geometryChangeKey_=null);var e=this.getGeometry();e&&(this.geometryChangeKey_=O(e,M,this.handleGeometryChange_,this)),this.changed()},t.prototype.setGeometry=function(e){this.set(this.geometryName_,e)},t.prototype.setStyle=function(e){this.style_=e,this.styleFunction_=e?function(e){if("function"==typeof e)return e;var t;Array.isArray(e)?t=e:(!function(e,t){if(!e)throw new v(t)}("function"==typeof e.getZIndex,41),t=[e]);return function(){return t}}(e):void 0,this.changed()},t.prototype.setId=function(e){this.id_=e,this.changed()},t.prototype.setGeometryName=function(e){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()},t}(A);function U(e){var t=e.offsetWidth,o=getComputedStyle(e);return t+=parseInt(o.marginLeft,10)+parseInt(o.marginRight,10)}function W(e){var t=e.offsetHeight,o=getComputedStyle(e);return t+=parseInt(o.marginTop,10)+parseInt(o.marginBottom,10)}function B(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(o){var i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:function(){return e[o]}})})),t}var K="postrender",Z="bottom-left",J="bottom-center",X="bottom-right",Y="center-left",Q="center-center",ee="center-right",te="top-left",oe="top-center",ie="top-right",ne=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])})(t,o)};return function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function i(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(i.prototype=o.prototype,new i)}}(),se="element",re="map",ae="offset",le="position",ce="positioning",de=function(e){function t(t){var o=e.call(this)||this;o.on,o.once,o.un,o.options=t,o.id=t.id,o.insertFirst=void 0===t.insertFirst||t.insertFirst,o.stopEvent=void 0===t.stopEvent||t.stopEvent,o.element=document.createElement("div"),o.element.className=void 0!==t.className?t.className:"ol-overlay-container ol-selectable",o.element.style.position="absolute",o.element.style.pointerEvents="auto";var i=t.autoPan;return i&&"object"!=typeof i&&(i={animation:t.autoPanAnimation,margin:t.autoPanMargin}),o.autoPan=i||!1,o.rendered={transform_:"",visible:!0},o.mapPostrenderListenerKey=null,o.addChangeListener(se,o.handleElementChanged),o.addChangeListener(re,o.handleMapChanged),o.addChangeListener(ae,o.handleOffsetChanged),o.addChangeListener(le,o.handlePositionChanged),o.addChangeListener(ce,o.handlePositioningChanged),void 0!==t.element&&o.setElement(t.element),o.setOffset(void 0!==t.offset?t.offset:[0,0]),o.setPositioning(void 0!==t.positioning?t.positioning:te),void 0!==t.position&&o.setPosition(t.position),o}return ne(t,e),t.prototype.getElement=function(){return this.get(se)},t.prototype.getId=function(){return this.id},t.prototype.getMap=function(){return this.get(re)},t.prototype.getOffset=function(){return this.get(ae)},t.prototype.getPosition=function(){return this.get(le)},t.prototype.getPositioning=function(){return this.get(ce)},t.prototype.handleElementChanged=function(){!function(e){for(;e.lastChild;)e.removeChild(e.lastChild)}(this.element);var e=this.getElement();e&&this.element.appendChild(e)},t.prototype.handleMapChanged=function(){var e;this.mapPostrenderListenerKey&&((e=this.element)&&e.parentNode&&e.parentNode.removeChild(e),k(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);var t=this.getMap();if(t){this.mapPostrenderListenerKey=O(t,K,this.render,this),this.updatePixelPosition();var o=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?o.insertBefore(this.element,o.childNodes[0]||null):o.appendChild(this.element),this.performAutoPan()}},t.prototype.render=function(){this.updatePixelPosition()},t.prototype.handleOffsetChanged=function(){this.updatePixelPosition()},t.prototype.handlePositionChanged=function(){this.updatePixelPosition(),this.performAutoPan()},t.prototype.handlePositioningChanged=function(){this.updatePixelPosition()},t.prototype.setElement=function(e){this.set(se,e)},t.prototype.setMap=function(e){this.set(re,e)},t.prototype.setOffset=function(e){this.set(ae,e)},t.prototype.setPosition=function(e){this.set(le,e)},t.prototype.performAutoPan=function(){this.autoPan&&this.panIntoView(this.autoPan)},t.prototype.panIntoView=function(e){var t=this.getMap();if(t&&t.getTargetElement()&&this.get(le)){var o,i,n=this.getRect(t.getTargetElement(),t.getSize()),s=this.getElement(),r=this.getRect(s,[U(s),W(s)]),a=e||{},l=void 0===a.margin?20:a.margin;if(i=r,!((o=n)[0]<=i[0]&&i[2]<=o[2]&&o[1]<=i[1]&&i[3]<=o[3])){var c=r[0]-n[0],d=n[2]-r[2],h=r[1]-n[1],u=n[3]-r[3],p=[0,0];if(c<0?p[0]=c-l:d<0&&(p[0]=Math.abs(d)+l),h<0?p[1]=h-l:u<0&&(p[1]=Math.abs(u)+l),0!==p[0]||0!==p[1]){var f=t.getView().getCenterInternal(),m=t.getPixelFromCoordinateInternal(f);if(!m)return;var y=[m[0]+p[0],m[1]+p[1]],_=a.animation||{};t.getView().animateInternal({center:t.getCoordinateFromPixelInternal(y),duration:_.duration,easing:_.easing})}}}},t.prototype.getRect=function(e,t){var o=e.getBoundingClientRect(),i=o.left+window.pageXOffset,n=o.top+window.pageYOffset;return[i,n,i+t[0],n+t[1]]},t.prototype.setPositioning=function(e){this.set(ce,e)},t.prototype.setVisible=function(e){this.rendered.visible!==e&&(this.element.style.display=e?"":"none",this.rendered.visible=e)},t.prototype.updatePixelPosition=function(){var e=this.getMap(),t=this.getPosition();if(e&&e.isRendered()&&t){var o=e.getPixelFromCoordinate(t),i=e.getSize();this.updateRenderedPosition(o,i)}else this.setVisible(!1)},t.prototype.updateRenderedPosition=function(e,t){var o=this.element.style,i=this.getOffset(),n=this.getPositioning();this.setVisible(!0);var s=Math.round(e[0]+i[0])+"px",r=Math.round(e[1]+i[1])+"px",a="0%",l="0%";n==X||n==ee||n==ie?a="-100%":n!=J&&n!=Q&&n!=oe||(a="-50%"),n==Z||n==J||n==X?l="-100%":n!=Y&&n!=Q&&n!=ee||(l="-50%");var c="translate("+a+", "+l+") translate("+s+", "+r+")";this.rendered.transform_!=c&&(this.rendered.transform_=c,o.transform=c,o.msTransform=c)},t.prototype.getOptions=function(){return this.options},t}(A);function he(){}function ue(){ue.init.call(this)}function pe(e){return void 0===e._maxListeners?ue.defaultMaxListeners:e._maxListeners}function fe(e,t,o){if(t)e.call(o);else for(var i=e.length,n=Ee(e,i),s=0;s<i;++s)n[s].call(o)}function me(e,t,o,i){if(t)e.call(o,i);else for(var n=e.length,s=Ee(e,n),r=0;r<n;++r)s[r].call(o,i)}function ye(e,t,o,i,n){if(t)e.call(o,i,n);else for(var s=e.length,r=Ee(e,s),a=0;a<s;++a)r[a].call(o,i,n)}function _e(e,t,o,i,n,s){if(t)e.call(o,i,n,s);else for(var r=e.length,a=Ee(e,r),l=0;l<r;++l)a[l].call(o,i,n,s)}function ge(e,t,o,i){if(t)e.apply(o,i);else for(var n=e.length,s=Ee(e,n),r=0;r<n;++r)s[r].apply(o,i)}function ve(e,t,o,i){var n,s,r,a;if("function"!=typeof o)throw new TypeError('"listener" argument must be a function');if((s=e._events)?(s.newListener&&(e.emit("newListener",t,o.listener?o.listener:o),s=e._events),r=s[t]):(s=e._events=new he,e._eventsCount=0),r){if("function"==typeof r?r=s[t]=i?[o,r]:[r,o]:i?r.unshift(o):r.push(o),!r.warned&&(n=pe(e))&&n>0&&r.length>n){r.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+r.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=r.length,a=l,"function"==typeof console.warn?console.warn(a):console.log(a)}}else r=s[t]=o,++e._eventsCount;return e}function be(e,t,o){var i=!1;function n(){e.removeListener(t,n),i||(i=!0,o.apply(e,arguments))}return n.listener=o,n}function we(e){var t=this._events;if(t){var o=t[e];if("function"==typeof o)return 1;if(o)return o.length}return 0}function Ee(e,t){for(var o=new Array(t);t--;)o[t]=e[t];return o}he.prototype=Object.create(null),ue.EventEmitter=ue,ue.usingDomains=!1,ue.prototype.domain=void 0,ue.prototype._events=void 0,ue.prototype._maxListeners=void 0,ue.defaultMaxListeners=10,ue.init=function(){this.domain=null,ue.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new he,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ue.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},ue.prototype.getMaxListeners=function(){return pe(this)},ue.prototype.emit=function(e){var t,o,i,n,s,r,a,l="error"===e;if(r=this._events)l=l&&null==r.error;else if(!l)return!1;if(a=this.domain,l){if(t=arguments[1],!a){if(t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(o=r[e]))return!1;var d="function"==typeof o;switch(i=arguments.length){case 1:fe(o,d,this);break;case 2:me(o,d,this,arguments[1]);break;case 3:ye(o,d,this,arguments[1],arguments[2]);break;case 4:_e(o,d,this,arguments[1],arguments[2],arguments[3]);break;default:for(n=new Array(i-1),s=1;s<i;s++)n[s-1]=arguments[s];ge(o,d,this,n)}return!0},ue.prototype.addListener=function(e,t){return ve(this,e,t,!1)},ue.prototype.on=ue.prototype.addListener,ue.prototype.prependListener=function(e,t){return ve(this,e,t,!0)},ue.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,be(this,e,t)),this},ue.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,be(this,e,t)),this},ue.prototype.removeListener=function(e,t){var o,i,n,s,r;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(i=this._events))return this;if(!(o=i[e]))return this;if(o===t||o.listener&&o.listener===t)0==--this._eventsCount?this._events=new he:(delete i[e],i.removeListener&&this.emit("removeListener",e,o.listener||t));else if("function"!=typeof o){for(n=-1,s=o.length;s-- >0;)if(o[s]===t||o[s].listener&&o[s].listener===t){r=o[s].listener,n=s;break}if(n<0)return this;if(1===o.length){if(o[0]=void 0,0==--this._eventsCount)return this._events=new he,this;delete i[e]}else!function(e,t){for(var o=t,i=o+1,n=e.length;i<n;o+=1,i+=1)e[o]=e[i];e.pop()}(o,n);i.removeListener&&this.emit("removeListener",e,r||t)}return this},ue.prototype.off=function(e,t){return this.removeListener(e,t)},ue.prototype.removeAllListeners=function(e){var t,o;if(!(o=this._events))return this;if(!o.removeListener)return 0===arguments.length?(this._events=new he,this._eventsCount=0):o[e]&&(0==--this._eventsCount?this._events=new he:delete o[e]),this;if(0===arguments.length){for(var i,n=Object.keys(o),s=0;s<n.length;++s)"removeListener"!==(i=n[s])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=new he,this._eventsCount=0,this}if("function"==typeof(t=o[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},ue.prototype.listeners=function(e){var t,o=this._events;return o&&(t=o[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),o=0;o<t.length;++o)t[o]=e[o].listener||e[o];return t}(t):[]},ue.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):we.call(e,t)},ue.prototype.listenerCount=we,ue.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};const Le=document.createElement("div"),Se=Object.freeze({el:null,animate:!0,animateClass:"fade",animateInClass:"show",appendTo:"body",backdrop:!0,keyboard:!0,title:!1,header:!0,content:!1,footer:!0,buttons:null,headerClose:!0,construct:!1,transition:300,backdropTransition:150}),Fe=function e(t){for(let o in t)Array.isArray(t[o])?t[o].forEach((t=>{e(t)})):null!==t[o]&&"object"==typeof t[o]&&Object.freeze(t[o]);return Object.freeze(t)}({dialog:[{text:"Cancel",value:!1,attr:{class:"btn btn-default","data-dismiss":"modal"}},{text:"OK",value:!0,attr:{class:"btn btn-primary","data-dismiss":"modal"}}],alert:[{text:"OK",attr:{class:"btn btn-primary","data-dismiss":"modal"}}],confirm:[{text:"Cancel",value:!1,attr:{class:"btn btn-default","data-dismiss":"modal"}},{text:"OK",value:!0,attr:{class:"btn btn-primary","data-dismiss":"modal"}}]}),Ce={container:'<div class="modal"></div>',dialog:'<div class="modal-dialog"></div>',content:'<div class="modal-content"></div>',header:'<div class="modal-header"></div>',headerClose:'<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>',body:'<div class="modal-body"></div>',footer:'<div class="modal-footer"></div>',backdrop:'<div class="modal-backdrop"></div>'};function Te(e,t,o){let i=e.data||{};if(void 0===o){if(e.data&&e.data[t])return e.data[t];var n=e.getAttribute(`data-${t}`);return void 0!==n?n:null}return i[t]=o,e.data=i,e}function Me(e,t){return e.nodeName?e:(e=e.replace(/(\t|\n$)/g,""),Le.innerHTML="",Le.innerHTML=e,!0===t?Le.childNodes:Le.childNodes[0])}class Oe extends ue{static set templates(e){this._baseTemplates=e}static get templates(){return Object.assign({},Ce,Oe._baseTemplates||{})}static set buttons(e){this._baseButtons=e}static get buttons(){return Object.assign({},Fe,Oe._baseButtons||{})}static set options(e){this._baseOptions=e}static get options(){return Object.assign({},Se,Oe._baseOptions||{})}static get version(){return"0.9.0"}static alert(e,t={}){let o=Object.assign({},Se,{title:e,content:!1,construct:!0,headerClose:!1,buttons:Oe.buttons.alert},t);return new Oe(o)}static confirm(e,t={}){let o=Object.assign({},Se,{title:e,content:!1,construct:!0,headerClose:!1,buttons:Oe.buttons.confirm},t);return new Oe(o)}constructor(e={}){if(super(),this.id=(65536*(1+Math.random())|0).toString(16)+(65536*(1+Math.random())|0).toString(16),this.el=null,this._html={},this._events={},this._visible=!1,this._options=Object.assign({},Oe.options,e),this._templates=Object.assign({},Oe.templates,e.templates||{}),this._html.appendTo=document.querySelector(this._options.appendTo),this._scrollbarWidth=function(){let e,t,o,i=document.createElement("div");return Object.assign(i.style,{visibility:"hidden",width:"100px"}),document.body.appendChild(i),o=i.offsetWidth,i.style.overflow="scroll",e=document.createElement("div"),e.style.width="100%",i.appendChild(e),t=o-e.offsetWidth,document.body.removeChild(i),t}(),null===this._options.buttons&&(this._options.buttons=Oe.buttons.dialog),this._options.el){let e=this._options.el;if("string"==typeof this._options.el&&(e=document.querySelector(this._options.el),!e))throw new Error(`Selector: DOM Element ${this._options.el} not found.`);Te(e,"modal",this),this.el=e}else this._options.construct=!0;this._options.construct?this._render():this._mapDom()}_render(){let e=this._html,t=this._options,o=this._templates,i=!!t.animate&&t.animateClass;return e.container=Me(o.container),e.dialog=Me(o.dialog),e.content=Me(o.content),e.header=Me(o.header),e.headerClose=Me(o.headerClose),e.body=Me(o.body),e.footer=Me(o.footer),i&&e.container.classList.add(i),this._setHeader(),this._setContent(),this._setFooter(),this.el=e.container,e.dialog.appendChild(e.content),e.container.appendChild(e.dialog),this}_mapDom(){let e=this._html,t=this._options;return this.el.classList.contains(t.animateClass)&&(t.animate=!0),e.container=this.el,e.dialog=this.el.querySelector(".modal-dialog"),e.content=this.el.querySelector(".modal-content"),e.header=this.el.querySelector(".modal-header"),e.headerClose=this.el.querySelector(".modal-header .close"),e.body=this.el.querySelector(".modal-body"),e.footer=this.el.querySelector(".modal-footer"),this._setHeader(),this._setContent(),this._setFooter(),this}_setHeader(){let e=this._html,t=this._options;t.header&&e.header&&(t.title.nodeName?e.header.innerHTML=t.title.outerHTML:"string"==typeof t.title&&(e.header.innerHTML=`<h4 class="modal-title">${t.title}</h4>`),null===this.el&&e.headerClose&&t.headerClose&&e.header.appendChild(e.headerClose),t.construct&&e.content.appendChild(e.header))}_setContent(){let e=this._html,t=this._options;t.content&&e.body&&("string"==typeof t.content?e.body.innerHTML=t.content:e.body.innerHTML=t.content.outerHTML,t.construct&&e.content.appendChild(e.body))}_setFooter(){let e=this._html,t=this._options;t.footer&&e.footer&&(t.footer.nodeName?e.footer.ineerHTML=t.footer.outerHTML:"string"==typeof t.footer?e.footer.innerHTML=t.footer:e.footer.children.length||t.buttons.forEach((t=>{let o=document.createElement("button");Te(o,"button",t),o.innerHTML=t.text,o.setAttribute("type","button");for(let e in t.attr)o.setAttribute(e,t.attr[e]);e.footer.appendChild(o)})),t.construct&&e.content.appendChild(e.footer))}_setEvents(){this._options;let e=this._html;this._events.keydownHandler=this._handleKeydownEvent.bind(this),document.body.addEventListener("keydown",this._events.keydownHandler),this._events.clickHandler=this._handleClickEvent.bind(this),e.container.addEventListener("click",this._events.clickHandler),this._events.resizeHandler=this._handleResizeEvent.bind(this),window.addEventListener("resize",this._events.resizeHandler)}_handleClickEvent(e){(function(e){let t=[e];for(;e.parentNode;)e=e.parentNode,t.push(e);return t})(e.target).every((t=>"HTML"!==t.tagName&&((!0===this._options.backdrop||!t.classList.contains("modal"))&&(!t.classList.contains("modal-content")&&("modal"===t.getAttribute("data-dismiss")?(this.emit("dismiss",this,e,Te(e.target,"button")),this.hide(),!1):!t.classList.contains("modal")||(this.emit("dismiss",this,e,null),this.hide(),!1))))))}_handleKeydownEvent(e){27===e.which&&this._options.keyboard&&(this.emit("dismiss",this,e,null),this.hide())}_handleResizeEvent(e){this._resize()}show(){let e=this._options,t=this._html;return this.emit("show",this),this._checkScrollbar(),this._setScrollbar(),document.body.classList.add("modal-open"),e.construct&&t.appendTo.appendChild(t.container),t.container.style.display="block",t.container.scrollTop=0,!1!==e.backdrop?(this.once("showBackdrop",(()=>{this._setEvents(),e.animate&&t.container.offsetWidth,t.container.classList.add(e.animateInClass),setTimeout((()=>{this._visible=!0,this.emit("shown",this)}),e.transition)})),this._backdrop()):(this._setEvents(),e.animate&&t.container.offsetWidth,t.container.classList.add(e.animateInClass),setTimeout((()=>{this._visible=!0,this.emit("shown",this)}),e.transition)),this._resize(),this}toggle(){this._visible?this.hide():this.show()}_resize(){var e=this._html.container.scrollHeight>document.documentElement.clientHeight;this._html.container.style.paddingLeft=!this.bodyIsOverflowing&&e?this._scrollbarWidth+"px":"",this._html.container.style.paddingRight=this.bodyIsOverflowing&&!e?this._scrollbarWidth+"px":""}_backdrop(){let e=this._html,t=this._templates,o=this._options,i=!!o.animate&&o.animateClass;e.backdrop=Me(t.backdrop),i&&e.backdrop.classList.add(i),e.appendTo.appendChild(e.backdrop),i&&e.backdrop.offsetWidth,e.backdrop.classList.add(o.animateInClass),setTimeout((()=>{this.emit("showBackdrop",this)}),this._options.backdropTransition)}hide(){let e=this._html,t=this._options,o=e.container.classList;if(this.emit("hide",this),o.remove(t.animateInClass),t.backdrop){e.backdrop.classList.remove(t.animateInClass)}return this._removeEvents(),setTimeout((()=>{document.body.classList.remove("modal-open"),document.body.style.paddingRight=this.originalBodyPad}),t.backdropTransition),setTimeout((()=>{t.backdrop&&e.backdrop.parentNode.removeChild(e.backdrop),e.container.style.display="none",t.construct&&e.container.parentNode.removeChild(e.container),this._visible=!1,this.emit("hidden",this)}),t.transition),this}_removeEvents(){this._events.keydownHandler&&document.body.removeEventListener("keydown",this._events.keydownHandler),this._html.container.removeEventListener("click",this._events.clickHandler),window.removeEventListener("resize",this._events.resizeHandler)}_checkScrollbar(){this.bodyIsOverflowing=document.body.clientWidth<window.innerWidth}_setScrollbar(){if(this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing){let e=parseInt(this.originalBodyPad||0,10);document.body.style.paddingRight=e+this._scrollbarWidth+"px"}}}var Pe,ke=B(Object.freeze({__proto__:null,default:Oe})).default;!function(e){e.Point="Point",e.LineString="LineString",e.LinearRing="LinearRing",e.Polygon="Polygon",e.MultiPoint="MultiPoint",e.MultiLineString="MultiLineString",e.MultiPolygon="MultiPolygon",e.GeometryCollection="GeometryCollection",e.Circle="Circle"}(Pe||(Pe={}));var xe=Object.freeze({__proto__:null,es:{labels:{select:"Seleccionar",addElement:"Modo dibujo",editElement:"Editar elemento",save:"Guardar",delete:"Eliminar",cancel:"Cancelar",apply:"Aplicar cambios",upload:"Subir",editMode:"Modo Edición",confirmDelete:"¿Estás seguro de borrar el elemento?",geomTypeNotSupported:"Geometría no compatible con la capa",editFields:"Editar campos",editGeom:"Editar geometría",selectDrawType:"Tipo de geometría para dibujar",uploadToLayer:"Subir archivo a la capa seleccionada",uploadFeatures:"Subida de elementos a la capa",validFeatures:"Válidas",invalidFeatures:"Invalidas",loading:"Cargando...",toggleVisibility:"Cambiar visibilidad de la capa",close:"Cerrar"},errors:{capabilities:"No se pudieron obtener las Capabilidades del GeoServer",wfst:"El GeoServer no tiene soporte a Transacciones",layer:"No se pudieron obtener datos de la capa",layerNotFound:"CApa no encontrada",noValidGeometry:"No se encontraron geometrías válidas para agregar a esta capa",geoserver:"No se pudieron obtener datos desde el GeoServer",badFormat:"Formato no soportado",badFile:"Error al leer elementos del archivo",lockFeature:"No se pudieron bloquear elementos en el GeoServer.",transaction:"Error al hacer transacción con el GeoServer. HTTP status:",getFeatures:"Error al obtener elemento desde el GeoServer. HTTP status:"}},en:{labels:{select:"Select",addElement:"Toggle Draw mode",editElement:"Edit feature",save:"Save",delete:"Delete",cancel:"Cancel",apply:"Apply changes",upload:"Upload",editMode:"Edit Mode",confirmDelete:"Are you sure to delete the feature?",geomTypeNotSupported:"Geometry not supported by layer",editFields:"Edit fields",editGeom:"Edit geometry",selectDrawType:"Geometry type to draw",uploadToLayer:"Upload file to selected layer",uploadFeatures:"Uploaded features to layer",validFeatures:"Valid geometries",invalidFeatures:"Invalid",loading:"Loading...",toggleVisibility:"Toggle layer visibility",close:"Close"},errors:{capabilities:"GeoServer Capabilities could not be downloaded.",wfst:"The GeoServer does not support Transactions",layer:"Could not get data from layer",layerNotFound:"Layer not found",noValidGeometry:"No valid geometries found to add to this layer",geoserver:"Could not get data from the GeoServer",badFormat:"Unsupported format",badFile:"Error reading items from file",lockFeature:"Could not lock items on the GeoServer. HTTP status:",transaction:"Error when doing Transaction with GeoServer. HTTP status:",getFeatures:"Error getting elements from GeoServer. HTTP status:"}},zh:{labels:{select:"选择",addElement:"切换绘图类型",editElement:"编辑元素",save:"保存",delete:"删除",cancel:"取消",apply:"确认并应用改变",upload:"上传",editMode:"编辑模式",confirmDelete:"确认删除元素?",geomTypeNotSupported:"图层不支持该几何",editFields:"编辑区域",editGeom:"编辑几何",selectDrawType:"几何类型",uploadToLayer:"通过文件上传图层",uploadFeatures:"上传元素到图层",validFeatures:"合法的几何类型",invalidFeatures:"不合法",loading:"加载中...",toggleVisibility:"切换图层透明度",close:"关闭"},errors:{capabilities:"无法加载GeoServer服务所支持的能力.",wfst:"GeoServer不支持事务",layer:"无法从图层获得数据",layerNotFound:"Layer not found",noValidGeometry:"不支持的几何类型无法加载到图层",geoserver:"无法从GeoServer获取数据",badFormat:"不支持的格式",badFile:"读取文件数据出错",lockFeature:"无法锁定GeoServer上的元素. HTTP状态码:",transaction:"GeoServer处理事务出错. HTTP状态码:",getFeatures:"从GeoServer获取元素出错. HTTP状态码:"}}});const je=document.createElement("div");class Ge extends o.Control{constructor(e){super({target:null,element:je}),this._i18n=e.language&&e.language in xe?xe[e.language]:xe.en,e.i18n&&(this._i18n=Object.assign(Object.assign({},this._i18n),e.i18n));const t={geoServerUrl:null,geoServerAdvanced:{getCapabilitiesVersion:"1.3.0",getFeatureVersion:"1.0.0",describeFeatureTypeVersion:"1.1.0",lockFeatureVersion:"1.1.0",wfsTransactionVersion:"1.1.0",projection:"EPSG:3857"},headers:{},credentials:"same-origin",layers:null,evtType:"singleclick",active:!0,showControl:!0,useLockFeature:!0,minZoom:9,language:"en",uploadFormats:".geojson,.json,.kml",processUpload:null,beforeInsertFeature:null,modal:{animateClass:"fade",animateInClass:"show",transition:300,backdropTransition:150,templates:{dialog:'<div class="modal-dialog modal-dialog-centered"></div>',headerClose:`<button type="button" class="btn-close" data-dismiss="modal" aria-label="${this._i18n.labels.close}"><span aria-hidden="true">×</span></button>`}}};this._options=Ne(t,e),this._mapLayers=[],this._countRequests=0,this._isEditModeOn=!1,this._hasLockFeature=!1,this._hasTransaction=!1,this._geoServerCapabilities=null,this._geoServerData={},this._editedFeatures=new Set,this._layerToInsertElements=this._options.layers[0].name,this._insertFeatures=[],this._updateFeatures=[],this._deleteFeatures=[],this._formatWFS=new n.WFS,this._formatGeoJSON=new n.GeoJSON,this._formatKml=new n.KML({extractStyles:!1,showPointNames:!1}),this._xs=new XMLSerializer,this._controlWidgetToolsDiv=je,this._controlWidgetToolsDiv.className="ol-wfst--tools-control",this._initAsyncOperations()}_onLoad(){this._map=super.getMap(),this._view=this._map.getView(),this._viewport=this._map.getViewport(),this._isVisible=this._view.getZoom()>this._options.minZoom,this._createLayers(this._options.layers),this._initMapElements(this._options.showControl,this._options.active)}_initAsyncOperations(){return p(this,void 0,void 0,(function*(){try{this.on("allDescribeFeatureTypeLoaded",this._onLoad),this._showLoading(),yield this._connectToGeoServerAndGetCapabilities(),this._options.layers&&(yield this._getGeoserverLayersData(this._options.layers,this._options.geoServerUrl))}catch(e){this._hideLoading(),this._showError(e.message,e)}}))}_connectToGeoServerAndGetCapabilities(){const e=Object.create(null,{dispatchEvent:{get:()=>super.dispatchEvent}});return p(this,void 0,void 0,(function*(){this._geoServerCapabilities=yield(()=>p(this,void 0,void 0,(function*(){const e=new URLSearchParams({service:"wfs",version:this._options.geoServerAdvanced.getCapabilitiesVersion,request:"GetCapabilities",exceptions:"application/json"}),t=this._options.geoServerUrl+"?"+e.toString();try{const e=yield fetch(t,{headers:this._options.headers,credentials:this._options.credentials});if(!e.ok)throw new Error("");const o=yield e.text();return(new window.DOMParser).parseFromString(o,"text/xml")}catch(e){throw new Error(this._i18n.errors.capabilities)}})))();const t=this._geoServerCapabilities.getElementsByTagName("ows:Operation");if(Array.from(t).forEach((e=>{"Transaction"===e.getAttribute("name")?this._hasTransaction=!0:"LockFeature"===e.getAttribute("name")&&(this._hasLockFeature=!0)})),!this._hasTransaction)throw new Error(this._i18n.errors.wfst);e.dispatchEvent.call(this,{type:"getCapabilities",data:this._geoServerCapabilities})}))}_getGeoserverLayersData(e,t){const o=Object.create(null,{dispatchEvent:{get:()=>super.dispatchEvent}});return p(this,void 0,void 0,(function*(){const i=e=>p(this,void 0,void 0,(function*(){const o=new URLSearchParams({service:"wfs",version:this._options.geoServerAdvanced.describeFeatureTypeVersion,request:"DescribeFeatureType",typeName:e,outputFormat:"application/json",exceptions:"application/json"}),i=t+"?"+o.toString(),n=yield fetch(i,{headers:this._options.headers,credentials:this._options.credentials});if(!n.ok)throw new Error("");return yield n.json()}));for(const t of e){const e=t.name,n=t.label||e;try{const t=yield i(e);if(!t)throw new Error("");o.dispatchEvent.call(this,{type:"describeFeatureType",layer:e,data:t});const n=t.targetNamespace,s=t.featureTypes[0].properties,r=s.find((e=>e.type.indexOf("gml:")>=0));this._geoServerData[e]={namespace:n,properties:s,geomType:r.localType,geomField:r.name}}catch(e){throw new Error(`${this._i18n.errors.layer} "${n}"`)}}o.dispatchEvent.call(this,{type:"allDescribeFeatureTypeLoaded",data:this._geoServerData})}))}_createLayers(e){let t=0,o=0;const i=()=>{t++,t>=o&&this._hideLoading()},l=e=>{const t=e.name,o=e.cqlFilter,n=e.tilesBuffer,a={SERVICE:"WMS",LAYERS:t,TILED:!0};o&&(a.CQL_FILTER=o),n&&(a.BUFFER=n);const l=new r.TileWMS({url:this._options.geoServerUrl,params:a,serverType:"geoserver",tileLoadFunction:(e,t)=>p(this,void 0,void 0,(function*(){try{const o=yield fetch(t,{headers:this._options.headers,credentials:this._options.credentials});if(!o.ok)throw new Error("");const i=yield o.blob();if(void 0===i)throw new Error("");e.getImage().src=URL.createObjectURL(i),e.setState(f)}catch(t){e.setState(m)}}))});let c=0,d=0;l.on("tileloadstart",(()=>{c++,this._showLoading()})),l.on(["tileloadend","tileloaderror"],(()=>{d++,setTimeout((()=>{c===d&&i()}),300)}));const h=Object.assign({name:t,type:"_wms_",minZoom:this._options.minZoom,source:l,visible:!0,zIndex:1},e);return new s.Tile(h)},c=e=>{const t=e.name,o=e.cqlFilter,l=e.wfsStrategy||"bbox",c=new r.Vector({format:new n.GeoJSON,strategy:"bbox"===l?a.bbox:a.all,loader:e=>p(this,void 0,void 0,(function*(){try{const i=new URLSearchParams({service:"wfs",version:this._options.geoServerAdvanced.getFeatureVersion,request:"GetFeature",typename:t,outputFormat:"application/json",exceptions:"application/json",srsName:this._options.geoServerAdvanced.projection.toString()});if(o&&i.append("cql_filter",o),"bbox"===l){const t=h.transformExtent(e,this._view.getProjection().getCode(),this._options.geoServerAdvanced.projection);i.append("bbox",t.toString()+`,${this._options.geoServerAdvanced.projection}`)}const n=this._options.geoServerUrl+"?"+i.toString(),s=yield fetch(n,{headers:this._options.headers,credentials:this._options.credentials});if(!s.ok)throw new Error("");const r=yield s.json();this.dispatchEvent({type:"getFeature",layer:t,data:r});const a=c.getFormat().readFeatures(r,{featureProjection:this._view.getProjection().getCode(),dataProjection:this._options.geoServerAdvanced.projection});a.forEach((e=>{e.set("_layerName_",t,!0)})),c.addFeatures(a),c.dispatchEvent("featuresloadend")}catch(t){c.dispatchEvent("featuresloaderror"),this._showError(this._i18n.errors.geoserver,t),c.removeLoadedExtent(e)}}))});let d=0,u=0;c.on("featuresloadstart",(()=>{d++,this._showLoading()})),c.on(["featuresloadend","featuresloaderror"],(()=>{u++,setTimeout((()=>{d===u&&i()}),300)}));const f=Object.assign({name:t,type:"_wfs_",minZoom:this._options.minZoom,source:c,visible:!0,zIndex:2},e);return new s.Vector(f)};for(const t of e){const e=t.name;if(this._geoServerData[e]){let t;const i=this._options.layers.find((t=>t.name===e));i.mode||(i.mode="wfs"),t="wfs"===i.mode?c(i):l(i),t.getVisible()&&o++,this._map.addLayer(t),this._mapLayers[e]=t}}}_initMapElements(e,t){return p(this,void 0,void 0,(function*(){this._createEditLayer(),this._addInteractions(),this._addHandlers(),e&&this._addMapControl(),this.activateEditMode(t)}))}_addInteractions(){const e=()=>{this._collectionModify=new R,this.interactionWfsSelect=new i.Select({hitTolerance:10,style:e=>this._styleFunction(e),toggleCondition:d.never,filter:(e,t)=>!this._isEditModeOn&&t&&"_wfs_"===t.get("type")}),this._map.addInteraction(this.interactionWfsSelect),this.interactionWfsSelect.on("select",(({selected:e,deselected:t,mapBrowserEvent:o})=>{const i=o.coordinate;e.length&&e.forEach((e=>{if(!this._editedFeatures.has(String(e.getId()))){this.interactionWfsSelect.getLayer(e).getSource().removeFeature(e),this._addFeatureToEdit(e,i)}})),t.length&&(this._isEditModeOn||t.forEach((e=>{this._collectionModify.remove(e)})))}))},o=()=>{this.interactionSelectModify=new i.Select({style:e=>this._styleFunction(e),layers:[this._editLayer],toggleCondition:d.never,removeCondition:()=>!!this._isEditModeOn}),this._map.addInteraction(this.interactionSelectModify),this._collectionModify=this.interactionSelectModify.getFeatures();const e=e=>p(this,void 0,void 0,(function*(){for(const t in this._mapLayers){const o=this._mapLayers[t];if(!o.getVisible()||"_wms_"!==o.get("type"))continue;const i=e.coordinate,n=this._view.getZoom()>10?10:5,s=o.getSource(),r=s["getFeatureInfoUrl"in s?"getFeatureInfoUrl":"getGetFeatureInfoUrl"](i,this._view.getResolution(),this._view.getProjection().getCode(),{INFO_FORMAT:"application/json",BUFFER:n,FEATURE_COUNT:1,EXCEPTIONS:"application/json"});try{const e=yield fetch(r,{headers:this._options.headers,credentials:this._options.credentials});if(!e.ok)throw new Error(this._i18n.errors.getFeatures+" "+e.status);const o=yield e.json(),n=this._formatGeoJSON.readFeatures(o);if(!n.length)continue;n.forEach((e=>this._addFeatureToEdit(e,i,t)))}catch(e){this._showError(e.message,e)}}}));this._keyClickWms=this._map.on(this._options.evtType,(t=>p(this,void 0,void 0,(function*(){this._map.hasFeatureAtPixel(t.pixel)||this._isVisible&&(this._isEditModeOn||(yield e(t)))}))))};this._options.layers.find((e=>"wfs"===e.mode))&&e(),this._options.layers.find((e=>"wms"===e.mode))&&o(),this.interactionModify=new i.Modify({style:()=>this._isEditModeOn?new t.Style({image:new t.Circle({radius:6,fill:new t.Fill({color:"#ff0000"}),stroke:new t.Stroke({width:2,color:"rgba(5, 5, 5, 0.9)"})})}):void 0,features:this._collectionModify,condition:e=>d.primaryAction(e)&&this._isEditModeOn}),this._map.addInteraction(this.interactionModify),this.interactionSnap=new i.Snap({source:this._editLayer.getSource()}),this._map.addInteraction(this.interactionSnap)}_createEditLayer(){this._editLayer=new s.Vector({source:new r.Vector,zIndex:100}),this._map.addLayer(this._editLayer)}_addHandlers(){this.interactionModify.on("modifyend",(e=>{const t=e.features.item(0);this._addFeatureToEditedList(t),super.dispatchEvent(e)})),this.interactionModify.on("modifystart",(e=>{super.dispatchEvent(e)})),this._onDeselectFeatureEvent(),this._onRemoveFeatureEvent();const e=()=>{this._currentZoom>this._options.minZoom?this._isVisible||(this._isVisible=!0):this._isVisible&&(this._isVisible=!1)};this._map.on("moveend",(()=>{this._currentZoom=this._view.getZoom(),this._currentZoom!==this._lastZoom&&e(),this._lastZoom=this._currentZoom})),(()=>{document.addEventListener("keydown",(({key:e})=>{if(!document.querySelector("input:focus")&&"Delete"===e){const e=this._collectionModify;e&&e.forEach((e=>{this._deleteFeature(e,!0)}))}}))})()}_addMapControl(){const e=(()=>{const e=()=>{const e=document.createElement("div"),t=document.createElement("label");t.className="ol-wfst--tools-control-btn ol-wfst--tools-control-btn-upload",t.htmlFor="ol-wfst--upload",t.innerHTML="<img src=\"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='512' height='512' viewBox='0 0 512 512'%3e%3cpath d='M240 352h-240v128h480v-128h-240zM448 416h-64v-32h64v32zM112 160l128-128 128 128h-80v160h-96v-160z'%3e%3c/path%3e%3c/svg%3e\"/> ",t.title=this._i18n.labels.uploadToLayer;const o=document.createElement("input");return o.id="ol-wfst--upload",o.type="file",o.accept=this._options.uploadFormats,o.onchange=e=>this._processUploadFile(e),e.append(o),e.append(t),e},t=document.createElement("div");if(t.className="wfst--tools-control--head",this._options.showUpload){const o=e();t.append(o)}const o=(()=>{const e=document.createElement("div");e.className="ol-wfst--tools-control-draw-cnt";const t=document.createElement("button");t.className="ol-wfst--tools-control-btn ol-wfst--tools-control-btn-draw",t.type="button",t.innerHTML="<img src=\"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e %3cpath d='M663 225l-58.5 58.5-120-120 58.5-58.5q9-9 22.5-9t22.5 9l75 75q9 9 9 22.5t-9 22.5zM96 552l354-354 120 120-354 354h-120v-120z'%3e%3c/path%3e%3c/svg%3e\"/>",t.title=this._i18n.labels.addElement,t.onclick=()=>{this._isDrawModeOn?(this._resetStateButtons(),this.activateEditMode()):this.activateDrawMode(this._layerToInsertElements)};const o=document.createElement("select");o.title=this._i18n.labels.selectDrawType,o.className="wfst--tools-control--select-draw",o.onchange=()=>{const e=o.value;this._changeStateSelect(this._layerToInsertElements,e),this._isDrawModeOn&&this.activateDrawMode(this._layerToInsertElements)};const i=[Pe.Point,Pe.MultiPoint,Pe.LineString,Pe.MultiLineString,Pe.Polygon,Pe.MultiPolygon,Pe.Circle];for(const e of i){const t=document.createElement("option");t.value=e,t.text=e,t.selected=this._geoServerData[this._layerToInsertElements].geomType===e||!1,o.appendChild(t)}return e.append(t),e.append(o),this._selectDraw=o,e})();return t.append(o),t})();this._controlWidgetToolsDiv.append(e);const t=(()=>{const e=e=>{const t=e.name,o=`<span title="${this._geoServerData[t].geomType}">${e.label||t}</span>`;return`\n <div class="wfst--layer-control \n ${!("visible"in e)||e.visible?"ol-wfst--visible-on":""}\n ${t===this._layerToInsertElements?"ol-wfst--selected-on":""}\n " data-layer="${t}">\n <div class="ol-wfst--tools-control-visible">\n <span class="ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-on" title="${this._i18n.labels.toggleVisibility}">\n <img src="data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e%3cpath d='M384 288q39 0 67.5 28.5t28.5 67.5-28.5 67.5-67.5 28.5-67.5-28.5-28.5-67.5 28.5-67.5 67.5-28.5zM384 544.5q66 0 113.25-47.25t47.25-113.25-47.25-113.25-113.25-47.25-113.25 47.25-47.25 113.25 47.25 113.25 113.25 47.25zM384 144q118.5 0 214.5 66t138 174q-42 108-138 174t-214.5 66-214.5-66-138-174q42-108 138-174t214.5-66z'%3e%3c/path%3e%3c/svg%3e"/>\n </span>\n <span class="ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-off" title="${this._i18n.labels.toggleVisibility}">\n <img src="data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e%3cpath d='M379.5 288h4.5q39 0 67.5 28.5t28.5 67.5v6zM241.5 313.5q-18 36-18 70.5 0 66 47.25 113.25t113.25 47.25q34.5 0 70.5-18l-49.5-49.5q-12 3-21 3-39 0-67.5-28.5t-28.5-67.5q0-9 3-21zM64.5 136.5l40.5-40.5 567 567-40.5 40.5q-7.5-7.5-47.25-46.5t-60.75-60q-64.5 27-139.5 27-118.5 0-214.5-66t-138-174q16.5-39 51.75-86.25t68.25-72.75q-18-18-50.25-51t-36.75-37.5zM384 223.5q-30 0-58.5 12l-69-69q58.5-22.5 127.5-22.5 118.5 0 213.75 66t137.25 174q-36 88.5-109.5 151.5l-93-93q12-28.5 12-58.5 0-66-47.25-113.25t-113.25-47.25z'%3e%3c/path%3e%3c/svg%3e"/>\n </span>\n </div>\n <label for="wfst--${t}">\n <input value="${t}" id="wfst--${t}" type="radio" class="ol-wfst--tools-control-input" name="wfst--select-layer" ${t===this._layerToInsertElements?'checked="checked"':""}>\n ${o}\n </label>\n </div>`};let t="";Object.keys(this._mapLayers).map((o=>t+=e(this._options.layers.find((e=>e.name===o)))));const o=document.createElement("div");o.className="wfst--tools-control--select-layers",o.innerHTML=t;o.querySelectorAll("input").forEach((e=>{const t=e.closest(".wfst--layer-control");e.onchange=()=>{const i=o.querySelector(".ol-wfst--selected-on");i&&i.classList.remove("ol-wfst--selected-on"),t.classList.add("ol-wfst--selected-on"),this._layerToInsertElements=e.value,this._changeStateSelect(this._layerToInsertElements)}}));return o.querySelectorAll(".ol-wfst--tools-control-visible-btn").forEach((e=>{const t=e.closest(".wfst--layer-control"),o=t.dataset.layer;e.onclick=()=>{t.classList.toggle("ol-wfst--visible-on");const e=this._mapLayers[o];t.classList.contains("ol-wfst--visible-on")?e.setVisible(!0):e.setVisible(!1)}})),o})();this._controlWidgetToolsDiv.append(t)}_showLoading(){this._modalLoading||(this._modalLoading=document.createElement("div"),this._modalLoading.className="ol-wfst--tools-control--loading",this._modalLoading.innerHTML=this._i18n.labels.loading,this._controlWidgetToolsDiv.append(this._modalLoading)),this._modalLoading.classList.add("ol-wfst--tools-control--loading-show")}_hideLoading(){this._modalLoading.classList.remove("ol-wfst--tools-control--loading-show")}_lockFeature(e,t,o=0){return p(this,void 0,void 0,(function*(){const i=new URLSearchParams({service:"wfs",version:this._options.geoServerAdvanced.lockFeatureVersion,request:"LockFeature",expiry:String(5),LockId:"GeoServer",typeName:t,releaseAction:"SOME",exceptions:"application/json",featureid:`${e}`}),n=this._options.geoServerUrl+"?"+i.toString();try{const i=yield fetch(n,{headers:this._options.headers,credentials:this._options.credentials});if(!i.ok)throw new Error(this._i18n.errors.lockFeature);const s=yield i.text();try{const i=JSON.parse(s);if("exceptions"in i){const n=i.exceptions;"CannotLockAllFeatures"===n[0].code?o?this._showError(this._i18n.errors.lockFeature,n):this._lockFeature(e,t,1):this._showError(n[0].text,n)}}catch(e){}return s}catch(e){this._showError(e.message,e)}}))}_showError(e,t=null){ke.alert("Error: "+e,Object.assign({},this._options.modal)).show(),t&&console.error(t)}_transactWFS(t,o,i){return p(this,void 0,void 0,(function*(){const n=(e,t)=>{const o=l.fromCircle(t);e.setGeometry(o)},s=(t,o)=>{let i=o.getGeometries()[0];i instanceof e.Circle&&(i=l.fromCircle(i)),t.setGeometry(i)};o=Array.isArray(o)?o:[o];const r=e=>{this._removeFeatureFromEditList(e);const t=e.getProperties();delete t.boundedBy,delete t._layerName_;const o=new H(t);return o.setId(e.getId()),o},a=[];for(const i of o){let o=r(i);const l=o.getGeometry();l instanceof e.GeometryCollection?s(o,l):l instanceof e.Circle&&n(o,l),"insert"===t&&this._options.beforeInsertFeature&&(o=this._options.beforeInsertFeature(o)),o&&a.push(o)}if(!a.length)return this._showError(this._i18n.errors.noValidGeometry),!1;switch(t){case"insert":this._insertFeatures=[...this._insertFeatures,...a];break;case"update":this._updateFeatures=[...this._updateFeatures,...a];break;case"delete":this._deleteFeatures=[...this._deleteFeatures,...a]}this._countRequests++;const c=this._countRequests;return new Promise(((e,n)=>{setTimeout((()=>p(this,void 0,void 0,(function*(){try{if(c!==this._countRequests)return;let n=this._view.getProjection().getCode();n="EPSG:4326"===n?"urn:x-ogc:def:crs:EPSG:4326":n;const s=this._geoServerData[i];if(!s)throw new Error(this._i18n.errors.layerNotFound);const r={featureNS:s.namespace,featureType:i,srsName:n,featurePrefix:null,nativeElements:null,version:this._options.geoServerAdvanced.wfsTransactionVersion},a=this._formatWFS.writeTransaction(this._insertFeatures,this._updateFeatures,this._deleteFeatures,r);let l=this._xs.serializeToString(a);const d=s.geomType,h=s.geomField;if(d===Pe.GeometryCollection)if("insert"===t)l=l.replace(/<geometry>/g,`<geometry><MultiGeometry xmlns="http://www.opengis.net/gml" srsName="${n}"><geometryMember>`),l=l.replace(/<\/geometry>/g,"</geometryMember></MultiGeometry></geometry>");else if("update"===t){const e=`<MultiGeometry xmlns="http://www.opengis.net/gml" srsName="${n}"><geometryMember>`,t="</geometryMember></MultiGeometry>";l=l.replace(/(.*)(<Name>geometry<\/Name><Value>)(.*?)(<\/Value>)(.*)/g,`$1$2${e}$3${t}$4$5`)}l="insert"===t?l.replace(/<(\/?)\bgeometry\b>/g,`<$1${h}>`):l.replace(/<Name>geometry<\/Name>/g,`<Name>${h}</Name>`),this._hasLockFeature&&this._useLockFeature&&"insert"!==t&&(l=l.replace("</Transaction>","<LockId>GeoServer</LockId></Transaction>"));const u=Object.assign({"Content-Type":"text/xml"},this._options.headers),p=yield fetch(this._options.geoServerUrl,{method:"POST",body:l,headers:u,credentials:this._options.credentials});if(!p.ok)throw new Error(this._i18n.errors.transaction+" "+p.status);const f=this._formatWFS.readTransactionResponse(p);if(!Object.keys(f).length){const e=yield p.text(),t=String(e).match(/<ows:ExceptionText>([\s\S]*?)<\/ows:ExceptionText>/);if(t)throw new Error(t[1])}if("delete"!==t)for(const e of o)this._editLayer.getSource().removeFeature(e);const{mode:m}=this._options.layers.find((e=>e.name===i));"wfs"===m?(e=>{e.getSource().refresh()})(this._mapLayers[i]):"wms"===m&&(e=>{const t=e.getSource();t.refresh();const o=t.getParams();o.t=(new Date).getMilliseconds(),t.updateParams(o)})(this._mapLayers[i]),this._hideLoading(),this._insertFeatures=[],this._updateFeatures=[],this._deleteFeatures=[],this._countRequests=0,e(!0)}catch(e){this._showError(e.message,e),this._hideLoading(),this._countRequests=0,n()}}))),0)}))}))}_addFeatureToEditedList(e){this._editedFeatures.add(String(e.getId()))}_removeFeatureFromEditList(e){this._editedFeatures.delete(String(e.getId()))}_isFeatureEdited(e){return this._editedFeatures.has(String(e.getId()))}_deselectEditFeature(e){this._removeOverlayHelper(e)}_restoreFeatureToLayer(e,t){t=t||e.get("_layerName_");this._mapLayers[t].getSource().addFeature(e)}_removeFeatureFromTmpLayer(e){this._editLayer.getSource().removeFeature(e)}_onDeselectFeatureEvent(){const e=e=>{const t=e.get("_layerName_"),{mode:o}=this._options.layers.find((e=>e.name===t));"wfs"===o&&this.interactionWfsSelect.getFeatures().remove(e),this._isFeatureEdited(e)?this._transactWFS("update",e,t):("wfs"===o&&this._restoreFeatureToLayer(e,t),this._removeFeatureFromTmpLayer(e))};this._keySelect=this._collectionModify.on("remove",(t=>{const o=t.element;this._deselectEditFeature(o),e(o),this._editModeOff()}))}_onRemoveFeatureEvent(){this._keyRemove=this._editLayer.getSource().on("removefeature",(e=>{const t=e.feature;if(!t.get("_delete_"))return;this._keySelect&&u.unByKey(this._keySelect);const o=t.get("_layerName_");this._transactWFS("delete",t,o),this._deselectEditFeature(t),this._editModeOff(),this._keySelect&&setTimeout((()=>{this._onDeselectFeatureEvent()}),150)}))}_styleFunction(o){const i=t=>{let o=t.getGeometry();o instanceof e.GeometryCollection&&(o=o.getGeometries()[0]);const i=o.getCoordinates();let n=null;if(n=o instanceof e.Polygon||o instanceof e.MultiLineString?i.flat(1):o instanceof e.MultiPolygon?i.flat(2):i,n&&n.length)return new e.MultiPoint(n)};let n=o.getGeometry(),s=n.getType();switch(n instanceof e.GeometryCollection&&(n=n.getGeometries()[0],s=n.getType()),s){case Pe.Point:case Pe.MultiPoint:return this._isEditModeOn?[new t.Style({image:new t.Circle({radius:6,fill:new t.Fill({color:"#000000"})})}),new t.Style({image:new t.Circle({radius:4,fill:new t.Fill({color:"#ff0000"})})})]:[new t.Style({image:new t.Circle({radius:5,fill:new t.Fill({color:"#ff0000"})})}),new t.Style({image:new t.Circle({radius:2,fill:new t.Fill({color:"#000000"})})})];default:return this._isEditModeOn||this._isDrawModeOn?[new t.Style({stroke:new t.Stroke({color:"rgba( 255, 0, 0, 1)",width:4}),fill:new t.Fill({color:"rgba(255, 0, 0, 0.7)"})}),new t.Style({image:new t.Circle({radius:4,fill:new t.Fill({color:"#ff0000"}),stroke:new t.Stroke({width:2,color:"rgba(5, 5, 5, 0.9)"})}),geometry:e=>i(e)}),new t.Style({stroke:new t.Stroke({color:"rgba(255, 255, 255, 0.7)",width:2})})]:[new t.Style({image:new t.Circle({radius:2,fill:new t.Fill({color:"#000000"})}),geometry:e=>i(e)}),new t.Style({stroke:new t.Stroke({color:"#ff0000",width:4}),fill:new t.Fill({color:"rgba(255, 0, 0, 0.7)"})})]}}_editModeOn(e){this._editFeatureOriginal=e.clone(),this._isEditModeOn=!0,this._editLayer.getSource().changed(),this._removeOverlayHelper(e);const t=document.createElement("div");t.className="ol-wfst--changes-control";const i=document.createElement("div");i.className="ol-wfst--changes-control-el";const n=document.createElement("div");n.className="ol-wfst--changes-control-id",n.innerHTML=`<b>${this._i18n.labels.editMode}</b> - <i>${String(e.getId())}</i>`;const s=document.createElement("button");s.type="button",s.textContent=this._i18n.labels.apply,s.className="btn btn-sm btn-primary",s.onclick=()=>{this._showLoading(),this._collectionModify.remove(e)};const r=document.createElement("button");r.type="button",r.textContent=this._i18n.labels.cancel,r.className="btn btn-sm btn-secondary",r.onclick=()=>{e.setGeometry(this._editFeatureOriginal.getGeometry()),this._removeFeatureFromEditList(e),this._collectionModify.remove(e)};const a=document.createElement("button");a.type="button",a.textContent=this._i18n.labels.delete,a.className="btn btn-sm btn-danger-outline",a.onclick=()=>{this._deleteFeature(e,!0)},i.append(n),i.append(r),i.append(s),i.append(a),t.append(i),this._controlApplyDiscardChanges=new o.Control({element:t}),this._map.addControl(this._controlApplyDiscardChanges)}_editModeOff(){this._isEditModeOn=!1,this._map.removeControl(this._controlApplyDiscardChanges)}_deleteFeature(e,t){const o=()=>{(Array.isArray(e)?e:[e]).forEach((e=>{e.set("_delete_",!0,!0),this._editLayer.getSource().removeFeature(e)})),this._collectionModify.clear();const t=e.get("_layerName_"),{mode:o}=this._options.layers.find((e=>e.name===t));"wfs"===o&&this.interactionWfsSelect.getFeatures().remove(e)};if(t){ke.confirm(this._i18n.labels.confirmDelete,Object.assign({},this._options.modal)).show().once("dismiss",(function(e,t,i){i&&i.value&&o()}))}else o()}_addFeatureToEdit(e,t=null,o=null){const i=()=>{const o=document.createElement("div");o.className="ol-wfst--edit-button-cnt",o.innerHTML=`<button class="ol-wfst--edit-button" type="button" title="${this._i18n.labels.editFields}"><img src="data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='448' height='448' viewBox='0 0 448 448'%3e %3cpath d='M222 296l29-29-38-38-29 29v14h24v24h14zM332 116c-2.25-2.25-6-2-8.25 0.25l-87.5 87.5c-2.25 2.25-2.5 6-0.25 8.25s6 2 8.25-0.25l87.5-87.5c2.25-2.25 2.5-6 0.25-8.25zM352 264.5v47.5c0 39.75-32.25 72-72 72h-208c-39.75 0-72-32.25-72-72v-208c0-39.75 32.25-72 72-72h208c10 0 20 2 29.25 6.25 2.25 1 4 3.25 4.5 5.75 0.5 2.75-0.25 5.25-2.25 7.25l-12.25 12.25c-2.25 2.25-5.25 3-8 2-3.75-1-7.5-1.5-11.25-1.5h-208c-22 0-40 18-40 40v208c0 22 18 40 40 40h208c22 0 40-18 40-40v-31.5c0-2 0.75-4 2.25-5.5l16-16c2.5-2.5 5.75-3 8.75-1.75s5 4 5 7.25zM328 80l72 72-168 168h-72v-72zM439 113l-23 23-72-72 23-23c9.25-9.25 24.75-9.25 34 0l38 38c9.25 9.25 9.25 24.75 0 34z'%3e%3c/path%3e%3c/svg%3e"/></button>`,o.onclick=()=>{this._initEditFieldsModal(e)};const i=document.createElement("div");i.append(o);const n=document.createElement("div");n.className="ol-wfst--edit-button-cnt",n.innerHTML=`<button class="ol-wfst--edit-button" type="button" title="${this._i18n.labels.editGeom}"><img src="data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='541' height='512' viewBox='0 0 541 512'%3e %3cpath fill='black' d='M103.306 228.483l129.493-125.249c-17.662-4.272-31.226-18.148-34.98-35.663l-0.055-0.307-129.852 125.248c17.812 4.15 31.53 18.061 35.339 35.662l0.056 0.308z'%3e%3c/path%3e %3cpath fill='black' d='M459.052 393.010c-13.486-8.329-22.346-23.018-22.373-39.779v-0.004c-0.053-0.817-0.082-1.772-0.082-2.733s0.030-1.916 0.089-2.863l-0.007 0.13-149.852 71.94c9.598 8.565 15.611 20.969 15.611 34.779 0 0.014 0 0.029 0 0.043v-0.002c-0.048 5.164-0.94 10.104-2.544 14.711l0.098-0.322z'%3e%3c/path%3e %3cpath fill='black' d='M290.207 57.553c-0.009 15.55-7.606 29.324-19.289 37.819l-0.135 0.093 118.054 46.69c-0.216-1.608-0.346-3.48-0.36-5.379v-0.017c0.033-16.948 9.077-31.778 22.596-39.953l0.209-0.118-122.298-48.056c0.659 2.633 1.098 5.693 1.221 8.834l0.002 0.087z'%3e%3c/path%3e %3cpath fill='black' d='M241.36 410.132l-138.629-160.067c-4.734 17.421-18.861 30.61-36.472 33.911l-0.29 0.045 143.881 166.255c1.668-18.735 14.197-34.162 31.183-40.044l0.327-0.099z'%3e%3c/path%3e %3cpath fill='black' d='M243.446 115.105c-31.785 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.785 0 57.552 25.767 57.552 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM243.446 21.582c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.104-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M483.224 410.78c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.552 25.767 57.552 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM483.224 317.257c-19.866 0-35.97 16.104-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M57.553 295.531c-31.785 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.785 0 57.553 25.767 57.553 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM57.553 202.008c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c-0.041-19.835-16.13-35.898-35.97-35.898 0 0 0 0 0 0v0z'%3e%3c/path%3e %3cpath fill='black' d='M256.036 512.072c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.553 25.767 57.553 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM256.036 418.55c-19.866 0-35.97 16.104-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M435.24 194.239c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.553 25.767 57.553 57.553v0c0 31.785-25.767 57.553-57.553 57.553v0zM435.24 100.716c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e%3c/svg%3e"/></button>`,n.onclick=()=>{this._editModeOn(e)},i.append(n);const s=t||c.getCenter(e.getGeometry().getExtent()),r=new de({id:e.getId(),position:s,positioning:"center-center",element:i,offset:[0,-40],stopEvent:!0});this._map.addOverlay(r)};o&&e.set("_layerName_",o);(e?e.getProperties():"")&&e.getGeometry()&&(this._editLayer.getSource().addFeature(e),this._collectionModify.push(e),i(),this._useLockFeature&&this._hasLockFeature&&this._lockFeature(e.getId(),e.get("_layerName_")))}_resetStateButtons(){const e=document.querySelector(".ol-wfst--tools-control-btn.wfst--active");e&&e.classList.remove("wfst--active")}_initUploadFileModal(e,t){const o=`\n <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">\n ${this._i18n.labels.cancel}\n </button>\n <button type="button" class="btn btn-sm btn-primary" data-action="save" data-dismiss="modal">\n ${this._i18n.labels.upload}\n </button>\n `;new ke(Object.assign(Object.assign({},this._options.modal),{header:!0,headerClose:!1,title:this._i18n.labels.uploadFeatures+" "+this._layerToInsertElements,content:e,backdrop:"static",footer:o})).show().on("dismiss",((e,o)=>{"save"===o.target.dataset.action?this._transactWFS("insert",t,this._layerToInsertElements):this._editLayer.getSource().clear()}))}_processUploadFile(t){return p(this,void 0,void 0,(function*(){const o=e=>new Promise(((t,o)=>{const i=new FileReader;i.addEventListener("load",(e=>p(this,void 0,void 0,(function*(){const o=e.target.result;t(o)})))),i.addEventListener("error",(e=>{console.error("Error"+e),o()})),i.readAsText(e)})),i=t=>{const o=this._geoServerData[this._layerToInsertElements].geomType;let i;switch(t.getGeometry().getType()){case"Point":if("MultiPoint"===o){const o=t.getGeometry().getCoordinates();i=new e.MultiPoint([o])}break;case"LineString":if("MultiLineString"===o){const o=t.getGeometry().getCoordinates();i=new e.MultiLineString([o])}break;case"Polygon":if("MultiPolygon"===o){const o=t.getGeometry().getCoordinates();i=new e.MultiPolygon([o])}break;default:i=null}return i?(t.setGeometry(i),t):null},n=e=>{const t=this._geoServerData[this._layerToInsertElements].geomType,o=e.getGeometry().getType();return t===Pe.GeometryCollection||o===t},s=t.target.files[0];let r;if(!s)return;const a=s.name.split(".").pop().toLowerCase();try{if(this._options.processUpload&&(r=this._options.processUpload(s)),!r){const e=yield o(s);"geojson"===a||"json"===a?r=this._formatGeoJSON.readFeatures(e,{featureProjection:this._view.getProjection().getCode()}):"kml"===a?r=this._formatKml.readFeatures(e,{featureProjection:this._view.getProjection().getCode()}):this._showError(this._i18n.errors.badFormat)}}catch(e){this._showError(this._i18n.errors.badFile,e)}let l=0,c=0;const d=[];for(let e of r)n(e)||(e=i(e)),e?(d.push(e),c++):l++;if(c){this._resetStateButtons(),this.activateEditMode();const e=`\n ${this._i18n.labels.validFeatures}: ${c}<br>\n ${l?`${this._i18n.labels.invalidFeatures}: ${l}`:""}\n `;this._editLayer.getSource().addFeatures(d),this._initUploadFileModal(e,d),this._view.fit(this._editLayer.getSource().getExtent(),{size:this._map.getSize(),maxZoom:21,padding:[100,100,100,100]})}else this._showError(this._i18n.errors.noValidGeometry);t.target.value=null}))}_changeStateSelect(e,t=null){const o=(e,t)=>{Array.from(this._selectDraw.options).forEach((o=>{o.selected=o.value===e,o.disabled="all"!==t&&!t.includes(o.value),o.title=o.disabled?this._i18n.labels.geomTypeNotSupported:""}))};let i;if(this._selectDraw){const n=this._geoServerData[e].geomType;t?i=this._selectDraw.value:n===Pe.GeometryCollection?(i=Pe.LineString,o(i,"all")):n===Pe.LinearRing?(i=Pe.LineString,o(i,[Pe.Circle,Pe.LinearRing,Pe.Polygon]),this._selectDraw.value=i):(i=n,o(i,[n]))}return i}activateDrawMode(e){const t=e=>{this.activateEditMode(!1),this.interactionDraw&&this._map.removeInteraction(this.interactionDraw);const t=this._selectDraw.value;this.interactionDraw=new i.Draw({source:this._editLayer.getSource(),type:t,style:e=>this._styleFunction(e)}),this._map.addInteraction(this.interactionDraw),this.interactionDraw.on("drawstart",(e=>{super.dispatchEvent(e)})),this.interactionDraw.on("drawend",(t=>{const o=t.feature;this._transactWFS("insert",o,e),super.dispatchEvent(t)}))};if(this.interactionDraw||e){if(e){if(!this._mapLayers[e].getVisible())return;const o=document.querySelector(".ol-wfst--tools-control-btn-draw");o&&o.classList.add("wfst--active"),this._viewport.classList.add("draw-mode"),t(String(e))}else this._map.removeInteraction(this.interactionDraw),this._viewport.classList.remove("draw-mode");this._isDrawModeOn=!!e}}activateEditMode(e=!0){if(e){const e=document.querySelector(".ol-wfst--tools-control-btn-edit");e&&e.classList.add("wfst--active"),this.activateDrawMode(!1)}else this._collectionModify.clear();this.interactionSelectModify&&this.interactionSelectModify.setActive(e),this.interactionModify.setActive(e),this.interactionWfsSelect&&this.interactionWfsSelect.setActive(e)}insertFeaturesTo(e,t){return p(this,void 0,void 0,(function*(){return yield this._transactWFS("insert",t,e)}))}_initEditFieldsModal(e){this._editFeature=e;const t=e.getProperties(),o=e.get("_layerName_"),i=this._geoServerData[o].properties;let n='<form autocomplete="false">';Object.keys(t).forEach((e=>{const o=i.find((t=>t.name===e));if(o){let i;switch(o.type){case"xsd:string":i="text";break;case"xsd:number":case"xsd:int":i="number";break;case"xsd:date-time":i="datetime";break;default:i="text"}i&&(n+=`\n <div class="ol-wfst--input-field-container">\n <label class="ol-wfst--input-field-label" for="${e}">${e}</label>\n <input placeholder="NULL" class="ol-wfst--input-field-input" type="${i}" name="${e}" value="${t[e]||""}">\n </div>`)}})),n+="</form>";const s=`\n <button type="button" class="btn btn-sm btn-link btn-third" data-action="delete" data-dismiss="modal">\n ${this._i18n.labels.delete}\n </button>\n <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">\n ${this._i18n.labels.cancel}\n </button>\n <button type="button" class="btn btn-sm btn-primary" data-action="save" data-dismiss="modal">\n ${this._i18n.labels.save}\n </button>\n `;new ke(Object.assign(Object.assign({},this._options.modal),{header:!0,headerClose:!0,title:`${this._i18n.labels.editElement} ${this._editFeature.getId()} `,content:n,footer:s})).show().on("dismiss",((e,t)=>{if("save"===t.target.dataset.action){e.el.querySelectorAll("input").forEach((e=>{const t=e.value,o=e.name;this._editFeature.set(o,t,!0)})),this._editFeature.changed(),this._addFeatureToEditedList(this._editFeature),this._collectionModify.remove(this._editFeature)}else"delete"===t.target.dataset.action&&this._deleteFeature(this._editFeature,!0)}))}_removeOverlayHelper(e){const t=e.getId();if(!t)return;const o=this._map.getOverlayById(t);o&&this._map.removeOverlay(o)}}const Ne=(e,...t)=>(t.forEach((t=>{Object.keys(t).forEach((o=>{const i=t[o],n=e[o];e[o]=n&&i&&"object"==typeof n&&"object"==typeof i&&!Array.isArray(n)?Ne(n,i):i}))})),e);return Ge}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("ol/style"),require("ol/control"),require("ol/interaction"),require("ol/events/Event"),require("ol/events/condition"),require("ol/Observable"),require("ol/layer/Vector"),require("ol/layer/Base"),require("ol/format/GeoJSON"),require("ol/source/Vector"),require("ol/proj"),require("ol/loadingstrategy"),require("ol/Object"),require("ol/layer/Tile"),require("ol/format"),require("ol/source/TileWMS"),require("ol/geom"),require("ol/geom/Polygon"),require("ol/extent")):"function"==typeof define&&define.amd?define(["ol/style","ol/control","ol/interaction","ol/events/Event","ol/events/condition","ol/Observable","ol/layer/Vector","ol/layer/Base","ol/format/GeoJSON","ol/source/Vector","ol/proj","ol/loadingstrategy","ol/Object","ol/layer/Tile","ol/format","ol/source/TileWMS","ol/geom","ol/geom/Polygon","ol/extent"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Wfst=t(e.ol.style,e.ol.control,e.ol.interaction,e.ol.events.Event,e.ol.events.condition,e.ol.Observable,e.ol.layer.Vector,e.ol.layer.Base,e.ol.format.GeoJSON,e.ol.source.Vector,e.ol.proj,e.ol.loadingstrategy,e.ol.Object,e.ol.layer.Tile,e.ol.format,e.ol.source.TileWMS,e.ol.geom,e.ol.geom.Polygon,e.ol.extent)}(this,(function(e,t,s,o,n,r,i,a,l,c,d,h,u,p,m,f,g,y,v){"use strict";function _(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var b=_(o),w=_(i),E=_(a),S=_(l),F=_(c),C=_(u),L=_(p),T=_(f);const M={1:"The view center is not defined",2:"The view resolution is not defined",3:"The view rotation is not defined",4:"`image` and `src` cannot be provided at the same time",5:"`imgSize` must be set when `image` is provided",7:"`format` must be set when `url` is set",8:"Unknown `serverType` configured",9:"`url` must be configured or set using `#setUrl()`",10:"The default `geometryFunction` can only handle `Point` geometries",11:"`options.featureTypes` must be an Array",12:"`options.geometryName` must also be provided when `options.bbox` is set",13:"Invalid corner",14:"Invalid color",15:"Tried to get a value for a key that does not exist in the cache",16:"Tried to set a value for a key that is used already",17:"`resolutions` must be sorted in descending order",18:"Either `origin` or `origins` must be configured, never both",19:"Number of `tileSizes` and `resolutions` must be equal",20:"Number of `origins` and `resolutions` must be equal",22:"Either `tileSize` or `tileSizes` must be configured, never both",24:"Invalid extent or geometry provided as `geometry`",25:"Cannot fit empty extent provided as `geometry`",26:"Features must have an id set",27:"Features must have an id set",28:'`renderMode` must be `"hybrid"` or `"vector"`',30:"The passed `feature` was already added to the source",31:"Tried to enqueue an `element` that was already added to the queue",32:"Transformation matrix cannot be inverted",33:"Invalid units",34:"Invalid geometry layout",36:"Unknown SRS type",37:"Unknown geometry type found",38:"`styleMapValue` has an unknown type",39:"Unknown geometry type",40:"Expected `feature` to have a geometry",41:"Expected an `ol/style/Style` or an array of `ol/style/Style.js`",42:"Question unknown, the answer is 42",43:"Expected `layers` to be an array or a `Collection`",47:"Expected `controls` to be an array or an `ol/Collection`",48:"Expected `interactions` to be an array or an `ol/Collection`",49:"Expected `overlays` to be an array or an `ol/Collection`",50:"`options.featureTypes` should be an Array",51:"Either `url` or `tileJSON` options must be provided",52:"Unknown `serverType` configured",53:"Unknown `tierSizeCalculation` configured",55:"The {-y} placeholder requires a tile grid with extent",56:"mapBrowserEvent must originate from a pointer event",57:"At least 2 conditions are required",59:"Invalid command found in the PBF",60:"Missing or invalid `size`",61:"Cannot determine IIIF Image API version from provided image information JSON",62:"A `WebGLArrayBuffer` must either be of type `ELEMENT_ARRAY_BUFFER` or `ARRAY_BUFFER`",64:"Layer opacity must be a number",66:"`forEachFeatureAtCoordinate` cannot be used on a WebGL layer if the hit detection logic has not been enabled. This is done by providing adequate shaders using the `hitVertexShader` and `hitFragmentShader` properties of `WebGLPointsLayerRenderer`",67:"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both",68:"A VectorTile source can only be rendered if it has a projection compatible with the view projection"};class k extends Error{constructor(e){const t=M[e];super(t),this.code=e,this.name="AssertionError",this.message=t}}var P=k;var A=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},x="propertychange";var I=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function N(){}function O(e){for(const t in e)delete e[t]}var R=class extends I{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;const s=this.listeners_||(this.listeners_={}),o=s[e]||(s[e]=[]);o.includes(t)||o.push(t)}dispatchEvent(e){const t="string"==typeof e,s=t?e:e.type,o=this.listeners_&&this.listeners_[s];if(!o)return;const n=t?new A(e):e;n.target||(n.target=this.eventTarget_||this);const r=this.dispatching_||(this.dispatching_={}),i=this.pendingRemovals_||(this.pendingRemovals_={});let a;s in r||(r[s]=0,i[s]=0),++r[s];for(let e=0,t=o.length;e<t;++e)if(a="handleEvent"in o[e]?o[e].handleEvent(n):o[e].call(this,n),!1===a||n.propagationStopped){a=!1;break}if(0==--r[s]){let e=i[s];for(delete i[s];e--;)this.removeEventListener(s,N);delete r[s]}return a}disposeInternal(){this.listeners_&&O(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return!!this.listeners_&&(e?e in this.listeners_:Object.keys(this.listeners_).length>0)}removeEventListener(e,t){const s=this.listeners_&&this.listeners_[e];if(s){const o=s.indexOf(t);-1!==o&&(this.pendingRemovals_&&e in this.pendingRemovals_?(s[o]=N,++this.pendingRemovals_[e]):(s.splice(o,1),0===s.length&&delete this.listeners_[e]))}}},G="change";function D(e,t,s,o,n){if(o&&o!==e&&(s=s.bind(o)),n){const o=s;s=function(){e.removeEventListener(t,s),o.apply(this,arguments)}}const r={target:e,type:t,listener:s};return e.addEventListener(t,s),r}function U(e,t,s,o){return D(e,t,s,o,!0)}function V(e){e&&e.target&&(e.target.removeEventListener(e.type,e.listener),O(e))}class q extends R{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(G)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){const s=e.length,o=new Array(s);for(let n=0;n<s;++n)o[n]=D(this,e[n],t);return o}return D(this,e,t)}onceInternal(e,t){let s;if(Array.isArray(e)){const o=e.length;s=new Array(o);for(let n=0;n<o;++n)s[n]=U(this,e[n],t)}else s=U(this,e,t);return t.ol_key=s,s}unInternal(e,t){const s=t.ol_key;if(s)!function(e){if(Array.isArray(e))for(let t=0,s=e.length;t<s;++t)V(e[t]);else V(e)}(s);else if(Array.isArray(e))for(let s=0,o=e.length;s<o;++s)this.removeEventListener(e[s],t);else this.removeEventListener(e,t)}}q.prototype.on,q.prototype.once,q.prototype.un;var j=q;let B=0;class z extends A{constructor(e,t,s){super(e),this.key=t,this.oldValue=s}}var H=class extends j{constructor(e){var t;super(),this.on,this.once,this.un,(t=this).ol_uid||(t.ol_uid=String(++B)),this.values_=null,void 0!==e&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}hasProperties(){return!!this.values_}notify(e,t){let s;s=`change:${e}`,this.hasListener(s)&&this.dispatchEvent(new z(s,e,t)),s=x,this.hasListener(s)&&this.dispatchEvent(new z(s,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,s){const o=this.values_||(this.values_={});if(s)o[e]=t;else{const s=o[e];o[e]=t,s!==t&&this.notify(e,s)}}setProperties(e,t){for(const s in e)this.set(s,e[s],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){const s=this.values_[e];delete this.values_[e],function(e){let t;for(t in e)return!1;return!t}(this.values_)&&(this.values_=null),t||this.notify(e,s)}}},$="add",W="remove";const K="length";class Z extends A{constructor(e,t,s){super(e),this.element=t,this.index=s}}var J=class extends H{constructor(e,t){if(super(),this.on,this.once,this.un,t=t||{},this.unique_=!!t.unique,this.array_=e||[],this.unique_)for(let e=0,t=this.array_.length;e<t;++e)this.assertUnique_(this.array_[e],e);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,s=e.length;t<s;++t)this.push(e[t]);return this}forEach(e){const t=this.array_;for(let s=0,o=t.length;s<o;++s)e(t[s],s,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(K)}insertAt(e,t){if(e<0||e>this.getLength())throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new Z($,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){this.unique_&&this.assertUnique_(e);const t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){const t=this.array_;for(let s=0,o=t.length;s<o;++s)if(t[s]===e)return this.removeAt(s)}removeAt(e){if(e<0||e>=this.getLength())return;const t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Z(W,t,e)),t}setAt(e,t){if(e>=this.getLength())return void this.insertAt(e,t);if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);const s=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Z(W,s,e)),this.dispatchEvent(new Z($,t,e))}updateLength_(){this.set(K,this.array_.length)}assertUnique_(e,t){for(let s=0,o=this.array_.length;s<o;++s)if(this.array_[s]===e&&s!==t)throw new P(58)}};class Y extends H{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if("function"==typeof e.getSimplifiedGeometry){const t=e;this.setGeometry(t)}else{const t=e;this.setProperties(t)}}clone(){const e=new Y(this.hasProperties()?this.getProperties():null);e.setGeometryName(this.getGeometryName());const t=this.getGeometry();t&&e.setGeometry(t.clone());const s=this.getStyle();return s&&e.setStyle(s),e}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(V(this.geometryChangeKey_),this.geometryChangeKey_=null);const e=this.getGeometry();e&&(this.geometryChangeKey_=D(e,G,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?function(e){if("function"==typeof e)return e;{let t;if(Array.isArray(e))t=e;else{!function(e,t){if(!e)throw new P(t)}("function"==typeof e.getZIndex,41);t=[e]}return function(){return t}}}(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}}var X=Y;function Q(e){let t=e.offsetWidth;const s=getComputedStyle(e);return t+=parseInt(s.marginLeft,10)+parseInt(s.marginRight,10),t}function ee(e){let t=e.offsetHeight;const s=getComputedStyle(e);return t+=parseInt(s.marginTop,10)+parseInt(s.marginBottom,10),t}function te(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function se(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(s){var o=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,o.get?o:{enumerable:!0,get:function(){return e[s]}})})),t}var oe=2,ne=3,re="postrender";const ie="element",ae="map",le="offset",ce="position",de="positioning";var he=class extends H{constructor(e){super(),this.on,this.once,this.un,this.options=e,this.id=e.id,this.insertFirst=void 0===e.insertFirst||e.insertFirst,this.stopEvent=void 0===e.stopEvent||e.stopEvent,this.element=document.createElement("div"),this.element.className=void 0!==e.className?e.className:"ol-overlay-container ol-selectable",this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=!0===e.autoPan?{}:e.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(ie,this.handleElementChanged),this.addChangeListener(ae,this.handleMapChanged),this.addChangeListener(le,this.handleOffsetChanged),this.addChangeListener(ce,this.handlePositionChanged),this.addChangeListener(de,this.handlePositioningChanged),void 0!==e.element&&this.setElement(e.element),this.setOffset(void 0!==e.offset?e.offset:[0,0]),this.setPositioning(e.positioning||"top-left"),void 0!==e.position&&this.setPosition(e.position)}getElement(){return this.get(ie)}getId(){return this.id}getMap(){return this.get(ae)||null}getOffset(){return this.get(le)}getPosition(){return this.get(ce)}getPositioning(){return this.get(de)}handleElementChanged(){!function(e){for(;e.lastChild;)e.removeChild(e.lastChild)}(this.element);const e=this.getElement();e&&this.element.appendChild(e)}handleMapChanged(){var e;this.mapPostrenderListenerKey&&((e=this.element)&&e.parentNode&&e.parentNode.removeChild(e),V(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=D(t,re,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(e){this.set(ie,e)}setMap(e){this.set(ae,e)}setOffset(e){this.set(le,e)}setPosition(e){this.set(ce,e)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(e){const t=this.getMap();if(!t||!t.getTargetElement()||!this.get(ce))return;const s=this.getRect(t.getTargetElement(),t.getSize()),o=this.getElement(),n=this.getRect(o,[Q(o),ee(o)]),r=void 0===(e=e||{}).margin?20:e.margin;if(a=n,!((i=s)[0]<=a[0]&&a[2]<=i[2]&&i[1]<=a[1]&&a[3]<=i[3])){const o=n[0]-s[0],i=s[2]-n[2],a=n[1]-s[1],l=s[3]-n[3],c=[0,0];if(o<0?c[0]=o-r:i<0&&(c[0]=Math.abs(i)+r),a<0?c[1]=a-r:l<0&&(c[1]=Math.abs(l)+r),0!==c[0]||0!==c[1]){const s=t.getView().getCenterInternal(),o=t.getPixelFromCoordinateInternal(s);if(!o)return;const n=[o[0]+c[0],o[1]+c[1]],r=e.animation||{};t.getView().animateInternal({center:t.getCoordinateFromPixelInternal(n),duration:r.duration,easing:r.easing})}}var i,a}getRect(e,t){const s=e.getBoundingClientRect(),o=s.left+window.pageXOffset,n=s.top+window.pageYOffset;return[o,n,o+t[0],n+t[1]]}setPositioning(e){this.set(de,e)}setVisible(e){this.rendered.visible!==e&&(this.element.style.display=e?"":"none",this.rendered.visible=e)}updatePixelPosition(){const e=this.getMap(),t=this.getPosition();if(!e||!e.isRendered()||!t)return void this.setVisible(!1);const s=e.getPixelFromCoordinate(t),o=e.getSize();this.updateRenderedPosition(s,o)}updateRenderedPosition(e,t){const s=this.element.style,o=this.getOffset(),n=this.getPositioning();this.setVisible(!0);let r="0%",i="0%";"bottom-right"==n||"center-right"==n||"top-right"==n?r="-100%":"bottom-center"!=n&&"center-center"!=n&&"top-center"!=n||(r="-50%"),"bottom-left"==n||"bottom-center"==n||"bottom-right"==n?i="-100%":"center-left"!=n&&"center-center"!=n&&"center-right"!=n||(i="-50%");const a=`translate(${r}, ${i}) translate(${Math.round(e[0]+o[0])+"px"}, ${Math.round(e[1]+o[1])+"px"})`;this.rendered.transform_!=a&&(this.rendered.transform_=a,s.transform=a)}getOptions(){return this.options}};function ue(){}function pe(){pe.init.call(this)}function me(e){return void 0===e._maxListeners?pe.defaultMaxListeners:e._maxListeners}function fe(e,t,s){if(t)e.call(s);else for(var o=e.length,n=Se(e,o),r=0;r<o;++r)n[r].call(s)}function ge(e,t,s,o){if(t)e.call(s,o);else for(var n=e.length,r=Se(e,n),i=0;i<n;++i)r[i].call(s,o)}function ye(e,t,s,o,n){if(t)e.call(s,o,n);else for(var r=e.length,i=Se(e,r),a=0;a<r;++a)i[a].call(s,o,n)}function ve(e,t,s,o,n,r){if(t)e.call(s,o,n,r);else for(var i=e.length,a=Se(e,i),l=0;l<i;++l)a[l].call(s,o,n,r)}function _e(e,t,s,o){if(t)e.apply(s,o);else for(var n=e.length,r=Se(e,n),i=0;i<n;++i)r[i].apply(s,o)}function be(e,t,s,o){var n,r,i,a;if("function"!=typeof s)throw new TypeError('"listener" argument must be a function');if((r=e._events)?(r.newListener&&(e.emit("newListener",t,s.listener?s.listener:s),r=e._events),i=r[t]):(r=e._events=new ue,e._eventsCount=0),i){if("function"==typeof i?i=r[t]=o?[s,i]:[i,s]:o?i.unshift(s):i.push(s),!i.warned&&(n=me(e))&&n>0&&i.length>n){i.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=i.length,a=l,"function"==typeof console.warn?console.warn(a):console.log(a)}}else i=r[t]=s,++e._eventsCount;return e}function we(e,t,s){var o=!1;function n(){e.removeListener(t,n),o||(o=!0,s.apply(e,arguments))}return n.listener=s,n}function Ee(e){var t=this._events;if(t){var s=t[e];if("function"==typeof s)return 1;if(s)return s.length}return 0}function Se(e,t){for(var s=new Array(t);t--;)s[t]=e[t];return s}ue.prototype=Object.create(null),pe.EventEmitter=pe,pe.usingDomains=!1,pe.prototype.domain=void 0,pe.prototype._events=void 0,pe.prototype._maxListeners=void 0,pe.defaultMaxListeners=10,pe.init=function(){this.domain=null,pe.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new ue,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},pe.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},pe.prototype.getMaxListeners=function(){return me(this)},pe.prototype.emit=function(e){var t,s,o,n,r,i,a,l="error"===e;if(i=this._events)l=l&&null==i.error;else if(!l)return!1;if(a=this.domain,l){if(t=arguments[1],!a){if(t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(s=i[e]))return!1;var d="function"==typeof s;switch(o=arguments.length){case 1:fe(s,d,this);break;case 2:ge(s,d,this,arguments[1]);break;case 3:ye(s,d,this,arguments[1],arguments[2]);break;case 4:ve(s,d,this,arguments[1],arguments[2],arguments[3]);break;default:for(n=new Array(o-1),r=1;r<o;r++)n[r-1]=arguments[r];_e(s,d,this,n)}return!0},pe.prototype.addListener=function(e,t){return be(this,e,t,!1)},pe.prototype.on=pe.prototype.addListener,pe.prototype.prependListener=function(e,t){return be(this,e,t,!0)},pe.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,we(this,e,t)),this},pe.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,we(this,e,t)),this},pe.prototype.removeListener=function(e,t){var s,o,n,r,i;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(o=this._events))return this;if(!(s=o[e]))return this;if(s===t||s.listener&&s.listener===t)0==--this._eventsCount?this._events=new ue:(delete o[e],o.removeListener&&this.emit("removeListener",e,s.listener||t));else if("function"!=typeof s){for(n=-1,r=s.length;r-- >0;)if(s[r]===t||s[r].listener&&s[r].listener===t){i=s[r].listener,n=r;break}if(n<0)return this;if(1===s.length){if(s[0]=void 0,0==--this._eventsCount)return this._events=new ue,this;delete o[e]}else!function(e,t){for(var s=t,o=s+1,n=e.length;o<n;s+=1,o+=1)e[s]=e[o];e.pop()}(s,n);o.removeListener&&this.emit("removeListener",e,i||t)}return this},pe.prototype.off=function(e,t){return this.removeListener(e,t)},pe.prototype.removeAllListeners=function(e){var t,s;if(!(s=this._events))return this;if(!s.removeListener)return 0===arguments.length?(this._events=new ue,this._eventsCount=0):s[e]&&(0==--this._eventsCount?this._events=new ue:delete s[e]),this;if(0===arguments.length){for(var o,n=Object.keys(s),r=0;r<n.length;++r)"removeListener"!==(o=n[r])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=new ue,this._eventsCount=0,this}if("function"==typeof(t=s[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},pe.prototype.listeners=function(e){var t,s=this._events;return s&&(t=s[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),s=0;s<t.length;++s)t[s]=e[s].listener||e[s];return t}(t):[]},pe.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Ee.call(e,t)},pe.prototype.listenerCount=Ee,pe.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};var Fe=se(Object.freeze({__proto__:null,default:pe,EventEmitter:pe})),Ce=function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e){e.exports=function(e){var t={};function s(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,s),n.l=!0,n.exports}return s.m=e,s.c=t,s.d=function(e,t,o){s.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=0)}([function(e,t,s){e.exports=s(1).default},function(e,t,s){Object.defineProperty(t,"__esModule",{value:!0});var o,n=function(){function e(e,t){for(var s=0;s<t.length;s++){var o=t[s];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,s,o){return s&&e(t.prototype,s),o&&e(t,o),t}}(),r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[o])}return e},i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=s(2),l=(o=a)&&o.__esModule?o:{default:o};function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var h=null,u=Object.freeze({el:null,animate:!0,animateClass:"fade",animateInClass:"show",appendTo:"body",backdrop:!0,keyboard:!0,title:!1,header:!0,content:!1,footer:!0,buttons:null,headerClose:!0,construct:!1,transition:300,backdropTransition:150}),p=function e(t){for(var s in t)Array.isArray(t[s])?t[s].forEach((function(t){e(t)})):null!==t[s]&&"object"===i(t[s])&&Object.freeze(t[s]);return Object.freeze(t)}({dialog:[{text:"Cancel",value:!1,attr:{class:"btn btn-default","data-dismiss":"modal"}},{text:"OK",value:!0,attr:{class:"btn btn-primary","data-dismiss":"modal"}}],alert:[{text:"OK",attr:{class:"btn btn-primary","data-dismiss":"modal"}}],confirm:[{text:"Cancel",value:!1,attr:{class:"btn btn-default","data-dismiss":"modal"}},{text:"OK",value:!0,attr:{class:"btn btn-primary","data-dismiss":"modal"}}]}),m={container:'<div class="modal"></div>',dialog:'<div class="modal-dialog"></div>',content:'<div class="modal-content"></div>',header:'<div class="modal-header"></div>',headerClose:'<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>',body:'<div class="modal-body"></div>',footer:'<div class="modal-footer"></div>',backdrop:'<div class="modal-backdrop"></div>'};function f(){return(65536*(1+Math.random())|0).toString(16)+(65536*(1+Math.random())|0).toString(16)}function g(e,t,s){var o=e.data||{};if(void 0===s){if(e.data&&e.data[t])return e.data[t];var n=e.getAttribute("data-"+t);return void 0!==n?n:null}return o[t]=s,e.data=o,e}function y(e,t){return e.nodeName?e:(e=e.replace(/(\t|\n$)/g,""),h||(h=document.createElement("div")),h.innerHTML="",h.innerHTML=e,!0===t?h.childNodes:h.childNodes[0])}function v(){var e,t,s=void 0,o=document.createElement("div");return r(o.style,{visibility:"hidden",width:"100px"}),document.body.appendChild(o),t=o.offsetWidth,o.style.overflow="scroll",(s=document.createElement("div")).style.width="100%",o.appendChild(s),e=t-s.offsetWidth,document.body.removeChild(o),e}function _(e){for(var t=[e];e.parentNode;)e=e.parentNode,t.push(e);return t}var b=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c(this,t);var s=d(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(s.id=f(),s.el=null,s._html={},s._events={},s._visible=!1,s._pointerInContent=!1,s._options=r({},t.options,e),s._templates=r({},t.templates,e.templates||{}),s._html.appendTo=document.querySelector(s._options.appendTo),s._scrollbarWidth=v(),null===s._options.buttons&&(s._options.buttons=t.buttons.dialog),s._options.el){var o=s._options.el;if("string"==typeof s._options.el&&!(o=document.querySelector(s._options.el)))throw new Error("Selector: DOM Element "+s._options.el+" not found.");g(o,"modal",s),s.el=o}else s._options.construct=!0;return s._options.construct?s._render():s._mapDom(),s}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,null,[{key:"alert",value:function(e){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r({},u,{title:e,content:!1,construct:!0,headerClose:!1,buttons:t.buttons.alert},s);return new t(o)}},{key:"confirm",value:function(e){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r({},u,{title:e,content:!1,construct:!0,headerClose:!1,buttons:t.buttons.confirm},s);return new t(o)}},{key:"templates",set:function(e){this._baseTemplates=e},get:function(){return r({},m,t._baseTemplates||{})}},{key:"buttons",set:function(e){this._baseButtons=e},get:function(){return r({},p,t._baseButtons||{})}},{key:"options",set:function(e){this._baseOptions=e},get:function(){return r({},u,t._baseOptions||{})}},{key:"version",get:function(){return"0.12.0"}}]),n(t,[{key:"_render",value:function(){var e=this._html,t=this._options,s=this._templates,o=!!t.animate&&t.animateClass;return e.container=y(s.container),e.dialog=y(s.dialog),e.content=y(s.content),e.header=y(s.header),e.headerClose=y(s.headerClose),e.body=y(s.body),e.footer=y(s.footer),o&&e.container.classList.add(o),this._setHeader(),this._setContent(),this._setFooter(),this.el=e.container,e.dialog.appendChild(e.content),e.container.appendChild(e.dialog),this}},{key:"_mapDom",value:function(){var e=this._html,t=this._options;return this.el.classList.contains(t.animateClass)&&(t.animate=!0),e.container=this.el,e.dialog=this.el.querySelector(".modal-dialog"),e.content=this.el.querySelector(".modal-content"),e.header=this.el.querySelector(".modal-header"),e.headerClose=this.el.querySelector(".modal-header .close"),e.body=this.el.querySelector(".modal-body"),e.footer=this.el.querySelector(".modal-footer"),this._setHeader(),this._setContent(),this._setFooter(),this}},{key:"_setHeader",value:function(){var e=this._html,t=this._options;t.header&&e.header&&(t.title.nodeName?e.header.innerHTML=t.title.outerHTML:"string"==typeof t.title&&(e.header.innerHTML='<h4 class="modal-title">'+t.title+"</h4>"),null===this.el&&e.headerClose&&t.headerClose&&e.header.appendChild(e.headerClose),t.construct&&e.content.appendChild(e.header))}},{key:"_setContent",value:function(){var e=this._html,t=this._options;t.content&&e.body&&("string"==typeof t.content?e.body.innerHTML=t.content:e.body.innerHTML=t.content.outerHTML,t.construct&&e.content.appendChild(e.body))}},{key:"_setFooter",value:function(){var e=this._html,t=this._options;t.footer&&e.footer&&(t.footer.nodeName?e.footer.ineerHTML=t.footer.outerHTML:"string"==typeof t.footer?e.footer.innerHTML=t.footer:e.footer.children.length||t.buttons.forEach((function(t){var s=document.createElement("button");for(var o in g(s,"button",t),s.innerHTML=t.text,s.setAttribute("type","button"),t.attr)s.setAttribute(o,t.attr[o]);e.footer.appendChild(s)})),t.construct&&e.content.appendChild(e.footer))}},{key:"_setEvents",value:function(){this._options;var e=this._html;this._events.keydownHandler=this._handleKeydownEvent.bind(this),document.body.addEventListener("keydown",this._events.keydownHandler),this._events.mousedownHandler=this._handleMousedownEvent.bind(this),e.container.addEventListener("mousedown",this._events.mousedownHandler),this._events.clickHandler=this._handleClickEvent.bind(this),e.container.addEventListener("click",this._events.clickHandler),this._events.resizeHandler=this._handleResizeEvent.bind(this),window.addEventListener("resize",this._events.resizeHandler)}},{key:"_handleMousedownEvent",value:function(e){var t=this;this._pointerInContent=!1,_(e.target).every((function(e){return!e.classList||!e.classList.contains("modal-content")||(t._pointerInContent=!0,!1)}))}},{key:"_handleClickEvent",value:function(e){var t=this;_(e.target).every((function(s){return"HTML"!==s.tagName&&((!0===t._options.backdrop||!s.classList.contains("modal"))&&(!s.classList.contains("modal-content")&&("modal"===s.getAttribute("data-dismiss")?(t.emit("dismiss",t,e,g(e.target,"button")),t.hide(),!1):!(!t._pointerInContent&&s.classList.contains("modal"))||(t.emit("dismiss",t,e,null),t.hide(),!1))))})),this._pointerInContent=!1}},{key:"_handleKeydownEvent",value:function(e){27===e.which&&this._options.keyboard&&(this.emit("dismiss",this,e,null),this.hide())}},{key:"_handleResizeEvent",value:function(e){this._resize()}},{key:"show",value:function(){var e=this,t=this._options,s=this._html;return this.emit("show",this),this._checkScrollbar(),this._setScrollbar(),document.body.classList.add("modal-open"),t.construct&&s.appendTo.appendChild(s.container),s.container.style.display="block",s.container.scrollTop=0,!1!==t.backdrop?(this.once("showBackdrop",(function(){e._setEvents(),t.animate&&s.container.offsetWidth,s.container.classList.add(t.animateInClass),setTimeout((function(){e._visible=!0,e.emit("shown",e)}),t.transition)})),this._backdrop()):(this._setEvents(),t.animate&&s.container.offsetWidth,s.container.classList.add(t.animateInClass),setTimeout((function(){e._visible=!0,e.emit("shown",e)}),t.transition)),this._resize(),this}},{key:"toggle",value:function(){this._visible?this.hide():this.show()}},{key:"_resize",value:function(){var e=this._html.container.scrollHeight>document.documentElement.clientHeight;this._html.container.style.paddingLeft=!this.bodyIsOverflowing&&e?this._scrollbarWidth+"px":"",this._html.container.style.paddingRight=this.bodyIsOverflowing&&!e?this._scrollbarWidth+"px":""}},{key:"_backdrop",value:function(){var e=this,t=this._html,s=this._templates,o=this._options,n=!!o.animate&&o.animateClass;t.backdrop=y(s.backdrop),n&&t.backdrop.classList.add(n),t.appendTo.appendChild(t.backdrop),n&&t.backdrop.offsetWidth,t.backdrop.classList.add(o.animateInClass),setTimeout((function(){e.emit("showBackdrop",e)}),this._options.backdropTransition)}},{key:"hide",value:function(){var e=this,t=this._html,s=this._options,o=t.container.classList;(this.emit("hide",this),o.remove(s.animateInClass),s.backdrop)&&t.backdrop.classList.remove(s.animateInClass);return this._removeEvents(),setTimeout((function(){document.body.classList.remove("modal-open"),document.body.style.paddingRight=e.originalBodyPad}),s.backdropTransition),setTimeout((function(){s.backdrop&&t.backdrop.parentNode.removeChild(t.backdrop),t.container.style.display="none",s.construct&&t.container.parentNode.removeChild(t.container),e._visible=!1,e.emit("hidden",e)}),s.transition),this}},{key:"_removeEvents",value:function(){this._events.keydownHandler&&document.body.removeEventListener("keydown",this._events.keydownHandler),this._html.container.removeEventListener("mousedown",this._events.mousedownHandler),this._html.container.removeEventListener("click",this._events.clickHandler),window.removeEventListener("resize",this._events.resizeHandler)}},{key:"_checkScrollbar",value:function(){this.bodyIsOverflowing=document.body.clientWidth<window.innerWidth}},{key:"_setScrollbar",value:function(){if(this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing){var e=parseInt(this.originalBodyPad||0,10);document.body.style.paddingRight=e+this._scrollbarWidth+"px"}}}]),t}(l.default);t.default=b},function(e,t){e.exports=Fe}])})),Le=te(Ce);let Te={};const Me=new Set,ke=e=>"exceptions"in e?e.exceptions.map((e=>e.text)).join(","):"",Pe=(e,t=null,s="")=>{if(Me.has(s))return;Me.add(s);let o=`<b>Error: ${e}</b>`;t&&console.log(t);const n=Le.alert(o,Te);n.show(),n.on("hidden",(()=>{Me.delete(s)}))},Ae={labels:{select:"Select",addElement:"Toggle Draw mode",editElement:"Edit feature",save:"Save",delete:"Delete",cancel:"Cancel",apply:"Apply changes",upload:"Upload",editMode:"Edit Mode",confirmDelete:"Are you sure to delete the feature?",geomTypeNotSupported:"Geometry not supported by layer",editFields:"Edit fields",editGeom:"Edit geometry",selectDrawType:"Geometry type to draw",uploadToLayer:"Upload file to selected layer",uploadFeatures:"Uploaded features to layer",validFeatures:"Valid geometries",invalidFeatures:"Invalid",loading:"Loading...",toggleVisibility:"Toggle layer visibility",close:"Close"},errors:{capabilities:"GeoServer Capabilities could not be downloaded.",wfst:"The GeoServer does not support Transactions",layer:"Could not get data from layer",layerNotFound:"Layer not found",layerNotVisible:"Layer is not visible",noValidGeometry:"No valid geometries found to add to this layer",geoserver:"Failed to get data from GeoServer",badFormat:"Unsupported format",badFile:"Error reading items from file",lockFeature:"Could not lock items on the GeoServer.",transaction:"Error when doing Transaction with GeoServer.",getFeatures:"Error getting elements from GeoServer."}},xe={es:{labels:{select:"Seleccionar",addElement:"Modo dibujo",editElement:"Editar elemento",save:"Guardar",delete:"Eliminar",cancel:"Cancelar",apply:"Aplicar cambios",upload:"Subir",editMode:"Modo Edición",confirmDelete:"¿Estás seguro de borrar el elemento?",geomTypeNotSupported:"Geometría no compatible con la capa",editFields:"Editar campos",editGeom:"Editar geometría",selectDrawType:"Tipo de geometría para dibujar",uploadToLayer:"Subir archivo a la capa seleccionada",uploadFeatures:"Subida de elementos a la capa",validFeatures:"Válidas",invalidFeatures:"Invalidas",loading:"Cargando...",toggleVisibility:"Cambiar visibilidad de la capa",close:"Cerrar"},errors:{capabilities:"No se pudieron obtener las Capabilidades del GeoServer",wfst:"El GeoServer no tiene soporte a Transacciones",layer:"No se pudieron obtener datos de la capa",layerNotFound:"Capa no encontrada",layerNotVisible:"La capa no está visible",noValidGeometry:"No se encontraron geometrías válidas para agregar a esta capa",geoserver:"No se pudieron obtener datos desde el GeoServer",badFormat:"Formato no soportado",badFile:"Error al leer elementos del archivo",lockFeature:"No se pudieron bloquear elementos en el GeoServer.",transaction:"Error al hacer transacción con el GeoServer.",getFeatures:"Error al obtener elemento desde el GeoServer."}},en:Ae,zh:{labels:{select:"选择",addElement:"切换绘图类型",editElement:"编辑元素",save:"保存",delete:"删除",cancel:"取消",apply:"确认并应用改变",upload:"上传",editMode:"编辑模式",confirmDelete:"确认删除元素?",geomTypeNotSupported:"图层不支持该几何",editFields:"编辑区域",editGeom:"编辑几何",selectDrawType:"几何类型",uploadToLayer:"通过文件上传图层",uploadFeatures:"上传元素到图层",validFeatures:"合法的几何类型",invalidFeatures:"不合法",loading:"加载中...",toggleVisibility:"切换图层透明度",close:"关闭"},errors:{capabilities:"无法加载GeoServer服务所支持的能力.",wfst:"GeoServer不支持事务",layer:"无法从图层获得数据",layerNotFound:"Layer not found",layerNotVisible:"Layer is not visible",noValidGeometry:"不支持的几何类型无法加载到图层",geoserver:"无法从GeoServer获取数据",badFormat:"不支持的格式",badFile:"读取文件数据出错",lockFeature:"无法锁定GeoServer上的元素.",transaction:"GeoServer处理事务出错.",getFeatures:"从GeoServer获取元素出错."}}};let Ie=Ae;let Ne;const Oe=(e=!0)=>{e?Ne.classList.add("ol-wfst--tools-control--loading-show"):Ne.classList.remove("ol-wfst--tools-control--loading-show")},Re=(e,t,s=[])=>{const o=Object.getOwnPropertyDescriptors(t);for(let e of s)delete o[e];Object.defineProperties(e,o)},Ge=(e,t=[e])=>{const s=Object.getPrototypeOf(e);return null===s?t:Ge(s,[...t,s])},De=(e,t,s=[])=>{var o;const n=null!==(o=((...e)=>{if(0===e.length)return;let t;const s=e.map((e=>Ge(e)));for(;s.every((e=>e.length>0));){const e=s.map((e=>e.pop())),o=e[0];if(!e.every((e=>e===o)))break;t=o}return t})(...e))&&void 0!==o?o:Object.prototype,r=Object.create(n),i=Ge(n);for(let t of e){let e=Ge(t);for(let t=e.length-1;t>=0;t--){let o=e[t];-1===i.indexOf(o)&&(Re(r,o,["constructor",...s]),i.push(o))}}return r.constructor=t,r},Ue=e=>e.filter(((t,s)=>e.indexOf(t)==s)),Ve=new Map,qe=e=>Ve.get(e),je=(e,t)=>{var s,o;const n=Ue([...Object.getOwnPropertyNames(e),...Object.getOwnPropertyNames(t)]),r={};for(let i of n)r[i]=Ue([...null!==(s=null==e?void 0:e[i])&&void 0!==s?s:[],...null!==(o=null==t?void 0:t[i])&&void 0!==o?o:[]]);return r},Be=(e,t)=>{var s,o,n,r;return{property:je(null!==(s=null==e?void 0:e.property)&&void 0!==s?s:{},null!==(o=null==t?void 0:t.property)&&void 0!==o?o:{}),method:je(null!==(n=null==e?void 0:e.method)&&void 0!==n?n:{},null!==(r=null==t?void 0:t.method)&&void 0!==r?r:{})}},ze=new Map,He=(...e)=>{const t=((...e)=>{var t;const s=new Set,o=new Set([...e]);for(;o.size>0;)for(let e of o){const n=[...Ge(e.prototype).map((e=>e.constructor)),...null!==(t=qe(e))&&void 0!==t?t:[]].filter((e=>!s.has(e)));for(let e of n)o.add(e);s.add(e),o.delete(e)}return[...s]})(...e).map((e=>ze.get(e))).filter((e=>!!e));return 0==t.length?{}:1==t.length?t[0]:t.reduce(((e,t)=>((e,t)=>{var s,o,n,r,i,a;return{class:Ue([...null!==(s=null==e?void 0:e.class)&&void 0!==s?s:[],...null!==(o=null==t?void 0:t.class)&&void 0!==o?o:[]]),static:Be(null!==(n=null==e?void 0:e.static)&&void 0!==n?n:{},null!==(r=null==t?void 0:t.static)&&void 0!==r?r:{}),instance:Be(null!==(i=null==e?void 0:e.instance)&&void 0!==i?i:{},null!==(a=null==t?void 0:t.instance)&&void 0!==a?a:{})}})(e,t)))};function $e(...e){var t,s,o;const n=e.map((e=>e.prototype));function r(...t){for(const s of e)Re(this,new s(...t))}r.prototype=De(n,r),Object.setPrototypeOf(r,De(e,null,["prototype"]));let i=r;{const n=He(...e);for(let e of null!==(t=null==n?void 0:n.class)&&void 0!==t?t:[])i=e(i);We(null!==(s=null==n?void 0:n.static)&&void 0!==s?s:{},i),We(null!==(o=null==n?void 0:n.instance)&&void 0!==o?o:{},i.prototype)}var a,l;return a=i,l=e,Ve.set(a,l),i}const We=(e,t)=>{const s=e.property,o=e.method;if(s)for(let e in s)for(let o of s[e])o(t,e);if(o)for(let e in o)for(let s of o[e])s(t,e,Object.getOwnPropertyDescriptor(t,e))};var Ke,Ze;let Je;!function(e){e.Point="Point",e.LineString="LineString",e.LinearRing="LinearRing",e.Polygon="Polygon",e.MultiPoint="MultiPoint",e.MultiLineString="MultiLineString",e.MultiPolygon="MultiPolygon",e.GeometryCollection="GeometryCollection",e.Circle="Circle"}(Ke||(Ke={})),function(e){e.Insert="insert",e.Delete="delete",e.Update="update"}(Ze||(Ze={}));let Ye=null,Xe=null;var Qe;function et(e=null){Xe=e}function tt(){return Xe}!function(e){e.Edit="EDIT",e.Draw="DRAW"}(Qe||(Qe={}));const st=new Set,ot={};function nt(){return Je}function rt(e){Ye=e}function it(){return Ye}function at(){return ot}function lt(e){return at()[e]}function ct(e){st.add(String(e.getId()))}function dt(e){st.delete(String(e.getId()))}function ht(e){return st.has(String(e.getId()))}class ut extends E.default{_init(){const e=this.getGeoserver();e.isLoaded()?this.getAndUpdateDescribeFeatureType():e.on("change:capabilities",(()=>{this.getAndUpdateDescribeFeatureType()}))}async getAndUpdateDescribeFeatureType(){const e=this.get(pt.NAME),t=this.get(pt.LABEL);try{const t=this.getGeoserver(),s=new URLSearchParams({service:"wfs",version:t.getAdvanced().describeFeatureTypeVersion,request:"DescribeFeatureType",typeName:e,outputFormat:"application/json",exceptions:"application/json"}),o=t.getUrl()+"?"+s.toString(),n=await fetch(o,{headers:t.getHeaders(),credentials:t.getCredentials()});if(!n.ok)throw new Error("");const r=await n.json();if(!r)throw new Error("");const i=r.targetNamespace,a=r.featureTypes[0].properties,l=a.find((e=>e.type.indexOf("gml:")>=0));r._parsed={namespace:i,properties:a,geomType:l.localType,geomField:l.name},this.set(pt.DESCRIBEFEATURETYPE,r)}catch(e){throw console.error(e),new Error(`${Ie.errors.layer} "${t}"`)}}isVisibleByZoom(){return nt().getView().getZoom()>this.getMinZoom()}async transactFeatures(e,t){return this.getGeoserver().transact(e,t,this.get(pt.NAME))}async insertFeatures(e){return this.transactFeatures(Ze.Insert,e)}async maybeLockFeature(e){const t=this.getGeoserver();return t.getUseLockFeature()&&t.hasLockFeature()?await t.lockFeature(e,this.get(pt.NAME)):null}getGeoserver(){return this.get(pt.GEOSERVER)}getDescribeFeatureType(){return this.get(pt.DESCRIBEFEATURETYPE)}}var pt,mt,ft,gt;!function(e){e.NAME="name",e.LABEL="label",e.DESCRIBEFEATURETYPE="describeFeatureType",e.ISVISIBLE="isVisible",e.GEOSERVER="geoserver"}(pt||(pt={}));class yt extends C.default{setCqlFilter(e,t){this.set(mt.CQLFILTER,e,t)}getCqlFilter(){return this.get(mt.CQLFILTER)}setSortBy(e,t){this.set(mt.SORTBY,e,t)}getSortBy(){return this.get(mt.SORTBY)}setFeatureId(e,t){this.set(mt.FEATUREID,e,t)}getFeatureId(){return this.get(mt.FEATUREID)}setFilter(e,t){this.set(mt.FILTER,e,t)}getFilter(){return this.get(mt.FILTER)}setFormatOptions(e,t){this.set(mt.FORMATOPTIONS,e,t)}getFormatOptions(){return this.get(mt.FORMATOPTIONS)}setMaxFeatures(e,t){this.set(mt.MAXFEATURES,e,t)}getMaxFeatures(){return this.get(mt.MAXFEATURES)}setStartIndex(e,t){this.set(mt.STARTINDEX,e,t)}getStartIndex(){return this.get(mt.STARTINDEX)}setPropertyName(e,t){this.set(mt.PROPERTYNAME,e,t)}getPropertyName(){return this.get(mt.PROPERTYNAME)}}!function(e){e.CQLFILTER="cql_filter",e.SORTBY="sortBy",e.FEATUREID="featureid",e.FILTER="filter",e.FORMATOPTIONS="format_options",e.MAXFEATURES="maxFeatures",e.STARTINDEX="startIndex",e.PROPERTYNAME="propertyname"}(mt||(mt={}));class vt extends($e(F.default,yt)){geoserverProps_=["cql_filter","filter","orderBy","maxFeatures","startIndex","featureid","format_options","propertyname","strict"];urlParams_=new URLSearchParams({SERVICE:"wfs",REQUEST:"GetFeature",OUTPUTFORMAT:"application/json",EXCEPTIONS:"application/json"});constructor(e){super({...e,format:new S.default,loader:async(t,s,o,n,r)=>{try{if(e.strategy==h.bbox){const s=d.transformExtent(t,o.getCode(),e.geoServerAdvanced.projection);this.urlParams_.set("bbox",s.toString()+`,${e.geoServerAdvanced.projection}`)}const s=this.getCqlFilter();s&&this.urlParams_.set("cql_filter",s);const r=this.getSortBy();r&&this.urlParams_.set("sortBy",r);const i=this.getFilter();i&&this.urlParams_.set("filter",i);const a=this.getFeatureId();a&&this.urlParams_.set("featureid",a);const l=this.getFormatOptions();l&&this.urlParams_.set("formatOptions",l);const c=this.getMaxFeatures();c&&this.urlParams_.set("maxFeatures",String(c));const u=this.getStartIndex();u&&this.urlParams_.set("startIndex",String(u));const p=this.getPropertyName();p&&this.urlParams_.set("propertyname",p);const m=this.getStrict();void 0!==m&&this.urlParams_.set("strict",String(m));const f=e.geoserverUrl+"?"+this.urlParams_.toString(),g=await fetch(f,{headers:e.headers,credentials:e.credentials});if(!g.ok)throw new Error("");const y=await g.json();if(y.exceptions)throw new Error(ke(y));const v=this.getFormat().readFeatures(y,{featureProjection:o.getCode(),dataProjection:e.geoServerAdvanced.projection});v.forEach((t=>{t.set("_layerName_",e.name,!0)})),this.addFeatures(v),n(v)}catch(s){this.removeLoadedExtent(t),Pe(Ie.errors.geoserver,s,e.name),r()}}}),this.urlParams_.set("version",e.geoServerAdvanced.getFeatureVersion),this.urlParams_.set("typename",e.name),this.urlParams_.set("srsName",e.geoServerAdvanced.projection.toString());const t=e.geoserverVendor;this.setCqlFilter(t.cql_filter,!0),this.setSortBy(t.sortBy,!0),this.setFeatureId(t.featureid,!0),this.setFilter(t.filter,!0),this.setFormatOptions(t.format_options,!0),this.setMaxFeatures(t.maxFeatures,!0),this.setStartIndex(t.startIndex,!0),this.setPropertyName(t.propertyname,!0),this.setStrict(t.strict,!0),this.addEvents_()}setStrict(e,t){this.set(ft.STRICT,e,t)}getStrict(){return this.get(ft.STRICT)}addEvents_(){this.on(["propertychange"],(e=>{this.geoserverProps_.includes(e.key)&&this.refresh()}))}}!function(e){e.STRICT="strict"}(ft||(ft={}));class _t extends($e(ut,w.default)){_loadingCount=0;_loadedCount=0;beforeTransactFeature;constructor(e){super({name:e.name,label:e.label||e.name,minZoom:e.minZoom,...e}),e.beforeTransactFeature&&(this.beforeTransactFeature=e.beforeTransactFeature);const t=e.geoserver,s=new vt({name:e.name,geoserverUrl:t.getUrl(),geoServerAdvanced:t.getAdvanced(),...e.strategy&&{strategy:e.strategy},geoserverVendor:e.geoserverVendor});this._loadingCount=0,this._loadedCount=0,s.on("featuresloadstart",(()=>{this._loadingCount++,1===this._loadingCount&&this.isVisibleByZoom()&&Oe()})),s.on(["featuresloadend","featuresloaderror"],(()=>{this._loadedCount++,this._loadingCount===this._loadedCount&&(this._loadingCount=0,this._loadedCount=0,setTimeout((()=>{this.dispatchEvent("layerRendered")}),300))})),this.setSource(s)}refresh(){this.getSource().refresh()}}class bt extends($e(T.default,yt)){geoserverProps_=["cql_filter","filter","orderBy","maxFeatures","startIndex","featureid","format_options","propertyname","buffer","clip","env"];constructor(e){super({url:e.geoserverUrl,serverType:"geoserver",params:{SERVICE:"wms",TILED:!0,LAYERS:e.name,EXCEPTIONS:"application/json",...e.geoserverVendor&&e.geoserverVendor},tileLoadFunction:async(t,s)=>{try{const n=await fetch(s,{headers:e.headers,credentials:e.credentials});if(!n.ok)throw new Error("");let r=await n.blob();if("application/json"==r.type){const e=await(o=r,new Promise((e=>{const t=new FileReader;t.onloadend=()=>e(JSON.parse(t.result)),t.readAsText(o)})));throw new Error(ke(e))}t.getImage().src=URL.createObjectURL(r),t.setState(oe)}catch(s){Pe(Ie.errors.geoserver,s,e.name),t.setState(ne)}var o},...e}),this.addEvents_()}setBuffer(e,t){this.set(gt.BUFFER,e,t)}getBuffer(){return this.get(gt.BUFFER)}setEnv(e,t){this.set(gt.ENV,e,t)}getEnv(){return this.get(gt.ENV)}setClip(e,t){this.set(gt.CLIP,e,t)}getClip(){return this.get(gt.CLIP)}addEvents_(){this.on(["propertychange"],(e=>{console.log(e.key),this.geoserverProps_.includes(e.key)&&(this.updateParams({[e.key]:e.target.get(e.key)}),this.refresh())}))}}!function(e){e.BUFFER="buffer",e.ENV="env",e.CLIP="clip"}(gt||(gt={}));class wt extends($e(ut,L.default)){_loadingCount=0;_loadedCount=0;beforeTransactFeature;_formatGeoJSON;constructor(e){super({name:e.name,label:e.label||e.name,minZoom:e.minZoom,...e}),e.beforeTransactFeature&&(this.beforeTransactFeature=e.beforeTransactFeature),this._formatGeoJSON=new m.GeoJSON;const t=e.geoserver,s=new bt({name:e.name,geoserverUrl:t.getUrl(),geoServerAdvanced:t.getAdvanced(),geoserverVendor:e.geoserverVendor});this._loadingCount=0,this._loadedCount=0,s.on("tileloadstart",(()=>{this._loadingCount++,1===this._loadingCount&&this.isVisibleByZoom()&&Oe()})),s.on(["tileloadend","tileloaderror"],(()=>{this._loadedCount++,this._loadingCount===this._loadedCount&&(this._loadingCount=0,this._loadedCount=0,setTimeout((()=>{this.dispatchEvent("layerRendered")}),300))})),this.setSource(s)}async getFeaturesByClickEvent(e){const t=e.coordinate,s=nt().getView(),o=s.getZoom()>10?10:5,n=this.getSource(),r=n["getFeatureInfoUrl"in n?"getFeatureInfoUrl":"getGetFeatureInfoUrl"](t,s.getResolution(),s.getProjection().getCode(),{INFO_FORMAT:"application/json",BUFFER:o,FEATURE_COUNT:1,EXCEPTIONS:"application/json"}),i=this.getGeoserver();try{const e=await fetch(r,{headers:i.getHeaders(),credentials:i.getCredentials()});if(!e.ok)throw new Error(`${Ie.errors.getFeatures} ${e.status}`);const t=await e.json();return this._formatGeoJSON.readFeatures(t)}catch(e){Pe(e.message,e)}}refresh(){const e=this.getSource();e.refresh();const t=e.getParams();t.t=(new Date).getMilliseconds(),e.updateParams(t)}}function Et(e,t={},...s){if("function"==typeof e)return e(t,s);const o=null===e?new DocumentFragment:document.createElement(e);Object.entries(t||{}).forEach((([e,t])=>{void 0!==typeof t&&null!=t&&(e.startsWith("on")&&e.toLowerCase()in window?o.addEventListener(e.toLowerCase().substr(2),t):"className"===e?o.setAttribute("class",t.toString()):"htmlFor"===e?o.setAttribute("for",t.toString()):o.setAttribute(e,t.toString()))}));for(const e of s)e&&(Array.isArray(e)?o.append(...e):void 0===e.nodeType?o.innerHTML+=e:o.appendChild(e));return o}const St=()=>{const e=document.querySelector(".ol-wfst--tools-control-btn.wfst--active");e&&e.classList.remove("wfst--active")};class Ft extends j{_uploads;_uploadFormats;constructor(e,t){super(),this._uploads=e,this._uploadFormats=t}addLayerEl(e){const t=document.querySelector(".wfst--tools-control--select-layers"),s=e.get(pt.NAME),o=Et("input",{value:s,id:`wfst--${s}`,type:"radio",className:"ol-wfst--tools-control-input",name:"wfst--select-layer",...e===it()?{checked:"checked"}:{},onchange:t=>this._layerChangeHandler(t,e)}),n=Et("div",{className:`wfst--layer-control \n ${e.getVisible()?"ol-wfst--visible-on":""}\n ${e===it()?"ol-wfst--selected-on":""}`,"data-layer":s},Et("div",{className:"ol-wfst--tools-control-visible"},Et("span",{className:"ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-on",title:Ie.labels.toggleVisibility,onclick:e=>this._visibilityClickHandler(e)},Et("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e%3cpath d='M384 288q39 0 67.5 28.5t28.5 67.5-28.5 67.5-67.5 28.5-67.5-28.5-28.5-67.5 28.5-67.5 67.5-28.5zM384 544.5q66 0 113.25-47.25t47.25-113.25-47.25-113.25-113.25-47.25-113.25 47.25-47.25 113.25 47.25 113.25 113.25 47.25zM384 144q118.5 0 214.5 66t138 174q-42 108-138 174t-214.5 66-214.5-66-138-174q42-108 138-174t214.5-66z'%3e%3c/path%3e%3c/svg%3e"})),Et("span",{className:"ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-off",title:Ie.labels.toggleVisibility,onclick:e=>this._visibilityClickHandler(e)},Et("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e%3cpath d='M379.5 288h4.5q39 0 67.5 28.5t28.5 67.5v6zM241.5 313.5q-18 36-18 70.5 0 66 47.25 113.25t113.25 47.25q34.5 0 70.5-18l-49.5-49.5q-12 3-21 3-39 0-67.5-28.5t-28.5-67.5q0-9 3-21zM64.5 136.5l40.5-40.5 567 567-40.5 40.5q-7.5-7.5-47.25-46.5t-60.75-60q-64.5 27-139.5 27-118.5 0-214.5-66t-138-174q16.5-39 51.75-86.25t68.25-72.75q-18-18-50.25-51t-36.75-37.5zM384 223.5q-30 0-58.5 12l-69-69q58.5-22.5 127.5-22.5 118.5 0 213.75 66t137.25 174q-36 88.5-109.5 151.5l-93-93q12-28.5 12-58.5 0-66-47.25-113.25t-113.25-47.25z'%3e%3c/path%3e%3c/svg%3e"}))),Et("label",{htmlFor:`wfst--${s}`},o,Et("span",{title:e.getDescribeFeatureType()._parsed.geomType},e.get(pt.LABEL))));return t.appendChild(n),e===it()&&o.dispatchEvent(new Event("change")),n}_changeStateSelect(e,t=null){const s=(e,t)=>{Array.from(o.options).forEach((s=>{s.selected=s.value===e,s.disabled="all"!==t&&!t.includes(s.value),s.title=s.disabled?Ie.labels.geomTypeNotSupported:""}))},o=document.querySelector(".wfst--tools-control--select-draw");let n;if(o){const r=e.getDescribeFeatureType()._parsed.geomType;t?n=o.value:r===Ke.GeometryCollection?(n=Ke.LineString,s(n,"all")):r===Ke.LinearRing?(n=Ke.LineString,s(n,[Ke.Circle,Ke.LinearRing,Ke.Polygon]),o.value=n):(n=r,s(n,[r]))}return n}_visibilityClickHandler(e){const t=e.currentTarget.closest(".wfst--layer-control"),s=t.dataset.layer;t.classList.toggle("ol-wfst--visible-on");const o=at()[s];t.classList.contains("ol-wfst--visible-on")?o.setVisible(!0):o.setVisible(!1)}_layerChangeHandler(e,t){const s=e.currentTarget.closest(".wfst--layer-control"),o=document.querySelector(".ol-wfst--selected-on");o&&o.classList.remove("ol-wfst--selected-on"),s.classList.add("ol-wfst--selected-on"),rt(t),this._changeStateSelect(t)}render(){return Et(null,null,Et("div",{className:"wfst--tools-control--head"},this._uploads&&Et("div",null,Et("input",{id:"ol-wfst--upload",type:"file",accept:this._uploadFormats,onchange:e=>this._uploads.process(e)}),Et("label",{className:"ol-wfst--tools-control-btn ol-wfst--tools-control-btn-upload",htmlFor:"ol-wfst--upload",title:Ie.labels.uploadToLayer},Et("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='512' height='512' viewBox='0 0 512 512'%3e%3cpath d='M240 352h-240v128h480v-128h-240zM448 416h-64v-32h64v32zM112 160l128-128 128 128h-80v160h-96v-160z'%3e%3c/path%3e%3c/svg%3e"}))),Et("div",{className:"ol-wfst--tools-control-draw-cnt"},Et("button",{className:"ol-wfst--tools-control-btn ol-wfst--tools-control-btn-draw",type:"button",title:Ie.labels.addElement,onclick:()=>{this.dispatchEvent("drawMode")}},Et("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='768' height='768' viewBox='0 0 768 768'%3e %3cpath d='M663 225l-58.5 58.5-120-120 58.5-58.5q9-9 22.5-9t22.5 9l75 75q9 9 9 22.5t-9 22.5zM96 552l354-354 120 120-354 354h-120v-120z'%3e%3c/path%3e%3c/svg%3e"})),Et("select",{title:Ie.labels.selectDrawType,className:"wfst--tools-control--select-draw",onchange:e=>{const t=e.target.value;this._changeStateSelect(it(),t),this.dispatchEvent("changeGeom")}},[Ke.Point,Ke.MultiPoint,Ke.LineString,Ke.MultiLineString,Ke.Polygon,Ke.MultiPolygon,Ke.Circle].map((e=>Et("option",{value:e},e)))))),Et("div",{className:"wfst--tools-control--select-layers"}))}}let Ct=new w.default({source:new F.default,zIndex:100});const Lt=()=>Ct;class Tt extends j{_options;_formatWFS;_formatGeoJSON;_formatKml;_xs;_processUpload;constructor(e){super(),this._options=e,this._processUpload=e.processUpload,this._formatWFS=new m.WFS,this._formatGeoJSON=new m.GeoJSON,this._formatKml=new m.KML({extractStyles:!1,showPointNames:!1}),this._xs=new XMLSerializer}async process(e){const t=nt().getView(),s=e.target.files[0];let o;if(!s)return;const n=s.name.split(".").pop().toLowerCase();try{if(this._processUpload&&(o=this._processUpload(s)),!o){const e=await this._fileReader(s);"geojson"===n||"json"===n?o=this._formatGeoJSON.readFeatures(e,{featureProjection:t.getProjection().getCode()}):"kml"===n?o=this._formatKml.readFeatures(e,{featureProjection:t.getProjection().getCode()}):Pe(Ie.errors.badFormat)}let r=0,i=0;const a=[];for(let e of o)this._checkGeometry(e)||(e=this._fixGeometry(e)),e?(a.push(e),i++):r++;if(i){St(),this.dispatchEvent(new c.VectorSourceEvent("loadedFeatures",null,a));const e=`\n ${Ie.labels.validFeatures}: ${i}<br>\n ${r?`${Ie.labels.invalidFeatures}: ${r}`:""}`;this._initModal(e,a)}else Pe(Ie.errors.noValidGeometry);e.target.value=null}catch(e){Pe(Ie.errors.badFile,e)}}async _fileReader(e){return new Promise(((t,s)=>{const o=new FileReader;o.addEventListener("load",(async e=>{const s=e.target.result;t(s)})),o.addEventListener("error",(e=>{console.error("Error"+e),s()})),o.readAsText(e)}))}_fixGeometry(e){const t=it().getDescribeFeatureType()._parsed.geomType;let s;switch(e.getGeometry().getType()){case Ke.Point:if(t===Ke.MultiPoint){const t=e.getGeometry().getCoordinates();s=new g.MultiPoint([t])}break;case Ke.LineString:if(t===Ke.MultiLineString){const t=e.getGeometry().getCoordinates();s=new g.MultiLineString([t])}break;case Ke.Polygon:if(t===Ke.MultiPolygon){const t=e.getGeometry().getCoordinates();s=new g.MultiPolygon([t])}break;default:s=null}return s?(e.setGeometry(s),e):null}_checkGeometry(e){const t=it().getDescribeFeatureType()._parsed.geomType,s=e.getGeometry().getType();return t===Ke.GeometryCollection||s===t}_initModal(e,t){const s=`\n <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">\n ${Ie.labels.cancel}\n </button>\n <button type="button" class="btn btn-sm btn-primary" data-action="save" data-dismiss="modal">\n ${Ie.labels.upload}\n </button>\n `;new Le({...this._options.modal,header:!0,headerClose:!1,title:Ie.labels.uploadFeatures+" "+it().get(pt.NAME),content:e,backdrop:"static",footer:s}).show().on("dismiss",((e,s)=>{"save"===s.target.dataset.action?this.dispatchEvent(new c.VectorSourceEvent("addedFeatures",null,t)):Lt().getSource().clear()}))}}const Mt=(e,...t)=>(t.forEach((t=>{Object.keys(t).forEach((s=>{const o=t[s],n=e[s];e[s]=n&&o&&"object"==typeof n&&"object"==typeof o&&!Array.isArray(n)?Mt(n,o):o}))})),e);class kt extends t.Control{constructor(e){super({element:Et("div",{className:"ol-wfst--changes-control"},Et("div",{className:"ol-wfst--changes-control-el"},Et("div",{className:"ol-wfst--changes-control-id"},Et("b",null,Ie.labels.editMode)," -"," ",Et("i",null,String(e.getId()))),Et("button",{type:"button",className:"btn btn-sm btn-secondary",onclick:()=>{this.dispatchEvent(new c.VectorSourceEvent("cancel",e))}},Ie.labels.cancel),Et("button",{type:"button",className:"btn btn-sm btn-primary",onclick:()=>{this.dispatchEvent(new c.VectorSourceEvent("apply",e))}},Ie.labels.apply),Et("button",{type:"button",className:"btn btn-sm btn-danger-outline",onclick:()=>{this.dispatchEvent(new c.VectorSourceEvent("delete",e))}},Ie.labels.delete)))})}}function Pt(t){const s=e=>{let t=e.getGeometry();t instanceof g.GeometryCollection&&(t=t.getGeometries()[0]);const s=t.getCoordinates();let o=null;if(o=t instanceof g.Polygon||t instanceof g.MultiLineString?s.flat(1):t instanceof g.MultiPolygon?s.flat(2):s,o&&o.length)return new g.MultiPoint(o)};let o=t.getGeometry(),n=o.getType();switch(o instanceof g.GeometryCollection&&(o=o.getGeometries()[0],n=o.getType()),n){case Ke.Point:case Ke.MultiPoint:return tt()===Qe.Edit?[new e.Style({image:new e.Circle({radius:6,fill:new e.Fill({color:"#000000"})})}),new e.Style({image:new e.Circle({radius:4,fill:new e.Fill({color:"#ff0000"})})})]:[new e.Style({image:new e.Circle({radius:5,fill:new e.Fill({color:"#ff0000"})})}),new e.Style({image:new e.Circle({radius:2,fill:new e.Fill({color:"#000000"})})})];default:return tt()==Qe.Draw||tt()==Qe.Edit?[new e.Style({stroke:new e.Stroke({color:"rgba( 255, 0, 0, 1)",width:4}),fill:new e.Fill({color:"rgba(255, 0, 0, 0.7)"})}),new e.Style({image:new e.Circle({radius:4,fill:new e.Fill({color:"#ff0000"}),stroke:new e.Stroke({width:2,color:"rgba(5, 5, 5, 0.9)"})}),geometry:e=>s(e)}),new e.Style({stroke:new e.Stroke({color:"rgba(255, 255, 255, 0.7)",width:2})})]:[new e.Style({image:new e.Circle({radius:2,fill:new e.Fill({color:"#000000"})}),geometry:e=>s(e)}),new e.Style({stroke:new e.Stroke({color:"#ff0000",width:4}),fill:new e.Fill({color:"rgba(255, 0, 0, 0.7)"})})]}}class At extends j{_options;_modal;_feature;constructor(e){super(),this._options=e;const t=`\n <button type="button" class="btn btn-sm btn-link btn-third" data-action="delete" data-dismiss="modal">\n ${Ie.labels.delete}\n </button>\n <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">\n ${Ie.labels.cancel}\n </button>\n <button type="button" class="btn btn-sm btn-primary" data-action="save" data-dismiss="modal">\n ${Ie.labels.save}\n </button>\n `;this._modal=new Le({...this._options,header:!0,headerClose:!0,title:"",content:"<div></div>",footer:t}),this._modal.on("dismiss",((e,t)=>{if("save"===t.target.dataset.action){e.el.querySelectorAll("input").forEach((e=>{const t=e.value,s=e.name;this._feature.set(s,t,!0)})),this._feature.changed(),ct(this._feature),this.dispatchEvent(new c.VectorSourceEvent("save",this._feature))}else"delete"===t.target.dataset.action&&this.dispatchEvent(new c.VectorSourceEvent("delete",this._feature))}))}show(e){this._feature=e;const t=`${Ie.labels.editElement} ${e.getId()} `,s=e.getProperties(),o=lt(e.get("_layerName_")).getDescribeFeatureType()._parsed.properties;let n='<form autocomplete="false">';Object.keys(s).forEach((e=>{const t=o.find((t=>t.name===e));if(t){let o;switch(t.type){case"xsd:string":default:o="text";break;case"xsd:number":case"xsd:int":o="number";break;case"xsd:date-time":o="datetime"}o&&(n+=`\n <div class="ol-wfst--input-field-container">\n <label class="ol-wfst--input-field-label" for="${e}">${e}</label>\n <input placeholder="NULL" class="ol-wfst--input-field-input" type="${o}" name="${e}" value="${s[e]||""}">\n </div>`)}})),n+="</form>",this._modal._html.body.innerHTML=n,this._modal._html.header.innerHTML=t,this._modal.show()}}class xt extends C.default{_options;_countRequests;_insertFeatures;_updateFeatures;_deleteFeatures;_formatWFS;_formatGeoJSON;_formatKml;_xs;state_;constructor(e){super();const t={url:null,advanced:{getCapabilitiesVersion:"1.3.0",getFeatureVersion:"1.0.0",describeFeatureTypeVersion:"1.1.0",lockFeatureVersion:"1.1.0",wfsTransactionVersion:"1.1.0",projection:"EPSG:3857",lockFeatureParams:{expiry:5,lockId:"GeoServer",releaseAction:"SOME"}},headers:{},credentials:"same-origin",useLockFeature:!0};this._options=Mt(t,e),this.setAdvanced(this._options.advanced),this.setHeaders(this._options.headers),this.setCredentials(this._options.credentials),this.setUrl(this._options.url),this.setUseLockFeature(this._options.useLockFeature),this._countRequests=0,this._insertFeatures=[],this._updateFeatures=[],this._deleteFeatures=[],this._formatWFS=new m.WFS,this._formatGeoJSON=new m.GeoJSON,this._formatKml=new m.KML({extractStyles:!1,showPointNames:!1}),this._xs=new XMLSerializer,this.getAndUpdateCapabilities(),this.on("change:capabilities",(()=>{this._checkGeoserverCapabilities()}))}getCapabilities(){return this.get(It.CAPABILITIES)}setUrl(e,t=!1){this.set(It.URL,e,t)}getUrl(){return this.get(It.URL)}setHeaders(e={},t=!1){return this.set(It.HEADERS,e,t)}getHeaders(){return this.get(It.HEADERS)}setCredentials(e=null,t=!1){this.set(It.CREDENTIALS,e,t)}getCredentials(){return this.get(It.CREDENTIALS)}setAdvanced(e={},t=!1){this.set(It.ADVANCED,e,t)}getAdvanced(){return this.get(It.ADVANCED)}hasTransaction(){return this.get(It.HASTRASNACTION)}hasLockFeature(){return this.get(It.HASLOCKFEATURE)}getUseLockFeature(){return this.get(It.USELOCKFEATURE)}setUseLockFeature(e,t=!1){this.set(It.USELOCKFEATURE,e,t)}isLoaded(){return this.get(It.ISLOADED)}getState(){return this.state_}async getAndUpdateCapabilities(){try{const e=new URLSearchParams({service:"wfs",version:this.getAdvanced().getCapabilitiesVersion,request:"GetCapabilities",exceptions:"application/json"}),t=this.getUrl()+"?"+e.toString(),s=await fetch(t,{headers:this.getHeaders(),credentials:this.getCredentials()});if(!s.ok)throw new Error("");const o=await s.text(),n=(new window.DOMParser).parseFromString(o,"text/xml");return this.set(It.CAPABILITIES,n),this.state_=n?"ready":"error",n}catch(e){console.error(e);const t="string"==typeof e?e:Ie.errors.capabilities;Pe(t,e)}}_checkGeoserverCapabilities(){const e=this.getCapabilities().getElementsByTagName("ows:Operation");if(Array.from(e).forEach((e=>{"Transaction"===e.getAttribute("name")?this.set(It.HASTRASNACTION,!0):"LockFeature"===e.getAttribute("name")?this.set(It.HASLOCKFEATURE,!0):"DescribeFeatureType"===e.getAttribute("name")&&this.set(It.HASDESCRIBEFEATURETYPE,!0)})),!this.hasTransaction())throw Ie.errors.wfst}async transact(e,t,s){t=Array.isArray(t)?t:[t];const o=[],n=lt(s);for(const s of t){let t=this._cloneFeature(s);const r=t.getGeometry();r instanceof g.GeometryCollection?this._transformGeoemtryCollectionToGeometries(t,r):r instanceof g.Circle&&this._transformCircleToPolygon(t,r),"beforeTransactFeature"in n&&"function"==typeof n.beforeTransactFeature&&(t=n.beforeTransactFeature(t,e)),t&&o.push(t)}if(!o.length)return Pe(Ie.errors.noValidGeometry),!1;switch(e){case Ze.Insert:this._insertFeatures=[...this._insertFeatures,...o];break;case Ze.Update:this._updateFeatures=[...this._updateFeatures,...o];break;case Ze.Delete:this._deleteFeatures=[...this._deleteFeatures,...o]}this._countRequests++;const r=this._countRequests;return new Promise(((o,i)=>{setTimeout((async()=>{try{if(r!==this._countRequests)return;let i=nt().getView().getProjection().getCode();i="EPSG:4326"===i?"urn:x-ogc:def:crs:EPSG:4326":i;const a=n.getDescribeFeatureType()._parsed;if(!n)throw new Error(Ie.errors.layerNotFound);const l={featureNS:a.namespace,featureType:s,srsName:i,featurePrefix:null,nativeElements:null,version:this.getAdvanced().wfsTransactionVersion},c=this._formatWFS.writeTransaction(this._insertFeatures,this._updateFeatures,this._deleteFeatures,l);let d=this._xs.serializeToString(c);const h=a.geomType,u=a.geomField;if(h===Ke.GeometryCollection)if(e===Ze.Insert)d=d.replace(/<geometry>/g,`<geometry><MultiGeometry xmlns="http://www.opengis.net/gml" srsName="${i}"><geometryMember>`),d=d.replace(/<\/geometry>/g,"</geometryMember></MultiGeometry></geometry>");else if(e===Ze.Update){const e=`<MultiGeometry xmlns="http://www.opengis.net/gml" srsName="${i}"><geometryMember>`,t="</geometryMember></MultiGeometry>";d=d.replace(/(.*)(<Name>geometry<\/Name><Value>)(.*?)(<\/Value>)(.*)/g,`$1$2${e}$3${t}$4$5`)}d=e===Ze.Insert?d.replace(/<(\/?)\bgeometry\b>/g,`<$1${u}>`):d.replace(/<Name>geometry<\/Name>/g,`<Name>${u}</Name>`),this.hasLockFeature&&this.getUseLockFeature()&&e!==Ze.Insert&&(d=d.replace("</Transaction>",`<LockId>${this._options.advanced.lockFeatureParams.lockId}</LockId></Transaction>`));const p={"Content-Type":"text/xml",...this.getHeaders()},m=await fetch(this.getUrl(),{method:"POST",body:d,headers:p,credentials:this._options.credentials});if(!m.ok)throw new Error(Ie.errors.transaction+" "+m.status);const f=this._formatWFS.readTransactionResponse(await m.text());if(!Object.keys(f).length){const e=await m.text(),t=String(e).match(/<ows:ExceptionText>([\s\S]*?)<\/ows:ExceptionText>/);if(t)throw new Error(t[1])}if(e!==Ze.Delete)for(const e of t)Lt().getSource().removeFeature(e);lt(s).refresh(),Oe(!1),this._insertFeatures=[],this._updateFeatures=[],this._deleteFeatures=[],this._countRequests=0,o(f)}catch(e){Pe(e.message,e),Oe(!1),this._countRequests=0,i()}}),0)}))}_transformCircleToPolygon(e,t){const s=y.fromCircle(t);e.setGeometry(s)}_transformGeoemtryCollectionToGeometries(e,t){let s=t.getGeometries()[0];s instanceof g.Circle&&(s=y.fromCircle(s)),e.setGeometry(s)}_cloneFeature(e){dt(e);const t=e.getProperties();delete t.boundedBy,delete t._layerName_;const s=new X(t);return s.setId(e.getId()),s}async lockFeature(e,t,s=0){const o=new URLSearchParams({service:"wfs",version:this.getAdvanced().lockFeatureVersion,request:"LockFeature",typeName:t,expiry:String(this._options.advanced.lockFeatureParams.expiry),LockId:this._options.advanced.lockFeatureParams.lockId,releaseAction:this._options.advanced.lockFeatureParams.releaseAction,exceptions:"application/json",featureid:`${e}`}),n=this.getUrl()+"?"+o.toString();try{const o=await fetch(n,{headers:this._options.headers,credentials:this._options.credentials});if(!o.ok)throw new Error(Ie.errors.lockFeature);const r=await o.text();try{const o=JSON.parse(r);if("exceptions"in o){const n=o.exceptions;"CannotLockAllFeatures"===n[0].code?s?Pe(Ie.errors.lockFeature,n):this.lockFeature(e,t,1):Pe(n[0].text,n)}}catch(e){}return r}catch(e){Pe(e.message,e)}}}var It;!function(e){e.CAPABILITIES="capabilities",e.URL="url",e.HEADERS="headers",e.CREDENTIALS="credentials",e.ADVANCED="advanced",e.HASTRASNACTION="hasTransaction",e.HASLOCKFEATURE="hasLockFeature",e.HASDESCRIBEFEATURETYPE="hasDescribeFeatureType",e.USELOCKFEATURE="useLockFeature",e.ISLOADED="isLoaded"}(It||(It={}));class Nt extends he{constructor(e,t=null){super({id:e.getId(),position:t||v.getCenter(e.getGeometry().getExtent()),positioning:"center-center",offset:[0,-40],stopEvent:!0,element:Et("div",null,Et("div",{className:"ol-wfst--edit-button-cnt",onclick:()=>{this.dispatchEvent("editFields")}},Et("button",{className:"ol-wfst--edit-button",type:"button",title:Ie.labels.editFields},Et("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='448' height='448' viewBox='0 0 448 448'%3e %3cpath d='M222 296l29-29-38-38-29 29v14h24v24h14zM332 116c-2.25-2.25-6-2-8.25 0.25l-87.5 87.5c-2.25 2.25-2.5 6-0.25 8.25s6 2 8.25-0.25l87.5-87.5c2.25-2.25 2.5-6 0.25-8.25zM352 264.5v47.5c0 39.75-32.25 72-72 72h-208c-39.75 0-72-32.25-72-72v-208c0-39.75 32.25-72 72-72h208c10 0 20 2 29.25 6.25 2.25 1 4 3.25 4.5 5.75 0.5 2.75-0.25 5.25-2.25 7.25l-12.25 12.25c-2.25 2.25-5.25 3-8 2-3.75-1-7.5-1.5-11.25-1.5h-208c-22 0-40 18-40 40v208c0 22 18 40 40 40h208c22 0 40-18 40-40v-31.5c0-2 0.75-4 2.25-5.5l16-16c2.5-2.5 5.75-3 8.75-1.75s5 4 5 7.25zM328 80l72 72-168 168h-72v-72zM439 113l-23 23-72-72 23-23c9.25-9.25 24.75-9.25 34 0l38 38c9.25 9.25 9.25 24.75 0 34z'%3e%3c/path%3e%3c/svg%3e",alt:Ie.labels.editFields}))),Et("div",{className:"ol-wfst--edit-button-cnt",onclick:()=>{this.dispatchEvent("editGeom")}},Et("button",{class:"ol-wfst--edit-button",type:"button",title:Ie.labels.editGeom},Et("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='541' height='512' viewBox='0 0 541 512'%3e %3cpath fill='black' d='M103.306 228.483l129.493-125.249c-17.662-4.272-31.226-18.148-34.98-35.663l-0.055-0.307-129.852 125.248c17.812 4.15 31.53 18.061 35.339 35.662l0.056 0.308z'%3e%3c/path%3e %3cpath fill='black' d='M459.052 393.010c-13.486-8.329-22.346-23.018-22.373-39.779v-0.004c-0.053-0.817-0.082-1.772-0.082-2.733s0.030-1.916 0.089-2.863l-0.007 0.13-149.852 71.94c9.598 8.565 15.611 20.969 15.611 34.779 0 0.014 0 0.029 0 0.043v-0.002c-0.048 5.164-0.94 10.104-2.544 14.711l0.098-0.322z'%3e%3c/path%3e %3cpath fill='black' d='M290.207 57.553c-0.009 15.55-7.606 29.324-19.289 37.819l-0.135 0.093 118.054 46.69c-0.216-1.608-0.346-3.48-0.36-5.379v-0.017c0.033-16.948 9.077-31.778 22.596-39.953l0.209-0.118-122.298-48.056c0.659 2.633 1.098 5.693 1.221 8.834l0.002 0.087z'%3e%3c/path%3e %3cpath fill='black' d='M241.36 410.132l-138.629-160.067c-4.734 17.421-18.861 30.61-36.472 33.911l-0.29 0.045 143.881 166.255c1.668-18.735 14.197-34.162 31.183-40.044l0.327-0.099z'%3e%3c/path%3e %3cpath fill='black' d='M243.446 115.105c-31.785 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.785 0 57.552 25.767 57.552 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM243.446 21.582c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.104-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M483.224 410.78c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.552 25.767 57.552 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM483.224 317.257c-19.866 0-35.97 16.104-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M57.553 295.531c-31.785 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.785 0 57.553 25.767 57.553 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM57.553 202.008c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c-0.041-19.835-16.13-35.898-35.97-35.898 0 0 0 0 0 0v0z'%3e%3c/path%3e %3cpath fill='black' d='M256.036 512.072c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.553 25.767 57.553 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM256.036 418.55c-19.866 0-35.97 16.104-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M435.24 194.239c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.553 25.767 57.553 57.553v0c0 31.785-25.767 57.553-57.553 57.553v0zM435.24 100.716c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e%3c/svg%3e",alt:Ie.labels.editGeom}))))})}}const Ot=document.createElement("div");class Rt extends t.Control{_options;_i18n;_map;_view;_viewport;_initialized=!1;_layersControl;_overlay;_interactionWfsSelect;_interactionSelectModify;_collectionModify;_interactionModify;_interactionSnap;_interactionDraw;_keyClickWms;_keyRemove;_keySelect;_controlApplyDiscardChanges;_controlWidgetToolsDiv;_selectDraw;_currentZoom;_lastZoom;_editFeature;_editFeatureOriginal;_uploads;_editFields;constructor(e){super({target:null,element:Ot,render:()=>{this._map||this._init()}}),((e="en",t=null)=>{e in xe&&(Ie=xe[e]),t&&(Ie={...Ie,...t})})(e.language,e.i18n);const t={layers:null,evtType:"singleclick",active:!0,showControl:!0,language:"en",uploadFormats:".geojson,.json,.kml",processUpload:null,modal:{animateClass:"fade",animateInClass:"show",transition:300,backdropTransition:150,templates:{dialog:'<div class="modal-dialog modal-dialog-centered"></div>',headerClose:`<button type="button" class="btn-close" data-dismiss="modal" aria-label="${Ie.labels.close}"><span aria-hidden="true">×</span></button>`}}};this._options=Mt(t,e),rt(this._options.layers[0]),this._controlWidgetToolsDiv=Ot,this._controlWidgetToolsDiv.className="ol-wfst--tools-control",this._uploads=new Tt(this._options),this._editFields=new At(this._options.modal)}getLayers(){return Object.values(at())}getLayerByName(e=""){const t=at();return e&&e in t?t[e]:null}async _initMapAndLayers(){try{const e=this._options.layers;if(e.length){let t=0,s=0;e.forEach((e=>{var o;e.getVisible()&&s++,e.on("layerRendered",(()=>{t++,t>=s&&(this._initialized||(this.dispatchEvent("load"),this._initialized=!0),Oe(!1))})),e.on("change:describeFeatureType",(()=>{const t=this._layersControl.addLayerEl(e);e.on("change:isVisible",(()=>{const s="ol-wfst--layer-not-visible";e.isVisibleByZoom()?t.classList.remove(s):t.classList.add(s)})),e.set(pt.ISVISIBLE,this._currentZoom>e.getMinZoom()),this.dispatchEvent(new Gt({type:"describeFeatureType",layer:e,data:e.getDescribeFeatureType()}))})),e._init(),this._map.addLayer(e),o={[e.get(pt.NAME)]:e},Object.assign(ot,o)})),this._createMapElements(this._options.showControl,this._options.active)}}catch(e){Oe(!1),Pe(e.message,e)}}_init(){var e,t;this._map=super.getMap(),this._view=this._map.getView(),this._viewport=this._map.getViewport(),e=this._map,Je=e,this._uploads.on("addedFeatures",(({features:e})=>{it().insertFeatures(e)})),this._uploads.on("loadedFeatures",(({features:e})=>{this.activateEditMode();const t=Lt().getSource();t.addFeatures(e),this._view.fit(t.getExtent(),{size:this._map.getSize(),maxZoom:21,padding:[100,100,100,100]})})),this._editFields.on("save",(({feature:e})=>{this._collectionModify.remove(e)})),this._editFields.dispose("delete",(({feature:e})=>{this._deleteFeature(e,!0)})),this._addMapEvents(),t=this._options.modal,Te=t,this._controlWidgetToolsDiv.append((Ne=document.createElement("div"),Ne.className="ol-wfst--tools-control--loading",Ne.innerHTML=Ie.labels.loading,Ne)),this._initMapAndLayers()}async _createMapElements(e,t){this._prepareEditLayer(),this._addInteractions(),this._addInteractionHandlers(),e&&this._addMapControl(),this.activateEditMode(t)}_addInteractions(){const t=()=>{this._collectionModify=new J,this._interactionWfsSelect=new s.Select({hitTolerance:10,style:e=>Pt(e),toggleCondition:n.never,filter:(e,t)=>tt()!==Qe.Edit&&t&&t instanceof _t&&t===it()}),this._map.addInteraction(this._interactionWfsSelect),this._interactionWfsSelect.on("select",(({selected:e,deselected:t,mapBrowserEvent:s})=>{const o=s.coordinate;e.length&&e.forEach((e=>{if(!ht(e)){const t=this._interactionWfsSelect.getLayer(e);t.getSource().removeFeature(e),this._addFeatureToEditMode(e,o,t.get(pt.NAME))}})),t.length&&tt()!==Qe.Edit&&t.forEach((e=>{this._collectionModify.remove(e)}))}))},o=()=>{this._interactionSelectModify=new s.Select({style:e=>Pt(e),layers:[Lt()],toggleCondition:n.never,removeCondition:()=>tt()===Qe.Edit}),this._map.addInteraction(this._interactionSelectModify),this._collectionModify=this._interactionSelectModify.getFeatures(),this._keyClickWms=this._map.on(this._options.evtType,(async e=>{if(!this._map.hasFeatureAtPixel(e.pixel)&&tt()!==Qe.Edit){const t=it();if(!t.getVisible()||!t.isVisibleByZoom()||t instanceof _t)return;const s=await t.getFeaturesByClickEvent(e);if(!s.length)return;this._addFeatureToEditMode(s[0],e.coordinate,t.get(pt.NAME))}}))};this._options.layers.find((e=>e instanceof _t))&&t(),this._options.layers.find((e=>e instanceof wt))&&o(),this._interactionModify=new s.Modify({style:()=>tt()===Qe.Edit?new e.Style({image:new e.Circle({radius:6,fill:new e.Fill({color:"#ff0000"}),stroke:new e.Stroke({width:2,color:"rgba(5, 5, 5, 0.9)"})})}):void 0,features:this._collectionModify,condition:e=>n.primaryAction(e)&&tt()===Qe.Edit}),this._map.addInteraction(this._interactionModify),this._interactionSnap=new s.Snap({source:Lt().getSource()}),this._map.addInteraction(this._interactionSnap)}_prepareEditLayer(){this._map.addLayer(Lt())}_addMapEvents(){(()=>{document.addEventListener("keydown",(({key:e})=>{if(!document.querySelector("input:focus")&&"Delete"===e){const e=this._collectionModify;e&&e.forEach((e=>{this._deleteFeature(e,!0)}))}}))})(),this._map.on("moveend",(()=>{if(this._currentZoom=this._view.getZoom(),this._currentZoom!==this._lastZoom){const e=at();Object.keys(e).forEach((t=>{const s=e[t];this._currentZoom>s.getMinZoom()?s.get(pt.ISVISIBLE)||s.set(pt.ISVISIBLE,!0):s.get(pt.ISVISIBLE)&&s.set(pt.ISVISIBLE,!1)})),this._lastZoom=this._currentZoom}}))}_addInteractionHandlers(){this._interactionModify.on("modifyend",(e=>{ct(e.features.item(0)),super.dispatchEvent(e)})),this._interactionModify.on("modifystart",(e=>{super.dispatchEvent(e)})),this._onDeselectFeatureEvent(),this._onRemoveFeatureEvent()}_addMapControl(){this._layersControl=new Ft(this._options.showUpload?this._uploads:null,this._options.uploadFormats),this._layersControl.on("drawMode",(()=>{if(tt()===Qe.Draw)St(),this.activateEditMode();else{it().isVisibleByZoom()?this.activateDrawMode(it()):Pe(Ie.errors.layerNotVisible)}})),this._layersControl.on("changeGeom",(()=>{tt()===Qe.Draw&&this.activateDrawMode(it())}));const e=this._layersControl.render();this._selectDraw=e.querySelector(".wfst--tools-control--select-draw"),this._controlWidgetToolsDiv.append(e)}_deselectEditFeature(e){this._removeOverlayHelper(e)}_restoreFeatureToLayer(e,t){t=t||e.get("_layerName_");at()[t].getSource().addFeature(e)}_removeFeatureFromTmpLayer(e){Lt().getSource().removeFeature(e)}_onDeselectFeatureEvent(){const e=e=>{const t=e.get("_layerName_"),s=this._options.layers.find((e=>e.get(pt.NAME)===t));s instanceof _t&&this._interactionWfsSelect.getFeatures().remove(e),ht(e)?s.transactFeatures(Ze.Update,e):(s instanceof _t&&this._restoreFeatureToLayer(e,t),this._removeFeatureFromTmpLayer(e))};this._keySelect=this._collectionModify.on("remove",(t=>{const s=t.element;this._deselectEditFeature(s),e(s),this._editModeOff()}))}_onRemoveFeatureEvent(){this._keyRemove=Lt().getSource().on("removefeature",(e=>{const t=e.feature;if(!t.get("_delete_"))return;this._keySelect&&r.unByKey(this._keySelect);const s=t.get("_layerName_");this.getLayerByName(s).transactFeatures(Ze.Delete,t),this._deselectEditFeature(t),this._editModeOff(),this._keySelect&&setTimeout((()=>{this._onDeselectFeatureEvent()}),150)}))}_editModeOn(e){this._editFeatureOriginal=e.clone(),et(Qe.Edit),Lt().getSource().changed(),this._removeOverlayHelper(e),this._controlApplyDiscardChanges=new kt(e),this._controlApplyDiscardChanges.on("cancel",(({feature:e})=>{e.setGeometry(this._editFeatureOriginal.getGeometry()),dt(e),this._collectionModify.remove(e)})),this._controlApplyDiscardChanges.on("apply",(({feature:e})=>{Oe(),this._collectionModify.remove(e)})),this._controlApplyDiscardChanges.on("delete",(({feature:e})=>{this._deleteFeature(e,!0)})),this._map.addControl(this._controlApplyDiscardChanges)}_editModeOff(){et(null),this._map.removeControl(this._controlApplyDiscardChanges)}_deleteFeature(e,t){const s=()=>{(Array.isArray(e)?e:[e]).forEach((e=>{e.set("_delete_",!0,!0),Lt().getSource().removeFeature(e)})),this._collectionModify.clear();const t=e.get("_layerName_");this._options.layers.find((e=>e.get(pt.NAME)===t))instanceof _t&&this._interactionWfsSelect.getFeatures().remove(e)};if(t){Le.confirm(Ie.labels.confirmDelete,{...this._options.modal}).show().once("dismiss",(function(e,t,o){o&&o.value&&s()}))}else s()}_addFeatureToEditMode(e,t=null,s=null){if(this._collectionModify.getLength())return;s&&e.set("_layerName_",s);if((e?e.getProperties():"")&&e.getGeometry()){Lt().getSource().addFeature(e),this._collectionModify.push(e);const o=new Nt(e,t);o.on("editFields",(()=>{this._editFields.show(e)})),o.on("editGeom",(()=>{this._editModeOn(e)})),this._map.addOverlay(o);const n=lt(s);n&&n.maybeLockFeature(e.getId())}}activateDrawMode(e){const t=e=>{this.activateEditMode(!1),this._interactionDraw&&this._map.removeInteraction(this._interactionDraw);const t=this._selectDraw.value;this._interactionDraw=new s.Draw({source:Lt().getSource(),type:t,style:e=>Pt(e),stopClick:!0}),this._map.addInteraction(this._interactionDraw),this._interactionDraw.on("drawstart",(e=>{super.dispatchEvent(e)})),this._interactionDraw.on("drawend",(t=>{const s=t.feature;e.transactFeatures(Ze.Insert,s),super.dispatchEvent(t)}))};if(this._interactionDraw||e){if(e){if(!e.getVisible())return;(()=>{const e=document.querySelector(".ol-wfst--tools-control-btn-draw");e&&e.classList.add("wfst--active")})(),this._viewport.classList.add("draw-mode"),t(e)}else this._map.removeInteraction(this._interactionDraw),this._viewport.classList.remove("draw-mode");et(e?Qe.Draw:null)}}activateEditMode(e=!0){e?((()=>{const e=document.querySelector(".ol-wfst--tools-control-btn-edit");e&&e.classList.add("wfst--active")})(),this.activateDrawMode(!1)):this._collectionModify.clear(),this._interactionSelectModify&&this._interactionSelectModify.setActive(e),this._interactionModify.setActive(e),this._interactionWfsSelect&&this._interactionWfsSelect.setActive(e)}_removeOverlayHelper(e){const t=e.getId();if(!t)return;const s=this._map.getOverlayById(t);s&&this._map.removeOverlay(s)}}class Gt extends b.default{data;layer;constructor(e){super(e.type),this.layer=e.layer,this.data=e.data}}var Dt={WfsLayer:_t,WmsLayer:wt,Geoserver:xt};return Object.assign(Rt,Dt),Rt}));
|
|
16
2
|
//# sourceMappingURL=ol-wfst.min.js.map
|