PageSourceSearch

https://hackathonhub.ai/assets/HackathonWizard-C7M2YZyL.js

js hackathonhub.ai collected 2026-10-05 13:33:47 UTC 39,528 bytes, 1 lines download raw bytes

1import{u as P,j as e,x as C,Y as z,Z as S,aE as T,y as D,L as h,I as f,z as F,D as J,E as W,J as U,K as V,r as A,B as b,ab as M,aP as ae,T as O,aD as oe,bn as G,c as y,s as $,ac as H,bw as B,$ as R,p as re,bP as q,w as X,M as K,aW as L,U as Y,t as Z,bu as de,v as xe,C as Q,a as he,R as me,a_ as ge,a$ as ue,b1 as je,l as pe,aL as ve,bX as fe,cu as Ne,bW as be}from"./index-BR70Jv3h.js";import{A as ee}from"./AiTranslateButton-BRz-v0Ix.js";import{V as _e}from"./video-BxKjUZNr.js";import{G as se}from"./grip-vertical-kc9SXPWS.js";import{M as ye}from"./medal-sK-FwD0U.js";import"./globe-s6baTepi.js";function we({data:r,onChange:c}){const{language:o}=P(),s=o==="ar",t=[{value:"technology",label:s?"التقنية":"Technology"},{value:"ai",label:s?"الذكاء الاصطناعي":"Artificial Intelligence"},{value:"fintech",label:s?"التقنية المالية":"FinTech"},{value:"healthcare",label:s?"الصحة":"Healthcare"},{value:"education",label:s?"التعليم":"Education"},{value:"sustainability",label:s?"الاستدامة":"Sustainability"},{value:"social",label:s?"الابتكار الاجتماعي":"Social Innovation"},{value:"other",label:s?"أخرى":"Other"}],g=[{value:"online",label:s?"عن بُعد":"Online"},{value:"onsite",label:s?"حضوري":"On-site"},{value:"hybrid",label:s?"مختلط":"Hybrid"}];return e.jsx("div",{className:"space-y-6",dir:s?"rtl":"ltr",children:e.jsxs(C,{children:[e.jsxs(z,{children:[e.jsx(S,{className:s?"text-right":"text-left",children:s?"المعلومات الأساسية":"Basic Information"}),e.jsx(T,{className:s?"text-right":"text-left",children:s?"أدخل اسم الهاكاثون والفئة ونوع الفعالية":"Enter hackathon name, category, and event type"})]}),e.jsxs(D,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(h,{className:s?"text-right block":"text-left block",children:[s?"اسم الهاكاثون":"Hackathon Title"," *"]}),e.jsx(f,{value:r.title,onChange:a=>c({title:a.target.value}),placeholder:s?"مثال: هاكاثون الابتكار 2024":"e.g., Innovation Hackathon 2024",className:s?"text-right":"text-left"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(h,{className:s?"text-right block":"text-left block",children:[s?"الفئة":"Category"," *"]}),e.jsxs(F,{value:r.category,onValueChange:a=>c({category:a}),children:[e.jsx(J,{className:s?"text-right":"text-left",children:e.jsx(W,{placeholder:s?"اختر الفئة":"Select category"})}),e.jsx(U,{children:t.map(a=>e.jsx(V,{value:a.value,children:a.label},a.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(h,{className:s?"text-right block":"text-left block",children:[s?"نوع الفعالية":"Event Type"," *"]}),e.jsxs(F,{value:r.event_type,onValueChange:a=>c({event_type:a}),children:[e.jsx(J,{className:s?"text-right":"text-left",children:e.jsx(W,{placeholder:s?"اختر نوع الفعالية":"Select event type"})}),e.jsx(U,{children:g.map(a=>e.jsx(V,{value:a.value,children:a.label},a.value))})]})]})]})]})})}function ke({data:r,hackathonTitle:c,onChange:o}){const{language:s}=P(),t=s==="ar",[g,a]=A.useState(!1),w=async()=>{if(!c){y.error(t?"يرجى إدخال اسم الهاكاثون أولاً":"Please enter hackathon title first");return}a(!0);try{const{data:l,error:i}=await $.functions.invoke("generate-field-text",{body:{fieldType:"hackathon_description",language:t?"ar":"en",context:{hackathonName:c}}});if(i)throw i;l!=null&&l.text&&(o({description:l.text}),y.success(t?"تم توليد الوصف بنجاح":"Description generated successfully"))}catch(l){console.error("Error generating description:",l),y.error(t?"فشل في توليد الوصف":"Failed to generate description")}finally{a(!1)}},N=r.banner_type||"image";return e.jsx("div",{className:"space-y-6",dir:t?"rtl":"ltr",children:e.jsxs(C,{children:[e.jsxs(z,{children:[e.jsx(S,{className:t?"text-right":"text-left",children:t?"الوصف والصورة":"Description & Banner"}),e.jsx(T,{className:t?"text-right":"text-left",children:t?"أضف وصفاً جذاباً وصورة رئيسية للهاكاثون":"Add an engaging description and banner image"})]}),e.jsxs(D,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:`flex items-center justify-between ${t?"flex-row-reverse":""}`,children:[e.jsxs(h,{className:t?"text-right":"text-left",children:[t?"وصف الهاكاثون":"Hackathon Description"," *"]}),e.jsxs(b,{type:"button",variant:"outline",size:"sm",onClick:w,disabled:g,className:`gap-2 ${t?"flex-row-reverse":""}`,children:[g?e.jsx(M,{className:"h-4 w-4 animate-spin"}):e.jsx(ae,{className:"h-4 w-4"}),t?"اقتراح بالذكاء الاصطناعي":"AI Suggest"]})]}),e.jsx(O,{value:r.description,onChange:l=>o({description:l.target.value}),placeholder:t?"اكتب وصفاً شاملاً للهاكاثون...":"Write a comprehensive hackathon description...",className:`min-h-[150px] ${t?"text-right":"text-left"}`})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{className:t?"text-right block":"text-left block",children:t?"العنوان الفرعي (عربي)":"Hero Subtitle (Arabic)"}),e.jsx(ee,{sourceText:r.hero_subtitle_ar,sourceLang:"ar",targetLang:"en",fieldType:"title",currentTargetText:r.hero_subtitle_en,onTranslated:l=>o({hero_subtitle_en:l})})]}),e.jsx(f,{value:r.hero_subtitle_ar,onChange:l=>o({hero_subtitle_ar:l.target.value}),placeholder:t?"العنوان الفرعي بالعربية":"Arabic subtitle",className:"text-right",dir:"rtl"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{className:t?"text-right block":"text-left block",children:t?"العنوان الفرعي (إنجليزي)":"Hero Subtitle (English)"}),e.jsx(ee,{sourceText:r.hero_subtitle_en,sourceLang:"en",targetLang:"ar",fieldType:"title",currentTargetText:r.hero_subtitle_ar,onTranslated:l=>o({hero_subtitle_ar:l})})]}),e.jsx(f,{value:r.hero_subtitle_en,onChange:l=>o({hero_subtitle_en:l.target.value}),placeholder:t?"العنوان الفرعي بالإنجليزية":"English subtitle",className:"text-left",dir:"ltr"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:t?"text-right block":"text-left block",children:t?"البانر":"Banner"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(b,{type:"button",variant:N==="image"?"default":"outline",size:"sm",onClick:()=>o({banner_type:"image"}),className:"gap-2",children:[e.jsx(oe,{className:"h-4 w-4"}),t?"صورة":"Image"]}),e.jsxs(b,{type:"button",variant:N==="video"?"default":"outline",size:"sm",onClick:()=>o({banner_type:"video"}),className:"gap-2",children:[e.jsx(_e,{className:"h-4 w-4"}),t?"فيديو":"Video"]})]}),N==="image"&&e.jsxs(e.Fragment,{children:[e.jsx(G,{bucket:"hackathon-banners",onUpload:l=>o({banner_url:l[0]||"",banner_video_url:""}),accept:"image/*"}),r.banner_url&&e.jsx("div",{className:"mt-4 rounded-lg overflow-hidden border",children:e.jsx("img",{src:r.banner_url,alt:"Banner preview",className:"w-full h-48 object-cover"})})]}),N==="video"&&e.jsxs(e.Fragment,{children:[e.jsx(G,{bucket:"hackathon-banners",onUpload:l=>o({banner_video_url:l[0]||"",banner_url:""}),accept:"video/mp4,video/webm,video/quicktime",maxSize:100}),r.banner_video_url&&e.jsx("div",{className:"mt-4 rounded-lg overflow-hidden border",children:e.jsx("video",{src:r.banner_video_url,className:"w-full h-48 object-cover",controls:!0,muted:!0}
1)})]})]})]})]})})}function $e({data:r,eventType:c,onChange:o}){const{language:s}=P(),t=s==="ar",g=c==="onsite"||c==="hybrid";return e.jsx("div",{className:"space-y-6",dir:t?"rtl":"ltr",children:e.jsxs(C,{children:[e.jsxs(z,{children:[e.jsx(S,{className:t?"text-right":"text-left",children:t?"التواريخ والموقع":"Dates & Location"}),e.jsx(T,{className:t?"text-right":"text-left",children:t?"حدد مواعيد التسجيل والفعالية":"Set registration and event dates"})]}),e.jsxs(D,{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:t?"text-right block":"text-left block",children:t?"بداية التسجيل":"Registration Start"}),e.jsx(f,{type:"datetime-local",value:r.registration_start,onChange:a=>o({registration_start:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:t?"text-right block":"text-left block",children:t?"نهاية التسجيل":"Registration Deadline"}),e.jsx(f,{type:"datetime-local",value:r.registration_deadline,onChange:a=>o({registration_deadline:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(h,{className:t?"text-right block":"text-left block",children:[t?"بداية الهاكاثون":"Hackathon Start"," *"]}),e.jsx(f,{type:"datetime-local",value:r.start_date,onChange:a=>o({start_date:a.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(h,{className:t?"text-right block":"text-left block",children:[t?"نهاية الهاكاثون":"Hackathon End"," *"]}),e.jsx(f,{type:"datetime-local",value:r.end_date,onChange:a=>o({end_date:a.target.value})})]})]}),g&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:"border-t pt-6",children:[e.jsx("h3",{className:`font-medium mb-4 ${t?"text-right":"text-left"}`,children:t?"معلومات الموقع":"Location Information"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:t?"text-right block":"text-left block",children:t?"المكان":"Venue"}),e.jsx(f,{value:r.location,onChange:a=>o({location:a.target.value}),placeholder:t?"اسم المكان أو المبنى":"Venue name or building",className:t?"text-right":"text-left"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:t?"text-right block":"text-left block",children:t?"المدينة":"City"}),e.jsx(f,{value:r.city,onChange:a=>o({city:a.target.value}),placeholder:t?"المدينة":"City",className:t?"text-right":"text-left"})]})]}),e.jsxs("div",{className:"space-y-2 mt-4",children:[e.jsx(h,{className:t?"text-right block":"text-left block",children:t?"رابط خرائط قوقل":"Google Maps URL"}),e.jsx(f,{value:r.google_maps_url,onChange:a=>o({google_maps_url:a.target.value}),placeholder:"https://maps.google.com/...",dir:"ltr"})]})]})})]})]})})}function Ce({data:r,hackathonTitle:c,onChange:o}){const{language:s}=P(),t=s==="ar",[g,a]=A.useState(!1),w=()=>{const d={id:`temp-${Date.now()}`,text_ar:"",text_en:""};o({objectives:[...r.objectives,d]})},N=(d,m,j)=>{const _=[...r.objectives];_[d]={..._[d],[m]:j},o({objectives:_})},l=d=>{o({objectives:r.objectives.filter((m,j)=>j!==d)})},i=()=>{const d={id:`temp-${Date.now()}`,title_ar:"",title_en:"",description_ar:"",description_en:""};o({challenges:[...r.challenges,d]})},n=(d,m,j)=>{const _=[...r.challenges];_[d]={..._[d],[m]:j},o({challenges:_})},u=d=>{o({challenges:r.challenges.filter((m,j)=>j!==d)})},k=async d=>{a(!0);try{const{data:m,error:j}=await $.functions.invoke("generate-field-text",{body:{fieldType:"hackathon_objective",language:t?"ar":"en",context:{hackathonName:c}}});if(j)throw j;m!=null&&m.text&&(N(d,t?"text_ar":"text_en",m.text),y.success(t?"تم توليد الهدف":"Objective generated"))}catch{y.error(t?"فشل في التوليد":"Failed to generate")}finally{a(!1)}};return e.jsxs("div",{className:"space-y-6",dir:t?"rtl":"ltr",children:[e.jsxs(C,{children:[e.jsx(z,{children:e.jsxs("div",{className:`flex items-center justify-between ${t?"flex-row-reverse":""}`,children:[e.jsxs("div",{children:[e.jsx(S,{className:t?"text-right":"text-left",children:t?"الأهداف":"Objectives"}),e.jsx(T,{className:t?"text-right":"text-left",children:t?"أضف أهداف الهاكاثون":"Add hackathon objectives"})]}),e.jsxs(b,{onClick:w,variant:"outline",size:"sm",className:`gap-2 ${t?"flex-row-reverse":""}`,children:[e.jsx(H,{className:"h-4 w-4"}),t?"إضافة هدف":"Add Objective"]})]})}),e.jsx(D,{className:"space-y-4",children:r.objectives.length===0?e.jsx("p",{className:`text-muted-foreground text-sm ${t?"text-right":"text-left"}
1`,children:t?"لم يتم إضافة أهداف بعد":"No objectives added yet"}):r.objectives.map((d,m)=>e.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[e.jsxs("div",{className:`flex items-center justify-between ${t?"flex-row-reverse":""}`,children:[e.jsxs("div",{className:`flex items-center gap-2 ${t?"flex-row-reverse":""}`,children:[e.jsx(se,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:t?`هدف ${m+1}`:`Objective ${m+1}`})]}),e.jsxs("div",{className:`flex items-center gap-2 ${t?"flex-row-reverse":""}`,children:[e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>k(m),disabled:g,children:g?e.jsx(M,{className:"h-4 w-4 animate-spin"}):e.jsx(ae,{className:"h-4 w-4"})}),e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>l(m),children:e.jsx(B,{className:"h-4 w-4 text-destructive"})})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:t?"بالعربية":"Arabic"}),e.jsx(f,{value:d.text_ar,onChange:j=>N(m,"text_ar",j.target.value),placeholder:t?"الهدف بالعربية":"Objective in Arabic",className:"text-right",dir:"rtl"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:t?"بالإنجليزية":"English"}),e.jsx(f,{value:d.text_en,onChange:j=>N(m,"text_en",j.target.value),placeholder:t?"الهدف بالإنجليزية":"Objective in English",className:"text-left",dir:"ltr"})]})]})]},d.id))})]}),e.jsxs(C,{children:[e.jsx(z,{children:e.jsxs("div",{className:`flex items-center justify-between ${t?"flex-row-reverse":""}`,children:[e.jsxs("div",{children:[e.jsx(S,{className:t?"text-right":"text-left",children:t?"التحديات":"Challenges"}),e.jsx(T,{className:t?"text-right":"text-left",children:t?"أضف تحديات ومجالات الهاكاثون":"Add hackathon challenges and tracks"})]}),e.jsxs(b,{onClick:i,variant:"outline",size:"sm",className:`gap-2 ${t?"flex-row-reverse":""}`,children:[e.jsx(H,{className:"h-4 w-4"}),t?"إضافة تحدي":"Add Challenge"]})]})}),e.jsx(D,{className:"space-y-4",children:r.challenges.length===0?e.jsx("p",{className:`text-muted-foreground text-sm ${t?"text-right":"text-left"}`,children:t?"لم يتم إضافة تحديات بعد":"No challenges added yet"}):r.challenges.map((d,m)=>e.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[e.jsxs("div",{className:`flex items-center justify-between ${t?"flex-row-reverse":""}`,children:[e.jsxs("div",{className:`flex items-center gap-2 ${t?"flex-row-reverse":""}`,children:[e.jsx(se,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:t?`تحدي ${m+1}`:`Challenge ${m+1}`})]}),e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>u(m),children:e.jsx(B,{className:"h-4 w-4 text-destructive"})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:t?"العنوان (عربي)":"Title (Arabic)"}),e.jsx(f,{value:d.title_ar,onChange:j=>n(m,"title_ar",j.target.value),className:"text-right",dir:"rtl"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:t?"العنوان (إنجليزي)":"Title (English)"}),e.jsx(f,{value:d.title_en,onChange:j=>n(m,"title_en",j.target.value),className:"text-left",dir:"ltr"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:t?"الوصف (عربي)":"Description (Arabic)"}),e.jsx(O,{value:d.description_ar,onChange:j=>n(m,"description_ar",j.target.value),className:"text-right min-h-[80px]",dir:"rtl"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:t?"الوصف (إنجليزي)":"Description (English)"}),e.jsx(O,{value:d.description_en,onChange:j=>n(m,"description_en",j.target.value),className:"text-left min-h-[80px]",dir:"ltr"})]})]})]},d.id))})]})]})}function ze({data:r,onChange:c}){const{language:o}=P(),s=o==="ar",t=()=>{const l=r.prizes.length+1,i={id:`temp-${Date.now()}`,rank:l,title_ar:l===1?"المركز الأول":l===2?"المركز الثاني":l===3?"المركز الثالث":`المركز ${l}`,title_en:l===1?"First Place":l===2?"Second Place":l===3?"Third Place":`${l}th Place`,amount:0,description_ar:"",description_en:""};c({prizes:[...r.prizes,i]})},g=(l,i,n)=>{const u=[...r.prizes];u[l]={...u[l],[i]:n},c({prizes:u})},a=l=>{c({prizes:r.prizes.filter((i,n)=>n!==l)})},w=l=>l===1?e.jsx(re,{className:"h-5 w-5 text-yellow-500"}):l===2?e.jsx(ye,{className:"h-5 w-5 text-gray-400"}):l===3?e.jsx(q,{className:"h-5 w-5 text-amber-600"}):e.jsx(q,{className:"h-5 w-5 text-muted-foreground"}),N=l=>l===1?"border-yellow-500/50 bg-yellow-500/5":l===2?"border-gray-400/50 bg-gray-400/5":l===3?"border-amber-600/50 bg-amber-600/5":"border-border";return e.jsxs("div",{className:"space-y-6",dir:s?"rtl":"ltr",children:[e.jsxs(C,{children:[e.jsxs(z,{children:[e.jsx(S,{className:s?"text-right":"text-left",children:s?"إجمالي الجوائز":"Total Prize Pool"}),e.jsx(T,{className:s?"text-right":"text-left",children:s?"أدخل إجمالي قيمة الجوائز":"Enter the total prize value"})]}),e.jsx(D,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{className:s?"text-right block":"text-left block",children:s?"إجمالي الجوائز (ريال)":"Total Prize (SAR)"}),e.jsx(f,{type:"number",value:r.total_prize,onChange:l=>c({total_prize:l.target.value}),placeholder:"100000",className:s?"text-right":"text-left"}),r.total_prize&&e.jsx("p",{className:`text-sm text-muted-foreground ${s?"text-right":"text-left"}`,children:s?`${R(r.total_prize)} ريال سعودي`:`SAR ${R(r.total_prize)}`})]})})]}),e.jsxs(C,{children:[e.jsx(z,{children:e.jsxs("div",{className:`flex items-center justify-between ${s?"flex-row-reverse":""}`,children:[e.jsxs("div",{children:[e.jsx(S,{className:s?"text-right":"text-left",children:s?"تفاصيل الجوائز":"Prize Breakdown"}),e.jsx(T,{className:s?"text-right":"text-left",children:s?"أضف تفاصيل كل جائزة":"Add details for each prize"})]}),e.jsxs(b,{onClick:t,variant:"outline",size:"sm",className:`gap-2 ${s?"flex-row-reverse":""}`,children:[e.jsx(H,{className:"h-4 w-4"}),s?"إضافة جائزة":"Add Prize"]})]})}),e.jsx(D,{className:"space-y-4",children:r.prizes.length===0?e.jsx("p",{className:`text-muted-foreground text-sm ${s?"text-right":"text-left"}`,children:s?"لم يتم إضافة جوائز بعد":"No prizes added yet"}):r.prizes.map((l,i)=>e.jsxs("div",{className:`border rounded-lg p-4 space-y-3 ${N(l.rank)}`,children:[e.jsxs("div",{className:`flex items-center justify-between ${s?"flex-row-reverse":""}`,children:[e.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[w(l.rank),e.jsx("span",{className:"font-medium",children:s?l.title_ar:l.title_en})]}),e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>a(i),children:e.jsx(B,{className:"h-4 w-4 text-destructive"})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:s?"العنوان (عربي)":"Title (Arabic)"}),e.jsx(f,{value:l.title_ar,onChange:n=>g(i,"title_ar",n.target.value),className:"text-right",dir:"rtl"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:s?"العنوان (إنجليزي)":"Title (English)"}),e.jsx(f,{value:l.title_en,onChange:n=>g(i,"title_en",n.target.value),className:"text-left",dir:"ltr"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:s?"قيمة الجائزة (ريال)":"Prize Amount (SAR)"}),e.jsx(f,{type:"number",value:l.amount,onChange:n=>g(i,"amount",parseInt(n.target.value)||0),placeholder:"50000"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:s?"الوصف (عربي)":"Description (Arabic)"}),e.jsx(O,{value:l.description_ar,onChange:n=>g(i,"description_ar",n.target.value),className:"text-right min-h-[60
1px]",dir:"rtl"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:s?"الوصف (إنجليزي)":"Description (English)"}),e.jsx(O,{value:l.description_en,onChange:n=>g(i,"description_en",n.target.value),className:"text-left min-h-[60px]",dir:"ltr"})]})]})]},l.id))})]})]})}function Se({data:r,onChange:c}){const{language:o}=P(),s=o==="ar",t=()=>{const i={id:`temp-${Date.now()}`,email:"",message:""};c({judges:[...r.judges,i]})},g=(i,n,u)=>{const k=[...r.judges];k[i]={...k[i],[n]:u},c({judges:k})},a=i=>{c({judges:r.judges.filter((n,u)=>u!==i)})},w=()=>{const i={id:`temp-${Date.now()}`,email:"",message:""};c({mentors:[...r.mentors,i]})},N=(i,n,u)=>{const k=[...r.mentors];k[i]={...k[i],[n]:u},c({mentors:k})},l=i=>{c({mentors:r.mentors.filter((n,u)=>u!==i)})};return e.jsxs("div",{className:"space-y-6",dir:s?"rtl":"ltr",children:[e.jsxs(C,{children:[e.jsx(z,{children:e.jsxs("div",{className:`flex items-center justify-between ${s?"flex-row-reverse":""}`,children:[e.jsxs("div",{className:`flex items-center gap-3 ${s?"flex-row-reverse":""}`,children:[e.jsx(X,{className:"h-5 w-5 text-primary"}),e.jsxs("div",{children:[e.jsx(S,{className:s?"text-right":"text-left",children:s?"المحكمون":"Judges"}),e.jsx(T,{className:s?"text-right":"text-left",children:s?"أضف المحكمين لتقييم المشاريع":"Add judges to evaluate projects"})]})]}),e.jsxs(b,{onClick:t,variant:"outline",size:"sm",className:`gap-2 ${s?"flex-row-reverse":""}`,children:[e.jsx(H,{className:"h-4 w-4"}),s?"إضافة محكم":"Add Judge"]})]})}),e.jsx(D,{className:"space-y-4",children:r.judges.length===0?e.jsxs("div",{className:`text-center py-8 border-2 border-dashed rounded-lg ${s?"text-right":"text-left"}`,children:[e.jsx(X,{className:"h-10 w-10 mx-auto text-muted-foreground mb-2"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:s?"لم يتم إضافة محكمين بعد":"No judges added yet"}),e.jsx("p",{className:"text-muted-foreground text-xs mt-1",children:s?"سيتم إرسال دعوات بعد نشر الهاكاثون":"Invitations will be sent after publishing"})]}):r.judges.map((i,n)=>e.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[e.jsxs("div",{className:`flex items-center justify-between ${s?"flex-row-reverse":""}`,children:[e.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[e.jsx(K,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium text-sm",children:s?`محكم ${n+1}`:`Judge ${n+1}`}),e.jsx(L,{variant:"secondary",className:"text-xs",children:s?"في الانتظار":"Pending"})]}),e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>a(n),children:e.jsx(B,{className:"h-4 w-4 text-destructive"})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(h,{className:"text-xs",children:[s?"البريد الإلكتروني":"Email Address"," *"]}),e.jsx(f,{type:"email",value:i.email,onChange:u=>g(n,"email",u.target.value),placeholder:"[email protected]",dir:"ltr"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:s?"رسالة الدعوة (اختياري)":"Invitation Message (Optional)"}),e.jsx(O,{value:i.message,onChange:u=>g(n,"message",u.target.value),placeholder:s?"رسالة مخصصة للمحكم...":"Custom message for the judge...",className:`min-h-[60px] ${s?"text-right":"text-left"}`})]})]})]},i.id))})]}),e.jsxs(C,{children:[e.jsx(z,{children:e.jsxs("div",{className:`flex items-center justify-between ${s?"flex-row-reverse":""}`,children:[e.jsxs("div",{className:`flex items-center gap-3 ${s?"flex-row-reverse":""}`,children:[e.jsx(Y,{className:"h-5 w-5 text-primary"}),e.jsxs("div",{children:[e.jsx(S,{className:s?"text-right":"text-left",children:s?"المرشدون":"Mentors"}),e.jsx(T,{className:s?"text-right":"text-left",children:s?"أضف المرشدين لدعم المشاركين":"Add mentors to support participants"})]})]}),e.jsxs(b,{onClick:w,variant:"outline",size:"sm",className:`gap-2 ${s?"flex-row-reverse":""}`,children:[e.jsx(H,{className:"h-4 w-4"}),s?"إضافة مرشد":"Add Mentor"]})]})}),e.jsx(D,{className:"space-y-4",children:r.mentors.length===0?e.jsxs("div",{className:`text-center py-8 border-2 border-dashed rounded-lg ${s?"text-right":"text-left"}`,children:[e.jsx(Y,{className:"h-10 w-10 mx-auto text-muted-foreground mb-2"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:s?"لم يتم إضافة مرشدين بعد":"No mentors added yet"}),e.jsx("p",{className:"text-muted-foreground text-xs mt-1",children:s?"سيتم إرسال دعوات بعد نشر الهاكاثون":"Invitations will be sent after publishing"})]}):r.mentors.map((i,n)=>e.jsxs("div",{className:"border rounded-lg p-4 space-y-3",children:[e.jsxs("div",{className:`flex items-center justify-between ${s?"flex-row-reverse":""}`,children:[e.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[e.jsx(K,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium text-sm",children:s?`مرشد ${n+1}`:`Mentor ${n+1}`}),e.jsx(L,{variant:"secondary",className:"text-xs",children:s?"في الانتظار":"Pending"})]}),e.jsx(b,{variant:"ghost",size:"sm",onClick:()=>l(n),children:e.jsx(B,{className:"h-4 w-4 text-destructive"})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(h,{className:"text-xs",children:[s?"البريد الإلكتروني":"Email Address"," *"]}),e.jsx(f,{type:"email",value:i.email,onChange:u=>N(n,"email",u.target.value),placeholder:"[email protected]",dir:"ltr"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(h,{className:"text-xs",children:s?"رسالة الدعوة (اختياري)":"Invitation Message (Optional)"}),e.jsx(O,{value:i.message,onChange:u=>N(n,"message",u.target.value),placeholder:s?"رسالة مخصصة للمرشد...":"Custom message for the mentor...",className:`min-h-[60
1px] ${s?"text-right":"text-left"}`})]})]})]},i.id))})]})]})}function De({data:r,checklist:c}){var N,l;const{language:o}=P(),s=o==="ar",t=i=>{if(!i)return"-";try{return me(new Date(i),"PPP",{locale:s?ge:ue})}catch{return i}},g=Object.values(c).every(Boolean),a={technology:{ar:"التقنية",en:"Technology"},ai:{ar:"الذكاء الاصطناعي",en:"AI"},fintech:{ar:"التقنية المالية",en:"FinTech"},healthcare:{ar:"الصحة",en:"Healthcare"},education:{ar:"التعليم",en:"Education"},sustainability:{ar:"الاستدامة",en:"Sustainability"},social:{ar:"الابتكار الاجتماعي",en:"Social Innovation"},other:{ar:"أخرى",en:"Other"}},w={online:{ar:"عن بُعد",en:"Online"},onsite:{ar:"حضوري",en:"On-site"},hybrid:{ar:"مختلط",en:"Hybrid"}};return e.jsxs("div",{className:"space-y-6",dir:s?"rtl":"ltr",children:[e.jsxs(C,{className:g?"border-green-500/50 bg-green-500/5":"border-yellow-500/50 bg-yellow-500/5",children:[e.jsxs(z,{children:[e.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[g?e.jsx(Z,{className:"h-5 w-5 text-green-500"}):e.jsx(de,{className:"h-5 w-5 text-yellow-500"}),e.jsx(S,{className:s?"text-right":"text-left",children:s?"قائمة التحقق للنشر":"Publishing Checklist"})]}),e.jsx(T,{className:s?"text-right":"text-left",children:g?s?"الهاكاثون جاهز للنشر!":"Hackathon is ready to publish!":s?"أكمل العناصر المطلوبة للنشر":"Complete required items to publish"})]}),e.jsx(D,{children:e.jsx("div",{className:"space-y-2",children:[{key:"hasTitle",label:s?"اسم الهاكاثون":"Hackathon Title",checked:c.hasTitle},{key:"hasDescription",label:s?"الوصف":"Description",checked:c.hasDescription},{key:"hasDates",label:s?"تاريخ البداية والنهاية":"Start & End Dates",checked:c.hasDates},{key:"hasBanner",label:s?"صورة البانر":"Banner Image",checked:c.hasBanner},{key:"hasChallenge",label:s?"تحدي واحد على الأقل":"At least one challenge",checked:c.hasChallenge}].map(i=>e.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[i.checked?e.jsx(Z,{className:"h-4 w-4 text-green-500"}):e.jsx(xe,{className:"h-4 w-4 text-destructive"}),e.jsx("span",{className:i.checked?"text-foreground":"text-muted-foreground",children:i.label})]},i.key))})})]}),e.jsxs(C,{children:[e.jsx(z,{children:e.jsx(S,{className:s?"text-right":"text-left",children:s?"معاينة الهاكاثون":"Hackathon Preview"})}),e.jsxs(D,{className:"space-y-6",children:[r.banner_url&&e.jsx("div",{className:"rounded-lg overflow-hidden border",children:e.jsx("img",{src:r.banner_url,alt:"Banner",className:"w-full h-48 object-cover"})}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:`text-2xl font-bold ${s?"text-right":"text-left"}`,children:r.title||(s?"بدون عنوان":"Untitled")}),e.jsxs("div",{className:`flex items-center gap-2 flex-wrap ${s?"flex-row-reverse justify-end":""}`,children:[r.category&&e.jsx(L,{variant:"secondary",children:((N=a[r.category])==null?void 0:N[s?"ar":"en"])||r.category}),r.event_type&&e.jsx(L,{variant:"outline",children:((l=w[r.event_type])==null?void 0:l[s?"ar":"en"])||r.event_type})]})]}),r.description&&e.jsx("p",{className:`text-muted-foreground ${s?"text-right":"text-left"}`,children:r.description}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[e.jsx(Q,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{className:s?"text-right":"text-left",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s?"البداية":"Start"}),e.jsx("p",{className:"text-sm font-medium",children:t(r.start_date)})]})]}),e.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[e.jsx(Q,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{className:s?"text-right":"text-left",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s?"النهاية":"End"}),e.jsx("p",{className:"text-sm font-medium",children:t(r.end_date)})]})]}),r.location&&e.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[e.jsx(he,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{className:s?"text-right":"text-left",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s?"الموقع":"Location"}),e.jsx("p",{className:"text-sm font-medium",children:r.location})]})]}),r.total_prize&&e.jsxs("div",{className:`flex items-center gap-2 ${s?"flex-row-reverse":""}`,children:[e.jsx(re,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs("div",{className:s?"text-right":"text-left",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s?"الجوائز":"Prizes"}),e.jsxs("p",{className:"text-sm font-medium",children:[R(r.total_prize)," ",s?"ريال":"SAR"]})]})]})]}),e.jsxs("div",{className:"border-t pt-4 grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[e.jsx("p",{className:"text-2xl font-bold",children:r.objectives.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s?"أهداف":"Objectives"})]}),e.jsxs("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[e.jsx("p",{className:"text-2xl font-bold",children:r.challenges.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s?"تحديات":"Challenges"})]}),e.jsxs("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[e.jsx("p",{className:"text-2xl font-bold",children:r.prizes.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s?"جوائز":"Prizes"})]}),e.jsxs("div",{className:"text-center p-3 bg-muted/50 rounded-lg",children:[e.jsx("p",{className:"text-2xl font-bold",children:r.judges.length+r.mentors.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s?"محكمون ومرشدون":"Judges & Mentors"})]})]})]})]})]})}const te=7,Te={title:"",category:"",event_type:"online",description:"",banner_url:"",banner_video_url:"",banner_type:"image",hero_subtitle_ar:"",hero_subtitle_en:"",start_date:"",end_date:"",registration_start:"",registration_deadline:"",location:"",city:"",google_maps_url:"",objectives:[],challenges:[],total_prize:"",prizes:[],judges:[],mentors:[]};function Be(){const{language:r}=P(),{user:c}=je(),o=pe(),s=r==="ar",[t,g]=A.useState(1),[a,w]=A.useState(Te),[N,l]=A.useState(!1),[i,n]=A.useState(!1),[u,k]=A.useState(null),[d,m]=A.useState(null),j={1:s?"المعلومات الأساسية":"Basic Info",2:s?"الوصف والصورة":"Description & Banner",3:s?"التواريخ والموقع":"Dates & Location",4:s?"الأهداف والتحديات":"Goals & Challenges",5:s?"الجوائز":"Prizes",6:s?"المحكمون والمرشدون":"Judges & Mentors",7:s?"المعاينة والنشر":"Preview & Publish"};A.useEffect(()=>{(async()=>
1{if(!c)return;const{data:v}=await $.from("organization_members").select("organization_id").eq("user_id",c.id).single();v&&k(v.organization_id)})()},[c]);const _=p=>{w(v=>({...v,...p}))},le=async()=>{if(!u||!c){y.error(s?"يرجى تسجيل الدخول":"Please sign in");return}l(!0);try{const p={title:a.title||"مسودة",description:a.description,banner_url:a.banner_url,banner_video_url:a.banner_video_url,banner_type:a.banner_type,category:a.category,event_type:a.event_type,start_date:a.start_date||null,end_date:a.end_date||null,registration_start:a.registration_start||null,registration_deadline:a.registration_deadline||null,location:a.location,city:a.city,google_maps_url:a.google_maps_url,hero_subtitle_ar:a.hero_subtitle_ar,hero_subtitle_en:a.hero_subtitle_en,stats_total_prize:a.total_prize,status:"draft",organization_id:u,created_by:c.id};if(d){const{error:v}=await $.from("hackathons").update(p).eq("id",d);if(v)throw v}else{const{data:v,error:x}=await $.from("hackathons").insert(p).select().single();if(x)throw x;m(v.id)}y.success(s?"تم حفظ المسودة":"Draft saved")}catch(p){console.error("Error saving draft:",p),y.error(s?"فشل حفظ المسودة":"Failed to save draft")}finally{l(!1)}},ie=async()=>{if(!u||!c){y.error(s?"يرجى تسجيل الدخول":"Please sign in");return}if(!E.hasTitle||!E.hasDescription||!E.hasDates){y.error(s?"يرجى إكمال الحقول المطلوبة":"Please complete required fields");return}n(!0);try{const p={title:a.title,description:a.description,banner_url:a.banner_url,banner_video_url:a.banner_video_url,banner_type:a.banner_type,category:a.category,event_type:a.event_type,start_date:a.start_date,end_date:a.end_date,registration_start:a.registration_start||null,registration_deadline:a.registration_deadline||null,location:a.location,city:a.city,google_maps_url:a.google_maps_url,hero_subtitle_ar:a.hero_subtitle_ar,hero_subtitle_en:a.hero_subtitle_en,stats_total_prize:a.total_prize,status:"published",organization_id:u,created_by:c.id};let v=d;if(d){const{error:x}=await $.from("hackathons").update(p).eq("id",d);if(x)throw x}else{const{data:x,error:I}=await $.from("hackathons").insert(p).select().single();if(I)throw I;v=x.id}if(a.objectives.length>0&&v)for(let x=0;x<a.objectives.length;x++){const I=a.objectives[x];await $.from("hackathon_objectives").insert({hackathon_id:v,text_ar:I.text_ar,text_en:I.text_en,order_index:x})}if(a.challenges.length>0&&v)for(const x of a.challenges)await $.from("challenges").insert({hackathon_id:v,title:x.title_ar||x.title_en,title_ar:x.title_ar||x.title_en,title_en:x.title_en||null,description:x.description_ar||x.description_en,description_ar:x.description_ar||x.description_en,description_en:x.description_en||null});for(const x of a.judges)x.email&&await $.functions.invoke("invite-judge",{body:{hackathon_id:v,email:x.email,message:x.message}});for(const x of a.mentors)x.email&&await $.functions.invoke("invite-mentor",{body:{hackathon_id:v,email:x.email,message:x.message}});y.success(s?"تم نشر الهاكاثون بنجاح!":"Hackathon published successfully!"),o(`/organizer/hackathons/${v}`)}catch(p){console.error("Error publishing:",p),y.error(s?"فشل نشر الهاكاثون":"Failed to publish hackathon")}finally{n(!1)}},E={hasTitle:!!a.title,hasDescription:!!a.description,hasDates:!!a.start_date&&!!a.end_date,hasBanner:!!a.banner_url||!!a.banner_video_url,hasChallenge:a.challenges.length>0},ne=E.hasTitle&&E.hasDescription&&E.hasDates,ce=()=>{switch(t){case 1:return e.jsx(we,{data:a,onChange:_});case 2:return e.jsx(ke,{data:a,hackathonTitle:a.title,onChange:_});case 3:return e.jsx($e,{data:a,eventType:a.event_type,onChange:_});case 4:return e.jsx(Ce,{data:a,hackathonTitle:a.title,onChange:_});case 5:return e.jsx(ze,{data:a,onChange:_});case 6:return e.jsx(Se,{data:a,onChange:_});case 7:return e.jsx(De,{data:a,checklist:E});default:return null}};return e.jsxs("div",{className:"min-h-screen bg-background",dir:s?"rtl":"ltr",children:[e.jsx("div",{className:"border-b bg-card sticky top-0 z-10",children:e.jsxs("div",{className:"container mx-auto px-4 py-4",children:[e.jsxs("div",{className:`flex items-center justify-between ${s?"flex-row-reverse":""}`,children:[e.jsx("h1",{className:`text-xl font-bold ${s?"text-right":"text-left"}`,children:s?"إنشاء هاكاثون جديد":"Create New Hackathon"}),e.jsxs(b,{variant:"outline",onClick:le,disabled:N,className:`gap-2 ${s?"flex-row-reverse":""}`,children:[N?e.jsx(M,{className:"h-4 w-4 animate-spin"}):e.jsx(ve,{className:"h-4 w-4"}),s?"حفظ كمسودة":"Save Draft"]})]}),e.jsx("div",{className:"mt-4 flex items-center justify-center gap-2",children:Array.from({length:te},(p,v)=>v+1).map(p=>e.jsxs("button",{onClick:()=>g(p),className:`flex items-center gap-1 px-3 py-1.5 rounded-full text-sm transition-colors ${p===t?"bg-primary text-primary-foreground":p<t?"bg-primary/20 text-primary":"bg-muted text-muted-foreground"}`,children:[e.jsx("span",{className:"font-medium",children:p}),e.jsx("span",{className:"hidden md:inline",children:j[p]})]},p))})]})}),e.jsx("div",{className:"container mx-auto px-4 py-8 max-w-4xl",children:ce()}),e.jsx("div",{className:"border-t bg-card sticky bottom-0",children:e.jsx("div",{className:"container mx-auto px-4 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(b,{variant:"outline",onClick:()=>g(p=>p-1),disabled:t===1,className:"gap-2",children:[e.jsx(fe,{className:"h-4 w-4 rtl-flip"}),s?"السابق":"Previous"]}),t===te?e.jsxs(b,{onClick:ie,disabled:!ne||i,className:"gap-2",children:[i?e.jsx(M,{className:"h-4 w-4 animate-spin"}):e.jsx(Ne,{className:"h-4 w-4"}),s?"نشر الهاكاثون":"Publish Hackathon"]}):e.jsxs(b,{onClick:()=>g(p=>p+1),className:"gap-2",children:[s?"التالي":"Next",e.jsx(be,{className:"h-4 w-4 rtl-flip"})]})]})})})]})}export{Be 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.