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EyB,IAA1B,KAAK,QAAQ,WAAuD,IAA3B,KAAK,QAAQ,WACjE,KAAK,YAEE,KAAK,QAAQ,OAChB,EAAI,GAAG,UAAW,KAAK,UAAW,MAClC,EAAI,GAAG,UAAW,KAAK,UAAW,MAClC,EAAI,GAAG,UAAW,KAAK,UAAW,MAE9B,KAAK,QAAQ,SAAW,IAC1B,KAAK,WAAa,OAAO,YAAY,KAAK,UAAU,KAAK,MAAO,KAAK,QAAQ,aAK/E,KAAK,QAAQ,OACf,QAAQ,MAAM,YAElB,EAEA,SAAU,SAAU,GAUlB,IATI,KAAK,QAAQ,OACf,QAAQ,MAAM,gBAEhB,EAAE,WAAW,UAAU,SAAS,KAAK,KAAM,IAEtC,KAAK,QAAQ,MAAQ,KAAK,QAAQ,SAAW,GAChD,OAAO,cAAc,KAAK,YAGtB,KAAK,UAAU,OAAS,GAC5B,KAAK,UAAU,QAAQ,QAGrB,KAAK,QAAQ,OACf,EAAI,IAAI,CACN,QAAW,KAAK,WACf,MACH,EAAI,IAAI,CACN,QAAW,KAAK,WACf,MACD,EAAI,IAAI,CACR,QAAW,KAAK,WACf,OAGL,KAAK,KAAO,IACd,EAEA,cAAA,GACE,KAAK,QAAQ,UAAY,KAAK,QAAQ,QACxC,IAGF,EAAE,cAAgB,SAAU,EAAU,GACpC,OAAO,IAAI,EAAE,cAAc,EAAU,EACvC","file":"/npm/leaflet-ugeojson@2.1.0/src/leaflet.uGeoJSON.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/leaflet-ugeojson@2.1.0/src/leaflet.uGeoJSON.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","L.UGeoJSONLayer = L.GeoJSON.extend({\n  options: {\n    debug: false,\n    light: true,\n    usebbox: false,\n    endpoint: -1,\n    parameters: {},\n    headers: {},\n    maxRequests: 5,\n    pollTime:0,\n    once: false,\n    minzoom: 0,\n    enctype: 'form-data', //urlencoded || form-data || json\n    transformData: function (data) { return data; },\n    afterFetch: function () {},\n    after: function (data) {},\n    disabled: false,\n  },\n  callback: function (data) {\n    if(this.options.light) {\n      this.clearLayers();//if needed, we clean the layers\n    }\n\n    //Then we add the new data\n    this.addData(data);\n    this.options.after(data);\n  },\n  initialize: function (uOptions, options) {\n    L.GeoJSON.prototype.initialize.call(this, undefined, options);\n    L.Util.setOptions(this, uOptions);\n\n    this._layersOld = [];\n    this._requests = [];\n  },\n  onMoveEnd: function () {\n    if (this.options.disabled) {\n      return;\n    }\n    if (this.options.debug) {\n      console.debug('load Data');\n    }\n\n    while(this._requests.length > this.options.maxRequests) { //This allows to stop the oldest requests\n      this._requests.shift().abort();\n    }\n\t  \n    var postData = {};\n\n    if (typeof this.options.parameters === 'function') {\n      postData = this.options.parameters();\n    } else {\n      for (var k in this.options.parameters) {\n        if (typeof this.options.parameters[k].scope !== 'undefined') {\n\t        postData[k]=this.options.parameters[k].scope[k];\n        } else {\n\t        postData[k]=this.options.parameters[k];\n        }\n      }\n    }\n\n    postData.zoom = this._map.getZoom();\n    \n    if (postData.zoom < this.options.minzoom) {\n      if (this.options.debug) {\n        console.debug('ignoring zoomlevel '+postData.zoom+' (< '+this.options.minzoom+')');\n      }\n      this.clearLayers();\n      return;\n    }\n\n    var bounds = this._map.getBounds();\n    if (this.options.usebbox) {\n      postData.bbox = bounds.toBBoxString();\n    } else {\n      postData.south = bounds.getSouth();\n      postData.north = bounds.getNorth();\n      postData.east = bounds.getEast();\n      postData.west = bounds.getWest();\n    }\n\n    var self = this;\n    var request = new XMLHttpRequest();\n    request.open('POST', this.options.endpoint, true);\n    for(var l in this.options.headers) {\n      if (typeof this.options.headers[l].scope !== 'undefined') {\n        request.setRequestHeader(l, this.options.headers[l].scope[l]);\n      } else {\n        request.setRequestHeader(l, this.options.headers[l]);\n      }\n    }\n\n    request.onload = function() {\n      for(var i in self._requests) {\n        if(self._requests[i] === request) {\n          self._requests.splice(i,1); //We remove the request from the list of currently running requests.\n          break;\n        }\n      }\n\n      if (this.status >= 200 && this.status < 400) {\n        var data = JSON.parse(this.responseText);\n\n        if (self.options.transformData) {\n          data = self.options.transformData(data);\n        }\n\n        self.options.afterFetch();\n        self.callback(data);\n      }\n    };\n\n    this._requests.push(request);\n\n    if (this.options.enctype=='urlencoded' || this.options.enctype=='json') {\n      if (this.options.enctype=='urlencoded') {\n        // urlencoded request\n        var urlencoded = '';\n        for (var p in postData) {\n          if (postData.hasOwnProperty(p)) {\n            if (urlencoded.length > 0) {\n              urlencoded += '&';\n            }\n            urlencoded += encodeURIComponent(p) + '=' + encodeURIComponent(postData[p]);\n          }\n        }\n        request.send(urlencoded);\n      } else {\n        // json request\n        request.send(JSON.stringify(postData));\n      }\n    } else {\n      var postFormData = new FormData();\n      for (var q in postData) {\n        if (postData.hasOwnProperty(q)) {\n          postFormData.append(q, postData[q]);\n        }\n      }\n      request.send(postFormData);\n    }\n  },\n  onAdd: function (map) {\n    this._map = map;\n\n    if (typeof this.options.endpoint !== 'undefined' && this.options.endpoint !== -1) {\n\t\t  this.onMoveEnd();\n\n      if (!this.options.once) {\n        map.on('dragend', this.onMoveEnd, this);\n        map.on('zoomend', this.onMoveEnd, this);\n        map.on('refresh', this.onMoveEnd, this);\n\n        if (this.options.pollTime > 0) {\n          this.intervalID = window.setInterval(this.onMoveEnd.bind(this), this.options.pollTime);\n        }\n      }\n    }\n\n    if (this.options.debug) {\n      console.debug('add layer');\n    }\n  },\n\n  onRemove: function (map) {\n    if (this.options.debug) {\n      console.debug('remove layer');\n    }\n    L.LayerGroup.prototype.onRemove.call(this, map);\n\n    if (!this.options.once && this.options.pollTime > 0) {\n      window.clearInterval(this.intervalID);\n    }\n\n    while(this._requests.length > 0) {\n      this._requests.shift().abort();\n    }\n\n    if(!this.options.once) {\n      map.off({\n        'dragend': this.onMoveEnd\n      }, this);\n      map.off({\n        'zoomend': this.onMoveEnd\n      }, this);\n        map.off({\n        'refresh': this.onMoveEnd\n      }, this);\n    }\n\n    this._map = null;\n  },\n\n  toggleDisabled() {\n    this.options.disabled = !this.options.disabled;\n  }\n});\n\nL.uGeoJSONLayer = function (uOptions, options) {\n  return new L.UGeoJSONLayer(uOptions, options);\n};\n"]}