/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
import { watch as u } from "@arcgis/core/core/reactiveUtils.js";
import { makeController as y } from "@arcgis/lumina/controllers";
function v(r, e) {
  return y((f, a) => (a.onLifecycle(
    () => u(
      () => ({
        layerId: r.mapLayerId,
        viewReady: r.view?.ready
      }),
      ({ layerId: i, viewReady: t }) => {
        if (!t)
          return;
        const d = r.view;
        if (!i) {
          e(void 0);
          return;
        }
        e(d?.map?.findLayerById(i));
      },
      {
        initial: !0
      }
    )
  ), r.mapLayerId));
}
export {
  v as u
};
