/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{makeHandle as e}from"../../core/handleUtils.js";import{watch as t,syncAndInitial as r}from"../../core/reactiveUtils.js";import n from"../Layer.js";const a=new WeakMap;function o(i){return!i.destroyed&&(a.has(i)||i.addHandles([t(()=>{const{parent:e}=i;return!!(e&&e instanceof n)&&("catalog-dynamic-group"===e.type||o(e))},e=>a.set(i,e),r),e(()=>a.delete(i))]),a.get(i))}function i(e){const{parent:t}=e;return"catalog-dynamic-group"===t?.type?t.parent:null}function c(e,t){const r=e.parent,{layer:n}=e;if("map-image"!==n?.type||!n.sourceJSON||!r)return!1;const a=n.sourceJSON.layers;if(!a)return!1;const o=a.find(t=>e.id===t.id),i="footprints"===t?"Feature Layer":"Catalog Dynamic Group Layer";return o?.type===i&&"Catalog Layer"===a.find(e=>e.id===r.id)?.type}export{i as getCatalogLayerForLayer,c as isCatalogSublayer,o as isLayerFromCatalog};
