import { k as r } from "./antd-2abdded3.js";
import { e2 as e, V as t, cU as o, e3 as i, e4 as s, e5 as a, e6 as p, e7 as m, e8 as n, e9 as c, ea as l } from "./index-f927b013.js";
import { useRef as d, useMemo as j, useEffect as u } from "react";
import { lI as h, lz as f } from "./ant-design-icons-6bfdc7d5.js";
import "react-dom";
import "./dayjs-2035e031.js";
import "./alasql-f60045ee.js";
import "./lodash-b5661970.js";
import "./axios-04f95181.js";
import "./redux-devtools-8dd21e4f.js";
import "./fontawesome-3904a214.js";
import "./dnd-kit-8227a2db.js";
import "./moment-059406e8.js";
import "./styled-components-7cfa37e6.js";
import "./numbro-47982265.js";
import "./papaparse-07642d76.js";
import "./uuid-bd83cae2.js";
import "./supabase-b2e314d0.js";
import "./fetch-648a91f6.js";
import "./react-draggable-ed505bfc.js";
import "./remark-gfm-18306abe.js";
import "./buffer-d3713d77.js";
import "./rehype-raw-6ebcba88.js";
import "./parse5-f837f753.js";
import "./rehype-sanitize-953d0761.js";
import "./simplebar-react-2133d981.js";
import "./react-best-gradient-color-picker-92c01739.js";
import "./ua-parser-js-c952c07b.js";
import "./clsx-469c2c43.js";
import "./loglevel-b4003767.js";
import "./file-saver-55285fc1.js";
import "./codemirror-8412b963.js";
import "./really-relaxed-json-056be70b.js";
import "./immer-c0428a8d.js";
import "./hotkeys-js-699906bc.js";
import "./cnchar-e1339167.js";
import "./react-documents-041601c7.js";
import "./react-sortable-hoc-4fbe0c32.js";
import "./sql-formatter-577b4ab0.js";
import "./rc-trigger-3f038851.js";
import "./react-json-view-5330ce92.js";
import "./qrcode-react-d377d762.js";
const g = e();
function y(e2) {
  const { dsl: y2, moduleDsl: V, appId: b, moduleInputs: v, onCompChange: x, onModuleEventTriggered: I } = e2, w = d(I);
  w.current = I;
  const E = j(() => ({ Comp: t, initialValue: y2, reduceContext: { readOnly: true, applicationId: b, parentApplicationPath: [], moduleDSL: V || {} }, initHandler: (r2) => r2.preload(`app-${b}`), actionPreInterceptor: (r2) => {
    var _a;
    return r2.type !== o.TRIGGER_MODULE_EVENT || ((_a = w.current) == null ? void 0 : _a.call(w, r2.name), false);
  } }), [b]), [k] = i(E);
  return u(() => {
    x == null ? void 0 : x(k);
  }, [k]), u(() => {
    const r2 = k == null ? void 0 : k.children.ui.getModuleLayoutComp();
    if (!r2 || !v)
      return;
    r2.children.io.children.inputs.getView().forEach((r3) => {
      const { name: e3 } = r3.getView(), t2 = v[e3];
      void 0 !== t2 && r3.children.defaultValue.children.comp.dispatch(s(r3.children.defaultValue.children.comp.changeValueAction(t2)));
    });
  }, [v]), h(r, { children: [f(a, {}), f(p, { store: m, children: f(n.Provider, { value: { applicationId: b, appType: 1, readOnly: true, hideHeader: true }, children: f(c, { history: g, children: f(l, { path: "/", render: () => k == null ? void 0 : k.getView() }) }) }) })] });
}
export {
  y as AppView
};
