1import{r as c,U as x,c as C,w as a,o as y,f as i,t as k,a as d,b as o,V as b,n as m,m as T}from"./app-DYrNw66O.js";import{_ as A}from"./DialogModal-Bu937B3E.js";import{_ as B}from"./TextInput-EhZxSRHF.js";import{_ as f}from"./PrimaryButton-DCSkRI35.js";import{_ as I}from"./InputError-zxDsJ2kL.js";import{_ as $}from"./SecondaryButton-CxEqQ1KF.js";import"./Modal-BQj-T0bB.js";const N={class:"flex gap-3 mt-4 items-center"},U={class:"w-full"},O={__name:"CreatePageTestVariant",props:{show:Boolean,pageTest:Object},emits:["created","cancelled"],setup(r,{emit:v}){const g=v,u=r,n=c(!1),l=c(""),e=x({suggested_content:"",error:"",processing:!1}),p=c(null),_=()=>{e.processing=!0,axios.post(route("page_test_variants.store"),{page_test_id:u.pageTest.id,suggested_content:e.suggested_content,is_ai_suggestion:e.suggested_content!==""&&e.suggested_content===l.value}).then(()=>{e.processing=!1,e.suggested_content="",l.value="",T().then(()=>g("created"))}).catch(s=>{var t;e.processing=!1,e.error=((t=s.response.data.errors)==null?void 0:t.suggested_content[0])??s.response.data.message,p.value.focus()})},h=()=>{n.value=!0,axios.post(route("page_test_variants.fetch-variant"),{page_test_id:u.pageTest.id}).then(s=>{n.value=!1,e.suggested_content=s.data.suggested_content,l.value=s.data.suggested_content}).catch(s=>{n.value=!1,e.error=s.response.data.message})},w=()=>{g("cancelled")};return(s,t)=>(y(),C(A,{show:r.show},{title:a(()=>[i(" Add new variant to "+k(r.pageTest.name),1)]),content:a(()=>[d("div",N,[d("div",U,[o(B,{ref_key:"suggestedContentInput",ref:p,modelValue:e.suggested_content,"onUpdate:modelValue":t[0]||(t[0]=V=>e.suggested_content=V),type:"text",class:"mt-1 block w-full",placeholder:"Suggested content",onKeyup:b(_,["enter"])},null,8,["modelValue"])]),o(f,{class:m(["!py-1 !h-10",{"opacity-25":n.value}]),disabled:n.value,onClick:h},{default:a(()=>t[1]||(t[1]=[d("span",{class:"text-nowrap"},"Use AI",-1)])),_:1},8,["class","disabled"])]),o(I,{message:e.error,class:"mt-2"},null,8,["message"])]),footer:a(()=>[o($,{onClick:w},{default:a(()=>t[2]||(t[2]=[i(" Cancel ")])),_:1}),o(f,{class:m(["ms-3",{"opacity-25":e.processing}]),disabled:e.processing,onClick:_},{default:a(()=>t[3]||(t[3]=[i(" Add Variant ")])),_:1},8,["class","disabled"])]),_:1},8,["show"]))}};export{O as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.