PageSourceSearch

https://flightsim.to/assets/EditUploadPage-9BkiYkNi.js

js flightsim.to collected 2026-10-01 10:19:57 UTC 64,387 bytes, 7 lines download raw bytes

1import{r as o,j as e,D as ce,f as de,aV as is,a2 as Ye,bh as os,B as g,N as re,al as We,u as cs,n as ds,a8 as Xe,I as ms,h as Q,ac as us,ad as fe,$ as X,w as _e,ah as xs,aT as qe,x as Ze,aP as Je,dg as hs,cI as ps,M as es,ay as gs,t as Ne,g as we,v as Ce,y as Se,aq as Ve,ak as Me,W as q,cW as xe,cX as he,bs as fs,cY as pe,d5 as js,ar as vs,aR as V,Q as _,i as O,d as ge,X as te,R as Oe,H as bs,Y as ae,b4 as je,V as ss,Z as ys,as as Re,e as _s,a9 as J,F as Ns,z as ws,an as Cs,b2 as Be,bN as Ss,bO as ks,bP as Ds,bQ as As,bR as Ts,bS as Fs,bT as Is,bU as Es,bV as Ls}from"./index-BUR_l9d0.js";import{u as qs,f as Ke,U as Os,r as zs,a as $s,D as Ms,b as Rs,p as Us,d as Ps,e as Vs,C as Ue,s as Bs,c as Ks,g as Hs,h as Gs,t as Qs,i as Ys,j as Ws,k as Xs}from"./useChunkedUpload-Bl760iAb.js";import{T as me}from"./textarea-BXzZpztK.js";import{S as Zs}from"./separator-DMzUUELV.js";import{T as ts,a as as,b as ee,c as se}from"./tabs-OEEREkRt.js";import{S as le,a as ne,b as ie,c as oe,d as Y}from"./select-B7hLupPU.js";import{C as Js}from"./calendar-CCwiRygs.js";import{C as ke,a as De,b as Ae,c as Te,d as ue,e as Pe}from"./command-Biq9FvDv.js";import{C as et}from"./CollectionModal-CConsxw4.js";import st from"./BasicHtmlEditor-CJiq4Xjc.js";import{u as tt,c as at,d as rt,a as lt}from"./useCategories-BeO0ZWdz.js";import{A as nt}from"./ArticleModal-DfLB0EiX.js";import{H as rs}from"./history-CpSHhrEf.js";import{C as it}from"./chart-column-C02s6Qxe.js";import{P as ze}from"./plus-JPnTyDXo.js";import{F as ot}from"./folder-plus-SbwataL-.js";import{M as ct}from"./mouse-pointer-click-CYY-PZFv.js";import{S as ls}from"./save-CDQR9ggd.js";import{G as dt}from"./grip-vertical-B45yWdrW.js";import{I as mt}from"./image-plus-A8zaXqkY.js";import{g as ut,B as $e,X as be,Y as ye,f as xt,R as Ie,A as ht,C as Ee,T as Le,a as pt}from"./AreaChart-zhypazYS.js";import{B as gt}from"./bell-off-D-oxMua1.js";import{E as He}from"./eye-off-B4CkS6KC.js";import"./myUploadsApi-CMavfcRg.js";import"./addMonths-DydxCsTQ.js";import"./checkbox-DczHt24I.js";import"./minus-4CiSas3o.js";import"./useCollections-Bb_mAeQX.js";import"./index-BAkSLD1T.js";import"./YoutubeNode-BinUHndW.js";import"./forumsApi-CUuRvBCA.js";import"./types-DXPrN7FL.js";import"./list-BeYbbxeC.js";import"./link-BhXY5Cr0.js";import"./youtube-BW00j5b2.js";import"./code-xml-FNXQWRqw.js";import"./useArticleDetail-gx6wKVeO.js";import"./supportApi-BT1qrbYP.js";var Ge=ut({chartName:"BarChart",GraphicalChild:$e,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:be},{axisType:"yAxis",AxisComp:ye}],formatAxisMap:xt});function ft({open:s,onOpenChange:c,addonId:n,addonSlug:j,version:f}){const[x,w]=o.useState(!1);return o.useEffect(()=>{if(s){const h=setTimeout(()=>w(!0),100);return()=>clearTimeout(h)}w(!1)},[s]),e.jsx(ce,{open:s,onOpenChange:c,children:e.jsxs(de,{className:"sm:max-w-md text-center border-none bg-gradient-to-b from-background to-muted/30 overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 pointer-events-none overflow-hidden",children:[...Array(6)].map((h,a)=>e.jsx("span",{className:"absolute block w-1.5 h-1.5 rounded-full bg-primary/40",style:{left:`${15+a*14}%`,top:`${10+a%3*20}%`,animation:x?`float-particle ${1.5+a*.3}s ease-in-out ${a*.15}s infinite alternate`:"none",opacity:x?1:0,transition:"opacity 0.5s ease"}},a))}),e.jsxs("div",{className:"flex flex-col items-center gap-4 py-4 relative z-10",children:[e.jsxs("div",{className:`relative transition-all duration-700 ease-out ${x?"scale-100 opacity-100":"scale-50 opacity-0"}`,children:[e.jsx("div",{className:"absolute inset-0 rounded-full bg-primary/20 animate-ping"}),e.jsx("div",{className:"relative w-20 h-20 rounded-full bg-primary/10 flex items-center justify-center ring-4 ring-primary/20",children:e.jsx(is,{className:"w-10 h-10 text-primary",strokeWidth:2.5})})]}),e.jsx("div",{className:`transition-all duration-500 delay-300 ${x?"scale-100 opacity-100":"scale-0 opacity-0"}`,children:e.jsx(Ye,{className:"w-5 h-5 text-primary/60"})}),e.jsxs("div",{className:`space-y-2 transition-all duration-500 delay-200 ${x?"translate-y-0 opacity-100":"translate-y-4 opacity-0"}`,children:[e.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Update Pushed!"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Version ",e.jsx("span",{className:"font-mono font-semibold text-foreground",children:f})," is now live and available for download."]})]}),e.jsx("div",{className:`rounded-lg border border-amber-500/30 bg-amber-500/10 p-4 w-full transition-all duration-500 delay-300 ${x?"translate-y-0 opacity-100":"translate-y-4 opacity-0"}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(os,{className:"w-5 h-5 text-amber-500 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1 text-left",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Promote your update"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Share this update as an Activity Post to reach your followers and new users."}),e.jsx(g,{asChild:!0,variant:"outline",size:"sm",className:"mt-3 w-full sm:w-auto",children:e.jsx(re,{to:"/activities",children:"Create Activity Post"})})]})]})}),e.jsxs("div",{className:`flex flex-col sm:flex-row gap-3 w-full mt-2 transition-all duration-500 delay-400 ${x?"translate-y-0 opacity-100":"translate-y-4 opacity-0"}`,children:[e.jsx(g,{variant:"outline",className:"flex-1",onClick:()=>c(!1),children:"Continue Editing"}),e.jsx(g,{asChild:!0,className:"flex-1 gap-2",children:e.jsxs(re,{to:`/addon/${n}/${j}`,children:[e.jsx(We,{className:"w-4 h-4"}),"View Addon Page"]})})]})]}),e.jsx("style",{children:`
2          @keyframes float-particle {
3            0% { transform: translateY(0) scale(1); }
4            100% { transform: translateY(-12px) scale(1.3); }
5          }
6        `})]})})}function ns({onFileDrop:s,onClick:c,icon:n,label:j,hint:f,disabled:x,children:w}
6){const[h,a]=o.useState(!1);return e.jsxs("div",{onDragOver:t=>{t.preventDefault(),x||a(!0)},onDragEnter:t=>{t.preventDefault(),x||a(!0)},onDragLeave:()=>a(!1),onDrop:t=>{a(!1),s(t)},onClick:c,className:`border-2 border-dashed rounded-xl p-10 text-center transition-all ${x?"opacity-50 cursor-not-allowed":"cursor-pointer"} ${h?"border-primary bg-primary/5 shadow-[0_0_15px_-3px_hsl(var(--primary)/0.3)]":"border-border hover:border-primary/50 hover:bg-primary/5"}`,children:[e.jsx("div",{className:`transition-colors ${h?"text-primary":"text-muted-foreground"}`,children:n}),e.jsx("p",{className:`text-sm font-medium transition-colors ${h?"text-primary":"text-foreground"}`,children:j}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:f}),w]})}const ua=()=>{const{id:s,slug:c}=cs(),{isAuthenticated:n,isLoading:j}=ds(),f=Xe(),x=ms(),{data:w,isLoading:h}=qs(),{t:a}=Q("editUpload");us({title:a("page_title"),description:a("page_desc")});const[t,S]=o.useState(null),[z,L]=o.useState(!0),[k,u]=o.useState(null),[v,d]=o.useState("general"),[p,F]=o.useState(!1),[T,I]=o.useState(!1),[U,M]=o.useState(!1),[C,m]=o.useState(!1),[$,A]=o.useState(void 0),[H,R]=o.useState("12:00"),[G,P]=o.useState(!1),[B,K]=o.useState(!1),Z=()=>{const N=t==null?void 0:t.scheduledReleaseAt;if(N){const l=new Date(N*1e3);A(l),R(`${String(l.getUTCHours()).padStart(2,"0")}:${String(l.getUTCMinutes()).padStart(2,"0")}`)}else A(void 0),R("12:00");m(!0)},i=async()=>{if(!t||!$)return;const[N,l]=H.split(":").map(y=>parseInt(y,10)||0),b=Math.floor(Date.UTC($.getFullYear(),$.getMonth(),$.getDate(),N,l,0)/1e3);K(!0);try{await $s(t.file_id,b),S(y=>y&&{...y,isScheduled:!0,scheduledReleaseAt:b}),_.success(a("schedule_updated")),m(!1)}catch(y){_.error(y.message||a("schedule_update_error"))}finally{K(!1)}},r=N=>{const l=new Date(N*1e3);return`${l.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"})} · ${String(l.getUTCHours()).padStart(2,"0")}:${String(l.getUTCMinutes()).padStart(2,"0")} UTC`},D=async()=>{if(t){F(!0);try{if(await zs(t.file_id),s&&c){const N=await Ke(s,c);S(N)}_.success(a("reapply_success"))}catch(N){_.error(N.message||"Re-apply failed.")}finally{F(!1)}}};return o.useEffect(()=>{!j&&!n&&f("/login",{replace:!0})},[j,n,f]),o.useEffect(()=>{!s||!c||!n||(L(!0),u(null),Ke(s,c).then(S).catch(N=>u(N.message)).finally(()=>L(!1)))},[s,c,n]),j||z||h?e.jsx(fe,{children:e.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:e.jsx(X,{className:"h-8 w-8 animate-spin text-primary"})})}):n?w&&!w.uploads_allowed?e.jsx(fe,{children:e.jsx(Os,{})}):k||!t?e.jsx(fe,{children:e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh] gap-4",children:[e.jsx(_e,{className:"h-10 w-10 text-destructive"}),e.jsx("p",{className:"text-muted-foreground",children:k||a("not_found")}),e.jsx(g,{variant:"outline",asChild:!0,children:e.jsx(re,{to:"/user/uploads",children:a("back_to_uploads")})})]})}):e.jsxs(fe,{children:[e.jsx("section",{className:"border-b border-border bg-card/50",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 py-6",children:[e.jsx("div",{className:"flex items-center gap-3 mb-4",children:e.jsx(g,{variant:"ghost",size:"sm",asChild:!0,children:e.jsxs(re,{to:"/user/uploads",children:[e.jsx(xs,{className:"h-4 w-4 mr-1"}),a("back_to_uploads")]})})}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground truncate",children:t.title}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["v",t.version," · ",t.simulator," · ",t.statusLabel]})]}),e.jsx("div",{className:"flex items-center gap-2 shrink-0",children:e.jsxs(g,{variant:"outline",size:"sm",onClick:()=>{x.invalidateQueries({queryKey:["addon-detail",s,c]}),x.invalidateQueries({queryKey:["addon-comments",s,c]}),x.invalidateQueries({queryKey:["addon-attachments",s]}),f(`/addon/${s}/${c}`)},children:[e.jsx(qe,{className:"h-4 w-4 mr-1.5"}),a("view_page")]})})]})]})}),e.jsx("section",{className:"py-8 bg-muted/30",children:e.jsx("div",{className:"max-w-6xl mx-auto px-4 sm:px-6",children:e.jsxs(ts,{value:v,onValueChange:d,children:[e.jsxs(as,{className:"mb-8 flex-wrap h-auto gap-1 w-full p-2",children:[e.jsxs(ee,{value:"general",className:"gap-1.5",children:[e.jsx(Ze,{className:"h-3.5 w-3.5"}),a("tab_general")]}),e.jsxs(ee,{value:"management",className:"gap-1.5",children:[e.jsx(Je,{className:"h-3.5 w-3.5"}),a("tab_versioning")]}),e.jsxs(ee,{value:"versions",className:"gap-1.5",children:[e.jsx(rs,{className:"h-3.5 w-3.5"}),a("tab_version_history")]}),e.jsxs(ee,{value:"images",className:"gap-1.5",children:[e.jsx(hs,{className:"h-3.5 w-3.5"}),a("tab_images")]}),e.jsxs(ee,{value:"more",className:"gap-1.5",children:[e.jsx(ps,{className:"h-3.5 w-3.5"}),a("tab_more")]}),e.jsxs(ee,{value:"statistics",className:"gap-1.5",children:[e.jsx(it,{className:"h-3.5 w-3.5"}),a("tab_statistics")]}),e.jsxs(ee,{value:"visibility",className:"gap-1.5",children:[e.jsx(qe,{className:"h-3.5 w-3.5"}),a("tab_visibility")]})]}),t.status!==1&&!t.isScheduled&&e.jsxs("div",{className:`flex items-start gap-3 p-4 rounded-lg border mb-6 ${t.status===2?"bg-destructive/10 border-destructive/30":"bg-warning/10 border-warning/30"}`,children:[e.jsx(_e,{className:`h-5 w-5 flex-shrink-0 mt-0.5 ${t.status===2?"text-destructive":"text-warning"}`}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:`text-sm font-semibold ${t.status===2?"text-destructive":"text-warning"}`,children:[t.status===0&&a("status_pending"),t.status===2&&a("status_declined"),t.status===4&&a("status_hidden")]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[t.status===0&&a("status_pending_desc"),t.status===2&&a("status_declined_desc"),t.status===4&&a("status_hidden_desc")]}),t.status===2&&t.declinedReason&&e.jsxs("div",{className:"mt-3 p-3 rounded-md bg-destructive/5 border border-destructive/20",children:[e.jsx("p",{className:"text-xs font-medium text-destructive mb-1",children:a("reason")}
6),e.jsx("p",{className:"text-sm text-foreground/90",children:t.declinedReason})]}),t.status===2&&e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[t.canReapply?e.jsx(g,{size:"sm",variant:"default",disabled:p,onClick:()=>I(!0),children:a(p?"reapplying":"reapply_for_review")}):e.jsx(g,{size:"sm",variant:"default",asChild:!0,children:e.jsxs(re,{to:"/support",children:[e.jsx(es,{className:"h-4 w-4 mr-1"}),a("contact_support")]})}),e.jsxs(g,{size:"sm",variant:"outline",onClick:()=>M(!0),children:[e.jsx(gs,{className:"h-4 w-4 mr-1"}),a("view_upload_rules")]}),e.jsx(nt,{slug:"general-rules-for-user-uploads",open:U,onOpenChange:M}),e.jsx(ce,{open:T,onOpenChange:I,children:e.jsxs(de,{children:[e.jsxs(Ne,{children:[e.jsx(we,{children:a("reapply_for_review")}),e.jsx(Ce,{children:a("reapply_dialog_desc")})]}),e.jsxs(Se,{children:[e.jsx(g,{variant:"outline",onClick:()=>I(!1),children:a("cancel")}),e.jsx(g,{disabled:p,onClick:async()=>{I(!1),await D()},children:a(p?"reapplying":"confirm_reapply")})]})]})})]})]})]}),t.isScheduled&&e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 p-4 rounded-lg border border-primary/30 bg-primary/5 mb-6",children:[e.jsx(Ve,{className:"h-5 w-5 flex-shrink-0 text-primary"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:a("scheduled_release_title")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t.scheduledReleaseAt?a("scheduled_release_at",{datetime:r(t.scheduledReleaseAt)}):a("scheduled_release_unknown")})]}),e.jsxs(g,{size:"sm",variant:"outline",onClick:Z,children:[e.jsx(Me,{className:"h-4 w-4 mr-1"}),a("edit_schedule")]})]}),e.jsx(ce,{open:C,onOpenChange:m,children:e.jsxs(de,{children:[e.jsxs(Ne,{children:[e.jsx(we,{children:a("edit_schedule")}),e.jsx(Ce,{children:a("edit_schedule_desc")})]}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(q,{children:a("release_date")}),e.jsxs(xe,{open:G,onOpenChange:P,children:[e.jsx(he,{asChild:!0,children:e.jsxs(g,{variant:"outline",className:"w-full justify-start font-normal h-10 text-left",children:[e.jsx(Ve,{className:"mr-2 h-4 w-4 text-muted-foreground"}),$?fs($,"PPP"):e.jsx("span",{className:"text-muted-foreground",children:a("pick_date")})]})}),e.jsx(pe,{className:"w-auto p-0 z-50 bg-popover",align:"start",children:e.jsx(Js,{mode:"single",selected:$,onSelect:N=>{A(N),P(!1)},disabled:N=>N<js(new Date),initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(q,{htmlFor:"edit-release-time",children:a("release_time_utc")}),e.jsxs("div",{className:"relative",children:[e.jsx(vs,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none"}),e.jsx(V,{id:"edit-release-time",type:"time",value:H,onChange:N=>R(N.target.value),className:"pr-9"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a("all_times_utc")})]})]}),e.jsxs(Se,{children:[e.jsx(g,{variant:"outline",onClick:()=>m(!1),children:a("cancel")}),e.jsx(g,{disabled:!$||B,onClick:i,children:a(B?"saving":"save_changes")})]})]})}),e.jsx(se,{value:"general",children:e.jsx(yt,{data:t,setData:S})}),e.jsx(se,{value:"management",children:e.jsx(_t,{data:t,setData:S,addonId:s||"",addonSlug:t.slug||c||""})}),e.jsx(se,{value:"images",children:e.jsx(Nt,{data:t,setData:S})}),e.jsx(se,{value:"more",children:e.jsx(wt,{data:t,setData:S})}),e.jsx(se,{value:"versions",children:e.jsx(kt,{data:t,setData:S})}),e.jsx(se,{value:"statistics",children:e.jsx(Ct,{data:t})}),e.jsx(se,{value:"visibility",children:e.jsx(St,{data:t,setData:S})})]})})})]}):null},jt=({categories:s,value:c,onChange:n})=>{const[j,f]=o.useState(!1),{t:x}=Q("editUpload"),w=o.useMemo(()=>{var h;if(!s||!c)return"";for(const a of s){const t=(h=a.subcategories)==null?void 0:h.find(S=>S.slug===c);if(t)return t.simulator?`${t.simulator} 🔹 ${t.name}`:`🔹 ${t.name}`}return c},[s,c]);return e.jsxs("div",{children:[e.jsx(q,{children:x("category_label")}),e.jsxs(xe,{open:j,onOpenChange:f,children:[e.jsx(he,{asChild:!0,children:e.jsxs(g,{variant:"outline",role:"combobox","aria-expanded":j,className:"mt-1 w-full justify-between font-normal h-10",children:[e.jsx("span",{className:"truncate",children:w||x("select_category")}),e.jsx(Ue,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(pe,{className:"w-[--radix-popover-trigger-width] p-0 z-50 bg-popover",align:"start",children:e.jsxs(ke,{children:[e.jsx(Pe,{placeholder:x("search_categories")}),e.jsxs(De,{children:[e.jsx(Ae,{children:x("no_category")}),s==null?void 0:s.slice().sort((h,a)=>h.slug==="liveries"?-1:a.slug==="liveries"?1:0).map(h=>{var a;return e.jsx(Te,{heading:h.name,children:(a=h.subcategories)==null?void 0:a.map(t=>e.jsxs(ue,{value:`${t.simulator} ${t.name} ${h.name}`,onSelect:()=>{n(t.slug),f(!1)},children:[e.jsx(ae,{className:`mr-2 h-4 w-4 ${c===t.slug?"opacity-100":"opacity-0"}`}),t.simulator," 🔹 ",t.name]},t.id))},h.id)})]})]})})]})]})},vt=({affiliations:s,value:c,onChange:n})=>{const[j,f]=o.useState(!1),{t:x}=Q("editUpload"),w=o.useMemo(()=>
6{if(!s||!c)return"";const h=s.find(t=>t.name===c);if(!h)return c;const a=h.msfs2020&&h.msfs2024?"MSFS 2020/24":h.msfs2024?"MSFS 2024":h.msfs2020?"MSFS 2020":"";return a?`${a} 🔹 ${h.name}`:h.name},[s,c]);return e.jsxs("div",{children:[e.jsx(q,{children:x("affiliation_label")}),e.jsxs(xe,{open:j,onOpenChange:f,children:[e.jsx(he,{asChild:!0,children:e.jsxs(g,{variant:"outline",role:"combobox","aria-expanded":j,className:"mt-1 w-full justify-between font-normal h-10",children:[e.jsx("span",{className:"truncate",children:w||x("select_affiliation")}),e.jsx(Ue,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(pe,{className:"w-[--radix-popover-trigger-width] p-0 z-50 bg-popover",align:"start",children:e.jsxs(ke,{children:[e.jsx(Pe,{placeholder:x("search_affiliations")}),e.jsxs(De,{children:[e.jsx(Ae,{children:x("no_affiliation")}),e.jsxs(Te,{children:[e.jsxs(ue,{value:"none clear no affiliation",onSelect:()=>{n(""),f(!1)},children:[e.jsx(ae,{className:`mr-2 h-4 w-4 ${c?"opacity-0":"opacity-100"}`}),e.jsx("span",{className:"text-muted-foreground",children:x("affiliation_none")})]}),s==null?void 0:s.map(h=>{const a=h.msfs2020&&h.msfs2024?"MSFS 2020/24":h.msfs2024?"MSFS 2024":h.msfs2020?"MSFS 2020":"";return e.jsxs(ue,{value:`${h.name} ${h.keywords} ${a}`,onSelect:()=>{n(h.name),f(!1)},children:[e.jsx(ae,{className:`mr-2 h-4 w-4 ${c===h.name?"opacity-100":"opacity-0"}`}),a&&e.jsxs("span",{className:"text-muted-foreground mr-1",children:[a," 🔹"]}),h.name]},h.id)})]})]})]})})]})]})},bt=({countries:s,value:c,onChange:n})=>{const[j,f]=o.useState(!1),{t:x}=Q("editUpload"),w=o.useMemo(()=>{var h;return!s||!c?"":((h=s.find(a=>a.code===c))==null?void 0:h.label)??c},[s,c]);return e.jsxs("div",{children:[e.jsx(q,{children:x("country_label")}),e.jsxs(xe,{open:j,onOpenChange:f,children:[e.jsx(he,{asChild:!0,children:e.jsxs(g,{variant:"outline",role:"combobox","aria-expanded":j,className:"mt-1 w-full justify-between font-normal h-10",children:[e.jsx("span",{className:"truncate",children:w||x("select_country")}),e.jsx(Ue,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(pe,{className:"w-[--radix-popover-trigger-width] p-0 z-50 bg-popover",align:"start",children:e.jsxs(ke,{children:[e.jsx(Pe,{placeholder:x("search_countries")}),e.jsxs(De,{children:[e.jsx(Ae,{children:x("no_country")}),e.jsx(Te,{children:s==null?void 0:s.map(h=>e.jsxs(ue,{value:`${h.label} ${h.code}`,onSelect:()=>{n(h.code),f(!1)},children:[e.jsx(ae,{className:`mr-2 h-4 w-4 ${c===h.code?"opacity-100":"opacity-0"}`}),h.label]},h.code))})]})]})})]})]})},yt=({data:s,setData:c})=>{const[n,j]=o.useState(""),[f,x]=o.useState(!1),[w,h]=o.useState(!1),[a,t]=o.useState(!1),[S,z]=o.useState(0),[L,k]=o.useState(!1),{t:u}=Q("editUpload"),{data:v,isLoading:d}=tt(),{data:p,isLoading:F}=at(),{data:T,isLoading:I}=rt(),{data:U,isLoading:M}=lt(),C=d||F||I||M,[m,$]=o.useState(!1),A=i=>c(r=>({...r,...i})),H=o.useMemo(()=>{var i;if(!v||!s.category)return null;for(const r of v)if((i=r.subcategories)!=null&&i.some(D=>D.slug===s.category))return r.id;return null},[v,s.category]),R=H===2||H===10,G=H===1,P=i=>{var D;const r={category:i,subCategorySlug:i,subCategory:""};if(v)for(const N of v){const l=(D=N.subcategories)==null?void 0:D.find(b=>b.slug===i);if(l){if(r.categorySlug=N.slug,r.categoryId=N.id,r.subCategoryId=l.id,N.id!==2&&N.id!==10&&(r.country="",r.icaoCode="",r.coordinates=""),N.id!==1&&(r.airline=""),l.affiliation_id&&p){const b=p.find(y=>y.id===l.affiliation_id);b&&(r.affiliation=b.name,r.affiliationId=b.id,r.affiliationSlug=b.slug)}break}}A(r)},B=()=>{const i=n.trim();i&&!s.searchKeywords.includes(i)&&(A({searchKeywords:[...s.searchKeywords,i]}),j(""))},K=i=>{A({searchKeywords:s.searchKeywords.filter(r=>r!==i)})},Z=async()=>{h(!0);try{const i=await Bs({...s,country:R?s.country:"",icaoCode:R?s.icaoCode:"",coordinates:R?s.coordinates:"",airline:G?s.airline:""});_.success(i.message||u("save_success"))}catch(i){_.error(i.message||u("save_error"))}finally{h(!1)}};return C?e.jsxs("div",{className:"flex items-center justify-center py-20",children:[e.jsx(X,{className:"h-6 w-6 animate-spin text-primary"}),e.jsx("span",{className:"ml-2 text-sm text-muted-foreground",children:u("loading_form")})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs(O,{className:"p-6 space-y-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:u("basic_info")}),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{children:[e.jsx(q,{htmlFor:"title",children:u("title_label")}),e.jsx(V,{id:"title",value:s.title,onChange:i=>A({title:i.target.value})})]}),e.jsxs("div",{children:[e.jsx(q,{htmlFor:"shortDesc",children:u("short_desc")}),e.jsx(me,{id:"shortDesc",value:s.shortDescription,onChange:i=>
6A({shortDescription:i.target.value}),rows:3})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(jt,{categories:v,value:s.category,onChange:P}),e.jsx(vt,{affiliations:p,value:s.affiliation,onChange:i=>A({affiliation:i})})]}),R&&e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(bt,{countries:T,value:s.country,onChange:i=>A({country:i})}),e.jsxs("div",{children:[e.jsx(q,{htmlFor:"icao",children:u("icao_label")}),e.jsx(V,{id:"icao",value:s.icaoCode,onChange:i=>A({icaoCode:i.target.value}),placeholder:"e.g. FAOR"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[G&&e.jsxs("div",{children:[e.jsx(q,{htmlFor:"airline",children:u("airline_label")}),e.jsxs(xe,{open:m,onOpenChange:$,children:[e.jsx(he,{asChild:!0,children:e.jsx("div",{className:"relative mt-1",children:e.jsx(V,{id:"airline",value:s.airline,onChange:i=>{A({airline:i.target.value}),i.target.value.length>0&&$(!0)},onFocus:()=>{s.airline.length>0&&$(!0)},placeholder:u("type_to_search"),autoComplete:"off",className:"mt-0"})})}),U&&U.length>0&&e.jsx(pe,{className:"w-[--radix-popover-trigger-width] p-0 z-50 bg-popover",align:"start",onOpenAutoFocus:i=>i.preventDefault(),children:e.jsx(ke,{children:e.jsxs(De,{children:[e.jsx(Ae,{children:u("no_airlines")}),e.jsx(Te,{children:U.filter(i=>i.airline.toLowerCase().includes(s.airline.toLowerCase())).slice(0,20).map(i=>e.jsxs(ue,{value:i.airline,onSelect:()=>{A({airline:i.airline}),$(!1)},children:[i.airline,e.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:i.file_count})]},i.airline))})]})})})]})]}),R&&e.jsxs("div",{children:[e.jsx(q,{htmlFor:"coordinates",children:u("coordinates_label")}),e.jsx(V,{id:"coordinates",value:s.coordinates,onChange:i=>A({coordinates:i.target.value}),placeholder:"40.725581, -74.189579"})]})]}),e.jsxs("div",{children:[e.jsx(q,{children:u("compatibility_label")}),e.jsxs(le,{value:s.simulator,onValueChange:i=>A({simulator:i}),children:[e.jsx(ne,{children:e.jsx(ie,{placeholder:u("select_compatibility")})}),e.jsxs(oe,{children:[e.jsx(Y,{value:"MSFS2020",children:"Microsoft Flight Simulator 2020"}),e.jsx(Y,{value:"MSFS2024",children:"Microsoft Flight Simulator 2024"}),e.jsx(Y,{value:"MSFS2020/24",children:"Microsoft Flight Simulator 2020/24"})]})]})]})]})]}),e.jsxs(O,{className:"p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:u("description_title")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:u("description_hint")})]}),e.jsxs(g,{type:"button",variant:"outline",size:"sm",onClick:()=>t(!0),children:[e.jsx(Ze,{className:"h-4 w-4 mr-1.5"}),u("templates")]})]}),e.jsx(st,{value:s.description,onChange:i=>A({description:i})},S)]}),e.jsx(Ms,{open:a,onOpenChange:t,onSelect:i=>{A({description:i}),z(r=>r+1)}}),e.jsxs(O,{className:"p-6 space-y-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:u("keywords_collections")}),e.jsxs("div",{children:[e.jsx(q,{children:u("search_keywords")}),e.jsxs("div",{className:"flex gap-2 mt-1.5",children:[e.jsx(V,{value:n,onChange:i=>j(i.target.value),placeholder:u("add_keyword"),onKeyDown:i=>i.key==="Enter"&&(i.preventDefault(),B())}),e.jsx(g,{type:"button",variant:"secondary",onClick:B,children:e.jsx(ze,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-3",children:s.searchKeywords.map(i=>e.jsxs(ge,{variant:"secondary",className:"gap-1 pr-1",children:[i,e.jsx("button",{onClick:()=>K(i),className:"ml-1 hover:text-destructive",children:e.jsx(te,{className:"h-3 w-3"})})]},i))})]}),e.jsxs("div",{children:[e.jsx(q,{children:u("collections_label")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:u("collections_hint")}),e.jsxs(g,{type:"button",variant:"outline",className:"mt-2 gap-2 w-full",onClick:()=>x(!0),children:[e.jsx(ot,{className:"h-4 w-4"}),u("manage_collections")]}),e.jsx(et,{open:f,onOpenChange:x,fileId:String(s.file_id),addonTitle:s.title})]})]}),e.jsxs(O,{className:"p-6 space-y-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:u("media_links")}),e.jsxs("div",{children:[e.jsx(q,{htmlFor:"youtube",children:u("youtube_label")}),e.jsx(V,{id:"youtube",value:s.youtubeLink,onChange:i=>A({youtubeLink:i.target.value}),placeholder:"https://www.youtube.com/watch?v=..."})]})]}),e.jsxs(O,{className:"p-6 space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:u("options_title")}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[{key:"dragDrop",icon:ct,label:u("opt_drag_drop"),desc:u("opt_drag_drop_desc"),checked:s.dragAndDrop,toggle:()=>A({dragAndDrop:!s.dragAndDrop})},{key:"autoInstall",icon:Oe,label:u("opt_auto_install"),desc:u("opt_auto_install_desc"),checked:s.autoInstall,toggle:()=>{s.autoInstall?A({autoInstall:!1}):k(!0)}},{key:"donations",icon:bs,label:u("opt_donations"),desc:u("opt_donations_desc"),checked:s.donationButtons,toggle:()=>A({donationButtons:!s.donationButtons})},{key:"fictional",icon:Ye,label:u("opt_fictional"),desc:u("opt_fictional_desc"),checked:s.fictional,toggle:()=>A({fictional:!s.fictional})}].map(i=>e.jsxs("button",{type:"button",onClick:i.toggle,className:`relative flex flex-col items-center text-center gap-2 p-4 rounded-lg border-2 transition-all cursor-pointer ${i.checked?"border-primary bg-primary/5":"border-border hover:border-muted-foreground
6/30 bg-card/80"}`,children:[i.checked&&e.jsx("div",{className:"absolute top-2 right-2",children:e.jsx(ae,{className:"h-3.5 w-3.5 text-primary"})}),e.jsx("div",{className:`p-2 rounded-lg ${i.checked?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"}`,children:e.jsx(i.icon,{className:"h-5 w-5"})}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:i.label}),e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:i.desc})]},i.key))})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(g,{onClick:Z,disabled:w,className:"gap-2",children:[e.jsx(ls,{className:"h-4 w-4"}),u(w?"saving":"save_changes")]})}),e.jsx(ce,{open:L,onOpenChange:k,children:e.jsxs(de,{className:"max-w-md",children:[e.jsxs(Ne,{children:[e.jsxs(we,{className:"flex items-center gap-2",children:[e.jsx(Oe,{className:"h-5 w-5 text-primary"}),u("opt_auto_install")]}),e.jsx(Ce,{className:"text-left pt-2 leading-relaxed",children:u("auto_install_info")})]}),e.jsxs(Se,{className:"flex-col sm:flex-row gap-2 pt-2",children:[e.jsx(g,{variant:"outline",asChild:!0,className:"gap-2",children:e.jsxs("a",{href:"https://flightsim.to/support/article/flightsim-to-auto-installer",target:"_blank",rel:"noopener noreferrer",children:[e.jsx(We,{className:"h-4 w-4"}),u("auto_install_learn_more")]})}),e.jsx(g,{onClick:()=>{A({autoInstall:!0}),k(!1)},children:u("auto_install_confirm")})]})]})})]})},_t=({data:s,setData:c,addonId:n,addonSlug:j})=>{const[f,x]=o.useState("silent"),[w,h]=o.useState(""),[a,t]=o.useState(""),[S,z]=o.useState(null),[L,k]=o.useState(""),[u,v]=o.useState(s.version),[d,p]=o.useState(!1),[F,T]=o.useState(""),[I,U]=o.useState(""),M=o.useRef(null),C=Rs(s.file_id),{t:m}=Q("editUpload"),$=/[^a-zA-Z0-9._\-() ]/,A=r=>{const N=r.name.substring(r.name.lastIndexOf(".")).toLowerCase(),l=r.name.substring(0,r.name.lastIndexOf("."));return N!==".zip"&&N!==".rar"?(_.error(m("only_zip_rar")),!1):$.test(l)?(_.error(m("invalid_filename")),!1):r.size>3758096384?(_.error(m("file_exceeds_limit")),!1):!0},H=r=>{var N;const D=(N=r.target.files)==null?void 0:N[0];D&&A(D)&&C.selectFile(D)},R=r=>{r.preventDefault();const D=r.dataTransfer.files[0];D&&A(D)&&C.selectFile(D)},G=r=>{if(r===0)return"0 B";const D=1024,N=["B","KB","MB","GB"],l=Math.floor(Math.log(r)/Math.log(D));return`${(r/Math.pow(D,l)).toFixed(1)} ${N[l]}`},P=C.status==="uploading",B=C.status==="paused",K=C.status==="complete",Z=C.status==="error",i=!!C.file;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(O,{className:"p-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:m("push_update")}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:m("push_update_desc")})]}),e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[e.jsx("span",{className:"inline-flex items-center justify-center h-6 w-6 rounded-full bg-primary text-primary-foreground text-xs font-bold shrink-0",children:"1"}),m("step_select_file")]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:m("step_select_file_desc")})]}),!i&&C.status==="idle"&&e.jsx(ns,{onFileDrop:R,onClick:()=>{var r;return(r=M.current)==null?void 0:r.click()},icon:e.jsx(je,{className:"h-10 w-10 mx-auto mb-3"}),label:m("click_upload_or_drag"),hint:m("zip_rar_hint"),children:e.jsx("input",{ref:M,type:"file",className:"hidden",accept:".zip,.rar",onChange:H})}),i&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border bg-muted/30 p-4",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(ss,{className:"h-5 w-5 text-muted-foreground shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:C.file.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:G(C.totalBytes)})]})]}),!P&&!K&&e.jsx(g,{variant:"ghost",size:"icon",onClick:C.reset,className:"shrink-0",children:e.jsx(te,{className:"h-4 w-4"})}),K&&e.jsxs(ge,{variant:"default",className:"gap-1 shrink-0",children:[e.jsx(ae,{className:"h-3 w-3"})," ",m("uploaded_badge")]})]}),(P||B||K)&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(ys,{value:C.progress,className:"h-2.5"}),e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{children:[G(C.uploadedBytes)," / ",G(C.totalBytes),B&&` — ${m("paused_label")}`]}),e.jsxs("span",{children:[C.chunksCompleted," / ",C.chunksTotal," chunks · ",C.progress,"%"]})]})]}),Z&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive bg-destructive/10 rounded-lg p-3",children:[e.jsx(_e,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{children:C.error}),e.jsx(g,{variant:"outline",size:"sm",className:"ml-auto shrink-0",onClick:C.resume,children:m("retry")})]}),i&&!K&&e.jsxs("div",{className:"flex items-center gap-2",children:[!P&&!B&&C.status==="error"&&e.jsxs(g,{onClick:C.startUpload,className:"gap-2",children:[e.jsx(je,{className:"h-4 w-4"}),m("retry_upload")]}),P&&e.jsxs(g,{variant:"outline",onClick:C.pause,className:"gap-2",children:[e.jsx(X,{className:"h-4 w-4 animate-spin"}),m("pause")]}),B&&e.jsxs(g,{onClick:C.resume,className:"gap-2",children:[e.jsx(je,{className:"h-4 w-4"}),m("resume")]}),(P||B)&&e.jsx(g,{variant:"ghost",onClick:C.cancel,children:m("cancel")})]})]})]}),e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[e.jsx("span",{className:"inline-flex items-center justify-center h-6 w-6 rounded-full bg-primary text-primary-foreground text-xs font-bold shrink-0",children:"2"}),m("step_target")]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:m("step_target_desc")})]}),e.jsxs(le,{value:a,onValueChange:r=>{t(r),r==="__new__"&&x("silent")},children:[e.jsx(ne,{className:"mt-1",children:e.jsx(ie,{placeholder:m("select_file_replace")})}),e.jsxs(oe,{children:[s.attachments.map(r=>e.jsxs(Y,{value:String(r.id),children:[e.jsx("span",{className:"font-medium",children:r.title||"Untitled"}),e.jsx("span",{className:"mx-1.5 text-muted-foreground",children:"|"}),e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:r.name}),e.jsx("span",{className:"mx-1.5 text-muted-foreground",children:"|"}),e.jsx("span",{className:"text-muted-foreground",children:r.size})]},r.id)),e.jsx(Y,{value:"__new__",children:m("upload_additional")})]})]})]}),a==="__new__"&&e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx(q,{htmlFor:"new-file-title",children:m("file_title_label")}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:m("file_title_desc")})]}),e.jsx(V,{id:"new-file-title",value:I,onChange:r=>U(r.target.value),placeholder:m("file_title_placeholder"),className:"mt-1"})]}),e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[e.jsx("span",{className:"inline-flex items-center justify-center h-6 w-6 rounded-full bg-primary text-primary-foreground text-xs font-bold shrink-0",children:"3"}),m("step_update_type")]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:m("step_update_type_desc")})]}),a==="__new__"?e.jsxs(e.Fragment,{children:[e.jsxs(le,{value:"silent",disabled:!0,children:[e.jsx(ne,{className:"mt-1 opacity-60",children:e.jsx(ie,{})}),e.jsx(oe,{children:e.jsx(Y,{value:"silent",children:m("silent_update")})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:m("additional_silent_note")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(le,{value:f,onValueChange:r=>x(r),children:[e.jsx(ne,{className:"mt-1",children:e.jsx(ie,{})}),e.jsxs(oe,{children:[e.jsx(Y,{value:"silent",children:m("silent_update")}),e.jsx(Y,{value:"major",children:m("major_update")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:m(f==="silent"?"silent_update_desc":"major_update_desc")})]})]}),f==="major"&&a!=="__new__"&&e.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[e.jsx("span",{className:"inline-flex items-center justify-center h-6 w-6 rounded-full bg-primary text-primary-foreground text-xs font-bold shrink-0",children:"4"}),m("step_release_details")]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:m("step_release_details_desc")})]}),e.jsxs("div",{children:[e.jsx(q,{htmlFor:"new-version",children:m("version_number")}),e.jsx(V,{id:"new-version",value:u,onChange:r=>v(r.target.value),placeholder:"e.g. 2.0.0",className:"mt-1 font-mono"})]}),e.jsxs("div",{children:[e.jsx(q,{htmlFor:"changelog",children:m("changelog_label")}),e.jsx(me,{id:"changelog",value:w,onChange:r=>
6h(r.target.value),rows:5,placeholder:m("changelog_placeholder"),className:"mt-1"})]})]}),e.jsx(Zs,{}),e.jsxs(g,{onClick:async()=>{const r=a==="__new__",D=r?null:Number(a)||null;try{const N=f==="major"?u:s.version;await Us({file_id:s.file_id,attachment_id:D,is_additional:r,update_type:r?"silent":f,version:N,changelog:f==="major"&&!r?w:"",filename:C.filename??"",size:G(C.totalBytes),...r&&I?{title:I}:{}}),T(N),p(!0),C.reset(),h(""),t(""),x("silent"),U("")}catch(N){_.error(N.message||m("push_update_error"))}},disabled:!K||!C.filename,className:"w-full gap-2",children:[e.jsx(je,{className:"h-4 w-4"}),m("push_update")]}),!K&&i&&e.jsx("p",{className:"text-xs text-muted-foreground",children:m("upload_must_complete")})]}),e.jsxs(O,{className:"p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground mb-1",children:m("current_version")}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["Version ",e.jsx("span",{className:"font-mono font-semibold text-foreground",children:s.version})," · ",s.simulator]}),s.attachments.length>0&&e.jsx("div",{className:"border border-border rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border bg-muted/50",children:[e.jsx("th",{className:"text-left px-4 py-2.5 font-medium text-muted-foreground",children:m("col_name")}),e.jsx("th",{className:"text-left px-4 py-2.5 font-medium text-muted-foreground",children:m("col_title")}),e.jsx("th",{className:"text-left px-4 py-2.5 font-medium text-muted-foreground",children:m("col_version")}),e.jsx("th",{className:"text-left px-4 py-2.5 font-medium text-muted-foreground",children:m("col_size")}),e.jsx("th",{className:"text-right px-4 py-2.5 font-medium text-muted-foreground",children:m("col_action")})]})}),e.jsx("tbody",{children:s.attachments.map(r=>e.jsxs("tr",{className:"border-b last:border-b-0 border-border",children:[e.jsx("td",{className:"px-4 py-2.5 text-foreground font-mono text-xs truncate max-w-[200px]",children:r.name}),e.jsx("td",{className:"px-4 py-2.5 text-foreground",children:r.title||"—"}),e.jsx("td",{className:"px-4 py-2.5 text-foreground font-mono text-xs",children:r.version||"—"}),e.jsx("td",{className:"px-4 py-2.5 text-muted-foreground",children:r.size}),e.jsx("td",{className:"px-4 py-2.5 text-right",children:e.jsxs(g,{variant:"ghost",size:"sm",className:"h-7 gap-1.5",onClick:()=>{k(r.title),z(r)},children:[e.jsx(Je,{className:"h-3.5 w-3.5"}),m("manage")]})})]},r.id))})]})}),s.attachments.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:m("no_files_attached")})]}),S&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"fixed inset-0 bg-black/60",onClick:()=>z(null)}),e.jsxs("div",{className:"relative z-50 w-full max-w-md rounded-lg border border-border bg-background p-6 shadow-lg",children:[e.jsx("button",{onClick:()=>
6z(null),className:"absolute right-4 top-4 rounded-sm opacity-70 hover:opacity-100",children:e.jsx(te,{className:"h-4 w-4"})}),e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-1",children:m("manage_attachment")}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4 font-mono truncate",children:S.name}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(q,{htmlFor:"attachment-title",children:m("col_title")}),e.jsx(V,{id:"attachment-title",value:L,onChange:r=>k(r.target.value),placeholder:"e.g. Main, 4K Textures, Patch...",className:"mt-1.5"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs(g,{variant:"destructive",size:"sm",className:"gap-1.5",onClick:async()=>{try{await Ps(s.file_id,S.id),c(r=>r&&{...r,attachments:r.attachments.filter(D=>D.id!==S.id)}),_.success(m("attachment_deleted")),z(null)}catch(r){_.error(r.message||m("delete_attachment_error"))}},children:[e.jsx(Re,{className:"h-3.5 w-3.5"}),m("delete")]}),e.jsxs(g,{size:"sm",onClick:async()=>{try{await Vs(s.file_id,S.id,L),c(r=>r&&{...r,attachments:r.attachments.map(D=>D.id===S.id?{...D,title:L}:D)}),_.success(m("attachment_updated")),z(null)}catch(r){_.error(r.message||m("update_attachment_error"))}},children:[e.jsx(ls,{className:"h-3.5 w-3.5 mr-1.5"}),m("save")]})]})]})]})]}),e.jsx(ft,{open:d,onOpenChange:p,addonId:n,addonSlug:j,version:F})]})},Nt=({data:s,setData:c})=>{const n=o.useRef(null),[j,f]=o.useState(!1),[x,w]=o.useState(null),[h,a]=o.useState(null),{t}=Q("editUpload"),S=[...s.images].sort((v,d)=>v.sortOrder-d.sortOrder),z=async v=>{c(d=>({...d,images:v}));try{await Xs(s.file_id,v.map(d=>({id:d.id,sort_order:d.sortOrder})))}catch(d){_.error(d.message||t("image_reorder_error"))}},L=(v,d)=>{if(v===d)return;const p=[...S],F=p.findIndex(M=>M.id===v),T=p.findIndex(M=>M.id===d);if(F<0||T<0)return;const[I]=p.splice(F,1);p.splice(T,0,I);const U=p.map((M,C)=>({...M,sortOrder:C}));z(U)},k=async v=>{c(d=>({...d,images:d.images.filter(p=>p.id!==v)}));try{await Ks(s.file_id,v),_.success(t("image_removed"))}catch(d){_.error(d.message||t("image_delete_error"))}},u=async v=>{const d=v.target.files;if(!(!d||d.length===0)){f(!0);try{for(const p of Array.from(d)){const F=await Hs(s.file_id,p);c(T=>({...T,images:[...T.images,{id:F.id,url:F.url,isMain:F.is_main,sortOrder:F.sort_order}]}))}_.success(t("images_uploaded",{count:d.length}))}catch(p){_.error(p.message||t("image_upload_error"))}finally{f(!1),n.current&&(n.current.value="")}}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(O,{className:"p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground mb-1",children:t("gallery_title",{count:S.length})}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:t("gallery_hint")}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:S.map((v,d)=>{const p=x===v.id,F=h===v.id&&x!==v.id;return e.jsxs("div",{draggable:S.length>1,onDragStart:()=>w(v.id),onDragEnter:T=>{T.preventDefault(),a(v.id)},onDragOver:T=>{T.preventDefault(),a(v.id)},onDrop:T=>{T.preventDefault();const I=x;a(null),w(null),I&&L(I,v.id)},onDragEnd:()=>{w(null),a(null)},className:_s("relative group rounded-lg overflow-hidden border bg-secondary transition-all",p?"opacity-40 ring-2 ring-primary border-primary":"border-border",F?"ring-2 ring-primary/50 scale-[1.02]":""),children:[e.jsxs("div",{className:"absolute top-2 right-2 z-20 opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1.5",children:[S.length>1&&e.jsx(g,{size:"icon-sm",variant:"secondary",className:"cursor-grab active:cursor-grabbing",onClick:T=>T.preventDefault(),"aria-label":t("reorder_image"),children:e.jsx(dt,{className:"h-4 w-4"})}),e.jsx(g,{size:"icon-sm",variant:"destructive",onClick:()=>k(v.id),children:e.jsx(Re,{className:"h-4 w-4"})})]}),e.jsx("img",{src:v.url,alt:`Image ${d+1}`,className:"w-full aspect-video object-cover",draggable:!1}),d===0&&e.jsx(ge,{className:"absolute top-2 left-2 bg-primary text-primary-foreground text-xs",children:t("main_badge")}),S.length>1&&e.jsx("div",{className:"absolute bottom-2 left-1/2 -translate-x-1/2 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx("span",{className:"text-[10px] uppercase tracking-wider font-medium text-white/90 bg-black/60 px-2 py-1 rounded-full",children:t("drag_to_reorder")})})]},v.id)})})]}),e.jsxs(O,{className:"p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground mb-4",children:t("upload_new_images")}),e.jsx(ns,{onFileDrop:v=>{if(v.preventDefault(),!j&&v.dataTransfer.files.length){const d=n.current;if(d){const p=new DataTransfer;
6Array.from(v.dataTransfer.files).forEach(F=>p.items.add(F)),d.files=p.files,d.dispatchEvent(new Event("change",{bubbles:!0}))}}},onClick:()=>{var v;return!j&&((v=n.current)==null?void 0:v.click())},icon:j?e.jsx(X,{className:"h-10 w-10 mx-auto mb-3 animate-spin"}):e.jsx(mt,{className:"h-10 w-10 mx-auto mb-3"}),label:t(j?"uploading":"click_upload_images"),hint:t("image_hint"),disabled:j,children:e.jsx("input",{ref:n,type:"file",className:"hidden",accept:"image/*",multiple:!0,onChange:u})})]})]})},wt=({data:s,setData:c})=>{const{t:n}=Q("editUpload"),[j,f]=o.useState(""),[x,w]=o.useState([]),[h,a]=o.useState(!1),[t,S]=o.useState("required"),[z,L]=o.useState(!1),k=o.useRef(null),[u,v]=o.useState(""),[d,p]=o.useState(""),[F,T]=o.useState(!1),[I,U]=o.useState(""),[M,C]=o.useState(""),[m,$]=o.useState(!1),[A,H]=o.useState(null),[R,G]=o.useState(""),[P,B]=o.useState(""),[K,Z]=o.useState(!1);o.useEffect(()=>{if(k.current&&clearTimeout(k.current),j.trim().length<2){w([]);return}return a(!0),k.current=setTimeout(async()=>{try{const{searchDependencies:l}=await J(async()=>{const{searchDependencies:E}=await import("./moreTabApi-CnhEVbZy.js");return{searchDependencies:E}},[]),b=await l(j.trim()),y=new Set(s.dependencies.map(E=>E.id));w(b.filter(E=>!y.has(E.id)))}catch{w([])}finally{a(!1)}},300),()=>{k.current&&clearTimeout(k.current)}},[j,s.dependencies]);const i=async l=>{L(!0);try{const{addDependency:b}=await J(async()=>{const{addDependency:E}=await import("./moreTabApi-CnhEVbZy.js");return{addDependency:E}},[]);await b(s.file_id,l.id,t);const y={...l,type:t};c(E=>({...E,dependencies:[...E.dependencies,y]})),f(""),w([]),_.success(n("dep_added"))}catch(b){_.error(b.message||n("dep_add_error"))}finally{L(!1)}},r=async l=>{try{const{deleteDependency:b}=await J(async()=>{const{deleteDependency:y}=await import("./moreTabApi-CnhEVbZy.js");return{deleteDependency:y}},[]);await b(s.file_id,l),c(y=>({...y,dependencies:y.dependencies.filter(E=>E.id!==l)})),_.success(n("dep_removed"))}catch(b){_.error(b.message||n("dep_remove_error"))}},D=async()=>{const l=u.trim(),b=d.trim();if(l){T(!0);try{const{addContributor:y}=await J(async()=>{const{addContributor:W}=await import("./moreTabApi-CnhEVbZy.js");return{addContributor:W}},[]),Fe=(await y(s.file_id,l,b||"Contributor")).data??{id:Date.now(),username:l,role:b||"Contributor"};c(W=>({...W,contributors:[...W.contributors,Fe]})),v(""),p(""),_.success(n("contributor_added"))}catch(y){_.error(y.message||n("contributor_add_error"))}finally{T(!1)}}},N=async l=>{try{const{deleteContributor:b}=await J(async()=>{const{deleteContributor:y}=await import("./moreTabApi-CnhEVbZy.js");return{deleteContributor:y}},[]);await b(s.file_id,l),c(y=>({...y,contributors:y.contributors.filter(E=>E.id!==l)})),_.success(n("contributor_removed"))}catch(b){_.error(b.message||n("contributor_remove_error"))}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(O,{className:"p-6 space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:n("dependencies_title")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n("dependencies_desc")}),e.jsxs("div",{className:"flex gap-2 items-end",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(q,{className:"text-xs text-muted-foreground",children:n("search_addon")}),e.jsx(V,{value:j,onChange:l=>f(l.target.value),placeholder:n("search_addon_placeholder")}),j.trim().length>=2&&e.jsx("div",{className:"absolute z-20 left-0 right-0 top-full mt-1 bg-popover border border-border rounded-md shadow-lg max-h-52 overflow-y-auto",children:h?e.jsxs("div",{className:"p-3 text-sm text-muted-foreground flex items-center gap-2",children:[e.jsx(X,{className:"h-3.5 w-3.5 animate-spin"})," ",n("searching")]}):x.length===0?e.jsx("div",{className:"p-3 text-sm text-muted-foreground",children:n("no_results")}):x.map(l=>e.jsx("button",{type:"button",disabled:z,onClick:()=>i(l),className:"w-full text-left px-3 py-2 text-sm hover:bg-accent transition-colors disabled:opacity-50",children:l.title},l.id))})]}),e.jsxs("div",{className:"w-40",children:[e.jsx(q,{className:"text-xs text-muted-foreground",children:n("dep_type_label")}),e.jsxs(le,{value:t,onValueChange:l=>S(l),children:[e.jsx(ne,{children:e.jsx(ie,{})}),e.jsxs(oe,{children:[e.jsx(Y,{value:"required",children:n("dep_required")}),e.jsx(Y,{value:"recommended",children:n("dep_recommended")})]})]})]})]}),s.dependencies.length>0&&e.jsx("div",{className:"space-y-2",children:s.dependencies.map(l=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-secondary/50 border border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ss,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-foreground",children:l.title}),e.jsx(ge,{variant:l.type==="required"?"default":"secondary",className:"text-[10px] capitalize",children:l.type==="required"?n("dep_required"):n("dep_recommended")})]}),e.jsx(g,{size:"icon-sm",variant:"ghost",onClick:()=>r(l.id),children:e.jsx(te,{className:"h-3.5 w-3.5"})})]},l.id))})]}),e.jsxs(O,{className:"p-6 space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:n("contributors_title")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n("contributors_desc")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(V,{value:u,onChange:l=>v(l.target.value),placeholder:n("username_placeholder"),className:"flex-1",onKeyDown:l=>l.key==="Enter"&&(l.preventDefault(),D())}),e.jsx(V,{value:d,onChange:l=>p(l.target.value),placeholder:n("role_placeholder"),className:"w-44",onKeyDown:l=>l.key==="Enter"&&(l.preventDefault(),D())}),e.jsx(g,{variant:"secondary",onClick:D,disabled:F||!u.trim(),children:F?e.jsx(X,{className:"h-4 w-4 animate-spin"}):e.jsx(ze,{className:"h-4 w-4"})})]}),s.contributors.length>0&&e.jsx("div",{className:"space-y-2",children:s.contributors.map(l
6=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-secondary/50 border border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[l.avatar?e.jsx("img",{src:l.avatar,alt:l.username,className:"h-6 w-6 rounded-full object-cover"}):e.jsx("div",{className:"h-6 w-6 rounded-full bg-muted flex items-center justify-center text-xs font-medium text-muted-foreground",children:l.username.charAt(0).toUpperCase()}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:l.username}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",l.role,")"]})]}),e.jsx(g,{size:"icon-sm",variant:"ghost",onClick:()=>N(l.id),children:e.jsx(te,{className:"h-3.5 w-3.5"})})]},l.id))})]}),e.jsxs(O,{className:"p-6 space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:n("faq_title")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n("faq_desc")}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(V,{value:I,onChange:l=>U(l.target.value),placeholder:n("faq_question_placeholder")}),e.jsx(me,{value:M,onChange:l=>C(l.target.value),placeholder:n("faq_answer_placeholder"),rows:3}),e.jsxs(g,{variant:"secondary",onClick:async()=>{const l=I.trim(),b=M.trim();if(!(!l||!b)){$(!0);try{const{addFaq:y}=await J(async()=>{const{addFaq:W}=await import("./moreTabApi-CnhEVbZy.js");return{addFaq:W}},[]),Fe=(await y(s.file_id,l,b)).data??{id:Date.now(),question:l,answer:b};c(W=>({...W,faq:[...W.faq,Fe]})),U(""),C(""),_.success(n("faq_added"))}catch(y){_.error(y.message||n("faq_add_error"))}finally{$(!1)}}},disabled:m||!I.trim()||!M.trim(),children:[m?e.jsx(X,{className:"h-4 w-4 animate-spin mr-2"}):e.jsx(ze,{className:"h-4 w-4 mr-2"}),n("faq_add")]})]}),s.faq&&s.faq.length>0&&e.jsx("div",{className:"space-y-2",children:s.faq.map(l=>e.jsx("div",{className:"p-3 rounded-lg bg-secondary/50 border border-border space-y-2",children:A===l.id?e.jsxs(e.Fragment,{children:[e.jsx(V,{value:R,onChange:b=>G(b.target.value),className:"text-sm"}),e.jsx(me,{value:P,onChange:b=>B(b.target.value),rows:3,className:"text-sm"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{size:"sm",variant:"secondary",disabled:K||!R.trim()||!P.trim(),onClick:async()=>{Z(!0);try{const{updateFaq:b}=await J(async()=>{const{updateFaq:y}=await import("./moreTabApi-CnhEVbZy.js");return{updateFaq:y}},[]);await b(s.file_id,l.id,R.trim(),P.trim()),c(y=>({...y,faq:y.faq.map(E=>E.id===l.id?{...E,question:R.trim(),answer:P.trim()}:E)})),H(null),_.success(n("faq_updated"))}catch(b){_.error(b.message||n("faq_update_error"))}finally{Z(!1)}},children:K?e.jsx(X,{className:"h-3.5 w-3.5 animate-spin"}):n("save")}),e.jsx(g,{size:"sm",variant:"ghost",onClick:()=>H(null),children:n("cancel")})]})]}):e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:l.question}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:l.answer})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx(g,{size:"icon-sm",variant:"ghost",onClick:()=>{H(l.id),G(l.question),B(l.answer)},children:e.jsx(Me,{className:"h-3.5 w-3.5"})}),e.jsx(g,{size:"icon-sm",variant:"ghost",onClick:async()=>{try{const{deleteFaq:b}=await J(async()=>{const{deleteFaq:y}=await import("./moreTabApi-CnhEVbZy.js");return{deleteFaq:y}},[]);await b(s.file_id,l.id),c(y=>({...y,faq:y.faq.filter(E=>E.id!==l.id)})),_.success(n("faq_removed"))}catch(b){_.error(b.message||n("faq_remove_error"))}},children:e.jsx(te,{className:"h-3.5 w-3.5"})})]})]})},l.id))})]})]})},Ct=({data:s})=>{const{stats:c}=s,{t:n}=Q("editUpload"),j={backgroundColor:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:"8px",color:"hsl(var(--foreground))"};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx(ve,{icon:Oe,label:n("stat_downloads"),value:c.totalDownloads.toLocaleString()}),e.jsx(ve,{icon:qe,label:n("stat_views"),value:c.totalViews.toLocaleStr
6ing()}),e.jsx(ve,{icon:ws,label:n("stat_avg_rating"),value:c.averageRating.toFixed(1)}),e.jsx(ve,{icon:es,label:n("stat_comments"),value:c.totalComments.toLocaleString()})]}),c.dailyViews&&c.dailyViews.length>0&&e.jsxs(O,{className:"p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground mb-4",children:n("daily_views")}),e.jsx("div",{className:"h-64",children:e.jsx(Ie,{width:"100%",height:"100%",children:e.jsxs(ht,{data:c.dailyViews,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"viewsGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"hsl(var(--primary))",stopOpacity:.25}),e.jsx("stop",{offset:"95%",stopColor:"hsl(var(--primary))",stopOpacity:0})]})}),e.jsx(Ee,{strokeDasharray:"3 3",stroke:"hsl(var(--border))"}),e.jsx(be,{dataKey:"date",stroke:"hsl(var(--muted-foreground))",fontSize:12,tickLine:!1,tickFormatter:f=>{try{return new Date(f).toLocaleDateString(void 0,{month:"short",day:"numeric"})}catch{return f}},interval:"preserveStartEnd"}),e.jsx(ye,{stroke:"hsl(var(--muted-foreground))",fontSize:12,tickLine:!1}),e.jsx(Le,{contentStyle:j,labelFormatter:f=>{try{return new Date(f).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"})}catch{return f}}}),e.jsx(pt,{type:"monotone",dataKey:"views",stroke:"hsl(var(--primary))",fill:"url(#viewsGradient)",strokeWidth:2,dot:!1})]})})})]}),e.jsxs(O,{className:"p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground mb-4",children:n("monthly_downloads")}),e.jsx("div",{className:"h-64",children:e.jsx(Ie,{width:"100%",height:"100%",children:e.jsxs(Ge,{data:c.monthlyDownloads,children:[e.jsx(Ee,{strokeDasharray:"3 3",stroke:"hsl(var(--border))"}),e.jsx(be,{dataKey:"month",stroke:"hsl(var(--muted-foreground))",fontSize:12}),e.jsx(ye,{stroke:"hsl(var(--muted-foreground))",fontSize:12}),e.jsx(Le,{contentStyle:j}),e.jsx($e,{dataKey:"downloads",fill:"hsl(var(--primary))",radius:[4,4,0,0]})]})})})]}),e.jsxs(O,{className:"p-6",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground mb-4",children:n("downloads_per_version")}),e.jsx("div",{className:"h-52",children:e.jsx(Ie,{width:"100%",height:"100%",children:e.jsxs(Ge,{data:c.downloadsPerVersion,children:[e.jsx(Ee,{strokeDasharray:"3 3",stroke:"hsl(var(--border))"}),e.jsx(be,{dataKey:"version",stroke:"hsl(var(--muted-foreground))",fontSize:12}),e.jsx(ye,{stroke:"hsl(var(--muted-foreground))",fontSize:12}),e.jsx(Le,{contentStyle:j}),e.jsx($e,{dataKey:"downloads",fill:"hsl(var(--accent))",radius:[4,4,0,0]})]})})})]})]})},ve=({icon:s,label:c,value:n})=>e.jsxs(O,{className:"p-5 flex flex-col items-center text-center",children:[e.jsx(s,{className:"h-5 w-5 text-muted-foreground mb-2"}),e.jsx("p",{className:"text-2xl font-bold text-foreground",children:n}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:c})]}),St=({data:s,setData:c})=>{const n=Xe(),[j,f]=o.useState(!1),[x,w]=o.useState(!1),[h,a]=o.useState(!1),{t}=Q("editUpload"),S=async k=>{f(!0);try{await Ys(s.file_id,k),c(u=>({...u,isHidden:k})),_.success(t(k?"upload_hidden":"upload_visible"))}catch(u){_.error(u instanceof Error?u.message:t("visibility_error"))}finally{f(!1)}},z=async()=>{w(!0);try{const k=await Ws(s.file_id);_.success(k.message||t("delete_success")),n("/user/uploads")}catch(k){_.error(k instanceof Error?k.message:t("delete_error"))}finally{w(!1)}},L=async k=>{a(!0);try{await Qs(s.file_id,k),c(u=>({...u,notificationsEnabled:k})),_.success(t(k?"notifications_enabled":"notifications_disabled"))}catch(u){_.error(u instanceof Error?u.message:t("notifications_error"))}finally{a(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(O,{className:"p-6 space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:t("notifications_title")}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-secondary/50 border border-border",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[e.jsx(Cs,{className:"h-4 w-4 text-muted-foreground"}),t("notifications_label")]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t("notifications_desc")})]}),e.jsx(Be,{checked:s.notificationsEnabled,disabled:h,onCheckedChange:L})]}),!s.notificationsEnabled&&e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-muted/50 border border-border",children:[e.jsx(gt,{className:"h-4 w-4 text-muted-foreground shrink-0"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("notifications_disabled_notice")})]})]}),e.jsxs(O,{className:"p-6 space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:t("visibility_title")}),e.jsxs("div",{className:"flex items-center justify-between p-4 rounded-lg bg-secondary/50 border border-border",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[e.jsx(He,{className:"h-4 w-4 text-muted-foreground"}),t("visibility_label")]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t("visibility_desc")})]}),e.jsx(Be,{checked:s.isHidden,disabled:j,onCheckedChange:S})]}),s.isHidden&&e.jsxs("div",{className:"flex items-center gap-2 p-3 rounded-lg bg-amber-500/10 border border-amber-500/30",children:[e.jsx(He,{className:"h-4 w-4 text-amber-400 shrink-0"}),e.jsx("p",{className:"text-xs text-amber-400",children:t("visibility_hidden_notice")})]})]}),e.jsxs(O,{className:"p-6 border-destructive/30",children:[e.jsx("h2",{className:"text-lg font-semibold text-destructive mb-2",children:t("danger_zone")}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:t("danger_desc")}),e.jsxs(Ss,{children:[e.jsx(ks,{asChild:!0,children:e.jsxs(g,{variant:"destructive",className:"gap-2",disabled:x,children:[e.jsx(Re,{className:"h-4 w-4"}),t("delete_upload")]})}),e.jsxs(Ds,{children:[e.jsxs(As,{children:[e.jsxs(Ts,{className:"flex items-center gap-2",children:[e.jsx(_e,{className:"h-5 w-5 text-destructive"}),t("delete_upload")]}),e.jsx(Fs,{asChild:!0,children:e.jsx("p",{dangerouslySetInnerHTML:{__html:t("delete_dialog_desc",{title:s.title})}})})]}),e.jsxs(Is,{children:[e.jsx(Es,{disabled:x,children:t("cancel")}),e.jsx(Ls,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:x,onClick:z,children:t(x?"deleting":"delete_permanently")})]})]})]})]})]})};function Qe({entries:s,latestId:c,openEdit:n}){const{t:j}=Q("editUpload"),f=x=>new Date(x).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"});return e.jsx("div",{className:"space-y-3",children:s.map(x=>{const w=x.id===c;return e.jsxs("div",{className:"border border-border rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(ge,{variant:w?"default":"outline",className:"font-mono",children:["v",x.version]}),w&&e.jsx("span",{className:"text-xs text-primary font-medium",children:j("latest")})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:f(x.date)}),w&&e.jsx(g,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>n(x),children:e.jsx(Me,{className:"h-3.5 w-3.5"})})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:x.content.replace(/\\r\\n|\\r|\\n/g,`
7`)})]},x.id)})})}const kt=({data:s,setData:c})=>
7{const[n,j]=o.useState(null),[f,x]=o.useState(""),[w,h]=o.useState(!1),{t:a}=Q("editUpload"),t=o.useMemo(()=>[...s.changelogs].sort((d,p)=>p.timestamp-d.timestamp),[s.changelogs]),S=t.length>0?t[0].id:null,z=o.useMemo(()=>{const d=new Map;for(const p of t){const F=p.fileItemId!=null?String(p.fileItemId):"general";if(!d.has(F)){let T="General";if(p.fileItemId!=null){const I=s.attachments.find(U=>U.id===p.fileItemId);T=(I==null?void 0:I.title)||`File #${p.fileItemId}`}else s.attachments.length>0&&(T=s.attachments[0].title||"General");d.set(F,{label:T,entries:[]})}d.get(F).entries.push(p)}return d},[t,s.attachments]),L=Array.from(z.keys()),k=L.length>1,u=d=>{x(d.content),j(d)},v=async()=>{if(n){h(!0);try{await Gs(s.file_id,n.id,f),c(d=>d&&{...d,changelogs:d.changelogs.map(p=>p.id===n.id?{...p,content:f}:p)}),_.success(a("changelog_updated")),j(null)}catch(d){_.error(d.message||a("changelog_update_error"))}finally{h(!1)}}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(O,{className:"p-6",children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2 mb-4",children:[e.jsx(rs,{className:"h-5 w-5"}),a("version_history_title")]}),t.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:a("no_version_history")}):k?e.jsxs(ts,{defaultValue:L[0],children:[e.jsx(as,{className:"mb-3 h-auto flex-wrap gap-1",children:L.map(d=>{const p=z.get(d);return e.jsxs(ee,{value:d,className:"text-xs gap-1.5",children:[e.jsx(Ns,{className:"h-3.5 w-3.5"}),p.label]},d)})}),L.map(d=>{const p=z.get(d);return e.jsx(se,{value:d,className:"mt-0",children:e.jsx(Qe,{entries:p.entries,latestId:S,openEdit:u})},d)})]}):e.jsx(Qe,{entries:t,latestId:S,openEdit:u})]}),e.jsx(ce,{open:!!n,onOpenChange:d=>!d&&j(null),children:e.jsxs(de,{className:"sm:max-w-lg",children:[e.jsxs(Ne,{children:[e.jsx(we,{children:a("edit_changelog_title",{version:n==null?void 0:n.version})}),e.jsx(Ce,{children:a("edit_changelog_desc")})]}),e.jsx(me,{value:f,onChange:d=>x(d.target.value),rows:8,placeholder:a("changelog_edit_placeholder")}),e.jsxs(Se,{children:[e.jsx(g,{variant:"outline",onClick:()=>j(null),children:a("cancel")}),e.jsxs(g,{onClick:v,disabled:w,children:[w&&e.jsx(X,{className:"h-4 w-4 mr-2 animate-spin"}),a("save_changes")]})]})]})})]})};export{ua 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.