ol-wfst 3.0.2 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
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 S(){}var L="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,S);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]=S,++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_&&L({},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_&&L(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 Se=document.createElement("div"),Le=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,""),Se.innerHTML="",Se.innerHTML=e,!0===t?Se.childNodes:Se.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({},Le,Oe._baseOptions||{})}static get version(){return"0.9.0"}static alert(e,t={}){let o=Object.assign({},Le,{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({},Le,{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",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",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:"无法从图层获得数据",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:{},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});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});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});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});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});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});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);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;setTimeout((()=>p(this,void 0,void 0,(function*(){try{if(c!==this._countRequests)return;let e=this._view.getProjection().getCode();e="EPSG:4326"===e?"urn:x-ogc:def:crs:EPSG:4326":e;const n={featureNS:this._geoServerData[i].namespace,featureType:i,srsName:e,featurePrefix:null,nativeElements:null,version:this._options.geoServerAdvanced.wfsTransactionVersion},s=this._formatWFS.writeTransaction(this._insertFeatures,this._updateFeatures,this._deleteFeatures,n);let r=this._xs.serializeToString(s);const a=this._geoServerData[i].geomType,l=this._geoServerData[i].geomField;if(a===Pe.GeometryCollection)if("insert"===t)r=r.replace(/<geometry>/g,`<geometry><MultiGeometry xmlns="http://www.opengis.net/gml" srsName="${e}"><geometryMember>`),r=r.replace(/<\/geometry>/g,"</geometryMember></MultiGeometry></geometry>");else if("update"===t){const t=`<MultiGeometry xmlns="http://www.opengis.net/gml" srsName="${e}"><geometryMember>`,o="</geometryMember></MultiGeometry>";r=r.replace(/(.*)(<Name>geometry<\/Name><Value>)(.*?)(<\/Value>)(.*)/g,`$1$2${t}$3${o}$4$5`)}r="insert"===t?r.replace(/<(\/?)\bgeometry\b>/g,`<$1${l}>`):r.replace(/<Name>geometry<\/Name>/g,`<Name>${l}</Name>`),this._hasLockFeature&&this._useLockFeature&&"insert"!==t&&(r=r.replace("</Transaction>","<LockId>GeoServer</LockId></Transaction>"));const d=Object.assign({"Content-Type":"text/xml"},this._options.headers),h=yield fetch(this._options.geoServerUrl,{method:"POST",body:r,headers:d});if(!h.ok)throw new Error(this._i18n.errors.transaction+" "+h.status);const u=this._formatWFS.readTransactionResponse(h);if(!Object.keys(u).length){const e=yield h.text(),t=String(e).match(/<ows:ExceptionText>([\s\S]*?)<\/ows:ExceptionText>/);t&&this._showError(t[1])}if("delete"!==t)for(const e of o)this._editLayer.getSource().removeFeature(e);const{mode:p}=this._options.layers.find((e=>e.name===i));"wfs"===p?(e=>{e.getSource().refresh()})(this._mapLayers[i]):"wms"===p&&(e=>{const t=e.getSource();t.refresh();const o=t.getParams();o.t=(new Date).getMilliseconds(),t.updateParams(o)})(this._mapLayers[i]),this._hideLoading()}catch(e){this._showError(e.message,e)}this._insertFeatures=[],this._updateFeatures=[],this._deleteFeatures=[],this._countRequests=0}))),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){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}));
16
- //# sourceMappingURL=ol-wfst.min.js.map
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="6.15.1",v=(_=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)}),b=function(e){function t(t){var o=this,i="Assertion failed. See https://openlayers.org/en/"+("v"+g.split("-")[0])+"/doc/errors/#"+t+" for details.";return(o=e.call(this,i)||this).code=t,o.name="AssertionError",o.message=i,o}return v(t,e),t}(Error),w=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}(),E="propertychange",L=function(){function e(){this.disposed=!1}return e.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposeInternal())},e.prototype.disposeInternal=function(){},e}();function S(){}var F="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 C(e){for(var t in e)delete e[t]}var T=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])},e(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)}}(),M=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 T(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,o=t?e:e.type,i=this.listeners_&&this.listeners_[o];if(i){var n=t?new w(e):e;n.target||(n.target=this.eventTarget_||this);var s,r=this.dispatching_||(this.dispatching_={}),a=this.pendingRemovals_||(this.pendingRemovals_={});o in r||(r[o]=0,a[o]=0),++r[o];for(var l=0,c=i.length;l<c;++l)if(!1===(s="handleEvent"in i[l]?i[l].handleEvent(n):i[l].call(this,n))||n.propagationStopped){s=!1;break}if(0==--r[o]){var d=a[o];for(delete a[o];d--;)this.removeEventListener(o,S);delete r[o]}return s}},t.prototype.disposeInternal=function(){this.listeners_&&C(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]=S,++this.pendingRemovals_[e]):(o.splice(i,1),0===o.length&&delete this.listeners_[e]))}},t}(L),O="change";function P(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 k(e,t,o,i){return P(e,t,o,i,!0)}function x(e){e&&e.target&&(e.target.removeEventListener(e.type,e.listener),C(e))}var j=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])},e(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)}}(),G=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 j(t,e),t.prototype.changed=function(){++this.revision_,this.dispatchEvent(O)},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]=P(this,e[n],t);return i}return P(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]=k(this,e[n],t)}else o=k(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)x(e[t]);else x(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}(M);G.prototype.on,G.prototype.once,G.prototype.un;var N=G,A=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])},e(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)}}(),I=function(e){function t(t,o,i){var n=e.call(this,t)||this;return n.key=o,n.oldValue=i,n}return A(t,e),t}(w),q=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 A(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_&&F({},this.values_)||{}},t.prototype.hasProperties=function(){return!!this.values_},t.prototype.notify=function(e,t){var o;o="change:".concat(e),this.hasListener(o)&&this.dispatchEvent(new I(o,e,t)),o=E,this.hasListener(o)&&this.dispatchEvent(new I(o,e,t))},t.prototype.addChangeListener=function(e,t){this.addEventListener("change:".concat(e),t)},t.prototype.removeChangeListener=function(e,t){this.removeEventListener("change:".concat(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_&&F(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}(N),D=q,z="add",$="remove",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])},e(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)}}(),R="length",H=function(e){function t(t,o,i){var n=e.call(this,t)||this;return n.element=o,n.index=i,n}return V(t,e),t}(w),U=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 V(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(R)},t.prototype.insertAt=function(e,t){this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new H(z,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 H($,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 H($,i,e)),this.dispatchEvent(new H(z,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(R,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 b(58)},t}(D);var W=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])},e(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)}}(),B=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 W(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_&&(x(this.geometryChangeKey_),this.geometryChangeKey_=null);var e=this.getGeometry();e&&(this.geometryChangeKey_=P(e,O,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 b(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}(D);var K=B;function Z(e){var t=e.offsetWidth,o=getComputedStyle(e);return t+=parseInt(o.marginLeft,10)+parseInt(o.marginRight,10)}function J(e){var t=e.offsetHeight,o=getComputedStyle(e);return t+=parseInt(o.marginTop,10)+parseInt(o.marginBottom,10)}function X(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 Y="postrender",Q=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])},e(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)}}(),ee="element",te="map",oe="offset",ie="position",ne="positioning",se=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(ee,o.handleElementChanged),o.addChangeListener(te,o.handleMapChanged),o.addChangeListener(oe,o.handleOffsetChanged),o.addChangeListener(ie,o.handlePositionChanged),o.addChangeListener(ne,o.handlePositioningChanged),void 0!==t.element&&o.setElement(t.element),o.setOffset(void 0!==t.offset?t.offset:[0,0]),o.setPositioning(t.positioning||"top-left"),void 0!==t.position&&o.setPosition(t.position),o}return Q(t,e),t.prototype.getElement=function(){return this.get(ee)},t.prototype.getId=function(){return this.id},t.prototype.getMap=function(){return this.get(te)||null},t.prototype.getOffset=function(){return this.get(oe)},t.prototype.getPosition=function(){return this.get(ie)},t.prototype.getPositioning=function(){return this.get(ne)},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),x(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);var t=this.getMap();if(t){this.mapPostrenderListenerKey=P(t,Y,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(ee,e)},t.prototype.setMap=function(e){this.set(te,e)},t.prototype.setOffset=function(e){this.set(oe,e)},t.prototype.setPosition=function(e){this.set(ie,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(ie)){var o,i,n=this.getRect(t.getTargetElement(),t.getSize()),s=this.getElement(),r=this.getRect(s,[Z(s),J(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(ne,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%";"bottom-right"==n||"center-right"==n||"top-right"==n?a="-100%":"bottom-center"!=n&&"center-center"!=n&&"top-center"!=n||(a="-50%"),"bottom-left"==n||"bottom-center"==n||"bottom-right"==n?l="-100%":"center-left"!=n&&"center-center"!=n&&"center-right"!=n||(l="-50%");var c="translate(".concat(a,", ").concat(l,") translate(").concat(s,", ").concat(r,")");this.rendered.transform_!=c&&(this.rendered.transform_=c,o.transform=c,o.msTransform=c)},t.prototype.getOptions=function(){return this.options},t}(D),re=se;function ae(){}function le(){le.init.call(this)}function ce(e){return void 0===e._maxListeners?le.defaultMaxListeners:e._maxListeners}function de(e,t,o){if(t)e.call(o);else for(var i=e.length,n=ge(e,i),s=0;s<i;++s)n[s].call(o)}function he(e,t,o,i){if(t)e.call(o,i);else for(var n=e.length,s=ge(e,n),r=0;r<n;++r)s[r].call(o,i)}function ue(e,t,o,i,n){if(t)e.call(o,i,n);else for(var s=e.length,r=ge(e,s),a=0;a<s;++a)r[a].call(o,i,n)}function pe(e,t,o,i,n,s){if(t)e.call(o,i,n,s);else for(var r=e.length,a=ge(e,r),l=0;l<r;++l)a[l].call(o,i,n,s)}function fe(e,t,o,i){if(t)e.apply(o,i);else for(var n=e.length,s=ge(e,n),r=0;r<n;++r)s[r].apply(o,i)}function me(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 ae,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=ce(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 ye(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 _e(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 ge(e,t){for(var o=new Array(t);t--;)o[t]=e[t];return o}ae.prototype=Object.create(null),le.EventEmitter=le,le.usingDomains=!1,le.prototype.domain=void 0,le.prototype._events=void 0,le.prototype._maxListeners=void 0,le.defaultMaxListeners=10,le.init=function(){this.domain=null,le.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new ae,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},le.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},le.prototype.getMaxListeners=function(){return ce(this)},le.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:de(o,d,this);break;case 2:he(o,d,this,arguments[1]);break;case 3:ue(o,d,this,arguments[1],arguments[2]);break;case 4:pe(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];fe(o,d,this,n)}return!0},le.prototype.addListener=function(e,t){return me(this,e,t,!1)},le.prototype.on=le.prototype.addListener,le.prototype.prependListener=function(e,t){return me(this,e,t,!0)},le.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,ye(this,e,t)),this},le.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,ye(this,e,t)),this},le.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 ae:(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 ae,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},le.prototype.off=function(e,t){return this.removeListener(e,t)},le.prototype.removeAllListeners=function(e){var t,o;if(!(o=this._events))return this;if(!o.removeListener)return 0===arguments.length?(this._events=new ae,this._eventsCount=0):o[e]&&(0==--this._eventsCount?this._events=new ae: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 ae,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},le.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):[]},le.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):_e.call(e,t)},le.prototype.listenerCount=_e,le.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};const ve=document.createElement("div"),be=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}),we=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"}}]}),Ee={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 Le(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 Se(e,t){return e.nodeName?e:(e=e.replace(/(\t|\n$)/g,""),ve.innerHTML="",ve.innerHTML=e,!0===t?ve.childNodes:ve.childNodes[0])}class Fe extends le{static set templates(e){this._baseTemplates=e}static get templates(){return Object.assign({},Ee,Fe._baseTemplates||{})}static set buttons(e){this._baseButtons=e}static get buttons(){return Object.assign({},we,Fe._baseButtons||{})}static set options(e){this._baseOptions=e}static get options(){return Object.assign({},be,Fe._baseOptions||{})}static get version(){return"0.9.0"}static alert(e,t={}){let o=Object.assign({},be,{title:e,content:!1,construct:!0,headerClose:!1,buttons:Fe.buttons.alert},t);return new Fe(o)}static confirm(e,t={}){let o=Object.assign({},be,{title:e,content:!1,construct:!0,headerClose:!1,buttons:Fe.buttons.confirm},t);return new Fe(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({},Fe.options,e),this._templates=Object.assign({},Fe.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=Fe.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.`);Le(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=Se(o.container),e.dialog=Se(o.dialog),e.content=Se(o.content),e.header=Se(o.header),e.headerClose=Se(o.headerClose),e.body=Se(o.body),e.footer=Se(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");Le(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,Le(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=Se(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 Ce,Te=X(Object.freeze({__proto__:null,default:Fe})).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"}(Ce||(Ce={}));var Me=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 Oe=document.createElement("div");class Pe extends o.Control{constructor(e){super({target:null,element:Oe}),this._initialized=!1,this._i18n=e.language&&e.language in Me?Me[e.language]:Me.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=ke(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=Oe,this._controlWidgetToolsDiv.className="ol-wfst--tools-control",this._initAsyncOperations()}getLayers(e=""){return e&&e in this._mapLayers?this._mapLayers[e]:Object.values(this._mapLayers)}_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._isVisible&&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 U,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=[Ce.Point,Ce.MultiPoint,Ce.LineString,Ce.MultiLineString,Ce.Polygon,Ce.MultiPolygon,Ce.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._initialized||(this.dispatchEvent("load"),this._initialized=!0),this._modalLoading&&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){Te.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)},r=(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 a=e=>{this._removeFeatureFromEditList(e);const t=e.getProperties();delete t.boundedBy,delete t._layerName_;const o=new K(t);return o.setId(e.getId()),o},c=[];for(const i of o){let o=a(i);const s=o.getGeometry();s instanceof e.GeometryCollection?r(o,s):s instanceof e.Circle&&n(o,s),"insert"===t&&this._options.beforeInsertFeature&&(o=this._options.beforeInsertFeature(o)),o&&c.push(o)}if(!c.length)return this._showError(this._i18n.errors.noValidGeometry),!1;switch(t){case"insert":this._insertFeatures=[...this._insertFeatures,...c];break;case"update":this._updateFeatures=[...this._updateFeatures,...c];break;case"delete":this._deleteFeatures=[...this._deleteFeatures,...c]}this._countRequests++;const d=this._countRequests;return new Promise(((e,n)=>{setTimeout((()=>p(this,void 0,void 0,(function*(){try{if(d!==this._countRequests)return;let n=this._view.getProjection().getCode();n="EPSG:4326"===n?"urn:x-ogc:def:crs:EPSG:4326":n;const r=this._geoServerData[i];if(!r)throw new Error(this._i18n.errors.layerNotFound);const a={featureNS:r.namespace,featureType:i,srsName:n,featurePrefix:null,nativeElements:null,version:this._options.geoServerAdvanced.wfsTransactionVersion},l=this._formatWFS.writeTransaction(this._insertFeatures,this._updateFeatures,this._deleteFeatures,a);let c=this._xs.serializeToString(l);const h=r.geomType,u=r.geomField;if(h===Ce.GeometryCollection)if("insert"===t)c=c.replace(/<geometry>/g,`<geometry><MultiGeometry xmlns="http://www.opengis.net/gml" srsName="${n}"><geometryMember>`),c=c.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>";c=c.replace(/(.*)(<Name>geometry<\/Name><Value>)(.*?)(<\/Value>)(.*)/g,`$1$2${e}$3${t}$4$5`)}c="insert"===t?c.replace(/<(\/?)\bgeometry\b>/g,`<$1${u}>`):c.replace(/<Name>geometry<\/Name>/g,`<Name>${u}</Name>`),this._hasLockFeature&&this._useLockFeature&&"insert"!==t&&(c=c.replace("</Transaction>","<LockId>GeoServer</LockId></Transaction>"));const p=Object.assign({"Content-Type":"text/xml"},this._options.headers),f=yield fetch(this._options.geoServerUrl,{method:"POST",body:c,headers:p,credentials:this._options.credentials});if(!f.ok)throw new Error(this._i18n.errors.transaction+" "+f.status);const m=this._formatWFS.readTransactionResponse(f);if(!Object.keys(m).length){const e=yield f.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 y=this._mapLayers[i];y instanceof s.Vector?(e=>{e.getSource().refresh()})(y):y instanceof s.Tile&&(e=>{const t=e.getSource();t.refresh();const o=t.getParams();o.t=(new Date).getMilliseconds(),t.updateParams(o)})(y),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 Ce.Point:case Ce.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){Te.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 re({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 Te(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===Ce.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===Ce.GeometryCollection?(i=Ce.LineString,o(i,"all")):n===Ce.LinearRing?(i=Ce.LineString,o(i,[Ce.Circle,Ce.LinearRing,Ce.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":default:i="text";break;case"xsd:number":case"xsd:int":i="number";break;case"xsd:date-time":i="datetime"}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 Te(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 ke=(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)?ke(n,i):i}))})),e);return Pe}));
16
+ //# sourceMappingURL=ol-wfst.min.js.map