PageSourceSearch

https://carceral.netlify.app/assets/FeatureLayerSource-Dar751iU.js

js carceral.netlify.app collected 2026-10-03 10:33:55 UTC 16,698 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/uploadAssets-B10kipaD.js","assets/index-DANm8E-o.js","assets/index-DpaVdqOb.css","assets/External-B8C8sOIt.js","assets/meshSpatialReferenceScaleUtils-Dt286qvC.js","assets/MeshTransform-DBORMNVo.js","assets/quat-ZAb-duL1.js","assets/quatf64-aQ5IuZRd.js","assets/axisAngleDegrees-BGj2BI3q.js","assets/meshFeatureAttributes-DcixCy8W.js","assets/convertMeshVertexSpace-CvvNDvTe.js","assets/MeshVertexAttributes-DHBOHPND.js","assets/meshProperties-DWLWd_LJ.js","assets/vertexSpaceConversion-DydRjZ2w.js","assets/spatialReferenceEllipsoidUtils-DoBYFfZz.js","assets/computeTranslationToOriginAndRotation-DhuszKM8.js","assets/projectPointToVector-D-73wcIz.js","assets/meshVertexSpaceUtils-CKKOhGwb.js","assets/MeshLocalVertexSpace-9SugMLro.js","assets/vec3-hAPwVw8m.js","assets/BufferView-siziGgfX.js","assets/vec4-CCFZ5Cvb.js"])))=>i.map(i=>d[i]);
2import{bA as L,bB as k,z as Q,ay as x,bC as O,X as h,a2 as A,bD as P,F as U,C as j,bE as $,b as S,bF as J,D as V,bG as H,Q as G,bH as z,al as F,_ as T,bI as M,bJ as B,bK as K,bL as W,bM as X,bN as Y,az as N,bO as Z,l as ee,bP as te,bQ as se,H as E,J as R,K as ae}from"./index-DANm8E-o.js";import{i as re}from"./MeshLocalVertexSpace-9SugMLro.js";import{t as ie}from"./meshVertexSpaceUtils-CKKOhGwb.js";import{v as ne}from"./External-B8C8sOIt.js";import{R as v,m as D,b as oe,f as ue,j as le,y as ce,I as de}from"./applyEditsUtils-CGJM9HDJ.js";import{S as pe}from"./QueryTask-B2UFEpIT.js";import{s as he}from"./executeQueryJSON-CkSmzwcD.js";import"./MeshTransform-DBORMNVo.js";import"./quat-ZAb-duL1.js";import"./quatf64-aQ5IuZRd.js";import"./axisAngleDegrees-BGj2BI3q.js";import"./editingSupport-D-IRxakv.js";import"./executeForIds-Cxc6JJJZ.js";import"./query-CzFu_CWn.js";import"./pbfQueryUtils-DdskhGeh.js";import"./pbf-DVzexDR5.js";import"./OptimizedFeature-C4hsiMCL.js";import"./OptimizedFeatureSet-BR8EEvDc.js";import"./featureConversionUtils-D3BQxJWT.js";const ye=new J({originalAndCurrentFeatures:"original-and-current-features",none:"none"}),me=new J({Started:"published",Publishing:"publishing",Stopped:"unavailable"});let _=class extends L{constructor(t){super(t),this.type="feature-layer",this.supportedSourceTypes=new Set(["Feature Layer","Oriented Imagery Layer","Table","Catalog Layer"]),this.refresh=k(async()=>{await this.load();const e=this.sourceJSON.editingInfo?.lastEditDate;if(e==null)return{dataChanged:!0,updates:{}};try{await this._fetchService(null)}catch{return{dataChanged:!0,updates:{}}}const s=e!==this.sourceJSON.editingInfo?.lastEditDate;return{dataChanged:s,updates:s?{editingInfo:this.sourceJSON.editingInfo,extent:this.sourceJSON.extent}:null}}),this._ongoingAssetUploads=new Map}load(t){const e=this.layer.sourceJSON,s=this._fetchService(e,{...t}).then(()=>this.layer.setUserPrivileges(this.sourceJSON.serviceItemId,t)).then(()=>this._ensureLatestMetadata(t));return this.addResolvingPromise(s),Promise.resolve(this)}initialize(){this.addHandles([Q(()=>{const t=this.layer;return t&&"lastEditsEventDate"in t?t.lastEditsEventDate:null},t=>this._handleLastEditsEventChange(t))])}destroy(){this._removeEditInterceptor()}get queryTask(){const{capabilities:t,parsedUrl:e,gdbVersion:s,spatialReference:a,fieldsIndex:r,uniqueIdFields:n}=this.layer,i="infoFor3D"in this.layer?this.layer.infoFor3D:null,o="dynamicDataSource"in this.layer?this.layer.dynamicDataSource:null,u=x("featurelayer-pbf")&&t?.query.supportsFormatPBF&&i==null;return new pe({dynamicDataSource:o,fieldsIndex:r,gdbVersion:s,infoFor3D:i,pbfSupported:u,queryAttachmentsSupported:t?.operations?.supportsQueryAttachments??!1,sourceSpatialReference:a,uniqueIdFields:n,url:e.path})}async addAttachment(t,e){await this.load();const{layer:s}=this;await O(s,"editing");const a=t.attributes[s.objectIdField],r=s.parsedUrl.path+"/"+a+"/addAttachment",n=this._getLayerRequestOptions(),i=this._getFormDataForAttachment(e,n.query);try{const o=await h(r,{body:i});return v(o.data.addAttachmentResult)}catch(o){throw this._createAttachmentErrorResult(a,o)}}async updateAttachment(t,e,s){await this.load();const{layer:a}=this;await O(a,"editing");const r=t.attributes[a.objectIdField],n=a.parsedUrl.path+"/"+r+"/updateAttachment",i=this._getLayerRequestOptions({query:{attachmentId:e}}),o=this._getFormDataForAttachment(s,i.query);try{const u=await h(n,{body:o});return v(u.data.updateAttachmentResult)}catch(u){throw this._createAttachmentErrorResult(r,u)}}async applyEdits(t,e){await this.load();const{layer:s}=this;await O(s,"editing");const a="infoFor3D"in s?s.infoFor3D:null,r=a!=null,n=r||(e?.globalIdUsed??!1),i=r?await this._uploadMeshesAndGetAssetMapEditsJSON(t):null,o=t.addFeatures?.map(f=>D(this.layer,f,a))??[],u=(await Promise.all(o)).filter(A),d=t.updateFeatures?.map(f=>D(this.layer,f,a))??[],l=(await Promise.all(d)).filter(A),g=oe(this.layer,t.deleteFeatures,n);P(u,l,s.spatialReference);const b=await ue(this.layer,t),w=s.capabilities.editing.supportsAsyncApplyEdits&&r,c=e?.gdbVersion||s.gdbVersion,p={gdbVersion:c,rollbackOnFailure:e?.rollbackOnFailureEnabled,useGlobalIds:n,returnEditMoment:e?.returnEditMoment,usePreviousEditMoment:e?.usePreviousEditMoment,async:w};await U(this.layer.url,c,!0);const I=j(this.layer.url,c||null);
2if(await $(s.url,c,s.historicMoment))throw new S("feature-layer-source:historic-version","Editing a historic version is not allowed");e?.returnServiceEditsOption?(p.edits=JSON.stringify([{id:s.layerId,adds:u.length?u:null,updates:l.length?l:null,deletes:g.length?g:null,attachments:b,assetMaps:i}]),p.returnServiceEditsOption=ye.toJSON(e?.returnServiceEditsOption),p.returnServiceEditsInSourceSR=e?.returnServiceEditsInSourceSR):(p.adds=u.length?JSON.stringify(u):null,p.updates=l.length?JSON.stringify(l):null,p.deletes=g.length?n?JSON.stringify(g):g.join(","):null,p.attachments=b&&JSON.stringify(b),p.assetMaps=i!=null?JSON.stringify(i):void 0);const y=this._getLayerRequestOptions({method:"post",query:p});I&&(y.authMode="immediate",y.query.returnEditMoment=!0,y.query.sessionId=V);const q=e?.returnServiceEditsOption?s.url:s.parsedUrl.path;let m;try{m=w?await this._asyncApplyEdits(q+"/applyEdits",y):await h(q+"/applyEdits",y)}catch(f){if(!le(f))throw f;y.authMode="immediate",m=w?await this._asyncApplyEdits(q+"/applyEdits",y):await h(q+"/applyEdits",y)}return this._createEditsResult(m)}async deleteAttachments(t,e){await this.load();const{layer:s}=this;await O(s,"editing");const a=t.attributes[s.objectIdField],r=s.parsedUrl.path+"/"+a+"/deleteAttachments";try{return(await h(r,this._getLayerRequestOptions({query:{attachmentIds:e.join(",")},method:"post"}))).data.deleteAttachmentResults.map(v)}catch(n){throw this._createAttachmentErrorResult(a,n)}}fetchRecomputedExtents(t={}){const e=t.signal;return this.load({signal:e}).then(async()=>{const s=this._getLayerRequestOptions({...t,query:{returnUpdates:!0}}),{layerId:a,url:r}=this.layer,{data:n}=await h(`${r}/${a}`,s),{id:i,extent:o,fullExtent:u,timeExtent:d}=n,l=o||u;return{id:i,fullExtent:l&&G.fromJSON(l),timeExtent:d&&H.fromJSON({start:d[0],end:d[1]})}})}async queryAttachments(t,e={}){await this.load();const s=this._getLayerRequestOptions(e);return this.queryTask.executeAttachmentQuery(t,s)}async queryFeatures(t,e){await this.load();const s=await this.queryTask.execute(t,{...e,query:this._createRequestQueryOptions(e)});if(t.outStatistics?.length&&s.features.length){const a=new Map;if(s.features.forEach(r=>{const n=r.attributes;t.outStatistics?.forEach(({outStatisticFieldName:i})=>{if(i){const o=i.toLowerCase();o&&o in n&&i!==o&&(n[i]=n[o],delete n[o],a.set(o,i))}})}),s.fields!=null)for(const r of s.fields){const n=a.get(r.name.toLowerCase());n!=null&&(r.name=n)}}return s}async queryFeaturesJSON(t,e){return await this.load(),this.queryTask.executeJSON(t,{...e,query:this._createRequestQueryOptions(e)})}async queryObjectIds(t,e){return await this.load(),this.queryTask.executeForIds(t,{...e,query:this._createRequestQueryOptions(e)})}async queryFeatureCount(t,e){return await this.load(),this.queryTask.executeForCount(t,{...e,query:this._createRequestQueryOptions(e)})}async queryExtent(t,e){return await this.load(),this.queryTask.executeForExtent(t,{...e,query:this._createRequestQueryOptions(e)})}async queryRelatedFeatures(t,e){return await this.load(),this.queryTask.executeRelationshipQuery(t,{...e,query:this._createRequestQueryOptions(e)})}async queryRelatedFeaturesCount(t,e){return await this.load(),this.queryTask.executeRelationshipQueryForCount(t,{...e,query:this._createRequestQueryOptions(e)})}async queryPivot(t,e){return await this.load(),this.queryTask.executePivotQuery(t,{...e,query:this._createRequestQueryOptions(e)})}async queryTopFeatures(t,e){return await this.load(),this.queryTask.executeTopFeaturesQuery(t,{...e,query:this._createRequestQueryOptions(e)})}async queryAttributeBins(t,e){return await this.load(),this.queryTask.executeAttributeBinsQuery(t,{...e,query:this._createRequestQueryOptions(e)})}async queryTopObjectIds(t,e){return await this.load(),this.queryTask.executeForTopIds(t,{...e,query:this._createRequestQueryOptions(e)})}async queryTopExtents(t,e){return await this.load(),this.queryTask.executeForTopExtents(t,{...e,query:this._createRequestQueryOptions(e)})}async queryTopCount(t,e){return await this.load(),this.queryTask.executeForTopCount(t,{...e,query:this._createRequestQueryOptions(e)})}async fetchPublishingStatus(){if(!z(this.layer.url))return"unavailable";const t=F(this.layer.url,"status"),e=await h(t,{query:{f:"json"}});return me.fromJSON(e.data.status)}async uploadAssets(t,e){const{uploadAssets:s}=await T(()=>import("./uploadAssets-B10kipaD.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]));return s(t,{layer:this.layer,ongoingUploads:this._ongoingAssetUploads},e)}_handleLastEditsEventChange(t){const e=this.layer;if(t==null||!("capabilities"in e)||!("effectiveCapabilities"in e)||!(!e.capabilities?.operations?.supportsEditing&&e.effectiveCapabilities?.operations?.supportsEditing))return;const s=e.url;s!=null&&("layerId"in e&&F(s,e.layerId.toString()),this._getOrCreateEditInterceptor(s).before=a=>{const r=a.requestOptions.method??"auto";if(r==="auto"||r==="head"){const n=a.requestOptions.query??{};n._ts=t.getTime(),a.requestOptions.query=n}})}_getOrCreateEditInterceptor(t){return this._editInterceptor==null&&(this._editInterceptor={urls:t},M.request.internalInterceptors.push(this._editInterceptor)),this._editInterceptor}_removeEditInterceptor(){this._editInterceptor!=null&&(B(M.request.internalInterceptors,this._editInterceptor),this._editInterceptor=null)}async _asyncApplyEdits(t,e){const s=(await h(t,e)).data.statusUrl;for(;;){const a=(await h(s,{query:{f:"json"},responseType:"json"})).data;switch(a.status){case"Completed":return h(a.resultUrl,{query:{f:"json"},responseType:"json"});case"CompletedWithErrors":throw new S("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 S("async-applyEdits-failed","asynchronous applyEdits call failed (undefined response status)")}await K(fe)}}_createRequestQueryOptions(t){const e={...this.layer.customParameters,token:this.layer.apiKey,...t?.query};return this.layer.datesInUnknownTimezone&&(e.timeReferenceUnknownClient=!0),e}async _fetchService(t,e){if(!t){const a={};
2x("featurelayer-advanced-symbols")&&(a.returnAdvancedSymbols=!0),e?.cacheBust&&(a._ts=Date.now());const{data:r}=await h(this.layer.parsedUrl.path,this._getLayerRequestOptions({query:a,signal:e?.signal}));t=r}this.layer.applyPreferredHost(t),this.sourceJSON=await this._patchServiceJSON(t,e?.signal);const s=t.type;if(!this.supportedSourceTypes.has(s))throw new S("feature-layer-source:unsupported-type",`Source type "${s}" is not supported`)}async _patchServiceJSON(t,e){if(t.type!=="Table"&&t.geometryType&&!t?.drawingInfo?.renderer&&!t.defaultSymbol){const s=W(t.geometryType).renderer;X("drawingInfo.renderer",s,t)}if(t.geometryType==="esriGeometryMultiPatch"&&t.infoFor3D&&(t.geometryType="mesh"),t.extent==null)try{const{data:s}=await h(this.layer.url,this._getLayerRequestOptions({signal:e}));s.spatialReference&&(t.extent={xmin:0,ymin:0,xmax:0,ymax:0,spatialReference:s.spatialReference})}catch(s){Y(s)}return t}async _ensureLatestMetadata(t){if(this.layer.userHasUpdateItemPrivileges&&this.sourceJSON.cacheMaxAge>0)return this._fetchService(null,{...t,cacheBust:!0})}async _uploadMeshesAndGetAssetMapEditsJSON(t){const{addAssetFeatures:e}=t;if(!e?.length||await this._areAllAssetsAlreadyMapped(e))return null;const s=t.addFeatures.filter(n=>n.geometry);if(e.length!==s.length+t.updateFeatures.length)throw new S("feature-layer-source:unsupported-mesh-edits","Mixing attribute only edits with mesh geometry edits is not currently supported");const a=new Array,r=new Map;for(const n of e){const{geometry:i}=n,{vertexSpace:o}=i;if(ie(o))a.push(i);else{const u=i.origin,{convertMeshVertexSpace:d}=await T(async()=>{const{convertMeshVertexSpace:g}=await import("./convertMeshVertexSpace-CvvNDvTe.js");return{convertMeshVertexSpace:g}},__vite__mapDeps([10,1,2,11,12,13,14,15,16,17,18,19,20,21])),l=await d(i,new re({origin:[u.x,u.y,u.z??0]}));r.set(l,i),n.geometry=l,a.push(l)}}await this.uploadAssets(a);for(const[n,i]of r)i.addExternalSources(n.metadata.externalSources.items);return{adds:this._getAssetMapEditsJSON(e),updates:[],deletes:[]}}_getAssetMapEditsJSON(t){const e=new Array,s=this.layer.globalIdField,a=this.layer.parsedUrl;for(const r of t){const n=r.geometry,{metadata:i}=n,o=i.getExternalSourcesOnService(a),u=r.getAttribute(s);if(o.length===0){N.getLogger(this).error(`Skipping feature ${u}. The mesh it is associated with has not been uploaded to the service and cannot be mapped to it.`);continue}const{source:d}=o.find(ne)??o[0];for(const l of d.assets)l.parts.length===1?e.push({globalId:Z(),parentGlobalId:u,assetName:l.assetName,assetHash:l.parts[0].partHash,flags:[]}):N.getLogger(this).error(`Skipping asset ${l.assetName}. It does not have exactly one part, so we cannot map it to a feature.`)}return e}_createEditsResult(t){const e=t.data,{layerId:s}=this.layer,a=[];let r=null;if(Array.isArray(e))for(const i of e)a.push({id:i.id,editedFeatures:i.editedFeatures}),i.id===s&&(r={addResults:i.addResults??[],updateResults:i.updateResults??[],deleteResults:i.deleteResults??[],attachments:i.attachments,editMoment:i.editMoment});else r=e;const n=ce(r);if(a.length>0){n.editedFeatureResults=[];for(const i of a){const{editedFeatures:o}=i,u=o?.spatialReference?new ee(o.spatialReference):null;n.editedFeatureResults.push({layerId:i.id,editedFeatures:de(o,u)})}}return n}_createAttachmentErrorResult(t,e){const s=e.details.messages?.[0]||e.message,a=e.details.httpStatus||e.details.messageCode;return{objectId:t,globalId:null,error:new S("feature-layer-source:attachment-failure",s,{code:a})}}_getFormDataForAttachment(t,e){const s=t instanceof FormData?t:t&&t.elements?new FormData(t):null;if(s)for(const a in e){const r=e[a];r!=null&&(s.set?s.set(a,r):s.append(a,r))}return s}_getLayerRequestOptions(t={}){const{layer:e,layer:{parsedUrl:s,gdbVersion:a}}=this;return{...t,query:{gdbVersion:a,layer:"dynamicDataSource"in e&&e.dynamicDataSource?JSON.stringify({source:e.dynamicDataSource}):void 0,...s.query,f:"json",...this._createRequestQueryOptions(t)},responseType:"json"}}async _areAllAssetsAlreadyMapped(t){const{layer:e}=this,{globalIdField:s,parsedUrl:a}=e,r="infoFor3D"in e?e.infoFor3D:null;if(r==null||s==null)return!1;const n=te(r);if(n==null)return!1;const i=F(a.path,`../${n.id}`),o=new Array;for(const c of t){if(!(c.geometry.metadata.getExternalSourcesOnService(a).length>0))return!1;o.push(c)}const u=o.map(c=>c.getAttribute(s)).filter(A);
2if(u.length===0)return!1;const{assetMapFieldRoles:{parentGlobalId:d,assetHash:l}}=r,g=new se({where:`${d} IN (${u.map(c=>`'${c}'`)})`,outFields:[l,d],returnGeometry:!1}),b=await he(i,g),{features:w}=b;return w.length!==0&&!o.some(c=>{const p=c.getAttribute(s);if(!p)return!0;const{metadata:I}=c.geometry,y=w.filter(m=>m.getAttribute(d)===p);if(y.length===0)return!0;const q=y.map(m=>m.getAttribute(l));return I.getExternalSourcesOnService(a).flatMap(({source:m})=>m.assets.flatMap(f=>f.parts.map(C=>C.partHash))).some(m=>q.every(f=>m!==f))})}};E([R()],_.prototype,"type",void 0),E([R({constructOnly:!0})],_.prototype,"layer",void 0),E([R({constructOnly:!0})],_.prototype,"supportedSourceTypes",void 0),E([R({readOnly:!0})],_.prototype,"queryTask",null),_=E([ae("esri.layers.graphics.sources.FeatureLayerSource")],_);const fe=1e3;export{_ as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.