UNPKG

@arcgis/map-components

Version:
1,203 lines • 93.8 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */ import { c as de } from "../../chunks/runtime.js"; import { css as pe, html as d, svg as X } from "lit"; import { keyed as w } from "lit/directives/keyed.js"; import { LitElement as he, createEvent as T, safeStyleMap as Z, nothing as ue, safeClassMap as me } from "@arcgis/lumina"; import { u as ge } from "../../chunks/useT9n.js"; import { m as ve } from "../../chunks/useViewModel.js"; import { property as o, subclass as C } from "@arcgis/core/core/accessorSupport/decorators.js"; import U from "@arcgis/core/core/Accessor.js"; import B from "@arcgis/core/Graphic.js"; import { getApplicationClipboard as fe } from "@arcgis/core/applications/Components/clipboard.js"; import we from "@arcgis/core/layers/GraphicsLayer.js"; import { g as be, a as ye } from "../../chunks/clipoardSymbolHelper.js"; import j from "@arcgis/core/core/Collection.js"; import { getFullTemplate as J, isSharedTemplate as Q, getCreationAttributes as Me, isSharedTemplateOrMetadata as ie } from "@arcgis/core/applications/Components/templateUtils.js"; import { createApplySetModifyItem as W, createApplySet as q, createFeatureStateProvider as K, createApplySetAddItem as R, writeApplySetToService as Ce } from "@arcgis/core/applications/Components/applySetUtils.js"; import { whenOnce as ae, watch as N } from "@arcgis/core/core/reactiveUtils.js"; import { getRendererFields as Y, getFeatureEditFields as Fe } from "@arcgis/core/layers/support/fieldUtils.js"; import _e from "@arcgis/core/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js"; import { c as xe, f as ee } from "../../chunks/layer-utils.js"; import { substitute as b } from "@arcgis/core/intl.js"; import { usePropertyChange as Pe } from "@arcgis/lumina/controllers"; import { createRef as V, ref as D } from "lit/directives/ref.js"; import "../arcgis-multi-feature-form/customElement.js"; import { createGraphicsMover as $e } from "@arcgis/core/applications/Components/editUtils.js"; const Ae = pe`.esri-widget__heading{color:var(--calcite-color-text-2);margin:0 0 .5rem;font-weight:var(--calcite-font-weight-semibold)}h1.esri-widget__heading{font-size:var(--calcite-font-size-xl)}h2.esri-widget__heading{font-size:var(--calcite-font-size-md)}h3.esri-widget__heading,h4.esri-widget__heading,h5.esri-widget__heading,h6.esri-widget__heading{font-size:var(--calcite-font-size)}.esri-widget{box-sizing:border-box;color:var(--calcite-color-text-2);background-color:var(--calcite-color-foreground-1);font-size:var(--calcite-font-size);line-height:var(--calcite-font-line-height-relative-tight)}.esri-widget *,.esri-widget :before,.esri-widget :after{box-sizing:inherit}.esri-widget.esri-widget--disabled>*{opacity:.4;pointer-events:none}.esri-widget.esri-widget--compact{--esri-widget-padding-y: 0;--esri-widget-padding-x: 0}.esri-widget__anchor{color:var(--calcite-color-text-2)}.esri-widget__anchor:hover{color:var(--calcite-color-text-3)}.esri-widget__anchor:hover,.esri-widget__anchor:focus{text-decoration:underline}.esri-widget__anchor--disabled{opacity:.4;pointer-events:none}.esri-widget__header{background-color:var(--calcite-color-foreground-1);flex:1 0 100%;justify-content:space-between;align-items:center;width:100%;min-height:48px;padding:12px 0 12px 15px;display:flex}.esri-widget__heading{word-break:break-word}.esri-widget__header .esri-widget__heading{width:calc(100% - 48px);text-align:initial;color:var(--calcite-color-text-1);align-items:center;margin:0;padding:0;display:flex}.esri-widget__header-button{appearance:none;cursor:pointer;color:var(--calcite-color-text-2);background-color:var(--calcite-color-foreground-1);border:none;flex:0 0 48px;justify-content:center;align-self:stretch;align-items:center;width:48px;padding:0;display:flex}.esri-widget__footer{background-color:var(--calcite-color-foreground-1);justify-content:center;align-items:center;width:100%;min-height:48px;display:flex}.esri-widget__footer-pagination{color:var(--calcite-color-text-2);justify-content:space-between;align-items:center;display:flex}.esri-widget__footer-pagination-previous-button,.esri-widget__footer-pagination-next-button{cursor:pointer;background-color:var(--calcite-color-foreground-1);border:0;margin:0 7px;padding:12px 15px;transition:background-color .125s ease-in-out}.esri-widget__footer-pagination-previous-button:hover,.esri-widget__footer-pagination-previous-button:focus,.esri-widget__footer-pagination-next-button:hover,.esri-widget__footer-pagination-next-button:focus{color:var(--calcite-color-text-1);background-color:var(--calcite-color-foreground-1)}.esri-menu{visibility:hidden;z-index:1;background-clip:padding;background-color:var(--calcite-color-foreground-1);background-clip:padding-box;width:100%;max-height:0;margin:2px 0 0;padding:0;font-size:var(--calcite-font-size);line-height:var(--calcite-spacing-xl);position:absolute;top:100%;left:0;overflow:hidden;box-shadow:0 1px 2px #0000004d}.esri-menu .esri-menu__header{color:var(--calcite-color-text-inverse);background-color:var(--calcite-color-inverse);padding:6px 12px}.esri-menu__list{margin:0;padding:0;list-style:none}.esri-menu__list-item{cursor:pointer;border-top:1px solid #adadad4d;border-left:3px solid #0000;padding:.8em 1em}.esri-menu__list-item [class^=esri-icon-],.esri-menu__list-item [class*=" esri-icon-"]{padding-right:2.8px}.esri-menu__list-item:first-child{border-top:none}.esri-menu__list-item--focus,.esri-menu__list-item:hover,.esri-menu__list-item:focus{background-color:var(--calcite-color-foreground-1)}.esri-menu__list-item:active{background-color:var(--calcite-color-foreground-current)}.esri-menu__list-item--active,.esri-menu__list-item--active:hover,.esri-menu__list-item--active:focus{background-color:var(--calcite-color-foreground-1);border-left-color:var(--calcite-color-brand)}.esri-widget__table{border-collapse:collapse;color:var(--calcite-color-text-1);border:none;width:100%;line-height:var(--calcite-font-line-height-relative-tight)}.esri-widget__table tr:nth-child(odd){background-color:var(--calcite-color-transparent)}.esri-widget__table tr:nth-child(2n){background-color:var(--calcite-color-transparent-press)}.esri-widget__table tr a{color:var(--calcite-color-text-2)}.esri-widget__table tr a:hover,.esri-widget__table tr a:focus{color:var(--calcite-color-text-1)}.esri-widget__table tr td,.esri-widget__table tr th{vertical-align:top;word-break:break-word;padding:.5em .7em;font-size:var(--calcite-font-size-sm);font-weight:var(--calcite-font-weight-regular)}.esri-widget__table tr th{text-align:left;border-right:3px solid #0000000d;width:50%}.esri-widget__table tr td{width:50%}.esri-input{color:var(--calcite-color-text-1);background-color:var(--calcite-color-foreground-1);border:1px solid #959595;font-size:var(--calcite-font-size)}.esri-input::-ms-clear{display:none}.esri-input::placeholder{opacity:1;color:var(--calcite-color-text-2)}.esri-input:placeholder-shown{text-overflow:ellipsis}.esri-input[type=text],.esri-input[type=password],.esri-input[type=number]{height:32px;padding:0 .5em}calcite-combobox.esri-input{border:none}.esri-widget__content--empty{text-align:center;color:var(--calcite-color-border-input);flex-flow:column wrap;align-items:center;padding:18px 22px;display:flex}.esri-widget__content--empty h1.esri-widget__heading,.esri-widget__content--empty h2.esri-widget__heading,.esri-widget__content--empty h3.esri-widget__heading,.esri-widget__content--empty h4.esri-widget__heading,.esri-widget__content--empty h5.esri-widget__heading{font-weight:var(--calcite-font-weight-regular)}.esri-widget__content-illustration--empty{width:128px;padding:1rem 0}.esri-widget__content-icon--empty{width:32px;padding:.5rem 0}.esri-select{appearance:none;cursor:pointer;color:var(--calcite-color-text-2);background:var(--calcite-color-foreground-1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-8 -8 32 32' width='32' height='32'%3E%3Cpath d='M8 11.207l-4-4V5.793l4 4 4-4v1.414z' fill='%23adadad' fillrule='nonzero'/%3E%3C/svg%3E") 100% no-repeat;border:1px solid #959595;border-radius:0;width:100%;height:32px;margin:0;padding:0 .5em;font-family:inherit;font-size:.85em;display:block}.esri-select[disabled]{cursor:auto}.esri-select::-ms-expand{display:none}.esri-disabled a,.esri-disabled [role=menu],.esri-disabled [role=checkbox],.esri-disabled [class^=esri-icon-],.esri-disabled [class*=" esri-icon-"]{color:var(--calcite-color-text-3)}.keynav-mode .esri-widget:focus,.keynav-mode .esri-widget :focus{z-index:1;outline-offset:2px;outline:2px solid #adadad}.esri-widget__loader-animation{border:.15em solid #adadad4d;border-top-color:var(--calcite-color-border-input);border-radius:100%;width:1em;height:1em;font-size:var(--calcite-font-size-md);animation:1.25s linear infinite esri-rotate;display:block;transform:translateZ(0)}:dir(rtl) .esri-widget__table th{text-align:right;border-left:3px solid #0000000d;border-right:none}:dir(rtl) .esri-select{background-position:0}:dir(rtl) .esri-menu__list-item{border-left:none;border-right:3px solid #0000}:dir(rtl) .esri-menu__list-item [class^=esri-icon-],:dir(rtl) .esri-menu__list-item [class*=" esri-icon-"]{padding-left:2px;padding-right:0}:dir(rtl) .esri-menu__list-item--active{border-right-color:var(--calcite-color-brand)}.esri-icon-font-fallback-text{clip:rect(0 0 0 0);width:1px;height:1px;position:absolute;overflow:hidden}.esri-rotating{animation:1.25s linear infinite esri-rotate;transform:translateZ(0)}.esri-clearfix:before,.esri-clearfix:after{content:" ";display:table}.esri-clearfix:after{clear:both}.esri-interactive{cursor:pointer}.esri-hidden{display:none!important}.esri-invisible{visibility:hidden!important}.esri-offscreen{position:absolute;top:-999em;left:-999em}.esri-match-height{flex-direction:column;flex:auto;display:flex;overflow:hidden}:host{display:flex}.arcgis-paste{height:var(--arcgis-paste-height, 300px);width:var(--arcgis-paste-width, 300px);flex:1}.hidden{display:none}.flex-row{flex-direction:row}.justify-center{justify-content:center}.h-full{height:100%}.w-full{width:100%}.flex{display:flex}.text-center{text-align:center}.pad-contents{padding:var(--arcgis-paste-blocks-padding, var(--calcite-spacing-md))}.merge-feature-form{padding-left:var(--arcgis-paste-blocks-padding, var(--calcite-spacing-md));padding-right:var(--arcgis-paste-blocks-padding, var(--calcite-spacing-md));padding-bottom:var(--arcgis-paste-blocks-padding, var(--calcite-spacing-md))}.pad-start-end{padding-left:var(--arcgis-paste-blocks-padding, var(--calcite-spacing-md));padding-right:var(--arcgis-paste-blocks-padding, var(--calcite-spacing-md))}.gallery-content{padding-top:var(--arcgis-paste-blocks-padding, var(--calcite-spacing-md));padding-bottom:var(--arcgis-paste-blocks-padding, var(--calcite-spacing-md));display:flex;row-gap:var(--arcgis-paste-blocks-padding, var(--calcite-spacing-md));flex-direction:column}.chip-indent{margin-left:5px;margin-right:5px}.merge-split-view-container{display:flex;flex-direction:column;height:100%}.merge-split-view-items{flex:0 1 auto;max-height:50%;overflow-y:scroll}.merge-split-view-attributes{flex:1;overflow-y:scroll}.choose-feature{position:absolute;width:100%;max-height:100%;z-index:2;overflow-y:auto}.bau-pick{display:flex;flex-direction:row;align-items:center;gap:4px}.danger-icon-warning{--calcite-icon-color: var(--calcite-color-status-danger)}.paste-feature-templates{--arcgis-feature-templates-max-list-height: 100%}`; async function Ee(e, t = {}) { if (e?.type === "subtype-group") { if (!e.subtypeField) return []; const a = t[e.subtypeField]; if (!le(a)) return []; const s = e.findSublayerForSubtypeCode(a); return s ? s.renderer && s.fieldsIndex ? await Y(s.renderer, e.fieldsIndex) : [] : []; } return e ? e.renderer && e.fieldsIndex ? await Y(e.renderer, e.fieldsIndex) : [] : []; } function Ie(e, t, i, a, s, r) { const l = { ...a }, h = Se(r), p = Te(r); let u = ""; (r.type === "subtype-group" || r.type === "subtype-sublayer") && (u = r.subtypeField ?? ""); const g = r.objectIdField ?? ""; return e.forEach((m) => { if (m.name !== g && !h.includes(m.name) && !p.includes(m.name) && !s.includes(m.name) && m.type !== "global-id" && (u === "" || u !== m.name)) { const f = Oe(m, t); f.match && f.targetField && (l[f.targetField?.name] = i[m.name]); } }), l; } function Se(e) { return e && "relationships" in e ? (e.relationships ?? []).filter((i) => i.role === "origin").map((i) => i.keyField) : []; } function Te(e) { return e?.type === "subtype-sublayer" && (e = e.parent), e ? Fe(e) : []; } function Ge(e, t) { if (e.type === t.type) return t.type === "string" ? e.length <= t.length : !0; switch (e.type) { case "small-integer": return ["integer", "big-integer"].includes(t.type); case "integer": return t.type === "big-integer"; case "single": return t.type === "double"; default: return !1; } } function Oe(e, t) { const i = { match: !1, sourceField: null, targetField: null }; for (const a of t) if (Ge(e, a)) { const s = e.name.replace(/\s/gu, "").toLowerCase(); if (a.name.replace(/\s/gu, "").toLowerCase() === s) return i.match = !0, i.sourceField = e, i.targetField = a, i; } return i; } async function se(e, t, i, a) { let s = !0; const r = { hasAsyncArcadeExpressions: !1 }, l = e.items.filter((h) => h.type === "add"); for (const h of l) { const p = h.graphic.clone(), u = ke( h.graphic, h.layer ); if (!u) { s = !1; continue; } const g = !await He( t, h.graphic, u, i, r ); if (r.hasAsyncArcadeExpressions && l.length > a) return !1; const m = W({ graphic: h.graphic, layer: h.layer, originalGraphic: p }); if (e.push(m), !g) return !1; } return s; } function ke(e, t) { if (t.type === "feature" || t.type === "subtype-sublayer") return t; const i = t.findSublayerForFeature(e); return i || null; } async function He(e, t, i, a, s) { const r = i.formTemplate, l = i.fields.filter((f) => { const z = t.attributes[f.name], ce = z === null || z === "" || z === void 0; return f.editable && !f.nullable && ce; }); if (!r) return l.length !== 0; const h = /* @__PURE__ */ new Set(); oe(r.elements ?? [], h); const p = /* @__PURE__ */ new Set(); if (re(r.elements ?? [], p), h.size === 0 && p.size === 0) return l.length > 0; const u = t.clone(); u.layer = i, delete u.attributes[i.objectIdField], a.has(i) || a.set( i, new _e({ map: e.map, editType: "INSERT" }) ); const g = a.get(i); if (g.features = new j([u]), await ae( () => (g.status === "loaded" || g.status === "failed") && !g.updating ), g.hasAsyncArcadeExpressions && (s.hasAsyncArcadeExpressions = !0), g.status === "failed") return !0; let m = g.getValues(u) ?? {}; if (i.objectIdField && m[i.objectIdField] !== void 0) { const { [i.objectIdField]: f, ...z } = m; m = z; } return Object.keys(m).forEach((f) => { i.fieldsIndex.has(f) && (t.attributes[f] = ze( m[f], f, i.fieldsIndex )); }), g.invalidFeatures.length > 0; } function re(e, t) { for (const i of e) i.type === "group" ? re(i.elements, t) : i.type === "field" && i.valueExpression && t.add(i.fieldName); } function oe(e, t) { for (const i of e) i.type === "group" ? oe(i.elements, t) : i.type === "field" && i.requiredExpression && t.add(i.fieldName); } function le(e) { return typeof e == "number"; } function Le(e) { return typeof e == "number" && window.isFinite(e) && Math.floor(e) === e; } function ze(e, t, i) { if (e === null || e === void 0) return null; switch (i.get(t).type) { case "big-integer": case "long": case "oid": case "integer": case "small-integer": return Le(e) ? e : window.parseInt(e); case "single": case "double": return le(e) ? e : window.parseFloat(e); case "global-id": case "guid": return e === "" ? null : e; case "date": break; case "date-only": case "time-only": case "timestamp-offset": return e === "" ? null : e; case "string": return e === "" ? null : e; } return e; } function Ve(e) { return e && "layer" in e ? e.layer : void 0; } function E(e) { if (!e) return null; const t = Ve(e.origin) ?? e.layer ?? e?.sourceLayer ?? null; if (t && t.type === "subtype-sublayer") return t.parent; switch (t?.type) { case "csv": case "feature": case "geojson": case "ogc-feature": case "subtype-group": case "wfs": return t; default: return null; } } var De = Object.defineProperty, Be = Object.getOwnPropertyDescriptor, A = (e, t, i, a) => { for (var s = a > 1 ? void 0 : a ? Be(t, i) : t, r = e.length - 1, l; r >= 0; r--) (l = e[r]) && (s = (a ? l(t, i, s) : l(s)) || s); return a && s && De(t, i, s), s; }; const ne = { noChangeError: "Operation has not made any changes", noSelectedError: "Operation requires a selected feature", deletesGeometryError: "Operation would result in a null geometry", noGeometryError: "The selected feature has not geometry" }; let v = class extends U { //#region Lifecycle constructor(e) { super(e); } get mustShowOnCommandPage() { return !0; } get icon() { } get id() { return ""; } /** * A label for the command */ label(e, t) { return ""; } /** * A description for the command */ description(e, t) { return ""; } get commandEnabled() { return !1; } commandDisabledReason(e, t) { return ""; } get immediate() { return !1; } /** * Initiate the paste command */ async initiate(e, t) { } /** * Execute the command silently. Performs the logic of the paste command */ async execute() { throw new Error("arcgis-paste: Paste command does not support execute"); } /** * The logic for the paste, paste-as and paste-merge command */ async runPasteCommand(e, t, i) { try { this.viewModel.applying = !0; const a = await this.prepareCopy(t); if (!a || a.items.length === 0) { this.viewModel.lastPasteError = { errorCode: "noPasteItems", errorMessage: "No items to paste", localizedErrorMessage: "noPasteItemsError" }, e.onPasteError(this.viewModel.lastPasteError); return; } const s = ( // If too many features, dont run anything a.items.length > this.viewModel.maximumFeatureCount || // If going to show feature form, then do not do all the analysis! this.viewModel.alwaysShowFeatureForm || i?.showFeatureForm === !0 || // Otherwise, need to see what is mandatory or not. !await se( a, this.viewModel.view, this.viewModel.formViewModelMap, this.viewModel.maximumFeatureCountWithComplexForms ) ); if (this.viewModel.alwaysShowFeatureForm || s || i?.showFeatureForm === !0) this.viewModel.bauActiveFeatureIndex = 0, this.viewModel.bauApplySet = a, this.viewModel.activeCommand = t, this.viewModel.bauOriginalGraphics = a.items.map((r) => r.type === "add" ? { layer: r.layer, graphic: r.graphic } : null).filter((r) => r !== null), this.viewModel.bauFeatures = new j(), this.viewModel.activeFlowPage = "form-page", await new Promise((r) => { setTimeout(r, 100); }), this.viewModel.bauFeatures = new j( this.viewModel.bauOriginalGraphics.map((r) => { if (xe(r.layer)) { const l = r.layer.findSublayerForFeature(r.graphic); if (l) return r.graphic.layer = l, r.graphic; } return r.graphic.layer = r.layer, r.graphic; }) ), this.viewModel.updateIndividualMultiFeatureFormHighlight(); else try { const r = await e.onApply({ command: "paste", applySet: a }); if (r.success) { this.viewModel.resetHome(), this.viewModel.closeOnApply && e.closeAfterApply(); return; } this.viewModel.handleApplyError(r, e.onPasteError); } catch (r) { this.viewModel.lastPasteError = { errorCode: "unexpectedError", errorMessage: r.message, localizedErrorMessage: "unexpectedError" }, e.onPasteError(this.viewModel.lastPasteError); return; } finally { a?.featureState?.clearAll(); } } finally { this.viewModel.applying = !1; } } /** * Builds an ApplySet for the Paste, Paste-as and Paste-merge command */ async prepareCopy(e) { const t = e === "paste" || e === "paste-as" && this.viewModel.pasteWithAttributes || e === "paste-merge" && this.viewModel.pasteWithAttributes, i = t && e === "paste-merge" ? this.viewModel.clipboard.items.getItemAt(this.viewModel.selectedClipboardItemIndex) : null, a = q(); if (a.featureState = K(this.viewModel.view), e === "paste-merge") { const s = this.viewModel.pasteTemplate?.template ? await J(this.viewModel.view, this.viewModel.pasteTemplate.template) : null; if (!s) return null; const r = Q(this.viewModel.pasteTemplate.template) ? s.layer : this.viewModel.pasteTemplate.layer, l = await this.createMergedClipboardGeom(), h = await this.constructFeatureAttributesCopy(s, r, i), p = new B({ geometry: l, attributes: h }); this.removeGraphicIdentifierFields(p, r), a.push(R({ graphic: p, layer: r })); } else if (e === "paste") for (const s of this.viewModel.clipboardFeatures) { const r = s.graphic.clone(); this.removeGraphicIdentifierFields(r, s.layer), a.push(R({ graphic: r, layer: s.layer })); } else if (e === "paste-as") { const s = this.viewModel.pasteTemplate?.template ? await J(this.viewModel.view, this.viewModel.pasteTemplate.template) : null; if (!s) return null; const r = Q(s) ? s.layer : this.viewModel.pasteTemplate.layer; for (const l of this.viewModel.clipboardFeatures) { const h = await this.constructFeatureAttributesCopy( s, r, t ? l : null ), p = new B({ geometry: l.graphic?.geometry?.clone() ?? null, attributes: h }); this.removeGraphicIdentifierFields(p, r), a.push(R({ graphic: p, layer: r })); } } return a; } async constructFeatureAttributesCopy(e, t, i) { let a = Me(e, {}); if (i) { const s = i.layer?.fields; if (s) { const r = t.fields, l = i.graphic.attributes ?? {}, h = await Ee(t, a); a = Ie( s, r, l, a, h, t ); } } return a; } async createMergedClipboardGeom() { const e = this.viewModel.clipboardFeatures.map((i) => i.graphic?.geometry).filter((i) => i != null).toArray(); return e.length === 0 ? null : e.length === 1 ? e[0].clone() : (await import("@arcgis/core/geometry/operators/unionOperator.js")).executeMany(e) ?? null; } removeGraphicIdentifierFields(e, t) { t.objectIdField && delete e.attributes[t.objectIdField], t.globalIdField && delete e.attributes[t.globalIdField]; } }; A([ o() ], v.prototype, "viewModel", 2); A([ o() ], v.prototype, "mustShowOnCommandPage", 1); A([ o() ], v.prototype, "icon", 1); A([ o() ], v.prototype, "id", 1); A([ o() ], v.prototype, "commandEnabled", 1); A([ o() ], v.prototype, "commandDisabledReason", 1); A([ o() ], v.prototype, "immediate", 1); v = A([ C("components.paste.commands.PasteCommand") ], v); var je = Object.defineProperty, We = Object.getOwnPropertyDescriptor, G = (e, t, i, a) => { for (var s = a > 1 ? void 0 : a ? We(t, i) : t, r = e.length - 1, l; r >= 0; r--) (l = e[r]) && (s = (a ? l(t, i, s) : l(s)) || s); return a && s && je(t, i, s), s; }; let F = class extends v { get id() { return "paste-append"; } get icon() { return "reshape-add-geometry"; } get immediate() { return !0; } get mustShowOnCommandPage() { return !0; } get commandEnabled() { return this.viewModel.clipboardFeatures.length > 0 && this.viewModel.selectedFeature !== void 0 && this.viewModel.layerPermissionsCheck.canUpdate( E(this.viewModel.selectedFeature) ) && this.viewModel.selectedFeature?.geometry !== null && // Need a geometry to append to (this.viewModel.selectedFeature?.geometry?.type === "multipoint" || this.viewModel.selectedFeature?.geometry?.type === "polyline" || this.viewModel.selectedFeature?.geometry?.type === "polygon") && // Cannot append to a point this.viewModel.clipboard.singleGeometryType === this.viewModel.selectedFeature?.geometry?.type; } /* * Initiate the paste command */ async initiate(e) { let t = null; try { this.viewModel.applying = !0; const i = await this.prepareAppend(); if (i.applySet && (t = i.applySet), !i.success) { this.viewModel.lastPasteError = { errorCode: i.failReason, errorMessage: ne[i.failReason], localizedErrorMessage: i.failReason }, e.onPasteError(this.viewModel.lastPasteError); return; } const a = await e.onApply({ command: "paste-append", applySet: i.applySet }); if (a.success) { this.viewModel.resetHome(), this.viewModel.closeOnApply && e.closeAfterApply(); return; } this.viewModel.handleApplyError(a, e.onPasteError); } catch (i) { this.viewModel.lastPasteError = { errorCode: "unexpectedError", errorMessage: i.message, localizedErrorMessage: "unexpectedError" }, e.onPasteError(this.viewModel.lastPasteError); return; } finally { this.viewModel.applying = !1, t && (t.featureState?.clearAll(), t.featureState = null); } } /* * Execute the command silently. Performs the logic of the paste command */ async execute() { const e = await this.prepareAppend(); if (!e.success) throw new Error(`arcgis-paste: Paste append failed. ${e.failReason}`); return { success: !0, userInputRequired: !1, applySet: e.applySet }; } /* * Builds an ApplySet for the Append command */ async prepareAppend() { const e = q(); if (e.featureState = K(this.viewModel.view), !this.viewModel.selectedFeature) return { success: !1, failReason: "noSelectedError" }; const [t, i] = await Promise.all([ import("@arcgis/core/geometry/operators/unionOperator.js"), import("@arcgis/core/geometry/operators/equalsOperator.js") ]); let a = this.viewModel.selectedFeature.geometry, s = !1; for (const l of this.viewModel.clipboardFeatures) { const h = l?.graphic?.geometry ?? null; if (!h) continue; if (a === null) { a = l?.graphic?.geometry ?? null, a && (a = a.clone(), s = !0); continue; } const p = t.execute(a, h); i.execute(a, p) || (a = p, s = !0); } if (!s) return { success: !1, failReason: "noChangeError" }; const r = this.viewModel.selectedFeature.clone(); return r.geometry = a, e.push( W({ graphic: r, layer: E(this.viewModel.selectedFeature), originalGraphic: this.viewModel.selectedFeature }) ), { success: !0, applySet: e }; } /* * A description for the command */ description(e, t) { return e.pasteAppendDesc; } /* * A label for the command */ label(e, t) { return e.pasteAppendTitle; } }; G([ o() ], F.prototype, "id", 1); G([ o() ], F.prototype, "icon", 1); G([ o() ], F.prototype, "immediate", 1); G([ o() ], F.prototype, "mustShowOnCommandPage", 1); G([ o() ], F.prototype, "commandEnabled", 1); F = G([ C("components.paste.commands.PasteAppendCommand") ], F); var Re = Object.defineProperty, Ne = Object.getOwnPropertyDescriptor, O = (e, t, i, a) => { for (var s = a > 1 ? void 0 : a ? Ne(t, i) : t, r = e.length - 1, l; r >= 0; r--) (l = e[r]) && (s = (a ? l(t, i, s) : l(s)) || s); return a && s && Re(t, i, s), s; }; let _ = class extends v { get id() { return "paste-subtract"; } get icon() { return "reshape-subtract-geometry"; } get immediate() { return !0; } get mustShowOnCommandPage() { return !0; } get commandEnabled() { return this.viewModel.clipboardFeatures.length > 0 && this.viewModel.selectedFeature !== void 0 && this.viewModel.layerPermissionsCheck.canUpdate( E(this.viewModel.selectedFeature) ) && this.viewModel.selectedFeature?.geometry !== null && // Need a geometry to append to (this.viewModel.selectedFeature?.geometry?.type === "multipoint" || this.viewModel.selectedFeature?.geometry?.type === "polyline" || this.viewModel.selectedFeature?.geometry?.type === "polygon") && // Cannot append to a point (this.viewModel.clipboard.singleGeometryType === this.viewModel.selectedFeature?.geometry?.type || this.viewModel.clipboard.singleGeometryType === "polygon"); } /* * Builds an ApplySet for the Subtract command */ async prepareSubtract() { const e = q(); if (e.featureState = K(this.viewModel.view), !this.viewModel.selectedFeature) return { success: !1, failReason: "noSelectedError", applySet: e }; const [t, i] = await Promise.all([ import("@arcgis/core/geometry/operators/differenceOperator.js"), import("@arcgis/core/geometry/operators/equalsOperator.js") ]); let a = this.viewModel.selectedFeature.geometry; if (!a) return { success: !1, failReason: "noGeometryError", applySet: e }; let s = !1; for (const l of this.viewModel.clipboardFeatures) { const h = l?.graphic?.geometry; if (!h) continue; const p = t.execute(a, h); if (!p) return { success: !1, failReason: "deletesGeometryError", applySet: e }; i.execute(a, p) || (a = p, s = !0); } if (!s) return { success: !1, failReason: "noChangeError", applySet: e }; const r = this.viewModel.selectedFeature.clone(); return r.geometry = a, e.push( W({ graphic: r, layer: E(this.viewModel.selectedFeature), originalGraphic: this.viewModel.selectedFeature }) ), { success: !0, applySet: e }; } /* * Execute the command silently. Performs the logic of the paste command */ async execute() { const e = await this.prepareSubtract(); if (!e.success) throw new Error(`arcgis-paste: Paste subtract failed. ${e.failReason}`); return { success: !0, userInputRequired: !1, applySet: e.applySet }; } /* * Initiate the paste command */ async initiate(e) { let t = null; try { this.viewModel.applying = !0; const i = await this.prepareSubtract(); if (i.applySet && (t = i.applySet), !i.success) { this.viewModel.lastPasteError = { errorCode: i.failReason, errorMessage: ne[i.failReason], localizedErrorMessage: i.failReason }, e.onPasteError(this.viewModel.lastPasteError); return; } const a = await e.onApply({ command: "paste-subtract", applySet: i.applySet }); if (a.success) { this.viewModel.resetHome(), this.viewModel.closeOnApply && e.closeAfterApply(); return; } this.viewModel.handleApplyError(a, e.onPasteError); } catch (i) { this.viewModel.lastPasteError = { errorCode: "unexpectedError", errorMessage: i.message, localizedErrorMessage: "unexpectedError" }, e.onPasteError(this.viewModel.lastPasteError); return; } finally { this.viewModel.applying = !1, t && (t.featureState?.clearAll(), t.featureState = null); } } /* * A description for the command */ description(e, t) { return e.pasteSubtractDesc; } /* * A label for the command */ label(e, t) { return e.pasteSubtractTitle; } }; O([ o() ], _.prototype, "id", 1); O([ o() ], _.prototype, "icon", 1); O([ o() ], _.prototype, "immediate", 1); O([ o() ], _.prototype, "mustShowOnCommandPage", 1); O([ o() ], _.prototype, "commandEnabled", 1); _ = O([ C("components.paste.commands.PasteSubtractCommand") ], _); var Ue = Object.defineProperty, qe = Object.getOwnPropertyDescriptor, k = (e, t, i, a) => { for (var s = a > 1 ? void 0 : a ? qe(t, i) : t, r = e.length - 1, l; r >= 0; r--) (l = e[r]) && (s = (a ? l(t, i, s) : l(s)) || s); return a && s && Ue(t, i, s), s; }; let x = class extends v { get id() { return "paste-as"; } get icon() { return "templates"; } get immediate() { return !1; } get mustShowOnCommandPage() { return !1; } get commandEnabled() { return (this.viewModel.clipboardFeatures.length === 1 || this.viewModel.clipboardFeatures.length > 0 && this.viewModel.pasteWithMultipleFeaturesEnabled) && this.viewModel.clipboard.singleGeometryType !== void 0; } /* * Initiate the paste command */ async initiate(e) { this.viewModel.activeFlowPage = "gallery-page", this.viewModel.activeCommand = "paste-as"; } /* * A description for the command */ description(e, t) { return e.pasteAsDesc; } /* * A label for the command */ label(e, t) { return e.pasteAsTitle; } }; k([ o() ], x.prototype, "id", 1); k([ o() ], x.prototype, "icon", 1); k([ o() ], x.prototype, "immediate", 1); k([ o() ], x.prototype, "mustShowOnCommandPage", 1); k([ o() ], x.prototype, "commandEnabled", 1); x = k([ C("components.paste.commands.PasteAsCommand") ], x); var Ke = Object.defineProperty, Xe = Object.getOwnPropertyDescriptor, H = (e, t, i, a) => { for (var s = a > 1 ? void 0 : a ? Xe(t, i) : t, r = e.length - 1, l; r >= 0; r--) (l = e[r]) && (s = (a ? l(t, i, s) : l(s)) || s); return a && s && Ke(t, i, s), s; }; let P = class extends v { get id() { return "paste"; } get icon() { return "duplicate"; } get immediate() { return !0; } get mustShowOnCommandPage() { return !0; } get commandEnabled() { const e = this.viewModel.clipboardFeatures.length === 1, t = this.viewModel.clipboardFeatures.length > 0 && this.viewModel.clipboardItemLayers.length === 1 && this.viewModel.pasteWithMultipleFeaturesEnabled, i = this.viewModel.clipboardFeatures.length > 0 && this.viewModel.pasteWithMultipleFeaturesEnabled && this.viewModel.pasteWithMultipleLayersEnabled; return this.viewModel.clipboardFeatures.length > 0 && this.viewModel.canCreateOnAllLayers && (e || t || i); } /* * Initiate the paste command */ async initiate(e, t) { await this.runPasteCommand(e, "paste", t); } async execute() { const e = await this.prepareCopy("paste"); if (!e || e.items.length === 0) throw new Error("arcgis-paste: No items to paste"); return e.items.length > this.viewModel.maximumFeatureCount || !await se( e, this.viewModel.view, this.viewModel.formViewModelMap, this.viewModel.maximumFeatureCountWithComplexForms ) ? { success: !1, userInputRequired: !0 } : { success: !0, userInputRequired: !1, applySet: e }; } /* * A description for the command */ description(e, t) { return e.pasteDesc; } /* * A label for the command */ label(e, t) { return e.pasteTitle; } }; H([ o() ], P.prototype, "id", 1); H([ o() ], P.prototype, "icon", 1); H([ o() ], P.prototype, "immediate", 1); H([ o() ], P.prototype, "mustShowOnCommandPage", 1); H([ o() ], P.prototype, "commandEnabled", 1); P = H([ C("components.paste.commands.PasteSetCommand") ], P); var Ze = Object.defineProperty, Je = Object.getOwnPropertyDescriptor, L = (e, t, i, a) => { for (var s = a > 1 ? void 0 : a ? Je(t, i) : t, r = e.length - 1, l; r >= 0; r--) (l = e[r]) && (s = (a ? l(t, i, s) : l(s)) || s); return a && s && Ze(t, i, s), s; }; let $ = class extends v { get id() { return "paste-merge"; } get icon() { return "merge"; } get immediate() { return !1; } get mustShowOnCommandPage() { return !0; } get commandEnabled() { return this.viewModel.clipboardFeatures.length > 1 && this.viewModel.clipboard.singleGeometryType !== void 0; } /* * Initiate the paste command */ async initiate(e) { this.viewModel.activeFlowPage = "gallery-page", this.viewModel.activeCommand = "paste-merge"; for (let t = 0; t < this.viewModel.clipboard.items.length; t++) if (this.viewModel.clipboard.items.getItemAt(t).type === "feature") { this.viewModel.selectedClipboardItemIndex = t; break; } } /* * A description for the command */ description(e, t) { return e.pasteMergeDesc; } /* * A label for the command */ label(e, t) { return e.pasteMergeTitle; } }; L([ o() ], $.prototype, "id", 1); L([ o() ], $.prototype, "icon", 1); L([ o() ], $.prototype, "immediate", 1); L([ o() ], $.prototype, "mustShowOnCommandPage", 1); L([ o() ], $.prototype, "commandEnabled", 1); $ = L([ C("components.paste.commands.PasteMergeCommand") ], $); var Qe = Object.defineProperty, Ye = Object.getOwnPropertyDescriptor, I = (e, t, i, a) => { for (var s = a > 1 ? void 0 : a ? Ye(t, i) : t, r = e.length - 1, l; r >= 0; r--) (l = e[r]) && (s = (a ? l(t, i, s) : l(s)) || s); return a && s && Qe(t, i, s), s; }; let y = class extends v { //#region Lifecycle constructor(e) { super(e); } get id() { return this.customCommand.id; } get icon() { return this.customCommand.icon; } get immediate() { return !0; } get mustShowOnCommandPage() { return !0; } get commandEnabled() { return this.customCommand.commandEnabled(this.viewModel.clipboard, this.viewModel.selectedFeature); } /* * Initiate the paste command */ async initiate(e) { try { this.viewModel.applying = !0; const t = await e.onApply({ command: this.id }); if (t.success) { this.viewModel.resetHome(), this.viewModel.closeOnApply && e.closeAfterApply(); return; } this.viewModel.handleApplyError(t, e.onPasteError); } catch (t) { this.viewModel.lastPasteError = { errorCode: "unexpectedError", errorMessage: t.message, localizedErrorMessage: "unexpectedError" }, e.onPasteError(this.viewModel.lastPasteError); return; } finally { this.viewModel.applying = !1; } } /* * A description for the command */ description(e, t) { return this.customCommand.description(e, t); } /* * A label for the command */ label(e, t) { return this.customCommand.label(e, t); } }; I([ o() ], y.prototype, "customCommand", 2); I([ o() ], y.prototype, "id", 1); I([ o() ], y.prototype, "icon", 1); I([ o() ], y.prototype, "immediate", 1); I([ o() ], y.prototype, "mustShowOnCommandPage", 1); I([ o() ], y.prototype, "commandEnabled", 1); y = I([ C("components.paste.commands.PasteCustomCommand") ], y); var et = Object.defineProperty, tt = Object.getOwnPropertyDescriptor, c = (e, t, i, a) => { for (var s = a > 1 ? void 0 : a ? tt(t, i) : t, r = e.length - 1, l; r >= 0; r--) (l = e[r]) && (s = (a ? l(t, i, s) : l(s)) || s); return a && s && et(t, i, s), s; }; function te(e) { return !ie(e) || e.type === "feature"; } let n = class extends U { //#region Lifecycle constructor(e) { super(e), this.customPasteCommands = new j(), this.bauInvalidFeatures = [], this.bauFormValid = !0, this.bauFormUpdating = !1, this.bauActiveFeatureIndex = -1, this.bauHasTooManyFeatures = !1, this.bauHasTooManyComplexFeatures = !1, this.bauOriginalGraphics = [], this.formViewModelMap = /* @__PURE__ */ new Map(), this.supportedCommands = ["paste-append", "paste-as", "paste-subtract", "paste", "paste-merge"], this.pasteWithMultipleLayersEnabled = !1, this.pasteWithMultipleFeaturesEnabled = !1, this.alwaysShowFeatureForm = !1, this.selectedClipboardItemIndex = -1, this.pasteWithAttributes = !0, this.closeOnApply = !1, this.currentPasteOperation = "", this.disableTemplatesMode = "never", this._activeFlowPage = "commands-page", this.showClipboardItems = !1, this.hideTooltips = !1, this.hideFooter = !1, this.hideFooterCancelButton = !1, this.hideHeaderCloseButton = !1, this.hideViewClipboard = !1, this.hideErrorNotice = !1, this.highlightGroup = "temporary", this._hoverHighlightHandle = null, this.maximumFeatureCount = 200, this.maximumFeatureCountWithComplexForms = 50, this.layerPermissionsCheck = { canCreate: (t) => t ? !!t.effectiveCapabilities?.operations.supportsAdd : !1, canUpdate: (t) => { if (!t) return !1; const i = t.effectiveCapabilities, a = !!i?.operations.supportsUpdate, s = !!i?.editing.supportsGeometryUpdate && a; return !t.isTable && !s ? !1 : a; } }, this.applying = !1; } get bauActiveGraphic() { return this.bauActiveFeatureIndex === -1 ? void 0 : this.bauFeatures?.getItemAt(this.bauActiveFeatureIndex); } get hasTooManyPasteCreateFeatures() { return this.clipboardFeatures.length > this.maximumFeatureCount && ["paste", "paste-as"].includes(this.activeCommand ?? ""); } get bauActiveLayer() { if (this.bauActiveFeatureIndex !== -1 && this.bauFeatures) return E(this.bauFeatures.getItemAt(this.bauActiveFeatureIndex)) ?? void 0; } get pasteTemplateIsValid() { return this.pasteTemplate ? this.pasteTemplate.layer ? !!this.workingLayers.includes( this.pasteTemplate.layer.type === "subtype-sublayer" ? this.pasteTemplate.layer.parent : this.pasteTemplate.layer ) : !1 : !0; } get clipboardAndTemplateSupportAttributes() { if (this.clipboardFeatures.length === 0 || !this.pasteTemplate?.layer) return !1; const e = this.pasteTemplate.template; if (!te(e)) return !1; for (const t of this.clipboardFeatures) { const i = t.layer; if (!i) return !1; const a = i.type === "subtype-sublayer" ? i.parent : i; if (a.type === "subtype-group") { const s = a.fieldsIndex.get(a.subtypeField).name, r = e.prototype?.[s]; if (r == null || r !== t.graphic.attributes[s]) return !1; } } return !0; } get hasClipboardItemMatchingTemplate() { const e = this.pasteTemplate?.layer; if (!e || this.clipboardFeatures.length === 0) return !1; const t = this.pasteTemplate.template; if (!te(t)) return !1; for (const i of this.clipboardFeatures) { const a = i.layer; if (!a) return !1; const s = a.type === "subtype-sublayer" ? a.parent : a; if (e === a) { if (s.type === "subtype-group") { const r = s.fieldsIndex.get(s.subtypeField).name, l = t.prototype?.[r]; if (l == null || l !== i.graphic.attributes[r]) continue; } return !0; } } return !1; } get activeFlowPage() { return this._activeFlowPage; } // When setting the active flow page // need to remember the before Page (when using clipboard or paste-form flow items) set activeFlowPage(e) { e === "clipboard" && this.beforeClipboard === void 0 ? this.beforeClipboard = this.activeFlowPage : e !== "clipboard" && (this.beforeClipboard = void 0), e === "form-page" && this.beforeForm === void 0 ? this.beforeForm = this.activeFlowPage : e !== "form-page" && (this.beforeForm = void 0), this._activeFlowPage = e, this.checkAndSuspendMove(); } get updating() { return this.applying; } // Update ApplySet after user changes feature on the BAU form. formFeatureValuesChanged(e, t) { if (!t) return; const i = e.graphic.clone(); for (const s of Object.keys(t)) i.attributes[s] = t[s]; const a = W({ graphic: i, originalGraphic: e.graphic.clone(), layer: e.layer }); this.bauApplySet?.push(a); } // Highlight the selected clipboard item on the map highlightSelectedGraphicOnMap(e) { if (this.clearHighlightSelectedGraphic(), !e.graphic?.geometry || !this.view) return; const t = new B({ geometry: e.graphic.geometry, symbol: be(e.graphic.geometry.type) }); this.view.graphics.add(t), this._hoverHighlightHandle = { remove: () => { this.view.graphics.remove(t); } }; } // Clear the highlights from the highlighted clipboard items clearHighlightSelectedGraphic() { this._hoverHighlightHandle?.remove(), this._hoverHighlightHandle = null; } updateIndividualMultiFeatureFormHighlight() { if (this.activeFlowPage !== "form-page") { this.clearIndividualFeatureFormHighlight(); return; } if (this.view) if (this.bauActiveGraphic && this.bauActiveLayer) { if (this.bauIndividualHighlight?.graphic !== this.bauActiveGraphic && this.clearIndividualFeatureFormHighlight(), !this.bauIndividualHighlight) { const e = ee(this.view, this.bauActiveLayer); if (!e) return; this.bauIndividualHighlight = { graphic: this.bauActiveGraphic, handle: e.highlight(this.bauActiveGraphic, { name: this.highlightGroup }) }; } } else this.clearIndividualFeatureFormHighlight(); } // Clear the multi feature form highlights clearIndividualFeatureFormHighlight() { this.bauIndividualHighlight?.handle?.remove(), this.bauIndividualHighlight = void 0; } // When using the Multi Feature Form, it is helpful to see the graphic // highlighted on the map highlightMultiFeatureFormFeature(e, t) { this.bauHighlight && this.clearMultiFeatureFormHighlights(); const i = this.view ? ee(this.view, e.layer) : void 0; i && (this.bauHighlight = i.highlight(e, { name: this.highlightGroup })); } // Clear the multi feature form highlights clearMultiFeatureFormHighlights() { this.bauHighlight?.remove(), this.bauHighlight = void 0; } // When the clipboard contents change and/or // the show clipboard graphics is set to true or false // Need to renew the generated graphics on the map updateClipboardGraphicsLayer() { if (!this.showClipboardItems) { if (this.clipboardMover?.cancel(), this.clipboardMover = void 0, this.clipboardGraphicsLayer && this.view) try { this.view.map?.remove(this.clipboardGraphicsLayer), this.clipboardGraphicsLayer = void 0; } catch { } return; } if (this.showClipboardItems && this.view) { this.clipboardGraphicsLayer || (this.clipboardGraphicsLayer = new we({ listMode: "hide" }), this.view.map?.layers.add(this.clipboardGraphicsLayer)); const e = this.clipboard.items; this.clipboardGraphicsLayer.removeAll(); let t = -1; for (const i of e) { if (t++, i.type !== "feature" || !i.graphic.geometry) continue; const a = new B({ geometry: i.graphic.geometry.clone(), attributes: { clipboardIdx: t }, symbol: ye(i.graphic.geometry.type) }); this.clipboardGraphicsLayer.add(a); } } else if (!this.showClipboardItems && this.view && this.clipboardGraphicsLayer) try { this.view.map?.remove(this.clipboardGraphicsLayer), this.clipboardGraphicsLayer = void 0; } catch { } this.checkAndSuspendMove(); } checkAndSuspendMove() { const e = this.activeFlowPage === "form-page"; this.clipboardGraphicsLayer && (this.clipboardGraphicsLayer.visible = !e), this.clipboardMover && (this.clipboardMover.suspended = e); } get clipboard() { return fe(); } get clipboardFeatures() { return this.clipboard.items.filter((e) => e.type === "feature"); } get hasPasteCommandsPage() { return this.availableCommands.length > 1 || !!this.availableCommands.at(0)?.mustShowOnCommandPage; } _clearActiveCommand() { this.activeCommand = void 0, this.lastPasteError = void 0; } // Reset to the landing flow item // The landing flow item will depend on the configuration // of the component and/or the contents of the clipboard resetHome() { let e = this.activeFlowPage; this.hasPasteCommandsPage ? (e = "commands-page", this._clearActiveCommand(), this.selectedClipboardItemIndex = -1) : this.clipboard.items.length === 0 ? (e = "clipboard-empty-page", this._clearActiveCommand(), this.selectedClipboardItemIndex = -1) : this.availableCommands.length === 0 ? (e = "no-command-page", this._clearActiveCommand()) : this.availableCommands[0].commandEnabled ? (e = "gallery-page", this.activeCommand = this.availableCommands[0].id, this.lastPasteError = void 0) : (e = "no-command-page", this._clearActiveCommand(), this.selectedClipboardItemIndex = -1), this.activeFlowPage === "clipboard" && this.hideViewClipboard ? (this.activeFlowPage = e, this.beforeClipboard = void 0) : this.activeFlowPage === "clipboard" && !this.hideViewClipboard ? this.beforeClipboard = e : (this.activeFlowPage = e, this.beforeClipboard = void 0), this.resetFormPage(); } get workingLayers() { return (this.view?.map?.allLayers?.toArray() ?? []).filter( (e) => e.type === "feature" || e.type === "subtype-group" ).filter((e) => { let t = this.clipboard.singleGeometryType; return this.activeCommand === "paste-merge" && this.clipboard.singleGeometryType === "point" && (t = "multipoint"), !(e.geometryType !== t || !this.layerPermissionsCheck.canCreate(e)); }).slice(0).reverse(); } get clipboardItemLayers() { const e = /* @__PURE__ */ new Set(); for (const t of this.clipboard.items) t.layer && e.add(t.layer.type === "subtype-sublayer" ? t.layer.parent : t.layer); return [...e]; } get canCreateOnAllLayers() { if (this