@reqdesk/widget 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export * from './index-2oPxlN4_.cjs';
@@ -0,0 +1 @@
1
+ export * from './index-B8fhsCuv.js';
@@ -0,0 +1,117 @@
1
+ var ReqdeskWidget=(function(e,t){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let n=``,r=``;function i(e,t){r=e.replace(/\/$/,``),n=t}let a=t.ofetch.create({timeout:15e3,retry:2,retryStatusCodes:[408,429,500,502,503,504],async onRequest({options:e}){e.baseURL=`${r}/api/v1`;let t=new Headers(e.headers);t.set(`X-API-Key`,n),e.headers=t},onResponseError({response:e}){let t=e._data;throw{code:t?.responseCode??`HTTP_${e.status}`,message:t?.responseMessage??e.statusText}}});function o(){return crypto.randomUUID()}async function s(e,t){let n=await a(`/projects/${e}/tickets`,{method:`POST`,body:{title:t.title,description:t.description,priority:t.priority,categoryId:t.categoryId,email:t.email},headers:{"Idempotency-Key":o()}});return{id:n.data.id,ticketNumber:n.data.attributes.ticketNumber,trackingToken:n.meta?.trackingToken,status:n.data.attributes.status}}async function c(e){let t=await a(`/tickets/track?token=${encodeURIComponent(e)}`),n=t.included??[];return{id:t.data.id,ticketNumber:t.data.attributes.ticketNumber,title:t.data.attributes.title,status:t.data.attributes.status,priority:t.data.attributes.priority,createdAt:t.data.attributes.createdAt,replies:n.filter(e=>e.type===`public-reply`).map(e=>({id:e.id,body:e.attributes.body,authorName:e.attributes.authorName,isStaff:e.attributes.isStaff,createdAt:e.attributes.createdAt}))}}async function l(e,t){await a(`/tickets/track/reply`,{method:`POST`,body:{trackingToken:e,body:t}})}let u={"widget.title":`Support`,"widget.newTicket":`New Ticket`,"widget.trackTicket":`Track Ticket`,"form.title":`Title`,"form.titlePlaceholder":`Brief summary of your issue`,"form.description":`Description`,"form.descriptionPlaceholder":`Describe your issue in detail...`,"form.email":`Email`,"form.emailPlaceholder":`your@email.com`,"form.priority":`Priority`,"form.priorityLow":`Low`,"form.priorityMedium":`Medium`,"form.priorityHigh":`High`,"form.priorityUrgent":`Urgent`,"form.category":`Category`,"form.categoryNone":`Select a category`,"form.submit":`Submit Ticket`,"form.submitting":`Submitting...`,"form.cancel":`Cancel`,"form.attachment":`Attach files`,"success.title":`Ticket Submitted!`,"success.ticketNumber":`Ticket #`,"success.trackingToken":`Your tracking token:`,"success.trackingHint":`Save this token to track your ticket status.`,"success.copyToken":`Copy Token`,"success.copied":`Copied!`,"success.close":`Close`,"success.trackNow":`Track Ticket`,"tracker.title":`Track Your Ticket`,"tracker.tokenPlaceholder":`Enter your tracking token (trk_...)`,"tracker.submit":`Track`,"tracker.tracking":`Tracking...`,"tracker.status":`Status`,"tracker.priority":`Priority`,"tracker.created":`Created`,"tracker.replies":`Replies`,"tracker.noReplies":`No replies yet.`,"tracker.replyPlaceholder":`Write a reply...`,"tracker.sendReply":`Send Reply`,"tracker.sending":`Sending...`,"tracker.back":`Back`,"tracker.staff":`Staff`,"error.generic":`Something went wrong. Please try again.`,"error.network":`Network error. Check your connection.`,"error.tokenInvalid":`Invalid or expired tracking token.`,"error.required":`This field is required.`,"error.emailInvalid":`Please enter a valid email address.`,"error.titleMin":`Title must be at least 5 characters.`,"portal.title":`Support Portal`,"portal.myTickets":`My Tickets`,"portal.noTickets":`No tickets yet.`,"portal.newTicket":`New Ticket`,"widget.close":`Close`,"menu.newTicket":`Submit a Ticket`,"menu.newTicketDesc":`Create a new support request`,"menu.myTickets":`My Tickets`,"menu.myTicketsDesc":`View and manage your tickets`,"menu.trackTicket":`Track a Ticket`,"menu.trackTicketDesc":`Check status with your tracking token`,"menu.knowledgeBase":`Knowledge Base`,"menu.knowledgeBaseDesc":`Browse help articles and guides`,"menu.myTicketsPlaceholder":`Sign in to view your tickets.`,"menu.trackPlaceholder":`Ticket tracking is coming soon.`,"menu.kbPlaceholder":`Knowledge base is coming soon.`,"menu.preferences":`Preferences`,"menu.preferencesDesc":`Language and appearance settings`,"prefs.title":`Preferences`,"prefs.language":`Language`,"prefs.theme":`Theme`,"prefs.light":`Light`,"prefs.dark":`Dark`,"prefs.auto":`System`,"branding.poweredBy":`Powered by`,"attach.dropzone":`Drop files here or click to browse`,"attach.dropzoneActive":`Drop files here`,"attach.maxFiles":`Maximum {max} files`,"attach.remove":`Remove`,"attach.uploading":`Uploading files...`,"attach.uploadProgress":`Uploading {name}... {percent}%`,"attach.invalidType":`File type not allowed`,"attach.tooLarge":`File exceeds maximum size`,"attach.tooMany":`Maximum number of files reached`,"attach.download":`Download`,"mytickets.title":`My Tickets`,"mytickets.emailPrompt":`Enter your email to view your tickets`,"mytickets.emailPlaceholder":`your@email.com`,"mytickets.rememberMe":`Remember me`,"mytickets.lookup":`Find My Tickets`,"mytickets.lookingUp":`Looking up...`,"mytickets.noTickets":`No tickets yet.`,"mytickets.submitFirst":`Submit your first ticket`,"mytickets.noAccount":`No tickets found for this email.`,"detail.description":`Description`,"detail.attachments":`Attachments`,"detail.noAttachments":`No attachments`,"detail.replies":`Conversation`,"detail.noReplies":`No replies yet.`,"detail.replyPlaceholder":`Write a reply...`,"detail.sendReply":`Send`,"detail.sending":`Sending...`,"detail.staff":`Staff`,"detail.you":`You`,"detail.loading":`Loading ticket...`,"track.title":`Track a Ticket`,"track.tokenPlaceholder":`Enter tracking token (trk_...)`,"track.submit":`Track`,"track.tracking":`Tracking...`,"track.recentTickets":`Recent Tickets`,"track.invalidToken":`Invalid or expired tracking token.`,"prefs.clearEmail":`Clear saved email`,"prefs.emailCleared":`Email cleared`,"auth.login":`Login`,"auth.logout":`Logout`,"auth.sessionExpired":`Session expired. Please log in again.`,"prefs.accentColor":`Accent Color`},d={"widget.title":`الدعم`,"widget.newTicket":`تذكرة جديدة`,"widget.trackTicket":`تتبع التذكرة`,"form.title":`العنوان`,"form.titlePlaceholder":`ملخص موجز لمشكلتك`,"form.description":`الوصف`,"form.descriptionPlaceholder":`صف مشكلتك بالتفصيل...`,"form.email":`البريد الإلكتروني`,"form.emailPlaceholder":`your@email.com`,"form.priority":`الأولوية`,"form.priorityLow":`منخفضة`,"form.priorityMedium":`متوسطة`,"form.priorityHigh":`عالية`,"form.priorityUrgent":`عاجلة`,"form.category":`الفئة`,"form.categoryNone":`اختر فئة`,"form.submit":`إرسال التذكرة`,"form.submitting":`جارِ الإرسال...`,"form.cancel":`إلغاء`,"form.attachment":`إرفاق ملفات`,"success.title":`تم إرسال التذكرة!`,"success.ticketNumber":`تذكرة #`,"success.trackingToken":`رمز التتبع الخاص بك:`,"success.trackingHint":`احفظ هذا الرمز لتتبع حالة تذكرتك.`,"success.copyToken":`نسخ الرمز`,"success.copied":`تم النسخ!`,"success.close":`إغلاق`,"success.trackNow":`تتبع التذكرة`,"tracker.title":`تتبع تذكرتك`,"tracker.tokenPlaceholder":`أدخل رمز التتبع الخاص بك (trk_...)`,"tracker.submit":`تتبع`,"tracker.tracking":`جارِ التتبع...`,"tracker.status":`الحالة`,"tracker.priority":`الأولوية`,"tracker.created":`تاريخ الإنشاء`,"tracker.replies":`الردود`,"tracker.noReplies":`لا توجد ردود بعد.`,"tracker.replyPlaceholder":`اكتب رداً...`,"tracker.sendReply":`إرسال الرد`,"tracker.sending":`جارِ الإرسال...`,"tracker.back":`رجوع`,"tracker.staff":`فريق الدعم`,"error.generic":`حدث خطأ ما. يرجى المحاولة مرة أخرى.`,"error.network":`خطأ في الشبكة. تحقق من اتصالك.`,"error.tokenInvalid":`رمز التتبع غير صالح أو منتهي الصلاحية.`,"error.required":`هذا الحقل مطلوب.`,"error.emailInvalid":`يرجى إدخال بريد إلكتروني صالح.`,"error.titleMin":`يجب أن يكون العنوان 5 أحرف على الأقل.`,"portal.title":`بوابة الدعم`,"portal.myTickets":`تذاكري`,"portal.noTickets":`لا توجد تذاكر بعد.`,"portal.newTicket":`تذكرة جديدة`,"widget.close":`إغلاق`,"menu.newTicket":`إرسال تذكرة`,"menu.newTicketDesc":`إنشاء طلب ��عم جديد`,"menu.myTickets":`تذاكري`,"menu.myTicketsDesc":`عرض وإدارة تذاكرك`,"menu.trackTicket":`تتبع تذكرة`,"menu.trackTicketDesc":`تحقق من الحالة باستخدام رمز التتبع`,"menu.knowledgeBase":`قاعدة المعرفة`,"menu.knowledgeBaseDesc":`تصفح مقالات المساعدة والأدلة`,"menu.myTicketsPlaceholder":`سجّل الدخول ��عرض تذاكرك.`,"menu.trackPlaceholder":`تتبع التذاكر قريبًا.`,"menu.kbPlaceholder":`قاعدة المعرفة قريبًا.`,"menu.preferences":`التفضيلات`,"menu.preferencesDesc":`إعدادات اللغة والمظهر`,"prefs.title":`التفضيلات`,"prefs.language":`اللغة`,"prefs.theme":`المظهر`,"prefs.light":`فاتح`,"prefs.dark":`داكن`,"prefs.auto":`النظام`,"branding.poweredBy":`مدعوم من`,"attach.dropzone":`اسحب الملفات هنا أو انقر للتصفح`,"attach.dropzoneActive":`أفلت الملفات هنا`,"attach.maxFiles":`بحد أقصى {max} ملفات`,"attach.remove":`إزالة`,"attach.uploading":`جارِ رفع الملفات...`,"attach.uploadProgress":`جارِ رفع {name}... {percent}%`,"attach.invalidType":`نوع الملف غير مسموح`,"attach.tooLarge":`حجم الملف يتجاوز الحد الأقصى`,"attach.tooMany":`تم الوصول للحد الأقصى لعدد الملفات`,"attach.download":`تحميل`,"mytickets.title":`تذاكري`,"mytickets.emailPrompt":`أدخل بريدك الإلكتروني لعرض تذاكرك`,"mytickets.emailPlaceholder":`your@email.com`,"mytickets.rememberMe":`تذكرني`,"mytickets.lookup":`البحث عن تذاكري`,"mytickets.lookingUp":`جارِ البحث...`,"mytickets.noTickets":`لا توجد تذاكر بعد.`,"mytickets.submitFirst":`أرسل تذكرتك الأولى`,"mytickets.noAccount":`لم يتم العثور على تذاكر لهذا البريد.`,"detail.description":`الوصف`,"detail.attachments":`المرفقات`,"detail.noAttachments":`لا توجد مرفقات`,"detail.replies":`المحادثة`,"detail.noReplies":`لا توجد ردود بعد.`,"detail.replyPlaceholder":`اكتب رداً...`,"detail.sendReply":`إرسال`,"detail.sending":`جارِ الإرسال...`,"detail.staff":`فريق الدعم`,"detail.you":`أنت`,"detail.loading":`جارِ تحميل التذكرة...`,"track.title":`تتبع تذكرة`,"track.tokenPlaceholder":`أدخل رمز التتبع (trk_...)`,"track.submit":`تتبع`,"track.tracking":`جارِ التتبع...`,"track.recentTickets":`التذاكر الأخيرة`,"track.invalidToken":`رمز التتبع غير صالح أو منتهي.`,"prefs.clearEmail":`مسح البريد المحفوظ`,"prefs.emailCleared":`تم مسح البريد`,"auth.login":`تسجيل الدخول`,"auth.logout":`تسجيل الخروج`,"auth.sessionExpired":`انتهت الجلسة. يرجى تسجيل الدخول مرة أخرى.`,"prefs.accentColor":`لون التمييز`},f={primaryColor:`#42b983`,mode:`light`,borderRadius:`8px`,fontFamily:`inherit`,zIndex:9999};function p(e){return e===`auto`?typeof window<`u`&&window.matchMedia?.(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e??`light`}function m(e={}){let t={...f,...e,mode:p(e.mode??f.mode)},n=h(t.primaryColor),r=Math.min(n.l+30,95),i=Math.max(n.l-15,10);return[`--rqd-primary: ${t.primaryColor}`,`--rqd-primary-h: ${n.h}`,`--rqd-primary-s: ${n.s}%`,`--rqd-primary-l: ${n.l}%`,`--rqd-primary-light: hsl(${n.h}, ${n.s}%, ${r}%)`,`--rqd-primary-dark: hsl(${n.h}, ${n.s}%, ${i}%)`,`--rqd-radius: ${t.borderRadius}`,`--rqd-font: ${t.fontFamily}`,`--rqd-z: ${t.zIndex}`,`--rqd-bg: ${t.mode===`dark`?`#1a1a2e`:`#ffffff`}`,`--rqd-bg-secondary: ${t.mode===`dark`?`#16213e`:`#f8f9fa`}`,`--rqd-text: ${t.mode===`dark`?`#e0e0e0`:`#1a1a2e`}`,`--rqd-text-secondary: ${t.mode===`dark`?`#a0a0b0`:`#6c757d`}`,`--rqd-border: ${t.mode===`dark`?`#2a2a4a`:`#e0e0e0`}`,`--rqd-input-bg: ${t.mode===`dark`?`#0f3460`:`#ffffff`}`,`--rqd-shadow: ${t.mode===`dark`?`0 8px 32px rgba(0,0,0,0.4)`:`0 8px 32px rgba(0,0,0,0.12)`}`].join(`; `)}function h(e){let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!t)return{h:160,s:51,l:49};let n=parseInt(t[1],16)/255,r=parseInt(t[2],16)/255,i=parseInt(t[3],16)/255,a=Math.max(n,r,i),o=Math.min(n,r,i),s=0,c=0,l=(a+o)/2;if(a!==o){let e=a-o;c=l>.5?e/(2-a-o):e/(a+o),s=a===n?((r-i)/e+(r<i?6:0))/6:a===r?((i-n)/e+2)/6:((n-r)/e+4)/6}return{h:Math.round(s*360),s:Math.round(c*100),l:Math.round(l*100)}}function ee(){return te}let te=`:host { all: initial; }
2
+ .rqd-root { font-family: var(--rqd-font, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif); font-size: 14px; line-height: 1.5; color: var(--rqd-text); -webkit-font-smoothing: antialiased; }
3
+ .rqd-fab { position: fixed; bottom: 20px; width: 56px; height: 56px; border-radius: 50%; background: var(--rqd-primary); color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 16px rgba(0,0,0,0.2); transition: transform 0.2s, box-shadow 0.2s; pointer-events: auto; z-index: var(--rqd-z, 9999); }
4
+ .rqd-fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(0,0,0,0.25); }
5
+ .rqd-fab.rqd-bottom-right { right: 20px; }
6
+ .rqd-fab.rqd-bottom-left { left: 20px; }
7
+ .rqd-fab svg { width: 24px; height: 24px; fill: currentColor; }
8
+ .rqd-panel { position: fixed; bottom: 88px; width: 380px; max-height: calc(100vh - 120px); background: var(--rqd-bg); border-radius: var(--rqd-radius); box-shadow: var(--rqd-shadow); overflow: hidden; display: flex; flex-direction: column; pointer-events: auto; animation: rqd-slide-up 0.25s ease-out; border: 1px solid var(--rqd-border); }
9
+ .rqd-panel.rqd-bottom-right { right: 20px; }
10
+ .rqd-panel.rqd-bottom-left { left: 20px; }
11
+ .rqd-panel.rqd-hidden { display: none; }
12
+ @keyframes rqd-slide-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
13
+ .rqd-header { display: flex; align-items: center; justify-content: space-between; padding: 16px; background: var(--rqd-primary); color: #fff; }
14
+ .rqd-header-title { font-size: 16px; font-weight: 600; }
15
+ .rqd-header-close { background: none; border: none; color: #fff; cursor: pointer; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: background 0.15s; }
16
+ .rqd-header-close:hover { background: rgba(255,255,255,0.2); }
17
+ .rqd-tabs { display: flex; border-bottom: 1px solid var(--rqd-border); }
18
+ .rqd-tab { flex: 1; padding: 10px; text-align: center; background: none; border: none; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--rqd-text-secondary); border-bottom: 2px solid transparent; transition: color 0.15s, border-color 0.15s; }
19
+ .rqd-tab.rqd-active { color: var(--rqd-primary); border-bottom-color: var(--rqd-primary); }
20
+ .rqd-body { flex: 1; overflow-y: auto; padding: 16px; }
21
+ .rqd-form-group { margin-bottom: 14px; }
22
+ .rqd-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: var(--rqd-text); }
23
+ .rqd-input, .rqd-textarea, .rqd-select { width: 100%; padding: 8px 12px; border: 1px solid var(--rqd-border); border-radius: calc(var(--rqd-radius, 8px) / 2); font-size: 14px; font-family: inherit; background: var(--rqd-input-bg); color: var(--rqd-text); outline: none; transition: border-color 0.15s; box-sizing: border-box; }
24
+ .rqd-input:focus, .rqd-textarea:focus, .rqd-select:focus { border-color: var(--rqd-primary); }
25
+ .rqd-textarea { resize: vertical; min-height: 80px; }
26
+ .rqd-error-text { color: #e74c3c; font-size: 12px; margin-top: 2px; }
27
+ .rqd-btn { width: 100%; padding: 10px; border: none; border-radius: calc(var(--rqd-radius, 8px) / 2); font-size: 14px; font-weight: 600; cursor: pointer; transition: opacity 0.15s; }
28
+ .rqd-btn:disabled { opacity: 0.6; cursor: not-allowed; }
29
+ .rqd-btn-primary { background: var(--rqd-primary); color: #fff; }
30
+ .rqd-btn-primary:hover:not(:disabled) { opacity: 0.9; }
31
+ .rqd-btn-secondary { background: transparent; color: var(--rqd-primary); border: 1px solid var(--rqd-primary); }
32
+ .rqd-success { text-align: center; padding: 24px 0; }
33
+ .rqd-success-icon { font-size: 48px; margin-bottom: 12px; }
34
+ .rqd-success h3 { margin: 0 0 8px; font-size: 18px; color: var(--rqd-text); }
35
+ .rqd-token-box { background: var(--rqd-bg-secondary); border: 1px solid var(--rqd-border); border-radius: calc(var(--rqd-radius, 8px) / 2); padding: 8px 12px; font-family: monospace; font-size: 12px; word-break: break-all; margin: 8px 0; color: var(--rqd-text); }
36
+ .rqd-ticket-info { background: var(--rqd-bg-secondary); border-radius: calc(var(--rqd-radius, 8px) / 2); padding: 12px; margin-bottom: 12px; }
37
+ .rqd-ticket-row { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 13px; }
38
+ .rqd-ticket-label { color: var(--rqd-text-secondary); }
39
+ .rqd-badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; background: var(--rqd-primary-light); color: var(--rqd-primary-dark); }
40
+ .rqd-reply { padding: 10px 0; border-bottom: 1px solid var(--rqd-border); }
41
+ .rqd-reply:last-child { border-bottom: none; }
42
+ .rqd-reply-header { display: flex; justify-content: space-between; font-size: 12px; color: var(--rqd-text-secondary); margin-bottom: 4px; }
43
+ .rqd-reply-staff { color: var(--rqd-primary); font-weight: 600; }
44
+ .rqd-reply-body { font-size: 14px; white-space: pre-wrap; }
45
+ .rqd-inline { pointer-events: auto; background: var(--rqd-bg); border: 1px solid var(--rqd-border); border-radius: var(--rqd-radius); overflow: hidden; }
46
+ .rqd-inline .rqd-body { max-height: none; }
47
+ :host([dir="rtl"]) .rqd-root { direction: rtl; text-align: right; }
48
+ :host([dir="rtl"]) .rqd-fab.rqd-bottom-right { right: auto; left: 20px; }
49
+ :host([dir="rtl"]) .rqd-fab.rqd-bottom-left { left: auto; right: 20px; }
50
+ :host([dir="rtl"]) .rqd-panel.rqd-bottom-right { right: auto; left: 20px; }
51
+ :host([dir="rtl"]) .rqd-panel.rqd-bottom-left { left: auto; right: 20px; }
52
+ .rqd-menu { display: flex; flex-direction: column; gap: 6px; }
53
+ .rqd-menu-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 12px; background: var(--rqd-bg-secondary); border: 1px solid transparent; border-radius: calc(var(--rqd-radius, 8px) / 1.5); cursor: pointer; text-align: start; transition: border-color 0.15s, background 0.15s, transform 0.1s; font-family: inherit; color: var(--rqd-text); }
54
+ .rqd-menu-item:hover { border-color: var(--rqd-primary); background: var(--rqd-bg); transform: translateY(-1px); }
55
+ .rqd-menu-icon { width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; border-radius: calc(var(--rqd-radius, 8px) / 2); background: var(--rqd-primary-light); color: var(--rqd-primary-dark); flex-shrink: 0; }
56
+ .rqd-menu-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
57
+ .rqd-menu-label { font-size: 14px; font-weight: 600; line-height: 1.3; }
58
+ .rqd-menu-desc { font-size: 12px; color: var(--rqd-text-secondary); line-height: 1.3; }
59
+ .rqd-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 40px 16px; color: var(--rqd-text-secondary); text-align: center; }
60
+ .rqd-placeholder p { margin: 0; font-size: 14px; }
61
+ .rqd-header-brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
62
+ .rqd-header-logo { width: 24px; height: 24px; border-radius: 4px; object-fit: contain; flex-shrink: 0; }
63
+ .rqd-footer { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 8px 16px; border-top: 1px solid var(--rqd-border); font-size: 11px; color: var(--rqd-text-secondary); }
64
+ .rqd-footer a { color: var(--rqd-text-secondary); text-decoration: none; font-weight: 600; transition: color 0.15s; }
65
+ .rqd-footer a:hover { color: var(--rqd-primary); }
66
+ .rqd-prefs { display: flex; flex-direction: column; gap: 16px; }
67
+ .rqd-prefs-group { display: flex; flex-direction: column; gap: 6px; }
68
+ .rqd-prefs-label { font-size: 13px; font-weight: 600; color: var(--rqd-text); }
69
+ .rqd-prefs-options { display: flex; gap: 6px; }
70
+ .rqd-prefs-option { flex: 1; padding: 8px 12px; background: var(--rqd-bg-secondary); border: 1px solid var(--rqd-border); border-radius: calc(var(--rqd-radius, 8px) / 2); cursor: pointer; text-align: center; font-size: 13px; font-family: inherit; color: var(--rqd-text); transition: border-color 0.15s, background 0.15s; }
71
+ .rqd-prefs-option:hover { border-color: var(--rqd-primary); }
72
+ .rqd-prefs-option.rqd-active { border-color: var(--rqd-primary); background: var(--rqd-primary-light); color: var(--rqd-primary-dark); font-weight: 600; }
73
+ .rqd-dropzone { border: 2px dashed var(--rqd-border); border-radius: calc(var(--rqd-radius, 8px) / 2); padding: 16px; text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s; color: var(--rqd-text-secondary); font-size: 13px; margin-bottom: 14px; }
74
+ .rqd-dropzone:hover { border-color: var(--rqd-primary); }
75
+ .rqd-dropzone.rqd-dropzone-active { border-color: var(--rqd-primary); background: var(--rqd-primary-light); color: var(--rqd-primary-dark); }
76
+ .rqd-file-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
77
+ .rqd-file-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; background: var(--rqd-bg-secondary); border-radius: calc(var(--rqd-radius, 8px) / 2); font-size: 13px; }
78
+ .rqd-file-item-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
79
+ .rqd-file-item-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
80
+ .rqd-file-item-size { font-size: 11px; color: var(--rqd-text-secondary); }
81
+ .rqd-file-remove { background: none; border: none; color: var(--rqd-text-secondary); cursor: pointer; padding: 4px; font-size: 16px; line-height: 1; flex-shrink: 0; }
82
+ .rqd-file-remove:hover { color: #e74c3c; }
83
+ .rqd-progress { width: 100%; height: 6px; background: var(--rqd-bg-secondary); border-radius: 3px; overflow: hidden; margin-top: 6px; }
84
+ .rqd-progress-bar { height: 100%; background: var(--rqd-primary); border-radius: 3px; transition: width 0.2s ease; }
85
+ .rqd-upload-status { font-size: 12px; color: var(--rqd-text-secondary); margin-top: 4px; }
86
+ .rqd-attachment-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
87
+ .rqd-attachment-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; background: var(--rqd-bg-secondary); border-radius: calc(var(--rqd-radius, 8px) / 2); font-size: 13px; }
88
+ .rqd-attachment-item a { color: var(--rqd-primary); text-decoration: none; font-weight: 500; font-size: 12px; flex-shrink: 0; }
89
+ .rqd-attachment-item a:hover { text-decoration: underline; }
90
+ .rqd-ticket-header { margin-bottom: 12px; }
91
+ .rqd-ticket-header h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; color: var(--rqd-text); }
92
+ .rqd-ticket-header-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
93
+ .rqd-ticket-desc { font-size: 14px; color: var(--rqd-text); white-space: pre-wrap; margin-bottom: 16px; padding: 10px; background: var(--rqd-bg-secondary); border-radius: calc(var(--rqd-radius, 8px) / 2); }
94
+ .rqd-section-title { font-size: 13px; font-weight: 600; color: var(--rqd-text); margin-bottom: 8px; }
95
+ .rqd-email-form { display: flex; flex-direction: column; gap: 12px; padding: 24px 0; }
96
+ .rqd-email-form p { margin: 0; font-size: 14px; color: var(--rqd-text-secondary); text-align: center; }
97
+ .rqd-checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--rqd-text-secondary); cursor: pointer; }
98
+ .rqd-checkbox-label input[type="checkbox"] { accent-color: var(--rqd-primary); width: 16px; height: 16px; cursor: pointer; }
99
+ .rqd-ticket-card { display: flex; flex-direction: column; gap: 4px; padding: 12px; background: var(--rqd-bg-secondary); border: 1px solid transparent; border-radius: calc(var(--rqd-radius, 8px) / 1.5); cursor: pointer; transition: border-color 0.15s, transform 0.1s; }
100
+ .rqd-ticket-card:hover { border-color: var(--rqd-primary); transform: translateY(-1px); }
101
+ .rqd-ticket-card-top { display: flex; justify-content: space-between; align-items: center; }
102
+ .rqd-ticket-card-number { font-size: 12px; font-weight: 600; color: var(--rqd-text-secondary); }
103
+ .rqd-ticket-card-title { font-size: 14px; font-weight: 500; color: var(--rqd-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
104
+ .rqd-ticket-card-date { font-size: 11px; color: var(--rqd-text-secondary); }
105
+ .rqd-ticket-list { display: flex; flex-direction: column; gap: 6px; }
106
+ .rqd-loading { text-align: center; padding: 24px 0; color: var(--rqd-text-secondary); font-size: 14px; }
107
+ .rqd-reply-compose { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
108
+ .rqd-auth-btn { background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.4); color: #fff; cursor: pointer; padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: 500; font-family: inherit; transition: background 0.15s; white-space: nowrap; }
109
+ .rqd-auth-btn:hover { background: rgba(255,255,255,0.3); }
110
+ .rqd-color-presets { display: flex; gap: 8px; flex-wrap: wrap; }
111
+ .rqd-color-preset { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s; padding: 0; }
112
+ .rqd-color-preset:hover { transform: scale(1.15); }
113
+ .rqd-color-preset.rqd-active { box-shadow: 0 0 0 3px var(--rqd-bg), 0 0 0 5px currentColor; }
114
+ .rqd-contained.rqd-fab { position: absolute; }
115
+ .rqd-contained.rqd-panel { position: absolute; }
116
+ @media (max-width: 440px) { .rqd-panel { width: calc(100vw - 24px); right: 12px !important; left: 12px !important; bottom: 76px; } .rqd-fab { bottom: 12px; } .rqd-fab.rqd-bottom-right { right: 12px; } .rqd-fab.rqd-bottom-left { left: 12px; } }
117
+ `,g=null,_=null;function v(e){if(g&&_){let e=g.querySelector(`.rqd-root`);return{shadow:g,host:_,mount:e}}_=document.createElement(`div`),_.id=`reqdesk-widget`,_.style.position=`fixed`,_.style.zIndex=String(e.zIndex??9999),_.style.inset=`0`,_.style.pointerEvents=`none`,document.body.appendChild(_),g=_.attachShadow({mode:`open`});let t=document.createElement(`style`);t.textContent=ee(),g.appendChild(t);let n=document.createElement(`div`);return n.className=`rqd-root`,g.appendChild(n),{shadow:g,host:_,mount:n}}function ne(){_&&(_.remove(),_=null,g=null)}function y(){return g}function b(e){let t=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);t.setAttribute(`viewBox`,`0 0 24 24`);let n=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);return n.setAttribute(`d`,e),t.appendChild(n),t}let x=`M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z`;function re(e,t){let n=document.createElement(`button`);return n.className=`rqd-fab rqd-${e}`,n.appendChild(b(x)),n.setAttribute(`aria-label`,`Open support widget`),n.addEventListener(`click`,t),n}function S(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(b(t?`M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z`:x)),e.setAttribute(`aria-label`,t?`Close support widget`:`Open support widget`)}let C=`reqdesk_`;function w(){try{let e=window.localStorage;return e.setItem(`__test__`,`1`),e.removeItem(`__test__`),e}catch{try{return window.sessionStorage}catch{return null}}}function T(e,t){let n=w();if(!n)return;let r=`${C}tokens_${e}`;try{let e=JSON.parse(n.getItem(r)??`[]`);e.includes(t)||(e.push(t),n.setItem(r,JSON.stringify(e)))}catch{n.setItem(r,JSON.stringify([t]))}}function E(e){let t=w();if(!t)return[];let n=`${C}tokens_${e}`;try{return JSON.parse(t.getItem(n)??`[]`)}catch{return[]}}function D(e,t){let n=w();if(!n)return;let r=`${C}config_${e}`;try{let i=O(e),a={...i,...t};t.theme&&i?.theme&&(a.theme={...i.theme,...t.theme}),n.setItem(r,JSON.stringify(a))}catch{}}function O(e){let t=w();if(!t)return null;let n=`${C}config_${e}`;try{let e=t.getItem(n);return e?JSON.parse(e):null}catch{return null}}function ie(e,t,n,r){let i=document.createElement(`form`);i.className=`rqd-form`,i.setAttribute(`novalidate`,``);let a={},o={};function c(e,t,n,r){let s=document.createElement(`div`);s.className=`rqd-form-group`;let c=document.createElement(`label`);c.className=`rqd-label`,c.textContent=n,s.appendChild(c);let l;if(t===`textarea`)l=document.createElement(`textarea`),l.className=`rqd-textarea`;else if(t===`select`){if(l=document.createElement(`select`),l.className=`rqd-select`,r?.options)for(let e of r.options){let t=document.createElement(`option`);t.value=e.value,t.textContent=e.label,l.appendChild(t)}}else l=document.createElement(`input`),l.className=`rqd-input`,l.type=e===`email`?`email`:`text`;r?.placeholder&&`placeholder`in l&&(l.placeholder=r.placeholder),r?.required&&(l.required=!0),l.name=e,s.appendChild(l);let u=document.createElement(`div`);u.className=`rqd-error-text`,u.style.display=`none`,s.appendChild(u),a[e]=l,o[e]=u,i.appendChild(s)}let l=!1;function u(e){l&&e.preventDefault()}window.addEventListener(`beforeunload`,u),i.addEventListener(`input`,()=>{l=Object.values(a).some(e=>e.value.trim().length>0)}),c(`title`,`input`,t(`form.title`),{placeholder:t(`form.titlePlaceholder`),required:!0}),c(`description`,`textarea`,t(`form.description`),{placeholder:t(`form.descriptionPlaceholder`)}),c(`email`,`input`,t(`form.email`),{placeholder:t(`form.emailPlaceholder`),required:!0}),c(`priority`,`select`,t(`form.priority`),{options:[{value:`medium`,label:t(`form.priorityMedium`)},{value:`low`,label:t(`form.priorityLow`)},{value:`high`,label:t(`form.priorityHigh`)},{value:`urgent`,label:t(`form.priorityUrgent`)}]});let d=document.createElement(`button`);d.type=`submit`,d.className=`rqd-btn rqd-btn-primary`,d.textContent=t(`form.submit`),i.appendChild(d);function f(){let e=!0,n=a.title.value.trim(),r=a.email.value.trim();for(let e of Object.values(o))e.style.display=`none`,e.textContent=``;return n?n.length<5&&(o.title.textContent=t(`error.titleMin`),o.title.style.display=`block`,e=!1):(o.title.textContent=t(`error.required`),o.title.style.display=`block`,e=!1),r?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)||(o.email.textContent=t(`error.emailInvalid`),o.email.style.display=`block`,e=!1):(o.email.textContent=t(`error.required`),o.email.style.display=`block`,e=!1),e}return i.addEventListener(`submit`,async i=>{if(i.preventDefault(),!f())return;d.disabled=!0,d.textContent=t(`form.submitting`);let o={title:a.title.value.trim(),description:a.description.value.trim()||void 0,email:a.email.value.trim(),priority:a.priority.value};try{let t=await s(e,o);t.trackingToken&&T(e,t.trackingToken),l=!1,window.removeEventListener(`beforeunload`,u),n(t)}catch(e){r(e),d.disabled=!1,d.textContent=t(`form.submit`)}}),i}function ae(e,t,n,r){let i=document.createElement(`div`);i.className=`rqd-success`;let a=document.createElement(`div`);a.className=`rqd-success-icon`,a.textContent=`✅`,i.appendChild(a);let o=document.createElement(`h3`);o.textContent=t(`success.title`),i.appendChild(o);let s=document.createElement(`p`);if(s.textContent=t(`success.ticketNumber`)+e.ticketNumber,i.appendChild(s),e.trackingToken){let n=document.createElement(`p`);n.textContent=t(`success.trackingHint`),n.style.fontSize=`13px`,n.style.color=`var(--rqd-text-secondary)`,i.appendChild(n);let a=document.createElement(`div`);a.className=`rqd-token-box`,a.textContent=e.trackingToken,i.appendChild(a);let o=document.createElement(`button`);if(o.className=`rqd-btn rqd-btn-secondary`,o.textContent=t(`success.copyToken`),o.style.marginBottom=`8px`,o.addEventListener(`click`,()=>{navigator.clipboard.writeText(e.trackingToken).then(()=>{o.textContent=t(`success.copied`),setTimeout(()=>{o.textContent=t(`success.copyToken`)},2e3)})}),i.appendChild(o),r){let e=document.createElement(`button`);e.className=`rqd-btn rqd-btn-primary`,e.textContent=t(`success.trackNow`),e.style.marginTop=`4px`,e.addEventListener(`click`,r),i.appendChild(e)}}let c=document.createElement(`button`);return c.className=`rqd-btn rqd-btn-secondary`,c.textContent=t(`success.close`),c.style.marginTop=`8px`,c.addEventListener(`click`,n),i.appendChild(c),i}function oe(e,t,n,r,i,a){let o=document.createElement(`div`);return o.className=`rqd-tracker`,a?(A(o,e),j(a,o,e,t,n,r,i)):k(o,e,t,n,r,i),o}function k(e,t,n,r,i,a){for(;e.firstChild;)e.removeChild(e.firstChild);let o=document.createElement(`div`);o.className=`rqd-form-group`;let s=document.createElement(`label`);s.className=`rqd-label`,s.textContent=t(`tracker.title`),o.appendChild(s);let c=document.createElement(`input`);c.className=`rqd-input`,c.placeholder=t(`tracker.tokenPlaceholder`),c.type=`text`,o.appendChild(c);let l=document.createElement(`div`);l.className=`rqd-error-text`,l.style.display=`none`,o.appendChild(l),e.appendChild(o);let u=document.createElement(`button`);u.className=`rqd-btn rqd-btn-primary`,u.textContent=t(`tracker.submit`),u.addEventListener(`click`,()=>{let o=c.value.trim();if(!o){l.textContent=t(`error.required`),l.style.display=`block`;return}l.style.display=`none`,u.disabled=!0,u.textContent=t(`tracker.tracking`),j(o,e,t,n,r,i,a)}),e.appendChild(u)}function A(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);let n=document.createElement(`p`);n.textContent=t(`tracker.tracking`),n.style.textAlign=`center`,n.style.color=`var(--rqd-text-secondary)`,e.appendChild(n)}async function j(e,t,n,r,i,a,o){try{let s=await c(e);r(s),M(t,e,s,n,i,a,o)}catch(e){a(e),k(t,n,r,i,a,o)}}function M(e,t,n,r,i,a,o){for(;e.firstChild;)e.removeChild(e.firstChild);if(o){let t=document.createElement(`button`);t.className=`rqd-btn rqd-btn-secondary`,t.textContent=r(`tracker.back`),t.style.marginBottom=`12px`,t.addEventListener(`click`,o),e.appendChild(t)}let s=document.createElement(`div`);s.className=`rqd-ticket-info`;let u=document.createElement(`div`);u.style.fontWeight=`600`,u.style.marginBottom=`8px`,u.textContent=`${n.ticketNumber} — ${n.title}`,s.appendChild(u);for(let[e,t]of[[r(`tracker.status`),n.status],[r(`tracker.priority`),n.priority],[r(`tracker.created`),new Date(n.createdAt).toLocaleDateString()]]){let n=document.createElement(`div`);n.className=`rqd-ticket-row`;let r=document.createElement(`span`);r.className=`rqd-ticket-label`,r.textContent=e,n.appendChild(r);let i=document.createElement(`span`);i.className=`rqd-badge`,i.textContent=t,n.appendChild(i),s.appendChild(n)}e.appendChild(s);let d=document.createElement(`div`);if(d.className=`rqd-label`,d.textContent=r(`tracker.replies`),d.style.marginBottom=`8px`,e.appendChild(d),n.replies.length===0){let t=document.createElement(`p`);t.textContent=r(`tracker.noReplies`),t.style.color=`var(--rqd-text-secondary)`,t.style.fontSize=`13px`,e.appendChild(t)}else for(let t of n.replies){let n=document.createElement(`div`);n.className=`rqd-reply`;let r=document.createElement(`div`);r.className=`rqd-reply-header`;let i=document.createElement(`span`);i.textContent=t.authorName,t.isStaff&&(i.className=`rqd-reply-staff`),r.appendChild(i);let a=document.createElement(`span`);a.textContent=new Date(t.createdAt).toLocaleString(),r.appendChild(a),n.appendChild(r);let o=document.createElement(`div`);o.className=`rqd-reply-body`,o.textContent=t.body,n.appendChild(o),e.appendChild(n)}let f=document.createElement(`div`);f.className=`rqd-form-group`,f.style.marginTop=`12px`;let p=document.createElement(`textarea`);p.className=`rqd-textarea`,p.placeholder=r(`tracker.replyPlaceholder`),p.rows=3,f.appendChild(p),e.appendChild(f);let m=document.createElement(`button`);m.className=`rqd-btn rqd-btn-primary`,m.textContent=r(`tracker.sendReply`),m.addEventListener(`click`,async()=>{let n=p.value.trim();if(n){m.disabled=!0,m.textContent=r(`tracker.sending`);try{await l(t,n),i({token:t,body:n}),M(e,t,await c(t),r,i,a,o)}catch(e){a(e),m.disabled=!1,m.textContent=r(`tracker.sendReply`)}}}),e.appendChild(m)}function se(e,t,n,r,i,a,o,c){let l=document.createElement(`div`);l.className=`rqd-portal`;let u=`list`,d;function f(){for(u=`list`;l.firstChild;)l.removeChild(l.firstChild);let n=document.createElement(`div`);n.style.display=`flex`,n.style.justifyContent=`space-between`,n.style.alignItems=`center`,n.style.marginBottom=`12px`;let r=document.createElement(`span`);r.style.fontWeight=`600`,r.textContent=e(`portal.myTickets`),n.appendChild(r);let i=document.createElement(`button`);i.className=`rqd-btn rqd-btn-primary`,i.style.width=`auto`,i.style.padding=`6px 14px`,i.style.fontSize=`13px`,i.textContent=e(`portal.newTicket`),i.addEventListener(`click`,m),n.appendChild(i),l.appendChild(n);let a=document.createElement(`p`);a.textContent=`...`,a.style.textAlign=`center`,a.style.color=`var(--rqd-text-secondary)`,l.appendChild(a),t().then(t=>{if(a.remove(),t.length===0){let t=document.createElement(`p`);t.textContent=e(`portal.noTickets`),t.style.textAlign=`center`,t.style.color=`var(--rqd-text-secondary)`,t.style.padding=`24px 0`,l.appendChild(t);return}for(let e of t){let t=document.createElement(`div`);t.className=`rqd-ticket-info`,t.style.cursor=`pointer`,t.style.marginBottom=`8px`;let n=document.createElement(`div`);n.style.display=`flex`,n.style.justifyContent=`space-between`,n.style.marginBottom=`4px`;let r=document.createElement(`span`);r.style.fontWeight=`600`,r.style.fontSize=`13px`,r.textContent=e.ticketNumber,n.appendChild(r);let i=document.createElement(`span`);i.className=`rqd-badge`,i.textContent=e.status,n.appendChild(i),t.appendChild(n);let a=document.createElement(`div`);a.style.fontSize=`14px`,a.textContent=e.title,t.appendChild(a);let o=document.createElement(`div`);o.style.fontSize=`12px`,o.style.color=`var(--rqd-text-secondary)`,o.style.marginTop=`4px`,o.textContent=new Date(e.createdAt).toLocaleDateString(),t.appendChild(o),t.addEventListener(`click`,()=>p(e.id)),l.appendChild(t)}}).catch(e=>{a.remove(),o(e)}),c&&c>0&&(h(),d=setInterval(()=>{u===`list`&&f()},c))}function p(t){for(u=`detail`,h();l.firstChild;)l.removeChild(l.firstChild);let i=document.createElement(`button`);i.className=`rqd-btn rqd-btn-secondary`,i.textContent=e(`tracker.back`),i.style.marginBottom=`12px`,i.addEventListener(`click`,f),l.appendChild(i);let a=document.createElement(`p`);a.textContent=`...`,a.style.textAlign=`center`,l.appendChild(a),n(t).then(n=>{a.remove();let i=document.createElement(`div`);i.className=`rqd-ticket-info`;let s=document.createElement(`div`);s.style.fontWeight=`600`,s.style.marginBottom=`8px`,s.textContent=`${n.ticketNumber} — ${n.title}`,i.appendChild(s);for(let[t,r]of[[e(`tracker.status`),n.status],[e(`tracker.priority`),n.priority]]){let e=document.createElement(`div`);e.className=`rqd-ticket-row`;let n=document.createElement(`span`);n.className=`rqd-ticket-label`,n.textContent=t,e.appendChild(n);let a=document.createElement(`span`);a.className=`rqd-badge`,a.textContent=r,e.appendChild(a),i.appendChild(e)}l.appendChild(i);let c=document.createElement(`div`);if(c.className=`rqd-label`,c.textContent=e(`tracker.replies`),c.style.marginBottom=`8px`,l.appendChild(c),n.replies.length===0){let t=document.createElement(`p`);t.textContent=e(`tracker.noReplies`),t.style.color=`var(--rqd-text-secondary)`,t.style.fontSize=`13px`,l.appendChild(t)}else for(let e of n.replies){let t=document.createElement(`div`);t.className=`rqd-reply`;let n=document.createElement(`div`);n.className=`rqd-reply-header`;let r=document.createElement(`span`);r.textContent=e.authorName,e.isStaff&&(r.className=`rqd-reply-staff`),n.appendChild(r);let i=document.createElement(`span`);i.textContent=new Date(e.createdAt).toLocaleString(),n.appendChild(i),t.appendChild(n);let a=document.createElement(`div`);a.className=`rqd-reply-body`,a.textContent=e.body,t.appendChild(a),l.appendChild(t)}let u=document.createElement(`div`);u.className=`rqd-form-group`,u.style.marginTop=`12px`;let d=document.createElement(`textarea`);d.className=`rqd-textarea`,d.placeholder=e(`tracker.replyPlaceholder`),d.rows=3,u.appendChild(d),l.appendChild(u);let f=document.createElement(`button`);f.className=`rqd-btn rqd-btn-primary`,f.textContent=e(`tracker.sendReply`),f.addEventListener(`click`,async()=>{let n=d.value.trim();if(n){f.disabled=!0,f.textContent=e(`tracker.sending`);try{await r(t,n),p(t)}catch(t){o(t),f.disabled=!1,f.textContent=e(`tracker.sendReply`)}}}),l.appendChild(f)}).catch(e=>{a.remove(),o(e)})}function m(){for(u=`new`,h();l.firstChild;)l.removeChild(l.firstChild);let t=document.createElement(`button`);t.className=`rqd-btn rqd-btn-secondary`,t.textContent=e(`tracker.back`),t.style.marginBottom=`12px`,t.addEventListener(`click`,f),l.appendChild(t);let n={};function r(e,t,r,i){let a=document.createElement(`div`);a.className=`rqd-form-group`;let o=document.createElement(`label`);o.className=`rqd-label`,o.textContent=r,a.appendChild(o);let s=t===`textarea`?document.createElement(`textarea`):document.createElement(`input`);s.className=t===`textarea`?`rqd-textarea`:`rqd-input`,s.placeholder=i,s.name=e,a.appendChild(s),n[e]=s,l.appendChild(a)}r(`title`,`input`,e(`form.title`),e(`form.titlePlaceholder`)),r(`description`,`textarea`,e(`form.description`),e(`form.descriptionPlaceholder`));let c=document.createElement(`button`);c.className=`rqd-btn rqd-btn-primary`,c.textContent=e(`form.submit`),c.addEventListener(`click`,async()=>{let t=n.title.value.trim();if(!t||t.length<5)return;c.disabled=!0,c.textContent=e(`form.submitting`);let r={title:t,description:n.description.value.trim()||void 0,email:``,priority:`medium`};try{a(await s(i,r)),f()}catch(t){o(t),c.disabled=!1,c.textContent=e(`form.submit`)}}),l.appendChild(c)}function h(){d&&=(clearInterval(d),void 0)}return f(),l}let N={en:u,ar:d},P={},F=null,I=!1,L=`en`,R=null,z=null,B=null,V=`form`,H;function U(e){let t=F?.translations;return t?.[e]?t[e]:(N[L]??N.en)[e]??e}function W(e,t){for(let n of P[e]??[])try{n(t)}catch{}}function G(){return window.location.origin}function K(){return`_current`}function q(){if(!B||!F)return;for(;B.firstChild;)B.removeChild(B.firstChild);let e=F.position??`bottom-right`;if(F.inline){let e=typeof F.container==`string`?document.querySelector(F.container):F.container;if(e){let t=document.createElement(`div`);t.className=`rqd-inline`,t.style.cssText=m(F.theme);let n=document.createElement(`div`);n.className=`rqd-body`,Y(n),t.appendChild(n),e.appendChild(t);return}}else{z=document.createElement(`div`),z.className=`rqd-panel rqd-${e}`,z.style.cssText=m(F.theme);let t=document.createElement(`div`);t.className=`rqd-header`;let n=document.createElement(`span`);n.className=`rqd-header-title`,n.textContent=U(`widget.title`),t.appendChild(n);let r=document.createElement(`button`);r.className=`rqd-header-close`,r.textContent=`✕`,r.addEventListener(`click`,Q),t.appendChild(r),z.appendChild(t);let i=document.createElement(`div`);if(i.className=`rqd-body`,F.widget===`support-portal`&&F.customer?.email)ce(i);else{let e=document.createElement(`div`);e.className=`rqd-tabs`;let t=document.createElement(`button`);t.className=`rqd-tab${V===`form`?` rqd-active`:``}`,t.textContent=U(`widget.newTicket`),t.addEventListener(`click`,()=>J(`form`,i,e));let n=document.createElement(`button`);n.className=`rqd-tab${V===`tracker`?` rqd-active`:``}`,n.textContent=U(`widget.trackTicket`),n.addEventListener(`click`,()=>J(`tracker`,i,e)),e.appendChild(t),e.appendChild(n),z.appendChild(e),V===`form`?Y(i):X(i)}z.appendChild(i),B.appendChild(z)}}function ce(e){if(!F)return;let t=se(U,async()=>[],async e=>({id:e,ticketNumber:``,title:``,status:``,priority:``,createdAt:``,replies:[]}),async(e,t)=>{},K(),e=>W(`ticket:created`,e),e=>W(`error`,e),3e4);e.appendChild(t)}function J(e,t,n){for(V=e,H=void 0,n.querySelectorAll(`.rqd-tab`).forEach((t,n)=>{t.classList.toggle(`rqd-active`,n===0&&e===`form`||n===1&&e===`tracker`)});t.firstChild;)t.removeChild(t.firstChild);e===`form`?Y(t):X(t)}function Y(e){if(!F)return;let t=ie(K(),U,t=>{W(`ticket:created`,t),le(e,t)},e=>{W(`error`,e)});e.appendChild(t)}function X(e){let t=oe(U,e=>W(`ticket:tracked`,e),e=>W(`reply:sent`,e),e=>W(`error`,e),void 0,H);e.appendChild(t)}function le(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);let n=ae(t,U,()=>Q(),t.trackingToken?()=>{if(H=t.trackingToken,z){let e=z.querySelector(`.rqd-body`),t=z.querySelector(`.rqd-tabs`);e&&t&&J(`tracker`,e,t)}}:void 0);e.appendChild(n)}function ue(e){if(F)return;let t=O(e.apiKey);if(F={...e,position:e.position??t?.position??`bottom-right`,language:e.language??t?.language??`en`,widget:e.widget??t?.widget??`ticket-form`,theme:{...t?.theme,...e.theme}},L=F.language??`en`,D(e.apiKey,{position:F.position,language:F.language,widget:F.widget,theme:F.theme}),i(G(),e.apiKey),e.inline){q();return}let{mount:n}=v({zIndex:e.theme?.zIndex});B=n;let r=y();if(r){let t=r.querySelector(`.rqd-root`);t&&(t.style.cssText=m(e.theme))}let a=document.getElementById(`reqdesk-widget`);a&&L===`ar`&&a.setAttribute(`dir`,`rtl`),E(e.apiKey).length>0&&(V=`tracker`),R=re(e.position??`bottom-right`,$),B.appendChild(R)}function Z(){!F||I||(I=!0,R&&S(R,!0),q(),W(`open`))}function Q(){I&&(I=!1,R&&S(R,!1),z&&=(z.remove(),null),W(`close`))}function $(){I?Q():Z()}function de(e){L=e,F&&(F.language=e,D(F.apiKey,{language:e}));let t=document.getElementById(`reqdesk-widget`);t&&t.setAttribute(`dir`,e===`ar`?`rtl`:`ltr`),I&&z&&B&&(z.remove(),z=null,q())}function fe(e){F&&(F.theme={...F.theme,...e},D(F.apiKey,{theme:F.theme}),z&&(z.style.cssText=m(F.theme)))}function pe(e,t){P[e]||(P[e]=[]),P[e].push(t)}function me(e){F&&(F.customer=e)}function he(){Q(),ne(),F=null,R=null,z=null,B=null,I=!1;for(let e of Object.keys(P))delete P[e]}return e.close=Q,e.destroy=he,e.identify=me,e.init=ue,e.on=pe,e.open=Z,e.setLanguage=de,e.setTheme=fe,e.toggle=$,e})({},ofetch);