text: /*! Leaflet-WFST 1.1.0 2016-11-10 */
  !function(a,b,c){"use strict";L.XmlUtil={namespaces:{xlink:"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/",xsd:"http://www.w3.org/2001/XMLSchema",xsi:"http://www.w3.org/2001/XMLSchema-instance",wfs:"http://www.opengis.net/wfs",gml:"http://www.opengis.net/gml",ogc:"http://www.opengis.net/ogc",ows:"http://www.opengis.net/ows"},xmldoc:(new DOMParser).parseFromString("<root />","text/xml"),setAttributes:function(a,b){for(var c in b)if(null!=b[c]&&b[c].toString){var d=b[c].toString(),e=this.namespaces[c.substring(0,c.indexOf(":"))]||null;a.setAttributeNS(e,c,d)}},evaluate:function(a,b){var c=new DOMParser,d=c.parseFromString(b,"text/xml"),e=new XPathEvaluator,f=e.createNSResolver(d.documentElement);return e.evaluate(a,d,f,XPathResult.ANY_TYPE,null)},createElementNS:function(a,b,c){c=c||{};var d=c.uri;d||(d=this.namespaces[a.substring(0,a.indexOf(":"))]),d||(d=this.namespaces[c.prefix]);var e=d?this.xmldoc.createElementNS(d,a):this.xmldoc.createElement(a);return b&&this.setAttributes(e,b),null!=c.value&&e.appendChild(this.xmldoc.createTextNode(c.value)),e},createTextNode:function(a){return this.xmldoc.createTextNode(a)},serializeXmlDocumentString:function(a){var c=b.implementation.createDocument("","",null);c.appendChild(a);var d=new XMLSerializer;return d.serializeToString(c)},serializeXmlToString:function(a){var b=new XMLSerializer;return b.serializeToString(a)},parseXml:function(b){if("undefined"!=typeof a.DOMParser)return(new a.DOMParser).parseFromString(b,"text/xml");if("undefined"!=typeof a.ActiveXObject&&new a.ActiveXObject("Microsoft.XMLDOM")){var c=new a.ActiveXObject("Microsoft.XMLDOM");return c.async="false",c.loadXML(b),c}throw new Error("No XML parser found")},parseOwsExceptionReport:function(a){var b=L.XmlUtil.parseXml(a).documentElement;if(!b||"ows:ExceptionReport"!==b.tagName)return null;for(var c={exceptions:[],message:""},d=b.getElementsByTagNameNS(L.XmlUtil.namespaces.ows,"Exception"),e=0,f=d.length;e<f;e++){for(var g=d[e],h=g.getAttribute("exceptionCode"),i=g.getElementsByTagNameNS(L.XmlUtil.namespaces.ows,"ExceptionText"),j={code:h,text:""},k=0,l=i.length;k<l;k++){var m=i[k],n=m.innerHTML;j.text+=n,k<l-1&&(j.text+=". ")}c.message+=j.code+" - "+j.text,e<f-1&&(c.message+=" "),c.exceptions.push(j)}return c}},L.Util.request=function(b){b=L.extend({async:!0,method:"POST",data:"",params:{},headers:{},url:a.location.href,success:function(a){console.log(a)},error:function(a){console.log("Ajax request fail"),console.log(a)},complete:function(){}},b);var c=new XMLHttpRequest;c.onreadystatechange=function(){4===c.readyState&&(200===c.status?b.success(c.responseText):b.error(c.responseText),b.complete())};var d=b.url+L.Util.getParamString(b.params,b.url);c.open(b.method,d,b.async);for(var e in b.headers)c.setRequestHeader(e,b.headers[e]);c.send(b.data)},L.Filter=L.Class.extend({initialize:function(){this.filter=L.XmlUtil.createElementNS("ogc:Filter")},toGml:function(){return this.filter},append:function(){return this}}),L.Filter.GmlObjectID=L.Filter.extend({append:function(a){return this.filter.appendChild(L.XmlUtil.createElementNS("ogc:GmlObjectId",{"gml:id":a})),this}}),L.Filter.BBox=L.Filter.extend({append:function(a,b,c){var d=L.XmlUtil.createElementNS("ogc:BBOX");return d.appendChild(L.XmlUtil.createElementNS("ogc:PropertyName",{},{value:b})),d.appendChild(a.toGml(c)),this.filter.appendChild(d),this}}),L.Filter.Intersects=L.Filter.extend({append:function(a,b,c){var d=L.XmlUtil.createElementNS("ogc:Intersects");return d.appendChild(L.XmlUtil.createElementNS("ogc:PropertyName",{},{value:b})),d.appendChild(a.toGml(c)),this.filter.appendChild(d),this}}),L.Filter.EQ=L.Filter.extend({append:function(a,b){var c=L.XmlUtil.createElementNS("ogc:PropertyIsEqualTo"),d=L.XmlUtil.createElementNS("ogc:PropertyName",{},{value:a}),e=L.XmlUtil.createElementNS("ogc:Literal",{},{value:b});return c.appendChild(d),c.appendChild(e),this.filter.appendChild(c),this}}),L.Format={},L.Format.Scheme=L.Class.extend({options:{geometryField:"Shape"},initialize:function(a){L.setOptions(this,a)},parse:function(a){for(var c=new L.GML.FeatureType({geometryField:this.options.geometryField}),d=a.getElementsByTagNameNS(L.XmlUtil.namespaces.xsd,"complexType")[0],e=d.getElementsByTagNameNS(L.XmlUtil.namespaces.xsd,"sequence")[0],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];if(g.nodeType===b.ELEMENT_NODE){var h=g.attributes.name;if(h){var i=g.attributes.name.value;if(i!==this.options.geometryField){var j=g.attributes.type;if(!j){var k=g.getElementsByTagNameNS(L.XmlUtil.namespaces.xsd,"restriction");j=k.attributes.base}if(j){var l=j.value.split(":").pop();c.appendField(i,l)}}}}}return c}}),L.Format.Base=L.Class.extend({defaultOptions:{crs:L.CRS.EPSG3857,coordsToLatLng:function(a){return new L.LatLng(a[1],a[0],a[2])},latLngToCoords:function(a){var b=[a.lng,a.lat];return a.alt!==c&&b.push(a.alt),b},geometryField:"Shape"},initialize:function(a){if(L.setOptions(this,L.extend({},this.defaultOptions,a)),a.crs){var b=a.crs;this.options.coordsToLatLng=function(a){var c=L.point(a[0],a[1]),d=b.projection.unproject(c);return a[2]&&(d.alt=a[2]),d},this.options.latLngToCoords=function(a){var c=L.latLng(a);return b.projection.project(c)}}},setFeatureDescription:function(a){this.namespaceUri=a.attributes.targetNamespace.value;var b=new L.Format.Scheme({geometryField:this.options.geometryField});this.featureType=b.parse(a)}}),L.Format.GeoJSON=L.Format.Base.extend({initialize:function(a){L.Format.Base.prototype.initialize.call(this,a),this.outputFormat="application/json"},responseToLayers:function(a){for(var b=[],c=JSON.parse(a),d=0;d<c.features.length;d++)b.push(this.processFeature(c.features[d]));return b},processFeature:function(a){var b=this.generateLayer(a);return b.feature=a,b},generateLayer:function(a){return L.GeoJSON.geometryToLayer(a,this.options.pointToLayer||null,this.options.coordsToLatLng||null,null)}}),L.GML=L.GML||{},L.GML.ParserContainerMixin={parsers:{},initializeParserContainer:function(){this.parsers={}},appendParser:function(a){this.parsers[a.elementTag]=a},parseElement:function(a,b){var c=this.parsers[a.tagName];if(!c)throw"unknown child element "+a.tagName;return c.parse(a,b)}},L.GML.Element=L.Class.extend({elementTag:"",parse:function(){throw"not implemented parse function in parser for "+this.elementTag}}),L.GML.Geometry=L.GML.Element.extend({statics:{DIM:2},dimensions:function(a){return a.attributes.srsDimension?parseInt(a.attributes.srsDimension.value):L.GML.Geometry.DIM}}),L.GML.Coordinates=L.GML.Element.extend({defaultSeparator:{ds:".",cs:",",ts:" "},initialize:function(){this.elementTag="gml:coordinates"},parse:function(a){var b=this.defaultSeparator.ds;a.attributes.decimal&&(b=a.attributes.decimal.value);var c=this.defaultSeparator.cs;a.attributes.cs&&(c=a.attributes.cs.value);var d=this.defaultSeparator.ts;a.attributes.ts&&(d=a.attributes.ts.value);for(var e=[],f=a.textContent.split(d),g=function(a){return"."!==b&&(a=a.replace(b,".")),parseFloat(a)},h=0;h<f.length;h++)e.push(f[h].split(c).map(g));return 1===e.length?e[0]:e}}),L.GML.Pos=L.GML.Element.extend({initialize:function(){this.elementTag="gml:pos"},parse:function(a){return a.textContent.split(" ").map(function(a){return parseFloat(a)})}}),L.GML.PosList=L.GML.Element.extend({initialize:function(){this.elementTag="gml:posList"},parse:function(a,b){for(var c=[],d=b.dimensions,e=a.textContent.split(" "),f=0;f<e.length;f+=d){for(var g=[],h=f;h<f+d;h++)g.push(parseFloat(e[h]));c.push(g)}return c}}),L.GML.PointNode=L.GML.Geometry.extend({includes:L.GML.ParserContainerMixin,initialize:function(){this.elementTag="gml:Point",this.initializeParserContainer(),this.appendParser(new L.GML.Pos),this.appendParser(new L.GML.Coordinates)},parse:function(a){return this.parseElement(a.firstChild,{dimensions:this.dimensions(a)})}}),L.GML.PointSequence=L.GML.Geometry.extend({includes:L.GML.ParserContainerMixin,initialize:function(){this.initializeParserContainer(),this.appendParser(new L.GML.Pos),this.appendParser(new L.GML.PosList),this.appendParser(new L.GML.Coordinates),this.appendParser(new L.GML.PointNode)},parse:function(a){var b=a.firstChild,c=[],d=b.tagName;if("gml:pos"===d||"gml:Point"===d)for(var e=this.parsers[d],f=a.getElementsByTagNameNS(L.XmlUtil.namespaces.gml,d.split(":").pop()),g=0;g<f.length;g++)c.push(e.parse(f[g]));else c=this.parseElement(b,{dimensions:this.dimensions(a)});return c}}),L.GML.LinearRing=L.GML.PointSequence.extend({initialize:function(){L.GML.PointSequence.prototype.initialize.call(this),this.elementTag="gml:LinearRing"},parse:function(a){var b=L.GML.PointSequence.prototype.parse.call(this,a);return b.pop(),b}}),L.GML.LineStringNode=L.GML.PointSequence.extend({initialize:function(){this.elementTag="gml:LineString",L.GML.PointSequence.prototype.initialize.call(this)},parse:function(a){return L.GML.PointSequence.prototype.parse.call(this,a)}}),L.GML.PolygonNode=L.GML.Geometry.extend({initialize:function(){this.elementTag="gml:Polygon",this.linearRingParser=new L.GML.LinearRing},parse:function(a){for(var c=[],d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];e.nodeType===b.ELEMENT_NODE&&c.push(this.linearRingParser.parse(e.firstChild))}return c}}),L.GML.CoordsToLatLngMixin={transform:function(a,b){if(Array.isArray(a[0])){for(var c=[],d=0;d<a.length;d++)c.push(this.transform(a[d],b));return c}return b.coordsToLatLng(a)}},L.GML.Point=L.GML.PointNode.extend({includes:L.GML.CoordsToLatLngMixin,parse:function(a,b){var c=L.GML.PointNode.prototype.parse.call(this,a),d=new L.Marker;return d.setLatLng(this.transform(c,b)),d}}),L.GML.LineString=L.GML.LineStringNode.extend({includes:L.GML.CoordsToLatLngMixin,parse:function(a,b){var c=new L.Polyline([]),d=L.GML.LineStringNode.prototype.parse.call(this,a);return c.setLatLngs(this.transform(d,b)),c}}),L.GML.Polygon=L.GML.PolygonNode.extend({includes:L.GML.CoordsToLatLngMixin,parse:function(a,b){var c=new L.Polygon([]),d=L.GML.PolygonNode.prototype.parse.call(this,a);return c.setLatLngs(this.transform(d,b)),c}}),L.GML.MultiGeometry=L.GML.Geometry.extend({includes:[L.GML.ParserContainerMixin,L.GML.CoordsToLatLngMixin],initialize:function(){this.initializeParserContainer()},parse:function(a,c){for(var d=[],e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType===b.ELEMENT_NODE)for(var g=0;g<f.childNodes.length;g++){var h=f.childNodes[g];h.nodeType===b.ELEMENT_NODE&&d.push(this.parseElement(h,c))}}return this.transform(d,c)}}),L.GML.AbstractMultiPolyline=L.GML.MultiGeometry.extend({initialize:function(){L.GML.MultiGeometry.prototype.initialize.call(this),this.appendParser(new L.GML.LineStringNode)},parse:function(a,b){var c=L.GML.MultiGeometry.prototype.parse.call(this,a,b),d=new L.Polyline([]);return d.setLatLngs(c),d}}),L.GML.AbstractMultiPolygon=L.GML.MultiGeometry.extend({initialize:function(){L.GML.MultiGeometry.prototype.initialize.call(this),this.appendParser(new L.GML.PolygonNode)},parse:function(a,b){var c=L.GML.MultiGeometry.prototype.parse.call(this,a,b),d=new L.Polygon([]);return d.setLatLngs(c),d}}),L.GML.MultiLineString=L.GML.AbstractMultiPolyline.extend({initialize:function(){L.GML.AbstractMultiPolyline.prototype.initialize.call(this),this.elementTag="gml:MultiLineString"}}),L.GML.MultiCurve=L.GML.AbstractMultiPolyline.extend({initialize:function(){L.GML.AbstractMultiPolyline.prototype.initialize.call(this),this.elementTag="gml:MultiCurve"}}),L.GML.MultiPolygon=L.GML.AbstractMultiPolygon.extend({initialize:function(){L.GML.AbstractMultiPolygon.prototype.initialize.call(this),this.elementTag="gml:MultiPolygon"}}),L.GML.MultiSurface=L.GML.AbstractMultiPolygon.extend({initialize:function(){L.GML.AbstractMultiPolygon.prototype.initialize.call(this),this.elementTag="gml:MultiSurface"}}),L.GML.MultiPoint=L.GML.MultiGeometry.extend({initialize:function(){L.GML.MultiGeometry.prototype.initialize.call(this),this.elementTag="gml:MultiPoint",this.appendParser(new L.GML.PointNode)},parse:function(a,b){for(var c=L.GML.MultiGeometry.prototype.parse.call(this,a,b),d=new L.FeatureGroup,e=0;e<c.length;e++){var f=new L.Marker;f.setLatLng(c[e]),d.addLayer(f)}return d}}),L.GML.FeatureType=L.Class.extend({options:{geometryField:"Shape"},primitives:[{types:["byte","decimal","int","integer","long","short"],parse:function(a){return Number(a)}},{types:["string"],parse:function(a){return a}},{types:["boolean"],parse:function(a){return"false"!==a}},{types:["date","time","datetime"],parse:function(a){return new Date(a)}}],initialize:function(a){L.setOptions(this,a),this.fields={}},appendField:function(a,b){var c=this;this.primitives.forEach(function(d){d.types.indexOf(b)!==-1&&(c.fields[a]=d.parse)})},parse:function(a){for(var c={},d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType===b.ELEMENT_NODE){var f=e.tagName.split(":").pop();if(f!==this.options.geometryField){var g=this.fields[f];g||(this.appendField(f,"string"),g=this.fields[f]),c[f]=g(e.textContent)}}}return{type:"Feature",properties:c,id:a.attributes["gml:id"].value}}}),L.Format.GML=L.Format.Base.extend({includes:L.GML.ParserContainerMixin,initialize:function(a){L.Format.Base.prototype.initialize.call(this,a),this.outputFormat="text/xml; subtype=gml/3.1.1",this.initializeParserContainer(),this.appendParser(new L.GML.Point),this.appendParser(new L.GML.LineString),this.appendParser(new L.GML.Polygon),this.appendParser(new L.GML.MultiLineString),this.appendParser(new L.GML.MultiPolygon),this.appendParser(new L.GML.MultiCurve),this.appendParser(new L.GML.MultiSurface),this.appendParser(new L.GML.MultiPoint)},responseToLayers:function(a){for(var c=[],d=L.XmlUtil.parseXml(a),e=d.documentElement,f=e.getElementsByTagNameNS(L.XmlUtil.namespaces.gml,"featureMember"),g=0;g<f.length;g++){var h=f[g].firstChild;c.push(this.processFeature(h))}var i=e.getElementsByTagNameNS(L.XmlUtil.namespaces.gml,"featureMembers");if(i.length>0)for(var j=i[0].childNodes,k=0;k<j.length;k++){var l=j[k];l.nodeType===b.ELEMENT_NODE&&c.push(this.processFeature(l))}return c},processFeature:function(a){var b=this.generateLayer(a);return b.feature=this.featureType.parse(a),b},generateLayer:function(a){var b=a.getElementsByTagNameNS(this.namespaceUri,this.options.geometryField)[0];if(!b)throw new Error("Geometry field '"+this.options.geometryField+"' doesn' exist inside received feature: '"+a.innerHTML+"'");return this.parseElement(b.firstChild,this.options)}}),L.Util.project=function(a,b){if(L.Util.isArray(b)){var c=[];return b.forEach(function(b){c.push(L.Util.project(a,b))}),c}return a.projection.project(b)},L.GMLUtil={posNode:function(a){return L.XmlUtil.createElementNS("gml:pos",{srsDimension:2},{value:a.x+" "+a.y})},posListNode:function(a,b){var c=[];if(a.forEach(function(a){c.push(a.x+" "+a.y)}),b&&a.length>0){var d=a[0];c.push(d.x+" "+d.y)}var e=c.join(" ");return L.XmlUtil.createElementNS("gml:posList",{},{value:e})}},L.LatLngBounds.prototype.toGml=function(a){var b=a.project(this.getSouthWest()),c=a.project(this.getNorthEast()),d=L.XmlUtil.createElementNS("gml:Envelope",{srsName:a.code});return d.appendChild(L.XmlUtil.createElementNS("gml:lowerCorner",{},{value:b.x+" "+b.y})),d.appendChild(L.XmlUtil.createElementNS("gml:upperCorner",{},{value:c.x+" "+c.y})),d},L.Marker.include({toGml:function(a){var b=L.XmlUtil.createElementNS("gml:Point",{srsName:a.code});return b.appendChild(L.GMLUtil.posNode(L.Util.project(a,this.getLatLng()))),b}}),L.Polygon.include({toGml:function(a){for(var b=this.getLatLngs(),c=[],d=0;d<b.length;d++){var e=b[d],f=L.Polyline._flat(e),g=L.XmlUtil.createElementNS("gml:Polygon",{srsName:a.code,srsDimension:2});if(g.appendChild(L.XmlUtil.createElementNS("gml:exterior")).appendChild(L.XmlUtil.createElementNS("gml:LinearRing",{srsDimension:2})).appendChild(L.GMLUtil.posListNode(L.Util.project(a,f?e:e[0]),!0)),!f)for(var h=1;h<e.length;h++)g.appendChild(L.XmlUtil.createElementNS("gml:interior")).appendChild(L.XmlUtil.createElementNS("gml:LinearRing",{srsDimension:2})).appendChild(L.GMLUtil.posListNode(L.Util.project(a,e[h]),!0));c.push(g)}if(1===c.length)return c[0];for(var i=L.XmlUtil.createElementNS("gml:MultiPolygon",{srsName:a.code,srsDimension:2}),j=i.appendChild(L.XmlUtil.createElementNS("gml:polygonMembers")),k=0;k<c.length;k++)j.appendChild(c[k]);return i}}),L.Polyline.include({_lineStringNode:function(a,b){var c=L.XmlUtil.createElementNS("gml:LineString",{srsName:a.code,srsDimension:2});return c.appendChild(L.GMLUtil.posListNode(L.Util.project(a,b),!1)),c},toGml:function(a){var b=this.getLatLngs();if(L.Polyline._flat(b))return this._lineStringNode(a,b);for(var c=L.XmlUtil.createElementNS("gml:MultiLineString",{srsName:a.code,srsDimension:2}),d=c.appendChild(L.XmlUtil.createElementNS("gml:lineStringMembers")),e=0;e<b.length;e++)d.appendChild(this._lineStringNode(a,b[e]));return c}});var d={setProperties:function(a){for(var b in a)a.hasOwnProperty(b)&&(this.feature.properties[b]=a[b])},getProperty:function(a){return this.feature.properties[a]},deleteProperties:function(a){for(var b=0;b<a.length;b++)this.feature.properties.hasOwnProperty(a[b])&&delete this.feature.properties[a[b]]}};L.Marker.include(d),L.Path.include(d),L.WFS=L.FeatureGroup.extend({options:{crs:L.CRS.EPSG3857,showExisting:!0,geometryField:"Shape",url:"",version:"1.1.0",typeNS:"",typeName:"",typeNSName:"",maxFeatures:null,filter:null,style:{color:"black",weight:1},namespaceUri:""},state:{},initialize:function(a,b){L.setOptions(this,a),this.state={exist:"exist"},this._layers={},this.readFormat=b||new L.Format.GML({crs:this.options.crs,geometryField:this.options.geometryField}),this.options.typeNSName=this.namespaceName(this.options.typeName),this.options.srsName=this.options.crs.code;var c=this;this.describeFeatureType(function(){c.options.showExisting&&c.loadFeatures(c.options.filter)},function(a){c.fire("error",{error:new Error(a)})})},namespaceName:function(a){return this.options.typeNS+":"+a},describeFeatureType:function(a,b){var c=L.XmlUtil.createElementNS("wfs:DescribeFeatureType",{service:"WFS",version:this.options.version});c.appendChild(L.XmlUtil.createElementNS("TypeName",{},{value:this.options.typeNSName}));var d=this;L.Util.request({url:this.options.url,data:L.XmlUtil.serializeXmlDocumentString(c),success:function(c){var e=L.XmlUtil.parseOwsExceptionReport(c);if(e)return void("function"==typeof b&&b(e.message));var f=L.XmlUtil.parseXml(c),g=f.documentElement;d.readFormat.setFeatureDescription(g),d.options.namespaceUri=g.attributes.targetNamespace.value,"function"==typeof a&&a()},error:function(a){"function"==typeof b&&b(a)}})},getFeature:function(a){var b=L.XmlUtil.createElementNS("wfs:GetFeature",{service:"WFS",version:this.options.version,maxFeatures:this.options.maxFeatures,outputFormat:this.readFormat.outputFormat}),c=b.appendChild(L.XmlUtil.createElementNS("wfs:Query",{typeName:this.options.typeNSName,srsName:this.options.srsName}));return a&&a.toGml&&c.appendChild(a.toGml()),b},loadFeatures:function(a){var b=this;L.Util.request({url:this.options.url,data:L.XmlUtil.serializeXmlDocumentString(b.getFeature(a)),success:function(a){var c=L.XmlUtil.parseOwsExceptionReport(a);if(c)return b.fire("error",{error:new Error(c.message)}),b;var d=b.readFormat.responseToLayers(a,{coordsToLatLng:b.options.coordsToLatLng,pointToLayer:b.options.pointToLayer});return d.forEach(function(a){a.state=b.state.exist,b.addLayer(a)}),b.setStyle(b.options.style),b.fire("load",{responseText:a}),b},error:function(a){return b.fire("error",{error:new Error(a)}),b}})}}),L.wfs=function(a,b){return new L.WFS(a,b)},L.WFST=L.WFS.extend({initialize:function(a,b){L.WFS.prototype.initialize.call(this,a,b),this.state=L.extend(this.state,{insert:"insert",update:"update",remove:"remove"}),this.changes={}},addLayer:function(a){if(L.FeatureGroup.prototype.addLayer.call(this,a),a.feature||(a.feature={properties:{}}),!a.state){a.state=this.state.insert;var b=this.getLayerId(a);this.changes[b]=a}return this},removeLayer:function(a){L.FeatureGroup.prototype.removeLayer.call(this,a);var b=this.getLayerId(a);if(b in this.changes){var c=this.changes[b];c.state===this.state.insert?delete this.changes[b]:c.state=this.state.remove}else a.state=this.state.remove,this.changes[b]=a},editLayer:function(a){a.state!==this.state.insert&&(a.state=this.state.update);var b=this.getLayerId(a);return this.changes[b]=a,this},save:function(){var a=L.XmlUtil.createElementNS("wfs:Transaction",{service:"WFS",version:this.options.version}),b=[];for(var c in this.changes){var d=this.changes[c],e=this[d.state](d);a.appendChild(e),d.state===this.state.insert&&b.push(d)}var f=this;return L.Util.request({url:this.options.url,data:L.XmlUtil.serializeXmlDocumentString(a),success:function(a){for(var c=L.XmlUtil.evaluate("//wfs:InsertResults/wfs:Feature/ogc:FeatureId/@fid",a),d=new L.Filter.GmlObjectID,e=c.iterateNext();e;)d.append(e.value),e=c.iterateNext();b.forEach(function(a){L.FeatureGroup.prototype.removeLayer.call(f,a)}),f.once("load",function(){f.fire("save:success"),f.changes={}}),f.loadFeatures(d)}}),this}}),L.wfst=function(a,b){return new L.WFST(a,b)},L.WFST.include({gmlFeature:function(a){var b=L.XmlUtil.createElementNS(this.options.typeNSName,{},{uri:this.options.namespaceUri}),c=a.feature;for(var d in c.properties)b.appendChild(this.gmlProperty(d,c.properties[d]));return b.appendChild(this.gmlProperty(this.options.geometryField,a.toGml(this.options.crs))),b},gmlProperty:function(a,b){var c=L.XmlUtil.createElementNS(this.namespaceName(a));return b instanceof Element?c.appendChild(b):c.appendChild(L.XmlUtil.createTextNode(b||"")),c},wfsProperty:function(a,b){var c=L.XmlUtil.createElementNS("wfs:Property");c.appendChild(L.XmlUtil.createElementNS("wfs:Name",{},{value:a}));var d=L.XmlUtil.createElementNS("wfs:Value");return b instanceof Element?d.appendChild(b):d.appendChild(L.XmlUtil.createTextNode(b||"")),c.appendChild(d),c}}),L.WFST.include({insert:function(a){var b=L.XmlUtil.createElementNS("wfs:Insert");return b.appendChild(this.gmlFeature(a)),b},update:function(a){var b=L.XmlUtil.createElementNS("wfs:Update",{typeName:this.options.typeNSName}),c=a.feature;for(var d in c.properties)b.appendChild(this.wfsProperty(d,c.properties[d]));b.appendChild(this.wfsProperty(this.namespaceName(this.options.geometryField),a.toGml(this.options.crs)));var e=(new L.Filter.GmlObjectID).append(a.feature.id);return b.appendChild(e.toGml()),b},remove:function(a){var b=L.XmlUtil.createElementNS("wfs:Delete",{typeName:this.options.typeNSName}),c=(new L.Filter.GmlObjectID).append(a.feature.id);return b.appendChild(c.toGml()),b}})}(window,document);