@arcgis/core 4.30.0-next.20240212 → 4.30.0-next.20240213

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 (69) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/05ebb9cec0e1826b283f.js +1 -0
  3. package/assets/esri/core/workers/chunks/0d54451c740f54a59f49.js +1 -0
  4. package/assets/esri/core/workers/chunks/18551a7eb5a9b88aa0dc.js +1 -0
  5. package/assets/esri/core/workers/chunks/24d19abc680b341d13bb.js +1 -0
  6. package/assets/esri/core/workers/chunks/{3f4d63436c3de04a6ebb.js → 254b4ee3621bbe345bb1.js} +1 -1
  7. package/assets/esri/core/workers/chunks/2d682ee6e5d66f2ea5cd.js +1 -0
  8. package/assets/esri/core/workers/chunks/{d5484d470121de2b403b.js → 36d091be859bbb1a149b.js} +1 -1
  9. package/assets/esri/core/workers/chunks/50b41f91be903a0977f9.js +1 -0
  10. package/assets/esri/core/workers/chunks/50bb67f2eeace5d50673.js +1 -0
  11. package/assets/esri/core/workers/chunks/784b6a8216b97440b180.js +1 -0
  12. package/assets/esri/core/workers/chunks/{7f7a4de2cd4ab71b9aee.js → 8d119dc0a92ad3612daa.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{0014635097a32ad38895.js → a854611d1a86b838c6ad.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{50a5abd75fa7dbb571a5.js → ccd53b81c2688dd11584.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{b2b8e6a0b3f70ada2799.js → e4da908079417cc2f495.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{af0314c2b5b7dc4f5bbd.js → e6dbf0a7b7b1cf64f23f.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{eba72ff1726ff6998204.js → f03d62ab7806b68d0b62.js} +1 -1
  18. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  19. package/geometry/Mesh.js +1 -1
  20. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  21. package/interfaces.d.ts +172 -14
  22. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  23. package/layers/SceneLayer.js +1 -1
  24. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  25. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  26. package/package.json +2 -2
  27. package/portal/support/resourceUtils.js +1 -1
  28. package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
  29. package/rest/support/meshFeatureSet.js +1 -1
  30. package/support/revision.js +1 -1
  31. package/symbols/cim/constants.js +1 -1
  32. package/symbols/support/previewSymbol2D.js +1 -1
  33. package/versionManagement/support/versionManagementUtils.js +1 -1
  34. package/views/2d/engine/webgl/collisions/CollisionEngine.js +1 -1
  35. package/views/2d/engine/webgl/collisions/CollisionGrid.js +1 -1
  36. package/views/2d/engine/webgl/collisions/LabelMetric.js +1 -1
  37. package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
  38. package/views/2d/engine/webgl/shaderGraph/GLSLShaderModule.js +1 -1
  39. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  40. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
  41. package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js +1 -1
  42. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/constants.js +1 -1
  43. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  44. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  45. package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
  46. package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
  47. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  48. package/views/3d/interactive/editingTools/transformGraphic/ExtentScale.js +1 -1
  49. package/views/3d/interactive/editingTools/transformGraphic/extentUtils.js +1 -1
  50. package/views/3d/layers/I3SMeshView3D.js +1 -1
  51. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  52. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  53. package/views/draw/DrawOperation.js +1 -1
  54. package/views/draw/support/Box.js +1 -1
  55. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  56. package/views/support/automaticLengthMeasurementUtils.js +1 -1
  57. package/views/support/extentUtils.js +5 -0
  58. package/widgets/BasemapLayerList.js +1 -1
  59. package/widgets/FeatureForm.js +1 -1
  60. package/widgets/LayerList.js +1 -1
  61. package/widgets/TableList.js +1 -1
  62. package/assets/esri/core/workers/chunks/062629a9b4695dea8bf8.js +0 -1
  63. package/assets/esri/core/workers/chunks/37803888bd9a537481a7.js +0 -1
  64. package/assets/esri/core/workers/chunks/5bfc5ffad705aaaafcd4.js +0 -1
  65. package/assets/esri/core/workers/chunks/655f4560fb36a0d9ff0b.js +0 -1
  66. package/assets/esri/core/workers/chunks/b927b655e955abe00d48.js +0 -1
  67. package/assets/esri/core/workers/chunks/bd2d64a5cd8e7a39c235.js +0 -1
  68. package/assets/esri/core/workers/chunks/d2417d179d015f1193a1.js +0 -1
  69. package/assets/esri/core/workers/chunks/f75ec599f53c66cab194.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import{id as t}from"../../../kernel.js";import s from"../../../request.js";import r from"../../../TimeExtent.js";import{isSome as a}from"../../../core/arrayUtils.js";import i from"../../../core/Error.js";import has from"../../../core/has.js";import{JSONMap as o}from"../../../core/jsonMap.js";import n from"../../../core/Loadable.js";import u from"../../../core/Logger.js";import{setDeepValue as l}from"../../../core/object.js";import{debounce as c,after as d,throwIfAbortError as p}from"../../../core/promiseUtils.js";import{join as y}from"../../../core/urlUtils.js";import{generateBracedUUID as h}from"../../../core/uuid.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import g from"../../../geometry/Extent.js";import{isRelativeVertexSpace as w,toRelativeVertexSpace as S}from"../../../geometry/support/meshVertexSpaceUtils.js";import{isOriginalExternal as q}from"../../../geometry/support/meshUtils/External.js";import{createFeatureEditResult as E,getFeatureJSON as O,getFeatureIds as R,getAttachmentEditsJSON as b,isProtectedOrPrivateVersionError as A,unpackEditResultData as F,createEditedFeatures as _}from"../applyEditsUtils.js";import{createDrawingInfo as x}from"./support/clientSideDefaults.js";import j from"./support/QueryTask.js";import{isHostedAgolService as I}from"../../support/arcgisLayerUrl.js";import{ensureLayerCredential as v}from"../../support/featureLayerUtils.js";import{getAssetMapTable as T}from"../../support/infoFor3D.js";import{executeQueryJSON as N}from"../../../rest/query/executeQueryJSON.js";import{unapplyEditsZUnitScaling as M}from"../../../rest/query/operations/editsZScale.js";import U from"../../../rest/support/Query.js";import{isSafeToEditVersion as J,isVersionInEditSession as k,currentSessionId as C}from"../../../versionManagement/support/versionManagementUtils.js";import L from"../../../geometry/SpatialReference.js";const Q=new o({originalAndCurrentFeatures:"original-and-current-features",none:"none"}),D=new Set(["Feature Layer","Oriented Imagery Layer","Table","Catalog Layer"]),P=new o({Started:"published",Publishing:"publishing",Stopped:"unavailable"});let V=class extends n{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}})),this._ongoingAssetUploads=new Map}load(e){const t=this.layer.sourceJSON,s=this._fetchService(t,{...e}).then((()=>this.layer.setUserPrivileges(this.sourceJSON.serviceItemId,e))).then((()=>this._ensureLatestMetadata(e)));return this.addResolvingPromise(s),Promise.resolve(this)}get queryTask(){const{capabilities:e,parsedUrl:t,dynamicDataSource:s,infoFor3D:r,gdbVersion:a,spatialReference:i,fieldsIndex:o}=this.layer,n=has("featurelayer-pbf")&&e?.query.supportsFormatPBF&&null==r,u=e?.operations?.supportsQueryAttachments??!1;return new j({url:t.path,pbfSupported:n,fieldsIndex:o,infoFor3D:r,dynamicDataSource:s,gdbVersion:a,sourceSpatialReference:i,queryAttachmentsSupported:u})}async addAttachment(e,t){await this.load();const{layer:r}=this;await v(r,"editing");const a=e.attributes[r.objectIdField],i=r.parsedUrl.path+"/"+a+"/addAttachment",o=this._getLayerRequestOptions(),n=this._getFormDataForAttachment(t,o.query);try{const e=await s(i,{body:n});return E(e.data.addAttachmentResult)}catch(u){throw this._createAttachmentErrorResult(a,u)}}async updateAttachment(e,t,r){await this.load();const{layer:a}=this;await v(a,"editing");const i=e.attributes[a.objectIdField],o=a.parsedUrl.path+"/"+i+"/updateAttachment",n=this._getLayerRequestOptions({query:{attachmentId:t}}),u=this._getFormDataForAttachment(r,n.query);try{const e=await s(o,{body:u});return E(e.data.updateAttachmentResult)}catch(l){throw this._createAttachmentErrorResult(i,l)}}async applyEdits(e,r){await this.load();const{layer:i}=this;await v(i,"editing");const o=i.infoFor3D,n=null!=o,u=n||(r?.globalIdUsed??!1),l=n?await this._uploadMeshesAndGetAssetMapEditsJSON(e):null,c=e.addFeatures?.map((e=>O(this.layer,e,o)))??[],d=(await Promise.all(c)).filter(a),p=e.updateFeatures?.map((e=>O(this.layer,e,o)))??[],y=(await Promise.all(p)).filter(a),h=R(this.layer,e.deleteFeatures,u);M(d,y,i.spatialReference);const m=await b(this.layer,e),f=i.capabilities.editing.supportsAsyncApplyEdits&&n,g=r?.gdbVersion||i.gdbVersion,w={gdbVersion:g,rollbackOnFailure:r?.rollbackOnFailureEnabled,useGlobalIds:u,returnEditMoment:r?.returnEditMoment,usePreviousEditMoment:r?.usePreviousEditMoment,async:f};await J(this.layer.url,g,!0);const S=k(this.layer.url,g||null);r?.returnServiceEditsOption?(w.edits=JSON.stringify([{id:i.layerId,adds:d,updates:y,deletes:h,attachments:m,assetMaps:l}]),w.returnServiceEditsOption=Q.toJSON(r?.returnServiceEditsOption),w.returnServiceEditsInSourceSR=r?.returnServiceEditsInSourceSR):(w.adds=d.length?JSON.stringify(d):null,w.updates=y.length?JSON.stringify(y):null,w.deletes=h.length?u?JSON.stringify(h):h.join(","):null,w.attachments=m&&JSON.stringify(m),w.assetMaps=null!=l?JSON.stringify(l):void 0);const q=this._getLayerRequestOptions({method:"post",query:w});S&&(q.authMode="immediate",q.query.returnEditMoment=!0,q.query.sessionId=C);const E=r?.returnServiceEditsOption?i.url:i.parsedUrl.path;let F;try{F=f?await this._asyncApplyEdits(E+"/applyEdits",q):await s(E+"/applyEdits",q)}catch(_){if(!A(_))throw _;q.authMode="immediate",F=f?await this._asyncApplyEdits(E+"/applyEdits",q):await s(E+"/applyEdits",q)}if(!i.capabilities.operations?.supportsEditing&&i.effectiveCapabilities?.operations?.supportsEditing){const e=t?.findCredential(i.url);await(e?.refreshToken())}return this._createEditsResult(F)}async deleteAttachments(e,t){await this.load();const{layer:r}=this;await v(r,"editing");const a=e.attributes[r.objectIdField],i=r.parsedUrl.path+"/"+a+"/deleteAttachments";try{return(await s(i,this._getLayerRequestOptions({query:{attachmentIds:t.join(",")},method:"post"}))).data.deleteAttachmentResults.map(E)}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:a,url:i}=this.layer,{data:o}=await s(`${i}/${a}`,t),{id:n,extent:u,fullExtent:l,timeExtent:c}=o,d=u||l;return{id:n,fullExtent:d&&g.fromJSON(d),timeExtent:c&&r.fromJSON({start:c[0],end:c[1]})}}))}async queryAttachments(e,t={}){await this.load();const s=this._getLayerRequestOptions(t);return this.queryTask.executeAttachmentQuery(e,s)}async queryFeatures(e,t){await this.load();const s=await this.queryTask.execute(e,{...t,query:this._createRequestQueryOptions(t)});return e.outStatistics?.length&&s.features.length&&s.features.forEach((t=>{const s=t.attributes;e.outStatistics?.forEach((({outStatisticFieldName:e})=>{if(e){const t=e.toLowerCase();t&&t in s&&e!==t&&(s[e]=s[t],delete s[t])}}))})),s}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=y(this.layer.url,"status"),t=await s(e,{query:{f:"json"}});return P.fromJSON(t.data.status)}async uploadAssets(e,t){const{uploadAssets:s}=await import("./support/uploadAssets.js");return s(e,{layer:this.layer,ongoingUploads:this._ongoingAssetUploads},t)}async _asyncApplyEdits(e,t){const r=(await s(e,t)).data.statusUrl;for(;;){const e=(await s(r,{query:{f:"json"},responseType:"json"})).data;switch(e.status){case"Completed":return s(e.resultUrl,{query:{f:"json"},responseType:"json"});case"CompletedWithErrors":throw new i("async-applyEdits-failed","asynchronous applyEdits call failed.");case"Failed ImportChanges":case"InProgress":case"Pending":case"ExportAttachments":case"ExportChanges":case"ExportingData":case"ExportingSnapshot":case"ImportAttachments":case"ProvisioningReplica":case"UnRegisteringReplica":break;default:throw new i("async-applyEdits-failed","asynchronous applyEdits call failed (undefined response status)")}await d($)}}_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 r={};has("featurelayer-advanced-symbols")&&(r.returnAdvancedSymbols=!0),t?.cacheBust&&(r._ts=Date.now());const{data:a}=await s(this.layer.parsedUrl.path,this._getLayerRequestOptions({query:r,signal:t?.signal}));e=a}this.sourceJSON=await this._patchServiceJSON(e,t?.signal);const r=e.type;if(!D.has(r))throw new i("feature-layer-source:unsupported-type",`Source type "${r}" is not supported`)}async _patchServiceJSON(e,t){if("Table"!==e.type&&e.geometryType&&!e?.drawingInfo?.renderer&&!e.defaultSymbol){const t=x(e.geometryType).renderer;l("drawingInfo.renderer",t,e)}if("esriGeometryMultiPatch"===e.geometryType&&e.infoFor3D&&(e.geometryType="mesh"),null==e.extent)try{const{data:r}=await s(this.layer.url,this._getLayerRequestOptions({signal:t}));r.spatialReference&&(e.extent={xmin:0,ymin:0,xmax:0,ymax:0,spatialReference:r.spatialReference})}catch(r){p(r)}return e}async _ensureLatestMetadata(e){if(this.layer.userHasUpdateItemPrivileges&&this.sourceJSON.cacheMaxAge>0)return this._fetchService(null,{...e,cacheBust:!0})}async _uploadMeshesAndGetAssetMapEditsJSON(e){const{addAssetFeatures:t}=e;if(!t?.length)return null;const s=await this._filterRedundantAssetMaps(t);if(!t?.length)return null;const r=new Array,a=new Map;for(const i of s){const{geometry:e}=i,{vertexSpace:t}=e;if(w(t))r.push(e);else{const t=S(e);a.set(t,e),i.geometry=t,r.push(t)}}await this.uploadAssets(r);for(const[i,o]of a)o.addExternalSources(i.metadata.externalSources.items);return{adds:this._getAssetMapEditsJSON(s),updates:[],deletes:[]}}_getAssetMapEditsJSON(e){const t=new Array,s=this.layer.globalIdField,r=this.layer.parsedUrl;for(const a of e){const e=a.geometry,{metadata:i}=e,o=i.getExternalSourcesOnService(r),n=a.getAttribute(s);if(0===o.length){u.getLogger(this).error(`Skipping feature ${n}. The mesh it is associated with has not been uploaded to the service and cannot be mapped to it.`);continue}const{source:l}=o.find(q)??o[0],{vertexSpace:c}=e,d="georeferenced"===c.type?["PROJECT_VERTICES"]:[];for(const s of l)1===s.parts.length?t.push({globalId:h(),parentGlobalId:n,assetName:s.assetName,assetHash:s.parts[0].partHash,flags:d}):u.getLogger(this).error(`Skipping asset ${s.assetName}. It does not have exactly one part, so we cannot map it to a feature.`)}return t}_createEditsResult(e){const t=e.data,{layerId:s}=this.layer,r=[];let a=null;if(Array.isArray(t))for(const o of t)r.push({id:o.id,editedFeatures:o.editedFeatures}),o.id===s&&(a={addResults:o.addResults??[],updateResults:o.updateResults??[],deleteResults:o.deleteResults??[],attachments:o.attachments,editMoment:o.editMoment});else a=t;const i=F(a);if(r.length>0){i.editedFeatureResults=[];for(const e of r){const{editedFeatures:t}=e,s=t?.spatialReference?new L(t.spatialReference):null;i.editedFeatureResults.push({layerId:e.id,editedFeatures:_(t,s)})}}return i}_createAttachmentErrorResult(e,t){const s=t.details.messages?.[0]||t.message,r=t.details.httpStatus||t.details.messageCode;return{objectId:e,globalId:null,error:new i("feature-layer-source:attachment-failure",s,{code:r})}}_getFormDataForAttachment(e,t){const s=e instanceof FormData?e:e&&e.elements?new FormData(e):null;if(s)for(const r in t){const e=t[r];null!=e&&(s.set?s.set(r,e):s.append(r,e))}return s}_getLayerRequestOptions(e={}){const{parsedUrl:t,gdbVersion:s,dynamicDataSource:r}=this.layer;return{...e,query:{gdbVersion:s,layer:r?JSON.stringify({source:r}):void 0,...t.query,f:"json",...this._createRequestQueryOptions(e)},responseType:"json"}}async _filterRedundantAssetMaps(e){const{layer:t}=this,{globalIdField:s,infoFor3D:r,parsedUrl:i}=t;if(null==r||null==s)return e;const o=T(r);if(null==o)return e;const n=y(i.path,`../${o.id}`),u=new Array,l=new Array;for(const a of e)a.geometry.metadata.getExternalSourcesOnService(i).length>0?l.push(a):u.push(a);const c=l.map((e=>e.getAttribute(s))).filter(a);if(0===c.length)return e;const{assetMapFieldRoles:{parentGlobalId:d,assetHash:p}}=r,h=new U;h.where=`${d} IN (${c.map((e=>`'${e}'`))})`,h.outFields=[p,d],h.returnGeometry=!1;const m=await N(n,h),{features:f}=m;return 0===f.length?e:[...u,...l.filter((e=>{const t=e.getAttribute(s);if(!t)return!0;const{metadata:r}=e.geometry,a=f.filter((e=>e.getAttribute(d)===t));if(0===a.length)return!0;const o=a.map((e=>e.getAttribute(p)));return r.getExternalSourcesOnService(i).flatMap((({source:e})=>e.flatMap((e=>e.parts.map((e=>e.partHash)))))).some((e=>o.every((t=>e!==t))))}))]}};e([m()],V.prototype,"type",void 0),e([m({constructOnly:!0})],V.prototype,"layer",void 0),e([m({readOnly:!0})],V.prototype,"queryTask",null),V=e([f("esri.layers.graphics.sources.FeatureLayerSource")],V);const $=1e3,G=V;export{G as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import{id as t}from"../../../kernel.js";import s from"../../../request.js";import r from"../../../TimeExtent.js";import{isSome as a}from"../../../core/arrayUtils.js";import i from"../../../core/Error.js";import has from"../../../core/has.js";import{JSONMap as o}from"../../../core/jsonMap.js";import n from"../../../core/Loadable.js";import u from"../../../core/Logger.js";import{setDeepValue as l}from"../../../core/object.js";import{debounce as c,after as d,throwIfAbortError as p}from"../../../core/promiseUtils.js";import{join as y}from"../../../core/urlUtils.js";import{generateBracedUUID as h}from"../../../core/uuid.js";import{property as m}from"../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../core/accessorSupport/decorators/subclass.js";import g from"../../../geometry/Extent.js";import{isRelativeVertexSpace as w,toRelativeVertexSpace as S}from"../../../geometry/support/meshVertexSpaceUtils.js";import{isOriginalExternal as q}from"../../../geometry/support/meshUtils/External.js";import{createFeatureEditResult as E,getFeatureJSON as O,getFeatureIds as R,getAttachmentEditsJSON as b,isProtectedOrPrivateVersionError as A,unpackEditResultData as F,createEditedFeatures as _}from"../applyEditsUtils.js";import{createDrawingInfo as x}from"./support/clientSideDefaults.js";import j from"./support/QueryTask.js";import{isHostedAgolService as I}from"../../support/arcgisLayerUrl.js";import{ensureLayerCredential as v}from"../../support/featureLayerUtils.js";import{getAssetMapTable as T}from"../../support/infoFor3D.js";import{executeQueryJSON as N}from"../../../rest/query/executeQueryJSON.js";import{unapplyEditsZUnitScaling as M}from"../../../rest/query/operations/editsZScale.js";import U from"../../../rest/support/Query.js";import{isSafeToEditVersion as J,isVersionInEditSession as k,isHistoricVersion as C,currentSessionId as L}from"../../../versionManagement/support/versionManagementUtils.js";import Q from"../../../geometry/SpatialReference.js";const D=new o({originalAndCurrentFeatures:"original-and-current-features",none:"none"}),P=new Set(["Feature Layer","Oriented Imagery Layer","Table","Catalog Layer"]),V=new o({Started:"published",Publishing:"publishing",Stopped:"unavailable"});let $=class extends n{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}})),this._ongoingAssetUploads=new Map}load(e){const t=this.layer.sourceJSON,s=this._fetchService(t,{...e}).then((()=>this.layer.setUserPrivileges(this.sourceJSON.serviceItemId,e))).then((()=>this._ensureLatestMetadata(e)));return this.addResolvingPromise(s),Promise.resolve(this)}get queryTask(){const{capabilities:e,parsedUrl:t,dynamicDataSource:s,infoFor3D:r,gdbVersion:a,spatialReference:i,fieldsIndex:o}=this.layer,n=has("featurelayer-pbf")&&e?.query.supportsFormatPBF&&null==r,u=e?.operations?.supportsQueryAttachments??!1;return new j({url:t.path,pbfSupported:n,fieldsIndex:o,infoFor3D:r,dynamicDataSource:s,gdbVersion:a,sourceSpatialReference:i,queryAttachmentsSupported:u})}async addAttachment(e,t){await this.load();const{layer:r}=this;await v(r,"editing");const a=e.attributes[r.objectIdField],i=r.parsedUrl.path+"/"+a+"/addAttachment",o=this._getLayerRequestOptions(),n=this._getFormDataForAttachment(t,o.query);try{const e=await s(i,{body:n});return E(e.data.addAttachmentResult)}catch(u){throw this._createAttachmentErrorResult(a,u)}}async updateAttachment(e,t,r){await this.load();const{layer:a}=this;await v(a,"editing");const i=e.attributes[a.objectIdField],o=a.parsedUrl.path+"/"+i+"/updateAttachment",n=this._getLayerRequestOptions({query:{attachmentId:t}}),u=this._getFormDataForAttachment(r,n.query);try{const e=await s(o,{body:u});return E(e.data.updateAttachmentResult)}catch(l){throw this._createAttachmentErrorResult(i,l)}}async applyEdits(e,r){await this.load();const{layer:o}=this;await v(o,"editing");const n=o.infoFor3D,u=null!=n,l=u||(r?.globalIdUsed??!1),c=u?await this._uploadMeshesAndGetAssetMapEditsJSON(e):null,d=e.addFeatures?.map((e=>O(this.layer,e,n)))??[],p=(await Promise.all(d)).filter(a),y=e.updateFeatures?.map((e=>O(this.layer,e,n)))??[],h=(await Promise.all(y)).filter(a),m=R(this.layer,e.deleteFeatures,l);M(p,h,o.spatialReference);const f=await b(this.layer,e),g=o.capabilities.editing.supportsAsyncApplyEdits&&u,w=r?.gdbVersion||o.gdbVersion,S={gdbVersion:w,rollbackOnFailure:r?.rollbackOnFailureEnabled,useGlobalIds:l,returnEditMoment:r?.returnEditMoment,usePreviousEditMoment:r?.usePreviousEditMoment,async:g};await J(this.layer.url,w,!0);const q=k(this.layer.url,w||null);if(await C(o.url,w,o.historicMoment))throw new i("feature-layer-source:historic-version","Editing a historic version is not allowed");r?.returnServiceEditsOption?(S.edits=JSON.stringify([{id:o.layerId,adds:p,updates:h,deletes:m,attachments:f,assetMaps:c}]),S.returnServiceEditsOption=D.toJSON(r?.returnServiceEditsOption),S.returnServiceEditsInSourceSR=r?.returnServiceEditsInSourceSR):(S.adds=p.length?JSON.stringify(p):null,S.updates=h.length?JSON.stringify(h):null,S.deletes=m.length?l?JSON.stringify(m):m.join(","):null,S.attachments=f&&JSON.stringify(f),S.assetMaps=null!=c?JSON.stringify(c):void 0);const E=this._getLayerRequestOptions({method:"post",query:S});q&&(E.authMode="immediate",E.query.returnEditMoment=!0,E.query.sessionId=L);const F=r?.returnServiceEditsOption?o.url:o.parsedUrl.path;let _;try{_=g?await this._asyncApplyEdits(F+"/applyEdits",E):await s(F+"/applyEdits",E)}catch(x){if(!A(x))throw x;E.authMode="immediate",_=g?await this._asyncApplyEdits(F+"/applyEdits",E):await s(F+"/applyEdits",E)}if(!o.capabilities.operations?.supportsEditing&&o.effectiveCapabilities?.operations?.supportsEditing){const e=t?.findCredential(o.url);await(e?.refreshToken())}return this._createEditsResult(_)}async deleteAttachments(e,t){await this.load();const{layer:r}=this;await v(r,"editing");const a=e.attributes[r.objectIdField],i=r.parsedUrl.path+"/"+a+"/deleteAttachments";try{return(await s(i,this._getLayerRequestOptions({query:{attachmentIds:t.join(",")},method:"post"}))).data.deleteAttachmentResults.map(E)}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:a,url:i}=this.layer,{data:o}=await s(`${i}/${a}`,t),{id:n,extent:u,fullExtent:l,timeExtent:c}=o,d=u||l;return{id:n,fullExtent:d&&g.fromJSON(d),timeExtent:c&&r.fromJSON({start:c[0],end:c[1]})}}))}async queryAttachments(e,t={}){await this.load();const s=this._getLayerRequestOptions(t);return this.queryTask.executeAttachmentQuery(e,s)}async queryFeatures(e,t){await this.load();const s=await this.queryTask.execute(e,{...t,query:this._createRequestQueryOptions(t)});return e.outStatistics?.length&&s.features.length&&s.features.forEach((t=>{const s=t.attributes;e.outStatistics?.forEach((({outStatisticFieldName:e})=>{if(e){const t=e.toLowerCase();t&&t in s&&e!==t&&(s[e]=s[t],delete s[t])}}))})),s}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=y(this.layer.url,"status"),t=await s(e,{query:{f:"json"}});return V.fromJSON(t.data.status)}async uploadAssets(e,t){const{uploadAssets:s}=await import("./support/uploadAssets.js");return s(e,{layer:this.layer,ongoingUploads:this._ongoingAssetUploads},t)}async _asyncApplyEdits(e,t){const r=(await s(e,t)).data.statusUrl;for(;;){const e=(await s(r,{query:{f:"json"},responseType:"json"})).data;switch(e.status){case"Completed":return s(e.resultUrl,{query:{f:"json"},responseType:"json"});case"CompletedWithErrors":throw new i("async-applyEdits-failed","asynchronous applyEdits call failed.");case"Failed ImportChanges":case"InProgress":case"Pending":case"ExportAttachments":case"ExportChanges":case"ExportingData":case"ExportingSnapshot":case"ImportAttachments":case"ProvisioningReplica":case"UnRegisteringReplica":break;default:throw new i("async-applyEdits-failed","asynchronous applyEdits call failed (undefined response status)")}await d(G)}}_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 r={};has("featurelayer-advanced-symbols")&&(r.returnAdvancedSymbols=!0),t?.cacheBust&&(r._ts=Date.now());const{data:a}=await s(this.layer.parsedUrl.path,this._getLayerRequestOptions({query:r,signal:t?.signal}));e=a}this.sourceJSON=await this._patchServiceJSON(e,t?.signal);const r=e.type;if(!P.has(r))throw new i("feature-layer-source:unsupported-type",`Source type "${r}" is not supported`)}async _patchServiceJSON(e,t){if("Table"!==e.type&&e.geometryType&&!e?.drawingInfo?.renderer&&!e.defaultSymbol){const t=x(e.geometryType).renderer;l("drawingInfo.renderer",t,e)}if("esriGeometryMultiPatch"===e.geometryType&&e.infoFor3D&&(e.geometryType="mesh"),null==e.extent)try{const{data:r}=await s(this.layer.url,this._getLayerRequestOptions({signal:t}));r.spatialReference&&(e.extent={xmin:0,ymin:0,xmax:0,ymax:0,spatialReference:r.spatialReference})}catch(r){p(r)}return e}async _ensureLatestMetadata(e){if(this.layer.userHasUpdateItemPrivileges&&this.sourceJSON.cacheMaxAge>0)return this._fetchService(null,{...e,cacheBust:!0})}async _uploadMeshesAndGetAssetMapEditsJSON(e){const{addAssetFeatures:t}=e;if(!t?.length)return null;const s=await this._filterRedundantAssetMaps(t);if(!t?.length)return null;const r=new Array,a=new Map;for(const i of s){const{geometry:e}=i,{vertexSpace:t}=e;if(w(t))r.push(e);else{const t=S(e);a.set(t,e),i.geometry=t,r.push(t)}}await this.uploadAssets(r);for(const[i,o]of a)o.addExternalSources(i.metadata.externalSources.items);return{adds:this._getAssetMapEditsJSON(s),updates:[],deletes:[]}}_getAssetMapEditsJSON(e){const t=new Array,s=this.layer.globalIdField,r=this.layer.parsedUrl;for(const a of e){const e=a.geometry,{metadata:i}=e,o=i.getExternalSourcesOnService(r),n=a.getAttribute(s);if(0===o.length){u.getLogger(this).error(`Skipping feature ${n}. The mesh it is associated with has not been uploaded to the service and cannot be mapped to it.`);continue}const{source:l}=o.find(q)??o[0],{vertexSpace:c}=e,d="georeferenced"===c.type?["PROJECT_VERTICES"]:[];for(const s of l)1===s.parts.length?t.push({globalId:h(),parentGlobalId:n,assetName:s.assetName,assetHash:s.parts[0].partHash,flags:d}):u.getLogger(this).error(`Skipping asset ${s.assetName}. It does not have exactly one part, so we cannot map it to a feature.`)}return t}_createEditsResult(e){const t=e.data,{layerId:s}=this.layer,r=[];let a=null;if(Array.isArray(t))for(const o of t)r.push({id:o.id,editedFeatures:o.editedFeatures}),o.id===s&&(a={addResults:o.addResults??[],updateResults:o.updateResults??[],deleteResults:o.deleteResults??[],attachments:o.attachments,editMoment:o.editMoment});else a=t;const i=F(a);if(r.length>0){i.editedFeatureResults=[];for(const e of r){const{editedFeatures:t}=e,s=t?.spatialReference?new Q(t.spatialReference):null;i.editedFeatureResults.push({layerId:e.id,editedFeatures:_(t,s)})}}return i}_createAttachmentErrorResult(e,t){const s=t.details.messages?.[0]||t.message,r=t.details.httpStatus||t.details.messageCode;return{objectId:e,globalId:null,error:new i("feature-layer-source:attachment-failure",s,{code:r})}}_getFormDataForAttachment(e,t){const s=e instanceof FormData?e:e&&e.elements?new FormData(e):null;if(s)for(const r in t){const e=t[r];null!=e&&(s.set?s.set(r,e):s.append(r,e))}return s}_getLayerRequestOptions(e={}){const{parsedUrl:t,gdbVersion:s,dynamicDataSource:r}=this.layer;return{...e,query:{gdbVersion:s,layer:r?JSON.stringify({source:r}):void 0,...t.query,f:"json",...this._createRequestQueryOptions(e)},responseType:"json"}}async _filterRedundantAssetMaps(e){const{layer:t}=this,{globalIdField:s,infoFor3D:r,parsedUrl:i}=t;if(null==r||null==s)return e;const o=T(r);if(null==o)return e;const n=y(i.path,`../${o.id}`),u=new Array,l=new Array;for(const a of e)a.geometry.metadata.getExternalSourcesOnService(i).length>0?l.push(a):u.push(a);const c=l.map((e=>e.getAttribute(s))).filter(a);if(0===c.length)return e;const{assetMapFieldRoles:{parentGlobalId:d,assetHash:p}}=r,h=new U;h.where=`${d} IN (${c.map((e=>`'${e}'`))})`,h.outFields=[p,d],h.returnGeometry=!1;const m=await N(n,h),{features:f}=m;return 0===f.length?e:[...u,...l.filter((e=>{const t=e.getAttribute(s);if(!t)return!0;const{metadata:r}=e.geometry,a=f.filter((e=>e.getAttribute(d)===t));if(0===a.length)return!0;const o=a.map((e=>e.getAttribute(p)));return r.getExternalSourcesOnService(i).flatMap((({source:e})=>e.flatMap((e=>e.parts.map((e=>e.partHash)))))).some((e=>o.every((t=>e!==t))))}))]}};e([m()],$.prototype,"type",void 0),e([m({constructOnly:!0})],$.prototype,"layer",void 0),e([m({readOnly:!0})],$.prototype,"queryTask",null),$=e([f("esri.layers.graphics.sources.FeatureLayerSource")],$);const G=1e3,H=$;export{H 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.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../request.js";import i from"../../../core/Error.js";import{JSONSupport as r}from"../../../core/JSONSupport.js";import o from"../../../core/Logger.js";import{EsriPromiseMixin as n}from"../../../core/Promise.js";import{onAbort as s}from"../../../core/promiseUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import{ensureClass as a}from"../../../core/accessorSupport/ensureType.js";import"../../../core/RandomLCG.js";import"../../../core/has.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{sanitizeUrl as m}from"../arcgisLayerUrl.js";import{url as f}from"../commonProperties.js";import u from"../DimensionalDefinition.js";import h from"../LOD.js";import p from"../RasterStorageInfo.js";import d from"../TileInfo.js";import{isMultiSliceOrRangeDefinition as x,getSliceIndex as y,createSlices as g,getSliceIds as I}from"./multidimensionalUtils.js";import{getRasterId as R,getBlock as w,putBlock as S,deleteBlock as k,decreaseRefCount as v}from"./RawBlockCache.js";import{convertNoDataToMask as T}from"../rasterFormats/pixelRangeUtils.js";import{decode as b}from"../rasterFormats/RasterCodec.js";import{mosaic as P,approximateTransform as B,getLocalArithmeticNorthRotations as M}from"../rasterFunctions/pixelUtils.js";import{load as _,getWorldWidth as C,projectPoint as W,snapPyramid as j,shiftExtent as z,getWorldWrapCount as H,projectExtent as L,getProjectionOffsetGrid as E,getRasterDatasetAlignmentInfo as D,projectResolution as F}from"../rasterFunctions/rasterProjectionHelper.js";import{convertToLocalDirections as O,uvComponentToVector as A}from"../rasterFunctions/vectorFieldUtils.js";import{QueueProcessor as G}from"../../../views/support/QueueProcessor.js";import q from"../../../geometry/Extent.js";import J from"../../../geometry/Point.js";import N from"../../../geometry/SpatialReference.js";const V=8,U=256;let $=0,Q=class extends(n(r)){constructor(){super(...arguments),this._tileFetchQueue=new G({concurrency:32,process:(e,t)=>this._fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}async init(){const e=_();this.addResolvingPromise(e),await this.when()}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:d.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=C(e.spatialReference);return null!=t&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return null==e||"gcs-shift"===e.type}set rasterJobHandler(e){this._set("rasterJobHandler",e),"Function"===this.datasetFormat&&this.primaryRasters?.rasters?.forEach((t=>t.rasterJobHandler=e))}get rasterId(){return this.url||"rasterId-"+$++}set url(e){this._set("url",m(e,o.getLogger(this)))}async open(e){throw new i("BaseRaster:open-not-implemented","open() is not implemented")}async fetchTile(e,t,i,r={}){const o=r.tileInfo||this.rasterInfo.storageInfo.tileInfo,n=this.getTileExtentFromTileInfo(e,t,i,o);return r={noClip:!0,...r},this.fetchPixels(n,o.size[0],o.size[1],r)}async identify(e,t={}){e=a(J,e).clone().normalize();const{multidimensionalDefinition:i,timeExtent:r}=t,{rasterInfo:o}=this,{hasMultidimensionalTranspose:n,multidimensionalInfo:s}=o;let{transposedVariableName:l}=t;const c=null!=s&&n&&(null!=r||x(i));if(c&&!l){l=null!=i&&i.length>0?i[0].variableName??void 0:s.variables[0].name,t={...t,transposedVariableName:l}}t=this._getRequestOptionsWithSliceId(t);const{spatialReference:m,extent:f}=o,{datumTransformation:u}=t;let h=W(e,m,u);if(!f.intersects(h))return{location:h,value:null};if(null!=o.transform){const e=o.transform.inverseTransform(h);if(!o.nativeExtent.intersects(e))return{location:e,value:null};h=e}let p=0;const d=null!=l&&null!=s&&o.hasMultidimensionalTranspose;if("Function"===this.datasetFormat){const e=this.primaryRasters.rasters[0];if(d)return e.identify(h,t);const{pixelSize:i}=o,r=3,n=i.x*r/2,s=i.y*r/2,l=new q({xmin:h.x-n,xmax:h.x+n,ymin:h.y-s,ymax:h.y+s,spatialReference:m}),a={interpolation:"nearest"},{pixelBlock:c}=await e.fetchPixels(l,r,r,a),{pixelBlock:f}=await this.fetchPixels(l,r,r,a);if(null==c)return{location:h,value:null};const u=Math.floor(r*r*.5),p=!c.mask||c.mask[u]?c.pixels.map((e=>e[u])):null;let x;return null!=f&&(x=!f.mask||f.mask[u]?f.pixels.map((e=>e[u])):void 0),{location:h,value:p,processedValue:x,pyramidLevel:0}}if(!d)if(t.srcResolution){p=j(t.srcResolution,o,this.ioConfig.sampling).pyramidLevel}else if(p=await this.computeBestPyramidLevelForLocation(e,t),null==p)return{location:h,value:null};const y=this.identifyPixelLocation(h,p,null,d);if(null===y)return{location:h,value:null};const{row:g,col:I,rowOffset:k,colOffset:v,blockWidth:T}=y,b=l??t.sliceId,P=R(this.rasterId,b),B=`${p}/${g}/${I}`;let M=w(P,null,B);null==M&&(M=this.fetchRawTile(p,g,I,t),S(P,null,B,M));const _=await M;if(!_?.pixels?.length)return{location:h,value:null};const C=k*T+v;return this._processIdentifyResult(_,{srcLocation:h,position:C,pyramidLevel:p,useTransposedTile:!!d,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,i,r={}){e=z(e),r=this._getRequestOptionsWithSliceId(r);const{_hasNoneOrGCSShiftTransform:o}=this;if(r.requestRawData&&o)return this._fetchPixels(e,t,i,r);const n=C(e.spatialReference),s=H(e);if(null==n||0===s||1===s&&this._isGlobalWrappableSource&&o)return this._fetchPixels(e,t,i,r);if(s>=3)return{extent:e,pixelBlock:null};const l=[],{xmin:a,xmax:c}=e,m=Math.round(n/(c-a)*t),f=m-Math.round((n/2-a)/(c-a)*t);let u=0;const h=[];for(let y=0;y<=s;y++){const o=new q({xmin:0===y?a:-n/2,xmax:y===s?c-n*y:n/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),p=0===y?m-f:y===s?t-u:m;u+=p,h.push(p);const d=r.disableWrapAround&&y>0?null:this._fetchPixels(o,p,i,r);l.push(d)}const p=(await Promise.all(l)).map((e=>e?.pixelBlock));let d=null;const x={width:t,height:i};if(this.rasterJobHandler){d=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:p,srcMosaicSize:x,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:h},r)).pixelBlock}else d=P(p,x,{blockWidths:h});return{extent:e,srcExtent:L(e,this.rasterInfo.spatialReference,r.datumTransformation),pixelBlock:d}}async fetchRawPixels(e,t,i,r={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const o=await this._fetchRawTiles(e,t,i,r),{nativeExtent:n,nativePixelSize:s,storageInfo:l}=this.rasterInfo,a=2**e,c=s.x*a,m=s.y*a,f=new q({xmin:n.xmin+c*t.x,xmax:n.xmin+c*(t.x+i.width-1),ymin:n.ymax-m*(t.y+i.height-1),ymax:n.ymax-m*t.y,spatialReference:n.spatialReference});if(!o)return{extent:f,srcExtent:f,pixelBlock:null};const{pixelBlocks:u,mosaicSize:h}=o;if(1===u.length&&null!=u[0]&&u[0].width===i.width&&u[0].height===i.height)return{extent:f,srcExtent:f,pixelBlock:o.pixelBlocks[0]};const p=e>0?l.pyramidBlockWidth:l.blockWidth,d=e>0?l.pyramidBlockHeight:l.blockHeight,x={x:t.x%p,y:t.y%d};let y;if(this.rasterJobHandler){y=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:u,srcMosaicSize:h,destDimension:i,clipOffset:x,clipSize:i,coefs:null,sampleSpacing:null,interpolation:r.interpolation,alignmentInfo:null,blockWidths:null},r)).pixelBlock}else y=P(u,h,{clipOffset:x,clipSize:i});return{extent:f,srcExtent:f,pixelBlock:y}}fetchRawTile(e,t,r,o){throw new i("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return L(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?b(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,i,r=0){const{customFetchParameters:o}=this.ioConfig,{range:n,query:s,headers:l}=i;r=r??i.retryCount??this.ioConfig.retryCount;const a=n?{Range:`bytes=${n.from}-${n.to}`}:null;try{return await t(e,{...i,query:{...s,...o},headers:{...l,...a}})}catch(c){if(r>0)return r--,this.request(e,i,r);throw c}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return null==t||null==e||0===e.length?null:y(e,t)}getTileExtentFromTileInfo(e,t,i,r){const o=r.lodAt(e);return this.getTileExtent({x:o.resolution,y:o.resolution},t,i,r.origin,r.spatialReference,r.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:r}=this.rasterInfo;if(!e.tileInfo){const o=[],n=e.maximumPyramidLevel||0;let s=Math.max(r.x,r.y),l=1/.0254*96*s;for(let e=0;e<=n;e++)o.unshift(new h({level:n-e,resolution:s,scale:l})),s*=2,l*=2;const a=new J({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new d({origin:a,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:o}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,r){const{width:o,height:n,nativeExtent:s,pixelSize:l,spatialReference:a}=e,c=new J({x:s.xmin,y:s.ymax,spatialReference:a});null==r&&(r=Math.max(0,Math.round(Math.log(Math.max(o,n))/Math.LN2-8)));const m=this.computeBlockBoundary(s,512,512,{x:s.xmin,y:s.ymax},[l],r);e.storageInfo=new p({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:r,blockBoundary:m})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,r,o,n=0,s=2){if(1===o.length&&n>0){o=[...o];let{x:e,y:t}=o[0];for(let i=0;i<n;i++)e*=s,t*=s,o.push({x:e,y:t})}const l=[],{x:a,y:c}=r;for(let m=0;m<o.length;m++){const{x:r,y:n}=o[m];l.push({minCol:Math.floor((e.xmin-a+.1*r)/t/r),maxCol:Math.floor((e.xmax-a-.1*r)/t/r),minRow:Math.floor((c-e.ymax+.1*n)/i/n),maxRow:Math.floor((c-e.ymin-.1*n)/i/n)})}return l}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:i,pyramidScalingFactor:r}=this.rasterInfo.storageInfo;if(0===e)return t;if(null!=i&&i.length)return i[e-1];const o=r**e;return{x:t.x*o,y:t.y*o}}identifyPixelLocation(e,t,i,r){const{spatialReference:o,nativeExtent:n,storageInfo:s}=this.rasterInfo,{maximumPyramidLevel:l,origin:a,transposeInfo:c}=s,m=r&&null!=c?c.tileSize[0]:s.blockWidth,f=r&&null!=c?c.tileSize[1]:s.blockHeight,u=W(e,o,i);if(!n.intersects(u))return null;if(t<0||t>l)return null;const h=this.getPyramidPixelSize(t),{x:p,y:d}=h,x=(a.y-u.y)/d/f,y=(u.x-a.x)/p/m,g=Math.min(f-1,Math.floor((x-Math.floor(x))*f)),I=Math.min(m-1,Math.floor((y-Math.floor(y))*m));return{pyramidLevel:t,row:Math.floor(x),col:Math.floor(y),rowOffset:g,colOffset:I,blockWidth:m,srcLocation:u}}getTileExtent(e,t,i,r,o,n){const[s,l]=n,a=r.x+i*s*e.x,c=a+s*e.x,m=r.y-t*l*e.y,f=m-l*e.y;return new q({xmin:a,xmax:c,ymin:f,ymax:m,spatialReference:o})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,i){const r=this.rasterInfo.storageInfo.blockBoundary[e];return!r||r.maxRow<t||r.maxCol<i||r.minRow>t||r.minCol>i}updateImageSpaceRasterInfo(e){const{extent:t,pixelSize:i}=e;if(-.5===t.xmin&&.5===t.ymax&&1===i.x&&1===i.y&&null==e.transform)return;const{width:r,height:o}=e,n=N.WebMercator;e.spatialReference=n,e.extent=e.nativeExtent=new q({xmin:-.5,ymax:.5,xmax:r-.5,ymin:.5-o,spatialReference:n}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new J({x:1,y:1,spatialReference:n});const{extent:s,storageInfo:l}=e;if(l){l.origin=new J({x:s.xmin,y:s.ymax,spatialReference:n});const{tileInfo:t}=l;if(t){t.origin=l.origin;const i=(e.nativePixelSize.x+e.nativePixelSize.y)/2;t.lods.forEach(((e,t)=>{e.resolution=i*2**t,e.scale=96*e.resolution/.0254}))}}}async _fetchPixels(e,t,i,r={}){let o=H(e);if(o>=2)return{extent:e,pixelBlock:null};const n=this._getSourceDataInfo(e,t,i,r),{pyramidLevel:s,srcResolution:l,srcExtent:a,srcWidth:c,srcHeight:m,ul:f}=n;if(0===c||0===m)return{extent:e,srcExtent:a,pixelBlock:null};const{rasterInfo:u}=this,h=u.transform,p="gcs-shift"===h?.type,d=null!=C(e.spatialReference);!p&&d||(o=H(n.srcExtent,p));const x=await this._fetchRawTiles(s,f,{width:c,height:m,wrapCount:o},r);if(!x)return{extent:e,srcExtent:a,pixelBlock:null};const y=u.storageInfo,g=s>0?y.pyramidBlockWidth:y.blockWidth,I=s>0?y.pyramidBlockHeight:y.blockHeight;let{x:R,y:w}=u.pixelSize;if(s>0){const{pyramidResolutions:e,pyramidScalingFactor:t}=y;if(null!=e&&e[s-1])({x:R,y:w}=e[s-1]);else{const e=t**s;R*=e,w*=e}}const S=u.spatialReference,k=new J({x:R,y:w,spatialReference:S}),v=g===c&&I===m&&f.x%g==0&&f.y%I==0,T=new J({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),b=!e.spatialReference.equals(S),W=S.isGeographic?1e-9:1e-4,{datumTransformation:j}=r;if(!b&&v&&1===x.pixelBlocks.length&&g===t&&I===i&&this._isSameResolution(l,T,W))return{extent:e,srcExtent:a,srcTilePixelSize:k,pixelBlock:x.pixelBlocks[0]};const z=d&&null!=C(a.spatialReference)&&this._hasNoneOrGCSShiftTransform,L=r.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");L&&!this.rasterJobHandler&&await _();const D=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:x.extent,pixelSize:T.toJSON(),datumTransformation:j,rasterTransform:h,hasWrapAround:o>0||z,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:L},r):E({projectedExtent:e,srcBufferExtent:x.extent,pixelSize:T,datumTransformation:j,rasterTransform:h,hasWrapAround:o>0||z,isAdaptive:!1,includeGCSGrid:L});let F;const A=!r.requestRawData,G={rows:D.spacing[0],cols:D.spacing[1]},q=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(s,x.extent.xmin):void 0,{pixelBlocks:N,mosaicSize:V,isPartiallyFilled:U}=x;let $=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:N,srcMosaicSize:V,destDimension:A?{width:t,height:i}:null,coefs:A?D.coefficients:null,sampleSpacing:A?G:null,projectDirections:L,gcsGrid:L?D.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:r.interpolation,alignmentInfo:q,blockWidths:null},r);({pixelBlock:F,localNorthDirections:$}=e)}else{const e=P(N,V,{alignmentInfo:q});F=A?B(e,{width:t,height:i},D.coefficients,G,r.interpolation):e,L&&D.gcsGrid&&($=M({width:t,height:i},D.gcsGrid),F=O(F,this.rasterInfo.dataType,$))}return r.requestRawData||L?{extent:e,srcExtent:a,srcTilePixelSize:k,pixelBlock:F,transformGrid:D,localNorthDirections:$,isPartiallyFilled:U}:{extent:e,srcExtent:a,srcTilePixelSize:k,pixelBlock:F}}async _fetchRawTiles(e,t,i,r){const{origin:o,blockBoundary:n}=this.rasterInfo.storageInfo,{blockWidth:s,blockHeight:l}=this.getBlockWidthHeight(e);let{x:a,y:c}=t,{width:m,height:f,wrapCount:u}=i;const h=this._getRasterTileAlignmentInfo(e,0);r.buffer&&(a-=r.buffer.cols,c-=r.buffer.rows,m+=2*r.buffer.cols,f+=2*r.buffer.rows);let p=0,d=0,x=0;if(u&&null!=h){({worldColumnCountFromOrigin:d,originColumnOffset:x,rightPadding:p}=h);d*h.blockWidth-p>=a+m&&(p=0)}const y=Math.floor(a/s),g=Math.floor(c/l),I=Math.floor((a+m+p-1)/s),R=Math.floor((c+f+p-1)/l),w=n[e];if(!w)return null;const{minRow:S,minCol:k,maxCol:v,maxRow:T}=w;if(0===u&&(R<S||I<k||g>T||y>v))return null;const b=new Array;let P=!1;const B=null==this.ioConfig.allowPartialFill?r.allowPartialFill:this.ioConfig.allowPartialFill;for(let H=g;H<=R;H++)for(let t=y;t<=I;t++){let i=t;if(!r.disableWrapAround&&u&&null!=h&&d<=t&&(i=t-d-x),H>=S&&i>=k&&T>=H&&v>=i){const t=this._tileFetchQueue.push({pyramidLevel:e,row:H,col:i,options:r},{signal:r.signal});B?b.push(new Promise((e=>{t.then((t=>e(t))).catch((()=>{P=!0,e(null)}))}))):b.push(t)}else b.push(Promise.resolve(null))}if(0===b.length)return null;const M=await Promise.all(b),_={height:(R-g+1)*l,width:(I-y+1)*s},{spatialReference:C}=this.rasterInfo,W=this.getPyramidPixelSize(e),{x:j,y:z}=W;return{extent:new q({xmin:o.x+y*s*j,xmax:o.x+(I+1)*s*j,ymin:o.y-(R+1)*l*z,ymax:o.y-g*l*z,spatialReference:C}),pixelBlocks:M,mosaicSize:_,isPartiallyFilled:P}}_isSameResolution(e,t,i){return Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i}_fetchRawTile(e,t,i,r){const o=this.rasterInfo.storageInfo.blockBoundary[e];if(!o)return Promise.resolve(null);const{minRow:n,minCol:l,maxCol:a,maxRow:c}=o;if(t<n||i<l||t>c||i>a)return Promise.resolve(null);const m=R(this.rasterId,r.sliceId),f=`${e}/${t}/${i}`;let u=w(m,r.registryId,f);if(null==u){const o=new AbortController;u=this.fetchRawTile(e,t,i,{...r,signal:o.signal}),S(m,r.registryId,f,u,o),u.catch((()=>k(m,r.registryId,f)))}return r.signal&&s(r,(()=>{v(m,r.registryId,f)})),u}_computeMagDirValues(e){const{bandCount:t,dataType:i}=this.rasterInfo;if(!(2===t&&"vector-magdir"===i||"vector-uv"===i)||2!==e?.length||!e[0]?.length)return null;const r=e[0].length;if("vector-magdir"===i){const t=e[1].map((e=>(e+360)%360));return[e[0],t]}const[o,n]=e,s=[],l=[];for(let a=0;a<r;a++){const[e,t]=A([o[a],n[a]]);s.push(e),l.push(t)}return[s,l]}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlignmentInfo&&(this._rasterTileAlignmentInfo=D(this.rasterInfo)),null==this._rasterTileAlignmentInfo.pyramidsInfo?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,i,r={}){const o={datumTransformation:r.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};r.srcResolution&&(o.srcResolution=r.srcResolution,this._updateSourceDataInfo(e,o));const n=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:s,srcHeight:l,pyramidLevel:a}=o,c=s/t,m=l/i,f=a<n&&c*m>=16,u=a===n&&this._requireTooManySrcTiles(s,l,t,i);if(f||u||(0===s||0===l)){const s=new J({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let l=F(s,this.rasterInfo.spatialReference,e,o.datumTransformation);const u=!l||r.srcResolution&&l.x+l.y<r.srcResolution.x+r.srcResolution.y;if(f&&r.srcResolution&&u){const e=Math.round(Math.log(Math.max(c,m))/Math.LN2)-1;if(n-a+3>=e){const t=2**e;l={x:r.srcResolution.x*t,y:r.srcResolution.y*t}}}l&&(o.srcResolution=l,this._updateSourceDataInfo(e,o))}return this._requireTooManySrcTiles(o.srcWidth,o.srcHeight,t,i)&&(o.srcWidth=0,o.srcHeight=0),o}_requireTooManySrcTiles(e,t,i,r){const{tileInfo:o}=this.rasterInfo.storageInfo,n=Math.ceil(e/o.size[0])*Math.ceil(t/o.size[1]),s=e/i,l=t/r,a=Math.max(1,(i+r)/1024);return n>=U*a||s>V||l>V}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const{rasterInfo:i}=this,r=i.spatialReference,{srcResolution:o,datumTransformation:n}=t,{pyramidLevel:s,pyramidResolution:l,excessiveReading:a}=j(o,i,this.ioConfig.sampling);if(a)return;let c=t.srcExtent||L(e,r,n);if(null==c)return;const m=i.transform;m&&(c=m.inverseTransform(c)),t.srcExtent=c;const{x:f,y:u}=i.storageInfo.origin,h=Math.floor((c.xmin-f)/l.x+.1),p=Math.floor((u-c.ymax)/l.y+.1),d=Math.floor((c.xmax-f)/l.x-.1),x=Math.floor((u-c.ymin)/l.y-.1),y=c.width<.1*l.x?0:d-h+1,g=c.height<.1*l.y?0:x-p+1;t.pyramidLevel=s,t.pyramidResolution=l,t.srcWidth=y,t.srcHeight=g,t.ul={x:h,y:p}}_getRequestOptionsWithSliceId(e){return null!=this.rasterInfo.multidimensionalInfo&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){const{srcLocation:i,position:r,pyramidLevel:o,useTransposedTile:n}=t,s=e.pixels[0].length/e.width/e.height;if(!(!e.mask||e.mask[r]))return{location:i,value:null};const{multidimensionalInfo:l}=this.rasterInfo;if(null==l||!n){const t=e.pixels.map((e=>e[r])),n={location:i,value:t,pyramidLevel:o},s=this._computeMagDirValues(t.map((e=>[e])));return s?.length&&(n.magdirValue=s.map((e=>e[0]))),n}let a=e.pixels.map((e=>e.slice(r*s,r*s+s))),c=this._computeMagDirValues(a);const{requestSomeSlices:m,identifyOptions:f}=t;let h=g(l,f.transposedVariableName);if(m){const e=I(h,f.multidimensionalDefinition,f.timeExtent);a=a.map((t=>e.map((e=>t[e])))),c=c?.map((t=>e.map((e=>t[e])))),h=e.map((e=>h[e]))}const p=e.noDataValues||this.rasterInfo.noDataValue,d={pixels:a,pixelType:e.pixelType};let x;null!=p&&(T(d,p),x=d.mask);return{location:i,value:null,dataSeries:h.map(((e,t)=>{const i={value:0===x?.[t]?null:a.map((e=>e[t])),multidimensionalDefinition:e.multidimensionalDefinition.map((e=>new u({...e,isSlice:!0})))};return c?.length&&(i.magdirValue=[c[0][t],c[1][t]]),i})),pyramidLevel:o}}};e([l()],Q.prototype,"_rasterTileAlignmentInfo",void 0),e([l()],Q.prototype,"_tileFetchQueue",void 0),e([l({readOnly:!0})],Q.prototype,"_isGlobalWrappableSource",null),e([l({readOnly:!0})],Q.prototype,"_hasNoneOrGCSShiftTransform",null),e([l()],Q.prototype,"rasterJobHandler",null),e([l({readOnly:!0})],Q.prototype,"rasterId",null),e([l(f)],Q.prototype,"url",null),e([l({type:String,json:{write:!0}})],Q.prototype,"datasetName",void 0),e([l({type:String,json:{write:!0}})],Q.prototype,"datasetFormat",void 0),e([l()],Q.prototype,"hasUniqueSourceStorageInfo",void 0),e([l()],Q.prototype,"rasterInfo",void 0),e([l()],Q.prototype,"ioConfig",void 0),e([l()],Q.prototype,"sourceJSON",void 0),Q=e([c("esri.layers.support.rasterDatasets.BaseRaster")],Q);const X=Q;export{X as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../request.js";import i from"../../../core/Error.js";import{JSONSupport as o}from"../../../core/JSONSupport.js";import r from"../../../core/Logger.js";import{EsriPromiseMixin as n}from"../../../core/Promise.js";import{onAbort as s}from"../../../core/promiseUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import{ensureClass as a}from"../../../core/accessorSupport/ensureType.js";import"../../../core/RandomLCG.js";import"../../../core/has.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{sanitizeUrl as m}from"../arcgisLayerUrl.js";import{url as f}from"../commonProperties.js";import u from"../DimensionalDefinition.js";import h from"../LOD.js";import p from"../RasterStorageInfo.js";import d from"../TileInfo.js";import{isMultiSliceOrRangeDefinition as x,getSliceIndex as y,createSlices as g,getSliceIds as I}from"./multidimensionalUtils.js";import{getRasterId as R,getBlock as w,putBlock as S,deleteBlock as k,decreaseRefCount as v}from"./RawBlockCache.js";import{convertNoDataToMask as T}from"../rasterFormats/pixelRangeUtils.js";import{decode as b}from"../rasterFormats/RasterCodec.js";import{mosaic as P,approximateTransform as B,getLocalArithmeticNorthRotations as M}from"../rasterFunctions/pixelUtils.js";import{load as _,getWorldWidth as C,projectPoint as W,snapPyramid as j,shiftExtent as z,getWorldWrapCount as H,projectExtent as L,getProjectionOffsetGrid as E,getRasterDatasetAlignmentInfo as D,projectResolution as F}from"../rasterFunctions/rasterProjectionHelper.js";import{convertToLocalDirections as O,uvComponentToVector as A}from"../rasterFunctions/vectorFieldUtils.js";import{QueueProcessor as G}from"../../../views/support/QueueProcessor.js";import q from"../../../geometry/Extent.js";import J from"../../../geometry/Point.js";import N from"../../../geometry/SpatialReference.js";const V=8,U=256;let $=0,Q=class extends(n(o)){constructor(){super(...arguments),this._tileFetchQueue=new G({concurrency:32,process:(e,t)=>this._fetchRawTile(e.pyramidLevel,e.row,e.col,{...e.options,signal:t})}),this.datasetName=null,this.datasetFormat=null,this.hasUniqueSourceStorageInfo=!0,this.rasterInfo=null,this.ioConfig={sampling:"closest"}}async init(){const e=_();this.addResolvingPromise(e),await this.when()}normalizeCtorArgs(e){return e?.ioConfig&&(e={...e,ioConfig:{resolution:null,bandIds:null,sampling:"closest",tileInfo:d.create(),...e.ioConfig}}),e}get _isGlobalWrappableSource(){const{rasterInfo:e}=this,t=C(e.spatialReference);return null!=t&&e.extent.width>=t/2}get _hasNoneOrGCSShiftTransform(){const{transform:e}=this.rasterInfo;return null==e||"gcs-shift"===e.type}set rasterJobHandler(e){this._set("rasterJobHandler",e),"Function"===this.datasetFormat&&this.primaryRasters?.rasters?.forEach((t=>t.rasterJobHandler=e))}get rasterId(){return this.url||"rasterId-"+$++}set url(e){this._set("url",m(e,r.getLogger(this)))}async open(e){throw new i("BaseRaster:open-not-implemented","open() is not implemented")}async fetchTile(e,t,i,o={}){const r=o.tileInfo||this.rasterInfo.storageInfo.tileInfo,n=this.getTileExtentFromTileInfo(e,t,i,r);return o={noClip:!0,...o},this.fetchPixels(n,r.size[0],r.size[1],o)}async identify(e,t={}){e=a(J,e).clone().normalize();const{multidimensionalDefinition:i,timeExtent:o}=t,{rasterInfo:r}=this,{hasMultidimensionalTranspose:n,multidimensionalInfo:s}=r;let{transposedVariableName:l}=t;const c=null!=s&&n&&(null!=o||x(i));if(c&&!l){l=null!=i&&i.length>0?i[0].variableName??void 0:s.variables[0].name,t={...t,transposedVariableName:l}}t=this._getRequestOptionsWithSliceId(t);const{spatialReference:m,extent:f}=r,{datumTransformation:u}=t;let h=W(e,m,u);if(!f.intersects(h))return{location:h,value:null};if(null!=r.transform){const e=r.transform.inverseTransform(h);if(!r.nativeExtent.intersects(e))return{location:e,value:null};h=e}let p=0;const d=null!=l&&null!=s&&r.hasMultidimensionalTranspose;if("Function"===this.datasetFormat){const e=this.primaryRasters.rasters[0];if(d)return e.identify(h,t);const{pixelSize:o}=r,n=3,s=o.x*n/2,l=o.y*n/2,a=new q({xmin:h.x-s,xmax:h.x+s,ymin:h.y-l,ymax:h.y+l,spatialReference:m}),c={interpolation:"nearest",multidimensionalDefinition:i,sliceId:t.sliceId},{pixelBlock:f}=await e.fetchPixels(a,n,n,c),{pixelBlock:u}=await this.fetchPixels(a,n,n,c);if(null==f)return{location:h,value:null};const p=Math.floor(n*n*.5),x=!f.mask||f.mask[p]?f.pixels.map((e=>e[p])):null;let y;return null!=u&&(y=!u.mask||u.mask[p]?u.pixels.map((e=>e[p])):void 0),{location:h,value:x,processedValue:y,pyramidLevel:0}}if(!d)if(t.srcResolution){p=j(t.srcResolution,r,this.ioConfig.sampling).pyramidLevel}else if(p=await this.computeBestPyramidLevelForLocation(e,t),null==p)return{location:h,value:null};const y=this.identifyPixelLocation(h,p,null,d);if(null===y)return{location:h,value:null};const{row:g,col:I,rowOffset:k,colOffset:v,blockWidth:T}=y,b=l??t.sliceId,P=R(this.rasterId,b),B=`${p}/${g}/${I}`;let M=w(P,null,B);null==M&&(M=this.fetchRawTile(p,g,I,t),S(P,null,B,M));const _=await M;if(!_?.pixels?.length)return{location:h,value:null};const C=k*T+v;return this._processIdentifyResult(_,{srcLocation:h,position:C,pyramidLevel:p,useTransposedTile:!!d,requestSomeSlices:c,identifyOptions:t})}async fetchPixels(e,t,i,o={}){e=z(e),o=this._getRequestOptionsWithSliceId(o);const{_hasNoneOrGCSShiftTransform:r}=this;if(o.requestRawData&&r)return this._fetchPixels(e,t,i,o);const n=C(e.spatialReference),s=H(e);if(null==n||0===s||1===s&&this._isGlobalWrappableSource&&r)return this._fetchPixels(e,t,i,o);if(s>=3)return{extent:e,pixelBlock:null};const l=[],{xmin:a,xmax:c}=e,m=Math.round(n/(c-a)*t),f=m-Math.round((n/2-a)/(c-a)*t);let u=0;const h=[];for(let y=0;y<=s;y++){const r=new q({xmin:0===y?a:-n/2,xmax:y===s?c-n*y:n/2,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference}),p=0===y?m-f:y===s?t-u:m;u+=p,h.push(p);const d=o.disableWrapAround&&y>0?null:this._fetchPixels(r,p,i,o);l.push(d)}const p=(await Promise.all(l)).map((e=>e?.pixelBlock));let d=null;const x={width:t,height:i};if(this.rasterJobHandler){d=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:p,srcMosaicSize:x,destDimension:null,coefs:null,sampleSpacing:null,interpolation:"nearest",alignmentInfo:null,blockWidths:h},o)).pixelBlock}else d=P(p,x,{blockWidths:h});return{extent:e,srcExtent:L(e,this.rasterInfo.spatialReference,o.datumTransformation),pixelBlock:d}}async fetchRawPixels(e,t,i,o={}){t={x:Math.floor(t.x),y:Math.floor(t.y)};const r=await this._fetchRawTiles(e,t,i,o),{nativeExtent:n,nativePixelSize:s,storageInfo:l}=this.rasterInfo,a=2**e,c=s.x*a,m=s.y*a,f=new q({xmin:n.xmin+c*t.x,xmax:n.xmin+c*(t.x+i.width-1),ymin:n.ymax-m*(t.y+i.height-1),ymax:n.ymax-m*t.y,spatialReference:n.spatialReference});if(!r)return{extent:f,srcExtent:f,pixelBlock:null};const{pixelBlocks:u,mosaicSize:h}=r;if(1===u.length&&null!=u[0]&&u[0].width===i.width&&u[0].height===i.height)return{extent:f,srcExtent:f,pixelBlock:r.pixelBlocks[0]};const p=e>0?l.pyramidBlockWidth:l.blockWidth,d=e>0?l.pyramidBlockHeight:l.blockHeight,x={x:t.x%p,y:t.y%d};let y;if(this.rasterJobHandler){y=(await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:u,srcMosaicSize:h,destDimension:i,clipOffset:x,clipSize:i,coefs:null,sampleSpacing:null,interpolation:o.interpolation,alignmentInfo:null,blockWidths:null},o)).pixelBlock}else y=P(u,h,{clipOffset:x,clipSize:i});return{extent:f,srcExtent:f,pixelBlock:y}}fetchRawTile(e,t,o,r){throw new i("BaseRaster:read-not-implemented","fetchRawTile() is not implemented")}computeExtent(e){return L(this.rasterInfo.extent,e)}decodePixelBlock(e,t){return!this.rasterJobHandler||t.useCanvas?b(e,t):this.rasterJobHandler.decode({data:e,options:t})}async request(e,i,o=0){const{customFetchParameters:r}=this.ioConfig,{range:n,query:s,headers:l}=i;o=o??i.retryCount??this.ioConfig.retryCount;const a=n?{Range:`bytes=${n.from}-${n.to}`}:null;try{return await t(e,{...i,query:{...s,...r},headers:{...l,...a}})}catch(c){if(o>0)return o--,this.request(e,i,o);throw c}}getSliceIndex(e){const{multidimensionalInfo:t}=this.rasterInfo;return null==t||null==e||0===e.length?null:y(e,t)}getTileExtentFromTileInfo(e,t,i,o){const r=o.lodAt(e);return this.getTileExtent({x:r.resolution,y:r.resolution},t,i,o.origin,o.spatialReference,o.size)}updateTileInfo(){const{storageInfo:e,spatialReference:t,extent:i,pixelSize:o}=this.rasterInfo;if(!e.tileInfo){const r=[],n=e.maximumPyramidLevel||0;let s=Math.max(o.x,o.y),l=1/.0254*96*s;for(let e=0;e<=n;e++)r.unshift(new h({level:n-e,resolution:s,scale:l})),s*=2,l*=2;const a=new J({x:i.xmin,y:i.ymax,spatialReference:t});e.tileInfo=new d({origin:a,size:[e.blockWidth,e.blockHeight],spatialReference:t,lods:r}),e.isVirtualTileInfo=!0}}createRemoteDatasetStorageInfo(e,t=512,i=512,o){const{width:r,height:n,nativeExtent:s,pixelSize:l,spatialReference:a}=e,c=new J({x:s.xmin,y:s.ymax,spatialReference:a});null==o&&(o=Math.max(0,Math.round(Math.log(Math.max(r,n))/Math.LN2-8)));const m=this.computeBlockBoundary(s,512,512,{x:s.xmin,y:s.ymax},[l],o);e.storageInfo=new p({blockWidth:t,blockHeight:i,pyramidBlockWidth:t,pyramidBlockHeight:i,origin:c,firstPyramidLevel:1,maximumPyramidLevel:o,blockBoundary:m})}async computeBestPyramidLevelForLocation(e,t={}){return 0}computeBlockBoundary(e,t,i,o,r,n=0,s=2){if(1===r.length&&n>0){r=[...r];let{x:e,y:t}=r[0];for(let i=0;i<n;i++)e*=s,t*=s,r.push({x:e,y:t})}const l=[],{x:a,y:c}=o;for(let m=0;m<r.length;m++){const{x:o,y:n}=r[m];l.push({minCol:Math.floor((e.xmin-a+.1*o)/t/o),maxCol:Math.floor((e.xmax-a-.1*o)/t/o),minRow:Math.floor((c-e.ymax+.1*n)/i/n),maxRow:Math.floor((c-e.ymin-.1*n)/i/n)})}return l}getPyramidPixelSize(e){const{nativePixelSize:t}=this.rasterInfo,{pyramidResolutions:i,pyramidScalingFactor:o}=this.rasterInfo.storageInfo;if(0===e)return t;if(null!=i&&i.length)return i[e-1];const r=o**e;return{x:t.x*r,y:t.y*r}}identifyPixelLocation(e,t,i,o){const{spatialReference:r,nativeExtent:n,storageInfo:s}=this.rasterInfo,{maximumPyramidLevel:l,origin:a,transposeInfo:c}=s,m=o&&null!=c?c.tileSize[0]:s.blockWidth,f=o&&null!=c?c.tileSize[1]:s.blockHeight,u=W(e,r,i);if(!n.intersects(u))return null;if(t<0||t>l)return null;const h=this.getPyramidPixelSize(t),{x:p,y:d}=h,x=(a.y-u.y)/d/f,y=(u.x-a.x)/p/m,g=Math.min(f-1,Math.floor((x-Math.floor(x))*f)),I=Math.min(m-1,Math.floor((y-Math.floor(y))*m));return{pyramidLevel:t,row:Math.floor(x),col:Math.floor(y),rowOffset:g,colOffset:I,blockWidth:m,srcLocation:u}}getTileExtent(e,t,i,o,r,n){const[s,l]=n,a=o.x+i*s*e.x,c=a+s*e.x,m=o.y-t*l*e.y,f=m-l*e.y;return new q({xmin:a,xmax:c,ymin:f,ymax:m,spatialReference:r})}getBlockWidthHeight(e){return{blockWidth:e>0?this.rasterInfo.storageInfo.pyramidBlockWidth:this.rasterInfo.storageInfo.blockWidth,blockHeight:e>0?this.rasterInfo.storageInfo.pyramidBlockHeight:this.rasterInfo.storageInfo.blockHeight}}isBlockOutside(e,t,i){const o=this.rasterInfo.storageInfo.blockBoundary[e];return!o||o.maxRow<t||o.maxCol<i||o.minRow>t||o.minCol>i}updateImageSpaceRasterInfo(e){const{extent:t,pixelSize:i}=e;if(-.5===t.xmin&&.5===t.ymax&&1===i.x&&1===i.y&&null==e.transform)return;const{width:o,height:r}=e,n=N.WebMercator;e.spatialReference=n,e.extent=e.nativeExtent=new q({xmin:-.5,ymax:.5,xmax:o-.5,ymin:.5-r,spatialReference:n}),e.isPseudoSpatialReference=!0,e.transform=null,e.pixelSize=new J({x:1,y:1,spatialReference:n});const{extent:s,storageInfo:l}=e;if(l){l.origin=new J({x:s.xmin,y:s.ymax,spatialReference:n});const{tileInfo:t}=l;if(t){t.origin=l.origin;const i=(e.nativePixelSize.x+e.nativePixelSize.y)/2;t.lods.forEach(((e,t)=>{e.resolution=i*2**t,e.scale=96*e.resolution/.0254}))}}}async _fetchPixels(e,t,i,o={}){let r=H(e);if(r>=2)return{extent:e,pixelBlock:null};const n=this._getSourceDataInfo(e,t,i,o),{pyramidLevel:s,srcResolution:l,srcExtent:a,srcWidth:c,srcHeight:m,ul:f}=n;if(0===c||0===m)return{extent:e,srcExtent:a,pixelBlock:null};const{rasterInfo:u}=this,h=u.transform,p="gcs-shift"===h?.type,d=null!=C(e.spatialReference);!p&&d||(r=H(n.srcExtent,p));const x=await this._fetchRawTiles(s,f,{width:c,height:m,wrapCount:r},o);if(!x)return{extent:e,srcExtent:a,pixelBlock:null};const y=u.storageInfo,g=s>0?y.pyramidBlockWidth:y.blockWidth,I=s>0?y.pyramidBlockHeight:y.blockHeight;let{x:R,y:w}=u.pixelSize;if(s>0){const{pyramidResolutions:e,pyramidScalingFactor:t}=y;if(null!=e&&e[s-1])({x:R,y:w}=e[s-1]);else{const e=t**s;R*=e,w*=e}}const S=u.spatialReference,k=new J({x:R,y:w,spatialReference:S}),v=g===c&&I===m&&f.x%g==0&&f.y%I==0,T=new J({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference}),b=!e.spatialReference.equals(S),W=S.isGeographic?1e-9:1e-4,{datumTransformation:j}=o;if(!b&&v&&1===x.pixelBlocks.length&&g===t&&I===i&&this._isSameResolution(l,T,W))return{extent:e,srcExtent:a,srcTilePixelSize:k,pixelBlock:x.pixelBlocks[0]};const z=d&&null!=C(a.spatialReference)&&this._hasNoneOrGCSShiftTransform,L=o.requestProjectedLocalDirections&&this.rasterInfo.dataType.startsWith("vector");L&&!this.rasterJobHandler&&await _();const D=this.rasterJobHandler?await this.rasterJobHandler.getProjectionOffsetGrid({projectedExtent:e,srcBufferExtent:x.extent,pixelSize:T.toJSON(),datumTransformation:j,rasterTransform:h,hasWrapAround:r>0||z,isAdaptive:!1!==this.ioConfig.optimizeProjectionAccuracy,includeGCSGrid:L},o):E({projectedExtent:e,srcBufferExtent:x.extent,pixelSize:T,datumTransformation:j,rasterTransform:h,hasWrapAround:r>0||z,isAdaptive:!1,includeGCSGrid:L});let F;const A=!o.requestRawData,G={rows:D.spacing[0],cols:D.spacing[1]},q=this._hasNoneOrGCSShiftTransform?this._getRasterTileAlignmentInfo(s,x.extent.xmin):void 0,{pixelBlocks:N,mosaicSize:V,isPartiallyFilled:U}=x;let $=null;if(this.rasterJobHandler){const e=await this.rasterJobHandler.mosaicAndTransform({srcPixelBlocks:N,srcMosaicSize:V,destDimension:A?{width:t,height:i}:null,coefs:A?D.coefficients:null,sampleSpacing:A?G:null,projectDirections:L,gcsGrid:L?D.gcsGrid:null,isUV:"vector-uv"===this.rasterInfo.dataType,interpolation:o.interpolation,alignmentInfo:q,blockWidths:null},o);({pixelBlock:F,localNorthDirections:$}=e)}else{const e=P(N,V,{alignmentInfo:q});F=A?B(e,{width:t,height:i},D.coefficients,G,o.interpolation):e,L&&D.gcsGrid&&($=M({width:t,height:i},D.gcsGrid),F=O(F,this.rasterInfo.dataType,$))}return o.requestRawData||L?{extent:e,srcExtent:a,srcTilePixelSize:k,pixelBlock:F,transformGrid:D,localNorthDirections:$,isPartiallyFilled:U}:{extent:e,srcExtent:a,srcTilePixelSize:k,pixelBlock:F}}async _fetchRawTiles(e,t,i,o){const{origin:r,blockBoundary:n}=this.rasterInfo.storageInfo,{blockWidth:s,blockHeight:l}=this.getBlockWidthHeight(e);let{x:a,y:c}=t,{width:m,height:f,wrapCount:u}=i;const h=this._getRasterTileAlignmentInfo(e,0);o.buffer&&(a-=o.buffer.cols,c-=o.buffer.rows,m+=2*o.buffer.cols,f+=2*o.buffer.rows);let p=0,d=0,x=0;if(u&&null!=h){({worldColumnCountFromOrigin:d,originColumnOffset:x,rightPadding:p}=h);d*h.blockWidth-p>=a+m&&(p=0)}const y=Math.floor(a/s),g=Math.floor(c/l),I=Math.floor((a+m+p-1)/s),R=Math.floor((c+f+p-1)/l),w=n[e];if(!w)return null;const{minRow:S,minCol:k,maxCol:v,maxRow:T}=w;if(0===u&&(R<S||I<k||g>T||y>v))return null;const b=new Array;let P=!1;const B=null==this.ioConfig.allowPartialFill?o.allowPartialFill:this.ioConfig.allowPartialFill;for(let H=g;H<=R;H++)for(let t=y;t<=I;t++){let i=t;if(!o.disableWrapAround&&u&&null!=h&&d<=t&&(i=t-d-x),H>=S&&i>=k&&T>=H&&v>=i){const t=this._tileFetchQueue.push({pyramidLevel:e,row:H,col:i,options:o},{signal:o.signal});B?b.push(new Promise((e=>{t.then((t=>e(t))).catch((()=>{P=!0,e(null)}))}))):b.push(t)}else b.push(Promise.resolve(null))}if(0===b.length)return null;const M=await Promise.all(b),_={height:(R-g+1)*l,width:(I-y+1)*s},{spatialReference:C}=this.rasterInfo,W=this.getPyramidPixelSize(e),{x:j,y:z}=W;return{extent:new q({xmin:r.x+y*s*j,xmax:r.x+(I+1)*s*j,ymin:r.y-(R+1)*l*z,ymax:r.y-g*l*z,spatialReference:C}),pixelBlocks:M,mosaicSize:_,isPartiallyFilled:P}}_isSameResolution(e,t,i){return Math.abs(e.x-t.x)<i&&Math.abs(e.y-t.y)<i}_fetchRawTile(e,t,i,o){const r=this.rasterInfo.storageInfo.blockBoundary[e];if(!r)return Promise.resolve(null);const{minRow:n,minCol:l,maxCol:a,maxRow:c}=r;if(t<n||i<l||t>c||i>a)return Promise.resolve(null);const m=R(this.rasterId,o.sliceId),f=`${e}/${t}/${i}`;let u=w(m,o.registryId,f);if(null==u){const r=new AbortController;u=this.fetchRawTile(e,t,i,{...o,signal:r.signal}),S(m,o.registryId,f,u,r),u.catch((()=>k(m,o.registryId,f)))}return o.signal&&s(o,(()=>{v(m,o.registryId,f)})),u}_computeMagDirValues(e){const{bandCount:t,dataType:i}=this.rasterInfo;if(!(2===t&&"vector-magdir"===i||"vector-uv"===i)||2!==e?.length||!e[0]?.length)return null;const o=e[0].length;if("vector-magdir"===i){const t=e[1].map((e=>(e+360)%360));return[e[0],t]}const[r,n]=e,s=[],l=[];for(let a=0;a<o;a++){const[e,t]=A([r[a],n[a]]);s.push(e),l.push(t)}return[s,l]}_getRasterTileAlignmentInfo(e,t){return null==this._rasterTileAlignmentInfo&&(this._rasterTileAlignmentInfo=D(this.rasterInfo)),null==this._rasterTileAlignmentInfo.pyramidsInfo?null:{startX:t,halfWorldWidth:this._rasterTileAlignmentInfo.halfWorldWidth,hasGCSSShiftTransform:this._rasterTileAlignmentInfo.hasGCSSShiftTransform,...this._rasterTileAlignmentInfo.pyramidsInfo[e]}}_getSourceDataInfo(e,t,i,o={}){const r={datumTransformation:o.datumTransformation,pyramidLevel:0,pyramidResolution:null,srcExtent:null,srcHeight:0,srcResolution:null,srcWidth:0,ul:{x:0,y:0}};o.srcResolution&&(r.srcResolution=o.srcResolution,this._updateSourceDataInfo(e,r));const n=this.rasterInfo.storageInfo.maximumPyramidLevel||0,{srcWidth:s,srcHeight:l,pyramidLevel:a}=r,c=s/t,m=l/i,f=a<n&&c*m>=16,u=a===n&&this._requireTooManySrcTiles(s,l,t,i);if(f||u||(0===s||0===l)){const s=new J({x:(e.xmax-e.xmin)/t,y:(e.ymax-e.ymin)/i,spatialReference:e.spatialReference});let l=F(s,this.rasterInfo.spatialReference,e,r.datumTransformation);const u=!l||o.srcResolution&&l.x+l.y<o.srcResolution.x+o.srcResolution.y;if(f&&o.srcResolution&&u){const e=Math.round(Math.log(Math.max(c,m))/Math.LN2)-1;if(n-a+3>=e){const t=2**e;l={x:o.srcResolution.x*t,y:o.srcResolution.y*t}}}l&&(r.srcResolution=l,this._updateSourceDataInfo(e,r))}return this._requireTooManySrcTiles(r.srcWidth,r.srcHeight,t,i)&&(r.srcWidth=0,r.srcHeight=0),r}_requireTooManySrcTiles(e,t,i,o){const{tileInfo:r}=this.rasterInfo.storageInfo,n=Math.ceil(e/r.size[0])*Math.ceil(t/r.size[1]),s=e/i,l=t/o,a=Math.max(1,(i+o)/1024);return n>=U*a||s>V||l>V}_updateSourceDataInfo(e,t){t.srcWidth=0,t.srcHeight=0;const{rasterInfo:i}=this,o=i.spatialReference,{srcResolution:r,datumTransformation:n}=t,{pyramidLevel:s,pyramidResolution:l,excessiveReading:a}=j(r,i,this.ioConfig.sampling);if(a)return;let c=t.srcExtent||L(e,o,n);if(null==c)return;const m=i.transform;m&&(c=m.inverseTransform(c)),t.srcExtent=c;const{x:f,y:u}=i.storageInfo.origin,h=Math.floor((c.xmin-f)/l.x+.1),p=Math.floor((u-c.ymax)/l.y+.1),d=Math.floor((c.xmax-f)/l.x-.1),x=Math.floor((u-c.ymin)/l.y-.1),y=c.width<.1*l.x?0:d-h+1,g=c.height<.1*l.y?0:x-p+1;t.pyramidLevel=s,t.pyramidResolution=l,t.srcWidth=y,t.srcHeight=g,t.ul={x:h,y:p}}_getRequestOptionsWithSliceId(e){return null!=this.rasterInfo.multidimensionalInfo&&null==e.sliceId&&(e={...e,sliceId:this.getSliceIndex(e.multidimensionalDefinition)}),e}_processIdentifyResult(e,t){const{srcLocation:i,position:o,pyramidLevel:r,useTransposedTile:n}=t,s=e.pixels[0].length/e.width/e.height;if(!(!e.mask||e.mask[o]))return{location:i,value:null};const{multidimensionalInfo:l}=this.rasterInfo;if(null==l||!n){const t=e.pixels.map((e=>e[o])),n={location:i,value:t,pyramidLevel:r},s=this._computeMagDirValues(t.map((e=>[e])));return s?.length&&(n.magdirValue=s.map((e=>e[0]))),n}let a=e.pixels.map((e=>e.slice(o*s,o*s+s))),c=this._computeMagDirValues(a);const{requestSomeSlices:m,identifyOptions:f}=t;let h=g(l,f.transposedVariableName);if(m){const e=I(h,f.multidimensionalDefinition,f.timeExtent);a=a.map((t=>e.map((e=>t[e])))),c=c?.map((t=>e.map((e=>t[e])))),h=e.map((e=>h[e]))}const p=e.noDataValues||this.rasterInfo.noDataValue,d={pixels:a,pixelType:e.pixelType};let x;null!=p&&(T(d,p),x=d.mask);return{location:i,value:null,dataSeries:h.map(((e,t)=>{const i={value:0===x?.[t]?null:a.map((e=>e[t])),multidimensionalDefinition:e.multidimensionalDefinition.map((e=>new u({...e,isSlice:!0})))};return c?.length&&(i.magdirValue=[c[0][t],c[1][t]]),i})),pyramidLevel:r}}};e([l()],Q.prototype,"_rasterTileAlignmentInfo",void 0),e([l()],Q.prototype,"_tileFetchQueue",void 0),e([l({readOnly:!0})],Q.prototype,"_isGlobalWrappableSource",null),e([l({readOnly:!0})],Q.prototype,"_hasNoneOrGCSShiftTransform",null),e([l()],Q.prototype,"rasterJobHandler",null),e([l({readOnly:!0})],Q.prototype,"rasterId",null),e([l(f)],Q.prototype,"url",null),e([l({type:String,json:{write:!0}})],Q.prototype,"datasetName",void 0),e([l({type:String,json:{write:!0}})],Q.prototype,"datasetFormat",void 0),e([l()],Q.prototype,"hasUniqueSourceStorageInfo",void 0),e([l()],Q.prototype,"rasterInfo",void 0),e([l()],Q.prototype,"ioConfig",void 0),e([l()],Q.prototype,"sourceJSON",void 0),Q=e([c("esri.layers.support.rasterDatasets.BaseRaster")],Q);const X=Q;export{X as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.30.0-next.20240212",
3
+ "version": "4.30.0-next.20240213",
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": [
@@ -29,7 +29,7 @@
29
29
  "@esri/calcite-colors": "~6.1.0",
30
30
  "@esri/calcite-components": "^2.4.0",
31
31
  "@popperjs/core": "~2.11.8",
32
- "@vaadin/grid": "~24.3.5",
32
+ "@vaadin/grid": "~24.3.6",
33
33
  "@zip.js/zip.js": "~2.7.34",
34
34
  "luxon": "~3.4.4",
35
35
  "sortablejs": "~1.15.2"
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../request.js";import t from"../../core/Error.js";import{join as r,getPathExtension as s}from"../../core/urlUtils.js";async function o(e,t={},s){await e.load(s);const o=r(e.itemUrl,"resources"),{start:a=1,num:n=10,sortOrder:c="asc",sortField:l="created"}=t,i={query:{start:a,num:n,sortOrder:c,sortField:l,token:e.apiKey},signal:s?.signal},u=await e.portal.request(o,i);return{total:u.total,nextStart:u.nextStart,resources:u.resources.map((({created:t,size:r,resource:s})=>({created:new Date(t),size:r,resource:e.resourceFromPath(s)})))}}async function a(e,s,o,a){const n=new Map;for(const{resource:r,content:i,compress:u,access:p}of s){if(!r.hasPath())throw new t(`portal-item-resource-${o}:invalid-path`,"Resource does not have a valid path");const[e,s]=l(r.path),a=`${e}/${u??""}/${p??""}`;n.has(a)||n.set(a,{prefix:e,compress:u,access:p,files:[]});n.get(a).files.push({fileName:s,content:i})}await e.load(a);const c=r(e.userItemUrl,"add"===o?"addResources":"updateResources");for(const{prefix:t,compress:r,access:l,files:i}of n.values()){const s=25;for(let o=0;o<i.length;o+=s){const n=i.slice(o,o+s),u=new FormData;t&&"."!==t&&u.append("resourcesPrefix",t),r&&u.append("compress","true"),l&&u.append("access",l);let p=0;for(const{fileName:e,content:t}of n)u.append("file"+ ++p,t,e);u.append("f","json"),await e.portal.request(c,{method:"post",body:u,signal:a?.signal})}}}async function n(e,s,o){if(!s.hasPath())throw new t("portal-item-resources-remove:invalid-path","Resource does not have a valid path");await e.load(o);const a=r(e.userItemUrl,"removeResources");await e.portal.request(a,{method:"post",query:{resource:s.path},signal:o?.signal}),s.portalItem=null}async function c(e,t){await e.load(t);const s=r(e.userItemUrl,"removeResources");return e.portal.request(s,{method:"post",query:{deleteAll:!0},signal:t?.signal})}function l(e){const t=e.lastIndexOf("/");return-1===t?[".",e]:[e.slice(0,t),e.slice(t+1)]}function i(e){const[t,r]=u(e),[s,o]=l(t);return[s,o,r]}function u(e){const t=s(e);return null==t?[e,""]:[e.slice(0,e.length-t.length-1),`.${t}`]}async function p(t){if("blob"===t.type)return t.blob;if("json"===t.type)return new Blob([t.jsonString],{type:"application/json"});return(await e(t.url,{responseType:"blob"})).data}function f(e,t){if(!e.hasPath())return null;const[s,,o]=i(e.path);return e.portalItem.resourceFromPath(r(s,t+o))}function d(e,t){if(!e.hasPath())return null;const[s,,o]=i(e.path);return e.portalItem.resourceFromPath(r(s,t+o))}export{a as addOrUpdateResources,p as contentToBlob,o as fetchResources,f as getSiblingOfSameType,d as getSiblingOfSameTypeI,c as removeAllResources,n as removeResource,i as splitPrefixFileNameAndExtension};
5
+ import e from"../../request.js";import t from"../../core/Error.js";import{join as r,getPathExtension as s}from"../../core/urlUtils.js";async function o(e,t={},s){await e.load(s);const o=r(e.itemUrl,"resources"),{start:a=1,num:n=10,sortOrder:c="asc",sortField:l="resource"}=t,i={query:{start:a,num:n,sortOrder:c,sortField:l,token:e.apiKey},signal:s?.signal},u=await e.portal.request(o,i);return{total:u.total,nextStart:u.nextStart,resources:u.resources.map((({created:t,size:r,resource:s})=>({created:new Date(t),size:r,resource:e.resourceFromPath(s)})))}}async function a(e,s,o,a){const n=new Map;for(const{resource:r,content:i,compress:u,access:p}of s){if(!r.hasPath())throw new t(`portal-item-resource-${o}:invalid-path`,"Resource does not have a valid path");const[e,s]=l(r.path),a=`${e}/${u??""}/${p??""}`;n.has(a)||n.set(a,{prefix:e,compress:u,access:p,files:[]});n.get(a).files.push({fileName:s,content:i})}await e.load(a);const c=r(e.userItemUrl,"add"===o?"addResources":"updateResources");for(const{prefix:t,compress:r,access:l,files:i}of n.values()){const s=25;for(let o=0;o<i.length;o+=s){const n=i.slice(o,o+s),u=new FormData;t&&"."!==t&&u.append("resourcesPrefix",t),r&&u.append("compress","true"),l&&u.append("access",l);let p=0;for(const{fileName:e,content:t}of n)u.append("file"+ ++p,t,e);u.append("f","json"),await e.portal.request(c,{method:"post",body:u,signal:a?.signal})}}}async function n(e,s,o){if(!s.hasPath())throw new t("portal-item-resources-remove:invalid-path","Resource does not have a valid path");await e.load(o);const a=r(e.userItemUrl,"removeResources");await e.portal.request(a,{method:"post",query:{resource:s.path},signal:o?.signal}),s.portalItem=null}async function c(e,t){await e.load(t);const s=r(e.userItemUrl,"removeResources");return e.portal.request(s,{method:"post",query:{deleteAll:!0},signal:t?.signal})}function l(e){const t=e.lastIndexOf("/");return-1===t?[".",e]:[e.slice(0,t),e.slice(t+1)]}function i(e){const[t,r]=u(e),[s,o]=l(t);return[s,o,r]}function u(e){const t=s(e);return null==t?[e,""]:[e.slice(0,e.length-t.length-1),`.${t}`]}async function p(t){if("blob"===t.type)return t.blob;if("json"===t.type)return new Blob([t.jsonString],{type:"application/json"});return(await e(t.url,{responseType:"blob"})).data}function f(e,t){if(!e.hasPath())return null;const[s,,o]=i(e.path);return e.portalItem.resourceFromPath(r(s,t+o))}function m(e,t){if(!e.hasPath())return null;const[s,,o]=i(e.path);return e.portalItem.resourceFromPath(r(s,t+o))}export{a as addOrUpdateResources,p as contentToBlob,o as fetchResources,f as getSiblingOfSameType,m as getSiblingOfSameTypeI,c as removeAllResources,n as removeResource,i as splitPrefixFileNameAndExtension};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{assertIsSome as e}from"../../../core/maybe.js";import{getGeometryZScaler as t}from"../../../geometry/support/zscale.js";import{unquantizeOptimizedGeometry as r,convertToGeometry as s}from"../../../layers/graphics/featureConversionUtils.js";function o(e,t){return t}function i(e,t,r,s){switch(r){case 0:return u(e,t+s,0);case 1:return"lowerLeft"===e.originPosition?u(e,t+s,1):l(e,t+s,1)}}function n(e,t,r,s){return 2===r?u(e,t,2):i(e,t,r,s)}function a(e,t,r,s){return 2===r?u(e,t,3):i(e,t,r,s)}function h(e,t,r,s){return 3===r?u(e,t,3):n(e,t,r,s)}function u({translate:e,scale:t},r,s){return e[s]+r*t[s]}function l({translate:e,scale:t},r,s){return e[s]-r*t[s]}class d{constructor(e){this._options=e,this.geometryTypes=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"],this._previousCoordinate=[0,0],this._transform=null,this._applyTransform=o,this._lengths=[],this._currentLengthIndex=0,this._toAddInCurrentPath=0,this._vertexDimension=0,this._mValueOffset=null,this._coordinateBuffer=null,this._coordinateBufferPtr=0,this._attributesConstructor=class{}}createFeatureResult(){return{fields:[],features:[]}}finishFeatureResult(e){if(this._options.applyTransform&&(e.transform=null),this._attributesConstructor=class{},this._coordinateBuffer=null,this._lengths.length=0,!e.hasZ)return;const r=t(e.geometryType,this._options.sourceSpatialReference,e.spatialReference);if(null!=r)for(const t of e.features)r(t.geometry)}createSpatialReference(){return{}}addField(t,r){const s=t.fields;e(s),s.push(r);const o=s.map((e=>e.name));this._attributesConstructor=function(){for(const e of o)this[e]=null}}addFeature(e,t){e.features.push(t)}prepareFeatures(e){switch(this._transform=e.transform,this._options.applyTransform&&e.transform&&(this._applyTransform=this._deriveApplyTransform(e)),this._mValueOffset=null,this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&(this._mValueOffset=this._vertexDimension,this._vertexDimension++),e.geometryType){case"esriGeometryPoint":this.addCoordinate=(e,t,r)=>this.addCoordinatePoint(e,t,r),this.createGeometry=e=>this.createPointGeometry(e);break;case"esriGeometryPolygon":this.addCoordinate=(e,t,r)=>this._addCoordinatePolygon(e,t,r),this.createGeometry=e=>this._createPolygonGeometry(e);break;case"esriGeometryPolyline":this.addCoordinate=(e,t,r)=>this._addCoordinatePolyline(e,t,r),this.createGeometry=e=>this._createPolylineGeometry(e);break;case"esriGeometryMultipoint":this.addCoordinate=(e,t,r)=>this._addCoordinateMultipoint(e,t,r),this.createGeometry=e=>this._createMultipointGeometry(e)}}createFeature(){return this._lengths.length=0,this._currentLengthIndex=0,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,{attributes:new this._attributesConstructor}}allocateCoordinates(){}addLength(e,t,r){0===this._lengths.length&&(this._toAddInCurrentPath=t),this._lengths.push(t)}addQueryGeometry(e,t){const{queryGeometry:o,queryGeometryType:i}=t,n=r(o.clone(),o,!1,!1,this._transform),a=s(n,i,!1,!1);e.queryGeometryType=i,e.queryGeometry={...a}}createPointGeometry(e){const t={x:0,y:0,spatialReference:e.spatialReference};return e.hasZ&&(t.z=0),e.hasM&&(t.m=0),t}addCoordinatePoint(e,t,r){const s=this._transform;switch(t=this._applyTransform(s,t,r,0),r){case 0:e.x=t;break;case 1:e.y=t;break;case 2:"z"in e?e.z=t:e.m=t;break;case 3:e.m=t}}_transformPathLikeValue(e,t){let r=0;t<=1&&(r=this._previousCoordinate[t],this._previousCoordinate[t]+=e);const s=this._transform;return null===this._mValueOffset||0!==e||t%this._mValueOffset?this._applyTransform(s,e,t,r):0}_addCoordinatePolyline(e,t,r){this._dehydratedAddPointsCoordinate(e.paths,t,r)}_addCoordinatePolygon(e,t,r){this._dehydratedAddPointsCoordinate(e.rings,t,r)}_addCoordinateMultipoint(e,t,r){0===r&&e.points.push([]);const s=this._transformPathLikeValue(t,r);e.points[e.points.length-1].push(s)}_createPolygonGeometry(e){return{rings:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createPolylineGeometry(e){return{paths:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createMultipointGeometry(e){return{points:[],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_dehydratedAddPointsCoordinate(e,t,r){0===r&&0==this._toAddInCurrentPath--&&(e.push([]),this._toAddInCurrentPath=this._lengths[++this._currentLengthIndex]-1,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0);const s=this._transformPathLikeValue(t,r),o=e[e.length-1];0===r&&(this._coordinateBufferPtr=0,this._coordinateBuffer=new Array(this._vertexDimension),o.push(this._coordinateBuffer)),this._coordinateBuffer[this._coordinateBufferPtr++]=s}_deriveApplyTransform(e){const{hasZ:t,hasM:r}=e;return t&&r?h:t?n:r?a:i}}export{d as JSONFeatureSetParserContext};
5
+ import{assertIsSome as e}from"../../../core/maybe.js";import{getGeometryZScaler as t}from"../../../geometry/support/zscale.js";import{unquantizeOptimizedGeometry as r,convertToGeometry as s}from"../../../layers/graphics/featureConversionUtils.js";function o(e,t){return t}function i(e,t,r,s){switch(r){case 0:return u(e,t+s,0);case 1:return"lowerLeft"===e.originPosition?u(e,t+s,1):l(e,t+s,1)}}function n(e,t,r,s){return 2===r?u(e,t,2):i(e,t,r,s)}function a(e,t,r,s){return 2===r?0===t?0:u(e,t,2):i(e,t,r,s)}function h(e,t,r,s){return 3===r?0===t?0:u(e,t,3):n(e,t,r,s)}function u({translate:e,scale:t},r,s){return e[s]+r*t[s]}function l({translate:e,scale:t},r,s){return e[s]-r*t[s]}class d{constructor(e){this._options=e,this.geometryTypes=["esriGeometryPoint","esriGeometryMultipoint","esriGeometryPolyline","esriGeometryPolygon"],this._previousCoordinate=[0,0],this._transform=null,this._applyTransform=o,this._lengths=[],this._currentLengthIndex=0,this._toAddInCurrentPath=0,this._vertexDimension=0,this._mValueOffset=null,this._coordinateBuffer=null,this._coordinateBufferPtr=0,this._attributesConstructor=class{}}createFeatureResult(){return{fields:[],features:[]}}finishFeatureResult(e){if(this._options.applyTransform&&(e.transform=null),this._attributesConstructor=class{},this._coordinateBuffer=null,this._lengths.length=0,!e.hasZ)return;const r=t(e.geometryType,this._options.sourceSpatialReference,e.spatialReference);if(null!=r)for(const t of e.features)r(t.geometry)}createSpatialReference(){return{}}addField(t,r){const s=t.fields;e(s),s.push(r);const o=s.map((e=>e.name));this._attributesConstructor=function(){for(const e of o)this[e]=null}}addFeature(e,t){e.features.push(t)}prepareFeatures(e){switch(this._transform=e.transform,this._options.applyTransform&&e.transform&&(this._applyTransform=this._deriveApplyTransform(e)),this._mValueOffset=null,this._vertexDimension=2,e.hasZ&&this._vertexDimension++,e.hasM&&(this._mValueOffset=this._vertexDimension,this._vertexDimension++),e.geometryType){case"esriGeometryPoint":this.addCoordinate=(e,t,r)=>this.addCoordinatePoint(e,t,r),this.createGeometry=e=>this.createPointGeometry(e);break;case"esriGeometryPolygon":this.addCoordinate=(e,t,r)=>this._addCoordinatePolygon(e,t,r),this.createGeometry=e=>this._createPolygonGeometry(e);break;case"esriGeometryPolyline":this.addCoordinate=(e,t,r)=>this._addCoordinatePolyline(e,t,r),this.createGeometry=e=>this._createPolylineGeometry(e);break;case"esriGeometryMultipoint":this.addCoordinate=(e,t,r)=>this._addCoordinateMultipoint(e,t,r),this.createGeometry=e=>this._createMultipointGeometry(e)}}createFeature(){return this._lengths.length=0,this._currentLengthIndex=0,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0,this._coordinateBuffer=null,this._coordinateBufferPtr=0,{attributes:new this._attributesConstructor}}allocateCoordinates(){}addLength(e,t,r){0===this._lengths.length&&(this._toAddInCurrentPath=t),this._lengths.push(t)}addQueryGeometry(e,t){const{queryGeometry:o,queryGeometryType:i}=t,n=r(o.clone(),o,!1,!1,this._transform),a=s(n,i,!1,!1);e.queryGeometryType=i,e.queryGeometry={...a}}createPointGeometry(e){const t={x:0,y:0,spatialReference:e.spatialReference};return e.hasZ&&(t.z=0),e.hasM&&(t.m=0),t}addCoordinatePoint(e,t,r){const s=this._transform;switch(t=this._applyTransform(s,t,r,0),r){case 0:e.x=t;break;case 1:e.y=t;break;case 2:"z"in e?e.z=t:e.m=t;break;case 3:e.m=t}}_transformPathLikeValue(e,t){let r=0;t<=1&&(r=this._previousCoordinate[t],this._previousCoordinate[t]+=e);const s=this._transform;return null===this._mValueOffset||0!==e||t%this._mValueOffset?this._applyTransform(s,e,t,r):0}_addCoordinatePolyline(e,t,r){this._dehydratedAddPointsCoordinate(e.paths,t,r)}_addCoordinatePolygon(e,t,r){this._dehydratedAddPointsCoordinate(e.rings,t,r)}_addCoordinateMultipoint(e,t,r){0===r&&e.points.push([]);const s=this._transformPathLikeValue(t,r);e.points[e.points.length-1].push(s)}_createPolygonGeometry(e){return{rings:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createPolylineGeometry(e){return{paths:[[]],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_createMultipointGeometry(e){return{points:[],spatialReference:e.spatialReference,hasZ:!!e.hasZ,hasM:!!e.hasM}}_dehydratedAddPointsCoordinate(e,t,r){0===r&&0==this._toAddInCurrentPath--&&(e.push([]),this._toAddInCurrentPath=this._lengths[++this._currentLengthIndex]-1,this._previousCoordinate[0]=0,this._previousCoordinate[1]=0);const s=this._transformPathLikeValue(t,r),o=e[e.length-1];0===r&&(this._coordinateBufferPtr=0,this._coordinateBuffer=new Array(this._vertexDimension),o.push(this._coordinateBuffer)),this._coordinateBuffer[this._coordinateBufferPtr++]=s}_deriveApplyTransform(e){const{hasZ:t,hasM:r}=e;return t&&r?h:t?n:r?a:i}}export{d as JSONFeatureSetParserContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../Graphic.js";import t from"../../core/Logger.js";import{getOrCreateMapValue as r}from"../../core/MapUtils.js";import{fromValues as o}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import n from"../../geometry/Extent.js";import s from"../../geometry/Mesh.js";import i from"../../geometry/Point.js";import a from"../../geometry/SpatialReference.js";import u from"../../geometry/support/MeshGeoreferencedVertexSpace.js";import c from"../../geometry/support/MeshLocalVertexSpace.js";import f from"../../geometry/support/MeshTransform.js";import{ServiceAssetPart as m,ServiceAsset as p}from"../../geometry/support/meshUtils/External.js";import{getFormatIdMimeType as l}from"../../layers/support/infoFor3D.js";import g from"./FeatureSet.js";const y=()=>t.getLogger("esri.rest.support.meshFeatureSet");function h(t,r,o){const n=o.features;o.features=[],delete o.geometryType;const s=g.fromJSON(o);if(s.geometryType="mesh",!o.assetMaps)return s;const i=M(r,o.assetMaps),u=t.sourceSpatialReference??a.WGS84,c=o.globalIdFieldName,{outFields:f}=t,m=null!=f&&f.length>0?E(f.includes("*")?null:new Set(f)):()=>({});for(const a of n){const t=S(a,c,u,r,i);null!=t&&s.features.push(new e({geometry:t,attributes:m(a)}))}return s}function E(e){return({attributes:t})=>{if(!t)return{};if(!e)return t;for(const r in t)e.has(r)||delete t[r];return t}}function S(e,t,r,o,i){const a=e.attributes[t],f=i.get(a);if(null==f)return y().error("mesh-feature-set:asset-not-found","Service returned a feature which was not found in the asset map",e),null;if(!e.geometry)return y().error("mesh-feature-set:no-geometry","Service returned a feature without geometry",e),null;const{originPoint:m,originVector:p}=d(e,r,o),l=n.fromJSON(e.geometry);l.spatialReference=r;const g=j(e.attributes,o),h=f.projectVertices?new u({origin:p}):new c({origin:p}),E=T(f);return E?s.createWithExternalSource(m,E,{extent:l,transform:g,vertexSpace:h}):s.createIncomplete(m,{extent:l,transform:g,vertexSpace:h})}function d({attributes:e},t,{transformFieldRoles:r}){const n=e[r.originX],s=e[r.originY],a=e[r.originZ];return{originPoint:new i({x:n,y:s,z:a,spatialReference:t}),originVector:o(n,s,a)}}function j(e,{transformFieldRoles:t}){return new f({translation:[e[t.translationX],-e[t.translationZ],e[t.translationY]],rotationAxis:[e[t.rotationX],-e[t.rotationZ],e[t.rotationY]],rotationAngle:e[t.rotationDeg],scale:[e[t.scaleX],e[t.scaleZ],e[t.scaleY]]})}var w;function M(e,t){const o=new Map;for(const n of t){const t=n.parentGlobalId;if(null==t)continue;const s=n.assetName,i=n.assetType,a=n.assetHash,u=n.assetURL,c=n.conversionStatus,f=n.seqNo,m=l(i,e.supportedFormats);if(!m){y().error("mesh-feature-set:unknown-format",`Service returned an asset of type ${i}, but it does not list it as a supported type`);continue}const p=r(o,t,(()=>({projectVertices:x(n.flags).projectVertices,files:new Map})));r(p.files,s,(()=>({name:s,type:i,mimeType:m,status:D(c),parts:[]}))).parts[f]={hash:a,url:u}}return o}function T(e){const t=Array.from(e.files.values()),r=new Array;for(const o of t){if(o.status!==w.COMPLETED)return null;const e=new Array;for(const t of o.parts){if(!t)return null;e.push(new m(t.url,t.hash))}r.push(new p(o.name,o.mimeType,e))}return r}function D(e){switch(e){case"COMPLETED":case"SUBMITTED":return w.COMPLETED;case"INPROGRESS":return w.PENDING;default:return w.FAILED}}function x(e){return{projectVertices:e.includes("PROJECT_VERTICES")}}!function(e){e[e.FAILED=0]="FAILED",e[e.PENDING=1]="PENDING",e[e.COMPLETED=2]="COMPLETED"}(w||(w={}));export{M as assetMapFromAssetMapsJSON,S as extractMesh,h as meshFeatureSetFromJSON};
5
+ import e from"../../Graphic.js";import t from"../../core/Logger.js";import{getOrCreateMapValue as r}from"../../core/MapUtils.js";import o from"../../geometry/Extent.js";import n from"../../geometry/Mesh.js";import s from"../../geometry/Point.js";import a from"../../geometry/SpatialReference.js";import i from"../../geometry/support/MeshTransform.js";import{ServiceAssetPart as u,ServiceAsset as c}from"../../geometry/support/meshUtils/External.js";import{getFormatIdMimeType as f}from"../../layers/support/infoFor3D.js";import l from"./FeatureSet.js";const m=()=>t.getLogger("esri.rest.support.meshFeatureSet");function p(t,r,o){const n=o.features;o.features=[],delete o.geometryType;const s=l.fromJSON(o);if(s.geometryType="mesh",!o.assetMaps)return s;const i=S(r,o.assetMaps),u=t.sourceSpatialReference??a.WGS84,c=o.globalIdFieldName,{outFields:f}=t,m=null!=f&&f.length>0?g(f.includes("*")?null:new Set(f)):()=>({});for(const a of n){const t=y(a,c,u,r,i);null!=t&&s.features.push(new e({geometry:t,attributes:m(a)}))}return s}function g(e){return({attributes:t})=>{if(!t)return{};if(!e)return t;for(const r in t)e.has(r)||delete t[r];return t}}function y(e,t,r,s,a){const i=e.attributes[t],u=a.get(i);if(null==u)return m().error("mesh-feature-set:asset-not-found","Service returned a feature which was not found in the asset map",e),null;if(!e.geometry)return m().error("mesh-feature-set:no-geometry","Service returned a feature without geometry",e),null;const c=h(e,r,s),f=o.fromJSON(e.geometry);f.spatialReference=r;const l=E(e.attributes,s),p=u.projectVertices?"georeferenced":"local",g=j(u);return g?n.createWithExternalSource(c,g,{extent:f,transform:l,vertexSpace:p}):n.createIncomplete(c,{extent:f,transform:l,vertexSpace:p})}function h({attributes:e},t,{transformFieldRoles:r}){const o=e[r.originX],n=e[r.originY],a=e[r.originZ];return new s({x:o,y:n,z:a,spatialReference:t})}function E(e,{transformFieldRoles:t}){return new i({translation:[e[t.translationX],-e[t.translationZ],e[t.translationY]],rotationAxis:[e[t.rotationX],-e[t.rotationZ],e[t.rotationY]],rotationAngle:e[t.rotationDeg],scale:[e[t.scaleX],e[t.scaleZ],e[t.scaleY]]})}var d;function S(e,t){const o=new Map;for(const n of t){const t=n.parentGlobalId;if(null==t)continue;const s=n.assetName,a=n.assetType,i=n.assetHash,u=n.assetURL,c=n.conversionStatus,l=n.seqNo,p=f(a,e.supportedFormats);if(!p){m().error("mesh-feature-set:unknown-format",`Service returned an asset of type ${a}, but it does not list it as a supported type`);continue}const g=r(o,t,(()=>({projectVertices:T(n.flags).projectVertices,files:new Map})));r(g.files,s,(()=>({name:s,type:a,mimeType:p,status:w(c),parts:[]}))).parts[l]={hash:i,url:u}}return o}function j(e){const t=Array.from(e.files.values()),r=new Array;for(const o of t){if(o.status!==d.COMPLETED)return null;const e=new Array;for(const t of o.parts){if(!t)return null;e.push(new u(t.url,t.hash))}r.push(new c(o.name,o.mimeType,e))}return r}function w(e){switch(e){case"COMPLETED":case"SUBMITTED":return d.COMPLETED;case"INPROGRESS":return d.PENDING;default:return d.FAILED}}function T(e){return{projectVertices:e.includes("PROJECT_VERTICES")}}!function(e){e[e.FAILED=0]="FAILED",e[e.PENDING=1]="PENDING",e[e.COMPLETED=2]="COMPLETED"}(d||(d={}));export{S as assetMapFromAssetMapsJSON,y as extractMesh,p as meshFeatureSetFromJSON};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- const c="20240212",b="b229408ae7d0cc0adc3bccbb02256f73d25b4a80";export{c as buildDate,b as commitHash};
5
+ const c="20240213",d="0dc7267612dbcfc0180202659a8234afb5d42d5b";export{c as buildDate,d 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.30/esri/copyright.txt for details.
4
4
  */
5
- const o=15.5;export{o as dashRadius};
5
+ const o=15.5,t=1024;export{o as dashRadius,t as maxTileCoordValue};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../Color.js";import{getColorLuminance as t}from"../../core/colorUtils.js";import a from"../../core/Error.js";import{loadFont as n}from"../../core/fontUtils.js";import{pt2px as l,px2pt as i}from"../../core/screenUtils.js";import{getFill as o,getStroke as s,getDashArray as r,getPatternUrlWithColor as c}from"./gfxUtils.js";import{SymbolSizeDefaults as h,shapes as m,adjustColorBrightness as u}from"./previewUtils.js";import{renderSymbol as p}from"./renderUtils.js";import{backgroundPadding as d}from"./textUtils.js";const f="picture-fill",y="picture-marker",g="simple-fill",w="simple-line",v="simple-marker",b="text",k="Aa",x=h.size,M=h.maxSize,z=h.maxOutlineSize,L=h.lineWidth,j=225,C=document.createElement("canvas");function S(e,t){const a=C.getContext("2d"),n=[];return t&&(t.weight&&n.push(t.weight),t.size&&n.push(t.size+"px"),t.family&&n.push(t.family)),a.font=n.join(" "),a.measureText(e).width}const F=7.2/2.54,U=72/2.54;function E(e){if(0===e.length)return 0;if(e.length>2){const t=i(1),a=parseFloat(e);switch(e.slice(-2)){case"px":return a;case"pt":return a*t;case"in":return 72*a*t;case"pc":return 12*a*t;case"mm":return a*F*t;case"cm":return a*U*t}}return parseFloat(e)}function Z(e){const t=e?.size;return{width:null!=t&&"object"==typeof t&&"width"in t?l(t.width):null,height:null!=t&&"object"==typeof t&&"height"in t?l(t.height):null}}async function D(e,t){const a=t.fill,n=e.color;if("pattern"===a?.type&&n&&e.type!==f){const e=await c(a.src,n.toCss(!0));a.src=e,t.fill=a}}async function O(e,t,a,l){if(!("font"in e)||!e.font||"text"!==t.shape.type)return;try{await n(e.font)}catch{}const{width:i}=Z(l),o=/[\uE600-\uE6FF]/.test(t.shape.text);null!=i||o||(a[0]=S(t.shape.text,{weight:t.font?.weight,size:t.font?.size,family:t.font?.family}))}function P(e,t,a,n,i){if(null!=e.haloColor&&null!=e.haloSize){i.masking??=a.map((()=>[]));const o=l(e.haloSize);n[0]+=o,n[1]+=o,a.unshift([{...t,fill:null,stroke:{color:e.haloColor,width:2*o,join:"round",cap:"round"}}]),i.masking.unshift([{shape:{type:"rect",x:0,y:0,width:n[0]+2*d,height:n[1]+2*d},fill:[255,255,255],stroke:null},{...t,fill:[0,0,0,0],stroke:null}])}null==e.backgroundColor&&null==e.borderLineColor||(n[0]+=2*d,n[1]+=2*d,a.unshift([{shape:{type:"rect",x:0,y:0,width:n[0],height:n[1]},fill:e.backgroundColor,stroke:{color:e.borderLineColor,width:l(e.borderLineSize)}}]),i.masking?.unshift([]))}function T(e,t){return e>t?"dark":"light"}function q(e,t){const a="number"==typeof t?.size?t?.size:null,n=null!=a?l(a):null,i=null!=t?.maxSize?l(t.maxSize):null,c=null!=t?.rotation?t.rotation:"angle"in e?e.angle:null,h=o(e);let u=s(e);"dark"!==V(e,245)||t?.ignoreWhiteSymbols||(u={width:.75,...u,color:"#bdc3c7"});const p={shape:null,fill:h,stroke:u,offset:[0,0]};u?.width&&(u.width=Math.min(u.width,z));const d=u?.width||0;let j=null!=t?.size&&(null==t?.scale||t?.scale),C=0,F=0,U=!1;switch(e.type){case v:{const a=e.style,{width:o,height:s}=Z(t),r=o===s&&null!=o?o:null!=n?n:Math.min(l(e.size),i||M);switch(C=r,F=r,a){case"circle":p.shape={type:"circle",cx:0,cy:0,r:.5*r},j||(C+=d,F+=d);break;case"cross":p.shape={type:"path",path:[{command:"M",values:[0,.5*F]},{command:"L",values:[C,.5*F]},{command:"M",values:[.5*C,0]},{command:"L",values:[.5*C,F]}]};break;case"diamond":p.shape={type:"path",path:[{command:"M",values:[0,.5*F]},{command:"L",values:[.5*C,0]},{command:"L",values:[C,.5*F]},{command:"L",values:[.5*C,F]},{command:"Z",values:[]}]},j||(C+=d,F+=d);break;case"square":p.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[C,0]},{command:"L",values:[C,F]},{command:"L",values:[0,F]},{command:"Z",values:[]}]},j||(C+=d,F+=d),c&&(U=!0);break;case"triangle":p.shape={type:"path",path:[{command:"M",values:[.5*C,0]},{command:"L",values:[C,F]},{command:"L",values:[0,F]},{command:"Z",values:[]}]},j||(C+=d,F+=d),c&&(U=!0);break;case"x":p.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[C,F]},{command:"M",values:[C,0]},{command:"L",values:[0,F]}]},c&&(U=!0);break;case"path":p.shape={type:"path",path:e.path||""},j||(C+=d,F+=d),c&&(U=!0),j=!0}break}case w:{const{width:e,height:a}=Z(t),l=r(u).reduce(((e,t)=>e+t),0),i=l&&Math.ceil(L/l),o=a??n??d,s=e??(l*i||L);u&&(u.width=o),C=s,F=o,j=!0,p.shape={type:"path",path:[{command:"M",values:[o/2,F/2]},{command:"L",values:[C-o/2,F/2]}]};break}case f:case g:{const e="object"==typeof t?.symbolConfig&&!!t?.symbolConfig?.isSquareFill,{width:a,height:l}=Z(t);C=!e&&a!==l||null==a?null!=n?n:x:a,F=!e&&a!==l||null==l?C:l,j||(C+=d,F+=d),j=!0,p.shape=e?{type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[C,0]},{command:"L",values:[C,F]},{command:"L",values:[0,F]},{command:"L",values:[0,0]},{command:"Z",values:[]}]}:m.fill[0];break}case y:{const a=Math.min(l(e.width),i||M),o=Math.min(l(e.height),i||M),{width:s,height:r}=Z(t),h=s===r&&null!=s?s:null!=n?n:Math.max(a,o),m=a/o;C=m<=1?Math.ceil(h*m):h,F=m<=1?h:Math.ceil(h/m),p.shape={type:"image",x:-Math.round(C/2),y:-Math.round(F/2),width:C,height:F,src:e.url||""},c&&(U=!0);break}case b:{const a=e,o=t?.overrideText||a.text||k,s=a.font,{width:r,height:h}=Z(t),m=null!=h?h:null!=n?n:Math.min(l(s.size),i||M),u=S(o,{weight:s.weight,size:m,family:s.family}),d=/[\uE600-\uE6FF]/.test(o);if(C=r??(d?m:u),F=m,c){const e=c*(Math.PI/180);F=C*Math.abs(Math.sin(e))+F*Math.abs(Math.cos(e))}let f=.25*E((s?m:0).toString());d&&(f+=5),p.shape={type:"text",text:o,x:a.xoffset||0,y:a.yoffset||f,align:"middle",alignBaseline:a.verticalAlignment,decoration:s&&s.decoration,rotated:a.rotated,kerning:a.kerning},p.font=s&&{size:m,style:s.style,decoration:s.decoration,weight:s.weight,family:s.family};break}}return{shapeDescriptor:p,size:[C,F],renderOptions:{node:t?.node,scale:j,opacity:t?.opacity,rotation:c,useRotationSize:U,effectView:t?.effectView,ariaLabel:t?.ariaLabel}}}async function A(e,t){const{shapeDescriptor:n,size:l,renderOptions:i}=q(e,t);if(!n.shape)throw new a("symbolPreview: renderPreviewHTML2D","symbol not supported.");await D(e,n),await O(e,n,l,t);const o=[[n]];if("object"==typeof t?.symbolConfig&&t?.symbolConfig?.applyColorModulation){const e=.6*l[0];o.unshift([{...n,offset:[-e,0],fill:u(n.fill,-.3)}]),o.push([{...n,offset:[e,0],fill:u(n.fill,.3)}]),l[0]+=2*e,i.scale=!1}return"text"===e.type&&P(e,n,o,l,i),p(o,l,i)}function V(a,n=j){const l=o(a),i=s(a),r=!l||"type"in l?null:new e(l),c=i?.color?new e(i?.color):null,h=r?T(t(r),n):null,m=c?T(t(c),n):null;return m?h?h===m?h:n>=j?"light":"dark":m:h}export{V as getContrastingBackgroundTheme,q as getRenderSymbolParameters,A as previewSymbol2D};
5
+ import e from"../../Color.js";import{getColorLuminance as t}from"../../core/colorUtils.js";import a from"../../core/Error.js";import{loadFont as o}from"../../core/fontUtils.js";import{pt2px as i}from"../../core/screenUtils.js";import{getFill as l,getStroke as n,getDashArray as s,getPatternUrlWithColor as r}from"./gfxUtils.js";import{SymbolSizeDefaults as c,shapes as h,adjustColorBrightness as u}from"./previewUtils.js";import{renderSymbol as m}from"./renderUtils.js";import{backgroundPadding as p}from"./textUtils.js";const d="picture-fill",f="picture-marker",y="simple-fill",g="simple-line",w="simple-marker",v="text",x="Aa",b=c.size,M=c.maxSize,k=c.maxOutlineSize,L=c.lineWidth,z=225,j=document.createElement("canvas");function C(e,t){const a=j.getContext("2d"),o=[];t&&(t.weight&&o.push(t.weight),t.size&&o.push(t.size+"px"),t.family&&o.push(t.family)),a.font=o.join(" ");const{width:i,actualBoundingBoxLeft:l,actualBoundingBoxRight:n,actualBoundingBoxAscent:s,actualBoundingBoxDescent:r}=a.measureText(e);return{width:Math.ceil(Math.max(i,l+n)),height:Math.ceil(s+r),x:Math.floor(l),y:Math.floor((s-r)/2)}}function S(e){const t=e?.size;return{width:null!=t&&"object"==typeof t&&"width"in t?i(t.width):null,height:null!=t&&"object"==typeof t&&"height"in t?i(t.height):null}}async function B(e,t){const a=t.fill,o=e.color;if("pattern"===a?.type&&o&&e.type!==d){const e=await r(a.src,o.toCss(!0));a.src=e,t.fill=a}}async function U(e,t,a,i){if(!("font"in e)||!e.font||"text"!==t.shape.type)return;try{await o(e.font)}catch{}const{width:l,height:n}=S(i);if(!/[\uE600-\uE6FF]/.test(t.shape.text)){const{width:o,height:s,x:r,y:c}=C(t.shape.text,{weight:t.font?.weight,size:t.font?.size,family:t.font?.family});a[0]=l??o,a[1]=n??s,t.shape.x=r,t.shape.y=c;const h=null!=i?.rotation?i.rotation:"angle"in e?e.angle:null;if(h){const e=h*(Math.PI/180),t=Math.abs(Math.sin(e)),o=Math.abs(Math.cos(e));a[1]=a[0]*t+a[1]*o}}}function E(e,t,a,o,l){if(null!=e.haloColor&&null!=e.haloSize){l.masking??=a.map((()=>[]));const n=i(e.haloSize);o[0]+=n,o[1]+=n,a.unshift([{...t,fill:null,stroke:{color:e.haloColor,width:2*n,join:"round",cap:"round"}}]),l.masking.unshift([{shape:{type:"rect",x:0,y:0,width:o[0]+2*p,height:o[1]+2*p},fill:[255,255,255],stroke:null},{...t,fill:[0,0,0,0],stroke:null}])}null==e.backgroundColor&&null==e.borderLineColor||(o[0]+=2*p,o[1]+=2*p,a.unshift([{shape:{type:"rect",x:0,y:0,width:o[0],height:o[1]},fill:e.backgroundColor,stroke:{color:e.borderLineColor,width:i(e.borderLineSize)}}]),l.masking?.unshift([]))}function F(e,t){return e>t?"dark":"light"}function D(e,t){const a="number"==typeof t?.size?t?.size:null,o=null!=a?i(a):null,r=null!=t?.maxSize?i(t.maxSize):null,c=null!=t?.rotation?t.rotation:"angle"in e?e.angle:null,u=l(e);let m=n(e);"dark"!==A(e,245)||t?.ignoreWhiteSymbols||(m={width:.75,...m,color:"#bdc3c7"});const p={shape:null,fill:u,stroke:m,offset:[0,0]};m?.width&&(m.width=Math.min(m.width,k));const z=m?.width||0;let j=null!=t?.size&&(null==t?.scale||t?.scale),B=0,U=0,E=!1;switch(e.type){case w:{const a=e.style,{width:l,height:n}=S(t),s=l===n&&null!=l?l:null!=o?o:Math.min(i(e.size),r||M);switch(B=s,U=s,a){case"circle":p.shape={type:"circle",cx:0,cy:0,r:.5*s},j||(B+=z,U+=z);break;case"cross":p.shape={type:"path",path:[{command:"M",values:[0,.5*U]},{command:"L",values:[B,.5*U]},{command:"M",values:[.5*B,0]},{command:"L",values:[.5*B,U]}]};break;case"diamond":p.shape={type:"path",path:[{command:"M",values:[0,.5*U]},{command:"L",values:[.5*B,0]},{command:"L",values:[B,.5*U]},{command:"L",values:[.5*B,U]},{command:"Z",values:[]}]},j||(B+=z,U+=z);break;case"square":p.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[B,0]},{command:"L",values:[B,U]},{command:"L",values:[0,U]},{command:"Z",values:[]}]},j||(B+=z,U+=z),c&&(E=!0);break;case"triangle":p.shape={type:"path",path:[{command:"M",values:[.5*B,0]},{command:"L",values:[B,U]},{command:"L",values:[0,U]},{command:"Z",values:[]}]},j||(B+=z,U+=z),c&&(E=!0);break;case"x":p.shape={type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[B,U]},{command:"M",values:[B,0]},{command:"L",values:[0,U]}]},c&&(E=!0);break;case"path":p.shape={type:"path",path:e.path||""},j||(B+=z,U+=z),c&&(E=!0),j=!0}break}case g:{const{width:e,height:a}=S(t),i=s(m).reduce(((e,t)=>e+t),0),l=i&&Math.ceil(L/i),n=a??o??z,r=e??(i*l||L);m&&(m.width=n),B=r,U=n,j=!0,p.shape={type:"path",path:[{command:"M",values:[n/2,U/2]},{command:"L",values:[B-n/2,U/2]}]};break}case d:case y:{const e="object"==typeof t?.symbolConfig&&!!t?.symbolConfig?.isSquareFill,{width:a,height:i}=S(t);B=!e&&a!==i||null==a?null!=o?o:b:a,U=!e&&a!==i||null==i?B:i,j||(B+=z,U+=z),j=!0,p.shape=e?{type:"path",path:[{command:"M",values:[0,0]},{command:"L",values:[B,0]},{command:"L",values:[B,U]},{command:"L",values:[0,U]},{command:"L",values:[0,0]},{command:"Z",values:[]}]}:h.fill[0];break}case f:{const a=Math.min(i(e.width),r||M),l=Math.min(i(e.height),r||M),{width:n,height:s}=S(t),h=n===s&&null!=n?n:null!=o?o:Math.max(a,l),u=a/l;B=u<=1?Math.ceil(h*u):h,U=u<=1?h:Math.ceil(h/u),p.shape={type:"image",x:-Math.round(B/2),y:-Math.round(U/2),width:B,height:U,src:e.url||""},c&&(E=!0);break}case v:{const a=e,l=t?.overrideText||a.text||x,n=a.font,{width:s,height:c}=S(t),h=null!=c?c:null!=o?o:Math.min(i(n.size),r||M),{width:u,height:m}=C(l,{weight:n.weight,size:h,family:n.family}),d=/[\uE600-\uE6FF]/.test(l);B=s??(d?h:u),U=d?h:m;let f=.5*(d?h:m);d&&(f+=5),p.shape={type:"text",text:l,x:a.xoffset||0,y:a.yoffset||f,align:"middle",alignBaseline:a.verticalAlignment,decoration:n&&n.decoration,rotated:a.rotated,kerning:a.kerning},p.font=n&&{size:h,style:n.style,decoration:n.decoration,weight:n.weight,family:n.family};break}}return{shapeDescriptor:p,size:[B,U],renderOptions:{node:t?.node,scale:j,opacity:t?.opacity,rotation:c,useRotationSize:E,effectView:t?.effectView,ariaLabel:t?.ariaLabel}}}async function Z(e,t){const{shapeDescriptor:o,size:i,renderOptions:l}=D(e,t);if(!o.shape)throw new a("symbolPreview: renderPreviewHTML2D","symbol not supported.");await B(e,o),await U(e,o,i,t);const n=[[o]];if("object"==typeof t?.symbolConfig&&t?.symbolConfig?.applyColorModulation){const e=.6*i[0];n.unshift([{...o,offset:[-e,0],fill:u(o.fill,-.3)}]),n.push([{...o,offset:[e,0],fill:u(o.fill,.3)}]),i[0]+=2*e,l.scale=!1}return"text"===e.type&&E(e,o,n,i,l),m(n,i,l)}function A(a,o=z){const i=l(a),s=n(a),r=!i||"type"in i?null:new e(i),c=s?.color?new e(s?.color):null,h=r?F(t(r),o):null,u=c?F(t(c),o):null;return u?h?h===u?h:o>=z?"light":"dark":u:h}export{A as getContrastingBackgroundTheme,D as getRenderSymbolParameters,Z as previewSymbol2D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{generateLowercaseBracedUUID as e}from"../../core/uuid.js";const r=e(),t=new Map,n=new Map,o=new Map;async function s(e,t,o=!1){if(!e||!t)return!0;const s=e.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,""),a=n.get(s)?.entries();if(a)for(const[n,i]of a)if(i.name===t){const e=!i.stack?.hasForwardEdits();if(!e&&o){const[{deleteForwardEdits:e},{default:t}]=await Promise.all([import("../../rest/versionManagement/gdbVersion/deleteForwardEdits.js"),import("../../rest/versionManagement/gdbVersion/support/DeleteForwardEditsParameters.js")]);return e(s,n,new t({sessionId:r,moment:i.moment}))}return e}return!0}function a(e,r){if(!e)return!1;const t=e.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,""),o=n.get(t)?.entries();if(o)for(const[n,s]of o)if(s.name===r){return"edit"===s.lockType}return!1}export{r as currentSessionId,t as defaultVersionNameLookup,s as isSafeToEditVersion,a as isVersionInEditSession,n as versionCollection,o as versionCollectionCount};
5
+ import e from"../../request.js";import{generateLowercaseBracedUUID as r}from"../../core/uuid.js";const t=r(),n=new Map,o=new Map,s=new Map;async function a(r,t,o){if(!r||!o)return!1;if(!t)return!0;const s=new URL(r).host;let a=n.get(s);if(!a){const t=r.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,"");a=(await e(t,{responseType:"json",query:{f:"json"}})).data.defaultVersionName}return a===t}async function i(e,r,n=!1){if(!e||!r)return!0;const s=e.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,""),a=o.get(s)?.entries();if(a)for(const[o,i]of a)if(i.name===r){const e=!i.stack?.hasForwardEdits();if(!e&&n){const[{deleteForwardEdits:e},{default:r}]=await Promise.all([import("../../rest/versionManagement/gdbVersion/deleteForwardEdits.js"),import("../../rest/versionManagement/gdbVersion/support/DeleteForwardEditsParameters.js")]);return e(s,o,new r({sessionId:t,moment:i.moment}))}return e}return!0}function c(e,r){if(!e)return!1;const t=e.replace(/\/FeatureServer/i,"/VersionManagementServer").replace(/\/\d*$/,""),n=o.get(t)?.entries();if(n)for(const[o,s]of n)if(s.name===r){return"edit"===s.lockType}return!1}export{t as currentSessionId,n as defaultVersionNameLookup,a as isHistoricVersion,i as isSafeToEditVersion,c as isVersionInEditSession,o as versionCollection,s as versionCollectionCount};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../../core/has.js";import{filterFlag0 as e,effectFlag0 as t}from"../definitions.js";import{CollisionBitsetGrid as o,none as i,hasCollision as n,outsideExtent as s}from"./CollisionGrid.js";const l=254,r=255,a=0;function c(e,t){const o=e.children.slice();o.sort(((e,t)=>e.tileAge-t.tileAge)),o.forEach((e=>{null!=e.labelMetrics&&e.isReady&&t(e,e.labelMetrics)}))}function f(e,t){return(!e.minScale||e.minScale>=t)&&(!e.maxScale||e.maxScale<=t)}class d{run(e,t,o,i){const n=[];for(let s=e.length-1;s>=0;s--){const t=e[s];t.labelingCollisionInfos?.length&&n.push(...t.labelingCollisionInfos)}has("esri-2d-update-debug")&&n.length&&console.debug("CollisionEngine.run"),this._transformMetrics(n),this._runCollision(n,t,o,i);for(const s of n)s.container.requestRender()}_runCollision(e,t,i,n){const[s,l]=t.state.size,f=new o(s,l,t.pixelRatio);for(const{container:o,deconflictionEnabled:d,visible:b}of e){const e=o.attributeView;d?b?(this._prepare(o),this._collideVisible(f,o,i,n),this._collideInvisible(f,o)):c(o,((t,o)=>{for(const i of o)e.setLabelMinZoom(i.entityTexel,r)})):c(o,((t,o)=>{for(const i of o)e.setLabelMinZoom(i.entityTexel,a),b&&f.insertMetrics(i)}))}}_isFiltered(o,i,n){const s=i.getFilterFlags(o),l=!n.hasFilter||!!(s&e),r=null==n.featureEffect||n.featureEffect.excludedLabelsVisible||!!(s&t);return!(l&&r)}_prepare(e){const t=e.attributeView,o=new Set;c(e,((i,n)=>{for(const s of n){const i=s.entityTexel;if(o.has(i))continue;if(o.add(i),this._isFiltered(i,t,e.layerView)){t.setLabelMinZoom(i,l);continue}t.getLabelMinZoom(i)!==a?t.setLabelMinZoom(i,r):t.setLabelMinZoom(i,a)}}))}_collideVisible(e,t,o,r){const d=t.attributeView,b=new Set;c(t,((t,c)=>{for(const u of c){const c=u.entityTexel;if(!b.has(c))if(t.key.level===r)if(f(u,o)){if(0===d.getLabelMinZoom(c)){switch(e.insertMetrics(u)){case s:break;case n:d.setLabelMinZoom(c,l),b.add(c);break;case i:d.setLabelMinZoom(c,a),b.add(c)}}}else d.setLabelMinZoom(c,l);else d.setLabelMinZoom(c,l)}}))}_collideInvisible(e,t){const o=t.attributeView,l=new Set;c(t,((t,c)=>{for(const f of c){const t=f.entityTexel;if(!l.has(t)&&o.getLabelMinZoom(t)===r){switch(e.insertMetrics(f)){case s:break;case n:o.setLabelMinZoom(t,r),l.add(t);break;case i:o.setLabelMinZoom(t,a),l.add(t)}}}}))}_transformMetrics(e){for(const{container:t,geometryType:o,vvEvaluators:i}of e)c(t,((e,n)=>{const s=t.attributeView,l=e.transforms.labelMat2d;l[4]=Math.round(l[4]),l[5]=Math.round(l[5]);const r="polyline"===o;for(const t of n){const{entityTexel:e,anchorX:o,anchorY:n}=t;let a=t.referenceBounds.size;const c=i[0];if(null!=c){const t=c(s.getVVSize(e));a=isNaN(t)||null==t||t===1/0?a:t}const f=t.directionX*(a/2),d=t.directionY*(a/2);for(const i of t.bounds){let e=o,t=n;if(r){let o=e+i.x+f,n=t+i.y+d;o=l[0]*o+l[2]*n+l[4],n=l[1]*o+l[3]*n+l[5],i.computedX=Math.floor(o),i.computedY=Math.floor(n)}else{e=l[0]*o+l[2]*n+l[4],t=l[1]*o+l[3]*n+l[5];const s=e+i.x+f,r=t+i.y+d;i.computedX=s,i.computedY=r}}}}))}}export{d as CollisionEngine};
5
+ import has from"../../../../../core/has.js";import{filterFlag0 as e,effectFlag0 as t}from"../definitions.js";import{CollisionBitsetGrid as o,hasCollision as i}from"./CollisionGrid.js";const n=254,l=255,s=0;function r(e,t){const o=e.children.slice();o.sort(((e,t)=>e.tileAge-t.tileAge)),o.forEach((e=>{null!=e.labelMetrics&&e.isReady&&t(e,e.labelMetrics)}))}function c(e,t){return(!e.minScale||e.minScale>=t)&&(!e.maxScale||e.maxScale<=t)}class a{run(e,t,o,i){const n=[];for(let l=e.length-1;l>=0;l--){const t=e[l];t.labelingCollisionInfos?.length&&n.push(...t.labelingCollisionInfos)}has("esri-2d-update-debug")&&n.length&&console.debug("CollisionEngine.run"),this._transformMetrics(n),this._runCollision(n,t,o,i);for(const l of n)l.container.requestRender()}_runCollision(e,t,i,n){const[c,a]=t.state.size,f=new o(c,a,t.pixelRatio);for(const{container:o,deconflictionEnabled:u,visible:d}of e){const e=o.attributeView;u?d?(this._prepare(o),this._collideVisible(f,o,i,n),this._collideInvisible(f,o)):r(o,((t,o)=>{for(const i of o)e.setLabelMinZoom(i.entityTexel,l)})):r(o,((t,o)=>{for(const i of o)e.setLabelMinZoom(i.entityTexel,s),d&&f.insertMetrics(i)}))}}_isFiltered(o,i,n){const l=i.getFilterFlags(o),s=!n.hasFilter||!!(l&e),r=null==n.featureEffect||n.featureEffect.excludedLabelsVisible||!!(l&t);return!(s&&r)}_prepare(e){const t=e.attributeView,o=new Set;r(e,((i,r)=>{for(const c of r){const i=c.entityTexel;if(o.has(i))continue;if(o.add(i),this._isFiltered(i,t,e.layerView)){t.setLabelMinZoom(i,n);continue}t.getLabelMinZoom(i)!==s?t.setLabelMinZoom(i,l):t.setLabelMinZoom(i,s)}}))}_collideVisible(e,t,o,l){const a=t.attributeView,f=new Set;r(t,((t,r)=>{for(let u=0;u<r.length;u++){const d=r[u].entityTexel;if(f.has(d))continue;if(f.add(d),t.key.level!==l){a.setLabelMinZoom(d,n);continue}if(!c(r[u],o)){a.setLabelMinZoom(d,n);continue}if(0!==a.getLabelMinZoom(d))continue;let b=!1;const m=u;for(let t=m;t<r.length;t++,u++){const o=r[t];if(o.entityTexel!==d)break;if(b)continue;e.hasCollision(o)===i&&(b=!0)}if(!b)for(let t=m;t<u;t++)e.insertMetrics(r[t]);a.setLabelMinZoom(d,b?n:s)}}))}_collideInvisible(e,t){const o=t.attributeView,n=new Set;r(t,((t,r)=>{for(let c=0;c<r.length;c++){const t=r[c].entityTexel;if(n.has(t))continue;if(n.add(t),o.getLabelMinZoom(t)!==l)continue;let a=!1;const f=c;for(let o=f;o<r.length;o++,c++){const n=r[o];if(n.entityTexel!==t)break;if(a)continue;e.hasCollision(n)===i&&(a=!0)}if(!a)for(let o=f;o<c;o++)e.insertMetrics(r[o]);o.setLabelMinZoom(t,a?l:s)}}))}_transformMetrics(e){for(const{container:t,geometryType:o,vvEvaluators:i}of e)r(t,((e,n)=>{const l=t.attributeView,s=e.transforms.labelMat2d;s[4]=Math.round(s[4]),s[5]=Math.round(s[5]);const r="polyline"===o;for(const t of n){const{entityTexel:e,anchorX:o,anchorY:n}=t;let c=t.referenceBounds?.size??0;const a=i[0];if(null!=a){const t=a(l.getVVSize(e));c=isNaN(t)||null==t||t===1/0?c:t}const f=t.directionX*(c/2),u=t.directionY*(c/2);for(const i of t.bounds){let e=o,t=n;if(r){let o=e+i.x+f,n=t+i.y+u;o=s[0]*o+s[2]*n+s[4],n=s[1]*o+s[3]*n+s[5],i.computedX=Math.floor(o),i.computedY=Math.floor(n)}else{e=s[0]*o+s[2]*n+s[4],t=s[1]*o+s[3]*n+s[5];const l=e+i.x+f,r=t+i.y+u;i.computedX=l,i.computedY=r}}}}))}}export{a as CollisionEngine};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as t}from"../../../../../core/mathUtils.js";import{labelPlacementOffsetPadding as s}from"../definitions.js";import{StaticBitSet as i}from"../../../layers/features/support/StaticBitSet.js";const e=1,h=0,o=1,r=2;class l{constructor(t,s,h){this._debugMap=new Map,this._width=t*h,this._height=s*h,this._pixelRatio=h;const o=Math.ceil(this._width/e),r=Math.ceil(this._height/e);this._cols=o,this._rows=r,this._cells=i.create(o*r)}insertMetrics(t){const s=this._hasCollision(t);return s===h&&this._markMetrics(t),s}getCellId(t,s){return t+s*this._cols}has(t){return this._cells.has(t)}hasRange(t,s){return this._cells.hasRange(t,s)}set(t){this._cells.set(t)}setRange(t,s){this._cells.setRange(t,s)}_collide(s,i,l,c){const a=s-l/2,n=i-c/2,_=a+l,u=n+c;if(_<0||u<0||a>this._width||n>this._height)return o;const d=t(Math.floor(a/e),0,this._cols),f=t(Math.floor(n/e),0,this._rows),p=t(Math.ceil(_/e),0,this._cols),M=t(Math.ceil(u/e),0,this._rows);for(let t=f;t<=M;t++)for(let s=d;s<=p;s++){const i=this.getCellId(s,t);if(this.has(i))return r}return h}_mark(s,i,h,o,r){const l=s-h/2,c=i-o/2,a=l+h,n=c+o,_=t(Math.floor(l/e),0,this._cols),u=t(Math.floor(c/e),0,this._rows),d=t(Math.ceil(a/e),0,this._cols),f=t(Math.ceil(n/e),0,this._rows);for(let t=u;t<=f;t++)for(let s=_;s<=d;s++){const i=this.getCellId(s,t);this._debugMap.set(i,r),this.set(i)}return!1}_hasCollision(t){let i=0;for(const{computedX:e,computedY:h,width:l,height:c}of t.bounds){const t=(l+s)*this._pixelRatio,a=(c+s)*this._pixelRatio;switch(this._collide(e,h,t,a)){case r:return r;case o:i++}}return i===t.bounds.length?o:h}_markMetrics(t){for(const{computedX:i,computedY:e,width:h,height:o}of t.bounds){const r=(h+s)*this._pixelRatio,l=(o+s)*this._pixelRatio;this._mark(i,e,r,l,t.entityTexel)}}}export{l as CollisionBitsetGrid,r as hasCollision,h as none,o as outsideExtent};
5
+ import{clamp as t}from"../../../../../core/mathUtils.js";import{labelPlacementOffsetPadding as s}from"../definitions.js";import{StaticBitSet as i}from"../../../layers/features/support/StaticBitSet.js";const e=1,h=0,o=1,r=2;class l{constructor(t,s,h){this._debugMap=new Map,this._width=t*h,this._height=s*h,this._pixelRatio=h;const o=Math.ceil(this._width/e),r=Math.ceil(this._height/e);this._cols=o,this._rows=r,this._cells=i.create(o*r)}insertMetrics(t){this._markMetrics(t)}hasCollision(t){let i=0;for(const{computedX:e,computedY:h,width:l,height:c}of t.bounds){const t=(l+s)*this._pixelRatio,a=(c+s)*this._pixelRatio;switch(this._collide(e,h,t,a)){case r:return r;case o:i++}}return i===t.bounds.length?o:h}getCellId(t,s){return t+s*this._cols}has(t){return this._cells.has(t)}hasRange(t,s){return this._cells.hasRange(t,s)}set(t){this._cells.set(t)}setRange(t,s){this._cells.setRange(t,s)}_collide(s,i,l,c){const a=s-l/2,n=i-c/2,_=a+l,u=n+c;if(_<0||u<0||a>this._width||n>this._height)return o;const d=t(Math.floor(a/e),0,this._cols),f=t(Math.floor(n/e),0,this._rows),p=t(Math.ceil(_/e),0,this._cols),M=t(Math.ceil(u/e),0,this._rows);for(let t=f;t<=M;t++)for(let s=d;s<=p;s++){const i=this.getCellId(s,t);if(this.has(i))return r}return h}_mark(s,i,h,o,r){const l=s-h/2,c=i-o/2,a=l+h,n=c+o,_=t(Math.floor(l/e),0,this._cols),u=t(Math.floor(c/e),0,this._rows),d=t(Math.ceil(a/e),0,this._cols),f=t(Math.ceil(n/e),0,this._rows);for(let t=u;t<=f;t++)for(let s=_;s<=d;s++){const i=this.getCellId(s,t);this._debugMap.set(i,r),this.set(i)}return!1}_markMetrics(t){for(const{computedX:i,computedY:e,width:h,height:o}of t.bounds){const r=(h+s)*this._pixelRatio,l=(o+s)*this._pixelRatio;this._mark(i,e,r,l,t.entityTexel)}}}export{l as CollisionBitsetGrid,r as hasCollision,h as none,o as outsideExtent};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import e from"./BoundingBox.js";import{serializeList as i,deserializeList as t}from"../util/serializationUtils.js";class r{constructor(e,i,t,r,s,n,o,a,h=[]){this.entityTexel=e,this.anchorX=i,this.anchorY=t,this.directionX=r,this.directionY=s,this.maxScale=n,this.minScale=o,this.referenceBounds=a,this.bounds=h}serialize(e){e.push(this.entityTexel),e.writeF32(this.anchorX),e.writeF32(this.anchorY),e.writeF32(this.directionX),e.writeF32(this.directionY),e.writeF32(this.maxScale),e.writeF32(this.minScale),e.writeF32(this.referenceBounds.size),e.writeF32(this.referenceBounds.offsetX),e.writeF32(this.referenceBounds.offsetY),i(e,this.bounds)}static deserialize(i){const s=i.readInt32(),n=i.readF32(),o=i.readF32(),a=i.readF32(),h=i.readF32(),d=i.readF32(),c=i.readF32(),F=i.readF32(),f=i.readF32(),l=i.readF32(),u=t(i,e)??[];return new r(s,n,o,a,h,d,c,{size:F,offsetX:f,offsetY:l},u)}}export{r as LabelMetric};
5
+ import e from"./BoundingBox.js";import{serializeList as i,deserializeList as t}from"../util/serializationUtils.js";class r{constructor(e,i,t,r,s,n,o,a,h=[]){this.entityTexel=e,this.anchorX=i,this.anchorY=t,this.directionX=r,this.directionY=s,this.maxScale=n,this.minScale=o,this.referenceBounds=a,this.bounds=h}serialize(e){e.push(this.entityTexel),e.writeF32(this.anchorX),e.writeF32(this.anchorY),e.writeF32(this.directionX),e.writeF32(this.directionY),e.writeF32(this.maxScale),e.writeF32(this.minScale),null===this.referenceBounds?(e.writeF32(0),e.writeF32(0),e.writeF32(0)):(e.writeF32(this.referenceBounds.size),e.writeF32(this.referenceBounds.offsetX),e.writeF32(this.referenceBounds.offsetY)),i(e,this.bounds)}static deserialize(i){const s=i.readInt32(),n=i.readF32(),o=i.readF32(),a=i.readF32(),h=i.readF32(),d=i.readF32(),c=i.readF32(),F=i.readF32(),f=i.readF32(),l=i.readF32(),u=t(i,e)??[];return new r(s,n,o,a,h,d,c,{size:F,offsetX:f,offsetY:l},u)}}export{r as LabelMetric};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- function t(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t}function e(t,e){return Math.sqrt(t*t+e*e)}function n(t){const n=e(t[0],t[1]);t[0]/=n,t[1]/=n}function s(t,n){return e(t[0]-n[0],t[1]-n[1])}function i(t,e){return t[e+1]}function r(t){return t.length-1}function h(t){let e=0;for(let n=0;n<r(t);n++)e+=a(t,n);return e}function a(t,e,n=1){const[s,r]=i(t,e);return Math.sqrt(s*s+r*r)*n}class c{constructor(t,e,n,s,i){this._segments=t,this._index=e,this._distance=n,this._xStart=s,this._yStart=i,this._done=!1}static create(t){return new c(t,0,0,t[0][0],t[0][1])}clone(){return new c(this._segments,this._index,this._distance,this.xStart,this.yStart)}equals(t){return this._index===t._index||t._index===this._index-1&&(0===this._distance||1===t._distance)||t._index===this._index+1&&(1===this._distance||0===t._distance)}leq(t){return this._index<t._index||this._index===t._index&&this._distance<=t._distance}geq(t){return this._index>t._index||this._index===t._index&&this._distance>=t._distance}get _segment(){return this._segments[this._index+1]}get angle(){const t=this.dy,e=(0*t+-1*-this.dx)/(1*this.length);let n=Math.acos(e);return t>0&&(n=2*Math.PI-n),n}get xStart(){return this._xStart}get yStart(){return this._yStart}get x(){return this.xStart+this.distance*this.dx}get y(){return this.yStart+this.distance*this.dy}get dx(){return this._segment[0]}get dy(){return this._segment[1]}get xMidpoint(){return this.xStart+.5*this.dx}get yMidpoint(){return this.yStart+.5*this.dy}get xEnd(){return this.xStart+this.dx}get yEnd(){return this.yStart+this.dy}get length(){const{dx:t,dy:e}=this;return Math.sqrt(t*t+e*e)}get remainingLength(){return this.length*(1-this._distance)}get backwardLength(){return this.length*this._distance}get distance(){return this._distance}get done(){return this._done}hasPrev(){return this._index-1>=0}hasNext(){return this._index+1<r(this._segments)}next(){return this.hasNext()?(this._xStart+=this.dx,this._yStart+=this.dy,this._distance=0,this._index+=1,this):null}prev(){return this.hasPrev()?(this._index-=1,this._xStart-=this.dx,this._yStart-=this.dy,this._distance=1,this):(this._done=!0,null)}_seekBackwards(t,e){const n=this.backwardLength;if(t<=n)return this._distance=(n-t)/this.length,this;let s=this.backwardLength;for(;this.prev();){if(s+this.length>t)return this._seekBackwards(t-s);s+=this.length}return this._distance=0,e?this:null}seek(t,e=!1){if(t<0)return this._seekBackwards(Math.abs(t),e);if(t<=this.remainingLength)return this._distance=(this.backwardLength+t)/this.length,this;let n=this.remainingLength;for(;this.next();){if(n+this.length>t)return this.seek(t-n,e);n+=this.length}return this._distance=1,e?this:null}}function u(t,e,n,s=!0){const i=h(t),r=c.create(t),a=i/2;if(!s)return r.seek(a),void n(r.clone(),0,a+0*e,i);const u=Math.max((i-e)/2,0),d=Math.floor(u/e),o=a-d*e;r.seek(o);for(let h=-d;h<=d;h++)n(r.clone(),h,a+h*e,i),r.seek(e)}function d(t,e,n){o(n,e,h(t),c.create(t),0)}function o(t,e,n,s,i){if(n<e)return;const r=s.clone().seek(n/2);if(null==r)return;t(r.clone(),n,i),n=(n-e)/2;const h=r.seek(e/2);o(t,e,n,s,i+1),o(t,e,n,h,i+1)}function _(t,e){const n=e;for(let s=0;s<t.length;s++){let e=t[s];l(e,n);const i=[];i.push(e[0]);for(let t=1;t<e.length;t++){const[n,s]=e[t-1],[r,h]=e[t],a=r-n,c=h-s;i.push([a,c])}t[s]=i,e=i}return t}function l(e,i){const r=1e-6;if(i<=0)return;const h=e.length;if(h<3)return;const a=[];let c=0;a.push(0);for(let t=1;t<h;t++)c+=s(e[t],e[t-1]),a.push(c);i=Math.min(i,.2*c);const u=[];u.push(e[0][0]),u.push(e[0][1]);const d=e[h-1][0],o=e[h-1][1],_=t([0,0],e[0],e[1]);n(_),e[0][0]+=i*_[0],e[0][1]+=i*_[1],t(_,e[h-1],e[h-2]),n(_),e[h-1][0]+=i*_[0],e[h-1][1]+=i*_[1];for(let t=1;t<h;t++)a[t]+=i;a[h-1]+=i;const l=.5*i;for(let t=1;t<h-1;t++){let n=0,s=0,c=0;for(let h=t-1;h>=0&&!(a[h+1]<a[t]-l);h--){const u=l+a[h+1]-a[t],d=a[h+1]-a[h],o=a[t]-a[h]<l?1:u/d;if(Math.abs(o)<r)break;const _=o*o,g=o*u-.5*_*d,x=o*d/i,f=e[h+1],y=e[h][0]-f[0],k=e[h][1]-f[1];n+=x/g*(f[0]*o*u+.5*_*(u*y-d*f[0])-_*o*d*y/3),s+=x/g*(f[1]*o*u+.5*_*(u*k-d*f[1])-_*o*d*k/3),c+=x}for(let u=t+1;u<h&&!(a[u-1]>a[t]+l);u++){const h=l-a[u-1]+a[t],d=a[u]-a[u-1],o=a[u]-a[t]<l?1:h/d;if(Math.abs(o)<r)break;const _=o*o,g=o*h-.5*_*d,x=o*d/i,f=e[u-1],y=e[u][0]-f[0],k=e[u][1]-f[1];n+=x/g*(f[0]*o*h+.5*_*(h*y-d*f[0])-_*o*d*y/3),s+=x/g*(f[1]*o*h+.5*_*(h*k-d*f[1])-_*o*d*k/3),c+=x}u.push(n/c),u.push(s/c)}u.push(d),u.push(o);for(let t=0,n=0;t<h;t++)e[t][0]=u[n++],e[t][1]=u[n++]}export{c as SegmentCursor,u as pathDivide,h as pathLength,d as pathSubdivide,i as segmentAt,r as segmentCount,a as segmentLength,_ as smoothPaths};
5
+ import{maxTileCoordValue as t}from"../../../../../../symbols/cim/constants.js";function e(t,e,s){return t[0]=e[0]-s[0],t[1]=e[1]-s[1],t}function s(t,e){return Math.sqrt(t*t+e*e)}function n(t){const e=s(t[0],t[1]);t[0]/=e,t[1]/=e}function i(t,e){return s(t[0]-e[0],t[1]-e[1])}function r(t,e){return t[e+1]}function h(t){return t.length-1}function a(t){let e=0;for(let s=0;s<h(t);s++)e+=c(t,s);return e}function c(t,e,s=1){const[n,i]=r(t,e);return Math.sqrt(n*n+i*i)*s}class u{constructor(t,e,s,n,i){this._segments=t,this._index=e,this._distance=s,this._xStart=n,this._yStart=i,this._done=!1}static create(t){return new u(t,0,0,t[0][0],t[0][1])}clone(){return new u(this._segments,this._index,this._distance,this.xStart,this.yStart)}equals(t){return this._index===t._index||t._index===this._index-1&&(0===this._distance||1===t._distance)||t._index===this._index+1&&(1===this._distance||0===t._distance)}leq(t){return this._index<t._index||this._index===t._index&&this._distance<=t._distance}geq(t){return this._index>t._index||this._index===t._index&&this._distance>=t._distance}get _segment(){return this._segments[this._index+1]}get angle(){const t=this.dy,e=(0*t+-1*-this.dx)/(1*this.length);let s=Math.acos(e);return t>0&&(s=2*Math.PI-s),s}get xStart(){return this._xStart}get yStart(){return this._yStart}get x(){return this.xStart+this.distance*this.dx}get y(){return this.yStart+this.distance*this.dy}get dx(){return this._segment[0]}get dy(){return this._segment[1]}get xMidpoint(){return this.xStart+.5*this.dx}get yMidpoint(){return this.yStart+.5*this.dy}get xEnd(){return this.xStart+this.dx}get yEnd(){return this.yStart+this.dy}get length(){const{dx:t,dy:e}=this;return Math.sqrt(t*t+e*e)}get remainingLength(){return this.length*(1-this._distance)}get backwardLength(){return this.length*this._distance}get distance(){return this._distance}get done(){return this._done}hasPrev(){return this._index-1>=0}hasNext(){return this._index+1<h(this._segments)}next(){return this.hasNext()?(this._xStart+=this.dx,this._yStart+=this.dy,this._distance=0,this._index+=1,this):null}prev(){return this.hasPrev()?(this._index-=1,this._xStart-=this.dx,this._yStart-=this.dy,this._distance=1,this):(this._done=!0,null)}_seekBackwards(t,e){const s=this.backwardLength;if(t<=s)return this._distance=(s-t)/this.length,this;let n=this.backwardLength;for(;this.prev();){if(n+this.length>t)return this._seekBackwards(t-n);n+=this.length}return this._distance=0,e?this:null}seek(t,e=!1){if(t<0)return this._seekBackwards(Math.abs(t),e);if(t<=this.remainingLength)return this._distance=(this.backwardLength+t)/this.length,this;let s=this.remainingLength;for(;this.next();){if(s+this.length>t)return this.seek(t-s,e);s+=this.length}return this._distance=1,e?this:null}}function d(e,s,n,i=!0){const r=a(e),h=u.create(e),c=r/2;if(!i)return h.seek(c),void(Math.abs(h.x)<t&&Math.abs(h.y)<t&&n(h.clone(),0,c+0*s,r));const d=Math.max((r-s)/2,0),o=Math.floor(d/s),_=c-o*s;h.seek(_);for(let a=-o;a<=o;a++)Math.abs(h.x)<t&&Math.abs(h.y)<t&&n(h.clone(),a,c+a*s,r),h.seek(s)}function o(t,e,s){_(s,e,a(t),u.create(t),0)}function _(t,e,s,n,i){if(s<e)return;const r=n.clone().seek(s/2);if(null==r)return;t(r.clone(),s,i),s=(s-e)/2;const h=r.seek(e/2);_(t,e,s,n,i+1),_(t,e,s,h,i+1)}function l(t,e){const s=e;for(let n=0;n<t.length;n++){let e=t[n];g(e,s);const i=[];i.push(e[0]);for(let t=1;t<e.length;t++){const[s,n]=e[t-1],[r,h]=e[t],a=r-s,c=h-n;i.push([a,c])}t[n]=i,e=i}return t}function g(t,s){const r=1e-6;if(s<=0)return;const h=t.length;if(h<3)return;const a=[];let c=0;a.push(0);for(let e=1;e<h;e++)c+=i(t[e],t[e-1]),a.push(c);s=Math.min(s,.2*c);const u=[];u.push(t[0][0]),u.push(t[0][1]);const d=t[h-1][0],o=t[h-1][1],_=e([0,0],t[0],t[1]);n(_),t[0][0]+=s*_[0],t[0][1]+=s*_[1],e(_,t[h-1],t[h-2]),n(_),t[h-1][0]+=s*_[0],t[h-1][1]+=s*_[1];for(let e=1;e<h;e++)a[e]+=s;a[h-1]+=s;const l=.5*s;for(let e=1;e<h-1;e++){let n=0,i=0,c=0;for(let h=e-1;h>=0&&!(a[h+1]<a[e]-l);h--){const u=l+a[h+1]-a[e],d=a[h+1]-a[h],o=a[e]-a[h]<l?1:u/d;if(Math.abs(o)<r)break;const _=o*o,g=o*u-.5*_*d,x=o*d/s,f=t[h+1],y=t[h][0]-f[0],k=t[h][1]-f[1];n+=x/g*(f[0]*o*u+.5*_*(u*y-d*f[0])-_*o*d*y/3),i+=x/g*(f[1]*o*u+.5*_*(u*k-d*f[1])-_*o*d*k/3),c+=x}for(let u=e+1;u<h&&!(a[u-1]>a[e]+l);u++){const h=l-a[u-1]+a[e],d=a[u]-a[u-1],o=a[u]-a[e]<l?1:h/d;if(Math.abs(o)<r)break;const _=o*o,g=o*h-.5*_*d,x=o*d/s,f=t[u-1],y=t[u][0]-f[0],k=t[u][1]-f[1];n+=x/g*(f[0]*o*h+.5*_*(h*y-d*f[0])-_*o*d*y/3),i+=x/g*(f[1]*o*h+.5*_*(h*k-d*f[1])-_*o*d*k/3),c+=x}u.push(n/c),u.push(i/c)}u.push(d),u.push(o);for(let e=0,n=0;e<h;e++)t[e][0]=u[n++],t[e][1]=u[n++]}export{u as SegmentCursor,d as pathDivide,a as pathLength,o as pathSubdivide,r as segmentAt,h as segmentCount,c as segmentLength,l as smoothPaths};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{numericHash as t}from"../../../../../core/string.js";import{TypedShaderProgram as o}from"./typed/TypedShaderProgram.js";class e{constructor(){this.computeAttributes={}}get locationsMap(){const t=new Map;for(const o in this.locations)t.set(o,this.locations[o].index);return t}get optionPropertyKeys(){if(!this._optionPropertyKeys){const t=new Set(Object.keys(this.options));this._optionPropertyKeys=t}return this._optionPropertyKeys}get _transformFeedbackBindings(){return[]}get locationInfo(){if(!this._locationInfo){const o=this.locationsMap,e=Array.from(o.entries()).map((([t,o])=>`${t}.${o}`)).join("."),n=t(e);this._locationInfo={hash:n,locations:o}}return this._locationInfo}getShaderKey(t,o,e){const n=Object.keys(e).filter((t=>e[t])).map((t=>`${t}_${e[t].toString()}`)).join("."),r=Object.keys(o).filter((t=>this.optionPropertyKeys.has(t))).join(".");return`${t.hash}.${n}.${r}`}getProgram(t,e,n,r){let i="",s="";for(const o in n)if(n[o]){const t="boolean"==typeof n[o]?`#define ${o}\n`:`#define ${o} ${n[o]}\n`;i+=t,s+=t}return i+=this.vertexShader,s+=this.fragmentShader,new o(i,s,this.locationsMap,this.locationInfo,this._getUniformBindings(e),this._transformFeedbackBindings)}_getUniformBindings(t){const o=[];for(const e in this.required){const t=this.required[e];o.push({uniformHydrated:null,shaderModulePath:e,uniformName:e,uniformType:t.type,uniformArrayElementType:n(t),uniformArrayLength:r(t)})}for(const e in t){const i=this.options[e];if(t[e])for(const t in i){const s=i[t];o.push({uniformHydrated:null,shaderModulePath:`${e}.${t}`,uniformName:t,uniformType:s.type,uniformArrayElementType:n(s),uniformArrayLength:r(s)})}}return o}}const n=t=>"array"===t.type?t.elementType?.type:void 0,r=t=>"array"===t.type?t.size:void 0;export{e as GLSLShaderModule};
5
+ import{numericHash as t}from"../../../../../core/string.js";import{TypedShaderProgram as o}from"./typed/TypedShaderProgram.js";class e{constructor(){this.computeAttributes={}}get locationsMap(){const t=new Map;for(const o in this.locations)t.set(o,this.locations[o].index);return t}get optionPropertyKeys(){if(!this._optionPropertyKeys){const t=new Set(Object.keys(this.options));this._optionPropertyKeys=t}return this._optionPropertyKeys}get _transformFeedbackBindings(){return[]}get locationInfo(){if(!this._locationInfo){const o=this.locationsMap,e=Array.from(o.entries()).map((([t,o])=>`${t}.${o}`)).join("."),n=t(e);this._locationInfo={hash:n,locations:o}}return this._locationInfo}get renamedLocationsMap(){const t=new Map;for(const[o,e]of this.locationsMap.entries())t.set("a_"+o,e);return t}getShaderKey(t,o,e){const n=Object.keys(e).filter((t=>e[t])).map((t=>`${t}_${e[t].toString()}`)).join("."),r=Object.keys(o).filter((t=>this.optionPropertyKeys.has(t))).join(".");return`${t.hash}.${n}.${r}`}getProgram(t,e,n,r){let i="",s="";for(const o in n)if(n[o]){const t="boolean"==typeof n[o]?`#define ${o}\n`:`#define ${o} ${n[o]}\n`;i+=t,s+=t}return i+=this.vertexShader,s+=this.fragmentShader,new o(i,s,this.renamedLocationsMap,this.locationInfo,this._getUniformBindings(e),this._transformFeedbackBindings)}_getUniformBindings(t){const o=[];for(const e in this.required){const t=this.required[e];o.push({uniformHydrated:null,shaderModulePath:e,uniformName:e,uniformType:t.type,uniformArrayElementType:n(t),uniformArrayLength:r(t)})}for(const e in t){const i=this.options[e];if(t[e])for(const t in i){const s=i[t];o.push({uniformHydrated:null,shaderModulePath:`${e}.${t}`,uniformName:t,uniformType:s.type,uniformArrayElementType:n(s),uniformArrayLength:r(s)})}}return o}}const n=t=>"array"===t.type?t.elementType?.type:void 0,r=t=>"array"===t.type?t.size:void 0;export{e as GLSLShaderModule};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{memoize as e}from"../../../../../../../core/MapUtils.js";import{fromRotation as t}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as i}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{getXAnchorDirection as s,getYAnchorDirection as o}from"../../../alignmentUtils.js";import{getDisplayIdTexel as n}from"../../../DisplayId.js";import{LabelMetric as r}from"../../../collisions/LabelMetric.js";import{smoothPaths as a,pathDivide as h}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as l,processColorInput as c}from"../fill/meshWriterUtils.js";import{TextMeshWriter as m}from"../text/TextMeshWriter.js";const d=1,g=0,u=25,p=128,f=e((e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t}));class x extends m{constructor(){super(...arguments),this._zoomLevel=0}_write(e,t,i,s){if(this._zoomLevel=s||0,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),s=t.readYForDisplay();return this._writePoint(e,i,s,t)}case"esriGeometryEnvelope":case"esriGeometryPolygon":case"esriGeometryMultipoint":{const i=t.readCentroidForDisplay();if(!i)return;const[s,o]=i.coords;return this._writePoint(e,s,o,t)}case"esriGeometryPolyline":{const i=t.readLegacyGeometryForDisplay();this._writeLines(e,t,i)}}}_writePoint(e,t,i,a){const h=this._getShaping();if(!h)return;let l=this._getPointReferenceBounds();l||(l={offsetX:0,offsetY:0,size:0});const c=h.boundsT,m=s(this.evaluatedMeshParams.horizontalAlignment),d=o(this.evaluatedMeshParams.verticalAlignment),g=this.evaluatedMeshParams.scaleInfo?.maxScale??0,u=this.evaluatedMeshParams.scaleInfo?.minScale??0,p=n(a.getDisplayId());e.metricStart(new r(p,t,i,m,d,g,u,l)),e.metricBoxWrite(c),this._writeGlyphs(e,a.getDisplayId(),t,i,h,0,l),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t,i){const{repeatLabel:s,scaleInfo:o}=this.evaluatedMeshParams,n=this.evaluatedMeshParams.repeatLabelDistance||128,r=this._getShaping();if(!r)return;this._current={out:e,id:t.getDisplayId(),shaping:r,zoomRange:l(o,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0}};const c=a(i.paths,r.bounds.width),m=this._placeSubdivGlyphs.bind(this),g=(r.bounds.width+n)/(1<<d);for(const a of c)h(a,g,m,!!s)}_placeSubdivGlyphs(e,t,i,s){const{allowOverrun:o,labelPosition:n,repeatLabelDistance:r}=this.evaluatedMeshParams,a=this._current.zoomRange[0],h=f(t),l=this._current.shaping.bounds.width/(1<<d),c=Math.sqrt(r||p)/(1<<d),m=Math.min(i,s-i),g=this._current.shaping.isMultiline?u:Math.log2(m/(c+l/2)),x=0===t?g:Math.min(h,g),_=Math.max(a,this._zoomLevel+d-x),y=this._zoomLevel-_,M=this._current.shaping.bounds.width/2*2**y;this._current.shaping.isMultiline?0===t&&this._placeStraight(e,_):o&&y<0?this._placeStraightAlong(e,a):"parallel"===n?this._placeStraightAlong(e,_):"curved"===n&&this._placeCurved(e,_,M)}_placeStraight(e,s){const{out:o,id:n,shaping:r,zoomRange:a,referenceBounds:h}=this._current,{x:l,y:c}=e,m=e.angle*(180/Math.PI)%360,d=(e.angle*(180/Math.PI)+180)%360;if(r.textBox){const l=Math.max(s,a[0],0),c=Math.min(u,a[1]),g=t(i(),-e.angle),[p,f]=r.shapeBackground(g),x={minZoom:l,maxZoom:c,clipAngle:m,mapAligned:!0,isLineLabel:!0};o.recordStart(this.instanceId,this.attributeLayout,r.glyphs[0].textureBinding),this._writeTextBox(o,n,e.x,e.y,f,h,x),o.recordEnd(),x.clipAngle=d,o.recordStart(this.instanceId,this.attributeLayout,r.glyphs[0].textureBinding),this._writeTextBox(o,n,e.x,e.y,f,h,x),o.recordEnd()}for(const t of r.glyphs)t.minZoom=s,t.maxZoom=a[1],t.angle=e.angle,this._writeLineGlyph(o,n,l,c,r.bounds,t,m,h,!0),t.angle=e.angle+Math.PI,this._writeLineGlyph(o,n,l,c,r.bounds,t,d,h,!0)}_placeCurved(e,t,i){const s=e.clone(),o=e.angle*(180/Math.PI)%360,n=(e.angle*(180/Math.PI)+180)%360;this._placeFirst(s,t,1,o),this._placeBack(e,s,t,i,1,o),this._placeForward(e,s,t,i,1,o),this._placeFirst(s,t,0,n),this._placeBack(e,s,t,i,0,n),this._placeForward(e,s,t,i,0,n)}_placeStraightAlong(e,s){const{out:o,id:n,shaping:r,zoomRange:a,referenceBounds:h}=this._current,{boxBorderLineColor:l,boxBackgroundColor:c}=this.evaluatedMeshParams,m=e.clone(),d=e.angle*(180/Math.PI)%360,g=(e.angle*(180/Math.PI)+180)%360;if(r.glyphs.length>0&&(l||c)){const l=Math.max(s,a[0],0),c=Math.min(u,a[1]),m=t(i(),-e.angle),[p,f]=r.shapeBackground(m),x={minZoom:l,maxZoom:c,clipAngle:d,mapAligned:!0,isLineLabel:!0};o.recordStart(this.instanceId,this.attributeLayout,r.glyphs[0].textureBinding),this._writeTextBox(o,n,e.x,e.y,f,h,x),o.recordEnd(),x.clipAngle=g,o.recordStart(this.instanceId,this.attributeLayout,r.glyphs[0].textureBinding),this._writeTextBox(o,n,e.x,e.y,f,h,x),o.recordEnd()}this._placeFirst(m,s,1,d,!0),this._placeFirst(m,s,0,g,!0)}_placeBack(e,t,i,s,o,n){const r=e.clone();let a=e.backwardLength+g;for(;r.prev()&&!(a>=s);)this._placeOnSegment(r,t,a,i,-1,o,n),a+=r.length+g}_placeForward(e,t,i,s,o,n){const r=e.clone();let a=e.remainingLength+g;for(;r.next()&&!(a>=s);)this._placeOnSegment(r,t,a,i,1,o,n),a+=r.length+g}_placeFirst(e,t,i,s,o=!1){const n=e,{out:r,id:a,shaping:h,zoomRange:l,referenceBounds:c}=this._current,m=h.glyphs;for(const d of m){const m=d.x>h.bounds.x?i:1-i,p=m*e.remainingLength+(1-m)*e.backwardLength,f=Math.abs(d.x+d.width/2-h.bounds.x),x=Math.max(0,this._zoomLevel+Math.log2(f/(p+g))),_=Math.max(t,o?0:x);d.maxZoom=Math.min(l[1],u),d.angle=e.angle+(1-i)*Math.PI,d.minZoom=Math.max(l[0],_),this._writeLineGlyph(r,a,n.x,n.y,h.bounds,d,s,c,!0)}}_placeOnSegment(e,t,i,s,o,n,r){const{out:a,id:h,shaping:l,referenceBounds:c}=this._current,m=l.glyphs,d=e.dx/e.length,u=e.dy/e.length,p={x:e.x+i*-o*d,y:e.y+i*-o*u};for(const f of m){const t=f.x>l.bounds.x?n:1-n;if(!(t&&1===o||!t&&-1===o))continue;const m=Math.abs(f.x+f.width/2-l.bounds.x),d=Math.max(0,this._zoomLevel+Math.log2(m/i)-.1),u=Math.max(s,this._zoomLevel+Math.log2(m/(i+e.length+g)));0!==d&&(f.angle=e.angle+(1-n)*Math.PI,f.minZoom=u,f.maxZoom=d,this._writeLineGlyph(a,h,p.x,p.y,l.bounds,f,r,c,!0))}}_writeLineGlyph(e,t,i,s,o,n,r,a,h){const l=i+o.x,m=s+o.y,d=2*(this.evaluatedMeshParams.minPixelBuffer?this.evaluatedMeshParams.minPixelBuffer/this._textMeshTransformProps.fontSize:1),g=Math.max(o.width,o.height)*d;e.recordStart(this.instanceId,this.attributeLayout,n.textureBinding),e.recordBounds(l,m,g,g);const{texcoords:u,offsets:p}=n,f=this._textMeshTransformProps.fontSize;this._writeQuad(e,t,i,s,{texcoords:u,offsets:p,fontSize:f,color:c(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:a,minZoom:Math.max(this._current.zoomRange[0],n.minZoom),maxZoom:Math.min(this._current.zoomRange[1],n.maxZoom),clipAngle:r,mapAligned:h,isLineLabel:!0}),e.recordEnd()}}export{x as LabelMeshWriter};
5
+ import{memoize as e}from"../../../../../../../core/MapUtils.js";import{fromRotation as t}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as i}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{getXAnchorDirection as s,getYAnchorDirection as a}from"../../../alignmentUtils.js";import{getDisplayIdTexel as n}from"../../../DisplayId.js";import{LabelMetric as r}from"../../../collisions/LabelMetric.js";import{smoothPaths as o,pathDivide as h}from"../../../mesh/templates/segmentUtils.js";import{getMinMaxZoom as l,processColorInput as c}from"../fill/meshWriterUtils.js";import{TextMeshWriter as m}from"../text/TextMeshWriter.js";const d=1,u=0,g=25,p=128,f=e((e=>{let t=0;if(0===e)return 1/0;for(;!(e%2);)t++,e/=2;return t}));class x extends m{constructor(){super(...arguments),this._zoomLevel=0}_write(e,t,i,s){if(this._zoomLevel=s||0,null!=i)throw new Error("InternalError: EffectGeometry not support for LabelMeshWriter");switch(t.geometryType){case"esriGeometryPoint":{const i=t.readXForDisplay(),s=t.readYForDisplay();return this._writePoint(e,i,s,t)}case"esriGeometryEnvelope":case"esriGeometryPolygon":case"esriGeometryMultipoint":{const i=t.readCentroidForDisplay();if(!i)return;const[s,a]=i.coords;return this._writePoint(e,s,a,t)}case"esriGeometryPolyline":{const i=t.readLegacyGeometryForDisplay();this._writeLines(e,t,i)}}}_writePoint(e,t,i,o){const h=this._getShaping();if(!h)return;let l=this._getPointReferenceBounds();l||(l={offsetX:0,offsetY:0,size:0});const c=h.boundsT,m=s(this.evaluatedMeshParams.horizontalAlignment),d=a(this.evaluatedMeshParams.verticalAlignment),u=this.evaluatedMeshParams.scaleInfo?.maxScale??0,g=this.evaluatedMeshParams.scaleInfo?.minScale??0,p=n(o.getDisplayId());e.metricStart(new r(p,t,i,m,d,u,g,l)),e.metricBoxWrite(c),this._writeGlyphs(e,o.getDisplayId(),t,i,h,0,l),e.metricEnd()}_getPointReferenceBounds(){if(!this._references)return null;for(const e of this._references){const t=e.getBoundsInfo();if(t)return t}return null}_writeLines(e,t,i){const{repeatLabel:s,scaleInfo:a}=this.evaluatedMeshParams,n=this.evaluatedMeshParams.repeatLabelDistance||128,r=this._getShaping();if(!r)return;this._current={out:e,id:t.getDisplayId(),shaping:r,zoomRange:l(a,this.getTileInfo()),referenceBounds:this._getPointReferenceBounds()||{offsetX:0,offsetY:0,size:0}};const c=o(i.paths,r.bounds.width),m=this._placeSubdivGlyphs.bind(this),u=(r.bounds.width+n)/(1<<d);for(const o of c)h(o,u,m,!!s)}_placeSubdivGlyphs(e,t,i,s){const{allowOverrun:a,labelPosition:n,repeatLabelDistance:r}=this.evaluatedMeshParams,o=this._current.zoomRange[0],h=f(t),l=this._current.shaping.bounds.width/(1<<d),c=Math.sqrt(r||p)/(1<<d),m=Math.min(i,s-i),u=this._current.shaping.isMultiline?g:Math.log2(m/(c+l/2)),x=0===t?u:Math.min(h,u),_=Math.max(o,this._zoomLevel+d-x),M=this._zoomLevel-_,y=this._current.shaping.bounds.width/2*2**M;this._current.shaping.isMultiline?0===t&&this._placeStraight(e,_):a&&M<0?this._placeStraightAlong(e,o):"parallel"===n?this._placeStraightAlong(e,_):"curved"===n&&this._placeCurved(e,_,y)}_placeStraight(e,s){const{out:a,id:n,shaping:r,zoomRange:o,referenceBounds:h}=this._current,{x:l,y:c}=e,m=e.angle*(180/Math.PI)%360,d=(e.angle*(180/Math.PI)+180)%360;if(r.textBox){const l=Math.max(s,o[0],0),c=Math.min(g,o[1]),u=t(i(),-e.angle),[p,f]=r.shapeBackground(u),x={minZoom:l,maxZoom:c,clipAngle:m,mapAligned:!0,isLineLabel:!0};a.recordStart(this.instanceId,this.attributeLayout,r.glyphs[0].textureBinding),this._writeTextBox(a,n,e.x,e.y,f,h,x),a.recordEnd(),x.clipAngle=d,a.recordStart(this.instanceId,this.attributeLayout,r.glyphs[0].textureBinding),this._writeTextBox(a,n,e.x,e.y,f,h,x),a.recordEnd()}for(const t of r.glyphs)t.minZoom=s,t.maxZoom=o[1],t.angle=e.angle,this._writeLineGlyph(a,n,l,c,r.bounds,t,m,h,!0),t.angle=e.angle+Math.PI,this._writeLineGlyph(a,n,l,c,r.bounds,t,d,h,!0)}_placeCurved(e,t,i){const{out:s,id:a}=this._current,o=e.clone(),h=e.angle*(180/Math.PI)%360,l=(e.angle*(180/Math.PI)+180)%360,c=n(a),m=this.evaluatedMeshParams.scaleInfo?.maxScale??0,d=this.evaluatedMeshParams.scaleInfo?.minScale??0;s.metricStart(new r(c,e.x,e.y,0,0,m,d,null)),this._placeFirst(o,t,1,h),this._placeBack(e,o,t,i,1,h),this._placeForward(e,o,t,i,1,h),this._placeFirst(o,t,0,l),this._placeBack(e,o,t,i,0,l),this._placeForward(e,o,t,i,0,l),s.metricEnd()}_placeStraightAlong(e,s){const{out:a,id:o,shaping:h,zoomRange:l,referenceBounds:c}=this._current,{boxBorderLineColor:m,boxBackgroundColor:d}=this.evaluatedMeshParams,u=e.clone(),p=e.angle*(180/Math.PI)%360,f=(e.angle*(180/Math.PI)+180)%360;if(h.glyphs.length>0&&(m||d)){const n=Math.max(s,l[0],0),r=Math.min(g,l[1]),m=t(i(),-e.angle),[d,u]=h.shapeBackground(m),x={minZoom:n,maxZoom:r,clipAngle:p,mapAligned:!0,isLineLabel:!0};a.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(a,o,e.x,e.y,u,c,x),a.recordEnd(),x.clipAngle=f,a.recordStart(this.instanceId,this.attributeLayout,h.glyphs[0].textureBinding),this._writeTextBox(a,o,e.x,e.y,u,c,x),a.recordEnd()}const x=n(o),_=this.evaluatedMeshParams.scaleInfo?.maxScale??0,M=this.evaluatedMeshParams.scaleInfo?.minScale??0;a.metricStart(new r(x,e.x,e.y,0,0,_,M,null)),this._placeFirst(u,s,1,p,!0),this._placeFirst(u,s,0,f,!0),a.metricEnd()}_placeBack(e,t,i,s,a,n){const r=e.clone();let o=e.backwardLength+u;for(;r.prev()&&!(o>=s);)this._placeOnSegment(r,t,o,i,-1,a,n),o+=r.length+u}_placeForward(e,t,i,s,a,n){const r=e.clone();let o=e.remainingLength+u;for(;r.next()&&!(o>=s);)this._placeOnSegment(r,t,o,i,1,a,n),o+=r.length+u}_placeFirst(e,t,i,s,a=!1){const n=e,{out:r,id:o,shaping:h,zoomRange:l,referenceBounds:c}=this._current,m=h.glyphs;for(const d of m){const m=d.x>h.bounds.x?i:1-i,p=m*e.remainingLength+(1-m)*e.backwardLength,f=Math.abs(d.x+d.width/2-h.bounds.x),x=Math.max(0,this._zoomLevel+Math.log2(f/(p+u))),_=Math.max(t,a?0:x);d.maxZoom=Math.min(l[1],g),d.angle=e.angle+(1-i)*Math.PI,d.minZoom=Math.max(l[0],_),r.metricBoxWrite(d.bounds),this._writeLineGlyph(r,o,n.x,n.y,h.bounds,d,s,c,!0)}}_placeOnSegment(e,t,i,s,a,n,r){const{out:o,id:h,shaping:l,referenceBounds:c}=this._current,m=l.glyphs,d=e.dx/e.length,g=e.dy/e.length,p={x:e.x+i*-a*d,y:e.y+i*-a*g};for(const f of m){const t=f.x>l.bounds.x?n:1-n;if(!(t&&1===a||!t&&-1===a))continue;const m=Math.abs(f.x+f.width/2-l.bounds.x),d=Math.max(0,this._zoomLevel+Math.log2(m/i)-.1),g=Math.max(s,this._zoomLevel+Math.log2(m/(i+e.length+u)));0!==d&&(f.angle=e.angle+(1-n)*Math.PI,f.minZoom=g,f.maxZoom=d,this._writeLineGlyph(o,h,p.x,p.y,l.bounds,f,r,c,!0))}}_writeLineGlyph(e,t,i,s,a,n,r,o,h){const l=i+a.x,m=s+a.y,d=2*(this.evaluatedMeshParams.minPixelBuffer?this.evaluatedMeshParams.minPixelBuffer/this._textMeshTransformProps.fontSize:1),u=Math.max(a.width,a.height)*d;e.recordStart(this.instanceId,this.attributeLayout,n.textureBinding),e.recordBounds(l,m,u,u);const{texcoords:g,offsets:p}=n,f=this._textMeshTransformProps.fontSize;this._writeQuad(e,t,i,s,{texcoords:g,offsets:p,fontSize:f,color:c(this.evaluatedMeshParams.color),isBackground:!1,referenceBounds:o,minZoom:Math.max(this._current.zoomRange[0],n.minZoom),maxZoom:Math.min(this._current.zoomRange[1],n.maxZoom),clipAngle:r,mapAligned:h,isLineLabel:!0}),e.recordEnd()}}export{x as LabelMeshWriter};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{fromRotation as t,identity as r,translate as o,rotate as i}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as s}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as a}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as n}from"../../../../../../../geometry/GeometryCursor.js";import{Alignment as c}from"../../../../../../../symbols/cim/enums.js";import{CIMMarkerPlacementHelper as l}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{minMaxZoomPrecisionFactor as m}from"../../../definitions.js";import{getMinMaxZoom as p,processColorInput as u,packByteSqrt as d,getBitMask as f}from"../fill/meshWriterUtils.js";import{ComputedMarkerParams as h}from"./ComputedMarkerParams.js";import{MarkerConstants as y}from"./markerConstants.js";import{getGeometryEngine as x}from"../mesh/loadGeometryEngine.js";import{MeshWriter as g}from"../mesh/MeshWriter.js";import{DataType as P}from"../../../../../../webgl/enums.js";const k=3.14159265359/180,M=128/Math.PI;function S(e,t){return e%=t,Math.abs(e>=0?e:e+t)}function b(e){return S(e*M,256)}function I(e,a,n,c,l=!1){const m=s(),p=l?1:-1;return e?t(m,p*k*e):r(m),(a||n)&&o(m,m,[a,-n]),c&&i(m,m,p*k*-c),m}const _={createComputedParams:e=>h.from(e),attributes:{pos:{type:P.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:P.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:P.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:r,overrideOutlineColor:o,colorLocked:i})=>{let s=0;return e.sdf&&(s|=f(y.bitset.isSDF)),t===c.MAP&&(s|=f(y.bitset.isMapAligned)),r&&(s|=f(y.bitset.scaleSymbolsProportionally)),o&&(s|=f(y.bitset.overrideOutlineColor)),i&&(s|=f(y.bitset.colorLocked)),s}},zoomRange:{type:P.SHORT,count:2,packPrecisionFactor:m,pack:({scaleInfo:e},{tileInfo:t})=>p(e,t)},offset:{type:P.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:r,anchorX:o,anchorY:i,offsetX:s,offsetY:n,rotateClockwise:c})=>{const l=I(0,s,n,-e,c),m=-(.5+o)*t,p=-(.5-i)*r,u=[m,p],d=[m+t,p],f=[m,p+r],h=[m+t,p+r];return a(u,u,l),a(d,d,l),a(f,f,l),a(h,h,l),[u,d,f,h]}}},textureUV:{type:P.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:r,texYmin:o})=>[[t,o],[e,o],[t,r],[e,r]]}},color:{type:P.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>u(e)},outlineColor:{type:P.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>u(e)},sizing:{type:P.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:r,referenceSize:o})=>{const i=Math.max(e,t);return[d(i,128),d(r,128),d(o,128),0]}},placementAngle:{type:P.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>b(e)},sizeRatio:{type:P.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sizeRatio:e})=>e}}};class E extends g{constructor(){super(...arguments),this.vertexSpec=_}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}_write(e,t,r){const o=this.evaluatedMeshParams.sprite?.textureBinding,i=t.getDisplayId();e.recordStart(this.instanceId,this.attributeLayout,o);const s=this.evaluatedMeshParams.minPixelBuffer,a=Math.max(this.evaluatedMeshParams.computedWidth,s),n=Math.max(this.evaluatedMeshParams.computedHeight,s);if(null!=this.evaluatedMeshParams.placement)this._writePlacedMarkers(e,t,r,a,n);else if(r&&r.nextPath()){r.nextPoint();const t=r.x,o=r.y;e.recordBounds(t,o,a,n),this._writeQuad(e,i,t,o)}else if("esriGeometryPolygon"===t.geometryType){const r=t.readCentroidForDisplay();if(!r)return;const[o,s]=r.coords;e.recordBounds(o,s,a,n),this._writeQuad(e,i,o,s)}else if("esriGeometryPoint"===t.geometryType){const r=t.readXForDisplay(),o=t.readYForDisplay();e.recordBounds(r,o,a,n),this._writeQuad(e,i,r,o)}else{const r=t.readGeometryForDisplay();r?.forEachVertex(((t,r)=>{e.recordBounds(t,r,a,n),this._writeQuad(e,i,t,r)}))}e.recordEnd()}_writePlacedMarkers(t,r,o,i,s){const a=o??n.fromFeatureSetReaderCIM(r)?.clone();if(!a)return;const c=-1,m=l.getPlacement(a,c,this.evaluatedMeshParams.placement,e(1),t.id,x());if(!m)return;const p=r.getDisplayId();let u=m.next();for(;null!=u;){const e=u.tx,r=-u.ty,o=-u.getAngle();t.recordBounds(e,r,i,s),this._writeQuad(t,p,e,r,o),u=m.next()}}_writeQuad(e,t,r,o,i){const s=e.vertexCount(),a=null==i?null:{placementAngle:i};this._writeVertex(e,t,r,o,a),e.indexWrite(s+0),e.indexWrite(s+1),e.indexWrite(s+2),e.indexWrite(s+1),e.indexWrite(s+3),e.indexWrite(s+2)}}export{E as MarkerMeshWriter,_ as MarkerVertexSpec};
5
+ import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{fromRotation as t,identity as r,translate as o,rotate as s}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as i}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as a}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as n}from"../../../../../../../geometry/GeometryCursor.js";import{maxTileCoordValue as c}from"../../../../../../../symbols/cim/constants.js";import{Alignment as m}from"../../../../../../../symbols/cim/enums.js";import{CIMMarkerPlacementHelper as l}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{minMaxZoomPrecisionFactor as u}from"../../../definitions.js";import{getMinMaxZoom as d,processColorInput as p,packByteSqrt as f,getBitMask as h}from"../fill/meshWriterUtils.js";import{ComputedMarkerParams as y}from"./ComputedMarkerParams.js";import{MarkerConstants as x}from"./markerConstants.js";import{getGeometryEngine as P}from"../mesh/loadGeometryEngine.js";import{MeshWriter as g}from"../mesh/MeshWriter.js";import{DataType as M}from"../../../../../../webgl/enums.js";const k=3.14159265359/180,b=128/Math.PI;function S(e,t){return e%=t,Math.abs(e>=0?e:e+t)}function I(e){return S(e*b,256)}function _(e,a,n,c,m=!1){const l=i(),u=m?1:-1;return e?t(l,u*k*e):r(l),(a||n)&&o(l,l,[a,-n]),c&&s(l,l,u*k*-c),l}const v={createComputedParams:e=>y.from(e),attributes:{pos:{type:M.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:M.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:M.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:r,overrideOutlineColor:o,colorLocked:s})=>{let i=0;return e.sdf&&(i|=h(x.bitset.isSDF)),t===m.MAP&&(i|=h(x.bitset.isMapAligned)),r&&(i|=h(x.bitset.scaleSymbolsProportionally)),o&&(i|=h(x.bitset.overrideOutlineColor)),s&&(i|=h(x.bitset.colorLocked)),i}},zoomRange:{type:M.SHORT,count:2,packPrecisionFactor:u,pack:({scaleInfo:e},{tileInfo:t})=>d(e,t)},offset:{type:M.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:r,anchorX:o,anchorY:s,offsetX:i,offsetY:n,rotateClockwise:c})=>{const m=_(0,i,n,-e,c),l=-(.5+o)*t,u=-(.5-s)*r,d=[l,u],p=[l+t,u],f=[l,u+r],h=[l+t,u+r];return a(d,d,m),a(p,p,m),a(f,f,m),a(h,h,m),[d,p,f,h]}}},textureUV:{type:M.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:r,texYmin:o})=>[[t,o],[e,o],[t,r],[e,r]]}},color:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>p(e)},outlineColor:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>p(e)},sizing:{type:M.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:r,referenceSize:o})=>{const s=Math.max(e,t);return[f(s,128),f(r,128),f(o,128),0]}},placementAngle:{type:M.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>I(e)},sizeRatio:{type:M.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sizeRatio:e})=>e}}};class E extends g{constructor(){super(...arguments),this.vertexSpec=v}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}_write(e,t,r){const o=this.evaluatedMeshParams.sprite?.textureBinding,s=t.getDisplayId();e.recordStart(this.instanceId,this.attributeLayout,o);const i=this.evaluatedMeshParams.minPixelBuffer,a=Math.max(this.evaluatedMeshParams.computedWidth,i),n=Math.max(this.evaluatedMeshParams.computedHeight,i),c=this.evaluatedMeshParams.offsetX,m=-this.evaluatedMeshParams.offsetY;if(null!=this.evaluatedMeshParams.placement)this._writePlacedMarkers(e,t,r,a,n);else if(r&&r.nextPath()){r.nextPoint();const t=r.x,o=r.y;e.recordBounds(t+c,o+m,a,n),this._writeQuad(e,s,t,o)}else if("esriGeometryPolygon"===t.geometryType){const r=t.readCentroidForDisplay();if(!r)return;const[o,i]=r.coords;e.recordBounds(o+c,i+m,a,n),this._writeQuad(e,s,o,i)}else if("esriGeometryPoint"===t.geometryType){const r=t.readXForDisplay(),o=t.readYForDisplay();e.recordBounds(r+c,o+m,a,n),this._writeQuad(e,s,r,o)}else{const r=t.readGeometryForDisplay();r?.forEachVertex(((t,r)=>{e.recordBounds(t+c,r+m,a,n),this._writeQuad(e,s,t,r)}))}e.recordEnd()}_writePlacedMarkers(t,r,o,s,i){const a=o??n.fromFeatureSetReaderCIM(r)?.clone();if(!a)return;const m=-1,u=l.getPlacement(a,m,this.evaluatedMeshParams.placement,e(1),t.id,P());if(!u)return;const d=r.getDisplayId();let p=u.next();const f=this.evaluatedMeshParams.offsetX,h=-this.evaluatedMeshParams.offsetY;for(;null!=p;){const e=p.tx,r=-p.ty;if(Math.abs(e)>c||Math.abs(r)>c){p=u.next();continue}const o=-p.getAngle();t.recordBounds(e+f,r+h,s,i),this._writeQuad(t,d,e,r,o),p=u.next()}}_writeQuad(e,t,r,o,s){const i=e.vertexCount(),a=null==s?null:{placementAngle:s};this._writeVertex(e,t,r,o,a),e.indexWrite(i+0),e.indexWrite(i+1),e.indexWrite(i+2),e.indexWrite(i+1),e.indexWrite(i+3),e.indexWrite(i+2)}}export{E as MarkerMeshWriter,v as MarkerVertexSpec};