chunk-JAUFBT5U.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. import {
  2. _,
  3. f,
  4. g,
  5. u,
  6. w,
  7. x
  8. } from "./chunk-3HCJD762.js";
  9. import {
  10. c
  11. } from "./chunk-RVCE264D.js";
  12. import {
  13. F,
  14. P,
  15. S2,
  16. m,
  17. m2,
  18. y as y4
  19. } from "./chunk-3Z755LKF.js";
  20. import {
  21. S,
  22. l as l2,
  23. o as o3,
  24. r as r2,
  25. s as s4,
  26. t,
  27. y as y3
  28. } from "./chunk-ZSW35JPD.js";
  29. import {
  30. o as o2
  31. } from "./chunk-UVVU4UUO.js";
  32. import {
  33. s as s3
  34. } from "./chunk-HZRKBTHJ.js";
  35. import {
  36. o
  37. } from "./chunk-6T6G6LCQ.js";
  38. import {
  39. r
  40. } from "./chunk-PQFTYGF5.js";
  41. import {
  42. e,
  43. l3 as l,
  44. n5 as n,
  45. y3 as y2
  46. } from "./chunk-2Z2TG5CU.js";
  47. import {
  48. s2 as s,
  49. s3 as s2
  50. } from "./chunk-E5O6P5I2.js";
  51. import {
  52. y
  53. } from "./chunk-SPWQ3AWG.js";
  54. // node_modules/@arcgis/core/layers/support/LabelExpressionInfo.js
  55. var l3;
  56. var n2 = l3 = class extends l {
  57. constructor() {
  58. super(...arguments), this.expression = null, this.title = null, this.value = null;
  59. }
  60. readExpression(r3, e2) {
  61. return e2.value ? w(e2.value) : r3;
  62. }
  63. writeExpression(r3, e2, s6) {
  64. null != this.value && (r3 = w(this.value)), null != r3 && (e2[s6] = r3);
  65. }
  66. clone() {
  67. return new l3({ expression: this.expression, title: this.title, value: this.value });
  68. }
  69. };
  70. e([y2({ type: String, json: { write: { writerEnsuresNonNull: true } } })], n2.prototype, "expression", void 0), e([o("expression", ["expression", "value"])], n2.prototype, "readExpression", null), e([r("expression")], n2.prototype, "writeExpression", null), e([y2({ type: String, json: { write: true, origins: { "web-scene": { write: false } } } })], n2.prototype, "title", void 0), e([y2({ json: { read: false, write: false } })], n2.prototype, "value", void 0), n2 = l3 = e([n("esri.layers.support.LabelExpressionInfo")], n2);
  71. var a = n2;
  72. // node_modules/@arcgis/core/symbols/support/defaults.js
  73. var c2 = y4.fromJSON(l2);
  74. var u2 = m.fromJSON(o3);
  75. var a2 = S2.fromJSON(S);
  76. var y5 = m2.fromJSON(t);
  77. var N = y4.fromJSON(r2);
  78. var O = m.fromJSON(s4);
  79. var j = S2.fromJSON(y3);
  80. // node_modules/@arcgis/core/layers/support/LabelClass.js
  81. var y6;
  82. var d = new s3({ esriServerPointLabelPlacementAboveCenter: "above-center", esriServerPointLabelPlacementAboveLeft: "above-left", esriServerPointLabelPlacementAboveRight: "above-right", esriServerPointLabelPlacementBelowCenter: "below-center", esriServerPointLabelPlacementBelowLeft: "below-left", esriServerPointLabelPlacementBelowRight: "below-right", esriServerPointLabelPlacementCenterCenter: "center-center", esriServerPointLabelPlacementCenterLeft: "center-left", esriServerPointLabelPlacementCenterRight: "center-right", esriServerLinePlacementAboveAfter: "above-after", esriServerLinePlacementAboveAlong: "above-along", esriServerLinePlacementAboveBefore: "above-before", esriServerLinePlacementAboveStart: "above-start", esriServerLinePlacementAboveEnd: "above-end", esriServerLinePlacementBelowAfter: "below-after", esriServerLinePlacementBelowAlong: "below-along", esriServerLinePlacementBelowBefore: "below-before", esriServerLinePlacementBelowStart: "below-start", esriServerLinePlacementBelowEnd: "below-end", esriServerLinePlacementCenterAfter: "center-after", esriServerLinePlacementCenterAlong: "center-along", esriServerLinePlacementCenterBefore: "center-before", esriServerLinePlacementCenterStart: "center-start", esriServerLinePlacementCenterEnd: "center-end", esriServerPolygonPlacementAlwaysHorizontal: "always-horizontal" }, { ignoreUnknown: true });
  83. function x2(e2) {
  84. var _a;
  85. return !e2 || "service" !== e2.origin && !("map-image" === ((_a = e2.layer) == null ? void 0 : _a.type));
  86. }
  87. function L(e2) {
  88. return "map-image" === (e2 == null ? void 0 : e2.type);
  89. }
  90. function P2(e2) {
  91. var _a, _b;
  92. return !!L(e2) && !!((_b = (_a = e2.capabilities) == null ? void 0 : _a.exportMap) == null ? void 0 : _b.supportsArcadeExpressionForLabeling);
  93. }
  94. function g2(e2) {
  95. return x2(e2) || P2(e2.layer);
  96. }
  97. var E = y6 = class extends l {
  98. constructor(e2) {
  99. super(e2), this.type = "label", this.name = null, this.allowOverrun = false, this.deconflictionStrategy = "static", this.labelExpression = null, this.labelExpressionInfo = null, this.labelPlacement = null, this.labelPosition = "curved", this.maxScale = 0, this.minScale = 0, this.repeatLabel = true, this.repeatLabelDistance = null, this.symbol = y5, this.useCodedValues = void 0, this.where = null;
  100. }
  101. static evaluateWhere(e2, r3) {
  102. const t3 = (e3, r4, t4) => {
  103. switch (r4) {
  104. case "=":
  105. return e3 == t4;
  106. case "<>":
  107. return e3 != t4;
  108. case ">":
  109. return e3 > t4;
  110. case ">=":
  111. return e3 >= t4;
  112. case "<":
  113. return e3 < t4;
  114. case "<=":
  115. return e3 <= t4;
  116. }
  117. return false;
  118. };
  119. try {
  120. if (null == e2)
  121. return true;
  122. const o4 = e2.split(" ");
  123. if (3 === o4.length)
  124. return t3(r3[o4[0]], o4[1], o4[2]);
  125. if (7 === o4.length) {
  126. const e3 = t3(r3[o4[0]], o4[1], o4[2]), n4 = o4[3], s6 = t3(r3[o4[4]], o4[5], o4[6]);
  127. switch (n4) {
  128. case "AND":
  129. return e3 && s6;
  130. case "OR":
  131. return e3 || s6;
  132. }
  133. }
  134. return false;
  135. } catch (o4) {
  136. console.log("Error.: can't parse = " + e2);
  137. }
  138. }
  139. readLabelExpression(e2, r3) {
  140. const t3 = r3.labelExpressionInfo;
  141. if (!t3 || !t3.value && !t3.expression)
  142. return e2;
  143. }
  144. writeLabelExpression(e2, r3, t3) {
  145. if (this.labelExpressionInfo) {
  146. if (null != this.labelExpressionInfo.value)
  147. e2 = u(this.labelExpressionInfo.value);
  148. else if (null != this.labelExpressionInfo.expression) {
  149. const r4 = _(this.labelExpressionInfo.expression);
  150. r4 && (e2 = "[" + r4 + "]");
  151. }
  152. }
  153. null != e2 && (r3[t3] = e2);
  154. }
  155. writeLabelExpressionInfo(e2, r3, t3, o4) {
  156. if (null == e2 && null != this.labelExpression && x2(o4))
  157. e2 = new a({ expression: this.getLabelExpressionArcade() });
  158. else if (!e2)
  159. return;
  160. const n4 = e2.toJSON(o4);
  161. n4.expression && (r3[t3] = n4);
  162. }
  163. writeMaxScale(e2, r3) {
  164. (e2 || this.minScale) && (r3.maxScale = e2);
  165. }
  166. writeMinScale(e2, r3) {
  167. (e2 || this.maxScale) && (r3.minScale = e2);
  168. }
  169. getLabelExpression() {
  170. return x(this);
  171. }
  172. getLabelExpressionArcade() {
  173. return f(this);
  174. }
  175. getLabelExpressionSingleField() {
  176. return g(this);
  177. }
  178. hash() {
  179. return JSON.stringify(this);
  180. }
  181. clone() {
  182. return new y6({ allowOverrun: this.allowOverrun, deconflictionStrategy: this.deconflictionStrategy, labelExpression: this.labelExpression, labelExpressionInfo: y(this.labelExpressionInfo), labelPosition: this.labelPosition, labelPlacement: this.labelPlacement, maxScale: this.maxScale, minScale: this.minScale, name: this.name, repeatLabel: this.repeatLabel, repeatLabelDistance: this.repeatLabelDistance, symbol: y(this.symbol), where: this.where, useCodedValues: this.useCodedValues });
  183. }
  184. };
  185. e([y2({ type: String, json: { write: true } })], E.prototype, "name", void 0), e([y2({ type: Boolean, json: { write: true, default: false, origins: { "web-scene": { write: false } } } })], E.prototype, "allowOverrun", void 0), e([y2({ type: String, json: { write: true, default: "static", origins: { "web-scene": { write: false } } } })], E.prototype, "deconflictionStrategy", void 0), e([y2({ type: String, json: { write: { overridePolicy(e2, r3, t3) {
  186. return this.labelExpressionInfo && "service" === (t3 == null ? void 0 : t3.origin) && P2(t3.layer) ? { enabled: false } : { allowNull: true };
  187. } } } })], E.prototype, "labelExpression", void 0), e([o("labelExpression")], E.prototype, "readLabelExpression", null), e([r("labelExpression")], E.prototype, "writeLabelExpression", null), e([y2({ type: a, json: { write: { overridePolicy: (e2, r3, t3) => g2(t3) ? { allowNull: true } : { enabled: false } } } })], E.prototype, "labelExpressionInfo", void 0), e([r("labelExpressionInfo")], E.prototype, "writeLabelExpressionInfo", null), e([y2({ type: d.apiValues, json: { type: d.jsonValues, read: d.read, write: d.write } })], E.prototype, "labelPlacement", void 0), e([y2({ type: ["curved", "parallel"], json: { write: true, origins: { "web-map": { write: false }, "web-scene": { write: false }, "portal-item": { write: false } } } })], E.prototype, "labelPosition", void 0), e([y2({ type: Number })], E.prototype, "maxScale", void 0), e([r("maxScale")], E.prototype, "writeMaxScale", null), e([y2({ type: Number })], E.prototype, "minScale", void 0), e([r("minScale")], E.prototype, "writeMinScale", null), e([y2({ type: Boolean, json: { write: true, origins: { "web-scene": { write: false }, "portal-item": { write: false } } } })], E.prototype, "repeatLabel", void 0), e([y2({ type: Number, cast: o2, json: { write: true, origins: { "web-scene": { write: false } } } })], E.prototype, "repeatLabelDistance", void 0), e([y2({ types: P, json: { origins: { "web-scene": { types: F, write: c, default: null } }, write: c, default: null } })], E.prototype, "symbol", void 0), e([y2({ type: Boolean, json: { write: true } })], E.prototype, "useCodedValues", void 0), e([y2({ type: String, json: { write: true } })], E.prototype, "where", void 0), E = y6 = e([n("esri.layers.support.LabelClass")], E);
  188. var j2 = E;
  189. // node_modules/@arcgis/core/layers/support/labelingInfo.js
  190. var n3 = s.getLogger("esri.layers.support.labelingInfo");
  191. var l4 = /\[([^\[\]]+)\]/gi;
  192. function i(e2, r3, o4) {
  193. return e2 ? e2.map((e3) => {
  194. const n4 = new j2();
  195. if (n4.read(e3, o4), n4.labelExpression) {
  196. const e4 = r3.fields || r3.layerDefinition && r3.layerDefinition.fields || this.fields;
  197. n4.labelExpression = n4.labelExpression.replace(l4, (r4, o5) => `[${s5(o5, e4)}]`);
  198. }
  199. return n4;
  200. }) : null;
  201. }
  202. function s5(e2, r3) {
  203. if (!r3)
  204. return e2;
  205. const o4 = e2.toLowerCase();
  206. for (let t3 = 0; t3 < r3.length; t3++) {
  207. const e3 = r3[t3].name;
  208. if (e3.toLowerCase() === o4)
  209. return e3;
  210. }
  211. return e2;
  212. }
  213. var a3 = { esriGeometryPoint: ["above-right", "above-center", "above-left", "center-center", "center-left", "center-right", "below-center", "below-left", "below-right"], esriGeometryPolygon: ["always-horizontal"], esriGeometryPolyline: ["center-along"], esriGeometryMultipoint: null };
  214. function c3(e2, o4) {
  215. const t3 = y(e2);
  216. return t3.some((e3) => f2(e3, o4)) ? [] : t3;
  217. }
  218. function f2(r3, o4) {
  219. const t3 = r3.labelPlacement, l5 = a3[o4];
  220. if (!r3.symbol)
  221. return n3.warn("No ILabelClass symbol specified."), true;
  222. if (!l5)
  223. return n3.error(new s2("labeling:unsupported-geometry-type", `Unable to create labels for layer, geometry type '${o4}' is not supported`)), true;
  224. if (!l5.includes(t3)) {
  225. const e2 = l5[0];
  226. t3 && n3.warn(`Found invalid label placement type ${t3} for ${o4}. Defaulting to ${e2}`), r3.labelPlacement = e2;
  227. }
  228. return false;
  229. }
  230. export {
  231. c2 as c,
  232. u2 as u,
  233. a2 as a,
  234. N,
  235. O,
  236. j,
  237. j2,
  238. i,
  239. c3 as c2
  240. };
  241. //# sourceMappingURL=chunk-JAUFBT5U.js.map