ol-wfst 4.0.6 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +790 -782
- package/dist/Geoserver.d.ts +15 -15
- package/dist/Geoserver.d.ts.map +1 -1
- package/dist/WfsLayer.d.ts +10 -10
- package/dist/WfsLayer.d.ts.map +1 -1
- package/dist/WmsLayer.d.ts +11 -11
- package/dist/WmsLayer.d.ts.map +1 -1
- package/dist/modules/EditControlChanges.d.ts +9 -9
- package/dist/modules/EditControlChanges.d.ts.map +1 -1
- package/dist/modules/EditFieldsModal.d.ts +3 -2
- package/dist/modules/EditFieldsModal.d.ts.map +1 -1
- package/dist/modules/EditOverlay.d.ts +4 -3
- package/dist/modules/EditOverlay.d.ts.map +1 -1
- package/dist/modules/LayersControl.d.ts +2 -3
- package/dist/modules/LayersControl.d.ts.map +1 -1
- package/dist/modules/Uploads.d.ts +6 -3
- package/dist/modules/Uploads.d.ts.map +1 -1
- package/dist/modules/base/BaseLayer.d.ts +4 -4
- package/dist/modules/base/BaseLayer.d.ts.map +1 -1
- package/dist/modules/base/WfsSource.d.ts +1 -1
- package/dist/modules/base/WfsSource.d.ts.map +1 -1
- package/dist/modules/base/WmsSource.d.ts +1 -1
- package/dist/modules/base/WmsSource.d.ts.map +1 -1
- package/dist/modules/editLayer.d.ts +2 -2
- package/dist/modules/editLayer.d.ts.map +1 -1
- package/dist/modules/state.d.ts +2 -2
- package/dist/modules/state.d.ts.map +1 -1
- package/dist/modules/styleFunction.d.ts +3 -3
- package/dist/modules/styleFunction.d.ts.map +1 -1
- package/dist/ol-wfst.d.ts +20 -20
- package/dist/ol-wfst.d.ts.map +1 -1
- package/dist/ol-wfst.js +321 -2105
- package/dist/ol-wfst.js.map +1 -1
- package/dist/ol-wfst.min.js +1 -1
- package/dist/ol-wfst.min.js.map +1 -1
- package/lib/Geoserver.d.ts +15 -15
- package/lib/Geoserver.d.ts.map +1 -1
- package/lib/WfsLayer.d.ts +10 -10
- package/lib/WfsLayer.d.ts.map +1 -1
- package/lib/WmsLayer.d.ts +11 -11
- package/lib/WmsLayer.d.ts.map +1 -1
- package/lib/modules/EditControlChanges.d.ts +9 -9
- package/lib/modules/EditControlChanges.d.ts.map +1 -1
- package/lib/modules/EditFieldsModal.d.ts +3 -2
- package/lib/modules/EditFieldsModal.d.ts.map +1 -1
- package/lib/modules/EditOverlay.d.ts +4 -3
- package/lib/modules/EditOverlay.d.ts.map +1 -1
- package/lib/modules/LayersControl.d.ts +2 -3
- package/lib/modules/LayersControl.d.ts.map +1 -1
- package/lib/modules/Uploads.d.ts +6 -3
- package/lib/modules/Uploads.d.ts.map +1 -1
- package/lib/modules/base/BaseLayer.d.ts +4 -4
- package/lib/modules/base/BaseLayer.d.ts.map +1 -1
- package/lib/modules/base/WfsSource.d.ts +1 -1
- package/lib/modules/base/WfsSource.d.ts.map +1 -1
- package/lib/modules/base/WmsSource.d.ts +1 -1
- package/lib/modules/base/WmsSource.d.ts.map +1 -1
- package/lib/modules/editLayer.d.ts +2 -2
- package/lib/modules/editLayer.d.ts.map +1 -1
- package/lib/modules/state.d.ts +2 -2
- package/lib/modules/state.d.ts.map +1 -1
- package/lib/modules/styleFunction.d.ts +3 -3
- package/lib/modules/styleFunction.d.ts.map +1 -1
- package/lib/ol-wfst.d.ts +20 -20
- package/lib/ol-wfst.d.ts.map +1 -1
- package/lib/ol-wfst.js +81 -196
- package/lib/ol-wfst.js.map +1 -1
- package/package.json +5 -5
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
package/dist/ol-wfst.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("ol/style/Circle"),require("ol/style/Fill"),require("ol/style/Stroke"),require("ol/style/Style"),require("ol/control/Control"),require("ol/interaction/Draw"),require("ol/interaction/Modify"),require("ol/interaction/Select"),require("ol/interaction/Snap"),require("ol/Collection"),require("ol/events/Event"),require("ol/events/condition"),require("ol/Observable"),require("ol/layer/Vector"),require("ol/layer/Base"),require("ol/format/GeoJSON"),require("ol/source/Vector"),require("ol/proj"),require("ol/loadingstrategy"),require("ol/layer/Tile"),require("ol/source/TileWMS"),require("ol/geom"),require("ol/format"),require("ol/control"),require("ol/style"),require("ol/Object"),require("ol/geom/Circle"),require("ol/geom/GeometryCollection"),require("ol/Feature"),require("ol/format/KML"),require("ol/format/WFS"),require("ol/geom/Polygon"),require("ol/extent")):"function"==typeof define&&define.amd?define(["ol/style/Circle","ol/style/Fill","ol/style/Stroke","ol/style/Style","ol/control/Control","ol/interaction/Draw","ol/interaction/Modify","ol/interaction/Select","ol/interaction/Snap","ol/Collection","ol/events/Event","ol/events/condition","ol/Observable","ol/layer/Vector","ol/layer/Base","ol/format/GeoJSON","ol/source/Vector","ol/proj","ol/loadingstrategy","ol/layer/Tile","ol/source/TileWMS","ol/geom","ol/format","ol/control","ol/style","ol/Object","ol/geom/Circle","ol/geom/GeometryCollection","ol/Feature","ol/format/KML","ol/format/WFS","ol/geom/Polygon","ol/extent"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Wfst=t(e.ol.style.Circle,e.ol.style.Fill,e.ol.style.Stroke,e.ol.style.Style,e.ol.control.Control,e.ol.interaction.Draw,e.ol.interaction.Modify,e.ol.interaction.Select,e.ol.interaction.Snap,e.ol.Collection,e.ol.events.Event,e.ol.events.condition,e.ol.Observable,e.ol.layer.Vector,e.ol.layer.Base,e.ol.format.GeoJSON,e.ol.source.Vector,e.ol.proj,e.ol.loadingstrategy,e.ol.layer.Tile,e.ol.source.TileWMS,e.ol.geom,e.ol.format,e.ol.control,e.ol.style,e.ol.Object,e.ol.geom.Circle,e.ol.geom.GeometryCollection,e.ol.Feature,e.ol.format.KML,e.ol.format.WFS,e.ol.geom.Polygon,e.ol.extent)}(this,(function(e,t,s,o,i,n,r,a,l,c,d,h,u,p,m,g,f,v,y,_,b,w,E,S,C,F,L,T,M,k,P,A,x){"use strict";function N(){}function O(){O.init.call(this)}function I(e){return void 0===e._maxListeners?O.defaultMaxListeners:e._maxListeners}function G(e,t,s,o){var i,n,r,a;if("function"!=typeof s)throw new TypeError('"listener" argument must be a function');if((n=e._events)?(n.newListener&&(e.emit("newListener",t,s.listener?s.listener:s),n=e._events),r=n[t]):(n=e._events=new N,e._eventsCount=0),r){if("function"==typeof r?r=n[t]=o?[s,r]:[r,s]:o?r.unshift(s):r.push(s),!r.warned&&(i=I(e))&&i>0&&r.length>i){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=n[t]=s,++e._eventsCount;return e}function D(e,t,s){var o=!1;function i(){e.removeListener(t,i),o||(o=!0,s.apply(e,arguments))}return i.listener=s,i}function R(e){var t=this._events;if(t){var s=t[e];if("function"==typeof s)return 1;if(s)return s.length}return 0}function V(e,t){for(var s=new Array(t);t--;)s[t]=e[t];return s}N.prototype=Object.create(null),O.EventEmitter=O,O.usingDomains=!1,O.prototype.domain=void 0,O.prototype._events=void 0,O.prototype._maxListeners=void 0,O.defaultMaxListeners=10,O.init=function(){this.domain=null,O.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new N,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},O.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},O.prototype.getMaxListeners=function(){return I(this)},O.prototype.emit=function(e){var t,s,o,i,n,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(!(s=r[e]))return!1;var d="function"==typeof s;switch(o=arguments.length){case 1:!function(e,t,s){if(t)e.call(s);else for(var o=e.length,i=V(e,o),n=0;n<o;++n)i[n].call(s)}(s,d,this);break;case 2:!function(e,t,s,o){if(t)e.call(s,o);else for(var i=e.length,n=V(e,i),r=0;r<i;++r)n[r].call(s,o)}(s,d,this,arguments[1]);break;case 3:!function(e,t,s,o,i){if(t)e.call(s,o,i);else for(var n=e.length,r=V(e,n),a=0;a<n;++a)r[a].call(s,o,i)}(s,d,this,arguments[1],arguments[2]);break;case 4:!function(e,t,s,o,i,n){if(t)e.call(s,o,i,n);else for(var r=e.length,a=V(e,r),l=0;l<r;++l)a[l].call(s,o,i,n)}(s,d,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(o-1),n=1;n<o;n++)i[n-1]=arguments[n];!function(e,t,s,o){if(t)e.apply(s,o);else for(var i=e.length,n=V(e,i),r=0;r<i;++r)n[r].apply(s,o)}(s,d,this,i)}return!0},O.prototype.addListener=function(e,t){return G(this,e,t,!1)},O.prototype.on=O.prototype.addListener,O.prototype.prependListener=function(e,t){return G(this,e,t,!0)},O.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,D(this,e,t)),this},O.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,D(this,e,t)),this},O.prototype.removeListener=function(e,t){var s,o,i,n,r;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(o=this._events))return this;if(!(s=o[e]))return this;if(s===t||s.listener&&s.listener===t)0==--this._eventsCount?this._events=new N:(delete o[e],o.removeListener&&this.emit("removeListener",e,s.listener||t));else if("function"!=typeof s){for(i=-1,n=s.length;n-- >0;)if(s[n]===t||s[n].listener&&s[n].listener===t){r=s[n].listener,i=n;break}if(i<0)return this;if(1===s.length){if(s[0]=void 0,0==--this._eventsCount)return this._events=new N,this;delete o[e]}else!function(e,t){for(var s=t,o=s+1,i=e.length;o<i;s+=1,o+=1)e[s]=e[o];e.pop()}(s,i);o.removeListener&&this.emit("removeListener",e,r||t)}return this},O.prototype.off=function(e,t){return this.removeListener(e,t)},O.prototype.removeAllListeners=function(e){var t,s;if(!(s=this._events))return this;if(!s.removeListener)return 0===arguments.length?(this._events=new N,this._eventsCount=0):s[e]&&(0==--this._eventsCount?this._events=new N:delete s[e]),this;if(0===arguments.length){for(var o,i=Object.keys(s),n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=new N,this._eventsCount=0,this}if("function"==typeof(t=s[e]))this.removeListener(e,t);else if(t)do{this.removeListener(e,t[t.length-1])}while(t[0]);return this},O.prototype.listeners=function(e){var t,s=this._events;return s&&(t=s[e])?"function"==typeof t?[t.listener||t]:function(e){for(var t=new Array(e.length),s=0;s<t.length;++s)t[s]=e[s].listener||e[s];return t}(t):[]},O.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):R.call(e,t)},O.prototype.listenerCount=R,O.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};let q=null;const j=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}),U=function e(t){for(let s in t)Array.isArray(t[s])?t[s].forEach((t=>{e(t)})):null!==t[s]&&"object"==typeof t[s]&&Object.freeze(t[s]);return Object.freeze(t)}({dialog:[{text:"Cancel",value:!1,attr:{class:"btn btn-default","data-dismiss":"modal"}},{text:"OK",value:!0,attr:{class:"btn btn-primary","data-dismiss":"modal"}}],alert:[{text:"OK",attr:{class:"btn btn-primary","data-dismiss":"modal"}}],confirm:[{text:"Cancel",value:!1,attr:{class:"btn btn-default","data-dismiss":"modal"}},{text:"OK",value:!0,attr:{class:"btn btn-primary","data-dismiss":"modal"}}]}),H={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 z(e,t,s){let o="data",i=e[o]||{};if(void 0===s){if(e[o]&&e[o][t])return e[o][t];var n=e.getAttribute(`${o}-${t}`);return void 0!==n?n:null}return i[t]=s,e[o]=i,e}function $(e,t){return e.nodeName?e:(e=e.replace(/(\t|\n$)/g,""),q||(q=document.createElement("div")),q.innerHTML="",q.innerHTML=e,!0===t?q.childNodes:q.childNodes[0])}function B(e){let t=[e];for(;e.parentNode;)e=e.parentNode,t.push(e);return t}class W extends O{static set templates(e){this._baseTemplates=e}static get templates(){return Object.assign({},H,W._baseTemplates||{})}static set buttons(e){this._baseButtons=e}static get buttons(){return Object.assign({},U,W._baseButtons||{})}static set options(e){this._baseOptions=e}static get options(){return Object.assign({},j,W._baseOptions||{})}static get version(){return"0.12.0"}static alert(e,t={}){let s=Object.assign({},j,{title:e,content:!1,construct:!0,headerClose:!1,buttons:W.buttons.alert},t);return new W(s)}static confirm(e,t={}){let s=Object.assign({},j,{title:e,content:!1,construct:!0,headerClose:!1,buttons:W.buttons.confirm},t);return new W(s)}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._pointerInContent=!1,this._options=Object.assign({},W.options,e),this._templates=Object.assign({},W.templates,e.templates||{}),this._html.appendTo=document.querySelector(this._options.appendTo),this._scrollbarWidth=function(){let e,t,s,o=document.createElement("div");return Object.assign(o.style,{visibility:"hidden",width:"100px"}),document.body.appendChild(o),s=o.offsetWidth,o.style.overflow="scroll",e=document.createElement("div"),e.style.width="100%",o.appendChild(e),t=s-e.offsetWidth,document.body.removeChild(o),t}(),null===this._options.buttons&&(this._options.buttons=W.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.`);z(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,s=this._templates,o=!!t.animate&&t.animateClass;return e.container=$(s.container),e.dialog=$(s.dialog),e.content=$(s.content),e.header=$(s.header),e.headerClose=$(s.headerClose),e.body=$(s.body),e.footer=$(s.footer),o&&e.container.classList.add(o),this._setHeader(),this._setContent(),this._setFooter(),this.el=e.container,e.dialog.appendChild(e.content),e.container.appendChild(e.dialog),this}_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 s=document.createElement("button");z(s,"button",t),s.innerHTML=t.text,s.setAttribute("type","button");for(let e in t.attr)s.setAttribute(e,t.attr[e]);e.footer.appendChild(s)})),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.mousedownHandler=this._handleMousedownEvent.bind(this),e.container.addEventListener("mousedown",this._events.mousedownHandler),this._events.clickHandler=this._handleClickEvent.bind(this),e.container.addEventListener("click",this._events.clickHandler),this._events.resizeHandler=this._handleResizeEvent.bind(this),window.addEventListener("resize",this._events.resizeHandler)}_handleMousedownEvent(e){this._pointerInContent=!1,B(e.target).every((e=>!e.classList||!e.classList.contains("modal-content")||(this._pointerInContent=!0,!1)))}_handleClickEvent(e){B(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,z(e.target,"button")),this.hide(),!1):!(!this._pointerInContent&&t.classList.contains("modal"))||(this.emit("dismiss",this,e,null),this.hide(),!1)))))),this._pointerInContent=!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,s=this._options,o=!!s.animate&&s.animateClass;e.backdrop=$(t.backdrop),o&&e.backdrop.classList.add(o),e.appendTo.appendChild(e.backdrop),o&&e.backdrop.offsetWidth,e.backdrop.classList.add(s.animateInClass),setTimeout((()=>{this.emit("showBackdrop",this)}),this._options.backdropTransition)}hide(){let e=this._html,t=this._options,s=e.container.classList;if(this.emit("hide",this),s.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("mousedown",this._events.mousedownHandler),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"}}}let K={};const Z=new Set,J=e=>"exceptions"in e?e.exceptions.map((e=>e.text)).join(","):"",Y=(e,t=null,s="")=>{if(Z.has(s))return;Z.add(s);let o=`<b>Error: ${e}</b>`;t&&t.message!==e&&(o+=`. ${t.message}`);const i=W.alert(o,K);i.show(),i.on("hidden",(()=>{Z.delete(s)}))},X={labels:{select:"Select",addElement:"Toggle Draw mode",editElement:"Edit feature",save:"Save",delete:"Delete",cancel:"Cancel",apply:"Apply changes",upload:"Upload",editMode:"Edit Mode",confirmDelete:"Are you sure to delete the feature?",geomTypeNotSupported:"Geometry not supported by layer",editFields:"Edit fields",editGeom:"Edit geometry",selectDrawType:"Geometry type to draw",uploadToLayer:"Upload file to selected layer",uploadFeatures:"Uploaded features to layer",validFeatures:"Valid geometries",invalidFeatures:"Invalid",loading:"Loading...",toggleVisibility:"Toggle layer visibility",close:"Close"},errors:{capabilities:"GeoServer Capabilities could not be downloaded.",wfst:"The GeoServer does not support Transactions",layer:"Could not get data from layer",layerNotFound:"Layer not found",layerNotVisible:"Layer is not visible",noValidGeometry:"No valid geometries found to add to this layer",geoserver:"Failed to get data from GeoServer",badFormat:"Unsupported format",badFile:"Error reading items from file",lockFeature:"Could not lock items on the GeoServer",transaction:"Error when doing Transaction with GeoServer",getFeatures:"Error getting elements from GeoServer"}},Q={es:{labels:{select:"Seleccionar",addElement:"Modo dibujo",editElement:"Editar elemento",save:"Guardar",delete:"Eliminar",cancel:"Cancelar",apply:"Aplicar cambios",upload:"Subir",editMode:"Modo Edición",confirmDelete:"¿Estás seguro de borrar el elemento?",geomTypeNotSupported:"Geometría no compatible con la capa",editFields:"Editar campos",editGeom:"Editar geometría",selectDrawType:"Tipo de geometría para dibujar",uploadToLayer:"Subir archivo a la capa seleccionada",uploadFeatures:"Subida de elementos a la capa",validFeatures:"Válidas",invalidFeatures:"Invalidas",loading:"Cargando...",toggleVisibility:"Cambiar visibilidad de la capa",close:"Cerrar"},errors:{capabilities:"No se pudieron obtener las Capabilidades del GeoServer",wfst:"El GeoServer no tiene soporte a Transacciones",layer:"No se pudieron obtener datos de la capa",layerNotFound:"Capa no encontrada",layerNotVisible:"La capa no está visible",noValidGeometry:"No se encontraron geometrías válidas para agregar a esta capa",geoserver:"No se pudieron obtener datos desde el GeoServer",badFormat:"Formato no soportado",badFile:"Error al leer elementos del archivo",lockFeature:"No se pudieron bloquear elementos en el GeoServer",transaction:"Error al hacer transacción con el GeoServer",getFeatures:"Error al obtener elemento desde el GeoServer"}},en:X,zh:{labels:{select:"选择",addElement:"切换绘图类型",editElement:"编辑元素",save:"保存",delete:"删除",cancel:"取消",apply:"确认并应用改变",upload:"上传",editMode:"编辑模式",confirmDelete:"确认删除元素?",geomTypeNotSupported:"图层不支持该几何",editFields:"编辑区域",editGeom:"编辑几何",selectDrawType:"几何类型",uploadToLayer:"通过文件上传图层",uploadFeatures:"上传元素到图层",validFeatures:"合法的几何类型",invalidFeatures:"不合法",loading:"加载中...",toggleVisibility:"切换图层透明度",close:"关闭"},errors:{capabilities:"无法加载GeoServer服务所支持的能力.",wfst:"GeoServer不支持事务",layer:"无法从图层获得数据",layerNotFound:"Layer not found",layerNotVisible:"Layer is not visible",noValidGeometry:"不支持的几何类型无法加载到图层",geoserver:"无法从GeoServer获取数据",badFormat:"不支持的格式",badFile:"读取文件数据出错",lockFeature:"无法锁定GeoServer上的元素.",transaction:"GeoServer处理事务出错.",getFeatures:"从GeoServer获取元素出错."}}};let ee=X;let te;const se=(e=!0)=>{e?te.classList.add("ol-wfst--tools-control--loading-show"):te.classList.remove("ol-wfst--tools-control--loading-show")},oe=(e,t,s=[])=>{const o=Object.getOwnPropertyDescriptors(t);for(let e of s)delete o[e];Object.defineProperties(e,o)},ie=(e,t=[e])=>{const s=Object.getPrototypeOf(e);return null===s?t:ie(s,[...t,s])},ne=(e,t,s=[])=>{var o;const i=null!==(o=((...e)=>{if(0===e.length)return;let t;const s=e.map((e=>ie(e)));for(;s.every((e=>e.length>0));){const e=s.map((e=>e.pop())),o=e[0];if(!e.every((e=>e===o)))break;t=o}return t})(...e))&&void 0!==o?o:Object.prototype,n=Object.create(i),r=ie(i);for(let t of e){let e=ie(t);for(let t=e.length-1;t>=0;t--){let o=e[t];-1===r.indexOf(o)&&(oe(n,o,["constructor",...s]),r.push(o))}}return n.constructor=t,n},re=e=>e.filter(((t,s)=>e.indexOf(t)==s)),ae=new Map,le=e=>ae.get(e),ce=(e,t)=>{var s,o;const i=re([...Object.getOwnPropertyNames(e),...Object.getOwnPropertyNames(t)]),n={};for(let r of i)n[r]=re([...null!==(s=null==e?void 0:e[r])&&void 0!==s?s:[],...null!==(o=null==t?void 0:t[r])&&void 0!==o?o:[]]);return n},de=(e,t)=>{var s,o,i,n;return{property:ce(null!==(s=null==e?void 0:e.property)&&void 0!==s?s:{},null!==(o=null==t?void 0:t.property)&&void 0!==o?o:{}),method:ce(null!==(i=null==e?void 0:e.method)&&void 0!==i?i:{},null!==(n=null==t?void 0:t.method)&&void 0!==n?n:{})}},he=new Map,ue=(...e)=>{const t=((...e)=>{var t;const s=new Set,o=new Set([...e]);for(;o.size>0;)for(let e of o){const i=[...ie(e.prototype).map((e=>e.constructor)),...null!==(t=le(e))&&void 0!==t?t:[]].filter((e=>!s.has(e)));for(let e of i)o.add(e);s.add(e),o.delete(e)}return[...s]})(...e).map((e=>he.get(e))).filter((e=>!!e));return 0==t.length?{}:1==t.length?t[0]:t.reduce(((e,t)=>((e,t)=>{var s,o,i,n,r,a;return{class:re([...null!==(s=null==e?void 0:e.class)&&void 0!==s?s:[],...null!==(o=null==t?void 0:t.class)&&void 0!==o?o:[]]),static:de(null!==(i=null==e?void 0:e.static)&&void 0!==i?i:{},null!==(n=null==t?void 0:t.static)&&void 0!==n?n:{}),instance:de(null!==(r=null==e?void 0:e.instance)&&void 0!==r?r:{},null!==(a=null==t?void 0:t.instance)&&void 0!==a?a:{})}})(e,t)))};function pe(...e){var t,s,o;const i=e.map((e=>e.prototype));function n(...t){for(const s of e)oe(this,new s(...t))}n.prototype=ne(i,n),Object.setPrototypeOf(n,ne(e,null,["prototype"]));let r=n;{const i=ue(...e);for(let e of null!==(t=null==i?void 0:i.class)&&void 0!==t?t:[]){const t=e(r);t&&(r=t)}me(null!==(s=null==i?void 0:i.static)&&void 0!==s?s:{},r),me(null!==(o=null==i?void 0:i.instance)&&void 0!==o?o:{},r.prototype)}var a,l;return a=r,l=e,ae.set(a,l),r}const me=(e,t)=>{const s=e.property,o=e.method;if(s)for(let e in s)for(let o of s[e])o(t,e);if(o)for(let e in o)for(let s of o[e])s(t,e,Object.getOwnPropertyDescriptor(t,e))};var ge,fe;let ve;!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"}(ge||(ge={})),function(e){e.Insert="insert",e.Delete="delete",e.Update="update"}(fe||(fe={}));let ye=null,_e=null;var be;function we(e=null){_e=e}function Ee(){return _e}!function(e){e.Edit="EDIT",e.Draw="DRAW"}(be||(be={}));const Se=new Set,Ce={};function Fe(){return ve}function Le(e){ye=e}function Te(){return ye}function Me(){return Ce}function ke(e){return Me()[e]}function Pe(e){Se.add(String(e.getId()))}function Ae(e){Se.delete(String(e.getId()))}function xe(e){return Se.has(String(e.getId()))}class Ne extends m{_init(){const e=this.getGeoserver();e.isLoaded()?this.getAndUpdateDescribeFeatureType():e.on("change:capabilities",(async()=>{this.getAndUpdateDescribeFeatureType()}))}async getAndUpdateDescribeFeatureType(){const e=this.get(Oe.NAME),t=this.get(Oe.LABEL);try{const t=this.getGeoserver(),s=new URLSearchParams({service:"wfs",version:t.getAdvanced().describeFeatureTypeVersion,request:"DescribeFeatureType",typeName:e,outputFormat:"application/json",exceptions:"application/json"}),o=t.getUrl()+"?"+s.toString(),i=await fetch(o,{headers:t.getHeaders(),credentials:t.getCredentials()});if(!i.ok)throw new Error("");const n=await i.json();if(!n)throw new Error("");if(n.exceptions)throw new Error(J(n));const r=n.targetNamespace,a=n.featureTypes[0].properties,l=a.find((e=>e.type.indexOf("gml:")>=0));n._parsed={namespace:r,properties:a,geomType:l.localType,geomField:l.name},this.set(Oe.DESCRIBEFEATURETYPE,n)}catch(s){console.error(s),Y(`${ee.errors.layer} "${t}"`,s,e)}}isVisibleByZoom(){return Fe().getView().getZoom()>this.getMinZoom()}async transactFeatures(e,t){return this.getGeoserver().transact(e,t,this.get(Oe.NAME))}async insertFeatures(e){return this.transactFeatures(fe.Insert,e)}async maybeLockFeature(e){const t=this.getGeoserver();return t.getUseLockFeature()&&t.hasLockFeature()?await t.lockFeature(e,this.get(Oe.NAME)):null}getGeoserver(){return this.get(Oe.GEOSERVER)}getDescribeFeatureType(){return this.get(Oe.DESCRIBEFEATURETYPE)}}var Oe;!function(e){e.NAME="name",e.LABEL="label",e.DESCRIBEFEATURETYPE="describeFeatureType",e.ISVISIBLE="isVisible",e.GEOSERVER="geoserver"}(Oe||(Oe={}));class Ie extends f{urlParams=new URLSearchParams({SERVICE:"wfs",REQUEST:"GetFeature",OUTPUTFORMAT:"application/json",EXCEPTIONS:"application/json"});constructor(e){super({...e,format:new g,loader:async(t,s,o,i,n)=>{try{if(e.strategy==y.bbox){const s=v.transformExtent(t,o.getCode(),e.geoServerAdvanced.projection);this.urlParams.set("bbox",s.toString()+`,${e.geoServerAdvanced.projection}`)}const s=e.geoserverUrl+"?"+this.urlParams.toString(),n=await fetch(s,{headers:e.headers,credentials:e.credentials});if(!n.ok)throw new Error("");const r=await n.json();if(r.exceptions)throw new Error(J(r));const a=this.getFormat().readFeatures(r,{featureProjection:o.getCode(),dataProjection:e.geoServerAdvanced.projection});a.forEach((t=>{t.set("_layerName_",e.name,!0)})),this.addFeatures(a),i(a)}catch(s){this.removeLoadedExtent(t),Y(ee.errors.geoserver,s,e.name),n()}}}),this.urlParams.set("version",e.geoServerAdvanced.getFeatureVersion),this.urlParams.set("typename",e.name),this.urlParams.set("srsName",e.geoServerAdvanced.projection.toString())}}class Ge extends(pe(Ne,p)){_loadingCount=0;_loadedCount=0;beforeTransactFeature;constructor(e){super({name:e.name,label:e.label||e.name,minZoom:e.minZoom,...e}),e.beforeTransactFeature&&(this.beforeTransactFeature=e.beforeTransactFeature);const t=e.geoserver,s=new Ie({name:e.name,geoserverUrl:t.getUrl(),geoServerAdvanced:t.getAdvanced(),...e.strategy&&{strategy:e.strategy},geoserverVendor:e.geoserverVendor});this._loadingCount=0,this._loadedCount=0,s.on("featuresloadstart",(()=>{this._loadingCount++,1===this._loadingCount&&this.isVisibleByZoom()&&se()})),s.on(["featuresloadend","featuresloaderror"],(()=>{this._loadedCount++,this._loadingCount===this._loadedCount&&(this._loadingCount=0,this._loadedCount=0,setTimeout((()=>{this.dispatchEvent("layerRendered")}),300))})),this.setSource(s);const o=e.geoserverVendor;Object.keys(o).forEach((e=>{s.urlParams.set(e,o[e])}))}refresh(){this.getSource().refresh()}setCustomParam(e,t=null,s=!0){const o=this.getSource();return null==t?o.urlParams.delete(e):o.urlParams.set(e,t),s&&this.refresh(),o.urlParams}}var De=2,Re=3;class Ve extends b{constructor(e){super({url:e.geoserverUrl,serverType:"geoserver",params:{SERVICE:"wms",TILED:!0,LAYERS:e.name,EXCEPTIONS:"application/json",...e.geoserverVendor&&e.geoserverVendor},tileLoadFunction:async(t,s)=>{try{const i=await fetch(s,{headers:e.headers,credentials:e.credentials});if(!i.ok)throw new Error("");let n=await i.blob();if("application/json"==n.type){const e=await(o=n,new Promise((e=>{const t=new FileReader;t.onloadend=()=>e(JSON.parse(t.result)),t.readAsText(o)})));throw new Error(J(e))}t.getImage().src=URL.createObjectURL(n),t.setState(De)}catch(s){Y(ee.errors.geoserver,s,e.name),t.setState(Re)}var o},...e})}}class qe extends(pe(Ne,_)){_loadingCount=0;_loadedCount=0;beforeTransactFeature;_formatGeoJSON;constructor(e){super({name:e.name,label:e.label||e.name,minZoom:e.minZoom,...e}),e.beforeTransactFeature&&(this.beforeTransactFeature=e.beforeTransactFeature),this._formatGeoJSON=new g;const t=e.geoserver,s=new Ve({name:e.name,geoserverUrl:t.getUrl(),geoServerAdvanced:t.getAdvanced(),geoserverVendor:e.geoserverVendor});this._loadingCount=0,this._loadedCount=0,s.on("tileloadstart",(()=>{this._loadingCount++,1===this._loadingCount&&this.isVisibleByZoom()&&se()})),s.on(["tileloadend","tileloaderror"],(()=>{this._loadedCount++,this._loadingCount===this._loadedCount&&(this._loadingCount=0,this._loadedCount=0,setTimeout((()=>{this.dispatchEvent("layerRendered")}),300))})),this.setSource(s)}async _getFeaturesByClickEvent(e){const t=e.coordinate,s=Fe().getView(),o=s.getZoom()>10?10:5,i=this.getSource(),n=i["getFeatureInfoUrl"in i?"getFeatureInfoUrl":"getGetFeatureInfoUrl"](t,s.getResolution(),s.getProjection().getCode(),{INFO_FORMAT:"application/json",BUFFER:o,FEATURE_COUNT:1,EXCEPTIONS:"application/json"}),r=this.getGeoserver();try{const e=await fetch(n,{headers:r.getHeaders(),credentials:r.getCredentials()});if(!e.ok)throw new Error(`${ee.errors.getFeatures} ${e.status}`);const t=await e.json();return this._formatGeoJSON.readFeatures(t)}catch(e){Y(e.message,e)}}refresh(){const e=this.getSource();e.refresh();const t=e.getParams();t.t=(new Date).getMilliseconds(),e.updateParams(t)}setCustomParam(e,t=null,s=!0){const o=this.getSource();return o.updateParams({[e]:t}),s&&this.refresh(),o.getParams()}}var je=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},Ue="propertychange";var He=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function ze(){}function $e(e){for(const t in e)delete e[t]}var Be=class extends He{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;const s=this.listeners_||(this.listeners_={}),o=s[e]||(s[e]=[]);o.includes(t)||o.push(t)}dispatchEvent(e){const t="string"==typeof e,s=t?e:e.type,o=this.listeners_&&this.listeners_[s];if(!o)return;const i=t?new je(e):e;i.target||(i.target=this.eventTarget_||this);const n=this.dispatching_||(this.dispatching_={}),r=this.pendingRemovals_||(this.pendingRemovals_={});let a;s in n||(n[s]=0,r[s]=0),++n[s];for(let e=0,t=o.length;e<t;++e)if(a="handleEvent"in o[e]?o[e].handleEvent(i):o[e].call(this,i),!1===a||i.propagationStopped){a=!1;break}if(0==--n[s]){let e=r[s];for(delete r[s];e--;)this.removeEventListener(s,ze);delete n[s]}return a}disposeInternal(){this.listeners_&&$e(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return!!this.listeners_&&(e?e in this.listeners_:Object.keys(this.listeners_).length>0)}removeEventListener(e,t){const s=this.listeners_&&this.listeners_[e];if(s){const o=s.indexOf(t);-1!==o&&(this.pendingRemovals_&&e in this.pendingRemovals_?(s[o]=ze,++this.pendingRemovals_[e]):(s.splice(o,1),0===s.length&&delete this.listeners_[e]))}}},We="change";function Ke(e,t,s,o,i){if(o&&o!==e&&(s=s.bind(o)),i){const o=s;s=function(){e.removeEventListener(t,s),o.apply(this,arguments)}}const n={target:e,type:t,listener:s};return e.addEventListener(t,s),n}function Ze(e,t,s,o){return Ke(e,t,s,o,!0)}function Je(e){e&&e.target&&(e.target.removeEventListener(e.type,e.listener),$e(e))}class Ye extends Be{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(We)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){const s=e.length,o=new Array(s);for(let i=0;i<s;++i)o[i]=Ke(this,e[i],t);return o}return Ke(this,e,t)}onceInternal(e,t){let s;if(Array.isArray(e)){const o=e.length;s=new Array(o);for(let i=0;i<o;++i)s[i]=Ze(this,e[i],t)}else s=Ze(this,e,t);return t.ol_key=s,s}unInternal(e,t){const s=t.ol_key;if(s)!function(e){if(Array.isArray(e))for(let t=0,s=e.length;t<s;++t)Je(e[t]);else Je(e)}(s);else if(Array.isArray(e))for(let s=0,o=e.length;s<o;++s)this.removeEventListener(e[s],t);else this.removeEventListener(e,t)}}Ye.prototype.on,Ye.prototype.once,Ye.prototype.un;var Xe=Ye;let Qe=0;class et extends je{constructor(e,t,s){super(e),this.key=t,this.oldValue=s}}var tt=class extends Xe{constructor(e){var t;super(),this.on,this.once,this.un,(t=this).ol_uid||(t.ol_uid=String(++Qe)),this.values_=null,void 0!==e&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}hasProperties(){return!!this.values_}notify(e,t){let s;s=`change:${e}`,this.hasListener(s)&&this.dispatchEvent(new et(s,e,t)),s=Ue,this.hasListener(s)&&this.dispatchEvent(new et(s,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,s){const o=this.values_||(this.values_={});if(s)o[e]=t;else{const s=o[e];o[e]=t,s!==t&&this.notify(e,s)}}setProperties(e,t){for(const s in e)this.set(s,e[s],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){const s=this.values_[e];delete this.values_[e],function(e){let t;for(t in e)return!1;return!t}(this.values_)&&(this.values_=null),t||this.notify(e,s)}}};function st(e){let t=e.offsetWidth;const s=getComputedStyle(e);return t+=parseInt(s.marginLeft,10)+parseInt(s.marginRight,10),t}function ot(e){let t=e.offsetHeight;const s=getComputedStyle(e);return t+=parseInt(s.marginTop,10)+parseInt(s.marginBottom,10),t}var it="postrender";const nt="element",rt="map",at="offset",lt="position",ct="positioning";var dt=class extends tt{constructor(e){super(),this.on,this.once,this.un,this.options=e,this.id=e.id,this.insertFirst=void 0===e.insertFirst||e.insertFirst,this.stopEvent=void 0===e.stopEvent||e.stopEvent,this.element=document.createElement("div"),this.element.className=void 0!==e.className?e.className:"ol-overlay-container ol-selectable",this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=!0===e.autoPan?{}:e.autoPan||void 0,this.rendered={transform_:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(nt,this.handleElementChanged),this.addChangeListener(rt,this.handleMapChanged),this.addChangeListener(at,this.handleOffsetChanged),this.addChangeListener(lt,this.handlePositionChanged),this.addChangeListener(ct,this.handlePositioningChanged),void 0!==e.element&&this.setElement(e.element),this.setOffset(void 0!==e.offset?e.offset:[0,0]),this.setPositioning(e.positioning||"top-left"),void 0!==e.position&&this.setPosition(e.position)}getElement(){return this.get(nt)}getId(){return this.id}getMap(){return this.get(rt)||null}getOffset(){return this.get(at)}getPosition(){return this.get(lt)}getPositioning(){return this.get(ct)}handleElementChanged(){!function(e){for(;e.lastChild;)e.removeChild(e.lastChild)}(this.element);const e=this.getElement();e&&this.element.appendChild(e)}handleMapChanged(){var e;this.mapPostrenderListenerKey&&((e=this.element)&&e.parentNode&&e.parentNode.removeChild(e),Je(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=Ke(t,it,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(e){this.set(nt,e)}setMap(e){this.set(rt,e)}setOffset(e){this.set(at,e)}setPosition(e){this.set(lt,e)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(e){const t=this.getMap();if(!t||!t.getTargetElement()||!this.get(lt))return;const s=this.getRect(t.getTargetElement(),t.getSize()),o=this.getElement(),i=this.getRect(o,[st(o),ot(o)]),n=void 0===(e=e||{}).margin?20:e.margin;if(a=i,!((r=s)[0]<=a[0]&&a[2]<=r[2]&&r[1]<=a[1]&&a[3]<=r[3])){const o=i[0]-s[0],r=s[2]-i[2],a=i[1]-s[1],l=s[3]-i[3],c=[0,0];if(o<0?c[0]=o-n:r<0&&(c[0]=Math.abs(r)+n),a<0?c[1]=a-n:l<0&&(c[1]=Math.abs(l)+n),0!==c[0]||0!==c[1]){const s=t.getView().getCenterInternal(),o=t.getPixelFromCoordinateInternal(s);if(!o)return;const i=[o[0]+c[0],o[1]+c[1]],n=e.animation||{};t.getView().animateInternal({center:t.getCoordinateFromPixelInternal(i),duration:n.duration,easing:n.easing})}}var r,a}getRect(e,t){const s=e.getBoundingClientRect(),o=s.left+window.pageXOffset,i=s.top+window.pageYOffset;return[o,i,o+t[0],i+t[1]]}setPositioning(e){this.set(ct,e)}setVisible(e){this.rendered.visible!==e&&(this.element.style.display=e?"":"none",this.rendered.visible=e)}updatePixelPosition(){const e=this.getMap(),t=this.getPosition();if(!e||!e.isRendered()||!t)return void this.setVisible(!1);const s=e.getPixelFromCoordinate(t),o=e.getSize();this.updateRenderedPosition(s,o)}updateRenderedPosition(e,t){const s=this.element.style,o=this.getOffset(),i=this.getPositioning();this.setVisible(!0);let n="0%",r="0%";"bottom-right"==i||"center-right"==i||"top-right"==i?n="-100%":"bottom-center"!=i&&"center-center"!=i&&"top-center"!=i||(n="-50%"),"bottom-left"==i||"bottom-center"==i||"bottom-right"==i?r="-100%":"center-left"!=i&&"center-center"!=i&&"center-right"!=i||(r="-50%");const a=`translate(${n}, ${r}) translate(${Math.round(e[0]+o[0])+"px"}, ${Math.round(e[1]+o[1])+"px"})`;this.rendered.transform_!=a&&(this.rendered.transform_=a,s.transform=a)}getOptions(){return this.options}};function ht(e,t={},...s){if("function"==typeof e)return e(t,s);const o=null===e?new DocumentFragment:document.createElement(e);Object.entries(t||{}).forEach((([e,t])=>{void 0!==typeof t&&null!=t&&(e.startsWith("on")&&e.toLowerCase()in window?o.addEventListener(e.toLowerCase().substr(2),t):"className"===e?o.setAttribute("class",t.toString()):"htmlFor"===e?o.setAttribute("for",t.toString()):o.setAttribute(e,t.toString()))}));for(const e of s)e&&(Array.isArray(e)?o.append(...e):void 0===e.nodeType?o.innerHTML+=e:o.appendChild(e));return o}const ut=()=>{const e=document.querySelector(".ol-wfst--tools-control-btn.wfst--active");e&&e.classList.remove("wfst--active")};class pt extends Xe{_uploads;_uploadFormats;constructor(e,t){super(),this._uploads=e,this._uploadFormats=t}addLayerEl(e){const t=document.querySelector(".wfst--tools-control--select-layers"),s=e.get(Oe.NAME),o=ht("input",{value:s,id:`wfst--${s}`,type:"radio",className:"ol-wfst--tools-control-input",name:"wfst--select-layer",...e===Te()?{checked:"checked"}:{},onchange:t=>this._layerChangeHandler(t,e)}),i=ht("div",{className:`wfst--layer-control \n ${e.getVisible()?"ol-wfst--visible-on":""}\n ${e===Te()?"ol-wfst--selected-on":""}`,"data-layer":s},ht("div",{className:"ol-wfst--tools-control-visible"},ht("span",{className:"ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-on",title:ee.labels.toggleVisibility,onclick:e=>this._visibilityClickHandler(e)},ht("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"})),ht("span",{className:"ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-off",title:ee.labels.toggleVisibility,onclick:e=>this._visibilityClickHandler(e)},ht("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"}))),ht("label",{htmlFor:`wfst--${s}`},o,ht("span",{title:e.getDescribeFeatureType()._parsed.geomType},e.get(Oe.LABEL))));return t.appendChild(i),e===Te()&&o.dispatchEvent(new Event("change")),i}_changeStateSelect(e,t=null){const s=(e,t)=>{Array.from(o.options).forEach((s=>{s.selected=s.value===e,s.disabled="all"!==t&&!t.includes(s.value),s.title=s.disabled?ee.labels.geomTypeNotSupported:""}))},o=document.querySelector(".wfst--tools-control--select-draw");let i;if(o){const n=e.getDescribeFeatureType()._parsed.geomType;t?i=o.value:n===ge.GeometryCollection?(i=ge.LineString,s(i,"all")):n===ge.LinearRing?(i=ge.LineString,s(i,[ge.Circle,ge.LinearRing,ge.Polygon]),o.value=i):(i=n,s(i,[n]))}return i}_visibilityClickHandler(e){const t=e.currentTarget.closest(".wfst--layer-control"),s=t.dataset.layer;t.classList.toggle("ol-wfst--visible-on");const o=Me()[s];t.classList.contains("ol-wfst--visible-on")?o.setVisible(!0):o.setVisible(!1)}_layerChangeHandler(e,t){const s=e.currentTarget.closest(".wfst--layer-control"),o=document.querySelector(".ol-wfst--selected-on");o&&o.classList.remove("ol-wfst--selected-on"),s.classList.add("ol-wfst--selected-on"),Le(t),this._changeStateSelect(t)}render(){return ht(null,null,ht("div",{className:"wfst--tools-control--head"},this._uploads&&ht("div",null,ht("input",{id:"ol-wfst--upload",type:"file",accept:this._uploadFormats,onchange:e=>this._uploads.process(e)}),ht("label",{className:"ol-wfst--tools-control-btn ol-wfst--tools-control-btn-upload",htmlFor:"ol-wfst--upload",title:ee.labels.uploadToLayer},ht("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"}))),ht("div",{className:"ol-wfst--tools-control-draw-cnt"},ht("button",{className:"ol-wfst--tools-control-btn ol-wfst--tools-control-btn-draw",type:"button",title:ee.labels.addElement,onclick:()=>{this.dispatchEvent("drawMode")}},ht("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"})),ht("select",{title:ee.labels.selectDrawType,className:"wfst--tools-control--select-draw",onchange:e=>{const t=e.target.value;this._changeStateSelect(Te(),t),this.dispatchEvent("changeGeom")}},[ge.Point,ge.MultiPoint,ge.LineString,ge.MultiLineString,ge.Polygon,ge.MultiPolygon,ge.Circle].map((e=>ht("option",{value:e},e)))))),ht("div",{className:"wfst--tools-control--select-layers"}))}}let mt=new p({source:new f,zIndex:100});const gt=()=>mt;class ft extends Xe{_options;_formatWFS;_formatGeoJSON;_formatKml;_xs;_processUpload;constructor(e){super(),this._options=e,this._processUpload=e.processUpload,this._formatWFS=new E.WFS,this._formatGeoJSON=new E.GeoJSON,this._formatKml=new E.KML({extractStyles:!1,showPointNames:!1}),this._xs=new XMLSerializer}async process(e){const t=Fe().getView(),s=e.target.files[0];let o;if(!s)return;const i=s.name.split(".").pop().toLowerCase();try{if(this._processUpload&&(o=this._processUpload(s)),!o){const e=await this._fileReader(s);"geojson"===i||"json"===i?o=this._formatGeoJSON.readFeatures(e,{featureProjection:t.getProjection().getCode()}):"kml"===i?o=this._formatKml.readFeatures(e,{featureProjection:t.getProjection().getCode()}):Y(ee.errors.badFormat)}let n=0,r=0;const a=[];for(let e of o)this._checkGeometry(e)||(e=this._fixGeometry(e)),e?(a.push(e),r++):n++;if(r){ut(),this.dispatchEvent(new f.VectorSourceEvent("loadedFeatures",null,a));const e=`\n ${ee.labels.validFeatures}: ${r}<br>\n ${n?`${ee.labels.invalidFeatures}: ${n}`:""}`;this._initModal(e,a)}else Y(ee.errors.noValidGeometry);e.target.value=null}catch(e){Y(ee.errors.badFile,e)}}async _fileReader(e){return new Promise(((t,s)=>{const o=new FileReader;o.addEventListener("load",(async e=>{const s=e.target.result;t(s)})),o.addEventListener("error",(e=>{console.error("Error"+e),s()})),o.readAsText(e)}))}_fixGeometry(e){const t=Te().getDescribeFeatureType()._parsed.geomType;let s;switch(e.getGeometry().getType()){case ge.Point:if(t===ge.MultiPoint){const t=e.getGeometry().getCoordinates();s=new w.MultiPoint([t])}break;case ge.LineString:if(t===ge.MultiLineString){const t=e.getGeometry().getCoordinates();s=new w.MultiLineString([t])}break;case ge.Polygon:if(t===ge.MultiPolygon){const t=e.getGeometry().getCoordinates();s=new w.MultiPolygon([t])}break;default:s=null}return s?(e.setGeometry(s),e):null}_checkGeometry(e){const t=Te().getDescribeFeatureType()._parsed.geomType,s=e.getGeometry().getType();return t===ge.GeometryCollection||s===t}_initModal(e,t){const s=`\n <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">\n ${ee.labels.cancel}\n </button>\n <button type="button" class="btn btn-sm btn-primary" data-action="save" data-dismiss="modal">\n ${ee.labels.upload}\n </button>\n `;new W({...this._options.modal,header:!0,headerClose:!1,title:ee.labels.uploadFeatures+" "+Te().get(Oe.NAME),content:e,backdrop:"static",footer:s}).show().on("dismiss",((e,s)=>{"save"===s.target.dataset.action?this.dispatchEvent(new f.VectorSourceEvent("addedFeatures",null,t)):gt().getSource().clear()}))}}const vt=(e,...t)=>(t.forEach((t=>{Object.keys(t).forEach((s=>{const o=t[s],i=e[s];e[s]=i&&o&&"object"==typeof i&&"object"==typeof o&&!Array.isArray(i)?vt(i,o):o}))})),e);class yt extends S.Control{constructor(e){super({element:ht("div",{className:"ol-wfst--changes-control"},ht("div",{className:"ol-wfst--changes-control-el"},ht("div",{className:"ol-wfst--changes-control-id"},ht("b",null,ee.labels.editMode)," -"," ",ht("i",null,String(e.getId()))),ht("button",{type:"button",className:"btn btn-sm btn-secondary",onclick:()=>{this.dispatchEvent(new f.VectorSourceEvent("cancel",e))}},ee.labels.cancel),ht("button",{type:"button",className:"btn btn-sm btn-primary",onclick:()=>{this.dispatchEvent(new f.VectorSourceEvent("apply",e))}},ee.labels.apply),ht("button",{type:"button",className:"btn btn-sm btn-danger-outline",onclick:()=>{this.dispatchEvent(new f.VectorSourceEvent("delete",e))}},ee.labels.delete)))})}}function _t(e){const t=e=>{let t=e.getGeometry();t instanceof w.GeometryCollection&&(t=t.getGeometries()[0]);const s=t.getCoordinates();let o=null;if(o=t instanceof w.Polygon||t instanceof w.MultiLineString?s.flat(1):t instanceof w.MultiPolygon?s.flat(2):s,o&&o.length)return new w.MultiPoint(o)};let s=e.getGeometry(),o=s.getType();switch(s instanceof w.GeometryCollection&&(s=s.getGeometries()[0],o=s.getType()),o){case ge.Point:case ge.MultiPoint:return Ee()===be.Edit?[new C.Style({image:new C.Circle({radius:6,fill:new C.Fill({color:"#000000"})})}),new C.Style({image:new C.Circle({radius:4,fill:new C.Fill({color:"#ff0000"})})})]:[new C.Style({image:new C.Circle({radius:5,fill:new C.Fill({color:"#ff0000"})})}),new C.Style({image:new C.Circle({radius:2,fill:new C.Fill({color:"#000000"})})})];default:return Ee()==be.Draw||Ee()==be.Edit?[new C.Style({stroke:new C.Stroke({color:"rgba( 255, 0, 0, 1)",width:4}),fill:new C.Fill({color:"rgba(255, 0, 0, 0.7)"})}),new C.Style({image:new C.Circle({radius:4,fill:new C.Fill({color:"#ff0000"}),stroke:new C.Stroke({width:2,color:"rgba(5, 5, 5, 0.9)"})}),geometry:e=>t(e)}),new C.Style({stroke:new C.Stroke({color:"rgba(255, 255, 255, 0.7)",width:2})})]:[new C.Style({image:new C.Circle({radius:2,fill:new C.Fill({color:"#000000"})}),geometry:e=>t(e)}),new C.Style({stroke:new C.Stroke({color:"#ff0000",width:4}),fill:new C.Fill({color:"rgba(255, 0, 0, 0.7)"})})]}}class bt extends Xe{_options;_modal;_feature;constructor(e){super(),this._options=e;const t=`\n <button type="button" class="btn btn-sm btn-link btn-third" data-action="delete" data-dismiss="modal">\n ${ee.labels.delete}\n </button>\n <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">\n ${ee.labels.cancel}\n </button>\n <button type="button" class="btn btn-sm btn-primary" data-action="save" data-dismiss="modal">\n ${ee.labels.save}\n </button>\n `;this._modal=new W({...this._options,header:!0,headerClose:!0,title:"",content:"<div></div>",footer:t}),this._modal.on("dismiss",((e,t)=>{if("save"===t.target.dataset.action){e.el.querySelectorAll("input").forEach((e=>{const t=e.value,s=e.name;this._feature.set(s,t,!0)})),this._feature.changed(),Pe(this._feature),this.dispatchEvent(new f.VectorSourceEvent("save",this._feature))}else"delete"===t.target.dataset.action&&this.dispatchEvent(new f.VectorSourceEvent("delete",this._feature))}))}show(e){this._feature=e;const t=`${ee.labels.editElement} ${e.getId()} `,s=e.getProperties(),o=ke(e.get("_layerName_")).getDescribeFeatureType()._parsed.properties;let i='<form autocomplete="false">';Object.keys(s).forEach((e=>{const t=o.find((t=>t.name===e));if(t){let o;switch(t.type){case"xsd:string":default:o="text";break;case"xsd:number":case"xsd:int":o="number";break;case"xsd:date-time":o="datetime"}o&&(i+=`\n <div class="ol-wfst--input-field-container">\n <label class="ol-wfst--input-field-label" for="${e}">${e}</label>\n <input placeholder="NULL" class="ol-wfst--input-field-input" type="${o}" name="${e}" value="${s[e]||""}">\n </div>`)}})),i+="</form>",this._modal._html.body.innerHTML=i,this._modal._html.header.innerHTML=t,this._modal.show()}}var wt;!function(e){e.CAPABILITIES="capabilities",e.URL="url",e.HEADERS="headers",e.CREDENTIALS="credentials",e.ADVANCED="advanced",e.HASTRASNACTION="hasTransaction",e.HASLOCKFEATURE="hasLockFeature",e.HASDESCRIBEFEATURETYPE="hasDescribeFeatureType",e.USELOCKFEATURE="useLockFeature",e.ISLOADED="isLoaded"}(wt||(wt={}));class Et extends dt{constructor(e,t=null){super({id:e.getId(),position:t||x.getCenter(e.getGeometry().getExtent()),positioning:"center-center",offset:[0,-40],stopEvent:!0,element:ht("div",null,ht("div",{className:"ol-wfst--edit-button-cnt",onclick:()=>{this.dispatchEvent("editFields")}},ht("button",{className:"ol-wfst--edit-button",type:"button",title:ee.labels.editFields},ht("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='448' height='448' viewBox='0 0 448 448'%3e %3cpath d='M222 296l29-29-38-38-29 29v14h24v24h14zM332 116c-2.25-2.25-6-2-8.25 0.25l-87.5 87.5c-2.25 2.25-2.5 6-0.25 8.25s6 2 8.25-0.25l87.5-87.5c2.25-2.25 2.5-6 0.25-8.25zM352 264.5v47.5c0 39.75-32.25 72-72 72h-208c-39.75 0-72-32.25-72-72v-208c0-39.75 32.25-72 72-72h208c10 0 20 2 29.25 6.25 2.25 1 4 3.25 4.5 5.75 0.5 2.75-0.25 5.25-2.25 7.25l-12.25 12.25c-2.25 2.25-5.25 3-8 2-3.75-1-7.5-1.5-11.25-1.5h-208c-22 0-40 18-40 40v208c0 22 18 40 40 40h208c22 0 40-18 40-40v-31.5c0-2 0.75-4 2.25-5.5l16-16c2.5-2.5 5.75-3 8.75-1.75s5 4 5 7.25zM328 80l72 72-168 168h-72v-72zM439 113l-23 23-72-72 23-23c9.25-9.25 24.75-9.25 34 0l38 38c9.25 9.25 9.25 24.75 0 34z'%3e%3c/path%3e%3c/svg%3e",alt:ee.labels.editFields}))),ht("div",{className:"ol-wfst--edit-button-cnt",onclick:()=>{this.dispatchEvent("editGeom")}},ht("button",{class:"ol-wfst--edit-button",type:"button",title:ee.labels.editGeom},ht("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='541' height='512' viewBox='0 0 541 512'%3e %3cpath fill='black' d='M103.306 228.483l129.493-125.249c-17.662-4.272-31.226-18.148-34.98-35.663l-0.055-0.307-129.852 125.248c17.812 4.15 31.53 18.061 35.339 35.662l0.056 0.308z'%3e%3c/path%3e %3cpath fill='black' d='M459.052 393.010c-13.486-8.329-22.346-23.018-22.373-39.779v-0.004c-0.053-0.817-0.082-1.772-0.082-2.733s0.030-1.916 0.089-2.863l-0.007 0.13-149.852 71.94c9.598 8.565 15.611 20.969 15.611 34.779 0 0.014 0 0.029 0 0.043v-0.002c-0.048 5.164-0.94 10.104-2.544 14.711l0.098-0.322z'%3e%3c/path%3e %3cpath fill='black' d='M290.207 57.553c-0.009 15.55-7.606 29.324-19.289 37.819l-0.135 0.093 118.054 46.69c-0.216-1.608-0.346-3.48-0.36-5.379v-0.017c0.033-16.948 9.077-31.778 22.596-39.953l0.209-0.118-122.298-48.056c0.659 2.633 1.098 5.693 1.221 8.834l0.002 0.087z'%3e%3c/path%3e %3cpath fill='black' d='M241.36 410.132l-138.629-160.067c-4.734 17.421-18.861 30.61-36.472 33.911l-0.29 0.045 143.881 166.255c1.668-18.735 14.197-34.162 31.183-40.044l0.327-0.099z'%3e%3c/path%3e %3cpath fill='black' d='M243.446 115.105c-31.785 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.785 0 57.552 25.767 57.552 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM243.446 21.582c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.104-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M483.224 410.78c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.552 25.767 57.552 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM483.224 317.257c-19.866 0-35.97 16.104-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M57.553 295.531c-31.785 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.785 0 57.553 25.767 57.553 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM57.553 202.008c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c-0.041-19.835-16.13-35.898-35.97-35.898 0 0 0 0 0 0v0z'%3e%3c/path%3e %3cpath fill='black' d='M256.036 512.072c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.553 25.767 57.553 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM256.036 418.55c-19.866 0-35.97 16.104-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M435.24 194.239c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.553 25.767 57.553 57.553v0c0 31.785-25.767 57.553-57.553 57.553v0zM435.24 100.716c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e%3c/svg%3e",alt:ee.labels.editGeom}))))})}}const St=document.createElement("div");class Ct extends i{_options;_i18n;_map;_view;_viewport;_initialized=!1;_layersControl;_overlay;_interactionWfsSelect;_interactionSelectModify;_collectionModify;_interactionModify;_interactionSnap;_interactionDraw;_keyClickWms;_keyRemove;_keySelect;_controlApplyDiscardChanges;_controlWidgetToolsDiv;_selectDraw;_currentZoom;_lastZoom;_editFeature;_editFeatureOriginal;_uploads;_editFields;constructor(e){super({target:null,element:St,render:()=>{this._map||this._init()}}),((e="en",t=null)=>{e in Q&&(ee=Q[e]),t&&(ee={...ee,...t})})(e.language,e.i18n);const t={layers:null,evtType:"singleclick",active:!0,showControl:!0,language:"en",uploadFormats:".geojson,.json,.kml",processUpload:null,modal:{animateClass:"fade",animateInClass:"show",transition:300,backdropTransition:150,templates:{dialog:'<div class="modal-dialog modal-dialog-centered"></div>',headerClose:`<button type="button" class="btn-close" data-dismiss="modal" aria-label="${ee.labels.close}"><span aria-hidden="true">×</span></button>`}}};this._options=vt(t,e),Le(this._options.layers[0]),this._controlWidgetToolsDiv=St,this._controlWidgetToolsDiv.className="ol-wfst--tools-control",this._uploads=new ft(this._options),this._editFields=new bt(this._options.modal)}getLayers(){return Object.values(Me())}getLayerByName(e=""){const t=Me();return e&&e in t?t[e]:null}async _initMapAndLayers(){try{const e=this._options.layers;if(e.length){let t=0,s=0;e.forEach((e=>{e.getVisible()&&s++,e.on("layerRendered",(()=>{t++,t>=s&&(this._initialized||(this.dispatchEvent("load"),this._initialized=!0),se(!1))})),e.on("change:describeFeatureType",(()=>{const t=this._layersControl.addLayerEl(e);e.on("change:isVisible",(()=>{const s="ol-wfst--layer-not-visible";e.isVisibleByZoom()?t.classList.remove(s):t.classList.add(s)})),e.set(Oe.ISVISIBLE,this._currentZoom>e.getMinZoom()),this.dispatchEvent(new Ft({type:"describeFeatureType",layer:e,data:e.getDescribeFeatureType()}))})),e._init(),this._map.addLayer(e),function(e){Object.assign(Ce,e)}({[e.get(Oe.NAME)]:e})})),this._createMapElements(this._options.showControl,this._options.active)}}catch(e){se(!1),Y(e.message,e)}}_init(){var e,t;this._map=super.getMap(),this._view=this._map.getView(),this._viewport=this._map.getViewport(),e=this._map,ve=e,this._uploads.on("addedFeatures",(({features:e})=>{Te().insertFeatures(e)})),this._uploads.on("loadedFeatures",(({features:e})=>{this.activateEditMode();const t=gt().getSource();t.addFeatures(e),this._view.fit(t.getExtent(),{size:this._map.getSize(),maxZoom:21,padding:[100,100,100,100]})})),this._editFields.on("save",(({feature:e})=>{this._collectionModify.remove(e)})),this._editFields.dispose("delete",(({feature:e})=>{this._deleteFeature(e,!0)})),this._addMapEvents(),t=this._options.modal,K=t,this._controlWidgetToolsDiv.append((te=document.createElement("div"),te.className="ol-wfst--tools-control--loading",te.innerHTML=ee.labels.loading,te)),this._initMapAndLayers()}async _createMapElements(e,t){this._prepareEditLayer(),this._addInteractions(),this._addInteractionHandlers(),e&&this._addMapControl(),this.activateEditMode(t)}_addInteractions(){const i=()=>{this._collectionModify=new c,this._interactionWfsSelect=new a({hitTolerance:10,style:e=>_t(e),toggleCondition:h.never,filter:(e,t)=>Ee()!==be.Edit&&t&&t instanceof Ge&&t===Te()}),this._map.addInteraction(this._interactionWfsSelect),this._interactionWfsSelect.on("select",(({selected:e,deselected:t,mapBrowserEvent:s})=>{const o=s.coordinate;e.length&&e.forEach((e=>{if(!xe(e)){const t=this._interactionWfsSelect.getLayer(e);t.getSource().removeFeature(e),this._addFeatureToEditMode(e,o,t.get(Oe.NAME))}})),t.length&&Ee()!==be.Edit&&t.forEach((e=>{this._collectionModify.remove(e)}))}))},n=()=>{this._interactionSelectModify=new a({style:e=>_t(e),layers:[gt()],toggleCondition:h.never,removeCondition:()=>Ee()===be.Edit}),this._map.addInteraction(this._interactionSelectModify),this._collectionModify=this._interactionSelectModify.getFeatures(),this._keyClickWms=this._map.on(this._options.evtType,(async e=>{if(!this._map.hasFeatureAtPixel(e.pixel)&&Ee()!==be.Edit){const t=Te();if(!t.getVisible()||!t.isVisibleByZoom()||t instanceof Ge)return;const s=await t._getFeaturesByClickEvent(e);if(!s.length)return;this._addFeatureToEditMode(s[0],e.coordinate,t.get(Oe.NAME))}}))};this._options.layers.find((e=>e instanceof Ge))&&i(),this._options.layers.find((e=>e instanceof qe))&&n(),this._interactionModify=new r({style:()=>Ee()===be.Edit?new o({image:new e({radius:6,fill:new t({color:"#ff0000"}),stroke:new s({width:2,color:"rgba(5, 5, 5, 0.9)"})})}):void 0,features:this._collectionModify,condition:e=>h.primaryAction(e)&&Ee()===be.Edit}),this._map.addInteraction(this._interactionModify),this._interactionSnap=new l({source:gt().getSource()}),this._map.addInteraction(this._interactionSnap)}_prepareEditLayer(){this._map.addLayer(gt())}_addMapEvents(){(()=>{document.addEventListener("keydown",(({key:e})=>{if(!document.querySelector("input:focus")&&"Delete"===e){const e=this._collectionModify;e&&e.forEach((e=>{this._deleteFeature(e,!0)}))}}))})(),this._map.on("moveend",(()=>{if(this._currentZoom=this._view.getZoom(),this._currentZoom!==this._lastZoom){const e=Me();Object.keys(e).forEach((t=>{const s=e[t];this._currentZoom>s.getMinZoom()?s.get(Oe.ISVISIBLE)||s.set(Oe.ISVISIBLE,!0):s.get(Oe.ISVISIBLE)&&s.set(Oe.ISVISIBLE,!1)})),this._lastZoom=this._currentZoom}}))}_addInteractionHandlers(){this._interactionModify.on("modifyend",(e=>{Pe(e.features.item(0)),super.dispatchEvent(e)})),this._interactionModify.on("modifystart",(e=>{super.dispatchEvent(e)})),this._onDeselectFeatureEvent(),this._onRemoveFeatureEvent()}_addMapControl(){this._layersControl=new pt(this._options.showUpload?this._uploads:null,this._options.uploadFormats),this._layersControl.on("drawMode",(()=>{if(Ee()===be.Draw)ut(),this.activateEditMode();else{Te().isVisibleByZoom()?this.activateDrawMode(Te()):Y(ee.errors.layerNotVisible)}})),this._layersControl.on("changeGeom",(()=>{Ee()===be.Draw&&this.activateDrawMode(Te())}));const e=this._layersControl.render();this._selectDraw=e.querySelector(".wfst--tools-control--select-draw"),this._controlWidgetToolsDiv.append(e)}_deselectEditFeature(e){this._removeOverlayHelper(e)}_restoreFeatureToLayer(e,t){t=t||e.get("_layerName_");Me()[t].getSource().addFeature(e)}_removeFeatureFromTmpLayer(e){gt().getSource().removeFeature(e)}_onDeselectFeatureEvent(){const e=e=>{const t=e.get("_layerName_"),s=this._options.layers.find((e=>e.get(Oe.NAME)===t));s instanceof Ge&&this._interactionWfsSelect.getFeatures().remove(e),xe(e)?s.transactFeatures(fe.Update,e):(s instanceof Ge&&this._restoreFeatureToLayer(e,t),this._removeFeatureFromTmpLayer(e))};this._keySelect=this._collectionModify.on("remove",(t=>{const s=t.element;this._deselectEditFeature(s),e(s),this._editModeOff()}))}_onRemoveFeatureEvent(){this._keyRemove=gt().getSource().on("removefeature",(e=>{const t=e.feature;if(!t.get("_delete_"))return;this._keySelect&&u.unByKey(this._keySelect);const s=t.get("_layerName_");this.getLayerByName(s).transactFeatures(fe.Delete,t),this._deselectEditFeature(t),this._editModeOff(),this._keySelect&&setTimeout((()=>{this._onDeselectFeatureEvent()}),150)}))}_editModeOn(e){this._editFeatureOriginal=e.clone(),we(be.Edit),gt().getSource().changed(),this._removeOverlayHelper(e),this._controlApplyDiscardChanges=new yt(e),this._controlApplyDiscardChanges.on("cancel",(({feature:e})=>{e.setGeometry(this._editFeatureOriginal.getGeometry()),Ae(e),this._collectionModify.remove(e)})),this._controlApplyDiscardChanges.on("apply",(({feature:e})=>{se(),this._collectionModify.remove(e)})),this._controlApplyDiscardChanges.on("delete",(({feature:e})=>{this._deleteFeature(e,!0)})),this._map.addControl(this._controlApplyDiscardChanges)}_editModeOff(){we(null),this._map.removeControl(this._controlApplyDiscardChanges)}_deleteFeature(e,t){const s=()=>{(Array.isArray(e)?e:[e]).forEach((e=>{e.set("_delete_",!0,!0),gt().getSource().removeFeature(e)})),this._collectionModify.clear();const t=e.get("_layerName_");this._options.layers.find((e=>e.get(Oe.NAME)===t))instanceof Ge&&this._interactionWfsSelect.getFeatures().remove(e)};if(t){W.confirm(ee.labels.confirmDelete,{...this._options.modal}).show().once("dismiss",(function(e,t,o){o&&o.value&&s()}))}else s()}_addFeatureToEditMode(e,t=null,s=null){if(this._collectionModify.getLength())return;s&&e.set("_layerName_",s);if((e?e.getProperties():"")&&e.getGeometry()){gt().getSource().addFeature(e),this._collectionModify.push(e);const o=new Et(e,t);o.on("editFields",(()=>{this._editFields.show(e)})),o.on("editGeom",(()=>{this._editModeOn(e)})),this._map.addOverlay(o);const i=ke(s);i&&i.maybeLockFeature(e.getId())}}activateDrawMode(e){const t=e=>{this.activateEditMode(!1),this._interactionDraw&&this._map.removeInteraction(this._interactionDraw);const t=this._selectDraw.value;this._interactionDraw=new n({source:gt().getSource(),type:t,style:e=>_t(e),stopClick:!0}),this._map.addInteraction(this._interactionDraw),this._interactionDraw.on("drawstart",(e=>{super.dispatchEvent(e)})),this._interactionDraw.on("drawend",(t=>{const s=t.feature;e.transactFeatures(fe.Insert,s),super.dispatchEvent(t)}))};if(this._interactionDraw||e){if(e){if(!e.getVisible())return;(()=>{const e=document.querySelector(".ol-wfst--tools-control-btn-draw");e&&e.classList.add("wfst--active")})(),this._viewport.classList.add("draw-mode"),t(e)}else this._map.removeInteraction(this._interactionDraw),this._viewport.classList.remove("draw-mode");we(e?be.Draw:null)}}activateEditMode(e=!0){e?((()=>{const e=document.querySelector(".ol-wfst--tools-control-btn-edit");e&&e.classList.add("wfst--active")})(),this.activateDrawMode(!1)):this._collectionModify.clear(),this._interactionSelectModify&&this._interactionSelectModify.setActive(e),this._interactionModify.setActive(e),this._interactionWfsSelect&&this._interactionWfsSelect.setActive(e)}_removeOverlayHelper(e){const t=e.getId();if(!t)return;const s=this._map.getOverlayById(t);s&&this._map.removeOverlay(s)}}class Ft extends d{data;layer;constructor(e){super(e.type),this.layer=e.layer,this.data=e.data}}var Lt={WfsLayer:Ge,WmsLayer:qe,Geoserver:class extends F{_options;_countRequests;_insertFeatures;_updateFeatures;_deleteFeatures;_formatWFS;_formatGeoJSON;_formatKml;_xs;state_;constructor(e){super();const t={url:null,advanced:{getCapabilitiesVersion:"1.3.0",getFeatureVersion:"1.0.0",describeFeatureTypeVersion:"1.1.0",lockFeatureVersion:"1.1.0",wfsTransactionVersion:"1.1.0",projection:"EPSG:3857",lockFeatureParams:{expiry:5,lockId:"GeoServer",releaseAction:"SOME"}},headers:{},credentials:"same-origin",useLockFeature:!0};this._options=vt(t,e),this.setAdvanced(this._options.advanced),this.setHeaders(this._options.headers),this.setCredentials(this._options.credentials),this.setUrl(this._options.url),this.setUseLockFeature(this._options.useLockFeature),this._countRequests=0,this._insertFeatures=[],this._updateFeatures=[],this._deleteFeatures=[],this._formatWFS=new P,this._formatGeoJSON=new g,this._formatKml=new k({extractStyles:!1,showPointNames:!1}),this._xs=new XMLSerializer,this.getAndUpdateCapabilities(),this.on("change:capabilities",(()=>{this._checkGeoserverCapabilities()}))}getCapabilities(){return this.get(wt.CAPABILITIES)}setUrl(e,t=!1){this.set(wt.URL,e,t)}getUrl(){return this.get(wt.URL)}setHeaders(e={},t=!1){return this.set(wt.HEADERS,e,t)}getHeaders(){return this.get(wt.HEADERS)}setCredentials(e=null,t=!1){this.set(wt.CREDENTIALS,e,t)}getCredentials(){return this.get(wt.CREDENTIALS)}setAdvanced(e={},t=!1){this.set(wt.ADVANCED,e,t)}getAdvanced(){return this.get(wt.ADVANCED)}hasTransaction(){return this.get(wt.HASTRASNACTION)}hasLockFeature(){return this.get(wt.HASLOCKFEATURE)}getUseLockFeature(){return this.get(wt.USELOCKFEATURE)}setUseLockFeature(e,t=!1){this.set(wt.USELOCKFEATURE,e,t)}isLoaded(){return this.get(wt.ISLOADED)}getState(){return this.state_}async getAndUpdateCapabilities(){try{const e=new URLSearchParams({service:"wfs",version:this.getAdvanced().getCapabilitiesVersion,request:"GetCapabilities",exceptions:"application/json"}),t=this.getUrl()+"?"+e.toString(),s=await fetch(t,{headers:this.getHeaders(),credentials:this.getCredentials()});if(!s.ok)throw new Error("");const o=await s.text(),i=(new window.DOMParser).parseFromString(o,"text/xml");return this.set(wt.CAPABILITIES,i),this.state_=i?"ready":"error",i}catch(e){console.error(e);const t="string"==typeof e?e:ee.errors.capabilities;Y(t,e)}}_checkGeoserverCapabilities(){const e=this.getCapabilities().getElementsByTagName("ows:Operation");if(Array.from(e).forEach((e=>{"Transaction"===e.getAttribute("name")?this.set(wt.HASTRASNACTION,!0):"LockFeature"===e.getAttribute("name")?this.set(wt.HASLOCKFEATURE,!0):"DescribeFeatureType"===e.getAttribute("name")&&this.set(wt.HASDESCRIBEFEATURETYPE,!0)})),!this.hasTransaction())throw ee.errors.wfst}async transact(e,t,s){t=Array.isArray(t)?t:[t];const o=[],i=ke(s);for(const s of t){let t=this._cloneFeature(s);const n=t.getGeometry();n instanceof T?this._transformGeoemtryCollectionToGeometries(t,n):n instanceof L&&this._transformCircleToPolygon(t,n),"beforeTransactFeature"in i&&"function"==typeof i.beforeTransactFeature&&(t=i.beforeTransactFeature(t,e)),t&&o.push(t)}if(!o.length)return Y(ee.errors.noValidGeometry),!1;switch(e){case fe.Insert:this._insertFeatures=[...this._insertFeatures,...o];break;case fe.Update:this._updateFeatures=[...this._updateFeatures,...o];break;case fe.Delete:this._deleteFeatures=[...this._deleteFeatures,...o]}this._countRequests++;const n=this._countRequests;return new Promise(((o,r)=>{setTimeout((async()=>{try{if(n!==this._countRequests)return;let r=Fe().getView().getProjection().getCode();if(r="EPSG:4326"===r?"urn:x-ogc:def:crs:EPSG:4326":r,!i||!i.getDescribeFeatureType())throw new Error(`${ee.errors.layerNotFound}: "${s}"`);const a=i.getDescribeFeatureType()._parsed,l={featureNS:a.namespace,featureType:s,srsName:r,featurePrefix:null,nativeElements:null,version:this.getAdvanced().wfsTransactionVersion},c=this._formatWFS.writeTransaction(this._insertFeatures,this._updateFeatures,this._deleteFeatures,l);let d=this._xs.serializeToString(c);const h=a.geomType,u=a.geomField;if(h===ge.GeometryCollection)if(e===fe.Insert)d=d.replace(/<geometry>/g,`<geometry><MultiGeometry xmlns="http://www.opengis.net/gml" srsName="${r}"><geometryMember>`),d=d.replace(/<\/geometry>/g,"</geometryMember></MultiGeometry></geometry>");else if(e===fe.Update){const e=`<MultiGeometry xmlns="http://www.opengis.net/gml" srsName="${r}"><geometryMember>`,t="</geometryMember></MultiGeometry>";d=d.replace(/(.*)(<Name>geometry<\/Name><Value>)(.*?)(<\/Value>)(.*)/g,`$1$2${e}$3${t}$4$5`)}d=e===fe.Insert?d.replace(/<(\/?)\bgeometry\b>/g,`<$1${u}>`):d.replace(/<Name>geometry<\/Name>/g,`<Name>${u}</Name>`),this.hasLockFeature&&this.getUseLockFeature()&&e!==fe.Insert&&(d=d.replace("</Transaction>",`<LockId>${this._options.advanced.lockFeatureParams.lockId}</LockId></Transaction>`));const p={"Content-Type":"text/xml",...this.getHeaders()},m=await fetch(this.getUrl(),{method:"POST",body:d,headers:p,credentials:this._options.credentials});if(!m.ok)throw new Error(ee.errors.transaction+" "+m.status);const g=await m.text(),f=this._formatWFS.readTransactionResponse(g),v=ke(s);if(!Object.keys(f).length){const e=String(g).match(/<ows:ExceptionText>([\s\S]*?)<\/ows:ExceptionText>/);if(e)throw v instanceof qe&&this._removeFeatures(t),new Error(e[1])}e!==fe.Delete&&this._removeFeatures(t),v.refresh(),se(!1),this._insertFeatures=[],this._updateFeatures=[],this._deleteFeatures=[],this._countRequests=0,o(f)}catch(e){Y(e.message,e),se(!1),this._countRequests=0,r()}}),0)}))}_removeFeatures(e){for(const t of e)gt().getSource().removeFeature(t)}_transformCircleToPolygon(e,t){const s=A.fromCircle(t);e.setGeometry(s)}_transformGeoemtryCollectionToGeometries(e,t){let s=t.getGeometries()[0];s instanceof L&&(s=A.fromCircle(s)),e.setGeometry(s)}_cloneFeature(e){Ae(e);const t=e.getProperties();delete t.boundedBy,delete t._layerName_;const s=new M(t);return s.setId(e.getId()),s}async lockFeature(e,t,s=0){const o=new URLSearchParams({service:"wfs",version:this.getAdvanced().lockFeatureVersion,request:"LockFeature",typeName:t,expiry:String(this._options.advanced.lockFeatureParams.expiry),LockId:this._options.advanced.lockFeatureParams.lockId,releaseAction:this._options.advanced.lockFeatureParams.releaseAction,exceptions:"application/json",featureid:`${e}`}),i=this.getUrl()+"?"+o.toString();try{const o=await fetch(i,{headers:this._options.headers,credentials:this._options.credentials});if(!o.ok)throw new Error(ee.errors.lockFeature);const n=await o.text();try{const o=JSON.parse(n);if("exceptions"in o){const i=new Error(J(o));if("CannotLockAllFeatures"!==o.exceptions[0].code)throw i;if(s)throw i;this.lockFeature(e,t,1)}}catch(e){}return n}catch(e){Y(e.message,e)}}}};return Object.assign(Ct,Lt),Ct}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("ol/style/Circle.js"),require("ol/style/Fill.js"),require("ol/style/Stroke.js"),require("ol/style/Style.js"),require("ol/control/Control.js"),require("ol/interaction/Draw.js"),require("ol/interaction/Modify.js"),require("ol/interaction/Select.js"),require("ol/interaction/Snap.js"),require("ol/Collection.js"),require("ol/events/Event.js"),require("ol/events/condition.js"),require("ol/Observable.js"),require("ol/layer/Vector.js"),require("ol/layer/Base.js"),require("ol/format/GeoJSON.js"),require("ol/source/Vector.js"),require("ol/proj.js"),require("ol/loadingstrategy.js"),require("ol/layer/Tile.js"),require("ol/source/TileWMS.js"),require("ol/geom.js"),require("ol/format/KML.js"),require("ol/format/WFS.js"),require("ol/style.js"),require("ol/Object.js"),require("ol/geom/Circle.js"),require("ol/geom/GeometryCollection.js"),require("ol/Feature.js"),require("ol/geom/Polygon.js"),require("ol/extent.js"),require("ol/Overlay.js")):"function"==typeof define&&define.amd?define(["ol/style/Circle.js","ol/style/Fill.js","ol/style/Stroke.js","ol/style/Style.js","ol/control/Control.js","ol/interaction/Draw.js","ol/interaction/Modify.js","ol/interaction/Select.js","ol/interaction/Snap.js","ol/Collection.js","ol/events/Event.js","ol/events/condition.js","ol/Observable.js","ol/layer/Vector.js","ol/layer/Base.js","ol/format/GeoJSON.js","ol/source/Vector.js","ol/proj.js","ol/loadingstrategy.js","ol/layer/Tile.js","ol/source/TileWMS.js","ol/geom.js","ol/format/KML.js","ol/format/WFS.js","ol/style.js","ol/Object.js","ol/geom/Circle.js","ol/geom/GeometryCollection.js","ol/Feature.js","ol/geom/Polygon.js","ol/extent.js","ol/Overlay.js"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Wfst=t(e.ol.style.Circle,e.ol.style.Fill,e.ol.style.Stroke,e.ol.style.Style,e.ol.control.Control,e.ol.interaction.Draw,e.ol.interaction.Modify,e.ol.interaction.Select,e.ol.interaction.Snap,e.ol.Collection,e.ol.events.Event,e.ol.events.condition,e.ol.Observable,e.ol.layer.Vector,e.ol.layer.Base,e.ol.format.GeoJSON,e.ol.source.Vector,e.ol.proj,e.ol.loadingstrategy,e.ol.layer.Tile,e.ol.source.TileWMS,e.ol.geom,e.ol.format.KML,e.ol.format.WFS,e.ol.style,e.ol.Object,e.ol.geom.Circle,e.ol.geom.GeometryCollection,e.ol.Feature,e.ol.geom.Polygon,e.ol.extent,e.ol.Overlay)}(this,(function(e,t,o,s,i,r,n,a,l,c,d,h,u,p,m,g,f,v,y,_,b,w,E,S,C,F,L,T,M,k,j,A){"use strict";function O(){}function N(){N.init.call(this)}function x(e){return void 0===e._maxListeners?N.defaultMaxListeners:e._maxListeners}function I(e,t,o,s){var i,r,n,a;if("function"!=typeof o)throw new TypeError('"listener" argument must be a function');if((r=e._events)?(r.newListener&&(e.emit("newListener",t,o.listener?o.listener:o),r=e._events),n=r[t]):(r=e._events=new O,e._eventsCount=0),n){if("function"==typeof n?n=r[t]=s?[o,n]:[n,o]:s?n.unshift(o):n.push(o),!n.warned&&(i=x(e))&&i>0&&n.length>i){n.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+n.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=n.length,a=l,"function"==typeof console.warn?console.warn(a):console.log(a)}}else n=r[t]=o,++e._eventsCount;return e}function G(e,t,o){var s=!1;function i(){e.removeListener(t,i),s||(s=!0,o.apply(e,arguments))}return i.listener=o,i}function P(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 D(e,t){for(var o=new Array(t);t--;)o[t]=e[t];return o}O.prototype=Object.create(null),N.EventEmitter=N,N.usingDomains=!1,N.prototype.domain=void 0,N.prototype._events=void 0,N.prototype._maxListeners=void 0,N.defaultMaxListeners=10,N.init=function(){this.domain=null,N.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new O,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},N.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},N.prototype.getMaxListeners=function(){return x(this)},N.prototype.emit=function(e){var t,o,s,i,r,n,a,l="error"===e;if(n=this._events)l=l&&null==n.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=n[e]))return!1;var d="function"==typeof o;switch(s=arguments.length){case 1:!function(e,t,o){if(t)e.call(o);else for(var s=e.length,i=D(e,s),r=0;r<s;++r)i[r].call(o)}(o,d,this);break;case 2:!function(e,t,o,s){if(t)e.call(o,s);else for(var i=e.length,r=D(e,i),n=0;n<i;++n)r[n].call(o,s)}(o,d,this,arguments[1]);break;case 3:!function(e,t,o,s,i){if(t)e.call(o,s,i);else for(var r=e.length,n=D(e,r),a=0;a<r;++a)n[a].call(o,s,i)}(o,d,this,arguments[1],arguments[2]);break;case 4:!function(e,t,o,s,i,r){if(t)e.call(o,s,i,r);else for(var n=e.length,a=D(e,n),l=0;l<n;++l)a[l].call(o,s,i,r)}(o,d,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(s-1),r=1;r<s;r++)i[r-1]=arguments[r];!function(e,t,o,s){if(t)e.apply(o,s);else for(var i=e.length,r=D(e,i),n=0;n<i;++n)r[n].apply(o,s)}(o,d,this,i)}return!0},N.prototype.addListener=function(e,t){return I(this,e,t,!1)},N.prototype.on=N.prototype.addListener,N.prototype.prependListener=function(e,t){return I(this,e,t,!0)},N.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,G(this,e,t)),this},N.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,G(this,e,t)),this},N.prototype.removeListener=function(e,t){var o,s,i,r,n;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(s=this._events))return this;if(!(o=s[e]))return this;if(o===t||o.listener&&o.listener===t)0==--this._eventsCount?this._events=new O:(delete s[e],s.removeListener&&this.emit("removeListener",e,o.listener||t));else if("function"!=typeof o){for(i=-1,r=o.length;r-- >0;)if(o[r]===t||o[r].listener&&o[r].listener===t){n=o[r].listener,i=r;break}if(i<0)return this;if(1===o.length){if(o[0]=void 0,0==--this._eventsCount)return this._events=new O,this;delete s[e]}else!function(e,t){for(var o=t,s=o+1,i=e.length;s<i;o+=1,s+=1)e[o]=e[s];e.pop()}(o,i);s.removeListener&&this.emit("removeListener",e,n||t)}return this},N.prototype.off=function(e,t){return this.removeListener(e,t)},N.prototype.removeAllListeners=function(e){var t,o;if(!(o=this._events))return this;if(!o.removeListener)return 0===arguments.length?(this._events=new O,this._eventsCount=0):o[e]&&(0==--this._eventsCount?this._events=new O:delete o[e]),this;if(0===arguments.length){for(var s,i=Object.keys(o),r=0;r<i.length;++r)"removeListener"!==(s=i[r])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=new O,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},N.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):[]},N.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):P.call(e,t)},N.prototype.listenerCount=P,N.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};let V=null;const q=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}),R=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"}}]}),U={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 H(e,t,o){let s="data",i=e[s]||{};if(void 0===o){if(e[s]&&e[s][t])return e[s][t];var r=e.getAttribute(`${s}-${t}`);return void 0!==r?r:null}return i[t]=o,e[s]=i,e}function z(e,t){return e.nodeName?e:(e=e.replace(/(\t|\n$)/g,""),V||(V=document.createElement("div")),V.innerHTML="",V.innerHTML=e,!0===t?V.childNodes:V.childNodes[0])}function $(e){let t=[e];for(;e.parentNode;)e=e.parentNode,t.push(e);return t}class B extends N{static set templates(e){this._baseTemplates=e}static get templates(){return Object.assign({},U,B._baseTemplates||{})}static set buttons(e){this._baseButtons=e}static get buttons(){return Object.assign({},R,B._baseButtons||{})}static set options(e){this._baseOptions=e}static get options(){return Object.assign({},q,B._baseOptions||{})}static get version(){return"0.12.0"}static alert(e,t={}){let o=Object.assign({},q,{title:e,content:!1,construct:!0,headerClose:!1,buttons:B.buttons.alert},t);return new B(o)}static confirm(e,t={}){let o=Object.assign({},q,{title:e,content:!1,construct:!0,headerClose:!1,buttons:B.buttons.confirm},t);return new B(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._pointerInContent=!1,this._options=Object.assign({},B.options,e),this._templates=Object.assign({},B.templates,e.templates||{}),this._html.appendTo=document.querySelector(this._options.appendTo),this._scrollbarWidth=function(){let e,t,o,s=document.createElement("div");return Object.assign(s.style,{visibility:"hidden",width:"100px"}),document.body.appendChild(s),o=s.offsetWidth,s.style.overflow="scroll",e=document.createElement("div"),e.style.width="100%",s.appendChild(e),t=o-e.offsetWidth,document.body.removeChild(s),t}(),null===this._options.buttons&&(this._options.buttons=B.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.`);H(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,s=!!t.animate&&t.animateClass;return e.container=z(o.container),e.dialog=z(o.dialog),e.content=z(o.content),e.header=z(o.header),e.headerClose=z(o.headerClose),e.body=z(o.body),e.footer=z(o.footer),s&&e.container.classList.add(s),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");H(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.mousedownHandler=this._handleMousedownEvent.bind(this),e.container.addEventListener("mousedown",this._events.mousedownHandler),this._events.clickHandler=this._handleClickEvent.bind(this),e.container.addEventListener("click",this._events.clickHandler),this._events.resizeHandler=this._handleResizeEvent.bind(this),window.addEventListener("resize",this._events.resizeHandler)}_handleMousedownEvent(e){this._pointerInContent=!1,$(e.target).every((e=>!e.classList||!e.classList.contains("modal-content")||(this._pointerInContent=!0,!1)))}_handleClickEvent(e){$(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,H(e.target,"button")),this.hide(),!1):!(!this._pointerInContent&&t.classList.contains("modal"))||(this.emit("dismiss",this,e,null),this.hide(),!1)))))),this._pointerInContent=!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,s=!!o.animate&&o.animateClass;e.backdrop=z(t.backdrop),s&&e.backdrop.classList.add(s),e.appendTo.appendChild(e.backdrop),s&&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("mousedown",this._events.mousedownHandler),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"}}}let W={};const Z=new Set,K=e=>"exceptions"in e?e.exceptions.map((e=>e.text)).join(","):"",J=(e,t=null,o="")=>{if(Z.has(o))return;Z.add(o);let s=`<b>Error: ${e}</b>`;t&&t.message!==e&&(s+=`. ${t.message}`);const i=B.alert(s,W);i.show(),i.on("hidden",(()=>{Z.delete(o)}))},Y={labels:{select:"Select",addElement:"Toggle Draw mode",editElement:"Edit feature",save:"Save",delete:"Delete",cancel:"Cancel",apply:"Apply changes",upload:"Upload",editMode:"Edit Mode",confirmDelete:"Are you sure to delete the feature?",geomTypeNotSupported:"Geometry not supported by layer",editFields:"Edit fields",editGeom:"Edit geometry",selectDrawType:"Geometry type to draw",uploadToLayer:"Upload file to selected layer",uploadFeatures:"Uploaded features to layer",validFeatures:"Valid geometries",invalidFeatures:"Invalid",loading:"Loading...",toggleVisibility:"Toggle layer visibility",close:"Close"},errors:{capabilities:"GeoServer Capabilities could not be downloaded.",wfst:"The GeoServer does not support Transactions",layer:"Could not get data from layer",layerNotFound:"Layer not found",layerNotVisible:"Layer is not visible",noValidGeometry:"No valid geometries found to add to this layer",geoserver:"Failed to get data from GeoServer",badFormat:"Unsupported format",badFile:"Error reading items from file",lockFeature:"Could not lock items on the GeoServer",transaction:"Error when doing Transaction with GeoServer",getFeatures:"Error getting elements from GeoServer"}},X={es:{labels:{select:"Seleccionar",addElement:"Modo dibujo",editElement:"Editar elemento",save:"Guardar",delete:"Eliminar",cancel:"Cancelar",apply:"Aplicar cambios",upload:"Subir",editMode:"Modo Edición",confirmDelete:"¿Estás seguro de borrar el elemento?",geomTypeNotSupported:"Geometría no compatible con la capa",editFields:"Editar campos",editGeom:"Editar geometría",selectDrawType:"Tipo de geometría para dibujar",uploadToLayer:"Subir archivo a la capa seleccionada",uploadFeatures:"Subida de elementos a la capa",validFeatures:"Válidas",invalidFeatures:"Invalidas",loading:"Cargando...",toggleVisibility:"Cambiar visibilidad de la capa",close:"Cerrar"},errors:{capabilities:"No se pudieron obtener las Capabilidades del GeoServer",wfst:"El GeoServer no tiene soporte a Transacciones",layer:"No se pudieron obtener datos de la capa",layerNotFound:"Capa no encontrada",layerNotVisible:"La capa no está visible",noValidGeometry:"No se encontraron geometrías válidas para agregar a esta capa",geoserver:"No se pudieron obtener datos desde el GeoServer",badFormat:"Formato no soportado",badFile:"Error al leer elementos del archivo",lockFeature:"No se pudieron bloquear elementos en el GeoServer",transaction:"Error al hacer transacción con el GeoServer",getFeatures:"Error al obtener elemento desde el GeoServer"}},en:Y,zh:{labels:{select:"选择",addElement:"切换绘图类型",editElement:"编辑元素",save:"保存",delete:"删除",cancel:"取消",apply:"确认并应用改变",upload:"上传",editMode:"编辑模式",confirmDelete:"确认删除元素?",geomTypeNotSupported:"图层不支持该几何",editFields:"编辑区域",editGeom:"编辑几何",selectDrawType:"几何类型",uploadToLayer:"通过文件上传图层",uploadFeatures:"上传元素到图层",validFeatures:"合法的几何类型",invalidFeatures:"不合法",loading:"加载中...",toggleVisibility:"切换图层透明度",close:"关闭"},errors:{capabilities:"无法加载GeoServer服务所支持的能力.",wfst:"GeoServer不支持事务",layer:"无法从图层获得数据",layerNotFound:"Layer not found",layerNotVisible:"Layer is not visible",noValidGeometry:"不支持的几何类型无法加载到图层",geoserver:"无法从GeoServer获取数据",badFormat:"不支持的格式",badFile:"读取文件数据出错",lockFeature:"无法锁定GeoServer上的元素.",transaction:"GeoServer处理事务出错.",getFeatures:"从GeoServer获取元素出错."}}};let Q=Y;let ee;const te=(e=!0)=>{e?ee.classList.add("ol-wfst--tools-control--loading-show"):ee.classList.remove("ol-wfst--tools-control--loading-show")},oe=(e,t,o=[])=>{const s=Object.getOwnPropertyDescriptors(t);for(let e of o)delete s[e];Object.defineProperties(e,s)},se=(e,t=[e])=>{const o=Object.getPrototypeOf(e);return null===o?t:se(o,[...t,o])},ie=(e,t,o=[])=>{var s;const i=null!==(s=((...e)=>{if(0===e.length)return;let t;const o=e.map((e=>se(e)));for(;o.every((e=>e.length>0));){const e=o.map((e=>e.pop())),s=e[0];if(!e.every((e=>e===s)))break;t=s}return t})(...e))&&void 0!==s?s:Object.prototype,r=Object.create(i),n=se(i);for(let t of e){let e=se(t);for(let t=e.length-1;t>=0;t--){let s=e[t];-1===n.indexOf(s)&&(oe(r,s,["constructor",...o]),n.push(s))}}return r.constructor=t,r},re=e=>e.filter(((t,o)=>e.indexOf(t)==o)),ne=new Map,ae=e=>ne.get(e),le=(e,t)=>{var o,s;const i=re([...Object.getOwnPropertyNames(e),...Object.getOwnPropertyNames(t)]),r={};for(let n of i)r[n]=re([...null!==(o=null==e?void 0:e[n])&&void 0!==o?o:[],...null!==(s=null==t?void 0:t[n])&&void 0!==s?s:[]]);return r},ce=(e,t)=>{var o,s,i,r;return{property:le(null!==(o=null==e?void 0:e.property)&&void 0!==o?o:{},null!==(s=null==t?void 0:t.property)&&void 0!==s?s:{}),method:le(null!==(i=null==e?void 0:e.method)&&void 0!==i?i:{},null!==(r=null==t?void 0:t.method)&&void 0!==r?r:{})}},de=new Map,he=(...e)=>{const t=((...e)=>{var t;const o=new Set,s=new Set([...e]);for(;s.size>0;)for(let e of s){const i=[...se(e.prototype).map((e=>e.constructor)),...null!==(t=ae(e))&&void 0!==t?t:[]].filter((e=>!o.has(e)));for(let e of i)s.add(e);o.add(e),s.delete(e)}return[...o]})(...e).map((e=>de.get(e))).filter((e=>!!e));return 0==t.length?{}:1==t.length?t[0]:t.reduce(((e,t)=>((e,t)=>{var o,s,i,r,n,a;return{class:re([...null!==(o=null==e?void 0:e.class)&&void 0!==o?o:[],...null!==(s=null==t?void 0:t.class)&&void 0!==s?s:[]]),static:ce(null!==(i=null==e?void 0:e.static)&&void 0!==i?i:{},null!==(r=null==t?void 0:t.static)&&void 0!==r?r:{}),instance:ce(null!==(n=null==e?void 0:e.instance)&&void 0!==n?n:{},null!==(a=null==t?void 0:t.instance)&&void 0!==a?a:{})}})(e,t)))};function ue(...e){var t,o,s;const i=e.map((e=>e.prototype));function r(...t){for(const o of e)oe(this,new o(...t))}r.prototype=ie(i,r),Object.setPrototypeOf(r,ie(e,null,["prototype"]));let n=r;{const i=he(...e);for(let e of null!==(t=null==i?void 0:i.class)&&void 0!==t?t:[]){const t=e(n);t&&(n=t)}pe(null!==(o=null==i?void 0:i.static)&&void 0!==o?o:{},n),pe(null!==(s=null==i?void 0:i.instance)&&void 0!==s?s:{},n.prototype)}var a,l;return a=n,l=e,ne.set(a,l),n}const pe=(e,t)=>{const o=e.property,s=e.method;if(o)for(let e in o)for(let s of o[e])s(t,e);if(s)for(let e in s)for(let o of s[e])o(t,e,Object.getOwnPropertyDescriptor(t,e))};var me,ge;let fe;!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"}(me||(me={})),function(e){e.Insert="insert",e.Delete="delete",e.Update="update"}(ge||(ge={}));let ve=null,ye=null;var _e;function be(e=null){ye=e}function we(){return ye}!function(e){e.Edit="EDIT",e.Draw="DRAW"}(_e||(_e={}));const Ee=new Set,Se={};function Ce(){return fe}function Fe(e){ve=e}function Le(){return ve}function Te(){return Se}function Me(e){return Te()[e]}function ke(e){Ee.add(String(e.getId()))}function je(e){Ee.delete(String(e.getId()))}function Ae(e){return Ee.has(String(e.getId()))}class Oe extends m{_init(){const e=this.getGeoserver();e.isLoaded()?this.getAndUpdateDescribeFeatureType():e.on("change:capabilities",(async()=>{this.getAndUpdateDescribeFeatureType()}))}async getAndUpdateDescribeFeatureType(){const e=this.get(Ne.NAME),t=this.get(Ne.LABEL);try{const t=this.getGeoserver(),o=new URLSearchParams({service:"wfs",version:t.getAdvanced().describeFeatureTypeVersion,request:"DescribeFeatureType",typeName:e,outputFormat:"application/json",exceptions:"application/json"}),s=t.getUrl()+"?"+o.toString(),i=await fetch(s,{headers:t.getHeaders(),credentials:t.getCredentials()});if(!i.ok)throw new Error("");const r=await i.json();if(!r)throw new Error("");if(r.exceptions)throw new Error(K(r));const n=r.targetNamespace,a=r.featureTypes[0].properties,l=a.find((e=>e.type.indexOf("gml:")>=0));r._parsed={namespace:n,properties:a,geomType:l.localType,geomField:l.name},this.set(Ne.DESCRIBEFEATURETYPE,r)}catch(o){console.error(o),J(`${Q.errors.layer} "${t}"`,o,e)}}isVisibleByZoom(){return Ce().getView().getZoom()>this.getMinZoom()}async transactFeatures(e,t){return this.getGeoserver().transact(e,t,this.get(Ne.NAME))}async insertFeatures(e){return this.transactFeatures(ge.Insert,e)}async maybeLockFeature(e){const t=this.getGeoserver();return t.getUseLockFeature()&&t.hasLockFeature()?await t.lockFeature(e,this.get(Ne.NAME)):null}getGeoserver(){return this.get(Ne.GEOSERVER)}getDescribeFeatureType(){return this.get(Ne.DESCRIBEFEATURETYPE)}}var Ne;!function(e){e.NAME="name",e.LABEL="label",e.DESCRIBEFEATURETYPE="describeFeatureType",e.ISVISIBLE="isVisible",e.GEOSERVER="geoserver"}(Ne||(Ne={}));class xe extends f{constructor(e){super(Object.assign(Object.assign({},e),{format:new g,loader:async(t,o,s,i,r)=>{try{if(e.strategy==y.bbox){const o=v.transformExtent(t,s.getCode(),e.geoServerAdvanced.projection);this.urlParams.set("bbox",o.toString()+`,${e.geoServerAdvanced.projection}`)}const o=e.geoserverUrl+"?"+this.urlParams.toString(),r=await fetch(o,{headers:e.headers,credentials:e.credentials});if(!r.ok)throw new Error("");const n=await r.json();if(n.exceptions)throw new Error(K(n));const a=this.getFormat().readFeatures(n,{featureProjection:s.getCode(),dataProjection:e.geoServerAdvanced.projection});a.forEach((t=>{t.set("_layerName_",e.name,!0)})),this.addFeatures(a),i(a)}catch(o){this.removeLoadedExtent(t),J(Q.errors.geoserver,o,e.name),r()}}})),this.urlParams=new URLSearchParams({SERVICE:"wfs",REQUEST:"GetFeature",OUTPUTFORMAT:"application/json",EXCEPTIONS:"application/json"}),this.urlParams.set("version",e.geoServerAdvanced.getFeatureVersion),this.urlParams.set("typename",e.name),this.urlParams.set("srsName",e.geoServerAdvanced.projection.toString())}}class Ie extends(ue(Oe,p)){constructor(e){super(Object.assign({name:e.name,label:e.label||e.name,minZoom:e.minZoom},e)),this._loadingCount=0,this._loadedCount=0,e.beforeTransactFeature&&(this.beforeTransactFeature=e.beforeTransactFeature);const t=e.geoserver,o=new xe(Object.assign(Object.assign({name:e.name,geoserverUrl:t.getUrl(),geoServerAdvanced:t.getAdvanced()},e.strategy&&{strategy:e.strategy}),{geoserverVendor:e.geoserverVendor}));this._loadingCount=0,this._loadedCount=0,o.on("featuresloadstart",(()=>{this._loadingCount++,1===this._loadingCount&&this.isVisibleByZoom()&&te()})),o.on(["featuresloadend","featuresloaderror"],(()=>{this._loadedCount++,this._loadingCount===this._loadedCount&&(this._loadingCount=0,this._loadedCount=0,setTimeout((()=>{this.dispatchEvent("layerRendered")}),300))})),this.setSource(o);const s=e.geoserverVendor;Object.keys(s).forEach((e=>{o.urlParams.set(e,s[e])}))}refresh(){this.getSource().refresh()}setCustomParam(e,t=null,o=!0){const s=this.getSource();return null==t?s.urlParams.delete(e):s.urlParams.set(e,t),o&&this.refresh(),s.urlParams}}var Ge=2,Pe=3;class De extends b{constructor(e){super(Object.assign({url:e.geoserverUrl,serverType:"geoserver",params:Object.assign({SERVICE:"wms",TILED:!0,LAYERS:e.name,EXCEPTIONS:"application/json"},e.geoserverVendor&&e.geoserverVendor),tileLoadFunction:async(t,o)=>{try{const i=await fetch(o,{headers:e.headers,credentials:e.credentials});if(!i.ok)throw new Error("");let r=await i.blob();if("application/json"==r.type){const e=await(s=r,new Promise((e=>{const t=new FileReader;t.onloadend=()=>e(JSON.parse(t.result)),t.readAsText(s)})));throw new Error(K(e))}t.getImage().src=URL.createObjectURL(r),t.setState(Ge)}catch(o){J(Q.errors.geoserver,o,e.name),t.setState(Pe)}var s}},e))}}class Ve extends(ue(Oe,_)){constructor(e){super(Object.assign({name:e.name,label:e.label||e.name,minZoom:e.minZoom},e)),this._loadingCount=0,this._loadedCount=0,e.beforeTransactFeature&&(this.beforeTransactFeature=e.beforeTransactFeature),this._formatGeoJSON=new g;const t=e.geoserver,o=new De({name:e.name,geoserverUrl:t.getUrl(),geoServerAdvanced:t.getAdvanced(),geoserverVendor:e.geoserverVendor});this._loadingCount=0,this._loadedCount=0,o.on("tileloadstart",(()=>{this._loadingCount++,1===this._loadingCount&&this.isVisibleByZoom()&&te()})),o.on(["tileloadend","tileloaderror"],(()=>{this._loadedCount++,this._loadingCount===this._loadedCount&&(this._loadingCount=0,this._loadedCount=0,setTimeout((()=>{this.dispatchEvent("layerRendered")}),300))})),this.setSource(o)}async _getFeaturesByClickEvent(e){const t=e.coordinate,o=Ce().getView(),s=o.getZoom()>10?10:5,i=this.getSource(),r=i["getFeatureInfoUrl"in i?"getFeatureInfoUrl":"getGetFeatureInfoUrl"](t,o.getResolution(),o.getProjection().getCode(),{INFO_FORMAT:"application/json",BUFFER:s,FEATURE_COUNT:1,EXCEPTIONS:"application/json"}),n=this.getGeoserver();try{const e=await fetch(r,{headers:n.getHeaders(),credentials:n.getCredentials()});if(!e.ok)throw new Error(`${Q.errors.getFeatures} ${e.status}`);const t=await e.json();return this._formatGeoJSON.readFeatures(t)}catch(e){J(e.message,e)}}refresh(){const e=this.getSource();e.refresh();const t=e.getParams();t.t=(new Date).getMilliseconds(),e.updateParams(t)}setCustomParam(e,t=null,o=!0){const s=this.getSource();return s.updateParams({[e]:t}),o&&this.refresh(),s.getParams()}}function qe(e,t={},...o){if("function"==typeof e)return e(t,o);const s=null===e?new DocumentFragment:document.createElement(e);Object.entries(t||{}).forEach((([e,t])=>{void 0!==typeof t&&null!=t&&(e.startsWith("on")&&e.toLowerCase()in window?s.addEventListener(e.toLowerCase().substr(2),t):"className"===e?s.setAttribute("class",t.toString()):"htmlFor"===e?s.setAttribute("for",t.toString()):s.setAttribute(e,t.toString()))}));for(const e of o)e&&(Array.isArray(e)?s.append(...e):void 0===e.nodeType?s.innerHTML+=e:s.appendChild(e));return s}const Re=()=>{const e=document.querySelector(".ol-wfst--tools-control-btn.wfst--active");e&&e.classList.remove("wfst--active")};class Ue extends u{constructor(e,t){super(),this._uploads=e,this._uploadFormats=t}addLayerEl(e){const t=document.querySelector(".wfst--tools-control--select-layers"),o=e.get(Ne.NAME),s=e===Le()?{checked:!0}:{},i=qe("input",Object.assign({value:o,id:`wfst--${o}`,type:"radio",className:"ol-wfst--tools-control-input",name:"wfst--select-layer"},s,{onChange:t=>this._layerChangeHandler(t,e)})),r=qe("div",{className:`wfst--layer-control \n ${e.getVisible()?"ol-wfst--visible-on":""}\n ${e===Le()?"ol-wfst--selected-on":""}`,"data-layer":o},qe("div",{className:"ol-wfst--tools-control-visible"},qe("span",{className:"ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-on",title:Q.labels.toggleVisibility,onClick:e=>this._visibilityClickHandler(e)},qe("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"})),qe("span",{className:"ol-wfst--tools-control-visible-btn ol-wfst--visible-btn-off",title:Q.labels.toggleVisibility,onClick:e=>this._visibilityClickHandler(e)},qe("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"}))),qe("label",{htmlFor:`wfst--${o}`},i,qe("span",{title:e.getDescribeFeatureType()._parsed.geomType},e.get(Ne.LABEL))));return t.appendChild(r),e===Le()&&i.dispatchEvent(new Event("change")),r}_changeStateSelect(e,t=null){const o=(e,t)=>{Array.from(s.options).forEach((o=>{o.selected=o.value===e,o.disabled="all"!==t&&!t.includes(o.value),o.title=o.disabled?Q.labels.geomTypeNotSupported:""}))},s=document.querySelector(".wfst--tools-control--select-draw");let i;if(s){const r=e.getDescribeFeatureType()._parsed.geomType;t?i=s.value:r===me.GeometryCollection?(i=me.LineString,o(i,"all")):r===me.LinearRing?(i=me.LineString,o(i,[me.Circle,me.LinearRing,me.Polygon]),s.value=i):(i=r,o(i,[r]))}return i}_visibilityClickHandler(e){const t=e.currentTarget.closest(".wfst--layer-control"),o=t.dataset.layer;t.classList.toggle("ol-wfst--visible-on");const s=Te()[o];t.classList.contains("ol-wfst--visible-on")?s.setVisible(!0):s.setVisible(!1)}_layerChangeHandler(e,t){const o=e.currentTarget.closest(".wfst--layer-control"),s=document.querySelector(".ol-wfst--selected-on");s&&s.classList.remove("ol-wfst--selected-on"),o.classList.add("ol-wfst--selected-on"),Fe(t),this._changeStateSelect(t)}render(){return qe(null,null,qe("div",{className:"wfst--tools-control--head"},this._uploads&&qe("div",null,qe("input",{id:"ol-wfst--upload",type:"file",accept:this._uploadFormats,onChange:e=>this._uploads.process(e)}),qe("label",{className:"ol-wfst--tools-control-btn ol-wfst--tools-control-btn-upload",htmlFor:"ol-wfst--upload",title:Q.labels.uploadToLayer},qe("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"}))),qe("div",{className:"ol-wfst--tools-control-draw-cnt"},qe("button",{className:"ol-wfst--tools-control-btn ol-wfst--tools-control-btn-draw",type:"button",title:Q.labels.addElement,onClick:()=>{this.dispatchEvent("drawMode")}},qe("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"})),qe("select",{title:Q.labels.selectDrawType,className:"wfst--tools-control--select-draw",onChange:e=>{const t=e.target.value;this._changeStateSelect(Le(),t),this.dispatchEvent("changeGeom")}},[me.Point,me.MultiPoint,me.LineString,me.MultiLineString,me.Polygon,me.MultiPolygon,me.Circle].map((e=>qe("option",{value:e},e)))))),qe("div",{className:"wfst--tools-control--select-layers"}))}}let He=new p({source:new f,zIndex:100});const ze=()=>He;class $e extends u{constructor(e){super(),this._options=e,this._processUpload=e.processUpload,this._formatWFS=new S,this._formatGeoJSON=new g,this._formatKml=new E({extractStyles:!1,showPointNames:!1}),this._xs=new XMLSerializer}async process(e){const t=Ce().getView(),o=e.target.files[0];let s;if(!o)return;const i=o.name.split(".").pop().toLowerCase();try{if(this._processUpload&&(s=this._processUpload(o)),!s){const e=await this._fileReader(o);"geojson"===i||"json"===i?s=this._formatGeoJSON.readFeatures(e,{featureProjection:t.getProjection().getCode()}):"kml"===i?s=this._formatKml.readFeatures(e,{featureProjection:t.getProjection().getCode()}):J(Q.errors.badFormat)}let r=0,n=0;const a=[];for(let e of s)this._checkGeometry(e)||(e=this._fixGeometry(e)),e?(a.push(e),n++):r++;if(n){Re(),this.dispatchEvent(new f.VectorSourceEvent("loadedFeatures",null,a));const e=`\n ${Q.labels.validFeatures}: ${n}<br>\n ${r?`${Q.labels.invalidFeatures}: ${r}`:""}`;this._initModal(e,a)}else J(Q.errors.noValidGeometry);e.target.value=null}catch(e){J(Q.errors.badFile,e)}}async _fileReader(e){return new Promise(((t,o)=>{const s=new FileReader;s.addEventListener("load",(async e=>{const o=e.target.result;t(o)})),s.addEventListener("error",(e=>{console.error("Error"+e),o()})),s.readAsText(e)}))}_fixGeometry(e){const t=Le().getDescribeFeatureType()._parsed.geomType;let o;switch(e.getGeometry().getType()){case me.Point:if(t===me.MultiPoint){const t=e.getGeometry().getCoordinates();o=new w.MultiPoint([t])}break;case me.LineString:if(t===me.MultiLineString){const t=e.getGeometry().getCoordinates();o=new w.MultiLineString([t])}break;case me.Polygon:if(t===me.MultiPolygon){const t=e.getGeometry().getCoordinates();o=new w.MultiPolygon([t])}break;default:o=null}return o?(e.setGeometry(o),e):null}_checkGeometry(e){const t=Le().getDescribeFeatureType()._parsed.geomType,o=e.getGeometry().getType();return t===me.GeometryCollection||o===t}_initModal(e,t){const o=`\n <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">\n ${Q.labels.cancel}\n </button>\n <button type="button" class="btn btn-sm btn-primary" data-action="save" data-dismiss="modal">\n ${Q.labels.upload}\n </button>\n `;new B(Object.assign(Object.assign({},this._options.modal),{header:!0,headerClose:!1,title:Q.labels.uploadFeatures+" "+Le().get(Ne.NAME),content:e,backdrop:"static",footer:o})).show().on("dismiss",((e,o)=>{"save"===o.target.dataset.action?this.dispatchEvent(new f.VectorSourceEvent("addedFeatures",null,t)):ze().getSource().clear()}))}}const Be=(e,...t)=>(t.forEach((t=>{Object.keys(t).forEach((o=>{const s=t[o],i=e[o];e[o]=i&&s&&"object"==typeof i&&"object"==typeof s&&!Array.isArray(i)?Be(i,s):s}))})),e);class We extends i{constructor(e){super({element:qe("div",{className:"ol-wfst--changes-control"},qe("div",{className:"ol-wfst--changes-control-el"},qe("div",{className:"ol-wfst--changes-control-id"},qe("b",null,Q.labels.editMode)," -"," ",qe("i",null,String(e.getId()))),qe("button",{type:"button",className:"btn btn-sm btn-secondary",onClick:()=>{this.dispatchEvent(new f.VectorSourceEvent("cancel",e))}},Q.labels.cancel),qe("button",{type:"button",className:"btn btn-sm btn-primary",onClick:()=>{this.dispatchEvent(new f.VectorSourceEvent("apply",e))}},Q.labels.apply),qe("button",{type:"button",className:"btn btn-sm btn-danger-outline",onClick:()=>{this.dispatchEvent(new f.VectorSourceEvent("delete",e))}},Q.labels.delete)))})}}function Ze(e){const t=e=>{let t=e.getGeometry();t instanceof w.GeometryCollection&&(t=t.getGeometries()[0]);const o=t.getCoordinates();let s=null;if(s=t instanceof w.Polygon||t instanceof w.MultiLineString?o.flat(1):t instanceof w.MultiPolygon?o.flat(2):o,s&&s.length)return new w.MultiPoint(s)};let o=e.getGeometry(),s=o.getType();switch(o instanceof w.GeometryCollection&&(o=o.getGeometries()[0],s=o.getType()),s){case me.Point:case me.MultiPoint:return we()===_e.Edit?[new C.Style({image:new C.Circle({radius:6,fill:new C.Fill({color:"#000000"})})}),new C.Style({image:new C.Circle({radius:4,fill:new C.Fill({color:"#ff0000"})})})]:[new C.Style({image:new C.Circle({radius:5,fill:new C.Fill({color:"#ff0000"})})}),new C.Style({image:new C.Circle({radius:2,fill:new C.Fill({color:"#000000"})})})];default:return we()==_e.Draw||we()==_e.Edit?[new C.Style({stroke:new C.Stroke({color:"rgba( 255, 0, 0, 1)",width:4}),fill:new C.Fill({color:"rgba(255, 0, 0, 0.7)"})}),new C.Style({image:new C.Circle({radius:4,fill:new C.Fill({color:"#ff0000"}),stroke:new C.Stroke({width:2,color:"rgba(5, 5, 5, 0.9)"})}),geometry:e=>t(e)}),new C.Style({stroke:new C.Stroke({color:"rgba(255, 255, 255, 0.7)",width:2})})]:[new C.Style({image:new C.Circle({radius:2,fill:new C.Fill({color:"#000000"})}),geometry:e=>t(e)}),new C.Style({stroke:new C.Stroke({color:"#ff0000",width:4}),fill:new C.Fill({color:"rgba(255, 0, 0, 0.7)"})})]}}class Ke extends u{constructor(e){super(),this._options=e;const t=`\n <button type="button" class="btn btn-sm btn-link btn-third" data-action="delete" data-dismiss="modal">\n ${Q.labels.delete}\n </button>\n <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">\n ${Q.labels.cancel}\n </button>\n <button type="button" class="btn btn-sm btn-primary" data-action="save" data-dismiss="modal">\n ${Q.labels.save}\n </button>\n `;this._modal=new B(Object.assign(Object.assign({},this._options),{header:!0,headerClose:!0,title:"",content:"<div></div>",footer:t})),this._modal.on("dismiss",((e,t)=>{if("save"===t.target.dataset.action){e.el.querySelectorAll("input").forEach((e=>{const t=e.value,o=e.name;this._feature.set(o,t,!0)})),this._feature.changed(),ke(this._feature),this.dispatchEvent(new f.VectorSourceEvent("save",this._feature))}else"delete"===t.target.dataset.action&&this.dispatchEvent(new f.VectorSourceEvent("delete",this._feature))}))}show(e){this._feature=e;const t=`${Q.labels.editElement} ${e.getId()} `,o=e.getProperties(),s=Me(e.get("_layerName_")).getDescribeFeatureType()._parsed.properties;let i='<form autocomplete="false">';Object.keys(o).forEach((e=>{const t=s.find((t=>t.name===e));if(t){let s;switch(t.type){case"xsd:string":default:s="text";break;case"xsd:number":case"xsd:int":s="number";break;case"xsd:date-time":s="datetime"}s&&(i+=`\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="${s}" name="${e}" value="${o[e]||""}">\n </div>`)}})),i+="</form>",this._modal._html.body.innerHTML=i,this._modal._html.header.innerHTML=t,this._modal.show()}}var Je;!function(e){e.CAPABILITIES="capabilities",e.URL="url",e.HEADERS="headers",e.CREDENTIALS="credentials",e.ADVANCED="advanced",e.HASTRASNACTION="hasTransaction",e.HASLOCKFEATURE="hasLockFeature",e.HASDESCRIBEFEATURETYPE="hasDescribeFeatureType",e.USELOCKFEATURE="useLockFeature",e.ISLOADED="isLoaded"}(Je||(Je={}));class Ye extends A{constructor(e,t=null){super({id:e.getId(),position:t||j.getCenter(e.getGeometry().getExtent()),positioning:"center-center",offset:[0,-40],stopEvent:!0,element:qe("div",null,qe("div",{className:"ol-wfst--edit-button-cnt",onClick:()=>{this.dispatchEvent("editFields")}},qe("button",{className:"ol-wfst--edit-button",type:"button",title:Q.labels.editFields},qe("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='448' height='448' viewBox='0 0 448 448'%3e %3cpath d='M222 296l29-29-38-38-29 29v14h24v24h14zM332 116c-2.25-2.25-6-2-8.25 0.25l-87.5 87.5c-2.25 2.25-2.5 6-0.25 8.25s6 2 8.25-0.25l87.5-87.5c2.25-2.25 2.5-6 0.25-8.25zM352 264.5v47.5c0 39.75-32.25 72-72 72h-208c-39.75 0-72-32.25-72-72v-208c0-39.75 32.25-72 72-72h208c10 0 20 2 29.25 6.25 2.25 1 4 3.25 4.5 5.75 0.5 2.75-0.25 5.25-2.25 7.25l-12.25 12.25c-2.25 2.25-5.25 3-8 2-3.75-1-7.5-1.5-11.25-1.5h-208c-22 0-40 18-40 40v208c0 22 18 40 40 40h208c22 0 40-18 40-40v-31.5c0-2 0.75-4 2.25-5.5l16-16c2.5-2.5 5.75-3 8.75-1.75s5 4 5 7.25zM328 80l72 72-168 168h-72v-72zM439 113l-23 23-72-72 23-23c9.25-9.25 24.75-9.25 34 0l38 38c9.25 9.25 9.25 24.75 0 34z'%3e%3c/path%3e%3c/svg%3e",alt:Q.labels.editFields}))),qe("div",{className:"ol-wfst--edit-button-cnt",onClick:()=>{this.dispatchEvent("editGeom")}},qe("button",{class:"ol-wfst--edit-button",type:"button",title:Q.labels.editGeom},qe("img",{src:"data:image/svg+xml,%3csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='541' height='512' viewBox='0 0 541 512'%3e %3cpath fill='black' d='M103.306 228.483l129.493-125.249c-17.662-4.272-31.226-18.148-34.98-35.663l-0.055-0.307-129.852 125.248c17.812 4.15 31.53 18.061 35.339 35.662l0.056 0.308z'%3e%3c/path%3e %3cpath fill='black' d='M459.052 393.010c-13.486-8.329-22.346-23.018-22.373-39.779v-0.004c-0.053-0.817-0.082-1.772-0.082-2.733s0.030-1.916 0.089-2.863l-0.007 0.13-149.852 71.94c9.598 8.565 15.611 20.969 15.611 34.779 0 0.014 0 0.029 0 0.043v-0.002c-0.048 5.164-0.94 10.104-2.544 14.711l0.098-0.322z'%3e%3c/path%3e %3cpath fill='black' d='M290.207 57.553c-0.009 15.55-7.606 29.324-19.289 37.819l-0.135 0.093 118.054 46.69c-0.216-1.608-0.346-3.48-0.36-5.379v-0.017c0.033-16.948 9.077-31.778 22.596-39.953l0.209-0.118-122.298-48.056c0.659 2.633 1.098 5.693 1.221 8.834l0.002 0.087z'%3e%3c/path%3e %3cpath fill='black' d='M241.36 410.132l-138.629-160.067c-4.734 17.421-18.861 30.61-36.472 33.911l-0.29 0.045 143.881 166.255c1.668-18.735 14.197-34.162 31.183-40.044l0.327-0.099z'%3e%3c/path%3e %3cpath fill='black' d='M243.446 115.105c-31.785 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.785 0 57.552 25.767 57.552 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM243.446 21.582c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.104-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M483.224 410.78c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.552 25.767 57.552 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM483.224 317.257c-19.866 0-35.97 16.104-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M57.553 295.531c-31.785 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.785 0 57.553 25.767 57.553 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM57.553 202.008c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c-0.041-19.835-16.13-35.898-35.97-35.898 0 0 0 0 0 0v0z'%3e%3c/path%3e %3cpath fill='black' d='M256.036 512.072c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.553 25.767 57.553 57.553v0c0 31.786-25.767 57.553-57.553 57.553v0zM256.036 418.55c-19.866 0-35.97 16.104-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e %3cpath fill='black' d='M435.24 194.239c-31.786 0-57.553-25.767-57.553-57.553s25.767-57.553 57.553-57.553c31.786 0 57.553 25.767 57.553 57.553v0c0 31.785-25.767 57.553-57.553 57.553v0zM435.24 100.716c-19.866 0-35.97 16.105-35.97 35.97s16.105 35.97 35.97 35.97c19.866 0 35.97-16.105 35.97-35.97v0c0-19.866-16.105-35.97-35.97-35.97v0z'%3e%3c/path%3e%3c/svg%3e",alt:Q.labels.editGeom}))))})}}const Xe=document.createElement("div");class Qe extends i{constructor(e){super({target:null,element:Xe,render:()=>{this._map||this._init()}}),this._initialized=!1,((e="en",t=null)=>{e in X&&(Q=X[e]),t&&(Q=Object.assign(Object.assign({},Q),t))})(e.language,e.i18n);const t={layers:null,evtType:"singleclick",active:!0,showControl:!0,language:"en",uploadFormats:".geojson,.json,.kml",processUpload:null,modal:{animateClass:"fade",animateInClass:"show",transition:300,backdropTransition:150,templates:{dialog:'<div class="modal-dialog modal-dialog-centered"></div>',headerClose:`<button type="button" class="btn-close" data-dismiss="modal" aria-label="${Q.labels.close}"><span aria-hidden="true">×</span></button>`}}};this._options=Be(t,e),Fe(this._options.layers[0]),this._controlWidgetToolsDiv=Xe,this._controlWidgetToolsDiv.className="ol-wfst--tools-control",this._uploads=new $e(this._options),this._editFields=new Ke(this._options.modal)}getLayers(){return Object.values(Te())}getLayerByName(e=""){const t=Te();return e&&e in t?t[e]:null}async _initMapAndLayers(){try{const e=this._options.layers;if(e.length){let t=0,o=0;e.forEach((e=>{e.getVisible()&&o++,e.on("layerRendered",(()=>{t++,t>=o&&(this._initialized||(this.dispatchEvent("load"),this._initialized=!0),te(!1))})),e.on("change:describeFeatureType",(()=>{const t=this._layersControl.addLayerEl(e);e.on("change:isVisible",(()=>{const o="ol-wfst--layer-not-visible";e.isVisibleByZoom()?t.classList.remove(o):t.classList.add(o)})),e.set(Ne.ISVISIBLE,this._currentZoom>e.getMinZoom()),this.dispatchEvent(new et({type:"describeFeatureType",layer:e,data:e.getDescribeFeatureType()}))})),e._init(),this._map.addLayer(e),function(e){Object.assign(Se,e)}({[e.get(Ne.NAME)]:e})})),this._createMapElements(this._options.showControl,this._options.active)}}catch(e){te(!1),J(e.message,e)}}_init(){var e,t;this._map=super.getMap(),this._view=this._map.getView(),this._viewport=this._map.getViewport(),e=this._map,fe=e,this._uploads.on("addedFeatures",(({features:e})=>{Le().insertFeatures(e)})),this._uploads.on("loadedFeatures",(({features:e})=>{this.activateEditMode();const t=ze().getSource();t.addFeatures(e),this._view.fit(t.getExtent(),{size:this._map.getSize(),maxZoom:21,padding:[100,100,100,100]})})),this._editFields.on("save",(({feature:e})=>{this._collectionModify.remove(e)})),this._editFields.dispose("delete",(({feature:e})=>{this._deleteFeature(e,!0)})),this._addMapEvents(),t=this._options.modal,W=t,this._controlWidgetToolsDiv.append((ee=document.createElement("div"),ee.className="ol-wfst--tools-control--loading",ee.innerHTML=Q.labels.loading,ee)),this._initMapAndLayers()}async _createMapElements(e,t){this._prepareEditLayer(),this._addInteractions(),this._addInteractionHandlers(),e&&this._addMapControl(),this.activateEditMode(t)}_addInteractions(){const i=()=>{this._collectionModify=new c,this._interactionWfsSelect=new a({hitTolerance:10,style:e=>Ze(e),toggleCondition:h.never,filter:(e,t)=>we()!==_e.Edit&&t&&t instanceof Ie&&t===Le()}),this._map.addInteraction(this._interactionWfsSelect),this._interactionWfsSelect.on("select",(({selected:e,deselected:t,mapBrowserEvent:o})=>{const s=o.coordinate;e.length&&e.forEach((e=>{if(!Ae(e)){const t=this._interactionWfsSelect.getLayer(e);t.getSource().removeFeature(e),this._addFeatureToEditMode(e,s,t.get(Ne.NAME))}})),t.length&&we()!==_e.Edit&&t.forEach((e=>{this._collectionModify.remove(e)}))}))},r=()=>{this._interactionSelectModify=new a({style:e=>Ze(e),layers:[ze()],toggleCondition:h.never,removeCondition:()=>we()===_e.Edit}),this._map.addInteraction(this._interactionSelectModify),this._collectionModify=this._interactionSelectModify.getFeatures(),this._keyClickWms=this._map.on(this._options.evtType,(async e=>{if(!this._map.hasFeatureAtPixel(e.pixel)&&we()!==_e.Edit){const t=Le();if(!t.getVisible()||!t.isVisibleByZoom()||t instanceof Ie)return;const o=await t._getFeaturesByClickEvent(e);if(!o.length)return;this._addFeatureToEditMode(o[0],e.coordinate,t.get(Ne.NAME))}}))};this._options.layers.find((e=>e instanceof Ie))&&i(),this._options.layers.find((e=>e instanceof Ve))&&r(),this._interactionModify=new n({style:()=>we()===_e.Edit?new s({image:new e({radius:6,fill:new t({color:"#ff0000"}),stroke:new o({width:2,color:"rgba(5, 5, 5, 0.9)"})})}):void 0,features:this._collectionModify,condition:e=>h.primaryAction(e)&&we()===_e.Edit}),this._map.addInteraction(this._interactionModify),this._interactionSnap=new l({source:ze().getSource()}),this._map.addInteraction(this._interactionSnap)}_prepareEditLayer(){this._map.addLayer(ze())}_addMapEvents(){(()=>{document.addEventListener("keydown",(({key:e})=>{if(!document.querySelector("input:focus")&&"Delete"===e){const e=this._collectionModify;e&&e.forEach((e=>{this._deleteFeature(e,!0)}))}}))})(),this._map.on("moveend",(()=>{if(this._currentZoom=this._view.getZoom(),this._currentZoom!==this._lastZoom){const e=Te();Object.keys(e).forEach((t=>{const o=e[t];this._currentZoom>o.getMinZoom()?o.get(Ne.ISVISIBLE)||o.set(Ne.ISVISIBLE,!0):o.get(Ne.ISVISIBLE)&&o.set(Ne.ISVISIBLE,!1)})),this._lastZoom=this._currentZoom}}))}_addInteractionHandlers(){this._interactionModify.on("modifyend",(e=>{ke(e.features.item(0)),super.dispatchEvent(e)})),this._interactionModify.on("modifystart",(e=>{super.dispatchEvent(e)})),this._onDeselectFeatureEvent(),this._onRemoveFeatureEvent()}_addMapControl(){this._layersControl=new Ue(this._options.showUpload?this._uploads:null,this._options.uploadFormats),this._layersControl.on("drawMode",(()=>{if(we()===_e.Draw)Re(),this.activateEditMode();else{Le().isVisibleByZoom()?this.activateDrawMode(Le()):J(Q.errors.layerNotVisible)}})),this._layersControl.on("changeGeom",(()=>{we()===_e.Draw&&this.activateDrawMode(Le())}));const e=this._layersControl.render();this._selectDraw=e.querySelector(".wfst--tools-control--select-draw"),this._controlWidgetToolsDiv.append(e)}_deselectEditFeature(e){this._removeOverlayHelper(e)}_restoreFeatureToLayer(e,t){t=t||e.get("_layerName_");Te()[t].getSource().addFeature(e)}_removeFeatureFromTmpLayer(e){ze().getSource().removeFeature(e)}_onDeselectFeatureEvent(){const e=e=>{const t=e.get("_layerName_"),o=this._options.layers.find((e=>e.get(Ne.NAME)===t));o instanceof Ie&&this._interactionWfsSelect.getFeatures().remove(e),Ae(e)?o.transactFeatures(ge.Update,e):(o instanceof Ie&&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=ze().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.getLayerByName(o).transactFeatures(ge.Delete,t),this._deselectEditFeature(t),this._editModeOff(),this._keySelect&&setTimeout((()=>{this._onDeselectFeatureEvent()}),150)}))}_editModeOn(e){this._editFeatureOriginal=e.clone(),be(_e.Edit),ze().getSource().changed(),this._removeOverlayHelper(e),this._controlApplyDiscardChanges=new We(e),this._controlApplyDiscardChanges.on("cancel",(({feature:e})=>{e.setGeometry(this._editFeatureOriginal.getGeometry()),je(e),this._collectionModify.remove(e)})),this._controlApplyDiscardChanges.on("apply",(({feature:e})=>{te(),this._collectionModify.remove(e)})),this._controlApplyDiscardChanges.on("delete",(({feature:e})=>{this._deleteFeature(e,!0)})),this._map.addControl(this._controlApplyDiscardChanges)}_editModeOff(){be(null),this._map.removeControl(this._controlApplyDiscardChanges)}_deleteFeature(e,t){const o=()=>{(Array.isArray(e)?e:[e]).forEach((e=>{e.set("_delete_",!0,!0),ze().getSource().removeFeature(e)})),this._collectionModify.clear();const t=e.get("_layerName_");this._options.layers.find((e=>e.get(Ne.NAME)===t))instanceof Ie&&this._interactionWfsSelect.getFeatures().remove(e)};if(t){B.confirm(Q.labels.confirmDelete,Object.assign({},this._options.modal)).show().once("dismiss",(function(e,t,s){s&&s.value&&o()}))}else o()}_addFeatureToEditMode(e,t=null,o=null){if(this._collectionModify.getLength())return;o&&e.set("_layerName_",o);if((e?e.getProperties():"")&&e.getGeometry()){ze().getSource().addFeature(e),this._collectionModify.push(e);const s=new Ye(e,t);s.on("editFields",(()=>{this._editFields.show(e)})),s.on("editGeom",(()=>{this._editModeOn(e)})),this._map.addOverlay(s);const i=Me(o);i&&i.maybeLockFeature(e.getId())}}activateDrawMode(e){const t=e=>{this.activateEditMode(!1),this._interactionDraw&&this._map.removeInteraction(this._interactionDraw);const t=this._selectDraw.value;this._interactionDraw=new r({source:ze().getSource(),type:t,style:e=>Ze(e),stopClick:!0}),this._map.addInteraction(this._interactionDraw),this._interactionDraw.on("drawstart",(e=>{super.dispatchEvent(e)})),this._interactionDraw.on("drawend",(t=>{const o=t.feature;e.transactFeatures(ge.Insert,o),super.dispatchEvent(t)}))};if(this._interactionDraw||e){if(e){if(!e.getVisible())return;(()=>{const e=document.querySelector(".ol-wfst--tools-control-btn-draw");e&&e.classList.add("wfst--active")})(),this._viewport.classList.add("draw-mode"),t(e)}else this._map.removeInteraction(this._interactionDraw),this._viewport.classList.remove("draw-mode");be(e?_e.Draw:null)}}activateEditMode(e=!0){e?((()=>{const e=document.querySelector(".ol-wfst--tools-control-btn-edit");e&&e.classList.add("wfst--active")})(),this.activateDrawMode(!1)):this._collectionModify.clear(),this._interactionSelectModify&&this._interactionSelectModify.setActive(e),this._interactionModify.setActive(e),this._interactionWfsSelect&&this._interactionWfsSelect.setActive(e)}_removeOverlayHelper(e){const t=e.getId();if(!t)return;const o=this._map.getOverlayById(t);o&&this._map.removeOverlay(o)}}class et extends d{constructor(e){super(e.type),this.layer=e.layer,this.data=e.data}}const tt={WfsLayer:Ie,WmsLayer:Ve,Geoserver:class extends F{constructor(e){super();const t={url:null,advanced:{getCapabilitiesVersion:"1.3.0",getFeatureVersion:"1.0.0",describeFeatureTypeVersion:"1.1.0",lockFeatureVersion:"1.1.0",wfsTransactionVersion:"1.1.0",projection:"EPSG:3857",lockFeatureParams:{expiry:5,lockId:"GeoServer",releaseAction:"SOME"}},headers:{},credentials:"same-origin",useLockFeature:!0};this._options=Be(t,e),this.setAdvanced(this._options.advanced),this.setHeaders(this._options.headers),this.setCredentials(this._options.credentials),this.setUrl(this._options.url),this.setUseLockFeature(this._options.useLockFeature),this._countRequests=0,this._insertFeatures=[],this._updateFeatures=[],this._deleteFeatures=[],this._formatWFS=new S,this._formatGeoJSON=new g,this._formatKml=new E({extractStyles:!1,showPointNames:!1}),this._xs=new XMLSerializer,this.getAndUpdateCapabilities(),this.on("change:capabilities",(()=>{this._checkGeoserverCapabilities()}))}getCapabilities(){return this.get(Je.CAPABILITIES)}setUrl(e,t=!1){this.set(Je.URL,e,t)}getUrl(){return this.get(Je.URL)}setHeaders(e={},t=!1){return this.set(Je.HEADERS,e,t)}getHeaders(){return this.get(Je.HEADERS)}setCredentials(e=null,t=!1){this.set(Je.CREDENTIALS,e,t)}getCredentials(){return this.get(Je.CREDENTIALS)}setAdvanced(e={},t=!1){this.set(Je.ADVANCED,e,t)}getAdvanced(){return this.get(Je.ADVANCED)}hasTransaction(){return this.get(Je.HASTRASNACTION)}hasLockFeature(){return this.get(Je.HASLOCKFEATURE)}getUseLockFeature(){return this.get(Je.USELOCKFEATURE)}setUseLockFeature(e,t=!1){this.set(Je.USELOCKFEATURE,e,t)}isLoaded(){return this.get(Je.ISLOADED)}getState(){return this.state_}async getAndUpdateCapabilities(){try{const e=new URLSearchParams({service:"wfs",version:this.getAdvanced().getCapabilitiesVersion,request:"GetCapabilities",exceptions:"application/json"}),t=this.getUrl()+"?"+e.toString(),o=await fetch(t,{headers:this.getHeaders(),credentials:this.getCredentials()});if(!o.ok)throw new Error("");const s=await o.text(),i=(new window.DOMParser).parseFromString(s,"text/xml");return this.set(Je.CAPABILITIES,i),this.state_=i?"ready":"error",i}catch(e){console.error(e);const t="string"==typeof e?e:Q.errors.capabilities;J(t,e)}}_checkGeoserverCapabilities(){const e=this.getCapabilities().getElementsByTagName("ows:Operation");if(Array.from(e).forEach((e=>{"Transaction"===e.getAttribute("name")?this.set(Je.HASTRASNACTION,!0):"LockFeature"===e.getAttribute("name")?this.set(Je.HASLOCKFEATURE,!0):"DescribeFeatureType"===e.getAttribute("name")&&this.set(Je.HASDESCRIBEFEATURETYPE,!0)})),!this.hasTransaction())throw Q.errors.wfst}async transact(e,t,o){t=Array.isArray(t)?t:[t];const s=[],i=Me(o);for(const o of t){let t=this._cloneFeature(o);const r=t.getGeometry();r instanceof T?this._transformGeoemtryCollectionToGeometries(t,r):r instanceof L&&this._transformCircleToPolygon(t,r),"beforeTransactFeature"in i&&"function"==typeof i.beforeTransactFeature&&(t=i.beforeTransactFeature(t,e)),t&&s.push(t)}if(!s.length)return J(Q.errors.noValidGeometry),!1;switch(e){case ge.Insert:this._insertFeatures=[...this._insertFeatures,...s];break;case ge.Update:this._updateFeatures=[...this._updateFeatures,...s];break;case ge.Delete:this._deleteFeatures=[...this._deleteFeatures,...s]}this._countRequests++;const r=this._countRequests;return new Promise(((s,n)=>{setTimeout((async()=>{try{if(r!==this._countRequests)return;let n=Ce().getView().getProjection().getCode();if(n="EPSG:4326"===n?"urn:x-ogc:def:crs:EPSG:4326":n,!i||!i.getDescribeFeatureType())throw new Error(`${Q.errors.layerNotFound}: "${o}"`);const a=i.getDescribeFeatureType()._parsed,l={featureNS:a.namespace,featureType:o,srsName:n,featurePrefix:null,nativeElements:null,version:this.getAdvanced().wfsTransactionVersion},c=this._formatWFS.writeTransaction(this._insertFeatures,this._updateFeatures,this._deleteFeatures,l);let d=this._xs.serializeToString(c);const h=a.geomType,u=a.geomField;if(h===me.GeometryCollection)if(e===ge.Insert)d=d.replace(/<geometry>/g,`<geometry><MultiGeometry xmlns="http://www.opengis.net/gml" srsName="${n}"><geometryMember>`),d=d.replace(/<\/geometry>/g,"</geometryMember></MultiGeometry></geometry>");else if(e===ge.Update){const e=`<MultiGeometry xmlns="http://www.opengis.net/gml" srsName="${n}"><geometryMember>`,t="</geometryMember></MultiGeometry>";d=d.replace(/(.*)(<Name>geometry<\/Name><Value>)(.*?)(<\/Value>)(.*)/g,`$1$2${e}$3${t}$4$5`)}d=e===ge.Insert?d.replace(/<(\/?)\bgeometry\b>/g,`<$1${u}>`):d.replace(/<Name>geometry<\/Name>/g,`<Name>${u}</Name>`),this.hasLockFeature&&this.getUseLockFeature()&&e!==ge.Insert&&(d=d.replace("</Transaction>",`<LockId>${this._options.advanced.lockFeatureParams.lockId}</LockId></Transaction>`));const p=Object.assign({"Content-Type":"text/xml"},this.getHeaders()),m=await fetch(this.getUrl(),{method:"POST",body:d,headers:p,credentials:this._options.credentials});if(!m.ok)throw new Error(Q.errors.transaction+" "+m.status);const g=await m.text(),f=this._formatWFS.readTransactionResponse(g),v=Me(o);if(!Object.keys(f).length){const e=String(g).match(/<ows:ExceptionText>([\s\S]*?)<\/ows:ExceptionText>/);if(e)throw v instanceof Ve&&this._removeFeatures(t),new Error(e[1])}e!==ge.Delete&&this._removeFeatures(t),v.refresh(),te(!1),this._insertFeatures=[],this._updateFeatures=[],this._deleteFeatures=[],this._countRequests=0,s(f)}catch(e){J(e.message,e),te(!1),this._countRequests=0,n()}}),0)}))}_removeFeatures(e){for(const t of e)ze().getSource().removeFeature(t)}_transformCircleToPolygon(e,t){const o=k.fromCircle(t);e.setGeometry(o)}_transformGeoemtryCollectionToGeometries(e,t){let o=t.getGeometries()[0];o instanceof L&&(o=k.fromCircle(o)),e.setGeometry(o)}_cloneFeature(e){je(e);const t=e.getProperties();delete t.boundedBy,delete t._layerName_;const o=new M(t);return o.setId(e.getId()),o}async lockFeature(e,t,o=0){const s=new URLSearchParams({service:"wfs",version:this.getAdvanced().lockFeatureVersion,request:"LockFeature",typeName:t,expiry:String(this._options.advanced.lockFeatureParams.expiry),LockId:this._options.advanced.lockFeatureParams.lockId,releaseAction:this._options.advanced.lockFeatureParams.releaseAction,exceptions:"application/json",featureid:`${e}`}),i=this.getUrl()+"?"+s.toString();try{const s=await fetch(i,{headers:this._options.headers,credentials:this._options.credentials});if(!s.ok)throw new Error(Q.errors.lockFeature);const r=await s.text();try{const s=JSON.parse(r);if("exceptions"in s){const i=new Error(K(s));if("CannotLockAllFeatures"!==s.exceptions[0].code)throw i;if(o)throw i;this.lockFeature(e,t,1)}}catch(e){}return r}catch(e){J(e.message,e)}}}};return Object.assign(Qe,tt),Qe}));
|
|
2
2
|
//# sourceMappingURL=ol-wfst.min.js.map
|