import { c as create_ssr_component, b as subscribe, g as getContext, v as validate_component } from "../../../../chunks/index-0e008fb3.js";
import { p as page } from "../../../../chunks/stores-9eb273d1.js";
import { E as Editor } from "../../../../chunks/editor-8f7742a9.js";
import { E as Error } from "../../../../chunks/error-b3674f8e.js";
import "lodash/get.js";
const Model = create_ssr_component(($$result, $$props, $$bindings, slots) => {
  let $$unsubscribe_activeConfigIndex;
  let $$unsubscribe_datastore;
  let $page, $$unsubscribe_page;
  let $models, $$unsubscribe_models;
  $$unsubscribe_page = subscribe(page, (value2) => $page = value2);
  const activeConfigIndex = getContext("stores").activeConfigIndex;
  $$unsubscribe_activeConfigIndex = subscribe(activeConfigIndex, (value2) => value2);
  const models = getContext("stores").models;
  $$unsubscribe_models = subscribe(models, (value2) => $models = value2);
  const datastore = getContext("stores").activeClient;
  $$unsubscribe_datastore = subscribe(datastore, (value2) => value2);
  getContext("services");
  let value;
  let error;
  let model;
  async function getValue(model2) {
    if (!model2) {
      return;
    }
    setValue(model2);
  }
  function setValue(entity) {
    value = JSON.stringify(entity, null, 2);
  }
  let $$settled;
  let $$rendered;
  do {
    $$settled = true;
    {
      if (!model) {
        model = $models[$page.params.model];
      }
    }
    !value && getValue(model);
    $$rendered = `${model ? `<div class="${"flex flex-column h-screen"}" style="${"background-color: #272822;"}"><div class="${"w-8/12 border-r-2"}" style="${"border-color: #171812;"}"><div class="${"w-full h-4/6"}">${validate_component(Editor, "Editor").$$render($$result, { language: "json", value }, {
      value: ($$value) => {
        value = $$value;
        $$settled = false;
      }
    }, {})}</div>

		<div class="${"w-full h-2/6 border-t-2"}" style="${"border-color: #171812;"}">${validate_component(Error, "Error").$$render($$result, { error }, {}, {})}</div></div></div>` : ``}`;
  } while (!$$settled);
  $$unsubscribe_activeConfigIndex();
  $$unsubscribe_datastore();
  $$unsubscribe_page();
  $$unsubscribe_models();
  return $$rendered;
});
export { Model as default };
