react-semaphor 0.1.469 → 0.1.470

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.
Files changed (88) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +107 -106
  3. package/dist/brand-studio/index.cjs +1 -1
  4. package/dist/brand-studio/index.js +4 -4
  5. package/dist/briefings/index.cjs +1 -1
  6. package/dist/briefings/index.js +4 -4
  7. package/dist/chunks/{analyze-result-contract-kaCNxjA7.js → analyze-result-contract-B3agc2XU.js} +1 -1
  8. package/dist/chunks/{analyze-result-contract-CMwVg9w2.cjs → analyze-result-contract-OgPk-zGu.cjs} +1 -1
  9. package/dist/chunks/{common-types-tRK8fhXV.cjs → common-types-C1IM7gao.cjs} +1 -1
  10. package/dist/chunks/{common-types-BgI-ymBp.js → common-types-g_1fKJLK.js} +1 -1
  11. package/dist/chunks/{dashboard-briefing-launcher-kKSBCRLE.js → dashboard-briefing-launcher-DEVbQCQE.js} +9 -9
  12. package/dist/chunks/{dashboard-briefing-launcher-BqxcYhO2.cjs → dashboard-briefing-launcher-exfJnSop.cjs} +1 -1
  13. package/dist/chunks/{dashboard-controls-Z8ow3GV6.cjs → dashboard-controls-8D1m_ECN.cjs} +1 -1
  14. package/dist/chunks/{dashboard-controls-DP2rftVR.js → dashboard-controls-DPK-CRWL.js} +9 -9
  15. package/dist/chunks/{dashboard-filter-value-compatibility-Ce7jUVh-.js → dashboard-filter-value-compatibility-BAaqJGjt.js} +77 -77
  16. package/dist/chunks/dashboard-filter-value-compatibility-CYrWe1U6.cjs +1 -0
  17. package/dist/chunks/{dashboard-input-contract-12mPNhCF.cjs → dashboard-input-contract-JFJZgenC.cjs} +1 -1
  18. package/dist/chunks/{dashboard-input-contract-Ciboc347.js → dashboard-input-contract-Vr_3ApfF.js} +1 -1
  19. package/dist/chunks/{dashboard-json-3qT123Xa.js → dashboard-json-DVWLTmIJ.js} +7 -7
  20. package/dist/chunks/{dashboard-json-CPq7IMvR.cjs → dashboard-json-DhKOoHwK.cjs} +1 -1
  21. package/dist/chunks/{edit-dashboard-visual-7eUCTZnx.cjs → edit-dashboard-visual-B6zidwTu.cjs} +1 -1
  22. package/dist/chunks/{edit-dashboard-visual-Clz6LQOX.js → edit-dashboard-visual-CxEC3bPx.js} +12 -12
  23. package/dist/chunks/{editor-action-buttons-WJFWflfs.cjs → editor-action-buttons-B3S00DsB.cjs} +1 -1
  24. package/dist/chunks/{editor-action-buttons-CFbMRQSE.js → editor-action-buttons-HfJ-Bohl.js} +6 -6
  25. package/dist/chunks/{index-CQN-X1jN.cjs → index-B4VxBoJg.cjs} +1 -1
  26. package/dist/chunks/{index-DKaQRhKm.cjs → index-DVBYvkj0.cjs} +40 -40
  27. package/dist/chunks/{index-DO4BESNy.js → index-oVXvCLH-.js} +9 -9
  28. package/dist/chunks/{index-8Cm77joZ.js → index-tsB3LfTQ.js} +8477 -8476
  29. package/dist/chunks/{matrix-result-contract-ClC6Pd_g.js → matrix-result-contract-DoU9diAh.js} +3 -3
  30. package/dist/chunks/{matrix-result-contract-DF-qt0jx.cjs → matrix-result-contract-SrzyG_KQ.cjs} +1 -1
  31. package/dist/chunks/{pivot-header-presentation-OpY8xzdT.js → pivot-header-presentation-BW0Ay7WV.js} +2 -2
  32. package/dist/chunks/{pivot-header-presentation-DyV0iOZ_.cjs → pivot-header-presentation-DVBTHug2.cjs} +1 -1
  33. package/dist/chunks/{pivot-result-identity-CCMpd8ZA.js → pivot-result-identity-5v4hRVbc.js} +1 -1
  34. package/dist/chunks/{pivot-result-identity-gsOwOjHi.cjs → pivot-result-identity-DRUlTWUq.cjs} +1 -1
  35. package/dist/chunks/{pivot-result-lifecycle-CEfU43GZ.cjs → pivot-result-lifecycle-DJgO2P0H.cjs} +1 -1
  36. package/dist/chunks/{pivot-result-lifecycle-B38AZx4a.js → pivot-result-lifecycle-O_roVguV.js} +7 -7
  37. package/dist/chunks/{raw-temporal-contract-r_EMdR85.js → raw-temporal-contract-BEMf3avg.js} +1 -1
  38. package/dist/chunks/{raw-temporal-contract-UdblxoVB.cjs → raw-temporal-contract-D8YuxTAg.cjs} +1 -1
  39. package/dist/chunks/{report-preferences-dialog-D-NDYRrk.js → report-preferences-dialog-D-VpoQJz.js} +6 -6
  40. package/dist/chunks/{report-preferences-dialog-C5UOCTwt.cjs → report-preferences-dialog-DvNWNrlj.cjs} +1 -1
  41. package/dist/chunks/{report-runtime-context-CcXUjpb-.js → report-runtime-context-DnNbpkGo.js} +1 -1
  42. package/dist/chunks/{report-runtime-context-CLtzrZdC.cjs → report-runtime-context-RFiWq4wK.cjs} +1 -1
  43. package/dist/chunks/{saved-temporal-bucket-format-hylaofsQ.js → saved-temporal-bucket-format-CygnBDO2.js} +24 -24
  44. package/dist/chunks/{saved-temporal-bucket-format-Ca4hUfTo.cjs → saved-temporal-bucket-format-DNMtD77o.cjs} +1 -1
  45. package/dist/chunks/{switch-BagpmPNw.js → switch-DnbD-yCM.js} +233 -233
  46. package/dist/chunks/{switch-DyE2_OmQ.cjs → switch-NAbuOQNg.cjs} +1 -1
  47. package/dist/chunks/{temporal-bucket-BDRcWdVv.cjs → temporal-bucket-9Wz9Ds6H.cjs} +1 -1
  48. package/dist/chunks/{temporal-bucket-Cc9fmx8s.js → temporal-bucket-CUKJktCl.js} +1 -1
  49. package/dist/chunks/{temporal-bucket-authoring-DjPFtRSF.js → temporal-bucket-authoring-CZoJV2L6.js} +3 -3
  50. package/dist/chunks/{temporal-bucket-authoring-C6sZAVqS.cjs → temporal-bucket-authoring-DSpzgXHc.cjs} +1 -1
  51. package/dist/chunks/{temporal-bucket-contract-vrOkax-r.cjs → temporal-bucket-contract-BD862TAa.cjs} +1 -1
  52. package/dist/chunks/{temporal-bucket-contract-DT4kU0VY.js → temporal-bucket-contract-Cno9TlYr.js} +1 -1
  53. package/dist/chunks/{token-types-DALtlgbG.cjs → token-types-CoHsSJ4E.cjs} +1 -1
  54. package/dist/chunks/{token-types-Z889rD6g.js → token-types-W3EHNW-D.js} +1 -1
  55. package/dist/chunks/{update-policy-Cyufdviq.cjs → update-policy-BGNXFgBU.cjs} +1 -1
  56. package/dist/chunks/{update-policy-Bu5Tw43R.js → update-policy-kRNJwwUV.js} +1 -1
  57. package/dist/chunks/{validators-DhTaCK1O.js → validators-B5t1s8oh.js} +274 -266
  58. package/dist/chunks/validators-DcshgK7w.cjs +1 -0
  59. package/dist/dashboard/index.cjs +1 -1
  60. package/dist/dashboard/index.js +2 -2
  61. package/dist/dashboard-authoring/index.cjs +1 -1
  62. package/dist/dashboard-authoring/index.js +4 -4
  63. package/dist/data-app-builder/index.cjs +1 -1
  64. package/dist/data-app-builder/index.js +2 -2
  65. package/dist/data-app-codegen/index.cjs +1 -1
  66. package/dist/data-app-codegen/index.js +2 -2
  67. package/dist/data-app-codegen-node/index.cjs +1 -1
  68. package/dist/data-app-codegen-node/index.js +3 -3
  69. package/dist/data-app-sdk/index.cjs +1 -1
  70. package/dist/data-app-sdk/index.js +3 -3
  71. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  72. package/dist/data-app-sdk-adapters/index.js +2 -2
  73. package/dist/data-app-sdk-validation/index.cjs +1 -1
  74. package/dist/data-app-sdk-validation/index.js +3 -3
  75. package/dist/format-utils/index.cjs +1 -1
  76. package/dist/format-utils/index.js +12 -12
  77. package/dist/index.cjs +1 -1
  78. package/dist/index.js +14 -14
  79. package/dist/report-runtime-context/index.cjs +1 -1
  80. package/dist/report-runtime-context/index.js +2 -2
  81. package/dist/surfboard/index.cjs +1 -1
  82. package/dist/surfboard/index.js +3 -3
  83. package/dist/types/analytics-protocol.d.ts +13 -0
  84. package/dist/types/index.cjs +1 -1
  85. package/dist/types/index.js +4 -4
  86. package/package.json +1 -1
  87. package/dist/chunks/dashboard-filter-value-compatibility-iCPBcrRS.cjs +0 -1
  88. package/dist/chunks/validators-DO-YuzgO.cjs +0 -1
@@ -1 +1 @@
1
- "use strict";const e=require("react/jsx-runtime"),o=require("react"),l=require("./index-DKaQRhKm.cjs"),u=require("./switch-DyE2_OmQ.cjs"),V=require("./report-runtime-context-CLtzrZdC.cjs");require("./x-B6ghREd2.cjs");require("./saved-temporal-bucket-format-Ca4hUfTo.cjs");require("./validators-DO-YuzgO.cjs");require("./analyze-result-contract-CMwVg9w2.cjs");const L=require("../value-format-preferences/index.cjs");function G(a={}){const{authToken:c,tokenProps:t}=l.useSemaphorContext(),m=u.useDashboardStore(p=>p.actions.applyResolvedCalendarPreferences),s=a.enabled??!0,i=(c==null?void 0:c.accessToken)??null,h=(t==null?void 0:t.apiServiceUrl)??null,[g,S]=o.useState(!1),[b,C]=o.useState(!1),[f,j]=o.useState(!1),[T,x]=o.useState(null),[w,P]=o.useState(null),v=o.useRef(i);v.current=i,o.useEffect(()=>{P(null),x(null),S(!1),C(!1),j(!1)},[i]);const N=o.useCallback(async p=>{const r=V.parseCalendarPreferencesResponse(await p.json());if(!r.ok)throw new Error("Calendar preferences response is invalid");return r.value},[]),k=o.useCallback(async()=>{if(!s||!i||!h)return;const p=i;S(!0),x(null);try{const r=await fetch(`${h}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${i}`}});if(!r.ok){const y=await r.json().catch(()=>({}));throw new Error(y.error||"Failed to fetch preferences")}const n=await N(r);v.current===p&&P(n)}catch(r){v.current===p&&x(r instanceof Error?r.message:"Unknown error")}finally{v.current===p&&S(!1)}},[i,h,s,N]);o.useEffect(()=>{s&&k()},[s,k]);const E=o.useCallback(async p=>{if(!i||!h)return x("Not authenticated"),!1;const r=i;C(!0),x(null);try{const n=await fetch(`${h}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:JSON.stringify(p)});if(!n.ok){const D=await n.json().catch(()=>({}));throw new Error(D.error||"Failed to update preferences")}const y=await N(n);return v.current!==r?!1:(P(y),m(y.resolved,y.sources),!0)}catch(n){return v.current===r&&x(n instanceof Error?n.message:"Unknown error"),!1}finally{v.current===r&&C(!1)}},[i,h,m,N]),A=o.useCallback(async()=>{if(!i||!h)return x("Not authenticated"),!1;const p=i;j(!0),x(null);try{const r=await fetch(`${h}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${i}`}});if(!r.ok){const y=await r.json().catch(()=>({}));throw new Error(y.error||"Failed to clear preferences")}const n=await N(r);return v.current!==p?!1:(P(n),m(n.resolved,n.sources),!0)}catch(r){return v.current===p&&x(r instanceof Error?r.message:"Unknown error"),!1}finally{v.current===p&&j(!1)}},[i,h,m,N]);return{preferences:w,isLoading:g,isSaving:b,isClearing:f,error:T,updatePreferences:E,clearPreferences:A,refetch:k}}const F=[{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"}],B=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}],R="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function W(){try{const a=Intl;if(a.supportedValuesOf)return a.supportedValuesOf("timeZone")}catch{}return F.map(a=>a.value)}function H(a){if(!a)return"default";if(a.tz!==a.weekStart)return"inherited";switch(a.tz){case"viewer_tenant":return"tenant";case"viewer_organization":return"organization";case"system_default":return"system";case"session_initial":return"embedded";default:return"default"}}function U(a){const c=F.find(t=>t.value===a);return c?c.label:a}function K(a){const c=B.find(t=>t.value===a);return c?c.label:String(a)}function J({active:a,onClose:c}){const{preferences:t,isLoading:m,isSaving:s,isClearing:i,updatePreferences:h,clearPreferences:g}=G({enabled:a}),S=l.useCalendarContext(),b=(t==null?void 0:t.resolved.tz)||(S==null?void 0:S.tz)||"UTC",C=(t==null?void 0:t.resolved.weekStart)??(S==null?void 0:S.weekStart)??1,[f,j]=o.useState((t==null?void 0:t.stored)===null),[T,x]=o.useState(!1),[w,P]=o.useState(b),[v,N]=o.useState(C),[k,E]=o.useState(!1),A=o.useMemo(()=>W(),[]),p=o.useMemo(()=>A.filter(d=>!F.some(M=>M.value===d)),[A]),r=o.useMemo(()=>U(w),[w]),n=t!=null&&t.inherited?U(t.inherited.tz):"UTC",y=t!=null&&t.inherited?K(t.inherited.weekStart):"Monday",D=H(t==null?void 0:t.inheritedSources);o.useEffect(()=>{if(!a){x(!1);return}T||(t&&j(t.stored===null),P(b),N(C))},[a,T,t,b,C]);const O=async()=>{if(m){l.ue.error("Preferences are still loading. Please try again.");return}f?await g()?(l.ue.success("Now using default settings."),c()):l.ue.error("Failed to save preferences. Please try again."):await h({tz:w,weekStart:v})?(l.ue.success("Preferences saved."),c()):l.ue.error("Failed to save preferences. Please try again.")},_=()=>{c()},z=s||i,$=z||m;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4 py-1",children:[e.jsxs(l.RadioGroup,{value:f?"defaults":"custom",onValueChange:d=>{x(!0),j(d==="defaults")},className:"space-y-0.5",children:[e.jsxs("label",{htmlFor:"mode-defaults",className:u.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",f&&"bg-muted/50"),onClick:()=>{x(!0),j(!0)},children:[e.jsx(l.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 ",D," defaults"]}),e.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[n,", week starts ",y]})]})]}),e.jsxs("label",{htmlFor:"mode-custom",className:u.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",!f&&"bg-muted/50"),onClick:()=>{x(!0),j(!1)},children:[e.jsx(l.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:u.cn("space-y-4 border-t border-border/60 pt-4 transition-opacity",f&&"pointer-events-none opacity-50"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(u.Label,{className:R,children:"Timezone"}),e.jsxs(u.Popover,{open:k,onOpenChange:E,modal:!0,children:[e.jsx(u.PopoverTrigger,{asChild:!0,children:e.jsxs(u.Button,{variant:"outline",size:"xs",role:"combobox","aria-expanded":k,className:"w-full justify-between text-[12px] font-normal",disabled:f,children:[e.jsx("span",{className:"truncate",children:r}),e.jsx(l.ChevronsUpDown,{className:"ml-2 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),e.jsx(u.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(l.Command,{className:"overflow-visible",children:[e.jsx(l.CommandInput,{placeholder:"Search timezones…"}),e.jsxs(l.CommandList,{children:[e.jsx(l.CommandEmpty,{children:"No timezone found."}),e.jsx(l.CommandGroup,{heading:"Common",children:F.map(d=>e.jsxs(l.CommandItem,{value:`${d.value} ${d.label}`,onSelect:()=>{x(!0),P(d.value),E(!1)},children:[e.jsx(u.Check,{className:u.cn("h-3.5 w-3.5",w===d.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:d.label}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:d.value})]},d.value))}),e.jsx(l.CommandSeparator,{}),e.jsx(l.CommandGroup,{heading:"All timezones",children:p.map(d=>e.jsxs(l.CommandItem,{value:d,onSelect:()=>{x(!0),P(d),E(!1)},children:[e.jsx(u.Check,{className:u.cn("h-3.5 w-3.5",w===d?"opacity-100":"opacity-0")}),d]},d))})]})]})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(u.Label,{className:R,children:"Week starts on"}),e.jsx(l.RadioGroup,{value:String(v),onValueChange:d=>{x(!0),N(Number(d))},className:"flex gap-4",disabled:f,children:B.map(d=>e.jsxs("label",{htmlFor:`week-start-${d.value}`,className:u.cn("flex cursor-pointer items-center gap-2 text-[13px]",f&&"cursor-not-allowed"),children:[e.jsx(l.RadioGroupItem,{value:String(d.value),id:`week-start-${d.value}`,disabled:f}),d.label]},d.value))})]})]})]}),e.jsxs(l.DialogFooter,{children:[e.jsx(u.Button,{variant:"outline",size:"xs",onClick:_,disabled:z,children:"Cancel"}),e.jsx(u.Button,{size:"xs",onClick:O,disabled:$,children:z?e.jsxs(e.Fragment,{children:[e.jsx(u.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})}function Y(a={}){const{authToken:c,tokenProps:t}=l.useSemaphorContext(),m=u.useDashboardStore(r=>r.actions.applyResolvedValueFormatPreferences),s=a.enabled??!0,i=(c==null?void 0:c.accessToken)??null,h=(t==null?void 0:t.apiServiceUrl)??null,g=o.useRef(i);g.current=i;const[S,b]=o.useState(null),[C,f]=o.useState(!1),[j,T]=o.useState(!1),[x,w]=o.useState(!1),[P,v]=o.useState(null);o.useEffect(()=>{b(null),v(null),f(!1),T(!1),w(!1)},[i]);const N=o.useCallback(async r=>{const n=L.parseValueFormatPreferencesResponse(await r.json());if(!n.ok)throw new Error("Value format preferences response is invalid");return n.value},[]),k=o.useCallback(async(r,n)=>{if(!i||!h)throw new Error("Not authenticated");const y=await fetch(`${h}/v1/user-preferences/value-format`,{method:r,headers:{Authorization:`Bearer ${i}`,...n?{"Content-Type":"application/json"}:{}},body:n?JSON.stringify(n):void 0});if(!y.ok){const D=await y.json().catch(()=>({}));throw new Error(D.error||"Failed to update preferences")}return N(y)},[i,h,N]),E=o.useCallback(async()=>{if(!s||!i||!h)return;const r=i;f(!0),v(null);try{const n=await k("GET");g.current===r&&b(n)}catch(n){g.current===r&&v(n instanceof Error?n.message:"Unknown error")}finally{g.current===r&&f(!1)}},[i,h,s,k]);o.useEffect(()=>{s&&E()},[s,E]);const A=o.useCallback(async r=>{const n=i;T(!0),v(null);try{const y=await k("PATCH",r);return g.current!==n?!1:(b(y),m(y.resolved,y.sources),!0)}catch(y){return g.current===n&&v(y instanceof Error?y.message:"Unknown error"),!1}finally{g.current===n&&T(!1)}},[i,m,k]),p=o.useCallback(async()=>{const r=i;w(!0),v(null);try{const n=await k("DELETE");return g.current!==r?!1:(b(n),m(n.resolved,n.sources),!0)}catch(n){return g.current===r&&v(n instanceof Error?n.message:"Unknown error"),!1}finally{g.current===r&&w(!1)}},[i,m,k]);return{preferences:S,isLoading:C,isSaving:j,isClearing:x,error:P,updatePreferences:A,clearPreferences:p,refetch:E}}const I=["locale","dateStyle","dateTime.dateStyle","dateTime.timeStyle","defaultCurrency"];function q(a,c){var t,m;switch(c){case"locale":return a==null?void 0:a.locale;case"dateStyle":return a==null?void 0:a.dateStyle;case"dateTime.dateStyle":return(t=a==null?void 0:a.dateTime)==null?void 0:t.dateStyle;case"dateTime.timeStyle":return(m=a==null?void 0:a.dateTime)==null?void 0:m.timeStyle;case"defaultCurrency":return a==null?void 0:a.defaultCurrency}}function Z(a){var m,s;const c=(m=a==null?void 0:a.dateTime)==null?void 0:m.dateStyle,t=(s=a==null?void 0:a.dateTime)==null?void 0:s.timeStyle;return{locale:a==null?void 0:a.locale,dateStyle:a==null?void 0:a.dateStyle,dateTime:c===void 0&&t===void 0?void 0:{dateStyle:c,timeStyle:t},defaultCurrency:a==null?void 0:a.defaultCurrency}}function Q({active:a,onClose:c}){var g,S,b,C,f,j,T;const{preferences:t,isLoading:m,isSaving:s,updatePreferences:i}=Y({enabled:a});if(!a)return null;if(!t)return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx("div",{className:"flex min-h-36 items-center justify-center text-[12px] text-muted-foreground",children:m?"Loading preferences…":"Preferences unavailable."})}),e.jsxs(l.DialogFooter,{className:"justify-between sm:justify-between",children:[e.jsx(u.Button,{variant:"ghost",size:"xs",disabled:!0,children:"Reset display formats"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(u.Button,{variant:"outline",size:"xs",onClick:c,children:"Cancel"}),e.jsx(u.Button,{size:"xs",disabled:!0,children:"Save"})]})]})]});const h=[((g=t.stored)==null?void 0:g.locale)??"",((S=t.stored)==null?void 0:S.dateStyle)??"",((C=(b=t.stored)==null?void 0:b.dateTime)==null?void 0:C.dateStyle)??"",((j=(f=t.stored)==null?void 0:f.dateTime)==null?void 0:j.timeStyle)??"",((T=t.stored)==null?void 0:T.defaultCurrency)??""].join(":");return e.jsx(X,{preferences:t,isSaving:s,updatePreferences:i,onClose:c},h)}function X({preferences:a,isSaving:c,updatePreferences:t,onClose:m}){var b,C;const[s,i]=o.useState(()=>Z(a.stored)),h=(s.locale===void 0||L.canonicalizeSupportedLocale(s.locale)!==void 0)&&(s.defaultCurrency===void 0||L.canonicalizeSupportedCurrencyCode(s.defaultCurrency)!==void 0)&&(s.dateStyle===void 0||["short","medium","long"].includes(s.dateStyle))&&(((b=s.dateTime)==null?void 0:b.dateStyle)===void 0||["short","medium","long"].includes(s.dateTime.dateStyle))&&(((C=s.dateTime)==null?void 0:C.timeStyle)===void 0||["short","medium","long"].includes(s.dateTime.timeStyle)),g=async()=>{const f={...s.locale!==void 0?{locale:s.locale}:{},...s.dateStyle!==void 0?{dateStyle:s.dateStyle}:{},...s.dateTime?{dateTime:{...s.dateTime}}:{},...s.defaultCurrency!==void 0?{defaultCurrency:s.defaultCurrency}:{}},j=I.filter(w=>q(s,w)===void 0&&q(a.stored,w)!==void 0),T={...Object.keys(f).length>0?{set:f}:{},...j.length>0?{clear:j}:{}};(Object.keys(T).length===0?!0:await t(T))?(l.ue.success("Display format preferences saved."),m()):l.ue.error("Failed to save preferences. Please try again.")},S=async()=>{await t({clear:[...I]})?(l.ue.success("Display format preferences reset."),m()):l.ue.error("Failed to reset display format preferences. Please try again.")};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx(l.DisplayFormatPreferencesFields,{value:s,inherited:a.inherited,inheritedSources:a.inheritedSources,onChange:i,disabled:c})}),e.jsxs(l.DialogFooter,{className:"justify-between sm:justify-between",children:[e.jsx(u.Button,{variant:"ghost",size:"xs",onClick:S,disabled:c||a.stored===null,children:"Reset display formats"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(u.Button,{variant:"outline",size:"xs",onClick:m,disabled:c,children:"Cancel"}),e.jsx(u.Button,{size:"xs",onClick:g,disabled:c||!h,children:c?e.jsxs(e.Fragment,{children:[e.jsx(u.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})]})}function ee({open:a,onOpenChange:c}){const[t,m]=o.useState("display"),s=()=>c(!1);return e.jsx(l.Dialog,{open:a,onOpenChange:c,children:e.jsxs(l.DialogContent,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[e.jsxs(l.DialogHeader,{children:[e.jsx(l.DialogTitle,{className:"text-[15px]",children:"Report preferences"}),e.jsx(l.DialogDescription,{className:"text-[13px] leading-5",children:"Set how values and Calendar periods appear for you."})]}),e.jsxs(u.Tabs,{value:t,onValueChange:m,children:[e.jsxs(u.TabsList,{variant:"underline",className:"w-full justify-start",children:[e.jsx(u.TabsTrigger,{value:"display",children:"Display formats"}),e.jsx(u.TabsTrigger,{value:"calendar",children:"Calendar"})]}),e.jsx(u.TabsContent,{value:"display",children:e.jsx(Q,{active:a&&t==="display",onClose:s})}),e.jsx(u.TabsContent,{value:"calendar",children:e.jsx(J,{active:a&&t==="calendar",onClose:s})})]})]})})}exports.ReportPreferencesDialog=ee;
1
+ "use strict";const e=require("react/jsx-runtime"),o=require("react"),l=require("./index-DVBYvkj0.cjs"),u=require("./switch-NAbuOQNg.cjs"),V=require("./report-runtime-context-RFiWq4wK.cjs");require("./x-B6ghREd2.cjs");require("./saved-temporal-bucket-format-DNMtD77o.cjs");require("./validators-DcshgK7w.cjs");require("./analyze-result-contract-OgPk-zGu.cjs");const L=require("../value-format-preferences/index.cjs");function G(a={}){const{authToken:c,tokenProps:t}=l.useSemaphorContext(),m=u.useDashboardStore(p=>p.actions.applyResolvedCalendarPreferences),s=a.enabled??!0,i=(c==null?void 0:c.accessToken)??null,h=(t==null?void 0:t.apiServiceUrl)??null,[g,S]=o.useState(!1),[b,C]=o.useState(!1),[f,j]=o.useState(!1),[T,x]=o.useState(null),[w,P]=o.useState(null),v=o.useRef(i);v.current=i,o.useEffect(()=>{P(null),x(null),S(!1),C(!1),j(!1)},[i]);const N=o.useCallback(async p=>{const r=V.parseCalendarPreferencesResponse(await p.json());if(!r.ok)throw new Error("Calendar preferences response is invalid");return r.value},[]),k=o.useCallback(async()=>{if(!s||!i||!h)return;const p=i;S(!0),x(null);try{const r=await fetch(`${h}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${i}`}});if(!r.ok){const y=await r.json().catch(()=>({}));throw new Error(y.error||"Failed to fetch preferences")}const n=await N(r);v.current===p&&P(n)}catch(r){v.current===p&&x(r instanceof Error?r.message:"Unknown error")}finally{v.current===p&&S(!1)}},[i,h,s,N]);o.useEffect(()=>{s&&k()},[s,k]);const E=o.useCallback(async p=>{if(!i||!h)return x("Not authenticated"),!1;const r=i;C(!0),x(null);try{const n=await fetch(`${h}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`},body:JSON.stringify(p)});if(!n.ok){const D=await n.json().catch(()=>({}));throw new Error(D.error||"Failed to update preferences")}const y=await N(n);return v.current!==r?!1:(P(y),m(y.resolved,y.sources),!0)}catch(n){return v.current===r&&x(n instanceof Error?n.message:"Unknown error"),!1}finally{v.current===r&&C(!1)}},[i,h,m,N]),A=o.useCallback(async()=>{if(!i||!h)return x("Not authenticated"),!1;const p=i;j(!0),x(null);try{const r=await fetch(`${h}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${i}`}});if(!r.ok){const y=await r.json().catch(()=>({}));throw new Error(y.error||"Failed to clear preferences")}const n=await N(r);return v.current!==p?!1:(P(n),m(n.resolved,n.sources),!0)}catch(r){return v.current===p&&x(r instanceof Error?r.message:"Unknown error"),!1}finally{v.current===p&&j(!1)}},[i,h,m,N]);return{preferences:w,isLoading:g,isSaving:b,isClearing:f,error:T,updatePreferences:E,clearPreferences:A,refetch:k}}const F=[{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"}],B=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}],R="text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";function W(){try{const a=Intl;if(a.supportedValuesOf)return a.supportedValuesOf("timeZone")}catch{}return F.map(a=>a.value)}function H(a){if(!a)return"default";if(a.tz!==a.weekStart)return"inherited";switch(a.tz){case"viewer_tenant":return"tenant";case"viewer_organization":return"organization";case"system_default":return"system";case"session_initial":return"embedded";default:return"default"}}function U(a){const c=F.find(t=>t.value===a);return c?c.label:a}function K(a){const c=B.find(t=>t.value===a);return c?c.label:String(a)}function J({active:a,onClose:c}){const{preferences:t,isLoading:m,isSaving:s,isClearing:i,updatePreferences:h,clearPreferences:g}=G({enabled:a}),S=l.useCalendarContext(),b=(t==null?void 0:t.resolved.tz)||(S==null?void 0:S.tz)||"UTC",C=(t==null?void 0:t.resolved.weekStart)??(S==null?void 0:S.weekStart)??1,[f,j]=o.useState((t==null?void 0:t.stored)===null),[T,x]=o.useState(!1),[w,P]=o.useState(b),[v,N]=o.useState(C),[k,E]=o.useState(!1),A=o.useMemo(()=>W(),[]),p=o.useMemo(()=>A.filter(d=>!F.some(M=>M.value===d)),[A]),r=o.useMemo(()=>U(w),[w]),n=t!=null&&t.inherited?U(t.inherited.tz):"UTC",y=t!=null&&t.inherited?K(t.inherited.weekStart):"Monday",D=H(t==null?void 0:t.inheritedSources);o.useEffect(()=>{if(!a){x(!1);return}T||(t&&j(t.stored===null),P(b),N(C))},[a,T,t,b,C]);const O=async()=>{if(m){l.ue.error("Preferences are still loading. Please try again.");return}f?await g()?(l.ue.success("Now using default settings."),c()):l.ue.error("Failed to save preferences. Please try again."):await h({tz:w,weekStart:v})?(l.ue.success("Preferences saved."),c()):l.ue.error("Failed to save preferences. Please try again.")},_=()=>{c()},z=s||i,$=z||m;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4 py-1",children:[e.jsxs(l.RadioGroup,{value:f?"defaults":"custom",onValueChange:d=>{x(!0),j(d==="defaults")},className:"space-y-0.5",children:[e.jsxs("label",{htmlFor:"mode-defaults",className:u.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",f&&"bg-muted/50"),onClick:()=>{x(!0),j(!0)},children:[e.jsx(l.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 ",D," defaults"]}),e.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[n,", week starts ",y]})]})]}),e.jsxs("label",{htmlFor:"mode-custom",className:u.cn("flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",!f&&"bg-muted/50"),onClick:()=>{x(!0),j(!1)},children:[e.jsx(l.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:u.cn("space-y-4 border-t border-border/60 pt-4 transition-opacity",f&&"pointer-events-none opacity-50"),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(u.Label,{className:R,children:"Timezone"}),e.jsxs(u.Popover,{open:k,onOpenChange:E,modal:!0,children:[e.jsx(u.PopoverTrigger,{asChild:!0,children:e.jsxs(u.Button,{variant:"outline",size:"xs",role:"combobox","aria-expanded":k,className:"w-full justify-between text-[12px] font-normal",disabled:f,children:[e.jsx("span",{className:"truncate",children:r}),e.jsx(l.ChevronsUpDown,{className:"ml-2 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),e.jsx(u.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(l.Command,{className:"overflow-visible",children:[e.jsx(l.CommandInput,{placeholder:"Search timezones…"}),e.jsxs(l.CommandList,{children:[e.jsx(l.CommandEmpty,{children:"No timezone found."}),e.jsx(l.CommandGroup,{heading:"Common",children:F.map(d=>e.jsxs(l.CommandItem,{value:`${d.value} ${d.label}`,onSelect:()=>{x(!0),P(d.value),E(!1)},children:[e.jsx(u.Check,{className:u.cn("h-3.5 w-3.5",w===d.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:d.label}),e.jsx("span",{className:"text-[11px] text-muted-foreground",children:d.value})]},d.value))}),e.jsx(l.CommandSeparator,{}),e.jsx(l.CommandGroup,{heading:"All timezones",children:p.map(d=>e.jsxs(l.CommandItem,{value:d,onSelect:()=>{x(!0),P(d),E(!1)},children:[e.jsx(u.Check,{className:u.cn("h-3.5 w-3.5",w===d?"opacity-100":"opacity-0")}),d]},d))})]})]})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(u.Label,{className:R,children:"Week starts on"}),e.jsx(l.RadioGroup,{value:String(v),onValueChange:d=>{x(!0),N(Number(d))},className:"flex gap-4",disabled:f,children:B.map(d=>e.jsxs("label",{htmlFor:`week-start-${d.value}`,className:u.cn("flex cursor-pointer items-center gap-2 text-[13px]",f&&"cursor-not-allowed"),children:[e.jsx(l.RadioGroupItem,{value:String(d.value),id:`week-start-${d.value}`,disabled:f}),d.label]},d.value))})]})]})]}),e.jsxs(l.DialogFooter,{children:[e.jsx(u.Button,{variant:"outline",size:"xs",onClick:_,disabled:z,children:"Cancel"}),e.jsx(u.Button,{size:"xs",onClick:O,disabled:$,children:z?e.jsxs(e.Fragment,{children:[e.jsx(u.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})}function Y(a={}){const{authToken:c,tokenProps:t}=l.useSemaphorContext(),m=u.useDashboardStore(r=>r.actions.applyResolvedValueFormatPreferences),s=a.enabled??!0,i=(c==null?void 0:c.accessToken)??null,h=(t==null?void 0:t.apiServiceUrl)??null,g=o.useRef(i);g.current=i;const[S,b]=o.useState(null),[C,f]=o.useState(!1),[j,T]=o.useState(!1),[x,w]=o.useState(!1),[P,v]=o.useState(null);o.useEffect(()=>{b(null),v(null),f(!1),T(!1),w(!1)},[i]);const N=o.useCallback(async r=>{const n=L.parseValueFormatPreferencesResponse(await r.json());if(!n.ok)throw new Error("Value format preferences response is invalid");return n.value},[]),k=o.useCallback(async(r,n)=>{if(!i||!h)throw new Error("Not authenticated");const y=await fetch(`${h}/v1/user-preferences/value-format`,{method:r,headers:{Authorization:`Bearer ${i}`,...n?{"Content-Type":"application/json"}:{}},body:n?JSON.stringify(n):void 0});if(!y.ok){const D=await y.json().catch(()=>({}));throw new Error(D.error||"Failed to update preferences")}return N(y)},[i,h,N]),E=o.useCallback(async()=>{if(!s||!i||!h)return;const r=i;f(!0),v(null);try{const n=await k("GET");g.current===r&&b(n)}catch(n){g.current===r&&v(n instanceof Error?n.message:"Unknown error")}finally{g.current===r&&f(!1)}},[i,h,s,k]);o.useEffect(()=>{s&&E()},[s,E]);const A=o.useCallback(async r=>{const n=i;T(!0),v(null);try{const y=await k("PATCH",r);return g.current!==n?!1:(b(y),m(y.resolved,y.sources),!0)}catch(y){return g.current===n&&v(y instanceof Error?y.message:"Unknown error"),!1}finally{g.current===n&&T(!1)}},[i,m,k]),p=o.useCallback(async()=>{const r=i;w(!0),v(null);try{const n=await k("DELETE");return g.current!==r?!1:(b(n),m(n.resolved,n.sources),!0)}catch(n){return g.current===r&&v(n instanceof Error?n.message:"Unknown error"),!1}finally{g.current===r&&w(!1)}},[i,m,k]);return{preferences:S,isLoading:C,isSaving:j,isClearing:x,error:P,updatePreferences:A,clearPreferences:p,refetch:E}}const I=["locale","dateStyle","dateTime.dateStyle","dateTime.timeStyle","defaultCurrency"];function q(a,c){var t,m;switch(c){case"locale":return a==null?void 0:a.locale;case"dateStyle":return a==null?void 0:a.dateStyle;case"dateTime.dateStyle":return(t=a==null?void 0:a.dateTime)==null?void 0:t.dateStyle;case"dateTime.timeStyle":return(m=a==null?void 0:a.dateTime)==null?void 0:m.timeStyle;case"defaultCurrency":return a==null?void 0:a.defaultCurrency}}function Z(a){var m,s;const c=(m=a==null?void 0:a.dateTime)==null?void 0:m.dateStyle,t=(s=a==null?void 0:a.dateTime)==null?void 0:s.timeStyle;return{locale:a==null?void 0:a.locale,dateStyle:a==null?void 0:a.dateStyle,dateTime:c===void 0&&t===void 0?void 0:{dateStyle:c,timeStyle:t},defaultCurrency:a==null?void 0:a.defaultCurrency}}function Q({active:a,onClose:c}){var g,S,b,C,f,j,T;const{preferences:t,isLoading:m,isSaving:s,updatePreferences:i}=Y({enabled:a});if(!a)return null;if(!t)return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx("div",{className:"flex min-h-36 items-center justify-center text-[12px] text-muted-foreground",children:m?"Loading preferences…":"Preferences unavailable."})}),e.jsxs(l.DialogFooter,{className:"justify-between sm:justify-between",children:[e.jsx(u.Button,{variant:"ghost",size:"xs",disabled:!0,children:"Reset display formats"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(u.Button,{variant:"outline",size:"xs",onClick:c,children:"Cancel"}),e.jsx(u.Button,{size:"xs",disabled:!0,children:"Save"})]})]})]});const h=[((g=t.stored)==null?void 0:g.locale)??"",((S=t.stored)==null?void 0:S.dateStyle)??"",((C=(b=t.stored)==null?void 0:b.dateTime)==null?void 0:C.dateStyle)??"",((j=(f=t.stored)==null?void 0:f.dateTime)==null?void 0:j.timeStyle)??"",((T=t.stored)==null?void 0:T.defaultCurrency)??""].join(":");return e.jsx(X,{preferences:t,isSaving:s,updatePreferences:i,onClose:c},h)}function X({preferences:a,isSaving:c,updatePreferences:t,onClose:m}){var b,C;const[s,i]=o.useState(()=>Z(a.stored)),h=(s.locale===void 0||L.canonicalizeSupportedLocale(s.locale)!==void 0)&&(s.defaultCurrency===void 0||L.canonicalizeSupportedCurrencyCode(s.defaultCurrency)!==void 0)&&(s.dateStyle===void 0||["short","medium","long"].includes(s.dateStyle))&&(((b=s.dateTime)==null?void 0:b.dateStyle)===void 0||["short","medium","long"].includes(s.dateTime.dateStyle))&&(((C=s.dateTime)==null?void 0:C.timeStyle)===void 0||["short","medium","long"].includes(s.dateTime.timeStyle)),g=async()=>{const f={...s.locale!==void 0?{locale:s.locale}:{},...s.dateStyle!==void 0?{dateStyle:s.dateStyle}:{},...s.dateTime?{dateTime:{...s.dateTime}}:{},...s.defaultCurrency!==void 0?{defaultCurrency:s.defaultCurrency}:{}},j=I.filter(w=>q(s,w)===void 0&&q(a.stored,w)!==void 0),T={...Object.keys(f).length>0?{set:f}:{},...j.length>0?{clear:j}:{}};(Object.keys(T).length===0?!0:await t(T))?(l.ue.success("Display format preferences saved."),m()):l.ue.error("Failed to save preferences. Please try again.")},S=async()=>{await t({clear:[...I]})?(l.ue.success("Display format preferences reset."),m()):l.ue.error("Failed to reset display format preferences. Please try again.")};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"py-2",children:e.jsx(l.DisplayFormatPreferencesFields,{value:s,inherited:a.inherited,inheritedSources:a.inheritedSources,onChange:i,disabled:c})}),e.jsxs(l.DialogFooter,{className:"justify-between sm:justify-between",children:[e.jsx(u.Button,{variant:"ghost",size:"xs",onClick:S,disabled:c||a.stored===null,children:"Reset display formats"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(u.Button,{variant:"outline",size:"xs",onClick:m,disabled:c,children:"Cancel"}),e.jsx(u.Button,{size:"xs",onClick:g,disabled:c||!h,children:c?e.jsxs(e.Fragment,{children:[e.jsx(u.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"Save"})]})]})]})}function ee({open:a,onOpenChange:c}){const[t,m]=o.useState("display"),s=()=>c(!1);return e.jsx(l.Dialog,{open:a,onOpenChange:c,children:e.jsxs(l.DialogContent,{className:"rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control",children:[e.jsxs(l.DialogHeader,{children:[e.jsx(l.DialogTitle,{className:"text-[15px]",children:"Report preferences"}),e.jsx(l.DialogDescription,{className:"text-[13px] leading-5",children:"Set how values and Calendar periods appear for you."})]}),e.jsxs(u.Tabs,{value:t,onValueChange:m,children:[e.jsxs(u.TabsList,{variant:"underline",className:"w-full justify-start",children:[e.jsx(u.TabsTrigger,{value:"display",children:"Display formats"}),e.jsx(u.TabsTrigger,{value:"calendar",children:"Calendar"})]}),e.jsx(u.TabsContent,{value:"display",children:e.jsx(Q,{active:a&&t==="display",onClose:s})}),e.jsx(u.TabsContent,{value:"calendar",children:e.jsx(J,{active:a&&t==="calendar",onClose:s})})]})]})})}exports.ReportPreferencesDialog=ee;
@@ -1,5 +1,5 @@
1
1
  import { parseValueFormatPreferences as _, isReportPreferenceSource as C } from "../value-format-preferences/index.js";
2
- import { b as k, g } from "./validators-DhTaCK1O.js";
2
+ import { b as k, g } from "./validators-B5t1s8oh.js";
3
3
  const M = {
4
4
  tz: "UTC",
5
5
  weekStart: 1,
@@ -1 +1 @@
1
- "use strict";const p=require("../value-format-preferences/index.cjs"),f=require("./validators-DO-YuzgO.cjs"),g={tz:"UTC",weekStart:1,anchor:"now"},b=["tz","weekStart","anchor","fiscalCalendar"],E=["kind","yearStartMonth"],w=["calendar","valueFormat","preferenceSources"],T=["calendar","valueFormat"],y=["tz","weekStart"],F=["stored","inherited","inheritedSources","resolved","sources"],z=["locale","dateStyle","dateTime","defaultCurrency"],R=["dateStyle","timeStyle"];function o(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const a=Object.getPrototypeOf(e);return a===null||Object.getPrototypeOf(a)===null}function n(e,a,r){const t=new Set(a);return Object.keys(e).filter(s=>!t.has(s)).map(s=>({path:r==="$"?s:`${r}.${s}`,code:"unknown_property",message:`Unknown property "${s}"`}))}function _(e){return Number.isInteger(e)&&typeof e=="number"&&e>=0&&e<=6}function d(e,a,r){if(!o(e))return{ok:!1,issues:[{path:a,code:"invalid_type",message:"Calendar preferences must be an object"}]};const t=n(e,["tz","weekStart"],a);return(!r||e.tz!==void 0)&&(typeof e.tz!="string"||!f.isValidIanaTimeZone(e.tz))&&t.push({path:`${a}.tz`,code:"invalid_timezone",message:"tz must be a valid IANA timezone"}),(!r||e.weekStart!==void 0)&&!_(e.weekStart)&&t.push({path:`${a}.weekStart`,code:"invalid_week_start",message:"weekStart must be an integer from 0 to 6"}),t.length?{ok:!1,issues:t}:{ok:!0,value:{...e.tz!==void 0?{tz:e.tz}:{},...e.weekStart!==void 0?{weekStart:e.weekStart}:{}}}}function A(e){if(e==="now")return{ok:!0,value:"now"};if(!o(e))return{ok:!1,issues:[{path:"anchor",code:"invalid_anchor",message:'anchor must be "now" or an object with an ISO timestamp'}]};const a=n(e,["iso"],"anchor"),r=e.iso;return f.parseSemaphorIsoInstant(r)===null&&a.push({path:"anchor.iso",code:"invalid_anchor",message:"anchor.iso must be an ISO timestamp with an explicit offset"}),a.length?{ok:!1,issues:a}:{ok:!0,value:{iso:r}}}function O(e){if(!o(e))return{ok:!1,issues:[{path:"fiscalCalendar",code:"invalid_fiscal_calendar",message:"fiscalCalendar must be an object"}]};const a=n(e,E,"fiscalCalendar");return e.kind!=="month_aligned"&&a.push({path:"fiscalCalendar.kind",code:"invalid_fiscal_calendar",message:'fiscalCalendar.kind must be "month_aligned"'}),(!Number.isInteger(e.yearStartMonth)||typeof e.yearStartMonth!="number"||e.yearStartMonth<1||e.yearStartMonth>12)&&a.push({path:"fiscalCalendar.yearStartMonth",code:"invalid_fiscal_calendar",message:"fiscalCalendar.yearStartMonth must be an integer from 1 to 12"}),a.length?{ok:!1,issues:a}:{ok:!0,value:{kind:"month_aligned",yearStartMonth:e.yearStartMonth}}}function C(e){if(!o(e))return{ok:!1,issues:[{path:"$",code:"invalid_type",message:"Calendar context must be an object"}]};const a=n(e,b,"$");(typeof e.tz!="string"||!f.isValidIanaTimeZone(e.tz))&&a.push({path:"tz",code:"invalid_timezone",message:"tz must be a valid IANA timezone"}),_(e.weekStart)||a.push({path:"weekStart",code:"invalid_week_start",message:"weekStart must be an integer from 0 to 6"});const r=A(e.anchor);r.ok||a.push(...r.issues);let t;if(e.fiscalCalendar!==void 0){const s=O(e.fiscalCalendar);s.ok?t=s.value:a.push(...s.issues)}return a.length||!r.ok?{ok:!1,issues:a}:{ok:!0,value:{tz:e.tz,weekStart:e.weekStart,anchor:r.value,...t?{fiscalCalendar:t}:{}}}}function l(e,a,r){if(!p.isReportPreferenceSource(e)){r.push({path:a,code:"invalid_preference_source",message:"Preference source is invalid"});return}return e}function k(e,a){if(!o(e))return{ok:!1,issues:[{path:a,code:"invalid_type",message:"Calendar preference sources must be an object"}]};const r=n(e,y,a),t=l(e.tz,`${a}.tz`,r),s=l(e.weekStart,`${a}.weekStart`,r);return r.length||!t||!s?{ok:!1,issues:r}:{ok:!0,value:{tz:t,weekStart:s}}}function $(e){if(!o(e))return{ok:!1,issues:[{path:"$",code:"invalid_type",message:"Calendar preference response must be an object"}]};const a=n(e,F,"$"),r=e.stored===null?{ok:!0,value:null}:d(e.stored,"stored",!0),t=d(e.inherited,"inherited",!1),s=k(e.inheritedSources,"inheritedSources"),c=d(e.resolved,"resolved",!1),i=k(e.sources,"sources");for(const u of[r,t,s,c,i])u.ok||a.push(...u.issues);return a.length||!r.ok||!t.ok||!s.ok||!c.ok||!i.ok?{ok:!1,issues:a}:{ok:!0,value:{stored:r.value,inherited:t.value,inheritedSources:s.value,resolved:c.value,sources:i.value}}}function P(e){if(!o(e))return{ok:!1,issues:[{path:"preferenceSources",code:"invalid_type",message:"preferenceSources must be an object"}]};const a=n(e,T,"preferenceSources"),r=e.calendar,t=e.valueFormat;if(o(r)||a.push({path:"preferenceSources.calendar",code:"invalid_type",message:"Calendar preference sources must be an object"}),o(t)||a.push({path:"preferenceSources.valueFormat",code:"invalid_type",message:"Value-format preference sources must be an object"}),!o(r)||!o(t))return{ok:!1,issues:a};a.push(...n(r,y,"preferenceSources.calendar"),...n(t,z,"preferenceSources.valueFormat"));const s=t.dateTime;o(s)?a.push(...n(s,R,"preferenceSources.valueFormat.dateTime")):a.push({path:"preferenceSources.valueFormat.dateTime",code:"invalid_type",message:"Datetime preference sources must be an object"});const c=l(r.tz,"preferenceSources.calendar.tz",a),i=l(r.weekStart,"preferenceSources.calendar.weekStart",a),u=l(t.locale,"preferenceSources.valueFormat.locale",a),m=l(t.dateStyle,"preferenceSources.valueFormat.dateStyle",a),S=o(s)?l(s.dateStyle,"preferenceSources.valueFormat.dateTime.dateStyle",a):void 0,v=o(s)?l(s.timeStyle,"preferenceSources.valueFormat.dateTime.timeStyle",a):void 0,h=l(t.defaultCurrency,"preferenceSources.valueFormat.defaultCurrency",a);return a.length||!c||!i||!u||!m||!S||!v||!h?{ok:!1,issues:a}:{ok:!0,value:{calendar:{tz:c,weekStart:i},valueFormat:{locale:u,dateStyle:m,dateTime:{dateStyle:S,timeStyle:v},defaultCurrency:h}}}}function j(e){var t;const a=p.parseValueFormatPreferences(e);if(!a.ok)return{ok:!1,issues:a.issues.map(s=>({path:`valueFormat.${s.path}`,code:"invalid_value_format",message:s.message}))};const r=a.value;return r.locale===void 0||r.dateStyle===void 0||((t=r.dateTime)==null?void 0:t.dateStyle)===void 0||r.dateTime.timeStyle===void 0||r.defaultCurrency===void 0?{ok:!1,issues:[{path:"valueFormat",code:"invalid_value_format",message:"Resolved value-format preferences must be complete"}]}:{ok:!0,value:{locale:r.locale,dateStyle:r.dateStyle,dateTime:{dateStyle:r.dateTime.dateStyle,timeStyle:r.dateTime.timeStyle},defaultCurrency:r.defaultCurrency}}}function N(e){if(!o(e))return{ok:!1,issues:[{path:"$",code:"invalid_type",message:"Report runtime context must be an object"}]};const a=n(e,w,"$"),r=C(e.calendar),t=j(e.valueFormat),s=P(e.preferenceSources);return r.ok||a.push(...r.issues.map(c=>({...c,path:c.path==="$"?"calendar":`calendar.${c.path}`}))),t.ok||a.push(...t.issues),s.ok||a.push(...s.issues),a.length||!r.ok||!t.ok||!s.ok?{ok:!1,issues:a}:{ok:!0,value:{calendar:r.value,valueFormat:t.value,preferenceSources:s.value}}}exports.DEFAULT_CALENDAR_CONTEXT=g;exports.parseCalendarContext=C;exports.parseCalendarPreferencesResponse=$;exports.parseReportRuntimeContext=N;
1
+ "use strict";const p=require("../value-format-preferences/index.cjs"),f=require("./validators-DcshgK7w.cjs"),g={tz:"UTC",weekStart:1,anchor:"now"},b=["tz","weekStart","anchor","fiscalCalendar"],E=["kind","yearStartMonth"],w=["calendar","valueFormat","preferenceSources"],T=["calendar","valueFormat"],y=["tz","weekStart"],F=["stored","inherited","inheritedSources","resolved","sources"],z=["locale","dateStyle","dateTime","defaultCurrency"],R=["dateStyle","timeStyle"];function o(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const a=Object.getPrototypeOf(e);return a===null||Object.getPrototypeOf(a)===null}function n(e,a,r){const t=new Set(a);return Object.keys(e).filter(s=>!t.has(s)).map(s=>({path:r==="$"?s:`${r}.${s}`,code:"unknown_property",message:`Unknown property "${s}"`}))}function _(e){return Number.isInteger(e)&&typeof e=="number"&&e>=0&&e<=6}function d(e,a,r){if(!o(e))return{ok:!1,issues:[{path:a,code:"invalid_type",message:"Calendar preferences must be an object"}]};const t=n(e,["tz","weekStart"],a);return(!r||e.tz!==void 0)&&(typeof e.tz!="string"||!f.isValidIanaTimeZone(e.tz))&&t.push({path:`${a}.tz`,code:"invalid_timezone",message:"tz must be a valid IANA timezone"}),(!r||e.weekStart!==void 0)&&!_(e.weekStart)&&t.push({path:`${a}.weekStart`,code:"invalid_week_start",message:"weekStart must be an integer from 0 to 6"}),t.length?{ok:!1,issues:t}:{ok:!0,value:{...e.tz!==void 0?{tz:e.tz}:{},...e.weekStart!==void 0?{weekStart:e.weekStart}:{}}}}function A(e){if(e==="now")return{ok:!0,value:"now"};if(!o(e))return{ok:!1,issues:[{path:"anchor",code:"invalid_anchor",message:'anchor must be "now" or an object with an ISO timestamp'}]};const a=n(e,["iso"],"anchor"),r=e.iso;return f.parseSemaphorIsoInstant(r)===null&&a.push({path:"anchor.iso",code:"invalid_anchor",message:"anchor.iso must be an ISO timestamp with an explicit offset"}),a.length?{ok:!1,issues:a}:{ok:!0,value:{iso:r}}}function O(e){if(!o(e))return{ok:!1,issues:[{path:"fiscalCalendar",code:"invalid_fiscal_calendar",message:"fiscalCalendar must be an object"}]};const a=n(e,E,"fiscalCalendar");return e.kind!=="month_aligned"&&a.push({path:"fiscalCalendar.kind",code:"invalid_fiscal_calendar",message:'fiscalCalendar.kind must be "month_aligned"'}),(!Number.isInteger(e.yearStartMonth)||typeof e.yearStartMonth!="number"||e.yearStartMonth<1||e.yearStartMonth>12)&&a.push({path:"fiscalCalendar.yearStartMonth",code:"invalid_fiscal_calendar",message:"fiscalCalendar.yearStartMonth must be an integer from 1 to 12"}),a.length?{ok:!1,issues:a}:{ok:!0,value:{kind:"month_aligned",yearStartMonth:e.yearStartMonth}}}function C(e){if(!o(e))return{ok:!1,issues:[{path:"$",code:"invalid_type",message:"Calendar context must be an object"}]};const a=n(e,b,"$");(typeof e.tz!="string"||!f.isValidIanaTimeZone(e.tz))&&a.push({path:"tz",code:"invalid_timezone",message:"tz must be a valid IANA timezone"}),_(e.weekStart)||a.push({path:"weekStart",code:"invalid_week_start",message:"weekStart must be an integer from 0 to 6"});const r=A(e.anchor);r.ok||a.push(...r.issues);let t;if(e.fiscalCalendar!==void 0){const s=O(e.fiscalCalendar);s.ok?t=s.value:a.push(...s.issues)}return a.length||!r.ok?{ok:!1,issues:a}:{ok:!0,value:{tz:e.tz,weekStart:e.weekStart,anchor:r.value,...t?{fiscalCalendar:t}:{}}}}function l(e,a,r){if(!p.isReportPreferenceSource(e)){r.push({path:a,code:"invalid_preference_source",message:"Preference source is invalid"});return}return e}function k(e,a){if(!o(e))return{ok:!1,issues:[{path:a,code:"invalid_type",message:"Calendar preference sources must be an object"}]};const r=n(e,y,a),t=l(e.tz,`${a}.tz`,r),s=l(e.weekStart,`${a}.weekStart`,r);return r.length||!t||!s?{ok:!1,issues:r}:{ok:!0,value:{tz:t,weekStart:s}}}function $(e){if(!o(e))return{ok:!1,issues:[{path:"$",code:"invalid_type",message:"Calendar preference response must be an object"}]};const a=n(e,F,"$"),r=e.stored===null?{ok:!0,value:null}:d(e.stored,"stored",!0),t=d(e.inherited,"inherited",!1),s=k(e.inheritedSources,"inheritedSources"),c=d(e.resolved,"resolved",!1),i=k(e.sources,"sources");for(const u of[r,t,s,c,i])u.ok||a.push(...u.issues);return a.length||!r.ok||!t.ok||!s.ok||!c.ok||!i.ok?{ok:!1,issues:a}:{ok:!0,value:{stored:r.value,inherited:t.value,inheritedSources:s.value,resolved:c.value,sources:i.value}}}function P(e){if(!o(e))return{ok:!1,issues:[{path:"preferenceSources",code:"invalid_type",message:"preferenceSources must be an object"}]};const a=n(e,T,"preferenceSources"),r=e.calendar,t=e.valueFormat;if(o(r)||a.push({path:"preferenceSources.calendar",code:"invalid_type",message:"Calendar preference sources must be an object"}),o(t)||a.push({path:"preferenceSources.valueFormat",code:"invalid_type",message:"Value-format preference sources must be an object"}),!o(r)||!o(t))return{ok:!1,issues:a};a.push(...n(r,y,"preferenceSources.calendar"),...n(t,z,"preferenceSources.valueFormat"));const s=t.dateTime;o(s)?a.push(...n(s,R,"preferenceSources.valueFormat.dateTime")):a.push({path:"preferenceSources.valueFormat.dateTime",code:"invalid_type",message:"Datetime preference sources must be an object"});const c=l(r.tz,"preferenceSources.calendar.tz",a),i=l(r.weekStart,"preferenceSources.calendar.weekStart",a),u=l(t.locale,"preferenceSources.valueFormat.locale",a),m=l(t.dateStyle,"preferenceSources.valueFormat.dateStyle",a),S=o(s)?l(s.dateStyle,"preferenceSources.valueFormat.dateTime.dateStyle",a):void 0,v=o(s)?l(s.timeStyle,"preferenceSources.valueFormat.dateTime.timeStyle",a):void 0,h=l(t.defaultCurrency,"preferenceSources.valueFormat.defaultCurrency",a);return a.length||!c||!i||!u||!m||!S||!v||!h?{ok:!1,issues:a}:{ok:!0,value:{calendar:{tz:c,weekStart:i},valueFormat:{locale:u,dateStyle:m,dateTime:{dateStyle:S,timeStyle:v},defaultCurrency:h}}}}function j(e){var t;const a=p.parseValueFormatPreferences(e);if(!a.ok)return{ok:!1,issues:a.issues.map(s=>({path:`valueFormat.${s.path}`,code:"invalid_value_format",message:s.message}))};const r=a.value;return r.locale===void 0||r.dateStyle===void 0||((t=r.dateTime)==null?void 0:t.dateStyle)===void 0||r.dateTime.timeStyle===void 0||r.defaultCurrency===void 0?{ok:!1,issues:[{path:"valueFormat",code:"invalid_value_format",message:"Resolved value-format preferences must be complete"}]}:{ok:!0,value:{locale:r.locale,dateStyle:r.dateStyle,dateTime:{dateStyle:r.dateTime.dateStyle,timeStyle:r.dateTime.timeStyle},defaultCurrency:r.defaultCurrency}}}function N(e){if(!o(e))return{ok:!1,issues:[{path:"$",code:"invalid_type",message:"Report runtime context must be an object"}]};const a=n(e,w,"$"),r=C(e.calendar),t=j(e.valueFormat),s=P(e.preferenceSources);return r.ok||a.push(...r.issues.map(c=>({...c,path:c.path==="$"?"calendar":`calendar.${c.path}`}))),t.ok||a.push(...t.issues),s.ok||a.push(...s.issues),a.length||!r.ok||!t.ok||!s.ok?{ok:!1,issues:a}:{ok:!0,value:{calendar:r.value,valueFormat:t.value,preferenceSources:s.value}}}exports.DEFAULT_CALENDAR_CONTEXT=g;exports.parseCalendarContext=C;exports.parseCalendarPreferencesResponse=$;exports.parseReportRuntimeContext=N;
@@ -1,8 +1,8 @@
1
1
  import { S as P, a as k } from "./color-CJvdlFM_.js";
2
- import { N as R, al as v, l as O, E as D } from "./validators-DhTaCK1O.js";
3
- import "./analyze-result-contract-kaCNxjA7.js";
2
+ import { N as R, am as v, l as O, E as D } from "./validators-B5t1s8oh.js";
3
+ import "./analyze-result-contract-B3agc2XU.js";
4
4
  import "../value-format-preferences/index.js";
5
- import { A as g } from "./temporal-bucket-authoring-DjPFtRSF.js";
5
+ import { A as g } from "./temporal-bucket-authoring-CZoJV2L6.js";
6
6
  var te = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
7
7
  function U(e) {
8
8
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
@@ -33,11 +33,11 @@ function G() {
33
33
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
34
34
  return y(I);
35
35
  }
36
- const s = [];
36
+ const l = [];
37
37
  for (let e = 0; e < 256; ++e)
38
- s.push((e + 256).toString(16).slice(1));
38
+ l.push((e + 256).toString(16).slice(1));
39
39
  function L(e, r = 0) {
40
- return s[e[r + 0]] + s[e[r + 1]] + s[e[r + 2]] + s[e[r + 3]] + "-" + s[e[r + 4]] + s[e[r + 5]] + "-" + s[e[r + 6]] + s[e[r + 7]] + "-" + s[e[r + 8]] + s[e[r + 9]] + "-" + s[e[r + 10]] + s[e[r + 11]] + s[e[r + 12]] + s[e[r + 13]] + s[e[r + 14]] + s[e[r + 15]];
40
+ return l[e[r + 0]] + l[e[r + 1]] + l[e[r + 2]] + l[e[r + 3]] + "-" + l[e[r + 4]] + l[e[r + 5]] + "-" + l[e[r + 6]] + l[e[r + 7]] + "-" + l[e[r + 8]] + l[e[r + 9]] + "-" + l[e[r + 10]] + l[e[r + 11]] + l[e[r + 12]] + l[e[r + 13]] + l[e[r + 14]] + l[e[r + 15]];
41
41
  }
42
42
  const W = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), E = {
43
43
  randomUUID: W
@@ -67,7 +67,7 @@ var N = A.exports;
67
67
  }
68
68
  r(e, {
69
69
  dim: function() {
70
- return l;
70
+ return s;
71
71
  },
72
72
  default: function() {
73
73
  return c;
@@ -83,7 +83,7 @@ var N = A.exports;
83
83
  function n(f, u, p) {
84
84
  typeof process < "u" && process.env.JEST_WORKER_ID || p && d.has(p) || (p && d.add(p), console.warn(""), u.forEach((b) => console.warn(f, "-", b)));
85
85
  }
86
- function l(f) {
86
+ function s(f) {
87
87
  return a.default.dim(f);
88
88
  }
89
89
  const c = {
@@ -128,9 +128,9 @@ var N = A.exports;
128
128
  default: n
129
129
  };
130
130
  }
131
- function t({ version: n, from: l, to: c }) {
132
- r.default.warn(`${l}-color-renamed`, [
133
- `As of Tailwind CSS ${n}, \`${l}\` has been renamed to \`${c}\`.`,
131
+ function t({ version: n, from: s, to: c }) {
132
+ r.default.warn(`${s}-color-renamed`, [
133
+ `As of Tailwind CSS ${n}, \`${s}\` has been renamed to \`${c}\`.`,
134
134
  "Update your configuration file to silence this warning."
135
135
  ]);
136
136
  }
@@ -478,7 +478,7 @@ const fe = !1, de = [
478
478
  "table",
479
479
  "view",
480
480
  "materialized view"
481
- ], ie = ["_forecast"], le = "dm", se = "semaphor_calculated_fields", ce = "calculated_fields", ue = ["lg", "md", "sm", "xs", "xxs"], pe = {
481
+ ], ie = ["_forecast"], se = "dm", le = "semaphor_calculated_fields", ce = "calculated_fields", ue = ["lg", "md", "sm", "xs", "xxs"], pe = {
482
482
  // dashboardHeader: ' font-mono border-b-2 border-red-700',
483
483
  default: {
484
484
  dashboardPanel: "",
@@ -714,8 +714,8 @@ const fe = !1, de = [
714
714
  }
715
715
  };
716
716
  function F(e) {
717
- var t, d, n, l, c, f, u, p, b;
718
- const r = (c = (l = (n = (d = (t = e == null ? void 0 : e.chart) == null ? void 0 : t.config) == null ? void 0 : d._config) == null ? void 0 : n.options) == null ? void 0 : l.plugins) == null ? void 0 : c.datalabels;
717
+ var t, d, n, s, c, f, u, p, b;
718
+ const r = (c = (s = (n = (d = (t = e == null ? void 0 : e.chart) == null ? void 0 : t.config) == null ? void 0 : d._config) == null ? void 0 : n.options) == null ? void 0 : s.plugins) == null ? void 0 : c.datalabels;
719
719
  let a = (f = e == null ? void 0 : e.dataset) == null ? void 0 : f.backgroundColor;
720
720
  return (r == null ? void 0 : r.align) === "end" && (r == null ? void 0 : r.anchor) === "end" && (a = C((u = e == null ? void 0 : e.chart) == null ? void 0 : u.canvas)), (r == null ? void 0 : r.align) === "start" && (r == null ? void 0 : r.anchor) === "start" && (a = C((p = e == null ? void 0 : e.chart) == null ? void 0 : p.canvas)), $(a, {
721
721
  baseColor: C((b = e == null ? void 0 : e.chart) == null ? void 0 : b.canvas)
@@ -738,11 +738,11 @@ function C(e) {
738
738
  }
739
739
  function $(e, r = {}) {
740
740
  let a = 0, t = 0, d = 0, n = 0;
741
- const l = r.baseColor ? k(r.baseColor) : null, c = (m) => {
741
+ const s = r.baseColor ? k(r.baseColor) : null, c = (m) => {
742
742
  if (!m) return i.gray[500];
743
743
  const w = k(m);
744
744
  if (!w) return i.gray[500];
745
- const h = M(w, l);
745
+ const h = M(w, s);
746
746
  a += h.r, t += h.g, d += h.b, n++;
747
747
  };
748
748
  if (Array.isArray(e) ? e.forEach((m) => {
@@ -772,10 +772,10 @@ function K(e) {
772
772
  return !!(r || a || t || d);
773
773
  }
774
774
  function ge(e, r) {
775
- var n, l, c;
775
+ var n, s, c;
776
776
  if (r != null && r.skipSetupCheck || e.type === "text" || (n = e.customCardPreferences) != null && n.url)
777
777
  return !1;
778
- const a = !!(e.connectionId || (l = e.dataSource) != null && l.connectionId), t = !!((c = e.sql) != null && c.trim()), d = K(e.config);
778
+ const a = !!(e.connectionId || (s = e.dataSource) != null && s.connectionId), t = !!((c = e.sql) != null && c.trim()), d = K(e.config);
779
779
  return !a || !d && !t;
780
780
  }
781
781
  function be(e) {
@@ -869,15 +869,15 @@ function me(e) {
869
869
  };
870
870
  let a, t, d;
871
871
  if (e.format !== void 0 && e.format !== null) {
872
- const l = R.safeParse(e.format);
873
- if (!l.success)
872
+ const s = R.safeParse(e.format);
873
+ if (!s.success)
874
874
  a = g, t = "unsupported_pattern";
875
875
  else {
876
876
  const c = v(
877
- l.data,
877
+ s.data,
878
878
  r.granularity
879
879
  );
880
- a = c.ok ? l.data : g, c.ok || (t = c.code === "invalid_temporal_bucket_pattern" ? "unsupported_pattern" : "grain_incompatible_pattern", d = l.data.presentation.mode === "pattern" ? l.data.presentation.pattern : l.data.presentation.mode === "preset" ? l.data.presentation.preset : void 0);
880
+ a = c.ok ? s.data : g, c.ok || (t = c.code === "invalid_temporal_bucket_pattern" ? "unsupported_pattern" : "grain_incompatible_pattern", d = s.data.presentation.mode === "pattern" ? s.data.presentation.pattern : s.data.presentation.mode === "preset" ? s.data.presentation.preset : void 0);
881
881
  }
882
882
  } else
883
883
  ({ format: a, repairCode: t, ignoredPattern: d } = J(
@@ -901,7 +901,7 @@ function me(e) {
901
901
  export {
902
902
  ue as B,
903
903
  ce as C,
904
- le as D,
904
+ se as D,
905
905
  ie as M,
906
906
  be as a,
907
907
  fe as b,
@@ -916,7 +916,7 @@ export {
916
916
  te as k,
917
917
  oe as l,
918
918
  F as m,
919
- se as n,
919
+ le as n,
920
920
  me as r,
921
921
  ne as v
922
922
  };
@@ -1 +1 @@
1
- "use strict";const T=require("./color-CyB5o13F.cjs"),b=require("./validators-DO-YuzgO.cjs");require("./analyze-result-contract-CMwVg9w2.cjs");require("../value-format-preferences/index.cjs");const g=require("./temporal-bucket-authoring-C6sZAVqS.cjs");var U=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function O(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function D(e){if(e.__esModule)return e;var r=e.default;if(typeof r=="function"){var t=function a(){return this instanceof a?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};t.prototype=r.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(a){var i=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,i.get?i:{enumerable:!0,get:function(){return e[a]}})}),t}let _;const I=new Uint8Array(16);function L(){if(!_&&(_=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!_))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return _(I)}const s=[];for(let e=0;e<256;++e)s.push((e+256).toString(16).slice(1));function G(e,r=0){return s[e[r+0]]+s[e[r+1]]+s[e[r+2]]+s[e[r+3]]+"-"+s[e[r+4]]+s[e[r+5]]+"-"+s[e[r+6]]+s[e[r+7]]+"-"+s[e[r+8]]+s[e[r+9]]+"-"+s[e[r+10]]+s[e[r+11]]+s[e[r+12]]+s[e[r+13]]+s[e[r+14]]+s[e[r+15]]}const q=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),F={randomUUID:q};function K(e,r,t){if(F.randomUUID&&!e)return F.randomUUID();e=e||{};const a=e.random||(e.rng||L)();return a[6]=a[6]&15|64,a[8]=a[8]&63|128,G(a)}var R={},k={},E={exports:{}},o=String,w=function(){return{isColorSupported:!1,reset:o,bold:o,dim:o,italic:o,underline:o,inverse:o,hidden:o,strikethrough:o,black:o,red:o,green:o,yellow:o,blue:o,magenta:o,cyan:o,white:o,gray:o,bgBlack:o,bgRed:o,bgGreen:o,bgYellow:o,bgBlue:o,bgMagenta:o,bgCyan:o,bgWhite:o,blackBright:o,redBright:o,greenBright:o,yellowBright:o,blueBright:o,magentaBright:o,cyanBright:o,whiteBright:o,bgBlackBright:o,bgRedBright:o,bgGreenBright:o,bgYellowBright:o,bgBlueBright:o,bgMagentaBright:o,bgCyanBright:o,bgWhiteBright:o}};E.exports=w();E.exports.createColors=w;var N=E.exports;(function(e){Object.defineProperty(e,"__esModule",{value:!0});function r(f,u){for(var p in u)Object.defineProperty(f,p,{enumerable:!0,get:u[p]})}r(e,{dim:function(){return l},default:function(){return c}});const t=a(N);function a(f){return f&&f.__esModule?f:{default:f}}let i=new Set;function n(f,u,p){typeof process<"u"&&process.env.JEST_WORKER_ID||p&&i.has(p)||(p&&i.add(p),console.warn(""),u.forEach(m=>console.warn(f,"-",m)))}function l(f){return t.default.dim(f)}const c={info(f,u){n(t.default.bold(t.default.cyan("info")),...Array.isArray(f)?[f]:[u,f])},warn(f,u){n(t.default.bold(t.default.yellow("warn")),...Array.isArray(f)?[f]:[u,f])},risk(f,u){n(t.default.bold(t.default.magenta("risk")),...Array.isArray(f)?[f]:[u,f])}}})(k);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return i}});const r=t(k);function t(n){return n&&n.__esModule?n:{default:n}}function a({version:n,from:l,to:c}){r.default.warn(`${l}-color-renamed`,[`As of Tailwind CSS ${n}, \`${l}\` has been renamed to \`${c}\`.`,"Update your configuration file to silence this warning."])}const i={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"},get lightBlue(){return a({version:"v2.2",from:"lightBlue",to:"sky"}),this.sky},get warmGray(){return a({version:"v3.0",from:"warmGray",to:"stone"}),this.stone},get trueGray(){return a({version:"v3.0",from:"trueGray",to:"neutral"}),this.neutral},get coolGray(){return a({version:"v3.0",from:"coolGray",to:"gray"}),this.gray},get blueGray(){return a({version:"v3.0",from:"blueGray",to:"slate"}),this.slate}}})(R);let A=R;var W=(A.__esModule?A:{default:A}).default;const d=O(W),j=".semaphor-scope";function V(e){return e?e.closest(j):null}function Q(e){if(!e)return"light";const r=e.dataset.semaphorTheme;return r==="dark"||r==="light"?r:e.classList.contains("dark")?"dark":"light"}const H=!1,$=["table","view","materialized view"],z=["_forecast"],J="dm",Z="semaphor_calculated_fields",X="calculated_fields",x=["lg","md","sm","xs","xxs"],ee={default:{dashboardPanel:"",dashboardTabsContainer:"",gridLayout:{className:""},chart:{font:{family:T.SEMAPHOR_DEFAULT_FONT_FAMILY},dataset:{backgroundColor:[d.teal[500],d.teal[300],d.gray[700],d.gray[500],d.gray[300]],borderColor:[d.teal[500],d.teal[300],d.gray[700],d.gray[500],d.gray[300]]},options:{interaction:{mode:"index"},plugins:{datalabels:{display:!1,color:v},title:{display:!0},tooltip:{backgroundColor:"#fff",bodyColor:"#000",borderWidth:.25,titleColor:"#000",borderColor:"rgb(128,131,139)",cornerRadius:4,usePointStyle:!0,pointStyle:"rectRounded",boxPadding:4},legend:{position:"top",align:"center",maxHeight:0,labels:{useBorderRadius:!0,borderRadius:2}}},scales:{y:{grid:{display:!0},title:{display:!0,text:""},beginAtZero:!0,ticks:{precision:0}},x:{grid:{display:!0},title:{display:!0}}},layout:{padding:{top:-40}},borderRadius:2,responsive:!0,maintainAspectRatio:!1}}},dark:{chart:{dataset:{datalables:{color:v},backgroundColor:[d.teal[500],d.teal[300],d.gray[700],d.gray[500],d.gray[300]],borderColor:[d.teal[500],d.teal[300],d.gray[700],d.gray[500],d.gray[300]]},options:{plugins:{tooltip:{backgroundColor:"#000",bodyColor:"#fff",borderWidth:.25,titleColor:"#fff",borderColor:"rgb(128,131,139)",cornerRadius:2,boxPadding:4}},datalabels:{display:!1},scales:{x:{grid:{display:!0,color:d.slate[800]}},y:{grid:{display:!0,color:d.slate[800]}}}}}}};function v(e){var a,i,n,l,c,f,u,p,m;const r=(c=(l=(n=(i=(a=e==null?void 0:e.chart)==null?void 0:a.config)==null?void 0:i._config)==null?void 0:n.options)==null?void 0:l.plugins)==null?void 0:c.datalabels;let t=(f=e==null?void 0:e.dataset)==null?void 0:f.backgroundColor;return(r==null?void 0:r.align)==="end"&&(r==null?void 0:r.anchor)==="end"&&(t=h((u=e==null?void 0:e.chart)==null?void 0:u.canvas)),(r==null?void 0:r.align)==="start"&&(r==null?void 0:r.anchor)==="start"&&(t=h((p=e==null?void 0:e.chart)==null?void 0:p.canvas)),P(t,{baseColor:h((m=e==null?void 0:e.chart)==null?void 0:m.canvas)})}function h(e){if(typeof document<"u"){const r=V(e);if(r){const a=window.getComputedStyle(r).getPropertyValue("--semaphor-background").trim();return a?`hsl(${a})`:Q(r)==="dark"?"#000000":"#FFFFFF"}const t=document.documentElement;if(t.classList.contains("dark"))return"#000000";if(t.classList.contains("light"))return"#FFFFFF"}return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"#000000":"#FFFFFF"}function P(e,r={}){let t=0,a=0,i=0,n=0;const l=r.baseColor?T.parseRuntimeColor(r.baseColor):null,c=y=>{if(!y)return d.gray[500];const M=T.parseRuntimeColor(y);if(!M)return d.gray[500];const C=S(M,l);t+=C.r,a+=C.g,i+=C.b,n++};if(Array.isArray(e)?e.forEach(y=>{c(y)}):c(e),n===0)return d.gray[500];const f=t/n,u=a/n,p=i/n;return(f*299+u*587+p*114)/1e3>=180?"black":"white"}function S(e,r){if(e.alpha>=1)return e;const t=r?S(r,null):re;return{r:e.r*e.alpha+t.r*(1-e.alpha),g:e.g*e.alpha+t.g*(1-e.alpha),b:e.b*e.alpha+t.b*(1-e.alpha)}}const re={r:255,g:255,b:255};function Y(e){if(!e)return!1;const r=e.groupByColumns&&e.groupByColumns.length>0,t=e.metricColumns&&e.metricColumns.length>0,a=e.pivotByColumns&&e.pivotByColumns.length>0,i=e.detailColumns&&e.detailColumns.length>0;return!!(r||t||a||i)}function te(e,r){var n,l,c;if(r!=null&&r.skipSetupCheck||e.type==="text"||(n=e.customCardPreferences)!=null&&n.url)return!1;const t=!!(e.connectionId||(l=e.dataSource)!=null&&l.connectionId),a=!!((c=e.sql)!=null&&c.trim()),i=Y(e.config);return!t||!i&&!a}function ae(e){return e.format!=null||e.dateFormat!=null}const B={"Week of MMM DD, YYYY":{type:"temporal_bucket",presentation:{mode:"preset",preset:"week_of_short"}},"Week of MMMM DD, YYYY":{type:"temporal_bucket",presentation:{mode:"preset",preset:"week_of_long"}},"Q1 YYYY":{type:"temporal_bucket",presentation:{mode:"preset",preset:"quarter_short"}},"1st Quarter YYYY":{type:"temporal_bucket",presentation:{mode:"preset",preset:"quarter_long"}},"YYYY Q1":void 0,"YYYY-Q1":void 0,"Quarter 1, YYYY":void 0,"YYYY-WW":void 0};function oe(e,r,t,a){return{code:r,severity:"warning",fieldId:e.fieldId,...a?{ignoredPattern:a}:{},effectiveFormat:t}}function ne(e,r){if(e.dateFormat===void 0||e.dateFormat===null)return{format:g.AUTOMATIC_TEMPORAL_BUCKET_FORMAT};if(typeof e.dateFormat!="string")return{format:g.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,repairCode:"unsupported_pattern"};const t=e.dateFormat==="custom"?typeof e.customFormat=="string"?e.customFormat.trim():"":e.dateFormat.trim();if(!t)return{format:g.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,repairCode:"missing_custom_pattern"};if(Object.prototype.hasOwnProperty.call(B,t)){const n=B[t];return n?b.validateTemporalBucketFormatApplicability(n,r).ok?{format:n}:{format:g.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,repairCode:"grain_incompatible_pattern",ignoredPattern:t}:{format:g.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,repairCode:"unsupported_pattern",ignoredPattern:t}}const a={type:"temporal_bucket",presentation:{mode:"pattern",pattern:t}},i=b.validateTemporalBucketFormatApplicability(a,r);return i.ok?{format:a}:{format:g.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,repairCode:i.code==="incompatible_temporal_bucket_pattern"||i.code==="incompatible_temporal_bucket_preset"?"grain_incompatible_pattern":"unsupported_pattern",ignoredPattern:t}}function fe(e){if(b.isSemaphorTimeGrain(e.granularity))return{granularity:e.granularity,assumedDay:!1};if(!(e.granularity!==void 0&&e.granularity!==null))return b.normalizeAnalyticsCatalogDataType(e.dataType)==="date"?{granularity:"day",assumedDay:!0}:void 0}function de(e){const r=fe(e);if(!r)return{ok:!1,error:{code:"ambiguous_temporal_grain",fieldId:e.fieldId}};let t,a,i;if(e.format!==void 0&&e.format!==null){const l=b.temporalBucketFormatSchema.safeParse(e.format);if(!l.success)t=g.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,a="unsupported_pattern";else{const c=b.validateTemporalBucketFormatApplicability(l.data,r.granularity);t=c.ok?l.data:g.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,c.ok||(a=c.code==="invalid_temporal_bucket_pattern"?"unsupported_pattern":"grain_incompatible_pattern",i=l.data.presentation.mode==="pattern"?l.data.presentation.pattern:l.data.presentation.mode==="preset"?l.data.presentation.preset:void 0)}}else({format:t,repairCode:a,ignoredPattern:i}=ne(e,r.granularity));const n=r.assumedDay?"missing_grain_assumed_day":a;return{ok:!0,format:t,...n?{diagnostic:oe(e,n,t,i)}:{}}}exports.BREAKPOINTS=x;exports.CALCULATED_FIELDS_GROUP_ID=Z;exports.CALCULATED_FIELDS_GROUP_NAME=X;exports.DATABASE_ENTITY_TYPES=$;exports.DATAMODEL_NAMESPCACE=J;exports.DEFAULT_STYLE=ee;exports.METADATA_KEYS=z;exports.colors=d;exports.commonjsGlobal=U;exports.getAugmentedNamespace=D;exports.getCanvasBackgroundColor=h;exports.getContrastColor=P;exports.getDatalabelColor=v;exports.getDefaultExportFromCjs=O;exports.hasSavedTemporalBucketPresentation=ae;exports.hasValidCardConfig=Y;exports.isCardUnconfigured=te;exports.isDevEnv=H;exports.readSavedTemporalBucketFormat=de;exports.v4=K;
1
+ "use strict";const T=require("./color-CyB5o13F.cjs"),b=require("./validators-DcshgK7w.cjs");require("./analyze-result-contract-OgPk-zGu.cjs");require("../value-format-preferences/index.cjs");const g=require("./temporal-bucket-authoring-DSpzgXHc.cjs");var U=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function O(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function D(e){if(e.__esModule)return e;var r=e.default;if(typeof r=="function"){var t=function a(){return this instanceof a?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};t.prototype=r.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach(function(a){var i=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,i.get?i:{enumerable:!0,get:function(){return e[a]}})}),t}let _;const I=new Uint8Array(16);function L(){if(!_&&(_=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!_))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return _(I)}const s=[];for(let e=0;e<256;++e)s.push((e+256).toString(16).slice(1));function G(e,r=0){return s[e[r+0]]+s[e[r+1]]+s[e[r+2]]+s[e[r+3]]+"-"+s[e[r+4]]+s[e[r+5]]+"-"+s[e[r+6]]+s[e[r+7]]+"-"+s[e[r+8]]+s[e[r+9]]+"-"+s[e[r+10]]+s[e[r+11]]+s[e[r+12]]+s[e[r+13]]+s[e[r+14]]+s[e[r+15]]}const q=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),F={randomUUID:q};function K(e,r,t){if(F.randomUUID&&!e)return F.randomUUID();e=e||{};const a=e.random||(e.rng||L)();return a[6]=a[6]&15|64,a[8]=a[8]&63|128,G(a)}var R={},k={},E={exports:{}},o=String,w=function(){return{isColorSupported:!1,reset:o,bold:o,dim:o,italic:o,underline:o,inverse:o,hidden:o,strikethrough:o,black:o,red:o,green:o,yellow:o,blue:o,magenta:o,cyan:o,white:o,gray:o,bgBlack:o,bgRed:o,bgGreen:o,bgYellow:o,bgBlue:o,bgMagenta:o,bgCyan:o,bgWhite:o,blackBright:o,redBright:o,greenBright:o,yellowBright:o,blueBright:o,magentaBright:o,cyanBright:o,whiteBright:o,bgBlackBright:o,bgRedBright:o,bgGreenBright:o,bgYellowBright:o,bgBlueBright:o,bgMagentaBright:o,bgCyanBright:o,bgWhiteBright:o}};E.exports=w();E.exports.createColors=w;var N=E.exports;(function(e){Object.defineProperty(e,"__esModule",{value:!0});function r(f,u){for(var p in u)Object.defineProperty(f,p,{enumerable:!0,get:u[p]})}r(e,{dim:function(){return l},default:function(){return c}});const t=a(N);function a(f){return f&&f.__esModule?f:{default:f}}let i=new Set;function n(f,u,p){typeof process<"u"&&process.env.JEST_WORKER_ID||p&&i.has(p)||(p&&i.add(p),console.warn(""),u.forEach(m=>console.warn(f,"-",m)))}function l(f){return t.default.dim(f)}const c={info(f,u){n(t.default.bold(t.default.cyan("info")),...Array.isArray(f)?[f]:[u,f])},warn(f,u){n(t.default.bold(t.default.yellow("warn")),...Array.isArray(f)?[f]:[u,f])},risk(f,u){n(t.default.bold(t.default.magenta("risk")),...Array.isArray(f)?[f]:[u,f])}}})(k);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return i}});const r=t(k);function t(n){return n&&n.__esModule?n:{default:n}}function a({version:n,from:l,to:c}){r.default.warn(`${l}-color-renamed`,[`As of Tailwind CSS ${n}, \`${l}\` has been renamed to \`${c}\`.`,"Update your configuration file to silence this warning."])}const i={inherit:"inherit",current:"currentColor",transparent:"transparent",black:"#000",white:"#fff",slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cbd5e1",400:"#94a3b8",500:"#64748b",600:"#475569",700:"#334155",800:"#1e293b",900:"#0f172a",950:"#020617"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5db",400:"#9ca3af",500:"#6b7280",600:"#4b5563",700:"#374151",800:"#1f2937",900:"#111827",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#a1a1aa",500:"#71717a",600:"#52525b",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a3a3a3",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a8a29e",500:"#78716c",600:"#57534e",700:"#44403c",800:"#292524",900:"#1c1917",950:"#0c0a09"},red:{50:"#fef2f2",100:"#fee2e2",200:"#fecaca",300:"#fca5a5",400:"#f87171",500:"#ef4444",600:"#dc2626",700:"#b91c1c",800:"#991b1b",900:"#7f1d1d",950:"#450a0a"},orange:{50:"#fff7ed",100:"#ffedd5",200:"#fed7aa",300:"#fdba74",400:"#fb923c",500:"#f97316",600:"#ea580c",700:"#c2410c",800:"#9a3412",900:"#7c2d12",950:"#431407"},amber:{50:"#fffbeb",100:"#fef3c7",200:"#fde68a",300:"#fcd34d",400:"#fbbf24",500:"#f59e0b",600:"#d97706",700:"#b45309",800:"#92400e",900:"#78350f",950:"#451a03"},yellow:{50:"#fefce8",100:"#fef9c3",200:"#fef08a",300:"#fde047",400:"#facc15",500:"#eab308",600:"#ca8a04",700:"#a16207",800:"#854d0e",900:"#713f12",950:"#422006"},lime:{50:"#f7fee7",100:"#ecfccb",200:"#d9f99d",300:"#bef264",400:"#a3e635",500:"#84cc16",600:"#65a30d",700:"#4d7c0f",800:"#3f6212",900:"#365314",950:"#1a2e05"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#bbf7d0",300:"#86efac",400:"#4ade80",500:"#22c55e",600:"#16a34a",700:"#15803d",800:"#166534",900:"#14532d",950:"#052e16"},emerald:{50:"#ecfdf5",100:"#d1fae5",200:"#a7f3d0",300:"#6ee7b7",400:"#34d399",500:"#10b981",600:"#059669",700:"#047857",800:"#065f46",900:"#064e3b",950:"#022c22"},teal:{50:"#f0fdfa",100:"#ccfbf1",200:"#99f6e4",300:"#5eead4",400:"#2dd4bf",500:"#14b8a6",600:"#0d9488",700:"#0f766e",800:"#115e59",900:"#134e4a",950:"#042f2e"},cyan:{50:"#ecfeff",100:"#cffafe",200:"#a5f3fc",300:"#67e8f9",400:"#22d3ee",500:"#06b6d4",600:"#0891b2",700:"#0e7490",800:"#155e75",900:"#164e63",950:"#083344"},sky:{50:"#f0f9ff",100:"#e0f2fe",200:"#bae6fd",300:"#7dd3fc",400:"#38bdf8",500:"#0ea5e9",600:"#0284c7",700:"#0369a1",800:"#075985",900:"#0c4a6e",950:"#082f49"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bfdbfe",300:"#93c5fd",400:"#60a5fa",500:"#3b82f6",600:"#2563eb",700:"#1d4ed8",800:"#1e40af",900:"#1e3a8a",950:"#172554"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c7d2fe",300:"#a5b4fc",400:"#818cf8",500:"#6366f1",600:"#4f46e5",700:"#4338ca",800:"#3730a3",900:"#312e81",950:"#1e1b4b"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6fe",300:"#c4b5fd",400:"#a78bfa",500:"#8b5cf6",600:"#7c3aed",700:"#6d28d9",800:"#5b21b6",900:"#4c1d95",950:"#2e1065"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d5ff",300:"#d8b4fe",400:"#c084fc",500:"#a855f7",600:"#9333ea",700:"#7e22ce",800:"#6b21a8",900:"#581c87",950:"#3b0764"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f5d0fe",300:"#f0abfc",400:"#e879f9",500:"#d946ef",600:"#c026d3",700:"#a21caf",800:"#86198f",900:"#701a75",950:"#4a044e"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fbcfe8",300:"#f9a8d4",400:"#f472b6",500:"#ec4899",600:"#db2777",700:"#be185d",800:"#9d174d",900:"#831843",950:"#500724"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#fecdd3",300:"#fda4af",400:"#fb7185",500:"#f43f5e",600:"#e11d48",700:"#be123c",800:"#9f1239",900:"#881337",950:"#4c0519"},get lightBlue(){return a({version:"v2.2",from:"lightBlue",to:"sky"}),this.sky},get warmGray(){return a({version:"v3.0",from:"warmGray",to:"stone"}),this.stone},get trueGray(){return a({version:"v3.0",from:"trueGray",to:"neutral"}),this.neutral},get coolGray(){return a({version:"v3.0",from:"coolGray",to:"gray"}),this.gray},get blueGray(){return a({version:"v3.0",from:"blueGray",to:"slate"}),this.slate}}})(R);let A=R;var W=(A.__esModule?A:{default:A}).default;const d=O(W),j=".semaphor-scope";function V(e){return e?e.closest(j):null}function Q(e){if(!e)return"light";const r=e.dataset.semaphorTheme;return r==="dark"||r==="light"?r:e.classList.contains("dark")?"dark":"light"}const H=!1,$=["table","view","materialized view"],z=["_forecast"],J="dm",Z="semaphor_calculated_fields",X="calculated_fields",x=["lg","md","sm","xs","xxs"],ee={default:{dashboardPanel:"",dashboardTabsContainer:"",gridLayout:{className:""},chart:{font:{family:T.SEMAPHOR_DEFAULT_FONT_FAMILY},dataset:{backgroundColor:[d.teal[500],d.teal[300],d.gray[700],d.gray[500],d.gray[300]],borderColor:[d.teal[500],d.teal[300],d.gray[700],d.gray[500],d.gray[300]]},options:{interaction:{mode:"index"},plugins:{datalabels:{display:!1,color:v},title:{display:!0},tooltip:{backgroundColor:"#fff",bodyColor:"#000",borderWidth:.25,titleColor:"#000",borderColor:"rgb(128,131,139)",cornerRadius:4,usePointStyle:!0,pointStyle:"rectRounded",boxPadding:4},legend:{position:"top",align:"center",maxHeight:0,labels:{useBorderRadius:!0,borderRadius:2}}},scales:{y:{grid:{display:!0},title:{display:!0,text:""},beginAtZero:!0,ticks:{precision:0}},x:{grid:{display:!0},title:{display:!0}}},layout:{padding:{top:-40}},borderRadius:2,responsive:!0,maintainAspectRatio:!1}}},dark:{chart:{dataset:{datalables:{color:v},backgroundColor:[d.teal[500],d.teal[300],d.gray[700],d.gray[500],d.gray[300]],borderColor:[d.teal[500],d.teal[300],d.gray[700],d.gray[500],d.gray[300]]},options:{plugins:{tooltip:{backgroundColor:"#000",bodyColor:"#fff",borderWidth:.25,titleColor:"#fff",borderColor:"rgb(128,131,139)",cornerRadius:2,boxPadding:4}},datalabels:{display:!1},scales:{x:{grid:{display:!0,color:d.slate[800]}},y:{grid:{display:!0,color:d.slate[800]}}}}}}};function v(e){var a,i,n,l,c,f,u,p,m;const r=(c=(l=(n=(i=(a=e==null?void 0:e.chart)==null?void 0:a.config)==null?void 0:i._config)==null?void 0:n.options)==null?void 0:l.plugins)==null?void 0:c.datalabels;let t=(f=e==null?void 0:e.dataset)==null?void 0:f.backgroundColor;return(r==null?void 0:r.align)==="end"&&(r==null?void 0:r.anchor)==="end"&&(t=h((u=e==null?void 0:e.chart)==null?void 0:u.canvas)),(r==null?void 0:r.align)==="start"&&(r==null?void 0:r.anchor)==="start"&&(t=h((p=e==null?void 0:e.chart)==null?void 0:p.canvas)),P(t,{baseColor:h((m=e==null?void 0:e.chart)==null?void 0:m.canvas)})}function h(e){if(typeof document<"u"){const r=V(e);if(r){const a=window.getComputedStyle(r).getPropertyValue("--semaphor-background").trim();return a?`hsl(${a})`:Q(r)==="dark"?"#000000":"#FFFFFF"}const t=document.documentElement;if(t.classList.contains("dark"))return"#000000";if(t.classList.contains("light"))return"#FFFFFF"}return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"#000000":"#FFFFFF"}function P(e,r={}){let t=0,a=0,i=0,n=0;const l=r.baseColor?T.parseRuntimeColor(r.baseColor):null,c=y=>{if(!y)return d.gray[500];const M=T.parseRuntimeColor(y);if(!M)return d.gray[500];const C=S(M,l);t+=C.r,a+=C.g,i+=C.b,n++};if(Array.isArray(e)?e.forEach(y=>{c(y)}):c(e),n===0)return d.gray[500];const f=t/n,u=a/n,p=i/n;return(f*299+u*587+p*114)/1e3>=180?"black":"white"}function S(e,r){if(e.alpha>=1)return e;const t=r?S(r,null):re;return{r:e.r*e.alpha+t.r*(1-e.alpha),g:e.g*e.alpha+t.g*(1-e.alpha),b:e.b*e.alpha+t.b*(1-e.alpha)}}const re={r:255,g:255,b:255};function Y(e){if(!e)return!1;const r=e.groupByColumns&&e.groupByColumns.length>0,t=e.metricColumns&&e.metricColumns.length>0,a=e.pivotByColumns&&e.pivotByColumns.length>0,i=e.detailColumns&&e.detailColumns.length>0;return!!(r||t||a||i)}function te(e,r){var n,l,c;if(r!=null&&r.skipSetupCheck||e.type==="text"||(n=e.customCardPreferences)!=null&&n.url)return!1;const t=!!(e.connectionId||(l=e.dataSource)!=null&&l.connectionId),a=!!((c=e.sql)!=null&&c.trim()),i=Y(e.config);return!t||!i&&!a}function ae(e){return e.format!=null||e.dateFormat!=null}const B={"Week of MMM DD, YYYY":{type:"temporal_bucket",presentation:{mode:"preset",preset:"week_of_short"}},"Week of MMMM DD, YYYY":{type:"temporal_bucket",presentation:{mode:"preset",preset:"week_of_long"}},"Q1 YYYY":{type:"temporal_bucket",presentation:{mode:"preset",preset:"quarter_short"}},"1st Quarter YYYY":{type:"temporal_bucket",presentation:{mode:"preset",preset:"quarter_long"}},"YYYY Q1":void 0,"YYYY-Q1":void 0,"Quarter 1, YYYY":void 0,"YYYY-WW":void 0};function oe(e,r,t,a){return{code:r,severity:"warning",fieldId:e.fieldId,...a?{ignoredPattern:a}:{},effectiveFormat:t}}function ne(e,r){if(e.dateFormat===void 0||e.dateFormat===null)return{format:g.AUTOMATIC_TEMPORAL_BUCKET_FORMAT};if(typeof e.dateFormat!="string")return{format:g.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,repairCode:"unsupported_pattern"};const t=e.dateFormat==="custom"?typeof e.customFormat=="string"?e.customFormat.trim():"":e.dateFormat.trim();if(!t)return{format:g.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,repairCode:"missing_custom_pattern"};if(Object.prototype.hasOwnProperty.call(B,t)){const n=B[t];return n?b.validateTemporalBucketFormatApplicability(n,r).ok?{format:n}:{format:g.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,repairCode:"grain_incompatible_pattern",ignoredPattern:t}:{format:g.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,repairCode:"unsupported_pattern",ignoredPattern:t}}const a={type:"temporal_bucket",presentation:{mode:"pattern",pattern:t}},i=b.validateTemporalBucketFormatApplicability(a,r);return i.ok?{format:a}:{format:g.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,repairCode:i.code==="incompatible_temporal_bucket_pattern"||i.code==="incompatible_temporal_bucket_preset"?"grain_incompatible_pattern":"unsupported_pattern",ignoredPattern:t}}function fe(e){if(b.isSemaphorTimeGrain(e.granularity))return{granularity:e.granularity,assumedDay:!1};if(!(e.granularity!==void 0&&e.granularity!==null))return b.normalizeAnalyticsCatalogDataType(e.dataType)==="date"?{granularity:"day",assumedDay:!0}:void 0}function de(e){const r=fe(e);if(!r)return{ok:!1,error:{code:"ambiguous_temporal_grain",fieldId:e.fieldId}};let t,a,i;if(e.format!==void 0&&e.format!==null){const l=b.temporalBucketFormatSchema.safeParse(e.format);if(!l.success)t=g.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,a="unsupported_pattern";else{const c=b.validateTemporalBucketFormatApplicability(l.data,r.granularity);t=c.ok?l.data:g.AUTOMATIC_TEMPORAL_BUCKET_FORMAT,c.ok||(a=c.code==="invalid_temporal_bucket_pattern"?"unsupported_pattern":"grain_incompatible_pattern",i=l.data.presentation.mode==="pattern"?l.data.presentation.pattern:l.data.presentation.mode==="preset"?l.data.presentation.preset:void 0)}}else({format:t,repairCode:a,ignoredPattern:i}=ne(e,r.granularity));const n=r.assumedDay?"missing_grain_assumed_day":a;return{ok:!0,format:t,...n?{diagnostic:oe(e,n,t,i)}:{}}}exports.BREAKPOINTS=x;exports.CALCULATED_FIELDS_GROUP_ID=Z;exports.CALCULATED_FIELDS_GROUP_NAME=X;exports.DATABASE_ENTITY_TYPES=$;exports.DATAMODEL_NAMESPCACE=J;exports.DEFAULT_STYLE=ee;exports.METADATA_KEYS=z;exports.colors=d;exports.commonjsGlobal=U;exports.getAugmentedNamespace=D;exports.getCanvasBackgroundColor=h;exports.getContrastColor=P;exports.getDatalabelColor=v;exports.getDefaultExportFromCjs=O;exports.hasSavedTemporalBucketPresentation=ae;exports.hasValidCardConfig=Y;exports.isCardUnconfigured=te;exports.isDevEnv=H;exports.readSavedTemporalBucketFormat=de;exports.v4=K;