PageSourceSearch

https://atzuma.co.il/assets/PetitionManagePage-CZWXWVdj.js

js atzuma.co.il collected 2026-10-02 07:47:33 UTC 54,388 bytes, 163 lines download raw bytes

1import{j as e,g as Q,u as pe}from"./index-C_Fqshtm.js";import{r as l,d as ge,u as ue,e as he}from"./router-BXL9ASSk.js";import{a as L}from"./index-BqDtoUCL.js";import{PetitionEditor as fe}from"./PetitionEditor-BqXZx-Oe.js";import{PetitionUpdatesManager as xe}from"./PetitionUpdatesManager-DWfCjQ75.js";import{f as te}from"./storage-FL96OxJv.js";import"./vendor-BNcAc9ko.js";import"./ImageUpload-UTlKN7LT.js";import"./RichTextEditor-C4AcvHzH.js";import"./Editor-qH2SyrCb.js";/* empty css                         */(function(){try{var c=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};c.SENTRY_RELEASE={id:"[email protected]"}}catch{}})();try{(function(){var c=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},A=new c.Error().stack;A&&(c._sentryDebugIds=c._sentryDebugIds||{},c._sentryDebugIds[A]="ccaf6ddf-49e5-4d5f-a97e-36ceb2fd6d9a",c._sentryDebugIdIdentifier="sentry-dbid-ccaf6ddf-49e5-4d5f-a97e-36ceb2fd6d9a")})()}catch{}const be=({petitionId:c,language:A,onClose:p,onSuccess:E})=>{const[x,u]=l.useState(""),[t,g]=l.useState(!1),[_,f]=l.useState(""),h=A==="he",b={en:{title:"Declare Victory! 🏆",subtitle:"Congratulations! Your petition has achieved its goal.",description:"Share the good news with your supporters and celebrate this achievement!",victoryDescriptionLabel:"Victory Description",victoryDescriptionPlaceholder:"Describe how your petition succeeded and what was achieved...",requirements:"Requirements:",req1:"• Describe the specific outcome or achievement",req2:"• Explain how supporters made a difference",req3:"• Share what happens next (if applicable)",examplesTitle:"Examples of victory descriptions:",example1:'"The company has officially changed their policy after 5,000 supporters signed this petition!"',example2:'"The city council voted unanimously to approve our proposal thanks to your incredible support!"',example3:'"The legislation was passed and will take effect next month - we did it together!"',declare:"Declare Victory",declaring:"Declaring...",cancel:"Cancel",fillRequired:"נא לתאר את ההצלחה",minLength:"Victory description must be at least 20 characters",declareError:"Error declaring victory",successTitle:"Victory Declared! 🎉",successMessage:"Your petition has been marked as victorious. All supporters will be notified of this great achievement!"},he:{title:"הכרז על הצלחה! 🏆",subtitle:"מזל טוב! העצומה שלך הגיעה למטרתה.",description:"שתף את החדשות הטובות עם התומכים שלך וחגוג את ההישג הזה!",victoryDescriptionLabel:"תיאור ההצלחה",victoryDescriptionPlaceholder:"תאר כיצד העצומה שלך הצליחה ומה הושג...",requirements:"דרישות:",req1:"• תאר את התוצאה או ההישג הספציפי",req2:"• הסבר כיצד התומכים עשו את ההבדל",req3:"• שתף מה קורה הלאה (במידה ורלוונטי)",examplesTitle:"דוגמאות לתיאורי הצלחה:",example1:'"החברה שינתה רשמית את המדיניות שלה אחרי ש-5,000 תומכים חתמו על העצומה!"',example2:'"מועצת העיר הצביעה פה אחד לאשר את ההצעה שלנו הודות לתמיכה המדהימה שלכם!"',example3:'"החקיקה עברה ותיכנס לתוקף בחודש הבא - עשינו את זה ביחד!"',declare:"הכרז על הצלחה",declaring:"מכריז...",cancel:"ביטול",fillRequired:"אנא תאר את ההצלחה שלך",minLength:"תיאור ההצלחה חייב להכיל לפחות 20 תווים",declareError:"שגיאה בהכרזת הצלחה",successTitle:"הצלחה הוכרזה! 🎉",successMessage:"העצומה שלך סומנה כמנצחת. כל התומכים יקבלו הודעה על ההישג הגדול הזה!"}},s=k=>b[A==="he"?"he":"en"]?.[k]||b.en?.[k]||k,n=async k=>{if(k.preventDefault(),!x.trim()){f(s("fillRequired"));return}if(x.trim().length<20){f(s("minLength"));return}try{g(!0),f("");const d=localStorage.getItem("auth_token"),I=await L.post(`/api/v1/petitions/${c}/declare-victory`,{victory_description:x.trim()},{headers:{Authorization:`Bearer ${d}`,"Content-Type":"application/json"}});console.log("✅ Victory declared:",I.data),E()}catch(d){console.error("💥 Error declaring victory:",d),f(d.response?.data?.message||s("declareError"))}finally{g(!1)}};return e.jsxs("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,padding:"1rem",direction:h?"rtl":"ltr"},children:[e.jsx("style",{children:`
2          @keyframes spin {
3            0% { transform: rotate(0deg); }
4            100% { transform: rotate(360deg); }
5          }
6          .victory-modal {
7            background: white;
8            border-radius: 1rem;
9            padding: 2rem;
10            max-width: 600px;
11            width: 100%;
12            max-height: 90vh;
13            overflow-y: auto;
14            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
15          }
16          .form-input {
17            width: 100%;
18            padding: 0.75rem 1rem;
19            border: 2px solid #e5e7eb;
20            border-radius: 0.5rem;
21            font-size: 1rem;
22            outline: none;
23            transition: border-color 0.2s ease;
24            box-sizing: border-box;
25            font-family: inherit;
26          }
27          .form-input:focus {
28            border-color: #059669;
29          }
30          .form-label {
31            display: block;
32            font-size: 0.875rem;
33            font-weight: 600;
34            color: #374151;
35            margin-bottom: 0.5rem;
36          }
37          .button-primary {
38            background: linear-gradient(135deg, #059669 0%, #047857 100%);
39            color: white;
40            border: none;
41            padding: 0.75rem 1.5rem;
42            border-radius: 0.5rem;
43            font-weight: 600;
44            cursor: pointer;
45            transition: all 0.2s ease;
46            display: flex;
47            align-items: center;
48            gap: 0.5rem;
49            justify-content: center;
50          }
51          .button-primary:hover:not(:disabled) {
52            transform: translateY(-1px);
53            box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
54          }
55          .button-primary:disabled {
56            opacity: 0.5;
57            cursor: not-allowed;
58            transform: none !important;
59            box-shadow: none !important;
60          }
61          .button-secondary {
62            background: transparent;
63            color: #6b7280;
64            border: 2px solid #e5e7eb;
65            padding: 0.75rem 1.5rem;
66            border-radius: 0.5rem;
67            font-weight: 600;
68            cursor: pointer;
69            transition: all 0.2s ease;
70          }
71          .button-secondary:hover {
72            background: #f9fafb;
73            border-color: #d1d5db;
74          }
75        `}),e.jsxs("div",{className:"victory-modal",children:[e.jsxs("div",{style:{textAlign:"center",marginBottom:"2rem"},children:[e.jsx("div",{style:{fontSize:"4rem",marginBottom:"1rem"},children:"🏆"}),e.jsx("h2",{style:{fontSize:"1.75rem",fontWeight:"bold",color:"#111827",marginBottom:"0.5rem"},children:s("title")}),e.jsx("p",{style:{color:"#6b7280",fontSize:"1.125rem"},children:s("subtitle")})]}),e.jsx("div",{style:{background:"#f0fdf4",border:"1px solid #bbf7d0",borderRadius:"0.5rem",padding:"1rem",marginBottom:"2rem"},children:e.jsx("p",{style:{color:"#166534",fontSize:"1rem",textAlign:h?"right":"left"},children:s("description")})}),_&&e.jsx("div",{style:{background:"#fef2f2",border:"1px solid #fecaca",borderRadius:"0.5rem",padding:"1rem",marginBottom:"1.5rem"},children:e.jsx("div",{style:{color:"#dc2626"},children:_})}),e.jsxs("form",{onSubmit:n,children:[e.jsxs("div",{style:{marginBottom:"1.5rem"},children:[e.jsxs("label",{className:"form-label",style:{textAlign:h?"right":"left"},children:[s("victoryDescriptionLabel")," *"]}),e.jsx("textarea",{className:"form-input",style:{textAlign:h?"right":"left",minHeight:"120px",resize:"vertical"},value:x,onChange:k=>u(k.target.value),placeholder:s("victoryDescriptionPlaceholder"),disabled:t,required:!0})]}),e.jsxs("div",{style:{background:"#f8fafc",border:"1px solid #e2e8f0",borderRadius:"0.5rem",padding:"1rem",marginBottom:"1.5rem"},children:[e.jsx("h4",{style:{fontSize:"0.875rem",fontWeight:"600",color:"#374151",marginBottom:"0.5rem",textAlign:h?"right":"left"},children:s("requirements")}),e.jsxs("div",{style:{fontSize:"0.75rem",color:"#6b7280",lineHeight:"1.5",textAlign:h?"right":"left"},children:[e.jsx("div",{children:s("req1")}),e.jsx("div",{children:s("req2")}),e.jsx("div",{children:s("req3")})]})]}),e.jsxs("div",{style:{background:"#fefbf3",border:"1px solid #fed7aa",borderRadius:"0.5rem",padding:"1rem",marginBottom:"2rem"},children:[e.jsx("h4",{style:{fontSize:"0.875rem",fontWeight:"600",color:"#92400e",marginBottom:"0.5rem",textAlign:h?"right":"left"},children:s("examplesTitle")}),e.jsxs("div",{style:{fontSize:"0.75rem",color:"#92400e",lineHeight:"1.5",textAlign:h?"right":"left"},children:[e.jsx("div",{style:{marginBottom:"0.5rem"},children:s("example1")}),e.jsx("div",{style:{marginBottom:"0.5rem"},children:s("example2")}),e.jsx("div",{children:s("example3")})]})]}),e.jsxs("div",{style:{display:"flex",gap:"1rem",justifyContent:"flex-end",flexDirection:h?"row-reverse":"row",paddingTop:"1rem",borderTop:"1px solid #e5e7eb"},children:[e.jsx("button",{type:"button",onClick:p,className:"button-secondary",disabled:t,children:s("cancel")}),e.jsxs("button",{type:"submit",className:"button-primary",disabled:t||x.trim().length<20,children:[t&&e.jsx("div",{style:{width:"1rem",he
75ight:"1rem",border:"2px solid transparent",borderTop:"2px solid white",borderRadius:"50%",animation:"spin 1s linear infinite"}}),e.jsx("span",{children:"🏆"}),s(t?"declaring":"declare")]})]})]})]})]})},ye=({petitionId:c,petitionTitle:A,language:p,onClose:E,onSuccess:x})=>{const[u,t]=l.useState(""),[g,_]=l.useState(!1),[f,h]=l.useState(""),[b,s]=l.useState(!1),n=p==="he",k={en:{title:"Close Petition",subtitle:"Are you sure you want to close this petition?",description:"The petition will be closed and no new signatures will be accepted. You can reopen it at any time from the petition management screen.",petitionTitle:"Petition to close:",reasonLabel:"Reason for Closing",reasonPlaceholder:"נא לציין סיבה לסגירת העצומה...",confirmationLabel:"Check to confirm closing the petition",confirmationText:"CLOSE",closeButton:"Close Petition",closing:"Closing...",cancel:"Cancel",cancelButton:"Cancel",consequences:"Consequences of closing:",fillRequired:"נא למלא את כל השדות הנדרשים",confirmationMismatch:'נא להקליד "CLOSE" לאישור',reasonTooShort:"Reason must be at least 10 characters",closeError:"Error closing petition",cons1:"• You can reopen the petition at any time",cons2:"• No new signatures will be accepted",cons3:"• The petition will be marked as closed",cons5:"• You can still view the petition but cannot modify it"},he:{title:"סגור עצומה",subtitle:"האם אתה בטוח שברצונך לסגור את העצומה הזו?",description:"העצומה תיסגר ולא יתקבלו חתימות חדשות. ניתן לפתוח אותה מחדש בכל עת ממסך ניהול העצומה.",petitionTitle:"עצומה לסגירה:",reasonLabel:"סיבה לסגירה",reasonPlaceholder:"אנא ספק סיבה לסגירת העצומה הזו...",confirmationLabel:"סמן לאישור סגירת העצומה",confirmationText:"סגור",closeButton:"סגור עצומה",closing:"סוגר...",cancel:"ביטול",cancelButton:"ביטול",consequences:"השלכות הסגירה:",fillRequired:"אנא מלא את כל השדות הנדרשים",confirmationMismatch:'אנא הקלד "סגור" לאישור',reasonTooShort:"הסיבה חייבת להכיל לפחות 10 תווים",closeError:"שגיאה בסגירת העצומה",cons1:"• ניתן לפתוח את העצומה מחדש בכל עת",cons2:"• לא יתקבלו חתימות חדשות",cons3:"• העצומה תסומן כסגורה",cons5:"• ניתן עדיין לצפות בעצומה אך לא לשנות אותה"}},d=o=>k[p==="he"?"he":"en"]?.[o]||k.en?.[o]||o,I=async o=>{if(o.preventDefault(),!b){h(d("confirmRequired"));return}try{_(!0),h("");const C=localStorage.getItem("auth_token");if(!C){h("Authentication required");return}console.log("🔒 Closing petition:",c);const $=await L.post(`/api/v1/petitions/${c}/close`,{close_reason:u.trim()||void 0},{headers:{Authorization:`Bearer ${C}`,"Content-Type":"application/json"}});console.log("✅ Petition closed successfully:",$.data),x()}catch(C){console.error("💥 Error closing petition:",C),h(C.response?.data?.message||d("closeError"))}finally{_(!1)}};return e.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,padding:"1rem",backdropFilter:"blur(8px)",direction:n?"rtl":"ltr"},onClick:E,children:e.jsxs("div",{style:{background:"white",borderRadius:"16px",padding:"2rem",width:"100%",maxWidth:"600px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",maxHeight:"90vh",overflowY:"auto",boxSizing:"border-box"},onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{style:{textAlign:"center",marginBottom:"2rem"},children:[e.jsx("div",{style:{fontSize:"4rem",marginBottom:"1rem"},children:"🔒"}),e.jsx("h2",{style:{fontSize:"2rem",fontWeight:"bold",color:"#111827",marginBottom:"0.5rem"},children:d("title")}),e.jsx("p",{style:{fontSize:"1.25rem",color:"#dc2626",fontWeight:"600",marginBottom:"0.5rem"},children:d("subtitle")}),e.jsx("p",{style:{color:"#6b7280",fontSize:"1rem"},children:d("description")})]}),e.jsxs("div",{style:{background:"#f9fafb",border:"1px solid #e5e7eb",borderRadius:"8px",padding:"1rem",marginBottom:"2rem"},children:[e.jsx("h3",{style:{fontSize:"0.875rem",fontWeight:"600",color:"#6b7280",marginBottom:"0.5rem",textAlign:n?"right":"left"},children:d("petitionTitle")}),e.jsx("p",{style:{fontSize:"1.125rem",fontWeight:"600",color:"#111827",textAlign:n?"right":"left"},children:A}),e.jsxs("p",{style:{fontSize:"0.875rem",color:"#6b7280",marginTop:"0.25rem",textAlign:n?"right":"left"},children:["Petition #",c]})]}),e.jsxs("div",{style:{background:"#fef3c7",border:"1px solid #fcd34d",borderRadius:"8px",padding:"1rem",marginBottom:"2rem"},children:[e.jsxs("h4",{style:{fontSize:"0.875rem",fontWeight:"600",color:"#92400e",marginBottom:"0.75rem",textAlign:n?"right":"left"},children:["⚠️ ",d("consequences")]}),e.jsxs("ul",{style:{listStyle:"none",padding:0,margin:0,color:"#b45309",fontSize:"0.875rem",textAlign:"right",direction:"rtl"},children:[e.jsxs("li",{style:{display:"flex",alignItems:"flex-start",ga
75p:"0.5rem",marginBottom:"0.5rem",flexDirection:n?"row-reverse":"row",justifyContent:"flex-end"},children:[e.jsx("span",{children:"•"}),e.jsx("span",{children:d("cons1")})]}),e.jsxs("li",{style:{display:"flex",alignItems:"flex-start",gap:"0.5rem",marginBottom:"0.5rem",flexDirection:n?"row-reverse":"row",justifyContent:"flex-end"},children:[e.jsx("span",{children:"•"}),e.jsx("span",{children:d("cons2")})]}),e.jsxs("li",{style:{display:"flex",alignItems:"flex-start",gap:"0.5rem",marginBottom:"0.5rem",flexDirection:n?"row-reverse":"row",justifyContent:"flex-end"},children:[e.jsx("span",{children:"•"}),e.jsx("span",{children:d("cons3")})]}),e.jsxs("li",{style:{display:"flex",alignItems:"flex-start",gap:"0.5rem",flexDirection:n?"row-reverse":"row",justifyContent:"flex-end"},children:[e.jsx("span",{children:"•"}),e.jsx("span",{children:d("cons5")})]})]})]}),f&&e.jsx("div",{style:{background:"#fef2f2",border:"1px solid #fecaca",borderRadius:"0.5rem",padding:"1rem",marginBottom:"1.5rem"},children:e.jsx("div",{style:{color:"#dc2626",fontSize:"0.875rem"},children:f})}),e.jsxs("form",{onSubmit:I,children:[e.jsxs("div",{style:{marginBottom:"1.5rem"},children:[e.jsx("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:"600",color:"#374151",marginBottom:"0.5rem",textAlign:n?"right":"left"},children:d("reasonLabel")}),e.jsx("textarea",{value:u,onChange:o=>t(o.target.value),style:{width:"100%",padding:"0.875rem",border:"2px solid #e5e7eb",borderRadius:"8px",fontSize:"1rem",minHeight:"100px",resize:"vertical",direction:n?"rtl":"ltr",textAlign:n?"right":"left",boxSizing:"border-box",outline:"none"},placeholder:d("reasonPlaceholder"),disabled:g,onFocus:o=>o.target.style.borderColor="#dc2626",onBlur:o=>o.target.style.borderColor="#e5e7eb"})]}),e.jsx("div",{style:{background:"#fef2f2",border:"1px solid #fecaca",borderRadius:"8px",padding:"1rem",marginBottom:"2rem"},children:e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem",flexDirection:n?"row-reverse":"row"},children:[e.jsx("input",{type:"checkbox",id:"confirmation",checked:b,onChange:o=>s(o.target.checked),style:{width:"1.25rem",height:"1.25rem",accentColor:"#dc2626",marginTop:"0.125rem"},disabled:g}),e.jsxs("div",{style:{flex:1},children:[e.jsx("label",{htmlFor:"confirmation",style:{fontSize:"0.875rem",fontWeight:"600",color:"#dc2626",cursor:g?"not-allowed":"pointer",display:"block",marginBottom:"0.25rem",textAlign:n?"right":"left"},children:d("confirmationLabel")}),e.jsx("p",{style:{fontSize:"0.875rem",color:"#7f1d1d",margin:0,textAlign:n?"right":"left"},children:d("confirmationText")})]})]})}),e.jsxs("div",{style:{display:"flex",gap:"1rem",justifyContent:"flex-end",flexDirection:n?"row-reverse":"row",flexWrap:"wrap"},children:[e.jsx("button",{type:"button",onClick:E,disabled:g,style:{padding:"0.875rem 1.5rem",background:"#f8fafc",color:"#64748b",border:"1px solid #e2e8f0",borderRadius:"8px",fontWeight:"600",cursor:g?"not-allowed":"pointer",minWidth:"120px",opacity:g?.5:1},children:d("cancelButton")}),e.jsxs("button",{type:"submit",disabled:g||!b,style:{padding:"0.875rem 1.5rem",background:g||!b?"#9ca3af":"linear-gradient(135deg, #dc2626 0%, #b91c1c 100%)",color:"white",border:"none",borderRadius:"8px",fontWeight:"600",cursor:g||!b?"not-allowed":"pointer",minWidth:"180px",display:"flex",alignItems:"center",justifyContent:"center",gap:"0.5rem",transition:"all 0.2s ease"},onMouseOver:o=>{!g&&b&&(o.currentTarget.style.transform="translateY(-1px)",o.currentTarget.style.boxShadow="0 6px 20px rgba(220, 38, 38, 0.4)")},onMouseOut:o=>{o.currentTarget.style.transform="translateY(0)",o.currentTarget.style.boxShadow="none"}
75,children:[g&&e.jsx("div",{style:{width:"1rem",height:"1rem",border:"2px solid transparent",borderTop:"2px solid white",borderRadius:"50%",animation:"spin 1s linear infinite"}}),e.jsx("span",{children:"🔒"}),d(g?"closing":"closeButton")]})]})]}),e.jsx("style",{children:`
76            @keyframes spin {
77              0% { transform: rotate(0deg); }
78              100% { transform: rotate(360deg); }
79            }
80          `})]})})},we=({isOpen:c,onClose:A,petitionSlug:p,signatureCount:E,language:x})=>{const[u,t]=l.useState(!1),[g,_]=l.useState(!1),[f,h]=l.useState([]),[b,s]=l.useState(!1),[n,k]=l.useState(null),d=5e3,o={en:{title:"Export Signatures",subtitle:"Download signature list as Excel file",signatureCount:"Total signatures to export:",gdprTitle:"Data Protection Agreement",gdprText:"I understand that this data contains personal information and must be handled according to the Israeli Privacy Protection Law. I confirm that:",gdprPoints:["I will use this data only for the stated purpose of this petition","I will not share this data with third parties","I will securely delete this data when no longer needed"],gdprConsent:"I agree to the terms above",exportButton:"Export Signatures",exportingButton:"Preparing Export...",cancel:"Cancel",immediateTitle:"✅ Export Ready!",immediateText:"Your signature export is ready for download.",downloadButton:"Download Excel File",asyncTitle:"⏳ Export in Progress",asyncText:"Your export is being prepared in the background.",asyncNote:'When it is ready it will appear under "Previous Exports" below — reopen this window in a few minutes to download it.',historyTitle:"Previous Exports",historyEmpty:"No previous exports",statusLabels:{pending:"Pending",processing:"Processing",ready:"Ready",downloaded:"Downloaded",expired:"Expired",failed:"Failed"},expiresIn:"Expires in",expired:"Expired",errorGeneral:"Export failed. Please try again.",errorNoConsent:"נא להסכים לתנאי הגנת המידע",errorNoSignatures:"No signatures to export"},he:{title:"ייצוא חתימות",subtitle:"הורדת רשימת חותמים כקובץ Excel",signatureCount:"סה״כ חתימות לייצוא:",gdprTitle:"הסכם הגנת מידע",gdprText:"אני מבין/ה שמידע זה מכיל נתונים אישיים וחייב להיות מטופל בהתאם לתקנות חוק הגנת הפרטיות. אני מאשר/ת כי:",gdprPoints:["אשתמש במידע זה אך ורק למטרת העצומה המוצהרת","לא אשתף מידע זה עם צדדים שלישיים","אמחק את המידע באופן מאובטח כשלא אצטרך אותו עוד"],gdprConsent:"אני מסכים/ה לתנאים לעיל",exportButton:"ייצא חתימות",exportingButton:"מכין ייצוא...",cancel:"ביטול",immediateTitle:"✅ הייצוא מוכן!",immediateText:"קובץ החתימות מוכן להורדה.",downloadButton:"הורד קובץ Excel",asyncTitle:"⏳ הייצוא בתהליך",asyncText:"הקובץ בהכנה ברקע.",asyncNote:'כשיהיה מוכן הוא יופיע ברשימת "ייצואים קודמים" למטה — פתח את החלון שוב בעוד כמה דקות כדי להוריד.',historyTitle:"ייצואים קודמים",historyEmpty:"אין ייצואים קודמים",statusLabels:{pending:"ממתין",processing:"בעיבוד",ready:"מוכן",downloaded:"הורד",expired:"פג תוקף",failed:"נכשל"},expiresIn:"פג תוקף בעוד",expired:"פג תוקף",errorGeneral:"הייצוא נכשל. אנא נסה שוב.",errorNoConsent:"יש לאשר את תנאי הגנת המידע",errorNoSignatures:"אין חתימות לייצוא"}}[x];l.useEffect(()=>{c&&p&&C()},[c,p]);const C=async()=>{try{const a=localStorage.getItem("auth_token"),y=await fetch(Q(`petitions/${p}/export-history`),{headers:{Authorization:`Bearer ${a}`}});if(y.ok){const w=await y.json();if(w.success){const T=w.exports||[];h(T),T.some(z=>z.can_download&&z.download_token)&&s(!0)}}}catch(a){console.error("Failed to load export history:",a)}},$=async()=>{if(!g){alert(o.errorNoConsent);return}if(E===0){alert(o.errorNoSignatures);return}t(!0),k(null);try{const a=localStorage.getItem("auth_token"),y=await fetch(Q(`petitions/${p}/export-signatures/request`),{method:"POST",headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json"},body:JSON.stringify({gdpr_consent_agreed:!0})}),w=await y.json();if(y.ok&&w.success)k(w),await C(),w.export_type==="immediate"&&setTimeout(()=>{N(w.download_token)},1e3);else throw new Error(w.error||o.errorGeneral)}catch(a){console.error("Export request failed:",a),alert(a.message||o.errorGeneral),k(null)}finally{t(!1)}},N=async a=>{const y=Q(`exports/${a}/download`);try{const w=localStorage.getItem("auth_token"),T=await fetch(y,{headers:w?{Authorization:`Bearer ${w}`}:{}});if(!T.ok){const X=await T.json().catch(()=>({}));alert(X.error||o.errorGeneral);return}const V=(T.headers.get("content-disposition")||"").match(/filename="?([^";]+)"?/),F=V?V[1]:`signatures_${a.slice(0,8)}.xlsx`,J=await T.blob(),U=window.URL.createObjectURL(J),P=document.createElement("a");P.href=U,P.setAttribute("download",F),document.body.appendChild(P),P.click(),P.remove(),window.URL.revokeObjectURL(U)}catch(w){console.error("Download failed:",w),alert(o.errorGeneral)}},q=a=>new Date(a).toLocaleDateString(x==="he"?"he-IL":"en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),O=a=>{const y=new Date,w=new Date(a),T=Math.floor((w.getTime()-y.getTime())/(1e3*60*60));return T<0?o.expired:T<1?"< 1h":T<24?`${T}h`:`${Math.floor(T/24)}d`};return c?e.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999},children:e.jsxs("div",{style:{background:"white",borderRadius:"12px",maxWidth:"600px",width:"90%",maxHeight:"90vh",overflowY:"auto",padding:"2rem",direction:x==="he"?"rtl":"ltr"},children:[e.jsxs("div",{style:{marginBottom:"1.5rem"},children:[e.jsx("h2",{style:{fontSize:"1.75rem",fontWeight:"700",color:"#1f2937",marginBottom:"0.5rem"},children:o.title}),e.jsx("p",{style:{color:"#6b7280",fontSize:"1rem"},children:o.subtitle})]}),n&&e.jsxs("div",{style:{padding:"1.5rem",borderRadius:"8px",marginBottom:"1.5rem",background:n.export_type==="immediate"?"#d1fae5":"#fef3c7",border:`1px solid ${n.export_type==="immediate"?"#10b981":"#f59e0b"}`},children:[e.jsx("h3",{style:{fontSize:"1.25rem",fontWeight:"600",marginBottom:"0.5rem",color:n.export_type==="immediate"?"#065f46":"#92400e"},children:n.export_type==="immediate"?o.immediateTitle:o.asyncTitle}),e.jsx("p",{style:{color:n.export_type==="immediate"?"#065f46":"#92400e",marginBottom:"0.5rem"},children:n.export_type==="immediate"?o.immediateText:o.asyncText}),n.export_type==="immediate"&&n.download_token&&e.jsx("button",{onClick:()=>N(n.download_token),style:{background:"#10b981",color:"white",padding:"0.75rem 1.5rem",borderRadius:"6px",border:"none",fontWeight:"600",cursor:"pointer",marginTop:"1rem"},children:o.downloadButton}),n.export_type==="async"&&e.jsx("p",{style:{fontSize:"0.875rem",fontStyle:"italic",marginTop:"0.5rem",color:"#92400e"},children:o.asyncNote})]}),!n&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{background:"#f3f4f6",padding:"1rem",borderRadius:"8px",marginBottom:"1.5rem"},children:[e.jsx("p",{style:{color:"#6b7280",marginBottom:"0.25rem"},children:o.signatureCount}),e.jsx("p",{style:{fontSize:"2rem",fontWeight:"700",color:"#10b981"},children:te(E)}),E>d&&e.jsxs("p",{style:{fontSize:"0.875rem",color:"#f59e0b",marginTop:"0.5rem"},children:["⚠️ ",x==="en"?'Large export is processed in the background and appears under "Previous Exports" below':'ייצוא גדול יעובד ברקע ויופיע ברשימת "ייצואים קודמים" למטה']})]}),e.jsxs("div",{style:{border:"1px solid #e5e7eb",borderRadius:"8px",padding:"1.5rem",marginBottom:"1.5rem"},children:[e.jsxs("h3",{style:{fontSize:"1.125rem",fontWeight:"600",marginBottom:"1rem",color:"#1f2937"},children:["🔒 ",o.gdprTitle]}),e.jsx("p",{style:{fontSize:"0.875rem",color:"#4b5563",marginBottom:"1rem"},children:o.gdprText}),e.jsx("ul",{style:{listStyle:"none",padding:0,marginBottom:"1rem"},children:o.gdprPoints.map((a,y)=>e.jsxs("li",{style:{display:"flex",alignItems:"flex-start",marginBottom:"0.5rem",fontSize:"0.875rem",color:"#4b5563"},children:[e.jsx("span",{style:{marginRight:"0.5rem",marginLeft:"0.5rem"},children:"✓"}),a]},y))}),e.jsxs("label",{style:{display:"flex",alignItems:"center",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:g,onChange:a=>_(a.target.checked),style:{marginRight:x==="en"?"0.5rem":0,marginLeft:x==="he"?"0.5rem":0,width:"18px",height:"18px",cursor:"pointer"}}),e.jsx("span",{style:{fontWeight:"600",color:g?"#10b981":"#6b7280"}
80,children:o.gdprConsent})]})]})]}),f.length>0&&e.jsxs("div",{style:{marginBottom:"1.5rem"},children:[e.jsxs("button",{onClick:()=>s(!b),style:{background:"transparent",border:"none",color:"#3b82f6",cursor:"pointer",fontSize:"0.875rem",fontWeight:"500",display:"flex",alignItems:"center",marginBottom:"1rem"},children:[e.jsx("span",{style:{marginRight:"0.25rem"},children:b?"▼":"▶"}),o.historyTitle," (",f.length,")"]}),b&&e.jsx("div",{style:{border:"1px solid #e5e7eb",borderRadius:"8px",overflow:"hidden"},children:f.map((a,y)=>e.jsxs("div",{style:{padding:"0.75rem 1rem",borderBottom:y<f.length-1?"1px solid #e5e7eb":"none",display:"flex",justifyContent:"space-between",alignItems:"center",background:y%2===0?"#f9fafb":"white"},children:[e.jsxs("div",{children:[e.jsx("p",{style:{fontSize:"0.875rem",color:"#4b5563"},children:q(a.requested_at)}),e.jsxs("p",{style:{fontSize:"0.75rem",color:"#9ca3af"},children:[te(a.signature_count)," signatures • ",o.statusLabels[a.status]]})]}),e.jsxs("div",{children:[a.can_download&&a.download_token&&e.jsx("button",{onClick:()=>N(a.download_token),style:{background:"#3b82f6",color:"white",padding:"0.25rem 0.75rem",borderRadius:"4px",border:"none",fontSize:"0.75rem",cursor:"pointer"},children:o.downloadButton}),a.expires_at&&a.status==="ready"&&e.jsxs("p",{style:{fontSize:"0.75rem",color:"#f59e0b",marginTop:"0.25rem"},children:[o.expiresIn,": ",O(a.expires_at)]})]})]},a.export_id))})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"1rem"},children:[e.jsx("button",{onClick:A,style:{padding:"0.75rem 1.5rem",background:"#e5e7eb",color:"#374151",border:"none",borderRadius:"6px",fontWeight:"600",cursor:"pointer"},children:n?x==="en"?"Close":"סגור":o.cancel}),!n&&e.jsx("button",{onClick:$,disabled:u||!g,style:{padding:"0.75rem 1.5rem",background:u||!g?"#9ca3af":"#10b981",color:"white",border:"none",borderRadius:"6px",fontWeight:"600",cursor:u||!g?"not-allowed":"pointer"},children:u?o.exportingButton:o.exportButton})]})]})}):null},Re=({language:c="en",onNavigate:A})=>{const{slug:p}=ge(),E=ue(),[x]=he(),u=x.get("admin")==="true",[t,g]=l.useState(null),[_,f]=l.useState("overview"),[h,b]=l.useState(!0),{showError:s,showSuccess:n,showWarning:k}=pe(),[d,I]=l.useState(!1),[o,C]=l.useState(!1),[$,N]=l.useState(!1),[q,O]=l.useState(!1),[a,y]=l.useState(null),[w,T]=l.useState(!1),[z,V]=l.useState(!1);l.useEffect(()=>{t?.ads_disabled!==void 0&&T(t.ads_disabled)},[t?.ads_disabled]);const F=async()=>{if(t){V(!0);try{const r=localStorage.getItem("auth_token"),m=await L.post(`/api/v1/petitions/${t.petition_id}/toggle-ads`,{},{headers:{Authorization:`Bearer ${r}`}});m.data?.success&&(T(m.data.ads_disabled),n(m.data.ads_disabled?"פרסומות בוטלו בעצומה זו":"פרסומות הופעלו בעצומה זו"))}catch{s("פעולה נכשלה, נסה שוב")}finally{V(!1)}}},J=async()=>{if(!t)return;const r=t.current_signatures_count??0,j=t.is_approved===1?r>0:r>10;if(window.confirm(`Delete petition #${t.petition_id}?
81"${t.title}"
82
83The petition will be permanently removed from the site (archived to deleted_petitions).`)&&!(j&&window.prompt(`⚠️ This petition has ${r} signatures (and possibly payments).
84Signatures and payment records will be KEPT in the database, but the petition will be removed from the site.
85
86Type DELETE to confirm:`)!=="DELETE"))try{const S=localStorage.getItem("auth_token");await L.delete(`/api/v1/admin/petitions/${t.petition_id}/hard-delete`,{headers:{Authorization:`Bearer ${S}`}}),window.location.href="/admin/petition-approvals"}catch{s("Delete failed")}},[U,P]=l.useState(!1),[X,H]=l.useState(""),oe=async(r,m,j)=>{for(let D=0;D<100;D++){await new Promise(B=>setTimeout(B,3e3));try{const B=await fetch(`/api/v1/petitions/${r}/export-history`,{headers:{Authorization:`Bearer ${j}`}});if(!B.ok)continue;const K=((await B.json()).exports||[]).find(me=>me.export_id===m);if(K?.download_token)return K.download_token;if(K?.status==="failed")throw new Error("export failed");H(`הקובץ בהכנה (${Math.round((D+1)*3e3/1e3)} שנ׳)…`)}catch(B){if(B?.message==="export failed")throw B}}return null},re=async()=>
86{if(!t||!p)return;const r=t.current_signatures_count??0;if(window.confirm(`ייצוא ${r.toLocaleString("he-IL")} חתימות כולל כתובות מייל.
87
88הקובץ מכיל מידע אישי — לשימוש פנימי בלבד, לא להעברה לצד שלישי.
89
90להמשיך?`)){P(!0);try{const m=localStorage.getItem("auth_token"),{data:j}=await L.post(`/api/v1/petitions/${p}/export-signatures/request`,{gdpr_consent_agreed:!0,include_emails:1},{headers:{Authorization:`Bearer ${m}`}});let S=j.download_token??null;if(j.export_type!=="immediate"&&(H("הקובץ בהכנה — ההורדה תתחיל אוטומטית כשיהיה מוכן…"),S=await oe(p,j.export_id,m),!S)){k('הקובץ עדיין בהכנה. פתח "ייצוא חתימות" → "ייצואים קודמים" בעוד כמה דקות כדי להוריד אותו.');return}if(!S)throw new Error("no download token");H("מוריד…");const R=await fetch(`/api/v1/exports/${S}/download`,{headers:{Authorization:`Bearer ${m}`}});if(!R.ok)throw{response:{status:R.status,data:await R.json().catch(()=>({}))}};const D=await R.blob(),B=window.URL.createObjectURL(D),M=document.createElement("a");M.href=B,M.setAttribute("download",`signatures_${p}_with_emails.xlsx`),document.body.appendChild(M),M.click(),M.remove(),window.URL.revokeObjectURL(B)}catch(m){s(m?.response?.status===403?"גישה מוגבלת — אדמין בלבד":m?.response?.data?.error||"הייצוא נכשל")}finally{P(!1),H("")}}},v=c==="he",W=r=>{A?A(r):E(r)},Z={en:{title:"Manage Petition",backToDashboard:"Back to Dashboard",overview:"Overview",edit:"Edit Content",updates:"Updates",victory:"Declare Victory",close:"Close Petition",overviewTitle:"Petition Management",currentStatus:"Current Status",totalSignatures:"Total Signatures",totalViews:"Total Views",createdOn:"Created On",publishedOn:"Published On",lastUpdate:"Last Update",quickActions:"Quick Actions",viewPublicly:"View Publicly",editContent:"Edit Content",manageUpdates:"Manage Updates",exportSignatures:"Export Signatures",declareVictory:"Declare Victory",closePetition:"Close Petition","status.draft":"Draft","status.active":"Active","status.victory":"Victory","status.closed":"Closed",victoryAvailable:"Available for active petitions",victoryUnavailable:"Only available for active petitions",closeAvailable:"Available for all petition statuses",editAvailable:"Edit petition content and settings",updatesAvailable:"Manage updates and communicate with supporters",signatures:"חתימות",views:"views",progress:"Progress",goal:"Goal",loading:"Loading petition...",unauthorized:"You are not authorized to manage this petition",petitionNotFound:"Petition not found",loadError:"Error loading petition details",adminWarning:"Admin Mode Active",adminWarningDesc:"You are editing another user's petition. All changes will be logged.",editingPetitionOf:"Editing petition of",allChangesLogged:"All changes are logged and monitored",adminModeActive:"Administrator Mode",returnToAdminDashboard:"Return to Admin Dashboard"},he:{title:"ניהול עצומה",backToDashboard:"חזרה לדשבורד",overview:"סקירה",edit:"עריכת תוכן",updates:"עדכונים",victory:"הכרזת הצלחה",close:"סגירת עצומה",overviewTitle:"ניהול עצומה",currentStatus:"סטטוס נוכחי",totalSignatures:"סך החתימות",totalViews:"סך הצפיות",createdOn:"נוצרה ב",publishedOn:"פורסמה ב",lastUpdate:"עדכון אחרון",quickActions:"פעולות מהירות",viewPublicly:"צפה בעצומה",editContent:"ערוך תוכן",manageUpdates:"נהל עדכונים",exportSignatures:"ייצוא חתימות",declareVictory:"הכרז על הצלחה",closePetition:"סגור עצומה","status.draft":"טיוטה","status.active":"פעילה","status.victory":"ניצחון","status.closed":"סגורה",victoryAvailable:"זמין לעצומות פעילות",victoryUnavailable:"זמין רק לעצומות פעילות",closeAvailable:"זמין לכל סטטוסי העצומה",editAvailable:"ערוך תוכן והגדרות העצומה",updatesAvailable:"נהל עדכונים ותקשר עם התומכים",signatures:"חתימות",views:"צפיות",progress:"התקדמות",goal:"יעד",loading:"טוען עצומה...",unauthorized:"אין לך הרשאה לנהל עצומה זו",petitionNotFound:"עצומה לא נמצאה",loadError:"שגיאה בטעינת פרטי העצומה",adminWarning:"מצב אדמין פעיל",adminWarningDesc:"אתה עורך עצומה של משתמש אחר. כל השינויים יתועדו.",editingPetitionOf:"עורך עצומה של",allChangesLogged:"כל השינויים מתועדים ומנוטרים",adminModeActive:"מצב מנהל מערכת",returnToAdminDashboard:"חזרה לדשבורד אדמין"}},i=r=>Z[c==="he"?"he":"en"]?.[r]||Z.en?.[r]||r;l.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]),l.useEffect(()=>{p&&Y()}
90,[p]),l.useEffect(()=>{u&&p&&ie()},[u,p]);const ie=async()=>{if(!(!u||!p))try{const r=localStorage.getItem("auth_token"),m=await L.get(`/api/v1/admin/petitions/${p}/can-edit`,{headers:{Authorization:`Bearer ${r}`}});m.data.success&&y(m.data.data)}catch(r){console.error("Error checking admin permissions:",r)}},ne=async r=>{try{const m=localStorage.getItem("auth_token");await L.post("/api/v1/admin/petition-edits",{petition_id:r.petition_id,original_creator_id:r.creator_user_id,field_changed:"admin_access",old_value:null,new_value:"Admin accessed petition management",action_type:"field_edit",admin_notes:"Admin opened petition management interface"},{headers:{Authorization:`Bearer ${m}`}})}catch(m){console.error("Error logging admin access:",m)}},Y=async()=>{try{const r=localStorage.getItem("auth_token"),m=JSON.parse(localStorage.getItem("user_data")||"{}");if(!r){s(i("unauthorized")),window.scrollTo({top:0,behavior:"smooth"}),b(!1);return}console.log("📡 Loading petition for management:",p,{isAdminMode:u});const j=await L.get(`/api/v1/petitions/${p}`,{headers:{Authorization:`Bearer ${r}`}});console.log("📥 Petition data response:",j.data);let S=null;if(j.data.petition&&j.data.petition.petition_id?S=j.data.petition:j.data.petition_id?S=j.data:j.data.data&&j.data.data.petition_id&&(S=j.data.data),S){const R=S.creator_user_id===m.id,D=m.role==="admin";if(console.log("🔐 Permission check:",{isAdminMode:u,isCreator:R,isUserAdmin:D,petitionCreatorId:S.creator_user_id,currentUserId:m.id,userRole:m.role}),R||D)g(S),D&&!R&&u&&(console.log("📝 Logging admin access to petition"),await ne(S));else{s(i("unauthorized")),window.scrollTo({top:0,behavior:"smooth"}),b(!1);return}}else s(i("petitionNotFound")),window.scrollTo({top:0,behavior:"smooth"})}catch(r){console.error("💥 Error loading petition:",r),r.response?.status===404?s(i("petitionNotFound")):r.response?.status===403?s(i("unauthorized")):s(i("loadError")),window.scrollTo({top:0,behavior:"smooth"})}finally{b(!1)}},G=r=>{switch(r){case"active":return{bg:"#ecfdf5",text:"#065f46",border:"#10b981"};case"victory":return{bg:"#fef3c7",text:"#92400e",border:"#f59e0b"};case"draft":return{bg:"#f3f4f6",text:"#374151",border:"#6b7280"};case"closed":return{bg:"#fef2f2",text:"#dc2626",border:"#ef4444"};default:return{bg:"#f3f4f6",text:"#374151",border:"#6b7280"}}},se=()=>t?Math.min(t.current_signatures_count/t.target_signatures*100,100):0,ae=r=>{f(r),window.scrollTo({top:0,behavior:"smooth"})},le=()=>{W(`/sign/${p}`)},de=()=>{I(!1),n("ניצחון הוכרז בהצלחה!"),Y()},ce=()=>{C(!1),n("עצומה נסגרה בהצלחה!"),Y()},ee=async()=>{if(!(!t||q)&&window.confirm("לפתוח מחדש את העצומה? היא תחזור לקבל חתימות.")){O(!0);try{const r=localStorage.getItem("auth_token");await L.post(`/api/v1/petitions/${t.petition_id}/reopen`,{},{headers:{Authorization:`Bearer ${r}`,Accept:"application/json"}}),n("העצומה נפתחה מחדש"),Y()}catch(r){s(r.response?.data?.message||"פתיחה מחדש נכשלה")}finally{O(!1)}}};return h?e.jsxs("div",{style:{minHeight:"100vh",background:"#f9fafb",display:"flex",alignItems:"center",justifyContent:"center",direction:v?"rtl":"ltr"},children:[e.jsxs("div",{style:{textAlign:"center"},children:[e.jsx("div",{style:{width:"3rem",height:"3rem",border:"4px solid #e5e7eb",borderTop:"4px solid #059669",borderRadius:"50%",margin:"0 auto 1rem auto",animation:"spin 1s linear infinite"}}),e.jsx("p",{style:{color:"#6b7280",fontSize:"1.125rem"},children:i("loading")})]}),e.jsx("style",{children:`
91            @keyframes spin {
92              0% { transform: rotate(0deg); }
93              100% { transform: rotate(360deg); }
94            }
95          `})]}):h===!1&&!t?e.jsx("div",{style:{minHeight:"100vh",background:"#f9fafb",display:"flex",alignItems:"center",justifyContent:"center",direction:v?"rtl":"ltr"},children:e.jsxs("div",{style:{textAlign:"center",maxWidth:"28rem",margin:"0 auto",background:"white",padding:"2rem",borderRadius:"0.5rem",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"},children:[e.jsx("h2",{style:{fontSize:"1.5rem",fontWeight:"bold",color:"#111827",marginBottom:"1rem"},children:"showError()"}),e.jsx("button",{onClick:()=>{W(u?"/admin/petitions":"/dashboard")},style:{color:"#059669",fontWeight:"500",background:"none",border:"none",cursor:"pointer",fontSize:"1rem",padding:"0.5rem 1rem",borderRadius:"0.375rem"},children:i(u?"returnToAdminDashboard":"backToDashboard")})]})}):e.jsxs("div",{style:{minHeight:"100vh",background:"#f9fafb",direction:v?"rtl":"ltr"},children:[e.jsx("style",{children:`
96          @keyframes spin {
97            0% { transform: rotate(0deg); }
98            100% { transform: rotate(360deg); }
99          }
100          .tab-button {
101            padding: 0.75rem 1.5rem;
102            border: none;
103            background: transparent;
104            cursor: pointer;
105            font-weight: 500;
106            border-radius: 0.5rem;
107            transition: all 0.2s ease;
108          }
109          .tab-button.active {
110            background: #059669;
111            color: white;
112          }
113          .tab-button:not(.active) {
114            color: #6b7280;
115          }
116          .tab-button:not(.active):hover {
117            background: #f3f4f6;
118            color: #374151;
119          }
120          .action-button {
121            padding: 0.75rem 1.5rem;
122            border: 2px solid #059669;
123            background: transparent;
124            color: #059669;
125            border-radius: 0.5rem;
126            cursor: pointer;
127            font-weight: 600;
128            transition: all 0.2s ease;
129            display: flex;
130            align-items: center;
131            gap: 0.5rem;
132            justify-content: center;
133          }
134          .action-button:hover {
135            background: #059669;
136            color: white;
137            transform: translateY(-1px);
138            box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
139          }
140          .action-button:disabled {
141            opacity: 0.5;
142            cursor: not-allowed;
143            transform: none !important;
144            box-shadow: none !important;
145          }
146          .action-button.danger {
147            border-color: #dc2626;
148            color: #dc2626;
149          }
150          .action-button.danger:hover {
151            background: #dc2626;
152            color: white;
153          }
154          .action-button.secondary {
155            border-color: #6b7280;
156            color: #6b7280;
157          }
158          .action-button.secondary:hover {
159            background: #6b7280;
160            color: white;
161          }
162        `}),t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{background:"white",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",borderBottom:"1px solid #e5e7eb",padding:"1.5rem 0"},children:e.jsxs("div",{style:{maxWidth:"1280px",margin:"0 auto",padding:"0 1rem",display:"flex",justifyContent:"space-between",alignItems:"flex-start",flexWrap:"wrap",gap:"1rem"},children:[e.jsxs("div",{style:{flex:1,minWidth:"300px"},children:[e.jsx("h1",{style:{fontSize:"1.875rem",fontWeight:"bold",color:"#111827",marginBottom:"0.5rem",textAlign:v?"right":"left"},children:i("title")}),e.jsx("p",{style:{color:"#6b7280",marginBottom:"0.5rem",fontSize:"1.125rem",textAlign:v?"right":"left"},children:t.title}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1rem",fontSize:"0.875rem",color:"#6b7280",flexWrap:"wrap",flexDirection:v?"row-reverse":"row"},children:[e.jsxs("span",{children:["#",t.petition_id]}),e.jsx("div",{style:{padding:"0.25rem 0.75rem",borderRadius:"9999px",fontSize:"0.75rem",fontWeight:"500",backgroundColor:G(t.status).bg,color:G(t.status).text,border:`1px solid ${G(t.status).border}`},children:i(`status.${t.status}`)}),e.jsxs("span",{children:[t.current_signatures_count," ",i("signatures")]})]})]}),e.jsx("button",{onClick:()=>{W(u?"/admin/petitions":"/dashboard")},style:{color:"#6b7280",background:"none",border:"none",cursor:"pointer",fontSize:"1rem",padding:"0.5rem 1rem",borderRadius:"0.375rem"},children:i(u?"returnToAdminDashboard":"backToDashboard")})]})}),u&&e.jsxs("div",{style:{background:"linear-gradient(90deg, #f59e0b 0%, #d97706 100%)",color:"white",padding:"1rem 0",borderBottom:"1px solid #92400e"},children:[e.jsxs("div",{style:{maxWidth:"1280px",margin:"0 auto",padding:"0 1rem",display:"flex",alignItems:"center",gap:"1rem",flexDirection:v?"row-reverse":"row"},children:[e.jsx("div",{style:{fontSize:"1.5rem"},children:"⚠️"}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontSize:"1.125rem",fontWeight:"bold",marginBottom:"0.25rem",textAlign:v?"right":"left"},children:i("adminWarning")}),e.jsxs("div",{style:{fontSize:"0.875rem",opacity:.9,textAlign:v?"right":"left"},children:[i("adminWarningDesc"),a?.petitionInfo?.creator_name&&` - ${i("editingPetitionOf")} ${a.petitionInfo.creator_name}`]})]}),e.jsx("button",{onClick:()=>W("/admin/petitions"),style:{padding:"0.5rem 1rem",background:"rgba(255, 255, 255, 0.2)",border:"1px solid rgba(255, 255, 255, 0.3)",borderRadius:"0.375rem",color:"white",fontSize:"0.875rem",fontWeight:"600",cursor:"pointer",transition:"all 0.2s ease"},onMouseEnter:r=>{r.currentTarget.style.background="rgba(255, 255, 255, 0.3)"},onMouseLeave:r=>{r.currentTarget.style.background="rgba(255, 255, 255, 0.2)"},children:i("returnToAdminDashboard")})]}),e.jsx("div",{style:{maxWidth:"1280px",margin:"0.75rem auto 0",padding:"0 1rem",textAlign:v?"right":"left"},children:w?e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"0.75rem",flexWrap:"wrap",flexDirection:v?"row-reverse":"row"},children:[e.jsx("span",{style:{fontSize:"0.85rem",color:"#fff"},children:"✓ פרסומות מבוטלות בעצומה זו"}),e.jsx("button",{onClick:F,disabled:z,style:{background:"rgba(255,255,255,0.2)",color:"#fff",border:"1px solid rgba(255,255,255,0.4)",borderRadius:"6px",padding:"4px 12px",cursor:z?"default":"pointer",fontSize:"0.8rem",fontWeight:500,opacity:z?.6:1},children:z?"...":"הפעל פרסומות מחדש"})]}):e.jsx("button",{onClick:F,disabled:z,style:{background:"#fff",color:"#e53e3e",border:"1px solid #e53e3e",borderRadius:"6px",padding:"6px 16px",cursor:z?"default":"pointer",fontSize:"0.875rem",fontWeight:500,opacity:z?.6:1},children:z?"...":"🚫 בטל פרסומות בעצומה זו"})}),JSON.parse(localStorage.getItem("user_data")||"{}").role==="admin"&&e.jsx("div",{style:{maxWidth:"1280px",margin:"0.75rem auto 0",padding:"0 1rem",textAlign:v?"right":"left"},children:e.jsx("button",{onClick:J,style:{background:"#dc2626",color:"#fff",border:"1px solid #b91c1c",borderRadius:"6px",padding:"6px 16px",cursor:"pointer",fontSize:"0.875rem",fontWeight:600},children:"🗑️ Delete petition"})})]}),e.jsx("div",{style:{background:"white",borderBottom:"1px solid #e5e7eb"},children:e.jsx("div",{style:{maxWidth:"1280px",margin:"0 auto",padding:"0 1rem"},children:e.jsx("div",{style:{display:"flex",gap:"0.5rem",overflowX:"auto",flexDirection:v?"row-reverse":"row"},children:[{id:"overview",label:i("overview"),icon:"📊"},{id:"edit",label:i("edit"),icon:"✏️"},{id:"updates",label:i("updates"),icon:"📝"},{id:"victory",label:i("victory"),icon:"🏆"},{id:"close",label:i("close"),icon:"🔒"}].map(r=>e.jsxs("button",{className:`tab-button ${_===r.id?"active":""}`,onClick:()=>ae(r.id),children:[e.jsx("span",{style:{marginRight:v?"0":"0.5rem",marginLeft:v?"0.5rem":"0"},children:r.icon}),r.label]},r.id))})})}),e.jsxs("div",{style:{maxWidth:"1280px",margin:"0 auto",padding:"2rem 1rem"},children:[_==="overview"&&e.jsxs("div",{children:[e.jsx("h2",{style:{fontSize:"1.5rem",fontWeight:"bold",color:"#111827",marginBottom:"2rem",textAlign:v?"right":"left"},children:i("overviewTitle")}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:"1.5rem",marginBottom:"2rem"},children:[e.jsxs("div",{style:{background:"white",padding:"1.5rem",borderRadius:"0.75rem",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:"2.5rem",fontWeight:"bold",color:"#059669",marginBottom:"0.5rem"}
162,children:t.current_signatures_count.toLocaleString()}),e.jsx("div",{style:{color:"#6b7280",fontSize:"0.875rem"},children:i("totalSignatures")}),e.jsx("div",{style:{marginTop:"1rem",height:"8px",background:"#e5e7eb",borderRadius:"4px",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",background:"linear-gradient(90deg, #10b981 0%, #059669 100%)",width:`${se()}%`,transition:"width 0.3s ease"}})}),e.jsxs("div",{style:{fontSize:"0.75rem",color:"#9ca3af",marginTop:"0.5rem"},children:[i("goal"),": ",t.target_signatures.toLocaleString()]})]}),e.jsxs("div",{style:{background:"white",padding:"1.5rem",borderRadius:"0.75rem",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:"2.5rem",fontWeight:"bold",color:"#3b82f6",marginBottom:"0.5rem"},children:t.views_count.toLocaleString()}),e.jsx("div",{style:{color:"#6b7280",fontSize:"0.875rem"},children:i("totalViews")})]}),e.jsxs("div",{style:{background:"white",padding:"1.5rem",borderRadius:"0.75rem",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:"1.25rem",fontWeight:"bold",marginBottom:"0.5rem",color:G(t.status).text},children:i(`status.${t.status}`)}),e.jsx("div",{style:{color:"#6b7280",fontSize:"0.875rem"},children:i("currentStatus")})]})]}),e.jsxs("div",{style:{background:"white",padding:"2rem",borderRadius:"0.75rem",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)"},children:[e.jsx("h3",{style:{fontSize:"1.25rem",fontWeight:"bold",color:"#111827",marginBottom:"1.5rem",textAlign:v?"right":"left"},children:i("quickActions")}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"1rem"},children:[e.jsxs("button",{className:"action-button",onClick:le,children:[e.jsx("span",{children:"👁️"}),i("viewPublicly")]}),e.jsxs("button",{className:"action-button",onClick:()=>f("edit"),children:[e.jsx("span",{children:"✏️"}),i("editContent")]}),e.jsxs("button",{className:"action-button",onClick:()=>f("updates"),children:[e.jsx("span",{children:"📝"}),i("manageUpdates")]}),e.jsxs("button",{className:"action-button",onClick:()=>N(!0),children:[e.jsx("span",{children:"📊"}),i("exportSignatures")]}),JSON.parse(localStorage.getItem("user_data")||"{}").role==="admin"&&e.jsxs("button",{className:"action-button",onClick:re,disabled:U,title:"ייצוא הכולל כתובות מייל — אדמין בלבד",children:[e.jsx("span",{children:"📧"}),U?X||"מכין ייצוא...":"ייצוא חתימות + מיילים"]}),e.jsxs("button",{className:"action-button",onClick:()=>f("victory"),disabled:t.status!=="active",children:[e.jsx("span",{children:"🏆"}),i("declareVictory")]}),t.status==="closed"?e.jsxs("button",{className:"action-button",onClick:ee,disabled:q,children:[e.jsx("span",{children:"🔓"}),"פתח עצומה מחדש"]}):e.jsxs("button",{className:"action-button danger",onClick:()=>f("close"),children:[e.jsx("span",{children:"🔒"}),i("closePetition")]})]})]})]}),_==="edit"&&e.jsx(fe,{isAdminMode:u,petitionSlug:p,language:c}),_==="updates"&&e.jsx(xe,{language:c,onNavigate:W}),_==="victory"&&e.jsxs("div",{style:{background:"white",padding:"2rem",borderRadius:"0.75rem",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:"4rem",marginBottom:"1.5rem"},children:"🏆"}),e.jsx("h3",{style:{fontSize:"1.5rem",fontWeight:"bold",color:"#111827",marginBottom:"1rem"},children:i("declareVictory")}),t.status==="active"?e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{color:"#6b7280",marginBottom:"2rem",fontSize:"1.125rem"},children:"האם העצומה שלך הגיעה למטרתה? הכרז על הצלחה וחגוג עם התומכים שלך!"}),e.jsxs("button",{className:"action-button",onClick:()=>I(!0),style:{margin:"0 auto"},children:[e.jsx("span",{children:"🏆"}),i("declareVictory")]})]}):e.jsx("p",{style:{color:"#9ca3af",fontSize:"1.125rem"},children:i("victoryUnavailable")})]}),_==="close"&&e.jsxs("div",{style:{background:"white",padding:"2rem",borderRadius:"0.75rem",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",textAlign:"center"},children:[e.jsx("div",{style:{fontSize:"4rem",marginBottom:"1.5rem"},children:"🔒"}),e.jsx("h3",{style:{fontSize:"1.5rem",fontWeight:"bold",color:"#111827",marginBottom:"1rem"},children:i("closePetition")}),t.status!=="closed"?e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{color:"#6b7280",marginBottom:"2rem",fontSize:"1.125rem"},children:"האם אתה בטוח שברצונך לסגור את העצומה הזו? הסגירה תעצור את קבלת החתימות. ניתן לפתוח אותה מחדש בכל עת."}),e.jsxs("button",{className:"action-button danger",onClick:()=>C(!0),style:{margin:"0 auto"},children:[e.jsx("span",{children:"🔒"}),i("closePetition")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{style:{color:"#9ca3af",fontSize:"1.125rem",marginBottom:"1.5rem"},children:["עצומה זו סגורה כבר.",t.closed_at&&` (נסגרה ב־${new Date(t.closed_at).toLocaleDateString("he-IL")})`]}),e.jsxs("button",{className:"action-button",onClick:ee,disabled:q,style:{margin:"0 auto"},children:[e.jsx("span",{children:"🔓"}),"פתח עצומה מחדש"]})]})]})]}),d&&e.jsx(be,{petitionId:t.petition_id,language:c,onClose:()=>I(!1),onSuccess:de}),o&&e.jsx(ye,{petitionId:t.petition_id,petitionTitle:t.title,language:c,onClose:()=>C(!1),onSuccess:ce}),$&&t&&e.jsx(we,{isOpen:$,onClose:()=>N(!1),petitionSlug:t.slug||p||"",signatureCount:t.current_signatures_count||0,language:c})]})]})};export{Re as default};
163//# sourceMappingURL=PetitionManagePage-CZWXWVdj.js.map

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.