>/= `;function A(){for(var f=i;N.indexOf(e[i])===-1;)i++;return e.slice(f,i)}var M=[];function w(){var f={};i++,f.tagName=A();for(var v=!1;e.charCodeAt(i)!==n;){var d=e.charCodeAt(i);if(d>64&&d<91||d>96&&d<123){for(var F=A(),m=e.charCodeAt(i);m!==P&&m!==C&&!(m>64&&m<91||m>96&&m<123)&&m!==n;)i++,m=e.charCodeAt(i);if(v||(f.attributes={},v=!0),m===P||m===C)var L=I();else L=null,i--;f.attributes[F]=L}i++}if(e.charCodeAt(i-1)!==g)if(f.tagName=="script"){var _=i+1;i=e.indexOf("<\/script>",i),f.children=[e.slice(_,i-1)],i+=8}else if(f.tagName=="style"){var _=i+1;i=e.indexOf("</style>",i),f.children=[e.slice(_,i-1)],i+=7}else M.indexOf(f.tagName)==-1&&(i++,f.children=b(F));return f}function I(){var f=e[i],v=++i;return i=e.indexOf(f,v),e.slice(v,i)}function B(){return new RegExp(`s*ids*=s*['"]`+a.searchId+`['"]`).exec(e).index}var c=null;if(a.searchId){var i=B();return i!==-1&&(i=e.lastIndexOf("<",i),i!==-1&&(c=w())),i}else{var i=0;c=b()}return a.filter&&(c=p.filter(c,a.filter)),a.simplify&&(c=p.simplify(c)),c}p.simplify=function(a){var t={};if(a==null)return t;if(a.length===1&&typeof a[0]=="string")return{value:a[0]};a.forEach(function(s){if(t[s.tagName]||(t[s.tagName]=[]),typeof s=="object"){var n=p.simplify(s.children);t[s.tagName].push(n),s.attributes&&(n._attributes=s.attributes)}else t[s.tagName].push(s)});for(var r in t)t[r].length==1&&(t[r]=t[r][0]);return t};p.filter=function(e,a){var t=[];return e.forEach(function(r){if(typeof r=="object"&&a(r)&&t.push(r),r.children){var s=p.filter(r.children,a);t=t.concat(s)}}),t};var E=p;function x(e,a,t,r,s,n){this._extractAttributes=e,this._featureName=s||"featureMember",this._xy=a,this._gmlns=t||"http://www.opengis.net/gml",this._wfs=r||"http://www.opengis.net/wfs",this._geometryAttribute=n,this._regExes={trimSpace:/^\s*|\s*$/g,removeSpace:/\s*/g,splitSpace:/\s+/,trimComma:/\s*,\s*/g}}Object.defineProperties(x.prototype,{extractAttributes:{get:function(){return this._extractAttributes},set:function(e){this._extractAttributes=e}},xy:{get:function(){return this._xy}}});x.prototype.read=function(e){this._wfsPrefix==null&&this.detectPrefixes();var a=e["?xml"];if(a==null?a=e[this._wfsPrefix+"FeatureCollection"]:a=e["?xml"][this._wfsPrefix+"FeatureCollection"],a==null)throw"Invalid GML format. Could not find root element";var t=a[this._gmlPrefix+this._featureName]||[],r=[],s=this._featureName;if(t.length==null){var n=Object.keys(t).map(function(u){return{objName:t[u]}});t=n}for(var o=0;o<t.length;o++){var l=t[o],h=Object.getOwnPropertyNames(l)[0],g=this.parseFeature(l[h]);g&&r.push(g)}return r};x.prototype.detectPrefixes=function(e){this._wfsPrefix="wfs:",this._gmlPrefix="gml:"};x.prototype.detectGeometryAttribute=function(e){this._geometryAttribute="Geom"};function j(e,a){var t=e.indexOf(":"+a);return t>0&&t==e.length-a.length-1}x.prototype.parseFeature=function(e){var a=["MultiPolygon","Polygon","MultiLineString","LineString","MultiPoint","Point"];this._geometryAttribute==null&&this.detectGeometryAttribute(e);var t,r,s,n={},o="";for(var l in e)if(o==""&&(o=l),l==this._geometryAttribute||j(l,this._geometryAttribute)){var h=Object.getOwnPropertyNames(e[l])[0];r=h.replace(this._gmlPrefix,""),s=this.parseGeometry[r.toLowerCase()],s?t=s.apply(this,[e[l][h]]):console.log("unsupportedGeometryType:"+r)}else l!="_attributes"&&(n[l]=e[l].value);var g;this.extractAttributes==!1&&(n=void 0);var u={geometryType:r.toLowerCase(),positions:t,attributes:n};return u.bounds=g,e._attributes!=null?u.fid=e._attributes.fid||e._attributes.id:u.fid=e[o].value,u};x.prototype.parseGeometry={point:function(e){var a,t,r=[];if(e[this._gmlPrefix+"pos"])t=e[this._gmlPrefix+"pos"].value,t=t.replace(this._regExes.trimSpace,""),r=t.split(this._regExes.splitSpace);else if(e[this._gmlPrefix+"coordinates"])t=e[this._gmlPrefix+"coordinates"].value,t=t.replace(this._regExes.removeSpace,""),r=t.split(",");else if(e[this._gmlPrefix+"coord"]){var s=e[this._gmlPrefix+"coord"][this._gmlPrefix+"X"].value,n=e[this._gmlPrefix+"coord"][this._gmlPrefix+"Y"].value;s!=null&&n!=null&&(r=[s,n])}return r.length==2&&(r[2]=null),this.xy?[parseFloat(r[0]),parseFloat(r[1]),parseFloat(r[2])]:[parseFloat(r[1]),parseFloat(r[0]),parseFloat(r[2])]},multipoint:function(e){var a=e[this._gmlPrefix+"pointMember"],t=[];if(a.length==null&&(a=[a]),a.length>0)for(var r,s=0;s<a.length;++s)r=this.parseGeometry.point.apply(this,[a[s][this._gmlPrefix+"Point"]]),r&&t.push(r);return t},linestring:function(e){var a,t,r=[],s=[];if(e[this._gmlPrefix+"posList"]){t=e[this._gmlPrefix+"posList"].value,t=t.replace(this._regExes.trimSpace,""),r=t.split(this._regExes.splitSpace);for(var n=e[this._gmlPrefix+"posList"]._attributes.dimension,o,l,h,g,u=0;u<r.length/n;++u)o=u*n,l=parseFloat(r[o]),h=parseFloat(r[o+1]),g=n==2?null:parseFloat(r[o+2]),this.xy?s.push(l,h,g):s.push(h,l,g)}else if(e[this._gmlPrefix+"coordinates"]){t=e[this._gmlPrefix+"coordinates"].value,t=t.replace(this._regExes.trimSpace,""),t=t.replace(this._regExes.trimComma,",");for(var y=t.split(this._regExes.splitSpace),u=0;u<y.length;++u)r=y[u].split(","),r.length==2&&(r[2]=null),this.xy?s.push(parseFloat(r[0]),parseFloat(r[1]),parseFloat(r[2])):s.push(parseFloat(r[1]),parseFloat(r[0]),parseFloat(r[2]))}return s},multilinestring:function(e){var a=e[this._gmlPrefix+"lineStringMember"],t=[];if(a.length==null&&(a=[a]),a.length>0)for(var r,s=0;s<a.length;++s)r=this.parseGeometry.linestring.apply(this,[a[s][this._gmlPrefix+"LineString"]]),r&&t.push(r);return t},polygon:function(e){var a=[e[this._gmlPrefix+"outerBoundaryIs"][this._gmlPrefix+"LinearRing"]];if(e[this._gmlPrefix+"innerBoundaryIs"])for(var t=0;t<e[this._gmlPrefix+"innerBoundaryIs"].length;t++)a.push(e[this._gmlPrefix+"innerBoundaryIs"][t][this._gmlPrefix+"LinearRing"]);var r=[];if(a.length>0)for(var s,t=0;t<a.length;++t)s=this.parseGeometry.linestring.apply(this,[a[t]]),s&&r.push(s);return r},multipolygon:function(e){var a=e[this._gmlPrefix+"polygonMember"],t=[];if(a.length==null&&(a=[a]),a.length>0)for(var r,s=0;s<a.length;++s)r=this.parseGeometry.polygon.apply(this,[a[s][this._gmlPrefix+"Polygon"]]),r&&t.push(r);return t}};var O=x;self.addEventListener("message",function(e){var a=new O(!0,!0,void 0,void 0,void 0,e.data.geometryFieldName),t=e.data,r,s;t.format==="JSON"?(r=JSON.parse(t.text),s=r.features,s.forEach(n=>{n.positions=[],n.geometry.coordinates.forEach(o=>{if(Array.isArray(o)){let l=[];o.forEach(h=>{if(Array.isArray(h[0])){let g=[];h.forEach(u=>{g.push(u[0],u[1],u[2])}),l.push(g)}else l.push(h[0],h[1],h[2])}),n.positions.push(l)}else n.positions.push(o)}),n.attributes=n.properties,n.fid=n.id,n.geometryType=n.geometry.type.toLocaleLowerCase(),n.bounds=void 0,delete n.geometry,delete n.id,delete n.properties,delete n.geometry_name,delete n.type})):(r=E(t.text,{simplify:!0}),s=a.read(r)),delete t.text,t.features=s,postMessage(t)});})();
|