1import{r as j,ah as X,j as e,X as q,K as le,d as ye,h as V,I as m,ao as pe,ap as L,aq as B,ar as I,as as H,at as E,J as f,B as z,x as ge,D as be,s as $,k as Ne,a as F,l as re,F as oe,a2 as Ce,g as fe,af as we,a6 as Se,a7 as ke,a8 as Te,a9 as Me,t as Q,an as se,G as Ae}from"./index-C4LWZPK9.js";import{T as Pe}from"./textarea-G6LYtFU8.js";import{T as Re,a as Ee,b as W,c as K,d as Le,e as U}from"./table-DCqWGOx9.js";import{T as Be,a as Ie,b as Y,c as Z}from"./tabs-k4Vtuswt.js";import{u as je}from"./useMobile-CP8-DlZL.js";import{F as ae}from"./FileUploader-DVCKECt2.js";import{P as ze}from"./progress-BTkBigNi.js";import{C as ce}from"./circle-check-Cx31KQzm.js";import{E as Ue}from"./external-link-lrsG04FH.js";import{U as Ve}from"./upload-CkiK-kaT.js";import{U as He}from"./users-round-Chmwqkee.js";import{M as J}from"./MobileSelectDrawer-EsQoSWfE.js";import{E as De}from"./eye-BuNnJwN2.js";import{P as ve}from"./plus-Nk5sUbpA.js";import{P as Ge}from"./pencil-DiYrB8i9.js";function de({value:a,onReady:n,onClear:x}){const[p,h]=j.useState("idle"),[T,o]=j.useState(0),[v,w]=j.useState(null),[r,d]=j.useState(""),c=j.useRef(null),M=j.useRef(null),_=()=>
1{M.current&&clearInterval(M.current)},D=l=>{_(),M.current=setInterval(async()=>{try{const S=(await V.functions.invoke("muxAssetStatus",{upload_id:l})).data;S.status==="ready"&&S.playback_url?(_(),h("ready"),n({playback_url:S.playback_url,thumbnail_url:S.thumbnail_url,duration_seconds:S.duration_seconds,asset_id:S.asset_id,caption_tracks:S.caption_tracks})):S.status==="errored"?(_(),h("error"),d("Mux transcoding failed.")):S.error&&(_(),h("error"),d("Status check failed."))}catch(N){console.error("Polling error:",N)}},4e3)},u=async l=>{if(!l)return;const N=5*1024*1024*1024;if(l.size>N){h("error"),d("File too large. Maximum size is 5GB.");return}if(l.size>1024*1024*1024){const g=(l.size/1073741824).toFixed(2);if(!confirm(`This is a large file (${g}GB). Upload may take 10-30 minutes depending on your connection. Continue?`))return}h("getting_url"),o(0),d("");const S=await V.functions.invoke("muxUpload",{}),{upload_url:s,upload_id:i}=S.data;w(i),h("uploading"),await new Promise((g,P)=>{const k=new XMLHttpRequest;k.open("PUT",s),k.timeout=36e5,k.setRequestHeader("Content-Type",l.type||"video/mp4"),k.upload.onprogress=b=>{if(b.lengthComputable){o(Math.round(b.loaded/b.total*100));const t=(b.loaded/(1024*1024)).toFixed(1),A=(b.total/(1024*1024)).toFixed(1);console.log(`Upload progress: ${t}MB / ${A}MB (${Math.round(b.loaded/b.total*100)}%)`)}},k.onload=()=>{var b;if(console.log("XHR onload:",k.status,k.responseText),k.status>=200&&k.status<300)g();else{const t=`Upload failed (status ${k.status}): ${(b=k.responseText)==null?void 0:b.slice(0,200)}`;console.error("Upload failed:",t),P(new Error(t))}},k.onerror=()=>{console.error("XHR onerror - network error. Upload URL:",s,"File size:",l.size);const b=Math.round(l.size/(1024*1024));P(new Error(`Upload failed (network error). File: ${b}MB. Check your connection and try again.`))},k.ontimeout=()=>{console.error("XHR ontimeout - file size:",l.size,"bytes");const b=(l.size/(1024*1024*1024)).toFixed(2);P(new Error(`Upload timed out after 60 minutes. For ${b}GB files, please ensure stable internet connection and try again.`))},k.send(l)}),h("processing"),D(i)},y=l=>{l.preventDefault();const N=l.dataTransfer.files[0];N!=null&&N.type.startsWith("video/")&&u(N)},C=()=>{_(),h("idle"),o(0),w(null),d(""),x==null||x()};return X.useEffect(()=>()=>{_()},[]),a&&p==="idle"?e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border border-border bg-secondary/30",children:[e.jsx(ce,{className:"w-5 h-5 text-accent shrink-0"}),e.jsx("p",{className:"text-sm text-muted-foreground truncate flex-1",children:"Video ready (Mux HLS)"}),e.jsxs("a",{href:a,target:"_blank",rel:"noreferrer",className:"text-xs text-primary flex items-center gap-0.5 hover:underline shrink-0",children:[e.jsx(Ue,{className:"w-3 h-3"})," Open"]}),e.jsx("button",{type:"button",onClick:C,className:"text-muted-foreground hover:text-destructive shrink-0",children:e.jsx(q,{className:"w-4 h-4"})})]}):p==="ready"?e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg border border-accent/40 bg-accent/5",children:[e.jsx(ce,{className:"w-5 h-5 text-accent shrink-0"}),e.jsx("p",{className:"text-sm font-medium text-accent flex-1",children:"Transcoding complete! Video is ready."}),e.jsx("button",{type:"button",onClick:C,className:"text-muted-foreground hover:text-destructive shrink-0",children:e.jsx(q,{className:"w-4 h-4"})})]}):p==="uploading"||p==="getting_url"?e.jsxs("div",{className:"p-4 rounded-lg border border-border bg-secondary/30 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{className:"w-4 h-4 text-primary animate-spin shrink-0"}),e.jsx("p",{className:"text-sm",children:p==="getting_url"?"Preparing upload...":`Uploading... ${T}%`})]}),p==="uploading"&&e.jsx(ze,{value:T,className:"h-1.5"})]}):p==="processing"?e.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg border border-border bg-secondary/30",children:[e.jsx(le,{className:"w-5 h-5 text-primary animate-spin shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Transcoding with Mux..."}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"This usually takes 1â3 minutes"})]})]}):p==="error"?e.jsxs("div",{className:"p-3 rounded-lg border border-destructive/40 bg-destructive/5 text-destructive text-sm flex items-center gap-2",children:[e.jsx(q,{className:"w-4 h-4 shrink-0"}),r,e.jsx("button",{type:"button",onClick:C,className:"ml-auto underline text-xs",children:"Retry"})]}):e.jsxs("div",{onDrop:y,onDragOver:l=>l.preventDefault(),onClick:()=>{var l;return(l=c.current)==null?void 0:l.click()},className:ye("border-2 border-dashed border-border rounded-lg p-6 flex flex-col items-center justify-center gap-2 cursor-pointer transition-colors hover:border-primary/50 hover:bg-primary/5"),children:[e.jsx(Ve,{className:"w-8 h-8 text-muted-foreground"}),e.jsx("p",{className:"text-sm font-medium",children:"Upload video for transcoding"}),e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Drag & drop or click · Mux will transcode to HLS automatically"}),e.jsx("input",{ref:c,type:"file",accept:"video/*",className:"hidden",onChange:l=>{var N;return u((N=l.target.files)==null?void 0:N[0])}})]})}const ne={Australia:["Sydney","Melbourne","Brisbane","Perth","Adelaide","Gold Coast","Cairns","Byron Bay","Noosa","Bondi"],"United States":["Los Angeles","New York","San Francisco","Miami","Honolulu","San Diego","Santa Cruz","Huntington Beach","Malibu","Pipeline (Hawaii)","Trestles","Jacksonville","Atlanta"],Brazil:["Rio de Janeiro","São Paulo","Florianópolis","Itacaré","Fernando de Noronha","Fortaleza","Recife","Búzios"],"South Africa":["Cape Town","Durban","Jeffreys Bay","Port Elizabeth","Hermanus","Muizenberg","Supertubes","Johannesburg"],Portugal:["Lisbon","Porto","Nazaré","Peniche","Ericeira","Cascais","Lagos","Sagres"],France:["Paris","Biarritz","Hossegor","Lacanau","Guéthary","Anglet","Nice","Marseille"],Spain:["Barcelona","Madrid","San Sebastián","Mundaka","Zarautz","Las Palmas","Tenerife","Fuerteventura"],Indonesia:["Bali","Lombok","Mentawai Islands","Nias","Sumbawa","Java","Sumatra"],"United Kingdom":["London","Bristol","Edinburgh","Newquay","Sennen Cove","St Ives","Croyde","Thurso"],Wales:["Cardiff","Swansea","Newport","Bangor","Aberystwyth","Brecon","Caernarfon","Tenby","Pembroke","Anglesey"],"New Zealand":["Auckland","Wellington","Christchurch","Raglan","Gisborne","Dunedin","Piha"],Japan:["Tokyo","Osaka","Kyoto","Chiba","Shonan","Niijima","Okinawa"],Mexico:["Mexico City","Puerto Escondido","Sayulita","Todos Santos","Ensenada","Punta Mita","Huatulco"],"Costa Rica":["San José","Tamarindo","N
1osara","Santa Teresa","Dominical","Pavones","Playa Hermosa"],Peru:["Lima","Mancora","Máncora","Punta Hermosa","Chicama","Lobitos"],Chile:["Santiago","Pichilemu","La Serena","Iquique","Arica"],Canada:["Vancouver","Toronto","Tofino","Ucluelet","Victoria","Montreal","Calgary"],Ireland:["Dublin","Cork","Galway","Bundoran","Lahinch","Mullaghmore","Achill Island"],Morocco:["Marrakech","Casablanca","Agadir","Essaouira","Taghazout","Dakhla"],Maldives:["Malé","North Malé Atoll","South Malé Atoll","Ari Atoll","Lhaviyani Atoll"],Philippines:["Manila","Siargao","Cebu","Palawan","La Union","Cloud 9"],Fiji:["Suva","Nadi","Tavarua","Cloudbreak","Namotu"],Tahiti:["Papeete","Teahupo'o","Moorea","Bora Bora","Huahine"],Hawaii:["Honolulu","Maui","Pipeline","Sunset Beach","Waimea Bay","Haleiwa","Jaws (Pe'ahi)"],Italy:["Rome","Milan","Venice","Naples","Sardinia","Sicily","Portofino"],Germany:["Berlin","Munich","Hamburg","Cologne","Frankfurt"],Norway:["Oslo","Bergen","Stavanger","Lofoten Islands","Unstad"],Sweden:["Stockholm","Gothenburg","Malmö"],Denmark:["Copenhagen","Aarhus","Klitmøller (Cold Hawaii)"],Netherlands:["Amsterdam","Rotterdam","Scheveningen","Zandvoort"],Greece:["Athens","Thessaloniki","Rhodes","Crete","Santorini","Mykonos","Corfu"],Thailand:["Bangkok","Phuket","Koh Samui","Chiang Mai","Krabi","Koh Lanta"],"Sri Lanka":["Colombo","Arugam Bay","Weligama","Hikkaduwa","Mirissa"],India:["Mumbai","Delhi","Goa","Kovalam","Varkala","Pondicherry","Chennai"],Argentina:["Buenos Aires","Mar del Plata","Miramar","Necochea"],Namibia:["Windhoek","Swakopmund","Skeleton Bay"],"Canary Islands":["Las Palmas","Tenerife","Lanzarote","El Hierro","La Palma"],Russia:["Moscow","St. Petersburg","Novosibirsk","Yekaterinburg","Vladivostok","Krasnoyarsk","Sochi","Kaliningrad","Yuzhno-Sakhalinsk","Khabarovsk","Irkutsk","Omsk"],Other:["Other"]},Ke=Object.keys(ne).sort();function $e({country:a,city:n,onChange:x}){const[p,h]=j.useState(!1),[T,o]=j.useState(""),v=j.useMemo(()=>!a||!ne[a]?[]:ne[a],[a]),w=c=>{x({country:c,city:""}),h(!1),o("")},r=c=>{c==="__other__"?(h(!0),o(""),x({country:a,city:""})):(h(!1),x({country:a,city:c}))},d=c=>{o(c),x({country:a,city:c})};return e.jsxs("div",{className:"border-t border-border pt-3",children:[e.jsxs(m,{className:"flex items-center gap-1 mb-2",children:[e.jsx(pe,{className:"w-3.5 h-3.5"})," Filming Location"]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(m,{className:"text-xs text-muted-foreground",children:"Country"}),e.jsxs(L,{value:a||"",onValueChange:w,children:[e.jsx(B,{children:e.jsx(I,{placeholder:"Select country..."})}),e.jsx(H,{className:"max-h-60",children:Ke.map(c=>e.jsx(E,{value:c,children:c},c))})]})]}),e.jsxs("div",{children:[e.jsx(m,{className:"text-xs text-muted-foreground",children:"City"}),a?e.jsxs(e.Fragment,{children:[e.jsxs(L,{value:p?"__other__":n||"",onValueChange:r,disabled:!a,children:[e.jsx(B,{children:e.jsx(I,{placeholder:"Select city..."})}
1),e.jsxs(H,{className:"max-h-60",children:[v.map(c=>e.jsx(E,{value:c,children:c},c)),e.jsx(E,{value:"__other__",children:"Other (type manually)"})]})]}),p&&e.jsx(f,{className:"mt-2",placeholder:"Type city name...",value:T,onChange:c=>d(c.target.value),autoFocus:!0})]}):e.jsx(L,{disabled:!0,children:e.jsx(B,{children:e.jsx(I,{placeholder:"Select country first"})})})]})]})]})}function Oe({authorIds:a,authorNames:n,onChange:x,allAuthors:p}){const[h,T]=X.useState(""),o=r=>{const d=(a||[]).filter((M,_)=>_!==r),c=(n||[]).filter((M,_)=>_!==r);x({author_ids:d,author_names:c})},v=r=>{const d=a||[],c=n||[];d.includes(r.id)?x({author_ids:d.filter(M=>M!==r.id),author_names:c.filter(M=>M!==r.name)}):x({author_ids:[...d,r.id],author_names:[...c,r.name]})},w=(p||[]).filter(r=>{var d;return!h||((d=r.name)==null?void 0:d.toLowerCase().includes(h.toLowerCase()))});return e.jsxs("div",{className:"border-t border-border pt-3",children:[e.jsxs(m,{className:"flex items-center gap-1 mb-2",children:[e.jsx(He,{className:"w-3.5 h-3.5"})," Authors / Creators"]}),(a||[]).length>0&&e.jsxs("div",{className:"mb-3 space-y-1",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Selected Authors:"}),(a||[]).map((r,d)=>{const c=n&&n[d]||r;return e.jsxs("div",{className:"flex items-center justify-between bg-secondary/50 rounded px-2 py-1.5",children:[e.jsx("span",{className:"text-sm",children:c}),e.jsx(z,{type:"button",variant:"ghost",size:"sm",onClick:()=>o(d),className:"h-6 text-destructive hover:text-destructive",children:"Remove"})]},`${r}-${d}`)})]}),e.jsx(f,{placeholder:"Search authors...",value:h,onChange:r=>T(r.target.value),className:"mb-2 h-8 text-sm"}),e.jsxs("div",{className:"max-h-32 overflow-y-auto space-y-1 border border-border rounded-lg p-1",children:[w.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:"No authors yet. Add them in Admin â Authors."}),w.map(r=>{const d=(a||[]).includes(r.id);return e.jsxs("button",{type:"button",onClick:()=>v(r),className:`w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-xs transition-colors text-left ${d?"bg-primary/20 text-primary":"hover:bg-secondary"}`,children:[r.photo_url&&e.jsx("img",{src:r.photo_url,alt:r.name,className:"w-5 h-5 rounded-full object-cover shrink-0"}),e.jsx("span",{className:"flex-1 truncate",children:r.name}),d&&e.jsx("span",{className:"text-primary shrink-0",children:"â"})]},r.id)})]})]})}function qe({form:a,setForm:n}){const[x,p]=j.useState(""),[h,T]=j.useState(""),[o,v]=j.useState(""),[w,r]=j.useState(""),d=a.view_breakdown||[],c=d.reduce((u,y)=>u+(Number(y.views)||0),0),M=()=>{if(!x.trim()||!w)return;const u={city:x.trim(),state:h.trim(),country:o.trim(),views:Number(w)},y=[...d,u];n({...a,view_breakdown:y,view_count:y.reduce((C,l)=>C+(Number(l.views)||0),0)}),p(""),T(""),v(""),r("")},_=u=>{const y=d.filter((C,l)=>l!==u);n({...a,view_breakdown:y,view_count:y.reduce((C,l)=>C+(Number(l.views)||0),0)})},D=(u,y)=>{const C=d.map((l,N)=>N===u?{...l,views:Number(y)||0}:l);n({...a,view_breakdown:C,view_count:C.reduce((l,N)=>l+(Number(N.views)||0),0)})};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(De,{className:"w-4 h-4 text-primary"}),e.jsx("h3",{className:"text-sm font-semibold",children:"Viewership by Location"}),e.jsxs("span",{className:"text-xs text-muted-foreground ml-auto",children:[c.toLocaleString()," total from locations"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Add viewer counts per city. The total view count will update automatically."}),e.jsx(ge,{className:"bg-secondary/20 border-dashed",children:e.jsxs(be,{className:"p-3 space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("div",{children:[e.jsx(m,{className:"text-xs",children:"City *"}),e.jsx(f,{value:x,onChange:u=>p(u.target.value),placeholder:"e.g. Los Angeles",className:"h-8 text-sm"})]}),e.jsxs("div",{children:[e.jsx(m,{className:"text-xs",children:"State / Region"}),e.jsx(f,{value:h,onChange:u=>T(u.target.value),placeholder:"e.g. California",className:"h-8 text-sm"})]}),e.jsxs("div",{children:[e.jsx(m,{className:"text-xs",children:"Country"}),e.jsx(f,{value:o,onChange:u=>v(u.target.value),placeholder:"e.g. US",className:"h-8 text-sm"})]}),e.jsxs("div",{children:[e.jsx(m,{className:"text-xs",children:"Views *"}),e.jsx(f,{type:"number",min:"0",value:w,onChange:u=>r(u.target.value),placeholder:"150",className:"h-8 text-sm"})]})]}),e.jsxs(z,{type:"button",size:"sm",onClick:M,disabled:!x.trim()||!w,className:"w-full h-8 gap-1.5",children:[e.jsx(ve,{className:"w-3.5 h-3.5"})," Add Location"]})]})}),d.length===0?e.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No location data added yet."}):e.jsx("div",{className:"space-y-2",children:d.map((u,y)=>e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-lg bg-secondary/30",children:[e.jsx(pe,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),e.jsxs("span",{className:"text-sm flex-1",children:[u.city,u.state?`, ${u.state}`:"",u.country?` · ${u.country}`:""]}),e.jsx(f,{type:"number",min:"0",value:u.views,onChange:C=>D(y,C.target.value),className:"w-24 h-7 text-sm text-right"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"views"}),e.jsx(z,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive shrink-0",onClick:()=>_(y),children:e.jsx(q,{className:"w-3.5 h-3.5"})})]},y))}),d.length>0&&e.jsxs("div",{className:"text-xs text-muted-foreground bg-secondary/20 rounded-lg p-3",children:[e.jsxs("span",{className:"font-medium text-foreground",children:["Total view count updated to: ",c.toLocaleStr
1ing()]})," ","(auto-synced from location totals above)"]})]})}const ue=[{code:"US",name:"United States"},{code:"GB",name:"United Kingdom"},{code:"CA",name:"Canada"},{code:"AU",name:"Australia"},{code:"DE",name:"Germany"},{code:"FR",name:"France"},{code:"IT",name:"Italy"},{code:"ES",name:"Spain"},{code:"MX",name:"Mexico"},{code:"BR",name:"Brazil"},{code:"JP",name:"Japan"},{code:"KR",name:"South Korea"},{code:"CN",name:"China"},{code:"IN",name:"India"},{code:"RU",name:"Russia"},{code:"NL",name:"Netherlands"},{code:"SE",name:"Sweden"},{code:"NO",name:"Norway"},{code:"DK",name:"Denmark"},{code:"FI",name:"Finland"},{code:"PL",name:"Poland"},{code:"BE",name:"Belgium"},{code:"CH",name:"Switzerland"},{code:"AT",name:"Austria"},{code:"IE",name:"Ireland"},{code:"NZ",name:"New Zealand"},{code:"SG",name:"Singapore"},{code:"HK",name:"Hong Kong"},{code:"TW",name:"Taiwan"},{code:"TH",name:"Thailand"},{code:"MY",name:"Malaysia"},{code:"PH",name:"Philippines"},{code:"ID",name:"Indonesia"},{code:"VN",name:"Vietnam"},{code:"ZA",name:"South Africa"},{code:"NG",name:"Nigeria"},{code:"EG",name:"Egypt"},{code:"AE",name:"United Arab Emirates"},{code:"SA",name:"Saudi Arabia"},{code:"IL",name:"Israel"},{code:"TR",name:"Turkey"},{code:"GR",name:"Greece"},{code:"PT",name:"Portugal"},{code:"CZ",name:"Czech Republic"},{code:"HU",name:"Hungary"},{code:"RO",name:"Romania"},{code:"UA",name:"Ukraine"},{code:"AR",name:"Argentina"},{code:"CL",name:"Chile"},{code:"CO",name:"Colombia"},{code:"PE",name:"Peru"}];function Je({selectedRegions:a=[],onChange:n}){const[x,p]=j.useState(""),h=ue.filter(o=>o.name.toLowerCase().includes(x.toLowerCase())||o.code.toLowerCase().includes(x.toLowerCase())),T=o=>{a.includes(o)?n(a.filter(v=>v!==o)):n([...a,o])};return e.jsxs("div",{className:"space-y-3",children:[a.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:a.map(o=>{const v=ue.find(w=>w.code===o);return e.jsxs($,{variant:"default",className:"gap-1 pl-2 pr-1",children:[(v==null?void 0:v.name)||o,e.jsx("button",{type:"button",onClick:()=>T(o),className:"ml-1 hover:bg-primary-foreground/20 rounded-full p-0.5",children:e.jsx(q,{className:"w-3 h-3"})})]},o)})}),e.jsx(f,{placeholder:"Search countries...",value:x,onChange:o=>p(o.target.value),className:"max-w-xs"}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-2 max-h-64 overflow-y-auto border border-border rounded-md p-2",children:h.map(o=>{const v=a.includes(o.code);return e.jsxs("button",{type:"button",onClick:()=>T(o.code),className:`flex items-center justify-between px-2 py-1.5 rounded text-xs transition-colors ${v?"bg-primary text-primary-foreground":"bg-secondary text-secondary-foreground hover:bg-secondary/80"}`,children:[e.jsx("span",{children:o.name}),e.jsx("span",{className:"text-[10px] opacity-70",children:o.code})]},o.code)})})]})}const Qe=["movies","series","documentaries","courses","live","sports","music","kids"],he=["free","basic","premium"],ee=["draft","published","scheduled","archived"],me=["Everyone","Teen","Mature"],We=["series","movie","documentary","live","comedy","dark comedy","romance","romantic comedy","drama"],xe="goby_custom_tags",te={title:"",description:"",short_description:"",video_url:"",trailer_url:"",thumbnail_url:"",poster_url:"",banner_url:"",duration_seconds:"",categories:[],access_tier:"free",status:"published",featured:!1,content_rating:"Everyone",series_name:"",season_number:"",episode_number:"",episode_title:"",ad_enabled:!0,tags:[],city:"",country:"",author_ids:[],author_names:[],thumbnail_position:null,poster_position:null,banner_position:null,view_breakdown:[],geo_block_enabled:!1,geo_block_mode:"block",geo_block_regions:[],mux_asset_id:"",caption_tracks:[],captions_enabled:!0};function Ye({form:a,setForm:n,onSubmit:x,onCancel:p,isPending:h,categories:T}){const[o,v]=j.useState(""),[w,r]=j.useState(a.series_name||""),[d,c]=j.useState(()=>{try{return JSON.parse(localStorage.getItem(xe)||"[]")}catch{return[]}}),M=[...new Set([...We,...d])],_=je(),D=s=>{const i=a.tags||[];i.includes(s)?n({...a,tags:i.filter(g=>g!==s)}):n({...a,tags:[...i,s]})},u=()=>{const s=o.trim().toLowerCase();if(s){if(!M.includes(s)){const i=[...d,s];c(i),localStorage.setItem(xe,JSON.stringify(i))}(a.tags||[]).includes(s)||n({...a,tags:[...a.tags||[],s]}),v("")}},{data:y=[]}=F({queryKey:["all-content-for-series"],queryFn:()=>V.entities.VideoContent.list("-created_date",500)}),{data:C=[]}=F({queryKey:["all-authors"],queryFn:()=>V.entities.Author.list("name",200)}),l=[...new Set(y.filter(s=>s.series_name&&s.series_name.trim()).map(s=>s.series_name))].sort(),N=T,S=s=>{if(s==="__none__"){r(""),n({...a,series_name:"",season_number:"",episode_number:""});return}if(r(s),s){const i=y.filter(g=>g.series_name===s).sort((g,P)=>(P.season_number||0)-(g.season_number||0)||(P.episode_number||0)-(g.episode_number||0))[0];i&&n({...a,series_name:s,season_number:i.season_number||"",episode_number:(i.episode_number||0)+1,description:i.description||"",short_description:i.short_description||"",categories:i.categories||[],access_tier:i.access_tier,content_rating:i.content_rating,ad_enabled:i.ad_enabled!==!1,tags:i.tags||[],city:i.city||"",country:i.country||"",title:i.title||""})}else n({...a,series_name:"",season_number:"",episode_number:""})};return e.jsxs("form",{onSubmit:s=>{s.preventDefault()},children:[e.jsxs(Be,{defaultValue:"info",children:[e.jsxs(Ie,{className:"w-full mb-4",children:[e.jsx(Y,{value:"info",className:"flex-1",children:"Info"}),e.jsx(Y,{value:"media",className:"flex-1",children:"Media"}),e.jsx(Y,{value:"settings",className:"flex-1",children:"Settings"}),e.jsx(Y,{value:"views",className:"flex-1",children:"Views"})]}),e.jsxs(Z,{value:"info",className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(m,{children:"Title *"}),e.jsx(f,{value:a.title,onChange:s=>n({...a,title:s.target.value}),required:!0})]}),e.jsxs("div",{children:[e.jsx(m,{children:"Short Description"}),e.jsx(f,{value:a.short_description,onChange:s=>n({...a,short_description:s.target.value})})]}),e.jsxs("div",{children:[e.jsx(m,{children:"Description"}),e.jsx(Pe,{value:a.description,onChange:s=>n({...a,description:s.target.value}),rows:6,className:"whitespace-pre-wrap font-mono text-sm",style:{whiteSpace:"pre-wrap"}})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"col-span-2",children:[e.jsx(m,{children:"Categories"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2 mb-2",children:N.map(s=>{const i=(a.categories||[]).includes(s.slug);return e.jsx("button",{type:"button",onClick:()=>{const g=a.categories||[];n(i?{...a,categories:g.filter(P=>P!==s.slug)}:{...a,categories:[...g,s.slug]})},className:`px-3 py-1.5 rounded-full text-xs font-medium transition-colors ${i?"bg-primary text-primary-foreground":"bg-secondary text-secondary-foreground hover:bg-secondary/80"}`,children:s.name},s.slug)})})]}),e.jsxs("div",{children:[e.jsx(m,{children:"Content Rating"}),_?e.jsx(J,{options:me.map(s=>({value:s,label:s})),value:a.content_rating,onChange:s=>n({...a,content_rating:s}),placeholder:"Select rating",label:"Content Rating"}):e.jsxs(L,{value:a.content_rating,onValueChange:s=>n({...a,content_rating:s}),children:[e.jsx(B,{children:e.jsx(I,{})}),e.jsx(H,{children:me.map(s=>e.jsx(E,{value:s,children:s},s))})]})]}),e.jsxs("div",{children:[e.jsx(m,{children:"Series Name"}),e.jsx(f,{value:a.series_name,onChange:s=>n({...a,series_name:s.target.value}),onBlur:s=>{const i=s.target.value.trim();i&&l.includes(i)&&S(i)}
1,placeholder:"Type series name (or pick existing below)"}),l.length>0&&e.jsxs(L,{value:"",onValueChange:s=>{s&&s!=="__none__"&&S(s)},children:[e.jsx(B,{className:"mt-2 text-muted-foreground",children:e.jsx(I,{placeholder:"Copy from existing seriesâ¦"})}),e.jsx(H,{children:l.map(s=>e.jsx(E,{value:s,children:s},s))})]})]}),e.jsxs("div",{children:[e.jsx(m,{children:"Duration (seconds)"}),e.jsx(f,{type:"number",value:a.duration_seconds,onChange:s=>n({...a,duration_seconds:s.target.value})})]}),e.jsxs("div",{children:[e.jsx(m,{children:"Season #"}),e.jsx(f,{type:"number",value:a.season_number,onChange:s=>n({...a,season_number:s.target.value})})]}),e.jsxs("div",{children:[e.jsx(m,{children:"Episode #"}),e.jsx(f,{type:"number",value:a.episode_number,onChange:s=>n({...a,episode_number:s.target.value})})]}),e.jsxs("div",{children:[e.jsx(m,{children:"Episode Title"}),e.jsx(f,{value:a.episode_title,onChange:s=>n({...a,episode_title:s.target.value}),placeholder:"e.g. The Beginning"})]})]}),e.jsxs("div",{children:[e.jsx(m,{children:"Tags"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:M.map(s=>{const i=(a.tags||[]).includes(s);return e.jsx("button",{type:"button",onClick:()=>D(s),className:`px-3 py-1.5 rounded-full text-xs font-medium transition-colors capitalize ${i?"bg-primary text-primary-foreground":"bg-secondary text-secondary-foreground hover:bg-secondary/80"}`,children:s},s)})}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(f,{value:o,onChange:s=>v(s.target.value),placeholder:"Add custom tag (saves for future use)",onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),u())},className:"text-sm"}),e.jsx(z,{type:"button",variant:"outline",size:"sm",onClick:u,children:"Add"})]})]}),e.jsx($e,{country:a.country||"",city:a.city||"",onChange:({country:s,city:i})=>n({...a,country:s,city:i})}),e.jsx(Oe,{authorIds:a.author_ids||[],authorNames:a.author_names||[],onChange:({author_ids:s,author_names:i})=>n({...a,author_ids:s,author_names:i}),allAuthors:C||[]})]}),e.jsxs(Z,{value:"media",className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Main Video File"}),e.jsx(de,{value:a.video_url,onReady:({playback_url:s,thumbnail_url:i,duration_seconds:g,asset_id:P,caption_tracks:k})=>{n(b=>({...b,video_url:s,thumbnail_url:b.thumbnail_url||i||"",duration_seconds:g||b.duration_seconds,mux_asset_id:P||b.mux_asset_id||"",caption_tracks:k||b.caption_tracks||[],captions_enabled:b.captions_enabled!==!1}))},onClear:()=>n(s=>({...s,video_url:""}))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Trailer Video"}),e.jsx(de,{value:a.trailer_url,onReady:({playback_url:s})=>n(i=>({...i,trailer_url:s})),onClear:()=>n(s=>({...s,trailer_url:""}))}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Optional short preview clip shown before the main video."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(ae,{label:"Thumbnail (16:9)",value:a.thumbnail_url,onChange:s=>n(i=>({...i,thumbnail_url:s,banner_url:s,thumbnail_position:i.thumbnail_position,banner_position:i.thumbnail_position})),position:a.thumbnail_position,onPositionChange:s=>n(i=>({...i,thumbnail_position:s,banner_position:s})),accept:"image/*",previewType:"image",dimensionHint:"1480Ã840px â also used as banner",aspectRatio:"16/9"}),e.jsx(ae,{label:"Poster Image (2:3)",value:a.poster_url,onChange:s=>n(i=>({...i,poster_url:s})),position:a.poster_position,onPositionChange:s=>n(i=>({...i,poster_position:s})),accept:"image/*",previewType:"image",dimensionHint:"300Ã450px â 2:3 portrait",aspectRatio:"2/3"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Banner is automatically synced from the thumbnail above. Upload below only to override with a different image."}),e.jsx(ae,{label:"Banner Image (Hero â optional override)",value:a.banner_url,onChange:s=>n(i=>({...i,banner_url:s})),position:a.banner_position,onPositionChange:s=>n(i=>({...i,banner_position:s})),accept:"image/*",previewType:"image",dimensionHint:"1480Ã400px â hero banner",aspectRatio:"37/10"})]})]}),e.jsx(Z,{value:"views",className:"space-y-4",children:e.jsx(qe,{form:a,setForm:n})}),e.jsxs(Z,{value:"settings",className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(m,{children:"Access Tier"}),_?e.jsx(J,{options:he.map(s=>({value:s,label:s.charAt(0).toUpperCase()+s.slice(1)}
1)),value:a.access_tier,onChange:s=>n({...a,access_tier:s}),placeholder:"Select tier",label:"Access Tier"}):e.jsxs(L,{value:a.access_tier,onValueChange:s=>n({...a,access_tier:s}),children:[e.jsx(B,{children:e.jsx(I,{})}),e.jsx(H,{children:he.map(s=>e.jsx(E,{value:s,className:"capitalize",children:s},s))})]})]}),e.jsxs("div",{children:[e.jsx(m,{children:"Status"}),_?e.jsx(J,{options:ee.map(s=>({value:s,label:s.charAt(0).toUpperCase()+s.slice(1)})),value:a.status,onChange:s=>n({...a,status:s}),placeholder:"Select status",label:"Status"}):e.jsxs(L,{value:a.status,onValueChange:s=>n({...a,status:s}),children:[e.jsx(B,{children:e.jsx(I,{})}),e.jsx(H,{children:ee.map(s=>e.jsx(E,{value:s,className:"capitalize",children:s},s))})]})]}),a.status==="scheduled"&&e.jsxs("div",{className:"col-span-2",children:[e.jsx(m,{children:"Scheduled Release (Pacific Time)"}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(f,{type:"date",className:"flex-1",value:a.scheduled_publish_at_local?a.scheduled_publish_at_local.slice(0,10):"",onChange:s=>{const i=a.scheduled_publish_at_local?a.scheduled_publish_at_local.slice(11,16):"12:00",g=`${s.target.value}T${i}`;n({...a,scheduled_publish_at_local:g,release_date:g})}}),e.jsx(f,{type:"time",className:"w-36",value:a.scheduled_publish_at_local?a.scheduled_publish_at_local.slice(11,16):"",onChange:s=>{const g=`${a.scheduled_publish_at_local?a.scheduled_publish_at_local.slice(0,10):""}T${s.target.value}`;n({...a,scheduled_publish_at_local:g,release_date:g})}})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Content will auto-publish at this date & time (Pacific Time)."})]}),e.jsxs("div",{children:[e.jsx(m,{children:"View Count"}),e.jsx(f,{type:"number",min:"0",value:a.view_count??"",onChange:s=>n({...a,view_count:s.target.value===""?0:Number(s.target.value)}),placeholder:"0"})]})]}),e.jsxs("div",{className:"flex items-center gap-6 mt-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{checked:!!a.featured,onCheckedChange:s=>n({...a,featured:s})}),e.jsx(m,{children:"Featured (shows in hero)"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{checked:!!a.ad_enabled,onCheckedChange:s=>n({...a,ad_enabled:s})}),e.jsx(m,{children:"Ads Enabled"})]})]}),e.jsxs("div",{className:"mt-6 border-t border-border pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(Ae,{className:"w-4 h-4 text-primary"}),e.jsx(m,{className:"text-base",children:"Geo-Blocking"})]}),e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(se,{checked:!!a.geo_block_enabled,onCheckedChange:s=>n({...a,geo_block_enabled:s})}),e.jsx(m,{children:"Enable Geo-Blocking"})]}),a.geo_block_enabled&&e.jsxs("div",{className:"space-y-3 ml-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{children:"Mode:"}),e.jsxs(L,{value:a.geo_block_mode,onValueChange:s=>n({...a,geo_block_mode:s}),children:[e.jsx(B,{className:"w-48",children:e.jsx(I,{})}
1),e.jsxs(H,{children:[e.jsx(E,{value:"block",children:"Block specific regions"}),e.jsx(E,{value:"allow",children:"Allow only specific regions"})]})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a.geo_block_mode==="block"?"Video will be blocked in the selected countries":"Video will only be viewable in the selected countries"}),e.jsx(Je,{selectedRegions:a.geo_block_regions||[],onChange:s=>n({...a,geo_block_regions:s})})]})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4 mt-2 border-t border-border",children:[e.jsx(z,{type:"button",variant:"outline",onClick:p,disabled:h,children:"Cancel"}),e.jsx(z,{type:"button",disabled:h,className:"bg-primary hover:bg-primary/90",onClick:x,children:h?"Saving...":"Save"})]})]})}function hs(){const a=je(),[n,x]=j.useState(!1),[p,h]=j.useState(null),[T,o]=j.useState(te),v=X.useRef(T),w=X.useCallback(t=>{o(A=>{const R=typeof t=="function"?t(A):t;return v.current=R,R})},[]),[r,d]=j.useState(""),[c,M]=j.useState("all"),[_,D]=j.useState("all"),u=Ne(),{data:y=[]}=F({queryKey:["admin-categories"],queryFn:()=>V.entities.Category.list("sort_order",100)}),C=y.length>0?y:Qe.map(t=>({slug:t,name:t})),{data:l=[],isLoading:N}=F({queryKey:["admin-content-list"],queryFn:()=>V.entities.VideoContent.list("-created_date",200)}),S=j.useRef(!1),s=re({mutationFn:async t=>{if(S.current)throw new Error("Already saving");S.current=!0;const A=t.scheduled_publish_at_local?new Date(t.scheduled_publish_at_local).toISOString():t.scheduled_publish_at||"",{scheduled_publish_at_local:R,...G}=t,O={...G,scheduled_publish_at:A||void 0,duration_seconds:t.duration_seconds?Number(t.duration_seconds):void 0,season_number:t.season_number?Number(t.season_number):void 0,episode_number:t.episode_number?Number(t.episode_number):void 0,view_count:t.view_count!==void 0?Number(t.view_count):0,thumbnail_position:t.thumbnail_position??null,poster_position:t.poster_position??null,banner_position:t.banner_position??null};return p?V.entities.VideoContent.update(p.id,O):V.entities.VideoContent.create(O)},onSuccess:()=>{S.current=!1,u.invalidateQueries({queryKey:["admin-content-list"]}
1),u.invalidateQueries({queryKey:["content-home-published"]}),u.invalidateQueries({queryKey:["content-home-scheduled"]}),u.invalidateQueries({queryKey:["content-home"]}),u.invalidateQueries({queryKey:["categories-home"]}),Q.success(p?"Content updated":"Content saved!"),console.log("Save successful - dialog should stay open")},onError:t=>{S.current=!1,console.error("Save error:",t),Q.error("Failed to save. Please try again.")}}),i=re({mutationFn:t=>V.entities.VideoContent.delete(t),onSuccess:()=>{u.invalidateQueries({queryKey:["admin-content-list"]}),Q.success("Deleted")}}),g=()=>{if(s.isPending){Q.error("Please wait for save to complete");return}x(!1),h(null),w(te)},P=t=>{if(!t)return"";const A=new Date(t),R=G=>String(G).padStart(2,"0");return`${A.getFullYear()}-${R(A.getMonth()+1)}-${R(A.getDate())}T${R(A.getHours())}:${R(A.getMinutes())}`},k=t=>{h(t),w({...te,...t,categories:t.categories||[],author_ids:t.author_ids||[],author_names:t.author_names||[],duration_seconds:t.duration_seconds||"",thumbnail_position:t.thumbnail_position??null,poster_position:t.poster_position??null,banner_position:t.banner_position??null,view_breakdown:t.view_breakdown||[],geo_block_enabled:t.geo_block_enabled||!1,geo_block_mode:t.geo_block_mode||"block",geo_block_regions:t.geo_block_regions||[],scheduled_publish_at_local:P(t.scheduled_publish_at)}),x(!0)},b=l.filter(t=>{var O,ie;const A=!r||((O=t.title)==null?void 0:O.toLowerCase().includes(r.toLowerCase()))||((ie=t.tags)==null?void 0:ie.some(_e=>_e.includes(r.toLowerCase()))),R=c==="all"||(t.categories||[]).includes(c),G=_==="all"||t.status===_;return A&&R&&G});return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(oe,{className:"w-6 h-6 text-primary"}),e.jsx("h1",{className:"text-2xl font-display font-bold",children:"Content Manager"})]}),e.jsxs(z,{className:"gap-2 bg-primary hover:bg-primary/90",onClick:()=>x(!0),children:[e.jsx(ve,{className:"w-4 h-4"})," Add Content"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 mb-4",children:[e.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[e.jsx(Ce,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(f,{placeholder:"Search title or tags...",value:r,onChange:t=>d(t.target.value),className:"pl-9"})]}),a?e.jsxs(e.Fragment,{children:[e.jsx(J,{options:[{value:"all",label:"All Categories"},...C.map(t=>({value:t.slug,label:t.name}))],value:c,onChange:M,placeholder:"Category",label:"Filter by Category",className:"w-36"}),e.jsx(J,{options:[{value:"all",label:"All Status"},...ee.map(t=>({value:t,label:t.charAt(0).toUpperCase()+t.slice(1)}))],value:_,onChange:D,placeholder:"Status",label:"Filter by Status",className:"w-32"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(L,{value:c,onValueChange:M,children:[e.jsx(B,{className:"w-36",children:e.jsx(I,{placeholder:"Category"})}
1),e.jsxs(H,{children:[e.jsx(E,{value:"all",children:"All Categories"}),C.map(t=>e.jsx(E,{value:t.slug,children:t.name},t.slug))]})]}),e.jsxs(L,{value:_,onValueChange:D,children:[e.jsx(B,{className:"w-32",children:e.jsx(I,{placeholder:"Status"})}),e.jsxs(H,{children:[e.jsx(E,{value:"all",children:"All Status"}),ee.map(t=>e.jsx(E,{value:t,className:"capitalize",children:t},t))]})]})]})]}),e.jsx(ge,{className:"bg-secondary/30",children:e.jsx(be,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(Re,{children:[e.jsx(Ee,{children:e.jsxs(W,{children:[e.jsx(K,{children:"Content"}),e.jsx(K,{children:"Category"}),e.jsx(K,{children:"Tier"}),e.jsx(K,{children:"Status"}),e.jsx(K,{children:"Views"}),e.jsx(K,{children:"Ads"}),e.jsx(K,{className:"text-right",children:"Actions"})]})}),e.jsxs(Le,{children:[N&&e.jsx(W,{children:e.jsx(U,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"Loading..."})}),b.map(t=>e.jsxs(W,{children:[e.jsx(U,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[t.thumbnail_url?e.jsx("img",{src:t.thumbnail_url,alt:"",className:"w-14 h-8 object-cover rounded shrink-0"}):e.jsx("div",{className:"w-14 h-8 rounded bg-secondary flex items-center justify-center shrink-0",children:e.jsx(oe,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm truncate max-w-[180px]",children:t.title}),t.series_name&&e.jsx("p",{className:"text-xs text-muted-foreground",children:t.series_name})]})]})}),e.jsx(U,{children:e.jsxs("div",{className:"flex flex-wrap gap-1",children:[(t.categories||[]).length>0?(t.categories||[]).slice(0,3).map(A=>{var R;return e.jsx($,{variant:"secondary",className:"capitalize text-xs",children:((R=C.find(G=>G.slug===A))==null?void 0:R.name)||A},A)}):e.jsx($,{variant:"secondary",className:"capitalize text-xs",children:"Uncategorized"}),(t.categories||[]).length>3&&e.jsxs($,{variant:"outline",className:"text-xs",children:["+",(t.categories||[]).length-3]})]})}),e.jsx(U,{children:e.jsx($,{variant:"outline",className:"capitalize text-xs",children:t.access_tier})}),e.jsx(U,{children:e.jsx($,{className:`text-xs ${t.status==="published"?"bg-accent/20 text-accent":t.status==="scheduled"?"bg-blue-500/20 text-blue-400":t.status==="draft"?"bg-muted":"bg-destructive/20 text-destructive"}`,children:t.status})}),e.jsx(U,{className:"text-sm",children:(t.view_count||0).toLocaleString()}),e.jsx(U,{className:"text-sm",children:t.ad_enabled?"â":"â"}),e.jsx(U,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-1",children:[e.jsx(fe,{to:`/admin/captions/${t.id}`,children:e.jsx(z,{variant:"ghost",size:"icon",className:"h-8 w-8 text-xs font-bold",title:"Manage captions",children:"CC"})}),e.jsx(z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>k(t),children:e.jsx(Ge,{className:"w-3.5 h-3.5"})}),e.jsx(z,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:()=>{confirm("Delete this content?")&&i.mutate(t.id)},children:e.jsx(we,{className:"w-3.5 h-3.5"})})]})})]},t.id)),!N&&b.length===0&&e.jsx(W,{children:e.jsx(U,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"No content found."})})]})]})})})}),e.jsx(Se,{open:n,onOpenChange:t=>{console.log("Dialog onOpenChange:",t,"isPending:",s.isPending),t||g()},children:e.jsxs(ke,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsx(Te,{children:e.jsx(Me,{className:"font-display",children:p?"Edit Content":"Add New Content"})}),e.jsx(Ye,{form:T,setForm:w,onSubmit:()=>s.mutate(v.current),onCancel:g,isPending:s.isPending,categories:C})]})})]})}export{hs 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.