import { a9 as je, S as Re, aa as fe, ab as Pe, ac as Ne, A as a, ad as He, ae as I, r as i, af as p, ag as u, ah as J, ai as Z, aj as B, ak as Me, al as Ke, am as Te, an as Fe, ao as Le, ap as Ae, aq as Be, M as Ge, a8 as Ee } from "./chunk-CODtpsMq.js";
import { b_ as c, b$ as m, c0 as $, c1 as ne, c2 as Ie, c3 as F, V as G, bK as De, an as se, br as Oe, aA as Xe, aE as Ue, aD as ze, aG as ke, al as qe, L as $e, T as re, b7 as ie, c4 as oe, aL as Ve, c5 as Ye, aM as Ze, aN as We, c6 as Je, aO as Qe, aR as ea, aT as aa, aU as ta, aV as na, aW as sa, c7 as ra, aJ as ia } from "./chunk-IERganv1.js";
const oa = /* @__PURE__ */ je("CollectionsAdd20Regular", "20", ["M15.5 7A2.5 2.5 0 0 1 18 9.33v.93a5.5 5.5 0 0 0-1-.66v-.1c0-.78-.6-1.42-1.35-1.5H9.5c-.78 0-1.42.6-1.5 1.35v6.15c0 .78.6 1.42 1.36 1.5H9.6c.18.36.4.7.66 1H9.5A2.5 2.5 0 0 1 7 15.66V9.5A2.5 2.5 0 0 1 9.34 7h6.16Zm-2.84-3.3.05.15L13.3 6h-1.04l-.5-1.89a1.5 1.5 0 0 0-1.7-1.1l-.14.04L4.1 4.6a1.5 1.5 0 0 0-1.09 1.7l.03.14 1.55 5.8a1.5 1.5 0 0 0 1.4 1.1v1a2.5 2.5 0 0 1-2.3-1.68l-.06-.17-1.55-5.8a2.5 2.5 0 0 1 1.6-3l.16-.05 5.8-1.56a2.5 2.5 0 0 1 2.96 1.46l.05.15ZM19 14.5a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0Zm-4-2a.5.5 0 1 0-1 0V14h-1.5a.5.5 0 0 0 0 1H14v1.5a.5.5 0 1 0 1 0V15h1.5a.5.5 0 1 0 0-1H15v-1.5Z"]), le = {
  name: "bvh",
  extensions: {
    // eslint-disable-next-line @typescript-eslint/naming-convention
    ".bvh": { isBinary: !1 }
  }
}, ce = {
  name: "obj",
  extensions: ".obj"
}, me = {
  name: "splat",
  extensions: {
    // eslint-disable-next-line @typescript-eslint/naming-convention
    ".splat": { isBinary: !0 },
    // eslint-disable-next-line @typescript-eslint/naming-convention
    ".ply": { isBinary: !0 },
    // eslint-disable-next-line @typescript-eslint/naming-convention
    ".spz": { isBinary: !0 },
    // eslint-disable-next-line @typescript-eslint/naming-convention
    ".json": { isBinary: !1 },
    // For SOG metadata files
    // eslint-disable-next-line @typescript-eslint/naming-convention
    ".sog": { isBinary: !0 }
  }
}, la = {
  name: "stl",
  extensions: {
    // eslint-disable-next-line @typescript-eslint/naming-convention
    ".stl": { isBinary: !0 }
  }
};
function ca() {
  c("EXT_lights_image_based"), m("EXT_lights_image_based", !0, async (e) => {
    const { EXT_lights_image_based: n } = await import("./chunk-IERganv1.js").then((t) => t.d1);
    return new n(e);
  }), c("EXT_mesh_gpu_instancing"), m("EXT_mesh_gpu_instancing", !0, async (e) => {
    const { EXT_mesh_gpu_instancing: n } = await import("./chunk-IERganv1.js").then((t) => t.d2);
    return new n(e);
  }), c("EXT_meshopt_compression"), m("EXT_meshopt_compression", !0, async (e) => {
    const { EXT_meshopt_compression: n } = await import("./chunk-IERganv1.js").then((t) => t.d3);
    return new n(e);
  }), c("EXT_texture_avif"), m("EXT_texture_avif", !0, async (e) => {
    const { EXT_texture_avif: n } = await import("./chunk-IERganv1.js").then((t) => t.d5);
    return new n(e);
  }), c("EXT_texture_webp"), m("EXT_texture_webp", !0, async (e) => {
    const { EXT_texture_webp: n } = await import("./chunk-IERganv1.js").then((t) => t.d4);
    return new n(e);
  }), c("ExtrasAsMetadata"), m("ExtrasAsMetadata", !1, async (e) => {
    const { ExtrasAsMetadata: n } = await import("./chunk-IERganv1.js").then((t) => t.dG);
    return new n(e);
  }), c("KHR_animation_pointer"), m("KHR_animation_pointer", !0, async (e) => {
    const { KHR_animation_pointer: n } = await import("./chunk-IERganv1.js").then((t) => t.dx);
    return new n(e);
  }), c("KHR_draco_mesh_compression"), m("KHR_draco_mesh_compression", !0, async (e) => {
    const { KHR_draco_mesh_compression: n } = await import("./chunk-IERganv1.js").then((t) => t.d7);
    return new n(e);
  }), c("KHR_interactivity"), m("KHR_interactivity", !0, async (e) => {
    const { KHR_interactivity: n } = await import("./chunk-IERganv1.js").then((t) => t.dC);
    return new n(e);
  }), c("KHR_lights_punctual"), m("KHR_lights_punctual", !0, async (e) => {
    const { KHR_lights: n } = await import("./chunk-IERganv1.js").then((t) => t.d8);
    return new n(e);
  }), c("EXT_lights_area"), m("EXT_lights_area", !0, async (e) => {
    const { EXT_lights_area: n } = await import("./chunk-IERganv1.js").then((t) => t.d9);
    return new n(e);
  }), c("EXT_lights_ies"), m("EXT_lights_ies", !0, async (e) => {
    const { EXT_lights_ies: n } = await import("./chunk-IERganv1.js").then((t) => t.d6);
    return new n(e);
  }), c("KHR_materials_anisotropy"), m("KHR_materials_anisotropy", !0, async (e) => {
    const { KHR_materials_anisotropy: n } = await import("./chunk-IERganv1.js").then((t) => t.df);
    return new n(e);
  }), c("KHR_materials_clearcoat"), m("KHR_materials_clearcoat", !0, async (e) => {
    const { KHR_materials_clearcoat: n } = await import("./chunk-IERganv1.js").then((t) => t.dc);
    return new n(e);
  }), c("KHR_materials_diffuse_roughness"), m("KHR_materials_diffuse_roughness", !0, async (e) => {
    const { KHR_materials_diffuse_roughness: n } = await import("./chunk-IERganv1.js").then((t) => t.ds);
    return new n(e);
  }), c("KHR_materials_diffuse_transmission"), m("KHR_materials_diffuse_transmission", !0, async (e) => {
    const { KHR_materials_diffuse_transmission: n } = await import("./chunk-IERganv1.js").then((t) => t.dn);
    return new n(e);
  }), c("KHR_materials_dispersion"), m("KHR_materials_dispersion", !0, async (e) => {
    const { KHR_materials_dispersion: n } = await import("./chunk-IERganv1.js").then((t) => t.dr);
    return new n(e);
  }), c("KHR_materials_emissive_strength"), m("KHR_materials_emissive_strength", !0, async (e) => {
    const { KHR_materials_emissive_strength: n } = await import("./chunk-IERganv1.js").then((t) => t.dg);
    return new n(e);
  }), c("KHR_materials_ior"), m("KHR_materials_ior", !0, async (e) => {
    const { KHR_materials_ior: n } = await import("./chunk-IERganv1.js").then((t) => t.dk);
    return new n(e);
  }), c("KHR_materials_iridescence"), m("KHR_materials_iridescence", !0, async (e) => {
    const { KHR_materials_iridescence: n } = await import("./chunk-IERganv1.js").then((t) => t.de);
    return new n(e);
  }), c("KHR_materials_pbrSpecularGlossiness"), m("KHR_materials_pbrSpecularGlossiness", !0, async (e) => {
    const { KHR_materials_pbrSpecularGlossiness: n } = await import("./chunk-IERganv1.js").then((t) => t.da);
    return new n(e);
  }), c("KHR_materials_sheen"), m("KHR_materials_sheen", !0, async (e) => {
    const { KHR_materials_sheen: n } = await import("./chunk-IERganv1.js").then((t) => t.dh);
    return new n(e);
  }), c("KHR_materials_specular"), m("KHR_materials_specular", !0, async (e) => {
    const { KHR_materials_specular: n } = await import("./chunk-IERganv1.js").then((t) => t.dj);
    return new n(e);
  }), c("KHR_materials_transmission"), m("KHR_materials_transmission", !0, async (e) => {
    const { KHR_materials_transmission: n } = await import("./chunk-IERganv1.js").then((t) => t.dm);
    return new n(e);
  }), c("KHR_materials_unlit"), m("KHR_materials_unlit", !0, async (e) => {
    const { KHR_materials_unlit: n } = await import("./chunk-IERganv1.js").then((t) => t.db);
    return new n(e);
  }), c("KHR_materials_variants"), m("KHR_materials_variants", !0, async (e) => {
    const { KHR_materials_variants: n } = await import("./chunk-IERganv1.js").then((t) => t.dl);
    return new n(e);
  }), c("KHR_materials_volume"), m("KHR_materials_volume", !0, async (e) => {
    const { KHR_materials_volume: n } = await import("./chunk-IERganv1.js").then((t) => t.dp);
    return new n(e);
  }), c("KHR_mesh_quantization"), m("KHR_mesh_quantization", !0, async (e) => {
    const { KHR_mesh_quantization: n } = await import("./chunk-IERganv1.js").then((t) => t.dt);
    return new n(e);
  }), c("KHR_texture_basisu"), m("KHR_texture_basisu", !0, async (e) => {
    const { KHR_texture_basisu: n } = await import("./chunk-IERganv1.js").then((t) => t.du);
    return new n(e);
  }), c("KHR_texture_transform"), m("KHR_texture_transform", !0, async (e) => {
    const { KHR_texture_transform: n } = await import("./chunk-IERganv1.js").then((t) => t.dv);
    return new n(e);
  }), c("KHR_xmp_json_ld"), m("KHR_xmp_json_ld", !0, async (e) => {
    const { KHR_xmp_json_ld: n } = await import("./chunk-IERganv1.js").then((t) => t.dw);
    return new n(e);
  }), c("MSFT_audio_emitter"), m("MSFT_audio_emitter", !0, async (e) => {
    const { MSFT_audio_emitter: n } = await import("./chunk-IERganv1.js").then((t) => t.dy);
    return new n(e);
  }), c("MSFT_lod"), m("MSFT_lod", !0, async (e) => {
    const { MSFT_lod: n } = await import("./chunk-IERganv1.js").then((t) => t.dz);
    return new n(e);
  }), c("MSFT_minecraftMesh"), m("MSFT_minecraftMesh", !0, async (e) => {
    const { MSFT_minecraftMesh: n } = await import("./chunk-IERganv1.js").then((t) => t.dA);
    return new n(e);
  }), c("MSFT_sRGBFactors"), m("MSFT_sRGBFactors", !0, async (e) => {
    const { MSFT_sRGBFactors: n } = await import("./chunk-IERganv1.js").then((t) => t.dB);
    return new n(e);
  }), c("KHR_node_visibility"), m("KHR_node_visibility", !0, async (e) => {
    const { KHR_node_visibility: n } = await import("./chunk-IERganv1.js").then((t) => t.dD);
    return new n(e);
  }), c("KHR_node_hoverability"), m("KHR_node_hoverability", !0, async (e) => {
    const { KHR_node_hoverability: n } = await import("./chunk-IERganv1.js").then((t) => t.dF);
    return new n(e);
  }), c("KHR_node_selectability"), m("KHR_node_selectability", !0, async (e) => {
    const { KHR_node_selectability: n } = await import("./chunk-IERganv1.js").then((t) => t.dE);
    return new n(e);
  }), c("KHR_materials_coat"), m("KHR_materials_coat", !0, async (e) => {
    const { KHR_materials_coat: n } = await import("./chunk-IERganv1.js").then((t) => t.dd);
    return new n(e);
  }), c("KHR_materials_fuzz"), m("KHR_materials_fuzz", !0, async (e) => {
    const { KHR_materials_fuzz: n } = await import("./chunk-IERganv1.js").then((t) => t.di);
    return new n(e);
  }), c("KHR_materials_volume_scatter"), m("KHR_materials_volume_scatter", !0, async (e) => {
    const { KHR_materials_volume_scatter: n } = await import("./chunk-IERganv1.js").then((t) => t.dq);
    return new n(e);
  });
}
function ma() {
  $({
    ...le,
    createPlugin: async (e) => {
      const { BVHFileLoader: n } = await import("./chunk-B-22ATAX.js");
      return new n(e[le.name]);
    }
  }), $({
    ...ne,
    createPlugin: async (e) => {
      const { GLTFFileLoader: n } = await import("./chunk-IERganv1.js").then((t) => t.d0);
      return new n(e[ne.name]);
    }
  }), ca(), $({
    ...ce,
    createPlugin: async (e) => {
      const { OBJFileLoader: n } = await import("./chunk-Cx4kqim-.js");
      return new n(e[ce.name]);
    }
  }), $({
    ...me,
    createPlugin: async (e) => {
      const { SPLATFileLoader: n } = await import("./chunk-DT3MgdVI.js");
      return new n(e[me.name]);
    }
  }), $({
    ...la,
    createPlugin: async () => {
      const { STLFileLoader: e } = await import("./chunk-DhZ6boYZ.js");
      return new e();
    }
  });
}
const ue = (e) => a.jsx(Ae, { icon: Be, open: e.open, onOpenChange: e.onOpenChange, children: e.children }), Q = Ge({
  section: {
    display: "flex",
    flexDirection: "column",
    rowGap: Ee.spacingVerticalM
  },
  row: { display: "flex", alignItems: "center", gap: "4px" },
  rightAligned: { marginLeft: "auto" }
}), D = ({ children: e }) => {
  const n = Q();
  return a.jsx("div", { className: n.section, children: e });
}, ua = ({ children: e }) => {
  const n = Q();
  return a.jsx("div", { className: n.row, children: e });
};
function da(e) {
  return "dispose" in e && typeof e.dispose == "function";
}
const b = ({ selectionService: e, label: n, onCreate: t, onSettingsCreate: j, children: l }) => {
  const [d, S] = i.useState(null), [P, h] = i.useState(!1), { showToast: H } = Te(), g = Q(), C = d && da(d) ? d : null, w = Fe("function", C, "dispose");
  i.useEffect(() => {
    const M = w.add(() => S(null));
    return () => M.remove();
  }, [w]);
  const _ = i.useCallback(async (M) => {
    try {
      const f = await M();
      S(f), H(`Created ${f.name}`);
    } catch (f) {
      H(`Creation failed: ${f instanceof Error ? f.message : String(f)}`);
    }
  }, [H]);
  return a.jsxs("div", { className: g.row, children: [a.jsx(Z, { onClick: () => void _(t), label: n }), l && a.jsxs(ue, { open: P, onOpenChange: h, children: [l, a.jsx(Z, { appearance: "primary", onClick: () => {
    h(!1), _(j ?? t);
  }, label: "Create" })] }), a.jsx("div", { className: g.rightAligned, children: a.jsx(Le, { entity: d, selectionService: e }) })] });
};
ma();
const L = function(e) {
  const n = e.activeCamera;
  n && n.radius !== void 0 && (n.radius = 5);
}, ha = ({ scene: e, selectionService: n }) => {
  const [t, j] = i.useState({
    name: "Sphere",
    segments: 32,
    diameter: 1,
    diameterX: 1,
    diameterY: 1,
    diameterZ: 1,
    arc: 1,
    slice: 1,
    uniform: !0
  }), l = (s, R) => {
    j((o) => ({
      ...o,
      [s]: R
    }));
  }, [d, S] = i.useState({
    name: "Box",
    size: 1,
    width: 1,
    height: 1,
    depth: 1
  }), P = (s, R) => {
    S((o) => ({
      ...o,
      [s]: R
    }));
  }, [h, H] = i.useState({
    name: "Cylinder",
    height: 2,
    diameterTop: 1,
    diameterBottom: 1,
    diameter: 1,
    tessellation: 32,
    subdivisions: 1,
    arc: 1
  }), g = (s, R) => {
    H((o) => ({
      ...o,
      [s]: R
    }));
  }, [C, w] = i.useState({
    name: "Cone",
    height: 2,
    diameter: 1,
    diameterTop: 0,
    diameterBottom: 1,
    tessellation: 32,
    subdivisions: 1,
    arc: 1
  }), [_, M] = i.useState(!0), f = (s, R) => {
    w((o) => ({
      ...o,
      [s]: R
    }));
  }, [N, x] = i.useState({
    name: "Ground",
    width: 10,
    height: 10,
    subdivisions: 1,
    subdivisionsX: 1,
    subdivisionsY: 1
  }), v = (s, R) => {
    x((o) => ({
      ...o,
      [s]: R
    }));
  }, T = i.useRef(null), [K, y] = i.useState("ImportedMesh"), O = (s) => {
    const R = s.target.files;
    if (!R || R.length === 0)
      return;
    const o = Array.from(R);
    if (K.trim().length > 0 && o.length > 0) {
      const A = o[0], k = A.name.lastIndexOf("."), E = k >= 0 ? A.name.substring(k) : "", q = K.trim(), Y = q.toLowerCase().endsWith(E.toLowerCase()) ? q : `${q}${E}`;
      o[0] = new File([A], Y, { type: A.type, lastModified: A.lastModified });
    }
    const z = new De(e.getEngine(), e, null, null, null, null, null, null, (A, k, E) => {
      alert(E ? `Failed to import mesh: ${E}` : "Failed to import mesh.");
    }, !0);
    z.displayLoadingUI = !1, z.loadFiles({ target: { files: o } }), z.dispose(), s.target.value = "";
  }, U = Ie().flatMap((s) => s.extensions.map((R) => R.extension)).filter((s) => s.toLowerCase() !== ".json");
  return a.jsxs(D, { children: [a.jsxs(b, { selectionService: n, label: "Sphere", onCreate: () => {
    const s = F.CreateSphere("Sphere", {}, e);
    return L(e), s;
  }, onSettingsCreate: () => {
    const s = {
      segments: t.segments,
      arc: t.arc,
      slice: t.slice
    };
    t.uniform ? s.diameter = t.diameter : (s.diameterX = t.diameterX, s.diameterY = t.diameterY, s.diameterZ = t.diameterZ);
    const R = F.CreateSphere(t.name, s, e);
    return L(e), R;
  }, children: [a.jsx(p, { label: "Name", value: t.name, onChange: (s) => l("name", s) }), a.jsx(u, { label: "Segments", value: t.segments, min: 0, onChange: (s) => l("segments", s) }), a.jsx(u, { label: "Diameter", value: t.diameter, min: 0, step: 0.1, onChange: (s) => l("diameter", s), disabled: !t.uniform }), a.jsx(J, { label: "Uniform", value: t.uniform, onChange: (s) => l("uniform", s) }), a.jsx(u, { label: "Diameter X", value: t.diameterX, min: 0, step: 0.1, onChange: (s) => l("diameterX", s), disabled: t.uniform }), a.jsx(u, { label: "Diameter Y", value: t.diameterY, min: 0, step: 0.1, onChange: (s) => l("diameterY", s), disabled: t.uniform }), a.jsx(u, { label: "Diameter Z", value: t.diameterZ, min: 0, step: 0.1, onChange: (s) => l("diameterZ", s), disabled: t.uniform }), a.jsx(u, { label: "Arc", value: t.arc, min: 0, max: 1, step: 0.1, onChange: (s) => l("arc", s) }), a.jsx(u, { label: "Slice", value: t.slice, min: 0, max: 1, step: 0.1, onChange: (s) => l("slice", s) })] }), a.jsxs(b, { selectionService: n, label: "Box", onCreate: () => {
    const s = F.CreateBox("Box", {}, e);
    return L(e), s;
  }, onSettingsCreate: () => {
    const s = F.CreateBox(d.name, d, e);
    return L(e), s;
  }, children: [a.jsx(p, { label: "Name", value: d.name, onChange: (s) => P("name", s) }), a.jsx(u, { label: "Size", value: d.size, min: 0, step: 0.1, onChange: (s) => P("size", s) }), a.jsx(u, { label: "Width", value: d.width, min: 0, step: 0.1, onChange: (s) => P("width", s) }), a.jsx(u, { label: "Height", value: d.height, min: 0, step: 0.1, onChange: (s) => P("height", s) }), a.jsx(u, { label: "Depth", value: d.depth, min: 0, step: 0.1, onChange: (s) => P("depth", s) })] }), a.jsxs(b, { selectionService: n, label: "Cylinder", onCreate: () => {
    const s = F.CreateCylinder("Cylinder", {}, e);
    return L(e), s;
  }, onSettingsCreate: () => {
    const s = F.CreateCylinder(h.name, h, e);
    return L(e), s;
  }, children: [a.jsx(p, { label: "Name", value: h.name, onChange: (s) => g("name", s) }), a.jsx(u, { label: "Height", value: h.height, min: 0, step: 0.1, onChange: (s) => g("height", s) }), a.jsx(u, { label: "Diameter Top", value: h.diameterTop, min: 0, step: 0.1, onChange: (s) => g("diameterTop", s) }), a.jsx(u, { label: "Diameter Bottom", value: h.diameterBottom, min: 0, step: 0.1, onChange: (s) => g("diameterBottom", s) }), a.jsx(u, { label: "Diameter", value: h.diameter, min: 0, step: 0.1, onChange: (s) => g("diameter", s) }), a.jsx(u, { label: "Tessellation", value: h.tessellation, min: 3, onChange: (s) => g("tessellation", s) }), a.jsx(u, { label: "Subdivisions", value: h.subdivisions, min: 1, onChange: (s) => g("subdivisions", s) }), a.jsx(u, { label: "Arc", value: h.arc, min: 0, max: 1, step: 0.1, onChange: (s) => g("arc", s) })] }), a.jsxs(b, { selectionService: n, label: "Cone", onCreate: () => {
    const s = F.CreateCylinder("Cone", { diameterTop: 0 }, e);
    return L(e), s;
  }, onSettingsCreate: () => {
    const s = {
      ...C,
      diameterTop: _ ? 0 : C.diameterTop,
      diameterBottom: _ ? C.diameterBottom : 0
    }, R = F.CreateCylinder(C.name, s, e);
    return L(e), R;
  }, children: [a.jsx(p, { label: "Name", value: C.name, onChange: (s) => f("name", s) }), a.jsx(u, { label: "Height", value: C.height, min: 0, step: 0.1, onChange: (s) => f("height", s) }), a.jsx(u, { label: "Diameter", value: C.diameter, min: 0, step: 0.1, onChange: (s) => f("diameter", s) }), a.jsx(u, { label: "Tessellation", value: C.tessellation, min: 3, onChange: (s) => f("tessellation", s) }), a.jsx(u, { label: "Subdivisions", value: C.subdivisions, min: 1, onChange: (s) => f("subdivisions", s) }), a.jsx(u, { label: "Arc", value: C.arc, min: 0, max: 1, step: 0.1, onChange: (s) => f("arc", s) }), a.jsx(J, { label: "Up", value: _, onChange: (s) => M(s) })] }), a.jsxs(b, { selectionService: n, label: "Ground", onCreate: () => {
    const s = F.CreateGround("Ground", {}, e);
    return L(e), s;
  }, onSettingsCreate: () => {
    const s = F.CreateGround(N.name, N, e);
    return L(e), s;
  }, children: [a.jsx(p, { label: "Name", value: N.name, onChange: (s) => v("name", s) }), a.jsx(u, { label: "Width", value: N.width, min: 0, step: 0.1, onChange: (s) => v("width", s) }), a.jsx(u, { label: "Height", value: N.height, min: 0, step: 0.1, onChange: (s) => v("height", s) }), a.jsx(u, { label: "Subdivisions", value: N.subdivisions, min: 1, onChange: (s) => v("subdivisions", s) }), a.jsx(u, { label: "Subdivisions X", value: N.subdivisionsX, min: 1, onChange: (s) => v("subdivisionsX", s) }), a.jsx(u, { label: "Subdivisions Y", value: N.subdivisionsY, min: 1, onChange: (s) => v("subdivisionsY", s) })] }), a.jsxs(ua, { children: [a.jsx(Z, { onClick: () => {
    T.current?.click();
  }, label: "Import Mesh" }), a.jsxs(ue, { children: [a.jsx(p, { label: "Name", value: K, onChange: (s) => y(s) }), a.jsx("div", { style: { display: "flex", justifyContent: "flex-end", gap: 8 }, children: a.jsx(Z, { appearance: "primary", onClick: () => {
    T.current?.click();
  }, label: "Import" }) })] }), a.jsx("input", { ref: T, type: "file", accept: U.join(","), multiple: !0, style: { display: "none" }, onChange: O })] })] });
}, pa = ({ scene: e, selectionService: n }) => {
  const [t, j] = i.useState("Node Material"), [l, d] = i.useState(""), [S, P] = i.useState("PBR Material"), [h, H] = i.useState("Standard Material"), g = () => new Oe(S, e), C = () => new Xe(h, e), w = async () => {
    if (l) {
      const _ = await se.ParseFromSnippetAsync(l, e);
      return _.name = t, _;
    } else {
      const _ = new se(t, e);
      return _.setToDefault(), _.build(), _;
    }
  };
  return a.jsxs(D, { children: [a.jsxs(b, { selectionService: n, label: "Node Material", onCreate: w, children: [a.jsx(p, { label: "Name", value: t, onChange: (_) => j(_) }), a.jsx(p, { label: "Snippet ID", value: l, onChange: (_) => d(_) })] }), a.jsx(b, { selectionService: n, label: "PBR Material", onCreate: () => g(), children: a.jsx(p, { label: "Name", value: S, onChange: (_) => P(_) }) }), a.jsx(b, { selectionService: n, label: "Standard Material", onCreate: () => C(), children: a.jsx(p, { label: "Name", value: h, onChange: (_) => H(_) }) })] });
}, ga = ({ scene: e, selectionService: n }) => {
  const [t, j] = i.useState("Point Light"), [l, d] = i.useState(new G(0, 5, 0)), [S, P] = i.useState("Directional Light"), [h, H] = i.useState(new G(1, -1, 0)), [g, C] = i.useState("Spotlight"), [w, _] = i.useState(new G(0, 5, 0)), [M, f] = i.useState(new G(0, -1, 0)), [N, x] = i.useState(1), [v, T] = i.useState(1), [K, y] = i.useState("Clustered Light"), O = () => {
    const o = new Ue(t, l, e);
    return o.intensity = 1, o;
  }, U = () => {
    const o = new ze(S, h, e);
    return o.intensity = 1, o;
  }, s = () => {
    const o = new ke(g, w, M, N, v, e);
    return o.intensity = 1, o;
  }, R = async () => (await import("./chunk-IERganv1.js").then((o) => o.dH), new qe(K, [], e));
  return a.jsxs(D, { children: [a.jsxs(b, { selectionService: n, label: "Point Light", onCreate: () => O(), children: [a.jsx(p, { label: "Name", value: t, onChange: (o) => j(o) }), a.jsx(B, { label: "Position", value: l, onChange: (o) => d(o) })] }), a.jsxs(b, { selectionService: n, label: "Directional Light", onCreate: () => U(), children: [a.jsx(p, { label: "Name", value: S, onChange: (o) => P(o) }), a.jsx(B, { label: "Direction", value: h, onChange: (o) => H(o) })] }), a.jsxs(b, { selectionService: n, label: "Spotlight", onCreate: () => s(), children: [a.jsx(p, { label: "Name", value: g, onChange: (o) => C(o) }), a.jsx(B, { label: "Position", value: w, onChange: (o) => _(o) }), a.jsx(B, { label: "Direction", value: M, onChange: (o) => f(o) }), a.jsx(u, { label: "Angle", value: N, onChange: (o) => x(o), min: 0, max: Math.PI, step: 0.1 }), a.jsx(u, { label: "Exponent", value: v, onChange: (o) => T(o), min: 0, max: 10, step: 0.1 })] }), a.jsx(b, { selectionService: n, label: "Clustered Light", onCreate: async () => await R(), children: a.jsx(p, { label: "Name", value: K, onChange: (o) => y(o) }) })] });
}, Ca = ({ scene: e, selectionService: n }) => {
  const [t, j] = i.useState("ArcRotate Camera"), [l, d] = i.useState(new G(0, 0, 0)), [S, P] = i.useState(10), [h, H] = i.useState(0), [g, C] = i.useState(45), [w, _] = i.useState(!1), [M, f] = i.useState("Universal Camera"), [N, x] = i.useState(new G(0, 1, -10)), [v, T] = i.useState("Free Camera"), [K, y] = i.useState(new G(0, 1, -10)), [O, U] = i.useState("Follow Camera"), [s, R] = i.useState(new G(0, 5, -10)), [o, z] = i.useState(10), [A, k] = i.useState(4), [E, q] = i.useState(0), [Y, he] = i.useState("Fly Camera"), [ee, pe] = i.useState(new G(0, 1, -10)), [ae, ge] = i.useState("Geospatial Camera"), [te, Ce] = i.useState(6371e3), X = (r) => {
    e.activeCamera || (e.activeCamera = r);
  }, _e = () => {
    const r = w ? h : h * Math.PI / 180, we = w ? g : g * Math.PI / 180, W = new Ve(t, r, we, S, l, e);
    return W.attachControl(e.getEngine().getRenderingCanvas(), !0), X(W), W;
  }, xe = () => {
    const r = new Ye(M, N, e);
    return r.attachControl(e.getEngine().getRenderingCanvas(), !0), X(r), r;
  }, Se = () => {
    const r = new Ze(v, K, e);
    return r.attachControl(e.getEngine().getRenderingCanvas(), !0), X(r), r;
  }, be = () => {
    const r = new We(O, s, e);
    return r.radius = o, r.heightOffset = A, r.rotationOffset = E, r.attachControl(!0), X(r), r;
  }, ve = () => {
    const r = new Je(Y, ee, e);
    return r.attachControl(!0), X(r), r;
  }, ye = () => {
    const r = new Qe(ae, e, { planetRadius: te });
    return r.attachControl(!0), X(r), r;
  };
  return a.jsxs(D, { children: [a.jsxs(b, { selectionService: n, label: "ArcRotate Camera", onCreate: () => _e(), children: [a.jsx(p, { label: "Name", value: t, onChange: (r) => j(r) }), a.jsx(B, { label: "Target", value: l, onChange: (r) => d(r) }), a.jsx(u, { label: "Radius", value: S, onChange: (r) => P(r), min: 0.1, max: 1e3, step: 0.5 }), a.jsx(u, { label: `Alpha ${w ? "(rad)" : "(deg)"}`, value: h, onChange: (r) => H(r), min: w ? -Math.PI * 2 : -360, max: w ? Math.PI * 2 : 360, step: w ? 0.1 : 5 }), a.jsx(u, { label: `Beta ${w ? "(rad)" : "(deg)"}`, value: g, onChange: (r) => C(r), min: 0, max: w ? Math.PI : 180, step: w ? 0.1 : 5 }), a.jsx(J, { label: "Use Radians", value: w, onChange: (r) => _(r) })] }), a.jsxs(b, { selectionService: n, label: "Universal Camera", onCreate: () => xe(), children: [a.jsx(p, { label: "Name", value: M, onChange: (r) => f(r) }), a.jsx(B, { label: "Position", value: N, onChange: (r) => x(r) })] }), a.jsxs(b, { selectionService: n, label: "Free Camera", onCreate: () => Se(), children: [a.jsx(p, { label: "Name", value: v, onChange: (r) => T(r) }), a.jsx(B, { label: "Position", value: K, onChange: (r) => y(r) })] }), a.jsxs(b, { selectionService: n, label: "Follow Camera", onCreate: () => be(), children: [a.jsx(p, { label: "Name", value: O, onChange: (r) => U(r) }), a.jsx(B, { label: "Position", value: s, onChange: (r) => R(r) }), a.jsx(u, { label: "Radius", value: o, onChange: (r) => z(r), min: 0.1, max: 1e3, step: 0.5 }), a.jsx(u, { label: "Height Offset", value: A, onChange: (r) => k(r), min: -100, max: 100, step: 0.5 }), a.jsx(u, { label: "Rotation Offset (deg)", value: E, onChange: (r) => q(r), min: -180, max: 180, step: 5 })] }), a.jsxs(b, { selectionService: n, label: "Fly Camera", onCreate: () => ve(), children: [a.jsx(p, { label: "Name", value: Y, onChange: (r) => he(r) }), a.jsx(B, { label: "Position", value: ee, onChange: (r) => pe(r) })] }), a.jsxs(b, { selectionService: n, label: "Geospatial Camera", onCreate: () => ye(), children: [a.jsx(p, { label: "Name", value: ae, onChange: (r) => ge(r) }), a.jsx(u, { label: "Planet Radius (m)", value: te, onChange: (r) => Ce(r), min: 1e3, max: 1e8, step: 1e3 })] })] });
}, _a = ({ scene: e, selectionService: n }) => {
  const [t, j] = i.useState("Particle System"), [l, d] = i.useState(2e3), [S, P] = i.useState("GPU Particle System"), [h, H] = i.useState(2e3), [g, C] = i.useState("Node Particle System"), [w, _] = i.useState(""), M = async () => await new Promise((x) => {
    setTimeout(() => {
      const v = new $e(t, l, e);
      v.particleTexture = new re("https://assets.babylonjs.com/textures/flare.png", e), v.start(), x(v);
    }, 0);
  }), f = async () => {
    if (!ie.IsSupported)
      throw alert("GPU Particle System is not supported."), new Error("GPU Particle System is not supported.");
    return await new Promise((x) => {
      setTimeout(() => {
        const v = new ie(S, { capacity: h }, e);
        v.particleTexture = new re("https://assets.babylonjs.com/textures/flare.png", e), v.start(), x(v);
      }, 0);
    });
  }, N = async () => {
    let x;
    const v = w.trim();
    v ? (x = await oe.ParseFromSnippetAsync(v), x.name = g) : x = oe.CreateDefault(g);
    const T = await x.buildAsync(e), K = T.systems;
    if (K.length === 0)
      throw new Error("No particle systems were produced by the node particle system.");
    for (const y of K)
      y.name = g;
    return T.start(), K[0];
  };
  return a.jsxs(D, { children: [a.jsxs(b, { selectionService: n, label: "CPU Particle System", onCreate: M, children: [a.jsx(p, { label: "Name", value: t, onChange: (x) => j(x) }), a.jsx(u, { label: "Capacity", value: l, onChange: (x) => d(x), min: 1, max: 1e5, step: 100 })] }), a.jsxs(b, { selectionService: n, label: "GPU Particle System", onCreate: f, children: [a.jsx(p, { label: "Name", value: S, onChange: (x) => P(x) }), a.jsx(u, { label: "Capacity", value: h, onChange: (x) => H(x), min: 1, max: 1e6, step: 1e3 })] }), a.jsxs(b, { selectionService: n, label: "Node Particle System", onCreate: N, children: [a.jsx(p, { label: "Name", value: g, onChange: (x) => C(x) }), a.jsx(p, { label: "Snippet ID", value: w, onChange: (x) => _(x) })] })] });
}, V = (e, n) => {
  const t = n.postProcessRenderPipelineManager.supportedPipelines, j = new Set(t.map((S) => S._name));
  if (!j.has(e))
    return e;
  let l = 1, d = `${e} ${l}`;
  for (; j.has(d); )
    l++, d = `${e} ${l}`;
  return d;
}, xa = ({ scene: e, selectionService: n }) => {
  const [t, j] = i.useState("Default rendering pipeline"), [l, d] = i.useState("SSAO rendering pipeline"), [S, P] = i.useState("SSAO2 rendering pipeline"), [h, H] = i.useState("SSR rendering pipeline"), [g, C] = i.useState("IBL Shadows rendering pipeline"), w = () => {
    const y = V(t, e);
    return new ea(y, !0, e, e.cameras);
  }, _ = () => {
    const y = V(l, e);
    return new aa(y, e, 1, e.cameras);
  }, M = () => {
    const y = V(S, e);
    return new ta(y, e, 1, e.cameras);
  }, f = () => {
    const y = V(h, e);
    return new na(y, e, e.cameras);
  }, N = () => {
    const y = V(g, e);
    return new sa(y, e, {}, e.cameras);
  }, x = e.getEngine().getCaps(), v = x.drawBuffersExtension, T = x.texelFetch, K = Me(e, "activeCamera");
  return a.jsx(D, { children: K ? a.jsxs(a.Fragment, { children: [a.jsx(b, { selectionService: n, label: "Default Pipeline", onCreate: () => w(), children: a.jsx(p, { label: "Name", value: t, onChange: (y) => j(y) }) }), a.jsx(b, { selectionService: n, label: "SSAO Pipeline", onCreate: () => _(), children: a.jsx(p, { label: "Name", value: l, onChange: (y) => d(y) }) }), v && a.jsx(b, { selectionService: n, label: "SSAO2 Pipeline", onCreate: () => M(), children: a.jsx(p, { label: "Name", value: S, onChange: (y) => P(y) }) }), v && T && a.jsx(b, { selectionService: n, label: "SSR Pipeline", onCreate: () => f(), children: a.jsx(p, { label: "Name", value: h, onChange: (y) => H(y) }) }), v && T && a.jsx(b, { selectionService: n, label: "IBL Shadows Pipeline", onCreate: () => N(), children: a.jsx(p, { label: "Name", value: g, onChange: (y) => C(y) }) })] }) : a.jsx(Ke, { message: "Cannot create rendering pipeline without an active camera.", title: "No active camera", intent: "info" }) });
};
function Sa(e, n) {
  let t = e, j = 1;
  for (; n.getFrameGraphByName(t); )
    t = e + " " + j++;
  return t;
}
const ba = ({ scene: e, selectionService: n }) => {
  const [t, j] = i.useState("Frame Graph"), l = () => {
    const d = Sa(t, e), S = new ra(d, e);
    return S.setToDefault(), S.buildAsync(), S.frameGraph;
  };
  return a.jsx(D, { children: a.jsx(b, { selectionService: n, label: "Frame Graph", onCreate: () => l(), children: a.jsx(p, { label: "Name", value: t, onChange: (d) => j(d) }) }) });
}, va = ({ scene: e, selectionService: n }) => {
  const [t, j] = i.useState("Sprite Manager"), [l, d] = i.useState(500), [S, P] = i.useState(64), [h, H] = i.useState("https://assets.babylonjs.com/textures/player.png"), g = () => new ia(t, h, l, S, e);
  return a.jsx(D, { children: a.jsxs(b, { selectionService: n, label: "Sprite Manager", onCreate: () => g(), children: [a.jsx(p, { label: "Name", value: t, onChange: (C) => j(C) }), a.jsx(p, { label: "Texture URL", value: h, onChange: (C) => H(C) }), a.jsx(u, { label: "Capacity", value: l, onChange: (C) => d(C), min: 1, max: 1e4, step: 100 }), a.jsx(u, { label: "Cell Size", value: S, onChange: (C) => P(C), min: 1, max: 1024, step: 1 })] }) });
}, de = {
  friendlyName: "Creation Tools",
  consumes: [Re, fe, Pe],
  factory: (e, n, t) => {
    const j = e.addSidePane({
      key: "Create",
      title: "Creation Tools",
      icon: oa,
      horizontalLocation: "left",
      verticalLocation: "top",
      content: () => {
        const l = Ne(() => n.currentScene, n.currentSceneObservable);
        return l && a.jsx(a.Fragment, { children: a.jsxs(He, { children: [a.jsx(I, { title: "Meshes", children: a.jsx(ha, { scene: l, selectionService: t }) }), a.jsx(I, { title: "Materials", children: a.jsx(pa, { scene: l, selectionService: t }) }), a.jsx(I, { title: "Lights", children: a.jsx(ga, { scene: l, selectionService: t }) }), a.jsx(I, { title: "Particles", children: a.jsx(_a, { scene: l, selectionService: t }) }), a.jsx(I, { title: "Cameras", children: a.jsx(Ca, { scene: l, selectionService: t }) }), a.jsx(I, { title: "Rendering Pipelines", children: a.jsx(xa, { scene: l, selectionService: t }) }), a.jsx(I, { title: "Frame Graphs", children: a.jsx(ba, { scene: l, selectionService: t }) }), a.jsx(I, { title: "Sprite Managers", children: a.jsx(va, { scene: l, selectionService: t }) })] }) });
      }
    });
    return {
      dispose: () => j.dispose()
    };
  }
};
var ya = {
  serviceDefinitions: [de]
};
const Ra = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  CreateToolsServiceDefinition: de,
  default: ya
}, Symbol.toStringTag, { value: "Module" }));
export {
  le as B,
  ce as O,
  me as S,
  la as a,
  Ra as q
};