1import{aP as re,c as j,o as l,w as r,b as a,B as de,h as x,_ as U,X as ue,ac as A,r as y,a1 as N,I as L,bv as _e,A as X,x as V,K as f,bo as xe,d as e,f as t,ba as ke,aX as ae,l as Ce,aT as Z,b9 as ee,t as _,m as P,a5 as ce,F as C,M as T,Q as H,b0 as ne,W as pe,bw as je,a3 as te,a4 as R,z as me,bx as $e,v as B,by as Ve,bz as le,bA as We,J as q,a9 as F,C as fe,aW as Se,bB as ze,e as Ie,U as Pe,bb as se,bC as ye,bD as ve,aD as Q,a2 as Te,bE as he,ad as O,u as be,bF as De,bG as Ae,a6 as Ee,a as Le,aZ as Me,y as Re}from"./index-Gf3RWEu2.js";import{_ as He}from"./PageWrapper-Bn6Mx0ZG.js";import{V as G,b as Ne}from"./VChip-DjhLPIJL.js";import{g as ge,_ as Ue}from"./CollectionFormDialog-Df8OVodv.js";import{V as we}from"./VEmptyState-_5yAY894.js";import{V as Be}from"./VPagination-Bg2OvNs6.js";import{a as ie,V as Fe}from"./VWindowItem-CnYAYcqk.js";import"./Errors-DZ_88x00.js";import"./VAlert-BiSxpy8A.js";import"./VSelect-BAoT9eTW.js";function Ke($,s){var p,m;const i=s.value,n={passive:!((p=s.modifiers)!=null&&p.active)};window.addEventListener("resize",i,n),$._onResize=Object($._onResize),$._onResize[s.instance.$.uid]={handler:i,options:n},(m=s.modifiers)!=null&&m.quiet||i()}function qe($,s){var p;if(!((p=$._onResize)!=null&&p[s.instance.$.uid]))return;const{handler:i,options:n}=$._onResize[s.instance.$.uid];window.removeEventListener("resize",i,n),delete $._onResize[s.instance.$.uid]}const Oe={mounted:Ke,unmounted:qe},Ge={};function Xe($,s){return l(),j(ue,{"max-width":"600"},{activator:r(({props:i})=>[a(x,U({icon:"mdi-information-box-outline"},i),null,16)]),default:r(()=>[a(de,{title:"Watson Assistant",subtitle:"Draft Context"})]),_:1})}const Ye=re(Ge,[["render",Xe]]),Je={class:"text-end pa-2"},Qe={key:0,class:"empty-messages-placeholder text-center d-flex position-fixed top-0 left-0 right-0 bottom-0 pa-4"},Ze={class:"my-auto w-100"},et=["textContent"],tt={key:0,class:"mt-4"},st={class:"mt-4"},ot={key:1},at={class:"message-content"},nt={class:"text-caption text-end caption opacity-60"},lt={key:0},it={key:1},rt={__name:"WatsonChatWindow",setup($){const s=A("watson"),i=y(),n=y(!1),p=y(!1),m=y(""),u=y(),c=N("toolbar"),o=N("messagesContainer"),d=N("inputContainer"),b=N("inputField"),g=L.throttle(()=>{W()},50);let M=0,D=0;_e(o,()=>{const k=o.value.closest(".v-navigation-drawer__content");k.scrollTop+k.clientHeight>=k.scrollHeight-50&&w()}),X(async()=>{i.value=(await I(s.thread.subject_type)).data.prompts,W(),b.value.focus(),w()});async function z(k){if(p.value)return!1;p.value=!0,n.value=!0;const h=M++,v=D++,Y={key:v,_tempId:h,content:k,role:"user",created_at:"now"};s.thread.messages.push(Y);const oe=L.findIndex(s.thread.messages,{_tempId:h});le(w),m.value="",u.value=void 0;try{const{data:S}=await V.post(`watson/threads/${s.thread.id}/message`,{message:k});p.value=!1;const K=S.received.content;S.sent.key=v,S.received.key=D++,S.received.content=y(""),s.thread.messages.splice(oe,1,S.sent),s.thread.messages.push(S.received),le(w);for(let J=0;J<K.length;J++)S.received.content.value+=K[J],await We(7)}catch(S){if(S.response){let K=L.findIndex(s.thread.messages,{_tempId:h});s.thread.messages.splice(K,1)}u.value=S,console.error(S),s.thread.messages.splice(oe,1),p.value=!1}finally{n.value=!1,b.value.focus()}}function E(k){k.shiftKey||(k.preventDefault(),z(m.value))}function w(){const k=o.value.closest(".v-navigation-drawer__content");k.scrollTop=k.scrollHeight}function I(k){return V.get("watson/prompts",{params:{subject_type:k}})}function W(){o.value.style.minHeight=window.innerHeight-c.value.$el.clientHeight-d.value.clientHeight+"px"}return(k,h)=>(l(),f(T,null,[xe((l(),j(ee,{title:t(s).title,class:"border-b-thin position-sticky top-0",color:"surface",style:{"z-index":"1"},ref_key:"toolbar",ref:c},ke({default:r(()=>[a(Z,null,{default:r(()=>[a(Ye),a(x,{"prepend-icon":"mdi-refresh",text:"New Chat",onClick:h[1]||(h[1]=v=>t(s).thread=null)}),a(x,{icon:"mdi-close",onClick:h[2]||(h[2]=v=>t(s).opened=!1)})]),_:1})]),_:2},[t(s).thread.created_at<t(s).subject.updated_at?{name:"prepend",fn:r(()=>[a(ae,{location:"bottom start","open-on-hover":"","close-on-content-click":"","open-delay":"0"},{activator:r(({props:v})=>[a(G,U(v,{text:"stale",color:"warning",variant:"tonal",rounded:"",size:"small",style:{cursor:"default"}}),null,16)]),default:r(()=>[a(Ce,{"max-width":"300"},{default:r(()=>[h[5]||(h[5]=e("div",{class:"text-body-2 pa-3 pb-0"},"Content has been updated since conversation start. To send Watson the latest content, start a new chat.",-1)),e("div",Je,[a(x,{text:"New Chat",size:"small",color:"secondary",onClick:h[0]||(h[0]=v=>t(s).thread=null)})])]),_:1})]),_:1})]),key:"0"}:void 0]),1032,["title"])),[[Oe,t(g)]]),e("div",{class:"pa-4 position-relative",ref_key:"messagesContainer",ref:o},[t(s).thread.messages.length===0?(l(),f("div",Qe,[e("div",Ze,[a(ce,{"x-large":"",color:"grey lighten-1"},{default:r(()=>h[6]||(h[6]=[P("mdi-robot")])),_:1}),e("p",{class:"mt-4",textContent:C(t(s).placeholderMessage)},null,8,et),t(i)&&t(i).length>0?(l(),f("div",tt,[h[7]||(h[7]=e("p",null,"The question involves...",-1)),e("div",st,[(l(!0),f(T,null,H(t(i),v=>(l(),j(x,{text:v.topic,onClick:Y=>z(v.questions),size:"small",class:"ma-1",variant:"outlined"},null,8,["text","onClick"]))),256))])])):_("",!0)])])):(l(),f("div",ot,[a(je,{group:""},{default:r(()=>[(l(!0),f(T,null,H(t(s).thread.messages,v=>(l(),f("div",{class:ne(["message-bubble mb-4 pa-2",`${v.role}-message`]),key:v.key},[e("p",{class:ne(["text-body-2 text-secondary",v.role==="user"?"text-end":""])},C(v.role==="user"?"You":"Watson"),3),e("div",at,C(v.content),1),e("div",nt,[v.created_at==="now"?(l(),f("span",lt,"now")):(l(),f("span",it,C(t(pe)(v.created_at).format("LLL")),1))])],2))),128))]),_:1})]))],512),e("div",{class:"border-t-thin pb-2 position-sticky bottom-0 bg-surface",style:{"z-index":"1"},ref_key:"inputContainer",ref:d},[h[8]||(h[8]=e("div",{class:"text-caption text-end opacity-50 px-4"},[e("kbd",null,"Shift"),P(" + "),e("kbd",null,"Enter"),P(" for new line ")],-1)),a(Ve,{modelValue:t(m),"onUpdate:modelValue":h[4]||(h[4]=v=>B(m)?m.value=v:null),rows:"1","max-rows":"5",placeholder:"Ask about your story...",loading:t(p),disabled:t(n),"auto-grow":"",counter:"",maxlength:"500",onKeydown:$e(E,["enter"]),messages:"","error-messages":t(me)(t(u)),ref_key:"inputField",ref:b,"data-testid":"watson-chat-input"},{"prepend-inner":r(()=>[a(ae,{"open-on-hover":"","open-on-click":"",location:"top start"},{activator:r(({props:v})=>[a(x,U({icon:"mdi-auto-fix",size:"small",variant:"plain"},v),null,16)]),default:r(()=>[a(te,null,{default:r(()=>[(l(!0),f(T,null,H(t(i),v=>(l(),j(R,{title:v.topic,onClick:Y=>z(v.questions)},null,8,["title","onClick"]))),256))]),_:1})]),_:1})]),"append-inner":r(()=>
1[a(x,{color:"secondary","prepend-icon":"mdi-send-circle",text:"Send",onClick:h[3]||(h[3]=v=>z(t(m))),"data-testid":"send-watson-message-button"})]),_:1},8,["modelValue","loading","disabled","error-messages"])],512)],64))}},dt={key:1},ut={class:"pa-4 d-flex align-center"},ct={__name:"WatsonPreviousChatsDialog",emits:["open-thread"],setup($,{emit:s}){A("store");const i=A("watson"),n=y(!1),p=q(()=>{switch(i.payload.type){case"project":return`Previous Chats for Project "${i.subject.name}"`;case"draft":return`Previous Chats for Draft "${i.subject.name}"`;case"chapter":return`Previous Chats for Chapter "${i.subject.title||"Chapter "+(i.subject.index+1)}"`}}),m=y(),u=y(1);F(u,()=>{c()});async function c(){await i.setSubject(),m.value=(await V.get("watson/threads",{params:{type:i.payload.type,subject_id:i.subject.id,page:u.value}})).data.threads}function o(d){n.value=!1,i.thread=d}return(d,b)=>(l(),j(ue,{modelValue:t(n),"onUpdate:modelValue":b[2]||(b[2]=g=>B(n)?n.value=g:null),"max-width":"600",onAfterEnter:c},{activator:r(({props:g})=>[ze(d.$slots,"activator",{props:g})]),default:r(()=>[a(de,null,{default:r(()=>[a(ee,{title:t(p)},{default:r(()=>[a(Z,null,{default:r(()=>[a(x,{icon:"mdi-close",onClick:b[0]||(b[0]=g=>n.value=!1)})]),_:1})]),_:1},8,["title"]),a(fe),t(m)&&t(m).data.length===0?(l(),j(we,{key:0,title:"No previous conversations..."})):_("",!0),t(m)&&t(m).data.length>0?(l(),f("div",dt,[a(te,{lines:"two"},{default:r(()=>[(l(!0),f(T,null,H(t(m).data,g=>(l(),j(R,{title:g.chat_name,onClick:M=>o(g)},{append:r(()=>[g.created_at<t(i).subject.updated_at?(l(),j(G,{key:0,text:"stale",rounded:"",color:"warning",variant:"tonal",class:"opacity-70"})):_("",!0)]),default:r(()=>[a(Se,null,{default:r(()=>[P(C(g.messages.length)+" Messages - Started "+C(t(pe)(g.created_at).fromNow()),1)]),_:2},1024)]),_:2},1032,["title","onClick"]))),256))]),_:1}),a(Be,{modelValue:t(u),"onUpdate:modelValue":b[1]||(b[1]=g=>B(u)?u.value=g:null),length:t(m).last_page,rounded:"circle",size:"small"},null,8,["modelValue","length"]),e("div",ut,[a(G,{text:"stale",rounded:"",color:"warning",variant:"tonal",class:"opacity-70"}),b[3]||(b[3]=e("div",{class:"text-body-2 ps-4 opacity-70"},"Means that the content has been updated since the conversation started.",-1))])])):_("",!0)]),_:1})]),_:3},8,["modelValue"]))}},pt={key:0},mt={class:"text-h6 font-weight-regular mb-4"},ft={key:1},yt={class:"text-h6 font-weight-regular mb-4"},vt={key:2},ht={class:"text-h6 font-weight-regular mb-4"},bt={key:3},gt={class:"text-body-2 pfs-list"},wt={key:4},_t={class:"text-subtitle-2 mt-4"},xt={key:5,class:"mt-8"},kt={key:0,class:"text-body-2 opacity-70"},Ct={key:0},jt={class:"text-caption ms-1 text-disabled"},$t={class:"mt-8"},Vt={key:0},Wt={key:1},St={class:"pfs-list text-body-2"},zt={key:0,"data-testid":"token-estimate"},It={class:"mt-8"},Pt={__name:"WatsonSetup",props:["title","draft"],setup($){const s=A("project"),i=y(0);A("store");const n=A("watson"),p=y(),m=y(),u=y();return X(async()=>{p.value=(await ge(s.value)).data.collections}),F(i,()=>{i.value===1&&(u.value=null,n.getContextEstimate().then(({data:c})=>{m.value=c}).catch(c=>{u.value=c}))}),(c,o)=>(l(),f(T,null,[a(ee,{title:t(n).title,class:"position-sticky top-0 border-b-thin",color:"surface",style:{"z-index":"1"}},{default:r(()=>[a(Z,null,{default:r(()=>[a(x,{icon:"mdi-close",onClick:o[0]||(o[0]=d=>t(n).opened=!1)})]),_:1})]),_:1},8,["title"]),a(Fe,{modelValue:t(i),"onUpdate:modelValue":o[7]||(o[7]=d=>B(i)?i.value=d:null),class:"my-auto"},{default:r(()=>[a(ie,{class:"pa-4"},{default:r(()=>[t(n).payload.type==="project"?(l(),f("div",pt,[e("h6",mt,'Project Context: "'+C(t(n).subject.name)+'"',1),o[8]||(o[8]=e("p",{class:"text-subtitle-2 mt-4"},"How it works",-1)),o[9]||(o[9]=e("ul",{class:"text-body-2 pfs-list"},[e("li",null,[P(" In the Project Context, Watson is sent your: "),e("ul",{class:"pfs-list"},[e("li",null,"Project name & description"),e("li",null,"Story titles & descriptions"),e("li",null,"Selected collections (with items) titles & descriptions")])]),e("li",null,"Watson will use these to make recommendations on story ideas and potential world building elements"),e("li",null,"Sending Watson more data (context) to process results in higher token usage"),e("li",null,"Watson does not remember conversations between chats"),e("li",null,"If any update is made to this project, any existing conversations for this chapter will be considered stale with outdated data.")],-1))])):_("",!0),t(n).payload.type==="collection"?(l(),f("div",ft,[e("h6",yt,'Collection Context: "'+C(t(n).subject.label_pluralized)+'"',1),o[10]||(o[10]=e("p",{class:"text-subtitle-2 mt-4"},"How it works",-1)),o[11]||(o[11]=e("ul",{class:"text-body-2 pfs-list"},[e("li",null,[P(" In the Collection Context, Watson is sent your: "),e("ul",{class:"pfs-list"},[e("li",null,"Project name & description"),e("li",null,"Story titles & descriptions"),e("li",null,"This collection title & description"),e("li",null,"This collection's item names & descriptions")])]),e("li",null,"Sending Watson more data (context) to process results in higher token usage"),e("li",null,"Watson does not remember conversations between chats"),e("li",null,"If any update is made to this collection, any existing conversations for this chapter will be considered stale with outdated data.")],-1))])):_("",!0),t(n).payload.type==="collection-item"?(l(),f("div",vt,[e("h6",ht,'Collection Item Context: "'+C(t(n).subject.collection.label_singular)+" - "+C(t(n).subject.name)+'"',1),o[12]||(o[12]=e("p",{class:"text-subtitle-2 mt-4"},"How it works",-1)),o[13]||(o[13]=e("ul",{class:"text-body-2 pfs-list"},[e("li",null,[P(" In the Collection Item Context, Watson is sent your: "),e("ul",{class:"pfs-list"},[e("li",null,"Project name & description"),e("li",null,"Story titles & descriptions"),e("li",null,"This collection title & description"),e("li",null,"This item's name & description")])]),e("li",null,"Sending Watson more data (context) to process results in higher token usage"),e("li",null,"Watson does not remember conversations between chats"),e("li",null,"If any update is made to this collection, any existing conversations for this chapter will be considered stale with outdated data.")],-1))])):_("",!0),t(n).payload.type==="draft"?(l(),f("div",bt,[o[19]||(o[19]=e("h6",{class:"text-h6 font-weight-regular mb-4"},"Comprehensive Draft Analysis & Feedback",-1)),o[20]||(o[20]=e("p",{class:"text-subtitle-2 mt-4"},"How it works",-1)),e("ul",gt,[o[15]||(o[15]=e("li",null,"A snapshot of your current draft and collections (that you may select below) is made to send to Watson",-1)),o[16]||(o[16]=e("li",null,"Sending Watson more data (context) to process results in higher token usage",-1)),e("li",null,[o[14]||(o[14]=P("If you would like a more focused analysis, you can use the ")),e("a",{href:"",onClick:o[1]||(o[1]=Ie(()=>{},["prevent"])),class:"opacity-70"},"chapter context assistant")]),o[17]||(o[17]=e("li",null,"Watson does not remember conversations between chats",-1)),o[18]||(o[18]=e("li",null,"If any update is made to this draft, any existing conversations for this chapter will be considered stale with outdated data.",-1))])])):_("",!0),t(n).payload.type==="chapter"?(l(),f("div",wt,[o[21]||(o[21]=e("h6",{class:"text-h6 font-weight-regular mb-4"},"Chapter Analysis & Feedback",-1)),e("p",_t," Context: "+C(t(n).subject.title||`Chapter ${t(n).subject.index+1}`)+" ("+C(t(L.sum)(t(n).subject.scenes.map(d=>
1d.word_count)).toLocaleString())+" words) ",1),o[22]||(o[22]=e("p",{class:"text-subtitle-2 mt-4"},"How it works",-1)),o[23]||(o[23]=e("ul",{class:"text-body-2 pfs-list"},[e("li",null,"A snapshot of your current chapter and collections (that you may select below) is made to send to Watson"),e("li",null,"Sending Watson more data (context) to process results in higher token usage"),e("li",null,"If you make changes to your chapter/scenes, you must start a new chat to send Watson a new snapshot"),e("li",null,"Watson does not remember conversations between chats"),e("li",null,"If any update is made to this chapter and scenes, any existing conversations for this chapter will be considered stale with outdated data.")],-1))])):_("",!0),["project","draft","chapter"].includes(t(n).payload.type)?(l(),f("div",xt,[o[25]||(o[25]=e("p",{class:"text-subtitle-2"},"Include Collections in Analysis:",-1)),t(p)&&t(p).length===0?(l(),f("div",kt,[o[24]||(o[24]=e("p",null,"No collections yet...",-1)),t(n).payload.type==="project"?(l(),f("p",Ct,"You can ask Watson to recommend collection ideas.")):_("",!0)])):_("",!0),t(p)&&t(p).length>0?(l(),j(Ne,{key:1,modelValue:t(n).selectedCollections,"onUpdate:modelValue":o[2]||(o[2]=d=>t(n).selectedCollections=d),multiple:"",column:"","selected-class":"bg-secondary"},{default:r(()=>[(l(!0),f(T,null,H(t(p),d=>(l(),j(G,{rounded:"",value:d.id,density:"compact"},{default:r(()=>[P(C(d.label_pluralized)+" ",1),e("span",jt,"("+C(d.items_count)+")",1)]),_:2},1032,["value"]))),256))]),_:1},8,["modelValue"])):_("",!0)])):_("",!0),e("div",$t,[a(x,{text:"Close",onClick:o[3]||(o[3]=d=>t(n).opened=!1)}),a(ct,null,{activator:r(({props:d})=>[a(x,U({class:"ms-4",text:"Previous Chats"},d),null,16)]),_:1}),a(x,{text:"Continue","append-icon":"mdi-arrow-right",color:"secondary",rounded:"",onClick:o[4]||(o[4]=d=>i.value++),class:"ms-4"})])]),_:1}),a(ie,{class:"pa-4 py-8"},{default:r(()=>[t(u)?(l(),f("div",Vt,[a(we,{title:t(me)(t(u))},{media:r(()=>[a(ce,{icon:"mdi-alert-circle-outline",style:{"font-size":"50px"}})]),actions:r(()=>[a(x,{text:"Upgrade",to:{name:"AccountIndex",params:{slug:"billing"}}}),a(x,{text:"Close",color:"",onClick:o[5]||(o[5]=d=>t(n).opened=!1)})]),_:1},8,["title"])])):(l(),f("div",Wt,[e("ul",St,[e("li",null,[o[26]||(o[26]=P(" Estimated token usage for initial message: ")),t(m)?(l(),f("b",zt,C(t(m).input_tokens.toLocaleString())+" tokens",1)):_("",!0)]),o[27]||(o[27]=e("li",null,"Actual usage may be slightly higher than estimate",-1))]),e("div",It,[a(x,{text:"Back",onClick:o[6]||(o[6]=d=>i.value--)}),a(x,{text:"Continue To Chat","append-icon":"mdi-arrow-right",color:"secondary",onClick:t(n).startThread,rounded:"",class:"ms-4"},null,8,["onClick"])])]))]),_:1})]),_:1},8,["modelValue"])],64))}},Tt={key:0},Dt={key:1,class:"h-100 d-flex justify-center align-center"},At={__name:"Watson",setup($){const s=Pe("watson",()=>{const u=y(!1),c=y(),o=y(),d=y(),b=y(),g=y(),M=y(),D=y(!1),z=y([]),E=q(()=>({type:c.value.type,subject_id:c.value.subject_id,collectionIds:z.value}));return F(u,()=>{u.value||(D.value=!1)}),{opened:u,payload:c,type:o,subject:d,thread:b,title:g,placeholderMessage:M,ready:D,selectedCollections:z,async setSubject(){s.payload.type==="project"&&(d.value=(await V.get(`projects/${c.value.subject_id}`)).data.project),s.payload.type==="collection"&&(d.value=(await V.get(`collections/${c.value.subject_id}`)).data.collection),s.payload.type==="collection-item"&&(d.value=(await V.get(`items/${c.value.subject_id}`)).data.item),s.payload.type==="draft"&&(d.value=(await V.get(`drafts/${c.value.subject_id}`)).data.draft),c.value.type==="chapter"&&(d.value=(await V.get(`chapters/${c.value.subject_id}`)).data.chapter)},async setActiveThreadIfExists(){b.value=(await m({type:s.payload.type,subject_id:s.payload.subject_id})).data.thread},async startThread(){b.value=(await V.post("watson/threads",E.value)).data.thread},async getContextEstimate(){return V.post("watson/estimate",E.value)}}})(),i=u=>{u.code==="Escape"&&(s.opened=!1)},n=y();O("watson",s),O("threadChannel",n),X(()=>{window.addEventListener("keydown",i)}),se(()=>{window.removeEventListener("keydown",i)}),F(()=>s.thread,(u,c)=>{c&&ye(n.value),u&&(n.value=ve(`Thread.${u.id}`))}),Q("openWatsonAssistant",async u=>{s.payload=u,s.opened=!0,await s.setSubject(),await s.setActiveThreadIfExists(),s.payload.type==="project"&&(s.title="Watson (Project Context)",s.placeholderMessage="Ask me anything about your project."),s.payload.type==="collection"&&(s.title=`Watson (${s.subject.label_pluralized} Context)`,s.placeholderMessage="Ask me anything about your collection."),s.payload.type==="collection-item"&&(s.title=`Watson (${s.subject.collection.label_singular} Context)`,s.placeholderMessage=`Ask me anything about your ${s.subject.collection.label_singular}.`),s.payload.type==="draft"&&(s.title="Watson (Draft Context)",s.placeholderMessage="Ask me anything about your draft."),s.payload.type==="chapter"&&(s.title="Watson (Chapter Context)",s.placeholderMessage="Ask me anything about your chapter."),s.ready=!0});async function p(){s.thread=null}function m(u){return V.get("watson/threads/active",{params:u})}return(u,c)=>(l(),j(he,{modelValue:t(s).opened,"onUpdate:modelValue":c[0]||(c[0]=o=>t(s).opened=o),app:"",location:"end",temporary:"",width:"600","max-width":"100%",class:"chat-drawer",persistent:"",order:"-2",color:"surface",scrim:!1},{default:r(()=>[t(s).ready?(l(),f("div",Tt,[t(s).thread?_("",!0):(l(),j(Pt,{key:0})),t(s).thread?(l(),j(rt,{key:1,onNewThread:p})):_("",!0)])):(l(),f("div",Dt,[a(Te,{indeterminate:""})]))]),_:1},8,["modelValue"]))}},Et={__name:"ProjectSidebar",setup($){const s=be(),i=A("project"),n=A("projectChannel"),p=y(),m=y(),u=y("opened"),c=q({get(){return u.value==="opened"},set(){u.value="toggling"}}),o=y(!0),d=N("drawer"),b=De(),g=Ae(),M=q(()=>{let w=0;w+=g.appSidebarOpened?b.getLayoutItem("app-sidebar").size:0;let I=c.value&&d.value?o.value?d.value.railWidth:d.value.width:0;return w+=I,`${w}px`});g.projectSidebar=d,X(async()=>{await D(),n.value.listen(".CreateCollection",z),n.value.listen(".DeleteCollection",E)}),se(()=>{n.value.stopListening(".CreateCollection",z),n.value.stopListening(".DeleteCollection",E)}),F(u,(w,I)=>{w==="toggling"&&(u.value=I==="opened"?"closed":"opened")}),Q(["collection-created","collection-updated"],()=>{D()}),Q("cache-draft-sidebar",w=>{p.value=w});async function D(){m.value=(await ge(i.value)).data.collections}function z({data:w}){m.value.push(w.collection)}function E({data:w}){L.remove(m.value,{id:w.collection.id})}return(w,I)=>(l(),f(T,null,[a(he,{rail:"","expand-on-hover":"","mobile-breakpoint":"sm",name:"project-sidebar",modelValue:t(c),"onUpdate:modelValue":I[0]||(I[0]=W=>B(c)?c.value=W:null),ref_key:"drawer",ref:d},{default:r(()=>[a(te,null,{default:r(()=>[a(R,{to:{name:"ProjectDashboard"},"prepend-icon":"mdi-view-dashboard",title:"Project Dashboard"}),t(p)&&t(s).name!=="EditDraft"?(l(),j(R,{key:0,to:{name:"EditDraft",params:{story_id:t(p).story_id,draft_id:t(p).id}},"prepend-icon":"mdi-pencil-box",title:"Back to draft"},null,8,["to"])):_("",!0),a(fe),(l(!0),f(T,null,H(t(m),W=>(l(),j(R,{key:W.id,"prepend-icon":"mdi-rhombus-split",title:W.label,to:{name:"Items",params:{collection_id:W.id}}},null,8,["title","to"]))),128)),a(Ue,null,{activator:r(({props:W})=>[a(R,U({"prepend-icon":"mdi-plus",title:"Create Collection"},W),null,16)]),_:1})]),_:1})]),_:1},8,["modelValue"]),a(x,{icon:"mdi-dots-vertical",class:"rounded-s-0 rounded-e-md project-sidebar-toggler border-e border-t border-b",style:Ee({left:t(M),"z-index":w.$refs.drawer?w.$refs.drawer.$el.nextSibling.style.zIndex-1:1}
1),onClick:I[1]||(I[1]=W=>c.value=!t(c))},null,8,["style"])],64))}},Lt=re(Et,[["__scopeId","data-v-b25c0415"]]),Gt={__name:"ProjectIndex",setup($){const s=be(),i=Le(),n=y(),p=y();O("project",p),O("projectChannel",n),se(()=>{n.value&&ye(n.value)});async function m(){p.value=(await V.get(`projects/${s.params.project_id}`)).data.project,n.value=ve("Project",p.value.id),n.value.listen(".UpdateProject",u).listen(".DeleteProject",c)}function u({data:o}){L.merge(p.value,L.pick(o.project,"name","description","updated_at"))}function c(){i.push({name:"Dashboard"}),Re("Project has been deleted.")}return(o,d)=>{const b=Me("RouterView");return l(),f(T,null,[a(He,{init:m},{default:r(()=>[a(Lt),a(b)]),_:1}),a(At)],64)}}};export{Gt 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.