1import{u as L,d as _,y as z,c as D,w as E,o as i,a as e,t as u,l as F,C as $,h as n,e as c,f as p,n as P,i as V,F as q,K as A,M as j,I as G,k as N}from"./app.1c75f29f.js";import{_ as O}from"./Modal.f4449063.js";const K={class:"py-10 px-14"},R={class:"flex items-center justify-between border-b border-gray-30 pb-2"},T={class:"text-20-medium"},Z={class:"flex flex-col gap-4 mt-4"},H=["placeholder"],J={key:0,class:"text-14-regular text-error-40 mt-1 mb-4"},Q=["placeholder"],W={key:1,class:"text-14-regular text-error-40 mt-1"},X={class:"flex flex-wrap -m-1 md:-m-2 p-2"},Y=["src"],ee=["onClick"],te=e("svg",{class:"fill-gray-40",width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e("g",{opacity:"0.7",filter:"url(#filter0_b_2569_7432)"},[e("circle",{cx:"16",cy:"16",r:"16",fill:"white"})]),e("path",{d:"M21.09 11.9349L20.0646 10.9094L15.9991 14.9749L11.9337 10.9094L10.9082 11.9349L14.9737 16.0003L10.9082 20.0658L11.9337 21.0912L15.9991 17.0258L20.0646 21.0912L21.09 20.0658L17.0246 16.0003L21.09 11.9349Z",fill:"#0F1A2A"}),e("defs",null,[e("filter",{id:"filter0_b_2569_7432",x:"-36",y:"-36",width:"104",height:"104",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},[e("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),e("feGaussianBlur",{in:"BackgroundImageFix",stdDeviation:"18"}),e("feComposite",{in2:"SourceAlpha",operator:"in",result:"effect1_backgroundBlur_2569_7432"}),e("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_backgroundBlur_2569_7432",result:"shape"})])])],-1),se=[te],le={key:0,class:"pointer-events-none rounded-md absolute h-full w-full bg-[#0000008c] z-10 top-0 left-0 flex items-center justify-center text-white text-3xl"},oe={key:2,class:"grid gap-4"},ae={key:0,class:"text-14-regular text-error-40 mt-2"},re={key:1,class:"rounded-md border border-gray-40 relative"},ie=e("span",{class:"icon-image-1 text-indigo-60 text-2xl"},null,-1),ne={key:3,class:"text-14-regular text-error-40 mt-1"},pe={__name:"EditModal",props:{show:{type:Boolean,required:!0},post:{required:!0}},emits:["close","updated"],setup(v,{emit:m}){const y=v;let o=L({title:null,body:null,files:[]});const g=_(null),d=_(o.attachments),h=_(0);z(()=>y.post,s=>{o=L({title:s.title,body:s.body,attachments:s.attachments.map(t=>t.id)}),d.value=s.attachments});const S=()=>{g.value.click()},I=s=>{let t=new FormData;t.append("file",s.target.files[0]),t.append("attachable_type","posts"),j.post("/attachments",t,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:l=>{h.value=Math.round(l.loaded/l.total*100)}}).then(l=>{Object.assign(l.data,{photo_url:l.data.path}),d.value.push(l.data),o.attachments.push(l.data.id),h.value=0}).catch(l=>{var a;((a=l==null?void 0:l.response)==null?void 0:a.status)==422&&(o.value.errors.file=l.response.data.errors.file[0])})},M=(s,t)=>{let l=g.value;j.delete(`/attachments/${s}`).then(a=>{d.value.splice(t,1),o.attachments.splice(t,1),l.value=null}).catch(a=>{var f;((f=a==null?void 0:a.response)==null?void 0:f.status)==400&&(o.errors.files=a.response.data.message)})},U=()=>{G.Inertia.post(`chat-room/${y.post.slug}/update`,{_method:"put",...o,forceFormData:!0},{preserveScroll:!0,preserveState:!0,replace:!0,onSuccess:s=>{m("updated",N().props.value.jetstream.flash.post.data),m("close")}})};return(s,t)=>(i(),D(O,{show:v.show,onClose:t[5]||(t[5]=l=>m("close")),"max-width":"3xl"},{default:E(()=>{var l,a,f,x,b,w,k,C;return[e("div",K,[e("div",R,[e("span",T,u(s.__("posts.edit.header")),1),e("span",{class:"icon icon-close-square text-lg cursor-pointer",onClick:t[0]||(t[0]=r=>m("close"))})]),e("div",Z,[F(e("input",{class:"rounded-xl w-full p-4 bg-gray-20",placeholder:s.__("posts.create.title_placeholder"),"onUpdate:modelValue":t[1]||(t[1]=r=>n(o).title=r)},null,8,H),[[$,n(o).title]]),(a=(l=n(o))==null?void 0:l.errors)!=null&&a.title?(i(),c("p",J,u((x=(f=n(o))==null?void 0:f.errors)==null?void 0:x.title[0]),1)):p("",!0),F(e("textarea",{class:"rounded-xl w-full p-4 bg-gray-20 border-none",rows:"2",placeholder:s.__("posts.create.description_placeholder"),"onUpdate:modelValue":t[2]||(t[2]=r=>n(o).body=r)},null,8,Q),[[$,n(o).body]]),(w=(b=n(o))==null?void 0:b.errors)!=null&&w.body?(i(),c("p",W,u((C=(k=n(o))==null?void 0:k.errors)==null?void 0:C.body[0]),1)):p("",!0),e("div",X,[e("div",{class:P(["grid gap-2 justify-items-center w-full overflow-y-auto",d.value.length<4?"grid-cols-"+d.value.length:"grid-cols-3"])},[(i(!0),c(q,null,V(d.value.slice(0,6),(r,B)=>(i(),c("div",{class:"relative group",key:r.id},[e("img",{alt:"gallery",class:"block object-cover object-center rounded-md w-full h-52 mt
1-2",src:r.path},null,8,Y),e("div",{class:"absolute z-10 top-4 right-4 opacity-0 group-hover:opacity-100 transition-all duration-150 cursor-pointer",onClick:de=>M(r.id,B)},se,8,ee),d.value.length>6&&B==5?(i(),c("div",le,u(`+${d.value.length-6}`),1)):p("",!0)]))),128))],2)]),d.value?(i(),c("div",oe,[s.$page.props.errors.attachments?(i(),c("p",ae,u(s.$page.props.errors.attachments),1)):p("",!0),h.value>0&&h.value<100?(i(),c("div",re,[e("div",{class:"bg-indigo-20 px-6 py-4 rounded-md w-0 transition-all duration-200 animate-pulse",style:A(`width: ${h.value}%`)},u(h.value)+"% ",5)])):p("",!0)])):p("",!0),e("div",{class:"flex flex-grow bg-gray-20 p-4 rounded-xl content-center items-center justify-center cursor-pointer",onClick:S},[e("input",{type:"file",ref_key:"file",ref:g,hidden:"",accept:"image/*",onChange:t[3]||(t[3]=r=>I(r)),multiple:""},null,544),ie,e("span",null,u(s.__("posts.photo")),1)]),n(o).errors.files?(i(),c("p",ne,u(n(o).errors.files),1)):p("",!0),e("button",{class:"bg-indigo-60 self-center w-full p-4 rounded-xl text-white",onClick:t[4]||(t[4]=r=>U())},u(s.__("posts.edit.update")),1)])])]}),_:1},8,["show"]))}};export{pe 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.