@nextgis/ngw-leaflet 3.0.0-alpha.3 → 3.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-leaflet; version: 3.0.0-alpha.3; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-leaflet; version: 3.0.0-alpha.5; author: NextGIS */
2
2
  function styleInject(css, ref) {
3
3
  if ( ref === void 0 ) ref = {};
4
4
  var insertAt = ref.insertAt;
@@ -62,7 +62,7 @@ EventEmitter.init = function() {
62
62
  this.domain = null;
63
63
  if (EventEmitter.usingDomains) {
64
64
  // if there is an active domain, then attach to it.
65
- if (domain.active ) ;
65
+ if (domain.active) ;
66
66
  }
67
67
 
68
68
  if (!this._events || this._events === Object.getPrototypeOf(this)._events) {
@@ -14944,6 +14944,20 @@ function isArray(val) {
14944
14944
  function fixUrlStr(url) {
14945
14945
  return url.replace(/([^:]\/)\/+/g, "$1");
14946
14946
  }
14947
+ function updateUrlParams(urlStr, params) {
14948
+ const url = new URL(urlStr);
14949
+ const searchParams = new URLSearchParams(url.search);
14950
+ Object.entries(params).forEach(([key, value]) => {
14951
+ if (value === void 0) {
14952
+ searchParams.delete(key);
14953
+ } else {
14954
+ searchParams.set(key, value);
14955
+ }
14956
+ });
14957
+ searchParams.set("timestamp", String((/* @__PURE__ */ new Date()).getTime()));
14958
+ const newSearch = [...searchParams.entries()].map(([key, value]) => `${key}=${value}`).join("&");
14959
+ return `${url.origin}${url.pathname}?${newSearch}`;
14960
+ }
14947
14961
 
14948
14962
  function boundsToArray(bounds) {
14949
14963
  const ne = bounds.getNorthEast();
@@ -15048,15 +15062,15 @@ function createFeaturePositionOptions(features) {
15048
15062
  };
15049
15063
  }
15050
15064
 
15051
- var __defProp$Y = Object.defineProperty;
15052
- var __defNormalProp$Y = (obj, key, value) => key in obj ? __defProp$Y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15053
- var __publicField$E = (obj, key, value) => __defNormalProp$Y(obj, typeof key !== "symbol" ? key + "" : key, value);
15065
+ var __defProp$11 = Object.defineProperty;
15066
+ var __defNormalProp$11 = (obj, key, value) => key in obj ? __defProp$11(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15067
+ var __publicField$H = (obj, key, value) => __defNormalProp$11(obj, typeof key !== "symbol" ? key + "" : key, value);
15054
15068
  class BaseAdapter {
15055
15069
  constructor(map, options) {
15056
15070
  this.map = map;
15057
15071
  this.options = options;
15058
- __publicField$E(this, "layer");
15059
- __publicField$E(this, "pane", "order-0");
15072
+ __publicField$H(this, "layer");
15073
+ __publicField$H(this, "pane", "order-0");
15060
15074
  if (options.order !== void 0) {
15061
15075
  const pane = "order-" + options.order;
15062
15076
  let exist = map.getPane(pane);
@@ -15085,19 +15099,19 @@ function convertMapClickEvent(evt) {
15085
15099
  };
15086
15100
  }
15087
15101
 
15088
- var __defProp$X = Object.defineProperty;
15089
- var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
15090
- var __hasOwnProp$G = Object.prototype.hasOwnProperty;
15091
- var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
15092
- var __defNormalProp$X = (obj, key, value) => key in obj ? __defProp$X(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15093
- var __spreadValues$F = (a, b) => {
15102
+ var __defProp$10 = Object.defineProperty;
15103
+ var __getOwnPropSymbols$I = Object.getOwnPropertySymbols;
15104
+ var __hasOwnProp$I = Object.prototype.hasOwnProperty;
15105
+ var __propIsEnum$I = Object.prototype.propertyIsEnumerable;
15106
+ var __defNormalProp$10 = (obj, key, value) => key in obj ? __defProp$10(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15107
+ var __spreadValues$H = (a, b) => {
15094
15108
  for (var prop in b || (b = {}))
15095
- if (__hasOwnProp$G.call(b, prop))
15096
- __defNormalProp$X(a, prop, b[prop]);
15097
- if (__getOwnPropSymbols$G)
15098
- for (var prop of __getOwnPropSymbols$G(b)) {
15099
- if (__propIsEnum$G.call(b, prop))
15100
- __defNormalProp$X(a, prop, b[prop]);
15109
+ if (__hasOwnProp$I.call(b, prop))
15110
+ __defNormalProp$10(a, prop, b[prop]);
15111
+ if (__getOwnPropSymbols$I)
15112
+ for (var prop of __getOwnPropSymbols$I(b)) {
15113
+ if (__propIsEnum$I.call(b, prop))
15114
+ __defNormalProp$10(a, prop, b[prop]);
15101
15115
  }
15102
15116
  return a;
15103
15117
  };
@@ -15107,7 +15121,7 @@ function createMouseEvent({
15107
15121
  }) {
15108
15122
  const layer_ = source.target;
15109
15123
  const feature = layer_.feature;
15110
- const opt = __spreadValues$F({
15124
+ const opt = __spreadValues$H({
15111
15125
  layer,
15112
15126
  feature,
15113
15127
  event: convertMapClickEvent(source),
@@ -15116,30 +15130,30 @@ function createMouseEvent({
15116
15130
  return opt;
15117
15131
  }
15118
15132
 
15119
- var __defProp$W = Object.defineProperty;
15120
- var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
15121
- var __hasOwnProp$F = Object.prototype.hasOwnProperty;
15122
- var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
15123
- var __defNormalProp$W = (obj, key, value) => key in obj ? __defProp$W(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15124
- var __spreadValues$E = (a, b) => {
15133
+ var __defProp$$ = Object.defineProperty;
15134
+ var __getOwnPropSymbols$H = Object.getOwnPropertySymbols;
15135
+ var __hasOwnProp$H = Object.prototype.hasOwnProperty;
15136
+ var __propIsEnum$H = Object.prototype.propertyIsEnumerable;
15137
+ var __defNormalProp$$ = (obj, key, value) => key in obj ? __defProp$$(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15138
+ var __spreadValues$G = (a, b) => {
15125
15139
  for (var prop in b || (b = {}))
15126
- if (__hasOwnProp$F.call(b, prop))
15127
- __defNormalProp$W(a, prop, b[prop]);
15128
- if (__getOwnPropSymbols$F)
15129
- for (var prop of __getOwnPropSymbols$F(b)) {
15130
- if (__propIsEnum$F.call(b, prop))
15131
- __defNormalProp$W(a, prop, b[prop]);
15140
+ if (__hasOwnProp$H.call(b, prop))
15141
+ __defNormalProp$$(a, prop, b[prop]);
15142
+ if (__getOwnPropSymbols$H)
15143
+ for (var prop of __getOwnPropSymbols$H(b)) {
15144
+ if (__propIsEnum$H.call(b, prop))
15145
+ __defNormalProp$$(a, prop, b[prop]);
15132
15146
  }
15133
15147
  return a;
15134
15148
  };
15135
- var __publicField$D = (obj, key, value) => __defNormalProp$W(obj, typeof key !== "symbol" ? key + "" : key, value);
15149
+ var __publicField$G = (obj, key, value) => __defNormalProp$$(obj, typeof key !== "symbol" ? key + "" : key, value);
15136
15150
  class GeoJsonEvents {
15137
15151
  constructor(layer) {
15138
- __publicField$D(this, "layer");
15139
- __publicField$D(this, "_onclick");
15140
- __publicField$D(this, "_ondblclick");
15141
- __publicField$D(this, "_mouseout");
15142
- __publicField$D(this, "_mouseover");
15152
+ __publicField$G(this, "layer");
15153
+ __publicField$G(this, "_onclick");
15154
+ __publicField$G(this, "_ondblclick");
15155
+ __publicField$G(this, "_mouseout");
15156
+ __publicField$G(this, "_mouseover");
15143
15157
  this.layer = layer;
15144
15158
  }
15145
15159
  handleMouseEvents(layer) {
@@ -15148,7 +15162,7 @@ class GeoJsonEvents {
15148
15162
  if (onClick_) {
15149
15163
  this._onclick = (e) => {
15150
15164
  const selected = !!this.layer._getSelected(layer);
15151
- onClick_(__spreadValues$E({
15165
+ onClick_(__spreadValues$G({
15152
15166
  selected
15153
15167
  }, this._createMouseEvent(e)));
15154
15168
  };
@@ -15158,7 +15172,7 @@ class GeoJsonEvents {
15158
15172
  this._ondblclick = (e) => {
15159
15173
  leafletSrcExports.DomEvent.stopPropagation(e);
15160
15174
  const selected = !!this.layer._getSelected(layer);
15161
- onDoubleClick(__spreadValues$E({
15175
+ onDoubleClick(__spreadValues$G({
15162
15176
  selected
15163
15177
  }, this._createMouseEvent(e)));
15164
15178
  };
@@ -15836,19 +15850,19 @@ const typeExpressions = {
15836
15850
  typeof: evaluateArgs(([arg]) => typeOfValue(arg))
15837
15851
  };
15838
15852
 
15839
- var __defProp$V = Object.defineProperty;
15840
- var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
15841
- var __hasOwnProp$E = Object.prototype.hasOwnProperty;
15842
- var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
15843
- var __defNormalProp$V = (obj, key, value) => key in obj ? __defProp$V(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15844
- var __spreadValues$D = (a, b) => {
15853
+ var __defProp$_ = Object.defineProperty;
15854
+ var __getOwnPropSymbols$G = Object.getOwnPropertySymbols;
15855
+ var __hasOwnProp$G = Object.prototype.hasOwnProperty;
15856
+ var __propIsEnum$G = Object.prototype.propertyIsEnumerable;
15857
+ var __defNormalProp$_ = (obj, key, value) => key in obj ? __defProp$_(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15858
+ var __spreadValues$F = (a, b) => {
15845
15859
  for (var prop in b || (b = {}))
15846
- if (__hasOwnProp$E.call(b, prop))
15847
- __defNormalProp$V(a, prop, b[prop]);
15848
- if (__getOwnPropSymbols$E)
15849
- for (var prop of __getOwnPropSymbols$E(b)) {
15850
- if (__propIsEnum$E.call(b, prop))
15851
- __defNormalProp$V(a, prop, b[prop]);
15860
+ if (__hasOwnProp$G.call(b, prop))
15861
+ __defNormalProp$_(a, prop, b[prop]);
15862
+ if (__getOwnPropSymbols$G)
15863
+ for (var prop of __getOwnPropSymbols$G(b)) {
15864
+ if (__propIsEnum$G.call(b, prop))
15865
+ __defNormalProp$_(a, prop, b[prop]);
15852
15866
  }
15853
15867
  return a;
15854
15868
  };
@@ -15860,7 +15874,7 @@ function isExpression(value) {
15860
15874
  }
15861
15875
  return false;
15862
15876
  }
15863
- const expressions = __spreadValues$D(__spreadValues$D(__spreadValues$D(__spreadValues$D(__spreadValues$D(__spreadValues$D({}, mathExpressions), typeExpressions), stringExpressions), lookupExpressions), decisionExpressions), interpolationExpressions);
15877
+ const expressions = __spreadValues$F(__spreadValues$F(__spreadValues$F(__spreadValues$F(__spreadValues$F(__spreadValues$F({}, mathExpressions), typeExpressions), stringExpressions), lookupExpressions), decisionExpressions), interpolationExpressions);
15864
15878
  function evaluate(expression, data = {}) {
15865
15879
  const [name, ...args] = expression;
15866
15880
  const expressionFun = expressions[name];
@@ -15873,19 +15887,19 @@ function evaluate(expression, data = {}) {
15873
15887
  throw new Error(`Expression "${name}" is not supported.`);
15874
15888
  }
15875
15889
 
15876
- var __defProp$U = Object.defineProperty;
15877
- var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
15878
- var __hasOwnProp$D = Object.prototype.hasOwnProperty;
15879
- var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
15880
- var __defNormalProp$U = (obj, key, value) => key in obj ? __defProp$U(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15881
- var __spreadValues$C = (a, b) => {
15890
+ var __defProp$Z = Object.defineProperty;
15891
+ var __getOwnPropSymbols$F = Object.getOwnPropertySymbols;
15892
+ var __hasOwnProp$F = Object.prototype.hasOwnProperty;
15893
+ var __propIsEnum$F = Object.prototype.propertyIsEnumerable;
15894
+ var __defNormalProp$Z = (obj, key, value) => key in obj ? __defProp$Z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15895
+ var __spreadValues$E = (a, b) => {
15882
15896
  for (var prop in b || (b = {}))
15883
- if (__hasOwnProp$D.call(b, prop))
15884
- __defNormalProp$U(a, prop, b[prop]);
15885
- if (__getOwnPropSymbols$D)
15886
- for (var prop of __getOwnPropSymbols$D(b)) {
15887
- if (__propIsEnum$D.call(b, prop))
15888
- __defNormalProp$U(a, prop, b[prop]);
15897
+ if (__hasOwnProp$F.call(b, prop))
15898
+ __defNormalProp$Z(a, prop, b[prop]);
15899
+ if (__getOwnPropSymbols$F)
15900
+ for (var prop of __getOwnPropSymbols$F(b)) {
15901
+ if (__propIsEnum$F.call(b, prop))
15902
+ __defNormalProp$Z(a, prop, b[prop]);
15889
15903
  }
15890
15904
  return a;
15891
15905
  };
@@ -15918,25 +15932,25 @@ function createExpressionCallback(paint) {
15918
15932
  for (const p in expressions) {
15919
15933
  fromCb[p] = expressions[p](feature);
15920
15934
  }
15921
- return __spreadValues$C(__spreadValues$C({}, paint), fromCb);
15935
+ return __spreadValues$E(__spreadValues$E({}, paint), fromCb);
15922
15936
  };
15923
15937
  }
15924
15938
  return;
15925
15939
  }
15926
15940
 
15927
- var __defProp$T = Object.defineProperty;
15928
- var __getOwnPropSymbols$C = Object.getOwnPropertySymbols;
15929
- var __hasOwnProp$C = Object.prototype.hasOwnProperty;
15930
- var __propIsEnum$C = Object.prototype.propertyIsEnumerable;
15931
- var __defNormalProp$T = (obj, key, value) => key in obj ? __defProp$T(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15932
- var __spreadValues$B = (a, b) => {
15941
+ var __defProp$Y = Object.defineProperty;
15942
+ var __getOwnPropSymbols$E = Object.getOwnPropertySymbols;
15943
+ var __hasOwnProp$E = Object.prototype.hasOwnProperty;
15944
+ var __propIsEnum$E = Object.prototype.propertyIsEnumerable;
15945
+ var __defNormalProp$Y = (obj, key, value) => key in obj ? __defProp$Y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15946
+ var __spreadValues$D = (a, b) => {
15933
15947
  for (var prop in b || (b = {}))
15934
- if (__hasOwnProp$C.call(b, prop))
15935
- __defNormalProp$T(a, prop, b[prop]);
15936
- if (__getOwnPropSymbols$C)
15937
- for (var prop of __getOwnPropSymbols$C(b)) {
15938
- if (__propIsEnum$C.call(b, prop))
15939
- __defNormalProp$T(a, prop, b[prop]);
15948
+ if (__hasOwnProp$E.call(b, prop))
15949
+ __defNormalProp$Y(a, prop, b[prop]);
15950
+ if (__getOwnPropSymbols$E)
15951
+ for (var prop of __getOwnPropSymbols$E(b)) {
15952
+ if (__propIsEnum$E.call(b, prop))
15953
+ __defNormalProp$Y(a, prop, b[prop]);
15940
15954
  }
15941
15955
  return a;
15942
15956
  };
@@ -15983,7 +15997,7 @@ function isPropertyFilter(filter) {
15983
15997
  return false;
15984
15998
  }
15985
15999
  function featureFilter(feature, filters) {
15986
- const properties = __spreadValues$B({}, feature.properties);
16000
+ const properties = __spreadValues$D({}, feature.properties);
15987
16001
  if (properties) {
15988
16002
  properties.$id = feature.id;
15989
16003
  return propertiesFilter(properties, filters);
@@ -16018,19 +16032,19 @@ function propertiesFilter(properties, filters) {
16018
16032
  return logic === "any" ? filters_.some(filterFunction) : filters_.every(filterFunction);
16019
16033
  }
16020
16034
 
16021
- var __defProp$S = Object.defineProperty;
16022
- var __getOwnPropSymbols$B = Object.getOwnPropertySymbols;
16023
- var __hasOwnProp$B = Object.prototype.hasOwnProperty;
16024
- var __propIsEnum$B = Object.prototype.propertyIsEnumerable;
16025
- var __defNormalProp$S = (obj, key, value) => key in obj ? __defProp$S(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16026
- var __spreadValues$A = (a, b) => {
16035
+ var __defProp$X = Object.defineProperty;
16036
+ var __getOwnPropSymbols$D = Object.getOwnPropertySymbols;
16037
+ var __hasOwnProp$D = Object.prototype.hasOwnProperty;
16038
+ var __propIsEnum$D = Object.prototype.propertyIsEnumerable;
16039
+ var __defNormalProp$X = (obj, key, value) => key in obj ? __defProp$X(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16040
+ var __spreadValues$C = (a, b) => {
16027
16041
  for (var prop in b || (b = {}))
16028
- if (__hasOwnProp$B.call(b, prop))
16029
- __defNormalProp$S(a, prop, b[prop]);
16030
- if (__getOwnPropSymbols$B)
16031
- for (var prop of __getOwnPropSymbols$B(b)) {
16032
- if (__propIsEnum$B.call(b, prop))
16033
- __defNormalProp$S(a, prop, b[prop]);
16042
+ if (__hasOwnProp$D.call(b, prop))
16043
+ __defNormalProp$X(a, prop, b[prop]);
16044
+ if (__getOwnPropSymbols$D)
16045
+ for (var prop of __getOwnPropSymbols$D(b)) {
16046
+ if (__propIsEnum$D.call(b, prop))
16047
+ __defNormalProp$X(a, prop, b[prop]);
16034
16048
  }
16035
16049
  return a;
16036
16050
  };
@@ -16059,7 +16073,7 @@ function createPropertiesPaint(propertiesPaint) {
16059
16073
  return (feature) => {
16060
16074
  const paint = paintsFilters.find((x) => featureFilter(feature, x[0]));
16061
16075
  if (paint) {
16062
- return __spreadValues$A(__spreadValues$A({}, mask), paint[1]);
16076
+ return __spreadValues$C(__spreadValues$C({}, mask), paint[1]);
16063
16077
  }
16064
16078
  return mask;
16065
16079
  };
@@ -16083,8 +16097,8 @@ function expressionCallback({
16083
16097
  }
16084
16098
  function finalizePaint({ paint, defaultPaint }) {
16085
16099
  var _a;
16086
- let newPaint = __spreadValues$A({}, defaultPaint);
16087
- newPaint = __spreadValues$A(__spreadValues$A({}, newPaint), paint);
16100
+ let newPaint = __spreadValues$C({}, defaultPaint);
16101
+ newPaint = __spreadValues$C(__spreadValues$C({}, newPaint), paint);
16088
16102
  newPaint.fill = (_a = newPaint.fill) != null ? _a : true;
16089
16103
  newPaint.stroke = newPaint.stroke !== void 0 ? newPaint.stroke : !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
16090
16104
  return newPaint;
@@ -16097,7 +16111,7 @@ function preparePaint({
16097
16111
  if (!paint) {
16098
16112
  throw new Error("paint is empty");
16099
16113
  }
16100
- let newPaint = __spreadValues$A({}, defaultPaint);
16114
+ let newPaint = __spreadValues$C({}, defaultPaint);
16101
16115
  if (isPaintCallback(paint)) {
16102
16116
  const getPaintFunction = (feature) => {
16103
16117
  const getPaint = preparePaint({
@@ -16154,41 +16168,41 @@ function preparePaint({
16154
16168
  return newPaint;
16155
16169
  }
16156
16170
 
16157
- var __defProp$R = Object.defineProperty;
16158
- var __defProps$l = Object.defineProperties;
16159
- var __getOwnPropDescs$l = Object.getOwnPropertyDescriptors;
16160
- var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
16161
- var __hasOwnProp$A = Object.prototype.hasOwnProperty;
16162
- var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
16163
- var __defNormalProp$R = (obj, key, value) => key in obj ? __defProp$R(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16164
- var __spreadValues$z = (a, b) => {
16171
+ var __defProp$W = Object.defineProperty;
16172
+ var __defProps$n = Object.defineProperties;
16173
+ var __getOwnPropDescs$n = Object.getOwnPropertyDescriptors;
16174
+ var __getOwnPropSymbols$C = Object.getOwnPropertySymbols;
16175
+ var __hasOwnProp$C = Object.prototype.hasOwnProperty;
16176
+ var __propIsEnum$C = Object.prototype.propertyIsEnumerable;
16177
+ var __defNormalProp$W = (obj, key, value) => key in obj ? __defProp$W(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16178
+ var __spreadValues$B = (a, b) => {
16165
16179
  for (var prop in b || (b = {}))
16166
- if (__hasOwnProp$A.call(b, prop))
16167
- __defNormalProp$R(a, prop, b[prop]);
16168
- if (__getOwnPropSymbols$A)
16169
- for (var prop of __getOwnPropSymbols$A(b)) {
16170
- if (__propIsEnum$A.call(b, prop))
16171
- __defNormalProp$R(a, prop, b[prop]);
16180
+ if (__hasOwnProp$C.call(b, prop))
16181
+ __defNormalProp$W(a, prop, b[prop]);
16182
+ if (__getOwnPropSymbols$C)
16183
+ for (var prop of __getOwnPropSymbols$C(b)) {
16184
+ if (__propIsEnum$C.call(b, prop))
16185
+ __defNormalProp$W(a, prop, b[prop]);
16172
16186
  }
16173
16187
  return a;
16174
16188
  };
16175
- var __spreadProps$l = (a, b) => __defProps$l(a, __getOwnPropDescs$l(b));
16176
- var __objRest$5 = (source, exclude) => {
16189
+ var __spreadProps$n = (a, b) => __defProps$n(a, __getOwnPropDescs$n(b));
16190
+ var __objRest$8 = (source, exclude) => {
16177
16191
  var target = {};
16178
16192
  for (var prop in source)
16179
- if (__hasOwnProp$A.call(source, prop) && exclude.indexOf(prop) < 0)
16193
+ if (__hasOwnProp$C.call(source, prop) && exclude.indexOf(prop) < 0)
16180
16194
  target[prop] = source[prop];
16181
- if (source != null && __getOwnPropSymbols$A)
16182
- for (var prop of __getOwnPropSymbols$A(source)) {
16183
- if (exclude.indexOf(prop) < 0 && __propIsEnum$A.call(source, prop))
16195
+ if (source != null && __getOwnPropSymbols$C)
16196
+ for (var prop of __getOwnPropSymbols$C(source)) {
16197
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$C.call(source, prop))
16184
16198
  target[prop] = source[prop];
16185
16199
  }
16186
16200
  return target;
16187
16201
  };
16188
- var __publicField$C = (obj, key, value) => __defNormalProp$R(obj, key + "" , value);
16202
+ var __publicField$F = (obj, key, value) => __defNormalProp$W(obj, key + "" , value);
16189
16203
  class GeoJsonPaint {
16190
16204
  constructor(layer) {
16191
- __publicField$C(this, "layer");
16205
+ __publicField$F(this, "layer");
16192
16206
  this.layer = layer;
16193
16207
  }
16194
16208
  setPaintEachLayer(paint) {
@@ -16256,7 +16270,7 @@ class GeoJsonPaint {
16256
16270
  return PAINT;
16257
16271
  }
16258
16272
  _createDivIcon(icon) {
16259
- const _a = icon, { html, rotate, className } = _a, toLIconOpt = __objRest$5(_a, ["html", "rotate", "className"]);
16273
+ const _a = icon, { html, rotate, className } = _a, toLIconOpt = __objRest$8(_a, ["html", "rotate", "className"]);
16260
16274
  const element = document.createElement("div");
16261
16275
  if (className) {
16262
16276
  element.className = className;
@@ -16267,7 +16281,7 @@ class GeoJsonPaint {
16267
16281
  if (html) {
16268
16282
  element.innerHTML = html;
16269
16283
  }
16270
- const divIcon = new leafletSrcExports.DivIcon(__spreadProps$l(__spreadValues$z({
16284
+ const divIcon = new leafletSrcExports.DivIcon(__spreadProps$n(__spreadValues$B({
16271
16285
  className: ""
16272
16286
  }, toLIconOpt), {
16273
16287
  html: element
@@ -16293,7 +16307,7 @@ class GeoJsonPaint {
16293
16307
  }
16294
16308
  return (_, latlng) => {
16295
16309
  const p = PAINT;
16296
- return new leafletSrcExports.CircleMarker(latlng, this.preparePaint(__spreadValues$z(__spreadValues$z({}, p), icon)));
16310
+ return new leafletSrcExports.CircleMarker(latlng, this.preparePaint(__spreadValues$B(__spreadValues$B({}, p), icon)));
16297
16311
  };
16298
16312
  }
16299
16313
  createPaintOptions(paint) {
@@ -16315,27 +16329,27 @@ class GeoJsonPaint {
16315
16329
  }
16316
16330
  }
16317
16331
 
16318
- var __defProp$Q = Object.defineProperty;
16319
- var __defProps$k = Object.defineProperties;
16320
- var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
16321
- var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
16322
- var __hasOwnProp$z = Object.prototype.hasOwnProperty;
16323
- var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
16324
- var __defNormalProp$Q = (obj, key, value) => key in obj ? __defProp$Q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16325
- var __spreadValues$y = (a, b) => {
16332
+ var __defProp$V = Object.defineProperty;
16333
+ var __defProps$m = Object.defineProperties;
16334
+ var __getOwnPropDescs$m = Object.getOwnPropertyDescriptors;
16335
+ var __getOwnPropSymbols$B = Object.getOwnPropertySymbols;
16336
+ var __hasOwnProp$B = Object.prototype.hasOwnProperty;
16337
+ var __propIsEnum$B = Object.prototype.propertyIsEnumerable;
16338
+ var __defNormalProp$V = (obj, key, value) => key in obj ? __defProp$V(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16339
+ var __spreadValues$A = (a, b) => {
16326
16340
  for (var prop in b || (b = {}))
16327
- if (__hasOwnProp$z.call(b, prop))
16328
- __defNormalProp$Q(a, prop, b[prop]);
16329
- if (__getOwnPropSymbols$z)
16330
- for (var prop of __getOwnPropSymbols$z(b)) {
16331
- if (__propIsEnum$z.call(b, prop))
16332
- __defNormalProp$Q(a, prop, b[prop]);
16341
+ if (__hasOwnProp$B.call(b, prop))
16342
+ __defNormalProp$V(a, prop, b[prop]);
16343
+ if (__getOwnPropSymbols$B)
16344
+ for (var prop of __getOwnPropSymbols$B(b)) {
16345
+ if (__propIsEnum$B.call(b, prop))
16346
+ __defNormalProp$V(a, prop, b[prop]);
16333
16347
  }
16334
16348
  return a;
16335
16349
  };
16336
- var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
16337
- var __publicField$B = (obj, key, value) => __defNormalProp$Q(obj, typeof key !== "symbol" ? key + "" : key, value);
16338
- var __async$s = (__this, __arguments, generator) => {
16350
+ var __spreadProps$m = (a, b) => __defProps$m(a, __getOwnPropDescs$m(b));
16351
+ var __publicField$E = (obj, key, value) => __defNormalProp$V(obj, typeof key !== "symbol" ? key + "" : key, value);
16352
+ var __async$u = (__this, __arguments, generator) => {
16339
16353
  return new Promise((resolve, reject) => {
16340
16354
  var fulfilled = (value) => {
16341
16355
  try {
@@ -16358,22 +16372,22 @@ var __async$s = (__this, __arguments, generator) => {
16358
16372
  class GeoJsonAdapter extends BaseAdapter {
16359
16373
  constructor(map, options) {
16360
16374
  super(map, options);
16361
- __publicField$B(this, "layer");
16362
- __publicField$B(this, "selected", false);
16363
- __publicField$B(this, "type");
16364
- __publicField$B(this, "_layers", []);
16365
- __publicField$B(this, "_events");
16366
- __publicField$B(this, "paint");
16367
- __publicField$B(this, "selectedPaint");
16368
- __publicField$B(this, "_selectedLayers", []);
16369
- __publicField$B(this, "_filteredLayers", []);
16370
- __publicField$B(this, "_filterFun");
16371
- __publicField$B(this, "_openedPopup", []);
16372
- __publicField$B(this, "_paint");
16373
- __publicField$B(this, "$updateTooltip", debounce(() => {
16375
+ __publicField$E(this, "layer");
16376
+ __publicField$E(this, "selected", false);
16377
+ __publicField$E(this, "type");
16378
+ __publicField$E(this, "_layers", []);
16379
+ __publicField$E(this, "_events");
16380
+ __publicField$E(this, "paint");
16381
+ __publicField$E(this, "selectedPaint");
16382
+ __publicField$E(this, "_selectedLayers", []);
16383
+ __publicField$E(this, "_filteredLayers", []);
16384
+ __publicField$E(this, "_filterFun");
16385
+ __publicField$E(this, "_openedPopup", []);
16386
+ __publicField$E(this, "_paint");
16387
+ __publicField$E(this, "$updateTooltip", debounce(() => {
16374
16388
  this.updateTooltip();
16375
16389
  }, 300));
16376
- __publicField$B(this, "$unselect", () => {
16390
+ __publicField$E(this, "$unselect", () => {
16377
16391
  this.unselect();
16378
16392
  });
16379
16393
  this._events = new GeoJsonEvents(this);
@@ -16382,7 +16396,7 @@ class GeoJsonAdapter extends BaseAdapter {
16382
16396
  addLayer(options) {
16383
16397
  Object.assign(this.options, options);
16384
16398
  this.paint = options.paint;
16385
- this.layer = new leafletSrcExports.FeatureGroup([], __spreadProps$k(__spreadValues$y({}, options.nativeOptions), {
16399
+ this.layer = new leafletSrcExports.FeatureGroup([], __spreadProps$m(__spreadValues$A({}, options.nativeOptions), {
16386
16400
  pane: this.pane
16387
16401
  }));
16388
16402
  this.selectedPaint = options.selectedPaint;
@@ -16431,7 +16445,7 @@ class GeoJsonAdapter extends BaseAdapter {
16431
16445
  }
16432
16446
  getSelected() {
16433
16447
  return this._selectedLayers.map((x) => {
16434
- return __spreadValues$y({
16448
+ return __spreadValues$A({
16435
16449
  target: this,
16436
16450
  feature: x.feature,
16437
16451
  layer: x
@@ -16450,14 +16464,14 @@ class GeoJsonAdapter extends BaseAdapter {
16450
16464
  const filteredLayers = [];
16451
16465
  this._layers.forEach(({ feature, layer }) => {
16452
16466
  if (layer) {
16453
- const ok = fun ? fun(__spreadValues$y({
16467
+ const ok = fun ? fun(__spreadValues$A({
16454
16468
  target: this,
16455
16469
  feature,
16456
16470
  layer
16457
16471
  }, createFeaturePositionOptions(feature))) : true;
16458
16472
  if (ok) {
16459
16473
  layer_.addLayer(layer);
16460
- filteredLayers.push(__spreadValues$y({
16474
+ filteredLayers.push(__spreadValues$A({
16461
16475
  target: this,
16462
16476
  feature,
16463
16477
  layer
@@ -16478,7 +16492,7 @@ class GeoJsonAdapter extends BaseAdapter {
16478
16492
  getLayers() {
16479
16493
  return this._layers.map(({ layer, feature }) => {
16480
16494
  const visible = layer && !!layer._map;
16481
- return __spreadValues$y({
16495
+ return __spreadValues$A({
16482
16496
  feature,
16483
16497
  layer,
16484
16498
  visible,
@@ -16596,13 +16610,13 @@ class GeoJsonAdapter extends BaseAdapter {
16596
16610
  }
16597
16611
  }
16598
16612
  updatePaint(paint) {
16599
- this.paint = __spreadValues$y(__spreadValues$y({}, this.paint), paint);
16613
+ this.paint = __spreadValues$A(__spreadValues$A({}, this.paint), paint);
16600
16614
  for (const l of this._layers) {
16601
16615
  this._paint.setPaint(l, this.paint);
16602
16616
  }
16603
16617
  }
16604
16618
  updateSelectedPaint(paint) {
16605
- this.selectedPaint = __spreadValues$y(__spreadValues$y({}, this.selectedPaint), paint);
16619
+ this.selectedPaint = __spreadValues$A(__spreadValues$A({}, this.selectedPaint), paint);
16606
16620
  for (const l of this._selectedLayers) {
16607
16621
  this._paint.setPaint(l, this.selectedPaint);
16608
16622
  }
@@ -16619,7 +16633,7 @@ class GeoJsonAdapter extends BaseAdapter {
16619
16633
  if (feature.properties && labelField) {
16620
16634
  message = feature.properties[labelField];
16621
16635
  } else if (label) {
16622
- message = label(__spreadValues$y(__spreadValues$y({
16636
+ message = label(__spreadValues$A(__spreadValues$A({
16623
16637
  target: this
16624
16638
  }, layerDef), createFeaturePositionOptions(feature)));
16625
16639
  }
@@ -16630,7 +16644,7 @@ class GeoJsonAdapter extends BaseAdapter {
16630
16644
  }
16631
16645
  }
16632
16646
  _openPopup(_0) {
16633
- return __async$s(this, arguments, function* (def, options = {}, type, latLng) {
16647
+ return __async$u(this, arguments, function* (def, options = {}, type, latLng) {
16634
16648
  var _a, _b;
16635
16649
  const { feature, layer } = def;
16636
16650
  const {
@@ -16638,7 +16652,7 @@ class GeoJsonAdapter extends BaseAdapter {
16638
16652
  autoPan,
16639
16653
  maxWidth,
16640
16654
  closeButton: closeButton_
16641
- } = __spreadValues$y({
16655
+ } = __spreadValues$A({
16642
16656
  minWidth: 300
16643
16657
  }, options);
16644
16658
  const closeButton = closeButton_ != null ? closeButton_ : !this.options.selectOnHover;
@@ -16654,7 +16668,7 @@ class GeoJsonAdapter extends BaseAdapter {
16654
16668
  };
16655
16669
  let content;
16656
16670
  if (options.createPopupContent) {
16657
- content = yield options.createPopupContent(__spreadValues$y({
16671
+ content = yield options.createPopupContent(__spreadValues$A({
16658
16672
  layer,
16659
16673
  feature,
16660
16674
  target: this,
@@ -16730,9 +16744,9 @@ class GeoJsonAdapter extends BaseAdapter {
16730
16744
  lopt = {
16731
16745
  style: (feature) => {
16732
16746
  if (feature) {
16733
- return this._paint.preparePaint(__spreadValues$y(__spreadValues$y({}, PAINT), paint(feature)));
16747
+ return this._paint.preparePaint(__spreadValues$A(__spreadValues$A({}, PAINT), paint(feature)));
16734
16748
  } else {
16735
- return this._paint.preparePaint(__spreadProps$k(__spreadValues$y({}, PAINT), { type: "path" }));
16749
+ return this._paint.preparePaint(__spreadProps$m(__spreadValues$A({}, PAINT), { type: "path" }));
16736
16750
  }
16737
16751
  }
16738
16752
  };
@@ -16748,7 +16762,7 @@ class GeoJsonAdapter extends BaseAdapter {
16748
16762
  _onEachFeature(feature, layer) {
16749
16763
  const layer_ = this.layer;
16750
16764
  if (layer_) {
16751
- const def = __spreadValues$y({
16765
+ const def = __spreadValues$A({
16752
16766
  target: this,
16753
16767
  feature,
16754
16768
  layer
@@ -16783,7 +16797,7 @@ class GeoJsonAdapter extends BaseAdapter {
16783
16797
  setTimeout(() => {
16784
16798
  if (popup) {
16785
16799
  this._openPopup(
16786
- __spreadValues$y({
16800
+ __spreadValues$A({
16787
16801
  target: this,
16788
16802
  layer,
16789
16803
  feature
@@ -16801,7 +16815,7 @@ class GeoJsonAdapter extends BaseAdapter {
16801
16815
  leafletSrcExports.DomEvent.stopPropagation(e);
16802
16816
  const layer = e.target;
16803
16817
  const feature = layer.feature;
16804
- const def = __spreadValues$y({
16818
+ const def = __spreadValues$A({
16805
16819
  target: this,
16806
16820
  layer,
16807
16821
  feature
@@ -16834,7 +16848,7 @@ class GeoJsonAdapter extends BaseAdapter {
16834
16848
  }
16835
16849
  if (this.options.onSelect) {
16836
16850
  const features = def.feature ? [def.feature] : [];
16837
- this.options.onSelect(__spreadValues$y({
16851
+ this.options.onSelect(__spreadValues$A({
16838
16852
  type,
16839
16853
  layer: this,
16840
16854
  features
@@ -16926,20 +16940,20 @@ function callAjax({
16926
16940
  return [promise, abortFunc];
16927
16941
  }
16928
16942
 
16929
- var __defProp$P = Object.defineProperty;
16930
- var __defNormalProp$P = (obj, key, value) => key in obj ? __defProp$P(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16931
- var __publicField$A = (obj, key, value) => __defNormalProp$P(obj, typeof key !== "symbol" ? key + "" : key, value);
16943
+ var __defProp$U = Object.defineProperty;
16944
+ var __defNormalProp$U = (obj, key, value) => key in obj ? __defProp$U(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16945
+ var __publicField$D = (obj, key, value) => __defNormalProp$U(obj, typeof key !== "symbol" ? key + "" : key, value);
16932
16946
  class Queue {
16933
16947
  /**
16934
16948
  * @param {PromiseQueueOptions} options - Configuration options for the queue.
16935
16949
  */
16936
16950
  constructor({ concurrency = 1, delay = 0 } = {}) {
16937
- __publicField$A(this, "queue", []);
16938
- __publicField$A(this, "concurrency");
16939
- __publicField$A(this, "activeCount", 0);
16940
- __publicField$A(this, "timeoutId");
16941
- __publicField$A(this, "delay");
16942
- __publicField$A(this, "toAbort", []);
16951
+ __publicField$D(this, "queue", []);
16952
+ __publicField$D(this, "concurrency");
16953
+ __publicField$D(this, "activeCount", 0);
16954
+ __publicField$D(this, "timeoutId");
16955
+ __publicField$D(this, "delay");
16956
+ __publicField$D(this, "toAbort", []);
16943
16957
  this.concurrency = concurrency;
16944
16958
  this.delay = delay;
16945
16959
  }
@@ -17015,13 +17029,13 @@ class Queue {
17015
17029
 
17016
17030
  const imageQueue = new Queue({ concurrency: 6, delay: 200 });
17017
17031
 
17018
- var __defProp$O = Object.defineProperty;
17019
- var __defNormalProp$O = (obj, key, value) => key in obj ? __defProp$O(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17020
- var __publicField$z = (obj, key, value) => __defNormalProp$O(obj, key + "" , value);
17032
+ var __defProp$T = Object.defineProperty;
17033
+ var __defNormalProp$T = (obj, key, value) => key in obj ? __defProp$T(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17034
+ var __publicField$C = (obj, key, value) => __defNormalProp$T(obj, key + "" , value);
17021
17035
  class ImageOverlay extends leafletSrcExports.ImageOverlay {
17022
17036
  constructor(imageUrl, bounds, options) {
17023
17037
  super(imageUrl, bounds, options);
17024
- __publicField$z(this, "_aborter");
17038
+ __publicField$C(this, "_aborter");
17025
17039
  }
17026
17040
  cancelLoad() {
17027
17041
  if (this._aborter) {
@@ -17050,13 +17064,14 @@ class ImageOverlay extends leafletSrcExports.ImageOverlay {
17050
17064
  }
17051
17065
  }
17052
17066
 
17053
- var __defProp$N = Object.defineProperty;
17054
- var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17055
- var __publicField$y = (obj, key, value) => __defNormalProp$N(obj, typeof key !== "symbol" ? key + "" : key, value);
17067
+ var __defProp$S = Object.defineProperty;
17068
+ var __defNormalProp$S = (obj, key, value) => key in obj ? __defProp$S(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17069
+ var __publicField$B = (obj, key, value) => __defNormalProp$S(obj, typeof key !== "symbol" ? key + "" : key, value);
17056
17070
  class ImageLayer extends leafletSrcExports.Layer {
17057
17071
  constructor(url, options) {
17072
+ var _a;
17058
17073
  super(options);
17059
- __publicField$y(this, "defaultWmsParams", {
17074
+ __publicField$B(this, "defaultWmsParams", {
17060
17075
  service: "WMS",
17061
17076
  request: "GetMap",
17062
17077
  version: "1.1.1",
@@ -17065,7 +17080,7 @@ class ImageLayer extends leafletSrcExports.Layer {
17065
17080
  format: "image/jpeg",
17066
17081
  transparent: false
17067
17082
  });
17068
- __publicField$y(this, "options", {
17083
+ __publicField$B(this, "options", {
17069
17084
  crs: null,
17070
17085
  uppercase: false,
17071
17086
  attribution: "",
@@ -17078,11 +17093,11 @@ class ImageLayer extends leafletSrcExports.Layer {
17078
17093
  viewPortBuffer: 0,
17079
17094
  setViewDelay: 100
17080
17095
  });
17081
- __publicField$y(this, "wmsParams");
17082
- __publicField$y(this, "_url");
17083
- __publicField$y(this, "_currentUrl");
17084
- __publicField$y(this, "_currentOverlay");
17085
- __publicField$y(this, "_loadedOverlay");
17096
+ __publicField$B(this, "wmsParams");
17097
+ __publicField$B(this, "_url");
17098
+ __publicField$B(this, "_currentUrl");
17099
+ __publicField$B(this, "_currentOverlay");
17100
+ __publicField$B(this, "_loadedOverlay");
17086
17101
  this._url = url;
17087
17102
  const params = {};
17088
17103
  const opts = {};
@@ -17095,7 +17110,11 @@ class ImageLayer extends leafletSrcExports.Layer {
17095
17110
  }
17096
17111
  }
17097
17112
  leafletSrcExports.Util.setOptions(this, opts);
17098
- this.wmsParams = leafletSrcExports.Util.extend({}, this.defaultWmsParams, params);
17113
+ this.wmsParams = leafletSrcExports.Util.extend(
17114
+ {},
17115
+ this.defaultWmsParams,
17116
+ (_a = params == null ? void 0 : params.params) != null ? _a : {}
17117
+ );
17099
17118
  }
17100
17119
  setParams(params) {
17101
17120
  leafletSrcExports.Util.extend(this.wmsParams, params);
@@ -17242,34 +17261,34 @@ class ImageLayer extends leafletSrcExports.Layer {
17242
17261
  }
17243
17262
  }
17244
17263
 
17245
- var __defProp$M = Object.defineProperty;
17246
- var __getOwnPropSymbols$y = Object.getOwnPropertySymbols;
17247
- var __hasOwnProp$y = Object.prototype.hasOwnProperty;
17248
- var __propIsEnum$y = Object.prototype.propertyIsEnumerable;
17249
- var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17250
- var __spreadValues$x = (a, b) => {
17264
+ var __defProp$R = Object.defineProperty;
17265
+ var __getOwnPropSymbols$A = Object.getOwnPropertySymbols;
17266
+ var __hasOwnProp$A = Object.prototype.hasOwnProperty;
17267
+ var __propIsEnum$A = Object.prototype.propertyIsEnumerable;
17268
+ var __defNormalProp$R = (obj, key, value) => key in obj ? __defProp$R(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17269
+ var __spreadValues$z = (a, b) => {
17251
17270
  for (var prop in b || (b = {}))
17252
- if (__hasOwnProp$y.call(b, prop))
17253
- __defNormalProp$M(a, prop, b[prop]);
17254
- if (__getOwnPropSymbols$y)
17255
- for (var prop of __getOwnPropSymbols$y(b)) {
17256
- if (__propIsEnum$y.call(b, prop))
17257
- __defNormalProp$M(a, prop, b[prop]);
17271
+ if (__hasOwnProp$A.call(b, prop))
17272
+ __defNormalProp$R(a, prop, b[prop]);
17273
+ if (__getOwnPropSymbols$A)
17274
+ for (var prop of __getOwnPropSymbols$A(b)) {
17275
+ if (__propIsEnum$A.call(b, prop))
17276
+ __defNormalProp$R(a, prop, b[prop]);
17258
17277
  }
17259
17278
  return a;
17260
17279
  };
17261
- var __publicField$x = (obj, key, value) => __defNormalProp$M(obj, typeof key !== "symbol" ? key + "" : key, value);
17280
+ var __publicField$A = (obj, key, value) => __defNormalProp$R(obj, typeof key !== "symbol" ? key + "" : key, value);
17262
17281
  class ImageAdapter extends BaseAdapter {
17263
17282
  constructor() {
17264
17283
  super(...arguments);
17265
- __publicField$x(this, "layer");
17284
+ __publicField$A(this, "layer");
17266
17285
  }
17267
17286
  addLayer(options) {
17268
17287
  const url = options && options.url;
17269
17288
  if (url) {
17270
- options = __spreadValues$x({ transparent: true }, options);
17289
+ options = __spreadValues$z({ transparent: true }, options);
17271
17290
  const updateWmsParamsFromOpt = options.updateWmsParams;
17272
- this.layer = new ImageLayer(url, __spreadValues$x(__spreadValues$x(__spreadValues$x({
17291
+ this.layer = new ImageLayer(url, __spreadValues$z(__spreadValues$z(__spreadValues$z({
17273
17292
  pane: this.pane,
17274
17293
  headers: options.headers,
17275
17294
  setViewDelay: options.setViewDelay
@@ -17284,8 +17303,15 @@ class ImageAdapter extends BaseAdapter {
17284
17303
  return this.layer;
17285
17304
  }
17286
17305
  }
17306
+ updateLayer(options) {
17307
+ if (this.layer) {
17308
+ const params = (options == null ? void 0 : options.params) || {};
17309
+ leafletSrcExports.Util.extend(this.layer.wmsParams, params);
17310
+ this.layer.update();
17311
+ }
17312
+ }
17287
17313
  }
17288
- __publicField$x(ImageAdapter, "queue", imageQueue);
17314
+ __publicField$A(ImageAdapter, "queue", imageQueue);
17289
17315
 
17290
17316
  function makeRemote(Base) {
17291
17317
  return class RemoteTileLayer extends Base {
@@ -17347,33 +17373,33 @@ class TileLayerBase extends leafletSrcExports.TileLayer {
17347
17373
  }
17348
17374
  const TileLayer = makeRemote(TileLayerBase);
17349
17375
 
17350
- var __defProp$L = Object.defineProperty;
17351
- var __defProps$j = Object.defineProperties;
17352
- var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
17353
- var __getOwnPropSymbols$x = Object.getOwnPropertySymbols;
17354
- var __hasOwnProp$x = Object.prototype.hasOwnProperty;
17355
- var __propIsEnum$x = Object.prototype.propertyIsEnumerable;
17356
- var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17357
- var __spreadValues$w = (a, b) => {
17376
+ var __defProp$Q = Object.defineProperty;
17377
+ var __defProps$l = Object.defineProperties;
17378
+ var __getOwnPropDescs$l = Object.getOwnPropertyDescriptors;
17379
+ var __getOwnPropSymbols$z = Object.getOwnPropertySymbols;
17380
+ var __hasOwnProp$z = Object.prototype.hasOwnProperty;
17381
+ var __propIsEnum$z = Object.prototype.propertyIsEnumerable;
17382
+ var __defNormalProp$Q = (obj, key, value) => key in obj ? __defProp$Q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17383
+ var __spreadValues$y = (a, b) => {
17358
17384
  for (var prop in b || (b = {}))
17359
- if (__hasOwnProp$x.call(b, prop))
17360
- __defNormalProp$L(a, prop, b[prop]);
17361
- if (__getOwnPropSymbols$x)
17362
- for (var prop of __getOwnPropSymbols$x(b)) {
17363
- if (__propIsEnum$x.call(b, prop))
17364
- __defNormalProp$L(a, prop, b[prop]);
17385
+ if (__hasOwnProp$z.call(b, prop))
17386
+ __defNormalProp$Q(a, prop, b[prop]);
17387
+ if (__getOwnPropSymbols$z)
17388
+ for (var prop of __getOwnPropSymbols$z(b)) {
17389
+ if (__propIsEnum$z.call(b, prop))
17390
+ __defNormalProp$Q(a, prop, b[prop]);
17365
17391
  }
17366
17392
  return a;
17367
17393
  };
17368
- var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
17369
- var __objRest$4 = (source, exclude) => {
17394
+ var __spreadProps$l = (a, b) => __defProps$l(a, __getOwnPropDescs$l(b));
17395
+ var __objRest$7 = (source, exclude) => {
17370
17396
  var target = {};
17371
17397
  for (var prop in source)
17372
- if (__hasOwnProp$x.call(source, prop) && exclude.indexOf(prop) < 0)
17398
+ if (__hasOwnProp$z.call(source, prop) && exclude.indexOf(prop) < 0)
17373
17399
  target[prop] = source[prop];
17374
- if (source != null && __getOwnPropSymbols$x)
17375
- for (var prop of __getOwnPropSymbols$x(source)) {
17376
- if (exclude.indexOf(prop) < 0 && __propIsEnum$x.call(source, prop))
17400
+ if (source != null && __getOwnPropSymbols$z)
17401
+ for (var prop of __getOwnPropSymbols$z(source)) {
17402
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$z.call(source, prop))
17377
17403
  target[prop] = source[prop];
17378
17404
  }
17379
17405
  return target;
@@ -17382,9 +17408,9 @@ class TileAdapter extends BaseAdapter {
17382
17408
  addLayer(options) {
17383
17409
  this.options = Object.assign(this.options, options);
17384
17410
  if (options) {
17385
- const _a = options, { url } = _a, opt = __objRest$4(_a, ["url"]);
17411
+ const _a = options, { url } = _a, opt = __objRest$7(_a, ["url"]);
17386
17412
  if (url) {
17387
- const tileLayerOptions = __spreadValues$w({
17413
+ const tileLayerOptions = __spreadValues$y({
17388
17414
  pane: this.pane,
17389
17415
  attribution: opt.attribution,
17390
17416
  minZoom: opt.minZoom,
@@ -17395,7 +17421,7 @@ class TileAdapter extends BaseAdapter {
17395
17421
  }
17396
17422
  let layer;
17397
17423
  if (opt.headers || opt.withCredentials) {
17398
- layer = new TileLayer(url, __spreadProps$j(__spreadValues$w({}, tileLayerOptions), {
17424
+ layer = new TileLayer(url, __spreadProps$l(__spreadValues$y({}, tileLayerOptions), {
17399
17425
  headers: opt.headers,
17400
17426
  withCredentials: opt.withCredentials,
17401
17427
  setViewDelay: opt.setViewDelay
@@ -17407,41 +17433,40 @@ class TileAdapter extends BaseAdapter {
17407
17433
  }
17408
17434
  }
17409
17435
  }
17410
- updateLayer() {
17436
+ updateLayer(options) {
17411
17437
  if (this.layer) {
17412
17438
  const currentUrl = this.layer._url;
17413
- const timestamp = (/* @__PURE__ */ new Date()).getTime();
17414
- const separator = currentUrl.includes("?") ? "&" : "?";
17415
- const newUrl = currentUrl.replace(/(\?|&)timestamp=\d*/g, "") + separator + `timestamp=${timestamp}`;
17416
- this.layer.setUrl(newUrl);
17439
+ if (options == null ? void 0 : options.params) {
17440
+ this.layer.setUrl(updateUrlParams(currentUrl, options.params));
17441
+ }
17417
17442
  this.layer.redraw();
17418
17443
  }
17419
17444
  }
17420
17445
  }
17421
17446
 
17422
- var __defProp$K = Object.defineProperty;
17423
- var __defProps$i = Object.defineProperties;
17424
- var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
17425
- var __getOwnPropSymbols$w = Object.getOwnPropertySymbols;
17426
- var __hasOwnProp$w = Object.prototype.hasOwnProperty;
17427
- var __propIsEnum$w = Object.prototype.propertyIsEnumerable;
17428
- var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17429
- var __spreadValues$v = (a, b) => {
17430
- for (var prop in b || (b = {}))
17431
- if (__hasOwnProp$w.call(b, prop))
17432
- __defNormalProp$K(a, prop, b[prop]);
17433
- if (__getOwnPropSymbols$w)
17434
- for (var prop of __getOwnPropSymbols$w(b)) {
17435
- if (__propIsEnum$w.call(b, prop))
17436
- __defNormalProp$K(a, prop, b[prop]);
17437
- }
17447
+ var __defProp$P = Object.defineProperty;
17448
+ var __defProps$k = Object.defineProperties;
17449
+ var __getOwnPropDescs$k = Object.getOwnPropertyDescriptors;
17450
+ var __getOwnPropSymbols$y = Object.getOwnPropertySymbols;
17451
+ var __hasOwnProp$y = Object.prototype.hasOwnProperty;
17452
+ var __propIsEnum$y = Object.prototype.propertyIsEnumerable;
17453
+ var __defNormalProp$P = (obj, key, value) => key in obj ? __defProp$P(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17454
+ var __spreadValues$x = (a, b) => {
17455
+ for (var prop in b || (b = {}))
17456
+ if (__hasOwnProp$y.call(b, prop))
17457
+ __defNormalProp$P(a, prop, b[prop]);
17458
+ if (__getOwnPropSymbols$y)
17459
+ for (var prop of __getOwnPropSymbols$y(b)) {
17460
+ if (__propIsEnum$y.call(b, prop))
17461
+ __defNormalProp$P(a, prop, b[prop]);
17462
+ }
17438
17463
  return a;
17439
17464
  };
17440
- var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
17465
+ var __spreadProps$k = (a, b) => __defProps$k(a, __getOwnPropDescs$k(b));
17441
17466
  class OsmAdapter extends TileAdapter {
17442
17467
  addLayer(options) {
17443
17468
  const url = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
17444
- return super.addLayer(__spreadProps$i(__spreadValues$v({
17469
+ return super.addLayer(__spreadProps$k(__spreadValues$x({
17445
17470
  name: "OpenStreetMap",
17446
17471
  attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
17447
17472
  }, options), {
@@ -17457,33 +17482,33 @@ class WmsLayerBase extends leafletSrcExports.TileLayer.WMS {
17457
17482
  }
17458
17483
  const WmsLayer = makeRemote(WmsLayerBase);
17459
17484
 
17460
- var __defProp$J = Object.defineProperty;
17461
- var __defProps$h = Object.defineProperties;
17462
- var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
17463
- var __getOwnPropSymbols$v = Object.getOwnPropertySymbols;
17464
- var __hasOwnProp$v = Object.prototype.hasOwnProperty;
17465
- var __propIsEnum$v = Object.prototype.propertyIsEnumerable;
17466
- var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17467
- var __spreadValues$u = (a, b) => {
17485
+ var __defProp$O = Object.defineProperty;
17486
+ var __defProps$j = Object.defineProperties;
17487
+ var __getOwnPropDescs$j = Object.getOwnPropertyDescriptors;
17488
+ var __getOwnPropSymbols$x = Object.getOwnPropertySymbols;
17489
+ var __hasOwnProp$x = Object.prototype.hasOwnProperty;
17490
+ var __propIsEnum$x = Object.prototype.propertyIsEnumerable;
17491
+ var __defNormalProp$O = (obj, key, value) => key in obj ? __defProp$O(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17492
+ var __spreadValues$w = (a, b) => {
17468
17493
  for (var prop in b || (b = {}))
17469
- if (__hasOwnProp$v.call(b, prop))
17470
- __defNormalProp$J(a, prop, b[prop]);
17471
- if (__getOwnPropSymbols$v)
17472
- for (var prop of __getOwnPropSymbols$v(b)) {
17473
- if (__propIsEnum$v.call(b, prop))
17474
- __defNormalProp$J(a, prop, b[prop]);
17494
+ if (__hasOwnProp$x.call(b, prop))
17495
+ __defNormalProp$O(a, prop, b[prop]);
17496
+ if (__getOwnPropSymbols$x)
17497
+ for (var prop of __getOwnPropSymbols$x(b)) {
17498
+ if (__propIsEnum$x.call(b, prop))
17499
+ __defNormalProp$O(a, prop, b[prop]);
17475
17500
  }
17476
17501
  return a;
17477
17502
  };
17478
- var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
17479
- var __objRest$3 = (source, exclude) => {
17503
+ var __spreadProps$j = (a, b) => __defProps$j(a, __getOwnPropDescs$j(b));
17504
+ var __objRest$6 = (source, exclude) => {
17480
17505
  var target = {};
17481
17506
  for (var prop in source)
17482
- if (__hasOwnProp$v.call(source, prop) && exclude.indexOf(prop) < 0)
17507
+ if (__hasOwnProp$x.call(source, prop) && exclude.indexOf(prop) < 0)
17483
17508
  target[prop] = source[prop];
17484
- if (source != null && __getOwnPropSymbols$v)
17485
- for (var prop of __getOwnPropSymbols$v(source)) {
17486
- if (exclude.indexOf(prop) < 0 && __propIsEnum$v.call(source, prop))
17509
+ if (source != null && __getOwnPropSymbols$x)
17510
+ for (var prop of __getOwnPropSymbols$x(source)) {
17511
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$x.call(source, prop))
17487
17512
  target[prop] = source[prop];
17488
17513
  }
17489
17514
  return target;
@@ -17491,9 +17516,9 @@ var __objRest$3 = (source, exclude) => {
17491
17516
  class WmsAdapter extends BaseAdapter {
17492
17517
  addLayer(options) {
17493
17518
  Object.assign(this.options, options);
17494
- const _a = options, { url } = _a, opt = __objRest$3(_a, ["url"]);
17519
+ const _a = options, { url } = _a, opt = __objRest$6(_a, ["url"]);
17495
17520
  if (url) {
17496
- const layerOptions = __spreadValues$u({
17521
+ const layerOptions = __spreadValues$w({
17497
17522
  pane: this.pane,
17498
17523
  attribution: opt.attribution,
17499
17524
  minZoom: opt.minZoom,
@@ -17504,7 +17529,7 @@ class WmsAdapter extends BaseAdapter {
17504
17529
  }, options.nativeOptions);
17505
17530
  let layer;
17506
17531
  if (opt.headers || opt.withCredentials) {
17507
- layer = new WmsLayer(url, __spreadProps$h(__spreadValues$u({}, layerOptions), {
17532
+ layer = new WmsLayer(url, __spreadProps$j(__spreadValues$w({}, layerOptions), {
17508
17533
  headers: opt.headers,
17509
17534
  withCredentials: opt.withCredentials
17510
17535
  }));
@@ -17524,33 +17549,33 @@ function arrayToBoundsExpression(bounds) {
17524
17549
  ];
17525
17550
  }
17526
17551
 
17527
- var __defProp$I = Object.defineProperty;
17528
- var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
17529
- var __hasOwnProp$u = Object.prototype.hasOwnProperty;
17530
- var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
17531
- var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17532
- var __spreadValues$t = (a, b) => {
17552
+ var __defProp$N = Object.defineProperty;
17553
+ var __getOwnPropSymbols$w = Object.getOwnPropertySymbols;
17554
+ var __hasOwnProp$w = Object.prototype.hasOwnProperty;
17555
+ var __propIsEnum$w = Object.prototype.propertyIsEnumerable;
17556
+ var __defNormalProp$N = (obj, key, value) => key in obj ? __defProp$N(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17557
+ var __spreadValues$v = (a, b) => {
17533
17558
  for (var prop in b || (b = {}))
17534
- if (__hasOwnProp$u.call(b, prop))
17535
- __defNormalProp$I(a, prop, b[prop]);
17536
- if (__getOwnPropSymbols$u)
17537
- for (var prop of __getOwnPropSymbols$u(b)) {
17538
- if (__propIsEnum$u.call(b, prop))
17539
- __defNormalProp$I(a, prop, b[prop]);
17559
+ if (__hasOwnProp$w.call(b, prop))
17560
+ __defNormalProp$N(a, prop, b[prop]);
17561
+ if (__getOwnPropSymbols$w)
17562
+ for (var prop of __getOwnPropSymbols$w(b)) {
17563
+ if (__propIsEnum$w.call(b, prop))
17564
+ __defNormalProp$N(a, prop, b[prop]);
17540
17565
  }
17541
17566
  return a;
17542
17567
  };
17543
- var __publicField$w = (obj, key, value) => __defNormalProp$I(obj, typeof key !== "symbol" ? key + "" : key, value);
17568
+ var __publicField$z = (obj, key, value) => __defNormalProp$N(obj, typeof key !== "symbol" ? key + "" : key, value);
17544
17569
  const _LeafletMapAdapter = class _LeafletMapAdapter {
17545
17570
  constructor() {
17546
- __publicField$w(this, "options", { target: "map" });
17547
- __publicField$w(this, "layerAdapters", _LeafletMapAdapter.layerAdapters);
17548
- __publicField$w(this, "controlAdapters", _LeafletMapAdapter.controlAdapters);
17549
- __publicField$w(this, "emitter", new EventEmitter());
17550
- __publicField$w(this, "map");
17551
- __publicField$w(this, "_resizeObserver");
17552
- __publicField$w(this, "_unselectCb", []);
17553
- __publicField$w(this, "_universalEvents", [
17571
+ __publicField$z(this, "options", { target: "map" });
17572
+ __publicField$z(this, "layerAdapters", _LeafletMapAdapter.layerAdapters);
17573
+ __publicField$z(this, "controlAdapters", _LeafletMapAdapter.controlAdapters);
17574
+ __publicField$z(this, "emitter", new EventEmitter());
17575
+ __publicField$z(this, "map");
17576
+ __publicField$z(this, "_resizeObserver");
17577
+ __publicField$z(this, "_unselectCb", []);
17578
+ __publicField$z(this, "_universalEvents", [
17554
17579
  "move",
17555
17580
  "zoom",
17556
17581
  "zoomend",
@@ -17558,14 +17583,14 @@ const _LeafletMapAdapter = class _LeafletMapAdapter {
17558
17583
  "moveend",
17559
17584
  "movestart"
17560
17585
  ]);
17561
- __publicField$w(this, "_positionEvents", [
17586
+ __publicField$z(this, "_positionEvents", [
17562
17587
  "mousemove",
17563
17588
  "mouseout",
17564
17589
  "mouseover"
17565
17590
  ]);
17566
17591
  }
17567
17592
  create(options) {
17568
- this.options = __spreadValues$t({}, options);
17593
+ this.options = __spreadValues$v({}, options);
17569
17594
  if (this.options.target) {
17570
17595
  const {
17571
17596
  zoom,
@@ -17575,7 +17600,7 @@ const _LeafletMapAdapter = class _LeafletMapAdapter {
17575
17600
  maxBounds: mb,
17576
17601
  mapAdapterOptions
17577
17602
  } = this.options;
17578
- this.map = this.options.map || new leafletSrcExports.Map(this.options.target, __spreadValues$t({
17603
+ this.map = this.options.map || new leafletSrcExports.Map(this.options.target, __spreadValues$v({
17579
17604
  attributionControl: false,
17580
17605
  zoomControl: false,
17581
17606
  maxBounds: mb ? arrayToBoundsExpression(mb) : void 0,
@@ -17858,7 +17883,7 @@ const _LeafletMapAdapter = class _LeafletMapAdapter {
17858
17883
  }
17859
17884
  }
17860
17885
  };
17861
- __publicField$w(_LeafletMapAdapter, "layerAdapters", {
17886
+ __publicField$z(_LeafletMapAdapter, "layerAdapters", {
17862
17887
  GEOJSON: GeoJsonAdapter,
17863
17888
  IMAGE: ImageAdapter,
17864
17889
  TILE: TileAdapter,
@@ -17866,11 +17891,11 @@ __publicField$w(_LeafletMapAdapter, "layerAdapters", {
17866
17891
  // // MVT: MvtAdapter,
17867
17892
  OSM: OsmAdapter
17868
17893
  });
17869
- __publicField$w(_LeafletMapAdapter, "controlAdapters", {
17894
+ __publicField$z(_LeafletMapAdapter, "controlAdapters", {
17870
17895
  ZOOM: leafletSrcExports.Control.Zoom,
17871
17896
  ATTRIBUTION: AttributionControl
17872
17897
  });
17873
- __publicField$w(_LeafletMapAdapter, "Map", leafletSrcExports.Map);
17898
+ __publicField$z(_LeafletMapAdapter, "Map", leafletSrcExports.Map);
17874
17899
  let LeafletMapAdapter = _LeafletMapAdapter;
17875
17900
 
17876
17901
  const svgPath = {
@@ -17945,12 +17970,12 @@ function getIcon(opt = {}) {
17945
17970
  };
17946
17971
  }
17947
17972
 
17948
- var __defProp$H = Object.defineProperty;
17949
- var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17950
- var __publicField$v = (obj, key, value) => __defNormalProp$H(obj, typeof key !== "symbol" ? key + "" : key, value);
17973
+ var __defProp$M = Object.defineProperty;
17974
+ var __defNormalProp$M = (obj, key, value) => key in obj ? __defProp$M(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
17975
+ var __publicField$y = (obj, key, value) => __defNormalProp$M(obj, typeof key !== "symbol" ? key + "" : key, value);
17951
17976
  const _Cache = class _Cache {
17952
17977
  constructor(options = {}) {
17953
- __publicField$v(this, "cache", []);
17978
+ __publicField$y(this, "cache", []);
17954
17979
  var _a;
17955
17980
  const namespace = (_a = options.namespace) != null ? _a : "default";
17956
17981
  if (_Cache.instance[namespace]) {
@@ -18056,12 +18081,12 @@ const _Cache = class _Cache {
18056
18081
  return objectDeepEqual(itemProps || {}, objectRemoveEmpty(props));
18057
18082
  }
18058
18083
  };
18059
- __publicField$v(_Cache, "instance", {});
18084
+ __publicField$y(_Cache, "instance", {});
18060
18085
  let Cache = _Cache;
18061
18086
 
18062
18087
  var pkg = {
18063
18088
  name: "@nextgis/ngw-connector",
18064
- version: "3.0.0-alpha.3",
18089
+ version: "3.0.0-alpha.5",
18065
18090
  _priority: 12,
18066
18091
  description: "A lightweight HTTP client optimized for use with NextGIS Web API",
18067
18092
  main: "index.js",
@@ -18070,15 +18095,15 @@ var pkg = {
18070
18095
  jsdelivr: "lib/ngw-connector.global.prod.js",
18071
18096
  types: "lib/index.d.ts",
18072
18097
  dependencies: {
18073
- "@nextgis/cache": "^3.0.0-alpha.3",
18074
- "@nextgis/cancelable-promise": "^3.0.0-alpha.3",
18075
- "@nextgis/utils": "^3.0.0-alpha.3",
18098
+ "@nextgis/cache": "^3.0.0-alpha.5",
18099
+ "@nextgis/cancelable-promise": "^3.0.0-alpha.5",
18100
+ "@nextgis/utils": "^3.0.0-alpha.5",
18076
18101
  "@types/events": "^3.0.0",
18077
18102
  events: "*",
18078
18103
  "form-data": "^4.0.0"
18079
18104
  },
18080
18105
  devDependencies: {
18081
- "@nextgis/build-tools": "^3.0.0-alpha.3"
18106
+ "@nextgis/build-tools": "^3.0.0-alpha.5"
18082
18107
  },
18083
18108
  scripts: {
18084
18109
  clean: "rimraf ./lib",
@@ -18112,87 +18137,179 @@ var pkg = {
18112
18137
  type: "git",
18113
18138
  url: "git://github.com/nextgis/nextgis_frontend.git"
18114
18139
  },
18140
+ engines: {
18141
+ node: ">=18.20.4"
18142
+ },
18115
18143
  gitHead: "edc68033f914f6c95c4125b9738bba6d36e990b4"
18116
18144
  };
18117
18145
 
18118
- var __defProp$G = Object.defineProperty;
18119
- var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18120
- var __publicField$u = (obj, key, value) => __defNormalProp$G(obj, typeof key !== "symbol" ? key + "" : key, value);
18146
+ const CONNECTORS = [];
18147
+ function addConnector(connector) {
18148
+ CONNECTORS.push(connector);
18149
+ }
18150
+ function findConnector(options) {
18151
+ return CONNECTORS.find((x) => {
18152
+ if (x.options.baseUrl === options.baseUrl) {
18153
+ if (options.auth) {
18154
+ if (x.options.auth) {
18155
+ return objectDeepEqual(x.options.auth, options.auth);
18156
+ }
18157
+ } else {
18158
+ return true;
18159
+ }
18160
+ }
18161
+ });
18162
+ }
18163
+ function removeConnector(connector) {
18164
+ const index = CONNECTORS.indexOf(connector);
18165
+ if (index !== -1) {
18166
+ CONNECTORS.splice(index, 1);
18167
+ }
18168
+ }
18169
+
18170
+ class AbortError extends Error {
18171
+ constructor(message = "AbortError") {
18172
+ super(message);
18173
+ this.name = "AbortError";
18174
+ }
18175
+ }
18176
+
18177
+ var __defProp$L = Object.defineProperty;
18178
+ var __defNormalProp$L = (obj, key, value) => key in obj ? __defProp$L(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18179
+ var __publicField$x = (obj, key, value) => __defNormalProp$L(obj, typeof key !== "symbol" ? key + "" : key, value);
18121
18180
  class NgwError extends Error {
18122
18181
  constructor(er) {
18123
18182
  super();
18124
- __publicField$u(this, "name", "NgwError");
18125
- __publicField$u(this, "title");
18126
- __publicField$u(this, "message");
18127
- __publicField$u(this, "detail");
18128
- __publicField$u(this, "exception");
18129
- __publicField$u(this, "status_code");
18130
- __publicField$u(this, "data");
18131
- __publicField$u(this, "guru_meditation");
18183
+ __publicField$x(this, "name", "NgwError");
18184
+ __publicField$x(this, "title");
18185
+ __publicField$x(this, "message");
18186
+ __publicField$x(this, "detail");
18187
+ __publicField$x(this, "exception");
18188
+ __publicField$x(this, "status_code");
18189
+ __publicField$x(this, "data");
18190
+ __publicField$x(this, "guru_meditation");
18132
18191
  Object.assign(this, er);
18133
18192
  Object.setPrototypeOf(this, NgwError.prototype);
18134
18193
  }
18135
18194
  }
18136
18195
 
18137
- var __defProp$F = Object.defineProperty;
18138
- var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18139
- var __publicField$t = (obj, key, value) => __defNormalProp$F(obj, typeof key !== "symbol" ? key + "" : key, value);
18196
+ var __defProp$K = Object.defineProperty;
18197
+ var __defNormalProp$K = (obj, key, value) => key in obj ? __defProp$K(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18198
+ var __publicField$w = (obj, key, value) => __defNormalProp$K(obj, typeof key !== "symbol" ? key + "" : key, value);
18199
+ class InsufficientPermissionsError extends NgwError {
18200
+ constructor(obj) {
18201
+ super(obj);
18202
+ __publicField$w(this, "name", "InsufficientPermissionsError");
18203
+ __publicField$w(this, "exception", "nextgisweb.core.exception.InsufficientPermissions");
18204
+ Object.setPrototypeOf(this, InsufficientPermissionsError.prototype);
18205
+ }
18206
+ }
18207
+
18208
+ var __defProp$J = Object.defineProperty;
18209
+ var __defNormalProp$J = (obj, key, value) => key in obj ? __defProp$J(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18210
+ var __publicField$v = (obj, key, value) => __defNormalProp$J(obj, typeof key !== "symbol" ? key + "" : key, value);
18140
18211
  class ResourceNotFoundError extends NgwError {
18141
18212
  constructor(obj) {
18142
18213
  super(obj);
18143
- __publicField$t(this, "name", "ResourceNotFoundError");
18144
- __publicField$t(this, "exception", "nextgisweb.resource.exception.ResourceNotFound");
18214
+ __publicField$v(this, "name", "ResourceNotFoundError");
18215
+ __publicField$v(this, "exception", "nextgisweb.resource.exception.ResourceNotFound");
18145
18216
  Object.setPrototypeOf(this, ResourceNotFoundError.prototype);
18146
18217
  }
18147
18218
  }
18148
18219
 
18149
- function isObject(val) {
18150
- return Object.prototype.toString.call(val) === "[object Object]";
18220
+ var __defProp$I = Object.defineProperty;
18221
+ var __defNormalProp$I = (obj, key, value) => key in obj ? __defProp$I(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18222
+ var __publicField$u = (obj, key, value) => __defNormalProp$I(obj, typeof key !== "symbol" ? key + "" : key, value);
18223
+ class BaseAPIError extends Error {
18224
+ constructor(message) {
18225
+ super(message || "Something went wrong.");
18226
+ __publicField$u(this, "title");
18227
+ this.name = "BaseAPIError";
18228
+ this.title = "Unknown API error";
18229
+ if (Error.captureStackTrace) {
18230
+ Error.captureStackTrace(this, BaseAPIError);
18231
+ }
18232
+ }
18151
18233
  }
18152
-
18153
- function resourceCompare(res1, res2) {
18154
- return objectDeepEqual(res1, res2);
18234
+ class NetworksResponseError extends BaseAPIError {
18235
+ // prettier-ignore
18236
+ constructor(message) {
18237
+ super(message || "There is no response from the server or problem connecting to server.");
18238
+ __publicField$u(this, "detail");
18239
+ this.title = "Network error";
18240
+ this.detail = "Check network connectivity and try again later.";
18241
+ }
18155
18242
  }
18156
-
18157
- const exclude = ["description"];
18158
- function resourceToQuery(resource, prefix = "") {
18159
- prefix = prefix ? prefix + "__" : "";
18160
- const query = {};
18161
- for (const [key, value] of Object.entries(resource)) {
18162
- if (exclude.indexOf(key) === -1) {
18163
- if (isObject(value)) {
18164
- if (key === "owner_user") {
18165
- const children = resourceToQuery(value, key);
18166
- Object.assign(query, children);
18167
- } else if (key === "parent" && "id" in value) {
18168
- query.parent_id = value.id;
18169
- }
18170
- } else if (defined(value)) {
18171
- query[prefix + key] = value;
18172
- }
18243
+ class InvalidResponseError extends BaseAPIError {
18244
+ constructor(message) {
18245
+ super(message || "Something went wrong.");
18246
+ this.title = "Unexpected server response";
18247
+ }
18248
+ }
18249
+ class ServerResponseError extends BaseAPIError {
18250
+ constructor(data) {
18251
+ super(data.message);
18252
+ __publicField$u(this, "detail");
18253
+ __publicField$u(this, "data");
18254
+ this.title = data.title || this.title;
18255
+ this.detail = data.detail || null;
18256
+ this.data = data;
18257
+ }
18258
+ }
18259
+ class LunkwillError extends Error {
18260
+ // prettier-ignore
18261
+ constructor(message, data = {}) {
18262
+ super(message || "Unexpected error while processing long-running request.");
18263
+ __publicField$u(this, "title");
18264
+ __publicField$u(this, "data");
18265
+ this.name = "LunkwillError";
18266
+ this.title = "Long-running request error";
18267
+ this.data = data;
18268
+ if (Error.captureStackTrace) {
18269
+ Error.captureStackTrace(this, LunkwillError);
18173
18270
  }
18174
18271
  }
18175
- return query;
18272
+ }
18273
+ class LunkwillRequestCancelled extends LunkwillError {
18274
+ constructor(data) {
18275
+ super("Long-running request was cancelled.", data);
18276
+ }
18277
+ }
18278
+ class LunkwillRequestFailed extends LunkwillError {
18279
+ constructor(data) {
18280
+ super(void 0, data);
18281
+ }
18176
18282
  }
18177
18283
 
18178
- var __defProp$E = Object.defineProperty;
18179
- var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
18180
- var __hasOwnProp$t = Object.prototype.hasOwnProperty;
18181
- var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
18182
- var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18183
- var __spreadValues$s = (a, b) => {
18284
+ var __defProp$H = Object.defineProperty;
18285
+ var __getOwnPropSymbols$v = Object.getOwnPropertySymbols;
18286
+ var __hasOwnProp$v = Object.prototype.hasOwnProperty;
18287
+ var __propIsEnum$v = Object.prototype.propertyIsEnumerable;
18288
+ var __defNormalProp$H = (obj, key, value) => key in obj ? __defProp$H(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18289
+ var __spreadValues$u = (a, b) => {
18184
18290
  for (var prop in b || (b = {}))
18185
- if (__hasOwnProp$t.call(b, prop))
18186
- __defNormalProp$E(a, prop, b[prop]);
18187
- if (__getOwnPropSymbols$t)
18188
- for (var prop of __getOwnPropSymbols$t(b)) {
18189
- if (__propIsEnum$t.call(b, prop))
18190
- __defNormalProp$E(a, prop, b[prop]);
18291
+ if (__hasOwnProp$v.call(b, prop))
18292
+ __defNormalProp$H(a, prop, b[prop]);
18293
+ if (__getOwnPropSymbols$v)
18294
+ for (var prop of __getOwnPropSymbols$v(b)) {
18295
+ if (__propIsEnum$v.call(b, prop))
18296
+ __defNormalProp$H(a, prop, b[prop]);
18191
18297
  }
18192
18298
  return a;
18193
18299
  };
18194
- var __publicField$s = (obj, key, value) => __defNormalProp$E(obj, typeof key !== "symbol" ? key + "" : key, value);
18195
- var __async$r = (__this, __arguments, generator) => {
18300
+ var __objRest$5 = (source, exclude) => {
18301
+ var target = {};
18302
+ for (var prop in source)
18303
+ if (__hasOwnProp$v.call(source, prop) && exclude.indexOf(prop) < 0)
18304
+ target[prop] = source[prop];
18305
+ if (source != null && __getOwnPropSymbols$v)
18306
+ for (var prop of __getOwnPropSymbols$v(source)) {
18307
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$v.call(source, prop))
18308
+ target[prop] = source[prop];
18309
+ }
18310
+ return target;
18311
+ };
18312
+ var __async$t = (__this, __arguments, generator) => {
18196
18313
  return new Promise((resolve, reject) => {
18197
18314
  var fulfilled = (value) => {
18198
18315
  try {
@@ -18212,51 +18329,904 @@ var __async$r = (__this, __arguments, generator) => {
18212
18329
  step((generator = generator.apply(__this, __arguments)).next());
18213
18330
  });
18214
18331
  };
18215
- class ResourcesControl {
18216
- constructor({
18217
- connector,
18218
- cacheId
18219
- }) {
18220
- __publicField$s(this, "cache");
18221
- __publicField$s(this, "connector");
18222
- this.connector = connector;
18223
- this.cache = new Cache({ namespace: cacheId });
18224
- }
18225
- // -------------------------------------------------------------------------
18226
- // Resource Methods
18227
- // -------------------------------------------------------------------------
18228
- /**
18229
- * Receive resource from NGW by id, keyname or search-object parameter.
18230
- * @param resource - Resource id, keyname or search-object
18231
- *
18232
- * @remarks
18233
- * Fetching resource would be cached to speed up next call
18234
- */
18235
- getOne(resource, requestOptions) {
18236
- const opt = __spreadValues$s({}, requestOptions);
18237
- if (typeof resource === "string") ; else if (typeof resource === "number") ; else if (isObject(resource)) {
18238
- if (resource.id !== void 0) {
18239
- resource.id;
18240
- } else {
18241
- if (resource.keyname) {
18242
- resource.keyname;
18243
- }
18244
- if (resource.display_name) {
18245
- resource.display_name;
18246
- }
18332
+ function lunkwillCheckResponse(lwResp) {
18333
+ const ct = lwResp.headers.get("content-type");
18334
+ return ct !== void 0 && ct !== null && ct.includes("application/vnd.lunkwill.request-summary+json");
18335
+ }
18336
+ function responseJson(response) {
18337
+ return __async$t(this, null, function* () {
18338
+ try {
18339
+ return response.json();
18340
+ } catch (e) {
18341
+ throw new Error();
18342
+ }
18343
+ });
18344
+ }
18345
+ function lunkwillResponseUrl(lwResp) {
18346
+ return __async$t(this, null, function* () {
18347
+ const lwData = yield responseJson(lwResp);
18348
+ let delay = lwData.delay_ms;
18349
+ const retry = lwData.retry_ms !== void 0 ? lwData.retry_ms : 2e3;
18350
+ const sum = `/api/lunkwill/${lwData.id}/summary`;
18351
+ const res = `/api/lunkwill/${lwData.id}/response`;
18352
+ const sleep = (msec) => new Promise((resolve) => setTimeout(resolve, msec));
18353
+ let failed = false;
18354
+ let ready = false;
18355
+ while (!ready) {
18356
+ yield sleep(failed ? retry : delay);
18357
+ failed = false;
18358
+ let lwResp2;
18359
+ let lwData2;
18360
+ try {
18361
+ lwResp2 = yield fetch(sum, { credentials: "same-origin" });
18362
+ lwData2 = yield lwResp2.json();
18363
+ } catch (e) {
18364
+ failed = true;
18365
+ continue;
18366
+ }
18367
+ switch (lwData2.status) {
18368
+ case void 0:
18369
+ throw new LunkwillError(void 0, lwData2);
18370
+ case "ready":
18371
+ ready = true;
18372
+ break;
18373
+ case "cancelled":
18374
+ throw new LunkwillRequestCancelled(lwData2);
18375
+ case "failed":
18376
+ throw new LunkwillRequestFailed(lwData2);
18377
+ case "spooled":
18378
+ case "processing":
18379
+ case "buffering":
18380
+ delay = lwData2.delay_ms;
18381
+ break;
18382
+ default:
18383
+ throw new LunkwillError(void 0, lwData2);
18247
18384
  }
18248
18385
  }
18249
- if (typeof resource === "string") {
18250
- return this._fetchResourceBy({ keyname: resource }, opt);
18251
- } else if (typeof resource === "number") {
18252
- return this._fetchResourceById(resource, opt);
18253
- } else if (isObject(resource)) {
18254
- return this._fetchResourceBy(resource, opt);
18386
+ return res;
18387
+ });
18388
+ }
18389
+ function lunkwillFetch(lwRespUrl) {
18390
+ return __async$t(this, null, function* () {
18391
+ try {
18392
+ return yield window.fetch(lwRespUrl, { credentials: "same-origin" });
18393
+ } catch (e) {
18394
+ throw new NetworksResponseError();
18255
18395
  }
18256
- return Promise.resolve(void 0);
18257
- }
18258
- getOneOrFail(resource, requestOptions) {
18259
- return this.getOne(resource, requestOptions).then((res) => {
18396
+ });
18397
+ }
18398
+ const mediaContentTypes = [
18399
+ "application/pdf",
18400
+ "image/png",
18401
+ "image/jpeg",
18402
+ "image/tiff",
18403
+ "text/csv"
18404
+ ];
18405
+ const mediaContentTypesRegex = new RegExp(mediaContentTypes.join("|"));
18406
+ function isMediaContentType(contentType) {
18407
+ return mediaContentTypesRegex.test(contentType);
18408
+ }
18409
+ function encodeQueryParams(value) {
18410
+ const result = [];
18411
+ for (const [k, v] of Object.entries(value)) {
18412
+ if (typeof v === "string" || typeof v === "number" || typeof v === "boolean") {
18413
+ result.push(`${k}=${encodeURIComponent(v)}`);
18414
+ } else if (Array.isArray(v)) {
18415
+ result.push(`${k}=${v.map(encodeURIComponent).join(",")}`);
18416
+ } else {
18417
+ for (const [sk, sv] of Object.entries(v)) {
18418
+ const ske = `${k}[${encodeURIComponent(sk)}]`;
18419
+ if (typeof sv === "string" || typeof sv === "number" || typeof sv === "boolean") {
18420
+ result.push(`${ske}=${encodeURIComponent(sv)}`);
18421
+ } else if (Array.isArray(sv)) {
18422
+ const sve = sv.map(encodeURIComponent);
18423
+ result.push(`${ske}=${sve.join(",")}`);
18424
+ }
18425
+ }
18426
+ }
18427
+ }
18428
+ return result.join("&");
18429
+ }
18430
+ function generateUrl(path, query) {
18431
+ let urlParams = "";
18432
+ if (query !== void 0) {
18433
+ urlParams = "?" + encodeQueryParams(query);
18434
+ }
18435
+ return path + urlParams;
18436
+ }
18437
+ function request(path, options, cacheEngine) {
18438
+ return __async$t(this, null, function* () {
18439
+ var _b;
18440
+ const defaults = {
18441
+ method: "GET",
18442
+ credentials: "same-origin",
18443
+ headers: {}
18444
+ };
18445
+ const _a = __spreadValues$u(__spreadValues$u({}, defaults), options), {
18446
+ withCredentials,
18447
+ responseType,
18448
+ cacheProps,
18449
+ cacheName,
18450
+ lunkwill,
18451
+ cache,
18452
+ query,
18453
+ json
18454
+ } = _a, opt = __objRest$5(_a, [
18455
+ "withCredentials",
18456
+ "responseType",
18457
+ "cacheProps",
18458
+ "cacheName",
18459
+ "lunkwill",
18460
+ "cache",
18461
+ "query",
18462
+ "json"
18463
+ ]);
18464
+ if (withCredentials) {
18465
+ opt.credentials = "include";
18466
+ }
18467
+ let useLunkwill = false;
18468
+ if (lunkwill !== void 0) {
18469
+ lunkwill.toHeaders(opt.headers || {});
18470
+ useLunkwill = true;
18471
+ }
18472
+ const lunkwillReturnUrl = !!opt.lunkwillReturnUrl;
18473
+ delete opt.lunkwillReturnUrl;
18474
+ if (json !== void 0) {
18475
+ opt.body = JSON.stringify(json);
18476
+ const headers = opt.headers || {};
18477
+ headers["Content-Type"] = "application/json";
18478
+ opt.headers = headers;
18479
+ }
18480
+ const url = generateUrl(path, query);
18481
+ const makeRequest = () => __async$t(this, null, function* () {
18482
+ let response;
18483
+ try {
18484
+ response = yield fetch(url, opt);
18485
+ } catch (e) {
18486
+ if (e.name === "AbortError") {
18487
+ throw e;
18488
+ }
18489
+ throw new NetworksResponseError();
18490
+ }
18491
+ if (useLunkwill && lunkwillCheckResponse(response)) {
18492
+ const lwRespUrl = yield lunkwillResponseUrl(response);
18493
+ if (lunkwillReturnUrl) {
18494
+ return lwRespUrl;
18495
+ }
18496
+ response = yield lunkwillFetch(lwRespUrl);
18497
+ }
18498
+ const respCType = response.headers.get("content-type");
18499
+ const respJSON = respCType && (respCType.includes("application/json") || respCType.includes("application/vnd.lunkwill.request-summary+json"));
18500
+ let body;
18501
+ try {
18502
+ const respMedia = respCType && isMediaContentType(respCType);
18503
+ if (responseType === "blob" || respMedia) {
18504
+ body = yield response.blob();
18505
+ } else if (respJSON) {
18506
+ body = yield response.json();
18507
+ } else {
18508
+ throw new InvalidResponseError();
18509
+ }
18510
+ } catch (e) {
18511
+ if (e.name === "AbortError" || e instanceof InvalidResponseError) {
18512
+ throw e;
18513
+ }
18514
+ throw new InvalidResponseError();
18515
+ }
18516
+ if (400 <= response.status && response.status <= 599) {
18517
+ throw new ServerResponseError(body);
18518
+ }
18519
+ return body;
18520
+ });
18521
+ if (cacheEngine && cache && ((_b = opt.method) == null ? void 0 : _b.toUpperCase()) === "GET") {
18522
+ const cacheOptions = cacheProps ? cacheProps : __spreadValues$u({}, objectRemoveEmpty({
18523
+ withCredentials,
18524
+ responseType
18525
+ }));
18526
+ return cacheEngine.add(cacheName || url, makeRequest, cacheOptions, false);
18527
+ }
18528
+ return makeRequest();
18529
+ });
18530
+ }
18531
+
18532
+ var __defProp$G = Object.defineProperty;
18533
+ var __defProps$i = Object.defineProperties;
18534
+ var __getOwnPropDescs$i = Object.getOwnPropertyDescriptors;
18535
+ var __getOwnPropSymbols$u = Object.getOwnPropertySymbols;
18536
+ var __hasOwnProp$u = Object.prototype.hasOwnProperty;
18537
+ var __propIsEnum$u = Object.prototype.propertyIsEnumerable;
18538
+ var __defNormalProp$G = (obj, key, value) => key in obj ? __defProp$G(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18539
+ var __spreadValues$t = (a, b) => {
18540
+ for (var prop in b || (b = {}))
18541
+ if (__hasOwnProp$u.call(b, prop))
18542
+ __defNormalProp$G(a, prop, b[prop]);
18543
+ if (__getOwnPropSymbols$u)
18544
+ for (var prop of __getOwnPropSymbols$u(b)) {
18545
+ if (__propIsEnum$u.call(b, prop))
18546
+ __defNormalProp$G(a, prop, b[prop]);
18547
+ }
18548
+ return a;
18549
+ };
18550
+ var __spreadProps$i = (a, b) => __defProps$i(a, __getOwnPropDescs$i(b));
18551
+ var __objRest$4 = (source, exclude) => {
18552
+ var target = {};
18553
+ for (var prop in source)
18554
+ if (__hasOwnProp$u.call(source, prop) && exclude.indexOf(prop) < 0)
18555
+ target[prop] = source[prop];
18556
+ if (source != null && __getOwnPropSymbols$u)
18557
+ for (var prop of __getOwnPropSymbols$u(source)) {
18558
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$u.call(source, prop))
18559
+ target[prop] = source[prop];
18560
+ }
18561
+ return target;
18562
+ };
18563
+ var __async$s = (__this, __arguments, generator) => {
18564
+ return new Promise((resolve, reject) => {
18565
+ var fulfilled = (value) => {
18566
+ try {
18567
+ step(generator.next(value));
18568
+ } catch (e) {
18569
+ reject(e);
18570
+ }
18571
+ };
18572
+ var rejected = (value) => {
18573
+ try {
18574
+ step(generator.throw(value));
18575
+ } catch (e) {
18576
+ reject(e);
18577
+ }
18578
+ };
18579
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18580
+ step((generator = generator.apply(__this, __arguments)).next());
18581
+ });
18582
+ };
18583
+ function routeURL(name, baseUrl, routeData, ...rest) {
18584
+ const [template, ...params] = routeData[name];
18585
+ const first = rest[0];
18586
+ let sub;
18587
+ if (first === void 0) {
18588
+ sub = [];
18589
+ } else if (typeof first === "object" && first !== null) {
18590
+ if (rest.length > 1) {
18591
+ throw new Error("Too many arguments for route(name, object)!");
18592
+ }
18593
+ sub = [];
18594
+ for (const [p, v] of Object.entries(first)) {
18595
+ sub[params.indexOf(p)] = String(v);
18596
+ }
18597
+ } else {
18598
+ sub = rest.map((v) => String(v));
18599
+ }
18600
+ return fixUrlStr(
18601
+ baseUrl + template.replace(/\{(\w+)\}/g, function(m, a) {
18602
+ const idx = parseInt(a);
18603
+ const value = sub[idx];
18604
+ if (value === void 0) {
18605
+ const msg = `Undefined parameter ${idx} in "${template}".`;
18606
+ throw new Error(msg);
18607
+ }
18608
+ return String(value);
18609
+ })
18610
+ );
18611
+ }
18612
+ function route(name, connector, ...rest) {
18613
+ const result = {
18614
+ url: (opt) => __async$s(this, null, function* () {
18615
+ var _a;
18616
+ const routeData = yield connector.connect();
18617
+ const template = routeURL(
18618
+ name,
18619
+ (_a = connector.options.baseUrl) != null ? _a : "",
18620
+ routeData,
18621
+ ...rest
18622
+ );
18623
+ return generateUrl(template, opt == null ? void 0 : opt.query);
18624
+ })
18625
+ };
18626
+ const methods = ["get", "post", "put", "delete", "patch"];
18627
+ for (const method of methods) {
18628
+ const methodResp = (requestOptions) => __async$s(this, null, function* () {
18629
+ var _b;
18630
+ const _a = requestOptions || {}, { headers: optHeaders } = _a, restOpt = __objRest$4(_a, ["headers"]);
18631
+ const routeData = yield connector.connect();
18632
+ const template = routeURL(
18633
+ name,
18634
+ (_b = connector.options.baseUrl) != null ? _b : "",
18635
+ routeData,
18636
+ ...rest
18637
+ );
18638
+ const headers = objectRemoveEmpty(__spreadValues$t(__spreadValues$t({}, connector.getAuthorizationHeaders()), optHeaders != null ? optHeaders : {}));
18639
+ return request(
18640
+ template,
18641
+ __spreadProps$i(__spreadValues$t({
18642
+ headers
18643
+ }, restOpt), {
18644
+ method
18645
+ }),
18646
+ connector.cache
18647
+ );
18648
+ });
18649
+ result[method] = methodResp;
18650
+ }
18651
+ return result;
18652
+ }
18653
+
18654
+ var __defProp$F = Object.defineProperty;
18655
+ var __defNormalProp$F = (obj, key, value) => key in obj ? __defProp$F(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18656
+ var __publicField$t = (obj, key, value) => __defNormalProp$F(obj, key + "" , value);
18657
+ class NetworkError extends Error {
18658
+ constructor(url) {
18659
+ super();
18660
+ __publicField$t(this, "name", "NetworkError");
18661
+ Object.setPrototypeOf(this, NetworkError.prototype);
18662
+ this.message = `Unable to request ${url}.
18663
+ Possibly invalid NGW URL entered or CORS not configured to get request from ${location.origin}`;
18664
+ }
18665
+ }
18666
+
18667
+ function isObject(val) {
18668
+ return Object.prototype.toString.call(val) === "[object Object]";
18669
+ }
18670
+
18671
+ let loadData;
18672
+ {
18673
+ loadData = (url, callback, options = {}, error, onCancel) => {
18674
+ options.method = options.method || "GET";
18675
+ const xhr = new XMLHttpRequest();
18676
+ xhr.open(options.method || "GET", url, true);
18677
+ if (options.responseType === "blob") {
18678
+ xhr.responseType = options.responseType;
18679
+ }
18680
+ const getResponseText = () => {
18681
+ try {
18682
+ return JSON.parse(xhr.responseText);
18683
+ } catch (er) {
18684
+ return xhr.responseText;
18685
+ }
18686
+ };
18687
+ const processingResponse = (forError = false) => {
18688
+ const cb = forError ? error : callback;
18689
+ if (options.responseType === "blob") {
18690
+ cb(xhr.response);
18691
+ } else {
18692
+ if (xhr.responseText) {
18693
+ cb(getResponseText());
18694
+ } else {
18695
+ error({ message: "" });
18696
+ }
18697
+ }
18698
+ };
18699
+ xhr.onload = () => {
18700
+ if ([401, 403, 404, 422, 500].indexOf(xhr.status) !== -1) {
18701
+ error(new NgwError(getResponseText()));
18702
+ }
18703
+ processingResponse();
18704
+ };
18705
+ xhr.onerror = (er) => {
18706
+ if (xhr.status === 0) {
18707
+ error(new NetworkError(url));
18708
+ } else {
18709
+ error(er);
18710
+ }
18711
+ };
18712
+ xhr.upload.onprogress = function(e) {
18713
+ if (e.lengthComputable) {
18714
+ const percentComplete = e.loaded / e.total * 100;
18715
+ if (options.onProgress) {
18716
+ options.onProgress(percentComplete, e);
18717
+ }
18718
+ }
18719
+ };
18720
+ const headers = options.headers;
18721
+ if (headers) {
18722
+ for (const h in headers) {
18723
+ const header = headers[h];
18724
+ if (typeof header === "string") {
18725
+ xhr.setRequestHeader(h, header);
18726
+ }
18727
+ }
18728
+ }
18729
+ if (options.withCredentials !== void 0) {
18730
+ xhr.withCredentials = options.withCredentials;
18731
+ }
18732
+ let data;
18733
+ if (options.file) {
18734
+ data = new FormData();
18735
+ data.append("file", options.file);
18736
+ if (options.data) {
18737
+ for (const d in options.data) {
18738
+ data.append(d, data[d]);
18739
+ }
18740
+ }
18741
+ } else {
18742
+ data = options.data ? typeof options.data === "string" ? options.data : JSON.stringify(options.data) : null;
18743
+ }
18744
+ if (onCancel) {
18745
+ onCancel(() => {
18746
+ xhr.abort();
18747
+ });
18748
+ }
18749
+ xhr.send(data);
18750
+ };
18751
+ }
18752
+
18753
+ const templateRe = /\{ *([\w_-]+) *\}/g;
18754
+ function template(str, data) {
18755
+ return str.replace(templateRe, (s, key) => {
18756
+ let value = data[key];
18757
+ if (value === void 0) {
18758
+ throw new Error("No value provided for letiable " + s);
18759
+ } else if (typeof value === "function") {
18760
+ value = value(data);
18761
+ }
18762
+ return value;
18763
+ });
18764
+ }
18765
+
18766
+ var __defProp$E = Object.defineProperty;
18767
+ var __defProps$h = Object.defineProperties;
18768
+ var __getOwnPropDescs$h = Object.getOwnPropertyDescriptors;
18769
+ var __getOwnPropSymbols$t = Object.getOwnPropertySymbols;
18770
+ var __hasOwnProp$t = Object.prototype.hasOwnProperty;
18771
+ var __propIsEnum$t = Object.prototype.propertyIsEnumerable;
18772
+ var __defNormalProp$E = (obj, key, value) => key in obj ? __defProp$E(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18773
+ var __spreadValues$s = (a, b) => {
18774
+ for (var prop in b || (b = {}))
18775
+ if (__hasOwnProp$t.call(b, prop))
18776
+ __defNormalProp$E(a, prop, b[prop]);
18777
+ if (__getOwnPropSymbols$t)
18778
+ for (var prop of __getOwnPropSymbols$t(b)) {
18779
+ if (__propIsEnum$t.call(b, prop))
18780
+ __defNormalProp$E(a, prop, b[prop]);
18781
+ }
18782
+ return a;
18783
+ };
18784
+ var __spreadProps$h = (a, b) => __defProps$h(a, __getOwnPropDescs$h(b));
18785
+ var __objRest$3 = (source, exclude) => {
18786
+ var target = {};
18787
+ for (var prop in source)
18788
+ if (__hasOwnProp$t.call(source, prop) && exclude.indexOf(prop) < 0)
18789
+ target[prop] = source[prop];
18790
+ if (source != null && __getOwnPropSymbols$t)
18791
+ for (var prop of __getOwnPropSymbols$t(source)) {
18792
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$t.call(source, prop))
18793
+ target[prop] = source[prop];
18794
+ }
18795
+ return target;
18796
+ };
18797
+ var __publicField$s = (obj, key, value) => __defNormalProp$E(obj, typeof key !== "symbol" ? key + "" : key, value);
18798
+ var __async$r = (__this, __arguments, generator) => {
18799
+ return new Promise((resolve, reject) => {
18800
+ var fulfilled = (value) => {
18801
+ try {
18802
+ step(generator.next(value));
18803
+ } catch (e) {
18804
+ reject(e);
18805
+ }
18806
+ };
18807
+ var rejected = (value) => {
18808
+ try {
18809
+ step(generator.throw(value));
18810
+ } catch (e) {
18811
+ reject(e);
18812
+ }
18813
+ };
18814
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18815
+ step((generator = generator.apply(__this, __arguments)).next());
18816
+ });
18817
+ };
18818
+ let ID$2 = 0;
18819
+ let REQUEST_ID = 0;
18820
+ class NgwConnector {
18821
+ constructor(options) {
18822
+ this.options = options;
18823
+ __publicField$s(this, "id", ID$2++);
18824
+ __publicField$s(this, "emitter", new EventEmitter());
18825
+ __publicField$s(this, "user");
18826
+ __publicField$s(this, "cache");
18827
+ __publicField$s(this, "withCredentials");
18828
+ __publicField$s(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
18829
+ __publicField$s(this, "routeStr", "/api/component/pyramid/route");
18830
+ __publicField$s(this, "activeRequests", {});
18831
+ __publicField$s(this, "requestTransform");
18832
+ const exist = findConnector(options);
18833
+ this.cache = new Cache({ namespace: options.cacheId });
18834
+ if (exist) {
18835
+ return exist;
18836
+ } else {
18837
+ const { route: route2, requestTransform, withCredentials } = this.options;
18838
+ if (route2) {
18839
+ this.routeStr = route2;
18840
+ }
18841
+ if (requestTransform) {
18842
+ this.requestTransform = requestTransform;
18843
+ }
18844
+ if (withCredentials !== void 0) {
18845
+ this.withCredentials = withCredentials;
18846
+ }
18847
+ addConnector(this);
18848
+ }
18849
+ }
18850
+ static create(options) {
18851
+ return new this(options);
18852
+ }
18853
+ /**
18854
+ * Clear the cache.
18855
+ */
18856
+ clearCache() {
18857
+ this.cache.clean();
18858
+ }
18859
+ setRequestTransform(requestTransform) {
18860
+ this.requestTransform = requestTransform;
18861
+ }
18862
+ /**
18863
+ * Fast way to specify the connection address to NextGIS Web.
18864
+ * The current connection will be severed.
18865
+ * @param baseUrl - NGW url
18866
+ */
18867
+ setNgw(baseUrl) {
18868
+ this.logout();
18869
+ this.options.baseUrl = baseUrl;
18870
+ addConnector(this);
18871
+ }
18872
+ /**
18873
+ * Establishing a connection with NextGIS Web to fulfill all other requests.
18874
+ * @remarks
18875
+ * This method need not be called manually as it is used when forming a request in {@link apiRequest | apiRequest}.
18876
+ * Can be used to check connection.
18877
+ * @example
18878
+ * ```javascript
18879
+ * const connector = new NgwConnector({ baseUrl: 'https://demo.nextgis.com' });
18880
+ * connector.connect()
18881
+ * .then(() => console.log('Ok'))
18882
+ * .catch((er) => console.log('Connection problem', er));
18883
+ * ```
18884
+ */
18885
+ connect() {
18886
+ return __async$r(this, null, function* () {
18887
+ const auth = this.options.auth;
18888
+ if (auth) {
18889
+ const { login, password } = auth;
18890
+ if (login && password) {
18891
+ yield this._login({ login, password });
18892
+ }
18893
+ }
18894
+ const routeUrl = `${this.routeStr}?client=${this.client}`;
18895
+ return yield this.makeQuery(
18896
+ routeUrl,
18897
+ {},
18898
+ {
18899
+ cacheName: "route",
18900
+ cache: true,
18901
+ cacheProps: {
18902
+ id: this.id,
18903
+ auth,
18904
+ baseUrl: this.options.baseUrl
18905
+ }
18906
+ }
18907
+ );
18908
+ });
18909
+ }
18910
+ /**
18911
+ * Quick way to change NextGIS Web user.
18912
+ * @param credentials - New user credentials
18913
+ */
18914
+ login(credentials, options) {
18915
+ this.logout();
18916
+ addConnector(this);
18917
+ return this._login(credentials, options);
18918
+ }
18919
+ /**
18920
+ * Disconnecting a user. Aborting all current requests
18921
+ */
18922
+ logout() {
18923
+ this.abort();
18924
+ removeConnector(this);
18925
+ this.options.auth = void 0;
18926
+ this.user = void 0;
18927
+ this.clearCache();
18928
+ this.emitter.emit("logout");
18929
+ }
18930
+ getUserInfo(credentials, options) {
18931
+ return __async$r(this, null, function* () {
18932
+ if (this.user && this.user.id) {
18933
+ return this.user;
18934
+ }
18935
+ if (credentials) {
18936
+ this.options.auth = credentials;
18937
+ }
18938
+ const options_ = __spreadValues$s({
18939
+ headers: this.getAuthorizationHeaders(credentials),
18940
+ cache: true
18941
+ }, options);
18942
+ return this.makeQuery(
18943
+ "/api/component/auth/current_user",
18944
+ {},
18945
+ options_
18946
+ );
18947
+ });
18948
+ }
18949
+ /**
18950
+ * Obtaining the required Headers for authentication of requests in the NGW.
18951
+ */
18952
+ getAuthorizationHeaders(credentials) {
18953
+ const client = this.makeClientId(credentials);
18954
+ if (client) {
18955
+ return {
18956
+ Authorization: `Basic ${client}`
18957
+ };
18958
+ }
18959
+ return {};
18960
+ }
18961
+ makeClientId(credentials) {
18962
+ credentials = credentials || this.options.auth;
18963
+ if (credentials) {
18964
+ const { login, password } = credentials;
18965
+ const encodedStr = [login, password].map(encodeURIComponent).join(":");
18966
+ {
18967
+ return window.btoa(encodedStr);
18968
+ }
18969
+ }
18970
+ }
18971
+ /** Stop all api requests */
18972
+ abort() {
18973
+ for (const abortController of Object.values(this.activeRequests)) {
18974
+ abortController.abort();
18975
+ }
18976
+ this.activeRequests = {};
18977
+ }
18978
+ getActiveApiRequests() {
18979
+ return __spreadValues$s({}, this.activeRequests);
18980
+ }
18981
+ route(name, ...rest) {
18982
+ return route(name, this, ...rest);
18983
+ }
18984
+ /**
18985
+ * Send request to NGW.
18986
+ * @param url - URL address to NGW
18987
+ * @param params - Query params
18988
+ * @param options - Request options
18989
+ */
18990
+ makeQuery(_0, _1) {
18991
+ return __async$r(this, arguments, function* (url, params, options = {}) {
18992
+ var _b;
18993
+ url = (this.options.baseUrl ? this.options.baseUrl : "") + url;
18994
+ if (!url) {
18995
+ throw new Error("Empty `url` not allowed");
18996
+ }
18997
+ if (params) {
18998
+ const _a = params, restParams = __objRest$3(_a, ["paramList"]);
18999
+ url = template(url, restParams);
19000
+ }
19001
+ url = encodeURI(fixUrlStr(url));
19002
+ options = __spreadValues$s({ withCredentials: this.withCredentials }, options);
19003
+ const {
19004
+ cache,
19005
+ signal: externalSignal,
19006
+ method = "GET",
19007
+ headers,
19008
+ cacheName,
19009
+ cacheProps,
19010
+ responseType,
19011
+ withCredentials
19012
+ } = options;
19013
+ const internalAbortController = new AbortController();
19014
+ const internalSignal = internalAbortController.signal;
19015
+ if (externalSignal) {
19016
+ if (externalSignal.aborted) {
19017
+ throw new AbortError();
19018
+ }
19019
+ externalSignal.addEventListener("abort", () => {
19020
+ internalAbortController.abort();
19021
+ });
19022
+ }
19023
+ options.signal = internalSignal;
19024
+ const createPromise = () => __async$r(this, null, function* () {
19025
+ const id = REQUEST_ID++;
19026
+ this.activeRequests[id] = internalAbortController;
19027
+ try {
19028
+ return this._loadData(url, options);
19029
+ } finally {
19030
+ this._cleanActiveRequest(id);
19031
+ }
19032
+ });
19033
+ if (cache && method === "GET") {
19034
+ const cacheOptions = cacheProps ? cacheProps : __spreadProps$h(__spreadValues$s({}, objectRemoveEmpty({
19035
+ headers,
19036
+ withCredentials,
19037
+ responseType,
19038
+ baseUrl: this.options.baseUrl,
19039
+ userId: (_b = this.user) == null ? void 0 : _b.id
19040
+ })), {
19041
+ params
19042
+ });
19043
+ return this.cache.add(
19044
+ cacheName || url,
19045
+ createPromise,
19046
+ cacheOptions,
19047
+ false
19048
+ );
19049
+ }
19050
+ return createPromise();
19051
+ });
19052
+ }
19053
+ _loadData(url, options) {
19054
+ options.responseType = options.responseType || "json";
19055
+ return new Promise((resolve, reject) => {
19056
+ var _a;
19057
+ if (this.user) {
19058
+ options = options || {};
19059
+ options.headers = __spreadValues$s(__spreadValues$s({}, this.getAuthorizationHeaders()), options.headers);
19060
+ }
19061
+ if (this.requestTransform) {
19062
+ const [transUrl, transOptions] = this.requestTransform(url, options);
19063
+ url = transUrl;
19064
+ options = transOptions;
19065
+ }
19066
+ let runOnAbort = void 0;
19067
+ loadData(url, resolve, options, reject, (handler) => {
19068
+ runOnAbort = handler;
19069
+ });
19070
+ (_a = options.signal) == null ? void 0 : _a.addEventListener("abort", () => {
19071
+ if (runOnAbort !== void 0) {
19072
+ runOnAbort();
19073
+ }
19074
+ reject(new AbortError());
19075
+ });
19076
+ }).catch((httpError) => {
19077
+ if (httpError.name !== "AbortError") {
19078
+ {
19079
+ console.warn("DEV WARN", httpError);
19080
+ }
19081
+ const er = this._handleHttpError(httpError);
19082
+ if (er) {
19083
+ throw er;
19084
+ }
19085
+ }
19086
+ throw httpError;
19087
+ });
19088
+ }
19089
+ _login(credentials, options) {
19090
+ return __async$r(this, null, function* () {
19091
+ try {
19092
+ const data = yield this.getUserInfo(credentials, options);
19093
+ this.user = data;
19094
+ this.emitter.emit("login", data);
19095
+ return data;
19096
+ } catch (er) {
19097
+ this.emitter.emit("login:error", er);
19098
+ throw er;
19099
+ }
19100
+ });
19101
+ }
19102
+ _cleanActiveRequest(requestId) {
19103
+ delete this.activeRequests[requestId];
19104
+ }
19105
+ _handleHttpError(er) {
19106
+ if (er) {
19107
+ if (er instanceof NgwError) {
19108
+ if (er.exception === "nextgisweb.resource.exception.ResourceNotFound") {
19109
+ throw new ResourceNotFoundError(er);
19110
+ } else if (er.exception === "nextgisweb.core.exception.InsufficientPermissions") {
19111
+ throw new InsufficientPermissionsError(er);
19112
+ }
19113
+ }
19114
+ }
19115
+ return er;
19116
+ }
19117
+ }
19118
+ __publicField$s(NgwConnector, "errors", {
19119
+ NgwError,
19120
+ ResourceNotFoundError
19121
+ });
19122
+
19123
+ function resourceCompare(res1, res2) {
19124
+ return objectDeepEqual(res1, res2);
19125
+ }
19126
+
19127
+ const exclude = ["description"];
19128
+ function resourceToQuery(resource, prefix = "") {
19129
+ prefix = prefix ? prefix + "__" : "";
19130
+ const query = {};
19131
+ for (const [key, value] of Object.entries(resource)) {
19132
+ if (exclude.indexOf(key) === -1) {
19133
+ if (isObject(value)) {
19134
+ if (key === "owner_user") {
19135
+ const children = resourceToQuery(value, key);
19136
+ Object.assign(query, children);
19137
+ } else if (key === "parent" && "id" in value) {
19138
+ query.parent_id = value.id;
19139
+ }
19140
+ } else if (defined(value)) {
19141
+ query[prefix + key] = value;
19142
+ }
19143
+ }
19144
+ }
19145
+ return query;
19146
+ }
19147
+
19148
+ var __defProp$D = Object.defineProperty;
19149
+ var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
19150
+ var __hasOwnProp$s = Object.prototype.hasOwnProperty;
19151
+ var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
19152
+ var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
19153
+ var __spreadValues$r = (a, b) => {
19154
+ for (var prop in b || (b = {}))
19155
+ if (__hasOwnProp$s.call(b, prop))
19156
+ __defNormalProp$D(a, prop, b[prop]);
19157
+ if (__getOwnPropSymbols$s)
19158
+ for (var prop of __getOwnPropSymbols$s(b)) {
19159
+ if (__propIsEnum$s.call(b, prop))
19160
+ __defNormalProp$D(a, prop, b[prop]);
19161
+ }
19162
+ return a;
19163
+ };
19164
+ var __publicField$r = (obj, key, value) => __defNormalProp$D(obj, typeof key !== "symbol" ? key + "" : key, value);
19165
+ var __async$q = (__this, __arguments, generator) => {
19166
+ return new Promise((resolve, reject) => {
19167
+ var fulfilled = (value) => {
19168
+ try {
19169
+ step(generator.next(value));
19170
+ } catch (e) {
19171
+ reject(e);
19172
+ }
19173
+ };
19174
+ var rejected = (value) => {
19175
+ try {
19176
+ step(generator.throw(value));
19177
+ } catch (e) {
19178
+ reject(e);
19179
+ }
19180
+ };
19181
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
19182
+ step((generator = generator.apply(__this, __arguments)).next());
19183
+ });
19184
+ };
19185
+ class ResourcesControl {
19186
+ constructor({
19187
+ connector,
19188
+ cacheId
19189
+ }) {
19190
+ __publicField$r(this, "cache");
19191
+ __publicField$r(this, "connector");
19192
+ this.connector = connector;
19193
+ this.cache = new Cache({ namespace: cacheId });
19194
+ }
19195
+ // -------------------------------------------------------------------------
19196
+ // Resource Methods
19197
+ // -------------------------------------------------------------------------
19198
+ /**
19199
+ * Receive resource from NGW by id, keyname or search-object parameter.
19200
+ * @param resource - Resource id, keyname or search-object
19201
+ *
19202
+ * @remarks
19203
+ * Fetching resource would be cached to speed up next call
19204
+ */
19205
+ getOne(resource, requestOptions) {
19206
+ const opt = __spreadValues$r({}, requestOptions);
19207
+ if (typeof resource === "string") ; else if (typeof resource === "number") ; else if (isObject(resource)) {
19208
+ if (resource.id !== void 0) {
19209
+ resource.id;
19210
+ } else {
19211
+ if (resource.keyname) {
19212
+ resource.keyname;
19213
+ }
19214
+ if (resource.display_name) {
19215
+ resource.display_name;
19216
+ }
19217
+ }
19218
+ }
19219
+ if (typeof resource === "string") {
19220
+ return this._fetchResourceBy({ keyname: resource }, opt);
19221
+ } else if (typeof resource === "number") {
19222
+ return this._fetchResourceById(resource, opt);
19223
+ } else if (isObject(resource)) {
19224
+ return this._fetchResourceBy(resource, opt);
19225
+ }
19226
+ return Promise.resolve(void 0);
19227
+ }
19228
+ getOneOrFail(resource, requestOptions) {
19229
+ return this.getOne(resource, requestOptions).then((res) => {
18260
19230
  if (res) {
18261
19231
  return res;
18262
19232
  }
@@ -18310,7 +19280,7 @@ class ResourcesControl {
18310
19280
  } else {
18311
19281
  Object.assign(query, resourceToQuery(resource));
18312
19282
  }
18313
- return this.connector.get("resource.search", requestOptions, __spreadValues$s({
19283
+ return this.connector.get("resource.search", requestOptions, __spreadValues$r({
18314
19284
  serialization: "full"
18315
19285
  }, query)).then((resources) => {
18316
19286
  if ((requestOptions == null ? void 0 : requestOptions.cache) && resources) {
@@ -18387,7 +19357,7 @@ class ResourcesControl {
18387
19357
  });
18388
19358
  }
18389
19359
  _cleanResourceItemCache(id) {
18390
- return __async$r(this, null, function* () {
19360
+ return __async$q(this, null, function* () {
18391
19361
  var _a;
18392
19362
  const all = this.cache.all();
18393
19363
  const toDelete = [];
@@ -18406,310 +19376,56 @@ class ResourcesControl {
18406
19376
  }
18407
19377
  }
18408
19378
  }
18409
- for (const d of toDelete) {
18410
- this.cache.delete(d);
18411
- }
18412
- });
18413
- }
18414
- _fetchResourceById(id, requestOptions) {
18415
- return this.connector.get("resource.item", requestOptions, { id });
18416
- }
18417
- _fetchResourceBy(resource, requestOptions) {
18418
- return this.getMany(resource, requestOptions).then((resources) => {
18419
- return resources[0];
18420
- });
18421
- }
18422
- _resourceCacheFilter(resource) {
18423
- return Promise.all(this.cache.matchAll("resource.item")).then(
18424
- (resources) => {
18425
- const items = [];
18426
- resources.filter((x) => {
18427
- if (x) {
18428
- if (resource.keyname && x.resource.keyname) {
18429
- return resource.keyname === x.resource.keyname;
18430
- }
18431
- if (defined(resource.id) && defined(x.resource.id)) {
18432
- return resource.id === x.resource.id;
18433
- }
18434
- return resourceCompare(resource, x.resource);
18435
- }
18436
- });
18437
- return items;
18438
- }
18439
- );
18440
- }
18441
- }
18442
-
18443
- const CONNECTORS = [];
18444
- function addConnector(connector) {
18445
- CONNECTORS.push(connector);
18446
- }
18447
- function findConnector(options) {
18448
- return CONNECTORS.find((x) => {
18449
- if (x.options.baseUrl === options.baseUrl) {
18450
- if (options.auth) {
18451
- if (x.options.auth) {
18452
- return objectDeepEqual(x.options.auth, options.auth);
18453
- }
18454
- } else {
18455
- return true;
18456
- }
18457
- }
18458
- });
18459
- }
18460
- function removeConnector(connector) {
18461
- const index = CONNECTORS.indexOf(connector);
18462
- if (index !== -1) {
18463
- CONNECTORS.splice(index, 1);
18464
- }
18465
- }
18466
-
18467
- class AbortError extends Error {
18468
- constructor(message = "AbortError") {
18469
- super(message);
18470
- this.name = "AbortError";
18471
- }
18472
- }
18473
-
18474
- var __defProp$D = Object.defineProperty;
18475
- var __defNormalProp$D = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18476
- var __publicField$r = (obj, key, value) => __defNormalProp$D(obj, typeof key !== "symbol" ? key + "" : key, value);
18477
- class InsufficientPermissionsError extends NgwError {
18478
- constructor(obj) {
18479
- super(obj);
18480
- __publicField$r(this, "name", "InsufficientPermissionsError");
18481
- __publicField$r(this, "exception", "nextgisweb.core.exception.InsufficientPermissions");
18482
- Object.setPrototypeOf(this, InsufficientPermissionsError.prototype);
18483
- }
18484
- }
18485
-
18486
- const templateRe = /\{ *([\w_-]+) *\}/g;
18487
- function template(str, data) {
18488
- return str.replace(templateRe, (s, key) => {
18489
- let value = data[key];
18490
- if (value === void 0) {
18491
- throw new Error("No value provided for letiable " + s);
18492
- } else if (typeof value === "function") {
18493
- value = value(data);
18494
- }
18495
- return value;
18496
- });
18497
- }
18498
-
18499
- var __defProp$C = Object.defineProperty;
18500
- var __getOwnPropSymbols$s = Object.getOwnPropertySymbols;
18501
- var __hasOwnProp$s = Object.prototype.hasOwnProperty;
18502
- var __propIsEnum$s = Object.prototype.propertyIsEnumerable;
18503
- var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18504
- var __spreadValues$r = (a, b) => {
18505
- for (var prop in b || (b = {}))
18506
- if (__hasOwnProp$s.call(b, prop))
18507
- __defNormalProp$C(a, prop, b[prop]);
18508
- if (__getOwnPropSymbols$s)
18509
- for (var prop of __getOwnPropSymbols$s(b)) {
18510
- if (__propIsEnum$s.call(b, prop))
18511
- __defNormalProp$C(a, prop, b[prop]);
18512
- }
18513
- return a;
18514
- };
18515
- var __async$q = (__this, __arguments, generator) => {
18516
- return new Promise((resolve, reject) => {
18517
- var fulfilled = (value) => {
18518
- try {
18519
- step(generator.next(value));
18520
- } catch (e) {
18521
- reject(e);
18522
- }
18523
- };
18524
- var rejected = (value) => {
18525
- try {
18526
- step(generator.throw(value));
18527
- } catch (e) {
18528
- reject(e);
18529
- }
18530
- };
18531
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18532
- step((generator = generator.apply(__this, __arguments)).next());
18533
- });
18534
- };
18535
- function apiRequest(opt) {
18536
- return __async$q(this, null, function* () {
18537
- const { params, name, connector, requestOptions } = opt;
18538
- const apiItems = yield connector.connect();
18539
- let apiItem = apiItems && apiItems[name];
18540
- if (apiItem) {
18541
- apiItem = [...apiItem];
18542
- let url = apiItem.shift();
18543
- if (apiItem.length) {
18544
- const replaceParams = {};
18545
- for (let fry = 0; fry < apiItem.length; fry++) {
18546
- const arg = apiItem[fry];
18547
- replaceParams[fry] = `{${arg}}`;
18548
- if (params[arg] === void 0) {
18549
- throw new Error(`\`${arg}\` URL API argument is not specified`);
18550
- }
18551
- }
18552
- if (url) {
18553
- url = template(url, replaceParams);
18554
- }
18555
- }
18556
- if (params) {
18557
- const paramArray = [];
18558
- const paramList = params.paramList;
18559
- if (Array.isArray(paramList)) {
18560
- paramList.forEach(([key, value]) => {
18561
- paramArray.push(`${key}=${value}`);
18562
- });
18563
- }
18564
- for (const p in params) {
18565
- if (apiItem.indexOf(p) === -1) {
18566
- paramArray.push(`${p}=${params[p]}`);
18567
- }
18568
- }
18569
- if (paramArray.length) {
18570
- url = `${url}?${paramArray.join("&")}`;
18571
- }
18572
- }
18573
- if (url) {
18574
- return connector.makeQuery(url, params, __spreadValues$r({
18575
- cacheName: name
18576
- }, requestOptions));
18577
- } else {
18578
- throw new Error("Request URL is not set");
18579
- }
18580
- } else {
18581
- return void 0;
18582
- }
18583
- });
18584
- }
18585
-
18586
- var __defProp$B = Object.defineProperty;
18587
- var __defNormalProp$B = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18588
- var __publicField$q = (obj, key, value) => __defNormalProp$B(obj, key + "" , value);
18589
- class NetworkError extends Error {
18590
- constructor(url) {
18591
- super();
18592
- __publicField$q(this, "name", "NetworkError");
18593
- Object.setPrototypeOf(this, NetworkError.prototype);
18594
- this.message = `Unable to request ${url}.
18595
- Possibly invalid NGW URL entered or CORS not configured to get request from ${location.origin}`;
18596
- }
18597
- }
18598
-
18599
- let loadData;
18600
- {
18601
- loadData = (url, callback, options = {}, error, onCancel) => {
18602
- options.method = options.method || "GET";
18603
- const xhr = new XMLHttpRequest();
18604
- xhr.open(options.method || "GET", url, true);
18605
- if (options.responseType === "blob") {
18606
- xhr.responseType = options.responseType;
18607
- }
18608
- const getResponseText = () => {
18609
- try {
18610
- return JSON.parse(xhr.responseText);
18611
- } catch (er) {
18612
- return xhr.responseText;
18613
- }
18614
- };
18615
- const processingResponse = (forError = false) => {
18616
- const cb = forError ? error : callback;
18617
- if (options.responseType === "blob") {
18618
- cb(xhr.response);
18619
- } else {
18620
- if (xhr.responseText) {
18621
- cb(getResponseText());
18622
- } else {
18623
- error({ message: "" });
18624
- }
18625
- }
18626
- };
18627
- xhr.onload = () => {
18628
- if ([401, 403, 404, 422, 500].indexOf(xhr.status) !== -1) {
18629
- error(new NgwError(getResponseText()));
18630
- }
18631
- processingResponse();
18632
- };
18633
- xhr.onerror = (er) => {
18634
- if (xhr.status === 0) {
18635
- error(new NetworkError(url));
18636
- } else {
18637
- error(er);
18638
- }
18639
- };
18640
- xhr.upload.onprogress = function(e) {
18641
- if (e.lengthComputable) {
18642
- const percentComplete = e.loaded / e.total * 100;
18643
- if (options.onProgress) {
18644
- options.onProgress(percentComplete, e);
18645
- }
18646
- }
18647
- };
18648
- const headers = options.headers;
18649
- if (headers) {
18650
- for (const h in headers) {
18651
- const header = headers[h];
18652
- if (typeof header === "string") {
18653
- xhr.setRequestHeader(h, header);
18654
- }
18655
- }
18656
- }
18657
- if (options.withCredentials !== void 0) {
18658
- xhr.withCredentials = options.withCredentials;
18659
- }
18660
- let data;
18661
- if (options.file) {
18662
- data = new FormData();
18663
- data.append("file", options.file);
18664
- if (options.data) {
18665
- for (const d in options.data) {
18666
- data.append(d, data[d]);
18667
- }
19379
+ for (const d of toDelete) {
19380
+ this.cache.delete(d);
18668
19381
  }
18669
- } else {
18670
- data = options.data ? typeof options.data === "string" ? options.data : JSON.stringify(options.data) : null;
18671
- }
18672
- if (onCancel) {
18673
- onCancel(() => {
18674
- xhr.abort();
18675
- });
18676
- }
18677
- xhr.send(data);
18678
- };
19382
+ });
19383
+ }
19384
+ _fetchResourceById(id, requestOptions) {
19385
+ return this.connector.get("resource.item", requestOptions, { id });
19386
+ }
19387
+ _fetchResourceBy(resource, requestOptions) {
19388
+ return this.getMany(resource, requestOptions).then((resources) => {
19389
+ return resources[0];
19390
+ });
19391
+ }
19392
+ _resourceCacheFilter(resource) {
19393
+ return Promise.all(this.cache.matchAll("resource.item")).then(
19394
+ (resources) => {
19395
+ const items = [];
19396
+ resources.filter((x) => {
19397
+ if (x) {
19398
+ if (resource.keyname && x.resource.keyname) {
19399
+ return resource.keyname === x.resource.keyname;
19400
+ }
19401
+ if (defined(resource.id) && defined(x.resource.id)) {
19402
+ return resource.id === x.resource.id;
19403
+ }
19404
+ return resourceCompare(resource, x.resource);
19405
+ }
19406
+ });
19407
+ return items;
19408
+ }
19409
+ );
19410
+ }
18679
19411
  }
18680
19412
 
18681
- var __defProp$A = Object.defineProperty;
18682
- var __defProps$g = Object.defineProperties;
18683
- var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
19413
+ var __defProp$C = Object.defineProperty;
18684
19414
  var __getOwnPropSymbols$r = Object.getOwnPropertySymbols;
18685
19415
  var __hasOwnProp$r = Object.prototype.hasOwnProperty;
18686
19416
  var __propIsEnum$r = Object.prototype.propertyIsEnumerable;
18687
- var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
19417
+ var __defNormalProp$C = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18688
19418
  var __spreadValues$q = (a, b) => {
18689
19419
  for (var prop in b || (b = {}))
18690
19420
  if (__hasOwnProp$r.call(b, prop))
18691
- __defNormalProp$A(a, prop, b[prop]);
19421
+ __defNormalProp$C(a, prop, b[prop]);
18692
19422
  if (__getOwnPropSymbols$r)
18693
19423
  for (var prop of __getOwnPropSymbols$r(b)) {
18694
19424
  if (__propIsEnum$r.call(b, prop))
18695
- __defNormalProp$A(a, prop, b[prop]);
19425
+ __defNormalProp$C(a, prop, b[prop]);
18696
19426
  }
18697
19427
  return a;
18698
19428
  };
18699
- var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
18700
- var __objRest$2 = (source, exclude) => {
18701
- var target = {};
18702
- for (var prop in source)
18703
- if (__hasOwnProp$r.call(source, prop) && exclude.indexOf(prop) < 0)
18704
- target[prop] = source[prop];
18705
- if (source != null && __getOwnPropSymbols$r)
18706
- for (var prop of __getOwnPropSymbols$r(source)) {
18707
- if (exclude.indexOf(prop) < 0 && __propIsEnum$r.call(source, prop))
18708
- target[prop] = source[prop];
18709
- }
18710
- return target;
18711
- };
18712
- var __publicField$p = (obj, key, value) => __defNormalProp$A(obj, typeof key !== "symbol" ? key + "" : key, value);
18713
19429
  var __async$p = (__this, __arguments, generator) => {
18714
19430
  return new Promise((resolve, reject) => {
18715
19431
  var fulfilled = (value) => {
@@ -18730,172 +19446,76 @@ var __async$p = (__this, __arguments, generator) => {
18730
19446
  step((generator = generator.apply(__this, __arguments)).next());
18731
19447
  });
18732
19448
  };
18733
- let ID$2 = 0;
18734
- let REQUEST_ID = 0;
18735
- class NgwConnector {
18736
- constructor(options) {
18737
- this.options = options;
18738
- __publicField$p(this, "id", ID$2++);
18739
- __publicField$p(this, "emitter", new EventEmitter());
18740
- __publicField$p(this, "user");
18741
- __publicField$p(this, "resources");
18742
- __publicField$p(this, "cache");
18743
- __publicField$p(this, "withCredentials");
18744
- __publicField$p(this, "client", `NextGIS-NGW-Connector/${pkg.version}`);
18745
- __publicField$p(this, "routeStr", "/api/component/pyramid/route");
18746
- __publicField$p(this, "activeRequests", {});
18747
- __publicField$p(this, "requestTransform");
18748
- const exist = findConnector(options);
18749
- this.cache = new Cache({ namespace: options.cacheId });
18750
- if (exist) {
18751
- return exist;
18752
- } else {
18753
- const { route, requestTransform, withCredentials } = this.options;
18754
- if (route) {
18755
- this.routeStr = route;
18756
- }
18757
- if (requestTransform) {
18758
- this.requestTransform = requestTransform;
18759
- }
18760
- if (withCredentials !== void 0) {
18761
- this.withCredentials = withCredentials;
18762
- }
18763
- this.resources = new ResourcesControl({
18764
- connector: this,
18765
- cacheId: options.cacheId
18766
- });
18767
- addConnector(this);
18768
- }
18769
- }
18770
- static create(options) {
18771
- return new this(options);
18772
- }
18773
- /**
18774
- * Clear the cache.
18775
- */
18776
- clearCache() {
18777
- this.cache.clean();
18778
- this.resources.cache.clean();
18779
- }
18780
- setRequestTransform(requestTransform) {
18781
- this.requestTransform = requestTransform;
18782
- }
18783
- /**
18784
- * Fast way to specify the connection address to NextGIS Web.
18785
- * The current connection will be severed.
18786
- * @param baseUrl - NGW url
18787
- */
18788
- setNgw(baseUrl) {
18789
- this.logout();
18790
- this.options.baseUrl = baseUrl;
18791
- addConnector(this);
18792
- }
18793
- /**
18794
- * Establishing a connection with NextGIS Web to fulfill all other requests.
18795
- * @remarks
18796
- * This method need not be called manually as it is used when forming a request in {@link apiRequest | apiRequest}.
18797
- * Can be used to check connection.
18798
- * @example
18799
- * ```javascript
18800
- * const connector = new NgwConnector({baseUrl: 'https://demo.nextgis.com'});
18801
- * connector.connect()
18802
- * .then(() => console.log('Ok'))
18803
- * .catch((er) => console.log('Connection problem', er));
18804
- * ```
18805
- */
18806
- connect() {
18807
- return __async$p(this, null, function* () {
18808
- const auth = this.options.auth;
18809
- if (auth) {
18810
- const { login, password } = auth;
18811
- if (login && password) {
18812
- yield this._login({ login, password });
19449
+ function apiRequest(opt) {
19450
+ return __async$p(this, null, function* () {
19451
+ const { params, name, connector, requestOptions } = opt;
19452
+ const apiItems = yield connector.connect();
19453
+ let apiItem = apiItems && apiItems[name];
19454
+ if (apiItem) {
19455
+ apiItem = [...apiItem];
19456
+ let url = apiItem.shift();
19457
+ if (apiItem.length) {
19458
+ const replaceParams = {};
19459
+ for (let fry = 0; fry < apiItem.length; fry++) {
19460
+ const arg = apiItem[fry];
19461
+ replaceParams[fry] = `{${arg}}`;
19462
+ if (params[arg] === void 0) {
19463
+ throw new Error(`\`${arg}\` URL API argument is not specified`);
19464
+ }
19465
+ }
19466
+ if (url) {
19467
+ url = template(url, replaceParams);
18813
19468
  }
18814
19469
  }
18815
- const routeUrl = `${this.routeStr}?client=${this.client}`;
18816
- return yield this.makeQuery(
18817
- routeUrl,
18818
- {},
18819
- {
18820
- cacheName: "route",
18821
- cache: true,
18822
- cacheProps: {
18823
- id: this.id,
18824
- auth,
18825
- baseUrl: this.options.baseUrl
19470
+ if (params) {
19471
+ const paramArray = [];
19472
+ const paramList = params.paramList;
19473
+ if (Array.isArray(paramList)) {
19474
+ paramList.forEach(([key, value]) => {
19475
+ paramArray.push(`${key}=${value}`);
19476
+ });
19477
+ }
19478
+ for (const p in params) {
19479
+ if (apiItem.indexOf(p) === -1) {
19480
+ paramArray.push(`${p}=${params[p]}`);
18826
19481
  }
18827
19482
  }
18828
- );
18829
- });
18830
- }
18831
- /**
18832
- * Quick way to change NextGIS Web user.
18833
- * @param credentials - New user credentials
18834
- */
18835
- login(credentials, options) {
18836
- this.logout();
18837
- addConnector(this);
18838
- return this._login(credentials, options);
18839
- }
18840
- /**
18841
- * Disconnecting a user. Aborting all current requests
18842
- */
18843
- logout() {
18844
- this.abort();
18845
- removeConnector(this);
18846
- this.options.auth = void 0;
18847
- this.user = void 0;
18848
- this.clearCache();
18849
- this.emitter.emit("logout");
18850
- }
18851
- getUserInfo(credentials, options) {
18852
- return __async$p(this, null, function* () {
18853
- if (this.user && this.user.id) {
18854
- return this.user;
19483
+ if (paramArray.length) {
19484
+ url = `${url}?${paramArray.join("&")}`;
19485
+ }
18855
19486
  }
18856
- if (credentials) {
18857
- this.options.auth = credentials;
19487
+ if (url) {
19488
+ return connector.makeQuery(url, params, __spreadValues$q({
19489
+ cacheName: name
19490
+ }, requestOptions));
19491
+ } else {
19492
+ throw new Error("Request URL is not set");
18858
19493
  }
18859
- const options_ = __spreadValues$q({
18860
- headers: this.getAuthorizationHeaders(credentials)
18861
- }, options);
18862
- return this.makeQuery(
18863
- "/api/component/auth/current_user",
18864
- {},
18865
- options_
18866
- );
19494
+ } else {
19495
+ return void 0;
19496
+ }
19497
+ });
19498
+ }
19499
+
19500
+ var __defProp$B = Object.defineProperty;
19501
+ var __defNormalProp$B = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
19502
+ var __publicField$q = (obj, key, value) => __defNormalProp$B(obj, key + "" , value);
19503
+ class NgwConnectorExtended extends NgwConnector {
19504
+ constructor(options) {
19505
+ super(options);
19506
+ this.options = options;
19507
+ __publicField$q(this, "resources");
19508
+ this.resources = new ResourcesControl({
19509
+ connector: this,
19510
+ cacheId: options.cacheId
18867
19511
  });
18868
19512
  }
18869
19513
  /**
18870
- * Obtaining the required Headers for authentication of requests in the NGW.
18871
- */
18872
- getAuthorizationHeaders(credentials) {
18873
- const client = this.makeClientId(credentials);
18874
- if (client) {
18875
- return {
18876
- Authorization: `Basic ${client}`
18877
- };
18878
- }
18879
- }
18880
- makeClientId(credentials) {
18881
- credentials = credentials || this.options.auth;
18882
- if (credentials) {
18883
- const { login, password } = credentials;
18884
- const encodedStr = [login, password].map(encodeURIComponent).join(":");
18885
- {
18886
- return window.btoa(encodedStr);
18887
- }
18888
- }
18889
- }
18890
- /** Stop all api requests */
18891
- abort() {
18892
- for (const abortController of Object.values(this.activeRequests)) {
18893
- abortController.abort();
18894
- }
18895
- this.activeRequests = {};
18896
- }
18897
- getActiveApiRequests() {
18898
- return __spreadValues$q({}, this.activeRequests);
19514
+ * Clear the cache.
19515
+ */
19516
+ clearCache() {
19517
+ super.clearCache();
19518
+ this.resources.cache.clean();
18899
19519
  }
18900
19520
  /**
18901
19521
  * Send request to NGW api router.
@@ -19014,75 +19634,6 @@ class NgwConnector {
19014
19634
  options
19015
19635
  );
19016
19636
  }
19017
- /**
19018
- * Send request to NGW.
19019
- * @param url - URL address to NGW
19020
- * @param params - Query params
19021
- * @param options - Request options
19022
- */
19023
- makeQuery(_0, _1) {
19024
- return __async$p(this, arguments, function* (url, params, options = {}) {
19025
- var _b;
19026
- url = (this.options.baseUrl ? this.options.baseUrl : "") + url;
19027
- if (!url) {
19028
- throw new Error("Empty `url` not allowed");
19029
- }
19030
- if (params) {
19031
- const _a = params, restParams = __objRest$2(_a, ["paramList"]);
19032
- url = template(url, restParams);
19033
- }
19034
- url = encodeURI(fixUrlStr(url));
19035
- options = __spreadValues$q({ withCredentials: this.withCredentials }, options);
19036
- const {
19037
- cache,
19038
- signal: externalSignal,
19039
- method = "GET",
19040
- headers,
19041
- cacheName,
19042
- cacheProps,
19043
- responseType,
19044
- withCredentials
19045
- } = options;
19046
- const internalAbortController = new AbortController();
19047
- const internalSignal = internalAbortController.signal;
19048
- if (externalSignal) {
19049
- if (externalSignal.aborted) {
19050
- throw new AbortError();
19051
- }
19052
- externalSignal.addEventListener("abort", () => {
19053
- internalAbortController.abort();
19054
- });
19055
- }
19056
- options.signal = internalSignal;
19057
- const createPromise = () => __async$p(this, null, function* () {
19058
- const id = REQUEST_ID++;
19059
- this.activeRequests[id] = internalAbortController;
19060
- try {
19061
- return this._loadData(url, options);
19062
- } finally {
19063
- this._cleanActiveRequest(id);
19064
- }
19065
- });
19066
- if (cache && method === "GET") {
19067
- const cacheOptions = cacheProps ? cacheProps : __spreadProps$g(__spreadValues$q({}, objectRemoveEmpty({
19068
- headers,
19069
- withCredentials,
19070
- responseType,
19071
- baseUrl: this.options.baseUrl,
19072
- userId: (_b = this.user) == null ? void 0 : _b.id
19073
- })), {
19074
- params
19075
- });
19076
- return this.cache.add(
19077
- cacheName || url,
19078
- createPromise,
19079
- cacheOptions,
19080
- false
19081
- );
19082
- }
19083
- return createPromise();
19084
- });
19085
- }
19086
19637
  // -------------------------------------------------------------------------
19087
19638
  // Resource Methods
19088
19639
  // -------------------------------------------------------------------------
@@ -19158,98 +19709,27 @@ class NgwConnector {
19158
19709
  deleteResource(resource) {
19159
19710
  return this.resources.delete(resource);
19160
19711
  }
19161
- /**
19162
- * @internal
19163
- */
19164
- _loadData(url, options) {
19165
- options.responseType = options.responseType || "json";
19166
- return new Promise((resolve, reject) => {
19167
- var _a;
19168
- if (this.user) {
19169
- options = options || {};
19170
- options.headers = __spreadValues$q(__spreadValues$q({}, this.getAuthorizationHeaders()), options.headers);
19171
- }
19172
- if (this.requestTransform) {
19173
- const [transUrl, transOptions] = this.requestTransform(url, options);
19174
- url = transUrl;
19175
- options = transOptions;
19176
- }
19177
- let runOnAbort = void 0;
19178
- loadData(url, resolve, options, reject, (handler) => {
19179
- runOnAbort = handler;
19180
- });
19181
- (_a = options.signal) == null ? void 0 : _a.addEventListener("abort", () => {
19182
- if (runOnAbort !== void 0) {
19183
- runOnAbort();
19184
- }
19185
- reject(new AbortError());
19186
- });
19187
- }).catch((httpError) => {
19188
- if (httpError.name !== "AbortError") {
19189
- {
19190
- console.warn("DEV WARN", httpError);
19191
- }
19192
- const er = this._handleHttpError(httpError);
19193
- if (er) {
19194
- throw er;
19195
- }
19196
- }
19197
- throw httpError;
19198
- });
19199
- }
19200
- _login(credentials, options) {
19201
- return __async$p(this, null, function* () {
19202
- try {
19203
- const data = yield this.getUserInfo(credentials, options);
19204
- this.user = data;
19205
- this.emitter.emit("login", data);
19206
- return data;
19207
- } catch (er) {
19208
- this.emitter.emit("login:error", er);
19209
- throw er;
19210
- }
19211
- });
19212
- }
19213
- _cleanActiveRequest(requestId) {
19214
- delete this.activeRequests[requestId];
19215
- }
19216
- _handleHttpError(er) {
19217
- if (er) {
19218
- if (er instanceof NgwError) {
19219
- if (er.exception === "nextgisweb.resource.exception.ResourceNotFound") {
19220
- throw new ResourceNotFoundError(er);
19221
- } else if (er.exception === "nextgisweb.core.exception.InsufficientPermissions") {
19222
- throw new InsufficientPermissionsError(er);
19223
- }
19224
- }
19225
- }
19226
- return er;
19227
- }
19228
19712
  }
19229
- __publicField$p(NgwConnector, "errors", {
19230
- NgwError,
19231
- ResourceNotFoundError
19232
- });
19233
19713
 
19234
- var __defProp$z = Object.defineProperty;
19235
- var __defProps$f = Object.defineProperties;
19236
- var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
19714
+ var __defProp$A = Object.defineProperty;
19715
+ var __defProps$g = Object.defineProperties;
19716
+ var __getOwnPropDescs$g = Object.getOwnPropertyDescriptors;
19237
19717
  var __getOwnPropSymbols$q = Object.getOwnPropertySymbols;
19238
19718
  var __hasOwnProp$q = Object.prototype.hasOwnProperty;
19239
19719
  var __propIsEnum$q = Object.prototype.propertyIsEnumerable;
19240
- var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
19720
+ var __defNormalProp$A = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
19241
19721
  var __spreadValues$p = (a, b) => {
19242
19722
  for (var prop in b || (b = {}))
19243
19723
  if (__hasOwnProp$q.call(b, prop))
19244
- __defNormalProp$z(a, prop, b[prop]);
19724
+ __defNormalProp$A(a, prop, b[prop]);
19245
19725
  if (__getOwnPropSymbols$q)
19246
19726
  for (var prop of __getOwnPropSymbols$q(b)) {
19247
19727
  if (__propIsEnum$q.call(b, prop))
19248
- __defNormalProp$z(a, prop, b[prop]);
19728
+ __defNormalProp$A(a, prop, b[prop]);
19249
19729
  }
19250
19730
  return a;
19251
19731
  };
19252
- var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
19732
+ var __spreadProps$g = (a, b) => __defProps$g(a, __getOwnPropDescs$g(b));
19253
19733
  var __async$o = (__this, __arguments, generator) => {
19254
19734
  return new Promise((resolve, reject) => {
19255
19735
  var fulfilled = (value) => {
@@ -19354,13 +19834,13 @@ function getQueries(opt, _queries = [], _parentAllParams = []) {
19354
19834
  for (const f of filters_) {
19355
19835
  if (isPropertyFilter(f)) {
19356
19836
  _queries.push(
19357
- fetchNgwLayerItemsRequest(__spreadProps$f(__spreadValues$p({}, opt), {
19837
+ fetchNgwLayerItemsRequest(__spreadProps$g(__spreadValues$p({}, opt), {
19358
19838
  paramList: [..._parentAllParams, ...paramList, createParam(f)]
19359
19839
  }))
19360
19840
  );
19361
19841
  } else {
19362
19842
  getQueries(
19363
- __spreadProps$f(__spreadValues$p({}, opt), {
19843
+ __spreadProps$g(__spreadValues$p({}, opt), {
19364
19844
  filters: f
19365
19845
  }),
19366
19846
  _queries,
@@ -19381,7 +19861,7 @@ function getQueries(opt, _queries = [], _parentAllParams = []) {
19381
19861
  if (propertiesFilterList.length) {
19382
19862
  for (const x of propertiesFilterList) {
19383
19863
  getQueries(
19384
- __spreadProps$f(__spreadValues$p({}, opt), {
19864
+ __spreadProps$g(__spreadValues$p({}, opt), {
19385
19865
  filters: x
19386
19866
  }),
19387
19867
  _queries,
@@ -19390,7 +19870,7 @@ function getQueries(opt, _queries = [], _parentAllParams = []) {
19390
19870
  }
19391
19871
  } else {
19392
19872
  _queries.push(
19393
- fetchNgwLayerItemsRequest(__spreadProps$f(__spreadValues$p({}, opt), {
19873
+ fetchNgwLayerItemsRequest(__spreadProps$g(__spreadValues$p({}, opt), {
19394
19874
  paramList: [..._parentAllParams, ...paramList, ...filters2]
19395
19875
  }))
19396
19876
  );
@@ -19455,25 +19935,25 @@ function fetchNgwLayerItemsRequest(options) {
19455
19935
  );
19456
19936
  }
19457
19937
 
19458
- var __defProp$y = Object.defineProperty;
19459
- var __defProps$e = Object.defineProperties;
19460
- var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
19938
+ var __defProp$z = Object.defineProperty;
19939
+ var __defProps$f = Object.defineProperties;
19940
+ var __getOwnPropDescs$f = Object.getOwnPropertyDescriptors;
19461
19941
  var __getOwnPropSymbols$p = Object.getOwnPropertySymbols;
19462
19942
  var __hasOwnProp$p = Object.prototype.hasOwnProperty;
19463
19943
  var __propIsEnum$p = Object.prototype.propertyIsEnumerable;
19464
- var __defNormalProp$y = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
19944
+ var __defNormalProp$z = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
19465
19945
  var __spreadValues$o = (a, b) => {
19466
19946
  for (var prop in b || (b = {}))
19467
19947
  if (__hasOwnProp$p.call(b, prop))
19468
- __defNormalProp$y(a, prop, b[prop]);
19948
+ __defNormalProp$z(a, prop, b[prop]);
19469
19949
  if (__getOwnPropSymbols$p)
19470
19950
  for (var prop of __getOwnPropSymbols$p(b)) {
19471
19951
  if (__propIsEnum$p.call(b, prop))
19472
- __defNormalProp$y(a, prop, b[prop]);
19952
+ __defNormalProp$z(a, prop, b[prop]);
19473
19953
  }
19474
19954
  return a;
19475
19955
  };
19476
- var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
19956
+ var __spreadProps$f = (a, b) => __defProps$f(a, __getOwnPropDescs$f(b));
19477
19957
  var __async$n = (__this, __arguments, generator) => {
19478
19958
  return new Promise((resolve, reject) => {
19479
19959
  var fulfilled = (value) => {
@@ -19511,45 +19991,45 @@ function fetchNgwLayerItem(options) {
19511
19991
  if (resp.geom) {
19512
19992
  return createGeoJsonFeature(resp);
19513
19993
  } else {
19514
- const onlyGeomItem = yield fetchNgwLayerItem(__spreadProps$e(__spreadValues$o({}, options), {
19994
+ const onlyGeomItem = yield fetchNgwLayerItem(__spreadProps$f(__spreadValues$o({}, options), {
19515
19995
  geom: true,
19516
19996
  fields: null,
19517
19997
  extensions: null
19518
19998
  }));
19519
19999
  const geom = onlyGeomItem.geom;
19520
- return createGeoJsonFeature(__spreadProps$e(__spreadValues$o({}, resp), { geom }));
20000
+ return createGeoJsonFeature(__spreadProps$f(__spreadValues$o({}, resp), { geom }));
19521
20001
  }
19522
20002
  });
19523
- return __spreadProps$e(__spreadValues$o({}, resp), {
20003
+ return __spreadProps$f(__spreadValues$o({}, resp), {
19524
20004
  toGeojson
19525
20005
  });
19526
20006
  });
19527
20007
  }
19528
20008
 
19529
- var __defProp$x = Object.defineProperty;
20009
+ var __defProp$y = Object.defineProperty;
19530
20010
  var __getOwnPropSymbols$o = Object.getOwnPropertySymbols;
19531
20011
  var __hasOwnProp$o = Object.prototype.hasOwnProperty;
19532
20012
  var __propIsEnum$o = Object.prototype.propertyIsEnumerable;
19533
- var __defNormalProp$x = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20013
+ var __defNormalProp$y = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
19534
20014
  var __spreadValues$n = (a, b) => {
19535
20015
  for (var prop in b || (b = {}))
19536
20016
  if (__hasOwnProp$o.call(b, prop))
19537
- __defNormalProp$x(a, prop, b[prop]);
20017
+ __defNormalProp$y(a, prop, b[prop]);
19538
20018
  if (__getOwnPropSymbols$o)
19539
20019
  for (var prop of __getOwnPropSymbols$o(b)) {
19540
20020
  if (__propIsEnum$o.call(b, prop))
19541
- __defNormalProp$x(a, prop, b[prop]);
20021
+ __defNormalProp$y(a, prop, b[prop]);
19542
20022
  }
19543
20023
  return a;
19544
20024
  };
19545
- var __publicField$o = (obj, key, value) => __defNormalProp$x(obj, typeof key !== "symbol" ? key + "" : key, value);
20025
+ var __publicField$p = (obj, key, value) => __defNormalProp$y(obj, typeof key !== "symbol" ? key + "" : key, value);
19546
20026
  class BookmarkItem {
19547
20027
  constructor(options) {
19548
20028
  this.options = options;
19549
- __publicField$o(this, "name");
19550
- __publicField$o(this, "resourceId");
19551
- __publicField$o(this, "item");
19552
- __publicField$o(this, "_extent");
20029
+ __publicField$p(this, "name");
20030
+ __publicField$p(this, "resourceId");
20031
+ __publicField$p(this, "item");
20032
+ __publicField$p(this, "_extent");
19553
20033
  this.resourceId = options.resourceId;
19554
20034
  const item = options.item;
19555
20035
  this.item = item;
@@ -19695,14 +20175,14 @@ function treeEvery_(item, filterFunc = (x) => !!x, relation, _filtered = []) {
19695
20175
  return true;
19696
20176
  }
19697
20177
 
19698
- var __defProp$w = Object.defineProperty;
19699
- var __defNormalProp$w = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
19700
- var __publicField$n = (obj, key, value) => __defNormalProp$w(obj, typeof key !== "symbol" ? key + "" : key, value);
20178
+ var __defProp$x = Object.defineProperty;
20179
+ var __defNormalProp$x = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20180
+ var __publicField$o = (obj, key, value) => __defNormalProp$x(obj, typeof key !== "symbol" ? key + "" : key, value);
19701
20181
  class TreeHelper {
19702
20182
  constructor(item) {
19703
- __publicField$n(this, "item");
19704
- __publicField$n(this, "_children", []);
19705
- __publicField$n(this, "_parent");
20183
+ __publicField$o(this, "item");
20184
+ __publicField$o(this, "_children", []);
20185
+ __publicField$o(this, "_parent");
19706
20186
  this.item = item;
19707
20187
  }
19708
20188
  setParent(parent) {
@@ -19765,19 +20245,19 @@ class TreeHelper {
19765
20245
  }
19766
20246
  }
19767
20247
 
19768
- var __defProp$v = Object.defineProperty;
19769
- var __defNormalProp$v = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
19770
- var __publicField$m = (obj, key, value) => __defNormalProp$v(obj, typeof key !== "symbol" ? key + "" : key, value);
20248
+ var __defProp$w = Object.defineProperty;
20249
+ var __defNormalProp$w = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20250
+ var __publicField$n = (obj, key, value) => __defNormalProp$w(obj, typeof key !== "symbol" ? key + "" : key, value);
19771
20251
  class BaseProperty {
19772
20252
  constructor(name, item, options) {
19773
- __publicField$m(this, "options");
19774
- __publicField$m(this, "emitter", new EventEmitter());
19775
- __publicField$m(this, "name");
19776
- __publicField$m(this, "item");
19777
- __publicField$m(this, "_blocked", false);
19778
- __publicField$m(this, "_container");
19779
- __publicField$m(this, "_value");
19780
- __publicField$m(this, "_removeEventsListener");
20253
+ __publicField$n(this, "options");
20254
+ __publicField$n(this, "emitter", new EventEmitter());
20255
+ __publicField$n(this, "name");
20256
+ __publicField$n(this, "item");
20257
+ __publicField$n(this, "_blocked", false);
20258
+ __publicField$n(this, "_container");
20259
+ __publicField$n(this, "_value");
20260
+ __publicField$n(this, "_removeEventsListener");
19781
20261
  this.item = item;
19782
20262
  this.options = Object.assign({}, options);
19783
20263
  this.name = name;
@@ -19874,23 +20354,23 @@ class BaseProperty {
19874
20354
  }
19875
20355
  }
19876
20356
 
19877
- var __defProp$u = Object.defineProperty;
20357
+ var __defProp$v = Object.defineProperty;
19878
20358
  var __getOwnPropSymbols$n = Object.getOwnPropertySymbols;
19879
20359
  var __hasOwnProp$n = Object.prototype.hasOwnProperty;
19880
20360
  var __propIsEnum$n = Object.prototype.propertyIsEnumerable;
19881
- var __defNormalProp$u = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20361
+ var __defNormalProp$v = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
19882
20362
  var __spreadValues$m = (a, b) => {
19883
20363
  for (var prop in b || (b = {}))
19884
20364
  if (__hasOwnProp$n.call(b, prop))
19885
- __defNormalProp$u(a, prop, b[prop]);
20365
+ __defNormalProp$v(a, prop, b[prop]);
19886
20366
  if (__getOwnPropSymbols$n)
19887
20367
  for (var prop of __getOwnPropSymbols$n(b)) {
19888
20368
  if (__propIsEnum$n.call(b, prop))
19889
- __defNormalProp$u(a, prop, b[prop]);
20369
+ __defNormalProp$v(a, prop, b[prop]);
19890
20370
  }
19891
20371
  return a;
19892
20372
  };
19893
- var __publicField$l = (obj, key, value) => __defNormalProp$u(obj, key + "" , value);
20373
+ var __publicField$m = (obj, key, value) => __defNormalProp$v(obj, key + "" , value);
19894
20374
  const _CheckProperty = class _CheckProperty extends BaseProperty {
19895
20375
  constructor(name, item, options) {
19896
20376
  super(name, item, __spreadValues$m(__spreadValues$m({}, _CheckProperty.options), options));
@@ -19998,7 +20478,7 @@ const _CheckProperty = class _CheckProperty extends BaseProperty {
19998
20478
  }
19999
20479
  }
20000
20480
  };
20001
- __publicField$l(_CheckProperty, "options", {
20481
+ __publicField$m(_CheckProperty, "options", {
20002
20482
  hierarchy: true,
20003
20483
  bubble: false,
20004
20484
  propagation: false,
@@ -20007,31 +20487,31 @@ __publicField$l(_CheckProperty, "options", {
20007
20487
  });
20008
20488
  let CheckProperty = _CheckProperty;
20009
20489
 
20010
- var __defProp$t = Object.defineProperty;
20490
+ var __defProp$u = Object.defineProperty;
20011
20491
  var __getOwnPropSymbols$m = Object.getOwnPropertySymbols;
20012
20492
  var __hasOwnProp$m = Object.prototype.hasOwnProperty;
20013
20493
  var __propIsEnum$m = Object.prototype.propertyIsEnumerable;
20014
- var __defNormalProp$t = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20494
+ var __defNormalProp$u = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20015
20495
  var __spreadValues$l = (a, b) => {
20016
20496
  for (var prop in b || (b = {}))
20017
20497
  if (__hasOwnProp$m.call(b, prop))
20018
- __defNormalProp$t(a, prop, b[prop]);
20498
+ __defNormalProp$u(a, prop, b[prop]);
20019
20499
  if (__getOwnPropSymbols$m)
20020
20500
  for (var prop of __getOwnPropSymbols$m(b)) {
20021
20501
  if (__propIsEnum$m.call(b, prop))
20022
- __defNormalProp$t(a, prop, b[prop]);
20502
+ __defNormalProp$u(a, prop, b[prop]);
20023
20503
  }
20024
20504
  return a;
20025
20505
  };
20026
- var __publicField$k = (obj, key, value) => __defNormalProp$t(obj, typeof key !== "symbol" ? key + "" : key, value);
20506
+ var __publicField$l = (obj, key, value) => __defNormalProp$u(obj, typeof key !== "symbol" ? key + "" : key, value);
20027
20507
  const BOOLEAN_TYPE = "boolean";
20028
20508
  const STRING_TYPE = "string";
20029
20509
  const _ItemProperties = class _ItemProperties {
20030
20510
  constructor(item, propertiesList) {
20031
20511
  this.item = item;
20032
- __publicField$k(this, "options", {});
20033
- __publicField$k(this, "_properties", {});
20034
- __publicField$k(this, "_propertiesList", []);
20512
+ __publicField$l(this, "options", {});
20513
+ __publicField$l(this, "_properties", {});
20514
+ __publicField$l(this, "_propertiesList", []);
20035
20515
  if (propertiesList) {
20036
20516
  propertiesList.forEach(this._setPropertyHandler.bind(this));
20037
20517
  }
@@ -20094,35 +20574,35 @@ const _ItemProperties = class _ItemProperties {
20094
20574
  return Handler;
20095
20575
  }
20096
20576
  };
20097
- __publicField$k(_ItemProperties, "handlers", {
20577
+ __publicField$l(_ItemProperties, "handlers", {
20098
20578
  CheckProperty
20099
20579
  });
20100
20580
  let ItemProperties = _ItemProperties;
20101
20581
 
20102
- var __defProp$s = Object.defineProperty;
20582
+ var __defProp$t = Object.defineProperty;
20103
20583
  var __getOwnPropSymbols$l = Object.getOwnPropertySymbols;
20104
20584
  var __hasOwnProp$l = Object.prototype.hasOwnProperty;
20105
20585
  var __propIsEnum$l = Object.prototype.propertyIsEnumerable;
20106
- var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20586
+ var __defNormalProp$t = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20107
20587
  var __spreadValues$k = (a, b) => {
20108
20588
  for (var prop in b || (b = {}))
20109
20589
  if (__hasOwnProp$l.call(b, prop))
20110
- __defNormalProp$s(a, prop, b[prop]);
20590
+ __defNormalProp$t(a, prop, b[prop]);
20111
20591
  if (__getOwnPropSymbols$l)
20112
20592
  for (var prop of __getOwnPropSymbols$l(b)) {
20113
20593
  if (__propIsEnum$l.call(b, prop))
20114
- __defNormalProp$s(a, prop, b[prop]);
20594
+ __defNormalProp$t(a, prop, b[prop]);
20115
20595
  }
20116
20596
  return a;
20117
20597
  };
20118
- var __publicField$j = (obj, key, value) => __defNormalProp$s(obj, typeof key !== "symbol" ? key + "" : key, value);
20598
+ var __publicField$k = (obj, key, value) => __defNormalProp$t(obj, typeof key !== "symbol" ? key + "" : key, value);
20119
20599
  let ID$1 = 0;
20120
20600
  class Item {
20121
20601
  constructor(options) {
20122
- __publicField$j(this, "options", {});
20123
- __publicField$j(this, "properties");
20124
- __publicField$j(this, "tree");
20125
- __publicField$j(this, "id", ID$1);
20602
+ __publicField$k(this, "options", {});
20603
+ __publicField$k(this, "properties");
20604
+ __publicField$k(this, "tree");
20605
+ __publicField$k(this, "id", ID$1);
20126
20606
  ID$1 += 1;
20127
20607
  this.options = __spreadValues$k({}, options);
20128
20608
  this.tree = new TreeHelper(this);
@@ -20176,25 +20656,25 @@ class WebmapLayerOpacityPropertyHandler extends BaseProperty {
20176
20656
  }
20177
20657
  }
20178
20658
 
20179
- var __defProp$r = Object.defineProperty;
20180
- var __defProps$d = Object.defineProperties;
20181
- var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
20659
+ var __defProp$s = Object.defineProperty;
20660
+ var __defProps$e = Object.defineProperties;
20661
+ var __getOwnPropDescs$e = Object.getOwnPropertyDescriptors;
20182
20662
  var __getOwnPropSymbols$k = Object.getOwnPropertySymbols;
20183
20663
  var __hasOwnProp$k = Object.prototype.hasOwnProperty;
20184
20664
  var __propIsEnum$k = Object.prototype.propertyIsEnumerable;
20185
- var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20665
+ var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20186
20666
  var __spreadValues$j = (a, b) => {
20187
20667
  for (var prop in b || (b = {}))
20188
20668
  if (__hasOwnProp$k.call(b, prop))
20189
- __defNormalProp$r(a, prop, b[prop]);
20669
+ __defNormalProp$s(a, prop, b[prop]);
20190
20670
  if (__getOwnPropSymbols$k)
20191
20671
  for (var prop of __getOwnPropSymbols$k(b)) {
20192
20672
  if (__propIsEnum$k.call(b, prop))
20193
- __defNormalProp$r(a, prop, b[prop]);
20673
+ __defNormalProp$s(a, prop, b[prop]);
20194
20674
  }
20195
20675
  return a;
20196
20676
  };
20197
- var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
20677
+ var __spreadProps$e = (a, b) => __defProps$e(a, __getOwnPropDescs$e(b));
20198
20678
  function getNgwWebmapExtent(webmap) {
20199
20679
  const bottom = webmap["extent_bottom"];
20200
20680
  const left = webmap["extent_left"];
@@ -20262,14 +20742,14 @@ function fetchNgwResourceExtent(item, connector, options) {
20262
20742
  if (resource.cls && resource.cls.indexOf("style") !== -1) {
20263
20743
  return connector.getResource(resource.parent.id, options).then((res) => {
20264
20744
  if (res) {
20265
- return fetchNgwLayerExtent(__spreadProps$d(__spreadValues$j({}, options), {
20745
+ return fetchNgwLayerExtent(__spreadProps$e(__spreadValues$j({}, options), {
20266
20746
  resourceId: res.resource.id,
20267
20747
  connector
20268
20748
  }));
20269
20749
  }
20270
20750
  });
20271
20751
  } else {
20272
- return fetchNgwLayerExtent(__spreadProps$d(__spreadValues$j({}, options), {
20752
+ return fetchNgwLayerExtent(__spreadProps$e(__spreadValues$j({}, options), {
20273
20753
  resourceId: resource.id,
20274
20754
  connector
20275
20755
  }));
@@ -20277,9 +20757,9 @@ function fetchNgwResourceExtent(item, connector, options) {
20277
20757
  }
20278
20758
  }
20279
20759
 
20280
- var __defProp$q = Object.defineProperty;
20281
- var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20282
- var __publicField$i = (obj, key, value) => __defNormalProp$q(obj, typeof key !== "symbol" ? key + "" : key, value);
20760
+ var __defProp$r = Object.defineProperty;
20761
+ var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20762
+ var __publicField$j = (obj, key, value) => __defNormalProp$r(obj, typeof key !== "symbol" ? key + "" : key, value);
20283
20763
  var __async$m = (__this, __arguments, generator) => {
20284
20764
  return new Promise((resolve, reject) => {
20285
20765
  var fulfilled = (value) => {
@@ -20302,9 +20782,9 @@ var __async$m = (__this, __arguments, generator) => {
20302
20782
  };
20303
20783
  class NgwResource {
20304
20784
  constructor() {
20305
- __publicField$i(this, "item");
20306
- __publicField$i(this, "connector");
20307
- __publicField$i(this, "_extent");
20785
+ __publicField$j(this, "item");
20786
+ __publicField$j(this, "connector");
20787
+ __publicField$j(this, "_extent");
20308
20788
  }
20309
20789
  /** @deprecated use {@link NgwResource.getBounds} instead */
20310
20790
  getExtent() {
@@ -20423,23 +20903,23 @@ function updateQmsOptions(qms) {
20423
20903
  };
20424
20904
  }
20425
20905
 
20426
- var __defProp$p = Object.defineProperty;
20906
+ var __defProp$q = Object.defineProperty;
20427
20907
  var __getOwnPropSymbols$j = Object.getOwnPropertySymbols;
20428
20908
  var __hasOwnProp$j = Object.prototype.hasOwnProperty;
20429
20909
  var __propIsEnum$j = Object.prototype.propertyIsEnumerable;
20430
- var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20910
+ var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20431
20911
  var __spreadValues$i = (a, b) => {
20432
20912
  for (var prop in b || (b = {}))
20433
20913
  if (__hasOwnProp$j.call(b, prop))
20434
- __defNormalProp$p(a, prop, b[prop]);
20914
+ __defNormalProp$q(a, prop, b[prop]);
20435
20915
  if (__getOwnPropSymbols$j)
20436
20916
  for (var prop of __getOwnPropSymbols$j(b)) {
20437
20917
  if (__propIsEnum$j.call(b, prop))
20438
- __defNormalProp$p(a, prop, b[prop]);
20918
+ __defNormalProp$q(a, prop, b[prop]);
20439
20919
  }
20440
20920
  return a;
20441
20921
  };
20442
- var __objRest$1 = (source, exclude) => {
20922
+ var __objRest$2 = (source, exclude) => {
20443
20923
  var target = {};
20444
20924
  for (var prop in source)
20445
20925
  if (__hasOwnProp$j.call(source, prop) && exclude.indexOf(prop) < 0)
@@ -20451,7 +20931,7 @@ var __objRest$1 = (source, exclude) => {
20451
20931
  }
20452
20932
  return target;
20453
20933
  };
20454
- var __publicField$h = (obj, key, value) => __defNormalProp$p(obj, typeof key !== "symbol" ? key + "" : key, value);
20934
+ var __publicField$i = (obj, key, value) => __defNormalProp$q(obj, typeof key !== "symbol" ? key + "" : key, value);
20455
20935
  var __async$k = (__this, __arguments, generator) => {
20456
20936
  return new Promise((resolve, reject) => {
20457
20937
  var fulfilled = (value) => {
@@ -20472,11 +20952,11 @@ var __async$k = (__this, __arguments, generator) => {
20472
20952
  step((generator = generator.apply(__this, __arguments)).next());
20473
20953
  });
20474
20954
  };
20475
- const URL = "https://qms.nextgis.com";
20476
- function createQmsAdapter(webMapOrOptions, url = URL, createOpt = {}) {
20955
+ const URL$1 = "https://qms.nextgis.com";
20956
+ function createQmsAdapter(webMapOrOptions, url = URL$1, createOpt = {}) {
20477
20957
  let webMap;
20478
20958
  if ("webMap" in webMapOrOptions) {
20479
- const _a = webMapOrOptions, { webMap: webMap_, url: url_ } = _a, adapterOptions = __objRest$1(_a, ["webMap", "url"]);
20959
+ const _a = webMapOrOptions, { webMap: webMap_, url: url_ } = _a, adapterOptions = __objRest$2(_a, ["webMap", "url"]);
20480
20960
  webMap = webMap_;
20481
20961
  if (url_) {
20482
20962
  url = url_;
@@ -20488,13 +20968,13 @@ function createQmsAdapter(webMapOrOptions, url = URL, createOpt = {}) {
20488
20968
  webMap = webMapOrOptions;
20489
20969
  }
20490
20970
  if (!url) {
20491
- url = URL;
20971
+ url = URL$1;
20492
20972
  }
20493
20973
  class QmsAdapter {
20494
20974
  constructor(map, options) {
20495
- __publicField$h(this, "qms");
20496
- __publicField$h(this, "options");
20497
- __publicField$h(this, "map");
20975
+ __publicField$i(this, "qms");
20976
+ __publicField$i(this, "options");
20977
+ __publicField$i(this, "map");
20498
20978
  this.map = map;
20499
20979
  const opt = __spreadValues$i(__spreadValues$i({}, createOpt), options);
20500
20980
  this.options = opt;
@@ -20548,29 +21028,29 @@ function createQmsAdapter(webMapOrOptions, url = URL, createOpt = {}) {
20548
21028
  return QmsAdapter;
20549
21029
  }
20550
21030
 
20551
- var __defProp$o = Object.defineProperty;
21031
+ var __defProp$p = Object.defineProperty;
20552
21032
  var __getOwnPropSymbols$i = Object.getOwnPropertySymbols;
20553
21033
  var __hasOwnProp$i = Object.prototype.hasOwnProperty;
20554
21034
  var __propIsEnum$i = Object.prototype.propertyIsEnumerable;
20555
- var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
21035
+ var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20556
21036
  var __spreadValues$h = (a, b) => {
20557
21037
  for (var prop in b || (b = {}))
20558
21038
  if (__hasOwnProp$i.call(b, prop))
20559
- __defNormalProp$o(a, prop, b[prop]);
21039
+ __defNormalProp$p(a, prop, b[prop]);
20560
21040
  if (__getOwnPropSymbols$i)
20561
21041
  for (var prop of __getOwnPropSymbols$i(b)) {
20562
21042
  if (__propIsEnum$i.call(b, prop))
20563
- __defNormalProp$o(a, prop, b[prop]);
21043
+ __defNormalProp$p(a, prop, b[prop]);
20564
21044
  }
20565
21045
  return a;
20566
21046
  };
20567
- var __publicField$g = (obj, key, value) => __defNormalProp$o(obj, typeof key !== "symbol" ? key + "" : key, value);
21047
+ var __publicField$h = (obj, key, value) => __defNormalProp$p(obj, typeof key !== "symbol" ? key + "" : key, value);
20568
21048
  class QmsKit {
20569
21049
  constructor(options) {
20570
- __publicField$g(this, "options", {
21050
+ __publicField$h(this, "options", {
20571
21051
  url: "https://qms.nextgis.com"
20572
21052
  });
20573
- __publicField$g(this, "url");
21053
+ __publicField$h(this, "url");
20574
21054
  this.options = __spreadValues$h(__spreadValues$h({}, this.options), options);
20575
21055
  this.url = this.options.url;
20576
21056
  }
@@ -20586,31 +21066,31 @@ class QmsKit {
20586
21066
  return createQmsAdapter({ webMap, url: this.url });
20587
21067
  }
20588
21068
  }
20589
- __publicField$g(QmsKit, "utils", {
21069
+ __publicField$h(QmsKit, "utils", {
20590
21070
  createQmsAdapter
20591
21071
  });
20592
21072
 
20593
- var __defProp$n = Object.defineProperty;
20594
- var __defProps$c = Object.defineProperties;
20595
- var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
21073
+ var __defProp$o = Object.defineProperty;
21074
+ var __defProps$d = Object.defineProperties;
21075
+ var __getOwnPropDescs$d = Object.getOwnPropertyDescriptors;
20596
21076
  var __getOwnPropSymbols$h = Object.getOwnPropertySymbols;
20597
21077
  var __getProtoOf$2 = Object.getPrototypeOf;
20598
21078
  var __hasOwnProp$h = Object.prototype.hasOwnProperty;
20599
21079
  var __propIsEnum$h = Object.prototype.propertyIsEnumerable;
20600
21080
  var __reflectGet$2 = Reflect.get;
20601
- var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
21081
+ var __defNormalProp$o = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20602
21082
  var __spreadValues$g = (a, b) => {
20603
21083
  for (var prop in b || (b = {}))
20604
21084
  if (__hasOwnProp$h.call(b, prop))
20605
- __defNormalProp$n(a, prop, b[prop]);
21085
+ __defNormalProp$o(a, prop, b[prop]);
20606
21086
  if (__getOwnPropSymbols$h)
20607
21087
  for (var prop of __getOwnPropSymbols$h(b)) {
20608
21088
  if (__propIsEnum$h.call(b, prop))
20609
- __defNormalProp$n(a, prop, b[prop]);
21089
+ __defNormalProp$o(a, prop, b[prop]);
20610
21090
  }
20611
21091
  return a;
20612
21092
  };
20613
- var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
21093
+ var __spreadProps$d = (a, b) => __defProps$d(a, __getOwnPropDescs$d(b));
20614
21094
  var __superGet$2 = (cls, obj, key) => __reflectGet$2(__getProtoOf$2(cls), key, obj);
20615
21095
  var __async$j = (__this, __arguments, generator) => {
20616
21096
  return new Promise((resolve, reject) => {
@@ -20655,7 +21135,7 @@ function createBasemapLayerAdapter(_0) {
20655
21135
  class BasemapTileAdapter extends TileAdapter {
20656
21136
  addLayer(opt) {
20657
21137
  return __async$j(this, null, function* () {
20658
- return __superGet$2(BasemapTileAdapter.prototype, this, "addLayer").call(this, __spreadProps$c(__spreadValues$g({}, opt), { url }));
21138
+ return __superGet$2(BasemapTileAdapter.prototype, this, "addLayer").call(this, __spreadProps$d(__spreadValues$g({}, opt), { url }));
20659
21139
  });
20660
21140
  }
20661
21141
  }
@@ -20734,25 +21214,25 @@ function prepareNgwFieldsToPropertiesFilter(fields) {
20734
21214
  return fields;
20735
21215
  }
20736
21216
 
20737
- var __defProp$m = Object.defineProperty;
20738
- var __defProps$b = Object.defineProperties;
20739
- var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
21217
+ var __defProp$n = Object.defineProperty;
21218
+ var __defProps$c = Object.defineProperties;
21219
+ var __getOwnPropDescs$c = Object.getOwnPropertyDescriptors;
20740
21220
  var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
20741
21221
  var __hasOwnProp$g = Object.prototype.hasOwnProperty;
20742
21222
  var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
20743
- var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
21223
+ var __defNormalProp$n = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20744
21224
  var __spreadValues$f = (a, b) => {
20745
21225
  for (var prop in b || (b = {}))
20746
21226
  if (__hasOwnProp$g.call(b, prop))
20747
- __defNormalProp$m(a, prop, b[prop]);
21227
+ __defNormalProp$n(a, prop, b[prop]);
20748
21228
  if (__getOwnPropSymbols$g)
20749
21229
  for (var prop of __getOwnPropSymbols$g(b)) {
20750
21230
  if (__propIsEnum$g.call(b, prop))
20751
- __defNormalProp$m(a, prop, b[prop]);
21231
+ __defNormalProp$n(a, prop, b[prop]);
20752
21232
  }
20753
21233
  return a;
20754
21234
  };
20755
- var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
21235
+ var __spreadProps$c = (a, b) => __defProps$c(a, __getOwnPropDescs$c(b));
20756
21236
  var __async$i = (__this, __arguments, generator) => {
20757
21237
  return new Promise((resolve, reject) => {
20758
21238
  var fulfilled = (value) => {
@@ -20778,13 +21258,13 @@ function fetchNgwLayerItems(options) {
20778
21258
  var _a;
20779
21259
  const filters = options.filters;
20780
21260
  if (filters) {
20781
- let data = yield createFeatureFieldFilterQueries(__spreadProps$b(__spreadValues$f({}, options), {
21261
+ let data = yield createFeatureFieldFilterQueries(__spreadProps$c(__spreadValues$f({}, options), {
20782
21262
  filters
20783
21263
  }));
20784
21264
  const clientFilterValidate = (_a = options.clientFilterValidate) != null ? _a : isFilterWithAnyCase(filters);
20785
21265
  if (clientFilterValidate) {
20786
21266
  data = data.filter((y) => {
20787
- const fields = prepareNgwFieldsToPropertiesFilter(__spreadProps$b(__spreadValues$f({}, y.fields), {
21267
+ const fields = prepareNgwFieldsToPropertiesFilter(__spreadProps$c(__spreadValues$f({}, y.fields), {
20788
21268
  id: y.id
20789
21269
  }));
20790
21270
  const result = propertiesFilter(fields, filters);
@@ -20872,28 +21352,28 @@ function getLayerFilterOptions(options) {
20872
21352
  return filterOptions;
20873
21353
  }
20874
21354
 
20875
- var __defProp$l = Object.defineProperty;
20876
- var __defProps$a = Object.defineProperties;
20877
- var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
21355
+ var __defProp$m = Object.defineProperty;
21356
+ var __defProps$b = Object.defineProperties;
21357
+ var __getOwnPropDescs$b = Object.getOwnPropertyDescriptors;
20878
21358
  var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
20879
21359
  var __getProtoOf$1 = Object.getPrototypeOf;
20880
21360
  var __hasOwnProp$f = Object.prototype.hasOwnProperty;
20881
21361
  var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
20882
21362
  var __reflectGet$1 = Reflect.get;
20883
- var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
21363
+ var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
20884
21364
  var __spreadValues$e = (a, b) => {
20885
21365
  for (var prop in b || (b = {}))
20886
21366
  if (__hasOwnProp$f.call(b, prop))
20887
- __defNormalProp$l(a, prop, b[prop]);
21367
+ __defNormalProp$m(a, prop, b[prop]);
20888
21368
  if (__getOwnPropSymbols$f)
20889
21369
  for (var prop of __getOwnPropSymbols$f(b)) {
20890
21370
  if (__propIsEnum$f.call(b, prop))
20891
- __defNormalProp$l(a, prop, b[prop]);
21371
+ __defNormalProp$m(a, prop, b[prop]);
20892
21372
  }
20893
21373
  return a;
20894
21374
  };
20895
- var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
20896
- var __publicField$f = (obj, key, value) => __defNormalProp$l(obj, typeof key !== "symbol" ? key + "" : key, value);
21375
+ var __spreadProps$b = (a, b) => __defProps$b(a, __getOwnPropDescs$b(b));
21376
+ var __publicField$g = (obj, key, value) => __defNormalProp$m(obj, typeof key !== "symbol" ? key + "" : key, value);
20897
21377
  var __superGet$1 = (cls, obj, key) => __reflectGet$1(__getProtoOf$1(cls), key, obj);
20898
21378
  var __async$g = (__this, __arguments, generator) => {
20899
21379
  return new Promise((resolve, reject) => {
@@ -20966,11 +21446,11 @@ function createGeoJsonAdapter(props) {
20966
21446
  class NgwGeoJsonAdapter extends GeoJsonAdapter {
20967
21447
  constructor() {
20968
21448
  super(...arguments);
20969
- __publicField$f(this, "emitter", new EventEmitter());
20970
- __publicField$f(this, "__onMapMove");
20971
- __publicField$f(this, "__onMapMoveStart");
20972
- __publicField$f(this, "__enableMapMoveListener");
20973
- __publicField$f(this, "__disableMapMoveListener");
21449
+ __publicField$g(this, "emitter", new EventEmitter());
21450
+ __publicField$g(this, "__onMapMove");
21451
+ __publicField$g(this, "__onMapMoveStart");
21452
+ __publicField$g(this, "__enableMapMoveListener");
21453
+ __publicField$g(this, "__disableMapMoveListener");
20974
21454
  }
20975
21455
  addLayer(opt) {
20976
21456
  return __async$g(this, null, function* () {
@@ -21043,10 +21523,10 @@ function createGeoJsonAdapter(props) {
21043
21523
  getCount() {
21044
21524
  return fetchNgwLayerCount({ connector, resourceId, cache: true });
21045
21525
  }
21046
- updateLayer(filterArgs) {
21526
+ updateLayer(opt) {
21047
21527
  return __async$g(this, null, function* () {
21048
21528
  var _a2;
21049
- filterArgs = filterArgs || _lastFilterArgs || {};
21529
+ const filterArgs = opt || _lastFilterArgs || {};
21050
21530
  if ((_a2 = this.options.strategy) == null ? void 0 : _a2.startsWith("BBOX")) {
21051
21531
  yield webMap.onLoad("create");
21052
21532
  filterArgs.options = filterArgs.options || {};
@@ -21071,7 +21551,7 @@ function createGeoJsonAdapter(props) {
21071
21551
  try {
21072
21552
  this.emitter.emit("preupdate", filterArgs);
21073
21553
  webMap._emitLayerEvent("layer:preupdate", options.id || "", filterArgs);
21074
- const data = yield getData(filterArgs.filters, __spreadProps$a(__spreadValues$e({}, filterArgs.options), {
21554
+ const data = yield getData(filterArgs.filters, __spreadProps$b(__spreadValues$e({}, filterArgs.options), {
21075
21555
  srs: this.options.srs
21076
21556
  }));
21077
21557
  let newData = data;
@@ -21124,7 +21604,7 @@ function createGeoJsonAdapter(props) {
21124
21604
  if (this.clearLayer) {
21125
21605
  this.clearLayer();
21126
21606
  }
21127
- const data = yield getData(filters, __spreadProps$a(__spreadValues$e({}, opt), {
21607
+ const data = yield getData(filters, __spreadProps$b(__spreadValues$e({}, opt), {
21128
21608
  srs: this.options.srs
21129
21609
  }));
21130
21610
  this.setData(data);
@@ -21313,26 +21793,26 @@ function ngwApiToAdapterOptions({
21313
21793
  }
21314
21794
  }
21315
21795
 
21316
- var __defProp$k = Object.defineProperty;
21317
- var __defProps$9 = Object.defineProperties;
21318
- var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
21796
+ var __defProp$l = Object.defineProperty;
21797
+ var __defProps$a = Object.defineProperties;
21798
+ var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors;
21319
21799
  var __getOwnPropSymbols$e = Object.getOwnPropertySymbols;
21320
21800
  var __hasOwnProp$e = Object.prototype.hasOwnProperty;
21321
21801
  var __propIsEnum$e = Object.prototype.propertyIsEnumerable;
21322
- var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
21802
+ var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
21323
21803
  var __spreadValues$d = (a, b) => {
21324
21804
  for (var prop in b || (b = {}))
21325
21805
  if (__hasOwnProp$e.call(b, prop))
21326
- __defNormalProp$k(a, prop, b[prop]);
21806
+ __defNormalProp$l(a, prop, b[prop]);
21327
21807
  if (__getOwnPropSymbols$e)
21328
21808
  for (var prop of __getOwnPropSymbols$e(b)) {
21329
21809
  if (__propIsEnum$e.call(b, prop))
21330
- __defNormalProp$k(a, prop, b[prop]);
21810
+ __defNormalProp$l(a, prop, b[prop]);
21331
21811
  }
21332
21812
  return a;
21333
21813
  };
21334
- var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
21335
- var __publicField$e = (obj, key, value) => __defNormalProp$k(obj, typeof key !== "symbol" ? key + "" : key, value);
21814
+ var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b));
21815
+ var __publicField$f = (obj, key, value) => __defNormalProp$l(obj, typeof key !== "symbol" ? key + "" : key, value);
21336
21816
  var __async$e = (__this, __arguments, generator) => {
21337
21817
  return new Promise((resolve, reject) => {
21338
21818
  var fulfilled = (value) => {
@@ -21353,11 +21833,47 @@ var __async$e = (__this, __arguments, generator) => {
21353
21833
  step((generator = generator.apply(__this, __arguments)).next());
21354
21834
  });
21355
21835
  };
21836
+ class Legend {
21837
+ constructor({
21838
+ layerId,
21839
+ legend,
21840
+ onSymbolRenderChange
21841
+ }) {
21842
+ __publicField$f(this, "layerId");
21843
+ __publicField$f(this, "legend");
21844
+ __publicField$f(this, "onSymbolRenderChange");
21845
+ this.layerId = layerId;
21846
+ this.legend = this.createLegend(legend);
21847
+ this.onSymbolRenderChange = onSymbolRenderChange;
21848
+ }
21849
+ createLegend(items) {
21850
+ return items.map((params) => __spreadProps$a(__spreadValues$d({}, params), {
21851
+ /** @deprecated use display_name instead */
21852
+ name: params.display_name,
21853
+ /** @deprecated use icon instead */
21854
+ symbol: params.icon
21855
+ }));
21856
+ }
21857
+ setSymbolRender(symbolIndex, status) {
21858
+ const legendItem = this.legend.find((l) => l.index === symbolIndex);
21859
+ if (legendItem) {
21860
+ const render = legendItem.render;
21861
+ if (render !== status) {
21862
+ legendItem.render = status;
21863
+ if (this.onSymbolRenderChange) {
21864
+ this.onSymbolRenderChange(
21865
+ this.legend.filter((l) => l.render).map((l) => l.index)
21866
+ );
21867
+ }
21868
+ }
21869
+ }
21870
+ }
21871
+ }
21356
21872
  function createRasterAdapter(_0) {
21357
21873
  return __async$e(this, arguments, function* ({
21358
21874
  layerOptions,
21359
- webMap,
21360
21875
  connector,
21876
+ webMap,
21361
21877
  item
21362
21878
  }) {
21363
21879
  const resourceCls = item.resource.cls;
@@ -21386,16 +21902,17 @@ function createRasterAdapter(_0) {
21386
21902
  constructor(map, _options) {
21387
21903
  super(map, _options);
21388
21904
  this.map = map;
21389
- // options = {};
21390
- __publicField$e(this, "item", item);
21391
- __publicField$e(this, "resourceId", resourceId);
21905
+ __publicField$f(this, "item", item);
21906
+ __publicField$f(this, "resourceId", resourceId);
21907
+ __publicField$f(this, "_blocked", false);
21908
+ __publicField$f(this, "_layerVisibility");
21392
21909
  const opt = ngwApiToAdapterOptions({
21393
21910
  options: layerOptions,
21394
21911
  webMap,
21395
21912
  baseUrl: connector.options.baseUrl || ""
21396
21913
  });
21397
21914
  if (opt) {
21398
- const layerAdapterOptions = __spreadProps$9(__spreadValues$d(__spreadValues$d({}, opt), layerOptions.adapterOptions), {
21915
+ const layerAdapterOptions = __spreadProps$a(__spreadValues$d(__spreadValues$d({}, opt), layerOptions.adapterOptions), {
21399
21916
  params: { resource: resourceId },
21400
21917
  layers: opt.layers || String(resourceId),
21401
21918
  resourceId
@@ -21409,25 +21926,19 @@ function createRasterAdapter(_0) {
21409
21926
  addLayer(addOptions) {
21410
21927
  return super.addLayer(__spreadValues$d(__spreadValues$d({}, this.options), addOptions));
21411
21928
  }
21412
- getLegend(options) {
21413
- return __async$e(this, null, function* () {
21414
- const ngwLegend = yield connector.get("render.legend_symbols", __spreadValues$d({
21415
- params: { id: resourceId },
21416
- cache: true
21417
- }, options));
21418
- const id = this.options.id;
21419
- if (id !== void 0) {
21420
- const legend = {
21421
- layerId: id,
21422
- legend: ngwLegend.map(({ display_name, icon }) => ({
21423
- name: display_name,
21424
- symbol: icon
21425
- }))
21426
- };
21427
- return [legend];
21929
+ showLayer() {
21930
+ this._layerVisibility = true;
21931
+ if (this.layer) {
21932
+ if (!this._blocked) {
21933
+ webMap.mapAdapter.showLayer(this.layer);
21428
21934
  }
21429
- return [];
21430
- });
21935
+ }
21936
+ }
21937
+ hideLayer() {
21938
+ this._layerVisibility = false;
21939
+ if (this.layer) {
21940
+ webMap.mapAdapter.hideLayer(this.layer);
21941
+ }
21431
21942
  }
21432
21943
  getIdentificationIds() {
21433
21944
  return __async$e(this, null, function* () {
@@ -21443,8 +21954,69 @@ function createRasterAdapter(_0) {
21443
21954
  return [];
21444
21955
  });
21445
21956
  }
21446
- // beforeRemove() {
21447
- // }
21957
+ getLegend(options) {
21958
+ return __async$e(this, null, function* () {
21959
+ const id = this.options.id;
21960
+ if (id !== void 0) {
21961
+ const ngwLegend = yield connector.get("render.legend_symbols", __spreadValues$d({
21962
+ params: { id: resourceId },
21963
+ cache: true
21964
+ }, options));
21965
+ const legend = new Legend({
21966
+ layerId: id,
21967
+ legend: ngwLegend,
21968
+ onSymbolRenderChange: this._setLegendSymbol.bind(this)
21969
+ });
21970
+ return [legend];
21971
+ }
21972
+ return [];
21973
+ });
21974
+ }
21975
+ _hideLayer() {
21976
+ if (this.options.id) {
21977
+ webMap.mapAdapter.hideLayer(this.layer);
21978
+ }
21979
+ }
21980
+ _showLayer() {
21981
+ if (this.options.id) {
21982
+ if (this._layerVisibility) {
21983
+ webMap.showLayer(this.options.id, { silent: true });
21984
+ }
21985
+ }
21986
+ }
21987
+ _setLegendSymbol(renderIndexes) {
21988
+ const intervals = this._consolidateIntervals(renderIndexes);
21989
+ if (!intervals.length) {
21990
+ this._hideLayer();
21991
+ this._blocked = true;
21992
+ } else {
21993
+ this._blocked = false;
21994
+ this._showLayer();
21995
+ }
21996
+ if (this.updateLayer) {
21997
+ this.updateLayer({
21998
+ params: {
21999
+ [`symbols[${resourceId}]`]: intervals.join(",") || void 0
22000
+ }
22001
+ });
22002
+ }
22003
+ }
22004
+ _consolidateIntervals(symbols) {
22005
+ const sortedSymbols = symbols.slice().sort((a, b) => a - b);
22006
+ const intervals = [];
22007
+ let start = sortedSymbols[0];
22008
+ let end = start;
22009
+ for (let i = 1; i <= sortedSymbols.length; i++) {
22010
+ if (sortedSymbols[i] === end + 1) {
22011
+ end = sortedSymbols[i];
22012
+ } else {
22013
+ intervals.push(start === end ? `${start}` : `${start}-${end}`);
22014
+ start = sortedSymbols[i];
22015
+ end = start;
22016
+ }
22017
+ }
22018
+ return intervals;
22019
+ }
21448
22020
  };
21449
22021
  } else {
21450
22022
  throw new Error(adapter + " not supported yet. Only TILE");
@@ -21452,25 +22024,25 @@ function createRasterAdapter(_0) {
21452
22024
  });
21453
22025
  }
21454
22026
 
21455
- var __defProp$j = Object.defineProperty;
21456
- var __defProps$8 = Object.defineProperties;
21457
- var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
22027
+ var __defProp$k = Object.defineProperty;
22028
+ var __defProps$9 = Object.defineProperties;
22029
+ var __getOwnPropDescs$9 = Object.getOwnPropertyDescriptors;
21458
22030
  var __getOwnPropSymbols$d = Object.getOwnPropertySymbols;
21459
22031
  var __hasOwnProp$d = Object.prototype.hasOwnProperty;
21460
22032
  var __propIsEnum$d = Object.prototype.propertyIsEnumerable;
21461
- var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
22033
+ var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
21462
22034
  var __spreadValues$c = (a, b) => {
21463
22035
  for (var prop in b || (b = {}))
21464
22036
  if (__hasOwnProp$d.call(b, prop))
21465
- __defNormalProp$j(a, prop, b[prop]);
22037
+ __defNormalProp$k(a, prop, b[prop]);
21466
22038
  if (__getOwnPropSymbols$d)
21467
22039
  for (var prop of __getOwnPropSymbols$d(b)) {
21468
22040
  if (__propIsEnum$d.call(b, prop))
21469
- __defNormalProp$j(a, prop, b[prop]);
22041
+ __defNormalProp$k(a, prop, b[prop]);
21470
22042
  }
21471
22043
  return a;
21472
22044
  };
21473
- var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
22045
+ var __spreadProps$9 = (a, b) => __defProps$9(a, __getOwnPropDescs$9(b));
21474
22046
  var __async$d = (__this, __arguments, generator) => {
21475
22047
  return new Promise((resolve, reject) => {
21476
22048
  var fulfilled = (value) => {
@@ -21518,7 +22090,7 @@ function createAdapterFromFirstStyle(_0) {
21518
22090
  const firstStyle = childrenStyles && childrenStyles[0];
21519
22091
  if (firstStyle) {
21520
22092
  return createAsyncAdapter(
21521
- __spreadProps$8(__spreadValues$c({}, layerOptions), { resource: firstStyle.resource.id }),
22093
+ __spreadProps$9(__spreadValues$c({}, layerOptions), { resource: firstStyle.resource.id }),
21522
22094
  webMap,
21523
22095
  connector
21524
22096
  );
@@ -21541,7 +22113,7 @@ function createAsyncAdapter(options, webMap, connector) {
21541
22113
  }
21542
22114
  if (item) {
21543
22115
  const cls = item.resource.cls;
21544
- const layerOptions = __spreadProps$8(__spreadValues$c({}, options), {
22116
+ const layerOptions = __spreadProps$9(__spreadValues$c({}, options), {
21545
22117
  resource: resourceId
21546
22118
  });
21547
22119
  const adapterOptions = {
@@ -21578,10 +22150,10 @@ function createAsyncAdapter(options, webMap, connector) {
21578
22150
  item.resource.parent.id
21579
22151
  );
21580
22152
  if (parentItem) {
21581
- const parentOptions = __spreadProps$8(__spreadValues$c({}, options), {
22153
+ const parentOptions = __spreadProps$9(__spreadValues$c({}, options), {
21582
22154
  resource: item.resource.parent.id
21583
22155
  });
21584
- adapter = createGeoJsonAdapter(__spreadProps$8(__spreadValues$c({}, adapterOptions), {
22156
+ adapter = createGeoJsonAdapter(__spreadProps$9(__spreadValues$c({}, adapterOptions), {
21585
22157
  item: parentItem,
21586
22158
  layerOptions: parentOptions
21587
22159
  }));
@@ -21625,31 +22197,46 @@ function createAsyncAdapter(options, webMap, connector) {
21625
22197
  });
21626
22198
  }
21627
22199
 
21628
- var __defProp$i = Object.defineProperty;
22200
+ var __defProp$j = Object.defineProperty;
22201
+ var __defProps$8 = Object.defineProperties;
22202
+ var __getOwnPropDescs$8 = Object.getOwnPropertyDescriptors;
21629
22203
  var __getOwnPropSymbols$c = Object.getOwnPropertySymbols;
21630
22204
  var __hasOwnProp$c = Object.prototype.hasOwnProperty;
21631
22205
  var __propIsEnum$c = Object.prototype.propertyIsEnumerable;
21632
- var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
22206
+ var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
21633
22207
  var __spreadValues$b = (a, b) => {
21634
22208
  for (var prop in b || (b = {}))
21635
22209
  if (__hasOwnProp$c.call(b, prop))
21636
- __defNormalProp$i(a, prop, b[prop]);
22210
+ __defNormalProp$j(a, prop, b[prop]);
21637
22211
  if (__getOwnPropSymbols$c)
21638
22212
  for (var prop of __getOwnPropSymbols$c(b)) {
21639
22213
  if (__propIsEnum$c.call(b, prop))
21640
- __defNormalProp$i(a, prop, b[prop]);
22214
+ __defNormalProp$j(a, prop, b[prop]);
21641
22215
  }
21642
22216
  return a;
21643
22217
  };
22218
+ var __spreadProps$8 = (a, b) => __defProps$8(a, __getOwnPropDescs$8(b));
22219
+ var __objRest$1 = (source, exclude) => {
22220
+ var target = {};
22221
+ for (var prop in source)
22222
+ if (__hasOwnProp$c.call(source, prop) && exclude.indexOf(prop) < 0)
22223
+ target[prop] = source[prop];
22224
+ if (source != null && __getOwnPropSymbols$c)
22225
+ for (var prop of __getOwnPropSymbols$c(source)) {
22226
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$c.call(source, prop))
22227
+ target[prop] = source[prop];
22228
+ }
22229
+ return target;
22230
+ };
21644
22231
  function updateImageParams(params, resourceId) {
21645
- const { bbox, width, height, nd } = params;
21646
- return {
22232
+ const _a = params, { bbox, width, height, nd } = _a, rest = __objRest$1(_a, ["bbox", "width", "height", "nd"]);
22233
+ return __spreadProps$8(__spreadValues$b({}, rest), {
21647
22234
  resource: Array.isArray(resourceId) ? resourceId.join(",") : resourceId,
21648
22235
  extent: bbox,
21649
22236
  size: width + "," + height,
21650
22237
  timestamp: Date.now(),
21651
22238
  nd: nd != null ? nd : 200
21652
- };
22239
+ });
21653
22240
  }
21654
22241
  const vectorLayerGeomToPaintTypeAlias = {
21655
22242
  POINT: "point",
@@ -21709,26 +22296,26 @@ function setScaleRatio(scale, lat = 0) {
21709
22296
  return zoom;
21710
22297
  }
21711
22298
 
21712
- var __defProp$h = Object.defineProperty;
22299
+ var __defProp$i = Object.defineProperty;
21713
22300
  var __defProps$7 = Object.defineProperties;
21714
22301
  var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
21715
22302
  var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
21716
22303
  var __hasOwnProp$b = Object.prototype.hasOwnProperty;
21717
22304
  var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
21718
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
22305
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
21719
22306
  var __spreadValues$a = (a, b) => {
21720
22307
  for (var prop in b || (b = {}))
21721
22308
  if (__hasOwnProp$b.call(b, prop))
21722
- __defNormalProp$h(a, prop, b[prop]);
22309
+ __defNormalProp$i(a, prop, b[prop]);
21723
22310
  if (__getOwnPropSymbols$b)
21724
22311
  for (var prop of __getOwnPropSymbols$b(b)) {
21725
22312
  if (__propIsEnum$b.call(b, prop))
21726
- __defNormalProp$h(a, prop, b[prop]);
22313
+ __defNormalProp$i(a, prop, b[prop]);
21727
22314
  }
21728
22315
  return a;
21729
22316
  };
21730
22317
  var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
21731
- var __publicField$d = (obj, key, value) => __defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value);
22318
+ var __publicField$e = (obj, key, value) => __defNormalProp$i(obj, typeof key !== "symbol" ? key + "" : key, value);
21732
22319
  var __async$c = (__this, __arguments, generator) => {
21733
22320
  return new Promise((resolve, reject) => {
21734
22321
  var fulfilled = (value) => {
@@ -21753,11 +22340,11 @@ const _NgwWebmapItem = class _NgwWebmapItem extends Item {
21753
22340
  constructor(webMap, item, options, connector, parent, noInit) {
21754
22341
  super(__spreadValues$a(__spreadValues$a({}, _NgwWebmapItem.options), options));
21755
22342
  this.webMap = webMap;
21756
- __publicField$d(this, "item");
21757
- __publicField$d(this, "connector");
21758
- __publicField$d(this, "layer");
21759
- __publicField$d(this, "emitter", new EventEmitter());
21760
- __publicField$d(this, "_rootDescendantsCount", 0);
22343
+ __publicField$e(this, "item");
22344
+ __publicField$e(this, "connector");
22345
+ __publicField$e(this, "layer");
22346
+ __publicField$e(this, "emitter", new EventEmitter());
22347
+ __publicField$e(this, "_rootDescendantsCount", 0);
21761
22348
  if (connector) {
21762
22349
  this.connector = connector;
21763
22350
  }
@@ -21819,10 +22406,12 @@ const _NgwWebmapItem = class _NgwWebmapItem extends Item {
21819
22406
  }, options));
21820
22407
  const legend = {
21821
22408
  layerId: id,
21822
- legend: ngwLegend.map(({ display_name, icon }) => ({
21823
- name: display_name,
21824
- symbol: icon
21825
- }))
22409
+ legend: ngwLegend.map((legend2) => __spreadValues$a({
22410
+ /** @deprecated use display_name instead */
22411
+ name: legend2.display_name,
22412
+ /** @deprecated use icon instead */
22413
+ symbol: legend2.icon
22414
+ }, legend2))
21826
22415
  };
21827
22416
  return [legend];
21828
22417
  }
@@ -21945,8 +22534,8 @@ const _NgwWebmapItem = class _NgwWebmapItem extends Item {
21945
22534
  return totalValue;
21946
22535
  }
21947
22536
  };
21948
- __publicField$d(_NgwWebmapItem, "GetAdapterFromLayerType", {});
21949
- __publicField$d(_NgwWebmapItem, "options", {
22537
+ __publicField$e(_NgwWebmapItem, "GetAdapterFromLayerType", {});
22538
+ __publicField$e(_NgwWebmapItem, "options", {
21950
22539
  properties: [
21951
22540
  {
21952
22541
  type: "boolean",
@@ -21986,23 +22575,23 @@ __publicField$d(_NgwWebmapItem, "options", {
21986
22575
  });
21987
22576
  let NgwWebmapItem = _NgwWebmapItem;
21988
22577
 
21989
- var __defProp$g = Object.defineProperty;
22578
+ var __defProp$h = Object.defineProperty;
21990
22579
  var __getOwnPropSymbols$a = Object.getOwnPropertySymbols;
21991
22580
  var __hasOwnProp$a = Object.prototype.hasOwnProperty;
21992
22581
  var __propIsEnum$a = Object.prototype.propertyIsEnumerable;
21993
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
22582
+ var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
21994
22583
  var __spreadValues$9 = (a, b) => {
21995
22584
  for (var prop in b || (b = {}))
21996
22585
  if (__hasOwnProp$a.call(b, prop))
21997
- __defNormalProp$g(a, prop, b[prop]);
22586
+ __defNormalProp$h(a, prop, b[prop]);
21998
22587
  if (__getOwnPropSymbols$a)
21999
22588
  for (var prop of __getOwnPropSymbols$a(b)) {
22000
22589
  if (__propIsEnum$a.call(b, prop))
22001
- __defNormalProp$g(a, prop, b[prop]);
22590
+ __defNormalProp$h(a, prop, b[prop]);
22002
22591
  }
22003
22592
  return a;
22004
22593
  };
22005
- var __publicField$c = (obj, key, value) => __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
22594
+ var __publicField$d = (obj, key, value) => __defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value);
22006
22595
  var __async$b = (__this, __arguments, generator) => {
22007
22596
  return new Promise((resolve, reject) => {
22008
22597
  var fulfilled = (value) => {
@@ -22032,10 +22621,10 @@ function createOnFirstShowAdapter(_0) {
22032
22621
  }) {
22033
22622
  class OnFirstShowAdapter {
22034
22623
  constructor() {
22035
- __publicField$c(this, "options", {});
22036
- __publicField$c(this, "layer", []);
22037
- __publicField$c(this, "_removed", false);
22038
- __publicField$c(this, "_creatingInProgress", false);
22624
+ __publicField$d(this, "options", {});
22625
+ __publicField$d(this, "layer", []);
22626
+ __publicField$d(this, "_removed", false);
22627
+ __publicField$d(this, "_creatingInProgress", false);
22039
22628
  }
22040
22629
  addLayer() {
22041
22630
  return this.layer;
@@ -22163,26 +22752,26 @@ function createOnFirstShowNgwAdapter(_0) {
22163
22752
 
22164
22753
  const WEBMAP_BASELAYER_ID_PREFIX = "webmap-baselayer";
22165
22754
 
22166
- var __defProp$f = Object.defineProperty;
22755
+ var __defProp$g = Object.defineProperty;
22167
22756
  var __defProps$6 = Object.defineProperties;
22168
22757
  var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
22169
22758
  var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
22170
22759
  var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
22171
22760
  var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
22172
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
22761
+ var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
22173
22762
  var __spreadValues$8 = (a, b) => {
22174
22763
  for (var prop in b || (b = {}))
22175
22764
  if (__hasOwnProp$9.call(b, prop))
22176
- __defNormalProp$f(a, prop, b[prop]);
22765
+ __defNormalProp$g(a, prop, b[prop]);
22177
22766
  if (__getOwnPropSymbols$9)
22178
22767
  for (var prop of __getOwnPropSymbols$9(b)) {
22179
22768
  if (__propIsEnum$9.call(b, prop))
22180
- __defNormalProp$f(a, prop, b[prop]);
22769
+ __defNormalProp$g(a, prop, b[prop]);
22181
22770
  }
22182
22771
  return a;
22183
22772
  };
22184
22773
  var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
22185
- var __publicField$b = (obj, key, value) => __defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
22774
+ var __publicField$c = (obj, key, value) => __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
22186
22775
  var __async$9 = (__this, __arguments, generator) => {
22187
22776
  return new Promise((resolve, reject) => {
22188
22777
  var fulfilled = (value) => {
@@ -22207,21 +22796,20 @@ class NgwWebmapLayerAdapter {
22207
22796
  constructor(map, options) {
22208
22797
  this.map = map;
22209
22798
  this.options = options;
22210
- __publicField$b(this, "layer");
22211
- __publicField$b(this, "NgwWebmapItem", NgwWebmapItem);
22799
+ __publicField$c(this, "layer");
22800
+ __publicField$c(this, "NgwWebmapItem", NgwWebmapItem);
22212
22801
  /**
22213
22802
  * Radius for searching objects in pixels
22214
22803
  */
22215
- __publicField$b(this, "pixelRadius", 10);
22804
+ __publicField$c(this, "pixelRadius", 10);
22216
22805
  // webmapSettings.identify_radius,
22217
- __publicField$b(this, "resourceId");
22218
- __publicField$b(this, "webmapClassName", "webmap");
22219
- __publicField$b(this, "emitter", new EventEmitter());
22220
- __publicField$b(this, "_extent");
22221
- __publicField$b(this, "response");
22222
- __publicField$b(this, "_webmapLayersIds");
22223
- __publicField$b(this, "_webmapBaselayersIds", []);
22224
- __publicField$b(this, "_lastActiveBaselayer");
22806
+ __publicField$c(this, "resourceId");
22807
+ __publicField$c(this, "webmapClassName", "webmap");
22808
+ __publicField$c(this, "emitter", new EventEmitter());
22809
+ __publicField$c(this, "_extent");
22810
+ __publicField$c(this, "response");
22811
+ __publicField$c(this, "_webmapBaselayersIds", []);
22812
+ __publicField$c(this, "_lastActiveBaselayer");
22225
22813
  const r = options.resourceId;
22226
22814
  if (Array.isArray(r)) {
22227
22815
  this.resourceId = r[0];
@@ -22264,7 +22852,6 @@ class NgwWebmapLayerAdapter {
22264
22852
  }
22265
22853
  delete this.layer;
22266
22854
  delete this.response;
22267
- delete this._webmapLayersIds;
22268
22855
  }
22269
22856
  showLayer() {
22270
22857
  return __async$9(this, null, function* () {
@@ -22355,26 +22942,19 @@ class NgwWebmapLayerAdapter {
22355
22942
  getIdentificationIds(options) {
22356
22943
  return __async$9(this, null, function* () {
22357
22944
  const visibleLayers = [];
22358
- let ids = this._webmapLayersIds;
22359
- if (!ids) {
22360
- ids = yield this._getWebMapIds(options);
22361
- this._webmapLayersIds = ids;
22362
- }
22363
- if (ids && ids.length) {
22364
- let deps = this.getDependLayers();
22365
- deps = deps.sort((a, b) => b.id - a.id);
22366
- deps.forEach((x) => {
22367
- const item = x.item;
22368
- const parentId = item.parentId;
22369
- if (parentId !== void 0 && item.item_type === "layer" && item.layer_identifiable) {
22370
- const visible = x.properties.property("visibility");
22371
- const isVisible = visible.get() && !visible.isBlocked();
22372
- if (isVisible) {
22373
- visibleLayers.push(parentId);
22374
- }
22945
+ let deps = this.getDependLayers();
22946
+ deps = deps.sort((a, b) => b.id - a.id);
22947
+ deps.forEach((x) => {
22948
+ const item = x.item;
22949
+ const parentId = item.style_parent_id;
22950
+ if (parentId !== void 0 && item.item_type === "layer" && item.layer_identifiable) {
22951
+ const visible = x.properties.property("visibility");
22952
+ const isVisible = visible.get() && !visible.isBlocked();
22953
+ if (isVisible) {
22954
+ visibleLayers.push(parentId);
22375
22955
  }
22376
- });
22377
- }
22956
+ }
22957
+ });
22378
22958
  return visibleLayers;
22379
22959
  });
22380
22960
  }
@@ -22503,50 +23083,25 @@ class NgwWebmapLayerAdapter {
22503
23083
  }
22504
23084
  return item;
22505
23085
  }
22506
- _getWebMapIds(options) {
22507
- return __async$9(this, null, function* () {
22508
- const webMapItem = this.layer;
22509
- if (webMapItem && webMapItem.item.item_type === "root") {
22510
- const layers = webMapItem.tree.getDescendants();
22511
- const promises = [];
22512
- for (const x of layers) {
22513
- const item = x.item;
22514
- if (item.item_type === "layer") {
22515
- const id = item.layer_style_id;
22516
- const promise = this.options.connector.getResource(id, options).then((y) => {
22517
- if (y) {
22518
- const parentId = Number(y.resource.parent.id);
22519
- item.parentId = parentId;
22520
- return parentId;
22521
- }
22522
- });
22523
- promises.push(promise);
22524
- }
22525
- }
22526
- const ids = yield Promise.all(promises);
22527
- return ids.filter((x) => x !== void 0);
22528
- }
22529
- });
22530
- }
22531
23086
  }
22532
23087
 
22533
- var __defProp$e = Object.defineProperty;
23088
+ var __defProp$f = Object.defineProperty;
22534
23089
  var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
22535
23090
  var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
22536
23091
  var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
22537
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
23092
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
22538
23093
  var __spreadValues$7 = (a, b) => {
22539
23094
  for (var prop in b || (b = {}))
22540
23095
  if (__hasOwnProp$8.call(b, prop))
22541
- __defNormalProp$e(a, prop, b[prop]);
23096
+ __defNormalProp$f(a, prop, b[prop]);
22542
23097
  if (__getOwnPropSymbols$8)
22543
23098
  for (var prop of __getOwnPropSymbols$8(b)) {
22544
23099
  if (__propIsEnum$8.call(b, prop))
22545
- __defNormalProp$e(a, prop, b[prop]);
23100
+ __defNormalProp$f(a, prop, b[prop]);
22546
23101
  }
22547
23102
  return a;
22548
23103
  };
22549
- var __publicField$a = (obj, key, value) => __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
23104
+ var __publicField$b = (obj, key, value) => __defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
22550
23105
  var __async$8 = (__this, __arguments, generator) => {
22551
23106
  return new Promise((resolve, reject) => {
22552
23107
  var fulfilled = (value) => {
@@ -22570,9 +23125,9 @@ var __async$8 = (__this, __arguments, generator) => {
22570
23125
  class NgwKit {
22571
23126
  constructor(options) {
22572
23127
  this.options = options;
22573
- __publicField$a(this, "url");
22574
- __publicField$a(this, "connector");
22575
- __publicField$a(this, "webMap");
23128
+ __publicField$b(this, "url");
23129
+ __publicField$b(this, "connector");
23130
+ __publicField$b(this, "webMap");
22576
23131
  if (this.options.connector) {
22577
23132
  this.url = this.options.connector.options.baseUrl || "";
22578
23133
  this.connector = this.options.connector;
@@ -22582,7 +23137,7 @@ class NgwKit {
22582
23137
  } else {
22583
23138
  throw new Error("url is not defined");
22584
23139
  }
22585
- this.connector = new NgwConnector({
23140
+ this.connector = new NgwConnectorExtended({
22586
23141
  baseUrl: this.url,
22587
23142
  auth: this.options.auth
22588
23143
  });
@@ -22633,37 +23188,37 @@ class NgwKit {
22633
23188
  }
22634
23189
  }
22635
23190
 
22636
- var __defProp$d = Object.defineProperty;
23191
+ var __defProp$e = Object.defineProperty;
22637
23192
  var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
22638
23193
  var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
22639
23194
  var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
22640
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
23195
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
22641
23196
  var __spreadValues$6 = (a, b) => {
22642
23197
  for (var prop in b || (b = {}))
22643
23198
  if (__hasOwnProp$7.call(b, prop))
22644
- __defNormalProp$d(a, prop, b[prop]);
23199
+ __defNormalProp$e(a, prop, b[prop]);
22645
23200
  if (__getOwnPropSymbols$7)
22646
23201
  for (var prop of __getOwnPropSymbols$7(b)) {
22647
23202
  if (__propIsEnum$7.call(b, prop))
22648
- __defNormalProp$d(a, prop, b[prop]);
23203
+ __defNormalProp$e(a, prop, b[prop]);
22649
23204
  }
22650
23205
  return a;
22651
23206
  };
22652
- var __publicField$9 = (obj, key, value) => __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
23207
+ var __publicField$a = (obj, key, value) => __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
22653
23208
  class IdentifyItem {
22654
23209
  constructor(options) {
22655
- __publicField$9(this, "id");
22656
- __publicField$9(this, "label");
22657
- __publicField$9(this, "layerId");
22658
- __publicField$9(this, "parent");
22659
- __publicField$9(this, "fields");
22660
- __publicField$9(this, "geom");
22661
- __publicField$9(this, "extensions");
22662
- __publicField$9(this, "connector");
22663
- __publicField$9(this, "_item");
22664
- __publicField$9(this, "_geojson");
22665
- __publicField$9(this, "_resource");
22666
- __publicField$9(this, "_extent");
23210
+ __publicField$a(this, "id");
23211
+ __publicField$a(this, "label");
23212
+ __publicField$a(this, "layerId");
23213
+ __publicField$a(this, "parent");
23214
+ __publicField$a(this, "fields");
23215
+ __publicField$a(this, "geom");
23216
+ __publicField$a(this, "extensions");
23217
+ __publicField$a(this, "connector");
23218
+ __publicField$a(this, "_item");
23219
+ __publicField$a(this, "_geojson");
23220
+ __publicField$a(this, "_resource");
23221
+ __publicField$a(this, "_extent");
22667
23222
  const f = options.feature;
22668
23223
  this.id = f.id;
22669
23224
  this.geom = f.geom;
@@ -22749,21 +23304,21 @@ function fetchNgwLayerFeature(options) {
22749
23304
  });
22750
23305
  }
22751
23306
 
22752
- var __defProp$c = Object.defineProperty;
23307
+ var __defProp$d = Object.defineProperty;
22753
23308
  var __defProps$5 = Object.defineProperties;
22754
23309
  var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
22755
23310
  var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
22756
23311
  var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
22757
23312
  var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
22758
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
23313
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
22759
23314
  var __spreadValues$5 = (a, b) => {
22760
23315
  for (var prop in b || (b = {}))
22761
23316
  if (__hasOwnProp$6.call(b, prop))
22762
- __defNormalProp$c(a, prop, b[prop]);
23317
+ __defNormalProp$d(a, prop, b[prop]);
22763
23318
  if (__getOwnPropSymbols$6)
22764
23319
  for (var prop of __getOwnPropSymbols$6(b)) {
22765
23320
  if (__propIsEnum$6.call(b, prop))
22766
- __defNormalProp$c(a, prop, b[prop]);
23321
+ __defNormalProp$d(a, prop, b[prop]);
22767
23322
  }
22768
23323
  return a;
22769
23324
  };
@@ -22967,95 +23522,95 @@ function getCompanyLogo(connector, options) {
22967
23522
  });
22968
23523
  }
22969
23524
 
22970
- var __defProp$b = Object.defineProperty;
22971
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
22972
- var __publicField$8 = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
23525
+ var __defProp$c = Object.defineProperty;
23526
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
23527
+ var __publicField$9 = (obj, key, value) => __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
22973
23528
  class KeyCodes {
22974
23529
  constructor() {
22975
- __publicField$8(this, "backspace", 8);
22976
- __publicField$8(this, "tab", 9);
22977
- __publicField$8(this, "enter", 13);
22978
- __publicField$8(this, "shift", 16);
22979
- __publicField$8(this, "ctrl", 17);
22980
- __publicField$8(this, "alt", 18);
22981
- __publicField$8(this, "pause/break", 19);
22982
- __publicField$8(this, "caps_lock", 20);
22983
- __publicField$8(this, "escape", 27);
22984
- __publicField$8(this, "page_up", 33);
22985
- __publicField$8(this, "page_down", 34);
22986
- __publicField$8(this, "end", 35);
22987
- __publicField$8(this, "home", 36);
22988
- __publicField$8(this, "left_arrow", 37);
22989
- __publicField$8(this, "up_arrow", 38);
22990
- __publicField$8(this, "right_arrow", 39);
22991
- __publicField$8(this, "down_arrow", 40);
22992
- __publicField$8(this, "insert", 45);
22993
- __publicField$8(this, "delete", 46);
22994
- __publicField$8(this, "left_window_key", 91);
22995
- __publicField$8(this, "right_window_key", 92);
22996
- __publicField$8(this, "select_key", 93);
22997
- __publicField$8(this, "numpad_0", 96);
22998
- __publicField$8(this, "numpad_1", 97);
22999
- __publicField$8(this, "numpad_2", 98);
23000
- __publicField$8(this, "numpad_3", 99);
23001
- __publicField$8(this, "numpad_4", 100);
23002
- __publicField$8(this, "numpad_5", 101);
23003
- __publicField$8(this, "numpad_6", 102);
23004
- __publicField$8(this, "numpad_7", 103);
23005
- __publicField$8(this, "numpad_8", 104);
23006
- __publicField$8(this, "numpad_9", 105);
23007
- __publicField$8(this, "multiply", 106);
23008
- __publicField$8(this, "add", 107);
23009
- __publicField$8(this, "subtract", 109);
23010
- __publicField$8(this, "decimal_point", 110);
23011
- __publicField$8(this, "divide", 111);
23012
- __publicField$8(this, "f1", 112);
23013
- __publicField$8(this, "f2", 113);
23014
- __publicField$8(this, "f3", 114);
23015
- __publicField$8(this, "f4", 115);
23016
- __publicField$8(this, "f5", 116);
23017
- __publicField$8(this, "f6", 117);
23018
- __publicField$8(this, "f7", 118);
23019
- __publicField$8(this, "f8", 119);
23020
- __publicField$8(this, "f9", 120);
23021
- __publicField$8(this, "f10", 121);
23022
- __publicField$8(this, "f11", 122);
23023
- __publicField$8(this, "f12", 123);
23024
- __publicField$8(this, "num_lock", 144);
23025
- __publicField$8(this, "scroll_lock", 145);
23026
- __publicField$8(this, "semi-colon", 186);
23027
- __publicField$8(this, "equal_sign", 187);
23028
- __publicField$8(this, ",", 188);
23530
+ __publicField$9(this, "backspace", 8);
23531
+ __publicField$9(this, "tab", 9);
23532
+ __publicField$9(this, "enter", 13);
23533
+ __publicField$9(this, "shift", 16);
23534
+ __publicField$9(this, "ctrl", 17);
23535
+ __publicField$9(this, "alt", 18);
23536
+ __publicField$9(this, "pause/break", 19);
23537
+ __publicField$9(this, "caps_lock", 20);
23538
+ __publicField$9(this, "escape", 27);
23539
+ __publicField$9(this, "page_up", 33);
23540
+ __publicField$9(this, "page_down", 34);
23541
+ __publicField$9(this, "end", 35);
23542
+ __publicField$9(this, "home", 36);
23543
+ __publicField$9(this, "left_arrow", 37);
23544
+ __publicField$9(this, "up_arrow", 38);
23545
+ __publicField$9(this, "right_arrow", 39);
23546
+ __publicField$9(this, "down_arrow", 40);
23547
+ __publicField$9(this, "insert", 45);
23548
+ __publicField$9(this, "delete", 46);
23549
+ __publicField$9(this, "left_window_key", 91);
23550
+ __publicField$9(this, "right_window_key", 92);
23551
+ __publicField$9(this, "select_key", 93);
23552
+ __publicField$9(this, "numpad_0", 96);
23553
+ __publicField$9(this, "numpad_1", 97);
23554
+ __publicField$9(this, "numpad_2", 98);
23555
+ __publicField$9(this, "numpad_3", 99);
23556
+ __publicField$9(this, "numpad_4", 100);
23557
+ __publicField$9(this, "numpad_5", 101);
23558
+ __publicField$9(this, "numpad_6", 102);
23559
+ __publicField$9(this, "numpad_7", 103);
23560
+ __publicField$9(this, "numpad_8", 104);
23561
+ __publicField$9(this, "numpad_9", 105);
23562
+ __publicField$9(this, "multiply", 106);
23563
+ __publicField$9(this, "add", 107);
23564
+ __publicField$9(this, "subtract", 109);
23565
+ __publicField$9(this, "decimal_point", 110);
23566
+ __publicField$9(this, "divide", 111);
23567
+ __publicField$9(this, "f1", 112);
23568
+ __publicField$9(this, "f2", 113);
23569
+ __publicField$9(this, "f3", 114);
23570
+ __publicField$9(this, "f4", 115);
23571
+ __publicField$9(this, "f5", 116);
23572
+ __publicField$9(this, "f6", 117);
23573
+ __publicField$9(this, "f7", 118);
23574
+ __publicField$9(this, "f8", 119);
23575
+ __publicField$9(this, "f9", 120);
23576
+ __publicField$9(this, "f10", 121);
23577
+ __publicField$9(this, "f11", 122);
23578
+ __publicField$9(this, "f12", 123);
23579
+ __publicField$9(this, "num_lock", 144);
23580
+ __publicField$9(this, "scroll_lock", 145);
23581
+ __publicField$9(this, "semi-colon", 186);
23582
+ __publicField$9(this, "equal_sign", 187);
23583
+ __publicField$9(this, ",", 188);
23029
23584
  // "comma";
23030
- __publicField$8(this, "-", 189);
23585
+ __publicField$9(this, "-", 189);
23031
23586
  // "dash";
23032
- __publicField$8(this, ".", 190);
23587
+ __publicField$9(this, ".", 190);
23033
23588
  // "period";
23034
- __publicField$8(this, "/", 191);
23589
+ __publicField$9(this, "/", 191);
23035
23590
  // "forward slash";
23036
- __publicField$8(this, "`", 192);
23591
+ __publicField$9(this, "`", 192);
23037
23592
  // "grave accent";
23038
- __publicField$8(this, "[", 219);
23593
+ __publicField$9(this, "[", 219);
23039
23594
  // "open bracket";
23040
- __publicField$8(this, "\\", 220);
23595
+ __publicField$9(this, "\\", 220);
23041
23596
  // "back slash";
23042
- __publicField$8(this, "]", 221);
23597
+ __publicField$9(this, "]", 221);
23043
23598
  // "close braket";
23044
- __publicField$8(this, "'", 222);
23599
+ __publicField$9(this, "'", 222);
23045
23600
  }
23046
23601
  // "single quote"
23047
23602
  }
23048
23603
 
23049
- var __defProp$a = Object.defineProperty;
23050
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
23051
- var __publicField$7 = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
23604
+ var __defProp$b = Object.defineProperty;
23605
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
23606
+ var __publicField$8 = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
23052
23607
  class Keys {
23053
23608
  constructor() {
23054
- __publicField$7(this, "keyCodeAlias", new KeyCodes());
23055
- __publicField$7(this, "keys", {});
23056
- __publicField$7(this, "_windowOnFocus");
23057
- __publicField$7(this, "_keysPressed");
23058
- __publicField$7(this, "_keysReleased");
23609
+ __publicField$8(this, "keyCodeAlias", new KeyCodes());
23610
+ __publicField$8(this, "keys", {});
23611
+ __publicField$8(this, "_windowOnFocus");
23612
+ __publicField$8(this, "_keysPressed");
23613
+ __publicField$8(this, "_keysReleased");
23059
23614
  this._windowOnFocus = this.windowOnFocus.bind(this);
23060
23615
  this._keysPressed = this.keysPressed.bind(this);
23061
23616
  this._keysReleased = this.keysReleased.bind(this);
@@ -23094,15 +23649,15 @@ class Keys {
23094
23649
  }
23095
23650
  }
23096
23651
 
23097
- var __defProp$9 = Object.defineProperty;
23098
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
23099
- var __publicField$6 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
23652
+ var __defProp$a = Object.defineProperty;
23653
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
23654
+ var __publicField$7 = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
23100
23655
  class StateItem {
23101
23656
  constructor(webMap, opt) {
23102
23657
  this.webMap = webMap;
23103
- __publicField$6(this, "name");
23104
- __publicField$6(this, "event");
23105
- __publicField$6(this, "value");
23658
+ __publicField$7(this, "name");
23659
+ __publicField$7(this, "event");
23660
+ __publicField$7(this, "value");
23106
23661
  if (opt) {
23107
23662
  if (opt.value) {
23108
23663
  this.setValue(opt.value);
@@ -23111,7 +23666,11 @@ class StateItem {
23111
23666
  this.name = opt.name;
23112
23667
  }
23113
23668
  if (opt.event) {
23114
- this.event = opt.event;
23669
+ if (typeof opt.event === "string") {
23670
+ this.event = [opt.event];
23671
+ } else {
23672
+ this.event = opt.event;
23673
+ }
23115
23674
  }
23116
23675
  }
23117
23676
  }
@@ -23123,6 +23682,34 @@ class StateItem {
23123
23682
  }
23124
23683
  }
23125
23684
 
23685
+ var __defProp$9 = Object.defineProperty;
23686
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
23687
+ var __publicField$6 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
23688
+ class BoundState extends StateItem {
23689
+ constructor() {
23690
+ super(...arguments);
23691
+ __publicField$6(this, "name", "bounds");
23692
+ __publicField$6(this, "event", ["moveend"]);
23693
+ }
23694
+ getValue() {
23695
+ return this.webMap.getBounds();
23696
+ }
23697
+ setValue(bounds) {
23698
+ this.webMap.setView({ bounds });
23699
+ }
23700
+ toString() {
23701
+ const data = this.getValue();
23702
+ if (data) {
23703
+ return data.slice(0, 4).map((x) => x.toFixed(5)).join("_");
23704
+ }
23705
+ return void 0;
23706
+ }
23707
+ parse(str) {
23708
+ const lngLat = str.split("_").map(Number);
23709
+ return lngLat;
23710
+ }
23711
+ }
23712
+
23126
23713
  var __defProp$8 = Object.defineProperty;
23127
23714
  var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
23128
23715
  var __publicField$5 = (obj, key, value) => __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -23130,7 +23717,7 @@ class CenterState extends StateItem {
23130
23717
  constructor() {
23131
23718
  super(...arguments);
23132
23719
  __publicField$5(this, "name", "center");
23133
- __publicField$5(this, "event", "moveend");
23720
+ __publicField$5(this, "event", ["moveend"]);
23134
23721
  }
23135
23722
  getValue() {
23136
23723
  return this.webMap.getCenter();
@@ -23138,9 +23725,13 @@ class CenterState extends StateItem {
23138
23725
  setValue(val) {
23139
23726
  this.webMap.setCenter(val);
23140
23727
  }
23141
- toString(data) {
23142
- const d = data.map((x) => x.toFixed(5));
23143
- return d[0] + "_" + d[1];
23728
+ toString() {
23729
+ const data = this.getValue();
23730
+ if (data) {
23731
+ const d = data.map((x) => x.toFixed(5));
23732
+ return d[0] + "_" + d[1];
23733
+ }
23734
+ return "";
23144
23735
  }
23145
23736
  parse(str) {
23146
23737
  const lngLat = str.split("_").map(Number);
@@ -23155,7 +23746,7 @@ class ZoomState extends StateItem {
23155
23746
  constructor() {
23156
23747
  super(...arguments);
23157
23748
  __publicField$4(this, "name", "zoom");
23158
- __publicField$4(this, "event", "zoomend");
23749
+ __publicField$4(this, "event", ["zoomend"]);
23159
23750
  }
23160
23751
  getValue() {
23161
23752
  const zoom = this.webMap.getZoom();
@@ -23164,8 +23755,8 @@ class ZoomState extends StateItem {
23164
23755
  setValue(val) {
23165
23756
  this.webMap.setZoom(val);
23166
23757
  }
23167
- toString(val) {
23168
- return String(val);
23758
+ toString() {
23759
+ return String(this.getValue());
23169
23760
  }
23170
23761
  parse(str) {
23171
23762
  return Number(str);
@@ -23234,14 +23825,14 @@ const _WebMapMain = class _WebMapMain {
23234
23825
  __publicField$3(this, "mapAdapter");
23235
23826
  __publicField$3(this, "runtimeParams", []);
23236
23827
  __publicField$3(this, "getPaintFunctions", _WebMapMain.getPaintFunctions);
23237
- __publicField$3(this, "mapState", [CenterState, ZoomState]);
23828
+ __publicField$3(this, "mapStateItems", [CenterState, ZoomState, BoundState]);
23238
23829
  __publicField$3(this, "id", ID++);
23239
23830
  /**
23240
23831
  * From runtime params
23241
23832
  */
23833
+ __publicField$3(this, "mapState", []);
23242
23834
  __publicField$3(this, "_initMapState", {});
23243
23835
  __publicField$3(this, "_starterKits");
23244
- __publicField$3(this, "_mapState", []);
23245
23836
  __publicField$3(this, "_extent");
23246
23837
  __publicField$3(this, "_eventsStatus", {});
23247
23838
  __publicField$3(this, "_coordFromMapClickAbort");
@@ -23276,7 +23867,7 @@ const _WebMapMain = class _WebMapMain {
23276
23867
  create() {
23277
23868
  return __async$5(this, null, function* () {
23278
23869
  if (!this.getEventStatus("create")) {
23279
- yield this._setInitMapState(this.mapState);
23870
+ yield this._setInitMapState(this.mapStateItems);
23280
23871
  yield this._setupMap();
23281
23872
  this._emitStatusEvent("create", this);
23282
23873
  }
@@ -23296,16 +23887,22 @@ const _WebMapMain = class _WebMapMain {
23296
23887
  this.mapAdapter.destroy();
23297
23888
  }
23298
23889
  }
23299
- getState() {
23890
+ mapStateWithFunc(func) {
23300
23891
  const state = {};
23301
- this._mapState.forEach((x) => {
23302
- state[x.name] = x.getValue();
23892
+ this.mapState.forEach((x) => {
23893
+ state[x.name] = func(x);
23303
23894
  });
23304
23895
  return state;
23305
23896
  }
23897
+ getStateAsString() {
23898
+ return this.mapStateWithFunc((x) => x.toString());
23899
+ }
23900
+ getState() {
23901
+ return this.mapStateWithFunc((x) => x.getValue());
23902
+ }
23306
23903
  getRuntimeParams() {
23307
23904
  const state = {};
23308
- this._mapState.forEach((x) => {
23905
+ this.mapState.forEach((x) => {
23309
23906
  for (const r of this.runtimeParams) {
23310
23907
  const val = r.get(x.name);
23311
23908
  if (val !== void 0) {
@@ -23647,7 +24244,7 @@ const _WebMapMain = class _WebMapMain {
23647
24244
  _setInitMapState(states) {
23648
24245
  for (const X of states) {
23649
24246
  const state = new X(this);
23650
- this._mapState.push(state);
24247
+ this.mapState.push(state);
23651
24248
  for (const r of this.runtimeParams) {
23652
24249
  const str = r.get(state.name);
23653
24250
  if (str !== void 0) {
@@ -23683,13 +24280,15 @@ const _WebMapMain = class _WebMapMain {
23683
24280
  events.forEach((x) => {
23684
24281
  this._mapEvents[x] = (data) => {
23685
24282
  if (this.runtimeParams.length) {
23686
- const mapStatusEvent = this._mapState.find((y) => y.event === x);
23687
- if (mapStatusEvent) {
23688
- const value = mapStatusEvent.toString(mapStatusEvent.getValue());
24283
+ const mapStatusEvents = this.mapState.filter(
24284
+ (y) => y.event.includes(x)
24285
+ );
24286
+ mapStatusEvents.forEach((mapStatusEvent) => {
24287
+ const value = mapStatusEvent.toString();
23689
24288
  this.runtimeParams.forEach((r) => {
23690
24289
  r.set(mapStatusEvent.name, value);
23691
24290
  });
23692
- }
24291
+ });
23693
24292
  }
23694
24293
  if (this._eventsStatus) {
23695
24294
  this.emitter.emit(x, data);
@@ -24265,11 +24864,11 @@ class WebMapLayers extends WebMapMain {
24265
24864
  }
24266
24865
  return Promise.resolve();
24267
24866
  }
24268
- updateLayer(layerDef) {
24867
+ updateLayer(layerDef, options) {
24269
24868
  const layer = this.getLayer(layerDef);
24270
24869
  if (layer) {
24271
24870
  if (layer.updateLayer) {
24272
- return Promise.resolve(layer.updateLayer());
24871
+ return Promise.resolve(layer.updateLayer(options));
24273
24872
  } else if (this.isLayerVisible(layer)) {
24274
24873
  return this.hideLayer(layer, { silent: true }).then(() => {
24275
24874
  return this.showLayer(layer, { silent: true });
@@ -25159,7 +25758,7 @@ function prepareWebMapOptions(options) {
25159
25758
  });
25160
25759
  }
25161
25760
  if (!options.connector) {
25162
- options.connector = new NgwConnector({
25761
+ options.connector = new NgwConnectorExtended({
25163
25762
  baseUrl: options.baseUrl || "",
25164
25763
  auth: options.auth,
25165
25764
  withCredentials: options.withCredentials
@@ -25433,7 +26032,7 @@ const _NgwMap = class _NgwMap extends WebMap {
25433
26032
  if (mem.layer.getDependLayers) {
25434
26033
  const dependLayers = mem.layer.getDependLayers();
25435
26034
  const dependFit = dependLayers.find((x) => {
25436
- return x.item && x.item.parentId === id;
26035
+ return x.item && x.item.style_parent_id === id;
25437
26036
  });
25438
26037
  if (dependFit) {
25439
26038
  return dependFit.layer;