PageSourceSearch

https://aiplans.org/assets/projectView-jp0nwE7K.js

js aiplans.org collected 2026-10-08 11:09:34 UTC 9,225 bytes, 1 lines download raw bytes

1import{_ as H,x as I,z as C,o as n,c as r,a,j as c,t as g,l as p,e as m,D as M,u as X,s as G,h as J,y as K,i as N,b as u,k as V,d as Q}from"./index-D8GvWgwI.js";import{u as Y}from"./eventStore-B0ynicFl.js";import{E as Z}from"./EditableRichText-CeNhdhWT.js";import{b as ee,E as te}from"./EventProjectForm-BXO9jJpZ.js";import"./useSafeMarked-CFTK_15D.js";import"./marked.esm-C4n1i0vC.js";const le={class:"cite-this-work tw-w-full"},se={class:"tw-flex tw-items-center tw-justify-between tw-mb-3"},ae={class:"bibtex-block tw-p-4 tw-rounded-lg tw-bg-surface-50 tw-border tw-border-surface-200 tw-overflow-x-auto tw-text-xs sm:tw-text-sm tw-whitespace-pre tw-m-0"},oe={__name:"CiteThisWork",props:{project:{type:Object,required:!0},event:{type:Object,required:!0},eventSlug:{type:String,default:""}},setup(T){const d=T,_=I(),v=p(!1),x=m(()=>{var t,o,b;const s=(((t=d.project)==null?void 0:t.bibtex_override)||"").trim();return s||ee({project:d.project,event:d.event,eventSlug:d.eventSlug||((o=d.event)==null?void 0:o.slug)||((b=d.event)==null?void 0:b.id)})});async function j(){var t;const s=x.value;try{if((t=navigator==null?void 0:navigator.clipboard)!=null&&t.writeText)await navigator.clipboard.writeText(s);else{const o=document.createElement("textarea");o.value=s,o.setAttribute("readonly",""),o.style.position="absolute",o.style.left="-9999px",document.body.appendChild(o),o.select(),document.execCommand("copy"),document.body.removeChild(o)}v.value=!0,setTimeout(()=>{v.value=!1},2e3),_.add({severity:"success",summary:"BibTeX copied",life:2e3})}catch(o){console.error("Error copying citation:",o),_.add({severity:"error",summary:"Copy failed",detail:"Could not copy citation to clipboard",life:3e3})}}return(s,t)=>{const o=C("Button");return n(),r("div",le,[a("div",se,[t[0]||(t[0]=a("h3",{class:"tw-text-xl tw-font-semibold tw-m-0 text-col"},"Cite this work",-1)),c(o,{icon:v.value?"pi pi-check":"pi pi-copy",label:v.value?"Copied":"Copy",onClick:j,text:"",size:"small"},null,8,["icon","label"])]),a("pre",ae,[a("code",null,g(x.value),1)])])}}},ne=H(oe,[["__scopeId","data-v-09d583c1"]]),re={class:"project-view tw-max-w-4xl tw-mx-auto tw-px-4 sm:tw-px-6 tw-py-6 sm:tw-py-10"},ie={key:0,class:"tw-flex tw-flex-col tw-gap-3"},ue={key:1,class:"tw-flex tw-flex-col tw-items-center tw-justify-center tw-py-16 tw-text-center"},ce={key:2,class:"tw-flex tw-flex-col tw-gap-6"},de={class:"tw-flex tw-items-center tw-gap-2 tw-text-sm tw-text-text-color-secondary tw-flex-wrap"},ve={class:"tw-truncate"},we={class:"tw-flex tw-items-start tw-justify-between tw-gap-3 tw-flex-wrap"},pe={class:"tw-flex-1 tw-min-w-0"},me={class:"tw-text-2xl sm:tw-text-3xl md:tw-text-4xl tw-font-bold tw-leading-tight tw-m-0 tw-text-slate-900"},fe={key:0,class:"tw-mt-2 tw-text-base tw-text-slate-700"},xe={key:1,class:"tw-mt-1 tw-text-sm tw-text-text-color-secondary"},ye={key:0,class:"tw-flex tw-items-center tw-gap-1"},ge={key:0,class:"tw-w-full tw-overflow-hidden tw-rounded-xl tw-bg-surface-100"},be=["src","alt"],_e={key:1,class:"tw-flex tw-flex-wrap tw-gap-2"},he=["href"],je=["href"],ke={key:2,class:"tw-mt-2"},Ce={class:"tw-mt-2 tw-mb-0 tw-text-sm tw-text-text-color-secondary"},Se={class:"tw-flex tw-justify-end tw-gap-2 tw-mt-4"},ze={__name:"projectView",setup(T){const d=M(),_=X(),v=I(),x=Y(),j=G(),s=p(null),t=p(null),o=p(!0),b=p(!1),S=p(!1),E=p(!1),h=p(!1),k=p(!1),f=m(()=>String(d.params.eventId||"")),D=m(()=>String(d.params.projectSlug||"")),$=m(()=>{var l,e;return((l=s.value)==null?void 0:l.slug)||((e=s.value)==null?void 0:e.id)||f.value}),R=m(()=>j.isSiteAdmin),U=m(()=>{var e,i;const l=(e=j.User)==null?void 0:e.id;return!l||!s.value?!1:Array.isArray((i=s.value.expand)==null?void 0:i.admins)&&s.value.expand.admins.length?s.value.expand.admins.some(y=>(y==null?void 0:y.id)===l):Array.isArray(s.value.admins)&&s.value.admins.length?s.value.admins.includes(l):!1}),B=m(()=>R.value||U.value),P=m(()=>{var e;if(!((e=t.value)!=null&&e.date))return"";const l=new Date(t.value.date);return Number.isNaN(l.getTime())?"":l.toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}),F=m(()=>{var l,e;return!!((l=t.value)!=null&&l.paper_url||(e=t.value)!=null&&e.code_url)}),A=async()=>{o.value=!0,b.value=!1,S.value=!1;try{const[l,e]=await Promise.all([x.getEvent(f.value,"admins"),x.getEventProjectBySlug(f.value,D.value)]);s.value=l,t.value=e,document.title=`${e.title} — ${l.title}`}catch(l){console.error("Error loading project:",l),b.value=!0}finally{o.value=!1}};J(A),K(()=>[f.value,D.value],([l,e],[i,y])=>{(l!==i||e!==y)&&A()});const L=async l=>{if(t.value)try{const e=await x.updateEventProject(t.value.id,{description:l});t.value=e,v.add({severity:"success",summary:"Description updated",life:2e3})}catch(e){console.error("Error updating description:",e),v.add({severity:"error",summary:"Save failed",detail
1:(e==null?void 0:e.message)||"Could not update description.",life:4e3})}},O=l=>{var e;l&&(t.value=l,document.title=`${l.title} — ${((e=s.value)==null?void 0:e.title)||"Event"}`,l.slug&&l.slug!==D.value&&_.replace({name:"event_project",params:{eventId:f.value,projectSlug:l.slug}}))},W=async()=>{if(t.value){k.value=!0;try{await x.deleteEventProject(t.value.id),v.add({severity:"success",summary:"Project deleted",life:2e3}),z()}catch(l){console.error("Error deleting project:",l),v.add({severity:"error",summary:"Delete failed",detail:(l==null?void 0:l.message)||"Could not delete the project.",life:4e3})}finally{k.value=!1,h.value=!1}}},z=()=>{_.push({name:"event",params:{id:f.value},hash:"#projects"})};return(l,e)=>{const i=C("Button"),y=C("router-link"),q=C("Dialog");return n(),r("div",re,[o.value?(n(),r("div",ie,[...e[6]||(e[6]=[a("div",{class:"tw-h-4 tw-w-40 tw-bg-surface-100 tw-rounded tw-animate-pulse"},null,-1),a("div",{class:"tw-h-10 tw-w-3/4 tw-bg-surface-100 tw-rounded tw-animate-pulse"},null,-1),a("div",{class:"tw-h-4 tw-w-1/2 tw-bg-surface-100 tw-rounded tw-animate-pulse"},null,-1),a("div",{class:"tw-aspect-[16/9] tw-w-full tw-bg-surface-100 tw-rounded-xl tw-animate-pulse tw-mt-2"},null,-1)])])):b.value?(n(),r("div",ue,[e[7]||(e[7]=a("i",{class:"pi pi-exclamation-triangle tw-text-3xl tw-text-surface-400 tw-mb-3"},null,-1)),e[8]||(e[8]=a("h2",{class:"tw-text-xl tw-font-semibold tw-mb-2"},"Project not found",-1)),e[9]||(e[9]=a("p",{class:"tw-text-text-color-secondary tw-mb-4"}," This project may have been deleted, or you may not have access to view it. ",-1)),f.value?(n(),N(i,{key:0,label:"Back to event",icon:"pi pi-arrow-left",onClick:z,outlined:""})):u("",!0)])):t.value&&s.value?(n(),r("div",ce,[a("nav",de,[c(y,{to:{name:"event",params:{id:f.value}},class:"tw-text-primary-color hover:tw-underline"},{default:V(()=>[Q(g(s.value.title),1)]),_:1},8,["to"]),e[10]||(e[10]=a("i",{class:"pi pi-chevron-right tw-text-xs"},null,-1)),a("span",ve,g(t.value.title),1)]),a("div",we,[a("div",pe,[a("h1",me,g(t.value.title),1),t.value.authors?(n(),r("div",fe,g(t.value.authors),1)):u("",!0),P.value?(n(),r("div",xe,g(P.value),1)):u("",!0)]),B.value?(n(),r("div",ye,[c(i,{icon:"pi pi-pencil",label:"Edit",onClick:e[0]||(e[0]=w=>E.value=!0),outlined:"",size:"small"}),c(i,{icon:"pi pi-trash","aria-label":"Delete project",onClick:e[1]||(e[1]=w=>h.value=!0),severity:"danger",outlined:"",size:"small"})])):u("",!0)]),t.value.cover_image_url&&!S.value?(n(),r("div",ge,[a("img",{src:t.value.cover_image_url,alt:t.value.title,class:"tw-w-full tw-h-auto tw-object-cover",onError:e[2]||(e[2]=w=>S.value=!0)},null,40,be)])):u("",!0),F.value?(n(),r("div",_e,[t.value.paper_url?(n(),r("a",{key:0,href:t.value.paper_url,target:"_blank",rel:"noopener noreferrer",class:"tw-no-underline"},[c(i,{label:"Read paper",icon:"pi pi-file-pdf",outlined:""})],8,he)):u("",!0),t.value.code_url?(n(),r("a",{key:1,href:t.value.code_url,target:"_blank",rel:"noopener noreferrer",class:"tw-no-underline"},[c(i,{label:"View code",icon:"pi pi-github",outlined:""})],8,je)):u("",!0)])):u("",!0),t.value.description||B.value?(n(),r("section",ke,[c(Z,{content:t.value.description||"","is-admin":B.value,onUpdate:L},null,8,["content","is-admin"])])):u("",!0),e[11]||(e[11]=a("hr",{class:"tw-w-full tw-border-0 tw-border-t tw-border-surface-200 tw-my-2"},null,-1)),a("section",null,[c(ne,{project:t.value,event:s.value,"event-slug":$.value},null,8,["project","event","event-slug"])])])):u("",!0),t.value&&s.value?(n(),N(te,{key:3,visible:E.value,"onUpdate:visible":e[3]||(e[3]=w=>E.value=w),"event-id":s.value.id,event:s.value,"event-slug":$.value,project:t.value,onSubmitted:O},null,8,["visible","event-id","event","event-slug","project"])):u("",!0),c(q,{visible:h.value,"onUpdate:visible":e[5]||(e[5]=w=>h.value=w),style:{width:"90vw",maxWidth:"420px"},modal:!0,showHeader:!1,closable:!1},{default:V(()=>{var w;return[a("div",null,[e[12]||(e[12]=a("p",{class:"tw-m-0 tw-font-medium"},"Delete this project?",-1)),a("p",Ce,' "'+g((w=t.value)==null?void 0:w.title)+'" will be permanently removed. This action cannot be undone. ',1),a("div",Se,[c(i,{label:"Cancel",disabled:k.value,onClick:e[4]||(e[4]=Ee=>h.value=!1),text:"",size:"small"},null,8,["disabled"]),c(i,{label:"Delete",loading:k.value,onClick:W,severity:"danger",size:"small"},null,8,["loading"])])])]}),_:1},8,["visible"])])}}};export{ze 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.