'use strict';
import { c } from 'react/compiler-runtime';
import { jsx } from 'react/jsx-runtime';
import { useState } from 'react';
import { useAsyncEffect } from '../../../../fd-toolbox/hooks/use-async-effect.js';
import { Link } from '../../../fd-component-toolbox/link/Link.js';

var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", {
  value,
  configurable: true
});
function CustomActionLink(t0) {
  const $ = c(6);
  const {
    text,
    cellContext,
    dynamicLink
  } = t0;
  const [href, setHref] = useState("");
  let t1;
  if ($[0] !== cellContext || $[1] !== dynamicLink) {
    t1 = async () => {
      setHref(await dynamicLink(cellContext));
    };
    $[0] = cellContext;
    $[1] = dynamicLink;
    $[2] = t1;
  } else {
    t1 = $[2];
  }
  useAsyncEffect(t1);
  let t2;
  if ($[3] !== href || $[4] !== text) {
    t2 = jsx(Link, {
      href,
      children: text
    });
    $[3] = href;
    $[4] = text;
    $[5] = t2;
  } else {
    t2 = $[5];
  }
  return t2;
}
__name(CustomActionLink, "CustomActionLink");

export { CustomActionLink };
