'use strict';
import { c } from 'react/compiler-runtime';
import { jsxs, jsx } from 'react/jsx-runtime';
import { useState, useEffect } from 'react';
import { Dialog, DialogTrigger, DialogContent, DialogTitle } from '../../../fd-component-toolbox/dialog/Dialog.js';
import '../../../fd-component-toolbox/client/framework/index.js';
import { getBlobUrl } from '../../core/resources/blob/blob-urls.js';
import { extractScreenshotBlobUrl } from './BlobBodyCell.funcs.js';
import FrameworkImage from 'next/image.js';

var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", {
  value,
  configurable: true
});
function BlobBodyCell(t0) {
  const $ = c(3);
  const {
    cellContext
  } = t0;
  const [fileName, setFileName] = useState("");
  const imageUrl = getBlobUrl(fileName);
  let t1;
  let t2;
  if ($[0] !== cellContext.row.item) {
    t1 = () => {
      extractScreenshotBlobUrl(cellContext.row.item, setFileName);
    };
    t2 = [cellContext.row.item];
    $[0] = cellContext.row.item;
    $[1] = t1;
    $[2] = t2;
  } else {
    t1 = $[1];
    t2 = $[2];
  }
  useEffect(t1, t2);
  if (!fileName) {
    return void 0;
  }
  return jsxs(Dialog, {
    children: [jsx(DialogTrigger, {
      className: "flex size-full",
      children: jsx("div", {
        className: "relative flex h-32 w-44",
        children: jsx(FrameworkImage, {
          src: imageUrl,
          alt: "Automatically generated screenshot preview",
          fill: true,
          className: "rounded-md object-contain",
          loading: "lazy"
        })
      })
    }), jsxs(DialogContent, {
      className: "h-4/5 w-full max-w-5xl",
      children: [jsx(DialogTitle, {
        className: "hidden"
      }), jsx("div", {
        className: "relative size-full",
        children: jsx(FrameworkImage, {
          src: imageUrl,
          alt: "Automatically generated screenshot preview",
          fill: true,
          className: "object-contain"
        })
      })]
    })]
  });
}
__name(BlobBodyCell, "BlobBodyCell");

export { BlobBodyCell };
