@arcgis/core 4.25.0-next.20221021 → 4.25.0-next.20221022
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.
- package/WebMap.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{0b0f3e93f658a012d5f0.js → 00df1053d3a8761fc0a3.js} +1 -1
- package/assets/esri/core/workers/chunks/0de7eca7acf74947cf2e.js +1 -0
- package/assets/esri/core/workers/chunks/{2474f0e8b8abc1387106.js → 2600954826b42f2b70c4.js} +1 -1
- package/assets/esri/core/workers/chunks/{af3f30f968363bb3930c.js → 353c4a51be72c4a77e1f.js} +1 -1
- package/assets/esri/core/workers/chunks/{2d8201f0f33ba66bb96b.js → 5f46751fa500a9dfacf9.js} +1 -1
- package/assets/esri/core/workers/chunks/{b9e93d9ea80361716f1d.js → 64190294f3dc9237b420.js} +1 -1
- package/assets/esri/core/workers/chunks/{883cfe319b15ebabf71e.js → 73ad8f3d3feff5882988.js} +1 -1
- package/assets/esri/core/workers/chunks/{177c8d5e2531c6f64581.js → 796504f93100aea7c6f5.js} +1 -1
- package/assets/esri/core/workers/chunks/8435ae4fe5a5332b1076.js +1 -0
- package/assets/esri/core/workers/chunks/{c8c0f091aab41e4effa5.js → 85690fabbfe60681f5e7.js} +1 -1
- package/assets/esri/core/workers/chunks/{942da417257f8fd8e4cf.js → 858970a88406562a26cc.js} +1 -1
- package/assets/esri/core/workers/chunks/a17d20ffaa47d430d98c.js +1 -0
- package/assets/esri/core/workers/chunks/ac2903c5f1587dec2f80.js +1 -0
- package/assets/esri/core/workers/chunks/{7ba0cfe4d1c214f44fc7.js → b6d9750b16bbf8ce5307.js} +1 -1
- package/assets/esri/core/workers/chunks/{7f40f4ac6e2af4b333f5.js → c4e5b929b152f8d36cc3.js} +1 -1
- package/assets/esri/core/workers/chunks/c7de993c0a85594a1969.js +1 -0
- package/assets/esri/core/workers/chunks/ca92022f53080fda75fe.js +1 -0
- package/assets/esri/core/workers/chunks/d7668e81467833a5a53d.js +1 -0
- package/assets/esri/core/workers/chunks/de83b062359c0459585f.js +1 -0
- package/assets/esri/core/workers/chunks/f57c3343f93d87423856.js +1 -0
- package/assets/esri/core/workers/chunks/f704ed07c514a0f436ec.js +1 -0
- package/assets/esri/themes/base/_color.scss +1 -0
- package/assets/esri/themes/base/widgets/_BasemapLayerList.scss +58 -14
- package/assets/esri/themes/base/widgets/_LayerList.scss +57 -13
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/geometry/support/normalizeUtils.js +1 -1
- package/interfaces.d.ts +109 -6
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolHelper.js +1 -1
- package/symbols/cim/Rasterizer.js +1 -1
- package/symbols/cim/rasterizingUtils.js +5 -0
- package/views/2d/engine/brushes.js +1 -1
- package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
- package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleLayer.js +1 -1
- package/views/2d/engine/vtlBrushes.js +5 -0
- package/views/2d/engine/webgl/mesh/bufcut.js +1 -1
- package/views/2d/layers/features/schemaUtils.js +1 -1
- package/widgets/BasemapLayerList/BasemapLayerListViewModel.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
- package/widgets/FeatureForm/FormExpressionArcadeExecutor.js +1 -1
- package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/LayerList/LayerListViewModel.js +1 -1
- package/widgets/LayerList/ListItem.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/assets/esri/core/workers/chunks/0cfb97b9f38c31b3b33a.js +0 -1
- package/assets/esri/core/workers/chunks/2a63949c3aad9ace1b44.js +0 -1
- package/assets/esri/core/workers/chunks/3b5be512567d9c1c6fe6.js +0 -1
- package/assets/esri/core/workers/chunks/4450f17444947fe2f27f.js +0 -1
- package/assets/esri/core/workers/chunks/5abda500f5d5607155ab.js +0 -1
- package/assets/esri/core/workers/chunks/81139c01e8016cbbe324.js +0 -1
- package/assets/esri/core/workers/chunks/94027976cfca4ad5789b.js +0 -1
- package/assets/esri/core/workers/chunks/9d410721f42259efe666.js +0 -1
- package/assets/esri/core/workers/chunks/b17ff3dfdc638f9f5705.js +0 -1
- package/assets/esri/core/workers/chunks/d6eb078d94171fb9d3d4.js +0 -1
- package/rest/geometry/cut.js +0 -5
- package/rest/geometry/simplify.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import i from"../../core/Collection.js";import{HandleOwnerMixin as r}from"../../core/HandleOwner.js";import{IdentifiableMixin as s}from"../../core/Identifiable.js";import{watch as o,initial as n}from"../../core/reactiveUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import{cast as a}from"../../core/accessorSupport/decorators/cast.js";import{subclass as
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import i from"../../core/Collection.js";import{HandleOwnerMixin as r}from"../../core/HandleOwner.js";import{IdentifiableMixin as s}from"../../core/Identifiable.js";import{watch as o,initial as n}from"../../core/reactiveUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import{cast as a}from"../../core/accessorSupport/decorators/cast.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../support/actions/ActionBase.js";import c from"../../support/actions/ActionButton.js";import d from"../../support/actions/ActionSlider.js";import u from"../../support/actions/ActionToggle.js";import y from"./ListItemPanel.js";import{isLayerOutsideScaleRange as m,findLayerVisibilityMode as v,findLayerListMode as b,canDisplayLayer as f,getNormalizedChildLayerProperty as w}from"./support/layerListUtils.js";var g;const S=i.ofType({key:"type",defaultKeyValue:"button",base:p,typeMap:{button:c,toggle:u,slider:d}}),C=i.ofType(S),_="layer",O="child-list-mode",j="hide",I="esri.widgets.LayerList.ListItem";let L=g=class extends(s(r(e))){constructor(t){super(t),this.actionsSections=new C,this.actionsOpen=!1,this.checkPublishStatusEnabled=!1,this.children=new(i.ofType(g)),this.childrenSortable=!0,this.hidden=!1,this.layer=null,this.layerView=null,this.listItemCreatedFunction=null,this.open=!1,this.panel=null,this.parent=null,this.sortable=!0,this.view=null}initialize(){if(this.handles.add([o((()=>this.layer),(t=>this._watchLayerProperties(t)),n),o((()=>this.view),(t=>this._updateChildren(t)),n),o((()=>this.panel),(t=>this._setListItemOnPanel(t)),n),o((()=>[this.layer,this.view]),(()=>this._getLayerView()),n)]),"function"==typeof this.listItemCreatedFunction){const t={item:this};this.listItemCreatedFunction.call(null,t)}}destroy(){this.view=null}get connectionStatus(){const{layerView:t,publishing:e}=this;if(!e&&t&&"connectionStatus"in t)return t.connectionStatus}get error(){return this.layer?.loadError}get incompatible(){const{layerView:t}=this;return!(!t||!("spatialReferenceSupported"in t))&&!t.spatialReferenceSupported}castPanel(t){return this.get("panel.open")&&!t.hasOwnProperty("open")&&(t.open=!0),t?new y(t):null}get title(){const t=this.get("layer.layer");return(!t||t&&this.get("layer.layer.loaded"))&&this.get("layer.title")||this.get("layer.attributes.title")||""}set title(t){this._override("title",t)}get publishing(){const{layer:t,checkPublishStatusEnabled:e}=this;return e&&t&&"publishingInfo"in t&&"publishing"===t.publishingInfo.status}get updating(){const{layerView:t,connectionStatus:e,layer:i,publishing:r}=this;return!r&&!e&&(t?t.updating:"loading"===i?.loadStatus||!1)}get visible(){return this.layer?.visible}set visible(t){const e=this.layer;e&&(e.visible=t)}get visibleAtCurrentScale(){return!m(this.layer,this.get("view.scale"))}get visibilityMode(){return v(this.layer)}clone(){return new g({actionsSections:this.actionsSections.clone(),actionsOpen:this.actionsOpen,children:this.children.clone(),layer:this.layer,listItemCreatedFunction:this.listItemCreatedFunction,open:this.open,panel:this.panel,title:this.title,view:this.view,visible:this.visible})}_setListItemOnPanel(t){t&&(t.listItem=this)}_updateChildren(t){const e=this.children;e&&e.forEach((e=>e.view=t))}_addChildren(t){if(this.handles.remove(O),this.children.removeAll(),!t)return;t.forEach((e=>{this.handles.add(o((()=>e.listMode),(()=>this._addChildren(t))),O)}));const e=t.filter((t=>b(t)!==j));this.children.addMany(this._makeChildren(e))}_watchSublayerChanges(t){t&&this.handles.add(t.on("change",(()=>{this._addChildren(t)})),_)}_initializeChildLayers(t){this._addChildren(t),this._watchSublayerChanges(t)}_makeChildren(t){return t.map((t=>f(t)?new g({layer:t,listItemCreatedFunction:this.listItemCreatedFunction,parent:this,view:this.view}):null)).reverse()}_watchLayerProperties(t){if(!this.handles)return;if(this.handles.remove(_),this.handles.remove(O),!t)return;this.handles.add(o((()=>t.listMode),(()=>this._watchLayerProperties(t))),_);if("hide-children"===b(t))return void this.children.removeAll();const e=w(t);e&&this.handles.add(o((()=>t[e]),(()=>{t.hasOwnProperty(e)&&this._initializeChildLayers(t[e])}),n),_)}async _getLayerView(){const{layer:t,view:e}=this;if(t&&e)try{const i=await e.whenLayerView(t);if(i.layer!==this.layer)return;this._set("layerView",i)}catch{}}};t([l({type:C})],L.prototype,"actionsSections",void 0),t([l()],L.prototype,"actionsOpen",void 0),t([l()],L.prototype,"checkPublishStatusEnabled",void 0),t([l({type:i})],L.prototype,"children",void 0),t([l()],L.prototype,"childrenSortable",void 0),t([l({readOnly:!0})],L.prototype,"connectionStatus",null),t([l({readOnly:!0})],L.prototype,"error",null),t([l()],L.prototype,"hidden",void 0),t([l({readOnly:!0})],L.prototype,"incompatible",null),t([l()],L.prototype,"layer",void 0),t([l({readOnly:!0})],L.prototype,"layerView",void 0),t([l()],L.prototype,"listItemCreatedFunction",void 0),t([l()],L.prototype,"open",void 0),t([l({type:y})],L.prototype,"panel",void 0),t([a("panel")],L.prototype,"castPanel",null),t([l()],L.prototype,"parent",void 0),t([l()],L.prototype,"sortable",void 0),t([l()],L.prototype,"title",null),t([l({readOnly:!0})],L.prototype,"publishing",null),t([l({readOnly:!0})],L.prototype,"updating",null),t([l()],L.prototype,"view",void 0),t([l()],L.prototype,"visible",null),t([l({readOnly:!0})],L.prototype,"visibleAtCurrentScale",null),t([l({readOnly:!0})],L.prototype,"visibilityMode",null),L=g=t([h(I)],L);const P=L;export{P as default};
|
package/widgets/LayerList.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{eventKey as i}from"../core/events.js";import s from"../core/Handles.js";import has from"../core/has.js";import{on as n,watch as o,initial as l,syncAndInitial as r}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import{cast as c}from"../core/accessorSupport/decorators/cast.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import h from"./Widget.js";import m from"./LayerList/LayerListViewModel.js";import g from"./LayerList/ListItem.js";import{findSelectedItem as u,sortLayersToIds as p,sortChildLayersToIds as _,canSortSublayers as b}from"./LayerList/support/layerListUtils.js";import{accessibleHandler as y}from"./support/decorators/accessibleHandler.js";import{messageBundle as I}from"./support/decorators/messageBundle.js";import{vmEvent as v}from"./support/decorators/vmEvent.js";import{tsx as f}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import C from"sortablejs";function w(e,t,i){e.splice(i,0,e.splice(t,1)[0])}const A="esri-layerlist-new-ui",S=t.ofType(g),k="data-sort-filter",L="data-layer-uid",M="layerUid",T={base:"esri-layer-list esri-widget esri-widget--panel",newUI:"esri-layer-list--new-ui",noItems:"esri-layer-list__no-items",list:"esri-layer-list__list",listRoot:"esri-layer-list__list--root",listExclusive:"esri-layer-list__list--exclusive",listInherited:"esri-layer-list__list--inherited",listIndependent:"esri-layer-list__list--independent",item:"esri-layer-list__item",itemContent:"esri-layer-list__item-content",itemMessage:"esri-layer-list__item--has-message",itemInvisible:"esri-layer-list__item--invisible",itemInvisibleAtScale:"esri-layer-list__item--invisible-at-scale",itemUpdating:"esri-layer-list__item--updating",itemChildren:"esri-layer-list__item--has-children",itemSelectable:"esri-layer-list__item--selectable",itemContainer:"esri-layer-list__item-container",actionsMenu:"esri-layer-list__item-actions-menu",actionsMenuItem:"esri-layer-list__item-actions-menu-item",actionsMenuItemActive:"esri-layer-list__item-actions-menu-item--active",actions:"esri-layer-list__item-actions",actionsList:"esri-layer-list__item-actions-list",action:"esri-layer-list__item-action",actionIcon:"esri-layer-list__item-action-icon",actionImage:"esri-layer-list__item-action-image",actionTitle:"esri-layer-list__item-action-title",actionToggle:"esri-layer-list__action-toggle",actionToggleOn:"esri-layer-list__action-toggle--on",label:"esri-layer-list__item-label",message:"esri-layer-list__item-message",title:"esri-layer-list__item-title",connectionStatus:"esri-layer-list__connection-status",connectionStatusDisconnected:"esri-layer-list__connection-status--disconnected",connectionStatusConnected:"esri-layer-list__connection-status--connected",toggleVisible:"esri-layer-list__item-toggle",toggleVisibleIcon:"esri-layer-list__item-toggle-icon",toggleIcon:"esri-layer-list__item-toggle-icon",radioIcon:"esri-layer-list__item-radio-icon",childToggle:"esri-layer-list__child-toggle",childToggleOpen:"esri-layer-list__child-toggle--open",childOpened:"esri-layer-list__child-toggle-icon--opened",childClosed:"esri-layer-list__child-toggle-icon--closed",childClosed_RTL:"esri-layer-list__child-toggle-icon--closed-rtl",sortableChosen:"esri-layer-list--chosen",disabled:"esri-disabled",disabledElement:"esri-disabled-element",hidden:"esri-hidden",rotating:"esri-rotating",iconEllipses:"esri-icon-handle-horizontal",iconVisible:"esri-icon-visible",iconInvisible:"esri-icon-non-visible",iconRadioSelected:"esri-icon-radio-checked",iconRadioUnselected:"esri-icon-radio-unchecked",iconNoticeTriangle:"esri-icon-notice-triangle",iconChildrenOpen:"esri-icon-down-arrow",iconDownArrow:"esri-icon-down-arrow",iconRightArrow:"esri-icon-right-triangle-arrow",iconLeftArrow:"esri-icon-left-triangle-arrow",iconLoading:"esri-icon-loading-indicator",iconDefaultAction:"esri-icon-default-action",widgetIcon:"esri-icon-layers"},E={actions:"actions",actionSection:"action-section",items:"items"},R={exclusive:"exclusive",inherited:"inherited",independent:"independent"};function x(e){const{actionsOpen:t,children:i}=e;t&&(e.actionsOpen=!1),i.forEach((e=>x(e)))}const U="root",N={statusIndicators:!0,errors:!1};let O=class extends h{constructor(e,t){super(e,t),this._handles=new s,this._sortableNodes=new Map,this._sortableMap=new Map,this._focusSortUid=null,this._newUI=has(A),this._tooltipReferenceMap=new Map,this.visibleItems=null,this.iconClass=T.widgetIcon,this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.messages=null,this.messagesCommon=null,this.multipleSelectionEnabled=!1,this.selectionEnabled=!1,this.selectedItems=new S,this.viewModel=new m,this.visibleElements={...N},this._onSortableSort=({to:e,from:t,item:i,newIndex:s})=>{t&&e&&(t===e?this._sortLayers(this._sortableMap.get(t.dataset.group)):this._moveLayerFromChildList({to:e,from:t,item:i,newIndex:s}))},this._sortableCanSort=(e,t)=>!(!e.el.dataset.group||!t.el.dataset.group),this._sortableCanPull=(e,t,i)=>{const{listItemCanGiveFunction:s}=this,n={selected:i["data-item"],from:t.el["data-item"],to:e.el["data-item"]};return!this._sortableCanSort(e,t)||"function"!=typeof s||s.call(null,n)},this._sortableCanPut=(e,t,i)=>{const{listItemCanReceiveFunction:s}=this,n={selected:i["data-item"],from:t.el["data-item"],to:e.el["data-item"]};return!this._sortableCanSort(e,t)||"function"!=typeof s||s.call(null,n)},this._onSortableEnd=({oldIndex:e,from:t,to:i,item:s})=>{t!==i&&t.insertBefore(s,t.children[e])}}initialize(){const e=this.operationalItems;this._setVisibleItems(e),this.addHandles([n((()=>this.operationalItems),"change",(()=>this._itemsChanged(e))),o((()=>this.visibleElements),(()=>this._itemsChanged(e))),o((()=>this.selectionEnabled),(()=>this._toggleAllSorting()),l)])}loadDependencies(){return import("@esri/calcite-components/dist/components/calcite-tooltip.js")}destroy(){this._destroySortables(),this._tooltipReferenceMap.clear(),this._handles.destroy(),this._handles=null}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get operationalItems(){return this.viewModel.operationalItems}set operationalItems(e){this.viewModel.operationalItems=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...N,...e}}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{visibleItems:e,_newUI:t}=this,i=this.viewModel?.state,s={[T.newUI]:t,[T.hidden]:"loading"===i,[T.disabled]:"disabled"===i},n=this.renderItemTooltips(),o=this.renderItems();return f("div",{class:this.classes(T.base,s)},e?.length?[n,o]:this.renderNoItems())}renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?f("calcite-tooltip",{label:i.layerIncompatible,referenceElement:t.get(e.uid)},i.layerIncompatibleTooltip):null}renderItemTooltipNodes(e){const{incompatible:t,children:i}=e;return[t?this.renderItemTooltip(e):null,...t?[]:i?.toArray().map((e=>this.renderItemTooltipNodes(e)))]}renderItemTooltips(){return this.visibleItems.toArray().map((e=>this.renderItemTooltipNodes(e)))}renderNoItems(){return f("div",{class:T.noItems},this.messages.noItemsToDisplay)}renderItems(){const{visibleItems:e,selectionEnabled:t,messages:i}=this;return f("ul",{"aria-label":i.widgetLabel,role:t?"listbox":void 0,afterCreate:this._sortNodeCreated,afterUpdate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,"data-group":U,bind:this,class:this.classes(T.list,T.listRoot,T.listIndependent)},e?.map((e=>this.renderItem(e,null))).toArray())}renderActionsMenuIcon(e,t){const{messagesCommon:i}=this,s={[T.actionsMenuItemActive]:e.actionsOpen};return f("div",{key:"actions-menu-toggle","data-item":e,bind:this,onclick:this._toggleActionsOpen,onkeydown:this._toggleActionsOpen,class:this.classes(T.actionsMenuItem,s),tabindex:"0",role:"button","aria-controls":t,"aria-label":i.options,title:i.options},f("span",{"aria-hidden":"true",class:T.iconEllipses}))}renderActionsMenu(e,t,i,s){const{panel:n}=e,o=n&&n.visible?this.renderPanelButton(n):null,l=1===i&&this._getSingleActionButton(t),r=l?this.renderAction({item:e,action:l,singleAction:!0}):null,a=!l&&i?this.renderActionsMenuIcon(e,s):null;return a||o||l?f("div",{key:"actions-menu",class:T.actionsMenu},o,r,a):null}renderChildList(e,t){const{selectionEnabled:i}=this,{visibilityMode:s,children:n}=e,o=this._hasChildren(e),l=!o&&i&&"group"===e.layer?.type,{exclusive:r,inherited:a}=R,c={[T.listExclusive]:s===r,[T.listInherited]:s===a,[T.listIndependent]:s!==a&&s!==r};return o||l?f("ul",{bind:this,key:"list-items",id:t,"data-group":e.uid,"data-item":e,afterCreate:this._sortNodeCreated,afterUpdate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,class:this.classes(T.list,c),"aria-expanded":e.open?"true":"false",role:i?"listbox":s===r?"radiogroup":"group",hidden:!e.open&&!l||null},n?.map((t=>this.renderItem(t,e))).toArray()):null}renderChildrenToggle(e,t){const{messagesCommon:i}=this,s=this._hasChildren(e),n={[T.childToggleOpen]:e.open},o=e.open?i.collapse:i.expand;return s?f("span",{onclick:this._toggleChildrenClick,onkeydown:this._toggleChildrenClick,"data-item":e,key:"toggle-children",class:this.classes(T.childToggle,n),tabindex:"0",role:"button","aria-controls":t,"aria-label":o,title:o},f("span",{"aria-hidden":"true",class:this.classes(T.childClosed,T.iconRightArrow)}),f("span",{"aria-hidden":"true",class:this.classes(T.childOpened,T.iconDownArrow)}),f("span",{"aria-hidden":"true",class:this.classes(T.childClosed_RTL,T.iconLeftArrow)})):null}renderItemMessage(e){return e.error?f("div",{key:"esri-layer-list__error",class:T.message,role:"alert"},f("span",{"aria-hidden":"true",class:T.iconNoticeTriangle}),this.messages.layerError):e.incompatible?f("div",{key:"esri-layer-list__incompatible",class:T.message,role:"alert"},f("span",{bind:this,tabIndex:0,"aria-hidden":"true",class:T.iconNoticeTriangle,afterCreate:t=>this._setTooltipReference(t,e)}),this.messages.layerIncompatible):null}renderItemContent(e,t,i){const{id:s}=this,n=`${s}_${e.uid}`,o=`${n}_actions`,l=`${n}__list`,{panel:r}=e,a=this._filterActions(e.actionsSections),c=this._countActions(a);return[f("div",{key:"list-item-container",class:T.itemContainer},this.renderChildrenToggle(e,l),this.renderLabel(e,t,i),this.renderActionsMenu(e,a,c,o)),this.renderItemMessage(e),c?this.renderActionsSections(e,a,o):null,r&&r.open&&!r.disabled?r.render():null,this.renderChildList(e,l)]}renderItem(e,t){const{_newUI:i,id:s,selectionEnabled:n,selectedItems:o,visibleElements:l}=this,r=`${`${s}_${e.uid}`}__title`,a=this._hasMessage(e),c=this._hasChildren(e),d={[T.itemChildren]:c,[T.itemMessage]:!!a,[T.itemUpdating]:e.updating&&!t&&l.statusIndicators,[T.itemInvisible]:i&&!e.visible,[T.itemInvisibleAtScale]:!e.visibleAtCurrentScale,[T.itemSelectable]:n};if(n){const i={[L]:e.layer?.uid,[k]:(!e.sortable).toString()};return f("li",{key:`item-with-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(T.item,d),"aria-labelledby":r,onclick:this._toggleSelection,onkeydown:this._selectionKeydown,"data-item":e,"data-group":t?t.uid:U,tabIndex:0,"aria-selected":u(e,o)?"true":"false",role:"option",...i},this.renderItemContent(e,t,r))}return f("li",{key:`item-no-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(T.item,d),"aria-labelledby":r},this.renderItemContent(e,t,r))}renderItemConnectionStatus(e){const{connectionStatus:t}=e;return t?f("span",{class:this.classes({[T.connectionStatus]:!0,[T.connectionStatusDisconnected]:"disconnected"===t,[T.connectionStatusConnected]:"connected"===t}),key:"layer-connection-status"}):null}renderItemTitle(e,t){const{messages:i}=this;if(!e)return null;const s=e.title||i.untitledLayer,n=e.visibleAtCurrentScale?s:`${s} (${i.layerInvisibleAtScale})`;return f("span",{key:"layer-title-container",id:t,title:n,"aria-label":n,class:T.title},s)}renderItemToggleIcon(e,t){const{_newUI:i}=this,{exclusive:s}=R,n=t&&t.visibilityMode,o={[T.toggleVisibleIcon]:i,[T.toggleIcon]:i&&n!==s,[T.radioIcon]:i&&n===s,[T.iconRadioSelected]:n===s&&e.visible,[T.iconRadioUnselected]:n===s&&!e.visible,[T.iconVisible]:n!==s&&e.visible,[T.iconInvisible]:n!==s&&!e.visible};return f("span",{key:"item-toggle-icon",class:this.classes(o),"aria-hidden":"true"})}renderItemToggle(e,t,i){const{selectionEnabled:s,messages:n}=this,{exclusive:o}=R,l=t&&t.visibilityMode,r=l===o?"radio":"switch";return f("span",s?{key:"item-toggle-selection-enabled",class:T.toggleVisible,bind:this,onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,"data-item":e,"data-parent-visibility":l,tabIndex:0,title:e.visible?n.hideLayer:n.showLayer,"aria-checked":e.visible?"true":"false",role:r,"aria-labelledby":i}:{key:"item-toggle",class:T.toggleVisible},this.renderItemToggleIcon(e,t))}renderLabel(e,t,i){const{selectionEnabled:s,_newUI:n,messages:o}=this,{inherited:l,exclusive:r}=R,a=t?.visibilityMode,c=a===r?"radio":"switch",d=[this.renderItemToggle(e,t,i),this.renderItemConnectionStatus(e),this.renderItemTitle(e,i)];n&&d.reverse();const h=f("div",s?{key:`item-label-no-selection-${e.uid}`,class:T.label}:{key:`item-label-with-selection-${e.uid}`,class:T.label,bind:this,onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,"data-item":e,"data-parent-visibility":a,tabIndex:0,"aria-checked":e.visible?"true":"false",title:e.visible?o.hideLayer:o.showLayer,role:c,"aria-labelledby":i},d);return a===l||e.error?f("div",{key:`item-label-container-${e.uid}`,class:T.label},this.renderItemTitle(e,i)):h}renderPanelButton(e){const{className:t,open:i,title:s,image:n}=e,o=n||t?t:T.iconDefaultAction,l=this._getIconImageStyles(e),r={[T.actionsMenuItemActive]:i},a={[T.actionImage]:!!l["background-image"],[T.disabledElement]:e.disabled};return o&&(a[o]=!!o),f("div",{"aria-disabled":e.disabled.toString(),key:`panel-${e.uid}`,bind:this,"data-panel":e,onclick:this._triggerPanel,onkeydown:this._triggerPanel,class:this.classes(T.actionsMenuItem,r),role:"button",tabindex:e.disabled?null:0,title:s,"aria-label":s},f("span",{class:this.classes(a),styles:l}))}renderActionsSections(e,t,i){const s=t.toArray().map(((t,i)=>f("ul",{key:`${e}-action-section-${i}`,class:T.actionsList},this.renderActionSection(e,t))));return f("div",{role:"group","aria-expanded":e.actionsOpen?"true":"false",key:"actions-section",id:i,class:T.actions,hidden:!e.actionsOpen||null},s)}renderActionSection(e,t){return(t&&t.toArray()).map((t=>this.renderAction({item:e,action:t})))}renderActionIcon(e){const{active:t,className:i}=e,s=this._getIconImageStyles(e),n="button"!==e.type||e.image||i?i:T.iconDefaultAction,o={[T.actionImage]:!t&&!!s["background-image"],[T.iconLoading]:t,[T.rotating]:t};return n&&!t&&(o[n]=!0),f("span",{key:"action-icon","aria-hidden":"true",class:this.classes(T.actionIcon,o),styles:s})}renderActionTitle(e,t){return t?null:f("span",{key:"action-title",class:T.actionTitle},e)}renderAction(e){const{item:t,action:i,singleAction:s}=e,{active:n,disabled:o,title:l}=i,r={[T.actionsMenuItem]:s&&"button"===i.type,[T.action]:n||!s&&"toggle"!==i.type,[T.actionToggle]:!n&&"toggle"===i.type,[T.actionToggleOn]:!n&&"toggle"===i.type&&i.value,[T.disabledElement]:o},a=[this.renderActionIcon(i),this.renderActionTitle(l,s)];return s?f("div",{bind:this,"data-item":t,"data-action":i,role:"button",key:`single-action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:r,tabindex:"0",title:l,"aria-label":l},a):f("li",{bind:this,"data-item":t,"data-action":i,key:`action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:r,tabindex:"0",role:"button",title:l,"aria-label":l},a)}_setTooltipReference(e,t){this._tooltipReferenceMap.set(t.uid,e),this.scheduleRender()}_hasMessage(e){return!!e.error||e.incompatible}_hasChildren(e){return!!e.children.length&&!this._hasMessage(e)}_sortNodeRemoved(e){const{_sortableMap:t}=this,i=e.dataset.group,s=t.get(i);s&&s.destroy(),t.delete(i)}_destroySortables(){const{_sortableMap:e,_sortableNodes:t}=this;e.forEach((e=>e&&e.destroy())),e.clear(),t.clear()}_moveLayerFromChildList({to:e,from:t,item:i,newIndex:s}){const n=i["data-item"],o=e["data-item"],l=t["data-item"];this.viewModel.moveListItem(n,l,o,s)}_sortLayers(e){if(!e)return;const t=e.el["data-item"],i=e.toArray();t?_(t,i):p(this.view?.map?.layers,i)}_toggleSorting(e,t){const{_sortableMap:i,selectionEnabled:s}=this,n=i.get(t),o=e["data-item"],l=(t===U||o.childrenSortable&&b(o))&&s;if(n)n.option("disabled",!l);else if(l){const s=C.create(e,{dataIdAttr:L,group:{name:t,pull:this._sortableCanPull,put:this._sortableCanPut},filter:`[${k}="true"]`,fallbackTolerance:4,onSort:this._onSortableSort,onEnd:this._onSortableEnd,disabled:!l,chosenClass:T.sortableChosen});i.set(t,s)}}_toggleAllSorting(){this._sortableNodes.forEach(((e,t)=>this._toggleSorting(e,t)))}_sortNodeCreated(e){const t=e.dataset.group;t&&(this._sortableNodes.set(t,e),this._toggleSorting(e,t))}_setVisibleItems(e){this.visibleItems=e?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}_getSingleActionButton(e){return e.reduce((e=>e)).filter((e=>e&&"button"===e.type)).getItemAt(0)}_focusListItem(e){const{_focusSortUid:t}=this;if(!e||!t)return;e["data-item"].layer?.uid===t&&(e.focus(),this._focusSortUid=null)}_watchActionSectionChanges(e,t){const i=E.actionSection+t;this._handles.add(e.on("change",this.scheduleRender.bind(this)),i),e.forEach((e=>this._renderOnActionChanges(e,t)))}_renderOnActionChanges(e,t){const i=E.actions+t;"toggle"!==e.type?"slider"!==e.type?this._handles.add(o((()=>[e?.className,e?.image,e?.id,e?.title,e?.visible]),(()=>this.scheduleRender()),l),i):this._handles.add(o((()=>[e?.className,e?.id,e?.title,e?.visible,e?.value,e?.displayValueEnabled,e?.max,e?.min,e?.step]),(()=>this.scheduleRender()),l),i):this._handles.add(o((()=>[e?.className,e?.image,e?.id,e?.title,e?.visible,e?.value]),(()=>this.scheduleRender()),l),i)}_renderOnItemChanges(e){const t=e.uid,i=E.items+t;this._handles.add([o((()=>[e?.actionsOpen,e?.visible,e?.open,e?.updating,e?.title,e?.visibleAtCurrentScale,e?.error,e?.visibilityMode,e?.panel,e?.panel?.title,e?.panel?.content,e?.panel?.className,e?.sortable,e?.childrenSortable]),(()=>this.scheduleRender()),r),o((()=>[e?.hidden,e?.error]),(()=>this._setVisibleItems(this.operationalItems))),e.actionsSections.on("change",(()=>this.scheduleRender())),e.children.on("change",(()=>this.scheduleRender()))],i),e.children.forEach((e=>this._renderOnItemChanges(e))),e.actionsSections.forEach((e=>this._watchActionSectionChanges(e,t)))}_itemsChanged(e){this._handles.removeAll(),e.forEach((e=>this._renderOnItemChanges(e))),this._tooltipReferenceMap.clear(),this._setVisibleItems(e),this.scheduleRender()}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_getIconImageStyles(e){const t="esri.widgets.LayerList.ListItemPanel"===e.declaredClass||"esri.support.Action.ActionButton"===e.declaredClass||"esri.support.Action.ActionToggle"===e.declaredClass?e.image:null;return{"background-image":t?`url("${t}")`:null}}_selectionKeydown(e){const t=["ArrowDown","ArrowUp"],s=i(e);if(!t.includes(s))return void this._toggleSelection(e);e.stopPropagation();const n=e.currentTarget,o=n["data-item"],{_sortableMap:l,selectedItems:r}=this,a=n.dataset.group,c=l.get(a);if(!c)return;const d=u(o,r),h=c.toArray(),m=e.target,g=h.indexOf(m.dataset[M]);if(-1!==g){if("ArrowDown"===s){const e=g+1;if(e>=h.length)return;d?(w(h,g,e),c.sort(h),this._sortLayers(c),this._focusSortUid=o.layer?.uid):(this._focusSortUid=o.layer?.uid,this.scheduleRender())}if("ArrowUp"===s){const e=g-1;if(e<=-1)return;d?(w(h,g,e),c.sort(h),this._sortLayers(c),this._focusSortUid=o.layer?.uid):(this._focusSortUid=o.layer?.uid,this.scheduleRender())}}}_toggleActionsOpen(e){const t=e.currentTarget["data-item"],{actionsOpen:i}=t,s=!i;s&&this.operationalItems.forEach((e=>x(e))),t.actionsOpen=s,e.stopPropagation()}_triggerPanel(e){const t=e.currentTarget["data-panel"];e.stopPropagation(),t&&!t.disabled&&(t.open=!t.open)}_triggerAction(e){const t=e.currentTarget,i=t["data-action"],s=t["data-item"];"toggle"===i.type&&(i.value=!i.value),this.triggerAction(i,s),e.stopPropagation()}_toggleVisibility(e){const t=e.currentTarget,i=t.getAttribute("data-parent-visibility"),s=t["data-item"];i===R.exclusive&&s.visible||(s.visible=!s.visible),e.stopPropagation()}_toggleChildrenClick(e){const t=e.currentTarget["data-item"];t.open=!t.open,e.stopPropagation()}_toggleSelection(e){e.stopPropagation();const{multipleSelectionEnabled:t,selectedItems:i}=this,s=e.currentTarget["data-item"],n=u(s,i),{length:o}=i;if(!t)return o&&!(n&&1===o)?(i.removeAll(),void i.add(s)):void(n?i.remove?.(n):i.add(s));n?i.remove?.(n):i.add(s)}};e([a()],O.prototype,"visibleItems",void 0),e([a()],O.prototype,"iconClass",void 0),e([a()],O.prototype,"label",null),e([a()],O.prototype,"listItemCanGiveFunction",void 0),e([a()],O.prototype,"listItemCanReceiveFunction",void 0),e([a()],O.prototype,"listItemCreatedFunction",null),e([a(),I("esri/widgets/LayerList/t9n/LayerList")],O.prototype,"messages",void 0),e([a(),I("esri/t9n/common")],O.prototype,"messagesCommon",void 0),e([a()],O.prototype,"multipleSelectionEnabled",void 0),e([a()],O.prototype,"operationalItems",null),e([a()],O.prototype,"selectionEnabled",void 0),e([a()],O.prototype,"selectedItems",void 0),e([a()],O.prototype,"view",null),e([v("trigger-action"),a({type:m})],O.prototype,"viewModel",void 0),e([a()],O.prototype,"visibleElements",void 0),e([c("visibleElements")],O.prototype,"castVisibleElements",null),e([y()],O.prototype,"_toggleActionsOpen",null),e([y()],O.prototype,"_triggerPanel",null),e([y()],O.prototype,"_triggerAction",null),e([y()],O.prototype,"_toggleVisibility",null),e([y()],O.prototype,"_toggleChildrenClick",null),e([y()],O.prototype,"_toggleSelection",null),O=e([d("esri.widgets.LayerList")],O);const j=O;export{j as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{eventKey as i}from"../core/events.js";import s from"../core/Handles.js";import has from"../core/has.js";import{isSome as n}from"../core/maybe.js";import{on as o,watch as l,initial as r,syncAndInitial as a}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import{subclass as h}from"../core/accessorSupport/decorators/subclass.js";import m from"./Widget.js";import g from"./LayerList/LayerListViewModel.js";import u from"./LayerList/ListItem.js";import{findSelectedItem as p,sortLayersToIds as _,sortChildLayersToIds as b,canSortSublayers as y}from"./LayerList/support/layerListUtils.js";import{accessibleHandler as I}from"./support/decorators/accessibleHandler.js";import{messageBundle as v}from"./support/decorators/messageBundle.js";import{vmEvent as f}from"./support/decorators/vmEvent.js";import{tsx as C}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import w from"sortablejs";function A(e,t,i){e.splice(i,0,e.splice(t,1)[0])}const S="esri-layerlist-new-ui",k=t.ofType(u),L="data-sort-filter",M="data-layer-uid",T="layerUid",E={base:"esri-layer-list esri-widget esri-widget--panel",newUI:"esri-layer-list--new-ui",noItems:"esri-layer-list__no-items",list:"esri-layer-list__list",listRoot:"esri-layer-list__list--root",listExclusive:"esri-layer-list__list--exclusive",listInherited:"esri-layer-list__list--inherited",listIndependent:"esri-layer-list__list--independent",item:"esri-layer-list__item",itemContent:"esri-layer-list__item-content",itemMessage:"esri-layer-list__item--has-message",itemInvisible:"esri-layer-list__item--invisible",itemInvisibleAtScale:"esri-layer-list__item--invisible-at-scale",itemChildren:"esri-layer-list__item--has-children",itemSelectable:"esri-layer-list__item--selectable",itemContainer:"esri-layer-list__item-container",actionsMenu:"esri-layer-list__item-actions-menu",actionsMenuItem:"esri-layer-list__item-actions-menu-item",actionsMenuItemActive:"esri-layer-list__item-actions-menu-item--active",actions:"esri-layer-list__item-actions",actionsList:"esri-layer-list__item-actions-list",action:"esri-layer-list__item-action",actionIcon:"esri-layer-list__item-action-icon",actionImage:"esri-layer-list__item-action-image",actionTitle:"esri-layer-list__item-action-title",actionToggle:"esri-layer-list__action-toggle",actionToggleOn:"esri-layer-list__action-toggle--on",label:"esri-layer-list__item-label",message:"esri-layer-list__item-message",title:"esri-layer-list__item-title",publishing:"esri-layer-list__publishing",updating:"esri-layer-list__updating",connectionStatus:"esri-layer-list__connection-status",connectionStatusConnected:"esri-layer-list__connection-status--connected",toggleVisible:"esri-layer-list__item-toggle",toggleVisibleIcon:"esri-layer-list__item-toggle-icon",toggleIcon:"esri-layer-list__item-toggle-icon",radioIcon:"esri-layer-list__item-radio-icon",childToggle:"esri-layer-list__child-toggle",childToggleOpen:"esri-layer-list__child-toggle--open",childOpened:"esri-layer-list__child-toggle-icon--opened",childClosed:"esri-layer-list__child-toggle-icon--closed",childClosed_RTL:"esri-layer-list__child-toggle-icon--closed-rtl",sortableChosen:"esri-layer-list--chosen",disabled:"esri-disabled",disabledElement:"esri-disabled-element",hidden:"esri-hidden",rotating:"esri-rotating",iconEllipses:"esri-icon-handle-horizontal",iconVisible:"esri-icon-visible",iconInvisible:"esri-icon-non-visible",iconRadioSelected:"esri-icon-radio-checked",iconRadioUnselected:"esri-icon-radio-unchecked",iconNoticeTriangle:"esri-icon-notice-triangle",iconChildrenOpen:"esri-icon-down-arrow",iconDownArrow:"esri-icon-down-arrow",iconRightArrow:"esri-icon-right-triangle-arrow",iconLeftArrow:"esri-icon-left-triangle-arrow",iconLoading:"esri-icon-loading-indicator",iconDefaultAction:"esri-icon-default-action",widgetIcon:"esri-icon-layers"},R={actions:"actions",actionSection:"action-section",items:"items"},x={exclusive:"exclusive",inherited:"inherited",independent:"independent"};function U(e){const{actionsOpen:t,children:i}=e;t&&(e.actionsOpen=!1),i.forEach((e=>U(e)))}const N="root",O={statusIndicators:!0,errors:!1};let j=class extends m{constructor(e,t){super(e,t),this._handles=new s,this._sortableNodes=new Map,this._sortableMap=new Map,this._focusSortUid=null,this._newUI=has(S),this._tooltipReferenceMap=new Map,this.visibleItems=null,this.iconClass=E.widgetIcon,this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.messages=null,this.messagesCommon=null,this.multipleSelectionEnabled=!1,this.selectionEnabled=!1,this.selectedItems=new k,this.viewModel=new g,this.visibleElements={...O},this._onSortableSort=({to:e,from:t,item:i,newIndex:s})=>{t&&e&&(t===e?this._sortLayers(this._sortableMap.get(t.dataset.group)):this._moveLayerFromChildList({to:e,from:t,item:i,newIndex:s}))},this._sortableCanSort=(e,t)=>!(!e.el.dataset.group||!t.el.dataset.group),this._sortableCanPull=(e,t,i)=>{const{listItemCanGiveFunction:s}=this,n={selected:i["data-item"],from:t.el["data-item"],to:e.el["data-item"]};return!this._sortableCanSort(e,t)||"function"!=typeof s||s.call(null,n)},this._sortableCanPut=(e,t,i)=>{const{listItemCanReceiveFunction:s}=this,n={selected:i["data-item"],from:t.el["data-item"],to:e.el["data-item"]};return!this._sortableCanSort(e,t)||"function"!=typeof s||s.call(null,n)},this._onSortableEnd=({oldIndex:e,from:t,to:i,item:s})=>{t!==i&&t.insertBefore(s,t.children[e])}}initialize(){const e=this.operationalItems;this._setVisibleItems(e),this.addHandles([o((()=>this.operationalItems),"change",(()=>this._itemsChanged(e))),l((()=>this.visibleElements),(()=>this._itemsChanged(e))),l((()=>this.selectionEnabled),(()=>this._toggleAllSorting()),r)])}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-tooltip.js")])}destroy(){this._destroySortables(),this._tooltipReferenceMap.clear(),this._handles.destroy(),this._handles=null}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get operationalItems(){return this.viewModel.operationalItems}set operationalItems(e){this.viewModel.operationalItems=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...O,...e}}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{visibleItems:e,_newUI:t}=this,i=this.viewModel?.state,s={[E.newUI]:t,[E.hidden]:"loading"===i,[E.disabled]:"disabled"===i},n=this.renderItemTooltips(),o=this.renderItems();return C("div",{class:this.classes(E.base,s)},e?.length?[n,o]:this.renderNoItems())}renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?C("calcite-tooltip",{label:i.layerIncompatible,referenceElement:t.get(e.uid)},i.layerIncompatibleTooltip):null}renderItemTooltipNodes(e){const{incompatible:t,children:i}=e;return[t?this.renderItemTooltip(e):null,...t?[]:i?.toArray().map((e=>this.renderItemTooltipNodes(e)))]}renderItemTooltips(){return this.visibleItems.toArray().map((e=>this.renderItemTooltipNodes(e)))}renderNoItems(){return C("div",{class:E.noItems},this.messages.noItemsToDisplay)}renderItems(){const{visibleItems:e,selectionEnabled:t,messages:i}=this;return C("ul",{"aria-label":i.widgetLabel,role:t?"listbox":void 0,afterCreate:this._sortNodeCreated,afterUpdate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,"data-group":N,bind:this,class:this.classes(E.list,E.listRoot,E.listIndependent)},e?.map((e=>this.renderItem(e,null))).toArray())}renderActionsMenuIcon(e,t){const{messagesCommon:i}=this,s={[E.actionsMenuItemActive]:e.actionsOpen};return C("div",{key:"actions-menu-toggle","data-item":e,bind:this,onclick:this._toggleActionsOpen,onkeydown:this._toggleActionsOpen,class:this.classes(E.actionsMenuItem,s),tabindex:"0",role:"button","aria-controls":t,"aria-label":i.options,title:i.options},C("span",{"aria-hidden":"true",class:E.iconEllipses}))}renderActionsMenu(e,t,i,s){const{panel:n}=e,o=n&&n.visible?this.renderPanelButton(n):null,l=1===i&&this._getSingleActionButton(t),r=l?this.renderAction({item:e,action:l,singleAction:!0}):null,a=!l&&i?this.renderActionsMenuIcon(e,s):null;return a||o||l?C("div",{key:"actions-menu",class:E.actionsMenu},o,r,a):null}renderChildList(e,t){const{selectionEnabled:i}=this,{visibilityMode:s,children:n}=e,o=this._hasChildren(e),l=!o&&i&&"group"===e.layer?.type,{exclusive:r,inherited:a}=x,c={[E.listExclusive]:s===r,[E.listInherited]:s===a,[E.listIndependent]:s!==a&&s!==r};return o||l?C("ul",{bind:this,key:"list-items",id:t,"data-group":e.uid,"data-item":e,afterCreate:this._sortNodeCreated,afterUpdate:this._sortNodeCreated,afterRemoved:this._sortNodeRemoved,class:this.classes(E.list,c),"aria-expanded":e.open?"true":"false",role:i?"listbox":s===r?"radiogroup":"group",hidden:!e.open&&!l||null},n?.map((t=>this.renderItem(t,e))).toArray()):null}renderChildrenToggle(e,t){const{messagesCommon:i}=this,s=this._hasChildren(e),n={[E.childToggleOpen]:e.open},o=e.open?i.collapse:i.expand;return s?C("span",{onclick:this._toggleChildrenClick,onkeydown:this._toggleChildrenClick,"data-item":e,key:"toggle-children",class:this.classes(E.childToggle,n),tabindex:"0",role:"button","aria-controls":t,"aria-label":o,title:o},C("span",{"aria-hidden":"true",class:this.classes(E.childClosed,E.iconRightArrow)}),C("span",{"aria-hidden":"true",class:this.classes(E.childOpened,E.iconDownArrow)}),C("span",{"aria-hidden":"true",class:this.classes(E.childClosed_RTL,E.iconLeftArrow)})):null}renderItemMessage(e){return e.error?C("div",{key:"esri-layer-list__error",class:E.message,role:"alert"},C("span",{"aria-hidden":"true",class:E.iconNoticeTriangle}),this.messages.layerError):e.incompatible?C("div",{key:"esri-layer-list__incompatible",class:E.message,role:"alert"},C("span",{bind:this,tabIndex:0,"aria-hidden":"true",class:E.iconNoticeTriangle,afterCreate:t=>this._setTooltipReference(t,e)}),this.messages.layerIncompatible):null}renderItemContent(e,t,i){const{id:s}=this,n=`${s}_${e.uid}`,o=`${n}_actions`,l=`${n}__list`,{panel:r}=e,a=this._filterActions(e.actionsSections),c=this._countActions(a);return[C("div",{key:"list-item-container",class:E.itemContainer},this.renderChildrenToggle(e,l),this.renderLabel(e,t,i),this.renderActionsMenu(e,a,c,o)),this.renderItemMessage(e),c?this.renderActionsSections(e,a,o):null,r&&r.open&&!r.disabled?r.render():null,this.renderChildList(e,l)]}renderItem(e,t){const{_newUI:i,id:s,selectionEnabled:n,selectedItems:o}=this,l=`${`${s}_${e.uid}`}__title`,r=this._hasMessage(e),a=this._hasChildren(e),c={[E.itemChildren]:a,[E.itemMessage]:!!r,[E.itemInvisible]:i&&!e.visible,[E.itemInvisibleAtScale]:!e.visibleAtCurrentScale,[E.itemSelectable]:n};if(n){const i={[M]:e.layer?.uid,[L]:(!e.sortable).toString()};return C("li",{key:`item-with-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(E.item,c),"aria-labelledby":l,onclick:this._toggleSelection,onkeydown:this._selectionKeydown,"data-item":e,"data-group":t?t.uid:N,tabIndex:0,"aria-selected":p(e,o)?"true":"false",role:"option",...i},this.renderItemContent(e,t,l))}return C("li",{key:`item-no-selection-${e.uid}`,bind:this,afterCreate:this._focusListItem,afterUpdate:this._focusListItem,class:this.classes(E.item,c),"aria-labelledby":l},this.renderItemContent(e,t,l))}renderConnectionIcon(e){const{connectionStatus:t}=e;return n(t)?C("calcite-icon",{icon:"connected"===t?"check-circle":"offline",scale:"s"}):null}renderItemStatus(e,t){const{visibleElements:i}=this;if(!i.statusIndicators)return null;const{connectionStatus:s,publishing:n,updating:o}=e,l=o&&!t,r=!!s;return C("span",{class:this.classes({[E.publishing]:n,[E.updating]:l,[E.connectionStatus]:r,[E.connectionStatusConnected]:r&&"connected"===s}),key:"layer-item-status"},this.renderConnectionIcon(e))}renderItemTitle(e,t){const{messages:i}=this;if(!e)return null;const s=e.title||i.untitledLayer,n=e.visibleAtCurrentScale?s:`${s} (${i.layerInvisibleAtScale})`;return C("span",{key:"layer-title-container",id:t,title:n,"aria-label":n,class:E.title},s)}renderItemToggleIcon(e,t){const{_newUI:i}=this,{exclusive:s}=x,n=t&&t.visibilityMode,o={[E.toggleVisibleIcon]:i,[E.toggleIcon]:i&&n!==s,[E.radioIcon]:i&&n===s,[E.iconRadioSelected]:n===s&&e.visible,[E.iconRadioUnselected]:n===s&&!e.visible,[E.iconVisible]:n!==s&&e.visible,[E.iconInvisible]:n!==s&&!e.visible};return C("span",{key:"item-toggle-icon",class:this.classes(o),"aria-hidden":"true"})}renderItemToggle(e,t,i){const{selectionEnabled:s,messages:n}=this,{exclusive:o}=x,l=t&&t.visibilityMode,r=l===o?"radio":"switch";return C("span",s?{key:"item-toggle-selection-enabled",class:E.toggleVisible,bind:this,onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,"data-item":e,"data-parent-visibility":l,tabIndex:0,title:e.visible?n.hideLayer:n.showLayer,"aria-checked":e.visible?"true":"false",role:r,"aria-labelledby":i}:{key:"item-toggle",class:E.toggleVisible},this.renderItemToggleIcon(e,t))}renderLabel(e,t,i){const{selectionEnabled:s,_newUI:n,messages:o}=this,{inherited:l,exclusive:r}=x,a=t?.visibilityMode,c=a===r?"radio":"switch",d=n?[this.renderItemTitle(e,i),this.renderItemStatus(e,t),this.renderItemToggle(e,t,i)]:[this.renderItemToggle(e,t,i),this.renderItemTitle(e,i),this.renderItemStatus(e,t)],h=C("div",s?{key:`item-label-no-selection-${e.uid}`,class:E.label}:{key:`item-label-with-selection-${e.uid}`,class:E.label,bind:this,onclick:this._toggleVisibility,onkeydown:this._toggleVisibility,"data-item":e,"data-parent-visibility":a,tabIndex:0,"aria-checked":e.visible?"true":"false",title:e.visible?o.hideLayer:o.showLayer,role:c,"aria-labelledby":i},d);return a===l||e.error?C("div",{key:`item-label-container-${e.uid}`,class:E.label},this.renderItemTitle(e,i),this.renderItemStatus(e,t)):h}renderPanelButton(e){const{className:t,open:i,title:s,image:n}=e,o=n||t?t:E.iconDefaultAction,l=this._getIconImageStyles(e),r={[E.actionsMenuItemActive]:i},a={[E.actionImage]:!!l["background-image"],[E.disabledElement]:e.disabled};return o&&(a[o]=!!o),C("div",{"aria-disabled":e.disabled.toString(),key:`panel-${e.uid}`,bind:this,"data-panel":e,onclick:this._triggerPanel,onkeydown:this._triggerPanel,class:this.classes(E.actionsMenuItem,r),role:"button",tabindex:e.disabled?null:0,title:s,"aria-label":s},C("span",{class:this.classes(a),styles:l}))}renderActionsSections(e,t,i){const s=t.toArray().map(((t,i)=>C("ul",{key:`${e}-action-section-${i}`,class:E.actionsList},this.renderActionSection(e,t))));return C("div",{role:"group","aria-expanded":e.actionsOpen?"true":"false",key:"actions-section",id:i,class:E.actions,hidden:!e.actionsOpen||null},s)}renderActionSection(e,t){return(t&&t.toArray()).map((t=>this.renderAction({item:e,action:t})))}renderActionIcon(e){const{active:t,className:i}=e,s=this._getIconImageStyles(e),n="button"!==e.type||e.image||i?i:E.iconDefaultAction,o={[E.actionImage]:!t&&!!s["background-image"],[E.iconLoading]:t,[E.rotating]:t};return n&&!t&&(o[n]=!0),C("span",{key:"action-icon","aria-hidden":"true",class:this.classes(E.actionIcon,o),styles:s})}renderActionTitle(e,t){return t?null:C("span",{key:"action-title",class:E.actionTitle},e)}renderAction(e){const{item:t,action:i,singleAction:s}=e,{active:n,disabled:o,title:l}=i,r={[E.actionsMenuItem]:s&&"button"===i.type,[E.action]:n||!s&&"toggle"!==i.type,[E.actionToggle]:!n&&"toggle"===i.type,[E.actionToggleOn]:!n&&"toggle"===i.type&&i.value,[E.disabledElement]:o},a=[this.renderActionIcon(i),this.renderActionTitle(l,s)];return s?C("div",{bind:this,"data-item":t,"data-action":i,role:"button",key:`single-action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:r,tabindex:"0",title:l,"aria-label":l},a):C("li",{bind:this,"data-item":t,"data-action":i,key:`action-${i.uid}`,onclick:this._triggerAction,onkeydown:this._triggerAction,classes:r,tabindex:"0",role:"button",title:l,"aria-label":l},a)}_setTooltipReference(e,t){this._tooltipReferenceMap.set(t.uid,e),this.scheduleRender()}_hasMessage(e){return!!e.error||e.incompatible}_hasChildren(e){return!!e.children.length&&!this._hasMessage(e)}_sortNodeRemoved(e){const{_sortableMap:t}=this,i=e.dataset.group,s=t.get(i);s&&s.destroy(),t.delete(i)}_destroySortables(){const{_sortableMap:e,_sortableNodes:t}=this;e.forEach((e=>e&&e.destroy())),e.clear(),t.clear()}_moveLayerFromChildList({to:e,from:t,item:i,newIndex:s}){const n=i["data-item"],o=e["data-item"],l=t["data-item"];this.viewModel.moveListItem(n,l,o,s)}_sortLayers(e){if(!e)return;const t=e.el["data-item"],i=e.toArray();t?b(t,i):_(this.view?.map?.layers,i)}_toggleSorting(e,t){const{_sortableMap:i,selectionEnabled:s}=this,n=i.get(t),o=e["data-item"],l=(t===N||o.childrenSortable&&y(o))&&s;if(n)n.option("disabled",!l);else if(l){const s=w.create(e,{dataIdAttr:M,group:{name:t,pull:this._sortableCanPull,put:this._sortableCanPut},filter:`[${L}="true"]`,fallbackTolerance:4,onSort:this._onSortableSort,onEnd:this._onSortableEnd,disabled:!l,chosenClass:E.sortableChosen});i.set(t,s)}}_toggleAllSorting(){this._sortableNodes.forEach(((e,t)=>this._toggleSorting(e,t)))}_sortNodeCreated(e){const t=e.dataset.group;t&&(this._sortableNodes.set(t,e),this._toggleSorting(e,t))}_setVisibleItems(e){this.visibleItems=e?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}_getSingleActionButton(e){return e.reduce((e=>e)).filter((e=>e&&"button"===e.type)).getItemAt(0)}_focusListItem(e){const{_focusSortUid:t}=this;if(!e||!t)return;e["data-item"].layer?.uid===t&&(e.focus(),this._focusSortUid=null)}_watchActionSectionChanges(e,t){const i=R.actionSection+t;this._handles.add(e.on("change",this.scheduleRender.bind(this)),i),e.forEach((e=>this._renderOnActionChanges(e,t)))}_renderOnActionChanges(e,t){const i=R.actions+t;"toggle"!==e.type?"slider"!==e.type?this._handles.add(l((()=>[e?.className,e?.image,e?.id,e?.title,e?.visible]),(()=>this.scheduleRender()),r),i):this._handles.add(l((()=>[e?.className,e?.id,e?.title,e?.visible,e?.value,e?.displayValueEnabled,e?.max,e?.min,e?.step]),(()=>this.scheduleRender()),r),i):this._handles.add(l((()=>[e?.className,e?.image,e?.id,e?.title,e?.visible,e?.value]),(()=>this.scheduleRender()),r),i)}_renderOnItemChanges(e){const t=e.uid,i=R.items+t;this._handles.add([l((()=>[e?.actionsOpen,e?.visible,e?.open,e?.updating,e?.connectionStatus,e?.publishing,e?.title,e?.visibleAtCurrentScale,e?.error,e?.visibilityMode,e?.panel,e?.panel?.title,e?.panel?.content,e?.panel?.className,e?.sortable,e?.childrenSortable]),(()=>this.scheduleRender()),a),l((()=>[e?.hidden,e?.error]),(()=>this._setVisibleItems(this.operationalItems))),e.actionsSections.on("change",(()=>this.scheduleRender())),e.children.on("change",(()=>this.scheduleRender()))],i),e.children.forEach((e=>this._renderOnItemChanges(e))),e.actionsSections.forEach((e=>this._watchActionSectionChanges(e,t)))}_itemsChanged(e){this._handles.removeAll(),e.forEach((e=>this._renderOnItemChanges(e))),this._tooltipReferenceMap.clear(),this._setVisibleItems(e),this.scheduleRender()}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_getIconImageStyles(e){const t="esri.widgets.LayerList.ListItemPanel"===e.declaredClass||"esri.support.Action.ActionButton"===e.declaredClass||"esri.support.Action.ActionToggle"===e.declaredClass?e.image:null;return{"background-image":t?`url("${t}")`:null}}_selectionKeydown(e){const t=["ArrowDown","ArrowUp"],s=i(e);if(!t.includes(s))return void this._toggleSelection(e);e.stopPropagation();const n=e.currentTarget,o=n["data-item"],{_sortableMap:l,selectedItems:r}=this,a=n.dataset.group,c=l.get(a);if(!c)return;const d=p(o,r),h=c.toArray(),m=e.target,g=h.indexOf(m.dataset[T]);if(-1!==g){if("ArrowDown"===s){const e=g+1;if(e>=h.length)return;d?(A(h,g,e),c.sort(h),this._sortLayers(c),this._focusSortUid=o.layer?.uid):(this._focusSortUid=o.layer?.uid,this.scheduleRender())}if("ArrowUp"===s){const e=g-1;if(e<=-1)return;d?(A(h,g,e),c.sort(h),this._sortLayers(c),this._focusSortUid=o.layer?.uid):(this._focusSortUid=o.layer?.uid,this.scheduleRender())}}}_toggleActionsOpen(e){const t=e.currentTarget["data-item"],{actionsOpen:i}=t,s=!i;s&&this.operationalItems.forEach((e=>U(e))),t.actionsOpen=s,e.stopPropagation()}_triggerPanel(e){const t=e.currentTarget["data-panel"];e.stopPropagation(),t&&!t.disabled&&(t.open=!t.open)}_triggerAction(e){const t=e.currentTarget,i=t["data-action"],s=t["data-item"];"toggle"===i.type&&(i.value=!i.value),this.triggerAction(i,s),e.stopPropagation()}_toggleVisibility(e){const t=e.currentTarget,i=t.getAttribute("data-parent-visibility"),s=t["data-item"];i===x.exclusive&&s.visible||(s.visible=!s.visible),e.stopPropagation()}_toggleChildrenClick(e){const t=e.currentTarget["data-item"];t.open=!t.open,e.stopPropagation()}_toggleSelection(e){e.stopPropagation();const{multipleSelectionEnabled:t,selectedItems:i}=this,s=e.currentTarget["data-item"],n=p(s,i),{length:o}=i;if(!t)return o&&!(n&&1===o)?(i.removeAll(),void i.add(s)):void(n?i.remove?.(n):i.add(s));n?i.remove?.(n):i.add(s)}};e([c()],j.prototype,"visibleItems",void 0),e([c()],j.prototype,"iconClass",void 0),e([c()],j.prototype,"label",null),e([c()],j.prototype,"listItemCanGiveFunction",void 0),e([c()],j.prototype,"listItemCanReceiveFunction",void 0),e([c()],j.prototype,"listItemCreatedFunction",null),e([c(),v("esri/widgets/LayerList/t9n/LayerList")],j.prototype,"messages",void 0),e([c(),v("esri/t9n/common")],j.prototype,"messagesCommon",void 0),e([c()],j.prototype,"multipleSelectionEnabled",void 0),e([c()],j.prototype,"operationalItems",null),e([c()],j.prototype,"selectionEnabled",void 0),e([c()],j.prototype,"selectedItems",void 0),e([c()],j.prototype,"view",null),e([f("trigger-action"),c({type:g})],j.prototype,"viewModel",void 0),e([c()],j.prototype,"visibleElements",void 0),e([d("visibleElements")],j.prototype,"castVisibleElements",null),e([I()],j.prototype,"_toggleActionsOpen",null),e([I()],j.prototype,"_triggerPanel",null),e([I()],j.prototype,"_triggerAction",null),e([I()],j.prototype,"_toggleVisibility",null),e([I()],j.prototype,"_toggleChildrenClick",null),e([I()],j.prototype,"_toggleSelection",null),j=e([h("esri.widgets.LayerList")],j);const V=j;export{V as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import{when as s,watch as i}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import o from"./Widget.js";import{storeNode as a}from"./support/widgetUtils.js";import{messageBundle as n}from"./support/decorators/messageBundle.js";import{vmEvent as c}from"./support/decorators/vmEvent.js";import{tsx as d}from"./support/jsxFactory.js";import h from"./UtilityNetworkTrace/UtilityNetworkTraceViewModel.js";import{GraphicHandler as u,HIGHLIGHT_COLOR as p}from"./UtilityNetworkTrace/support/GraphicHandler.js";const g={base:"esri-utility-trace-network",loaderContainer:"esri-utility-trace-network__loader-container",loader:"esri-utility-trace-network__loader",fadeIn:"esri-utility-trace-network--fade-in",addButtonContainer:"esri-utility-trace-network__add-button-container",noticeContainer:"esri-utility-trace-network__notice-container",listContainer:"esri-utility-trace-network__list-container",resultsContainer:"esri-utility-trace-network__results-container",flow:"esri-utility-trace-network__flow",esriWidget:"esri-widget",esriWidgetPanel:"esri-widget--panel",esriWidgetDisabled:"esri-widget--disabled",esriButton:"esri-button",esriButtonTertiary:"esri-button--tertiary",esriInput:"esri-input",esriMatchHeight:"esri-match-height",iconHandle:"esri-icon-handle-vertical",iconPlus:"esri-icon-plus",iconEdit:"esri-icon-edit",iconHandleHorizontal:"esri-icon-handle-horizontal",iconRefresh:"esri-icon-refresh",iconLink:"esri-icon-link",iconRemove:"esri-icon-erase",widgetIcon:"esri-icon-UtilityNetworkTrace",header:"esri-widget__heading",loading:"esri-icon-loading-indicator",rotating:"esri-rotating"},m="esri.widgets.UtilityNetworkTrace";function w(e){return{height:e+"px"}}function _(e){return{width:e+"px"}}function v(){return{width:"75%"}}function b(){return{textAlign:"center"}}function y(){return{width:"100%"}}const T={NOEXTENTION:-2147208474};let S=class extends(t(o)){constructor(e,t){super(e,t),this._tracesExists=!0,this._graphicHandler=null,this._selectToolActive=!1,this._activeTrace=null,this._activeSwatch="",this._traceHeaderForFlow="",this._assetGroupHeader="",this._assetTypeHeader="",this._traceResultsFunctions=[],this._traceResultsAssetGroup=[],this._traceResultsAssetType=[],this._traceResultsIndividual=[],this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1,this._activeTab="input",this._flagViewType="starting-point",this._alertRemoveModal=!1,this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._warningNoStartAssetFound=!1,this._warningNoBarrierAssetFound=!1,this._warningNoTerminal=!1,this._confirmReset=!1,this._showResultOptions=!1,this._resultObjectIdField="objectid",this._resultDisplayField="objectid",this._resultSortField="objectid",this._resultSortOrder="desc",this._swatchNode=null,this._individualResultNode=null,this._symbolStartFlag=null,this._symbolBarrier=null,this._watchHandler=null,this._loadUNError=!0,this._errorMessage="",this.disabled=!0,this.iconClass=g.widgetIcon,this.inputSettings=[],this.messages=null,this.messagesCommon=null,this.viewModel=new h}initialize(){this._utilityNetworkTraceInitialized(),this._graphicHandler=new u}get defaultGraphicColor(){return this.viewModel.defaultGraphicColor}set defaultGraphicColor(e){this.viewModel.defaultGraphicColor=e}get flags(){return this.viewModel.flags}set flags(e){this.viewModel.flags=e}get gdbVersion(){return this.viewModel.gdbVersion}set gdbVersion(e){this.viewModel.gdbVersion=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get selectedTraces(){return this.viewModel.selectedTraces}set selectedTraces(e){this.viewModel.selectedTraces=e}get selectOnComplete(){return this.viewModel.selectOnComplete}set selectOnComplete(e){this.viewModel.selectOnComplete=e}get showGraphicsOnComplete(){return this.viewModel.showGraphicsOnComplete}set showGraphicsOnComplete(e){this.viewModel.showGraphicsOnComplete=e}get showSelectionAttributes(){return this.viewModel.showSelectionAttributes}set showSelectionAttributes(e){this.viewModel.showSelectionAttributes=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}async checkCanTrace(){this._confirmReset=!1;const e=this.viewModel.checkCanTrace();e.status?(this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._warningNoTraceSelected=!1,this._warningNoTerminal=!1,this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1,this.switchTab("result"),this.viewModel._activeProgress=!0,await this.viewModel.callTrace(),this.viewModel._activeProgress=!1):e.issues.forEach((e=>{switch(e){case"noStart":this._warningNoFlag=!0;break;case"noTerminalSelected":this._warningNoTerminal=!0;break;default:this._warningNoTraceSelected=!0}}))}confirmReset(){this._confirmReset=!0}render(){const{state:e}=this.viewModel;this._mixCustomStrings(),this._overrideFlagSymbol();const t="loading"===e?this.renderLoading():this.renderUtilityNetworkTrace();return d("div",{class:this.classes(g.base,g.esriWidget,g.esriWidgetPanel,{[g.esriWidgetDisabled]:this.disabled})},t)}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-action.js"),import("@esri/calcite-components/dist/components/calcite-action-group.js"),import("@esri/calcite-components/dist/components/calcite-action-pad.js"),import("@esri/calcite-components/dist/components/calcite-block.js"),import("@esri/calcite-components/dist/components/calcite-block-section.js"),import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-checkbox.js"),import("@esri/calcite-components/dist/components/calcite-color-picker-swatch.js"),import("@esri/calcite-components/dist/components/calcite-combobox.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),import("@esri/calcite-components/dist/components/calcite-flow.js"),import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-label.js"),import("@esri/calcite-components/dist/components/calcite-list.js"),import("@esri/calcite-components/dist/components/calcite-list-item.js"),import("@esri/calcite-components/dist/components/calcite-loader.js"),import("@esri/calcite-components/dist/components/calcite-modal.js"),import("@esri/calcite-components/dist/components/calcite-notice.js"),import("@esri/calcite-components/dist/components/calcite-option.js"),import("@esri/calcite-components/dist/components/calcite-panel.js"),import("@esri/calcite-components/dist/components/calcite-popover.js"),import("@esri/calcite-components/dist/components/calcite-select.js"),import("@esri/calcite-components/dist/components/calcite-tab.js"),import("@esri/calcite-components/dist/components/calcite-tab-nav.js"),import("@esri/calcite-components/dist/components/calcite-tab-title.js"),import("@esri/calcite-components/dist/components/calcite-tabs.js")])}switchTab(e){this._activeTab=e}switchToFunctions(e,t){this._traceResultsFunctions=e,this._showTraceResultFunctions=t}switchToAssetGroup(e,t,s){this._traceHeaderForFlow=t,this._traceResultsAssetGroup=e,this._showTraceResultAssetGroup=s}switchToAssetType(e,t,s){this._assetGroupHeader=t,this._traceResultsAssetType=e,this._showTraceResultAssetType=s}switchToIndividualRecords(e,t,s){this._assetTypeHeader=t,this._traceResultsIndividual=e,this._showIndividualRecords=s}renderLoading(){return d("div",{class:g.loaderContainer,key:"loader"},d("div",{class:g.loader}))}renderUtilityNetworkTrace(){const{messages:e}=this;let t=d("calcite-tabs",{position:"above",layout:"center",styles:y()},d("calcite-tab-nav",{slot:"tab-nav"},d("calcite-tab-title",{active:"input"===this._activeTab,onclick:()=>{this.switchTab("input")}},e.inputsStrings.headerTabInputs),d("calcite-tab-title",{active:"result"===this._activeTab,onclick:()=>{this.switchTab("result")}},e.resultsStrings.headerTabResults)),d("calcite-tab",{active:"input"===this._activeTab},this.renderInputPanel()),d("calcite-tab",{active:"result"===this._activeTab},this.viewModel._activeProgress?d("calcite-loader",{active:!0,label:e.alertsStrings.traceExecuting,text:e.alertsStrings.traceExecuting,type:"indeterminate"}):this.viewModel._traceResults.length>0?this.renderResultPanel():this.renderWarningMessage("noTraceExecuted",!1),d("calcite-modal",{active:this._confirmReset,color:"blue",scale:"m",width:"s","intl-close":"Close",onCalciteModalClose:()=>{this._confirmReset=!1}},d("h3",{slot:"header"},e.resultsStrings.startOverButton),d("div",{slot:"content"},e.resultsStrings.startOverValidation),d("calcite-button",{slot:"secondary",width:"full",appearance:"outline",onclick:()=>{this._confirmReset=!1}},e.globalStrings.cancel),d("calcite-button",{slot:"primary",width:"full",onclick:()=>{this._confirmReset=!1,this.viewModel.reset(),this.switchTab("input")}},e.globalStrings.ok))));return this._tracesExists||(t=d("calcite-panel",null,this.renderWarningMessage("noTraceConfig",!1))),this._loadUNError||(t=d("calcite-panel",null,this.renderWarningMessage("loadUNError",!1,this._errorMessage))),t}renderInputPanel(){const{messages:e}=this;return d("calcite-flow",{class:g.flow},d("calcite-panel",null,this._warningNoFlag?this.renderWarningMessage("flag",!0):null,this._warningNoTerminal?this.renderWarningMessage("noTerminal",!0):null,this._warningNoTraceSelected?this.renderWarningMessage("trace",!0):null,this.renderTraceSelectorContainer(),this.renderStartFlagsContainer(),this.renderBarriersFlagsContainer(),this._warningNoFlag&&this._warningNoTraceSelected?d("div",{styles:w(10)}):null,d("calcite-button",{slot:"footer",scale:"m",color:"blue",width:"full",onclick:()=>{this.checkCanTrace()}},e.tracingStrings.runTrace)),this._selectToolActive?this.renderActiveTool():null)}renderResultPanel(){return d("div",{class:this.classes(g.resultsContainer)},d("calcite-flow",null,this.renderTraceResults(),this._showTraceResultFunctions?this.renderTraceResultFunctions():null,this._showTraceResultAssetGroup?this.renderTraceResultByAssetGroup():null,this._showTraceResultAssetType?this.renderTraceResultByAssetType():null,this._showIndividualRecords?this.renderTraceResultIndividual():null,this._showIndividualRecords?this.renderTraceResultIndividualPopover():null))}renderStartFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter((e=>"starting-point"===e.type)),s.forEach((e=>{e.displayValue&&t.push(this.renderFlagRow(e,"start"))}));let i=null;return this._symbolStartFlag&&(i=this._getSymbolIcon(this._symbolStartFlag)),d("calcite-block",{heading:e.inputsStrings.headerStartingPoint+" ("+s.length+")",open:!0,collapsible:!0},d("div",{slot:"icon"},i||d("calcite-icon",{icon:"pin",scale:"s"})),d("div",null,e.inputsStrings.startingPointHint),d("div",{class:g.listContainer},t),this._warningNoStartAssetFound?this.renderWarningMessage("noStartAsset",!0):null,d("div",{class:g.addButtonContainer},d("calcite-button",{alignment:"center",appearance:"outline","icon-start":"plus",scale:"m",href:"",label:e.inputsStrings.addPointOption,onclick:()=>{this._flagViewType="starting-point",this._selectToolActive=!0,this._warningNoStartAssetFound=!1,this.viewModel.addFlagByHit("starting-point",this._symbolStartFlag).then((e=>{e?this._warningNoFlag=!1:this._warningNoStartAssetFound=!0,this._selectToolActive=!1}))},round:!0})))}renderBarriersFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter((e=>"barrier"===e.type)),s.forEach((e=>{e.displayValue&&t.push(this.renderFlagRow(e,"barrier"))}));let i=null;return this._symbolBarrier&&(i=this._getSymbolIcon(this._symbolBarrier)),d("calcite-block",{heading:e.inputsStrings.headerBarrier+" ("+s.length+")",open:!1,collapsible:!0},d("div",{slot:"icon"},i||d("calcite-icon",{icon:"x-circle-f",scale:"s"})),d("div",null,e.inputsStrings.barrierPointHint),d("div",{class:g.listContainer},t),this._warningNoBarrierAssetFound?this.renderWarningMessage("noBarrierAsset",!0):null,d("div",{class:g.addButtonContainer},d("calcite-button",{alignment:"center",appearance:"outline",color:"blue","icon-start":"plus",scale:"m",href:"",round:!0,label:e.inputsStrings.addPointOption,onclick:()=>{this._flagViewType="barrier",this._selectToolActive=!0,this._warningNoBarrierAssetFound=!1,this.viewModel.addFlagByHit("barrier",this._symbolBarrier).then((e=>{e||(this._warningNoBarrierAssetFound=!0),this._selectToolActive=!1}))}})))}renderFlagRow(e,t){const{messages:s}=this,i=[];let r=!1;return null!==e.allTerminals&&void 0!==e.allTerminals&&e.allTerminals.terminals.length>0&&(r=!0,e.allTerminals.terminals.forEach((t=>{let s=!1;e.selectedTerminals.includes(t.id)&&(s=!0),i.push(d("calcite-combobox-item",{key:t.name,selected:s,value:t.id,"text-label":t.name}))}))),d("calcite-block",{key:"pop"+e.globalId+e.type+e.id+t,heading:e.displayValue.value,collapsible:null!==e.allTerminals||"barrier"===e.type},d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:s.globalStrings.remove,label:s.globalStrings.remove,onCalciteListItemChange:()=>{this.viewModel.removeFlag(e)},onclick:()=>{this.viewModel.removeFlag(e)},scale:"s",icon:"trash"}),d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:s.globalStrings.zoomToFeature,label:s.globalStrings.zoomToFeature,onCalciteListItemChange:()=>{this.viewModel.zoomToAsset(e.details.geometry)},onclick:()=>{this.viewModel.zoomToAsset(e.details.geometry)},scale:"s",icon:"zoom-to-object"}),"barrier"===e.type?d("calcite-label",{scale:"s",layout:"inline"},d("calcite-checkbox",{checked:e.isFilterBarrier,scale:"s",onclick:()=>{this.viewModel.manageFilterBarrier(!e.isFilterBarrier,e)}}),s.inputsStrings.barrierFilter):null,r?d("calcite-combobox",{label:s.globalStrings.selectTerminalPlaceholder,placeholder:s.globalStrings.selectTerminalPlaceholder,"selection-mode":"multi",scale:"s",maxItems:0,onCalciteComboboxChange:t=>{t.detail.selectedItems.length>0?(e.selectedTerminals=[],t.detail.selectedItems.forEach((t=>{this.viewModel.addTerminal(t.value,e)}))):e.selectedTerminals=[]},onCalciteComboboxChipDismiss:t=>{t.preventDefault(),this.viewModel.removeTerminal(t.target.value,e)}},i):null)}renderActiveTool(){const{messages:e}=this;let t=null;return"starting-point"===this._flagViewType?this._symbolStartFlag&&(t=this._getSymbolIcon(this._symbolStartFlag)):this._symbolBarrier&&(t=this._getSymbolIcon(this._symbolBarrier)),d("calcite-panel",{"height-scale":"s",onCalcitePanelBackClick:()=>{this.viewModel._clickHandler&&(this.viewModel._clickHandler.remove(),this.view.popup.autoOpenEnabled=!0),this._selectToolActive=!1},heading:e.inputsStrings.addPointOption},d("calcite-block",{open:!0,collapsible:!1,heading:""},d("div",{styles:b()},t||d("calcite-icon",{icon:"starting-point"===this._flagViewType?"pin":"x-circle-f",scale:"s"})),d("div",{styles:b()},e.inputsStrings.addPointHint)))}renderTraceSelectorContainer(){const{messages:e}=this,t=[];return this.viewModel._traces.length>0&&this.viewModel._traces.forEach((e=>{t.push(d("calcite-combobox-item",{key:e.globalId,selected:e.selected,value:e.globalId,"text-label":e.title,onCalciteComboboxItemChange:t=>{const s=t.target;this.viewModel.selectTraces(s.selected,e.globalId),this.viewModel._traces.length>0&&(this._warningNoTraceSelected=!1)}}))})),d("calcite-block",{heading:e.tracingStrings.traceOperation,open:!0,collapsible:!0},d("calcite-combobox",{label:e.inputsStrings.selectTraces,placeholder:e.inputsStrings.selectTraces,"selection-mode":"multi",scale:"s",maxItems:0,onCalciteComboboxChipDismiss:e=>{this.viewModel.selectTraces(!1,e.target.value),this.viewModel._traces.length>0&&(this._warningNoTraceSelected=!1)}},t))}renderStartOverContainer(){const{messages:e}=this;return d("calcite-button",{slot:"footer",scale:"m",color:"blue",width:"full",onclick:()=>{this.confirmReset()}},e.resultsStrings.startOverButton)}renderWarningMessage(e,t,s){const{messages:i}=this;let r=i.alertsStrings.NoRunAlertHeader,l=i.alertsStrings.noResultsInfo;switch(e){case"flag":r=i.alertsStrings.startingPointAlertHeader,l=i.alertsStrings.startingPointAlert;break;case"noTerminal":r=i.alertsStrings.noTerminalDefinedHeader,l=i.alertsStrings.noTerminalDefined;break;case"trace":r=i.alertsStrings.selectTraceAlertHeader,l=i.alertsStrings.selectTraceAlert;break;case"noTraceExecuted":r=i.alertsStrings.NoRunAlertHeader,l=i.alertsStrings.noResultsInfo;break;case"noBarrierAsset":case"noStartAsset":r=i.alertsStrings.noAssetsFoundHeader,l=i.alertsStrings.noAssetFound;break;case"noTraceConfig":r="",l=i.alertsStrings.noTraceSupported;break;default:r=i.alertsStrings.genericErrorHeader,l=s||""}return d("div",{class:g.noticeContainer,key:e},d("calcite-notice",{open:!0,key:e,active:!0,dismissible:t,icon:!0,scale:"s",width:"auto",color:"red",onCalciteNoticeClose:()=>{switch(e){case"flag":this._warningNoFlag=!1;break;case"noTerminal":this._warningNoTerminal=!1;break;case"trace":this._warningNoTraceSelected=!1;break;case"noStartAsset":this._warningNoStartAssetFound=!1;break;case"noBarrierAsset":this._warningNoBarrierAssetFound=!1}}},d("div",{slot:"title"},r),d("div",{slot:"message"},l)))}renderRemoveTraceContainer(e){const{messages:t}=this;return d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:t.globalStrings.clearResults,label:t.globalStrings.clearResults,onCalciteListItemChange:()=>{this._alertRemoveModal=!0,this._activeTrace=e.trace},onclick:()=>{this._alertRemoveModal=!0,this._activeTrace=e.trace},scale:"s",icon:"trash"})}renderHighlightColorPicker(e,t){const{messages:s}=this,i=[];for(let r=0;r<p.length;r++)i.push(d("calcite-action",{key:r,text:s.resultsStrings.graphicColor,label:s.resultsStrings.graphicColor,scale:"s",onclick:()=>{this.viewModel.changeResultGraphicColor(this._graphicHandler.getHighlightColor(r),t)}},d("calcite-color-picker-swatch",{scale:"s",color:this._graphicHandler.getHighlightColor(r).hex,active:e.color===this._graphicHandler.getHighlightColor(r).color})));return d("calcite-action-pad",{position:"start",layout:"grid",expandDisabled:!0},d("calcite-action-group",{layout:"grid",columns:4},i))}renderTraceResults(){const{messages:e}=this,t=this.viewModel._traceResults,s=[];return t.forEach(((t,i)=>{let r=[],l=[],o=!1,a=!1,n=!1;null!==t.results&&t.results.hasOwnProperty("elements")?(null!==t.results.aggregatedGeometry&&(a=!0),null!==t.results.globalFunctionResults&&t.results.globalFunctionResults.length>0&&(l=t.results.globalFunctionResults,l.length>0&&(n=!0)),t.results.elements.length>0&&(r=t.results.elements,r.length>0&&(o=!0)),s.push(d("calcite-block",{key:t.trace.title,heading:t.trace.title,summary:t.trace.description,collapsible:!1,open:!0,intlOptions:e.resultsStrings.ellipsesOptions},this.renderRemoveTraceContainer(t),d("calcite-list",null,n?d("calcite-list-item",{label:e.resultsStrings.functionHeader+" ("+l.length+")",onclick:()=>{this.switchToFunctions(l,!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):null,o&&this.viewModel.showSelectionAttributes?d("calcite-list-item",{key:this.id,label:e.resultsStrings.viewFeatures+" ("+r.length+")",onclick:()=>{this.switchToAssetGroup(this._groupResultsByAssetGroup(t),t.trace.title+" ("+r.length+")",!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):this.viewModel.showSelectionAttributes?d("calcite-label",{layout:"inline",scale:"s"},e.resultsStrings.noSelectionResults):null),d("div",{styles:w(10)}),o?d("calcite-label",{layout:"inline",scale:"s",onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)}},d("calcite-checkbox",{checked:t.selectionEnabled,scale:"m",onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)}}),this.viewModel.showSelectionAttributes?e.resultsStrings.selectFeatures:e.resultsStrings.selectFeatures+" ("+r.length+")"):null,a?d("calcite-block-section",{"toggle-display":"switch",text:e.resultsStrings.highlightTrace,open:t.graphicEnabled,onCalciteBlockSectionToggle:e=>{e.target.open?this.viewModel.changeResultGraphicColor(t.graphicColor,t):this.viewModel.removeResultGraphicFromView(t)}},d("calcite-action",{text:e.resultsStrings.graphicColor,label:e.resultsStrings.graphicColor,scale:"s",onclick:e=>{const t=e.target;this._swatchNode=t,this._activeSwatch="aggGeom_"+i}},d("calcite-color-picker-swatch",{scale:"s",color:t.graphicColor.hex})),d("calcite-popover",{autoClose:!0,label:e.resultsStrings.graphicColor,text:e.resultsStrings.graphicColor,referenceElement:this._swatchNode,placement:"auto-start",offsetDistance:0,offsetSkidding:0,open:this._activeSwatch==="aggGeom_"+i,onCalcitePopoverClose:()=>{this._swatchNode=null,this._activeSwatch=null}},this.renderHighlightColorPicker(t.graphicColor,t))):null))):s.push(d("calcite-block",{key:"error-"+i,heading:t.trace.title,collapsible:!1,open:!0},this.renderRemoveTraceContainer(t),this.renderWarningMessage("noController",!1,t.status)))})),d("calcite-panel",{key:"traceResults"},s,this.renderStartOverContainer(),d("calcite-modal",{active:this._alertRemoveModal,color:"blue",scale:"m",width:"s","intl-close":"Close",onCalciteModalClose:()=>{this._alertRemoveModal=!1}},d("h3",{slot:"header"},e.globalStrings.clearResults),d("div",{slot:"content"},e.alertsStrings.clearResultsAlert),d("calcite-button",{slot:"secondary",width:"full",appearance:"outline",onclick:()=>{this._alertRemoveModal=!1}},e.globalStrings.cancel),d("calcite-button",{slot:"primary",width:"full",onclick:()=>{this.viewModel.clearResult(this._activeTrace),this._alertRemoveModal=!1,0===this.viewModel._traceResults.length?this.switchTab("input"):(this._activeTrace=this.viewModel._traceResults[0].trace,this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1)}},e.globalStrings.ok)))}renderTraceResultFunctions(){const{messages:e}=this,t=this._traceResultsFunctions,s=[];return t.forEach((e=>{s.push(this.renderResultRowFunctions(e))})),d("calcite-panel",{key:"functionResultMultiple",onCalcitePanelBackClick:()=>{this.switchToFunctions([],!1)},heading:e.resultsStrings.functionHeader},s,this.renderStartOverContainer())}renderTraceResultByAssetGroup(){const e=this._traceResultsAssetGroup,t=[];for(const s in e){const i=e[s];for(const e in i)t.push(this.renderResultRowAssetGroup(i[e]))}return d("calcite-panel",{key:"assetGroupResultMultiple",onCalcitePanelBackClick:()=>{this.switchToAssetGroup([],"",!1)},heading:this._traceHeaderForFlow},d("calcite-list",null,t),this.renderStartOverContainer())}renderTraceResultByAssetType(){const e=this._traceResultsAssetType,t=[];for(const s in e)e[s].length>0&&t.push(this.renderResultRowAssetType(e[s]));return d("calcite-panel",{key:"assetTypeResult",onCalcitePanelBackClick:()=>{this.switchToAssetType([],"",!1)},heading:this._assetGroupHeader},t,this.renderStartOverContainer())}renderTraceResultIndividual(){const{messages:e}=this,t=this._traceResultsIndividual;t.sort(this._compare(this._resultSortField,this._resultSortOrder));const s=[];if(t.length>0){t[0].details.fields.some((e=>e.name.toLowerCase()===this._resultDisplayField.toLocaleLowerCase()))||(this._resultDisplayField=this._resultObjectIdField,this._resultSortField=this._resultObjectIdField),t.forEach((e=>{s.push(this.renderResultRowIndividual(e))}))}return d("calcite-panel",{key:"individualResult",onCalcitePanelBackClick:()=>{this._showResultOptions=!1,this.switchToIndividualRecords([],"",!1)},heading:this._assetTypeHeader},d("calcite-action",{"text-enabled":!0,slot:"header-actions-end",text:e.resultsStrings.displayAttribute,onCalciteListItemChange:()=>{this._showResultOptions=!0},onclick:()=>{this._showResultOptions=!0},scale:"s",icon:"gear",label:e.resultsStrings.displayAttribute,id:"field_options"+this.id,afterCreate:a,bind:this,"data-node-ref":"_individualResultNode"}),s,this.renderStartOverContainer())}renderTraceResultIndividualPopover(){const{messages:e}=this,t=this._traceResultsIndividual,s=[],i=[];return t.length>0&&t[0].details.fields.forEach((e=>{s.push(d("calcite-option",{key:"display"+e.name,label:e.alias,value:e.name,selected:e.name===this._resultDisplayField})),i.push(d("calcite-option",{key:"sort"+e.name,label:e.alias,value:e.name,selected:e.name===this._resultSortField}))})),d("calcite-popover",{autoClose:!0,label:e.resultsStrings.displayAttribute,referenceElement:this._individualResultNode,placement:"left-start",offsetDistance:0,offsetSkidding:0,open:this._showResultOptions,styles:null!==this.domNode?_(.75*this.domNode.clientWidth):v()},d("calcite-block",{heading:"",open:!0},d("calcite-label",{scale:"s"},e.resultsStrings.displayAttribute,d("calcite-select",{label:e.resultsStrings.displayAttribute,onCalciteSelectChange:e=>{const t=e.target;this._resultDisplayField=t.selectedOption.value,this._showResultOptions=!1}},s)),d("calcite-label",{scale:"s"},e.resultsStrings.sortBy,d("calcite-select",{label:e.resultsStrings.sortBy,onCalciteSelectChange:e=>{const s=e.target;this._resultSortField=s.selectedOption.value,t.sort(this._compare(this._resultSortField,this._resultSortOrder)),this._traceResultsIndividual=t,this._showResultOptions=!1}},i))))}renderResultRow(e){let t=e[0].assetGroupCode;const s=this.viewModel.getValidSources().filter((t=>t.sourceId===e[0].networkSourceId));if(s.length>0){const i=s[0].assetGroups.filter((t=>t.assetGroupCode===e[0].assetGroupCode));i.length>0&&(t=i[0].assetGroupName)}return d("calcite-list-item",{label:t+" ("+e.length+")",onclick:()=>{this.switchToAssetType(this._groupResultsByAssetType(e),t+" ("+e.length+")",!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}renderResultRowFunctions(e){return d("calcite-block",{heading:e.networkAttributeName+" "+e.functionType+" = "+e.result,collapsible:!1})}renderResultRowAssetGroup(e){const t=this._getAssetGroupName(e[0]);return d("calcite-list-item",{label:t+" ("+e.length+")",onclick:()=>{this.switchToAssetType(this._groupResultsByAssetType(e),t+" ("+e.length+")",!0)}},d("calcite-icon",{slot:"content-end",icon:"chevron-right",scale:"s"}))}renderResultRowAssetType(e){const t=this._getAssetTypeName(e[0]);return d("calcite-list-item",{label:t+" ("+e.length+")",onclick:()=>{this.viewModel.queryFeaturesById(e).then((s=>{if(s?.length){this._resultObjectIdField=s[0].layer.objectIdField,"objectid"===this._resultDisplayField&&(this._resultDisplayField=s[0].layer.objectIdField),"objectid"===this._resultSortField&&(this._resultSortField=s[0].layer.objectIdField);const i=this._appendAttributes(e,s,"objectId");this.switchToIndividualRecords(i,t+" ("+e.length+")",!0)}else this.switchToIndividualRecords(e,t+" ("+e.length+")",!0)}))}},d("calcite-icon",{slot:"content-end",icon:"chevron-right",scale:"s"}))}renderResultRowIndividual(e){const{messages:t}=this;let s="",i=null;for(let r=0;r<e.details.fields.length;r++)e.details.fields[r].name===this._resultDisplayField&&(i=e.details.fields[r]);if("date"===i.type){s=new Date(e.details.attributes[this._resultDisplayField]).toDateString()}else if(null!==i.domain){const t=i.domain.codedValues;let r="";for(let s=0;s<t.length;s++)t[s].code===e.details.attributes[this._resultDisplayField]&&(r=t[s].name);s=r}else s="assetgroup"===this._resultDisplayField.toLocaleLowerCase()?this._getAssetGroupName(e):"assettype"===this._resultDisplayField.toLocaleLowerCase()?this._getAssetTypeName(e):e.details.attributes[this._resultDisplayField];return s&&""!==s&&null!==s||(s=t.resultsStrings.noValue),d("calcite-list-item",{label:s,onclick:()=>{this.viewModel.zoomToAsset(e.details.geometry)}},d("calcite-icon",{icon:"zoom-to-object","text-label":t.globalStrings.zoomToFeature,scale:"s",slot:"content-end"}))}_mixCustomStrings(){const{messages:e}=this;this.inputSettings.length>0&&this.inputSettings.forEach((t=>{"starting-point"===t.type&&(e.inputsStrings.headerStartingPoint=t.label,e.inputsStrings.startingPointHint=t.description),"barrier"===t.type&&(e.inputsStrings.headerBarrier=t.label,e.inputsStrings.barrierPointHint=t.description)}))}_overrideFlagSymbol(){this.inputSettings.length>0&&this.inputSettings.forEach((e=>{"starting-point"===e.type?this._symbolStartFlag=e.symbol:this._symbolBarrier=e.symbol,this.viewModel.changeFlagSymbol(e.type,e.symbol)}))}_utilityNetworkTraceInitialized(){return this.viewModel.loadUtilityNetwork().then((e=>e?(this.viewModel.selectTracesOnLoad(),this._registerWatchers(),this.viewModel._traces.length<=0&&(this._tracesExists=!1),this.viewModel.flags.length>0?this.view.when().then((()=>{this._watchHandler=s((()=>!this.view?.updating),(async()=>{this._warningNoFlag=!1,this._warningNoBarrierAssetFound=!1,this._warningNoStartAssetFound=!1;const e=await this.viewModel.addFlagsOnLoad();this.viewModel.removeFlagsOnLoadWatcher(),e.includes("barrier")&&(this._warningNoBarrierAssetFound=!0),e.includes("starting-point")&&(this._warningNoStartAssetFound=!0),this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}))})):this.view.when().then((()=>{this._watchHandler=s((()=>!this.view?.updating),(()=>{this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}),{initial:!0})}))):(this._tracesExists=!1,this.view.when().then((()=>{this._watchHandler=s((()=>!this.view?.updating),(()=>{this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}),{initial:!0})}))))).catch((e=>{const{messages:t}=this;this._loadUNError=!1,e.details.raw.extendedCode===T.NOEXTENTION?this._errorMessage=t?.alertsStrings?.noUserExtension||e.message:this._errorMessage=e.message,this.disabled=!1}))}_registerWatchers(){this.addHandles([i((()=>this.selectedTraces),(()=>{this.viewModel.selectTracesOnLoad(),this.scheduleRender()})),i((()=>this.defaultGraphicColor),(()=>{this.viewModel._traceResults.length>0&&this.viewModel._traceResults.forEach((e=>{this.viewModel.changeResultGraphicColor(this.viewModel.defaultGraphicColor,e)})),this.scheduleRender()}))])}_groupResultsByAssetGroup(e){const t=[],s=e.results.elements,i=this._groupBy(s,"networkSourceId");for(const r in i)t.push(this._groupBy(i[r],"assetGroupCode"));return t}_groupResultsByAssetType(e){return this._groupBy(e,"assetTypeCode")}_appendAttributes(e,t,s){const i=[];return e.forEach((e=>{t.forEach((t=>{t.featureSet.features.forEach((r=>{e[s]===r.attributes[this._resultObjectIdField]&&(e.details=r,e.details.fields=t.featureSet.fields,i.push(e))}))}))})),i}_getAssetGroupName(e){let t=e.assetGroupCode.toString();const s=e.assetGroupCode,i=this.viewModel.getValidSources().find((t=>t.sourceId===e.networkSourceId));if(i){const e=i.assetGroups.find((e=>e.assetGroupCode===s));e&&(t=e.assetGroupName)}return t}_getAssetTypeName(e){let t=e.assetTypeCode.toString();const s=e.assetGroupCode,i=this.viewModel.getValidSources().find((t=>t.sourceId===e.networkSourceId));if(i){const r=i.assetGroups.find((e=>e.assetGroupCode===s));if(r){const s=r.assetTypes.find((t=>t.assetTypeCode===e.assetTypeCode));s&&(t=s.assetTypeName)}}return t}_compare(e,t){return(s,i)=>{let r=0,l=s.details.attributes[e],o=i.details.attributes[e];return isNaN(l)&&(l=l.toLowerCase()),isNaN(o)&&(o=o.toLowerCase()),"desc"===t?l>o?r=1:l<o&&(r=-1):l<o?r=1:l>o&&(r=-1),r}}_groupBy(e,t){return e.reduce(((e,s)=>((e[s[t]]=e[s[t]]||[]).push(s),e)),{})}_getSymbolIcon(e){return"picture-marker"===e.type?d("img",{src:e.url,width:e.width,height:e.height}):null}};e([r()],S.prototype,"_tracesExists",void 0),e([r()],S.prototype,"_selectToolActive",void 0),e([r()],S.prototype,"_activeTrace",void 0),e([r()],S.prototype,"_activeSwatch",void 0),e([r()],S.prototype,"_traceHeaderForFlow",void 0),e([r()],S.prototype,"_assetGroupHeader",void 0),e([r()],S.prototype,"_assetTypeHeader",void 0),e([r()],S.prototype,"_traceResultsFunctions",void 0),e([r()],S.prototype,"_traceResultsAssetGroup",void 0),e([r()],S.prototype,"_traceResultsAssetType",void 0),e([r()],S.prototype,"_traceResultsIndividual",void 0),e([r()],S.prototype,"_showTraceResultFunctions",void 0),e([r()],S.prototype,"_showTraceResultAssetGroup",void 0),e([r()],S.prototype,"_showTraceResultAssetType",void 0),e([r()],S.prototype,"_showIndividualRecords",void 0),e([r()],S.prototype,"_activeTab",void 0),e([r()],S.prototype,"_alertRemoveModal",void 0),e([r()],S.prototype,"_warningNoFlag",void 0),e([r()],S.prototype,"_warningNoTraceSelected",void 0),e([r()],S.prototype,"_confirmReset",void 0),e([r()],S.prototype,"_swatchNode",void 0),e([r()],S.prototype,"_errorMessage",void 0),e([r()],S.prototype,"defaultGraphicColor",null),e([r()],S.prototype,"disabled",void 0),e([r()],S.prototype,"flags",null),e([r()],S.prototype,"gdbVersion",null),e([r()],S.prototype,"iconClass",void 0),e([r()],S.prototype,"inputSettings",void 0),e([r()],S.prototype,"label",null),e([r(),n("esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace")],S.prototype,"messages",void 0),e([r(),n("esri/t9n/common")],S.prototype,"messagesCommon",void 0),e([r()],S.prototype,"selectedTraces",null),e([r()],S.prototype,"selectOnComplete",null),e([r()],S.prototype,"showGraphicsOnComplete",null),e([r()],S.prototype,"showSelectionAttributes",null),e([r()],S.prototype,"view",null),e([c(["add-flag","add-flag-complete","add-flag-error","select-features","clear-selection"]),r({type:h})],S.prototype,"viewModel",void 0),S=e([l(m)],S);const f=S;export{f as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import{when as s,watch as i}from"../core/reactiveUtils.js";import{property as r}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/accessorSupport/ensureType.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import o from"./Widget.js";import{storeNode as a}from"./support/widgetUtils.js";import{messageBundle as n}from"./support/decorators/messageBundle.js";import{vmEvent as c}from"./support/decorators/vmEvent.js";import{tsx as d}from"./support/jsxFactory.js";import h from"./UtilityNetworkTrace/UtilityNetworkTraceViewModel.js";import{GraphicHandler as u,HIGHLIGHT_COLOR as p}from"./UtilityNetworkTrace/support/GraphicHandler.js";const g={base:"esri-utility-trace-network",loaderContainer:"esri-utility-trace-network__loader-container",loader:"esri-utility-trace-network__loader",fadeIn:"esri-utility-trace-network--fade-in",addButtonContainer:"esri-utility-trace-network__add-button-container",noticeContainer:"esri-utility-trace-network__notice-container",listContainer:"esri-utility-trace-network__list-container",resultsContainer:"esri-utility-trace-network__results-container",flow:"esri-utility-trace-network__flow",esriWidget:"esri-widget",esriWidgetPanel:"esri-widget--panel",esriWidgetDisabled:"esri-widget--disabled",esriButton:"esri-button",esriButtonTertiary:"esri-button--tertiary",esriInput:"esri-input",esriMatchHeight:"esri-match-height",iconHandle:"esri-icon-handle-vertical",iconPlus:"esri-icon-plus",iconEdit:"esri-icon-edit",iconHandleHorizontal:"esri-icon-handle-horizontal",iconRefresh:"esri-icon-refresh",iconLink:"esri-icon-link",iconRemove:"esri-icon-erase",widgetIcon:"esri-icon-UtilityNetworkTrace",header:"esri-widget__heading",loading:"esri-icon-loading-indicator",rotating:"esri-rotating"},m="esri.widgets.UtilityNetworkTrace";function w(e){return{height:e+"px"}}function _(e){return{width:e+"px"}}function v(){return{width:"75%"}}function b(){return{textAlign:"center"}}function y(){return{width:"100%"}}const T={NOEXTENTION:-2147208474};let S=class extends(t(o)){constructor(e,t){super(e,t),this._tracesExists=!0,this._graphicHandler=null,this._selectToolActive=!1,this._activeTrace=null,this._activeSwatch="",this._traceHeaderForFlow="",this._assetGroupHeader="",this._assetTypeHeader="",this._traceResultsFunctions=[],this._traceResultsAssetGroup=[],this._traceResultsAssetType=[],this._traceResultsIndividual=[],this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1,this._activeTab="input",this._flagViewType="starting-point",this._alertRemoveModal=!1,this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._warningNoStartAssetFound=!1,this._warningNoBarrierAssetFound=!1,this._warningNoTerminal=!1,this._confirmReset=!1,this._showResultOptions=!1,this._resultObjectIdField="objectid",this._resultDisplayField="objectid",this._resultSortField="objectid",this._resultSortOrder="desc",this._swatchNode=null,this._individualResultNode=null,this._symbolStartFlag=null,this._symbolBarrier=null,this._watchHandler=null,this._loadUNError=!0,this._errorMessage="",this.disabled=!0,this.iconClass=g.widgetIcon,this.inputSettings=[],this.messages=null,this.messagesCommon=null,this.viewModel=new h}initialize(){this._utilityNetworkTraceInitialized(),this._graphicHandler=new u}get defaultGraphicColor(){return this.viewModel.defaultGraphicColor}set defaultGraphicColor(e){this.viewModel.defaultGraphicColor=e}get flags(){return this.viewModel.flags}set flags(e){this.viewModel.flags=e}get gdbVersion(){return this.viewModel.gdbVersion}set gdbVersion(e){this.viewModel.gdbVersion=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get selectedTraces(){return this.viewModel.selectedTraces}set selectedTraces(e){this.viewModel.selectedTraces=e}get selectOnComplete(){return this.viewModel.selectOnComplete}set selectOnComplete(e){this.viewModel.selectOnComplete=e}get showGraphicsOnComplete(){return this.viewModel.showGraphicsOnComplete}set showGraphicsOnComplete(e){this.viewModel.showGraphicsOnComplete=e}get showSelectionAttributes(){return this.viewModel.showSelectionAttributes}set showSelectionAttributes(e){this.viewModel.showSelectionAttributes=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}async checkCanTrace(){this._confirmReset=!1;const e=this.viewModel.checkCanTrace();e.status?(this._warningNoFlag=!1,this._warningNoTraceSelected=!1,this._warningNoTraceSelected=!1,this._warningNoTerminal=!1,this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1,this.switchTab("result"),this.viewModel._activeProgress=!0,await this.viewModel.callTrace(),this.viewModel._activeProgress=!1):e.issues.forEach((e=>{switch(e){case"noStart":this._warningNoFlag=!0;break;case"noTerminalSelected":this._warningNoTerminal=!0;break;default:this._warningNoTraceSelected=!0}}))}confirmReset(){this._confirmReset=!0}render(){const{state:e}=this.viewModel;this._mixCustomStrings(),this._overrideFlagSymbol();const t="loading"===e?this.renderLoading():this.renderUtilityNetworkTrace();return d("div",{class:this.classes(g.base,g.esriWidget,g.esriWidgetPanel,{[g.esriWidgetDisabled]:this.disabled})},t)}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-action.js"),import("@esri/calcite-components/dist/components/calcite-action-group.js"),import("@esri/calcite-components/dist/components/calcite-action-pad.js"),import("@esri/calcite-components/dist/components/calcite-block.js"),import("@esri/calcite-components/dist/components/calcite-block-section.js"),import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-checkbox.js"),import("@esri/calcite-components/dist/components/calcite-color-picker-swatch.js"),import("@esri/calcite-components/dist/components/calcite-combobox.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),import("@esri/calcite-components/dist/components/calcite-flow.js"),import("@esri/calcite-components/dist/components/calcite-flow-item.js"),import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-label.js"),import("@esri/calcite-components/dist/components/calcite-list.js"),import("@esri/calcite-components/dist/components/calcite-list-item.js"),import("@esri/calcite-components/dist/components/calcite-loader.js"),import("@esri/calcite-components/dist/components/calcite-modal.js"),import("@esri/calcite-components/dist/components/calcite-notice.js"),import("@esri/calcite-components/dist/components/calcite-option.js"),import("@esri/calcite-components/dist/components/calcite-panel.js"),import("@esri/calcite-components/dist/components/calcite-popover.js"),import("@esri/calcite-components/dist/components/calcite-select.js"),import("@esri/calcite-components/dist/components/calcite-tab.js"),import("@esri/calcite-components/dist/components/calcite-tab-nav.js"),import("@esri/calcite-components/dist/components/calcite-tab-title.js"),import("@esri/calcite-components/dist/components/calcite-tabs.js")])}switchTab(e){this._activeTab=e}switchToFunctions(e,t){this._traceResultsFunctions=e,this._showTraceResultFunctions=t}switchToAssetGroup(e,t,s){this._traceHeaderForFlow=t,this._traceResultsAssetGroup=e,this._showTraceResultAssetGroup=s}switchToAssetType(e,t,s){this._assetGroupHeader=t,this._traceResultsAssetType=e,this._showTraceResultAssetType=s}switchToIndividualRecords(e,t,s){this._assetTypeHeader=t,this._traceResultsIndividual=e,this._showIndividualRecords=s}renderLoading(){return d("div",{class:g.loaderContainer,key:"loader"},d("div",{class:g.loader}))}renderUtilityNetworkTrace(){const{messages:e}=this;let t=d("calcite-tabs",{position:"above",layout:"center",styles:y()},d("calcite-tab-nav",{slot:"tab-nav"},d("calcite-tab-title",{active:"input"===this._activeTab,onclick:()=>{this.switchTab("input")}},e.inputsStrings.headerTabInputs),d("calcite-tab-title",{active:"result"===this._activeTab,onclick:()=>{this.switchTab("result")}},e.resultsStrings.headerTabResults)),d("calcite-tab",{active:"input"===this._activeTab},this.renderInputPanel()),d("calcite-tab",{active:"result"===this._activeTab},this.viewModel._activeProgress?d("calcite-loader",{active:!0,label:e.alertsStrings.traceExecuting,text:e.alertsStrings.traceExecuting,type:"indeterminate"}):this.viewModel._traceResults.length>0?this.renderResultPanel():this.renderWarningMessage("noTraceExecuted",!1),d("calcite-modal",{active:this._confirmReset,color:"blue",scale:"m",width:"s","intl-close":"Close",onCalciteModalClose:()=>{this._confirmReset=!1}},d("h3",{slot:"header"},e.resultsStrings.startOverButton),d("div",{slot:"content"},e.resultsStrings.startOverValidation),d("calcite-button",{slot:"secondary",width:"full",appearance:"outline",onclick:()=>{this._confirmReset=!1}},e.globalStrings.cancel),d("calcite-button",{slot:"primary",width:"full",onclick:()=>{this._confirmReset=!1,this.viewModel.reset(),this.switchTab("input")}},e.globalStrings.ok))));return this._tracesExists||(t=d("calcite-panel",null,this.renderWarningMessage("noTraceConfig",!1))),this._loadUNError||(t=d("calcite-panel",null,this.renderWarningMessage("loadUNError",!1,this._errorMessage))),t}renderInputPanel(){const{messages:e}=this;return d("calcite-flow",{class:g.flow},d("calcite-flow-item",null,this._warningNoFlag?this.renderWarningMessage("flag",!0):null,this._warningNoTerminal?this.renderWarningMessage("noTerminal",!0):null,this._warningNoTraceSelected?this.renderWarningMessage("trace",!0):null,this.renderTraceSelectorContainer(),this.renderStartFlagsContainer(),this.renderBarriersFlagsContainer(),this._warningNoFlag&&this._warningNoTraceSelected?d("div",{styles:w(10)}):null,d("calcite-button",{slot:"footer",scale:"m",color:"blue",width:"full",onclick:()=>{this.checkCanTrace()}},e.tracingStrings.runTrace)),this._selectToolActive?this.renderActiveTool():null)}renderResultPanel(){return d("div",{class:this.classes(g.resultsContainer)},d("calcite-flow",null,this.renderTraceResults(),this._showTraceResultFunctions?this.renderTraceResultFunctions():null,this._showTraceResultAssetGroup?this.renderTraceResultByAssetGroup():null,this._showTraceResultAssetType?this.renderTraceResultByAssetType():null,this._showIndividualRecords?this.renderTraceResultIndividual():null,this._showIndividualRecords?this.renderTraceResultIndividualPopover():null))}renderStartFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter((e=>"starting-point"===e.type)),s.forEach((e=>{e.displayValue&&t.push(this.renderFlagRow(e,"start"))}));let i=null;return this._symbolStartFlag&&(i=this._getSymbolIcon(this._symbolStartFlag)),d("calcite-block",{heading:e.inputsStrings.headerStartingPoint+" ("+s.length+")",open:!0,collapsible:!0},d("div",{slot:"icon"},i||d("calcite-icon",{icon:"pin",scale:"s"})),d("div",null,e.inputsStrings.startingPointHint),d("div",{class:g.listContainer},t),this._warningNoStartAssetFound?this.renderWarningMessage("noStartAsset",!0):null,d("div",{class:g.addButtonContainer},d("calcite-button",{alignment:"center",appearance:"outline","icon-start":"plus",scale:"m",href:"",label:e.inputsStrings.addPointOption,onclick:()=>{this._flagViewType="starting-point",this._selectToolActive=!0,this._warningNoStartAssetFound=!1,this.viewModel.addFlagByHit("starting-point",this._symbolStartFlag).then((e=>{e?this._warningNoFlag=!1:this._warningNoStartAssetFound=!0,this._selectToolActive=!1}))},round:!0})))}renderBarriersFlagsContainer(){const{messages:e}=this,t=[];let s=[];s=this.viewModel._flags.filter((e=>"barrier"===e.type)),s.forEach((e=>{e.displayValue&&t.push(this.renderFlagRow(e,"barrier"))}));let i=null;return this._symbolBarrier&&(i=this._getSymbolIcon(this._symbolBarrier)),d("calcite-block",{heading:e.inputsStrings.headerBarrier+" ("+s.length+")",open:!1,collapsible:!0},d("div",{slot:"icon"},i||d("calcite-icon",{icon:"x-circle-f",scale:"s"})),d("div",null,e.inputsStrings.barrierPointHint),d("div",{class:g.listContainer},t),this._warningNoBarrierAssetFound?this.renderWarningMessage("noBarrierAsset",!0):null,d("div",{class:g.addButtonContainer},d("calcite-button",{alignment:"center",appearance:"outline",color:"blue","icon-start":"plus",scale:"m",href:"",round:!0,label:e.inputsStrings.addPointOption,onclick:()=>{this._flagViewType="barrier",this._selectToolActive=!0,this._warningNoBarrierAssetFound=!1,this.viewModel.addFlagByHit("barrier",this._symbolBarrier).then((e=>{e||(this._warningNoBarrierAssetFound=!0),this._selectToolActive=!1}))}})))}renderFlagRow(e,t){const{messages:s}=this,i=[];let r=!1;return null!==e.allTerminals&&void 0!==e.allTerminals&&e.allTerminals.terminals.length>0&&(r=!0,e.allTerminals.terminals.forEach((t=>{let s=!1;e.selectedTerminals.includes(t.id)&&(s=!0),i.push(d("calcite-combobox-item",{key:t.name,selected:s,value:t.id,"text-label":t.name}))}))),d("calcite-block",{key:"pop"+e.globalId+e.type+e.id+t,heading:e.displayValue.value,collapsible:null!==e.allTerminals||"barrier"===e.type},d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:s.globalStrings.remove,label:s.globalStrings.remove,onCalciteListItemChange:()=>{this.viewModel.removeFlag(e)},onclick:()=>{this.viewModel.removeFlag(e)},scale:"s",icon:"trash"}),d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:s.globalStrings.zoomToFeature,label:s.globalStrings.zoomToFeature,onCalciteListItemChange:()=>{this.viewModel.zoomToAsset(e.details.geometry)},onclick:()=>{this.viewModel.zoomToAsset(e.details.geometry)},scale:"s",icon:"zoom-to-object"}),"barrier"===e.type?d("calcite-label",{scale:"s",layout:"inline"},d("calcite-checkbox",{checked:e.isFilterBarrier,scale:"s",onclick:()=>{this.viewModel.manageFilterBarrier(!e.isFilterBarrier,e)}}),s.inputsStrings.barrierFilter):null,r?d("calcite-combobox",{label:s.globalStrings.selectTerminalPlaceholder,placeholder:s.globalStrings.selectTerminalPlaceholder,"selection-mode":"multi",scale:"s",maxItems:0,onCalciteComboboxChange:t=>{t.detail.selectedItems.length>0?(e.selectedTerminals=[],t.detail.selectedItems.forEach((t=>{this.viewModel.addTerminal(t.value,e)}))):e.selectedTerminals=[]},onCalciteComboboxChipDismiss:t=>{t.preventDefault(),this.viewModel.removeTerminal(t.target.value,e)}},i):null)}renderActiveTool(){const{messages:e}=this;let t=null;return"starting-point"===this._flagViewType?this._symbolStartFlag&&(t=this._getSymbolIcon(this._symbolStartFlag)):this._symbolBarrier&&(t=this._getSymbolIcon(this._symbolBarrier)),d("calcite-flow-item",{"height-scale":"s",onCalciteFlowItemBackClick:()=>{this.viewModel._clickHandler&&(this.viewModel._clickHandler.remove(),this.view.popup.autoOpenEnabled=!0),this._selectToolActive=!1},heading:e.inputsStrings.addPointOption},d("calcite-block",{open:!0,collapsible:!1,heading:""},d("div",{styles:b()},t||d("calcite-icon",{icon:"starting-point"===this._flagViewType?"pin":"x-circle-f",scale:"s"})),d("div",{styles:b()},e.inputsStrings.addPointHint)))}renderTraceSelectorContainer(){const{messages:e}=this,t=[];return this.viewModel._traces.length>0&&this.viewModel._traces.forEach((e=>{t.push(d("calcite-combobox-item",{key:e.globalId,selected:e.selected,value:e.globalId,"text-label":e.title,onCalciteComboboxItemChange:t=>{const s=t.target;this.viewModel.selectTraces(s.selected,e.globalId),this.viewModel._traces.length>0&&(this._warningNoTraceSelected=!1)}}))})),d("calcite-block",{heading:e.tracingStrings.traceOperation,open:!0,collapsible:!0},d("calcite-combobox",{label:e.inputsStrings.selectTraces,placeholder:e.inputsStrings.selectTraces,"selection-mode":"multi",scale:"s",maxItems:0,onCalciteComboboxChipDismiss:e=>{this.viewModel.selectTraces(!1,e.target.value),this.viewModel._traces.length>0&&(this._warningNoTraceSelected=!1)}},t))}renderStartOverContainer(){const{messages:e}=this;return d("calcite-button",{slot:"footer",scale:"m",color:"blue",width:"full",onclick:()=>{this.confirmReset()}},e.resultsStrings.startOverButton)}renderWarningMessage(e,t,s){const{messages:i}=this;let r=i.alertsStrings.NoRunAlertHeader,l=i.alertsStrings.noResultsInfo;switch(e){case"flag":r=i.alertsStrings.startingPointAlertHeader,l=i.alertsStrings.startingPointAlert;break;case"noTerminal":r=i.alertsStrings.noTerminalDefinedHeader,l=i.alertsStrings.noTerminalDefined;break;case"trace":r=i.alertsStrings.selectTraceAlertHeader,l=i.alertsStrings.selectTraceAlert;break;case"noTraceExecuted":r=i.alertsStrings.NoRunAlertHeader,l=i.alertsStrings.noResultsInfo;break;case"noBarrierAsset":case"noStartAsset":r=i.alertsStrings.noAssetsFoundHeader,l=i.alertsStrings.noAssetFound;break;case"noTraceConfig":r="",l=i.alertsStrings.noTraceSupported;break;default:r=i.alertsStrings.genericErrorHeader,l=s||""}return d("div",{class:g.noticeContainer,key:e},d("calcite-notice",{open:!0,key:e,active:!0,dismissible:t,icon:!0,scale:"s",width:"auto",color:"red",onCalciteNoticeClose:()=>{switch(e){case"flag":this._warningNoFlag=!1;break;case"noTerminal":this._warningNoTerminal=!1;break;case"trace":this._warningNoTraceSelected=!1;break;case"noStartAsset":this._warningNoStartAssetFound=!1;break;case"noBarrierAsset":this._warningNoBarrierAssetFound=!1}}},d("div",{slot:"title"},r),d("div",{slot:"message"},l)))}renderRemoveTraceContainer(e){const{messages:t}=this;return d("calcite-action",{textEnabled:!0,slot:"header-menu-actions",text:t.globalStrings.clearResults,label:t.globalStrings.clearResults,onCalciteListItemChange:()=>{this._alertRemoveModal=!0,this._activeTrace=e.trace},onclick:()=>{this._alertRemoveModal=!0,this._activeTrace=e.trace},scale:"s",icon:"trash"})}renderHighlightColorPicker(e,t){const{messages:s}=this,i=[];for(let r=0;r<p.length;r++)i.push(d("calcite-action",{key:r,text:s.resultsStrings.graphicColor,label:s.resultsStrings.graphicColor,scale:"s",onclick:()=>{this.viewModel.changeResultGraphicColor(this._graphicHandler.getHighlightColor(r),t)}},d("calcite-color-picker-swatch",{scale:"s",color:this._graphicHandler.getHighlightColor(r).hex,active:e.color===this._graphicHandler.getHighlightColor(r).color})));return d("calcite-action-pad",{position:"start",layout:"grid",expandDisabled:!0},d("calcite-action-group",{layout:"grid",columns:4},i))}renderTraceResults(){const{messages:e}=this,t=this.viewModel._traceResults,s=[];return t.forEach(((t,i)=>{let r=[],l=[],o=!1,a=!1,n=!1;null!==t.results&&t.results.hasOwnProperty("elements")?(null!==t.results.aggregatedGeometry&&(a=!0),null!==t.results.globalFunctionResults&&t.results.globalFunctionResults.length>0&&(l=t.results.globalFunctionResults,l.length>0&&(n=!0)),t.results.elements.length>0&&(r=t.results.elements,r.length>0&&(o=!0)),s.push(d("calcite-block",{key:t.trace.title,heading:t.trace.title,summary:t.trace.description,collapsible:!1,open:!0,intlOptions:e.resultsStrings.ellipsesOptions},this.renderRemoveTraceContainer(t),d("calcite-list",null,n?d("calcite-list-item",{label:e.resultsStrings.functionHeader+" ("+l.length+")",onclick:()=>{this.switchToFunctions(l,!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):null,o&&this.viewModel.showSelectionAttributes?d("calcite-list-item",{key:this.id,label:e.resultsStrings.viewFeatures+" ("+r.length+")",onclick:()=>{this.switchToAssetGroup(this._groupResultsByAssetGroup(t),t.trace.title+" ("+r.length+")",!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"})):this.viewModel.showSelectionAttributes?d("calcite-label",{layout:"inline",scale:"s"},e.resultsStrings.noSelectionResults):null),d("div",{styles:w(10)}),o?d("calcite-label",{layout:"inline",scale:"s",onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)}},d("calcite-checkbox",{checked:t.selectionEnabled,scale:"m",onclick:e=>{e.preventDefault(),e.stopPropagation(),this.viewModel.mergeSelection(!t.selectionEnabled,t.trace)}}),this.viewModel.showSelectionAttributes?e.resultsStrings.selectFeatures:e.resultsStrings.selectFeatures+" ("+r.length+")"):null,a?d("calcite-block-section",{"toggle-display":"switch",text:e.resultsStrings.highlightTrace,open:t.graphicEnabled,onCalciteBlockSectionToggle:e=>{e.target.open?this.viewModel.changeResultGraphicColor(t.graphicColor,t):this.viewModel.removeResultGraphicFromView(t)}},d("calcite-action",{text:e.resultsStrings.graphicColor,label:e.resultsStrings.graphicColor,scale:"s",onclick:e=>{const t=e.target;this._swatchNode=t,this._activeSwatch="aggGeom_"+i}},d("calcite-color-picker-swatch",{scale:"s",color:t.graphicColor.hex})),d("calcite-popover",{autoClose:!0,label:e.resultsStrings.graphicColor,text:e.resultsStrings.graphicColor,referenceElement:this._swatchNode,placement:"auto-start",offsetDistance:0,offsetSkidding:0,open:this._activeSwatch==="aggGeom_"+i,onCalcitePopoverClose:()=>{this._swatchNode=null,this._activeSwatch=null}},this.renderHighlightColorPicker(t.graphicColor,t))):null))):s.push(d("calcite-block",{key:"error-"+i,heading:t.trace.title,collapsible:!1,open:!0},this.renderRemoveTraceContainer(t),this.renderWarningMessage("noController",!1,t.status)))})),d("calcite-flow-item",{key:"traceResults"},s,this.renderStartOverContainer(),d("calcite-modal",{active:this._alertRemoveModal,color:"blue",scale:"m",width:"s","intl-close":"Close",onCalciteModalClose:()=>{this._alertRemoveModal=!1}},d("h3",{slot:"header"},e.globalStrings.clearResults),d("div",{slot:"content"},e.alertsStrings.clearResultsAlert),d("calcite-button",{slot:"secondary",width:"full",appearance:"outline",onclick:()=>{this._alertRemoveModal=!1}},e.globalStrings.cancel),d("calcite-button",{slot:"primary",width:"full",onclick:()=>{this.viewModel.clearResult(this._activeTrace),this._alertRemoveModal=!1,0===this.viewModel._traceResults.length?this.switchTab("input"):(this._activeTrace=this.viewModel._traceResults[0].trace,this._showTraceResultFunctions=!1,this._showTraceResultAssetGroup=!1,this._showTraceResultAssetType=!1,this._showIndividualRecords=!1)}},e.globalStrings.ok)))}renderTraceResultFunctions(){const{messages:e}=this,t=this._traceResultsFunctions,s=[];return t.forEach((e=>{s.push(this.renderResultRowFunctions(e))})),d("calcite-flow-item",{key:"functionResultMultiple",onCalciteFlowItemBackClick:()=>{this.switchToFunctions([],!1)},heading:e.resultsStrings.functionHeader},s,this.renderStartOverContainer())}renderTraceResultByAssetGroup(){const e=this._traceResultsAssetGroup,t=[];for(const s in e){const i=e[s];for(const e in i)t.push(this.renderResultRowAssetGroup(i[e]))}return d("calcite-flow-item",{key:"assetGroupResultMultiple",onCalciteFlowItemBackClick:()=>{this.switchToAssetGroup([],"",!1)},heading:this._traceHeaderForFlow},d("calcite-list",null,t),this.renderStartOverContainer())}renderTraceResultByAssetType(){const e=this._traceResultsAssetType,t=[];for(const s in e)e[s].length>0&&t.push(this.renderResultRowAssetType(e[s]));return d("calcite-flow-item",{key:"assetTypeResult",onCalciteFlowItemBackClick:()=>{this.switchToAssetType([],"",!1)},heading:this._assetGroupHeader},t,this.renderStartOverContainer())}renderTraceResultIndividual(){const{messages:e}=this,t=this._traceResultsIndividual;t.sort(this._compare(this._resultSortField,this._resultSortOrder));const s=[];if(t.length>0){t[0].details.fields.some((e=>e.name.toLowerCase()===this._resultDisplayField.toLocaleLowerCase()))||(this._resultDisplayField=this._resultObjectIdField,this._resultSortField=this._resultObjectIdField),t.forEach((e=>{s.push(this.renderResultRowIndividual(e))}))}return d("calcite-flow-item",{key:"individualResult",onCalciteFlowItemBackClick:()=>{this._showResultOptions=!1,this.switchToIndividualRecords([],"",!1)},heading:this._assetTypeHeader},d("calcite-action",{"text-enabled":!0,slot:"header-actions-end",text:e.resultsStrings.displayAttribute,onCalciteListItemChange:()=>{this._showResultOptions=!0},onclick:()=>{this._showResultOptions=!0},scale:"s",icon:"gear",label:e.resultsStrings.displayAttribute,id:"field_options"+this.id,afterCreate:a,bind:this,"data-node-ref":"_individualResultNode"}),s,this.renderStartOverContainer())}renderTraceResultIndividualPopover(){const{messages:e}=this,t=this._traceResultsIndividual,s=[],i=[];return t.length>0&&t[0].details.fields.forEach((e=>{s.push(d("calcite-option",{key:"display"+e.name,label:e.alias,value:e.name,selected:e.name===this._resultDisplayField})),i.push(d("calcite-option",{key:"sort"+e.name,label:e.alias,value:e.name,selected:e.name===this._resultSortField}))})),d("calcite-popover",{autoClose:!0,label:e.resultsStrings.displayAttribute,referenceElement:this._individualResultNode,placement:"left-start",offsetDistance:0,offsetSkidding:0,open:this._showResultOptions,styles:null!==this.domNode?_(.75*this.domNode.clientWidth):v()},d("calcite-block",{heading:"",open:!0},d("calcite-label",{scale:"s"},e.resultsStrings.displayAttribute,d("calcite-select",{label:e.resultsStrings.displayAttribute,onCalciteSelectChange:e=>{const t=e.target;this._resultDisplayField=t.selectedOption.value,this._showResultOptions=!1}},s)),d("calcite-label",{scale:"s"},e.resultsStrings.sortBy,d("calcite-select",{label:e.resultsStrings.sortBy,onCalciteSelectChange:e=>{const s=e.target;this._resultSortField=s.selectedOption.value,t.sort(this._compare(this._resultSortField,this._resultSortOrder)),this._traceResultsIndividual=t,this._showResultOptions=!1}},i))))}renderResultRow(e){let t=e[0].assetGroupCode;const s=this.viewModel.getValidSources().filter((t=>t.sourceId===e[0].networkSourceId));if(s.length>0){const i=s[0].assetGroups.filter((t=>t.assetGroupCode===e[0].assetGroupCode));i.length>0&&(t=i[0].assetGroupName)}return d("calcite-list-item",{label:t+" ("+e.length+")",onclick:()=>{this.switchToAssetType(this._groupResultsByAssetType(e),t+" ("+e.length+")",!0)}},d("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}renderResultRowFunctions(e){return d("calcite-block",{heading:e.networkAttributeName+" "+e.functionType+" = "+e.result,collapsible:!1})}renderResultRowAssetGroup(e){const t=this._getAssetGroupName(e[0]);return d("calcite-list-item",{label:t+" ("+e.length+")",onclick:()=>{this.switchToAssetType(this._groupResultsByAssetType(e),t+" ("+e.length+")",!0)}},d("calcite-icon",{slot:"content-end",icon:"chevron-right",scale:"s"}))}renderResultRowAssetType(e){const t=this._getAssetTypeName(e[0]);return d("calcite-list-item",{label:t+" ("+e.length+")",onclick:()=>{this.viewModel.queryFeaturesById(e).then((s=>{if(s?.length){this._resultObjectIdField=s[0].layer.objectIdField,"objectid"===this._resultDisplayField&&(this._resultDisplayField=s[0].layer.objectIdField),"objectid"===this._resultSortField&&(this._resultSortField=s[0].layer.objectIdField);const i=this._appendAttributes(e,s,"objectId");this.switchToIndividualRecords(i,t+" ("+e.length+")",!0)}else this.switchToIndividualRecords(e,t+" ("+e.length+")",!0)}))}},d("calcite-icon",{slot:"content-end",icon:"chevron-right",scale:"s"}))}renderResultRowIndividual(e){const{messages:t}=this;let s="",i=null;for(let r=0;r<e.details.fields.length;r++)e.details.fields[r].name===this._resultDisplayField&&(i=e.details.fields[r]);if("date"===i.type){s=new Date(e.details.attributes[this._resultDisplayField]).toDateString()}else if(null!==i.domain){const t=i.domain.codedValues;let r="";for(let s=0;s<t.length;s++)t[s].code===e.details.attributes[this._resultDisplayField]&&(r=t[s].name);s=r}else s="assetgroup"===this._resultDisplayField.toLocaleLowerCase()?this._getAssetGroupName(e):"assettype"===this._resultDisplayField.toLocaleLowerCase()?this._getAssetTypeName(e):e.details.attributes[this._resultDisplayField];return s&&""!==s&&null!==s||(s=t.resultsStrings.noValue),d("calcite-list-item",{label:s,onclick:()=>{this.viewModel.zoomToAsset(e.details.geometry)}},d("calcite-icon",{icon:"zoom-to-object","text-label":t.globalStrings.zoomToFeature,scale:"s",slot:"content-end"}))}_mixCustomStrings(){const{messages:e}=this;this.inputSettings.length>0&&this.inputSettings.forEach((t=>{"starting-point"===t.type&&(e.inputsStrings.headerStartingPoint=t.label,e.inputsStrings.startingPointHint=t.description),"barrier"===t.type&&(e.inputsStrings.headerBarrier=t.label,e.inputsStrings.barrierPointHint=t.description)}))}_overrideFlagSymbol(){this.inputSettings.length>0&&this.inputSettings.forEach((e=>{"starting-point"===e.type?this._symbolStartFlag=e.symbol:this._symbolBarrier=e.symbol,this.viewModel.changeFlagSymbol(e.type,e.symbol)}))}_utilityNetworkTraceInitialized(){return this.viewModel.loadUtilityNetwork().then((e=>e?(this.viewModel.selectTracesOnLoad(),this._registerWatchers(),this.viewModel._traces.length<=0&&(this._tracesExists=!1),this.viewModel.flags.length>0?this.view.when().then((()=>{this._watchHandler=s((()=>!this.view?.updating),(async()=>{this._warningNoFlag=!1,this._warningNoBarrierAssetFound=!1,this._warningNoStartAssetFound=!1;const e=await this.viewModel.addFlagsOnLoad();this.viewModel.removeFlagsOnLoadWatcher(),e.includes("barrier")&&(this._warningNoBarrierAssetFound=!0),e.includes("starting-point")&&(this._warningNoStartAssetFound=!0),this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}))})):this.view.when().then((()=>{this._watchHandler=s((()=>!this.view?.updating),(()=>{this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}),{initial:!0})}))):(this._tracesExists=!1,this.view.when().then((()=>{this._watchHandler=s((()=>!this.view?.updating),(()=>{this.disabled=!1,null!==this._watchHandler&&this._watchHandler.remove()}),{initial:!0})}))))).catch((e=>{const{messages:t}=this;this._loadUNError=!1,e.details.raw.extendedCode===T.NOEXTENTION?this._errorMessage=t?.alertsStrings?.noUserExtension||e.message:this._errorMessage=e.message,this.disabled=!1}))}_registerWatchers(){this.addHandles([i((()=>this.selectedTraces),(()=>{this.viewModel.selectTracesOnLoad(),this.scheduleRender()})),i((()=>this.defaultGraphicColor),(()=>{this.viewModel._traceResults.length>0&&this.viewModel._traceResults.forEach((e=>{this.viewModel.changeResultGraphicColor(this.viewModel.defaultGraphicColor,e)})),this.scheduleRender()}))])}_groupResultsByAssetGroup(e){const t=[],s=e.results.elements,i=this._groupBy(s,"networkSourceId");for(const r in i)t.push(this._groupBy(i[r],"assetGroupCode"));return t}_groupResultsByAssetType(e){return this._groupBy(e,"assetTypeCode")}_appendAttributes(e,t,s){const i=[];return e.forEach((e=>{t.forEach((t=>{t.featureSet.features.forEach((r=>{e[s]===r.attributes[this._resultObjectIdField]&&(e.details=r,e.details.fields=t.featureSet.fields,i.push(e))}))}))})),i}_getAssetGroupName(e){let t=e.assetGroupCode.toString();const s=e.assetGroupCode,i=this.viewModel.getValidSources().find((t=>t.sourceId===e.networkSourceId));if(i){const e=i.assetGroups.find((e=>e.assetGroupCode===s));e&&(t=e.assetGroupName)}return t}_getAssetTypeName(e){let t=e.assetTypeCode.toString();const s=e.assetGroupCode,i=this.viewModel.getValidSources().find((t=>t.sourceId===e.networkSourceId));if(i){const r=i.assetGroups.find((e=>e.assetGroupCode===s));if(r){const s=r.assetTypes.find((t=>t.assetTypeCode===e.assetTypeCode));s&&(t=s.assetTypeName)}}return t}_compare(e,t){return(s,i)=>{let r=0,l=s.details.attributes[e],o=i.details.attributes[e];return isNaN(l)&&(l=l.toLowerCase()),isNaN(o)&&(o=o.toLowerCase()),"desc"===t?l>o?r=1:l<o&&(r=-1):l<o?r=1:l>o&&(r=-1),r}}_groupBy(e,t){return e.reduce(((e,s)=>((e[s[t]]=e[s[t]]||[]).push(s),e)),{})}_getSymbolIcon(e){return"picture-marker"===e.type?d("img",{src:e.url,width:e.width,height:e.height}):null}};e([r()],S.prototype,"_tracesExists",void 0),e([r()],S.prototype,"_selectToolActive",void 0),e([r()],S.prototype,"_activeTrace",void 0),e([r()],S.prototype,"_activeSwatch",void 0),e([r()],S.prototype,"_traceHeaderForFlow",void 0),e([r()],S.prototype,"_assetGroupHeader",void 0),e([r()],S.prototype,"_assetTypeHeader",void 0),e([r()],S.prototype,"_traceResultsFunctions",void 0),e([r()],S.prototype,"_traceResultsAssetGroup",void 0),e([r()],S.prototype,"_traceResultsAssetType",void 0),e([r()],S.prototype,"_traceResultsIndividual",void 0),e([r()],S.prototype,"_showTraceResultFunctions",void 0),e([r()],S.prototype,"_showTraceResultAssetGroup",void 0),e([r()],S.prototype,"_showTraceResultAssetType",void 0),e([r()],S.prototype,"_showIndividualRecords",void 0),e([r()],S.prototype,"_activeTab",void 0),e([r()],S.prototype,"_alertRemoveModal",void 0),e([r()],S.prototype,"_warningNoFlag",void 0),e([r()],S.prototype,"_warningNoTraceSelected",void 0),e([r()],S.prototype,"_confirmReset",void 0),e([r()],S.prototype,"_swatchNode",void 0),e([r()],S.prototype,"_errorMessage",void 0),e([r()],S.prototype,"defaultGraphicColor",null),e([r()],S.prototype,"disabled",void 0),e([r()],S.prototype,"flags",null),e([r()],S.prototype,"gdbVersion",null),e([r()],S.prototype,"iconClass",void 0),e([r()],S.prototype,"inputSettings",void 0),e([r()],S.prototype,"label",null),e([r(),n("esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace")],S.prototype,"messages",void 0),e([r(),n("esri/t9n/common")],S.prototype,"messagesCommon",void 0),e([r()],S.prototype,"selectedTraces",null),e([r()],S.prototype,"selectOnComplete",null),e([r()],S.prototype,"showGraphicsOnComplete",null),e([r()],S.prototype,"showSelectionAttributes",null),e([r()],S.prototype,"view",null),e([c(["add-flag","add-flag-complete","add-flag-error","select-features","clear-selection"]),r({type:h})],S.prototype,"viewModel",void 0),S=e([l(m)],S);const f=S;export{f as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[7269,7035,7541],{41123:(e,t,a)=>{a.d(t,{D:()=>s});const r="randomUUID"in crypto;function s(){if(r)return crypto.randomUUID();const e=crypto.getRandomValues(new Uint16Array(8));e[3]=4095&e[3]|16384,e[4]=16383&e[4]|32768;const t=t=>e[t].toString(16).padStart(4,"0");return t(0)+t(1)+"-"+t(2)+"-"+t(3)+"-"+t(4)+"-"+t(5)+t(6)+t(7)}},82526:(e,t,a)=>{a.d(t,{aX:()=>S});var r=a(68773),s=a(20102),n=a(92604),i=a(70586),o=a(38913),l=a(58901),d=a(82971),u=a(33955);const p={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new l.Z({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:d.Z.WebMercator}),minus180Line:new l.Z({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:d.Z.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new l.Z({paths:[[[180,-180],[180,180]]],spatialReference:d.Z.WGS84}),minus180Line:new l.Z({paths:[[[-180,-180],[-180,180]]],spatialReference:d.Z.WGS84})}};function c(e,t){return Math.ceil((e-t)/(2*t))}function h(e,t){const a=f(e);for(const e of a)for(const a of e)a[0]+=t;return e}function f(e){return(0,u.oU)(e)?e.rings:e.paths}var y=a(8744),m=a(40488),g=(a(66577),a(3172)),b=a(17452);function w(e){return{geometryType:(0,u.Ji)(e[0]),geometries:e.map((e=>e.toJSON()))}}const F=n.Z.getLogger("esri.geometry.support.normalizeUtils");function I(e){return"polygon"===e[0].type}function A(e){return"polyline"===e[0].type}function Z(e,t,a){if(t){const t=function(e,t){if(!(e instanceof l.Z||e instanceof o.Z)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw F.error(e),new s.Z(e)}const a=f(e),r=[];for(const e of a){const a=[];r.push(a),a.push([e[0][0],e[0][1]]);for(let r=0;r<e.length-1;r++){const s=e[r][0],n=e[r][1],i=e[r+1][0],o=e[r+1][1],l=Math.sqrt((i-s)*(i-s)+(o-n)*(o-n)),d=(o-n)/l,u=(i-s)/l,p=l/t;if(p>1){for(let e=1;e<=p-1;e++){const r=e*t,i=u*r+s,o=d*r+n;a.push([i,o])}const e=(l+Math.floor(p-1)*t)/2,r=u*e+s,i=d*e+n;a.push([r,i])}a.push([i,o])}}return function(e){return"polygon"===e.type}(e)?new o.Z({rings:r,spatialReference:e.spatialReference}):new l.Z({paths:r,spatialReference:e.spatialReference})}(e,1e6);e=(0,m.Sx)(t,!0)}return a&&(e=h(e,a)),e}function v(e,t,a){if(Array.isArray(e)){const r=e[0];if(r>t){const a=c(r,t);e[0]=r+a*(-2*t)}else if(r<a){const t=c(r,a);e[0]=r+t*(-2*a)}}else{const r=e.x;if(r>t){const a=c(r,t);e=e.clone().offset(a*(-2*t),0)}else if(r<a){const t=c(r,a);e=e.clone().offset(t*(-2*a),0)}}return e}function R(e,t){let a=-1;for(let r=0;r<t.cutIndexes.length;r++){const s=t.cutIndexes[r],n=t.geometries[r],i=f(n);for(let e=0;e<i.length;e++){const t=i[e];t.some((a=>{if(a[0]<180)return!0;{let a=0;for(let e=0;e<t.length;e++){const r=t[e][0];a=r>a?r:a}a=Number(a.toFixed(9));const r=-360*c(a,180);for(let a=0;a<t.length;a++){const t=n.getPoint(e,a);n.setPoint(e,a,t.clone().offset(r,0))}return!0}}))}if(s===a){if(I(e))for(const t of f(n))e[s]=e[s].addRing(t);else if(A(e))for(const t of f(n))e[s]=e[s].addPath(t)}else a=s,e[s]=n}return e}async function S(e,t,a){if(!Array.isArray(e))return S([e],t);t&&"string"!=typeof t&&F.warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const s="string"==typeof t?t:t?.url??r.Z.geometryServiceUrl;let n,d,f,I,A,E,$,x,O=0;const U=[],L=[];for(const t of e)if((0,i.Wi)(t))L.push(t);else if(n||(n=t.spatialReference,d=(0,y.C5)(n),f=n.isWebMercator,E=f?102100:4326,I=p[E].maxX,A=p[E].minX,$=p[E].plus180Line,x=p[E].minus180Line),d)if("mesh"===t.type)L.push(t);else if("point"===t.type)L.push(v(t.clone(),I,A));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map((e=>v(e,I,A))),L.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,d);L.push(e.rings?new o.Z(e):e)}else if(t.extent){const e=t.extent,a=c(e.xmin,A)*(2*I);let r=0===a?t.clone():h(t.clone(),a);e.offset(a,0),e.intersects($)&&e.xmax!==I?(O=e.xmax>O?e.xmax:O,r=Z(r,f),U.push(r),L.push("cut")):e.intersects(x)&&e.xmin!==A?(O=e.xmax*(2*I)>O?e.xmax*(2*I):O,r=Z(r,f,360),U.push(r),L.push("cut")):L.push(r)}else L.push(t.clone());else L.push(t);let C=c(O,I),T=-90;const j=C,k=new l.Z;for(;C>0;){const e=360*C-180;k.addPath([[e,T],[e,-1*T]]),T*=-1,C--}if(U.length>0&&j>0){const t=R(U,await async function(e,t,a,r){const s="string"==typeof e?(0,b.mN)(e):e,n=t[0].spatialReference,i={...r,query:{...s.query,f:"json",sr:JSON.stringify(n),target:JSON.stringify({geometryType:(0,u.Ji)(t[0]),geometries:t}),cutter:JSON.stringify(a)}},o=await(0,g.default)(s.path+"/cut",i),{cutIndexes:l,geometries:d=[]}=o.data;return{cutIndexes:l,geometries:d.map((e=>{const t=(0,u.im)(e);return t.spatialReference=n,t}))}}(s,U,k,a)),r=[],n=[];for(let a=0;a<L.length;a++){const s=L[a];if("cut"!==s)n.push(s);else{const s=t.shift(),o=e[a];(0,i.pC)(o)&&"polygon"===o.type&&o.rings&&o.rings.length>1&&s.rings.length>=o.rings.length?(r.push(s),n.push("simplify")):n.push(f?(0,m.$)(s):s)}}if(!r.length)return n;const o=await async function(e,t,a){const r="string"==typeof e?(0,b.mN)(e):e,s=t[0].spatialReference,n=(0,u.Ji)(t[0]),i={...a,query:{...r.query,f:"json",sr:s.wkid?s.wkid:JSON.stringify(s),geometries:JSON.stringify(w(t))}};return function(e,t,a){const r=(0,u.q9)(t);return e.map((e=>{const t=r.fromJSON(e);return t.spatialReference=a,t}))}((await(0,g.default)(r.path+"/simplify",i)).data,n,s)}(s,r,a),l=[];for(let e=0;e<n.length;e++){const t=n[e];"simplify"!==t?l.push(t):l.push(f?(0,m.$)(o.shift()):o.shift())}return l}const N=[];for(let e=0;e<L.length;e++){const t=L[e];if("cut"!==t)N.push(t);else{const e=U.shift();N.push(!0===f?(0,m.$)(e):e)}}return N}},87269:(e,t,a)=>{a.r(t),a.d(t,{AssetMapEditFlags:()=>s,applyEdits:()=>y});var r,s,n,i=a(38171),o=a(46791),l=a(20102),d=a(22974),u=a(70586),p=a(17452),c=a(41123),h=a(82526),f=a(66361);async function y(e,t,a,s={}){let n,i;const p={edits:a,result:new Promise(((e,t)=>{n=e,i=t}))};e.emit("apply-edits",p);try{const{results:i,edits:p}=await async function(e,t,a,s){if(await e.load(),!function(e){return e&&null!=e.applyEdits}(t))throw new l.Z(`${e.type}-layer:no-editing-support`,"Layer source does not support applyEdits capability",{layer:e});if(!e.editingEnabled)throw new l.Z(`${e.type}-layer:editing-disabled`,"Editing is disabled for layer",{layer:e});const{edits:n,options:i}=await async function(e,t,a){const s=t&&(t.addFeatures||t.updateFeatures||t.deleteFeatures),n=t&&(t.addAttachments||t.updateAttachments||t.deleteAttachments),i=(0,u.pC)(e.infoFor3D);if(!t||!s&&!n)throw new l.Z(`${e.type}-layer:missing-parameters`,"'addFeatures', 'updateFeatures', 'deleteFeatures', 'addAttachments', 'updateAttachments' or 'deleteAttachments' parameter is required");if(!e.capabilities.data.isVersioned&&a&&a.gdbVersion)throw new l.Z(`${e.type}-layer:invalid-parameter`,"'gdbVersion' is applicable only if the layer supports versioned data. See: 'capabilities.data.isVersioned'");if(!e.capabilities.editing.supportsRollbackOnFailure&&a&&a.rollbackOnFailureEnabled)throw new l.Z(`${e.type}-layer:invalid-parameter`,"This layer does not support 'rollbackOnFailureEnabled' parameter. See: 'capabilities.editing.supportsRollbackOnFailure'");if(!e.capabilities.editing.supportsGlobalId&&a&&a.globalIdUsed)throw new l.Z(`${e.type}-layer:invalid-parameter`,"This layer does not support 'globalIdUsed' parameter. See: 'capabilities.editing.supportsGlobalId'");if(!e.capabilities.editing.supportsGlobalId&&n)throw new l.Z(`${e.type}-layer:invalid-parameter`,"'addAttachments', 'updateAttachments' and 'deleteAttachments' are applicable only if the layer supports global ids. See: 'capabilities.editing.supportsGlobalId'");if((!a||!a.globalIdUsed)&&n)throw new l.Z(`${e.type}-layer:invalid-parameter`,"When 'addAttachments', 'updateAttachments' or 'deleteAttachments' is specified, globalIdUsed should be set to true");const d={...a};if(null!=d.rollbackOnFailureEnabled||e.capabilities.editing.supportsRollbackOnFailure||(d.rollbackOnFailureEnabled=!0),!1===d.rollbackOnFailureEnabled&&"original-and-current-features"===d.returnServiceEditsOption)throw new l.Z(`${e.type}-layer:invalid-parameter`,"'original-and-current-features' is valid for 'returnServiceEditsOption' only when 'rollBackOnFailure' is true.");if(!e.capabilities.editing.supportsReturnServiceEditsInSourceSpatialReference&&d.returnServiceEditsInSourceSR)throw new l.Z(`${e.type}-layer:invalid-parameter`,"This layer does not support 'returnServiceEditsInSourceSR' parameter. See: 'capabilities.editing.supportsReturnServiceEditsInSourceSpatialReference'");if(d.returnServiceEditsInSourceSR&&"original-and-current-features"!==d.returnServiceEditsOption)throw new l.Z(`${e.type}-layer:invalid-parameter`,"'returnServiceEditsOption' is valid only when 'returnServiceEditsOption' is set to 'original-and-current-features'");const p={...t};if(p.addFeatures=t&&o.Z.isCollection(t.addFeatures)?t.addFeatures.toArray():p.addFeatures||[],p.updateFeatures=t&&o.Z.isCollection(t.updateFeatures)?t.updateFeatures.toArray():p.updateFeatures||[],p.deleteFeatures=t&&o.Z.isCollection(t.deleteFeatures)?t.deleteFeatures.toArray():p.deleteFeatures||[],p.addFeatures.length&&!e.capabilities.operations.supportsAdd)throw new l.Z(`${e.type}-layer:unsupported-operation`,"Layer does not support adding features.");if(p.updateFeatures.length&&!e.capabilities.operations.supportsUpdate)throw new l.Z(`${e.type}-layer:unsupported-operation`,"Layer does not support updating features.");if(p.deleteFeatures.length&&!e.capabilities.operations.supportsDelete)throw new l.Z(`${e.type}-layer:unsupported-operation`,"Layer does not support deleting features.");p.addAttachments=p.addAttachments||[],p.updateAttachments=p.updateAttachments||[],p.deleteAttachments=p.deleteAttachments||[],p.addFeatures=p.addFeatures.map(w),p.updateFeatures=p.updateFeatures.map(w),p.addAssets=[];const c=a&&a.globalIdUsed||i;return p.addFeatures.forEach((t=>function(e,t,a){m(e,t,a)}(t,e,c))),p.updateFeatures.forEach((t=>function(e,t,a){if(m(e,t,a),"geometry"in e&&(0,u.pC)(e.geometry)&&!t.capabilities.editing.supportsGeometryUpdate)throw new l.Z(`${t.type}-layer:unsupported-operation`,"Layer does not support geometry updates.")}(t,e,c))),p.deleteFeatures.forEach((t=>function(e,t,a){m(e,t,a)}(t,e,c))),p.addAttachments.forEach((t=>g(t,e))),p.updateAttachments.forEach((t=>g(t,e))),i&&await async function(e,t){if((0,u.Wi)(t.infoFor3D))return;const{infoFor3D:a}=t;let s=!1;for(const{id:e}of a.editFormats)if(e===r.GLTF_BINARY){s=!0;break}const n=[];for(const a of e.addFeatures)n.push(F(a,e,t,s));for(const a of e.updateFeatures)n.push(F(a,e,t,s));const i=await Promise.allSettled(n);for(const e of i)if("rejected"===e.status)throw e.reason}(p,e),{edits:await b(p),options:d}}(e,a,s);return n.addFeatures.length||n.updateFeatures.length||n.deleteFeatures.length||n.addAttachments.length||n.updateAttachments.length||n.deleteAttachments.length?{edits:n,results:await t.applyEdits(n,i)}:{edits:n,results:{addFeatureResults:[],updateFeatureResults:[],deleteFeatureResults:[],addAttachmentResults:[],updateAttachmentResults:[],deleteAttachmentResults:[]}}}(e,t,a,s),c=e=>e.filter((e=>!e.error)).map(d.d9),h={edits:p,addedFeatures:c(i.addFeatureResults),updatedFeatures:c(i.updateFeatureResults),deletedFeatures:c(i.deleteFeatureResults),addedAttachments:c(i.addAttachmentResults),updatedAttachments:c(i.updateAttachmentResults),deletedAttachments:c(i.deleteAttachmentResults)};return i.editedFeatureResults?.length&&(h.editedFeatures=i.editedFeatureResults),(h.addedFeatures.length||h.updatedFeatures.length||h.deletedFeatures.length||h.addedAttachments.length||h.updatedAttachments.length||h.deletedAttachments.length)&&(e.emit("edits",h),(0,f.lQ)(e)&&f.dU.emit("edits",{layer:e,event:h})),n(h),i}catch(e){throw i(e),e}}function m(e,t,a){if(a){if("attributes"in e&&!e.attributes[t.globalIdField])throw new l.Z(`${t.type}-layer:invalid-parameter`,"Feature should have 'globalId' when 'globalIdUsed' is true");if(!("attributes"in e)&&!e.globalId)throw new l.Z(`${t.type}-layer:invalid-parameter`,"'globalId' of the feature should be passed when 'globalIdUsed' is true")}if("geometry"in e&&(0,u.pC)(e.geometry)){if(e.geometry.hasZ&&!1===t.capabilities.data.supportsZ)throw new l.Z(`${t.type}-layer:z-unsupported`,"Layer does not support z values while feature has z values.");if(e.geometry.hasM&&!1===t.capabilities.data.supportsM)throw new l.Z(`${t.type}-layer:m-unsupported`,"Layer does not support m values while feature has m values.")}}function g(e,t){const{feature:a,attachment:r}=e;if(!a||"attributes"in a&&!a.attributes[t.globalIdField])throw new l.Z(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to a feature with 'globalId'");if(!("attributes"in a)&&!a.globalId)throw new l.Z(`${t.type}-layer:invalid-parameter`,"Attachment should have reference to 'globalId' of the parent feature");if(!r.globalId)throw new l.Z(`${t.type}-layer:invalid-parameter`,"Attachment should have 'globalId'");if(!r.data&&!r.uploadId)throw new l.Z(`${t.type}-layer:invalid-parameter`,"Attachment should have 'data' or 'uploadId'");if(!(r.data instanceof File&&r.data.name||r.name))throw new l.Z(`${t.type}-layer:invalid-parameter`,"'name' is required when attachment is specified as Base64 encoded string using 'data'");if(!t.capabilities.editing.supportsUploadWithItemId&&r.uploadId)throw new l.Z(`${t.type}-layer:invalid-parameter`,"This layer does not support 'uploadId' parameter. See: 'capabilities.editing.supportsUploadWithItemId'");if("string"==typeof r.data){const e=(0,p.sJ)(r.data);if(e&&!e.isBase64)throw new l.Z(`${t.type}-layer:invalid-parameter`,"Attachment 'data' should be a Blob, File or Base64 encoded string")}}async function b(e){const t=e.addFeatures,a=e.updateFeatures,r=t.concat(a).map((e=>e.geometry)),s=await(0,h.aX)(r),n=t.length,i=a.length;return s.slice(0,n).forEach(((t,a)=>e.addFeatures[a].geometry=t)),s.slice(n,n+i).forEach(((t,a)=>e.updateFeatures[a].geometry=t)),e}function w(e){const t=new i.Z;return e.attributes||(e.attributes={}),t.geometry=e.geometry,t.attributes=e.attributes,t}async function F(e,t,a,s){if((0,u.Wi)(e.geometry)||"mesh"!==e.geometry.type)return;const n=e.geometry,i=a.globalIdField;if((0,u.pC)(a.parsedUrl)&&(0,u.pC)(n.external)&&"string"==typeof n.external.source&&n.external.source.startsWith(a.parsedUrl.path))return;if(!s)throw new l.Z(`${a.type}-layer:binary-gltf-asset-not-supported`,"3DObjectFeatureLayer requires binary glTF (.glb) support for updating mesh geometry.");const o=await n.toBinaryGLTF(),d=await o.buffer(),p=`{${(0,c.D)()}}`,h=`${p}.glb`;t.addAssets.push({featureGlobalId:e.getAttribute(i),assetMapGlobalId:p,assetName:h,flags:0,data:d.data,mimeType:d.type,assetType:r.GLTF_BINARY,feature:e})}!function(e){e.GLTF_BINARY="3D_glb",e.GLTF_JSON="3D_gltf"}(r||(r={})),(n=s||(s={}))[n.PROJECT_VERTICES=1]="PROJECT_VERTICES"},66361:(e,t,a)=>{a.d(t,{dU:()=>o,lQ:()=>u,o1:()=>p});var r=a(43697),s=a(32448),n=a(22974),i=(a(92604),a(75215),a(20102),a(80442),a(52011));const o=new s.Z.EventEmitter,l="esri.layers.mixins.EditBusLayer",d=Symbol(l);function u(e){return null!=e&&"object"==typeof e&&d in e}const p=e=>{var t;let a=class extends e{constructor(...e){super(...e),this[t]=!0,this.when().then((()=>{this.own([o.on("edits",(e=>{const t="layer"in e?e.layer:null,a="layer"in e?e.layer?.url:e.serviceUrl,r="layer"in e?e.layer?.layerId:e.layerId,s=e.event;if(t===this||a!==this.url)return;if(null!=r&&null!=this.layerId&&r===this.layerId)return void this.emit("edits",(0,n.d9)(s));const i=s.editedFeatures?.find((({layerId:e})=>e===this.layerId));if(i){const{adds:e,updates:t,deletes:a}=i.editedFeatures,r={edits:null,addedAttachments:[],deletedAttachments:[],updatedAttachments:[],addedFeatures:e.map((({attributes:e})=>({objectId:this.objectIdField&&e[this.objectIdField],globalId:this.globalIdField&&e[this.globalIdField]}))),deletedFeatures:a.map((({attributes:e})=>({objectId:this.objectIdField&&e[this.objectIdField],globalId:this.globalIdField&&e[this.globalIdField]}))),updatedFeatures:t.map((({current:{attributes:e}})=>({objectId:this.objectIdField&&e[this.objectIdField],globalId:this.globalIdField&&e[this.globalIdField]}))),editedFeatures:(0,n.d9)(s.editedFeatures)};this.emit("edits",r)}}))])}),(()=>{}))}};return t=d,a=(0,r._)([(0,i.j)(l)],a),a}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[3281,5732],{5732:(e,t,s)=>{s.d(t,{a:()=>r,c:()=>i,g:()=>n});var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function r(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}},69801:(e,t,s)=>{s.d(t,{WJ:()=>h,Xq:()=>a});var i,n,r=s(70586),o=s(44553);(n=i||(i={}))[n.ALL=0]="ALL",n[n.SOME=1]="SOME";class a{constructor(e,t,s){this._namespace=e,this._storage=t,this._removeFunc=!1,this._hit=0,this._miss=0,this._storage.register(this),this._namespace+=":",s&&(this._storage.registerRemoveFunc(this._namespace,s),this._removeFunc=!0)}destroy(){this._storage.clear(this._namespace),this._removeFunc&&this._storage.deregisterRemoveFunc(this._namespace),this._storage.deregister(this),this._storage=null}get namespace(){return this._namespace.slice(0,-1)}get hitRate(){return this._hit/(this._hit+this._miss)}get size(){return this._storage.size}get maxSize(){return this._storage.maxSize}resetHitRate(){this._hit=this._miss=0}put(e,t,s,i=0){this._storage.put(this._namespace+e,t,s,i)}get(e){const t=this._storage.get(this._namespace+e);return void 0===t?++this._miss:++this._hit,t}pop(e){const t=this._storage.pop(this._namespace+e);return void 0===t?++this._miss:++this._hit,t}updateSize(e,t,s){this._storage.updateSize(this._namespace+e,t,s)}clear(){this._storage.clear(this._namespace)}clearAll(){this._storage.clearAll()}getStats(){return this._storage.getStats()}resetStats(){this._storage.resetStats()}}class h{constructor(e=10485760){this._maxSize=e,this._db=new Map,this._size=0,this._hit=0,this._miss=0,this._removeFuncs=new o.Z,this._users=new o.Z}destroy(){this.clearAll(),this._removeFuncs.clear(),this._users.clear(),this._db=null}register(e){this._users.push(e)}deregister(e){this._users.removeUnordered(e)}registerRemoveFunc(e,t){this._removeFuncs.push([e,t])}deregisterRemoveFunc(e){this._removeFuncs.filterInPlace((t=>t[0]!==e))}get size(){return this._size}get maxSize(){return this._maxSize}set maxSize(e){this._maxSize=Math.max(e,0),this._checkSizeLimit()}put(e,t,s,n){const r=this._db.get(e);if(r&&(this._size-=r.size,this._db.delete(e),r.entry!==t&&this._notifyRemove(e,r.entry,i.ALL)),s>this._maxSize)return void this._notifyRemove(e,t,i.ALL);if(void 0===t)return void console.warn("Refusing to cache undefined entry ");if(!s||s<0)return void console.warn("Refusing to cache entry with invalid size "+s);const o=1+Math.max(n,-3)- -3;this._db.set(e,{entry:t,size:s,lifetime:o,lives:o}),this._size+=s,this._checkSizeLimit()}updateSize(e,t,s){const n=this._db.get(e);if(n&&n.entry===t){for(this._size-=n.size;s>this._maxSize;){const n=this._notifyRemove(e,t,i.SOME);if(!((0,r.pC)(n)&&n>0))return void this._db.delete(e);s=n}n.size=s,this._size+=s,this._checkSizeLimit()}}pop(e){const t=this._db.get(e);if(t)return this._size-=t.size,this._db.delete(e),++this._hit,t.entry;++this._miss}get(e){const t=this._db.get(e);if(void 0!==t)return this._db.delete(e),t.lives=t.lifetime,this._db.set(e,t),++this._hit,t.entry;++this._miss}getStats(){const e={Size:Math.round(this._size/1048576)+"/"+Math.round(this._maxSize/1048576)+"MB","Hit rate":Math.round(100*this._getHitRate())+"%",Entries:this._db.size.toString()},t={},s=new Array;this._db.forEach(((e,i)=>{const n=e.lifetime;s[n]=(s[n]||0)+e.size,this._users.forAll((s=>{const n=s.namespace;if(i.startsWith(n)){const s=t[n]||0;t[n]=s+e.size}}))}));const i={};this._users.forAll((e=>{const s=e.namespace;if(!isNaN(e.hitRate)&&e.hitRate>0){const n=t[s]||0;t[s]=n,i[s]=Math.round(100*e.hitRate)+"%"}else i[s]="0%"}));const n=Object.keys(t);n.sort(((e,s)=>t[s]-t[e])),n.forEach((s=>e[s]=Math.round(t[s]/2**20)+"MB / "+i[s]));for(let t=s.length-1;t>=0;--t){const i=s[t];i&&(e["Priority "+(t+-3-1)]=Math.round(i/this.size*100)+"%")}return e}resetStats(){this._hit=this._miss=0,this._users.forAll((e=>e.resetHitRate()))}clear(e){this._db.forEach(((t,s)=>{s.startsWith(e)&&(this._size-=t.size,this._db.delete(s),this._notifyRemove(s,t.entry,i.ALL))}))}clearAll(){this._db.forEach(((e,t)=>this._notifyRemove(t,e.entry,i.ALL))),this._size=0,this._db.clear()}_getHitRate(){return this._hit/(this._hit+this._miss)}_notifyRemove(e,t,s){let i;return this._removeFuncs.some((n=>{if(e.startsWith(n[0])){const e=n[1](t,s);return"number"==typeof e&&(i=e),!0}return!1})),i}_checkSizeLimit(){if(!(this._size<=this._maxSize))for(const[e,t]of this._db){if(this._db.delete(e),t.lives<=1){this._size-=t.size;const s=this._notifyRemove(e,t.entry,i.SOME);(0,r.pC)(s)&&s>0&&(this._size+=s,t.lives=t.lifetime,t.size=s,this._db.set(e,t))}else--t.lives,this._db.set(e,t);if(this._size<=.9*this.maxSize)return}}}},60437:(e,t,s)=>{s.d(t,{Gv:()=>y,HH:()=>a,JR:()=>m,TC:()=>h,Tn:()=>c,Ue:()=>r,al:()=>o,cS:()=>_,dp:()=>d,fS:()=>p,op:()=>l,pp:()=>u,t8:()=>f});var i=s(70586),n=s(6570);function r(e=b){return[e[0],e[1],e[2],e[3],e[4],e[5]]}function o(e,t,s,i,n,o,a=r()){return a[0]=e,a[1]=t,a[2]=s,a[3]=i,a[4]=n,a[5]=o,a}function a(e,t){const s=isFinite(e[2])||isFinite(e[5]);return new n.Z(s?{xmin:e[0],xmax:e[3],ymin:e[1],ymax:e[4],zmin:e[2],zmax:e[5],spatialReference:t}:{xmin:e[0],xmax:e[3],ymin:e[1],ymax:e[4],spatialReference:t})}function h(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.min(e[2],t[2]),e[3]=Math.max(e[3],t[3]),e[4]=Math.max(e[4],t[4]),e[5]=Math.max(e[5],t[5])}function u(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.min(e[2],t[2]),e[3]=Math.max(e[3],t[0]),e[4]=Math.max(e[4],t[1]),e[5]=Math.max(e[5],t[2])}function d(e,t=[0,0,0]){return t[0]=function(e){return e[0]>=e[3]?0:e[3]-e[0]}(e),t[1]=function(e){return e[1]>=e[4]?0:e[4]-e[1]}(e),t[2]=function(e){return e[2]>=e[5]?0:e[5]-e[2]}(e),t}function l(e,t,s=e){return s[0]=t[0],s[1]=t[1],s[2]=t[2],s!==e&&(s[3]=e[3],s[4]=e[4],s[5]=e[5]),s}function c(e,t,s=e){return s[3]=t[0],s[4]=t[1],s[5]=t[2],s!==e&&(s[0]=e[0],s[1]=e[1],s[2]=e[2]),e}function f(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function _(e){return e?f(e,y):r(y)}function m(e,t){return e[0]=t[0],e[1]=t[1],e[2]=Number.NEGATIVE_INFINITY,e[3]=t[2],e[4]=t[3],e[5]=Number.POSITIVE_INFINITY,e}function g(e){return 6===e.length}function p(e,t,s){if((0,i.Wi)(e)||(0,i.Wi)(t))return e===t;if(!g(e)||!g(t))return!1;if(s){for(let i=0;i<e.length;i++)if(!s(e[i],t[i]))return!1}else for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}s(24470);const y=[1/0,1/0,1/0,-1/0,-1/0,-1/0],b=[0,0,0,0,0,0];r()},82526:(e,t,s)=>{s.d(t,{aX:()=>w});var i=s(68773),n=s(20102),r=s(92604),o=s(70586),a=s(38913),h=s(58901),u=s(82971),d=s(33955);const l={102100:{maxX:20037508.342788905,minX:-20037508.342788905,plus180Line:new h.Z({paths:[[[20037508.342788905,-20037508.342788905],[20037508.342788905,20037508.342788905]]],spatialReference:u.Z.WebMercator}),minus180Line:new h.Z({paths:[[[-20037508.342788905,-20037508.342788905],[-20037508.342788905,20037508.342788905]]],spatialReference:u.Z.WebMercator})},4326:{maxX:180,minX:-180,plus180Line:new h.Z({paths:[[[180,-180],[180,180]]],spatialReference:u.Z.WGS84}),minus180Line:new h.Z({paths:[[[-180,-180],[-180,180]]],spatialReference:u.Z.WGS84})}};function c(e,t){return Math.ceil((e-t)/(2*t))}function f(e,t){const s=_(e);for(const e of s)for(const s of e)s[0]+=t;return e}function _(e){return(0,d.oU)(e)?e.rings:e.paths}var m=s(8744),g=s(40488),p=(s(66577),s(3172)),y=s(17452);function b(e){return{geometryType:(0,d.Ji)(e[0]),geometries:e.map((e=>e.toJSON()))}}const I=r.Z.getLogger("esri.geometry.support.normalizeUtils");function v(e){return"polygon"===e[0].type}function x(e){return"polyline"===e[0].type}function S(e,t,s){if(t){const t=function(e,t){if(!(e instanceof h.Z||e instanceof a.Z)){const e="straightLineDensify: the input geometry is neither polyline nor polygon";throw I.error(e),new n.Z(e)}const s=_(e),i=[];for(const e of s){const s=[];i.push(s),s.push([e[0][0],e[0][1]]);for(let i=0;i<e.length-1;i++){const n=e[i][0],r=e[i][1],o=e[i+1][0],a=e[i+1][1],h=Math.sqrt((o-n)*(o-n)+(a-r)*(a-r)),u=(a-r)/h,d=(o-n)/h,l=h/t;if(l>1){for(let e=1;e<=l-1;e++){const i=e*t,o=d*i+n,a=u*i+r;s.push([o,a])}const e=(h+Math.floor(l-1)*t)/2,i=d*e+n,o=u*e+r;s.push([i,o])}s.push([o,a])}}return function(e){return"polygon"===e.type}(e)?new a.Z({rings:i,spatialReference:e.spatialReference}):new h.Z({paths:i,spatialReference:e.spatialReference})}(e,1e6);e=(0,g.Sx)(t,!0)}return s&&(e=f(e,s)),e}function F(e,t,s){if(Array.isArray(e)){const i=e[0];if(i>t){const s=c(i,t);e[0]=i+s*(-2*t)}else if(i<s){const t=c(i,s);e[0]=i+t*(-2*s)}}else{const i=e.x;if(i>t){const s=c(i,t);e=e.clone().offset(s*(-2*t),0)}else if(i<s){const t=c(i,s);e=e.clone().offset(t*(-2*s),0)}}return e}function z(e,t){let s=-1;for(let i=0;i<t.cutIndexes.length;i++){const n=t.cutIndexes[i],r=t.geometries[i],o=_(r);for(let e=0;e<o.length;e++){const t=o[e];t.some((s=>{if(s[0]<180)return!0;{let s=0;for(let e=0;e<t.length;e++){const i=t[e][0];s=i>s?i:s}s=Number(s.toFixed(9));const i=-360*c(s,180);for(let s=0;s<t.length;s++){const t=r.getPoint(e,s);r.setPoint(e,s,t.clone().offset(i,0))}return!0}}))}if(n===s){if(v(e))for(const t of _(r))e[n]=e[n].addRing(t);else if(x(e))for(const t of _(r))e[n]=e[n].addPath(t)}else s=n,e[n]=r}return e}async function w(e,t,s){if(!Array.isArray(e))return w([e],t);t&&"string"!=typeof t&&I.warn("normalizeCentralMeridian()","The url object is deprecated, use the url string instead");const n="string"==typeof t?t:t?.url??i.Z.geometryServiceUrl;let r,u,_,v,x,M,B,R,T=0;const L=[],Z=[];for(const t of e)if((0,o.Wi)(t))Z.push(t);else if(r||(r=t.spatialReference,u=(0,m.C5)(r),_=r.isWebMercator,M=_?102100:4326,v=l[M].maxX,x=l[M].minX,B=l[M].plus180Line,R=l[M].minus180Line),u)if("mesh"===t.type)Z.push(t);else if("point"===t.type)Z.push(F(t.clone(),v,x));else if("multipoint"===t.type){const e=t.clone();e.points=e.points.map((e=>F(e,v,x))),Z.push(e)}else if("extent"===t.type){const e=t.clone()._normalize(!1,!1,u);Z.push(e.rings?new a.Z(e):e)}else if(t.extent){const e=t.extent,s=c(e.xmin,x)*(2*v);let i=0===s?t.clone():f(t.clone(),s);e.offset(s,0),e.intersects(B)&&e.xmax!==v?(T=e.xmax>T?e.xmax:T,i=S(i,_),L.push(i),Z.push("cut")):e.intersects(R)&&e.xmin!==x?(T=e.xmax*(2*v)>T?e.xmax*(2*v):T,i=S(i,_,360),L.push(i),Z.push("cut")):Z.push(i)}else Z.push(t.clone());else Z.push(t);let A=c(T,v),C=-90;const E=A,q=new h.Z;for(;A>0;){const e=360*A-180;q.addPath([[e,C],[e,-1*C]]),C*=-1,A--}if(L.length>0&&E>0){const t=z(L,await async function(e,t,s,i){const n="string"==typeof e?(0,y.mN)(e):e,r=t[0].spatialReference,o={...i,query:{...n.query,f:"json",sr:JSON.stringify(r),target:JSON.stringify({geometryType:(0,d.Ji)(t[0]),geometries:t}),cutter:JSON.stringify(s)}},a=await(0,p.default)(n.path+"/cut",o),{cutIndexes:h,geometries:u=[]}=a.data;return{cutIndexes:h,geometries:u.map((e=>{const t=(0,d.im)(e);return t.spatialReference=r,t}))}}(n,L,q,s)),i=[],r=[];for(let s=0;s<Z.length;s++){const n=Z[s];if("cut"!==n)r.push(n);else{const n=t.shift(),a=e[s];(0,o.pC)(a)&&"polygon"===a.type&&a.rings&&a.rings.length>1&&n.rings.length>=a.rings.length?(i.push(n),r.push("simplify")):r.push(_?(0,g.$)(n):n)}}if(!i.length)return r;const a=await async function(e,t,s){const i="string"==typeof e?(0,y.mN)(e):e,n=t[0].spatialReference,r=(0,d.Ji)(t[0]),o={...s,query:{...i.query,f:"json",sr:n.wkid?n.wkid:JSON.stringify(n),geometries:JSON.stringify(b(t))}};return function(e,t,s){const i=(0,d.q9)(t);return e.map((e=>{const t=i.fromJSON(e);return t.spatialReference=s,t}))}((await(0,p.default)(i.path+"/simplify",o)).data,r,n)}(n,i,s),h=[];for(let e=0;e<r.length;e++){const t=r[e];"simplify"!==t?h.push(t):h.push(_?(0,g.$)(a.shift()):a.shift())}return h}const N=[];for(let e=0;e<Z.length;e++){const t=Z[e];if("cut"!==t)N.push(t);else{const e=L.shift();N.push(!0===_?(0,g.$)(e):e)}}return N}},37549:(e,t,s)=>{s.d(t,{H:()=>a});var i=s(80442),n=s(24133),r=s(24470);const o={minX:0,minY:0,maxX:0,maxY:0};class a{constructor(){this._indexInvalid=!1,this._boundsToLoad=[],this._boundsById=new Map,this._idByBounds=new Map,this._index=new n.Q(9,(0,i.Z)("esri-csp-restrictions")?e=>({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}):["[0]","[1]","[2]","[3]"]),this._loadIndex=()=>{if(this._indexInvalid){const e=new Array(this._idByBounds.size);let t=0;this._idByBounds.forEach(((s,i)=>{e[t++]=i})),this._indexInvalid=!1,this._index.clear(),this._index.load(e)}else this._boundsToLoad.length&&(this._index.load(this._boundsToLoad.filter((e=>this._idByBounds.has(e)))),this._boundsToLoad.length=0)}}get fullBounds(){if(!this._boundsById.size)return null;const e=(0,r.cS)();for(const t of this._boundsById.values())t&&(e[0]=Math.min(t[0],e[0]),e[1]=Math.min(t[1],e[1]),e[2]=Math.max(t[2],e[2]),e[3]=Math.max(t[3],e[3]));return e}get valid(){return!this._indexInvalid}clear(){this._indexInvalid=!1,this._boundsToLoad.length=0,this._boundsById.clear(),this._idByBounds.clear(),this._index.clear()}delete(e){const t=this._boundsById.get(e);this._boundsById.delete(e),t&&(this._idByBounds.delete(t),this._indexInvalid||this._index.remove(t))}forEachInBounds(e,t){this._loadIndex(),function(e,t,s){(function(e){o.minX=e[0],o.minY=e[1],o.maxX=e[2],o.maxY=e[3]})(t),e.search(o,s)}(this._index,e,(e=>t(this._idByBounds.get(e))))}get(e){return this._boundsById.get(e)}has(e){return this._boundsById.has(e)}invalidateIndex(){this._indexInvalid||(this._indexInvalid=!0,this._boundsToLoad.length=0)}set(e,t){if(!this._indexInvalid){const t=this._boundsById.get(e);t&&(this._index.remove(t),this._idByBounds.delete(t))}this._boundsById.set(e,t),t&&(this._idByBounds.set(t,e),this._indexInvalid||(this._boundsToLoad.push(t),this._boundsToLoad.length>5e4&&this._loadIndex()))}}},57191:(e,t,s)=>{s.d(t,{Z:()=>m});var i=s(20102),n=s(32448),r=s(92604),o=s(70586),a=s(60437),h=s(24470),u=s(98732),d=s(37549),l=s(29730),c=s(70272),f=s(5428);const _={getObjectId:e=>e.objectId,getAttributes:e=>e.attributes,getAttribute:(e,t)=>e.attributes[t],cloneWithGeometry:(e,t)=>new c.u_(t,e.attributes,null,e.objectId),getGeometry:e=>e.geometry,getCentroid:(e,t)=>((0,o.Wi)(e.centroid)&&(e.centroid=(0,l.Y)(new f.Z,e.geometry,t.hasZ,t.hasM)),e.centroid)};class m{constructor(e){this.geometryInfo=e,this._boundsStore=new d.H,this._featuresById=new Map,this._markedIds=new Set,this.events=new n.Z,this.featureAdapter=_}get geometryType(){return this.geometryInfo.geometryType}get hasM(){return this.geometryInfo.hasM}get hasZ(){return this.geometryInfo.hasZ}get numFeatures(){return this._featuresById.size}get fullBounds(){return this._boundsStore.fullBounds}get storeStatistics(){let e=0;return this._featuresById.forEach((t=>{(0,o.pC)(t.geometry)&&t.geometry.coords&&(e+=t.geometry.coords.length)})),{featureCount:this._featuresById.size,vertexCount:e/(this.hasZ?this.hasM?4:3:this.hasM?3:2)}}add(e){this._add(e),this._emitChanged()}addMany(e){for(const t of e)this._add(t);this._emitChanged()}clear(){this._featuresById.clear(),this._boundsStore.clear(),this._emitChanged()}removeById(e){const t=this._featuresById.get(e);return t?(this._remove(t),this._emitChanged(),t):null}removeManyById(e){this._boundsStore.invalidateIndex();for(const t of e){const e=this._featuresById.get(t);e&&this._remove(e)}this._emitChanged()}forEachBounds(e,t,s){for(const i of e){const e=this._boundsStore.get(i.objectId);e&&t((0,a.JR)(s,e))}}getFeature(e){return this._featuresById.get(e)}has(e){return this._featuresById.has(e)}toArray(){return Array.from(this._featuresById.values())}forEach(e){this._featuresById.forEach((t=>e(t)))}forEachInBounds(e,t){this._boundsStore.forEachInBounds(e,(e=>{t(this._featuresById.get(e))}))}startMarkingUsedFeatures(){this._boundsStore.invalidateIndex(),this._markedIds.clear()}sweep(){let e=!1;this._featuresById.forEach(((t,s)=>{this._markedIds.has(s)||(e=!0,this._remove(t))})),this._markedIds.clear(),e&&this._emitChanged()}_emitChanged(){this.events.emit("changed",void 0)}_add(e){if(!e)return;const t=e.objectId;if(null==t)return void r.Z.getLogger("esri.layers.graphics.data.FeatureStore").error(new i.Z("featurestore:invalid-feature","feature id is missing",{feature:e}));const s=this._featuresById.get(t);let n;if(this._markedIds.add(t),s?(e.displayId=s.displayId,n=this._boundsStore.get(t),this._boundsStore.delete(t)):(0,o.pC)(this.onFeatureAdd)&&this.onFeatureAdd(e),(0,o.Wi)(e.geometry)||!e.geometry.coords||!e.geometry.coords.length)return this._boundsStore.set(t,null),void this._featuresById.set(t,e);n=(0,u.$)((0,o.pC)(n)?n:(0,h.Ue)(),e.geometry,this.geometryInfo.hasZ,this.geometryInfo.hasM),(0,o.pC)(n)&&this._boundsStore.set(t,n),this._featuresById.set(t,e)}_remove(e){return(0,o.pC)(this.onFeatureRemove)&&this.onFeatureRemove(e),this._markedIds.delete(e.objectId),this._boundsStore.delete(e.objectId),this._featuresById.delete(e.objectId),e}}},23095:(e,t,s)=>{s.d(t,{O0:()=>c,av:()=>h,b:()=>g,d1:()=>d,og:()=>m});var i=s(70586),n=s(8744),r=s(35671);class o{constructor(){this.code=null,this.description=null}}class a{constructor(e){this.error=new o,this.globalId=null,this.objectId=null,this.success=!1,this.uniqueId=null,this.error.description=e}}function h(e){return new a(e)}class u{constructor(e){this.globalId=null,this.success=!0,this.objectId=this.uniqueId=e}}function d(e){return new u(e)}const l=new Set;function c(e,t,s,i=!1,n){l.clear();for(const o in s){const a=e?.get(o);if(!a)continue;const u=s[o],d=f(a,u);if(d!==u&&n&&n.push({name:"invalid-value-type",message:"attribute value was converted to match the field type",details:{field:a,originalValue:u,sanitizedValue:d}}),l.add(a.name),a&&(i||a.editable)){const e=(0,r.Qc)(a,d);if(e)return h((0,r.vP)(e,a,d));t[a.name]=d}}for(const t of e?.requiredFields??[])if(!l.has(t.name))return h(`missing required field "${t.name}"`);return null}function f(e,t){let s=t;return"string"==typeof t&&(0,r.H7)(e)?s=parseFloat(t):null!=t&&(0,r.qN)(e)&&"string"!=typeof t&&(s=String(t)),(0,r.Pz)(s)}let _;function m(e,t){if(!e||!(0,n.JY)(t))return e;if("rings"in e||"paths"in e){if((0,i.Wi)(_))throw new TypeError("geometry engine not loaded");return _.simplify(t,e)}return e}async function g(e,t){!(0,n.JY)(e)||"esriGeometryPolygon"!==t&&"esriGeometryPolyline"!==t||await async function(){return(0,i.Wi)(_)&&(_=await Promise.all([s.e(5837),s.e(247)]).then(s.bind(s,30247))),_}()}},99514:(e,t,s)=>{s.d(t,{Z:()=>o});var i=s(35671);function n(e){return"oid"===e.type||"esriFieldTypeOID"===e.type}function r(e){return"global-id"===e.type||"esriFieldTypeGlobalID"===e.type}class o{constructor(e=[]){if(this.fields=[],this._fieldsMap=new Map,this._dateFieldsSet=new Set,this._numericFieldsSet=new Set,this.dateFields=[],this.numericFields=[],this._requiredFields=null,!e)return;this.fields=e;const t=[];for(const o of e){const e=o&&o.name;if(e){const h=a(e);this._fieldsMap.set(e,o),this._fieldsMap.set(h,o),t.push(h),"date"===(s=o).type||"esriFieldTypeDate"===s.type?(this.dateFields.push(o),this._dateFieldsSet.add(o)):(0,i.H7)(o)&&(this._numericFieldsSet.add(o),this.numericFields.push(o)),n(o)||r(o)||(o.editable=null==o.editable||!!o.editable,o.nullable=null==o.nullable||!!o.nullable)}}var s;t.sort(),this.uid=t.join(",")}destroy(){this._fieldsMap.clear()}get requiredFields(){if(!this._requiredFields){this._requiredFields=[];for(const e of this.fields)n(e)||r(e)||e.nullable||void 0!==(0,i.os)(e)||this._requiredFields.push(e)}return this._requiredFields}has(e){return null!=this.get(e)}get(e){return null!=e?this._fieldsMap.get(e)||this._fieldsMap.get(a(e)):void 0}isDateField(e){return this._dateFieldsSet.has(this.get(e))}isNumericField(e){return this._numericFieldsSet.has(this.get(e))}normalizeFieldName(e){const t=this.get(e);if(t)return t.name??void 0}}function a(e){return e.toLowerCase().trim()}},86719:(e,t,s)=>{s.d(t,{v:()=>i});const i=new(s(35454).X)({esriFieldTypeSmallInteger:"small-integer",esriFieldTypeInteger:"integer",esriFieldTypeSingle:"single",esriFieldTypeDouble:"double",esriFieldTypeLong:"long",esriFieldTypeString:"string",esriFieldTypeDate:"date",esriFieldTypeOID:"oid",esriFieldTypeGeometry:"geometry",esriFieldTypeBlob:"blob",esriFieldTypeRaster:"raster",esriFieldTypeGUID:"guid",esriFieldTypeGlobalID:"global-id",esriFieldTypeXML:"xml"})}}]);
|