1import{c as o,j as t,am as i,q as e,C as m,ad as Y,ae as r}from"./index-vzpZIVg6.js";import{I as x}from"./input-aZHXUG0z.js";import{C as g,b as D,c as E,a as f}from"./card-c5NhOQyD.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const ee=o("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const se=o("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** 12 * @license lucide-react v0.462.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const I=o("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** 17 * @license lucide-react v0.462.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */const ae=o("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** 22 * @license lucide-react v0.462.0 - ISC 23 * 24 * This source code is licensed under the ISC license. 25 * See the LICENSE file in the root directory of this source tree. 26 */const R=o("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]),oe=()=>{const[F,y]=t.useState(null),[H,u]=t.useState(!1),[O,j]=t.useState(!0),[w,T]=t.useState(""),[N,K]=t.useState(""),[v,b]=t.useState(!1),[l,k]=t.useState(!1),[C,S]=t.useState(null),[te,U]=t.useState(0),[L,q]=t.useState([]),[W,M]=t.useState(null),h=t.useRef(null);t.useEffect(()=>{const{data:{subscription:s}}=i.auth.onAuthStateChange(async(a,n)=>{if(y(n),n!=null&&n.user){const{data:c}=await i.rpc("has_role",{_user_id:n.user.id,_role:"admin"});u(!!c)}else u(!1);j(!1)});return i.auth.getSession().then(async({data:{session:a}})=>{if(y(a),a!=null&&a.user){const{data:n}=await i.rpc("has_role",{_user_id:a.user.id,_role:"admin"});u(!!n)}j(!1)}),()=>s.unsubscribe()},[]);const z=async()=>{b(!0);const{error:s}=await i.auth.signInWithPassword({email:w,password:N});s&&r.error("Anmeldung fehlgeschlagen. Bitte überprüfen Sie Ihre Zugangsdaten."),b(!1)},V=async()=>{await i.auth.signOut(),r.success("Abgemeldet")},Z=async s=>{var B,_;const a=(B=s.target.files)==null?void 0:B[0];if(!a)return;const n=["video/mp4","video/webm","video/quicktime","video/mov",""],c=a.name.toLowerCase().split(".").pop(),J=["mp4","webm","mov"];if(!n.includes(a.type)&&!J.includes(c||"")){r.error(`Ungültiger Dateityp: ${a.type||c}. Bitte MP4, WebM oder MOV hochladen.`);return}if(a.size>700*1024*1024){r.error("Datei zu groÃ. Maximum 700MB.");return}k(!0),S(a.name),U(0),r.info(`Starte Upload: ${a.name} (${A(a.size)})`);try{const d=Date.now(),p=a.name.replace(/[^a-zA-Z0-9.-]/g,"_"),$=`${d}-${p}`,{data:ne,error:P}=await i.storage.from("project-videos").upload($,a,{cacheControl:"3600",upsert:!1});if(P)throw P;const{data:Q}=i.storage.from("project-videos").getPublicUrl($);q(X=>[{name:a.name,url:Q.publicUrl,size:a.size},...X]),r.success("Video erfolgreich hochgeladen!"),h.current&&(h.current.value="")}catch(d){console.error("Upload error:",d);const p=(_=d.message)!=null&&_.includes("size")?"Datei zu groÃ. Bitte wählen Sie eine kleinere Datei.":"Upload fehlgeschlagen. Bitte versuchen Sie es erneut.";r.error(p)}finally{k(!1),S(null),U(0)}},G=async s=>{await navigator.clipboard.writeText(s),M(s),r.success("URL kopiert!"),setTimeout(()=>M(null),2e3)},A=s=>s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`;return O?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx("p",{className:"text-muted-foreground",children:"Laden..."})}):F?H?e.jsx("div",{className:"min-h-screen bg-background py-20 px-4",children:e.jsx("div",{className:"max-w-2xl mx-auto",children:e.jsxs(g,{children:[e.jsxs(D,{className:"flex flex-row items-center justify-between",children:[e.jsxs(E,{className:"flex items-center gap-2",children:[e.jsx(R,{className:"h-6 w-6"}),"Video Upload für Projekte"]}),e.jsx(m,{variant:"ghost",size:"sm",onClick:V,children:e.jsx(I,{className:"h-4 w-4"})})]}),e.jsxs(f,{className:"space-y-6",children:[e.jsxs("div",{className:`border-2 border-dashed rounded-lg p-8 text-center transition-colors ${l?"border-primary bg-primary/5":"border-muted-foreground
26/25"}`,children:[e.jsx(x,{ref:h,type:"file",accept:"video/mp4,video/webm,video/quicktime,.mp4,.webm,.mov",onChange:Z,disabled:l,className:"hidden",id:"video-upload"}),e.jsxs("label",{htmlFor:"video-upload",className:`flex flex-col items-center gap-4 ${l?"pointer-events-none":"cursor-pointer"}`,children:[e.jsx(ae,{className:`h-12 w-12 ${l?"animate-pulse text-primary":"text-muted-foreground"}`}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:l?"Hochladen...":"Video auswählen"}),l&&C&&e.jsx("p",{className:"text-sm text-primary font-medium mt-1",children:C}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:l?"Bitte warten - groÃe Dateien können einige Minuten dauern":"MP4, WebM oder MOV (max. 700MB)"})]})]})]}),L.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"font-medium",children:"Hochgeladene Videos"}),L.map((s,a)=>e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[e.jsx(R,{className:"h-5 w-5 text-primary shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:s.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:A(s.size)})]}),e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>G(s.url),children:W===s.url?e.jsx(Y,{className:"h-4 w-4 text-green-500"}):e.jsx(ee,{className:"h-4 w-4"})})]},a))]}),e.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 text-sm",children:[e.jsx("p",{className:"font-medium mb-2",children:"Anleitung:"}),e.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-muted-foreground",children:[e.jsx("li",{children:"Video hochladen (bis 700MB)"}),e.jsx("li",{children:"URL kopieren"}),e.jsx("li",{children:"URL hier im Chat teilen"})]})]})]})]})})}):e.jsx("div",{className:"min-h-screen bg-background py-20 px-4 flex items-center justify-center",children:e.jsx(g,{className:"w-full max-w-md",children:e.jsxs(f,{className:"pt-6 text-center space-y-4",children:[e.jsx("p",{className:"text-muted-foreground",children:"Kein Admin-Zugang. Bitte melden Sie sich mit einem Admin-Konto an."}),e.jsxs(m,{variant:"outline",onClick:V,children:[e.jsx(I,{className:"h-4 w-4 mr-2"})," Abmelden"]})]})})}):e.jsx("div",{className:"min-h-screen bg-background py-20 px-4 flex items-center justify-center",children:e.jsxs(g,{className:"w-full max-w-md",children:[e.jsx(D,{children:e.jsxs(E,{className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-6 w-6"}),"Admin Login"]})}),e.jsxs(f,{className:"space-y-4",children:[e.jsx(x,{type:"email",placeholder:"E-Mail",value:w,onChange:s=>T(s.target.value)}),e.jsx(x,{type:"password",placeholder:"Passwort",value:N,onChange:s=>K(s.target.value),onKeyDown:s=>s.key==="Enter"&&z()}),e.jsx(m,{onClick:z,className:"w-full",disabled:v,children:v?"Anmelden...":"Anmelden"})]})]})})};export{oe 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.