@arcgis/core 4.26.0 → 4.26.2

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.
Files changed (90) hide show
  1. package/arcade/ArcadeDate.js +1 -1
  2. package/arcade/Feature.js +1 -1
  3. package/arcade/arcadeTimeUtils.js +1 -1
  4. package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/009cd8f27d2357ec9317.js +1 -0
  7. package/assets/esri/core/workers/chunks/03081e28fe59ba2e8040.js +1 -0
  8. package/assets/esri/core/workers/chunks/17ce4b146825adcca307.js +1 -0
  9. package/assets/esri/core/workers/chunks/186f2d0c94fa1eca4959.js +1 -0
  10. package/assets/esri/core/workers/chunks/1fd48420dfbbfdb3b051.js +1 -0
  11. package/assets/esri/core/workers/chunks/226bfa115acb8542f21c.js +1 -0
  12. package/assets/esri/core/workers/chunks/{25abc848a128b24ff66e.js → 3808f33563757fad703d.js} +1 -1
  13. package/assets/esri/core/workers/chunks/38ebf5d20576609566f9.js +1 -0
  14. package/assets/esri/core/workers/chunks/4125b10b1d009f35e75e.js +1 -0
  15. package/assets/esri/core/workers/chunks/47195afa66f640cb4b64.js +1 -0
  16. package/assets/esri/core/workers/chunks/48d35993b6ffb76e56e9.js +1 -0
  17. package/assets/esri/core/workers/chunks/5022862c5658e7bb0e04.js +1 -0
  18. package/assets/esri/core/workers/chunks/55782608bee89fa0d6e1.js +1 -0
  19. package/assets/esri/core/workers/chunks/5598996bcf60741aa734.js +1 -0
  20. package/assets/esri/core/workers/chunks/592e9834aa896cdd0e86.js +1 -0
  21. package/assets/esri/core/workers/chunks/5a5e4983c526bf08c7f1.js +1 -0
  22. package/assets/esri/core/workers/chunks/{a6d34147e7dbb1e4609c.js → 5f8acce073b8da5ac6ae.js} +1 -1
  23. package/assets/esri/core/workers/chunks/611c27efa10e4e04d8b6.js +1 -0
  24. package/assets/esri/core/workers/chunks/6ecf0bb8e16159160cde.js +1 -0
  25. package/assets/esri/core/workers/chunks/81949c9d14a8d75c45b6.js +1 -0
  26. package/assets/esri/core/workers/chunks/843a8b87ebecc246598a.js +1 -0
  27. package/assets/esri/core/workers/chunks/84c0a8d41eec91bb5142.js +1 -0
  28. package/assets/esri/core/workers/chunks/85c6a2c7239d0cf73a44.js +1 -0
  29. package/assets/esri/core/workers/chunks/8f3262f33d635cf9f046.js +1 -0
  30. package/assets/esri/core/workers/chunks/9054fd0707a15d037bb9.js +1 -0
  31. package/assets/esri/core/workers/chunks/a2e5b67c1c65a93f3c75.js +1 -0
  32. package/assets/esri/core/workers/chunks/b8b6df646ecf5482c5b4.js +1 -0
  33. package/assets/esri/core/workers/chunks/bcdd71e7475777f0f1bb.js +1 -0
  34. package/assets/esri/core/workers/chunks/{97ba79f9bceb42405573.js → bce1d4d6449a646834a1.js} +1 -1
  35. package/assets/esri/core/workers/chunks/bdeb15d8c536cc64f8da.js +1 -0
  36. package/assets/esri/core/workers/chunks/c999e9dd748ae449d66e.js +1 -0
  37. package/assets/esri/core/workers/chunks/cb177fb86cf8cec95e87.js +1 -0
  38. package/assets/esri/core/workers/chunks/{3c557a5728c76843561f.js → d3498d28fd01a0ad3899.js} +1 -1
  39. package/assets/esri/core/workers/chunks/dd698ada6b7c03cfd25c.js +1 -0
  40. package/assets/esri/core/workers/chunks/e26acb83eae5eec87ca1.js +1 -0
  41. package/assets/esri/core/workers/chunks/eca1b840c009e5477b80.js +1 -0
  42. package/assets/esri/core/workers/chunks/fbe981e42e92a32d922d.js +1 -0
  43. package/config.js +1 -1
  44. package/core/string.js +1 -1
  45. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  46. package/layers/support/PixelBlock.js +1 -1
  47. package/package.json +1 -1
  48. package/support/revision.js +1 -1
  49. package/views/2d/engine/ImageryBitmapSource.js +1 -1
  50. package/views/2d/layers/features/sources/BaseFeatureSource.js +1 -1
  51. package/views/2d/layers/features/sources/DataTileSource.js +1 -1
  52. package/views/layers/ImageryTileLayerView.js +1 -1
  53. package/widgets/Editor.js +1 -1
  54. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  55. package/widgets/FeatureForm/featureFormUtils.js +1 -1
  56. package/widgets/FeatureForm.js +1 -1
  57. package/assets/esri/core/workers/chunks/03a811b5a912d83792dd.js +0 -1
  58. package/assets/esri/core/workers/chunks/0923c0641ca9d9a52efc.js +0 -1
  59. package/assets/esri/core/workers/chunks/1aff09c90f287eeba408.js +0 -1
  60. package/assets/esri/core/workers/chunks/1faf0e2aeabe003e2f64.js +0 -1
  61. package/assets/esri/core/workers/chunks/28a17bb249893350c2bf.js +0 -1
  62. package/assets/esri/core/workers/chunks/29662688eedc6df54d4b.js +0 -1
  63. package/assets/esri/core/workers/chunks/2b94b1bc4634f0518890.js +0 -1
  64. package/assets/esri/core/workers/chunks/3664d97f0c2819690cf9.js +0 -1
  65. package/assets/esri/core/workers/chunks/3d457f987e2089d67e89.js +0 -1
  66. package/assets/esri/core/workers/chunks/41d25407888326c91566.js +0 -1
  67. package/assets/esri/core/workers/chunks/4503194b1b1d8908a386.js +0 -1
  68. package/assets/esri/core/workers/chunks/4a264b7cfd0a4bc62be9.js +0 -1
  69. package/assets/esri/core/workers/chunks/4cddaa79af86b0981baa.js +0 -1
  70. package/assets/esri/core/workers/chunks/582d12138e6eea62d6fe.js +0 -1
  71. package/assets/esri/core/workers/chunks/5e9869849d999aac5756.js +0 -1
  72. package/assets/esri/core/workers/chunks/636b4e080d701d5856c7.js +0 -1
  73. package/assets/esri/core/workers/chunks/69c89c01783250811b56.js +0 -1
  74. package/assets/esri/core/workers/chunks/72c827a5388a4b1112e3.js +0 -1
  75. package/assets/esri/core/workers/chunks/7db8a429ef7bf11c5bb6.js +0 -1
  76. package/assets/esri/core/workers/chunks/8d52093b6c4bfd087a12.js +0 -1
  77. package/assets/esri/core/workers/chunks/9b449a036598479ad0b0.js +0 -1
  78. package/assets/esri/core/workers/chunks/9c67598554e0d2b2c14a.js +0 -1
  79. package/assets/esri/core/workers/chunks/9f8aad19c5973e201604.js +0 -1
  80. package/assets/esri/core/workers/chunks/9ff12db2f3dcd5749053.js +0 -1
  81. package/assets/esri/core/workers/chunks/a0e3b837262d6d64f605.js +0 -1
  82. package/assets/esri/core/workers/chunks/a213fb1cd2b5da2b7027.js +0 -1
  83. package/assets/esri/core/workers/chunks/aa864f9ad6b9a92ab328.js +0 -1
  84. package/assets/esri/core/workers/chunks/bb6e4affafef9855b8fd.js +0 -1
  85. package/assets/esri/core/workers/chunks/bd711b7229aa5cfa063b.js +0 -1
  86. package/assets/esri/core/workers/chunks/e384e1daec50f8cdcdd1.js +0 -1
  87. package/assets/esri/core/workers/chunks/eccc725bc3f8047171f7.js +0 -1
  88. package/assets/esri/core/workers/chunks/f3b59aa3b33e3ee70bec.js +0 -1
  89. package/assets/esri/core/workers/chunks/f7ed302a233d4cfb9060.js +0 -1
  90. package/assets/esri/core/workers/chunks/fd03ba4613f8973f8c86.js +0 -1
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[8008,8062],{52104:(e,a,t)=>{t.d(a,{V:()=>n});var r=t(96187);async function n(e,a){const t=await(0,r.T)(e,a);t.layers=t.layers.filter(s);const n={serviceJSON:t};if((t.currentVersion??0)<10.5)return n;const i=await(0,r.T)(e+"/layers",a);return n.layersJSON={layers:i.layers.filter(s),tables:i.tables},n}function s(e){return!e.type||"Feature Layer"===e.type}},87344:(e,a,t)=>{t.d(a,{T:()=>r});const r={BingMapsLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(8153)]).then(t.bind(t,2723))).default,BuildingSceneLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(4729),t.e(9790),t.e(8244),t.e(1223),t.e(1423),t.e(4165),t.e(911),t.e(5546),t.e(9942),t.e(9238),t.e(3975),t.e(5590),t.e(8239),t.e(223)]).then(t.bind(t,30223))).default,CSVLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(4729),t.e(9790),t.e(8244),t.e(1223),t.e(1423),t.e(4165),t.e(911),t.e(5546),t.e(9942),t.e(9238),t.e(9675)]).then(t.bind(t,45425))).default,DimensionLayer:async()=>(await Promise.all([t.e(5103),t.e(81)]).then(t.bind(t,40081))).default,ElevationLayer:async()=>(await Promise.all([t.e(3055),t.e(9230)]).then(t.bind(t,65665))).default,FeatureLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(4729),t.e(9790),t.e(8244),t.e(1223),t.e(1423),t.e(4165),t.e(911),t.e(5546),t.e(9942),t.e(9238),t.e(5159)]).then(t.bind(t,19238))).default,GeoJSONLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(4729),t.e(9790),t.e(8244),t.e(1223),t.e(1423),t.e(4165),t.e(911),t.e(5546),t.e(7202)]).then(t.bind(t,23477))).default,GeoRSSLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(9790),t.e(9538)]).then(t.bind(t,3723))).default,GroupLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(7483)]).then(t.bind(t,89348))).default,ImageryLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(4729),t.e(9790),t.e(8244),t.e(1223),t.e(4165),t.e(4599),t.e(6610),t.e(4242),t.e(665)]).then(t.bind(t,45378))).default,ImageryTileLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(4729),t.e(9790),t.e(8244),t.e(1223),t.e(3055),t.e(6610),t.e(4242),t.e(8104),t.e(8915)]).then(t.bind(t,92045))).default,IntegratedMeshLayer:async()=>(await Promise.all([t.e(2710),t.e(3975),t.e(1537)]).then(t.bind(t,9310))).default,KMLLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(4729),t.e(9790),t.e(8244),t.e(1223),t.e(1423),t.e(739)]).then(t.bind(t,42756))).default,LineOfSightLayer:async()=>(await Promise.all([t.e(5103),t.e(690)]).then(t.bind(t,30690))).default,MapImageLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(4729),t.e(9790),t.e(8244),t.e(1223),t.e(1423),t.e(4165),t.e(911),t.e(4599),t.e(6368),t.e(7374)]).then(t.bind(t,27374))).default,MapNotesLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(4729),t.e(9790),t.e(8244),t.e(1223),t.e(1423),t.e(4165),t.e(911),t.e(5546),t.e(9942),t.e(9238),t.e(1227)]).then(t.bind(t,62128))).default,MediaLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(1984)]).then(t.bind(t,57765))).default,OGCFeatureLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(4729),t.e(9790),t.e(8244),t.e(1223),t.e(1423),t.e(4165),t.e(911),t.e(5546),t.e(2855)]).then(t.bind(t,88068))).default,OpenStreetMapLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(9971),t.e(6237)]).then(t.bind(t,66237))).default,OrientedImageryLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(4729),t.e(9790),t.e(8244),t.e(1223),t.e(1423),t.e(4165),t.e(911),t.e(5546),t.e(9942),t.e(9238),t.e(5132)]).then(t.bind(t,76604))).default,PointCloudLayer:async()=>(await Promise.all([t.e(2710),t.e(4729),t.e(3975),t.e(8643),t.e(6772)]).then(t.bind(t,10608))).default,RouteLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(4729),t.e(9790),t.e(8244),t.e(1223),t.e(1423),t.e(4286)]).then(t.bind(t,40153))).default,SceneLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(4729),t.e(9790),t.e(8244),t.e(1223),t.e(1423),t.e(4165),t.e(911),t.e(5546),t.e(9942),t.e(9238),t.e(3975),t.e(5590),t.e(8239),t.e(7476)]).then(t.bind(t,57476))).default,StreamLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(4729),t.e(9790),t.e(8244),t.e(1223),t.e(1423),t.e(4165),t.e(911),t.e(5546),t.e(5004)]).then(t.bind(t,88387))).default,SubtypeGroupLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(4729),t.e(9790),t.e(8244),t.e(1223),t.e(1423),t.e(4165),t.e(911),t.e(9942),t.e(908)]).then(t.bind(t,30359))).default,TileLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(4729),t.e(9790),t.e(8244),t.e(1223),t.e(1423),t.e(4165),t.e(911),t.e(4599),t.e(3055),t.e(6368),t.e(8636)]).then(t.bind(t,98636))).default,UnknownLayer:async()=>(await t.e(4166).then(t.bind(t,44166))).default,UnsupportedLayer:async()=>(await t.e(9296).then(t.bind(t,39296))).default,VectorTileLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(3055),t.e(4325),t.e(1785),t.e(719)]).then(t.bind(t,94756))).default,VoxelLayer:async()=>(await Promise.all([t.e(2710),t.e(4729),t.e(3975),t.e(9327)]).then(t.bind(t,28865))).default,WFSLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(4729),t.e(9790),t.e(8244),t.e(1223),t.e(1423),t.e(4165),t.e(911),t.e(5546),t.e(3974)]).then(t.bind(t,12653))).default,WMSLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(4729),t.e(9790),t.e(2462)]).then(t.bind(t,25906))).default,WMTSLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(9971),t.e(5853)]).then(t.bind(t,55853))).default,WebTileLayer:async()=>(await Promise.all([t.e(2710),t.e(1612),t.e(9971)]).then(t.bind(t,16199))).default}},33516:(e,a,t)=>{t.d(a,{Y:()=>i,h:()=>s});var r=t(17452),n=t(65587);function s(e){return{origin:"portal-item",url:(0,r.mN)(e.itemUrl),portal:e.portal||n.Z.getDefault(),portalItem:e,readResourcePaths:[]}}function i(e){return{origin:"portal-item",messages:[],writtenProperties:[],url:e.itemUrl?(0,r.mN)(e.itemUrl):null,portal:e.portal||n.Z.getDefault(),portalItem:e}}},18062:(e,a,t)=>{t.r(a),t.d(a,{getFirstLayerOrTableId:()=>h,getNumLayersAndTables:()=>g,getSubtypeGroupLayerIds:()=>S,load:()=>p,preprocessFSItemData:()=>b});var r=t(20102),n=t(87085),s=t(66677),i=t(52104),l=t(65587),o=t(15235),c=t(33516),u=t(14661),y=t(40555),d=t(96187);async function p(e,a){const t=e.instance.portalItem;if(t&&t.id)return await t.load(a),function(e){const a=e.instance.portalItem;if(!a?.type||!e.supportedTypes.includes(a.type))throw new r.Z("portal:invalid-layer-item-type","Invalid layer item type '${type}', expected '${expectedType}'",{type:a?.type,expectedType:e.supportedTypes.join(", ")})}(e),async function(e,a){const t=e.instance,n=t.portalItem;if(!n)return;const{url:s,title:l}=n,o=(0,c.h)(n);if("group"===t.type)return t.read({title:l},o),async function(e,a){let t;const{portalItem:n}=e;if(!n)return;const s=n.type,l=a.layerModuleTypeMap,o=(0,u._$)(n,"Oriented Imagery Layer")??!1;switch(s){case"Feature Service":t=o?l.OrientedImageryLayer:l.FeatureLayer;break;case"Stream Service":t=l.StreamLayer;break;case"Scene Service":t=l.SceneLayer;break;case"Feature Collection":t=l.FeatureLayer;break;default:throw new r.Z("portal:unsupported-item-type-as-group",`The item type '${s}' is not supported as a 'IGroupLayer'`)}let[c,y]=await Promise.all([t(),L(a)]),p=()=>c;if("Feature Service"===s){if(y=n.url?await b(y,n.url):{},S(y).length){const e=l.SubtypeGroupLayer,a=await e();p=e=>"SubtypeGroupLayer"===e.layerType?a:c}return f(e,p,y,await async function(e){const{layersJSON:a}=await(0,i.V)(e);if(!a)return null;const t=[...a.layers,...a.tables];return e=>t.find((a=>a.id===e.id))}(n.url))}return g(y)>0?f(e,p,y):async function(e,a){const{portalItem:t}=e;if(!t?.url)return;const r=await(0,d.T)(t.url);r&&f(e,a,{layers:r.layers?.map(m),tables:r.tables?.map(m)})}(e,p)}(t,e);s&&t.read({url:s},o);const p=await L(e,a);return p&&t.read(p,o),t.resourceReferences={portalItem:n,paths:o.readResourcePaths??[]},"subtype-group"!==t.type&&t.read({title:l},o),(0,y.y)(t,o)}(e,a)}function m(e){return{id:e.id,name:e.name}}function f(e,a,t,i){let l=t.layers||[];const c=t.tables||[];if("Feature Collection"===e.portalItem?.type&&(l.forEach((e=>{"Table"===e?.layerDefinition?.type&&c.push(e)})),l=l.filter((e=>"Table"!==e?.layerDefinition?.type))),"coverage"in t){const a=function(e){const{coverage:a}=e;if(!a)return null;const t=new URL(a);if(a.toLowerCase().includes("item.html")){const e=t.searchParams.get("id"),a=t.origin;return n.Z.fromPortalItem({portalItem:new o.default({id:e,url:a})})}if((0,s.B5)(a))return n.Z.fromArcGISServerUrl({url:a});throw new r.Z("portal:oriented-imagery-layer-coverage","the provided coverage url couldn't be loaded as a layer")}(t);a&&e.add(a)}l.reverse().forEach((r=>{const n=w(e,a(r),t,r,i?.(r));e.add(n)})),c.reverse().forEach((r=>{const n=w(e,a(r),t,r,i?.(r));e.tables.add(n)}))}function w(e,a,t,r,n){const s=e.portalItem,i=new a({portalItem:s.clone(),layerId:r.id});if("sourceJSON"in i&&(i.sourceJSON=n),"subtype-group"!==i.type&&(i.sublayerTitleMode="service-name"),"Feature Collection"===s.type){const e={origin:"portal-item",portal:s.portal||l.Z.getDefault()};i.read(r,e);const a=t.showLegend;null!=a&&i.read({showLegend:a},e)}return i}async function L(e,a){if(!1===e.supportsData)return;const t=e.instance,r=t.portalItem;if(!r)return;let n=null;try{n=await r.fetchData("json",a)}catch(e){}if(function(e){return"stream"!==e.type&&"oriented-imagery"!==e.type&&"layerId"in e}(t)){let e=null,a=!0;if(n&&g(n)>0){if(null==t.layerId){const e=S(n);t.layerId="subtype-group"===t.type?e?.[0]:h(n)}e=function(e,a){const{layerId:t}=a,r=e.layers?.find((e=>e.id===t))||e.tables?.find((e=>e.id===t));return r&&function(e,a){return!("feature"===a.type&&"layerType"in e&&"SubtypeGroupLayer"===e.layerType||"subtype-group"===a.type&&!("layerType"in e))}(r,a)?r:null}(n,t),e&&(1===g(n)&&(a=!1),null!=n.showLegend&&(e.showLegend=n.showLegend))}return a&&"service-name"!==t.sublayerTitleMode&&(t.sublayerTitleMode="item-title-and-service-name"),e}return n}async function b(e,a){if(null==e?.layers||null==e?.tables){const t=await(0,d.T)(a);(e=e||{}).layers=e.layers||t?.layers,e.tables=e.tables||t?.tables}return e}function h(e){const a=e.layers;if(a&&a.length)return a[0].id;const t=e.tables;return t&&t.length?t[0].id:null}function g(e){return(e?.layers?.length??0)+(e?.tables?.length??0)}function S(e){const a=[];return e?.layers?.forEach((e=>{"SubtypeGroupLayer"===e.layerType&&a.push(e.id)})),a}},28008:(e,a,t)=>{t.r(a),t.d(a,{fromItem:()=>u,selectLayerClassPath:()=>y});var r=t(20102),n=t(84230),s=t(87344),i=t(15235),l=t(18062),o=t(14661),c=t(96187);async function u(e){!e.portalItem||e.portalItem instanceof i.default||(e={...e,portalItem:new i.default(e.portalItem)});const a=await async function(e){return await e.load(),async function(e){const a=s.T[e.className];return{constructor:await a(),properties:e.properties}}(await y(e))}(e.portalItem);return new(0,a.constructor)({portalItem:e.portalItem,...a.properties})}async function y(e){switch(e.type){case"Map Service":return async function(e){return await async function(e){return(await(0,c.T)(e.url)).tileInfo}(e)?{className:"TileLayer"}:{className:"MapImageLayer"}}(e);case"Feature Service":return async function(e){if((0,o._$)(e,"Oriented Imagery Layer"))return async function(e){await e.load();const a=await e.fetchData();return a.coverage?{className:"GroupLayer"}:{className:"OrientedImageryLayer",properties:a}}(e);const a=await d(e);if("object"==typeof a){const e={};return null!=a.id&&(e.layerId=a.id),{className:a.className||"FeatureLayer",properties:e}}return{className:"GroupLayer"}}(e);case"Feature Collection":return async function(e){await e.load();const a=(0,o._$)(e,"Map Notes"),t=(0,o._$)(e,"Markup");if(a||t)return{className:"MapNotesLayer"};if((0,o._$)(e,"Route Layer"))return{className:"RouteLayer"};const r=await e.fetchData();return 1===(0,l.getNumLayersAndTables)(r)?{className:"FeatureLayer"}:{className:"GroupLayer"}}(e);case"Scene Service":return async function(e){const a=await d(e);if("object"==typeof a){const t={};let r;if(null!=a.id?(t.layerId=a.id,r=`${e.url}/layers/${a.id}`):r=e.url,e.typeKeywords?.length)for(const a of Object.keys(n.fb))if(e.typeKeywords.includes(a))return{className:n.fb[a]};const s=await(0,c.T)(r);return{className:n.fb[s?.layerType]||"SceneLayer",properties:t}}return!1===a&&"Voxel"===(await(0,c.T)(e.url))?.layerType?{className:"VoxelLayer"}:{className:"GroupLayer"}}(e);case"Image Service":return async function(e){await e.load();const a=e.typeKeywords?.map((e=>e.toLowerCase()))??[];if(a.includes("elevation 3d layer"))return{className:"ElevationLayer"};if(a.includes("tiled imagery"))return{className:"ImageryTileLayer"};const t=(await e.fetchData())?.layerType;if("ArcGISTiledImageServiceLayer"===t)return{className:"ImageryTileLayer"};if("ArcGISImageServiceLayer"===t)return{className:"ImageryLayer"};const r=await(0,c.T)(e.url),n=r.cacheType?.toLowerCase(),s=r.capabilities?.toLowerCase().includes("tilesonly");return"map"===n||s?{className:"ImageryTileLayer"}:{className:"ImageryLayer"}}(e);case"Stream Service":case"Feed":return{className:"StreamLayer"};case"Vector Tile Service":return{className:"VectorTileLayer"};case"GeoJson":return{className:"GeoJSONLayer"};case"CSV":return{className:"CSVLayer"};case"KML":return{className:"KMLLayer"};case"WFS":return{className:"WFSLayer"};case"WMTS":return{className:"WMTSLayer"};case"WMS":return{className:"WMSLayer"};default:throw new r.Z("portal:unknown-item-type","Unknown item type '${type}'",{type:e.type})}}async function d(e){const a=e.url;if(!a||a.match(/\/\d+$/))return{};await e.load();const t=await e.fetchData();if("Feature Service"===e.type){const e=p(await(0,l.preprocessFSItemData)(t,a));if("object"==typeof e){const a=(0,l.getSubtypeGroupLayerIds)(t);e.className=null!=e.id&&a.includes(e.id)?"SubtypeGroupLayer":"FeatureLayer"}return e}return(0,l.getNumLayersAndTables)(t)>0?p(t):p(await(0,c.T)(a))}function p(e){return 1===(0,l.getNumLayersAndTables)(e)&&{id:(0,l.getFirstLayerOrTableId)(e)}}},40555:(e,a,t)=>{t.d(a,{y:()=>i});var r=t(66643),n=t(95330),s=t(20941);async function i(e,a,t){const i=e&&e.getAtOrigin&&e.getAtOrigin("renderer",a.origin);if(i&&"unique-value"===i.type&&i.styleOrigin){const l=await(0,r.q6)(i.populateFromStyle());if((0,n.k_)(t),!1===l.ok){const t=l.error;a&&a.messages&&a.messages.push(new s.Z("renderer:style-reference",`Failed to create unique value renderer from style reference: ${t.message}`,{error:t,context:a})),e.clear("renderer",a?.origin)}}}},96187:(e,a,t)=>{t.d(a,{T:()=>n});var r=t(3172);async function n(e,a){const{data:t}=await(0,r.default)(e,{responseType:"json",query:{f:"json",...a?.customParameters,token:a?.apiKey}});return t}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[5159],{3920:(e,t,s)=>{s.d(t,{p:()=>l,r:()=>u});var r=s(43697),o=s(15923),i=s(61247),n=s(5600),a=s(52011),p=s(72762);const l=e=>{let t=class extends e{destroy(){this.destroyed||(this._get("handles")?.destroy(),this._get("updatingHandles")?.destroy())}get handles(){return this._get("handles")||new i.Z}get updatingHandles(){return this._get("updatingHandles")||new p.t}};return(0,r._)([(0,n.Cb)({readOnly:!0})],t.prototype,"handles",null),(0,r._)([(0,n.Cb)({readOnly:!0})],t.prototype,"updatingHandles",null),t=(0,r._)([(0,a.j)("esri.core.HandleOwner")],t),t};let u=class extends(l(o.Z)){};u=(0,r._)([(0,a.j)("esri.core.HandleOwner")],u)},42033:(e,t,s)=>{s.d(t,{E:()=>o,_:()=>i});var r=s(70586);async function o(e,t){const{WhereClause:r}=await s.e(1534).then(s.bind(s,41534));return r.create(e,t)}function i(e,t){return(0,r.pC)(e)?(0,r.pC)(t)?`(${e}) AND (${t})`:e:t}},72762:(e,t,s)=>{s.d(t,{t:()=>d});var r=s(43697),o=s(15923),i=s(61247),n=s(70586),a=s(17445),p=s(1654),l=s(5600),u=s(52011);let d=class extends o.Z{constructor(){super(...arguments),this.updating=!1,this._handleId=0,this._handles=new i.Z,this._scheduleHandleId=0,this._pendingPromises=new Set}destroy(){this.removeAll(),this._handles.destroy()}add(e,t,s={}){return this._installWatch(e,t,s,a.YP)}addWhen(e,t,s={}){return this._installWatch(e,t,s,a.gx)}addOnCollectionChange(e,t,{initial:s=!1,final:r=!1}={}){const o=++this._handleId;return this._handles.add([(0,a.on)(e,"after-changes",this._createSyncUpdatingCallback(),a.Z_),(0,a.on)(e,"change",t,{onListenerAdd:s?e=>t({added:e.toArray(),removed:[]}):void 0,onListenerRemove:r?e=>t({added:[],removed:e.toArray()}):void 0})],o),{remove:()=>this._handles.remove(o)}}addPromise(e){if((0,n.Wi)(e))return e;const t=++this._handleId;this._handles.add({remove:()=>{this._pendingPromises.delete(e)&&(0!==this._pendingPromises.size||this._handles.has(c)||this._set("updating",!1))}},t),this._pendingPromises.add(e),this._set("updating",!0);const s=()=>this._handles.remove(t);return e.then(s,s),e}removeAll(){this._pendingPromises.clear(),this._handles.removeAll(),this._set("updating",!1)}_installWatch(e,t,s={},r){const o=++this._handleId;s.sync||this._installSyncUpdatingWatch(e,o);const i=r(e,t,s);return this._handles.add(i,o),{remove:()=>this._handles.remove(o)}}_installSyncUpdatingWatch(e,t){const s=this._createSyncUpdatingCallback(),r=(0,a.YP)(e,s,{sync:!0,equals:()=>!1});return this._handles.add(r,t),r}_createSyncUpdatingCallback(){return()=>{this._handles.remove(c),++this._scheduleHandleId;const e=this._scheduleHandleId;this._get("updating")||this._set("updating",!0),this._handles.add((0,p.Os)((()=>{e===this._scheduleHandleId&&(this._set("updating",this._pendingPromises.size>0),this._handles.remove(c))})),c)}}};(0,r._)([(0,l.Cb)({readOnly:!0})],d.prototype,"updating",void 0),d=(0,r._)([(0,u.j)("esri.core.support.WatchUpdatingTracking")],d);const c=-42},54295:(e,t,s)=>{s.d(t,{V:()=>n});var r=s(43697),o=s(5600),i=(s(75215),s(67676),s(52011));const n=e=>{let t=class extends e{get apiKey(){return this._isOverridden("apiKey")?this._get("apiKey"):"portalItem"in this?this.portalItem?.apiKey:null}set apiKey(e){null!=e?this._override("apiKey",e):(this._clearOverride("apiKey"),this.clear("apiKey","user"))}};return(0,r._)([(0,o.Cb)({type:String})],t.prototype,"apiKey",null),t=(0,r._)([(0,i.j)("esri.layers.mixins.APIKeyMixin")],t),t}},17287:(e,t,s)=>{s.d(t,{Y:()=>l});var r=s(43697),o=s(92604),i=s(70586),n=s(5600),a=(s(75215),s(67676),s(52011)),p=s(66677);const l=e=>{let t=class extends e{get title(){if(this._get("title")&&"defaults"!==this.originOf("title"))return this._get("title");if(this.url){const e=(0,p.Qc)(this.url);if((0,i.pC)(e)&&e.title)return e.title}return this._get("title")||""}set title(e){this._set("title",e)}set url(e){this._set("url",(0,p.Nm)(e,o.Z.getLogger(this.declaredClass)))}};return(0,r._)([(0,n.Cb)()],t.prototype,"title",null),(0,r._)([(0,n.Cb)({type:String})],t.prototype,"url",null),t=(0,r._)([(0,a.j)("esri.layers.mixins.ArcGISService")],t),t}},70082:(e,t,s)=>{s.d(t,{Z:()=>d});var r=s(43697),o=s(2368),i=s(35454),n=s(96674),a=s(5600),p=(s(75215),s(67676),s(52011));const l=new i.X({esriFeatureEditToolAutoCompletePolygon:"auto-complete-polygon",esriFeatureEditToolCircle:"circle",esriFeatureEditToolEllipse:"ellipse",esriFeatureEditToolFreehand:"freehand",esriFeatureEditToolLine:"line",esriFeatureEditToolNone:"none",esriFeatureEditToolPoint:"point",esriFeatureEditToolPolygon:"polygon",esriFeatureEditToolRectangle:"rectangle",esriFeatureEditToolArrow:"arrow",esriFeatureEditToolTriangle:"triangle",esriFeatureEditToolLeftArrow:"left-arrow",esriFeatureEditToolRightArrow:"right-arrow",esriFeatureEditToolUpArrow:"up-arrow",esriFeatureEditToolDownArrow:"down-arrow"});let u=class extends((0,o.J)(n.wq)){constructor(e){super(e),this.name=null,this.description=null,this.drawingTool=null,this.prototype=null,this.thumbnail=null}};(0,r._)([(0,a.Cb)({json:{write:!0}})],u.prototype,"name",void 0),(0,r._)([(0,a.Cb)({json:{write:!0}})],u.prototype,"description",void 0),(0,r._)([(0,a.Cb)({json:{read:l.read,write:l.write}})],u.prototype,"drawingTool",void 0),(0,r._)([(0,a.Cb)({json:{write:!0}})],u.prototype,"prototype",void 0),(0,r._)([(0,a.Cb)({json:{write:!0}})],u.prototype,"thumbnail",void 0),u=(0,r._)([(0,p.j)("esri.layers.support.FeatureTemplate")],u);const d=u},16451:(e,t,s)=>{s.d(t,{Z:()=>y});var r=s(43697),o=s(2368),i=s(96674),n=s(5600),a=(s(75215),s(67676),s(71715)),p=s(52011),l=s(30556),u=s(72729),d=s(70082);let c=class extends((0,o.J)(i.wq)){constructor(e){super(e),this.id=null,this.name=null,this.domains=null,this.templates=null}readDomains(e){const t={};for(const s of Object.keys(e))t[s]=(0,u.im)(e[s]);return t}writeDomains(e,t){const s={};for(const t of Object.keys(e))e[t]&&(s[t]=e[t]?.toJSON());t.domains=s}};(0,r._)([(0,n.Cb)({json:{write:!0}})],c.prototype,"id",void 0),(0,r._)([(0,n.Cb)({json:{write:!0}})],c.prototype,"name",void 0),(0,r._)([(0,n.Cb)({json:{write:!0}})],c.prototype,"domains",void 0),(0,r._)([(0,a.r)("domains")],c.prototype,"readDomains",null),(0,r._)([(0,l.c)("domains")],c.prototype,"writeDomains",null),(0,r._)([(0,n.Cb)({type:[d.Z],json:{write:!0}})],c.prototype,"templates",void 0),c=(0,r._)([(0,p.j)("esri.layers.support.FeatureType")],c);const y=c},56765:(e,t,s)=>{s.d(t,{Z:()=>u});var r,o=s(43697),i=s(46791),n=s(96674),a=s(5600),p=(s(75215),s(67676),s(52011));let l=r=class extends n.wq{constructor(e){super(e),this.floorField=null,this.viewAllMode=!1,this.viewAllLevelIds=new i.Z}clone(){return new r({floorField:this.floorField,viewAllMode:this.viewAllMode,viewAllLevelIds:this.viewAllLevelIds})}};(0,o._)([(0,a.Cb)({type:String,json:{write:!0}})],l.prototype,"floorField",void 0),(0,o._)([(0,a.Cb)({json:{read:!1,write:!1}})],l.prototype,"viewAllMode",void 0),(0,o._)([(0,a.Cb)({json:{read:!1,write:!1}})],l.prototype,"viewAllLevelIds",void 0),l=r=(0,o._)([(0,p.j)("esri.layers.support.LayerFloorInfo")],l);const u=l},72064:(e,t,s)=>{s.d(t,{h:()=>d});var r=s(80442),o=s(70586),i=s(66677);const n={name:"supportsName",size:"supportsSize",contentType:"supportsContentType",keywords:"supportsKeywords",exifInfo:"supportsExifInfo"};function a(e,t,s){return!!(e&&e.hasOwnProperty(t)?e[t]:s)}function p(e,t,s){return e&&e.hasOwnProperty(t)?e[t]:s}function l(e){const t=e?.supportedSpatialAggregationStatistics?.map((e=>e.toLowerCase()));return{envelope:!!t?.includes("envelopeaggregate"),centroid:!!t?.includes("centroidaggregate"),convexHull:!!t?.includes("convexhullaggregate")}}function u(e,t){const s=e?.supportedOperationsWithCacheHint?.map((e=>e.toLowerCase()));return!!s?.includes(t.toLowerCase())}function d(e,t){return{analytics:c(e),attachment:y(e),data:h(e),metadata:m(e),operations:g(e.capabilities,e,t),query:f(e,t),queryRelated:w(e),queryTopFeatures:v(e),editing:S(e)}}function c(e){return{supportsCacheHint:u(e.advancedQueryCapabilities,"queryAnalytics")}}function y(e){const t=e.attachmentProperties,s={supportsName:!1,supportsSize:!1,supportsContentType:!1,supportsKeywords:!1,supportsExifInfo:!1,supportsCacheHint:u(e.advancedQueryCapabilities,"queryAttachments"),supportsResize:a(e,"supportsAttachmentsResizing",!1)};return t&&Array.isArray(t)&&t.forEach((e=>{const t=n[e.name];t&&(s[t]=!!e.isEnabled)})),s}function h(e){return{isVersioned:a(e,"isDataVersioned",!1),supportsAttachment:a(e,"hasAttachments",!1),supportsM:a(e,"hasM",!1),supportsZ:a(e,"hasZ",!1)}}function m(e){return{supportsAdvancedFieldProperties:a(e,"supportsFieldDescriptionProperty",!1)}}function g(e,t,s){const r=e?e.toLowerCase().split(",").map((e=>e.trim())):[],n=s?(0,i.Qc)(s):null,p=r.includes((0,o.pC)(n)&&"MapServer"===n.serverType?"data":"query"),l=r.includes("editing")&&!t.datesInUnknownTimezone;let u=l&&r.includes("create"),d=l&&r.includes("delete"),c=l&&r.includes("update");const y=r.includes("changetracking"),h=t.advancedQueryCapabilities;return l&&!(u||d||c)&&(u=d=c=!0),{supportsCalculate:a(t,"supportsCalculate",!1),supportsTruncate:a(t,"supportsTruncate",!1),supportsValidateSql:a(t,"supportsValidateSql",!1),supportsAdd:u,supportsDelete:d,supportsEditing:l,supportsChangeTracking:y,supportsQuery:p,supportsQueryAnalytics:a(h,"supportsQueryAnalytic",!1),supportsQueryAttachments:a(h,"supportsQueryAttachments",!1),supportsQueryTopFeatures:a(h,"supportsTopFeaturesQuery",!1),supportsResizeAttachments:a(t,"supportsAttachmentsResizing",!1),supportsSync:r.includes("sync"),supportsUpdate:c,supportsExceedsLimitStatistics:a(t,"supportsExceedsLimitStatistics",!1)}}function f(e,t){const s=e.advancedQueryCapabilities,o=e.ownershipBasedAccessControlForFeatures,n=e.archivingInfo,d=e.currentVersion,c=t?.includes("MapServer"),y=!c||d>=(0,r.Z)("mapserver-pbf-version-support"),h=(0,i.M8)(t),m=new Set((e.supportedQueryFormats??"").split(",").map((e=>e.toLowerCase().trim())));return{supportsStatistics:a(s,"supportsStatistics",e.supportsStatistics),supportsPercentileStatistics:a(s,"supportsPercentileStatistics",!1),supportsSpatialAggregationStatistics:a(s,"supportsSpatialAggregationStatistics",!1),supportedSpatialAggregationStatistics:l(s),supportsCentroid:a(s,"supportsReturningGeometryCentroid",!1),supportsDistance:a(s,"supportsQueryWithDistance",!1),supportsDistinct:a(s,"supportsDistinct",e.supportsAdvancedQueries),supportsExtent:a(s,"supportsReturningQueryExtent",!1),supportsGeometryProperties:a(s,"supportsReturningGeometryProperties",!1),supportsHavingClause:a(s,"supportsHavingClause",!1),supportsOrderBy:a(s,"supportsOrderBy",e.supportsAdvancedQueries),supportsPagination:a(s,"supportsPagination",!1),supportsQuantization:a(e,"supportsCoordinatesQuantization",!1),supportsQuantizationEditMode:a(e,"supportsQuantizationEditMode",!1),supportsQueryGeometry:a(e,"supportsReturningQueryGeometry",!1),supportsResultType:a(s,"supportsQueryWithResultType",!1),supportsMaxRecordCountFactor:a(s,"supportsMaxRecordCountFactor",!1),supportsSqlExpression:a(s,"supportsSqlExpression",!1),supportsStandardizedQueriesOnly:a(e,"useStandardizedQueries",!1),supportsTopFeaturesQuery:a(s,"supportsTopFeaturesQuery",!1),supportsQueryByOthers:a(o,"allowOthersToQuery",!0),supportsHistoricMoment:a(n,"supportsQueryWithHistoricMoment",!1),supportsFormatPBF:y&&m.has("pbf"),supportsDisjointSpatialRelationship:a(s,"supportsDisjointSpatialRel",!1),supportsCacheHint:a(s,"supportsQueryWithCacheHint",!1)||u(s,"query"),supportsDefaultSpatialReference:a(s,"supportsDefaultSR",!1),supportsCompactGeometry:h,supportsFullTextSearch:a(s,"supportsFullTextSearch",!1),maxRecordCountFactor:p(e,"maxRecordCountFactor",void 0),maxRecordCount:p(e,"maxRecordCount",void 0),standardMaxRecordCount:p(e,"standardMaxRecordCount",void 0),tileMaxRecordCount:p(e,"tileMaxRecordCount",void 0)}}function w(e){const t=e.advancedQueryCapabilities,s=a(t,"supportsAdvancedQueryRelated",!1);return{supportsPagination:a(t,"supportsQueryRelatedPagination",!1),supportsCount:s,supportsOrderBy:s,supportsCacheHint:u(t,"queryRelated")}}function v(e){return{supportsCacheHint:u(e.advancedQueryCapabilities,"queryTopFilter")}}function S(e){const t=e.ownershipBasedAccessControlForFeatures;return{supportsGeometryUpdate:a(e,"allowGeometryUpdates",!0),supportsGlobalId:a(e,"supportsApplyEditsWithGlobalIds",!1),supportsReturnServiceEditsInSourceSpatialReference:a(e,"supportsReturnServiceEditsInSourceSR",!1),supportsRollbackOnFailure:a(e,"supportsRollbackOnFailureParameter",!1),supportsUpdateWithoutM:a(e,"allowUpdateWithoutMValues",!1),supportsUploadWithItemId:a(e,"supportsAttachmentsByUploadId",!1),supportsDeleteByAnonymous:a(t,"allowAnonymousToDelete",!0),supportsDeleteByOthers:a(t,"allowOthersToDelete",!0),supportsUpdateByAnonymous:a(t,"allowAnonymousToUpdate",!0),supportsUpdateByOthers:a(t,"allowOthersToUpdate",!0)}}},51706:(e,t,s)=>{var r,o;function i(e){return e&&"esri.renderers.visualVariables.SizeVariable"===e.declaredClass}function n(e){return null!=e&&!isNaN(e)&&isFinite(e)}function a(e){return e.valueExpression?r.Expression:e.field&&"string"==typeof e.field?r.Field:r.Unknown}function p(e,t){const s=t||a(e),i=e.valueUnit||"unknown";return s===r.Unknown?o.Constant:e.stops?o.Stops:null!=e.minSize&&null!=e.maxSize&&null!=e.minDataValue&&null!=e.maxDataValue?o.ClampedLinear:"unknown"===i?null!=e.minSize&&null!=e.minDataValue?e.minSize&&e.minDataValue?o.Proportional:o.Additive:o.Identity:o.RealWorldSize}s.d(t,{PS:()=>a,QW:()=>p,RY:()=>r,hL:()=>o,iY:()=>i,qh:()=>n}),function(e){e.Unknown="unknown",e.Expression="expression",e.Field="field"}(r||(r={})),function(e){e.Unknown="unknown",e.Stops="stops",e.ClampedLinear="clamped-linear",e.Proportional="proportional",e.Additive="additive",e.Constant="constant",e.Identity="identity",e.RealWorldSize="real-world-size"}(o||(o={}))},28694:(e,t,s)=>{s.d(t,{p:()=>i});var r=s(70586),o=s(69285);function i(e,t,s){if(!s||!s.features||!s.hasZ)return;const i=(0,o.k)(s.geometryType,t,e.outSpatialReference);if(!(0,r.Wi)(i))for(const e of s.features)i(e.geometry)}},56545:(e,t,s)=>{s.d(t,{Z:()=>c});var r,o=s(43697),i=s(96674),n=s(22974),a=s(5600),p=s(75215),l=s(52011),u=s(30556);let d=r=class extends i.wq{constructor(e){super(e),this.attachmentTypes=null,this.attachmentsWhere=null,this.cacheHint=void 0,this.keywords=null,this.globalIds=null,this.name=null,this.num=null,this.objectIds=null,this.returnMetadata=!1,this.size=null,this.start=null,this.where=null}writeStart(e,t){t.resultOffset=this.start,t.resultRecordCount=this.num||10}clone(){return new r((0,n.d9)({attachmentTypes:this.attachmentTypes,attachmentsWhere:this.attachmentsWhere,cacheHint:this.cacheHint,keywords:this.keywords,where:this.where,globalIds:this.globalIds,name:this.name,num:this.num,objectIds:this.objectIds,returnMetadata:this.returnMetadata,size:this.size,start:this.start}))}};(0,o._)([(0,a.Cb)({type:[String],json:{write:!0}})],d.prototype,"attachmentTypes",void 0),(0,o._)([(0,a.Cb)({type:String,json:{read:{source:"attachmentsDefinitionExpression"},write:{target:"attachmentsDefinitionExpression"}}})],d.prototype,"attachmentsWhere",void 0),(0,o._)([(0,a.Cb)({type:Boolean,json:{write:!0}})],d.prototype,"cacheHint",void 0),(0,o._)([(0,a.Cb)({type:[String],json:{write:!0}})],d.prototype,"keywords",void 0),(0,o._)([(0,a.Cb)({type:[Number],json:{write:!0}})],d.prototype,"globalIds",void 0),(0,o._)([(0,a.Cb)({json:{write:!0}})],d.prototype,"name",void 0),(0,o._)([(0,a.Cb)({type:Number,json:{read:{source:"resultRecordCount"}}})],d.prototype,"num",void 0),(0,o._)([(0,a.Cb)({type:[Number],json:{write:!0}})],d.prototype,"objectIds",void 0),(0,o._)([(0,a.Cb)({type:Boolean,json:{default:!1,write:!0}})],d.prototype,"returnMetadata",void 0),(0,o._)([(0,a.Cb)({type:[Number],json:{write:!0}})],d.prototype,"size",void 0),(0,o._)([(0,a.Cb)({type:Number,json:{read:{source:"resultOffset"}}})],d.prototype,"start",void 0),(0,o._)([(0,u.c)("start"),(0,u.c)("num")],d.prototype,"writeStart",null),(0,o._)([(0,a.Cb)({type:String,json:{read:{source:"definitionExpression"},write:{target:"definitionExpression"}}})],d.prototype,"where",void 0),d=r=(0,o._)([(0,l.j)("esri.rest.support.AttachmentQuery")],d),d.from=(0,p.se)(d);const c=d},74889:(e,t,s)=>{s.d(t,{Z:()=>S});var r,o=s(43697),i=s(66577),n=s(38171),a=s(35454),p=s(96674),l=s(22974),u=s(70586),d=s(5600),c=(s(75215),s(71715)),y=s(52011),h=s(30556),m=s(82971),g=s(33955),f=s(1231);const w=new a.X({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryEnvelope:"extent",mesh:"mesh","":null});let v=r=class extends p.wq{constructor(e){super(e),this.displayFieldName=null,this.exceededTransferLimit=!1,this.features=[],this.fields=null,this.geometryType=null,this.hasM=!1,this.hasZ=!1,this.queryGeometry=null,this.spatialReference=null}readFeatures(e,t){const s=m.Z.fromJSON(t.spatialReference),r=[];for(let t=0;t<e.length;t++){const o=e[t],i=n.Z.fromJSON(o),a=o.geometry&&o.geometry.spatialReference;(0,u.pC)(i.geometry)&&!a&&(i.geometry.spatialReference=s);const p=o.aggregateGeometries,l=i.aggregateGeometries;if(p&&(0,u.pC)(l))for(const e in l){const t=l[e],r=p[e]?.spatialReference;(0,u.pC)(t)&&!r&&(t.spatialReference=s)}r.push(i)}return r}writeGeometryType(e,t,s,r){if(e)return void w.write(e,t,s,r);const{features:o}=this;if(o)for(const e of o)if(e&&(0,u.pC)(e.geometry))return void w.write(e.geometry.type,t,s,r)}readQueryGeometry(e,t){if(!e)return null;const s=!!e.spatialReference,r=(0,g.im)(e);return r&&!s&&t.spatialReference&&(r.spatialReference=m.Z.fromJSON(t.spatialReference)),r}writeSpatialReference(e,t){if(e)return void(t.spatialReference=e.toJSON());const{features:s}=this;if(s)for(const e of s)if(e&&(0,u.pC)(e.geometry)&&e.geometry.spatialReference)return void(t.spatialReference=e.geometry.spatialReference.toJSON())}clone(){return new r(this.cloneProperties())}cloneProperties(){return(0,l.d9)({displayFieldName:this.displayFieldName,exceededTransferLimit:this.exceededTransferLimit,features:this.features,fields:this.fields,geometryType:this.geometryType,hasM:this.hasM,hasZ:this.hasZ,queryGeometry:this.queryGeometry,spatialReference:this.spatialReference,transform:this.transform})}toJSON(e){const t=this.write();if(t.features&&Array.isArray(e)&&e.length>0)for(let s=0;s<t.features.length;s++){const r=t.features[s];if(r.geometry){const t=e&&e[s];r.geometry=t&&t.toJSON()||r.geometry}}return t}quantize(e){const{scale:[t,s],translate:[r,o]}=e,i=this.features,n=this._getQuantizationFunction(this.geometryType,(e=>Math.round((e-r)/t)),(e=>Math.round((o-e)/s)));for(let e=0,t=i.length;e<t;e++)n?.((0,u.Wg)(i[e].geometry))||(i.splice(e,1),e--,t--);return this.transform=e,this}unquantize(){const{geometryType:e,features:t,transform:s}=this;if(!s)return this;const{translate:[r,o],scale:[i,n]}=s,a=this._getHydrationFunction(e,(e=>e*i+r),(e=>o-e*n));for(const{geometry:e}of t)(0,u.pC)(e)&&a&&a(e);return this.transform=null,this}_quantizePoints(e,t,s){let r,o;const i=[];for(let n=0,a=e.length;n<a;n++){const a=e[n];if(n>0){const e=t(a[0]),n=s(a[1]);e===r&&n===o||(i.push([e-r,n-o]),r=e,o=n)}else r=t(a[0]),o=s(a[1]),i.push([r,o])}return i.length>0?i:null}_getQuantizationFunction(e,t,s){return"point"===e?e=>(e.x=t(e.x),e.y=s(e.y),e):"polyline"===e||"polygon"===e?e=>{const r=(0,g.oU)(e)?e.rings:e.paths,o=[];for(let e=0,i=r.length;e<i;e++){const i=r[e],n=this._quantizePoints(i,t,s);n&&o.push(n)}return o.length>0?((0,g.oU)(e)?e.rings=o:e.paths=o,e):null}:"multipoint"===e?e=>{const r=this._quantizePoints(e.points,t,s);return r&&r.length>0?(e.points=r,e):null}:"extent"===e?e=>e:null}_getHydrationFunction(e,t,s){return"point"===e?e=>{e.x=t(e.x),e.y=s(e.y)}:"polyline"===e||"polygon"===e?e=>{const r=(0,g.oU)(e)?e.rings:e.paths;let o,i;for(let e=0,n=r.length;e<n;e++){const n=r[e];for(let e=0,r=n.length;e<r;e++){const r=n[e];e>0?(o+=r[0],i+=r[1]):(o=r[0],i=r[1]),r[0]=t(o),r[1]=s(i)}}}:"extent"===e?e=>{e.xmin=t(e.xmin),e.ymin=s(e.ymin),e.xmax=t(e.xmax),e.ymax=s(e.ymax)}:"multipoint"===e?e=>{const r=e.points;let o,i;for(let e=0,n=r.length;e<n;e++){const n=r[e];e>0?(o+=n[0],i+=n[1]):(o=n[0],i=n[1]),n[0]=t(o),n[1]=s(i)}}:null}};(0,o._)([(0,d.Cb)({type:String,json:{write:!0}})],v.prototype,"displayFieldName",void 0),(0,o._)([(0,d.Cb)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],v.prototype,"exceededTransferLimit",void 0),(0,o._)([(0,d.Cb)({type:[n.Z],json:{write:!0}})],v.prototype,"features",void 0),(0,o._)([(0,c.r)("features")],v.prototype,"readFeatures",null),(0,o._)([(0,d.Cb)({type:[f.Z],json:{write:!0}})],v.prototype,"fields",void 0),(0,o._)([(0,d.Cb)({type:["point","multipoint","polyline","polygon","extent","mesh"],json:{read:{reader:w.read}}})],v.prototype,"geometryType",void 0),(0,o._)([(0,h.c)("geometryType")],v.prototype,"writeGeometryType",null),(0,o._)([(0,d.Cb)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],v.prototype,"hasM",void 0),(0,o._)([(0,d.Cb)({type:Boolean,json:{write:{overridePolicy:e=>({enabled:e})}}})],v.prototype,"hasZ",void 0),(0,o._)([(0,d.Cb)({types:i.qM,json:{write:!0}})],v.prototype,"queryGeometry",void 0),(0,o._)([(0,c.r)("queryGeometry")],v.prototype,"readQueryGeometry",null),(0,o._)([(0,d.Cb)({type:m.Z,json:{write:!0}})],v.prototype,"spatialReference",void 0),(0,o._)([(0,h.c)("spatialReference")],v.prototype,"writeSpatialReference",null),(0,o._)([(0,d.Cb)({json:{write:!0}})],v.prototype,"transform",void 0),v=r=(0,o._)([(0,y.j)("esri.rest.support.FeatureSet")],v),v.prototype.toJSON.isDefaultToJSON=!0;const S=v},58333:(e,t,s)=>{s.d(t,{ET:()=>i,I4:()=>o,eG:()=>p,lF:()=>n,lj:()=>u,qP:()=>a,wW:()=>l});const r=[252,146,31,255],o={type:"esriSMS",style:"esriSMSCircle",size:6,color:r,outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[153,153,153,255]}},i={type:"esriSLS",style:"esriSLSSolid",width:.75,color:r},n={type:"esriSFS",style:"esriSFSSolid",color:[252,146,31,196],outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[255,255,255,191]}},a={type:"esriTS",color:[255,255,255,255],font:{family:"arial-unicode-ms",size:10,weight:"bold"},horizontalAlignment:"center",kerning:!0,haloColor:[0,0,0,255],haloSize:1,rotated:!1,text:"",xoffset:0,yoffset:0,angle:0},p={type:"esriSMS",style:"esriSMSCircle",color:[0,0,0,255],outline:null,size:10.5},l={type:"esriSLS",style:"esriSLSSolid",color:[0,0,0,255],width:1.5},u={type:"esriSFS",style:"esriSFSSolid",color:[0,0,0,255],outline:null}}}]);
package/config.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.26/esri/copyright.txt for details.
4
4
  */
5
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={analysisTheme:{accentColor:[255,128,0],textColor:"white"},apiKey:void 0,applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!1,portalUrl:"https://www.arcgis.com",routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="4.26.0";s.assetsPath=`https://js.arcgis.com/${e.slice(0,-2)}/@arcgis/core/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
5
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={analysisTheme:{accentColor:[255,128,0],textColor:"white"},apiKey:void 0,applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!1,portalUrl:"https://www.arcgis.com",routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="4.26.2";s.assetsPath=`https://js.arcgis.com/${e.slice(0,-2)}/@arcgis/core/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
package/core/string.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.26/esri/copyright.txt for details.
4
4
  */
5
- import{getDeepValue as t}from"./object.js";const e=/\{([^\}]+)\}/g;function r(t){return t??""}function n(n,o){return n.replace(e,"object"==typeof o?(e,n)=>r(t(n,o)):(t,e)=>r(o(e)))}function o(t,e){return t.replace(/([\.$?*|{}\(\)\[\]\\\/\+\-^])/g,(t=>e&&e.includes(t)?t:`\\${t}`))}function c(t){let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return e}function u(t){return(new DOMParser).parseFromString(t||"","text/html").body.innerText||""}export{o as escapeRegExpString,c as numericHash,n as replace,u as stripHTML};
5
+ import{getDeepValue as t}from"./object.js";const e=/\{([^\}]+)\}/g;function n(t){return t??""}function r(r,o){return r.replace(e,"object"==typeof o?(e,r)=>n(t(r,o)):(t,e)=>n(o(e)))}function o(t,e){return t.replace(/([\.$?*|{}\(\)\[\]\\\/\+\-^])/g,(t=>e&&e.includes(t)?t:`\\${t}`))}function c(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return e}function u(t){return(new DOMParser).parseFromString(t||"","text/html").body.innerText||""}function i(t,e){return new RegExp(`{${e}}`,"ig").test(t)}export{o as escapeRegExpString,c as numericHash,r as replace,u as stripHTML,i as templateHasKey};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../Graphic.js";import s from"../../../request.js";import a from"../../../TimeExtent.js";import r from"../../../core/Error.js";import has from"../../../core/has.js";import{JSONMap as o}from"../../../core/jsonMap.js";import i from"../../../core/Loadable.js";import{isSome as n,isNone as u,unwrap as l}from"../../../core/maybe.js";import{setDeepValue as d}from"../../../core/object.js";import{debounce as c}from"../../../core/promiseUtils.js";import{join as p,dataComponents as y}from"../../../core/urlUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import f from"../../../geometry/Extent.js";import{fromJSON as g}from"../../../geometry/support/jsonUtils.js";import{AssetMapEditFlags as R}from"../assetEditingSupport.js";import{createDrawingInfo as F}from"./support/clientSideDefaults.js";import b from"./support/QueryTask.js";import{isHostedAgolService as q}from"../../support/arcgisLayerUrl.js";import{unapplyEditsZUnitScaling as I}from"../../../rest/query/operations/editsZScale.js";import _ from"../../../geometry/SpatialReference.js";const w=new o({originalAndCurrentFeatures:"original-and-current-features",none:"none"});async function S(e){if("string"==typeof e){const t=y(e);return t||{data:e}}return new Promise(((t,s)=>{const a=new FileReader;a.readAsDataURL(e),a.onload=()=>t(y(a.result)),a.onerror=e=>s(e)}))}const O=new Set(["Feature Layer","Table"]),E=new o({Started:"published",Publishing:"publishing",Stopped:"unavailable"});let j=class extends i{constructor(){super(...arguments),this.type="feature-layer",this.refresh=c((async()=>{await this.load();const e=this.sourceJSON.editingInfo?.lastEditDate;if(null==e)return{dataChanged:!0,updates:{}};try{await this._fetchService(null)}catch{return{dataChanged:!0,updates:{}}}const t=e!==this.sourceJSON.editingInfo?.lastEditDate;return{dataChanged:t,updates:t?{editingInfo:this.sourceJSON.editingInfo,extent:this.sourceJSON.extent}:null}}))}load(e){const t=n(e)?e.signal:null,s=this.layer.sourceJSON;return this.addResolvingPromise(this._fetchService(s,t)),Promise.resolve(this)}get queryTask(){const{capabilities:e,parsedUrl:t,dynamicDataSource:s,infoFor3D:a,gdbVersion:r,spatialReference:o,fieldsIndex:i}=this.layer,n=has("featurelayer-pbf")&&e?.query.supportsFormatPBF&&u(a),l=e?.operations?.supportsQueryAttachments??!1;return new b({url:t.path,pbfSupported:n,fieldsIndex:i,infoFor3D:a,dynamicDataSource:s,gdbVersion:r,sourceSpatialReference:o,queryAttachmentsSupported:l})}async addAttachment(e,t){await this.load();const a=e.attributes[this.layer.objectIdField],r=this.layer.parsedUrl.path+"/"+a+"/addAttachment",o=this._getLayerRequestOptions(),i=this._getFormDataForAttachment(t,o.query);try{const e=await s(r,{body:i});return this._createFeatureEditResult(e.data.addAttachmentResult)}catch(n){throw this._createAttachmentErrorResult(a,n)}}async updateAttachment(e,t,a){await this.load();const r=e.attributes[this.layer.objectIdField],o=this.layer.parsedUrl.path+"/"+r+"/updateAttachment",i=this._getLayerRequestOptions({query:{attachmentId:t}}),n=this._getFormDataForAttachment(a,i.query);try{const e=await s(o,{body:n});return this._createFeatureEditResult(e.data.updateAttachmentResult)}catch(u){throw this._createAttachmentErrorResult(r,u)}}async applyEdits(e,t){await this.load();const a=this.layer.infoFor3D,r=n(a),o=r||(t?.globalIdUsed??!1),i=e.addFeatures?.map((e=>this._serializeFeature(e,a))).filter(n)??[],u=e.updateFeatures?.map((e=>this._serializeFeature(e,a))).filter(n)??[],d=this._getFeatureIds(e.deleteFeatures,o);I(i,u,this.layer.spatialReference);const c=[],p=[],y=[...e.deleteAttachments??[]];for(const s of e.addAttachments??[])c.push(await this._serializeAttachment(s));for(const s of e.updateAttachments??[])p.push(await this._serializeAttachment(s));const h=c.length||p.length||y.length?{adds:c,updates:p,deletes:y}:null;let m,f=null;if(r){f=new Map;const t=[];for(const a of e.addAssets??[])t.push(this._serializeAssetMapEditAndUploadAssets(a,f));const s=await Promise.all(t);m=s.length?{adds:s,updates:[],deletes:[]}:void 0}const g={gdbVersion:t?.gdbVersion||this.layer.gdbVersion,rollbackOnFailure:t?.rollbackOnFailureEnabled,useGlobalIds:o,returnEditMoment:t?.returnEditMoment,usePreviousEditMoment:t?.usePreviousEditMoment,sessionId:t?.sessionId};t?.returnServiceEditsOption?(g.edits=JSON.stringify([{id:this.layer.layerId,adds:i,updates:u,deletes:d,attachments:h,assetMaps:l(m)}]),g.returnServiceEditsOption=w.toJSON(t?.returnServiceEditsOption),g.returnServiceEditsInSourceSR=t?.returnServiceEditsInSourceSR):(g.adds=i.length?JSON.stringify(i):null,g.updates=u.length?JSON.stringify(u):null,g.deletes=d.length?o?JSON.stringify(d):d.join(","):null,g.attachments=h&&JSON.stringify(h),g.assetMaps=n(m)?JSON.stringify(m):void 0);const R=this._getLayerRequestOptions({method:"post",query:g}),F=t?.returnServiceEditsOption?this.layer.url:this.layer.parsedUrl.path,b=await s(F+"/applyEdits",R);if(r&&null!=b.data&&null!=b.data.assetMaps){const e=b.data,t=this.layer.objectIdField,a=[];for(const s of e.addResults)s.success&&a.push(s.objectId);for(const s of e.updateResults)s.success&&a.push(s.objectId);const r=this._createRequestQueryOptions(),o=await s(F+"/query",{...r,query:{f:"json",formatOf3DObjects:"3D_glb",where:`OBJECTID IN (${a.join(",")})`,outFields:`${t}`}});if(o&&o.data&&o.data.assetMaps&&n(f)){const e=o.data.assetMaps;for(const t of e){const e=f.get(t.parentGlobalId).geometry;n(e)&&"mesh"===e.type&&e.updateExternalSource({source:[{name:t.assetName,source:t.assetName}],extent:e.extent})}}}return this._createEditsResult(b)}async deleteAttachments(e,t){await this.load();const a=e.attributes[this.layer.objectIdField],r=this.layer.parsedUrl.path+"/"+a+"/deleteAttachments";try{return(await s(r,this._getLayerRequestOptions({query:{attachmentIds:t.join(",")},method:"post"}))).data.deleteAttachmentResults.map(this._createFeatureEditResult)}catch(o){throw this._createAttachmentErrorResult(a,o)}}fetchRecomputedExtents(e={}){const t=e.signal;return this.load({signal:t}).then((async()=>{const t=this._getLayerRequestOptions({...e,query:{returnUpdates:!0}}),{layerId:r,url:o}=this.layer,{data:i}=await s(`${o}/${r}`,t),{id:n,extent:u,fullExtent:l,timeExtent:d}=i,c=u||l;return{id:n,fullExtent:c&&f.fromJSON(c),timeExtent:d&&a.fromJSON({start:d[0],end:d[1]})}}))}async queryAttachments(e,t={}){await this.load();const s=this._getLayerRequestOptions(t);return this.queryTask.executeAttachmentQuery(e,s)}async queryFeatures(e,t){return await this.load(),this.queryTask.execute(e,{...t,query:this._createRequestQueryOptions(t)})}async queryFeaturesJSON(e,t){return await this.load(),this.queryTask.executeJSON(e,{...t,query:this._createRequestQueryOptions(t)})}async queryObjectIds(e,t){return await this.load(),this.queryTask.executeForIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryFeatureCount(e,t){return await this.load(),this.queryTask.executeForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryExtent(e,t){return await this.load(),this.queryTask.executeForExtent(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeatures(e,t){return await this.load(),this.queryTask.executeRelationshipQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeaturesCount(e,t){return await this.load(),this.queryTask.executeRelationshipQueryForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopFeatures(e,t){return await this.load(),this.queryTask.executeTopFeaturesQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopObjectIds(e,t){return await this.load(),this.queryTask.executeForTopIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopExtents(e,t){return await this.load(),this.queryTask.executeForTopExtents(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopCount(e,t){return await this.load(),this.queryTask.executeForTopCount(e,{...t,query:this._createRequestQueryOptions(t)})}async fetchPublishingStatus(){if(!q(this.layer.url))return"unavailable";const e=p(this.layer.url,"status"),t=await s(e,{query:{f:"json"}});return E.fromJSON(t.data.status)}_createRequestQueryOptions(e){const t={...this.layer.customParameters,token:this.layer.apiKey,...e?.query};return this.layer.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t}async _fetchService(e,t){if(!e){const{data:a}=await s(this.layer.parsedUrl.path,this._getLayerRequestOptions({query:has("featurelayer-advanced-symbols")?{returnAdvancedSymbols:!0}:{},signal:t}));e=a}this.sourceJSON=this._patchServiceJSON(e);const a=e.type;if(!O.has(a))throw new r("feature-layer-source:unsupported-type",`Source type "${a}" is not supported`)}_patchServiceJSON(e){if("Table"!==e.type&&e.geometryType&&!e?.drawingInfo?.renderer&&!e.defaultSymbol){const t=F(e.geometryType).renderer;d("drawingInfo.renderer",t,e)}return"esriGeometryMultiPatch"===e.geometryType&&e.infoFor3D&&(e.geometryType="mesh"),e}_serializeFeature(e,t){const{geometry:s,attributes:a}=e;if(n(t)&&n(e.geometry)&&"mesh"===e.geometry.type){const s={...a},r=e.geometry,o=r.origin,i=r.transform;if(s[t.transformFieldRoles.originX]=o.x,s[t.transformFieldRoles.originY]=o.y,s[t.transformFieldRoles.originZ]=o.z,n(i)){const e=i.translation,a=i.scale,r=i.rotation;s[t.transformFieldRoles.translationX]=e[0],s[t.transformFieldRoles.translationY]=-e[2],s[t.transformFieldRoles.translationZ]=e[1],s[t.transformFieldRoles.scaleX]=a[0],s[t.transformFieldRoles.scaleY]=a[1],s[t.transformFieldRoles.scaleZ]=a[2],s[t.transformFieldRoles.rotationX]=r[0],s[t.transformFieldRoles.rotationY]=r[2],s[t.transformFieldRoles.rotationZ]=r[1],s[t.transformFieldRoles.rotationDeg]=r[3]}return{geometry:null,attributes:s}}return u(s)?{attributes:a}:"mesh"===s.type||"extent"===s.type?null:{geometry:s.toJSON(),attributes:a}}async _serializeAttachment(e){const{feature:t,attachment:s}=e,{globalId:a,name:r,contentType:o,data:i,uploadId:n}=s,u={globalId:a,parentGlobalId:null,contentType:null,name:null,uploadId:null,data:null};if(t&&(u.parentGlobalId="attributes"in t?t.attributes&&t.attributes[this.layer.globalIdField]:t.globalId),n)u.uploadId=n;else if(i){const e=await S(i);e&&(u.contentType=e.mediaType,u.data=e.data),i instanceof File&&(u.name=i.name)}return r&&(u.name=r),o&&(u.contentType=o),u}async _serializeAssetMapEditAndUploadAssets(e,t){const a=this.layer.url;let o=null;try{const t=new Blob([e.data],{type:e.mimeType}),i=new FormData;i.append("f","json"),i.append("file",t,`${e.assetName}`);const n={body:i,method:"post",responseType:"json"},{data:u}=await s(`${a}/uploads/upload`,n);if(!u.success)throw new r("feature-layer-source:upload-failure","Expected upload to be successfull.");o={assetType:e.assetType,assetUploadId:u.item.itemID}}catch(y){o=null}if(u(o)){const t=await S(new Blob([e.data]));if(!t.isBase64)throw new r("feature-layer-source:uploadAssets-failure","Expected gltf data in base64 format after conversion.");o={assetType:e.assetType,assetData:t.data}}if(u(o))throw new r("feature-layer-source:uploadAssets-failure","Unable to prepare uploadAsset request options.");const i={method:"post",query:{f:"json",assets:JSON.stringify([o])},responseType:"json"},n=await s(p(this.layer.parsedUrl.path,"uploadAssets"),i);if(1!==n.data.uploadResults.length||!n.data.uploadResults[0].success)throw new r("feature-layer-source:uploadAssets-failure","Bad response.");const l=n.data.uploadResults[0].assetHash,d=[];e.flags&R.PROJECT_VERTICES&&d.push("PROJECT_VERTICES");const c={globalId:e.assetMapGlobalId,parentGlobalId:e.featureGlobalId,assetName:e.assetName,assetHash:l,flags:d};return t.set(e.featureGlobalId,e.feature),c}_getFeatureIds(e,t){const s=e?.[0];return s?this._canUseGlobalIds(t,e)?this._getGlobalIdsFromFeatureIdentifier(e):"objectId"in s?this._getObjectIdsFromFeatureIdentifier(e):this._getIdsFromFeatures(e):[]}_getIdsFromFeatures(e){const t=this.layer.objectIdField;return e.map((e=>e.attributes&&e.attributes[t]))}_canUseGlobalIds(e,t){return e&&"globalId"in t[0]}_getObjectIdsFromFeatureIdentifier(e){return e.map((e=>e.objectId))}_getGlobalIdsFromFeatureIdentifier(e){return e.map((e=>e.globalId))}_createEditsResult(e){const t=e.data,{layerId:s}=this.layer,a=[];let r=null;if(Array.isArray(t))for(const n of t)a.push({id:n.id,editedFeatures:n.editedFeatures}),n.id===s&&(r={addResults:n.addResults??[],updateResults:n.updateResults??[],deleteResults:n.deleteResults??[],attachments:n.attachments,editMoment:n.editMoment});else r=t;const o=r?.attachments,i={addFeatureResults:r?.addResults?.map(this._createFeatureEditResult,this)??[],updateFeatureResults:r?.updateResults?.map(this._createFeatureEditResult,this)??[],deleteFeatureResults:r?.deleteResults?.map(this._createFeatureEditResult,this)??[],addAttachmentResults:o&&o.addResults?o.addResults.map(this._createFeatureEditResult,this):[],updateAttachmentResults:o&&o.updateResults?o.updateResults.map(this._createFeatureEditResult,this):[],deleteAttachmentResults:o&&o.deleteResults?o.deleteResults.map(this._createFeatureEditResult,this):[]};if(r?.editMoment&&(i.editMoment=r.editMoment),a.length>0){i.editedFeatureResults=[];for(const e of a){const{adds:t,updates:s,deletes:a,spatialReference:r}=e.editedFeatures,o=r?new _(r):null;i.editedFeatureResults.push({layerId:e.id,editedFeatures:{adds:t?.map((e=>this._createEditedFeature(e,o)))||[],updates:s?.map((e=>({original:this._createEditedFeature(e[0],o),current:this._createEditedFeature(e[1],o)})))||[],deletes:a?.map((e=>this._createEditedFeature(e,o)))||[],spatialReference:o}})}}return i}_createEditedFeature(e,s){return new t({attributes:e.attributes,geometry:g({...e.geometry,spatialReference:s})})}_createFeatureEditResult(e){const t=!0===e.success?null:e.error||{code:void 0,description:void 0};return{objectId:e.objectId,globalId:e.globalId,error:t?new r("feature-layer-source:edit-failure",t.description,{code:t.code}):null}}_createAttachmentErrorResult(e,t){const s=t.details.messages&&t.details.messages[0]||t.message,a=t.details.httpStatus||t.details.messageCode;return{objectId:e,globalId:null,error:new r("feature-layer-source:attachment-failure",s,{code:a})}}_getFormDataForAttachment(e,t){const s=e instanceof FormData?e:e&&e.elements?new FormData(e):null;if(s)for(const a in t){const e=t[a];null!=e&&(s.set?s.set(a,e):s.append(a,e))}return s}_getLayerRequestOptions(e={}){const{parsedUrl:t,gdbVersion:s,dynamicDataSource:a}=this.layer;return{...e,query:{gdbVersion:s,layer:a?JSON.stringify({source:a}):void 0,...t.query,f:"json",...this._createRequestQueryOptions(e)},responseType:"json"}}};e([h()],j.prototype,"type",void 0),e([h({constructOnly:!0})],j.prototype,"layer",void 0),e([h({readOnly:!0})],j.prototype,"queryTask",null),j=e([m("esri.layers.graphics.sources.FeatureLayerSource")],j);const T=j;export{T as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../Graphic.js";import{id as s}from"../../../kernel.js";import a from"../../../request.js";import r from"../../../TimeExtent.js";import o from"../../../core/Error.js";import has from"../../../core/has.js";import{JSONMap as i}from"../../../core/jsonMap.js";import n from"../../../core/Loadable.js";import{isSome as u,isNone as l,unwrap as d}from"../../../core/maybe.js";import{setDeepValue as c}from"../../../core/object.js";import{debounce as p}from"../../../core/promiseUtils.js";import{join as h,dataComponents as y}from"../../../core/urlUtils.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import g from"../../../geometry/Extent.js";import{fromJSON as R}from"../../../geometry/support/jsonUtils.js";import{AssetMapEditFlags as F}from"../assetEditingSupport.js";import{createDrawingInfo as b}from"./support/clientSideDefaults.js";import q from"./support/QueryTask.js";import{isHostedAgolService as I}from"../../support/arcgisLayerUrl.js";import{unapplyEditsZUnitScaling as _}from"../../../rest/query/operations/editsZScale.js";import w from"../../../geometry/SpatialReference.js";const E=new i({originalAndCurrentFeatures:"original-and-current-features",none:"none"});async function S(e){if("string"==typeof e){const t=y(e);return t||{data:e}}return new Promise(((t,s)=>{const a=new FileReader;a.readAsDataURL(e),a.onload=()=>t(y(a.result)),a.onerror=e=>s(e)}))}const O=new Set(["Feature Layer","Table"]),j=new i({Started:"published",Publishing:"publishing",Stopped:"unavailable"});let T=class extends n{constructor(){super(...arguments),this.type="feature-layer",this.refresh=p((async()=>{await this.load();const e=this.sourceJSON.editingInfo?.lastEditDate;if(null==e)return{dataChanged:!0,updates:{}};try{await this._fetchService(null)}catch{return{dataChanged:!0,updates:{}}}const t=e!==this.sourceJSON.editingInfo?.lastEditDate;return{dataChanged:t,updates:t?{editingInfo:this.sourceJSON.editingInfo,extent:this.sourceJSON.extent}:null}}))}load(e){const t=u(e)?e.signal:null,s=this.layer.sourceJSON;return this.addResolvingPromise(this._fetchService(s,t)),Promise.resolve(this)}get queryTask(){const{capabilities:e,parsedUrl:t,dynamicDataSource:s,infoFor3D:a,gdbVersion:r,spatialReference:o,fieldsIndex:i}=this.layer,n=has("featurelayer-pbf")&&e?.query.supportsFormatPBF&&l(a),u=e?.operations?.supportsQueryAttachments??!1;return new q({url:t.path,pbfSupported:n,fieldsIndex:i,infoFor3D:a,dynamicDataSource:s,gdbVersion:r,sourceSpatialReference:o,queryAttachmentsSupported:u})}async addAttachment(e,t){await this.load();const s=e.attributes[this.layer.objectIdField],r=this.layer.parsedUrl.path+"/"+s+"/addAttachment",o=this._getLayerRequestOptions(),i=this._getFormDataForAttachment(t,o.query);try{const e=await a(r,{body:i});return this._createFeatureEditResult(e.data.addAttachmentResult)}catch(n){throw this._createAttachmentErrorResult(s,n)}}async updateAttachment(e,t,s){await this.load();const r=e.attributes[this.layer.objectIdField],o=this.layer.parsedUrl.path+"/"+r+"/updateAttachment",i=this._getLayerRequestOptions({query:{attachmentId:t}}),n=this._getFormDataForAttachment(s,i.query);try{const e=await a(o,{body:n});return this._createFeatureEditResult(e.data.updateAttachmentResult)}catch(u){throw this._createAttachmentErrorResult(r,u)}}async applyEdits(e,t){await this.load();const r=this.layer.infoFor3D,o=u(r),i=o||(t?.globalIdUsed??!1),n=e.addFeatures?.map((e=>this._serializeFeature(e,r))).filter(u)??[],l=e.updateFeatures?.map((e=>this._serializeFeature(e,r))).filter(u)??[],c=this._getFeatureIds(e.deleteFeatures,i);_(n,l,this.layer.spatialReference);const p=[],h=[],y=[...e.deleteAttachments??[]];for(const s of e.addAttachments??[])p.push(await this._serializeAttachment(s));for(const s of e.updateAttachments??[])h.push(await this._serializeAttachment(s));const m=p.length||h.length||y.length?{adds:p,updates:h,deletes:y}:null;let f,g=null;if(o){g=new Map;const t=[];for(const a of e.addAssets??[])t.push(this._serializeAssetMapEditAndUploadAssets(a,g));const s=await Promise.all(t);f=s.length?{adds:s,updates:[],deletes:[]}:void 0}const R={gdbVersion:t?.gdbVersion||this.layer.gdbVersion,rollbackOnFailure:t?.rollbackOnFailureEnabled,useGlobalIds:i,returnEditMoment:t?.returnEditMoment,usePreviousEditMoment:t?.usePreviousEditMoment,sessionId:t?.sessionId};t?.returnServiceEditsOption?(R.edits=JSON.stringify([{id:this.layer.layerId,adds:n,updates:l,deletes:c,attachments:m,assetMaps:d(f)}]),R.returnServiceEditsOption=E.toJSON(t?.returnServiceEditsOption),R.returnServiceEditsInSourceSR=t?.returnServiceEditsInSourceSR):(R.adds=n.length?JSON.stringify(n):null,R.updates=l.length?JSON.stringify(l):null,R.deletes=c.length?i?JSON.stringify(c):c.join(","):null,R.attachments=m&&JSON.stringify(m),R.assetMaps=u(f)?JSON.stringify(f):void 0);const F=this._getLayerRequestOptions({method:"post",query:R}),b=t?.returnServiceEditsOption?this.layer.url:this.layer.parsedUrl.path,q=await a(b+"/applyEdits",F);if(!this.layer.capabilities.operations?.supportsEditing&&this.layer.effectiveCapabilities?.operations?.supportsEditing){const e=s?.findCredential(this.layer.url);await(e?.refreshToken())}if(o&&null!=q.data&&null!=q.data.assetMaps){const e=q.data,t=this.layer.objectIdField,s=[];for(const a of e.addResults)a.success&&s.push(a.objectId);for(const a of e.updateResults)a.success&&s.push(a.objectId);const r=this._createRequestQueryOptions(),o=await a(b+"/query",{...r,query:{f:"json",formatOf3DObjects:"3D_glb",where:`OBJECTID IN (${s.join(",")})`,outFields:`${t}`}});if(o&&o.data&&o.data.assetMaps&&u(g)){const e=o.data.assetMaps;for(const t of e){const e=g.get(t.parentGlobalId).geometry;u(e)&&"mesh"===e.type&&e.updateExternalSource({source:[{name:t.assetName,source:t.assetName}],extent:e.extent})}}}return this._createEditsResult(q)}async deleteAttachments(e,t){await this.load();const s=e.attributes[this.layer.objectIdField],r=this.layer.parsedUrl.path+"/"+s+"/deleteAttachments";try{return(await a(r,this._getLayerRequestOptions({query:{attachmentIds:t.join(",")},method:"post"}))).data.deleteAttachmentResults.map(this._createFeatureEditResult)}catch(o){throw this._createAttachmentErrorResult(s,o)}}fetchRecomputedExtents(e={}){const t=e.signal;return this.load({signal:t}).then((async()=>{const t=this._getLayerRequestOptions({...e,query:{returnUpdates:!0}}),{layerId:s,url:o}=this.layer,{data:i}=await a(`${o}/${s}`,t),{id:n,extent:u,fullExtent:l,timeExtent:d}=i,c=u||l;return{id:n,fullExtent:c&&g.fromJSON(c),timeExtent:d&&r.fromJSON({start:d[0],end:d[1]})}}))}async queryAttachments(e,t={}){await this.load();const s=this._getLayerRequestOptions(t);return this.queryTask.executeAttachmentQuery(e,s)}async queryFeatures(e,t){return await this.load(),this.queryTask.execute(e,{...t,query:this._createRequestQueryOptions(t)})}async queryFeaturesJSON(e,t){return await this.load(),this.queryTask.executeJSON(e,{...t,query:this._createRequestQueryOptions(t)})}async queryObjectIds(e,t){return await this.load(),this.queryTask.executeForIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryFeatureCount(e,t){return await this.load(),this.queryTask.executeForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryExtent(e,t){return await this.load(),this.queryTask.executeForExtent(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeatures(e,t){return await this.load(),this.queryTask.executeRelationshipQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryRelatedFeaturesCount(e,t){return await this.load(),this.queryTask.executeRelationshipQueryForCount(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopFeatures(e,t){return await this.load(),this.queryTask.executeTopFeaturesQuery(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopObjectIds(e,t){return await this.load(),this.queryTask.executeForTopIds(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopExtents(e,t){return await this.load(),this.queryTask.executeForTopExtents(e,{...t,query:this._createRequestQueryOptions(t)})}async queryTopCount(e,t){return await this.load(),this.queryTask.executeForTopCount(e,{...t,query:this._createRequestQueryOptions(t)})}async fetchPublishingStatus(){if(!I(this.layer.url))return"unavailable";const e=h(this.layer.url,"status"),t=await a(e,{query:{f:"json"}});return j.fromJSON(t.data.status)}_createRequestQueryOptions(e){const t={...this.layer.customParameters,token:this.layer.apiKey,...e?.query};return this.layer.datesInUnknownTimezone&&(t.timeReferenceUnknownClient=!0),t}async _fetchService(e,t){if(!e){const{data:s}=await a(this.layer.parsedUrl.path,this._getLayerRequestOptions({query:has("featurelayer-advanced-symbols")?{returnAdvancedSymbols:!0}:{},signal:t}));e=s}this.sourceJSON=this._patchServiceJSON(e);const s=e.type;if(!O.has(s))throw new o("feature-layer-source:unsupported-type",`Source type "${s}" is not supported`)}_patchServiceJSON(e){if("Table"!==e.type&&e.geometryType&&!e?.drawingInfo?.renderer&&!e.defaultSymbol){const t=b(e.geometryType).renderer;c("drawingInfo.renderer",t,e)}return"esriGeometryMultiPatch"===e.geometryType&&e.infoFor3D&&(e.geometryType="mesh"),e}_serializeFeature(e,t){const{geometry:s,attributes:a}=e;if(u(t)&&u(e.geometry)&&"mesh"===e.geometry.type){const s={...a},r=e.geometry,o=r.origin,i=r.transform;if(s[t.transformFieldRoles.originX]=o.x,s[t.transformFieldRoles.originY]=o.y,s[t.transformFieldRoles.originZ]=o.z,u(i)){const e=i.translation,a=i.scale,r=i.rotation;s[t.transformFieldRoles.translationX]=e[0],s[t.transformFieldRoles.translationY]=-e[2],s[t.transformFieldRoles.translationZ]=e[1],s[t.transformFieldRoles.scaleX]=a[0],s[t.transformFieldRoles.scaleY]=a[1],s[t.transformFieldRoles.scaleZ]=a[2],s[t.transformFieldRoles.rotationX]=r[0],s[t.transformFieldRoles.rotationY]=r[2],s[t.transformFieldRoles.rotationZ]=r[1],s[t.transformFieldRoles.rotationDeg]=r[3]}return{geometry:null,attributes:s}}return l(s)?{attributes:a}:"mesh"===s.type||"extent"===s.type?null:{geometry:s.toJSON(),attributes:a}}async _serializeAttachment(e){const{feature:t,attachment:s}=e,{globalId:a,name:r,contentType:o,data:i,uploadId:n}=s,u={globalId:a,parentGlobalId:null,contentType:null,name:null,uploadId:null,data:null};if(t&&(u.parentGlobalId="attributes"in t?t.attributes&&t.attributes[this.layer.globalIdField]:t.globalId),n)u.uploadId=n;else if(i){const e=await S(i);e&&(u.contentType=e.mediaType,u.data=e.data),i instanceof File&&(u.name=i.name)}return r&&(u.name=r),o&&(u.contentType=o),u}async _serializeAssetMapEditAndUploadAssets(e,t){const s=this.layer.url;let r=null;try{const t=new Blob([e.data],{type:e.mimeType}),i=new FormData;i.append("f","json"),i.append("file",t,`${e.assetName}`);const n={body:i,method:"post",responseType:"json"},{data:u}=await a(`${s}/uploads/upload`,n);if(!u.success)throw new o("feature-layer-source:upload-failure","Expected upload to be successfull.");r={assetType:e.assetType,assetUploadId:u.item.itemID}}catch(p){r=null}if(l(r)){const t=await S(new Blob([e.data]));if(!t.isBase64)throw new o("feature-layer-source:uploadAssets-failure","Expected gltf data in base64 format after conversion.");r={assetType:e.assetType,assetData:t.data}}if(l(r))throw new o("feature-layer-source:uploadAssets-failure","Unable to prepare uploadAsset request options.");const i={method:"post",query:{f:"json",assets:JSON.stringify([r])},responseType:"json"},n=await a(h(this.layer.parsedUrl.path,"uploadAssets"),i);if(1!==n.data.uploadResults.length||!n.data.uploadResults[0].success)throw new o("feature-layer-source:uploadAssets-failure","Bad response.");const u=n.data.uploadResults[0].assetHash,d=[];e.flags&F.PROJECT_VERTICES&&d.push("PROJECT_VERTICES");const c={globalId:e.assetMapGlobalId,parentGlobalId:e.featureGlobalId,assetName:e.assetName,assetHash:u,flags:d};return t.set(e.featureGlobalId,e.feature),c}_getFeatureIds(e,t){const s=e?.[0];return s?this._canUseGlobalIds(t,e)?this._getGlobalIdsFromFeatureIdentifier(e):"objectId"in s?this._getObjectIdsFromFeatureIdentifier(e):this._getIdsFromFeatures(e):[]}_getIdsFromFeatures(e){const t=this.layer.objectIdField;return e.map((e=>e.attributes&&e.attributes[t]))}_canUseGlobalIds(e,t){return e&&"globalId"in t[0]}_getObjectIdsFromFeatureIdentifier(e){return e.map((e=>e.objectId))}_getGlobalIdsFromFeatureIdentifier(e){return e.map((e=>e.globalId))}_createEditsResult(e){const t=e.data,{layerId:s}=this.layer,a=[];let r=null;if(Array.isArray(t))for(const n of t)a.push({id:n.id,editedFeatures:n.editedFeatures}),n.id===s&&(r={addResults:n.addResults??[],updateResults:n.updateResults??[],deleteResults:n.deleteResults??[],attachments:n.attachments,editMoment:n.editMoment});else r=t;const o=r?.attachments,i={addFeatureResults:r?.addResults?.map(this._createFeatureEditResult,this)??[],updateFeatureResults:r?.updateResults?.map(this._createFeatureEditResult,this)??[],deleteFeatureResults:r?.deleteResults?.map(this._createFeatureEditResult,this)??[],addAttachmentResults:o&&o.addResults?o.addResults.map(this._createFeatureEditResult,this):[],updateAttachmentResults:o&&o.updateResults?o.updateResults.map(this._createFeatureEditResult,this):[],deleteAttachmentResults:o&&o.deleteResults?o.deleteResults.map(this._createFeatureEditResult,this):[]};if(r?.editMoment&&(i.editMoment=r.editMoment),a.length>0){i.editedFeatureResults=[];for(const e of a){const{adds:t,updates:s,deletes:a,spatialReference:r}=e.editedFeatures,o=r?new w(r):null;i.editedFeatureResults.push({layerId:e.id,editedFeatures:{adds:t?.map((e=>this._createEditedFeature(e,o)))||[],updates:s?.map((e=>({original:this._createEditedFeature(e[0],o),current:this._createEditedFeature(e[1],o)})))||[],deletes:a?.map((e=>this._createEditedFeature(e,o)))||[],spatialReference:o}})}}return i}_createEditedFeature(e,s){return new t({attributes:e.attributes,geometry:R({...e.geometry,spatialReference:s})})}_createFeatureEditResult(e){const t=!0===e.success?null:e.error||{code:void 0,description:void 0};return{objectId:e.objectId,globalId:e.globalId,error:t?new o("feature-layer-source:edit-failure",t.description,{code:t.code}):null}}_createAttachmentErrorResult(e,t){const s=t.details.messages&&t.details.messages[0]||t.message,a=t.details.httpStatus||t.details.messageCode;return{objectId:e,globalId:null,error:new o("feature-layer-source:attachment-failure",s,{code:a})}}_getFormDataForAttachment(e,t){const s=e instanceof FormData?e:e&&e.elements?new FormData(e):null;if(s)for(const a in t){const e=t[a];null!=e&&(s.set?s.set(a,e):s.append(a,e))}return s}_getLayerRequestOptions(e={}){const{parsedUrl:t,gdbVersion:s,dynamicDataSource:a}=this.layer;return{...e,query:{gdbVersion:s,layer:a?JSON.stringify({source:a}):void 0,...t.query,f:"json",...this._createRequestQueryOptions(e)},responseType:"json"}}};e([m()],T.prototype,"type",void 0),e([m({constructOnly:!0})],T.prototype,"layer",void 0),e([m({readOnly:!0})],T.prototype,"queryTask",null),T=e([f("esri.layers.graphics.sources.FeatureLayerSource")],T);const A=T;export{A 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.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Error.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{clone as i}from"../../core/lang.js";import r from"../../core/Logger.js";import{isSome as l,isNone as o}from"../../core/maybe.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{cast as h}from"../../core/accessorSupport/decorators/cast.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{SimpleBandStatistics as p}from"./SimpleBandStatistics.js";import{getPixelValueRange as c}from"./rasterFormats/pixelRangeUtils.js";var u;let g=u=class extends s{static createEmptyBand(t,e){return new(u.getPixelArrayConstructor(t))(e)}static getPixelArrayConstructor(t){let e;switch(t){case"u1":case"u2":case"u4":case"u8":e=Uint8Array;break;case"u16":e=Uint16Array;break;case"u32":e=Uint32Array;break;case"s8":e=Int8Array;break;case"s16":e=Int16Array;break;case"s32":e=Int32Array;break;case"f32":case"c64":case"c128":case"unknown":e=Float32Array;break;case"f64":e=Float64Array}return e}constructor(t){super(t),this.width=null,this.height=null,this.pixelType="f32",this.validPixelCount=null,this.mask=null,this.maskIsAlpha=!1,this.statistics=null,this.depthCount=1}castPixelType(t){if(!t)return"f32";let e=t.toLowerCase();return["u1","u2","u4"].includes(e)?e="u8":["unknown","u8","s8","u16","s16","u32","s32","f32","f64"].includes(e)||(e="f32"),e}getPlaneCount(){return this.pixels?.length}addData(t){if(!t.pixels||t.pixels.length!==this.width*this.height)throw new e("pixelblock:invalid-or-missing-pixels","add data requires valid pixels array that has same length defined by pixel block width * height");this.pixels||(this.pixels=[]),this.statistics||(this.statistics=[]),this.pixels.push(t.pixels),this.statistics.push(t.statistics??new p)}getAsRGBA(){const t=new ArrayBuffer(this.width*this.height*4);switch(this.pixelType){case"s8":case"s16":case"u16":case"s32":case"u32":case"f32":case"f64":this._fillFromNon8Bit(t);break;default:this._fillFrom8Bit(t)}return new Uint8ClampedArray(t)}getAsRGBAFloat(){const t=new Float32Array(this.width*this.height*4);return this._fillFrom32Bit(t),t}updateStatistics(){if(!this.pixels)return;this.statistics=this.pixels.map((t=>this._calculateBandStatistics(t,this.mask)));const t=this.mask;let e=0;if(l(t))for(let s=0;s<t.length;s++)t[s]&&e++;else e=this.width*this.height;this.validPixelCount=e}clamp(t){if(!t||"f64"===t||"f32"===t||!this.pixels)return;const[e,s]=c(t),i=this.pixels,r=this.width*this.height,l=i.length;let o,a,h;const n=[];for(let p=0;p<l;p++){h=u.createEmptyBand(t,r),o=i[p];for(let t=0;t<r;t++)a=o[t],h[t]=a>s?s:a<e?e:a;n.push(h)}this.pixels=n,this.pixelType=t}extractBands(t){const{pixels:e,statistics:s}=this;if(o(t)||0===t.length||!e||0===e.length)return this;const i=e.length,r=t.some((t=>t>=e.length)),l=i===t.length&&!t.some(((t,e)=>t!==e));return r||l?this:new u({pixelType:this.pixelType,width:this.width,height:this.height,mask:this.mask,validPixelCount:this.validPixelCount,maskIsAlpha:this.maskIsAlpha,pixels:t.map((t=>e[t])),statistics:s&&t.map((t=>s[t]))})}clone(){const t=new u({width:this.width,height:this.height,pixelType:this.pixelType,maskIsAlpha:this.maskIsAlpha,validPixelCount:this.validPixelCount});let e;l(this.mask)&&(this.mask instanceof Uint8Array?t.mask=new Uint8Array(this.mask):t.mask=this.mask.slice(0));const s=u.getPixelArrayConstructor(this.pixelType);if(this.pixels&&this.pixels.length>0){t.pixels=[];const i=!!this.pixels[0].slice;for(e=0;e<this.pixels.length;e++)t.pixels[e]=i?this.pixels[e].slice(0,this.pixels[e].length):new s(this.pixels[e])}if(this.statistics)for(t.statistics=[],e=0;e<this.statistics.length;e++)t.statistics[e]=i(this.statistics[e]);return t}_fillFrom8Bit(t){const{mask:e,maskIsAlpha:s,pixels:i}=this;if(!t||!i||!i.length)return void r.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The input pixel block is empty.");let o,a,h,n;o=a=h=i[0],i.length>=3?(a=i[1],h=i[2]):2===i.length&&(a=i[1]);const p=new Uint32Array(t),c=this.width*this.height;if(o.length===c)if(l(e)&&e.length===c)if(s)for(n=0;n<c;n++){const t=e[n];if(t){const e=t/255;p[n]=t<<24|h[n]*e<<16|a[n]*e<<8|o[n]*e}}else for(n=0;n<c;n++)e[n]&&(p[n]=255<<24|h[n]<<16|a[n]<<8|o[n]);else for(n=0;n<c;n++)p[n]=255<<24|h[n]<<16|a[n]<<8|o[n];else r.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The pixelblock is invalid.")}_fillFromNon8Bit(t){const{pixels:e,mask:s,statistics:i}=this;if(!t||!e||!e.length)return void r.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The input pixel block is empty.");const o=this.pixelType;let a=1,h=0,n=1;if(i&&i.length>0){for(const t of i)if(null!=t.minValue&&(h=Math.min(h,t.minValue)),null!=t.maxValue&&null!=t.minValue){const e=t.maxValue-t.minValue;n=Math.max(n,e)}a=255/n}else{let t=255;"s8"===o?(h=-128,t=127):"u16"===o?t=65535:"s16"===o?(h=-32768,t=32767):"u32"===o?t=4294967295:"s32"===o?(h=-2147483648,t=2147483647):"f32"===o?(h=-34e38,t=34e38):"f64"===o&&(h=-Number.MAX_VALUE,t=Number.MAX_VALUE),a=255/(t-h)}const p=new Uint32Array(t),c=this.width*this.height;let u,g,d,f,m;if(u=g=d=e[0],u.length!==c)return r.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The pixelblock is invalid.");if(e.length>=2)if(g=e[1],e.length>=3&&(d=e[2]),l(s)&&s.length===c)for(f=0;f<c;f++)s[f]&&(p[f]=255<<24|(d[f]-h)*a<<16|(g[f]-h)*a<<8|(u[f]-h)*a);else for(f=0;f<c;f++)p[f]=255<<24|(d[f]-h)*a<<16|(g[f]-h)*a<<8|(u[f]-h)*a;else if(l(s)&&s.length===c)for(f=0;f<c;f++)m=(u[f]-h)*a,s[f]&&(p[f]=255<<24|m<<16|m<<8|m);else for(f=0;f<c;f++)m=(u[f]-h)*a,p[f]=255<<24|m<<16|m<<8|m}_fillFrom32Bit(t){const{pixels:e,mask:s}=this;if(!t||!e||!e.length)return r.getLogger(this.declaredClass).error("getAsRGBAFloat()","Unable to convert to RGBA. The input pixel block is empty.");let i,o,a,h;i=o=a=e[0],e.length>=3?(o=e[1],a=e[2]):2===e.length&&(o=e[1]);const n=this.width*this.height;if(i.length!==n)return r.getLogger(this.declaredClass).error("getAsRGBAFloat()","Unable to convert to RGBA. The pixelblock is invalid.");let p=0;if(l(s)&&s.length===n)for(h=0;h<n;h++)t[p++]=i[h],t[p++]=o[h],t[p++]=a[h],t[p++]=1&s[h];else for(h=0;h<n;h++)t[p++]=i[h],t[p++]=o[h],t[p++]=a[h],t[p++]=1}_calculateBandStatistics(t,e){let s=1/0,i=-1/0;const r=t.length;let o,a=0;if(l(e))for(o=0;o<r;o++)e[o]&&(a=t[o],s=a<s?a:s,i=a>i?a:i);else for(o=0;o<r;o++)a=t[o],s=a<s?a:s,i=a>i?a:i;return new p(s,i)}};t([a({json:{write:!0}})],g.prototype,"width",void 0),t([a({json:{write:!0}})],g.prototype,"height",void 0),t([a({json:{write:!0}})],g.prototype,"pixelType",void 0),t([h("pixelType")],g.prototype,"castPixelType",null),t([a({json:{write:!0}})],g.prototype,"validPixelCount",void 0),t([a({json:{write:!0}})],g.prototype,"mask",void 0),t([a({json:{write:!0}})],g.prototype,"maskIsAlpha",void 0),t([a({json:{write:!0}})],g.prototype,"pixels",void 0),t([a({json:{write:!0}})],g.prototype,"statistics",void 0),t([a({json:{write:!0}})],g.prototype,"depthCount",void 0),t([a({json:{write:!0}})],g.prototype,"noDataValues",void 0),t([a({json:{write:!0}})],g.prototype,"bandMasks",void 0),g=u=t([n("esri.layers.support.PixelBlock")],g);const d=g;export{d as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Error.js";import{JSONSupport as s}from"../../core/JSONSupport.js";import{clone as i}from"../../core/lang.js";import l from"../../core/Logger.js";import{isSome as r,isNone as o}from"../../core/maybe.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import{cast as h}from"../../core/accessorSupport/decorators/cast.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{SimpleBandStatistics as p}from"./SimpleBandStatistics.js";import{getPixelValueRange as c}from"./rasterFormats/pixelRangeUtils.js";var u;let g=u=class extends s{static createEmptyBand(t,e){return new(u.getPixelArrayConstructor(t))(e)}static getPixelArrayConstructor(t){let e;switch(t){case"u1":case"u2":case"u4":case"u8":e=Uint8Array;break;case"u16":e=Uint16Array;break;case"u32":e=Uint32Array;break;case"s8":e=Int8Array;break;case"s16":e=Int16Array;break;case"s32":e=Int32Array;break;case"f32":case"c64":case"c128":case"unknown":e=Float32Array;break;case"f64":e=Float64Array}return e}constructor(t){super(t),this.width=null,this.height=null,this.pixelType="f32",this.validPixelCount=null,this.mask=null,this.maskIsAlpha=!1,this.premultiplyAlpha=!1,this.statistics=null,this.depthCount=1}castPixelType(t){if(!t)return"f32";let e=t.toLowerCase();return["u1","u2","u4"].includes(e)?e="u8":["unknown","u8","s8","u16","s16","u32","s32","f32","f64"].includes(e)||(e="f32"),e}getPlaneCount(){return this.pixels?.length}addData(t){if(!t.pixels||t.pixels.length!==this.width*this.height)throw new e("pixelblock:invalid-or-missing-pixels","add data requires valid pixels array that has same length defined by pixel block width * height");this.pixels||(this.pixels=[]),this.statistics||(this.statistics=[]),this.pixels.push(t.pixels),this.statistics.push(t.statistics??new p)}getAsRGBA(){const t=new ArrayBuffer(this.width*this.height*4);switch(this.pixelType){case"s8":case"s16":case"u16":case"s32":case"u32":case"f32":case"f64":this._fillFromNon8Bit(t);break;default:this._fillFrom8Bit(t)}return new Uint8ClampedArray(t)}getAsRGBAFloat(){const t=new Float32Array(this.width*this.height*4);return this._fillFrom32Bit(t),t}updateStatistics(){if(!this.pixels)return;this.statistics=this.pixels.map((t=>this._calculateBandStatistics(t,this.mask)));const t=this.mask;let e=0;if(r(t))for(let s=0;s<t.length;s++)t[s]&&e++;else e=this.width*this.height;this.validPixelCount=e}clamp(t){if(!t||"f64"===t||"f32"===t||!this.pixels)return;const[e,s]=c(t),i=this.pixels,l=this.width*this.height,r=i.length;let o,a,h;const n=[];for(let p=0;p<r;p++){h=u.createEmptyBand(t,l),o=i[p];for(let t=0;t<l;t++)a=o[t],h[t]=a>s?s:a<e?e:a;n.push(h)}this.pixels=n,this.pixelType=t}extractBands(t){const{pixels:e,statistics:s}=this;if(o(t)||0===t.length||!e||0===e.length)return this;const i=e.length,l=t.some((t=>t>=e.length)),r=i===t.length&&!t.some(((t,e)=>t!==e));return l||r?this:new u({pixelType:this.pixelType,width:this.width,height:this.height,mask:this.mask,validPixelCount:this.validPixelCount,maskIsAlpha:this.maskIsAlpha,pixels:t.map((t=>e[t])),statistics:s&&t.map((t=>s[t]))})}clone(){const t=new u({width:this.width,height:this.height,pixelType:this.pixelType,maskIsAlpha:this.maskIsAlpha,validPixelCount:this.validPixelCount});let e;r(this.mask)&&(this.mask instanceof Uint8Array?t.mask=new Uint8Array(this.mask):t.mask=this.mask.slice(0));const s=u.getPixelArrayConstructor(this.pixelType);if(this.pixels&&this.pixels.length>0){t.pixels=[];const i=!!this.pixels[0].slice;for(e=0;e<this.pixels.length;e++)t.pixels[e]=i?this.pixels[e].slice(0,this.pixels[e].length):new s(this.pixels[e])}if(this.statistics)for(t.statistics=[],e=0;e<this.statistics.length;e++)t.statistics[e]=i(this.statistics[e]);return t.premultiplyAlpha=this.premultiplyAlpha,t}_fillFrom8Bit(t){const{mask:e,maskIsAlpha:s,premultiplyAlpha:i,pixels:o}=this;if(!t||!o||!o.length)return void l.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The input pixel block is empty.");let a,h,n,p;a=h=n=o[0],o.length>=3?(h=o[1],n=o[2]):2===o.length&&(h=o[1]);const c=new Uint32Array(t),u=this.width*this.height;if(a.length===u)if(r(e)&&e.length===u)if(s)for(p=0;p<u;p++){const t=e[p];if(t){const e=t/255;c[p]=i?t<<24|n[p]*e<<16|h[p]*e<<8|a[p]*e:t<<24|n[p]<<16|h[p]<<8|a[p]}}else for(p=0;p<u;p++)e[p]&&(c[p]=255<<24|n[p]<<16|h[p]<<8|a[p]);else for(p=0;p<u;p++)c[p]=255<<24|n[p]<<16|h[p]<<8|a[p];else l.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The pixelblock is invalid.")}_fillFromNon8Bit(t){const{pixels:e,mask:s,statistics:i}=this;if(!t||!e||!e.length)return void l.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The input pixel block is empty.");const o=this.pixelType;let a=1,h=0,n=1;if(i&&i.length>0){for(const t of i)if(null!=t.minValue&&(h=Math.min(h,t.minValue)),null!=t.maxValue&&null!=t.minValue){const e=t.maxValue-t.minValue;n=Math.max(n,e)}a=255/n}else{let t=255;"s8"===o?(h=-128,t=127):"u16"===o?t=65535:"s16"===o?(h=-32768,t=32767):"u32"===o?t=4294967295:"s32"===o?(h=-2147483648,t=2147483647):"f32"===o?(h=-34e38,t=34e38):"f64"===o&&(h=-Number.MAX_VALUE,t=Number.MAX_VALUE),a=255/(t-h)}const p=new Uint32Array(t),c=this.width*this.height;let u,g,m,d,f;if(u=g=m=e[0],u.length!==c)return l.getLogger(this.declaredClass).error("getAsRGBA()","Unable to convert to RGBA. The pixelblock is invalid.");if(e.length>=2)if(g=e[1],e.length>=3&&(m=e[2]),r(s)&&s.length===c)for(d=0;d<c;d++)s[d]&&(p[d]=255<<24|(m[d]-h)*a<<16|(g[d]-h)*a<<8|(u[d]-h)*a);else for(d=0;d<c;d++)p[d]=255<<24|(m[d]-h)*a<<16|(g[d]-h)*a<<8|(u[d]-h)*a;else if(r(s)&&s.length===c)for(d=0;d<c;d++)f=(u[d]-h)*a,s[d]&&(p[d]=255<<24|f<<16|f<<8|f);else for(d=0;d<c;d++)f=(u[d]-h)*a,p[d]=255<<24|f<<16|f<<8|f}_fillFrom32Bit(t){const{pixels:e,mask:s}=this;if(!t||!e||!e.length)return l.getLogger(this.declaredClass).error("getAsRGBAFloat()","Unable to convert to RGBA. The input pixel block is empty.");let i,o,a,h;i=o=a=e[0],e.length>=3?(o=e[1],a=e[2]):2===e.length&&(o=e[1]);const n=this.width*this.height;if(i.length!==n)return l.getLogger(this.declaredClass).error("getAsRGBAFloat()","Unable to convert to RGBA. The pixelblock is invalid.");let p=0;if(r(s)&&s.length===n)for(h=0;h<n;h++)t[p++]=i[h],t[p++]=o[h],t[p++]=a[h],t[p++]=1&s[h];else for(h=0;h<n;h++)t[p++]=i[h],t[p++]=o[h],t[p++]=a[h],t[p++]=1}_calculateBandStatistics(t,e){let s=1/0,i=-1/0;const l=t.length;let o,a=0;if(r(e))for(o=0;o<l;o++)e[o]&&(a=t[o],s=a<s?a:s,i=a>i?a:i);else for(o=0;o<l;o++)a=t[o],s=a<s?a:s,i=a>i?a:i;return new p(s,i)}};t([a({json:{write:!0}})],g.prototype,"width",void 0),t([a({json:{write:!0}})],g.prototype,"height",void 0),t([a({json:{write:!0}})],g.prototype,"pixelType",void 0),t([h("pixelType")],g.prototype,"castPixelType",null),t([a({json:{write:!0}})],g.prototype,"validPixelCount",void 0),t([a({json:{write:!0}})],g.prototype,"mask",void 0),t([a({json:{write:!0}})],g.prototype,"maskIsAlpha",void 0),t([a({json:{write:!0}})],g.prototype,"pixels",void 0),t([a()],g.prototype,"premultiplyAlpha",void 0),t([a({json:{write:!0}})],g.prototype,"statistics",void 0),t([a({json:{write:!0}})],g.prototype,"depthCount",void 0),t([a({json:{write:!0}})],g.prototype,"noDataValues",void 0),t([a({json:{write:!0}})],g.prototype,"bandMasks",void 0),g=u=t([n("esri.layers.support.PixelBlock")],g);const m=g;export{m as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.26.0",
3
+ "version": "4.26.2",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- const b="20230222",d="f17172bab03d767d6c0b1299b23ed7d4aba5edea";export{b as buildDate,d as commitHash};
5
+ const e="20230224",c="4a7176411474fc00e70dc14454e198e38b707fec";export{e as buildDate,c as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{isSome as e,isNone as t}from"../../../core/maybe.js";class i{constructor(e,t,i){this.pixelBlock=e,this.extent=t,this.originalPixelBlock=i}get width(){return e(this.pixelBlock)?this.pixelBlock.width:0}get height(){return e(this.pixelBlock)?this.pixelBlock.height:0}render(e){const i=this.pixelBlock;if(t(i))return;const l=this.filter({extent:this.extent,pixelBlock:this.originalPixelBlock??i});if(t(l.pixelBlock))return;const o=l.pixelBlock.getAsRGBA(),r=e.createImageData(l.pixelBlock.width,l.pixelBlock.height);r.data.set(o),e.putImageData(r,0,0)}getRenderedRasterPixels(){const e=this.filter({extent:this.extent,pixelBlock:this.pixelBlock});return t(e.pixelBlock)?null:{width:e.pixelBlock.width,height:e.pixelBlock.height,renderedRasterPixels:new Uint8Array(e.pixelBlock.getAsRGBA().buffer)}}}export{i as default};
5
+ import{isSome as e,isNone as t}from"../../../core/maybe.js";class l{constructor(e,t,l){this.pixelBlock=e,this.extent=t,this.originalPixelBlock=l}get width(){return e(this.pixelBlock)?this.pixelBlock.width:0}get height(){return e(this.pixelBlock)?this.pixelBlock.height:0}render(e){const l=this.pixelBlock;if(t(l))return;const i=this.filter({extent:this.extent,pixelBlock:this.originalPixelBlock??l});if(t(i.pixelBlock))return;i.pixelBlock.maskIsAlpha&&(i.pixelBlock.premultiplyAlpha=!0);const o=i.pixelBlock.getAsRGBA(),s=e.createImageData(i.pixelBlock.width,i.pixelBlock.height);s.data.set(o),e.putImageData(s,0,0)}getRenderedRasterPixels(){const e=this.filter({extent:this.extent,pixelBlock:this.pixelBlock});return t(e.pixelBlock)?null:(e.pixelBlock.maskIsAlpha&&(e.pixelBlock.premultiplyAlpha=!0),{width:e.pixelBlock.width,height:e.pixelBlock.height,renderedRasterPixels:new Uint8Array(e.pixelBlock.getAsRGBA().buffer)})}}export{l 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.26/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../request.js";import t from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import r from"../../../../../core/Logger.js";import{isSome as s,unwrapOr as i,isNone as a}from"../../../../../core/maybe.js";import{throwIfAborted as o,isAbortError as n}from"../../../../../core/promiseUtils.js";import{createSourceAdapter as u}from"../controllers/support/sourceAdapters.js";import{DataTileSource as c}from"./DataTileSource.js";import{QueueProcessor as l}from"../../../../support/QueueProcessor.js";const d=4;class p extends c{constructor(e){super(e),this.type="feature",this.mode="on-demand",this._adapter=u(e.serviceInfo),this._queue=new l({concurrency:8,process:async e=>{if(o(e),s(e.tile)){const t=e.tile.key.id,{signal:r}=e,s=has("esri-tiles-debug")?{tile:t.replace(/\//g,"."),depth:e.depth}:void 0,i=await this._adapter.executeQuery(e.query,{signal:r,query:{...s,...this._schema?.customParameters,_ts:this._lastForcedAdminEdit}});return i.level=e.tile.key.level,i}return this._adapter.executeQuery(e.query,{...e,query:this._schema?.customParameters})}}),this._patchQueue=new l({concurrency:8,process:async e=>{if(o(e),s(e.tile)){const t=e.tile.key.id,{signal:r}=e,s=has("esri-tiles-debug")?{tile:t.replace(/\//g,"."),depth:e.depth}:void 0,i=await this._adapter.executeQuery(e.query,{signal:r,query:{...s,...this._schema?.customParameters,_ts:this._lastForcedAdminEdit}});return i.level=e.tile.key.level,i}return this._adapter.executeQuery(e.query,{...e,query:this._schema?.customParameters})}})}destroy(){super.destroy(),this._adapter.destroy(),this._queue.destroy(),this._patchQueue.destroy()}get updating(){return!!this._queue.length||Array.from(this._subscriptions.values()).some((e=>!e.done))}get maxRecordCountFactor(){const{query:e}=this._serviceInfo.capabilities;return e.supportsMaxRecordCountFactor?d:null}get maxPageSize(){const{query:e}=this._serviceInfo.capabilities;return(e.maxRecordCount??8e3)*i(this.maxRecordCountFactor,1)}get pageSize(){return Math.min(8e3,this.maxPageSize)}enableEvent(e,t){}subscribe(e,s){super.subscribe(e,s);const i=this._subscriptions.get(e.id);this._fetchDataTile(e).catch((s=>{n(s)||r.getLogger("esri.views.2d.layers.features.sources.BaseFeatureSource").error(new t("mapview-query-error","Encountered error when fetching tile",{tile:e,error:s}))})).then((()=>i.end()))}unsubscribe(e){super.unsubscribe(e)}readers(e){return this._subscriptions.get(e).readers()}async query(e,t={}){const r=t.query??{};return this._adapter.executeQuery(e,{...t,query:{...r,...this._schema?.customParameters}})}async queryLastEditDate(){const t=this._serviceInfo.source,r={...t.query,f:"json"};return(await e(t.path,{query:r,responseType:"json"})).data.editingInfo.lastEditDate}createTileQuery(e,t={}){const r=this._serviceInfo.geometryType,s=this.createQuery(t);s.quantizationParameters=t.quantizationParameters??e.getQuantizationParameters(),s.resultType="tile",s.geometry=e.extent,this._serviceInfo.capabilities.query.supportsQuantization?"esriGeometryPolyline"===r&&(s.maxAllowableOffset=e.resolution*has("feature-polyline-generalization-factor")):"esriGeometryPolyline"!==r&&"esriGeometryPolygon"!==r||(s.maxAllowableOffset=e.resolution,"esriGeometryPolyline"===r&&(s.maxAllowableOffset*=has("feature-polyline-generalization-factor")));const i=this._serviceInfo.capabilities.query;return s.defaultSpatialReferenceEnabled=i.supportsDefaultSpatialReference,s.compactGeometryEnabled=i.supportsCompactGeometry,s}async _executePatchQuery(e,t,r,i){const a=t.clone();a.outFields=[this._serviceInfo.objectIdField,...r],a.returnCentroid=!1,a.returnGeometry=!1;const o=s(a.start)?a.start/8e3:0,n=i.signal;return this._patchQueue.push({tile:e,query:a,signal:n,depth:o})}async _resend(e,t){const{query:r,message:i}=e,n=s(r.outFields)?r.outFields:[],u=this._queryInfo.outFields,c=u.filter((e=>!n.includes(e)));if(a(i.addOrUpdate))this._onMessage({...i,type:"append"});else if(c.length)try{const e=this._subscriptions.get(i.id).tile,s=await this._executePatchQuery(e,r,c,t);o(t),r.outFields=u,i.addOrUpdate.joinAttributes(s),this._onMessage({...i,end:i.end,type:"append"})}catch(l){}else this._onMessage({...i,type:"append"})}async _resendSubscription(e){if(has("esri-2d-update-debug")&&console.debug(e.tile.id,"Resend Subscription"),e.empty)return this._onMessage({id:e.tile.id,addOrUpdate:null,end:!1,type:"append"});const t=e.signal;for(const r of e.requests.done)await this._resend(r,{signal:t});return s(e.edits)?this._onMessage(e.edits):void 0}async resend(){const e=Array.from(this._subscriptions.values());await Promise.all(e.map((e=>this._resendSubscription(e))))}}export{p as BaseFeatureSource};
5
+ import e from"../../../../../request.js";import t from"../../../../../core/Error.js";import has from"../../../../../core/has.js";import r from"../../../../../core/Logger.js";import{isSome as s,unwrapOr as i,isNone as a}from"../../../../../core/maybe.js";import{throwIfAborted as o,isAbortError as n}from"../../../../../core/promiseUtils.js";import{createSourceAdapter as u}from"../controllers/support/sourceAdapters.js";import{DataTileSource as c}from"./DataTileSource.js";import{QueueProcessor as l}from"../../../../support/QueueProcessor.js";const p=4;class d extends c{constructor(e){super(e),this.type="feature",this.mode="on-demand",this._adapter=u(e.serviceInfo),this._queue=new l({concurrency:8,process:async e=>{if(o(e),s(e.tile)){const t=e.tile.key.id,{signal:r}=e,s=has("esri-tiles-debug")?{tile:t.replace(/\//g,"."),depth:e.depth}:void 0,i=await this._adapter.executeQuery(e.query,{signal:r,query:{...s,...this._schema?.customParameters}});return i.level=e.tile.key.level,i}return this._adapter.executeQuery(e.query,{...e,query:this._schema?.customParameters})}}),this._patchQueue=new l({concurrency:8,process:async e=>{if(o(e),s(e.tile)){const t=e.tile.key.id,{signal:r}=e,s=has("esri-tiles-debug")?{tile:t.replace(/\//g,"."),depth:e.depth}:void 0,i=await this._adapter.executeQuery(e.query,{signal:r,query:{...s,...this._schema?.customParameters}});return i.level=e.tile.key.level,i}return this._adapter.executeQuery(e.query,{...e,query:this._schema?.customParameters})}})}destroy(){super.destroy(),this._adapter.destroy(),this._queue.destroy(),this._patchQueue.destroy()}get updating(){return!!this._queue.length||Array.from(this._subscriptions.values()).some((e=>!e.done))}get maxRecordCountFactor(){const{query:e}=this._serviceInfo.capabilities;return e.supportsMaxRecordCountFactor?p:null}get maxPageSize(){const{query:e}=this._serviceInfo.capabilities;return(e.maxRecordCount??8e3)*i(this.maxRecordCountFactor,1)}get pageSize(){return Math.min(8e3,this.maxPageSize)}enableEvent(e,t){}subscribe(e,s){super.subscribe(e,s);const i=this._subscriptions.get(e.id);this._fetchDataTile(e).catch((s=>{n(s)||r.getLogger("esri.views.2d.layers.features.sources.BaseFeatureSource").error(new t("mapview-query-error","Encountered error when fetching tile",{tile:e,error:s}))})).then((()=>i.end()))}unsubscribe(e){super.unsubscribe(e)}readers(e){return this._subscriptions.get(e).readers()}async query(e,t={}){const r=t.query??{};return this._adapter.executeQuery(e,{...t,query:{...r,...this._schema?.customParameters}})}async queryLastEditDate(){const t=this._serviceInfo.source,r={...t.query,f:"json"};return(await e(t.path,{query:r,responseType:"json"})).data.editingInfo.lastEditDate}createTileQuery(e,t={}){const r=this._serviceInfo.geometryType,s=this.createQuery(t);s.quantizationParameters=t.quantizationParameters??e.getQuantizationParameters(),s.resultType="tile",s.geometry=e.extent,this._serviceInfo.capabilities.query.supportsQuantization?"esriGeometryPolyline"===r&&(s.maxAllowableOffset=e.resolution*has("feature-polyline-generalization-factor")):"esriGeometryPolyline"!==r&&"esriGeometryPolygon"!==r||(s.maxAllowableOffset=e.resolution,"esriGeometryPolyline"===r&&(s.maxAllowableOffset*=has("feature-polyline-generalization-factor")));const i=this._serviceInfo.capabilities.query;return s.defaultSpatialReferenceEnabled=i.supportsDefaultSpatialReference,s.compactGeometryEnabled=i.supportsCompactGeometry,s}async _executePatchQuery(e,t,r,i){const a=t.clone();a.outFields=[this._serviceInfo.objectIdField,...r],a.returnCentroid=!1,a.returnGeometry=!1;const o=s(a.start)?a.start/8e3:0,n=i.signal;return this._patchQueue.push({tile:e,query:a,signal:n,depth:o})}async _resend(e,t){const{query:r,message:i}=e,n=s(r.outFields)?r.outFields:[],u=this._queryInfo.outFields,c=u.filter((e=>!n.includes(e)));if(a(i.addOrUpdate))this._onMessage({...i,type:"append"});else if(c.length)try{const e=this._subscriptions.get(i.id).tile,s=await this._executePatchQuery(e,r,c,t);o(t),r.outFields=u,i.addOrUpdate.joinAttributes(s),this._onMessage({...i,end:i.end,type:"append"})}catch(l){}else this._onMessage({...i,type:"append"})}async _resendSubscription(e){if(has("esri-2d-update-debug")&&console.debug(e.tile.id,"Resend Subscription"),e.empty)return this._onMessage({id:e.tile.id,addOrUpdate:null,end:!1,type:"append"});const t=e.signal;for(const r of e.requests.done)await this._resend(r,{signal:t});return s(e.edits)?this._onMessage(e.edits):void 0}async resend(){const e=Array.from(this._subscriptions.values());await Promise.all(e.map((e=>this._resendSubscription(e))))}}export{d as BaseFeatureSource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../../TimeExtent.js";import t from"../../../../../core/Accessor.js";import s from"../../../../../core/Evented.js";import has from"../../../../../core/has.js";import{isSome as i}from"../../../../../core/maybe.js";import{createResolver as r,ignoreAbortErrors as o,eachAlwaysValues as n,eachAlways as c}from"../../../../../core/promiseUtils.js";import{diff as u,hasDiff as d,hasDiffAny as a}from"../../../../../core/accessorSupport/diffUtils.js";import h from"../../../../../rest/support/Query.js";import{DataTileSubscription as p}from"./DataTileSubscription.js";import{UpdateToken as l}from"../support/UpdateToken.js";function m(e,t){const s=new Set;return e&&e.forEach((e=>s.add(e))),t&&t.forEach((e=>s.add(e))),s.has("*")?["*"]:Array.from(s)}class f extends t{constructor(e){super(),this.events=new s,this._resolver=r(),this._didEdit=!1,this._subscriptions=new Map,this._outSR=e.outSR,this._serviceInfo=e.serviceInfo,this._onTileUpdateMessage=e.onMessage}async _onMessage(e){const t=this._subscriptions.get(e.id);if(!t)return;const s={...e,remove:e.remove??[],status:e.status??l.empty()};return o(this._onTileUpdateMessage(s,t.options))}update(t,s){const i=s.fields.length;s.outFields=m(this._schema?.outFields,s.outFields),s.outFields=s.outFields.length>=.75*i?["*"]:s.outFields,s.outFields.sort();const r=u(this._schema,s);if(!r)return;has("esri-2d-update-debug")&&console.debug("Applying Update - Source:",r);const o="orderByFields"in this._serviceInfo&&this._serviceInfo.orderByFields?this._serviceInfo.orderByFields:this._serviceInfo.objectIdField+" ASC",n={returnCentroid:"esriGeometryPolygon"===this._serviceInfo.geometryType,returnGeometry:!0,timeReferenceUnknownClient:"stream"!==this._serviceInfo.type&&this._serviceInfo.timeReferenceUnknownClient,outFields:s.outFields,outSpatialReference:this._outSR,orderByFields:[o],where:s.definitionExpression||"1=1",gdbVersion:s.gdbVersion,historicMoment:s.historicMoment,timeExtent:s.timeExtent?e.fromJSON(s.timeExtent):null},c=this._schema&&d(r,"outFields");this._schema&&a(r,["timeExtent","definitionExpression","gdbVersion","historicMoment","customParameters"])&&(t.why.mesh.push("Layer filter and/or custom parameters changed"),t.why.source.push("Layer filter and/or custom parameters changed"),t.mesh=!0,t.source=!0,t.queryFilter=!0),c&&(t.why.source.push("Layer required fields changed"),t.source=!0),u(n,this._queryInfo)&&(this._queryInfo=n),this._schema=s,this._resolver.resolve()}whenInitialized(){return this._resolver.promise}async applyUpdate(e){if(e.queryFilter||e.source&&this._didEdit)return this.refresh(e.version),void(this._didEdit=!1);this._subscriptions.forEach((t=>t.applyUpdate(e))),await this.resend()}refresh(e,t){for(const s of this._tiles())this.unsubscribe(s),this.subscribe(s,e)}subscribe(e,t){const s=new p(e,t);this._subscriptions.set(e.id,s)}unsubscribe(e){const t=this.getSubscription(e.id);i(t)&&t.abort(),this._subscriptions.delete(e.id)}createQuery(e={}){const t=this._queryInfo.historicMoment?new Date(this._queryInfo.historicMoment):null;return new h({...this._queryInfo,historicMoment:t,...e})}getSubscription(e){return this._subscriptions.has(e)?this._subscriptions.get(e):null}async queryLastEditDate(){throw new Error("Service does not support query type")}async query(e,t){throw new Error("Service does not support query")}*_tiles(){const e=Array.from(this._subscriptions.values());for(const t of e)yield t.tile}_updateLastForcedAdminEdit(){if("stream"!==this._serviceInfo.type){const{capabilities:e,effectiveCapabilities:t}=this._serviceInfo,s=!e.operations?.supportsEditing&&t.operations?.supportsEditing;this._lastForcedAdminEdit=s?Date.now():void 0}}async edit(e,t){this._updateLastForcedAdminEdit();const s=Array.from(this._subscriptions.values()),i=s.map((({tile:e})=>e));for(const r of s)r.removeIds(t);if(e.length){const s=i.map((t=>{const s=this.createTileQuery(t);return s.objectIds=e,{tile:t,query:s}})).map((async({tile:e,query:t})=>({tile:e,result:await this.query(t,{query:{tile:has("esri-tiles-debug")?e.id.replace(/\//g,"."):void 0,_ts:this._lastForcedAdminEdit}}),query:t}))),r=(await n(s)).map((async({tile:s,result:i})=>{if(!i.hasFeatures&&!t.length&&!e.length)return;const r=this._subscriptions.get(s.key.id);r&&r.edit(i,e)}));await c(r)}this._didEdit=!0}}export{f as DataTileSource};
5
+ import e from"../../../../../TimeExtent.js";import s from"../../../../../core/Accessor.js";import t from"../../../../../core/Evented.js";import has from"../../../../../core/has.js";import{isSome as i}from"../../../../../core/maybe.js";import{createResolver as r,ignoreAbortErrors as o,eachAlwaysValues as n,eachAlways as c}from"../../../../../core/promiseUtils.js";import{diff as u,hasDiff as h,hasDiffAny as a}from"../../../../../core/accessorSupport/diffUtils.js";import d from"../../../../../rest/support/Query.js";import{DataTileSubscription as p}from"./DataTileSubscription.js";import{UpdateToken as l}from"../support/UpdateToken.js";function m(e,s){const t=new Set;return e&&e.forEach((e=>t.add(e))),s&&s.forEach((e=>t.add(e))),t.has("*")?["*"]:Array.from(t)}class f extends s{constructor(e){super(),this.events=new t,this._resolver=r(),this._didEdit=!1,this._subscriptions=new Map,this._outSR=e.outSR,this._serviceInfo=e.serviceInfo,this._onTileUpdateMessage=e.onMessage}async _onMessage(e){const s=this._subscriptions.get(e.id);if(!s)return;const t={...e,remove:e.remove??[],status:e.status??l.empty()};return o(this._onTileUpdateMessage(t,s.options))}update(s,t){const i=t.fields.length;t.outFields=m(this._schema?.outFields,t.outFields),t.outFields=t.outFields.length>=.75*i?["*"]:t.outFields,t.outFields.sort();const r=u(this._schema,t);if(!r)return;has("esri-2d-update-debug")&&console.debug("Applying Update - Source:",r);const o="orderByFields"in this._serviceInfo&&this._serviceInfo.orderByFields?this._serviceInfo.orderByFields:this._serviceInfo.objectIdField+" ASC",n={returnCentroid:"esriGeometryPolygon"===this._serviceInfo.geometryType,returnGeometry:!0,timeReferenceUnknownClient:"stream"!==this._serviceInfo.type&&this._serviceInfo.timeReferenceUnknownClient,outFields:t.outFields,outSpatialReference:this._outSR,orderByFields:[o],where:t.definitionExpression||"1=1",gdbVersion:t.gdbVersion,historicMoment:t.historicMoment,timeExtent:t.timeExtent?e.fromJSON(t.timeExtent):null},c=this._schema&&h(r,"outFields");this._schema&&a(r,["timeExtent","definitionExpression","gdbVersion","historicMoment","customParameters"])&&(s.why.mesh.push("Layer filter and/or custom parameters changed"),s.why.source.push("Layer filter and/or custom parameters changed"),s.mesh=!0,s.source=!0,s.queryFilter=!0),c&&(s.why.source.push("Layer required fields changed"),s.source=!0),u(n,this._queryInfo)&&(this._queryInfo=n),this._schema=t,this._resolver.resolve()}whenInitialized(){return this._resolver.promise}async applyUpdate(e){if(e.queryFilter||e.source&&this._didEdit)return this.refresh(e.version),void(this._didEdit=!1);this._subscriptions.forEach((s=>s.applyUpdate(e))),await this.resend()}refresh(e,s){for(const t of this._tiles())this.unsubscribe(t),this.subscribe(t,e)}subscribe(e,s){const t=new p(e,s);this._subscriptions.set(e.id,t)}unsubscribe(e){const s=this.getSubscription(e.id);i(s)&&s.abort(),this._subscriptions.delete(e.id)}createQuery(e={}){const s=this._queryInfo.historicMoment?new Date(this._queryInfo.historicMoment):null;return new d({...this._queryInfo,historicMoment:s,...e})}getSubscription(e){return this._subscriptions.has(e)?this._subscriptions.get(e):null}async queryLastEditDate(){throw new Error("Service does not support query type")}async query(e,s){throw new Error("Service does not support query")}*_tiles(){const e=Array.from(this._subscriptions.values());for(const s of e)yield s.tile}async edit(e,s){const t=Array.from(this._subscriptions.values()),i=t.map((({tile:e})=>e));for(const r of t)r.removeIds(s);if(e.length){const t=i.map((s=>{const t=this.createTileQuery(s);return t.objectIds=e,{tile:s,query:t}})).map((async({tile:e,query:s})=>({tile:e,result:await this.query(s,{query:{tile:has("esri-tiles-debug")?e.id.replace(/\//g,"."):void 0}}),query:s}))),r=(await n(t)).map((async({tile:t,result:i})=>{if(!i.hasFeatures&&!s.length&&!e.length)return;const r=this._subscriptions.get(t.key.id);r&&r.edit(i,e)}));await c(r)}this._didEdit=!0}}export{f as DataTileSource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../core/Error.js";import{unwrap as o,isNone as s,isSome as i}from"../../core/maybe.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{combinedViewLayerTimeExtentProperty as l}from"../../layers/support/commonProperties.js";import{getDefaultDatumTransformationForDataset as p,projectExtent as u}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{getFetchPopupTemplate as c}from"./support/popupUtils.js";const f=f=>{let m=class extends f{constructor(){super(...arguments),this._rasterFieldPrefix="Raster.",this.layer=null,this.view=null,this.tileInfo=null}get fullExtent(){return this._getfullExtent()}_getfullExtent(){return this.projectFullExtent(this.view.spatialReference)}get hasTilingEffects(){return this.layer.renderer&&"dynamicRangeAdjustment"in this.layer.renderer&&this.layer.renderer.dynamicRangeAdjustment}get datumTransformation(){return p(o(this.layer.fullExtent),this.view.spatialReference,!0)}supportsSpatialReference(e){return!!this.projectFullExtent(e)}projectFullExtent(e){const t=o(this.layer.fullExtent),r=p(t,e,!1);return u(t,e,r)}async fetchPopupFeatures(e,o){const{layer:a}=this;if(!e)throw new r("imageryTileLayerView:fetchPopupFeatures","Nothing to fetch without area",{layer:a});const{popupEnabled:n}=a,l=c(a,o);if(!n||s(l))throw new r("imageryTileLayerView:fetchPopupFeatures","Missing required popupTemplate or popupEnabled",{popupEnabled:n,popupTemplate:l});const p=[],{value:u,magdirValue:f}=await a.identify(e,{timeExtent:this.timeExtent});let m="";if(u&&u.length){m="imagery-tile"===a.type&&a.hasStandardTime()&&null!=u[0]?u.map((e=>a.getStandardTimeValue(e))).join(", "):u.join(", ");const e={ObjectId:0};e["Raster.ServicePixelValue"]=m;const r=a.rasterInfo.attributeTable;if(i(r)){const{fields:t,features:o}=r,s=t.find((({name:e})=>"value"===e.toLowerCase())),i=s?o.find((e=>String(e.attributes[s.name])===m)):null;if(i)for(const r in i.attributes)if(i.attributes.hasOwnProperty(r)){e[this._rasterFieldPrefix+r]=i.attributes[r]}}const o=a.rasterInfo.dataType;"vector-magdir"!==o&&"vector-uv"!==o||(e["Raster.Magnitude"]=f?.[0],e["Raster.Direction"]=f?.[1]);const s=new t(this.fullExtent.clone(),null,e);s.layer=a,s.sourceLayer=s.layer,p.push(s)}return p}};return e([a()],m.prototype,"layer",void 0),e([a(l)],m.prototype,"timeExtent",void 0),e([a()],m.prototype,"view",void 0),e([a()],m.prototype,"fullExtent",null),e([a()],m.prototype,"tileInfo",void 0),e([a({readOnly:!0})],m.prototype,"hasTilingEffects",null),m=e([n("esri.views.layers.ImageryTileLayerView")],m),m};export{f as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../core/Error.js";import{unwrap as o,isNone as s,isSome as i}from"../../core/maybe.js";import{property as a}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{combinedViewLayerTimeExtentProperty as l}from"../../layers/support/commonProperties.js";import{getDefaultDatumTransformationForDataset as p,projectExtent as u}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{getFetchPopupTemplate as c}from"./support/popupUtils.js";const f=f=>{let m=class extends f{constructor(){super(...arguments),this._rasterFieldPrefix="Raster.",this.layer=null,this.view=null,this.tileInfo=null}get fullExtent(){return this._getfullExtent()}_getfullExtent(){return this.projectFullExtent(this.view.spatialReference)}get hasTilingEffects(){return this.layer.renderer&&"dynamicRangeAdjustment"in this.layer.renderer&&this.layer.renderer.dynamicRangeAdjustment}get datumTransformation(){return p(o(this.layer.fullExtent),this.view.spatialReference,!0)}supportsSpatialReference(e){return!!this.projectFullExtent(e)}projectFullExtent(e){const t=o(this.layer.fullExtent),r=p(t,e,!1);return u(t,e,r)}async fetchPopupFeatures(e,o){const{layer:a}=this;if(!e)throw new r("imageryTileLayerView:fetchPopupFeatures","Nothing to fetch without area",{layer:a});const{popupEnabled:n}=a,l=c(a,o);if(!n||s(l))throw new r("imageryTileLayerView:fetchPopupFeatures","Missing required popupTemplate or popupEnabled",{popupEnabled:n,popupTemplate:l});const p=[],{value:u,magdirValue:f}=await a.identify(e,{timeExtent:this.timeExtent});let m="";if(u&&u.length){m="imagery-tile"===a.type&&a.hasStandardTime()&&null!=u[0]?u.map((e=>a.getStandardTimeValue(e))).join(", "):u.join(", ");const e={ObjectId:0};e["Raster.ServicePixelValue"]=m;const r=a.rasterInfo.attributeTable;if(i(r)){const{fields:t,features:o}=r,s=t.find((({name:e})=>"value"===e.toLowerCase())),i=s?o.find((e=>String(e.attributes[s.name])===m)):null;if(i)for(const r in i.attributes)if(i.attributes.hasOwnProperty(r)){e[this._rasterFieldPrefix+r]=i.attributes[r]}}const o=a.rasterInfo.dataType;"vector-magdir"!==o&&"vector-uv"!==o||(e["Raster.Magnitude"]=f?.[0],e["Raster.Direction"]=f?.[1]);const s=new t(this.fullExtent.clone(),null,e);s.layer=a,s.sourceLayer=s.layer,p.push(s)}return p}};return e([a()],m.prototype,"layer",void 0),e([a(l)],m.prototype,"timeExtent",void 0),e([a()],m.prototype,"view",void 0),e([a()],m.prototype,"fullExtent",null),e([a()],m.prototype,"tileInfo",void 0),e([a({readOnly:!0})],m.prototype,"hasTilingEffects",null),e([a()],m.prototype,"datumTransformation",null),m=e([n("esri.views.layers.ImageryTileLayerView")],m),m};export{f as default};
package/widgets/Editor.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.26/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import s from"../core/Logger.js";import{isSome as i}from"../core/maybe.js";import{createDeferred as a}from"../core/promiseUtils.js";import{watch as o,on as n,when as r,initial as l}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{getDisplayFieldName as m}from"../layers/support/fieldUtils.js";import h from"./Attachments.js";import u from"./FeatureForm.js";import g from"./FeatureTemplates.js";import _ from"./Spinner.js";import w from"./Widget.js";import{workflowDeprecation as f}from"./Editor/deprecationUtils.js";import v from"./Editor/EditorViewModel.js";import{ItemList as k}from"./FeatureTemplates/ItemList.js";import{Heading as y,incrementHeadingLevel as b}from"./support/Heading.js";import A from"./support/SnappingControls.js";import{accessibleHandler as M}from"./support/decorators/accessibleHandler.js";import{messageBundle as C}from"./support/decorators/messageBundle.js";import{vmEvent as F}from"./support/decorators/vmEvent.js";import{tsx as W}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import{SketchTooltipControls as T}from"./support/SketchTooltipControls/SketchTooltipControls.js";import{substitute as E}from"../intl/substitute.js";const S="esri-editor",j=`${S}__panel`,L=`${S}__prompt`,P={base:`${S} esri-widget esri-widget--panel`,message:`${S}__message`,actions:`${S}__actions`,helpMessage:`${S}__help-message`,progressBar:`${S}__progress-bar`,panelToolbar:`${j}-toolbar`,panelContent:`${j}-content`,panelContentMessage:`${j}-content__message`,panelContentSection:`${j}-content__section`,panelContentSectionGroup:`${j}-content__section__group`,panelContentScrimContainer:`${j}-content__scrim-container`,settingsContainer:`${S}__settings`,updateFeaturesActionButtons:`${S}__update-features-action-buttons`,updateFeaturesActionButtonsButton:`${S}__update-features-action-buttons--button`,featureTemplatesContainer:`${S}__feature-templates-container`,ownerAdminNotice:`${S}__owner-admin-notice`,promptContainer:L,promptHeader:`${L}__header`,promptHeading:`${L}__header__heading`,promptMessage:`${L}__message`,promptDivider:`${L}__divider`,promptActions:`${L}__actions`,warningIcon:"esri-icon-notice-triangle",widgetIcon:"esri-icon-edit"},B={undoRedoButtons:!1,snappingControls:!0,snappingControlsElements:{header:!1,enabledToggle:!0,selfEnabledToggle:!0,featureEnabledToggle:!0,layerList:!0},sketchTooltipControls:!0};function U(e){e.focus()}const I="esri.widgets.Editor",$=s.getLogger(I);let O=class extends(t(w)){constructor(e,t){super(e,t),this._featureForm=new u,this._attachments=new h({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._featureTemplates=new g({enableListScroll:!1}),this._filterText="",this._prompt=null,this._spinner=new _,this.useDeprecatedCreateWorkflow=!1,this.headingLevel=4,this.iconClass=P.widgetIcon,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.supportingWidgetDefaults=null,this.viewModel=new v,this.visibleElements={...B},this.EditorPanel=({handleBack:e,heading:t,headingLevel:s,key:i},...a)=>{const{messagesCommon:o,viewModel:n,visibleElements:r}=this,l=n.sketchViewModel,c=n.syncing||this._attachments.submitting;return W("calcite-flow-item",{closable:!1,heading:t,headingLevel:s,key:i,loading:c,onCalciteFlowItemBack:e??void 0},W("div",{key:"panel-toolbar",class:P.panelToolbar},this._renderSettings(),r.undoRedoButtons&&[W("calcite-button",{key:"undo-button",label:o.undo,appearance:"transparent",kind:"neutral",alignment:"center",iconStart:"undo",scale:"l",disabled:!l.canUndo(),onclick:l.undo.bind(l)},o.undo),W("calcite-button",{key:"redo-button",label:o.redo,appearance:"transparent",kind:"neutral",alignment:"center",iconStart:"redo",scale:"l",disabled:!l.canRedo(),onclick:l.redo.bind(l)},o.redo)]),...a)},this._showDiscardWarning=()=>{const{messages:e}=this,t="create"===this.activeWorkflow?.type,s=a();return this._prompt={title:e[t?"cancelAddTitle":"cancelEditTitle"],message:e[t?"cancelAddWarningMessage":"cancelEditWarningMessage"],context:"danger",actions:{primary:{label:e[t?"discardFeature":"discardEdits"],action:()=>{s.resolve(),this._clearPrompt()}},secondary:{label:e[t?"continueAdding":"continueEditing"],action:()=>{s.reject(),this._clearPrompt()}}}},s.promise},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.previous(),this._clearPrompt())},this._onAttachmentsError=e=>{this._prompt={title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}}},this._clearPrompt=()=>{this._prompt=null},this._onBack=this._onBack.bind(this),this._onSave=this._onSave.bind(this),this._onDelete=this._onDelete.bind(this),this._onToggleUpdateWorkflow=this._onToggleUpdateWorkflow.bind(this),this._onAttachmentAdd=this._onAttachmentAdd.bind(this),this._onAttachmentUpdate=this._onAttachmentUpdate.bind(this),this._onAttachmentDelete=this._onAttachmentDelete.bind(this)}initialize(){const e=()=>this.scheduleRender();this.addHandles([o((()=>b(this.headingLevel)),(e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e}),l),n((()=>this.viewModel.featureTemplatesViewModel),"select",(async({item:e,oldItem:t})=>{this.viewModel.activeWorkflow&&await this.viewModel.cancelWorkflow(),e&&e.id!==t?.id&&(this.useDeprecatedCreateWorkflow?this.startCreateWorkflowAtFeatureCreation(e):this.startCreateFeaturesWorkflowAtFeatureCreation(e))})),o((()=>this.viewModel.selectedTemplateItem),(e=>this._featureTemplates.select(e,!1))),n((()=>this.viewModel.activeWorkflow),"cancel-request",(({controller:e})=>{const{messages:t,messagesCommon:s}=this;this._prompt={title:t.cancelRequestTitle,message:t.cancelRequestWarningMessage,context:"danger",actions:{primary:{label:s.form.yes,action:()=>{e.allow(),this._clearPrompt()}},secondary:{label:s.form.no,action:()=>{e.deny(),this._clearPrompt()}}}}})),o((()=>this.viewModel),(e=>{this._featureForm.viewModel=e?.featureFormViewModel??null,this._attachments.viewModel=e?.attachmentsViewModel??null,this._featureTemplates.viewModel=e?.featureTemplatesViewModel??null,this._spinner.viewModel=e?.spinnerViewModel??null,e.showDiscardPrompt=this._showDiscardWarning}),l),o((()=>this.view),((e,t)=>{const s=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,s),e?.ui.add(this._spinner,{key:s,position:"manual"})}),l),n((()=>this.viewModel?.sketchViewModel),"create",e),r((()=>this.supportingWidgetDefaults),(e=>{this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel.set(e.sketch)}),l),r((()=>this._attachments?.error),(e=>this._onAttachmentsError(e))),r((()=>this.viewModel?.failures),(e=>{const{messages:t}=this,[{error:s,retry:i,cancel:a}]=e;this._prompt={title:t.errorWarningTitle,message:E(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{i(),this._clearPrompt()}},secondary:{label:t.ignore,action:()=>{a(),this._clearPrompt()}}}}})),o((()=>this.viewModel?.state),(e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}})),o((()=>[this._attachments?.selectedFile,this._attachments?.submitting]),e),o((()=>this.viewModel.featureFormDisabled),(e=>this._featureForm.disabled=e)),n((()=>this.view),"key-down",(e=>{"Escape"===e.key&&this.viewModel.back()}))])}destroy(){this._attachments.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy()}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-accordion-item.js"),import("@esri/calcite-components/dist/components/calcite-accordion.js"),import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-flow-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-list-item.js"),import("@esri/calcite-components/dist/components/calcite-list.js"),import("@esri/calcite-components/dist/components/calcite-notice.js"),import("@esri/calcite-components/dist/components/calcite-scrim.js")])}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger",type:"primary"}}get activeWorkflow(){return this.viewModel.activeWorkflow}get allowedWorkflows(){return this.viewModel.allowedWorkflows}set allowedWorkflows(e){this.viewModel.allowedWorkflows=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...B,...e,snappingControlsElements:{...B.snappingControlsElements,...e?.snappingControlsElements}}}startCreateWorkflowAtFeatureTypeSelection(){return f($,"startCreateWorkflowAtFeatureTypeSelection","startCreateFeaturesWorkflowAtFeatureTypeSelection"),this.viewModel.startCreateWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateWorkflowAtFeatureCreation(e){return f($,"startCreateWorkflowAtFeatureCreation","startCreateFeaturesWorkflowAtFeatureCreation"),this.viewModel.startCreateWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateWorkflowAtFeatureEdit(e){return f($,"startCreateWorkflowAtFeatureEdit"),this.viewModel.startCreateWorkflowAtFeatureEdit(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{viewModel:e}=this;if(!e)return W("div",{class:P.base});const{state:t}=e;return W("div",{class:P.base},W("calcite-flow",null,e.pageStack.map((e=>this._renderPage(e,t))),this._renderPage(e.page,t)),this._renderPrompt())}_renderPage(e,t){switch(e){case"disabled":break;case"ready":return this._renderLanding(t);case"awaiting-feature-creation-info":return this._renderTemplates(t);case"creating-features":case"editing-new-feature":case"editing-existing-feature":return this._renderAttributeEditing(t);case"awaiting-update-feature-candidate":return this._renderFeatureList(t);case"adding-attachment":return this._renderAttachmentAdding(t);case"editing-attachment":return this._renderAttachmentEditing(t)}return W("div",null)}_renderTemplates(e){const{EditorPanel:t,headingLevel:s,messages:i,_onBack:a}=this;return W(t,{active:this._isPanelActive(e),key:"templates-panel",handleBack:a,heading:i.selectTemplate,headingLevel:s},W("div",{class:P.panelContent},this._featureTemplates.render()))}_renderAttributeEditing(e){const{activeWorkflow:t,EditorPanel:s,messages:i,messagesCommon:a,headingLevel:o,_onBack:n,viewModel:r}=this;if(!t)return null;const l=t.type,c=r.featureFormViewModel,d="update"===l&&!t.data.edits.modified||r.syncing||c.updating,p="update"===l?i.editFeature:i.createFeatures,m="update"===l?a.update:a.create,h="create-features"===l&&"create-new"===t.createFeatureState,u="create-features"===l?t.numPendingFeatures:0,g=u>1?E(i.createFeaturesTemplate,{numFeatures:u}):m,_=t.shouldShowAttachments,w=c.inputFields.every((e=>!e.visible))&&!_?this._renderMessage(E(i.clickToFinishTemplate,{button:m})):W("div",{key:"panel-content-section",class:P.panelContentSection},this._renderOwnerAdminNoticeIfApplicable(t),W("div",{class:P.panelContentSectionGroup},this._featureForm.render(),_&&W("div",{key:"attachments"},W(y,{level:b(o)},i.attachments),this._attachments.render())));return W(s,{active:this._isPanelActive(e),key:"attribute-editing-panel",heading:p,headingLevel:o,handleBack:n},W("div",{key:"panel-content",class:this.classes(P.panelContent,{[P.panelContentScrimContainer]:h})},w,h&&W("calcite-scrim",null)),this._renderFooterActions([{clickHandler:this._onSave,disabled:d,label:g,type:"primary"},r.shouldShowDeleteButton?{...this._deleteButtonCommonInfo,clickHandler:this._onDelete,disabled:r.syncing,label:a.delete}:null]))}_renderOwnerAdminNoticeIfApplicable(e){if(e?.reliesOnOwnerAdminPrivileges)return W("calcite-notice",{open:!0,icon:!0,kind:"info",scale:"s",class:P.ownerAdminNotice},W("div",{slot:"message"},this.messages.ownerAdminNotice))}_renderAttachmentAdding(e){const{_attachments:t,EditorPanel:s,_onBack:i,headingLevel:a,messages:o,messagesCommon:n}=this;return W(s,{active:this._isPanelActive(e),key:"attachment-adding-panel",heading:o.addAttachment,headingLevel:a,handleBack:i},W("div",{class:P.panelContent},t.render()),this._renderFooterActions([{label:t.submitting?n.cancel:n.add,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._onAttachmentAdd}]))}_renderAttachmentEditing(e){const{_attachments:t,EditorPanel:s,_onBack:i,activeWorkflow:a,headingLevel:o,messages:n,messagesCommon:r}=this;return a?W(s,{active:this._isPanelActive(e),key:"attachment-editing-panel",heading:n.editAttachment,headingLevel:o,handleBack:i},W("div",{class:P.panelContent},t.render()),a.shouldAllowAttachmentEditing?this._renderFooterActions([{label:r.update,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._onAttachmentUpdate},{...this._deleteButtonCommonInfo,clickHandler:this._onAttachmentDelete,disabled:t.submitting,label:r.delete}]):void 0):null}_renderMessage(e){return W("div",{key:"panel-content-message",class:P.panelContentMessage},e)}_renderFooterActions(e){return W("div",{key:"footer-actions",slot:"footer",class:P.actions},e.filter(i).map((({type:e,disabled:t,class:s,clickHandler:i,label:a,...o},n)=>W("calcite-button",{key:`action-${n}`,slot:"footer-actions",class:s,disabled:t??!1,onclick:i,width:"full",...o},a))))}_renderPrompt(){const e=this._prompt;if(!e)return null;const{title:t,message:s,context:i,actions:a}=e,o=a.secondary;let n;switch(i){case"danger":n="danger";break;case"info":n="brand";break;default:n="neutral"}const r=W("calcite-button",{afterCreate:U,appearance:"solid",key:"prompt-primary-button",kind:n,onclick:a.primary.action,scale:"m",width:o?"half":"full"},a.primary.label),l=o&&W("calcite-button",{appearance:"outline",key:"prompt-secondary-button",kind:n,onclick:o.action,scale:"m",width:"half"},o.label);return W("calcite-scrim",null,W("div",{class:`${P.promptContainer}--${i}`},W("div",{class:P.promptHeader},W("calcite-icon",{icon:"exclamation-mark-triangle"}),W(y,{class:P.promptHeading,level:this.headingLevel},t)),W("div",{class:P.promptMessage},s),W("div",{class:P.promptDivider}),W("div",{class:P.promptActions},l,r)))}_renderLanding(e){const{EditorPanel:t,headingLevel:s,messages:i,viewModel:a}=this,{canUpdate:o}=a,n=this._featureTemplates.viewModel.numberOfFeatureTemplates,r=!o&&0===n;return W(t,{active:this._isPanelActive(e),key:"landing-panel",heading:i.widgetLabel,headingLevel:s},W("div",{class:P.panelContent},o&&W("div",{key:"edit-actions",class:P.panelContentSection},this._renderUpdateActions(e)),n>0&&W("div",{key:"create-actions",class:P.panelContentSection},this._renderCreateActions()),r&&W("div",{key:"no-content",class:P.panelContentMessage},i.noEditableLayers)),this._renderFooterHelpMessages())}_renderFooterHelpMessages(){const{activeWorkflow:e,messages:t,view:s}=this,i=e?.helpMessage,a=i?t["3d"===s?.type?"helpMessages3d":"helpMessages2d"]?.[i]:null;return a?W("div",{key:"footer-actions",slot:"footer",class:P.helpMessage},a):null}_renderUpdateActions(e){const{messages:t,messagesCommon:s}=this;return W("div",{key:"update-actions"},W(y,{level:b(this.headingLevel)},t.editFeatures),W("calcite-list",{selectionMode:"single",selectionAppearance:"border"},W("calcite-list-item",{selected:"awaiting-feature-to-update"===e,label:s.select,onCalciteListItemSelect:this._onToggleUpdateWorkflow},W("calcite-icon",{icon:"cursor",slot:"content-start"}))))}_renderCreateActions(){const{_featureTemplates:e,headingLevel:t,messages:s}=this;return W("div",{key:"create-actions"},W(y,{level:b(t)},s.createFeatures),W("div",{key:"templates",class:P.featureTemplatesContainer},e.render()))}_renderFeatureList(e){const{EditorPanel:t,_onBack:s,headingLevel:a,messages:o,messagesTemplates:n,viewModel:{activeWorkflow:r,editableItems:l}}=this;if("update"!==r?.type)return null;const c=r.data.candidates,d=E(o.multipleFeaturesTemplate,{total:c.length}),p=new Map;let m=0;c.map((e=>({label:this._getLabel(e),id:e.attributes[e.layer.objectIdField],data:e}))).filter((e=>{const{label:t,data:s}=e,i=this._filterText.toLowerCase(),{title:a}=s.layer,o=l.find((e=>e.layer===s.layer));if(!o)return null;const{attachmentsOnUpdateEnabled:n,supports:r}=o;return(r.includes("update")||r.includes("delete")||n)&&(!i||t?.toLowerCase().includes(i)||a?.toLowerCase().includes(i))})).filter(i).forEach((e=>{m++;const t=e.data.layer;p.has(t)?p.get(t)?.items.push(e):p.set(t,{id:`${t.id}`,label:t.title??"",items:[e]})}));const h=l.toArray().map((({layer:e})=>p.get(e))).filter(i),u=m>10||this._filterText.length>0;return W(t,{active:this._isPanelActive(e),key:"feature-list",heading:d,headingLevel:a,handleBack:s},W("div",{class:P.panelContent},W("div",{class:P.panelContentSection},k({id:this.id,enableListScroll:!1,filterEnabled:u,filterText:this._filterText,items:h,messages:{filterPlaceholder:n.filterPlaceholder,noItems:n.noItems,noMatches:n.noMatches},onItemMouseEnter:e=>this.viewModel.selectFeature(e.data),onItemMouseLeave:()=>this.viewModel.selectFeature(null),onItemSelect:e=>this.viewModel.selectFeature(e.data,!0),onFilterChange:e=>this._filterText=e}))))}_isPanelActive(e){return this.viewModel.state===e}_renderSettings(){const e=this.visibleElements,t=e.snappingControls,s=e.sketchTooltipControls;return t||s?W("calcite-accordion",{class:P.settingsContainer,appearance:"transparent"},W("calcite-accordion-item",{heading:this.messagesCommon?.settings,iconStart:"gear"},s&&W(T,{tooltipOptions:this.tooltipOptions}),t&&W(A,{snappingOptions:this.snappingOptions,view:this.view,visibleElements:e.snappingControlsElements,afterCreate:e=>e.layerListOpen=!1}))):null}_getLabel(e){const t=e.layer;if(!t)return null;const{objectIdField:s}=t,{attributes:i}=e,a=m(t);return a&&i[a]&&`${i[a]}`||E(this.messages.untitledFeatureTemplate,{id:i[s]})}_onSave(){this.viewModel.save()}_onDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteFeatureFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepFeature,action:this._clearPrompt}}}}async _onToggleUpdateWorkflow(){const{viewModel:e}=this;e.canUpdate&&(e.activeWorkflow&&"awaiting-feature-to-update"===e.state?await e.cancelWorkflow():await e.startUpdateWorkflowAtFeatureSelection())}async _onBack(e){return e?.stopPropagation(),this.viewModel.back()}_onAttachmentAdd(){const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.addFile(),e.previous()):this._attachments.addAttachment().then((()=>e.previous())))}_onAttachmentUpdate(){const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.previous()):this._attachments.updateAttachment().then((()=>e.previous())))}_onAttachmentDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}}}};e([c()],O.prototype,"_featureForm",void 0),e([c()],O.prototype,"_attachments",void 0),e([c()],O.prototype,"_featureTemplates",void 0),e([c()],O.prototype,"_filterText",void 0),e([c()],O.prototype,"_prompt",void 0),e([c()],O.prototype,"_spinner",void 0),e([c()],O.prototype,"_deleteButtonCommonInfo",null),e([c({readOnly:!0})],O.prototype,"activeWorkflow",null),e([c()],O.prototype,"allowedWorkflows",null),e([c()],O.prototype,"useDeprecatedCreateWorkflow",void 0),e([c()],O.prototype,"headingLevel",void 0),e([c()],O.prototype,"iconClass",void 0),e([c()],O.prototype,"label",null),e([c()],O.prototype,"labelOptions",null),e([c()],O.prototype,"layerInfos",null),e([c(),C("esri/widgets/Editor/t9n/Editor")],O.prototype,"messages",void 0),e([c(),C("esri/t9n/common")],O.prototype,"messagesCommon",void 0),e([c(),C("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],O.prototype,"messagesTemplates",void 0),e([c()],O.prototype,"snappingOptions",null),e([c()],O.prototype,"tooltipOptions",null),e([c()],O.prototype,"supportingWidgetDefaults",void 0),e([c()],O.prototype,"view",null),e([c(),F(["workflow-cancel","workflow-commit"])],O.prototype,"viewModel",void 0),e([c()],O.prototype,"visibleElements",void 0),e([d("visibleElements")],O.prototype,"castVisibleElements",null),e([M()],O.prototype,"_onSave",null),e([M()],O.prototype,"_onDelete",null),e([M()],O.prototype,"_onToggleUpdateWorkflow",null),e([M()],O.prototype,"_onBack",null),e([M()],O.prototype,"_onAttachmentAdd",null),e([M()],O.prototype,"_onAttachmentUpdate",null),e([M()],O.prototype,"_onAttachmentDelete",null),O=e([p(I)],O);const D=O;export{D as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import s from"../core/Logger.js";import{isSome as i}from"../core/maybe.js";import{createDeferred as a}from"../core/promiseUtils.js";import{watch as o,on as n,when as r,initial as l}from"../core/reactiveUtils.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{getDisplayFieldName as m}from"../layers/support/fieldUtils.js";import h from"./Attachments.js";import u from"./FeatureForm.js";import g from"./FeatureTemplates.js";import _ from"./Spinner.js";import w from"./Widget.js";import{workflowDeprecation as f}from"./Editor/deprecationUtils.js";import v from"./Editor/EditorViewModel.js";import{ItemList as k}from"./FeatureTemplates/ItemList.js";import{Heading as y,incrementHeadingLevel as b}from"./support/Heading.js";import A from"./support/SnappingControls.js";import{accessibleHandler as M}from"./support/decorators/accessibleHandler.js";import{messageBundle as C}from"./support/decorators/messageBundle.js";import{vmEvent as F}from"./support/decorators/vmEvent.js";import{tsx as W}from"./support/jsxFactory.js";import"./support/widgetUtils.js";import{SketchTooltipControls as T}from"./support/SketchTooltipControls/SketchTooltipControls.js";import{substitute as E}from"../intl/substitute.js";const S="esri-editor",j=`${S}__panel`,L=`${S}__prompt`,P={base:`${S} esri-widget esri-widget--panel`,message:`${S}__message`,actions:`${S}__actions`,helpMessage:`${S}__help-message`,progressBar:`${S}__progress-bar`,panelToolbar:`${j}-toolbar`,panelContent:`${j}-content`,panelContentMessage:`${j}-content__message`,panelContentSection:`${j}-content__section`,panelContentSectionGroup:`${j}-content__section__group`,panelContentScrimContainer:`${j}-content__scrim-container`,settingsContainer:`${S}__settings`,updateFeaturesActionButtons:`${S}__update-features-action-buttons`,updateFeaturesActionButtonsButton:`${S}__update-features-action-buttons--button`,featureTemplatesContainer:`${S}__feature-templates-container`,ownerAdminNotice:`${S}__owner-admin-notice`,promptContainer:L,promptHeader:`${L}__header`,promptHeading:`${L}__header__heading`,promptMessage:`${L}__message`,promptDivider:`${L}__divider`,promptActions:`${L}__actions`,warningIcon:"esri-icon-notice-triangle",widgetIcon:"esri-icon-edit"},B={undoRedoButtons:!1,snappingControls:!0,snappingControlsElements:{header:!1,enabledToggle:!0,selfEnabledToggle:!0,featureEnabledToggle:!0,layerList:!0},sketchTooltipControls:!0};function U(e){e.focus()}const I="esri.widgets.Editor",$=s.getLogger(I);let O=class extends(t(w)){constructor(e,t){super(e,t),this._featureForm=new u,this._attachments=new h({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._featureTemplates=new g({enableListScroll:!1}),this._filterText="",this._prompt=null,this._spinner=new _,this.useDeprecatedCreateWorkflow=!1,this.headingLevel=4,this.iconClass=P.widgetIcon,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.supportingWidgetDefaults=null,this.viewModel=new v,this.visibleElements={...B},this.EditorPanel=({handleBack:e,heading:t,headingLevel:s,key:i},...a)=>{const{messagesCommon:o,viewModel:n,visibleElements:r}=this,l=n.sketchViewModel,c=n.syncing||this._attachments.submitting;return W("calcite-flow-item",{closable:!1,heading:t,headingLevel:s,key:i,loading:c,onCalciteFlowItemBack:e??void 0},W("div",{key:"panel-toolbar",class:P.panelToolbar},this._renderSettings(),r.undoRedoButtons&&[W("calcite-button",{key:"undo-button",label:o.undo,appearance:"transparent",kind:"neutral",alignment:"center",iconStart:"undo",scale:"l",disabled:!l.canUndo(),onclick:l.undo.bind(l)},o.undo),W("calcite-button",{key:"redo-button",label:o.redo,appearance:"transparent",kind:"neutral",alignment:"center",iconStart:"redo",scale:"l",disabled:!l.canRedo(),onclick:l.redo.bind(l)},o.redo)]),...a)},this._showDiscardWarning=()=>{const{messages:e}=this,t="create"===this.activeWorkflow?.type,s=a();return this._prompt={title:e[t?"cancelAddTitle":"cancelEditTitle"],message:e[t?"cancelAddWarningMessage":"cancelEditWarningMessage"],context:"danger",actions:{primary:{label:e[t?"discardFeature":"discardEdits"],action:()=>{s.resolve(),this._clearPrompt()}},secondary:{label:e[t?"continueAdding":"continueEditing"],action:()=>{s.reject(),this._clearPrompt()}}}},s.promise},this._onAttachmentDeleteConfirm=async()=>{const e=this._attachments,{activeWorkflow:t}=this.viewModel;t&&("create-features"===t.type?e.deleteFile():(await e.deleteAttachment(e.viewModel.activeAttachmentInfo),this._clearPrompt()),await t.previous(),this._clearPrompt())},this._onAttachmentsError=e=>{this._prompt={title:this.messages.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:this.messagesCommon.form.ok,action:this._clearPrompt}}}},this._clearPrompt=()=>{this._prompt=null},this._onBack=this._onBack.bind(this),this._onSave=this._onSave.bind(this),this._onDelete=this._onDelete.bind(this),this._onToggleUpdateWorkflow=this._onToggleUpdateWorkflow.bind(this),this._onAttachmentAdd=this._onAttachmentAdd.bind(this),this._onAttachmentUpdate=this._onAttachmentUpdate.bind(this),this._onAttachmentDelete=this._onAttachmentDelete.bind(this)}initialize(){const e=()=>this.scheduleRender();this.addHandles([o((()=>b(this.headingLevel)),(e=>{this._featureForm.headingLevel=e,this._featureTemplates.headingLevel=e}),l),n((()=>this.viewModel.featureTemplatesViewModel),"select",(async({item:e,oldItem:t})=>{this.viewModel.activeWorkflow&&await this.viewModel.cancelWorkflow(),e&&e.id!==t?.id&&(this.useDeprecatedCreateWorkflow?this.startCreateWorkflowAtFeatureCreation(e):this.startCreateFeaturesWorkflowAtFeatureCreation(e))})),o((()=>this.viewModel.selectedTemplateItem),(e=>this._featureTemplates.select(e,!1))),n((()=>this.viewModel.activeWorkflow),"cancel-request",(({controller:e})=>{const{messages:t,messagesCommon:s}=this;this._prompt={title:t.cancelRequestTitle,message:t.cancelRequestWarningMessage,context:"danger",actions:{primary:{label:s.form.yes,action:()=>{e.allow(),this._clearPrompt()}},secondary:{label:s.form.no,action:()=>{e.deny(),this._clearPrompt()}}}}})),o((()=>this.viewModel),(e=>{this._featureForm.viewModel=e?.featureFormViewModel??null,this._attachments.viewModel=e?.attachmentsViewModel??null,this._featureTemplates.viewModel=e?.featureTemplatesViewModel??null,this._spinner.viewModel=e?.spinnerViewModel??null,e.showDiscardPrompt=this._showDiscardWarning}),l),o((()=>this.view),((e,t)=>{const s=`editor-${this.id}-spinner`;t?.ui.remove(this._spinner,s),e?.ui.add(this._spinner,{key:s,position:"manual"})}),l),n((()=>this.viewModel?.sketchViewModel),"create",e),r((()=>this.supportingWidgetDefaults),(e=>{this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel.set(e.sketch)}),l),r((()=>this._attachments?.error),(e=>this._onAttachmentsError(e))),r((()=>this.viewModel?.failures),(e=>{const{messages:t}=this,[{error:s,retry:i,cancel:a}]=e;this._prompt={title:t.errorWarningTitle,message:E(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{i(),this._clearPrompt()}},secondary:{label:t.ignore,action:()=>{a(),this._clearPrompt()}}}}})),o((()=>this.viewModel?.state),(e=>{switch(e){case"awaiting-feature-to-update":case"ready":case"disabled":this._filterText="",this._featureTemplates.filterText=""}})),o((()=>[this._attachments?.selectedFile,this._attachments?.submitting]),e),o((()=>this.viewModel.featureFormDisabled),(e=>this._featureForm.disabled=e)),n((()=>this.view),"key-down",(e=>{"Escape"===e.key&&this.viewModel.back()}))])}destroy(){this._attachments.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy()}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-accordion-item.js"),import("@esri/calcite-components/dist/components/calcite-accordion.js"),import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-flow-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-list-item.js"),import("@esri/calcite-components/dist/components/calcite-list.js"),import("@esri/calcite-components/dist/components/calcite-notice.js"),import("@esri/calcite-components/dist/components/calcite-scrim.js")])}get _deleteButtonCommonInfo(){return{appearance:"outline",kind:"danger",type:"primary"}}get activeWorkflow(){return this.viewModel.activeWorkflow}get allowedWorkflows(){return this.viewModel.allowedWorkflows}set allowedWorkflows(e){this.viewModel.allowedWorkflows=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get labelOptions(){return this.viewModel.labelOptions}set labelOptions(e){this.viewModel.labelOptions=e}get layerInfos(){return this.viewModel.layerInfos}set layerInfos(e){this.viewModel.layerInfos=e}get snappingOptions(){return this.viewModel.snappingOptions}set snappingOptions(e){this.viewModel.snappingOptions=e}get tooltipOptions(){return this.viewModel.tooltipOptions}set tooltipOptions(e){this.viewModel.tooltipOptions=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...B,...e,snappingControlsElements:{...B.snappingControlsElements,...e?.snappingControlsElements}}}startCreateWorkflowAtFeatureTypeSelection(){return f($,"startCreateWorkflowAtFeatureTypeSelection","startCreateFeaturesWorkflowAtFeatureTypeSelection"),this.viewModel.startCreateWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateWorkflowAtFeatureCreation(e){return f($,"startCreateWorkflowAtFeatureCreation","startCreateFeaturesWorkflowAtFeatureCreation"),this.viewModel.startCreateWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateWorkflowAtFeatureEdit(e){return f($,"startCreateWorkflowAtFeatureEdit"),this.viewModel.startCreateWorkflowAtFeatureEdit(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{viewModel:e}=this;if(!e)return W("div",{class:P.base});const{state:t}=e;return W("div",{class:P.base},W("calcite-flow",null,e.pageStack.map((e=>this._renderPage(e,t))),this._renderPage(e.page,t)),this._renderPrompt())}_renderPage(e,t){switch(e){case"disabled":break;case"ready":return this._renderLanding(t);case"awaiting-feature-creation-info":return this._renderTemplates(t);case"creating-features":case"editing-new-feature":case"editing-existing-feature":return this._renderAttributeEditing(t);case"awaiting-update-feature-candidate":return this._renderFeatureList(t);case"adding-attachment":return this._renderAttachmentAdding(t);case"editing-attachment":return this._renderAttachmentEditing(t)}return W("div",null)}_renderTemplates(e){const{EditorPanel:t,headingLevel:s,messages:i,_onBack:a}=this;return W(t,{active:this._isPanelActive(e),key:"templates-panel",handleBack:a,heading:i.selectTemplate,headingLevel:s},W("div",{class:P.panelContent},this._featureTemplates.render()))}_renderAttributeEditing(e){const{activeWorkflow:t,EditorPanel:s,messages:i,messagesCommon:a,headingLevel:o,_onBack:n,viewModel:r}=this;if(!t)return null;const l=t.type,c=r.featureFormViewModel,d="update"===l&&!t.data.edits.modified||r.syncing||c.updating,p="update"===l?i.editFeature:i.createFeatures,m="update"===l?a.update:a.create,h="create-features"===l&&"create-new"===t.createFeatureState,u="create-features"===l?t.numPendingFeatures:0,g=u>1?E(i.createFeaturesTemplate,{numFeatures:u}):m,_=t.shouldShowAttachments,w=c.inputFields.every((e=>!e.visible))&&!_?this._renderMessage(E(i.clickToFinishTemplate,{button:m})):W("div",{key:"panel-content-section",class:P.panelContentSection},this._renderOwnerAdminNoticeIfApplicable(t),W("div",{class:P.panelContentSectionGroup},this._featureForm.render(),_&&W("div",{key:"attachments"},W(y,{level:b(o)},i.attachments),this._attachments.render())));return W(s,{active:this._isPanelActive(e),key:"attribute-editing-panel",heading:p,headingLevel:o,handleBack:n},W("div",{key:"panel-content",class:this.classes(P.panelContent,{[P.panelContentScrimContainer]:h})},w,h&&W("calcite-scrim",null)),this._renderFooterActions([{clickHandler:this._onSave,disabled:d,label:g,type:"primary"},r.shouldShowDeleteButton?{...this._deleteButtonCommonInfo,clickHandler:this._onDelete,disabled:r.syncing,label:a.delete}:null]))}_renderOwnerAdminNoticeIfApplicable(e){if(e?.reliesOnOwnerAdminPrivileges)return W("calcite-notice",{open:!0,kind:"info",scale:"s",class:P.ownerAdminNotice},W("div",{slot:"message"},this.messages.ownerAdminNotice))}_renderAttachmentAdding(e){const{_attachments:t,EditorPanel:s,_onBack:i,headingLevel:a,messages:o,messagesCommon:n}=this;return W(s,{active:this._isPanelActive(e),key:"attachment-adding-panel",heading:o.addAttachment,headingLevel:a,handleBack:i},W("div",{class:P.panelContent},t.render()),this._renderFooterActions([{label:t.submitting?n.cancel:n.add,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._onAttachmentAdd}]))}_renderAttachmentEditing(e){const{_attachments:t,EditorPanel:s,_onBack:i,activeWorkflow:a,headingLevel:o,messages:n,messagesCommon:r}=this;return a?W(s,{active:this._isPanelActive(e),key:"attachment-editing-panel",heading:n.editAttachment,headingLevel:o,handleBack:i},W("div",{class:P.panelContent},t.render()),a.shouldAllowAttachmentEditing?this._renderFooterActions([{label:r.update,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._onAttachmentUpdate},{...this._deleteButtonCommonInfo,clickHandler:this._onAttachmentDelete,disabled:t.submitting,label:r.delete}]):void 0):null}_renderMessage(e){return W("div",{key:"panel-content-message",class:P.panelContentMessage},e)}_renderFooterActions(e){return W("div",{key:"footer-actions",slot:"footer",class:P.actions},e.filter(i).map((({type:e,disabled:t,class:s,clickHandler:i,label:a,...o},n)=>W("calcite-button",{key:`action-${n}`,slot:"footer-actions",class:s,disabled:t??!1,onclick:i,width:"full",...o},a))))}_renderPrompt(){const e=this._prompt;if(!e)return null;const{title:t,message:s,context:i,actions:a}=e,o=a.secondary;let n;switch(i){case"danger":n="danger";break;case"info":n="brand";break;default:n="neutral"}const r=W("calcite-button",{afterCreate:U,appearance:"solid",key:"prompt-primary-button",kind:n,onclick:a.primary.action,scale:"m",width:o?"half":"full"},a.primary.label),l=o&&W("calcite-button",{appearance:"outline",key:"prompt-secondary-button",kind:n,onclick:o.action,scale:"m",width:"half"},o.label);return W("calcite-scrim",null,W("div",{class:`${P.promptContainer}--${i}`},W("div",{class:P.promptHeader},W("calcite-icon",{icon:"exclamation-mark-triangle"}),W(y,{class:P.promptHeading,level:this.headingLevel},t)),W("div",{class:P.promptMessage},s),W("div",{class:P.promptDivider}),W("div",{class:P.promptActions},l,r)))}_renderLanding(e){const{EditorPanel:t,headingLevel:s,messages:i,viewModel:a}=this,{canUpdate:o}=a,n=this._featureTemplates.viewModel.numberOfFeatureTemplates,r=!o&&0===n;return W(t,{active:this._isPanelActive(e),key:"landing-panel",heading:i.widgetLabel,headingLevel:s},W("div",{class:P.panelContent},o&&W("div",{key:"edit-actions",class:P.panelContentSection},this._renderUpdateActions(e)),n>0&&W("div",{key:"create-actions",class:P.panelContentSection},this._renderCreateActions()),r&&W("div",{key:"no-content",class:P.panelContentMessage},i.noEditableLayers)),this._renderFooterHelpMessages())}_renderFooterHelpMessages(){const{activeWorkflow:e,messages:t,view:s}=this,i=e?.helpMessage,a=i?t["3d"===s?.type?"helpMessages3d":"helpMessages2d"]?.[i]:null;return a?W("div",{key:"footer-actions",slot:"footer",class:P.helpMessage},a):null}_renderUpdateActions(e){const{messages:t,messagesCommon:s}=this;return W("div",{key:"update-actions"},W(y,{level:b(this.headingLevel)},t.editFeatures),W("calcite-list",{selectionMode:"single",selectionAppearance:"border"},W("calcite-list-item",{selected:"awaiting-feature-to-update"===e,label:s.select,onCalciteListItemSelect:this._onToggleUpdateWorkflow},W("calcite-icon",{icon:"cursor",slot:"content-start"}))))}_renderCreateActions(){const{_featureTemplates:e,headingLevel:t,messages:s}=this;return W("div",{key:"create-actions"},W(y,{level:b(t)},s.createFeatures),W("div",{key:"templates",class:P.featureTemplatesContainer},e.render()))}_renderFeatureList(e){const{EditorPanel:t,_onBack:s,headingLevel:a,messages:o,messagesTemplates:n,viewModel:{activeWorkflow:r,editableItems:l}}=this;if("update"!==r?.type)return null;const c=r.data.candidates,d=E(o.multipleFeaturesTemplate,{total:c.length}),p=new Map;let m=0;c.map((e=>({label:this._getLabel(e),id:e.attributes[e.layer.objectIdField],data:e}))).filter((e=>{const{label:t,data:s}=e,i=this._filterText.toLowerCase(),{title:a}=s.layer,o=l.find((e=>e.layer===s.layer));if(!o)return null;const{attachmentsOnUpdateEnabled:n,supports:r}=o;return(r.includes("update")||r.includes("delete")||n)&&(!i||t?.toLowerCase().includes(i)||a?.toLowerCase().includes(i))})).filter(i).forEach((e=>{m++;const t=e.data.layer;p.has(t)?p.get(t)?.items.push(e):p.set(t,{id:`${t.id}`,label:t.title??"",items:[e]})}));const h=l.toArray().map((({layer:e})=>p.get(e))).filter(i),u=m>10||this._filterText.length>0;return W(t,{active:this._isPanelActive(e),key:"feature-list",heading:d,headingLevel:a,handleBack:s},W("div",{class:P.panelContent},W("div",{class:P.panelContentSection},k({id:this.id,enableListScroll:!1,filterEnabled:u,filterText:this._filterText,items:h,messages:{filterPlaceholder:n.filterPlaceholder,noItems:n.noItems,noMatches:n.noMatches},onItemMouseEnter:e=>this.viewModel.selectFeature(e.data),onItemMouseLeave:()=>this.viewModel.selectFeature(null),onItemSelect:e=>this.viewModel.selectFeature(e.data,!0),onFilterChange:e=>this._filterText=e}))))}_isPanelActive(e){return this.viewModel.state===e}_renderSettings(){const e=this.visibleElements,t=e.snappingControls,s=e.sketchTooltipControls;return t||s?W("calcite-accordion",{class:P.settingsContainer,appearance:"transparent"},W("calcite-accordion-item",{heading:this.messagesCommon?.settings,iconStart:"gear"},s&&W(T,{tooltipOptions:this.tooltipOptions}),t&&W(A,{snappingOptions:this.snappingOptions,view:this.view,visibleElements:e.snappingControlsElements,afterCreate:e=>e.layerListOpen=!1}))):null}_getLabel(e){const t=e.layer;if(!t)return null;const{objectIdField:s}=t,{attributes:i}=e,a=m(t);return a&&i[a]&&`${i[a]}`||E(this.messages.untitledFeatureTemplate,{id:i[s]})}_onSave(){this.viewModel.save()}_onDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.deleteFeatureFromWorkflow(),this._clearPrompt()}},secondary:{label:e.keepFeature,action:this._clearPrompt}}}}async _onToggleUpdateWorkflow(){const{viewModel:e}=this;e.canUpdate&&(e.activeWorkflow&&"awaiting-feature-to-update"===e.state?await e.cancelWorkflow():await e.startUpdateWorkflowAtFeatureSelection())}async _onBack(e){return e?.stopPropagation(),this.viewModel.back()}_onAttachmentAdd(){const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.addFile(),e.previous()):this._attachments.addAttachment().then((()=>e.previous())))}_onAttachmentUpdate(){const{activeWorkflow:e}=this.viewModel;e&&("create-features"===e.type?(this._attachments.updateFile(),e.previous()):this._attachments.updateAttachment().then((()=>e.previous())))}_onAttachmentDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:this._onAttachmentDeleteConfirm},secondary:{label:e.keepAttachment,action:this._clearPrompt}}}}};e([c()],O.prototype,"_featureForm",void 0),e([c()],O.prototype,"_attachments",void 0),e([c()],O.prototype,"_featureTemplates",void 0),e([c()],O.prototype,"_filterText",void 0),e([c()],O.prototype,"_prompt",void 0),e([c()],O.prototype,"_spinner",void 0),e([c()],O.prototype,"_deleteButtonCommonInfo",null),e([c({readOnly:!0})],O.prototype,"activeWorkflow",null),e([c()],O.prototype,"allowedWorkflows",null),e([c()],O.prototype,"useDeprecatedCreateWorkflow",void 0),e([c()],O.prototype,"headingLevel",void 0),e([c()],O.prototype,"iconClass",void 0),e([c()],O.prototype,"label",null),e([c()],O.prototype,"labelOptions",null),e([c()],O.prototype,"layerInfos",null),e([c(),C("esri/widgets/Editor/t9n/Editor")],O.prototype,"messages",void 0),e([c(),C("esri/t9n/common")],O.prototype,"messagesCommon",void 0),e([c(),C("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],O.prototype,"messagesTemplates",void 0),e([c()],O.prototype,"snappingOptions",null),e([c()],O.prototype,"tooltipOptions",null),e([c()],O.prototype,"supportingWidgetDefaults",void 0),e([c()],O.prototype,"view",null),e([c(),F(["workflow-cancel","workflow-commit"])],O.prototype,"viewModel",void 0),e([c()],O.prototype,"visibleElements",void 0),e([d("visibleElements")],O.prototype,"castVisibleElements",null),e([M()],O.prototype,"_onSave",null),e([M()],O.prototype,"_onDelete",null),e([M()],O.prototype,"_onToggleUpdateWorkflow",null),e([M()],O.prototype,"_onBack",null),e([M()],O.prototype,"_onAttachmentAdd",null),e([M()],O.prototype,"_onAttachmentUpdate",null),e([M()],O.prototype,"_onAttachmentDelete",null),O=e([p(I)],O);const D=O;export{D as default};