react-semaphor 0.1.301 → 0.1.302
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/appearance/index.cjs +1 -0
- package/dist/appearance/index.js +9 -0
- package/dist/brand-studio/index.cjs +21 -0
- package/dist/brand-studio/index.js +1512 -0
- package/dist/chunks/{braces-BwK7fWd_.js → braces-CpOcaBNm.js} +1 -1
- package/dist/chunks/{braces-Bhqo4iW1.js → braces-TYclg8Hl.js} +1 -1
- package/dist/chunks/dashboard-controls-BkuB9TQX.js +47 -0
- package/dist/chunks/dashboard-controls-CZuC_QjN.js +2227 -0
- package/dist/chunks/dashboard-filter-controls-button-2I1ltWQ9.js +11 -0
- package/dist/chunks/{dashboard-filter-controls-button-DjALRkvg.js → dashboard-filter-controls-button-kfb_T18o.js} +205 -216
- package/dist/chunks/dashboard-json-C3v6rBdp.js +1 -0
- package/dist/chunks/{dashboard-json-D-zIG46N.js → dashboard-json-Df6v2Jem.js} +14 -12
- package/dist/chunks/dashboard-summary-settings-dialog-BBALEHJQ.js +1 -0
- package/dist/chunks/{dashboard-summary-settings-dialog-D-F1eEJI.js → dashboard-summary-settings-dialog-DKAaWq-G.js} +64 -63
- package/dist/chunks/date-formatter-D9Bvw5Qk.js +1 -0
- package/dist/chunks/date-formatter-DyIOb6uC.js +333 -0
- package/dist/chunks/edit-dashboard-visual-CGBYahAK.js +183 -0
- package/dist/chunks/{edit-dashboard-visual-BjflrL8w.js → edit-dashboard-visual-D8L0cl_U.js} +6691 -6679
- package/dist/chunks/{index-DDA12yqV.js → index-BmoR3VQT.js} +48608 -66300
- package/dist/chunks/index-Cxb9UUro.js +4 -0
- package/dist/chunks/index-D7KJindZ.js +1 -0
- package/dist/chunks/index-DFOb_6HB.js +1657 -0
- package/dist/chunks/index-eM6MU4q_.js +1361 -0
- package/dist/chunks/index-uRJmUpof.js +2555 -0
- package/dist/chunks/palette-326-dgn0.js +6 -0
- package/dist/chunks/palette-jd7xiGTg.js +23 -0
- package/dist/chunks/{resource-management-panel-B2558XA1.js → resource-management-panel-C_c-BwrC.js} +116 -115
- package/dist/chunks/resource-management-panel-DrcEEARD.js +6 -0
- package/dist/chunks/rotate-ccw-BugHcM1w.js +6 -0
- package/dist/chunks/rotate-ccw-yFwqBFJZ.js +14 -0
- package/dist/chunks/save-CaybXtdd.js +6 -0
- package/dist/chunks/save-DU0FXUlM.js +21 -0
- package/dist/chunks/switch-AmoR1YIA.js +163 -0
- package/dist/chunks/switch-CZtMtqEj.js +19725 -0
- package/dist/chunks/{use-create-flow-overlay-state-BUw_JtLs.js → use-create-flow-overlay-state-84Xe8VrP.js} +396 -412
- package/dist/chunks/use-create-flow-overlay-state-CiKVJGWF.js +16 -0
- package/dist/chunks/use-visual-utils-lp5DfmvL.js +1 -0
- package/dist/chunks/{use-visual-utils-C45OxsOf.js → use-visual-utils-z3ifg6Fd.js} +54 -53
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/format-utils/index.cjs +1 -1
- package/dist/format-utils/index.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +210 -207
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/dist/types/appearance.d.ts +176 -0
- package/dist/types/brand-studio.d.ts +245 -0
- package/dist/types/dashboard.d.ts +134 -0
- package/dist/types/main.d.ts +141 -1
- package/dist/types/surfboard.d.ts +134 -0
- package/dist/types/types.d.ts +139 -0
- package/package.json +13 -1
- package/dist/chunks/dashboard-controls-BIRiWCUK.js +0 -47
- package/dist/chunks/dashboard-controls-DIlnYo96.js +0 -2219
- package/dist/chunks/dashboard-filter-controls-button-CK1-mKQh.js +0 -11
- package/dist/chunks/dashboard-json-DK4mQ1gS.js +0 -1
- package/dist/chunks/dashboard-summary-settings-dialog-DSxNqxFI.js +0 -1
- package/dist/chunks/date-formatter-CqXdM6JO.js +0 -1
- package/dist/chunks/date-formatter-vkCj9Ct-.js +0 -1982
- package/dist/chunks/edit-dashboard-visual-DCsrtJr_.js +0 -193
- package/dist/chunks/index-8GnvL1_L.js +0 -1523
- package/dist/chunks/resource-management-panel-CKp4_aem.js +0 -6
- package/dist/chunks/use-create-flow-overlay-state-CWcCdPbC.js +0 -21
- package/dist/chunks/use-visual-utils-DyaThRzf.js +0 -1
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";const v=require("react"),e=require("./index-8GnvL1_L.js"),t=require("react/jsx-runtime"),I=require("./use-create-flow-overlay-state-CWcCdPbC.js"),O=require("./use-visual-utils-DyaThRzf.js"),M=require("./date-formatter-CqXdM6JO.js");/**
|
|
2
|
-
* @license lucide-react v0.453.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const U=e.createLucideIcon("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/**
|
|
7
|
-
* @license lucide-react v0.453.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const H=e.createLucideIcon("FilterX",[["path",{d:"M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055",key:"1fi1da"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]),$=1e4,_=15e3,q=3e4,X=3e4,G=12e4,V=2*60*60*1e3;function Q(s){const a=Date.now()-s.getTime();return a<X?$:a<G?_:q}function K(){const{authToken:s,tokenProps:a}=e.useSemaphorContext(),f=e.useExportStore(p=>p.activeExports),[l,n]=v.useState(typeof document<"u"?!document.hidden:!0),d=v.useRef(null),c=v.useRef(!1),u=v.useRef(void 0),i=a==null?void 0:a.apiServiceUrl,r=s==null?void 0:s.accessToken,h=v.useCallback(()=>{const p=e.useExportStore.getState().activeExports;return Array.from(p.values()).filter(w=>e.isExportInProgress(w.status))},[]);v.useEffect(()=>{if(typeof document>"u")return;const p=()=>{n(!document.hidden)};return document.addEventListener("visibilitychange",p),()=>{document.removeEventListener("visibilitychange",p)}},[]);const b=v.useCallback(async()=>{if(!i||!r){c.current=!1;return}const p=h();if(p.length===0){c.current=!1;return}const w=Date.now(),E=p.filter(o=>w-o.startedAt.getTime()>V);if(E.length>0){const{updateExport:o}=e.useExportStore.getState().actions;for(const C of E)o(C.id,{status:"failed",error:"Export timed out. Please try again or contact support.",lastUpdatedAt:new Date})}const x=p.filter(o=>w-o.startedAt.getTime()<=V);if(x.length===0){c.current=!1;return}const y=await Promise.allSettled(x.map(async o=>{try{const C=await e.getExportStatus(i,r,o.id);let S;if(C.status==="completed")try{S=await e.getDownloadUrl(i,r,o.id)}catch(F){console.error(`[useExportPolling] Failed to get download URL for ${o.id}:`,F)}return{id:o.id,status:C.status,progress:C.progress,completedChunks:C.completedChunks,completedAt:C.completedAt?new Date(C.completedAt):void 0,lastUpdatedAt:new Date,fileSize:C.fileSize,error:C.error,downloadUrl:S}}catch(C){return console.error(`[useExportPolling] Failed to poll export ${o.id}:`,C),null}})),{updateExport:N}=e.useExportStore.getState().actions;for(const o of y)o.status==="fulfilled"&&o.value&&N(o.value.id,o.value);const j=h();if(j.length>0&&!document.hidden){const o=j.reduce((S,F)=>F.startedAt<S?F.startedAt:S,j[0].startedAt),C=Q(o);d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{var S;(S=u.current)==null||S.call(u)},C)}else c.current=!1},[i,r,h]);return v.useEffect(()=>{u.current=b},[b]),v.useEffect(()=>{var w;h().length>0&&l&&!c.current&&(c.current=!0,(w=u.current)==null||w.call(u))},[f,l,h]),v.useEffect(()=>{var w;const p=h();l&&p.length>0&&!c.current&&(c.current=!0,(w=u.current)==null||w.call(u))},[l,h]),v.useEffect(()=>{!l&&d.current&&(clearTimeout(d.current),d.current=null,c.current=!1)},[l]),v.useEffect(()=>()=>{d.current&&(clearTimeout(d.current),d.current=null)},[]),{isPolling:c.current,isTabVisible:l,inProgressCount:h().length}}function W(){const{authToken:s,tokenProps:a}=e.useSemaphorContext(),f=e.useExportStore(u=>u.activeExports),{addExport:l}=e.useExportActions(),n=v.useRef(!1),d=a==null?void 0:a.apiServiceUrl,c=s==null?void 0:s.accessToken;v.useEffect(()=>{if(n.current||!d||!c)return;(async()=>{try{const{exports:i}=await e.getExports(d,c,{status:["pending","processing","chunking","compacting","completed","failed"],limit:20});for(const r of i){if(f.has(r.id))continue;const h=r.totalChunks?Math.round(r.completedChunks/r.totalChunks*100):0;let b;if(r.status==="completed")try{b=await e.getDownloadUrl(d,c,r.id)}catch(w){console.error(`[useExportRecovery] Failed to get download URL for ${r.id}:`,w)}const p={id:r.id,status:r.status,progress:h,title:Y(r),totalRows:r.totalRows,totalChunks:r.totalChunks,completedChunks:r.completedChunks,startedAt:new Date(r.createdAt),lastUpdatedAt:new Date,completedAt:r.completedAt?new Date(r.completedAt):void 0,fileSize:r.fileSize,error:r.error,expiresAt:new Date(r.expiresAt),downloadUrl:b};l(p)}n.current=!0}catch(i){console.error("[useExportRecovery] Failed to recover exports:",i),n.current=!0}})()},[d,c,l,f])}function Y(s){return s.title?s.title:e.isExportInProgress(s.status)?"Export in progress...":s.status==="completed"?"Export completed":s.status==="failed"?"Export failed":"Export"}function Z({open:s,onOpenChange:a,isLibraryVisual:f,currentVisualName:l,isSaving:n=!1,destinationMode:d="both",onConfirm:c}){const[u,i]=v.useState(f&&l?`Copy of ${l}`:l||""),[r,h]=v.useState("");v.useEffect(()=>{s&&(i(f&&l?`Copy of ${l}`:l||""),h(""))},[s,f,l]);const b=!!u.trim(),p=d==="local"?{saveToLibrary:!1,saveToCurrentDashboard:!0,badgeType:"local",description:"Creates a local copy on the current dashboard.",actionLabel:"Add to Dashboard (Local)"}:d==="library"?{saveToLibrary:!0,saveToCurrentDashboard:!1,badgeType:"library",description:"Creates a reusable visual in Visual Library.",actionLabel:"Save as Library Visual"}:{saveToLibrary:!0,saveToCurrentDashboard:!0,badgeType:"linked",description:"Creates a new library visual and adds a linked copy to this dashboard.",actionLabel:"Save Copy as Linked Visual"},w=()=>{!b||n||c({name:u.trim(),description:r.trim()||void 0,saveToLibrary:p.saveToLibrary,saveToCurrentDashboard:p.saveToCurrentDashboard})};return t.jsx(e.Dialog,{open:s,onOpenChange:a,children:t.jsxs(e.DialogContent,{className:"sm:max-w-[500px]",children:[t.jsxs(e.DialogHeader,{children:[t.jsxs(e.DialogTitle,{className:"flex items-center gap-2",children:[t.jsx("span",{children:"Save Visual As"}),p.badgeType!=="local"&&t.jsx(I.VisualBadge,{type:p.badgeType,showLabel:!0,className:"px-2 py-0.5"})]}),t.jsx(e.DialogDescription,{children:p.description})]}),t.jsxs("div",{className:"grid gap-4 py-4",children:[t.jsxs("div",{className:"grid gap-2",children:[t.jsx(e.Label,{htmlFor:"name",children:"Name"}),t.jsx(e.Input,{id:"name",value:u,onChange:E=>i(E.target.value),placeholder:"Enter visual name",disabled:n})]}),t.jsxs("div",{className:"grid gap-2",children:[t.jsx(e.Label,{htmlFor:"description",children:"Description (optional)"}),t.jsx(e.Textarea,{id:"description",value:r,onChange:E=>h(E.target.value),placeholder:"Enter visual description",rows:3,disabled:n})]})]}),t.jsxs(e.DialogFooter,{children:[t.jsx(e.Button,{variant:"outline",onClick:()=>a(!1),disabled:n,children:"Cancel"}),t.jsxs(e.Button,{onClick:w,disabled:!b||n,children:[n&&t.jsx(e.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),p.actionLabel]})]})]})})}function J(){const[s,a]=v.useState(!1),[f,l]=v.useState(!1),[n,d]=v.useState(null),[c,u]=v.useState(null),i=e.useEditorStore(m=>m.frame),r=e.useEditorStore(m=>m.card),h=e.useSelectedVisual(),b=e.useDashboardStore(m=>m.selectedSheetId),p=e.useDashboardStore(m=>m.dashboard),w=e.useDashboardStore(m=>m.actions.setIsDashboardPanelOpen),{getUpdatedFrame:E}=O.useVisualUtils(),{selectVisual:x}=e.useManagementActions(),{addFrame:y,setSelectedFrameId:N,setIsVisualEditing:j}=e.useDashboardActions(),o=e.useResolveExistingFrameSemanticExecutionPayload(),C=!!(i!=null&&i.visualId),S=(()=>{var m,g;return((m=i==null?void 0:i.cards)==null?void 0:m.length)===1&&((g=i.cards[0])!=null&&g.title)?i.cards[0].title:h!=null&&h.title?h.title:(r==null?void 0:r.title)||"Untitled Visual"})(),F=e.useCreateVisualWithFrame(m=>{m!=null&&m.id&&(x(m),f&&n&&c&&b&&(async()=>{try{const g={...n,id:e.v4(),visualId:m.id};y(b,g,{position:"end",semanticExecutionPayload:c}),N(g.id),l(!1),d(null),u(null),j(!1)}catch(g){console.error("Failed to promote semantic metadata for saved visual:",g),e.ue.error(g instanceof Error?g.message:"Failed to prepare semantic metadata for the saved visual")}})(),w(!0),a(!1))});return{saveAsDialogOpen:s,setSaveAsDialogOpen:a,handleSaveAs:async m=>{if(!b){e.ue.error("No sheet selected");return}const g=E(),A=e.getDynamicFrameSaveIssue(g);if(A){e.ue.error(A);return}const T=g.cards.length===1?{...g,cards:g.cards.map(L=>({...L,title:m.name}))}:g;if(m.saveToLibrary){let L=null;if(m.saveToCurrentDashboard)try{L=await o(T,{previousFrame:e.findDashboardFrameById(p,T.id)})}catch(B){console.error("Failed to prepare semantic metadata before saving visual:",B),e.ue.error(B instanceof Error?B.message:"Failed to prepare semantic metadata for the saved visual");return}l(m.saveToCurrentDashboard),d(T),u(L);const k={title:m.name,description:m.description,frameObject:T,isPrivate:!1};F.mutate(k)}else if(m.saveToCurrentDashboard){const L={...T,id:e.v4(),visualId:void 0};try{const k=await o(T,{previousFrame:e.findDashboardFrameById(p,T.id)});y(b,L,{position:"end",semanticExecutionPayload:k}),N(L.id),e.ue.success("Visual saved to dashboard"),a(!1),j(!1)}catch(k){console.error("Failed to save visual to dashboard:",k),e.ue.error(k instanceof Error?k.message:"Failed to prepare semantic metadata for the visual")}}},isLibraryVisual:C,currentVisualName:S,isSaving:F.isPending}}function ee(s={}){const a=e.useEditorStore(D=>D.frame),f=e.useEditorStore(D=>D.editorContext),l=e.useManagementStore(D=>D.selectedVisual),n=e.useDashboardStore(D=>D.selectedFrameId),d=e.useDashboardStore(D=>D.selectedSheetId),c=e.useDashboardStore(D=>D.dashboard),{setIsVisualEditing:u,updateFrame:i}=e.useDashboardActions(),[r,h]=v.useState(!1),[b,p]=v.useState("both"),w=e.useResolveExistingFrameSemanticExecutionPayload(),E=(f==null?void 0:f.type)==="documentSection",x=!!(a!=null&&a.visualId||l!=null&&l.id),y=!!(a!=null&&a.visualId&&n),N=x&&!y,{saveAsDialogOpen:j,setSaveAsDialogOpen:o,handleSaveAs:C,isLibraryVisual:S,currentVisualName:F,isSaving:P}=J(),{getUpdatedFrame:m}=O.useVisualUtils();if(E)return t.jsxs(t.Fragment,{children:[t.jsx(I.EditorAcceptButton,{className:"rounded-[5px]",variant:"default"}),t.jsx(I.EditorCancelButton,{})]});const g=async()=>{if(!d){e.ue.error("No sheet selected");return}if(r)return;h(!0);const D=m(),T=e.getDynamicFrameSaveIssue(D);if(T){h(!1),e.ue.error(T);return}const L={...D,visualId:void 0},k=e.findDashboardFrameById(c,L.id);try{const B=await w(L,{previousFrame:k});i(d,L,{semanticExecutionPayload:B})}catch(B){console.error("Failed to apply local semantic metadata:",B),h(!1),e.ue.error(B instanceof Error?B.message:"Failed to prepare semantic metadata for this visual");return}setTimeout(()=>{h(!1),e.ue.success("Changes applied. Visual is now local to this dashboard"),u(!1)},300)},A=D=>{p(D),o(!0)};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"inline-flex items-center overflow-hidden rounded-[5px]",children:[!x&&t.jsx(I.EditorAcceptButton,{className:"rounded-none",variant:"default"}),x&&N&&t.jsx(I.VisualSaveButton,{className:"rounded-none",variant:"default"}),x&&y&&t.jsx(I.VisualSaveAndApplyButton,{className:"rounded-none"}),t.jsxs(e.DropdownMenu,{modal:!1,children:[t.jsx(e.DropdownMenuTrigger,{asChild:!0,children:t.jsx(e.Button,{variant:"default",size:"xs",className:"w-7 rounded-none border-l border-primary-foreground/20 px-0","aria-label":"Open visual save options",disabled:P||r,children:t.jsx(e.ChevronDown,{className:"h-3.5 w-3.5"})})}),t.jsxs(e.DropdownMenuContent,{align:"end",className:"min-w-[220px] rounded-[6px] border border-border/60 p-1 shadow-sm",children:[y&&t.jsxs(t.Fragment,{children:[t.jsxs(e.DropdownMenuItem,{onClick:g,disabled:r,children:[t.jsx(e.Check,{className:"h-3.5 w-3.5"}),r?"Applying...":"Apply Locally"]}),t.jsx(e.DropdownMenuSeparator,{})]}),t.jsxs(e.DropdownMenuItem,{onClick:()=>A("local"),disabled:P,children:[t.jsx(e.Plus,{className:"h-3.5 w-3.5"}),"Add to Dashboard (Local)"]}),t.jsxs(e.DropdownMenuItem,{onClick:()=>A("library"),disabled:P,children:[t.jsx(I.Library,{className:"h-3.5 w-3.5"}),"Save as Library Visual"]}),t.jsxs(e.DropdownMenuItem,{onClick:()=>A("both"),disabled:P,children:[t.jsx(I.Link2,{className:"h-3.5 w-3.5"}),"Save Copy as Linked Visual"]})]})]})]}),t.jsx(I.EditorCancelButton,{}),t.jsx(Z,{open:j,onOpenChange:D=>{P||o(D)},isLibraryVisual:S,currentVisualName:F,isSaving:P,destinationMode:b,onConfirm:C})]})}function te({className:s}){const a=e.useEditorStore(r=>r.isDevMode),f=e.useDashboardStore(r=>r.isVisualEditing),{setIsDevMode:l}=e.useEditorActions(),{config:n}=v.useContext(e.SemaphorContext).tokenProps,d=(n==null?void 0:n.showAdvancedMode)!==!1;if(!f||!d)return null;const c=a?e.SlidersHorizontal:e.CodeXml,u=a?"Drag & drop":"SQL",i=a?"Switch to drag-and-drop mode":"Switch to SQL mode";return t.jsxs("button",{type:"button","aria-label":i,title:i,onClick:()=>l(!a),className:e.cn("inline-flex h-7 items-center gap-1.5 rounded-[5px] border border-border bg-background px-2 text-[12px] font-medium text-foreground transition-colors hover:bg-muted/40",s),children:[t.jsx(c,{className:"h-3 w-3 text-muted-foreground"}),u]})}function se({open:s,onOpenChange:a,onSave:f,onDiscard:l,isSaving:n,title:d="Unsaved changes",description:c="You have unsaved changes to this dashboard. What would you like to do?",cancelLabel:u="Cancel",discardLabel:i="Discard",saveLabel:r="Save"}){const h=b=>{!b&&n||a(b)};return t.jsx(e.AlertDialog,{open:s,onOpenChange:h,children:t.jsxs(e.AlertDialogContent,{children:[t.jsxs(e.AlertDialogHeader,{children:[t.jsx(e.AlertDialogTitle,{children:d}),t.jsx(e.AlertDialogDescription,{children:c})]}),t.jsxs(e.AlertDialogFooter,{children:[t.jsx(e.Button,{type:"button",size:"xs",onClick:l,disabled:n,variant:"ghost",className:"mr-auto text-muted-foreground hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive",children:i}),t.jsx(e.AlertDialogCancel,{disabled:n,children:u}),t.jsx(e.Button,{type:"button",size:"xs",onClick:f,disabled:n,children:n?t.jsxs(t.Fragment,{children:[t.jsx(e.LoaderCircle,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),"Saving..."]}):r})]})]})})}function R({export:s,onRemove:a}){const f=()=>{s.downloadUrl&&window.open(s.downloadUrl,"_blank")},l=u=>{u.stopPropagation(),a==null||a(s.id)},n=()=>{switch(s.status){case"completed":return t.jsx(e.CircleCheck,{className:"mt-0.5 h-5 w-5 shrink-0 text-green-600"});case"failed":return t.jsx(I.CircleX,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"});default:return t.jsx(e.LoaderCircle,{className:"text-foreground-muted mt-0.5 h-5 w-5 shrink-0 animate-spin"})}},d=e.isExportInProgress(s.status),c=(()=>{switch(s.status){case"pending":return"Queued...";case"processing":return"Processing...";case"chunking":return"Processing...";case"compacting":return"Finalizing...";default:return"Processing..."}})();return t.jsxs("div",{className:"group p-4 transition-colors hover:bg-muted/50",children:[t.jsxs("div",{className:"mb-2 flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[n(),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("h4",{className:"mb-1 truncate text-sm font-medium",children:s.title}),s.status==="completed"&&t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsxs("span",{children:[s.totalRows.toLocaleString()," rows"]}),s.fileSize&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"•"}),t.jsx("span",{children:e.formatFileSize(s.fileSize)})]})]}),d&&t.jsx("div",{className:"text-xs text-muted-foreground",children:c}),s.status==="failed"&&t.jsx("div",{className:"line-clamp-2 text-xs text-destructive",children:s.error||"Export failed"})]})]}),t.jsx(e.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",onClick:l,"aria-label":"Remove notification",children:t.jsx(e.X,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"ml-8",children:[s.status==="completed"&&t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:M.formatDistanceToNow(s.startedAt,{addSuffix:!0})}),s.downloadUrl&&t.jsxs(e.Button,{size:"sm",variant:"outline",className:"h-8 bg-transparent",onClick:f,children:[t.jsx(e.Download,{className:"mr-1.5 h-3.5 w-3.5"}),"Download"]})]}),d&&t.jsxs("div",{children:[t.jsx(e.Progress,{value:s.progress,className:"h-1.5"}),t.jsxs("span",{className:"mt-1 block text-xs text-muted-foreground",children:[s.progress,"% complete"]})]}),s.status==="failed"&&t.jsx("span",{className:"text-xs text-muted-foreground",children:M.formatDistanceToNow(s.startedAt,{addSuffix:!0})})]})]})}function z(){const{authToken:s,tokenProps:a}=e.useSemaphorContext(),f=e.useExportStore(x=>x.activeExports),{clearCompleted:l,removeExport:n,updateExport:d}=e.useExportActions(),[c,u]=v.useState(!1),[i,r]=v.useState(!1),h=Array.from(f.values()).sort((x,y)=>y.startedAt.getTime()-x.startedAt.getTime()),b=h.some(x=>x.status==="completed"||x.status==="failed"),p=v.useCallback(async()=>{const x=a==null?void 0:a.apiServiceUrl,y=s==null?void 0:s.accessToken;if(!(!x||!y)){u(!0);try{const N=Array.from(f.values());await Promise.all(N.map(async j=>{try{const o=await e.getExportStatus(x,y,j.id);let C;if(o.status==="completed")try{C=await e.getDownloadUrl(x,y,j.id)}catch(S){console.error(`Failed to get download URL for ${j.id}:`,S)}d(j.id,{status:o.status,progress:o.progress,completedChunks:o.completedChunks,completedAt:o.completedAt?new Date(o.completedAt):void 0,lastUpdatedAt:new Date,fileSize:o.fileSize,error:o.error,downloadUrl:C})}catch(o){console.error(`Failed to refresh export ${j.id}:`,o)}}))}finally{u(!1)}}},[f,s==null?void 0:s.accessToken,a==null?void 0:a.apiServiceUrl,d]),w=v.useCallback(async()=>{const x=a==null?void 0:a.apiServiceUrl,y=s==null?void 0:s.accessToken;if(!x||!y){l();return}r(!0);try{const N=h.filter(o=>o.status==="completed"||o.status==="failed"),j=await Promise.allSettled(N.map(async o=>(await e.cancelExport(x,y,o.id),o.id)));for(const o of j)o.status==="fulfilled"?n(o.value):console.error("Failed to delete export:",o.reason)}finally{r(!1)}},[h,a==null?void 0:a.apiServiceUrl,s==null?void 0:s.accessToken,l,n]),E=v.useCallback(async x=>{const y=a==null?void 0:a.apiServiceUrl,N=s==null?void 0:s.accessToken;if(y&&N)try{await e.cancelExport(y,N,x),n(x);return}catch(j){console.error(`Failed to cancel export ${x}:`,j)}n(x)},[a==null?void 0:a.apiServiceUrl,s==null?void 0:s.accessToken,n]);return h.length===0?t.jsxs("div",{className:"p-6 text-center",children:[t.jsx(U,{className:"mx-auto mb-2 h-8 w-8 text-muted-foreground"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"No active exports"}),t.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Large exports will appear here"})]}):t.jsxs("div",{className:"flex flex-col",children:[t.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(U,{className:"h-5 w-5 text-muted-foreground"}),t.jsx("h4",{className:"font-semibold",children:"Exports"})]}),t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(e.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:p,disabled:c,title:"Refresh status",children:t.jsx(e.RefreshCw,{className:`h-4 w-4 ${c?"animate-spin":""}`})}),b&&t.jsx(e.Button,{variant:"ghost",size:"sm",className:"h-7 px-2 text-sm",onClick:w,disabled:i,children:i?"Clearing...":"Clear all"})]})]}),t.jsx("div",{className:"max-h-[350px] overflow-y-auto",children:t.jsx("div",{className:"divide-y",children:h.map(x=>t.jsx(R,{export:x,onRemove:E},x.id))})})]})}function ae({variant:s}){const a=e.useExportStore(i=>i.activeExports),f=e.useInProgressExportsCount(),l=a.size>0,n=Array.from(a.values()).some(i=>i.status==="completed"||i.status==="failed"),c=f>0?f>9?"9+":String(f):null,u=l;return t.jsxs(e.Popover,{children:[t.jsx(e.PopoverTrigger,{asChild:!0,children:t.jsxs(e.Button,{variant:s??"ghost",size:"xs",className:"relative w-7 px-0 text-muted-foreground hover:text-foreground","aria-label":"Export notifications",children:[t.jsx(e.Bell,{className:"h-3.5 w-3.5"}),u&&t.jsx("span",{className:`absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${c?"-right-0.5 -top-0.5 h-3.5 min-w-3.5 px-0.5 text-[9px] font-semibold":"right-1 top-1 h-1.5 w-1.5"}`,children:c})]})}),t.jsx(e.PopoverContent,{className:"w-80 p-0",align:"end",sideOffset:8,children:t.jsx(z,{})})]})}function re(s){if(s)return{renamed:s.type==="rename"?{oldId:s.oldId,newId:s.newId}:void 0,removedControlId:s.type==="remove"?s.controlId:void 0,cardBindingsById:s.type==="add"||s.type==="update"?s.cardBindingsById:void 0,affectedBindingControlIds:s.type==="add"||s.type==="update"?s.affectedBindingControlIds:void 0}}function oe({open:s,onOpenChange:a,trigger:f,showTrigger:l=!0,initialMode:n="manage"}){const d=n==="create",{forceClose:c,handleOpenChange:u,isCreateFlowActive:i,preventPassiveDismissDuringCreate:r,resolvedOpen:h,setIsCreateFlowActive:b}=I.useCreateFlowOverlayState({open:s,onOpenChange:a,initialCreateFlowActive:n==="create",dismissMode:l?"passive":"explicit-only"}),p=e.useDashboardStore(m=>m.dashboard),{setDashboardControlsModel:w}=e.useDashboardActions(),{participants:E}=e.useDashboardStructuralParticipants(e.getDashboardCards(p)),x=Array.from(new Map(E.flatMap(m=>m.fieldChoices.map(g=>{var A;return[g.value,{option:g,target:(A=m.fieldTargetMap)==null?void 0:A[g.value]}]}))).values()),y=Array.from(new Map(E.flatMap(m=>m.metricChoices.map(g=>{var A;return[g.value,{option:g,target:(A=m.metricTargetMap)==null?void 0:A[g.value]}]}))).values()),N=e.collectDashboardControlIds({...p||{},controls:[]}),j=e.buildDashboardStructuralParticipantIdsByControlId(p),o=(m,g,A)=>{w(m,g,re(A))},C=v.useCallback(()=>{if(d){c();return}b(!1)},[d,c,b]),S=t.jsx(I.ControlDefinitionListEditor,{scope:"dashboard",controls:p.controls||[],reservedControlIds:N,defaultValues:p.defaultControlValues||{},usageByControlId:e.buildDashboardControlUsageById(p),availableFieldChoices:x,availableMetricChoices:y,structuralParticipants:E,structuralParticipantIdsByControlId:j,initialCreateFlow:n==="create",onCreateFlowActiveChange:b,onCreateFlowComplete:C,onChange:o,emptyMessage:"No dashboard controls yet."}),F=i?"Add dashboard control":"Dashboard Controls",P=t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("h4",{className:"text-sm font-medium",children:"Dashboard Controls"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Add shared controls viewers can use across the dashboard. Each card can decide how to respond to the same control."})]}),S]});return l?t.jsxs(e.Popover,{open:h,onOpenChange:u,children:[t.jsx(e.PopoverTrigger,{asChild:!0,children:f||t.jsxs(e.Button,{variant:"outline",className:"h-7 px-2",size:"sm",children:[t.jsx(e.SlidersHorizontal,{className:"mr-2 h-4 w-4"}),"Controls"]})}),t.jsx(e.PopoverContent,{className:"w-[620px] max-w-[95vw] space-y-4",align:"end",onEscapeKeyDown:r,onPointerDownOutside:r,children:P})]}):t.jsx(e.Dialog,{open:h,onOpenChange:u,children:t.jsxs(e.DialogContent,{className:"flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",onEscapeKeyDown:r,onPointerDownOutside:r,children:[t.jsxs(e.DialogHeader,{className:i?"space-y-0":void 0,children:[t.jsx(e.DialogTitle,{className:"text-[15px]",children:F}),t.jsx(e.DialogDescription,{className:i?"sr-only":"text-[13px]",children:i?"Configure and add a shared dashboard control.":"Add shared controls viewers can use across the dashboard. Each card can decide how to respond to the same control."})]}),t.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:S})]})})}function ne({showFilters:s,onToggleFilters:a,onAddFilter:f,onAddControl:l,onManageControls:n,size:d="default",className:c,primaryButtonClassName:u,secondaryButtonClassName:i,dropdownContentClassName:r}){const h=d==="toolbar";return t.jsxs("div",{className:e.cn("relative inline-flex items-stretch overflow-hidden rounded-[5px] border border-input bg-background",h?"h-8":"h-7",c),children:[t.jsxs(e.Button,{variant:"ghost",size:"xs",className:e.cn("h-full rounded-none border-0 bg-transparent pl-2.5 pr-2 shadow-none hover:bg-accent/50",u),onClick:a,children:[s?t.jsx(H,{className:"h-3.5 w-3.5"}):t.jsx(e.Filter,{className:"h-3.5 w-3.5"}),"Filter"]}),t.jsxs(e.DropdownMenu,{children:[t.jsx(e.DropdownMenuTrigger,{asChild:!0,children:t.jsx(e.Button,{variant:"ghost",size:"xs",className:e.cn("h-full w-7 rounded-none border-0 border-l border-border/60 bg-transparent px-0 shadow-none hover:bg-accent/50",i),"aria-label":"Filter and control actions",children:t.jsx(e.ChevronDown,{className:"h-3.5 w-3.5"})})}),t.jsxs(e.DropdownMenuContent,{align:"start",className:e.cn("min-w-[180px] rounded-[6px] border border-border/60 p-1 shadow-sm",r),children:[t.jsxs(e.DropdownMenuItem,{onSelect:f,children:[t.jsx(e.Filter,{className:"h-3.5 w-3.5"}),"Add filter"]}),t.jsxs(e.DropdownMenuItem,{onSelect:l,children:[t.jsx(e.SlidersHorizontal,{className:"h-3.5 w-3.5"}),"Add control"]}),t.jsxs(e.DropdownMenuItem,{onSelect:n,children:[t.jsx(e.Pencil,{className:"h-3.5 w-3.5"}),"Manage controls"]})]})]})]})}exports.AdvancedModeToggle=te;exports.DashboardControlsSettings=oe;exports.DashboardFilterControlsButton=ne;exports.ExportNotificationItem=R;exports.ExportNotificationList=z;exports.NotificationBell=ae;exports.UnsavedChangesAlert=se;exports.VisualEditingControls=ee;exports.useExportPolling=K;exports.useExportRecovery=W;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),r=require("react"),s=require("./index-8GnvL1_L.js");require("react-dom");function b(){const t=s.useDashboardStore(e=>e.dashboard),i=s.useDashboardStore(e=>e.actions.setDashboard),h=s.useDashboardStore(e=>e.showDashboardJSON),u=s.useDashboardStore(e=>e.actions.setShowDashboardJSON),a=r.useMemo(()=>t?JSON.stringify(t,null,2):"",[t]),[l,d]=r.useState(a),n=r.useRef(a);return r.useEffect(()=>{a!==n.current&&(d(a),n.current=a)},[a]),o.jsxs("div",{className:s.cn("relative p-2",{hidden:!h}),children:[o.jsxs(s.Button,{variant:"secondary",size:"sm",className:"absolute right-2 top-2 z-10 h-8",onClick:()=>u(!1),children:[o.jsx(s.X,{className:"mr-2 h-4 w-4"}),"Close"]}),o.jsx("div",{className:"h-[550px] overflow-hidden",children:o.jsx(s.CodeEditor,{value:l,onValueChange:e=>{d(e);try{const c=JSON.parse(e);n.current=JSON.stringify(c,null,2),i(c)}catch{}},language:"json"})})]})}exports.default=b;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),l=require("react"),a=require("./index-8GnvL1_L.js");function V(r={}){var C,I,P,A;const{authToken:o,tokenProps:s}=a.useSemaphorContext(),g=r.enabled??!0,d=(o==null?void 0:o.accessToken)??null,x=(s==null?void 0:s.apiServiceUrl)??null,[y,v]=l.useState(!1),[S,p]=l.useState(!1),[m,n]=l.useState(!1),[j,c]=l.useState(null),[f,N]=l.useState(null),k=f||{tz:((I=(C=s==null?void 0:s.params)==null?void 0:C.calendarContext)==null?void 0:I.tz)||null,weekStart:((A=(P=s==null?void 0:s.params)==null?void 0:P.calendarContext)==null?void 0:A.weekStart)??null},b=l.useCallback(async()=>{if(!(!g||!d||!x)){v(!0),c(null);try{const u=await fetch(`${x}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${d}`}});if(!u.ok){const h=await u.json().catch(()=>({}));throw new Error(h.error||"Failed to fetch preferences")}const i=await u.json();N({tz:i.tz,weekStart:i.weekStart,source:i.source,isInherited:i.isInherited,userHasPrefs:i.userHasPrefs,inherited:i.inherited})}catch(u){const i=u instanceof Error?u.message:"Unknown error";c(i)}finally{v(!1)}}},[d,x,g]);l.useEffect(()=>{g&&b()},[g,b]);const T=l.useCallback(async u=>{if(!d||!x)return c("Not authenticated"),!1;p(!0),c(null);try{const i=await fetch(`${x}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${d}`},body:JSON.stringify(u)});if(!i.ok){const h=await i.json().catch(()=>({}));throw new Error(h.error||"Failed to update preferences")}return await b(),!0}catch(i){const h=i instanceof Error?i.message:"Unknown error";return c(h),!1}finally{p(!1)}},[d,x,b]),w=l.useCallback(async()=>{if(!d||!x)return c("Not authenticated"),!1;n(!0),c(null);try{const u=await fetch(`${x}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${d}`}});if(!u.ok){const h=await u.json().catch(()=>({}));throw new Error(h.error||"Failed to clear preferences")}const i=await u.text();if(i)try{const h=JSON.parse(i);return N({tz:h.tz,weekStart:h.weekStart,source:h.source,isInherited:h.isInherited??!0,userHasPrefs:!1,inherited:h.inherited}),!0}catch{}return await b(),!0}catch(u){const i=u instanceof Error?u.message:"Unknown error";return c(i),!1}finally{n(!1)}},[d,x,b]);return{preferences:k,isLoading:y,isSaving:S,isClearing:m,error:j,updatePreferences:T,clearPreferences:w,refetch:b}}const z=[{value:"America/New_York",label:"Eastern Time (US & Canada)"},{value:"America/Chicago",label:"Central Time (US & Canada)"},{value:"America/Denver",label:"Mountain Time (US & Canada)"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)"},{value:"America/Phoenix",label:"Arizona"},{value:"America/Anchorage",label:"Alaska"},{value:"Pacific/Honolulu",label:"Hawaii"},{value:"Europe/London",label:"London"},{value:"Europe/Paris",label:"Paris, Berlin, Rome"},{value:"Asia/Tokyo",label:"Tokyo"},{value:"Asia/Shanghai",label:"Beijing, Shanghai"},{value:"Asia/Kolkata",label:"Mumbai, New Delhi"},{value:"Australia/Sydney",label:"Sydney"},{value:"UTC",label:"UTC"}],_=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}],U="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function X(){try{const r=Intl;if(r.supportedValuesOf)return r.supportedValuesOf("timeZone")}catch{}return z.map(r=>r.value)}function q(r){switch(r){case"tenant":return"tenant";case"organization":return"organization";case"system":return"system";default:return"default"}}function B(r){const o=z.find(s=>s.value===r);return o?o.label:r}function Z(r){const o=_.find(s=>s.value===r);return o?o.label:String(r)}function J({open:r,onOpenChange:o}){var L,M,F;const{preferences:s,isLoading:g,isSaving:d,isClearing:x,updatePreferences:y,clearPreferences:v}=V({enabled:r}),S=s.tz||((L=s.inherited)==null?void 0:L.tz)||Intl.DateTimeFormat().resolvedOptions().timeZone,p=s.weekStart??((M=s.inherited)==null?void 0:M.weekStart)??1,[m,n]=l.useState(!s.userHasPrefs),[j,c]=l.useState(!1),[f,N]=l.useState(S),[k,b]=l.useState(p),[T,w]=l.useState(!1),C=l.useMemo(()=>X(),[]),I=l.useMemo(()=>C.filter(t=>!z.some(W=>W.value===t)),[C]),P=l.useMemo(()=>B(f),[f]),A=s.inherited?B(s.inherited.tz):"UTC",u=s.inherited?Z(s.inherited.weekStart):"Monday",i=q((F=s.inherited)==null?void 0:F.source);l.useEffect(()=>{if(!r){c(!1);return}j||(s.userHasPrefs!==void 0&&n(!s.userHasPrefs),N(S),b(p))},[r,j,s.userHasPrefs,S,p]);const h=async()=>{if(g){a.ue.error("Preferences are still loading. Please try again.");return}m?await v()?(a.ue.success("Now using default settings. Please refresh the page to apply changes.",{duration:5e3}),o(!1)):a.ue.error("Failed to save preferences. Please try again."):await y({tz:f,weekStart:k})?(a.ue.success("Preferences saved. Please refresh the page to apply changes.",{duration:5e3}),o(!1)):a.ue.error("Failed to save preferences. Please try again.")},R=()=>{o(!1)},D=d||x,G=D||g;return e.jsx(a.Dialog,{open:r,onOpenChange:o,children:e.jsxs(a.DialogContent,{className:"rounded-[6px] border-border/60 sm:max-w-[440px] sm:rounded-[6px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{className:"text-[15px]",children:"Calendar preferences"}),e.jsx(a.DialogDescription,{className:"text-[13px] leading-5",children:"Set your timezone and week-start for date calculations and displays."})]}),e.jsxs("div",{className:"space-y-4 py-1",children:[e.jsxs(a.RadioGroup,{value:m?"defaults":"custom",onValueChange:t=>{c(!0),n(t==="defaults")},className:"space-y-0.5",children:[e.jsxs("label",{htmlFor:"mode-defaults",className:a.cn("flex cursor-pointer items-start gap-2 rounded-[5px] px-2 py-1.5 hover:bg-muted/50",m&&"bg-muted/50"),onClick:()=>{c(!0),n(!0)},children:[e.jsx(a.RadioGroupItem,{value:"defaults",id:"mode-defaults",className:"mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"text-[13px] font-medium text-foreground",children:["Use ",i," defaults"]}),e.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[A,", week starts ",u]})]})]}),e.jsxs("label",{htmlFor:"mode-custom",className:a.cn("flex cursor-pointer items-start gap-2 rounded-[5px] px-2 py-1.5 hover:bg-muted/50",!m&&"bg-muted/50"),onClick:()=>{c(!0),n(!1)},children:[e.jsx(a.RadioGroupItem,{value:"custom",id:"mode-custom",className:"mt-0.5"}),e.jsx("p",{className:"flex-1 text-[13px] font-medium text-foreground",children:"Use custom settings"})]})]}),e.jsxs("div",{className:a.cn("space-y-4 border-t border-border/60 pt-4 transition-opacity",m&&"pointer-events-none opacity-50"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a.Label,{className:U,children:"Timezone"}),e.jsxs(a.Popover,{open:T,onOpenChange:w,modal:!0,children:[e.jsx(a.PopoverTrigger,{asChild:!0,children:e.jsxs(a.Button,{variant:"outline",size:"xs",role:"combobox","aria-expanded":T,className:"w-full justify-between text-[12px] font-normal",disabled:m,children:[e.jsx("span",{className:"truncate",children:P}),e.jsx(a.ChevronsUpDown,{className:"ml-2 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),e.jsx(a.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(a.Command,{className:"overflow-visible",children:[e.jsx(a.CommandInput,{placeholder:"Search timezones…"}),e.jsxs(a.CommandList,{children:[e.jsx(a.CommandEmpty,{children:"No timezone found."}),e.jsx(a.CommandGroup,{heading:"Common",children:z.map(t=>e.jsxs(a.CommandItem,{value:`${t.value} ${t.label}`,onSelect:()=>{c(!0),N(t.value),w(!1)},children:[e.jsx(a.Check,{className:a.cn("h-3.5 w-3.5",f===t.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:t.label}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:t.value})]},t.value))}),e.jsx(a.CommandSeparator,{}),e.jsx(a.CommandGroup,{heading:"All timezones",children:I.map(t=>e.jsxs(a.CommandItem,{value:t,onSelect:()=>{c(!0),N(t),w(!1)},children:[e.jsx(a.Check,{className:a.cn("h-3.5 w-3.5",f===t?"opacity-100":"opacity-0")}),t]},t))})]})]})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a.Label,{className:U,children:"Week starts on"}),e.jsx(a.RadioGroup,{value:String(k),onValueChange:t=>{c(!0),b(Number(t))},className:"flex gap-4",disabled:m,children:_.map(t=>e.jsxs("label",{htmlFor:`week-start-${t.value}`,className:a.cn("flex cursor-pointer items-center gap-2 text-[13px]",m&&"cursor-not-allowed"),children:[e.jsx(a.RadioGroupItem,{value:String(t.value),id:`week-start-${t.value}`,disabled:m}),t.label]},t.value))})]})]})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(a.Button,{variant:"outline",size:"xs",onClick:R,disabled:D,children:"Cancel"}),e.jsx(a.Button,{size:"xs",onClick:h,disabled:G,children:D?e.jsxs(e.Fragment,{children:[e.jsx(a.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})})}const E=6,$=1,O=20,H="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function K(r){return Number.isNaN(r)?E:Math.min(O,Math.max($,r))}function Y({open:r,onOpenChange:o,dashboard:s,onApply:g,disabled:d=!1}){const[x,y]=l.useState(!1),[v,S]=l.useState("top"),[p,m]=l.useState(String(E)),n=s.summary;l.useEffect(()=>{r&&(y((n==null?void 0:n.enabled)===!0),S((n==null?void 0:n.position)==="bottom"?"bottom":"top"),m(String((n==null?void 0:n.maxItems)??E)))},[r,n==null?void 0:n.enabled,n==null?void 0:n.position,n==null?void 0:n.maxItems]);const j=l.useMemo(()=>K(Number.parseInt(p||`${E}`,10)),[p]),c=()=>{g({enabled:x,position:v,maxItems:j}),o(!1)};return e.jsx(a.Dialog,{open:r,onOpenChange:o,children:e.jsxs(a.DialogContent,{className:"rounded-[6px] border-border/60 sm:max-w-[420px] sm:rounded-[6px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{className:"text-[15px]",children:"Summary Settings"}),e.jsx(a.DialogDescription,{className:"text-[13px] leading-5",children:"Configure dashboard-level summary display. Card-level summary settings still control which cards contribute."})]}),e.jsxs("div",{className:"space-y-4 py-1",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-enabled",className:"text-[13px]",children:"Enable dashboard summary"}),e.jsx(a.Switch,{size:"xs",id:"dashboard-summary-enabled",checked:x,disabled:d,onCheckedChange:y})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-position",className:H,children:"Position"}),e.jsxs(a.Select,{value:v,disabled:d,onValueChange:f=>S(f),children:[e.jsx(a.SelectTrigger,{id:"dashboard-summary-position",size:"xs",children:e.jsx(a.SelectValue,{placeholder:"Select position"})}),e.jsxs(a.SelectContent,{children:[e.jsx(a.SelectItem,{value:"top",children:"Top"}),e.jsx(a.SelectItem,{value:"bottom",children:"Bottom"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-max-items",className:H,children:"Max items"}),e.jsx(a.Input,{size:"xs",id:"dashboard-summary-max-items",type:"number",min:$,max:O,disabled:d,value:p,onChange:f=>m(f.target.value),onBlur:()=>m(String(j))}),e.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Display limit only. Computation is unchanged."})]}),d&&e.jsx("p",{className:"text-[12px] text-amber-700",children:"Enter dashboard edit mode to modify summary settings."})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(a.Button,{variant:"outline",size:"xs",onClick:()=>o(!1),children:"Cancel"}),e.jsx(a.Button,{size:"xs",onClick:c,disabled:d,children:"Apply"})]})]})})}exports.CalendarPreferencesDialog=J;exports.DashboardSummarySettingsDialog=Y;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const Ce={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Ee=(t,e,n)=>{let r;const a=Ce[t];return typeof a=="string"?r=a:e===1?r=a.one:r=a.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function X(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const Fe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},$e={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},He={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Le={date:X({formats:Fe,defaultWidth:"full"}),time:X({formats:$e,defaultWidth:"full"}),dateTime:X({formats:He,defaultWidth:"full"})},_e={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Xe=(t,e,n,r)=>_e[t];function S(t){return(e,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&t.formattingValues){const c=t.defaultFormattingWidth||t.defaultWidth,u=n!=null&&n.width?String(n.width):c;a=t.formattingValues[u]||t.formattingValues[c]}else{const c=t.defaultWidth,u=n!=null&&n.width?String(n.width):t.defaultWidth;a=t.values[u]||t.values[c]}const i=t.argumentCallback?t.argumentCallback(e):e;return a[i]}}const Ue={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Ze={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Ae={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Ge={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},qe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Re={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ze=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},je={ordinalNumber:ze,era:S({values:Ue,defaultWidth:"wide"}),quarter:S({values:Ze,defaultWidth:"wide",argumentCallback:t=>t-1}),month:S({values:Ae,defaultWidth:"wide"}),day:S({values:Ge,defaultWidth:"wide"}),dayPeriod:S({values:qe,defaultWidth:"wide",formattingValues:Re,defaultFormattingWidth:"wide"})};function W(t){return(e,n={})=>{const r=n.width,a=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(a);if(!i)return null;const c=i[0],u=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],s=Array.isArray(u)?Qe(u,D=>D.test(c)):Be(u,D=>D.test(c));let f;f=t.valueCallback?t.valueCallback(s):s,f=n.valueCallback?n.valueCallback(f):f;const d=e.slice(c.length);return{value:f,rest:d}}}function Be(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function Qe(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function Ve(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const a=r[0],i=e.match(t.parsePattern);if(!i)return null;let c=t.valueCallback?t.valueCallback(i[0]):i[0];c=n.valueCallback?n.valueCallback(c):c;const u=e.slice(a.length);return{value:c,rest:u}}}const Je=/^(\d+)(th|st|nd|rd)?/i,Ke=/\d+/i,pe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},et={any:[/^b/i,/^(a|c)/i]},tt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},nt={any:[/1/i,/2/i,/3/i,/4/i]},rt={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},at={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},it={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},ct={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},ut={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},st={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ft={ordinalNumber:Ve({matchPattern:Je,parsePattern:Ke,valueCallback:t=>parseInt(t,10)}),era:W({matchPatterns:pe,defaultMatchWidth:"wide",parsePatterns:et,defaultParseWidth:"any"}),quarter:W({matchPatterns:tt,defaultMatchWidth:"wide",parsePatterns:nt,defaultParseWidth:"any",valueCallback:t=>t+1}),month:W({matchPatterns:rt,defaultMatchWidth:"wide",parsePatterns:at,defaultParseWidth:"any"}),day:W({matchPatterns:it,defaultMatchWidth:"wide",parsePatterns:ct,defaultParseWidth:"any"}),dayPeriod:W({matchPatterns:ut,defaultMatchWidth:"any",parsePatterns:st,defaultParseWidth:"any"})},Me={code:"en-US",formatDistance:Ee,formatLong:Le,formatRelative:Xe,localize:je,match:ft,options:{weekStartsOn:0,firstWeekContainsDate:1}};let ot={};function P(){return ot}const xe=6048e5,lt=864e5,dt=6e4,mt=36e5,v=43200,ee=1440;function l(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function te(t){const e=l(t);return e.setHours(0,0,0,0),e}function E(t){const e=l(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function ht(t,e){const n=te(t),r=te(e),a=+n-E(n),i=+r-E(r);return Math.round((a-i)/lt)}function x(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function gt(t){const e=l(t),n=x(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}function wt(t){const e=l(t);return ht(e,gt(e))+1}function k(t,e){var u,s,f,d;const n=P(),r=(e==null?void 0:e.weekStartsOn)??((s=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:s.weekStartsOn)??n.weekStartsOn??((d=(f=n.locale)==null?void 0:f.options)==null?void 0:d.weekStartsOn)??0,a=l(t),i=a.getDay(),c=(i<r?7:0)+i-r;return a.setDate(a.getDate()-c),a.setHours(0,0,0,0),a}function F(t){return k(t,{weekStartsOn:1})}function Te(t){const e=l(t),n=e.getFullYear(),r=x(t,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const a=F(r),i=x(t,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const c=F(i);return e.getTime()>=a.getTime()?n+1:e.getTime()>=c.getTime()?n:n-1}function Dt(t){const e=Te(t),n=x(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),F(n)}function yt(t){const e=l(t),n=+F(e)-+Dt(e);return Math.round(n/xe)+1}function Ne(t,e){var d,D,m,y;const n=l(t),r=n.getFullYear(),a=P(),i=(e==null?void 0:e.firstWeekContainsDate)??((D=(d=e==null?void 0:e.locale)==null?void 0:d.options)==null?void 0:D.firstWeekContainsDate)??a.firstWeekContainsDate??((y=(m=a.locale)==null?void 0:m.options)==null?void 0:y.firstWeekContainsDate)??1,c=x(t,0);c.setFullYear(r+1,0,i),c.setHours(0,0,0,0);const u=k(c,e),s=x(t,0);s.setFullYear(r,0,i),s.setHours(0,0,0,0);const f=k(s,e);return n.getTime()>=u.getTime()?r+1:n.getTime()>=f.getTime()?r:r-1}function Mt(t,e){var u,s,f,d;const n=P(),r=(e==null?void 0:e.firstWeekContainsDate)??((s=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:s.firstWeekContainsDate)??n.firstWeekContainsDate??((d=(f=n.locale)==null?void 0:f.options)==null?void 0:d.firstWeekContainsDate)??1,a=Ne(t,e),i=x(t,0);return i.setFullYear(a,0,r),i.setHours(0,0,0,0),k(i,e)}function xt(t,e){const n=l(t),r=+k(n,e)-+Mt(n,e);return Math.round(r/xe)+1}function o(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const T={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return o(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):o(n+1,2)},d(t,e){return o(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return o(t.getHours()%12||12,e.length)},H(t,e){return o(t.getHours(),e.length)},m(t,e){return o(t.getMinutes(),e.length)},s(t,e){return o(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return o(a,e.length)}},b={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ne={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return T.y(t,e)},Y:function(t,e,n,r){const a=Ne(t,r),i=a>0?a:1-a;if(e==="YY"){const c=i%100;return o(c,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):o(i,e.length)},R:function(t,e){const n=Te(t);return o(n,e.length)},u:function(t,e){const n=t.getFullYear();return o(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return o(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return o(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return T.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return o(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const a=xt(t,r);return e==="wo"?n.ordinalNumber(a,{unit:"week"}):o(a,e.length)},I:function(t,e,n){const r=yt(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):o(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):T.d(t,e)},D:function(t,e,n){const r=wt(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):o(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const a=t.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return o(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const a=t.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return o(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),a=r===0?7:r;switch(e){case"i":return String(a);case"ii":return o(a,e.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const a=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let a;switch(r===12?a=b.noon:r===0?a=b.midnight:a=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let a;switch(r>=17?a=b.evening:r>=12?a=b.afternoon:r>=4?a=b.morning:a=b.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return T.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):T.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):o(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):o(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):T.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):T.s(t,e)},S:function(t,e){return T.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return ae(r);case"XXXX":case"XX":return N(r);case"XXXXX":case"XXX":default:return N(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return ae(r);case"xxxx":case"xx":return N(r);case"xxxxx":case"xxx":default:return N(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+re(r,":");case"OOOO":default:return"GMT"+N(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+re(r,":");case"zzzz":default:return"GMT"+N(r,":")}},t:function(t,e,n){const r=Math.trunc(t.getTime()/1e3);return o(r,e.length)},T:function(t,e,n){const r=t.getTime();return o(r,e.length)}};function re(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),a=Math.trunc(r/60),i=r%60;return i===0?n+String(a):n+String(a)+e+o(i,2)}function ae(t,e){return t%60===0?(t>0?"-":"+")+o(Math.abs(t)/60,2):N(t,e)}function N(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),a=o(Math.trunc(r/60),2),i=o(r%60,2);return n+a+e+i}const ie=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},Oe=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Tt=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return ie(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",ie(r,e)).replace("{{time}}",Oe(a,e))},Nt={p:Oe,P:Tt},Ot=/^D+$/,bt=/^Y+$/,Yt=["D","DD","YY","YYYY"];function Pt(t){return Ot.test(t)}function It(t){return bt.test(t)}function St(t,e,n){const r=Wt(t,e,n);if(console.warn(r),Yt.includes(t))throw new RangeError(r)}function Wt(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function kt(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function vt(t){if(!kt(t)&&typeof t!="number")return!1;const e=l(t);return!isNaN(Number(e))}const Ct=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Et=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Ft=/^'([^]*?)'?$/,$t=/''/g,Ht=/[a-zA-Z]/;function j(t,e,n){var d,D,m,y,M,O,K,p;const r=P(),a=(n==null?void 0:n.locale)??r.locale??Me,i=(n==null?void 0:n.firstWeekContainsDate)??((D=(d=n==null?void 0:n.locale)==null?void 0:d.options)==null?void 0:D.firstWeekContainsDate)??r.firstWeekContainsDate??((y=(m=r.locale)==null?void 0:m.options)==null?void 0:y.firstWeekContainsDate)??1,c=(n==null?void 0:n.weekStartsOn)??((O=(M=n==null?void 0:n.locale)==null?void 0:M.options)==null?void 0:O.weekStartsOn)??r.weekStartsOn??((p=(K=r.locale)==null?void 0:K.options)==null?void 0:p.weekStartsOn)??0,u=l(t);if(!vt(u))throw new RangeError("Invalid time value");let s=e.match(Et).map(w=>{const g=w[0];if(g==="p"||g==="P"){const _=Nt[g];return _(w,a.formatLong)}return w}).join("").match(Ct).map(w=>{if(w==="''")return{isToken:!1,value:"'"};const g=w[0];if(g==="'")return{isToken:!1,value:Lt(w)};if(ne[g])return{isToken:!0,value:w};if(g.match(Ht))throw new RangeError("Format string contains an unescaped latin alphabet character `"+g+"`");return{isToken:!1,value:w}});a.localize.preprocessor&&(s=a.localize.preprocessor(u,s));const f={firstWeekContainsDate:i,weekStartsOn:c,locale:a};return s.map(w=>{if(!w.isToken)return w.value;const g=w.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&It(g)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&Pt(g))&&St(g,e,String(t));const _=ne[g[0]];return _(u,g,a.localize,f)}).join("")}function Lt(t){const e=t.match(Ft);return e?e[1].replace($t,"'"):t}function C(t,e){const n=l(t),r=l(e),a=n.getTime()-r.getTime();return a<0?-1:a>0?1:a}function _t(t){return x(t,Date.now())}function Xt(t,e){const n=l(t),r=l(e),a=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return a*12+i}function Ut(t){return e=>{const r=(t?Math[t]:Math.trunc)(e);return r===0?0:r}}function Zt(t,e){return+l(t)-+l(e)}function At(t){const e=l(t);return e.setHours(23,59,59,999),e}function Gt(t){const e=l(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function qt(t){const e=l(t);return+At(e)==+Gt(e)}function Rt(t,e){const n=l(t),r=l(e),a=C(n,r),i=Math.abs(Xt(n,r));let c;if(i<1)c=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-a*i);let u=C(n,r)===-a;qt(l(t))&&i===1&&C(t,r)===1&&(u=!1),c=a*(i-Number(u))}return c===0?0:c}function zt(t,e,n){const r=Zt(t,e)/1e3;return Ut(n==null?void 0:n.roundingMethod)(r)}function jt(t,e,n){const r=P(),a=(n==null?void 0:n.locale)??r.locale??Me,i=2520,c=C(t,e);if(isNaN(c))throw new RangeError("Invalid time value");const u=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:c});let s,f;c>0?(s=l(e),f=l(t)):(s=l(t),f=l(e));const d=zt(f,s),D=(E(f)-E(s))/1e3,m=Math.round((d-D)/60);let y;if(m<2)return n!=null&&n.includeSeconds?d<5?a.formatDistance("lessThanXSeconds",5,u):d<10?a.formatDistance("lessThanXSeconds",10,u):d<20?a.formatDistance("lessThanXSeconds",20,u):d<40?a.formatDistance("halfAMinute",0,u):d<60?a.formatDistance("lessThanXMinutes",1,u):a.formatDistance("xMinutes",1,u):m===0?a.formatDistance("lessThanXMinutes",1,u):a.formatDistance("xMinutes",m,u);if(m<45)return a.formatDistance("xMinutes",m,u);if(m<90)return a.formatDistance("aboutXHours",1,u);if(m<ee){const M=Math.round(m/60);return a.formatDistance("aboutXHours",M,u)}else{if(m<i)return a.formatDistance("xDays",1,u);if(m<v){const M=Math.round(m/ee);return a.formatDistance("xDays",M,u)}else if(m<v*2)return y=Math.round(m/v),a.formatDistance("aboutXMonths",y,u)}if(y=Rt(f,s),y<12){const M=Math.round(m/v);return a.formatDistance("xMonths",M,u)}else{const M=y%12,O=Math.trunc(y/12);return M<3?a.formatDistance("aboutXYears",O,u):M<9?a.formatDistance("overXYears",O,u):a.formatDistance("almostXYears",O+1,u)}}function be(t,e){return jt(t,_t(t),e)}function Bt(){return Object.assign({},P())}function ce(t,e,n){const r=Bt(),a=Jt(t,n.timeZone,n.locale??r.locale);return"formatToParts"in a?Qt(a,e):Vt(a,e)}function Qt(t,e){const n=t.formatToParts(e);for(let r=n.length-1;r>=0;--r)if(n[r].type==="timeZoneName")return n[r].value}function Vt(t,e){const n=t.format(e).replace(/\u200E/g,""),r=/ [\w-+ ]+$/.exec(n);return r?r[0].substr(1):""}function Jt(t,e,n){return new Intl.DateTimeFormat(n?[n.code,"en-US"]:void 0,{timeZone:e,timeZoneName:t})}function Kt(t,e){const n=rn(e);return"formatToParts"in n?en(n,t):tn(n,t)}const pt={year:0,month:1,day:2,hour:3,minute:4,second:5};function en(t,e){try{const n=t.formatToParts(e),r=[];for(let a=0;a<n.length;a++){const i=pt[n[a].type];i!==void 0&&(r[i]=parseInt(n[a].value,10))}return r}catch(n){if(n instanceof RangeError)return[NaN];throw n}}function tn(t,e){const n=t.format(e),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[parseInt(r[3],10),parseInt(r[1],10),parseInt(r[2],10),parseInt(r[4],10),parseInt(r[5],10),parseInt(r[6],10)]}const U={},ue=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),nn=ue==="06/25/2014, 00:00:00"||ue==="06/25/2014 00:00:00";function rn(t){return U[t]||(U[t]=nn?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:t,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),U[t]}function B(t,e,n,r,a,i,c){const u=new Date(0);return u.setUTCFullYear(t,e,n),u.setUTCHours(r,a,i,c),u}const se=36e5,an=6e4,Z={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function L(t,e,n){if(!t)return 0;let r=Z.timezoneZ.exec(t);if(r)return 0;let a,i;if(r=Z.timezoneHH.exec(t),r)return a=parseInt(r[1],10),fe(a)?-(a*se):NaN;if(r=Z.timezoneHHMM.exec(t),r){a=parseInt(r[2],10);const c=parseInt(r[3],10);return fe(a,c)?(i=Math.abs(a)*se+c*an,r[1]==="+"?-i:i):NaN}if(sn(t)){e=new Date(e||Date.now());const c=n?e:cn(e),u=R(c,t);return-(n?u:un(e,u,t))}return NaN}function cn(t){return B(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())}function R(t,e){const n=Kt(t,e),r=B(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime();let a=t.getTime();const i=a%1e3;return a-=i>=0?i:1e3+i,r-a}function un(t,e,n){let a=t.getTime()-e;const i=R(new Date(a),n);if(e===i)return e;a-=i-e;const c=R(new Date(a),n);return i===c?i:Math.max(i,c)}function fe(t,e){return-23<=t&&t<=23&&(e==null||0<=e&&e<=59)}const oe={};function sn(t){if(oe[t])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:t}),oe[t]=!0,!0}catch{return!1}}const fn=60*1e3,on={X:function(t,e,n){const r=A(n.timeZone,t);if(r===0)return"Z";switch(e){case"X":return le(r);case"XXXX":case"XX":return Y(r);case"XXXXX":case"XXX":default:return Y(r,":")}},x:function(t,e,n){const r=A(n.timeZone,t);switch(e){case"x":return le(r);case"xxxx":case"xx":return Y(r);case"xxxxx":case"xxx":default:return Y(r,":")}},O:function(t,e,n){const r=A(n.timeZone,t);switch(e){case"O":case"OO":case"OOO":return"GMT"+ln(r,":");case"OOOO":default:return"GMT"+Y(r,":")}},z:function(t,e,n){switch(e){case"z":case"zz":case"zzz":return ce("short",t,n);case"zzzz":default:return ce("long",t,n)}}};function A(t,e){const n=t?L(t,e,!0)/fn:(e==null?void 0:e.getTimezoneOffset())??0;if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+t);return n}function $(t,e){const n=t<0?"-":"";let r=Math.abs(t).toString();for(;r.length<e;)r="0"+r;return n+r}function Y(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),a=$(Math.floor(r/60),2),i=$(Math.floor(r%60),2);return n+a+e+i}function le(t,e){return t%60===0?(t>0?"-":"+")+$(Math.abs(t)/60,2):Y(t,e)}function ln(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),a=Math.floor(r/60),i=r%60;return i===0?n+String(a):n+String(a)+e+$(i,2)}function de(t){const e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+t-+e}const Ye=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,G=36e5,me=6e4,dn=2,h={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Ye};function H(t,e={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(t===null)return new Date(NaN);const n=e.additionalDigits==null?dn:Number(e.additionalDigits);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]")return new Date(t.getTime());if(typeof t=="number"||Object.prototype.toString.call(t)==="[object Number]")return new Date(t);if(Object.prototype.toString.call(t)!=="[object String]")return new Date(NaN);const r=mn(t),{year:a,restDateString:i}=hn(r.date,n),c=gn(i,a);if(c===null||isNaN(c.getTime()))return new Date(NaN);if(c){const u=c.getTime();let s=0,f;if(r.time&&(s=wn(r.time),s===null||isNaN(s)))return new Date(NaN);if(r.timeZone||e.timeZone){if(f=L(r.timeZone||e.timeZone,new Date(u+s)),isNaN(f))return new Date(NaN)}else f=de(new Date(u+s)),f=de(new Date(u+s+f));return new Date(u+s+f)}else return new Date(NaN)}function mn(t){const e={};let n=h.dateTimePattern.exec(t),r;if(n?(e.date=n[1],r=n[3]):(n=h.datePattern.exec(t),n?(e.date=n[1],r=n[2]):(e.date=null,r=t)),r){const a=h.timeZone.exec(r);a?(e.time=r.replace(a[1],""),e.timeZone=a[1].trim()):e.time=r}return e}function hn(t,e){if(t){const n=h.YYY[e],r=h.YYYYY[e];let a=h.YYYY.exec(t)||r.exec(t);if(a){const i=a[1];return{year:parseInt(i,10),restDateString:t.slice(i.length)}}if(a=h.YY.exec(t)||n.exec(t),a){const i=a[1];return{year:parseInt(i,10)*100,restDateString:t.slice(i.length)}}}return{year:null}}function gn(t,e){if(e===null)return null;let n,r,a;if(!t||!t.length)return n=new Date(0),n.setUTCFullYear(e),n;let i=h.MM.exec(t);if(i)return n=new Date(0),r=parseInt(i[1],10)-1,ge(e,r)?(n.setUTCFullYear(e,r),n):new Date(NaN);if(i=h.DDD.exec(t),i){n=new Date(0);const c=parseInt(i[1],10);return Mn(e,c)?(n.setUTCFullYear(e,0,c),n):new Date(NaN)}if(i=h.MMDD.exec(t),i){n=new Date(0),r=parseInt(i[1],10)-1;const c=parseInt(i[2],10);return ge(e,r,c)?(n.setUTCFullYear(e,r,c),n):new Date(NaN)}if(i=h.Www.exec(t),i)return a=parseInt(i[1],10)-1,we(a)?he(e,a):new Date(NaN);if(i=h.WwwD.exec(t),i){a=parseInt(i[1],10)-1;const c=parseInt(i[2],10)-1;return we(a,c)?he(e,a,c):new Date(NaN)}return null}function wn(t){let e,n,r=h.HH.exec(t);if(r)return e=parseFloat(r[1].replace(",",".")),q(e)?e%24*G:NaN;if(r=h.HHMM.exec(t),r)return e=parseInt(r[1],10),n=parseFloat(r[2].replace(",",".")),q(e,n)?e%24*G+n*me:NaN;if(r=h.HHMMSS.exec(t),r){e=parseInt(r[1],10),n=parseInt(r[2],10);const a=parseFloat(r[3].replace(",","."));return q(e,n,a)?e%24*G+n*me+a*1e3:NaN}return null}function he(t,e,n){e=e||0,n=n||0;const r=new Date(0);r.setUTCFullYear(t,0,4);const a=r.getUTCDay()||7,i=e*7+n+1-a;return r.setUTCDate(r.getUTCDate()+i),r}const Dn=[31,28,31,30,31,30,31,31,30,31,30,31],yn=[31,29,31,30,31,30,31,31,30,31,30,31];function Pe(t){return t%400===0||t%4===0&&t%100!==0}function ge(t,e,n){if(e<0||e>11)return!1;if(n!=null){if(n<1)return!1;const r=Pe(t);if(r&&n>yn[e]||!r&&n>Dn[e])return!1}return!0}function Mn(t,e){if(e<1)return!1;const n=Pe(t);return!(n&&e>366||!n&&e>365)}function we(t,e){return!(t<0||t>52||e!=null&&(e<0||e>6))}function q(t,e,n){return!(t<0||t>=25||e!=null&&(e<0||e>=60)||n!=null&&(n<0||n>=60))}const xn=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Tn(t,e,n={}){e=String(e);const r=e.match(xn);if(r){const a=H(n.originalDate||t,n);e=r.reduce(function(i,c){if(c[0]==="'")return i;const u=i.indexOf(c),s=i[u-1]==="'",f=i.replace(c,"'"+on[c[0]](a,c,n)+"'");return s?f.substring(0,u-1)+f.substring(u+1):f},e)}return j(t,e,n)}function Ie(t,e,n){t=H(t,n);const r=L(e,t,!0),a=new Date(t.getTime()-r),i=new Date(0);return i.setFullYear(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()),i.setHours(a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds()),i}function Se(t,e,n,r){return r={...r,timeZone:e,originalDate:t},Tn(Ie(t,e,{timeZone:r.timeZone}),n,r)}function We(t,e,n){if(typeof t=="string"&&!t.match(Ye))return H(t,{...n,timeZone:e});t=H(t,n);const r=B(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()).getTime(),a=L(e,new Date(r));return new Date(r+a)}function De(t){if(!t)return!1;const e=t.toLowerCase().replace("_","-");return e==="en-in"||e.startsWith("en-in-")}function ye(t,e){const n=Math.abs(t);return n>=1e12?{divisor:1e12,suffix:"T"}:n>=1e9?{divisor:1e9,suffix:"B"}:De(e)&&n>=1e7?{divisor:1e7,suffix:"Cr"}:n>=1e6?{divisor:1e6,suffix:"M"}:De(e)&&n>=1e5?{divisor:1e5,suffix:"L"}:n>=1e3?{divisor:1e3,suffix:"K"}:{divisor:1,suffix:""}}function z(t,e){try{const n=I(e);return ye(t,n)}catch{return ye(t,"en-US")}}function Nn(t){try{return new Intl.NumberFormat(t),!0}catch{return!1}}function I(t){return t&&Nn(t)?t:"en-US"}function Q(t,e){if(t==null||isNaN(t))return"";const n=I(e==null?void 0:e.locale);let r=t;if(e!=null&&e.multiplyBy&&(r*=e.multiplyBy),e!=null&&e.useSuffix){const{divisor:i,suffix:c}=z(r,n);r=r/i;const u=new Intl.NumberFormat(n,{minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(r);return`${(e==null?void 0:e.prefix)??""}${u}${c}${(e==null?void 0:e.suffix)??""}`}const a=new Intl.NumberFormat(n,{minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(r);if(e!=null&&e.negativeInParentheses&&r<0){const i=a.replace("-","");return`(${(e==null?void 0:e.prefix)??""}${i}${(e==null?void 0:e.suffix)??""})`}return`${(e==null?void 0:e.prefix)??""}${a}${(e==null?void 0:e.suffix)??""}`}function ke(t,e){if(t==null||isNaN(t))return"";const n=I(e==null?void 0:e.locale),r=(e==null?void 0:e.currency)||"USD",a=t<0,i=!!(e!=null&&e.negativeInParentheses&&a),c=i?Math.abs(t):t;try{if(e!=null&&e.useSuffix){const{divisor:s,suffix:f}=z(c,n),d=c/s,m=`${new Intl.NumberFormat(n,{style:"currency",currency:r,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(d)}${f}`;return i?`(${m})`:m}const u=new Intl.NumberFormat(n,{style:"currency",currency:r,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(c);return i?`(${u})`:u}catch{const u=Math.abs(t),s=e!=null&&e.useSuffix?z(u,n):{divisor:1,suffix:""},f=Q(u/s.divisor,{locale:n,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}),d=`${r} ${f}${s.suffix}`;return a?e!=null&&e.negativeInParentheses?`(${d})`:`-${d}`:d}}function ve(t,e){if(t==null||isNaN(t))return"";const n=I(e==null?void 0:e.locale),a=(e==null?void 0:e.alreadyPercent)??(e==null?void 0:e.percentValueMode)==="whole"?t/100:t;return new Intl.NumberFormat(n,{style:"percent",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(a)}function V(t,e){if(t==null||isNaN(t))return"";const n=I(e==null?void 0:e.locale);return new Intl.NumberFormat(n,{notation:"scientific",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2}).format(t)}function On(t,e,n="en-US"){if(t==null||isNaN(t))return"";const r=I((e==null?void 0:e.locale)||n),a=(e==null?void 0:e.style)||"decimal";if(a==="percent"){const c=((e==null?void 0:e.percentValueMode)??"whole")==="whole"?t/100:t;return new Intl.NumberFormat(r,{style:"percent",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(c)}return a==="currency"?new Intl.NumberFormat(r,{style:"currency",currency:(e==null?void 0:e.currency)||"USD",minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(t):a==="scientific"?V(t,{locale:r,minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2}):new Intl.NumberFormat(r,{minimumFractionDigits:(e==null?void 0:e.minimumFractionDigits)??0,maximumFractionDigits:(e==null?void 0:e.maximumFractionDigits)??2,useGrouping:(e==null?void 0:e.useGrouping)??!0}).format(t)}function bn(t,e,n){const r={style:e==="currency"?"currency":e==="percent"?"percent":"decimal",locale:n==null?void 0:n.locale,currency:n==null?void 0:n.currency,minimumFractionDigits:n==null?void 0:n.decimalPlaces,maximumFractionDigits:n==null?void 0:n.decimalPlaces,useSuffix:n==null?void 0:n.useSuffix,prefix:n==null?void 0:n.prefix,suffix:n==null?void 0:n.suffix,negativeInParentheses:n==null?void 0:n.negativeInParentheses,multiplyBy:n==null?void 0:n.multiplyBy};switch(e){case"currency":return ke(t,r);case"percent":return ve(t,r);case"scientific":return V(t,r);default:return Q(t,r)}}function Yn(t,e){return t&&t!=="auto"?t:e}function Pn(t,e=new Date){try{const n={timeZone:t,timeZoneName:"short"},a=new Intl.DateTimeFormat("en-US",n).formatToParts(e).find(i=>i.type==="timeZoneName");return(a==null?void 0:a.value)||t}catch{return t}}function In(t){try{const e={timeZone:t,timeZoneName:"long"},r=new Intl.DateTimeFormat("en-US",e).formatToParts(new Date).find(a=>a.type==="timeZoneName");return(r==null?void 0:r.value)||t}catch{return t}}function J(t,e="auto"){if(!t)return new Date(NaN);const n=t.endsWith("Z"),r=/[+-]\d{2}:?\d{2}$/.test(t),a=/\([A-Z]{3,4}\)$/.test(t);if(e==="auto")return n||r||a?new Date(t):new Date(t+"Z");if(e==="local"){if(n||r){const i=t.replace(/Z$/,"").replace(/[+-]\d{2}:?\d{2}$/,"");return new Date(i)}return new Date(t)}else return e==="UTC"?n?new Date(t):r?new Date(t):new Date(t+"Z"):n||r||a?new Date(t):We(t,e)}const Sn="MM/dd/yyyy",Wn=(t,e,n,r="auto")=>{if(!t)return"";try{const a=J(t,r);if(isNaN(a.getTime()))return t;const c=(e&&e.trim()?e:Sn).replace(/LLLL/g,"MMMM").replace(/LLL/g,"MMM");return n&&n!=="auto"?Se(a,n,c):j(a,c)}catch(a){return console.error("Date formatting error:",a),t}},kn=(t,e="auto")=>{if(!t)return"";try{const n=J(t,e);return isNaN(n.getTime())?t:be(n,{addSuffix:!0})}catch(n){return console.error("Relative time formatting error:",n),t}};exports.constructFrom=x;exports.format=j;exports.formatCurrency=ke;exports.formatDate=Wn;exports.formatDistanceToNow=be;exports.formatInTimeZone=Se;exports.formatNumber=Q;exports.formatNumberCustom=bn;exports.formatNumberWithColumnSettings=On;exports.formatPercent=ve;exports.formatRelativeTime=kn;exports.formatScientific=V;exports.fromZonedTime=We;exports.getTimezoneAbbreviation=Pn;exports.getTimezoneName=In;exports.millisecondsInHour=mt;exports.millisecondsInMinute=dt;exports.parseWithSourceTimezone=J;exports.resolveTimezone=Yn;exports.toDate=l;exports.toZonedTime=Ie;
|