your-ai-workflow-firebase-os 2.0.8 → 2.0.9
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.
- package/dist/{Assets-Dd_96avv.js → Assets-COH4Ji57.js} +5 -5
- package/dist/{Assets-CBBNIHrw.cjs → Assets-D7fDckSi.cjs} +1 -1
- package/dist/{Attachments-C6QrTcNt.cjs → Attachments-BMuQ0CD4.cjs} +1 -1
- package/dist/{Attachments-YyjQmhBx.js → Attachments-Co1UkdWB.js} +2 -2
- package/dist/{Billing-B6f49cGH.cjs → Billing-DkuJdls5.cjs} +1 -1
- package/dist/{Billing-BZafAizg.js → Billing-kk4ZMd3z.js} +4 -4
- package/dist/{BookingCalendar-DYsA71vl.cjs → BookingCalendar-BcvJiyaq.cjs} +1 -1
- package/dist/{BookingCalendar-_xoRa2tL.js → BookingCalendar-Bej__mIs.js} +1 -1
- package/dist/{Button-DSldWACF.js → Button-BGN6q7lY.js} +1 -1
- package/dist/{Button-PyTaaoyu.cjs → Button-Ccy4wFZ1.cjs} +1 -1
- package/dist/{ConfirmModal-CQ73WYUg.cjs → ConfirmModal-BUNtss4a.cjs} +1 -1
- package/dist/{ConfirmModal-C1dM-bzk.js → ConfirmModal-BW9e6Y7d.js} +3 -3
- package/dist/{ContactPopup-D5Hh0bfE.cjs → ContactPopup-D8aSSlmS.cjs} +1 -1
- package/dist/{ContactPopup-CL4AMwK9.js → ContactPopup-Fs7wzrOX.js} +7 -7
- package/dist/{CopyLink-BnYpVy6H.cjs → CopyLink-C5lKLyOU.cjs} +1 -1
- package/dist/{CopyLink-rLr_5eNM.js → CopyLink-CNjDLzOl.js} +2 -2
- package/dist/{DashboardNav-B0G943ux.js → DashboardNav-CEd8gGPm.js} +3 -3
- package/dist/{DashboardNav-DOl9gJuu.cjs → DashboardNav-GgEUpyTa.cjs} +1 -1
- package/dist/{EmailAdmin-CWHMMybh.cjs → EmailAdmin-d_gWd48U.cjs} +1 -1
- package/dist/{EmailAdmin-humrSTzI.js → EmailAdmin-pbQ-f9Ge.js} +9 -9
- package/dist/{EventCard-CrPswwyG.js → EventCard-BSGLYD64.js} +2 -2
- package/dist/{EventCard-6eCfvOA-.cjs → EventCard-DAsGsicK.cjs} +1 -1
- package/dist/{FileViewerPopup-DQmhXMSg.cjs → FileViewerPopup-CkLUYCNo.cjs} +1 -1
- package/dist/{FileViewerPopup-Dnl3td2o.js → FileViewerPopup-gqhRT22v.js} +2 -2
- package/dist/{FormNote-BWGLs9lx.js → FormNote-DJ9HBokL.js} +1 -1
- package/dist/{FormNote-CX2rSBDB.cjs → FormNote-DP0GK9ya.cjs} +1 -1
- package/dist/{FormsAdmin-Tg20B0iA.cjs → FormsAdmin-5KTTp6zo.cjs} +1 -1
- package/dist/{FormsAdmin-CHwmKnYU.js → FormsAdmin-BNI63vEk.js} +9 -9
- package/dist/{Inbox-Cgq4MALU.js → Inbox-D9Y5K8Se.js} +9 -9
- package/dist/{Inbox-BPwIiThg.cjs → Inbox-DjslBakx.cjs} +1 -1
- package/dist/{Loader-DP_dL5qC.js → Loader-CVoz1Zf0.js} +1 -1
- package/dist/{Loader-p3eNQDUU.cjs → Loader-QHqQsXLr.cjs} +1 -1
- package/dist/{ManagePlanButton-BRW7Sevd.cjs → ManagePlanButton-Buwfs2bU.cjs} +1 -1
- package/dist/{ManagePlanButton-CNLCxK-o.js → ManagePlanButton-CE4uyh_7.js} +2 -2
- package/dist/{MyBookings-C_pqsSEk.js → MyBookings-B4DndHV6.js} +7 -7
- package/dist/{MyBookings-BC5sn_fE.cjs → MyBookings-CkEioQIj.cjs} +1 -1
- package/dist/{PageTitle-DFGW71q8.js → PageTitle-DCoUQWw6.js} +2 -2
- package/dist/{PageTitle-BWmE74WQ.cjs → PageTitle-DQkvCB11.cjs} +1 -1
- package/dist/PagesAdmin-D0qgoZtW.js +3 -0
- package/dist/{PagesAdmin-jjnDLYmF.js → PagesAdmin-DzLJWKBJ.js} +21 -21
- package/dist/PagesAdmin-KUxCI1Mr.cjs +1 -0
- package/dist/{PagesAdmin-BZZ3by92.cjs → PagesAdmin-YdYgmuEB.cjs} +1 -1
- package/dist/{PaymentsAdmin-CI0zXraR.cjs → PaymentsAdmin-B5l-f0mp.cjs} +1 -1
- package/dist/{PaymentsAdmin-DeBMmFFo.js → PaymentsAdmin-C3cEOeIs.js} +15 -15
- package/dist/{Popup-DmPEk98h.js → Popup-Bi63lzoS.js} +1 -1
- package/dist/{Popup-nq7YNM4N.cjs → Popup-COnHpbrY.cjs} +1 -1
- package/dist/{ProviderMark-DJ5mYjYn.cjs → ProviderMark--adeeajP.cjs} +1 -1
- package/dist/{ProviderMark-CAeOnBsB.js → ProviderMark-BvEMlZAm.js} +1 -1
- package/dist/{PublishApp-mMMwf_in.js → PublishApp-B9Fo6xN0.js} +7 -7
- package/dist/{PublishApp-DI96gX9b.cjs → PublishApp-Bc82Ijkq.cjs} +1 -1
- package/dist/{Said-DAD7Ctp_.js → Said-BvSRaEfZ.js} +1 -1
- package/dist/{Said-DlJOjNMN.cjs → Said-W3KFi5uX.cjs} +1 -1
- package/dist/{ScheduleAdmin-dWj_N_tf.cjs → ScheduleAdmin-Dh_hW6p4.cjs} +1 -1
- package/dist/{ScheduleAdmin-C4W8Ls0D.js → ScheduleAdmin-bk3GgxKP.js} +14 -14
- package/dist/{SchedulePicker-CwKId9JF.cjs → SchedulePicker-CN0755Ek.cjs} +1 -1
- package/dist/{SchedulePicker-BOSJEcfL.js → SchedulePicker-DO4PewPJ.js} +2 -2
- package/dist/{Setup-DcZzh6Xd.cjs → Setup-R4r6_tbV.cjs} +1 -1
- package/dist/{Setup-NOvtplUS.js → Setup-_G-s5y5Q.js} +3 -3
- package/dist/{SetupPayments-DrXK0LQa.js → SetupPayments-CkolcOtv.js} +5 -5
- package/dist/{SetupPayments-CZ0KqXdR.cjs → SetupPayments-CuFk9REC.cjs} +1 -1
- package/dist/{SignInAdmin-CwIUAJrv.cjs → SignInAdmin-B1yLLaQu.cjs} +1 -1
- package/dist/{SignInAdmin-Cb65ChHL.js → SignInAdmin-BLEn0rId.js} +9 -9
- package/dist/{SupportBar-528kXe-Z.js → SupportBar-DI_XbEsG.js} +4 -4
- package/dist/{SupportBar-CNVXSYwT.cjs → SupportBar-DLWruzQb.cjs} +1 -1
- package/dist/{SystemTabContent-EegzTuLd.cjs → SystemTabContent-BWhRHoXx.cjs} +1 -1
- package/dist/{SystemTabContent-C4azXKMs.js → SystemTabContent-CMyT7mDN.js} +2 -2
- package/dist/{TemplateDrive-XDRPkxIj.cjs → TemplateDrive-BJN-ReA_.cjs} +1 -1
- package/dist/{TemplateDrive-CfPXKMKX.js → TemplateDrive-DNBwL0oy.js} +10 -10
- package/dist/{ThemeAdmin-XLbC9fX7.js → ThemeAdmin-Cnqefrz6.js} +6 -6
- package/dist/ThemeAdmin-CoE_c5-P.cjs +1 -0
- package/dist/ThemeAdmin-DI7QaZ-0.js +2 -0
- package/dist/{ThemeAdmin-BrEozdpZ.cjs → ThemeAdmin-DkgmjW3g.cjs} +1 -1
- package/dist/TimeZoneField-Ckn1pKAL.cjs +11 -0
- package/dist/{TimeZoneField-Dv389mAe.js → TimeZoneField-oIMwb5_X.js} +119 -107
- package/dist/{TransactionsAdmin-X-NjI4NB.js → TransactionsAdmin-Brs-CEcG.js} +11 -11
- package/dist/{TransactionsAdmin-DgsG629u.cjs → TransactionsAdmin-C5wQRR1g.cjs} +1 -1
- package/dist/{Trouble-qjWYeKzC.js → Trouble-CtFq7tjk.js} +1 -1
- package/dist/{Trouble-DokPNHQZ.cjs → Trouble-KQZyf6aY.cjs} +1 -1
- package/dist/{Users-BEjl_Vjc.cjs → Users-B16L9cKI.cjs} +1 -1
- package/dist/{Users-BUGb7-Kz.js → Users-CbI4K_Le.js} +15 -15
- package/dist/{VideoPlayer-BVOkrJBR.cjs → VideoPlayer-CggwpVXH.cjs} +1 -1
- package/dist/{VideoPlayer-DB0oz6lM.js → VideoPlayer-QI1Jc3bS.js} +1 -1
- package/dist/appIcons-C90OKlV5.cjs +130 -0
- package/dist/{appIcons-CUXAX_gJ.js → appIcons-CCArfCDe.js} +761 -735
- package/dist/{arrivalRoads-BZk39p8Z.js → arrivalRoads-CGXm9Ntm.js} +0 -0
- package/dist/{arrivalRoads-CD7pt03E.cjs → arrivalRoads-Cc6AZM-d.cjs} +0 -0
- package/dist/{bookingPages-BxqkyZ-M.js → bookingPages-BFSY3Riv.js} +1 -1
- package/dist/{bookingPages-2fn9xPiA.cjs → bookingPages-Dx1ViiwW.cjs} +1 -1
- package/dist/{contentFallback-C6xLwXTs.js → contentFallback-BGGpI1Ts.js} +2 -2
- package/dist/{contentFallback-DLm_iHo9.cjs → contentFallback-DVCrIUvK.cjs} +1 -1
- package/dist/{email-DxxovRtf.js → email-PBHbXXgR.js} +1 -1
- package/dist/{email-DD48BP42.cjs → email-Sya6gl4F.cjs} +1 -1
- package/dist/lib/basket.d.ts +29 -9
- package/dist/lib/recordPrice.d.ts +1 -1
- package/dist/{notices-Cwon5Q0Y.cjs → notices-CKm9-Pqt.cjs} +1 -1
- package/dist/{notices-C4yqYzBw.js → notices-CysS7BLF.js} +1 -1
- package/dist/{ownerMail-CGmDk7aP.cjs → ownerMail-BS9SjJ2u.cjs} +1 -1
- package/dist/{ownerMail-Chzy5Ehy.js → ownerMail-DepG5-Qw.js} +2 -2
- package/dist/{pageFiles-BClshvXs.cjs → pageFiles-Cn0YQ4Ur.cjs} +1 -1
- package/dist/{pageFiles-D-GYqRgZ.js → pageFiles-ZFPSCDZz.js} +1 -1
- package/dist/{paidInFull-KuStok9_.cjs → paidInFull-CZywIs-V.cjs} +1 -1
- package/dist/{paidInFull-D14Eh0QV.js → paidInFull-mBOh9iwN.js} +1 -1
- package/dist/{paidSessions-Cr_93LGa.js → paidSessions-B8e5RHi4.js} +7 -7
- package/dist/{paidSessions-QXv7SHeb.cjs → paidSessions-D-zHC4oG.cjs} +1 -1
- package/dist/{people-D8nPPMlM.cjs → people-BwWVVLfy.cjs} +1 -1
- package/dist/{people-sk2DcHPi.js → people-Wk2opW4G.js} +1 -1
- package/dist/{publishSteps-DB1Hxr6H.js → publishSteps-Cf5pSB_H.js} +1 -1
- package/dist/{publishSteps-CaZRpC3C.cjs → publishSteps-DvWlF0p_.cjs} +1 -1
- package/dist/{recordLock-Dnz61J-_.js → recordLock-CMOiezNC.js} +1 -1
- package/dist/{recordLock-CLUp3QNh.cjs → recordLock-CiulizO1.cjs} +1 -1
- package/dist/{recordsKey-R5BjLoGQ.cjs → recordsKey-C4E2vOti.cjs} +1 -1
- package/dist/{recordsKey-DHJJWWOo.js → recordsKey-Cd216nq1.js} +2 -2
- package/dist/{registrationFields-COv8jW4n.cjs → registrationFields-DHHTptcl.cjs} +1 -1
- package/dist/{registrationFields-CeTZSerx.js → registrationFields-DdHoMPAQ.js} +1 -1
- package/dist/renderer.cjs.js +1 -1
- package/dist/renderer.es.js +1 -1
- package/dist/{roles-5juCr5sY.cjs → roles-BBDIJzox.cjs} +1 -1
- package/dist/{roles-hzcMnn_M.js → roles-DiwP6-WQ.js} +3 -3
- package/dist/{scheduleData-BpkfnBjP.cjs → scheduleData-BXjNXVHY.cjs} +1 -1
- package/dist/{scheduleData-BLCUm84s.js → scheduleData-DR6A-Q7Z.js} +1 -1
- package/dist/server.cjs.js +1 -1
- package/dist/server.es.js +1 -1
- package/dist/{serviceStatus-5sk8MPjW.js → serviceStatus-C9izcuQz.js} +2 -2
- package/dist/{serviceStatus-1pGLLilF.cjs → serviceStatus-Cde96_OO.cjs} +1 -1
- package/dist/{serviceSwitches-BWnZBooS.js → serviceSwitches-CZHwvVfP.js} +1 -1
- package/dist/{serviceSwitches-Do_pkFCu.cjs → serviceSwitches-mhJbQBrV.cjs} +1 -1
- package/dist/vite.cjs.js +1 -1
- package/dist/vite.es.js +1 -1
- package/dist/your-ai-workflow-firebase-os.cjs.js +8 -8
- package/dist/your-ai-workflow-firebase-os.css +1 -1
- package/dist/your-ai-workflow-firebase-os.es.js +358 -316
- package/package.json +1 -1
- package/src/index.css +41 -6
- package/dist/PagesAdmin-B-XopEi9.js +0 -3
- package/dist/PagesAdmin-nL5ZltFn.cjs +0 -1
- package/dist/ThemeAdmin-CwCiTp2I.js +0 -2
- package/dist/ThemeAdmin-Db5edTYj.cjs +0 -1
- package/dist/TimeZoneField-zR8N2Fj0.cjs +0 -11
- package/dist/appIcons-BNovDw6_.cjs +0 -130
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { t as e } from "./PageTitle-
|
|
2
|
-
import { Ft as t, I as n, O as r, Ot as i, h as a, ii as o, nt as s, o as c, rt as l, tt as u, ui as d, w as f } from "./TimeZoneField-
|
|
3
|
-
import { t as p } from "./DashboardNav-
|
|
1
|
+
import { t as e } from "./PageTitle-DCoUQWw6.js";
|
|
2
|
+
import { Ft as t, I as n, O as r, Ot as i, h as a, ii as o, nt as s, o as c, rt as l, tt as u, ui as d, w as f } from "./TimeZoneField-oIMwb5_X.js";
|
|
3
|
+
import { t as p } from "./DashboardNav-CEd8gGPm.js";
|
|
4
4
|
import { wn as m } from "./schedule-C13m_kiO.js";
|
|
5
5
|
import { t as h } from "./chevron-down--LwXEv9w.js";
|
|
6
|
-
import { t as g } from "./SupportBar-
|
|
7
|
-
import { t as _ } from "./FileViewerPopup-
|
|
8
|
-
import { t as v } from "./FormNote-
|
|
6
|
+
import { t as g } from "./SupportBar-DI_XbEsG.js";
|
|
7
|
+
import { t as _ } from "./FileViewerPopup-gqhRT22v.js";
|
|
8
|
+
import { t as v } from "./FormNote-DJ9HBokL.js";
|
|
9
9
|
import { t as y } from "./trash-6Wj66gJi.js";
|
|
10
|
-
import { t as b } from "./Loader-
|
|
10
|
+
import { t as b } from "./Loader-CVoz1Zf0.js";
|
|
11
11
|
import { a as x, d as S, f as C, l as w, n as T, r as E, s as D, t as O, u as k } from "./transactions-ycKW6zHa.js";
|
|
12
|
-
import { t as ee } from "./ConfirmModal-
|
|
12
|
+
import { t as ee } from "./ConfirmModal-BW9e6Y7d.js";
|
|
13
13
|
import { n as A } from "./soldLines-Ci-FLIrS.js";
|
|
14
|
-
import { r as j, t as M } from "./paidInFull-
|
|
14
|
+
import { r as j, t as M } from "./paidInFull-mBOh9iwN.js";
|
|
15
15
|
import { t as te } from "./openOnArrival-CtSqdQ8L.js";
|
|
16
|
-
import { i as N } from "./serviceStatus-
|
|
17
|
-
import { t as P } from "./Attachments-
|
|
16
|
+
import { i as N } from "./serviceStatus-C9izcuQz.js";
|
|
17
|
+
import { t as P } from "./Attachments-Co1UkdWB.js";
|
|
18
18
|
import { Fragment as ne, useCallback as F, useEffect as I, useMemo as L, useRef as R, useState as z } from "react";
|
|
19
19
|
import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
|
|
20
20
|
import { collection as U, deleteDoc as re, doc as W, getDoc as ie, getDocs as ae, limit as G, onSnapshot as oe, orderBy as K, query as q, startAfter as se, where as ce } from "firebase/firestore";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk-CiTBaPhY.cjs`);const e=require(`./PageTitle-BWmE74WQ.cjs`),t=require(`./TimeZoneField-zR8N2Fj0.cjs`),n=require(`./DashboardNav-DOl9gJuu.cjs`),r=require(`./schedule-BAea6q8_.cjs`),i=require(`./chevron-down-lyDK1rfL.cjs`),a=require(`./SupportBar-CNVXSYwT.cjs`),o=require(`./FileViewerPopup-DQmhXMSg.cjs`),s=require(`./FormNote-CX2rSBDB.cjs`),c=require(`./trash-D-CpYHCs.cjs`),l=require(`./Loader-p3eNQDUU.cjs`),u=require(`./transactions-CIU2NcKh.cjs`),d=require(`./ConfirmModal-CQ73WYUg.cjs`),f=require(`./soldLines-BGtA9Oub.cjs`),p=require(`./paidInFull-KuStok9_.cjs`),m=require(`./openOnArrival-FiXqw4WM.cjs`),h=require(`./serviceStatus-1pGLLilF.cjs`),g=require(`./Attachments-C6QrTcNt.cjs`);let _=require(`react`),v=require(`react/jsx-runtime`),y=require(`firebase/firestore`),b=require(`react-router-dom`);function x(e,n){let[r,i]=(0,_.useState)({}),[a,o]=(0,_.useState)({}),[s,c]=(0,_.useState)({}),[l,d]=(0,_.useState)({}),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)({}),g=(0,_.useRef)(new Set);(0,_.useEffect)(()=>{let n=u.t.map(n=>(0,y.onSnapshot)(e?(0,y.query)((0,y.collection)(t.ui,n),(0,y.where)(`transaction`,`==`,!0)):(0,y.query)((0,y.collection)(t.ui,n),(0,y.orderBy)(`submittedAt`,`desc`),(0,y.limit)(100)),t=>{let r=!e&&t.docs.length>=100;i(e=>({...e,[n]:S(t.docs,n)})),o(e=>({...e,[n]:{more:r,last:r?t.docs[t.docs.length-1]:null}})),c(e=>e[n]?{...e,[n]:``}:e)},e=>{c(r=>({...r,[n]:t.ii(e,`The orders could not be read.`)})),o(e=>({...e,[n]:{more:!1,last:null}}))}));return()=>n.forEach(e=>e())},[e]);let v=(0,_.useMemo)(()=>{let e=new Set,t=[],n=n=>{let r=`${n.collection}:${n.id}`;e.has(r)||(e.add(r),t.push(n))};for(let e of u.t)(r[e]||[]).forEach(n);for(let e of u.t)(l[e]?.rows||[]).forEach(n);return Object.values(m).forEach(n),t},[r,l,m]),b=u.t.some(e=>!a[e]);(0,_.useEffect)(()=>{if(b)return;let e=new Set(v.map(e=>e.id));for(let r of n)e.has(r)||g.current.has(r)||(g.current.add(r),(async()=>{for(let e of u.t)try{let n=await(0,y.getDoc)((0,y.doc)(t.ui,e,r));if(!n.exists())continue;let[i]=S([n],e);i&&h(e=>({...e,[r]:i}));return}catch{}})())},[b,n,v]);let x=e=>l[e]||a[e]||{more:!1,last:null},C=async()=>{p(!0);try{await Promise.all(u.t.map(async e=>{let n=x(e);if(!n.more||!n.last)return;let i=await(0,y.getDocs)((0,y.query)((0,y.collection)(t.ui,e),(0,y.orderBy)(`submittedAt`,`desc`),(0,y.startAfter)(n.last),(0,y.limit)(100))),a=i.docs.length>=100,o=S(i.docs,e);d(t=>({...t,[e]:{rows:[...t[e]?.rows||r[e]||[],...o],more:a,last:a?i.docs[i.docs.length-1]:null}}))})),c(e=>e.older?{...e,older:``}:e)}catch(e){c(n=>({...n,older:t.ii(e,`The older orders could not be read.`)}))}p(!1)},w=(0,_.useCallback)((e,t)=>{d(n=>n[e]?{...n,[e]:{...n[e],rows:n[e].rows.filter(e=>e.id!==t)}}:n),h(n=>{if(n[t]?.collection!==e)return n;let r={...n};return delete r[t],r})},[]),E=Math.max(0,...u.t.map(e=>{let t=x(e);return t.more&&t.last?T(t.last.data()):0}));return{entries:v,loading:b,error:Object.values(s).find(Boolean)||``,more:u.t.some(e=>x(e).more),reachedBack:E,loadingOlder:f,loadOlder:C,forget:w}}var S=(e,t)=>e.map(e=>({...e.data(),id:e.id,collection:t})).filter(u.a),C=[`orderEntryId`,`entryId`,`orderId`,`submissionId`,`entry`,`order`],w=e=>{for(let t of C){let n=String(e?.[t]??``).trim();if(/^[A-Za-z0-9_-]{1,128}$/.test(n))return n}return``},T=e=>{let t=e?.submittedAt;if(!t)return 0;if(typeof t.toMillis==`function`)return t.toMillis();if(typeof t.toDate==`function`)return t.toDate().getTime();let n=new Date(t).getTime();return Number.isNaN(n)?0:n};function E(e){let{user:n}=t.Ft(),r=(0,_.useRef)(n);(0,_.useEffect)(()=>{r.current=n},[n]);let i=n?.uid||``,[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)({charges:null,subscriptions:null}),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(!1),b=(0,_.useCallback)(async(e,t)=>{let n=r.current,i=n?await n.getIdToken():``,a=await fetch(e,{...t,headers:{...t?.body?{"Content-Type":`application/json`}:{},...i?{Authorization:`Bearer ${i}`}:{}}}),o=await a.json().catch(()=>({}));if(!a.ok||o?.success===!1)throw Error(o?.error||`The server could not answer.`);return o},[]),x=(0,_.useCallback)((e,t)=>{let n=e.charges||[],r=e.subscriptions||[];o(e=>t?[...e,...n]:n),c(e=>t?[...e,...r]:r),g(!!(e.chargesHasMore||e.subscriptionsHasMore)),u(i=>{let a={charges:e.chargesAfter||n[n.length-1]?.id||(t?i.charges:null),subscriptions:e.subscriptionsAfter||r[r.length-1]?.id||(t?i.subscriptions:null)};return a.charges===i.charges&&a.subscriptions===i.subscriptions?i:a})},[]);(0,_.useEffect)(()=>{if(!e||!i)return;let t=!1;return b(`/api/payments/orders`).then(e=>{t||(x(e,!1),m(``),f(!0))}).catch(e=>{t||(m(e.message),f(!0))}),()=>{t=!0}},[e,i,b,x]);let S=async()=>{y(!0);try{let e=new URLSearchParams;l.charges&&e.set(`starting_after`,l.charges),l.subscriptions&&e.set(`subscriptions_after`,l.subscriptions),x(await b(`/api/payments/orders?${e}`),!0),m(``)}catch(e){m(e.message)}y(!1)},C=(0,_.useCallback)((e,t)=>{e===`charge`?o(e=>e.filter(e=>e.id!==t)):c(e=>e.filter(e=>e.id!==t))},[]);return{orders:(0,_.useMemo)(()=>[...a,...s],[a,s]),loaded:d,error:p,hasMore:h,loadingMore:v,loadMore:S,authed:b,drop:C}}var D=e=>e?new Date(e).toLocaleString(void 0,{day:`numeric`,month:`short`,year:`numeric`,hour:`numeric`,minute:`2-digit`}):``,O=e=>e?new Date(e).toLocaleDateString(void 0,{day:`numeric`,month:`short`,year:`numeric`}):``;function k(e){let t=e.order,n=[];if(e.at){let r=t?t.kind===`subscription`?`Started`:t.paid?`Paid on`:`Date`:`Sent on`;n.push({label:r,value:D(e.at)})}return t?.paidWith&&n.push({value:t.paidWith}),e.page&&n.push({label:`Sold on`,value:e.page}),t&&(t.amountRefunded||0)>0&&n.push({value:`${u.r(t.amountRefunded,t.currency)} refunded`}),t&&e.entry&&p.r(e.entry,t)&&n.push({value:`Paid less than this order says — do not send it`}),t&&e.entry&&p.t(e.entry,t)&&n.push({value:`Paid for other things than this order says — do not send it`}),n}var A=e=>/^(charge|subscription|entry):/.test(e)?e:e.startsWith(`sub_`)?`subscription:${e}`:`charge:${e}`,j=e=>e.order?e.order.kind===`subscription`?{title:`Delete this subscription?`,message:`It comes off this screen for good. The subscription itself stays in your Stripe account and keeps running — cancel it there if that is what you mean.`}:{title:`Delete this payment?`,message:`It comes off this screen for good. The payment itself stays in your Stripe account, and nothing is refunded.`}:{title:`Delete this order?`,message:`The order they started is deleted. Nothing was paid, so there is nothing in Stripe to keep.`},M=`grid grid-cols-[minmax(0,1fr)_auto_1rem] md:grid-cols-[minmax(0,1.5fr)_minmax(0,1.3fr)_6.5rem_7rem_8.5rem_1rem] items-center gap-x-3 md:gap-x-6 px-4 md:px-5`;function N({status:e,className:t=``}){return(0,v.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-[12.5px] font-medium text-foreground/60 leading-tight whitespace-nowrap ${t}`,children:[(0,v.jsx)(`span`,{"aria-hidden":`true`,className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.in?`bg-emerald-500`:`bg-foreground/25`}`}),e.label]})}var P=`text-[12.5px] font-semibold text-foreground/50 leading-tight mb-3`,F=`block text-[12px] font-medium text-foreground/45 leading-tight mb-0.5`,I=`text-[13.5px] text-foreground/85 leading-snug break-words [overflow-wrap:anywhere]`;function L({row:e}){let t=e.name||e.email||`Someone`,n=[];return e.email&&e.email!==t&&n.push([`Email`,e.email]),e.order?.phone&&n.push([`Phone`,e.order.phone]),e.order?.address&&n.push([`Delivery address`,e.order.address]),(0,v.jsxs)(`section`,{className:`min-w-0`,children:[(0,v.jsx)(`h3`,{className:P,children:`Who`}),(0,v.jsx)(`p`,{className:`text-[14px] font-semibold text-foreground leading-snug break-words [overflow-wrap:anywhere]`,children:t}),n.length>0&&(0,v.jsx)(`div`,{className:`flex flex-col gap-2.5 mt-3`,children:n.map(([e,t])=>(0,v.jsxs)(`p`,{className:`min-w-0`,children:[(0,v.jsx)(`span`,{className:F,children:e}),(0,v.jsx)(`span`,{className:`block ${I}`,children:t})]},e))})]})}function R({lines:e,onOpen:n}){return(0,v.jsxs)(`section`,{className:`min-w-0`,children:[(0,v.jsx)(`h3`,{className:P,children:`What they bought`}),(0,v.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map((e,r)=>{let i=(0,v.jsx)(`span`,{className:e.kind===`total`?`text-[13.5px] font-semibold text-foreground leading-snug`:e.kind===`extra`?`${I} text-foreground/60`:I,children:e.left});return(0,v.jsxs)(`div`,{className:`flex justify-between gap-4 ${e.picture?`items-center`:`items-baseline`} ${e.kind===`total`?`border-t border-[var(--panel-border)]/70 pt-2.5 mt-1`:``}`,children:[e.picture?(0,v.jsxs)(`span`,{className:`flex items-center gap-3 min-w-0`,children:[(0,v.jsx)(`button`,{type:`button`,onClick:()=>n({src:e.picture,name:e.left||`Picture`}),"aria-label":`Open the picture of ${e.left||`this`}`,title:e.left,className:`shrink-0 rounded-lg outline-none focus-visible:ring-2 focus-visible:ring-accent/50 hover:opacity-90 active:scale-[0.99] transition cursor-pointer`,children:(0,v.jsx)(t.O,{src:e.picture,alt:``,fit:`cover`,className:`w-10 h-10 rounded-lg border border-[var(--panel-border)]`})}),i]}):i,e.right&&(0,v.jsx)(`span`,{className:`text-[13.5px] tabular-nums whitespace-nowrap shrink-0 leading-snug ${e.kind===`total`?`font-semibold text-foreground`:`text-foreground/85`}`,children:e.right})]},r)})})]})}function z({pairs:e,currency:n,onOpen:r}){return(0,v.jsxs)(`section`,{className:`min-w-0`,children:[(0,v.jsx)(`h3`,{className:P,children:`What they told you`}),(0,v.jsx)(`dl`,{className:`grid grid-cols-1 sm:grid-cols-[minmax(0,11rem)_minmax(0,1fr)] gap-x-8 gap-y-1 sm:gap-y-2`,children:e.map(([e,i])=>{let a=u.n(e,i,n);return(0,v.jsxs)(_.Fragment,{children:[(0,v.jsx)(`dt`,{className:`text-[13px] text-foreground/50 leading-snug`,children:u.s(e)}),t.I(i)?(0,v.jsx)(`dd`,{className:`my-1 max-sm:mb-2.5`,children:(0,v.jsx)(g.t,{value:i,onOpen:r,className:`w-20 h-14`})}):(0,v.jsx)(`dd`,{className:`${I} max-sm:mb-2`,children:(a.length?a:[`—`]).map((e,t)=>(0,v.jsx)(`span`,{className:`block`,children:e},t))})]},e)})})]})}function B({row:e,open:n,onToggle:r,onDelete:a,onOpenFile:o}){let s=t.tt(),l=u.u(e),d=e.name||e.email||`Someone`,p=e.email&&e.email!==d?e.email:``,m=e.order?.currency||null,h=e.order?u.r(e.order.amount,e.order.currency):``,g=e.order?.kind===`subscription`&&e.order.interval?`/ ${e.order.interval}`:``,{bought:_,told:y}=u.d(e.collected.filter(([e])=>!f.n(e))),b=new Set([e.name,e.email,e.order?.phone,e.order?.address].filter(Boolean)),x=y.filter(([,e])=>!(typeof e==`string`&&b.has(e.trim()))),S=k(e),C=u.l(_,m);return e.order&&!C.some(e=>e.kind===`item`)&&C.unshift({left:e.what,right:g?`${h} ${g}`:h,kind:`item`}),(0,v.jsxs)(`div`,{"data-ledger-row":e.key,className:`scroll-mt-6 ${n?`bg-foreground/[0.02]`:``}`,children:[(0,v.jsxs)(`button`,{type:`button`,onClick:r,"aria-expanded":n,className:`w-full ${M} py-3 text-left cursor-pointer transition-colors hover:bg-foreground/[0.03]`,children:[(0,v.jsxs)(`span`,{className:`flex flex-col min-w-0 gap-0.5`,children:[(0,v.jsx)(`span`,{className:`text-[13.5px] font-bold text-foreground leading-tight truncate`,children:d}),(0,v.jsx)(`span`,{className:`md:hidden text-[12px] font-medium text-foreground/45 leading-tight truncate`,children:e.what}),p&&(0,v.jsx)(`span`,{className:`max-md:hidden text-[12px] font-medium text-foreground/45 leading-tight truncate`,children:p})]}),(0,v.jsxs)(`span`,{className:`max-md:hidden md:flex flex-col min-w-0 gap-0.5`,children:[(0,v.jsx)(`span`,{className:`text-[13px] font-medium text-foreground/80 leading-tight truncate`,children:e.what}),e.page&&(0,v.jsx)(`span`,{className:`text-[11.5px] font-medium text-foreground/40 leading-tight truncate`,children:e.page})]}),(0,v.jsx)(`span`,{className:`max-md:hidden text-[12.5px] font-medium text-foreground/45 tabular-nums whitespace-nowrap leading-tight`,children:O(e.at)}),(0,v.jsx)(N,{status:l,className:`max-md:hidden`}),(0,v.jsxs)(`span`,{className:`flex flex-col items-end gap-1 min-w-0`,children:[(0,v.jsxs)(`span`,{className:`text-[13.5px] font-semibold text-foreground tabular-nums whitespace-nowrap leading-tight`,children:[h||(0,v.jsx)(`span`,{className:`text-foreground/25 font-medium`,children:`—`}),g&&(0,v.jsxs)(`span`,{className:`text-[12.5px] text-foreground/40 font-medium`,children:[` `,g]})]}),(0,v.jsx)(N,{status:l,className:`md:hidden !text-[11.5px] !gap-1.5`})]}),(0,v.jsx)(i.t,{className:`w-4 h-4 text-foreground/35 shrink-0 justify-self-end transition-transform ${n?`rotate-180`:``}`})]}),(0,v.jsx)(t.rt,{initial:!1,children:n&&(0,v.jsx)(t.nt.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:s?{duration:0}:t.w,className:`overflow-hidden`,children:(0,v.jsxs)(`div`,{className:`mx-4 md:mx-5 pt-4 pb-5 md:pt-5 md:pb-6 border-t border-[var(--panel-border)]/50 flex flex-col gap-6`,children:[(0,v.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,v.jsx)(`div`,{className:`flex items-center flex-wrap gap-x-4 gap-y-1`,children:h?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`span`,{className:`text-2xl font-semibold tracking-tight text-foreground tabular-nums leading-none`,children:[h,g&&(0,v.jsxs)(`span`,{className:`text-[15px] font-medium text-foreground/45 tracking-normal`,children:[` `,g]})]}),(0,v.jsx)(N,{status:l,className:`!text-[13px]`})]}):(0,v.jsx)(`span`,{className:`text-lg font-semibold tracking-tight leading-none text-foreground/50`,children:l.label})}),S.length>0&&(0,v.jsx)(`p`,{className:`flex flex-wrap items-baseline gap-x-2 text-[13px] text-foreground/60 leading-snug`,children:S.map((e,t)=>(0,v.jsxs)(`span`,{className:`inline-flex flex-wrap gap-x-1`,children:[t>0&&(0,v.jsx)(`span`,{"aria-hidden":`true`,className:`text-foreground/30 mr-1`,children:`·`}),e.label&&(0,v.jsx)(`span`,{className:`text-foreground/45`,children:e.label}),(0,v.jsx)(`span`,{children:e.value})]},t))})]}),(0,v.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] gap-x-12 gap-y-6`,children:[(0,v.jsx)(L,{row:e}),C.length>0&&(0,v.jsx)(R,{lines:C,onOpen:o})]}),x.length>0&&(0,v.jsx)(z,{pairs:x,currency:m,onOpen:o}),C.length===0&&x.length===0&&(0,v.jsx)(`p`,{className:`text-[13px] text-foreground/40`,children:`Nothing was asked before paying.`}),(0,v.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[e.order?.receiptUrl?(0,v.jsxs)(`a`,{href:e.order.receiptUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-[13px] font-medium text-foreground/55 hover:text-accent transition-colors`,children:[`Stripe receipt`,(0,v.jsx)(t.Ot,{className:`w-3.5 h-3.5`})]}):(0,v.jsx)(`span`,{}),a&&(0,v.jsx)(t.o,{icon:c.t,tone:`danger`,compact:!0,title:`Delete this transaction`,onClick:a,children:`Delete`})]})]})})})]})}function V({rows:r,waiting:i,configured:c,error:u,hasMore:f,loadingMore:p,onLoadMore:h,onDelete:g,initialOpen:y=null,help:x=!1,focus:S=null,onFocused:C}){let[w,T]=(0,_.useState)(y),[E,D]=(0,_.useState)(null),[O,k]=(0,_.useState)(null),[N,P]=(0,_.useState)(!1),[F,I]=(0,_.useState)(``),L=S?A(S):null;m.t(L,!i&&!!L&&r.some(e=>e.key===L),T,C);let R=async()=>{if(!(!O||!g)){P(!0),I(``);try{await g(O),w===O.key&&T(null),k(null)}catch(e){I(t.ii(e,e?.message||`It could not be deleted.`))}P(!1)}},z=O?j(O):null;return(0,v.jsxs)(`main`,{className:`flex-1 w-full max-w-7xl mx-auto p-4 pt-2 md:p-8 md:pt-4 z-10 flex flex-col min-h-screen`,children:[(0,v.jsxs)(t.nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:`mb-6`,children:[(0,v.jsx)(e.t,{children:`Transactions`}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2 text-foreground/40 font-bold uppercase tracking-[0.2em] text-[11px]`,children:[(0,v.jsx)(`span`,{className:`w-8 h-[1px] bg-foreground/10`}),`/transactions`]})]}),(0,v.jsxs)(`div`,{className:`flex flex-col gap-6 flex-1 pb-16`,children:[(0,v.jsx)(n.t,{}),(0,v.jsx)(`div`,{className:`glass-panel border border-[var(--panel-border)] rounded-3xl p-4 sm:p-5 md:p-8 shadow-2xl relative bg-background flex flex-col fbos-tab-fill min-h-[400px] gap-4`,children:i?(0,v.jsx)(l.t,{block:!0,className:`flex-1`}):(0,v.jsxs)(v.Fragment,{children:[u&&(0,v.jsx)(t.h,{tone:`error`,children:u}),!c&&(0,v.jsxs)(t.h,{children:[`Stripe is not connected yet, so there is no money to show — connect it on the`,` `,(0,v.jsx)(b.Link,{to:`/payments`,className:`font-bold text-accent hover:underline`,children:`Payments`}),` screen and every payment lands here on its own.`]}),r.length===0&&f?(0,v.jsxs)(`div`,{className:`flex flex-col items-center justify-center flex-1 gap-3 py-16 text-center`,children:[(0,v.jsx)(`p`,{className:`text-[13px] font-medium text-foreground/50`,children:`Nothing recent.`}),(0,v.jsx)(t.o,{busy:p,onClick:h,children:`Show older payments`})]}):r.length===0?(0,v.jsx)(`div`,{className:`flex flex-col items-center justify-center flex-1 gap-3 py-16 text-center`,children:(0,v.jsx)(`p`,{className:`text-[13px] font-medium text-foreground/50 max-w-md leading-relaxed`,children:`Nothing yet. When somebody pays, or answers a payment’s form, it lands here on its own — with what they bought and everything they told the page beside it. A refund you make in Stripe shows here too.`})}):(0,v.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,v.jsxs)(`div`,{className:`rounded-2xl border border-[var(--panel-border)]/60 divide-y divide-[var(--panel-border)]/60 overflow-hidden`,children:[(0,v.jsxs)(`div`,{className:`max-md:hidden ${M} py-2.5 text-[11.5px] font-medium text-foreground/40`,children:[(0,v.jsx)(`span`,{children:`Who`}),(0,v.jsx)(`span`,{children:`What`}),(0,v.jsx)(`span`,{children:`When`}),(0,v.jsx)(`span`,{children:`Status`}),(0,v.jsx)(`span`,{className:`text-right`,children:`Amount`}),(0,v.jsx)(`span`,{})]}),r.map(e=>(0,v.jsx)(B,{row:e,open:w===e.key,onToggle:()=>T(t=>t===e.key?null:e.key),onDelete:g?()=>{I(``),k(e)}:void 0,onOpenFile:D},e.key))]}),f&&(0,v.jsx)(t.o,{busy:p,onClick:h,className:`self-center mt-1`,children:`Show older payments`})]})]})})]}),x&&(0,v.jsx)(a.t,{}),(0,v.jsx)(o.t,{open:!!E,onClose:()=>D(null),src:E?.src||``,name:E?.name}),(0,v.jsx)(d.t,{isOpen:!!O,title:z?.title||``,message:(0,v.jsxs)(v.Fragment,{children:[z?.message,F&&(0,v.jsx)(`span`,{className:`block mt-4 text-left`,children:(0,v.jsx)(s.t,{tone:`error`,children:F})})]}),confirmText:`Delete`,isProcessing:N,onConfirm:R,onCancel:()=>{N||k(null)}})]})}function H(){let{userRole:e}=t.Ft(),n=r.wn(e),{status:i,error:a}=h.i(),o=!!i?.configured,s=E(o),c=(0,_.useMemo)(()=>n?s.orders.map(e=>w(e.collected)).filter(Boolean):[],[n,s.orders]),l=x(!n,c),{entries:d,loading:f,error:p}=l,m=(0,_.useMemo)(()=>u.f(s.orders,d).filter(e=>e.order||e.at>=l.reachedBack),[s.orders,d,l.reachedBack]),g=!i&&!a||f||o&&!s.loaded,S=()=>{s.hasMore?s.loadMore():l.loadOlder()},[C,T]=(0,b.useSearchParams)();return(0,v.jsx)(V,{rows:m,waiting:g,configured:o,error:[s.error,p].filter(Boolean).join(` `),hasMore:s.hasMore||l.more,loadingMore:s.loadingMore||l.loadingOlder,onLoadMore:S,onDelete:n?async e=>{e.order&&await s.authed(`/api/payments/orders/remove`,{method:`POST`,body:JSON.stringify({kind:e.order.kind,id:e.order.id})}),e.entry?.collection&&(await(0,y.deleteDoc)((0,y.doc)(t.ui,e.entry.collection,e.entry.id)),l.forget(e.entry.collection,e.entry.id)),e.order&&s.drop(e.order.kind,e.order.id)}:void 0,help:n,focus:C.get(`open`),onFocused:()=>T(e=>{let t=new URLSearchParams(e);return t.delete(`open`),t},{replace:!0})})}exports.TransactionsAdmin=H;
|
|
1
|
+
require(`./chunk-CiTBaPhY.cjs`);const e=require(`./PageTitle-DQkvCB11.cjs`),t=require(`./TimeZoneField-Ckn1pKAL.cjs`),n=require(`./DashboardNav-GgEUpyTa.cjs`),r=require(`./schedule-BAea6q8_.cjs`),i=require(`./chevron-down-lyDK1rfL.cjs`),a=require(`./SupportBar-DLWruzQb.cjs`),o=require(`./FileViewerPopup-CkLUYCNo.cjs`),s=require(`./FormNote-DP0GK9ya.cjs`),c=require(`./trash-D-CpYHCs.cjs`),l=require(`./Loader-QHqQsXLr.cjs`),u=require(`./transactions-CIU2NcKh.cjs`),d=require(`./ConfirmModal-BUNtss4a.cjs`),f=require(`./soldLines-BGtA9Oub.cjs`),p=require(`./paidInFull-CZywIs-V.cjs`),m=require(`./openOnArrival-FiXqw4WM.cjs`),h=require(`./serviceStatus-Cde96_OO.cjs`),g=require(`./Attachments-BMuQ0CD4.cjs`);let _=require(`react`),v=require(`react/jsx-runtime`),y=require(`firebase/firestore`),b=require(`react-router-dom`);function x(e,n){let[r,i]=(0,_.useState)({}),[a,o]=(0,_.useState)({}),[s,c]=(0,_.useState)({}),[l,d]=(0,_.useState)({}),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)({}),g=(0,_.useRef)(new Set);(0,_.useEffect)(()=>{let n=u.t.map(n=>(0,y.onSnapshot)(e?(0,y.query)((0,y.collection)(t.ui,n),(0,y.where)(`transaction`,`==`,!0)):(0,y.query)((0,y.collection)(t.ui,n),(0,y.orderBy)(`submittedAt`,`desc`),(0,y.limit)(100)),t=>{let r=!e&&t.docs.length>=100;i(e=>({...e,[n]:S(t.docs,n)})),o(e=>({...e,[n]:{more:r,last:r?t.docs[t.docs.length-1]:null}})),c(e=>e[n]?{...e,[n]:``}:e)},e=>{c(r=>({...r,[n]:t.ii(e,`The orders could not be read.`)})),o(e=>({...e,[n]:{more:!1,last:null}}))}));return()=>n.forEach(e=>e())},[e]);let v=(0,_.useMemo)(()=>{let e=new Set,t=[],n=n=>{let r=`${n.collection}:${n.id}`;e.has(r)||(e.add(r),t.push(n))};for(let e of u.t)(r[e]||[]).forEach(n);for(let e of u.t)(l[e]?.rows||[]).forEach(n);return Object.values(m).forEach(n),t},[r,l,m]),b=u.t.some(e=>!a[e]);(0,_.useEffect)(()=>{if(b)return;let e=new Set(v.map(e=>e.id));for(let r of n)e.has(r)||g.current.has(r)||(g.current.add(r),(async()=>{for(let e of u.t)try{let n=await(0,y.getDoc)((0,y.doc)(t.ui,e,r));if(!n.exists())continue;let[i]=S([n],e);i&&h(e=>({...e,[r]:i}));return}catch{}})())},[b,n,v]);let x=e=>l[e]||a[e]||{more:!1,last:null},C=async()=>{p(!0);try{await Promise.all(u.t.map(async e=>{let n=x(e);if(!n.more||!n.last)return;let i=await(0,y.getDocs)((0,y.query)((0,y.collection)(t.ui,e),(0,y.orderBy)(`submittedAt`,`desc`),(0,y.startAfter)(n.last),(0,y.limit)(100))),a=i.docs.length>=100,o=S(i.docs,e);d(t=>({...t,[e]:{rows:[...t[e]?.rows||r[e]||[],...o],more:a,last:a?i.docs[i.docs.length-1]:null}}))})),c(e=>e.older?{...e,older:``}:e)}catch(e){c(n=>({...n,older:t.ii(e,`The older orders could not be read.`)}))}p(!1)},w=(0,_.useCallback)((e,t)=>{d(n=>n[e]?{...n,[e]:{...n[e],rows:n[e].rows.filter(e=>e.id!==t)}}:n),h(n=>{if(n[t]?.collection!==e)return n;let r={...n};return delete r[t],r})},[]),E=Math.max(0,...u.t.map(e=>{let t=x(e);return t.more&&t.last?T(t.last.data()):0}));return{entries:v,loading:b,error:Object.values(s).find(Boolean)||``,more:u.t.some(e=>x(e).more),reachedBack:E,loadingOlder:f,loadOlder:C,forget:w}}var S=(e,t)=>e.map(e=>({...e.data(),id:e.id,collection:t})).filter(u.a),C=[`orderEntryId`,`entryId`,`orderId`,`submissionId`,`entry`,`order`],w=e=>{for(let t of C){let n=String(e?.[t]??``).trim();if(/^[A-Za-z0-9_-]{1,128}$/.test(n))return n}return``},T=e=>{let t=e?.submittedAt;if(!t)return 0;if(typeof t.toMillis==`function`)return t.toMillis();if(typeof t.toDate==`function`)return t.toDate().getTime();let n=new Date(t).getTime();return Number.isNaN(n)?0:n};function E(e){let{user:n}=t.Ft(),r=(0,_.useRef)(n);(0,_.useEffect)(()=>{r.current=n},[n]);let i=n?.uid||``,[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)({charges:null,subscriptions:null}),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(!1),b=(0,_.useCallback)(async(e,t)=>{let n=r.current,i=n?await n.getIdToken():``,a=await fetch(e,{...t,headers:{...t?.body?{"Content-Type":`application/json`}:{},...i?{Authorization:`Bearer ${i}`}:{}}}),o=await a.json().catch(()=>({}));if(!a.ok||o?.success===!1)throw Error(o?.error||`The server could not answer.`);return o},[]),x=(0,_.useCallback)((e,t)=>{let n=e.charges||[],r=e.subscriptions||[];o(e=>t?[...e,...n]:n),c(e=>t?[...e,...r]:r),g(!!(e.chargesHasMore||e.subscriptionsHasMore)),u(i=>{let a={charges:e.chargesAfter||n[n.length-1]?.id||(t?i.charges:null),subscriptions:e.subscriptionsAfter||r[r.length-1]?.id||(t?i.subscriptions:null)};return a.charges===i.charges&&a.subscriptions===i.subscriptions?i:a})},[]);(0,_.useEffect)(()=>{if(!e||!i)return;let t=!1;return b(`/api/payments/orders`).then(e=>{t||(x(e,!1),m(``),f(!0))}).catch(e=>{t||(m(e.message),f(!0))}),()=>{t=!0}},[e,i,b,x]);let S=async()=>{y(!0);try{let e=new URLSearchParams;l.charges&&e.set(`starting_after`,l.charges),l.subscriptions&&e.set(`subscriptions_after`,l.subscriptions),x(await b(`/api/payments/orders?${e}`),!0),m(``)}catch(e){m(e.message)}y(!1)},C=(0,_.useCallback)((e,t)=>{e===`charge`?o(e=>e.filter(e=>e.id!==t)):c(e=>e.filter(e=>e.id!==t))},[]);return{orders:(0,_.useMemo)(()=>[...a,...s],[a,s]),loaded:d,error:p,hasMore:h,loadingMore:v,loadMore:S,authed:b,drop:C}}var D=e=>e?new Date(e).toLocaleString(void 0,{day:`numeric`,month:`short`,year:`numeric`,hour:`numeric`,minute:`2-digit`}):``,O=e=>e?new Date(e).toLocaleDateString(void 0,{day:`numeric`,month:`short`,year:`numeric`}):``;function k(e){let t=e.order,n=[];if(e.at){let r=t?t.kind===`subscription`?`Started`:t.paid?`Paid on`:`Date`:`Sent on`;n.push({label:r,value:D(e.at)})}return t?.paidWith&&n.push({value:t.paidWith}),e.page&&n.push({label:`Sold on`,value:e.page}),t&&(t.amountRefunded||0)>0&&n.push({value:`${u.r(t.amountRefunded,t.currency)} refunded`}),t&&e.entry&&p.r(e.entry,t)&&n.push({value:`Paid less than this order says — do not send it`}),t&&e.entry&&p.t(e.entry,t)&&n.push({value:`Paid for other things than this order says — do not send it`}),n}var A=e=>/^(charge|subscription|entry):/.test(e)?e:e.startsWith(`sub_`)?`subscription:${e}`:`charge:${e}`,j=e=>e.order?e.order.kind===`subscription`?{title:`Delete this subscription?`,message:`It comes off this screen for good. The subscription itself stays in your Stripe account and keeps running — cancel it there if that is what you mean.`}:{title:`Delete this payment?`,message:`It comes off this screen for good. The payment itself stays in your Stripe account, and nothing is refunded.`}:{title:`Delete this order?`,message:`The order they started is deleted. Nothing was paid, so there is nothing in Stripe to keep.`},M=`grid grid-cols-[minmax(0,1fr)_auto_1rem] md:grid-cols-[minmax(0,1.5fr)_minmax(0,1.3fr)_6.5rem_7rem_8.5rem_1rem] items-center gap-x-3 md:gap-x-6 px-4 md:px-5`;function N({status:e,className:t=``}){return(0,v.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-[12.5px] font-medium text-foreground/60 leading-tight whitespace-nowrap ${t}`,children:[(0,v.jsx)(`span`,{"aria-hidden":`true`,className:`w-1.5 h-1.5 rounded-full shrink-0 ${e.in?`bg-emerald-500`:`bg-foreground/25`}`}),e.label]})}var P=`text-[12.5px] font-semibold text-foreground/50 leading-tight mb-3`,F=`block text-[12px] font-medium text-foreground/45 leading-tight mb-0.5`,I=`text-[13.5px] text-foreground/85 leading-snug break-words [overflow-wrap:anywhere]`;function L({row:e}){let t=e.name||e.email||`Someone`,n=[];return e.email&&e.email!==t&&n.push([`Email`,e.email]),e.order?.phone&&n.push([`Phone`,e.order.phone]),e.order?.address&&n.push([`Delivery address`,e.order.address]),(0,v.jsxs)(`section`,{className:`min-w-0`,children:[(0,v.jsx)(`h3`,{className:P,children:`Who`}),(0,v.jsx)(`p`,{className:`text-[14px] font-semibold text-foreground leading-snug break-words [overflow-wrap:anywhere]`,children:t}),n.length>0&&(0,v.jsx)(`div`,{className:`flex flex-col gap-2.5 mt-3`,children:n.map(([e,t])=>(0,v.jsxs)(`p`,{className:`min-w-0`,children:[(0,v.jsx)(`span`,{className:F,children:e}),(0,v.jsx)(`span`,{className:`block ${I}`,children:t})]},e))})]})}function R({lines:e,onOpen:n}){return(0,v.jsxs)(`section`,{className:`min-w-0`,children:[(0,v.jsx)(`h3`,{className:P,children:`What they bought`}),(0,v.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map((e,r)=>{let i=(0,v.jsx)(`span`,{className:e.kind===`total`?`text-[13.5px] font-semibold text-foreground leading-snug`:e.kind===`extra`?`${I} text-foreground/60`:I,children:e.left});return(0,v.jsxs)(`div`,{className:`flex justify-between gap-4 ${e.picture?`items-center`:`items-baseline`} ${e.kind===`total`?`border-t border-[var(--panel-border)]/70 pt-2.5 mt-1`:``}`,children:[e.picture?(0,v.jsxs)(`span`,{className:`flex items-center gap-3 min-w-0`,children:[(0,v.jsx)(`button`,{type:`button`,onClick:()=>n({src:e.picture,name:e.left||`Picture`}),"aria-label":`Open the picture of ${e.left||`this`}`,title:e.left,className:`shrink-0 rounded-lg outline-none focus-visible:ring-2 focus-visible:ring-accent/50 hover:opacity-90 active:scale-[0.99] transition cursor-pointer`,children:(0,v.jsx)(t.O,{src:e.picture,alt:``,fit:`cover`,className:`w-10 h-10 rounded-lg border border-[var(--panel-border)]`})}),i]}):i,e.right&&(0,v.jsx)(`span`,{className:`text-[13.5px] tabular-nums whitespace-nowrap shrink-0 leading-snug ${e.kind===`total`?`font-semibold text-foreground`:`text-foreground/85`}`,children:e.right})]},r)})})]})}function z({pairs:e,currency:n,onOpen:r}){return(0,v.jsxs)(`section`,{className:`min-w-0`,children:[(0,v.jsx)(`h3`,{className:P,children:`What they told you`}),(0,v.jsx)(`dl`,{className:`grid grid-cols-1 sm:grid-cols-[minmax(0,11rem)_minmax(0,1fr)] gap-x-8 gap-y-1 sm:gap-y-2`,children:e.map(([e,i])=>{let a=u.n(e,i,n);return(0,v.jsxs)(_.Fragment,{children:[(0,v.jsx)(`dt`,{className:`text-[13px] text-foreground/50 leading-snug`,children:u.s(e)}),t.I(i)?(0,v.jsx)(`dd`,{className:`my-1 max-sm:mb-2.5`,children:(0,v.jsx)(g.t,{value:i,onOpen:r,className:`w-20 h-14`})}):(0,v.jsx)(`dd`,{className:`${I} max-sm:mb-2`,children:(a.length?a:[`—`]).map((e,t)=>(0,v.jsx)(`span`,{className:`block`,children:e},t))})]},e)})})]})}function B({row:e,open:n,onToggle:r,onDelete:a,onOpenFile:o}){let s=t.tt(),l=u.u(e),d=e.name||e.email||`Someone`,p=e.email&&e.email!==d?e.email:``,m=e.order?.currency||null,h=e.order?u.r(e.order.amount,e.order.currency):``,g=e.order?.kind===`subscription`&&e.order.interval?`/ ${e.order.interval}`:``,{bought:_,told:y}=u.d(e.collected.filter(([e])=>!f.n(e))),b=new Set([e.name,e.email,e.order?.phone,e.order?.address].filter(Boolean)),x=y.filter(([,e])=>!(typeof e==`string`&&b.has(e.trim()))),S=k(e),C=u.l(_,m);return e.order&&!C.some(e=>e.kind===`item`)&&C.unshift({left:e.what,right:g?`${h} ${g}`:h,kind:`item`}),(0,v.jsxs)(`div`,{"data-ledger-row":e.key,className:`scroll-mt-6 ${n?`bg-foreground/[0.02]`:``}`,children:[(0,v.jsxs)(`button`,{type:`button`,onClick:r,"aria-expanded":n,className:`w-full ${M} py-3 text-left cursor-pointer transition-colors hover:bg-foreground/[0.03]`,children:[(0,v.jsxs)(`span`,{className:`flex flex-col min-w-0 gap-0.5`,children:[(0,v.jsx)(`span`,{className:`text-[13.5px] font-bold text-foreground leading-tight truncate`,children:d}),(0,v.jsx)(`span`,{className:`md:hidden text-[12px] font-medium text-foreground/45 leading-tight truncate`,children:e.what}),p&&(0,v.jsx)(`span`,{className:`max-md:hidden text-[12px] font-medium text-foreground/45 leading-tight truncate`,children:p})]}),(0,v.jsxs)(`span`,{className:`max-md:hidden md:flex flex-col min-w-0 gap-0.5`,children:[(0,v.jsx)(`span`,{className:`text-[13px] font-medium text-foreground/80 leading-tight truncate`,children:e.what}),e.page&&(0,v.jsx)(`span`,{className:`text-[11.5px] font-medium text-foreground/40 leading-tight truncate`,children:e.page})]}),(0,v.jsx)(`span`,{className:`max-md:hidden text-[12.5px] font-medium text-foreground/45 tabular-nums whitespace-nowrap leading-tight`,children:O(e.at)}),(0,v.jsx)(N,{status:l,className:`max-md:hidden`}),(0,v.jsxs)(`span`,{className:`flex flex-col items-end gap-1 min-w-0`,children:[(0,v.jsxs)(`span`,{className:`text-[13.5px] font-semibold text-foreground tabular-nums whitespace-nowrap leading-tight`,children:[h||(0,v.jsx)(`span`,{className:`text-foreground/25 font-medium`,children:`—`}),g&&(0,v.jsxs)(`span`,{className:`text-[12.5px] text-foreground/40 font-medium`,children:[` `,g]})]}),(0,v.jsx)(N,{status:l,className:`md:hidden !text-[11.5px] !gap-1.5`})]}),(0,v.jsx)(i.t,{className:`w-4 h-4 text-foreground/35 shrink-0 justify-self-end transition-transform ${n?`rotate-180`:``}`})]}),(0,v.jsx)(t.rt,{initial:!1,children:n&&(0,v.jsx)(t.nt.div,{initial:{height:0,opacity:0},animate:{height:`auto`,opacity:1},exit:{height:0,opacity:0},transition:s?{duration:0}:t.w,className:`overflow-hidden`,children:(0,v.jsxs)(`div`,{className:`mx-4 md:mx-5 pt-4 pb-5 md:pt-5 md:pb-6 border-t border-[var(--panel-border)]/50 flex flex-col gap-6`,children:[(0,v.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,v.jsx)(`div`,{className:`flex items-center flex-wrap gap-x-4 gap-y-1`,children:h?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`span`,{className:`text-2xl font-semibold tracking-tight text-foreground tabular-nums leading-none`,children:[h,g&&(0,v.jsxs)(`span`,{className:`text-[15px] font-medium text-foreground/45 tracking-normal`,children:[` `,g]})]}),(0,v.jsx)(N,{status:l,className:`!text-[13px]`})]}):(0,v.jsx)(`span`,{className:`text-lg font-semibold tracking-tight leading-none text-foreground/50`,children:l.label})}),S.length>0&&(0,v.jsx)(`p`,{className:`flex flex-wrap items-baseline gap-x-2 text-[13px] text-foreground/60 leading-snug`,children:S.map((e,t)=>(0,v.jsxs)(`span`,{className:`inline-flex flex-wrap gap-x-1`,children:[t>0&&(0,v.jsx)(`span`,{"aria-hidden":`true`,className:`text-foreground/30 mr-1`,children:`·`}),e.label&&(0,v.jsx)(`span`,{className:`text-foreground/45`,children:e.label}),(0,v.jsx)(`span`,{children:e.value})]},t))})]}),(0,v.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-[minmax(0,2fr)_minmax(0,3fr)] gap-x-12 gap-y-6`,children:[(0,v.jsx)(L,{row:e}),C.length>0&&(0,v.jsx)(R,{lines:C,onOpen:o})]}),x.length>0&&(0,v.jsx)(z,{pairs:x,currency:m,onOpen:o}),C.length===0&&x.length===0&&(0,v.jsx)(`p`,{className:`text-[13px] text-foreground/40`,children:`Nothing was asked before paying.`}),(0,v.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[e.order?.receiptUrl?(0,v.jsxs)(`a`,{href:e.order.receiptUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-[13px] font-medium text-foreground/55 hover:text-accent transition-colors`,children:[`Stripe receipt`,(0,v.jsx)(t.Ot,{className:`w-3.5 h-3.5`})]}):(0,v.jsx)(`span`,{}),a&&(0,v.jsx)(t.o,{icon:c.t,tone:`danger`,compact:!0,title:`Delete this transaction`,onClick:a,children:`Delete`})]})]})})})]})}function V({rows:r,waiting:i,configured:c,error:u,hasMore:f,loadingMore:p,onLoadMore:h,onDelete:g,initialOpen:y=null,help:x=!1,focus:S=null,onFocused:C}){let[w,T]=(0,_.useState)(y),[E,D]=(0,_.useState)(null),[O,k]=(0,_.useState)(null),[N,P]=(0,_.useState)(!1),[F,I]=(0,_.useState)(``),L=S?A(S):null;m.t(L,!i&&!!L&&r.some(e=>e.key===L),T,C);let R=async()=>{if(!(!O||!g)){P(!0),I(``);try{await g(O),w===O.key&&T(null),k(null)}catch(e){I(t.ii(e,e?.message||`It could not be deleted.`))}P(!1)}},z=O?j(O):null;return(0,v.jsxs)(`main`,{className:`flex-1 w-full max-w-7xl mx-auto p-4 pt-2 md:p-8 md:pt-4 z-10 flex flex-col min-h-screen`,children:[(0,v.jsxs)(t.nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:`mb-6`,children:[(0,v.jsx)(e.t,{children:`Transactions`}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2 text-foreground/40 font-bold uppercase tracking-[0.2em] text-[11px]`,children:[(0,v.jsx)(`span`,{className:`w-8 h-[1px] bg-foreground/10`}),`/transactions`]})]}),(0,v.jsxs)(`div`,{className:`flex flex-col gap-6 flex-1 pb-16`,children:[(0,v.jsx)(n.t,{}),(0,v.jsx)(`div`,{className:`glass-panel border border-[var(--panel-border)] rounded-3xl p-4 sm:p-5 md:p-8 shadow-2xl relative bg-background flex flex-col fbos-tab-fill min-h-[400px] gap-4`,children:i?(0,v.jsx)(l.t,{block:!0,className:`flex-1`}):(0,v.jsxs)(v.Fragment,{children:[u&&(0,v.jsx)(t.h,{tone:`error`,children:u}),!c&&(0,v.jsxs)(t.h,{children:[`Stripe is not connected yet, so there is no money to show — connect it on the`,` `,(0,v.jsx)(b.Link,{to:`/payments`,className:`font-bold text-accent hover:underline`,children:`Payments`}),` screen and every payment lands here on its own.`]}),r.length===0&&f?(0,v.jsxs)(`div`,{className:`flex flex-col items-center justify-center flex-1 gap-3 py-16 text-center`,children:[(0,v.jsx)(`p`,{className:`text-[13px] font-medium text-foreground/50`,children:`Nothing recent.`}),(0,v.jsx)(t.o,{busy:p,onClick:h,children:`Show older payments`})]}):r.length===0?(0,v.jsx)(`div`,{className:`flex flex-col items-center justify-center flex-1 gap-3 py-16 text-center`,children:(0,v.jsx)(`p`,{className:`text-[13px] font-medium text-foreground/50 max-w-md leading-relaxed`,children:`Nothing yet. When somebody pays, or answers a payment’s form, it lands here on its own — with what they bought and everything they told the page beside it. A refund you make in Stripe shows here too.`})}):(0,v.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,v.jsxs)(`div`,{className:`rounded-2xl border border-[var(--panel-border)]/60 divide-y divide-[var(--panel-border)]/60 overflow-hidden`,children:[(0,v.jsxs)(`div`,{className:`max-md:hidden ${M} py-2.5 text-[11.5px] font-medium text-foreground/40`,children:[(0,v.jsx)(`span`,{children:`Who`}),(0,v.jsx)(`span`,{children:`What`}),(0,v.jsx)(`span`,{children:`When`}),(0,v.jsx)(`span`,{children:`Status`}),(0,v.jsx)(`span`,{className:`text-right`,children:`Amount`}),(0,v.jsx)(`span`,{})]}),r.map(e=>(0,v.jsx)(B,{row:e,open:w===e.key,onToggle:()=>T(t=>t===e.key?null:e.key),onDelete:g?()=>{I(``),k(e)}:void 0,onOpenFile:D},e.key))]}),f&&(0,v.jsx)(t.o,{busy:p,onClick:h,className:`self-center mt-1`,children:`Show older payments`})]})]})})]}),x&&(0,v.jsx)(a.t,{}),(0,v.jsx)(o.t,{open:!!E,onClose:()=>D(null),src:E?.src||``,name:E?.name}),(0,v.jsx)(d.t,{isOpen:!!O,title:z?.title||``,message:(0,v.jsxs)(v.Fragment,{children:[z?.message,F&&(0,v.jsx)(`span`,{className:`block mt-4 text-left`,children:(0,v.jsx)(s.t,{tone:`error`,children:F})})]}),confirmText:`Delete`,isProcessing:N,onConfirm:R,onCancel:()=>{N||k(null)}})]})}function H(){let{userRole:e}=t.Ft(),n=r.wn(e),{status:i,error:a}=h.i(),o=!!i?.configured,s=E(o),c=(0,_.useMemo)(()=>n?s.orders.map(e=>w(e.collected)).filter(Boolean):[],[n,s.orders]),l=x(!n,c),{entries:d,loading:f,error:p}=l,m=(0,_.useMemo)(()=>u.f(s.orders,d).filter(e=>e.order||e.at>=l.reachedBack),[s.orders,d,l.reachedBack]),g=!i&&!a||f||o&&!s.loaded,S=()=>{s.hasMore?s.loadMore():l.loadOlder()},[C,T]=(0,b.useSearchParams)();return(0,v.jsx)(V,{rows:m,waiting:g,configured:o,error:[s.error,p].filter(Boolean).join(` `),hasMore:s.hasMore||l.more,loadingMore:s.loadingMore||l.loadingOlder,onLoadMore:S,onDelete:n?async e=>{e.order&&await s.authed(`/api/payments/orders/remove`,{method:`POST`,body:JSON.stringify({kind:e.order.kind,id:e.order.id})}),e.entry?.collection&&(await(0,y.deleteDoc)((0,y.doc)(t.ui,e.entry.collection,e.entry.id)),l.forget(e.entry.collection,e.entry.id)),e.order&&s.drop(e.order.kind,e.order.id)}:void 0,help:n,focus:C.get(`open`),onFocused:()=>T(e=>{let t=new URLSearchParams(e);return t.delete(`open`),t},{replace:!0})})}exports.TransactionsAdmin=H;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Qr as e, oi as t, ri as n } from "./TimeZoneField-
|
|
1
|
+
import { Qr as e, oi as t, ri as n } from "./TimeZoneField-oIMwb5_X.js";
|
|
2
2
|
import { n as r } from "./chevron-down--LwXEv9w.js";
|
|
3
3
|
import { useEffect as i, useRef as a, useState as o, useSyncExternalStore as s } from "react";
|
|
4
4
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./TimeZoneField-
|
|
1
|
+
const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./TimeZoneField-Ckn1pKAL.cjs`),n=require(`./chevron-down-lyDK1rfL.cjs`);let r=require(`react`);r=e.a(r,1);let i=require(`react/jsx-runtime`);var a=`fbos:trouble`;function o(e){typeof window>`u`||window.dispatchEvent(new CustomEvent(a,{detail:e}))}var s=12e3,c=e=>String(e?.message??e??``).toLowerCase().includes(`websocket`),l=e=>{let t=String(e?.name||``),n=String(e?.code||``).toLowerCase(),r=String(e?.message??e??``).toLowerCase();return!(!r&&!n&&!t||c(e)||t===`AbortError`||n===`storage/canceled`||n===`cancelled`||r.includes(`resizeobserver`)||r===`script error.`||r===`script error`||r.includes(`the above error occurred`))};function u(){let[e,n]=(0,r.useState)(null),[i,o]=(0,r.useState)(()=>typeof navigator<`u`&&navigator.onLine===!1),u=(0,r.useRef)({words:``,at:0}),d=(0,r.useRef)(0),f=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(typeof window>`u`)return;let e=(e,r)=>{if(!l(e)){c(e)&&r?.preventDefault?.();return}console.warn(`Your AI Firebase: something did not finish —`,e),r?.preventDefault?.();let i=`${e?.code||``}|${e?.message??e??``}`,a=Date.now();u.current.words===i&&a-u.current.at<15e3||(u.current={words:i,at:a},d.current+=1,n({error:e,id:d.current}),f.current&&clearTimeout(f.current),t.oi(e)||(f.current=setTimeout(()=>n(null),s)))},r=t=>e(t.reason,t),i=t=>e(t.detail),p=t=>{typeof t.target?.tagName!=`string`&&e(t.error??t.message,t)},m=()=>o(!0),h=()=>{o(!1),n(null),u.current={words:``,at:0}};return window.addEventListener(`unhandledrejection`,r),window.addEventListener(a,i),window.addEventListener(`error`,p,!0),window.addEventListener(`offline`,m),window.addEventListener(`online`,h),()=>{window.removeEventListener(`unhandledrejection`,r),window.removeEventListener(a,i),window.removeEventListener(`error`,p,!0),window.removeEventListener(`offline`,m),window.removeEventListener(`online`,h),f.current&&clearTimeout(f.current)}},[]),{problem:e,offline:i,dismiss:()=>n(null)}}var d={name:`log-in`,size:24,node:[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]};d.node;var f=n.n(d),p={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};p.node;var m=n.n(p),h={name:`wifi-off`,size:24,node:[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};h.node;var g=n.n(h),_=()=>{typeof window<`u`&&window.location.reload()},v=()=>{let e=typeof window<`u`?window.location.pathname:`/`;return e&&e!==`/login`&&e!==`/`?`/login?from=${encodeURIComponent(e)}`:`/login`},y={again:m,reload:m,signin:f,none:m},b=`w-full flex items-center justify-center gap-2 py-2.5 bg-foreground/5 hover:bg-foreground/10 text-foreground text-[14px] font-bold rounded-xl transition-colors`,x=`w-full text-center py-2 mt-2 text-[13px] font-bold text-foreground/50 hover:text-foreground/80 transition-colors`;function S({found:e,onRetry:n,way:r,onTried:a}){let o=e.next===`again`&&!n?`reload`:e.next,s=y[o],c=t.Qr[o];return o===`signin`?(0,i.jsxs)(`a`,{href:r.signInHref??v(),className:b,children:[(0,i.jsx)(s,{className:`w-4 h-4 shrink-0`}),c]}):(0,i.jsxs)(`button`,{type:`button`,onClick:()=>{a(),o===`again`&&n?n():(r.reload??_)()},className:b,children:[(0,i.jsx)(s,{className:`w-4 h-4 shrink-0`}),c]})}function C({error:e,override:n,onRetry:a,size:o=`page`,...s}){let[c,l]=(0,r.useState)(0),u={...t.ri(e),...n||{}},d=u.next===`again`&&!!a;return(0,i.jsx)(`div`,{className:o===`page`?`flex-1 flex flex-col items-center justify-center relative z-10 min-h-[60vh] px-4 fbos-fade-in`:`w-full flex flex-col items-center justify-center py-10 px-4 fbos-fade-in`,role:`alert`,children:(0,i.jsxs)(`div`,{className:`glass-panel p-8 md:p-10 rounded-3xl border border-[var(--panel-border)] text-center shadow-xl max-w-sm w-full relative overflow-hidden`,children:[(0,i.jsx)(`div`,{className:`absolute inset-0 bg-amber-500/5`}),(0,i.jsx)(`h2`,{className:`text-2xl font-bold text-foreground mb-3 relative z-10 tracking-tight`,children:u.title}),(0,i.jsx)(`p`,{className:`text-[14px] text-foreground/70 font-medium leading-relaxed relative z-10 mb-6`,children:u.message}),(0,i.jsxs)(`div`,{className:`relative z-10`,children:[(0,i.jsx)(S,{found:u,onRetry:a,way:s,onTried:()=>l(e=>e+1)}),d&&c>0&&(0,i.jsx)(`button`,{type:`button`,onClick:()=>(s.reload??_)(),className:x,children:`Still not working? Reload the page`})]})]})})}var w=0,T=new Set,E=()=>T.forEach(e=>e()),D=e=>(T.add(e),()=>{T.delete(e)});function O(){return(0,r.useSyncExternalStore)(D,()=>w>0,()=>!1)}function k({error:e,offline:n,onRetry:a,onDismiss:o,...s}){let c=t.ri(e),l=n?`You are offline. The app will catch up by itself the moment you are back.`:c.short,u=!n&&c.next===`none`,d=c.kind===`drawnByHand`||c.kind===`ownFileBroken`,f=u&&d&&c.message&&c.message!==c.short?c.message:``,[p,h]=(0,r.useState)(!1);return(0,r.useEffect)(()=>(w+=1,E(),()=>{--w,E()}),[]),(0,i.jsx)(`div`,{className:`fixed bottom-4 left-1/2 -translate-x-1/2 z-[60] w-[calc(100%-2rem)] max-w-md px-0`,role:`status`,children:(0,i.jsxs)(`div`,{className:`glass-panel rounded-2xl border border-[var(--panel-border)] shadow-xl px-4 py-3 flex items-center gap-3`,children:[n?(0,i.jsx)(g,{className:`w-4 h-4 shrink-0 text-amber-500`}):(0,i.jsx)(m,{className:`w-4 h-4 shrink-0 text-amber-500`}),(0,i.jsx)(`p`,{className:`text-[13px] font-semibold text-foreground/80 leading-snug flex-1`,children:l}),f&&(0,i.jsx)(`button`,{type:`button`,onClick:()=>{navigator.clipboard?.writeText(f).then(()=>h(!0),()=>{})},className:`shrink-0 text-[13px] font-bold text-foreground hover:text-accent transition-colors whitespace-nowrap`,children:p?`Copied`:`Copy`}),!n&&!u&&(0,i.jsx)(`button`,{type:`button`,onClick:()=>a?a():(s.reload??_)(),className:`shrink-0 text-[13px] font-bold text-foreground hover:text-accent transition-colors whitespace-nowrap`,children:a?`Try again`:`Reload`}),o&&(0,i.jsx)(`button`,{type:`button`,onClick:o,"aria-label":`Hide this`,className:`shrink-0 text-[13px] font-bold text-foreground/40 hover:text-foreground/70 transition-colors`,children:`✕`})]})})}function A(){let{problem:e,offline:t,dismiss:n}=u();return t?(0,i.jsx)(k,{offline:!0}):e?(0,i.jsx)(k,{error:e.error,onDismiss:n},e.id):null}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return C}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./PageTitle-BWmE74WQ.cjs`),n=require(`./TimeZoneField-zR8N2Fj0.cjs`),r=require(`./DashboardNav-DOl9gJuu.cjs`),i=require(`./schedule-BAea6q8_.cjs`),a=require(`./chevron-down-lyDK1rfL.cjs`),o=require(`./arrow-left-C39sNUA7.cjs`);require(`./boxes-CpGWLEM7.cjs`),require(`./scheduleData-BpkfnBjP.cjs`);const s=require(`./SupportBar-CNVXSYwT.cjs`),c=require(`./FormNote-CX2rSBDB.cjs`),l=require(`./x-Ci8c5p6T.cjs`),u=require(`./lock-xMnTQLRt.cjs`),d=require(`./pencil-Ca8JSmp0.cjs`),f=require(`./plus-zsWFCu4F.cjs`),ee=require(`./trash-D-CpYHCs.cjs`),p=require(`./registrationFields-COv8jW4n.cjs`),m=require(`./roles-5juCr5sY.cjs`),h=require(`./notices-Cwon5Q0Y.cjs`),g=require(`./ConfirmModal-CQ73WYUg.cjs`),_=require(`./recordsKey-R5BjLoGQ.cjs`),v=require(`./pageFiles-BClshvXs.cjs`),y=require(`./personName-BvH1NWNy.cjs`),b=require(`./people-D8nPPMlM.cjs`),x=require(`./SystemTabContent-EegzTuLd.cjs`),te=require(`./ownerMail-CGmDk7aP.cjs`),S=require(`./useIsPhone-CoiQVcCo.cjs`);let C=require(`react`);C=e.a(C,1);let w=require(`react/jsx-runtime`),T=require(`firebase/firestore`),E=require(`firebase/storage`),D=require(`react-router-dom`);var O={name:`tags`,size:24,node:[[`path`,{d:`M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z`,key:`16rjxf`}],[`path`,{d:`M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193`,key:`178nd4`}],[`circle`,{cx:`10.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`12ikhr`}]]};O.node;var k=a.n(O);function A(e){return e.length===1?/\bplan$/i.test(e[0])?e[0]:`${e[0]} plan`:`Plans: ${e.join(`, `)}`}var j=`flex flex-col divide-y divide-[var(--panel-border)]/60 rounded-2xl border border-[var(--panel-border)]/60`,ne=`flex items-center gap-3 rounded-2xl border border-dashed border-[var(--panel-border)] px-4 py-3 sm:px-5`,M=`${n.c.replace(`h-11 `,`h-9 sm:h-10 `)} flex-1 min-w-0 max-w-sm`,re={user:`Everybody who signs up`,internal:`People you mark as your team`,admin:`People who run the app`};function N({roles:e,plans:r}){let[i,a]=(0,C.useState)(``),[o,s]=(0,C.useState)(``),[c,u]=(0,C.useState)(``),[p,h]=(0,C.useState)(``),[v,y]=(0,C.useState)(!1),[x,te]=(0,C.useState)(``),[S,T]=(0,C.useState)(``),[E,D]=(0,C.useState)(null),[O,N]=(0,C.useState)(``),ie=[...m.t(e),...e],F=_.u()||[],ae=async t=>{let r=m.i(t.id,o,e);if(r){u(r);return}h(t.id);try{await m.a(t.id,o),a(``),u(``)}catch(e){u(n.ii(e,`The new name could not be saved. Try again.`))}h(``)},oe=async e=>{h(e.id);try{D({role:e,standing:await m.s(e.id)})}catch{D({role:e,standing:{people:[],pages:[]}})}h(``)},I=()=>{y(!1),te(``),T(``)},L=async()=>{let t=m.o(x,e);if(t){T(t);return}h(`adding`);try{await m.n(x.trim()),I()}catch(e){T(n.ii(e,`The role could not be saved. Try again.`))}h(``)};return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(n.m,{icon:k,title:`Roles`,description:`The words you mark people with, and the words your pages are kept for. Renaming one changes it everywhere.`,children:[(0,w.jsx)(`div`,{className:j,children:ie.map(f=>{let h=n.Gr(f.id),g=r[f.id]||[],_=b.n(f.id,b.t(f.id,F),e),v=m.u(f.id,e),y=h?!!n.Wr(f.id):!!f.icon;return(0,w.jsxs)(`div`,{className:`px-4 py-2.5 sm:py-3`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2 sm:gap-3`,children:[(0,w.jsx)(t.l,{name:v,label:`Change the icon for ${f.name}`,open:O===f.id,onClick:()=>N(O===f.id?``:f.id)}),i===f.id?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`input`,{autoFocus:!0,value:o,disabled:p===f.id,placeholder:n.Vr[f.id]||f.name,"aria-label":`Rename ${f.name}`,onChange:e=>{s(e.target.value),c&&u(``)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),ae(f)),e.key===`Escape`&&(e.preventDefault(),a(``),u(``))},className:M}),(0,w.jsx)(`span`,{className:`flex-1`}),(0,w.jsx)(n.o,{icon:n.At,compact:!0,busy:p===f.id,title:`Save ${o||f.name}`,onClick:()=>ae(f),children:`Save`}),(0,w.jsx)(n.o,{icon:l.t,compact:!0,title:`Keep the name`,onClick:()=>{a(``),u(``)},children:`Cancel`})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`span`,{className:`flex-1 min-w-0 flex items-center gap-2.5`,children:[(0,w.jsx)(`span`,{className:`text-[13.5px] font-bold text-foreground leading-tight truncate`,children:f.name}),h&&(0,w.jsx)(`span`,{className:`max-sm:hidden text-[12px] font-medium text-foreground/45 truncate`,children:re[f.id]}),g.length>0&&(0,w.jsx)(`span`,{className:`max-sm:hidden min-w-0 overflow-hidden`,title:g.join(`, `),children:(0,w.jsx)(n._,{state:`saved`,label:A(g)})})]}),(0,w.jsx)(n.o,{icon:d.t,compact:!0,title:`Rename ${f.name}`,onClick:()=>{a(f.id),s(f.name),u(``)},children:`Rename`}),!h&&(0,w.jsx)(n.o,{icon:ee.t,tone:`danger`,compact:!0,busy:p===f.id,title:`Remove ${f.name}`,onClick:()=>oe(f),children:`Remove`})]})]}),O===f.id&&(0,w.jsx)(`div`,{className:`mt-2.5`,children:(0,w.jsx)(t.s,{label:`${f.name} is drawn as`,hint:`Type a word — anything close comes up. Until you pick one it follows the name.`,value:v,onPick:async e=>{N(``);try{await m.c(f.id,e)}catch(e){u(n.ii(e,`The icon could not be saved. Try again.`))}},resetLabel:y?`Use the one the name suggests`:void 0,resetTitle:`Go back to the icon ${f.name} suggests`,onReset:y?async()=>{N(``);try{await m.c(f.id,``)}catch(e){u(n.ii(e,`The icon could not be saved. Try again.`))}}:void 0})}),!!_&&i!==f.id&&(0,w.jsx)(`p`,{className:`max-sm:hidden text-[12px] font-medium text-foreground/45 leading-relaxed mt-1`,children:_})]},f.id)})}),!!c&&(0,w.jsx)(`p`,{className:`text-[12px] font-semibold text-red-500 px-1 -mt-2`,children:c}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,w.jsx)(`div`,{className:ne,children:v?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`input`,{autoFocus:!0,value:x,placeholder:`Client`,disabled:p===`adding`,"aria-label":`Name the role`,onChange:e=>{te(e.target.value),S&&T(``)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),L()),e.key===`Escape`&&(e.preventDefault(),I())},className:M}),(0,w.jsx)(`span`,{className:`flex-1`}),(0,w.jsx)(n.o,{icon:n.At,compact:!0,busy:p===`adding`,title:`Add this role`,onClick:L,children:`Add`}),(0,w.jsx)(n.o,{icon:l.t,compact:!0,title:`Cancel the new role`,onClick:I,children:`Cancel`})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(n.o,{icon:f.t,onClick:()=>{y(!0),T(``)},children:`Add a role`}),!e.length&&(0,w.jsxs)(`p`,{className:`text-[12.5px] text-foreground/55 font-medium leading-relaxed`,children:[(0,w.jsx)(`span`,{className:`sm:hidden`,children:`A word of your own — Client, say, or Supplier.`}),(0,w.jsx)(`span`,{className:`max-sm:hidden`,children:`A word of your own to mark people with — Client, say, or Supplier — and a page can be kept for them alone.`})]})]})}),!!S&&(0,w.jsx)(`p`,{className:`text-[12px] font-semibold text-red-500 px-1`,children:S})]}),(0,w.jsx)(`p`,{className:`${n.s} px-1 max-sm:hidden`,children:`A role you make opens nothing on its own. Tick it on a page's row on the Pages screen, or let a plan on the Payments screen give it. Renaming changes the word on every screen and nothing else — nobody loses a page and no rules have to be pasted again.`})]}),(0,w.jsx)(g.t,{isOpen:!!E,title:E?`Remove ${E.role.name}?`:``,message:E?P(E.standing):``,confirmText:`Yes, remove it`,cancelText:`Keep it`,isProcessing:p===`removing`,onCancel:()=>D(null),onConfirm:async()=>{if(E){h(`removing`);try{await m.r(E.role.id),D(null)}catch(e){u(n.ii(e,`The role could not be removed. Try again.`)),D(null)}h(``)}}})]})}function P(e){let t=e.people.length,n=e.pages.length,r=e.plans||[],i=[];t&&i.push(`${t} ${t===1?`person goes`:`people go`} back to being ${t===1?`a member`:`members`}`),n&&i.push(`${n} ${n===1?`page goes`:`pages go`} back to everybody signed in`),r.length&&i.push(r.length===1?`the ${r[0]} plan stops giving it`:`${r.length} plans stop giving it`);let a=i.length>2?`${i.slice(0,-1).join(`, `)}, and ${i[i.length-1]}`:i.join(`, and `),o=i.length?`${a.charAt(0).toUpperCase()}${a.slice(1)}. `:`Nobody is marked with it and no page is kept for it. `,s=r.length?` A plan keeps selling — pick it a new role on the Payments screen.`:``;return`${o}Whatever those pages have saved stays exactly where it is — you and your admins can still read it — but nobody else will, and the word itself is gone from every list.${n?` ${n===1?`That page was built to read what was kept for this role, so it needs building again: open it`:`Those pages were built to read what was kept for this role, so they need building again: open each one`} on your Pages screen and copy the sentence on its row.`:``}${s}`}function ie(e){return`Everything this app keeps about ${e} is deleted — their name, their picture, their role, what they kept on pages only they could see, and their place in every list — and they are signed out at once. If they ever sign in or sign up again they start from nothing, as a new person with no role, like anybody else. Whatever they made on your pages for others stays exactly where it is, under the name the record itself saved. This cannot be undone.`}function F(e){let t=new Set;for(let[n,r]of e)!r||i.Mn(r)!==`user_`||t.add(_.r(r,`user_`,n));return[...t]}async function ae(e){let t=new Map;for(let[e,n]of r.x())!n.isPublic&&n.config&&t.set(e,n.config);try{(await(0,T.getDocs)((0,T.collection)(n.ui,`sys_tabs`))).forEach(e=>t.set(e.id,{...t.get(e.id)||{},...e.data()}))}catch{}let i=v.i(`user_`);for(let r of F([...t.entries()]))try{let t=await(0,T.getDocs)((0,T.query)((0,T.collection)(n.ui,r),(0,T.where)(`uid`,`==`,e)));await Promise.all(t.docs.map(async e=>{await v.o({id:e.id,...e.data()},[],i),await(0,T.deleteDoc)(e.ref)}))}catch(e){console.warn(`${r}: a deleted person's own records could not be swept.`,e)}}function oe({person:e,settings:t}){let r=p.l(e,t);return r.length?(0,w.jsxs)(`div`,{className:`pt-5 border-t border-[var(--panel-border)]/50 flex flex-col gap-3`,children:[(0,w.jsx)(`p`,{className:`${n.u} ml-1`,children:`What they told you`}),(0,w.jsx)(`div`,{className:`flex flex-col divide-y divide-[var(--panel-border)]/50 rounded-xl border border-[var(--panel-border)]/60`,children:r.map(t=>{let n=p.p(e,t);return(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 px-3.5 py-2.5 min-w-0`,children:[(0,w.jsx)(`span`,{className:`text-[12.5px] font-medium text-foreground/50 shrink-0 max-w-[45%] truncate`,children:t.label}),(0,w.jsx)(`span`,{className:`text-[13px] font-semibold min-w-0 text-right [overflow-wrap:anywhere] ${n?`text-foreground`:`text-foreground/35 italic`}`,children:n?p.a(e,t):`Not given`})]},t.key)})})]}):null}var I=e=>{let t=n.Gn(e);return i.bn(t)||i.In(i.kn(t))},L=`waiting`;function se(e,t,n){let r=new Map,i=[];for(let t of e){if(!t.inactive&&n(t)){i.push(t);continue}let e=I(t);r.set(e,[...r.get(e)||[],t])}let a=[...r.keys()].filter(e=>![`admin`,`internal`,`user`,...t].includes(e)).sort(),o=[`admin`,`internal`,...t,...a,`user`];return[...i.length?[{id:L,people:i}]:[],...o.filter(e=>r.has(e)).map(e=>({id:e,people:r.get(e)}))]}var ce=n.l.replace(`h-11 `,`h-9 `).replace(`px-4 `,`px-3 `),R=e=>e.normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase();function le(e,t){let n=R(t.trim());if(!n)return!0;let r=e.email||``;if([e.displayName,/[@.]/.test(n)?r:r.split(`@`)[0]].some(e=>!!e&&R(e).includes(n)))return!0;let i=n.replace(/\D/g,``);return!!i&&i.length===n.replace(/[\s+()-]/g,``).length&&(e.phone||``).replace(/\D/g,``).includes(i)}function ue({label:e,title:n,count:r,icon:i,plain:a,active:o,onClick:s}){return(0,w.jsxs)(`button`,{type:`button`,"aria-pressed":o,"aria-label":n,title:n,onClick:s,className:`inline-flex items-center gap-2 h-9 pl-3 pr-3.5 shrink-0 whitespace-nowrap rounded-full border text-[12.5px] font-semibold transition-all cursor-pointer active:scale-[0.98] ${o?`border-accent/35 bg-accent/10 text-foreground`:`border-[var(--panel-border)]/70 text-foreground/55 hover:text-foreground hover:border-accent/30 hover:bg-foreground/[0.03]`}`,children:[i===``?(0,w.jsx)(`span`,{className:`w-1.5 h-1.5 mx-1 rounded-full shrink-0 bg-accent animate-pulse`}):i&&(0,w.jsx)(t.c,{name:i,className:`w-3.5 h-3.5 shrink-0 ${a&&!o?`text-foreground/35`:`text-accent`}`}),(0,w.jsx)(`span`,{children:e}),(0,w.jsx)(`span`,{className:`tabular-nums font-medium ${o?`text-foreground/50`:`text-foreground/35`}`,children:r})]})}function z({label:e,plain:n,waiting:r,icon:i}){return(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[11.5px] font-semibold whitespace-nowrap shrink-0 ${r?`text-foreground/70`:`text-foreground/50`}`,children:[i?(0,w.jsx)(t.c,{name:i,className:`w-3.5 h-3.5 shrink-0 ${n?`text-foreground/35`:`text-accent`} ${r?`animate-pulse`:``}`}):(0,w.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 ${n?`bg-foreground/25`:`bg-accent`} ${r?`animate-pulse`:``}`}),e]})}function B(){let{user:e,userRole:a}=n.Ft(),d=m.l(),f=n.Cn(),p=n.Yn(),{groups:_}=r.v(),[v,b]=(0,C.useState)(!0),O=(0,D.useNavigate)(),{id:k}=(0,D.useParams)(),A=S.n(),[j,ne]=(0,C.useState)([]);te.n(j,a===`admin`,!v);let[M,re]=(0,C.useState)(null),[P,F]=(0,C.useState)(null),[L,R]=(0,C.useState)(!1),[B,de]=(0,C.useState)(``),[V,H]=(0,C.useState)(null),[fe,pe]=(0,C.useState)(!1),U=se(j,d.map(e=>e.id),e=>!!n.in(e)),W=U[0]?.people[0]?.id||``,[me,he]=(0,C.useState)(``),[ge,_e]=(0,C.useState)(``),G=U.some(e=>e.id===me)?me:``,K=j.length>=8,ve=U.filter(e=>!G||e.id===G).map(e=>({...e,people:e.people.filter(e=>le(e,K?ge:``))})).filter(e=>e.people.length),q=k?j.find(e=>e.id===k)||null:j.find(e=>e.id===W)||null,J=e=>{O(e?`/users/${e.id}`:`/users`)};(0,C.useEffect)(()=>{let e=(0,T.onSnapshot)((0,T.collection)(n.ui,`user_profiles`),e=>{let t=[];e.forEach(e=>{let n={id:e.id,...e.data()};n.removed||t.push(n)}),t.sort((e,t)=>Number(!!n.in(t))-Number(!!n.in(e))),ne(t),re(null),b(!1)},e=>{console.error(`Error fetching users:`,e),re(e),b(!1)});return()=>e()},[]),(0,C.useEffect)(()=>{!k&&W&&!S.t()&&O(`/users/${W}`,{replace:!0})},[k,W,O]);let ye=(0,C.useRef)(null),[be,xe]=(0,C.useState)(!1);(0,C.useEffect)(()=>{let e=ye.current,t=e?.querySelector(`[aria-current="true"]`);if(!e||!t||e.scrollHeight<=e.clientHeight)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.top<n.top?e.scrollTop-=n.top-r.top+12:r.bottom>n.bottom-40&&(e.scrollTop+=r.bottom-n.bottom+40)},[k,j.length,G]);let Y=j.find(t=>t.id===e?.uid),X=a===`admin`,Z=e=>!X||e.id===Y?.id?!1:e.role!==`admin`||!Y?.createdAt?!0:e.createdAt?new Date(Y.createdAt).getTime()<=new Date(e.createdAt).getTime():!1,Se=[...i.fn.map(e=>({value:i.In(e),label:n.qr(i.In(e),d)})),...d.map(e=>({value:e.id,label:e.name}))],Ce=Se.map(e=>({value:e.value,label:(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-2 min-w-0`,children:[(0,w.jsx)(t.c,{name:m.u(e.value,d),className:`w-4 h-4 shrink-0 opacity-70`}),(0,w.jsx)(`span`,{className:`truncate`,children:e.label})]})})),Q=I,we=e=>{let t=_.filter(t=>i.Cn(Q(e),t)).map(e=>e.name);return t.length?`In ${t.length===1?`the group`:`the groups`} ${t.join(`, `)}`:``},Te=e=>{let t=n.in(e);return t?n.en(t.role,n.qr(t.role,d)):``},Ee=e=>n.mn(e)&&(e===`internal`||d.some(t=>t.id===e)),De=j.filter(e=>n.in(e)).length,Oe=e=>!n.qn(e)||n.Gn(e)===`user`?``:`Paid plan · until ${new Date(n.Kn(e)).toLocaleDateString(void 0,{day:`numeric`,month:`short`,year:`numeric`})}`,ke=e=>e===i.In(`free`)?n.nn():n.$t(),Ae=async(e,t,r)=>{if(a!==`admin`||!Z(e)||Q(e)===t)return;let i=n.in(e);try{await(0,T.updateDoc)((0,T.doc)(n.ui,`user_profiles`,e.id),{role:t,...n.Wn(),...i?n.tn():{}}),i&&await h.n(e.id,ke(t)),F({text:`Role set to ${r}`,type:`success`}),setTimeout(()=>F(null),3e3)}catch(e){F({text:e.message,type:`error`}),setTimeout(()=>F(null),3e3)}},je=async(e,t)=>{if(!(a!==`admin`||!Z(e)||!Ee(t)))try{await(0,T.updateDoc)((0,T.doc)(n.ui,`user_profiles`,e.id),{role:t,...n.Wn(),...n.tn()}),await h.n(e.id,n.$t()),F({text:`${y.n(e)} is ${n.xn(t,n.qr(t,d))} now`,type:`success`}),setTimeout(()=>F(null),3e3)}catch(e){F({text:e.message,type:`error`}),setTimeout(()=>F(null),3e3)}},Me=async e=>{if(a!==`admin`||!Z(e))return;let t=n.in(e);try{await(0,T.updateDoc)((0,T.doc)(n.ui,`user_profiles`,e.id),n.tn()),t&&await h.n(e.id,n.nn()),F({text:`Request cleared — ${y.n(e)} stays a member`,type:`success`}),setTimeout(()=>F(null),3e3)}catch(e){F({text:e.message,type:`error`}),setTimeout(()=>F(null),3e3)}},Ne=async(e,t)=>{if(!(a!==`admin`||!Z(e)))try{await(0,T.updateDoc)((0,T.doc)(n.ui,`user_profiles`,e.id),{inactive:t}),F({text:`User ${t?`deactivated`:`activated`} successfully`,type:`success`}),setTimeout(()=>F(null),3e3)}catch(e){F({text:e.message,type:`error`}),setTimeout(()=>F(null),3e3)}},Pe=async e=>{if(!(a!==`admin`||!Z(e))){pe(!0);try{let t=Date.now();await(0,T.setDoc)((0,T.doc)(n.ui,`user_profiles`,e.id),{removed:!0,inactive:!0,removedAt:new Date(t).toISOString(),removedMs:t}),await(0,E.deleteObject)((0,E.ref)(n.fi,`user_avatars/${e.id}/file.png`)).catch(()=>{}),await ae(e.id),pe(!1),H(null),J(null),F({text:`Person deleted`,type:`success`}),setTimeout(()=>F(null),3e3)}catch(e){pe(!1),H(null),F({text:e.message,type:`error`}),setTimeout(()=>F(null),3e3)}}},Fe=async()=>{if(R(!1),!(!q||!Z(q)||B===q.displayName))try{await(0,T.updateDoc)((0,T.doc)(n.ui,`user_profiles`,q.id),{displayName:B}),F({text:`Name updated successfully`,type:`success`}),setTimeout(()=>F(null),3e3)}catch(e){F({text:e.message,type:`error`}),setTimeout(()=>F(null),3e3)}},[Ie,Le]=(0,C.useState)(!1);if((0,C.useEffect)(()=>{let e;return v&&j.length===0?e=setTimeout(()=>Le(!0),150):Le(!1),()=>clearTimeout(e)},[v,j.length]),v&&j.length===0)return Ie?(0,w.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center bg-background/60 backdrop-blur-xl transition-all duration-300`,children:(0,w.jsx)(l.r,{className:`w-8 h-8 animate-spin text-accent`})}):null;let $=A&&!!k,Re=!$,ze=!A||!!k,Be=e=>K&&(0,w.jsxs)(`div`,{className:`${ce} md:w-56 shrink-0`,children:[(0,w.jsx)(l.n,{className:`w-3.5 h-3.5 mr-2 shrink-0 text-foreground/35`}),(0,w.jsx)(`input`,{value:ge,onFocus:e,onChange:e=>_e(e.target.value),onKeyDown:e=>{e.key===`Escape`&&_e(``)},placeholder:`Find somebody`,"aria-label":`Find somebody`,className:`flex-1 min-w-0 h-full bg-transparent border-none outline-none shadow-none text-[14px] text-foreground placeholder:text-foreground/35 disabled:cursor-not-allowed text-[13px]`}),!!ge&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>_e(``),"aria-label":`Clear the search`,className:`shrink-0 -mr-1 w-6 h-6 flex items-center justify-center rounded-full text-foreground/40 hover:text-foreground hover:bg-foreground/5 transition-colors cursor-pointer`,children:(0,w.jsx)(l.t,{className:`w-3.5 h-3.5`})})]}),Ve=De?`${De} ${De===1?`person is`:`people are`} waiting for an answer — first in the list.`:`${j.length} ${j.length===1?`person has`:`people have`} signed up. ${A?`Tap somebody to `:`Pick somebody to `}${X?`change what they can open.`:`see their details.`}`;return(0,w.jsxs)(`main`,{className:`flex-1 w-full max-w-7xl mx-auto p-4 pt-2 md:p-8 md:pt-4 z-10 flex flex-col min-h-screen`,children:[(0,w.jsxs)(n.nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:`mb-6`,children:[(0,w.jsx)(t.t,{children:`Users`}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2 text-foreground/40 font-bold uppercase tracking-[0.2em] text-[11px]`,children:[(0,w.jsx)(`span`,{className:`w-8 h-[1px] bg-foreground/10`}),`/users`]})]}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-6 flex-1 pb-16`,children:[(0,w.jsx)(n.rt,{children:P&&(0,w.jsx)(n.nt.div,{exit:{opacity:0,y:-6},children:(0,w.jsx)(c.t,{tone:P.type===`error`?`error`:`done`,children:P.text})})}),(0,w.jsx)(r.t,{}),(0,w.jsx)(x.n,{tab:`users`}),(0,w.jsxs)(`div`,{className:`glass-panel border border-[var(--panel-border)] rounded-3xl p-4 sm:p-5 md:p-8 shadow-2xl relative bg-background flex flex-col fbos-tab-fill gap-4`,children:[(0,w.jsx)(n.m,{icon:r.S,title:`People`,description:j.length?Ve:M?void 0:`Nobody has signed up yet.`,actions:A||!K?void 0:({open:e})=>Be(e),children:j.length===0&&M?(0,w.jsx)(c.t,{tone:`error`,children:n.ii(M,`The people could not be read.`)}):j.length===0?(0,w.jsx)(n.h,{children:`Everybody who signs in to your app appears here, and this is where you say what each of them can open.`}):(0,w.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-[minmax(0,5fr)_minmax(0,7fr)] gap-x-6 lg:gap-x-8 gap-y-5 items-start`,children:[Re&&(U.length>1||K)&&(0,w.jsxs)(`div`,{className:`md:col-span-2 flex flex-col md:flex-row md:items-start gap-3 md:gap-4 min-w-0`,children:[U.length>1&&(0,w.jsxs)(`div`,{role:`group`,"aria-label":`Show`,className:`flex-1 min-w-0 flex items-center gap-2 md:flex-wrap max-md:overflow-x-auto max-md:-mx-4 max-md:px-4 hide-scrollbar`,children:[(0,w.jsx)(ue,{label:`Everyone`,title:`Show everyone`,count:j.length,active:!G,onClick:()=>he(``)}),U.map(e=>{let t=e.id===`waiting`,r=t?`Waiting`:n.qr(e.id,d);return(0,w.jsx)(ue,{label:r,title:t?`Show only whoever is waiting for an answer`:`Show only ${r}`,count:e.people.length,icon:t?``:m.u(e.id,d),plain:e.id===`user`,active:G===e.id,onClick:()=>he(G===e.id?``:e.id)},e.id)})]}),A&&Be()]}),Re&&(0,w.jsxs)(`div`,{ref:ye,onScroll:e=>xe(e.currentTarget.scrollTop>2),className:`flex flex-col gap-6 min-w-0 md:max-h-[min(72vh,680px)] md:overflow-y-auto md:pb-8 md:-mr-2 md:pr-2 hide-scrollbar ${be?`md:[mask-image:linear-gradient(to_bottom,transparent,black_1.5rem,black_calc(100%-2rem),transparent)]`:`md:[mask-image:linear-gradient(to_bottom,black_calc(100%-2rem),transparent)]`}`,children:[ve.length===0&&(0,w.jsx)(`p`,{className:`px-3 py-6 text-[13px] font-medium text-foreground/50`,children:`Nobody here by that name.`}),ve.map(e=>{let r=e.id===`waiting`;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0`,children:[(0,w.jsxs)(`div`,{role:`heading`,"aria-level":4,className:`flex items-center gap-2.5 px-3 text-[13px] font-bold text-foreground/85 leading-tight`,children:[(0,w.jsx)(`span`,{className:`w-7 h-7 rounded-[10px] flex items-center justify-center shrink-0 ${e.id===`user`?`bg-foreground/[0.05] text-foreground/40`:`bg-accent/10 text-accent`}`,children:r?(0,w.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-accent animate-pulse`}):(0,w.jsx)(t.c,{name:m.u(e.id,d),className:`w-3.5 h-3.5`})}),(0,w.jsx)(`span`,{className:`truncate`,children:r?`Waiting for an answer`:n.qr(e.id,d)}),(0,w.jsx)(`span`,{className:`shrink-0 text-[11.5px] font-semibold text-foreground/35 tabular-nums`,children:e.people.length})]}),(0,w.jsx)(`div`,{className:`flex flex-col gap-0.5 min-w-0 ${r?`rounded-2xl border border-accent/20 bg-accent/[0.04] p-1`:``}`,children:e.people.map(e=>{let t=!!k&&q?.id===e.id;return(0,w.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-current":t||void 0,onClick:()=>J(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),J(e))},className:`flex items-center gap-3 px-3 py-2.5 rounded-xl transition-colors cursor-pointer outline-none focus-visible:bg-foreground/[0.05] ${t?`bg-accent/[0.09]`:`hover:bg-foreground/[0.035]`} ${e.inactive?`opacity-55`:``}`,children:[(0,w.jsxs)(`span`,{className:`flex flex-col gap-0.5 min-w-0 flex-1`,children:[(0,w.jsx)(`span`,{className:`text-[14px] font-semibold text-foreground leading-tight truncate`,children:y.n(e)}),(0,w.jsx)(`span`,{className:`max-sm:hidden text-[12.5px] text-foreground/45 leading-snug truncate`,children:y.t(e)})]}),!e.inactive&&n.in(e)?A?(0,w.jsx)(z,{label:n.qr(n.in(e).role,d),icon:m.u(n.in(e).role,d),plain:!1,waiting:!0}):(0,w.jsx)(z,{label:Te(e),plain:!1,waiting:!0}):e.inactive?(0,w.jsx)(z,{label:`Off`,plain:!0}):null,A?(0,w.jsx)(n.kt,{className:`w-4 h-4 text-foreground/25 shrink-0 -mr-1`}):t&&(0,w.jsx)(n.kt,{className:`w-4 h-4 text-accent/70 shrink-0 -mr-0.5`})]},e.id)})})]},e.id)})]}),ze&&(q?(0,w.jsxs)(`div`,{className:`rounded-2xl border border-[var(--panel-border)]/60 bg-foreground/[0.015] overflow-hidden fbos-fade-in min-w-0`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3 px-4 sm:px-5 py-4 border-b border-[var(--panel-border)]/50 min-w-0`,children:[$&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>J(null),"aria-label":`Back to all users`,className:`shrink-0 -ml-1.5 w-8 h-8 flex items-center justify-center rounded-lg text-foreground/45 hover:text-foreground active:bg-foreground/5 transition-colors cursor-pointer`,children:(0,w.jsx)(o.t,{className:`w-4.5 h-4.5`})}),(0,w.jsx)(`span`,{"aria-hidden":!0,className:`max-sm:hidden w-10 h-10 rounded-2xl flex items-center justify-center shrink-0 border border-[var(--panel-border)]/50 ${q.inactive||Q(q)===`user`?`bg-foreground/[0.04] text-foreground/40`:`bg-accent/10 text-accent`}`,children:(0,w.jsx)(t.c,{name:m.u(Q(q),d),className:`w-5 h-5`})}),(0,w.jsxs)(`div`,{className:`flex flex-col flex-1 min-w-0 gap-0.5`,children:[L?(0,w.jsx)(`input`,{autoFocus:!0,value:B,"aria-label":`Name`,onChange:e=>de(e.target.value),onBlur:Fe,onKeyDown:e=>e.key===`Enter`&&Fe(),className:`text-[17px] sm:text-[18px] font-bold tracking-tight leading-tight bg-transparent border-b-2 border-accent outline-none text-foreground w-full`}):(0,w.jsx)(`h3`,{onDoubleClick:()=>{Z(q)&&(de(q.displayName||``),R(!0))},className:`text-[17px] sm:text-[18px] font-bold tracking-tight leading-tight text-foreground select-none truncate ${Z(q)?`cursor-pointer hover:text-accent transition-colors`:``}`,title:Z(q)?`Double-click to rename`:``,children:y.n(q)}),(0,w.jsx)(`p`,{className:`text-[12.5px] text-foreground/50 leading-snug truncate`,children:y.t(q)})]}),q.inactive&&(0,w.jsx)(`span`,{className:`max-sm:hidden`,children:(0,w.jsx)(z,{label:`Off`,plain:!0})})]}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-5 p-4 sm:p-5`,children:[(()=>{let e=n.in(q);if(!e)return null;let t=Ee(e.role),r=e.at?new Date(e.at).toLocaleDateString(void 0,{day:`numeric`,month:`short`}):``;return(0,w.jsxs)(`div`,{className:`rounded-xl border border-accent/30 bg-accent/[0.05] px-4 py-3 flex items-center gap-3 flex-wrap`,children:[(0,w.jsxs)(`div`,{className:`flex flex-col gap-0.5 min-w-0 flex-1`,children:[(0,w.jsx)(`span`,{className:`text-[13px] font-bold text-foreground leading-tight`,children:Te(q)}),(0,w.jsx)(`span`,{className:`text-[11px] sm:text-[11.5px] text-foreground/40 font-medium leading-snug`,children:t?`${r?`Asked ${r}. `:``}A member until you say otherwise.`:`That role no longer exists — clear the request, or pick them another role below.`})]}),Z(q)&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[t&&(0,w.jsx)(n.o,{icon:n.At,compact:!0,title:`Approve ${y.n(q)} as ${n.qr(e.role,d)}`,onClick:()=>je(q,e.role),children:`Approve`}),(0,w.jsx)(n.o,{icon:l.t,compact:!0,title:t?`Decline the request`:`Clear the request`,onClick:()=>Me(q),children:t?`Decline`:`Clear`})]})]})})(),(0,w.jsx)(n.i,{label:`Role`,hint:[Oe(q),we(q)].filter(Boolean).join(` · `)||void 0,children:(0,w.jsx)(n.Z,{ariaLabel:`Role`,value:Q(q),options:Ce,onChange:e=>{let t=Se.find(t=>t.value===e);t&&Ae(q,t.value,t.label)},disabled:!Z(q),className:`console-select`,dense:!0,portal:!0,direction:`auto`})}),X&&!Z(q)&&q.id!==Y?.id&&(0,w.jsxs)(`p`,{className:`-mt-3 flex items-center gap-1.5 px-1 text-[12px] font-medium text-foreground/45`,children:[(0,w.jsx)(u.t,{className:`w-3 h-3 shrink-0`}),`Admin since before you, so only they can change this account.`]}),(0,w.jsx)(oe,{person:q,settings:f.finishRegistration}),(0,w.jsx)(`div`,{className:`pt-5 border-t border-[var(--panel-border)]/50`,children:(0,w.jsx)(n.S,{label:`Can use the app`,hint:q.inactive?`Switched off — every page is closed to them.`:`Switch off to close every page to them.`,hintWideOnly:!0,enabled:!q.inactive,onChange:e=>Ne(q,!e),disabled:!Z(q)})}),Z(q)&&(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pt-5 border-t border-[var(--panel-border)]/50`,children:[(0,w.jsxs)(`div`,{className:`flex flex-col gap-0.5 min-w-0 ml-1`,children:[(0,w.jsx)(`span`,{className:`text-[13px] font-medium text-foreground/80`,children:`Delete this person`}),(0,w.jsx)(`span`,{className:`text-[11px] sm:text-[11.5px] text-foreground/40 font-medium leading-snug max-sm:hidden`,children:`Everything about them goes, their sign-in with it. What they made on your pages stays.`})]}),(0,w.jsx)(n.o,{icon:ee.t,tone:`danger`,compact:!0,title:`Delete ${y.n(q)}`,onClick:()=>H(q),children:`Delete`})]})]})]}):(0,w.jsx)(`div`,{className:`rounded-2xl border border-dashed border-[var(--panel-border)] min-h-[200px] flex flex-col items-center justify-center gap-3 px-4 text-center`,children:$&&!v?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`p`,{className:`text-[11px] sm:text-[11.5px] text-foreground/40 font-medium leading-snug`,children:`This person is not on the list any more.`}),(0,w.jsx)(n.o,{onClick:()=>O(`/users`,{replace:!0}),children:`Back to all users`})]}):(0,w.jsx)(`p`,{className:`text-[11px] sm:text-[11.5px] text-foreground/40 font-medium leading-snug`,children:`Pick somebody to see their role.`})}))]})}),X&&(0,w.jsx)(`div`,{hidden:$,children:(0,w.jsx)(N,{roles:d,plans:p})}),X&&!1]})]}),(0,w.jsx)(g.t,{isOpen:!!V,title:V?`Delete ${y.n(V,`this person`)}?`:``,message:V?ie(y.n(V,`this person`)):``,confirmText:`Yes, delete them`,cancelText:`Keep them`,isProcessing:fe,onCancel:()=>H(null),onConfirm:()=>V&&Pe(V)}),(0,w.jsx)(s.t,{video:`users`})]})}exports.UsersTab=B;
|
|
1
|
+
const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./PageTitle-DQkvCB11.cjs`),n=require(`./TimeZoneField-Ckn1pKAL.cjs`),r=require(`./DashboardNav-GgEUpyTa.cjs`),i=require(`./schedule-BAea6q8_.cjs`),a=require(`./chevron-down-lyDK1rfL.cjs`),o=require(`./arrow-left-C39sNUA7.cjs`);require(`./boxes-CpGWLEM7.cjs`),require(`./scheduleData-BXjNXVHY.cjs`);const s=require(`./SupportBar-DLWruzQb.cjs`),c=require(`./FormNote-DP0GK9ya.cjs`),l=require(`./x-Ci8c5p6T.cjs`),u=require(`./lock-xMnTQLRt.cjs`),d=require(`./pencil-Ca8JSmp0.cjs`),f=require(`./plus-zsWFCu4F.cjs`),ee=require(`./trash-D-CpYHCs.cjs`),p=require(`./registrationFields-DHHTptcl.cjs`),m=require(`./roles-BBDIJzox.cjs`),h=require(`./notices-CKm9-Pqt.cjs`),g=require(`./ConfirmModal-BUNtss4a.cjs`),_=require(`./recordsKey-C4E2vOti.cjs`),v=require(`./pageFiles-Cn0YQ4Ur.cjs`),y=require(`./personName-BvH1NWNy.cjs`),b=require(`./people-BwWVVLfy.cjs`),x=require(`./SystemTabContent-BWhRHoXx.cjs`),te=require(`./ownerMail-BS9SjJ2u.cjs`),S=require(`./useIsPhone-CoiQVcCo.cjs`);let C=require(`react`);C=e.a(C,1);let w=require(`react/jsx-runtime`),T=require(`firebase/firestore`),E=require(`firebase/storage`),D=require(`react-router-dom`);var O={name:`tags`,size:24,node:[[`path`,{d:`M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z`,key:`16rjxf`}],[`path`,{d:`M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193`,key:`178nd4`}],[`circle`,{cx:`10.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`12ikhr`}]]};O.node;var k=a.n(O);function A(e){return e.length===1?/\bplan$/i.test(e[0])?e[0]:`${e[0]} plan`:`Plans: ${e.join(`, `)}`}var j=`flex flex-col divide-y divide-[var(--panel-border)]/60 rounded-2xl border border-[var(--panel-border)]/60`,ne=`flex items-center gap-3 rounded-2xl border border-dashed border-[var(--panel-border)] px-4 py-3 sm:px-5`,M=`${n.c.replace(`h-11 `,`h-9 sm:h-10 `)} flex-1 min-w-0 max-w-sm`,re={user:`Everybody who signs up`,internal:`People you mark as your team`,admin:`People who run the app`};function N({roles:e,plans:r}){let[i,a]=(0,C.useState)(``),[o,s]=(0,C.useState)(``),[c,u]=(0,C.useState)(``),[p,h]=(0,C.useState)(``),[v,y]=(0,C.useState)(!1),[x,te]=(0,C.useState)(``),[S,T]=(0,C.useState)(``),[E,D]=(0,C.useState)(null),[O,N]=(0,C.useState)(``),ie=[...m.t(e),...e],F=_.u()||[],ae=async t=>{let r=m.i(t.id,o,e);if(r){u(r);return}h(t.id);try{await m.a(t.id,o),a(``),u(``)}catch(e){u(n.ii(e,`The new name could not be saved. Try again.`))}h(``)},oe=async e=>{h(e.id);try{D({role:e,standing:await m.s(e.id)})}catch{D({role:e,standing:{people:[],pages:[]}})}h(``)},I=()=>{y(!1),te(``),T(``)},L=async()=>{let t=m.o(x,e);if(t){T(t);return}h(`adding`);try{await m.n(x.trim()),I()}catch(e){T(n.ii(e,`The role could not be saved. Try again.`))}h(``)};return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(n.m,{icon:k,title:`Roles`,description:`The words you mark people with, and the words your pages are kept for. Renaming one changes it everywhere.`,children:[(0,w.jsx)(`div`,{className:j,children:ie.map(f=>{let h=n.Gr(f.id),g=r[f.id]||[],_=b.n(f.id,b.t(f.id,F),e),v=m.u(f.id,e),y=h?!!n.Wr(f.id):!!f.icon;return(0,w.jsxs)(`div`,{className:`px-4 py-2.5 sm:py-3`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2 sm:gap-3`,children:[(0,w.jsx)(t.l,{name:v,label:`Change the icon for ${f.name}`,open:O===f.id,onClick:()=>N(O===f.id?``:f.id)}),i===f.id?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`input`,{autoFocus:!0,value:o,disabled:p===f.id,placeholder:n.Vr[f.id]||f.name,"aria-label":`Rename ${f.name}`,onChange:e=>{s(e.target.value),c&&u(``)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),ae(f)),e.key===`Escape`&&(e.preventDefault(),a(``),u(``))},className:M}),(0,w.jsx)(`span`,{className:`flex-1`}),(0,w.jsx)(n.o,{icon:n.At,compact:!0,busy:p===f.id,title:`Save ${o||f.name}`,onClick:()=>ae(f),children:`Save`}),(0,w.jsx)(n.o,{icon:l.t,compact:!0,title:`Keep the name`,onClick:()=>{a(``),u(``)},children:`Cancel`})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`span`,{className:`flex-1 min-w-0 flex items-center gap-2.5`,children:[(0,w.jsx)(`span`,{className:`text-[13.5px] font-bold text-foreground leading-tight truncate`,children:f.name}),h&&(0,w.jsx)(`span`,{className:`max-sm:hidden text-[12px] font-medium text-foreground/45 truncate`,children:re[f.id]}),g.length>0&&(0,w.jsx)(`span`,{className:`max-sm:hidden min-w-0 overflow-hidden`,title:g.join(`, `),children:(0,w.jsx)(n._,{state:`saved`,label:A(g)})})]}),(0,w.jsx)(n.o,{icon:d.t,compact:!0,title:`Rename ${f.name}`,onClick:()=>{a(f.id),s(f.name),u(``)},children:`Rename`}),!h&&(0,w.jsx)(n.o,{icon:ee.t,tone:`danger`,compact:!0,busy:p===f.id,title:`Remove ${f.name}`,onClick:()=>oe(f),children:`Remove`})]})]}),O===f.id&&(0,w.jsx)(`div`,{className:`mt-2.5`,children:(0,w.jsx)(t.s,{label:`${f.name} is drawn as`,hint:`Type a word — anything close comes up. Until you pick one it follows the name.`,value:v,onPick:async e=>{N(``);try{await m.c(f.id,e)}catch(e){u(n.ii(e,`The icon could not be saved. Try again.`))}},resetLabel:y?`Use the one the name suggests`:void 0,resetTitle:`Go back to the icon ${f.name} suggests`,onReset:y?async()=>{N(``);try{await m.c(f.id,``)}catch(e){u(n.ii(e,`The icon could not be saved. Try again.`))}}:void 0})}),!!_&&i!==f.id&&(0,w.jsx)(`p`,{className:`max-sm:hidden text-[12px] font-medium text-foreground/45 leading-relaxed mt-1`,children:_})]},f.id)})}),!!c&&(0,w.jsx)(`p`,{className:`text-[12px] font-semibold text-red-500 px-1 -mt-2`,children:c}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,w.jsx)(`div`,{className:ne,children:v?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`input`,{autoFocus:!0,value:x,placeholder:`Client`,disabled:p===`adding`,"aria-label":`Name the role`,onChange:e=>{te(e.target.value),S&&T(``)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),L()),e.key===`Escape`&&(e.preventDefault(),I())},className:M}),(0,w.jsx)(`span`,{className:`flex-1`}),(0,w.jsx)(n.o,{icon:n.At,compact:!0,busy:p===`adding`,title:`Add this role`,onClick:L,children:`Add`}),(0,w.jsx)(n.o,{icon:l.t,compact:!0,title:`Cancel the new role`,onClick:I,children:`Cancel`})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(n.o,{icon:f.t,onClick:()=>{y(!0),T(``)},children:`Add a role`}),!e.length&&(0,w.jsxs)(`p`,{className:`text-[12.5px] text-foreground/55 font-medium leading-relaxed`,children:[(0,w.jsx)(`span`,{className:`sm:hidden`,children:`A word of your own — Client, say, or Supplier.`}),(0,w.jsx)(`span`,{className:`max-sm:hidden`,children:`A word of your own to mark people with — Client, say, or Supplier — and a page can be kept for them alone.`})]})]})}),!!S&&(0,w.jsx)(`p`,{className:`text-[12px] font-semibold text-red-500 px-1`,children:S})]}),(0,w.jsx)(`p`,{className:`${n.s} px-1 max-sm:hidden`,children:`A role you make opens nothing on its own. Tick it on a page's row on the Pages screen, or let a plan on the Payments screen give it. Renaming changes the word on every screen and nothing else — nobody loses a page and no rules have to be pasted again.`})]}),(0,w.jsx)(g.t,{isOpen:!!E,title:E?`Remove ${E.role.name}?`:``,message:E?P(E.standing):``,confirmText:`Yes, remove it`,cancelText:`Keep it`,isProcessing:p===`removing`,onCancel:()=>D(null),onConfirm:async()=>{if(E){h(`removing`);try{await m.r(E.role.id),D(null)}catch(e){u(n.ii(e,`The role could not be removed. Try again.`)),D(null)}h(``)}}})]})}function P(e){let t=e.people.length,n=e.pages.length,r=e.plans||[],i=[];t&&i.push(`${t} ${t===1?`person goes`:`people go`} back to being ${t===1?`a member`:`members`}`),n&&i.push(`${n} ${n===1?`page goes`:`pages go`} back to everybody signed in`),r.length&&i.push(r.length===1?`the ${r[0]} plan stops giving it`:`${r.length} plans stop giving it`);let a=i.length>2?`${i.slice(0,-1).join(`, `)}, and ${i[i.length-1]}`:i.join(`, and `),o=i.length?`${a.charAt(0).toUpperCase()}${a.slice(1)}. `:`Nobody is marked with it and no page is kept for it. `,s=r.length?` A plan keeps selling — pick it a new role on the Payments screen.`:``;return`${o}Whatever those pages have saved stays exactly where it is — you and your admins can still read it — but nobody else will, and the word itself is gone from every list.${n?` ${n===1?`That page was built to read what was kept for this role, so it needs building again: open it`:`Those pages were built to read what was kept for this role, so they need building again: open each one`} on your Pages screen and copy the sentence on its row.`:``}${s}`}function ie(e){return`Everything this app keeps about ${e} is deleted — their name, their picture, their role, what they kept on pages only they could see, and their place in every list — and they are signed out at once. If they ever sign in or sign up again they start from nothing, as a new person with no role, like anybody else. Whatever they made on your pages for others stays exactly where it is, under the name the record itself saved. This cannot be undone.`}function F(e){let t=new Set;for(let[n,r]of e)!r||i.Mn(r)!==`user_`||t.add(_.r(r,`user_`,n));return[...t]}async function ae(e){let t=new Map;for(let[e,n]of r.x())!n.isPublic&&n.config&&t.set(e,n.config);try{(await(0,T.getDocs)((0,T.collection)(n.ui,`sys_tabs`))).forEach(e=>t.set(e.id,{...t.get(e.id)||{},...e.data()}))}catch{}let i=v.i(`user_`);for(let r of F([...t.entries()]))try{let t=await(0,T.getDocs)((0,T.query)((0,T.collection)(n.ui,r),(0,T.where)(`uid`,`==`,e)));await Promise.all(t.docs.map(async e=>{await v.o({id:e.id,...e.data()},[],i),await(0,T.deleteDoc)(e.ref)}))}catch(e){console.warn(`${r}: a deleted person's own records could not be swept.`,e)}}function oe({person:e,settings:t}){let r=p.l(e,t);return r.length?(0,w.jsxs)(`div`,{className:`pt-5 border-t border-[var(--panel-border)]/50 flex flex-col gap-3`,children:[(0,w.jsx)(`p`,{className:`${n.u} ml-1`,children:`What they told you`}),(0,w.jsx)(`div`,{className:`flex flex-col divide-y divide-[var(--panel-border)]/50 rounded-xl border border-[var(--panel-border)]/60`,children:r.map(t=>{let n=p.p(e,t);return(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 px-3.5 py-2.5 min-w-0`,children:[(0,w.jsx)(`span`,{className:`text-[12.5px] font-medium text-foreground/50 shrink-0 max-w-[45%] truncate`,children:t.label}),(0,w.jsx)(`span`,{className:`text-[13px] font-semibold min-w-0 text-right [overflow-wrap:anywhere] ${n?`text-foreground`:`text-foreground/35 italic`}`,children:n?p.a(e,t):`Not given`})]},t.key)})})]}):null}var I=e=>{let t=n.Gn(e);return i.bn(t)||i.In(i.kn(t))},L=`waiting`;function se(e,t,n){let r=new Map,i=[];for(let t of e){if(!t.inactive&&n(t)){i.push(t);continue}let e=I(t);r.set(e,[...r.get(e)||[],t])}let a=[...r.keys()].filter(e=>![`admin`,`internal`,`user`,...t].includes(e)).sort(),o=[`admin`,`internal`,...t,...a,`user`];return[...i.length?[{id:L,people:i}]:[],...o.filter(e=>r.has(e)).map(e=>({id:e,people:r.get(e)}))]}var ce=n.l.replace(`h-11 `,`h-9 `).replace(`px-4 `,`px-3 `),R=e=>e.normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase();function le(e,t){let n=R(t.trim());if(!n)return!0;let r=e.email||``;if([e.displayName,/[@.]/.test(n)?r:r.split(`@`)[0]].some(e=>!!e&&R(e).includes(n)))return!0;let i=n.replace(/\D/g,``);return!!i&&i.length===n.replace(/[\s+()-]/g,``).length&&(e.phone||``).replace(/\D/g,``).includes(i)}function ue({label:e,title:n,count:r,icon:i,plain:a,active:o,onClick:s}){return(0,w.jsxs)(`button`,{type:`button`,"aria-pressed":o,"aria-label":n,title:n,onClick:s,className:`inline-flex items-center gap-2 h-9 pl-3 pr-3.5 shrink-0 whitespace-nowrap rounded-full border text-[12.5px] font-semibold transition-all cursor-pointer active:scale-[0.98] ${o?`border-accent/35 bg-accent/10 text-foreground`:`border-[var(--panel-border)]/70 text-foreground/55 hover:text-foreground hover:border-accent/30 hover:bg-foreground/[0.03]`}`,children:[i===``?(0,w.jsx)(`span`,{className:`w-1.5 h-1.5 mx-1 rounded-full shrink-0 bg-accent animate-pulse`}):i&&(0,w.jsx)(t.c,{name:i,className:`w-3.5 h-3.5 shrink-0 ${a&&!o?`text-foreground/35`:`text-accent`}`}),(0,w.jsx)(`span`,{children:e}),(0,w.jsx)(`span`,{className:`tabular-nums font-medium ${o?`text-foreground/50`:`text-foreground/35`}`,children:r})]})}function z({label:e,plain:n,waiting:r,icon:i}){return(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[11.5px] font-semibold whitespace-nowrap shrink-0 ${r?`text-foreground/70`:`text-foreground/50`}`,children:[i?(0,w.jsx)(t.c,{name:i,className:`w-3.5 h-3.5 shrink-0 ${n?`text-foreground/35`:`text-accent`} ${r?`animate-pulse`:``}`}):(0,w.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 ${n?`bg-foreground/25`:`bg-accent`} ${r?`animate-pulse`:``}`}),e]})}function B(){let{user:e,userRole:a}=n.Ft(),d=m.l(),f=n.Cn(),p=n.Yn(),{groups:_}=r.v(),[v,b]=(0,C.useState)(!0),O=(0,D.useNavigate)(),{id:k}=(0,D.useParams)(),A=S.n(),[j,ne]=(0,C.useState)([]);te.n(j,a===`admin`,!v);let[M,re]=(0,C.useState)(null),[P,F]=(0,C.useState)(null),[L,R]=(0,C.useState)(!1),[B,de]=(0,C.useState)(``),[V,H]=(0,C.useState)(null),[fe,pe]=(0,C.useState)(!1),U=se(j,d.map(e=>e.id),e=>!!n.in(e)),W=U[0]?.people[0]?.id||``,[me,he]=(0,C.useState)(``),[ge,_e]=(0,C.useState)(``),G=U.some(e=>e.id===me)?me:``,K=j.length>=8,ve=U.filter(e=>!G||e.id===G).map(e=>({...e,people:e.people.filter(e=>le(e,K?ge:``))})).filter(e=>e.people.length),q=k?j.find(e=>e.id===k)||null:j.find(e=>e.id===W)||null,J=e=>{O(e?`/users/${e.id}`:`/users`)};(0,C.useEffect)(()=>{let e=(0,T.onSnapshot)((0,T.collection)(n.ui,`user_profiles`),e=>{let t=[];e.forEach(e=>{let n={id:e.id,...e.data()};n.removed||t.push(n)}),t.sort((e,t)=>Number(!!n.in(t))-Number(!!n.in(e))),ne(t),re(null),b(!1)},e=>{console.error(`Error fetching users:`,e),re(e),b(!1)});return()=>e()},[]),(0,C.useEffect)(()=>{!k&&W&&!S.t()&&O(`/users/${W}`,{replace:!0})},[k,W,O]);let ye=(0,C.useRef)(null),[be,xe]=(0,C.useState)(!1);(0,C.useEffect)(()=>{let e=ye.current,t=e?.querySelector(`[aria-current="true"]`);if(!e||!t||e.scrollHeight<=e.clientHeight)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();r.top<n.top?e.scrollTop-=n.top-r.top+12:r.bottom>n.bottom-40&&(e.scrollTop+=r.bottom-n.bottom+40)},[k,j.length,G]);let Y=j.find(t=>t.id===e?.uid),X=a===`admin`,Z=e=>!X||e.id===Y?.id?!1:e.role!==`admin`||!Y?.createdAt?!0:e.createdAt?new Date(Y.createdAt).getTime()<=new Date(e.createdAt).getTime():!1,Se=[...i.fn.map(e=>({value:i.In(e),label:n.qr(i.In(e),d)})),...d.map(e=>({value:e.id,label:e.name}))],Ce=Se.map(e=>({value:e.value,label:(0,w.jsxs)(`span`,{className:`inline-flex items-center gap-2 min-w-0`,children:[(0,w.jsx)(t.c,{name:m.u(e.value,d),className:`w-4 h-4 shrink-0 opacity-70`}),(0,w.jsx)(`span`,{className:`truncate`,children:e.label})]})})),Q=I,we=e=>{let t=_.filter(t=>i.Cn(Q(e),t)).map(e=>e.name);return t.length?`In ${t.length===1?`the group`:`the groups`} ${t.join(`, `)}`:``},Te=e=>{let t=n.in(e);return t?n.en(t.role,n.qr(t.role,d)):``},Ee=e=>n.mn(e)&&(e===`internal`||d.some(t=>t.id===e)),De=j.filter(e=>n.in(e)).length,Oe=e=>!n.qn(e)||n.Gn(e)===`user`?``:`Paid plan · until ${new Date(n.Kn(e)).toLocaleDateString(void 0,{day:`numeric`,month:`short`,year:`numeric`})}`,ke=e=>e===i.In(`free`)?n.nn():n.$t(),Ae=async(e,t,r)=>{if(a!==`admin`||!Z(e)||Q(e)===t)return;let i=n.in(e);try{await(0,T.updateDoc)((0,T.doc)(n.ui,`user_profiles`,e.id),{role:t,...n.Wn(),...i?n.tn():{}}),i&&await h.n(e.id,ke(t)),F({text:`Role set to ${r}`,type:`success`}),setTimeout(()=>F(null),3e3)}catch(e){F({text:e.message,type:`error`}),setTimeout(()=>F(null),3e3)}},je=async(e,t)=>{if(!(a!==`admin`||!Z(e)||!Ee(t)))try{await(0,T.updateDoc)((0,T.doc)(n.ui,`user_profiles`,e.id),{role:t,...n.Wn(),...n.tn()}),await h.n(e.id,n.$t()),F({text:`${y.n(e)} is ${n.xn(t,n.qr(t,d))} now`,type:`success`}),setTimeout(()=>F(null),3e3)}catch(e){F({text:e.message,type:`error`}),setTimeout(()=>F(null),3e3)}},Me=async e=>{if(a!==`admin`||!Z(e))return;let t=n.in(e);try{await(0,T.updateDoc)((0,T.doc)(n.ui,`user_profiles`,e.id),n.tn()),t&&await h.n(e.id,n.nn()),F({text:`Request cleared — ${y.n(e)} stays a member`,type:`success`}),setTimeout(()=>F(null),3e3)}catch(e){F({text:e.message,type:`error`}),setTimeout(()=>F(null),3e3)}},Ne=async(e,t)=>{if(!(a!==`admin`||!Z(e)))try{await(0,T.updateDoc)((0,T.doc)(n.ui,`user_profiles`,e.id),{inactive:t}),F({text:`User ${t?`deactivated`:`activated`} successfully`,type:`success`}),setTimeout(()=>F(null),3e3)}catch(e){F({text:e.message,type:`error`}),setTimeout(()=>F(null),3e3)}},Pe=async e=>{if(!(a!==`admin`||!Z(e))){pe(!0);try{let t=Date.now();await(0,T.setDoc)((0,T.doc)(n.ui,`user_profiles`,e.id),{removed:!0,inactive:!0,removedAt:new Date(t).toISOString(),removedMs:t}),await(0,E.deleteObject)((0,E.ref)(n.fi,`user_avatars/${e.id}/file.png`)).catch(()=>{}),await ae(e.id),pe(!1),H(null),J(null),F({text:`Person deleted`,type:`success`}),setTimeout(()=>F(null),3e3)}catch(e){pe(!1),H(null),F({text:e.message,type:`error`}),setTimeout(()=>F(null),3e3)}}},Fe=async()=>{if(R(!1),!(!q||!Z(q)||B===q.displayName))try{await(0,T.updateDoc)((0,T.doc)(n.ui,`user_profiles`,q.id),{displayName:B}),F({text:`Name updated successfully`,type:`success`}),setTimeout(()=>F(null),3e3)}catch(e){F({text:e.message,type:`error`}),setTimeout(()=>F(null),3e3)}},[Ie,Le]=(0,C.useState)(!1);if((0,C.useEffect)(()=>{let e;return v&&j.length===0?e=setTimeout(()=>Le(!0),150):Le(!1),()=>clearTimeout(e)},[v,j.length]),v&&j.length===0)return Ie?(0,w.jsx)(`div`,{className:`fixed inset-0 z-[100] flex items-center justify-center bg-background/60 backdrop-blur-xl transition-all duration-300`,children:(0,w.jsx)(l.r,{className:`w-8 h-8 animate-spin text-accent`})}):null;let $=A&&!!k,Re=!$,ze=!A||!!k,Be=e=>K&&(0,w.jsxs)(`div`,{className:`${ce} md:w-56 shrink-0`,children:[(0,w.jsx)(l.n,{className:`w-3.5 h-3.5 mr-2 shrink-0 text-foreground/35`}),(0,w.jsx)(`input`,{value:ge,onFocus:e,onChange:e=>_e(e.target.value),onKeyDown:e=>{e.key===`Escape`&&_e(``)},placeholder:`Find somebody`,"aria-label":`Find somebody`,className:`flex-1 min-w-0 h-full bg-transparent border-none outline-none shadow-none text-[14px] text-foreground placeholder:text-foreground/35 disabled:cursor-not-allowed text-[13px]`}),!!ge&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>_e(``),"aria-label":`Clear the search`,className:`shrink-0 -mr-1 w-6 h-6 flex items-center justify-center rounded-full text-foreground/40 hover:text-foreground hover:bg-foreground/5 transition-colors cursor-pointer`,children:(0,w.jsx)(l.t,{className:`w-3.5 h-3.5`})})]}),Ve=De?`${De} ${De===1?`person is`:`people are`} waiting for an answer — first in the list.`:`${j.length} ${j.length===1?`person has`:`people have`} signed up. ${A?`Tap somebody to `:`Pick somebody to `}${X?`change what they can open.`:`see their details.`}`;return(0,w.jsxs)(`main`,{className:`flex-1 w-full max-w-7xl mx-auto p-4 pt-2 md:p-8 md:pt-4 z-10 flex flex-col min-h-screen`,children:[(0,w.jsxs)(n.nt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:`mb-6`,children:[(0,w.jsx)(t.t,{children:`Users`}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2 text-foreground/40 font-bold uppercase tracking-[0.2em] text-[11px]`,children:[(0,w.jsx)(`span`,{className:`w-8 h-[1px] bg-foreground/10`}),`/users`]})]}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-6 flex-1 pb-16`,children:[(0,w.jsx)(n.rt,{children:P&&(0,w.jsx)(n.nt.div,{exit:{opacity:0,y:-6},children:(0,w.jsx)(c.t,{tone:P.type===`error`?`error`:`done`,children:P.text})})}),(0,w.jsx)(r.t,{}),(0,w.jsx)(x.n,{tab:`users`}),(0,w.jsxs)(`div`,{className:`glass-panel border border-[var(--panel-border)] rounded-3xl p-4 sm:p-5 md:p-8 shadow-2xl relative bg-background flex flex-col fbos-tab-fill gap-4`,children:[(0,w.jsx)(n.m,{icon:r.S,title:`People`,description:j.length?Ve:M?void 0:`Nobody has signed up yet.`,actions:A||!K?void 0:({open:e})=>Be(e),children:j.length===0&&M?(0,w.jsx)(c.t,{tone:`error`,children:n.ii(M,`The people could not be read.`)}):j.length===0?(0,w.jsx)(n.h,{children:`Everybody who signs in to your app appears here, and this is where you say what each of them can open.`}):(0,w.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-[minmax(0,5fr)_minmax(0,7fr)] gap-x-6 lg:gap-x-8 gap-y-5 items-start`,children:[Re&&(U.length>1||K)&&(0,w.jsxs)(`div`,{className:`md:col-span-2 flex flex-col md:flex-row md:items-start gap-3 md:gap-4 min-w-0`,children:[U.length>1&&(0,w.jsxs)(`div`,{role:`group`,"aria-label":`Show`,className:`flex-1 min-w-0 flex items-center gap-2 md:flex-wrap max-md:overflow-x-auto max-md:-mx-4 max-md:px-4 hide-scrollbar`,children:[(0,w.jsx)(ue,{label:`Everyone`,title:`Show everyone`,count:j.length,active:!G,onClick:()=>he(``)}),U.map(e=>{let t=e.id===`waiting`,r=t?`Waiting`:n.qr(e.id,d);return(0,w.jsx)(ue,{label:r,title:t?`Show only whoever is waiting for an answer`:`Show only ${r}`,count:e.people.length,icon:t?``:m.u(e.id,d),plain:e.id===`user`,active:G===e.id,onClick:()=>he(G===e.id?``:e.id)},e.id)})]}),A&&Be()]}),Re&&(0,w.jsxs)(`div`,{ref:ye,onScroll:e=>xe(e.currentTarget.scrollTop>2),className:`flex flex-col gap-6 min-w-0 md:max-h-[min(72vh,680px)] md:overflow-y-auto md:pb-8 md:-mr-2 md:pr-2 hide-scrollbar ${be?`md:[mask-image:linear-gradient(to_bottom,transparent,black_1.5rem,black_calc(100%-2rem),transparent)]`:`md:[mask-image:linear-gradient(to_bottom,black_calc(100%-2rem),transparent)]`}`,children:[ve.length===0&&(0,w.jsx)(`p`,{className:`px-3 py-6 text-[13px] font-medium text-foreground/50`,children:`Nobody here by that name.`}),ve.map(e=>{let r=e.id===`waiting`;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1.5 min-w-0`,children:[(0,w.jsxs)(`div`,{role:`heading`,"aria-level":4,className:`flex items-center gap-2.5 px-3 text-[13px] font-bold text-foreground/85 leading-tight`,children:[(0,w.jsx)(`span`,{className:`w-7 h-7 rounded-[10px] flex items-center justify-center shrink-0 ${e.id===`user`?`bg-foreground/[0.05] text-foreground/40`:`bg-accent/10 text-accent`}`,children:r?(0,w.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-accent animate-pulse`}):(0,w.jsx)(t.c,{name:m.u(e.id,d),className:`w-3.5 h-3.5`})}),(0,w.jsx)(`span`,{className:`truncate`,children:r?`Waiting for an answer`:n.qr(e.id,d)}),(0,w.jsx)(`span`,{className:`shrink-0 text-[11.5px] font-semibold text-foreground/35 tabular-nums`,children:e.people.length})]}),(0,w.jsx)(`div`,{className:`flex flex-col gap-0.5 min-w-0 ${r?`rounded-2xl border border-accent/20 bg-accent/[0.04] p-1`:``}`,children:e.people.map(e=>{let t=!!k&&q?.id===e.id;return(0,w.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-current":t||void 0,onClick:()=>J(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),J(e))},className:`flex items-center gap-3 px-3 py-2.5 rounded-xl transition-colors cursor-pointer outline-none focus-visible:bg-foreground/[0.05] ${t?`bg-accent/[0.09]`:`hover:bg-foreground/[0.035]`} ${e.inactive?`opacity-55`:``}`,children:[(0,w.jsxs)(`span`,{className:`flex flex-col gap-0.5 min-w-0 flex-1`,children:[(0,w.jsx)(`span`,{className:`text-[14px] font-semibold text-foreground leading-tight truncate`,children:y.n(e)}),(0,w.jsx)(`span`,{className:`max-sm:hidden text-[12.5px] text-foreground/45 leading-snug truncate`,children:y.t(e)})]}),!e.inactive&&n.in(e)?A?(0,w.jsx)(z,{label:n.qr(n.in(e).role,d),icon:m.u(n.in(e).role,d),plain:!1,waiting:!0}):(0,w.jsx)(z,{label:Te(e),plain:!1,waiting:!0}):e.inactive?(0,w.jsx)(z,{label:`Off`,plain:!0}):null,A?(0,w.jsx)(n.kt,{className:`w-4 h-4 text-foreground/25 shrink-0 -mr-1`}):t&&(0,w.jsx)(n.kt,{className:`w-4 h-4 text-accent/70 shrink-0 -mr-0.5`})]},e.id)})})]},e.id)})]}),ze&&(q?(0,w.jsxs)(`div`,{className:`rounded-2xl border border-[var(--panel-border)]/60 bg-foreground/[0.015] overflow-hidden fbos-fade-in min-w-0`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3 px-4 sm:px-5 py-4 border-b border-[var(--panel-border)]/50 min-w-0`,children:[$&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>J(null),"aria-label":`Back to all users`,className:`shrink-0 -ml-1.5 w-8 h-8 flex items-center justify-center rounded-lg text-foreground/45 hover:text-foreground active:bg-foreground/5 transition-colors cursor-pointer`,children:(0,w.jsx)(o.t,{className:`w-4.5 h-4.5`})}),(0,w.jsx)(`span`,{"aria-hidden":!0,className:`max-sm:hidden w-10 h-10 rounded-2xl flex items-center justify-center shrink-0 border border-[var(--panel-border)]/50 ${q.inactive||Q(q)===`user`?`bg-foreground/[0.04] text-foreground/40`:`bg-accent/10 text-accent`}`,children:(0,w.jsx)(t.c,{name:m.u(Q(q),d),className:`w-5 h-5`})}),(0,w.jsxs)(`div`,{className:`flex flex-col flex-1 min-w-0 gap-0.5`,children:[L?(0,w.jsx)(`input`,{autoFocus:!0,value:B,"aria-label":`Name`,onChange:e=>de(e.target.value),onBlur:Fe,onKeyDown:e=>e.key===`Enter`&&Fe(),className:`text-[17px] sm:text-[18px] font-bold tracking-tight leading-tight bg-transparent border-b-2 border-accent outline-none text-foreground w-full`}):(0,w.jsx)(`h3`,{onDoubleClick:()=>{Z(q)&&(de(q.displayName||``),R(!0))},className:`text-[17px] sm:text-[18px] font-bold tracking-tight leading-tight text-foreground select-none truncate ${Z(q)?`cursor-pointer hover:text-accent transition-colors`:``}`,title:Z(q)?`Double-click to rename`:``,children:y.n(q)}),(0,w.jsx)(`p`,{className:`text-[12.5px] text-foreground/50 leading-snug truncate`,children:y.t(q)})]}),q.inactive&&(0,w.jsx)(`span`,{className:`max-sm:hidden`,children:(0,w.jsx)(z,{label:`Off`,plain:!0})})]}),(0,w.jsxs)(`div`,{className:`flex flex-col gap-5 p-4 sm:p-5`,children:[(()=>{let e=n.in(q);if(!e)return null;let t=Ee(e.role),r=e.at?new Date(e.at).toLocaleDateString(void 0,{day:`numeric`,month:`short`}):``;return(0,w.jsxs)(`div`,{className:`rounded-xl border border-accent/30 bg-accent/[0.05] px-4 py-3 flex items-center gap-3 flex-wrap`,children:[(0,w.jsxs)(`div`,{className:`flex flex-col gap-0.5 min-w-0 flex-1`,children:[(0,w.jsx)(`span`,{className:`text-[13px] font-bold text-foreground leading-tight`,children:Te(q)}),(0,w.jsx)(`span`,{className:`text-[11px] sm:text-[11.5px] text-foreground/40 font-medium leading-snug`,children:t?`${r?`Asked ${r}. `:``}A member until you say otherwise.`:`That role no longer exists — clear the request, or pick them another role below.`})]}),Z(q)&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[t&&(0,w.jsx)(n.o,{icon:n.At,compact:!0,title:`Approve ${y.n(q)} as ${n.qr(e.role,d)}`,onClick:()=>je(q,e.role),children:`Approve`}),(0,w.jsx)(n.o,{icon:l.t,compact:!0,title:t?`Decline the request`:`Clear the request`,onClick:()=>Me(q),children:t?`Decline`:`Clear`})]})]})})(),(0,w.jsx)(n.i,{label:`Role`,hint:[Oe(q),we(q)].filter(Boolean).join(` · `)||void 0,children:(0,w.jsx)(n.Z,{ariaLabel:`Role`,value:Q(q),options:Ce,onChange:e=>{let t=Se.find(t=>t.value===e);t&&Ae(q,t.value,t.label)},disabled:!Z(q),className:`console-select`,dense:!0,portal:!0,direction:`auto`})}),X&&!Z(q)&&q.id!==Y?.id&&(0,w.jsxs)(`p`,{className:`-mt-3 flex items-center gap-1.5 px-1 text-[12px] font-medium text-foreground/45`,children:[(0,w.jsx)(u.t,{className:`w-3 h-3 shrink-0`}),`Admin since before you, so only they can change this account.`]}),(0,w.jsx)(oe,{person:q,settings:f.finishRegistration}),(0,w.jsx)(`div`,{className:`pt-5 border-t border-[var(--panel-border)]/50`,children:(0,w.jsx)(n.S,{label:`Can use the app`,hint:q.inactive?`Switched off — every page is closed to them.`:`Switch off to close every page to them.`,hintWideOnly:!0,enabled:!q.inactive,onChange:e=>Ne(q,!e),disabled:!Z(q)})}),Z(q)&&(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pt-5 border-t border-[var(--panel-border)]/50`,children:[(0,w.jsxs)(`div`,{className:`flex flex-col gap-0.5 min-w-0 ml-1`,children:[(0,w.jsx)(`span`,{className:`text-[13px] font-medium text-foreground/80`,children:`Delete this person`}),(0,w.jsx)(`span`,{className:`text-[11px] sm:text-[11.5px] text-foreground/40 font-medium leading-snug max-sm:hidden`,children:`Everything about them goes, their sign-in with it. What they made on your pages stays.`})]}),(0,w.jsx)(n.o,{icon:ee.t,tone:`danger`,compact:!0,title:`Delete ${y.n(q)}`,onClick:()=>H(q),children:`Delete`})]})]})]}):(0,w.jsx)(`div`,{className:`rounded-2xl border border-dashed border-[var(--panel-border)] min-h-[200px] flex flex-col items-center justify-center gap-3 px-4 text-center`,children:$&&!v?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`p`,{className:`text-[11px] sm:text-[11.5px] text-foreground/40 font-medium leading-snug`,children:`This person is not on the list any more.`}),(0,w.jsx)(n.o,{onClick:()=>O(`/users`,{replace:!0}),children:`Back to all users`})]}):(0,w.jsx)(`p`,{className:`text-[11px] sm:text-[11.5px] text-foreground/40 font-medium leading-snug`,children:`Pick somebody to see their role.`})}))]})}),X&&(0,w.jsx)(`div`,{hidden:$,children:(0,w.jsx)(N,{roles:d,plans:p})}),X&&!1]})]}),(0,w.jsx)(g.t,{isOpen:!!V,title:V?`Delete ${y.n(V,`this person`)}?`:``,message:V?ie(y.n(V,`this person`)):``,confirmText:`Yes, delete them`,cancelText:`Keep them`,isProcessing:fe,onCancel:()=>H(null),onConfirm:()=>V&&Pe(V)}),(0,w.jsx)(s.t,{video:`users`})]})}exports.UsersTab=B;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { c as e, l as t, s as n, t as r } from "./PageTitle-
|
|
2
|
-
import { $t as i, At as a, Cn as o, Ft as s, Gn as ee, Gr as c, Kn as l, S as u, Vr as te, Wn as d, Wr as ne, Yn as f, Z as p, _ as re, c as m, en as h, fi as g, h as _, i as v, ii as y, in as b, kt as x, l as S, m as ie, mn as ae, nn as oe, nt as se, o as C, qn as ce, qr as w, rt as le, s as T, tn as E, u as D, ui as O, xn as ue } from "./TimeZoneField-
|
|
3
|
-
import { S as de, t as fe, v as pe, x as k } from "./DashboardNav-
|
|
1
|
+
import { c as e, l as t, s as n, t as r } from "./PageTitle-DCoUQWw6.js";
|
|
2
|
+
import { $t as i, At as a, Cn as o, Ft as s, Gn as ee, Gr as c, Kn as l, S as u, Vr as te, Wn as d, Wr as ne, Yn as f, Z as p, _ as re, c as m, en as h, fi as g, h as _, i as v, ii as y, in as b, kt as x, l as S, m as ie, mn as ae, nn as oe, nt as se, o as C, qn as ce, qr as w, rt as le, s as T, tn as E, u as D, ui as O, xn as ue } from "./TimeZoneField-oIMwb5_X.js";
|
|
3
|
+
import { S as de, t as fe, v as pe, x as k } from "./DashboardNav-CEd8gGPm.js";
|
|
4
4
|
import { Cn as me, In as he, Mn as A, bn as ge, fn as _e, kn as ve } from "./schedule-C13m_kiO.js";
|
|
5
5
|
import { n as ye } from "./chevron-down--LwXEv9w.js";
|
|
6
6
|
import { t as be } from "./arrow-left-DdRja6es.js";
|
|
7
7
|
import "./boxes-DcQnzrdY.js";
|
|
8
|
-
import "./scheduleData-
|
|
9
|
-
import { t as xe } from "./SupportBar-
|
|
10
|
-
import { t as Se } from "./FormNote-
|
|
8
|
+
import "./scheduleData-DR6A-Q7Z.js";
|
|
9
|
+
import { t as xe } from "./SupportBar-DI_XbEsG.js";
|
|
10
|
+
import { t as Se } from "./FormNote-DJ9HBokL.js";
|
|
11
11
|
import { n as Ce, r as we, t as Te } from "./x-hax8aKt8.js";
|
|
12
12
|
import { t as Ee } from "./lock-CeHdSreq.js";
|
|
13
13
|
import { t as De } from "./pencil-CLQlJdep.js";
|
|
14
14
|
import { t as j } from "./plus-BKrt0Qx5.js";
|
|
15
15
|
import { t as Oe } from "./trash-6Wj66gJi.js";
|
|
16
|
-
import { a as ke, l as Ae, p as je } from "./registrationFields-
|
|
17
|
-
import { a as Me, c as M, i as N, l as Ne, n as Pe, o as P, r as F, s as I, t as Fe, u as L } from "./roles-
|
|
18
|
-
import { n as Ie } from "./notices-
|
|
19
|
-
import { t as Le } from "./ConfirmModal-
|
|
20
|
-
import { r as Re, u as ze } from "./recordsKey-
|
|
21
|
-
import { i as Be, o as R } from "./pageFiles-
|
|
16
|
+
import { a as ke, l as Ae, p as je } from "./registrationFields-DdHoMPAQ.js";
|
|
17
|
+
import { a as Me, c as M, i as N, l as Ne, n as Pe, o as P, r as F, s as I, t as Fe, u as L } from "./roles-DiwP6-WQ.js";
|
|
18
|
+
import { n as Ie } from "./notices-CysS7BLF.js";
|
|
19
|
+
import { t as Le } from "./ConfirmModal-BW9e6Y7d.js";
|
|
20
|
+
import { r as Re, u as ze } from "./recordsKey-Cd216nq1.js";
|
|
21
|
+
import { i as Be, o as R } from "./pageFiles-ZFPSCDZz.js";
|
|
22
22
|
import { n as z, t as Ve } from "./personName-DeDpef0M.js";
|
|
23
|
-
import { n as B, t as He } from "./people-
|
|
24
|
-
import { n as Ue } from "./SystemTabContent-
|
|
25
|
-
import { n as We } from "./ownerMail-
|
|
23
|
+
import { n as B, t as He } from "./people-Wk2opW4G.js";
|
|
24
|
+
import { n as Ue } from "./SystemTabContent-CMyT7mDN.js";
|
|
25
|
+
import { n as We } from "./ownerMail-DepG5-Qw.js";
|
|
26
26
|
import { n as Ge, t as Ke } from "./useIsPhone-gAClfVGG.js";
|
|
27
27
|
import { useEffect as qe, useRef as Je, useState as V } from "react";
|
|
28
28
|
import { Fragment as H, jsx as U, jsxs as W } from "react/jsx-runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./TimeZoneField-zR8N2Fj0.cjs`),n=require(`./chevron-down-lyDK1rfL.cjs`),r=require(`./x-Ci8c5p6T.cjs`),i=require(`./mediaKind-ButDya5f.cjs`);let a=require(`react`);a=e.a(a,1);let o=require(`react/jsx-runtime`);var s={name:`film`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]};s.node;var c=n.n(s),l={name:`maximize`,size:24,node:[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]};l.node;var u=n.n(l),d={name:`minimize`,size:24,node:[[`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3`,key:`hohbtr`}],[`path`,{d:`M21 8h-3a2 2 0 0 1-2-2V3`,key:`5jw1f3`}],[`path`,{d:`M3 16h3a2 2 0 0 1 2 2v3`,key:`198tvr`}],[`path`,{d:`M16 21v-3a2 2 0 0 1 2-2h3`,key:`ph8mxp`}]]};d.node;var f=n.n(d),p={name:`pause`,size:24,node:[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]};p.node;var m=n.n(p),h={name:`picture-in-picture-2`,size:24,node:[[`path`,{d:`M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4`,key:`daa4of`}],[`rect`,{width:`10`,height:`7`,x:`12`,y:`13`,rx:`2`,key:`1nb8gs`}]]};h.node;var g=n.n(h),_={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};_.node;var v=n.n(_),y={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};y.node;var b=n.n(y),x={name:`volume-1`,size:24,node:[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}]]};x.node;var S=n.n(x),C={name:`volume-2`,size:24,node:[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]};C.node;var w=n.n(C),T={name:`volume-x`,size:24,node:[[`path`,{d:`M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z`,key:`1p7khw`}],[`path`,{d:`m16.5 14.5 5-5`,key:`cul3yw`}],[`path`,{d:`m16.5 9.5 5 5`,key:`1akey5`}]]};T.node;var ee=n.n(T),te=[.5,.75,1,1.25,1.5,2],E=e=>{let t=Number.isFinite(e)&&e>0?e:0,n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(Math.floor(t%60)).padStart(2,`0`);return n?`${n}:${String(r).padStart(2,`0`)}:${i}`:`${r}:${i}`},D=`w-9 h-9 shrink-0 rounded-full flex items-center justify-center text-white/85 hover:text-white hover:bg-white/15 transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-accent`,ne=`absolute inset-0 m-auto w-16 h-16 md:w-20 md:h-20 rounded-full bg-accent text-[var(--button-fg,#fff)] flex items-center justify-center shadow-2xl shadow-black/40 ring-8 ring-accent/25 hover:scale-105 active:scale-95 transition-transform cursor-pointer outline-none focus-visible:ring-white/70`,re=`relative w-full overflow-hidden rounded-2xl bg-black border border-[var(--panel-border)] shadow-xl`;function O({value:e,max:t,buffered:n=0,onSeek:r,tone:i,label:s,format:c=E,step:l=5}){let u=(0,a.useRef)(null),d=(0,a.useRef)(!1),[f,p]=(0,a.useState)(null),m=e=>{let t=u.current?.getBoundingClientRect();return t&&t.width?Math.min(1,Math.max(0,(e-t.left)/t.width)):0},h=t>0?Math.min(100,e/t*100):0,g=t>0?Math.min(100,n/t*100):0,_=i===`dark`,v=f!==null&&c&&t>0?c(f*t):null;return(0,o.jsxs)(`div`,{ref:u,role:`slider`,tabIndex:0,"aria-label":s,"aria-valuemin":0,"aria-valuemax":Math.round(t)||0,"aria-valuenow":Math.round(e)||0,"aria-valuetext":c?c(e):`${Math.round(h)}%`,className:`group/scrub relative h-4 flex items-center cursor-pointer touch-none outline-none rounded-full focus-visible:ring-2 focus-visible:ring-accent/60`,onPointerDown:e=>{e.stopPropagation(),e.currentTarget.setPointerCapture(e.pointerId),d.current=!0,r(m(e.clientX)*t)},onPointerMove:e=>{p(m(e.clientX)),d.current&&r(m(e.clientX)*t)},onPointerUp:()=>{d.current=!1},onPointerCancel:()=>{d.current=!1},onPointerLeave:()=>p(null),onKeyDown:n=>{let i=n.key;[`ArrowRight`,`ArrowUp`,`ArrowLeft`,`ArrowDown`,`Home`,`End`].includes(i)&&(n.preventDefault(),n.stopPropagation(),r(i===`Home`?0:i===`End`?t:Math.min(t,Math.max(0,e+(i===`ArrowRight`||i===`ArrowUp`?l:-l)))))},children:[(0,o.jsxs)(`div`,{className:`relative w-full h-1 group-hover/scrub:h-1.5 transition-[height] duration-150 rounded-full overflow-hidden ${_?`bg-white/25`:`bg-foreground/10`}`,children:[(0,o.jsx)(`div`,{className:`absolute inset-y-0 left-0 ${_?`bg-white/35`:`bg-foreground/15`}`,style:{width:`${g}%`}}),(0,o.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-accent`,style:{width:`${h}%`}})]}),(0,o.jsx)(`div`,{className:`absolute w-3 h-3 -ml-1.5 rounded-full bg-accent shadow-md scale-0 group-hover/scrub:scale-100 group-focus-visible/scrub:scale-100 transition-transform pointer-events-none`,style:{left:`${h}%`}}),v&&(0,o.jsx)(`div`,{className:`absolute bottom-full mb-2 -translate-x-1/2 px-1.5 py-0.5 rounded-md text-[11px] font-semibold tabular-nums whitespace-nowrap pointer-events-none ${_?`bg-black/80 text-white`:`bg-background text-foreground border border-[var(--panel-border)] shadow`}`,style:{left:`${f*100}%`},children:v})]})}function k({src:e,poster:n,title:i,autoPlay:s,loop:l,muted:d,aspect:p=`16 / 9`,className:h=``,onRatio:_}){let y=(0,a.useRef)(null),x=(0,a.useRef)(null),C=(0,a.useRef)(null),T=(0,a.useRef)(0),[k,A]=(0,a.useState)(!1),[j,M]=(0,a.useState)(!!s),[N,P]=(0,a.useState)(!1),[F,ie]=(0,a.useState)(!1),[I,ae]=(0,a.useState)(!1),[L,oe]=(0,a.useState)(0),[R,se]=(0,a.useState)(0),[ce,le]=(0,a.useState)(0),[z,ue]=(0,a.useState)(1),[B,de]=(0,a.useState)(!!d||!!s),[V,fe]=(0,a.useState)(1),[H,U]=(0,a.useState)(!1),[W,pe]=(0,a.useState)(!1),[me,G]=(0,a.useState)(!0),[K,he]=(0,a.useState)(null),q=(0,a.useCallback)(()=>{G(!0),window.clearTimeout(T.current),T.current=window.setTimeout(()=>G(!1),2600)},[]);(0,a.useEffect)(()=>()=>window.clearTimeout(T.current),[]),(0,a.useEffect)(()=>{let e=()=>pe(!!y.current&&document.fullscreenElement===y.current);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]),(0,a.useEffect)(()=>{if(!H)return;let e=e=>{C.current?.contains(e.target)||U(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[H]);let J=()=>{let e=x.current;e&&(e.paused||e.ended?e.play().catch(()=>{}):e.pause())},Y=e=>{let t=x.current;!t||!Number.isFinite(e)||(t.currentTime=Math.max(0,Math.min(e,Number.isFinite(t.duration)?t.duration:e)),oe(t.currentTime))},X=e=>{let t=x.current;t&&(t.volume=Math.min(1,Math.max(0,e)),t.muted=t.volume===0)},Z=()=>{let e=x.current;e&&(e.muted||e.volume===0?(e.muted=!1,e.volume===0&&(e.volume=.6)):e.muted=!0)},Q=()=>{if(document.fullscreenElement){document.exitFullscreen().catch(()=>{});return}let e=y.current;e?.requestFullscreen?e.requestFullscreen().catch(()=>{}):x.current?.webkitEnterFullscreen?.()},ge=typeof document<`u`&&`pictureInPictureEnabled`in document&&document.pictureInPictureEnabled,_e=async()=>{try{document.pictureInPictureElement?await document.exitPictureInPicture():await x.current?.requestPictureInPicture()}catch{}},ve=e=>{if(e.target!==y.current)return;let t=e.key.toLowerCase();if(t===` `||t===`k`)e.preventDefault(),J();else if(t===`arrowright`)e.preventDefault(),Y(L+5);else if(t===`arrowleft`)e.preventDefault(),Y(L-5);else if(t===`arrowup`)e.preventDefault(),X(z+.1);else if(t===`arrowdown`)e.preventDefault(),X(z-.1);else if(t===`m`)Z();else if(t===`f`)Q();else return;q()},$=!k||me||H,ye=B||z===0?ee:z<.5?S:w,be=n||/#/.test(e)?e:`${e}#t=0.001`,xe=p===`auto`?K?String(K):`16 / 9`:p;return(0,o.jsxs)(`div`,{ref:y,tabIndex:0,role:`region`,"aria-label":i?`Video: ${i}`:`Video player`,onKeyDown:ve,onPointerMove:q,onPointerLeave:()=>{k&&G(!1)},className:`fbos-video group/player ${re} outline-none focus-visible:ring-2 focus-visible:ring-accent ${$?``:`cursor-none`} ${W?`!rounded-none !border-0`:``} ${h}`,style:W?void 0:{aspectRatio:xe},children:[!R&&!I&&(0,o.jsx)(`span`,{"aria-hidden":`true`,className:`fbos-picture-tint fbos-video-tint absolute inset-0`}),(0,o.jsx)(`video`,{ref:x,src:be,poster:n,playsInline:!0,preload:`metadata`,autoPlay:s,loop:l,muted:B,className:`absolute inset-0 w-full h-full object-contain`,onClick:()=>{J(),q()},onDoubleClick:Q,onPlay:()=>{A(!0),M(!0),ie(!1),q()},onPause:()=>{A(!1),G(!0)},onEnded:()=>{ie(!0),A(!1),G(!0)},onTimeUpdate:e=>oe(e.currentTarget.currentTime),onLoadedMetadata:e=>{let t=e.currentTarget;if(se(t.duration),t.videoWidth&&t.videoHeight){let e=t.videoWidth/t.videoHeight;he(e),_?.(e)}},onDurationChange:e=>se(e.currentTarget.duration),onProgress:e=>{let t=e.currentTarget.buffered;t.length&&le(t.end(t.length-1))},onWaiting:()=>P(!0),onPlaying:()=>P(!1),onCanPlay:()=>P(!1),onVolumeChange:e=>{ue(e.currentTarget.volume),de(e.currentTarget.muted)},onRateChange:e=>fe(e.currentTarget.playbackRate),onError:()=>ae(!0)}),i&&!I&&(0,o.jsx)(`div`,{className:`absolute inset-x-0 top-0 px-4 pt-3 pb-10 bg-gradient-to-b from-black/60 to-transparent text-white text-[13px] md:text-[14px] font-semibold truncate pointer-events-none transition-opacity duration-300 ${$?`opacity-100`:`opacity-0`}`,children:i}),I?(0,o.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-2 text-white/75 text-[13px] font-medium text-center px-6`,children:[(0,o.jsx)(c,{className:`w-8 h-8 opacity-60`}),`This video could not be played here.`]}):!k&&!N?(0,o.jsx)(`button`,{type:`button`,onClick:J,"aria-label":F?`Play again`:`Play`,className:ne,children:F?(0,o.jsx)(b,{className:`w-7 h-7 md:w-8 md:h-8`}):(0,o.jsx)(v,{className:`w-7 h-7 md:w-8 md:h-8 translate-x-0.5 fill-current`})}):null,N&&!I&&(0,o.jsx)(r.r,{className:`absolute inset-0 m-auto w-10 h-10 text-white/90 animate-spin pointer-events-none`}),!I&&(0,o.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 px-2.5 md:px-4 pb-1.5 md:pb-2.5 pt-12 bg-gradient-to-t from-black/75 via-black/35 to-transparent transition-opacity duration-300 ${$&&j?`opacity-100`:`opacity-0 pointer-events-none`}`,children:[(0,o.jsx)(O,{value:L,max:R,buffered:ce,onSeek:Y,tone:`dark`,label:`Time`}),(0,o.jsxs)(`div`,{className:`flex items-center gap-0.5 md:gap-1 mt-0.5`,children:[(0,o.jsx)(`button`,{type:`button`,className:D,onClick:J,"aria-label":k?`Pause`:`Play`,children:k?(0,o.jsx)(m,{className:`w-[18px] h-[18px] fill-current`}):(0,o.jsx)(v,{className:`w-[18px] h-[18px] fill-current translate-x-px`})}),(0,o.jsxs)(`div`,{className:`group/vol flex items-center`,children:[(0,o.jsx)(`button`,{type:`button`,className:D,onClick:Z,"aria-label":B?`Turn the sound on`:`Mute`,children:(0,o.jsx)(ye,{className:`w-[18px] h-[18px]`})}),(0,o.jsx)(`div`,{className:`max-sm:hidden w-0 group-hover/vol:w-[76px] group-focus-within/vol:w-[76px] overflow-hidden transition-[width] duration-200`,children:(0,o.jsx)(`div`,{className:`w-[68px] ml-1`,children:(0,o.jsx)(O,{value:B?0:z,max:1,onSeek:X,tone:`dark`,label:`Volume`,format:null,step:.1})})})]}),(0,o.jsxs)(`span`,{className:`px-1.5 text-[12px] md:text-[12.5px] font-semibold text-white/90 tabular-nums whitespace-nowrap select-none`,children:[E(L),` `,(0,o.jsxs)(`span`,{className:`text-white/50`,children:[`/ `,E(R)]})]}),(0,o.jsx)(`div`,{className:`flex-1`}),(0,o.jsxs)(`div`,{ref:C,className:`relative`,children:[(0,o.jsxs)(`button`,{type:`button`,className:`${D} !w-auto px-2.5 text-[12px] font-bold tabular-nums`,onClick:()=>U(e=>!e),"aria-label":`Playback speed`,"aria-expanded":H,children:[V,`×`]}),H&&(0,o.jsx)(`div`,{role:`menu`,className:`absolute bottom-full right-0 mb-2 py-1 min-w-[108px] rounded-xl bg-black/85 backdrop-blur-md border border-white/10 shadow-2xl`,children:te.map(e=>(0,o.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e===V,onClick:()=>{x.current&&(x.current.playbackRate=e),U(!1)},className:`w-full px-3 py-1.5 flex items-center justify-between gap-3 text-left text-[12.5px] font-semibold tabular-nums hover:bg-white/10 cursor-pointer ${e===V?`text-accent`:`text-white/85`}`,children:[e===1?`Normal`:`${e}×`,e===V&&(0,o.jsx)(t.At,{className:`w-3.5 h-3.5`})]},e))})]}),ge&&(0,o.jsx)(`span`,{className:`max-sm:hidden`,children:(0,o.jsx)(`button`,{type:`button`,className:D,onClick:_e,"aria-label":`Picture in picture`,children:(0,o.jsx)(g,{className:`w-[18px] h-[18px]`})})}),(0,o.jsx)(`button`,{type:`button`,className:D,onClick:Q,"aria-label":W?`Leave full screen`:`Full screen`,children:W?(0,o.jsx)(f,{className:`w-[18px] h-[18px]`}):(0,o.jsx)(u,{className:`w-[18px] h-[18px]`})})]})]})]})}function A({src:e,embed:n,title:r,aspect:s=`16 / 9`,autoPlay:c,className:l=``}){let[u,d]=(0,a.useState)(!!c),[f,p]=(0,a.useState)(!1),[m,h]=(0,a.useState)(null);(0,a.useEffect)(()=>{let t=i.i(e);if(!t)return;let n=!0,r=new Image;return r.onload=()=>{n&&r.naturalWidth>121&&h({src:e,url:t})},r.src=t,()=>{n=!1}},[e]);let g=m?.src===e?m.url:null,_=f?null:g||i.r(e),[y,b]=n.split(`#`),x=u?`${y}${y.includes(`?`)?`&`:`?`}autoplay=1${b?`#${b}`:``}`:n;return(0,o.jsx)(`div`,{className:`fbos-video ${re} ${l}`,style:{aspectRatio:s===`auto`?`16 / 9`:s},children:u?(0,o.jsx)(`iframe`,{src:x,title:r||`Video`,className:`absolute inset-0 w-full h-full border-0`,allow:`autoplay; encrypted-media; picture-in-picture; fullscreen; clipboard-write`,allowFullScreen:!0,referrerPolicy:`strict-origin-when-cross-origin`}):(0,o.jsxs)(`button`,{type:`button`,onClick:()=>d(!0),"aria-label":r?`Play ${r}`:`Play the video`,className:`group/facade absolute inset-0 w-full h-full cursor-pointer`,children:[_?(0,o.jsx)(t.O,{src:_,alt:``,className:`absolute inset-0`,onError:()=>p(!0)}):(0,o.jsx)(`span`,{className:`absolute inset-0 bg-gradient-to-br from-accent/30 via-black to-black`}),(0,o.jsx)(`span`,{className:`absolute inset-0 bg-gradient-to-t from-black/55 via-transparent to-black/35`}),r&&(0,o.jsx)(`span`,{className:`absolute left-4 right-4 top-3 text-left text-white text-[14px] font-semibold truncate`,children:r}),(0,o.jsx)(`span`,{className:`${ne} pointer-events-none group-hover/facade:scale-105`,children:(0,o.jsx)(v,{className:`w-7 h-7 md:w-8 md:h-8 translate-x-0.5 fill-current`})})]})})}function j({src:e,title:t,autoPlay:n,loop:r,className:s=``}){let c=(0,a.useRef)(null),[l,u]=(0,a.useState)(!1),[d,f]=(0,a.useState)(0),[p,h]=(0,a.useState)(0),[g,_]=(0,a.useState)(0),[y,b]=(0,a.useState)(!1),[x,S]=(0,a.useState)(1),[C,T]=(0,a.useState)(!1);return(0,o.jsxs)(`div`,{role:`region`,"aria-label":`Recording: ${t||i.s(e)}`,className:`fbos-audio w-full flex items-center gap-3 rounded-2xl border border-[var(--panel-border)] bg-[var(--panel-bg)] px-3 py-2.5 ${s}`,children:[(0,o.jsx)(`audio`,{ref:c,src:e,preload:`metadata`,autoPlay:n,loop:r,className:`hidden`,onPlay:()=>u(!0),onPause:()=>u(!1),onEnded:()=>u(!1),onTimeUpdate:e=>f(e.currentTarget.currentTime),onLoadedMetadata:e=>h(e.currentTarget.duration),onDurationChange:e=>h(e.currentTarget.duration),onProgress:e=>{let t=e.currentTarget.buffered;t.length&&_(t.end(t.length-1))},onVolumeChange:e=>b(e.currentTarget.muted),onRateChange:e=>S(e.currentTarget.playbackRate),onError:()=>T(!0)}),(0,o.jsx)(`button`,{type:`button`,onClick:()=>{let e=c.current;e&&(e.paused?e.play().catch(()=>{}):e.pause())},disabled:C,"aria-label":l?`Pause`:`Play`,className:`w-10 h-10 shrink-0 rounded-full bg-accent text-[var(--button-fg,#fff)] flex items-center justify-center shadow-md hover:scale-105 active:scale-95 transition-transform cursor-pointer disabled:opacity-40`,children:l?(0,o.jsx)(m,{className:`w-4 h-4 fill-current`}):(0,o.jsx)(v,{className:`w-4 h-4 fill-current translate-x-px`})}),(0,o.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,o.jsx)(`span`,{className:`text-[13px] font-semibold text-foreground truncate`,children:t||i.s(e)}),(0,o.jsx)(`span`,{className:`text-[11.5px] font-medium text-foreground/50 tabular-nums whitespace-nowrap`,children:C?`Could not be played`:`${E(d)} / ${E(p)}`})]}),(0,o.jsx)(O,{value:d,max:p,buffered:g,onSeek:e=>{let t=c.current;!t||!Number.isFinite(e)||(t.currentTime=Math.max(0,Math.min(e,Number.isFinite(t.duration)?t.duration:e)),f(t.currentTime))},tone:`theme`,label:`Time`})]}),(0,o.jsxs)(`button`,{type:`button`,onClick:()=>{let e=c.current;if(!e)return;let t=[1,1.25,1.5,2,.75];e.playbackRate=t[(t.indexOf(e.playbackRate)+1)%t.length]||1},"aria-label":`Playback speed`,className:`h-8 px-2 shrink-0 rounded-lg text-[12px] font-bold tabular-nums text-foreground/60 hover:text-foreground hover:bg-foreground/5 transition-colors cursor-pointer`,children:[x,`×`]}),(0,o.jsx)(`button`,{type:`button`,onClick:()=>{c.current&&(c.current.muted=!c.current.muted)},"aria-label":y?`Turn the sound on`:`Mute`,className:`w-8 h-8 shrink-0 rounded-lg flex items-center justify-center text-foreground/60 hover:text-foreground hover:bg-foreground/5 transition-colors cursor-pointer`,children:y?(0,o.jsx)(ee,{className:`w-4 h-4`}):(0,o.jsx)(w,{className:`w-4 h-4`})})]})}function M(e){let t=i.a(e.src);return t?(0,o.jsx)(A,{...e,embed:t}):i.u(e.src,e.type)===`audio`?(0,o.jsx)(j,{...e}):(0,o.jsx)(k,{...e},e.src)}Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return M}});
|
|
1
|
+
const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./TimeZoneField-Ckn1pKAL.cjs`),n=require(`./chevron-down-lyDK1rfL.cjs`),r=require(`./x-Ci8c5p6T.cjs`),i=require(`./mediaKind-ButDya5f.cjs`);let a=require(`react`);a=e.a(a,1);let o=require(`react/jsx-runtime`);var s={name:`film`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]};s.node;var c=n.n(s),l={name:`maximize`,size:24,node:[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]};l.node;var u=n.n(l),d={name:`minimize`,size:24,node:[[`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3`,key:`hohbtr`}],[`path`,{d:`M21 8h-3a2 2 0 0 1-2-2V3`,key:`5jw1f3`}],[`path`,{d:`M3 16h3a2 2 0 0 1 2 2v3`,key:`198tvr`}],[`path`,{d:`M16 21v-3a2 2 0 0 1 2-2h3`,key:`ph8mxp`}]]};d.node;var f=n.n(d),p={name:`pause`,size:24,node:[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]};p.node;var m=n.n(p),h={name:`picture-in-picture-2`,size:24,node:[[`path`,{d:`M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4`,key:`daa4of`}],[`rect`,{width:`10`,height:`7`,x:`12`,y:`13`,rx:`2`,key:`1nb8gs`}]]};h.node;var g=n.n(h),_={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};_.node;var v=n.n(_),y={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};y.node;var b=n.n(y),x={name:`volume-1`,size:24,node:[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}]]};x.node;var S=n.n(x),C={name:`volume-2`,size:24,node:[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]};C.node;var w=n.n(C),T={name:`volume-x`,size:24,node:[[`path`,{d:`M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z`,key:`1p7khw`}],[`path`,{d:`m16.5 14.5 5-5`,key:`cul3yw`}],[`path`,{d:`m16.5 9.5 5 5`,key:`1akey5`}]]};T.node;var ee=n.n(T),te=[.5,.75,1,1.25,1.5,2],E=e=>{let t=Number.isFinite(e)&&e>0?e:0,n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(Math.floor(t%60)).padStart(2,`0`);return n?`${n}:${String(r).padStart(2,`0`)}:${i}`:`${r}:${i}`},D=`w-9 h-9 shrink-0 rounded-full flex items-center justify-center text-white/85 hover:text-white hover:bg-white/15 transition-colors cursor-pointer outline-none focus-visible:ring-2 focus-visible:ring-accent`,ne=`absolute inset-0 m-auto w-16 h-16 md:w-20 md:h-20 rounded-full bg-accent text-[var(--button-fg,#fff)] flex items-center justify-center shadow-2xl shadow-black/40 ring-8 ring-accent/25 hover:scale-105 active:scale-95 transition-transform cursor-pointer outline-none focus-visible:ring-white/70`,re=`relative w-full overflow-hidden rounded-2xl bg-black border border-[var(--panel-border)] shadow-xl`;function O({value:e,max:t,buffered:n=0,onSeek:r,tone:i,label:s,format:c=E,step:l=5}){let u=(0,a.useRef)(null),d=(0,a.useRef)(!1),[f,p]=(0,a.useState)(null),m=e=>{let t=u.current?.getBoundingClientRect();return t&&t.width?Math.min(1,Math.max(0,(e-t.left)/t.width)):0},h=t>0?Math.min(100,e/t*100):0,g=t>0?Math.min(100,n/t*100):0,_=i===`dark`,v=f!==null&&c&&t>0?c(f*t):null;return(0,o.jsxs)(`div`,{ref:u,role:`slider`,tabIndex:0,"aria-label":s,"aria-valuemin":0,"aria-valuemax":Math.round(t)||0,"aria-valuenow":Math.round(e)||0,"aria-valuetext":c?c(e):`${Math.round(h)}%`,className:`group/scrub relative h-4 flex items-center cursor-pointer touch-none outline-none rounded-full focus-visible:ring-2 focus-visible:ring-accent/60`,onPointerDown:e=>{e.stopPropagation(),e.currentTarget.setPointerCapture(e.pointerId),d.current=!0,r(m(e.clientX)*t)},onPointerMove:e=>{p(m(e.clientX)),d.current&&r(m(e.clientX)*t)},onPointerUp:()=>{d.current=!1},onPointerCancel:()=>{d.current=!1},onPointerLeave:()=>p(null),onKeyDown:n=>{let i=n.key;[`ArrowRight`,`ArrowUp`,`ArrowLeft`,`ArrowDown`,`Home`,`End`].includes(i)&&(n.preventDefault(),n.stopPropagation(),r(i===`Home`?0:i===`End`?t:Math.min(t,Math.max(0,e+(i===`ArrowRight`||i===`ArrowUp`?l:-l)))))},children:[(0,o.jsxs)(`div`,{className:`relative w-full h-1 group-hover/scrub:h-1.5 transition-[height] duration-150 rounded-full overflow-hidden ${_?`bg-white/25`:`bg-foreground/10`}`,children:[(0,o.jsx)(`div`,{className:`absolute inset-y-0 left-0 ${_?`bg-white/35`:`bg-foreground/15`}`,style:{width:`${g}%`}}),(0,o.jsx)(`div`,{className:`absolute inset-y-0 left-0 bg-accent`,style:{width:`${h}%`}})]}),(0,o.jsx)(`div`,{className:`absolute w-3 h-3 -ml-1.5 rounded-full bg-accent shadow-md scale-0 group-hover/scrub:scale-100 group-focus-visible/scrub:scale-100 transition-transform pointer-events-none`,style:{left:`${h}%`}}),v&&(0,o.jsx)(`div`,{className:`absolute bottom-full mb-2 -translate-x-1/2 px-1.5 py-0.5 rounded-md text-[11px] font-semibold tabular-nums whitespace-nowrap pointer-events-none ${_?`bg-black/80 text-white`:`bg-background text-foreground border border-[var(--panel-border)] shadow`}`,style:{left:`${f*100}%`},children:v})]})}function k({src:e,poster:n,title:i,autoPlay:s,loop:l,muted:d,aspect:p=`16 / 9`,className:h=``,onRatio:_}){let y=(0,a.useRef)(null),x=(0,a.useRef)(null),C=(0,a.useRef)(null),T=(0,a.useRef)(0),[k,A]=(0,a.useState)(!1),[j,M]=(0,a.useState)(!!s),[N,P]=(0,a.useState)(!1),[F,ie]=(0,a.useState)(!1),[I,ae]=(0,a.useState)(!1),[L,oe]=(0,a.useState)(0),[R,se]=(0,a.useState)(0),[ce,le]=(0,a.useState)(0),[z,ue]=(0,a.useState)(1),[B,de]=(0,a.useState)(!!d||!!s),[V,fe]=(0,a.useState)(1),[H,U]=(0,a.useState)(!1),[W,pe]=(0,a.useState)(!1),[me,G]=(0,a.useState)(!0),[K,he]=(0,a.useState)(null),q=(0,a.useCallback)(()=>{G(!0),window.clearTimeout(T.current),T.current=window.setTimeout(()=>G(!1),2600)},[]);(0,a.useEffect)(()=>()=>window.clearTimeout(T.current),[]),(0,a.useEffect)(()=>{let e=()=>pe(!!y.current&&document.fullscreenElement===y.current);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]),(0,a.useEffect)(()=>{if(!H)return;let e=e=>{C.current?.contains(e.target)||U(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[H]);let J=()=>{let e=x.current;e&&(e.paused||e.ended?e.play().catch(()=>{}):e.pause())},Y=e=>{let t=x.current;!t||!Number.isFinite(e)||(t.currentTime=Math.max(0,Math.min(e,Number.isFinite(t.duration)?t.duration:e)),oe(t.currentTime))},X=e=>{let t=x.current;t&&(t.volume=Math.min(1,Math.max(0,e)),t.muted=t.volume===0)},Z=()=>{let e=x.current;e&&(e.muted||e.volume===0?(e.muted=!1,e.volume===0&&(e.volume=.6)):e.muted=!0)},Q=()=>{if(document.fullscreenElement){document.exitFullscreen().catch(()=>{});return}let e=y.current;e?.requestFullscreen?e.requestFullscreen().catch(()=>{}):x.current?.webkitEnterFullscreen?.()},ge=typeof document<`u`&&`pictureInPictureEnabled`in document&&document.pictureInPictureEnabled,_e=async()=>{try{document.pictureInPictureElement?await document.exitPictureInPicture():await x.current?.requestPictureInPicture()}catch{}},ve=e=>{if(e.target!==y.current)return;let t=e.key.toLowerCase();if(t===` `||t===`k`)e.preventDefault(),J();else if(t===`arrowright`)e.preventDefault(),Y(L+5);else if(t===`arrowleft`)e.preventDefault(),Y(L-5);else if(t===`arrowup`)e.preventDefault(),X(z+.1);else if(t===`arrowdown`)e.preventDefault(),X(z-.1);else if(t===`m`)Z();else if(t===`f`)Q();else return;q()},$=!k||me||H,ye=B||z===0?ee:z<.5?S:w,be=n||/#/.test(e)?e:`${e}#t=0.001`,xe=p===`auto`?K?String(K):`16 / 9`:p;return(0,o.jsxs)(`div`,{ref:y,tabIndex:0,role:`region`,"aria-label":i?`Video: ${i}`:`Video player`,onKeyDown:ve,onPointerMove:q,onPointerLeave:()=>{k&&G(!1)},className:`fbos-video group/player ${re} outline-none focus-visible:ring-2 focus-visible:ring-accent ${$?``:`cursor-none`} ${W?`!rounded-none !border-0`:``} ${h}`,style:W?void 0:{aspectRatio:xe},children:[!R&&!I&&(0,o.jsx)(`span`,{"aria-hidden":`true`,className:`fbos-picture-tint fbos-video-tint absolute inset-0`}),(0,o.jsx)(`video`,{ref:x,src:be,poster:n,playsInline:!0,preload:`metadata`,autoPlay:s,loop:l,muted:B,className:`absolute inset-0 w-full h-full object-contain`,onClick:()=>{J(),q()},onDoubleClick:Q,onPlay:()=>{A(!0),M(!0),ie(!1),q()},onPause:()=>{A(!1),G(!0)},onEnded:()=>{ie(!0),A(!1),G(!0)},onTimeUpdate:e=>oe(e.currentTarget.currentTime),onLoadedMetadata:e=>{let t=e.currentTarget;if(se(t.duration),t.videoWidth&&t.videoHeight){let e=t.videoWidth/t.videoHeight;he(e),_?.(e)}},onDurationChange:e=>se(e.currentTarget.duration),onProgress:e=>{let t=e.currentTarget.buffered;t.length&&le(t.end(t.length-1))},onWaiting:()=>P(!0),onPlaying:()=>P(!1),onCanPlay:()=>P(!1),onVolumeChange:e=>{ue(e.currentTarget.volume),de(e.currentTarget.muted)},onRateChange:e=>fe(e.currentTarget.playbackRate),onError:()=>ae(!0)}),i&&!I&&(0,o.jsx)(`div`,{className:`absolute inset-x-0 top-0 px-4 pt-3 pb-10 bg-gradient-to-b from-black/60 to-transparent text-white text-[13px] md:text-[14px] font-semibold truncate pointer-events-none transition-opacity duration-300 ${$?`opacity-100`:`opacity-0`}`,children:i}),I?(0,o.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-2 text-white/75 text-[13px] font-medium text-center px-6`,children:[(0,o.jsx)(c,{className:`w-8 h-8 opacity-60`}),`This video could not be played here.`]}):!k&&!N?(0,o.jsx)(`button`,{type:`button`,onClick:J,"aria-label":F?`Play again`:`Play`,className:ne,children:F?(0,o.jsx)(b,{className:`w-7 h-7 md:w-8 md:h-8`}):(0,o.jsx)(v,{className:`w-7 h-7 md:w-8 md:h-8 translate-x-0.5 fill-current`})}):null,N&&!I&&(0,o.jsx)(r.r,{className:`absolute inset-0 m-auto w-10 h-10 text-white/90 animate-spin pointer-events-none`}),!I&&(0,o.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 px-2.5 md:px-4 pb-1.5 md:pb-2.5 pt-12 bg-gradient-to-t from-black/75 via-black/35 to-transparent transition-opacity duration-300 ${$&&j?`opacity-100`:`opacity-0 pointer-events-none`}`,children:[(0,o.jsx)(O,{value:L,max:R,buffered:ce,onSeek:Y,tone:`dark`,label:`Time`}),(0,o.jsxs)(`div`,{className:`flex items-center gap-0.5 md:gap-1 mt-0.5`,children:[(0,o.jsx)(`button`,{type:`button`,className:D,onClick:J,"aria-label":k?`Pause`:`Play`,children:k?(0,o.jsx)(m,{className:`w-[18px] h-[18px] fill-current`}):(0,o.jsx)(v,{className:`w-[18px] h-[18px] fill-current translate-x-px`})}),(0,o.jsxs)(`div`,{className:`group/vol flex items-center`,children:[(0,o.jsx)(`button`,{type:`button`,className:D,onClick:Z,"aria-label":B?`Turn the sound on`:`Mute`,children:(0,o.jsx)(ye,{className:`w-[18px] h-[18px]`})}),(0,o.jsx)(`div`,{className:`max-sm:hidden w-0 group-hover/vol:w-[76px] group-focus-within/vol:w-[76px] overflow-hidden transition-[width] duration-200`,children:(0,o.jsx)(`div`,{className:`w-[68px] ml-1`,children:(0,o.jsx)(O,{value:B?0:z,max:1,onSeek:X,tone:`dark`,label:`Volume`,format:null,step:.1})})})]}),(0,o.jsxs)(`span`,{className:`px-1.5 text-[12px] md:text-[12.5px] font-semibold text-white/90 tabular-nums whitespace-nowrap select-none`,children:[E(L),` `,(0,o.jsxs)(`span`,{className:`text-white/50`,children:[`/ `,E(R)]})]}),(0,o.jsx)(`div`,{className:`flex-1`}),(0,o.jsxs)(`div`,{ref:C,className:`relative`,children:[(0,o.jsxs)(`button`,{type:`button`,className:`${D} !w-auto px-2.5 text-[12px] font-bold tabular-nums`,onClick:()=>U(e=>!e),"aria-label":`Playback speed`,"aria-expanded":H,children:[V,`×`]}),H&&(0,o.jsx)(`div`,{role:`menu`,className:`absolute bottom-full right-0 mb-2 py-1 min-w-[108px] rounded-xl bg-black/85 backdrop-blur-md border border-white/10 shadow-2xl`,children:te.map(e=>(0,o.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e===V,onClick:()=>{x.current&&(x.current.playbackRate=e),U(!1)},className:`w-full px-3 py-1.5 flex items-center justify-between gap-3 text-left text-[12.5px] font-semibold tabular-nums hover:bg-white/10 cursor-pointer ${e===V?`text-accent`:`text-white/85`}`,children:[e===1?`Normal`:`${e}×`,e===V&&(0,o.jsx)(t.At,{className:`w-3.5 h-3.5`})]},e))})]}),ge&&(0,o.jsx)(`span`,{className:`max-sm:hidden`,children:(0,o.jsx)(`button`,{type:`button`,className:D,onClick:_e,"aria-label":`Picture in picture`,children:(0,o.jsx)(g,{className:`w-[18px] h-[18px]`})})}),(0,o.jsx)(`button`,{type:`button`,className:D,onClick:Q,"aria-label":W?`Leave full screen`:`Full screen`,children:W?(0,o.jsx)(f,{className:`w-[18px] h-[18px]`}):(0,o.jsx)(u,{className:`w-[18px] h-[18px]`})})]})]})]})}function A({src:e,embed:n,title:r,aspect:s=`16 / 9`,autoPlay:c,className:l=``}){let[u,d]=(0,a.useState)(!!c),[f,p]=(0,a.useState)(!1),[m,h]=(0,a.useState)(null);(0,a.useEffect)(()=>{let t=i.i(e);if(!t)return;let n=!0,r=new Image;return r.onload=()=>{n&&r.naturalWidth>121&&h({src:e,url:t})},r.src=t,()=>{n=!1}},[e]);let g=m?.src===e?m.url:null,_=f?null:g||i.r(e),[y,b]=n.split(`#`),x=u?`${y}${y.includes(`?`)?`&`:`?`}autoplay=1${b?`#${b}`:``}`:n;return(0,o.jsx)(`div`,{className:`fbos-video ${re} ${l}`,style:{aspectRatio:s===`auto`?`16 / 9`:s},children:u?(0,o.jsx)(`iframe`,{src:x,title:r||`Video`,className:`absolute inset-0 w-full h-full border-0`,allow:`autoplay; encrypted-media; picture-in-picture; fullscreen; clipboard-write`,allowFullScreen:!0,referrerPolicy:`strict-origin-when-cross-origin`}):(0,o.jsxs)(`button`,{type:`button`,onClick:()=>d(!0),"aria-label":r?`Play ${r}`:`Play the video`,className:`group/facade absolute inset-0 w-full h-full cursor-pointer`,children:[_?(0,o.jsx)(t.O,{src:_,alt:``,className:`absolute inset-0`,onError:()=>p(!0)}):(0,o.jsx)(`span`,{className:`absolute inset-0 bg-gradient-to-br from-accent/30 via-black to-black`}),(0,o.jsx)(`span`,{className:`absolute inset-0 bg-gradient-to-t from-black/55 via-transparent to-black/35`}),r&&(0,o.jsx)(`span`,{className:`absolute left-4 right-4 top-3 text-left text-white text-[14px] font-semibold truncate`,children:r}),(0,o.jsx)(`span`,{className:`${ne} pointer-events-none group-hover/facade:scale-105`,children:(0,o.jsx)(v,{className:`w-7 h-7 md:w-8 md:h-8 translate-x-0.5 fill-current`})})]})})}function j({src:e,title:t,autoPlay:n,loop:r,className:s=``}){let c=(0,a.useRef)(null),[l,u]=(0,a.useState)(!1),[d,f]=(0,a.useState)(0),[p,h]=(0,a.useState)(0),[g,_]=(0,a.useState)(0),[y,b]=(0,a.useState)(!1),[x,S]=(0,a.useState)(1),[C,T]=(0,a.useState)(!1);return(0,o.jsxs)(`div`,{role:`region`,"aria-label":`Recording: ${t||i.s(e)}`,className:`fbos-audio w-full flex items-center gap-3 rounded-2xl border border-[var(--panel-border)] bg-[var(--panel-bg)] px-3 py-2.5 ${s}`,children:[(0,o.jsx)(`audio`,{ref:c,src:e,preload:`metadata`,autoPlay:n,loop:r,className:`hidden`,onPlay:()=>u(!0),onPause:()=>u(!1),onEnded:()=>u(!1),onTimeUpdate:e=>f(e.currentTarget.currentTime),onLoadedMetadata:e=>h(e.currentTarget.duration),onDurationChange:e=>h(e.currentTarget.duration),onProgress:e=>{let t=e.currentTarget.buffered;t.length&&_(t.end(t.length-1))},onVolumeChange:e=>b(e.currentTarget.muted),onRateChange:e=>S(e.currentTarget.playbackRate),onError:()=>T(!0)}),(0,o.jsx)(`button`,{type:`button`,onClick:()=>{let e=c.current;e&&(e.paused?e.play().catch(()=>{}):e.pause())},disabled:C,"aria-label":l?`Pause`:`Play`,className:`w-10 h-10 shrink-0 rounded-full bg-accent text-[var(--button-fg,#fff)] flex items-center justify-center shadow-md hover:scale-105 active:scale-95 transition-transform cursor-pointer disabled:opacity-40`,children:l?(0,o.jsx)(m,{className:`w-4 h-4 fill-current`}):(0,o.jsx)(v,{className:`w-4 h-4 fill-current translate-x-px`})}),(0,o.jsxs)(`div`,{className:`flex-1 min-w-0 flex flex-col`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,o.jsx)(`span`,{className:`text-[13px] font-semibold text-foreground truncate`,children:t||i.s(e)}),(0,o.jsx)(`span`,{className:`text-[11.5px] font-medium text-foreground/50 tabular-nums whitespace-nowrap`,children:C?`Could not be played`:`${E(d)} / ${E(p)}`})]}),(0,o.jsx)(O,{value:d,max:p,buffered:g,onSeek:e=>{let t=c.current;!t||!Number.isFinite(e)||(t.currentTime=Math.max(0,Math.min(e,Number.isFinite(t.duration)?t.duration:e)),f(t.currentTime))},tone:`theme`,label:`Time`})]}),(0,o.jsxs)(`button`,{type:`button`,onClick:()=>{let e=c.current;if(!e)return;let t=[1,1.25,1.5,2,.75];e.playbackRate=t[(t.indexOf(e.playbackRate)+1)%t.length]||1},"aria-label":`Playback speed`,className:`h-8 px-2 shrink-0 rounded-lg text-[12px] font-bold tabular-nums text-foreground/60 hover:text-foreground hover:bg-foreground/5 transition-colors cursor-pointer`,children:[x,`×`]}),(0,o.jsx)(`button`,{type:`button`,onClick:()=>{c.current&&(c.current.muted=!c.current.muted)},"aria-label":y?`Turn the sound on`:`Mute`,className:`w-8 h-8 shrink-0 rounded-lg flex items-center justify-center text-foreground/60 hover:text-foreground hover:bg-foreground/5 transition-colors cursor-pointer`,children:y?(0,o.jsx)(ee,{className:`w-4 h-4`}):(0,o.jsx)(w,{className:`w-4 h-4`})})]})}function M(e){let t=i.a(e.src);return t?(0,o.jsx)(A,{...e,embed:t}):i.u(e.src,e.type)===`audio`?(0,o.jsx)(j,{...e}):(0,o.jsx)(k,{...e},e.src)}Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return M}});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as e, i as t, r as n, s as r, u as i } from "./mediaKind-BtaMpGy8.js";
|
|
2
|
-
import { At as a, O as o } from "./TimeZoneField-
|
|
2
|
+
import { At as a, O as o } from "./TimeZoneField-oIMwb5_X.js";
|
|
3
3
|
import { n as s } from "./chevron-down--LwXEv9w.js";
|
|
4
4
|
import { r as c } from "./x-hax8aKt8.js";
|
|
5
5
|
import { useCallback as l, useEffect as u, useRef as d, useState as f } from "react";
|