/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{throwIfAborted as e}from"../../../../core/promiseUtils.js";import{loadArcade as n}from"../../../../support/loadArcade.js";async function r(r,a,s){if(null==r||0===a.candidates.length)return t;const i=r.graphics3DGraphicsByObjectID??r.graphics3DGraphics,o=[],c=[],{renderer:d}=r,l=null!=d&&"arcadeRequired"in d&&d.arcadeRequired?n():null,p=async(e,{graphic:n,graphics3DSymbol:t})=>{const a=await l,i=await r.getRenderingInfoAsync(n,d,a,{signal:s});return null==i?[]:t.queryForSnapping(e,g,i,s)},{candidates:u,spatialReference:g}=a;for(let e=0;e<u.length;++e){const n=u[e],{objectId:r}=n,t="number"==typeof r?i?.get(r):void 0;if(null==t)continue;const{graphics3DSymbol:a}=t;a.symbologySnappingSupported&&(o.push(p(n,t)),c.push(e))}if(0===o.length)return t;const h=await Promise.all(o);e(s);const f=[],m=[];for(let e=0;e<h.length;++e){const n=h[e],r=c[e];for(const e of n)f.push(e),m.push(r)}return{candidates:f,sourceCandidateIndices:m}}const t={candidates:[],sourceCandidateIndices:[]};export{r as queryForSymbologySnapping};
