(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,28004,e=>{"use strict";let a=async e=>{if(!e)return"";try{let a=new FormData;a.append("file",e);let r=await fetch("/api/upload",{method:"POST",body:a});if(!r.ok)throw Error("Server returned error status "+r.status);let t=await r.json();if(t.success&&t.url)return t.url;throw Error(t.error||"Gagal menyimpan berkas di server")}catch(e){throw console.error("Upload failed: ",e),e}};e.s(["uploadImage",0,a])},48658,e=>{"use strict";var a=e.i(43476),r=e.i(71645),t=e.i(46696),s=e.i(28004),l=e.i(95187);let i=(0,l.createServerReference)("6082d397241cb6ec88dfd572bd04fb66cbfd1d197d",l.callServer,void 0,l.findSourceMapURL,"updateOrganigramDpm");var d=e.i(19455),n=e.i(93479);function o({profilId:e,initialUrl:l}){let[o,c]=(0,r.useState)(null),[u,m]=(0,r.useState)(l),[f,h]=(0,r.useState)(!1),g=async()=>{if(!o)return void t.toast.error("Pilih file terlebih dahulu");h(!0);try{let a=await (0,s.uploadImage)(o),r=await i(e,a);r.success?(t.toast.success(r.message),m(a),c(null)):t.toast.error(r.message)}catch(e){t.toast.error(e.message)}finally{h(!1)}},p=o?URL.createObjectURL(o):u;return(0,a.jsxs)("div",{className:"bg-white border border-slate-200 rounded-3xl p-8 relative overflow-hidden flex flex-col md:flex-row gap-6 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex-1 space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-xl font-bold text-slate-800",children:"Organigram DPM"}),(0,a.jsx)("p",{className:"text-slate-500 text-sm mt-1",children:"Unggah bagan struktur organisasi Dewan Perwakilan Mahasiswa."})]}),(0,a.jsx)("div",{className:"space-y-2",children:(0,a.jsx)(n.Input,{type:"file",accept:"image/*",onChange:e=>c(e.target.files?.[0]||null)})}),(0,a.jsx)(d.Button,{onClick:g,disabled:!o||f,children:f?"Menyimpan...":"Simpan Organigram"})]}),(0,a.jsx)("div",{className:"w-full md:w-1/3 aspect-video bg-slate-50 border-2 border-dashed border-slate-200 rounded-xl flex items-center justify-center overflow-hidden",children:p?(0,a.jsx)("img",{src:p,alt:"Organigram",className:"w-full h-full object-contain"}):(0,a.jsx)("span",{className:"text-slate-400 text-sm font-medium",children:"Belum ada bagan"})})]})}e.s(["default",()=>o],48658)}]);