1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/settings-DzxxN8Yi.js","assets/vendor-pdf-DksyQ9Qr.js","assets/rolldown-runtime-Cql5ZV07.js","assets/vendor-utils-DiM3BD4o.js","assets/vendor-twilio-BWAG7uEQ.js","assets/vendor-charts-D81iZKCV.js","assets/vendor-redux-CLEI5hTp.js","assets/vendor-lucide-EY3Z5fcy.js","assets/vendor-mixpanel-Dh8wsiZW.js","assets/vendor-react-HZz3WA9p.js","assets/vendor-dnd-D_JGdZnv.js","assets/biz-icon-BHlHk8WD.js","assets/ping-one-CpLVEVLd.js","assets/app-storage-slice-mFVFfzPf.js","assets/device-CBwMusKw.js","assets/integrations-DXZtn6wp.js","assets/vendor-date-d6_4rWHy.js","assets/vendor-ui-G6aSO5L-.js","assets/vendor-tanstack-N3AJtZOe.js","assets/vendor-tiptap-_i5A4X7p.js","assets/button-BWyXpawe.js","assets/alert-dialog-DqgZ-9QP.js","assets/label-BU8XDazs.js","assets/dates-B2P7D4-n.js","assets/driver-app-splash-CtgTS8Ac.js","assets/dist-Bh07-69G.js","assets/app-breadcrumb-C_0-hj4G.js","assets/breadcrumb-DaQ4spt4.js","assets/page-DjksvvDH.js","assets/use-fleet-permission-otVvJqAQ.js","assets/settings-personal-profile-D3BaD9MB.js","assets/vendor-form-DCqShb_y.js","assets/password-field-DnTxtWsq.js","assets/spin-Bjb5hq6_.js","assets/profile-service-Dr5sIh12.js","assets/area-DK7oSQ7j.js","assets/regex-C8eU81Av.js","assets/strings-dAFeDkjR.js","assets/settings-company-profile-DOjb4xaB.js","assets/operators-permission-B1N2BjTs.js","assets/operators-service-Bm7gmDVg.js","assets/add-operators-CdpbJKuL.js","assets/driver-info-add-BBxWP9yH.js","assets/permission-setting-qWrOg_Xc.js","assets/premission-CHwgNWNS.js","assets/driver-permission-CJuLNxHU.js","assets/radio-group-DEh2WG4M.js","assets/permission-setting-form-fNXBzOFM.js","assets/checkbox-field-Bhc3M4dB.js","assets/select-multiple-Cw2fNSBe.js","assets/routing-profile-B2AlIg_I.js","assets/address-book-Xrx6AqG2.js","assets/vendor-maps-1lAD1rp9.js","assets/markers-Dqkq5E8S.js","assets/poi-od04TUaf.js","assets/marker-tQkMpDnD.js","assets/checkbox-group-BcQiMlUj.js","assets/highlight-query-C8rGVgio.js","assets/route-style-36mhJxRu.js","assets/map-default-controls-Cg-QqICw.js","assets/button-group-BAAxXGl0.js","assets/address-book-poi-group-list-Dc1shLu6.js","assets/address-book-service-BvEDI2nF.js","assets/here-service-BnskO8xY.js","assets/address-book-import-CqY4whmI.js","assets/document-upload-CFFEvI8B.js","assets/progress-BMT-Tsbj.js","assets/settings-sso-C6007Mzx.js","assets/upload-field.utils-D6MOo_v7.js","assets/settings-sso.constants-Wi3LENBC.js","assets/settings-sso-azure-ad-DbHAhPU2.js","assets/setup-form-layout--TVmI94p.js","assets/settings-sso-ping-one-Cwli6-8k.js","assets/settings-sso-duo-BDvkvuOc.js","assets/settings-sso-google-ke4jaWgI.js","assets/document-upload-H5V5QdR-.js","assets/upload-field-_uA03Ut7.js","assets/settings-sso-okta-BPCNrmH2.js","assets/settings-sso-cyber-ark-iRz2CK-4.js","assets/routing-profile-C5eeXCkA.js","assets/confirm-dialog-CtBbl_Do.js","assets/routing-profile.utils-OpZWAeTY.js","assets/routing-profile-new-B_YGL1na.js","assets/number-field-Dxe2TK1R.js","assets/input-number-DboDBRGc.js","assets/leave-confirmation-alert-dialog-B154i1bw.js","assets/map-polyline-icons-4RowtU-L.js","assets/toggle-group-THklAHjp.js","assets/toggle-dkWcMWXB.js","assets/use-here-revgeocode-Cg2vftYi.js","assets/here-flexible-polyline-CkLVKbma.js","assets/trucks-B8Yy1wJq.js","assets/trucks-schema-Do42dNqO.js","assets/trucks-service-DYtLsyHk.js","assets/trucks-form-Cihv_BHf.js","assets/command-D1zQBHjo.js","assets/scroll-area-DFVujIwJ.js","assets/trucks-helper-BXQ4OZnq.js","assets/trucks-view-JyvPRnIa.js","assets/hooks-D28ke8RY.js","assets/pdf-BGKmZv-x.js","assets/hooks-xMfytmYm.css","assets/terminals-on6TBLkp.js","assets/terminals-service-C5yhnzod.js","assets/terminals-detail-H8z25OHW.js","assets/subscription-and-billing-D8r6rTzu.js","assets/vendor-stripe-Bm0uAhM8.js","assets/edit-YWRE7aOK.js","assets/card-service-BOYGocoL.js","assets/manage-seats-Co1KI_rp.js","assets/manage-seats-C2pfIAde.js","assets/subscription-plan-D6RXsPzj.js","assets/counter-DfnV4SDz.js","assets/number-utils-BFbtjl5G.js","assets/settings-dialer-ChXUvGvq.js","assets/drivers-Cx6k8Dey.js","assets/vendor-nim-DNL8ztpi.js","assets/filter-select-D8dJOkhj.js","assets/trips-detail
1s-CB5VSABe.js","assets/map-trip-BHmtbu7x.js","assets/use-map-trip-BnNvO0V0.js","assets/connect-account-dialogs.config-N6qmpDJx.js","assets/driver-service-DR_Z8LWd.js","assets/eld-service-BvxS-QDM.js","assets/driver-type-header-BH2OI1v0.js","assets/drivers-list.utils-2pKPqiPu.js","assets/use-driver-form-options-BVaQhqsQ.js","assets/generate-mixed-BuweQD5H.js","assets/drivers-new-iEU0Wrvr.js","assets/drivers-types-popover-Dopha0y8.js","assets/drivers-details-edit-zMBFDzbe.js","assets/drivers-details-owner-lists-dialog-BlaweM9F.js","assets/drivers-details-BOlAJ8qC.js","assets/drivers-details-overview-JnkFHU4I.js","assets/map-service-0jSVooY2.js","assets/location-refresh-VEHp6AYS.js","assets/drivers-details-trip-history-WzEvXYc5.js","assets/use-driver-performance-fuel-model-DeK8-Ozz.js","assets/fuel-price-service-BqRwZM13.js","assets/drivers-details-documents-DyC0hNQP.js","assets/document-header-filters-CAkqv-CV.js","assets/drivers-groups-new-BTXR4jJ1.js","assets/drivers-groups-form-BWyIL8Oa.js","assets/driver-groups-service-DFt1LvWy.js","assets/terminal-groups-service-CJzysrqa.js","assets/drivers-groups-edit-oBSZXFUk.js","assets/out-of-route-alert-CHVlHKM9.js","assets/alert-time-picker-BVKjQvk0.js","assets/map-BphFm1ih.js","assets/load-board.trip-handoff-PlPOKxqi.js","assets/info-collection-DVaXKswO.js","assets/brands-Ci09J8Nd.js","assets/sign-up-service-ChpkZoxj.js","assets/trips-Cp8Uw6Bm.js","assets/fuel-network-Q8zhRwyB.js","assets/fuel-network-settings-DseT91o4.js","assets/documents-e456Q8Ti.js","assets/driver-performance-BdSLZMRN.js","assets/load-board-DC5rEFiU.js","assets/marketplace-DxOsDLPH.js","assets/marketplace-eld-integrations-BXk5_b0b.js","assets/release-history-4ocrt1pJ.js","assets/fleet-logo-with-text-DBrUWQu2.js","assets/login-DvzPtAZo.js","assets/phone-validation-BEbI_lFZ.js","assets/orders-C3f6JvtP.js","assets/onboarding-layout-DboOkGun.js","assets/free-trial-success-Cr9-eylz.js","assets/sms-link-sender-CR7QSY9U.js","assets/free-trial-fleet-user-success-BCYubhmX.js","assets/confirm-change-email-BHyL4MV0.js"])))=>i.map(i=>d[i]); 2import { a as __toESM } from "./rolldown-runtime-Cql5ZV07.js"; 3import "./src-CC0OeqYt.js"; 4import { f as clsx, p as require_react } from "./vendor-charts-D81iZKCV.js"; 5import { _ as require_client, a as Navigate, c as isRouteErrorResponse, f as useNavigate, g as require_compiler_runtime, h as useSearchParams, m as useRouteError, n as RouterProvider2, o as Outlet, r as Link, s as createBrowserRouter, t as require_jsx_runtime, u as useLocation } from "./vendor-react-HZz3WA9p.js"; 6import "./vendor-dnd-D_JGdZnv.js"; 7import { t as mixpanel } from "./vendor-mixpanel-Dh8wsiZW.js"; 8import { t as getDeviceType } from "./device-CBwMusKw.js"; 9import { C as Provider_default, S as PersistGate, T as useSelector, _ as isFulfilled, a as FLUSH, b as createSelector, c as PURGE, d as createApi, f as fetchBaseQuery, g as createSlice, h as configureStore, i as persistReducer, l as REGISTER, n as require_storage, o as PAUSE, p as setupListeners, r as persistStore, s as PERSIST, u as REHYDRATE, v as isRejected, w as useDispatch, x as combineReducers, y as isRejectedWithValue } from "./vendor-redux-CLEI5hTp.js"; 10import { y as __vitePreload } from "./vendor-pdf-DksyQ9Qr.js"; 11import { A as usePrevious_default, C as require_bytes, D as useSize_default, L as useDebounce_default, O as configResponsive, U as css, f as isFunction, j as useInViewport_default, k as useResponsive_default, l as require_cropper, m as omit, p as pick, u as useDropzone, v as groupBy, x as get, z as useCountDown_default } from "./vendor-utils-DiM3BD4o.js"; 12import { $ as Icon, $t as Trigger$3, A as Trigger$5, At as Fallback, Bt as Arrow2, Ct as RadioGroup2, D as Content$1, Dt as SubContent2, E as Thumb$1, Et as Sub2, Ft as Root2, Gt as Trigger, Ht as Portal$1, It as Trigger$1, J as Ht, Jt as Description, Kt as Close, Lt as CollapsibleContent$1, Mt as Root$3, Nt as Content2$1, O as List, Ot as SubTrigger2, Pt as Portal$2, Q as Content2$3, Qt as Title, Rt as CollapsibleTrigger$1, St as Portal2, T as Root$5, Tt as Root2$1, Ut as Provider$2, Vt as Content2, Wt as Root3, X as ko, Xt as Portal, Y as Uo, Yt as Overlay, Zt as Root$1, an as useComposedRefs, at as ScrollDownButton, bt as Item2, ct as Value, dt as Root$4, et as Item$1, ft as Thumb, gt as Content2$2, ht as CheckboxIndicator, it as Root2$2, jt as Image$1, k as Root2$3, kt as Trigger$2, lt as Viewport, mt as Checkbox$1, nn as Root, nt as ItemText, on as J, ot as ScrollUpButton, pt as Track, q as Ho, qt as Content, rn as Slot, rt as Portal$3, st as Trigger$4, tn as useLayoutEffect2, tt as ItemIndicator, ut as Range, wt as RadioItem2, xt as ItemIndicator2, zt as Root$2 } from "./vendor-ui-G6aSO5L-.js"; 13import { n as toast } from "./dist-Bh07-69G.js"; 14import { t as Toaster } from "./sonner-DW8cmEcR.js"; 15import { $ as PanelLeft, An as ChevronDown, C as Star, Cn as ChevronsUpDown, D as Speech, Dn as ChevronUp, En as ChevronsDown, F as Settings, G as Plus, I as Search, In as Bug, J as PhoneOutgoing, K as Play, Mt as Headset, Nn as CalendarSearch, O as Sparkles, On as ChevronRight, Ot as Info, Pt as Grip, Qt as EllipsisVertical, Sn as CircleAlert, Tn as ChevronsLeft, X as PencilLine, Y as Pencil, Z as Pause, Zt as Ellipsis, _t as LogOut, a as Voicemail, b as Trash2, bn as CircleCheck, bt as Loader, cn as Clock, ct as MicOff, d as UserCog, fn as Circle, gn as CircleQuestionMark, it as Minus, jn as Check, kn as ChevronLeft, kt as Image, l as UserRound, ln as Clock8, n as X, nn as Crop, ot as Minim
15ize2, p as Upload, pn as CircleX, pt as Maximize2, q as Phone, rt as MonitorSmartphone, st as Mic, t as Zap, u as UserPlus, un as ClipboardPen, v as TriangleAlert, vn as CircleMinus, w as Square, wn as ChevronsRight, xt as LoaderCircle } from "./vendor-lucide-EY3Z5fcy.js"; 16import { a as cn, i as Spinner, n as buttonVariants, o as getCSSVar, r as T, t as Button } from "./button-BWyXpawe.js"; 17import { n as Device, t as Call } from "./vendor-twilio-BWAG7uEQ.js"; 18import { t as fleet_logo_with_text_default } from "./fleet-logo-with-text-DBrUWQu2.js"; 19import { i as audio_recording_default, r as send_messages_default, t as BizIcon } from "./biz-icon-BHlHk8WD.js"; 20import "./ping-one-CpLVEVLd.js"; 21import "./vendor-tiptap-_i5A4X7p.js"; 22import { a as decodeBase64, i as setUserToken, n as selectUserToken, o as decryptAES, r as setTpKeys, s as encryptAES, t as appStorageSlice } from "./app-storage-slice-mFVFfzPf.js"; 23import { t as require_NIM_Web_NIM } from "./vendor-nim-DNL8ztpi.js"; 24import { c as normalizePhone, i as formatPhone, l as parsePhoneNumber, n as combiningStrings, o as getInitials, s as getNumberValue } from "./strings-dAFeDkjR.js"; 25import { S as startOfDay, c as isToday, g as endOfDay, n as getDefaultClassNames, s as subDays, t as DayPicker, w as addMilliseconds } from "./vendor-date-d6_4rWHy.js"; 26import { c as formatMinutesSeconds, f as safeFormatDate, l as getCurrentTimeZone, o as _formatRelativeDay, u as locale } from "./dates-B2P7D4-n.js"; 27import { a as getCoreRowModel, c as getPaginationRowModel, i as createColumnHelper, n as flexRender, o as getExpandedRowModel, r as useReactTable, s as getFilteredRowModel, t as useVirtualizer } from "./vendor-tanstack-N3AJtZOe.js"; 28import { t as Spin } from "./spin-Bjb5hq6_.js"; 29import { _ as Controller, a as booleanType, b as useForm, c as enumType, d as numberType, f as objectType, i as arrayType, m as stringType, n as zod_default, t as t$2, v as FormProvider } from "./vendor-form-DCqShb_y.js"; 30import { t as Label } from "./label-BU8XDazs.js"; 31import { n as RadioGroupItem, t as RadioGroup } from "./radio-group-DEh2WG4M.js"; 32import { a as AlertDialogDescription, c as AlertDialogTitle, i as AlertDialogContent, n as AlertDialogAction, o as AlertDialogFooter, r as AlertDialogCancel, s as AlertDialogHeader, t as AlertDialog } from "./alert-dialog-DqgZ-9QP.js"; 33import { r as APIProvider } from "./vendor-maps-1lAD1rp9.js"; 34var import_client = /* @__PURE__ */ __toESM(require_client()); 35var import_react = /* @__PURE__ */ __toESM(require_react()); 36var state$2 = { initialized: false }; 37const initMixpanel = () => { 38 mixpanel.init("e7faf9dc7135978329a67fbff2a6ebab", { 39 debug: false, 40 track_pageview: false, 41 persistence: "localStorage", 42 ignore_dnt: false 43 }); 44 state$2.initialized = true; 45 registerSuperProperties({ version: "navpro-v2" }); 46}; 47const isInitialized = () => state$2.initialized; 48var isSuperPropertyStore = (value) => typeof value === "object" && value !== null && typeof value.properties === "function"; 49const getSuperProperties = () => { 50 if (!state$2.initialized) return {}; 51 try { 52 const store$1 = mixpanel.persistence; 53 return isSuperPropertyStore(store$1) ? store$1.properties() : {}; 54 } catch { 55 return {}; 56 } 57}; 58const identifyUser = (distinctId, properties) => { 59 if (!state$2.initialized) return; 60 mixpanel.identify(distinctId); 61 mixpanel.people.set(properties); 62}; 63const registerSuperProperties = (properties) => { 64 if (!state$2.initialized) return; 65 mixpanel.register(properties); 66}; 67const unregisterSuperProperties = (keys) => { 68 if (!state$2.initialized) return; 69 keys.forEach((key) => mixpanel.unregister(key)); 70}; 71const trackEvent = (eventName, properties) => { 72 if (!state$2.initialized) return; 73 mixpanel.track(eventName, properties); 74}; 75const trackPageView = (pagePath) => { 76 if (!state$2.initialized) return; 77 mixpanel.track("Page View", { 78 path: pagePath, 79 url: window.location.href 80 }); 81}; 82var state$1 = { 83 initialized: false, 84 measurementId: "" 85}; 86var marketingAttribution = {}; 87var callGtag = (...args) => { 88 try { 89 window.gtag?.(...args); 90 } catch (error) {} 91}; 92const initGoogleAnalytics = () => { 93 const measurementId = "G-5FDBMY56PH"; 94 try { 95 window.dataLayer = window.dataLayer || []; 96 window.gtag = function gtag() { 97 window.dataLayer.push(arguments); 98 }; 99 const script = document.createElement("script"); 100 script.async = true;
101 script.src = `https://www.googletagmanager.com/gtag/js?id=${measurementId}`; 102 document.head.appendChild(script); 103 callGtag("js", /* @__PURE__ */ new Date()); 104 callGtag("config", measurementId, { 105 debug_mode: false, 106 send_page_view: false 107 }); 108 state$1.measurementId = measurementId; 109 state$1.initialized = true; 110 } catch (error) {} 111}; 112const isGoogleAnalyticsInitialized = () => state$1.initialized; 113const setGoogleAnalyticsAttribution = (attribution) => { 114 marketingAttribution = attribution; 115}; 116const trackGAEvent = (eventName, properties) => { 117 if (!state$1.initialized) return; 118 callGtag("event", eventName, { 119 ...marketingAttribution, 120 ...properties 121 }); 122}; 123const trackGAPageView = (pagePath) => { 124 if (!state$1.initialized) return; 125 callGtag("event", "page_view", { 126 ...marketingAttribution, 127 page_path: pagePath, 128 page_location: window.location.href 129 }); 130}; 131const setGAUser = (userId, properties) => { 132 if (!state$1.initialized) return; 133 callGtag("config", state$1.measurementId, { user_id: userId }); 134 if (properties) callGtag("set", "user_properties", properties); 135}; 136var STORAGE_KEY = "navproMarketingUtm"; 137var UTM_PREFIX = "utm_"; 138var EXTRA_ATTRIBUTION_KEYS = [ 139 "gclid", 140 "page", 141 "placement" 142]; 143var LEGACY_MARKETING_UTM_KEYS = [ 144 "source", 145 "content", 146 "medium", 147 "campaign", 148 "term", 149 "sourceLink" 150]; 151var DEFAULT_UTM_SOURCE = "NavPro"; 152var readStored = () => { 153 try { 154 const raw = localStorage.getItem(STORAGE_KEY); 155 return raw ? JSON.parse(raw) : {}; 156 } catch { 157 return {}; 158 } 159}; 160var persist = (attribution) => { 161 try { 162 localStorage.setItem(STORAGE_KEY, JSON.stringify(attribution)); 163 } catch {} 164}; 165var readFromUrl = () => { 166 const params = new URLSearchParams(window.location.search); 167 const fromUrl = {}; 168 for (const [rawKey, value] of params.entries()) { 169 const key = rawKey.toLowerCase(); 170 if (value && key.startsWith(UTM_PREFIX)) fromUrl[key] = value; 171 } 172 for (const key of EXTRA_ATTRIBUTION_KEYS) { 173 const value = params.get(key) ?? params.get(key.toUpperCase()); 174 if (value) fromUrl[key] = value; 175 } 176 return fromUrl; 177}; 178const captureMarketingAttribution = () => { 179 const attribution = { 180 ...readStored(), 181 ...readFromUrl() 182 }; 183 persist(attribution); 184 return attribution; 185}; 186var toMarketingUtmKey = (utmKey) => utmKey.toLowerCase().slice(4).replace(/_+([a-z0-9])/g, (_, char) => char.toUpperCase()); 187var pickUtmParams = (properties) => { 188 const utmParams = {}; 189 for (const [rawKey, value] of Object.entries(properties)) { 190 const key = rawKey.toLowerCase(); 191 if (!key.startsWith(UTM_PREFIX)) continue; 192 if (typeof value !== "string" || value === "") continue; 193 utmParams[key] = value; 194 } 195 return utmParams; 196}; 197const buildMarketingUtm = () => { 198 const fromMixpanel = pickUtmParams(getSuperProperties()); 199 const recorded = Object.keys(fromMixpanel).length > 0 ? fromMixpanel : pickUtmParams(readStored()); 200 const payload = {}; 201 for (const key of LEGACY_MARKETING_UTM_KEYS) payload[key] = ""; 202 for (const [key, value] of Object.entries(recorded)) payload[toMarketingUtmKey(key)] = value; 203 payload.source = recorded[`${UTM_PREFIX}source`] ?? DEFAULT_UTM_SOURCE; 204 return payload; 205}; 206const initAnalytics = () => { 207 initMixpanel(); 208 initGoogleAnalytics(); 209 const attribution = { 210 ...captureMarketingAttribution(), 211 device_type: getDeviceType() 212 }; 213 registerSuperProperties(attribution); 214 setGoogleAnalyticsAttribution(attribution); 215}; 216const isAnalyticsActive = () => isInitialized() || isGoogleAnalyticsInitialized(); 217const track = (eventName, properties) => { 218 trackEvent(eventName, properties); 219 trackGAEvent(eventName, properties); 220}; 221const trackPage = (pagePath) => { 222 trackPageView(pagePath); 223 trackGAPageView(pagePath); 224}; 225const identify = (distinctId, properties) => { 226 identifyUser(distinctId, properties); 227 setGAUser(distinctId, properties); 228}; 229var import_compiler_runtime$146 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 230var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime()); 231function RootErrorPage() { 232 const $ = (0, import_compiler_runtime$146.c)(7); 233 const error = useRouteError(); 234 let errorMessage; 235 if (isRouteErrorResponse(error)) { 236 errorMessage = error.statusText || "Unknown Error"; 237 if (error.status === 404) errorMessage = "Sorry, the page you are looking for does not exist."; 238 } else if (error instanceof Error) errorMessage = error.message; 239 else if (typeof error === "string") errorMessage = error; 240 else errorMessage = "An unknown error occurred.";
241 let t0; 242 let t1; 243 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 244 t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { 245 className: "mb-5 text-6xl font-bold text-red-600", 246 children: "OOPS!" 247 }); 248 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 249 className: "mt-4 text-lg text-gray-700", 250 children: "An error occurred." 251 }); 252 $[0] = t0; 253 $[1] = t1; 254 } else { 255 t0 = $[0]; 256 t1 = $[1]; 257 } 258 let t2; 259 if ($[2] !== errorMessage) { 260 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 261 className: "mt-2 font-bold text-gray-500", 262 children: errorMessage 263 }); 264 $[2] = errorMessage; 265 $[3] = t2; 266 } else t2 = $[3]; 267 let t3; 268 if ($[4] === Symbol.for("react.memo_cache_sentinel")) { 269 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, { 270 to: "/", 271 className: "mt-6 text-blue-500 hover:underline", 272 replace: true, 273 children: "Go back to the home page" 274 }); 275 $[4] = t3; 276 } else t3 = $[4]; 277 let t4; 278 if ($[5] !== t2) { 279 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 280 id: "error-page", 281 className: "flex min-h-screen flex-col items-center justify-center bg-gray-50 p-8", 282 children: [ 283 t0, 284 t1, 285 t2, 286 t3 287 ] 288 }); 289 $[5] = t2; 290 $[6] = t4; 291 } else t4 = $[6]; 292 return t4; 293} 294var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value; 295const cx = clsx; 296const cva = (base, config) => (props) => { 297 var _config_compoundVariants; 298 if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className); 299 const { variants, defaultVariants } = config; 300 const getVariantClassNames = Object.keys(variants).map((variant) => { 301 const variantProp = props === null || props === void 0 ? void 0 : props[variant]; 302 const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant]; 303 if (variantProp === null) return null; 304 const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp); 305 return variants[variant][variantKey]; 306 }); 307 const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => { 308 let [key, value] = param; 309 if (value === void 0) return acc; 310 acc[key] = value; 311 return acc; 312 }, {}); 313 const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param) => { 314 let { class: cvClass, className: cvClassName,...compoundVariantOptions } = param; 315 return Object.entries(compoundVariantOptions).every((param$1) => { 316 let [key, value] = param$1; 317 return Array.isArray(value) ? value.includes({ 318 ...defaultVariants, 319 ...propsWithoutUndefined 320 }[key]) : { 321 ...defaultVariants, 322 ...propsWithoutUndefined 323 }[key] === value; 324 }) ? [ 325 ...acc, 326 cvClass, 327 cvClassName 328 ] : acc; 329 }, []); 330 return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className); 331}; 332var import_compiler_runtime$145 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 333var MOBILE_BREAKPOINT = 768; 334function useIsMobile() { 335 const $ = (0, import_compiler_runtime$145.c)(2); 336 const [isMobile, setIsMobile] = import_react.useState(void 0); 337 let t0; 338 let t1; 339 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 340 t0 = () => { 341 const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`); 342 const onChange = () => { 343 setIsMobile(window.innerWidth < MOBILE_BREAKPOINT); 344 }; 345 mql.addEventListener("change", onChange); 346 setIsMobile(window.innerWidth < MOBILE_BREAKPOINT); 347 return () => mql.removeEventListener("change", onChange); 348 }; 349 t1 = []; 350 $[0] = t0; 351 $[1] = t1; 352 } else { 353 t0 = $[0]; 354 t1 = $[1]; 355 } 356 import_react.useEffect(t0, t1); 357 return !!isMobile; 358} 359var import_compiler_runtime$144 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 360function Input(t0) { 361 const $ = (0, import_compiler_runtime$144.c)(24); 362 let className; 363 let prefixIcon; 364 let props; 365 let ref; 366 let suffixIcon; 367 let type; 368 if ($[0] !== t0) { 369 ({className, type, ref, prefixIcon, suffixIcon, ...props} = t0); 370 $[0] = t0; 371 $[1] = className; 372 $[2] = prefixIcon; 373 $[3] = props; 374 $[4] = ref; 375 $[5] = suffixIcon; 376 $[6] = type; 377 } else { 378 className = $[1]; 379 prefixIcon = $[2]; 380 props = $[3]; 381 ref = $[4]; 382 suffixIcon = $[5]; 383 type = $[6]; 384 } 385 const t1 = prefixIcon && "pl-9"; 386 const t2 = suffixIcon && "pr-9"; 387 let t3; 388 if ($[7] !== className || $[8] !== t1 || $[9] !== t2) { 389 t3 = cn("bg-input-field file:bg-input-field h-9 w-full min-w-0 rounded-md border border-input px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "focu
389s-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/20", "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40", className, t1, t2); 390 $[7] = className; 391 $[8] = t1; 392 $[9] = t2; 393 $[10] = t3; 394 } else t3 = $[10]; 395 let t4; 396 if ($[11] !== props || $[12] !== ref || $[13] !== t3 || $[14] !== type) { 397 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { 398 type, 399 ref, 400 "data-slot": "input", 401 className: t3, 402 ...props 403 }); 404 $[11] = props; 405 $[12] = ref; 406 $[13] = t3; 407 $[14] = type; 408 $[15] = t4; 409 } else t4 = $[15]; 410 const input = t4; 411 if (prefixIcon || suffixIcon) { 412 let t5; 413 if ($[16] !== prefixIcon) { 414 t5 = prefixIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 415 className: "pointer-events-none absolute inset-y-0 left-0 flex items-center justify-center pl-3 text-muted-foreground peer-disabled:opacity-50", 416 children: prefixIcon 417 }); 418 $[16] = prefixIcon; 419 $[17] = t5; 420 } else t5 = $[17]; 421 let t6; 422 if ($[18] !== suffixIcon) {
423 t6 = suffixIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 424 className: "absolute inset-y-0 right-0 flex items-center justify-center pr-3 text-muted-foreground peer-disabled:opacity-50", 425 children: suffixIcon 426 }); 427 $[18] = suffixIcon; 428 $[19] = t6; 429 } else t6 = $[19]; 430 let t7; 431 if ($[20] !== input || $[21] !== t5 || $[22] !== t6) { 432 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 433 className: "relative", 434 children: [ 435 t5, 436 input, 437 t6 438 ] 439 }); 440 $[20] = input; 441 $[21] = t5; 442 $[22] = t6; 443 $[23] = t7; 444 } else t7 = $[23]; 445 return t7; 446 } 447 return input; 448} 449var import_compiler_runtime$143 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 450function Separator(t0) { 451 const $ = (0, import_compiler_runtime$143.c)(12); 452 let className; 453 let props; 454 let t1; 455 let t2; 456 if ($[0] !== t0) { 457 ({className, orientation: t1, decorative: t2, ...props} = t0); 458 $[0] = t0; 459 $[1] = className; 460 $[2] = props; 461 $[3] = t1; 462 $[4] = t2; 463 } else { 464 className = $[1]; 465 props = $[2]; 466 t1 = $[3]; 467 t2 = $[4]; 468 } 469 const orientation = t1 === void 0 ? "horizontal" : t1; 470 const decorative = t2 === void 0 ? true : t2; 471 let t3; 472 if ($[5] !== className) { 473 t3 = cn("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px", className); 474 $[5] = className; 475 $[6] = t3; 476 } else t3 = $[6]; 477 let t4; 478 if ($[7] !== decorative || $[8] !== orientation || $[9] !== props || $[10] !== t3) { 479 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root, { 480 "data-slot": "separator", 481 decorative, 482 orientation, 483 className: t3, 484 ...props 485 }); 486 $[7] = decorative; 487 $[8] = orientation; 488 $[9] = props; 489 $[10] = t3; 490 $[11] = t4; 491 } else t4 = $[11]; 492 return t4; 493} 494var import_compiler_runtime$142 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 495function Sheet(t0) { 496 const $ = (0, import_compiler_runtime$142.c)(4); 497 let props; 498 if ($[0] !== t0) { 499 ({...props} = t0); 500 $[0] = t0; 501 $[1] = props; 502 } else props = $[1]; 503 let t1; 504 if ($[2] !== props) { 505 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root$1, { 506 "data-slot": "sheet", 507 ...props 508 }); 509 $[2] = props; 510 $[3] = t1; 511 } else t1 = $[3]; 512 return t1; 513} 514function SheetPortal(t0) { 515 const $ = (0, import_compiler_runtime$142.c)(4); 516 let props; 517 if ($[0] !== t0) { 518 ({...props} = t0); 519 $[0] = t0; 520 $[1] = props; 521 } else props = $[1]; 522 let t1; 523 if ($[2] !== props) { 524 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Portal, { 525 "data-slot": "sheet-portal", 526 ...props 527 }); 528 $[2] = props; 529 $[3] = t1; 530 } else t1 = $[3]; 531 return t1; 532} 533function SheetOverlay(t0) { 534 const $ = (0, import_compiler_runtime$142.c)(10); 535 let className; 536 let props; 537 let t1; 538 if ($[0] !== t0) { 539 ({className, disableAnimation: t1, ...props} = t0); 540 $[0] = t0; 541 $[1] = className; 542 $[2] = props; 543 $[3] = t1; 544 } else { 545 className = $[1]; 546 props = $[2]; 547 t1 = $[3]; 548 } 549 const t2 = !(t1 === void 0 ? false : t1) && "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0"; 550 let t3; 551 if ($[4] !== className || $[5] !== t2) { 552 t3 = cn("fixed inset-0 z-50 bg-black/50", t2, "bg-transparent", className); 553 $[4] = className; 554 $[5] = t2; 555 $[6] = t3; 556 } else t3 = $[6]; 557 let t4; 558 if ($[7] !== props || $[8] !== t3) { 559 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Overlay, { 560 "data-slot": "sheet-overlay", 561 className: t3, 562 ...props 563 }); 564 $[7] = props; 565 $[8] = t3; 566 $[9] = t4; 567 } else t4 = $[9]; 568 return t4; 569} 570function SheetCloseButton(t0) { 571 const $ = (0, import_compiler_runtime$142.c)(6); 572 let props; 573 if ($[0] !== t0) { 574 ({...props} = t0); 575 $[0] = t0; 576 $[1] = props; 577 } else props = $[1]; 578 let t1; 579 let t2; 580 if ($[2] === Symbol.for("react.memo_cache_sentinel")) { 581 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { className: "size-4" }); 582 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 583 className: "sr-only", 584 children: "Close" 585 }); 586 $[2] = t1; 587 $[3] = t2; 588 } else { 589 t1 = $[2]; 590 t2 = $[3]; 591 } 592 let t3; 593 if ($[4] !== props) { 594 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Close, { 595 "data-slot": "sheet-close-button", 596 className: "absolute top-4 right-4 rounded-2xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary", 597 ...props, 598 children: [t1, t2] 599 }); 600 $[4] = props; 601 $[5] = t3; 602 } else t3 = $[5]; 603 return t3; 604} 605function SheetContent(t0) { 606 const $ = (0, import_compiler_runtime$142.c)(30); 607 let children; 608 let className; 609 let props; 610 let t1; 611 let t2; 612 let t3; 613 if ($[0] !== t0) { 614 ({className, children, side: t1, showCloseButton: t2, disableAnimation: t3, ...props} = t0); 615 $[0] = t0; 616 $[1] = children; 617 $[2] = className; 618 $[3] = props; 619 $[4] = t1; 620 $[5] = t2; 621 $[6] = t3; 622 } else { 623 children = $[1]; 624 className = $[2]; 625 props = $[3]; 626 t1 = $[4]; 627 t2 = $[5]; 628 t3 = $[6]; 629 } 630 const side = t1 === void 0 ? "right" : t1; 631 const showCloseButton = t2 === void 0 ? true : t2; 632 const disableAnimation = t3 === void 0 ? false : t3; 633 let t4; 634 if ($[7] !== disableAnimation) { 635 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetOverlay, { disableAnimation }); 636 $[7] = disableAnimation; 637 $[8] = t4; 638 } else t4 = $[8]; 639 const t5 = !disableAnimation && "transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500"; 640 const t6 = side === "right" && "inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm"; 641 const t7 = side === "right" && !disableAnimation && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right"; 642 const t8 = side === "left" && "inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm"; 643 const t9 = side === "left" && !disableAnimation && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left"; 644 const t10 = side === "top" && "inset-x-0 top-0 h-auto border-b"; 645 const t11 = side === "top" && !disableAnimation && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top"; 646 const t12 = side === "bottom" && "inset-x-0 bottom-0 h-auto border-t"; 647 const t13 = side === "bottom" && !disableAnimation && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom"; 648 let t14; 649 if ($[9] !== className || $[10] !== t10 || $[11] !== t11 || $[12] !== t12 || $[13] !== t13 || $[14] !== t5 || $[15] !== t6 || $[16] !== t7 || $[17] !== t8 || $[18] !== t9) { 650 t14 = cn("fixed z-50 flex flex-col gap-4 bg-background shadow-lg", t5, t6, t7, t8, t9, t10, t11, t12, t13, className); 651 $[9] = className; 652 $[10] = t10; 653 $[11] = t11; 654 $[12] = t12; 655 $[13] = t13; 656 $[14] = t5; 657 $[15] = t6; 658 $[16] = t7; 659 $[17] = t8; 660 $[18] = t9; 661 $[19] = t14; 662 } else t14 = $[19]; 663 let t15; 664 if ($[20] !== showCloseButton) {
665 t15 = showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetCloseButton, { "data-slot": "sheet-close-button" }); 666 $[20] = showCloseButton; 667 $[21] = t15; 668 } else t15 = $[21]; 669 let t16; 670 if ($[22] !== children || $[23] !== props || $[24] !== t14 || $[25] !== t15) { 671 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Content, { 672 "data-slot": "sheet-content", 673 className: t14, 674 ...props, 675 children: [children, t15] 676 }); 677 $[22] = children; 678 $[23] = props; 679 $[24] = t14; 680 $[25] = t15; 681 $[26] = t16; 682 } else t16 = $[26]; 683 let t17; 684 if ($[27] !== t16 || $[28] !== t4) { 685 t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SheetPortal, { children: [t4, t16] }); 686 $[27] = t16; 687 $[28] = t4; 688 $[29] = t17; 689 } else t17 = $[29]; 690 return t17; 691} 692function SheetShrinkContent(t0) { 693 const $ = (0, import_compiler_runtime$142.c)(26); 694 let children; 695 let className; 696 let props; 697 let t1; 698 let t2; 699 let t3; 700 if ($[0] !== t0) { 701 ({className, children, side: t1, showCloseButton: t2, disableAnimation: t3, ...props} = t0); 702 $[0] = t0; 703 $[1] = children; 704 $[2] = className; 705 $[3] = props; 706 $[4] = t1; 707 $[5] = t2; 708 $[6] = t3; 709 } else { 710 children = $[1]; 711 className = $[2]; 712 props = $[3]; 713 t1 = $[4]; 714 t2 = $[5]; 715 t3 = $[6]; 716 } 717 const side = t1 === void 0 ? "top-right" : t1; 718 const showCloseButton = t2 === void 0 ? true : t2; 719 const disableAnimation = t3 === void 0 ? false : t3; 720 let t4; 721 if ($[7] !== disableAnimation) { 722 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetOverlay, { disableAnimation }); 723 $[7] = disableAnimation; 724 $[8] = t4; 725 } else t4 = $[8]; 726 const t5 = !disableAnimation && "transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=closed]:zoom-out data-[state=open]:animate-in data-[state=open]:duration-500 data-[state=open]:zoom-in"; 727 const t6 = side === "top-right" && "top-6 right-6"; 728 const t7 = side === "top-left" && "top-6 left-6"; 729 const t8 = side === "bottom-left" && "bottom-6 left-6"; 730 const t9 = side === "bottom-right" && "right-6 bottom-6"; 731 let t10; 732 if ($[9] !== className || $[10] !== t5 || $[11] !== t6 || $[12] !== t7 || $[13] !== t8 || $[14] !== t9) {
733 t10 = cn("fixed z-50 flex flex-col gap-4 rounded-md bg-background px-3 py-4 shadow-lg", t5, t6, t7, t8, t9, className); 734 $[9] = className; 735 $[10] = t5; 736 $[11] = t6; 737 $[12] = t7; 738 $[13] = t8; 739 $[14] = t9; 740 $[15] = t10; 741 } else t10 = $[15]; 742 let t11; 743 if ($[16] !== showCloseButton) { 744 t11 = showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetCloseButton, { "data-slot": "sheet-close-button" }); 745 $[16] = showCloseButton; 746 $[17] = t11; 747 } else t11 = $[17]; 748 let t12; 749 if ($[18] !== children || $[19] !== props || $[20] !== t10 || $[21] !== t11) { 750 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Content, { 751 "data-slot": "sheet-content", 752 className: t10, 753 ...props, 754 children: [children, t11] 755 }); 756 $[18] = children; 757 $[19] = props; 758 $[20] = t10; 759 $[21] = t11; 760 $[22] = t12; 761 } else t12 = $[22]; 762 let t13; 763 if ($[23] !== t12 || $[24] !== t4) { 764 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SheetPortal, { children: [t4, t12] }); 765 $[23] = t12; 766 $[24] = t4; 767 $[25] = t13; 768 } else t13 = $[25]; 769 return t13; 770} 771function SheetHeader(t0) { 772 const $ = (0, import_compiler_runtime$142.c)(8); 773 let className; 774 let props; 775 if ($[0] !== t0) { 776 ({className, ...props} = t0); 777 $[0] = t0; 778 $[1] = className; 779 $[2] = props; 780 } else { 781 className = $[1]; 782 props = $[2]; 783 } 784 let t1; 785 if ($[3] !== className) { 786 t1 = cn("flex flex-col gap-1.5 p-4", className); 787 $[3] = className; 788 $[4] = t1; 789 } else t1 = $[4]; 790 let t2; 791 if ($[5] !== props || $[6] !== t1) { 792 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 793 "data-slot": "sheet-header", 794 className: t1, 795 ...props 796 }); 797 $[5] = props; 798 $[6] = t1; 799 $[7] = t2; 800 } else t2 = $[7]; 801 return t2; 802} 803function SheetTitle(t0) { 804 const $ = (0, import_compiler_runtime$142.c)(8); 805 let className; 806 let props; 807 if ($[0] !== t0) { 808 ({className, ...props} = t0); 809 $[0] = t0; 810 $[1] = className; 811 $[2] = props; 812 } else { 813 className = $[1]; 814 props = $[2]; 815 } 816 let t1; 817 if ($[3] !== className) { 818 t1 = cn("font-semibold text-foreground", className); 819 $[3] = className; 820 $[4] = t1; 821 } else t1 = $[4]; 822 let t2; 823 if ($[5] !== props || $[6] !== t1) { 824 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Title, { 825 "data-slot": "sheet-title", 826 className: t1, 827 ...props 828 }); 829 $[5] = props; 830 $[6] = t1; 831 $[7] = t2; 832 } else t2 = $[7]; 833 return t2; 834} 835function SheetDescription(t0) { 836 const $ = (0, import_compiler_runtime$142.c)(8); 837 let className; 838 let props; 839 if ($[0] !== t0) { 840 ({className, ...props} = t0); 841 $[0] = t0; 842 $[1] = className; 843 $[2] = props; 844 } else { 845 className = $[1]; 846 props = $[2]; 847 } 848 let t1; 849 if ($[3] !== className) { 850 t1 = cn("text-sm text-muted-foreground", className); 851 $[3] = className; 852 $[4] = t1; 853 } else t1 = $[4]; 854 let t2; 855 if ($[5] !== props || $[6] !== t1) { 856 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, { 857 "data-slot": "sheet-description", 858 className: t1, 859 ...props 860 }); 861 $[5] = props; 862 $[6] = t1; 863 $[7] = t2; 864 } else t2 = $[7]; 865 return t2; 866} 867var import_compiler_runtime$141 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 868function Skeleton(t0) { 869 const $ = (0, import_compiler_runtime$141.c)(8); 870 let className; 871 let props; 872 if ($[0] !== t0) { 873 ({className, ...props} = t0); 874 $[0] = t0; 875 $[1] = className; 876 $[2] = props; 877 } else { 878 className = $[1]; 879 props = $[2]; 880 } 881 let t1; 882 if ($[3] !== className) { 883 t1 = cn("animate-pulse rounded-md bg-accent", className); 884 $[3] = className; 885 $[4] = t1; 886 } else t1 = $[4]; 887 let t2; 888 if ($[5] !== props || $[6] !== t1) { 889 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 890 "data-slot": "skeleton", 891 className: t1, 892 ...props 893 }); 894 $[5] = props; 895 $[6] = t1; 896 $[7] = t2; 897 } else t2 = $[7]; 898 return t2; 899} 900var import_compiler_runtime$140 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 901function TooltipProvider(t0) { 902 const $ = (0, import_compiler_runtime$140.c)(6); 903 let props; 904 let t1; 905 if ($[0] !== t0) { 906 ({delayDuration: t1, ...props} = t0); 907 $[0] = t0; 908 $[1] = props; 909 $[2] = t1; 910 } else { 911 props = $[1]; 912 t1 = $[2]; 913 } 914 const delayDuration = t1 === void 0 ? 0 : t1; 915 let t2; 916 if ($[3] !== delayDuration || $[4] !== props) { 917 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider$2, { 918 "data-slot": "tooltip-provider", 919 delayDuration, 920 ...props 921 }); 922 $[3] = delayDuration; 923 $[4] = props; 924 $[5] = t2; 925 } else t2 = $[5]; 926 return t2; 927} 928function Tooltip(t0) { 929 const $ = (0, import_compiler_runtime$140.c)(4); 930 let props; 931 if ($[0] !== t0) { 932 ({...props} = t0); 933 $[0] = t0; 934 $[1] = props; 935 } else props = $[1]; 936 let t1; 937 if ($[2] !== props) { 938 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root3, { 939 "data-slot": "tooltip", 940 ...props 941 }) }); 942 $[2] = props; 943 $[3] = t1; 944 } else t1 = $[3]; 945 return t1; 946} 947function TooltipTrigger(t0) { 948 const $ = (0, import_compiler_runtime$140.c)(4); 949 let props; 950 if ($[0] !== t0) { 951 ({...props} = t0); 952 $[0] = t0; 953 $[1] = props; 954 } else props = $[1]; 955 let t1; 956 if ($[2] !== props) { 957 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trigger, { 958 "data-slot": "tooltip-trigger", 959 ...props 960 }); 961 $[2] = props; 962 $[3] = t1; 963 } else t1 = $[3]; 964 return t1; 965} 966function TooltipContent(t0) { 967 const $ = (0, import_compiler_runtime$140.c)(13); 968 let children; 969 let className; 970 let props; 971 let t1; 972 if ($[0] !== t0) { 973 ({className, sideOffset: t1, children, ...props} = t0); 974 $[0] = t0; 975 $[1] = children; 976 $[2] = className; 977 $[3] = props; 978 $[4] = t1; 979 } else { 980 children = $[1]; 981 className = $[2]; 982 props = $[3]; 983 t1 = $[4]; 984 } 985 const sideOffset = t1 === void 0 ? 0 : t1; 986 let t2; 987 if ($[5] !== className) { 988 t2 = cn("z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
988de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95", className); 989 $[5] = className; 990 $[6] = t2; 991 } else t2 = $[6]; 992 let t3; 993 if ($[7] === Symbol.for("react.memo_cache_sentinel")) { 994 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Arrow2, { className: "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" }); 995 $[7] = t3; 996 } else t3 = $[7]; 997 let t4; 998 if ($[8] !== children || $[9] !== props || $[10] !== sideOffset || $[11] !== t2) { 999 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Portal$1, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Content2, { 1000 "data-slot": "tooltip-content", 1001 sideOffset, 1002 className: t2, 1003 ...props, 1004 children: [children, t3] 1005 }) }); 1006 $[8] = children; 1007 $[9] = props; 1008 $[10] = sideOffset; 1009 $[11] = t2; 1010 $[12] = t4; 1011 } else t4 = $[12]; 1012 return t4; 1013} 1014var TooltipOverflowTrigger = (t0) => { 1015 const $ = (0, import_compiler_runtime$140.c)(21); 1016 let asChild; 1017 let children; 1018 let className; 1019 let props; 1020 let ref; 1021 if ($[0] !== t0) { 1022 ({children, className, asChild, ref, ...props} = t0); 1023 $[0] = t0; 1024 $[1] = asChild; 1025 $[2] = children; 1026 $[3] = className; 1027 $[4] = props; 1028 $[5] = ref; 1029 } else { 1030 asChild = $[1]; 1031 children = $[2]; 1032 className = $[3]; 1033 props = $[4]; 1034 ref = $[5]; 1035 } 1036 const [isOverflowing, setIsOverflowing] = (0, import_react.useState)(false); 1037 const triggerRef = (0, import_react.useRef)(null); 1038 const composedRefs = useComposedRefs(triggerRef, ref); 1039 let t1; 1040 if ($[6] === Symbol.for("react.memo_cache_sentinel")) { 1041 t1 = () => { 1042 const checkOverflow = () => { 1043 const element = triggerRef.current; 1044 if (element) { 1045 const isOverflow = element.scrollWidth > element.clientWidth; 1046 setIsOverflowing(isOverflow); 1047 } 1048 }; 1049 checkOverflow(); 1050 const resizeObserver = new ResizeObserver(checkOverflow); 1051 if (triggerRef.current) resizeObserver.observe(triggerRef.current); 1052 return () => resizeObserver.disconnect(); 1053 }; 1054 $[6] = t1; 1055 } else t1 = $[6]; 1056 let t2; 1057 if ($[7] !== children) { 1058 t2 = [children]; 1059 $[7] = children; 1060 $[8] = t2; 1061 } else t2 = $[8]; 1062 (0, import_react.useEffect)(t1, t2); 1063 if (isOverflowing) { 1064 let t3$1; 1065 if ($[9] !== asChild || $[10] !== children || $[11] !== className || $[12] !== composedRefs || $[13] !== props) { 1066 t3$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 1067 ref: composedRefs, 1068 className, 1069 asChild, 1070 ...props, 1071 children 1072 }); 1073 $[9] = asChild; 1074 $[10] = children; 1075 $[11] = className; 1076 $[12] = composedRefs; 1077 $[13] = props; 1078 $[14] = t3$1; 1079 } else t3$1 = $[14]; 1080 return t3$1; 1081 } 1082 const Comp = asChild ? Slot : "span"; 1083 let t3; 1084 if ($[15] !== Comp || $[16] !== children || $[17] !== className || $[18] !== composedRefs || $[19] !== props) { 1085 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, { 1086 ref: composedRefs, 1087 className, 1088 ...props, 1089 children 1090 }); 1091 $[15] = Comp; 1092 $[16] = children; 1093 $[17] = className; 1094 $[18] = composedRefs; 1095 $[19] = props; 1096 $[20] = t3; 1097 } else t3 = $[20]; 1098 return t3; 1099}; 1100var import_compiler_runtime$139 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 1101var SIDEBAR_COOKIE_NAME = "sidebar_state"; 1102var SIDEBAR_COOKIE_MAX_AGE = 3600 * 24 * 7; 1103var SIDEBAR_WIDTH_MOBILE = "18rem"; 1104var SIDEBAR_WIDTH_ICON = "3rem"; 1105var SIDEBAR_KEYBOARD_SHORTCUT = "b"; 1106var SidebarContext = import_react.createContext(null); 1107function useSidebar() { 1108 const context = import_react.useContext(SidebarContext); 1109 if (!context) throw new Error("useSidebar must be used within a SidebarProvider."); 1110 return context; 1111} 1112function SidebarProvider(t0) { 1113 const $ = (0, import_compiler_runtime$139.c)(36); 1114 let children; 1115 let className; 1116 let openProp; 1117 let props; 1118 let setOpenProp; 1119 let style; 1120 let t1; 1121 if ($[0] !== t0) { 1122 ({defaultOpen: t1, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props} = t0); 1123 $[0] = t0; 1124 $[1] = children; 1125 $[2] = className; 1126 $[3] = openProp; 1127 $[4] = props; 1128 $[5] = setOpenProp; 1129 $[6] = style; 1130 $[7] = t1; 1131 } else { 1132 children = $[1]; 1133 className = $[2]; 1134 openProp = $[3]; 1135 props = $[4]; 1136 setOpenProp = $[5]; 1137 style = $[6]; 1138 t1 = $[7]; 1139 } 1140 const defaultOpen = t1 === void 0 ? false : t1; 1141 const isMobile = useIsMobile(); 1142 const [openMobile, setOpenMobile] = import_react.useState(false); 1143 const [_open, _setOpen] = import_react.useState(defaultOpen); 1144 const open = openProp ?? _open; 1145 let t2; 1146 if ($[8] !== open || $[9] !== setOpenProp) { 1147 t2 = (value) => { 1148 const openState = typeof value === "function" ? value(open) : value; 1149 if (setOpenProp) setOpenProp(openState); 1150 else _setOpen(openState); 1151 document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`; 1152 }; 1153 $[8] = open; 1154 $[9] = setOpenProp; 1155 $[10] = t2; 1156 } else t2 = $[10]; 1157 const setOpen$1 = t2; 1158 let t3; 1159 if ($[11] !== isMobile || $[12] !== setOpen$1) { 1160 t3 = () => isMobile ? setOpenMobile(_temp$28) : setOpen$1(_temp2$14); 1161 $[11] = isMobile; 1162 $[12] = setOpen$1; 1163 $[13] = t3; 1164 } else t3 = $[13]; 1165 const toggleSidebar = t3; 1166 let t4; 1167 let t5; 1168 if ($[14] !== toggleSidebar) { 1169 t4 = () => { 1170 const handleKeyDown = (event) => { 1171 if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) { 1172 event.preventDefault(); 1173 toggleSidebar(); 1174 } 1175 }; 1176 window.addEventListener("keydown", handleKeyDown); 1177 return () => window.removeEventListener("keydown", handleKeyDown); 1178 }; 1179 t5 = [toggleSidebar]; 1180 $[14] = toggleSidebar; 1181 $[15] = t4; 1182 $[16] = t5; 1183 } else { 1184 t4 = $[15]; 1185 t5 = $[16]; 1186 } 1187 import_react.useEffect(t4, t5); 1188 const state$3 = open ? "expanded" : "collapsed"; 1189 let t6; 1190 if ($[17] !== isMobile || $[18] !== open || $[19] !== openMobile || $[20] !== setOpen$1 || $[21] !== state$3 || $[22] !== toggleSidebar) { 1191 t6 = { 1192 state: state$3, 1193 open, 1194 setOpen: setOpen$1, 1195 isMobile, 1196 openMobile, 1197 setOpenMobile, 1198 toggleSidebar 1199 }; 1200 $[17] = isMobile; 1201 $[18] = open; 1202 $[19] = openMobile; 1203 $[20] = setOpen$1; 1204 $[21] = state$3; 1205 $[22] = toggleSidebar; 1206 $[23] = t6; 1207 } else t6 = $[23]; 1208 const contextValue = t6; 1209 let t7; 1210 if ($[24] !== style) { 1211 t7 = { 1212 "--sidebar-width-icon": SIDEBAR_WIDTH_ICON, 1213 ...style 1214 }; 1215 $[24] = style; 1216 $[25] = t7; 1217 } else t7 = $[25]; 1218 const t8 = t7; 1219 let t9; 1220 if ($[26] !== className) { 1221 t9 = cn("group/sidebar-wrapper flex h-svh w-full has-data-[variant=inset]:bg-sidebar", className); 1222 $[26] = className; 1223 $[27] = t9; 1224 } else t9 = $[27]; 1225 let t10; 1226 if ($[28] !== children || $[29] !== props || $[30] !== t8 || $[31] !== t9) { 1227 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipProvider, { 1228 delayDuration: 0, 1229 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 1230 "data-slot": "sidebar-wrapper", 1231 style: t8, 1232 className: t9, 1233 ...props, 1234 children 1235 }) 1236 }); 1237 $[28] = children; 1238 $[29] = props; 1239 $[30] = t8; 1240 $[31] = t9; 1241 $[32] = t10; 1242 } else t10 = $[32]; 1243 let t11; 1244 if ($[33] !== contextValue || $[34] !== t10) { 1245 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarContext.Provider, { 1246 value: contextValue, 1247 children: t10 1248 }); 1249 $[33] = contextValue; 1250 $[34] = t10; 1251 $[35] = t11; 1252 } else t11 = $[35]; 1253 return t11; 1254} 1255function _temp2$14(open_1) { 1256 return !open_1; 1257} 1258function _temp$28(open_0) { 1259 return !open_0; 1260} 1261function Sidebar(t0) { 1262 const $ = (0, import_compiler_runtime$139.c)(46); 1263 let children; 1264 let className; 1265 let props; 1266 let t1; 1267 let t2; 1268 let t3; 1269 if ($[0] !== t0) { 1270 ({side: t1, variant: t2, collapsible: t3, className, children, ...props} = t0); 1271 $[0] = t0; 1272 $[1] = children; 1273 $[2] = className; 1274 $[3] = props; 1275 $[4] = t1; 1276 $[5] = t2; 1277 $[6] = t3; 1278 } else { 1279 children = $[1]; 1280 className = $[2]; 1281 props = $[3]; 1282 t1 = $[4]; 1283 t2 = $[5]; 1284 t3 = $[6]; 1285 } 1286 const side = t1 === void 0 ? "left" : t1; 1287 const variant = t2 === void 0 ? "sidebar" : t2; 1288 const collapsible = t3 === void 0 ? "offcanvas" : t3;
1289 const { isMobile, state: state$3, openMobile, setOpenMobile } = useSidebar(); 1290 if (collapsible === "none") { 1291 let t4$1; 1292 if ($[7] !== className) { 1293 t4$1 = cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", className); 1294 $[7] = className; 1295 $[8] = t4$1; 1296 } else t4$1 = $[8]; 1297 let t5$1; 1298 if ($[9] !== children || $[10] !== props || $[11] !== t4$1) { 1299 t5$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("aside", { 1300 "data-slot": "sidebar", 1301 className: t4$1, 1302 ...props, 1303 children 1304 }); 1305 $[9] = children; 1306 $[10] = props; 1307 $[11] = t4$1; 1308 $[12] = t5$1; 1309 } else t5$1 = $[12]; 1310 return t5$1; 1311 } 1312 if (isMobile) { 1313 let t4$1; 1314 if ($[13] === Symbol.for("react.memo_cache_sentinel")) { 1315 t4$1 = { "--sidebar-width": SIDEBAR_WIDTH_MOBILE }; 1316 $[13] = t4$1; 1317 } else t4$1 = $[13]; 1318 let t5$1; 1319 if ($[14] === Symbol.for("react.memo_cache_sentinel")) { 1320 t5$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SheetHeader, { 1321 className: "sr-only", 1322 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetTitle, { children: "Sidebar" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetDescription, { children: "Displays the mobile sidebar." })] 1323 }); 1324 $[14] = t5$1; 1325 } else t5$1 = $[14]; 1326 let t6$1; 1327 if ($[15] !== children) { 1328 t6$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 1329 className: "flex h-full w-full flex-col", 1330 children 1331 }); 1332 $[15] = children; 1333 $[16] = t6$1; 1334 } else t6$1 = $[16]; 1335 let t7$1; 1336 if ($[17] !== side || $[18] !== t6$1) { 1337 t7$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SheetContent, { 1338 "data-sidebar": "sidebar", 1339 "data-slot": "sidebar", 1340 "data-mobile": "true", 1341 className: "w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden", 1342 style: t4$1, 1343 side, 1344 children: [t5$1, t6$1] 1345 }); 1346 $[17] = side; 1347 $[18] = t6$1; 1348 $[19] = t7$1; 1349 } else t7$1 = $[19]; 1350 let t8$1; 1351 if ($[20] !== openMobile || $[21] !== props || $[22] !== setOpenMobile || $[23] !== t7$1) { 1352 t8$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sheet, { 1353 open: openMobile, 1354 onOpenChange: setOpenMobile, 1355 ...props, 1356 children: t7$1 1357 }); 1358 $[20] = openMobile; 1359 $[21] = props; 1360 $[22] = setOpenMobile; 1361 $[23] = t7$1; 1362 $[24] = t8$1; 1363 } else t8$1 = $[24]; 1364 return t8$1; 1365 } 1366 const t4 = state$3 === "collapsed" ? collapsible : ""; 1367 const t5 = variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"; 1368 let t6; 1369 if ($[25] !== t5) { 1370 t6 = cn("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", t5); 1371 $[25] = t5; 1372 $[26] = t6; 1373 } else t6 = $[26]; 1374 let t7; 1375 if ($[27] !== t6) { 1376 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 1377 "data-slot": "sidebar-gap", 1378 className: t6 1379 }); 1380 $[27] = t6; 1381 $[28] = t7; 1382 } else t7 = $[28]; 1383 const t8 = side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]"; 1384 const t9 = variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l"; 1385 let t10; 1386 if ($[29] !== className || $[30] !== t8 || $[31] !== t9) { 1387 t10 = cn("fixed inset-y-0 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex", t8, t9, className); 1388 $[29] = className; 1389 $[30] = t8; 1390 $[31] = t9; 1391 $[32] = t10; 1392 } else t10 = $[32]; 1393 let t11; 1394 if ($[33] !== children) { 1395 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 1396 "data-sidebar": "sidebar", 1397 "data-slot": "sidebar-inner", 1398 className: "flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow-sm", 1399 children 1400 }); 1401 $[33] = children; 1402 $[34] = t11; 1403 } else t11 = $[34]; 1404 let t12; 1405 if ($[35] !== props || $[36] !== t10 || $[37] !== t11) { 1406 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 1407 "data-slot": "sidebar-container", 1408 className: t10, 1409 ...props, 1410 children: t11 1411 }); 1412 $[35] = props; 1413 $[36] = t10; 1414 $[37] = t11; 1415 $[38] = t12; 1416 } else t12 = $[38]; 1417 let t13; 1418 if ($[39] !== side || $[40] !== state$3 || $[41] !== t12 || $[42] !== t4 || $[43] !== t7 || $[44] !== variant) { 1419 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("aside", { 1420 "data-slot": "sidebar", 1421 className: "group peer hidden text-sidebar-foreground md:block", 1422 "data-state": state$3, 1423 "data-collapsible": t4, 1424 "data-variant": variant, 1425 "data-side": side, 1426 children: [t7, t12] 1427 }); 1428 $[39] = side; 1429 $[40] = state$3; 1430 $[41] = t12; 1431 $[42] = t4; 1432 $[43] = t7; 1433 $[44] = variant; 1434 $[45] = t13; 1435 } else t13 = $[45]; 1436 return t13; 1437} 1438function SidebarTrigger(t0) { 1439 const $ = (0, import_compiler_runtime$139.c)(15); 1440 let className; 1441 let onClick; 1442 let props; 1443 if ($[0] !== t0) { 1444 ({className, onClick, ...props} = t0); 1445 $[0] = t0; 1446 $[1] = className; 1447 $[2] = onClick; 1448 $[3] = props; 1449 } else { 1450 className = $[1]; 1451 onClick = $[2]; 1452 props = $[3]; 1453 } 1454 const { toggleSidebar } = useSidebar(); 1455 let t1; 1456 if ($[4] !== className) { 1457 t1 = cn("size-7 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", className); 1458 $[4] = className; 1459 $[5] = t1; 1460 } else t1 = $[5]; 1461 let t2; 1462 if ($[6] !== onClick || $[7] !== toggleSidebar) { 1463 t2 = (event) => { 1464 onClick?.(event); 1465 toggleSidebar(); 1466 }; 1467 $[6] = onClick; 1468 $[7] = toggleSidebar; 1469 $[8] = t2; 1470 } else t2 = $[8]; 1471 let t3; 1472 let t4; 1473 if ($[9] === Symbol.for("react.memo_cache_sentinel")) { 1474 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PanelLeft, { className: "size-5" }); 1475 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 1476 className: "sr-only", 1477 children: "Toggle Sidebar" 1478 }); 1479 $[9] = t3; 1480 $[10] = t4; 1481 } else { 1482 t3 = $[9]; 1483 t4 = $[10]; 1484 } 1485 let t5; 1486 if ($[11] !== props || $[12] !== t1 || $[13] !== t2) { 1487 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 1488 "data-sidebar": "trigger",
1489 "data-slot": "sidebar-trigger", 1490 variant: "ghost", 1491 size: "icon", 1492 className: t1, 1493 onClick: t2, 1494 ...props, 1495 children: [t3, t4] 1496 }); 1497 $[11] = props; 1498 $[12] = t1; 1499 $[13] = t2; 1500 $[14] = t5; 1501 } else t5 = $[14]; 1502 return t5; 1503} 1504function SidebarInset(t0) { 1505 const $ = (0, import_compiler_runtime$139.c)(8); 1506 let className; 1507 let props; 1508 if ($[0] !== t0) { 1509 ({className, ...props} = t0); 1510 $[0] = t0; 1511 $[1] = className; 1512 $[2] = props; 1513 } else { 1514 className = $[1]; 1515 props = $[2]; 1516 } 1517 let t1; 1518 if ($[3] !== className) { 1519 t1 = cn("relative flex min-h-0 w-full min-w-0 flex-1 flex-col bg-background", "md:peer-data-[variant=inset]:my-2 md:peer-data-[variant=inset]:rounded-s-md md:peer-data-[variant=inset]:shadow-md", "h-svh overflow-hidden md:h-[calc(100svh-calc(var(--spacing)*4))]", "z-1", className); 1520 $[3] = className; 1521 $[4] = t1; 1522 } else t1 = $[4]; 1523 let t2; 1524 if ($[5] !== props || $[6] !== t1) { 1525 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("main", { 1526 "data-slot": "sidebar-inset", 1527 className: t1, 1528 ...props 1529 }); 1530 $[5] = props; 1531 $[6] = t1; 1532 $[7] = t2; 1533 } else t2 = $[7]; 1534 return t2; 1535} 1536function SidebarHeader(t0) { 1537 const $ = (0, import_compiler_runtime$139.c)(8); 1538 let className; 1539 let props; 1540 if ($[0] !== t0) { 1541 ({className, ...props} = t0); 1542 $[0] = t0; 1543 $[1] = className; 1544 $[2] = props; 1545 } else { 1546 className = $[1]; 1547 props = $[2]; 1548 } 1549 let t1; 1550 if ($[3] !== className) { 1551 t1 = cn("flex flex-col gap-2 p-2", className); 1552 $[3] = className; 1553 $[4] = t1; 1554 } else t1 = $[4]; 1555 let t2; 1556 if ($[5] !== props || $[6] !== t1) { 1557 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 1558 "data-slot": "sidebar-header", 1559 "data-sidebar": "header", 1560 className: t1, 1561 ...props 1562 }); 1563 $[5] = props; 1564 $[6] = t1; 1565 $[7] = t2; 1566 } else t2 = $[7]; 1567 return t2; 1568} 1569function SidebarFooter(t0) { 1570 const $ = (0, import_compiler_runtime$139.c)(8); 1571 let className; 1572 let props; 1573 if ($[0] !== t0) { 1574 ({className, ...props} = t0); 1575 $[0] = t0; 1576 $[1] = className; 1577 $[2] = props; 1578 } else { 1579 className = $[1]; 1580 props = $[2]; 1581 } 1582 let t1; 1583 if ($[3] !== className) { 1584 t1 = cn("flex flex-col gap-2 p-2", className); 1585 $[3] = className; 1586 $[4] = t1; 1587 } else t1 = $[4]; 1588 let t2; 1589 if ($[5] !== props || $[6] !== t1) { 1590 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 1591 "data-slot": "sidebar-footer", 1592 "data-sidebar": "footer", 1593 className: t1, 1594 ...props 1595 }); 1596 $[5] = props; 1597 $[6] = t1; 1598 $[7] = t2; 1599 } else t2 = $[7]; 1600 return t2; 1601} 1602function SidebarContent(t0) { 1603 const $ = (0, import_compiler_runtime$139.c)(8); 1604 let className; 1605 let props; 1606 if ($[0] !== t0) { 1607 ({className, ...props} = t0); 1608 $[0] = t0; 1609 $[1] = className; 1610 $[2] = props; 1611 } else { 1612 className = $[1]; 1613 props = $[2]; 1614 } 1615 let t1; 1616 if ($[3] !== className) { 1617 t1 = cn("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className); 1618 $[3] = className; 1619 $[4] = t1; 1620 } else t1 = $[4]; 1621 let t2; 1622 if ($[5] !== props || $[6] !== t1) { 1623 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 1624 "data-slot": "sidebar-content", 1625 "data-sidebar": "content", 1626 className: t1, 1627 ...props 1628 }); 1629 $[5] = props; 1630 $[6] = t1; 1631 $[7] = t2; 1632 } else t2 = $[7]; 1633 return t2; 1634} 1635function SidebarGroup(t0) { 1636 const $ = (0, import_compiler_runtime$139.c)(8); 1637 let className; 1638 let props; 1639 if ($[0] !== t0) { 1640 ({className, ...props} = t0); 1641 $[0] = t0; 1642 $[1] = className; 1643 $[2] = props; 1644 } else { 1645 className = $[1]; 1646 props = $[2]; 1647 } 1648 let t1; 1649 if ($[3] !== className) { 1650 t1 = cn("relative flex w-full min-w-0 flex-col p-2", className); 1651 $[3] = className; 1652 $[4] = t1; 1653 } else t1 = $[4]; 1654 let t2; 1655 if ($[5] !== props || $[6] !== t1) { 1656 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 1657 "data-slot": "sidebar-group", 1658 "data-sidebar": "group", 1659 className: t1, 1660 ...props 1661 }); 1662 $[5] = props; 1663 $[6] = t1; 1664 $[7] = t2; 1665 } else t2 = $[7]; 1666 return t2; 1667} 1668function SidebarGroupContent(t0) { 1669 const $ = (0, import_compiler_runtime$139.c)(8); 1670 let className; 1671 let props; 1672 if ($[0] !== t0) { 1673 ({className, ...props} = t0); 1674 $[0] = t0; 1675 $[1] = className; 1676 $[2] = props; 1677 } else { 1678 className = $[1]; 1679 props = $[2]; 1680 } 1681 let t1; 1682 if ($[3] !== className) { 1683 t1 = cn("w-full text-sm", className); 1684 $[3] = className; 1685 $[4] = t1; 1686 } else t1 = $[4]; 1687 let t2; 1688 if ($[5] !== props || $[6] !== t1) { 1689 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 1690 "data-slot": "sidebar-group-content", 1691 "data-sidebar": "group-content", 1692 className: t1, 1693 ...props 1694 }); 1695 $[5] = props; 1696 $[6] = t1; 1697 $[7] = t2; 1698 } else t2 = $[7]; 1699 return t2; 1700} 1701function SidebarMenu(t0) { 1702 const $ = (0, import_compiler_runtime$139.c)(8); 1703 let className; 1704 let props; 1705 if ($[0] !== t0) { 1706 ({className, ...props} = t0); 1707 $[0] = t0; 1708 $[1] = className; 1709 $[2] = props; 1710 } else { 1711 className = $[1]; 1712 props = $[2]; 1713 } 1714 let t1; 1715 if ($[3] !== className) { 1716 t1 = cn("flex w-full min-w-0 flex-col gap-1", className); 1717 $[3] = className; 1718 $[4] = t1; 1719 } else t1 = $[4]; 1720 let t2; 1721 if ($[5] !== props || $[6] !== t1) { 1722 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { 1723 "data-slot": "sidebar-menu", 1724 "data-sidebar": "menu", 1725 className: t1, 1726 ...props 1727 }); 1728 $[5] = props; 1729 $[6] = t1; 1730 $[7] = t2; 1731 } else t2 = $[7]; 1732 return t2; 1733} 1734function SidebarMenuItem(t0) { 1735 const $ = (0, import_compiler_runtime$139.c)(8); 1736 let className; 1737 let props; 1738 if ($[0] !== t0) { 1739 ({className, ...props} = t0); 1740 $[0] = t0; 1741 $[1] = className; 1742 $[2] = props; 1743 } else { 1744 className = $[1]; 1745 props = $[2]; 1746 } 1747 let t1; 1748 if ($[3] !== className) { 1749 t1 = cn("group/menu-item relative", className); 1750 $[3] = className; 1751 $[4] = t1; 1752 } else t1 = $[4]; 1753 let t2; 1754 if ($[5] !== props || $[6] !== t1) { 1755 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { 1756 "data-slot": "sidebar-menu-item", 1757 "data-sidebar": "menu-item", 1758 className: t1, 1759 ...props 1760 }); 1761 $[5] = props; 1762 $[6] = t1; 1763 $[7] = t2; 1764 } else t2 = $[7]; 1765 return t2; 1766} 1767var sidebarMenuButtonVariants = cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0", { 1768 variants: { 1769 variant: { 1770 default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", 1771 outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]" 1772 }, 1773 size: { 1774 default: "h-8 text-sm", 1775 sm: "h-7 text-xs", 1776 lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!" 1777 } 1778 }, 1779 defaultVariants: { 1780 variant: "default", 1781 size: "default" 1782 } 1783}); 1784function SidebarMenuButton(t0) { 1785 const $ = (0, import_compiler_runtime$139.c)(28); 1786 let className; 1787 let props; 1788 let t1; 1789 let t2; 1790 let t3; 1791 let t4; 1792 let tooltip; 1793 if ($[0] !== t0) { 1794 ({asChild: t1, isActive: t2, variant: t3, size: t4, tooltip, className, ...props} = t0); 1795 $[0] = t0; 1796 $[1] = className; 1797 $[2] = props; 1798 $[3] = t1; 1799 $[4] = t2; 1800 $[5] = t3; 1801 $[6] = t4; 1802 $[7] = tooltip; 1803 } else { 1804 className = $[1]; 1805 props = $[2]; 1806 t1 = $[3]; 1807 t2 = $[4]; 1808 t3 = $[5]; 1809 t4 = $[6]; 1810 tooltip = $[7]; 1811 }
1812 const asChild = t1 === void 0 ? false : t1; 1813 const isActive = t2 === void 0 ? false : t2; 1814 const variant = t3 === void 0 ? "default" : t3; 1815 const size = t4 === void 0 ? "default" : t4; 1816 const Comp = asChild ? Slot : "button"; 1817 const { isMobile, state: state$3 } = useSidebar(); 1818 let t5; 1819 if ($[8] !== className || $[9] !== size || $[10] !== variant) { 1820 t5 = cn(sidebarMenuButtonVariants({ 1821 variant, 1822 size 1823 }), className); 1824 $[8] = className; 1825 $[9] = size; 1826 $[10] = variant; 1827 $[11] = t5; 1828 } else t5 = $[11]; 1829 let t6; 1830 if ($[12] !== Comp || $[13] !== isActive || $[14] !== props || $[15] !== size || $[16] !== t5) { 1831 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, { 1832 "data-slot": "sidebar-menu-button", 1833 "data-sidebar": "menu-button", 1834 "data-size": size, 1835 "data-active": isActive, 1836 className: t5, 1837 ...props 1838 }); 1839 $[12] = Comp; 1840 $[13] = isActive; 1841 $[14] = props; 1842 $[15] = size; 1843 $[16] = t5; 1844 $[17] = t6; 1845 } else t6 = $[17]; 1846 const button = t6; 1847 if (!tooltip) return button; 1848 if (typeof tooltip === "string") { 1849 let t7$1; 1850 if ($[18] !== tooltip) { 1851 t7$1 = { children: tooltip }; 1852 $[18] = tooltip; 1853 $[19] = t7$1; 1854 } else t7$1 = $[19]; 1855 tooltip = t7$1; 1856 } 1857 let t7; 1858 if ($[20] !== button) { 1859 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 1860 asChild: true, 1861 children: button 1862 }); 1863 $[20] = button; 1864 $[21] = t7; 1865 } else t7 = $[21]; 1866 const t8 = state$3 !== "collapsed" || isMobile; 1867 let t9; 1868 if ($[22] !== t8 || $[23] !== tooltip) { 1869 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { 1870 side: "right", 1871 align: "center", 1872 hidden: t8, 1873 ...tooltip 1874 }); 1875 $[22] = t8; 1876 $[23] = tooltip; 1877 $[24] = t9; 1878 } else t9 = $[24]; 1879 let t10; 1880 if ($[25] !== t7 || $[26] !== t9) { 1881 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [t7, t9] }); 1882 $[25] = t7; 1883 $[26] = t9; 1884 $[27] = t10; 1885 } else t10 = $[27]; 1886 return t10; 1887} 1888function SidebarMenuSub(t0) { 1889 const $ = (0, import_compiler_runtime$139.c)(8); 1890 let className; 1891 let props; 1892 if ($[0] !== t0) { 1893 ({className, ...props} = t0); 1894 $[0] = t0; 1895 $[1] = className; 1896 $[2] = props; 1897 } else { 1898 className = $[1]; 1899 props = $[2]; 1900 } 1901 let t1; 1902 if ($[3] !== className) { 1903 t1 = cn("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5", "group-data-[collapsible=icon]:hidden", className); 1904 $[3] = className; 1905 $[4] = t1; 1906 } else t1 = $[4]; 1907 let t2; 1908 if ($[5] !== props || $[6] !== t1) { 1909 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { 1910 "data-slot": "sidebar-menu-sub", 1911 "data-sidebar": "menu-sub", 1912 className: t1, 1913 ...props 1914 }); 1915 $[5] = props; 1916 $[6] = t1; 1917 $[7] = t2; 1918 } else t2 = $[7]; 1919 return t2; 1920} 1921function SidebarMenuSubItem(t0) { 1922 const $ = (0, import_compiler_runtime$139.c)(8); 1923 let className; 1924 let props; 1925 if ($[0] !== t0) { 1926 ({className, ...props} = t0); 1927 $[0] = t0; 1928 $[1] = className; 1929 $[2] = props; 1930 } else { 1931 className = $[1]; 1932 props = $[2]; 1933 } 1934 let t1; 1935 if ($[3] !== className) { 1936 t1 = cn("group/menu-sub-item relative", className); 1937 $[3] = className; 1938 $[4] = t1; 1939 } else t1 = $[4]; 1940 let t2; 1941 if ($[5] !== props || $[6] !== t1) { 1942 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { 1943 "data-slot": "sidebar-menu-sub-item", 1944 "data-sidebar": "menu-sub-item", 1945 className: t1, 1946 ...props 1947 }); 1948 $[5] = props; 1949 $[6] = t1; 1950 $[7] = t2; 1951 } else t2 = $[7]; 1952 return t2; 1953} 1954var import_compiler_runtime$138 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 1955var breadkpoints = [ 1956 "xs", 1957 "sm", 1958 "md", 1959 "lg", 1960 "xl", 1961 "2xl", 1962 "3xl", 1963 "4xl" 1964]; 1965var BREAKPOINTS = { 1966 xs: parseInt(getCSSVar("--breakpoint-xs")) || 0, 1967 sm: parseInt(getCSSVar("--breakpoint-sm")) || 640, 1968 md: parseInt(getCSSVar("--breakpoint-md")) || 768, 1969 lg: parseInt(getCSSVar("--breakpoint-lg")) || 1024, 1970 xl: parseInt(getCSSVar("--breakpoint-xl")) || 1280, 1971 "2xl": parseInt(getCSSVar("--breakpoint-2xl")) || 1440, 1972 "3xl": parseInt(getCSSVar("--breakpoint-3xl")) || 1920, 1973 "4xl": parseInt(getCSSVar("--breakpoint-4xl")) || 2560 1974}; 1975configResponsive(BREAKPOINTS); 1976function useResponsive() { 1977 const $ = (0, import_compiler_runtime$138.c)(5); 1978 const responsive = useResponsive_default(); 1979 let t0; 1980 if ($[0] !== responsive) { 1981 t0 = breadkpoints.findLast((breakpoint) => responsive[breakpoint]) || breadkpoints[0]; 1982 $[0] = responsive; 1983 $[1] = t0; 1984 } else t0 = $[1]; 1985 const current = t0; 1986 let t1; 1987 if ($[2] !== current || $[3] !== responsive) { 1988 t1 = { 1989 current, 1990 ...responsive 1991 }; 1992 $[2] = current; 1993 $[3] = responsive; 1994 $[4] = t1; 1995 } else t1 = $[4]; 1996 return t1; 1997} 1998var SvgFleetLogo = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { 1999 width: 32, 2000 height: 32, 2001 viewBox: "0 0 32 32", 2002 fill: "none", 2003 xmlns: "http://www.w3.org/2000/svg", 2004 ...props, 2005 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 2006 d: "M-0.000488281 32H31.9534V0H-0.000488281V32Z", 2007 fill: "#1688CA" 2008 }
2008), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 2009 d: "M20.8708 8.28793H11.0827V6.14795H7.82306V13.5563H11.0827V11.4163H20.8708V13.5563H24.1305V6.15702H20.8708V8.297V8.28793ZM17.6111 19.0604H20.8708V22.1888H11.0827V19.0604H14.3424V13.9462H17.6021V19.0604H17.6111ZM6.14795 25.843V17.9179L9.40762 19.0695V25.843H6.14795ZM22.5369 25.843V19.0695L25.7965 17.9179V25.843H22.5369Z", 2010 fill: "white" 2011 })] 2012}); 2013var fleet_logo_default = SvgFleetLogo; 2014var import_compiler_runtime$137 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 2015var NavHeader = () => { 2016 const $ = (0, import_compiler_runtime$137.c)(21); 2017 const { open } = useSidebar(); 2018 const triggerLabel = open ? "Close sidebar" : "Open sidebar"; 2019 const t0 = open ? "url('/cursor-arrow-left.svg') 12 12, w-resize" : "url('/cursor-arrow-right.svg') 12 12, e-resize"; 2020 let t1; 2021 if ($[0] !== t0) { 2022 t1 = { cursor: t0 }; 2023 $[0] = t0; 2024 $[1] = t1; 2025 } else t1 = $[1]; 2026 const triggerCursorStyle = t1; 2027 let t2; 2028 if ($[2] === Symbol.for("react.memo_cache_sentinel")) { 2029 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarMenuItem, { 2030 className: "group-data-[collapsible=icon]:hidden", 2031 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, { 2032 to: "/", 2033 className: "flex items-center", 2034 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(fleet_logo_with_text_default, { className: "h-6.5" }) 2035 }) 2036 }); 2037 $[2] = t2; 2038 } else t2 = $[2]; 2039 let t3; 2040 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 2041 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, { 2042 to: "/", 2043 className: "absolute flex items-center justify-center transition-opacity duration-150 group-hover/header:pointer-events-none group-hover/header:opacity-0", 2044 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(fleet_logo_default, { className: "size-6.5" }) 2045 }); 2046 $[3] = t3; 2047 } else t3 = $[3]; 2048 let t4; 2049 if ($[4] !== triggerCursorStyle) { 2050 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 2051 asChild: true, 2052 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarTrigger, { 2053 className: "absolute size-5 rounded-md opacity-0 transition-opacity duration-150 group-hover/header:opacity-70 group-hover/header:[&:hover]:opacity-100", 2054 style: triggerCursorStyle 2055 }) 2056 }); 2057 $[4] = triggerCursorStyle; 2058 $[5] = t4; 2059 } else t4 = $[5]; 2060 let t5; 2061 if ($[6] !== triggerLabel) { 2062 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { 2063 side: "right", 2064 children: triggerLabel 2065 }); 2066 $[6] = triggerLabel; 2067 $[7] = t5; 2068 } else t5 = $[7]; 2069 let t6; 2070 if ($[8] !== t4 || $[9] !== t5) { 2071 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarMenuItem, { 2072 className: "relative hidden size-10 items-center justify-center group-data-[collapsible=icon]:flex", 2073 children: [t3, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [t4, t5] })] 2074 }); 2075 $[8] = t4; 2076 $[9] = t5; 2077 $[10] = t6; 2078 } else t6 = $[10]; 2079 let t7; 2080 if ($[11] !== triggerCursorStyle) { 2081 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 2082 asChild: true, 2083 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarTrigger, { 2084 className: "size-10 rounded-md opacity-70 hover:opacity-100", 2085 style: triggerCursorStyle 2086 }) 2087 }); 2088 $[11] = triggerCursorStyle; 2089 $[12] = t7; 2090 } else t7 = $[12]; 2091 let t8; 2092 if ($[13] !== triggerLabel) { 2093 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { 2094 side: "right", 2095 children: triggerLabel 2096 }); 2097 $[13] = triggerLabel; 2098 $[14] = t8; 2099 } else t8 = $[14]; 2100 let t9; 2101 if ($[15] !== t7 || $[16] !== t8) { 2102 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarMenuItem, { 2103 className: "group-data-[collapsible=icon]:hidden", 2104 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [t7, t8] }) 2105 }); 2106 $[15] = t7; 2107 $[16] = t8; 2108 $[17] = t9; 2109 } else t9 = $[17]; 2110 let t10; 2111 if ($[18] !== t6 || $[19] !== t9) { 2112 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarHeader, { 2113 className: "p-0", 2114 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarGroup, { 2115 className: "p-0", 2116 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarGroupContent, { 2117 className: "p-0", 2118 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarMenu, { 2119 className: "group/header h-16 flex-row items-center justify-between px-3", 2120 children: [ 2121 t2, 2122 t6, 2123 t9 2124 ] 2125 }) 2126 }) 2127 }) 2128 }); 2129 $[18] = t6; 2130 $[19] = t9; 2131 $[20] = t10; 2132 } else t10 = $[20]; 2133 return t10; 2134}; 2135var import_compiler_runtime$136 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 2136function Collapsible(t0) { 2137 const $ = (0, import_compiler_runtime$136.c)(4); 2138 let props; 2139 if ($[0] !== t0) { 2140 ({...props} = t0); 2141 $[0] = t0; 2142 $[1] = props; 2143 } else props = $[1]; 2144 let t1; 2145 if ($[2] !== props) { 2146 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root$2, { 2147 "data-slot": "collapsible", 2148 ...props 2149 }); 2150 $[2] = props; 2151 $[3] = t1; 2152 } else t1 = $[3]; 2153 return t1; 2154} 2155function CollapsibleTrigger(t0) { 2156 const $ = (0, import_compiler_runtime$136.c)(4); 2157 let props; 2158 if ($[0] !== t0) { 2159 ({...props} = t0); 2160 $[0] = t0; 2161 $[1] = props; 2162 } else props = $[1]; 2163 let t1; 2164 if ($[2] !== props) { 2165 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleTrigger$1, { 2166 "data-slot": "collapsible-trigger", 2167 ...props 2168 }); 2169 $[2] = props; 2170 $[3] = t1; 2171 } else t1 = $[3]; 2172 return t1; 2173} 2174function CollapsibleContent(t0) { 2175 const $ = (0, import_compiler_runtime$136.c)(4); 2176 let props; 2177 if ($[0] !== t0) { 2178 ({...props} = t0); 2179 $[0] = t0; 2180 $[1] = props; 2181 } else props = $[1]; 2182 let t1; 2183 if ($[2] !== props) { 2184 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleContent$1, { 2185 "data-slot": "collapsible-content", 2186 ...props 2187 }); 2188 $[2] = props; 2189 $[3] = t1; 2190 } else t1 = $[3]; 2191 return t1; 2192} 2193var import_compiler_runtime$135 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 2194function Popover(t0) { 2195 const $ = (0, import_compiler_runtime$135.c)(4); 2196 let props; 2197 if ($[0] !== t0) { 2198 ({...props} = t0); 2199 $[0] = t0; 2200 $[1] = props; 2201 } else props = $[1]; 2202 let t1; 2203 if ($[2] !== props) { 2204 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root2, { 2205 "data-slot": "popover", 2206 ...props 2207 }); 2208 $[2] = props; 2209 $[3] = t1; 2210 } else t1 = $[3]; 2211 return t1; 2212} 2213function PopoverTrigger(t0) { 2214 const $ = (0, import_compiler_runtime$135.c)(4); 2215 let props; 2216 if ($[0] !== t0) { 2217 ({...props} = t0); 2218 $[0] = t0; 2219 $[1] = props; 2220 } else props = $[1]; 2221 let t1; 2222 if ($[2] !== props) { 2223 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trigger$1, { 2224 "data-slot": "popover-trigger", 2225 ...props 2226 }); 2227 $[2] = props; 2228 $[3] = t1; 2229 } else t1 = $[3]; 2230 return t1; 2231} 2232function PopoverContent(t0) { 2233 const $ = (0, import_compiler_runtime$135.c)(16); 2234 let className; 2235 let container; 2236 let props; 2237 let t1; 2238 let t2; 2239 if ($[0] !== t0) { 2240 ({className, align: t1, sideOffset: t2, container, ...props} = t0); 2241 $[0] = t0; 2242 $[1] = className; 2243 $[2] = container; 2244 $[3] = props; 2245 $[4] = t1; 2246 $[5] = t2; 2247 } else { 2248 className = $[1]; 2249 container = $[2]; 2250 props = $[3]; 2251 t1 = $[4]; 2252 t2 = $[5]; 2253 } 2254 const align = t1 === void 0 ? "center" : t1; 2255 const sideOffset = t2 === void 0 ? 4 : t2; 2256 let t3; 2257 if ($[6] !== className) { 2258 t3 = cn("z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
2258de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", className); 2259 $[6] = className; 2260 $[7] = t3; 2261 } else t3 = $[7]; 2262 let t4; 2263 if ($[8] !== align || $[9] !== props || $[10] !== sideOffset || $[11] !== t3) { 2264 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content2$1, { 2265 "data-slot": "popover-content", 2266 align, 2267 sideOffset, 2268 className: t3, 2269 ...props 2270 }); 2271 $[8] = align; 2272 $[9] = props; 2273 $[10] = sideOffset; 2274 $[11] = t3; 2275 $[12] = t4; 2276 } else t4 = $[12]; 2277 let t5; 2278 if ($[13] !== container || $[14] !== t4) { 2279 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Portal$2, { 2280 container, 2281 children: t4 2282 }); 2283 $[13] = container; 2284 $[14] = t4; 2285 $[15] = t5; 2286 } else t5 = $[15]; 2287 return t5; 2288} 2289var import_compiler_runtime$134 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 2290var NavMenuButton = (t0) => { 2291 const $ = (0, import_compiler_runtime$134.c)(27); 2292 let isActive; 2293 let item; 2294 let rest; 2295 let t1; 2296 let t2; 2297 let t3; 2298 if ($[0] !== t0) { 2299 ({item, isActive, showArrow: t1, asChild: t2, showTooltip: t3, ...rest} = t0); 2300 $[0] = t0; 2301 $[1] = isActive; 2302 $[2] = item; 2303 $[3] = rest; 2304 $[4] = t1; 2305 $[5] = t2; 2306 $[6] = t3; 2307 } else { 2308 isActive = $[1]; 2309 item = $[2]; 2310 rest = $[3]; 2311 t1 = $[4]; 2312 t2 = $[5]; 2313 t3 = $[6]; 2314 } 2315 const showArrow = t1 === void 0 ? false : t1; 2316 const asChild = t2 === void 0 ? false : t2; 2317 const showTooltip = t3 === void 0 ? true : t3; 2318 let t4; 2319 if ($[7] !== item.icon) { 2320 t4 = item.icon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { 2321 className: "size-6", 2322 children: item.icon 2323 }) : null; 2324 $[7] = item.icon; 2325 $[8] = t4; 2326 } else t4 = $[8]; 2327 let t5; 2328 if ($[9] !== item.title) { 2329 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: item.title }); 2330 $[9] = item.title; 2331 $[10] = t5; 2332 } else t5 = $[10]; 2333 let t6; 2334 if ($[11] !== showArrow) {
2335 t6 = showArrow && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, { className: "ml-auto size-4 shrink-0 transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90" }); 2336 $[11] = showArrow; 2337 $[12] = t6; 2338 } else t6 = $[12]; 2339 let t7; 2340 if ($[13] !== t4 || $[14] !== t5 || $[15] !== t6) { 2341 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ 2342 t4, 2343 t5, 2344 t6 2345 ] }); 2346 $[13] = t4; 2347 $[14] = t5; 2348 $[15] = t6; 2349 $[16] = t7; 2350 } else t7 = $[16]; 2351 const content = t7; 2352 const t8 = showTooltip ? item.title : void 0; 2353 let t9; 2354 if ($[17] !== asChild || $[18] !== content || $[19] !== item) { 2355 t9 = asChild && "url" in item ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, { 2356 to: item.url, 2357 children: content 2358 }) : content; 2359 $[17] = asChild; 2360 $[18] = content; 2361 $[19] = item; 2362 $[20] = t9; 2363 } else t9 = $[20]; 2364 let t10; 2365 if ($[21] !== asChild || $[22] !== isActive || $[23] !== rest || $[24] !== t8 || $[25] !== t9) { 2366 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarMenuButton, { 2367 ...rest, 2368 asChild, 2369 tooltip: t8, 2370 isActive, 2371 className: "h-10 gap-3 p-2 font-medium opacity-70 group-data-[collapsible=icon]:size-10! hover:opacity-100 data-[active=true]:font-semibold data-[active=true]:opacity-100", 2372 children: t9 2373 }); 2374 $[21] = asChild; 2375 $[22] = isActive; 2376 $[23] = rest; 2377 $[24] = t8; 2378 $[25] = t9; 2379 $[26] = t10; 2380 } else t10 = $[26]; 2381 return t10; 2382}; 2383const isNavGroup = (item) => { 2384 return "children" in item; 2385}; 2386var import_compiler_runtime$133 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 2387var items = [ 2388 { 2389 title: "Map", 2390 url: "/map", 2391 icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { name: "map" }) 2392 }, 2393 { 2394 title: "Trips", 2395 url: "/trips", 2396 icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { name: "recent-trips" }) 2397 }, 2398 { 2399 title: "Documents", 2400 url: "/documents", 2401 icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { name: "documents" }) 2402 }, 2403 { 2404 title: "Driver Performance", 2405 url: "/driver-performance", 2406 icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { name: "reports" }) 2407 }, 2408 { 2409 title: "Fuel Network", 2410 url: "/fuel-network", 2411 icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { name: "fuel-network" }) 2412 }, 2413 { 2414 title: "Marketplace", 2415 icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { name: "marketplace" }), 2416 children: [{ 2417 title: "Loadboard", 2418 url: "/load-board" 2419 }] 2420 } 2421]; 2422const NavMain = () => { 2423 const $ = (0, import_compiler_runtime$133.c)(9); 2424 const location = useLocation(); 2425 let t0; 2426 if ($[0] !== location) { 2427 t0 = (url) => location.pathname.startsWith(url); 2428 $[0] = location; 2429 $[1] = t0; 2430 } else t0 = $[1]; 2431 const isActive = t0; 2432 let t1; 2433 if ($[2] !== isActive) { 2434 t1 = (item) => item.children.some((child) => isActive(child.url)); 2435 $[2] = isActive; 2436 $[3] = t1; 2437 } else t1 = $[3]; 2438 const hasActiveChild = t1; 2439 let t2; 2440 if ($[4] !== hasActiveChild || $[5] !== isActive) { 2441 t2 = items.map((item_0) => isNavGroup(item_0) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleNavItem, { 2442 item: item_0, 2443 defaultOpen: hasActiveChild(item_0) 2444 }, item_0.title) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarMenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavMenuButton, { 2445 asChild: true, 2446 item: item_0, 2447 isActive: isActive(item_0.url) 2448 }) }, item_0.title)); 2449 $[4] = hasActiveChild; 2450 $[5] = isActive; 2451 $[6] = t2; 2452 } else t2 = $[6]; 2453 let t3; 2454 if ($[7] !== t2) { 2455 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarGroup, { 2456 className: "p-0", 2457 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarGroupContent, { 2458 className: "px-3 pb-1.5", 2459 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarMenu, { 2460 className: "gap-0.5", 2461 children: t2 2462 }) 2463 }) 2464 }) }); 2465 $[7] = t2; 2466 $[8] = t3; 2467 } else t3 = $[8]; 2468 return t3; 2469}; 2470var CollapsibleNavItem = (t0) => { 2471 const $ = (0, import_compiler_runtime$133.c)(41); 2472 const { item, defaultOpen: t1 } = t0; 2473 const defaultOpen = t1 === void 0 ? false : t1; 2474 const { pathname } = useLocation(); 2475 const { state: state$3 } = useSidebar(); 2476 const [popoverOpen, setPopoverOpen] = (0, import_react.useState)(false); 2477 let t2; 2478 if ($[0] !== item.children || $[1] !== pathname) { 2479 let t3$1; 2480 if ($[3] !== pathname) { 2481 t3$1 = (child) => pathname.startsWith(child.url); 2482 $[3] = pathname; 2483 $[4] = t3$1; 2484 } else t3$1 = $[4]; 2485 t2 = item.children.some(t3$1); 2486 $[0] = item.children; 2487 $[1] = pathname; 2488 $[2] = t2; 2489 } else t2 = $[2]; 2490 const isChildActive = t2; 2491 if (state$3 === "collapsed") { 2492 let t3$1; 2493 let t4$1; 2494 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 2495 t3$1 = () => setPopoverOpen(true); 2496 t4$1 = () => setPopoverOpen(false); 2497 $[5] = t3$1; 2498 $[6] = t4$1; 2499 } else { 2500 t3$1 = $[5]; 2501 t4$1 = $[6]; 2502 } 2503 let t5$1; 2504 if ($[7] !== isChildActive || $[8] !== item) { 2505 t5$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverTrigger, { 2506 asChild: true, 2507 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 2508 onMouseEnter: t3$1, 2509 onMouseLeave: t4$1, 2510 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavMenuButton, { 2511 item, 2512 isActive: isChildActive, 2513 showTooltip: false 2514 }) 2515 }) 2516 }); 2517 $[7] = isChildActive; 2518 $[8] = item; 2519 $[9] = t5$1; 2520 } else t5$1 = $[9]; 2521 let t6$1; 2522 let t7$1; 2523 if ($[10] === Symbol.for("react.memo_cache_sentinel")) { 2524 t6$1 = () => setPopoverOpen(true); 2525 t7$1 = () => setPopoverOpen(false); 2526 $[10] = t6$1; 2527 $[11] = t7$1; 2528 } else { 2529 t6$1 = $[10]; 2530 t7$1 = $[11]; 2531 } 2532 let t8; 2533 if ($[12] !== item.title) { 2534 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 2535 className: "px-2 py-1 text-xs text-muted-foreground", 2536 children: item.title 2537 }); 2538 $[12] = item.title; 2539 $[13] = t8; 2540 } else t8 = $[13]; 2541 let t9; 2542 if ($[14] !== item.children || $[15] !== pathname) { 2543 let t10$1; 2544 if ($[17] !== pathname) { 2545 t10$1 = (child_0) => { 2546 const active = pathname.startsWith(child_0.url); 2547 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, { 2548 to: child_0.url, 2549 onClick: () => setPopoverOpen(false), 2550 className: cn("flex h-9 items-center rounded-md px-2 text-sm transition-colors hover:bg-accent", active ? "font-semibold text-accent-foreground" : "font-normal text-popover-foreground"), 2551 children: child_0.title 2552 }, child_0.url); 2553 }; 2554 $[17] = pathname; 2555 $[18] = t10$1; 2556 } else t10$1 = $[18]; 2557 t9 = item.children.map(t10$1); 2558 $[14] = item.children; 2559 $[15] = pathname;
2560 $[16] = t9; 2561 } else t9 = $[16]; 2562 let t10; 2563 if ($[19] !== t9) { 2564 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 2565 className: "flex flex-col gap-0.5", 2566 children: t9 2567 }); 2568 $[19] = t9; 2569 $[20] = t10; 2570 } else t10 = $[20]; 2571 let t11; 2572 if ($[21] !== t10 || $[22] !== t8) { 2573 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PopoverContent, { 2574 side: "right", 2575 align: "start", 2576 sideOffset: 8, 2577 className: "w-44 p-1.5", 2578 onMouseEnter: t6$1, 2579 onMouseLeave: t7$1, 2580 children: [t8, t10] 2581 }); 2582 $[21] = t10; 2583 $[22] = t8; 2584 $[23] = t11; 2585 } else t11 = $[23]; 2586 let t12; 2587 if ($[24] !== popoverOpen || $[25] !== t11 || $[26] !== t5$1) { 2588 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarMenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Popover, { 2589 open: popoverOpen, 2590 onOpenChange: setPopoverOpen, 2591 children: [t5$1, t11] 2592 }) }); 2593 $[24] = popoverOpen; 2594 $[25] = t11; 2595 $[26] = t5$1; 2596 $[27] = t12; 2597 } else t12 = $[27]; 2598 return t12; 2599 } 2600 let t3; 2601 if ($[28] !== item) { 2602 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleTrigger, { 2603 asChild: true, 2604 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavMenuButton, { 2605 item, 2606 showArrow: true 2607 }) 2608 }); 2609 $[28] = item; 2610 $[29] = t3; 2611 } else t3 = $[29]; 2612 let t4; 2613 if ($[30] !== item.children || $[31] !== pathname) { 2614 t4 = item.children?.map((child_1) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarMenuSubItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavMenuButton, { 2615 asChild: true, 2616 item: child_1, 2617 isActive: pathname === child_1.url 2618 }) }, child_1.url)); 2619 $[30] = item.children; 2620 $[31] = pathname; 2621 $[32] = t4; 2622 } else t4 = $[32]; 2623 let t5; 2624 if ($[33] !== t4) { 2625 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarMenuSub, { 2626 className: "mr-0 ml-4 gap-y-0.5 pl-4", 2627 children: t4 2628 }) }); 2629 $[33] = t4; 2630 $[34] = t5; 2631 } else t5 = $[34]; 2632 let t6; 2633 if ($[35] !== t3 || $[36] !== t5) { 2634 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarMenuItem, { children: [t3, t5] }); 2635 $[35] = t3; 2636 $[36] = t5; 2637 $[37] = t6; 2638 } else t6 = $[37]; 2639 let t7; 2640 if ($[38] !== defaultOpen || $[39] !== t6) { 2641 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collapsible, { 2642 className: "group/collapsible", 2643 defaultOpen, 2644 asChild: true, 2645 children: t6 2646 }); 2647 $[38] = defaultOpen; 2648 $[39] = t6; 2649 $[40] = t7; 2650 } else t7 = $[40]; 2651 return t7; 2652}; 2653var EVENT_PREFIX_REGEX = /^(handle|on)([A-Z])/; 2654var SENSITIVE_KEYS = new Set([ 2655 "email", 2656 "phone", 2657 "password", 2658 "token", 2659 "secret", 2660 "authorization", 2661 "ssn", 2662 "otp", 2663 "creditcard", 2664 "creditcardnumber", 2665 "cardnumber", 2666 "cvv", 2667 "accesstoken", 2668 "refreshtoken", 2669 "firstname", 2670 "lastname", 2671 "phonenumber" 2672]); 2673var isSensitiveKey = (key) => { 2674 return SENSITIVE_KEYS.has(key.toLowerCase().replace(/[_-]/g, "")); 2675}; 2676var isEvent = (value) => { 2677 return typeof value === "object" && value !== null && "type" in value && ("target" in value || "currentTarget" in value || "nativeEvent" in value); 2678}; 2679var OMIT = Symbol("omit"); 2680var sanitizeValue = (value, depth) => { 2681 if (depth > 3) return OMIT; 2682 if (value === null || value === void 0) return OMIT; 2683 if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value; 2684 if (typeof value === "function") return OMIT; 2685 if (isEvent(value)) return OMIT; 2686 if (Array.isArray(value)) return value.map((item) => sanitizeValue(item, depth + 1)).filter((item) => item !== OMIT); 2687 if (typeof value === "object") { 2688 const sanitized = {}; 2689 for (const [key, val] of Object.entries(value)) { 2690 if (isSensitiveKey(key)) continue; 2691 const next = sanitizeValue(val, depth + 1); 2692 if (next !== OMIT) sanitized[key] = next; 2693 } 2694 return sanitized; 2695 } 2696 return String(value); 2697}; 2698const sanitizeArgs = (args) => { 2699 return args.map((arg) => sanitizeValue(arg, 0)).filter((arg) => arg !== OMIT); 2700}; 2701var toReadableEventName = (methodName) => { 2702 return methodName.replace(EVENT_PREFIX_REGEX, "$2").replace(/([a-z])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2"); 2703}; 2704const trackMethodCall = (method, _args, _metadata = {}) => { 2705 if (!isAnalyticsActive()) return; 2706 const eventName = toReadableEventName(method);
2707 const pagePath = window.location.pathname; 2708 track(eventName, { 2709 rawMethodName: method, 2710 pagePath 2711 }); 2712}; 2713const AVATAR_BACKGROUND_COLOR_CLASSES = [ 2714 "bg-blue-900", 2715 "bg-cyan-700", 2716 "bg-teal-700", 2717 "bg-green-700", 2718 "bg-sky-700" 2719]; 2720function getAvatarBackgroundColorClass(seed) { 2721 const normalizedSeed = seed ?? ""; 2722 const sum = Array.from(normalizedSeed).reduce((acc, char) => acc + char.charCodeAt(0), 0); 2723 return AVATAR_BACKGROUND_COLOR_CLASSES[sum % AVATAR_BACKGROUND_COLOR_CLASSES.length]; 2724} 2725var import_compiler_runtime$132 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 2726function Avatar(t0) { 2727 const $ = (0, import_compiler_runtime$132.c)(8); 2728 let className; 2729 let props; 2730 if ($[0] !== t0) { 2731 ({className, ...props} = t0); 2732 $[0] = t0; 2733 $[1] = className; 2734 $[2] = props; 2735 } else { 2736 className = $[1]; 2737 props = $[2]; 2738 } 2739 let t1; 2740 if ($[3] !== className) { 2741 t1 = cn("relative flex size-8 shrink-0 overflow-hidden rounded-full", className); 2742 $[3] = className; 2743 $[4] = t1; 2744 } else t1 = $[4]; 2745 let t2; 2746 if ($[5] !== props || $[6] !== t1) { 2747 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root$3, { 2748 "data-slot": "avatar", 2749 className: t1, 2750 ...props 2751 }); 2752 $[5] = props; 2753 $[6] = t1; 2754 $[7] = t2; 2755 } else t2 = $[7]; 2756 return t2; 2757} 2758function AvatarImage(t0) { 2759 const $ = (0, import_compiler_runtime$132.c)(8); 2760 let className; 2761 let props; 2762 if ($[0] !== t0) { 2763 ({className, ...props} = t0); 2764 $[0] = t0; 2765 $[1] = className; 2766 $[2] = props; 2767 } else { 2768 className = $[1]; 2769 props = $[2]; 2770 } 2771 let t1; 2772 if ($[3] !== className) { 2773 t1 = cn("aspect-square size-full", className); 2774 $[3] = className; 2775 $[4] = t1; 2776 } else t1 = $[4]; 2777 let t2; 2778 if ($[5] !== props || $[6] !== t1) { 2779 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Image$1, { 2780 "data-slot": "avatar-image", 2781 className: t1, 2782 ...props 2783 }); 2784 $[5] = props; 2785 $[6] = t1; 2786 $[7] = t2; 2787 } else t2 = $[7]; 2788 return t2; 2789} 2790function AvatarFallback(t0) { 2791 const $ = (0, import_compiler_runtime$132.c)(14); 2792 let className; 2793 let colorSeed; 2794 let props; 2795 if ($[0] !== t0) { 2796 ({className, colorSeed, ...props} = t0); 2797 $[0] = t0; 2798 $[1] = className; 2799 $[2] = colorSeed; 2800 $[3] = props; 2801 } else { 2802 className = $[1]; 2803 colorSeed = $[2]; 2804 props = $[3]; 2805 } 2806 let T0; 2807 let t1; 2808 let t2; 2809 if ($[4] !== className || $[5] !== colorSeed) { 2810 const backgroundColorClass = colorSeed ? getAvatarBackgroundColorClass(colorSeed) : "bg-muted"; 2811 T0 = Fallback; 2812 t1 = "avatar-fallback"; 2813 t2 = cn("flex size-full items-center justify-center rounded-full", backgroundColorClass, className); 2814 $[4] = className; 2815 $[5] = colorSeed; 2816 $[6] = T0; 2817 $[7] = t1; 2818 $[8] = t2; 2819 } else { 2820 T0 = $[6]; 2821 t1 = $[7]; 2822 t2 = $[8]; 2823 } 2824 let t3; 2825 if ($[9] !== T0 || $[10] !== props || $[11] !== t1 || $[12] !== t2) { 2826 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(T0, { 2827 "data-slot": t1, 2828 className: t2, 2829 ...props 2830 }); 2831 $[9] = T0; 2832 $[10] = props; 2833 $[11] = t1; 2834 $[12] = t2; 2835 $[13] = t3; 2836 } else t3 = $[13]; 2837 return t3; 2838} 2839var import_compiler_runtime$131 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 2840function DropdownMenu(t0) { 2841 const $ = (0, import_compiler_runtime$131.c)(4); 2842 let props; 2843 if ($[0] !== t0) { 2844 ({...props} = t0); 2845 $[0] = t0; 2846 $[1] = props; 2847 } else props = $[1]; 2848 let t1; 2849 if ($[2] !== props) { 2850 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root2$1, { 2851 "data-slot": "dropdown-menu", 2852 ...props 2853 }); 2854 $[2] = props; 2855 $[3] = t1; 2856 } else t1 = $[3]; 2857 return t1; 2858} 2859function DropdownMenuTrigger(t0) { 2860 const $ = (0, import_compiler_runtime$131.c)(4); 2861 let props; 2862 if ($[0] !== t0) { 2863 ({...props} = t0); 2864 $[0] = t0; 2865 $[1] = props; 2866 } else props = $[1]; 2867 let t1; 2868 if ($[2] !== props) { 2869 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trigger$2, { 2870 "data-slot": "dropdown-menu-trigger", 2871 ...props 2872 }); 2873 $[2] = props; 2874 $[3] = t1; 2875 } else t1 = $[3]; 2876 return t1; 2877} 2878function DropdownMenuContent(t0) { 2879 const $ = (0, import_compiler_runtime$131.c)(10); 2880 let className; 2881 let props; 2882 let t1; 2883 if ($[0] !== t0) { 2884 ({className, sideOffset: t1, ...props} = t0); 2885 $[0] = t0; 2886 $[1] = className; 2887 $[2] = props; 2888 $[3] = t1; 2889 } else { 2890 className = $[1]; 2891 props = $[2]; 2892 t1 = $[3]; 2893 } 2894 const sideOffset = t1 === void 0 ? 4 : t1; 2895 let t2; 2896 if ($[4] !== className) { 2897 t2 = cn("z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
2897de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", className); 2898 $[4] = className; 2899 $[5] = t2; 2900 } else t2 = $[5]; 2901 let t3; 2902 if ($[6] !== props || $[7] !== sideOffset || $[8] !== t2) { 2903 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Portal2, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content2$2, { 2904 "data-slot": "dropdown-menu-content", 2905 sideOffset, 2906 className: t2, 2907 onWheel: _temp$27, 2908 ...props 2909 }) }); 2910 $[6] = props; 2911 $[7] = sideOffset; 2912 $[8] = t2; 2913 $[9] = t3; 2914 } else t3 = $[9]; 2915 return t3; 2916} 2917function _temp$27(e$4) { 2918 return e$4.stopPropagation(); 2919} 2920function DropdownMenuItem(t0) { 2921 const $ = (0, import_compiler_runtime$131.c)(12); 2922 let className; 2923 let inset; 2924 let props; 2925 let t1; 2926 if ($[0] !== t0) { 2927 ({className, inset, variant: t1, ...props} = t0); 2928 $[0] = t0; 2929 $[1] = className; 2930 $[2] = inset; 2931 $[3] = props; 2932 $[4] = t1; 2933 } else { 2934 className = $[1]; 2935 inset = $[2]; 2936 props = $[3]; 2937 t1 = $[4]; 2938 } 2939 const variant = t1 === void 0 ? "default" : t1; 2940 let t2; 2941 if ($[5] !== className) { 2942 t2 = cn("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:!text-destructive", className); 2943 $[5] = className; 2944 $[6] = t2; 2945 } else t2 = $[6]; 2946 let t3; 2947 if ($[7] !== inset || $[8] !== props || $[9] !== t2 || $[10] !== variant) { 2948 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Item2, { 2949 "data-slot": "dropdown-menu-item", 2950 "data-inset": inset, 2951 "data-variant": variant, 2952 className: t2, 2953 ...props 2954 }); 2955 $[7] = inset; 2956 $[8] = props; 2957 $[9] = t2; 2958 $[10] = variant; 2959 $[11] = t3; 2960 } else t3 = $[11]; 2961 return t3; 2962} 2963function DropdownMenuRadioGroup(t0) { 2964 const $ = (0, import_compiler_runtime$131.c)(4); 2965 let props; 2966 if ($[0] !== t0) { 2967 ({...props} = t0); 2968 $[0] = t0; 2969 $[1] = props; 2970 } else props = $[1]; 2971 let t1; 2972 if ($[2] !== props) { 2973 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroup2, { 2974 "data-slot": "dropdown-menu-radio-group", 2975 ...props 2976 }); 2977 $[2] = props; 2978 $[3] = t1; 2979 } else t1 = $[3]; 2980 return t1; 2981} 2982function DropdownMenuRadioItem(t0) { 2983 const $ = (0, import_compiler_runtime$131.c)(11); 2984 let children; 2985 let className; 2986 let props; 2987 if ($[0] !== t0) { 2988 ({className, children, ...props} = t0); 2989 $[0] = t0; 2990 $[1] = children; 2991 $[2] = className; 2992 $[3] = props; 2993 } else { 2994 children = $[1]; 2995 className = $[2]; 2996 props = $[3]; 2997 } 2998 let t1; 2999 if ($[4] !== className) { 3000 t1 = cn("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className); 3001 $[4] = className; 3002 $[5] = t1; 3003 } else t1 = $[5]; 3004 let t2; 3005 if ($[6] === Symbol.for("react.memo_cache_sentinel")) { 3006 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 3007 className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", 3008 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemIndicator2, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Circle, { className: "size-2 fill-current" }) }) 3009 }); 3010 $[6] = t2; 3011 } else t2 = $[6]; 3012 let t3; 3013 if ($[7] !== children || $[8] !== props || $[9] !== t1) { 3014 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(RadioItem2, { 3015 "data-slot": "dropdown-menu-radio-item", 3016 className: t1, 3017 ...props, 3018 children: [t2, children] 3019 }); 3020 $[7] = children; 3021 $[8] = props; 3022 $[9] = t1; 3023 $[10] = t3; 3024 } else t3 = $[10]; 3025 return t3; 3026} 3027function DropdownMenuSub(t0) { 3028 const $ = (0, import_compiler_runtime$131.c)(4); 3029 let props; 3030 if ($[0] !== t0) { 3031 ({...props} = t0); 3032 $[0] = t0; 3033 $[1] = props; 3034 } else props = $[1]; 3035 let t1; 3036 if ($[2] !== props) { 3037 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sub2, { 3038 "data-slot": "dropdown-menu-sub", 3039 ...props 3040 }); 3041 $[2] = props; 3042 $[3] = t1; 3043 } else t1 = $[3]; 3044 return t1; 3045} 3046function DropdownMenuSubTrigger(t0) { 3047 const $ = (0, import_compiler_runtime$131.c)(13); 3048 let children; 3049 let className; 3050 let inset; 3051 let props; 3052 if ($[0] !== t0) { 3053 ({className, inset, children, ...props} = t0); 3054 $[0] = t0; 3055 $[1] = children; 3056 $[2] = className; 3057 $[3] = inset; 3058 $[4] = props; 3059 } else { 3060 children = $[1]; 3061 className = $[2]; 3062 inset = $[3]; 3063 props = $[4]; 3064 } 3065 let t1; 3066 if ($[5] !== className) { 3067 t1 = cn("flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground", className); 3068 $[5] = className; 3069 $[6] = t1; 3070 } else t1 = $[6]; 3071 let t2; 3072 if ($[7] === Symbol.for("react.memo_cache_sentinel")) { 3073 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, { className: "ml-auto size-4" }); 3074 $[7] = t2; 3075 } else t2 = $[7]; 3076 let t3; 3077 if ($[8] !== children || $[9] !== inset || $[10] !== props || $[11] !== t1) { 3078 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SubTrigger2, { 3079 "data-slot": "dropdown-menu-sub-trigger", 3080 "data-inset": inset, 3081 className: t1, 3082 ...props, 3083 children: [children, t2] 3084 }); 3085 $[8] = children; 3086 $[9] = inset; 3087 $[10] = props; 3088 $[11] = t1; 3089 $[12] = t3; 3090 } else t3 = $[12]; 3091 return t3; 3092} 3093function DropdownMenuSubContent(t0) { 3094 const $ = (0, import_compiler_runtime$131.c)(8); 3095 let className; 3096 let props; 3097 if ($[0] !== t0) { 3098 ({className, ...props} = t0); 3099 $[0] = t0; 3100 $[1] = className; 3101 $[2] = props; 3102 } else { 3103 className = $[1]; 3104 props = $[2]; 3105 } 3106 let t1; 3107 if ($[3] !== className) { 3108 t1 = cn("z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
3108de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", className); 3109 $[3] = className; 3110 $[4] = t1; 3111 } else t1 = $[4]; 3112 let t2; 3113 if ($[5] !== props || $[6] !== t1) { 3114 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SubContent2, { 3115 "data-slot": "dropdown-menu-sub-content", 3116 className: t1, 3117 ...props 3118 }); 3119 $[5] = props; 3120 $[6] = t1; 3121 $[7] = t2; 3122 } else t2 = $[7]; 3123 return t2; 3124} 3125const getResponseCode = (data) => { 3126 if (typeof data === "string" && data.trim().startsWith("{")) try { 3127 return JSON.parse(data)?.code; 3128 } catch { 3129 return; 3130 } 3131 if (data && typeof data === "object" && "code" in data) return data.code; 3132}; 3133var toUrlPath = (url) => url.split("?")[0]; 3134const trackApiResult = ({ endpoint, type, args, requestBody, result, durationMs }) => { 3135 try { 3136 if (!isAnalyticsActive()) return; 3137 const eventName = args.trackEventName || `API: ${endpoint}`; 3138 const httpStatus = result.meta?.response?.status; 3139 const code = getResponseCode(result.data); 3140 const success = !result.error && (code === void 0 || code === 200); 3141 const params = sanitizeArgs([{ 3142 query: args.params, 3143 body: requestBody 3144 }])[0]; 3145 const trackData = { 3146 endpoint, 3147 type, 3148 method: args.method, 3149 urlPath: typeof args.url === "string" ? toUrlPath(args.url) : void 0, 3150 success, 3151 code, 3152 httpStatus, 3153 durationMs: Math.round(durationMs), 3154 params 3155 }; 3156 if (args.trackDataFields && result.data && typeof result.data === "object") { 3157 const responseData = result.data.data; 3158 if (responseData && typeof responseData === "object") args.trackDataFields.forEach((fieldName) => { 3159 const value = responseData[fieldName]; 3160 if (value !== void 0) trackData[fieldName] = value; 3161 }); 3162 } 3163 track(eventName, trackData); 3164 } catch {} 3165}; 3166var SITE_KEY = "6LdSXCYbAAAAAItDag4D0zJCxZq4Fu-QU_ySsWDJ"; 3167var getGrecaptcha = () => window.grecaptcha; 3168const getRecaptchaToken = async (action) => { 3169 let retry = 10; 3170 while (!getGrecaptcha()?.execute && retry-- > 0) await new Promise((r) => setTimeout(r, 500)); 3171 const grecaptcha = getGrecaptcha(); 3172 if (!grecaptcha?.execute) return ""; 3173 return new Promise((resolve, reject) => { 3174 grecaptcha.ready(() => { 3175 grecaptcha.execute(SITE_KEY, { action }).then(resolve).catch(reject); 3176 }); 3177 }); 3178}; 3179var API_TIMEOUT = 20 * 1e3; 3180var BASE_API_URL = "https://api.truckerpath.com"; 3181var TP_KEYS_URL = "/fleet/front/notLogin/keys"; 3182var TP_TOKEN_URL = "/fleet/user/tp/auth-token"; 3183var ENCRYPT_KEY_URL = "/tp/api/encrypt/key"; 3184var STALE_ENCRYPT_KEY_CODE = 588; 3185var MAX_ENCRYPT_KEY_RETRY = 1; 3186var compose = (...enhancers) => (next) => enhancers.reduceRight((wrapped, enhance) => enhance(wrapped), next); 3187var commonValidateStatus = (response) => response.status >= 200 && response.status < 400; 3188var baseQuery = fetchBaseQuery({ 3189 baseUrl: BASE_API_URL, 3190 prepareHeaders: async (headers, api) => { 3191 const rootState = api.getState(); 3192 const appStorageState = rootState.appStorage; 3193 if (appStorageState.userToken) headers.set("portal-token", appStorageState.userToken); 3194 const companyId = authApi.endpoints.getUserInfo.select()(rootState)?.data?.data?.companyId; 3195 if (companyId != null) headers.set("X-Company-Id", String(companyId)); 3196 if (!(headers.has("X-Skip-Content-Type") || headers.get("content-type"))) headers.set("content-type", "application/json"); 3197 return headers; 3198 }, 3199 validateStatus(response) { 3200 return commonValidateStatus(response); 3201 }, 3202 responseHandler: (response) => { 3203 const contentType = (response.headers.get("content-type") || "").toLowerCase(); 3204 if (contentType.startsWith("text/")) return response.text(); 3205 if (contentType === "application/zip" || contentType.includes("spreadsheet") || contentType.includes("excel") || contentType === "application/pdf" || contentType.startsWith("application/octet-stream")) return response.blob(); 3206 return response.json(); 3207 }, 3208 timeout: API_TIMEOUT 3209}); 3210var externalBaseQuery = fetchBaseQuery({ 3211 prepareHeaders: (headers) => { 3212 return headers; 3213 }, 3214 validateStatus(response) { 3215 return commonValidateStatus(response); 3216 }, 3217 responseHandler: (response) => { 3218 if (response.headers.get("content-type")?.toLowerCase().startsWith("text")) return response.text(); 3219 else return response.json(); 3220 }, 3221 timeout: API_TIMEOUT 3222}); 3223var routeQuery = (args, api, extraOptions) => { 3224 return (typeof args === "object" && typeof args.url === "string" && (args.url.startsWith("http://") || args.url.startsWith("https://")) ? externalBaseQuery : baseQuery)(args, api, extraOptions); 3225}; 3226var withJsonStringParsing = (next) => async (args, api, extraOptions) => { 3227 const result = await next(args, api, extraOptions); 3228 if (typeof result.data === "string" && result.data.trim().startsWith("{")) try { 3229 result.data = JSON.parse(result.data); 3230 } catch (e$4) { 3231 console.error(e$4); 3232 } 3233 return result; 3234}; 3235var jsonQuery = withJsonStringParsing(routeQuery); 3236var singleFlight = (run) => { 3237 let pending = null; 3238 return (api) => { 3239 pending ??= run(api).finally(() => { 3240 pending = null; 3241 }); 3242 return pending; 3243 }; 3244}; 3245var fetchTpKeys = singleFlight(async (api) => { 3246 const keys = (await jsonQuery({ 3247 url: TP_KEYS_URL, 3248 method: "GET" 3249 }, api, {})).data?.data; 3250 if (!keys) return; 3251 const tpKeys = { 3252 installationId: keys.installationId, 3253 xAuthToken: keys["x-auth-token"] 3254 }; 3255 api.dispatch(setTpKeys(tpKeys)); 3256 return tpKeys; 3257}); 3258var tpKeysRefreshRequested = false;
3259var ensureTpKeys = async (api) => { 3260 const storedTpKeys = api.getState().appStorage.tpKeys; 3261 if (!storedTpKeys) { 3262 tpKeysRefreshRequested = true; 3263 return fetchTpKeys(api); 3264 } 3265 if (!tpKeysRefreshRequested) { 3266 tpKeysRefreshRequested = true; 3267 fetchTpKeys(api); 3268 } 3269 return { 3270 installationId: decodeBase64(storedTpKeys.installationId), 3271 xAuthToken: decodeBase64(storedTpKeys.xAuthToken) 3272 }; 3273}; 3274var mergeTpKeyHeaders = (headers, tpKeys) => { 3275 const merged = { ...headers }; 3276 const hasHeader = (name) => Object.keys(merged).some((key) => key.toLowerCase() === name); 3277 if (tpKeys) { 3278 if (!hasHeader("installation-id")) merged["installation-id"] = tpKeys.installationId; 3279 if (!hasHeader("x-auth-token")) merged["x-auth-token"] = tpKeys.xAuthToken; 3280 } 3281 if (!hasHeader("client")) merged.client = "Truckerpath_Command/5.0.0"; 3282 return merged; 3283}; 3284var withTpKeyHeaders = (next) => async (args, api, extraOptions) => { 3285 if (typeof args !== "object" || !args.withTpKeys) return next(args, api, extraOptions); 3286 const tpKeys = await ensureTpKeys(api); 3287 const headers = mergeTpKeyHeaders(args.headers, tpKeys); 3288 return next({ 3289 ...args, 3290 headers 3291 }, api, extraOptions); 3292}; 3293var cachedTpToken; 3294var fetchTpToken = singleFlight(async (api) => { 3295 const { userToken } = api.getState().appStorage; 3296 const token = (await jsonQuery({ 3297 url: TP_TOKEN_URL, 3298 method: "GET" 3299 }, api, {})).data?.data; 3300 if (!token) return; 3301 cachedTpToken = { 3302 token, 3303 userToken 3304 }; 3305 return token; 3306}); 3307var ensureTpToken = async (api) => { 3308 const { userToken } = api.getState().appStorage; 3309 if (cachedTpToken && cachedTpToken.userToken === userToken) return cachedTpToken.token; 3310 return fetchTpToken(api); 3311}; 3312var withTpTokenHeader = (next) => async (args, api, extraOptions) => { 3313 if (typeof args !== "object" || !args.withTpToken) return next(args, api, extraOptions); 3314 const token = await ensureTpToken(api); 3315 if (!token) return { error: { 3316 status: "CUSTOM_ERROR", 3317 error: "Could not resolve the TruckLoads auth token for this session." 3318 } }; 3319 const headers = { 3320 ...args.headers, 3321 "x-auth-token": token 3322 }; 3323 return next({ 3324 ...args, 3325 headers 3326 }, api, extraOptions); 3327}; 3328var tpKeyedQuery = withTpKeyHeaders(jsonQuery); 3329var cachedEncryptKey; 3330var fetchEncryptKey = singleFlight(async (api) => { 3331 const { userToken } = api.getState().appStorage; 3332 const encryptKey = (await tpKeyedQuery({ 3333 url: ENCRYPT_KEY_URL, 3334 method: "GET", 3335 headers: { 3336 "system-source": "fleet", 3337 notEncrypted: "true" 3338 }, 3339 withTpKeys: true 3340 }, api, {}
3340)).data?.data?.encryptKey; 3341 if (!encryptKey) return; 3342 cachedEncryptKey = { 3343 userToken, 3344 key: encryptKey 3345 }; 3346 return encryptKey; 3347}); 3348var ensureEncryptKey = async (api) => { 3349 const { userToken } = api.getState().appStorage; 3350 if (cachedEncryptKey && cachedEncryptKey.userToken === userToken) return cachedEncryptKey.key; 3351 cachedEncryptKey = void 0; 3352 return fetchEncryptKey(api); 3353}; 3354var invalidateEncryptKey = (staleKey) => { 3355 if (cachedEncryptKey?.key === staleKey) cachedEncryptKey = void 0; 3356}; 3357var withRecaptchaToken = (next) => async (args, api, extraOptions) => { 3358 if (typeof args !== "object" || !args.withRecaptcha) return next(args, api, extraOptions); 3359 const recaptchaToken = await getRecaptchaToken(args.withRecaptcha); 3360 const headers = { 3361 ...args.headers, 3362 "recaptcha-token": recaptchaToken 3363 }; 3364 return next({ 3365 ...args, 3366 headers 3367 }, api, extraOptions); 3368}; 3369var encryptRequestBody = (body, encryptKey) => { 3370 if (typeof body === "object" && body !== null && "data" in body) return JSON.stringify({ data: encryptAES(body.data, encryptKey) }); 3371 return encryptAES(body, encryptKey); 3372}; 3373var withEncryptedPayload = (next) => async (args, api, extraOptions) => { 3374 if (typeof args !== "object" || !args.isEncrypt) return next(args, api, extraOptions); 3375 for (let attempt = 0;; attempt++) { 3376 const encryptKey = await ensureEncryptKey(api); 3377 if (!encryptKey) return { error: { 3378 status: "CUSTOM_ERROR", 3379 error: "Encryption key unavailable" 3380 } }; 3381 const requestArgs = args.body ? { 3382 ...args, 3383 body: encryptRequestBody(args.body, encryptKey) 3384 } : args; 3385 const result = await next(requestArgs, api, extraOptions); 3386 if (result.error) return result; 3387 const code = getResponseCode(result.data); 3388 if (code === STALE_ENCRYPT_KEY_CODE) { 3389 if (attempt >= MAX_ENCRYPT_KEY_RETRY) { 3390 console.error("encrypt key refresh exceeded the retry limit"); 3391 return result; 3392 } 3393 invalidateEncryptKey(encryptKey); 3394 continue; 3395 } 3396 if (code && code !== 200) return result; 3397 if (typeof result.data === "string") try { 3398 result.data = decryptAES(result.data, encryptKey); 3399 } catch (e$4) { 3400 console.error(e$4); 3401 } 3402 return result; 3403 } 3404}; 3405var withApiTracking = (next) => async (args, api, extraOptions) => { 3406 const start = performance.now(); 3407 const result = await next(args, api, extraOptions); 3408 if (typeof args === "object" && args.track) trackApiResult({ 3409 endpoint: api.endpoint, 3410 type: api.type, 3411 args, 3412 requestBody: args.body, 3413 result, 3414 durationMs: performance.now() - start 3415 }); 3416 return result; 3417}; 3418const baseApiQuery = compose(withApiTracking, withJsonStringParsing, withEncryptedPayload, withRecaptchaToken, withTpTokenHeader, withTpKeyHeaders)(routeQuery); 3419const overrideExisting = true; 3420const baseApi = createApi({ 3421 reducerPath: "baseApi", 3422 baseQuery: baseApiQuery, 3423 endpoints: () => ({}), 3424 tagTypes: [ 3425 "userInfo", 3426 "fuelPrices", 3427 "fuelNetworkConfig", 3428 "ssoPreConfig", 3429 "ssoConfig", 3430 "ssoUsers", 3431 "profile", 3432 "fleetTrucksList", 3433 "fleetTruckDetail", 3434 "terminals", 3435 "terminalMembers", 3436 "terminalGroups", 3437 "driverGroups", 3438 "driverPerformanceReport", 3439 "driverExcessByDriver", 3440 "driverPerformanceAlerts", 3441 "driverPerformanceSeries", 3442 "dialers", 3443 "cards", 3444 "messages-groups", 3445 "drivers", 3446 "driverDetail", 3447 "driverProfile", 3448 "subscriptionSummary", 3449 "manageSeats", 3450 "operatorsList", 3451 "companyPermissions", 3452 "permissionSettings", 3453 "driverPermissionGroupList", 3454 "driverTeams", 3455 "driverTeamDetail", 3456 "documentCondition", 3457 "recentDocuments", 3458 "documents", 3459 "mergeFilesSetting", 3460 "poiGroup", 3461 "poi", 3462 "poiContact", 3463 "circlePois", 3464 "circleFacilities", 3465 "eldConnectedDrivers", 3466 "eldConnectedTrucks", 3467 "eldToConnectTrucks", 3468 "eldSourceList", 3469 "eldNotConnectedDrivers", 3470 "eldImportPreview", 3471 "billingInfo", 3472 "bundledCommodity", 3473 "driverGroupMembers", 3474 "apiTokens", 3475 "fuelNetworkSettings", 3476 "oorConfig", 3477 "trafficCameras", 3478 "releaseNotes", 3479 "tripDetails", 3480 "routeTrafficFlow", 3481 "loadBoardLoads", 3482 "hiddenBrokers", 3483 "savedBrokers", 3484 "savedSearches", 3485 "truckstopStatus", 3486 "connectedBrokers", 3487 "invitationBrokers", 3488 "driverAudiences", 3489 "driverPriceSettings" 3490 ], 3491 refetchOnReconnect: true,
3492 keepUnusedDataFor: 0 3493}); 3494const authApi = baseApi.injectEndpoints({ 3495 endpoints: (builder) => ({ 3496 login: builder.mutation({ 3497 query: (credentials) => ({ 3498 url: "/fleet/login", 3499 method: "POST", 3500 body: credentials 3501 }), 3502 invalidatesTags: ["userInfo"] 3503 }), 3504 confirmLogin: builder.mutation({ query: (credentials) => ({ 3505 url: "/fleet/user/third/party/login/signup", 3506 method: "POST", 3507 body: credentials, 3508 track: true, 3509 trackEventName: "API: Third-Party Login Signup", 3510 trackDataFields: ["action"] 3511 }) }), 3512 getSSOToken: builder.query({ query: ({ loginKey }) => ({ 3513 url: "/command-center/sso/oauth2/token", 3514 method: "GET", 3515 params: { loginKey }, 3516 track: true, 3517 trackEventName: "API: SSO Login" 3518 }) }), 3519 forgotPassword: builder.mutation({ query: (credentials) => ({ 3520 url: "/fleet/forgetPass", 3521 method: "POST", 3522 body: credentials 3523 }) }), 3524 changePassword: builder.mutation({ query: (data) => ({ 3525 url: "/command-center/zuul/user/change/password", 3526 method: "POST", 3527 body: data, 3528 headers: { "system-source": "fleet" } 3529 }) }), 3530 checkPassword: builder.mutation({ query: (password) => ({ 3531 url: "/fleet/user/check/password", 3532 method: "POST", 3533 body: password, 3534 headers: { "Content-Type": "text/plain" } 3535 }) }), 3536 changeEmailSend: builder.mutation({ 3537 query: (data) => ({ 3538 url: "/fleet/user/change/email/send", 3539 method: "POST", 3540 body: data 3541 }), 3542 invalidatesTags: ["userInfo", "profile"] 3543 }), 3544 changeEmailConfirm: builder.query({ query: (params) => ({ 3545 url: "/fleet/user/change/email/verify", 3546 method: "GET", 3547 params 3548 }) }), 3549 singleSignOn: builder.mutation({ query: (credentials) => ({ 3550 url: "/command-center/sso/oauth2/login/url", 3551 method: "POST", 3552 body: credentials, 3553 headers: { "system-source": "fleet" }, 3554 track: true, 3555 trackEventName: "API: SSO Login URL" 3556 }) }), 3557 getUserInfo: builder.query({ 3558 query: () => ({ 3559 url: "/fleet/user/info/me", 3560 method: "GET", 3561 headers: { "system-source": "fleet" } 3562 }), 3563 providesTags: ["userInfo"] 3564 }), 3565 getTpAuthToken: builder.query({ 3566 query: () => ({ 3567 url: "/fleet/user/tp/auth-token", 3568 method: "GET" 3569 }), 3570 providesTags: ["userInfo"] 3571 }), 3572 updateAutoFillFuelStop: builder.mutation({ 3573 query: ({ enabled }) => ({ 3574 url: "/fleet/user/extend/update/auto-fill-fuel-stop", 3575 method: "POST", 3576 params: { enabled }, 3577 headers: { "system-source": "fleet" } 3578 }), 3579 invalidatesTags: ["userInfo"] 3580 }) 3581 }), 3582 overrideExisting: true 3583}); 3584const useUserInfoQueryState = () => { 3585 return authApi.endpoints.getUserInfo.useQueryState()?.data?.data; 3586}; 3587const { useLoginMutation, useConfirmLoginMutation, useLazyGetSSOTokenQuery, useGetUserInfoQuery, useLazyGetUserInfoQuery, useGetTpAuthTokenQuery, useUpdateAutoFillFuelStopMutation, useForgotPasswordMutation, useSingleSignOnMutation, useChangePasswordMutation, useCheckPasswordMutation, useChangeEmailSendMutation, useChangeEmailConfirmQuery } = authApi; 3588var SCRIPT_ID = "ze-snippet"; 3589var SCRIPT_BASE_URL = "https://static.zdassets.com/ekr/snippet.js"; 3590var state = { loaded: false }; 3591var callZE = (...args) => { 3592 const zE = window.zE; 3593 if (typeof zE !== "function") return; 3594 try { 3595 zE(...args); 3596 } catch {} 3597}; 3598const openZendeskChat = () => { 3599 callZE("messenger", "open"); 3600 callZE("webWidget", "open"); 3601}; 3602const loadZendeskChat = () => { 3603 if (state.loaded) return; 3604 if (document.getElementById(SCRIPT_ID)) { 3605 state.loaded = true; 3606 return; 3607 } 3608 const key = "3126edd4-214e-4e65-8478-5c2823130282"; 3609 const script = document.createElement("script"); 3610 script.id = SCRIPT_ID; 3611 script.async = true; 3612 script.src = `${SCRIPT_BASE_URL}?key=${key}`; 3613 document.body.appendChild(script); 3614 state.loaded = true; 3615}; 3616var import_compiler_runtime$130 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 3617function Card(t0) { 3618 const $ = (0, import_compiler_runtime$130.c)(8); 3619 let className; 3620 let props; 3621 if ($[0] !== t0) { 3622 ({className, ...props} = t0); 3623 $[0] = t0; 3624 $[1] = className; 3625 $[2] = props; 3626 } else { 3627 className = $[1]; 3628 props = $[2]; 3629 } 3630 let t1; 3631 if ($[3] !== className) { 3632 t1 = cn("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm", className); 3633 $[3] = className; 3634 $[4] = t1; 3635 } else t1 = $[4]; 3636 let t2; 3637 if ($[5] !== props || $[6] !== t1) { 3638 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 3639 "data-slot": "card", 3640 className: t1, 3641 ...props 3642 }); 3643 $[5] = props; 3644 $[6] = t1; 3645 $[7] = t2; 3646 } else t2 = $[7]; 3647 return t2; 3648} 3649function CardHeader(t0) { 3650 const $ = (0, import_compiler_runtime$130.c)(8); 3651 let className; 3652 let props; 3653 if ($[0] !== t0) { 3654 ({className, ...props} = t0); 3655 $[0] = t0; 3656 $[1] = className; 3657 $[2] = props; 3658 } else { 3659 className = $[1]; 3660 props = $[2]; 3661 } 3662 let t1; 3663 if ($[3] !== className) { 3664 t1 = cn("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6", className); 3665 $[3] = className; 3666 $[4] = t1; 3667 } else t1 = $[4]; 3668 let t2; 3669 if ($[5] !== props || $[6] !== t1) { 3670 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 3671 "data-slot": "card-header", 3672 className: t1, 3673 ...props 3674 }); 3675 $[5] = props; 3676 $[6] = t1; 3677 $[7] = t2; 3678 } else t2 = $[7]; 3679 return t2; 3680} 3681function CardTitle(t0) { 3682 const $ = (0, import_compiler_runtime$130.c)(8); 3683 let className; 3684 let props; 3685 if ($[0] !== t0) { 3686 ({className, ...props} = t0); 3687 $[0] = t0; 3688 $[1] = className; 3689 $[2] = props; 3690 } else { 3691 className = $[1]; 3692 props = $[2]; 3693 } 3694 let t1; 3695 if ($[3] !== className) { 3696 t1 = cn("leading-none font-semibold", className); 3697 $[3] = className; 3698 $[4] = t1; 3699 } else t1 = $[4]; 3700 let t2; 3701 if ($[5] !== props || $[6] !== t1) { 3702 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 3703 "data-slot": "card-title", 3704 className: t1, 3705 ...props 3706 }); 3707 $[5] = props; 3708 $[6] = t1; 3709 $[7] = t2; 3710 } else t2 = $[7]; 3711 return t2; 3712}
3713function CardAction(t0) { 3714 const $ = (0, import_compiler_runtime$130.c)(8); 3715 let className; 3716 let props; 3717 if ($[0] !== t0) { 3718 ({className, ...props} = t0); 3719 $[0] = t0; 3720 $[1] = className; 3721 $[2] = props; 3722 } else { 3723 className = $[1]; 3724 props = $[2]; 3725 } 3726 let t1; 3727 if ($[3] !== className) { 3728 t1 = cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end", className); 3729 $[3] = className; 3730 $[4] = t1; 3731 } else t1 = $[4]; 3732 let t2; 3733 if ($[5] !== props || $[6] !== t1) { 3734 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 3735 "data-slot": "card-action", 3736 className: t1, 3737 ...props 3738 }); 3739 $[5] = props; 3740 $[6] = t1; 3741 $[7] = t2; 3742 } else t2 = $[7]; 3743 return t2; 3744} 3745function CardContent(t0) { 3746 const $ = (0, import_compiler_runtime$130.c)(8); 3747 let className; 3748 let props; 3749 if ($[0] !== t0) { 3750 ({className, ...props} = t0); 3751 $[0] = t0; 3752 $[1] = className; 3753 $[2] = props; 3754 } else { 3755 className = $[1]; 3756 props = $[2]; 3757 } 3758 let t1; 3759 if ($[3] !== className) { 3760 t1 = cn("px-6", className); 3761 $[3] = className; 3762 $[4] = t1; 3763 } else t1 = $[4]; 3764 let t2; 3765 if ($[5] !== props || $[6] !== t1) { 3766 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 3767 "data-slot": "card-content", 3768 className: t1, 3769 ...props 3770 }); 3771 $[5] = props; 3772 $[6] = t1; 3773 $[7] = t2; 3774 } else t2 = $[7]; 3775 return t2; 3776} 3777function CardFooter(t0) { 3778 const $ = (0, import_compiler_runtime$130.c)(8); 3779 let className; 3780 let props; 3781 if ($[0] !== t0) { 3782 ({className, ...props} = t0); 3783 $[0] = t0; 3784 $[1] = className; 3785 $[2] = props; 3786 } else { 3787 className = $[1]; 3788 props = $[2]; 3789 } 3790 let t1; 3791 if ($[3] !== className) { 3792 t1 = cn("flex items-center px-6 [.border-t]:pt-6", className); 3793 $[3] = className; 3794 $[4] = t1; 3795 } else t1 = $[4]; 3796 let t2; 3797 if ($[5] !== props || $[6] !== t1) { 3798 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 3799 "data-slot": "card-footer", 3800 className: t1, 3801 ...props 3802 }); 3803 $[5] = props; 3804 $[6] = t1; 3805 $[7] = t2; 3806 } else t2 = $[7]; 3807 return t2; 3808} 3809var import_compiler_runtime$129 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 3810var badgeVariants = T({ 3811 base: [ 3812 "inline-flex items-center justify-center rounded-xs text-xs w-fit whitespace-nowrap shrink-0 transition-[color,box-shadow] overflow-hidden outline-none gap-1", 3813 "[&>svg]:size-3 [&>svg]:pointer-events-none", 3814 "border border-transparent", 3815 "focus-visible:ring-[3px]" 3816 ], 3817 variants: { 3818 variant: { 3819 default: "bg-[#3E70BB] text-primary-foreground [a&]:hover:bg-[#3E70BB]/80 focus-visible:ring-[#3E70BB]/20", 3820 "default-subtle": "bg-[#3E70BB]/10 text-[#2359AB] [a&]:hover:bg-[#3E70BB]/8 focus-visible:ring-[#3E70BB]/5", 3821 success: "bg-success text-primary-foreground [a&]:hover:bg-success/80 focus-visible:ring-success/20", 3822 "success-subtle": "bg-success/20 text-success-foreground [a&]:hover:bg-success/80 focus-visible:ring-success/4", 3823 "neutral-subtle": "bg-slate-200 text-tag-gray [a&]:hover:bg-slate-200/80 focus-visible:ring-slate-200/20", 3824 "destructive-subtle": "bg-destructive/10 dark:bg-destructive/30 text-destructive [a&]:hover:bg-destructive/8 focus-visible:ring-destructive/5", 3825 destructive: "bg-red-500 dark:bg-red-500 text-white [a&]:hover:bg-red-500/8 focus-visible:ring-red-500/5" 3826 }, 3827 size: { 3828 default: "px-2 py-0.5 font-medium", 3829 lg: "px-2 py-0.75 font-semibold", 3830 num: "px-1 h-5 min-w-5 rounded-full font-medium" 3831 } 3832 }, 3833 defaultVariants: { 3834 variant: "default", 3835 size: "default" 3836 } 3837}); 3838function Badge(t0) { 3839 const $ = (0, import_compiler_runtime$129.c)(14); 3840 let className; 3841 let props; 3842 let size; 3843 let t1; 3844 let variant; 3845 if ($[0] !== t0) { 3846 ({className, variant, size, asChild: t1, ...props} = t0); 3847 $[0] = t0; 3848 $[1] = className; 3849 $[2] = props; 3850 $[3] = size; 3851 $[4] = t1; 3852 $[5] = variant; 3853 } else { 3854 className = $[1]; 3855 props = $[2]; 3856 size = $[3]; 3857 t1 = $[4]; 3858 variant = $[5]; 3859 } 3860 const Comp = (t1 === void 0 ? false : t1) ? Slot : "span"; 3861 let t2; 3862 if ($[6] !== className || $[7] !== size || $[8] !== variant) { 3863 t2 = cn(badgeVariants({ 3864 variant, 3865 size 3866 }), className); 3867 $[6] = className; 3868 $[7] = size; 3869 $[8] = variant; 3870 $[9] = t2; 3871 } else t2 = $[9]; 3872 let t3; 3873 if ($[10] !== Comp || $[11] !== props || $[12] !== t2) { 3874 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, { 3875 "data-slot": "badge", 3876 className: t2, 3877 ...props 3878 }); 3879 $[10] = Comp; 3880 $[11] = props; 3881 $[12] = t2; 3882 $[13] = t3; 3883 } else t3 = $[13]; 3884 return t3; 3885} 3886var import_compiler_runtime$128 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 3887const FreeTrialCard = (t0) => { 3888 const $ = (0, import_compiler_runtime$128.c)(3); 3889 const { dayCount } = t0; 3890 if (!dayCount) return; 3891 let t1; 3892 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 3893 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 3894 className: "text-sm font-medium", 3895 children: "Free Trial" 3896 }); 3897 $[0] = t1; 3898 } else t1 = $[0]; 3899 let t2; 3900 if ($[1] !== dayCount) { 3901 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, { 3902 className: "border bg-background p-0 shadow-xs group-data-[collapsible=icon]:hidden", 3903 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardContent, { 3904 className: "p-2.5", 3905 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 3906 className: "flex items-center justify-between",
3907 children: [t1, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Badge, { 3908 className: "bg-orange-100 text-amber-700", 3909 children: [dayCount, " days left"] 3910 })] 3911 }) 3912 }) 3913 }); 3914 $[1] = dayCount; 3915 $[2] = t2; 3916 } else t2 = $[2]; 3917 return t2; 3918}; 3919const { useGetWhatsNewQuery, useLazyGetReleaseHistoryQuery, useGetReleaseHistoryIndexQuery } = baseApi.injectEndpoints({ endpoints: (builder) => ({ 3920 getWhatsNew: builder.query({ 3921 query: () => ({ 3922 url: "/fleet/api/release-note/whats-new", 3923 method: "GET" 3924 }), 3925 providesTags: ["releaseNotes"] 3926 }), 3927 getReleaseHistory: builder.query({ 3928 query: (params) => ({ 3929 url: "/fleet/api/release-note/history", 3930 method: "GET", 3931 params 3932 }), 3933 providesTags: ["releaseNotes"] 3934 }), 3935 getReleaseHistoryIndex: builder.query({ 3936 query: () => ({ 3937 url: "/fleet/api/release-note/history/index", 3938 method: "GET" 3939 }), 3940 providesTags: ["releaseNotes"] 3941 }) 3942}) }); 3943var NEW_FEATURE_KEY_PREFIX = "releaseNoteLastSeenNewFeatureId"; 3944var ANY_KEY_PREFIX = "releaseNoteLastSeenAnyId"; 3945var readId = (key) => { 3946 const raw = localStorage.getItem(key); 3947 if (raw === null) return null; 3948 const parsed = Number(raw); 3949 return Number.isNaN(parsed) ? null : parsed; 3950}; 3951const getLastSeenNewFeatureId = (userId) => readId(`${NEW_FEATURE_KEY_PREFIX}:${userId}`); 3952const setLastSeenNewFeatureId = (userId, id) => { 3953 localStorage.setItem(`${NEW_FEATURE_KEY_PREFIX}:${userId}`, String(id)); 3954}; 3955const getLastSeenAnyId = (userId) => readId(`${ANY_KEY_PREFIX}:${userId}`); 3956const setLastSeenAnyId = (userId, id) => { 3957 localStorage.setItem(`${ANY_KEY_PREFIX}:${userId}`, String(id)); 3958}; 3959var import_compiler_runtime$127 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 3960const useReleaseNoteSidebarEntry = () => { 3961 const $ = (0, import_compiler_runtime$127.c)(10); 3962 const userInfo = useUserInfoQueryState(); 3963 const { data } = useGetWhatsNewQuery(); 3964 const latestAny = data?.data.latestAny ?? null; 3965 const [hasNewNotes, setHasNewNotes] = (0, import_react.useState)(false); 3966 let t0; 3967 let t1; 3968 if ($[0] !== latestAny || $[1] !== userInfo) { 3969 t0 = () => { 3970 setHasNewNotes(Boolean(userInfo && latestAny && getLastSeenAnyId(userInfo.id) !== latestAny.id)); 3971 }; 3972 t1 = [userInfo, latestAny]; 3973 $[0] = latestAny; 3974 $[1] = userInfo; 3975 $[2] = t0; 3976 $[3] = t1; 3977 } else { 3978 t0 = $[2]; 3979 t1 = $[3]; 3980 } 3981 (0, import_react.useEffect)(t0, t1); 3982 let t2; 3983 if ($[4] !== latestAny || $[5] !== userInfo) { 3984 t2 = () => { 3985 if (userInfo && latestAny) { 3986 setLastSeenAnyId(userInfo.id, latestAny.id); 3987 setHasNewNotes(false); 3988 } 3989 }; 3990 $[4] = latestAny; 3991 $[5] = userInfo; 3992 $[6] = t2; 3993 } else t2 = $[6]; 3994 const markLatestAnySeen = t2; 3995 let t3; 3996 if ($[7] !== hasNewNotes || $[8] !== markLatestAnySeen) { 3997 t3 = { 3998 hasNewNotes, 3999 markLatestAnySeen 4000 }; 4001 $[7] = hasNewNotes; 4002 $[8] = markLatestAnySeen; 4003 $[9] = t3; 4004 } else t3 = $[9]; 4005 return t3; 4006}; 4007var import_compiler_runtime$126 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 4008function Dialog(t0) { 4009 const $ = (0, import_compiler_runtime$126.c)(4); 4010 let props; 4011 if ($[0] !== t0) { 4012 ({...props} = t0); 4013 $[0] = t0; 4014 $[1] = props; 4015 } else props = $[1]; 4016 let t1; 4017 if ($[2] !== props) { 4018 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root$1, { 4019 "data-slot": "dialog", 4020 ...props 4021 }); 4022 $[2] = props; 4023 $[3] = t1; 4024 } else t1 = $[3]; 4025 return t1; 4026} 4027function DialogTrigger(t0) { 4028 const $ = (0, import_compiler_runtime$126.c)(4); 4029 let props; 4030 if ($[0] !== t0) { 4031 ({...props} = t0); 4032 $[0] = t0; 4033 $[1] = props; 4034 } else props = $[1]; 4035 let t1; 4036 if ($[2] !== props) { 4037 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trigger$3, { 4038 "data-slot": "dialog-trigger", 4039 ...props 4040 }); 4041 $[2] = props; 4042 $[3] = t1; 4043 } else t1 = $[3]; 4044 return t1; 4045} 4046function DialogPortal(t0) { 4047 const $ = (0, import_compiler_runtime$126.c)(4); 4048 let props; 4049 if ($[0] !== t0) { 4050 ({...props} = t0); 4051 $[0] = t0; 4052 $[1] = props; 4053 } else props = $[1]; 4054 let t1; 4055 if ($[2] !== props) { 4056 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Portal, { 4057 "data-slot": "dialog-portal", 4058 ...props 4059 }); 4060 $[2] = props; 4061 $[3] = t1; 4062 } else t1 = $[3]; 4063 return t1; 4064} 4065function DialogClose(t0) { 4066 const $ = (0, import_compiler_runtime$126.c)(4); 4067 let props; 4068 if ($[0] !== t0) { 4069 ({...props} = t0); 4070 $[0] = t0; 4071 $[1] = props; 4072 } else props = $[1]; 4073 let t1; 4074 if ($[2] !== props) { 4075 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Close, { 4076 "data-slot": "dialog-close", 4077 ...props 4078 }); 4079 $[2] = props; 4080 $[3] = t1; 4081 } else t1 = $[3]; 4082 return t1; 4083} 4084function DialogOverlay(t0) { 4085 const $ = (0, import_compiler_runtime$126.c)(8); 4086 let className; 4087 let props; 4088 if ($[0] !== t0) { 4089 ({className, ...props} = t0); 4090 $[0] = t0; 4091 $[1] = className; 4092 $[2] = props; 4093 } else { 4094 className = $[1]; 4095 props = $[2]; 4096 } 4097 let t1; 4098 if ($[3] !== className) { 4099 t1 = cn("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0", className); 4100 $[3] = className; 4101 $[4] = t1; 4102 } else t1 = $[4]; 4103 let t2; 4104 if ($[5] !== props || $[6] !== t1) { 4105 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Overlay, { 4106 "data-slot": "dialog-overlay", 4107 className: t1, 4108 ...props 4109 }); 4110 $[5] = props; 4111 $[6] = t1; 4112 $[7] = t2; 4113 } else t2 = $[7]; 4114 return t2; 4115} 4116function DialogContent(t0) { 4117 const $ = (0, import_compiler_runtime$126.c)(16); 4118 let children; 4119 let className; 4120 let props; 4121 let t1; 4122 if ($[0] !== t0) { 4123 ({className, children, showCloseButton: t1, ...props} = t0); 4124 $[0] = t0; 4125 $[1] = children; 4126 $[2] = className; 4127 $[3] = props; 4128 $[4] = t1; 4129 } else { 4130 children = $[1]; 4131 className = $[2]; 4132 props = $[3]; 4133 t1 = $[4]; 4134 } 4135 const showCloseButton = t1 === void 0 ? true : t1; 4136 let t2; 4137 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 4138 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogOverlay, {}); 4139 $[5] = t2; 4140 } else t2 = $[5]; 4141 let t3; 4142 if ($[6] !== className) { 4143 t3 = cn("group/dialog-content", "fixed top-[50%] left-[50%] z-50 grid w-full max-w-[600px] translate-x-[-50%] translate-y-[-50%] rounded-lg border bg-background shadow-lg outline-hidden duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 max-sm:max-w-[400px]", className); 4144 $[6] = className; 4145 $[7] = t3; 4146 } else t3 = $[7]; 4147 let t4; 4148 if ($[8] !== showCloseButton) {
4149 t4 = showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Close, { 4150 "data-slot": "dialog-close", 4151 className: "absolute top-5 right-5 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-5", 4152 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 4153 className: "sr-only", 4154 children: "Close" 4155 })] 4156 }); 4157 $[8] = showCloseButton; 4158 $[9] = t4; 4159 } else t4 = $[9]; 4160 let t5; 4161 if ($[10] !== children || $[11] !== props || $[12] !== showCloseButton || $[13] !== t3 || $[14] !== t4) { 4162 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogPortal, { 4163 "data-slot": "dialog-portal", 4164 children: [t2, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Content, { 4165 "data-slot": "dialog-content", 4166 "data-show-close": showCloseButton, 4167 className: t3, 4168 ...props, 4169 children: [children, t4] 4170 })] 4171 }); 4172 $[10] = children; 4173 $[11] = props; 4174 $[12] = showCloseButton; 4175 $[13] = t3; 4176 $[14] = t4; 4177 $[15] = t5; 4178 } else t5 = $[15]; 4179 return t5; 4180} 4181function DialogInner(t0) { 4182 const $ = (0, import_compiler_runtime$126.c)(8); 4183 let className; 4184 let props; 4185 if ($[0] !== t0) { 4186 ({className, ...props} = t0); 4187 $[0] = t0; 4188 $[1] = className; 4189 $[2] = props; 4190 } else { 4191 className = $[1]; 4192 props = $[2]; 4193 } 4194 let t1; 4195 if ($[3] !== className) { 4196 t1 = cn("flex flex-col border-y border-border p-5", className); 4197 $[3] = className; 4198 $[4] = t1; 4199 } else t1 = $[4]; 4200 let t2; 4201 if ($[5] !== props || $[6] !== t1) { 4202 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 4203 "data-slot": "dialog-inner", 4204 className: t1, 4205 ...props 4206 }); 4207 $[5] = props; 4208 $[6] = t1; 4209 $[7] = t2; 4210 } else t2 = $[7]; 4211 return t2; 4212} 4213function DialogHeader(t0) { 4214 const $ = (0, import_compiler_runtime$126.c)(8); 4215 let className; 4216 let props; 4217 if ($[0] !== t0) { 4218 ({className, ...props} = t0); 4219 $[0] = t0; 4220 $[1] = className; 4221 $[2] = props; 4222 } else { 4223 className = $[1]; 4224 props = $[2]; 4225 } 4226 let t1; 4227 if ($[3] !== className) { 4228 t1 = cn("flex flex-col gap-1.5 p-5 text-left max-sm:text-center", className); 4229 $[3] = className; 4230 $[4] = t1; 4231 } else t1 = $[4]; 4232 let t2; 4233 if ($[5] !== props || $[6] !== t1) { 4234 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 4235 "data-slot": "dialog-header", 4236 className: t1, 4237 ...props 4238 }); 4239 $[5] = props; 4240 $[6] = t1; 4241 $[7] = t2; 4242 } else t2 = $[7]; 4243 return t2; 4244} 4245function DialogFooter(t0) { 4246 const $ = (0, import_compiler_runtime$126.c)(8); 4247 let className; 4248 let props; 4249 if ($[0] !== t0) { 4250 ({className, ...props} = t0); 4251 $[0] = t0; 4252 $[1] = className; 4253 $[2] = props; 4254 } else { 4255 className = $[1]; 4256 props = $[2]; 4257 } 4258 let t1; 4259 if ($[3] !== className) { 4260 t1 = cn("flex flex-row justify-end gap-2 p-5 max-sm:flex-col-reverse", className); 4261 $[3] = className; 4262 $[4] = t1; 4263 } else t1 = $[4]; 4264 let t2; 4265 if ($[5] !== props || $[6] !== t1) { 4266 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 4267 "data-slot": "dialog-footer", 4268 className: t1, 4269 ...props 4270 }); 4271 $[5] = props; 4272 $[6] = t1; 4273 $[7] = t2; 4274 } else t2 = $[7]; 4275 return t2; 4276} 4277function DialogTitle(t0) { 4278 const $ = (0, import_compiler_runtime$126.c)(8); 4279 let className; 4280 let props; 4281 if ($[0] !== t0) { 4282 ({className, ...props} = t0); 4283 $[0] = t0; 4284 $[1] = className; 4285 $[2] = props; 4286 } else { 4287 className = $[1]; 4288 props = $[2]; 4289 } 4290 let t1; 4291 if ($[3] !== className) { 4292 t1 = cn("text-xl font-semibold group-data-[show-close=true]/dialog-content:pr-9", className); 4293 $[3] = className; 4294 $[4] = t1; 4295 } else t1 = $[4]; 4296 let t2; 4297 if ($[5] !== props || $[6] !== t1) { 4298 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Title, { 4299 "data-slot": "dialog-title", 4300 className: t1, 4301 ...props 4302 }); 4303 $[5] = props; 4304 $[6] = t1; 4305 $[7] = t2; 4306 } else t2 = $[7]; 4307 return t2; 4308} 4309function DialogDescription(t0) { 4310 const $ = (0, import_compiler_runtime$126.c)(8); 4311 let className; 4312 let props; 4313 if ($[0] !== t0) { 4314 ({className, ...props} = t0); 4315 $[0] = t0; 4316 $[1] = className; 4317 $[2] = props; 4318 } else { 4319 className = $[1]; 4320 props = $[2]; 4321 } 4322 let t1; 4323 if ($[3] !== className) { 4324 t1 = cn("text-sm text-muted-foreground", className); 4325 $[3] = className; 4326 $[4] = t1; 4327 } else t1 = $[4]; 4328 let t2; 4329 if ($[5] !== props || $[6] !== t1) { 4330 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, { 4331 "data-slot": "dialog-description", 4332 className: t1, 4333 ...props 4334 }); 4335 $[5] = props; 4336 $[6] = t1; 4337 $[7] = t2; 4338 } else t2 = $[7]; 4339 return t2; 4340} 4341/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */ 4342var { entries, setPrototypeOf, isFrozen, getPrototypeOf, getOwnPropertyDescriptor } = Object; 4343var { freeze, seal, create } = Object; 4344var { apply, construct } = typeof Reflect !== "undefined" && Reflect; 4345if (!freeze) freeze = function freeze$1(x) { 4346 return x; 4347}; 4348if (!seal) seal = function seal$1(x) { 4349 return x; 4350}; 4351if (!apply) apply = function apply$1(func, thisArg) { 4352 for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) args[_key - 2] = arguments[_key]; 4353 return func.apply(thisArg, args); 4354}; 4355if (!construct) construct = function construct$1(Func) { 4356 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2]; 4357 return new Func(...args); 4358}; 4359var arrayForEach = unapply(Array.prototype.forEach); 4360var arrayLastIndexOf = unapply(Array.prototype.lastIndexOf); 4361var arrayPop = unapply(Array.prototype.pop); 4362var arrayPush = unapply(Array.prototype.push); 4363var arraySplice = unapply(Array.prototype.splice); 4364var stringToLowerCase = unapply(String.prototype.toLowerCase); 4365var stringToString = unapply(String.prototype.toString); 4366var stringMatch = unapply(String.prototype.match); 4367var stringReplace = unapply(String.prototype.replace); 4368var stringIndexOf = unapply(String.prototype.indexOf); 4369var stringTrim = unapply(String.prototype.trim); 4370var objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty); 4371var regExpTest = unapply(RegExp.prototype.test); 4372var typeErrorCreate = unconstruct(TypeError); 4373function unapply(func) { 4374 return function(thisArg) { 4375 if (thisArg instanceof RegExp) thisArg.lastIndex = 0; 4376 for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) args[_key3 - 1] = arguments[_key3]; 4377 return apply(func, thisArg, args); 4378 }; 4379} 4380function unconstruct(Func) { 4381 return function() { 4382 for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4;
4382 _key4++) args[_key4] = arguments[_key4]; 4383 return construct(Func, args); 4384 }; 4385} 4386function addToSet(set, array) { 4387 let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase; 4388 if (setPrototypeOf) setPrototypeOf(set, null); 4389 let l$1 = array.length; 4390 while (l$1--) { 4391 let element = array[l$1]; 4392 if (typeof element === "string") { 4393 const lcElement = transformCaseFunc(element); 4394 if (lcElement !== element) { 4395 if (!isFrozen(array)) array[l$1] = lcElement; 4396 element = lcElement; 4397 } 4398 } 4399 set[element] = true; 4400 } 4401 return set; 4402} 4403function cleanArray(array) { 4404 for (let index = 0; index < array.length; index++) if (!objectHasOwnProperty(array, index)) array[index] = null; 4405 return array; 4406} 4407function clone(object) { 4408 const newObject = create(null); 4409 for (const [property, value] of entries(object)) if (objectHasOwnProperty(object, property)) if (Array.isArray(value)) newObject[property] = cleanArray(value); 4410 else if (value && typeof value === "object" && value.constructor === Object) newObject[property] = clone(value); 4411 else newObject[property] = value; 4412 return newObject; 4413} 4414function lookupGetter(object, prop) { 4415 while (object !== null) { 4416 const desc = getOwnPropertyDescriptor(object, prop); 4417 if (desc) { 4418 if (desc.get) return unapply(desc.get); 4419 if (typeof desc.value === "function") return unapply(desc.value); 4420 } 4421 object = getPrototypeOf(object); 4422 } 4423 function fallbackValue() { 4424 return null; 4425 } 4426 return fallbackValue; 4427} 4428var html$1 = freeze([ 4429 "a", 4430 "abbr", 4431 "acronym", 4432 "address", 4433 "area", 4434 "article", 4435 "aside", 4436 "audio", 4437 "b", 4438 "bdi", 4439 "bdo", 4440 "big", 4441 "blink", 4442 "blockquote", 4443 "body", 4444 "br", 4445 "button", 4446 "canvas", 4447 "caption", 4448 "center", 4449 "cite", 4450 "code", 4451 "col", 4452 "colgroup", 4453 "content", 4454 "data", 4455 "datalist", 4456 "dd", 4457 "decorator", 4458 "del", 4459 "details", 4460 "dfn", 4461 "dialog", 4462 "dir", 4463 "div", 4464 "dl", 4465 "dt", 4466 "element", 4467 "em", 4468 "fieldset", 4469 "figcaption", 4470 "figure", 4471 "font", 4472 "footer", 4473 "form", 4474 "h1", 4475 "h2", 4476 "h3", 4477 "h4", 4478 "h5", 4479 "h6", 4480 "head", 4481 "header", 4482 "hgroup", 4483 "hr", 4484 "html", 4485 "i", 4486 "img", 4487 "input", 4488 "ins", 4489 "kbd", 4490 "label", 4491 "legend", 4492 "li", 4493 "main", 4494 "map", 4495 "mark", 4496 "marquee", 4497 "menu", 4498 "menuitem", 4499 "meter", 4500 "nav", 4501 "nobr", 4502 "ol", 4503 "optgroup", 4504 "option", 4505 "output", 4506 "p", 4507 "picture", 4508 "pre", 4509 "progress", 4510 "q", 4511 "rp", 4512 "rt", 4513 "ruby", 4514 "s", 4515 "samp", 4516 "search", 4517 "section", 4518 "select", 4519 "shadow", 4520 "slot", 4521 "small", 4522 "source", 4523 "spacer", 4524 "span", 4525 "strike", 4526 "strong", 4527 "style", 4528 "sub", 4529 "summary", 4530 "sup", 4531 "table", 4532 "tbody", 4533 "td", 4534 "template", 4535 "textarea", 4536 "tfoot", 4537 "th", 4538 "thead", 4539 "time", 4540 "tr", 4541 "track", 4542 "tt", 4543 "u", 4544 "ul", 4545 "var", 4546 "video", 4547 "wbr" 4548]); 4549var svg$1 = freeze([ 4550 "svg", 4551 "a", 4552 "altglyph", 4553 "altglyphdef", 4554 "altglyphitem", 4555 "animatecolor", 4556 "animatemotion", 4557 "animatetransform", 4558 "circle", 4559 "clippath", 4560 "defs", 4561 "desc", 4562 "ellipse", 4563 "enterkeyhint", 4564 "exportparts", 4565 "filter", 4566 "font", 4567 "g", 4568 "glyph", 4569 "glyphref", 4570 "hkern", 4571 "image", 4572 "inputmode", 4573 "line", 4574 "lineargradient", 4575 "marker", 4576 "mask", 4577 "metadata", 4578 "mpath", 4579 "part", 4580 "path", 4581 "pattern", 4582 "polygon", 4583 "polyline", 4584 "radialgradient", 4585 "rect", 4586 "stop", 4587 "style", 4588 "switch", 4589 "symbol", 4590 "text", 4591 "textpath", 4592 "title", 4593 "tref", 4594 "tspan", 4595 "view", 4596 "vkern" 4597]); 4598var svgFilters = freeze([ 4599 "feBlend", 4600 "feColorMatrix", 4601 "feComponentTransfer", 4602 "feComposite", 4603 "feConvolveMatrix", 4604 "feDiffuseLighting", 4605 "feDisplacementMap", 4606 "feDistantLight", 4607 "feDropShadow", 4608 "feFlood", 4609 "feFuncA", 4610 "feFuncB", 4611 "feFuncG", 4612 "feFuncR", 4613 "feGaussianBlur", 4614 "feImage", 4615 "feMerge", 4616 "feMergeNode", 4617 "feMorphology", 4618 "feOffset", 4619 "fePointLight", 4620 "feSpecularLighting", 4621 "feSpotLight", 4622 "feTile", 4623 "feTurbulence" 4624]); 4625var svgDisallowed = freeze([ 4626 "animate", 4627 "color-profile", 4628 "cursor", 4629 "discard", 4630 "font-face", 4631 "font-face-format", 4632 "font-face-name", 4633 "font-face-src", 4634 "font-face-uri", 4635 "foreignobject", 4636 "hatch", 4637 "hatchpath", 4638 "mesh", 4639 "meshgradient", 4640 "meshpatch", 4641 "meshrow", 4642 "missing-glyph", 4643 "script", 4644 "set", 4645 "solidcolor", 4646 "unknown", 4647 "use" 4648]); 4649var mathMl$1 = freeze([ 4650 "math", 4651 "menclose", 4652 "merror", 4653 "mfenced", 4654 "mfrac", 4655 "mglyph", 4656 "mi", 4657 "mlabeledtr", 4658 "mmultiscripts", 4659 "mn", 4660 "mo", 4661 "mover", 4662 "mpadded", 4663 "mphantom", 4664 "mroot", 4665 "mrow", 4666 "ms", 4667 "mspace", 4668 "msqrt", 4669 "mstyle", 4670 "msub", 4671 "msup", 4672 "msubsup", 4673 "mtable", 4674 "mtd", 4675 "mtext", 4676 "mtr", 4677 "munder", 4678 "munderover", 4679 "mprescripts" 4680]); 4681var mathMlDisallowed = freeze([ 4682 "maction", 4683 "maligngroup", 4684 "malignmark", 4685 "mlongdiv", 4686 "mscarries", 4687 "mscarry", 4688 "msgroup", 4689 "mstack", 4690 "msline", 4691 "msrow", 4692 "semantics", 4693 "annotation", 4694 "annotation-xml", 4695 "mprescripts", 4696 "none" 4697]); 4698var text = freeze(["#text"]); 4699var html = freeze([ 4700 "accept", 4701 "action", 4702 "align", 4703 "alt", 4704 "autocapitalize", 4705 "autocomplete", 4706 "autopictureinpicture", 4707 "autoplay", 4708 "background", 4709 "bgcolor", 4710 "border", 4711 "capture", 4712 "cellpadding", 4713 "cellspacing", 4714 "checked", 4715 "cite", 4716 "class", 4717 "clear", 4718 "color", 4719 "cols", 4720 "colspan", 4721 "controls", 4722 "controlslist", 4723 "coords", 4724 "crossorigin", 4725 "datetime", 4726 "decoding", 4727 "default", 4728 "dir", 4729 "disabled", 4730 "disablepictureinpicture", 4731 "disableremoteplayback", 4732 "download", 4733 "draggable", 4734 "enctype", 4735 "enterkeyhint", 4736 "exportparts", 4737 "face", 4738 "for", 4739 "headers", 4740 "height", 4741 "hidden", 4742 "high", 4743 "href", 4744 "hreflang",
4745 "id", 4746 "inert", 4747 "inputmode", 4748 "integrity", 4749 "ismap", 4750 "kind", 4751 "label", 4752 "lang", 4753 "list", 4754 "loading", 4755 "loop", 4756 "low", 4757 "max", 4758 "maxlength", 4759 "media", 4760 "method", 4761 "min", 4762 "minlength", 4763 "multiple", 4764 "muted", 4765 "name", 4766 "nonce", 4767 "noshade", 4768 "novalidate", 4769 "nowrap", 4770 "open", 4771 "optimum", 4772 "part", 4773 "pattern", 4774 "placeholder", 4775 "playsinline", 4776 "popover", 4777 "popovertarget", 4778 "popovertargetaction", 4779 "poster", 4780 "preload", 4781 "pubdate", 4782 "radiogroup", 4783 "readonly", 4784 "rel", 4785 "required", 4786 "rev", 4787 "reversed", 4788 "role", 4789 "rows", 4790 "rowspan", 4791 "spellcheck", 4792 "scope", 4793 "selected", 4794 "shape", 4795 "size", 4796 "sizes", 4797 "slot", 4798 "span", 4799 "srclang", 4800 "start", 4801 "src", 4802 "srcset", 4803 "step", 4804 "style", 4805 "summary", 4806 "tabindex", 4807 "title", 4808 "translate", 4809 "type", 4810 "usemap", 4811 "valign", 4812 "value", 4813 "width", 4814 "wrap", 4815 "xmlns", 4816 "slot" 4817]); 4818var svg = freeze([ 4819 "accent-height", 4820 "accumulate", 4821 "additive", 4822 "alignment-baseline", 4823 "amplitude", 4824 "ascent", 4825 "attributename", 4826 "attributetype", 4827 "azimuth", 4828 "basefrequency", 4829 "baseline-shift", 4830 "begin", 4831 "bias", 4832 "by", 4833 "class", 4834 "clip", 4835 "clippathunits", 4836 "clip-path", 4837 "clip-rule", 4838 "color", 4839 "color-interpolation", 4840 "color-interpolation-filters", 4841 "color-profile", 4842 "color-rendering", 4843 "cx", 4844 "cy", 4845 "d", 4846 "dx", 4847 "dy", 4848 "diffuseconstant", 4849 "direction", 4850 "display", 4851 "divisor", 4852 "dur", 4853 "edgemode", 4854 "elevation", 4855 "end", 4856 "exponent", 4857 "fill", 4858 "fill-opacity", 4859 "fill-rule", 4860 "filter", 4861 "filterunits", 4862 "flood-color", 4863 "flood-opacity", 4864 "font-family", 4865 "font-size", 4866 "font-size-adjust", 4867 "font-stretch", 4868 "font-style", 4869 "font-variant", 4870 "font-weight", 4871 "fx", 4872 "fy", 4873 "g1", 4874 "g2", 4875 "glyph-name", 4876 "glyphref", 4877 "gradientunits", 4878 "gradienttransform", 4879 "height", 4880 "href", 4881 "id", 4882 "image-rendering", 4883 "in", 4884 "in2", 4885 "intercept", 4886 "k", 4887 "k1", 4888 "k2", 4889 "k3", 4890 "k4", 4891 "kerning", 4892 "keypoints", 4893 "keysplines", 4894 "keytimes", 4895 "lang", 4896 "lengthadjust", 4897 "letter-spacing", 4898 "kernelmatrix", 4899 "kernelunitlength", 4900 "lighting-color", 4901 "local", 4902 "marker-end", 4903 "marker-mid", 4904 "marker-start", 4905 "markerheight", 4906 "markerunits", 4907 "markerwidth", 4908 "maskcontentunits", 4909 "maskunits", 4910 "max", 4911 "mask", 4912 "mask-type", 4913 "media", 4914 "method", 4915 "mode", 4916 "min", 4917 "name", 4918 "numoctaves", 4919 "offset", 4920 "operator", 4921 "opacity", 4922 "order", 4923 "orient", 4924 "orientation", 4925 "origin", 4926 "overflow", 4927 "paint-order", 4928 "path", 4929 "pathlength", 4930 "patterncontentunits", 4931 "patterntransform", 4932 "patternunits", 4933 "points", 4934 "preservealpha", 4935 "preserveaspectratio", 4936 "primitiveunits", 4937 "r", 4938 "rx", 4939 "ry", 4940 "radius", 4941 "refx", 4942 "refy", 4943 "repeatcount", 4944 "repeatdur", 4945 "restart", 4946 "result", 4947 "rotate", 4948 "scale", 4949 "seed", 4950 "shape-rendering", 4951 "slope", 4952 "specularconstant", 4953 "specularexponent", 4954 "spreadmethod", 4955 "startoffset", 4956 "stddeviation", 4957 "stitchtiles", 4958 "stop-color", 4959 "stop-opacity", 4960 "stroke-dasharray", 4961 "stroke-dashoffset", 4962 "stroke-linecap", 4963 "stroke-linejoin", 4964 "stroke-miterlimit", 4965 "stroke-opacity", 4966 "stroke", 4967 "stroke-width", 4968 "style", 4969 "surfacescale", 4970 "systemlanguage", 4971 "tabindex", 4972 "tablevalues", 4973 "targetx", 4974 "targety", 4975 "transform", 4976 "transform-origin", 4977 "text-anchor", 4978 "text-decoration", 4979 "text-rendering", 4980 "textlength", 4981 "type", 4982 "u1", 4983 "u2", 4984 "unicode", 4985 "values", 4986 "viewbox", 4987 "visibility",
4988 "version", 4989 "vert-adv-y", 4990 "vert-origin-x", 4991 "vert-origin-y", 4992 "width", 4993 "word-spacing", 4994 "wrap", 4995 "writing-mode", 4996 "xchannelselector", 4997 "ychannelselector", 4998 "x", 4999 "x1", 5000 "x2", 5001 "xmlns", 5002 "y", 5003 "y1", 5004 "y2", 5005 "z", 5006 "zoomandpan" 5007]); 5008var mathMl = freeze([ 5009 "accent", 5010 "accentunder", 5011 "align", 5012 "bevelled", 5013 "close", 5014 "columnsalign", 5015 "columnlines", 5016 "columnspan", 5017 "denomalign", 5018 "depth", 5019 "dir", 5020 "display", 5021 "displaystyle", 5022 "encoding", 5023 "fence", 5024 "frame", 5025 "height", 5026 "href", 5027 "id", 5028 "largeop", 5029 "length", 5030 "linethickness", 5031 "lspace", 5032 "lquote", 5033 "mathbackground", 5034 "mathcolor", 5035 "mathsize", 5036 "mathvariant", 5037 "maxsize", 5038 "minsize", 5039 "movablelimits", 5040 "notation", 5041 "numalign", 5042 "open", 5043 "rowalign", 5044 "rowlines", 5045 "rowspacing", 5046 "rowspan", 5047 "rspace", 5048 "rquote", 5049 "scriptlevel", 5050 "scriptminsize", 5051 "scriptsizemultiplier", 5052 "selection", 5053 "separator", 5054 "separators", 5055 "stretchy", 5056 "subscriptshift", 5057 "supscriptshift", 5058 "symmetric", 5059 "voffset", 5060 "width", 5061 "xmlns" 5062]); 5063var xml = freeze([ 5064 "xlink:href", 5065 "xml:id", 5066 "xlink:title", 5067 "xml:space", 5068 "xmlns:xlink" 5069]); 5070var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); 5071var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm); 5072var TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm); 5073var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); 5074var ARIA_ATTR = seal(/^aria-[\-\w]+$/); 5075var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i); 5076var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); 5077var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g); 5078var DOCTYPE_NAME = seal(/^html$/i); 5079var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i); 5080var EXPRESSIONS = /* @__PURE__ */ Object.freeze({ 5081 __proto__: null, 5082 ARIA_ATTR, 5083 ATTR_WHITESPACE, 5084 CUSTOM_ELEMENT, 5085 DATA_ATTR, 5086 DOCTYPE_NAME, 5087 ERB_EXPR, 5088 IS_ALLOWED_URI, 5089 IS_SCRIPT_OR_DATA, 5090 MUSTACHE_EXPR, 5091 TMPLIT_EXPR 5092}); 5093var NODE_TYPE = { 5094 element: 1, 5095 attribute: 2, 5096 text: 3, 5097 cdataSection: 4, 5098 entityReference: 5, 5099 entityNode: 6, 5100 progressingInstruction: 7, 5101 comment: 8, 5102 document: 9, 5103 documentType: 10, 5104 documentFragment: 11, 5105 notation: 12 5106}; 5107var getGlobal = function getGlobal$1() { 5108 return typeof window === "undefined" ? null : window; 5109}; 5110var _createTrustedTypesPolicy = function _createTrustedTypesPolicy$1(trustedTypes, purifyHostElement) { 5111 if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") return null; 5112 let suffix = null; 5113 const ATTR_NAME = "data-tt-policy-suffix"; 5114 if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) suffix = purifyHostElement.getAttribute(ATTR_NAME); 5115 const policyName = "dompurify" + (suffix ? "#" + suffix : ""); 5116 try { 5117 return trustedTypes.createPolicy(policyName, { 5118 createHTML(html$2) { 5119 return html$2; 5120 }, 5121 createScriptURL(scriptUrl) { 5122 return scriptUrl; 5123 } 5124 }); 5125 } catch (_) { 5126 console.warn("TrustedTypes policy " + policyName + " could not be created."); 5127 return null; 5128 } 5129}; 5130var _createHooksMap = function _createHooksMap$1() { 5131 return { 5132 afterSanitizeAttributes: [], 5133 afterSanitizeElements: [], 5134 afterSanitizeShadowDOM: [], 5135 beforeSanitizeAttributes: [], 5136 beforeSanitizeElements: [], 5137 beforeSanitizeShadowDOM: [], 5138 uponSanitizeAttribute: [], 5139 uponSanitizeElement: [], 5140 uponSanitizeShadowNode: [] 5141 }; 5142}; 5143function createDOMPurify() { 5144 let window$1 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal(); 5145 const DOMPurify = (root) => createDOMPurify(root); 5146 DOMPurify.version = "3.3.1"; 5147 DOMPurify.removed = []; 5148 if (!window$1 || !window$1.document || window$1.document.nodeType !== NODE_TYPE.document || !window$1.Element) { 5149 DOMPurify.isSupported = false; 5150 return DOMPurify; 5151 } 5152 let { document: document$1 } = window$1; 5153 const originalDocument = document$1; 5154 const currentScript = originalDocument.currentScript; 5155 const { DocumentFragment, HTMLTemplateElement, Node, Element, NodeFilter, NamedNodeMap = window$1.NamedNodeMap || window$1.MozNamedAttrMap, HTMLFormElement, DOMParser, trustedTypes } = window$1; 5156 const ElementPrototype = Element.prototype; 5157 const cloneNode = lookupGetter(ElementPrototype, "cloneNode"); 5158 const remove = lookupGetter(ElementPrototype, "remove"); 5159 const getNextSibling = lookupGetter(ElementPrototype, "nextSibling"); 5160 const getChildNodes = lookupGetter(ElementPrototype, "childNodes"); 5161 const getParentNode = lookupGetter(ElementPrototype, "parentNode"); 5162 if (typeof HTMLTemplateElement === "function") { 5163 const template = document$1.createElement("template"); 5164 if (template.content && template.content.ownerDocument) document$1 = template.content.ownerDocument; 5165 } 5166 let trustedTypesPolicy; 5167 let emptyHTML = ""; 5168 const { implementation, createNodeIterator, createDocumentFragment, getElementsByTagName } = document$1; 5169 const { importNode } = originalDocument; 5170 let hooks = _createHooksMap();
vendor: 1,727 bytes, lines 5171-5233
5171 DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0; 5172 const { MUSTACHE_EXPR: MUSTACHE_EXPR$1, ERB_EXPR: ERB_EXPR$1, TMPLIT_EXPR: TMPLIT_EXPR$1, DATA_ATTR: DATA_ATTR$1, ARIA_ATTR: ARIA_ATTR$1, IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA$1, ATTR_WHITESPACE: ATTR_WHITESPACE$1, CUSTOM_ELEMENT: CUSTOM_ELEMENT$1 } = EXPRESSIONS; 5173 let { IS_ALLOWED_URI: IS_ALLOWED_URI$1 } = EXPRESSIONS; 5174 let ALLOWED_TAGS = null; 5175 const DEFAULT_ALLOWED_TAGS = addToSet({}, [ 5176 ...html$1, 5177 ...svg$1, 5178 ...svgFilters, 5179 ...mathMl$1, 5180 ...text 5181 ]); 5182 let ALLOWED_ATTR = null; 5183 const DEFAULT_ALLOWED_ATTR = addToSet({}, [ 5184 ...html, 5185 ...svg, 5186 ...mathMl, 5187 ...xml 5188 ]); 5189 let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, { 5190 tagNameCheck: { 5191 writable: true, 5192 configurable: false, 5193 enumerable: true, 5194 value: null 5195 }, 5196 attributeNameCheck: { 5197 writable: true, 5198 configurable: false, 5199 enumerable: true, 5200 value: null 5201 }, 5202 allowCustomizedBuiltInElements: { 5203 writable: true, 5204 configurable: false, 5205 enumerable: true, 5206 value: false 5207 } 5208 })); 5209 let FORBID_TAGS = null; 5210 let FORBID_ATTR = null; 5211 const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, { 5212 tagCheck: { 5213 writable: true, 5214 configurable: false, 5215 enumerable: true, 5216 value: null 5217 }, 5218 attributeCheck: { 5219 writable: true, 5220 configurable: false, 5221 enumerable: true, 5222 value: null 5223 } 5224 })); 5225 let ALLOW_ARIA_ATTR = true; 5226 let ALLOW_DATA_ATTR = true; 5227 let ALLOW_UNKNOWN_PROTOCOLS = false; 5228 let ALLOW_SELF_CLOSE_IN_ATTR = true; 5229 let SAFE_FOR_TEMPLATES = false; 5230 let SAFE_FOR_XML = true; 5231 let WHOLE_DOCUMENT = false; 5232 let SET_CONFIG = false; 5233 let FORCE_BODY = false;
5234 let RETURN_DOM = false; 5235 let RETURN_DOM_FRAGMENT = false; 5236 let RETURN_TRUSTED_TYPE = false; 5237 let SANITIZE_DOM = true; 5238 let SANITIZE_NAMED_PROPS = false; 5239 const SANITIZE_NAMED_PROPS_PREFIX = "user-content-"; 5240 let KEEP_CONTENT = true; 5241 let IN_PLACE = false; 5242 let USE_PROFILES = {}; 5243 let FORBID_CONTENTS = null; 5244 const DEFAULT_FORBID_CONTENTS = addToSet({}, [ 5245 "annotation-xml", 5246 "audio", 5247 "colgroup", 5248 "desc", 5249 "foreignobject", 5250 "head", 5251 "iframe", 5252 "math", 5253 "mi", 5254 "mn", 5255 "mo", 5256 "ms", 5257 "mtext", 5258 "noembed", 5259 "noframes", 5260 "noscript", 5261 "plaintext", 5262 "script", 5263 "style", 5264 "svg", 5265 "template", 5266 "thead", 5267 "title", 5268 "video", 5269 "xmp" 5270 ]); 5271 let DATA_URI_TAGS = null; 5272 const DEFAULT_DATA_URI_TAGS = addToSet({}, [ 5273 "audio", 5274 "video", 5275 "img", 5276 "source", 5277 "image", 5278 "track" 5279 ]); 5280 let URI_SAFE_ATTRIBUTES = null; 5281 const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [ 5282 "alt", 5283 "class", 5284 "for", 5285 "id", 5286 "label", 5287 "name", 5288 "pattern", 5289 "placeholder", 5290 "role", 5291 "summary", 5292 "title", 5293 "value", 5294 "style", 5295 "xmlns" 5296 ]); 5297 const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML"; 5298 const SVG_NAMESPACE = "http://www.w3.org/2000/svg"; 5299 const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml"; 5300 let NAMESPACE = HTML_NAMESPACE; 5301 let IS_EMPTY_INPUT = false;
vendor: 1,596 bytes, lines 5302-5340
5302 let ALLOWED_NAMESPACES = null; 5303 const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [ 5304 MATHML_NAMESPACE, 5305 SVG_NAMESPACE, 5306 HTML_NAMESPACE 5307 ], stringToString); 5308 let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, [ 5309 "mi", 5310 "mo", 5311 "mn", 5312 "ms", 5313 "mtext" 5314 ]); 5315 let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]); 5316 const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [ 5317 "title", 5318 "style", 5319 "font", 5320 "a", 5321 "script" 5322 ]); 5323 let PARSER_MEDIA_TYPE = null; 5324 const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"]; 5325 const DEFAULT_PARSER_MEDIA_TYPE = "text/html"; 5326 let transformCaseFunc = null; 5327 let CONFIG = null; 5328 const formElement = document$1.createElement("form"); 5329 const isRegexOrFunction = function isRegexOrFunction$1(testValue) { 5330 return testValue instanceof RegExp || testValue instanceof Function; 5331 }; 5332 const _parseConfig = function _parseConfig$1() { 5333 let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 5334 if (CONFIG && CONFIG === cfg) return; 5335 if (!cfg || typeof cfg !== "object") cfg = {}; 5336 cfg = clone(cfg); 5337 PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE; 5338 transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase; 5339 ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS; 5340 ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
5341 ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES; 5342 URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES; 5343 DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS; 5344 FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS; 5345 FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({}); 5346 FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({}); 5347 USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES : false; 5348 ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; 5349 ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; 5350 ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; 5351 ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; 5352 SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; 5353 SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; 5354 WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; 5355 RETURN_DOM = cfg.RETURN_DOM || false; 5356 RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; 5357 RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; 5358 FORCE_BODY = cfg.FORCE_BODY || false; 5359 SANITIZE_DOM = cfg.SANITIZE_DOM !== false; 5360 SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; 5361 KEEP_CONTENT = cfg.KEEP_CONTENT !== false; 5362 IN_PLACE = cfg.IN_PLACE || false; 5363 IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI; 5364 NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE; 5365 MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS; 5366 HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS; 5367 CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {}; 5368 if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck; 5369 if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck; 5370 if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements; 5371 if (SAFE_FOR_TEMPLATES) ALLOW_DATA_ATTR = false; 5372 if (RETURN_DOM_FRAGMENT) RETURN_DOM = true; 5373 if (USE_PROFILES) { 5374 ALLOWED_TAGS = addToSet({}, text); 5375 ALLOWED_ATTR = []; 5376 if (USE_PROFILES.html === true) { 5377 addToSet(ALLOWED_TAGS, html$1); 5378 addToSet(ALLOWED_ATTR, html); 5379 } 5380 if (USE_PROFILES.svg === true) { 5381 addToSet(ALLOWED_TAGS, svg$1); 5382 addToSet(ALLOWED_ATTR, svg); 5383 addToSet(ALLOWED_ATTR, xml); 5384 } 5385 if (USE_PROFILES.svgFilters === true) { 5386 addToSet(ALLOWED_TAGS, svgFilters); 5387 addToSet(ALLOWED_ATTR, svg); 5388 addToSet(ALLOWED_ATTR, xml); 5389 } 5390 if (USE_PROFILES.mathMl === true) { 5391 addToSet(ALLOWED_TAGS, mathMl$1); 5392 addToSet(ALLOWED_ATTR, mathMl); 5393 addToSet(ALLOWED_ATTR, xml); 5394 } 5395 } 5396 if (cfg.ADD_TAGS) if (typeof cfg.ADD_TAGS === "function") EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS; 5397 else { 5398 if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) ALLOWED_TAGS = clone(ALLOWED_TAGS); 5399 addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc); 5400 } 5401 if (cfg.ADD_ATTR) if (typeof cfg.ADD_ATTR === "function") EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR; 5402 else { 5403 if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) ALLOWED_ATTR = clone(ALLOWED_ATTR); 5404 addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc); 5405 } 5406 if (cfg.ADD_URI_SAFE_ATTR) addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc); 5407 if (cfg.FORBID_CONTENTS) { 5408 if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS); 5409 addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc); 5410 } 5411 if (cfg.ADD_FORBID_CONTENTS) { 5412 if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS); 5413 addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc); 5414 } 5415 if (KEEP_CONTENT) ALLOWED_TAGS["#text"] = true; 5416 if (WHOLE_DOCUMENT) addToSet(ALLOWED_TAGS, [ 5417 "html", 5418 "head", 5419 "body" 5420 ]); 5421 if (ALLOWED_TAGS.table) { 5422 addToSet(ALLOWED_TAGS, ["tbody"]); 5423 delete FORBID_TAGS.tbody; 5424 } 5425 if (cfg.TRUSTED_TYPES_POLICY) { 5426 if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook."); 5427 if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") throw typeErrorCreate("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook."); 5428 trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY; 5429 emptyHTML = trustedTypesPolicy.createHTML(""); 5430 } else { 5431 if (trustedTypesPolicy === void 0) trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript); 5432 if (trustedTypesPolicy !== null && typeof emptyHTML === "string") emptyHTML = trustedTypesPolicy.createHTML(""); 5433 } 5434 if (freeze) freeze(cfg); 5435 CONFIG = cfg; 5436 }; 5437 const ALL_SVG_TAGS = addToSet({}, [ 5438 ...svg$1, 5439 ...svgFilters, 5440 ...svgDisallowed 5441 ]); 5442 const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]); 5443 const _checkValidNamespace = function _checkValidNamespace$1(element) { 5444 let parent = getParentNode(element); 5445 if (!parent || !parent.tagName) parent = { 5446 namespaceURI: NAMESPACE, 5447 tagName: "template" 5448 }; 5449 const tagName = stringToLowerCase(element.tagName); 5450 const parentTagName = stringToLowerCase(parent.tagName); 5451 if (!ALLOWED_NAMESPACES[element.namespaceURI]) return false;
5452 if (element.namespaceURI === SVG_NAMESPACE) { 5453 if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "svg"; 5454 if (parent.namespaceURI === MATHML_NAMESPACE) return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]); 5455 return Boolean(ALL_SVG_TAGS[tagName]); 5456 } 5457 if (element.namespaceURI === MATHML_NAMESPACE) { 5458 if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "math"; 5459 if (parent.namespaceURI === SVG_NAMESPACE) return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName]; 5460 return Boolean(ALL_MATHML_TAGS[tagName]); 5461 } 5462 if (element.namespaceURI === HTML_NAMESPACE) { 5463 if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) return false; 5464 if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) return false; 5465 return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]); 5466 } 5467 if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) return true; 5468 return false; 5469 }; 5470 const _forceRemove = function _forceRemove$1(node) { 5471 arrayPush(DOMPurify.removed, { element: node }); 5472 try { 5473 getParentNode(node).removeChild(node); 5474 } catch (_) { 5475 remove(node); 5476 } 5477 }; 5478 const _removeAttribute = function _removeAttribute$1(name, element) { 5479 try { 5480 arrayPush(DOMPurify.removed, { 5481 attribute: element.getAttributeNode(name), 5482 from: element 5483 }); 5484 } catch (_) { 5485 arrayPush(DOMPurify.removed, { 5486 attribute: null, 5487 from: element 5488 }); 5489 } 5490 element.removeAttribute(name); 5491 if (name === "is") if (RETURN_DOM || RETURN_DOM_FRAGMENT) try { 5492 _forceRemove(element); 5493 } catch (_) {} 5494 else try { 5495 element.setAttribute(name, ""); 5496 } catch (_) {} 5497 }; 5498 const _initDocument = function _initDocument$1(dirty) { 5499 let doc = null; 5500 let leadingWhitespace = null; 5501 if (FORCE_BODY) dirty = "<remove></remove>" + dirty; 5502 else { 5503 const matches = stringMatch(dirty, /^[\r\n\t ]+/); 5504 leadingWhitespace = matches && matches[0]; 5505 } 5506 if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) dirty = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + dirty + "</body></html>"; 5507 const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; 5508 if (NAMESPACE === HTML_NAMESPACE) try { 5509 doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE); 5510 } catch (_) {} 5511 if (!doc || !doc.documentElement) { 5512 doc = implementation.createDocument(NAMESPACE, "template", null); 5513 try { 5514 doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload; 5515 } catch (_) {} 5516 } 5517 const body = doc.body || doc.documentElement; 5518 if (dirty && leadingWhitespace) body.insertBefore(document$1.createTextNode(leadingWhitespace), body.childNodes[0] || null); 5519 if (NAMESPACE === HTML_NAMESPACE) return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0]; 5520 return WHOLE_DOCUMENT ? doc.documentElement : body; 5521 }; 5522 const _createNodeIterator = function _createNodeIterator$1(root) { 5523 return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null); 5524 }; 5525 const _isClobbered = function _isClobbered$1(element) { 5526 return element instanceof HTMLFormElement && (typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function"); 5527 }; 5528 const _isNode = function _isNode$1(value) { 5529 return typeof Node === "function" && value instanceof Node; 5530 }; 5531 function _executeHooks(hooks$1, currentNode, data) { 5532 arrayForEach(hooks$1, (hook) => { 5533 hook.call(DOMPurify, currentNode, data, CONFIG); 5534 }); 5535 } 5536 const _sanitizeElements = function _sanitizeElements$1(currentNode) { 5537 let content = null; 5538 _executeHooks(hooks.beforeSanitizeElements, currentNode, null); 5539 if (_isClobbered(currentNode)) { 5540 _forceRemove(currentNode); 5541 return true; 5542 } 5543 const tagName = transformCaseFunc(currentNode.nodeName); 5544 _executeHooks(hooks.uponSanitizeElement, currentNode, { 5545 tagName, 5546 allowedTags: ALLOWED_TAGS 5547 }); 5548 if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) { 5549 _forceRemove(currentNode); 5550 return true; 5551 } 5552 if (currentNode.nodeType === NODE_TYPE.progressingInstruction) { 5553 _forceRemove(currentNode); 5554 return true; 5555 } 5556 if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) { 5557 _forceRemove(currentNode); 5558 return true; 5559 } 5560 if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) { 5561 if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) { 5562 if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
5563 if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false; 5564 } 5565 if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) { 5566 const parentNode = getParentNode(currentNode) || currentNode.parentNode; 5567 const childNodes = getChildNodes(currentNode) || currentNode.childNodes; 5568 if (childNodes && parentNode) { 5569 const childCount = childNodes.length; 5570 for (let i = childCount - 1; i >= 0; --i) { 5571 const childClone = cloneNode(childNodes[i], true); 5572 childClone.__removalCount = (currentNode.__removalCount || 0) + 1; 5573 parentNode.insertBefore(childClone, getNextSibling(currentNode)); 5574 } 5575 } 5576 } 5577 _forceRemove(currentNode); 5578 return true; 5579 } 5580 if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) { 5581 _forceRemove(currentNode); 5582 return true; 5583 } 5584 if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) { 5585 _forceRemove(currentNode); 5586 return true; 5587 } 5588 if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) { 5589 content = currentNode.textContent; 5590 arrayForEach([ 5591 MUSTACHE_EXPR$1, 5592 ERB_EXPR$1, 5593 TMPLIT_EXPR$1 5594 ], (expr) => { 5595 content = stringReplace(content, expr, " "); 5596 }); 5597 if (currentNode.textContent !== content) { 5598 arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() }); 5599 currentNode.textContent = content; 5600 } 5601 } 5602 _executeHooks(hooks.afterSanitizeElements, currentNode, null); 5603 return false; 5604 }; 5605 const _isValidAttribute = function _isValidAttribute$1(lcTag, lcName, value) { 5606 if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document$1 || value in formElement)) return false; 5607 if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$1, lcName)); 5608 else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)); 5609 else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)); 5610 else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) if (_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) || lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))); 5611 else return false; 5612 else if (URI_SAFE_ATTRIBUTES[lcName]); 5613 else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ""))); 5614 else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]); 5615 else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ""))); 5616 else if (value) return false; 5617 return true; 5618 }; 5619 const _isBasicCustomElement = function _isBasicCustomElement$1(tagName) { 5620 return tagName !== "annotation-xml" && stringMatch(tagName, CUSTOM_ELEMENT$1); 5621 }; 5622 const _sanitizeAttributes = function _sanitizeAttributes$1(currentNode) { 5623 _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null); 5624 const { attributes } = currentNode; 5625 if (!attributes || _isClobbered(currentNode)) return; 5626 const hookEvent = { 5627 attrName: "", 5628 attrValue: "", 5629 keepAttr: true, 5630 allowedAttributes: ALLOWED_ATTR, 5631 forceKeepAttr: void 0 5632 }; 5633 let l$1 = attributes.length; 5634 while (l$1--) { 5635 const { name, namespaceURI, value: attrValue } = attributes[l$1]; 5636 const lcName = transformCaseFunc(name); 5637 const initValue = attrValue; 5638 let value = name === "value" ? initValue : stringTrim(initValue); 5639 hookEvent.attrName = lcName; 5640 hookEvent.attrValue = value; 5641 hookEvent.keepAttr = true; 5642 hookEvent.forceKeepAttr = void 0; 5643 _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent); 5644 value = hookEvent.attrValue;
5645 if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name")) { 5646 _removeAttribute(name, currentNode); 5647 value = SANITIZE_NAMED_PROPS_PREFIX + value; 5648 } 5649 if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, value)) { 5650 _removeAttribute(name, currentNode); 5651 continue; 5652 } 5653 if (lcName === "attributename" && stringMatch(value, "href")) { 5654 _removeAttribute(name, currentNode); 5655 continue; 5656 } 5657 if (hookEvent.forceKeepAttr) continue; 5658 if (!hookEvent.keepAttr) { 5659 _removeAttribute(name, currentNode); 5660 continue; 5661 } 5662 if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) { 5663 _removeAttribute(name, currentNode); 5664 continue; 5665 } 5666 if (SAFE_FOR_TEMPLATES) arrayForEach([ 5667 MUSTACHE_EXPR$1, 5668 ERB_EXPR$1, 5669 TMPLIT_EXPR$1 5670 ], (expr) => { 5671 value = stringReplace(value, expr, " "); 5672 }); 5673 const lcTag = transformCaseFunc(currentNode.nodeName); 5674 if (!_isValidAttribute(lcTag, lcName, value)) { 5675 _removeAttribute(name, currentNode); 5676 continue; 5677 } 5678 if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") if (namespaceURI); 5679 else switch (trustedTypes.getAttributeType(lcTag, lcName)) { 5680 case "TrustedHTML": 5681 value = trustedTypesPolicy.createHTML(value); 5682 break; 5683 case "TrustedScriptURL": 5684 value = trustedTypesPolicy.createScriptURL(value); 5685 break; 5686 } 5687 if (value !== initValue) try { 5688 if (namespaceURI) currentNode.setAttributeNS(namespaceURI, name, value); 5689 else currentNode.setAttribute(name, value); 5690 if (_isClobbered(currentNode)) _forceRemove(currentNode); 5691 else arrayPop(DOMPurify.removed); 5692 } catch (_) { 5693 _removeAttribute(name, currentNode); 5694 } 5695 } 5696 _executeHooks(hooks.afterSanitizeAttributes, currentNode, null); 5697 }; 5698 const _sanitizeShadowDOM = function _sanitizeShadowDOM$1(fragment) { 5699 let shadowNode = null; 5700 const shadowIterator = _createNodeIterator(fragment); 5701 _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null); 5702 while (shadowNode = shadowIterator.nextNode()) { 5703 _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null); 5704 _sanitizeElements(shadowNode); 5705 _sanitizeAttributes(shadowNode); 5706 if (shadowNode.content instanceof DocumentFragment) _sanitizeShadowDOM$1(shadowNode.content); 5707 } 5708 _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null); 5709 }; 5710 DOMPurify.sanitize = function(dirty) { 5711 let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 5712 let body = null; 5713 let importedNode = null; 5714 let currentNode = null; 5715 let returnNode = null; 5716 IS_EMPTY_INPUT = !dirty; 5717 if (IS_EMPTY_INPUT) dirty = "<!-->"; 5718 if (typeof dirty !== "string" && !_isNode(dirty)) if (typeof dirty.toString === "function") { 5719 dirty = dirty.toString(); 5720 if (typeof dirty !== "string") throw typeErrorCreate("dirty is not a string, aborting"); 5721 } else throw typeErrorCreate("toString is not a function"); 5722 if (!DOMPurify.isSupported) return dirty; 5723 if (!SET_CONFIG) _parseConfig(cfg); 5724 DOMPurify.removed = []; 5725 if (typeof dirty === "string") IN_PLACE = false; 5726 if (IN_PLACE) { 5727 if (dirty.nodeName) { 5728 const tagName = transformCaseFunc(dirty.nodeName); 5729 if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place"); 5730 } 5731 } else if (dirty instanceof Node) { 5732 body = _initDocument("<!---->"); 5733 importedNode = body.ownerDocument.importNode(dirty, true); 5734 if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") body = importedNode; 5735 else if (importedNode.nodeName === "HTML") body = importedNode; 5736 else body.appendChild(importedNode); 5737 } else { 5738 if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf("<") === -1) return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty; 5739 body = _initDocument(dirty); 5740 if (!body) return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : ""; 5741 } 5742 if (body && FORCE_BODY) _forceRemove(body.firstChild); 5743 const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body); 5744 while (currentNode = nodeIterator.nextNode()) { 5745 _sanitizeElements(currentNode); 5746 _sanitizeAttributes(currentNode); 5747 if (currentNode.content instanceof DocumentFragment) _sanitizeShadowDOM(currentNode.content); 5748 } 5749 if (IN_PLACE) return dirty; 5750 if (RETURN_DOM) { 5751 if (RETURN_DOM_FRAGMENT) { 5752 returnNode = createDocumentFragment.call(body.ownerDocument); 5753 while (body.firstChild) returnNode.appendChild(body.firstChild); 5754 } else returnNode = body; 5755 if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) returnNode = importNode.call(originalDocument, returnNode, true); 5756 return returnNode; 5757 } 5758 let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML; 5759 if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML; 5760 if (SAFE_FOR_TEMPLATES) arrayForEach([ 5761 MUSTACHE_EXPR$1, 5762 ERB_EXPR$1, 5763 TMPLIT_EXPR$1 5764 ], (expr) => { 5765 serializedHTML = stringReplace(serializedHTML, expr, " "); 5766 }); 5767 return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML; 5768 }; 5769 DOMPurify.setConfig = function() { 5770 let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 5771 _parseConfig(cfg); 5772 SET_CONFIG = true; 5773 }; 5774 DOMPurify.clearConfig = function() { 5775 CONFIG = null; 5776 SET_CONFIG = false;
5777 }; 5778 DOMPurify.isValidAttribute = function(tag, attr, value) { 5779 if (!CONFIG) _parseConfig({}); 5780 const lcTag = transformCaseFunc(tag); 5781 const lcName = transformCaseFunc(attr); 5782 return _isValidAttribute(lcTag, lcName, value); 5783 }; 5784 DOMPurify.addHook = function(entryPoint, hookFunction) { 5785 if (typeof hookFunction !== "function") return; 5786 arrayPush(hooks[entryPoint], hookFunction); 5787 }; 5788 DOMPurify.removeHook = function(entryPoint, hookFunction) { 5789 if (hookFunction !== void 0) { 5790 const index = arrayLastIndexOf(hooks[entryPoint], hookFunction); 5791 return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0]; 5792 } 5793 return arrayPop(hooks[entryPoint]); 5794 }; 5795 DOMPurify.removeHooks = function(entryPoint) { 5796 hooks[entryPoint] = []; 5797 }; 5798 DOMPurify.removeAllHooks = function() { 5799 hooks = _createHooksMap(); 5800 }; 5801 return DOMPurify; 5802} 5803var purify = createDOMPurify(); 5804var import_compiler_runtime$125 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 5805const ReleaseNoteContent = (t0) => { 5806 const $ = (0, import_compiler_runtime$125.c)(9); 5807 const { html: html$2, className } = t0; 5808 let t1; 5809 if ($[0] !== html$2) { 5810 t1 = purify.sanitize(html$2); 5811 $[0] = html$2; 5812 $[1] = t1; 5813 } else t1 = $[1]; 5814 const sanitizedHtml = t1; 5815 let t2; 5816 if ($[2] !== className) { 5817 t2 = cn("min-w-0 text-sm leading-6 break-words text-foreground [&_a]:underline [&_img]:mt-2 [&_img]:max-w-full [&_img]:rounded-md [&_li]:ml-4 [&_ol]:list-decimal [&_p+p]:mt-2 [&_ul]:list-disc", className); 5818 $[2] = className; 5819 $[3] = t2; 5820 } else t2 = $[3]; 5821 let t3; 5822 if ($[4] !== sanitizedHtml) { 5823 t3 = { __html: sanitizedHtml }; 5824 $[4] = sanitizedHtml; 5825 $[5] = t3; 5826 } else t3 = $[5]; 5827 let t4; 5828 if ($[6] !== t2 || $[7] !== t3) { 5829 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 5830 className: t2, 5831 dangerouslySetInnerHTML: t3 5832 }); 5833 $[6] = t2; 5834 $[7] = t3; 5835 $[8] = t4; 5836 } else t4 = $[8]; 5837 return t4; 5838}; 5839var RELEASE_NOTE_FEATURE_TYPE_BADGES = { 5840 NEW_FEATURE: { 5841 label: "New", 5842 icon: Sparkles, 5843 className: "rounded-full font-semibold uppercase bg-green-100 text-green-700 hover:bg-green-100 dark:bg-green-500/15 dark:text-green-400" 5844 }, 5845 BUG_FIX: { 5846 label: "Fixed", 5847 icon: Bug, 5848 className: "rounded-full font-semibold uppercase bg-amber-100 text-amber-700 hover:bg-amber-100 dark:bg-amber-500/15 dark:text-amber-400" 5849 }, 5850 OPTIMIZATION: { 5851 label: "Improved", 5852 icon: Zap, 5853 className: "rounded-full font-semibold uppercase bg-blue-100 text-blue-700 hover:bg-blue-100 dark:bg-blue-500/15 dark:text-blue-400" 5854 }, 5855 OTHER: { 5856 label: "Update", 5857 icon: Info, 5858 className: "rounded-full font-semibold uppercase bg-slate-100 text-slate-600 hover:bg-slate-100 dark:bg-slate-500/15 dark:text-slate-400" 5859 } 5860}; 5861const RELEASE_NOTE_FEATURE_TYPES = [ 5862 "NEW_FEATURE", 5863 "OPTIMIZATION", 5864 "BUG_FIX" 5865]; 5866const getReleaseNoteFeatureTypeBadge = (featureType) => RELEASE_NOTE_FEATURE_TYPE_BADGES[featureType]; 5867var import_compiler_runtime$124 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 5868const ReleaseNoteWhatsNewDialog = (t0) => { 5869 const $ = (0, import_compiler_runtime$124.c)(35); 5870 const { open, onOpenChange, note } = t0; 5871 let t1; 5872 if ($[0] !== note.featureType) { 5873 t1 = getReleaseNoteFeatureTypeBadge(note.featureType); 5874 $[0] = note.featureType; 5875 $[1] = t1; 5876 } else t1 = $[1]; 5877 const FeatureTypeIcon = t1.icon; 5878 let t2; 5879 if ($[2] !== onOpenChange) { 5880 t2 = () => { 5881 trackMethodCall("handleSeeWhatsNewInWhatsNewDialog", []); 5882 onOpenChange(false); 5883 window.open("/release-history", "_blank", "noopener,noreferrer"); 5884 }; 5885 $[2] = onOpenChange; 5886 $[3] = t2; 5887 } else t2 = $[3]; 5888 const handleSeeWhatsNewInWhatsNewDialog = t2; 5889 let t3; 5890 if ($[4] !== onOpenChange) { 5891 t3 = () => { 5892 trackMethodCall("handleMaybeLaterInWhatsNewDialog", []); 5893 onOpenChange(false); 5894 }; 5895 $[4] = onOpenChange; 5896 $[5] = t3; 5897 } else t3 = $[5]; 5898 const handleMaybeLaterInWhatsNewDialog = t3; 5899 let t4; 5900 if ($[6] !== FeatureTypeIcon || $[7] !== note.thumbnailUrl || $[8] !== note.title) { 5901 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 5902 className: "relative flex h-70 items-center justify-center overflow-hidden bg-primary-muted",
5903 children: note.thumbnailUrl ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { 5904 src: note.thumbnailUrl, 5905 alt: note.title, 5906 className: "size-full object-cover" 5907 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FeatureTypeIcon, { 5908 "aria-hidden": true, 5909 className: "size-20 text-primary", 5910 strokeWidth: 1.5 5911 }) 5912 }); 5913 $[6] = FeatureTypeIcon; 5914 $[7] = note.thumbnailUrl; 5915 $[8] = note.title; 5916 $[9] = t4; 5917 } else t4 = $[9]; 5918 let t5; 5919 if ($[10] === Symbol.for("react.memo_cache_sentinel")) { 5920 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Badge, { 5921 className: "w-fit gap-1.5 rounded-md border-0 bg-gradient-to-r from-primary-muted to-primary-muted/40 px-2.5 py-1.5 text-primary hover:from-primary-muted hover:to-primary-muted/40", 5922 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 5923 name: "message-square-text", 5924 "aria-hidden": true 5925 }), "New Feature"] 5926 }); 5927 $[10] = t5; 5928 } else t5 = $[10]; 5929 let t6; 5930 if ($[11] !== note.title) { 5931 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { 5932 className: "text-2xl font-bold text-foreground", 5933 children: note.title 5934 }); 5935 $[11] = note.title; 5936 $[12] = t6; 5937 } else t6 = $[12]; 5938 let t7; 5939 if ($[13] !== note.content) { 5940 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ReleaseNoteContent, { 5941 html: note.content, 5942 className: "text-muted-foreground" 5943 }); 5944 $[13] = note.content; 5945 $[14] = t7; 5946 } else t7 = $[14]; 5947 let t8; 5948 if ($[15] !== t6 || $[16] !== t7) { 5949 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 5950 className: "flex flex-col gap-3.5", 5951 children: [t5, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 5952 className: "flex max-h-80 flex-col gap-2 overflow-y-auto", 5953 children: [t6, t7] 5954 })] 5955 }); 5956 $[15] = t6; 5957 $[16] = t7; 5958 $[17] = t8; 5959 } else t8 = $[17]; 5960 let t9; 5961 if ($[18] !== handleMaybeLaterInWhatsNewDialog) { 5962 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 5963 variant: "ghost", 5964 onClick: handleMaybeLaterInWhatsNewDialog, 5965 children: "Maybe Later" 5966 }); 5967 $[18] = handleMaybeLaterInWhatsNewDialog; 5968 $[19] = t9; 5969 } else t9 = $[19]; 5970 let t10; 5971 if ($[20] !== handleSeeWhatsNewInWhatsNewDialog) { 5972 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 5973 className: "shadow-xs", 5974 onClick: handleSeeWhatsNewInWhatsNewDialog, 5975 children: "See What's New" 5976 }); 5977 $[20] = handleSeeWhatsNewInWhatsNewDialog; 5978 $[21] = t10; 5979 } else t10 = $[21]; 5980 let t11; 5981 if ($[22] !== t10 || $[23] !== t9) { 5982 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 5983 className: "flex items-center justify-end gap-2", 5984 children: [t9, t10] 5985 }); 5986 $[22] = t10; 5987 $[23] = t9; 5988 $[24] = t11; 5989 } else t11 = $[24]; 5990 let t12; 5991 if ($[25] !== t11 || $[26] !== t8) { 5992 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 5993 className: "flex flex-col gap-6 p-6", 5994 children: [t8, t11] 5995 }); 5996 $[25] = t11; 5997 $[26] = t8; 5998 $[27] = t12; 5999 } else t12 = $[27]; 6000 let t13; 6001 if ($[28] !== t12 || $[29] !== t4) { 6002 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, { 6003 className: "max-w-125 overflow-hidden rounded-3xl border-0 p-0", 6004 showCloseButton: false, 6005 children: [t4, t12] 6006 }); 6007 $[28] = t12; 6008 $[29] = t4; 6009 $[30] = t13; 6010 } else t13 = $[30]; 6011 let t14; 6012 if ($[31] !== onOpenChange || $[32] !== open || $[33] !== t13) { 6013 t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, { 6014 open, 6015 onOpenChange, 6016 children: t13 6017 }); 6018 $[31] = onOpenChange; 6019 $[32] = open; 6020 $[33] = t13; 6021 $[34] = t14; 6022 } else t14 = $[34]; 6023 return t14; 6024}; 6025var import_compiler_runtime$123 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 6026const WhatsNewAutoPopup = () => { 6027 const $ = (0, import_compiler_runtime$123.c)(7); 6028 const userInfo = useUserInfoQueryState(); 6029 const { data } = useGetWhatsNewQuery(); 6030 const latestNewFeature = data?.data.latestNewFeature ?? null; 6031 const [open, setOpen$1] = (0, import_react.useState)(false); 6032 let t0; 6033 let t1; 6034 if ($[0] !== latestNewFeature || $[1] !== userInfo) { 6035 t0 = () => { 6036 if (!userInfo || !latestNewFeature) return; 6037 if (getLastSeenNewFeatureId(userInfo.id) === latestNewFeature.i
6037d) return; 6038 setOpen$1(true); 6039 setLastSeenNewFeatureId(userInfo.id, latestNewFeature.id); 6040 }; 6041 t1 = [userInfo, latestNewFeature]; 6042 $[0] = latestNewFeature; 6043 $[1] = userInfo; 6044 $[2] = t0; 6045 $[3] = t1; 6046 } else { 6047 t0 = $[2]; 6048 t1 = $[3]; 6049 } 6050 (0, import_react.useEffect)(t0, t1); 6051 if (!latestNewFeature) return null; 6052 let t2; 6053 if ($[4] !== latestNewFeature || $[5] !== open) { 6054 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ReleaseNoteWhatsNewDialog, { 6055 open, 6056 onOpenChange: setOpen$1, 6057 note: latestNewFeature 6058 }); 6059 $[4] = latestNewFeature; 6060 $[5] = open; 6061 $[6] = t2; 6062 } else t2 = $[6]; 6063 return t2; 6064}; 6065const useAppDispatch = useDispatch.withTypes(); 6066const useAppSelector = useSelector.withTypes(); 6067var initialState$2 = { 6068 activeSheet: "none", 6069 nestedSheet: { 6070 status: "closed", 6071 sourceRect: void 0, 6072 data: void 0 6073 }, 6074 call: void 0, 6075 active: void 0, 6076 count: void 0, 6077 twilioToken: void 0, 6078 currentStepBuyVirtualPhone: null, 6079 dialerNotificationOpen: false, 6080 dialerNotificationType: void 0, 6081 resultSheetSid: void 0, 6082 dialerView: "dial-pad", 6083 pendingAutoCall: void 0, 6084 isPlacingCall: false 6085}; 6086const dialerSlice = createSlice({ 6087 name: "dialer", 6088 initialState: initialState$2, 6089 reducers: { 6090 setActiveSheet: (state$3, action) => { 6091 state$3.activeSheet = action.payload; 6092 }, 6093 showIncomingCallSheet: (state$3, action) => { 6094 state$3.activeSheet = "incoming"; 6095 state$3.call = action.payload; 6096 }, 6097 showInboundCallSheet: (state$3, action) => { 6098 state$3.activeSheet = "inbound"; 6099 state$3.call = action.payload; 6100 }, 6101 showMinimizeSheet: (state$3) => { 6102 state$3.activeSheet = "minimize"; 6103 }, 6104 closeDialerSheet: (state$3) => { 6105 if (state$3.activeSheet === "inbound") state$3.activeSheet = "call-result"; 6106 else state$3.activeSheet = "none"; 6107 state$3.call = void 0; 6108 state$3.nestedSheet = { 6109 status: "closed", 6110 sourceRect: void 0, 6111 data: void 0 6112 }; 6113 state$3.resultSheetSid = void 0; 6114 }, 6115 answerCall: (state$3) => { 6116 if (state$3.activeSheet === "incoming") state$3.activeSheet = "inbound"; 6117 }, 6118 showNestedSheet: (state$3, action) => { 6119 state$3.nestedSheet = { 6120 status: "open", 6121 sourceRect: action.payload.sourceRect, 6122 data: action.payload.data 6123 }; 6124 }, 6125 closeNestedSheet: (state$3) => { 6126 state$3.nestedSheet = { 6127 status: "closed", 6128 sourceRect: void 0, 6129 data: void 0 6130 }; 6131 }, 6132 openCallResultSheet: (state$3, payload) => { 6133 state$3.activeSheet = "call-result"; 6134 state$3.resultSheetSid = payload.payload.resultSheetSid; 6135 state$3.call = void 0; 6136 }, 6137 setActive: (state$3, action) => { 6138 state$3.active = action.payload ?? void 0; 6139 }, 6140 setCount: (state$3, action) => { 6141 state$3.count = action.payload ?? void 0; 6142 }, 6143 setVoicemailUnreadCount: (state$3, action) => { 6144 state$3.count = { 6145 unreadCalls: state$3.count?.unreadCalls ?? 0, 6146 unreadVoiceMails: action.payload 6147 }; 6148 }, 6149 setTwilioToken: (state$3, action) => { 6150 state$3.twilioToken = action.payload ?? void 0; 6151 }, 6152 setCurrentStepBuyVirtualPhone: (state$3, action) => { 6153 state$3.currentStepBuyVirtualPhone = action.payload; 6154 }, 6155 setDialerNotificationOpen: (state$3, action) => { 6156 state$3.dialerNotificationOpen = action.payload; 6157 }, 6158 setDialerNotificationType: (state$3, action) => { 6159 state$3.dialerNotificationType = action.payload; 6160 }, 6161 openDialerNotificationByType: (state$3, action) => { 6162 state$3.dialerNotificationType = action.payload; 6163 state$3.dialerNotificationOpen = true; 6164 }, 6165 setDialerView: (state$3, action) => { 6166 state$3.dialerView = action.payload; 6167 }, 6168 setPendingAutoCall: (state$3, action) => { 6169 state$3.pendingAutoCall = action.payload; 6170 }, 6171 setPlacingCall: (state$3, action) => { 6172 state$3.isPlacingCall = action.payload; 6173 }, 6174 clearDialerState: () => initialState$2 6175 } 6176}); 6177const { setActiveSheet, showIncomingCallSheet, showInboundCallSheet, showMinimizeSheet, closeDialerSheet, answerCall, showNestedSheet, closeNestedSheet, openCallResultSheet, setActive, setCount, setVoicemailUnreadCount, setTwilioToken, setCurrentStepBuyVirtualPhone, setDialerNotificationOpen, setDialerNotificationType, openDialerNotificationByType, setDialerView, setPendingAutoCall, setPlacingCall, clearDialerState } = dialerSlice.actions; 6178const selectIsIncomingCallSheetOpen = (state$3) => state$3.dialer.activeSheet === "incoming"; 6179const selectIsInboundCallSheetOpen = (state$3) =>
6179 state$3.dialer.activeSheet === "inbound"; 6180const selectIsMinimizeSheetOpen = (state$3) => state$3.dialer.activeSheet === "minimize"; 6181const selectIsCallResultSheetOpen = (state$3) => state$3.dialer.activeSheet === "call-result"; 6182const selectIsNestedSheetOpen = (state$3) => state$3.dialer.nestedSheet.status === "open"; 6183const selectCall = (state$3) => state$3.dialer.call; 6184const selectNestedSheetSourceRect = (state$3) => state$3.dialer.nestedSheet.sourceRect; 6185const selectNestedSheetData = (state$3) => state$3.dialer.nestedSheet.data; 6186const selectActive = (state$3) => state$3.dialer.active; 6187const selectCount = (state$3) => state$3.dialer.count; 6188const selectTwilioToken = (state$3) => state$3.dialer.twilioToken; 6189const selectCurrentStepBuyVirtualPhone = (state$3) => state$3.dialer.currentStepBuyVirtualPhone; 6190const selectDialerNotificationOpen = (state$3) => state$3.dialer.dialerNotificationOpen; 6191const selectDialerNotificationType = (state$3) => state$3.dialer.dialerNotificationType; 6192const selectResultSheetSid = (state$3) => state$3.dialer.resultSheetSid; 6193const selectDialerView = (state$3) => state$3.dialer.dialerView; 6194const selectPendingAutoCall = (state$3) => state$3.dialer.pendingAutoCall; 6195const selectIsPlacingCall = (state$3) => state$3.dialer.isPlacingCall; 6196var initialState$1 = { 6197 open: false, 6198 messagesTabValue: "messages" 6199}; 6200const messagesAndDialersSlice = createSlice({ 6201 name: "messagesAndDialers", 6202 initialState: initialState$1, 6203 reducers: { 6204 setOpen: (state$3, action) => { 6205 state$3.open = action.payload; 6206 }, 6207 setMessagesTabValue: (state$3, action) => { 6208 state$3.messagesTabValue = action.payload; 6209 }, 6210 clearMessagesAndDialers: () => initialState$1 6211 } 6212}); 6213const { setOpen, setMessagesTabValue, clearMessagesAndDialers } = messagesAndDialersSlice.actions; 6214async function openDialerRecent(dispatch) { 6215 await dispatch(setOpen(true)); 6216 await dispatch(setMessagesTabValue("dialer")); 6217 await dispatch(setDialerView("recent")); 6218} 6219async function openDialerNumpad(dispatch, payload) { 6220 await dispatch(setPendingAutoCall(payload)); 6221} 6222const selectOpen = (state$3) => state$3.messagesAndDialers.open; 6223const selectMessagesTabValue = (state$3) => state$3.messagesAndDialers.messagesTabValue; 6224var import_NIM_Web_NIM = /* @__PURE__ */ __toESM(require_NIM_Web_NIM()); 6225var import_bytes = /* @__PURE__ */ __toESM(require_bytes()); 6226const metersToFtIn = (meters) => { 6227 if (!meters) return { 6228 text: "-", 6229 value: [0, 0] 6230 }; 6231 const totalInches = meters / .0254; 6232 let feet = Math.floor(totalInches / 12); 6233 let inches = Math.round(totalInches % 12); 6234 if (inches === 12) { 6235 feet += 1; 6236 inches = 0; 6237 } 6238 return { 6239 text: `${feet}ft ${inches}in`, 6240 value: [feet, inches] 6241 }; 6242}; 6243const tonsToLbs = (tons) => { 6244 if (!tons) return { 6245 text: "-", 6246 value: [0] 6247 }; 6248 const pounds = Math.round(tons / .00045359237); 6249 return { 6250 text: `${pounds}lbs`, 6251 value: [pounds] 6252 }; 6253}; 6254const fromKmToMi = (meters) => { 6255 return ((meters || 0) / 1e3 * .621371).toFixed(2); 6256}; 6257var METERS_PER_SECOND_PER_MPH = .44704; 6258const mphToMetersPerSecond = (mph) => mph * METERS_PER_SECOND_PER_MPH; 6259const metersPerSecondToMph = (metersPerSecond) => Math.round(metersPerSecond / METERS_PER_SECOND_PER_MPH); 6260var _bytes = (value) => (0, import_bytes.default)(value) ?? void 0; 6261var initialState = { 6262 sessionId: void 0, 6263 view: "default", 6264 token: void 0, 6265 friends: void 0, 6266 groups: void 0, 6267 groupDetail: void 0, 6268 sessions: void 0, 6269 historyMessages: {}, 6270 hasMoreHistory: {} 6271}; 6272const messagesSlice = createSlice({ 6273 name: "messages", 6274 initialState, 6275 reducers: { 6276 setToken: (state$3, action) => { 6277 state$3.token = action.payload; 6278 }, 6279 setSessionId: (state$3, action) => { 6280 state$3.sessionId = action.payload; 6281 }, 6282 setGroupDetail: (state$3, action) => { 6283 state$3.groupDetail = action.payload; 6284 }, 6285 setView: (state$3, action) => { 6286 state$3.view = action.payload; 6287 }, 6288 setFriends: (state$3, action) => { 6289 state$3.friends = action.payload; 6290 }, 6291 setGroups: (state$3, action) => { 6292 state$3.groups = action.payload; 6293 }, 6294 setSessions: (state$3, action) => { 6295 state$3.sessions = action.payload; 6296 }, 6297 updateSessions: (state$3, action) => { 6298 const toUpdateSessions = action.payload; 6299 const updatesById = new Map(toUpdateSessions.map((s$1) => [s$1.id, s$1])); 6300 let updatedSessions = (state$3.sessions ?? []).map((s$1) =>
6300 updatesById.get(s$1.id) ?? s$1); 6301 const newSessions = toUpdateSessions.filter((s$1) => !(state$3.sessions ?? []).some((c$2) => c$2.id === s$1.id)); 6302 updatedSessions = [...updatedSessions, ...newSessions].sort((a, b) => b.updateTime - a.updateTime); 6303 state$3.sessions = updatedSessions; 6304 }, 6305 removeGroup: (state$3, action) => { 6306 state$3.groups = state$3.groups?.filter((g) => g.tid !== action.payload); 6307 }, 6308 removeSession: (state$3, action) => { 6309 state$3.sessions = state$3.sessions?.filter((s$1) => s$1.id !== action.payload); 6310 }, 6311 setHistoryMessages: (state$3, action) => { 6312 const { sessionId, messages, hasMore } = action.payload; 6313 const existing = state$3.historyMessages[sessionId] ?? []; 6314 const cloudKeys = new Set(messages.map((m$2) => m$2.idClient || m$2.idServer)); 6315 const newestCloudTime = messages.reduce((max, m$2) => m$2.time > max ? m$2.time : max, 0); 6316 const localPending = existing.filter((m$2) => { 6317 if (cloudKeys.has(m$2.idClient || m$2.idServer)) return false; 6318 return m$2.status === "sending" || m$2.status === "fail" || m$2.time > newestCloudTime; 6319 }); 6320 state$3.historyMessages[sessionId] = [...messages, ...localPending].sort((a, b) => a.time - b.time); 6321 state$3.hasMoreHistory[sessionId] = hasMore ?? true; 6322 }, 6323 prependHistoryMessages: (state$3, action) => { 6324 const { sessionId, messages, hasMore } = action.payload; 6325 const existing = state$3.historyMessages[sessionId] ?? []; 6326 const seen = new Set(existing.map((m$2) => m$2.idClient || m$2.idServer)); 6327 const older = messages.filter((m$2) => !seen.has(m$2.idClient || m$2.idServer)); 6328 state$3.historyMessages[sessionId] = [...older, ...existing]; 6329 state$3.hasMoreHistory[sessionId] = hasMore; 6330 }, 6331 appendHistoryMessage: (state$3, action) => { 6332 const { sessionId, message } = action.payload; 6333 const existing = state$3.historyMessages[sessionId] ?? []; 6334 const key = message.idClient || message.idServer; 6335 if (existing.some((m$2) => (m$2.idClient || m$2.idServer) === key)) return; 6336 state$3.historyMessages[sessionId] = [...existing, message].sort((a, b) => a.time - b.time); 6337 }, 6338 updateHistoryMessage: (state$3, action) => { 6339 const { sessionId, message } = action.payload; 6340 const key = message.idClient || message.idServer; 6341 const list = state$3.historyMessages[sessionId] ?? []; 6342 const index = list.findIndex((m$2) => (m$2.idClient || m$2.idServer) === key); 6343 if (index === -1) state$3.historyMessages[sessionId] = [...list, message].sort((a, b) => a.time - b.time); 6344 else { 6345 list[index] = message; 6346 list.sort((a, b) => a.time - b.time); 6347 } 6348 }, 6349 clearMessages: () => initialState 6350 } 6351}); 6352const { setToken, setSessionId, setView, setFriends, setGroups, setGroupDetail, setSessions, updateSessions, removeGroup, removeSession, setHistoryMessages, prependHistoryMessages, appendHistoryMessage, updateHistoryMessage, clearMessages } = messagesSlice.actions; 6353const selectToken = (state$3) => state$3.messages.token; 6354const selectSessionId = (state$3) => state$3.messages.sessionId; 6355const selectView = (state$3) => state$3.messages.view; 6356const selectFriends = (state$3) => state$3.messages.friends; 6357const selectGroups = (state$3) => state$3.messages.groups; 6358const selectGroupDetail = (state$3) => state$3.messages.groupDetail; 6359const selectSessions = (state$3) => state$3.messages.sessions; 6360const selectHistoryMessages = (state$3) => state$3.messages.historyMessages; 6361const selectHasMoreHistory = (state$3, sessionId) => sessionId ? state$3.messages.hasMoreHistory[sessionId] ?? true : false; 6362const selectCurrentGroupTid = createSelector([selectGroups, selectSessionId], (groups, sessionId) => { 6363 const normalizedId = sessionId?.replace(/^team-/, ""); 6364 return (normalizedId && groups ? groups.find((g) => g.tid === normalizedId || String(g.id) === normalizedId) : void 0)?.tid; 6365}); 6366function teamMembersToContacts(teamMembers) { 6367 if (!teamMembers) return []; 6368 return teamMembers.map((member) => { 6369 const name = [member.firstName, member.lastName].filter(Boolean).join(" ") || member.email; 6370 return { 6371 id: String(member.id), 6372 accid: member.accid, 6373 tpUserId: member.tpId, 6374 name, 6375 role: member.role, 6376 phone: member.phone, 6377 company: member.companyName, 6378 avatar: { url: member.avatar } 6379 }; 6380 }); 6381} 6382const selectGroup = createSelector([selectGroupDetail], (groupDetail)
6382=> groupDetail ? { 6383 id: groupDetail.id, 6384 tid: groupDetail.tid, 6385 name: groupDetail.name, 6386 numberOfUsers: groupDetail.members, 6387 avatar: { url: groupDetail.avatar }, 6388 members: teamMembersToContacts(groupDetail.teamMembers), 6389 masterTpId: groupDetail.masterTpId 6390} : void 0); 6391const selectContacts = createSelector([selectFriends], (friends) => { 6392 if (!friends) return []; 6393 return friends.map((friend) => ({ 6394 id: friend.accId, 6395 accid: friend.accId, 6396 tpUserId: friend.tpUserId, 6397 clientUserId: friend.clientUserId, 6398 name: friend.clientUserName || friend.email, 6399 role: friend.role, 6400 phone: friend.phone, 6401 company: friend.companyName, 6402 avatar: { initials: getInitials(friend.clientUserName) } 6403 })); 6404}); 6405const selectMessageGroups = createSelector([selectGroups], (groups) => { 6406 return groups?.map((group) => ({ 6407 id: group.id, 6408 tid: group.tid, 6409 name: group.name, 6410 numberOfUsers: group.members, 6411 avatar: { 6412 url: group.avatar, 6413 backgroundColor: "bg-blue-900" 6414 } 6415 })) ?? []; 6416}); 6417function parseSystemMessageContent(content) { 6418 try { 6419 const parsed = JSON.parse(content || "{}"); 6420 if (parsed.messageType === "SYSTEM") return JSON.parse(parsed.extra || "{}").content; 6421 } catch {} 6422} 6423const selectRecentChats = createSelector([ 6424 selectSessions, 6425 selectFriends, 6426 selectGroups 6427], (sessions, friends, groups) => { 6428 if (!sessions) return []; 6429 return sessions.filter((session) => { 6430 const toId = session.to; 6431 if (session.scene === "team") { 6432 if (groups === void 0) return true; 6433 return groups.some((g) => g.tid === toId || String(g.id) === toId); 6434 } 6435 if (friends === void 0) return true; 6436 return friends.some((f$1) => f$1.accId === toId); 6437 }).map((session) => { 6438 const type = session.scene === "team" ? "team" : "p2p"; 6439 const toId = session.to; 6440 let name; 6441 let avatar = {}; 6442 let numberOfUsers; 6443 if (type === "team") { 6444 const group = groups?.find((g) => g.tid === toId || String(g.id) === toId); 6445 if (group) { 6446 name = group.name; 6447 numberOfUsers = group.members; 6448 avatar = { url: group.avatar }; 6449 } 6450 } else { 6451 const friend = friends?.find((f$1) => f$1.accId === toId); 6452 if (friend) { 6453 name = friend.clientUserName || friend.email; 6454 avatar = { url: friend.avatar }; 6455 } 6456 } 6457 let lastMessage = session.lastMsg.text || session.lastMsg.content; 6458 let isSystemMessage = false; 6459 let isNotification = false; 6460 if (session.lastMsg.type === "notification") { 6461 isNotification = true; 6462 lastMessage = "[System]"; 6463 } else if (session.lastMsg.type === "audio") lastMessage = "[Voice]"; 6464 else if (session.lastMsg.type === "image") lastMessage = "[Image]"; 6465 else if (session.lastMsg.content === "route") lastMessage = "[Route]"; 6466 else if (session.lastMsg.type === "custom") { 6467 const systemContent = parseSystemMessageContent(session.lastMsg.content); 6468 if (systemContent !== void 0) { 6469 isSystemMessage = true; 6470 lastMessage = systemContent; 6471 } 6472 } 6473 if (type === "team" && !isNotification) lastMessage = `${isSystemMessage ? "System" : session.lastMsg.fromNick}: ${lastMessage}`; 6474 const sessionDate = new Date(session.updateTime); 6475 const updatedAt = safeFormatDate(sessionDate, isToday(sessionDate) ? "HH:mm" : "MMM d"); 6476 return { 6477 id: session.id, 6478 type, 6479 name, 6480 unreadCount: session.unread > 0 ? session.unread : void 0, 6481 avatar, 6482 updatedAt, 6483 lastMessage, 6484 numberOfUsers 6485 }; 6486 }); 6487}); 6488function mapMessageStatus(status) { 6489 if (status === "sending") return "sending"; 6490 if (status === "fail") return "failed"; 6491 return "sent"; 6492} 6493const selectMessagesChats = createSelector([ 6494 selectHistoryMessages, 6495 selectSessionId, 6496 selectToken, 6497 selectFriends 6498], (historyMessages, sessionId, token, friends) => { 6499 if (!sessionId || !token) return []; 6500 const messages = historyMessages[sessionId]; 6501 if (!messages || messages.length === 0) return []; 6502 const currentUserId = token.accId; 6503 return messages.filter((msg) => msg.type !== "notification").map((msg) => { 6504 const isCurrentUser = msg.from === currentUserId; 6505 let messageType = "text"; 6506 let content = msg.text || msg.content; 6507 let trip; 6508 let duration; 6509 let width; 6510 let height; 6511 const localPreviewUrl = msg.localPreviewUrl; 6512 if (msg.type === "image") { 6513 messageType = "image"; 6514 content = msg.file?.url || localPreviewUrl; 6515 width = msg.file?.w; 6516 height = msg.file?.h; 6517 } else if (msg.type === "audio") { 6518 messageType = "audio"; 6519 content = msg.file?.url || localPreviewUrl; 6520 duration = msg.file?.dur ? msg.file.dur / 1e3 : void 0; 6521 } else if (msg.type === "custom" && msg.content === "route") { 6522 messageType = "trip"; 6523 try { 6524 const customData = JSON.parse(msg.custom || "{}"); 6525 const extraData = JSON.parse(customData.extra || "{}"); 6526 const sendData = extraData.sendData || {}; 6527 const waypointList = sendData.waypointList || []; 6528 trip = { 6529 id: extraData.tripId, 6530 tripCustomId: sendData.tripCustomId, 6531 stops: waypointList.map((waypoint) => ({ address: waypoint.title })), 6532 totalTime: sendData.drivingTimeHours || sendData.drivingTimeMinutes ? `${sendData.drivingTimeHours}hr ${sendData.drivingTimeMinutes || 0}m` : void 0, 6533 totalDistance: `${fromKmToMi(sendData.distance)}mi` 6534 }; 6535 content = "[Route]"; 6536 } catch { 6537 messageType = "text"; 6538 } 6539 } else if (msg.type === "custom") try { 6540 const parsed = JSON.parse(msg.content || "{}"); 6541 if (parsed.messageType === "SYSTEM") { 6542 messageType = "system"; 6543 content = JSON.parse(parsed.extra || "{}").content; 6544 } 6545 } catch {} 6546 const userName = msg.fromNick; 6547 let userAvatar = {}; 6548 if (!isCurrentUser) { 6549 const contact = friends?.find((f$1) => f$1.accId === msg.from); 6550 if (contact) userAvatar = { url: contact.avatar }; 6551 } 6552 return { 6553 id: msg.idClient || msg.idServer, 6554 type: messageType, 6555 user: { 6556 id: msg.from, 6557 name: userName, 6558 avatar: userAvatar 6559 },
6560 content, 6561 duration, 6562 width, 6563 height, 6564 trip, 6565 createdAt: new Date(msg.time), 6566 status: mapMessageStatus(msg.status), 6567 current: isCurrentUser 6568 }; 6569 }); 6570}); 6571const selectCurrentContact = createSelector([selectSessionId, selectFriends], (sessionId, friends) => { 6572 if (!sessionId || !friends) return; 6573 const userId = sessionId.replace(/^(p2p|team)-/, ""); 6574 const friend = friends.find((f$1) => f$1.accId === userId || String(f$1.tpUserId) === userId || String(f$1.clientUserId) === userId); 6575 if (!friend) return; 6576 const name = friend.clientUserName || friend.email; 6577 return { 6578 id: friend.accId, 6579 name, 6580 role: friend.role, 6581 company: friend.companyName, 6582 status: friend.workStatus || void 0, 6583 phone: friend.phone, 6584 avatar: { 6585 url: friend.avatar, 6586 backgroundColor: getAvatarBackgroundColorClass(name || ""), 6587 initials: getInitials(name) 6588 } 6589 }; 6590}); 6591const messagesApi = baseApi.injectEndpoints({ 6592 endpoints: (builder) => ({ 6593 getToken: builder.query({ 6594 query: () => ({ 6595 url: "command-center/zuul/chatV4/token/get", 6596 method: "GET", 6597 headers: { "system-source": "fleet" } 6598 }), 6599 onQueryStarted: async (_, { dispatch, queryFulfilled }) => { 6600 const { data } = await queryFulfilled; 6601 if (data.code === 200 && data.data) dispatch(setToken(data.data)); 6602 } 6603 }), 6604 getFriendList: builder.query({ 6605 query: () => ({ 6606 url: "command-center/zuul/chatV4/friend/list", 6607 method: "GET", 6608 headers: { "system-source": "fleet" } 6609 }), 6610 onQueryStarted: async (_, { dispatch, queryFulfilled }) => { 6611 const { data } = await queryFulfilled; 6612 if (data.code === 200 && data.data) dispatch(setFriends(data.data)); 6613 } 6614 }), 6615 getGroupList: builder.query({ 6616 query: () => ({ 6617 url: "command-center/zuul/chatV4/group/list", 6618 method: "GET", 6619 headers: { "system-source": "fleet" } 6620 }), 6621 onQueryStarted: async (_, { dispatch, queryFulfilled }) => { 6622 const { data } = await queryFulfilled; 6623 if (data.code === 200 && data.data) dispatch(setGroups(data.data)); 6624 }, 6625 providesTags: ["messages-groups"] 6626 }), 6627 createGroup: builder.mutation({ 6628 query: (data) => ({ 6629 url: "command-center/zuul/chatV4/group/create", 6630 method: "POST", 6631 body: data, 6632 headers: { "system-source": "fleet" } 6633 }), 6634 invalidatesTags: ["messages-groups"] 6635 }), 6636 editMessageGroup: builder.mutation({ 6637 query: (data) => ({ 6638 url: "command-center/zuul/chatV4/group/edit", 6639 method: "POST", 6640 body: data, 6641 headers: { "system-source": "fleet" } 6642 }), 6643 invalidatesTags: ["messages-groups"] 6644 }), 6645 disbandGroup: builder.mutation({ 6646 query: (params) => ({ 6647 url: "command-center/zuul/chatV4/group/dissolution", 6648 method: "GET", 6649 params, 6650 headers: { "system-source": "fleet" } 6651 }), 6652 invalidatesTags: ["messages-groups"] 6653 }), 6654 quitGroup: builder.mutation({ 6655 query: (params) => ({ 6656 url: "command-center/zuul/chatV4/group/quit", 6657 method: "GET", 6658 params, 6659 headers: { "system-source": "fleet" } 6660 }), 6661 invalidatesTags: ["messages-groups"] 6662 }), 6663 addGroupMember: builder.mutation({ 6664 query: ({ tid, memberIds }) => ({ 6665 url: "command-center/zuul/chatV4/group/add/member", 6666 method: "POST", 6667 params: { tid }, 6668 body: memberIds, 6669 headers: { "system-source": "fleet" } 6670 }), 6671 invalidatesTags: ["messages-groups"] 6672 }), 6673 removeGroupMember: builder.mutation({ 6674 query: ({ tid, memberIds }) => ({ 6675 url: "command-center/zuul/chatV4/group/remove/member", 6676 method: "POST", 6677 params: { tid }, 6678 body: memberIds, 6679 headers: { "system-source": "fleet" } 6680 }), 6681 invalidatesTags: ["messages-groups"] 6682 }), 6683 getGroupDetail: builder.query({ 6684 query: (params) => ({ 6685 url: "command-center/zuul/chatV4/group/detail", 6686 method: "GET", 6687 params, 6688 headers: { "system-source": "fleet" } 6689 }), 6690 onQueryStarted: async (_, { dispatch, queryFulfilled }) => { 6691 try { 6692 const { data } = await queryFulfilled; 6693 if (data.code === 200 && data.data) dispatch(setGroupDetail(data.data)); 6694 } catch {} 6695 }, 6696 providesTags: (_result, _error, params) => [{ 6697 type: "messages-groups", 6698 id: params.tid 6699 }] 6700 }) 6701 }), 6702 overrideExisting: true 6703}); 6704const { useGetTokenQuery, useGetFriendListQuery, useGetGroupListQuery, useCreateGroupMutation, useEditMessageGroupMutation, useDisbandGroupMutation, useQuitGroupMutation, useAddGroupMemberMutation, useRemoveGroupMemberMutation, useGetGroupDetailQuery } = messagesApi; 6705function createContext$1(rootComponentName, defaultValue) { 6706 const Context = (0, import_react.createContext)(defaultValue); 6707 function Provider$3({ children,...props }) { 6708 const value = (0, import_react.useMemo)(() => props, Object.values(props)); 6709 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Context.Provider, { 6710 value, 6711 children 6712 }); 6713 } 6714 Provider$3.displayName = `${rootComponentName}Provider`; 6715 function useContextValue() { 6716 const context = (0, import_react.useContext)(Context); 6717 if (context !== void 0) return context; 6718 if (defaultValue !== void 0) return defaultValue; 6719 throw new Error(`useContext must be used within \`${rootComponentName}Provider\`.`); 6720 } 6721 return [Provider$3, useContextValue]; 6722} 6723var create_context_default = createContext$1; 6724var import_storage = /* @__PURE__ */ __toESM(require_storage()); 6725var UPLOAD_BASE_URL = "https://fileupload.truckerpath.com"; 6726async function uploadImage(params) { 6727 const formData = new FormData(); 6728 formData.append("image", params.image); 6729 const res = await fetch(`${UPLOAD_BASE_URL}/tp/support/image`, { 6730 method: "POST", 6731 body: formData 6732 }); 6733 if (!res.ok) throw new Error(`Upload failed: ${res.status}`); 6734 return res.json(); 6735} 6736var uploadBaseQuery = fetchBaseQuery({ 6737 baseUrl: UPLOAD_BASE_URL, 6738 prepareHeaders: (headers, api) => { 6739 const appStorageState = api.getState().appStorage; 6740 if (appStorageState.userToken) headers.set("portal-token", appStorageState.userToken); 6741 return headers; 6742 } 6743}); 6744const uploadApi = createApi({ 6745 reducerPath: "uploadApi", 6746 baseQuery: uploadBaseQuery, 6747 tagTypes: [], 6748 endpoints: (builder) => ({ 6749 uploadImage: builder.mutation({ query: (params) => { 6750 const formData = new FormData(); 6751 formData.append("image", params.image); 6752 return { 6753 url: "/tp/support/image", 6754 method: "POST", 6755 body: formData 6756 }; 6757 } }), 6758 uploadMedia: builder.mutation({ query: (params) => { 6759 const formData = new FormData(); 6760 formData.append("file", params.file); 6761 return { 6762 url: "/tp/upload/video", 6763 method: "POST", 6764 body: formData 6765 }; 6766 } }) 6767 }) 6768}); 6769const { useUploadImageMutation, useUploadMediaMutation } = uploadApi; 6770var SESSION_EXPIRED_TOAST_ID = "session-expired"; 6771var LOGOUT_DELAY_ON_EXPIRY = 3e3; 6772var pendingLogout; 6773var isUnauthorized = (payload, baseQueryMeta) => { 6774 if (payload?.status === 401) return true; 6775 return baseQueryMeta?.response?.status === 401; 6776}; 6777var handleSessionExpiry = (api) => { 6778 const { userToken } = api.getState().appStorage; 6779 if (!userToken || pendingLogout) return; 6780 toast.error("Login expired, please log in again.", { id: SESSION_EXPIRED_TOAST_ID }); 6781 pendingLogout = setTimeout(() => { 6782 pendingLogout = void 0; 6783 api.dispatch(setUserToken(void 0)); 6784 }, LOGOUT_DELAY_ON_EXPIRY); 6785}; 6786const rtkQueryErrorCatcher = (api) => (next) => (action) => { 6787 if (isFulfilled(action)) {} else if (isRejectedWithValue(action)) { 6788 const { baseQueryMeta } = action.meta; 6789 if (isUnauthorized(action.payload, baseQueryMeta)) handleSessionExpiry(api); 6790 } else if (isRejected(action)) { 6791 const { meta } = action; 6792 if (meta.aborted) {} 6793 } 6794 return next(action); 6795}; 6796var LOCALSTORAGE_KEY_SHOW_EDIT_ROUTE = "showEditRoute"; 6797const getShowEditRoute = () => localStorage.getItem(LOCALSTORAGE_KEY_SHOW_EDIT_ROUTE) === "true"; 6798const clearShowEditRoute = () => { 6799 localStorage.removeItem(LOCALSTORAGE_KEY_SHOW_EDIT_ROUTE); 6800}; 6801const clearSessionOnLogout = (api) => (next) => (action) => { 6802 if (setUserToken.match(action) && action.payload === void 0) { 6803 api.dispatch(baseApi.util.resetApiState()); 6804 clearShowEditRoute(); 6805 } 6806 return next(action); 6807}; 6808var rootReducers = combineReducers({ 6809 [appStorageSlice.name]: appStorageSlice.reducer, 6810 [baseApi.reducerPath]: baseApi.reducer, 6811 [uploadApi.reducerPath]: uploadApi.reducer, 6812 [messagesAndDialersSlice.name]: messagesAndDialersSlice.reducer, 6813 [messagesSlice.name]: messagesSlice.reducer, 6814 [dialerSlice.name]: dialerSlice.reducer 6815});
6816var persistConfig = { 6817 key: "root", 6818 storage: import_storage.default, 6819 whitelist: [appStorageSlice.name] 6820}; 6821var persistedRootReducers = persistReducer(persistConfig, rootReducers); 6822const store = configureStore({ 6823 reducer: persistedRootReducers, 6824 middleware: (getDefaultMiddleware) => getDefaultMiddleware({ serializableCheck: { ignoredActions: [ 6825 FLUSH, 6826 REHYDRATE, 6827 PAUSE, 6828 PERSIST, 6829 PURGE, 6830 REGISTER 6831 ] } }).concat(baseApi.middleware, uploadApi.middleware, clearSessionOnLogout, rtkQueryErrorCatcher) 6832}); 6833const persistor = persistStore(store); 6834setupListeners(store.dispatch); 6835const ANY_EVENT = "__ANY__"; 6836const EDIT_DRIVER_IM_UPDATE = "driver"; 6837const DIALER_CHANGE = "dialer_change"; 6838const SYSTEM_MESSAGE = "system_message"; 6839const MISS_CALL = "miss_call"; 6840const VERIFY_PHONE = "verify_phone"; 6841var listeners = /* @__PURE__ */ new Map(); 6842var ws = null; 6843var heartbeatTimer = null; 6844var reconnectTimer = null; 6845var savedConfig = null; 6846var connectionGeneration = 0; 6847function emit(eventType, payload) { 6848 listeners.get(eventType)?.forEach((fn) => fn(payload)); 6849 if (eventType !== "__ANY__") listeners.get(ANY_EVENT)?.forEach((fn) => fn(payload)); 6850} 6851function onPushEvent(event, handler) { 6852 if (!listeners.has(event)) listeners.set(event, /* @__PURE__ */ new Set()); 6853 listeners.get(event).add(handler); 6854 return () => { 6855 listeners.get(event)?.delete(handler); 6856 }; 6857} 6858function disconnect() { 6859 connectionGeneration += 1; 6860 if (heartbeatTimer !== null) { 6861 clearInterval(heartbeatTimer); 6862 heartbeatTimer = null; 6863 } 6864 if (reconnectTimer !== null) { 6865 clearTimeout(reconnectTimer); 6866 reconnectTimer = null; 6867 } 6868 if (ws) { 6869 ws.onclose = null; 6870 ws.close(); 6871 ws = null; 6872 } 6873} 6874async function fetchPushToken() { 6875 const baseUrl = "https://api.truckerpath.com"; 6876 const portalToken = store.getState().appStorage.userToken; 6877 const res = await fetch(`${baseUrl}/message-center/token`, { 6878 method: "GET", 6879 headers: { ...portalToken ? { "portal-token": portalToken } : {} } 6880 }); 6881 if (!res.ok) throw new Error(`[push-service] Failed to fetch push token: ${res.status}`); 6882 const json = await res.json(); 6883 return json?.res?.data?.data ?? json?.data?.data ?? json?.data ?? json; 6884} 6885async function connect(config) { 6886 disconnect(); 6887 const generation = connectionGeneration; 6888 let token; 6889 try { 6890 token = await fetchPushToken(); 6891 } catch (err) { 6892 console.error("[push-service] Cannot connect, token fetch failed:", err); 6893 return; 6894 } 6895 if (generation !== connectionGeneration) return; 6896 const socket = new WebSocket(`wss://message.truckerpath.com?token=${token}`); 6897 ws = socket; 6898 socket.onopen = () => { 6899 socket.send(JSON.stringify({ 6900 action: "verify", 6901 [config.authBy]: config[config.authBy] 6902 })); 6903 heartbeatTimer = setInterval(() => { 6904 if (socket.readyState === WebSocket.OPEN) socket.send(JSON.stringify({ action: "heartbeat" })); 6905 }, 240 * 1e3); 6906 console.debug("[push-service] Connected"); 6907 }; 6908 socket.onmessage = (event) => { 6909 try { 6910 const msg = JSON.parse(event.data); 6911 if (msg.code !== 200) return; 6912 if (msg.data?.type !== 1 && msg.data?.type !== 2) return; 6913 const inner = msg.data?.data; 6914 const eventType = inner?.event ?? inner?.dataType ?? "__ANY__"; 6915 emit(eventType, msg); 6916 } catch {} 6917 }; 6918 socket.onerror = (err) => { 6919 console.error("[push-service] WebSocket error:", err); 6920 }; 6921 socket.onclose = () => { 6922 if (socket !== ws) return; 6923 if (heartbeatTimer !== null) { 6924 clearInterval(heartbeatTimer); 6925 heartbeatTimer = null; 6926 } 6927 ws = null; 6928 console.debug("[push-service] Disconnected, scheduling reconnect..."); 6929 if (savedConfig) reconnectTimer = setTimeout(() => { 6930 console.debug("[push-service] Reconnecting..."); 6931 connect(savedConfig); 6932 }, 3e3); 6933 }; 6934} 6935function initPush(config) { 6936 savedConfig = config; 6937 connect(config); 6938} 6939function destroyPush() { 6940 savedConfig = null; 6941 disconnect(); 6942} 6943var privateConf = { 6944 lbs_web: "https://yunxin.chime.me:443/lbs/webconf.jsp", 6945 link_web: "https://yunxin.chime.me:443", 6946 link_ssl_web: true, 6947 nos_uploader_web: "https://yunxin.chime.me:443", 6948 https_enabled: true, 6949 nos_downloader: "yunxin.chime.me:443/{bucket}/{object}", 6950 nos_accelerate: "",
6951 nos_accelerate_host: "", 6952 nt_server: "", 6953 kibana_server: "", 6954 statistic_server: "", 6955 report_global_server: "" 6956}; 6957var MESSAGES_PAGE_SIZE = 100; 6958var [MessagesContext, useMessagesContext] = create_context_default("MessagesContext", { 6959 nim: null, 6960 connected: false, 6961 loading: false, 6962 resetSessionUnread: () => {}, 6963 getMessages: () => {}, 6964 getOlderMessages: async () => {}, 6965 sendMessage: () => {}, 6966 resendMessage: () => {}, 6967 messageTo: () => {}, 6968 logoutAndDestroy: () => {} 6969}); 6970const MessagesProvider = ({ children,...options }) => { 6971 const nimRef = (0, import_react.useRef)(null); 6972 const currentSessionIdRef = (0, import_react.useRef)(null); 6973 const [syncing, setSyncing] = (0, import_react.useState)(false); 6974 const [connected, setConnected] = (0, import_react.useState)(false); 6975 const connectedRef = (0, import_react.useRef)(connected); 6976 (0, import_react.useEffect)(() => { 6977 connectedRef.current = connected; 6978 }, [connected]); 6979 const token = useAppSelector(selectToken); 6980 const tokenRef = (0, import_react.useRef)(token); 6981 (0, import_react.useEffect)(() => { 6982 tokenRef.current = token; 6983 }, [token]); 6984 const currentSessionId = useAppSelector(selectSessionId); 6985 const currentGroupTid = useAppSelector(selectCurrentGroupTid); 6986 const friends = useAppSelector(selectFriends); 6987 const groups = useAppSelector(selectGroups); 6988 const groupsRef = (0, import_react.useRef)(groups); 6989 (0, import_react.useEffect)(() => { 6990 groupsRef.current = groups; 6991 }, [groups]); 6992 const historyMessages = useAppSelector(selectHistoryMessages); 6993 const historyMessagesRef = (0, import_react.useRef)(historyMessages); 6994 (0, import_react.useEffect)(() => { 6995 historyMessagesRef.current = historyMessages; 6996 }, [historyMessages]); 6997 const dispatch = useAppDispatch(); 6998 const { isLoading: isTokenLoading, refetch: refetchToken } = useGetTokenQuery(); 6999 const refetchTokenRef = (0, import_react.useRef)(refetchToken); 7000 (0, import_react.useEffect)(() => { 7001 refetchTokenRef.current = refetchToken; 7002 }, [refetchToken]); 7003 const { isLoading: isFriendsLoading, refetch: refetchGetFriendList } = useGetFriendListQuery(); 7004 const refetchGetFriendListRef = (0, import_react.useRef)(refetchGetFriendList); 7005 (0, import_react.useEffect)(() => { 7006 refetchGetFriendListRef.current = refetchGetFriendList; 7007 }, [refetchGetFriendList]); 7008 const { isLoading: isGroupsLoading, refetch: refetchGroupList } = useGetGroupListQuery(); 7009 const refetchGroupListRef = (0, import_react.useRef)(refetchGroupList); 7010 (0, import_react.useEffect)(() => { 7011 refetchGroupListRef.current = refetchGroupList; 7012 }, [refetchGroupList]); 7013 useGetGroupDetailQuery({ tid: currentGroupTid ?? "" }, { skip: !currentGroupTid }); 7014 const loading = isTokenLoading || isFriendsLoading || isGroupsLoading || syncing; 7015 const resetSessionUnread = (sessionId) => { 7016 sessionId = sessionId || currentSessionId; 7017 if (!nimRef.current || !sessionId) return; 7018 nimRef.current.resetSessionUnread(sessionId, () => {}); 7019 }; 7020 const getMessages = (sessionId) => { 7021 sessionId = sessionId || currentSessionId; 7022 if (!nimRef.current || !sessionId) return; 7023 const scene = sessionId.startsWith("team") ? "team" : "p2p"; 7024 const to = sessionId.replace(/^(p2p|team)-/, ""); 7025 if (scene === "team") { 7026 if (!groupsRef.current?.some((g) => { 7027 return g.tid === to || String(g.id) === to; 7028 })) return; 7029 } 7030 nimRef.current.getHistoryMsgs({ 7031 scene, 7032 to, 7033 reverse: false, 7034 asc: true, 7035 limit: MESSAGES_PAGE_SIZE, 7036 done: (error, response) => { 7037 if (error) { 7038 if (scene === "team") { 7039 if (!groupsRef.current?.some((g) => { 7040 return g.tid === to || String(g.id) === to; 7041 })) return; 7042 } 7043 return; 7044 } 7045 dispatch(setHistoryMessages({ 7046 sessionId, 7047 messages: response.msgs, 7048 hasMore: response.msgs.length >= MESSAGES_PAGE_SIZE 7049 })); 7050 if (sessionId === currentSessionIdRef.current) resetSessionUnread(sessionId); 7051 } 7052 }); 7053 }; 7054 const getOlderMessages = (sessionId) => { 7055 sessionId = sessionId || currentSessionId; 7056 return new Promise((resolve) => { 7057 if (!nimRef.current || !sessionId) { 7058 resolve(); 7059 return; 7060 } 7061 const existing = historyMessagesRef.current[sessionId]; 7062 if (!existing || existing.length === 0) { 7063 resolve(); 7064 return; 7065 } 7066 const scene = sessionId.startsWith("team") ? "team" : "p2p"; 7067 const to = sessionId.replace(/^(p2p|team)-/, ""); 7068 const oldest = existing[0]; 7069 nimRef.current.getHistoryMsgs({ 7070 scene, 7071 to, 7072 endTime: oldest.time, 7073 lastMsgId: oldest.idServer, 7074 limit: MESSAGES_PAGE_SIZE, 7075 reverse: false, 7076 asc: true, 7077 done: (error, response) => { 7078 if (!error && response?.msgs) dispatch(prependHistoryMessages({ 7079 sessionId, 7080 messages: response.msgs, 7081 hasMore: response.msgs.length >= MESSAGES_PAGE_SIZE 7082 })); 7083 resolve(); 7084 } 7085 }); 7086 }); 7087 }; 7088 const messageTo = (userId) => { 7089 const friend = friends?.find((f$1) => { 7090 return f$1.accId === userId || f$1.clientUserId != null && String(f$1.clientUserId) === String(userId) || f$1.tpUserId != null && String(f$1.tpUserId) === String(userId); 7091 }); 7092 if (!friend) return; 7093 const sessionId = `p2p-${friend.accId}`; 7094 dispatch(setOpen(true)); 7095 dispatch(setView("p2p-chat")); 7096 dispatch(setSessionId(sessionId)); 7097 }; 7098 const sendMessage = ({ type = "text", text: text$1, image, audio, info }, sessionId) => { 7099 sessionId = sessionId || currentSessionId; 7100 if (!nimRef.current || !sessionId) return; 7101 const scene = sessionId.startsWith("team") ? "team" : "p2p"; 7102 const to = sessionId.replace(/^(p2p|team)-/, ""); 7103 if (type === "text" && text$1) { 7104 const sending = nimRef.current.sendText({ 7105 scene, 7106 to, 7107 type: "text", 7108 text: text$1, 7109 custom: JSON.stringify({ createtime: Date.now() }), 7110 done: (error, message) => { 7111 if (error) { 7112 dispatch(updateHistoryMessage({ 7113 sessionId, 7114 message: { 7115 ...sending, 7116 status: "fail" 7117 } 7118 })); 7119 return; 7120 } 7121 dispatch(updateHistoryMessage({ 7122 sessionId, 7123 message 7124 })); 7125 } 7126 }); 7127 dispatch(appendHistoryMessage({ 7128 sessionId, 7129 message: sending 7130 })); 7131 return sending; 7132 } 7133 if (type === "image" && image) { 7134 const previewUrl = URL.createObjectURL(image); 7135 const sending = nimRef.current.sendFile({ 7136 scene, 7137 to, 7138 type: "image", 7139 blob: image, 7140 custom: JSON.stringify({ createtime: Date.now() }), 7141 done: (error, result) => { 7142 if (error || "msg" in result) { 7143 dispatch(updateHistoryMessage({ 7144 sessionId, 7145 message: { 7146 ...sending, 7147 localPreviewUrl: previewUrl, 7148 status: "fail" 7149 } 7150 })); 7151 return; 7152 } 7153 URL.revokeObjectURL(previewUrl); 7154 dispatch(updateHistoryMessage({ 7155 sessionId, 7156 message: result 7157 })); 7158 } 7159 }); 7160 dispatch(appendHistoryMessage({ 7161 sessionId, 7162 message: { 7163 ...sending, 7164 localPreviewUrl: previewUrl 7165 } 7166 })); 7167 return sending; 7168 } 7169 if (type === "audio" && audio) { 7170 const previewUrl = URL.createObjectURL(audio); 7171 const sending = nimRef.current.sendFile({ 7172 scene, 7173 to, 7174 type: "audio", 7175 blob: audio, 7176 custom: JSON.stringify({ createtime: Date.now() }), 7177 done: (error, result) => { 7178 if (error || "msg" in result) { 7179 dispatch(updateHistoryMessage({ 7180 sessionId, 7181 message: { 7182 ...sending, 7183 localPreviewUrl: previewUrl, 7184 status: "fail" 7185 } 7186 })); 7187 return; 7188 } 7189 URL.revokeObjectURL(previewUrl); 7190 dispatch(updateHistoryMessage({ 7191 sessionId, 7192 message: result 7193 })); 7194 } 7195 }); 7196 dispatch(appendHistoryMessage({ 7197 sessionId, 7198 message: { 7199 ...sending, 7200 localPreviewUrl: previewUrl 7201 } 7202 })); 7203 return sending; 7204 } 7205 if (type === "custom" && info) { 7206 const sending = nimRef.current.sendCustomMsg({ 7207 scene, 7208 to, 7209 text: "route", 7210 content: "route", 7211 custom: JSON.stringify({ 7212 messageType: "ROUTE", 7213 createtime: info.createtime, 7214 extra: info.extra 7215 }), 7216 ...info.isResend ? { pushContent: "Your operator has updated your trip sc
7216heduled" } : {}, 7217 pushPayload: info.extra, 7218 done: (error, message) => { 7219 if (error) { 7220 dispatch(updateHistoryMessage({ 7221 sessionId, 7222 message: { 7223 ...sending, 7224 status: "fail" 7225 } 7226 })); 7227 return; 7228 } 7229 dispatch(updateHistoryMessage({ 7230 sessionId, 7231 message 7232 })); 7233 } 7234 }); 7235 dispatch(appendHistoryMessage({ 7236 sessionId, 7237 message: sending 7238 })); 7239 return sending; 7240 } 7241 }; 7242 const resendMessage = (idClient, sessionId) => { 7243 sessionId = sessionId || currentSessionId; 7244 if (!nimRef.current || !sessionId) return; 7245 const msg = historyMessagesRef.current[sessionId]?.find((m$2) => { 7246 return m$2.idClient === idClient; 7247 }); 7248 if (!msg) return; 7249 dispatch(updateHistoryMessage({ 7250 sessionId, 7251 message: { 7252 ...msg, 7253 status: "sending" 7254 } 7255 })); 7256 nimRef.current.resendMsg({ 7257 msg, 7258 done: (error, result) => { 7259 if (error || "msg" in result) { 7260 dispatch(updateHistoryMessage({ 7261 sessionId, 7262 message: { 7263 ...msg, 7264 status: "fail" 7265 } 7266 })); 7267 return; 7268 } 7269 dispatch(updateHistoryMessage({ 7270 sessionId, 7271 message: result 7272 })); 7273 } 7274 }); 7275 }; 7276 const refreshTokenAndReconnect = async () => { 7277 const instance = nimRef.current; 7278 if (!instance) return; 7279 try { 7280 const freshToken = (await refetchTokenRef.current()).data?.data?.token; 7281 if (freshToken) instance.setOptions({ token: freshToken }); 7282 if (!connectedRef.current) instance.connect({}); 7283 } catch {} 7284 }; 7285 const onConnect = () => { 7286 setConnected(true); 7287 const openSessionId = currentSessionIdRef.current; 7288 if (openSessionId && nimRef.current) getMessages(openSessionId); 7289 }; 7290 const onWillReconnect = () => { 7291 setConnected(false); 7292 const latestToken = tokenRef.current?.token; 7293 if (latestToken) nimRef.current?.setOptions({ token: latestToken }); 7294 }; 7295 const onDisconnect = (error) => { 7296 setConnected(false); 7297 const code = error?.code; 7298 if (code === "kicked" || code === "manuallyDisconnect") return; 7299 if (typeof code === "number" || code === "allAttemptsFailed") { 7300 refreshTokenAndReconnect(); 7301 return; 7302 } 7303 }; 7304 const onMsg = (message) => { 7305 if (message.scene === "team") { 7306 if (!groupsRef.current?.some((g) => { 7307 return g.tid === message.to || String(g.id) === message.to; 7308 })) return; 7309 } 7310 const sessionId = message.scene === "team" ? `team-${message.to}` : `p2p-${message.flow === "out" ? message.to : message.from}`; 7311 dispatch(appendHistoryMessage({ 7312 sessionId, 7313 message 7314 })); 7315 if (message.scene === "team" && parseSystemMessageContent(message.content) !== void 0) dispatch(messagesApi.util.invalidateTags(["messages-groups"])); 7316 if (sessionId === currentSessionIdRef.current) resetSessionUnread(sessionId); 7317 }; 7318 const onSessions = (sessions) => { 7319 dispatch(setSessions(sessions)); 7320 }; 7321 const onUpdateSessions = (toUpdateSessions) => { 7322 dispatch(updateSessions(toUpdateSessions)); 7323 if (toUpdateSessions.some((session) => { 7324 if (session.scene !== "team") return false; 7325 return !groupsRef.current?.some((g) => { 7326 return g.tid === session.to || String(g.id) === session.to; 7327 }); 7328 })) refetchGroupListRef.current(); 7329 }; 7330 const onUpdateTeam = () => { 7331 dispatch(messagesApi.util.invalidateTags(["messages-groups"])); 7332 }; 7333 const onCreateTeam = () => { 7334 dispatch(messagesApi.util.invalidateTags(["messages-groups"])); 7335 }; 7336 const onDismissTeam = (data) => { 7337 dispatch(removeSession(`team-${data.teamId}`)); 7338 dispatch(messagesApi.util.invalidateTags(["messages-groups"])); 7339 }; 7340 const onRemoveTeamMembers = (data) => { 7341 const { team, accounts } = data; 7342 const myAccId = tokenRef.current?.accId; 7343 if (!myAccId || !accounts?.includes(myAccId)) return; 7344 if (team?.teamId) dispatch(removeSession(`team-${team.teamId}`)); 7345 dispatch(messagesApi.util.invalidateTags(["messages-groups"])); 7346 }; 7347 const onSyncDone = () => { 7348 setSyncing(false); 7349 }; 7350 const onSyncFriendAction = () => { 7351 refetchGetFriendListRef.current(); 7352 }; 7353 (0, import_react.useEffect)(() => { 7354 return onPushEvent(EDIT_DRIVER_IM_UPDATE, () => { 7355 refetchGetFriendListRef.current(); 7356 }); 7357 }, []); 7358 const logoutAndDestroy = () => { 7359 const instance = nimRef.current; 7360 if (!instance) return; 7361 instance.logout(); 7362 instance.destroy({ done: () => { 7363 if (nimRef.current === instance) nimRef.current = null; 7364 setConnected(false); 7365 dispatch(clearMessages()); 7366 } }); 7367 }; 7368 const init = (account, token$1, opts) => { 7369 if (!account || !token$1) return; 7370 if (!opts?.silent) setSyncing(true); 7371 nimRef.current = import_NIM_Web_NIM.default.getInstance({ 7372 appKey: "504315dcd7e3ab247e23c4cea4848cf3", 7373 account, 7374 token: token$1, 7375 db: true, 7376 debug: false, 7377 authType: 0, 7378 privateConf, 7379 needReconnect: true, 7380 quickReconnect: true, 7381 onconnect: onConnect, 7382 ondisconnect: onDisconnect, 7383 onwillreconnect: onWillReconnect, 7384 onsyncdone: onSyncDone, 7385 onsyncfriendaction: onSyncFriendAction, 7386 syncTeams: false,
7387 onUpdateTeam, 7388 onCreateTeam, 7389 onDismissTeam, 7390 onRemoveTeamMembers, 7391 rollbackDelMsgUnread: true, 7392 syncRoamingMsgs: true, 7393 shouldIgnoreNotification: () => { 7394 return true; 7395 }, 7396 onmsg: onMsg, 7397 syncSessionUnread: true, 7398 syncSessions: true, 7399 onsessions: onSessions, 7400 onupdatesessions: onUpdateSessions, 7401 ...options 7402 }); 7403 }; 7404 const reconnect = async () => { 7405 const accId = tokenRef.current?.accId; 7406 if (!accId) return; 7407 let freshToken = tokenRef.current?.token; 7408 try { 7409 freshToken = (await refetchTokenRef.current()).data?.data?.token ?? freshToken; 7410 } catch {} 7411 if (!freshToken) return; 7412 const stale = nimRef.current; 7413 const start = () => { 7414 return init(accId, freshToken, { silent: true }); 7415 }; 7416 if (!stale) { 7417 start(); 7418 return; 7419 } 7420 stale.logout(); 7421 stale.destroy({ done: () => { 7422 if (nimRef.current === stale) nimRef.current = null; 7423 start(); 7424 } }); 7425 }; 7426 (0, import_react.useEffect)(() => { 7427 const handleOnline = () => { 7428 trackMethodCall("handleOnline", []); 7429 if (!connectedRef.current) reconnect(); 7430 }; 7431 window.addEventListener("online", handleOnline); 7432 return () => { 7433 return window.removeEventListener("online", handleOnline); 7434 }; 7435 }, []); 7436 (0, import_react.useEffect)(() => { 7437 init(token?.accId, token?.token); 7438 return () => { 7439 logoutAndDestroy(); 7440 }; 7441 }, [token?.accId]); 7442 (0, import_react.useEffect)(() => { 7443 currentSessionIdRef.current = currentSessionId ?? null; 7444 if (currentSessionId && nimRef.current) getMessages(currentSessionId); 7445 }, [currentSessionId]); 7446 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesContext, { 7447 nim: nimRef.current, 7448 loading, 7449 resetSessionUnread, 7450 getMessages, 7451 getOlderMessages, 7452 sendMessage, 7453 resendMessage, 7454 messageTo, 7455 logoutAndDestroy, 7456 connected, 7457 children 7458 }); 7459}; 7460var import_compiler_runtime$122 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 7461var NavFooter = () => { 7462 const $ = (0, import_compiler_runtime$122.c)(50); 7463 const { isMobile } = useSidebar(); 7464 const navigate = useNavigate(); 7465 const dispatch = useAppDispatch(); 7466 const userInfo = useUserInfoQueryState(); 7467 const { pathname } = useLocation(); 7468 const sheetOpen = useAppSelector(selectOpen); 7469 const { logoutAndDestroy } = useMessagesContext(); 7470 const { hasNewNotes, markLatestAnySeen } = useReleaseNoteSidebarEntry(); 7471 let t0; 7472 if ($[0] !== pathname) { 7473 t0 = (path) => pathname.startsWith(path); 7474 $[0] = pathname; 7475 $[1] = t0; 7476 } else t0 = $[1]; 7477 const checkIfActivePath = t0; 7478 let t1; 7479 if ($[2] !== markLatestAnySeen) { 7480 t1 = () => { 7481 trackMethodCall("handleOpenWhatsNew", []); 7482 markLatestAnySeen(); 7483 window.open("/release-history", "_blank", "noopener,noreferrer"); 7484 }; 7485 $[2] = markLatestAnySeen; 7486 $[3] = t1; 7487 } else t1 = $[3]; 7488 const handleOpenWhatsNew = t1; 7489 let t2; 7490 if ($[4] !== dispatch || $[5] !== logoutAndDestroy || $[6] !== navigate) { 7491 t2 = () => { 7492 trackMethodCall("handleLogout", []); 7493 logoutAndDestroy(); 7494 dispatch(clearMessagesAndDialers()); 7495 dispatch(clearMessages()); 7496 dispatch(setUserToken(void 0)); 7497 navigate("/login"); 7498 }; 7499 $[4] = dispatch; 7500 $[5] = logoutAndDestroy; 7501 $[6] = navigate; 7502 $[7] = t2; 7503 } else t2 = $[7]; 7504 const handleLogout = t2; 7505 let t3; 7506 if ($[8] !== navigate) { 7507 t3 = () => { 7508 trackMethodCall("handleEditProfile", []); 7509 navigate("/settings/personal-profile"); 7510 }; 7511 $[8] = navigate; 7512 $[9] = t3; 7513 } else t3 = $[9]; 7514 const handleEditProfile = t3; 7515 const t4 = userInfo?.firstName; 7516 const t5 = userInfo?.lastName; 7517 let t6; 7518 if ($[10] !== t4 || $[11] !== t5) { 7519 t6 = getInitials(t4, t5); 7520 $[10] = t4; 7521 $[11] = t5; 7522 $[12] = t6; 7523 } else t6 = $[12]; 7524 const initials = t6; 7525 let t7; 7526 if ($[13] === Symbol.for("react.memo_cache_sentinel")) { 7527 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarMenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarMenuButton, { 7528 tooltip: "Live Support", 7529 "aria-label": "Live Support", 7530 onClick: openZendeskChat, 7531 className: "h-10 gap-3 p-2 font-medium opacity-70 group-data-[collapsible=icon]:size-10! hover:opacity-100", 7532 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { 7533 className: "size-6", 7534 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Headset, { 7535 className: "size-6", 7536 strokeWidth: 1.5 7537 }) 7538 }
7538), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Live Support" })] 7539 }) }); 7540 $[13] = t7; 7541 } else t7 = $[13]; 7542 let t8; 7543 if ($[14] !== dispatch || $[15] !== sheetOpen) { 7544 t8 = () => { 7545 if (sheetOpen) dispatch(closeNestedSheet()); 7546 dispatch(setOpen(!sheetOpen)); 7547 }; 7548 $[14] = dispatch; 7549 $[15] = sheetOpen; 7550 $[16] = t8; 7551 } else t8 = $[16]; 7552 let t9; 7553 if ($[17] === Symbol.for("react.memo_cache_sentinel")) { 7554 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { 7555 className: "size-6", 7556 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 7557 name: "messages", 7558 className: "size-6" 7559 }) 7560 }); 7561 $[17] = t9; 7562 } else t9 = $[17]; 7563 let t10; 7564 if ($[18] !== t8) { 7565 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarMenuButton, { 7566 tooltip: "Messages", 7567 className: "h-10 gap-3 p-2 font-medium opacity-70 group-data-[collapsible=icon]:size-10! hover:opacity-100 data-[active=true]:opacity-100", 7568 onClick: t8, 7569 children: [t9, "Messages"] 7570 }); 7571 $[18] = t8; 7572 $[19] = t10; 7573 } else t10 = $[19]; 7574 let t11; 7575 if ($[20] !== checkIfActivePath) { 7576 t11 = checkIfActivePath("/settings"); 7577 $[20] = checkIfActivePath; 7578 $[21] = t11; 7579 } else t11 = $[21]; 7580 let t12; 7581 if ($[22] === Symbol.for("react.memo_cache_sentinel")) { 7582 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, { 7583 to: "/settings", 7584 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { 7585 className: "size-6", 7586 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 7587 name: "setting", 7588 className: "size-6" 7589 }) 7590 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Settings" })] 7591 }); 7592 $[22] = t12; 7593 } else t12 = $[22]; 7594 let t13; 7595 if ($[23] !== t11) { 7596 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarMenuButton, { 7597 asChild: true, 7598 tooltip: "Settings", 7599 className: "h-10 gap-3 p-2 font-medium opacity-70 group-data-[collapsible=icon]:size-10! hover:opacity-100 data-[active=true]:opacity-100", 7600 isActive: t11, 7601 children: t12 7602 }); 7603 $[23] = t11; 7604 $[24] = t13; 7605 } else t13 = $[24]; 7606 let t14; 7607 if ($[25] === Symbol.for("react.memo_cache_sentinel")) { 7608 t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 7609 name: "announcement", 7610 className: "size-6" 7611 }); 7612 $[25] = t14; 7613 } else t14 = $[25]; 7614 let t15; 7615 if ($[26] !== hasNewNotes) { 7616 t15 = hasNewNotes && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 7617 "aria-hidden": true, 7618 className: "absolute -top-0.5 -right-0.5 size-2 rounded-full bg-primary" 7619 }); 7620 $[26] = hasNewNotes; 7621 $[27] = t15; 7622 } else t15 = $[27]; 7623 let t16; 7624 if ($[28] !== t15) { 7625 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("i", { 7626 className: "relative size-6", 7627 children: [t14, t15] 7628 }); 7629 $[28] = t15; 7630 $[29] = t16; 7631 } else t16 = $[29]; 7632 let t17; 7633 if ($[30] === Symbol.for("react.memo_cache_sentinel")) { 7634 t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "What's New" }); 7635 $[30] = t17; 7636 } else t17 = $[30]; 7637 let t18; 7638 if ($[31] !== handleOpenWhatsNew || $[32] !== t16) { 7639 t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarMenuButton, { 7640 tooltip: "What's New", 7641 "aria-label": "What's New", 7642 onClick: handleOpenWhatsNew, 7643 className: "h-10 gap-3 p-2 font-medium opacity-70 group-data-[collapsible=icon]:size-10! hover:opacity-100", 7644 children: [t16, t17] 7645 }); 7646 $[31] = handleOpenWhatsNew; 7647 $[32] = t16; 7648 $[33] = t18; 7649 } else t18 = $[33]; 7650 let t19; 7651 if ($[34] !== t10 || $[35] !== t13 || $[36] !== t18) { 7652 t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarMenuItem, { children: [ 7653 t10, 7654 t13, 7655 t18 7656 ] }); 7657 $[34] = t10; 7658 $[35] = t13; 7659 $[36] = t18; 7660 $[37] = t19; 7661 } else t19 = $[37]; 7662 let t20; 7663 if ($[38] !== handleEditProfile || $[39] !== handleLogout || $[40] !== initials || $[41] !== isMobile || $[42] !== userInfo) {
7664 t20 = userInfo && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarMenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FreeTrialCard, { dayCount: userInfo.dayCount }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarMenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenu, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownMenuTrigger, { 7665 asChild: true, 7666 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarMenuButton, { 7667 size: "lg", 7668 className: "h-15 pl-0 group-data-[collapsible=icon]:size-10! data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground", 7669 children: [ 7670 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Avatar, { 7671 className: "ml-1 size-8 rounded-full", 7672 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarFallback, { 7673 className: "rounded-lg bg-[#CCCED6]", 7674 children: initials 7675 }) 7676 }), 7677 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 7678 className: "grid flex-1 text-left text-sm leading-tight", 7679 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { 7680 className: "truncate font-medium", 7681 children: [ 7682 userInfo.firstName, 7683 " ", 7684 userInfo.lastName 7685 ] 7686 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 7687 className: "truncate text-xs text-muted-foreground", 7688 children: userInfo.companyName 7689 })] 7690 }), 7691 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronsUpDown, { className: "text-muted-foreground" }) 7692 ] 7693 }) 7694 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenuContent, { 7695 className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-md p-1.5", 7696 side: isMobile ? "bottom" : "top", 7697 align: "end", 7698 sideOffset: 5, 7699 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenuItem, { 7700 onClick: handleEditProfile, 7701 className: "p-2", 7702 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PencilLine, { className: "size-4" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Edit Profile" })] 7703 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenuItem, { 7704 onClick: handleLogout, 7705 className: "p-2", 7706 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LogOut, { className: "size-4" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Logout" })] 7707 })] 7708 })] }) })] }); 7709 $[38] = handleEditProfile; 7710 $[39] = handleLogout; 7711 $[40] = initials; 7712 $[41] = isMobile; 7713 $[42] = userInfo; 7714 $[43] = t20; 7715 } else t20 = $[43]; 7716 let t21; 7717 if ($[44] !== t19 || $[45] !== t20) { 7718 t21 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarGroup, { 7719 className: "p-0", 7720 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarGroupContent, { 7721 className: "px-3 pb-1.5", 7722 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarMenu, { children: [ 7723 t7, 7724 t19, 7725 t20 7726 ] }) 7727 }) 7728 }); 7729 $[44] = t19; 7730 $[45] = t20; 7731 $[46] = t21; 7732 } else t21 = $[46]; 7733 let t22; 7734 if ($[47] === Symbol.for("react.memo_cache_sentinel")) { 7735 t22 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WhatsNewAutoPopup, {}); 7736 $[47] = t22; 7737 } else t22 = $[47]; 7738 let t23; 7739 if ($[48] !== t21) { 7740 t23 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarFooter, { 7741 className: "p-0", 7742 children: [t21, t22] 7743 }); 7744 $[48] = t21; 7745 $[49] = t23; 7746 } else t23 = $[49]; 7747 return t23; 7748}; 7749function AppSidebar({ ...props }) { 7750 const responsive = useResponsive(); 7751 const { setOpen: setOpen$1, state: state$3, toggleSidebar } = useSidebar(); 7752 (0, import_react.useEffect)(() => { 7753 setOpen$1(responsive["3xl"] ?? false); 7754 }, []); 7755 const onSidebarBackgroundClick = (e$4) => { 7756 if (state$3 !== "collapsed") return; 7757 if (!e$4.target.closest("button, a, [role=\"button\"]")) toggleSidebar(); 7758 }; 7759 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Sidebar, { 7760 collapsible: "icon", 7761 className: "group p-0", 7762 variant: "inset", 7763 onClick: onSidebarBackgroundClick, 7764 ...props, 7765 children: [
7766 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavHeader, {}), 7767 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavMain, {}), 7768 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NavFooter, {}) 7769 ] 7770 }); 7771} 7772const dialersApi = baseApi.injectEndpoints({ 7773 endpoints: (builder) => ({ 7774 getActive: builder.query({ 7775 query: () => ({ 7776 url: "command-center/dialer/call/active", 7777 method: "GET", 7778 headers: { "system-source": "fleet" } 7779 }), 7780 onQueryStarted: async (_, { dispatch, queryFulfilled }) => { 7781 const { data } = await queryFulfilled; 7782 if (data.code === 200 && data.data) dispatch(setActive(data.data)); 7783 }, 7784 providesTags: [{ 7785 type: "dialers", 7786 id: "GET_ACTIVE" 7787 }] 7788 }), 7789 getCount: builder.query({ 7790 query: () => ({ 7791 url: "command-center/dialer/call-records/unread/count", 7792 method: "GET", 7793 headers: { "system-source": "fleet" } 7794 }), 7795 providesTags: [{ 7796 type: "dialers", 7797 id: "UNREAD_COUNT" 7798 }], 7799 onQueryStarted: async (_, { dispatch, queryFulfilled }) => { 7800 const { data } = await queryFulfilled; 7801 if (data.code === 200 && data.data) dispatch(setCount(data.data)); 7802 } 7803 }), 7804 getTwilioToken: builder.query({ 7805 query: (params) => ({ 7806 url: "command-center/dialer/call/token", 7807 method: "GET", 7808 params: params ?? void 0, 7809 headers: { "system-source": "fleet" } 7810 }), 7811 onQueryStarted: async (_, { dispatch, queryFulfilled }) => { 7812 const { data } = await queryFulfilled; 7813 if (data.code === 200 && data.data) dispatch(setTwilioToken(data.data)); 7814 } 7815 }), 7816 preCheck: builder.query({ query: (params) => ({ 7817 url: "command-center/dialer/call/pre-check", 7818 method: "GET", 7819 params, 7820 headers: { "system-source": "fleet" } 7821 }) }), 7822 getDialerVirtualNumbersList: builder.query({ 7823 query: (params) => ({ 7824 url: "/command-center/dialer/virtual-numbers/list", 7825 method: "GET", 7826 params, 7827 headers: { "system-source": "fleet" } 7828 }), 7829 providesTags: ["dialers"] 7830 }), 7831 getRemainSeats: builder.query({ 7832 query: () => ({ 7833 url: "/command-center/dialer/setting/get/seat/number", 7834 method: "POST", 7835 headers: { "system-source": "fleet" } 7836 }), 7837 providesTags: ["dialers"] 7838 }), 7839 addVirtualNumber: builder.mutation({ 7840 query: (data) => ({ 7841 url: "/command-center/dialer/virtual-numbers/add", 7842 method: "POST", 7843 body: JSON.stringify(data), 7844 headers: { "system-source": "fleet" } 7845 }), 7846 invalidatesTags: [ 7847 { 7848 type: "dialers", 7849 id: "NUMBERS" 7850 }, 7851 { 7852 type: "dialers", 7853 id: "GET_ACTIVE" 7854 }, 7855 "subscriptionSummary" 7856 ] 7857 }), 7858 getDialerSettingNumbersList: builder.query({ 7859 query: (data) => ({ 7860 url: "/command-center/dialer/setting/list", 7861 method: "POST", 7862 body: JSON.stringify(data), 7863 headers: { "system-source": "fleet" } 7864 }), 7865 providesTags: [{ 7866 type: "dialers", 7867 id: "NUMBERS" 7868 }] 7869 }), 7870 getDialerSettingCallOutcomeList: builder.query({ 7871 query: () => ({ 7872 url: "/command-center/dialer/setting/call-outcome/list", 7873 method: "GET", 7874 headers: { "system-source": "fleet" } 7875 }), 7876 providesTags: [{ 7877 type: "dialers", 7878 id: "CALL_OUTCOME" 7879 }] 7880 }), 7881 deleteDialerSettingCallOutcome: builder.mutation({ 7882 query: (params) => ({ 7883 url: "/command-center/dialer/setting/call-outcome/delete", 7884 method: "GET", 7885 params, 7886 headers: { "system-source": "fleet" } 7887 }), 7888 invalidatesTags: [{ 7889 type: "dialers", 7890 id: "CALL_OUTCOME" 7891 }] 7892 }), 7893 mutateDialerSettingCallOutcome: builder.mutation({ 7894 query: (data) => ({ 7895 url: "/command-center/dialer/setting/call-outcome/option", 7896 method: "POST", 7897 body: JSON.stringify(data), 7898 headers: { "system-source": "fleet" } 7899 }), 7900 invalidatesTags: [{ 7901 type: "dialers", 7902 id: "CALL_OUTCOME" 7903 }] 7904 }), 7905 getDialerSettingUsersList: builder.query({ 7906 query: (params) => ({ 7907 url: "/command-center/dialer/setting/user/list", 7908 method: "GET", 7909 params, 7910 headers: { "system-source": "fleet" } 7911 }), 7912 providesTags: [{ 7913 type: "dialers", 7914 id: "USERS" 7915 }] 7916 }), 7917 assignDialerSettingVirtualNumber: builder.mutation({ 7918 query: (data) => ({ 7919 url: "/command-center/dialer/setting/assign/virtual-number", 7920 method: "POST", 7921 body: JSON.stringify(data), 7922 headers: { "system-source": "fleet" } 7923 }), 7924 invalidatesTags: [ 7925 { 7926 type: "dialers", 7927 id: "NUMBERS" 7928 }, 7929 { 7930 type: "dialers", 7931 id: "GET_ACTIVE" 7932 }, 7933 { 7934 type: "dialers", 7935 id: "USER_DIALER_SETTING_INFO" 7936 } 7937 ] 7938 }), 7939 deleteDialerSettingVirtualNumber: builder.mutation({ 7940 query: (params) => ({ 7941 url: "/command-center/dialer/virtual-numbers/delete", 7942 method: "GET", 7943 params, 7944 headers: { "system-source": "fleet" } 7945 }), 7946 invalidatesTags: [ 7947 { 7948 type: "dialers", 7949 id: "NUMBERS" 7950 }, 7951 { 7952 type: "dialers", 7953 id: "GET_ACTIVE" 7954 }, 7955 { 7956 type: "dialers", 7957 id: "USER_DIALER_SETTING_INFO" 7958 } 7959 ] 7960 }), 7961 getUserDialerSettingInfo: builder.query({ 7962 query: () => ({ 7963 url: "/command-center/user/setting/my/dialer/info", 7964 method: "GET", 7965 headers: { "system-source": "fleet" } 7966 }), 7967 providesTags: [{ 7968 type: "dialers", 7969 id: "USER_DIALER_SETTING_INFO" 7970 }] 7971 }), 7972 switchDialerSettingCallRecord: builder.mutation({ 7973 query: (data) => ({ 7974 url: "/command-center/user/setting/update/switch", 7975 method: "POST", 7976 body: JSON.stringify(data), 7977 headers: { "system-source": "fleet" } 7978 }), 7979 invalidatesTags: [{ 7980 type: "dialers", 7981 id: "NUMBERS" 7982 }, { 7983 type: "dialers", 7984 id: "USER_DIALER_SETTING_INFO" 7985 }] 7986 }), 7987 getFuzzySearchPhone: builder.query({ 7988 query: (params) => ({ 7989 url: "/command-center/dialer/user-phone/fuzzy/search/phone", 7990 method: "GET", 7991 params, 7992 headers: { "system-source": "fleet" } 7993 }), 7994 providesTags: [{ 7995 type: "dialers", 7996 id: "FUZZY_SEARCH_PHONE" 7997 }] 7998 }), 7999 getUserPhoneSearch: builder.query({ 8000 query: (params) => ({ 8001 url: "/command-center/dialer/user-phone/search", 8002 method: "GET", 8003 params, 8004 headers: { "system-source": "fleet" } 8005 }), 8006 providesTags: [{ 8007 type: "dialers", 8008 id: "USER_PHONE_SEARCH" 8009 }] 8010 }), 8011 getDialerRecentList: builder.infiniteQuery({ 8012 query: ({ queryArg, pageParam }) => ({ 8013 url: "/command-center/dialer/call-records/recent", 8014 method: "POST", 8015 body: JSON.stringify({ 8016 ...queryArg, 8017 page: pageParam 8018 }), 8019 headers: { "system-source": "fleet" } 8020 }), 8021 infiniteQueryOptions: { 8022 initialPageParam: 1, 8023 getNextPageParam: (lastPage, _allPages, lastPageParam, _allPageParams, queryArg) => { 8024 if (lastPage.code !== 200 || !lastPage.data) return; 8025 if (lastPage.data.length < queryArg.size) return; 8026 return lastPageParam + 1; 8027 } 8028 }, 8029 providesTags: [{ 8030 type: "dialers", 8031 id: "RECENT_LIST" 8032 }] 8033 }),
8034 saveCallResult: builder.mutation({ 8035 query: (data) => ({ 8036 url: "/command-center/dialer/call-records", 8037 method: "POST", 8038 body: JSON.stringify(data), 8039 headers: { "system-source": "fleet" } 8040 }), 8041 invalidatesTags: [ 8042 { 8043 type: "dialers", 8044 id: "RECENT_LIST" 8045 }, 8046 { 8047 type: "dialers", 8048 id: "VOICEMAIL_LIST" 8049 }, 8050 { 8051 type: "dialers", 8052 id: "GET_DIALER_CALL_RESULT" 8053 }, 8054 { 8055 type: "dialers", 8056 id: "GET_DIALER_ACTIVITIES_IN_DIALOG" 8057 } 8058 ] 8059 }), 8060 getDialerVoicemailList: builder.infiniteQuery({ 8061 query: ({ queryArg, pageParam }) => ({ 8062 url: "/command-center/user/setting/voice/email", 8063 method: "POST", 8064 body: JSON.stringify({ 8065 ...queryArg, 8066 page: pageParam 8067 }), 8068 headers: { "system-source": "fleet" } 8069 }), 8070 infiniteQueryOptions: { 8071 initialPageParam: 0, 8072 getNextPageParam: (lastPage) => { 8073 if (lastPage.code !== 200 || !lastPage.data) return; 8074 const { page, size, total } = lastPage.data; 8075 return (page + 1) * size < total ? page + 1 : void 0; 8076 } 8077 }, 8078 providesTags: [{ 8079 type: "dialers", 8080 id: "VOICEMAIL_LIST" 8081 }], 8082 onQueryStarted: async (arg, { dispatch, queryFulfilled }) => { 8083 if (arg.startDate !== "" || arg.endDate !== "") return; 8084 const { data } = await queryFulfilled; 8085 const firstPage = data?.pages?.[0]; 8086 if (firstPage?.code !== 200 || !firstPage.data) return; 8087 const totalUnRead = firstPage.data.data?.[0]?.totalUnRead; 8088 if (totalUnRead != null) dispatch(setVoicemailUnreadCount(totalUnRead)); 8089 } 8090 }), 8091 markDialerVoiceAsRead: builder.mutation({ 8092 query: (params) => ({ 8093 url: "/command-center/user/setting/read/record", 8094 method: "GET", 8095 params, 8096 headers: { "system-source": "fleet" } 8097 }), 8098 invalidatesTags: [{ 8099 type: "dialers", 8100 id: "VOICEMAIL_LIST" 8101 }, { 8102 type: "dialers", 8103 id: "UNREAD_COUNT" 8104 }] 8105 }), 8106 markDialerRecentCallAsRead: builder.mutation({ 8107 query: (params) => ({ 8108 url: "/command-center/user/setting/read/record", 8109 method: "GET", 8110 params, 8111 headers: { "system-source": "fleet" } 8112 }), 8113 invalidatesTags: [{ 8114 type: "dialers", 8115 id: "RECENT_LIST" 8116 }, { 8117 type: "dialers", 8118 id: "UNREAD_COUNT" 8119 }] 8120 }), 8121 getDialerVoiceMessagesList: builder.query({ 8122 query: () => ({ 8123 url: "/command-center/user/setting/voice/list", 8124 method: "GET", 8125 headers: { "system-source": "fleet" } 8126 }), 8127 providesTags: [{ 8128 type: "dialers", 8129 id: "VOICE_MESSAGES_LIST" 8130 }] 8131 }), 8132 saveDialerVoiceInfo: builder.mutation({ 8133 query: (data) => ({ 8134 url: "/command-center/user/setting/save/voice/info", 8135 method: "POST", 8136 body: JSON.stringify(data), 8137 headers: { "system-source": "fleet" } 8138 }), 8139 invalidatesTags: [{ 8140 type: "dialers", 8141 id: "VOICE_MESSAGES_LIST" 8142 }] 8143 }), 8144 deleteDialerVoiceMessage: builder.mutation({ 8145 query: (params) => ({ 8146 url: "/command-center/user/setting/voice/delete", 8147 method: "GET", 8148 params, 8149 headers: { "system-source": "fleet" } 8150 }), 8151 invalidatesTags: [{ 8152 type: "dialers", 8153 id: "VOICE_MESSAGES_LIST" 8154 }] 8155 }), 8156 changeDialerUserPhoneNumber: builder.mutation({ 8157 query: (data) => ({ 8158 url: "/command-center/user/setting/change/phone/number", 8159 method: "POST", 8160 body: JSON.stringify(data), 8161 headers: { "system-source": "fleet" } 8162 }), 8163 invalidatesTags: [{ 8164 type: "dialers", 8165 id: "USER_DIALER_SETTING_INFO" 8166 }] 8167 }), 8168 verifyDialerUserPhoneNumber: builder.mutation({ 8169 query: (data) => ({ 8170 url: "/command-center/user/setting/verify/phone", 8171 method: "POST", 8172 body: JSON.stringify(data), 8173 headers: { "system-source": "fleet" } 8174 }), 8175 invalidatesTags: [{ 8176 type: "dialers", 8177 id: "USER_DIALER_SETTING_INFO" 8178 }] 8179 }), 8180 unbindDialerUserPhoneNumber: builder.mutation({ 8181 query: (data) => ({ 8182 url: "/command-center/user/setting/unbind/phone", 8183 method: "POST", 8184 body: JSON.stringify(data), 8185 headers: { "system-source": "fleet" } 8186 }), 8187 invalidatesTags: [{ 8188 type: "dialers", 8189 id: "USER_DIALER_SETTING_INFO" 8190 }] 8191 }), 8192 getDialerCallResult: builder.query({ 8193 query: (params) => ({ 8194 url: "/command-center/dialer/call-records", 8195 method: "GET", 8196 params, 8197 headers: { "system-source": "fleet" } 8198 }), 8199 providesTags: [{ 8200 type: "dialers", 8201 id: "GET_DIALER_CALL_RESULT" 8202 }] 8203 }), 8204 getDialerLoads: builder.query({ 8205 query: (params) => ({ 8206 url: "/command-center/load/call-info/list", 8207 method: "GET", 8208 params, 8209 headers: { "system-source": "fleet" } 8210 }), 8211 providesTags: [{ 8212 type: "dialers", 8213 id: "GET_DIALER_LOADS" 8214 }] 8215 }), 8216 getDialerContact: builder.query({ 8217 query: (params) => ({ 8218 url: "/command-center/dialer/contacts", 8219 method: "GET", 8220 params, 8221 headers: { "system-source": "fleet" } 8222 }), 8223 providesTags: [{ 8224 type: "dialers", 8225 id: "GET_DIALER_CONTACT" 8226 }] 8227 }), 8228 getDialerContactsList: builder.query({ 8229 query: (params) => ({ 8230 url: "/command-center/dialer/contacts/list", 8231 method: "GET", 8232 params, 8233 headers: { "system-source": "fleet" } 8234 }), 8235 providesTags: [{ 8236 type: "dialers", 8237 id: "CONTACTS_LIST" 8238 }] 8239 }), 8240 getDialerActivitiesInDialog: builder.infiniteQuery({ 8241 query: ({ queryArg, pageParam }) => ({ 8242 url: "/command-center/dialer-activity/get/between/to", 8243 method: "POST", 8244 body: JSON.stringify({ 8245 ...queryArg, 8246 page: pageParam 8247 }), 8248 headers: { "system-source": "fleet" } 8249 }), 8250 infiniteQueryOptions: { 8251 initialPageParam: 0, 8252 getNextPageParam: (lastPage, _allPages, lastPageParam, _allPageParams, queryArg) => { 8253 if (lastPage.code !== 200 || !lastPage.data) return; 8254 return lastPage.data.length === queryArg.size ? lastPageParam + 1 : void 0; 8255 } 8256 }, 8257 providesTags: [{ 8258 type: "dialers", 8259 id: "GET_DIALER_ACTIVITIES_IN_DIALOG" 8260 }] 8261 }), 8262 getDialerFreeTrialSeat: builder.mutation({ 8263 query: () => ({ 8264 url: "/fleet/dialer/get/free-trial-seat", 8265 method: "GET" 8266 }), 8267 invalidatesTags: [ 8268 "userInfo", 8269 { 8270 type: "dialers", 8271 id: "GET_ACTIVE" 8272 }, 8273 "subscriptionSummary" 8274 ] 8275 }), 8276 sendDialerVoiceMessage: builder.mutation({ query: (data) => ({ 8277 url: "/command-center/dialer/call/voicemessage/play", 8278 method: "POST", 8279 body: JSON.stringify(data), 8280 headers: { "system-source": "fleet" } 8281 }) }) 8282 }), 8283 overrideExisting: true 8284}); 8285const { useGetTwilioTokenQuery, useLazyGetTwilioTokenQuery, useGetActiveQuery, useLazyGetActiveQuery, useGetCountQuery, usePreCheckQuery, useLazyPreCheckQuery, useGetDialerVirtualNumbersListQuery, useGetRemainSeatsQuery, useAddVirtualNumberMutation, useGetDialerSettingNumbersListQuery, useGetDialerSettingCallOutcomeListQuery, useDeleteDialerSettingCallOutcomeMutation, useMutateDialerSettingCallOutcomeMutation: useDialerSettingCallOutcomeMutation, useGetDialerSettingUsersListQuery, useAssignDialerSettingVirtualNumberMutation, useDeleteDialerSettingVirtualNumberMutation, useGetUserDialerSettingInfoQuery, useSwitchDialerSettingCallRecordMutation, useGetFuzzySearchPhoneQuery, useGetUserPhoneSearchQuery, useGetDialerRecentListInfiniteQuery, useSaveCallResultMutation, useGetDialerVoicemailListInfiniteQuery, useMarkDialerVoiceAsReadMutation, useMarkDialerRecentCallAsReadMutation, useGetDialerVoiceMessagesListQuery, useSaveDialerVoiceInfoMutation, useDeleteDialerVoiceMessageMutation, useChangeDialerUserPhoneNumberMutation, useVerifyDialerUserPhoneNumberMutation, useUnbindDialerUserPhoneNumberMutation, useGetDialerCallResultQuery, useGetDialerLoadsQuery, useGetDialerContactQuery, useGetDialerContactsListQuery, useLazyGetDialerContactsListQuery, useGetDialerActivitiesInDialogInfiniteQuery, useGetDialerFreeTrialSeatMutation, useSendDialerVoiceMessageMutation } = dialersApi; 8286var RANK_ROLE_MAP = { 8287 0: "Super Admin", 8288 1: "Driver", 8289 2: "Operator", 8290 4: "Super Admin" 8291}; 8292const getRoleName = (rank) => { 8293 return RANK_ROLE_MAP[rank ?? Infinity] ?? "Unknown"; 8294}; 8295const MICROPHONE_ERROR_MESSAGE = { 8296 denied: "Microphone access is blocked. Please allow microphone access in your browser and system settings, then try again.", 8297 "device-busy": "Your microphone is being used by another app or browser tab. Close it and try again.", 8298 "no-device": "No microphone found. Please connect a microphone and try again.", 8299 "insecure-context": "Microphone access is blocked on this page. It requires a secure (HTTPS) connection or is disabled by site policy.", 8300 unsupported: "Your browser does not support microphone access.", 8301 unknown: "Couldn't access your microphone. Please try again." 8302}; 8303var mapMicrophoneError = (error) => { 8304 switch (error?.name) {
8305 case "NotAllowedError": return "denied"; 8306 case "SecurityError": return "insecure-context"; 8307 case "NotReadableError": 8308 case "AbortError": return "device-busy"; 8309 case "NotFoundError": 8310 case "OverconstrainedError": return "no-device"; 8311 default: return "unknown"; 8312 } 8313}; 8314var requestMicrophoneAccess = async (retried = false) => { 8315 try { 8316 (await navigator.mediaDevices.getUserMedia({ audio: true })).getTracks().forEach((track$1) => track$1.stop()); 8317 return "granted"; 8318 } catch (error) { 8319 const status = mapMicrophoneError(error); 8320 if (status === "device-busy" && !retried) { 8321 await new Promise((resolve) => setTimeout(resolve, 300)); 8322 return requestMicrophoneAccess(true); 8323 } 8324 return status; 8325 } 8326}; 8327var useAudioRecorder = (options = {}) => { 8328 const { audioBitsPerSecond = 128e3, mimeType = "audio/webm", timeslice, enableAnalysis = false, fftSize = 2048 } = options; 8329 const [isRecording, setIsRecording] = (0, import_react.useState)(false); 8330 const [isPaused, setIsPaused] = (0, import_react.useState)(false); 8331 const [stream, setStream] = (0, import_react.useState)(null); 8332 const [mediaRecorder, setMediaRecorder] = (0, import_react.useState)(null); 8333 const [audioBlob, setAudioBlob] = (0, import_react.useState)(null); 8334 const [audioUrl, setAudioUrl] = (0, import_react.useState)(null); 8335 const [duration, setDuration] = (0, import_react.useState)(0); 8336 const [error, setError] = (0, import_react.useState)(null); 8337 const [analysisData, setAnalysisData] = (0, import_react.useState)(null); 8338 const chunksRef = (0, import_react.useRef)([]); 8339 const startTimeRef = (0, import_react.useRef)(0); 8340 const pausedTimeRef = (0, import_react.useRef)(0); 8341 const intervalRef = (0, import_react.useRef)(null); 8342 const audioContextRef = (0, import_react.useRef)(null); 8343 const analyserRef = (0, import_react.useRef)(null); 8344 const sourceRef = (0, import_react.useRef)(null); 8345 const animationFrameRef = (0, import_react.useRef)(null); 8346 const isSupported = typeof navigator !== "undefined" && !!navigator.mediaDevices && !!navigator.mediaDevices.getUserMedia && !!window.MediaRecorder; 8347 const updateDuration = (0, import_react.useCallback)(() => { 8348 if (startTimeRef.current) { 8349 const elapsed = Date.now() - startTimeRef.current - pausedTimeRef.current; 8350 setDuration(Math.floor(elapsed / 1e3)); 8351 } 8352 }, []); 8353 const analyzeAudio = (0, import_react.useCallback)(() => {
8354 if (!analyserRef.current || !enableAnalysis) return; 8355 const frequencyData = new Uint8Array(analyserRef.current.frequencyBinCount); 8356 const timeData = new Uint8Array(analyserRef.current.fftSize); 8357 analyserRef.current.getByteFrequencyData(frequencyData); 8358 analyserRef.current.getByteTimeDomainData(timeData); 8359 let sum = 0; 8360 for (let i = 0; i < timeData.length; i++) { 8361 const sample = ((timeData[i] ?? 0) - 128) / 128; 8362 sum += sample * sample; 8363 } 8364 const volume = Math.sqrt(sum / timeData.length); 8365 setAnalysisData({ 8366 frequencyData: frequencyData.slice(), 8367 timeData: timeData.slice(), 8368 volume 8369 }); 8370 if (isRecording && !isPaused) animationFrameRef.current = requestAnimationFrame(analyzeAudio); 8371 }, [ 8372 isRecording, 8373 isPaused, 8374 enableAnalysis 8375 ]); 8376 const setupAudioAnalysis = (0, import_react.useCallback)((mediaStream) => { 8377 if (!enableAnalysis) return; 8378 try { 8379 audioContextRef.current = new (window.AudioContext || window.webkitAudioContext)(); 8380 analyserRef.current = audioContextRef.current.createAnalyser(); 8381 sourceRef.current = audioContextRef.current.createMediaStreamSource(mediaStream); 8382 analyserRef.current.fftSize = fftSize; 8383 analyserRef.current.smoothingTimeConstant = .8; 8384 sourceRef.current.connect(analyserRef.current); 8385 analyzeAudio(); 8386 } catch (err) { 8387 console.warn("Failed to setup audio analysis:", err); 8388 } 8389 }, [ 8390 enableAnalysis, 8391 fftSize, 8392 analyzeAudio 8393 ]); 8394 const startRecording = (0, import_react.useCallback)(async () => { 8395 if (!isSupported) { 8396 setError("Audio recording is not supported in this browser"); 8397 return; 8398 } 8399 try { 8400 setError(null); 8401 const mediaStream_0 = await navigator.mediaDevices.getUserMedia({ audio: { 8402 echoCancellation: true, 8403 noiseSuppression: true, 8404 autoGainControl: true 8405 } }); 8406 setStream(mediaStream_0); 8407 setupAudioAnalysis(mediaStream_0); 8408 const recorder = new MediaRecorder(mediaStream_0, { 8409 audioBitsPerSecond, 8410 mimeType: MediaRecorder.isTypeSupported(mimeType) ? mimeType : "audio/webm" 8411 }); 8412 chunksRef.current = []; 8413 recorder.ondataavailable = (event) => { 8414 if (event.data.size > 0) chunksRef.current.push(event.data); 8415 }; 8416 recorder.onstop = () => { 8417 const blob = new Blob(chunksRef.current, { type: recorder.mimeType }); 8418 setAudioBlob(blob); 8419 setAudioUrl(URL.createObjectURL(blob)); 8420 setIsRecording(false); 8421 setIsPaused(false); 8422 if (intervalRef.current) { 8423 clearInterval(intervalRef.current); 8424 intervalRef.current = null; 8425 } 8426 if (animationFrameRef.current) { 8427 cancelAnimationFrame(animationFrameRef.current); 8428 animationFrameRef.current = null; 8429 } 8430 }; 8431 recorder.onpause = () => { 8432 setIsPaused(true); 8433 pausedTimeRef.current += Date.now() - startTimeRef.current; 8434 if (animationFrameRef.current) { 8435 cancelAnimationFrame(animationFrameRef.current); 8436 animationFrameRef.current = null; 8437 } 8438 }; 8439 recorder.onresume = () => { 8440 setIsPaused(false); 8441 startTimeRef.current = Date.now(); 8442 if (enableAnalysis) analyzeAudio(); 8443 }; 8444 recorder.onerror = (event_0) => { 8445 setError(`Recording error: ${event_0.error?.message || "Unknown error"}`); 8446 setIsRecording(false); 8447 setIsPaused(false); 8448 }; 8449 setMediaRecorder(recorder); 8450 recorder.start(timeslice); 8451 setIsRecording(true); 8452 startTimeRef.current = Date.now(); 8453 pausedTimeRef.current = 0; 8454 setDuration(0); 8455 intervalRef.current = setInterval(updateDuration, 1e3); 8456 } catch (err_0) { 8457 const errorMessage = err_0 instanceof Error ? err_0.message : "Failed to start recording"; 8458 setError(errorMessage); 8459 } 8460 }, [ 8461 isSupported, 8462 audioBitsPerSecond, 8463 mimeType, 8464 timeslice, 8465 setupAudioAnalysis, 8466 updateDuration, 8467 enableAnalysis, 8468 analyzeAudio 8469 ]); 8470 const stopRecording = (0, import_react.useCallback)(() => { 8471 if (mediaRecorder && mediaRecorder.state !== "inactive") mediaRecorder.stop(); 8472 if (stream) { 8473 stream.getTracks().forEach((track$1) => track$1.stop()); 8474 setStream(null); 8475 } 8476 if (audioContextRef.current) { 8477 audioContextRef.current.close(); 8478 audioContextRef.current = null; 8479 } 8480 }, [mediaRecorder, stream]); 8481 const pauseRecording = (0, import_react.useCallback)(() => { 8482 if (mediaRecorder && mediaRecorder.state === "recording") mediaRecorder.pause(); 8483 }, [mediaRecorder]); 8484 const resumeRecording = (0, import_react.useCallback)(() => { 8485 if (mediaRecorder && mediaRecorder.state === "paused") mediaRecorder.resume(); 8486 }, [mediaRecorder]); 8487 const clearRecording = (0, import_react.useCallback)(() => { 8488 if (audioUrl) URL.revokeObjectURL(audioUrl); 8489 setAudioBlob(null); 8490 setAudioUrl(null); 8491 setDuration(0); 8492 setAnalysisData(null); 8493 setError(null); 8494 }, [audioUrl]); 8495 const downloadRecording = (0, import_react.useCallback)((filename = "recording.webm") => { 8496 if (!audioUrl) return; 8497 const link = document.createElement("a"); 8498 link.href = audioUrl; 8499 link.download = filename; 8500 document.body.appendChild(link); 8501 link.click(); 8502 document.body.removeChild(link); 8503 }, [audioUrl]); 8504 const checkPermission = (0, import_react.useCallback)(async () => { 8505 if (!isSupported) return "unsupported"; 8506 return requestMicrophoneAccess(); 8507 }, [isSupported]); 8508 (0, import_react.useEffect)(() => { 8509 return () => { 8510 if (intervalRef.current) clearInterval(intervalRef.current); 8511 if (animationFrameRef.current) cancelAnimationFrame(animationFrameRef.current); 8512 }; 8513 }, []); 8514 (0, import_react.useEffect)(() => { 8515 return () => {
8516 if (stream) stream.getTracks().forEach((track_0) => track_0.stop()); 8517 if (audioContextRef.current) audioContextRef.current.close(); 8518 if (audioUrl) URL.revokeObjectURL(audioUrl); 8519 }; 8520 }, [stream, audioUrl]); 8521 return { 8522 isSupported, 8523 isRecording, 8524 isPaused, 8525 stream, 8526 mediaRecorder, 8527 audioBlob, 8528 audioUrl, 8529 duration, 8530 error, 8531 analysisData, 8532 startRecording, 8533 stopRecording, 8534 pauseRecording, 8535 resumeRecording, 8536 clearRecording, 8537 downloadRecording, 8538 checkPermission 8539 }; 8540}; 8541const GENERIC_API_ERROR_MESSAGE = "Something went wrong... Please try again."; 8542const getApiErrorDetail = (error, fallback = GENERIC_API_ERROR_MESSAGE) => { 8543 return error?.data?.detail || fallback; 8544}; 8545async function mutateWithErrorHandling(trigger, params, options = {}) { 8546 const { showErrorToast = true, showSuccessToast = false, successMessage, silent = false } = options; 8547 try { 8548 const result = await trigger(params).unwrap(); 8549 if (result.code !== 200) { 8550 if (!silent) console.error("API Error:", result); 8551 if (showErrorToast) toast.error(result.message, { position: "top-center" }); 8552 return null; 8553 } 8554 if (showSuccessToast) toast.success(successMessage ?? result.message, { position: "top-center" }); 8555 return result; 8556 } catch (error) { 8557 if (!silent) console.error("Mutation Error:", error); 8558 return null; 8559 } 8560} 8561var import_compiler_runtime$121 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 8562function Checkbox(t0) { 8563 const $ = (0, import_compiler_runtime$121.c)(9); 8564 let className; 8565 let props; 8566 if ($[0] !== t0) { 8567 ({className, ...props} = t0); 8568 $[0] = t0; 8569 $[1] = className; 8570 $[2] = props; 8571 } else { 8572 className = $[1]; 8573 props = $[2]; 8574 } 8575 let t1; 8576 if ($[3] !== className) { 8577 t1 = cn("group peer size-4 shrink-0 rounded-xs border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/20 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary", "data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground", className); 8578 $[3] = className; 8579 $[4] = t1; 8580 } else t1 = $[4]; 8581 let t2; 8582 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 8583 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CheckboxIndicator, { 8584 "data-slot": "checkbox-indicator", 8585 className: "grid place-content-center text-current transition-none", 8586 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { className: "hidden size-3.5 group-data-[state=checked]:block" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Minus, { className: "hidden size-3.5 group-data-[state=indeterminate]:block" })] 8587 }); 8588 $[5] = t2; 8589 } else t2 = $[5]; 8590 let t3; 8591 if ($[6] !== props || $[7] !== t1) { 8592 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Checkbox$1, { 8593 "data-slot": "checkbox", 8594 className: t1, 8595 ...props, 8596 children: t2 8597 }); 8598 $[6] = props; 8599 $[7] = t1; 8600 $[8] = t3; 8601 } else t3 = $[8]; 8602 return t3; 8603} 8604const getRecordingTimeFormatted = (time) => { 8605 const seconds = time % 60; 8606 if (time >= 3600) { 8607 const hours = Math.floor(time / 3600); 8608 const minutes = Math.floor(time % 3600 / 60); 8609 return `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`; 8610 } 8611 return `${Math.floor(time / 60).toString().padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`; 8612}; 8613function formatDuration(seconds) { 8614 const dateWithDuration = addMilliseconds(/* @__PURE__ */ new Date(0), seconds * 1e3); 8615 return safeFormatDate(dateWithDuration, "mm:ss"); 8616} 8617function groupActivitiesByDate(activities) { 8618 const groups = /* @__PURE__ */ new Map(); 8619 const sortedActivities = [...activities].sort((a, b) => { 8620 return new Date(b.callTime).getTime() - new Date(a.callTime).getTime(); 8621 }); 8622 for (const activity of sortedActivities) { 8623 const activityDate = new Date(activity.callTime); 8624 const dayStart = startOfDay(activityDate); 8625 const key = dayStart.toISOString();
8626 const label = _formatRelativeDay(activityDate, /* @__PURE__ */ new Date()); 8627 if (groups.has(key)) groups.get(key).activities.push(activity); 8628 else groups.set(key, { 8629 id: key, 8630 label, 8631 date: dayStart, 8632 activities: [activity] 8633 }); 8634 } 8635 return Array.from(groups.values()); 8636} 8637function formatDurationMinutesGreatest(seconds) { 8638 const max = Math.ceil(seconds / 60); 8639 return `${max} minute${max !== 1 ? "s" : ""}`; 8640} 8641const FORMATE_DATE_TIME_TIMEZONE = "MMM d, yyyy h:mm a"; 8642const DIAL_PAD_KEYS = [ 8643 [ 8644 { digit: "1" }, 8645 { 8646 digit: "2", 8647 letters: "abc" 8648 }, 8649 { 8650 digit: "3", 8651 letters: "def" 8652 } 8653 ], 8654 [ 8655 { 8656 digit: "4", 8657 letters: "ghi" 8658 }, 8659 { 8660 digit: "5", 8661 letters: "jkl" 8662 }, 8663 { 8664 digit: "6", 8665 letters: "mno" 8666 } 8667 ], 8668 [ 8669 { 8670 digit: "7", 8671 letters: "pqrs" 8672 }, 8673 { 8674 digit: "8", 8675 letters: "tuv" 8676 }, 8677 { 8678 digit: "9", 8679 letters: "wxyz" 8680 } 8681 ], 8682 [ 8683 { digit: "*" }, 8684 { 8685 digit: "0", 8686 letters: "+" 8687 }, 8688 { digit: "#" } 8689 ] 8690]; 8691const COUNTRY_OPTIONS = [{ 8692 code: "US", 8693 name: "United States", 8694 dialCode: "1", 8695 flag: "usa-mini-circle-flag" 8696}, { 8697 code: "CA", 8698 name: "Canada", 8699 dialCode: "1", 8700 flag: "canada-mini-circle-flag" 8701}]; 8702const ROLE_LABELS_MAPPING = { 8703 driver: "Drivers", 8704 carrier: "Carriers", 8705 customer: "Customers", 8706 broker: "Brokers", 8707 location: "Locations", 8708 dispatch: "Dispatchers", 8709 dispatcher: "Dispatchers", 8710 company: "Companies" 8711}; 8712var buyNumberColumnHelper = createColumnHelper(); 8713const getBuyNumberColumns = ({ freeNumbers }) => { 8714 return [ 8715 buyNumberColumnHelper.display({ 8716 id: "select", 8717 size: 32, 8718 header: ({ table }) => { 8719 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Checkbox, { 8720 checked: table.getIsAllPageRowsSelected() || table.getIsSomePageRowsSelected() && "indeterminate", 8721 onCheckedChange: (value) => { 8722 return table.toggleAllPageRowsSelected(!!value); 8723 }, 8724 "aria-label": "Select all" 8725 }); 8726 }, 8727 cell: ({ row }) => { 8728 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Checkbox, { 8729 checked: row.getIsSelected(), 8730 onCheckedChange: (value) => { 8731 return row.toggleSelected(!!value); 8732 }, 8733 "aria-label": "Select row" 8734 }); 8735 } 8736 }), 8737 buyNumberColumnHelper.accessor("virtualNumber", { 8738 id: "virtualNumber", 8739 size: 160, 8740 header: () => { 8741 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 8742 className: "text-xs font-medium text-muted-foreground uppercase", 8743 children: "Virtual Number" 8744 }); 8745 }, 8746 cell: (info) => { 8747 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { 8748 className: "flex items-center gap-1", 8749 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 8750 className: "text-sm font-medium text-foreground", 8751 children: formatPhone(normalizePhone(info.getValue()), "parentheses") 8752 }), info.row.original.hasWarning && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleAlert, { className: "size-4 text-amber-600" })] 8753 }); 8754 } 8755 }), 8756 buyNumberColumnHelper.accessor("area", { 8757 id: "area", 8758 size: 150, 8759 header: () => { 8760 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 8761 className: "text-xs font-medium text-muted-foreground uppercase", 8762 children: "Area" 8763 }); 8764 }, 8765 cell: (info) => { 8766 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 8767 className: "text-sm font-medium text-foreground", 8768 children: info.getValue() 8769 }); 8770 } 8771 }), 8772 buyNumberColumnHelper.accessor("fee", { 8773 id: "fee", 8774 size: 150, 8775 header: () => { 8776 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 8777 className: "text-xs font-medium text-muted-foreground uppercase", 8778 children: "Fee" 8779 }); 8780 }, 8781 cell: (info) => { 8782 const isFree = freeNumbers?.has(info.row.original.virtualNumber) ?? false; 8783 const feeDollars = info.getValue() / 100; 8784 if (isFree) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { 8785 className: "flex items-center gap-0.5 text-sm font-medium", 8786 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { 8787 className: "text-muted-foreground line-through", 8788 children: [ 8789 "$", 8790 feeDollars.toFixed(1), 8791 "/Month" 8792 ] 8793 }
8793), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 8794 className: "text-success", 8795 children: "Free" 8796 })] 8797 }); 8798 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { 8799 className: "text-sm font-medium text-foreground", 8800 children: [ 8801 "$", 8802 feeDollars.toFixed(1), 8803 "/Month" 8804 ] 8805 }); 8806 } 8807 }) 8808 ]; 8809}; 8810const sanitizePhoneSearchString = (searchString) => { 8811 return searchString.replace(/[^0-9+]/g, ""); 8812}; 8813const roleCt = { broker: "customer" }; 8814var initialCallingState = { 8815 isMuted: false, 8816 setMuted: () => {}, 8817 callingDuration: 0, 8818 setCallingDuration: () => {}, 8819 isConnecting: false, 8820 setCallNote: () => {}, 8821 data: { 8822 sid: void 0, 8823 direction: Call.CallDirection.Incoming, 8824 contacts: [], 8825 displayContact: { name: "Unknown" }, 8826 displayAvatar: "", 8827 displayPhone: "", 8828 hasContactPermission: false, 8829 callLabel: "" 8830 }, 8831 handleMute: () => { 8832 trackMethodCall("handleMute", []); 8833 }, 8834 handleDialPadTap: () => { 8835 trackMethodCall("handleDialPadTap", []); 8836 }, 8837 handleHangup: () => { 8838 trackMethodCall("handleHangup", []); 8839 }, 8840 isLoading: false, 8841 isCallRecordingEnabled: true 8842}; 8843var [DialersContext, useDialersContext] = create_context_default("DialersContext", { 8844 destroy: () => {}, 8845 call: async () => {}, 8846 checkPlanAndDisplayDialog: async () => { 8847 return true; 8848 }, 8849 checkTrialAndDisplayDialog: async () => {}, 8850 resolveRemainTimeWarning: () => {}, 8851 ...initialCallingState 8852}); 8853var DEVICE_OPTIONS = { logLevel: "silent" }; 8854var DIRECTION_LABELS$1 = { 8855 [Call.CallDirection.Outgoing]: "Outbound Call", 8856 [Call.CallDirection.Incoming]: "Inbound Call" 8857}; 8858function mockUnknown$1(call) { 8859 return { 8860 contacts: [], 8861 callRecord: { 8862 companyId: 13, 8863 userId: 13, 8864 callSid: get(call, "parameters.CallSid"), 8865 fromNumber: get(call, "parameters.From"), 8866 toNumber: get(call, "customParameters.To"), 8867 direction: get(call, "direction"), 8868 status: "called-ringing", 8869 isFinish: false, 8870 isSaveCallResult: false, 8871 duration: 0 8872 }, 8873 loadInfos: [] 8874 }; 8875} 8876const DialersProvider = ({ children }) => { 8877 const [device, setDevice] = (0, import_react.useState)(); 8878 const twilioToken = useAppSelector(selectTwilioToken); 8879 const dispatch = useAppDispatch(); 8880 const [getActive] = useLazyGetActiveQuery(); 8881 const [preCheckPhoneNumber] = useLazyPreCheckQuery(); 8882 const [refetchTwilioToken] = useLazyGetTwilioTokenQuery(); 8883 const [saveCallResult] = useSaveCallResultMutation(); 8884 const userInfo = useUserInfoQueryState(); 8885 const { checkPermission } = useAudioRecorder(); 8886 const isInboundCallSheetOpen = useAppSelector(selectIsInboundCallSheetOpen); 8887 const isMinimizeSheetOpen = useAppSelector(selectIsMinimizeSheetOpen); 8888 const currentCall = useAppSelector(selectCall); 8889 const active = useAppSelector(selectActive); 8890 const isDialerUsable = Boolean(active?.hasSeat && active?.hasVirtualNumber); 8891 const [startOutboundRecording, setStartOutboundRecording] = (0, import_react.useState)(false); 8892 const [isMuted, setIsMuted] = (0, import_react.useState)(false); 8893 const [callingDuration, setCallingDuration] = (0, import_react.useState)(0); 8894 const [callStatus, setCallStatus] = (0, import_react.useState)(); 8895 const intervalRef = (0, import_react.useRef)(null); 8896 const callNoteRef = (0, import_react.useRef)(""); 8897 const isOpen = isInboundCallSheetOpen || isMinimizeSheetOpen; 8898 const isConnecting = callStatus === Call.State.Connecting || callStatus === Call.State.Ringing || callStatus === Call.State.Pending || callStatus === Call.State.Reconnecting; 8899 const sid = get(currentCall, "parameters.CallSid"); 8900 const direction = get(currentCall, "direction"); 8901 const loadIds = currentCall?.customParameters.get("loadIds"); 8902 useGetActiveQuery(); 8903 useGetCountQuery(); 8904 useGetTwilioTokenQuery(void 0, { refetchOnMountOrArgChange: true }); 8905 const { data: callResultData, isLoading: isLoadingCallResult, isFetching: isFetchingCallResult } = useGetDialerCallResultQuery({ sid }, { skip: !sid }); 8906 const { data: userDialerSettingInfoResponse } = useGetUserDialerSettingInfoQuery(); 8907 const callResult = get(callResultData, "data") ?? mockUnknown$1(currentCall); 8908 const contacts = get(callResultData, "data.contacts") ?? []; 8909 const displayContact = get(contacts, "[0]", { name: "Unknown" }); 8910 const callRecord = get(callResult, "callRecord"); 8911 const displayPhone = displayContact.phone ?? (direction === Call.CallDirection.Incoming ? callRecord?.fromNumber : callRecord?.toNumber); 8912 const displayAvatar = displayContact.avatar ?? callRecord?.avatar ?? ""; 8913 const hasContactPermission = get(callResult, "hasContactPermission") ?? false; 8914 const isCallRecordingEnabled = get(userDialerSettingInfoResponse, "data.callRecordSwitch") ?? true; 8915 const startRecording = (0, import_react.useCallback)(() => { 8916 intervalRef.current = setInterval(() => { 8917 setCallingDuration((prev) => { 8918 return prev + 1; 8919 }); 8920 }, 1e3); 8921 }, []); 8922 const stopRecording = (0, import_react.useCallback)(() => { 8923 if (intervalRef.current) { 8924 clearInterval(intervalRef.current); 8925 intervalRef.current = null; 8926 } 8927 }, []); 8928 const handleMute = (0, import_react.useCallback)(() => { 8929 trackMethodCall("handleMute", []); 8930 if (!currentCall) return; 8931 setIsMuted(!isMuted); 8932 currentCall.mute(!isMuted); 8933 }, [currentCall, isMuted]); 8934 const handleDialPadTap = (0, import_react.useCallback)((digit) => { 8935 trackMethodCall("handleDialPadTap", [digit]); 8936 if (!currentCall) return; 8937 currentCall.sendDigits(digit); 8938 }, [currentCall]); 8939 const handleHangup = (0, import_react.useCallback)(() => { 8940 trackMethodCall("handleHangup", []); 8941 if (!currentCall) return; 8942 currentCall.disconnect(); 8943 }, [currentCall]); 8944 const setCallNote = (0, import_react.useCallback)((note) => { 8945 callNoteRef.current = note; 8946 }, []); 8947 const handleIncomingCallEventListener = (0, import_react.useCallback)((call$1) => { 8948 trackMethodCall("handleIncomingCallEventListener", [call$1]); 8949 if (call$1.status() !== Call.State.Pending) return; 8950 dispatch(showIncomingCallSheet(call$1)); 8951 }, [dispatch]); 8952 const handleCallAccept = (0, import_react.useCallback)(() => { 8953 trackMethodCall("handleCallAccept", []); 8954 if (direction === Call.CallDirection.Incoming || !currentCall) return; 8955 const isStartRecording = currentCall.status() === Call.State.Open; 8956 setStartOutboundRecording(isStartRecording); 8957 }, [direction, currentCall]); 8958 const handleCallEnd = (0, import_react.useCallback)(async () => { 8959 trackMethodCall("handleCallEnd", []); 8960 if (!sid) return; 8961 const note = callNoteRef.current.trim(); 8962 if (note) await mutateWithErrorHandling(saveCallResult, { 8963 callSid: sid, 8964 resultContent: note 8965 }); 8966 else dispatch(dialersApi.util.invalidateTags([{ 8967 type: "dialers", 8968 id: "GET_DIALER_CALL_RESULT" 8969 }])); 8970 callNoteRef.current = ""; 8971 setIsMuted(false); 8972 setCallingDuration(0); 8973 setStartOutboundRecording(false);
8974 dispatch(closeNestedSheet()); 8975 dispatch(openCallResultSheet({ resultSheetSid: String(sid) })); 8976 }, [ 8977 sid, 8978 saveCallResult, 8979 dispatch 8980 ]); 8981 const init = (0, import_react.useCallback)(async (token) => { 8982 if (!token) return; 8983 const newDevice = new Device(token, DEVICE_OPTIONS); 8984 newDevice.on(Device.EventName.Incoming, handleIncomingCallEventListener); 8985 newDevice.on(Device.EventName.TokenWillExpire, () => { 8986 refetchTwilioToken(); 8987 }); 8988 newDevice.on(Device.EventName.Error, (error) => { 8989 if (error?.code === 20104 || error?.code === 31204) refetchTwilioToken(); 8990 }); 8991 const MAX_REGISTER_ATTEMPTS = 3; 8992 for (let attempt = 1; attempt <= MAX_REGISTER_ATTEMPTS; attempt += 1) try { 8993 await newDevice.register(); 8994 setDevice(newDevice); 8995 return; 8996 } catch (error) { 8997 if (attempt === MAX_REGISTER_ATTEMPTS) { 8998 newDevice.destroy(); 8999 refetchTwilioToken(); 9000 return; 9001 } 9002 await new Promise((resolve) => { 9003 return setTimeout(resolve, attempt * 500); 9004 }); 9005 } 9006 }, [handleIncomingCallEventListener, refetchTwilioToken]); 9007 const destroy = (0, import_react.useCallback)(() => { 9008 if (!device) return; 9009 device.disconnectAll(); 9010 device.destroy(); 9011 setDevice(void 0); 9012 }, [device]); 9013 const destroyRef = (0, import_react.useRef)(destroy); 9014 destroyRef.current = destroy; 9015 const currentCallRef = (0, import_react.useRef)(currentCall); 9016 currentCallRef.current = currentCall; 9017 const deviceIdentityRef = (0, import_react.useRef)(void 0); 9018 (0, import_react.useEffect)(() => { 9019 return () => { 9020 const call$1 = currentCallRef.current; 9021 if (call$1 && call$1.status() === Call.State.Pending) call$1.reject(); 9022 destroyRef.current(); 9023 dispatch(clearDialerState()); 9024 }; 9025 }, [dispatch]); 9026 const connect$1 = (0, import_react.useCallback)(async ({ to, called, role, personId, contactId, loadId }) => { 9027 if (!to || !device) return; 9028 const rawParams = { 9029 role: role || void 0, 9030 personId: personId ? String(personId) : void 0, 9031 contactId: contactId ? String(contactId) : void 0, 9032 loadIds: loadId ? String(loadId) : void 0, 9033 To: to, 9034 Called: called, 9035 From: `client:${twilioToken?.identity}`, 9036 Caller: `client:${twilioToken?.identity}` 9037 }; 9038 const options = { params: Object.fromEntries(Object.entries(rawParams).filter(([, v]) => { 9039 return v !== null && v !== void 0; 9040 })) }; 9041 return device.connect(options); 9042 }, [device, twilioToken?.identity]); 9043 const remainTimeConfirmRef = (0, import_react.useRef)(null); 9044 const waitForRemainTimeConfirm = (0, import_react.useCallback)(() => { 9045 return new Promise((resolve) => { 9046 remainTimeConfirmRef.current = resolve; 9047 }); 9048 }, []); 9049 const resolveRemainTimeWarning = (0, import_react.useCallback)((proceed) => { 9050 dispatch(setDialerNotificationOpen(false)); 9051 const resolve = remainTimeConfirmRef.current; 9052 remainTimeConfirmRef.current = null; 9053 resolve?.(proceed); 9054 }, [dispatch]); 9055 const checkPlanAndDisplayDialog = (0, import_react.useCallback)(async () => { 9056 const activeData = (await getActive()).data?.data; 9057 const hasVirtualNumber = activeData?.hasVirtualNumber; 9058 const hasValidOrder = activeData?.hasValidOrder; 9059 const hasSeat = activeData?.hasSeat; 9060 const seat = activeData?.dialerSeatDetail; 9061 const hasBaseDialerSeat = userInfo?.hasBaseDialerSeat; 9062 const noValidOrder = !hasValidOrder && (!seat || !seat.isBasic) || !hasSeat; 9063 const hasMinutes = activeData?.hasMinutes; 9064 const payStatus = activeData?.payStatus; 9065 const isBasic = seat?.isBasic; 9066 const isUnlimited = seat?.isUnlimited; 9067 const remaining = (seat?.minutes ?? 0) - (seat?.usedMinutes ?? 0); 9068 const isAdmin = getRoleName(userInfo?.rank) === "Super Admin"; 9069 const openDialog = (type) => { 9070 dispatch(openDialerNotificationByType(type)); 9071 }; 9072 if (payStatus === 6 && seat && !isBasic) { 9073 openDialog(isAdmin ? "subscription-required" : "subscription-required-operator"); 9074 return false; 9075 } 9076 if (noValidOrder) { 9077 openDialog(isAdmin ? !hasBaseDialerSeat ? "try-dialer-for-free" : "no-package-admin" : "no-package"); 9078 return false; 9079 } 9080 if (!hasVirtualNumber) { 9081 openDialog("no-virtual-number"); 9082 return false; 9083 } 9084 if (seat && !isUnlimited) { 9085 if (!hasMinutes) { 9086 openDialog(isBasic ? isAdmin ? "free-trial-ended" : "free-trial-ended-operator" : "standard-accelerator-less-than-0-mins"); 9087 return false;
9088 } 9089 if (remaining < 15) { 9090 openDialog("basic-less-than-15-mins"); 9091 return waitForRemainTimeConfirm(); 9092 } 9093 } 9094 return true; 9095 }, [ 9096 dispatch, 9097 getActive, 9098 userInfo?.hasBaseDialerSeat, 9099 userInfo?.rank, 9100 waitForRemainTimeConfirm 9101 ]); 9102 const checkTrialAndDisplayDialog = (0, import_react.useCallback)(async () => { 9103 const activeData = (await getActive()).data?.data; 9104 const hasValidOrder = activeData?.hasValidOrder; 9105 const hasVirtualNumber = activeData?.hasVirtualNumber; 9106 const hasSeat = activeData?.hasSeat; 9107 const seat = activeData?.dialerSeatDetail; 9108 const hasMinutes = activeData?.hasMinutes; 9109 const payStatus = activeData?.payStatus; 9110 const isBasic = seat?.isBasic; 9111 const isUnlimited = seat?.isUnlimited; 9112 const hasBaseDialerSeat = userInfo?.hasBaseDialerSeat; 9113 const isAdmin = getRoleName(userInfo?.rank) === "Super Admin"; 9114 const noValidOrder = !hasValidOrder && (!seat || !seat.isBasic) || !hasSeat; 9115 const openDialog = (type) => { 9116 dispatch(openDialerNotificationByType(type)); 9117 }; 9118 if (noValidOrder && isAdmin && !hasBaseDialerSeat) { 9119 openDialog("try-dialer-for-free"); 9120 return; 9121 } 9122 if (seat && !isUnlimited && isBasic && !hasMinutes) { 9123 openDialog(isAdmin ? "free-trial-ended" : "free-trial-ended-operator"); 9124 return; 9125 } 9126 if (payStatus === 6 && seat && !isBasic) { 9127 openDialog(isAdmin ? "subscription-required" : "subscription-required-operator"); 9128 return; 9129 } 9130 if (noValidOrder) { 9131 openDialog(isAdmin ? "no-package-admin" : "no-package"); 9132 return; 9133 } 9134 if (!hasVirtualNumber) openDialog("no-virtual-number"); 9135 }, [ 9136 dispatch, 9137 getActive, 9138 userInfo?.hasBaseDialerSeat, 9139 userInfo?.rank 9140 ]); 9141 const checkTryDialerForFreeBeforeCall = (0, import_react.useCallback)(async () => { 9142 const activeData = (await getActive()).data?.data; 9143 const hasValidOrder = activeData?.hasValidOrder; 9144 const hasSeat = activeData?.hasSeat; 9145 const seat = activeData?.dialerSeatDetail; 9146 const hasBaseDialerSeat = userInfo?.hasBaseDialerSeat; 9147 const isAdmin = getRoleName(userInfo?.rank) === "Super Admin"; 9148 if ((!hasValidOrder && (!seat || !seat.isBasic) || !hasSeat) && isAdmin && !hasBaseDialerSeat) { 9149 dispatch(openDialerNotificationByType("try-dialer-for-free")); 9150 return true; 9151 } 9152 return false; 9153 }, [ 9154 dispatch, 9155 getActive, 9156 userInfo?.hasBaseDialerSeat, 9157 userInfo?.rank 9158 ]); 9159 const checkReceiver = (0, import_react.useCallback)(async (phone) => { 9160 const { isInvalidPhone, hasUnfinishedCall } = (await preCheckPhoneNumber({ toNumber: phone })).data?.data ?? {}; 9161 if (isInvalidPhone) { 9162 toast.warning("Invalid phone number."); 9163 return false; 9164 } 9165 if (hasUnfinishedCall) { 9166 toast.error("You have an unfinished call already"); 9167 return false; 9168 } 9169 return true; 9170 }, [preCheckPhoneNumber]); 9171 const checkMicrophone = (0, import_react.useCallback)(async () => { 9172 const status = await checkPermission(); 9173 if (status === "granted") return true; 9174 toast.error(MICROPHONE_ERROR_MESSAGE[status]); 9175 return false; 9176 }, [checkPermission]); 9177 const call = (0, import_react.useCallback)(async (params) => { 9178 if (!params.to) return; 9179 try { 9180 if (!(await checkMicrophone() && await checkPlanAndDisplayDialog() && await checkReceiver(params.to))) { 9181 dispatch(setPlacingCall(false)); 9182 return; 9183 } 9184 dispatch(setPlacingCall(true)); 9185 const newCall = await connect$1(params); 9186 if (!newCall) { 9187 dispatch(setPlacingCall(false)); 9188 toast.error("Dialer is still connecting. Please try again in a moment."); 9189 refetchTwilioToken(); 9190 return; 9191 } 9192 dispatch(showInboundCallSheet(newCall)); 9193 dispatch(setPlacingCall(false)); 9194 const lowerRole = params.role?.toLowerCase() ?? ""; 9195 const mappedRole = lowerRole ? roleCt[lowerRole] || lowerRole : void 0; 9196 const saveInterval = setInterval(() => { 9197 const callSid = get(newCall, "parameters.CallSid"); 9198 if (!callSid) return; 9199 clearInterval(saveInterval); 9200 saveCallResult({ 9201 callSid, 9202 role: mappedRole, 9203 personId: params.personId || void 0, 9204 contactId: params.contactId || null, 9205 loadIds: params.loadId ? [params.loadId] : void 0 9206 }); 9207 }, 100); 9208 const clearPoll = () => { 9209 return clearInterval(saveInterval); 9210 }; 9211 newCall.once("cancel", clearPoll); 9212 newCall.once("reject", clearPoll); 9213 newCall.once("disconnect", clearPoll); 9214 setTimeout(clearPoll, 3e4); 9215 } catch { 9216 dispatch(setPlacingCall(false)); 9217 toast.error("Failed to call"); 9218 } 9219 }, [ 9220 checkMicrophone, 9221 checkPlanAndDisplayDialog, 9222 checkReceiver, 9223 connect$1, 9224 dispatch, 9225 refetchTwilioToken,
9226 saveCallResult 9227 ]); 9228 const pendingAutoCall = useAppSelector(selectPendingAutoCall); 9229 const pendingAutoCallRef = (0, import_react.useRef)(false); 9230 (0, import_react.useEffect)(() => { 9231 if (!pendingAutoCall) { 9232 pendingAutoCallRef.current = false; 9233 return; 9234 } 9235 if (pendingAutoCallRef.current) return; 9236 pendingAutoCallRef.current = true; 9237 const { phone, role: rawRole, personId, contactId, source } = pendingAutoCall; 9238 let digits = phone.replace(/[^\d]/g, ""); 9239 if (digits.length === 11 && digits.startsWith("1")) digits = digits.slice(1); 9240 const run = async () => { 9241 if (digits.length !== 10) { 9242 toast.warning("Invalid phone number."); 9243 return; 9244 } 9245 if (await checkTryDialerForFreeBeforeCall()) return; 9246 const phoneNo = `+1${digits}`; 9247 const role = rawRole === "dispatch" ? "dispatcher" : rawRole; 9248 dispatch(setPlacingCall(true)); 9249 call({ 9250 to: phoneNo, 9251 called: phoneNo, 9252 role: role?.toUpperCase(), 9253 personId: personId ?? 0, 9254 contactId: contactId ?? 0, 9255 source: source ?? `${role ?? ""} List-Button` 9256 }); 9257 }; 9258 run(); 9259 dispatch(setPendingAutoCall(void 0)); 9260 }, [pendingAutoCall]); 9261 (0, import_react.useEffect)(() => { 9262 const token = twilioToken?.token; 9263 const identity = twilioToken?.identity; 9264 if (!token) { 9265 destroy(); 9266 deviceIdentityRef.current = void 0; 9267 return; 9268 } 9269 if (device && deviceIdentityRef.current === identity) { 9270 device.updateToken(token); 9271 return; 9272 } 9273 destroy(); 9274 deviceIdentityRef.current = identity; 9275 init(token); 9276 }, [twilioToken?.token, twilioToken?.identity]); 9277 (0, import_react.useEffect)(() => { 9278 if (isDialerUsable && !twilioToken?.token) refetchTwilioToken(); 9279 }, [ 9280 isDialerUsable, 9281 twilioToken?.token, 9282 refetchTwilioToken 9283 ]); 9284 (0, import_react.useEffect)(() => { 9285 if (!currentCall) { 9286 setCallStatus(void 0); 9287 return; 9288 } 9289 const syncCallStatus = () => { 9290 return setCallStatus(currentCall.status()); 9291 }; 9292 syncCallStatus(); 9293 const statusEvents = [ 9294 "accept", 9295 "ringing", 9296 "reconnecting", 9297 "reconnected" 9298 ]; 9299 statusEvents.forEach((event) => { 9300 return currentCall.on(event, syncCallStatus); 9301 }); 9302 currentCall.on("accept", handleCallAccept); 9303 currentCall.on("disconnect", handleCallEnd); 9304 currentCall.on("cancel", handleCallEnd); 9305 currentCall.on("reject", handleCallEnd); 9306 return () => { 9307 statusEvents.forEach((event) => { 9308 return currentCall.removeListener(event, syncCallStatus); 9309 }); 9310 currentCall.removeListener("accept", handleCallAccept); 9311 currentCall.removeListener("disconnect", handleCallEnd); 9312 currentCall.removeListener("cancel", handleCallEnd); 9313 currentCall.removeListener("reject", handleCallEnd); 9314 }; 9315 }, [ 9316 currentCall, 9317 handleCallAccept, 9318 handleCallEnd 9319 ]); 9320 (0, import_react.useEffect)(() => {}
9320, [dispatch]); 9321 (0, import_react.useEffect)(() => { 9322 let isStartRecording = isOpen; 9323 if (direction === Call.CallDirection.Outgoing) isStartRecording = !isOpen ? isOpen : startOutboundRecording; 9324 if (isStartRecording) { 9325 setCallingDuration(0); 9326 startRecording(); 9327 } else stopRecording(); 9328 return () => { 9329 return stopRecording(); 9330 }; 9331 }, [ 9332 isOpen, 9333 startOutboundRecording, 9334 direction, 9335 startRecording, 9336 stopRecording 9337 ]); 9338 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialersContext, { 9339 destroy, 9340 call, 9341 checkPlanAndDisplayDialog, 9342 checkTrialAndDisplayDialog, 9343 resolveRemainTimeWarning, 9344 isLoading: isLoadingCallResult || isFetchingCallResult, 9345 data: { 9346 sid, 9347 direction, 9348 contacts, 9349 displayContact, 9350 displayPhone, 9351 displayAvatar, 9352 hasContactPermission, 9353 callLabel: DIRECTION_LABELS$1[direction], 9354 loadIds: loadIds ? [loadIds] : void 0 9355 }, 9356 isMuted, 9357 setMuted: setIsMuted, 9358 callingDuration, 9359 setCallingDuration, 9360 handleMute, 9361 handleDialPadTap, 9362 handleHangup, 9363 isCallRecordingEnabled, 9364 isConnecting, 9365 setCallNote, 9366 children 9367 }); 9368}; 9369var import_compiler_runtime$120 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 9370function usePushInit() { 9371 const $ = (0, import_compiler_runtime$120.c)(3); 9372 const userToken = useAppSelector(selectUserToken); 9373 let t0; 9374 let t1; 9375 if ($[0] !== userToken) { 9376 t0 = () => { 9377 if (!userToken) return; 9378 initPush({ 9379 type: "init", 9380 authBy: "portal-token", 9381 "portal-token": userToken 9382 }); 9383 return _temp$26; 9384 }; 9385 t1 = [userToken]; 9386 $[0] = userToken; 9387 $[1] = t0; 9388 $[2] = t1; 9389 } else { 9390 t0 = $[1]; 9391 t1 = $[2]; 9392 } 9393 (0, import_react.useEffect)(t0, t1); 9394} 9395function _temp$26() { 9396 return destroyPush(); 9397} 9398function usePushEvent(event, handler) { 9399 const handlerRef = (0, import_react.useRef)(handler); 9400 handlerRef.current = handler; 9401 (0, import_react.useEffect)(() => { 9402 return onPushEvent(event, (data) => { 9403 handlerRef.current(data); 9404 }); 9405 }, [event]); 9406} 9407var import_compiler_runtime$119 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 9408var VARIANT_ICON = { 9409 success: "success", 9410 warning: "alert" 9411}; 9412function DialerChangeToast(t0) { 9413 const $ = (0, import_compiler_runtime$119.c)(25); 9414 const { toastId, variant, title, description } = t0; 9415 let t1; 9416 if ($[0] !== toastId) { 9417 t1 = () => toast.dismiss(toastId); 9418 $[0] = toastId; 9419 $[1] = t1; 9420 } else t1 = $[1]; 9421 const dismiss = t1; 9422 const t2 = VARIANT_ICON[variant]; 9423 let t3; 9424 if ($[2] !== t2) { 9425 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 9426 name: t2, 9427 className: "size-6 shrink-0" 9428 }); 9429 $[2] = t2; 9430 $[3] = t3; 9431 } else t3 = $[3]; 9432 let t4; 9433 if ($[4] !== title) { 9434 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 9435 className: "text-base font-semibold text-popover-foreground", 9436 children: title 9437 }); 9438 $[4] = title; 9439 $[5] = t4; 9440 } else t4 = $[5]; 9441 let t5; 9442 if ($[6] !== description) { 9443 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 9444 className: "text-sm text-muted-foreground", 9445 children: description 9446 }); 9447 $[6] = description; 9448 $[7] = t5; 9449 } else t5 = $[7]; 9450 let t6; 9451 if ($[8] !== t4 || $[9] !== t5) { 9452 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 9453 className: "flex min-w-0 flex-1 flex-col gap-1", 9454 children: [t4, t5] 9455 }); 9456 $[8] = t4; 9457 $[9] = t5; 9458 $[10] = t6; 9459 } else t6 = $[10]; 9460 let t7; 9461 if ($[11] !== t3 || $[12] !== t6) { 9462 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 9463 className: "flex min-w-0 flex-1 items-start gap-3", 9464 children: [t3, t6] 9465 }); 9466 $[11] = t3; 9467 $[12] = t6; 9468 $[13] = t7; 9469 } else t7 = $[13]; 9470 let t8; 9471 if ($[14] === Symbol.for("react.memo_cache_sentinel")) { 9472 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { className: "size-5" }); 9473 $[14] = t8; 9474 } else t8 = $[14]; 9475 let t9; 9476 if ($[15] !== dismiss) { 9477 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { 9478 type: "button", 9479 "aria-label": "Close", 9480 onClick: dismiss, 9481 className: "shrink-0 opacity-70 transition-opacity hover:opacity-100", 9482 children: t8 9483 }); 9484 $[15] = dismiss; 9485 $[16] = t9; 9486 } else t9 = $[16]; 9487 let t10; 9488 if ($[17] !== t7 || $[18] !== t9) { 9489 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 9490 className: "flex w-full items-start gap-3", 9491 children: [t7, t9] 9492 }); 9493 $[17] = t7; 9494 $[18] = t9; 9495 $[19] = t10; 9496 } else t10 = $[19]; 9497 let t11; 9498 if ($[20] !== dismiss) { 9499 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 9500 size: "sm", 9501 onClick: dismiss, 9502 children: "Got It" 9503 }); 9504 $[20] = dismiss; 9505 $[21] = t11; 9506 } else t11 = $[21]; 9507 let t12; 9508 if ($[22] !== t10 || $[23] !== t11) { 9509 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
9510 className: "flex w-90 flex-col items-end gap-4 rounded-xl border border-border bg-popover p-4 shadow-lg", 9511 children: [t10, t11] 9512 }); 9513 $[22] = t10; 9514 $[23] = t11; 9515 $[24] = t12; 9516 } else t12 = $[24]; 9517 return t12; 9518} 9519function showDialerChangeToast({ variant, title, description }) { 9520 toast.custom((id) => { 9521 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialerChangeToast, { 9522 toastId: id, 9523 variant, 9524 title, 9525 description 9526 }); 9527 }, { duration: Infinity }); 9528} 9529var import_compiler_runtime$118 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 9530var DIALER_CHANGE_DATA_TYPE = "dialer_change"; 9531function extractDialerChangeFrame(message) { 9532 const payload = get(message, "data.data"); 9533 if (!payload || payload.dataType !== DIALER_CHANGE_DATA_TYPE) return null; 9534 return { 9535 payload, 9536 sourceId: get(message, "data.sourceId") 9537 }; 9538} 9539function useDialerChangeNotifications() { 9540 const $ = (0, import_compiler_runtime$118.c)(3); 9541 const dispatch = useAppDispatch(); 9542 const currentUserTpId = useUserInfoQueryState()?.userTpId; 9543 let t0; 9544 if ($[0] !== currentUserTpId || $[1] !== dispatch) { 9545 t0 = (message) => { 9546 const frame = extractDialerChangeFrame(message); 9547 if (!frame) return; 9548 const { payload, sourceId } = frame; 9549 dispatch(dialersApi.util.invalidateTags([{ 9550 type: "dialers", 9551 id: "GET_ACTIVE" 9552 }, { 9553 type: "dialers", 9554 id: "USER_DIALER_SETTING_INFO" 9555 }])); 9556 if (currentUserTpId != null && sourceId != null && sourceId === currentUserTpId) return; 9557 if (!payload.isAssign) showDialerChangeToast({ 9558 variant: "warning", 9559 title: "Virtual Number Unassign Notification", 9560 description: "Your virtual number has been unassigned by the administrator. The dialer is currently unavailable. Please contact your administrator." 9561 }); 9562 else if (payload.isAssignSeat) showDialerChangeToast({ 9563 variant: "success", 9564 title: "Dialer Assign Notification", 9565 description: "The administrator has assigned you a virtual number and call package at the same time." 9566 }); 9567 else showDialerChangeToast({ 9568 variant: "success", 9569 title: "Virtual Number Assign Notification", 9570 description: "The administrator has assigned you a virtual number. Please contact your administrator to assign a call package to you so you can start making calls from your browser." 9571 }); 9572 }; 9573 $[0] = currentUserTpId; 9574 $[1] = dispatch; 9575 $[2] = t0; 9576 } else t0 = $[2]; 9577 usePushEvent(DIALER_CHANGE, t0); 9578} 9579var import_compiler_runtime$117 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 9580var ASSIGN_DIALER_SEAT_MODULE = "assign-dialer-seat"; 9581function extractAssignSeatMessage(message) { 9582 const rawInfo = get(message, "data.data.info"); 9583 if (typeof rawInfo !== "string") return null; 9584 try { 9585 const parsed = JSON.parse(rawInfo); 9586 if (parsed?.module !== ASSIGN_DIALER_SEAT_MODULE) return null; 9587 return { 9588 message: parsed.message ?? {}, 9589 sourceTpUserId: parsed.sourceTpUserId 9590 }; 9591 } catch { 9592 return null; 9593 } 9594} 9595function useDialerSeatNotifications() { 9596 const $ = (0, import_compiler_runtime$117.c)(3); 9597 const dispatch = useAppDispatch(); 9598 const currentUserTpId = useUserInfoQueryState()?.userTpId; 9599 let t0; 9600 if ($[0] !== currentUserTpId || $[1] !== dispatch) { 9601 t0 = (message) => { 9602 const frame = extractAssignSeatMessage(message); 9603 if (!frame) return; 9604 const { message: payload, sourceTpUserId } = frame; 9605 dispatch(dialersApi.util.invalidateTags([{ 9606 type: "dialers", 9607 id: "GET_ACTIVE" 9608 }, { 9609 type: "dialers", 9610 id: "USER_DIALER_SETTING_INFO" 9611 }])); 9612 if (currentUserTpId != null && sourceTpUserId != null && sourceTpUserId === currentUserTpId) return; 9613 if (!payload.isAssign) { 9614 showDialerChangeToast({ 9615 variant: "warning", 9616 title: "Dialer - Call Package Unassign Notification", 9617 description: "Your administrator has unassigned your call package, so outbound calls are currently unavailable. Please contact your administrator to activate outbound calling." 9618 }); 9619 return; 9620 } 9621 showDialerChangeToast({ 9622 variant: "success", 9623 title: "Dialer - Call Package Assignment Notification", 9624 description: payload.hasVirtualNumber ? "The administrator has assigned you a call package. You can now make calls from your browser." : "The administrator has assigned you a call package." 9625 }); 9626 }; 9627 $[0] = currentUserTpId; 9628 $[1] = dispatch; 9629 $[2] = t0; 9630 } else t0 = $[2]; 9631 usePushEvent(SYSTEM_MESSAGE, t0); 9632} 9633var import_compiler_runtime$116 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 9634function useDialerUnreadNotifications() { 9635 const $ = (0, import_compiler_runtime$116.c)(2); 9636 const dispatch = useAppDispatch(); 9637 let t0; 9638 if ($[0] !== dispatch) { 9639 t0 = () => { 9640 dispatch(dialersApi.util.invalidateTags([{ 9641 type: "dialers", 9642 id: "UNREAD_COUNT" 9643 }])); 9644 }; 9645 $[0] = dispatch; 9646 $[1] = t0; 9647 } else t0 = $[1]; 9648 usePushEvent(MISS_CALL, t0); 9649} 9650var import_compiler_runtime$115 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 9651var AppProviderInner = (t0) => { 9652 const $ = (0, import_compiler_runtime$115.c)(4); 9653 const { children } = t0;
9654 usePushInit(); 9655 const navigate = useNavigate(); 9656 let t1; 9657 if ($[0] !== navigate) { 9658 t1 = () => { 9659 toast("Your imported POIs are ready for viewing", { action: { 9660 label: "View POI", 9661 onClick: () => navigate("/settings/address-book") 9662 } }); 9663 }; 9664 $[0] = navigate; 9665 $[1] = t1; 9666 } else t1 = $[1]; 9667 usePushEvent("poi", t1); 9668 useDialerChangeNotifications(); 9669 useDialerSeatNotifications(); 9670 useDialerUnreadNotifications(); 9671 let t2; 9672 if ($[2] !== children) { 9673 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialersProvider, { children }) }); 9674 $[2] = children; 9675 $[3] = t2; 9676 } else t2 = $[3]; 9677 return t2; 9678}; 9679const AppProvider = (t0) => { 9680 const $ = (0, import_compiler_runtime$115.c)(2); 9681 const { children } = t0; 9682 let t1; 9683 if ($[0] !== children) { 9684 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppProviderInner, { children }); 9685 $[0] = children; 9686 $[1] = t1; 9687 } else t1 = $[1]; 9688 return t1; 9689}; 9690require_compiler_runtime(); 9691var import_compiler_runtime$113 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 9692function Slider(t0) { 9693 const $ = (0, import_compiler_runtime$113.c)(26); 9694 let className; 9695 let defaultValue; 9696 let props; 9697 let t1; 9698 let t2; 9699 let value; 9700 if ($[0] !== t0) { 9701 ({className, defaultValue, value, min: t1, max: t2, ...props} = t0); 9702 $[0] = t0; 9703 $[1] = className; 9704 $[2] = defaultValue; 9705 $[3] = props; 9706 $[4] = t1; 9707 $[5] = t2; 9708 $[6] = value; 9709 } else { 9710 className = $[1]; 9711 defaultValue = $[2]; 9712 props = $[3]; 9713 t1 = $[4]; 9714 t2 = $[5]; 9715 value = $[6]; 9716 } 9717 const min = t1 === void 0 ? 0 : t1; 9718 const max = t2 === void 0 ? 100 : t2; 9719 let t3; 9720 if ($[7] !== defaultValue || $[8] !== max || $[9] !== min || $[10] !== value) { 9721 t3 = Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max]; 9722 $[7] = defaultValue; 9723 $[8] = max; 9724 $[9] = min; 9725 $[10] = value; 9726 $[11] = t3; 9727 } else t3 = $[11]; 9728 const _values = t3; 9729 let t4; 9730 if ($[12] !== className) { 9731 t4 = cn("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col", className); 9732 $[12] = className; 9733 $[13] = t4; 9734 } else t4 = $[13]; 9735 let t5; 9736 if ($[14] === Symbol.for("react.memo_cache_sentinel")) { 9737 t5 = cn("relative grow overflow-hidden rounded-full bg-muted data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"); 9738 $[14] = t5; 9739 } else t5 = $[14]; 9740 let t6; 9741 if ($[15] === Symbol.for("react.memo_cache_sentinel")) { 9742 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Track, { 9743 "data-slot": "slider-track", 9744 className: t5, 9745 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Range, { 9746 "data-slot": "slider-range", 9747 className: cn("absolute bg-primary data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full") 9748 }) 9749 }); 9750 $[15] = t6; 9751 } else t6 = $[15]; 9752 let t7; 9753 if ($[16] !== _values.length) { 9754 t7 = Array.from({ length: _values.length }, _temp$25); 9755 $[16] = _values.length; 9756 $[17] = t7; 9757 } else t7 = $[17]; 9758 let t8; 9759 if ($[18] !== defaultValue || $[19] !== max || $[20] !== min || $[21] !== props || $[22] !== t4 || $[23] !== t7 || $[24] !== value) { 9760 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Root$4, { 9761 "data-slot": "slider", 9762 defaultValue, 9763 value, 9764 min, 9765 max, 9766 className: t4, 9767 ...props, 9768 children: [t6, t7] 9769 }); 9770 $[18] = defaultValue; 9771 $[19] = max; 9772 $[20] = min; 9773 $[21] = props; 9774 $[22] = t4; 9775 $[23] = t7; 9776 $[24] = value; 9777 $[25] = t8; 9778 } else t8 = $[25]; 9779 return t8; 9780} 9781function _temp$25(_, index) { 9782 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Thumb, { 9783 "data-slot": "slider-thumb", 9784 className: "block size-4 shrink-0 rounded-full border border-primary bg-white shadow-sm ring-ring/20 transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50" 9785 }, index); 9786} 9787var import_compiler_runtime$112 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 9788function AudioPlayer(t0) { 9789 const $ = (0, import_compiler_runtime$112.c)(57); 9790 let className; 9791 let onPlay; 9792 let props; 9793 let t1; 9794 let url; 9795 if ($[0] !== t0) { 9796 ({duration: t1, url, className, onPlay, ...props} = t0); 9797 $[0] = t0; 9798 $[1] = className; 9799 $[2] = onPlay; 9800 $[3] = props; 9801 $[4] = t1; 9802 $[5] = url; 9803 } else { 9804 className = $[1]; 9805 onPlay = $[2]; 9806 props = $[3]; 9807 t1 = $[4]; 9808 url = $[5]; 9809 } 9810 const duration = t1 === void 0 ? 0 : t1; 9811 const audioRef = (0, import_react.useRef)(null); 9812 const [isPlaying, setIsPlaying] = (0, import_react.useState)(false); 9813 const [currentTime, setCurrentTime] = (0, import_react.useState)(0); 9814 const [isLoaded, setIsLoaded] = (0, import_react.useState)(false); 9815 const [isError, setIsError] = (0, import_react.useState)(false); 9816 const [audioDuration, setAudioDuration] = (0, import_react.useState)(duration); 9817 let t2; 9818 if ($[6] !== duration) { 9819 t2 = () => { 9820 setCurrentTime(0); 9821 setIsPlaying(false); 9822 setIsLoaded(false); 9823 setIsError(false); 9824 setAudioDuration(duration); 9825 }; 9826 $[6] = duration; 9827 $[7] = t2; 9828 } else t2 = $[7]; 9829 let t3; 9830 if ($[8] !== duration || $[9] !== url) { 9831 t3 = [url, duration]; 9832 $[8] = duration; 9833 $[9] = url; 9834 $[10] = t3; 9835 } else t3 = $[10]; 9836 (0, import_react.useEffect)(t2, t3); 9837 let t4; 9838 if ($[11] === Symbol.for("react.memo_cache_sentinel")) { 9839 t4 = () => { 9840 trackMethodCall("handleCanPlay", []); 9841 setIsLoaded(true); 9842 setIsError(false); 9843 if (audioRef.current) { 9844 const d$1 = audioRef.current.duration; 9845 if (d$1 && isFinite(d$1)) setAudioDuration(Math.floor(d$1)); 9846 } 9847 }; 9848 $[11] = t4; 9849 } else t4 = $[11]; 9850 const handleCanPlay = t4; 9851 let t5; 9852 if ($[12] === Symbol.for("react.memo_cache_sentinel")) { 9853 t5 = () => { 9854 trackMethodCall("handleError", []); 9855 setIsLoaded(false); 9856 setIsError(true); 9857 }; 9858 $[12] = t5; 9859 } else t5 = $[12]; 9860 const handleError = t5; 9861 let t6; 9862 if ($[13] === Symbol.for("react.memo_cache_sentinel")) { 9863 t6 = () => { 9864 trackMethodCall("handleTimeUpdate", []); 9865 if (audioRef.current) setCurrentTime(Math.floor(audioRef.current.currentTime)); 9866 }; 9867 $[13] = t6; 9868 } else t6 = $[13]; 9869 const handleTimeUpdate = t6; 9870 let t7; 9871 if ($[14] === Symbol.for("react.memo_cache_sentinel")) { 9872 t7 = () => { 9873 trackMethodCall("handleEnded", []); 9874 setIsPlaying(false); 9875 setCurrentTime(0); 9876 if (audioRef.current) audioRef.current.currentTime = 0; 9877 }; 9878 $[14] = t7; 9879 } else t7 = $[14]; 9880 const handleEnded = t7; 9881 let t8; 9882 if ($[15] !== onPlay) { 9883 t8 = () => { 9884 trackMethodCall("handlePlay", []); 9885 onPlay?.(); 9886 }; 9887 $[15] = onPlay; 9888 $[16] = t8; 9889 } else t8 = $[16]; 9890 const handlePlay = t8; 9891 let t9; 9892 if ($[17] !== isPlaying) { 9893 t9 = () => { 9894 trackMethodCall("handlePlayPause", []); 9895 const audio = audioRef.current; 9896 if (!audio) return; 9897 if (isPlaying) { 9898 audio.pause(); 9899 setIsPlaying(false); 9900 } else { 9901 audio.play(); 9902 setIsPlaying(true); 9903 } 9904 }; 9905 $[17] = isPlaying; 9906 $[18] = t9; 9907 } else t9 = $[18]; 9908 const handlePlayPause = t9; 9909 let t10; 9910 if ($[19] === Symbol.for("react.memo_cache_sentinel")) { 9911 t10 = (value) => { 9912 trackMethodCall("handleSeek", [value]); 9913 const audio_0 = audioRef.current; 9914 if (!audio_0) return; 9915 audio_0.currentTime = value[0]; 9916 setCurrentTime(value[0]); 9917 }; 9918 $[19] = t10; 9919 } else t10 = $[19]; 9920 const handleSeek = t10; 9921 const totalDuration = audioDuration || duration; 9922 let t11; 9923 if ($[20] !== className) { 9924 t11 = cn("flex h-8 w-full items-center rounded-md bg-primary-muted px-2", className); 9925 $[20] = className; 9926 $[21] = t11; 9927 } else t11 = $[21]; 9928 let t12; 9929 if ($[22] !== handlePlay || $[23] !== url) { 9930 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("audio", { 9931 ref: audioRef, 9932 src: url, 9933 preload: "metadata", 9934 onCanPlay: handleCanPlay, 9935 onError: handleError, 9936 onTimeUpdate: handleTimeUpdate, 9937 onEnded: handleEnded, 9938 onPlay: handlePlay 9939 }); 9940 $[22] = handlePlay; 9941 $[23] = url; 9942 $[24] = t12; 9943 } else t12 = $[24]; 9944 const t13 = isPlaying ? "playing" : "paused"; 9945 const t14 = !isLoaded; 9946 const t15 = !isLoaded || isError; 9947 let t16; 9948 let t17; 9949 let t18; 9950 let t19; 9951 if ($[25] === Symbol.for("react.memo_cache_sentinel")) { 9952 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loader, { className: "size-4 animate-spin fill-primary group-data-[error=true]:hidden group-data-[loading=false]:hidden" }); 9953 t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pause, { className: "size-4 fill-primary group-data-[loading=true]:hidden group-data-[state=paused]:hidden" }); 9954 t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Play, { className: "size-4 fill-primary group-data-[loading=true]:hidden group-data-[state=playing]:hidden" }); 9955 t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleAlert, { className: "hidden size-4 text-amber-700 group-data-[error=true]:block" }); 9956 $[25] = t16; 9957 $[26] = t17; 9958 $[27] = t18; 9959 $[28] = t19; 9960 } else { 9961 t16 = $[25]; 9962 t17 = $[26]; 9963 t18 = $[27]; 9964 t19 = $[28]; 9965 } 9966 let t20; 9967 if ($[29] !== handlePlayPause || $[30] !== isError || $[31] !== t13 || $[32] !== t14 || $[33] !== t15) { 9968 t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 9969 type: "button", 9970 variant: "ghost", 9971 size: "icon-sm", 9972 "aria-label": "Play audio", 9973 className: "group mr-1 h-4 w-4 text-primary hover:text-primary", 9974 "data-state": t13, 9975 "data-loading": t14, 9976 "data-error": isError, 9977 onClick: handlePlayPause, 9978 disabled: t15, 9979 children: [ 9980 t16, 9981 t17, 9982 t18, 9983 t19 9984 ] 9985 }); 9986 $[29] = handlePlayPause;
9987 $[30] = isError; 9988 $[31] = t13; 9989 $[32] = t14; 9990 $[33] = t15; 9991 $[34] = t20; 9992 } else t20 = $[34]; 9993 let t21; 9994 if ($[35] !== currentTime) { 9995 t21 = formatDuration(currentTime); 9996 $[35] = currentTime; 9997 $[36] = t21; 9998 } else t21 = $[36]; 9999 let t22; 10000 if ($[37] !== t21) { 10001 t22 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 10002 className: "text-xs font-medium text-muted-foreground", 10003 children: t21 10004 }); 10005 $[37] = t21; 10006 $[38] = t22; 10007 } else t22 = $[38]; 10008 let t23; 10009 if ($[39] !== currentTime) { 10010 t23 = [currentTime]; 10011 $[39] = currentTime; 10012 $[40] = t23; 10013 } else t23 = $[40]; 10014 const t24 = !isLoaded || isError; 10015 let t25; 10016 if ($[41] !== t23 || $[42] !== t24 || $[43] !== totalDuration) { 10017 t25 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slider, { 10018 value: t23, 10019 max: totalDuration, 10020 step: 1, 10021 onValueChange: handleSeek, 10022 disabled: t24, 10023 className: "mx-1.5 flex-1 [&_*[data-slot='slider-thumb']]:size-2 [&_*[data-slot='slider-thumb']]:border-2 [&_*[data-slot='slider-thumb']]:border-primary [&_*[data-slot='slider-thumb']]:bg-white [&_*[data-slot='slider-track']]:h-1 [&_*[data-slot='slider-track']]:bg-primary/20" 10024 }); 10025 $[41] = t23; 10026 $[42] = t24; 10027 $[43] = totalDuration; 10028 $[44] = t25; 10029 } else t25 = $[44]; 10030 let t26; 10031 if ($[45] !== totalDuration) { 10032 t26 = formatDuration(totalDuration); 10033 $[45] = totalDuration; 10034 $[46] = t26; 10035 } else t26 = $[46]; 10036 let t27; 10037 if ($[47] !== t26) { 10038 t27 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 10039 className: "text-xs font-medium text-muted-foreground", 10040 children: t26 10041 }); 10042 $[47] = t26; 10043 $[48] = t27; 10044 } else t27 = $[48]; 10045 let t28; 10046 if ($[49] !== props || $[50] !== t11 || $[51] !== t12 || $[52] !== t20 || $[53] !== t22 || $[54] !== t25 || $[55] !== t27) { 10047 t28 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 10048 className: t11, 10049 ...props, 10050 children: [ 10051 t12, 10052 t20, 10053 t22, 10054 t25, 10055 t27 10056 ] 10057 }); 10058 $[49] = props; 10059 $[50] = t11; 10060 $[51] = t12; 10061 $[52] = t20; 10062 $[53] = t22; 10063 $[54] = t25; 10064 $[55] = t27; 10065 $[56] = t28; 10066 } else t28 = $[56]; 10067 return t28; 10068} 10069var audio_player_default = AudioPlayer; 10070var import_compiler_runtime$111 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 10071var ACTIVITY_TYPE_ICON_MAPPING = { 10072 outBound: "outbound-muted",
10073 inBound: "inbound-muted", 10074 missed: "missed-call" 10075}; 10076function ActivityItem(t0) { 10077 const $ = (0, import_compiler_runtime$111.c)(78); 10078 let activity; 10079 let className; 10080 let props; 10081 if ($[0] !== t0) { 10082 ({activity, className, ...props} = t0); 10083 $[0] = t0; 10084 $[1] = activity; 10085 $[2] = className; 10086 $[3] = props; 10087 } else { 10088 activity = $[1]; 10089 className = $[2]; 10090 props = $[3]; 10091 } 10092 const dispatch = useAppDispatch(); 10093 let t1; 10094 if ($[4] !== activity.callTime) { 10095 t1 = safeFormatDate(activity.callTime, FORMATE_DATE_TIME_TIMEZONE); 10096 $[4] = activity.callTime; 10097 $[5] = t1; 10098 } else t1 = $[5]; 10099 const formattedDate = t1; 10100 const icon = ACTIVITY_TYPE_ICON_MAPPING[activity.activityType]; 10101 let t2; 10102 if ($[6] !== activity.callSid || $[7] !== dispatch) { 10103 t2 = () => { 10104 trackMethodCall("handleOpenCallResultSheet", []); 10105 dispatch(openCallResultSheet({ resultSheetSid: activity.callSid })); 10106 }; 10107 $[6] = activity.callSid; 10108 $[7] = dispatch; 10109 $[8] = t2; 10110 } else t2 = $[8]; 10111 const handleOpenCallResultSheet = t2; 10112 let t3; 10113 if ($[9] !== className) { 10114 t3 = cn("flex gap-4 bg-card", className); 10115 $[9] = className; 10116 $[10] = t3; 10117 } else t3 = $[10]; 10118 let t4; 10119 if ($[11] !== icon) { 10120 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 10121 className: "flex size-9 items-center justify-center rounded-full bg-secondary", 10122 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 10123 name: icon, 10124 className: "size-4.5" 10125 }) 10126 }); 10127 $[11] = icon; 10128 $[12] = t4; 10129 } else t4 = $[12]; 10130 const t5 = activity.callFromName ?? "Unknown"; 10131 let t6; 10132 if ($[13] !== t5) { 10133 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipOverflowTrigger, { 10134 asChild: true, 10135 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 10136 className: "inline-block max-w-25 truncate font-semibold text-foreground", 10137 children: t5 10138 }) 10139 }); 10140 $[13] = t5; 10141 $[14] = t6; 10142 } else t6 = $[14]; 10143 const t7 = activity.callFromName ?? "Unknown"; 10144 let t8; 10145 if ($[15] !== t7) { 10146 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t7 }) }); 10147 $[15] = t7; 10148 $[16] = t8; 10149 } else t8 = $[16]; 10150 let t9; 10151 if ($[17] !== t6 || $[18] !== t8) { 10152 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [t6, t8] }); 10153 $[17] = t6; 10154 $[18] = t8; 10155 $[19] = t9; 10156 } else t9 = $[19]; 10157 let t10; 10158 if ($[20] !== activity.callFromIdentity) { 10159 t10 = activity.callFromIdentity && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 10160 variant: "neutral-subtle", 10161 className: "h-4.5 bg-[#F2F4F6] capitalize", 10162 children: activity.callFromIdentity 10163 }); 10164 $[20] = activity.callFromIdentity; 10165 $[21] = t10; 10166 } else t10 = $[21]; 10167 let t11; 10168 if ($[22] !== activity.callFromPhone) { 10169 t11 = formatPhone(normalizePhone(activity.callFromPhone)); 10170 $[22] = activity.callFromPhone; 10171 $[23] = t11; 10172 } else t11 = $[23]; 10173 let t12; 10174 if ($[24] !== t11) { 10175 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 10176 className: "text-sm text-muted-foreground", 10177 children: t11 10178 }); 10179 $[24] = t11; 10180 $[25] = t12; 10181 } else t12 = $[25]; 10182 let t13; 10183 if ($[26] !== t10 || $[27] !== t12 || $[28] !== t9) { 10184 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 10185 className: "mb-1.5 flex flex-wrap items-center gap-1.5", 10186 children: [ 10187 t9, 10188 t10, 10189 t12 10190 ] 10191 }); 10192 $[26] = t10; 10193 $[27] = t12; 10194 $[28] = t9; 10195 $[29] = t13; 10196 } else t13 = $[29]; 10197 let t14; 10198 if ($[30] === Symbol.for("react.memo_cache_sentinel")) { 10199 t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 10200 className: "text-sm text-muted-foreground", 10201 children: "made a call to " 10202 }); 10203 $[30] = t14; 10204 } else t14 = $[30]; 10205 const t15 = activity.callToName ?? "Unknown"; 10206 let t16; 10207 if ($[31] !== t15) { 10208 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipOverflowTrigger, { 10209 asChild: true, 10210 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 10211 className: "inline-block max-w-25 truncate font-semibold text-foreground", 10212 children: t15 10213 }) 10214 }); 10215 $[31] = t15; 10216 $[32] = t16; 10217 } else t16 = $[32]; 10218 const t17 = activity.callToName ?? "Unknown"; 10219 let t18; 10220 if ($[33] !== t17) { 10221 t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t17 }) }); 10222 $[33] = t17; 10223 $[34] = t18; 10224 } else t18 = $[34]; 10225 let t19; 10226 if ($[35] !== t16 || $[36] !== t18) { 10227 t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [t16, t18] }); 10228 $[35] = t16; 10229 $[36] = t18; 10230 $[37] = t19; 10231 } else t19 = $[37]; 10232 let t20; 10233 if ($[38] !== activity.callToIdentity) {
10234 t20 = activity.callToIdentity && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 10235 variant: "neutral-subtle", 10236 className: "h-4.5 bg-[#F2F4F6] capitalize", 10237 children: activity.callToIdentity 10238 }); 10239 $[38] = activity.callToIdentity; 10240 $[39] = t20; 10241 } else t20 = $[39]; 10242 let t21; 10243 if ($[40] !== t19 || $[41] !== t20) { 10244 t21 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 10245 className: "mb-0.5 flex flex-wrap items-center gap-1.5", 10246 children: [ 10247 t14, 10248 t19, 10249 t20 10250 ] 10251 }); 10252 $[40] = t19; 10253 $[41] = t20; 10254 $[42] = t21; 10255 } else t21 = $[42]; 10256 let t22; 10257 if ($[43] !== activity.callToPhone) { 10258 t22 = formatPhone(normalizePhone(activity.callToPhone)); 10259 $[43] = activity.callToPhone; 10260 $[44] = t22; 10261 } else t22 = $[44]; 10262 let t23; 10263 if ($[45] !== t22) { 10264 t23 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 10265 className: "text-sm text-muted-foreground", 10266 children: t22 10267 }); 10268 $[45] = t22; 10269 $[46] = t23; 10270 } else t23 = $[46]; 10271 let t24; 10272 if ($[47] !== activity.outcome) { 10273 t24 = activity.outcome && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 10274 className: "text-sm text-muted-foreground", 10275 children: ":" 10276 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 10277 className: "text-sm text-muted-foreground", 10278 children: activity.outcome 10279 })] }); 10280 $[47] = activity.outcome; 10281 $[48] = t24; 10282 } else t24 = $[48]; 10283 let t25; 10284 if ($[49] !== t23 || $[50] !== t24) { 10285 t25 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 10286 className: "mb-2 flex flex-wrap items-center gap-1", 10287 children: [t23, t24] 10288 }); 10289 $[49] = t23; 10290 $[50] = t24; 10291 $[51] = t25; 10292 } else t25 = $[51]; 10293 let t26; 10294 if ($[52] === Symbol.for("react.memo_cache_sentinel")) { 10295 t26 = getCurrentTimeZone(); 10296 $[52] = t26; 10297 } else t26 = $[52]; 10298 let t27; 10299 if ($[53] !== activity.callDuration) { 10300 t27 = formatDurationMinutesGreatest(activity.callDuration); 10301 $[53] = activity.callDuration; 10302 $[54] = t27; 10303 } else t27 = $[54]; 10304 let t28; 10305 if ($[55] !== formattedDate || $[56] !== t27) { 10306 t28 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { 10307 className: "mb-2 text-xs text-muted-foreground", 10308 children: [ 10309 formattedDate, 10310 " ", 10311 t26, 10312 " ·", 10313 " ", 10314 t27 10315 ] 10316 }); 10317 $[55] = formattedDate; 10318 $[56] = t27; 10319 $[57] = t28; 10320 } else t28 = $[57]; 10321 let t29; 10322 if ($[58] !== activity.callDuration || $[59] !== activity.callRecord) { 10323 t29 = activity.callRecord ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(audio_player_default, { 10324 duration: activity.callDuration, 10325 url: activity.callRecord, 10326 className: "mb-2" 10327 }) : null; 10328 $[58] = activity.callDuration; 10329 $[59] = activity.callRecord; 10330 $[60] = t29; 10331 } else t29 = $[60]; 10332 let t30; 10333 if ($[61] !== activity.note) { 10334 t30 = activity.note && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 10335 className: "mb-2 text-xs text-muted-foreground", 10336 children: activity.note 10337 }); 10338 $[61] = activity.note; 10339 $[62] = t30; 10340 } else t30 = $[62]; 10341 let t31; 10342 if ($[63] !== handleOpenCallResultSheet) { 10343 t31 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 10344 type: "button", 10345 variant: "link", 10346 size: "sm", 10347 className: "h-fit p-0", 10348 onClick: handleOpenCallResultSheet, 10349 children: "View Call Result" 10350 }) }); 10351 $[63] = handleOpenCallResultSheet; 10352 $[64] = t31; 10353 } else t31 = $[64]; 10354 let t32; 10355 if ($[65] !== t13 || $[66] !== t21 || $[67] !== t25 || $[68] !== t28 || $[69] !== t29 || $[70] !== t30 || $[71] !== t31) { 10356 t32 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 10357 className: "flex min-w-0 flex-1 flex-col", 10358 children: [ 10359 t13, 10360 t21, 10361 t25, 10362 t28, 10363 t29, 10364 t30, 10365 t31 10366 ] 10367 }); 10368 $[65] = t13; 10369 $[66] = t21; 10370 $[67] = t25; 10371 $[68] = t28; 10372 $[69] = t29; 10373 $[70] = t30; 10374 $[71] = t31; 10375 $[72] = t32; 10376 } else t32 = $[72]; 10377 let t33; 10378 if ($[73] !== props || $[74] !== t3 || $[75] !== t32 || $[76] !== t4) { 10379 t33 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 10380 className: t3, 10381 ...props, 10382 children: [t4, t32] 10383 }); 10384 $[73] = props; 10385 $[74] = t3; 10386 $[75] = t32; 10387 $[76] = t4; 10388 $[77] = t33; 10389 } else t33 = $[77]; 10390 return t33; 10391} 10392var activity_item_default = ActivityItem; 10393var import_compiler_runtime$110 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 10394function Calendar({ className, classNames, showOutsideDays = true, captionLayout = "label", buttonVariant = "ghost", formatters, components,...props }) { 10395 const defaultClassNames = getDefaultClassNames(); 10396 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DayPicker, { 10397 showOutsideDays, 10398 className: cn("group/calendar bg-background p-3 [--cell-size:--spacing(8)] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent", String.raw`rtl:**:[.rdp-button\_next>
10398svg]:rotate-180`, String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`, className), 10399 captionLayout, 10400 formatters: { 10401 formatMonthDropdown: (date) => date.toLocaleString("default", { month: "short" }), 10402 ...formatters 10403 }, 10404 classNames: { 10405 root: cn("w-fit", defaultClassNames.root), 10406 months: cn("flex gap-4 flex-col md:flex-row relative", defaultClassNames.months), 10407 month: cn("flex flex-col w-full gap-4", defaultClassNames.month), 10408 nav: cn("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between", defaultClassNames.nav), 10409 button_previous: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none", defaultClassNames.button_previous), 10410 button_next: cn(buttonVariants({ variant: buttonVariant }), "size-(--cell-size) aria-disabled:opacity-50 p-0 select-none", defaultClassNames.button_next), 10411 month_caption: cn("flex items-center justify-center h-(--cell-size) w-full px-(--cell-size)", defaultClassNames.month_caption), 10412 dropdowns: cn("w-full flex items-center text-sm font-medium justify-center h-(--cell-size) gap-1.5", defaultClassNames.dropdowns), 10413 dropdown_root: cn("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/20 has-focus:ring-[3px] rounded-md", defaultClassNames.dropdown_root), 10414 dropdown: cn("absolute bg-popover inset-0 opacity-0", defaultClassNames.dropdown), 10415 caption_label: cn("select-none font-medium", captionLayout === "label" ? "text-sm" : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5", defaultClassNames.caption_label), 10416 table: "w-full border-collapse", 10417 weekdays: cn("flex", defaultClassNames.weekdays), 10418 weekday: cn("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none", defaultClassNames.weekday), 10419 week: cn("flex w-full mt-2", defaultClassNames.week), 10420 week_number_header: cn("select-none w-(--cell-size)", defaultClassNames.week_number_header), 10421 week_number: cn("text-[0.8rem] select-none text-muted-foreground", defaultClassNames.week_number), 10422 day: cn("relative w-full h-full p-0 text-center [&:last-child[data-selected=true]_button]:rounded-r-md group/day aspect-square select-none", props.showWeekNumber ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-md" : "[&:first-child[data-selected=true]_button]:rounded-l-md", defaultClassNames.day), 10423 range_start: cn("rounded-l-md bg-accent", defaultClassNames.range_start), 10424 range_middle: cn("rounded-none", defaultClassNames.range_middle), 10425 range_end: cn("rounded-r-md bg-accent", defaultClassNames.range_end), 10426 today: cn("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none", defaultClassNames.today), 10427 outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside), 10428 disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled), 10429 hidden: cn("invisible", defaultClassNames.hidden), 10430 ...classNames 10431 }, 10432 components: { 10433 Root: ({ className: className_0, rootRef,...props_0 }) => { 10434 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 10435 "data-slot": "calendar", 10436 ref: rootRef, 10437 className: cn(className_0), 10438 ...props_0 10439 }); 10440 }, 10441 Chevron: ({ className: className_1, orientation,...props_1 }) => { 10442 if (orientation === "left") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronLeft, { 10443 className: cn("size-4", className_1), 10444 ...props_1 10445 }); 10446 if (orientation === "right") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, { 10447 className: cn("size-4", className_1), 10448 ...props_1 10449 }); 10450 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { 10451 className: cn("size-4", className_1), 10452 ...props_1 10453 }); 10454 }, 10455 DayButton: CalendarDayButton, 10456 WeekNumber: ({ children,...props_2 }) => { 10457 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { 10458 ...props_2, 10459 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 10460 className: "flex size-(--cell-size) items-center justify-center text-center", 10461 children 10462 }) 10463 }); 10464 }, 10465 ...components 10466 }, 10467 ...props 10468 }); 10469} 10470function CalendarDayButton(t0) { 10471 const $ = (0, import_compiler_runtime$110.c)(19); 10472 let className; 10473 let day; 10474 let modifiers; 10475 let props; 10476 if ($[0] !== t0) { 10477 ({className, day, modifiers, ...props} = t0); 10478 $[0] = t0; 10479 $[1] = className; 10480 $[2] = day; 10481 $[3] = modifiers; 10482 $[4] = props; 10483 } else { 10484 className = $[1]; 10485 day = $[2]; 10486 modifiers = $[3]; 10487 props = $[4]; 10488 } 10489 const defaultClassNames = getDefaultClassNames(); 10490 const ref = import_react.useRef(null); 10491 let t1; 10492 let t2; 10493 if ($[5] !== modifiers.focused) { 10494 t1 = () => { 10495 if (modifiers.focused) ref.current?.focus(); 10496 }; 10497 t2 = [modifiers.focused]; 10498 $[5] = modifiers.focused; 10499 $[6] = t1; 10500 $[7] = t2; 10501 } else { 10502 t1 = $[6]; 10503 t2 = $[7]; 10504 } 10505 import_react.useEffect(t1, t2); 10506 const T0 = Button; 10507 const t3 = "ghost"; 10508 const t4 = "icon"; 10509 let t5; 10510 if ($[8] !== day.date) { 10511 t5 = day.date.toLocaleDateString(); 10512 $[8] = day.date; 10513 $[9] = t5; 10514 } else t5 = $[9]; 10515 const t6 = modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle; 10516 const t7 = modifiers.range_start; 10517 const t8 = modifiers.range_end; 10518 const t9 = modifiers.range_middle; 10519 const t10 = cn("flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/20 data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-accent-foreground [&>span]:text-xs [&>span]:opacity-70", defaultClassNames.day, className); 10520 let t11; 10521 if ($[10] !== T0 || $[11] !== modifiers.range_end || $[12] !== modifiers.range_middle || $[13] !== modifiers.range_start || $[14] !== props || $[15] !== t10 || $[16] !== t5 || $[17] !== t6) { 10522 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(T0, { 10523 ref, 10524 variant: t3, 10525 size: t4, 10526 "data-day": t5, 10527 "data-selected-single": t6, 10528 "data-range-start": t7, 10529 "data-range-end": t8, 10530 "data-range-middle": t9, 10531 className: t10, 10532 ...props 10533 }); 10534 $[10] = T0; 10535 $[11] = modifiers.range_end; 10536 $[12] = modifiers.range_middle; 10537 $[13] = modifiers.range_start; 10538 $[14] = props; 10539 $[15] = t10; 10540 $[16] = t5; 10541 $[17] = t6; 10542 $[18] = t11; 10543 } else t11 = $[18]; 10544 return t11; 10545} 10546var import_compiler_runtime$109 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 10547function getDisplayDate(selected, mode) { 10548 if (!selected) return; 10549 if (mode === "single") return `${safeFormatDate(selected)}`; 10550 if (mode === "range") return `${safeFormatDate(selected.from)}
10550 - ${safeFormatDate(selected.to)}`; 10551 if (mode === "multiple") { 10552 const dates = selected; 10553 if (dates.length === 0) return; 10554 if (dates.length === 1) return safeFormatDate(dates[0]); 10555 if (dates.length <= 3) return dates.map((date) => safeFormatDate(date)).join(", "); 10556 return `${dates.length} dates selected`; 10557 } 10558} 10559const DatePicker = (t0) => { 10560 const $ = (0, import_compiler_runtime$109.c)(41); 10561 let ariaInvalid; 10562 let className; 10563 let mode; 10564 let onSelect; 10565 let placeholder; 10566 let restProps; 10567 let selected; 10568 if ($[0] !== t0) { 10569 ({mode, selected, onSelect, className, placeholder, "aria-invalid": ariaInvalid, ...restProps} = t0); 10570 $[0] = t0; 10571 $[1] = ariaInvalid; 10572 $[2] = className; 10573 $[3] = mode; 10574 $[4] = onSelect; 10575 $[5] = placeholder; 10576 $[6] = restProps; 10577 $[7] = selected; 10578 } else { 10579 ariaInvalid = $[1]; 10580 className = $[2]; 10581 mode = $[3]; 10582 onSelect = $[4]; 10583 placeholder = $[5]; 10584 restProps = $[6]; 10585 selected = $[7]; 10586 } 10587 let t1; 10588 if ($[8] !== mode || $[9] !== selected) { 10589 t1 = getDisplayDate(selected, mode); 10590 $[8] = mode; 10591 $[9] = selected; 10592 $[10] = t1; 10593 } else t1 = $[10]; 10594 const display = t1; 10595 const [open, setOpen$1] = (0, import_react.useState)(false); 10596 let t2; 10597 if ($[11] !== onSelect) { 10598 t2 = () => { 10599 onSelect?.(void 0); 10600 }; 10601 $[11] = onSelect; 10602 $[12] = t2; 10603 } else t2 = $[12]; 10604 const onClear = t2; 10605 let t3; 10606 if ($[13] !== mode || $[14] !== onSelect) { 10607 t3 = (date) => { 10608 onSelect?.(date); 10609 if (mode === "single") setOpen$1(false); 10610 }; 10611 $[13] = mode; 10612 $[14] = onSelect; 10613 $[15] = t3; 10614 } else t3 = $[15]; 10615 const handleSelect = t3; 10616 const t4 = !selected ? "text-muted-foreground" : "text-foreground"; 10617 let t5; 10618 if ($[16] !== className || $[17] !== t4) { 10619 t5 = cn("w-full justify-between border-input font-normal", t4, "data-[state=open]:border-ring data-[state=open]:ring-[3px] data-[state=open]:ring-ring/20", className); 10620 $[16] = className; 10621 $[17] = t4; 10622 $[18] = t5; 10623 } else t5 = $[18]; 10624 const t6 = selected ? display : placeholder; 10625 let t7; 10626 if ($[19] !== t6) { 10627 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 10628 className: "truncate text-left", 10629 children: t6 10630 }); 10631 $[19] = t6; 10632 $[20] = t7; 10633 } else t7 = $[20]; 10634 let t8; 10635 if ($[21] !== onClear || $[22] !== selected) {
10636 t8 = selected && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { 10637 type: "button", 10638 className: "flex h-4 w-4 items-center justify-center rounded-sm p-0 text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none", 10639 onClick: (e$4) => { 10640 e$4.stopPropagation(); 10641 onClear(); 10642 }, 10643 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleX, { className: "size-3.5" }) 10644 }); 10645 $[21] = onClear; 10646 $[22] = selected; 10647 $[23] = t8; 10648 } else t8 = $[23]; 10649 let t9; 10650 if ($[24] === Symbol.for("react.memo_cache_sentinel")) { 10651 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { className: "h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" }); 10652 $[24] = t9; 10653 } else t9 = $[24]; 10654 let t10; 10655 if ($[25] !== t8) { 10656 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 10657 className: "ml-2 flex shrink-0 items-center gap-1", 10658 children: [t8, t9] 10659 }); 10660 $[25] = t8; 10661 $[26] = t10; 10662 } else t10 = $[26]; 10663 let t11; 10664 if ($[27] !== ariaInvalid || $[28] !== t10 || $[29] !== t5 || $[30] !== t7) { 10665 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverTrigger, { 10666 asChild: true, 10667 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 10668 variant: "outline", 10669 "aria-invalid": ariaInvalid, 10670 className: t5, 10671 children: [t7, t10] 10672 }) 10673 }); 10674 $[27] = ariaInvalid; 10675 $[28] = t10; 10676 $[29] = t5; 10677 $[30] = t7; 10678 $[31] = t11; 10679 } else t11 = $[31]; 10680 let t12; 10681 if ($[32] !== handleSelect || $[33] !== mode || $[34] !== restProps || $[35] !== selected) { 10682 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverContent, { 10683 className: "w-fit p-0", 10684 align: "start", 10685 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Calendar, { 10686 mode, 10687 selected, 10688 onSelect: handleSelect, 10689 ...restProps 10690 }) 10691 }); 10692 $[32] = handleSelect; 10693 $[33] = mode; 10694 $[34] = restProps; 10695 $[35] = selected; 10696 $[36] = t12; 10697 } else t12 = $[36]; 10698 let t13; 10699 if ($[37] !== open || $[38] !== t11 || $[39] !== t12) { 10700 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Popover, { 10701 open, 10702 onOpenChange: setOpen$1, 10703 children: [t11, t12] 10704 }); 10705 $[37] = open; 10706 $[38] = t11; 10707 $[39] = t12; 10708 $[40] = t13; 10709 } else t13 = $[40]; 10710 return t13; 10711}; 10712var import_compiler_runtime$108 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 10713function Select(t0) { 10714 const $ = (0, import_compiler_runtime$108.c)(4); 10715 let props; 10716 if ($[0] !== t0) { 10717 ({...props} = t0); 10718 $[0] = t0; 10719 $[1] = props; 10720 } else props = $[1]; 10721 let t1; 10722 if ($[2] !== props) { 10723 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root2$2, { 10724 "data-slot": "select", 10725 ...props 10726 }); 10727 $[2] = props; 10728 $[3] = t1; 10729 } else t1 = $[3]; 10730 return t1; 10731} 10732function SelectValue(t0) { 10733 const $ = (0, import_compiler_runtime$108.c)(4); 10734 let props; 10735 if ($[0] !== t0) { 10736 ({...props} = t0); 10737 $[0] = t0; 10738 $[1] = props; 10739 } else props = $[1]; 10740 let t1; 10741 if ($[2] !== props) { 10742 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Value, { 10743 "data-slot": "select-value", 10744 ...props 10745 }); 10746 $[2] = props; 10747 $[3] = t1; 10748 } else t1 = $[3]; 10749 return t1; 10750} 10751function SelectTrigger(t0) { 10752 const $ = (0, import_compiler_runtime$108.c)(24); 10753 let children; 10754 let className; 10755 let onClear; 10756 let props; 10757 let t1; 10758 let t2; 10759 if ($[0] !== t0) { 10760 ({className, size: t1, children, showClear: t2, onClear, ...props} = t0); 10761 $[0] = t0; 10762 $[1] = children; 10763 $[2] = className; 10764 $[3] = onClear; 10765 $[4] = props; 10766 $[5] = t1; 10767 $[6] = t2; 10768 } else { 10769 children = $[1]; 10770 className = $[2]; 10771 onClear = $[3]; 10772 props = $[4]; 10773 t1 = $[5]; 10774 t2 = $[6]; 10775 } 10776 const size = t1 === void 0 ? "default" : t1; 10777 const showClear = t2 === void 0 ? false : t2; 10778 let t3; 10779 if ($[7] !== className) { 10780 t3 = cn("group/select flex w-fit items-center gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/20 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground", className); 10781 $[7] = className; 10782 $[8] = t3; 10783 } else t3 = $[8]; 10784 let t4; 10785 if ($[9] !== onClear || $[10] !== showClear) {
10786 t4 = showClear && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 10787 role: "button", 10788 "aria-label": "Clear selection", 10789 className: "ml-auto inline-flex size-6 items-center justify-center rounded-sm hover:bg-accent hover:text-accent-foreground", 10790 onPointerDown: _temp$24, 10791 onClick: (event_0) => { 10792 event_0.preventDefault(); 10793 event_0.stopPropagation(); 10794 onClear?.(); 10795 }, 10796 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleX, { 10797 className: "size-4", 10798 "aria-hidden": "true" 10799 }) 10800 }); 10801 $[9] = onClear; 10802 $[10] = showClear; 10803 $[11] = t4; 10804 } else t4 = $[11]; 10805 const t5 = !showClear && "ml-auto"; 10806 let t6; 10807 if ($[12] !== t5) { 10808 t6 = cn(t5); 10809 $[12] = t5; 10810 $[13] = t6; 10811 } else t6 = $[13]; 10812 let t7; 10813 if ($[14] === Symbol.for("react.memo_cache_sentinel")) { 10814 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { className: "size-4 transition-transform group-data-[state=open]/select:rotate-180" }); 10815 $[14] = t7; 10816 } else t7 = $[14]; 10817 let t8; 10818 if ($[15] !== t6) { 10819 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { 10820 asChild: true, 10821 className: t6, 10822 children: t7 10823 }); 10824 $[15] = t6; 10825 $[16] = t8; 10826 } else t8 = $[16]; 10827 let t9; 10828 if ($[17] !== children || $[18] !== props || $[19] !== size || $[20] !== t3 || $[21] !== t4 || $[22] !== t8) { 10829 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Trigger$4, { 10830 "data-slot": "select-trigger", 10831 "data-size": size, 10832 className: t3, 10833 ...props, 10834 children: [ 10835 children, 10836 t4, 10837 t8 10838 ] 10839 }); 10840 $[17] = children; 10841 $[18] = props; 10842 $[19] = size; 10843 $[20] = t3; 10844 $[21] = t4; 10845 $[22] = t8; 10846 $[23] = t9; 10847 } else t9 = $[23]; 10848 return t9; 10849} 10850function _temp$24(event) { 10851 event.preventDefault(); 10852 event.stopPropagation(); 10853} 10854function SelectContent(t0) { 10855 const $ = (0, import_compiler_runtime$108.c)(22); 10856 let children; 10857 let className; 10858 let props; 10859 let t1; 10860 let t2; 10861 if ($[0] !== t0) { 10862 ({className, children, position: t1, align: t2, ...props} = t0); 10863 $[0] = t0; 10864 $[1] = children; 10865 $[2] = className; 10866 $[3] = props; 10867 $[4] = t1; 10868 $[5] = t2; 10869 } else { 10870 children = $[1]; 10871 className = $[2]; 10872 props = $[3]; 10873 t1 = $[4]; 10874 t2 = $[5]; 10875 } 10876 const position = t1 === void 0 ? "popper" : t1; 10877 const align = t2 === void 0 ? "center" : t2; 10878 const t3 = position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1"; 10879 let t4; 10880 if ($[6] !== className || $[7] !== t3) { 10881 t4 = cn("relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", t3, className); 10882 $[6] = className; 10883 $[7] = t3; 10884 $[8] = t4; 10885 } else t4 = $[8]; 10886 let t5; 10887 if ($[9] === Symbol.for("react.memo_cache_sentinel")) { 10888 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectScrollUpButton, {}); 10889 $[9] = t5; 10890 } else t5 = $[9]; 10891 const t6 = position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"; 10892 let t7; 10893 if ($[10] !== t6) { 10894 t7 = cn("p-1", t6); 10895 $[10] = t6; 10896 $[11] = t7; 10897 } else t7 = $[11]; 10898 let t8; 10899 if ($[12] !== children || $[13] !== t7) { 10900 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Viewport, { 10901 className: t7, 10902 children 10903 }); 10904 $[12] = children; 10905 $[13] = t7; 10906 $[14] = t8; 10907 } else t8 = $[14]; 10908 let t9; 10909 if ($[15] === Symbol.for("react.memo_cache_sentinel")) { 10910 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectScrollDownButton, {}); 10911 $[15] = t9; 10912 } else t9 = $[15]; 10913 let t10; 10914 if ($[16] !== align || $[17] !== position || $[18] !== props || $[19] !== t4 || $[20] !== t8) { 10915 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Portal$3, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Content2$3, { 10916 "data-slot": "select-content", 10917 className: t4, 10918 position, 10919 align, 10920 ...props, 10921 children: [ 10922 t5, 10923 t8, 10924 t9 10925 ] 10926 }) }); 10927 $[16] = align; 10928 $[17] = position; 10929 $[18] = props; 10930 $[19] = t4; 10931 $[20] = t8; 10932 $[21] = t10; 10933 } else t10 = $[21]; 10934 return t10; 10935} 10936function SelectItem(t0) { 10937 const $ = (0, import_compiler_runtime$108.c)(13); 10938 let children; 10939 let className; 10940 let props; 10941 if ($[0] !== t0) { 10942 ({className, children, ...props} = t0); 10943 $[0] = t0; 10944 $[1] = children; 10945 $[2] = className; 10946 $[3] = props; 10947 } else { 10948 children = $[1]; 10949 className = $[2]; 10950 props = $[3]; 10951 } 10952 let t1; 10953 if ($[4] !== className) { 10954 t1 = cn("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className); 10955 $[4] = className; 10956 $[5] = t1; 10957 } else t1 = $[5]; 10958 let t2; 10959 if ($[6] === Symbol.for("react.memo_cache_sentinel")) { 10960 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 10961 className: "absolute right-2 flex size-3.5 items-center justify-center", 10962 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { className: "size-4" }) }) 10963 }); 10964 $[6] = t2; 10965 } else t2 = $[6]; 10966 let t3; 10967 if ($[7] !== children) { 10968 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemText, { children }); 10969 $[7] = children; 10970 $[8] = t3; 10971 } else t3 = $[8]; 10972 let t4; 10973 if ($[9] !== props || $[10] !== t1 || $[11] !== t3) { 10974 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Item$1, { 10975 "data-slot": "select-item", 10976 className: t1, 10977 ...props, 10978 children: [t2, t3] 10979 }); 10980 $[9] = props; 10981 $[10] = t1; 10982 $[11] = t3; 10983 $[12] = t4; 10984 } else t4 = $[12]; 10985 return t4; 10986} 10987function SelectScrollUpButton(t0) { 10988 const $ = (0, import_compiler_runtime$108.c)(9); 10989 let className; 10990 let props; 10991 if ($[0] !== t0) { 10992 ({className, ...props} = t0); 10993 $[0] = t0; 10994 $[1] = className; 10995 $[2] = props; 10996 } else { 10997 className = $[1]; 10998 props = $[2]; 10999 } 11000 let t1; 11001 if ($[3] !== className) { 11002 t1 = cn("flex cursor-default items-center justify-center py-1", className); 11003 $[3] = className; 11004 $[4] = t1; 11005 } else t1 = $[4]; 11006 let t2; 11007 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 11008 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronUp, { className: "size-4" }); 11009 $[5] = t2; 11010 } else t2 = $[5]; 11011 let t3; 11012 if ($[6] !== props || $[7] !== t1) { 11013 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollUpButton, { 11014 "data-slot": "select-scroll-up-button", 11015 className: t1, 11016 ...props, 11017 children: t2 11018 }); 11019 $[6] = props; 11020 $[7] = t1; 11021 $[8] = t3; 11022 } else t3 = $[8]; 11023 return t3; 11024} 11025function SelectScrollDownButton(t0) { 11026 const $ = (0, import_compiler_runtime$108.c)(9); 11027 let className; 11028 let props; 11029 if ($[0] !== t0) { 11030 ({className, ...props} = t0); 11031 $[0] = t0; 11032 $[1] = className; 11033 $[2] = props; 11034 } else { 11035 className = $[1]; 11036 props = $[2]; 11037 } 11038 let t1; 11039 if ($[3] !== className) { 11040 t1 = cn("flex cursor-default items-center justify-center py-1", className); 11041 $[3] = className; 11042 $[4] = t1; 11043 } else t1 = $[4]; 11044 let t2; 11045 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 11046 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { className: "size-4" }); 11047 $[5] = t2; 11048 } else t2 = $[5]; 11049 let t3; 11050 if ($[6] !== props || $[7] !== t1) { 11051 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollDownButton, { 11052 "data-slot": "select-scroll-down-button", 11053 className: t1, 11054 ...props, 11055 children: t2 11056 }); 11057 $[6] = props; 11058 $[7] = t1; 11059 $[8] = t3; 11060 } else t3 = $[8]; 11061 return t3; 11062} 11063var import_compiler_runtime$107 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 11064function Empty(t0) { 11065 const $ = (0, import_compiler_runtime$107.c)(8); 11066 let className; 11067 let props; 11068 if ($[0] !== t0) { 11069 ({className, ...props} = t0); 11070 $[0] = t0; 11071 $[1] = className; 11072 $[2] = props; 11073 } else { 11074 className = $[1]; 11075 props = $[2]; 11076 } 11077 let t1; 11078 if ($[3] !== className) { 11079 t1 = cn("flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12", className); 11080 $[3] = className; 11081 $[4] = t1; 11082 } else t1 = $[4]; 11083 let t2; 11084 if ($[5] !== props || $[6] !== t1) { 11085 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 11086 "data-slot": "empty", 11087 className: t1, 11088 ...props 11089 }); 11090 $[5] = props; 11091 $[6] = t1; 11092 $[7] = t2; 11093 } else t2 = $[7]; 11094 return t2; 11095} 11096function EmptyHeader(t0) { 11097 const $ = (0, import_compiler_runtime$107.c)(8); 11098 let className; 11099 let props; 11100 if ($[0] !== t0) { 11101 ({className, ...props} = t0); 11102 $[0] = t0; 11103 $[1] = className; 11104 $[2] = props; 11105 } else { 11106 className = $[1]; 11107 props = $[2]; 11108 } 11109 let t1; 11110 if ($[3] !== className) { 11111 t1 = cn("flex max-w-sm flex-col items-center gap-2 text-center", className); 11112 $[3] = className; 11113 $[4] = t1; 11114 } else t1 = $[4]; 11115 let t2; 11116 if ($[5] !== props || $[6] !== t1) { 11117 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 11118 "data-slot": "empty-header", 11119 className: t1, 11120 ...props 11121 }); 11122 $[5] = props; 11123 $[6] = t1; 11124 $[7] = t2; 11125 } else t2 = $[7]; 11126 return t2; 11127} 11128var emptyMediaVariants = T({ 11129 base: "flex shrink-0 items-center justify-center mb-2 [&_svg]:pointer-events-none [&_svg]:shrink-0", 11130 variants: { variant: { 11131 default: "bg-transparent", 11132 icon: "bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-6" 11133 } }, 11134 defaultVariants: { variant: "default" } 11135}); 11136function EmptyMedia(t0) { 11137 const $ = (0, import_compiler_runtime$107.c)(11); 11138 let className; 11139 let props; 11140 let t1; 11141 if ($[0] !== t0) { 11142 ({className, variant: t1, ...props} = t0); 11143 $[0] = t0; 11144 $[1] = className; 11145 $[2] = props; 11146 $[3] = t1; 11147 } else { 11148 className = $[1]; 11149 props = $[2]; 11150 t1 = $[3]; 11151 } 11152 const variant = t1 === void 0 ? "default" : t1; 11153 let t2; 11154 if ($[4] !== className || $[5] !== variant) { 11155 t2 = cn(emptyMediaVariants({ 11156 variant, 11157 className 11158 })); 11159 $[4] = className; 11160 $[5] = variant; 11161 $[6] = t2; 11162 } else t2 = $[6]; 11163 let t3; 11164 if ($[7] !== props || $[8] !== t2 || $[9] !== variant) { 11165 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 11166 "data-slot": "empty-icon", 11167 "data-variant": variant, 11168 className: t2, 11169 ...props 11170 }); 11171 $[7] = props; 11172 $[8] = t2; 11173 $[9] = variant; 11174 $[10] = t3; 11175 } else t3 = $[10]; 11176 return t3; 11177} 11178function EmptyTitle(t0) { 11179 const $ = (0, import_compiler_runtime$107.c)(8); 11180 let className; 11181 let props; 11182 if ($[0] !== t0) { 11183 ({className, ...props} = t0); 11184 $[0] = t0; 11185 $[1] = className; 11186 $[2] = props; 11187 } else { 11188 className = $[1]; 11189 props = $[2]; 11190 } 11191 let t1; 11192 if ($[3] !== className) { 11193 t1 = cn("text-lg font-medium tracking-tight text-foreground", className); 11194 $[3] = className; 11195 $[4] = t1; 11196 } else t1 = $[4]; 11197 let t2; 11198 if ($[5] !== props || $[6] !== t1) { 11199 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 11200 "data-slot": "empty-title", 11201 className: t1, 11202 ...props 11203 }); 11204 $[5] = props; 11205 $[6] = t1; 11206 $[7] = t2; 11207 } else t2 = $[7]; 11208 return t2; 11209}
11210function EmptyDescription(t0) { 11211 const $ = (0, import_compiler_runtime$107.c)(8); 11212 let className; 11213 let props; 11214 if ($[0] !== t0) { 11215 ({className, ...props} = t0); 11216 $[0] = t0; 11217 $[1] = className; 11218 $[2] = props; 11219 } else { 11220 className = $[1]; 11221 props = $[2]; 11222 } 11223 let t1; 11224 if ($[3] !== className) { 11225 t1 = cn("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", className); 11226 $[3] = className; 11227 $[4] = t1; 11228 } else t1 = $[4]; 11229 let t2; 11230 if ($[5] !== props || $[6] !== t1) { 11231 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 11232 "data-slot": "empty-description", 11233 className: t1, 11234 ...props 11235 }); 11236 $[5] = props; 11237 $[6] = t1; 11238 $[7] = t2; 11239 } else t2 = $[7]; 11240 return t2; 11241} 11242function EmptyContent(t0) { 11243 const $ = (0, import_compiler_runtime$107.c)(8); 11244 let className; 11245 let props; 11246 if ($[0] !== t0) { 11247 ({className, ...props} = t0); 11248 $[0] = t0; 11249 $[1] = className; 11250 $[2] = props; 11251 } else { 11252 className = $[1]; 11253 props = $[2]; 11254 } 11255 let t1; 11256 if ($[3] !== className) { 11257 t1 = cn("flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance", className); 11258 $[3] = className; 11259 $[4] = t1; 11260 } else t1 = $[4]; 11261 let t2; 11262 if ($[5] !== props || $[6] !== t1) { 11263 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 11264 "data-slot": "empty-content", 11265 className: t1, 11266 ...props 11267 }); 11268 $[5] = props; 11269 $[6] = t1; 11270 $[7] = t2; 11271 } else t2 = $[7]; 11272 return t2; 11273} 11274var import_compiler_runtime$106 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 11275var EMPTY_VALUE = "--"; 11276var PAGE_SIZE$2 = 10; 11277var SHOW_RECENT_LOADS = false; 11278var ALL_CALL_TYPES = [ 11279 "inBound", 11280 "outBound", 11281 "missed" 11282]; 11283function DialerActivitiesSheet() { 11284 const dispatch = useAppDispatch(); 11285 const isNestedSheetOpen = useAppSelector(selectIsNestedSheetOpen); 11286 const isMinimized = useAppSelector(selectIsMinimizeSheetOpen); 11287 const isOpen = isNestedSheetOpen && !isMinimized; 11288 const sourceRect = useAppSelector(selectNestedSheetSourceRect); 11289 const basicInfo = useAppSelector(selectNestedSheetData) ?? {}; 11290 const [filters, setFilters] = (0, import_react.useState)({ type: ALL_CALL_TYPES }); 11291 const loadMoreRef = (0, import_react.useRef)(null); 11292 const [inViewport] = useInViewport_default(loadMoreRef); 11293 const isDisabledLoadContact = !basicInfo.id || !basicInfo.role; 11294 const { data: contactDataResponse, isLoading: isLoadingContact, isFetching: isFetchingContact } = useGetDialerContactQuery({ 11295 role: basicInfo.role?.toUpperCase(), 11296 personId: basicInfo.id, 11297 contactId: basicInfo.contactId, 11298 phoneNumber: basicInfo.phone 11299 }, { skip: isDisabledLoadContact }); 11300 const { data, isLoading, isFetching, isFetchingNextPage, fetchNextPage, hasNextPage, refetch } = useGetDialerActivitiesInDialogInfiniteQuery({ 11301 callType: filters.type, 11302 fromDate: filters.date?.from ? startOfDay(filters.date.from).getTime() : void 0, 11303 toDate: filters.date?.to ? endOfDay(filters.date.to).getTime() : void 0, 11304 size: PAGE_SIZE$2, 11305 phone: basicInfo.phone ?? "", 11306 activityType: basicInfo.role ? basicInfo.role.toLowerCase() : "", 11307 relatedId: basicInfo.role && basicInfo.id ? basicInfo.id : "" 11308 }); 11309 const activities = (get(data, "pages") ?? []).flatMap((page) => { 11310 return get(page, "data") ?? []; 11311 }) ?? []; 11312 const isGetContactLoading = isLoadingContact || isFetchingContact; 11313 const contactData = get(contactDataResponse, "data") ?? {}; 11314 get(contactDataResponse, "data.recentLoads"); 11315 const phone = normalizePhone(!isDisabledLoadContact ? contactData.formatPhone ?? contactData.phone : basicInfo.phone); 11316 const groupedActivities = groupActivitiesByDate(activities); 11317 const contactKey = `${basicInfo.id ?? ""}|${basicInfo.contactId ?? ""}|${basicInfo.phone ?? ""}|${basicInfo.role ?? ""}`; 11318 const prevResetKeyRef = (0, import_react.useRef)(null); 11319 (0, import_react.useEffect)(() => { 11320 if (!isNestedSheetOpen) { 11321 prevResetKeyRef.current = null; 11322 return; 11323 } 11324 if (prevResetKeyRef.current !== contactKey) { 11325 prevResetKeyRef.current = contactKey; 11326 setFilters({ type: ALL_CALL_TYPES }); 11327 refetch(); 11328 } 11329 }, [ 11330 isNestedSheetOpen, 11331 contactKey, 11332 refetch 11333 ]); 11334 const listScrollRef = (0, import_react.useRef)(null); 11335 const skipAutoLoadRef = (0, import_react.useRef)(false); 11336 const isAutoScrollingRef = (0, import_react.useRef)(false); 11337 const prevInViewportRef = (0, import_react.useRef)(false); 11338 (0, import_react.useEffect)(() => { 11339 skipAutoLoadRef.current = true; 11340 const el = listScrollRef.current; 11341 if (el && el.scrollTop > 0) { 11342 isAutoScrollingRef.current = true; 11343 el.scrollTo({ top: 0 }); 11344 } 11345 }, [filters]); 11346 (0, import_react.useEffect)(() => { 11347 const enteredView = !!inViewport && !prevInViewportRef.current; 11348 prevInViewportRef.current = !!inViewport; 11349 if (enteredView && hasNextPage && !isFetching && !skipAutoLoadRef.current) fetchNextPage(); 11350 }, [ 11351 inViewport, 11352 hasNextPage, 11353 isFetching 11354 ]); 11355 const handleHideActivities = () => { 11356 trackMethodCall("handleHideActivities", []);
11357 dispatch(closeNestedSheet()); 11358 }; 11359 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sheet, { 11360 open: isOpen, 11361 modal: false, 11362 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SheetContent, { 11363 "data-source-width": sourceRect?.width, 11364 className: "w-162.5 data-[state=open]:right-[attr(data-source-width_px)] sm:max-w-162.5", 11365 showCloseButton: false, 11366 disableAnimation: true, 11367 children: [ 11368 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetTitle, { 11369 className: "sr-only", 11370 children: "Activities" 11371 }), 11372 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetDescription, { 11373 className: "sr-only", 11374 children: "Activities for the call." 11375 }), 11376 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spin, { 11377 spinning: isGetContactLoading || isLoading || isFetching && !isFetchingNextPage, 11378 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 11379 className: "flex size-full flex-col", 11380 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { 11381 className: "flex h-14 shrink-0 items-center justify-between border-b border-border px-6", 11382 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 11383 className: "flex items-center gap-2", 11384 children: [ 11385 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 11386 className: "text-base font-semibold text-foreground", 11387 children: basicInfo.name 11388 }),
11389 !basicInfo.hasContactPermission && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 11390 asChild: true, 11391 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleAlert, { className: "size-4 text-pending" }) 11392 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "You do not have permission to view this contact information." }) })] }), 11393 basicInfo.role && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 11394 variant: "neutral-subtle", 11395 className: "h-4.5 rounded-full bg-[#F2F4F6] capitalize", 11396 children: basicInfo.role 11397 }) 11398 ] 11399 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 11400 type: "button", 11401 onClick: handleHideActivities, 11402 variant: "ghost", 11403 className: "text-xs text-primary hover:bg-primary-muted hover:text-primary", 11404 children: "Hide Activities" 11405 })] 11406 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { 11407 className: "flex flex-1 overflow-hidden", 11408 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("aside", { 11409 "aria-label": "contact information", 11410 className: "w-62.5 shrink-0 overflow-y-auto border-r border-border px-6 py-5", 11411 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 11412 className: "flex flex-col gap-2", 11413 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { 11414 className: "border-b border-border pb-2 text-sm font-semibold text-foreground", 11415 children: "Basic info" 11416 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 11417 className: "flex flex-col gap-2", 11418 children: [ 11419 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 11420 className: "flex flex-col", 11421 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 11422 className: "text-xs text-muted-foreground", 11423 children: "Phone" 11424 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 11425 className: "text-xs font-medium text-foreground", 11426 children: phone ? formatPhone(phone, "parentheses") : EMPTY_VALUE 11427 })] 11428 }), 11429 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 11430 className: "flex min-w-0 flex-col", 11431 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 11432 className: "text-xs text-muted-foreground", 11433 children: "Email" 11434 }), !isDisabledLoadContact && contactData.email ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 11435 asChild: true, 11436 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 11437 className: "truncate text-xs font-medium text-foreground", 11438 children: contactData.email 11439 }) 11440 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { 11441 className: "max-w-75 break-all", 11442 children: contactData.email 11443 })] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 11444 className: "text-xs font-medium text-foreground", 11445 children: EMPTY_VALUE 11446 })] 11447 }), 11448 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 11449 className: "flex flex-col", 11450 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 11451 className: "text-xs text-muted-foreground", 11452 children: "Company Name" 11453 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 11454 className: "text-xs font-medium text-foreground", 11455 children: contactData.companyName ?? EMPTY_VALUE 11456 })] 11457 }), 11458 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 11459 className: "flex flex-col", 11460 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 11461 className: "text-xs text-muted-foreground", 11462 children: "Company Phone" 11463 }
11463), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 11464 className: "text-xs font-medium text-foreground", 11465 children: contactData.companyPhone ? formatPhone(normalizePhone(contactData.companyPhone), "parentheses") : EMPTY_VALUE 11466 })] 11467 }) 11468 ] 11469 })] 11470 }), SHOW_RECENT_LOADS] 11471 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("aside", { 11472 "aria-label": "activities", 11473 className: "flex flex-1 flex-col overflow-y-auto", 11474 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 11475 "aria-label": "filler", 11476 className: "flex flex-wrap items-center gap-2 border-b border-border px-6 py-3", 11477 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select, { 11478 value: filters.type.length > 1 ? "all" : filters.type[0], 11479 onValueChange: (value) => { 11480 return setFilters({ 11481 ...filters, 11482 type: value === "all" ? [ 11483 "inBound", 11484 "outBound", 11485 "missed" 11486 ] : [value] 11487 }); 11488 }, 11489 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectTrigger, { 11490 className: "flex-1", 11491 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectValue, { placeholder: "All" }) 11492 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SelectContent, { children: [ 11493 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, { 11494 value: "all", 11495 children: "All" 11496 }), 11497 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, { 11498 value: "inBound", 11499 children: "Inbound" 11500 }), 11501 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, { 11502 value: "outBound", 11503 children: "Outbound" 11504 }), 11505 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, { 11506 value: "missed", 11507 children: "Missed Call" 11508 }) 11509 ] })] 11510 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DatePicker, { 11511 className: "w-50", 11512 mode: "range", 11513 placeholder: "Date", 11514 numberOfMonths: 2, 11515 selected: filters.date, 11516 onSelect: (dateRange) => { 11517 return setFilters({ 11518 ...filters, 11519 date: dateRange 11520 }); 11521 } 11522 })] 11523 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 11524 ref: listScrollRef, 11525 onScroll: () => { 11526 if (isAutoScrollingRef.current) { 11527 isAutoScrollingRef.current = false; 11528 return; 11529 } 11530 skipAutoLoadRef.current = false; 11531 }, 11532 className: cn("flex-1 px-6 py-2", groupedActivities.length > 0 ? "overflow-y-auto" : "overflow-hidden"), 11533 children: groupedActivities.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 11534 className: "flex flex-col gap-6", 11535 children: groupedActivities.map((group) => { 11536 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 11537 className: "mb-4 text-sm font-semibold text-foreground", 11538 children: group.label 11539 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 11540 className: "flex flex-col gap-4", 11541 children: group.activities.map((activity) => { 11542 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(activity_item_default, { activity }
11542), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 11543 className: "flex w-full gap-4 last:hidden", 11544 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Separator, { className: "invisible h-px w-9!" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Separator, { className: "h-px flex-1 bg-border" })] 11545 })] }, `${group.id}-${activity.id}`); 11546 }) 11547 })] }, group.id); 11548 }) 11549 }), isFetchingNextPage ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 11550 className: "flex w-full items-center justify-center py-5", 11551 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { className: "size-5 text-muted-foreground" }) 11552 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 11553 ref: loadMoreRef, 11554 className: "flex w-full items-center justify-center py-5", 11555 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 11556 className: "text-sm text-muted-foreground", 11557 children: "No more data" 11558 }) 11559 })] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RecentLoadsEmpty, { className: "mt-0" }) 11560 })] 11561 })] 11562 })] 11563 }) 11564 }) 11565 ] 11566 }) 11567 }); 11568} 11569function RecentLoadsEmpty(t0) { 11570 const $ = (0, import_compiler_runtime$106.c)(6); 11571 const { className } = t0; 11572 let t1; 11573 if ($[0] !== className) { 11574 t1 = cn("mt-5 h-full gap-1 p-0!", className); 11575 $[0] = className; 11576 $[1] = t1; 11577 } else t1 = $[1]; 11578 let t2; 11579 if ($[2] === Symbol.for("react.memo_cache_sentinel")) { 11580 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyMedia, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 11581 name: "no-result-match", 11582 className: "size-17.5" 11583 }) }); 11584 $[2] = t2; 11585 } else t2 = $[2]; 11586 let t3; 11587 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 11588 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyTitle, { 11589 className: "text-xs text-muted-foreground", 11590 children: "No results matched this search. Please try a different search criteria." 11591 }) }); 11592 $[3] = t3; 11593 } else t3 = $[3]; 11594 let t4; 11595 if ($[4] !== t1) { 11596 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Empty, { 11597 className: t1, 11598 children: [t2, t3] 11599 }); 11600 $[4] = t1; 11601 $[5] = t4; 11602 } else t4 = $[5]; 11603 return t4; 11604} 11605var dialer_activities_sheet_default = DialerActivitiesSheet; 11606var import_compiler_runtime$105 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 11607var fieldVariants = cva("group/field flex w-full gap-2 data-[invalid=true]:text-destructive", { 11608 variants: { orientation: { 11609 vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"], 11610 horizontal: [ 11611 "flex-row items-center", 11612 "[&>[data-slot=field-label]]:flex-auto", 11613 "has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px" 11614 ], 11615 responsive: [ 11616 "flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto", 11617 "@md/field-group:[&>[data-slot=field-label]]:flex-auto", 11618 "@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px" 11619 ] 11620 } }, 11621 defaultVariants: { orientation: "vertical" } 11622}); 11623function Field(t0) { 11624 const $ = (0, import_compiler_runtime$105.c)(11); 11625 let className; 11626 let props; 11627 let t1; 11628 if ($[0] !== t0) { 11629 ({className, orientation: t1, ...props} = t0); 11630 $[0] = t0; 11631 $[1] = className; 11632 $[2] = props; 11633 $[3] = t1; 11634 } else { 11635 className = $[1]; 11636 props = $[2]; 11637 t1 = $[3]; 11638 } 11639 const orientation = t1 === void 0 ? "vertical" : t1; 11640 let t2; 11641 if ($[4] !== className || $[5] !== orientation) { 11642 t2 = cn(fieldVariants({ orientation }), className); 11643 $[4] = className; 11644 $[5] = orientation; 11645 $[6] = t2; 11646 } else t2 = $[6]; 11647 let t3; 11648 if ($[7] !== orientation || $[8] !== props || $[9] !== t2) { 11649 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 11650 role: "group", 11651 "data-slot": "field", 11652 "data-orientation": orientation, 11653 className: t2, 11654 ...props 11655 }); 11656 $[7] = orientation; 11657 $[8] = props; 11658 $[9] = t2; 11659 $[10] = t3; 11660 } else t3 = $[10]; 11661 return t3; 11662} 11663function FieldLabel(t0) { 11664 const $ = (0, import_compiler_runtime$105.c)(8); 11665 let className; 11666 let props; 11667 if ($[0] !== t0) { 11668 ({className, ...props} = t0); 11669 $[0] = t0; 11670 $[1] = className; 11671 $[2] = props; 11672 } else { 11673 className = $[1]; 11674 props = $[2]; 11675 } 11676 let t1; 11677 if ($[3] !== className) { 11678 t1 = cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4", "has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10", "group-data-[required=true]/field:after:-ml-2 group-data-[required=true]/field:after:text-destructive group-data-[required=true]/field:after:content-[\"*\"]", className); 11679 $[3] = className; 11680 $[4] = t1; 11681 } else t1 = $[4]; 11682 let t2; 11683 if ($[5] !== props || $[6] !== t1) { 11684 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, { 11685 "data-slot": "field-label", 11686 className: t1, 11687 ...props 11688 }); 11689 $[5] = props; 11690 $[6] = t1; 11691 $[7] = t2; 11692 } else t2 = $[7]; 11693 return t2; 11694}
11695function FieldDescription(t0) { 11696 const $ = (0, import_compiler_runtime$105.c)(8); 11697 let className; 11698 let props; 11699 if ($[0] !== t0) { 11700 ({className, ...props} = t0); 11701 $[0] = t0; 11702 $[1] = className; 11703 $[2] = props; 11704 } else { 11705 className = $[1]; 11706 props = $[2]; 11707 } 11708 let t1; 11709 if ($[3] !== className) { 11710 t1 = cn("text-sm leading-normal font-normal text-muted-foreground group-has-[[data-orientation=horizontal]]/field:text-balance", "last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5", "[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", className); 11711 $[3] = className; 11712 $[4] = t1; 11713 } else t1 = $[4]; 11714 let t2; 11715 if ($[5] !== props || $[6] !== t1) { 11716 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 11717 "data-slot": "field-description", 11718 className: t1, 11719 ...props 11720 }); 11721 $[5] = props; 11722 $[6] = t1; 11723 $[7] = t2; 11724 } else t2 = $[7]; 11725 return t2; 11726} 11727function FieldError(t0) { 11728 const $ = (0, import_compiler_runtime$105.c)(15); 11729 let children; 11730 let className; 11731 let errors; 11732 let props; 11733 if ($[0] !== t0) { 11734 ({className, children, errors, ...props} = t0); 11735 $[0] = t0; 11736 $[1] = children; 11737 $[2] = className; 11738 $[3] = errors; 11739 $[4] = props; 11740 } else { 11741 children = $[1]; 11742 className = $[2]; 11743 errors = $[3]; 11744 props = $[4]; 11745 } 11746 let t1; 11747 bb0: { 11748 if (children) { 11749 t1 = children; 11750 break bb0; 11751 } 11752 if (!errors?.length) { 11753 t1 = null; 11754 break bb0; 11755 } 11756 let t2$1; 11757 if ($[5] !== errors) { 11758 t2$1 = [...new Map(errors.map(_temp$23)).values()]; 11759 $[5] = errors; 11760 $[6] = t2$1; 11761 } else t2$1 = $[6]; 11762 const uniqueErrors = t2$1; 11763 if (uniqueErrors?.length == 1) { 11764 t1 = uniqueErrors[0]?.message; 11765 break bb0; 11766 } 11767 let t3$1; 11768 if ($[7] !== uniqueErrors) { 11769 t3$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { 11770 className: "ml-4 flex list-disc flex-col gap-1", 11771 children: uniqueErrors.map(_temp2$13) 11772 }); 11773 $[7] = uniqueErrors; 11774 $[8] = t3$1; 11775 } else t3$1 = $[8]; 11776 t1 = t3$1; 11777 } 11778 const content = t1; 11779 if (!content) return null; 11780 let t2; 11781 if ($[9] !== className) { 11782 t2 = cn("text-sm font-normal text-destructive", className); 11783 $[9] = className; 11784 $[10] = t2; 11785 } else t2 = $[10]; 11786 let t3; 11787 if ($[11] !== content || $[12] !== props || $[13] !== t2) { 11788 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 11789 role: "alert", 11790 "data-slot": "field-error", 11791 className: t2, 11792 ...props, 11793 children: content 11794 }); 11795 $[11] = content; 11796 $[12] = props; 11797 $[13] = t2; 11798 $[14] = t3; 11799 } else t3 = $[14]; 11800 return t3; 11801} 11802function _temp2$13(error_0, index) { 11803 return error_0?.message && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: error_0.message }, index); 11804} 11805function _temp$23(error) { 11806 return [error?.message, error]; 11807} 11808var import_compiler_runtime$104 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 11809var FormWrapper = (t0) => { 11810 const $ = (0, import_compiler_runtime$104.c)(12); 11811 let children; 11812 let className; 11813 let form; 11814 let props; 11815 if ($[0] !== t0) { 11816 ({form, children, className, ...props} = t0); 11817 $[0] = t0; 11818 $[1] = children; 11819 $[2] = className; 11820 $[3] = form; 11821 $[4] = props; 11822 } else { 11823 children = $[1]; 11824 className = $[2]; 11825 form = $[3]; 11826 props = $[4]; 11827 } 11828 let t1; 11829 if ($[5] !== children || $[6] !== className || $[7] !== props) { 11830 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { 11831 noValidate: true, 11832 className, 11833 ...props, 11834 children 11835 }); 11836 $[5] = children; 11837 $[6] = className; 11838 $[7] = props; 11839 $[8] = t1; 11840 } else t1 = $[8]; 11841 let t2; 11842 if ($[9] !== form || $[10] !== t1) { 11843 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormProvider, { 11844 ...form, 11845 children: t1 11846 }); 11847 $[9] = form; 11848 $[10] = t1; 11849 $[11] = t2; 11850 } else t2 = $[11]; 11851 return t2; 11852}; 11853var FormItem = (t0) => { 11854 const $ = (0, import_compiler_runtime$104.c)(18); 11855 let description; 11856 let hideErrorUntilTouched; 11857 let id; 11858 let props; 11859 let render; 11860 let required; 11861 let title; 11862 if ($[0] !== t0) { 11863 ({id, title, description, required, render, hideErrorUntilTouched, ...props} = t0); 11864 $[0] = t0; 11865 $[1] = description; 11866 $[2] = hideErrorUntilTouched; 11867 $[3] = id; 11868 $[4] = props; 11869 $[5] = render; 11870 $[6] = required; 11871 $[7] = title; 11872 } else { 11873 description = $[1]; 11874 hideErrorUntilTouched = $[2]; 11875 id = $[3]; 11876 props = $[4]; 11877 render = $[5]; 11878 required = $[6]; 11879 title = $[7]; 11880 } 11881 let t1; 11882 if ($[8] !== description || $[9] !== hideErrorUntilTouched || $[10] !== id || $[11] !== render || $[12] !== required || $[13] !== title) { 11883 t1 = (t2$1) => { 11884 const { field, fieldState, formState } = t2$1; 11885 const { invalid, error, isTouched } = fieldState; 11886 const shouldHide = typeof hideErrorUntilTouched === "function" ? hideErrorUntilTouched(fieldState, field.value) : Boolean(hideErrorUntilTouched) && !isTouched; 11887 const showError = invalid && !!error?.message && !shouldHide; 11888 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Field, { 11889 "data-invalid": showError, 11890 "data-disabled": field.disabled, 11891 "data-required": required, 11892 children: [
11893 title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldLabel, { 11894 htmlFor: id, 11895 children: title 11896 }), 11897 render({ 11898 field, 11899 fieldState, 11900 formState 11901 }), 11902 showError ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldError, { errors: [error] }) : description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldDescription, { children: description }) 11903 ] 11904 }); 11905 }; 11906 $[8] = description; 11907 $[9] = hideErrorUntilTouched; 11908 $[10] = id; 11909 $[11] = render; 11910 $[12] = required; 11911 $[13] = title; 11912 $[14] = t1; 11913 } else t1 = $[14]; 11914 let t2; 11915 if ($[15] !== props || $[16] !== t1) { 11916 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Controller, { 11917 ...props, 11918 render: t1 11919 }); 11920 $[15] = props; 11921 $[16] = t1; 11922 $[17] = t2; 11923 } else t2 = $[17]; 11924 return t2; 11925}; 11926var import_compiler_runtime$103 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 11927function Textarea(t0) { 11928 const $ = (0, import_compiler_runtime$103.c)(8); 11929 let className; 11930 let props; 11931 if ($[0] !== t0) { 11932 ({className, ...props} = t0); 11933 $[0] = t0; 11934 $[1] = className; 11935 $[2] = props; 11936 } else { 11937 className = $[1]; 11938 props = $[2]; 11939 } 11940 let t1; 11941 if ($[3] !== className) { 11942 t1 = cn("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/20 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40", className); 11943 $[3] = className; 11944 $[4] = t1; 11945 } else t1 = $[4]; 11946 let t2; 11947 if ($[5] !== props || $[6] !== t1) { 11948 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", { 11949 "data-slot": "textarea", 11950 className: t1, 11951 ...props 11952 }); 11953 $[5] = props; 11954 $[6] = t1; 11955 $[7] = t2; 11956 } else t2 = $[7]; 11957 return t2; 11958} 11959var import_compiler_runtime$102 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 11960var useFormProps = (props) => { 11961 const $ = (0, import_compiler_runtime$102.c)(27); 11962 let description; 11963 let disabled; 11964 let id; 11965 let name; 11966 let required; 11967 let rest; 11968 let rules; 11969 let shouldUnregister; 11970 let title; 11971 if ($[0] !== props) { 11972 ({id, name, title, description, required, rules, shouldUnregister, disabled, ...rest} = props); 11973 $[0] = props; 11974 $[1] = description; 11975 $[2] = disabled; 11976 $[3] = id; 11977 $[4] = name; 11978 $[5] = required; 11979 $[6] = rest; 11980 $[7] = rules; 11981 $[8] = shouldUnregister; 11982 $[9] = title; 11983 } else { 11984 description = $[1]; 11985 disabled = $[2]; 11986 id = $[3]; 11987 name = $[4]; 11988 required = $[5]; 11989 rest = $[6]; 11990 rules = $[7]; 11991 shouldUnregister = $[8]; 11992 title = $[9]; 11993 } 11994 const generatedId = `form-item-${(0, import_react.useId)()}`; 11995 const innerId = id ?? generatedId; 11996 let t0; 11997 if ($[10] !== description || $[11] !== disabled || $[12] !== innerId || $[13] !== name || $[14] !== required || $[15] !== rules || $[16] !== shouldUnregister || $[17] !== title) { 11998 t0 = { 11999 id: innerId, 12000 name, 12001 required, 12002 disabled, 12003 title, 12004 description, 12005 rules, 12006 shouldUnregister 12007 }; 12008 $[10] = description; 12009 $[11] = disabled; 12010 $[12] = innerId; 12011 $[13] = name; 12012 $[14] = required; 12013 $[15] = rules; 12014 $[16] = shouldUnregister; 12015 $[17] = title; 12016 $[18] = t0; 12017 } else t0 = $[18]; 12018 const formItemProps = t0; 12019 const t1 = rest; 12020 let t2; 12021 if ($[19] !== disabled || $[20] !== innerId || $[21] !== required || $[22] !== t1) { 12022 t2 = { 12023 id: innerId, 12024 required, 12025 disabled, 12026 ...t1 12027 }; 12028 $[19] = disabled; 12029 $[20] = innerId; 12030 $[21] = required; 12031 $[22] = t1; 12032 $[23] = t2; 12033 } else t2 = $[23]; 12034 const fieldProps = t2; 12035 let t3; 12036 if ($[24] !== fieldProps || $[25] !== formItemProps) { 12037 t3 = { 12038 formItemProps, 12039 fieldProps 12040 }; 12041 $[24] = fieldProps; 12042 $[25] = formItemProps; 12043 $[26] = t3; 12044 } else t3 = $[26]; 12045 return t3; 12046}; 12047var import_compiler_runtime$101 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 12048var TextareaField = (props) => { 12049 const $ = (0, import_compiler_runtime$101.c)(5); 12050 const { formItemProps, fieldProps } = useFormProps(props); 12051 let t0; 12052 if ($[0] !== fieldProps) { 12053 t0 = (t1$1) => { 12054 const { field, fieldState } = t1$1; 12055 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Textarea, {
12056 "aria-invalid": fieldState.invalid, 12057 ...field, 12058 ...fieldProps 12059 }); 12060 }; 12061 $[0] = fieldProps; 12062 $[1] = t0; 12063 } else t0 = $[1]; 12064 let t1; 12065 if ($[2] !== formItemProps || $[3] !== t0) { 12066 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, { 12067 ...formItemProps, 12068 render: t0 12069 }); 12070 $[2] = formItemProps; 12071 $[3] = t0; 12072 $[4] = t1; 12073 } else t1 = $[4]; 12074 return t1; 12075}; 12076var import_compiler_runtime$100 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 12077var selectInputVariants = T({ 12078 base: [ 12079 "h-9 w-full min-w-0 truncate rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs transition-[color,box-shadow] outline-none", 12080 "disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50", 12081 "md:text-sm dark:bg-input/30", 12082 "placeholder:text-muted-foreground" 12083 ], 12084 variants: { size: { 12085 sm: "h-8 py-1.5", 12086 default: "h-9 py-2" 12087 } } 12088}); 12089const SelectInput = import_react.forwardRef((t0, ref) => { 12090 const $ = (0, import_compiler_runtime$100.c)(37); 12091 const { options, value, onChange, placeholder: t1, disabled: t2, className, comboboxClassName, error: t3, name, onQueryChange, prefixIcon, loading, busy, optionsClassName, size: t4, id, "aria-describedby": ariaDescribedBy, defaultOptions, anchor, clearIcon: t5 } = t0; 12092 const placeholder = t1 === void 0 ? "Search or select an option" : t1; 12093 const disabled = t2 === void 0 ? false : t2; 12094 const error = t3 === void 0 ? false : t3; 12095 const size = t4 === void 0 ? "default" : t4; 12096 const ClearIcon = t5 === void 0 ? X : t5; 12097 const [query, setQuery] = import_react.useState(""); 12098 let t6; 12099 if ($[0] !== query) { 12100 t6 = query.trim(); 12101 $[0] = query; 12102 $[1] = t6; 12103 } else t6 = $[1]; 12104 const isQueryEmpty = t6 === ""; 12105 const hasDefaultOptions = Boolean(defaultOptions?.length); 12106 let t7; 12107 if ($[2] !== defaultOptions || $[3] !== isQueryEmpty || $[4] !== options) { 12108 t7 = isQueryEmpty ? defaultOptions ?? [] : options; 12109 $[2] = defaultOptions; 12110 $[3] = isQueryEmpty; 12111 $[4] = options; 12112 $[5] = t7; 12113 } else t7 = $[5]; 12114 const filteredOptions = t7; 12115 const showsOptions = !isQueryEmpty || hasDefaultOptions; 12116 let t8; 12117 if ($[6] !== onQueryChange) { 12118 t8 = (event) => { 12119 const newQuery = event.target.value; 12120 setQuery(newQuery); 12121 onQueryChange?.(newQuery); 12122 }; 12123 $[6] = onQueryChange; 12124 $[7] = t8; 12125 } else t8 = $[7]; 12126 const handleQueryChange = t8; 12127 let t9; 12128 if ($[8] !== ClearIcon || $[9] !== anchor || $[10] !== ariaDescribedBy || $[11] !== busy || $[12] !== className || $[13] !== comboboxClassName || $[14] !== error || $[15] !== filteredOptions || $[16] !== handleQueryChange || $[17] !== id || $[18] !== loading || $[19] !== onChange || $[20] !== options || $[21] !== optionsClassName || $[22] !== placeholder || $[23] !== prefixIcon || $[24] !== query || $[25] !== ref || $[26] !== showsOptions || $[27] !== size || $[28] !== value) { 12129 t9 = (t10$1) => { 12130 const { open } = t10$1; 12131 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 12132 className: cn("relative", className), 12133 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 12134 className: "relative", 12135 children: [
12136 prefixIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 12137 className: "pointer-events-none absolute flex h-full items-center pl-3", 12138 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 12139 className: "flex size-4 items-center", 12140 children: prefixIcon 12141 }) 12142 }), 12143 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ko, { 12144 ref, 12145 id, 12146 "aria-invalid": error || void 0, 12147 "aria-describedby": ariaDescribedBy, 12148 className: cn(selectInputVariants({ size }), prefixIcon && "pl-8", value && "pr-10", error ? "border-destructive focus-visible:border-destructive focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40" : "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/20", open && "border-ring ring-[3px] ring-ring/20", comboboxClassName), 12149 displayValue: (value_0) => { 12150 return (options?.find((opt) => opt.value === value_0))?.label || value_0 || ""; 12151 }, 12152 onChange: handleQueryChange, 12153 placeholder 12154 }), 12155 busy ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 12156 role: "status", 12157 "aria-label": "Loading selection", 12158 className: "absolute inset-y-0 right-0 flex items-center pr-3", 12159 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { className: "size-4 text-muted-foreground" }) 12160 }) : value && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { 12161 type: "button", 12162 className: "absolute inset-y-0 right-0 flex items-center pr-3", 12163 onClick: (e$4) => { 12164 e$4.stopPropagation(); 12165 onChange?.(null); 12166 }, 12167 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClearIcon, { 12168 className: "h-4 w-4 text-muted-foreground transition-colors hover:text-foreground", 12169 "aria-hidden": "true" 12170 }) 12171 }) 12172 ] 12173 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Uo, { 12174 anchor, 12175 className: cn("z-50 overflow-auto rounded-lg", anchor ? "w-(--in
12175put-width) [--anchor-gap:4px]" : "absolute mt-1 w-full", "border border-input bg-popover text-popover-foreground shadow-lg", "focus:outline-none", "animate-in fade-in-0 zoom-in-95", "p-1.5", "empty:invisible", optionsClassName), 12176 children: [ 12177 loading && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 12178 className: "flex h-full items-center justify-center gap-2", 12179 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { className: "size-6 text-primary" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 12180 className: "text-sm font-medium text-foreground", 12181 children: "Loading..." 12182 })] 12183 }), 12184 !loading && filteredOptions.length === 0 && query !== "" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 12185 className: "relative cursor-default px-4 py-2 text-muted-foreground select-none", 12186 children: "No results found." 12187 }), 12188 !loading && filteredOptions.length > 0 && showsOptions && filteredOptions.map(_temp$22) 12189 ] 12190 })] 12191 }); 12192 }; 12193 $[8] = ClearIcon; 12194 $[9] = anchor; 12195 $[10] = ariaDescribedBy; 12196 $[11] = busy; 12197 $[12] = className; 12198 $[13] = comboboxClassName; 12199 $[14] = error; 12200 $[15] = filteredOptions; 12201 $[16] = handleQueryChange; 12202 $[17] = id; 12203 $[18] = loading; 12204 $[19] = onChange; 12205 $[20] = options; 12206 $[21] = optionsClassName; 12207 $[22] = placeholder; 12208 $[23] = prefixIcon; 12209 $[24] = query; 12210 $[25] = ref; 12211 $[26] = showsOptions; 12212 $[27] = size; 12213 $[28] = value; 12214 $[29] = t9; 12215 } else t9 = $[29]; 12216 let t10; 12217 if ($[30] !== disabled || $[31] !== hasDefaultOptions || $[32] !== name || $[33] !== onChange || $[34] !== t9 || $[35] !== value) { 12218 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Ht, { 12219 value, 12220 onChange, 12221 disabled, 12222 name, 12223 immediate: hasDefaultOptions, 12224 children: t9 12225 }); 12226 $[30] = disabled; 12227 $[31] = hasDefaultOptions; 12228 $[32] = name; 12229 $[33] = onChange; 12230 $[34] = t9; 12231 $[35] = value; 12232 $[36] = t10; 12233 } else t10 = $[36]; 12234 return t10; 12235}); 12236SelectInput.displayName = "SelectInput"; 12237var multiSelectInputVariants = T({ 12238 base: [ 12239 "w-full min-w-0 rounded-md border border-input bg-transparent px-3 text-sm shadow-xs transition-[color,box-shadow] outline-none", 12240 "pr-10", 12241 "disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50", 12242 "md:text-sm dark:bg-input/30", 12243 "placeholder:text-muted-foreground" 12244 ], 12245 variants: { size: { 12246 sm: "h-8 py-1.5", 12247 default: "h-9 py-2" 12248 } } 12249}); 12250const MultiSelectInput = import_react.forwardRef((t0, ref) => { 12251 const $ = (0, import_compiler_runtime$100.c)(32); 12252 const { options, value: t1, onChange, placeholder: t2, disabled: t3, className, error: t4, name, onQueryChange, size: t5, id, immediate, emptyMessage: t6 } = t0; 12253 let t7; 12254 if ($[0] !== t1) { 12255 t7 = t1 === void 0 ? [] : t1; 12256 $[0] = t1; 12257 $[1] = t7; 12258 } else t7 = $[1]; 12259 const value = t7; 12260 const placeholder = t2 === void 0 ? "Search or select options" : t2; 12261 const disabled = t3 === void 0 ? false : t3; 12262 const error = t4 === void 0 ? false : t4; 12263 const size = t5 === void 0 ? "default" : t5; 12264 const emptyMessage = t6 === void 0 ? "No results found." : t6; 12265 const [query, setQuery] = import_react.useState(""); 12266 let t8; 12267 if ($[2] !== options || $[3] !== query) { 12268 t8 = query === "" ? options : options.filter((option) => { 12269 return (option.searchLabel || option.label).toLowerCase().includes(query.toLowerCase()); 12270 }); 12271 $[2] = options; 12272 $[3] = query; 12273 $[4] = t8; 12274 } else t8 = $[4]; 12275 const filteredOptions = t8; 12276 let t9; 12277 if ($[5] !== onQueryChange) { 12278 t9 = (event) => { 12279 const newQuery = event.target.value; 12280 setQuery(newQuery); 12281 onQueryChange?.(newQuery); 12282 }; 12283 $[5] = onQueryChange; 12284 $[6] = t9; 12285 } else t9 = $[6]; 12286 const handleQueryChange = t9; 12287 let t10; 12288 if ($[7] !== options || $[8] !== value) { 12289 let t11$1; 12290 if ($[10] !== value) { 12291 t11$1 = (opt) => value.includes(opt.value); 12292 $[10] = value; 12293 $[11] = t11$1; 12294 } else t11$1 = $[11]; 12295 t10 = options.filter(t11$1); 12296 $[7] = options; 12297 $[8] = value; 12298 $[9] = t10; 12299 } else t10 = $[9]; 12300 const selectedOptions = t10; 12301 let t11; 12302 if ($[12] !== className || $[13] !== emptyMessage || $[14] !== error || $[15] !== filteredOptions || $[16] !== handleQueryChange || $[17] !== id || $[18] !== onChange || $[19] !== placeholder || $[20] !== ref || $[21] !== selectedOptions || $[22] !== size || $[23] !== value.length) { 12303 t11 = (t12$1) => { 12304 const { open } = t12$1; 12305 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 12306 className: cn("relative", className), 12307 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 12308 className: "relative", 12309 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ko, { 12310 ref, 12311 id, 12312 className: cn(multiSelectInputVariants({ size }), error ? "border-destructive focus-visible:border-destructive focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40" : "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/20", open && "border-ring ring-[3px] ring-ring/20"), 12313 displayValue: () => { 12314 if (selectedOptions.length === 0) return ""; 12315 return selectedOptions.map(_temp2$12).join(", "); 12316 }, 12317 onChange: handleQueryChange, 12318 placeholder 12319 }), value.length >
12319 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { 12320 type: "button", 12321 className: "absolute inset-y-0 right-0 flex items-center pr-3", 12322 onClick: (e$4) => { 12323 e$4.stopPropagation(); 12324 onChange?.([]); 12325 }, 12326 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { 12327 className: "h-4 w-4 text-muted-foreground transition-colors hover:text-foreground", 12328 "aria-hidden": "true" 12329 }) 12330 })] 12331 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Uo, { 12332 className: cn("absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg", "border border-input bg-popover text-popover-foreground shadow-lg", "focus:outline-none", "animate-in fade-in-0 zoom-in-95", "p-1.5"), 12333 children: filteredOptions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 12334 className: "relative cursor-default px-4 py-2 text-sm text-muted-foreground select-none", 12335 children: emptyMessage 12336 }) : filteredOptions.map(_temp3$4) 12337 })] 12338 }); 12339 }; 12340 $[12] = className; 12341 $[13] = emptyMessage; 12342 $[14] = error; 12343 $[15] = filteredOptions; 12344 $[16] = handleQueryChange; 12345 $[17] = id; 12346 $[18] = onChange; 12347 $[19] = placeholder; 12348 $[20] = ref; 12349 $[21] = selectedOptions; 12350 $[22] = size; 12351 $[23] = value.length; 12352 $[24] = t11; 12353 } else t11 = $[24]; 12354 let t12; 12355 if ($[25] !== disabled || $[26] !== immediate || $[27] !== name || $[28] !== onChange || $[29] !== t11 || $[30] !== value) { 12356 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Ht, { 12357 value, 12358 onChange, 12359 disabled, 12360 name, 12361 multiple: true, 12362 immediate, 12363 children: t11 12364 }); 12365 $[25] = disabled; 12366 $[26] = immediate;
12367 $[27] = name; 12368 $[28] = onChange; 12369 $[29] = t11; 12370 $[30] = value; 12371 $[31] = t12; 12372 } else t12 = $[31]; 12373 return t12; 12374}); 12375MultiSelectInput.displayName = "MultiSelectInput"; 12376function _temp$22(option_0) { 12377 const displayContent = option_0.displayLabel ?? option_0.label; 12378 const isReactNode = import_react.isValidElement(displayContent) || typeof displayContent === "object"; 12379 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Ho, { 12380 value: option_0.value, 12381 disabled: option_0.disabled, 12382 className: (t0) => { 12383 const { focus, selected } = t0; 12384 return cn("relative cursor-default select-none", isReactNode ? "" : "py-2 pr-4 pl-10", focus && "bg-accent text-accent-foreground", !isReactNode && selected && "bg-accent/50", option_0.disabled && "cursor-not-allowed opacity-50", "rounded-md"); 12385 }, 12386 children: (t1) => { 12387 const { selected: selected_0 } = t1; 12388 return isReactNode ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: displayContent }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 12389 className: cn("block truncate", selected_0 && "font-medium"), 12390 children: displayContent 12391 }), selected_0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 12392 className: "absolute inset-y-0 left-0 flex items-center pl-3 text-primary", 12393 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { 12394 className: "h-4 w-4", 12395 "aria-hidden": "true" 12396 }) 12397 })] }); 12398 } 12399 }, option_0.value); 12400} 12401function _temp2$12(opt_0) { 12402 return opt_0.label; 12403} 12404function _temp3$4(option_0) { 12405 const displayContent = option_0.displayLabel ?? option_0.label; 12406 const isReactNode = import_react.isValidElement(displayContent) || typeof displayContent === "object"; 12407 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Ho, { 12408 value: option_0.value, 12409 disabled: option_0.disabled, 12410 className: (t0) => { 12411 const { focus, selected } = t0; 12412 return cn("relative cursor-default select-none", isReactNode ? "" : "py-2 pr-4 pl-10", focus && "bg-accent text-accent-foreground", !isReactNode && selected && "bg-accent/50", option_0.disabled && "cursor-not-allowed opacity-50", "rounded-md"); 12413 }, 12414 children: (t1) => { 12415 const { selected: selected_0 } = t1; 12416 return isReactNode ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: displayContent }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 12417 className: cn("block truncate", selected_0 && "font-medium"), 12418 children: displayContent 12419 }), selected_0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 12420 className: "absolute inset-y-0 left-0 flex items-center pl-3 text-primary", 12421 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { 12422 className: "h-4 w-4", 12423 "aria-hidden": "true" 12424 }) 12425 })] }); 12426 } 12427 }, option_0.value); 12428} 12429var import_compiler_runtime$99 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 12430function RatingInput(t0) { 12431 const $ = (0, import_compiler_runtime$99.c)(5); 12432 const { value, onChange } = t0; 12433 const [hoveredRating, setHoveredRating] = (0, import_react.useState)(0); 12434 let t1; 12435 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 12436 t1 = [ 12437 1, 12438 2, 12439 3, 12440 4, 12441 5 12442 ]; 12443 $[0] = t1; 12444 } else t1 = $[0]; 12445 let t2; 12446 if ($[1] !== hoveredRating || $[2] !== onChange || $[3] !== value) { 12447 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 12448 className: "flex items-center gap-2", 12449 children: t1.map((star) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 12450 type: "button", 12451 variant: "ghost", 12452 size: "icon-sm", 12453 onClick: () => onChange(star), 12454 onMouseEnter: () => setHoveredRating(star), 12455 onMouseLeave: () => setHoveredRating(0), 12456 "aria-label": `Rate ${star} stars`, 12457 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Star, { className: cn("size-4 transition-colors", (hoveredRating >= star || value >= star) && hoveredRating !== 0 ? "fill-yellow-400 text-yellow-400" : value >= star ? "fill-yellow-400 text-yellow-400" : "text-slate-400") }) 12458 }, star)) 12459 }); 12460 $[1] = hoveredRating; 12461 $[2] = onChange; 12462 $[3] = value; 12463 $[4] = t2; 12464 } else t2 = $[4]; 12465 return t2; 12466} 12467var rating_input_default = RatingInput; 12468var import_compiler_runtime$98 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 12469var SelectField = (props) => { 12470 const $ = (0, import_compiler_runtime$98.c)(23); 12471 const { formItemProps, fieldProps } = useFormProps(props); 12472 let id; 12473 let onValueChange; 12474 let options; 12475 let placeholder; 12476 let restFieldProps; 12477 let selectContentProps; 12478 let selectItemProps; 12479 let selectTriggerProps; 12480 let selectValueProps; 12481 if ($[0] !== fieldProps) { 12482 ({id, placeholder, options, selectTriggerProps, selectItemProps, selectContentProps, selectValueProps, onValueChange, ...restFieldProps} = fieldProps); 12483 $[0] = fieldProps; 12484 $[1] = id; 12485 $[2] = onValueChange; 12486 $[3] = options; 12487 $[4] = placeholder; 12488 $[5] = restFieldProps; 12489 $[6] = selectContentProps; 12490 $[7] = selectItemProps; 12491 $[8] = selectTriggerProps; 12492 $[9] = selectValueProps; 12493 } else { 12494 id = $[1]; 12495 onValueChange = $[2]; 12496 options = $[3]; 12497 placeholder = $[4]; 12498 restFieldProps = $[5]; 12499 selectContentProps = $[6]; 12500 selectItemProps = $[7]; 12501 selectTriggerProps = $[8]; 12502 selectValueProps = $[9]; 12503 } 12504 let t0; 12505 if ($[10] !== id || $[11] !== onValueChange || $[12] !== options || $[13] !== placeholder || $[14] !== restFieldProps || $[15] !== selectContentProps || $[16] !== selectItemProps || $[17] !== selectTriggerProps || $[18] !== selectValueProps) { 12506 t0 = (t1$1) => { 12507 const { field: t2, fieldState } = t1$1; 12508 const { onChange,...field } = t2; 12509 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select, { 12510 onValueChange: (value) => { 12511 onChange(value); 12512 onValueChange?.(value); 12513 }, 12514 ...field, 12515 ...restFieldProps, 12516 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectTrigger, { 12517 id,
12518 "aria-invalid": fieldState.invalid, 12519 ...selectTriggerProps, 12520 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectValue, { 12521 placeholder, 12522 ...selectValueProps 12523 }) 12524 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContent, { 12525 ...selectContentProps, 12526 children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, { 12527 value: option.value, 12528 disabled: option.disabled, 12529 ...selectItemProps, 12530 children: option.label 12531 }, option.value)) 12532 })] 12533 }); 12534 }; 12535 $[10] = id; 12536 $[11] = onValueChange; 12537 $[12] = options; 12538 $[13] = placeholder; 12539 $[14] = restFieldProps; 12540 $[15] = selectContentProps; 12541 $[16] = selectItemProps; 12542 $[17] = selectTriggerProps; 12543 $[18] = selectValueProps; 12544 $[19] = t0; 12545 } else t0 = $[19]; 12546 let t1; 12547 if ($[20] !== formItemProps || $[21] !== t0) { 12548 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, { 12549 ...formItemProps, 12550 render: t0 12551 }); 12552 $[20] = formItemProps; 12553 $[21] = t0; 12554 $[22] = t1; 12555 } else t1 = $[22]; 12556 return t1; 12557}; 12558var import_compiler_runtime$97 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 12559var useInsertionEffect = import_react[" useInsertionEffect ".trim().toString()] || useLayoutEffect2; 12560function useControllableState(t0) { 12561 const $ = (0, import_compiler_runtime$97.c)(11); 12562 const { prop, defaultProp, onChange: t1 } = t0; 12563 const onChange = t1 === void 0 ? _temp$21 : t1; 12564 let t2; 12565 if ($[0] !== defaultProp || $[1] !== onChange) { 12566 t2 = { 12567 defaultProp, 12568 onChange 12569 }; 12570 $[0] = defaultProp; 12571 $[1] = onChange; 12572 $[2] = t2; 12573 } else t2 = $[2]; 12574 const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState(t2); 12575 const isControlled = prop !== void 0; 12576 const value = isControlled ? prop : uncontrolledProp; 12577 let t3; 12578 if ($[3] !== isControlled || $[4] !== onChangeRef || $[5] !== prop || $[6] !== setUncontrolledProp) { 12579 t3 = (nextValue) => { 12580 if (isControlled) { 12581 const value_0 = isFunction(nextValue) ? nextValue(prop) : nextValue; 12582 if (value_0 !== prop) onChangeRef.current?.(value_0); 12583 } else setUncontrolledProp(nextValue); 12584 }; 12585 $[3] = isControlled; 12586 $[4] = onChangeRef; 12587 $[5] = prop; 12588 $[6] = setUncontrolledProp; 12589 $[7] = t3; 12590 } else t3 = $[7]; 12591 const setValue = t3; 12592 let t4; 12593 if ($[8] !== setValue || $[9] !== value) { 12594 t4 = [value, setValue]; 12595 $[8] = setValue; 12596 $[9] = value; 12597 $[10] = t4; 12598 } else t4 = $[10]; 12599 return t4; 12600} 12601function _temp$21() {} 12602function useUncontrolledState(t0) { 12603 const $ = (0, import_compiler_runtime$97.c)(8); 12604 const { defaultProp, onChange } = t0; 12605 const [value, setValue] = import_react.useState(defaultProp); 12606 const prevValueRef = import_react.useRef(value); 12607 const onChangeRef = import_react.useRef(onChange); 12608 let t1; 12609 let t2; 12610 if ($[0] !== onChange) { 12611 t1 = () => { 12612 onChangeRef.current = onChange; 12613 }; 12614 t2 = [onChange]; 12615 $[0] = onChange; 12616 $[1] = t1; 12617 $[2] = t2; 12618 } else { 12619 t1 = $[1]; 12620 t2 = $[2]; 12621 } 12622 useInsertionEffect(t1, t2); 12623 let t3; 12624 let t4; 12625 if ($[3] !== value) { 12626 t3 = () => { 12627 if (prevValueRef.current !== value) { 12628 onChangeRef.current?.(value); 12629 prevValueRef.current = value; 12630 } 12631 }; 12632 t4 = [value, prevValueRef]; 12633 $[3] = value; 12634 $[4] = t3; 12635 $[5] = t4; 12636 } else { 12637 t3 = $[4]; 12638 t4 = $[5]; 12639 } 12640 import_react.useEffect(t3, t4); 12641 let t5; 12642 if ($[6] !== value) { 12643 t5 = [ 12644 value, 12645 setValue, 12646 onChangeRef 12647 ]; 12648 $[6] = value; 12649 $[7] = t5; 12650 } else t5 = $[7]; 12651 return t5; 12652} 12653var import_compiler_runtime$96 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 12654function DialerMultipleIdentities(t0) { 12655 const $ = (0, import_compiler_runtime$96.c)(41); 12656 let children; 12657 let className; 12658 let onSelectedContactChange; 12659 let props; 12660 let selectedContactProp; 12661 let t1; 12662 let t2; 12663 if ($[0] !== t0) { 12664 ({contacts: t1, selectedContact: selectedContactProp, onSelectedContactChange, className, children, optionLoading: t2, ...props} = t0); 12665 $[0] = t0; 12666 $[1] = children; 12667 $[2] = className; 12668 $[3] = onSelectedContactChange; 12669 $[4] = props; 12670 $[5] = selectedContactProp; 12671 $[6] = t1; 12672 $[7] = t2; 12673 } else { 12674 children = $[1]; 12675 className = $[2]; 12676 onSelectedContactChange = $[3]; 12677 props = $[4]; 12678 selectedContactProp = $[5]; 12679 t1 = $[6]; 12680 t2 = $[7]; 12681 } 12682 let t3; 12683 if ($[8] !== t1) { 12684 t3 = t1 === void 0 ? [] : t1; 12685 $[8] = t1; 12686 $[9] = t3; 12687 } else t3 = $[9]; 12688 const contacts = t3; 12689 const optionLoading = t2 === void 0 ? false : t2; 12690 const t4 = contacts?.[0]; 12691 let t5; 12692 if ($[10] !== onSelectedContactChange || $[11] !== selectedContactProp || $[12] !== t4) { 12693 t5 = { 12694 prop: selectedContactProp, 12695 defaultProp: t4, 12696 onChange: onSelectedContactChange 12697 }; 12698 $[10] = onSelectedContactChange; 12699 $[11] = selectedContactProp; 12700 $[12] = t4; 12701 $[13] = t5; 12702 } else t5 = $[13]; 12703 const [selectedContact, setSelectedContact] = useControllableState(t5); 12704 let t6; 12705 if ($[14] !== className) { 12706 t6 = cn("flex cursor-pointer items-center gap-0.5 text-orange-500 select-none", className); 12707 $[14] = className; 12708 $[15] = t6; 12709 } else t6 = $[15]; 12710 let t7; 12711 if ($[16] !== children) {
12712 t7 = children ?? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 12713 className: "text-xs font-medium", 12714 children: "Phone # is registered to multiple contacts" 12715 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleQuestionMark, { className: "size-4" })] }); 12716 $[16] = children; 12717 $[17] = t7; 12718 } else t7 = $[17]; 12719 let t8; 12720 if ($[18] !== props || $[19] !== t6 || $[20] !== t7) { 12721 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverTrigger, { 12722 asChild: true, 12723 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 12724 ...props, 12725 className: t6, 12726 children: t7 12727 }) 12728 }); 12729 $[18] = props; 12730 $[19] = t6; 12731 $[20] = t7; 12732 $[21] = t8; 12733 } else t8 = $[21]; 12734 let t10; 12735 let t9; 12736 if ($[22] === Symbol.for("react.memo_cache_sentinel")) { 12737 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { 12738 className: "border-b border-border px-4 py-2.5 font-semibold text-foreground", 12739 children: "Multiple identities list" 12740 }); 12741 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 12742 className: "px-4 pt-3 pb-2 text-xs text-muted-foreground", 12743 children: "We've found that this phone number is registered to multiple contacts." 12744 }); 12745 $[22] = t10; 12746 $[23] = t9; 12747 } else { 12748 t10 = $[22]; 12749 t9 = $[23]; 12750 } 12751 let t11; 12752 if ($[24] !== contacts || $[25] !== onSelectedContactChange || $[26] !== selectedContact || $[27] !== setSelectedContact) { 12753 let t12$1; 12754 if ($[29] !== onSelectedContactChange || $[30] !== selectedContact || $[31] !== setSelectedContact) { 12755 t12$1 = (contact) => { 12756 const selectedId = Object.values(selectedContact).join("-"); 12757 const contactId = Object.values(contact).join("-"); 12758 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 12759 variant: "ghost", 12760 onClick: () => { 12761 setSelectedContact(contact); 12762 onSelectedContactChange?.(contact); 12763 }, 12764 className: "h-auto w-full justify-between px-2 py-1.5", 12765 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipOverflowTrigger, { 12766 asChild: true, 12767 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 12768 className: cn("min-w-0 truncate text-sm font-medium", selectedId === contactId ? "text-primary" : "text-foreground"), 12769 children: contact.name 12770 }) 12771 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: contact.name })] }
12771), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 12772 className: "ml-2 shrink-0 text-xs font-normal text-muted-foreground", 12773 children: contact.role 12774 })] 12775 }, contactId); 12776 }; 12777 $[29] = onSelectedContactChange; 12778 $[30] = selectedContact; 12779 $[31] = setSelectedContact; 12780 $[32] = t12$1; 12781 } else t12$1 = $[32]; 12782 t11 = contacts.map(t12$1); 12783 $[24] = contacts; 12784 $[25] = onSelectedContactChange; 12785 $[26] = selectedContact; 12786 $[27] = setSelectedContact; 12787 $[28] = t11; 12788 } else t11 = $[28]; 12789 let t12; 12790 if ($[33] !== t11) { 12791 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 12792 className: "flex max-h-100 flex-col overflow-y-auto px-4 pb-3", 12793 children: t11 12794 }); 12795 $[33] = t11; 12796 $[34] = t12; 12797 } else t12 = $[34]; 12798 let t13; 12799 if ($[35] !== optionLoading || $[36] !== t12) { 12800 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverContent, { 12801 className: "w-75 p-0", 12802 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 12803 className: "flex flex-col", 12804 children: [ 12805 t9, 12806 t10, 12807 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spin, { 12808 spinning: optionLoading, 12809 children: t12 12810 }) 12811 ] 12812 }) 12813 }); 12814 $[35] = optionLoading; 12815 $[36] = t12; 12816 $[37] = t13; 12817 } else t13 = $[37]; 12818 let t14; 12819 if ($[38] !== t13 || $[39] !== t8) { 12820 t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Popover, { children: [t8, t13] }); 12821 $[38] = t13; 12822 $[39] = t8; 12823 $[40] = t14; 12824 } else t14 = $[40]; 12825 return t14; 12826} 12827function DialerMultipleIdentitiesDialog(t0) { 12828 const $ = (0, import_compiler_runtime$96.c)(34); 12829 const { open, onOpenChange, contacts: t1, selectedContact: selectedContactProp, onSelectedContactChange, onSave } = t0; 12830 let t2; 12831 if ($[0] !== t1) { 12832 t2 = t1 === void 0 ? [] : t1; 12833 $[0] = t1; 12834 $[1] = t2; 12835 } else t2 = $[1]; 12836 const contacts = t2; 12837 let t3; 12838 if ($[2] !== onSelectedContactChange || $[3] !== selectedContactProp) { 12839 t3 = { 12840 prop: selectedContactProp, 12841 defaultProp: void 0, 12842 onChange: onSelectedContactChange 12843 }; 12844 $[2] = onSelectedContactChange; 12845 $[3] = selectedContactProp; 12846 $[4] = t3; 12847 } else t3 = $[4]; 12848 const [selectedContact, setSelectedContact] = useControllableState(t3); 12849 let t4; 12850 if ($[5] !== onOpenChange || $[6] !== onSave || $[7] !== selectedContact) { 12851 t4 = () => { 12852 trackMethodCall("handleSaveMultipleIdentities", []); 12853 if (selectedContact) onSave?.(selectedContact); 12854 onOpenChange?.(false); 12855 }; 12856 $[5] = onOpenChange; 12857 $[6] = onSave; 12858 $[7] = selectedContact; 12859 $[8] = t4; 12860 } else t4 = $[8]; 12861 const handleSaveMultipleIdentities = t4; 12862 let t5; 12863 if ($[9] === Symbol.for("react.memo_cache_sentinel")) { 12864 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, { children: "Multiple identities list" }) }); 12865 $[9] = t5; 12866 } else t5 = $[9]; 12867 let t6; 12868 if ($[10] === Symbol.for("react.memo_cache_sentinel")) { 12869 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogDescription, { 12870 className: "mb-5 px-5 text-foreground", 12871 children: "Phone is registered to multiple contacts. Which contact did you have this call with? After selecting, we will more accurately map the phone records to the contacts." 12872 }); 12873 $[10] = t6; 12874 } else t6 = $[10]; 12875 let t7; 12876 if ($[11] !== contacts || $[12] !== selectedContact || $[13] !== setSelectedContact) { 12877 let t8$1; 12878 if ($[15] !== selectedContact || $[16] !== setSelectedContact) { 12879 t8$1 = (contact) => { 12880 const selectedId = Object.values(selectedContact ?? {}).join("-"); 12881 const contactId = Object.values(contact).join("-"); 12882 const isSelected = selectedId === contactId; 12883 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 12884 variant: "ghost", 12885 onClick: () => setSelectedContact(contact), 12886 className: cn("h-auto w-full justify-between border border-transparent px-2 py-1.5", isSelected && "border-border"), 12887 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipOverflowTrigger, { 12888 asChild: true, 12889 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 12890 className: cn("min-w-0 truncate text-sm font-medium", isSelected ? "text-primary" : "text-foreground"), 12891 children: contact.name 12892 }) 12893 }
12893), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: contact.name })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 12894 className: "ml-2 shrink-0 text-xs font-normal text-muted-foreground", 12895 children: contact.role 12896 })] 12897 }, contactId); 12898 }; 12899 $[15] = selectedContact; 12900 $[16] = setSelectedContact; 12901 $[17] = t8$1; 12902 } else t8$1 = $[17]; 12903 t7 = contacts.map(t8$1); 12904 $[11] = contacts; 12905 $[12] = selectedContact; 12906 $[13] = setSelectedContact; 12907 $[14] = t7; 12908 } else t7 = $[14]; 12909 let t8; 12910 if ($[18] !== t7) { 12911 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogInner, { 12912 className: "min-w-0 px-0", 12913 children: [t6, /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 12914 className: "flex max-h-100 flex-col overflow-y-auto px-5", 12915 children: t7 12916 })] 12917 }); 12918 $[18] = t7; 12919 $[19] = t8; 12920 } else t8 = $[19]; 12921 let t9; 12922 if ($[20] !== onOpenChange) { 12923 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 12924 variant: "outline", 12925 onClick: () => onOpenChange?.(false), 12926 children: "Cancel" 12927 }); 12928 $[20] = onOpenChange; 12929 $[21] = t9; 12930 } else t9 = $[21]; 12931 let t10; 12932 if ($[22] !== handleSaveMultipleIdentities) { 12933 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 12934 onClick: handleSaveMultipleIdentities, 12935 children: "Save" 12936 }); 12937 $[22] = handleSaveMultipleIdentities; 12938 $[23] = t10; 12939 } else t10 = $[23]; 12940 let t11; 12941 if ($[24] !== t10 || $[25] !== t9) { 12942 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogFooter, { children: [t9, t10] }); 12943 $[24] = t10; 12944 $[25] = t9; 12945 $[26] = t11; 12946 } else t11 = $[26]; 12947 let t12; 12948 if ($[27] !== t11 || $[28] !== t8) { 12949 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, { 12950 className: "max-w-105", 12951 children: [ 12952 t5, 12953 t8, 12954 t11 12955 ] 12956 }); 12957 $[27] = t11; 12958 $[28] = t8; 12959 $[29] = t12; 12960 } else t12 = $[29]; 12961 let t13; 12962 if ($[30] !== onOpenChange || $[31] !== open || $[32] !== t12) { 12963 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, { 12964 open, 12965 onOpenChange, 12966 children: t12 12967 }); 12968 $[30] = onOpenChange; 12969 $[31] = open; 12970 $[32] = t12; 12971 $[33] = t13; 12972 } else t13 = $[33]; 12973 return t13; 12974} 12975var dialer_multiple_identities_default = DialerMultipleIdentities; 12976var dialer_default_avatar_default = "data:image/svg+xml,%3csvg%20width='68'%20height='68'%20viewBox='0%200%2068%2068'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M34%201C52.2254%201%2067%2015.7746%2067%2034C67%2052.2254%2052.2254%2067%2034%2067C15.7746%2067%201%2052.2254%201%2034C1%2015.7746%2015.7746%201%2034%201Z'%20fill='%23F3F3F5'/%3e%3cpath%20d='M34%201C52.2254%201%2067%2015.7746%2067%2034C67%2052.2254%2052.2254%2067%2034%2067C15.7746%2067%201%2052.2254%201%2034C1%2015.7746%2015.7746%201%2034%201Z'%20stroke='white'%20stroke-width='2'/%3e%3cpath%20d='M34.0026%2015.668C29.4463%2015.668%2025.7526%2019.3616%2025.7526%2023.918C25.7526%2028.4743%2029.4463%2032.168%2034.0026%2032.168C38.559%2032.168%2042.2526%2028.4743%2042.2526%2023.918C42.2526%2019.3616%2038.559%2015.668%2034.0026%2015.668Z'%20fill='url(%23paint0_linear_20178_36494)'/%3e%3cpath%20d='M34.0044%2034.0013C26.1226%2034.0013%2020.3512%2039.2881%2018.7803%2046.278C18.249%2048.6419%2020.1871%2050.5013%2022.2682%2050.5013H45.7407C47.8219%2050.5013%2049.7599%2048.6419%2049.2286%2046.278C47.6578%2039.2881%2041.8863%2034.0013%2034.0044%2034.0013Z'%20fill='url(%23paint1_linear_20178_36494)'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_20178_36494'%20x1='18.6914'%20y1='34.0013'%20x2='16.13'%20y2='62.8253'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23525962'/%3e%3cstop%20offset='1'%20stop-color='%231B1F25'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_20178_36494'%20x1='18.6914'%20y1='34.0013'%20x2='16.13'%20y2='62.8253'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23525962'/%3e%3cstop%20offset='1'%20stop-color='%231B1F25'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e"; 12977var import_compiler_runtime$95 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 12978var callResultSchema = objectType({ 12979 outcomeId: stringType().optional(), 12980 resultContent: stringType().optional(), 12981 loadIds: arrayType(stringType()).optional(), 12982 callScore: numberType().min(0).max(5).optional(), 12983 callErrorMsg: stringType().optional() 12984}); 12985var DEFAULT_CALL_RESULT_VALUES = { 12986 outcomeId: "", 12987 resultContent: "", 12988 loadIds: [], 12989 callScore: 0 12990}; 12991var SHOW_RELATED_TRIP = false;
12992var DIRECTION_LABELS = { 12993 OUTBOUND: "Outbound Call Result", 12994 INBOUND: "Inbound Call Result" 12995}; 12996var getLoadLoadingOptions = (query) => { 12997 return [{ 12998 value: "loading", 12999 label: "Loading...", 13000 disabled: true, 13001 displayLabel: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { className: "size-4 text-primary" }), 13002 searchLabel: query 13003 }]; 13004}; 13005function DialerCallResultSheet() { 13006 const $ = (0, import_compiler_runtime$95.c)(104); 13007 const dispatch = useAppDispatch(); 13008 const isOpen = useAppSelector(selectIsCallResultSheetOpen); 13009 const sid = useAppSelector(selectResultSheetSid); 13010 const sheetContentRef = (0, import_react.useRef)(null); 13011 const t0 = sid; 13012 let t1; 13013 if ($[0] !== t0) { 13014 t1 = { sid: t0 }; 13015 $[0] = t0; 13016 $[1] = t1; 13017 } else t1 = $[1]; 13018 const t2 = !sid; 13019 let t3; 13020 if ($[2] !== t2) { 13021 t3 = { skip: t2 }; 13022 $[2] = t2; 13023 $[3] = t3; 13024 } else t3 = $[3]; 13025 const { data: callResultData, isLoading: isLoadingCallResult, isFetching: isFetchingCallResult } = useGetDialerCallResultQuery(t1, t3); 13026 const [saveCallResult, t4] = useSaveCallResultMutation(); 13027 const { isLoading: isSavingCallResult } = t4; 13028 let t5; 13029 if ($[4] !== callResultData) { 13030 t5 = get(callResultData, "data"); 13031 $[4] = callResultData; 13032 $[5] = t5; 13033 } else t5 = $[5]; 13034 const callResult = t5; 13035 let T0; 13036 let T1; 13037 let T2; 13038 let callRecord; 13039 let initFormValues; 13040 let t10; 13041 let t11; 13042 let t12; 13043 let t13; 13044 let t14; 13045 let t15; 13046 let t16; 13047 let t17; 13048 let t18; 13049 let t19; 13050 let t20; 13051 let t21; 13052 let t22; 13053 let t23; 13054 let t24; 13055 let t25; 13056 let t6; 13057 let t7; 13058 let t8; 13059 let t9; 13060 if ($[6] !== callResultData || $[7] !== dispatch || $[8] !== isFetchingCallResult || $[9] !== isLoadingCallResult || $[10] !== isOpen || $[11] !== isSavingCallResult || $[12] !== saveCallResult || $[13] !== sid) { 13061 callRecord = get(callResultData, "data.callRecord") ?? {}; 13062 const contacts = get(callResultData, "data.contacts") ?? []; 13063 const displayContact = get(contacts, "[0]", { name: "Unknown" }); 13064 const displayAvatar = displayContact.avatar ?? callRecord.avatar ?? ""; 13065 const displayPhone = displayContact.phone ?? (callRecord.direction === "INBOUND" ? callRecord.fromNumber : callRecord.toNumber); 13066 initFormValues = { 13067 resultContent: callRecord.resultContent ?? "", 13068 callScore: callRecord.callScore ?? 0, 13069 callErrorMsg: callRecord.callErrorMsg ?? void 0, 13070 outcomeId: callRecord.outcomeId ? String(callRecord.outcomeId) : void 0, 13071 loadIds: callRecord.extra?.loadIds?.map(_temp$20) ?? void 0 13072 }; 13073 let t26$1; 13074 if ($[39] !== dispatch) { 13075 t26$1 = async () => { 13076 trackMethodCall("handleCloseSheet", []); 13077 dispatch(closeDialerSheet()); 13078 }; 13079 $[39] = dispatch; 13080 $[40] = t26$1; 13081 } else t26$1 = $[40]; 13082 const handleCloseSheet = t26$1; 13083 let t27$1; 13084 if ($[41] !== saveCallResult || $[42] !== sid) { 13085 t27$1 = async (contact) => { 13086 trackMethodCall("handleSelectedContactChange", [contact]); 13087 if (!contact.id || !sid) { 13088 toast.error("Please select data."); 13089 return; 13090 } 13091 const lowerCaseRole = contact.role.toLowerCase(); 13092 const params = { 13093 callSid: sid, 13094 role: roleCt[lowerCaseRole] || lowerCaseRole, 13095 personId: contact.id, 13096 contactId: contact.contactId ?? null 13097 }; 13098 await mutateWithErrorHandling(saveCallResult, params, { 13099 showSuccessToast: true, 13100 successMessage: "Call result saved successfully" 13101 }); 13102 }; 13103 $[41] = saveCallResult; 13104 $[42] = sid; 13105 $[43] = t27$1; 13106 } else t27$1 = $[43]; 13107 const handleSelectedContactChange = t27$1; 13108 T2 = Sheet; 13109 t24 = isOpen; 13110 t25 = false; 13111 T1 = SheetContent; 13112 t18 = "w-95 overflow-hidden shadow-[-7px_0_24px_-3px_rgba(12,25,63,0.07)]"; 13113 t19 = false; 13114 t20 = true; 13115 t21 = sheetContentRef; 13116 if ($[44] === Symbol.for("react.memo_cache_sentinel")) { 13117 t22 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetTitle, { 13118 className: "sr-only", 13119 children: "Call Result" 13120 }); 13121 t23 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetDescription, { 13122 className: "sr-only", 13123 children: "The result of the call." 13124 }); 13125 $[44] = t22; 13126 $[45] = t23; 13127 } else { 13128 t22 = $[44]; 13129 t23 = $[45]; 13130 } 13131 T0 = Spin; 13132 t17 = isLoadingCallResult || isFetchingCallResult; 13133 t16 = "flex size-full flex-col"; 13134 t13 = "Call result header"; 13135 t14 = "bg-linear-to-b from-[#525962] to-[#1B1F25] p-5 text-primary-foreground"; 13136 const t28$1 = DIRECTION_LABELS[callRecord.direction]; 13137 let t29$1; 13138 if ($[46] !== t28$1) { 13139 t29$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { 13140 className: "text-sm font-medium", 13141 children: t28$1 13142 }); 13143 $[46] = t28$1; 13144 $[47] = t29$1; 13145 } else t29$1 = $[47]; 13146 let t30$1; 13147 if ($[48] === Symbol.for("react.memo_cache_sentinel")) { 13148 t30$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { className: "size-5" }); 13149 $[48] = t30$1; 13150 } else t30$1 = $[48]; 13151 let t31$1; 13152 if ($[49] !== handleCloseSheet) { 13153 t31$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 13154 variant: "ghost", 13155 size: "icon-sm", 13156 className: "size-5 bg-transparent hover:bg-transparent hover:text-primary-foreground", 13157 tabIndex: -1, 13158 onClick: handleCloseSheet, 13159 children: t30$1 13160 }); 13161 $[49] = handleCloseSheet; 13162 $[50] = t31$1; 13163 } else t31$1 = $[50]; 13164 const t32$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 13165 className: "flex items-center gap-4", 13166 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 13167 variant: "neutral-subtle", 13168 className: "h-5 rounded-[13px] bg-white/10 px-2 text-xs font-medium text-white", 13169 children: getRecordingTimeFormatted(callRecord.duration ?? 0) 13170 }
13170), t31$1] 13171 }); 13172 if ($[51] !== t29$1 || $[52] !== t32$1) { 13173 t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { 13174 className: "flex items-center justify-between", 13175 children: [t29$1, t32$1] 13176 }); 13177 $[51] = t29$1; 13178 $[52] = t32$1; 13179 $[53] = t15; 13180 } else t15 = $[53]; 13181 t11 = "flex flex-col items-center justify-center gap-1 px-5 pt-6 pb-3"; 13182 let t33$1; 13183 if ($[54] === Symbol.for("react.memo_cache_sentinel")) { 13184 t33$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarFallback, { 13185 className: "bg-white", 13186 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { 13187 src: dialer_default_avatar_default, 13188 alt: "", 13189 className: "size-full object-cover" 13190 }) 13191 }); 13192 $[54] = t33$1; 13193 } else t33$1 = $[54]; 13194 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 13195 className: "flex flex-col items-center pb-1.5", 13196 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Avatar, { 13197 className: "z-0 size-16 border-white", 13198 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarImage, { 13199 src: displayAvatar, 13200 alt: displayContact.name ?? "Contact avatar" 13201 }), t33$1] 13202 }), displayContact.role && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 13203 variant: "neutral-subtle", 13204 className: "z-10 -mt-1.5 bg-white text-slate-600 capitalize", 13205 children: displayContact.role.replace("_", " ") 13206 })] 13207 }); 13208 t8 = "flex flex-col items-center"; 13209 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { 13210 className: "font-semibold text-white", 13211 children: displayContact.name 13212 }); 13213 t10 = contacts.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_multiple_identities_default, { 13214 contacts, 13215 onSelectedContactChange: handleSelectedContactChange, 13216 className: "mb-1", 13217 optionLoading: isSavingCallResult 13218 }); 13219 t6 = "text-xs text-white"; 13220 t7 = formatPhone(normalizePhone(displayPhone)); 13221 $[6] = callResultData; 13222 $[7] = dispatch; 13223 $[8] = isFetchingCallResult; 13224 $[9] = isLoadingCallResult; 13225 $[10] = isOpen; 13226 $[11] = isSavingCallResult; 13227 $[12] = saveCallResult; 13228 $[13] = sid; 13229 $[14] = T0; 13230 $[15] = T1; 13231 $[16] = T2; 13232 $[17] = callRecord; 13233 $[18] = initFormValues; 13234 $[19] = t10; 13235 $[20] = t11; 13236 $[21] = t12; 13237 $[22] = t13; 13238 $[23] = t14; 13239 $[24] = t15; 13240 $[25] = t16; 13241 $[26] = t17; 13242 $[27] = t18; 13243 $[28] = t19; 13244 $[29] = t20; 13245 $[30] = t21; 13246 $[31] = t22; 13247 $[32] = t23; 13248 $[33] = t24; 13249 $[34] = t25; 13250 $[35] = t6; 13251 $[36] = t7; 13252 $[37] = t8; 13253 $[38] = t9; 13254 } else { 13255 T0 = $[14]; 13256 T1 = $[15]; 13257 T2 = $[16]; 13258 callRecord = $[17]; 13259 initFormValues = $[18]; 13260 t10 = $[19]; 13261 t11 = $[20]; 13262 t12 = $[21]; 13263 t13 = $[22]; 13264 t14 = $[23]; 13265 t15 = $[24]; 13266 t16 = $[25]; 13267 t17 = $[26]; 13268 t18 = $[27]; 13269 t19 = $[28]; 13270 t20 = $[29]; 13271 t21 = $[30]; 13272 t22 = $[31]; 13273 t23 = $[32]; 13274 t24 = $[33]; 13275 t25 = $[34]; 13276 t6 = $[35]; 13277 t7 = $[36]; 13278 t8 = $[37]; 13279 t9 = $[38]; 13280 } 13281 let t26; 13282 if ($[55] !== t6 || $[56] !== t7) { 13283 t26 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 13284 className: t6, 13285 children: t7 13286 }); 13287 $[55] = t6; 13288 $[56] = t7; 13289 $[57] = t26; 13290 } else t26 = $[57]; 13291 let t27; 13292 if ($[58] !== t10 || $[59] !== t26 || $[60] !== t8 || $[61] !== t9) { 13293 t27 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 13294 className: t8, 13295 children: [ 13296 t9, 13297 t10, 13298 t26 13299 ] 13300 }); 13301 $[58] = t10; 13302 $[59] = t26; 13303 $[60] = t8; 13304 $[61] = t9; 13305 $[62] = t27; 13306 } else t27 = $[62]; 13307 let t28; 13308 if ($[63] !== t11 || $[64] !== t12 || $[65] !== t27) { 13309 t28 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 13310 className: t11, 13311 children: [t12, t27] 13312 }); 13313 $[63] = t11; 13314 $[64] = t12; 13315 $[65] = t27; 13316 $[66] = t28; 13317 } else t28 = $[66]; 13318 let t29; 13319 if ($[67] !== t13 || $[68] !== t14 || $[69] !== t15 || $[70] !== t28) { 13320 t29 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { 13321 "aria-label": t13, 13322 className: t14, 13323 children: [t15, t28] 13324 }); 13325 $[67] = t13; 13326 $[68] = t14; 13327 $[69] = t15; 13328 $[70] = t28; 13329 $[71] = t29; 13330 } else t29 = $[71]; 13331 let t30; 13332 if ($[72] !== initFormValues) { 13333 t30 = Object.values(initFormValues); 13334 $[72] = initFormValues; 13335 $[73] = t30; 13336 } else t30 = $[73]; 13337 const t31 = t30.join("-"); 13338 const t32 = callRecord.duration ?? 0; 13339 const t33 = callRecord.recordingUrl ?? ""; 13340 let t34; 13341 if ($[74] === Symbol.for("react.memo_cache_sentinel")) { 13342 t34 = () => sheetContentRef.current?.getBoundingClientRect() ?? null; 13343 $[74] = t34; 13344 } else t34 = $[74]; 13345 let t35; 13346 if ($[75] !== callResult || $[76] !== initFormValues || $[77] !== sid || $[78] !== t31 || $[79] !== t32 || $[80] !== t33) { 13347 t35 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialerCallResultForm, { 13348 sid, 13349 callDuration: t32, 13350 recordingUrl: t33, 13351 getSheetContentRect: t34, 13352 initialValues: initFormValues, 13353 callResult 13354 }, t31); 13355 $[75] = callResult; 13356 $[76] = initFormValues; 13357 $[77] = sid; 13358 $[78] = t31; 13359 $[79] = t32; 13360 $[80] = t33; 13361 $[81] = t35; 13362 } else t35 = $[81]; 13363 let t36; 13364 if ($[82] !== t16 || $[83] !== t29 || $[84] !== t35) { 13365 t36 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 13366 className: t16, 13367 children: [t29, t35] 13368 }); 13369 $[82] = t16; 13370 $[83] = t29; 13371 $[84] = t35; 13372 $[85] = t36; 13373 } else t36 = $[85]; 13374 let t37;
13375 if ($[86] !== T0 || $[87] !== t17 || $[88] !== t36) { 13376 t37 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(T0, { 13377 spinning: t17, 13378 children: t36 13379 }); 13380 $[86] = T0; 13381 $[87] = t17; 13382 $[88] = t36; 13383 $[89] = t37; 13384 } else t37 = $[89]; 13385 let t38; 13386 if ($[90] !== T1 || $[91] !== t18 || $[92] !== t19 || $[93] !== t20 || $[94] !== t21 || $[95] !== t22 || $[96] !== t23 || $[97] !== t37) { 13387 t38 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(T1, { 13388 className: t18, 13389 showCloseButton: t19, 13390 disableAnimation: t20, 13391 ref: t21, 13392 children: [ 13393 t22, 13394 t23, 13395 t37 13396 ] 13397 }); 13398 $[90] = T1; 13399 $[91] = t18; 13400 $[92] = t19; 13401 $[93] = t20; 13402 $[94] = t21; 13403 $[95] = t22; 13404 $[96] = t23; 13405 $[97] = t37; 13406 $[98] = t38; 13407 } else t38 = $[98]; 13408 let t39; 13409 if ($[99] !== T2 || $[100] !== t24 || $[101] !== t25 || $[102] !== t38) { 13410 t39 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(T2, { 13411 open: t24, 13412 modal: t25, 13413 children: t38 13414 }); 13415 $[99] = T2; 13416 $[100] = t24; 13417 $[101] = t25; 13418 $[102] = t38; 13419 $[103] = t39; 13420 } else t39 = $[103]; 13421 return t39; 13422} 13423function _temp$20(id) { 13424 return String(id); 13425} 13426function DialerCallResultForm(t0) { 13427 const $ = (0, import_compiler_runtime$95.c)(67); 13428 const { callDuration, recordingUrl, getSheetContentRect, initialValues: t1, sid, callResult } = t0; 13429 let t2; 13430 if ($[0] !== t1) { 13431 t2 = t1 === void 0 ? {} : t1; 13432 $[0] = t1; 13433 $[1] = t2; 13434 } else t2 = $[1]; 13435 const initialValues = t2; 13436 const dispatch = useAppDispatch(); 13437 const [loadQuery, setLoadQuery] = (0, import_react.useState)(""); 13438 let t3; 13439 if ($[2] === Symbol.for("react.memo_cache_sentinel")) { 13440 t3 = { wait: 300 }; 13441 $[2] = t3; 13442 } else t3 = $[2]; 13443 const loadQueryDebounced = useDebounce_default(loadQuery, t3); 13444 let t4; 13445 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 13446 t4 = t$2(callResultSchema); 13447 $[3] = t4; 13448 } else t4 = $[3]; 13449 let t5; 13450 if ($[4] !== initialValues) { 13451 t5 = Object.assign(DEFAULT_CALL_RESULT_VALUES, initialValues); 13452 $[4] = initialValues; 13453 $[5] = t5; 13454 } else t5 = $[5]; 13455 let t6; 13456 if ($[6] !== t5) { 13457 t6 = { 13458 resolver: t4, 13459 defaultValues: t5 13460 }; 13461 $[6] = t5; 13462 $[7] = t6; 13463 } else t6 = $[7]; 13464 const form = useForm(t6); 13465 const { data: callOutcomesResponse } = useGetDialerSettingCallOutcomeListQuery(); 13466 let t7; 13467 if ($[8] !== loadQueryDebounced) { 13468 t7 = { loadId: loadQueryDebounced }; 13469 $[8] = loadQueryDebounced; 13470 $[9] = t7; 13471 } else t7 = $[9]; 13472 const { data: loadsResponse, isLoading: isLoadingLoads, isFetching: isFetchingLoads } = useGetDialerLoadsQuery(t7); 13473 const [saveCallResult, t8] = useSaveCallResultMutation(); 13474 const { isLoading: isSavingCallResult } = t8; 13475 let t9; 13476 if ($[10] !== callOutcomesResponse) { 13477 t9 = (get(callOutcomesResponse, "data") ?? []).map(_temp2$11); 13478 $[10] = callOutcomesResponse; 13479 $[11] = t9; 13480 } else t9 = $[11]; 13481 const outcomeOptions = t9; 13482 let t10; 13483 if ($[12] !== loadsResponse) { 13484 t10 = (get(loadsResponse, "data") ?? []).map(_temp3$3); 13485 $[12] = loadsResponse; 13486 $[13] = t10; 13487 } else t10 = $[13]; 13488 const loadFetchedOptions = t10; 13489 let t11; 13490 if ($[14] !== isFetchingLoads || $[15] !== isLoadingLoads || $[16] !== loadFetchedOptions || $[17] !== loadQueryDebounced) { 13491 t11 = isLoadingLoads || isFetchingLoads ? getLoadLoadingOptions(loadQueryDebounced) : loadFetchedOptions; 13492 $[14] = isFetchingLoads; 13493 $[15] = isLoadingLoads; 13494 $[16] = loadFetchedOptions; 13495 $[17] = loadQueryDebounced; 13496 $[18] = t11; 13497 } else t11 = $[18]; 13498 const loadOptions = t11; 13499 let t12; 13500 if ($[19] !== saveCallResult || $[20] !== sid) { 13501 t12 = async (data) => { 13502 trackMethodCall("handleSaveCallResultSubmit", [data]); 13503 if (!sid) return; 13504 const params = { 13505 callSid: sid, 13506 resultContent: data.resultContent, 13507 callScore: data.callScore, 13508 callErrorMsg: data.callErrorMsg, 13509 loadIds: data.loadIds ? data.loadIds.map(_temp4$2) : void 0, 13510 outcomeId: data.outcomeId ? Number(data.outcomeId) : void 0 13511 }; 13512 await mutateWithErrorHandling(saveCallResult, params, { 13513 showSuccessToast: true, 13514 successMessage: "Call result saved successfully" 13515 }); 13516 }; 13517 $[19] = saveCallResult; 13518 $[20] = sid; 13519 $[21] = t12; 13520 } else t12 = $[21]; 13521 const handleSaveCallResultSubmit = t12; 13522 let t13; 13523 if ($[22] !== callResult || $[23] !== dispatch || $[24] !== getSheetContentRect) { 13524 t13 = () => { 13525 trackMethodCall("handleViewActivity", []); 13526 const rect = getSheetContentRect(); 13527 if (!rect) return; 13528 const contact = get(callResult, "contacts.[0]"); 13529 const callRecord = get(callResult, "callRecord"); 13530 const callRecordPhone = callRecord?.direction === "INBOUND" ? callRecord?.fromNumber : callRecord?.toNumber ?? ""; 13531 dispatch(showNestedSheet({ 13532 sourceRect: { 13533 x: rect.x, 13534 y: rect.y, 13535 width: rect.width, 13536 height: rect.height 13537 }, 13538 data: { 13539 id: contact?.id ?? void 0, 13540 name: contact?.name ?? "Unknown", 13541 role: contact?.role ?? void 0, 13542 hasContactPermission: callResult?.hasContactPermission ?? false,
13543 phone: contact?.formatPhone ?? contact?.phone ?? callRecordPhone ?? "", 13544 contactId: contact?.contactId ?? void 0, 13545 type: "recent" 13546 } 13547 })); 13548 }; 13549 $[22] = callResult; 13550 $[23] = dispatch; 13551 $[24] = getSheetContentRect; 13552 $[25] = t13; 13553 } else t13 = $[25]; 13554 const handleViewActivity = t13; 13555 let t14; 13556 if ($[26] !== form || $[27] !== handleSaveCallResultSubmit) { 13557 t14 = form.handleSubmit(handleSaveCallResultSubmit, console.warn); 13558 $[26] = form; 13559 $[27] = handleSaveCallResultSubmit; 13560 $[28] = t14; 13561 } else t14 = $[28]; 13562 let t15; 13563 if ($[29] === Symbol.for("react.memo_cache_sentinel")) { 13564 t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 13565 className: "text-sm font-medium text-foreground", 13566 children: "Call Recording" 13567 }); 13568 $[29] = t15; 13569 } else t15 = $[29]; 13570 let t16; 13571 if ($[30] !== callDuration || $[31] !== recordingUrl) { 13572 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 13573 className: "flex flex-col gap-2", 13574 children: [t15, recordingUrl ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(audio_player_default, { 13575 duration: callDuration, 13576 url: recordingUrl 13577 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 13578 className: "text-sm text-muted-foreground", 13579 children: "No Call Recording" 13580 })] 13581 }); 13582 $[30] = callDuration; 13583 $[31] = recordingUrl; 13584 $[32] = t16; 13585 } else t16 = $[32]; 13586 let t17; 13587 if ($[33] !== outcomeOptions) { 13588 t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectField, { 13589 name: "outcomeId", 13590 title: "Outcome", 13591 placeholder: "Please Choose", 13592 options: outcomeOptions 13593 }); 13594 $[33] = outcomeOptions; 13595 $[34] = t17; 13596 } else t17 = $[34]; 13597 let t18; 13598 if ($[35] === Symbol.for("react.memo_cache_sentinel")) { 13599 t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextareaField, { 13600 name: "resultContent", 13601 title: "Call Notes", 13602 placeholder: "Write something about this call.", 13603 className: "min-h-19 resize-none" 13604 }); 13605 $[35] = t18; 13606 } else t18 = $[35]; 13607 let t19; 13608 if ($[36] !== form.control || $[37] !== loadOptions) { 13609 t19 = SHOW_RELATED_TRIP; 13610 $[36] = form.control; 13611 $[37] = loadOptions; 13612 $[38] = t19; 13613 } else t19 = $[38]; 13614 let t20; 13615 if ($[39] !== t16 || $[40] !== t17 || $[41] !== t19) { 13616 t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 13617 className: "flex flex-col gap-4", 13618 children: [ 13619 t16, 13620 t17, 13621 t18, 13622 t19 13623 ] 13624 }); 13625 $[39] = t16; 13626 $[40] = t17; 13627 $[41] = t19; 13628 $[42] = t20; 13629 } else t20 = $[42]; 13630 let t21; 13631 if ($[43] === Symbol.for("react.memo_cache_sentinel")) { 13632 t21 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 13633 className: "flex w-full items-center gap-2", 13634 children: [
13635 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-px flex-1 bg-[#dadce1]" }), 13636 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 13637 className: "text-sm text-muted-foreground", 13638 children: "How was the quality of your call?" 13639 }), 13640 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-px flex-1 bg-[#dadce1]" }) 13641 ] 13642 }); 13643 $[43] = t21; 13644 } else t21 = $[43]; 13645 let t22; 13646 if ($[44] !== form) { 13647 t22 = (t23$1) => { 13648 const { field: field_0 } = t23$1; 13649 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(rating_input_default, { 13650 value: field_0.value ?? 0, 13651 onChange: (rating) => { 13652 if (rating > 3) form.setValue("callErrorMsg", void 0); 13653 field_0.onChange(rating); 13654 } 13655 }), !!field_0.value && field_0.value <= 3 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextareaField, { 13656 name: "callErrorMsg", 13657 placeholder: "What wrong with this call?", 13658 className: "min-h-19 resize-none" 13659 })] }); 13660 }; 13661 $[44] = form; 13662 $[45] = t22; 13663 } else t22 = $[45]; 13664 let t23; 13665 if ($[46] !== form.control || $[47] !== t22) { 13666 t23 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 13667 className: "flex flex-col items-center gap-2", 13668 children: [t21, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Controller, { 13669 control: form.control, 13670 name: "callScore", 13671 render: t22 13672 })] 13673 }); 13674 $[46] = form.control; 13675 $[47] = t22; 13676 $[48] = t23; 13677 } else t23 = $[48]; 13678 let t24; 13679 if ($[49] !== t20 || $[50] !== t23) { 13680 t24 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 13681 className: "flex flex-col gap-6 px-5 py-6", 13682 children: [t20, t23] 13683 }); 13684 $[49] = t20; 13685 $[50] = t23; 13686 $[51] = t24; 13687 } else t24 = $[51]; 13688 let t25; 13689 if ($[52] !== form || $[53] !== t14 || $[54] !== t24) { 13690 t25 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", { 13691 "aria-label": "Call result form", 13692 className: "flex flex-1 flex-col overflow-y-auto", 13693 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormWrapper, { 13694 id: "rhf-call-result-form", 13695 form, 13696 onSubmit: t14, 13697 children: t24 13698 }) 13699 }); 13700 $[52] = form; 13701 $[53] = t14; 13702 $[54] = t24; 13703 $[55] = t25; 13704 } else t25 = $[55]; 13705 let t26; 13706 if ($[56] !== isSavingCallResult) { 13707 t26 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 13708 type: "submit", 13709 form: "rhf-call-result-form", 13710 className: "w-full", 13711 disabled: isSavingCallResult, 13712 loading: isSavingCallResult, 13713 children: "Save" 13714 }); 13715 $[56] = isSavingCallResult; 13716 $[57] = t26; 13717 } else t26 = $[57]; 13718 let t27; 13719 if ($[58] === Symbol.for("react.memo_cache_sentinel")) { 13720 t27 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CalendarSearch, { className: "size-4" }); 13721 $[58] = t27; 13722 } else t27 = $[58]; 13723 let t28; 13724 if ($[59] !== handleViewActivity) { 13725 t28 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 13726 className: "flex justify-center pt-1", 13727 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 13728 type: "button", 13729 size: "sm", 13730 variant: "ghost", 13731 className: "text-primary hover:bg-primary-muted hover:text-primary", 13732 onClick: handleViewActivity, 13733 children: ["View Activity", t27] 13734 }) 13735 }); 13736 $[59] = handleViewActivity; 13737 $[60] = t28; 13738 } else t28 = $[60]; 13739 let t29; 13740 if ($[61] !== t26 || $[62] !== t28) { 13741 t29 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { 13742 "aria-label": "Call result actions", 13743 className: "px-6 py-5", 13744 children: [t26, t28] 13745 }); 13746 $[61] = t26; 13747 $[62] = t28; 13748 $[63] = t29; 13749 } else t29 = $[63]; 13750 let t30; 13751 if ($[64] !== t25 || $[65] !== t29) { 13752 t30 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [t25, t29] }); 13753 $[64] = t25; 13754 $[65] = t29; 13755 $[66] = t30; 13756 } else t30 = $[66]; 13757 return t30; 13758} 13759function _temp4$2(id) { 13760 return Number(id); 13761} 13762function _temp3$3(load) { 13763 return { 13764 value: String(load.id), 13765 label: `${load.loadId} - ${load.status}` 13766 }; 13767} 13768function _temp2$11(outcome) { 13769 return { 13770 label: outcome.name, 13771 value: String(outcome.id) 13772 }; 13773} 13774var dialer_call_result_sheet_default = DialerCallResultSheet; 13775var import_compiler_runtime$94 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 13776function DialPad(t0) { 13777 const $ = (0, import_compiler_runtime$94.c)(21); 13778 const { value, onChange, onTap, className } = t0; 13779 let t1; 13780 if ($[0] !== onChange || $[1] !== value) { 13781 t1 = { 13782 prop: value, 13783 defaultProp: "", 13784 onChange 13785 }; 13786 $[0] = onChange; 13787 $[1] = value; 13788 $[2] = t1; 13789 } else t1 = $[2]; 13790 const [dialValue, setDialValue] = useControllableState(t1); 13791 let t2; 13792 if ($[3] !== onTap || $[4] !== setDialValue) { 13793 t2 = (digit) => { 13794 trackMethodCall("handleKeyPress", [digit]); 13795 setDialValue((prev) => prev + digit); 13796 onTap?.(digit); 13797 };
13798 $[3] = onTap; 13799 $[4] = setDialValue; 13800 $[5] = t2; 13801 } else t2 = $[5]; 13802 const handleKeyPress = t2; 13803 let t3; 13804 if ($[6] !== setDialValue) { 13805 t3 = (e$4) => { 13806 trackMethodCall("handleInputChange", [e$4]); 13807 const newValue = e$4.target.value.replace(/[^0-9*#]/g, ""); 13808 setDialValue(newValue); 13809 }; 13810 $[6] = setDialValue; 13811 $[7] = t3; 13812 } else t3 = $[7]; 13813 const handleInputChange = t3; 13814 let t4; 13815 if ($[8] !== className) { 13816 t4 = cn("flex flex-col gap-3 bg-background", className); 13817 $[8] = className; 13818 $[9] = t4; 13819 } else t4 = $[9]; 13820 let t5; 13821 if ($[10] !== dialValue || $[11] !== handleInputChange) { 13822 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input, { 13823 type: "text", 13824 value: dialValue, 13825 onChange: handleInputChange, 13826 className: "h-9 text-sm font-normal", 13827 placeholder: "" 13828 }); 13829 $[10] = dialValue; 13830 $[11] = handleInputChange; 13831 $[12] = t5; 13832 } else t5 = $[12]; 13833 let t6; 13834 if ($[13] !== handleKeyPress) { 13835 t6 = DIAL_PAD_KEYS.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 13836 className: "flex gap-2", 13837 children: row.map((padKey) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 13838 type: "button", 13839 onClick: () => handleKeyPress(padKey.digit), 13840 variant: "secondary", 13841 className: "group h-11 flex-1 flex-col justify-start gap-0 transition-transform active:scale-95 active:opacity-100", 13842 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 13843 className: "font-numeric text-xs leading-4 font-bold text-foreground group-hover:text-primary", 13844 children: padKey.digit 13845 }), padKey.letters && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 13846 className: "text-xs leading-4 font-normal text-muted-foreground group-hover:text-primary", 13847 children: padKey.letters 13848 })] 13849 }, padKey.digit)) 13850 }, rowIndex)); 13851 $[13] = handleKeyPress; 13852 $[14] = t6; 13853 } else t6 = $[14]; 13854 let t7; 13855 if ($[15] !== t6) { 13856 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 13857 className: "flex flex-col gap-2", 13858 children: t6 13859 }); 13860 $[15] = t6; 13861 $[16] = t7; 13862 } else t7 = $[16]; 13863 let t8; 13864 if ($[17] !== t4 || $[18] !== t5 || $[19] !== t7) { 13865 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 13866 className: t4, 13867 children: [t5, t7] 13868 }); 13869 $[17] = t4; 13870 $[18] = t5; 13871 $[19] = t7; 13872 $[20] = t8; 13873 } else t8 = $[20]; 13874 return t8; 13875} 13876var dial_pad_default = DialPad; 13877var import_compiler_runtime$93 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 13878function VoiceMessages(t0) { 13879 const $ = (0, import_compiler_runtime$93.c)(45); 13880 const { sid, onCancel, onSend, className } = t0; 13881 const [selectedMessage, setSelectedMessage] = (0, import_react.useState)(""); 13882 const { data: voiceMessagesListResponse, isLoading, isFetching } = useGetDialerVoiceMessagesListQuery(); 13883 const [sendDialerVoiceMessage, t1] = useSendDialerVoiceMessageMutation(); 13884 const { isLoading: isSendDialerVoiceMessageLoading } = t1; 13885 let T0; 13886 let handleSend; 13887 let t2; 13888 let t3; 13889 let t4; 13890 let t5; 13891 let t6; 13892 if ($[0] !== className || $[1] !== isFetching || $[2] !== isLoading || $[3] !== onSend || $[4] !== selectedMessage || $[5] !== sendDialerVoiceMessage || $[6] !== sid || $[7] !== voiceMessagesListResponse) { 13893 const outboundVoiceList = (get(voiceMessagesListResponse, "data") ?? []).filter(_temp$19); 13894 const isEmpty = !isLoading && !isFetching && outboundVoiceList.length === 0; 13895 let t7$1; 13896 if ($[15] !== onSend || $[16] !== selectedMessage || $[17] !== sendDialerVoiceMessage || $[18] !== sid) { 13897 t7$1 = async () => { 13898 trackMethodCall("handleSend", []); 13899 if (!sid || !selectedMessage) return; 13900 await mutateWithErrorHandling(sendDialerVoiceMessage, { 13901 sid, 13902 voiceMessageId: selectedMessage, 13903 isHangup: true 13904 }, { 13905 showSuccessToast: true, 13906 successMessage: "Voice message sent successfully" 13907 }); 13908 onSend?.(selectedMessage); 13909 }; 13910 $[15] = onSend; 13911 $[16] = selectedMessage; 13912 $[17] = sendDialerVoiceMessage; 13913 $[18] = sid; 13914 $[19] = t7$1; 13915 } else t7$1 = $[19]; 13916 handleSend = t7$1; 13917 if ($[20] !== className) { 13918 t5 = cn("flex flex-col overflow-hidden rounded-lg", className); 13919 $[20] = className; 13920 $[21] = t5; 13921 } else t5 = $[21]; 13922 if ($[22] === Symbol.for("react.memo_cache_sentinel")) { 13923 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 13924 className: "border-b border-border px-4 py-3", 13925 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { 13926 className: "text-base font-semibold text-card-foreground", 13927 children: "Voice Messages" 13928 }) 13929 }); 13930 $[22] = t6; 13931 } else t6 = $[22]; 13932 t4 = "min-h-0 flex-1 overflow-hidden"; 13933 T0 = Spin; 13934 t2 = isLoading || isFetching;
13935 t3 = isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VoiceMessagesEmpty, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 13936 className: "max-h-64 overflow-y-auto px-4 py-3", 13937 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 13938 className: "mb-3 text-sm leading-5 text-muted-foreground", 13939 children: "The call will end after sending the voice message. Please send it after the prompt to ensure success." 13940 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroup, { 13941 value: selectedMessage, 13942 onValueChange: setSelectedMessage, 13943 className: "flex flex-col gap-3", 13944 children: outboundVoiceList.map(_temp2$10) 13945 })] 13946 }); 13947 $[0] = className; 13948 $[1] = isFetching; 13949 $[2] = isLoading; 13950 $[3] = onSend; 13951 $[4] = selectedMessage; 13952 $[5] = sendDialerVoiceMessage; 13953 $[6] = sid; 13954 $[7] = voiceMessagesListResponse; 13955 $[8] = T0; 13956 $[9] = handleSend; 13957 $[10] = t2; 13958 $[11] = t3; 13959 $[12] = t4; 13960 $[13] = t5; 13961 $[14] = t6; 13962 } else { 13963 T0 = $[8]; 13964 handleSend = $[9]; 13965 t2 = $[10]; 13966 t3 = $[11]; 13967 t4 = $[12]; 13968 t5 = $[13]; 13969 t6 = $[14]; 13970 } 13971 let t7; 13972 if ($[23] !== T0 || $[24] !== t2 || $[25] !== t3) { 13973 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(T0, { 13974 spinning: t2, 13975 children: t3 13976 }); 13977 $[23] = T0; 13978 $[24] = t2; 13979 $[25] = t3; 13980 $[26] = t7; 13981 } else t7 = $[26]; 13982 let t8; 13983 if ($[27] !== t4 || $[28] !== t7) { 13984 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 13985 className: t4, 13986 children: t7 13987 }); 13988 $[27] = t4; 13989 $[28] = t7; 13990 $[29] = t8; 13991 } else t8 = $[29]; 13992 let t9; 13993 if ($[30] !== isSendDialerVoiceMessageLoading || $[31] !== onCancel) { 13994 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 13995 variant: "outline", 13996 size: "sm", 13997 onClick: onCancel, 13998 disabled: isSendDialerVoiceMessageLoading, 13999 children: "Cancel" 14000 }); 14001 $[30] = isSendDialerVoiceMessageLoading; 14002 $[31] = onCancel; 14003 $[32] = t9; 14004 } else t9 = $[32]; 14005 const t10 = !selectedMessage || isSendDialerVoiceMessageLoading; 14006 let t11; 14007 if ($[33] !== handleSend || $[34] !== isSendDialerVoiceMessageLoading || $[35] !== t10) { 14008 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 14009 size: "sm", 14010 onClick: handleSend, 14011 loading: isSendDialerVoiceMessageLoading, 14012 disabled: t10, 14013 children: "Send" 14014 }); 14015 $[33] = handleSend; 14016 $[34] = isSendDialerVoiceMessageLoading; 14017 $[35] = t10; 14018 $[36] = t11; 14019 } else t11 = $[36]; 14020 let t12; 14021 if ($[37] !== t11 || $[38] !== t9) { 14022 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14023 className: "flex items-center justify-end gap-3 border-t border-border bg-white px-4 py-3", 14024 children: [t9, t11] 14025 }); 14026 $[37] = t11; 14027 $[38] = t9; 14028 $[39] = t12; 14029 } else t12 = $[39]; 14030 let t13; 14031 if ($[40] !== t12 || $[41] !== t5 || $[42] !== t6 || $[43] !== t8) { 14032 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14033 className: t5, 14034 children: [ 14035 t6, 14036 t8, 14037 t12 14038 ] 14039 }); 14040 $[40] = t12; 14041 $[41] = t5; 14042 $[42] = t6; 14043 $[43] = t8; 14044 $[44] = t13; 14045 } else t13 = $[44]; 14046 return t13; 14047} 14048function _temp2$10(message_0) { 14049 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VoiceMessageItem$1, { message: message_0 }, message_0.id); 14050} 14051function _temp$19(message) { 14052 return message.type === "outbound_voice"; 14053} 14054function VoiceMessageItem$1(t0) { 14055 const $ = (0, import_compiler_runtime$93.c)(14); 14056 const { message } = t0; 14057 const t1 = String(message.id); 14058 const t2 = String(message.id); 14059 let t3; 14060 if ($[0] !== t1 || $[1] !== t2) { 14061 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupItem, { 14062 value: t1, 14063 id: t2 14064 }); 14065 $[0] = t1; 14066 $[1] = t2; 14067 $[2] = t3; 14068 } else t3 = $[2]; 14069 const t4 = String(message.id); 14070 let t5; 14071 if ($[3] !== message.recordingName || $[4] !== t4) { 14072 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, { 14073 htmlFor: t4, 14074 className: "cursor-pointer text-sm leading-none font-medium", 14075 children: message.recordingName 14076 }); 14077 $[3] = message.recordingName; 14078 $[4] = t4; 14079 $[5] = t5; 14080 } else t5 = $[5]; 14081 let t6; 14082 if ($[6] !== t3 || $[7] !== t5) { 14083 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14084 className: "flex items-start gap-3", 14085 children: [t3, t5] 14086 }); 14087 $[6] = t3; 14088 $[7] = t5; 14089 $[8] = t6; 14090 } else t6 = $[8]; 14091 let t7; 14092 if ($[9] !== message.recordingUrl) { 14093 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(audio_player_default, { 14094 url: message.recordingUrl, 14095 className: "mb-2 h-9" 14096 }); 14097 $[9] = message.recordingUrl; 14098 $[10] = t7; 14099 } else t7 = $[10]; 14100 let t8; 14101 if ($[11] !== t6 || $[12] !== t7) { 14102 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14103 className: "flex w-full flex-col gap-2", 14104 children: [t6, t7] 14105 }); 14106 $[11] = t6; 14107 $[12] = t7; 14108 $[13] = t8; 14109 } else t8 = $[13]; 14110 return t8; 14111} 14112function VoiceMessagesEmpty() { 14113 const $ = (0, import_compiler_runtime$93.c)(2); 14114 let t0; 14115 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 14116 t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyMedia, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 14117 name: "no-result-muted", 14118 className: "size-17.5" 14119 }) }); 14120 $[0] = t0; 14121 } else t0 = $[0]; 14122 let t1; 14123 if ($[1] === Symbol.for("react.memo_cache_sentinel")) { 14124 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Empty, { 14125 className: "h-65 gap-3 border-0 px-4 py-3",
14126 children: [t0, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyTitle, { 14127 className: "text-sm font-medium text-muted-foreground", 14128 children: "No voice messages available" 14129 }) })] 14130 }); 14131 $[1] = t1; 14132 } else t1 = $[1]; 14133 return t1; 14134} 14135var voice_messages_default = VoiceMessages; 14136var callingSchema = objectType({ callNotes: stringType().optional() }); 14137var actionButtonVariants$1 = T({ 14138 base: "size-12 rounded-full transition-color active:opacity-100", 14139 variants: { 14140 isPopoverTrigger: { true: "data-[state=open]:bg-muted-foreground data-[state=open]:text-primary-foreground data-[state=open]:hover:bg-muted-foreground/80" }, 14141 active: { true: "bg-muted-foreground text-primary-foreground hover:bg-muted-foreground/80" }, 14142 isFullImage: { true: "bg-transparent transition-transform hover:scale-105 active:scale-100 active:opacity-100" } 14143 } 14144}); 14145function DialerInboundCallSheet() { 14146 const dispatch = useAppDispatch(); 14147 const isInboundOpen = useAppSelector(selectIsInboundCallSheetOpen); 14148 const isPlacingCall = useAppSelector(selectIsPlacingCall); 14149 const isOpen = isInboundOpen || isPlacingCall; 14150 const [voiceMessagesOpen, setVoiceMessagesOpen] = (0, import_react.useState)(false); 14151 const sheetContentRef = (0, import_react.useRef)(null); 14152 const form = useForm({ 14153 resolver: t$2(callingSchema), 14154 defaultValues: { callNotes: "" } 14155 }); 14156 const { data: callingData, isLoading, isMuted, handleMute, handleDialPadTap, handleHangup, callingDuration, isCallRecordingEnabled, isConnecting, setCallNote } = useDialersContext(); 14157 const [saveCallResult, { isLoading: isSavingCallResult }] = useSaveCallResultMutation(); 14158 const { sid, displayContact, displayPhone, displayAvatar, hasContactPermission, contacts, callLabel } = callingData; 14159 const handleInboundCallNotesSubmit = (_data) => { 14160 trackMethodCall("handleInboundCallNotesSubmit", [_data]); 14161 console.log(_data); 14162 }; 14163 const handleSelectedContactChange = async (contact) => { 14164 trackMethodCall("handleSelectedContactChange", [contact]); 14165 if (!contact.id || !sid) { 14166 toast.error("Please select data."); 14167 return; 14168 } 14169 const lowerCaseRole = contact.role.toLowerCase(); 14170 const params = { 14171 callSid: sid, 14172 role: roleCt[lowerCaseRole] || lowerCaseRole, 14173 personId: contact.id, 14174 contactId: contact.contactId ?? null 14175 }; 14176 await mutateWithErrorHandling(saveCallResult, params, { 14177 showSuccessToast: true, 14178 successMessage: "Call result saved successfully" 14179 }); 14180 }; 14181 const handleViewActivity = () => { 14182 trackMethodCall("handleViewActivity", []); 14183 const rect = sheetContentRef.current?.getBoundingClientRect(); 14184 if (rect) { 14185 const sourceRect = { 14186 x: rect.x, 14187 y: rect.y, 14188 width: rect.width, 14189 height: rect.height 14190 }; 14191 const data = { 14192 id: displayContact?.id ?? void 0, 14193 name: displayContact?.name ?? "Unknown", 14194 role: displayContact?.role ?? void 0, 14195 hasContactPermission, 14196 phone: displayPhone, 14197 contactId: displayContact?.contactId ?? void 0, 14198 type: "recent" 14199 }; 14200 dispatch(showNestedSheet({ 14201 sourceRect, 14202 data 14203 })); 14204 } 14205 }; 14206 (0, import_react.useEffect)(() => { 14207 form.reset({ callNotes: "" }); 14208 }, [sid, form]); 14209 const callNotes = form.watch("callNotes"); 14210 (0, import_react.useEffect)(() => { 14211 setCallNote(callNotes ?? ""); 14212 }, [callNotes, setCallNote]); 14213 (0, import_react.useEffect)(() => { 14214 if (isOpen && !isLoading && sid) handleViewActivity(); 14215 }, [ 14216 isOpen, 14217 isLoading, 14218 sid 14219 ]); 14220 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sheet, { 14221 open: isOpen, 14222 modal: false, 14223 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SheetContent, { 14224 className: "w-95 shadow-[-7px_0_24px_-3px_rgba(12,25,63,0.07)]", 14225 showCloseButton: false, 14226 disableAnimation: true, 14227 ref: sheetContentRef, 14228 children: [
vendor: 1,120 bytes, lines 14229-14254
14229 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetTitle, { 14230 className: "sr-only", 14231 children: callLabel 14232 }), 14233 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SheetDescription, { 14234 className: "sr-only", 14235 children: [ 14236 "A call from ", 14237 displayContact.name, 14238 " is inbound." 14239 ] 14240 }), 14241 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spin, { 14242 spinning: isLoading || !sid, 14243 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14244 className: "flex size-full flex-col", 14245 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { 14246 "aria-label": "Inbound call", 14247 className: "bg-radial-[at_0%_0%] from-[#1A6CFF] to-[#000814] p-5 text-primary-foreground", 14248 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { 14249 className: "flex items-center justify-between", 14250 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { 14251 className: "text-sm font-medium", 14252 children: callLabel 14253 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14254 className: "flex items-center gap-4",
14255 children: [isConnecting ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 14256 className: "text-sm font-medium", 14257 children: "Connecting..." 14258 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Badge, { 14259 variant: "destructive", 14260 className: cn("h-5 justify-between rounded-full px-1 font-medium", !isCallRecordingEnabled && "bg-transparent"), 14261 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: cn("relative size-3 animate-pulse rounded-full border-[1.3px] border-white bg-transparent before:absolute before:inset-0.5 before:rounded-full before:bg-white") }), getRecordingTimeFormatted(callingDuration)] 14262 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 14263 variant: "ghost", 14264 size: "icon-sm", 14265 className: "size-5 bg-transparent hover:bg-transparent hover:text-primary-foreground", 14266 tabIndex: -1, 14267 onClick: () => { 14268 return dispatch(showMinimizeSheet()); 14269 }, 14270 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Minimize2, { className: "size-5" }) 14271 })] 14272 })] 14273 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14274 className: "relative flex flex-col items-center justify-center gap-1 px-5 pt-6 pb-3", 14275 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14276 className: "flex flex-col items-center", 14277 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14278 className: "flex items-center justify-center gap-2", 14279 children: [ 14280 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14281 className: "flex items-center gap-1.5", 14282 children: [ 14283 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-3 w-1.5 animate-[wave_0.8s_ease-in-out_infinite] rounded-full bg-[#71A7F6] [animation-delay:0ms]" }), 14284 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-5 w-1.5 animate-[wave_0.8s_ease-in-out_infinite] rounded-full bg-[#71A7F6] [animation-delay:100ms]" }), 14285 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-3 w-1.5 animate-[wave_0.8s_ease-in-out_infinite] rounded-full bg-[#71A7F6] [animation-delay:200ms]" }), 14286 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-5 w-1.5 animate-[wave_0.8s_ease-in-out_infinite] rounded-full bg-[#71A7F6] [animation-delay:300ms]" }) 14287 ] 14288 }), 14289 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Avatar, { 14290 className: "z-0 size-16 ring-2 ring-white", 14291 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarImage, { 14292 src: displayAvatar, 14293 alt: displayAvatar 14294 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarFallback, { 14295 className: "bg-white text-lg text-slate-600", 14296 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserRound, { className: "size-10 stroke-3" }) 14297 })] 14298 }), 14299 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14300 className: "flex flex-row-reverse items-center gap-1.5", 14301 children: [ 14302 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-3 w-1.5 animate-[wave_0.8s_ease-in-out_infinite] rounded-full bg-[#71A7F6] [animation-delay:400ms]" }), 14303 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-5 w-1.5 animate-[wave_0.8s_ease-in-out_infinite] rounded-full bg-[#71A7F6] [animation-delay:500ms]" }), 14304 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-3 w-1.5 animate-[wave_0.8s_ease-in-out_infinite] rounded-full bg-[#71A7F6] [animation-delay:600ms]" }), 14305 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-5 w-1.5 animate-[wave_0.8s_ease-in-out_infinite] rounded-full bg-[#71A7F6] [animation-delay:700ms]" }) 14306 ] 14307 }) 14308 ] 14309 }), displayContact.role && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 14310 variant: "neutral-subtle", 14311 className: "z-10 -mt-1.5 bg-white text-slate-600 capitalize", 14312 children: displayContact.role.replace("_", " ") 14313 })] 14314 }
14314), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14315 className: "flex flex-col items-center", 14316 children: [ 14317 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { 14318 className: "font-semibold text-white", 14319 children: displayContact.name 14320 }), 14321 contacts.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_multiple_identities_default, { 14322 contacts, 14323 onSelectedContactChange: handleSelectedContactChange, 14324 optionLoading: isSavingCallResult, 14325 className: "mb-1" 14326 }), 14327 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 14328 className: "text-xs text-white", 14329 children: formatPhone(normalizePhone(displayPhone), "parentheses") 14330 }) 14331 ] 14332 })] 14333 })] 14334 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { 14335 "aria-label": "Call actions", 14336 className: "flex flex-1 flex-col px-5 py-6", 14337 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14338 className: "flex flex-1 flex-col gap-6", 14339 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormWrapper, { 14340 form, 14341 onSubmit: form.handleSubmit(handleInboundCallNotesSubmit, console.warn), 14342 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextareaField, { 14343 name: "callNotes", 14344 title: "Call Notes", 14345 placeholder: "Write something about this call.", 14346 className: "min-h-19 resize-none" 14347 }) 14348 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14349 className: "flex items-center gap-6", 14350 children: [ 14351 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Popover, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverTrigger, { 14352 asChild: true, 14353 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 14354 type: "button", 14355 variant: "secondary", 14356 className: actionButtonVariants$1({ isPopoverTrigger: true }), 14357 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Grip, { className: "size-5" }) 14358 }) 14359 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverContent, { 14360 className: "w-57", 14361 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dial_pad_default, { onTap: handleDialPadTap }) 14362 })] }), 14363 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 14364 type: "button", 14365 variant: "secondary", 14366 className: actionButtonVariants$1({ active: isMuted }), 14367 onClick: handleMute, 14368 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MicOff, { className: "size-5" }) 14369 }), 14370 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Popover, { 14371 open: voiceMessagesOpen, 14372 onOpenChange: setVoiceMessagesOpen, 14373 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverTrigger, { 14374 asChild: true, 14375 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 14376 type: "button", 14377 variant: "secondary", 14378 className: actionButtonVariants$1({ isPopoverTrigger: true }), 14379 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Voicemail, { className: "size-5" }) 14380 }) 14381 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PopoverContent, { 14382 className: "w-75 p-0", 14383 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(voice_messages_default, { 14384 sid, 14385 onCancel: () => { 14386 return setVoiceMessagesOpen(false); 14387 }, 14388 onSend: () => { 14389 return setVoiceMessagesOpen(false); 14390 } 14391 }) 14392 })] 14393 }), 14394 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 14395 type: "button", 14396 "aria-label": "Decline call", 14397 className: actionButtonVariants$1({ 14398 isFullImage: true, 14399 className: "ml-auto" 14400 }), 14401 onClick: handleHangup, 14402 tabIndex: -1, 14403 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 14404 name: "phone-hang-up", 14405 className: "size-12" 14406 }) 14407 }) 14408 ] 14409 })] 14410 }
14410), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 14411 className: "flex justify-center pb-10", 14412 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 14413 type: "button", 14414 size: "sm", 14415 variant: "ghost", 14416 className: "text-primary hover:bg-primary-muted hover:text-primary", 14417 onClick: handleViewActivity, 14418 children: ["View Activity", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CalendarSearch, { className: "size-4" })] 14419 }) 14420 })] 14421 })] 14422 }) 14423 }) 14424 ] 14425 }) 14426 }); 14427} 14428var dialer_inbound_call_sheet_default = DialerInboundCallSheet; 14429var import_compiler_runtime$92 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 14430var ACTIVITY_ICONS_MAPPING = { 14431 inBound: "inbound", 14432 outBound: "outbound", 14433 missed: "missed-call" 14434}; 14435function RecentActivityItem(t0) { 14436 const $ = (0, import_compiler_runtime$92.c)(21); 14437 const { activity, className } = t0; 14438 const icon = ACTIVITY_ICONS_MAPPING[activity.activityType]; 14439 let t1; 14440 if ($[0] !== activity.callTime) { 14441 t1 = safeFormatDate(activity.callTime, FORMATE_DATE_TIME_TIMEZONE); 14442 $[0] = activity.callTime; 14443 $[1] = t1; 14444 } else t1 = $[1]; 14445 const formattedDate = t1; 14446 let t2; 14447 if ($[2] !== className) { 14448 t2 = cn("mb-3 flex items-start gap-2.5", className); 14449 $[2] = className; 14450 $[3] = t2; 14451 } else t2 = $[3]; 14452 let t3; 14453 if ($[4] !== icon) { 14454 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 14455 name: icon, 14456 className: "size-4" 14457 }); 14458 $[4] = icon; 14459 $[5] = t3; 14460 } else t3 = $[5]; 14461 let t4; 14462 if ($[6] === Symbol.for("react.memo_cache_sentinel")) { 14463 t4 = getCurrentTimeZone(); 14464 $[6] = t4; 14465 } else t4 = $[6]; 14466 let t5; 14467 if ($[7] !== formattedDate) { 14468 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { 14469 className: "font-bold", 14470 children: [ 14471 formattedDate, 14472 " ", 14473 t4 14474 ] 14475 }); 14476 $[7] = formattedDate; 14477 $[8] = t5; 14478 } else t5 = $[8]; 14479 let t6; 14480 if ($[9] !== activity.outcome) { 14481 t6 = activity.outcome && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: activity.outcome }); 14482 $[9] = activity.outcome; 14483 $[10] = t6; 14484 } else t6 = $[10]; 14485 let t7; 14486 if ($[11] !== activity.note) { 14487 t7 = activity.note && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 14488 className: "text-white/50", 14489 children: activity.note 14490 }); 14491 $[11] = activity.note; 14492 $[12] = t7; 14493 } else t7 = $[12]; 14494 let t8; 14495 if ($[13] !== t5 || $[14] !== t6 || $[15] !== t7) { 14496 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14497 className: "grid flex-1 gap-1 text-xs", 14498 children: [ 14499 t5, 14500 t6, 14501 t7 14502 ] 14503 }); 14504 $[13] = t5; 14505 $[14] = t6; 14506 $[15] = t7; 14507 $[16] = t8; 14508 } else t8 = $[16]; 14509 let t9; 14510 if ($[17] !== t2 || $[18] !== t3 || $[19] !== t8) { 14511 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14512 className: t2, 14513 children: [t3, t8] 14514 }); 14515 $[17] = t2; 14516 $[18] = t3; 14517 $[19] = t8; 14518 $[20] = t9; 14519 } else t9 = $[20]; 14520 return t9; 14521} 14522var recent_activity_item_default = RecentActivityItem; 14523var import_compiler_runtime$91 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 14524function mockUnknown(call) { 14525 return { 14526 contacts: [], 14527 callRecord: { 14528 companyId: 13, 14529 userId: 13, 14530 callSid: get(call, "parameters.CallSid"), 14531 fromNumber: get(call, "parameters.From"), 14532 toNumber: get(call, "customParameters.To"), 14533 direction: get(call, "direction"), 14534 status: "called-ringing", 14535 isFinish: false, 14536 isSaveCallResult: false, 14537 duration: 0 14538 }, 14539 loadInfos: [] 14540 }; 14541} 14542function DialerIncomingCallSheet() { 14543 const $ = (0, import_compiler_runtime$91.c)(106); 14544 const dispatch = useAppDispatch(); 14545 const isOpen = useAppSelector(selectIsIncomingCallSheetOpen); 14546 const call = useAppSelector(selectCall); 14547 const sheetContentRef = (0, import_react.useRef)(null); 14548 let t0; 14549 if ($[0] !== call) { 14550 t0 = get(call, "parameters.CallSid"); 14551 $[0] = call; 14552 $[1] = t0; 14553 } else t0 = $[1]; 14554 const sid = t0; 14555 const t1 = sid; 14556 let t2; 14557 if ($[2] !== t1) { 14558 t2 = { sid: t1 }; 14559 $[2] = t1; 14560 $[3] = t2; 14561 } else t2 = $[3]; 14562 const t3 = !sid; 14563 let t4; 14564 if ($[4] !== t3) { 14565 t4 = { skip: t3 }; 14566 $[4] = t3; 14567 $[5] = t4; 14568 } else t4 = $[5]; 14569 const { data: callResultData, isLoading: isLoadingCallResult, isFetching: isFetchingCallResult } = useGetDialerCallResultQuery(t2, t4); 14570 const [saveCallResult, t5] = useSaveCallResultMutation(); 14571 const { isLoading: isSavingCallResult } = t5; 14572 let T0; 14573 let T1; 14574 let T2; 14575 let displayContact; 14576 let displayPhone; 14577 let getCurrentSheetSourceRect; 14578 let handleAnswerCall; 14579 let handleDeclineCall; 14580 let hasContactPermission; 14581 let t10; 14582 let t11; 14583 let t12; 14584 let t13; 14585 let t14; 14586 let t15; 14587 let t16; 14588 let t17; 14589 let t18; 14590 let t19; 14591 let t20; 14592 let t21; 14593 let t22; 14594 let t23; 14595 let t24; 14596 let t6; 14597 let t7; 14598 let t8; 14599 let t9; 14600 if ($[6] !== call || $[7] !== callResultData || $[8] !== dispatch || $[9] !== isFetchingCallResult || $[10] !== isLoadingCallResult || $[11] !== isOpen || $[12] !== isSavingCallResult || $[13] !== saveCallResult || $[14] !== sid) { 14601 const callResult = get(callResultData, "data") ?? mockUnknown(call); 14602 const contacts = get(callResultData, "data.contacts") ?? []; 14603 displayContact = get(contacts, "[0]", { name: "Unknown" }); 14604 const callRecord = get(callResult, "callRecord"); 14605 displayPhone = displayContact.phone ?? (callRecord.direction === "INBOUND" ? callRecord.fromNumber : callRecord.toNumber); 14606 const displayAvatar = displayContact.avatar ?? callRecord.avatar ?? ""; 14607 hasContactPermission = get(callResult, "hasContactPermission") ?? false; 14608 let t25$1; 14609 if ($[43] === Symbol.for("react.memo_cache_sentinel")) { 14610 t25$1 = () => { 14611 const rect = sheetContentRef.current?.getBoundingClientRect(); 14612 if (!rect) return; 14613 return { 14614 x: rect.x, 14615 y: rect.y, 14616 width: rect.width, 14617 height: rect.height 14618 }; 14619 }; 14620 $[43] = t25$1; 14621 } else t25$1 = $[43]; 14622 getCurrentSheetSourceRect = t25$1; 14623 let t26$1; 14624 if ($[44] !== saveCallResult || $[45] !== sid) { 14625 t26$1 = async (contact) => { 14626 trackMethodCall("handleSelectedContactChange", [contact]); 14627 if (!contact.id || !sid) { 14628 toast.error("Please select data."); 14629 return; 14630 } 14631 const lowerCaseRole = contact.role.toLowerCase(); 14632 const params = { 14633 callSid: sid, 14634 role: roleCt[lowerCaseRole] || lowerCaseRole,
14635 personId: contact.id, 14636 contactId: contact.contactId ?? null 14637 }; 14638 await mutateWithErrorHandling(saveCallResult, params, { 14639 showSuccessToast: true, 14640 successMessage: "Call result saved successfully" 14641 }); 14642 }; 14643 $[44] = saveCallResult; 14644 $[45] = sid; 14645 $[46] = t26$1; 14646 } else t26$1 = $[46]; 14647 const handleSelectedContactChange = t26$1; 14648 let t27$1; 14649 if ($[47] !== call) { 14650 t27$1 = () => { 14651 trackMethodCall("handleDeclineCall", []); 14652 if (!call) return; 14653 call.reject(); 14654 }; 14655 $[47] = call; 14656 $[48] = t27$1; 14657 } else t27$1 = $[48]; 14658 handleDeclineCall = t27$1; 14659 let t28$1; 14660 if ($[49] !== call || $[50] !== dispatch) { 14661 t28$1 = () => { 14662 trackMethodCall("handleAnswerCall", []); 14663 if (!call) return; 14664 call.accept(); 14665 dispatch(answerCall()); 14666 }; 14667 $[49] = call; 14668 $[50] = dispatch; 14669 $[51] = t28$1; 14670 } else t28$1 = $[51]; 14671 handleAnswerCall = t28$1; 14672 T2 = Sheet; 14673 t23 = isOpen; 14674 t24 = false; 14675 T1 = SheetContent; 14676 t17 = "w-95 bg-linear-to-b from-[#525962] to-[#1B1F25] text-primary-foreground shadow-[-7px_0_24px_0_rgba(12,25,63,0.08)]"; 14677 t18 = false; 14678 t19 = true; 14679 t20 = sheetContentRef; 14680 if ($[52] === Symbol.for("react.memo_cache_sentinel")) { 14681 t21 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetTitle, { 14682 className: "sr-only", 14683 children: "Incoming Call" 14684 }); 14685 $[52] = t21; 14686 } else t21 = $[52]; 14687 t22 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SheetDescription, { 14688 className: "sr-only", 14689 children: [ 14690 "A call from ", 14691 displayContact.name,
14692 " is incoming." 14693 ] 14694 }); 14695 T0 = Spin; 14696 t16 = isLoadingCallResult || isFetchingCallResult; 14697 t15 = "flex size-full flex-col"; 14698 t13 = "Incoming call"; 14699 t14 = "flex flex-1 flex-col"; 14700 t11 = "flex flex-1 flex-col items-center justify-center gap-3"; 14701 let t29$1; 14702 if ($[53] === Symbol.for("react.memo_cache_sentinel")) { 14703 t29$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarFallback, { 14704 className: "bg-white text-lg text-slate-600", 14705 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserRound, { className: "size-10 stroke-3" }) 14706 }); 14707 $[53] = t29$1; 14708 } else t29$1 = $[53]; 14709 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Avatar, { 14710 className: "size-16 ring-2 ring-white", 14711 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarImage, { 14712 src: displayAvatar, 14713 alt: displayAvatar 14714 }), t29$1] 14715 }); 14716 t6 = "flex flex-col items-center gap-1.5"; 14717 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { 14718 className: "text-2xl font-semibold text-white", 14719 children: displayContact.name 14720 }); 14721 t8 = contacts.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_multiple_identities_default, { 14722 contacts, 14723 onSelectedContactChange: handleSelectedContactChange, 14724 optionLoading: isSavingCallResult 14725 }); 14726 t9 = displayContact.role && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 14727 variant: "neutral-subtle", 14728 className: "bg-white text-slate-600 capitalize", 14729 children: displayContact.role.replace("_", " ") 14730 }); 14731 t10 = displayPhone && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 14732 className: "text-white", 14733 children: formatPhone(normalizePhone(displayPhone), "parentheses") 14734 }); 14735 $[6] = call; 14736 $[7] = callResultData; 14737 $[8] = dispatch; 14738 $[9] = isFetchingCallResult; 14739 $[10] = isLoadingCallResult; 14740 $[11] = isOpen; 14741 $[12] = isSavingCallResult; 14742 $[13] = saveCallResult; 14743 $[14] = sid; 14744 $[15] = T0; 14745 $[16] = T1; 14746 $[17] = T2; 14747 $[18] = displayContact; 14748 $[19] = displayPhone; 14749 $[20] = getCurrentSheetSourceRect; 14750 $[21] = handleAnswerCall; 14751 $[22] = handleDeclineCall; 14752 $[23] = hasContactPermission; 14753 $[24] = t10; 14754 $[25] = t11; 14755 $[26] = t12; 14756 $[27] = t13; 14757 $[28] = t14; 14758 $[29] = t15; 14759 $[30] = t16; 14760 $[31] = t17; 14761 $[32] = t18; 14762 $[33] = t19; 14763 $[34] = t20; 14764 $[35] = t21; 14765 $[36] = t22; 14766 $[37] = t23; 14767 $[38] = t24; 14768 $[39] = t6; 14769 $[40] = t7; 14770 $[41] = t8; 14771 $[42] = t9; 14772 } else { 14773 T0 = $[15]; 14774 T1 = $[16]; 14775 T2 = $[17]; 14776 displayContact = $[18]; 14777 displayPhone = $[19]; 14778 getCurrentSheetSourceRect = $[20]; 14779 handleAnswerCall = $[21]; 14780 handleDeclineCall = $[22]; 14781 hasContactPermission = $[23]; 14782 t10 = $[24]; 14783 t11 = $[25]; 14784 t12 = $[26]; 14785 t13 = $[27]; 14786 t14 = $[28]; 14787 t15 = $[29]; 14788 t16 = $[30]; 14789 t17 = $[31]; 14790 t18 = $[32]; 14791 t19 = $[33]; 14792 t20 = $[34]; 14793 t21 = $[35]; 14794 t22 = $[36]; 14795 t23 = $[37]; 14796 t24 = $[38]; 14797 t6 = $[39]; 14798 t7 = $[40]; 14799 t8 = $[41]; 14800 t9 = $[42]; 14801 } 14802 let t25; 14803 if ($[54] !== t10 || $[55] !== t6 || $[56] !== t7 || $[57] !== t8 || $[58] !== t9) { 14804 t25 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14805 className: t6, 14806 children: [ 14807 t7, 14808 t8, 14809 t9, 14810 t10 14811 ] 14812 }); 14813 $[54] = t10; 14814 $[55] = t6; 14815 $[56] = t7; 14816 $[57] = t8; 14817 $[58] = t9; 14818 $[59] = t25; 14819 } else t25 = $[59]; 14820 let t26; 14821 if ($[60] !== t11 || $[61] !== t12 || $[62] !== t25) { 14822 t26 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14823 className: t11, 14824 children: [t12, t25] 14825 }); 14826 $[60] = t11; 14827 $[61] = t12; 14828 $[62] = t25; 14829 $[63] = t26; 14830 } else t26 = $[63]; 14831 let t27; 14832 if ($[64] === Symbol.for("react.memo_cache_sentinel")) { 14833 t27 = cn("flex items-center justify-center gap-22.5 pb-8 transition-[padding] duration-300", "pb-8"); 14834 $[64] = t27; 14835 } else t27 = $[64]; 14836 let t28; 14837 if ($[65] === Symbol.for("react.memo_cache_sentinel")) { 14838 t28 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 14839 name: "phone-hang-up", 14840 className: "size-15" 14841 }); 14842 $[65] = t28; 14843 } else t28 = $[65]; 14844 let t29; 14845 if ($[66] !== handleDeclineCall) { 14846 t29 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 14847 type: "button", 14848 "aria-label": "Decline call", 14849 className: "size-15 rounded-full bg-transparent transition-transform hover:scale-105 active:scale-100 active:opacity-100", 14850 onClick: handleDeclineCall, 14851 tabIndex: -1, 14852 children: t28 14853 }); 14854 $[66] = handleDeclineCall; 14855 $[67] = t29; 14856 } else t29 = $[67]; 14857 let t30; 14858 if ($[68] === Symbol.for("react.memo_cache_sentinel")) { 14859 t30 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 14860 name: "phone-answer", 14861 className: "size-15" 14862 }); 14863 $[68] = t30; 14864 } else t30 = $[68]; 14865 let t31; 14866 if ($[69] !== handleAnswerCall) { 14867 t31 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 14868 type: "button", 14869 "aria-label": "Answer call", 14870 className: "size-15 rounded-full bg-transparent transition-transform hover:scale-105 active:scale-100 active:opacity-100", 14871 onClick: handleAnswerCall, 14872 children: t30 14873 }); 14874 $[69] = handleAnswerCall; 14875 $[70] = t31; 14876 } else t31 = $[70]; 14877 let t32; 14878 if ($[71] !== t29 || $[72] !== t31) { 14879 t32 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14880 className: t27, 14881 children: [t29, t31] 14882 }); 14883 $[71] = t29; 14884 $[72] = t31; 14885 $[73] = t32; 14886 } else t32 = $[73]; 14887 let t33; 14888 if ($[74] !== t13 || $[75] !== t14 || $[76] !== t26 || $[77] !== t32) { 14889 t33 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { 14890 "aria-label": t13, 14891 className: t14, 14892 children: [t26, t32] 14893 }); 14894 $[74] = t13; 14895 $[75] = t14; 14896 $[76] = t26; 14897 $[77] = t32; 14898 $[78] = t33; 14899 } else t33 = $[78]; 14900 let t34; 14901 if ($[79] !== displayContact || $[80] !== displayPhone || $[81] !== getCurrentSheetSourceRect || $[82] !== hasContactPermission) { 14902 t34 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RecentActivities, {
14903 phone: displayPhone, 14904 hasContactPermission, 14905 contact: displayContact, 14906 getCurrentSheetSourceRect 14907 }); 14908 $[79] = displayContact; 14909 $[80] = displayPhone; 14910 $[81] = getCurrentSheetSourceRect; 14911 $[82] = hasContactPermission; 14912 $[83] = t34; 14913 } else t34 = $[83]; 14914 let t35; 14915 if ($[84] !== t15 || $[85] !== t33 || $[86] !== t34) { 14916 t35 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 14917 className: t15, 14918 children: [t33, t34] 14919 }); 14920 $[84] = t15; 14921 $[85] = t33; 14922 $[86] = t34; 14923 $[87] = t35; 14924 } else t35 = $[87]; 14925 let t36; 14926 if ($[88] !== T0 || $[89] !== t16 || $[90] !== t35) { 14927 t36 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(T0, { 14928 spinning: t16, 14929 children: t35 14930 }); 14931 $[88] = T0; 14932 $[89] = t16; 14933 $[90] = t35; 14934 $[91] = t36; 14935 } else t36 = $[91]; 14936 let t37; 14937 if ($[92] !== T1 || $[93] !== t17 || $[94] !== t18 || $[95] !== t19 || $[96] !== t20 || $[97] !== t21 || $[98] !== t22 || $[99] !== t36) { 14938 t37 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(T1, { 14939 className: t17, 14940 showCloseButton: t18, 14941 disableAnimation: t19, 14942 ref: t20, 14943 children: [ 14944 t21, 14945 t22, 14946 t36 14947 ] 14948 }); 14949 $[92] = T1; 14950 $[93] = t17; 14951 $[94] = t18; 14952 $[95] = t19; 14953 $[96] = t20; 14954 $[97] = t21; 14955 $[98] = t22; 14956 $[99] = t36; 14957 $[100] = t37; 14958 } else t37 = $[100]; 14959 let t38; 14960 if ($[101] !== T2 || $[102] !== t23 || $[103] !== t24 || $[104] !== t37) { 14961 t38 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(T2, { 14962 open: t23, 14963 modal: t24, 14964 children: t37 14965 }); 14966 $[101] = T2; 14967 $[102] = t23; 14968 $[103] = t24; 14969 $[104] = t37; 14970 $[105] = t38; 14971 } else t38 = $[105]; 14972 return t38; 14973} 14974function RecentActivities(t0) { 14975 const $ = (0, import_compiler_runtime$91.c)(48); 14976 const { hasContactPermission, contact, phone, getCurrentSheetSourceRect } = t0; 14977 const dispatch = useAppDispatch(); 14978 let t1; 14979 let t2; 14980 let t3; 14981 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 14982 t1 = [ 14983 "inBound", 14984 "outBound", 14985 "missed" 14986 ]; 14987 t2 = startOfDay(subDays(/* @__PURE__ */ new Date(), 7)).getTime(); 14988 t3 = endOfDay(/* @__PURE__ */ new Date()).getTime(); 14989 $[0] = t1; 14990 $[1] = t2; 14991 $[2] = t3; 14992 } else { 14993 t1 = $[0]; 14994 t2 = $[1]; 14995 t3 = $[2]; 14996 } 14997 const t4 = phone ?? ""; 14998 let t5; 14999 if ($[3] !== t4) { 15000 t5 = { 15001 callType: t1, 15002 fromDate: t2, 15003 toDate: t3, 15004 size: 100, 15005 phone: t4 15006 }; 15007 $[3] = t4; 15008 $[4] = t5; 15009 } else t5 = $[4]; 15010 const t6 = !phone; 15011 let t7; 15012 if ($[5] !== t6) { 15013 t7 = { skip: t6 }; 15014 $[5] = t6; 15015 $[6] = t7; 15016 } else t7 = $[6]; 15017 const { data } = useGetDialerActivitiesInDialogInfiniteQuery(t5, t7); 15018 let t10; 15019 let t11; 15020 let t12; 15021 let t13; 15022 let t14; 15023 let t8; 15024 let t9; 15025 if ($[7] !== contact?.contactId || $[8] !== contact?.id || $[9] !== contact?.name || $[10] !== contact?.role || $[11] !== data || $[12] !== dispatch || $[13] !== getCurrentSheetSourceRect || $[14] !== hasContactPermission || $[15] !== phone) { 15026 const activities = (get(data, "pages") ?? []).flatMap(_temp$18) ?? []; 15027 let t15$1; 15028 if ($[23] !== contact?.contactId || $[24] !== contact?.id || $[25] !== contact?.name || $[26] !== contact?.role || $[27] !== dispatch || $[28] !== getCurrentSheetSourceRect || $[29] !== hasContactPermission || $[30] !== phone) { 15029 t15$1 = () => { 15030 trackMethodCall("handleViewActivity", []); 15031 const sourceRect = getCurrentSheetSourceRect(); 15032 if (sourceRect) { 15033 const data_0 = { 15034 id: contact?.id ?? void 0, 15035 name: contact?.name ?? "Unknown", 15036 role: contact?.role ?? void 0, 15037 hasContactPermission, 15038 phone, 15039 contactId: contact?.contactId ?? void 0, 15040 type: "recent" 15041 }; 15042 dispatch(showNestedSheet({ 15043 sourceRect, 15044 data: data_0 15045 })); 15046 } 15047 }; 15048 $[23] = contact?.contactId; 15049 $[24] = contact?.id; 15050 $[25] = contact?.name; 15051 $[26] = contact?.role; 15052 $[27] = dispatch; 15053 $[28] = getCurrentSheetSourceRect; 15054 $[29] = hasContactPermission; 15055 $[30] = phone; 15056 $[31] = t15$1; 15057 } else t15$1 = $[31]; 15058 const handleViewActivity = t15$1; 15059 t12 = "Recent Activity"; 15060 if ($[32] === Symbol.for("react.memo_cache_sentinel")) { 15061 t13 = cn("flex flex-col bg-[#32353B] px-5 transition-[height] duration-300", "h-70"); 15062 $[32] = t13; 15063 } else t13 = $[32]; 15064 let t16$1; 15065 if ($[33] === Symbol.for("react.memo_cache_sentinel")) { 15066 t16$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { 15067 className: "text-sm font-semibold", 15068 children: "Recent Activity" 15069 }); 15070 $[33] = t16$1; 15071 } else t16$1 = $[33]; 15072 let t17; 15073 if ($[34] === Symbol.for("react.memo_cache_sentinel")) { 15074 t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CalendarSearch, { className: "size-4" }); 15075 $[34] = t17; 15076 } else t17 = $[34]; 15077 if ($[35] !== handleViewActivity) { 15078 t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { 15079 className: "flex h-13 items-center justify-between border-b border-white/20 py-4",
15080 children: [t16$1, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 15081 type: "button", 15082 variant: "ghost", 15083 onClick: handleViewActivity, 15084 children: ["View Activity", t17] 15085 })] 15086 }); 15087 $[35] = handleViewActivity; 15088 $[36] = t14; 15089 } else t14 = $[36]; 15090 t8 = "flex min-h-0 flex-1 flex-col gap-3 pt-3"; 15091 if ($[37] === Symbol.for("react.memo_cache_sentinel")) { 15092 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 15093 className: "shrink-0 text-xs leading-normal", 15094 children: "Most recent activity from the past week are displayed here." 15095 }); 15096 $[37] = t9; 15097 } else t9 = $[37]; 15098 t10 = activities.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 15099 className: "flex flex-1 items-center justify-center", 15100 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 15101 name: "no-result", 15102 className: "size-25" 15103 }) 15104 }); 15105 t11 = activities.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 15106 className: "min-h-0 flex-1", 15107 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 15108 className: "h-full overflow-y-auto", 15109 children: activities.map(_temp2$9) 15110 }) 15111 }); 15112 $[7] = contact?.contactId; 15113 $[8] = contact?.id; 15114 $[9] = contact?.name; 15115 $[10] = contact?.role; 15116 $[11] = data; 15117 $[12] = dispatch; 15118 $[13] = getCurrentSheetSourceRect; 15119 $[14] = hasContactPermission; 15120 $[15] = phone; 15121 $[16] = t10; 15122 $[17] = t11; 15123 $[18] = t12; 15124 $[19] = t13; 15125 $[20] = t14; 15126 $[21] = t8; 15127 $[22] = t9; 15128 } else { 15129 t10 = $[16]; 15130 t11 = $[17]; 15131 t12 = $[18]; 15132 t13 = $[19]; 15133 t14 = $[20]; 15134 t8 = $[21]; 15135 t9 = $[22]; 15136 } 15137 let t15; 15138 if ($[38] !== t10 || $[39] !== t11 || $[40] !== t8 || $[41] !== t9) { 15139 t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 15140 className: t8, 15141 children: [ 15142 t9, 15143 t10, 15144 t11 15145 ] 15146 }); 15147 $[38] = t10; 15148 $[39] = t11; 15149 $[40] = t8; 15150 $[41] = t9; 15151 $[42] = t15; 15152 } else t15 = $[42]; 15153 let t16; 15154 if ($[43] !== t12 || $[44] !== t13 || $[45] !== t14 || $[46] !== t15) { 15155 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { 15156 "aria-label": t12, 15157 className: t13, 15158 children: [t14, t15] 15159 }); 15160 $[43] = t12; 15161 $[44] = t13; 15162 $[45] = t14; 15163 $[46] = t15; 15164 $[47] = t16; 15165 } else t16 = $[47]; 15166 return t16; 15167} 15168function _temp2$9(activity) { 15169 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(recent_activity_item_default, { activity }, activity.id); 15170} 15171function _temp$18(page) { 15172 return get(page, "data") ?? []; 15173} 15174var dialer_incoming_call_sheet_default = DialerIncomingCallSheet; 15175var VIEWPORT_PADDING = 8; 15176function useDraggable() { 15177 const [position, setPosition] = (0, import_react.useState)(null); 15178 const offsetRef = (0, import_react.useRef)({ 15179 x: 0, 15180 y: 0 15181 }); 15182 const sizeRef = (0, import_react.useRef)({ 15183 width: 0, 15184 height: 0 15185 }); 15186 const draggingRef = (0, import_react.useRef)(false); 15187 const handlePointerMove = (0, import_react.useCallback)((event) => { 15188 if (!draggingRef.current) return; 15189 const { width, height } = sizeRef.current; 15190 const maxX = Math.max(window.innerWidth - width - VIEWPORT_PADDING, VIEWPORT_PADDING); 15191 const maxY = Math.max(window.innerHeight - height - VIEWPORT_PADDING, VIEWPORT_PADDING); 15192 const x = Math.min(Math.max(event.clientX - offsetRef.current.x, VIEWPORT_PADDING), maxX); 15193 const y = Math.min(Math.max(event.clientY - offsetRef.current.y, VIEWPORT_PADDING), maxY); 15194 setPosition({ 15195 x, 15196 y 15197 }); 15198 }, []); 15199 const handlePointerUp = (0, import_react.useCallback)(() => { 15200 draggingRef.current = false; 15201 window.removeEventListener("pointermove", handlePointerMove); 15202 window.removeEventListener("pointerup", handlePointerUp); 15203 document.body.style.userSelect = ""; 15204 }, [handlePointerMove]); 15205 const onPointerDown = (0, import_react.useCallback)((event_0) => { 15206 if (event_0.button !== 0) return; 15207 const rect = event_0.currentTarget.getBoundingClientRect(); 15208 offsetRef.current = { 15209 x: event_0.clientX - rect.left, 15210 y: event_0.clientY - rect.top 15211 }; 15212 sizeRef.current = { 15213 width: rect.width, 15214 height: rect.height 15215 }; 15216 draggingRef.current = true; 15217 document.body.style.userSelect = "none"; 15218 window.addEventListener("pointermove", handlePointerMove); 15219 window.addEventListener("pointerup", handlePointerUp); 15220 }, [handlePointerMove, handlePointerUp]); 15221 (0, import_react.useEffect)(() => { 15222 return () => { 15223 window.removeEventListener("pointermove", handlePointerMove); 15224 window.removeEventListener("pointerup", handlePointerUp); 15225 document.body.style.userSelect = ""; 15226 }; 15227 }, [handlePointerMove, handlePointerUp]); 15228 return { 15229 style: position ? { 15230 left: position.x, 15231 top: position.y, 15232 right: "auto", 15233 bottom: "auto" 15234 } : void 0, 15235 onPointerDown 15236 }; 15237} 15238var import_compiler_runtime$90 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 15239var actionButtonVariants = T({ 15240 base: "size-8 rounded-full transition-colors", 15241 variants: { variant: { 15242 ghost: "bg-white/10 hover:bg-white/20 text-white data-[state=muted]:bg-white data-[state=muted]:text-primary data-[state=muted]:hover:bg-white/90 active:opacity-100", 15243 hangup: "bg-transparent p-0 hover:scale-105 active:scale-100 transition-transform" 15244 } } 15245}); 15246function DialerMinimizeSheet() { 15247 const $ = (0, import_compiler_runtime$90.c)(63); 15248 const dispatch = useAppDispatch(); 15249 const isOpen = useAppSelector(selectIsMinimizeSheetOpen); 15250 const { data: callingData, isMuted, callingDuration, handleMute, handleHangup, isCallRecordingEnabled, isConnecting } = useDialersContext(); 15251 const currentCall = useAppSelector(selectCall); 15252 const { displayContact, displayAvatar, callLabel } = callingData; 15253 const { style: dragStyle, onPointerDown } = useDraggable(); 15254 let t0; 15255 if ($[0] !== onPointerDown) { 15256 t0 = (event) => { 15257 trackMethodCall("handlePointerDown", [event]); 15258 if (event.target.closest("button")) return; 15259 onPointerDown(event); 15260 }; 15261 $[0] = onPointerDown; 15262 $[1] = t0; 15263 } else t0 = $[1]; 15264 const handlePointerDown = t0; 15265 let t1; 15266 let t2; 15267 if ($[2] === Symbol.for("react.memo_cache_sentinel")) { 15268 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetTitle, { 15269 className: "sr-only",
15270 children: "Minimize" 15271 }); 15272 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetDescription, { 15273 className: "sr-only", 15274 children: "Minimized dialer view." 15275 }); 15276 $[2] = t1; 15277 $[3] = t2; 15278 } else { 15279 t1 = $[2]; 15280 t2 = $[3]; 15281 } 15282 let t3; 15283 if ($[4] !== callLabel) { 15284 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 15285 className: "text-xs font-medium", 15286 children: callLabel 15287 }); 15288 $[4] = callLabel; 15289 $[5] = t3; 15290 } else t3 = $[5]; 15291 let t4; 15292 if ($[6] !== callingDuration || $[7] !== isCallRecordingEnabled || $[8] !== isConnecting) { 15293 t4 = isConnecting ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 15294 className: "text-xs font-semibold", 15295 children: "Connecting..." 15296 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Badge, { 15297 variant: "destructive", 15298 className: cn("h-5 justify-between rounded-full px-1 font-medium", !isCallRecordingEnabled && "bg-transparent"), 15299 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: cn("relative size-3 animate-pulse rounded-full border-[1.3px] border-white bg-transparent before:absolute before:inset-0.5 before:rounded-full before:bg-white") }), getRecordingTimeFormatted(callingDuration)] 15300 }); 15301 $[6] = callingDuration; 15302 $[7] = isCallRecordingEnabled; 15303 $[8] = isConnecting; 15304 $[9] = t4; 15305 } else t4 = $[9]; 15306 let t5; 15307 if ($[10] !== currentCall || $[11] !== dispatch) { 15308 t5 = () => dispatch(showInboundCallSheet(currentCall)); 15309 $[10] = currentCall; 15310 $[11] = dispatch; 15311 $[12] = t5; 15312 } else t5 = $[12]; 15313 let t6; 15314 if ($[13] === Symbol.for("react.memo_cache_sentinel")) { 15315 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Maximize2, { className: "size-4" }); 15316 $[13] = t6; 15317 } else t6 = $[13]; 15318 let t7; 15319 if ($[14] !== t5) { 15320 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 15321 variant: "ghost", 15322 size: "icon", 15323 className: "size-4 bg-transparent p-0 hover:bg-transparent hover:text-white/80", 15324 onClick: t5, 15325 "aria-label": "Expand dialer", 15326 children: t6 15327 }); 15328 $[14] = t5; 15329 $[15] = t7; 15330 } else t7 = $[15]; 15331 let t8; 15332 if ($[16] !== t4 || $[17] !== t7) { 15333 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 15334 className: "flex items-center gap-3", 15335 children: [t4, t7] 15336 }); 15337 $[16] = t4; 15338 $[17] = t7; 15339 $[18] = t8; 15340 } else t8 = $[18]; 15341 let t9; 15342 if ($[19] !== t3 || $[20] !== t8) { 15343 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { 15344 className: "flex items-center justify-between", 15345 children: [t3, t8] 15346 }); 15347 $[19] = t3; 15348 $[20] = t8; 15349 $[21] = t9; 15350 } else t9 = $[21]; 15351 let t10; 15352 if ($[22] !== displayAvatar) { 15353 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarImage, { 15354 src: displayAvatar, 15355 alt: displayAvatar 15356 }); 15357 $[22] = displayAvatar; 15358 $[23] = t10; 15359 } else t10 = $[23]; 15360 let t11; 15361 if ($[24] === Symbol.for("react.memo_cache_sentinel")) { 15362 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarFallback, { 15363 className: "bg-white text-lg text-slate-600", 15364 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserRound, { className: "size-6 stroke-3" }) 15365 }); 15366 $[24] = t11; 15367 } else t11 = $[24]; 15368 let t12; 15369 if ($[25] !== t10) { 15370 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Avatar, { 15371 className: "size-8 ring-2 ring-white", 15372 children: [t10, t11] 15373 }); 15374 $[25] = t10; 15375 $[26] = t12; 15376 } else t12 = $[26]; 15377 let t13; 15378 if ($[27] !== displayContact.name) { 15379 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipOverflowTrigger, { 15380 asChild: true, 15381 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 15382 className: "max-w-34 truncate font-bold text-white", 15383 children: displayContact.name 15384 }) 15385 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: displayContact.name })] }); 15386 $[27] = displayContact.name; 15387 $[28] = t13; 15388 } else t13 = $[28]; 15389 let t14; 15390 if ($[29] !== displayContact.role) { 15391 t14 = displayContact.role && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 15392 className: "text-white/70 capitalize", 15393 children: displayContact.role.replace("_", " ") 15394 }); 15395 $[29] = displayContact.role; 15396 $[30] = t14; 15397 } else t14 = $[30]; 15398 let t15; 15399 if ($[31] !== t13 || $[32] !== t14) { 15400 t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 15401 className: "flex flex-col text-xs leading-tight", 15402 children: [t13, t14] 15403 }); 15404 $[31] = t13; 15405 $[32] = t14; 15406 $[33] = t15; 15407 } else t15 = $[33]; 15408 let t16; 15409 if ($[34] !== t12 || $[35] !== t15) { 15410 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 15411 className: "flex flex-1 items-center gap-2.5", 15412 children: [t12, t15] 15413 }); 15414 $[34] = t12; 15415 $[35] = t15; 15416 $[36] = t16; 15417 } else t16 = $[36]; 15418 const t17 = isMuted ? "Unmute" : "Mute"; 15419 const t18 = isMuted ? "muted" : "unmuted"; 15420 let t19; 15421 if ($[37] === Symbol.for("react.memo_cache_sentinel")) { 15422 t19 = actionButtonVariants({ variant: "ghost" }); 15423 $[37] = t19; 15424 } else t19 = $[37]; 15425 let t20; 15426 if ($[38] === Symbol.for("react.memo_cache_sentinel")) { 15427 t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MicOff, { className: "size-4" }); 15428 $[38] = t20; 15429 } else t20 = $[38]; 15430 let t21; 15431 if ($[39] !== handleMute || $[40] !== t17 || $[41] !== t18) { 15432 t21 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 15433 "aria-label": t17, 15434 "data-state": t18, 15435 type: "button", 15436 variant: "ghost", 15437 className: t19, 15438 onClick: handleMute, 15439 children: t20 15440 }); 15441 $[39] = handleMute; 15442 $[40] = t17; 15443 $[41] = t18; 15444 $[42] = t21; 15445 } else t21 = $[42]; 15446 let t22; 15447 if ($[43] === Symbol.for("react.memo_cache_sentinel")) { 15448 t22 = actionButtonVariants({ variant: "hangup" }); 15449 $[43] = t22; 15450 } else t22 = $[43]; 15451 let t23; 15452 if ($[44] === Symbol.for("react.memo_cache_sentinel")) { 15453 t23 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 15454 name: "phone-hang-up", 15455 className: "size-8" 15456 }); 15457 $[44] = t23; 15458 } else t23 = $[44]; 15459 let t24; 15460 if ($[45] !== handleHangup) { 15461 t24 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 15462 "aria-label": "End call", 15463 type: "button", 15464 className: t22, 15465 onClick: handleHangup, 15466 children: t23 15467 }); 15468 $[45] = handleHangup; 15469 $[46] = t24; 15470 } else t24 = $[46]; 15471 let t25; 15472 if ($[47] !== t21 || $[48] !== t24) { 15473 t25 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 15474 className: "flex items-center gap-2", 15475 children: [t21, t24] 15476 }); 15477 $[47] = t21; 15478 $[48] = t24; 15479 $[49] = t25; 15480 } else t25 = $[49]; 15481 let t26; 15482 if ($[50] !== t16 || $[51] !== t25) { 15483 t26 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 15484 className: "flex items-center justify-between gap-4", 15485 children: [t16, t25] 15486 }); 15487 $[50] = t16; 15488 $[51] = t25; 15489 $[52] = t26; 15490 } else t26 = $[52]; 15491 let t27; 15492 if ($[53] !== t26 || $[54] !== t9) { 15493 t27 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 15494 className: "flex flex-col gap-3", 15495 children: [t9, t26] 15496 }); 15497 $[53] = t26; 15498 $[54] = t9; 15499 $[55] = t27; 15500 } else t27 = $[55]; 15501 let t28; 15502 if ($[56] !== dragStyle || $[57] !== handlePointerDown || $[58] !== t27) { 15503 t28 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SheetShrinkContent, {
15504 showCloseButton: false, 15505 disableAnimation: true, 15506 style: dragStyle, 15507 onPointerDown: handlePointerDown, 15508 className: "w-75 cursor-move touch-none bg-radial-[at_0%_0%] from-[#446CB3] to-[#073068] px-4 pt-3 pb-4 text-white select-none", 15509 children: [ 15510 t1, 15511 t2, 15512 t27 15513 ] 15514 }); 15515 $[56] = dragStyle; 15516 $[57] = handlePointerDown; 15517 $[58] = t27; 15518 $[59] = t28; 15519 } else t28 = $[59]; 15520 let t29; 15521 if ($[60] !== isOpen || $[61] !== t28) { 15522 t29 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sheet, { 15523 open: isOpen, 15524 modal: false, 15525 children: t28 15526 }); 15527 $[60] = isOpen; 15528 $[61] = t28; 15529 $[62] = t29; 15530 } else t29 = $[62]; 15531 return t29; 15532} 15533var dialer_minimize_sheet_default = DialerMinimizeSheet; 15534var import_compiler_runtime$89 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 15535const DialerNoPackageDialog = (t0) => { 15536 const $ = (0, import_compiler_runtime$89.c)(16); 15537 const { open, onOpenChange } = t0; 15538 let t1; 15539 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 15540 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 15541 className: "flex items-center gap-3", 15542 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 15543 name: "info", 15544 className: "size-6" 15545 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogTitle, { 15546 className: "text-base font-medium", 15547 children: "Dialer - No Call Package Reminders" 15548 })] 15549 }); 15550 $[0] = t1; 15551 } else t1 = $[0]; 15552 let t2; 15553 if ($[1] !== onOpenChange) { 15554 t2 = () => onOpenChange?.(false); 15555 $[1] = onOpenChange; 15556 $[2] = t2; 15557 } else t2 = $[2]; 15558 let t3; 15559 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 15560 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { className: "size-4" }); 15561 $[3] = t3; 15562 } else t3 = $[3]; 15563 let t4; 15564 if ($[4] !== t2) { 15565 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 15566 className: "flex items-center justify-between gap-3", 15567 children: [t1, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 15568 variant: "ghost", 15569 size: "icon", 15570 className: "size-6 shrink-0", 15571 "aria-label": "Close", 15572 onClick: t2, 15573 children: t3 15574 })] 15575 }) }); 15576 $[4] = t2; 15577 $[5] = t4; 15578 } else t4 = $[5]; 15579 let t5; 15580 if ($[6] === Symbol.for("react.memo_cache_sentinel")) { 15581 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogDescription, { 15582 className: "ml-9 w-75", 15583 children: "You have not purchased/assigned the call package, Please contact the administrator to purchase/assign." 15584 }); 15585 $[6] = t5; 15586 } else t5 = $[6]; 15587 let t6; 15588 if ($[7] !== onOpenChange) { 15589 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogFooter, { 15590 className: "mt-4", 15591 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogAction, { 15592 size: "sm", 15593 onClick: () => onOpenChange?.(false), 15594 children: "Got It" 15595 }) 15596 }); 15597 $[7] = onOpenChange; 15598 $[8] = t6; 15599 } else t6 = $[8]; 15600 let t7; 15601 if ($[9] !== t4 || $[10] !== t6) { 15602 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogContent, { 15603 className: "w-100 gap-1 p-4", 15604 children: [ 15605 t4, 15606 t5, 15607 t6 15608 ] 15609 }); 15610 $[9] = t4; 15611 $[10] = t6; 15612 $[11] = t7; 15613 } else t7 = $[11]; 15614 let t8; 15615 if ($[12] !== onOpenChange || $[13] !== open || $[14] !== t7) { 15616 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialog, { 15617 open, 15618 onOpenChange, 15619 children: t7 15620 }); 15621 $[12] = onOpenChange; 15622 $[13] = open; 15623 $[14] = t7; 15624 $[15] = t8; 15625 } else t8 = $[15]; 15626 return t8; 15627}; 15628var import_compiler_runtime$88 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 15629var MANAGE_SEATS = "/settings/subscription-and-billing/manage-seats"; 15630const DialerNoPackageAdminDialog = (t0) => { 15631 const $ = (0, import_compiler_runtime$88.c)(24); 15632 const { open, onOpenChange } = t0; 15633 const navigate = useNavigate(); 15634 let t1; 15635 if ($[0] !== navigate || $[1] !== onOpenChange) { 15636 t1 = () => { 15637 trackMethodCall("handleToSubscribe", []); 15638 onOpenChange?.(false); 15639 navigate(MANAGE_SEATS); 15640 }; 15641 $[0] = navigate; 15642 $[1] = onOpenChange; 15643 $[2] = t1; 15644 } else t1 = $[2]; 15645 const handleToSubscribe = t1; 15646 let t2; 15647 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 15648 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 15649 className: "flex items-center gap-3", 15650 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 15651 name: "info", 15652 className: "size-6" 15653 }
15653), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogTitle, { 15654 className: "text-base font-medium", 15655 children: "Dialer - No Call Package Reminders" 15656 })] 15657 }); 15658 $[3] = t2; 15659 } else t2 = $[3]; 15660 let t3; 15661 if ($[4] !== onOpenChange) { 15662 t3 = () => onOpenChange?.(false); 15663 $[4] = onOpenChange; 15664 $[5] = t3; 15665 } else t3 = $[5]; 15666 let t4; 15667 if ($[6] === Symbol.for("react.memo_cache_sentinel")) { 15668 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { className: "size-4" }); 15669 $[6] = t4; 15670 } else t4 = $[6]; 15671 let t5; 15672 if ($[7] !== t3) { 15673 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 15674 className: "flex items-center justify-between gap-3", 15675 children: [t2, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 15676 variant: "ghost", 15677 size: "icon", 15678 className: "size-6 shrink-0", 15679 "aria-label": "Close", 15680 onClick: t3, 15681 children: t4 15682 })] 15683 }) }); 15684 $[7] = t3; 15685 $[8] = t5; 15686 } else t5 = $[8]; 15687 let t6; 15688 if ($[9] === Symbol.for("react.memo_cache_sentinel")) { 15689 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogDescription, { 15690 className: "ml-9 w-75", 15691 children: "You have not purchased/assigned the call package, Please purchase it." 15692 }); 15693 $[9] = t6; 15694 } else t6 = $[9]; 15695 let t7; 15696 if ($[10] !== onOpenChange) { 15697 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogCancel, { 15698 size: "sm", 15699 onClick: () => onOpenChange?.(false), 15700 children: "CANCEL" 15701 }); 15702 $[10] = onOpenChange; 15703 $[11] = t7; 15704 } else t7 = $[11]; 15705 let t8; 15706 if ($[12] !== handleToSubscribe) { 15707 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogAction, { 15708 size: "sm", 15709 onClick: handleToSubscribe, 15710 children: "TO SUBSCRIBE" 15711 }); 15712 $[12] = handleToSubscribe; 15713 $[13] = t8; 15714 } else t8 = $[13]; 15715 let t9; 15716 if ($[14] !== t7 || $[15] !== t8) { 15717 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogFooter, { 15718 className: "mt-4", 15719 children: [t7, t8] 15720 }); 15721 $[14] = t7; 15722 $[15] = t8; 15723 $[16] = t9; 15724 } else t9 = $[16]; 15725 let t10; 15726 if ($[17] !== t5 || $[18] !== t9) { 15727 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogContent, { 15728 className: "w-100 gap-1 p-4", 15729 children: [ 15730 t5, 15731 t6, 15732 t9 15733 ] 15734 }); 15735 $[17] = t5; 15736 $[18] = t9; 15737 $[19] = t10; 15738 } else t10 = $[19]; 15739 let t11; 15740 if ($[20] !== onOpenChange || $[21] !== open || $[22] !== t10) { 15741 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialog, { 15742 open, 15743 onOpenChange, 15744 children: t10 15745 }); 15746 $[20] = onOpenChange; 15747 $[21] = open; 15748 $[22] = t10; 15749 $[23] = t11; 15750 } else t11 = $[23]; 15751 return t11; 15752}; 15753var import_compiler_runtime$87 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 15754var SUBSCRIPTION_PATH$1 = "/settings/subscription-and-billing"; 15755const DialerBasicLessThan15MinsDialog = (t0) => { 15756 const $ = (0, import_compiler_runtime$87.c)(28); 15757 const { open, onOpenChange, onContinue } = t0; 15758 const navigate = useNavigate(); 15759 const t1 = useUserInfoQueryState()?.rank; 15760 let t2; 15761 if ($[0] !== t1) { 15762 t2 = getRoleName(t1); 15763 $[0] = t1; 15764 $[1] = t2; 15765 } else t2 = $[1]; 15766 const isAdmin = t2 === "Super Admin"; 15767 let t3; 15768 if ($[2] !== navigate || $[3] !== onOpenChange) { 15769 t3 = () => { 15770 trackMethodCall("handleUpgrade", []); 15771 onOpenChange?.(false); 15772 navigate(SUBSCRIPTION_PATH$1); 15773 }; 15774 $[2] = navigate; 15775 $[3] = onOpenChange; 15776 $[4] = t3; 15777 } else t3 = $[4]; 15778 const handleUpgrade = t3; 15779 let t4; 15780 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 15781 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 15782 className: "flex items-center gap-3", 15783 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 15784 name: "info", 15785 className: "size-6" 15786 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogTitle, { 15787 className: "text-base font-medium", 15788 children: "Dialer - Call Time Limit Alert" 15789 })] 15790 }); 15791 $[5] = t4; 15792 } else t4 = $[5]; 15793 let t5; 15794 if ($[6] !== onOpenChange) { 15795 t5 = () => onOpenChange?.(false); 15796 $[6] = onOpenChange; 15797 $[7] = t5; 15798 } else t5 = $[7]; 15799 let t6; 15800 if ($[8] === Symbol.for("react.memo_cache_sentinel")) { 15801 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { className: "size-4" }); 15802 $[8] = t6; 15803 } else t6 = $[8]; 15804 let t7; 15805 if ($[9] !== t5) { 15806 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 15807 className: "flex items-center justify-between gap-3",
15808 children: [t4, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 15809 variant: "ghost", 15810 size: "icon", 15811 className: "size-6 shrink-0", 15812 "aria-label": "Close", 15813 onClick: t5, 15814 children: t6 15815 })] 15816 }) }); 15817 $[9] = t5; 15818 $[10] = t7; 15819 } else t7 = $[10]; 15820 let t8; 15821 if ($[11] === Symbol.for("react.memo_cache_sentinel")) { 15822 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 15823 className: "font-semibold text-orange-600", 15824 children: "15" 15825 }); 15826 $[11] = t8; 15827 } else t8 = $[11]; 15828 let t9; 15829 if ($[12] === Symbol.for("react.memo_cache_sentinel")) { 15830 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogDescription, { 15831 className: "ml-9 w-75", 15832 children: [ 15833 "The remaining time in this call package is less than", 15834 " ", 15835 t8, 15836 " minutes. When it reaches", 15837 " ", 15838 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 15839 className: "font-semibold text-orange-600", 15840 children: "0" 15841 }), 15842 " minutes, the call will be disconnected. Purchase an Unlimited package to avoid running out of minutes." 15843 ] 15844 }); 15845 $[12] = t9; 15846 } else t9 = $[12]; 15847 let t10; 15848 if ($[13] !== onContinue) { 15849 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogCancel, { 15850 size: "sm", 15851 onClick: onContinue, 15852 children: "Got It" 15853 }); 15854 $[13] = onContinue; 15855 $[14] = t10; 15856 } else t10 = $[14]; 15857 let t11; 15858 if ($[15] !== handleUpgrade || $[16] !== isAdmin) {
15859 t11 = isAdmin && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogAction, { 15860 size: "sm", 15861 onClick: handleUpgrade, 15862 children: "Upgrade" 15863 }); 15864 $[15] = handleUpgrade; 15865 $[16] = isAdmin; 15866 $[17] = t11; 15867 } else t11 = $[17]; 15868 let t12; 15869 if ($[18] !== t10 || $[19] !== t11) { 15870 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogFooter, { 15871 className: "mt-4", 15872 children: [t10, t11] 15873 }); 15874 $[18] = t10; 15875 $[19] = t11; 15876 $[20] = t12; 15877 } else t12 = $[20]; 15878 let t13; 15879 if ($[21] !== t12 || $[22] !== t7) { 15880 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogContent, { 15881 className: "w-100 gap-1 p-4", 15882 children: [ 15883 t7, 15884 t9, 15885 t12 15886 ] 15887 }); 15888 $[21] = t12; 15889 $[22] = t7; 15890 $[23] = t13; 15891 } else t13 = $[23]; 15892 let t14; 15893 if ($[24] !== onOpenChange || $[25] !== open || $[26] !== t13) { 15894 t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialog, { 15895 open, 15896 onOpenChange, 15897 children: t13 15898 }); 15899 $[24] = onOpenChange; 15900 $[25] = open; 15901 $[26] = t13; 15902 $[27] = t14; 15903 } else t14 = $[27]; 15904 return t14; 15905}; 15906var import_compiler_runtime$86 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 15907var SUBSCRIPTION_PATH = "/settings/subscription-and-billing"; 15908const DialerStandardAcceleratorLessThan0MinsDialog = (t0) => { 15909 const $ = (0, import_compiler_runtime$86.c)(27); 15910 const { open, onOpenChange } = t0; 15911 const navigate = useNavigate(); 15912 const t1 = useUserInfoQueryState()?.rank; 15913 let t2; 15914 if ($[0] !== t1) { 15915 t2 = getRoleName(t1); 15916 $[0] = t1; 15917 $[1] = t2; 15918 } else t2 = $[1]; 15919 const isAdmin = t2 === "Super Admin"; 15920 let t3; 15921 if ($[2] !== navigate || $[3] !== onOpenChange) { 15922 t3 = () => { 15923 trackMethodCall("handleUpgrade", []); 15924 onOpenChange?.(false); 15925 navigate(SUBSCRIPTION_PATH); 15926 }; 15927 $[2] = navigate; 15928 $[3] = onOpenChange; 15929 $[4] = t3; 15930 } else t3 = $[4]; 15931 const handleUpgrade = t3; 15932 let t4; 15933 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 15934 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 15935 className: "flex items-center gap-3", 15936 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 15937 name: "alert", 15938 className: "size-6" 15939 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogTitle, { 15940 className: "text-base font-medium", 15941 children: "Dialer - Call Time Limit Alert" 15942 })] 15943 }); 15944 $[5] = t4; 15945 } else t4 = $[5]; 15946 let t5; 15947 if ($[6] !== onOpenChange) { 15948 t5 = () => onOpenChange?.(false); 15949 $[6] = onOpenChange; 15950 $[7] = t5; 15951 } else t5 = $[7]; 15952 let t6; 15953 if ($[8] === Symbol.for("react.memo_cache_sentinel")) { 15954 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { className: "size-4" }); 15955 $[8] = t6; 15956 } else t6 = $[8]; 15957 let t7; 15958 if ($[9] !== t5) { 15959 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 15960 className: "flex items-center justify-between gap-3", 15961 children: [t4, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 15962 variant: "ghost", 15963 size: "icon", 15964 className: "size-6 shrink-0", 15965 "aria-label": "Close", 15966 onClick: t5, 15967 children: t6 15968 })] 15969 }) }); 15970 $[9] = t5; 15971 $[10] = t7; 15972 } else t7 = $[10]; 15973 let t8; 15974 if ($[11] === Symbol.for("react.memo_cache_sentinel")) { 15975 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogDescription, { 15976 className: "ml-9 w-75", 15977 children: [ 15978 "The remaining time in this call package is", 15979 " ",
15980 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 15981 className: "font-semibold text-orange-600", 15982 children: "0" 15983 }), 15984 " minutes and the call service is no longer active. Purchase an Unlimited package to avoid running out of minutes." 15985 ] 15986 }); 15987 $[11] = t8; 15988 } else t8 = $[11]; 15989 let t9; 15990 if ($[12] !== onOpenChange) { 15991 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogCancel, { 15992 size: "sm", 15993 onClick: () => onOpenChange?.(false), 15994 children: "Got It" 15995 }); 15996 $[12] = onOpenChange; 15997 $[13] = t9; 15998 } else t9 = $[13]; 15999 let t10; 16000 if ($[14] !== handleUpgrade || $[15] !== isAdmin) { 16001 t10 = isAdmin && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogAction, { 16002 size: "sm", 16003 onClick: handleUpgrade, 16004 children: "Upgrade" 16005 }); 16006 $[14] = handleUpgrade; 16007 $[15] = isAdmin; 16008 $[16] = t10; 16009 } else t10 = $[16]; 16010 let t11; 16011 if ($[17] !== t10 || $[18] !== t9) { 16012 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogFooter, { 16013 className: "mt-4", 16014 children: [t9, t10] 16015 }); 16016 $[17] = t10; 16017 $[18] = t9; 16018 $[19] = t11; 16019 } else t11 = $[19]; 16020 let t12; 16021 if ($[20] !== t11 || $[21] !== t7) { 16022 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogContent, { 16023 className: "w-100 gap-1 p-4", 16024 children: [ 16025 t7, 16026 t8, 16027 t11 16028 ] 16029 }); 16030 $[20] = t11; 16031 $[21] = t7; 16032 $[22] = t12; 16033 } else t12 = $[22]; 16034 let t13; 16035 if ($[23] !== onOpenChange || $[24] !== open || $[25] !== t12) { 16036 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialog, { 16037 open, 16038 onOpenChange, 16039 children: t12 16040 }); 16041 $[23] = onOpenChange; 16042 $[24] = open; 16043 $[25] = t12; 16044 $[26] = t13; 16045 } else t13 = $[26]; 16046 return t13; 16047}; 16048var dialer_advertise_q80_default = "/assets/dialer-advertise.q80-DhPPgHvD.webp"; 16049var import_compiler_runtime$85 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 16050var FEATURES = [ 16051 { 16052 icon: "inbound-dialer", 16053 label: "Inbound" 16054 }, 16055 { 16056 icon: "outbound-dialer", 16057 label: "Outbound" 16058 }, 16059 { 16060 icon: "activities-dialer", 16061 label: "Activities" 16062 }, 16063 { 16064 icon: "packages-dialer", 16065 label: "Free Packages" 16066 } 16067]; 16068const DialerTryDialerForFreeDialog = (t0) => { 16069 const $ = (0, import_compiler_runtime$85.c)(13); 16070 const { open, onOpenChange, onGetFreeTrial } = t0; 16071 const dispatch = useAppDispatch(); 16072 let t1; 16073 if ($[0] !== dispatch || $[1] !== onGetFreeTrial) { 16074 t1 = () => { 16075 trackMethodCall("handleGetFreeTrial", []); 16076 dispatch(setDialerNotificationType("start-free-trial")); 16077 onGetFreeTrial?.(); 16078 }; 16079 $[0] = dispatch; 16080 $[1] = onGetFreeTrial; 16081 $[2] = t1; 16082 } else t1 = $[2]; 16083 const handleGetFreeTrial = t1; 16084 let t2; 16085 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 16086 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(fleet_logo_with_text_default, { className: "absolute top-6 left-5.5" }); 16087 $[3] = t2; 16088 } else t2 = $[3]; 16089 let t3; 16090 if ($[4] === Symbol.for("react.memo_cache_sentinel")) { 16091 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16092 className: "relative flex w-92 shrink-0 items-center justify-center bg-[#f5f9ff]", 16093 children: [t2, /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 16094 className: "h-66.5 w-75", 16095 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { 16096 src: dialer_advertise_q80_default, 16097 alt: "dialer-advertise", 16098 className: "size-full object-cover" 16099 }) 16100 })] 16101 }); 16102 $[4] = t3; 16103 } else t3 = $[4]; 16104 let t4; 16105 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 16106 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16107 className: "flex flex-col gap-2 text-foreground", 16108 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { 16109 className: "text-3xl leading-9 font-bold", 16110 children: "Try Dialer for free" 16111 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 16112 className: "text-sm leading-5", 16113 children: "Use the virtual number to make and receive calls directly through the browser. It will automatically link contact info to your caller." 16114 })] 16115 }); 16116 $[5] = t4; 16117 } else t4 = $[5]; 16118 let t5; 16119 if ($[6] === Symbol.for("react.memo_cache_sentinel")) { 16120 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16121 className: "flex flex-col gap-6", 16122 children: [ 16123 t4,
16124 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 16125 className: "flex items-center justify-center gap-7 border-y border-border py-3", 16126 children: FEATURES.map(_temp$17) 16127 }), 16128 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 16129 className: "text-sm text-muted-foreground", 16130 children: "Start increasing work efficiency today!" 16131 }) 16132 ] 16133 }); 16134 $[6] = t5; 16135 } else t5 = $[6]; 16136 let t6; 16137 if ($[7] !== handleGetFreeTrial) { 16138 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, { 16139 className: "flex max-w-200 overflow-hidden p-0", 16140 showCloseButton: true, 16141 children: [t3, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16142 className: "flex flex-1 flex-col justify-center gap-10 px-12 py-19", 16143 children: [t5, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 16144 className: "w-50", 16145 onClick: handleGetFreeTrial, 16146 children: "Get a Free Trial" 16147 })] 16148 })] 16149 }); 16150 $[7] = handleGetFreeTrial; 16151 $[8] = t6; 16152 } else t6 = $[8]; 16153 let t7; 16154 if ($[9] !== onOpenChange || $[10] !== open || $[11] !== t6) { 16155 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, { 16156 open, 16157 onOpenChange, 16158 children: t6 16159 }); 16160 $[9] = onOpenChange; 16161 $[10] = open; 16162 $[11] = t6; 16163 $[12] = t7; 16164 } else t7 = $[12]; 16165 return t7; 16166}; 16167function _temp$17(feature) { 16168 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16169 className: "flex flex-col items-center gap-1", 16170 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 16171 name: feature.icon, 16172 className: "size-6 text-primary" 16173 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 16174 className: "text-xs font-medium text-primary", 16175 children: feature.label 16176 })] 16177 }, feature.icon); 16178} 16179var import_compiler_runtime$84 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 16180var DIALER_SETTINGS_PATH = "/settings/dialer-settings"; 16181const DialerNoVirtualNumberDialog = (t0) => { 16182 const $ = (0, import_compiler_runtime$84.c)(15); 16183 const { open, onOpenChange } = t0; 16184 const navigate = useNavigate(); 16185 let t1; 16186 if ($[0] !== navigate || $[1] !== onOpenChange) { 16187 t1 = () => { 16188 trackMethodCall("handleGoSetting", []); 16189 onOpenChange?.(false); 16190 navigate(DIALER_SETTINGS_PATH); 16191 }; 16192 $[0] = navigate; 16193 $[1] = onOpenChange; 16194 $[2] = t1; 16195 } else t1 = $[2]; 16196 const handleGoSetting = t1; 16197 let t2; 16198 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 16199 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogHeader, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogTitle, { children: "No virtual phone available." }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogDescription, { children: "You must be assigned a virtual mobile phone number before they can use the browser to make calls." })] }); 16200 $[3] = t2; 16201 } else t2 = $[3]; 16202 let t3; 16203 if ($[4] !== onOpenChange) { 16204 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogCancel, { 16205 size: "sm", 16206 onClick: () => onOpenChange?.(false), 16207 children: "Cancel" 16208 }); 16209 $[4] = onOpenChange; 16210 $[5] = t3; 16211 } else t3 = $[5]; 16212 let t4; 16213 if ($[6] !== handleGoSetting) { 16214 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogAction, { 16215 size: "sm", 16216 onClick: handleGoSetting, 16217 children: "GO SETTING" 16218 }); 16219 $[6] = handleGoSetting; 16220 $[7] = t4; 16221 } else t4 = $[7]; 16222 let t5; 16223 if ($[8] !== t3 || $[9] !== t4) { 16224 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogContent, { 16225 className: "max-w-lg", 16226 children: [t2, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogFooter, { children: [t3, t4] })] 16227 }); 16228 $[8] = t3; 16229 $[9] = t4; 16230 $[10] = t5; 16231 } else t5 = $[10]; 16232 let t6; 16233 if ($[11] !== onOpenChange || $[12] !== open || $[13] !== t5) { 16234 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialog, { 16235 open, 16236 onOpenChange, 16237 children: t5 16238 }); 16239 $[11] = onOpenChange; 16240 $[12] = open; 16241 $[13] = t5; 16242 $[14] = t6; 16243 } else t6 = $[14]; 16244 return t6; 16245}; 16246var import_compiler_runtime$83 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 16247var SUBSCRIPTION_AND_BILLING$1 = "/settings/subscription-and-billing"; 16248const DialerFreeTrialEndedDialog = (t0) => { 16249 const $ = (0, import_compiler_runtime$83.c)(16); 16250 const { open, onOpenChange } = t0; 16251 const navigate = useNavigate(); 16252 let t1; 16253 if ($[0] !== navigate || $[1] !== onOpenChange) { 16254 t1 = () => { 16255 trackMethodCall("handleUpgradeNow", []); 16256 onOpenChange?.(false); 16257 navigate(SUBSCRIPTION_AND_BILLING$1); 16258 }; 16259 $[0] = navigate; 16260 $[1] = onOpenChange; 16261 $[2] = t1; 16262 } else t1 = $[2]; 16263 const handleUpgradeNow = t1; 16264 let t2; 16265 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 16266 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 16267 className: "flex items-center justify-center bg-primary-muted py-11", 16268 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 16269 className: "h-53 w-60", 16270 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { 16271 src: dialer_advertise_q80_default, 16272 alt: "dialer-advertise", 16273 className: "size-full object-contain" 16274 }) 16275 }) 16276 }); 16277 $[3] = t2; 16278 } else t2 = $[3]; 16279 let t3; 16280 if ($[4] === Symbol.for("react.memo_cache_sentinel")) { 16281 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16282 className: "flex flex-col gap-2 text-center", 16283 children: [
16284 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 16285 className: "text-base font-semibold text-muted-foreground", 16286 children: "Free trial ended" 16287 }), 16288 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { 16289 className: "text-2xl font-semibold text-foreground", 16290 children: "Dialer Time Limit Reached" 16291 }), 16292 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 16293 className: "text-sm leading-5 text-foreground", 16294 children: "You've used all trial call minutes. Upgrade to keep calling your drivers, dispatchers, and operators." 16295 }) 16296 ] 16297 }); 16298 $[4] = t3; 16299 } else t3 = $[4]; 16300 let t4; 16301 if ($[5] !== onOpenChange) { 16302 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 16303 variant: "outline", 16304 className: "h-9 flex-1", 16305 onClick: () => onOpenChange?.(false), 16306 children: "Maybe Later" 16307 }); 16308 $[5] = onOpenChange; 16309 $[6] = t4; 16310 } else t4 = $[6]; 16311 let t5; 16312 if ($[7] !== handleUpgradeNow) { 16313 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 16314 className: "h-9 flex-1", 16315 onClick: handleUpgradeNow, 16316 children: "Upgrade Now" 16317 }); 16318 $[7] = handleUpgradeNow; 16319 $[8] = t5; 16320 } else t5 = $[8]; 16321 let t6; 16322 if ($[9] !== t4 || $[10] !== t5) { 16323 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, { 16324 className: "max-w-96.75 overflow-hidden p-0", 16325 showCloseButton: false, 16326 children: [t2, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16327 className: "flex flex-col gap-6 p-6", 16328 children: [t3, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16329 className: "flex h-9 items-center gap-2", 16330 children: [t4, t5] 16331 })] 16332 })] 16333 }); 16334 $[9] = t4; 16335 $[10] = t5; 16336 $[11] = t6; 16337 } else t6 = $[11]; 16338 let t7; 16339 if ($[12] !== onOpenChange || $[13] !== open || $[14] !== t6) { 16340 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, { 16341 open, 16342 onOpenChange, 16343 children: t6 16344 }); 16345 $[12] = onOpenChange; 16346 $[13] = open; 16347 $[14] = t6; 16348 $[15] = t7; 16349 } else t7 = $[15]; 16350 return t7; 16351}; 16352var import_compiler_runtime$82 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 16353const DialerFreeTrialEndedOperatorDialog = (t0) => { 16354 const $ = (0, import_compiler_runtime$82.c)(8); 16355 const { open, onOpenChange } = t0; 16356 let t1; 16357 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 16358 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 16359 className: "flex items-center justify-center bg-primary-muted py-11", 16360 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 16361 className: "h-53 w-60", 16362 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { 16363 src: dialer_advertise_q80_default, 16364 alt: "dialer-advertise", 16365 className: "size-full object-contain" 16366 }) 16367 }) 16368 }); 16369 $[0] = t1; 16370 } else t1 = $[0]; 16371 let t2; 16372 if ($[1] === Symbol.for("react.memo_cache_sentinel")) { 16373 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16374 className: "flex flex-col gap-2 text-center", 16375 children: [
16376 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 16377 className: "text-base font-semibold text-muted-foreground", 16378 children: "Free trial ended" 16379 }), 16380 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { 16381 className: "text-2xl font-semibold text-foreground", 16382 children: "Dialer Time Limit Reached" 16383 }), 16384 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 16385 className: "text-sm leading-5 text-foreground", 16386 children: "You've used all trial call minutes. Contact your admin to get upgrade and keep using the feature." 16387 }) 16388 ] 16389 }); 16390 $[1] = t2; 16391 } else t2 = $[1]; 16392 let t3; 16393 if ($[2] !== onOpenChange) { 16394 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, { 16395 className: "max-w-96.75 overflow-hidden p-0", 16396 showCloseButton: false, 16397 children: [t1, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16398 className: "flex flex-col gap-6 p-6", 16399 children: [t2, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 16400 className: "h-9 w-full", 16401 onClick: () => onOpenChange?.(false), 16402 children: "Got it" 16403 })] 16404 })] 16405 }); 16406 $[2] = onOpenChange; 16407 $[3] = t3; 16408 } else t3 = $[3]; 16409 let t4; 16410 if ($[4] !== onOpenChange || $[5] !== open || $[6] !== t3) { 16411 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, { 16412 open, 16413 onOpenChange, 16414 children: t3 16415 }); 16416 $[4] = onOpenChange; 16417 $[5] = open; 16418 $[6] = t3; 16419 $[7] = t4; 16420 } else t4 = $[7]; 16421 return t4; 16422}; 16423var import_compiler_runtime$81 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 16424var SUBSCRIPTION_AND_BILLING = "/settings/subscription-and-billing"; 16425const DialerSubscriptionRequiredDialog = (t0) => { 16426 const $ = (0, import_compiler_runtime$81.c)(16); 16427 const { open, onOpenChange } = t0; 16428 const navigate = useNavigate(); 16429 let t1; 16430 if ($[0] !== navigate || $[1] !== onOpenChange) { 16431 t1 = () => { 16432 trackMethodCall("handleUpgradeNow", []); 16433 onOpenChange?.(false); 16434 navigate(SUBSCRIPTION_AND_BILLING); 16435 }; 16436 $[0] = navigate; 16437 $[1] = onOpenChange; 16438 $[2] = t1; 16439 } else t1 = $[2]; 16440 const handleUpgradeNow = t1; 16441 let t2; 16442 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 16443 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 16444 className: "flex items-center justify-center bg-primary-muted py-11", 16445 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 16446 className: "h-53 w-60", 16447 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { 16448 src: dialer_advertise_q80_default, 16449 alt: "dialer-advertise", 16450 className: "size-full object-contain" 16451 }) 16452 }) 16453 }); 16454 $[3] = t2; 16455 } else t2 = $[3]; 16456 let t3; 16457 if ($[4] === Symbol.for("react.memo_cache_sentinel")) { 16458 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16459 className: "flex flex-col gap-2 text-center", 16460 children: [
16461 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 16462 className: "text-base font-semibold text-muted-foreground", 16463 children: "Subscription required" 16464 }), 16465 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { 16466 className: "text-2xl font-semibold text-foreground", 16467 children: "Dialer is Paused" 16468 }), 16469 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 16470 className: "text-sm leading-5 text-foreground", 16471 children: "You don't have an active subscription. Upgrade to start calling drivers, dispatchers, and operators." 16472 }) 16473 ] 16474 }); 16475 $[4] = t3; 16476 } else t3 = $[4]; 16477 let t4; 16478 if ($[5] !== onOpenChange) { 16479 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 16480 variant: "outline", 16481 className: "h-9 flex-1", 16482 onClick: () => onOpenChange?.(false), 16483 children: "Maybe Later" 16484 }); 16485 $[5] = onOpenChange; 16486 $[6] = t4; 16487 } else t4 = $[6]; 16488 let t5; 16489 if ($[7] !== handleUpgradeNow) { 16490 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 16491 className: "h-9 flex-1", 16492 onClick: handleUpgradeNow, 16493 children: "Upgrade Now" 16494 }); 16495 $[7] = handleUpgradeNow; 16496 $[8] = t5; 16497 } else t5 = $[8]; 16498 let t6; 16499 if ($[9] !== t4 || $[10] !== t5) { 16500 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, { 16501 className: "max-w-96.75 overflow-hidden p-0", 16502 showCloseButton: false, 16503 children: [t2, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16504 className: "flex flex-col gap-6 p-6", 16505 children: [t3, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16506 className: "flex h-9 items-center gap-2", 16507 children: [t4, t5] 16508 })] 16509 })] 16510 }); 16511 $[9] = t4; 16512 $[10] = t5; 16513 $[11] = t6; 16514 } else t6 = $[11]; 16515 let t7; 16516 if ($[12] !== onOpenChange || $[13] !== open || $[14] !== t6) { 16517 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, { 16518 open, 16519 onOpenChange, 16520 children: t6 16521 }); 16522 $[12] = onOpenChange; 16523 $[13] = open; 16524 $[14] = t6; 16525 $[15] = t7; 16526 } else t7 = $[15]; 16527 return t7; 16528}; 16529var import_compiler_runtime$80 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 16530const DialerSubscriptionRequiredOperatorDialog = (t0) => { 16531 const $ = (0, import_compiler_runtime$80.c)(8); 16532 const { open, onOpenChange } = t0; 16533 let t1; 16534 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 16535 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 16536 className: "flex items-center justify-center bg-primary-muted py-11", 16537 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 16538 className: "h-53 w-60", 16539 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { 16540 src: dialer_advertise_q80_default, 16541 alt: "dialer-advertise", 16542 className: "size-full object-contain" 16543 }) 16544 }) 16545 }); 16546 $[0] = t1; 16547 } else t1 = $[0]; 16548 let t2; 16549 if ($[1] === Symbol.for("react.memo_cache_sentinel")) { 16550 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16551 className: "flex flex-col gap-2 text-center", 16552 children: [
16553 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 16554 className: "text-base font-semibold text-muted-foreground", 16555 children: "Subscription required" 16556 }), 16557 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { 16558 className: "text-2xl font-semibold text-foreground", 16559 children: "Dialer is Paused" 16560 }), 16561 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 16562 className: "text-sm leading-5 text-foreground", 16563 children: "You don't have an active subscription. Contact your admin to get upgrade and start calling drivers, dispatchers, and operators." 16564 }) 16565 ] 16566 }); 16567 $[1] = t2; 16568 } else t2 = $[1]; 16569 let t3; 16570 if ($[2] !== onOpenChange) { 16571 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, { 16572 className: "max-w-96.75 overflow-hidden p-0", 16573 showCloseButton: false, 16574 children: [t1, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16575 className: "flex flex-col gap-6 p-6", 16576 children: [t2, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 16577 className: "h-9 w-full", 16578 onClick: () => onOpenChange?.(false), 16579 children: "Got it" 16580 })] 16581 })] 16582 }); 16583 $[2] = onOpenChange; 16584 $[3] = t3; 16585 } else t3 = $[3]; 16586 let t4; 16587 if ($[4] !== onOpenChange || $[5] !== open || $[6] !== t3) { 16588 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, { 16589 open, 16590 onOpenChange, 16591 children: t3 16592 }); 16593 $[4] = onOpenChange; 16594 $[5] = open; 16595 $[6] = t3; 16596 $[7] = t4; 16597 } else t4 = $[7]; 16598 return t4; 16599}; 16600var import_compiler_runtime$79 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 16601function VirtualNumberSelectLabel(t0) { 16602 const $ = (0, import_compiler_runtime$79.c)(15); 16603 const { number } = t0; 16604 let t1; 16605 let t2; 16606 let t3; 16607 let t4; 16608 if ($[0] !== number.virtualNumber) { 16609 const { phoneNumber, phoneCode } = parsePhoneNumber(number.virtualNumber); 16610 t1 = "inline-block min-w-32"; 16611 t2 = phoneCode ?? "+1"; 16612 t3 = " "; 16613 t4 = formatPhone(phoneNumber, "parentheses"); 16614 $[0] = number.virtualNumber; 16615 $[1] = t1; 16616 $[2] = t2; 16617 $[3] = t3; 16618 $[4] = t4; 16619 } else { 16620 t1 = $[1]; 16621 t2 = $[2]; 16622 t3 = $[3]; 16623 t4 = $[4]; 16624 } 16625 let t5; 16626 if ($[5] !== t1 || $[6] !== t2 || $[7] !== t3 || $[8] !== t4) { 16627 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { 16628 className: t1, 16629 children: [ 16630 t2, 16631 t3, 16632 t4 16633 ] 16634 }); 16635 $[5] = t1; 16636 $[6] = t2; 16637 $[7] = t3; 16638 $[8] = t4; 16639 $[9] = t5; 16640 } else t5 = $[9]; 16641 let t6; 16642 if ($[10] !== number.area) { 16643 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 16644 className: "text-muted-foreground", 16645 children: number.area 16646 }); 16647 $[10] = number.area; 16648 $[11] = t6; 16649 } else t6 = $[11]; 16650 let t7; 16651 if ($[12] !== t5 || $[13] !== t6) { 16652 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [ 16653 t5, 16654 " ", 16655 t6 16656 ] }); 16657 $[12] = t5; 16658 $[13] = t6; 16659 $[14] = t7; 16660 } else t7 = $[14]; 16661 return t7; 16662} 16663var DialerTrialStarted = ({ open, onOpenChange }) => { 16664 const userInfo = useUserInfoQueryState(); 16665 const [selectedNumber, setSelectedNumber] = (0, import_react.useState)(""); 16666 const { data: phoneNumbersResponse, isLoading: isPhoneNumbersLoading } = useGetDialerVirtualNumbersListQuery({ 16667 countryCode: "US", 16668 key: "" 16669 }, { skip: !open }); 16670 const [getDialerFreeTrialSeat, { isLoading: isFreeTrialSeatLoading }] = useGetDialerFreeTrialSeatMutation(); 16671 const [addVirtualNumber, { isLoading: isAddVirtualNumberLoading }] = useAddVirtualNumberMutation(); 16672 const [assignDialerSettingVirtualNumber, { isLoading: isAssignDialerSettingVirtualNumberLoading }] = useAssignDialerSettingVirtualNumberMutation(); 16673 const phoneNumbers = get(phoneNumbersResponse, "data", []) ?? []; 16674 const isMutationLoading = isFreeTrialSeatLoading || isAddVirtualNumberLoading || isAssignDialerSettingVirtualNumberLoading; 16675 const handleCancelDialerTrial = () => { 16676 trackMethodCall("handleCancelDialerTrial", []); 16677 setSelectedNumber(""); 16678 onOpenChange?.(false); 16679 }; 16680 const onDialogOpenChange = (nextOpen) => { 16681 if (!nextOpen) { 16682 handleCancelDialerTrial(); 16683 return; 16684 } 16685 onOpenChange?.(nextOpen); 16686 }; 16687 const handleStartUsing = async () => { 16688 trackMethodCall("handleStartUsing", []); 16689 const virtualNumber = phoneNumbers.find((n$2) => { 16690 return n$2.virtualNumber === selectedNumber; 16691 }); 16692 if (!virtualNumber) return; 16693 try { 16694 await getDialerFreeTrialSeat().unwrap(); 16695 await addVirtualNumber([virtualNumber]).unwrap(); 16696 await assignDialerSettingVirtualNumber({ 16697 clientUserId: userInfo?.id, 16698 virtualNumber: virtualNumber.virtualNumber, 16699 isAssign: true 16700 }).unwrap(); 16701 toast.success("Free trial started successfully"); 16702 setSelectedNumber(""); 16703 onOpenChange?.(false); 16704 } catch { 16705 toast.error("Failed to start free trial"); 16706 } 16707 }; 16708 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, { 16709 open, 16710 onOpenChange: onDialogOpenChange, 16711 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogContent, { 16712 showCloseButton: true, 16713 className: "w-full max-w-122.5", 16714 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16715 className: "p-10", 16716 children: [
vendor: 1,508 bytes, lines 16717-16752
16717 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 16718 className: "flex items-center justify-center", 16719 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 16720 name: "dialer-advertise", 16721 className: "size-15" 16722 }) 16723 }), 16724 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 16725 className: "mt-5 text-center text-xl font-semibold text-foreground", 16726 children: "Start Dialer Free Trial?" 16727 }), 16728 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16729 className: "mt-3 text-sm text-foreground", 16730 children: [ 16731 "You'll\xA0", 16732 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 16733 className: "font-semibold text-success", 16734 children: "get 50 minutes" 16735 }), 16736 "\xA0 of free calling during the trial." 16737 ] 16738 }), 16739 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 16740 className: "mt-1.5 text-sm text-foreground", 16741 children: "To use Dialer, you need a virtual phone number for caller ID." 16742 }), 16743 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 16744 className: "mt-1.5 text-sm text-muted-foreground", 16745 children: "You can also verify your own phone number and use it instead later." 16746 }), 16747 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16748 className: "mt-3 flex flex-col gap-2", 16749 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { 16750 className: "text-sm font-medium text-foreground", 16751 children: "Choose Your Virtual Number" 16752 }
16752), isPhoneNumbersLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 16753 className: "flex h-9 items-center justify-center", 16754 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { className: "size-5 text-primary" }) 16755 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select, { 16756 value: selectedNumber, 16757 onValueChange: setSelectedNumber, 16758 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectTrigger, { 16759 className: "w-full", 16760 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectValue, { placeholder: "Select a virtual number" }) 16761 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContent, { children: phoneNumbers.map((number) => { 16762 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, { 16763 value: number.virtualNumber, 16764 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VirtualNumberSelectLabel, { number }) 16765 }, number.virtualNumber); 16766 }) })] 16767 })] 16768 }), 16769 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 16770 className: "mt-5 flex items-center justify-center gap-2", 16771 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 16772 type: "button", 16773 variant: "outline", 16774 className: "flex-1", 16775 onClick: handleCancelDialerTrial, 16776 children: "Cancel" 16777 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 16778 type: "button", 16779 className: "flex-1", 16780 disabled: !selectedNumber, 16781 loading: isMutationLoading, 16782 onClick: handleStartUsing, 16783 children: "Start Using" 16784 })] 16785 }) 16786 ] 16787 }) 16788 }) 16789 }); 16790}; 16791var import_compiler_runtime$78 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 16792var DialerNotifications = (t0) => { 16793 const $ = (0, import_compiler_runtime$78.c)(26); 16794 let props; 16795 let type; 16796 if ($[0] !== t0) { 16797 ({type, ...props} = t0); 16798 $[0] = t0; 16799 $[1] = props; 16800 $[2] = type; 16801 } else { 16802 props = $[1]; 16803 type = $[2]; 16804 } 16805 switch (type) { 16806 case "no-package": { 16807 let t1; 16808 if ($[3] !== props) { 16809 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialerNoPackageDialog, { ...props }); 16810 $[3] = props; 16811 $[4] = t1; 16812 } else t1 = $[4]; 16813 return t1; 16814 } 16815 case "no-package-admin": { 16816 let t1; 16817 if ($[5] !== props) { 16818 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialerNoPackageAdminDialog, { ...props }); 16819 $[5] = props; 16820 $[6] = t1; 16821 } else t1 = $[6]; 16822 return t1; 16823 } 16824 case "try-dialer-for-free": { 16825 let t1; 16826 if ($[7] !== props) { 16827 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialerTryDialerForFreeDialog, { ...props }); 16828 $[7] = props; 16829 $[8] = t1; 16830 } else t1 = $[8]; 16831 return t1; 16832 } 16833 case "basic-less-than-15-mins": { 16834 let t1; 16835 if ($[9] !== props) { 16836 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialerBasicLessThan15MinsDialog, { ...props }); 16837 $[9] = props; 16838 $[10] = t1; 16839 } else t1 = $[10]; 16840 return t1; 16841 } 16842 case "standard-accelerator-less-than-0-mins": { 16843 let t1; 16844 if ($[11] !== props) { 16845 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialerStandardAcceleratorLessThan0MinsDialog, { ...props }); 16846 $[11] = props; 16847 $[12] = t1; 16848 } else t1 = $[12]; 16849 return t1; 16850 } 16851 case "no-virtual-number": { 16852 let t1; 16853 if ($[13] !== props) { 16854 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialerNoVirtualNumberDialog, { ...props }); 16855 $[13] = props; 16856 $[14] = t1; 16857 } else t1 = $[14]; 16858 return t1; 16859 } 16860 case "free-trial-ended": { 16861 let t1; 16862 if ($[15] !== props) { 16863 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialerFreeTrialEndedDialog, { ...props }); 16864 $[15] = props; 16865 $[16] = t1; 16866 } else t1 = $[16]; 16867 return t1; 16868 } 16869 case "free-trial-ended-operator": { 16870 let t1; 16871 if ($[17] !== props) { 16872 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialerFreeTrialEndedOperatorDialog, { ...props }); 16873 $[17] = props; 16874 $[18] = t1; 16875 } else t1 = $[18]; 16876 return t1; 16877 } 16878 case "subscription-required": { 16879 let t1; 16880 if ($[19] !== props) { 16881 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialerSubscriptionRequiredDialog, { ...props }); 16882 $[19] = props; 16883 $[20] = t1; 16884 } else t1 = $[20]; 16885 return t1; 16886 } 16887 case "subscription-required-operator": { 16888 let t1; 16889 if ($[21] !== props) { 16890 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialerSubscriptionRequiredOperatorDialog, { ...props }); 16891 $[21] = props; 16892 $[22] = t1; 16893 } else t1 = $[22]; 16894 return t1; 16895 } 16896 case "start-free-trial": { 16897 let t1; 16898 if ($[23] !== props) { 16899 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialerTrialStarted, { ...props }); 16900 $[23] = props; 16901 $[24] = t1; 16902 } else t1 = $[24]; 16903 return t1; 16904 } 16905 default: { 16906 let t1; 16907 if ($[25] === Symbol.for("react.memo_cache_sentinel")) { 16908 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}); 16909 $[25] = t1; 16910 } else t1 = $[25]; 16911 return t1; 16912 } 16913 } 16914}; 16915var dialer_notifications_default = DialerNotifications; 16916var [Provider$1, useProvider] = create_context_default("DialerBuyVirtualPhoneContext"); 16917var import_compiler_runtime$77 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 16918function DialerNoVirtualPhoneAvailableAlertDialog(t0) { 16919 const $ = (0, import_compiler_runtime$77.c)(15); 16920 const { open, onCancel, onGoSetting } = t0; 16921 let t1; 16922 if ($[0] !== onCancel) { 16923 t1 = () => { 16924 trackMethodCall("handleCancelNoVirtualPhone", []); 16925 onCancel?.(); 16926 }; 16927 $[0] = onCancel; 16928 $[1] = t1; 16929 } else t1 = $[1]; 16930 const handleCancelNoVirtualPhone = t1; 16931 let t2; 16932 if ($[2] !== onGoSetting) { 16933 t2 = () => { 16934 trackMethodCall("handleGoSetting", []); 16935 onGoSetting?.(); 16936 }; 16937 $[2] = onGoSetting; 16938 $[3] = t2; 16939 } else t2 = $[3]; 16940 const handleGoSetting = t2; 16941 let t3; 16942 if ($[4] === Symbol.for("react.memo_cache_sentinel")) { 16943 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogHeader, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogTitle, { children: "N
16943o virtual phone available." }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogDescription, { children: "You must be assigned a virtual mobile phone number before they can use the browser to make calls." })] }); 16944 $[4] = t3; 16945 } else t3 = $[4]; 16946 let t4; 16947 if ($[5] !== handleCancelNoVirtualPhone) { 16948 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogCancel, { 16949 onClick: handleCancelNoVirtualPhone, 16950 children: "Cancel" 16951 }); 16952 $[5] = handleCancelNoVirtualPhone; 16953 $[6] = t4; 16954 } else t4 = $[6]; 16955 let t5; 16956 if ($[7] !== handleGoSetting) { 16957 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogAction, { 16958 onClick: handleGoSetting, 16959 children: "GO SETTING" 16960 }); 16961 $[7] = handleGoSetting; 16962 $[8] = t5; 16963 } else t5 = $[8]; 16964 let t6; 16965 if ($[9] !== t4 || $[10] !== t5) { 16966 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogContent, { 16967 className: "max-w-lg", 16968 children: [t3, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogFooter, { children: [t4, t5] })] 16969 }); 16970 $[9] = t4; 16971 $[10] = t5; 16972 $[11] = t6; 16973 } else t6 = $[11]; 16974 let t7; 16975 if ($[12] !== open || $[13] !== t6) { 16976 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialog, { 16977 open, 16978 children: t6 16979 }); 16980 $[12] = open; 16981 $[13] = t6; 16982 $[14] = t7; 16983 } else t7 = $[14]; 16984 return t7; 16985} 16986var dialer_no_virtual_phone_available_alert_dialog_default = DialerNoVirtualPhoneAvailableAlertDialog; 16987var import_compiler_runtime$76 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 16988function InputGroup(t0) { 16989 const $ = (0, import_compiler_runtime$76.c)(8); 16990 let className; 16991 let props; 16992 if ($[0] !== t0) { 16993 ({className, ...props} = t0); 16994 $[0] = t0; 16995 $[1] = className; 16996 $[2] = props; 16997 } else { 16998 className = $[1]; 16999 props = $[2]; 17000 } 17001 let t1; 17002 if ($[3] !== className) { 17003 t1 = cn("group/input-group relative flex w-full items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none dark:bg-input/30", "h-9 min-w-0 has-[>textarea]:h-auto", "has-[>[data-align=inline-start]]:[&>input]:pl-2", "has-[>[data-align=inline-end]]:[&>input]:pr-2", "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3", "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3", "has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control]:focus-visible]:ring-ring/20", "has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40", className); 17004 $[3] = className; 17005 $[4] = t1; 17006 } else t1 = $[4]; 17007 let t2; 17008 if ($[5] !== props || $[6] !== t1) { 17009 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 17010 "data-slot": "input-group", 17011 role: "group", 17012 className: t1, 17013 ...props 17014 }); 17015 $[5] = props; 17016 $[6] = t1; 17017 $[7] = t2; 17018 } else t2 = $[7]; 17019 return t2; 17020} 17021var inputGroupAddonVariants = cva("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50", { 17022 variants: { align: { 17023 "inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]", 17024 "inline-end": "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]", 17025 "block-start": "order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5", 17026 "block-end": "order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5" 17027 } }, 17028 defaultVariants: { align: "inline-start" } 17029}); 17030function InputGroupAddon(t0) { 17031 const $ = (0, import_compiler_runtime$76.c)(11); 17032 let className; 17033 let props; 17034 let t1; 17035 if ($[0] !== t0) { 17036 ({className, align: t1, ...props} = t0); 17037 $[0] = t0; 17038 $[1] = className; 17039 $[2] = props; 17040 $[3] = t1; 17041 } else { 17042 className = $[1]; 17043 props = $[2]; 17044 t1 = $[3]; 17045 } 17046 const align = t1 === void 0 ? "inline-start" : t1; 17047 let t2; 17048 if ($[4] !== align || $[5] !== className) { 17049 t2 = cn(inputGroupAddonVariants({ align }), className); 17050 $[4] = align; 17051 $[5] = className; 17052 $[6] = t2; 17053 } else t2 = $[6]; 17054 let t3; 17055 if ($[7] !== align || $[8] !== props || $[9] !== t2) { 17056 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 17057 role: "group", 17058 "data-slot": "input-group-addon", 17059 "data-align": align, 17060 className: t2, 17061 onClick: _temp$16, 17062 ...props 17063 }); 17064 $[7] = align; 17065 $[8] = props; 17066 $[9] = t2; 17067 $[10] = t3; 17068 } else t3 = $[10]; 17069 return t3; 17070} 17071function _temp$16(e$4) { 17072 if (e$4.target.closest("button")) return; 17073 e$4.currentTarget.parentElement?.querySelector("input")?.focus(); 17074} 17075var inputGroupButtonVariants = cva("text-sm shadow-none flex gap-2 items-center", { 17076 variants: { size: { 17077 xs: "h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2", 17078 sm: "h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5", 17079 "icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0", 17080 "icon-sm": "size-8 p-0 has-[>svg]:p-0" 17081 } }, 17082 defaultVariants: { size: "xs" } 17083}); 17084function InputGroupButton(t0) { 17085 const $ = (0, import_compiler_runtime$76.c)(15); 17086 let className; 17087 let props; 17088 let t1; 17089 let t2; 17090 let t3; 17091 if ($[0] !== t0) { 17092 ({className, type: t1, variant: t2, size: t3, ...props} = t0); 17093 $[0] = t0; 17094 $[1] = className; 17095 $[2] = props; 17096 $[3] = t1; 17097 $[4] = t2; 17098 $[5] = t3; 17099 } else { 17100 className = $[1]; 17101 props = $[2]; 17102 t1 = $[3]; 17103 t2 = $[4]; 17104 t3 = $[5]; 17105 } 17106 const type = t1 === void 0 ? "button" : t1; 17107 const variant = t2 === void 0 ? "ghost" : t2; 17108 const size = t3 === void 0 ? "xs" : t3; 17109 let t4; 17110 if ($[6] !== className || $[7] !== size) { 17111 t4 = cn(inputGroupButtonVariants({ size }), className); 17112 $[6] = className; 17113 $[7] = size; 17114 $[8] = t4; 17115 } else t4 = $[8]; 17116 let t5; 17117 if ($[9] !== props || $[10] !== size || $[11] !== t4 || $[12] !== type || $[13] !== variant) { 17118 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 17119 type, 17120 "data-size": size, 17121 variant, 17122 className: t4, 17123 ...props 17124 }); 17125 $[9] = props; 17126 $[10] = size; 17127 $[11] = t4; 17128 $[12] = type; 17129 $[13] = variant; 17130 $[14] = t5; 17131 } else t5 = $[14]; 17132 return t5; 17133} 17134function InputGroupInput(t0) { 17135 const $ = (0, import_compiler_runtime$76.c)(8); 17136 let className; 17137 let props; 17138 if ($[0] !== t0) { 17139 ({className, ...props} = t0); 17140 $[0] = t0; 17141 $[1] = className; 17142 $[2] = props; 17143 } else { 17144 className = $[1]; 17145 props = $[2]; 17146 } 17147 let t1; 17148 if ($[3] !== className) { 17149 t1 = cn("flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent", className); 17150 $[3] = className; 17151 $[4] = t1; 17152 } else t1 = $[4]; 17153 let t2; 17154 if ($[5] !== props || $[6] !== t1) { 17155 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input, { 17156 "data-slot": "input-group-control", 17157 className: t1, 17158 ...props 17159 }); 17160 $[5] = props; 17161 $[6] = t1; 17162 $[7] = t2; 17163 } else t2 = $[7]; 17164 return t2; 17165} 17166var import_compiler_runtime$75 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 17167var TableContainer = (t0) => {
17168 const $ = (0, import_compiler_runtime$75.c)(10); 17169 let className; 17170 let props; 17171 let ref; 17172 if ($[0] !== t0) { 17173 ({className, ref, ...props} = t0); 17174 $[0] = t0; 17175 $[1] = className; 17176 $[2] = props; 17177 $[3] = ref; 17178 } else { 17179 className = $[1]; 17180 props = $[2]; 17181 ref = $[3]; 17182 } 17183 let t1; 17184 if ($[4] !== className) { 17185 t1 = cn("relative w-full overflow-auto", className); 17186 $[4] = className; 17187 $[5] = t1; 17188 } else t1 = $[5]; 17189 let t2; 17190 if ($[6] !== props || $[7] !== ref || $[8] !== t1) { 17191 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 17192 ref, 17193 "data-slot": "table-container", 17194 className: t1, 17195 ...props 17196 }); 17197 $[6] = props; 17198 $[7] = ref; 17199 $[8] = t1; 17200 $[9] = t2; 17201 } else t2 = $[9]; 17202 return t2; 17203}; 17204var Table$1 = (t0) => { 17205 const $ = (0, import_compiler_runtime$75.c)(10); 17206 let className; 17207 let props; 17208 let ref; 17209 if ($[0] !== t0) { 17210 ({className, ref, ...props} = t0); 17211 $[0] = t0; 17212 $[1] = className; 17213 $[2] = props; 17214 $[3] = ref; 17215 } else { 17216 className = $[1]; 17217 props = $[2]; 17218 ref = $[3]; 17219 } 17220 let t1; 17221 if ($[4] !== className) { 17222 t1 = cn("w-full caption-bottom text-sm", className); 17223 $[4] = className; 17224 $[5] = t1; 17225 } else t1 = $[5]; 17226 let t2; 17227 if ($[6] !== props || $[7] !== ref || $[8] !== t1) { 17228 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("table", { 17229 ref, 17230 "data-slot": "table", 17231 className: t1, 17232 ...props 17233 }); 17234 $[6] = props; 17235 $[7] = ref; 17236 $[8] = t1; 17237 $[9] = t2; 17238 } else t2 = $[9]; 17239 return t2; 17240}; 17241var tableHeaderVariant = T({ base: "font-medium text-xs" }); 17242var TableHeader = (t0) => { 17243 const $ = (0, import_compiler_runtime$75.c)(10); 17244 let className; 17245 let props; 17246 let ref; 17247 if ($[0] !== t0) { 17248 ({className, ref, ...props} = t0); 17249 $[0] = t0; 17250 $[1] = className; 17251 $[2] = props; 17252 $[3] = ref; 17253 } else { 17254 className = $[1]; 17255 props = $[2]; 17256 ref = $[3]; 17257 } 17258 let t1; 17259 if ($[4] !== className) { 17260 t1 = tableHeaderVariant({ className }); 17261 $[4] = className; 17262 $[5] = t1; 17263 } else t1 = $[5]; 17264 let t2; 17265 if ($[6] !== props || $[7] !== ref || $[8] !== t1) { 17266 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { 17267 ref, 17268 "data-slot": "table-header", 17269 className: t1, 17270 ...props 17271 }); 17272 $[6] = props; 17273 $[7] = ref; 17274 $[8] = t1; 17275 $[9] = t2; 17276 } else t2 = $[9]; 17277 return t2; 17278}; 17279var tableHeadVariant = T({ base: "bg-background px-2 py-3.5 text-left align-middle font-medium whitespace-nowrap text-muted-foreground transition-all [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]" }); 17280var TableHead = (t0) => { 17281 const $ = (0, import_compiler_runtime$75.c)(10); 17282 let className; 17283 let props; 17284 let ref; 17285 if ($[0] !== t0) { 17286 ({className, ref, ...props} = t0); 17287 $[0] = t0; 17288 $[1] = className; 17289 $[2] = props; 17290 $[3] = ref; 17291 } else { 17292 className = $[1]; 17293 props = $[2]; 17294 ref = $[3]; 17295 } 17296 let t1; 17297 if ($[4] !== className) { 17298 t1 = tableHeadVariant({ className }); 17299 $[4] = className; 17300 $[5] = t1; 17301 } else t1 = $[5]; 17302 let t2; 17303 if ($[6] !== props || $[7] !== ref || $[8] !== t1) { 17304 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { 17305 ref, 17306 "data-slot": "table-head", 17307 className: t1, 17308 ...props 17309 }); 17310 $[6] = props; 17311 $[7] = ref; 17312 $[8] = t1; 17313 $[9] = t2; 17314 } else t2 = $[9]; 17315 return t2; 17316}; 17317var TableBody = (t0) => { 17318 const $ = (0, import_compiler_runtime$75.c)(10); 17319 let className; 17320 let props; 17321 let ref; 17322 if ($[0] !== t0) { 17323 ({className, ref, ...props} = t0); 17324 $[0] = t0; 17325 $[1] = className; 17326 $[2] = props; 17327 $[3] = ref; 17328 } else { 17329 className = $[1]; 17330 props = $[2]; 17331 ref = $[3]; 17332 } 17333 let t1; 17334 if ($[4] !== className) { 17335 t1 = cn("[&_tr:last-child]:border-0 [&_tr:last-child]:border-border", className); 17336 $[4] = className; 17337 $[5] = t1; 17338 } else t1 = $[5]; 17339 let t2; 17340 if ($[6] !== props || $[7] !== ref || $[8] !== t1) { 17341 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { 17342 ref, 17343 "data-slot": "table-body", 17344 className: t1, 17345 ...props 17346 }); 17347 $[6] = props; 17348 $[7] = ref; 17349 $[8] = t1; 17350 $[9] = t2; 17351 } else t2 = $[9]; 17352 return t2; 17353}; 17354var tableFooterVariant = T({ base: "font-medium bg-muted/50 [&>tr]:last:border-b-0" }); 17355var TableFooter = (t0) => { 17356 const $ = (0, import_compiler_runtime$75.c)(10); 17357 let className; 17358 let props; 17359 let ref; 17360 if ($[0] !== t0) { 17361 ({className, ref, ...props} = t0); 17362 $[0] = t0; 17363 $[1] = className; 17364 $[2] = props; 17365 $[3] = ref; 17366 } else { 17367 className = $[1]; 17368 props = $[2]; 17369 ref = $[3]; 17370 } 17371 let t1; 17372 if ($[4] !== className) { 17373 t1 = tableFooterVariant({ className }); 17374 $[4] = className; 17375 $[5] = t1; 17376 } else t1 = $[5]; 17377 let t2; 17378 if ($[6] !== props || $[7] !== ref || $[8] !== t1) { 17379 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tfoot", { 17380 ref, 17381 "data-slot": "table-footer", 17382 className: t1, 17383 ...props 17384 }); 17385 $[6] = props; 17386 $[7] = ref; 17387 $[8] = t1; 17388 $[9] = t2; 17389 } else t2 = $[9]; 17390 return t2; 17391}; 17392var tableRowVariant = T({ base: "transition-colors border-b border-border group/tr" }); 17393var TableRow = (t0) => {
17394 const $ = (0, import_compiler_runtime$75.c)(10); 17395 let className; 17396 let props; 17397 let ref; 17398 if ($[0] !== t0) { 17399 ({className, ref, ...props} = t0); 17400 $[0] = t0; 17401 $[1] = className; 17402 $[2] = props; 17403 $[3] = ref; 17404 } else { 17405 className = $[1]; 17406 props = $[2]; 17407 ref = $[3]; 17408 } 17409 let t1; 17410 if ($[4] !== className) { 17411 t1 = tableRowVariant({ className }); 17412 $[4] = className; 17413 $[5] = t1; 17414 } else t1 = $[5]; 17415 let t2; 17416 if ($[6] !== props || $[7] !== ref || $[8] !== t1) { 17417 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { 17418 ref, 17419 "data-slot": "table-row", 17420 className: t1, 17421 ...props 17422 }); 17423 $[6] = props; 17424 $[7] = ref; 17425 $[8] = t1; 17426 $[9] = t2; 17427 } else t2 = $[9]; 17428 return t2; 17429}; 17430var tableCellVariant = T({ base: ["px-2 py-3.5 align-middle whitespace-nowrap text-foreground transition-all [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", "group-hover/tr:bg-[color-mix(in_srgb,var(--accent)_50%,var(--background))] group-data-[state=selected]/tr:bg-accent"] }); 17431var TableCell = (t0) => { 17432 const $ = (0, import_compiler_runtime$75.c)(10); 17433 let className; 17434 let props; 17435 let ref; 17436 if ($[0] !== t0) { 17437 ({className, ref, ...props} = t0); 17438 $[0] = t0; 17439 $[1] = className; 17440 $[2] = props; 17441 $[3] = ref; 17442 } else { 17443 className = $[1]; 17444 props = $[2]; 17445 ref = $[3]; 17446 } 17447 let t1; 17448 if ($[4] !== className) { 17449 t1 = tableCellVariant({ className }); 17450 $[4] = className; 17451 $[5] = t1; 17452 } else t1 = $[5]; 17453 let t2; 17454 if ($[6] !== props || $[7] !== ref || $[8] !== t1) { 17455 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { 17456 ref, 17457 "data-slot": "table-cell", 17458 className: t1, 17459 ...props 17460 }); 17461 $[6] = props; 17462 $[7] = ref; 17463 $[8] = t1; 17464 $[9] = t2; 17465 } else t2 = $[9]; 17466 return t2; 17467}; 17468var iconSortingVariants = T({ 17469 base: "size-4 text-muted-foreground/60 transition-color duration-200 inline-block", 17470 variants: { variant: { 17471 asc: "[&>path:last-child]:text-primary", 17472 desc: "[&>path:first-child]:text-primary", 17473 false: "" 17474 } }, 17475 defaultVariants: { variant: false } 17476}); 17477var IconSorting = (t0) => { 17478 const $ = (0, import_compiler_runtime$75.c)(12); 17479 let className; 17480 let props; 17481 let ref; 17482 let variant; 17483 if ($[0] !== t0) { 17484 ({variant, ref, className, ...props} = t0); 17485 $[0] = t0; 17486 $[1] = className; 17487 $[2] = props; 17488 $[3] = ref; 17489 $[4] = variant; 17490 } else { 17491 className = $[1]; 17492 props = $[2]; 17493 ref = $[3]; 17494 variant = $[4]; 17495 } 17496 let t1; 17497 if ($[5] !== className || $[6] !== variant) { 17498 t1 = iconSortingVariants({ 17499 variant, 17500 className 17501 }); 17502 $[5] = className; 17503 $[6] = variant; 17504 $[7] = t1; 17505 } else t1 = $[7]; 17506 let t2; 17507 if ($[8] !== props || $[9] !== ref || $[10] !== t1) { 17508 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronsUpDown, { 17509 ref, 17510 className: t1, 17511 ...props 17512 }); 17513 $[8] = props; 17514 $[9] = ref; 17515 $[10] = t1; 17516 $[11] = t2; 17517 } else t2 = $[11]; 17518 return t2; 17519}; 17520const getCommonPinningStyles = (column) => { 17521 const isPinned = column.getIsPinned(); 17522 const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left"); 17523 const isFirstRightPinnedColumn = isPinned === "right" && column.getIsFirstColumn("right"); 17524 if (!isPinned) return css` 17525 width: ${column.getSize()}px; 17526 `; 17527 return css` 17528 left: ${isPinned === "left" ? `${column.getStart("left")}px` : "auto"}; 17529 right: ${isPinned === "right" ? `${column.getAfter("right")}px` : "auto"}; 17530 position: ${isPinned ? "sticky" : "relative"}; 17531 width: ${column.getSize()}px; 17532 z-index: ${isPinned ? 10 : 0}; 17533 17534 ${isLastLeftPinnedColumn && css` 17535 &::after { 17536 position: absolute; 17537 top: 0; 17538 right: 0px; 17539 bottom: 0px; 17540 width: 30px; 17541 transform: translateX(100%); 17542 transition: box-shadow 0.3s; 17543 content: ''; 17544 pointer-events: none; 17545 will-change: transform; 17546 border-left: 1px solid var(--border); 17547 box-shadow: inset 10px 0 8px -8px var(--accent); 17548 } 17549 `} 17550 17551 ${isFirstRightPinnedColumn && css` 17552 &::before { 17553 position: absolute; 17554 top: 0; 17555 left: 0px; 17556 bottom: 0px; 17557 width: 30px; 17558 transition: box-shadow 0.3s; 17559 content: ''; 17560 pointer-events: none; 17561 will-change: transform; 17562 border-left: 1px solid var(--border); 17563 box-shadow: -4px 0 8px 0 var(--accent); 17564 } 17565 `} 17566 `; 17567}; 17568const tableSlotsVariants = T({ 17569 slots: { 17570 tableContainerVariants: "relative", 17571 tableVariants: "", 17572 tableHeaderVariants: "", 17573 tableHeaderRowVariants: "group/header-wrap", 17574 tableHeadVariants: "group/header", 17575 iconSortingVariants: "group-hover/header:text-foreground ml-0.5", 17576 tableBodyVariants: "", 17577 tableRowVariants: "", 17578 tableCellVariants: "", 17579 tableFooterVariants: "", 17580 tableFooterRowVariants: "", 17581 tableFootVariants: "bg-muted/10 text-foreground" 17582 }, 17583 variants: { 17584 isSorting: { true: { tableHeadVariants: "cursor-pointer select-none" } }, 17585 stickyHeader: { true: { tableHeaderVariants: "sticky top-0 z-20" } }, 17586 isPinned: { true: { 17587 tableCellVariants: "bg-background", 17588 tableHeadVariants: "bg-background" 17589 } }, 17590 isSelected: { true: { tableRowVariants: "bg-accent" } } 17591 }, 17592 compoundVariants: [{ 17593 isPinned: true, 17594 isSelected: true, 17595 class: { tableCellVariants: "bg-accent" } 17596 }] 17597}); 17598const DEFAULT_PAGINATION_SIZE_OPTIONS = [ 17599 10, 17600 20, 17601 50, 17602 100, 17603 200 17604]; 17605const DEFAULT_PAGINATION_SHOW_PAGE_SIZE_SELECTOR = true; 17606const DEFAULT_PAGINATION_SHOW_ITEMS_INFO = true; 17607const DEFAULT_PAGE_SIZE = 20; 17608const TableContext = (0, import_react.createContext)({ 17609 loading: false, 17610 isSorting: false, 17611 isMultiSort: false, 17612 slotsVariants: tableSlotsVariants({}) 17613}); 17614const useTableContext = () => { 17615 const context = (0, import_react.useContext)(TableContext); 17616 if (!context || !context.table) throw Error("Table components must be used within a Table context"); 17617 return context; 17618}; 17619var TableBody$1 = () => { 17620 const { table, renderExpanded, onRowContextMenu, slotsVariants: { tableBodyVariants, tableRowVariants, tableCellVariants }, onRow } = useTableContext(); 17621 const isManualRenderExpanded = !!renderExpanded; 17622 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableBody, { 17623 className: tableBodyVariants(), 17624 children: table?.getRowModel().rows.map((row, index) => { 17625 const cells = row.getVisibleCells(); 17626 const rowProps = onRow?.(row, index); 17627 const isSelected = row.getIsSelected(); 17628 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableRow, { 17629 onContextMenu: (e$4) => onRowContextMenu?.(e$4, row), 17630 ...rowProps, 17631 className: tableRowVariants({ 17632 isSelected, 17633 className: rowProps?.className 17634 }), 17635 children: cells.map((cell) => { 17636 const Cell = cell.column.columnDef.cell; 17637 const props = cell.getContext(); 17638 const { column } = cell; 17639 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, { 17640 className: tableCellVariants({ 17641 isPinned: Boolean(cell.column.getIsPinned()), 17642 isSelected, 17643 className: getCommonPinningStyles(column) 17644 }), 17645 children: flexRender(Cell, props) 17646 }, cell.id); 17647 }) 17648 }
17648), row.getIsExpanded() && isManualRenderExpanded && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableRow, { 17649 className: tableRowVariants(), 17650 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, { 17651 colSpan: row.getVisibleCells().length, 17652 className: tableCellVariants(), 17653 children: renderExpanded?.({ row }) 17654 }) 17655 })] }, row.id); 17656 }) 17657 }); 17658}; 17659var table_body_default = (0, import_react.memo)(TableBody$1); 17660var SvgNoResult = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { 17661 width: 70, 17662 height: 70, 17663 viewBox: "0 0 70 70", 17664 fill: "none", 17665 xmlns: "http://www.w3.org/2000/svg", 17666 ...props, 17667 children: [ 17668 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("mask", { 17669 id: "mask0_20847_3910", 17670 style: { maskType: "alpha" }, 17671 maskUnits: "userSpaceOnUse", 17672 x: 5, 17673 y: 5, 17674 width: 65, 17675 height: 65, 17676 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 17677 d: "M37.45 69.3C55.0402 69.3 69.3 55.0402 69.3 37.45C69.3 19.8597 55.0402 5.59998 37.45 5.59998C19.8597 5.59998 5.59998 19.8597 5.59998 37.45C5.59998 55.0402 19.8597 69.3 37.45 69.3Z", 17678 fill: "white" 17679 }) 17680 }), 17681 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { 17682 mask: "url(#mask0_20847_3910)", 17683 children: [
17684 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 17685 d: "M37.45 69.3C55.0402 69.3 69.3 55.0402 69.3 37.45C69.3 19.8597 55.0402 5.59998 37.45 5.59998C19.8597 5.59998 5.59998 19.8597 5.59998 37.45C5.59998 55.0402 19.8597 69.3 37.45 69.3Z", 17686 fill: "url(#paint0_linear_20847_3910)" 17687 }), 17688 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 17689 d: "M25.2 52.5C38.3444 52.5 49 41.8444 49 28.7C49 15.5556 38.3444 4.90002 25.2 4.90002C12.0556 4.90002 1.40002 15.5556 1.40002 28.7C1.40002 41.8444 12.0556 52.5 25.2 52.5Z", 17690 fill: "url(#paint1_linear_20847_3910)" 17691 }), 17692 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 17693 d: "M43.5098 39.0902L59.0227 55.4128L55.0629 59.3726L39.55 43.05L43.5098 39.0902Z", 17694 fill: "url(#paint2_linear_20847_3910)" 17695 }), 17696 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 17697 d: "M53.9527 47.3731L67.812 61.2324C69.7256 63.146 69.7256 66.2485 67.812 68.1621C65.8984 70.0756 62.7959 70.0756 60.8824 68.1621L47.0231 54.3028C46.4763 53.756 46.4763 52.8696 47.0231 52.3229L51.9728 47.3731C52.5196 46.8264 53.406 46.8264 53.9527 47.3731Z", 17698 fill: "url(#paint3_linear_20847_3910)" 17699 }) 17700 ] 17701 }), 17702 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 17703 d: "M25.2 49C38.3444 49 49 38.3444 49 25.2C49 12.0556 38.3444 1.40002 25.2 1.40002C12.0556 1.40002 1.40002 12.0556 1.40002 25.2C1.40002 38.3444 12.0556 49 25.2 49Z", 17704 fill: "url(#paint4_linear_20847_3910)" 17705 }), 17706 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 17707 d: "M25.2 44.8C36.0248 44.8 44.8 36.0248 44.8 25.2C44.8 14.3752 36.0248 5.59998 25.2 5.59998C14.3752 5.59998 5.59998 14.3752 5.59998 25.2C5.59998 36.0248 14.3752 44.8 25.2 44.8Z", 17708 fill: "url(#paint5_linear_20847_3910)" 17709 }), 17710 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 17711 d: "M27.2087 28.5481V27.6593C27.2087 27.2049 27.3136 26.8543 27.5233 26.6074C27.733 26.3605 28.1429 26.0988 28.7531 25.8222C29.5157 25.4667 30.1592 25.1309 30.6835 24.8148C31.2078 24.4988 31.6321 24.1235 31.9562 23.6889C32.2803 23.2543 32.5186 22.7259 32.6712 22.1037C32.8237 21.4815 32.9 20.6864 32.9 19.7185C32.9 18.4543 32.7284 17.4469 32.3852 16.6963C32.042 15.9457 31.5558 15.3728 30.9266 14.9778C30.2974 14.5827 29.5395 14.321 28.653 14.1926C27.7664 14.0642 26.7797 14 25.6929 14C24.549 14 23.5194 14.0593 22.6042 14.1778C21.6891 14.2963 20.9073 14.558 20.2591 14.963C19.6108 15.3679 19.1104 15.9457 18.7576 16.6963C18.4049 17.4469 18.219 18.4543 18.2 19.7185V20.637H23.119V19.7185C23.119 19.3037 23.1857 18.9778 23.3192 18.7407C23.4527 18.5037 23.6338 18.321 23.8626 18.1926C24.0914 18.0642 24.3631 17.9852 24.6777 17.9556C24.9923 17.9259 25.3307 17.9111 25.6929 17.9111C26.4747 17.9111 27.0514 18.0148 27.4232 18.2222C27.795 18.4296 27.9809 18.9284 27.9809 19.7185C27.9809 20.1333 27.938 20.4741 27.8522 20.7407C27.7664 21.0074 27.6425 21.2296 27.4804 21.4074C27.3183 21.5852 27.1324 21.7383 26.9227 21.8667C26.713 21.9951 26.4842 22.1185 26.2363 22.237L25.2068 22.7407C24.5394 23.0765 24.0151 23.3926 23.6338 23.6889C23.2525 23.9852 22.9617 24.3111 22.7615 24.6667C22.5613 25.0222 22.4326 25.437 22.3754 25.9111C22.3182 26.3852 22.2896 26.9679 22.2896 27.6593V28.5481H27.2087ZM27.0657 31.2444H22.4326V36.4H27.0657V31.2444Z", 17712 fill: "white" 17713 }), 17714 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 17715 d: "M25.2 5.59998C26.3858 5.59998 27.5471 5.70529 28.6749 5.90706C31.7396 9.36622 33.6 13.9158 33.6 18.9C33.6 29.7248 24.8248 38.5 14 38.5C12.8141 38.5 11.6529 38.3947 10.5251 38.1929C7.46035 34.7337 5.59998 30.1841 5.59998 25.2C5.59998 14.3752 14.3752 5.59998 25.2 5.59998Z", 17716 fill: "url(#paint6_linear_20847_3910)", 17717 fillOpacity: .1 17718 }), 17719 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("defs", { children: [ 17720 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { 17721 id: "paint0_linear_20847_3910", 17722 x1: -57.1862, 17723 y1: -55.5482, 17724 x2: 60.0111, 17725 y2: 59.0657, 17726 gradientUnits: "userSpaceOnUse", 17727 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#D2D5DA" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { 17728 offset: 1, 17729 stopColor: "#E3E5E8" 17730 })] 17731 }),
17732 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { 17733 id: "paint1_linear_20847_3910", 17734 x1: 43.4483, 17735 y1: 59.0218, 17736 x2: 25.2, 17737 y2: 28.7, 17738 gradientUnits: "userSpaceOnUse", 17739 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#E3E5E8" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { 17740 offset: 1, 17741 stopColor: "#D2D5DA" 17742 })] 17743 }), 17744 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { 17745 id: "paint2_linear_20847_3910", 17746 x1: 49.2864, 17747 y1: 49.2314, 17748 x2: 41.2081, 17749 y2: 40.9647, 17750 gradientUnits: "userSpaceOnUse", 17751 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#F4F5F6" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { 17752 offset: 1, 17753 stopColor: "#E3E5E8" 17754 })] 17755 }), 17756 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { 17757 id: "paint3_linear_20847_3910", 17758 x1: 49.4979, 17759 y1: 49.848, 17760 x2: 69.1862, 17761 y2: 69.5362, 17762 gradientUnits: "userSpaceOnUse", 17763 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#C9CCD1" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { 17764 offset: 1, 17765 stopColor: "#E3E5E8" 17766 })] 17767 }), 17768 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { 17769 id: "paint4_linear_20847_3910", 17770 x1: 25.2, 17771 y1: 49, 17772 x2: 23.9857, 17773 y2: 13.3259, 17774 gradientUnits: "userSpaceOnUse", 17775 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#F9FAFA" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { 17776 offset: 1, 17777 stopColor: "#F1F2F4" 17778 })] 17779 }), 17780 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { 17781 id: "paint5_linear_20847_3910", 17782 x1: 5.59998, 17783 y1: 5.59998, 17784 x2: 44.8, 17785 y2: 44.8, 17786 gradientUnits: "userSpaceOnUse", 17787 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#E3E5E8" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { 17788 offset: 1, 17789 stopColor: "#D2D5DA" 17790 })] 17791 }), 17792 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { 17793 id: "paint6_linear_20847_3910", 17794 x1: 15.2545, 17795 y1: 38.5, 17796 x2: 15.2545, 17797 y2: 7.54728, 17798 gradientUnits: "userSpaceOnUse", 17799 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#F4F5F6" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { 17800 offset: 1, 17801 stopColor: "#FCFCFD" 17802 })] 17803 }) 17804 ] }) 17805 ] 17806}); 17807var no_result_default = SvgNoResult; 17808var TableEmpty = () => { 17809 const { table } = useTableContext(); 17810 const numOfCol = table?.getHeaderGroups().at(-1)?.headers.length ?? 1; 17811 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableBody, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, { 17812 colSpan: numOfCol, 17813 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Empty, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EmptyHeader, { children: [ 17814 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyMedia, { 17815 variant: "default", 17816 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(no_result_default, {}) 17817 }), 17818 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyTitle, { children: "No results found" }), 17819 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyDescription, { children: "Try adjusting your filters or add new data to get started." }) 17820 ] }) }) 17821 }) }) }); 17822}; 17823var table_empty_default = (0, import_react.memo)(TableEmpty); 17824var TableFoot = () => { 17825 const { table, slotsVariants: { tableFooterVariants, tableFooterRowVariants, tableFootVariants } } = useTableContext(); 17826 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableFooter, { 17827 className: tableFooterVariants(), 17828 children: table?.getFooterGroups().map((footerGroup) => { 17829 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableRow, { 17830 className: tableFooterRowVariants(), 17831 children: footerGroup.headers.map((head) => { 17832 const Cell = head.column.columnDef.footer; 17833 const props = head.getContext(); 17834 const { column } = head; 17835 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, { 17836 colSpan: head.colSpan, 17837 className: tableFootVariants({ className: getCommonPinningStyles(column) }), 17838 children: flexRender(head.isPlaceholder ? null : Cell, props) 17839 }, head.id); 17840 }) 17841 }, footerGroup.id); 17842 }) 17843 }); 17844}; 17845var table_foot_default = (0, import_react.memo)(TableFoot); 17846var TableHead$1 = ({ className }) => { 17847 const { table, isSorting, isMultiSort, slotsVariants: { tableHeaderVariants, tableHeaderRowVariants, tableHeadVariants, iconSortingVariants: iconSortingVariants$1 } } = useTableContext(); 17848 const handleSorting = (head) => { 17849 if (!isSorting || !head.column.getCanSort()) return () => void 0; 17850 if (isMultiSort) return () => { 17851 const nextSortOrder = String(head.column.getNextSortingOrder()); 17852 head.column.toggleSorting({ 17853 asc: false, 17854 desc: true, 17855 false: void 0 17856 }[nextSortOrder], isMultiSort); 17857 }; 17858 return head.column.getToggleSortingHandler(); 17859 }; 17860 const getHeadTitle = (head_0) => { 17861 if (!head_0.column.getCanSort()) return void 0; 17862 return { 17863 asc: "Sort ascending", 17864 desc: "Sort descending", 17865 false: "Clear sort" 17866 }[String(head_0.column.getNextSortingOrder())]; 17867 }; 17868 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHeader, { 17869 className: tableHeaderVariants({ className }), 17870 children: table?.getHeaderGroups().map((headerGroup) => { 17871 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableRow, { 17872 className: tableHeaderRowVariants(), 17873 children: headerGroup.headers.map((head_1) => { 17874 const Cell = head_1.column.columnDef.header; 17875 const props = head_1.getContext(); 17876 const { column } = head_1; 17877 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableHead, { 17878 colSpan: head_1.colSpan, 17879 className: tableHeadVariants({ 17880 isSorting: isSorting && column.getCanSort(), 17881 isPinned: Boolean(column.getIsPinned()), 17882 className: getCommonPinningStyles(column) 17883 }), 17884 onClick: handleSorting(head_1), 17885 title: getHeadTitle(head_1), 17886 children: head_1.isPlaceholder ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [flexRender(Cell, props), isSorting && column.getCanSort() && /* @__P
17886URE__ */ (0, import_jsx_runtime.jsx)(IconSorting, { 17887 className: iconSortingVariants$1(), 17888 variant: column.getIsSorted() 17889 })] }) 17890 }, head_1.id); 17891 }) 17892 }, headerGroup.id); 17893 }) 17894 }); 17895}; 17896var table_head_default = (0, import_react.memo)(TableHead$1); 17897var import_compiler_runtime$74 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 17898function Pagination(t0) { 17899 const $ = (0, import_compiler_runtime$74.c)(8); 17900 let className; 17901 let props; 17902 if ($[0] !== t0) { 17903 ({className, ...props} = t0); 17904 $[0] = t0; 17905 $[1] = className; 17906 $[2] = props; 17907 } else { 17908 className = $[1]; 17909 props = $[2]; 17910 } 17911 let t1; 17912 if ($[3] !== className) { 17913 t1 = cn("flex justify-center", className); 17914 $[3] = className; 17915 $[4] = t1; 17916 } else t1 = $[4]; 17917 let t2; 17918 if ($[5] !== props || $[6] !== t1) { 17919 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { 17920 role: "navigation", 17921 "aria-label": "pagination", 17922 "data-slot": "pagination", 17923 className: t1, 17924 ...props 17925 }); 17926 $[5] = props; 17927 $[6] = t1; 17928 $[7] = t2; 17929 } else t2 = $[7]; 17930 return t2; 17931} 17932function PaginationContent(t0) { 17933 const $ = (0, import_compiler_runtime$74.c)(8); 17934 let className; 17935 let props; 17936 if ($[0] !== t0) { 17937 ({className, ...props} = t0); 17938 $[0] = t0; 17939 $[1] = className; 17940 $[2] = props; 17941 } else { 17942 className = $[1]; 17943 props = $[2]; 17944 } 17945 let t1; 17946 if ($[3] !== className) { 17947 t1 = cn("flex flex-row items-center gap-1", className); 17948 $[3] = className; 17949 $[4] = t1; 17950 } else t1 = $[4]; 17951 let t2; 17952 if ($[5] !== props || $[6] !== t1) { 17953 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { 17954 "data-slot": "pagination-content", 17955 className: t1, 17956 ...props 17957 }); 17958 $[5] = props; 17959 $[6] = t1; 17960 $[7] = t2; 17961 } else t2 = $[7]; 17962 return t2; 17963} 17964function PaginationItem(t0) { 17965 const $ = (0, import_compiler_runtime$74.c)(4); 17966 let props; 17967 if ($[0] !== t0) { 17968 ({...props} = t0); 17969 $[0] = t0; 17970 $[1] = props; 17971 } else props = $[1]; 17972 let t1; 17973 if ($[2] !== props) { 17974 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { 17975 "data-slot": "pagination-item", 17976 ...props 17977 }); 17978 $[2] = props; 17979 $[3] = t1; 17980 } else t1 = $[3]; 17981 return t1; 17982} 17983function PaginationLink(t0) { 17984 const $ = (0, import_compiler_runtime$74.c)(16); 17985 let className; 17986 let isActive; 17987 let props; 17988 let t1; 17989 if ($[0] !== t0) { 17990 ({className, isActive, size: t1, ...props} = t0); 17991 $[0] = t0; 17992 $[1] = className; 17993 $[2] = isActive; 17994 $[3] = props; 17995 $[4] = t1; 17996 } else { 17997 className = $[1]; 17998 isActive = $[2]; 17999 props = $[3]; 18000 t1 = $[4]; 18001 } 18002 const size = t1 === void 0 ? "icon" : t1; 18003 const t2 = isActive ? "outline" : "ghost"; 18004 let t3; 18005 if ($[5] !== className) { 18006 t3 = cn("cursor-pointer", className); 18007 $[5] = className; 18008 $[6] = t3; 18009 } else t3 = $[6]; 18010 const t4 = isActive ? "page" : void 0; 18011 let t5; 18012 if ($[7] !== isActive || $[8] !== props || $[9] !== t4) { 18013 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { 18014 "aria-current": t4, 18015 "data-slot": "pagination-link", 18016 "data-active": isActive, 18017 ...props 18018 }); 18019 $[7] = isActive; 18020 $[8] = props; 18021 $[9] = t4; 18022 $[10] = t5; 18023 } else t5 = $[10]; 18024 let t6; 18025 if ($[11] !== size || $[12] !== t2 || $[13] !== t3 || $[14] !== t5) { 18026 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 18027 variant: t2, 18028 size, 18029 className: t3, 18030 asChild: true, 18031 children: t5 18032 }); 18033 $[11] = size; 18034 $[12] = t2; 18035 $[13] = t3; 18036 $[14] = t5; 18037 $[15] = t6; 18038 } else t6 = $[15]; 18039 return t6; 18040} 18041function PaginationPrevious(t0) { 18042 const $ = (0, import_compiler_runtime$74.c)(11); 18043 let children; 18044 let className; 18045 let props; 18046 if ($[0] !== t0) { 18047 ({className, children, ...props} = t0); 18048 $[0] = t0; 18049 $[1] = children; 18050 $[2] = className; 18051 $[3] = props; 18052 } else { 18053 children = $[1]; 18054 className = $[2]; 18055 props = $[3]; 18056 } 18057 let t1; 18058 if ($[4] !== className) { 18059 t1 = cn("gap-1 px-2.5 sm:pl-2.5", className); 18060 $[4] = className; 18061 $[5] = t1; 18062 } else t1 = $[5]; 18063 let t2; 18064 if ($[6] === Symbol.for("react.memo_cache_sentinel")) { 18065 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronLeft, {}); 18066 $[6] = t2; 18067 } else t2 = $[6]; 18068 let t3; 18069 if ($[7] !== children || $[8] !== props || $[9] !== t1) { 18070 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PaginationLink, { 18071 "aria-label": "Go to previous page", 18072 size: "default", 18073 className: t1, 18074 ...props, 18075 children: [t2, children] 18076 }); 18077 $[7] = children; 18078 $[8] = props; 18079 $[9] = t1; 18080 $[10] = t3; 18081 } else t3 = $[10]; 18082 return t3; 18083} 18084function PaginationNext(t0) { 18085 const $ = (0, import_compiler_runtime$74.c)(10); 18086 let className; 18087 let props; 18088 if ($[0] !== t0) { 18089 ({className, ...props} = t0); 18090 $[0] = t0; 18091 $[1] = className; 18092 $[2] = props; 18093 } else { 18094 className = $[1]; 18095 props = $[2]; 18096 } 18097 let t1; 18098 if ($[3] !== className) { 18099 t1 = cn("gap-1 px-2.5 sm:pr-2.5", className); 18100 $[3] = className; 18101 $[4] = t1; 18102 } else t1 = $[4]; 18103 let t2; 18104 let t3; 18105 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 18106 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 18107 className: "hidden sm:block", 18108 children: "Next" 18109 }); 18110 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, {}); 18111 $[5] = t2; 18112 $[6] = t3; 18113 } else { 18114 t2 = $[5]; 18115 t3 = $[6]; 18116 } 18117 let t4; 18118 if ($[7] !== props || $[8] !== t1) { 18119 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PaginationLink, {
18120 "aria-label": "Go to next page", 18121 size: "default", 18122 className: t1, 18123 ...props, 18124 children: [t2, t3] 18125 }); 18126 $[7] = props; 18127 $[8] = t1; 18128 $[9] = t4; 18129 } else t4 = $[9]; 18130 return t4; 18131} 18132function PaginationEllipsis(t0) { 18133 const $ = (0, import_compiler_runtime$74.c)(22); 18134 let className; 18135 let hoverDirection; 18136 let props; 18137 if ($[0] !== t0) { 18138 ({className, hoverDirection, ...props} = t0); 18139 $[0] = t0; 18140 $[1] = className; 18141 $[2] = hoverDirection; 18142 $[3] = props; 18143 } else { 18144 className = $[1]; 18145 hoverDirection = $[2]; 18146 props = $[3]; 18147 } 18148 let t1; 18149 if ($[4] !== className || $[5] !== hoverDirection) { 18150 t1 = cn("flex size-9 items-center justify-center", !!hoverDirection && buttonVariants({ 18151 variant: "ghost", 18152 className: "group/ellipsis cursor-pointer hover:bg-accent" 18153 }), className); 18154 $[4] = className; 18155 $[5] = hoverDirection; 18156 $[6] = t1; 18157 } else t1 = $[6]; 18158 const t2 = !!hoverDirection; 18159 let t3; 18160 if ($[7] !== t2) { 18161 t3 = cn("size-4", { "group-hover/ellipsis:hidden": t2 }); 18162 $[7] = t2; 18163 $[8] = t3; 18164 } else t3 = $[8]; 18165 let t4; 18166 if ($[9] !== t3) { 18167 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Ellipsis, { className: t3 }); 18168 $[9] = t3; 18169 $[10] = t4; 18170 } else t4 = $[10]; 18171 let t5; 18172 if ($[11] !== hoverDirection) { 18173 t5 = hoverDirection === "backward" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronsLeft, { className: "hidden size-4 group-hover/ellipsis:block" }); 18174 $[11] = hoverDirection; 18175 $[12] = t5; 18176 } else t5 = $[12]; 18177 let t6; 18178 if ($[13] !== hoverDirection) { 18179 t6 = hoverDirection === "forward" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronsRight, { className: "hidden size-4 group-hover/ellipsis:block" }); 18180 $[13] = hoverDirection; 18181 $[14] = t6; 18182 } else t6 = $[14]; 18183 let t7; 18184 if ($[15] === Symbol.for("react.memo_cache_sentinel")) { 18185 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 18186 className: "sr-only", 18187 children: "More pages" 18188 }); 18189 $[15] = t7; 18190 } else t7 = $[15]; 18191 let t8; 18192 if ($[16] !== props || $[17] !== t1 || $[18] !== t4 || $[19] !== t5 || $[20] !== t6) { 18193 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { 18194 "aria-hidden": true, 18195 "data-slot": "pagination-ellipsis", 18196 className: t1, 18197 ...props, 18198 children: [ 18199 t4, 18200 t5, 18201 t6, 18202 t7 18203 ] 18204 }); 18205 $[16] = props; 18206 $[17] = t1; 18207 $[18] = t4; 18208 $[19] = t5; 18209 $[20] = t6; 18210 $[21] = t8; 18211 } else t8 = $[21]; 18212 return t8; 18213} 18214var TablePagination = (props) => { 18215 const { pageSizeOptions = DEFAULT_PAGINATION_SIZE_OPTIONS, showPageSizeSelector = true, showGoToPage = false, showItemsInfo = true, maxVisible = 6, containerClassName, ref } = props; 18216 const table = props.table; 18217 const isControlled = !table || "page" in props && "total" in props && "pageSize" in props; 18218 const [goToPageInput, setGoToPageInput] = (0, import_react.useState)(""); 18219 let currentPage; 18220 let totalPages; 18221 let pageSize; 18222 let totalItems; 18223 let startItem; 18224 let endItem; 18225 let canPreviousPage; 18226 let canNextPage; 18227 if (isControlled) { 18228 const controlledProps = props; 18229 currentPage = controlledProps.page ?? 1; 18230 pageSize = controlledProps.pageSize ?? 20; 18231 totalItems = controlledProps.total ?? 0; 18232 totalPages = Math.ceil(totalItems / pageSize); 18233 startItem = (currentPage - 1) * pageSize + 1; 18234 endItem = Math.min(startItem + pageSize - 1, totalItems); 18235 canPreviousPage = currentPage > 1; 18236 canNextPage = currentPage < totalPages; 18237 } else { 18238 const pageIndex = table?.getState().pagination.pageIndex ?? 0; 18239 currentPage = pageIndex + 1; 18240 totalPages = table?.getPageCount() ?? 0; 18241 pageSize = table?.getState().pagination.pageSize ?? 20; 18242 totalItems = table?.getFilteredRowModel().rows.length ?? 0; 18243 startItem = pageIndex * pageSize + 1; 18244 endItem = Math.min(startItem + pageSize - 1, totalItems); 18245 canPreviousPage = table?.getCanPreviousPage() ?? false; 18246 canNextPage = table?.getCanNextPage() ?? false; 18247 } 18248 const handleGoToPage = () => { 18249 const pageNum = parseInt(goToPageInput, 10); 18250 if (pageNum >= 1 && pageNum <= totalPages) { 18251 if (isControlled) props.onPageChange?.(pageNum); 18252 else table?.setPageIndex(pageNum - 1); 18253 setGoToPageInput(""); 18254 } 18255 }; 18256 const handleKeyDown = (e$4) => { 18257 if (e$4.key === "Enter") handleGoToPage(); 18258 }; 18259 const handleGoToInputBlur = (e_0) => { 18260 if (parseInt(e_0.target.value, 10) !== currentPage) handleGoToPage(); 18261 }; 18262 const getPageNumbers = () => { 18263 const pages = []; 18264 if (totalPages <= maxVisible) for (let i = 1; i <= totalPages; i++) pages.push(i); 18265 else { 18266 pages.push(1); 18267 if (currentPage > 4) pages.push("backward"); 18268 const startPage = Math.max(2, currentPage - 2); 18269 const endPage = Math.min(totalPages - 1, currentPage + 2); 18270 for (let i_0 = startPage; i_0 <= endPage; i_0++) pages.push(i_0); 18271 if (currentPage < totalPages - 3) pages.push("forward"); 18272 if (totalPages > 1) pages.push(totalPages); 18273 } 18274 return pages; 18275 }; 18276 const pageNumbers = getPageNumbers(); 18277 if (totalItems === 0) return null; 18278 const handlePageChange = (page_0) => { 18279 if (isControlled) props.onPageChange?.(page_0); 18280 else table?.setPageIndex(page_0 - 1); 18281 }; 18282 const handlePreviousPage = () => { 18283 if (isControlled) { 18284 const controlledProps_2 = props; 18285 if (canPreviousPage) controlledProps_2.onPageChange?.(currentPage - 1); 18286 } else table?.previousPage(); 18287 }; 18288 const handleNextPage = () => { 18289 if (isControlled) { 18290 const controlledProps_3 = props; 18291 if (canNextPage) controlledProps_3.onPageChange?.(currentPage + 1); 18292 } else table?.nextPage(); 18293 }; 18294 const handlePageSizeChange = (newPageSize) => { 18295 if (isControlled) props.onPageSizeChange?.(newPageSize); 18296 else table?.setPagination({ 18297 pageIndex: 0, 18298 pageSize: newPageSize 18299 }); 18300 }; 18301 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 18302 className: cn("flex flex-col items-center justify-center gap-7 border-t border-border py-3 sm:flex-row", containerClassName), 18303 ref, 18304 children: [
18305 showItemsInfo && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 18306 className: "text-sm text-muted-foreground", 18307 children: [ 18308 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 18309 className: "font-medium text-foreground", 18310 children: startItem 18311 }), 18312 " -", 18313 " ", 18314 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 18315 className: "font-medium text-foreground", 18316 children: endItem 18317 }), 18318 " of", 18319 " ", 18320 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 18321 className: "font-medium text-foreground", 18322 children: totalItems 18323 }), 18324 " items" 18325 ] 18326 }), 18327 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Pagination, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PaginationContent, { children: [ 18328 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PaginationPrevious, { 18329 onClick: (e_1) => { 18330 e_1.preventDefault(); 18331 handlePreviousPage(); 18332 }, 18333 className: cn("text-foreground select-none", { "pointer-events-none cursor-not-allowed opacity-50": !canPreviousPage }), 18334 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 18335 className: "hidden sm:block", 18336 children: "Previous" 18337 }) 18338 }) }), 18339 pageNumbers.map((page_1, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PaginationItem, { children: page_1 === "backward" || page_1 === "forward" ? /* @__P
18339URE__ */ (0, import_jsx_runtime.jsx)(PaginationEllipsis, { 18340 hoverDirection: page_1, 18341 className: "text-muted-foreground opacity-50", 18342 onClick: (e_2) => { 18343 e_2.preventDefault(); 18344 if (page_1 === "backward") handlePageChange(Math.max(currentPage - 5, 1)); 18345 else handlePageChange(Math.min(currentPage + 5, totalPages)); 18346 } 18347 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PaginationLink, { 18348 onClick: (e_3) => { 18349 e_3.preventDefault(); 18350 handlePageChange(Number(page_1)); 18351 }, 18352 isActive: currentPage === page_1, 18353 className: "text-foreground select-none", 18354 children: page_1 18355 }) }, `page-${index}`)), 18356 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PaginationItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PaginationNext, { 18357 onClick: (e_4) => { 18358 e_4.preventDefault(); 18359 handleNextPage(); 18360 }, 18361 className: cn("text-foreground select-none", { "pointer-events-none cursor-not-allowed opacity-50": !canNextPage }), 18362 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 18363 className: "hidden sm:block", 18364 children: "Next" 18365 }) 18366 }) }) 18367 ] }), showGoToPage && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 18368 className: "ml-4 flex items-center gap-2", 18369 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 18370 className: "text-sm whitespace-nowrap text-muted-foreground", 18371 children: "Go to" 18372 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input, { 18373 type: "number", 18374 className: "h-9 w-16 text-foreground", 18375 min: 1, 18376 max: totalPages, 18377 value: goToPageInput, 18378 placeholder: currentPage.toString(), 18379 onChange: (e_5) => setGoToPageInput(String(e_5.target.value)), 18380 onKeyDown: handleKeyDown, 18381 onBlur: handleGoToInputBlur 18382 })] 18383 })] }), 18384 showPageSizeSelector && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 18385 className: "flex items-center gap-2", 18386 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select, { 18387 value: String(pageSize), 18388 onValueChange: (value) => handlePageSizeChange(Number(value)), 18389 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectTrigger, { 18390 className: "*:data-[slot=select-value]:text-foreground", 18391 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectValue, { placeholder: pageSize }) 18392 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContent, { children: pageSizeOptions.map((size) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SelectItem, { 18393 value: String(size), 18394 children: [size, "/page"] 18395 }, size)) })] 18396 }) 18397 }) 18398 ] 18399 }) }); 18400}; 18401var table_pagination_default = TablePagination; 18402var TableBodyVirtualized = ({ rowVirtualizer }) => { 18403 const { table, slotsVariants: { tableBodyVariants } } = useTableContext(); 18404 const rows = table?.getRowModel().rows || []; 18405 const virtualItems = rowVirtualizer.getVirtualItems(); 18406 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableBody, { 18407 "data-role": "table-body-virtualized", 18408 className: tableBodyVariants({ className: ["relative", css` 18409 height: ${rowVirtualizer.getTotalSize()}px; 18410 `] }), 18411 children: virtualItems.map((virtualRow) => { 18412 const row = rows[virtualRow.index]; 18413 if (!row) { 18414 console.warn("[TableBodyVirtualized] Missing row at index:", virtualRow.index); 18415 return null; 18416 } 18417 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableBodyRow, { 18418 row, 18419 virtualRow 18420 }, row.id); 18421 }) 18422 }); 18423}; 18424var TableBodyRow = ({ row, virtualRow }) => { 18425 const { onRowContextMenu, onRow, slotsVariants: { tableRowVariants, tableCellVariants } } = useTableContext(); 18426 const cells = row.getVisibleCells(); 18427 const rowProps = onRow?.(row, virtualRow.index); 18428 const isSelected = row.getIsSelected(); 18429 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableRow, { 18430 "data-index": virtualRow.index, 18431 onContextMenu: (e$4) => onRowContextMenu?.(e$4, row), 18432 ...rowProps, 18433 className: tableRowVariants({ 18434 isSelected, 18435 className: [ 18436 "absolute left-0", 18437 rowProps?.className, 18438 css` 18439 height: ${virtualRow.size}px; 18440 transform: translateY(${virtualRow.start}px); 18441 display: table; 18442 width: 100%; 18443 table-layout: fixed; 18444 ` 18445 ] 18446 }), 18447 children: cells.map((cell) => { 18448 const Cell = cell.column.columnDef.cell; 18449 const props = cell.getContext(); 18450 const { column } = cell; 18451 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, { 18452 className: tableCellVariants({ 18453 isPinned: Boolean(cell.column.getIsPinned()), 18454 isSelected, 18455 className: getCommonPinningStyles(column) 18456 }), 18457 children: flexRender(Cell, props) 18458 }, cell.id); 18459 }) 18460 }, row.id); 18461}; 18462var table_body_virtualized_default = (0, import_react.memo)(TableBodyVirtualized); 18463function TableProvider({ children,...props }) { 18464 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableContext.Provider, { 18465 value: { ...props }, 18466 children 18467 }); 18468} 18469var table_provider_default = TableProvider; 18470var TableComponent = ({ ref, data, columns, loading = false, footer = false, pagination = { 18471 page: 1, 18472 pageSize: 20 18473}, filter = false, sorting = false, columnPinning, columnPinningMode = "fixed", expandable, scroll = void 0, rowVirtualizer, scrollContainerRef, containerClassName, paginationClassName, onRowContextMenu, selection = false, onChange, onRow, getRowId, emptyContent }) => { 18474 const isNoPagination = pagination === void 0 || pagination === false; 18475 const page = get(pagination, "page", 1); 18476 const pageSize = get(pagination, "pageSize", 20); 18477 const isControlled = typeof pagination === "object" && "page" in pagination && "total" in pagination && "pageSize" in pagination; 18478 const [internalPagination, setInternalPagination] = (0, import_react.useState)({ 18479 pageIndex: page - 1, 18480 pageSize 18481 }); 18482 const [internalSorting, setInternalSorting] = (0, import_react.useState)(typeof sorting === "object" ? sorting.sortingState : []); 18483 const [hasHorizontalScroll, setHasHorizontalScroll] = (0, import_react.useState)(false); 18484 const tableContainerRef = (0, import_react.useRef)(null);
18485 const resolvedScrollRef = scrollContainerRef ?? tableContainerRef; 18486 const composedScrollRefs = useComposedRefs(tableContainerRef, scrollContainerRef); 18487 const containerSize = useSize_default(tableContainerRef); 18488 const slotsVariants = tableSlotsVariants({ stickyHeader: scroll?.pingingHeader }); 18489 const { tableContainerVariants, tableVariants } = slotsVariants; 18490 const scrollToStart = () => { 18491 resolvedScrollRef.current?.scrollTo({ 18492 top: 0, 18493 left: 0 18494 }); 18495 }; 18496 const handlePaginationChange = (updater) => { 18497 const newState = typeof updater === "function" ? updater(internalPagination) : updater; 18498 setInternalPagination(newState); 18499 const newPagination = { 18500 page: newState.pageIndex + 1, 18501 pageSize: newState.pageSize 18502 }; 18503 onChange?.({ pagination: newPagination }); 18504 scrollToStart(); 18505 }; 18506 const handlePaginationComponentChange = (valueUpdatedType, updater) => { 18507 const currentValue = { 18508 page, 18509 pageSize 18510 }; 18511 return (newValue) => { 18512 if (typeof updater === "function") updater(newValue); 18513 onChange?.({ pagination: { 18514 ...currentValue, 18515 [valueUpdatedType]: newValue 18516 } }); 18517 scrollToStart(); 18518 }; 18519 }; 18520 const handleSortingChange = (updater) => { 18521 const newState = typeof updater === "function" ? updater(internalSorting) : updater; 18522 setInternalSorting(newState); 18523 if (typeof sorting === "object") sorting.onSortingChange?.(newState); 18524 onChange?.({ sorting: newState }); 18525 }; 18526 const handleFilterChange = (updater) => { 18527 const newState = typeof updater === "function" ? updater(filter && Array.isArray(filter) ? filter : []) : updater; 18528 onChange?.({ filter: newState }); 18529 }; 18530 const handleSelectionChange = (updater) => { 18531 if (selection === false) return; 18532 const newState = typeof updater === "function" ? updater(selection.selectionState) : updater; 18533 selection.onSelectionChange?.(newState); 18534 onChange?.({ selection: newState }); 18535 }; 18536 const filterConfig = (0, import_react.useMemo)(() => { 18537 if (filter) return { 18538 manualFiltering: false, 18539 getFilteredRowModel: getFilteredRowModel(), 18540 state: { columnFilters: Array.isArray(filter) ? filter : void 0 }, 18541 onColumnFiltersChange: handleFilterChange 18542 }; 18543 return { manualFiltering: true }; 18544 }, [filter]); 18545 const sortingConfig = (0, import_react.useMemo)(() => { 18546 if (sorting === false) return {}; 18547 return { 18548 manualSorting: true, 18549 enableMultiSort: sorting.enableMultiSort, 18550 enableSortingRemoval: sorting.enableSortingRemoval, 18551 state: { sorting: internalSorting }, 18552 onSortingChange: handleSortingChange 18553 }; 18554 }, [sorting, internalSorting]); 18555 const paginationConfig = (0, import_react.useMemo)(() => { 18556 if (isNoPagination || isControlled) return { 18557 getPaginationRowModel: void 0, 18558 manualPagination: true 18559 }; 18560 return { 18561 getPaginationRowModel: getPaginationRowModel(), 18562 manualPagination: false, 18563 state: { pagination: internalPagination }, 18564 onPaginationChange: handlePaginationChange 18565 }; 18566 }, [ 18567 isNoPagination, 18568 isControlled, 18569 internalPagination 18570 ]); 18571 const columnPinningConfig = (0, import_react.useMemo)(() => { 18572 if (!columnPinning) return {}; 18573 if (columnPinningMode === "autoDetect" && !hasHorizontalScroll) return {}; 18574 return { state: { columnPinning } }; 18575 }, [ 18576 columnPinning, 18577 columnPinningMode, 18578 hasHorizontalScroll 18579 ]); 18580 const expandableConfig = (0, import_react.useMemo)(() => { 18581 if (!expandable) return {}; 18582 const configs = omit(expandable, ["renderExpanded"]); 18583 return { 18584 getExpandedRowModel: getExpandedRowModel(), 18585 ...configs 18586 }; 18587 }, [expandable]); 18588 const selectionConfig = (0, import_react.useMemo)(() => { 18589 if (selection === false) return {}; 18590 return { 18591 state: { rowSelection: selection.selectionState }, 18592 onRowSelectionChange: handleSelectionChange 18593 }; 18594 }, [selection]); 18595 const table = useReactTable({ 18596 data, 18597 columns, 18598 getCoreRowModel: getCoreRowModel(), 18599 getRowId, 18600 ...paginationConfig, 18601 ...filterConfig, 18602 ...expandableConfig, 18603 ...sortingConfig, 18604 ...selectionConfig, 18605 state: { 18606 ...paginationConfig.state, 18607 ...filterConfig.state, 18608 ...columnPinningConfig.state, 18609 ...sortingConfig.state, 18610 ...selectionConfig.state 18611 } 18612 }); 18613 (0, import_react.useEffect)(() => { 18614 if (columnPinningMode !== "autoDetect") return; 18615 if (containerSize?.width) setHasHorizontalScroll(table.getTotalSize() > containerSize.width - 20); 18616 }, [ 18617 columnPinningMode, 18618 containerSize?.width, 18619 table 18620 ]); 18621 (0, import_react.useImperativeHandle)(ref, () => table, [table]); 18622 const hasData = !!table.getRowModel().rows.length; 18623 (0, import_react.useEffect)(() => { 18624 resolvedScrollRef.current?.scrollTo({ top: 0 }); 18625 }, [data, resolvedScrollRef]); 18626 (0, import_react.useEffect)(() => { 18627 resolvedScrollRef.current?.scrollTo({ 18628 top: 0, 18629 left: 0 18630 }); 18631 }, [ 18632 page, 18633 pageSize, 18634 resolvedScrollRef 18635 ]); 18636 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spin, { 18637 spinning: loading, 18638 wrapperClassName: "**:data-[slot=spin-inset]:flex **:data-[slot=spin-inset]:flex-col", 18639 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(table_provider_default, { 18640 table, 18641 loading, 18642 renderExpanded: expandable?.renderExpanded, 18643 onRowContextMenu, 18644 isSorting: typeof sorting === "object", 18645 isMultiSort: typeof sorting === "object" ? sorting.enableMultiSort ?? false : false, 18646 slotsVariants, 18647 onRow, 18648 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableContainer, { 18649 ref: composedScrollRefs, 18650 className: tableContainerVariants({ className: containerClassName }), 18651 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Table$1, { 18652 className: tableVariants({ className: css` 18653 min-width: ${table.getTotalSize()}px; 18654 ${rowVirtualizer ? "table-layout: fixed;" : ""} 18655 ` }), 18656 children: [
18657 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(table_head_default, {}), 18658 hasData ? rowVirtualizer ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(table_body_virtualized_default, { rowVirtualizer }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(table_body_default, {}) : emptyContent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { 18659 colSpan: columns.length, 18660 className: "p-0", 18661 children: emptyContent 18662 }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(table_empty_default, {}), 18663 typeof footer === "function" ? footer(table) : footer && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(table_foot_default, {}) 18664 ] 18665 }) 18666 }), !isNoPagination && hasData && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(table_pagination_default, { 18667 table, 18668 containerClassName: paginationClassName, 18669 ...pagination, 18670 onPageChange: handlePaginationComponentChange("page", pagination.onPageChange), 18671 onPageSizeChange: handlePaginationComponentChange("pageSize", pagination.onPageSizeChange) 18672 })] 18673 }) 18674 }); 18675}; 18676var table_default = TableComponent; 18677const useTableVirtualizer = ({ count, scrollElement, estimatedRowHeight = 53, overscan = 20, enabled = true }) => { 18678 return useVirtualizer({ 18679 count, 18680 getScrollElement: () => scrollElement.current, 18681 estimateSize: () => estimatedRowHeight, 18682 overscan, 18683 measureElement: typeof window !== "undefined" && navigator.userAgent.indexOf("Firefox") === -1 ? (element) => element?.getBoundingClientRect().height : void 0, 18684 enabled 18685 }); 18686}; 18687var Table = table_default; 18688Table.TableHead = table_head_default; 18689Table.TableBody = table_body_default; 18690Table.TableFoot = table_foot_default; 18691Table.TableEmpty = table_empty_default; 18692Table.TablePagination = table_pagination_default; 18693var data_table_default = Table; 18694function DialerBuyNumberDialog({ open, onBuy, onCancel, cancelButtonProps, buyButtonProps }) { 18695 const userInfo = useUserInfoQueryState(); 18696 const [selectedCountryCode, setSelectedCountryCode] = (0, import_react.useState)("US"); 18697 const [areaCode, setAreaCode] = (0, import_react.useState)(""); 18698 const [selectionState, setSelectionState] = (0, import_react.useState)({}); 18699 const areaCodeDebounced = useDebounce_default(areaCode, { wait: 300 }); 18700 const isAdmin = getRoleName(userInfo?.rank) === "Super Admin"; 18701 const { data: phoneNumbersResponse, isLoading: isPhoneNumbersLoading, isFetching: isPhoneNumbersFetching } = useGetDialerVirtualNumbersListQuery({ 18702 countryCode: selectedCountryCode, 18703 key: areaCodeDebounced 18704 }, { skip: !open }); 18705 const { data: remainSeatsResponse, isLoading: isRemainSeatsLoading, isFetching: isRemainSeatsFetching } = useGetRemainSeatsQuery(void 0, { skip: !open }); 18706 const phoneNumbers = get(phoneNumbersResponse, "data", []); 18707 const remainSeatsData = get(remainSeatsResponse, "data", { 18708 buyNumber: 0, 18709 seatNumber: 0 18710 }); 18711 const remainSeats = remainSeatsData.seatNumber - remainSeatsData.buyNumber; 18712 const selectedNumbers = phoneNumbers.filter((phone) => { 18713 return selectionState[phone.virtualNumber]; 18714 }); 18715 const selectedCount = selectedNumbers.length; 18716 const freeNumbers = (0, import_react.useMemo)(() => { 18717 const set = /* @__PURE__ */ new Set(); 18718 if (remainSeats <= 0) return set; 18719 selectedNumbers.slice(0, remainSeats).forEach((phone_0) => { 18720 return set.add(phone_0.virtualNumber); 18721 }); 18722 if (selectedCount < remainSeats) phoneNumbers.forEach((phone_1) => { 18723 if (!selectionState[phone_1.virtualNumber]) set.add(phone_1.virtualNumber); 18724 }); 18725 return set; 18726 }, [ 18727 phoneNumbers, 18728 selectionState, 18729 selectedNumbers, 18730 selectedCount, 18731 remainSeats 18732 ]); 18733 const disabledBuyButton = !isAdmin || selectedCount === 0 || buyButtonProps?.disabled; 18734 (0, import_react.useEffect)(() => { 18735 if (!open) handleCleanState(); 18736 }, [open]); 18737 const handleCleanState = () => { 18738 trackMethodCall("handleCleanState", []); 18739 setSelectionState({}); 18740 setAreaCode(""); 18741 setSelectedCountryCode("US"); 18742 }; 18743 const handleCancelBuyNumber = () => { 18744 trackMethodCall("handleCancelBuyNumber", []); 18745 onCancel?.(); 18746 }; 18747 const handleBuy = () => { 18748 trackMethodCall("handleBuy", []); 18749 const type = selectedCount > remainSeats ? "subscribe" : "buy"; 18750 const purchasableNumbers = type === "subscribe" ? selectedNumbers.slice(Math.max(remainSeats, 0)) : selectedNumbers; 18751 onBuy?.(selectedNumbers, type, purchasableNumbers); 18752 }; 18753 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, { 18754 open, 18755 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, { 18756 className: "max-w-150",
18757 showCloseButton: false, 18758 children: [ 18759 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogClose, { 18760 "data-slot": "dialog-close", 18761 className: "absolute top-5 right-5 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-5", 18762 onClick: handleCancelBuyNumber, 18763 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 18764 className: "sr-only", 18765 children: "Close" 18766 })] 18767 }), 18768 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, { children: "Buy Number" }) }), 18769 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogInner, { 18770 className: "gap-4", 18771 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 18772 className: "flex flex-1 items-center gap-2", 18773 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select, { 18774 value: selectedCountryCode, 18775 onValueChange: (val) => { 18776 return setSelectedCountryCode(val); 18777 }, 18778 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectTrigger, { 18779 className: "h-9 w-full flex-1", 18780 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectValue, { placeholder: "Select country" }) 18781 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContent, { children: COUNTRY_OPTIONS.map((option) => { 18782 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SelectItem, { 18783 value: option.code, 18784 children: [ 18785 option.name, 18786 " ", 18787 option.dialCode 18788 ] 18789 }, option.code); 18790 }) })] 18791 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(InputGroup, { 18792 className: "flex-1", 18793 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputGroupAddon, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Search, { className: "size-4" }) }
18793), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputGroupInput, { 18794 placeholder: "Area Code", 18795 value: areaCode, 18796 onChange: (e$4) => { 18797 return setAreaCode(e$4.target.value.toString()); 18798 }, 18799 className: "[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none" 18800 })] 18801 })] 18802 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(data_table_default, { 18803 data: phoneNumbers, 18804 columns: getBuyNumberColumns({ freeNumbers }), 18805 loading: isPhoneNumbersLoading || isPhoneNumbersFetching, 18806 pagination: false, 18807 selection: { 18808 selectionState, 18809 onSelectionChange: setSelectionState 18810 }, 18811 getRowId: (row) => { 18812 return row.virtualNumber; 18813 }, 18814 containerClassName: "max-h-[300px]", 18815 scroll: { pingingHeader: true } 18816 })] 18817 }), 18818 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogFooter, { 18819 className: "justify-between", 18820 children: [isRemainSeatsLoading || isRemainSeatsFetching ? /* @__P
18820URE__ */ (0, import_jsx_runtime.jsx)(Spinner, { className: "size-6 text-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 18821 className: "flex flex-wrap items-center gap-1 text-xs font-semibold text-foreground", 18822 children: [ 18823 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 18824 asChild: true, 18825 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Info, { className: "size-4" }) 18826 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { 18827 align: "start", 18828 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [ 18829 "Your team currently has ", 18830 remainSeats, 18831 " dialer seat", 18832 remainSeats > 1 ? "s" : null, 18833 " ", 18834 "left." 18835 ] }) 18836 })] }), 18837 " ", 18838 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [ 18839 selectedCount, 18840 " / ", 18841 remainSeats, 18842 " Number(s) Selected" 18843 ] }) 18844 ] 18845 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 18846 className: "flex items-center gap-2", 18847 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 18848 variant: "outline", 18849 ...cancelButtonProps, 18850 onClick: handleCancelBuyNumber, 18851 children: "Cancel" 18852 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 18853 ...buyButtonProps, 18854 onClick: handleBuy, 18855 disabled: disabledBuyButton, 18856 children: "Buy" 18857 })] 18858 })] 18859 }) 18860 ] 18861 }) 18862 }); 18863} 18864var dialer_buy_number_dialog_default = DialerBuyNumberDialog; 18865var import_compiler_runtime$73 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 18866function DialerPurchasedVirtualPhoneSuccessDialog(t0) { 18867 const $ = (0, import_compiler_runtime$73.c)(17); 18868 const { open, onViewSubscription, onClose, onGotIt } = t0; 18869 let t1; 18870 if ($[0] !== onViewSubscription) { 18871 t1 = () => { 18872 trackMethodCall("handleViewSubscription", []); 18873 onViewSubscription?.(); 18874 }; 18875 $[0] = onViewSubscription; 18876 $[1] = t1; 18877 } else t1 = $[1]; 18878 const handleViewSubscription = t1; 18879 let t2; 18880 if ($[2] !== onClose) { 18881 t2 = (isOpen) => !isOpen && onClose?.(); 18882 $[2] = onClose; 18883 $[3] = t2; 18884 } else t2 = $[3]; 18885 let t3; 18886 if ($[4] === Symbol.for("react.memo_cache_sentinel")) { 18887 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 18888 className: "flex size-17.5 items-center justify-center", 18889 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 18890 className: "flex size-15 items-center justify-center rounded-full bg-success", 18891 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { 18892 className: "size-9 text-white", 18893 strokeWidth: 3 18894 }) 18895 }) 18896 }); 18897 $[4] = t3; 18898 } else t3 = $[4]; 18899 let t4; 18900 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 18901 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogHeader, { 18902 className: "items-center gap-5 p-5 pb-0 text-center", 18903 children: [t3, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 18904 className: "flex flex-col gap-1.5 text-center", 18905 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, { 18906 className: "text-xl font-semibold", 18907 children: "Calling setup complete" 18908 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogDescription, { 18909 className: "text-sm text-muted-foreground", 18910 children: "Your Virtual Phone Number is ready. If you have Dialer seats, you can start calling now; otherwise, add Dialer seats to place outbound calls." 18911 })] 18912 })] 18913 }); 18914 $[5] = t4; 18915 } else t4 = $[5]; 18916 let t5; 18917 if ($[6] !== handleViewSubscription) { 18918 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 18919 variant: "outline", 18920 className: "flex-1", 18921 onClick: handleViewSubscription, 18922 children: "View Subscription" 18923 }); 18924 $[6] = handleViewSubscription; 18925 $[7] = t5; 18926 } else t5 = $[7]; 18927 let t6; 18928 if ($[8] !== onGotIt) { 18929 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 18930 className: "flex-1", 18931 onClick: onGotIt, 18932 children: "Got it" 18933 }); 18934 $[8] = onGotIt; 18935 $[9] = t6; 18936 } else t6 = $[9]; 18937 let t7; 18938 if ($[10] !== t5 || $[11] !== t6) { 18939 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, { 18940 className: "max-w-107.5! p-5",
18941 children: [t4, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogFooter, { 18942 className: "flex-row gap-2 px-5 sm:justify-stretch", 18943 children: [t5, t6] 18944 })] 18945 }); 18946 $[10] = t5; 18947 $[11] = t6; 18948 $[12] = t7; 18949 } else t7 = $[12]; 18950 let t8; 18951 if ($[13] !== open || $[14] !== t2 || $[15] !== t7) { 18952 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, { 18953 open, 18954 onOpenChange: t2, 18955 children: t7 18956 }); 18957 $[13] = open; 18958 $[14] = t2; 18959 $[15] = t7; 18960 $[16] = t8; 18961 } else t8 = $[16]; 18962 return t8; 18963} 18964var dialer_purchased_virtual_phone_success_dialog_default = DialerPurchasedVirtualPhoneSuccessDialog; 18965var import_compiler_runtime$72 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 18966function DialerBuyVirtualPhoneFlow() { 18967 const $ = (0, import_compiler_runtime$72.c)(37); 18968 const dispatch = useAppDispatch(); 18969 const currentStep = useAppSelector(selectCurrentStepBuyVirtualPhone); 18970 const [addVirtualNumber, t0] = useAddVirtualNumberMutation(); 18971 const { isLoading: isAddVirtualNumberLoading } = t0; 18972 let handleConfirmPurchasingVirtualNumber; 18973 let setCurrentStep; 18974 if ($[0] !== addVirtualNumber || $[1] !== dispatch) { 18975 handleConfirmPurchasingVirtualNumber = async (virtualNumbers, type) => { 18976 trackMethodCall("handleConfirmPurchasingVirtualNumber", [virtualNumbers, type]); 18977 if (!virtualNumbers.length) return; 18978 if (type === "subscribe") { 18979 toast.error("Please purchase a call package to add virtual numbers"); 18980 return; 18981 } 18982 await mutateWithErrorHandling(addVirtualNumber, virtualNumbers); 18983 setCurrentStep("4-purchased-virtual-number-success"); 18984 }; 18985 setCurrentStep = (step) => dispatch(setCurrentStepBuyVirtualPhone(step)); 18986 $[0] = addVirtualNumber; 18987 $[1] = dispatch; 18988 $[2] = handleConfirmPurchasingVirtualNumber; 18989 $[3] = setCurrentStep; 18990 } else { 18991 handleConfirmPurchasingVirtualNumber = $[2]; 18992 setCurrentStep = $[3]; 18993 } 18994 const t1 = currentStep === "1-no-virtual-number"; 18995 let t2; 18996 let t3; 18997 if ($[4] !== setCurrentStep) { 18998 t2 = () => setCurrentStep(null); 18999 t3 = () => setCurrentStep("2-buy-virtual-number"); 19000 $[4] = setCurrentStep; 19001 $[5] = t2; 19002 $[6] = t3; 19003 } else { 19004 t2 = $[5]; 19005 t3 = $[6]; 19006 } 19007 let t4; 19008 if ($[7] !== t1 || $[8] !== t2 || $[9] !== t3) { 19009 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_no_virtual_phone_available_alert_dialog_default, { 19010 open: t1, 19011 onCancel: t2, 19012 onGoSetting: t3 19013 }); 19014 $[7] = t1; 19015 $[8] = t2; 19016 $[9] = t3; 19017 $[10] = t4; 19018 } else t4 = $[10]; 19019 const t5 = currentStep === "2-buy-virtual-number"; 19020 let t6; 19021 if ($[11] !== setCurrentStep) { 19022 t6 = () => setCurrentStep("1-no-virtual-number"); 19023 $[11] = setCurrentStep; 19024 $[12] = t6; 19025 } else t6 = $[12]; 19026 let t7; 19027 let t8; 19028 if ($[13] !== isAddVirtualNumberLoading) { 19029 t7 = { disabled: isAddVirtualNumberLoading }; 19030 t8 = { 19031 loading: isAddVirtualNumberLoading, 19032 disabled: isAddVirtualNumberLoading 19033 }; 19034 $[13] = isAddVirtualNumberLoading; 19035 $[14] = t7; 19036 $[15] = t8; 19037 } else { 19038 t7 = $[14]; 19039 t8 = $[15]; 19040 } 19041 let t9; 19042 if ($[16] !== handleConfirmPurchasingVirtualNumber || $[17] !== t5 || $[18] !== t6 || $[19] !== t7 || $[20] !== t8) { 19043 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_buy_number_dialog_default, { 19044 open: t5, 19045 onCancel: t6, 19046 onBuy: handleConfirmPurchasingVirtualNumber, 19047 cancelButtonProps: t7, 19048 buyButtonProps: t8 19049 }); 19050 $[16] = handleConfirmPurchasingVirtualNumber; 19051 $[17] = t5; 19052 $[18] = t6; 19053 $[19] = t7; 19054 $[20] = t8; 19055 $[21] = t9; 19056 } else t9 = $[21]; 19057 const t10 = currentStep === "4-purchased-virtual-number-success"; 19058 let t11; 19059 let t12; 19060 let t13; 19061 if ($[22] !== setCurrentStep) { 19062 t11 = () => setCurrentStep(null); 19063 t12 = () => setCurrentStep(null); 19064 t13 = () => setCurrentStep(null); 19065 $[22] = setCurrentStep; 19066 $[23] = t11; 19067 $[24] = t12; 19068 $[25] = t13; 19069 } else { 19070 t11 = $[23]; 19071 t12 = $[24]; 19072 t13 = $[25]; 19073 } 19074 let t14; 19075 if ($[26] !== t10 || $[27] !== t11 || $[28] !== t12 || $[29] !== t13) { 19076 t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_purchased_virtual_phone_success_dialog_default, { 19077 open: t10, 19078 onViewSubscription: t11, 19079 onClose: t12, 19080 onGotIt: t13 19081 }); 19082 $[26] = t10; 19083 $[27] = t11; 19084 $[28] = t12; 19085 $[29] = t13; 19086 $[30] = t14; 19087 } else t14 = $[30]; 19088 let t15; 19089 if ($[31] !== currentStep || $[32] !== setCurrentStep || $[33] !== t14 || $[34] !== t4 || $[35] !== t9) { 19090 t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Provider$1, { 19091 currentStep, 19092 setCurrentStep, 19093 children: [ 19094 t4, 19095 t9, 19096 t14 19097 ] 19098 }); 19099 $[31] = currentStep; 19100 $[32] = setCurrentStep; 19101 $[33] = t14; 19102 $[34] = t4; 19103 $[35] = t9; 19104 $[36] = t15; 19105 } else t15 = $[36]; 19106 return t15; 19107} 19108var dialer_buy_virtual_phone_flow_default = DialerBuyVirtualPhoneFlow; 19109var import_compiler_runtime$71 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 19110function DialerCallingGroupSheets() { 19111 const $ = (0, import_compiler_runtime$71.c)(17); 19112 const dispatch = useAppDispatch(); 19113 const open = useAppSelector(selectDialerNotificationOpen); 19114 const type = useAppSelector(selectDialerNotificationType); 19115 const { resolveRemainTimeWarning } = useDialersContext(); 19116 const isRemainTimeWarning = type === "basic-less-than-15-mins"; 19117 let t0; 19118 if ($[0] !== dispatch || $[1] !== isRemainTimeWarning || $[2] !== resolveRemainTimeWarning) { 19119 t0 = (value) => { 19120 if (!value && isRemainTimeWarning) { 19121 resolveRemainTimeWarning(false); 19122 return; 19123 } 19124 dispatch(setDialerNotificationOpen(value)); 19125 }; 19126 $[0] = dispatch; 19127 $[1] = isRemainTimeWarning; 19128 $[2] = resolveRemainTimeWarning; 19129 $[3] = t0; 19130 } else t0 = $[3]; 19131 const onOpenChange = t0; 19132 let t1; 19133 let t2; 19134 let t3; 19135 let t4; 19136 let t5; 19137 let t6; 19138 if ($[4] === Symbol.for("react.memo_cache_sentinel")) { 19139 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_incoming_call_sheet_default, {}); 19140 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_inbound_call_sheet_default, {}); 19141 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_minimize_sheet_default, {}); 19142 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_activities_sheet_default, {}); 19143 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_call_result_sheet_default, {}); 19144 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_buy_virtual_phone_flow_default, {}); 19145 $[4] = t1; 19146 $[5] = t2; 19147 $[6] = t3; 19148 $[7] = t4; 19149 $[8] = t5; 19150 $[9] = t6; 19151 } else { 19152 t1 = $[4]; 19153 t2 = $[5]; 19154 t3 = $[6]; 19155 t4 = $[7]; 19156 t5 = $[8]; 19157 t6 = $[9]; 19158 } 19159 let t7; 19160 if ($[10] !== resolveRemainTimeWarning) { 19161 t7 = () => resolveRemainTimeWarning(true); 19162 $[10] = resolveRemainTimeWarning; 19163 $[11] = t7; 19164 } else t7 = $[11]; 19165 let t8; 19166 if ($[12] !== onOpenChange || $[13] !== open || $[14] !== t7 || $[15] !== type) { 19167 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ 19168 t1, 19169 t2, 19170 t3, 19171 t4, 19172 t5, 19173 t6,
19174 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_notifications_default, { 19175 type, 19176 open, 19177 onOpenChange, 19178 onContinue: t7 19179 }) 19180 ] }); 19181 $[12] = onOpenChange; 19182 $[13] = open; 19183 $[14] = t7; 19184 $[15] = type; 19185 $[16] = t8; 19186 } else t8 = $[16]; 19187 return t8; 19188} 19189var dialer_calling_group_sheets_default = DialerCallingGroupSheets; 19190var import_compiler_runtime$70 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 19191function ItemGroup(t0) { 19192 const $ = (0, import_compiler_runtime$70.c)(8); 19193 let className; 19194 let props; 19195 if ($[0] !== t0) { 19196 ({className, ...props} = t0); 19197 $[0] = t0; 19198 $[1] = className; 19199 $[2] = props; 19200 } else { 19201 className = $[1]; 19202 props = $[2]; 19203 } 19204 let t1; 19205 if ($[3] !== className) { 19206 t1 = cn("group/item-group flex flex-col", className); 19207 $[3] = className; 19208 $[4] = t1; 19209 } else t1 = $[4]; 19210 let t2; 19211 if ($[5] !== props || $[6] !== t1) { 19212 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 19213 role: "list", 19214 "data-slot": "item-group", 19215 className: t1, 19216 ...props 19217 }); 19218 $[5] = props; 19219 $[6] = t1; 19220 $[7] = t2; 19221 } else t2 = $[7]; 19222 return t2; 19223} 19224var itemVariants = cva("group/item flex items-center border border-transparent text-sm rounded-md transition-colors [a]:hover:bg-accent/50 [a]:transition-colors duration-100 flex-wrap outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", { 19225 variants: { 19226 variant: { 19227 default: "bg-transparent", 19228 outline: "border-border", 19229 muted: "bg-muted/50" 19230 }, 19231 size: { 19232 default: "p-4 gap-4 ", 19233 sm: "py-3 px-4 gap-2.5" 19234 } 19235 }, 19236 defaultVariants: { 19237 variant: "default", 19238 size: "default" 19239 } 19240}); 19241function Item(t0) { 19242 const $ = (0, import_compiler_runtime$70.c)(16); 19243 let className; 19244 let props; 19245 let t1; 19246 let t2; 19247 let t3; 19248 if ($[0] !== t0) { 19249 ({className, variant: t1, size: t2, asChild: t3, ...props} = t0); 19250 $[0] = t0; 19251 $[1] = className; 19252 $[2] = props; 19253 $[3] = t1; 19254 $[4] = t2; 19255 $[5] = t3; 19256 } else { 19257 className = $[1]; 19258 props = $[2]; 19259 t1 = $[3]; 19260 t2 = $[4]; 19261 t3 = $[5]; 19262 } 19263 const variant = t1 === void 0 ? "default" : t1; 19264 const size = t2 === void 0 ? "default" : t2; 19265 const Comp = (t3 === void 0 ? false : t3) ? Slot : "div"; 19266 let t4; 19267 if ($[6] !== className || $[7] !== size || $[8] !== variant) { 19268 t4 = cn(itemVariants({ 19269 variant, 19270 size, 19271 className 19272 })); 19273 $[6] = className; 19274 $[7] = size; 19275 $[8] = variant; 19276 $[9] = t4; 19277 } else t4 = $[9]; 19278 let t5; 19279 if ($[10] !== Comp || $[11] !== props || $[12] !== size || $[13] !== t4 || $[14] !== variant) { 19280 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Comp, { 19281 "data-slot": "item", 19282 "data-variant": variant, 19283 "data-size": size, 19284 className: t4, 19285 ...props 19286 }); 19287 $[10] = Comp; 19288 $[11] = props; 19289 $[12] = size; 19290 $[13] = t4; 19291 $[14] = variant; 19292 $[15] = t5; 19293 } else t5 = $[15]; 19294 return t5; 19295} 19296var itemMediaVariants = cva("flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5", { 19297 variants: { variant: { 19298 default: "bg-transparent", 19299 icon: "size-8 border rounded-sm bg-muted [&_svg:not([class*='size-'])]:size-4", 19300 image: "size-10 rounded-sm overflow-hidden [&_img]:size-full [&_img]:object-cover" 19301 } }, 19302 defaultVariants: { variant: "default" } 19303}); 19304function ItemMedia(t0) { 19305 const $ = (0, import_compiler_runtime$70.c)(11); 19306 let className; 19307 let props; 19308 let t1; 19309 if ($[0] !== t0) { 19310 ({className, variant: t1, ...props} = t0); 19311 $[0] = t0; 19312 $[1] = className; 19313 $[2] = props; 19314 $[3] = t1; 19315 } else { 19316 className = $[1]; 19317 props = $[2]; 19318 t1 = $[3]; 19319 } 19320 const variant = t1 === void 0 ? "default" : t1; 19321 let t2; 19322 if ($[4] !== className || $[5] !== variant) { 19323 t2 = cn(itemMediaVariants({ 19324 variant, 19325 className 19326 })); 19327 $[4] = className; 19328 $[5] = variant; 19329 $[6] = t2; 19330 } else t2 = $[6]; 19331 let t3; 19332 if ($[7] !== props || $[8] !== t2 || $[9] !== variant) { 19333 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 19334 "data-slot": "item-media", 19335 "data-variant": variant, 19336 className: t2, 19337 ...props 19338 }); 19339 $[7] = props; 19340 $[8] = t2; 19341 $[9] = variant; 19342 $[10] = t3; 19343 } else t3 = $[10]; 19344 return t3; 19345} 19346function ItemContent(t0) { 19347 const $ = (0, import_compiler_runtime$70.c)(8); 19348 let className; 19349 let props; 19350 if ($[0] !== t0) { 19351 ({className, ...props} = t0); 19352 $[0] = t0; 19353 $[1] = className; 19354 $[2] = props; 19355 } else { 19356 className = $[1]; 19357 props = $[2]; 19358 } 19359 let t1; 19360 if ($[3] !== className) { 19361 t1 = cn("flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none", className); 19362 $[3] = className; 19363 $[4] = t1; 19364 } else t1 = $[4]; 19365 let t2; 19366 if ($[5] !== props || $[6] !== t1) { 19367 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 19368 "data-slot": "item-content", 19369 className: t1, 19370 ...props 19371 }); 19372 $[5] = props; 19373 $[6] = t1; 19374 $[7] = t2; 19375 } else t2 = $[7]; 19376 return t2; 19377} 19378function ItemTitle(t0) { 19379 const $ = (0, import_compiler_runtime$70.c)(8); 19380 let className; 19381 let props; 19382 if ($[0] !== t0) { 19383 ({className, ...props} = t0); 19384 $[0] = t0; 19385 $[1] = className; 19386 $[2] = props; 19387 } else { 19388 className = $[1]; 19389 props = $[2]; 19390 } 19391 let t1; 19392 if ($[3] !== className) { 19393 t1 = cn("flex w-fit items-center gap-2 text-sm leading-snug font-medium", className); 19394 $[3] = className; 19395 $[4] = t1; 19396 } else t1 = $[4]; 19397 let t2; 19398 if ($[5] !== props || $[6] !== t1) { 19399 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 19400 "data-slot": "item-title", 19401 className: t1, 19402 ...props 19403 }); 19404 $[5] = props; 19405 $[6] = t1; 19406 $[7] = t2; 19407 } else t2 = $[7]; 19408 return t2; 19409}
19410function ItemDescription(t0) { 19411 const $ = (0, import_compiler_runtime$70.c)(8); 19412 let className; 19413 let props; 19414 if ($[0] !== t0) { 19415 ({className, ...props} = t0); 19416 $[0] = t0; 19417 $[1] = className; 19418 $[2] = props; 19419 } else { 19420 className = $[1]; 19421 props = $[2]; 19422 } 19423 let t1; 19424 if ($[3] !== className) { 19425 t1 = cn("line-clamp-2 text-sm leading-normal font-normal text-balance text-muted-foreground", "[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", className); 19426 $[3] = className; 19427 $[4] = t1; 19428 } else t1 = $[4]; 19429 let t2; 19430 if ($[5] !== props || $[6] !== t1) { 19431 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 19432 "data-slot": "item-description", 19433 className: t1, 19434 ...props 19435 }); 19436 $[5] = props; 19437 $[6] = t1; 19438 $[7] = t2; 19439 } else t2 = $[7]; 19440 return t2; 19441} 19442function ItemActions(t0) { 19443 const $ = (0, import_compiler_runtime$70.c)(8); 19444 let className; 19445 let props; 19446 if ($[0] !== t0) { 19447 ({className, ...props} = t0); 19448 $[0] = t0; 19449 $[1] = className; 19450 $[2] = props; 19451 } else { 19452 className = $[1]; 19453 props = $[2]; 19454 } 19455 let t1; 19456 if ($[3] !== className) { 19457 t1 = cn("flex items-center gap-2", className); 19458 $[3] = className; 19459 $[4] = t1; 19460 } else t1 = $[4]; 19461 let t2; 19462 if ($[5] !== props || $[6] !== t1) { 19463 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 19464 "data-slot": "item-actions", 19465 className: t1, 19466 ...props 19467 }); 19468 $[5] = props; 19469 $[6] = t1; 19470 $[7] = t2; 19471 } else t2 = $[7]; 19472 return t2; 19473} 19474function ItemHeader(t0) { 19475 const $ = (0, import_compiler_runtime$70.c)(8); 19476 let className; 19477 let props; 19478 if ($[0] !== t0) { 19479 ({className, ...props} = t0); 19480 $[0] = t0; 19481 $[1] = className; 19482 $[2] = props; 19483 } else { 19484 className = $[1]; 19485 props = $[2]; 19486 } 19487 let t1; 19488 if ($[3] !== className) { 19489 t1 = cn("flex basis-full items-center justify-between gap-2", className); 19490 $[3] = className; 19491 $[4] = t1; 19492 } else t1 = $[4]; 19493 let t2; 19494 if ($[5] !== props || $[6] !== t1) { 19495 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 19496 "data-slot": "item-header", 19497 className: t1, 19498 ...props 19499 }); 19500 $[5] = props; 19501 $[6] = t1; 19502 $[7] = t2; 19503 } else t2 = $[7]; 19504 return t2; 19505} 19506var VirtualizedList = ({ items: items$1, renderItem, estimatedItemHeight = 64, overscan = 5, className, getItemKey }) => { 19507 const ref = (0, import_react.useRef)(null); 19508 const virtualizer = useVirtualizer({ 19509 count: items$1.length, 19510 getScrollElement: () => ref.current, 19511 estimateSize: () => estimatedItemHeight, 19512 overscan 19513 }); 19514 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemGroup, { 19515 ref, 19516 className: cn("h-full overflow-y-auto", className), 19517 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 19518 className: "relative", 19519 style: { height: `${virtualizer.getTotalSize()}px` }, 19520 children: virtualizer.getVirtualItems().map((virtualItem) => { 19521 const item = items$1[virtualItem.index]; 19522 const key = getItemKey?.(item, virtualItem.index) ?? virtualItem.index; 19523 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 19524 className: "absolute top-0 left-0 w-full", 19525 style: { transform: `translateY(${virtualItem.start}px)` }, 19526 children: renderItem(item, virtualItem.index) 19527 }, key); 19528 }) 19529 }) 19530 }); 19531}; 19532var virtualized_list_default = VirtualizedList; 19533var import_compiler_runtime$69 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 19534const AppAvatar = (t0) => { 19535 const $ = (0, import_compiler_runtime$69.c)(20); 19536 const { url, backgroundColor, initials, name, className, children } = t0; 19537 let t1; 19538 if ($[0] !== initials || $[1] !== name) { 19539 t1 = initials || getInitials(name); 19540 $[0] = initials; 19541 $[1] = name; 19542 $[2] = t1; 19543 } else t1 = $[2]; 19544 const displayInitials = t1; 19545 let t2; 19546 if ($[3] !== backgroundColor || $[4] !== name) { 19547 t2 = backgroundColor || getAvatarBackgroundColorClass(name || ""); 19548 $[3] = backgroundColor; 19549 $[4] = name; 19550 $[5] = t2; 19551 } else t2 = $[5]; 19552 const displayBackgroundColor = t2; 19553 let t3; 19554 if ($[6] !== className) { 19555 t3 = cn("size-8", className); 19556 $[6] = className; 19557 $[7] = t3; 19558 } else t3 = $[7]; 19559 let t4; 19560 if ($[8] !== name || $[9] !== url) { 19561 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarImage, { 19562 src: url, 19563 alt: name 19564 }); 19565 $[8] = name; 19566 $[9] = url; 19567 $[10] = t4; 19568 } else t4 = $[10]; 19569 let t5;
19570 if ($[11] !== displayBackgroundColor) { 19571 t5 = cn("text-white", displayBackgroundColor); 19572 $[11] = displayBackgroundColor; 19573 $[12] = t5; 19574 } else t5 = $[12]; 19575 const t6 = children || displayInitials; 19576 let t7; 19577 if ($[13] !== t5 || $[14] !== t6) { 19578 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarFallback, { 19579 className: t5, 19580 children: t6 19581 }); 19582 $[13] = t5; 19583 $[14] = t6; 19584 $[15] = t7; 19585 } else t7 = $[15]; 19586 let t8; 19587 if ($[16] !== t3 || $[17] !== t4 || $[18] !== t7) { 19588 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Avatar, { 19589 className: t3, 19590 children: [t4, t7] 19591 }); 19592 $[16] = t3; 19593 $[17] = t4; 19594 $[18] = t7; 19595 $[19] = t8; 19596 } else t8 = $[19]; 19597 return t8; 19598}; 19599var import_compiler_runtime$68 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 19600var MessagesContactsItem = (t0) => { 19601 const $ = (0, import_compiler_runtime$68.c)(46); 19602 const { contact, hasCheckbox: t1, hasRemove: t2, checked: t3, onCheckedChange, onRemove } = t0; 19603 const hasCheckbox = t1 === void 0 ? false : t1; 19604 const hasRemove = t2 === void 0 ? false : t2; 19605 const checked = t3 === void 0 ? false : t3; 19606 const { messageTo } = useMessagesContext(); 19607 const { name, role, phone, company, avatar, accid } = contact; 19608 const isOperator = role === "Operator"; 19609 let t4; 19610 if ($[0] !== accid || $[1] !== checked || $[2] !== hasCheckbox || $[3] !== messageTo || $[4] !== onCheckedChange) { 19611 t4 = () => { 19612 trackMethodCall("handleMessageContact", []); 19613 if (hasCheckbox) { 19614 onCheckedChange?.(!checked); 19615 return; 19616 }
19617 if (accid) messageTo(accid); 19618 }; 19619 $[0] = accid; 19620 $[1] = checked; 19621 $[2] = hasCheckbox; 19622 $[3] = messageTo; 19623 $[4] = onCheckedChange; 19624 $[5] = t4; 19625 } else t4 = $[5]; 19626 const handleMessageContact = t4; 19627 const isClickable = !(hasCheckbox || hasRemove); 19628 const t5 = isClickable && "cursor-pointer"; 19629 let t6; 19630 if ($[6] !== t5) { 19631 t6 = cn("h-16 gap-2.5 p-3 hover:bg-muted", t5); 19632 $[6] = t5; 19633 $[7] = t6; 19634 } else t6 = $[7]; 19635 const t7 = isClickable ? handleMessageContact : void 0; 19636 let t8; 19637 if ($[8] !== checked || $[9] !== hasCheckbox || $[10] !== hasRemove || $[11] !== onCheckedChange) { 19638 t8 = hasCheckbox && !hasRemove && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemActions, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 19639 onClick: _temp$15, 19640 "data-slot": "checkbox", 19641 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Checkbox, { 19642 checked, 19643 onCheckedChange 19644 }) 19645 }) }); 19646 $[8] = checked; 19647 $[9] = hasCheckbox; 19648 $[10] = hasRemove; 19649 $[11] = onCheckedChange; 19650 $[12] = t8; 19651 } else t8 = $[12]; 19652 const t9 = avatar?.url; 19653 const t10 = avatar?.backgroundColor; 19654 const t11 = avatar?.initials; 19655 let t12; 19656 if ($[13] !== name || $[14] !== t10 || $[15] !== t11 || $[16] !== t9) { 19657 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemMedia, { 19658 variant: "image", 19659 className: "relative size-8 overflow-visible", 19660 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppAvatar, { 19661 url: t9, 19662 backgroundColor: t10, 19663 initials: t11, 19664 name 19665 }) 19666 }); 19667 $[13] = name; 19668 $[14] = t10; 19669 $[15] = t11; 19670 $[16] = t9; 19671 $[17] = t12; 19672 } else t12 = $[17]; 19673 let t13; 19674 if ($[18] !== name) { 19675 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemTitle, { 19676 className: "min-w-0 text-sm font-semibold", 19677 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 19678 className: "truncate", 19679 children: name 19680 }) 19681 }) }); 19682 $[18] = name; 19683 $[19] = t13; 19684 } else t13 = $[19]; 19685 const t14 = isOperator ? "text-green-600" : "text-foreground"; 19686 let t15; 19687 if ($[20] !== t14) { 19688 t15 = cn("shrink-0", t14); 19689 $[20] = t14; 19690 $[21] = t15; 19691 } else t15 = $[21]; 19692 let t16; 19693 if ($[22] !== role || $[23] !== t15) { 19694 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 19695 className: t15, 19696 children: role 19697 }); 19698 $[22] = role; 19699 $[23] = t15; 19700 $[24] = t16; 19701 } else t16 = $[24]; 19702 let t17; 19703 if ($[25] !== phone) { 19704 t17 = phone && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "h-3 w-px shrink-0 bg-border" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 19705 className: "shrink-0 text-muted-foreground", 19706 children: formatPhone(normalizePhone(phone), "parentheses") 19707 })] }); 19708 $[25] = phone; 19709 $[26] = t17; 19710 } else t17 = $[26]; 19711 let t18; 19712 if ($[27] !== company) {
19713 t18 = company && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "h-3 w-px shrink-0 bg-border" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 19714 className: "min-w-0 truncate text-muted-foreground", 19715 children: company 19716 })] }); 19717 $[27] = company; 19718 $[28] = t18; 19719 } else t18 = $[28]; 19720 let t19; 19721 if ($[29] !== t16 || $[30] !== t17 || $[31] !== t18) { 19722 t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 19723 className: "flex items-center gap-1.5 text-sm", 19724 children: [ 19725 t16, 19726 t17, 19727 t18 19728 ] 19729 }); 19730 $[29] = t16; 19731 $[30] = t17; 19732 $[31] = t18; 19733 $[32] = t19; 19734 } else t19 = $[32]; 19735 let t20; 19736 if ($[33] !== t13 || $[34] !== t19) { 19737 t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ItemContent, { 19738 className: "min-w-0 flex-col gap-0", 19739 children: [t13, t19] 19740 }); 19741 $[33] = t13; 19742 $[34] = t19; 19743 $[35] = t20; 19744 } else t20 = $[35]; 19745 let t21; 19746 if ($[36] !== hasRemove || $[37] !== onRemove) { 19747 t21 = hasRemove && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemActions, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 19748 asChild: true, 19749 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 19750 variant: "ghost", 19751 size: "icon-sm", 19752 onClick: onRemove, 19753 className: "shrink-0 hover:text-destructive", 19754 "aria-label": "Remove member", 19755 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleMinus, { className: "size-4" }) 19756 }) 19757 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: "Remove member" })] }) }); 19758 $[36] = hasRemove; 19759 $[37] = onRemove; 19760 $[38] = t21; 19761 } else t21 = $[38]; 19762 let t22; 19763 if ($[39] !== t12 || $[40] !== t20 || $[41] !== t21 || $[42] !== t6 || $[43] !== t7 || $[44] !== t8) { 19764 t22 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Item, { 19765 className: t6, 19766 onClick: t7, 19767 children: [ 19768 t8, 19769 t12, 19770 t20, 19771 t21 19772 ] 19773 }); 19774 $[39] = t12; 19775 $[40] = t20; 19776 $[41] = t21; 19777 $[42] = t6; 19778 $[43] = t7; 19779 $[44] = t8; 19780 $[45] = t22; 19781 } else t22 = $[45]; 19782 return t22; 19783}; 19784var messages_contacts_item_default = MessagesContactsItem; 19785function _temp$15(e$4) { 19786 return e$4.stopPropagation(); 19787} 19788var import_compiler_runtime$67 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 19789var MessagesContactsList = (t0) => { 19790 const $ = (0, import_compiler_runtime$67.c)(12); 19791 const { contacts, hasRemove, canRemove, onRemove, className } = t0; 19792 let t1; 19793 if ($[0] !== className) { 19794 t1 = cn("px-2 pb-3", className); 19795 $[0] = className; 19796 $[1] = t1; 19797 } else t1 = $[1]; 19798 let t2; 19799 if ($[2] !== canRemove || $[3] !== hasRemove || $[4] !== onRemove) { 19800 t2 = (contact) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_contacts_item_default, { 19801 contact, 19802 hasRemove: hasRemove && (canRemove ? canRemove(contact) : true), 19803 onRemove: () => onRemove?.(contact) 19804 }); 19805 $[2] = canRemove; 19806 $[3] = hasRemove; 19807 $[4] = onRemove; 19808 $[5] = t2; 19809 } else t2 = $[5]; 19810 let t3; 19811 if ($[6] !== contacts || $[7] !== t2) { 19812 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(virtualized_list_default, { 19813 items: contacts, 19814 renderItem: t2, 19815 estimatedItemHeight: 64, 19816 getItemKey: _temp$14 19817 }); 19818 $[6] = contacts; 19819 $[7] = t2; 19820 $[8] = t3; 19821 } else t3 = $[8]; 19822 let t4; 19823 if ($[9] !== t1 || $[10] !== t3) { 19824 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 19825 className: t1, 19826 children: t3 19827 }); 19828 $[9] = t1; 19829 $[10] = t3; 19830 $[11] = t4; 19831 } else t4 = $[11]; 19832 return t4; 19833}; 19834var messages_contacts_list_default = MessagesContactsList; 19835function _temp$14(contact_0) { 19836 return contact_0.id || ""; 19837} 19838const MessagesRemoveMemberDialog = ({ memberName, open, onOpenChange, tid, memberId }) => { 19839 const [removeGroupMember, { isLoading: isRemoving }] = useRemoveGroupMemberMutation(); 19840 const handleConfirmRemoveGroupMember = async () => { 19841 trackMethodCall("handleConfirmRemoveGroupMember", []); 19842 if (!tid || memberId == null) return; 19843 try { 19844 const result = await removeGroupMember({ 19845 tid, 19846 memberIds: [memberId] 19847 }).unwrap(); 19848 if (result.code === 200) { 19849 toast.success("Member has been removed"); 19850 onOpenChange(false); 19851 } else toast.error(result.message || "Failed to remove member"); 19852 } catch { 19853 toast.error("Failed to remove member"); 19854 } 19855 }; 19856 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialog, { 19857 open, 19858 onOpenChange, 19859 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogContent, { 19860 className: "max-w-[512px]", 19861 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogHeader, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogTitle, { children: "Remove" }
19861), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogDescription, { children: [ 19862 "Are you sure you want to remove ", 19863 memberName, 19864 " from this group?" 19865 ] })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogFooter, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogCancel, { children: "Cancel" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 19866 variant: "destructive", 19867 onClick: handleConfirmRemoveGroupMember, 19868 disabled: !tid || memberId == null, 19869 loading: isRemoving, 19870 children: "Remove" 19871 })] })] 19872 }) 19873 }); 19874}; 19875var import_compiler_runtime$66 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 19876const InputSearch = (t0) => { 19877 const $ = (0, import_compiler_runtime$66.c)(19); 19878 const { value: valueProp, onChange: onChangeProp, placeholder: t1, className } = t0; 19879 const placeholder = t1 === void 0 ? "Search" : t1; 19880 let t2; 19881 if ($[0] !== onChangeProp || $[1] !== valueProp) { 19882 t2 = { 19883 prop: valueProp, 19884 defaultProp: "", 19885 onChange: onChangeProp 19886 }; 19887 $[0] = onChangeProp; 19888 $[1] = valueProp; 19889 $[2] = t2; 19890 } else t2 = $[2]; 19891 const [value, setValue] = useControllableState(t2); 19892 let t3; 19893 if ($[3] !== setValue) { 19894 t3 = (e$4) => { 19895 setValue(e$4.target.value); 19896 }; 19897 $[3] = setValue; 19898 $[4] = t3; 19899 } else t3 = $[4]; 19900 const onChange = t3; 19901 let t4; 19902 if ($[5] !== setValue) { 19903 t4 = () => { 19904 setValue(""); 19905 }; 19906 $[5] = setValue; 19907 $[6] = t4; 19908 } else t4 = $[6]; 19909 const onClear = t4; 19910 let t5; 19911 if ($[7] === Symbol.for("react.memo_cache_sentinel")) { 19912 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputGroupAddon, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Search, { className: "size-4 text-muted-foreground" }) }); 19913 $[7] = t5; 19914 } else t5 = $[7]; 19915 let t6; 19916 if ($[8] !== onChange || $[9] !== placeholder || $[10] !== value) { 19917 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputGroupInput, { 19918 value, 19919 onChange, 19920 placeholder 19921 }); 19922 $[8] = onChange; 19923 $[9] = placeholder; 19924 $[10] = value; 19925 $[11] = t6; 19926 } else t6 = $[11]; 19927 let t7; 19928 if ($[12] !== onClear || $[13] !== value) { 19929 t7 = value && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputGroupAddon, { 19930 align: "inline-end", 19931 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputGroupButton, { 19932 onClick: onClear, 19933 "aria-label": "Clear search", 19934 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { className: "size-4" }) 19935 }) 19936 }); 19937 $[12] = onClear; 19938 $[13] = value; 19939 $[14] = t7; 19940 } else t7 = $[14]; 19941 let t8; 19942 if ($[15] !== className || $[16] !== t6 || $[17] !== t7) { 19943 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(InputGroup, { 19944 className, 19945 children: [ 19946 t5, 19947 t6, 19948 t7 19949 ] 19950 }); 19951 $[15] = className; 19952 $[16] = t6; 19953 $[17] = t7; 19954 $[18] = t8; 19955 } else t8 = $[18]; 19956 return t8; 19957}; 19958var SvgMessagesContactsEmpty = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { 19959 width: 100, 19960 height: 100, 19961 viewBox: "0 0 100 100", 19962 fill: "none", 19963 xmlns: "http://www.w3.org/2000/svg", 19964 ...props, 19965 children: [ 19966 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 19967 d: "M38.8064 12.4559C39.9499 8.18818 44.3366 5.65553 48.6044 6.79907L92.2282 18.488C96.4959 19.6316 99.0286 24.0183 97.885 28.286L81.9244 87.8516C80.7809 92.1194 76.3942 94.652 72.1265 93.5085L28.5027 81.8195C24.235 80.676 21.7023 76.2893 22.8458 72.0216L38.8064 12.4559Z", 19968 fill: "url(#paint0_linear_8111_97222)" 19969 }), 19970 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 19971 d: "M10 22C10 17.5817 13.5817 14 18 14H65C69.4183 14 73 17.5817 73 22V86C73 90.4183 69.4183 94 65 94H18C13.5817 94 10 90.4183 10 86V22Z", 19972 fill: "url(#paint1_linear_8111_97222)" 19973 }), 19974 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 19975 d: "M65.0005 14.0003C69.4188 14.0003 73.0005 17.582 73.0005 22.0003V86.0003C73.0005 88.7351 71.6282 91.1495 69.5346 92.5922L28.242 81.5279C23.9743 80.3843 21.4416 75.9976 22.5851 71.7299L38.0535 14L65.0005 14.0003Z", 19976 fill: "url(#paint2_linear_8111_97222)" 19977 }), 19978 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 19979 d: "M14 30H4C3.44772 30 3 30.4477 3 31V37C3 37.5523 3.44772 38 4 38H14C14.5523 38 15 37.5523 15 37V31C15 30.4477 14.5523 30 14 30Z", 19980 fill: "url(#paint3_linear_8111_97222)", 19981 stroke: "white", 19982 strokeWidth: 2 19983 }),
19984 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 19985 d: "M14 50H4C3.44772 50 3 50.4477 3 51V57C3 57.5523 3.44772 58 4 58H14C14.5523 58 15 57.5523 15 57V51C15 50.4477 14.5523 50 14 50Z", 19986 fill: "url(#paint4_linear_8111_97222)", 19987 stroke: "white", 19988 strokeWidth: 2 19989 }), 19990 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 19991 d: "M14 70H4C3.44772 70 3 70.4477 3 71V77C3 77.5523 3.44772 78 4 78H14C14.5523 78 15 77.5523 15 77V71C15 70.4477 14.5523 70 14 70Z", 19992 fill: "url(#paint5_linear_8111_97222)", 19993 stroke: "white", 19994 strokeWidth: 2 19995 }), 19996 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 19997 fillRule: "evenodd", 19998 clipRule: "evenodd", 19999 d: "M41.0493 40.5C44.3099 40.5 46.9531 43.1432 46.9531 46.4038C46.9531 46.7222 46.9274 47.0401 46.8761 47.3544L46.4133 50.1913C45.9804 52.8451 43.6878 54.794 40.9988 54.794C38.3144 54.794 36.03 52.8385 35.6161 50.1862L35.1753 47.3619C34.669 44.1178 36.8884 41.0774 40.1325 40.5711C40.4358 40.5238 40.7423 40.5 41.0493 40.5ZM32.2744 60.2025L35.558 58.7648C39.0263 57.2461 42.9714 57.2461 46.4397 58.7648L49.7233 60.2025C51.083 60.7979 52.0876 61.9929 52.4404 63.4346L52.9541 65.5343C53.1626 66.3863 52.6409 67.246 51.7889 67.4545C51.6654 67.4847 51.5386 67.5 51.4114 67.5H30.5863C29.7091 67.5 28.998 66.7889 28.998 65.9118C28.998 65.7846 29.0133 65.6578 29.0436 65.5343L29.5573 63.4346C29.9101 61.9929 30.9147 60.7979 32.2744 60.2025Z", 20000 fill: "white" 20001 }), 20002 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("defs", { children: [ 20003 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { 20004 id: "paint0_linear_8111_97222", 20005 x1: 50.3146, 20006 y1: 87.664, 20007 x2: 70.4163, 20008 y2: 12.6435, 20009 gradientUnits: "userSpaceOnUse", 20010 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#E3E5E8" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { 20011 offset: 1, 20012 stopColor: "#D2D5DA" 20013 })] 20014 }), 20015 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { 20016 id: "paint1_linear_8111_97222", 20017 x1: 41.5, 20018 y1: 94, 20019 x2: 41.5, 20020 y2: 14, 20021 gradientUnits: "userSpaceOnUse", 20022 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#F4F5F6" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { 20023 offset: 1, 20024 stopColor: "#E3E5E8" 20025 })] 20026 }), 20027 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { 20028 id: "paint2_linear_8111_97222", 20029 x1: 58.1988, 20030 y1: 14, 20031 x2: 18.581, 20032 y2: 65.2538, 20033 gradientUnits: "userSpaceOnUse", 20034 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#E3E5E8" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { 20035 offset: 1, 20036 stopColor: "#E3E5E8" 20037 })] 20038 }), 20039 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { 20040 id: "paint3_linear_8111_97222", 20041 x1: 3, 20042 y1: 34, 20043 x2: 15, 20044 y2: 34, 20045 gradientUnits: "userSpaceOnUse", 20046 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#E3E5E8" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { 20047 offset: 1, 20048 stopColor: "#F4F5F6" 20049 })] 20050 }), 20051 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { 20052 id: "paint4_linear_8111_97222", 20053 x1: 3, 20054 y1: 54, 20055 x2: 15, 20056 y2: 54, 20057 gradientUnits: "userSpaceOnUse", 20058 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#E3E5E8" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { 20059 offset: 1, 20060 stopColor: "#F4F5F6" 20061 })] 20062 }), 20063 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("linearGradient", { 20064 id: "paint5_linear_8111_97222", 20065 x1: 3, 20066 y1: 74, 20067 x2: 15, 20068 y2: 74, 20069 gradientUnits: "userSpaceOnUse", 20070 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { stopColor: "#E3E5E8" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("stop", { 20071 offset: 1, 20072 stopColor: "#F4F5F6" 20073 })] 20074 }) 20075 ] }) 20076 ] 20077}); 20078var messages_contacts_empty_default$1 = SvgMessagesContactsEmpty; 20079const MessagesGroupsAddMembersDialog = ({ open = false, onOpenChange, tid }) => { 20080 const contacts = useAppSelector(selectContacts); 20081 const group = useAppSelector(selectGroup); 20082 const [addGroupMember, { isLoading: isAdding }
20082] = useAddGroupMemberMutation(); 20083 const [selectedContactIds, setSelectedContactIds] = (0, import_react.useState)(/* @__PURE__ */ new Set()); 20084 const [searchQuery, setSearchQuery] = (0, import_react.useState)(""); 20085 const existingMemberTpUserIds = new Set((group?.members ?? []).map((m$2) => { 20086 return m$2.tpUserId; 20087 }).filter((id) => { 20088 return id != null; 20089 })); 20090 const availableContacts = contacts.filter((c$2) => { 20091 return c$2.tpUserId != null && !existingMemberTpUserIds.has(c$2.tpUserId); 20092 }); 20093 const filteredContacts = availableContacts.filter((contact) => { 20094 if (!searchQuery) return true; 20095 const query = searchQuery.toLowerCase(); 20096 return contact.name?.toLowerCase().includes(query) || contact.phone?.includes(query) || contact.company?.toLowerCase().includes(query); 20097 }); 20098 const selectedCount = selectedContactIds.size; 20099 const selectedContacts = availableContacts.filter((contact_0) => { 20100 return selectedContactIds.has(contact_0.id ?? ""); 20101 }); 20102 const disabled = isAdding || selectedCount === 0 || !tid; 20103 const onToggleContact = (contactId, checked) => { 20104 setSelectedContactIds((prev) => { 20105 const next = new Set(prev); 20106 if (checked) next.add(contactId); 20107 else next.delete(contactId); 20108 return next; 20109 }); 20110 }; 20111 const onAdd = async () => { 20112 if (!tid) return; 20113 const memberIds = selectedContacts.map((c_0) => { 20114 return c_0.tpUserId; 20115 }).filter((id_0) => { 20116 return id_0 != null; 20117 }); 20118 if (memberIds.length === 0) return; 20119 try { 20120 const result = await addGroupMember({ 20121 tid, 20122 memberIds 20123 }).unwrap(); 20124 if (result.code === 200) { 20125 toast.success("Members added successfully"); 20126 setSelectedContactIds(/* @__PURE__ */ new Set()); 20127 setSearchQuery(""); 20128 onOpenChange?.(false); 20129 } else toast.error(result.message || "Failed to add members"); 20130 } catch { 20131 toast.error("Failed to add members"); 20132 } 20133 }; 20134 const onCancel = () => { 20135 setSelectedContactIds(/* @__PURE__ */ new Set()); 20136 setSearchQuery(""); 20137 onOpenChange?.(false); 20138 }; 20139 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, { 20140 open, 20141 onOpenChange, 20142 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, { 20143 className: "flex h-[600px] w-fit max-w-[1000px] flex-row overflow-hidden p-0", 20144 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 20145 className: "flex w-110 shrink-0 flex-col gap-3 border-r border-border p-5", 20146 children: [ 20147 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { 20148 className: "text-xl font-semibold", 20149 children: "Add Members" 20150 }), 20151 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputSearch, { 20152 value: searchQuery, 20153 onChange: setSearchQuery, 20154 placeholder: "Search", 20155 className: "w-full" 20156 }), 20157 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(virtualized_list_default, { 20158 items: filteredContacts, 20159 renderItem: (contact_1) => { 20160 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_contacts_item_default, { 20161 contact: contact_1, 20162 hasCheckbox: true, 20163 checked: selectedContactIds.has(contact_1.id ?? ""), 20164 onCheckedChange: (checked_0) => { 20165 return onToggleContact(contact_1.id ?? "", checked_0); 20166 } 20167 }); 20168 }, 20169 estimatedItemHeight: 64, 20170 getItemKey: (contact_2) => { 20171 return contact_2.id ?? ""; 20172 } 20173 }) 20174 ] 20175 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 20176 className: "flex w-110 min-w-0 flex-1 flex-col", 20177 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 20178 className: "flex flex-1 flex-col gap-2 overflow-hidden p-5", 20179 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 20180 className: "flex items-center justify-between pr-10", 20181 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, { 20182 className: "text-sm font-medium text-foreground", 20183 children: "Members" 20184 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { 20185 className: "text-sm text-muted-foreground", 20186 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 20187 className: "font-bold", 20188 children: selectedCount 20189 }), " Members Selected"] 20190 })] 20191 }
20191), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 20192 className: "flex min-h-0 flex-1 flex-col", 20193 children: selectedCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 20194 className: "flex flex-1 items-center justify-center", 20195 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Empty, { 20196 className: "border-0 p-0", 20197 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EmptyHeader, { 20198 className: "gap-6", 20199 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyMedia, { 20200 variant: "default", 20201 className: "size-25", 20202 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_contacts_empty_default$1, {}) 20203 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 20204 className: "flex flex-col gap-2", 20205 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyTitle, { 20206 className: "text-base leading-none font-medium", 20207 children: "No members selected" 20208 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyDescription, { 20209 className: "text-center text-sm leading-5", 20210 children: "Select contacts from the list to add members" 20211 })] 20212 })] 20213 }) 20214 }) 20215 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(virtualized_list_default, { 20216 items: selectedContacts, 20217 renderItem: (contact_3) => { 20218 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_contacts_item_default, { 20219 contact: contact_3, 20220 hasRemove: true, 20221 onRemove: () => { 20222 return onToggleContact(contact_3.id ?? "", false); 20223 } 20224 }); 20225 }, 20226 estimatedItemHeight: 64, 20227 getItemKey: (contact_4) => { 20228 return contact_4.id ?? ""; 20229 } 20230 }) 20231 })] 20232 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogFooter, { 20233 className: "border-t border-border p-5", 20234 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 20235 variant: "outline", 20236 onClick: onCancel, 20237 children: "Cancel" 20238 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 20239 onClick: onAdd, 20240 disabled, 20241 children: isAdding ? "Adding..." : "Add" 20242 })] 20243 })] 20244 })] 20245 }) 20246 }); 20247}; 20248var import_compiler_runtime$65 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 20249var MessagesManageMembers = () => { 20250 const $ = (0, import_compiler_runtime$65.c)(38); 20251 const dispatch = useAppDispatch(); 20252 const group = useAppSelector(selectGroup); 20253 const userInfo = useUserInfoQueryState(); 20254 let t0; 20255 if ($[0] !== group?.members) { 20256 t0 = group?.members ?? []; 20257 $[0] = group?.members; 20258 $[1] = t0; 20259 } else t0 = $[1]; 20260 const contacts = t0; 20261 const isOwner = group?.masterTpId != null && group.masterTpId === userInfo?.userTpId; 20262 const [removeMemberDialogOpen, setRemoveMemberDialogOpen] = (0, import_react.useState)(false); 20263 const [addMembersDialogOpen, setAddMembersDialogOpen] = (0, import_react.useState)(false); 20264 const [selectedContact, setSelectedContact] = (0, import_react.useState)(null); 20265 let t1; 20266 if ($[2] !== dispatch) { 20267 t1 = () => { 20268 trackMethodCall("handleClose", []); 20269 dispatch(setView("group-chat")); 20270 }; 20271 $[2] = dispatch; 20272 $[3] = t1; 20273 } else t1 = $[3]; 20274 const handleClose = t1; 20275 let t2; 20276 if ($[4] === Symbol.for("react.memo_cache_sentinel")) { 20277 t2 = (contact) => { 20278 trackMethodCall("handleRemove", [contact]); 20279 setSelectedContact(contact); 20280 setRemoveMemberDialogOpen(true); 20281 }; 20282 $[4] = t2; 20283 } else t2 = $[4]; 20284 const handleRemove = t2; 20285 let t3; 20286 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 20287 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { 20288 className: "text-xl font-semibold text-foreground", 20289 children: "Manage Members" 20290 }); 20291 $[5] = t3; 20292 } else t3 = $[5]; 20293 let t4; 20294 if ($[6] === Symbol.for("react.memo_cache_sentinel")) { 20295 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { className: "size-4" }); 20296 $[6] = t4; 20297 } else t4 = $[6]; 20298 let t5; 20299 if ($[7] !== handleClose) { 20300 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 20301 className: "sticky top-0 z-3 h-16 shrink-0 border-b border-border bg-white", 20302 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 20303 className: "relative flex items-center justify-between gap-4 px-5 py-5",
20304 children: [t3, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 20305 variant: "ghost", 20306 size: "icon", 20307 onClick: handleClose, 20308 className: "size-5 shrink-0 opacity-70 hover:opacity-100", 20309 "aria-label": "Close", 20310 children: t4 20311 })] 20312 }) 20313 }); 20314 $[7] = handleClose; 20315 $[8] = t5; 20316 } else t5 = $[8]; 20317 let t6; 20318 if ($[9] === Symbol.for("react.memo_cache_sentinel")) { 20319 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 20320 className: "text-sm font-medium text-foreground", 20321 children: "Members" 20322 }); 20323 $[9] = t6; 20324 } else t6 = $[9]; 20325 let t7; 20326 if ($[10] !== contacts.length) { 20327 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 20328 className: "mb-3 flex items-center justify-between px-5 pt-5", 20329 children: [t6, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { 20330 className: "text-sm text-muted-foreground", 20331 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 20332 className: "font-bold", 20333 children: contacts.length 20334 }), " Members"] 20335 })] 20336 }); 20337 $[10] = contacts.length; 20338 $[11] = t7; 20339 } else t7 = $[11]; 20340 let t8; 20341 if ($[12] !== userInfo?.userTpId) { 20342 t8 = (contact_0) => contact_0.tpUserId !== userInfo?.userTpId; 20343 $[12] = userInfo?.userTpId; 20344 $[13] = t8; 20345 } else t8 = $[13]; 20346 let t9; 20347 if ($[14] !== contacts || $[15] !== isOwner || $[16] !== t8) { 20348 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_contacts_list_default, { 20349 contacts, 20350 hasRemove: isOwner, 20351 canRemove: t8, 20352 onRemove: handleRemove, 20353 className: "min-h-0 flex-1" 20354 }); 20355 $[14] = contacts; 20356 $[15] = isOwner; 20357 $[16] = t8; 20358 $[17] = t9; 20359 } else t9 = $[17]; 20360 let t10; 20361 if ($[18] !== t7 || $[19] !== t9) { 20362 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 20363 className: "flex flex-1 flex-col gap-0 overflow-hidden border-t border-border", 20364 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 20365 className: "flex flex-1 flex-col gap-0 overflow-hidden", 20366 children: [t7, t9] 20367 }) 20368 }); 20369 $[18] = t7; 20370 $[19] = t9; 20371 $[20] = t10; 20372 } else t10 = $[20]; 20373 let t11; 20374 if ($[21] === Symbol.for("react.memo_cache_sentinel")) { 20375 t11 = () => setAddMembersDialogOpen(true); 20376 $[21] = t11; 20377 } else t11 = $[21]; 20378 const t12 = !group?.tid; 20379 let t13; 20380 if ($[22] !== t12) { 20381 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 20382 className: "flex shrink-0 flex-col border-t border-border bg-white px-5 py-4", 20383 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 20384 className: "self-end", 20385 onClick: t11, 20386 disabled: t12, 20387 children: "Add Members" 20388 }) 20389 }); 20390 $[22] = t12; 20391 $[23] = t13; 20392 } else t13 = $[23]; 20393 const t14 = selectedContact?.name ?? ""; 20394 const t15 = group?.tid; 20395 const t16 = selectedContact?.tpUserId; 20396 let t17; 20397 if ($[24] !== removeMemberDialogOpen || $[25] !== t14 || $[26] !== t15 || $[27] !== t16) { 20398 t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesRemoveMemberDialog, { 20399 open: removeMemberDialogOpen, 20400 onOpenChange: setRemoveMemberDialogOpen, 20401 memberName: t14, 20402 tid: t15, 20403 memberId: t16 20404 }); 20405 $[24] = removeMemberDialogOpen; 20406 $[25] = t14; 20407 $[26] = t15; 20408 $[27] = t16; 20409 $[28] = t17; 20410 } else t17 = $[28]; 20411 const t18 = group?.tid; 20412 let t19; 20413 if ($[29] !== addMembersDialogOpen || $[30] !== t18) { 20414 t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesGroupsAddMembersDialog, { 20415 open: addMembersDialogOpen, 20416 onOpenChange: setAddMembersDialogOpen, 20417 tid: t18 20418 }); 20419 $[29] = addMembersDialogOpen; 20420 $[30] = t18; 20421 $[31] = t19; 20422 } else t19 = $[31]; 20423 let t20; 20424 if ($[32] !== t10 || $[33] !== t13 || $[34] !== t17 || $[35] !== t19 || $[36] !== t5) { 20425 t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 20426 className: "flex h-full animate-in flex-col duration-200 fade-in slide-in-from-right", 20427 children: [ 20428 t5, 20429 t10, 20430 t13, 20431 t17, 20432 t19 20433 ] 20434 }); 20435 $[32] = t10; 20436 $[33] = t13; 20437 $[34] = t17; 20438 $[35] = t19; 20439 $[36] = t5; 20440 $[37] = t20; 20441 } else t20 = $[37]; 20442 return t20; 20443}; 20444var messages_groups_manage_members_default = MessagesManageMembers; 20445var import_compiler_runtime$64 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 20446var DEFAULT_TABS_VARIANT = "underline"; 20447var tabsListVariants = T({ 20448 base: "inline-flex items-center text-muted-foreground", 20449 variants: { variant: { 20450 contained: "h-9 w-fit justify-center rounded-lg bg-muted p-[3px]", 20451 underline: "h-12 w-full gap-4 border-b border-border" 20452 } }, 20453 defaultVariants: { variant: DEFAULT_TABS_VARIANT } 20454}); 20455var tabsTriggerVariants = T({ 20456 base: "cursor-pointer inline-flex items-center justify-center gap-1.5 px-2 text-sm font-medium whitespace-nowrap disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\"size-\"])]:size-4", 20457 variants: { variant: { 20458 contained: "h-[calc(100%-1px)] flex-1 rounded-md border border-transparent py-1 text-foreground transition-[color,box-shadow] focu
20458s-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/20 focus-visible:outline-1 focus-visible:outline-ring data-[state=active]:bg-background data-[state=active]:shadow-sm dark:text-muted-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground", 20459 underline: "h-12 border-b-2 border-transparent py-1.5 text-muted-foreground transition-[color,border-color] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:border-accent-foreground data-[state=active]:text-foreground data-[state=active]:font-semibold" 20460 } }, 20461 defaultVariants: { variant: DEFAULT_TABS_VARIANT } 20462}); 20463var TabsContext = import_react.createContext({}); 20464function Tabs(t0) { 20465 const $ = (0, import_compiler_runtime$64.c)(14); 20466 let className; 20467 let props; 20468 let variant; 20469 if ($[0] !== t0) { 20470 ({className, variant, ...props} = t0); 20471 $[0] = t0; 20472 $[1] = className; 20473 $[2] = props; 20474 $[3] = variant; 20475 } else { 20476 className = $[1]; 20477 props = $[2]; 20478 variant = $[3]; 20479 } 20480 const t1 = variant ?? DEFAULT_TABS_VARIANT; 20481 let t2; 20482 if ($[4] !== t1) { 20483 t2 = { variant: t1 }; 20484 $[4] = t1; 20485 $[5] = t2; 20486 } else t2 = $[5]; 20487 let t3; 20488 if ($[6] !== className) { 20489 t3 = cn("flex flex-col gap-2", className); 20490 $[6] = className; 20491 $[7] = t3; 20492 } else t3 = $[7]; 20493 let t4; 20494 if ($[8] !== props || $[9] !== t3) { 20495 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root2$3, { 20496 "data-slot": "tabs", 20497 className: t3, 20498 ...props 20499 }); 20500 $[8] = props; 20501 $[9] = t3; 20502 $[10] = t4; 20503 } else t4 = $[10]; 20504 let t5; 20505 if ($[11] !== t2 || $[12] !== t4) { 20506 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsContext.Provider, { 20507 value: t2, 20508 children: t4 20509 }); 20510 $[11] = t2; 20511 $[12] = t4; 20512 $[13] = t5; 20513 } else t5 = $[13]; 20514 return t5; 20515} 20516function TabsList(t0) { 20517 const $ = (0, import_compiler_runtime$64.c)(10); 20518 let className; 20519 let props; 20520 let variantProp; 20521 if ($[0] !== t0) { 20522 ({className, variant: variantProp, ...props} = t0); 20523 $[0] = t0; 20524 $[1] = className; 20525 $[2] = props; 20526 $[3] = variantProp; 20527 } else { 20528 className = $[1]; 20529 props = $[2]; 20530 variantProp = $[3]; 20531 } 20532 const context = import_react.useContext(TabsContext); 20533 const variant = variantProp ?? context.variant; 20534 let t1; 20535 if ($[4] !== className || $[5] !== variant) { 20536 t1 = cn(tabsListVariants({ variant }), className); 20537 $[4] = className; 20538 $[5] = variant; 20539 $[6] = t1; 20540 } else t1 = $[6]; 20541 let t2; 20542 if ($[7] !== props || $[8] !== t1) { 20543 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(List, { 20544 "data-slot": "tabs-list", 20545 className: t1, 20546 ...props 20547 }); 20548 $[7] = props; 20549 $[8] = t1; 20550 $[9] = t2; 20551 } else t2 = $[9]; 20552 return t2; 20553} 20554function TabsTrigger(t0) { 20555 const $ = (0, import_compiler_runtime$64.c)(10); 20556 let className; 20557 let props; 20558 let variantProp; 20559 if ($[0] !== t0) { 20560 ({className, variant: variantProp, ...props} = t0); 20561 $[0] = t0; 20562 $[1] = className; 20563 $[2] = props; 20564 $[3] = variantProp; 20565 } else { 20566 className = $[1]; 20567 props = $[2]; 20568 variantProp = $[3]; 20569 } 20570 const context = import_react.useContext(TabsContext); 20571 const variant = variantProp ?? context.variant; 20572 let t1; 20573 if ($[4] !== className || $[5] !== variant) { 20574 t1 = cn(tabsTriggerVariants({ variant }), className); 20575 $[4] = className; 20576 $[5] = variant; 20577 $[6] = t1; 20578 } else t1 = $[6]; 20579 let t2; 20580 if ($[7] !== props || $[8] !== t1) { 20581 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trigger$5, { 20582 "data-slot": "tabs-trigger", 20583 className: t1, 20584 ...props 20585 }); 20586 $[7] = props; 20587 $[8] = t1; 20588 $[9] = t2; 20589 } else t2 = $[9]; 20590 return t2; 20591} 20592function TabsContent(t0) { 20593 const $ = (0, import_compiler_runtime$64.c)(8); 20594 let className; 20595 let props; 20596 if ($[0] !== t0) { 20597 ({className, ...props} = t0); 20598 $[0] = t0; 20599 $[1] = className; 20600 $[2] = props; 20601 } else { 20602 className = $[1]; 20603 props = $[2]; 20604 } 20605 let t1; 20606 if ($[3] !== className) { 20607 t1 = cn("flex-1 outline-none", className); 20608 $[3] = className; 20609 $[4] = t1; 20610 } else t1 = $[4]; 20611 let t2; 20612 if ($[5] !== props || $[6] !== t1) { 20613 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content$1, { 20614 "data-slot": "tabs-content", 20615 className: t1, 20616 ...props 20617 }); 20618 $[5] = props; 20619 $[6] = t1; 20620 $[7] = t2; 20621 } else t2 = $[7]; 20622 return t2; 20623} 20624var import_compiler_runtime$63 = /* @__PURE__ */ __toESM(require_compiler_runtime());
20625const MessagesChatsDateMessage = (t0) => { 20626 const $ = (0, import_compiler_runtime$63.c)(11); 20627 const { date, className } = t0; 20628 let t1; 20629 if ($[0] !== date) { 20630 t1 = _formatRelativeDay(date, /* @__PURE__ */ new Date()); 20631 $[0] = date; 20632 $[1] = t1; 20633 } else t1 = $[1]; 20634 const formattedDate = t1; 20635 let t2; 20636 if ($[2] !== className) { 20637 t2 = cn("flex items-center gap-3 py-2", className); 20638 $[2] = className; 20639 $[3] = t2; 20640 } else t2 = $[3]; 20641 let t3; 20642 if ($[4] === Symbol.for("react.memo_cache_sentinel")) { 20643 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Separator, { className: "flex-1" }); 20644 $[4] = t3; 20645 } else t3 = $[4]; 20646 let t4; 20647 if ($[5] !== formattedDate) { 20648 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 20649 className: "text-xs text-muted-foreground", 20650 children: formattedDate 20651 }); 20652 $[5] = formattedDate; 20653 $[6] = t4; 20654 } else t4 = $[6]; 20655 let t5; 20656 if ($[7] === Symbol.for("react.memo_cache_sentinel")) { 20657 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Separator, { className: "flex-1" }); 20658 $[7] = t5; 20659 } else t5 = $[7]; 20660 let t6; 20661 if ($[8] !== t2 || $[9] !== t4) { 20662 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 20663 className: t2, 20664 children: [ 20665 t3, 20666 t4, 20667 t5 20668 ] 20669 }); 20670 $[8] = t2; 20671 $[9] = t4; 20672 $[10] = t6; 20673 } else t6 = $[10]; 20674 return t6; 20675}; 20676var import_compiler_runtime$62 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 20677var textMessage = T({ 20678 base: "rounded-lg px-3 py-2.5 text-sm whitespace-pre-wrap wrap-break-word", 20679 variants: { current: { 20680 true: "bg-blue-200 text-[#151A26]", 20681 false: "bg-gray-200 text-accent-foreground" 20682 } }, 20683 defaultVariants: { current: false } 20684}); 20685const MessagesChatsTextMessage = (t0) => { 20686 const $ = (0, import_compiler_runtime$62.c)(6); 20687 const { children, current: t1, className } = t0; 20688 const current = t1 === void 0 ? false : t1; 20689 let t2; 20690 if ($[0] !== className || $[1] !== current) { 20691 t2 = cn(textMessage({ current }), className); 20692 $[0] = className; 20693 $[1] = current; 20694 $[2] = t2; 20695 } else t2 = $[2]; 20696 let t3; 20697 if ($[3] !== children || $[4] !== t2) { 20698 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 20699 className: t2, 20700 children 20701 }); 20702 $[3] = children; 20703 $[4] = t2; 20704 $[5] = t3; 20705 } else t3 = $[5]; 20706 return t3; 20707}; 20708var import_compiler_runtime$61 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 20709const MessagesChatsImagePreviewDialog = (t0) => { 20710 const $ = (0, import_compiler_runtime$61.c)(13); 20711 const { open, onOpenChange, src, alt: t1, className } = t0; 20712 const alt = t1 === void 0 ? "Image preview" : t1; 20713 let t2; 20714 if ($[0] !== className) { 20715 t2 = cn("inset-0 flex max-h-none max-w-none translate-x-0 translate-y-0 items-center justify-center border-0 bg-transparent p-0 shadow-none", "focus:outline-none data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", className); 20716 $[0] = className; 20717 $[1] = t2; 20718 } else t2 = $[1]; 20719 let t3; 20720 if ($[2] !== alt || $[3] !== src) { 20721 t3 = src && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { 20722 src, 20723 alt, 20724 className: "max-h-[90vh] max-w-[90vw] rounded-lg object-contain", 20725 draggable: false 20726 }); 20727 $[2] = alt; 20728 $[3] = src; 20729 $[4] = t3; 20730 } else t3 = $[4]; 20731 let t4; 20732 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 20733 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogClose, { 20734 asChild: true, 20735 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 20736 variant: "ghost", 20737 size: "icon", 20738 className: "absolute top-4 right-4 rounded-full bg-black/50 text-white focus-visible:ring-white", 20739 "aria-label": "Close", 20740 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { className: "size-6" }) 20741 }) 20742 }); 20743 $[5] = t4; 20744 } else t4 = $[5]; 20745 let t5; 20746 if ($[6] !== t2 || $[7] !== t3) { 20747 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, { 20748 className: t2, 20749 showCloseButton: false, 20750 children: [t3, t4] 20751 }); 20752 $[6] = t2; 20753 $[7] = t3; 20754 $[8] = t5; 20755 } else t5 = $[8]; 20756 let t6; 20757 if ($[9] !== onOpenChange || $[10] !== open || $[11] !== t5) { 20758 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, { 20759 open, 20760 onOpenChange, 20761 children: t5 20762 }); 20763 $[9] = onOpenChange; 20764 $[10] = open; 20765 $[11] = t5; 20766 $[12] = t6; 20767 } else t6 = $[12]; 20768 return t6; 20769}; 20770var import_compiler_runtime$60 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 20771var MAX_WIDTH = 260; 20772var MIN_HEIGHT = 40; 20773var MAX_HEIGHT = 348; 20774const MessagesChatsImageMessage = (t0) => { 20775 const $ = (0, import_compiler_runtime$60.c)(26); 20776 const { src, alt: t1, width, height, className } = t0; 20777 const alt = t1 === void 0 ? "Chat image" : t1; 20778 const [previewOpen, setPreviewOpen] = (0, import_react.useState)(false);
20779 const [loaded, setLoaded] = (0, import_react.useState)(false); 20780 let t2; 20781 if ($[0] !== src) { 20782 t2 = () => { 20783 trackMethodCall("handleViewImage", []); 20784 if (src) setPreviewOpen(true); 20785 }; 20786 $[0] = src; 20787 $[1] = t2; 20788 } else t2 = $[1]; 20789 const handleViewImage = t2; 20790 const hasDimensions = Boolean(width && height); 20791 let boxStyle; 20792 if (width && height) { 20793 const displayWidth = Math.min(width, MAX_WIDTH); 20794 const ratioHeight = displayWidth * height / width; 20795 const displayHeight = Math.min(Math.max(ratioHeight, MIN_HEIGHT), MAX_HEIGHT); 20796 let t3$1; 20797 if ($[2] !== displayHeight || $[3] !== displayWidth) { 20798 t3$1 = { 20799 width: displayWidth, 20800 height: displayHeight 20801 }; 20802 $[2] = displayHeight; 20803 $[3] = displayWidth; 20804 $[4] = t3$1; 20805 } else t3$1 = $[4]; 20806 boxStyle = t3$1; 20807 } else { 20808 let t3$1; 20809 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 20810 t3$1 = { 20811 maxWidth: MAX_WIDTH, 20812 minHeight: MIN_HEIGHT, 20813 maxHeight: MAX_HEIGHT 20814 }; 20815 $[5] = t3$1; 20816 } else t3$1 = $[5]; 20817 boxStyle = t3$1; 20818 } 20819 const t3 = boxStyle; 20820 let t4; 20821 if ($[6] === Symbol.for("react.memo_cache_sentinel")) { 20822 t4 = () => setLoaded(true); 20823 $[6] = t4; 20824 } else t4 = $[6]; 20825 const t5 = hasDimensions ? "size-full" : "max-h-[348px] w-auto"; 20826 const t6 = loaded ? "opacity-100" : "opacity-0"; 20827 let t7; 20828 if ($[7] !== className || $[8] !== t5 || $[9] !== t6) { 20829 t7 = cn("object-cover object-center transition-opacity duration-200", t5, t6, className); 20830 $[7] = className; 20831 $[8] = t5; 20832 $[9] = t6; 20833 $[10] = t7; 20834 } else t7 = $[10]; 20835 let t8; 20836 if ($[11] !== alt || $[12] !== src || $[13] !== t7) { 20837 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { 20838 src, 20839 alt, 20840 onLoad: t4, 20841 className: t7 20842 }); 20843 $[11] = alt; 20844 $[12] = src; 20845 $[13] = t7; 20846 $[14] = t8; 20847 } else t8 = $[14]; 20848 let t9; 20849 if ($[15] !== boxStyle || $[16] !== handleViewImage || $[17] !== t8) { 20850 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 20851 type: "button", 20852 variant: "ghost", 20853 onClick: handleViewImage, 20854 style: t3, 20855 className: "block size-auto min-h-0 cursor-pointer overflow-hidden rounded-lg bg-[#E7EBF3] p-0 hover:bg-[#E7EBF3] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", 20856 "aria-label": "View image", 20857 children: t8 20858 }); 20859 $[15] = boxStyle; 20860 $[16] = handleViewImage; 20861 $[17] = t8; 20862 $[18] = t9; 20863 } else t9 = $[18]; 20864 const t10 = typeof src === "string" ? src : null; 20865 let t11; 20866 if ($[19] !== alt || $[20] !== previewOpen || $[21] !== t10) { 20867 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesChatsImagePreviewDialog, { 20868 open: previewOpen, 20869 onOpenChange: setPreviewOpen, 20870 src: t10, 20871 alt 20872 }); 20873 $[19] = alt; 20874 $[20] = previewOpen; 20875 $[21] = t10; 20876 $[22] = t11; 20877 } else t11 = $[22]; 20878 let t12; 20879 if ($[23] !== t11 || $[24] !== t9) { 20880 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [t9, t11] }); 20881 $[23] = t11; 20882 $[24] = t9; 20883 $[25] = t12; 20884 } else t12 = $[25]; 20885 return t12; 20886}; 20887var import_compiler_runtime$59 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 20888var audioMessage = T({ slots: { 20889 root: "flex w-[173px] items-center gap-2 rounded-lg bg-blue-200 p-3", 20890 button: "size-4 shrink-0 text-primary hover:bg-transparent hover:text-primary", 20891 icon: "size-4 fill-current", 20892 slider: "[&_[data-slot=slider-track]]:bg-white [&_[data-slot=slider-thumb]]:relative [&_[data-slot=slider-thumb]]:size-4 [&_[data-slot=slider-thumb]]:border-white [&_[data-slot=slider-thumb]]:after:absolute [&_[data-slot=slider-thumb]]:after:inset-0 [&_[data-slot=slider-thumb]]:after:m-auto [&_[data-slot=slider-thumb]]:after:size-2 [&_[data-slot=slider-thumb]]:after:rounded-full [&_[data-slot=slider-thumb]]:after:bg-primary [&_[data-slot=slider-thumb]]:after:content-['']", 20893 time: "shrink-0 text-xs font-medium text-[#151A26]" 20894} }); 20895var formatTime = (seconds) => { 20896 const safe = Number.isFinite(seconds) && seconds > 0 ? Math.floor(seconds) : 0; 20897 const minutes = Math.floor(safe / 60); 20898 const secs = safe % 60; 20899 return `${minutes}:${String(secs).padStart(2, "0")}`; 20900}; 20901const MessagesChatsAudioMessage = (t0) => { 20902 const $ = (0, import_compiler_runtime$59.c)(29); 20903 const { url, duration: t1, className } = t0; 20904 const durationProp = t1 === void 0 ? 0 : t1; 20905 const audioRef = (0, import_react.useRef)(null); 20906 const [isPlaying, setIsPlaying] = (0, import_react.useState)(false); 20907 const [currentTime, setCurrentTime] = (0, import_react.useState)(0); 20908 const [duration, setDuration] = (0, import_react.useState)(durationProp); 20909 let t2; 20910 let t3; 20911 let t4; 20912 let t5; 20913 let t6; 20914 let t7; 20915 if ($[0] !== className || $[1] !== currentTime || $[2] !== duration || $[3] !== isPlaying || $[4] !== url) { 20916 const styles = audioMessage(); 20917 let t8$1; 20918 if ($[11] === Symbol.for("react.memo_cache_sentinel")) { 20919 t8$1 = () => { 20920 const audio = audioRef.current; 20921 if (!audio) return; 20922 if (audio.paused) { 20923 audio.play(); 20924 setIsPlaying(true); 20925 } else { 20926 audio.pause(); 20927 setIsPlaying(false); 20928 } 20929 }; 20930 $[11] = t8$1; 20931 } else t8$1 = $[11]; 20932 const togglePlay = t8$1; 20933 let t9$1; 20934 if ($[12] === Symbol.for("react.memo_cache_sentinel")) { 20935 t9$1 = () => { 20936 const value = audioRef.current?.duration; 20937 if (value && Number.isFinite(value)) setDuration(value); 20938 }; 20939 $[12] = t9$1; 20940 } else t9$1 = $[12]; 20941 const syncDuration = t9$1; 20942 let t10; 20943 if ($[13] === Symbol.for("react.memo_cache_sentinel")) { 20944 t10 = () => { 20945 setCurrentTime(audioRef.current?.currentTime ?? 0); 20946 }; 20947 $[13] = t10; 20948 } else t10 = $[13]; 20949 const onTimeUpdate = t10; 20950 let t11; 20951 if ($[14] === Symbol.for("react.memo_cache_sentinel")) { 20952 t11 = () => { 20953 setIsPlaying(false); 20954 setCurrentTime(0); 20955 }; 20956 $[14] = t11; 20957 } else t11 = $[14]; 20958 const onEnded = t11; 20959 let t12; 20960 if ($[15] === Symbol.for("react.memo_cache_sentinel")) { 20961 t12 = (t13$1) => { 20962 const [value_0] = t13$1; 20963 const audio_0 = audioRef.current; 20964 if (!audio_0) return; 20965 audio_0.currentTime = value_0; 20966 setCurrentTime(value_0); 20967 }; 20968 $[15] = t12; 20969 } else t12 = $[15]; 20970 const onSeek = t12; 20971 const sliderMax = duration > 0 ? duration : 1; 20972 const displayTime = currentTime > 0 ? Math.max(Math.floor(duration) - Math.floor(currentTime), 0) : Math.round(duration); 20973 t4 = cn(styles.root(), className); 20974 if ($[16] !== url) { 20975 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("audio", { 20976 ref: audioRef, 20977 src: url, 20978 preload: "metadata", 20979 onLoadedMetadata: syncDuration, 20980 onDurationChange: syncDuration, 20981 onTimeUpdate, 20982 onEnded 20983 });
20984 $[16] = url; 20985 $[17] = t5; 20986 } else t5 = $[17]; 20987 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 20988 type: "button", 20989 variant: "ghost", 20990 size: "icon", 20991 className: styles.button(), 20992 "aria-label": isPlaying ? "Pause voice message" : "Play voice message", 20993 onClick: togglePlay, 20994 children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pause, { className: styles.icon() }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Play, { className: styles.icon() }) 20995 }); 20996 const t13 = styles.slider(); 20997 const t14 = Math.min(currentTime, sliderMax); 20998 let t15; 20999 if ($[18] !== t14) { 21000 t15 = [t14]; 21001 $[18] = t14; 21002 $[19] = t15; 21003 } else t15 = $[19]; 21004 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slider, { 21005 "aria-label": "Seek voice message", 21006 className: t13, 21007 value: t15, 21008 max: sliderMax, 21009 step: .1, 21010 onValueChange: onSeek 21011 }); 21012 t2 = styles.time(); 21013 t3 = formatTime(displayTime); 21014 $[0] = className; 21015 $[1] = currentTime; 21016 $[2] = duration; 21017 $[3] = isPlaying; 21018 $[4] = url; 21019 $[5] = t2; 21020 $[6] = t3; 21021 $[7] = t4; 21022 $[8] = t5; 21023 $[9] = t6; 21024 $[10] = t7; 21025 } else { 21026 t2 = $[5]; 21027 t3 = $[6]; 21028 t4 = $[7]; 21029 t5 = $[8]; 21030 t6 = $[9]; 21031 t7 = $[10]; 21032 } 21033 let t8; 21034 if ($[20] !== t2 || $[21] !== t3) { 21035 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 21036 className: t2, 21037 children: t3 21038 }); 21039 $[20] = t2; 21040 $[21] = t3; 21041 $[22] = t8; 21042 } else t8 = $[22]; 21043 let t9; 21044 if ($[23] !== t4 || $[24] !== t5 || $[25] !== t6 || $[26] !== t7 || $[27] !== t8) { 21045 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 21046 className: t4, 21047 children: [ 21048 t5, 21049 t6, 21050 t7, 21051 t8 21052 ] 21053 }); 21054 $[23] = t4; 21055 $[24] = t5; 21056 $[25] = t6; 21057 $[26] = t7; 21058 $[27] = t8; 21059 $[28] = t9; 21060 } else t9 = $[28]; 21061 return t9; 21062}; 21063var trip_card_background_default = "/assets/trip-card-background-uNA-0NYn.svg"; 21064var import_compiler_runtime$58 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 21065var StopAddress = (t0) => { 21066 const $ = (0, import_compiler_runtime$58.c)(7); 21067 const { type, address } = t0; 21068 const t1 = type === "pick-up" ? "pick-up" : "drop-off"; 21069 let t2; 21070 if ($[0] !== t1) { 21071 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 21072 name: t1, 21073 className: "size-4 shrink-0" 21074 }); 21075 $[0] = t1; 21076 $[1] = t2; 21077 } else t2 = $[1]; 21078 let t3; 21079 if ($[2] !== address) { 21080 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 21081 asChild: true, 21082 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 21083 className: "block overflow-hidden text-sm leading-5 text-ellipsis whitespace-nowrap text-gray-900", 21084 children: address 21085 }) 21086 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: address })] }); 21087 $[2] = address; 21088 $[3] = t3; 21089 } else t3 = $[3]; 21090 let t4; 21091 if ($[4] !== t2 || $[5] !== t3) { 21092 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 21093 className: "flex min-w-0 flex-nowrap items-center gap-2", 21094 children: [t2, t3] 21095 }); 21096 $[4] = t2; 21097 $[5] = t3; 21098 $[6] = t4; 21099 } else t4 = $[6]; 21100 return t4; 21101}; 21102var Dots = (t0) => { 21103 const $ = (0, import_compiler_runtime$58.c)(3); 21104 const { displayStops } = t0; 21105 let t1; 21106 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 21107 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 21108 className: "flex h-5 w-4 flex-col items-center justify-between gap-1", 21109 children: [ 21110 0, 21111 1, 21112 2, 21113 3 21114 ].map(_temp$13) 21115 }); 21116 $[0] = t1; 21117 } else t1 = $[0]; 21118 let t2; 21119 if ($[1] !== displayStops) { 21120 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 21121 className: "flex gap-2", 21122 children: [t1, /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 21123 className: "pt-0.5 text-xs leading-4 text-gray-500", 21124 children: displayStops 21125 })] 21126 }); 21127 $[1] = displayStops; 21128 $[2] = t2; 21129 } else t2 = $[2]; 21130 return t2; 21131}; 21132const MessagesChatsTripCardMessage = (t0) => { 21133 const $ = (0, import_compiler_runtime$58.c)(23); 21134 const { trip, className } = t0; 21135 if (!trip || !trip.stops || trip.stops.length === 0) { 21136 let t1$1; 21137 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 21138 t1$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}); 21139 $[0] = t1$1; 21140 } else t1$1 = $[0]; 21141 return t1$1; 21142 } 21143 const { stops, totalTime, totalDistance } = trip; 21144 const pickUpStop = stops[0]; 21145 const dropOffStop = stops[stops.length - 1]; 21146 const middleStopsLength = Math.max(stops.length - 2, 0); 21147 const displayMiddleStops = middleStopsLength === 0 ? "" : stops.length === 1 ? "1 Stop" : `${middleStopsLength} Stops`; 21148 let t1; 21149 if ($[1] !== className) { 21150 t1 = cn("relative overflow-hidden p-3", className); 21151 $[1] = className; 21152 $[2] = t1; 21153 } else t1 = $[2]; 21154 let t2; 21155 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 21156 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { 21157 src: trip_card_background_default, 21158 width: 135, 21159 height: 75, 21160 alt: "trip-card-background", 21161 className: "pointer-events-none absolute top-0 right-0 z-1" 21162 }); 21163 $[3] = t2; 21164 } else t2 = $[3]; 21165 let t3; 21166 if ($[4] !== pickUpStop.address) { 21167 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StopAddress, { 21168 type: "pick-up", 21169 address: pickUpStop.address 21170 }); 21171 $[4] = pickUpStop.address; 21172 $[5] = t3; 21173 } else t3 = $[5]; 21174 let t4; 21175 if ($[6] !== displayMiddleStops) { 21176 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dots, { displayStops: displayMiddleStops }); 21177 $[6] = displayMiddleStops; 21178 $[7] = t4; 21179 } else t4 = $[7]; 21180 let t5; 21181 if ($[8] !== dropOffStop.address) { 21182 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StopAddress, { 21183 type: "drop-off", 21184 address: dropOffStop.address 21185 }); 21186 $[8] = dropOffStop.address; 21187 $[9] = t5; 21188 } else t5 = $[9]; 21189 const t6 = `${totalTime} · ${totalDistance}`; 21190 let t7; 21191 if ($[10] !== t6) { 21192 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 21193 className: "mt-2 text-xs leading-4 text-gray-500", 21194 children: t6 21195 }); 21196 $[10] = t6; 21197 $[11] = t7; 21198 } else t7 = $[11]; 21199 const t8 = `?tripId=${trip.tripCustomId ?? ""}`; 21200 let t9; 21201 if ($[12] !== t8) { 21202 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, { 21203 to: { 21204 pathname: "/trips", 21205 search: t8 21206 }, 21207 className: "h-fit w-fit p-0 text-left text-xs text-primary underline-offset-4 hover:underline", 21208 children: "View Route Detail" 21209 }); 21210 $[12] = t8; 21211 $[13] = t9; 21212 } else t9 = $[13]; 21213 let t10; 21214 if ($[14] !== t3 || $[15] !== t4 || $[16] !== t5 || $[17] !== t7 || $[18] !== t9) { 21215 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 21216 className: "z-2 flex w-[236px] flex-col gap-1", 21217 children: [ 21218 t3, 21219 t4, 21220 t5, 21221 t7, 21222 t9 21223 ] 21224 }); 21225 $[14] = t3; 21226 $[15] = t4; 21227 $[16] = t5; 21228 $[17] = t7; 21229 $[18] = t9; 21230 $[19] = t10; 21231 } else t10 = $[19]; 21232 let t11; 21233 if ($[20] !== t1 || $[21] !== t10) { 21234 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Card, { 21235 className: t1, 21236 children: [t2, t10] 21237 }); 21238 $[20] = t1; 21239 $[21] = t10; 21240 $[22] = t11; 21241 } else t11 = $[22]; 21242 return t11; 21243}; 21244function _temp$13(key) { 21245 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "size-0.5 rounded-full bg-gray-300" }, key); 21246}
21247const MessagesChatsDescriptionMessage = ({ status, date = /* @__PURE__ */ new Date(), name, onResend, className }) => { 21248 if (status === "sending") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, { className: "size-3 animate-spin text-primary" }); 21249 if (status === "failed") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 21250 className: cn("flex items-center", className), 21251 children: [ 21252 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 21253 className: "text-xs text-muted-foreground", 21254 children: "Not Delivered" 21255 }), 21256 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 21257 size: "sm", 21258 variant: "link", 21259 onClick: onResend, 21260 className: "ml-1 h-auto p-0 text-xs", 21261 children: "Resend" 21262 }), 21263 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleAlert, { 21264 className: "ml-1 text-destructive", 21265 size: 12 21266 }) 21267 ] 21268 }); 21269 const formattedTime = safeFormatDate(date, "HH:mm"); 21270 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 21271 className: cn("flex items-center gap-1 text-xs text-muted-foreground", className), 21272 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 21273 className: "text-xs text-foreground", 21274 children: name 21275 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 21276 className: "text-xs text-muted-foreground", 21277 children: formattedTime 21278 })] 21279 }); 21280}; 21281var import_compiler_runtime$57 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 21282const MessagesChatsSystemMessage = (t0) => { 21283 const $ = (0, import_compiler_runtime$57.c)(10); 21284 const { content, date, className } = t0; 21285 let t1; 21286 if ($[0] !== className) { 21287 t1 = cn("flex flex-col items-center gap-1", className); 21288 $[0] = className; 21289 $[1] = t1; 21290 } else t1 = $[1]; 21291 let t2; 21292 if ($[2] !== content) { 21293 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 21294 className: "text-center text-sm text-foreground", 21295 children: content 21296 }); 21297 $[2] = content; 21298 $[3] = t2; 21299 } else t2 = $[3]; 21300 let t3; 21301 if ($[4] !== date) { 21302 t3 = date && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 21303 className: "text-xs text-muted-foreground", 21304 children: safeFormatDate(date, "HH:mm") 21305 }); 21306 $[4] = date; 21307 $[5] = t3; 21308 } else t3 = $[5]; 21309 let t4; 21310 if ($[6] !== t1 || $[7] !== t2 || $[8] !== t3) { 21311 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 21312 className: t1, 21313 children: [t2, t3] 21314 }); 21315 $[6] = t1; 21316 $[7] = t2; 21317 $[8] = t3; 21318 $[9] = t4; 21319 } else t4 = $[9]; 21320 return t4; 21321}; 21322var groupConsecutiveBy = (messages, getKey) => { 21323 const groups = []; 21324 let previousKey; 21325 for (const message of messages) { 21326 const key = getKey(message); 21327 if (key !== previousKey) { 21328 groups.push([]); 21329 previousKey = key; 21330 } 21331 groups[groups.length - 1].push(message); 21332 } 21333 return groups; 21334}; 21335var groupMessagesByUserTime = (messages) => { 21336 return groupConsecutiveBy(messages, (message) => { 21337 return JSON.stringify({ 21338 userId: message.user?.id, 21339 time: safeFormatDate(message.createdAt ?? /* @__PURE__ */ new Date(), "HH:mm") 21340 }); 21341 }).map((items$1, index) => { 21342 return { 21343 id: index.toString(), 21344 time: items$1[0].createdAt, 21345 user: items$1[0].user, 21346 items: items$1 21347 }; 21348 }); 21349}; 21350const groupMessagesByDate = (messages) => { 21351 return groupConsecutiveBy(messages, (message) => { 21352 return safeFormatDate(message.createdAt ?? /* @__PURE__ */ new Date()); 21353 }).map((items$1, index) => { 21354 return { 21355 id: index.toString(), 21356 date: items$1[0].createdAt, 21357 items: groupMessagesByUserTime(items$1) 21358 }; 21359 }); 21360}; 21361var import_compiler_runtime$56 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 21362var SCROLL_FAR_THRESHOLD = 1e3; 21363var SCROLL_HISTORY_THRESHOLD = 300; 21364var LOAD_OLDER_THRESHOLD = 80; 21365var MessagesChatsList = (t0) => { 21366 const $ = (0, import_compiler_runtime$56.c)(39); 21367 const { messages: t1 } = t0; 21368 let t2; 21369 if ($[0] !== t1) { 21370 t2 = t1 === void 0 ? [] : t1; 21371 $[0] = t1; 21372 $[1] = t2; 21373 } else t2 = $[1]; 21374 const messages = t2; 21375 const scrollRef = (0, import_react.useRef)(null); 21376 const [showScrollToBottom, setShowScrollToBottom] = (0, import_react.useState)(false); 21377 const [isLoadingOlder, setIsLoadingOlder] = (0, import_react.useState)(false); 21378 const { getOlderMessages, resendMessage }
21378 = useMessagesContext(); 21379 const sessionId = useAppSelector(selectSessionId); 21380 let t3; 21381 if ($[2] !== sessionId) { 21382 t3 = (state$3) => selectHasMoreHistory(state$3, sessionId); 21383 $[2] = sessionId; 21384 $[3] = t3; 21385 } else t3 = $[3]; 21386 const hasMore = useAppSelector(t3); 21387 let t4; 21388 if ($[4] !== sessionId) { 21389 t4 = sessionId?.startsWith("team-") ?? false; 21390 $[4] = sessionId; 21391 $[5] = t4; 21392 } else t4 = $[5]; 21393 const isGroup = t4; 21394 const isLoadingOlderRef = (0, import_react.useRef)(false); 21395 const isScrolledUpRef = (0, import_react.useRef)(false); 21396 const prevFirstIdRef = (0, import_react.useRef)(void 0); 21397 const prevLastIdRef = (0, import_react.useRef)(void 0); 21398 const prevLenRef = (0, import_react.useRef)(0); 21399 const prevScrollHeightRef = (0, import_react.useRef)(0); 21400 const prevSessionIdRef = (0, import_react.useRef)(void 0); 21401 let t5; 21402 if ($[6] !== getOlderMessages || $[7] !== hasMore) { 21403 t5 = () => { 21404 const scroll = scrollRef.current; 21405 if (!scroll) return; 21406 const distanceFromBottom = scroll.scrollHeight - scroll.clientHeight - scroll.scrollTop; 21407 const isScrolledUp = distanceFromBottom > SCROLL_HISTORY_THRESHOLD; 21408 isScrolledUpRef.current = isScrolledUp; 21409 if (distanceFromBottom > SCROLL_FAR_THRESHOLD) setShowScrollToBottom(true); 21410 else if (!isScrolledUp) setShowScrollToBottom(false); 21411 if (scroll.scrollTop <= LOAD_OLDER_THRESHOLD && hasMore && !isLoadingOlderRef.current) { 21412 isLoadingOlderRef.current = true; 21413 setIsLoadingOlder(true); 21414 getOlderMessages().finally(() => { 21415 isLoadingOlderRef.current = false; 21416 setIsLoadingOlder(false); 21417 }); 21418 } 21419 }; 21420 $[6] = getOlderMessages; 21421 $[7] = hasMore; 21422 $[8] = t5; 21423 } else t5 = $[8]; 21424 const onScroll = t5; 21425 let t6; 21426 if ($[9] === Symbol.for("react.memo_cache_sentinel")) { 21427 t6 = () => { 21428 trackMethodCall("handleScrollToBottom", []); 21429 const scroll_0 = scrollRef.current; 21430 if (!scroll_0) return; 21431 scroll_0.scrollTo({ 21432 top: scroll_0.scrollHeight, 21433 behavior: "smooth" 21434 }); 21435 setShowScrollToBottom(false); 21436 }; 21437 $[9] = t6; 21438 } else t6 = $[9]; 21439 const handleScrollToBottom = t6; 21440 let t7; 21441 if ($[10] === Symbol.for("react.memo_cache_sentinel")) { 21442 t7 = () => { 21443 isLoadingOlderRef.current = false; 21444 setIsLoadingOlder(false); 21445 }; 21446 $[10] = t7; 21447 } else t7 = $[10]; 21448 let t8; 21449 if ($[11] !== sessionId) { 21450 t8 = [sessionId]; 21451 $[11] = sessionId; 21452 $[12] = t8; 21453 } else t8 = $[12]; 21454 (0, import_react.useEffect)(t7, t8); 21455 let t10; 21456 let t9; 21457 if ($[13] !== messages || $[14] !== sessionId) { 21458 t9 = () => { 21459 const scroll_1 = scrollRef.current; 21460 if (!scroll_1 || messages.length === 0) return; 21461 const firstId = messages[0]?.id; 21462 const lastId = messages[messages.length - 1]?.id; 21463 const isInitial = prevSessionIdRef.current !== sessionId || prevLenRef.current === 0; 21464 const isPrepend = !isInitial && messages.length > prevLenRef.current && firstId !== prevFirstIdRef.current && lastId === prevLastIdRef.current; 21465 const scrollToBottom = () => { 21466 requestAnimationFrame(() => { 21467 scroll_1.scrollTop = scroll_1.scrollHeight - scroll_1.clientHeight; 21468 }); 21469 }; 21470 if (isInitial) { 21471 setShowScrollToBottom(false); 21472 scrollToBottom(); 21473 } else if (isPrepend) scroll_1.scrollTop = scroll_1.scrollTop + (scroll_1.scrollHeight - prevScrollHeightRef.current); 21474 else if (messages.length > prevLenRef.current) { 21475 const lastMessage = messages[messages.length - 1]; 21476 if (!Boolean(lastMessage?.current) && isScrolledUpRef.current) setShowScrollToBottom(true); 21477 else { 21478 setShowScrollToBottom(false); 21479 scrollToBottom(); 21480 } 21481 } 21482 prevFirstIdRef.current = firstId; 21483 prevLastIdRef.current = lastId; 21484 prevLenRef.current = messages.length; 21485 prevScrollHeightRef.current = scroll_1.scrollHeight; 21486 prevSessionIdRef.current = sessionId; 21487 }; 21488 t10 = [messages, sessionId]; 21489 $[13] = messages; 21490 $[14] = sessionId; 21491 $[15] = t10; 21492 $[16] = t9; 21493 } else { 21494 t10 = $[15]; 21495 t9 = $[16]; 21496 } 21497 (0, import_react.useLayoutEffect)(t9, t10); 21498 let t11; 21499 if ($[17] !== isLoadingOlder) { 21500 t11 = isLoadingOlder && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 21501 className: "flex justify-center py-2", 21502 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, { 21503 className: "size-4 animate-spin text-muted-foreground", 21504 "aria-hidden": true 21505 }) 21506 }); 21507 $[17] = isLoadingOlder; 21508 $[18] = t11; 21509 } else t11 = $[18]; 21510 let t12; 21511 if ($[19] !== isGroup || $[20] !== messages || $[21] !== resendMessage || $[22] !== sessionId) { 21512 let t13$1; 21513 if ($[24] !== isGroup || $[25] !== resendMessage || $[26] !== sessionId) { 21514 t13$1 = (groupByDate) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 21515 className: "flex flex-col gap-1",
21516 children: [groupByDate.date && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesChatsDateMessage, { date: groupByDate.date }), groupByDate.items?.map((groupByUserTime) => { 21517 const blockItems = groupByUserTime.items ?? []; 21518 const isOwn = Boolean(blockItems[0]?.current); 21519 const hasBubble = blockItems.some(_temp$12); 21520 const showSender = isGroup && !isOwn && hasBubble; 21521 const lastMessage_0 = blockItems[blockItems.length - 1]; 21522 const lastIsPending = lastMessage_0?.status === "sending" || lastMessage_0?.status === "failed"; 21523 const bubbles = blockItems.map((message_0) => { 21524 const { current, createdAt, content, duration, width, height, status, id, type, trip } = message_0; 21525 if (type === "system") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesChatsSystemMessage, { 21526 content, 21527 date: createdAt 21528 }, id); 21529 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 21530 className: cn("flex max-w-[80%] flex-col gap-1", current ? "self-end" : "self-start", current ? "items-end" : "items-start"), 21531 children: [ 21532 type === "text" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesChatsTextMessage, { 21533 current, 21534 className: "max-w-full", 21535 children: content 21536 }), 21537 type === "image" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesChatsImageMessage, { 21538 src: content, 21539 width, 21540 height 21541 }), 21542 type === "audio" && content && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesChatsAudioMessage, { 21543 url: content, 21544 duration 21545 }), 21546 type === "trip" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesChatsTripCardMessage, { trip }), 21547 (status === "sending" || status === "failed") && /* @__P
21547URE__ */ (0, import_jsx_runtime.jsx)(MessagesChatsDescriptionMessage, { 21548 status, 21549 onResend: id ? () => resendMessage(id, sessionId) : void 0 21550 }) 21551 ] 21552 }, id); 21553 }); 21554 if (showSender) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 21555 className: "flex flex-col gap-1 py-3", 21556 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 21557 className: "flex items-end gap-1.5", 21558 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppAvatar, { 21559 className: "size-8 shrink-0", 21560 url: groupByUserTime.user?.avatar?.url, 21561 name: groupByUserTime.user?.name 21562 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 21563 className: "flex min-w-0 flex-1 flex-col gap-1", 21564 children: bubbles 21565 })] 21566 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesChatsDescriptionMessage, { 21567 className: "pl-10", 21568 date: lastMessage_0?.createdAt, 21569 name: groupByUserTime.user?.name 21570 })] 21571 }, groupByUserTime.id); 21572 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 21573 className: "flex flex-col gap-1 py-3", 21574 children: [bubbles, hasBubble && !lastIsPending && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesChatsDescriptionMessage, { 21575 className: isOwn ? "self-end" : "self-start", 21576 date: lastMessage_0?.createdAt 21577 })] 21578 }, groupByUserTime.id); 21579 })] 21580 }, groupByDate.id); 21581 $[24] = isGroup; 21582 $[25] = resendMessage; 21583 $[26] = sessionId; 21584 $[27] = t13$1; 21585 } else t13$1 = $[27]; 21586 t12 = groupMessagesByDate(messages).map(t13$1); 21587 $[19] = isGroup; 21588 $[20] = messages; 21589 $[21] = resendMessage; 21590 $[22] = sessionId; 21591 $[23] = t12; 21592 } else t12 = $[23]; 21593 let t13; 21594 if ($[28] !== t11 || $[29] !== t12) { 21595 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 21596 className: "flex flex-col gap-6 px-5 py-5", 21597 children: [t11, t12] 21598 }); 21599 $[28] = t11; 21600 $[29] = t12; 21601 $[30] = t13; 21602 } else t13 = $[30]; 21603 let t14; 21604 if ($[31] !== onScroll || $[32] !== t13) { 21605 t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 21606 ref: scrollRef, 21607 onScroll, 21608 className: "h-full overflow-auto", 21609 children: t13 21610 }); 21611 $[31] = onScroll; 21612 $[32] = t13; 21613 $[33] = t14; 21614 } else t14 = $[33]; 21615 let t15; 21616 if ($[34] !== showScrollToBottom) { 21617 t15 = showScrollToBottom && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 21618 size: "icon", 21619 "aria-label": "Scroll to bottom", 21620 onClick: handleScrollToBottom, 21621 className: "absolute right-6 bottom-6 z-10 size-10 animate-in rounded-full shadow-md fade-in zoom-in", 21622 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronsDown, { className: "size-5" }) 21623 }); 21624 $[34] = showScrollToBottom; 21625 $[35] = t15; 21626 } else t15 = $[35]; 21627 let t16; 21628 if ($[36] !== t14 || $[37] !== t15) { 21629 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 21630 className: "relative flex-1 overflow-hidden", 21631 children: [t14, t15] 21632 }); 21633 $[36] = t14; 21634 $[37] = t15; 21635 $[38] = t16; 21636 } else t16 = $[38]; 21637 return t16; 21638}; 21639var messages_chats_list_default = MessagesChatsList; 21640function _temp$12(message) { 21641 return message.type !== "system"; 21642} 21643var import_compiler_runtime$55 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 21644const MessagesChatsMediaInput = (t0) => { 21645 const $ = (0, import_compiler_runtime$55.c)(42); 21646 let restProps; 21647 let t1; 21648 let t2; 21649 let t3; 21650 let t4; 21651 if ($[0] !== t0) { 21652 ({accept: t1, multiple: t2, maxFiles: t3, maxSize: t4, ...restProps} = t0); 21653 $[0] = t0; 21654 $[1] = restProps; 21655 $[2] = t1; 21656 $[3] = t2; 21657 $[4] = t3; 21658 $[5] = t4; 21659 } else { 21660 restProps = $[1]; 21661 t1 = $[2]; 21662 t2 = $[3]; 21663 t3 = $[4]; 21664 t4 = $[5]; 21665 } 21666 let t5; 21667 if ($[6] !== t1) { 21668 t5 = t1 === void 0 ? { "image/*": [] } : t1; 21669 $[6] = t1; 21670 $[7] = t5; 21671 } else t5 = $[7]; 21672 const accept = t5; 21673 const multiple = t2 === void 0 ? false : t2; 21674 const maxFiles = t3 === void 0 ? 1 : t3; 21675 let t6; 21676 if ($[8] !== t4) { 21677 t6 = t4 === void 0 ? _bytes("30MB") : t4; 21678 $[8] = t4; 21679 $[9] = t6; 21680 } else t6 = $[9]; 21681 const maxSize = t6; 21682 const { sendMessage } = useMessagesContext(); 21683 const [isTooltipOpen, setIsTooltipOpen] = (0, import_react.useState)(false); 21684 const suppressOpenRef = (0, import_react.useRef)(false); 21685 let t7; 21686 if ($[10] === Symbol.for("react.memo_cache_sentinel")) { 21687 t7 = (nextOpen) => { 21688 if (nextOpen && suppressOpenRef.current) { 21689 suppressOpenRef.current = false;
21690 return; 21691 } 21692 setIsTooltipOpen(nextOpen); 21693 }; 21694 $[10] = t7; 21695 } else t7 = $[10]; 21696 const onTooltipOpenChange = t7; 21697 let t8; 21698 if ($[11] !== sendMessage) { 21699 t8 = (acceptedFiles) => { 21700 acceptedFiles.forEach((file) => { 21701 sendMessage({ 21702 type: "image", 21703 image: file 21704 }); 21705 }); 21706 }; 21707 $[11] = sendMessage; 21708 $[12] = t8; 21709 } else t8 = $[12]; 21710 const onDropAccepted = t8; 21711 let t9; 21712 if ($[13] !== maxSize) { 21713 t9 = (fileRejections) => { 21714 const codes = new Set(fileRejections.flatMap(_temp2$8)); 21715 if (codes.has("file-invalid-type")) { 21716 toast.error("Unsupported format. Only BMP, PNG, and JPG images are allowed."); 21717 return; 21718 } 21719 if (codes.has("file-too-large") && maxSize) { 21720 const maxSizeMb = Math.round(maxSize / 1024 / 1024); 21721 toast.error(`File is too large. Maximum size is ${maxSizeMb}MB.`); 21722 return; 21723 } 21724 toast.error("Couldn't upload this image. Please try a different one."); 21725 }; 21726 $[13] = maxSize; 21727 $[14] = t9; 21728 } else t9 = $[14]; 21729 const onDropRejected = t9; 21730 let t10; 21731 if ($[15] !== accept || $[16] !== maxFiles || $[17] !== maxSize || $[18] !== multiple || $[19] !== onDropAccepted || $[20] !== onDropRejected || $[21] !== restProps) { 21732 t10 = { 21733 accept, 21734 multiple, 21735 maxFiles, 21736 maxSize, 21737 onDropAccepted, 21738 onDropRejected, 21739 ...restProps 21740 }; 21741 $[15] = accept; 21742 $[16] = maxFiles; 21743 $[17] = maxSize; 21744 $[18] = multiple; 21745 $[19] = onDropAccepted; 21746 $[20] = onDropRejected; 21747 $[21] = restProps; 21748 $[22] = t10; 21749 } else t10 = $[22]; 21750 const { getRootProps, getInputProps, open } = useDropzone(t10); 21751 let t11; 21752 if ($[23] !== getRootProps) { 21753 t11 = getRootProps(); 21754 $[23] = getRootProps; 21755 $[24] = t11; 21756 } else t11 = $[24]; 21757 let t12; 21758 if ($[25] !== getInputProps) { 21759 t12 = getInputProps(); 21760 $[25] = getInputProps; 21761 $[26] = t12; 21762 } else t12 = $[26]; 21763 let t13; 21764 if ($[27] !== t12) { 21765 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { ...t12 }); 21766 $[27] = t12; 21767 $[28] = t13; 21768 } else t13 = $[28]; 21769 let t14; 21770 if ($[29] !== open) { 21771 t14 = (e$4) => { 21772 e$4.stopPropagation(); 21773 suppressOpenRef.current = true; 21774 open(); 21775 }; 21776 $[29] = open; 21777 $[30] = t14; 21778 } else t14 = $[30]; 21779 let t15; 21780 if ($[31] === Symbol.for("react.memo_cache_sentinel")) { 21781 t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Image, { className: "size-5 text-muted-foreground group-hover:text-primary" }); 21782 $[31] = t15; 21783 } else t15 = $[31]; 21784 let t16; 21785 if ($[32] !== t14) { 21786 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 21787 asChild: true, 21788 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 21789 variant: "ghost", 21790 size: "icon", 21791 "aria-label": "Upload image", 21792 className: "group hover:bg-transparent active:bg-transparent", 21793 onClick: t14, 21794 type: "button", 21795 children: t15 21796 }) 21797 }); 21798 $[32] = t14; 21799 $[33] = t16; 21800 } else t16 = $[33]; 21801 let t17; 21802 if ($[34] === Symbol.for("react.memo_cache_sentinel")) { 21803 t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: "BMP, PNG, JPG up to 30MB each" }); 21804 $[34] = t17; 21805 } else t17 = $[34]; 21806 let t18; 21807 if ($[35] !== isTooltipOpen || $[36] !== t16) { 21808 t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { 21809 open: isTooltipOpen, 21810 onOpenChange: onTooltipOpenChange, 21811 children: [t16, t17] 21812 }); 21813 $[35] = isTooltipOpen; 21814 $[36] = t16; 21815 $[37] = t18; 21816 } else t18 = $[37]; 21817 let t19; 21818 if ($[38] !== t11 || $[39] !== t13 || $[40] !== t18) { 21819 t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 21820 ...t11, 21821 children: [t13, t18] 21822 }); 21823 $[38] = t11; 21824 $[39] = t13; 21825 $[40] = t18; 21826 $[41] = t19; 21827 } else t19 = $[41]; 21828 return t19; 21829}; 21830function _temp$11(error) { 21831 return error.code; 21832} 21833function _temp2$8(t0) { 21834 const { errors } = t0; 21835 return errors.map(_temp$11); 21836} 21837var import_compiler_runtime$54 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 21838function CircularProgress(t0) { 21839 const $ = (0, import_compiler_runtime$54.c)(21); 21840 const { value: t1, size: t2, strokeWidth: t3, color: t4, className, children } = t0; 21841 const value = t1 === void 0 ? 0 : t1; 21842 const size = t2 === void 0 ? 100 : t2; 21843 const strokeWidth = t3 === void 0 ? 4 : t3; 21844 const color = t4 === void 0 ? "var(--primary)" : t4; 21845 const radius = size / 2 - strokeWidth / 2; 21846 const circumference = 2 * Math.PI * radius;
21847 const percentToPx = circumference / 100; 21848 let t5; 21849 if ($[0] !== className) { 21850 t5 = cn("relative size-11 text-2xl font-semibold", className); 21851 $[0] = className; 21852 $[1] = t5; 21853 } else t5 = $[1]; 21854 const t6 = `${percentToPx}px`; 21855 let t7; 21856 if ($[2] !== circumference || $[3] !== t6) { 21857 t7 = { 21858 "--circle-size": "100px", 21859 "--circumference": circumference, 21860 "--percent-to-px": t6, 21861 "--gap-percent": "5", 21862 "--offset-factor": "0", 21863 "--transition-length": "1s", 21864 "--transition-step": "200ms", 21865 "--delay": "0s", 21866 "--percent-to-deg": "3.6deg", 21867 transform: "translateZ(0)" 21868 }; 21869 $[2] = circumference; 21870 $[3] = t6; 21871 $[4] = t7; 21872 } else t7 = $[4]; 21873 const t8 = t7; 21874 let t9; 21875 if ($[5] !== color || $[6] !== value) { 21876 t9 = { 21877 stroke: color, 21878 "--stroke-percent": value, 21879 strokeDasharray: "calc(var(--stroke-percent) * var(--percent-to-px)) var(--circumference)", 21880 transition: "var(--transition-length) ease var(--delay),stroke var(--transition-length) ease var(--delay)", 21881 transitionProperty: "stroke-dasharray,transform", 21882 transform: "rotate(calc(-90deg + var(--gap-percent) * var(--offset-factor) * var(--percent-to-deg)))", 21883 transformOrigin: "calc(var(--circle-size) / 2) calc(var(--circle-size) / 2)" 21884 }; 21885 $[5] = color; 21886 $[6] = value; 21887 $[7] = t9; 21888 } else t9 = $[7]; 21889 const t10 = t9; 21890 let t11; 21891 if ($[8] !== color || $[9] !== radius || $[10] !== strokeWidth || $[11] !== t10) { 21892 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { 21893 fill: "none", 21894 className: "absolute size-full", 21895 strokeWidth: "4", 21896 viewBox: "0 0 100 100", 21897 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { 21898 cx: "50", 21899 cy: "50", 21900 r: radius, 21901 strokeWidth, 21902 strokeDashoffset: "0", 21903 strokeLinecap: "round", 21904 strokeLinejoin: "round", 21905 className: "opacity-100", 21906 stroke: color, 21907 style: t10 21908 }) 21909 }); 21910 $[8] = color; 21911 $[9] = radius; 21912 $[10] = strokeWidth; 21913 $[11] = t10; 21914 $[12] = t11; 21915 } else t11 = $[12]; 21916 const t12 = children ? children : value; 21917 let t13; 21918 if ($[13] !== t12 || $[14] !== value) { 21919 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 21920 "data-current-value": value, 21921 className: "absolute inset-0 m-auto size-fit animate-in delay-(--delay) duration-(--transition-length) ease-linear fade-in", 21922 children: t12 21923 }); 21924 $[13] = t12; 21925 $[14] = value; 21926 $[15] = t13; 21927 } else t13 = $[15]; 21928 let t14; 21929 if ($[16] !== t11 || $[17] !== t13 || $[18] !== t5 || $[19] !== t8) { 21930 t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 21931 className: t5, 21932 style: t8, 21933 children: [t11, t13] 21934 }); 21935 $[16] = t11; 21936 $[17] = t13; 21937 $[18] = t5; 21938 $[19] = t8; 21939 $[20] = t14; 21940 } else t14 = $[20]; 21941 return t14; 21942} 21943var import_compiler_runtime$53 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 21944var useMediaRecorder = (t0) => { 21945 const $ = (0, import_compiler_runtime$53.c)(12); 21946 let t1; 21947 if ($[0] !== t0) { 21948 t1 = t0 === void 0 ? {} : t0; 21949 $[0] = t0; 21950 $[1] = t1; 21951 } else t1 = $[1]; 21952 const { mimeType: t2 } = t1; 21953 const mimeType = t2 === void 0 ? "audio/webm" : t2; 21954 const [recording, setRecording] = (0, import_react.useState)(false); 21955 const [blob, setBlob] = (0, import_react.useState)(null); 21956 const [error, setError] = (0, import_react.useState)(null); 21957 const mediaRecorderRef = (0, import_react.useRef)(null); 21958 let t3; 21959 if ($[2] === Symbol.for("react.memo_cache_sentinel")) { 21960 t3 = []; 21961 $[2] = t3; 21962 } else t3 = $[2]; 21963 const audioChunksRef = (0, import_react.useRef)(t3); 21964 const streamRef = (0, import_react.useRef)(null); 21965 let t4; 21966 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 21967 t4 = []; 21968 $[3] = t4; 21969 } else t4 = $[3]; 21970 const streamsRef = (0, import_react.useRef)(t4); 21971 let t5; 21972 if ($[4] !== mimeType) { 21973 t5 = async () => { 21974 try { 21975 if (streamRef.current) return; 21976 const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); 21977 streamRef.current = stream; 21978 streamsRef.current.push(stream); 21979 const recorder = new MediaRecorder(stream); 21980 mediaRecorderRef.current = recorder; 21981 recorder.ondataavailable = (event) => { 21982 if (event.data.size > 0) audioChunksRef.current.push(event.data); 21983 }; 21984 recorder.onstop = () => { 21985 const recordedBlob = new Blob(audioChunksRef.current, { type: mimeType }); 21986 setBlob(recordedBlob); 21987 audioChunksRef.current = [];
21988 streamRef.current?.getTracks().forEach(_temp$10); 21989 streamsRef.current.forEach(_temp3$2); 21990 streamRef.current = null; 21991 }; 21992 recorder.start(); 21993 setRecording(true); 21994 } catch (t6$1) { 21995 const err = t6$1; 21996 const message = err instanceof Error ? err.message : "Failed to start recording"; 21997 setError(message); 21998 } 21999 }; 22000 $[4] = mimeType; 22001 $[5] = t5; 22002 } else t5 = $[5]; 22003 const start = t5; 22004 let t6; 22005 if ($[6] === Symbol.for("react.memo_cache_sentinel")) { 22006 t6 = () => { 22007 if (mediaRecorderRef.current && mediaRecorderRef.current.state !== "inactive") { 22008 mediaRecorderRef.current.stop(); 22009 setRecording(false); 22010 } 22011 }; 22012 $[6] = t6; 22013 } else t6 = $[6]; 22014 const stop = t6; 22015 let t7; 22016 if ($[7] !== blob || $[8] !== error || $[9] !== recording || $[10] !== start) { 22017 t7 = { 22018 recording, 22019 blob, 22020 error, 22021 start, 22022 stop 22023 }; 22024 $[7] = blob; 22025 $[8] = error; 22026 $[9] = recording; 22027 $[10] = start; 22028 $[11] = t7; 22029 } else t7 = $[11]; 22030 return t7; 22031}; 22032function _temp$10(track$1) { 22033 return track$1.stop(); 22034} 22035function _temp2$7(track_0) { 22036 return track_0.stop(); 22037} 22038function _temp3$2(stream_0) { 22039 stream_0.getTracks().forEach(_temp2$7); 22040} 22041var MAX_RECORDING_DURATION = 300 * 1e3; 22042var MAX_PROGRESS = 100; 22043var MessagesChatsAudioRecording = ({ onCancel }) => { 22044 const { sendMessage } = useMessagesContext(); 22045 const { start, stop, blob, recording } = useMediaRecorder({ mimeType: "audio/webm" }); 22046 const sendOnStopRef = (0, import_react.useRef)(false); 22047 const [countdown] = useCountDown_default({ 22048 leftTime: recording ? MAX_RECORDING_DURATION : void 0, 22049 onEnd: stop 22050 }); 22051 const [hasStarted, setHasStarted] = (0, import_react.useState)(false); 22052 (0, import_react.useEffect)(() => { 22053 if (recording) setHasStarted(true); 22054 }, [recording]); 22055 const elapsed = hasStarted ? MAX_RECORDING_DURATION - countdown : 0; 22056 const progress = Math.min(elapsed / MAX_RECORDING_DURATION * MAX_PROGRESS, MAX_PROGRESS); 22057 const time = formatMinutesSeconds(elapsed); 22058 (0, import_react.useEffect)(() => { 22059 start(); 22060 return () => { 22061 stop(); 22062 }; 22063 }, []); 22064 (0, import_react.useEffect)(() => { 22065 if (blob && sendOnStopRef.current) { 22066 sendMessage({ 22067 type: "audio", 22068 audio: blob 22069 }); 22070 onCancel(); 22071 } 22072 }, [blob]); 22073 const handleSend = () => { 22074 trackMethodCall("handleSend", []); 22075 if (recording) { 22076 sendOnStopRef.current = true; 22077 stop(); 22078 return; 22079 } 22080 if (blob) { 22081 sendMessage({ 22082 type: "audio", 22083 audio: blob 22084 }); 22085 onCancel(); 22086 } 22087 }; 22088 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 22089 className: "flex h-30 items-center justify-between border-t border-border p-4 fade-in fade-out", 22090 children: [ 22091 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 22092 variant: "ghost", 22093 className: "text-primary", 22094 "aria-label": "Cancel", 22095 onClick: onCancel, 22096 children: "Cancel" 22097 }), 22098 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircularProgress, { 22099 value: progress, 22100 color: "var(--primary)", 22101 className: "size-11", 22102 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 22103 size: "icon", 22104 className: "size-10 rounded-full bg-blue-100 hover:bg-blue-200", 22105 "aria-label": "Send voice message", 22106 onClick: handleSend, 22107 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(send_messages_default, { className: "size-5 text-primary" }) 22108 }) 22109 }), 22110 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Badge, { 22111 variant: "destructive", 22112 className: "w-18 rounded-full", 22113 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(audio_recording_default, {}), time] 22114 }) 22115 ] 22116 }); 22117}; 22118var messages_chats_audio_recording_default = MessagesChatsAudioRecording; 22119var import_compiler_runtime$52 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 22120var MAX_MESSAGE_LENGTH = 300; 22121var MEDIA_ACCEPT = { 22122 "image/bmp": [".bmp"], 22123 "image/png": [".png"], 22124 "image/jpeg": [".jpg", ".jpeg"] 22125}; 22126var MEDIA_MAX_SIZE = 30 * 1024 * 1024; 22127var MessagesChatsInput = () => { 22128 const $ = (0, import_compiler_runtime$52.c)(44); 22129 const { isSupported, checkPermission } = useAudioRecorder(); 22130 const [isRecording, setIsRecording] = (0, import_react.useState)(false); 22131 const [text$1, setText] = (0, import_react.useState)(""); 22132 const { sendMessage }
22132 = useMessagesContext(); 22133 let t0; 22134 if ($[0] !== checkPermission || $[1] !== isSupported) { 22135 t0 = async () => { 22136 trackMethodCall("handleStartRecording", []); 22137 if (!isSupported) { 22138 toast.error(MICROPHONE_ERROR_MESSAGE.unsupported); 22139 return; 22140 } 22141 const status = await checkPermission(); 22142 if (status === "granted") { 22143 setIsRecording(true); 22144 return; 22145 } 22146 toast.error(MICROPHONE_ERROR_MESSAGE[status]); 22147 }; 22148 $[0] = checkPermission; 22149 $[1] = isSupported; 22150 $[2] = t0; 22151 } else t0 = $[2]; 22152 const handleStartRecording = t0; 22153 let t1; 22154 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 22155 t1 = (e$4) => { 22156 setText(e$4.target.value.slice(0, MAX_MESSAGE_LENGTH)); 22157 }; 22158 $[3] = t1; 22159 } else t1 = $[3]; 22160 const onChange = t1; 22161 let t2; 22162 if ($[4] !== sendMessage || $[5] !== text$1) { 22163 t2 = () => { 22164 if (!text$1.trim()) return; 22165 sendMessage({ 22166 type: "text", 22167 text: text$1.trim() 22168 }); 22169 setText(""); 22170 }; 22171 $[4] = sendMessage; 22172 $[5] = text$1; 22173 $[6] = t2; 22174 } else t2 = $[6]; 22175 const onSend = t2; 22176 let t3; 22177 if ($[7] !== onSend) { 22178 t3 = (e_0) => { 22179 if (e_0.key === "Enter" && !e_0.shiftKey) { 22180 e_0.preventDefault(); 22181 onSend(); 22182 } 22183 }; 22184 $[7] = onSend; 22185 $[8] = t3; 22186 } else t3 = $[8]; 22187 const onKeyDown = t3; 22188 const t4 = isRecording ? "hidden" : "visible"; 22189 let t5; 22190 if ($[9] !== onKeyDown || $[10] !== text$1) { 22191 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Textarea, { 22192 id: "send-message", 22193 placeholder: "Send a Text Message", 22194 value: text$1, 22195 onChange, 22196 onKeyDown, 22197 maxLength: MAX_MESSAGE_LENGTH, 22198 rows: 1, 22199 className: "algin-center max-h-10 min-h-0 flex-1 resize-none overflow-y-auto border-none bg-transparent p-0 text-sm shadow-none focus-visible:border-transparent focus-visible:ring-0" 22200 }); 22201 $[9] = onKeyDown; 22202 $[10] = text$1; 22203 $[11] = t5; 22204 } else t5 = $[11]; 22205 let t6; 22206 if ($[12] !== text$1) { 22207 t6 = text$1.trim(); 22208 $[12] = text$1; 22209 $[13] = t6; 22210 } else t6 = $[13]; 22211 const t7 = !t6; 22212 let t8; 22213 if ($[14] === Symbol.for("react.memo_cache_sentinel")) { 22214 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 22215 name: "send-messages", 22216 className: "size-5" 22217 }); 22218 $[14] = t8; 22219 } else t8 = $[14]; 22220 let t9; 22221 if ($[15] !== onSend || $[16] !== t7) { 22222 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 22223 variant: "ghost", 22224 size: "icon", 22225 className: "size-6 shrink-0 text-primary disabled:text-neutral-600 disabled:opacity-100", 22226 "aria-label": "Send", 22227 onClick: onSend, 22228 disabled: t7, 22229 children: t8 22230 }); 22231 $[15] = onSend; 22232 $[16] = t7; 22233 $[17] = t9; 22234 } else t9 = $[17]; 22235 let t10; 22236 if ($[18] !== t5 || $[19] !== t9) { 22237 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 22238 className: "flex items-start gap-6", 22239 children: [t5, t9] 22240 }); 22241 $[18] = t5; 22242 $[19] = t9; 22243 $[20] = t10; 22244 } else t10 = $[20]; 22245 let t11; 22246 if ($[21] !== text$1.length) { 22247 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 22248 className: "mt-1 text-xs text-muted-foreground", 22249 children: [ 22250 text$1.length, 22251 " / ", 22252 MAX_MESSAGE_LENGTH 22253 ] 22254 }); 22255 $[21] = text$1.length; 22256 $[22] = t11; 22257 } else t11 = $[22]; 22258 let t12; 22259 if ($[23] !== t10 || $[24] !== t11) { 22260 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 22261 className: "px-5 py-3", 22262 children: [t10, t11] 22263 }); 22264 $[23] = t10; 22265 $[24] = t11; 22266 $[25] = t12; 22267 } else t12 = $[25]; 22268 let t13; 22269 if ($[26] === Symbol.for("react.memo_cache_sentinel")) { 22270 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesChatsMediaInput, { 22271 accept: MEDIA_ACCEPT, 22272 maxSize: MEDIA_MAX_SIZE 22273 }); 22274 $[26] = t13; 22275 } else t13 = $[26]; 22276 let t14; 22277 if ($[27] === Symbol.for("react.memo_cache_sentinel")) { 22278 t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Mic, { className: "size-5 text-muted-foreground group-hover:text-primary" }); 22279 $[27] = t14; 22280 } else t14 = $[27]; 22281 let t15; 22282 if ($[28] !== handleStartRecording) { 22283 t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 22284 asChild: true, 22285 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 22286 variant: "ghost", 22287 size: "icon", 22288 "aria-label": "Send a Voice Message", 22289 className: "group hover:bg-transparent active:bg-transparent", 22290 onClick: handleStartRecording, 22291 children: t14 22292 }) 22293 }); 22294 $[28] = handleStartRecording; 22295 $[29] = t15; 22296 } else t15 = $[29]; 22297 let t16; 22298 if ($[30] === Symbol.for("react.memo_cache_sentinel")) { 22299 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: "Send a Voice Message" }); 22300 $[30] = t16; 22301 } else t16 = $[30]; 22302 let t17; 22303 if ($[31] !== t15) { 22304 t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 22305 className: "flex items-center px-5 py-3",
22306 children: [t13, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [t15, t16] })] 22307 }); 22308 $[31] = t15; 22309 $[32] = t17; 22310 } else t17 = $[32]; 22311 let t18; 22312 if ($[33] !== t12 || $[34] !== t17) { 22313 t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 22314 className: "relative z-1 w-[380px] shrink-0 border-t border-border bg-white", 22315 children: [t12, t17] 22316 }); 22317 $[33] = t12; 22318 $[34] = t17; 22319 $[35] = t18; 22320 } else t18 = $[35]; 22321 let t19; 22322 if ($[36] !== t18 || $[37] !== t4) { 22323 t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Activity, { 22324 mode: t4, 22325 children: t18 22326 }); 22327 $[36] = t18; 22328 $[37] = t4; 22329 $[38] = t19; 22330 } else t19 = $[38]; 22331 let t20; 22332 if ($[39] !== isRecording) { 22333 t20 = isRecording && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_chats_audio_recording_default, { onCancel: () => setIsRecording(false) }); 22334 $[39] = isRecording; 22335 $[40] = t20; 22336 } else t20 = $[40]; 22337 let t21; 22338 if ($[41] !== t19 || $[42] !== t20) { 22339 t21 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [t19, t20] }); 22340 $[41] = t19; 22341 $[42] = t20; 22342 $[43] = t21; 22343 } else t21 = $[43]; 22344 return t21; 22345}; 22346var messages_chats_input_default = MessagesChatsInput; 22347const MessagesDisbandGroupDialog = ({ open, onOpenChange, group, onConfirm }) => { 22348 const [deleteGroup, { isLoading }] = useDisbandGroupMutation(); 22349 const tid = group?.tid; 22350 const handleConfirmDisbandGroup = async () => { 22351 trackMethodCall("handleConfirmDisbandGroup", []); 22352 if (!tid) return; 22353 try { 22354 const result = await deleteGroup({ tid }).unwrap(); 22355 if (result.code === 200) { 22356 toast.success("Group has been disbanded"); 22357 onConfirm?.(); 22358 } else toast.error(result.message || "Failed to disband group"); 22359 } catch { 22360 toast.error("Failed to disband group"); 22361 } 22362 }; 22363 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialog, { 22364 open, 22365 onOpenChange, 22366 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogContent, { 22367 className: "max-w-[512px]", 22368 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogHeader, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogTitle, { children: "Disband Group" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogDescription, { children: "Are you sure you want to disband this group? Once disbanded, all members will be removed and you can't read history anymore" })] }
22368), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogFooter, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogCancel, { children: "Cancel" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 22369 variant: "destructive", 22370 onClick: handleConfirmDisbandGroup, 22371 disabled: !group?.tid, 22372 loading: isLoading, 22373 children: "Disband" 22374 })] })] 22375 }) 22376 }); 22377}; 22378var import_compiler_runtime$51 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 22379var import_cropper = /* @__PURE__ */ __toESM(require_cropper()); 22380var DEFAULT_ZOOM_MIN = -1; 22381var DEFAULT_ZOOM_MAX = 1; 22382var DEFAULT_ZOOM_STEP = .02; 22383var ImageCropper = (0, import_react.forwardRef)((props, ref) => { 22384 const $ = (0, import_compiler_runtime$51.c)(42); 22385 const { src, aspectRatio, onReady, className, showZoomControls: t0, zoomMin: t1, zoomMax: t2, zoomStep: t3, cropperOptions } = props; 22386 const showZoomControls = t0 === void 0 ? true : t0; 22387 const zoomMin = t1 === void 0 ? DEFAULT_ZOOM_MIN : t1; 22388 const zoomMax = t2 === void 0 ? DEFAULT_ZOOM_MAX : t2; 22389 const zoomStep = t3 === void 0 ? DEFAULT_ZOOM_STEP : t3; 22390 const imageRef = (0, import_react.useRef)(null); 22391 const cropperRef = (0, import_react.useRef)(null); 22392 const [zoomValue, setZoomValue] = (0, import_react.useState)(0); 22393 let t4; 22394 if ($[0] !== aspectRatio || $[1] !== cropperOptions || $[2] !== onReady) { 22395 t4 = () => { 22396 if (!imageRef.current) return; 22397 if (cropperRef.current) { 22398 cropperRef.current.destroy(); 22399 cropperRef.current = null; 22400 } 22401 const cropper = new import_cropper.default(imageRef.current, { 22402 aspectRatio: aspectRatio ?? NaN, 22403 viewMode: 0, 22404 dragMode: "move", 22405 autoCropArea: .8, 22406 restore: false, 22407 guides: true, 22408 center: true, 22409 highlight: true, 22410 cropBoxMovable: true, 22411 cropBoxResizable: true, 22412 toggleDragModeOnDblclick: false, 22413 ...cropperOptions, 22414 ready: (event) => { 22415 cropperOptions?.ready?.call(cropper, event); 22416 onReady?.(); 22417 } 22418 }); 22419 cropperRef.current = cropper; 22420 setZoomValue(0); 22421 }; 22422 $[0] = aspectRatio; 22423 $[1] = cropperOptions; 22424 $[2] = onReady; 22425 $[3] = t4; 22426 } else t4 = $[3]; 22427 const initCropper = t4; 22428 let t5; 22429 if ($[4] !== initCropper) { 22430 t5 = () => { 22431 if (cropperRef.current) return; 22432 initCropper(); 22433 }; 22434 $[4] = initCropper; 22435 $[5] = t5; 22436 } else t5 = $[5]; 22437 const handleImageLoad = t5; 22438 let t6; 22439 let t7; 22440 if ($[6] === Symbol.for("react.memo_cache_sentinel")) { 22441 t6 = () => () => { 22442 if (cropperRef.current) { 22443 cropperRef.current.destroy(); 22444 cropperRef.current = null; 22445 } 22446 }; 22447 t7 = []; 22448 $[6] = t6; 22449 $[7] = t7; 22450 } else { 22451 t6 = $[6]; 22452 t7 = $[7]; 22453 } 22454 (0, import_react.useEffect)(t6, t7); 22455 let t8; 22456 let t9; 22457 if ($[8] !== src) { 22458 t8 = () => { 22459 if (cropperRef.current && src) { 22460 cropperRef.current.replace(src); 22461 setZoomValue(0); 22462 } 22463 }; 22464 t9 = [src]; 22465 $[8] = src; 22466 $[9] = t8; 22467 $[10] = t9; 22468 } else { 22469 t8 = $[9]; 22470 t9 = $[10]; 22471 } 22472 (0, import_react.useEffect)(t8, t9); 22473 let t10; 22474 if ($[11] === Symbol.for("react.memo_cache_sentinel")) { 22475 t10 = () => ({ 22476 getCroppedCanvas: (options) => { 22477 const cropper_0 = cropperRef.current; 22478 if (!cropper_0) return null; 22479 return cropper_0.getCroppedCanvas({ 22480 imageSmoothingEnabled: true, 22481 imageSmoothingQuality: "high", 22482 ...options 22483 }); 22484 }, 22485 getCroppedBlob: async (t11$1, t12$1) => { 22486 const type = t11$1 === void 0 ? "image/png" : t11$1; 22487 const quality = t12$1 === void 0 ? 1 : t12$1; 22488 const cropper_1 = cropperRef.current; 22489 if (!cropper_1) return null; 22490 const canvas = cropper_1.getCroppedCanvas({ 22491 imageSmoothingEnabled: true, 22492 imageSmoothingQuality: "high" 22493 }); 22494 return new Promise((resolve) => { 22495 canvas.toBlob((blob) => { 22496 resolve(blob); 22497 }, type, quality); 22498 }); 22499 }, 22500 getCropper: () => cropperRef.current, 22501 reset: () => { 22502 cropperRef.current?.reset(); 22503 setZoomValue(0); 22504 } 22505 }); 22506 $[11] = t10; 22507 } else t10 = $[11]; 22508 (0, import_react.useImperativeHandle)(ref, t10); 22509 let t11; 22510 if ($[12] !== zoomMax || $[13] !== zoomStep || $[14] !== zoomValue) { 22511 t11 = () => { 22512 if (zoomValue >= zoomMax) return; 22513 setZoomValue((prev) => Math.min(zoomMax, +(prev + zoomStep).toFixed(2))); 22514 cropperRef.current?.zoom(zoomStep); 22515 }; 22516 $[12] = zoomMax; 22517 $[13] = zoomStep; 22518 $[14] = zoomValue; 22519 $[15] = t11; 22520 } else t11 = $[15]; 22521 const handleZoomIn = t11; 22522 let t12; 22523 if ($[16] !== zoomMin || $[17] !== zoomStep || $[18] !== zoomValue) { 22524 t12 = () => { 22525 if (zoomValue <= zoomMin) return; 22526 setZoomValue((prev_0) => Math.max(zoomMin, +(prev_0 - zoomStep).toFixed(2))); 22527 cropperRef.current?.zoom(-zoomStep); 22528 }; 22529 $[16] = zoomMin; 22530 $[17] = zoomStep; 22531 $[18] = zoomValue; 22532 $[19] = t12; 22533 } else t12 = $[19]; 22534 const handleZoomOut = t12; 22535 let t13; 22536 if ($[20] !== zoomValue) { 22537 t13 = (values) => { 22538 const next = values[0]; 22539 const diff = next - zoomValue; 22540 setZoomValue(next); 22541 cropperRef.current?.zoom(diff); 22542 }; 22543 $[20] = zoomValue; 22544 $[21] = t13; 22545 } else t13 = $[21]; 22546 const handleSliderChange = t13; 22547 let t14; 22548 if ($[22] !== className) { 22549 t14 = cn("flex h-full flex-col", className); 22550 $[22] = className; 22551 $[23] = t14; 22552 } else t14 = $[23]; 22553 let t15; 22554 if ($[24] !== handleImageLoad || $[25] !== src) {
22555 t15 = src && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { 22556 ref: imageRef, 22557 src, 22558 alt: "Crop", 22559 className: "block max-w-full", 22560 onLoad: handleImageLoad 22561 }); 22562 $[24] = handleImageLoad; 22563 $[25] = src; 22564 $[26] = t15; 22565 } else t15 = $[26]; 22566 let t16; 22567 if ($[27] !== t15) { 22568 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 22569 className: "overflow-hidden bg-black", 22570 children: t15 22571 }); 22572 $[27] = t15; 22573 $[28] = t16; 22574 } else t16 = $[28]; 22575 let t17; 22576 if ($[29] !== handleSliderChange || $[30] !== handleZoomIn || $[31] !== handleZoomOut || $[32] !== showZoomControls || $[33] !== zoomMax || $[34] !== zoomMin || $[35] !== zoomStep || $[36] !== zoomValue) { 22577 t17 = showZoomControls && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 22578 className: "flex items-center gap-4 border-t px-24 py-6", 22579 children: [ 22580 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Minus, { 22581 className: "h-6 w-6 cursor-pointer rounded-sm border", 22582 onClick: handleZoomOut 22583 }), 22584 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slider, { 22585 className: "flex-1", 22586 min: zoomMin, 22587 max: zoomMax, 22588 step: zoomStep, 22589 value: [zoomValue], 22590 onValueChange: handleSliderChange 22591 }),
22592 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Plus, { 22593 className: "h-6 w-6 cursor-pointer rounded-sm border", 22594 onClick: handleZoomIn 22595 }) 22596 ] 22597 }); 22598 $[29] = handleSliderChange; 22599 $[30] = handleZoomIn; 22600 $[31] = handleZoomOut; 22601 $[32] = showZoomControls; 22602 $[33] = zoomMax; 22603 $[34] = zoomMin; 22604 $[35] = zoomStep; 22605 $[36] = zoomValue; 22606 $[37] = t17; 22607 } else t17 = $[37]; 22608 let t18; 22609 if ($[38] !== t14 || $[39] !== t16 || $[40] !== t17) { 22610 t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 22611 className: t14, 22612 children: [t16, t17] 22613 }); 22614 $[38] = t14; 22615 $[39] = t16; 22616 $[40] = t17; 22617 $[41] = t18; 22618 } else t18 = $[41]; 22619 return t18; 22620}); 22621ImageCropper.displayName = "ImageCropper"; 22622var import_compiler_runtime$50 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 22623var ImageCropperDialog = (props) => { 22624 const $ = (0, import_compiler_runtime$50.c)(36); 22625 const { open, onOpenChange, imageSrc, aspectRatio, title: t0, description, cancelText: t1, confirmText: t2, loading: t3, onConfirm, onCancel, cropperOptions } = props; 22626 const title = t0 === void 0 ? "Title" : t0; 22627 const cancelText = t1 === void 0 ? "Cancel" : t1; 22628 const confirmText = t2 === void 0 ? "Save" : t2; 22629 const loading = t3 === void 0 ? false : t3; 22630 const cropperRef = (0, import_react.useRef)(null); 22631 const [isReady, setIsReady] = (0, import_react.useState)(false); 22632 let t4; 22633 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 22634 t4 = () => { 22635 setIsReady(true); 22636 }; 22637 $[0] = t4; 22638 } else t4 = $[0]; 22639 const handleReady = t4; 22640 let t5; 22641 if ($[1] !== onCancel || $[2] !== onOpenChange) { 22642 t5 = (nextOpen) => { 22643 if (!nextOpen) { 22644 setIsReady(false); 22645 onCancel?.(); 22646 } 22647 onOpenChange(nextOpen); 22648 }; 22649 $[1] = onCancel; 22650 $[2] = onOpenChange; 22651 $[3] = t5; 22652 } else t5 = $[3]; 22653 const handleOpenChange = t5; 22654 let t6; 22655 if ($[4] !== onConfirm) { 22656 t6 = async () => { 22657 const cropper = cropperRef.current; 22658 if (!cropper || !onConfirm) return; 22659 const blob = await cropper.getCroppedBlob(); 22660 if (blob) await onConfirm(blob); 22661 }; 22662 $[4] = onConfirm; 22663 $[5] = t6; 22664 } else t6 = $[5]; 22665 const handleConfirm = t6; 22666 let t7; 22667 if ($[6] !== title) { 22668 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, { children: title }); 22669 $[6] = title; 22670 $[7] = t7; 22671 } else t7 = $[7]; 22672 let t8; 22673 if ($[8] !== description) {
22674 t8 = description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogDescription, { children: description }); 22675 $[8] = description; 22676 $[9] = t8; 22677 } else t8 = $[9]; 22678 let t9; 22679 if ($[10] !== t7 || $[11] !== t8) { 22680 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogHeader, { children: [t7, t8] }); 22681 $[10] = t7; 22682 $[11] = t8; 22683 $[12] = t9; 22684 } else t9 = $[12]; 22685 let t10; 22686 if ($[13] !== aspectRatio || $[14] !== cropperOptions || $[15] !== imageSrc) { 22687 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogInner, { 22688 className: "max-h-[500px] border-none py-0", 22689 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ImageCropper, { 22690 ref: cropperRef, 22691 src: imageSrc, 22692 aspectRatio, 22693 onReady: handleReady, 22694 cropperOptions 22695 }) 22696 }); 22697 $[13] = aspectRatio; 22698 $[14] = cropperOptions; 22699 $[15] = imageSrc; 22700 $[16] = t10; 22701 } else t10 = $[16]; 22702 let t11; 22703 if ($[17] !== cancelText || $[18] !== loading) { 22704 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogClose, { 22705 asChild: true, 22706 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 22707 variant: "outline", 22708 disabled: loading, 22709 children: cancelText 22710 }) 22711 }); 22712 $[17] = cancelText; 22713 $[18] = loading; 22714 $[19] = t11; 22715 } else t11 = $[19]; 22716 const t12 = !isReady; 22717 let t13; 22718 if ($[20] !== confirmText || $[21] !== handleConfirm || $[22] !== loading || $[23] !== t12) { 22719 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 22720 className: "w-[150px]", 22721 onClick: handleConfirm, 22722 loading, 22723 disabled: t12, 22724 children: confirmText 22725 }); 22726 $[20] = confirmText; 22727 $[21] = handleConfirm; 22728 $[22] = loading; 22729 $[23] = t12; 22730 $[24] = t13; 22731 } else t13 = $[24]; 22732 let t14; 22733 if ($[25] !== t11 || $[26] !== t13) { 22734 t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogFooter, { children: [t11, t13] }); 22735 $[25] = t11; 22736 $[26] = t13; 22737 $[27] = t14; 22738 } else t14 = $[27]; 22739 let t15; 22740 if ($[28] !== t10 || $[29] !== t14 || $[30] !== t9) { 22741 t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, { children: [ 22742 t9, 22743 t10, 22744 t14 22745 ] }); 22746 $[28] = t10; 22747 $[29] = t14; 22748 $[30] = t9; 22749 $[31] = t15; 22750 } else t15 = $[31]; 22751 let t16; 22752 if ($[32] !== handleOpenChange || $[33] !== open || $[34] !== t15) { 22753 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, { 22754 open, 22755 onOpenChange: handleOpenChange, 22756 children: t15 22757 }); 22758 $[32] = handleOpenChange; 22759 $[33] = open; 22760 $[34] = t15; 22761 $[35] = t16; 22762 } else t16 = $[35]; 22763 return t16; 22764}; 22765var import_compiler_runtime$49 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 22766function useObjectUrl(value) { 22767 const $ = (0, import_compiler_runtime$49.c)(3); 22768 const [url, setUrl] = (0, import_react.useState)(void 0); 22769 let t0; 22770 let t1; 22771 if ($[0] !== value) { 22772 t0 = () => { 22773 if (!value) { 22774 setUrl(void 0); 22775 return; 22776 } 22777 if (typeof value === "string") { 22778 setUrl(value); 22779 return; 22780 } 22781 const objectUrl = URL.createObjectURL(value); 22782 setUrl(objectUrl); 22783 return () => { 22784 URL.revokeObjectURL(objectUrl); 22785 }; 22786 }; 22787 t1 = [value]; 22788 $[0] = value; 22789 $[1] = t0; 22790 $[2] = t1; 22791 } else { 22792 t0 = $[1]; 22793 t1 = $[2]; 22794 } 22795 (0, import_react.useEffect)(t0, t1); 22796 return url; 22797} 22798const readFileAsJson = (file) => { 22799 return new Promise((resolve, reject) => { 22800 const reader = new FileReader(); 22801 reader.onload = (event) => { 22802 try { 22803 const content = event.target?.result; 22804 resolve(JSON.parse(content)); 22805 } catch (error) { 22806 reject(new Error(error instanceof Error ? error.message : "Invalid JSON file")); 22807 } 22808 }; 22809 reader.onerror = () => reject(/* @__PURE__ */ new Error("Failed to read file")); 22810 reader.readAsText(file); 22811 }); 22812}; 22813const downloadBlob = (blob, fileName) => { 22814 const url = window.URL.createObjectURL(blob); 22815 const link = document.createElement("a"); 22816 link.href = url; 22817 link.setAttribute("download", fileName); 22818 document.body.appendChild(link); 22819 link.click(); 22820 link.remove(); 22821 window.URL.revokeObjectURL(url); 22822}; 22823const blobToFile = (blob, fileName) => { 22824 return new File([blob], fileName, { 22825 type: blob.type, 22826 lastModified: (/* @__PURE__ */ new Date()).getTime() 22827 }); 22828}; 22829const downloadFileForExport = (fileName, data) => { 22830 const body = document.querySelector("body"); 22831 if (!body) return; 22832 const link = document.createElement("a"); 22833 link.download = fileName; 22834 link.href = window.URL.createObjectURL(data); 22835 link.style.display = "none"; 22836 body.appendChild(link); 22837 link.click(); 22838 body.removeChild(link); 22839 window.URL.revokeObjectURL(link.href); 22840}; 22841var SvgImageUpload = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { 22842 width: 50, 22843 height: 50, 22844 viewBox: "0 0 50 50", 22845 fill: "none", 22846 xmlns: "http://www.w3.org/2000/svg", 22847 ...props, 22848 children: [
22849 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 22850 d: "M33.9999 27.3091L26.8339 20.5781L23.9139 23.4981L33.4329 33.0171C33.8005 32.4076 33.9965 31.7099 33.9999 30.9981V27.3091Z", 22851 fill: "#E6E7EB" 22852 }), 22853 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 22854 d: "M23 15C23.5523 15 24 14.5523 24 14C24 13.4477 23.5523 13 23 13C22.4477 13 22 13.4477 22 14C22 14.5523 22.4477 15 23 15Z", 22855 fill: "#E6E7EB" 22856 }), 22857 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 22858 d: "M10 5.5H30C30.9283 5.5 31.8182 5.86901 32.4746 6.52539C33.131 7.18177 33.5 8.07174 33.5 9V23.4102L27.8389 18.0938C27.5549 17.8271 27.1786 17.6815 26.7891 17.6875C26.3993 17.6937 26.0265 17.8512 25.751 18.127L22.499 21.3779L18.0508 16.9297L17.9395 16.835C17.672 16.6266 17.3418 16.5117 17 16.5117C16.6582 16.5117 16.328 16.6266 16.0605 16.835L15.9492 16.9297L6.5 26.3789V9C6.5 8.07174 6.86901 7.18177 7.52539 6.52539C8.18177 5.86901 9.07174 5.5 10 5.5ZM23 10.5C22.0717 10.5 21.1818 10.869 20.5254 11.5254C19.869 12.1818 19.5 13.0717 19.5 14C19.5 14.6922 19.7053 15.3688 20.0898 15.9443C20.4743 16.5198 21.0208 16.9685 21.6602 17.2334C22.2996 17.4983 23.0037 17.5676 23.6826 17.4326C24.3616 17.2976 24.9851 16.9641 25.4746 16.4746C25.9641 15.9851 26.2976 15.3616 26.4326 14.6826C26.5676 14.0037 26.4983 13.2996 26.2334 12.6602C25.9685 12.0208 25.5198 11.4743 24.9443 11.0898C24.3688 10.7053 23.6922 10.5 23 10.5Z", 22859 fill: "#E6E7EB", 22860 stroke: "#E6E7EB" 22861 }), 22862 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 22863 d: "M31.167 34.2881C30.7937 34.425 30.398 34.498 29.9971 34.5H10C9.07174 34.5 8.18177 34.131 7.52539 33.4746C6.86903 32.8182 6.5 31.9282 6.5 31V30.6211L17 20.1211L31.167 34.2881Z", 22864 fill: "#E6E7EB", 22865 stroke: "#E6E7EB" 22866 }), 22867 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ellipse", { 22868 cx: 32, 22869 cy: 32.5, 22870 rx: 6, 22871 ry: 5.5, 22872 fill: "white" 22873 }), 22874 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { 22875 fillRule: "evenodd", 22876 clipRule: "evenodd", 22877 d: "M42 33C42 27.4772 37.5228 23 32 23C26.4772 23 22 27.4772 22 33C22 38.5228 26.4772 43 32 43C37.5228 43 42 38.5228 42 33ZM28.2929 31.2929C27.9024 31.6834 27.9024 32.3166 28.2929 32.7071C28.6834 33.0976 29.3166 33.0976 29.7071 32.7071L31 31.4142V37C31 37.5523 31.4477 38 32 38C32.5523 38 33 37.5523 33 37V31.4142L34.2929 32.7071C34.6834 33.0976 35.3166 33.0976 35.7071 32.7071C36.0976 32.3166 36.0976 31.6834 35.7071 31.2929L32.7071 28.2929C32.3166 27.9024 31.6834 27.9024 31.2929 28.2929L28.2929 31.2929Z", 22878 fill: "#4066D4" 22879 }) 22880 ] 22881}); 22882var image_upload_default = SvgImageUpload; 22883var import_compiler_runtime$48 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 22884var dropzoneVariants = T({ 22885 base: "relative flex cursor-pointer flex-col items-center justify-center overflow-hidden", 22886 variants: { 22887 variant: { 22888 default: "h-[150px] rounded-md p-4 border border-border transition-colors", 22889 ghost: "", 22890 compact: "" 22891 }, 22892 hasPreview: { 22893 true: "", 22894 false: "" 22895 }, 22896 isDragActive: { 22897 true: "", 22898 false: "" 22899 }, 22900 disabled: { 22901 true: "", 22902 false: "" 22903 } 22904 }, 22905 compoundVariants: [ 22906 { 22907 variant: "default", 22908 hasPreview: true, 22909 class: "border-solid bg-white" 22910 }, 22911 { 22912 variant: "default", 22913 hasPreview: false, 22914 class: "border-dashed bg-neutral-50/50" 22915 }, 22916 { 22917 variant: "default", 22918 isDragActive: true, 22919 class: "border-primary bg-primary/5" 22920 }, 22921 { 22922 variant: "default", 22923 disabled: true, 22924 class: "cursor-not-allowed opacity-60" 22925 } 22926 ] 22927}); 22928var DEFAULT_MAX_SIZE = 5 * 1024 * 1024; 22929var DEFAULT_ACCEPT = { "image/*": [ 22930 ".png", 22931 ".jpg", 22932 ".jpeg", 22933 ".webp" 22934] }; 22935var DEFAULT_IMAGE_NAME = "image.png"; 22936var DefaultEmptyContent = () => { 22937 const $ = (0, import_compiler_runtime$48.c)(1); 22938 let t0; 22939 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 22940 t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 22941 className: "flex flex-1 flex-col items-center justify-center gap-2", 22942 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(image_upload_default, { className: "size-[50px]" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 22943 className: "text-center text-sm leading-5 font-medium text-black", 22944 children: "Upload your image" 22945 })] 22946 }); 22947 $[0] = t0; 22948 } else t0 = $[0]; 22949 return t0; 22950}; 22951var ImageUpload = ({ variant = "default", value, onChange, aspectRatio, crop = true, showEditAction = false, disabled = false, loading = false, className, imageClassName, maxSize = DEFAULT_MAX_SIZE, accept = DEFAULT_ACCEPT, onCropOpenChange, onDropRejected, emptyContent = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DefaultEmptyContent, {}),...dropzoneProps }) => { 22952 const [originalFile, setOriginalFile] = (0, import_react.useState)(null); 22953 const [cropFile, setCropFile] = (0, import_react.useState)(null); 22954 const [isCropOpen, setIsCropOpen] = (0, import_react.useState)(false); 22955 const previewUrl = useObjectUrl(value); 22956 const cropFileUrl = useObjectUrl(cropFile); 22957 (0, import_react.useEffect)(() => { 22958 if (value === null) setOriginalFile(null); 22959 }, [value]); 22960 const onDrop = (acceptedFiles) => { 22961 const file = acceptedFiles[0]; 22962 if (!file) return; 22963 setOriginalFile(file); 22964 if (crop) { 22965 setCropFile(file); 22966 setIsCropOpen(true); 22967 onCropOpenChange?.(true); 22968 } else onChange?.(file); 22969 }; 22970 const { getRootProps, getInputProps, isDragActive } = useDropzone({ 22971 onDrop, 22972 accept, 22973 maxFiles: 1, 22974 maxSize, 22975 disabled, 22976 multiple: false, 22977 ...dropzoneProps, 22978 onDropRejected: (fileRejections) => { 22979 if (onDropRejected) { 22980 onDropRejected(fileRejections); 22981 return; 22982 } 22983 const error = fileRejections[0]?.errors[0]; 22984 if (error) toast.error(error.message); 22985 } 22986 }); 22987 const dropzoneClassName = dropzoneVariants({ 22988 variant, 22989 hasPreview: !!value, 22990 isDragActive, 22991 disabled 22992 }); 22993 const handleCropConfirm = async (blob) => { 22994 const fileName = cropFile?.name || originalFile?.name || DEFAULT_IMAGE_NAME; 22995 const newFile = blobToFile(blob, fileName); 22996 onChange?.(newFile); 22997 setIsCropOpen(false); 22998 onCropOpenChange?.(false); 22999 setCropFile(null); 23000 }; 23001 const handleCropCancel = () => { 23002 setIsCropOpen(false); 23003 onCropOpenChange?.(false); 23004 setCropFile(null); 23005 }; 23006 const handleRemove = (e$4) => { 23007 e$4.stopPropagation(); 23008 onChange?.(null); 23009 setOriginalFile(null); 23010 };
23011 const handleManualCropClick = (e_0) => { 23012 e_0.stopPropagation(); 23013 if (originalFile) { 23014 setCropFile(originalFile); 23015 setIsCropOpen(true); 23016 onCropOpenChange?.(true); 23017 } 23018 }; 23019 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23020 "data-slot": "image-upload", 23021 className, 23022 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23023 ...getRootProps(), 23024 "data-slot": "image-upload-dropzone", 23025 className: dropzoneClassName, 23026 children: [ 23027 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { 23028 "data-slot": "image-upload-input", 23029 ...getInputProps() 23030 }), 23031 variant === "default" && (previewUrl ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23032 "data-slot": "image-upload-preview", 23033 className: "size-full overflow-hidden object-contain", 23034 children: [!disabled && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23035 className: "absolute top-3 right-3 z-10 flex gap-1", 23036 children: [showEditAction && originalFile && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 23037 type: "button", 23038 variant: "ghost", 23039 size: "icon", 23040 onClick: handleManualCropClick, 23041 className: "size-8 bg-white/50 hover:bg-white", 23042 title: "Crop Image", 23043 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Crop, { className: "size-4" }) 23044 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 23045 type: "button", 23046 variant: "ghost", 23047 size: "icon", 23048 onClick: handleRemove, 23049 className: "size-8 bg-white/50 text-destructive hover:bg-white hover:text-destructive", 23050 title: "Remove Image", 23051 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2, { className: "size-4" }) 23052 })] 23053 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { 23054 src: previewUrl, 23055 alt: "Preview", 23056 className: cn("h-full w-full object-contain", imageClassName) 23057 })] 23058 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 23059 "data-slot": "image-upload-empty", 23060 className: "flex size-full flex-1 flex-col", 23061 children: emptyContent 23062 })), 23063 variant === "ghost" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23064 "data-slot": "image-upload-ghost", 23065 className: "flex items-center justify-start gap-2", 23066 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Avatar, { 23067 className: "size-8", 23068 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarImage, { 23069 src: previewUrl || "", 23070 alt: "Preview" 23071 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarFallback, { 23072 className: "bg-input text-sm text-foreground", 23073 children: "G" 23074 })] 23075 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 23076 variant: "link", 23077 className: "h-9 px-2 text-primary", 23078 type: "button", 23079 loading, 23080 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Upload, { className: "size-4" }), "Upload Photo"] 23081 })] 23082 }) 23083 ] 23084 }), crop && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ImageCropperDialog, { 23085 open: isCropOpen, 23086 onOpenChange: (val) => !val && handleCropCancel(), 23087 imageSrc: cropFileUrl || "", 23088 aspectRatio, 23089 onConfirm: handleCropConfirm, 23090 onCancel: handleCropCancel, 23091 title: "Crop Image", 23092 confirmText: "Apply" 23093 })] 23094 }); 23095}; 23096const GROUP_LOGO_MAX_SIZE = 1024 * 1024; 23097const GROUP_LOGO_ACCEPT = { 23098 "image/jpeg": [".jpg", ".jpeg"], 23099 "image/png": [".png"] 23100}; 23101const getGroupLogoRejectionMessage = (fileRejections) => { 23102 if (new Set(fileRejections.flatMap(({ errors }) => { 23103 return errors.map((error) => { 23104 return error.code; 23105 }); 23106 })).has("file-too-large")) return "Failed to upload, The maximum size of the image is 1MB"; 23107 return "Failed to upload, only JPEG, JPG and PNG images are allowed"; 23108}; 23109const MessagesGroupsEditDialog = ({ open, onOpenChange, group, onConfirm }) => { 23110 const [editGroup, { isLoading: isEditingGroup }] = useEditMessageGroupMutation(); 23111 const [uploadImage$1, { isLoading: isUploadingLogo }] = useUploadImageMutation(); 23112 const [name, setName] = (0, import_react.useState)(group?.name ?? ""); 23113 const [logo, setLogo] = (0, import_react.useState)(null); 23114 const [logoUrl, setLogoUrl] = (0, import_react.useState)(null); 23115 const tid = group?.tid; 23116 const groupAvatar = group?.avatar?.url; 23117 (0, import_react.useEffect)(() => { 23118 if (open) { 23119 setName(group?.name ?? ""); 23120 setLogo(null); 23121 setLogoUrl(null); 23122 } 23123 }, [open, group?.name]); 23124 const onChangeLogo = async (file) => { 23125 setLogo(file); 23126 if (!file) { 23127 setLogoUrl(null); 23128 return; 23129 } 23130 try { 23131 const url = (await uploadImage$1({ image: file }).unwrap()).data?.url; 23132 setLogoUrl(url ?? null); 23133 } catch { 23134 toast.error("Failed to upload image"); 23135 setLogoUrl(null); 23136 } 23137 }; 23138 const handleConfirmEditGroup = async () => { 23139 trackMethodCall("handleConfirmEditGroup", []); 23140 if (!tid) return; 23141 try { 23142 const result_0 = await editGroup({ 23143 tid, 23144 name: name.trim() || "", 23145 avatar: logoUrl ?? groupAvatar ?? void 0 23146 }).unwrap(); 23147 if (result_0.code === 200) { 23148 toast.success("Update successful"); 23149 onConfirm?.(); 23150 onOpenChange(false); 23151 } else toast.error(result_0.message || "Update failed"); 23152 } catch { 23153 toast.error("Update failed"); 23154 } 23155 }; 23156 const handleCancelEditGroup = () => { 23157 trackMethodCall("handleCancelEditGroup", []); 23158 setName(group?.name ?? ""); 23159 setLogo(null); 23160 setLogoUrl(null); 23161 onOpenChange(false); 23162 }; 23163 const disabled = isEditingGroup || isUploadingLogo || !tid || !name.trim(); 23164 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, { 23165 open, 23166 onOpenChange, 23167 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, { 23168 className: "max-w-[450px]", 23169 children: [
23170 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, { children: "Edit Profile" }) }), 23171 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogInner, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23172 className: "flex flex-col gap-5", 23173 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23174 className: "flex flex-col gap-2", 23175 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, { 23176 className: "text-sm font-medium", 23177 children: "Change group photo" 23178 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ImageUpload, { 23179 variant: "ghost", 23180 className: "w-fit", 23181 value: logo ?? logoUrl ?? groupAvatar ?? null, 23182 onChange: onChangeLogo, 23183 loading: isUploadingLogo, 23184 aspectRatio: 1, 23185 maxSize: GROUP_LOGO_MAX_SIZE, 23186 accept: GROUP_LOGO_ACCEPT, 23187 onDropRejected: (fileRejections) => { 23188 return toast.warning(getGroupLogoRejectionMessage(fileRejections)); 23189 } 23190 })] 23191 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23192 className: "flex flex-col gap-2", 23193 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, { 23194 htmlFor: "group-name", 23195 className: "text-sm leading-none font-medium", 23196 children: "Group name" 23197 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input, { 23198 id: "group-name", 23199 value: name, 23200 maxLength: 30, 23201 onChange: (e$4) => { 23202 return setName(e$4.target.value); 23203 }, 23204 placeholder: "Set group name", 23205 className: "w-full" 23206 })] 23207 })] 23208 }) }),
23209 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogFooter, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 23210 variant: "outline", 23211 onClick: handleCancelEditGroup, 23212 children: "Cancel" 23213 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 23214 loading: isEditingGroup, 23215 onClick: handleConfirmEditGroup, 23216 disabled, 23217 children: "Confirm" 23218 })] }) 23219 ] 23220 }) 23221 }); 23222}; 23223const MessagesGroupsChatHeader = ({ group, onBack, onEditProfile, onManageMembers, onDisbandGroup, onLeaveGroup }) => { 23224 const userInfo = useUserInfoQueryState(); 23225 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 23226 className: "sticky top-0 z-3 h-16 shrink-0 border-b border-border bg-white", 23227 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23228 className: "relative flex items-center gap-2 px-4 py-3", 23229 children: [ 23230 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 23231 variant: "ghost", 23232 size: "icon", 23233 onClick: onBack, 23234 className: "size-5 shrink-0", 23235 "aria-label": "Back", 23236 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronLeft, { className: "size-5" }) 23237 }),
23238 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23239 className: "flex min-w-0 flex-1 items-center gap-2.5", 23240 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppAvatar, { 23241 className: "shrink-0", 23242 url: group?.avatar?.url, 23243 backgroundColor: group?.avatar?.backgroundColor, 23244 initials: "G" 23245 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23246 className: "flex min-w-0 flex-1 flex-col gap-0.5", 23247 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 23248 className: "truncate text-sm font-semibold text-foreground", 23249 children: group?.name 23250 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { 23251 className: "text-xs text-secondary-foreground", 23252 children: [group?.numberOfUsers, " members"] 23253 })] 23254 })] 23255 }), 23256 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenu, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownMenuTrigger, { 23257 asChild: true, 23258 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 23259 variant: "ghost", 23260 size: "icon-sm", 23261 className: "shrink-0 data-[state=open]:bg-accent", 23262 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EllipsisVertical, { className: "size-4" }) 23263 }) 23264 }), group?.masterTpId === userInfo?.userTpId ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenuContent, { 23265 align: "end", 23266 className: "w-[180px]", 23267 children: [ 23268 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenuItem, { 23269 onClick: onEditProfile, 23270 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PencilLine, { className: "mr-2 size-4 text-muted-foreground" }), "Rename"] 23271 }), 23272 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenuItem, { 23273 onClick: onManageMembers, 23274 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserCog, { className: "mr-2 size-4 text-muted-foreground" }), "Manage Members"] 23275 }), 23276 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenuItem, { 23277 variant: "destructive", 23278 onClick: onDisbandGroup, 23279 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2, { className: "mr-2 size-4" }), "Disband Group"] 23280 }) 23281 ] 23282 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownMenuContent, { 23283 align: "end", 23284 className: "w-[180px]", 23285 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenuItem, { 23286 onClick: onLeaveGroup, 23287 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LogOut, { className: "mr-2 size-4 text-muted-foreground" }), "Leave Group"] 23288 }) 23289 })] }) 23290 ] 23291 }) 23292 }); 23293}; 23294const MessagesLeaveGroupDialog = ({ open, onOpenChange, group, onConfirm }) => { 23295 const [quitGroup, { isLoading }] = useQuitGroupMutation(); 23296 const tid = group?.tid; 23297 const handleConfirmLeaveGroup = async () => { 23298 trackMethodCall("handleConfirmLeaveGroup", []); 23299 if (!tid) return; 23300 try { 23301 const result = await quitGroup({ tid }).unwrap(); 23302 if (result.code === 200) { 23303 toast.success("Group leave successfully"); 23304 onConfirm?.(); 23305 } else toast.error(result.message || "Failed to leave group"); 23306 } catch { 23307 toast.error("Failed to leave group"); 23308 } 23309 }; 23310 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialog, { 23311 open, 23312 onOpenChange, 23313 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogContent, { 23314 className: "max-w-[512px]", 23315 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogHeader, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogTitle, { children: "Leave Group" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogDescription, { children: "Are you sure you want to leave this group?" })] }
23315), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogFooter, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogCancel, { children: "Cancel" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 23316 variant: "destructive", 23317 onClick: handleConfirmLeaveGroup, 23318 disabled: !group?.tid, 23319 loading: isLoading, 23320 children: "Leave" 23321 })] })] 23322 }) 23323 }); 23324}; 23325var import_compiler_runtime$47 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 23326var MessagesGroupsChat = () => { 23327 const $ = (0, import_compiler_runtime$47.c)(39); 23328 const dispatch = useAppDispatch(); 23329 const group = useAppSelector(selectGroup); 23330 const sessionId = useAppSelector(selectSessionId); 23331 const messages = useAppSelector(selectMessagesChats); 23332 const [disbandGroupDialogOpen, setDisbandGroupDialogOpen] = (0, import_react.useState)(false); 23333 const [editProfileDialogOpen, setEditProfileDialogOpen] = (0, import_react.useState)(false); 23334 const [leaveGroupDialogOpen, setleaveGroupDialogOpen] = (0, import_react.useState)(false); 23335 let t0; 23336 if ($[0] !== dispatch) { 23337 t0 = () => { 23338 trackMethodCall("handleBack", []); 23339 dispatch(setView("default")); 23340 dispatch(setSessionId(void 0)); 23341 }; 23342 $[0] = dispatch; 23343 $[1] = t0; 23344 } else t0 = $[1]; 23345 const handleBack = t0; 23346 let t1; 23347 if ($[2] === Symbol.for("react.memo_cache_sentinel")) { 23348 t1 = () => { 23349 trackMethodCall("handleDisbandGroupClick", []); 23350 setDisbandGroupDialogOpen(true); 23351 }; 23352 $[2] = t1; 23353 } else t1 = $[2]; 23354 const handleDisbandGroupClick = t1; 23355 let t2; 23356 if ($[3] !== dispatch || $[4] !== group || $[5] !== sessionId) { 23357 t2 = () => { 23358 trackMethodCall("handleDisbandGroupConfirm", []); 23359 setDisbandGroupDialogOpen(false); 23360 if (group?.tid) dispatch(removeGroup(group.tid)); 23361 if (sessionId) dispatch(removeSession(sessionId)); 23362 dispatch(setView("default")); 23363 dispatch(setSessionId(void 0)); 23364 }; 23365 $[3] = dispatch; 23366 $[4] = group; 23367 $[5] = sessionId; 23368 $[6] = t2; 23369 } else t2 = $[6]; 23370 const handleDisbandGroupConfirm = t2; 23371 let t3; 23372 if ($[7] === Symbol.for("react.memo_cache_sentinel")) { 23373 t3 = () => { 23374 setEditProfileDialogOpen(true); 23375 }; 23376 $[7] = t3; 23377 } else t3 = $[7]; 23378 const onEditProfile = t3; 23379 let t4; 23380 if ($[8] !== dispatch) { 23381 t4 = () => { 23382 dispatch(setView("group-members")); 23383 }; 23384 $[8] = dispatch; 23385 $[9] = t4; 23386 } else t4 = $[9]; 23387 const onManageMembers = t4; 23388 let t5; 23389 if ($[10] === Symbol.for("react.memo_cache_sentinel")) { 23390 t5 = () => { 23391 trackMethodCall("handleLeaveGroupClick", []); 23392 setleaveGroupDialogOpen(true); 23393 }; 23394 $[10] = t5; 23395 } else t5 = $[10]; 23396 const handleLeaveGroupClick = t5; 23397 let t6; 23398 if ($[11] !== dispatch || $[12] !== group || $[13] !== sessionId) { 23399 t6 = () => { 23400 trackMethodCall("handleLeaveGroupConfirm", []); 23401 setleaveGroupDialogOpen(false); 23402 if (group?.tid) dispatch(removeGroup(group.tid)); 23403 if (sessionId) dispatch(removeSession(sessionId)); 23404 dispatch(setView("default")); 23405 dispatch(setSessionId(void 0)); 23406 }; 23407 $[11] = dispatch; 23408 $[12] = group; 23409 $[13] = sessionId; 23410 $[14] = t6; 23411 } else t6 = $[14]; 23412 const handleLeaveGroupConfirm = t6; 23413 let t7; 23414 if ($[15] !== group || $[16] !== handleBack || $[17] !== onManageMembers) { 23415 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesGroupsChatHeader, { 23416 group, 23417 onBack: handleBack, 23418 onEditProfile, 23419 onManageMembers, 23420 onDisbandGroup: handleDisbandGroupClick, 23421 onLeaveGroup: handleLeaveGroupClick 23422 }); 23423 $[15] = group; 23424 $[16] = handleBack; 23425 $[17] = onManageMembers; 23426 $[18] = t7; 23427 } else t7 = $[18]; 23428 let t8; 23429 if ($[19] !== messages) { 23430 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_chats_list_default, { messages }); 23431 $[19] = messages; 23432 $[20] = t8; 23433 } else t8 = $[20]; 23434 let t9; 23435 if ($[21] === Symbol.for("react.memo_cache_sentinel")) { 23436 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_chats_input_default, {}); 23437 $[21] = t9; 23438 } else t9 = $[21]; 23439 let t10; 23440 if ($[22] !== disbandGroupDialogOpen || $[23] !== group || $[24] !== handleDisbandGroupConfirm) { 23441 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesDisbandGroupDialog, { 23442 open: disbandGroupDialogOpen, 23443 onOpenChange: setDisbandGroupDialogOpen, 23444 group, 23445 onConfirm: handleDisbandGroupConfirm 23446 }); 23447 $[22] = disbandGroupDialogOpen; 23448 $[23] = group; 23449 $[24] = handleDisbandGroupConfirm; 23450 $[25] = t10; 23451 } else t10 = $[25]; 23452 let t11; 23453 if ($[26] !== editProfileDialogOpen || $[27] !== group) { 23454 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesGroupsEditDialog, { 23455 open: editProfileDialogOpen, 23456 onOpenChange: setEditProfileDialogOpen, 23457 group 23458 }); 23459 $[26] = editProfileDialogOpen; 23460 $[27] = group; 23461 $[28] = t11; 23462 } else t11 = $[28]; 23463 let t12; 23464 if ($[29] !== group || $[30] !== handleLeaveGroupConfirm || $[31] !== leaveGroupDialogOpen) { 23465 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesLeaveGroupDialog, { 23466 open: leaveGroupDialogOpen, 23467 onOpenChange: setleaveGroupDialogOpen, 23468 group, 23469 onConfirm: handleLeaveGroupConfirm 23470 }); 23471 $[29] = group; 23472 $[30] = handleLeaveGroupConfirm; 23473 $[31] = leaveGroupDialogOpen; 23474 $[32] = t12; 23475 } else t12 = $[32]; 23476 let t13; 23477 if ($[33] !== t10 || $[34] !== t11 || $[35] !== t12 || $[36] !== t7 || $[37] !== t8) { 23478 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23479 className: "flex h-full flex-col border-t border-border", 23480 children: [ 23481 t7, 23482 t8, 23483 t9, 23484 t10, 23485 t11, 23486 t12 23487 ] 23488 }); 23489 $[33] = t10; 23490 $[34] = t11; 23491 $[35] = t12; 23492 $[36] = t7; 23493 $[37] = t8; 23494 $[38] = t13; 23495 } else t13 = $[38]; 23496 return t13; 23497}; 23498var messages_groups_chat_default = MessagesGroupsChat; 23499var import_compiler_runtime$46 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 23500var getContactStatusBadge = (workStatus) => { 23501 switch (workStatus.trim().toLowerCase().replace(/[\s_-]+/g, "")) { 23502 case "intransit": return { 23503 label: "In Transit", 23504 variant: "success" 23505 }; 23506 case "available": return { 23507 label: "Available", 23508 variant: "default" 23509 }; 23510 case "inactive": return { 23511 label: "Inactive", 23512 variant: "neutral-subtle", 23513 className: "bg-slate-200 text-gray-700" 23514 }; 23515 default: return { 23516 label: workStatus, 23517 variant: "neutral-subtle", 23518 className: "bg-slate-200 text-gray-700" 23519 }; 23520 } 23521}; 23522var MessagesP2pChatsHeader = (t0) => { 23523 const $ = (0, import_compiler_runtime$46.c)(51); 23524 const { contact } = t0; 23525 const dispatch = useAppDispatch(); 23526 let t1; 23527 if ($[0] !== dispatch) { 23528 t1 = () => { 23529 dispatch(setSessionId(void 0)); 23530 dispatch(setView("default")); 23531 }; 23532 $[0] = dispatch; 23533 $[1] = t1; 23534 } else t1 = $[1]; 23535 const onBack = t1; 23536 let t2; 23537 if ($[2] !== contact || $[3] !== dispatch) { 23538 t2 = async () => { 23539 if (!contact?.phone) { 23540 toast.error("No phone number available. This contact has no virtual phone assigned."); 23541 return; 23542 } 23543 await dispatch(setView("default")); 23544 openDialerNumpad(dispatch, { 23545 phone: contact.phone, 23546 role: contact.role === "Operator" ? "carrier" : "driver", 23547 personId: contact.clientUserId, 23548 source: "Messaging" 23549 }); 23550 }; 23551 $[2] = contact; 23552 $[3] = dispatch; 23553 $[4] = t2; 23554 } else t2 = $[4]; 23555 const onCall = t2; 23556 const t3 = contact?.role; 23557 const t4 = contact?.company; 23558 let t5; 23559 if ($[5] !== t3 || $[6] !== t4) {
23560 t5 = [t3, t4].filter(Boolean); 23561 $[5] = t3; 23562 $[6] = t4; 23563 $[7] = t5; 23564 } else t5 = $[7]; 23565 const displayInfo = t5.join(" · "); 23566 let t6; 23567 if ($[8] !== contact) { 23568 t6 = contact?.role === "Driver" && contact.status ? getContactStatusBadge(contact.status) : void 0; 23569 $[8] = contact; 23570 $[9] = t6; 23571 } else t6 = $[9]; 23572 const statusBadge = t6; 23573 let t7; 23574 if ($[10] === Symbol.for("react.memo_cache_sentinel")) { 23575 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronLeft, { className: "size-5" }); 23576 $[10] = t7; 23577 } else t7 = $[10]; 23578 let t8; 23579 if ($[11] !== onBack) { 23580 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 23581 variant: "ghost", 23582 size: "icon", 23583 onClick: onBack, 23584 className: "size-5 shrink-0", 23585 "aria-label": "Back", 23586 children: t7 23587 }); 23588 $[11] = onBack; 23589 $[12] = t8; 23590 } else t8 = $[12]; 23591 const t9 = contact?.avatar?.url; 23592 const t10 = contact?.name; 23593 let t11; 23594 if ($[13] !== t10 || $[14] !== t9) { 23595 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarImage, { 23596 src: t9, 23597 alt: t10 23598 }); 23599 $[13] = t10; 23600 $[14] = t9; 23601 $[15] = t11; 23602 } else t11 = $[15]; 23603 const t12 = contact?.avatar?.backgroundColor; 23604 let t13; 23605 if ($[16] !== t12) { 23606 t13 = cn("text-white", t12); 23607 $[16] = t12; 23608 $[17] = t13; 23609 } else t13 = $[17]; 23610 const t14 = contact?.avatar?.initials; 23611 let t15; 23612 if ($[18] !== t13 || $[19] !== t14) { 23613 t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AvatarFallback, { 23614 className: t13, 23615 children: t14 23616 }); 23617 $[18] = t13; 23618 $[19] = t14; 23619 $[20] = t15; 23620 } else t15 = $[20]; 23621 let t16; 23622 if ($[21] !== t11 || $[22] !== t15) { 23623 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Avatar, { 23624 className: "size-8 shrink-0", 23625 children: [t11, t15] 23626 }); 23627 $[21] = t11; 23628 $[22] = t15; 23629 $[23] = t16; 23630 } else t16 = $[23]; 23631 const t17 = contact?.name; 23632 let t18; 23633 if ($[24] !== t17) { 23634 t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 23635 className: "truncate text-sm font-semibold text-foreground", 23636 children: t17 23637 }); 23638 $[24] = t17; 23639 $[25] = t18; 23640 } else t18 = $[25]; 23641 let t19; 23642 if ($[26] !== statusBadge) { 23643 t19 = statusBadge && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 23644 variant: statusBadge.variant, 23645 size: "default", 23646 className: statusBadge.className, 23647 children: statusBadge.label 23648 }); 23649 $[26] = statusBadge; 23650 $[27] = t19; 23651 } else t19 = $[27]; 23652 let t20; 23653 if ($[28] !== t18 || $[29] !== t19) { 23654 t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23655 className: "flex items-center gap-1.5", 23656 children: [t18, t19] 23657 }); 23658 $[28] = t18; 23659 $[29] = t19; 23660 $[30] = t20; 23661 } else t20 = $[30]; 23662 let t21; 23663 if ($[31] !== displayInfo) {
23664 t21 = displayInfo && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 23665 className: "truncate text-xs text-secondary-foreground", 23666 children: displayInfo 23667 }); 23668 $[31] = displayInfo; 23669 $[32] = t21; 23670 } else t21 = $[32]; 23671 let t22; 23672 if ($[33] !== t20 || $[34] !== t21) { 23673 t22 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23674 className: "flex min-w-0 flex-1 flex-col gap-0.5", 23675 children: [t20, t21] 23676 }); 23677 $[33] = t20; 23678 $[34] = t21; 23679 $[35] = t22; 23680 } else t22 = $[35]; 23681 let t23; 23682 if ($[36] !== t16 || $[37] !== t22) { 23683 t23 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23684 className: "flex min-w-0 flex-1 items-center gap-2.5", 23685 children: [t16, t22] 23686 }); 23687 $[36] = t16; 23688 $[37] = t22; 23689 $[38] = t23; 23690 } else t23 = $[38]; 23691 let t24; 23692 if ($[39] !== t23 || $[40] !== t8) { 23693 t24 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23694 className: "flex min-w-0 flex-1 items-center gap-2", 23695 children: [t8, t23] 23696 }); 23697 $[39] = t23; 23698 $[40] = t8; 23699 $[41] = t24; 23700 } else t24 = $[41]; 23701 let t25; 23702 if ($[42] === Symbol.for("react.memo_cache_sentinel")) { 23703 t25 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Phone, { className: "size-4" }); 23704 $[42] = t25; 23705 } else t25 = $[42]; 23706 let t26; 23707 if ($[43] !== onCall) { 23708 t26 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 23709 asChild: true, 23710 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 23711 variant: "ghost", 23712 size: "icon-sm", 23713 onClick: onCall, 23714 className: "size-6 shrink-0", 23715 "aria-label": "Make a phone call", 23716 children: t25 23717 }) 23718 }); 23719 $[43] = onCall; 23720 $[44] = t26; 23721 } else t26 = $[44]; 23722 let t27; 23723 if ($[45] === Symbol.for("react.memo_cache_sentinel")) { 23724 t27 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: "Make a phone call" }); 23725 $[45] = t27; 23726 } else t27 = $[45]; 23727 let t28; 23728 if ($[46] !== t26) { 23729 t28 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [t26, t27] }); 23730 $[46] = t26; 23731 $[47] = t28; 23732 } else t28 = $[47]; 23733 let t29; 23734 if ($[48] !== t24 || $[49] !== t28) { 23735 t29 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23736 className: "sticky top-0 z-3 flex shrink-0 items-center gap-2 border-b border-border bg-white py-[15px] pr-5 pl-3.5", 23737 children: [t24, t28] 23738 }); 23739 $[48] = t24; 23740 $[49] = t28; 23741 $[50] = t29; 23742 } else t29 = $[50]; 23743 return t29; 23744}; 23745var messages_p2p_chats_header_default = MessagesP2pChatsHeader; 23746var import_compiler_runtime$45 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 23747var MessagesP2pChat = () => { 23748 const $ = (0, import_compiler_runtime$45.c)(8); 23749 const messages = useAppSelector(selectMessagesChats); 23750 const contact = useAppSelector(selectCurrentContact); 23751 let t0; 23752 if ($[0] !== contact) { 23753 t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_p2p_chats_header_default, { contact }); 23754 $[0] = contact; 23755 $[1] = t0; 23756 } else t0 = $[1]; 23757 let t1; 23758 if ($[2] !== messages) { 23759 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_chats_list_default, { messages }); 23760 $[2] = messages; 23761 $[3] = t1; 23762 } else t1 = $[3]; 23763 let t2; 23764 if ($[4] === Symbol.for("react.memo_cache_sentinel")) { 23765 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_chats_input_default, {}); 23766 $[4] = t2; 23767 } else t2 = $[4]; 23768 let t3; 23769 if ($[5] !== t0 || $[6] !== t1) { 23770 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23771 className: "flex h-full flex-col border-t border-border", 23772 children: [ 23773 t0, 23774 t1, 23775 t2 23776 ] 23777 }); 23778 $[5] = t0; 23779 $[6] = t1; 23780 $[7] = t3; 23781 } else t3 = $[7]; 23782 return t3; 23783}; 23784var messages_p2p_chat_default = MessagesP2pChat; 23785var MessagesCreateGroupDialog = ({ open = false, onOpenChange }) => { 23786 const userInfo = useUserInfoQueryState(); 23787 const contacts = useAppSelector(selectContacts); 23788 const [createGroup, { isLoading: isCreatingGroup }] = useCreateGroupMutation(); 23789 const [uploadImage$1, { isLoading: isUploadingLogo }] = useUploadImageMutation(); 23790 const [selectedContactIds, setSelectedContactIds] = (0, import_react.useState)(/* @__PURE__ */ new Set()); 23791 const [groupName, setGroupName] = (0, import_react.useState)(""); 23792 const [searchQuery, setSearchQuery] = (0, import_react.useState)(""); 23793 const [logo, setLogo] = (0, import_react.useState)(null); 23794 const [logoUrl, setLogoUrl] = (0, import_react.useState)(null); 23795 const selectedCount = selectedContactIds.size; 23796 const selectedContacts = contacts.filter((contact) => { 23797 return selectedContactIds.has(contact.id || ""); 23798 }); 23799 const filteredContacts = contacts.filter((contact_0) => { 23800 if (!searchQuery) return true; 23801 const query = searchQuery.toLowerCase(); 23802 return contact_0.name?.toLowerCase().includes(query) || contact_0.p
23802hone?.includes(query) || contact_0.company?.toLowerCase().includes(query); 23803 }); 23804 const disabled = isUploadingLogo || selectedCount === 0; 23805 const onToggleContact = (contactId, checked) => { 23806 setSelectedContactIds((prev) => { 23807 const next = new Set(prev); 23808 if (checked) next.add(contactId); 23809 else next.delete(contactId); 23810 return next; 23811 }); 23812 }; 23813 const onChangeLogo = async (file) => { 23814 setLogo(file); 23815 if (!file) return; 23816 try { 23817 const url = (await uploadImage$1({ image: file }).unwrap()).data?.url; 23818 setLogoUrl(url ?? null); 23819 } catch { 23820 toast.error("Failed to upload image"); 23821 setLogoUrl(null); 23822 } 23823 }; 23824 const onCreate = async () => { 23825 try { 23826 const ownName = combiningStrings([userInfo?.firstName, userInfo?.lastName], " ") || userInfo?.email; 23827 const joined = combiningStrings([ownName, ...selectedContacts.map((c$2) => { 23828 return c$2.name; 23829 })]); 23830 const autoName = joined.length <= 30 ? joined : `${joined.slice(0, 28)}...`; 23831 const data = { 23832 name: groupName || autoName || void 0, 23833 memberList: Array.from(selectedContactIds).map((id) => { 23834 return Number(id); 23835 }), 23836 avatar: logoUrl ?? void 0 23837 }; 23838 const result_0 = await createGroup(data).unwrap(); 23839 if (result_0.code === 200) { 23840 toast.success("Group created successfully"); 23841 setSelectedContactIds(/* @__PURE__ */ new Set()); 23842 setGroupName(""); 23843 setSearchQuery(""); 23844 setLogo(null); 23845 onOpenChange?.(false); 23846 } else toast.error(result_0.message || "Failed to create group"); 23847 } catch { 23848 toast.error("Failed to create group"); 23849 } 23850 }; 23851 const onCancel = () => { 23852 setSelectedContactIds(/* @__PURE__ */ new Set()); 23853 setGroupName(""); 23854 setSearchQuery(""); 23855 setLogo(null); 23856 onOpenChange?.(false); 23857 }; 23858 const handleOpenChange = (next_0) => { 23859 trackMethodCall("handleOpenChange", [next_0]); 23860 if (next_0) { 23861 onOpenChange?.(true); 23862 return; 23863 } 23864 onCancel(); 23865 }; 23866 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, { 23867 open, 23868 onOpenChange: handleOpenChange, 23869 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, { 23870 className: "flex h-[600px] w-fit max-w-[1000px] flex-row overflow-hidden p-0", 23871 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23872 className: "flex w-110 shrink-0 flex-col gap-3 border-r border-border p-5", 23873 children: [ 23874 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { 23875 className: "text-xl font-semibold", 23876 children: "Start Group Chat" 23877 }), 23878 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputSearch, { 23879 value: searchQuery, 23880 onChange: setSearchQuery, 23881 placeholder: "Search", 23882 className: "w-full" 23883 }), 23884 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(virtualized_list_default, { 23885 items: filteredContacts, 23886 renderItem: (contact_1) => { 23887 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_contacts_item_default, { 23888 contact: contact_1, 23889 hasCheckbox: true, 23890 checked: selectedContactIds.has(contact_1.id ?? ""), 23891 onCheckedChange: (checked_0) => { 23892 return onToggleContact(contact_1.id || "", checked_0); 23893 } 23894 }); 23895 }, 23896 estimatedItemHeight: 64, 23897 getItemKey: (contact_2) => { 23898 return contact_2.id ?? ""; 23899 } 23900 }) 23901 ] 23902 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23903 className: "flex w-110 min-w-0 flex-1 flex-col", 23904 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23905 className: "flex flex-1 flex-col gap-5 overflow-hidden p-5", 23906 children: [ 23907 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23908 className: "flex flex-col gap-2", 23909 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, { 23910 className: "text-sm font-medium", 23911 children: "Change group photo" 23912 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ImageUpload, { 23913 variant: "ghost", 23914 className: "w-fit", 23915 value: logo, 23916 onChange: onChangeLogo, 23917 loading: isUploadingLogo, 23918 aspectRatio: 1, 23919 maxSize: GROUP_LOGO_MAX_SIZE, 23920 accept: GROUP_LOGO_ACCEPT, 23921 onDropRejected: (fileRejections) => { 23922 return toast.warning(getGroupLogoRejectionMessage(fileRejections)); 23923 } 23924 })] 23925 }),
23926 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23927 className: "flex flex-col gap-2", 23928 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, { 23929 htmlFor: "group-name", 23930 className: "text-sm leading-none font-medium", 23931 children: "Group name" 23932 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input, { 23933 id: "group-name", 23934 placeholder: "Set group name (optional)", 23935 value: groupName, 23936 maxLength: 30, 23937 onChange: (e$4) => { 23938 return setGroupName(e$4.target.value); 23939 } 23940 })] 23941 }), 23942 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-px bg-border" }), 23943 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23944 className: "flex min-h-0 flex-1 flex-col gap-2", 23945 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23946 className: "flex items-center justify-between", 23947 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, { 23948 className: "text-sm font-medium text-foreground", 23949 children: "Members" 23950 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { 23951 className: "text-sm text-muted-foreground", 23952 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 23953 className: "font-bold", 23954 children: selectedCount 23955 }), " Members Selected"] 23956 })] 23957 }), selectedCount === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 23958 className: "flex flex-1 items-center justify-center", 23959 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Empty, { 23960 className: "border-0 p-0", 23961 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EmptyHeader, { 23962 className: "gap-6", 23963 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyMedia, { 23964 variant: "default", 23965 className: "size-25", 23966 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_contacts_empty_default$1, {}) 23967 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 23968 className: "flex flex-col gap-2", 23969 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyTitle, { 23970 className: "text-base leading-none font-medium", 23971 children: "No members selected" 23972 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyDescription, { 23973 className: "text-center text-sm leading-5", 23974 children: "Select contacts from the list to add members" 23975 })] 23976 })] 23977 }) 23978 }) 23979 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(virtualized_list_default, { 23980 items: selectedContacts, 23981 renderItem: (contact_3) => { 23982 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_contacts_item_default, { 23983 contact: contact_3, 23984 hasRemove: true, 23985 onRemove: () => { 23986 return onToggleContact(contact_3.id || "", false); 23987 } 23988 }); 23989 }, 23990 estimatedItemHeight: 64, 23991 getItemKey: (contact_4) => { 23992 return contact_4.id || ""; 23993 } 23994 })] 23995 }) 23996 ] 23997 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogFooter, { 23998 className: "border-t border-border p-5", 23999 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 24000 variant: "outline", 24001 onClick: onCancel, 24002 children: "Cancel" 24003 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 24004 loading: isCreatingGroup, 24005 onClick: onCreate, 24006 disabled, 24007 children: "Create" 24008 })] 24009 })] 24010 })] 24011 }) 24012 }); 24013}; 24014var messages_groups_create_dialog_default = MessagesCreateGroupDialog; 24015var import_compiler_runtime$44 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 24016var MessagesSearch = (t0) => { 24017 const $ = (0, import_compiler_runtime$44.c)(9); 24018 const { onChange } = t0; 24019 const [isCreateGroupDialogOpen, setIsCreateGroupDialogOpen] = (0, import_react.useState)(false); 24020 let t1; 24021 if ($[0] !== onChange) { 24022 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputSearch, { 24023 className: "flex-1", 24024 onChange 24025 }); 24026 $[0] = onChange; 24027 $[1] = t1; 24028 } else t1 = $[1]; 24029 let t2; 24030 if ($[2] === Symbol.for("react.memo_cache_sentinel")) { 24031 t2 = () => setIsCreateGroupDialogOpen(true); 24032 $[2] = t2; 24033 } else t2 = $[2]; 24034 let t3; 24035 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 24036 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 24037 asChild: true, 24038 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 24039 variant: "outline", 24040 size: "icon-lg", 24041 onClick: t2, 24042 className: "h-9 w-9", 24043 "aria-label": "Start Group Chat", 24044 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UserPlus, { className: "size-4" }) 24045 }) 24046 }
24046), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: "Start Group Chat" })] }); 24047 $[3] = t3; 24048 } else t3 = $[3]; 24049 let t4; 24050 if ($[4] !== isCreateGroupDialogOpen) { 24051 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_groups_create_dialog_default, { 24052 open: isCreateGroupDialogOpen, 24053 onOpenChange: setIsCreateGroupDialogOpen 24054 }); 24055 $[4] = isCreateGroupDialogOpen; 24056 $[5] = t4; 24057 } else t4 = $[5]; 24058 let t5; 24059 if ($[6] !== t1 || $[7] !== t4) { 24060 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 24061 className: "flex w-full items-center gap-2.5", 24062 children: [ 24063 t1, 24064 t3, 24065 t4 24066 ] 24067 }); 24068 $[6] = t1; 24069 $[7] = t4; 24070 $[8] = t5; 24071 } else t5 = $[8]; 24072 return t5; 24073}; 24074var messages_search_default = MessagesSearch; 24075var SvgMessagesRecentChatEmpty = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { 24076 width: 100, 24077 height: 100, 24078 viewBox: "0 0 100 100", 24079 fill: "none", 24080 xmlns: "http://www.w3.org/2000/svg", 24081 ...props, 24082 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("g", { 24083 clipPath: "url(#clip0_8111_97176)", 24084 children: [ 24085 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { 24086 x: 14.123, 24087 y: 8.67383, 24088 width: 72.8645, 24089 height: 82.6522, 24090 rx: 4.35012, 24091 fill: "#EEEFF2" 24092 }), 24093 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { 24094 filter: "url(#filter0_d_8111_97176)", 24095 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { 24096 x: 4.33594, 24097 y: 16.2871, 24098 width: 65.2518, 24099 height: 19.5755, 24100 rx: 4.35012, 24101 fill: "white" 24102 }) 24103 }), 24104 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { 24105 filter: "url(#filter1_d_8111_97176)", 24106 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { 24107 x: 31.5234, 24108 y: 40.2129, 24109 width: 65.2518, 24110 height: 19.5755, 24111 rx: 4.35012, 24112 fill: "white" 24113 }) 24114 }), 24115 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("g", { 24116 filter: "url(#filter2_d_8111_97176)", 24117 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { 24118 x: 4.33594, 24119 y: 64.1387, 24120 width: 65.2518, 24121 height: 19.5755, 24122 rx: 4.35012, 24123 fill: "white" 24124 }) 24125 }), 24126 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { 24127 x: 22.8242, 24128 y: 21.7246, 24129 width: 42.4137, 24130 height: 3.26259, 24131 rx: 1.63129, 24132 fill: "#D1D5DB" 24133 }), 24134 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { 24135 x: 50.0117, 24136 y: 45.6504, 24137 width: 42.4137, 24138 height: 3.26259, 24139 rx: 1.63129, 24140 fill: "#D1D5DB" 24141 }), 24142 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { 24143 x: 22.8242, 24144 y: 69.5762, 24145 width: 42.4137, 24146 height: 3.26259, 24147 rx: 1.63129, 24148 fill: "#D1D5DB" 24149 }), 24150 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { 24151 x: 22.8242, 24152 y: 27.1621, 24153 width: 25.0132, 24154 height: 3.26259, 24155 rx: 1.63129, 24156 fill: "#D1D5DB" 24157 }), 24158 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { 24159 x: 50.0117, 24160 y: 51.0879, 24161 width: 25.0132, 24162 height: 3.26259, 24163 rx: 1.63129, 24164 fill: "#D1D5DB" 24165 }), 24166 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { 24167 x: 22.8242, 24168 y: 75.0137, 24169 width: 25.0132, 24170 height: 3.26259, 24171 rx: 1.63129, 24172 fill: "#D1D5DB" 24173 }), 24174 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { 24175 x: 8.68555, 24176 y: 20.6367, 24177 width: 10.8753, 24178 height: 10.8753, 24179 rx: 2.17506, 24180 fill: "#D1D5DB" 24181 }), 24182 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { 24183 x: 35.875, 24184 y: 44.5625, 24185 width: 10.8753, 24186 height: 10.8753, 24187 rx: 2.17506, 24188 fill: "#D1D5DB" 24189 }), 24190 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { 24191 x: 8.68555, 24192 y: 68.4883, 24193 width: 10.8753, 24194 height: 10.8753, 24195 rx: 2.17506, 24196 fill: "#D1D5DB" 24197 }) 24198 ] 24199 }
24199), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("defs", { children: [ 24200 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("filter", { 24201 id: "filter0_d_8111_97176", 24202 x: -1.10171, 24203 y: 10.8495, 24204 width: 76.1272, 24205 height: 30.4515, 24206 filterUnits: "userSpaceOnUse", 24207 colorInterpolationFilters: "sRGB", 24208 children: [ 24209 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feFlood", { 24210 floodOpacity: 0, 24211 result: "BackgroundImageFix" 24212 }), 24213 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feColorMatrix", { 24214 in: "SourceAlpha", 24215 type: "matrix", 24216 values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", 24217 result: "hardAlpha" 24218 }), 24219 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feOffset", {}), 24220 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feGaussianBlur", { stdDeviation: 2.71882 }), 24221 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feComposite", { 24222 in2: "hardAlpha", 24223 operator: "out" 24224 }), 24225 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feColorMatrix", { 24226 type: "matrix", 24227 values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" 24228 }),
24229 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feBlend", { 24230 mode: "normal", 24231 in2: "BackgroundImageFix", 24232 result: "effect1_dropShadow_8111_97176" 24233 }), 24234 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feBlend", { 24235 mode: "normal", 24236 in: "SourceGraphic", 24237 in2: "effect1_dropShadow_8111_97176", 24238 result: "shape" 24239 }) 24240 ] 24241 }), 24242 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("filter", { 24243 id: "filter1_d_8111_97176", 24244 x: 26.0858, 24245 y: 34.7752, 24246 width: 76.1272, 24247 height: 30.4515, 24248 filterUnits: "userSpaceOnUse", 24249 colorInterpolationFilters: "sRGB", 24250 children: [ 24251 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feFlood", { 24252 floodOpacity: 0, 24253 result: "BackgroundImageFix" 24254 }), 24255 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feColorMatrix", { 24256 in: "SourceAlpha", 24257 type: "matrix", 24258 values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", 24259 result: "hardAlpha" 24260 }), 24261 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feOffset", {}), 24262 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feGaussianBlur", { stdDeviation: 2.71882 }),
24263 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feComposite", { 24264 in2: "hardAlpha", 24265 operator: "out" 24266 }), 24267 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feColorMatrix", { 24268 type: "matrix", 24269 values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" 24270 }), 24271 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feBlend", { 24272 mode: "normal", 24273 in2: "BackgroundImageFix", 24274 result: "effect1_dropShadow_8111_97176" 24275 }), 24276 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feBlend", { 24277 mode: "normal", 24278 in: "SourceGraphic", 24279 in2: "effect1_dropShadow_8111_97176", 24280 result: "shape" 24281 }) 24282 ] 24283 }), 24284 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("filter", { 24285 id: "filter2_d_8111_97176", 24286 x: -1.10171, 24287 y: 58.701, 24288 width: 76.1272, 24289 height: 30.4515, 24290 filterUnits: "userSpaceOnUse", 24291 colorInterpolationFilters: "sRGB", 24292 children: [ 24293 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feFlood", { 24294 floodOpacity: 0, 24295 result: "BackgroundImageFix" 24296 }), 24297 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feColorMatrix", { 24298 in: "SourceAlpha", 24299 type: "matrix", 24300 values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0", 24301 result: "hardAlpha" 24302 }),
24303 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feOffset", {}), 24304 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feGaussianBlur", { stdDeviation: 2.71882 }), 24305 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feComposite", { 24306 in2: "hardAlpha", 24307 operator: "out" 24308 }), 24309 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feColorMatrix", { 24310 type: "matrix", 24311 values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0" 24312 }), 24313 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feBlend", { 24314 mode: "normal", 24315 in2: "BackgroundImageFix", 24316 result: "effect1_dropShadow_8111_97176" 24317 }), 24318 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("feBlend", { 24319 mode: "normal", 24320 in: "SourceGraphic", 24321 in2: "effect1_dropShadow_8111_97176", 24322 result: "shape" 24323 }) 24324 ] 24325 }), 24326 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("clipPath", { 24327 id: "clip0_8111_97176", 24328 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { 24329 width: 100, 24330 height: 100, 24331 fill: "white" 24332 }) 24333 }) 24334 ] })] 24335}); 24336var messages_recent_chat_empty_default = SvgMessagesRecentChatEmpty; 24337var import_compiler_runtime$43 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 24338var MessagesRecentChatEmpty = () => { 24339 const $ = (0, import_compiler_runtime$43.c)(2); 24340 let t0; 24341 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 24342 t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyMedia, { 24343 variant: "default", 24344 className: "size-25", 24345 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_recent_chat_empty_default, {}) 24346 }); 24347 $[0] = t0; 24348 } else t0 = $[0]; 24349 let t1; 24350 if ($[1] === Symbol.for("react.memo_cache_sentinel")) { 24351 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Empty, { 24352 className: "h-full border-0 p-0", 24353 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EmptyHeader, { 24354 className: "gap-6", 24355 children: [t0, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 24356 className: "flex flex-col gap-2", 24357 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyTitle, { 24358 className: "text-base leading-none font-medium", 24359 children: "No Recent Chat" 24360 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyDescription, { 24361 className: "text-center text-sm leading-5", 24362 children: "Stay in sync with your drivers via multimedia messaging and location pins" 24363 })] 24364 })] 24365 }) 24366 }); 24367 $[1] = t1; 24368 } else t1 = $[1]; 24369 return t1; 24370}; 24371var messages_recent_chat_empty_default$1 = MessagesRecentChatEmpty; 24372var import_compiler_runtime$42 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 24373var MessagesChatsItem = (t0) => { 24374 const $ = (0, import_compiler_runtime$42.c)(36); 24375 const { id, type, numberOfUsers, name, unreadCount, avatar, updatedAt, lastMessage } = t0; 24376 const dispatch = useAppDispatch(); 24377 const displayUnreadCount = unreadCount && unreadCount > 99 ? "99+" : unreadCount; 24378 let t1; 24379 if ($[0] !== dispatch || $[1] !== id) { 24380 t1 = () => { 24381 trackMethodCall("handleOpenChat", []); 24382 if (id) { 24383 dispatch(setSessionId(id)); 24384 dispatch(setView(id.startsWith("team") ? "group-chat" : "p2p-chat")); 24385 } 24386 }; 24387 $[0] = dispatch; 24388 $[1] = id; 24389 $[2] = t1; 24390 } else t1 = $[2]; 24391 const handleOpenChat = t1; 24392 const t2 = avatar?.url; 24393 const t3 = avatar?.backgroundColor; 24394 const t4 = avatar?.initials; 24395 let t5; 24396 if ($[3] !== name || $[4] !== t2 || $[5] !== t3 || $[6] !== t4) { 24397 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppAvatar, { 24398 url: t2, 24399 backgroundColor: t3, 24400 initials: t4, 24401 name 24402 }); 24403 $[3] = name; 24404 $[4] = t2; 24405 $[5] = t3; 24406 $[6] = t4; 24407 $[7] = t5; 24408 } else t5 = $[7]; 24409 let t6; 24410 if ($[8] !== displayUnreadCount || $[9] !== unreadCount) { 24411 t6 = unreadCount && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 24412 className: "absolute -top-[5px] -right-[6px] h-4 max-w-6.5 rounded-full px-1", 24413 children: displayUnreadCount 24414 }); 24415 $[8] = displayUnreadCount; 24416 $[9] = unreadCount; 24417 $[10] = t6; 24418 } else t6 = $[10]; 24419 let t7; 24420 if ($[11] !== t5 || $[12] !== t6) { 24421 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ItemMedia, { 24422 variant: "image", 24423 className: "relative size-8 overflow-visible", 24424 children: [t5, t6] 24425 }); 24426 $[11] = t5; 24427 $[12] = t6; 24428 $[13] = t7; 24429 } else t7 = $[13]; 24430 let t8; 24431 if ($[14] !== name) { 24432 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 24433 className: "truncate", 24434 children: name 24435 }); 24436 $[14] = name; 24437 $[15] = t8; 24438 } else t8 = $[15]; 24439 let t9; 24440 if ($[16] !== numberOfUsers || $[17] !== type) {
24441 t9 = type === "team" && numberOfUsers && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [ 24442 "(", 24443 numberOfUsers, 24444 ")" 24445 ] }); 24446 $[16] = numberOfUsers; 24447 $[17] = type; 24448 $[18] = t9; 24449 } else t9 = $[18]; 24450 let t10; 24451 if ($[19] !== t8 || $[20] !== t9) { 24452 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ItemTitle, { 24453 className: "min-w-0 gap-1 text-sm font-semibold", 24454 children: [t8, t9] 24455 }); 24456 $[19] = t8; 24457 $[20] = t9; 24458 $[21] = t10; 24459 } else t10 = $[21]; 24460 let t11; 24461 if ($[22] !== updatedAt) { 24462 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 24463 className: "max-w-12 shrink-0 text-right text-xs text-muted-foreground", 24464 children: updatedAt 24465 }); 24466 $[22] = updatedAt; 24467 $[23] = t11; 24468 } else t11 = $[23]; 24469 let t12; 24470 if ($[24] !== t10 || $[25] !== t11) { 24471 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ItemHeader, { 24472 className: "space-between gap-2", 24473 children: [t10, t11] 24474 }); 24475 $[24] = t10; 24476 $[25] = t11; 24477 $[26] = t12; 24478 } else t12 = $[26]; 24479 let t13; 24480 if ($[27] !== lastMessage) { 24481 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemDescription, { 24482 className: "line-clamp-1 truncate text-sm text-muted-foreground", 24483 children: lastMessage 24484 }); 24485 $[27] = lastMessage; 24486 $[28] = t13; 24487 } else t13 = $[28]; 24488 let t14; 24489 if ($[29] !== t12 || $[30] !== t13) { 24490 t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ItemContent, { 24491 className: "min-w-0 flex-col gap-0", 24492 children: [t12, t13] 24493 }); 24494 $[29] = t12; 24495 $[30] = t13; 24496 $[31] = t14; 24497 } else t14 = $[31]; 24498 let t15; 24499 if ($[32] !== handleOpenChat || $[33] !== t14 || $[34] !== t7) { 24500 t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Item, { 24501 size: "sm", 24502 className: "h-16 cursor-pointer gap-2.5 p-3 hover:bg-muted", 24503 onClick: handleOpenChat, 24504 children: [t7, t14] 24505 }); 24506 $[32] = handleOpenChat; 24507 $[33] = t14; 24508 $[34] = t7; 24509 $[35] = t15; 24510 } else t15 = $[35]; 24511 return t15; 24512}; 24513var messages_chats_item_default = MessagesChatsItem; 24514var import_compiler_runtime$41 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 24515var MessagesRecentChatList = (t0) => { 24516 const $ = (0, import_compiler_runtime$41.c)(4); 24517 const { recentChats: t1 } = t0; 24518 let t2; 24519 if ($[0] !== t1) { 24520 t2 = t1 === void 0 ? [] : t1; 24521 $[0] = t1; 24522 $[1] = t2; 24523 } else t2 = $[1]; 24524 const recentChats = t2; 24525 let t3; 24526 if ($[2] !== recentChats) { 24527 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 24528 className: "px-2 pb-3", 24529 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(virtualized_list_default, { 24530 items: recentChats, 24531 renderItem: _temp$9, 24532 estimatedItemHeight: 64, 24533 getItemKey: _temp2$6 24534 }) 24535 }); 24536 $[2] = recentChats; 24537 $[3] = t3; 24538 } else t3 = $[3]; 24539 return t3; 24540}; 24541var messages_recent_chat_list_default = MessagesRecentChatList; 24542function _temp$9(chat) { 24543 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_chats_item_default, { ...chat }); 24544} 24545function _temp2$6(chat_0) { 24546 return chat_0.id || ""; 24547} 24548var import_compiler_runtime$40 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 24549var MessagesRecentChat = () => { 24550 const $ = (0, import_compiler_runtime$40.c)(5); 24551 const recentChats = useAppSelector(selectRecentChats); 24552 const { loading } = useMessagesContext(); 24553 let t0; 24554 if ($[0] !== recentChats) { 24555 t0 = recentChats.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_recent_chat_empty_default$1, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_recent_chat_list_default, { recentChats }); 24556 $[0] = recentChats; 24557 $[1] = t0; 24558 } else t0 = $[1]; 24559 let t1; 24560 if ($[2] !== loading || $[3] !== t0) { 24561 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spin, { 24562 spinning: loading, 24563 wrapperClassName: "overflow-y-auto", 24564 children: t0 24565 }); 24566 $[2] = loading; 24567 $[3] = t0; 24568 $[4] = t1; 24569 } else t1 = $[4]; 24570 return t1; 24571}; 24572var messages_recent_chat_default = MessagesRecentChat; 24573var import_compiler_runtime$39 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 24574var MessagesGroupsEmpty = () => { 24575 const $ = (0, import_compiler_runtime$39.c)(2); 24576 let t0; 24577 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 24578 t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyMedia, { 24579 variant: "default", 24580 className: "size-25", 24581 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_recent_chat_empty_default, {}) 24582 }); 24583 $[0] = t0; 24584 } else t0 = $[0]; 24585 let t1; 24586 if ($[1] === Symbol.for("react.memo_cache_sentinel")) { 24587 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Empty, { 24588 className: "h-full border-0 p-0", 24589 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EmptyHeader, { 24590 className: "gap-6",
24591 children: [t0, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 24592 className: "flex flex-col gap-2", 24593 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyTitle, { 24594 className: "text-base leading-none font-medium", 24595 children: "No group" 24596 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyDescription, { 24597 className: "text-center text-sm leading-5", 24598 children: "Keep connected with your drivers using multimedia messages and location markers." 24599 })] 24600 })] 24601 }) 24602 }); 24603 $[1] = t1; 24604 } else t1 = $[1]; 24605 return t1; 24606}; 24607var messages_groups_empty_default = MessagesGroupsEmpty; 24608var import_compiler_runtime$38 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 24609var MessagesGroupsItem = (t0) => { 24610 const $ = (0, import_compiler_runtime$38.c)(17); 24611 const { tid, name, numberOfUsers, avatar } = t0; 24612 const dispatch = useAppDispatch(); 24613 let t1; 24614 if ($[0] !== dispatch || $[1] !== tid) { 24615 t1 = () => { 24616 trackMethodCall("handleOpenGroup", []); 24617 if (!tid) return; 24618 dispatch(setSessionId(`team-${tid}`)); 24619 dispatch(setView("group-chat")); 24620 }; 24621 $[0] = dispatch; 24622 $[1] = tid; 24623 $[2] = t1; 24624 } else t1 = $[2]; 24625 const handleOpenGroup = t1; 24626 const t2 = avatar?.url; 24627 let t3; 24628 if ($[3] !== name || $[4] !== t2) { 24629 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemMedia, { 24630 variant: "image", 24631 className: "relative size-8 overflow-visible", 24632 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppAvatar, { 24633 className: "size-8", 24634 name, 24635 url: t2 24636 }) 24637 }); 24638 $[3] = name; 24639 $[4] = t2; 24640 $[5] = t3; 24641 } else t3 = $[5]; 24642 let t4; 24643 if ($[6] !== name) { 24644 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 24645 className: "truncate", 24646 children: name 24647 }); 24648 $[6] = name; 24649 $[7] = t4; 24650 } else t4 = $[7]; 24651 let t5; 24652 if ($[8] !== numberOfUsers) { 24653 t5 = numberOfUsers && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [ 24654 "(", 24655 numberOfUsers, 24656 ")" 24657 ] }); 24658 $[8] = numberOfUsers; 24659 $[9] = t5; 24660 } else t5 = $[9]; 24661 let t6; 24662 if ($[10] !== t4 || $[11] !== t5) { 24663 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemContent, { 24664 className: "min-w-0 flex-col", 24665 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ItemTitle, { 24666 className: "min-w-0 gap-1 font-semibold", 24667 children: [t4, t5] 24668 }) }) 24669 }); 24670 $[10] = t4; 24671 $[11] = t5; 24672 $[12] = t6; 24673 } else t6 = $[12]; 24674 let t7; 24675 if ($[13] !== handleOpenGroup || $[14] !== t3 || $[15] !== t6) { 24676 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Item, { 24677 className: "h-16 cursor-pointer gap-2.5 p-3 hover:bg-muted", 24678 size: "sm", 24679 onClick: handleOpenGroup, 24680 children: [t3, t6] 24681 }); 24682 $[13] = handleOpenGroup; 24683 $[14] = t3; 24684 $[15] = t6; 24685 $[16] = t7; 24686 } else t7 = $[16]; 24687 return t7; 24688}; 24689var messages_groups_item_default = MessagesGroupsItem; 24690var import_compiler_runtime$37 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 24691var MessagesGroupsList = (t0) => { 24692 const $ = (0, import_compiler_runtime$37.c)(2); 24693 const { groups } = t0; 24694 let t1; 24695 if ($[0] !== groups) { 24696 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 24697 className: "px-2 pb-3", 24698 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(virtualized_list_default, { 24699 items: groups, 24700 renderItem: _temp$8, 24701 estimatedItemHeight: 64, 24702 getItemKey: _temp2$5 24703 }) 24704 }); 24705 $[0] = groups; 24706 $[1] = t1; 24707 } else t1 = $[1]; 24708 return t1; 24709}; 24710var messages_groups_list_default = MessagesGroupsList; 24711function _temp$8(group) { 24712 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_groups_item_default, { ...group }); 24713} 24714function _temp2$5(group_0) { 24715 return group_0.id || ""; 24716} 24717var import_compiler_runtime$36 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 24718var MessagesGroups = () => { 24719 const $ = (0, import_compiler_runtime$36.c)(5); 24720 const groups = useAppSelector(selectMessageGroups); 24721 const { loading } = useMessagesContext(); 24722 let t0; 24723 if ($[0] !== groups) { 24724 t0 = groups.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_groups_empty_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_groups_list_default, { groups }); 24725 $[0] = groups; 24726 $[1] = t0; 24727 } else t0 = $[1]; 24728 let t1; 24729 if ($[2] !== loading || $[3] !== t0) { 24730 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spin, { 24731 spinning: loading, 24732 wrapperClassName: "overflow-y-auto", 24733 children: t0 24734 }); 24735 $[2] = loading; 24736 $[3] = t0; 24737 $[4] = t1; 24738 } else t1 = $[4]; 24739 return t1; 24740}; 24741var messages_groups_default = MessagesGroups; 24742var import_compiler_runtime$35 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 24743var MessagesContactsEmpty = () => { 24744 const $ = (0, import_compiler_runtime$35.c)(2); 24745 let t0; 24746 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 24747 t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyMedia, { 24748 variant: "default", 24749 className: "size-25", 24750 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_contacts_empty_default$1, {}) 24751 }); 24752 $[0] = t0; 24753 } else t0 = $[0]; 24754 let t1; 24755 if ($[1] === Symbol.for("react.memo_cache_sentinel")) { 24756 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Empty, { 24757 className: "h-full border-0 p-0", 24758 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EmptyHeader, { 24759 className: "gap-6",
24760 children: [t0, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 24761 className: "flex flex-col gap-2", 24762 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyTitle, { 24763 className: "text-base leading-none font-medium", 24764 children: "Add Drivers To Start Messaging" 24765 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyDescription, { 24766 className: "text-center text-sm leading-5", 24767 children: "Keep connected with your drivers using multimedia messages and location markers." 24768 })] 24769 })] 24770 }) 24771 }); 24772 $[1] = t1; 24773 } else t1 = $[1]; 24774 return t1; 24775}; 24776var messages_contacts_empty_default = MessagesContactsEmpty; 24777var import_compiler_runtime$34 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 24778var MessagesContacts = () => { 24779 const $ = (0, import_compiler_runtime$34.c)(5); 24780 const contacts = useAppSelector(selectContacts); 24781 const { loading } = useMessagesContext(); 24782 let t0; 24783 if ($[0] !== contacts) { 24784 t0 = contacts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_contacts_empty_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_contacts_list_default, { contacts }); 24785 $[0] = contacts; 24786 $[1] = t0; 24787 } else t0 = $[1]; 24788 let t1; 24789 if ($[2] !== loading || $[3] !== t0) { 24790 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spin, { 24791 spinning: loading, 24792 wrapperClassName: "overflow-y-auto", 24793 children: t0 24794 }); 24795 $[2] = loading; 24796 $[3] = t0; 24797 $[4] = t1; 24798 } else t1 = $[4]; 24799 return t1; 24800}; 24801var messages_contacts_default = MessagesContacts; 24802var import_compiler_runtime$33 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 24803var MessagesSearchResults = (t0) => { 24804 const $ = (0, import_compiler_runtime$33.c)(18); 24805 const { query } = t0; 24806 const contacts = useAppSelector(selectContacts); 24807 const groups = useAppSelector(selectMessageGroups); 24808 let t1; 24809 bb0: { 24810 if (!query.trim()) { 24811 let t2$2; 24812 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 24813 t2$2 = []; 24814 $[0] = t2$2; 24815 } else t2$2 = $[0]; 24816 t1 = t2$2; 24817 break bb0; 24818 } 24819 let t2$1; 24820 if ($[1] !== contacts || $[2] !== query) { 24821 const lowerQuery = query.toLowerCase(); 24822 t2$1 = contacts.filter((contact) => { 24823 const name = contact.name?.toLowerCase() || ""; 24824 const role = contact.role?.toLowerCase() || ""; 24825 const phone = contact.phone?.toLowerCase() || ""; 24826 const company = contact.company?.toLowerCase() || ""; 24827 return name.includes(lowerQuery) || role.includes(lowerQuery) || phone.includes(lowerQuery) || company.includes(lowerQuery); 24828 }).slice(0, 10); 24829 $[1] = contacts; 24830 $[2] = query; 24831 $[3] = t2$1; 24832 } else t2$1 = $[3]; 24833 t1 = t2$1; 24834 } 24835 const filteredContacts = t1; 24836 let t2; 24837 bb1: { 24838 if (!query.trim()) { 24839 let t3$2; 24840 if ($[4] === Symbol.for("react.memo_cache_sentinel")) { 24841 t3$2 = []; 24842 $[4] = t3$2; 24843 } else t3$2 = $[4]; 24844 t2 = t3$2; 24845 break bb1; 24846 } 24847 let t3$1; 24848 if ($[5] !== groups || $[6] !== query) { 24849 const lowerQuery_0 = query.toLowerCase(); 24850 t3$1 = groups.filter((group) => { 24851 return (group.name?.toLowerCase() || "").includes(lowerQuery_0); 24852 }).slice(0, 10); 24853 $[5] = groups; 24854 $[6] = query; 24855 $[7] = t3$1; 24856 } else t3$1 = $[7]; 24857 t2 = t3$1; 24858 } 24859 const filteredGroups = t2; 24860 if (!(filteredContacts.length > 0 || filteredGroups.length > 0) && query.trim()) { 24861 let t3$1; 24862 if ($[8] === Symbol.for("react.memo_cache_sentinel")) { 24863 t3$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyMedia, { 24864 variant: "default", 24865 className: "size-25", 24866 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 24867 name: "no-result-muted", 24868 className: "size-25" 24869 }) 24870 }); 24871 $[8] = t3$1; 24872 } else t3$1 = $[8]; 24873 let t4$1; 24874 if ($[9] === Symbol.for("react.memo_cache_sentinel")) { 24875 t4$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Empty, { 24876 className: "h-full border-0 p-0", 24877 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EmptyHeader, { 24878 className: "gap-6",
24879 children: [t3$1, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 24880 className: "flex flex-col gap-2", 24881 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyTitle, { 24882 className: "text-base leading-none font-medium", 24883 children: "No Results" 24884 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyDescription, { 24885 className: "text-center text-sm leading-5", 24886 children: "No results matched this search. Please try a different search criteria." 24887 })] 24888 })] 24889 }) 24890 }); 24891 $[9] = t4$1; 24892 } else t4$1 = $[9]; 24893 return t4$1; 24894 } 24895 let t3; 24896 if ($[10] === Symbol.for("react.memo_cache_sentinel")) { 24897 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Separator, { className: "mb-4" }); 24898 $[10] = t3; 24899 } else t3 = $[10]; 24900 let t4; 24901 if ($[11] !== filteredContacts) { 24902 t4 = filteredContacts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 24903 className: "mb-4", 24904 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { 24905 className: "mb-2 text-sm font-medium text-muted-foreground", 24906 children: "Contacts" 24907 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemGroup, { children: filteredContacts.map(_temp$7) })] 24908 }); 24909 $[11] = filteredContacts; 24910 $[12] = t4; 24911 } else t4 = $[12]; 24912 let t5; 24913 if ($[13] !== filteredGroups) { 24914 t5 = filteredGroups.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { 24915 className: "mb-2 text-sm font-medium text-muted-foreground", 24916 children: "Groups" 24917 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemGroup, { children: filteredGroups.map(_temp2$4) })] }); 24918 $[13] = filteredGroups; 24919 $[14] = t5; 24920 } else t5 = $[14]; 24921 let t6; 24922 if ($[15] !== t4 || $[16] !== t5) { 24923 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 24924 className: "flex h-full flex-col overflow-y-auto px-5 pt-4 pb-3", 24925 children: [ 24926 t3, 24927 t4, 24928 t5 24929 ] 24930 }); 24931 $[15] = t4; 24932 $[16] = t5; 24933 $[17] = t6; 24934 } else t6 = $[17]; 24935 return t6; 24936}; 24937var messages_search_results_default = MessagesSearchResults; 24938function _temp$7(contact_0) { 24939 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_contacts_item_default, { contact: contact_0 }, contact_0.id); 24940} 24941function _temp2$4(group_0) { 24942 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_groups_item_default, { ...group_0 }, group_0.id); 24943} 24944var import_compiler_runtime$32 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 24945var tabs$1 = [ 24946 { 24947 value: "recent-chat", 24948 label: "Recent Chat", 24949 Component: messages_recent_chat_default 24950 }, 24951 { 24952 value: "groups", 24953 label: "Groups", 24954 Component: messages_groups_default 24955 }, 24956 { 24957 value: "contacts", 24958 label: "Contacts", 24959 Component: messages_contacts_default 24960 } 24961]; 24962var MessagesTabs = () => { 24963 const $ = (0, import_compiler_runtime$32.c)(12); 24964 const [search, setSearch] = (0, import_react.useState)(""); 24965 const deferredSearch = (0, import_react.useDeferredValue)(search); 24966 const hasSearch = deferredSearch.trim().length > 0; 24967 let t0; 24968 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 24969 t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 24970 className: "px-5", 24971 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_search_default, { onChange: setSearch }) 24972 }); 24973 $[0] = t0; 24974 } else t0 = $[0]; 24975 const t1 = hasSearch ? "visible" : "hidden"; 24976 let t2; 24977 if ($[1] !== deferredSearch) { 24978 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_search_results_default, { query: deferredSearch }); 24979 $[1] = deferredSearch; 24980 $[2] = t2; 24981 } else t2 = $[2]; 24982 let t3; 24983 if ($[3] !== t1 || $[4] !== t2) { 24984 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Activity, { 24985 mode: t1, 24986 children: t2 24987 }); 24988 $[3] = t1; 24989 $[4] = t2; 24990 $[5] = t3; 24991 } else t3 = $[5]; 24992 const t4 = hasSearch ? "hidden" : "visible"; 24993 let t5; 24994 if ($[6] === Symbol.for("react.memo_cache_sentinel")) { 24995 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tabs, { 24996 defaultValue: "recent-chat", 24997 className: "min-h-0 flex-1", 24998 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsList, { 24999 className: "px-5", 25000 children: tabs$1.map(_temp$6) 25001 }), tabs$1.map(_temp2$3)] 25002 }); 25003 $[6] = t5; 25004 } else t5 = $[6]; 25005 let t6; 25006 if ($[7] !== t4) { 25007 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Activity, { 25008 mode: t4, 25009 children: t5 25010 }); 25011 $[7] = t4; 25012 $[8] = t6; 25013 } else t6 = $[8]; 25014 let t7; 25015 if ($[9] !== t3 || $[10] !== t6) { 25016 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 25017 className: "flex h-full flex-col", 25018 children: [ 25019 t0, 25020 t3, 25021 t6 25022 ] 25023 }); 25024 $[9] = t3; 25025 $[10] = t6; 25026 $[11] = t7; 25027 } else t7 = $[11]; 25028 return t7; 25029}; 25030var messages_tabs_default = MessagesTabs; 25031function _temp$6(tab) { 25032 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsTrigger, { 25033 value: tab.value, 25034 className: "px-2 py-1.5",
25035 children: tab.label 25036 }, tab.value); 25037} 25038function _temp2$3(tab_0) { 25039 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsContent, { 25040 value: tab_0.value, 25041 className: "min-h-0", 25042 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(tab_0.Component, {}) 25043 }, tab_0.value); 25044} 25045var import_compiler_runtime$31 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 25046var MessagesPanel = () => { 25047 const $ = (0, import_compiler_runtime$31.c)(12); 25048 const view = useAppSelector(selectView); 25049 let t0; 25050 if ($[0] !== view) { 25051 t0 = view === "group-chat" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_groups_chat_default, {}); 25052 $[0] = view; 25053 $[1] = t0; 25054 } else t0 = $[1]; 25055 const t1 = view === "p2p-chat" ? "visible" : "hidden"; 25056 let t2; 25057 if ($[2] === Symbol.for("react.memo_cache_sentinel")) { 25058 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_p2p_chat_default, {}); 25059 $[2] = t2; 25060 } else t2 = $[2]; 25061 let t3; 25062 if ($[3] !== t1) { 25063 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Activity, { 25064 mode: t1, 25065 children: t2 25066 }); 25067 $[3] = t1; 25068 $[4] = t3; 25069 } else t3 = $[4]; 25070 const t4 = view === "default" ? "visible" : "hidden"; 25071 let t5; 25072 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 25073 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_tabs_default, {}); 25074 $[5] = t5; 25075 } else t5 = $[5]; 25076 let t6; 25077 if ($[6] !== t4) { 25078 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Activity, { 25079 mode: t4, 25080 children: t5 25081 }); 25082 $[6] = t4; 25083 $[7] = t6; 25084 } else t6 = $[7]; 25085 let t7; 25086 if ($[8] !== t0 || $[9] !== t3 || $[10] !== t6) { 25087 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ 25088 t0, 25089 t3, 25090 t6 25091 ] }); 25092 $[8] = t0; 25093 $[9] = t3; 25094 $[10] = t6; 25095 $[11] = t7; 25096 } else t7 = $[11]; 25097 return t7; 25098}; 25099var messages_panel_default = MessagesPanel; 25100var import_compiler_runtime$30 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 25101function DialerTabs(t0) { 25102 const $ = (0, import_compiler_runtime$30.c)(8); 25103 let className; 25104 let props; 25105 if ($[0] !== t0) { 25106 ({className, ...props} = t0); 25107 $[0] = t0; 25108 $[1] = className; 25109 $[2] = props; 25110 } else { 25111 className = $[1]; 25112 props = $[2]; 25113 } 25114 let t1; 25115 if ($[3] !== className) { 25116 t1 = cn("flex h-full flex-col", className); 25117 $[3] = className; 25118 $[4] = t1; 25119 } else t1 = $[4]; 25120 let t2; 25121 if ($[5] !== props || $[6] !== t1) { 25122 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root2$3, { 25123 "data-slot": "dialer-tabs", 25124 className: t1, 25125 ...props 25126 }); 25127 $[5] = props; 25128 $[6] = t1; 25129 $[7] = t2; 25130 } else t2 = $[7]; 25131 return t2; 25132} 25133function DialerTabsList(t0) { 25134 const $ = (0, import_compiler_runtime$30.c)(8); 25135 let className; 25136 let props; 25137 if ($[0] !== t0) { 25138 ({className, ...props} = t0); 25139 $[0] = t0; 25140 $[1] = className; 25141 $[2] = props; 25142 } else { 25143 className = $[1]; 25144 props = $[2]; 25145 } 25146 let t1; 25147 if ($[3] !== className) { 25148 t1 = cn("inline-flex w-full items-center border-t border-border bg-background text-muted-foreground", className); 25149 $[3] = className; 25150 $[4] = t1; 25151 } else t1 = $[4]; 25152 let t2; 25153 if ($[5] !== props || $[6] !== t1) { 25154 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(List, { 25155 "data-slot": "dialer-tabs-list", 25156 className: t1, 25157 ...props 25158 }); 25159 $[5] = props; 25160 $[6] = t1; 25161 $[7] = t2; 25162 } else t2 = $[7]; 25163 return t2; 25164} 25165function DialerTabsTrigger(t0) { 25166 const $ = (0, import_compiler_runtime$30.c)(8); 25167 let className; 25168 let props; 25169 if ($[0] !== t0) { 25170 ({className, ...props} = t0); 25171 $[0] = t0; 25172 $[1] = className; 25173 $[2] = props; 25174 } else { 25175 className = $[1]; 25176 props = $[2]; 25177 } 25178 let t1; 25179 if ($[3] !== className) { 25180 t1 = cn("inline-flex h-15 flex-1 flex-col items-center justify-center gap-1 rounded-none border-r border-border bg-background px-3 py-2.5 text-xs font-bold whitespace-nowrap text-muted-foreground transition-colors last:border-r-0 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none focus-visible:ring-inset disabled:pointer-events-none disabled:opacity-50 data-[state=active]:text-primary [&_svg]:pointer-events-none [&_svg]:shrink-0", className); 25181 $[3] = className; 25182 $[4] = t1; 25183 } else t1 = $[4]; 25184 let t2; 25185 if ($[5] !== props || $[6] !== t1) { 25186 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trigger$5, { 25187 "data-slot": "dialer-tabs-trigger", 25188 className: t1, 25189 ...props 25190 }); 25191 $[5] = props; 25192 $[6] = t1; 25193 $[7] = t2; 25194 } else t2 = $[7]; 25195 return t2; 25196} 25197function DialerTabsContent(t0) { 25198 const $ = (0, import_compiler_runtime$30.c)(12); 25199 let children; 25200 let className; 25201 let props; 25202 let value; 25203 if ($[0] !== t0) { 25204 ({value, className, children, ...props} = t0); 25205 $[0] = t0; 25206 $[1] = children; 25207 $[2] = className; 25208 $[3] = props; 25209 $[4] = value; 25210 } else { 25211 children = $[1]; 25212 className = $[2]; 25213 props = $[3]; 25214 value = $[4]; 25215 } 25216 let t1; 25217 if ($[5] !== className) { 25218 t1 = cn("min-h-0 flex-1 overflow-y-auto border-t border-border outline-none", className); 25219 $[5] = className; 25220 $[6] = t1; 25221 } else t1 = $[6]; 25222 let t2; 25223 if ($[7] !== children || $[8] !== props || $[9] !== t1 || $[10] !== value) { 25224 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content$1, { 25225 "data-slot": "dialer-tabs-content", 25226 value, 25227 className: t1, 25228 ...props, 25229 children 25230 }); 25231 $[7] = children; 25232 $[8] = props; 25233 $[9] = t1; 25234 $[10] = value; 25235 $[11] = t2; 25236 } else t2 = $[11]; 25237 return t2; 25238} 25239var [Provider, useContext] = create_context_default("MessagesAndDialersContext"); 25240var import_compiler_runtime$29 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 25241var CALL_TYPE_ICONS = { 25242 1: "outbound-muted", 25243 2: "inbound-muted", 25244 3: "outbound-muted", 25245 4: "missed-call" 25246}; 25247var PAGE_SIZE$1 = 20; 25248function DialerRecent() { 25249 const $ = (0, import_compiler_runtime$29.c)(24); 25250 let t0; 25251 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 25252 t0 = {}; 25253 $[0] = t0; 25254 } else t0 = $[0]; 25255 const [filters, setFilters] = (0, import_react.useState)(t0); 25256 let t1; 25257 if ($[1] !== filters) { 25258 t1 = JSON.stringify(filters); 25259 $[1] = filters; 25260 $[2] = t1; 25261 } else t1 = $[2]; 25262 const listKey = t1; 25263 let t2; 25264 if ($[3] !== filters) { 25265 t2 = (value) => setFilters({ 25266 ...filters, 25267 type: value 25268 }); 25269 $[3] = filters; 25270 $[4] = t2; 25271 } else t2 = $[4]; 25272 let t3; 25273 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 25274 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectTrigger, { 25275 className: "w-[140px]", 25276 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectValue, { placeholder: "Type" }) 25277 }); 25278 $[5] = t3; 25279 } else t3 = $[5]; 25280 let t4; 25281 if ($[6] === Symbol.for("react.memo_cache_sentinel")) { 25282 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SelectContent, { children: [
25283 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, { 25284 value: "all", 25285 children: "All" 25286 }), 25287 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, { 25288 value: "inbound", 25289 children: "Inbound" 25290 }), 25291 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, { 25292 value: "outbound", 25293 children: "Outbound" 25294 }), 25295 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, { 25296 value: "missed", 25297 children: "Missed Call" 25298 }) 25299 ] }); 25300 $[6] = t4; 25301 } else t4 = $[6]; 25302 let t5; 25303 if ($[7] !== filters.type || $[8] !== t2) { 25304 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select, { 25305 value: filters.type, 25306 onValueChange: t2, 25307 children: [t3, t4] 25308 }); 25309 $[7] = filters.type; 25310 $[8] = t2; 25311 $[9] = t5; 25312 } else t5 = $[9]; 25313 let t6; 25314 if ($[10] !== filters) { 25315 t6 = (dateRange) => setFilters({ 25316 ...filters, 25317 date: dateRange 25318 }); 25319 $[10] = filters; 25320 $[11] = t6; 25321 } else t6 = $[11]; 25322 let t7; 25323 if ($[12] !== filters.date || $[13] !== t6) { 25324 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DatePicker, { 25325 mode: "range", 25326 className: "min-w-0 flex-1", 25327 placeholder: "Date", 25328 numberOfMonths: 2, 25329 selected: filters.date, 25330 onSelect: t6 25331 }); 25332 $[12] = filters.date; 25333 $[13] = t6; 25334 $[14] = t7; 25335 } else t7 = $[14]; 25336 let t8; 25337 if ($[15] !== t5 || $[16] !== t7) { 25338 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 25339 className: "sticky top-0 flex items-center gap-2 bg-white px-5 pt-5", 25340 children: [t5, t7] 25341 }); 25342 $[15] = t5; 25343 $[16] = t7; 25344 $[17] = t8; 25345 } else t8 = $[17]; 25346 let t9; 25347 if ($[18] !== filters || $[19] !== listKey) { 25348 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RecentCallList, { filters }, listKey); 25349 $[18] = filters; 25350 $[19] = listKey; 25351 $[20] = t9; 25352 } else t9 = $[20]; 25353 let t10; 25354 if ($[21] !== t8 || $[22] !== t9) { 25355 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 25356 className: "relative flex size-full flex-col pb-5", 25357 children: [t8, t9] 25358 }); 25359 $[21] = t8; 25360 $[22] = t9; 25361 $[23] = t10; 25362 } else t10 = $[23]; 25363 return t10; 25364} 25365function RecentCallList({ filters }) { 25366 const loadMoreRef = (0, import_react.useRef)(null); 25367 const [inViewport] = useInViewport_default(loadMoreRef); 25368 const { data, isLoading, isFetching, fetchNextPage, hasNextPage } = useGetDialerRecentListInfiniteQuery({ 25369 type: filters.type ?? "all", 25370 startTime: filters.date?.from ? startOfDay(filters.date.from).getTime() : null, 25371 endTime: filters.date?.to ? endOfDay(filters.date.to).getTime() : null, 25372 size: PAGE_SIZE$1 25373 }); 25374 const activities = (get(data, "pages") ?? []).flatMap((page) => { 25375 return get(page, "data.data") ?? []; 25376 }) ?? []; 25377 (0, import_react.useEffect)(() => { 25378 if (inViewport && hasNextPage && !isFetching) fetchNextPage(); 25379 }, [ 25380 inViewport, 25381 hasNextPage, 25382 isFetching 25383 ]); 25384 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ 25385 isLoading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 25386 className: "flex w-full items-center justify-center py-5", 25387 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { className: "size-5 text-muted-foreground" }) 25388 }), 25389 !isLoading && activities.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 25390 className: "flex flex-col", 25391 children: [activities.map((activity) => { 25392 const recentInfo = get(activity, "recentInfo"); 25393 const key = `${recentInfo.type}-${recentInfo.phone}-${recentInfo.time}-${recentInfo.sid}`; 25394 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RecentCallItem, { activity }, key); 25395 }
25395), isFetching ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 25396 className: "flex w-full items-center justify-center py-5", 25397 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { className: "size-5 text-muted-foreground" }) 25398 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 25399 ref: loadMoreRef, 25400 className: "flex w-full items-center justify-center py-5", 25401 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 25402 className: "text-sm text-muted-foreground", 25403 children: "No more data" 25404 }) 25405 })] 25406 }), 25407 !isLoading && activities.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RecentCallEmpty, {}) 25408 ] }); 25409} 25410function RecentCallItem(t0) { 25411 const $ = (0, import_compiler_runtime$29.c)(77); 25412 const { activity } = t0; 25413 const dispatch = useAppDispatch(); 25414 const { getMessagesAndDialersSheetRect } = useContext(); 25415 const [multipleIdentitiesDialogOpen, setMultipleIdentitiesDialogOpen] = (0, import_react.useState)(false); 25416 const [saveCallResult] = useSaveCallResultMutation(); 25417 const [markDialerRecentCallAsRead] = useMarkDialerRecentCallAsReadMutation(); 25418 let contactInfos; 25419 let formattedDate; 25420 let handleCallBack; 25421 let handleOpenCallResultSheet; 25422 let handleSaveCallResult; 25423 let handleViewActivity; 25424 let t1; 25425 let t2; 25426 let t3; 25427 let t4; 25428 let t5; 25429 let t6; 25430 let t7; 25431 let t8; 25432 let t9; 25433 if ($[0] !== activity || $[1] !== dispatch || $[2] !== getMessagesAndDialersSheetRect || $[3] !== markDialerRecentCallAsRead || $[4] !== saveCallResult) { 25434 const recentInfo = get(activity, "recentInfo"); 25435 contactInfos = get(activity, "contactInfos"); 25436 const iconName = CALL_TYPE_ICONS[recentInfo.type]; 25437 const isMissedCall = recentInfo.type === 4; 25438 const contact = get(contactInfos, "[0]") ?? {}; 25439 const phone = normalizePhone(contact.formatPhone ?? contact.phone ?? recentInfo.phone); 25440 formattedDate = safeFormatDate(recentInfo.time, "MMM d, yyyy, HH:mm"); 25441 handleSaveCallResult = async (contact_0) => { 25442 trackMethodCall("handleSaveCallResult", [contact_0]); 25443 if (!contact_0.id) { 25444 toast.error("Please select data."); 25445 return; 25446 } 25447 const lowerCaseRole = contact_0.role.toLowerCase(); 25448 const params = { 25449 callSid: recentInfo.sid || recentInfo.callSid || "", 25450 role: roleCt[lowerCaseRole] || lowerCaseRole, 25451 personId: contact_0.id, 25452 contactId: contact_0.contactId ?? null 25453 }; 25454 await mutateWithErrorHandling(saveCallResult, params, { 25455 showSuccessToast: true, 25456 successMessage: "Call result saved successfully" 25457 }); 25458 setMultipleIdentitiesDialogOpen(false); 25459 }; 25460 const handleMarkAsRead = () => { 25461 trackMethodCall("handleMarkAsRead", []); 25462 if (recentInfo.isCallRead) return; 25463 mutateWithErrorHandling(markDialerRecentCallAsRead, { id: recentInfo.id }); 25464 }; 25465 handleOpenCallResultSheet = () => { 25466 trackMethodCall("handleOpenCallResultSheet", []); 25467 handleMarkAsRead(); 25468 dispatch(openCallResultSheet({ resultSheetSid: recentInfo.sid || recentInfo.callSid || "" })); 25469 }; 25470 handleCallBack = () => { 25471 trackMethodCall("handleCallBack", []); 25472 handleMarkAsRead(); 25473 openDialerNumpad(dispatch, { 25474 phone, 25475 role: contact.role, 25476 personId: contact.id, 25477 contactId: contact.contactId ?? void 0, 25478 source: "Recent List-Button" 25479 }); 25480 }; 25481 handleViewActivity = () => { 25482 trackMethodCall("handleViewActivity", []); 25483 const rect = getMessagesAndDialersSheetRect(); 25484 if (!rect) return; 25485 handleMarkAsRead(); 25486 dispatch(showNestedSheet({ 25487 sourceRect: { 25488 x: rect.x, 25489 y: rect.y, 25490 width: rect.width, 25491 height: rect.height 25492 }, 25493 data: { 25494 id: contact?.id ?? recentInfo.personId ?? void 0, 25495 name: contact?.name ?? recentInfo.name ?? "Unknown", 25496 role: contact?.role ?? recentInfo.role ?? void 0, 25497 hasContactPermission: recentInfo.hasContactPermission, 25498 phone, 25499 contactId: contact?.contactId ?? recentInfo.contactId ?? void 0, 25500 type: "recent" 25501 } 25502 })); 25503 }; 25504 t9 = "flex w-full items-center gap-3 bg-white px-5 py-4"; 25505 t7 = "flex flex-1 items-start gap-3"; 25506 let t10$1; 25507 if ($[20] !== iconName) { 25508 t10$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 25509 className: "flex size-9 items-center justify-center overflow-hidden rounded-full bg-slate-100", 25510 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 25511 name: iconName, 25512 className: "size-4" 25513 }) 25514 }); 25515 $[20] = iconName; 25516 $[21] = t10$1; 25517 } else t10$1 = $[21];
25518 const t11$1 = !recentInfo.isCallRead && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute top-0 right-0 size-2.5 rounded-full border border-white bg-primary" }); 25519 if ($[22] !== t10$1 || $[23] !== t11$1) { 25520 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 25521 className: "relative shrink-0", 25522 children: [t10$1, t11$1] 25523 }); 25524 $[22] = t10$1; 25525 $[23] = t11$1; 25526 $[24] = t8; 25527 } else t8 = $[24]; 25528 t6 = "flex flex-1 items-center justify-between"; 25529 t4 = "flex flex-col"; 25530 const t12$1 = isMissedCall ? "text-destructive" : "text-foreground"; 25531 let t13$1; 25532 if ($[25] !== t12$1) { 25533 t13$1 = cn("max-w-45 truncate text-sm font-semibold", t12$1); 25534 $[25] = t12$1; 25535 $[26] = t13$1; 25536 } else t13$1 = $[26]; 25537 const t14$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipOverflowTrigger, { 25538 asChild: true, 25539 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 25540 className: t13$1, 25541 children: recentInfo.name ?? "Unknown" 25542 }) 25543 }); 25544 const t15$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: recentInfo.name ?? "Unknown" }) }); 25545 let t16$1; 25546 if ($[27] !== t14$1 || $[28] !== t15$1) { 25547 t16$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [t14$1, t15$1] }); 25548 $[27] = t14$1; 25549 $[28] = t15$1; 25550 $[29] = t16$1; 25551 } else t16$1 = $[29]; 25552 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 25553 className: "flex items-center gap-1", 25554 children: [t16$1, recentInfo.role && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 25555 variant: "neutral-subtle", 25556 children: recentInfo.role 25557 })] 25558 }); 25559 t1 = "text-sm text-foreground"; 25560 t2 = "+1 "; 25561 t3 = formatPhone(phone, "parentheses"); 25562 $[0] = activity; 25563 $[1] = dispatch; 25564 $[2] = getMessagesAndDialersSheetRect; 25565 $[3] = markDialerRecentCallAsRead; 25566 $[4] = saveCallResult; 25567 $[5] = contactInfos; 25568 $[6] = formattedDate; 25569 $[7] = handleCallBack; 25570 $[8] = handleOpenCallResultSheet; 25571 $[9] = handleSaveCallResult; 25572 $[10] = handleViewActivity; 25573 $[11] = t1; 25574 $[12] = t2; 25575 $[13] = t3; 25576 $[14] = t4; 25577 $[15] = t5; 25578 $[16] = t6; 25579 $[17] = t7; 25580 $[18] = t8; 25581 $[19] = t9; 25582 } else { 25583 contactInfos = $[5]; 25584 formattedDate = $[6]; 25585 handleCallBack = $[7]; 25586 handleOpenCallResultSheet = $[8]; 25587 handleSaveCallResult = $[9]; 25588 handleViewActivity = $[10]; 25589 t1 = $[11]; 25590 t2 = $[12]; 25591 t3 = $[13]; 25592 t4 = $[14]; 25593 t5 = $[15]; 25594 t6 = $[16]; 25595 t7 = $[17]; 25596 t8 = $[18]; 25597 t9 = $[19]; 25598 } 25599 let t10; 25600 if ($[30] !== t1 || $[31] !== t2 || $[32] !== t3) { 25601 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { 25602 className: t1, 25603 children: [t2, t3] 25604 }); 25605 $[30] = t1; 25606 $[31] = t2; 25607 $[32] = t3; 25608 $[33] = t10; 25609 } else t10 = $[33]; 25610 let t11; 25611 if ($[34] !== formattedDate) { 25612 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 25613 className: "text-sm text-muted-foreground", 25614 children: formattedDate 25615 }); 25616 $[34] = formattedDate; 25617 $[35] = t11; 25618 } else t11 = $[35]; 25619 let t12; 25620 if ($[36] !== contactInfos) { 25621 t12 = contactInfos && contactInfos.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 25622 className: "text-warning flex items-center gap-0.5 text-[#FE8600]", 25623 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 25624 className: "cursor-pointer text-xs font-medium", 25625 onClick: () => setMultipleIdentitiesDialogOpen(true), 25626 children: "Phone # is registered to multiple contacts" 25627 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 25628 asChild: true, 25629 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleQuestionMark, { className: "size-3 cursor-pointer" }) 25630 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "This phone number is associated with multiple contacts in your system." }) })] })] 25631 }); 25632 $[36] = contactInfos; 25633 $[37] = t12; 25634 } else t12 = $[37]; 25635 let t13; 25636 if ($[38] !== t10 || $[39] !== t11 || $[40] !== t12 || $[41] !== t4 || $[42] !== t5) { 25637 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 25638 className: t4, 25639 children: [ 25640 t5, 25641 t10, 25642 t11, 25643 t12 25644 ] 25645 }); 25646 $[38] = t10; 25647 $[39] = t11; 25648 $[40] = t12; 25649 $[41] = t4; 25650 $[42] = t5; 25651 $[43] = t13; 25652 } else t13 = $[43]; 25653 let t14; 25654 if ($[44] === Symbol.for("react.memo_cache_sentinel")) { 25655 t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownMenuTrigger, { 25656 asChild: true, 25657 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 25658 variant: "ghost", 25659 size: "icon-sm", 25660 "aria-label": "More options", 25661 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EllipsisVertical, { className: "size-4 text-muted-foreground" }) 25662 }) 25663 }); 25664 $[44] = t14; 25665 } else t14 = $[44]; 25666 let t15; 25667 if ($[45] === Symbol.for("react.memo_cache_sentinel")) { 25668 t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PhoneOutgoing, { className: "size-4" }); 25669 $[45] = t15; 25670 } else t15 = $[45]; 25671 let t16; 25672 if ($[46] !== handleCallBack) { 25673 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenuItem, { 25674 className: "h-9", 25675 onClick: handleCallBack, 25676 children: [t15, "Call back"] 25677 }); 25678 $[46] = handleCallBack; 25679 $[47] = t16; 25680 } else t16 = $[47]; 25681 let t17; 25682 if ($[48] === Symbol.for("react.memo_cache_sentinel")) { 25683 t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClipboardPen, { className: "size-4" }); 25684 $[48] = t17; 25685 } else t17 = $[48]; 25686 let t18; 25687 if ($[49] !== handleOpenCallResultSheet) { 25688 t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenuItem, { 25689 className: "h-9", 25690 onClick: handleOpenCallResultSheet, 25691 children: [t17, "Call Result"] 25692 }); 25693 $[49] = handleOpenCallResultSheet; 25694 $[50] = t18; 25695 } else t18 = $[50]; 25696 let t19; 25697 if ($[51] === Symbol.for("react.memo_cache_sentinel")) { 25698 t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CalendarSearch, { className: "size-4" }); 25699 $[51] = t19; 25700 } else t19 = $[51]; 25701 let t20; 25702 if ($[52] !== handleViewActivity) { 25703 t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenuItem, { 25704 className: "h-9", 25705 onClick: handleViewActivity, 25706 children: [t19, "View Activity"] 25707 }); 25708 $[52] = handleViewActivity; 25709 $[53] = t20; 25710 } else t20 = $[53]; 25711 let t21; 25712 if ($[54] !== t16 || $[55] !== t18 || $[56] !== t20) { 25713 t21 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenu, { children: [t14, /* @__P
25713URE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenuContent, { 25714 align: "end", 25715 className: "w-37.5", 25716 children: [ 25717 t16, 25718 t18, 25719 t20 25720 ] 25721 })] }); 25722 $[54] = t16; 25723 $[55] = t18; 25724 $[56] = t20; 25725 $[57] = t21; 25726 } else t21 = $[57]; 25727 let t22; 25728 if ($[58] !== t13 || $[59] !== t21 || $[60] !== t6) { 25729 t22 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 25730 className: t6, 25731 children: [t13, t21] 25732 }); 25733 $[58] = t13; 25734 $[59] = t21; 25735 $[60] = t6; 25736 $[61] = t22; 25737 } else t22 = $[61]; 25738 let t23; 25739 if ($[62] !== t22 || $[63] !== t7 || $[64] !== t8) { 25740 t23 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 25741 className: t7, 25742 children: [t8, t22] 25743 }); 25744 $[62] = t22; 25745 $[63] = t7; 25746 $[64] = t8; 25747 $[65] = t23; 25748 } else t23 = $[65]; 25749 let t24; 25750 if ($[66] !== t23 || $[67] !== t9) { 25751 t24 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 25752 className: t9, 25753 children: t23 25754 }); 25755 $[66] = t23; 25756 $[67] = t9; 25757 $[68] = t24; 25758 } else t24 = $[68]; 25759 let t25; 25760 if ($[69] === Symbol.for("react.memo_cache_sentinel")) { 25761 t25 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 25762 className: "flex w-full items-center gap-3 px-5", 25763 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-px w-9" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Separator, { className: "flex-1" })] 25764 }); 25765 $[69] = t25; 25766 } else t25 = $[69]; 25767 let t26; 25768 if ($[70] !== contactInfos || $[71] !== handleSaveCallResult || $[72] !== multipleIdentitiesDialogOpen) { 25769 t26 = contactInfos && contactInfos.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialerMultipleIdentitiesDialog, { 25770 open: multipleIdentitiesDialogOpen, 25771 onOpenChange: setMultipleIdentitiesDialogOpen, 25772 contacts: contactInfos, 25773 onSave: handleSaveCallResult 25774 }); 25775 $[70] = contactInfos; 25776 $[71] = handleSaveCallResult; 25777 $[72] = multipleIdentitiesDialogOpen; 25778 $[73] = t26; 25779 } else t26 = $[73]; 25780 let t27; 25781 if ($[74] !== t24 || $[75] !== t26) { 25782 t27 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ 25783 t24, 25784 t25, 25785 t26 25786 ] }); 25787 $[74] = t24; 25788 $[75] = t26; 25789 $[76] = t27; 25790 } else t27 = $[76]; 25791 return t27; 25792} 25793function RecentCallEmpty() { 25794 const $ = (0, import_compiler_runtime$29.c)(2); 25795 let t0; 25796 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 25797 t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyMedia, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 25798 name: "no-result-muted", 25799 className: "size-25" 25800 }) }); 25801 $[0] = t0; 25802 } else t0 = $[0]; 25803 let t1; 25804 if ($[1] === Symbol.for("react.memo_cache_sentinel")) { 25805 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Empty, { 25806 className: "px-5!", 25807 children: [t0, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EmptyHeader, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyTitle, { children: "No Results" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyDescription, { children: "No results matched this search. Please try a different search criteria." })] })] 25808 }); 25809 $[1] = t1; 25810 } else t1 = $[1]; 25811 return t1; 25812} 25813var dialer_recent_default = DialerRecent; 25814var import_compiler_runtime$28 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 25815var PAGE_SIZE = 20; 25816function DialerVoiceMail() { 25817 const $ = (0, import_compiler_runtime$28.c)(11); 25818 const [filters, setFilters] = (0, import_react.useState)(); 25819 let t0; 25820 if ($[0] !== filters) { 25821 t0 = JSON.stringify(filters); 25822 $[0] = filters; 25823 $[1] = t0; 25824 } else t0 = $[1]; 25825 const listKey = t0; 25826 let t1; 25827 if ($[2] === Symbol.for("react.memo_cache_sentinel")) { 25828 t1 = (dateRange) => setFilters(dateRange); 25829 $[2] = t1; 25830 } else t1 = $[2]; 25831 let t2; 25832 if ($[3] !== filters) { 25833 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 25834 className: "sticky top-0 z-10 bg-white px-5 pt-5", 25835 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DatePicker, { 25836 className: "w-full", 25837 mode: "range", 25838 placeholder: "Date", 25839 numberOfMonths: 2, 25840 selected: filters, 25841 onSelect: t1 25842 }) 25843 }); 25844 $[3] = filters; 25845 $[4] = t2; 25846 } else t2 = $[4]; 25847 let t3; 25848 if ($[5] !== filters || $[6] !== listKey) { 25849 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VoiceMailList, { filters }, listKey); 25850 $[5] = filters; 25851 $[6] = listKey; 25852 $[7] = t3; 25853 } else t3 = $[7]; 25854 let t4; 25855 if ($[8] !== t2 || $[9] !== t3) { 25856 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 25857 className: "relative flex size-full flex-col overflow-y-auto pb-5", 25858 children: [t2, t3] 25859 }); 25860 $[8] = t2; 25861 $[9] = t3; 25862 $[10] = t4; 25863 } else t4 = $[10]; 25864 return t4; 25865} 25866function VoiceMailList({ filters }) {
25867 const loadMoreRef = (0, import_react.useRef)(null); 25868 const [inViewport] = useInViewport_default(loadMoreRef); 25869 const { data, isLoading, isFetching, hasNextPage, fetchNextPage } = useGetDialerVoicemailListInfiniteQuery({ 25870 startDate: filters?.from ? safeFormatDate(startOfDay(filters.from), "T", "", { locale }) : "", 25871 endDate: filters?.to ? safeFormatDate(endOfDay(filters.to), "T", "", { locale }) : "", 25872 size: PAGE_SIZE 25873 }); 25874 const voicemailList = (get(data, "pages") ?? []).flatMap((page) => { 25875 return get(page, "data.data") ?? []; 25876 }) ?? []; 25877 (0, import_react.useEffect)(() => { 25878 if (inViewport && hasNextPage && !isLoading) fetchNextPage(); 25879 }, [ 25880 inViewport, 25881 hasNextPage, 25882 isLoading 25883 ]); 25884 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ 25885 isLoading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 25886 className: "flex w-full items-center justify-center py-5", 25887 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { className: "size-5 text-muted-foreground" }) 25888 }), 25889 !isLoading && voicemailList.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [voicemailList.map((voicemail) => { 25890 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VoiceMailItem, { voicemail }, voicemail.id); 25891 }
25891), isFetching ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 25892 className: "flex w-full items-center justify-center py-5", 25893 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { className: "size-5 text-muted-foreground" }) 25894 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 25895 ref: loadMoreRef, 25896 className: "flex w-full items-center justify-center py-5", 25897 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 25898 className: "text-sm text-muted-foreground", 25899 children: "No more data" 25900 }) 25901 })] }), 25902 !isLoading && voicemailList.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VoiceMailEmpty, {}) 25903 ] }); 25904} 25905function VoiceMailItem(t0) { 25906 const $ = (0, import_compiler_runtime$28.c)(89); 25907 const { voicemail } = t0; 25908 const dispatch = useAppDispatch(); 25909 const { getMessagesAndDialersSheetRect } = useContext(); 25910 const [multipleIdentitiesDialogOpen, setMultipleIdentitiesDialogOpen] = (0, import_react.useState)(false); 25911 const [markDialerVoiceAsRead] = useMarkDialerVoiceAsReadMutation(); 25912 const [saveCallResult] = useSaveCallResultMutation(); 25913 let formattedDate; 25914 let handleCallBack; 25915 let handleMarkDialerVoiceAsRead; 25916 let handleSaveCallResult; 25917 let handleViewActivity; 25918 let hasMultipleContacts; 25919 let t1; 25920 let t2; 25921 let t3; 25922 let t4; 25923 let t5; 25924 let t6; 25925 let t7; 25926 let t8; 25927 if ($[0] !== dispatch || $[1] !== getMessagesAndDialersSheetRect || $[2] !== markDialerVoiceAsRead || $[3] !== saveCallResult || $[4] !== voicemail) { 25928 const contact = get(voicemail, "contacts[0]", { name: "Unknown" }); 25929 let t9$1; 25930 if ($[19] !== voicemail.voiceTime) { 25931 t9$1 = safeFormatDate(voicemail.voiceTime, "MMM d, yyyy, HH:mm", ""); 25932 $[19] = voicemail.voiceTime; 25933 $[20] = t9$1; 25934 } else t9$1 = $[20]; 25935 formattedDate = t9$1; 25936 hasMultipleContacts = voicemail.contacts?.length > 1; 25937 const phone = normalizePhone(contact.formatPhone ?? contact.phone ?? voicemail.userPhone); 25938 let t10$1; 25939 if ($[21] !== markDialerVoiceAsRead || $[22] !== voicemail.id || $[23] !== voicemail.isRead) { 25940 t10$1 = async () => { 25941 trackMethodCall("handleMarkDialerVoiceAsRead", []); 25942 if (voicemail.isRead) return; 25943 await mutateWithErrorHandling(markDialerVoiceAsRead, { id: voicemail.id }); 25944 }; 25945 $[21] = markDialerVoiceAsRead; 25946 $[22] = voicemail.id; 25947 $[23] = voicemail.isRead; 25948 $[24] = t10$1; 25949 } else t10$1 = $[24]; 25950 handleMarkDialerVoiceAsRead = t10$1; 25951 let t11$1; 25952 if ($[25] !== saveCallResult || $[26] !== voicemail.callSid || $[27] !== voicemail.sid) { 25953 t11$1 = async (contact_0) => { 25954 trackMethodCall("handleSaveCallResult", [contact_0]); 25955 if (!contact_0.id) { 25956 toast.error("Please select data."); 25957 return; 25958 } 25959 const lowerCaseRole = contact_0.role.toLowerCase(); 25960 const params = { 25961 callSid: voicemail.sid || voicemail.callSid || "", 25962 role: roleCt[lowerCaseRole] || lowerCaseRole, 25963 personId: contact_0.id, 25964 contactId: contact_0.contactId ?? null 25965 }; 25966 await mutateWithErrorHandling(saveCallResult, params, { 25967 showSuccessToast: true, 25968 successMessage: "Call result saved successfully" 25969 }); 25970 setMultipleIdentitiesDialogOpen(false); 25971 }; 25972 $[25] = saveCallResult; 25973 $[26] = voicemail.callSid; 25974 $[27] = voicemail.sid; 25975 $[28] = t11$1; 25976 } else t11$1 = $[28]; 25977 handleSaveCallResult = t11$1; 25978 handleCallBack = () => { 25979 trackMethodCall("handleCallBack", []); 25980 openDialerNumpad(dispatch, { 25981 phone, 25982 role: contact.role, 25983 personId: contact.id, 25984 contactId: contact.contactId ?? void 0, 25985 source: "Voicemail List-Button" 25986 }); 25987 }; 25988 let t12$1; 25989 if ($[29] !== dispatch || $[30] !== getMessagesAndDialersSheetRect || $[31] !== voicemail) { 25990 t12$1 = () => { 25991 trackMethodCall("handleViewActivity", []); 25992 const rect = getMessagesAndDialersSheetRect(); 25993 if (!rect) return; 25994 const contact_1 = get(voicemail, "contacts.[0]") ?? {}; 25995 dispatch(showNestedSheet({ 25996 sourceRect: { 25997 x: rect.x, 25998 y: rect.y, 25999 width: rect.width, 26000 height: rect.height 26001 }, 26002 data: { 26003 id: contact_1?.id ?? void 0, 26004 name: contact_1?.name ?? "Unknown", 26005 role: contact_1?.role ?? void 0, 26006 hasContactPermission: voicemail.hasContactPermission, 26007 phone: contact_1?.formatPhone ?? contact_1?.phone ?? voicemail.userPhone.slice(2), 26008 contactId: contact_1?.contactId ?? void 0, 26009 type: "recent" 26010 } 26011 })); 26012 }; 26013 $[29] = dispatch; 26014 $[30] = getMessagesAndDialersSheetRect; 26015 $[31] = voicemail; 26016 $[32] = t12$1; 26017 } else t12$1 = $[32]; 26018 handleViewActivity = t12$1; 26019 t8 = "flex w-full items-center gap-3 bg-white px-5 py-4"; 26020 t6 = "flex flex-1 items-start gap-3"; 26021 let t13$1; 26022 if ($[33] === Symbol.for("react.memo_cache_sentinel")) { 26023 t13$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 26024 name: "call-speech", 26025 className: "size-4" 26026 }); 26027 $[33] = t13$1; 26028 } else t13$1 = $[33]; 26029 let t14$1; 26030 if ($[34] !== voicemail.isRead) {
26031 t14$1 = !voicemail.isRead && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute top-0 right-0 size-2.5 rounded-full border border-white bg-primary" }); 26032 $[34] = voicemail.isRead; 26033 $[35] = t14$1; 26034 } else t14$1 = $[35]; 26035 if ($[36] !== handleMarkDialerVoiceAsRead || $[37] !== t14$1) { 26036 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 26037 className: "relative flex size-9 shrink-0 items-center justify-center rounded-full bg-slate-100", 26038 onClick: handleMarkDialerVoiceAsRead, 26039 children: [t13$1, t14$1] 26040 }); 26041 $[36] = handleMarkDialerVoiceAsRead; 26042 $[37] = t14$1; 26043 $[38] = t7; 26044 } else t7 = $[38]; 26045 t5 = "flex flex-1 flex-col gap-3"; 26046 t4 = "flex items-center justify-between"; 26047 t1 = "flex flex-col"; 26048 let t15$1; 26049 if ($[39] === Symbol.for("react.memo_cache_sentinel")) { 26050 t15$1 = cn("max-w-45 truncate text-sm font-semibold text-foreground"); 26051 $[39] = t15$1; 26052 } else t15$1 = $[39]; 26053 const t16$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipOverflowTrigger, { 26054 asChild: true, 26055 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 26056 className: t15$1, 26057 children: contact.name 26058 }) 26059 }); 26060 const t17$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: contact.name }) }); 26061 let t18$1; 26062 if ($[40] !== t16$1 || $[41] !== t17$1) { 26063 t18$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [t16$1, t17$1] }); 26064 $[40] = t16$1; 26065 $[41] = t17$1; 26066 $[42] = t18$1; 26067 } else t18$1 = $[42]; 26068 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 26069 className: "flex items-center gap-1", 26070 children: [t18$1, contact.role && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 26071 variant: "neutral-subtle", 26072 children: contact.role 26073 })] 26074 }); 26075 t3 = phone && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { 26076 className: "text-sm text-foreground", 26077 children: ["+1 ", formatPhone(phone, "parentheses")] 26078 }); 26079 $[0] = dispatch; 26080 $[1] = getMessagesAndDialersSheetRect; 26081 $[2] = markDialerVoiceAsRead; 26082 $[3] = saveCallResult; 26083 $[4] = voicemail; 26084 $[5] = formattedDate; 26085 $[6] = handleCallBack; 26086 $[7] = handleMarkDialerVoiceAsRead; 26087 $[8] = handleSaveCallResult; 26088 $[9] = handleViewActivity; 26089 $[10] = hasMultipleContacts; 26090 $[11] = t1; 26091 $[12] = t2; 26092 $[13] = t3; 26093 $[14] = t4; 26094 $[15] = t5; 26095 $[16] = t6; 26096 $[17] = t7; 26097 $[18] = t8; 26098 } else { 26099 formattedDate = $[5]; 26100 handleCallBack = $[6]; 26101 handleMarkDialerVoiceAsRead = $[7]; 26102 handleSaveCallResult = $[8]; 26103 handleViewActivity = $[9]; 26104 hasMultipleContacts = $[10]; 26105 t1 = $[11]; 26106 t2 = $[12]; 26107 t3 = $[13]; 26108 t4 = $[14]; 26109 t5 = $[15]; 26110 t6 = $[16]; 26111 t7 = $[17]; 26112 t8 = $[18]; 26113 } 26114 let t9; 26115 if ($[43] !== formattedDate) { 26116 t9 = formattedDate && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 26117 className: "text-sm text-muted-foreground", 26118 children: formattedDate 26119 }); 26120 $[43] = formattedDate; 26121 $[44] = t9; 26122 } else t9 = $[44]; 26123 let t10; 26124 if ($[45] !== hasMultipleContacts) { 26125 t10 = hasMultipleContacts && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 26126 className: "text-warning flex items-center gap-0.5 text-[#FE8600]", 26127 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 26128 className: "cursor-pointer text-xs font-medium", 26129 onClick: () => setMultipleIdentitiesDialogOpen(true), 26130 children: "Phone # is registered to multiple contacts" 26131 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 26132 asChild: true, 26133 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleQuestionMark, { className: "size-3 cursor-pointer" }) 26134 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "This phone number is associated with multiple contacts in your system." }) })] })] 26135 }); 26136 $[45] = hasMultipleContacts; 26137 $[46] = t10; 26138 } else t10 = $[46]; 26139 let t11; 26140 if ($[47] !== t1 || $[48] !== t10 || $[49] !== t2 || $[50] !== t3 || $[51] !== t9) { 26141 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 26142 className: t1, 26143 children: [ 26144 t2, 26145 t3, 26146 t9, 26147 t10 26148 ] 26149 }); 26150 $[47] = t1; 26151 $[48] = t10; 26152 $[49] = t2; 26153 $[50] = t3; 26154 $[51] = t9; 26155 $[52] = t11; 26156 } else t11 = $[52]; 26157 let t12; 26158 if ($[53] === Symbol.for("react.memo_cache_sentinel")) { 26159 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropdownMenuTrigger, { 26160 asChild: true, 26161 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 26162 variant: "ghost", 26163 size: "icon-sm", 26164 "aria-label": "More options", 26165 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EllipsisVertical, { className: "size-4 text-muted-foreground" }) 26166 }) 26167 }); 26168 $[53] = t12; 26169 } else t12 = $[53]; 26170 let t13; 26171 if ($[54] === Symbol.for("react.memo_cache_sentinel")) { 26172 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PhoneOutgoing, { className: "size-4" }); 26173 $[54] = t13; 26174 } else t13 = $[54]; 26175 let t14; 26176 if ($[55] !== handleCallBack) { 26177 t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenuItem, { 26178 className: "h-9", 26179 onClick: handleCallBack, 26180 children: [t13, "Call back"] 26181 }); 26182 $[55] = handleCallBack; 26183 $[56] = t14; 26184 } else t14 = $[56]; 26185 let t15; 26186 if ($[57] === Symbol.for("react.memo_cache_sentinel")) { 26187 t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CalendarSearch, { className: "size-4" }); 26188 $[57] = t15; 26189 } else t15 = $[57]; 26190 let t16; 26191 if ($[58] !== handleViewActivity) { 26192 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenuItem, { 26193 className: "h-9", 26194 onClick: handleViewActivity, 26195 children: [t15, "View Activity"] 26196 }); 26197 $[58] = handleViewActivity; 26198 $[59] = t16; 26199 } else t16 = $[59]; 26200 let t17; 26201 if ($[60] !== t14 || $[61] !== t16) { 26202 t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenu, { children: [t12, /* @__P
26202URE__ */ (0, import_jsx_runtime.jsxs)(DropdownMenuContent, { 26203 align: "end", 26204 className: "w-37.5", 26205 children: [t14, t16] 26206 })] }); 26207 $[60] = t14; 26208 $[61] = t16; 26209 $[62] = t17; 26210 } else t17 = $[62]; 26211 let t18; 26212 if ($[63] !== t11 || $[64] !== t17 || $[65] !== t4) { 26213 t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 26214 className: t4, 26215 children: [t11, t17] 26216 }); 26217 $[63] = t11; 26218 $[64] = t17; 26219 $[65] = t4; 26220 $[66] = t18; 26221 } else t18 = $[66]; 26222 let t19; 26223 if ($[67] !== handleMarkDialerVoiceAsRead || $[68] !== voicemail.voiceUrl) { 26224 t19 = voicemail.voiceUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(audio_player_default, { 26225 url: voicemail.voiceUrl, 26226 className: "h-9", 26227 onPlay: handleMarkDialerVoiceAsRead 26228 }); 26229 $[67] = handleMarkDialerVoiceAsRead; 26230 $[68] = voicemail.voiceUrl; 26231 $[69] = t19; 26232 } else t19 = $[69]; 26233 let t20; 26234 if ($[70] !== t18 || $[71] !== t19 || $[72] !== t5) { 26235 t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 26236 className: t5, 26237 children: [t18, t19] 26238 }); 26239 $[70] = t18; 26240 $[71] = t19; 26241 $[72] = t5; 26242 $[73] = t20; 26243 } else t20 = $[73]; 26244 let t21; 26245 if ($[74] !== t20 || $[75] !== t6 || $[76] !== t7) { 26246 t21 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 26247 className: t6, 26248 children: [t7, t20] 26249 }); 26250 $[74] = t20; 26251 $[75] = t6; 26252 $[76] = t7; 26253 $[77] = t21; 26254 } else t21 = $[77]; 26255 let t22; 26256 if ($[78] !== t21 || $[79] !== t8) { 26257 t22 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 26258 className: t8, 26259 children: t21 26260 }); 26261 $[78] = t21; 26262 $[79] = t8; 26263 $[80] = t22; 26264 } else t22 = $[80]; 26265 let t23; 26266 if ($[81] === Symbol.for("react.memo_cache_sentinel")) { 26267 t23 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 26268 className: "flex w-full items-center gap-3 px-5", 26269 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-px w-9" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Separator, { className: "flex-1" })] 26270 }); 26271 $[81] = t23; 26272 } else t23 = $[81]; 26273 let t24; 26274 if ($[82] !== handleSaveCallResult || $[83] !== multipleIdentitiesDialogOpen || $[84] !== voicemail.contacts) { 26275 t24 = voicemail.contacts && voicemail.contacts.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialerMultipleIdentitiesDialog, { 26276 open: multipleIdentitiesDialogOpen, 26277 onOpenChange: setMultipleIdentitiesDialogOpen, 26278 contacts: voicemail.contacts, 26279 onSave: handleSaveCallResult 26280 }); 26281 $[82] = handleSaveCallResult; 26282 $[83] = multipleIdentitiesDialogOpen; 26283 $[84] = voicemail.contacts; 26284 $[85] = t24; 26285 } else t24 = $[85]; 26286 let t25; 26287 if ($[86] !== t22 || $[87] !== t24) { 26288 t25 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ 26289 t22, 26290 t23, 26291 t24 26292 ] }); 26293 $[86] = t22; 26294 $[87] = t24; 26295 $[88] = t25; 26296 } else t25 = $[88]; 26297 return t25; 26298} 26299function VoiceMailEmpty() { 26300 const $ = (0, import_compiler_runtime$28.c)(2); 26301 let t0; 26302 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 26303 t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyMedia, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 26304 name: "no-result-muted", 26305 className: "size-25" 26306 }) }); 26307 $[0] = t0; 26308 } else t0 = $[0]; 26309 let t1; 26310 if ($[1] === Symbol.for("react.memo_cache_sentinel")) { 26311 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Empty, { 26312 className: "px-5!", 26313 children: [t0, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EmptyHeader, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyTitle, { children: "No Results" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyDescription, { children: "No results matched this search. Please try a different search criteria." })] })] 26314 }); 26315 $[1] = t1; 26316 } else t1 = $[1]; 26317 return t1; 26318} 26319var dialer_voice_mail_default = DialerVoiceMail; 26320var import_compiler_runtime$27 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 26321function DialerSettingsSpinner(t0) { 26322 const $ = (0, import_compiler_runtime$27.c)(12); 26323 let children; 26324 let props; 26325 let t1; 26326 if ($[0] !== t0) { 26327 ({spinning: t1, children, ...props} = t0); 26328 $[0] = t0; 26329 $[1] = children; 26330 $[2] = props; 26331 $[3] = t1; 26332 } else { 26333 children = $[1]; 26334 props = $[2]; 26335 t1 = $[3]; 26336 } 26337 if (t1 === void 0 ? false : t1) { 26338 let t2$1; 26339 if ($[4] === Symbol.for("react.memo_cache_sentinel")) { 26340 t2$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { className: "mx-auto" }); 26341 $[4] = t2$1; 26342 } else t2$1 = $[4]; 26343 let t3; 26344 if ($[5] !== props) { 26345 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 26346 "data-state": "loading", 26347 className: "pb-5", 26348 ...props, 26349 children: t2$1 26350 }); 26351 $[5] = props; 26352 $[6] = t3; 26353 } else t3 = $[6]; 26354 return t3; 26355 } 26356 if (!children) { 26357 let t2$1; 26358 if ($[7] === Symbol.for("react.memo_cache_sentinel")) { 26359 t2$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { className: "mx-auto" }); 26360 $[7] = t2$1; 26361 } else t2$1 = $[7]; 26362 let t3; 26363 if ($[8] !== props) { 26364 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 26365 "data-state": "loading", 26366 className: "pb-5", 26367 ...props, 26368 children: t2$1 26369 }); 26370 $[8] = props; 26371 $[9] = t3; 26372 } else t3 = $[9]; 26373 return t3; 26374 } 26375 let t2; 26376 if ($[10] !== children) { 26377 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children }); 26378 $[10] = children; 26379 $[11] = t2; 26380 } else t2 = $[11]; 26381 return t2; 26382} 26383var dialer_settings_spinner_default = DialerSettingsSpinner; 26384var import_compiler_runtime$26 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 26385function Switch(t0) { 26386 const $ = (0, import_compiler_runtime$26.c)(9); 26387 let className; 26388 let props; 26389 if ($[0] !== t0) { 26390 ({className, ...props} = t0); 26391 $[0] = t0; 26392 $[1] = className; 26393 $[2] = props; 26394 } else { 26395 className = $[1]; 26396 props = $[2]; 26397 } 26398 let t1; 26399 if ($[3] !== className) { 26400 t1 = cn("peer inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/20 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80", className); 26401 $[3] = className; 26402 $[4] = t1; 26403 } else t1 = $[4]; 26404 let t2; 26405 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 26406 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Thumb$1, { 26407 "data-slot": "switch-thumb", 26408 className: cn("pointer-events-none block size-4 rounded-full bg-background ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dar
26408k:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground") 26409 }); 26410 $[5] = t2; 26411 } else t2 = $[5]; 26412 let t3; 26413 if ($[6] !== props || $[7] !== t1) { 26414 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root$5, { 26415 "data-slot": "switch", 26416 className: t1, 26417 ...props, 26418 children: t2 26419 }); 26420 $[6] = props; 26421 $[7] = t1; 26422 $[8] = t3; 26423 } else t3 = $[8]; 26424 return t3; 26425} 26426var import_compiler_runtime$25 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 26427function DialerUnbindPhoneNumberDialog(t0) { 26428 const $ = (0, import_compiler_runtime$25.c)(13); 26429 const { open, onOpenChange, onConfirm, cancelButtonProps, confirmButtonProps } = t0; 26430 let t1; 26431 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 26432 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogHeader, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogTitle, { children: "Delete Verified Number Confirmation" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogDescription, { children: "Are you sure you want to delete this verified number?" })] }); 26433 $[0] = t1; 26434 } else t1 = $[0]; 26435 let t2; 26436 if ($[1] !== cancelButtonProps) { 26437 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogCancel, { 26438 ...cancelButtonProps, 26439 children: "Cancel" 26440 }); 26441 $[1] = cancelButtonProps; 26442 $[2] = t2; 26443 } else t2 = $[2]; 26444 let t3; 26445 if ($[3] !== confirmButtonProps || $[4] !== onConfirm) { 26446 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 26447 ...confirmButtonProps, 26448 onClick: onConfirm, 26449 children: "Confirm" 26450 }); 26451 $[3] = confirmButtonProps; 26452 $[4] = onConfirm; 26453 $[5] = t3; 26454 } else t3 = $[5]; 26455 let t4; 26456 if ($[6] !== t2 || $[7] !== t3) { 26457 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogContent, { children: [t1, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogFooter, { children: [t2, t3] })] }); 26458 $[6] = t2; 26459 $[7] = t3; 26460 $[8] = t4; 26461 } else t4 = $[8]; 26462 let t5; 26463 if ($[9] !== onOpenChange || $[10] !== open || $[11] !== t4) { 26464 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialog, { 26465 open, 26466 onOpenChange, 26467 children: t4 26468 }); 26469 $[9] = onOpenChange; 26470 $[10] = open; 26471 $[11] = t4; 26472 $[12] = t5; 26473 } else t5 = $[12]; 26474 return t5; 26475} 26476var dialer_unbind_phone_number_dialog_tsx_default = DialerUnbindPhoneNumberDialog; 26477var import_compiler_runtime$24 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 26478var VERIFY_BADGE_MAPPING = { 26479 SUCCESS: { 26480 label: "Verification succeeded", 26481 icon: CircleCheck, 26482 variant: "success-subtle" 26483 }, 26484 IN_PROGRESS: { 26485 label: "Verification in progress", 26486 icon: Clock8, 26487 variant: "default-subtle" 26488 }, 26489 FAILED: { 26490 label: "Verification failed", 26491 icon: TriangleAlert, 26492 variant: "destructive-subtle" 26493 } 26494}; 26495var callSettingsFormSchema = objectType({ 26496 virtualPhoneId: stringType().min(1), 26497 callRecording: booleanType(), 26498 doNotDisturb: booleanType(), 26499 displayOwnNumber: booleanType(), 26500 forwardCallsToPhone: booleanType(), 26501 verifyCountryCode: stringType(), 26502 verifyPhoneNumber: stringType().regex(/^[+]?[\d\s()-]{7,20}$/, "Enter the correct phone format"), 26503 verificationStatus: enumType([ 26504 "SUCCESS", 26505 "IN_PROGRESS", 26506 "FAILED" 26507 ]).optional(), 26508 inboundVerifyCountryCode: stringType(), 26509 inboundVerifyPhoneNumber: stringType().regex(/^[+]?[\d\s()-]{7,20}$/, "Enter the correct phone format"), 26510 inboundVerificationStatus: enumType([ 26511 "SUCCESS", 26512 "IN_PROGRESS", 26513 "FAILED" 26514 ]).optional() 26515}); 26516var CALL_SETTINGS_DEFAULT = { 26517 virtualPhoneId: "", 26518 callRecording: true, 26519 doNotDisturb: true, 26520 displayOwnNumber: false, 26521 forwardCallsToPhone: false, 26522 verifyCountryCode: "US", 26523 verifyPhoneNumber: "", 26524 inboundVerifyCountryCode: "US", 26525 inboundVerifyPhoneNumber: "" 26526}; 26527function buildPhoneWithDialCode(countryCode, phoneNumber) { 26528 const trimmed = phoneNumber.trim(); 26529 if (trimmed.startsWith("+")) return trimmed; 26530 return `+${COUNTRY_OPTIONS.find((country) => { 26531 return country.code === countryCode; 26532 })?.dialCode ?? ""}${trimmed.replace(/\D/g, "")}`; 26533} 26534function DialerCallSettingsForm(t0) { 26535 const $ = (0, import_compiler_runtime$24.c)(133); 26536 const { dialerUserInfo, initialValues, isFetching } = t0; 26537 const dispatch = useAppDispatch(); 26538 let t1; 26539 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 26540 t1 = t$2(callSettingsFormSchema); 26541 $[0] = t1; 26542 } else t1 = $[0]; 26543 let t2; 26544 if ($[1] !== initialValues) { 26545 t2 = Object.assign(CALL_SETTINGS_DEFAULT, initialValues); 26546 $[1] = initialValues; 26547 $[2] = t2; 26548 } else t2 = $[2]; 26549 let t3; 26550 if ($[3] !== t2) { 26551 t3 = { 26552 resolver: t1, 26553 defaultValues: t2, 26554 mode: "onSubmit" 26555 }; 26556 $[3] = t2; 26557 $[4] = t3; 26558 } else t3 = $[4]; 26559 const form = useForm(t3); 26560 const [unbindOutboundOpen, setUnbindOutboundOpen] = (0, import_react.useState)(false);
26561 const [unbindInboundOpen, setUnbindInboundOpen] = (0, import_react.useState)(false); 26562 const [callTypeLoading, setCallTypeLoading] = (0, import_react.useState)(null); 26563 const [unbindCallTypeLoading, setUnbindCallTypeLoading] = (0, import_react.useState)(null); 26564 const [changeDialerUserPhoneNumber, t4] = useChangeDialerUserPhoneNumberMutation(); 26565 const { isLoading: isChangeDialerUserPhoneNumberLoading } = t4; 26566 const [getTwilioToken, t5] = useLazyGetTwilioTokenQuery(); 26567 const { isLoading: isGetTwilioTokenLoading } = t5; 26568 const [switchDialerSettingCallRecord, t6] = useSwitchDialerSettingCallRecordMutation(); 26569 const { isLoading: isSwitchDialerSettingCallRecordLoading } = t6; 26570 const [verifyDialerUserPhoneNumber, t7] = useVerifyDialerUserPhoneNumberMutation(); 26571 const { isLoading: isVerifyDialerUserPhoneNumberLoading } = t7; 26572 const [unbindDialerUserPhoneNumber, t8] = useUnbindDialerUserPhoneNumberMutation(); 26573 const { isLoading: isUnbindDialerUserPhoneNumberLoading } = t8; 26574 const isOutboundUnbindLoading = isUnbindDialerUserPhoneNumberLoading && unbindCallTypeLoading === "outbound"; 26575 const isInboundUnbindLoading = isUnbindDialerUserPhoneNumberLoading && unbindCallTypeLoading === "inbound"; 26576 let t9; 26577 if ($[5] !== dialerUserInfo) { 26578 t9 = get(dialerUserInfo, "virtualNumber") ?? []; 26579 $[5] = dialerUserInfo; 26580 $[6] = t9; 26581 } else t9 = $[6]; 26582 const virtualNumbers = t9; 26583 let t10; 26584 if ($[7] !== dialerUserInfo) { 26585 t10 = get(dialerUserInfo, "userInfoId"); 26586 $[7] = dialerUserInfo; 26587 $[8] = t10; 26588 } else t10 = $[8]; 26589 const userInfoId = t10; 26590 let t11; 26591 if ($[9] !== dialerUserInfo) { 26592 t11 = get(dialerUserInfo, "outboundRealNumber"); 26593 $[9] = dialerUserInfo; 26594 $[10] = t11; 26595 } else t11 = $[10]; 26596 const outboundRealNumber = t11; 26597 let t12; 26598 if ($[11] !== dialerUserInfo) { 26599 t12 = get(dialerUserInfo, "incomingRealNumber"); 26600 $[11] = dialerUserInfo; 26601 $[12] = t12; 26602 } else t12 = $[12]; 26603 const incomingRealNumber = t12; 26604 let t13; 26605 if ($[13] !== dispatch || $[14] !== form) { 26606 t13 = (message) => { 26607 const { callType, isSuccess } = get(message, "data.data") ?? {}; 26608 const nextStatus = isSuccess ? "SUCCESS" : "FAILED"; 26609 if (callType === "outbound") form.setValue("verificationStatus", nextStatus); 26610 else if (callType === "inbound") form.setValue("inboundVerificationStatus", nextStatus); 26611 if (isSuccess) dispatch(dialersApi.util.invalidateTags([{ 26612 type: "dialers", 26613 id: "USER_DIALER_SETTING_INFO" 26614 }])); 26615 }; 26616 $[13] = dispatch; 26617 $[14] = form; 26618 $[15] = t13; 26619 } else t13 = $[15]; 26620 usePushEvent(VERIFY_PHONE, t13); 26621 let t14; 26622 if ($[16] !== form || $[17] !== verifyDialerUserPhoneNumber) { 26623 t14 = async () => { 26624 trackMethodCall("handleVerifyOutboundPhoneNumber", []); 26625 setCallTypeLoading("outbound"); 26626 if (!await form.trigger(["verifyPhoneNumber", "verifyCountryCode"])) return; 26627 const verifyPhoneNumber = buildPhoneWithDialCode(form.getValues("verifyCountryCode"), form.getValues("verifyPhoneNumber")); 26628 const res = await verifyDialerUserPhoneNumber({ 26629 callType: "outbound", 26630 phoneNumber: verifyPhoneNumber 26631 }); 26632 setCallTypeLoading(null); 26633 const verificationCode = get(res, "data.data"); 26634 if (!verificationCode) { 26635 const errorMessage = get(res, "data.message") ?? "Server error!"; 26636 toast.error(errorMessage, { position: "top-right" }); 26637 return; 26638 } 26639 toast.success(`Verification Code: ${verificationCode}`, { 26640 description: "You will receive a verification call shortly. Please enter the correct verification code as prompted by the phone steps.", 26641 position: "top-right" 26642 }); 26643 form.setValue("verificationStatus", "IN_PROGRESS"); 26644 }; 26645 $[16] = form; 26646 $[17] = verifyDialerUserPhoneNumber; 26647 $[18] = t14; 26648 } else t14 = $[18]; 26649 const handleVerifyOutboundPhoneNumber = t14; 26650 let t15; 26651 if ($[19] !== form || $[20] !== verifyDialerUserPhoneNumber) { 26652 t15 = async () => { 26653 trackMethodCall("handleVerifyInboundPhoneNumber", []); 26654 setCallTypeLoading("inbound"); 26655 if (!await form.trigger(["inboundVerifyPhoneNumber", "inboundVerifyCountryCode"])) return; 26656 const verifyPhoneNumber_0 = buildPhoneWithDialCode(form.getValues("inboundVerifyCountryCode"), form.getValues("inboundVerifyPhoneNumber")); 26657 const res_0 = await verifyDialerUserPhoneNumber({ 26658 callType: "inbound", 26659 phoneNumber: verifyPhoneNumber_0 26660 });
26661 setCallTypeLoading(null); 26662 const verificationCode_0 = get(res_0, "data.data"); 26663 if (!verificationCode_0) { 26664 const errorMessage_0 = get(res_0, "data.message") ?? "Server error!"; 26665 toast.error(errorMessage_0, { position: "top-right" }); 26666 return; 26667 } 26668 toast.success(`Verification Code: ${verificationCode_0}`, { 26669 description: "You will receive a verification call shortly. Please enter the correct verification code as prompted by the phone steps.", 26670 position: "top-right" 26671 }); 26672 form.setValue("inboundVerificationStatus", "IN_PROGRESS"); 26673 }; 26674 $[19] = form; 26675 $[20] = verifyDialerUserPhoneNumber; 26676 $[21] = t15; 26677 } else t15 = $[21]; 26678 const handleVerifyInboundPhoneNumber = t15; 26679 let t16; 26680 if ($[22] !== dispatch) { 26681 t16 = () => { 26682 trackMethodCall("handleManageNumber", []); 26683 dispatch(setOpen(false)); 26684 dispatch(closeNestedSheet()); 26685 }; 26686 $[22] = dispatch; 26687 $[23] = t16; 26688 } else t16 = $[23]; 26689 const handleManageNumber = t16; 26690 let t17; 26691 if ($[24] !== changeDialerUserPhoneNumber || $[25] !== getTwilioToken || $[26] !== virtualNumbers) { 26692 t17 = (onChange) => {
26693 trackMethodCall("handleChangeDialerUserPhoneNumber", [onChange]); 26694 return async (virtualPhoneId) => { 26695 onChange(virtualPhoneId); 26696 const selectedVirtualNumber = virtualNumbers.find((number) => number.virtualNumber === virtualPhoneId); 26697 if (!selectedVirtualNumber || !selectedVirtualNumber.status) return; 26698 const mutationParams = { virtualNumber: selectedVirtualNumber.virtualNumber }; 26699 await mutateWithErrorHandling(changeDialerUserPhoneNumber, mutationParams, { 26700 showSuccessToast: true, 26701 successMessage: "Virtual number changed successfully" 26702 }); 26703 await mutateWithErrorHandling(getTwilioToken, { phoneNumber: selectedVirtualNumber.virtualNumber }); 26704 }; 26705 }; 26706 $[24] = changeDialerUserPhoneNumber; 26707 $[25] = getTwilioToken; 26708 $[26] = virtualNumbers; 26709 $[27] = t17; 26710 } else t17 = $[27]; 26711 const handleChangeDialerUserPhoneNumber = t17; 26712 let t18; 26713 if ($[28] !== switchDialerSettingCallRecord || $[29] !== userInfoId) { 26714 t18 = (onChange_0) => { 26715 trackMethodCall("handleSwitchDialerCallRecordingChange", [onChange_0]); 26716 return async (checked) => { 26717 if (!userInfoId) return; 26718 onChange_0(checked); 26719 await mutateWithErrorHandling(switchDialerSettingCallRecord, { 26720 userInfoId, 26721 callRecordSwitch: checked 26722 }, { 26723 showSuccessToast: true, 26724 successMessage: "Call recording switch updated successfully" 26725 }); 26726 }; 26727 }; 26728 $[28] = switchDialerSettingCallRecord; 26729 $[29] = userInfoId; 26730 $[30] = t18; 26731 } else t18 = $[30]; 26732 const handleSwitchDialerCallRecordingChange = t18; 26733 let t19; 26734 if ($[31] !== outboundRealNumber || $[32] !== switchDialerSettingCallRecord || $[33] !== userInfoId) { 26735 t19 = (onChange_1) => { 26736 trackMethodCall("handleSwitchDialerDisplayOwnNumberChange", [onChange_1]); 26737 return async (checked_0) => { 26738 if (!outboundRealNumber) { 26739 toast.error("Please verify your mobile number first.", { position: "top-center" }); 26740 return; 26741 } 26742 if (!userInfoId) return; 26743 onChange_1(checked_0); 26744 await mutateWithErrorHandling(switchDialerSettingCallRecord, { 26745 userInfoId, 26746 isDisplayRealNumber: checked_0 26747 }, { 26748 showSuccessToast: true, 26749 successMessage: "Display my own number switch updated successfully" 26750 }); 26751 }; 26752 }; 26753 $[31] = outboundRealNumber; 26754 $[32] = switchDialerSettingCallRecord; 26755 $[33] = userInfoId; 26756 $[34] = t19; 26757 } else t19 = $[34]; 26758 const handleSwitchDialerDisplayOwnNumberChange = t19; 26759 let t20; 26760 if ($[35] !== incomingRealNumber || $[36] !== switchDialerSettingCallRecord || $[37] !== userInfoId) { 26761 t20 = (onChange_2) => { 26762 trackMethodCall("handleSwitchForwardCallsToPhoneChange", [onChange_2]); 26763 return async (checked_1) => { 26764 if (!incomingRealNumber) { 26765 toast.error("Please verify your mobile number first.", { position: "top-center" }); 26766 return; 26767 } 26768 if (!userInfoId) return; 26769 onChange_2(checked_1); 26770 await mutateWithErrorHandling(switchDialerSettingCallRecord, { 26771 userInfoId, 26772 simultaneouslyCalledNumber: checked_1 26773 }, { 26774 showSuccessToast: true, 26775 successMessage: "Forward calls to my phone switch updated successfully" 26776 }); 26777 }; 26778 }; 26779 $[35] = incomingRealNumber; 26780 $[36] = switchDialerSettingCallRecord; 26781 $[37] = userInfoId; 26782 $[38] = t20; 26783 } else t20 = $[38]; 26784 const handleSwitchForwardCallsToPhoneChange = t20; 26785 let t21; 26786 if ($[39] !== switchDialerSettingCallRecord || $[40] !== userInfoId) { 26787 t21 = (onChange_3) => { 26788 trackMethodCall("handleSwitchDoNotDisturbChange", [onChange_3]); 26789 return async (checked_2) => { 26790 if (!userInfoId) return; 26791 onChange_3(checked_2); 26792 await mutateWithErrorHandling(switchDialerSettingCallRecord, { 26793 userInfoId, 26794 isDoNotDisturb: checked_2 26795 }, { 26796 showSuccessToast: true, 26797 successMessage: "Do not disturb switch updated successfully" 26798 }); 26799 }; 26800 }; 26801 $[39] = switchDialerSettingCallRecord; 26802 $[40] = userInfoId; 26803 $[41] = t21; 26804 } else t21 = $[41]; 26805 const handleSwitchDoNotDisturbChange = t21; 26806 let t22; 26807 if ($[42] !== form) { 26808 t22 = () => { 26809 trackMethodCall("handleCancelVerification", []); 26810 form.setValue("verificationStatus", void 0); 26811 form.setValue("verifyPhoneNumber", ""); 26812 form.setValue("verifyCountryCode", "US"); 26813 }; 26814 $[42] = form; 26815 $[43] = t22; 26816 } else t22 = $[43]; 26817 const handleCancelVerification = t22; 26818 let t23; 26819 if ($[44] !== form) { 26820 t23 = () => { 26821 trackMethodCall("handleCancelInboundVerification", []); 26822 form.setValue("inboundVerificationStatus", void 0); 26823 form.setValue("inboundVerifyPhoneNumber", ""); 26824 form.setValue("inboundVerifyCountryCode", "US"); 26825 }; 26826 $[44] = form; 26827 $[45] = t23; 26828 } else t23 = $[45]; 26829 const handleCancelInboundVerification = t23; 26830 let t24; 26831 if ($[46] !== form || $[47] !== handleCancelVerification || $[48] !== unbindDialerUserPhoneNumber) { 26832 t24 = async () => {
26833 trackMethodCall("handleUnbindDialerUserPhoneNumber", []); 26834 setUnbindCallTypeLoading("outbound"); 26835 const mutationParams_4 = { 26836 callType: "outbound", 26837 phoneNumber: buildPhoneWithDialCode(form.getValues("verifyCountryCode"), form.getValues("verifyPhoneNumber")) 26838 }; 26839 await mutateWithErrorHandling(unbindDialerUserPhoneNumber, mutationParams_4, { 26840 showSuccessToast: true, 26841 successMessage: "Unbind dialer user phone number successfully" 26842 }); 26843 setUnbindCallTypeLoading(null); 26844 handleCancelVerification(); 26845 setUnbindOutboundOpen(false); 26846 }; 26847 $[46] = form; 26848 $[47] = handleCancelVerification; 26849 $[48] = unbindDialerUserPhoneNumber; 26850 $[49] = t24; 26851 } else t24 = $[49]; 26852 const handleUnbindDialerUserPhoneNumber = t24; 26853 let t25; 26854 if ($[50] !== form || $[51] !== handleCancelInboundVerification || $[52] !== unbindDialerUserPhoneNumber) { 26855 t25 = async () => { 26856 trackMethodCall("handleUnbindInboundDialerUserPhoneNumber", []); 26857 setUnbindCallTypeLoading("inbound"); 26858 const mutationParams_5 = { 26859 callType: "inbound", 26860 phoneNumber: buildPhoneWithDialCode(form.getValues("inboundVerifyCountryCode"), form.getValues("inboundVerifyPhoneNumber")) 26861 }; 26862 await mutateWithErrorHandling(unbindDialerUserPhoneNumber, mutationParams_5, { 26863 showSuccessToast: true, 26864 successMessage: "Unbind dialer user phone number successfully" 26865 }); 26866 setUnbindCallTypeLoading(null); 26867 handleCancelInboundVerification(); 26868 setUnbindInboundOpen(false); 26869 }; 26870 $[50] = form; 26871 $[51] = handleCancelInboundVerification; 26872 $[52] = unbindDialerUserPhoneNumber; 26873 $[53] = t25; 26874 } else t25 = $[53]; 26875 const handleUnbindInboundDialerUserPhoneNumber = t25; 26876 let t26; 26877 if ($[54] !== form) { 26878 t26 = form.handleSubmit(_temp$5, console.warn); 26879 $[54] = form; 26880 $[55] = t26; 26881 } else t26 = $[55]; 26882 const t27 = isFetching || isSwitchDialerSettingCallRecordLoading; 26883 let t28; 26884 if ($[56] !== handleChangeDialerUserPhoneNumber || $[57] !== handleManageNumber || $[58] !== isChangeDialerUserPhoneNumberLoading || $[59] !== isGetTwilioTokenLoading || $[60] !== virtualNumbers) { 26885 t28 = (t29$1) => { 26886 const { field, fieldState } = t29$1; 26887 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Field, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 26888 className: "flex items-center justify-between", 26889 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldLabel, { 26890 htmlFor: "field-" + field.name, 26891 children: "Virtual Number" 26892 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 26893 type: "button", 26894 variant: "link", 26895 className: "h-auto p-0 text-sm font-medium", 26896 asChild: true, 26897 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, { 26898 to: "/settings/dialer-settings", 26899 onClick: handleManageNumber, 26900 children: "Manage Number" 26901 }) 26902 })] 26903 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select, { 26904 ...field, 26905 value: field.value, 26906 onValueChange: handleChangeDialerUserPhoneNumber(field.onChange), 26907 disabled: isChangeDialerUserPhoneNumberLoading, 26908 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectTrigger, { 26909 id: "field-" + field.name, 26910 className: "w-full", 26911 "aria-invalid": fieldState.invalid, 26912 children: isChangeDialerUserPhoneNumberLoading || isGetTwilioTokenLoading ? /* @__P
26912URE__ */ (0, import_jsx_runtime.jsx)(SelectValue, { 26913 placeholder: "Select a virtual number", 26914 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { className: "text-primary" }) 26915 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectValue, { placeholder: "Select a virtual number" }) 26916 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContent, { children: virtualNumbers.map(_temp2$2) })] 26917 })] }); 26918 }; 26919 $[56] = handleChangeDialerUserPhoneNumber; 26920 $[57] = handleManageNumber; 26921 $[58] = isChangeDialerUserPhoneNumberLoading; 26922 $[59] = isGetTwilioTokenLoading; 26923 $[60] = virtualNumbers; 26924 $[61] = t28; 26925 } else t28 = $[61]; 26926 let t29; 26927 if ($[62] !== form.control || $[63] !== t28) { 26928 t29 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Controller, { 26929 control: form.control, 26930 name: "virtualPhoneId", 26931 render: t28 26932 }); 26933 $[62] = form.control; 26934 $[63] = t28; 26935 $[64] = t29; 26936 } else t29 = $[64]; 26937 let t30; 26938 if ($[65] !== handleSwitchDialerCallRecordingChange) { 26939 t30 = (t31$1) => { 26940 const { field: field_0 } = t31$1; 26941 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 26942 className: "flex items-center justify-between pt-2.5", 26943 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 26944 className: "flex items-center gap-1", 26945 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldLabel, { 26946 htmlFor: "field-" + field_0.name, 26947 children: "Call Recording" 26948 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 26949 asChild: true, 26950 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Info, { className: "size-4 cursor-help text-muted-foreground" }) 26951 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { 26952 className: "max-w-62", 26953 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Enabling this feature records all calls made and are saved for each contact." }) 26954 })] })] 26955 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Switch, { 26956 id: "field-" + field_0.name, 26957 checked: field_0.value, 26958 onCheckedChange: handleSwitchDialerCallRecordingChange(field_0.onChange) 26959 })] 26960 }); 26961 }; 26962 $[65] = handleSwitchDialerCallRecordingChange; 26963 $[66] = t30; 26964 } else t30 = $[66]; 26965 let t31; 26966 if ($[67] !== form.control || $[68] !== t30) { 26967 t31 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Controller, { 26968 control: form.control, 26969 name: "callRecording", 26970 render: t30 26971 }); 26972 $[67] = form.control; 26973 $[68] = t30; 26974 $[69] = t31; 26975 } else t31 = $[69]; 26976 let t32; 26977 if ($[70] !== t29 || $[71] !== t31) { 26978 t32 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [t29, t31] }); 26979 $[70] = t29; 26980 $[71] = t31; 26981 $[72] = t32; 26982 } else t32 = $[72]; 26983 let t33; 26984 if ($[73] === Symbol.for("react.memo_cache_sentinel")) { 26985 t33 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { 26986 className: "font-semibold text-muted-foreground", 26987 children: "Outbound Call" 26988 }); 26989 $[73] = t33; 26990 } else t33 = $[73]; 26991 let t34; 26992 if ($[74] !== handleSwitchDialerDisplayOwnNumberChange) { 26993 t34 = (t35$1) => { 26994 const { field: field_1 } = t35$1; 26995 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 26996 className: "flex items-center justify-between py-2.5", 26997 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 26998 className: "flex items-center gap-1", 26999 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldLabel, { 27000 htmlFor: "field-" + field_1.name, 27001 children: "Display My Own Number" 27002 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 27003 asChild: true, 27004 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Info, { className: "size-4 cursor-help text-muted-foreground" }) 27005 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { 27006 className: "max-w-62", 27007 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Enabling this feature means that when you use a virtual number to make an outbound call, the receiver will see your real number." }) 27008 })] })] 27009 }
27009), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Switch, { 27010 id: "field-" + field_1.name, 27011 checked: field_1.value, 27012 onCheckedChange: handleSwitchDialerDisplayOwnNumberChange(field_1.onChange) 27013 })] 27014 }); 27015 }; 27016 $[74] = handleSwitchDialerDisplayOwnNumberChange; 27017 $[75] = t34; 27018 } else t34 = $[75]; 27019 let t35; 27020 if ($[76] !== form.control || $[77] !== t34) { 27021 t35 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Controller, { 27022 control: form.control, 27023 name: "displayOwnNumber", 27024 render: t34 27025 }); 27026 $[76] = form.control; 27027 $[77] = t34; 27028 $[78] = t35; 27029 } else t35 = $[78]; 27030 let t36; 27031 if ($[79] !== callTypeLoading || $[80] !== form.control || $[81] !== handleCancelVerification || $[82] !== handleUnbindDialerUserPhoneNumber || $[83] !== handleVerifyOutboundPhoneNumber || $[84] !== isOutboundUnbindLoading || $[85] !== isVerifyDialerUserPhoneNumberLoading || $[86] !== unbindOutboundOpen) { 27032 t36 = (t37$1) => { 27033 const { field: t38$1 } = t37$1; 27034 const { value: verificationStatus } = t38$1; 27035 if (typeof verificationStatus === "string") { 27036 const { label, icon: Icon$1, variant } = VERIFY_BADGE_MAPPING[verificationStatus]; 27037 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27038 className: "flex flex-col gap-3", 27039 children: [ 27040 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 27041 className: "text-sm font-medium text-foreground", 27042 children: "Verify My Own Number" 27043 }), 27044 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27045 className: "flex items-center gap-1.5", 27046 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Controller, { 27047 control: form.control, 27048 name: "verifyPhoneNumber", 27049 render: _temp3$1 27050 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Badge, { 27051 variant, 27052 className: "h-5", 27053 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon$1, { className: "size-3" }), label] 27054 })] 27055 }),
27056 verificationStatus !== "SUCCESS" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 27057 type: "button", 27058 className: "w-full", 27059 variant: "outline", 27060 onClick: handleCancelVerification, 27061 children: "Cancel Verification" 27062 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 27063 type: "button", 27064 className: "w-full", 27065 variant: "outline", 27066 onClick: () => setUnbindOutboundOpen(true), 27067 disabled: isOutboundUnbindLoading, 27068 loading: isOutboundUnbindLoading, 27069 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2, { className: "size-4" }), "Delete Verified Number"] 27070 }), 27071 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_unbind_phone_number_dialog_tsx_default, { 27072 open: unbindOutboundOpen, 27073 onOpenChange: setUnbindOutboundOpen, 27074 onConfirm: handleUnbindDialerUserPhoneNumber, 27075 cancelButtonProps: { disabled: isOutboundUnbindLoading }, 27076 confirmButtonProps: { 27077 loading: isOutboundUnbindLoading, 27078 disabled: isOutboundUnbindLoading 27079 } 27080 }) 27081 ] 27082 }); 27083 } 27084 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27085 className: "flex flex-col gap-3", 27086 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Controller, { 27087 control: form.control, 27088 name: "verifyPhoneNumber", 27089 render: (t39$1) => { 27090 const { field: field_3, fieldState: fieldState_0 } = t39$1; 27091 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Field, { 27092 className: "gap-3", 27093 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldLabel, { 27094 htmlFor: "field-" + field_3.name, 27095 children: "Verify My Own Number" 27096 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27097 className: "flex gap-2", 27098 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Controller, { 27099 control: form.control, 27100 name: "verifyCountryCode", 27101 render: _temp5$1 27102 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Field, { 27103 className: "flex-1", 27104 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input, { 27105 id: "field-" + field_3.name, 27106 "aria-invalid": fieldState_0.invalid, 27107 type: "tel", 27108 placeholder: "Phone Number", 27109 ...field_3, 27110 value: field_3.value ? formatPhone(normalizePhone(field_3.value), "parentheses") : "", 27111 onChange: (event) => field_3.onChange(getNumberValue(event.target.value)), 27112 inputMode: "numeric", 27113 maxLength: 14, 27114 className: "w-full" 27115 }), fieldState_0.invalid && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldError, { errors: [fieldState_0.error] })] 27116 })] 27117 })] 27118 }); 27119 } 27120 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 27121 type: "button", 27122 form: "call-settings-form", 27123 className: "w-full", 27124 disabled: isVerifyDialerUserPhoneNumberLoading && callTypeLoading === "outbound", 27125 loading: isVerifyDialerUserPhoneNumberLoading && callTypeLoading === "outbound", 27126 onClick: handleVerifyOutboundPhoneNumber, 27127 children: "Verify" 27128 })] 27129 }); 27130 }; 27131 $[79] = callTypeLoading; 27132 $[80] = form.control; 27133 $[81] = handleCancelVerification; 27134 $[82] = handleUnbindDialerUserPhoneNumber; 27135 $[83] = handleVerifyOutboundPhoneNumber; 27136 $[84] = isOutboundUnbindLoading; 27137 $[85] = isVerifyDialerUserPhoneNumberLoading; 27138 $[86] = unbindOutboundOpen; 27139 $[87] = t36; 27140 } else t36 = $[87]; 27141 let t37; 27142 if ($[88] !== form.control || $[89] !== t36) { 27143 t37 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Controller, { 27144 control: form.control, 27145 name: "verificationStatus", 27146 render: t36 27147 }); 27148 $[88] = form.control; 27149 $[89] = t36; 27150 $[90] = t37; 27151 } else t37 = $[90]; 27152 let t38; 27153 if ($[91] !== t35 || $[92] !== t37) { 27154 t38 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [ 27155 t33, 27156 t35, 27157 t37 27158 ] }); 27159 $[91] = t35; 27160 $[92] = t37; 27161 $[93] = t38; 27162 } else t38 = $[93]; 27163 let t39; 27164 if ($[94] === Symbol.for("react.memo_cache_sentinel")) { 27165 t39 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { 27166 className: "font-semibold text-muted-foreground", 27167 children: "Inbound Call" 27168 }); 27169 $[94] = t39; 27170 } else t39 = $[94]; 27171 let t40; 27172 if ($[95] !== handleSwitchDoNotDisturbChange) { 27173 t40 = (t41$1) => { 27174 const { field: field_5 } = t41$1; 27175 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27176 className: "flex items-center justify-between pt-2.5", 27177 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27178 className: "flex items-center gap-1", 27179 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldLabel, { 27180 htmlFor: "field-" + field_5.name, 27181 children: "Do Not Disturb" 27182 }
27182), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 27183 asChild: true, 27184 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Info, { className: "size-4 cursor-help text-muted-foreground" }) 27185 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { 27186 className: "max-w-62", 27187 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Calls are automatically forwarded to voicemail when turned on." }) 27188 })] })] 27189 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Switch, { 27190 id: "field-" + field_5.name, 27191 checked: field_5.value, 27192 onCheckedChange: handleSwitchDoNotDisturbChange(field_5.onChange) 27193 })] 27194 }); 27195 }; 27196 $[95] = handleSwitchDoNotDisturbChange; 27197 $[96] = t40; 27198 } else t40 = $[96]; 27199 let t41; 27200 if ($[97] !== form.control || $[98] !== t40) { 27201 t41 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Controller, { 27202 control: form.control, 27203 name: "doNotDisturb", 27204 render: t40 27205 }); 27206 $[97] = form.control; 27207 $[98] = t40; 27208 $[99] = t41; 27209 } else t41 = $[99]; 27210 let t42; 27211 if ($[100] !== form.control || $[101] !== handleSwitchForwardCallsToPhoneChange) { 27212 t42 = (t43$1) => { 27213 const { field: field_6 } = t43$1; 27214 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27215 className: "flex items-center justify-between pt-2.5 pb-4", 27216 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27217 className: "flex items-center gap-1", 27218 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldLabel, { 27219 htmlFor: "field-" + field_6.name, 27220 children: "Forward calls to my phone" 27221 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 27222 asChild: true, 27223 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Info, { className: "size-4 cursor-help text-muted-foreground" }) 27224 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { 27225 className: "max-w-62", 27226 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "You will receive incoming calls via the browser by default. To avoid missing any calls, you can type in a phone number below and the incoming call will be forwarded to your phone or landline at the same time." }) 27227 })] })] 27228 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Controller, { 27229 control: form.control, 27230 name: "verificationStatus", 27231 render: (t44$1) => { 27232 const { field: t45$1 } = t44$1; 27233 const { value: verificationStatus_0 } = t45$1; 27234 const isDisabled_0 = verificationStatus_0 !== "SUCCESS"; 27235 const switchComponent = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Switch, { 27236 id: "field-" + field_6.name, 27237 checked: field_6.value, 27238 onCheckedChange: handleSwitchForwardCallsToPhoneChange(field_6.onChange), 27239 disabled: isDisabled_0 27240 }, field_6.name); 27241 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [isDisabled_0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 27242 asChild: true, 27243 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: switchComponent }) 27244 }) : switchComponent, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { 27245 className: "max-w-62", 27246 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Please verify your mobile number first." }) 27247 })] }); 27248 } 27249 })] 27250 }); 27251 }; 27252 $[100] = form.control; 27253 $[101] = handleSwitchForwardCallsToPhoneChange; 27254 $[102] = t42; 27255 } else t42 = $[102]; 27256 let t43; 27257 if ($[103] !== form.control || $[104] !== t42) { 27258 t43 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Controller, { 27259 control: form.control, 27260 name: "forwardCallsToPhone", 27261 render: t42 27262 }); 27263 $[103] = form.control; 27264 $[104] = t42; 27265 $[105] = t43; 27266 } else t43 = $[105]; 27267 let t44; 27268 if ($[106] !== callTypeLoading || $[107] !== form.control || $[108] !== handleCancelInboundVerification || $[109] !== handleUnbindInboundDialerUserPhoneNumber || $[110] !== handleVerifyInboundPhoneNumber || $[111] !== isInboundUnbindLoading || $[112] !== isVerifyDialerUserPhoneNumberLoading || $[113] !== unbindInbou
27268ndOpen) { 27269 t44 = (t45$1) => { 27270 const { field: t46$1 } = t45$1; 27271 const { value: verificationStatus_1 } = t46$1; 27272 if (typeof verificationStatus_1 === "string") { 27273 const { label: label_0, icon: Icon_0, variant: variant_0 } = VERIFY_BADGE_MAPPING[verificationStatus_1]; 27274 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27275 className: "flex flex-col gap-3", 27276 children: [ 27277 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 27278 className: "text-sm font-medium text-foreground", 27279 children: "Verify My Own Number" 27280 }), 27281 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27282 className: "flex items-center gap-1.5", 27283 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Controller, { 27284 control: form.control, 27285 name: "inboundVerifyPhoneNumber", 27286 render: _temp6 27287 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Badge, { 27288 variant: variant_0, 27289 className: "h-5", 27290 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon_0, { className: "size-3" }), label_0] 27291 })] 27292 }),
27293 verificationStatus_1 !== "SUCCESS" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 27294 type: "button", 27295 className: "w-full", 27296 variant: "outline", 27297 onClick: handleCancelInboundVerification, 27298 children: "Cancel Verification" 27299 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 27300 type: "button", 27301 className: "w-full", 27302 variant: "outline", 27303 onClick: () => setUnbindInboundOpen(true), 27304 disabled: isInboundUnbindLoading, 27305 loading: isInboundUnbindLoading, 27306 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2, { className: "size-4" }), "Delete Verified Number"] 27307 }), 27308 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_unbind_phone_number_dialog_tsx_default, { 27309 open: unbindInboundOpen, 27310 onOpenChange: setUnbindInboundOpen, 27311 onConfirm: handleUnbindInboundDialerUserPhoneNumber, 27312 cancelButtonProps: { disabled: isInboundUnbindLoading }, 27313 confirmButtonProps: { 27314 loading: isInboundUnbindLoading, 27315 disabled: isInboundUnbindLoading 27316 } 27317 }) 27318 ] 27319 }); 27320 } 27321 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27322 className: "flex flex-col gap-3", 27323 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Controller, { 27324 control: form.control, 27325 name: "inboundVerifyPhoneNumber", 27326 render: (t47$1) => { 27327 const { field: field_8, fieldState: fieldState_1 } = t47$1; 27328 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Field, { 27329 className: "gap-3", 27330 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldLabel, { 27331 htmlFor: "field-" + field_8.name, 27332 children: "Verify My Own Number" 27333 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27334 className: "flex gap-2", 27335 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Controller, { 27336 control: form.control, 27337 name: "inboundVerifyCountryCode", 27338 render: _temp8 27339 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Field, { 27340 className: "flex-1", 27341 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input, { 27342 id: "field-" + field_8.name, 27343 "aria-invalid": fieldState_1.invalid, 27344 type: "tel", 27345 placeholder: "Phone Number", 27346 ...field_8, 27347 value: field_8.value ? formatPhone(normalizePhone(field_8.value), "parentheses") : "", 27348 onChange: (event_0) => field_8.onChange(getNumberValue(event_0.target.value)), 27349 inputMode: "numeric", 27350 maxLength: 14, 27351 className: "w-full" 27352 }), fieldState_1.invalid && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldError, { errors: [fieldState_1.error] })] 27353 })] 27354 })] 27355 }); 27356 } 27357 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 27358 type: "button", 27359 form: "call-settings-form", 27360 className: "w-full", 27361 disabled: isVerifyDialerUserPhoneNumberLoading && callTypeLoading === "inbound", 27362 loading: isVerifyDialerUserPhoneNumberLoading && callTypeLoading === "inbound", 27363 onClick: handleVerifyInboundPhoneNumber, 27364 children: "Verify" 27365 })] 27366 }); 27367 }; 27368 $[106] = callTypeLoading; 27369 $[107] = form.control; 27370 $[108] = handleCancelInboundVerification; 27371 $[109] = handleUnbindInboundDialerUserPhoneNumber; 27372 $[110] = handleVerifyInboundPhoneNumber; 27373 $[111] = isInboundUnbindLoading; 27374 $[112] = isVerifyDialerUserPhoneNumberLoading; 27375 $[113] = unbindInboundOpen; 27376 $[114] = t44; 27377 } else t44 = $[114]; 27378 let t45; 27379 if ($[115] !== form.control || $[116] !== t44) { 27380 t45 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Controller, { 27381 control: form.control, 27382 name: "inboundVerificationStatus", 27383 render: t44 27384 }); 27385 $[115] = form.control; 27386 $[116] = t44; 27387 $[117] = t45; 27388 } else t45 = $[117]; 27389 let t46; 27390 if ($[118] !== t41 || $[119] !== t43 || $[120] !== t45) { 27391 t46 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [ 27392 t39, 27393 t41, 27394 t43, 27395 t45 27396 ] }); 27397 $[118] = t41; 27398 $[119] = t43; 27399 $[120] = t45; 27400 $[121] = t46; 27401 } else t46 = $[121]; 27402 let t47; 27403 if ($[122] !== t32 || $[123] !== t38 || $[124] !== t46) { 27404 t47 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27405 className: "flex flex-col gap-6 pb-5", 27406 children: [ 27407 t32, 27408 t38, 27409 t46 27410 ] 27411 }); 27412 $[122] = t32; 27413 $[123] = t38; 27414 $[124] = t46; 27415 $[125] = t47; 27416 } else t47 = $[125]; 27417 let t48; 27418 if ($[126] !== t27 || $[127] !== t47) { 27419 t48 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spin, { 27420 spinning: t27, 27421 children: t47 27422 }); 27423 $[126] = t27; 27424 $[127] = t47; 27425 $[128] = t48; 27426 } else t48 = $[128]; 27427 let t49; 27428 if ($[129] !== form || $[130] !== t26 || $[131] !== t48) { 27429 t49 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormWrapper, { 27430 form, 27431 id: "call-settings-form", 27432 onSubmit: t26, 27433 children: t48 27434 }); 27435 $[129] = form; 27436 $[130] = t26; 27437 $[131] = t48; 27438 $[132] = t49; 27439 } else t49 = $[132]; 27440 return t49; 27441} 27442function _temp8(t0) { 27443 const { field: field_9 } = t0; 27444 const selectedCountry_0 = COUNTRY_OPTIONS.find((country_1) =>
27444 country_1.code === field_9.value); 27445 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select, { 27446 ...field_9, 27447 value: field_9.value, 27448 onValueChange: field_9.onChange, 27449 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectTrigger, { 27450 className: "w-24 shrink-0", 27451 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectValue, { 27452 placeholder: "Select a country", 27453 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27454 className: "flex items-center gap-2", 27455 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 27456 name: selectedCountry_0?.flag ?? "", 27457 className: "size-4" 27458 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: ["+", selectedCountry_0?.dialCode] })] 27459 }) 27460 }) 27461 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContent, { 27462 align: "start", 27463 children: COUNTRY_OPTIONS.map(_temp7) 27464 })] 27465 }); 27466} 27467function _temp7(country_2) { 27468 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, { 27469 value: country_2.code, 27470 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27471 className: "flex items-center gap-2", 27472 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 27473 name: country_2.flag, 27474 className: "size-4" 27475 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [ 27476 country_2.name, 27477 " +", 27478 country_2.dialCode 27479 ] })] 27480 }) 27481 }, country_2.code); 27482} 27483function _temp6(t0) { 27484 const { field: field_7 } = t0; 27485 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27486 className: "text-xs text-muted-foreground", 27487 children: ["Current: ", formatPhone(normalizePhone(field_7.value), "parentheses")] 27488 }); 27489} 27490function _temp5$1(t0) { 27491 const { field: field_4 } = t0; 27492 const selectedCountry = COUNTRY_OPTIONS.find((country) => country.code === field_4.value); 27493 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select, { 27494 ...field_4, 27495 value: field_4.value, 27496 onValueChange: field_4.onChange, 27497 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectTrigger, { 27498 className: "w-24 shrink-0", 27499 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectValue, { 27500 placeholder: "Select a country", 27501 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27502 className: "flex items-center gap-2", 27503 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 27504 name: selectedCountry?.flag ?? "", 27505 className: "size-4" 27506 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: ["+", selectedCountry?.dialCode] })] 27507 }) 27508 }) 27509 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContent, { 27510 align: "start", 27511 children: COUNTRY_OPTIONS.map(_temp4$1) 27512 })] 27513 }); 27514} 27515function _temp4$1(country_0) { 27516 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, { 27517 value: country_0.code, 27518 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27519 className: "flex items-center gap-2", 27520 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 27521 name: country_0.flag, 27522 className: "size-4" 27523 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [ 27524 country_0.name, 27525 " +", 27526 country_0.dialCode 27527 ] })] 27528 }) 27529 }, country_0.code); 27530} 27531function _temp3$1(t0) { 27532 const { field: field_2 } = t0; 27533 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27534 className: "text-xs text-muted-foreground", 27535 children: ["Current: ", formatPhone(normalizePhone(field_2.value), "parentheses")] 27536 }); 27537} 27538function _temp2$2(number_0) { 27539 const isDisabled = !number_0.status; 27540 const virtualNumSelectItem = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, { 27541 value: number_0.virtualNumber, 27542 disabled: isDisabled, 27543 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27544 className: "flex items-center gap-2", 27545 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: cn("size-2 rounded-full", number_0.status ? "bg-success" : "bg-destructive") }
27545), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: formatPhone(normalizePhone(number_0.virtualNumber), "parentheses") })] 27546 }) 27547 }, number_0.virtualNumber); 27548 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [isDisabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, { 27549 disabled: !number_0.status, 27550 children: virtualNumSelectItem 27551 }) : virtualNumSelectItem, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "This number is failed and can't be selected." }) })] }, number_0.virtualNumber); 27552} 27553function _temp$5() {} 27554var dialer_call_settings_form_default = DialerCallSettingsForm; 27555var import_compiler_runtime$23 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 27556function DialerSettingsCallSetting() { 27557 const $ = (0, import_compiler_runtime$23.c)(25); 27558 const { data: userDialerSettingInfoResponse, isLoading, isFetching } = useGetUserDialerSettingInfoQuery(); 27559 let dialerUserInfo; 27560 let t0; 27561 let virtualNumbers; 27562 if ($[0] !== userDialerSettingInfoResponse) { 27563 dialerUserInfo = get(userDialerSettingInfoResponse, "data"); 27564 virtualNumbers = get(dialerUserInfo, "virtualNumber") ?? []; 27565 t0 = virtualNumbers.find(_temp$4); 27566 $[0] = userDialerSettingInfoResponse; 27567 $[1] = dialerUserInfo; 27568 $[2] = t0; 27569 $[3] = virtualNumbers; 27570 } else { 27571 dialerUserInfo = $[1]; 27572 t0 = $[2]; 27573 virtualNumbers = $[3]; 27574 } 27575 const t1 = t0?.virtualNumber ?? ""; 27576 const t2 = dialerUserInfo?.callRecordSwitch; 27577 const t3 = dialerUserInfo?.isDisplayRealNumber; 27578 const t4 = dialerUserInfo?.isDoNotDisturb; 27579 const t5 = dialerUserInfo?.simultaneouslyCalledNumber; 27580 const t6 = dialerUserInfo?.outboundRealNumber ?? ""; 27581 const t7 = dialerUserInfo?.outboundRealNumber ? "SUCCESS" : void 0; 27582 const t8 = dialerUserInfo?.incomingRealNumber ?? ""; 27583 const t9 = dialerUserInfo?.incomingRealNumber ? "SUCCESS" : void 0; 27584 let t10; 27585 if ($[4] !== t1 || $[5] !== t2 || $[6] !== t3 || $[7] !== t4 || $[8] !== t5 || $[9] !== t6 || $[10] !== t7 || $[11] !== t8 || $[12] !== t9) { 27586 t10 = { 27587 virtualPhoneId: t1, 27588 callRecording: t2, 27589 displayOwnNumber: t3, 27590 doNotDisturb: t4, 27591 forwardCallsToPhone: t5, 27592 verifyPhoneNumber: t6, 27593 verificationStatus: t7, 27594 inboundVerifyPhoneNumber: t8, 27595 inboundVerificationStatus: t9 27596 }; 27597 $[4] = t1; 27598 $[5] = t2; 27599 $[6] = t3; 27600 $[7] = t4; 27601 $[8] = t5; 27602 $[9] = t6; 27603 $[10] = t7; 27604 $[11] = t8; 27605 $[12] = t9; 27606 $[13] = t10; 27607 } else t10 = $[13]; 27608 const initValues = t10; 27609 let t11; 27610 if ($[14] !== initValues) { 27611 t11 = Object.values(initValues); 27612 $[14] = initValues; 27613 $[15] = t11; 27614 } else t11 = $[15]; 27615 const formKey = t11.join("-"); 27616 let t12; 27617 if ($[16] !== dialerUserInfo || $[17] !== formKey || $[18] !== initValues || $[19] !== isFetching || $[20] !== virtualNumbers.length) { 27618 t12 = virtualNumbers.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_call_settings_form_default, { 27619 dialerUserInfo, 27620 initialValues: initValues, 27621 isFetching 27622 }, formKey) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NoVirtualNumber, {}); 27623 $[16] = dialerUserInfo; 27624 $[17] = formKey; 27625 $[18] = initValues; 27626 $[19] = isFetching; 27627 $[20] = virtualNumbers.length; 27628 $[21] = t12; 27629 } else t12 = $[21]; 27630 let t13; 27631 if ($[22] !== isLoading || $[23] !== t12) { 27632 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_settings_spinner_default, { 27633 spinning: isLoading, 27634 children: t12 27635 }); 27636 $[22] = isLoading; 27637 $[23] = t12; 27638 $[24] = t13; 27639 } else t13 = $[24]; 27640 return t13; 27641} 27642function _temp$4(number) { 27643 return number.currentActive; 27644} 27645function NoVirtualNumber() { 27646 const $ = (0, import_compiler_runtime$23.c)(5); 27647 const dispatch = useAppDispatch(); 27648 let t0; 27649 if ($[0] !== dispatch) { 27650 t0 = () => { 27651 trackMethodCall("handleAddNumbers", []); 27652 dispatch(setOpen(false)); 27653 dispatch(closeNestedSheet()); 27654 }; 27655 $[0] = dispatch; 27656 $[1] = t0; 27657 } else t0 = $[1]; 27658 const handleAddNumbers = t0; 27659 let t1; 27660 if ($[2] === Symbol.for("react.memo_cache_sentinel")) { 27661 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 27662 className: "text-sm leading-none font-medium text-foreground", 27663 children: "Virtual Number" 27664 }); 27665 $[2] = t1; 27666 } else t1 = $[2]; 27667 let t2; 27668 if ($[3] !== handleAddNumbers) { 27669 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27670 className: "flex flex-col gap-2 pb-5",
27671 children: [t1, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 27672 className: "text-sm leading-5 text-muted-foreground", 27673 children: [ 27674 "You don't have a virtual number yet. Please go to", 27675 " ", 27676 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 27677 type: "button", 27678 variant: "link", 27679 className: "h-auto p-0 font-normal text-primary hover:underline", 27680 asChild: true, 27681 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, { 27682 to: "/settings/dialer-settings", 27683 onClick: handleAddNumbers, 27684 children: "Add Number(s)" 27685 }) 27686 }), 27687 " ", 27688 "or contact your admin." 27689 ] 27690 })] 27691 }); 27692 $[3] = handleAddNumbers; 27693 $[4] = t2; 27694 } else t2 = $[4]; 27695 return t2; 27696} 27697var dialer_settings_call_setting_default = DialerSettingsCallSetting; 27698function getAudioContextConstructor() { 27699 if (typeof window === "undefined") return null; 27700 const win = window; 27701 return win.AudioContext ?? win.webkitAudioContext ?? null; 27702} 27703function encodeWav(audioBuffer) { 27704 const numChannels = audioBuffer.numberOfChannels; 27705 const sampleRate = audioBuffer.sampleRate; 27706 const numFrames = audioBuffer.length; 27707 const bytesPerSample = 2; 27708 const blockAlign = numChannels * bytesPerSample; 27709 const dataSize = numFrames * blockAlign; 27710 const buffer = new ArrayBuffer(44 + dataSize); 27711 const view = new DataView(buffer); 27712 const writeString = (offset$1, value) => { 27713 for (let i = 0; i < value.length; i++) view.setUint8(offset$1 + i, value.charCodeAt(i)); 27714 }; 27715 writeString(0, "RIFF"); 27716 view.setUint32(4, 36 + dataSize, true); 27717 writeString(8, "WAVE"); 27718 writeString(12, "fmt "); 27719 view.setUint32(16, 16, true); 27720 view.setUint16(20, 1, true); 27721 view.setUint16(22, numChannels, true); 27722 view.setUint32(24, sampleRate, true); 27723 view.setUint32(28, sampleRate * blockAlign, true); 27724 view.setUint16(32, blockAlign, true); 27725 view.setUint16(34, bytesPerSample * 8, true); 27726 writeString(36, "data"); 27727 view.setUint32(40, dataSize, true); 27728 const channels = []; 27729 for (let channel = 0; channel < numChannels; channel++) channels.push(audioBuffer.getChannelData(channel)); 27730 let offset = 44; 27731 for (let frame = 0; frame < numFrames; frame++) for (let channel = 0; channel < numChannels; channel++) { 27732 const sample = Math.max(-1, Math.min(1, channels[channel]?.[frame] ?? 0)); 27733 view.setInt16(offset, sample < 0 ? sample * 32768 : sample * 32767, true); 27734 offset += bytesPerSample; 27735 } 27736 return buffer; 27737} 27738async function audioBlobToWav(blob) { 27739 const AudioContextCtor = getAudioContextConstructor(); 27740 if (!AudioContextCtor) throw new Error("Web Audio API is not supported in this browser"); 27741 const arrayBuffer = await blob.arrayBuffer(); 27742 const audioContext = new AudioContextCtor(); 27743 try { 27744 const audioBuffer = await audioContext.decodeAudioData(arrayBuffer); 27745 return new Blob([encodeWav(audioBuffer)], { type: "audio/wav" }); 27746 } finally { 27747 audioContext.close(); 27748 } 27749} 27750var import_compiler_runtime$22 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 27751var MAX_DURATION_DEFAULT = 300; 27752function VoiceRecorder({ maxDuration = MAX_DURATION_DEFAULT, onRecordingComplete, onRecordingClear, onRecordingStart, className, ref, initialAudioUrl, noUploadMedia = false }) { 27753 const [audioUrl, setAudioUrl] = (0, import_react.useState)(initialAudioUrl ?? null); 27754 const { startRecording, stopRecording, audioBlob, audioUrl: recordedAudioUrl, isRecording, isSupported, duration: recordingTime, clearRecording, checkPermission } = useAudioRecorder(); 27755 const [uploadMedia, { isLoading }] = useUploadMediaMutation(); 27756 const [isProcessing, setIsProcessing] = (0, import_react.useState)(false); 27757 let state$3; 27758 if (isRecording) state$3 = "recording"; 27759 else if (audioBlob) state$3 = "recorded"; 27760 else state$3 = "idle"; 27761 const handleClear = (0, import_react.useCallback)(() => { 27762 trackMethodCall("handleClear", []); 27763 clearRecording(); 27764 onRecordingClear?.(); 27765 setAudioUrl(null); 27766 }, [clearRecording, onRecordingClear]); 27767 (0, import_react.useImperativeHandle)(ref, () => { 27768 return { 27769 getBlob: () => { 27770 return audioBlob; 27771 }, 27772 getUrl: () => { 27773 return audioUrl; 27774 }, 27775 clear: handleClear, 27776 getState: () => { 27777 return state$3; 27778 }, 27779 isSupported 27780 }; 27781 }); 27782 const handleUploadDialerMedia = (0, import_react.useCallback)(async (audioBlob$1) => { 27783 trackMethodCall("handleUploadDialerMedia", [audioBlob$1]); 27784 setIsProcessing(true); 27785 try { 27786 let uploadBlob = audioBlob$1; 27787 try { 27788 uploadBlob = await audioBlobToWav(audioBlob$1); 27789 } catch (error) {} 27790 const file = new File([uploadBlob], "audio.wav", { type: "audio/wav" }); 27791 const result = await mutateWithErrorHandling(uploadMedia, { file }); 27792 const mediaFile = get(result, "data", null); 27793 if (!result || !mediaFile) { 27794 setAudioUrl(null); 27795 return; 27796 } 27797 setAudioUrl(mediaFile.url); 27798 onRecordingComplete?.(mediaFile); 27799 } finally { 27800 setIsProcessing(false); 27801 } 27802 }, [uploadMedia, onRecordingComplete]); 27803 (0, import_react.useEffect)(() => { 27804 if (state$3 === "recorded" && audioBlob) { 27805 if (noUploadMedia && recordedAudioUrl) { 27806 setAudioUrl(recordedAudioUrl); 27807 return; 27808 } 27809 handleUploadDialerMedia(audioBlob); 27810 } 27811 }, [ 27812 audioBlob, 27813 noUploadMedia, 27814 recordedAudioUrl, 27815 state$3 27816 ]); 27817 (0, import_react.useEffect)(() => { 27818 if (isRecording && recordingTime >= maxDuration) stopRecording(); 27819 }, [ 27820 isRecording, 27821 recordingTime, 27822 maxDuration, 27823 stopRecording 27824 ]); 27825 (0, import_react.useEffect)(() => { 27826 if (isRecording) onRecordingStart?.(); 27827 }, [isRecording, onRecordingStart]); 27828 const handleToggleRecording = async () => { 27829 trackMethodCall("handleToggleRecording", []); 27830 if (isRecording) { 27831 stopRecording(); 27832 return; 27833 } 27834 const status = await checkPermission(); 27835 if (status !== "granted") { 27836 toast.error(MICROPHONE_ERROR_MESSAGE[status]); 27837 return; 27838 } 27839 startRecording(); 27840 };
27841 if (state$3 === "idle" && !audioUrl) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 27842 type: "button", 27843 variant: "default-subtle", 27844 onClick: handleToggleRecording, 27845 className: cn("w-full", className), 27846 "aria-label": "Start recording", 27847 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Mic, { className: "size-6" }) 27848 }); 27849 if (state$3 === "recording") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VoiceRecordingButton, { 27850 seconds: recordingTime, 27851 onClick: handleToggleRecording, 27852 className 27853 }); 27854 const isBusy = isLoading || isProcessing; 27855 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [ 27856 isBusy && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 27857 type: "button", 27858 variant: "default-subtle", 27859 className: cn("w-full", className), 27860 "aria-label": "Uploading...", 27861 loading: isBusy, 27862 disabled: isBusy 27863 }), 27864 audioUrl && !isBusy && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(audio_player_default, { 27865 url: audioUrl, 27866 className: cn("h-9", className) 27867 }),
27868 !audioUrl && !isBusy && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 27869 type: "button", 27870 variant: "default-subtle", 27871 className: cn("w-full", className), 27872 "aria-label": "Error uploading audio", 27873 onClick: handleToggleRecording, 27874 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleAlert, { className: "size-4 text-amber-700" }), "Try again"] 27875 }) 27876 ] }); 27877} 27878var VoiceRecordingButton = (t0) => { 27879 const $ = (0, import_compiler_runtime$22.c)(15); 27880 let className; 27881 let props; 27882 let seconds; 27883 if ($[0] !== t0) { 27884 ({seconds, className, ...props} = t0); 27885 $[0] = t0; 27886 $[1] = className; 27887 $[2] = props; 27888 $[3] = seconds; 27889 } else { 27890 className = $[1]; 27891 props = $[2]; 27892 seconds = $[3]; 27893 } 27894 let t1; 27895 if ($[4] !== className) { 27896 t1 = cn("w-full cursor-pointer gap-2", className); 27897 $[4] = className; 27898 $[5] = t1; 27899 } else t1 = $[5]; 27900 let t2; 27901 if ($[6] === Symbol.for("react.memo_cache_sentinel")) { 27902 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 27903 className: "flex size-6 items-center justify-center rounded-full border-2 border-muted-foreground", 27904 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Square, { className: "size-2 animate-pulse rounded-[2px] fill-destructive text-destructive" }) 27905 }); 27906 $[6] = t2; 27907 } else t2 = $[6]; 27908 let t3; 27909 if ($[7] !== seconds) { 27910 t3 = formatDuration(seconds); 27911 $[7] = seconds; 27912 $[8] = t3; 27913 } else t3 = $[8]; 27914 let t4; 27915 if ($[9] !== t3) { 27916 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 27917 className: "text-sm font-medium text-foreground", 27918 children: t3 27919 }); 27920 $[9] = t3; 27921 $[10] = t4; 27922 } else t4 = $[10]; 27923 let t5; 27924 if ($[11] !== props || $[12] !== t1 || $[13] !== t4) { 27925 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 27926 type: "button", 27927 variant: "default-subtle", 27928 className: t1, 27929 "aria-label": "Stop recording", 27930 ...props, 27931 children: [t2, t4] 27932 }); 27933 $[11] = props; 27934 $[12] = t1; 27935 $[13] = t4; 27936 $[14] = t5; 27937 } else t5 = $[14]; 27938 return t5; 27939}; 27940var voice_recorder_default = VoiceRecorder; 27941var import_compiler_runtime$21 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 27942var VOICE_VERIFICATION_URL = "https://forum-images-test.s3.us-west-2.amazonaws.com/fleet/voice/2022_05_dialer_equipment_calibration.mp3"; 27943var LOCALSTORAGE_KEY_EARPIECE_WORKING = "isEarpiece"; 27944function DialerSettingsDeviceDetection() { 27945 const $ = (0, import_compiler_runtime$21.c)(19); 27946 const [isEarpieceWorkingChecked, setIsEarpieceWorkingChecked] = (0, import_react.useState)(false); 27947 const [isShowRecordedAudio, setIsShowRecordedAudio] = (0, import_react.useState)(false); 27948 const voiceRecorderRef = (0, import_react.useRef)(null); 27949 const { checkPermission } = useAudioRecorder(); 27950 let t0; 27951 let t1; 27952 if ($[0] !== checkPermission) { 27953 t0 = () => { 27954 const isEarpieceWorking = localStorage.getItem(LOCALSTORAGE_KEY_EARPIECE_WORKING); 27955 if (isEarpieceWorking) setIsEarpieceWorkingChecked(isEarpieceWorking === "true"); 27956 const checkPermissionOnce = () => { 27957 checkPermission().then((status) => { 27958 setIsShowRecordedAudio(status === "granted"); 27959 }).catch(() => { 27960 setIsShowRecordedAudio(false); 27961 }); 27962 }; 27963 const permissions = navigator.permissions; 27964 if (!permissions?.query) { 27965 checkPermissionOnce(); 27966 return; 27967 } 27968 let status_0 = null; 27969 const handlePermissionChange = () => { 27970 trackMethodCall("handlePermissionChange", []); 27971 setIsShowRecordedAudio(status_0?.state === "granted"); 27972 }; 27973 permissions.query({ name: "microphone" }).then((result) => { 27974 status_0 = result; 27975 setIsShowRecordedAudio(result.state === "granted"); 27976 result.addEventListener("change", handlePermissionChange); 27977 }).catch(() => { 27978 checkPermissionOnce(); 27979 }); 27980 return () => { 27981 status_0?.removeEventListener("change", handlePermissionChange); 27982 }; 27983 }; 27984 t1 = [checkPermission]; 27985 $[0] = checkPermission; 27986 $[1] = t0; 27987 $[2] = t1; 27988 } else { 27989 t0 = $[1]; 27990 t1 = $[2]; 27991 } 27992 (0, import_react.useEffect)(t0, t1); 27993 let t2; 27994 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 27995 t2 = (checked) => { 27996 trackMethodCall("handleCheckedChange", [checked]); 27997 setIsEarpieceWorkingChecked(checked); 27998 localStorage.setItem(LOCALSTORAGE_KEY_EARPIECE_WORKING, checked.toString()); 27999 }; 28000 $[3] = t2; 28001 } else t2 = $[3]; 28002 const handleCheckedChange = t2; 28003 let t3; 28004 if ($[4] === Symbol.for("react.memo_cache_sentinel")) { 28005 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 28006 className: "text-sm leading-5 text-muted-foreground", 28007 children: "Play the voice verification code and repeat the numbers. If your device works, check \"My Earpiece works fine\" below." 28008 }); 28009 $[4] = t3; 28010 } else t3 = $[4]; 28011 let t4; 28012 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 28013 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 28014 className: "flex flex-col gap-2", 28015 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, { 28016 className: "text-sm font-medium text-secondary-foreground", 28017 children: "Voice Verification Code" 28018 }
28018), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(audio_player_default, { 28019 url: VOICE_VERIFICATION_URL, 28020 title: "Voice Verification Code", 28021 className: "h-9" 28022 })] 28023 }); 28024 $[5] = t4; 28025 } else t4 = $[5]; 28026 let t5; 28027 if ($[6] === Symbol.for("react.memo_cache_sentinel")) { 28028 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, { 28029 className: "text-sm font-medium text-secondary-foreground", 28030 children: "Repeat Voice Verification Code" 28031 }); 28032 $[6] = t5; 28033 } else t5 = $[6]; 28034 let t6; 28035 if ($[7] === Symbol.for("react.memo_cache_sentinel")) { 28036 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 28037 className: "flex flex-col gap-2", 28038 children: [t5, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(voice_recorder_default, { 28039 ref: voiceRecorderRef, 28040 className: "h-9", 28041 noUploadMedia: true, 28042 onRecordingStart: () => setIsShowRecordedAudio(true) 28043 })] 28044 }); 28045 $[7] = t6; 28046 } else t6 = $[7]; 28047 let t7; 28048 if ($[8] !== isEarpieceWorkingChecked) { 28049 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Checkbox, { 28050 id: "earpiece-working", 28051 checked: isEarpieceWorkingChecked, 28052 onCheckedChange: handleCheckedChange 28053 }); 28054 $[8] = isEarpieceWorkingChecked; 28055 $[9] = t7; 28056 } else t7 = $[9]; 28057 let t8; 28058 if ($[10] === Symbol.for("react.memo_cache_sentinel")) { 28059 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, { 28060 htmlFor: "earpiece-working", 28061 className: "cursor-pointer text-secondary-foreground", 28062 children: "My Earpiece works fine." 28063 }); 28064 $[10] = t8; 28065 } else t8 = $[10]; 28066 let t9; 28067 if ($[11] !== t7) { 28068 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 28069 className: "flex items-center gap-2", 28070 children: [t7, t8] 28071 }); 28072 $[11] = t7; 28073 $[12] = t9; 28074 } else t9 = $[12]; 28075 let t10; 28076 if ($[13] !== isEarpieceWorkingChecked || $[14] !== isShowRecordedAudio) { 28077 t10 = isEarpieceWorkingChecked && isShowRecordedAudio ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Badge, { 28078 variant: "success-subtle", 28079 className: "w-full justify-center", 28080 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleCheck, { className: "size-3" }), "Microphone works fine"] 28081 }) : isEarpieceWorkingChecked ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Badge, { 28082 variant: "destructive-subtle", 28083 className: "w-full justify-center", 28084 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TriangleAlert, { className: "size-3" }), "Microphone not detected"] 28085 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Badge, { 28086 variant: "destructive-subtle", 28087 className: "w-full justify-center", 28088 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TriangleAlert, { className: "size-3" }), "Microphone & earpiece not detected"] 28089 }); 28090 $[13] = isEarpieceWorkingChecked; 28091 $[14] = isShowRecordedAudio; 28092 $[15] = t10; 28093 } else t10 = $[15]; 28094 let t11; 28095 if ($[16] !== t10 || $[17] !== t9) { 28096 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_settings_spinner_default, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 28097 className: "flex flex-col gap-6 pb-5", 28098 children: [ 28099 t3, 28100 t4, 28101 t6, 28102 t9, 28103 t10 28104 ] 28105 }) }); 28106 $[16] = t10; 28107 $[17] = t9; 28108 $[18] = t11; 28109 } else t11 = $[18]; 28110 return t11; 28111} 28112var dialer_settings_device_detection_default = DialerSettingsDeviceDetection; 28113var import_compiler_runtime$20 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 28114var InputField = (props) => { 28115 const $ = (0, import_compiler_runtime$20.c)(5); 28116 const { formItemProps, fieldProps } = useFormProps(props); 28117 let t0; 28118 if ($[0] !== fieldProps) { 28119 t0 = (t1$1) => { 28120 const { field, fieldState } = t1$1; 28121 const { onBlur, prefixIcon, suffixIcon, className,...restFieldProps } = fieldProps; 28122 const sharedProps = { 28123 "aria-invalid": fieldState.invalid, 28124 ...field, 28125 ...restFieldProps, 28126 onBlur: (e$4) => { 28127 field.onBlur(); 28128 onBlur?.(e$4); 28129 } 28130 }; 28131 if (!prefixIcon && !suffixIcon) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input, { 28132 className, 28133 ...sharedProps 28134 }); 28135 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(InputGroup, { 28136 className, 28137 children: [
28138 prefixIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputGroupAddon, { 28139 align: "inline-start", 28140 children: prefixIcon 28141 }), 28142 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputGroupInput, { ...sharedProps }), 28143 suffixIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputGroupAddon, { 28144 align: "inline-end", 28145 children: suffixIcon 28146 }) 28147 ] 28148 }); 28149 }; 28150 $[0] = fieldProps; 28151 $[1] = t0; 28152 } else t0 = $[1]; 28153 let t1; 28154 if ($[2] !== formItemProps || $[3] !== t0) { 28155 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormItem, { 28156 ...formItemProps, 28157 render: t0 28158 }); 28159 $[2] = formItemProps; 28160 $[3] = t0; 28161 $[4] = t1; 28162 } else t1 = $[4]; 28163 return t1; 28164}; 28165var import_compiler_runtime$19 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 28166var recordingVoiceFormSchema = zod_default.object({ recordingName: zod_default.string().min(1, "Enter recording name") }); 28167var INIT_FORM_VALUES = { recordingName: "" }; 28168function DialerRecordingVoiceForm(t0) { 28169 const $ = (0, import_compiler_runtime$19.c)(51); 28170 const { id, type, dialerUserInfo, voiceMessage, onCancel, onSave } = t0; 28171 let t1; 28172 if ($[0] !== voiceMessage) { 28173 t1 = voiceMessage ? { recordingName: voiceMessage.recordingName } : INIT_FORM_VALUES; 28174 $[0] = voiceMessage; 28175 $[1] = t1; 28176 } else t1 = $[1]; 28177 const initFormValues = t1; 28178 let t2; 28179 if ($[2] !== voiceMessage) { 28180 t2 = voiceMessage ? { 28181 url: voiceMessage.recordingUrl, 28182 size: voiceMessage.recordingSize, 28183 filename: "", 28184 type: "audio/wav" 28185 } : null; 28186 $[2] = voiceMessage; 28187 $[3] = t2; 28188 } else t2 = $[3]; 28189 const [mediaFile, setMediaFile] = (0, import_react.useState)(t2); 28190 const [hasRecording, setHasRecording] = (0, import_react.useState)(!!voiceMessage); 28191 const voiceRecorderRef = (0, import_react.useRef)(null); 28192 const [saveDialerVoiceInfo, t3] = useSaveDialerVoiceInfoMutation(); 28193 const { isLoading } = t3; 28194 let t4; 28195 if ($[4] === Symbol.for("react.memo_cache_sentinel")) { 28196 t4 = t$2(recordingVoiceFormSchema); 28197 $[4] = t4; 28198 } else t4 = $[4]; 28199 let t5; 28200 if ($[5] !== initFormValues) { 28201 t5 = { 28202 resolver: t4, 28203 defaultValues: initFormValues, 28204 mode: "onSubmit" 28205 }; 28206 $[5] = initFormValues; 28207 $[6] = t5; 28208 } else t5 = $[6]; 28209 const form = useForm(t5); 28210 let t6; 28211 if ($[7] === Symbol.for("react.memo_cache_sentinel")) { 28212 t6 = (mediaFile_0) => { 28213 trackMethodCall("handleRecordingComplete", [mediaFile_0]); 28214 setHasRecording(true); 28215 setMediaFile(mediaFile_0); 28216 }; 28217 $[7] = t6; 28218 } else t6 = $[7]; 28219 const handleRecordingComplete = t6; 28220 let t7; 28221 if ($[8] === Symbol.for("react.memo_cache_sentinel")) { 28222 t7 = () => { 28223 trackMethodCall("handleRecordingClear", []); 28224 setHasRecording(false); 28225 setMediaFile(null); 28226 }; 28227 $[8] = t7; 28228 } else t7 = $[8]; 28229 const handleRecordingClear = t7; 28230 let t8; 28231 if ($[9] !== dialerUserInfo || $[10] !== mediaFile || $[11] !== onSave || $[12] !== saveDialerVoiceInfo || $[13] !== type || $[14] !== voiceMessage?.id) { 28232 t8 = async (data) => { 28233 trackMethodCall("handleSaveRecordingVoiceSubmit", [data]); 28234 if (!dialerUserInfo || !mediaFile) return; 28235 const params = { 28236 type, 28237 recordingName: data.recordingName, 28238 recordingUrl: mediaFile.url ?? "", 28239 voiceSize: mediaFile.size ? String(mediaFile.size) : "", 28240 userInfoId: dialerUserInfo.userInfoId, 28241 id: voiceMessage?.id ?? "" 28242 }; 28243 await mutateWithErrorHandling(saveDialerVoiceInfo, params, { 28244 showSuccessToast: true, 28245 successMessage: "Voice message saved successfully" 28246 }); 28247 onSave({ 28248 recordingName: data.recordingName, 28249 mediaFile 28250 }); 28251 }; 28252 $[9] = dialerUserInfo; 28253 $[10] = mediaFile; 28254 $[11] = onSave; 28255 $[12] = saveDialerVoiceInfo; 28256 $[13] = type; 28257 $[14] = voiceMessage?.id; 28258 $[15] = t8; 28259 } else t8 = $[15]; 28260 const handleSaveRecordingVoiceSubmit = t8; 28261 let t9; 28262 if ($[16] !== onCancel) { 28263 t9 = () => { 28264 trackMethodCall("handleCancelRecordingVoiceForm", []); 28265 voiceRecorderRef.current?.clear(); 28266 onCancel(); 28267 }; 28268 $[16] = onCancel; 28269 $[17] = t9; 28270 } else t9 = $[17]; 28271 const handleCancelRecordingVoiceForm = t9; 28272 const t10 = id ?? "dialer-recording-voice-form"; 28273 let t11; 28274 if ($[18] !== form || $[19] !== handleSaveRecordingVoiceSubmit) { 28275 t11 = form.handleSubmit(handleSaveRecordingVoiceSubmit, console.warn); 28276 $[18] = form; 28277 $[19] = handleSaveRecordingVoiceSubmit; 28278 $[20] = t11; 28279 } else t11 = $[20]; 28280 let t12; 28281 if ($[21] === Symbol.for("react.memo_cache_sentinel")) { 28282 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputField, { 28283 name: "recordingName", 28284 title: "Recording Name", 28285 placeholder: "Enter", 28286 maxLength: 30 28287 }); 28288 $[21] = t12; 28289 } else t12 = $[21]; 28290 let t13; 28291 if ($[22] === Symbol.for("react.memo_cache_sentinel")) { 28292 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldLabel, { 28293 className: "text-muted-foreground", 28294 children: "Record Now" 28295 }); 28296 $[22] = t13; 28297 } else t13 = $[22]; 28298 let t14; 28299 if ($[23] !== mediaFile) {
28300 t14 = mediaFile && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 28301 type: "button", 28302 variant: "ghost", 28303 size: "icon-sm", 28304 className: "size-4 text-muted-foreground opacity-0 group-hover:opacity-100 hover:bg-transparent hover:text-destructive", 28305 "aria-label": "Clear recording", 28306 onClick: () => voiceRecorderRef.current?.clear(), 28307 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2, { className: "size-4" }) 28308 }); 28309 $[23] = mediaFile; 28310 $[24] = t14; 28311 } else t14 = $[24]; 28312 let t15; 28313 if ($[25] !== t14) { 28314 t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 28315 className: "group flex items-center justify-between", 28316 children: [t13, t14] 28317 }); 28318 $[25] = t14; 28319 $[26] = t15; 28320 } else t15 = $[26]; 28321 const t16 = voiceMessage?.recordingUrl; 28322 let t17; 28323 if ($[27] !== t16) { 28324 t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(voice_recorder_default, { 28325 ref: voiceRecorderRef, 28326 maxDuration: 300, 28327 onRecordingComplete: handleRecordingComplete, 28328 onRecordingClear: handleRecordingClear, 28329 initialAudioUrl: t16 28330 }); 28331 $[27] = t16; 28332 $[28] = t17; 28333 } else t17 = $[28]; 28334 let t18; 28335 if ($[29] === Symbol.for("react.memo_cache_sentinel")) { 28336 t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(FieldDescription, { 28337 className: "text-xs", 28338 children: [ 28339 "Note: Recording cannot exceed ",
28340 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 28341 className: "font-semibold text-destructive", 28342 children: "5" 28343 }), 28344 " ", 28345 "minutes" 28346 ] 28347 }); 28348 $[29] = t18; 28349 } else t18 = $[29]; 28350 let t19; 28351 if ($[30] !== t15 || $[31] !== t17) { 28352 t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Field, { children: [ 28353 t15, 28354 t17, 28355 t18 28356 ] }); 28357 $[30] = t15; 28358 $[31] = t17; 28359 $[32] = t19; 28360 } else t19 = $[32]; 28361 let t20; 28362 if ($[33] !== handleCancelRecordingVoiceForm || $[34] !== isLoading) { 28363 t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 28364 type: "button", 28365 variant: "outline", 28366 onClick: handleCancelRecordingVoiceForm, 28367 className: "flex-1", 28368 disabled: isLoading, 28369 children: "Cancel" 28370 }); 28371 $[33] = handleCancelRecordingVoiceForm; 28372 $[34] = isLoading; 28373 $[35] = t20; 28374 } else t20 = $[35]; 28375 const t21 = id ?? "dialer-recording-voice-form"; 28376 const t22 = !hasRecording || !mediaFile || isLoading; 28377 let t23; 28378 if ($[36] !== isLoading || $[37] !== t21 || $[38] !== t22) { 28379 t23 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 28380 type: "submit", 28381 form: t21, 28382 className: "flex-1", 28383 disabled: t22, 28384 loading: isLoading, 28385 children: "Save" 28386 }); 28387 $[36] = isLoading; 28388 $[37] = t21; 28389 $[38] = t22; 28390 $[39] = t23; 28391 } else t23 = $[39]; 28392 let t24; 28393 if ($[40] !== t20 || $[41] !== t23) { 28394 t24 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Field, { 28395 orientation: "horizontal", 28396 children: [t20, t23] 28397 }); 28398 $[40] = t20; 28399 $[41] = t23; 28400 $[42] = t24; 28401 } else t24 = $[42]; 28402 let t25; 28403 if ($[43] !== t19 || $[44] !== t24) { 28404 t25 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 28405 className: "flex flex-col gap-4", 28406 children: [ 28407 t12, 28408 t19, 28409 t24 28410 ] 28411 }); 28412 $[43] = t19; 28413 $[44] = t24; 28414 $[45] = t25; 28415 } else t25 = $[45]; 28416 let t26; 28417 if ($[46] !== form || $[47] !== t10 || $[48] !== t11 || $[49] !== t25) { 28418 t26 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormWrapper, { 28419 form, 28420 id: t10, 28421 onSubmit: t11, 28422 children: t25 28423 }); 28424 $[46] = form; 28425 $[47] = t10; 28426 $[48] = t11; 28427 $[49] = t25; 28428 $[50] = t26; 28429 } else t26 = $[50]; 28430 return t26; 28431} 28432var dialer_recording_voice_form_default = DialerRecordingVoiceForm; 28433var import_compiler_runtime$18 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 28434function DialerSettingsVoiceMessages() { 28435 const $ = (0, import_compiler_runtime$18.c)(49); 28436 const [addVoiceMessageFormType, setAddVoiceMessageFormType] = (0, import_react.useState)(null); 28437 const [selectedEditVoiceMessage, setSelectedEditVoiceMessage] = (0, import_react.useState)(null); 28438 const previousAddVoiceMessageFormType = usePrevious_default(addVoiceMessageFormType); 28439 const { data: voiceMessagesListResponse, isLoading, isFetching } = useGetDialerVoiceMessagesListQuery(); 28440 const { data: userDialerSettingInfoResponse, isLoading: isUserDialerSettingInfoLoading } = useGetUserDialerSettingInfoQuery(); 28441 const [saveDialerVoiceInfo, t0] = useSaveDialerVoiceInfoMutation(); 28442 const { isLoading: isSaveDialerVoiceInfoLoading } = t0; 28443 const [deleteDialerVoiceMessage, t1] = useDeleteDialerVoiceMessageMutation(); 28444 const { isLoading: isDeleteDialerVoiceMessageLoading } = t1; 28445 let T0; 28446 let T1; 28447 let t2; 28448 let t3; 28449 let t4; 28450 let t5; 28451 let t6; 28452 let t7; 28453 let t8; 28454 if ($[0] !== addVoiceMessageFormType || $[1] !== deleteDialerVoiceMessage || $[2] !== isDeleteDialerVoiceMessageLoading || $[3] !== isFetching || $[4] !== isLoading || $[5] !== isSaveDialerVoiceInfoLoading || $[6] !== isUserDialerSettingInfoLoading || $[7] !== previousAddVoiceMessageFormType || $[8] !== saveDialerVoiceInfo || $[9] !== selectedEditVoiceMessage || $[10] !== userDialerSettingInfoResponse || $[11] !== voiceMessagesListResponse) { 28455 const voiceMessagesList = get(voiceMessagesListResponse, "data") ?? []; 28456 const voiceMessagesListGrouped = groupBy(voiceMessagesList, _temp$3); 28457 const outboundVoiceList = get(voiceMessagesListGrouped, "outbound_voice", []); 28458 const voicemailGreetingList = get(voiceMessagesListGrouped, "voicemail_greetings", []); 28459 let t9$1; 28460 if ($[21] !== userDialerSettingInfoResponse) { 28461 t9$1 = get(userDialerSettingInfoResponse, "data"); 28462 $[21] = userDialerSettingInfoResponse; 28463 $[22] = t9$1; 28464 } else t9$1 = $[22]; 28465 const dialerUserInfo = t9$1; 28466 let t10$1; 28467 if ($[23] !== saveDialerVoiceInfo) { 28468 t10$1 = async (id) => { 28469 trackMethodCall("handleChangeDefaultVoicemailGreeting", [id]); 28470 await mutateWithErrorHandling(saveDialerVoiceInfo, { 28471 id, 28472 type: "voicemail_greetings", 28473 isDefault: true 28474 }); 28475 }; 28476 $[23] = saveDialerVoiceInfo; 28477 $[24] = t10$1; 28478 } else t10$1 = $[24]; 28479 const handleChangeDefaultVoicemailGreeting = t10$1; 28480 let t11$1; 28481 if ($[25] === Symbol.for("react.memo_cache_sentinel")) { 28482 t11$1 = () => { 28483 trackMethodCall("handleCancel", []); 28484 setAddVoiceMessageFormType(null); 28485 setSelectedEditVoiceMessage(null); 28486 }; 28487 $[25] = t11$1; 28488 } else t11$1 = $[25]; 28489 const handleCancel = t11$1; 28490 let t12; 28491 if ($[26] === Symbol.for("react.memo_cache_sentinel")) { 28492 t12 = () => { 28493 setAddVoiceMessageFormType(null); 28494 setSelectedEditVoiceMessage(null); 28495 }; 28496 $[26] = t12; 28497 } else t12 = $[26]; 28498 const createHandleSave = t12; 28499 let t13; 28500 if ($[27] === Symbol.for("react.memo_cache_sentinel")) { 28501 t13 = (message_0) => { 28502 trackMethodCall("handleEditOutbound", [message_0]); 28503 setSelectedEditVoiceMessage(message_0); 28504 setAddVoiceMessageFormType("outbound_voice"); 28505 }; 28506 $[27] = t13; 28507 } else t13 = $[27]; 28508 const handleEditOutbound = t13; 28509 let t14; 28510 if ($[28] !== deleteDialerVoiceMessage) { 28511 t14 = async (message_1) => { 28512 trackMethodCall("handleDeleteVoiceMessage", [message_1]); 28513 await mutateWithErrorHandling(deleteDialerVoiceMessage, { voiceId: message_1.id }, { 28514 showSuccessToast: true, 28515 successMessage: "Voice message deleted successfully" 28516 }); 28517 }; 28518 $[28] = deleteDialerVoiceMessage; 28519 $[29] = t14; 28520 } else t14 = $[29]; 28521 const handleDeleteVoiceMessage = t14; 28522 let t15; 28523 if ($[30] === Symbol.for("react.memo_cache_sentinel")) { 28524 t15 = (message_2) => { 28525 trackMethodCall("handleEditVoicemailGreeting", [message_2]); 28526 setSelectedEditVoiceMessage(message_2); 28527 setAddVoiceMessageFormType("voicemail_greetings"); 28528 }; 28529 $[30] = t15; 28530 } else t15 = $[30]; 28531 const handleEditVoicemailGreeting = t15; 28532 T1 = dialer_settings_spinner_default; 28533 t8 = isLoading || isUserDialerSettingInfoLoading; 28534 t6 = "flex flex-col gap-6 pb-5"; 28535 let t16; 28536 if ($[31] === Symbol.for("react.memo_cache_sentinel")) { 28537 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldLabel, { children: "Outbound" }); 28538 $[31] = t16; 28539 } else t16 = $[31]; 28540 const t17 = addVoiceMessageFormType === "outbound_voice" ? /* @__P
28540URE__ */ (0, import_jsx_runtime.jsx)(dialer_recording_voice_form_default, { 28541 id: "outbound-voice-message-form", 28542 type: "outbound_voice", 28543 dialerUserInfo, 28544 voiceMessage: selectedEditVoiceMessage, 28545 onCancel: handleCancel, 28546 onSave: createHandleSave 28547 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [outboundVoiceList.map((message_3) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OutboundVoiceMessageItem, { 28548 message: message_3, 28549 onEdit: handleEditOutbound, 28550 onDelete: handleDeleteVoiceMessage, 28551 deleteLoading: isDeleteDialerVoiceMessageLoading 28552 }, message_3.id)), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 28553 type: "button", 28554 disabled: !!addVoiceMessageFormType || isFetching, 28555 onClick: () => setAddVoiceMessageFormType("outbound_voice"), 28556 loading: isFetching && previousAddVoiceMessageFormType === "outbound_voice", 28557 children: "Add" 28558 })] }); 28559 if ($[32] !== t17) { 28560 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Field, { children: [t16, t17] }); 28561 $[32] = t17; 28562 $[33] = t7; 28563 } else t7 = $[33]; 28564 T0 = RadioGroup; 28565 t2 = "flex flex-col gap-4"; 28566 t3 = handleChangeDefaultVoicemailGreeting; 28567 if ($[34] === Symbol.for("react.memo_cache_sentinel")) { 28568 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FieldLabel, { children: "Voicemail Greetings" }); 28569 $[34] = t4; 28570 } else t4 = $[34]; 28571 t5 = addVoiceMessageFormType === "voicemail_greetings" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_recording_voice_form_default, { 28572 id: "voicemail-greeting-voice-message-form", 28573 type: "voicemail_greetings", 28574 dialerUserInfo, 28575 voiceMessage: selectedEditVoiceMessage, 28576 onCancel: handleCancel, 28577 onSave: createHandleSave 28578 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [voicemailGreetingList.map((message_4) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VoiceMessageItem, { 28579 message: message_4, 28580 onEdit: handleEditVoicemailGreeting, 28581 onDelete: handleDeleteVoiceMessage, 28582 isLoading: isSaveDialerVoiceInfoLoading || isFetching, 28583 deleteLoading: isDeleteDialerVoiceMessageLoading 28584 }, message_4.id)), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 28585 type: "button", 28586 disabled: !!addVoiceMessageFormType || isFetching, 28587 onClick: () => setAddVoiceMessageFormType("voicemail_greetings"), 28588 loading: isFetching && previousAddVoiceMessageFormType === "voicemail_greetings", 28589 children: "Add" 28590 })] }); 28591 $[0] = addVoiceMessageFormType; 28592 $[1] = deleteDialerVoiceMessage; 28593 $[2] = isDeleteDialerVoiceMessageLoading; 28594 $[3] = isFetching; 28595 $[4] = isLoading; 28596 $[5] = isSaveDialerVoiceInfoLoading; 28597 $[6] = isUserDialerSettingInfoLoading; 28598 $[7] = previousAddVoiceMessageFormType; 28599 $[8] = saveDialerVoiceInfo; 28600 $[9] = selectedEditVoiceMessage; 28601 $[10] = userDialerSettingInfoResponse; 28602 $[11] = voiceMessagesListResponse; 28603 $[12] = T0; 28604 $[13] = T1; 28605 $[14] = t2; 28606 $[15] = t3; 28607 $[16] = t4; 28608 $[17] = t5; 28609 $[18] = t6; 28610 $[19] = t7; 28611 $[20] = t8; 28612 } else { 28613 T0 = $[12]; 28614 T1 = $[13]; 28615 t2 = $[14]; 28616 t3 = $[15]; 28617 t4 = $[16]; 28618 t5 = $[17]; 28619 t6 = $[18]; 28620 t7 = $[19]; 28621 t8 = $[20]; 28622 } 28623 let t9; 28624 if ($[35] !== T0 || $[36] !== t2 || $[37] !== t3 || $[38] !== t4 || $[39] !== t5) { 28625 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(T0, { 28626 className: t2, 28627 onValueChange: t3, 28628 children: [t4, t5] 28629 }); 28630 $[35] = T0; 28631 $[36] = t2; 28632 $[37] = t3; 28633 $[38] = t4; 28634 $[39] = t5; 28635 $[40] = t9; 28636 } else t9 = $[40]; 28637 let t10; 28638 if ($[41] !== t6 || $[42] !== t7 || $[43] !== t9) { 28639 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 28640 className: t6, 28641 children: [t7, t9] 28642 }); 28643 $[41] = t6; 28644 $[42] = t7; 28645 $[43] = t9; 28646 $[44] = t10; 28647 } else t10 = $[44]; 28648 let t11; 28649 if ($[45] !== T1 || $[46] !== t10 || $[47] !== t8) { 28650 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(T1, { 28651 spinning: t8, 28652 children: t10 28653 }); 28654 $[45] = T1; 28655 $[46] = t10; 28656 $[47] = t8; 28657 $[48] = t11; 28658 } else t11 = $[48]; 28659 return t11; 28660} 28661function _temp$3(message) { 28662 return message.type; 28663} 28664function OutboundVoiceMessageItem(t0) { 28665 const $ = (0, import_compiler_runtime$18.c)(28); 28666 const { message, onEdit, onDelete, deleteLoading } = t0; 28667 let t1; 28668 if ($[0] !== message.recordingName) { 28669 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 28670 className: "truncate text-sm font-medium text-muted-foreground", 28671 children: message.recordingName 28672 }); 28673 $[0] = message.recordingName; 28674 $[1] = t1; 28675 } else t1 = $[1]; 28676 let t2; 28677 if ($[2] !== message || $[3] !== onEdit) { 28678 t2 = () => onEdit?.(message); 28679 $[2] = message; 28680 $[3] = onEdit; 28681 $[4] = t2; 28682 } else t2 = $[4]; 28683 let t3; 28684 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 28685 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pencil, { className: "size-4" }); 28686 $[5] = t3; 28687 } else t3 = $[5]; 28688 let t4; 28689 if ($[6] !== t2) { 28690 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 28691 type: "button", 28692 variant: "ghost", 28693 size: "icon-sm", 28694 className: "size-4 text-muted-foreground hover:bg-transparent hover:text-primary", 28695 onClick: t2, 28696 "aria-label": "Edit voice message", 28697 children: t3 28698 }); 28699 $[6] = t2; 28700 $[7] = t4; 28701 } else t4 = $[7]; 28702 let t5; 28703 if ($[8] !== message || $[9] !== onDelete) { 28704 t5 = () => onDelete?.(message); 28705 $[8] = message; 28706 $[9] = onDelete; 28707 $[10] = t5; 28708 } else t5 = $[10]; 28709 let t6; 28710 if ($[11] !== deleteLoading) {
28711 t6 = !deleteLoading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2, { className: "size-4" }); 28712 $[11] = deleteLoading; 28713 $[12] = t6; 28714 } else t6 = $[12]; 28715 let t7; 28716 if ($[13] !== deleteLoading || $[14] !== t5 || $[15] !== t6) { 28717 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 28718 type: "button", 28719 variant: "ghost", 28720 size: "icon-sm", 28721 className: "size-4 text-muted-foreground hover:bg-transparent hover:text-destructive", 28722 onClick: t5, 28723 "aria-label": "Delete voice message", 28724 loading: deleteLoading, 28725 disabled: deleteLoading, 28726 children: t6 28727 }); 28728 $[13] = deleteLoading; 28729 $[14] = t5; 28730 $[15] = t6; 28731 $[16] = t7; 28732 } else t7 = $[16]; 28733 let t8; 28734 if ($[17] !== t4 || $[18] !== t7) { 28735 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 28736 className: "flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100", 28737 children: [t4, t7] 28738 }); 28739 $[17] = t4; 28740 $[18] = t7; 28741 $[19] = t8; 28742 } else t8 = $[19]; 28743 let t9; 28744 if ($[20] !== t1 || $[21] !== t8) { 28745 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 28746 className: "flex min-w-0 items-center justify-between", 28747 children: [t1, t8] 28748 }); 28749 $[20] = t1; 28750 $[21] = t8; 28751 $[22] = t9; 28752 } else t9 = $[22]; 28753 let t10; 28754 if ($[23] !== message.recordingUrl) { 28755 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(audio_player_default, { 28756 url: message.recordingUrl, 28757 className: "h-9" 28758 }); 28759 $[23] = message.recordingUrl; 28760 $[24] = t10; 28761 } else t10 = $[24]; 28762 let t11; 28763 if ($[25] !== t10 || $[26] !== t9) { 28764 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 28765 "data-slot": "voice-message-item", 28766 className: "group flex flex-col gap-2", 28767 children: [t9, t10] 28768 }); 28769 $[25] = t10; 28770 $[26] = t9; 28771 $[27] = t11; 28772 } else t11 = $[27]; 28773 return t11; 28774} 28775function VoiceMessageItem(t0) { 28776 const $ = (0, import_compiler_runtime$18.c)(41); 28777 const { message, onEdit, onDelete, isLoading, deleteLoading } = t0; 28778 const isDefault = message.isDefault; 28779 let t1; 28780 if ($[0] !== isDefault || $[1] !== isLoading || $[2] !== message.id) {
28781 t1 = !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadioGroupItem, { 28782 value: String(message.id), 28783 checked: isDefault, 28784 id: "checkbox-group-item-" + message.id 28785 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { className: "text-primary" }); 28786 $[0] = isDefault; 28787 $[1] = isLoading; 28788 $[2] = message.id; 28789 $[3] = t1; 28790 } else t1 = $[3]; 28791 const t2 = "checkbox-group-item-" + message.id; 28792 let t3; 28793 if ($[4] !== message.recordingName) { 28794 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 28795 className: "max-w-full truncate text-muted-foreground", 28796 children: message.recordingName 28797 }); 28798 $[4] = message.recordingName; 28799 $[5] = t3; 28800 } else t3 = $[5]; 28801 let t4; 28802 if ($[6] !== isDefault) { 28803 t4 = isDefault && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 28804 className: "min-w-19.5 flex-1 text-xs text-success", 28805 children: "Default Voice" 28806 }); 28807 $[6] = isDefault; 28808 $[7] = t4; 28809 } else t4 = $[7]; 28810 let t5; 28811 if ($[8] !== t2 || $[9] !== t3 || $[10] !== t4) { 28812 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Label, { 28813 htmlFor: t2, 28814 className: "min-w-0 flex-1", 28815 children: [t3, t4] 28816 }); 28817 $[8] = t2; 28818 $[9] = t3; 28819 $[10] = t4; 28820 $[11] = t5; 28821 } else t5 = $[11]; 28822 let t6; 28823 if ($[12] !== t1 || $[13] !== t5) { 28824 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 28825 className: "flex min-w-0 flex-1 items-center gap-1.5", 28826 children: [t1, t5] 28827 }); 28828 $[12] = t1; 28829 $[13] = t5; 28830 $[14] = t6; 28831 } else t6 = $[14]; 28832 let t7; 28833 if ($[15] !== message || $[16] !== onEdit) { 28834 t7 = () => onEdit?.(message); 28835 $[15] = message; 28836 $[16] = onEdit; 28837 $[17] = t7; 28838 } else t7 = $[17]; 28839 let t8; 28840 if ($[18] === Symbol.for("react.memo_cache_sentinel")) { 28841 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pencil, { className: "size-4" }); 28842 $[18] = t8; 28843 } else t8 = $[18]; 28844 let t9; 28845 if ($[19] !== t7) { 28846 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 28847 type: "button", 28848 variant: "ghost", 28849 size: "icon-sm", 28850 className: "size-4 text-muted-foreground hover:bg-transparent hover:text-primary", 28851 onClick: t7, 28852 "aria-label": "Edit voice message", 28853 children: t8 28854 }); 28855 $[19] = t7; 28856 $[20] = t9; 28857 } else t9 = $[20]; 28858 let t10; 28859 if ($[21] !== message || $[22] !== onDelete) { 28860 t10 = () => onDelete?.(message); 28861 $[21] = message; 28862 $[22] = onDelete; 28863 $[23] = t10; 28864 } else t10 = $[23]; 28865 let t11; 28866 if ($[24] !== deleteLoading) { 28867 t11 = !deleteLoading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2, { className: "size-4" }); 28868 $[24] = deleteLoading; 28869 $[25] = t11; 28870 } else t11 = $[25]; 28871 let t12; 28872 if ($[26] !== deleteLoading || $[27] !== t10 || $[28] !== t11) { 28873 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 28874 type: "button", 28875 variant: "ghost", 28876 size: "icon-sm", 28877 className: "size-4 text-muted-foreground hover:bg-transparent hover:text-destructive", 28878 onClick: t10, 28879 "aria-label": "Delete voice message", 28880 loading: deleteLoading, 28881 disabled: deleteLoading, 28882 children: t11 28883 }); 28884 $[26] = deleteLoading; 28885 $[27] = t10; 28886 $[28] = t11; 28887 $[29] = t12; 28888 } else t12 = $[29]; 28889 let t13; 28890 if ($[30] !== t12 || $[31] !== t9) { 28891 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 28892 className: "hidden items-center gap-1 opacity-0 transition-opacity group-hover:flex group-hover:opacity-100", 28893 children: [t9, t12] 28894 }); 28895 $[30] = t12; 28896 $[31] = t9; 28897 $[32] = t13; 28898 } else t13 = $[32]; 28899 let t14; 28900 if ($[33] !== t13 || $[34] !== t6) { 28901 t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 28902 className: "flex w-full items-center justify-between gap-1", 28903 children: [t6, t13] 28904 }); 28905 $[33] = t13; 28906 $[34] = t6; 28907 $[35] = t14; 28908 } else t14 = $[35]; 28909 let t15; 28910 if ($[36] !== message.recordingUrl) { 28911 t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(audio_player_default, { 28912 url: message.recordingUrl, 28913 className: "h-9" 28914 }); 28915 $[36] = message.recordingUrl; 28916 $[37] = t15; 28917 } else t15 = $[37]; 28918 let t16; 28919 if ($[38] !== t14 || $[39] !== t15) { 28920 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 28921 className: "group flex flex-col gap-2", 28922 children: [t14, t15] 28923 }); 28924 $[38] = t14; 28925 $[39] = t15; 28926 $[40] = t16; 28927 } else t16 = $[40]; 28928 return t16; 28929} 28930var dialer_settings_voice_messages_default = DialerSettingsVoiceMessages; 28931var import_compiler_runtime$17 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 28932function DialerSettings() { 28933 const $ = (0, import_compiler_runtime$17.c)(23); 28934 const [openCollapsible, setOpenCollapsible] = (0, import_react.useState)("call-settings"); 28935 const dispatch = useAppDispatch(); 28936 let t0; 28937 let t1; 28938 if ($[0] !== dispatch) { 28939 t0 = () => { 28940 dispatch(dialersApi.util.invalidateTags([{ 28941 type: "dialers", 28942 id: "USER_DIALER_SETTING_INFO" 28943 }])); 28944 }; 28945 t1 = [dispatch]; 28946 $[0] = dispatch; 28947 $[1] = t0; 28948 $[2] = t1; 28949 } else { 28950 t0 = $[1]; 28951 t1 = $[2]; 28952 } 28953 (0, import_react.useEffect)(t0, t1); 28954 let t2; 28955 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 28956 t2 = (collapsible) => (open) => { 28957 setOpenCollapsible(open ? collapsible : null); 28958 }; 28959 $[3] = t2; 28960 } else t2 = $[3]; 28961 const createHandleOpenCollapsible = t2; 28962 const t3 = openCollapsible === "call-settings"; 28963 let t4; 28964 if ($[4] === Symbol.for("react.memo_cache_sentinel")) { 28965 t4 = createHandleOpenCollapsible("call-settings"); 28966 $[4] = t4; 28967 } else t4 = $[4]; 28968 let t5; 28969 if ($[5] === Symbol.for("react.memo_cache_sentinel")) { 28970 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CollapsibleTrigger, { 28971 className: "group flex w-full items-center justify-between py-5 text-left", 28972 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 28973 className: "flex items-center gap-2.5", 28974 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MonitorSmartphone, { className: "size-5 text-foreground" }
28974), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 28975 className: "text-sm font-semibold text-foreground", 28976 children: "Call Settings" 28977 })] 28978 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { className: "size-5 text-muted-foreground transition-transform duration-200 group-data-[state=open]:rotate-180" })] 28979 }); 28980 $[5] = t5; 28981 } else t5 = $[5]; 28982 let t6; 28983 if ($[6] === Symbol.for("react.memo_cache_sentinel")) { 28984 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_settings_call_setting_default, {}) }); 28985 $[6] = t6; 28986 } else t6 = $[6]; 28987 let t7; 28988 if ($[7] !== t3) { 28989 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Collapsible, { 28990 open: t3, 28991 onOpenChange: t4, 28992 className: "border-b border-border", 28993 children: [t5, t6] 28994 }); 28995 $[7] = t3; 28996 $[8] = t7; 28997 } else t7 = $[8]; 28998 const t8 = openCollapsible === "voice-messages"; 28999 let t9; 29000 if ($[9] === Symbol.for("react.memo_cache_sentinel")) { 29001 t9 = createHandleOpenCollapsible("voice-messages"); 29002 $[9] = t9; 29003 } else t9 = $[9]; 29004 let t10; 29005 if ($[10] === Symbol.for("react.memo_cache_sentinel")) { 29006 t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CollapsibleTrigger, { 29007 className: "group flex w-full items-center justify-between py-5 text-left", 29008 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 29009 className: "flex items-center gap-2.5", 29010 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Speech, { className: "size-5 text-foreground" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 29011 className: "text-sm font-semibold text-foreground", 29012 children: "Voice Messages" 29013 })] 29014 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { className: "size-5 text-muted-foreground transition-transform duration-200 group-data-[state=open]:rotate-180" })] 29015 }); 29016 $[10] = t10; 29017 } else t10 = $[10]; 29018 let t11; 29019 if ($[11] === Symbol.for("react.memo_cache_sentinel")) { 29020 t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_settings_voice_messages_default, {}) }); 29021 $[11] = t11; 29022 } else t11 = $[11]; 29023 let t12; 29024 if ($[12] !== t8) { 29025 t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Collapsible, { 29026 open: t8, 29027 onOpenChange: t9, 29028 className: "border-b border-border", 29029 children: [t10, t11] 29030 }); 29031 $[12] = t8; 29032 $[13] = t12; 29033 } else t12 = $[13]; 29034 const t13 = openCollapsible === "device-detection"; 29035 let t14; 29036 if ($[14] === Symbol.for("react.memo_cache_sentinel")) { 29037 t14 = createHandleOpenCollapsible("device-detection"); 29038 $[14] = t14; 29039 } else t14 = $[14]; 29040 let t15; 29041 if ($[15] === Symbol.for("react.memo_cache_sentinel")) { 29042 t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(CollapsibleTrigger, { 29043 className: "group flex w-full items-center justify-between py-5 text-left", 29044 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 29045 className: "flex items-center gap-2.5", 29046 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Headset, { className: "size-5 text-foreground" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 29047 className: "text-sm font-semibold text-foreground", 29048 children: "Device Detection" 29049 })] 29050 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { className: "size-5 text-muted-foreground transition-transform duration-200 group-data-[state=open]:rotate-180" })] 29051 }); 29052 $[15] = t15; 29053 } else t15 = $[15]; 29054 let t16; 29055 if ($[16] === Symbol.for("react.memo_cache_sentinel")) { 29056 t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CollapsibleContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_settings_device_detection_default, {}) }); 29057 $[16] = t16; 29058 } else t16 = $[16]; 29059 let t17; 29060 if ($[17] !== t13) { 29061 t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Collapsible, { 29062 open: t13, 29063 onOpenChange: t14, 29064 className: "border-b border-border", 29065 children: [t15, t16] 29066 }); 29067 $[17] = t13; 29068 $[18] = t17; 29069 } else t17 = $[18]; 29070 let t18; 29071 if ($[19] !== t12 || $[20] !== t17 || $[21] !== t7) { 29072 t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 29073 className: "flex flex-col px-5", 29074 children: [ 29075 t7, 29076 t12, 29077 t17 29078 ] 29079 }); 29080 $[19] = t12; 29081 $[20] = t17; 29082 $[21] = t7; 29083 $[22] = t18; 29084 } else t18 = $[22]; 29085 return t18; 29086} 29087var dialer_settings_default = DialerSettings; 29088var import_compiler_runtime$16 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 29089const Combobox = Ht; 29090const ComboboxWrapper = (t0) => { 29091 const $ = (0, import_compiler_runtime$16.c)(10); 29092 let className; 29093 let props; 29094 let t1; 29095 if ($[0] !== t0) { 29096 ({className, border: t1, ...props} = t0); 29097 $[0] = t0; 29098 $[1] = className; 29099 $[2] = props; 29100 $[3] = t1; 29101 } else { 29102 className = $[1]; 29103 props = $[2]; 29104 t1 = $[3]; 29105 } 29106 const t2 = !(t1 === void 0 ? true : t1); 29107 let t3; 29108 if ($[4] !== className || $[5] !== t2) { 29109 t3 = cn("flex w-full flex-wrap items-center gap-2 border border-border px-2 py-1", "group/input-group relative min-h-9 rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none dark:bg-input/30", "has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control]:focus-visible]:ring-ring/20", "has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-destructive/20 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40", { "border-0 shadow-none ring-0 has-[[data-slot=input-group-control]:focus-visible]:ring-0": t2 }, className); 29110 $[4] = className; 29111 $[5] = t2; 29112 $[6] = t3; 29113 } else t3 = $[6]; 29114 let t4; 29115 if ($[7] !== props || $[8] !== t3) { 29116 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 29117 ...props, 29118 className: t3 29119 }); 29120 $[7] = props; 29121 $[8] = t3; 29122 $[9] = t4; 29123 } else t4 = $[9]; 29124 return t4; 29125}; 29126const ComboboxInput = (t0) => { 29127 const $ = (0, import_compiler_runtime$16.c)(10); 29128 let className; 29129 let placeholder; 29130 let props; 29131 if ($[0] !== t0) { 29132 ({className, placeholder, ...props} = t0); 29133 $[0] = t0; 29134 $[1] = className; 29135 $[2] = placeholder; 29136 $[3] = props; 29137 } else { 29138 className = $[1]; 29139 placeholder = $[2]; 29140 props = $[3]; 29141 } 29142 let t1; 29143 if ($[4] !== className) { 29144 t1 = cn("bg-input-field file:bg-input-field w-full min-w-0 rounded-md border border-input text-sm shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "focu
29144s-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/20", "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40", "flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent", className); 29145 $[4] = className; 29146 $[5] = t1; 29147 } else t1 = $[5]; 29148 let t2; 29149 if ($[6] !== placeholder || $[7] !== props || $[8] !== t1) { 29150 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ko, { 29151 placeholder, 29152 "data-slot": "input-group-control", 29153 className: t1, 29154 ...props 29155 }); 29156 $[6] = placeholder; 29157 $[7] = props; 29158 $[8] = t1; 29159 $[9] = t2; 29160 } else t2 = $[9]; 29161 return t2; 29162}; 29163const ComboboxOptions = (t0) => { 29164 const $ = (0, import_compiler_runtime$16.c)(8); 29165 let className; 29166 let props; 29167 if ($[0] !== t0) { 29168 ({className, ...props} = t0); 29169 $[0] = t0; 29170 $[1] = className; 29171 $[2] = props; 29172 } else { 29173 className = $[1]; 29174 props = $[2]; 29175 } 29176 let t1; 29177 if ($[3] !== className) { 29178 t1 = cn("absolute z-50 mt-1 w-full overflow-auto rounded-lg", "border border-input bg-popover text-popover-foreground shadow-lg", "focu
29178s:outline-none", "animate-in fade-in-0 zoom-in-95", "p-1.5", "empty:invisible", className); 29179 $[3] = className; 29180 $[4] = t1; 29181 } else t1 = $[4]; 29182 let t2; 29183 if ($[5] !== props || $[6] !== t1) { 29184 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Uo, { 29185 className: t1, 29186 ...props 29187 }); 29188 $[5] = props; 29189 $[6] = t1; 29190 $[7] = t2; 29191 } else t2 = $[7]; 29192 return t2; 29193}; 29194const ComboboxOption = (t0) => { 29195 const $ = (0, import_compiler_runtime$16.c)(8); 29196 let className; 29197 let props; 29198 if ($[0] !== t0) { 29199 ({className, ...props} = t0); 29200 $[0] = t0; 29201 $[1] = className; 29202 $[2] = props; 29203 } else { 29204 className = $[1]; 29205 props = $[2]; 29206 } 29207 let t1; 29208 if ($[3] !== className) { 29209 t1 = cn("relative cursor-default rounded-md px-4 py-2 select-none", "data-focus:bg-accent data-focus:text-accent-foreground", "data-selected:bg-accent/50 data-selected:text-accent-foreground", "data-disabled:cursor-not-allowed data-disabled:opacity-50", "group", className); 29210 $[3] = className; 29211 $[4] = t1; 29212 } else t1 = $[4]; 29213 let t2; 29214 if ($[5] !== props || $[6] !== t1) { 29215 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Ho, { 29216 className: t1, 29217 ...props 29218 }); 29219 $[5] = props; 29220 $[6] = t1; 29221 $[7] = t2; 29222 } else t2 = $[7]; 29223 return t2; 29224}; 29225const ComboboxOptionGroup = (t0) => { 29226 const $ = (0, import_compiler_runtime$16.c)(8); 29227 let className; 29228 let props; 29229 if ($[0] !== t0) { 29230 ({className, ...props} = t0); 29231 $[0] = t0; 29232 $[1] = className; 29233 $[2] = props; 29234 } else { 29235 className = $[1]; 29236 props = $[2]; 29237 } 29238 let t1; 29239 if ($[3] !== className) { 29240 t1 = cn("flex w-full flex-col", className); 29241 $[3] = className; 29242 $[4] = t1; 29243 } else t1 = $[4]; 29244 let t2; 29245 if ($[5] !== props || $[6] !== t1) { 29246 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 29247 className: t1, 29248 ...props 29249 }); 29250 $[5] = props; 29251 $[6] = t1; 29252 $[7] = t2; 29253 } else t2 = $[7]; 29254 return t2; 29255}; 29256const ComboboxOptionGroupLabel = (t0) => { 29257 const $ = (0, import_compiler_runtime$16.c)(8); 29258 let className; 29259 let props; 29260 if ($[0] !== t0) { 29261 ({className, ...props} = t0); 29262 $[0] = t0; 29263 $[1] = className; 29264 $[2] = props; 29265 } else { 29266 className = $[1]; 29267 props = $[2]; 29268 } 29269 let t1; 29270 if ($[3] !== className) { 29271 t1 = cn("px-4 py-2 text-xs font-medium text-muted-foreground select-none", className); 29272 $[3] = className; 29273 $[4] = t1; 29274 } else t1 = $[4]; 29275 let t2; 29276 if ($[5] !== props || $[6] !== t1) { 29277 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 29278 className: t1, 29279 ...props 29280 }); 29281 $[5] = props; 29282 $[6] = t1; 29283 $[7] = t2; 29284 } else t2 = $[7]; 29285 return t2; 29286}; 29287const ComboboxEmpty = (t0) => { 29288 const $ = (0, import_compiler_runtime$16.c)(11); 29289 let children; 29290 let className; 29291 let props; 29292 let t1; 29293 if ($[0] !== t0) { 29294 ({className, visible: t1, children, ...props} = t0); 29295 $[0] = t0; 29296 $[1] = children; 29297 $[2] = className; 29298 $[3] = props; 29299 $[4] = t1; 29300 } else { 29301 children = $[1]; 29302 className = $[2]; 29303 props = $[3]; 29304 t1 = $[4]; 29305 } 29306 if (!(t1 === void 0 ? false : t1)) return null; 29307 let t2; 29308 if ($[5] !== className) { 29309 t2 = cn("relative cursor-default px-4 py-2 text-muted-foreground select-none", className); 29310 $[5] = className; 29311 $[6] = t2; 29312 } else t2 = $[6]; 29313 const t3 = children || "No results found."; 29314 let t4; 29315 if ($[7] !== props || $[8] !== t2 || $[9] !== t3) { 29316 t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 29317 ...props, 29318 className: t2, 29319 children: t3 29320 }); 29321 $[7] = props; 29322 $[8] = t2; 29323 $[9] = t3; 29324 $[10] = t4; 29325 } else t4 = $[10]; 29326 return t4; 29327}; 29328var import_compiler_runtime$15 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 29329function PhoneNumberSelect(t0) { 29330 const $ = (0, import_compiler_runtime$15.c)(40); 29331 const { dropDownClassName, value, onChange, onSearchChange, "aria-invalid": ariaInvalid, placeholder: t1, phoneNumber, ref } = t0; 29332 const placeholder = t1 === void 0 ? "Search by number" : t1; 29333 const [searchValue, setSearchValue] = (0, import_react.useState)(""); 29334 let t2; 29335 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 29336 t2 = { wait: 300 }; 29337 $[0] = t2; 29338 } else t2 = $[0]; 29339 const searchValueDebounced = useDebounce_default(searchValue, t2); 29340 const inputRef = (0, import_react.useRef)(null); 29341 let t3; 29342 if ($[1] !== searchValueDebounced) { 29343 t3 = sanitizePhoneSearchString(searchValueDebounced); 29344 $[1] = searchValueDebounced; 29345 $[2] = t3; 29346 } else t3 = $[2]; 29347 const t4 = phoneNumber?.dialCode ?? "1"; 29348 let t5; 29349 if ($[3] !== t3 || $[4] !== t4) { 29350 t5 = { 29351 phone: t3, 29352 code: t4 29353 }; 29354 $[3] = t3; 29355 $[4] = t4; 29356 $[5] = t5; 29357 } else t5 = $[5]; 29358 const t6 = !searchValueDebounced; 29359 let t7; 29360 if ($[6] !== t6) { 29361 t7 = { skip: t6 }; 29362 $[6] = t6; 29363 $[7] = t7; 29364 } else t7 = $[7]; 29365 const { data: fuzzySearchPhoneResponse, isLoading: isFuzzySearchPhoneLoading, isFetching: isFuzzySearchPhoneFetching } = useGetFuzzySearchPhoneQuery(t5, t7); 29366 const phoneNumbers = (searchValueDebounced ? get(fuzzySearchPhoneResponse, "data", []) ?? [] : []).map(_temp$2); 29367 const options = groupBy(phoneNumbers || [], _temp2$1); 29368 const isLoading = isFuzzySearchPhoneLoading || isFuzzySearchPhoneFetching; 29369 const isEmpty = !isLoading && phoneNumbers.length === 0; 29370 let t8; 29371 let t9; 29372 if ($[8] !== searchValue) { 29373 t8 = () => ({ 29374 searchValue, 29375 setSearchValue, 29376 focus: () => { 29377 inputRef.current?.focus(); 29378 } 29379 }); 29380 t9 = [ 29381 searchValue, 29382 setSearchValue, 29383 inputRef 29384 ]; 29385 $[8] = searchValue; 29386 $[9] = t8; 29387 $[10] = t9; 29388 } else { 29389 t8 = $[9]; 29390 t9 = $[10]; 29391 } 29392 (0, import_react.useImperativeHandle)(ref, t8, t9); 29393 const T0 = Combobox; 29394 const t10 = true; 29395 let t11; 29396 if ($[11] !== searchValue) { 29397 t11 = (selectedOption) => { 29398 const showPhone = selectedOption?.showPhone; 29399 if (showPhone) return formatPhone(normalizePhone(showPhone), "parentheses"); 29400 return searchValue ? formatPhone(searchValue, "parentheses") : ""; 29401 }; 29402 $[11] = searchValue; 29403 $[12] = t11; 29404 } else t11 = $[12]; 29405 let t12; 29406 if ($[13] !== onSearchChange) { 29407 t12 = (event_0) => { 29408 const searchString = getNumberValue(event_0.target.value); 29409 setSearchValue(searchString); 29410 onSearchChange?.(searchString); 29411 }; 29412 $[13] = onSearchChange; 29413 $[14] = t12; 29414 } else t12 = $[14]; 29415 let t13; 29416 if ($[15] !== placeholder || $[16] !== t11 || $[17] !== t12) { 29417 t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComboboxInput, { 29418 ref: inputRef, 29419 placeholder, 29420 displayValue: t11, 29421 onInput: _temp3, 29422 onChange: t12 29423 }); 29424 $[15] = placeholder; 29425 $[16] = t11; 29426 $[17] = t12; 29427 $[18] = t13; 29428 } else t13 = $[18]; 29429 let t14; 29430 if ($[19] !== ariaInvalid || $[20] !== t13) { 29431 t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComboboxWrapper, { 29432 "aria-invalid": ariaInvalid, 29433 children: t13 29434 }); 29435 $[19] = ariaInvalid; 29436 $[20] = t13; 29437 $[21] = t14; 29438 } else t14 = $[21]; 29439 const T1 = ComboboxOptions; 29440 const t15 = "bottom end"; 29441 let t16; 29442 if ($[22] !== dropDownClassName) {
29443 t16 = cn("max-h-85! w-(--input-width) [--anchor-gap:8px]", dropDownClassName); 29444 $[22] = dropDownClassName; 29445 $[23] = t16; 29446 } else t16 = $[23]; 29447 const t17 = false; 29448 let t18; 29449 if ($[24] !== isEmpty) { 29450 t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComboboxEmpty, { 29451 visible: isEmpty, 29452 className: "text-sm", 29453 children: "No Matches Found" 29454 }); 29455 $[24] = isEmpty; 29456 $[25] = t18; 29457 } else t18 = $[25]; 29458 let t19; 29459 if ($[26] !== isLoading) { 29460 t19 = isLoading && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 29461 className: "flex items-center gap-2 p-2 text-sm text-foreground", 29462 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { className: "text-primary" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Loading" })] 29463 }); 29464 $[26] = isLoading; 29465 $[27] = t19; 29466 } else t19 = $[27]; 29467 const t20 = !isLoading && phoneNumbers.length > 0 && Object.entries(options).map(_temp5); 29468 let t21; 29469 if ($[28] !== T1 || $[29] !== t16 || $[30] !== t18 || $[31] !== t19 || $[32] !== t20) { 29470 t21 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(T1, { 29471 anchor: t15, 29472 className: t16, 29473 modal: t17, 29474 children: [ 29475 t18, 29476 t19, 29477 t20 29478 ] 29479 }); 29480 $[28] = T1; 29481 $[29] = t16; 29482 $[30] = t18; 29483 $[31] = t19; 29484 $[32] = t20; 29485 $[33] = t21; 29486 } else t21 = $[33]; 29487 let t22; 29488 if ($[34] !== T0 || $[35] !== onChange || $[36] !== t14 || $[37] !== t21 || $[38] !== value) { 29489 t22 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(T0, { 29490 immediate: t10, 29491 value, 29492 onChange, 29493 children: [t14, t21] 29494 }); 29495 $[34] = T0; 29496 $[35] = onChange; 29497 $[36] = t14; 29498 $[37] = t21; 29499 $[38] = value; 29500 $[39] = t22; 29501 } else t22 = $[39]; 29502 return t22; 29503} 29504function _temp5(t0) { 29505 const [role, contacts] = t0; 29506 return contacts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ComboboxOptionGroup, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ComboboxOptionGroupLabel, { 29507 className: "p-2", 29508 children: ROLE_LABELS_MAPPING[role] 29509 }), contacts.map(_temp4)] }, role) : null; 29510} 29511function _temp4(contact, index) { 29512 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ComboboxOption, { 29513 value: contact, 29514 className: "flex items-center justify-between gap-1 p-2", 29515 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 29516 className: "block truncate", 29517 children: contact.name 29518 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 29519 className: "text-xs text-muted-foreground", 29520 children: formatPhone(normalizePhone(contact.phone), "parentheses") 29521 })] 29522 }, `${contact.phone}-${index}`); 29523} 29524function _temp3(event) { 29525 const digits = getNumberValue(event.currentTarget.value); 29526 event.currentTarget.value = digits ? formatPhone(digits, "parentheses") : ""; 29527} 29528function _temp2$1(item_0) { 29529 return item_0.role; 29530} 29531function _temp$2(item) { 29532 return item.role === "dispatch" ? Object.assign(item, { role: "dispatcher" }) : item; 29533} 29534var phone_number_select_default = PhoneNumberSelect; 29535var import_compiler_runtime$14 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 29536var alertVariants = cva("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-1 items-start [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:translate-y-0.5 [&>svg]:text-current", { 29537 variants: { variant: { 29538 default: "bg-card text-card-foreground", 29539 destructive: "text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90 *:data-[slot=alert-title]:text-destructive", 29540 info: "border-primary-muted bg-primary-muted text-foreground [&>svg]:text-primary", 29541 warning: "border-[#FBF4EC] bg-[#FBF4EC] dark:bg-warning/10 dark:border-warning/20 text-foreground [&>svg]:text-warning" 29542 } }, 29543 defaultVariants: { variant: "default" } 29544}); 29545function Alert(t0) { 29546 const $ = (0, import_compiler_runtime$14.c)(10); 29547 let className; 29548 let props; 29549 let variant; 29550 if ($[0] !== t0) { 29551 ({className, variant, ...props} = t0); 29552 $[0] = t0; 29553 $[1] = className; 29554 $[2] = props; 29555 $[3] = variant; 29556 } else { 29557 className = $[1]; 29558 props = $[2]; 29559 variant = $[3]; 29560 } 29561 let t1; 29562 if ($[4] !== className || $[5] !== variant) { 29563 t1 = cn(alertVariants({ variant }), className); 29564 $[4] = className; 29565 $[5] = variant; 29566 $[6] = t1; 29567 } else t1 = $[6]; 29568 let t2; 29569 if ($[7] !== props || $[8] !== t1) { 29570 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 29571 "data-slot": "alert", 29572 role: "alert", 29573 className: t1, 29574 ...props 29575 }); 29576 $[7] = props; 29577 $[8] = t1; 29578 $[9] = t2; 29579 } else t2 = $[9]; 29580 return t2; 29581} 29582function AlertTitle(t0) { 29583 const $ = (0, import_compiler_runtime$14.c)(8); 29584 let className; 29585 let props; 29586 if ($[0] !== t0) { 29587 ({className, ...props} = t0); 29588 $[0] = t0; 29589 $[1] = className; 29590 $[2] = props; 29591 } else { 29592 className = $[1]; 29593 props = $[2]; 29594 } 29595 let t1; 29596 if ($[3] !== className) { 29597 t1 = cn("col-start-2 line-clamp-1 min-h-4 text-sm leading-5 font-medium text-foreground", className); 29598 $[3] = className; 29599 $[4] = t1; 29600 } else t1 = $[4]; 29601 let t2; 29602 if ($[5] !== props || $[6] !== t1) { 29603 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 29604 "data-slot": "alert-title", 29605 className: t1, 29606 ...props 29607 }); 29608 $[5] = props; 29609 $[6] = t1; 29610 $[7] = t2; 29611 } else t2 = $[7]; 29612 return t2; 29613}
29614function AlertDescription(t0) { 29615 const $ = (0, import_compiler_runtime$14.c)(8); 29616 let className; 29617 let props; 29618 if ($[0] !== t0) { 29619 ({className, ...props} = t0); 29620 $[0] = t0; 29621 $[1] = className; 29622 $[2] = props; 29623 } else { 29624 className = $[1]; 29625 props = $[2]; 29626 } 29627 let t1; 29628 if ($[3] !== className) { 29629 t1 = cn("col-start-2 grid justify-items-start gap-1 text-sm leading-5 text-muted-foreground [&_p]:leading-relaxed", className); 29630 $[3] = className; 29631 $[4] = t1; 29632 } else t1 = $[4]; 29633 let t2; 29634 if ($[5] !== props || $[6] !== t1) { 29635 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 29636 "data-slot": "alert-description", 29637 className: t1, 29638 ...props 29639 }); 29640 $[5] = props; 29641 $[6] = t1; 29642 $[7] = t2; 29643 } else t2 = $[7]; 29644 return t2; 29645} 29646var import_compiler_runtime$13 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 29647function DialerSubscriptionInMessage() { 29648 const $ = (0, import_compiler_runtime$13.c)(6); 29649 const dispatch = useAppDispatch(); 29650 let t0; 29651 if ($[0] !== dispatch) { 29652 t0 = () => { 29653 trackMethodCall("handleTryDialer", []); 29654 dispatch(openDialerNotificationByType("start-free-trial")); 29655 }; 29656 $[0] = dispatch; 29657 $[1] = t0; 29658 } else t0 = $[1]; 29659 const handleTryDialer = t0; 29660 let t1; 29661 if ($[2] === Symbol.for("react.memo_cache_sentinel")) { 29662 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { 29663 src: dialer_advertise_q80_default, 29664 alt: "dialer-advertise", 29665 className: "h-66.5 w-75 shrink-0" 29666 }); 29667 $[2] = t1; 29668 } else t1 = $[2]; 29669 let t2; 29670 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 29671 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", { 29672 className: "flex w-full flex-col items-center gap-2 text-center", 29673 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { 29674 className: "text-2xl leading-8 font-semibold text-foreground", 29675 children: "Get 50 minutes Free Trial" 29676 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 29677 className: "text-sm leading-5 text-muted-foreground", 29678 children: "Use the virtual number to make and receive calls directly through the browser. It will automatically link contact info to your caller." 29679 })] 29680 }); 29681 $[3] = t2; 29682 } else t2 = $[3]; 29683 let t3; 29684 if ($[4] !== handleTryDialer) { 29685 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { 29686 className: "flex h-full flex-col items-center justify-center gap-10 px-5", 29687 children: [t1, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("article", { 29688 className: "flex flex-col items-center justify-center gap-6", 29689 children: [t2, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 29690 onClick: handleTryDialer, 29691 children: "Try Dialer For Free" 29692 })] 29693 })] 29694 }); 29695 $[4] = handleTryDialer; 29696 $[5] = t3; 29697 } else t3 = $[5]; 29698 return t3; 29699} 29700function DialerSubscriptionInMessageAlert(t0) { 29701 const $ = (0, import_compiler_runtime$13.c)(6); 29702 const { type } = t0; 29703 const dispatch = useAppDispatch(); 29704 let t1; 29705 if ($[0] !== dispatch || $[1] !== type) { 29706 t1 = () => { 29707 trackMethodCall("handleUpgrade", []); 29708 dispatch(openDialerNotificationByType(type)); 29709 }; 29710 $[0] = dispatch; 29711 $[1] = type; 29712 $[2] = t1; 29713 } else t1 = $[2]; 29714 const handleUpgrade = t1; 29715 let t2; 29716 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 29717 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TriangleAlert, { className: "-mt-1" }); 29718 $[3] = t2; 29719 } else t2 = $[3]; 29720 let t3; 29721 if ($[4] !== handleUpgrade) { 29722 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Alert, { 29723 variant: "info", 29724 className: "items-center rounded-none", 29725 children: [t2, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertTitle, { 29726 className: "flex items-center justify-between gap-2", 29727 children: ["Subscription required", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 29728 variant: "outline", 29729 size: "sm", 29730 onClick: handleUpgrade, 29731 className: "h-6 rounded-md", 29732 children: "Upgrade" 29733 })] 29734 })] 29735 }); 29736 $[4] = handleUpgrade; 29737 $[5] = t3; 29738 } else t3 = $[5]; 29739 return t3; 29740} 29741var dialer_subscription_in_message_default = DialerSubscriptionInMessage; 29742var import_compiler_runtime$12 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 29743function useMutation(mutationFn) { 29744 const $ = (0, import_compiler_runtime$12.c)(7); 29745 let t0; 29746 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 29747 t0 = { 29748 data: void 0, 29749 error: void 0, 29750 isLoading: false, 29751 isError: false 29752 }; 29753 $[0] = t0; 29754 } else t0 = $[0]; 29755 const [state$3, setState] = (0, import_react.useState)(t0); 29756 const mutationIdRef = (0, import_react.useRef)(0); 29757 let t1; 29758 if ($[1] !== mutationFn) { 29759 t1 = async (variables) => { 29760 const currentMutationId = mutationIdRef.current = mutationIdRef.current + 1; 29761 setState({ 29762 data: void 0, 29763 error: void 0, 29764 isLoading: true, 29765 isError: false 29766 }); 29767 try { 29768 const data = await mutationFn(variables); 29769 if (currentMutationId === mutationIdRef.current) setState({ 29770 data, 29771 error: void 0, 29772 isLoading: false, 29773 isError: false 29774 }); 29775 } catch (t2$1) { 29776 const error = t2$1; 29777 if (currentMutationId === mutationIdRef.current) setState({ 29778 data: void 0, 29779 error, 29780 isLoading: false, 29781 isError: true 29782 }); 29783 } 29784 }; 29785 $[1] = mutationFn; 29786 $[2] = t1; 29787 } else t1 = $[2]; 29788 const mutate = t1; 29789 let t2; 29790 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 29791 t2 = () => { 29792 setState({ 29793 data: void 0, 29794 error: void 0, 29795 isLoading: false, 29796 isError: false 29797 }); 29798 }; 29799 $[3] = t2; 29800 } else t2 = $[3]; 29801 const reset = t2; 29802 let t3; 29803 if ($[4] !== mutate || $[5] !== state$3) { 29804 t3 = { 29805 ...state$3, 29806 mutate, 29807 reset 29808 }; 29809 $[4] = mutate; 29810 $[5] = state$3; 29811 $[6] = t3; 29812 } else t3 = $[6]; 29813 return t3; 29814} 29815var use_mutation_default = useMutation; 29816function DialerPad() { 29817 const [countryCode, setCountryCode] = (0, import_react.useState)("US"); 29818 const activeData = useAppSelector(selectActive); 29819 const userInfo = useUserInfoQueryState(); 29820 const isAdmin = getRoleName(userInfo?.rank) === "Super Admin"; 29821 const subscriptionAlertType = (0, import_react.useMemo)(() => { 29822 if (!activeData) return null; 29823 const seat = activeData.dialerSeatDetail; 29824 if (activeData.payStatus === 6 && seat && !seat.isBasic) return isAdmin ? "subscription-required" : "subscription-required-operator"; 29825 if (seat && !seat.isUnlimited && seat.isBasic && !activeData.hasMinutes) return isAdmin ? "free-trial-ended" : "free-trial-ended-operator"; 29826 return null; 29827 }, [activeData, isAdmin]); 29828 const [phoneNumber, setPhoneNumber] = (0, import_react.useState)(null); 29829 const phoneInputContainerRef = (0, import_react.useRef)(null); 29830 const phoneNumberSelectRef = (0, import_react.useRef)(null); 29831 const phoneInputContainerSize = useSize_default(phoneInputContainerRef); 29832 const selectedCountry = COUNTRY_OPTIONS.find((country) => { 29833 return country.code === countryCode; 29834 }); 29835 const { call } = useDialersContext(); 29836 const { mutate: makeCall, isLoading: isMakingCallLoading } = use_mutation_default(call); 29837 const { data: userPhoneSearchResponse, isLoading: isUserPhoneSearchLoading, isFetching: isUserPhoneSearchFetching } = useGetUserPhoneSearchQuery({ phone: phoneNumber?.phone ?? "" }, { skip: !phoneNumber?.phone }); 29838 const userPhoneSearch = get(userPhoneSearchResponse, "data", []) ?? []; 29839 const handleDigitPress = (digit) => { 29840 trackMethodCall("handleDigitPress", [digit]); 29841 if (!phoneNumberSelectRef.current) return; 29842 const prevSearchValue = phoneNumberSelectRef.current.searchValue; 29843 phoneNumberSelectRef.current.setSearchValue(prevSearchValue + digit); 29844 phoneNumberSelectRef.current.focus(); 29845 }; 29846 const handleBackspace = () => { 29847 trackMethodCall("handleBackspace", []); 29848 if (!phoneNumberSelectRef.current) return; 29849 const prevSearchValue_0 = phoneNumberSelectRef.current.searchValue; 29850 phoneNumberSelectRef.current.setSearchValue(prevSearchValue_0.slice(0, -1)); 29851 phoneNumberSelectRef.current.focus(); 29852 }; 29853 const placeCallToNumber = (rawPhone, { showInvalidToast = false } = {}) => { 29854 let digits = rawPhone.replace(/[^\d]/g, ""); 29855 if (digits.length === 11 && digits.startsWith("1")) digits = digits.slice(1); 29856 if (digits.length !== 10) {
29857 if (showInvalidToast) toast.warning("Invalid phone number."); 29858 return false; 29859 } 29860 const phoneNo = `+${selectedCountry?.dialCode}${digits}`; 29861 let role = phoneNumber?.role; 29862 if (role === "dispatch") role = "dispatcher"; 29863 makeCall({ 29864 to: phoneNo, 29865 called: phoneNo, 29866 role: role?.toUpperCase(), 29867 personId: phoneNumber?.activityClientId ?? 0, 29868 contactId: phoneNumber?.originalUserId ?? 0, 29869 source: `${role ?? ""} List-Button` 29870 }); 29871 return true; 29872 }; 29873 const handleCall = () => { 29874 trackMethodCall("handleCall", []); 29875 const rawPhone_0 = phoneNumber?.showPhone ?? phoneNumberSelectRef.current?.searchValue ?? ""; 29876 placeCallToNumber(rawPhone_0, { showInvalidToast: true }); 29877 }; 29878 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 29879 className: "flex h-full flex-col gap-1", 29880 children: [ 29881 subscriptionAlertType && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialerSubscriptionInMessageAlert, { type: subscriptionAlertType }), 29882 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 29883 className: "flex gap-3 px-5 pt-5", 29884 ref: phoneInputContainerRef, 29885 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select, { 29886 value: countryCode, 29887 onValueChange: setCountryCode, 29888 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectTrigger, { 29889 className: "w-[94px] shrink-0", 29890 "aria-label": "Country code", 29891 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectValue, { 29892 placeholder: "Select a country", 29893 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 29894 className: "flex items-center gap-2", 29895 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 29896 name: selectedCountry?.flag ?? "", 29897 className: "size-4" 29898 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: ["+", selectedCountry?.dialCode] })] 29899 }) 29900 }) 29901 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContent, { 29902 align: "start", 29903 className: "w-50", 29904 children: COUNTRY_OPTIONS.map((country_0) => { 29905 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectItem, { 29906 value: country_0.code, 29907 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 29908 className: "flex items-center gap-2", 29909 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 29910 name: country_0.flag, 29911 className: "size-4" 29912 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [ 29913 country_0.name, 29914 " +", 29915 country_0.dialCode 29916 ] })] 29917 }) 29918 }, country_0.code); 29919 }) 29920 })] 29921 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(phone_number_select_default, { 29922 ref: phoneNumberSelectRef, 29923 value: phoneNumber, 29924 onChange: setPhoneNumber, 29925 onSearchChange: () => { 29926 return setPhoneNumber(null); 29927 }, 29928 phoneNumber: selectedCountry, 29929 dropDownClassName: cn("[--anchor-offset:9px]", css` 29930 width: ${phoneInputContainerSize?.width ? phoneInputContainerSize.width - 40 + "px" : "var(--input-width)"}; 29931 `) 29932 })] 29933 }), 29934 phoneNumber && userPhoneSearch.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dialer_multiple_identities_default, { 29935 className: "mt-2 h-5 justify-center gap-1 px-5 text-foreground", 29936 contacts: userPhoneSearch, 29937 selectedContact: phoneNumber ?? void 0, 29938 onSelectedContactChange: setPhoneNumber, 29939 children: [ 29940 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 29941 className: "truncate text-xs font-medium text-foreground", 29942 children: phoneNumber.name 29943 }), 29944 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 29945 variant: "neutral-subtle", 29946 className: "h-5", 29947 children: ROLE_LABELS_MAPPING[phoneNumber.role] 29948 }), 29949 isUserPhoneSearchLoading || isUserPhoneSearchFetching ? /* @__P
29949URE__ */ (0, import_jsx_runtime.jsx)(Spinner, { className: "size-4 text-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronDown, { className: "size-4" }) 29950 ] 29951 }), 29952 phoneNumber && userPhoneSearch.length <= 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 29953 className: "mt-2 flex h-5 items-center justify-center gap-1 truncate text-xs font-medium text-foreground select-none", 29954 children: [ 29955 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { 29956 className: "truncate", 29957 children: phoneNumber.name 29958 }), 29959 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, { 29960 variant: "neutral-subtle", 29961 className: "h-5", 29962 children: ROLE_LABELS_MAPPING[phoneNumber.role] 29963 }), 29964 (isUserPhoneSearchLoading || isUserPhoneSearchFetching) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { className: "size-4 text-primary" }) 29965 ] 29966 }), 29967 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 29968 className: "flex flex-1 flex-col items-center", 29969 children: [ 29970 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "w-px flex-1" }), 29971 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 29972 className: "w-full", 29973 children: DIAL_PAD_KEYS.map((row, rowIndex) => { 29974 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 29975 className: "flex", 29976 children: row.map((padKey, colIndex) => { 29977 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, { 29978 type: "button", 29979 variant: "ghost", 29980 onClick: () => { 29981 return handleDigitPress(padKey.digit); 29982 }, 29983 className: cn("flex flex-1 flex-col items-center justify-center gap-0 rounded-none border-border bg-background", "h-[clamp(50px,10vh,80px)]", "hover:bg-accent active:bg-accent active:opacity-100", rowIndex === 0 && "border-t", "border-b", colIndex < row.length - 1 && "border-r"), 29984 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 29985 className: "font-numeric text-xl leading-7 font-bold text-accent-foreground", 29986 children: padKey.digit 29987 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { 29988 "data-hidden": !padKey.letters, 29989 className: "text-xs leading-4 text-muted-foreground data-[hidden=true]:opacity-0", 29990 children: padKey.letters ?? "hidden" 29991 })] 29992 }, padKey.digit); 29993 }) 29994 }, rowIndex); 29995 }) 29996 }), 29997 /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 29998 className: "flex w-full flex-1 items-center justify-between px-5 py-4", 29999 children: [ 30000 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-7 w-10" }), 30001 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, { 30002 size: "icon", 30003 "aria-label": "Call", 30004 onClick: handleCall, 30005 className: "size-15 rounded-full bg-emerald-500 transition-transform hover:scale-105 hover:bg-emerald-600 active:scale-100 active:opacity-100", 30006 disabled: isMakingCallLoading,
30007 children: isMakingCallLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { className: "size-5 text-white" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Phone, { className: "size-5 fill-white text-white" }) 30008 }), 30009 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BizIcon, { 30010 name: "backspace", 30011 onClick: handleBackspace, 30012 className: "h-7 w-10 transition-transform select-none hover:scale-105 active:scale-100" 30013 }) 30014 ] 30015 }) 30016 ] 30017 }) 30018 ] 30019 }); 30020} 30021var dialer_pad_default = DialerPad; 30022var INIT_UNREAD_COUNT = { 30023 unreadCalls: 0, 30024 unreadVoiceMails: 0 30025}; 30026var DIALER_TABS = [ 30027 { 30028 value: "dial-pad", 30029 label: "Dial Pad", 30030 icon: Grip, 30031 content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_pad_default, {}) 30032 }, 30033 { 30034 value: "recent", 30035 label: "Recent", 30036 icon: Clock, 30037 content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_recent_default, {}), 30038 notUpgradeFallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_subscription_in_message_default, {}) 30039 }, 30040 { 30041 value: "voicemail", 30042 label: "Voicemail", 30043 icon: Voicemail, 30044 content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_voice_mail_default, {}), 30045 notUpgradeFallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_subscription_in_message_default, {}) 30046 }, 30047 { 30048 value: "settings", 30049 label: "Settings", 30050 icon: Settings, 30051 content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_settings_default, {}), 30052 notUpgradeFallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_subscription_in_message_default, {}) 30053 } 30054]; 30055var Dialer = () => { 30056 const dispatch = useAppDispatch(); 30057 const dialerView = useAppSelector(selectDialerView); 30058 const activeData = useAppSelector(selectActive); 30059 const unreadCount = useAppSelector(selectCount); 30060 const { checkTrialAndDisplayDialog } = useDialersContext(); 30061 const userInfo = useUserInfoQueryState(); 30062 const isAdmin = getRoleName(userInfo?.rank) === "Super Admin"; 30063 const hasBaseDialerSeat = userInfo?.hasBaseDialerSeat; 30064 const unreadMapping = (0, import_react.useMemo)(() => { 30065 const countData = pick(unreadCount, ["unreadCalls", "unreadVoiceMails"]); 30066 const { unreadCalls, unreadVoiceMails } = Object.assign({}, INIT_UNREAD_COUNT, countData); 30067 return { 30068 recent: unreadCalls, 30069 voicemail: unreadVoiceMails 30070 }; 30071 }, [unreadCount]); 30072 const isNotUpgrade = (0, import_react.useMemo)(() => { 30073 if (!isAdmin || !activeData) return false; 30074 const seat = activeData?.dialerSeatDetail; 30075 const hasSeat = activeData?.hasSeat; 30076 return (!activeData?.hasValidOrder && (!seat || !seat.isBasic) || !hasSeat) && !hasBaseDialerSeat; 30077 }, [ 30078 isAdmin, 30079 hasBaseDialerSeat, 30080 activeData 30081 ]); 30082 const handleDialerView = (value) => { 30083 trackMethodCall("handleDialerView", [value]); 30084 dispatch(setDialerView(value)); 30085 }; 30086 const cleanup = async () => { 30087 await dispatch(setDialerView("dial-pad")); 30088 }; 30089 (0, import_react.useEffect)(() => { 30090 checkTrialAndDisplayDialog(); 30091 return () => { 30092 cleanup(); 30093 }; 30094 }, []); 30095 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialerTabs, { 30096 defaultValue: "dial-pad", 30097 value: dialerView, 30098 onValueChange: handleDialerView, 30099 children: [DIALER_TABS.map((tab) => { 30100 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialerTabsContent, { 30101 value: tab.value, 30102 children: isNotUpgrade && tab.notUpgradeFallback ? tab.notUpgradeFallback : tab.content 30103 }, tab.value); 30104 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialerTabsList, { children: DIALER_TABS.map((tab) => { 30105 const Icon$1 = tab.icon; 30106 const unread = unreadMapping[tab.value] ?? 0; 30107 return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialerTabsTrigger, { 30108 value: tab.value, 30109 className: "relative", 30110 children: [ 30111 /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon$1, { className: "size-4.5" }), 30112 /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: tab.label }), 30113 unread > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 30114 className: "absolute top-2 left-[calc(50%_+_9px)] flex h-4 max-w-6.5 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-xs font-medium text-white", 30115 children: unread > 99 ? "99+" : unread 30116 }) 30117 ] 30118 }, tab.value); 30119 }) })] 30120 }) }); 30121}; 30122var dialer_in_message_default = Dialer; 30123var import_compiler_runtime$11 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 30124var tabs = [{ 30125 value: "messages", 30126 label: "Messages", 30127 Component: messages_panel_default 30128}, { 30129 value: "dialer", 30130 label: "Dialer", 30131 Component: dialer_in_message_default 30132}]; 30133const MessagesAndDialersTabs = () => { 30134 const $ = (0, import_compiler_runtime$11.c)(7); 30135 const messagesTabValue = useAppSelector(selectMessagesTabValue); 30136 const dispatch = useAppDispatch(); 30137 let t0; 30138 if ($[0] !== dispatch) { 30139 t0 = (value) => { 30140 trackMethodCall("handleMessagesTabValue", [value]); 30141 if (value === "dialer") { 30142 dispatch(setView("default")); 30143 dispatch(setSessionId(void 0)); 30144 } 30145 dispatch(setMessagesTabValue(value)); 30146 }; 30147 $[0] = dispatch; 30148 $[1] = t0; 30149 } else t0 = $[1]; 30150 const handleMessagesTabValue = t0; 30151 let t1; 30152 let t2; 30153 if ($[2] === Symbol.for("react.memo_cache_sentinel")) { 30154 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsList, { 30155 className: "gap-0 border-0 px-3", 30156 children: tabs.map(_temp$1) 30157 }); 30158 t2 = tabs.map(_temp2); 30159 $[2] = t1; 30160 $[3] = t2; 30161 } else { 30162 t1 = $[2]; 30163 t2 = $[3]; 30164 } 30165 let t3; 30166 if ($[4] !== handleMessagesTabValue || $[5] !== messagesTabValue) { 30167 t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tabs, { 30168 defaultValue: "messages", 30169 className: "h-full", 30170 value: messagesTabValue, 30171 onValueChange: handleMessagesTabValue, 30172 children: [t1, t2] 30173 }); 30174 $[4] = handleMessagesTabValue; 30175 $[5] = messagesTabValue; 30176 $[6] = t3; 30177 } else t3 = $[6]; 30178 return t3; 30179}; 30180function _temp$1(tab) { 30181 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsTrigger, { 30182 value: tab.value, 30183 className: "underline-none border-0 text-xl font-semibold",
30184 children: tab.label 30185 }, tab.value); 30186} 30187function _temp2(tab_0) { 30188 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsContent, { 30189 value: tab_0.value, 30190 className: "min-h-0", 30191 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(tab_0.Component, {}) 30192 }, tab_0.value); 30193} 30194var import_compiler_runtime$10 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 30195var MessagesAndDialers = () => { 30196 const $ = (0, import_compiler_runtime$10.c)(5); 30197 const view = useAppSelector(selectView); 30198 let t0; 30199 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 30200 t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessagesAndDialersTabs, {}); 30201 $[0] = t0; 30202 } else t0 = $[0]; 30203 let t1; 30204 if ($[1] !== view) { 30205 t1 = view === "group-members" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 30206 className: "absolute inset-0 z-10 bg-background", 30207 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_groups_manage_members_default, {}) 30208 }); 30209 $[1] = view; 30210 $[2] = t1; 30211 } else t1 = $[2]; 30212 let t2; 30213 if ($[3] !== t1) { 30214 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { 30215 className: "relative h-full", 30216 children: [t0, t1] 30217 }); 30218 $[3] = t1; 30219 $[4] = t2; 30220 } else t2 = $[4]; 30221 return t2; 30222}; 30223var messages_and_dialers_default = MessagesAndDialers; 30224var import_compiler_runtime$9 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 30225var MessagesAndDialersSheet = () => { 30226 const $ = (0, import_compiler_runtime$9.c)(17); 30227 const dispatch = useAppDispatch(); 30228 const open = useAppSelector(selectOpen); 30229 const isMinimized = useAppSelector(selectIsMinimizeSheetOpen); 30230 const sheetContentRef = (0, import_react.useRef)(null); 30231 const prevOpenRef = (0, import_react.useRef)(open); 30232 let t0; 30233 let t1; 30234 if ($[0] !== dispatch || $[1] !== open) { 30235 t0 = () => { 30236 if (prevOpenRef.current && !open) { 30237 dispatch(setView("default")); 30238 dispatch(setSessionId(void 0)); 30239 dispatch(setMessagesTabValue("messages")); 30240 } 30241 prevOpenRef.current = open; 30242 }; 30243 t1 = [open, dispatch]; 30244 $[0] = dispatch; 30245 $[1] = open; 30246 $[2] = t0; 30247 $[3] = t1; 30248 } else { 30249 t0 = $[2]; 30250 t1 = $[3]; 30251 } 30252 (0, import_react.useEffect)(t0, t1); 30253 let t2; 30254 if ($[4] === Symbol.for("react.memo_cache_sentinel")) { 30255 t2 = () => sheetContentRef.current?.getBoundingClientRect(); 30256 $[4] = t2; 30257 } else t2 = $[4]; 30258 const getMessagesAndDialersSheetRect = t2; 30259 const t3 = isMinimized && "invisible"; 30260 let t4; 30261 if ($[5] !== t3) { 30262 t4 = cn("h-full", t3); 30263 $[5] = t3; 30264 $[6] = t4; 30265 } else t4 = $[6]; 30266 let t5; 30267 if ($[7] === Symbol.for("react.memo_cache_sentinel")) { 30268 t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SheetHeader, { 30269 className: "sr-only", 30270 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetTitle, { children: "Messages" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetDescription, { children: "Messages" })] 30271 }); 30272 $[7] = t5; 30273 } else t5 = $[7]; 30274 let t6; 30275 if ($[8] === Symbol.for("react.memo_cache_sentinel")) { 30276 t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider, { 30277 getMessagesAndDialersSheetRect, 30278 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_and_dialers_default, {}) 30279 }); 30280 $[8] = t6; 30281 } else t6 = $[8]; 30282 let t7; 30283 if ($[9] !== dispatch) { 30284 t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SheetCloseButton, { 30285 onClick: () => { 30286 dispatch(setOpen(false)); 30287 dispatch(closeNestedSheet()); 30288 }, 30289 tabIndex: -1 30290 }); 30291 $[9] = dispatch; 30292 $[10] = t7; 30293 } else t7 = $[10]; 30294 let t8; 30295 if ($[11] !== t4 || $[12] !== t7) { 30296 t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SheetContent, { 30297 ref: sheetContentRef, 30298 className: t4, 30299 showCloseButton: false, 30300 children: [ 30301 t5, 30302 t6, 30303 t7 30304 ] 30305 }); 30306 $[11] = t4; 30307 $[12] = t7; 30308 $[13] = t8; 30309 } else t8 = $[13]; 30310 let t9; 30311 if ($[14] !== open || $[15] !== t8) { 30312 t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sheet, { 30313 open, 30314 modal: false, 30315 children: t8 30316 }); 30317 $[14] = open; 30318 $[15] = t8; 30319 $[16] = t9; 30320 } else t9 = $[16]; 30321 return t9; 30322}; 30323var messages_and_dialers_sheet_default = MessagesAndDialersSheet; 30324var import_compiler_runtime$8 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 30325const AppSheets = () => { 30326 const $ = (0, import_compiler_runtime$8.c)(1); 30327 let t0; 30328 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 30329 t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(messages_and_dialers_sheet_default, {}
30329), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dialer_calling_group_sheets_default, {})] }); 30330 $[0] = t0; 30331 } else t0 = $[0]; 30332 return t0; 30333}; 30334const { useGetPermissionSettingsListQuery, useGetCompanyAuthoritiesFleetQuery, useSetCompanyAuthoritiesFleetMutation, useGetDriverPermissionGroupListQuery, useSetDefaultProfileMutation, useDeletePermissionProfileMutation, useGetProfileAppliedGroupListQuery, useCreatePermissionProfileMutation, useGetPermissionProfileInfoQuery, useEditPermissionProfileMutation } = baseApi.injectEndpoints({ 30335 endpoints: (builder) => ({ 30336 getPermissionSettingsList: builder.query({ 30337 query: (params) => ({ 30338 url: "/command-center/authorities/settings/V2", 30339 method: "GET", 30340 params, 30341 headers: { "system-source": "fleet" } 30342 }), 30343 transformResponse: (response) => response.data, 30344 providesTags: ["permissionSettings"] 30345 }), 30346 getCompanyAuthoritiesFleet: builder.query({ 30347 query: () => ({ 30348 url: "/command-center/company/authorities/fleet", 30349 method: "GET", 30350 headers: { "system-source": "fleet" } 30351 }), 30352 transformResponse: (response) => response.data, 30353 providesTags: ["companyPermissions"] 30354 }), 30355 setCompanyAuthoritiesFleet: builder.mutation({ 30356 query: (body) => ({ 30357 url: "/command-center/company/authorities/fleet", 30358 method: "PUT", 30359 body 30360 }), 30361 invalidatesTags: ["companyPermissions"] 30362 }), 30363 getDriverPermissionGroupList: builder.query({ 30364 query: () => ({ 30365 url: "/command-center/permissionGroup/company/profile/list", 30366 method: "GET", 30367 headers: { "system-source": "fleet" } 30368 }), 30369 transformResponse: (response) => response.data, 30370 providesTags: ["driverPermissionGroupList"] 30371 }), 30372 setDefaultProfile: builder.mutation({ 30373 query: ({ id, isDefault }) => ({ 30374 url: "/command-center/permissionGroup/set/default/profile", 30375 method: "GET", 30376 params: { 30377 id, 30378 isDefault 30379 }, 30380 headers: { "system-source": "fleet" } 30381 }), 30382 invalidatesTags: ["driverPermissionGroupList"] 30383 }), 30384 deletePermissionProfile: builder.mutation({ 30385 query: (ids) => ({ 30386 url: "/command-center/permissionGroup/delete/profile", 30387 method: "POST", 30388 body: ids, 30389 headers: { "system-source": "fleet" } 30390 }), 30391 invalidatesTags: ["driverPermissionGroupList"] 30392 }), 30393 getProfileAppliedGroupList: builder.query({ 30394 query: ({ profileId } = {}) => ({ 30395 url: "/command-center/permissionGroup/profile/company/group/list", 30396 method: "GET", 30397 params: { 30398 page: 0, 30399 size: 1e4, 30400 ...profileId && { profileId } 30401 }, 30402 headers: { "system-source": "fleet" } 30403 }), 30404 transformResponse: (response) => response.data.list, 30405 providesTags: ["profileAppliedGroupList"] 30406 }), 30407 getPermissionProfileInfo: builder.query({ 30408 query: (id) => ({ 30409 url: `/command-center/permissionGroup/get/profile/permission/${id}`, 30410 method: "GET", 30411 headers: { "system-source": "fleet" } 30412 }), 30413 transformResponse: (response) => response.data, 30414 providesTags: (_result, _error, id) => [{ 30415 type: "permissionProfileInfo", 30416 id 30417 }] 30418 }), 30419 createPermissionProfile: builder.mutation({ 30420 query: (body) => ({ 30421 url: "/command-center/permissionGroup/create/profile", 30422 method: "POST", 30423 body, 30424 headers: { "system-source": "fleet" } 30425 }), 30426 invalidatesTags: ["driverPermissionGroupList"] 30427 }), 30428 editPermissionProfile: builder.mutation({ 30429 query: (body) => ({ 30430 url: "/command-center/group/authorities/fleet/group", 30431 method: "PUT", 30432 body, 30433 headers: { "system-source": "fleet" } 30434 }), 30435 invalidatesTags: ["driverPermissionGroupList"] 30436 }) 30437 }), 30438 overrideExisting: true 30439}); 30440var import_compiler_runtime$7 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 30441var EDGE_RENEWAL_FAIL_KEY = "edgeRenewalFailEmail"; 30442const useAuthGuard = () => { 30443 const $ = (0, import_compiler_runtime$7.c)(40); 30444 const userToken = useAppSelector(selectUserToken); 30445 const dispatch = useAppDispatch(); 30446 const navigate = useNavigate(); 30447 const [searchParams] = useSearchParams(); 30448 const userInfo = useUserInfoQueryState(); 30449 const retryCountRef = (0, import_react.useRef)(0); 30450 const t0 = !userToken; 30451 let t1; 30452 if ($[0] !== t0) { 30453 t1 = { skip: t0 }; 30454 $[0] = t0; 30455 $[1] = t1; 30456 } else t1 = $[1]; 30457 const { data: userInfoData, error, isFetching, isSuccess, refetch } = useGetUserInfoQuery(void 0, t1); 30458 const t2 = !userToken; 30459 let t3; 30460 if ($[2] !== t2) { 30461 t3 = { skip: t2 }; 30462 $[2] = t2; 30463 $[3] = t3; 30464 } else t3 = $[3]; 30465 useGetCompanyAuthoritiesFleetQuery(void 0, t3); 30466 let t4; 30467 if ($[4] !== userInfoData) { 30468 t4 = () => { 30469 if (!userInfoData?.data) return; 30470 const user = userInfoData.data; 30471 identify(String(user.id), { 30472 companyId: user.companyId, 30473 companyName: user.companyName, 30474 userId: user.userId, 30475 userTpId: user.userTpId, 30476 fleetSize: user.fleetSize, 30477 roleType: user.roleType, 30478 editionType: user.editionType 30479 }); 30480 }; 30481 $[4] = userInfoData; 30482 $[5] = t4; 30483 } else t4 = $[5]; 30484 const t5 = userInfoData?.data; 30485 let t6; 30486 if ($[6] !== t5) { 30487 t6 = [t5]; 30488 $[6] = t5; 30489 $[7] = t6; 30490 } else t6 = $[7]; 30491 (0, import_react.useEffect)(t4, t6); 30492 let t7; 30493 let t8; 30494 if ($[8] !== dispatch || $[9] !== error) { 30495 t7 = () => { 30496 if (error) dispatch(setUserToken(void 0)); 30497 }; 30498 t8 = [error, dispatch]; 30499 $[8] = dispatch; 30500 $[9] = error; 30501 $[10] = t7; 30502 $[11] = t8; 30503 } else { 30504 t7 = $[10]; 30505 t8 = $[11]; 30506 } 30507 (0, import_react.useEffect)(t7, t8); 30508 let t9; 30509 if ($[12] !== dispatch || $[13] !== isFetching || $[14] !== isSuccess || $[15] !== refetch || $[16] !== userInfoData?.code) { 30510 t9 = () => { 30511 if (isFetching || !isSuccess) return; 30512 if (userInfoData?.code !== 200) if (retryCountRef.current < 3) { 30513 retryCountRef.current = retryCountRef.current + 1; 30514 refetch(); 30515 } else dispatch(setUserToken(void 0)); 30516 else retryCountRef.current = 0; 30517 }; 30518 $[12] = dispatch; 30519 $[13] = isFetching; 30520 $[14] = isSuccess; 30521 $[15] = refetch; 30522 $[16] = userInfoData?.code; 30523 $[17] = t9; 30524 } else t9 = $[17]; 30525 let t10; 30526 if ($[18] !== dispatch || $[19] !== isFetching || $[20] !== isSuccess || $[21] !== refetch || $[22] !== userInfoData) { 30527 t10 = [ 30528 userInfoData, 30529 isFetching, 30530 isSuccess, 30531 refetch, 30532 dispatch 30533 ];
30534 $[18] = dispatch; 30535 $[19] = isFetching; 30536 $[20] = isSuccess; 30537 $[21] = refetch; 30538 $[22] = userInfoData; 30539 $[23] = t10; 30540 } else t10 = $[23]; 30541 (0, import_react.useEffect)(t9, t10); 30542 let edgeRenewalFailParam; 30543 if ($[24] !== searchParams) { 30544 edgeRenewalFailParam = searchParams.get("edge_renewal_fail"); 30545 if (edgeRenewalFailParam) try { 30546 sessionStorage.setItem(EDGE_RENEWAL_FAIL_KEY, atob(edgeRenewalFailParam)); 30547 } catch {} 30548 $[24] = searchParams; 30549 $[25] = edgeRenewalFailParam; 30550 } else edgeRenewalFailParam = $[25]; 30551 let t11; 30552 let t12; 30553 if ($[26] !== dispatch || $[27] !== edgeRenewalFailParam || $[28] !== navigate || $[29] !== userInfo || $[30] !== userToken) { 30554 t11 = () => { 30555 if (!edgeRenewalFailParam || !userToken || !userInfo) return; 30556 try { 30557 const email = atob(edgeRenewalFailParam); 30558 if (userInfo.email === email) { 30559 sessionStorage.removeItem(EDGE_RENEWAL_FAIL_KEY); 30560 navigate("/settings/subscription-and-billing/subscription-plan", { replace: true }); 30561 } else dispatch(setUserToken(void 0)); 30562 } catch {} 30563 }; 30564 t12 = [ 30565 edgeRenewalFailParam, 30566 userToken, 30567 userInfo, 30568 navigate, 30569 dispatch 30570 ]; 30571 $[26] = dispatch; 30572 $[27] = edgeRenewalFailParam; 30573 $[28] = navigate; 30574 $[29] = userInfo; 30575 $[30] = userToken; 30576 $[31] = t11; 30577 $[32] = t12; 30578 } else { 30579 t11 = $[31]; 30580 t12 = $[32]; 30581 } 30582 (0, import_react.useEffect)(t11, t12); 30583 let t13; 30584 let t14; 30585 if ($[33] !== isFetching || $[34] !== navigate || $[35] !== userInfo) { 30586 t13 = () => { 30587 if (!userInfo || isFetching) return; 30588 if (userInfo.isMajorCustomer || userInfo.registeredTrial) return; 30589 if (!userInfo.hasCard) { 30590 const storedFleetSize = sessionStorage.getItem("fleetSize"); 30591 navigate("/orders", { 30592 replace: true, 30593 state: { 30594 userEmail: userInfo.email, 30595 fleetSize: storedFleetSize || userInfo.fleetSize || "" 30596 } 30597 }); 30598 } 30599 }; 30600 t14 = [ 30601 userInfo, 30602 isFetching, 30603 navigate 30604 ]; 30605 $[33] = isFetching; 30606 $[34] = navigate; 30607 $[35] = userInfo; 30608 $[36] = t13; 30609 $[37] = t14; 30610 } else { 30611 t13 = $[36]; 30612 t14 = $[37]; 30613 } 30614 (0, import_react.useEffect)(t13, t14); 30615 let t15; 30616 if ($[38] !== userToken) { 30617 t15 = { userToken }; 30618 $[38] = userToken; 30619 $[39] = t15; 30620 } else t15 = $[39]; 30621 return t15; 30622}; 30623var import_compiler_runtime$6 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 30624var Default = () => { 30625 const $ = (0, import_compiler_runtime$6.c)(4); 30626 const { userToken } = useAuthGuard(); 30627 let t0; 30628 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 30629 t0 = []; 30630 $[0] = t0; 30631 } else t0 = $[0]; 30632 (0, import_react.useEffect)(_temp, t0); 30633 if (!userToken) { 30634 let t1$1; 30635 if ($[1] === Symbol.for("react.memo_cache_sentinel")) { 30636 t1$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Navigate, { 30637 to: "/login", 30638 replace: true 30639 }); 30640 $[1] = t1$1; 30641 } else t1$1 = $[1]; 30642 return t1$1; 30643 } 30644 let t1; 30645 if ($[2] === Symbol.for("react.memo_cache_sentinel")) { 30646 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppSidebar, {}); 30647 $[2] = t1; 30648 } else t1 = $[2]; 30649 let t2; 30650 if ($[3] === Symbol.for("react.memo_cache_sentinel")) { 30651 t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AppProvider, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SidebarProvider, { children: [t1, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarInset, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Outlet, {}) })] }
30651), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppSheets, {})] }); 30652 $[3] = t2; 30653 } else t2 = $[3]; 30654 return t2; 30655}; 30656var default_default = Default; 30657function _temp() { 30658 loadZendeskChat(); 30659} 30660var import_compiler_runtime$5 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 30661const usePageViewTracker = () => { 30662 const $ = (0, import_compiler_runtime$5.c)(4); 30663 const location = useLocation(); 30664 const previousPathRef = (0, import_react.useRef)(""); 30665 let t0; 30666 let t1; 30667 if ($[0] !== location.pathname || $[1] !== location.search) { 30668 t0 = () => { 30669 const trackedPath = `${location.pathname}${location.search}`; 30670 if (trackedPath === previousPathRef.current) return; 30671 previousPathRef.current = trackedPath; 30672 trackPage(location.pathname); 30673 }; 30674 t1 = [location.pathname, location.search]; 30675 $[0] = location.pathname; 30676 $[1] = location.search; 30677 $[2] = t0; 30678 $[3] = t1; 30679 } else { 30680 t0 = $[2]; 30681 t1 = $[3]; 30682 } 30683 (0, import_react.useEffect)(t0, t1); 30684}; 30685var import_compiler_runtime$4 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 30686const RootLayout = () => { 30687 const $ = (0, import_compiler_runtime$4.c)(1); 30688 usePageViewTracker(); 30689 let t0; 30690 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 30691 t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Outlet, {}); 30692 $[0] = t0; 30693 } else t0 = $[0]; 30694 return t0; 30695}; 30696var import_compiler_runtime$3 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 30697const StandaloneLayout = () => { 30698 const $ = (0, import_compiler_runtime$3.c)(1); 30699 let t0; 30700 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 30701 t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { 30702 className: "flex h-svh w-full flex-col overflow-hidden bg-paper", 30703 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Outlet, {}) 30704 }); 30705 $[0] = t0; 30706 } else t0 = $[0]; 30707 return t0; 30708}; 30709var RELOAD_FLAG = "navpro:lazy-route-reloaded";
30710function lazyRoute(load, pick$1) { 30711 return async () => { 30712 let mod; 30713 try { 30714 mod = await load(); 30715 } catch { 30716 try { 30717 mod = await load(); 30718 } catch (secondErr) { 30719 if (!sessionStorage.getItem(RELOAD_FLAG)) { 30720 sessionStorage.setItem(RELOAD_FLAG, "1"); 30721 window.location.reload(); 30722 return new Promise(() => {}); 30723 } 30724 throw secondErr; 30725 } 30726 } 30727 sessionStorage.removeItem(RELOAD_FLAG); 30728 const Component = pick$1(mod); 30729 if (!Component) throw new Error("Lazy route module did not export the expected component"); 30730 return Component; 30731 }; 30732} 30733var import_compiler_runtime$2 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 30734var SubscriptionBillingGuard = () => { 30735 const $ = (0, import_compiler_runtime$2.c)(2); 30736 const userInfo = useUserInfoQueryState(); 30737 if (userInfo && (!userInfo.isShowSubscription || getRoleName(userInfo.rank) !== "Super Admin")) { 30738 let t0$1; 30739 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 30740 t0$1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Navigate, { 30741 to: "/settings", 30742 replace: true 30743 }); 30744 $[0] = t0$1; 30745 } else t0$1 = $[0]; 30746 return t0$1; 30747 } 30748 let t0; 30749 if ($[1] === Symbol.for("react.memo_cache_sentinel")) { 30750 t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Outlet, {}); 30751 $[1] = t0; 30752 } else t0 = $[1]; 30753 return t0; 30754}; 30755var settingsRoutes = [ 30756 { 30757 index: true, 30758 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./settings-DzxxN8Yi.js"), __vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])), (m$2) => m$2.Settings) } 30759 }, 30760 { 30761 path: "integrations", 30762 handle: { breadcrumb: "Integrations" }, 30763 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./integrations-DXZtn6wp.js"), __vite__mapDeps([15,16,5,2,10,3,4,17,6,18,19,9,1,7,8,20,21,22,13,23,14])), (m$2) => m$2.Integrations) } 30764 }, 30765 { 30766 path: "driver-app-splash", 30767 handle: { breadcrumb: "Driver App Splash" }, 30768 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./driver-app-splash-CtgTS8Ac.js"), __vite__mapDeps([24,1,2,10,5,3,4,17,6,18,19,9,7,8,25,20,11,12,26,27,28,29,13,14])), (m$2) => m$2.DriverAppSplash) } 30769 }, 30770 { 30771 path: "personal-profile", 30772 handle: { breadcrumb: "Personal Profile" }, 30773 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./settings-personal-profile-D3BaD9MB.js"), __vite__mapDeps([30,1,2,10,5,3,4,17,6,18,19,9,31,7,8,25,20,26,27,32,33,22,29,13,34,35,14,36,37])), (m$2) => m$2.default) } 30774 }, 30775 { 30776 path: "company-profile", 30777 handle: { breadcrumb: "Company Profile" }, 30778 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./settings-company-profile-DOjb4xaB.js"), __vite__mapDeps([38,1,2,10,5,3,4,17,6,18,19,9,31,7,8,25,20,26,27,33,22,29,13,34,35,14,36,37])), (m$2) => m$2.default) } 30779 }, 30780 { 30781 path: "operators", 30782 handle: { breadcrumb: "Operators" }, 30783 children: [ 30784 { 30785 index: true, 30786 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./operators-permission-B1N2BjTs.js"), __vite__mapDeps([39,1,2,10,5,3,4,17,6,18,19,9,31,7,8,25,20,11,12,26,27,32,28,33,21,22,29,13,40,14,37])), (m$2) => m$2.default) } 30787 }, 30788 { 30789 path: "add", 30790 handle: { breadcrumb: "Add Operators" }, 30791 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./add-operators-CdpbJKuL.js"), __vite__mapDeps([41,1,2,10,5,3,4,17,6,18,19,9,31,7,8,25,20,42,26,27,32,28,22,13,40,35,14,36,37])), (m$2) => m$2.default) } 30792 }, 30793 { 30794 path: "permission-setting", 30795 handle: { breadcrumb: "Permission Setting" }, 30796 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./permission-setting-qWrOg_Xc.js"), __vite__mapDeps([43,1,2,10,5,3,4,17,6,18,19,9,31,7,8,25,20,26,27,44,22,28,13,14])), (m$2) => m$2.default) } 30797 } 30798 ] 30799 }, 30800 { 30801 path: "drivers", 30802 handle: { breadcrumb: "Drivers" }, 30803 children: [{ 30804 path: "permission", 30805 handle: { breadcrumb: "Permission Setting" }, 30806 children: [ 30807 { 30808 index: true, 30809 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./driver-permission-CJuLNxHU.js"), __vite__mapDeps([45,1,2,10,5,3,4,17,6,18,19,9,7,8,20,26,27,28,33,21,22,46,13,14])), (m$2) => m$2.default) } 30810 }, 30811 { 30812 path: "add", 30813 handle: { breadcrumb: "Add Permission Setting" }, 30814 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./permission-setting-form-fNXBzOFM.js"), __vite__mapDeps([47,1,2,10,5,3,4,17,6,18,19,9,31,7,8,25,20,11,12,26,27,48,22,44,28,49,13,50,14])), (m$2) => m$2.default) } 30815 }, 30816 { 30817 path: ":id/edit", 30818 handle: { breadcrumb: "Edit Permission Setting" }, 30819 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./permission-setting-form-fNXBzOFM.js"), __vite__mapDeps([47,1,2,10,5,3,4,17,6,18,19,9,31,7,8,25,20,11,12,26,27,48,22,44,28,49,13,50,14])), (m$2) => m$2.default) } 30820 } 30821 ] 30822 }] 30823 }, 30824 { 30825 path: "address-book", 30826 handle: { breadcrumb: "Address Book" }, 30827 children: [{ 30828 index: true, 30829 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./address-book-Xrx6AqG2.js"), __vite__mapDeps([51,1,2,10,5,3,4,17,6,18,19,9,52,31,7,8,25,20,11,12,53,54,37,55,26,27,56,48,22,57,58,59,49,33,21,60,13,61,62,63,14])), (m$2) => m$2.AddressBook) } 30830 }, { 30831 path: "import", 30832 handle: { breadcrumb: "Import" }, 30833 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./address-book-import-CqY4whmI.js"), __vite__mapDeps([64,1,2,16,5,10,3,4,17,6,18,19,9,52,31,7,8,25,20,11,12,53,54,37,55,65,66,23,57,59,28,33,22,46,13,61,62,63,34,14])), (m$2) => m$2.AddressBookImportPage) } 30834 }] 30835 }, 30836 { 30837 path: "sso", 30838 handle: { breadcrumb: "SSO" }, 30839 children: [ 30840 { 30841 index: true, 30842 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./settings-sso-C6007Mzx.js"), __vite__mapDeps([67,1,2,10,5,3,4,17,6,18,19,9,31,7,8,25,20,12,26,27,68,28,33,21,13,69,14])), (m$2) => m$2.default) } 30843 }, 30844 { 30845 path: "azure-active-directory", 30846 handle: { breadcrumb: "Microsoft Entra ID" }, 30847 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./settings-sso-azure-ad-DbHAhPU2.js"), __vite__mapDeps([70,1,2,10,5,3,4,17,6,18,19,9,31,7,8,25,20,12,26,27,68,33,22,13,71,69,14])), (m$2) => m$2.default) } 30848 }, 30849 { 30850 path: "ping-one", 30851 handle: { breadcrumb: "PingOne" }, 30852 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./settings-sso-ping-one-Cwli6-8k.js"), __vite__mapDeps([72,1,2,10,5,3,4,17,6,18,19,9,31,7,8,25,20,12,26,27,68,33,22,13,71,69,14])), (m$2) => m$2.default) } 30853 }, 30854 { 30855 path: "duo", 30856 handle: { breadcrumb: "Duo" }, 30857 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./settings-sso-duo-BDvkvuOc.js"), __vite__mapDeps([73,1,2,10,5,3,4,17,6,18,19,9,31,7,8,25,20,12,26,27,68,33,21,22,13,71,69,14])), (m$2) => m$2.default) } 30858 }, 30859 { 30860 path: "google", 30861 handle: { breadcrumb: "Google" }, 30862 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./settings-sso-google-ke4jaWgI.js"), __vite__mapDeps([74,1,2,16,5,10,3,4,17,6,18,19,9,31,7,8,25,20,11,12,26,27,65,66,23,75,76,68,33,22,13,71,69,14])), (m$2) => m$2.default) } 30863 }, 30864 { 30865 path: "okta", 30866 handle: { breadcrumb: "Okta" }, 30867 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./settings-sso-okta-BPCNrmH2.js"), __vite__mapDeps([77,1,2,10,5,3,4,17,6,18,19,9,31,7,8,25,20,12,26,27,68,33,22,13,71,69,14])), (m$2) => m$2.default) } 30868 }, 30869 { 30870 path: "cyber-ark", 30871 handle: { breadcrumb: "CyberArk Identity" }, 30872 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./settings-sso-cyber-ark-iRz2CK-4.js"), __vite__mapDeps([78,1,2,10,5,3,4,17,6,18,19,9,31,7,8,25,20,12,26,27,68,33,21,22,13,71,69,14])), (m$2) => m$2.default) } 30873 } 30874 ] 30875 }, 30876 { 30877 path: "routing-profile", 30878 handle: { breadcrumb: "Routing Profile" }, 30879 children: [ 30880 { 30881 index: true, 30882 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./routing-profile-C5eeXCkA.js"), __vite__mapDeps([79,1,2,10,5,3,4,17,6,18,19,9,7,8,25,20,11,12,26,27,33,21,60,13,80,81,50,14])), (m$2) => m$2.default) } 30883 }, 30884 { 30885 path: "new", 30886 handle: { breadcrumb: "Add New Setting" }, 30887 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./routing-profile-new-B_YGL1na.js"), __vite__mapDeps([82,1,2,10,5,3,4,17,6,18,19,9,52,31,7,8,25,20,11,12,55,26,27,48,22,83,84,85,21,86,87,88,59,49,33,89,63,13,80,50,14,90])), (m$2) => m$2.default) } 30888 }, 30889 { 30890 path: ":id/edit", 30891 handle: { breadcrumb: "Edit Setting" }, 30892 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./routing-profile-new-B_YGL1na.js"), __vite__mapDeps([82,1,2,10,5,3,4,17,6,18,19,9,52,31,7,8,25,20,11,12,55,26,27,48,22,83,84,85,21,86,87,88,59,49,33,89,63,13,80,50,14,90])), (m$2) => m$2.default) } 30893 } 30894 ] 30895 }, 30896 { 30897 path: "trucks", 30898 handle: { breadcrumb: "Trucks" }, 30899 children: [ 30900 { 30901 index: true, 30902 lazy: { Component: lazyRoute(() => __vitePreload(() =>
30902 import("./trucks-B8Yy1wJq.js"), __vite__mapDeps([91,1,2,10,5,3,4,17,6,18,19,9,31,7,8,25,20,26,27,49,33,21,60,29,13,92,35,93,14])), (m$2) => m$2.default) } 30903 }, 30904 { 30905 path: "new", 30906 handle: { breadcrumb: "Add New Truck" }, 30907 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./trucks-form-Cihv_BHf.js"), __vite__mapDeps([94,1,2,16,5,10,3,4,17,6,18,19,9,31,7,8,25,20,26,27,83,84,85,21,33,95,22,46,96,13,97,23,92,35,93,14,37])), (m$2) => m$2.default) } 30908 }, 30909 { 30910 path: ":id/edit", 30911 handle: { breadcrumb: "Edit Truck" }, 30912 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./trucks-form-Cihv_BHf.js"), __vite__mapDeps([94,1,2,16,5,10,3,4,17,6,18,19,9,31,7,8,25,20,26,27,83,84,85,21,33,95,22,46,96,13,97,23,92,35,93,14,37])), (m$2) => m$2.default) } 30913 }, 30914 { 30915 path: ":id/view", 30916 handle: { breadcrumb: "Truck" }, 30917 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./trucks-view-JyvPRnIa.js"), __vite__mapDeps([98,1,2,16,5,10,3,4,17,6,18,19,9,31,7,8,25,20,11,12,99,56,65,66,23,76,68,60,96,29,34,100,101,26,27,75,33,22,13,97,93,14])), (m$2) => m$2.default) } 30918 } 30919 ] 30920 }, 30921 { 30922 path: "terminals", 30923 handle: { breadcrumb: "Terminals" }, 30924 children: [{ 30925 index: true, 30926 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./terminals-on6TBLkp.js"), __vite__mapDeps([102,1,2,10,5,3,4,17,6,18,19,9,31,7,8,25,20,26,27,33,21,22,29,13,103,14])), (m$2) => m$2.default) } 30927 }, { 30928 path: ":id", 30929 handle: { breadcrumb: "Terminal" }, 30930 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./terminals-detail-H8z25OHW.js"), __vite__mapDeps([104,1,2,10,5,3,4,17,6,18,19,9,31,7,8,25,20,11,12,26,27,33,21,22,13,103,14,37])), (m$2) => m$2.default) } 30931 }] 30932 }, 30933 { 30934 path: "subscription-and-billing", 30935 handle: { breadcrumb: "Subscription & Billing" }, 30936 Component: SubscriptionBillingGuard, 30937 children: [ 30938 { 30939 index: true, 30940 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./subscription-and-billing-D8r6rTzu.js"), __vite__mapDeps([105,1,2,16,5,10,3,4,17,6,18,19,9,31,106,7,8,25,20,11,12,107,48,22,33,108,35,26,27,66,46,13,109,23,14,36,37])), (m$2) => m$2.SubscriptionDetail) } 30941 }, 30942 { 30943 path: "manage-seats", 30944 handle: { breadcrumb: "Manage Seats" }, 30945 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./manage-seats-C2pfIAde.js"), __vite__mapDeps([110,1,2,10,5,3,4,17,6,18,19,9,7,8,25,20,26,27,33,13,109,14,37])), (m$2) => m$2.ManageSeats) } 30946 }, 30947 { 30948 path: "subscription-plan", 30949 handle: { breadcrumb: "Subscription Plan" }, 30950 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./subscription-plan-D6RXsPzj.js"), __vite__mapDeps([111,1,2,16,5,10,3,4,17,6,18,19,9,31,106,7,8,25,20,11,12,107,48,22,33,108,35,26,27,46,13,112,113,23,14,37])), (m$2) => m$2.SubscriptionPlan) } 30951 } 30952 ] 30953 }, 30954 { 30955 path: "dialer-settings", 30956 handle: { breadcrumb: "Dialer Settings" }, 30957 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./settings-dialer-ChXUvGvq.js"), __vite__mapDeps([114,1,2,16,5,10,3,4,17,6,18,19,9,31,7,8,25,20,11,12,26,27,33,21,22,46,13,112,113,108,23,14,37])), (m$2) => m$2.default) } 30958 }, 30959 { 30960 path: "drivers", 30961 handle: { breadcrumb: "Drivers" }, 30962 children: [ 30963 { 30964 index: true, 30965 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./drivers-Cx6k8Dey.js"), __vite__mapDeps([115,1,2,16,5,10,3,4,17,6,18,19,9,52,31,116,7,8,25,20,11,12,42,53,54,37,55,26,27,117,95,65,66,23,75,118,48,22,119,120,59,33,21,32,121,46,96,29,122,123,49,60,13,124,125,126,103,127,35,14,36])), (m$2) => m$2.Drivers) } 30966 }, 30967 { 30968 path: "new", 30969 handle: { breadcrumb: "Add Drivers" }, 30970 children: [{ 30971 index: true, 30972 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./drivers-new-iEU0Wrvr.js"), __vite__mapDeps([128,1,2,10,5,3,4,17,6,18,19,9,31,7,8,25,20,42,26,27,21,22,13,129,126,122,103,127,35,14,36,37])), (m$2) => m$2.DriversNew) } 30973 }
30973] 30974 }, 30975 { 30976 path: ":id/edit", 30977 handle: { breadcrumb: "Edit Drivers" }, 30978 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./drivers-details-edit-zMBFDzbe.js"), __vite__mapDeps([130,1,2,16,5,10,3,4,17,6,18,19,9,31,7,8,25,20,26,27,56,32,33,95,22,46,13,131,122,129,126,103,63,35,23,14,37])), (m$2) => m$2.DriversDetailsEdit) } 30979 }, 30980 { 30981 path: ":id/view", 30982 handle: { breadcrumb: "Driver Details" }, 30983 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./drivers-details-BOlAJ8qC.js"), __vite__mapDeps([132,1,2,16,5,10,3,4,17,6,18,19,9,116,7,8,25,20,26,27,13,125,23,37,122,14])), (m$2) => m$2.DriversDetails) }, 30984 children: [ 30985 { 30986 index: true, 30987 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./drivers-details-overview-JnkFHU4I.js"), __vite__mapDeps([133,1,2,16,5,10,3,4,17,6,18,19,9,52,31,7,8,25,20,11,12,53,54,37,55,83,84,120,59,33,60,22,46,13,131,122,134,135,23,14])), (m$2) => m$2.DriversDetailsOverview) } 30988 }, 30989 { 30990 path: "trip-history", 30991 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./drivers-details-trip-history-WzEvXYc5.js"), __vite__mapDeps([136,1,2,16,5,10,3,4,17,6,18,19,9,52,31,116,7,8,25,20,11,12,53,54,37,55,65,66,23,75,118,48,22,119,120,59,33,21,13,137,138,122,14])), (m$2) => m$2.DriversDetailsTripHistory) } 30992 }, 30993 { 30994 path: "documents", 30995 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./drivers-details-documents-DyC0hNQP.js"), __vite__mapDeps([139,1,2,16,5,10,3,4,17,6,18,19,9,31,7,8,25,20,11,12,99,56,65,66,23,76,68,60,96,29,34,100,101,75,49,33,22,87,88,13,140,14])), (m$2) => m$2.DriversDetailsDocuments) } 30996 } 30997 ] 30998 }, 30999 { 31000 path: "groups/new", 31001 handle: { breadcrumb: "Add Driver Group" }, 31002 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./drivers-groups-new-BTXR4jJ1.js"), __vite__mapDeps([141,1,2,16,5,10,3,4,17,6,18,19,9,31,7,8,25,20,11,12,26,27,49,33,21,22,46,13,142,124,125,23,37,81,143,122,134,50,144,14])), (m$2) => m$2.DriversGroupsNew) } 31003 }, 31004 { 31005 path: "groups/:id/edit", 31006 handle: { breadcrumb: "Edit Driver Group" }, 31007 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./drivers-groups-edit-oBSZXFUk.js"), __vite__mapDeps([145,1,2,16,5,10,3,4,17,6,18,19,9,31,7,8,25,20,11,12,26,27,49,33,21,22,46,13,142,124,125,23,37,81,143,122,134,50,144,14])), (m$2) => m$2.DriversGroupsEdit) } 31008 } 31009 ] 31010 }, 31011 { 31012 path: "out-of-route-alert", 31013 handle: { breadcrumb: "Out of Route Alert" }, 31014 children: [{ 31015 index: true, 31016 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./out-of-route-alert-CHVlHKM9.js"), __vite__mapDeps([146,1,2,10,5,3,4,17,6,18,19,9,7,8,25,20,26,27,56,85,21,33,22,46,13,147,14,37])), (m$2) => m$2.default) } 31017 }] 31018 } 31019]; 31020var routes = [{ 31021 path: "/", 31022 Component: RootLayout, 31023 ErrorBoundary: RootErrorPage, 31024 HydrateFallback: () => null, 31025 children: [ 31026 { 31027 path: "", 31028 Component: default_default, 31029 children: [ 31030 { 31031 index: true, 31032 Component: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Navigate, { 31033 to: "/map", 31034 replace: true 31035 }) 31036 }, 31037 { 31038 path: "map", 31039 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./map-BphFm1ih.js"), __vite__mapDeps([148,1,2,16,5,10,3,4,17,6,18,19,9,52,31,116,7,8,25,20,11,12,53,54,37,55,56,117,95,65,66,23,75,57,84,119,120,58,86,87,88,59,33,21,22,46,96,89,63,13,149,150,147,151,62,138,134,127,34,135,50,152,35,14,113,100,36])), (m$2) => m$2.Map) } 31040 }, 31041 { 31042 path: "trips", 31043 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./trips-Cp8Uw6Bm.js"), __vite__mapDeps([153,1,2,16,5,10,3,4,17,6,18,19,9,52,31,116,7,8,25,20,11,12,53,54,37,55,65,66,23,75,118,48,22,119,120,59,33,21,57,28,49,13,122,14])), (m$2) => m$2.default) } 31044 }, 31045 { 31046 path: "fuel-network", 31047 handle: { breadcrumb: "Fuel Network" }, 31048 children: [{ 31049 index: true, 31050 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./fuel-network-Q8zhRwyB.js"), __vite__mapDeps([154,1,2,16,5,10,3,4,17,6,18,19,9,31,7,8,25,20,11,12,65,66,23,75,49,33,21,22,13,151,54,138,14])), (m$2) => m$2.default) } 31051 }, {
31052 path: "fuel-network-settings", 31053 handle: { breadcrumb: "Fuel Network Settings" }, 31054 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./fuel-network-settings-DseT91o4.js"), __vite__mapDeps([155,1,2,10,5,3,4,17,6,18,19,9,7,8,25,20,26,27,33,22,46,13,138,14])), (m$2) => m$2.default) } 31055 }] 31056 }, 31057 { 31058 path: "settings", 31059 handle: { breadcrumb: "Setting" }, 31060 children: settingsRoutes 31061 }, 31062 { 31063 path: "documents", 31064 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./documents-e456Q8Ti.js"), __vite__mapDeps([156,1,2,16,5,10,3,4,17,6,18,19,9,31,7,8,25,20,11,12,99,56,65,66,23,76,68,60,96,29,34,100,101,75,49,33,27,22,87,88,13,140,14])), (m$2) => m$2.default) } 31065 }, 31066 { 31067 path: "driver-performance", 31068 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./driver-performance-BdSLZMRN.js"), __vite__mapDeps([157,1,2,16,5,10,3,4,17,6,18,19,9,31,7,8,20,11,12,83,84,49,33,60,22,66,88,13,137,138,143,144,23,14,37])), (m$2) => m$2.DriverPerformance) } 31069 }, 31070 { 31071 path: "load-board", 31072 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./load-board-DC5rEFiU.js"), __vite__mapDeps([158,1,2,16,5,10,3,4,17,6,18,19,9,52,31,7,8,25,20,11,12,53,54,37,55,33,21,95,22,89,63,13,149,23,14,90])), (m$2) => m$2.LoadBoard) } 31073 }, 31074 { 31075 path: "marketplace", 31076 handle: { breadcrumb: "Marketplace" }, 31077 children: [{ 31078 index: true, 31079 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./marketplace-DxOsDLPH.js"), __vite__mapDeps([159,1,2,16,5,10,3,4,17,6,18,19,9,31,7,8,25,20,11,12,42,48,22,32,121,66,46,96,29,122,123,37,33,21,13,143,23,14])), (m$2) => m$2.default) } 31080 }, { 31081 path: "eld-integrations", 31082 handle: { breadcrumb: "ELD Integrations" }, 31083 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./marketplace-eld-integrations-BXk5_b0b.js"), __vite__mapDeps([160,1,2,16,5,10,3,4,17,6,18,19,9,31,7,8,25,20,11,12,26,27,33,21,22,29,13,80,122,123,23,14])), (m$2) => m$2.default) } 31084 }] 31085 } 31086 ] 31087 }, 31088 { 31089 path: "", 31090 Component: StandaloneLayout, 31091 children: [{ 31092 path: "release-history", 31093 handle: { breadcrumb: "Release History" }, 31094 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./release-history-4ocrt1pJ.js"), __vite__mapDeps([161,1,2,16,5,10,3,4,17,6,18,19,9,7,8,20,162,87,88,13,14])), (m$2) => m$2.ReleaseHistory) } 31095 }] 31096 }, 31097 { 31098 path: "login", 31099 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./login-DvzPtAZo.js"), __vite__mapDeps([163,1,2,10,5,3,4,17,6,18,19,9,31,164,37,7,8,25,20,11,12,48,22,32,33,87,88,13,152,14])), (m$2) => m$2.default) } 31100 }, 31101 { 31102 path: "orders", 31103 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./orders-C3f6JvtP.js"), __vite__mapDeps([165,1,2,16,5,10,3,4,17,6,18,19,9,31,106,164,37,7,8,25,20,11,12,166,
3110313,84,33,22,150,63,152,35,23,14,36])), (m$2) => m$2.default) } 31104 }, 31105 { 31106 path: "success-pages", 31107 children: [{ 31108 index: true, 31109 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./free-trial-success-Cr9-eylz.js"), __vite__mapDeps([167,1,2,10,5,3,4,17,6,18,19,9,7,8,20,11,12,166,13,37,168,152,14])), (m$2) => m$2.FreeTrialSuccess) } 31110 }, { 31111 path: "free-trial-fleet-user", 31112 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./free-trial-fleet-user-success-BCYubhmX.js"), __vite__mapDeps([169,1,2,10,5,3,4,17,6,18,19,9,31,7,8,25,20,11,12,166,13,37,168,152,22,150,14])), (m$2) => m$2.FreeTrialFleetUserSuccess) } 31113 }] 31114 }, 31115 { 31116 path: "confirm-email", 31117 lazy: { Component: lazyRoute(() => __vitePreload(() => import("./confirm-change-email-BHyL4MV0.js"), __vite__mapDeps([170,1,2,3,4,5,17,10,6,18,19,9,7,8,20,13,14])), (m$2) => m$2.default) } 31118 } 31119 ] 31120}]; 31121const router = createBrowserRouter(routes); 31122var import_compiler_runtime$1 = /* @__PURE__ */ __toESM(require_compiler_runtime()); 31123function ThemeProvider(t0) { 31124 const $ = (0, import_compiler_runtime$1.c)(6); 31125 let children; 31126 let props; 31127 if ($[0] !== t0) { 31128 ({children, ...props} = t0); 31129 $[0] = t0; 31130 $[1] = children; 31131 $[2] = props; 31132 } else { 31133 children = $[1]; 31134 props = $[2]; 31135 } 31136 let t1; 31137 if ($[3] !== children || $[4] !== props) { 31138 t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(J, { 31139 attribute: "class", 31140 defaultTheme: "light", 31141 enableSystem: true, 31142 ...props, 31143 children 31144 }); 31145 $[3] = children; 31146 $[4] = props; 31147 $[5] = t1; 31148 } else t1 = $[5]; 31149 return t1; 31150} 31151var t$1 = "GoogleReCaptcha Context has not yet been implemented, if you are using useGoogleReCaptcha hook, make sure the hook is called inside component wrapped by GoogleRecaptchaProvider", n = (0, import_react.createContext)({ 31152 instance: void 0, 31153 siteKey: "", 31154 language: "", 31155 isLoading: !0, 31156 executeV3: () => { 31157 throw Error(t$1); 31158 }, 31159 executeV2Invisible: () => { 31160 throw Error(t$1); 31161 }, 31162 reset: () => { 31163 throw Error(t$1); 31164 }, 31165 getResponse: () => { 31166 throw Error(t$1); 31167 }, 31168 render: () => { 31169 throw Error(t$1); 31170 } 31171}); 31172var c = () => !!document.querySelector("script[src*=\"/recaptcha/\"]:not([src*=\"gstatic\"])"); 31173var e$2 = () => ".grecaptcha-badge{display: none !important;}"; 31174var n$1 = ({ host: t$3 = "google.com", isEnterprise: c$2 = !1, render: s$1, hl: e$4, badge: r }) => { 31175 const a = new URLSearchParams({ 31176 ...e$4 && { hl: e$4 }, 31177 ...r && { badge: r }, 31178 render: s$1 31179 }); 31180 return `https://www.${t$3}/recaptcha/${c$2 ? "enterprise.js" : "api.js"}?${a}`; 31181}; 31182var d = () => { 31183 const e$4 = document.createElement("style"); 31184 e$4.innerHTML = e$2(), document.body.appendChild(e$4); 31185}; 31186var m$1 = ({ onload: e$4, appendTo: c$2 = "head", isEnterprise: o$3 = !1, host: r, render: a, badge: n$2, hl: p$1,...i }) => { 31187 const s$1 = n$1({ 31188 host: r, 31189 isEnterprise: o$3, 31190 render: a, 31191 hl: p$1, 31192 badge: n$2 31193 }), t$3 = document.createElement("script"); 31194 Object.entries(i).forEach(([l$1, d$1]) => { 31195 t$3.setAttribute(l$1, d$1?.toString() ?? ""); 31196 }), t$3.src = s$1, t$3.onload = e$4, document[c$2].appendChild(t$3); 31197}; 31198var o = () => { 31199 const e$4 = document.querySelector(".grecaptcha-badge"); 31200 e$4 && e$4.parentNode && document.body.removeChild(e$4.parentNode); 31201}; 31202var o$1 = (t$3) => { 31203 const e$4 = document.getElementById(t$3); 31204 if (e$4) for (; e$4.lastChild;) e$4.lastChild.remove(); 31205}; 31206var e$1 = "https://www.gstatic.com/recaptcha/releases", o$2 = () => { 31207 window.___grecaptcha_cfg = void 0; 31208 const c$2 = document.querySelector("script[src*=\"/recaptcha/\"]:not([src*=\"gstatic\"])"); 31209 c$2 && c$2.remove(); 31210 const t$3 = document.querySelector(`script[src^="${e$1}"]`); 31211 t$3 && t$3.remove(); 31212}; 31213var t = (t$3 = !1) => { 31214 let [n$2, r] = (0, import_react.useState)(t$3); 31215 return [n$2, (e$4) => r((t$4) => e$4 ?? !t$4)]; 31216}; 31217var f = "onGoogleReCaptchaLoad", p = "google-recaptcha-container", m = ({ type: m$2, siteKey: h, language: g, scriptProps: _, isEnterprise: v = !1, host: y, theme: b = "light", children: x, explicit: S, onLoad: C, onError: w }) => { 31218 let [T$1, E] = t(!0), D = (0, import_react.useRef)(void 0); 31219 (0, import_react.useEffect)(() => { 31220 let e$4 = _?.id ?? `google-recaptcha-${m$2}-script`, s$1 = c(); 31221 try { 31222 let c$2 = () => { 31223 E(!0); 31224 let e$5 = v ? window.grecaptcha?.enterprise : window.grecaptcha; 31225 if (!e$5) { 31226 w?.(), E(!1); 31227 return; 31228 } 31229 if (S || e$5.ready(async () => { 31230 D.current = e$5, await C?.(e$5), E(!1); 31231 }), S) { 31232 let t$3 = { 31233 size: m$2 === "v3" || m$2 === "v2-invisible" ? "invisible" : "normal", 31234 ...(m$2 === "v3" || m$2 === "v2-invisible") && { badge: "bottomright" }, 31235 sitekey: h, 31236 theme: b, 31237 ...typeof S == "object" && { 31238 ...S, 31239 "expired-callback": S.expiredCallback, 31240 "error-callback": S.errorCallback 31241 } 31242 }; 31243 s$1 || typeof S == "object" && (m$2 === "v3" || m$2 === "v2-invisible") && S?.badge === "hidden" && d(), e$5.ready(async () => { 31244 typeof S == "object" && S.container && e$5.render(S.container, t$3, !!S.inherit), D.current = e$5,
31244C && await C(e$5), E(!1); 31245 }); 31246 } 31247 }; 31248 return window[f] = c$2, s$1 ? c$2() : m$1({ 31249 isEnterprise: v, 31250 host: y, 31251 ...(m$2 === "v3" || m$2 === "v2-invisible") && typeof S == "object" && S?.badge && { badge: S?.badge === "hidden" ? "bottomright" : S?.badge }, 31252 ...g && { hl: g }, 31253 render: S || m$2 === "v2-checkbox" ? "explicit" : h, 31254 ..._, 31255 onload: c$2, 31256 id: e$4 31257 }), () => { 31258 c() && o$2(), typeof S == "object" && (m$2 === "v3" || m$2 === "v2-invisible") && !S?.container && S?.badge ? o$1(p) : o(); 31259 }; 31260 } catch { 31261 E(!1); 31262 } 31263 }, [ 31264 v, 31265 g, 31266 y, 31267 h, 31268 m$2 31269 ]); 31270 let O = (e$4) => { 31271 if (!D.current?.execute) throw Error("Google ReCaptcha has not been loaded"); 31272 return D.current.execute(h, { action: e$4 }); 31273 }, k = (e$4) => { 31274 if (!D.current?.execute) throw Error("Google ReCaptcha has not been loaded"); 31275 return D.current.execute(e$4); 31276 }, A = (0, import_react.useMemo)(() => ({ 31277 instance: D.current, 31278 siteKey: h, 31279 isLoading: T$1, 31280 theme: b, 31281 executeV2Invisible: k, 31282 executeV3: O, 31283 reset: D.current?.reset, 31284 getResponse: D.current?.getResponse, 31285 render: D.current?.render, 31286 ...g && { language: g } 31287 }), [ 31288 h, 31289 T$1, 31290 g 31291 ]); 31292 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(n.Provider, { 31293 value: A, 31294 children: x 31295 }); 31296}; 31297var import_compiler_runtime = /* @__PURE__ */ __toESM(require_compiler_runtime()); 31298function App() { 31299 const $ = (0, import_compiler_runtime.c)(1); 31300 let t0; 31301 if ($[0] === Symbol.for("react.memo_cache_sentinel")) { 31302 t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider_default, { 31303 store, 31304 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PersistGate, { 31305 loading: null, 31306 persistor, 31307 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(m, { 31308 type: "v3", 31309 siteKey: "6LdSXCYbAAAAAItDag4D0zJCxZq4Fu-QU_ySsWDJ", 31310 children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(APIProvider, { 31311 apiKey: "AIzaSyAxsMssg12MeJ_oJegXcDiKo4GJnWC7jHc", 31312 libraries: ["geometry"], 31313 children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RouterProvider2, { router }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toaster, {})] 31314 }) 31315 }) }) 31316 }) 31317 }); 31318 $[0] = t0; 31319 } else t0 = $[0]; 31320 return t0; 31321} 31322var app_default = App; 31323initAnalytics(); 31324document.addEventListener("wheel", (e$4) => { 31325 if (e$4.ctrlKey) e$4.preventDefault(); 31326}, { passive: false }); 31327(0, import_client.createRoot)(document.getElementById("root")).render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(app_default, {}) })); 31328export { TextareaField as $, Collapsible as $n, useAppDispatch as $t, useTableVirtualizer as A, useLazyGetUserInfoQuery as An, useDeleteDialerSettingVirtualNumberMutation as At, TableCell as B, DropdownMenuRadioGroup as Bn, uploadImage as Bt, TabsContent as C, useChangeEmailSendMutation as Cn, GENERIC_API_ERROR_MESSAGE as Ct, AppAvatar as D, useForgotPasswordMutation as Dn, useAddVirtualNumberMutation as Dt, InputSearch as E, useConfirmLoginMutation as En, getRoleName as Et, DEFAULT_PAGINATION_SHOW_ITEMS_INFO as F, baseApi as Fn, useGetUserDialerSettingInfoQuery as Ft, InputGroup as G, DropdownMenuTrigger as Gn, _bytes as Gt, TableHead as H, DropdownMenuSub as Hn, create_context_default as Ht, DEFAULT_PAGINATION_SHOW_PAGE_SIZE_SELECTOR as I, overrideExisting as In, useLazyGetDialerContactsListQuery as It, DialerTrialStarted as J, AvatarImage as Jn, mphToMetersPerSecond as Jt, InputGroupAddon as K, Avatar as Kn, metersPerSecondToMph as Kt, DEFAULT_PAGINATION_SIZE_OPTIONS as L, DropdownMenu as Ln, useSwitchDialerSettingCallRecordMutation as Lt, table_pagination_default as M, useSingleSignOnMutation as Mn, useGetDialerSettingCallOutcomeListQuery as Mt, no_result_default as N, useUpdateAutoFillFuelStopMutation as Nn, useGetDialerSettingNumbersListQuery as Nt, dialer_buy_number_dialog_default as O, useGetUserInfoQuery as On, useAssignDialerSettingVirtualNumberMutation as Ot, DEFAULT_PAGE_SIZE as P, useUserInfoQueryState as Pn, useGetDialerSettingUsersListQuery as Pt, SelectInput as Q, PopoverTrigger as Qn, useAppSelector as Qt, Table$1 as R, DropdownMenuContent as Rn, useMessagesContext as Rt, Tabs as S, useChangeEmailConfirmQuery as Sn, Checkbox as St, TabsTrigger as T, useCheckPasswordMutation as Tn, mutateWithErrorHandling as Tt, TableHeader as U, DropdownMenuSubContent as Un, useGetFriendListQuery as Ut, TableContainer as V, DropdownMenuRadioItem as Vn, useUploadImageMutation as Vt, TableRow as W, DropdownMenuSubTrigger as Wn, selectFriends as Wt, useControllableState as X, Popover as Xn, openDialerNumpad as Xt, dialer_advertise_q80_default as Y, trackMethodCall as Yn, tonsToLbs as Yt, SelectField as Z, PopoverContent as Zn, openDialerRecent as Zt, downloadBlob as _, CardAction as _n, buildMarketingUtm as _r, SelectTrigger as _t, useGetCompanyAuthoritiesFleetQuery as a, DialogClose as an, TooltipProvider as ar, FieldDescription as at, ImageCropperDialog as b, CardHeader as bn, Calendar as bt, useGetPermissionSettingsListQuery as c, DialogFooter as cn, Sheet as cr, Empty as ct, Alert as d, DialogTitle as dn, SheetHeader as dr, EmptyHeader as dt, RELEASE_NOTE_FEATURE_TYPES as en, CollapsibleContent as er, useFormProps as et, AlertDescription as f, DialogTrigger as fn, SheetTitle as fr, EmptyMedia as ft, ImageUpload as g, Card as gn, track as gr, SelectItem as gt, Switch as h, Badge as hn, cva as hr, SelectContent as ht, useEditPermissionProfileMutation as i, Dialog as in, TooltipOverflowTrigger as ir, Field as it, table_default as j, useL
31328oginMutation as jn, useDialerSettingCallOutcomeMutation as jt, data_table_default as k, useLazyGetSSOTokenQuery as kn, useDeleteDialerSettingCallOutcomeMutation as kt, useSetCompanyAuthoritiesFleetMutation as l, DialogHeader as ln, SheetContent as lr, EmptyContent as lt, InputField as m, useLazyGetReleaseHistoryQuery as mn, Input as mr, Select as mt, useCreatePermissionProfileMutation as n, ReleaseNoteContent as nn, Tooltip as nr, FormItem as nt, useGetDriverPermissionGroupListQuery as o, DialogContent as on, TooltipTrigger as or, FieldError as ot, AlertTitle as p, useGetReleaseHistoryIndexQuery as pn, Separator as pr, EmptyTitle as pt, InputGroupInput as q, AvatarFallback as qn, metersToFtIn as qt, useDeletePermissionProfileMutation as r, purify as rn, TooltipContent as rr, FormWrapper as rt, useGetPermissionProfileInfoQuery as s, DialogDescription as sn, Skeleton as sr, FieldLabel as st, n as t, getReleaseNoteFeatureTypeBadge as tn, CollapsibleTrigger as tr, Textarea as tt, useSetDefaultProfileMutation as u, DialogInner as un, SheetDescription as ur, EmptyDescription as ut, downloadFileForExport as v, CardContent as vn, registerSuperProperties as vr, SelectValue as vt, TabsList as w, useChangePasswordMutation as wn, getApiErrorDetail as wt, CircularProgress as x, CardTitle as xn, Slider as xt, readFileAsJson as y, CardFooter as yn, unregisterSuperProperties as yr, DatePicker as yt, TableBody as z, DropdownMenuItem as zn, getShowEditRoute as zt };
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.