import { defineComponent, ref, computed, mergeProps, unref, useSSRContext } from 'vue';
import { ssrRenderAttrs, ssrInterpolate, ssrRenderAttr, ssrIncludeBooleanAttr, ssrRenderList, ssrRenderClass } from 'vue/server-renderer';
import { u as useNotification } from './useNotification-BqDqaGnC.mjs';
import { _ as _export_sfc, a as useHead } from './server.mjs';
import '../nitro/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:crypto';
import 'stream';
import 'events';
import 'http';
import 'crypto';
import 'buffer';
import 'zlib';
import 'https';
import 'net';
import 'tls';
import 'url';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'vue-router';
import '@prisma/client';
import '@prisma/adapter-better-sqlite3';
import 'fs';
import 'path';
import 'fs/promises';
import 'child_process';
import 'node:child_process';
import 'node:url';
import '../routes/renderer.mjs';
import 'vue-bundle-renderer/runtime';
import 'unhead/server';
import 'devalue';
import 'unhead/utils';

const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "autocreate",
  __ssrInlineRender: true,
  setup(__props) {
    useNotification();
    const prompt = ref("");
    const generating = ref(false);
    const applying = ref(false);
    const streamingContent = ref("");
    ref(null);
    const proposals = ref([]);
    const selectedProposals = ref([]);
    const results = ref([]);
    const error = ref("");
    const allSelected = computed(
      () => proposals.value.length > 0 && selectedProposals.value.length === proposals.value.length
    );
    useHead({
      title: "Autocreate - AutoCode"
    });
    return (_ctx, _push, _parent, _attrs) => {
      _push(`<div${ssrRenderAttrs(mergeProps({ class: "autocreate-page" }, _attrs))} data-v-8a41c3ab><header class="page-header" data-v-8a41c3ab><h1 data-v-8a41c3ab>${ssrInterpolate(_ctx.$t("autocreate.title"))}</h1><p class="page-description" data-v-8a41c3ab>${ssrInterpolate(_ctx.$t("autocreate.description"))}</p></header><div class="card input-section" data-v-8a41c3ab><div class="form-group" data-v-8a41c3ab><label class="form-label" for="prompt" data-v-8a41c3ab>${ssrInterpolate(_ctx.$t("autocreate.prompt"))}</label><textarea id="prompt" class="form-input" rows="4"${ssrRenderAttr("placeholder", _ctx.$t("autocreate.promptPlaceholder"))} data-v-8a41c3ab>${ssrInterpolate(unref(prompt))}</textarea></div><button class="btn btn-primary"${ssrIncludeBooleanAttr(!unref(prompt).trim() || unref(generating)) ? " disabled" : ""} data-v-8a41c3ab>${ssrInterpolate(unref(generating) ? _ctx.$t("autocreate.generating") : _ctx.$t("autocreate.generate"))}</button></div>`);
      if (unref(streamingContent) || unref(generating)) {
        _push(`<div class="card streaming-section" data-v-8a41c3ab><h2 data-v-8a41c3ab>${ssrInterpolate(_ctx.$t("autocreate.thinking"))}</h2><div class="streaming-output" data-v-8a41c3ab>${ssrInterpolate(unref(streamingContent))} `);
        if (unref(generating)) {
          _push(`<span class="cursor" data-v-8a41c3ab>▊</span>`);
        } else {
          _push(`<!---->`);
        }
        _push(`</div></div>`);
      } else {
        _push(`<!---->`);
      }
      if (unref(error)) {
        _push(`<div class="card error-section" data-v-8a41c3ab><p class="error-text" data-v-8a41c3ab>${ssrInterpolate(unref(error))}</p><button class="btn btn-secondary" data-v-8a41c3ab>${ssrInterpolate(_ctx.$t("form.dismiss"))}</button></div>`);
      } else {
        _push(`<!---->`);
      }
      if (unref(proposals).length) {
        _push(`<div class="proposals-section" data-v-8a41c3ab><h2 data-v-8a41c3ab>${ssrInterpolate(_ctx.$t("autocreate.proposals"))}</h2><div class="proposals-grid" data-v-8a41c3ab><!--[-->`);
        ssrRenderList(unref(proposals), (proposal, index) => {
          _push(`<div class="${ssrRenderClass([{ selected: unref(selectedProposals).includes(index) }, "proposal-card card"])}" data-v-8a41c3ab><div class="proposal-header" data-v-8a41c3ab><input type="checkbox"${ssrIncludeBooleanAttr(unref(selectedProposals).includes(index)) ? " checked" : ""} data-v-8a41c3ab><h3 data-v-8a41c3ab>${ssrInterpolate(proposal.name)}</h3></div><p class="proposal-description" data-v-8a41c3ab>${ssrInterpolate(proposal.description)}</p><div class="proposal-meta" data-v-8a41c3ab><span class="badge" data-v-8a41c3ab>${ssrInterpolate(proposal.type)}</span></div></div>`);
        });
        _push(`<!--]--></div><div class="proposals-actions" data-v-8a41c3ab><button class="btn btn-secondary" data-v-8a41c3ab>${ssrInterpolate(unref(allSelected) ? _ctx.$t("autocreate.deselectAll") : _ctx.$t("autocreate.selectAll"))}</button><button class="btn btn-primary"${ssrIncludeBooleanAttr(!unref(selectedProposals).length || unref(applying)) ? " disabled" : ""} data-v-8a41c3ab>${ssrInterpolate(unref(applying) ? _ctx.$t("autocreate.applying") : _ctx.$t("autocreate.apply"))} (${ssrInterpolate(unref(selectedProposals).length)}) </button></div></div>`);
      } else {
        _push(`<!---->`);
      }
      if (unref(results).length) {
        _push(`<div class="card results-section" data-v-8a41c3ab><h2 data-v-8a41c3ab>${ssrInterpolate(_ctx.$t("autocreate.results"))}</h2><ul class="results-list" data-v-8a41c3ab><!--[-->`);
        ssrRenderList(unref(results), (result, index) => {
          _push(`<li class="${ssrRenderClass({ success: result.success, error: !result.success })}" data-v-8a41c3ab><span class="result-icon" data-v-8a41c3ab>${ssrInterpolate(result.success ? "✓" : "✗")}</span><span class="result-name" data-v-8a41c3ab>${ssrInterpolate(result.name)}</span>`);
          if (result.error) {
            _push(`<span class="result-error" data-v-8a41c3ab>${ssrInterpolate(result.error)}</span>`);
          } else {
            _push(`<!---->`);
          }
          _push(`</li>`);
        });
        _push(`<!--]--></ul></div>`);
      } else {
        _push(`<!---->`);
      }
      _push(`</div>`);
    };
  }
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/autocreate.vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
const autocreate = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-8a41c3ab"]]);

export { autocreate as default };
//# sourceMappingURL=autocreate-DrAjWR5B.mjs.map
