import{d as f,i as x,o as v,h as i,j as d,R as w,U as y,l as p,n as V,g as B,Z as C,v as m,a2 as u,r as D,f as _,J as $,c as k,z as K,a1 as P,m as z}from"./index-DPl1iiyq.js";import{Z as A,bl as E}from"./navigation-BzNQiq4W.js";const M={class:"flex gap-2"},N={class:"flex max-h-8 flex-1"},U=f({__name:"CommandActionForm",props:{loading:{},disabled:{type:Boolean,default:!1}},emits:["submit","cancel","back"],setup(c){const{cx:s}=A();return(t,a)=>(v(),x("form",{class:"flex w-full flex-col gap-3",onKeydown:a[0]||(a[0]=u(m(()=>{},["stop"]),["enter"])),onSubmit:a[1]||(a[1]=m(n=>t.$emit("submit"),["prevent","stop"]))},[i("div",w(y(p(s)("relative flex min-h-20 flex-col rounded"))),[d(t.$slots,"default")],16),i("div",M,[i("div",N,[d(t.$slots,"options")]),V(p(E),{class:"max-h-8 p-0 px-3 text-xs",disabled:t.disabled,loading:t.loading,type:"submit"},{default:B(()=>[d(t.$slots,"submit",{},()=>[a[2]||(a[2]=C("Continue"))])]),_:3},8,["disabled","loading"])])],32))}}),T=["placeholder"],Z=f({inheritAttrs:!1,__name:"CommandActionInput",props:{modelValue:{},placeholder:{},autofocus:{type:Boolean}},emits:["update:modelValue","onDelete"],setup(c,{emit:s}){const t=c,a=s,n=D(null);_(()=>$(()=>{var e;t.autofocus||(e=n.value)==null||e.focus()}));const r=k({get:()=>t.modelValue??"",set:e=>a("update:modelValue",e)});function h(e){var o;if(e.shiftKey||!e.target)return;e.preventDefault();const l=e.target,g=new Event("submit",{cancelable:!0});(o=l.form)==null||o.dispatchEvent(g)}function b(e){r.value===""&&(e.preventDefault(),e.stopPropagation(),a("onDelete",e))}return(e,o)=>K((v(),x("textarea",z({id:"command-action-input",ref_key:"input",ref:n,"onUpdate:modelValue":o[0]||(o[0]=l=>r.value=l),class:"min-h-8 w-full flex-1 resize-none border border-transparent py-1.5 pl-8.5 text-sm outline-none focus:border-b-1",placeholder:t.placeholder??"",wrap:"hard"},e.$attrs,{onKeydown:[o[1]||(o[1]=u(l=>b(l),["delete"])),o[2]||(o[2]=u(l=>h(l),["enter"]))]}),null,16,T)),[[P,r.value]])}});export{Z as V,U as h};
