react-semaphor 0.1.449 → 0.1.454

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 (147) hide show
  1. package/dist/analytics-protocol/index.cjs +1 -1
  2. package/dist/analytics-protocol/index.js +119 -112
  3. package/dist/appearance/index.cjs +1 -1
  4. package/dist/appearance/index.js +1 -1
  5. package/dist/brand-studio/index.cjs +4 -4
  6. package/dist/brand-studio/index.js +15 -13
  7. package/dist/briefings/index.cjs +1 -1
  8. package/dist/briefings/index.js +39 -2131
  9. package/dist/chunks/{analyze-result-contract-T-0Ntzys.js → analyze-result-contract-BbRJ-C06.js} +1 -1
  10. package/dist/chunks/{analyze-result-contract-BHb7sUUW.cjs → analyze-result-contract-LPDNldic.cjs} +1 -1
  11. package/dist/chunks/canonical-result-keys-BA0HCP4e.cjs +1 -0
  12. package/dist/chunks/canonical-result-keys-D6avdjpA.js +467 -0
  13. package/dist/chunks/color-CJvdlFM_.js +2162 -0
  14. package/dist/chunks/color-CyB5o13F.cjs +4 -0
  15. package/dist/chunks/{common-types-CQ6SHfLk.cjs → common-types-C57kJ59w.cjs} +1 -1
  16. package/dist/chunks/{common-types-B7Jk3Rtj.js → common-types-H51FLKB7.js} +1 -1
  17. package/dist/chunks/contracts-CoCOpd_i.js +11 -0
  18. package/dist/chunks/contracts-CtB2VONT.cjs +1 -0
  19. package/dist/chunks/dashboard-briefing-launcher-Dwj1i7lr.cjs +26 -0
  20. package/dist/chunks/{dashboard-briefing-launcher-DCHiEkLE.js → dashboard-briefing-launcher-SYroFdae.js} +86 -84
  21. package/dist/chunks/{dashboard-controls-DwRFCcHV.js → dashboard-controls-1LpeU2sz.js} +15 -13
  22. package/dist/chunks/{dashboard-controls-CaFioayc.cjs → dashboard-controls-CpFoh7-A.cjs} +1 -1
  23. package/dist/chunks/dashboard-date-comparison-definition-Ces4alFm.cjs +1 -0
  24. package/dist/chunks/{dashboard-date-comparison-definition-Ba-clViK.js → dashboard-date-comparison-definition-DC3ekV2S.js} +1 -1
  25. package/dist/chunks/{dashboard-json-WoILbfTe.js → dashboard-json-D-T-sQxU.js} +25 -23
  26. package/dist/chunks/dashboard-json-DwSQopc_.cjs +1 -0
  27. package/dist/chunks/edit-dashboard-visual-BEmoQAET.cjs +172 -0
  28. package/dist/chunks/{edit-dashboard-visual-ciFhxqaI.js → edit-dashboard-visual-DqxUq4Bs.js} +6925 -6947
  29. package/dist/chunks/editor-action-buttons-18r2xwei.cjs +16 -0
  30. package/dist/chunks/{editor-action-buttons-BPo_45pM.js → editor-action-buttons-B2l3WIRC.js} +41 -39
  31. package/dist/chunks/format-types-CFHQoIuk.js +1350 -0
  32. package/dist/chunks/format-types-PSZZ7hG8.cjs +1 -0
  33. package/dist/chunks/index-Bn5wlkHt.cjs +4 -0
  34. package/dist/chunks/index-ByFbacH7.cjs +1 -0
  35. package/dist/chunks/index-CACdoqu3.js +318 -0
  36. package/dist/chunks/index-CLB_NGZ8.cjs +1392 -0
  37. package/dist/chunks/index-Ca784dpx.js +3714 -0
  38. package/dist/chunks/{index-CPuawpXJ.js → index-DAoS4BNU.js} +48514 -48484
  39. package/dist/chunks/index-DSKR3nKn.js +421 -0
  40. package/dist/chunks/index-F25jnH0p.cjs +1 -0
  41. package/dist/chunks/matrix-result-contract-CofATICL.js +437 -0
  42. package/dist/chunks/matrix-result-contract-zamd9euI.cjs +1 -0
  43. package/dist/chunks/pivot-header-presentation-DhyQXxKq.cjs +4 -0
  44. package/dist/chunks/pivot-header-presentation-ckYOQ4aZ.js +557 -0
  45. package/dist/chunks/{pivot-result-identity-CDLRT-YG.cjs → pivot-result-identity-Bb4EixVN.cjs} +1 -1
  46. package/dist/chunks/{pivot-result-identity-CwJWpKI7.js → pivot-result-identity-DU1v-5Xk.js} +1 -1
  47. package/dist/chunks/pivot-result-lifecycle-DmcF1ris.cjs +1 -0
  48. package/dist/chunks/pivot-result-lifecycle-sjzIOpvp.js +1641 -0
  49. package/dist/chunks/raw-temporal-contract-BtjH_G-d.cjs +1 -0
  50. package/dist/chunks/raw-temporal-contract-CxncLze5.js +64 -0
  51. package/dist/chunks/report-preferences-dialog-BgSvlDXa.cjs +1 -0
  52. package/dist/chunks/report-preferences-dialog-DDc2WUa0.js +723 -0
  53. package/dist/chunks/{report-runtime-context-C8LZFsqV.cjs → report-runtime-context-DqxS4wbi.cjs} +1 -1
  54. package/dist/chunks/{report-runtime-context-bCy3CVzK.js → report-runtime-context-SM6YO61_.js} +5 -5
  55. package/dist/chunks/saved-temporal-bucket-format-CFfWXRl9.cjs +1 -0
  56. package/dist/chunks/saved-temporal-bucket-format-SGAV0ivR.js +922 -0
  57. package/dist/chunks/{switch-BXet-Sno.js → switch-BeZW-HnS.js} +4350 -5249
  58. package/dist/chunks/switch-D-CCcfhc.cjs +138 -0
  59. package/dist/chunks/temporal-bucket-5UYEotyQ.js +810 -0
  60. package/dist/chunks/temporal-bucket-DHY1y9lq.cjs +1 -0
  61. package/dist/chunks/temporal-bucket-authoring-K1kE6R_z.js +222 -0
  62. package/dist/chunks/temporal-bucket-authoring-o3Emn05L.cjs +1 -0
  63. package/dist/chunks/{temporal-bucket-contract-ChDBWX8I.cjs → temporal-bucket-contract-D2-93DGr.cjs} +1 -1
  64. package/dist/chunks/{temporal-bucket-contract-_F6vNhhH.js → temporal-bucket-contract-D5d-xEl3.js} +1 -1
  65. package/dist/chunks/{token-types-BdQ8kHBm.cjs → token-types-D7CaaI80.cjs} +1 -1
  66. package/dist/chunks/{token-types-BHR58aTy.js → token-types-GbxRUozo.js} +1 -1
  67. package/dist/chunks/{update-policy-BxvYMYz0.cjs → update-policy-BmiOd0PB.cjs} +1 -1
  68. package/dist/chunks/{update-policy-g0rCQ9BM.js → update-policy-hednMF-0.js} +1 -1
  69. package/dist/chunks/validators-BDYprKI9.cjs +1 -0
  70. package/dist/chunks/{validators-Cs74WVie.js → validators-DEmd8Sin.js} +1561 -1197
  71. package/dist/dashboard/index.cjs +1 -1
  72. package/dist/dashboard/index.js +2 -2
  73. package/dist/dashboard-authoring/index.cjs +3 -3
  74. package/dist/dashboard-authoring/index.js +35 -32
  75. package/dist/data-app-builder/index.cjs +1 -1
  76. package/dist/data-app-builder/index.js +2 -2
  77. package/dist/data-app-codegen/index.cjs +1 -1
  78. package/dist/data-app-codegen/index.js +2 -2
  79. package/dist/data-app-codegen-node/index.cjs +1 -1
  80. package/dist/data-app-codegen-node/index.js +3 -3
  81. package/dist/data-app-sdk/index.cjs +1 -1
  82. package/dist/data-app-sdk/index.js +78 -77
  83. package/dist/data-app-sdk-adapters/index.cjs +1 -1
  84. package/dist/data-app-sdk-adapters/index.js +29 -30
  85. package/dist/data-app-sdk-validation/index.cjs +1 -1
  86. package/dist/data-app-sdk-validation/index.js +21 -21
  87. package/dist/format-utils/index.cjs +3 -3
  88. package/dist/format-utils/index.js +156 -140
  89. package/dist/index.cjs +1 -1
  90. package/dist/index.js +157 -155
  91. package/dist/report-runtime-context/index.cjs +1 -1
  92. package/dist/report-runtime-context/index.js +2 -2
  93. package/dist/style.css +1 -1
  94. package/dist/surfboard/index.cjs +1 -1
  95. package/dist/surfboard/index.js +3 -3
  96. package/dist/types/analytics-protocol.d.ts +81 -11
  97. package/dist/types/briefings.d.ts +727 -19
  98. package/dist/types/dashboard-assistant.d.ts +37 -17
  99. package/dist/types/dashboard-authoring.d.ts +61 -14
  100. package/dist/types/dashboard.d.ts +137 -12
  101. package/dist/types/data-app-builder.d.ts +28 -2
  102. package/dist/types/data-app-codegen-node.d.ts +29 -3
  103. package/dist/types/data-app-codegen.d.ts +29 -3
  104. package/dist/types/data-app-sdk-adapters.d.ts +28 -2
  105. package/dist/types/data-app-sdk-validation.d.ts +51 -7
  106. package/dist/types/data-app-sdk.d.ts +55 -10
  107. package/dist/types/format-utils.d.ts +190 -3
  108. package/dist/types/index.cjs +1 -1
  109. package/dist/types/index.js +4 -4
  110. package/dist/types/main.d.ts +128 -33
  111. package/dist/types/shared.d.ts +14 -12
  112. package/dist/types/surfboard.d.ts +138 -13
  113. package/dist/types/types.d.ts +117 -23
  114. package/dist/types/value-format-preferences.d.ts +3 -0
  115. package/package.json +2 -1
  116. package/dist/chunks/card-config-utils-15sRtebL.cjs +0 -1
  117. package/dist/chunks/card-config-utils-BYZ5MJOh.js +0 -16
  118. package/dist/chunks/catalog-field-grounding-Bnx-3tE0.cjs +0 -1
  119. package/dist/chunks/catalog-field-grounding-S2jKwKGD.js +0 -100
  120. package/dist/chunks/dashboard-briefing-launcher-DDgDr2s3.cjs +0 -26
  121. package/dist/chunks/dashboard-date-comparison-definition-DZq0htjG.cjs +0 -1
  122. package/dist/chunks/dashboard-input-contract-DSt8dGzP.js +0 -18
  123. package/dist/chunks/dashboard-input-contract-DV3cshjz.cjs +0 -1
  124. package/dist/chunks/dashboard-json-CYtvwtvj.cjs +0 -1
  125. package/dist/chunks/edit-dashboard-visual-DwKcvlsF.cjs +0 -177
  126. package/dist/chunks/editor-action-buttons-BVmsk0Aj.cjs +0 -16
  127. package/dist/chunks/format-types-CSv0V7mm.cjs +0 -1
  128. package/dist/chunks/format-types-DZGgYj39.js +0 -1663
  129. package/dist/chunks/index-CJdxSyQq.js +0 -2578
  130. package/dist/chunks/index-DPv8_Ild.cjs +0 -1395
  131. package/dist/chunks/index-DRlMUglg.cjs +0 -4
  132. package/dist/chunks/metric-comparison-97zHGEx5.js +0 -387
  133. package/dist/chunks/metric-comparison-CUAJ8n4y.cjs +0 -1
  134. package/dist/chunks/pivot-result-lifecycle-BBabQ_da.js +0 -914
  135. package/dist/chunks/pivot-result-lifecycle-DPc0ANwk.cjs +0 -4
  136. package/dist/chunks/presentation-execution-BLfPTGX_.js +0 -637
  137. package/dist/chunks/presentation-execution-BTV-Q43g.cjs +0 -1
  138. package/dist/chunks/report-preferences-dialog-D9ZCGh9l.js +0 -691
  139. package/dist/chunks/report-preferences-dialog-DaqTEcac.cjs +0 -1
  140. package/dist/chunks/switch-Cjk6G06r.cjs +0 -138
  141. package/dist/chunks/temporal-bucket-BnPxGrAi.js +0 -446
  142. package/dist/chunks/temporal-bucket-authoring-CPTwHzvs.cjs +0 -1
  143. package/dist/chunks/temporal-bucket-authoring-CgOuakGW.js +0 -205
  144. package/dist/chunks/temporal-bucket-pMnV-4Nj.cjs +0 -1
  145. package/dist/chunks/temporal-result-owner-6peubmhU.js +0 -443
  146. package/dist/chunks/temporal-result-owner-f6-i65Fb.cjs +0 -1
  147. package/dist/chunks/validators-9D4KBqKD.cjs +0 -1
@@ -1,16 +0,0 @@
1
- "use strict";const J=require("./x-B6ghREd2.cjs"),v=require("react"),s=require("./switch-Cjk6G06r.cjs"),f=require("./index-DPv8_Ild.cjs"),e=require("react/jsx-runtime");require("./validators-9D4KBqKD.cjs");require("./analyze-result-contract-BHb7sUUW.cjs");require("../value-format-preferences/index.cjs");const ge=require("./search-BqqhaMx9.cjs"),Se=require("./save-3dYRmehL.cjs");/**
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 Fe=J.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"}]]);/**
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 je=J.createLucideIcon("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
12
- * @license lucide-react v0.453.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const ke=J.createLucideIcon("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);function Ve(r){const[a,l]=v.useState(null),[n,d]=v.useState(null),u=f.useEnsureReactGlobals();return v.useEffect(()=>{if(!r||r.trim()===""){l(null),d(null);return}if(!u)return;(async()=>{try{if(!r.startsWith("http://")&&!r.startsWith("https://"))throw new Error(`Invalid URL format: ${r}`);try{new URL(r)}catch{throw new Error(`Invalid URL: ${r}`)}const p=`${r.endsWith("/")?r:`${r}/`}index.js`;try{if(!(await fetch(p,{method:"HEAD"})).ok)throw new Error(`Module not found at ${p}`)}catch{}const C=await import(p);if(typeof C.useChartStore!="function")throw new Error("useChartStore is not a function");l(()=>C.useChartStore),d(null)}catch(x){const p=x instanceof Error?x.message:"Unknown error";console.error("Failed to load remote chart store:",p),d(p),l(null)}})()},[r,u]),a}function Ie(r,a){if(r.length===0)return"";const l=r.find(n=>{var d,u;return((d=n.customCardPreferences)==null?void 0:d.visualType)==="multiple"||!!((u=n.customCardPreferences)!=null&&u.dataInputCardIds)});if(l)return l.id;if(a){const n=r.find(d=>d.id===a);if(n){const d=n.tabTitle;if(d=="All__Header")return r[0].id;if(d&&d.endsWith("__Header")){const m=d.split("__")[0],x=r.find(p=>p.tabTitle===m);return x?x.id:r[0].id}return a}}return r[0].id}const Te=r=>{if(!r||!("detailTableBackup"in r))return r;const{detailTableBackup:a,...l}=r;return l};async function be(r,a,l,n,d="Opening library visual..."){if(!a||!l)throw new Error("Missing auth token or visual ID");const u=["resource-by-id","visual",l],m=n.getQueryData(u);if(m)return console.log("Using cached visual data for:",l),{data:m,fromCache:!0};console.log("Fetching visual data from network for:",l);const x=f.ue.loading(d,{position:"top-center"});try{const p=await fetch(`${r}/management/v1/visuals/${l}`,{headers:{Authorization:`Bearer ${a}`}});if(!p.ok)throw new Error("Failed to load visual");const C=await p.json();return n.setQueryData(u,C),f.ue.dismiss(x),{data:C,fromCache:!1}}catch(p){throw f.ue.dismiss(x),p}}function Ne(r){if(typeof r=="string")return JSON.parse(r);if(typeof r=="object")return r;throw new Error("Invalid frame object format")}function Le(r,a){var u,m;const l=(r==null?void 0:r.frameObject)??((u=r==null?void 0:r.visual)==null?void 0:u.frameObject);if(!l)return!1;const n=Ne(l);if(!(n!=null&&n.cards)||n.cards.length===0)return!1;const d=(m=n.cards)==null?void 0:m.find(x=>x.id===n.activeCardId);return d?(f.setupEditorWithCard({...a,frame:n,card:d,visualId:(r==null?void 0:r.id)||n.visualId}),!0):!1}function Ae(){const r=s.useEditorStore(n=>{var d;return((d=n.card.customCardPreferences)==null?void 0:d.url)||""}),a=Ve(r);return{getUpdatedFrame:v.useCallback(()=>{var T;f.flushPendingEditorDrafts();const{frame:n,card:d,isDevMode:u,isShowingVisual:m,selectedSchemaName:x,selectedDatamodelId:p,selectedDatabaseName:C,selectedTableName:y,selectedConnectionId:g}=s.useEditorStore.getState(),S=d.sql,D=(T=a==null?void 0:a.getState())==null?void 0:T.settings,k=s.buildSavedEditorCard(d,{isDevMode:u,cardSql:S,isShowingVisual:m,selectedSchemaName:x,selectedDatamodelId:p,selectedDatabaseName:C,selectedTableName:y,selectedConnectionId:g,remoteChartSettings:D,stripConfig:Te}),E=n.cards.map(O=>O.id===d.id?k:O);return{...n,cards:E,activeCardId:Ie(E,n.activeCardId)}},[a])}}function ae(){const{authToken:r,tokenProps:a}=f.useSemaphorContext(),l=f.useQueryClient(),n=f.useAddFrameWithFreshSemanticExecutionPayload(),d=f.useSelectedVisual(),{selectVisual:u}=f.useManagementActions(),{setFrame:m,setCard:x,setIsDevMode:p,initializeModeDrafts:C,setActiveTabCardId:y,updateDataSource:g,setQueryResultColumns:S,setSelectedConnectionId:D,setSelectedDatabaseName:k,setSelectedSchemaName:E,setSelectedTableName:T,setSelectedDatamodelId:O,setFilterValues:$,setInlineFilterValuesMap:U,setApplyFilters:R,clearEditorContext:W}=s.useEditorActions(),{setIsDashboardEditing:F,setIsVisualEditing:o,setSelectedFrameId:w,clearSelectedFrameId:Q}=s.useDashboardActions(),q=s.useDashboardStore(A=>A.selectedSheetId),Y=s.useDashboardStore(A=>A.selectedFrameId),H=s.useDashboardStore(A=>A.dashboard),X=s.useDashboardStore(A=>A.filterValues),B=s.useDashboardStore(A=>A.inlineFilterValuesMap),K=f.useVisualById((d==null?void 0:d.id)||"",{enabled:!!(d!=null&&d.id)&&!!(r!=null&&r.accessToken)}),Z=v.useCallback(async A=>{try{u(A),Q(),W();const{data:V,fromCache:P}=await be(a.apiServiceUrl,(r==null?void 0:r.accessToken)||"",A.id,l,"Opening library visual...");if(!Le(V,{setFrame:m,setCard:x,setIsDevMode:p,initializeModeDrafts:C,setActiveTabCardId:y,updateDataSource:g,setQueryResultColumns:S,setSelectedConnectionId:D,setSelectedDatabaseName:k,setSelectedSchemaName:E,setSelectedTableName:T,setSelectedDatamodelId:O,setFilterValues:$,setInlineFilterValuesMap:U,setApplyFilters:R,setIsDashboardEditing:F,setIsVisualEditing:o,dashboard:H,selectedSheetId:q,selectedFrameId:Y,filterValues:X,inlineFilterValuesMap:B}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:P}}catch(V){return console.error("Error editing visual:",V),{success:!1,error:"Failed to load visual for editing"}}},[r==null?void 0:r.accessToken,a.apiServiceUrl,l,u,m,x,F,o,p,C,y,g,S,D,k,E,T,O,$,U,R,W,Q,H,q,Y,X,B]),ne=v.useCallback(async A=>{var P;const V=_=>(f.ue.error(_),{success:!1,error:_});try{if(u(A),!q)return V("No sheet selected. Please select a sheet first.");const{data:_,fromCache:oe}=await be(a.apiServiceUrl,(r==null?void 0:r.accessToken)||"",A.id,l,"Adding visual to dashboard..."),re=(_==null?void 0:_.frameObject)??((P=_==null?void 0:_.visual)==null?void 0:P.frameObject);if(!re)return V("Visual has no frame data");const z=Ne(re);if(!(z!=null&&z.cards)||z.cards.length===0)return V("Visual frame is malformed");const te={...f.cloneLinkedFrameWithSourceMapping(z),visualId:A.id};return await n(q,te,"end"),F(!0),w(te.id),{success:!0,fromCache:oe}}catch(_){return console.error("Error adding visual:",_),V(_ instanceof Error?_.message:"Failed to add visual to dashboard")}},[r==null?void 0:r.accessToken,a.apiServiceUrl,l,u,q,F,w,n]);return{visual:K.data,isLoading:K.isLoading,isError:K.isError,error:K.error,handleEditLibraryVisual:Z,handleAddLibraryVisual:ne,getUpdatedFrame:Ae().getUpdatedFrame,refetch:K.refetch}}function _e(){const r=s.useEditorStore(m=>m.card.dataSource),{setSelectedConnectionId:a,setSelectedDatabaseName:l,setSelectedSchemaName:n,setSelectedTableName:d,setSelectedDatamodelId:u}=s.useEditorActions();v.useEffect(()=>{var D;if(!r)return;const{tableName:m,schemaName:x,databaseName:p,connectionId:C}=f.extractTableMetadata(r),y=(D=r.selectedEntities)==null?void 0:D[0],S=(y==null?void 0:y.type)==="model"&&"id"in y?y.id:"";a(C||""),l(p||""),n(x||""),d(m||""),u(S)},[r,a,l,n,d,u])}function Be(r,a){return{...r,sql:"",python:"",config:void 0,customCfg:"",preferences:{},interactionConfig:void 0,linkedInteractionTargetOverrides:void 0,dynamicCardPreferences:void 0,customCardPreferences:a?r.customCardPreferences:void 0,visualizationMode:"builtin",type:a?r.type:"bar"}}function Ee(){const{setTempQueryData:r}=s.useEditorActions(),a=f.useQueryClient(),l=s.useEditorStore(U=>U.tempQueryData),n=s.useEditorStore(U=>U.card),d=f.useEffectiveEditorCardType(),u=v.useMemo(()=>d!==n.type?{...n,type:d}:n,[n,d]),{queryKey:m}=f.useEditorCardQuery(u),{setCardSql:x,setSqlGen:p,setCardPython:C,setCardCustomCfg:y,setCardPreferences:g,clearQueryConfig:S,setCardConfig:D,setCardType:k,setFrame:E,setCard:T,setActiveTabCardId:O}=s.useEditorActions();function $(){var Q,q,Y,H;const U=a.getQueryData(m);l!=null&&l.queryData||r({queryKey:m,queryData:U}),a.setQueryData(m,null),a.removeQueries({queryKey:m,exact:!0}),x(""),p({}),S(),D(void 0),C(""),y(""),g({});const R=s.useEditorStore.getState().frame,W=s.useEditorStore.getState().card,F=f.findCustomVisualConfigCard(R,W),o=((Q=F==null?void 0:F.customCardPreferences)==null?void 0:Q.visualType)==="multiple"||!!((q=F==null?void 0:F.customCardPreferences)!=null&&q.dataInputCardIds)||(((Y=F==null?void 0:F.customCardPreferences)==null?void 0:Y.minInputs)||0)>1||(((H=F==null?void 0:F.customCardPreferences)==null?void 0:H.maxInputs)||0)>1,w=Be(W,o);E({...R,cards:R.cards.map(X=>X.id===w.id?w:X)}),O(w.id),T(w),o||k("bar")}return $}function qe({type:r,isLinked:a,className:l,showLabel:n=!1,showLocal:d=!1}){const u=s.useDashboardStore(E=>E.selectedFrameId),m=f.useManagementStore(E=>E.selectedVisual),x=s.useEditorStore(E=>E.frame);let p;if(r)p=r;else if(a!==void 0)p=a?"linked":"library";else if(!!!(x!=null&&x.visualId||m!=null&&m.id)&&u)p="local";else if(m&&!u)p="library";else if(x!=null&&x.visualId&&u)p="linked";else if(m!=null&&m.id&&u)p="library";else return null;if(p==="local"&&!d)return null;const C={local:"border-slate-200/70 bg-slate-50/80 text-slate-700 shadow-sm hover:bg-slate-100/80 dark:border-slate-700 dark:bg-slate-900/70 dark:text-slate-200 dark:hover:bg-slate-800/80",linked:"border-purple-200/70 bg-gradient-to-r from-purple-50/50 to-purple-100/30 text-purple-900 shadow-sm hover:from-purple-100/60 hover:to-purple-100/50 hover:shadow-md dark:border-purple-800/50 dark:from-purple-950/40 dark:to-purple-900/30 dark:text-purple-100 dark:hover:from-purple-950/60 dark:hover:to-purple-900/50",library:"border-blue-200/70 bg-gradient-to-r from-blue-50/50 to-blue-100/30 text-blue-900 shadow-sm hover:from-blue-100/60 hover:to-blue-100/50 hover:shadow-md dark:border-blue-800/50 dark:from-blue-950/40 dark:to-blue-900/30 dark:text-blue-100 dark:hover:from-blue-950/60 dark:hover:to-blue-900/50"},y={local:"Local to this dashboard: Changes made here only affect this dashboard copy.",linked:"Linked to library: Changes made here update the library visual and all linked instances.",library:"Library visual: Share and reuse this visual across multiple dashboards."},g={local:"border-slate-200 bg-slate-50 text-slate-900 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100",linked:"border-purple-200 bg-purple-50 text-purple-900 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-100",library:"border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-100"},S={local:"fill-slate-50 dark:fill-slate-900",linked:"fill-purple-50 dark:fill-purple-950",library:"fill-blue-50 dark:fill-blue-950"},D={local:e.jsx("span",{className:"h-2 w-2 rounded-full bg-current/70"}),linked:e.jsx(ke,{className:"h-3.5 w-3.5"}),library:e.jsx(je,{className:"h-3.5 w-3.5"})},k={local:"Local",linked:"Linked",library:"Library"};return e.jsx(s.TooltipProvider,{children:e.jsxs(s.Tooltip,{delayDuration:300,children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxs(f.Badge,{variant:"outline",className:s.cn("cursor-help select-none transition-all",C[p],l),children:[D[p],n&&e.jsx("span",{className:"ml-1 text-xs font-medium leading-none",children:k[p]})]})}),e.jsxs(s.TooltipContent,{side:"bottom",className:s.cn("max-w-xs",g[p]),children:[e.jsx(s.TooltipArrow,{className:S[p]}),e.jsx("p",{children:y[p]})]})]})})}function we(r){const{control:a,onChange:l}=r;return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(s.Label,{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Label"}),e.jsx(s.Input,{size:"xs",value:a.label,placeholder:"Control label",onChange:n=>l(n.target.value)})]})}function Me(r){const{currentStep:a,labels:l}=r;return e.jsx("div",{className:"sticky top-0 z-10 -mx-1 border-b border-border/60 bg-background/95 px-1 pb-2.5 pt-1 backdrop-blur supports-[backdrop-filter]:bg-background/85",children:e.jsx("div",{className:"flex flex-wrap items-center gap-2 sm:gap-2.5",children:l.map((n,d)=>{const u=d+1,m=u===a,x=u<a;return e.jsxs(v.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:s.cn("flex h-5 w-5 items-center justify-center rounded-full border text-[10px] font-medium tabular-nums",m?"border-foreground bg-foreground text-background":x?"border-foreground/30 bg-foreground/10 text-foreground":"border-border/60 bg-background text-muted-foreground"),children:u}),e.jsx("span",{className:s.cn("text-[12px]",m?"font-medium text-foreground":"text-muted-foreground"),children:n})]}),d<l.length-1?e.jsx("span",{className:"h-px w-4 bg-border/60 sm:w-6","aria-hidden":"true"}):null]},n)})})})}function se(r){const{secondary:a,tertiary:l,primary:n}=r;return e.jsxs("div",{className:"sticky bottom-0 z-10 -mx-1 flex justify-end gap-2 border-t bg-background/95 px-1 pb-1 pt-3 backdrop-blur supports-[backdrop-filter]:bg-background/85",children:[a,l,n]})}function Oe(r){const{control:a,scope:l,detail:n}=r;return e.jsxs("div",{className:"flex items-start gap-2.5 rounded-control border border-border/60 bg-muted/30 px-3 py-2.5",children:[e.jsx(f.CircleCheck,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-foreground"}),e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx("div",{className:"text-[13px] font-medium text-foreground",children:a.label}),e.jsxs("div",{className:"text-[12px] text-muted-foreground",children:[s.getFriendlyTypeOption(a.type).label," ·"," ",s.getControlOptionPreview(a)," ·"," ",s.getPlacementLabel(l,a.placement)]}),n?e.jsx("div",{className:"text-[12px] text-muted-foreground",children:n}):null]})]})}function ye(r){const{control:a,defaultValue:l,availableFieldChoices:n,availableMetricChoices:d,previewControlDefinitions:u,previewControlValues:m,onControlChange:x,onLabelChange:p,onDefaultValueChange:C,onBack:y,onNext:g,nextDisabled:S}=r;return e.jsxs("div",{className:"space-y-3",children:[e.jsx(we,{control:a,onChange:p}),e.jsx(f.ControlDefinitionOptionsEditor,{control:a,availableFieldChoices:n,availableMetricChoices:d,previewControlDefinitions:u,previewControlValues:m,controlLifecycle:"create",onChange:x}),e.jsx(f.ControlDefaultValueEditor,{control:a,value:l,onChange:C,allowNoDefault:!0,allowCardDefault:!0,hint:"This is the value viewers will see first.",previewControlDefinitions:u,previewControlValues:m}),e.jsx(se,{secondary:e.jsx(s.Button,{type:"button",variant:"outline",size:"xs",onClick:y,children:"Back"}),primary:e.jsx(s.Button,{type:"button",size:"xs",onClick:g,disabled:S,children:"Next"})})]})}const Ue=new Set(["grain_selector","aggregation_selector","field_selector","metric_selector"]);function ve(r){const{text:a,ariaLabel:l}=r,[n,d]=v.useState(!1);return e.jsxs("button",{type:"button","aria-label":l,onClick:async()=>{try{await navigator.clipboard.writeText(a),d(!0),setTimeout(()=>d(!1),1200)}catch(u){console.error("Failed to copy",u)}},className:"group flex w-full items-center justify-between gap-2 rounded-control bg-muted/40 px-2 py-1 text-left transition-colors hover:bg-muted/60 focus-visible:bg-muted/60 focus-visible:outline-none",children:[e.jsx("code",{className:"min-w-0 truncate font-mono text-[12px] text-foreground",children:a}),e.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",children:n?"Copied":"Click to copy"})]})}function Ce(r){const{control:a,scope:l,createdReference:n,explorerContent:d,sqlDescription:u,summaryDetail:m,onBack:x,onCancel:p,onDone:C}=r,y=Ue.has(a.type),g=n.match(/\[\[param\.(.+?)\]\]/),S=g?`{{ param('${g[1]}') }}`:"";return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Oe,{control:a,scope:l,detail:m}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[13px] font-medium text-foreground",children:"How cards use this control"}),e.jsxs("div",{className:"divide-y divide-border/60 overflow-hidden rounded-control border border-border/60",children:[y?e.jsxs("div",{className:"space-y-1 px-3 py-2.5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Explorer cards"}),e.jsx("div",{className:"text-[12px] text-muted-foreground",children:d})]}):null,e.jsxs("div",{className:"space-y-1.5 px-3 py-2.5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"SQL cards"}),e.jsx(ve,{text:n,ariaLabel:"Copy SQL control reference"}),S?e.jsx(ve,{text:S,ariaLabel:"Copy Jinja control reference"}):null,e.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[u," ",e.jsx("a",{href:"https://docs.semaphor.cloud/docs/concepts/template-expressions",target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 hover:text-foreground",children:"Template expressions docs"}),"."]})]})]})]}),e.jsx(se,{secondary:e.jsx(s.Button,{type:"button",variant:"outline",size:"xs",onClick:x,children:"Back"}),tertiary:e.jsx(s.Button,{type:"button",variant:"outline",size:"xs",onClick:p,children:"Cancel"}),primary:e.jsx(s.Button,{type:"button",size:"xs",onClick:C,children:"Done"})})]})}function ze(r){const a=s.createBlankControl(r.scope,r.existingControls,r.reservedIds),l=r.type===a.type?{...a,label:s.DEFAULT_LABEL_BY_TYPE[r.type]}:{...s.applyControlTypeChange({controls:[{...a,label:s.DEFAULT_LABEL_BY_TYPE[r.type]}],controlId:a.id,nextType:r.type}).controls[0],label:s.DEFAULT_LABEL_BY_TYPE[r.type]};return{step:2,control:l,defaultValue:s.getDefaultValueForType(l,void 0)}}function Re({scope:r,controls:a,reservedControlIds:l,defaultValues:n,onChange:d,emptyMessage:u,initialCreateFlow:m=!1,usageByControlId:x,availableFieldChoices:p,availableMetricChoices:C,structuralParticipants:y,structuralParticipantIdsByControlId:g,card:S,allowedControlTypes:D,onCreateFlowActiveChange:k,onCreateFlowComplete:E}){const T=v.useMemo(()=>new Set(l||[]),[l]),O=s.getPlacementOptionsForScope(r),$=s.getDefaultPlacement(r),[U,R]=v.useState(null),[W,F]=v.useState(null),[o,w]=v.useState(()=>m?{step:1,control:s.createBlankControl(r,a,Array.from(T))}:null),Q=v.useRef({}),q=v.useRef(void 0),Y=v.useRef(m),H=v.useMemo(()=>{const t=s.getFriendlyControlTypeOptions({scope:r,card:S});if(!D)return t;const c=new Set(D);return t.filter(i=>c.has(i.value))},[D,S,r]),X=v.useCallback(t=>{const c=s.getFriendlyControlTypeOptions({scope:r,card:S,includeType:D?void 0:t});if(!D)return c;const i=new Set(D);return c.filter(h=>i.has(h.value))},[D,S,r]),B=v.useCallback(t=>r==="dashboard"&&(t==="field_selector"||t==="metric_selector"),[r]),K=v.useMemo(()=>o?s.getEligibleParticipantsForStructuralControl(y||[],o.control.type):[],[o,y]),Z=v.useMemo(()=>{if(!o)return{fields:p||[],metrics:C||[]};if(!B(o.control.type))return{fields:p||[],metrics:C||[]};const t=o.selectedCardIds||[],c=s.getCompatibleStructuralChoiceCatalog({controlType:o.control.type,participants:y||[],selectedCardIds:t});return{fields:o.control.type==="field_selector"?c.choices.map(i=>({option:i,target:c.fieldTargetMap[i.value]})):[],metrics:o.control.type==="metric_selector"?c.choices.map(i=>({option:i,target:c.metricTargetMap[i.value]})):[]}},[p,C,o,B,y]);v.useEffect(()=>{k==null||k(!!o)},[o,k]),v.useEffect(()=>{const t=m&&!Y.current;Y.current=m,t&&(w({step:1,control:s.createBlankControl(r,a,Array.from(T))}),F(null),R(null))},[a,m,T,r]);const ne=t=>{if(!B(t.type))return{fields:p||[],metrics:C||[]};const c=(g==null?void 0:g[t.id])||[];if(c.length===0)return{fields:p||[],metrics:C||[]};const i=s.getCompatibleStructuralChoiceCatalog({controlType:t.type,participants:y||[],selectedCardIds:c});return{fields:t.type==="field_selector"?i.choices.map(h=>({option:h,target:i.fieldTargetMap[h.value]})):[],metrics:t.type==="metric_selector"?i.choices.map(h=>({option:h,target:i.metricTargetMap[h.value]})):[]}},A=t=>{if(!B(t.control.type))return{nextControl:t.control,cardBindingsById:void 0};const c=(g==null?void 0:g[t.control.id])||[],i=s.getCompatibleStructuralChoiceCatalog({controlType:t.control.type,participants:y||[],selectedCardIds:t.nextSelectedCardIds}),h=s.reconcileStructuralControlChoices({control:t.control,choices:i.choices}),j=Object.fromEntries(c.filter(N=>!t.nextSelectedCardIds.includes(N)).map(N=>[N,void 0]));return t.nextSelectedCardIds.length>0&&h.source.kind==="manual"&&h.source.options.length>0&&Object.assign(j,s.buildStructuralControlBindingsForParticipants({control:h,participants:y||[],selectedCardIds:t.nextSelectedCardIds})),{nextControl:h,cardBindingsById:j}},V=v.useCallback((t,c=n,i={type:"update"})=>{const h=t.map(j=>(s.resolveAuthoringControlDefaultValue({control:j,defaultValues:c}),s.syncSqlQueryControlExecutionRequirement(j)));d(h,c,i)},[n,d]),P=(t,c)=>{const i=a.find(L=>L.id===t);let h=a.map(L=>L.id!==t?L:c(L));const j=h.find(L=>L.id===t);let N,b;if(j&&r==="dashboard"&&(j.type==="field_selector"||j.type==="metric_selector")){const L=(g==null?void 0:g[j.id])||[],ee=A({control:j,nextSelectedCardIds:L});h=h.map(G=>G.id===t?ee.nextControl:G),N=ee.cardBindingsById,b=[j.id]}else if(i&&r==="dashboard"&&(i.type==="field_selector"||i.type==="metric_selector")){const L=(g==null?void 0:g[i.id])||[];N=Object.fromEntries(L.map(ee=>[ee,void 0])),b=[i.id]}const I=h.find(L=>L.id===t);let M=n;if(i&&I){const L=s.resolveAuthoringControlDefaultValue({control:i,defaultValues:n});i.source.kind==="manual"&&I.source.kind==="sql_query"&&(Q.current[t]=L);const ee=L===void 0&&i.source.kind==="sql_query"&&I.source.kind==="manual"?Q.current[t]:L,G=s.getNextEditedControlDefaultValue({previousControl:i,nextControl:I,currentDefaultValue:ee});I.source.kind==="manual"&&(Q.current[t]=G),n&&(M={...n},G===void 0?delete M[t]:M[t]=G),h=h.map(xe=>xe.id===t?{...I,defaultValue:G}:xe)}V(h,M,{type:"update",cardBindingsById:N,affectedBindingControlIds:b})},_=(t,c)=>{if(!c.trim())return;const i=f.normalizeDashboardInputVariableName(c);if(i===t||T.has(i)||a.some(N=>N.id===i&&N.id!==t))return;const h=a.map(N=>N.id===t?{...N,id:i}:N);if(!n){V(h,void 0,{type:"rename",oldId:t,newId:i});return}const j={...n};Object.prototype.hasOwnProperty.call(j,t)&&(j[i]=j[t],delete j[t]),V(h,j,{type:"rename",oldId:t,newId:i})},oe=t=>{const c=a.filter(h=>h.id!==t);if(!n){V(c,void 0,{type:"remove",controlId:t});return}const i={...n};delete i[t],V(c,i,{type:"remove",controlId:t})},re=v.useCallback(()=>{q.current=void 0,w({step:1,control:s.createBlankControl(r,a,Array.from(T))}),F(null),R(null)},[a,T,r]),z=t=>{w(c=>c&&(()=>{const i=t(c.control);c.control.source.kind==="manual"&&i.source.kind==="sql_query"&&(q.current=c.defaultValue);const h=c.defaultValue===void 0&&c.control.source.kind==="sql_query"&&i.source.kind==="manual"?q.current:c.defaultValue,j=s.getNextEditedControlDefaultValue({previousControl:c.control,nextControl:i,currentDefaultValue:h});return i.source.kind==="manual"&&(q.current=j),{...c,control:i,defaultValue:j}})())},te=t=>{w(c=>c&&(c.control.source.kind==="manual"&&(q.current=t),{...c,defaultValue:t}))},le=(()=>{if(!o)return!1;if(o.step===2&&B(o.control.type))return(o.selectedCardIds||[]).length>0;if(o.step!==2&&o.step!==3||!o.control.label.trim())return!1;const c=o.control.source.kind==="sql_query"?o.control:s.ensureManualSource(o.control);if(c.source.kind==="manual"&&(s.needsManualOptions(c)&&c.source.options.length===0||c.source.options.some(h=>h.label.trim().length===0||h.value.trim().length===0)))return!1;if(c.source.kind==="sql_query"){const{connectionId:i,sql:h,valueColumn:j}=c.source;return i.trim().length>0&&h.trim().length>0&&j.trim().length>0}return s.hasConcreteDefaultValue(s.getDefaultValueForType(c,o.defaultValue))})(),pe=()=>{var N;if(!o)return;const t=s.ensureManualSource(o.control),c=s.deriveUniqueControlId({label:t.label,fallbackId:t.id,existingControls:a,reservedIds:Array.from(T)}),i={...t,id:c},h=r==="dashboard"&&(i.type==="field_selector"||i.type==="metric_selector")&&((N=o.selectedCardIds)!=null&&N.length)?s.buildStructuralControlBindingsForParticipants({control:i,participants:y||[],selectedCardIds:o.selectedCardIds}):void 0,j=s.getDefaultValueForType(i,o.defaultValue);w({step:r==="dashboard"&&(i.type==="field_selector"||i.type==="metric_selector")?4:3,control:i,defaultValue:j,createdControlId:c,selectedCardIds:o.selectedCardIds,cardBindingsById:h})},ie=v.useCallback(()=>{w(null)},[]),me=v.useCallback(()=>{if(!(o!=null&&o.createdControlId)){w(null);return}const t=o.control,c=o.createdControlId,i=s.getDefaultValueForType(t,o.defaultValue);if(n){const h={...n};i===void 0?delete h[c]:h[c]=i,V([...a,{...t,defaultValue:i}],h,{type:"add",cardBindingsById:o.cardBindingsById})}else V([...a,{...t,defaultValue:i}],void 0,{type:"add",cardBindingsById:o.cardBindingsById});F(c),w(null),E==null||E()},[a,o,n,V,E]),De=o?B(o.control.type)?["Choose type","Select cards","Configure","Finish"]:["Choose type","Configure","Finish"]:[],fe=o!=null&&o.createdControlId?`[[param.${o.createdControlId}]]`:o?`[[param.${s.slugifyControlValue(o.control.label)||o.control.id}]]`:"",de=s.buildAuthoringPreviewControlValues({controls:a,defaultValues:n}),ce=o?[...a,o.control]:a,he=o?s.buildAuthoringPreviewControlValues({controls:ce,defaultValues:n,overrides:[{controlId:o.control.id,value:o.defaultValue}]}):de;return e.jsxs("div",{className:"space-y-4",children:[o?e.jsxs("div",{className:"space-y-4 pb-1",children:[e.jsx(Me,{currentStep:o.step,labels:De}),o.step===1&&(()=>{const t=new Set(["grain_selector","aggregation_selector","field_selector","metric_selector"]),c=new Set(["date","text"]),i=H.filter(N=>!t.has(N.value)&&!c.has(N.value)),h=H.filter(N=>t.has(N.value)),j=N=>e.jsxs("button",{type:"button",className:"rounded-control border border-border/60 bg-background px-3 py-2.5 text-left transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:outline-none",onClick:()=>w(ze({scope:r,existingControls:a,reservedIds:Array.from(T),type:N.value})),children:[e.jsx("div",{className:"text-[13px] font-medium text-foreground",children:N.label}),e.jsx("p",{className:"mt-0.5 text-[12px] text-muted-foreground",children:N.description})]},N.value);return e.jsxs("div",{className:"space-y-4",children:[r==="card"&&(S==null?void 0:S.sql)==null?e.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Explorer cards support displayed metric, group by field, aggregation, and time grain controls here."}):null,i.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Input controls"}),e.jsx("div",{className:"grid gap-1.5 sm:grid-cols-2",children:i.map(j)})]}),h.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Data-driven controls"}),e.jsx("div",{className:"grid gap-1.5 sm:grid-cols-2",children:h.map(j)})]}),e.jsx(se,{secondary:e.jsx(s.Button,{type:"button",variant:"outline",size:"xs",onClick:ie,children:"Back to controls"})})]})})(),o.step===2&&B(o.control.type)&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(we,{control:o.control,onChange:t=>z(c=>({...c,label:t}))}),e.jsx("p",{className:"text-[12px] text-muted-foreground",children:"Choose which cards should respond to this shared control."})]}),K.length===0?e.jsx("div",{className:"rounded-control border border-border/60 bg-muted/30 px-3 py-2.5 text-[12px] text-muted-foreground",children:"No eligible cards are available yet. Add compatible metrics or group-by fields to cards first."}):e.jsx("div",{className:"space-y-1 rounded-control border border-border/60 bg-background p-2",children:K.map(t=>{const c=(o.selectedCardIds||[]).includes(t.cardId);return e.jsxs("label",{className:"flex items-start gap-2 rounded-control px-1.5 py-1 text-[13px] hover:bg-muted/40",children:[e.jsx(f.Checkbox,{checked:c,onCheckedChange:i=>w(h=>h&&{...h,selectedCardIds:i===!0?[...h.selectedCardIds||[],t.cardId]:(h.selectedCardIds||[]).filter(j=>j!==t.cardId)})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"font-medium text-foreground",children:t.title}),e.jsx("div",{className:"text-[12px] text-muted-foreground",children:o.control.type==="field_selector"?`${t.fieldChoices.length} compatible group-by fields`:`${t.metricChoices.length} compatible metrics`})]})]},t.cardId)})}),e.jsx(se,{secondary:e.jsx(s.Button,{type:"button",variant:"outline",size:"xs",onClick:()=>w(t=>t&&{...t,step:1,selectedCardIds:[]}),children:"Back"}),primary:e.jsx(s.Button,{type:"button",size:"xs",onClick:()=>w(t=>t&&{...t,step:3}),disabled:!le,children:"Next"})})]}),o.step===2&&!B(o.control.type)&&e.jsx(ye,{control:o.control,defaultValue:o.defaultValue,availableFieldChoices:Z.fields,availableMetricChoices:Z.metrics,previewControlDefinitions:ce,previewControlValues:he,onControlChange:t=>z(()=>t),onLabelChange:t=>z(c=>({...c,label:t})),onDefaultValueChange:te,onBack:()=>w(t=>t&&{...t,step:1}),onNext:pe,nextDisabled:!le}),o.step===3&&B(o.control.type)&&e.jsx(ye,{control:o.control,defaultValue:o.defaultValue,availableFieldChoices:Z.fields,availableMetricChoices:Z.metrics,previewControlDefinitions:ce,previewControlValues:he,onControlChange:t=>z(()=>t),onLabelChange:t=>z(c=>({...c,label:t})),onDefaultValueChange:te,onBack:()=>w(t=>t&&{...t,step:2}),onNext:pe,nextDisabled:!le}),o.step===3&&!B(o.control.type)&&e.jsx(Ce,{control:o.control,scope:r,createdReference:fe,explorerContent:e.jsxs(e.Fragment,{children:["Open the card and use"," ",e.jsx("span",{className:"font-medium text-foreground",children:"Settings → Controls"})," ","to choose what this control changes."]}),sqlDescription:"Reference this control directly in the SQL editor.",onBack:()=>w(t=>t&&{...t,step:2}),onCancel:ie,onDone:me}),o.step===4&&B(o.control.type)&&e.jsx(Ce,{control:o.control,scope:r,createdReference:fe,summaryDetail:e.jsxs(e.Fragment,{children:["Used by ",(o.selectedCardIds||[]).length," selected card",(o.selectedCardIds||[]).length===1?"":"s"]}),explorerContent:e.jsx(e.Fragment,{children:"Selected cards have been set up to respond to this control automatically."}),sqlDescription:"SQL cards can still reference this control directly in the SQL editor.",onBack:()=>w(t=>t&&{...t,step:3}),onCancel:ie,onDone:me})]}):null,!o&&a.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-sm text-muted-foreground",children:u}):null,!o&&a.map(t=>{const c=ne(t),i=x==null?void 0:x[t.id],h=s.resolveAuthoringControlDefaultValue({control:t,defaultValues:n}),j=W===t.id,N="inline-flex shrink-0 items-center rounded-[4px] border border-border/60 bg-muted/40 px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground";return e.jsxs("div",{className:"rounded-control border border-border/60",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[e.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-start gap-2 rounded-control text-left focus:outline-none focus-visible:bg-muted/40",onClick:()=>F(b=>b===t.id?null:t.id),children:[j?e.jsx(J.ChevronDown,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}):e.jsx(ge.ChevronRight,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-[13px] font-medium text-foreground",children:t.label||"Untitled control"}),e.jsx("span",{className:N,children:s.getFriendlyTypeOption(t.type).label}),e.jsx("span",{className:N,children:s.getPlacementLabel(r,t.placement)})]}),e.jsxs("div",{className:"mt-0.5 text-[12px] text-muted-foreground",children:[s.getControlOptionPreview(t),i!=null&&i.status?` · ${i.status}`:""]})]})]}),e.jsx(s.Button,{type:"button",size:"xs",variant:"ghost",className:"h-7 w-7 shrink-0 p-0 text-muted-foreground",onClick:()=>oe(t.id),"aria-label":`Remove ${t.label}`,children:e.jsx(f.Trash2,{className:"h-3.5 w-3.5"})})]}),j&&e.jsxs("div",{className:"space-y-4 border-t border-border/60 px-3 py-3",children:[e.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(s.Label,{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Label"}),e.jsx(s.Input,{size:"xs",value:t.label,placeholder:"Control label",onChange:b=>P(t.id,I=>({...I,label:b.target.value}))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(s.Label,{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Type"}),e.jsxs(s.Select,{value:t.type,onValueChange:b=>{const I=s.applyControlTypeChange({controls:a,controlId:t.id,nextType:b,defaultValues:n});V(I.controls,I.defaultValues)},children:[e.jsx(s.SelectTrigger,{size:"xs",children:e.jsx(s.SelectValue,{})}),e.jsx(s.SelectContent,{children:X(t.type).map(b=>e.jsx(s.SelectItem,{value:b.value,children:b.label},b.value))})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(s.Label,{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Show in"}),e.jsxs(s.Select,{value:t.placement||$,onValueChange:b=>P(t.id,I=>({...I,placement:b})),children:[e.jsx(s.SelectTrigger,{size:"xs",children:e.jsx(s.SelectValue,{})}),e.jsx(s.SelectContent,{children:O.map(b=>e.jsx(s.SelectItem,{value:b.value,children:b.label},b.value))})]})]})]}),B(t.type)?e.jsx(f.StructuralParticipantSelector,{type:t.type,participants:s.getEligibleParticipantsForStructuralControl(y||[],t.type).map(b=>({cardId:b.cardId,title:b.title,choiceCount:t.type==="field_selector"?b.fieldChoices.length:b.metricChoices.length})),selectedCardIds:(g==null?void 0:g[t.id])||[],onChange:b=>{const I=A({control:t,nextSelectedCardIds:b}),M=a.map(L=>L.id===t.id?I.nextControl:L);V(M,n,{type:"update",cardBindingsById:I.cardBindingsById})}}):null,e.jsx(f.ControlDefinitionOptionsEditor,{control:t,availableFieldChoices:c.fields,availableMetricChoices:c.metrics,previewControlDefinitions:a,previewControlValues:de,controlLifecycle:"edit",onChange:b=>P(t.id,()=>b)}),t.initialValueStrategy==="saved_default"&&e.jsx(f.ControlDefaultValueEditor,{control:t,value:h,allowNoDefault:!0,allowCardDefault:!0,previewControlDefinitions:a,previewControlValues:de,onChange:b=>{const I=a.map(M=>M.id===t.id?{...M,defaultValue:b}:M);if(t.source.kind==="manual"&&(Q.current[t.id]=b),n){const M={...n};b===void 0?delete M[t.id]:M[t.id]=b,V(I,M);return}V(I,void 0)}}),e.jsxs(f.Collapsible,{open:U===t.id,onOpenChange:b=>R(b?t.id:null),children:[e.jsx(f.CollapsibleTrigger,{asChild:!0,children:e.jsxs(s.Button,{type:"button",variant:"ghost",size:"xs",className:"-ml-2 gap-1 text-muted-foreground hover:text-foreground",children:[U===t.id?e.jsx(J.ChevronDown,{className:"h-3.5 w-3.5"}):e.jsx(ge.ChevronRight,{className:"h-3.5 w-3.5"}),"Advanced"]})}),e.jsxs(f.CollapsibleContent,{className:"space-y-3 pt-2",children:[e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(s.Label,{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Variable name"}),e.jsx(f.ControlIdInput,{controlId:t.id,onCommit:b=>_(t.id,b)},t.id)]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(s.Label,{className:"text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",children:"Initial value"}),e.jsxs(s.Select,{value:t.initialValueStrategy,onValueChange:b=>P(t.id,I=>({...I,initialValueStrategy:b})),children:[e.jsx(s.SelectTrigger,{size:"xs",children:e.jsx(s.SelectValue,{})}),e.jsx(s.SelectContent,{children:s.INITIAL_VALUE_STRATEGY_OPTIONS.map(b=>e.jsx(s.SelectItem,{value:b.value,children:b.label},b.value))})]})]})]}),e.jsx(f.ControlVisibilitySettings,{control:t,onChange:b=>P(t.id,()=>b)})]})]})]})]},t.id)}),!o&&e.jsxs(s.Button,{type:"button",variant:"outline",size:"xs",onClick:re,children:[e.jsx(f.Plus,{className:"h-3.5 w-3.5"}),"Add control"]})]})}function Qe(r){const{open:a,onOpenChange:l,initialCreateFlowActive:n=!1,dismissMode:d="passive"}=r,u=a!==void 0,[m,x]=v.useState(!1),[p,C]=v.useState(n),y=u?a:m,g=v.useCallback(k=>{!k&&p&&d==="passive"||(u||x(k),k||C(!1),l==null||l(k))},[u,p,d,l]),S=v.useCallback(()=>{u||x(!1),C(!1),l==null||l(!1)},[u,l]);v.useEffect(()=>{y||C(!1)},[y]);const D=v.useCallback(k=>{p&&k.preventDefault()},[p]);return{forceClose:S,handleOpenChange:g,isCreateFlowActive:p,preventPassiveDismissDuringCreate:D,resolvedOpen:y,setIsCreateFlowActive:C}}function ue(r){const a=s.getDynamicFrameSaveIssue(r);return a?(f.ue.error(a),!1):!0}function Pe({className:r,variant:a="outline"}){const l=s.useEditorStore(u=>u.onSave),{getUpdatedFrame:n}=ae();function d(){const u=n();ue(u)&&(l==null||l(u))}return e.jsxs(s.Button,{onClick:d,className:r,size:"xs",variant:a,children:[e.jsx(s.Check,{className:"h-3.5 w-3.5"}),"Accept"]})}function $e({className:r,variant:a="default"}){const l=f.useQueryClient(),[n,d]=v.useState(!1),{setIsVisualEditing:u}=s.useDashboardActions(),{getUpdatedFrame:m}=ae(),x=f.useSelectedVisual(),p=s.useEditorStore(g=>g.frame),C=f.useUpdateVisualMutation(),y=()=>{const g=m();if(!ue(g))return;const S=(p==null?void 0:p.visualId)||(x==null?void 0:x.id);if(!S){f.ue.error("No visual to save");return}d(!0),C.mutate({visualId:S,data:{frameObject:g}},{onSuccess:()=>{d(!1),f.ue.success("Visual updated successfully"),l.invalidateQueries({queryKey:["resource-by-id","visual",S],exact:!0})},onError:()=>{d(!1),f.ue.error("Failed to update visual")}})};return e.jsx(s.Button,{onClick:y,className:r,size:"xs",variant:a,children:n?e.jsxs(e.Fragment,{children:[e.jsx(s.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving"]}):e.jsxs(e.Fragment,{children:[e.jsx(Se.Save,{className:"h-3.5 w-3.5"}),"Save to Library"]})})}function Ye({className:r}){const a=f.useQueryClient(),[l,n]=v.useState(!1),d=f.useSelectedVisual(),u=s.useEditorStore(k=>k.frame),m=s.useDashboardStore(k=>k.selectedSheetId),x=s.useDashboardStore(k=>k.dashboard),{updateFrame:p,setIsVisualEditing:C}=s.useDashboardActions(),{getUpdatedFrame:y}=ae(),g=f.useUpdateVisualMutation(),S=f.useResolveExistingFrameSemanticExecutionPayload(),D=async()=>{if(!m){f.ue.error("No sheet selected");return}const k=(u==null?void 0:u.visualId)||(d==null?void 0:d.id);if(!k){f.ue.error("No visual to update");return}n(!0);try{const E=y();if(!ue(E)){n(!1);return}const T={...E,visualId:k},O=s.findDashboardFrameById(x,T.id),$=await S(T,{previousFrame:O});await g.mutateAsync({visualId:k,data:{frameObject:E}}),p(m,T,{semanticExecutionPayload:$}),a.invalidateQueries({queryKey:["visuals"]}),a.invalidateQueries({queryKey:["visual",k]}),f.ue.success("Saved to library and applied locally"),setTimeout(()=>{C(!1)},300)}catch(E){console.error("Failed to save and apply:",E),f.ue.error(E instanceof Error?E.message:"Failed to save and apply changes")}finally{n(!1)}};return e.jsx(s.Button,{onClick:D,className:r,size:"xs",variant:"default",disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx(s.LoaderCircle,{className:"h-3.5 w-3.5 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Se.Save,{className:"h-3.5 w-3.5"}),"Save & Apply"]})})}function He({className:r}){const{setTempQueryData:a,setSqlGen:l}=s.useEditorActions(),n=f.useQueryClient(),d=s.useEditorStore(g=>g.tempQueryData),u=s.useEditorStore(g=>g.onClose),m=s.useEditorStore(g=>g.card),x=f.useEffectiveEditorCardType(),p=v.useMemo(()=>x!==m.type?{...m,type:x}:m,[m,x]),{queryKey:C}=f.useEditorCardQuery(p);function y(){if(d){const{queryKey:g,queryData:S}=d;g&&S&&n.setQueryData(g,S)}l({}),u==null||u()}return e.jsxs(s.Button,{onClick:y,className:r,size:"xs",variant:"outline",children:[e.jsx(J.X,{className:"h-3.5 w-3.5"}),"Close"]})}function Ke({label:r="Clear",variant:a="secondary",className:l}={}){const n=Ee();return e.jsxs(s.Button,{onClick:n,className:l,size:"xs",variant:a,children:[e.jsx(J.X,{className:"h-3.5 w-3.5"}),r]})}exports.ControlDefinitionListEditor=Re;exports.EditorAcceptButton=Pe;exports.EditorCancelButton=He;exports.EditorClearButton=Ke;exports.FilterX=Fe;exports.Library=je;exports.Link2=ke;exports.VisualBadge=qe;exports.VisualSaveAndApplyButton=Ye;exports.VisualSaveButton=$e;exports.useCreateFlowOverlayState=Qe;exports.useEditorClearAction=Ee;exports.useSyncLegacyEditorState=_e;exports.useVisualUtils=ae;
@@ -1 +0,0 @@
1
- "use strict";const ye={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"}},be=(e,t,n)=>{let r;const a=ye[e];return typeof a=="string"?r=a:t===1?r=a.one:r=a.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function C(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const De={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Me={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Te={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Oe={date:C({formats:De,defaultWidth:"full"}),time:C({formats:Me,defaultWidth:"full"}),dateTime:C({formats:Te,defaultWidth:"full"})},xe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ye=(e,t,n,r)=>xe[e];function N(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,s=n!=null&&n.width?String(n.width):o;a=e.formattingValues[s]||e.formattingValues[o]}else{const o=e.defaultWidth,s=n!=null&&n.width?String(n.width):e.defaultWidth;a=e.values[s]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return a[i]}}const Ne={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Pe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},pe={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"]},ke={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"]},We={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"}},ve={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"}},Se=(e,t)=>{const n=Number(e),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"},Ie={ordinalNumber:Se,era:N({values:Ne,defaultWidth:"wide"}),quarter:N({values:Pe,defaultWidth:"wide",argumentCallback:e=>e-1}),month:N({values:pe,defaultWidth:"wide"}),day:N({values:ke,defaultWidth:"wide"}),dayPeriod:N({values:We,defaultWidth:"wide",formattingValues:ve,defaultFormattingWidth:"wide"})};function P(e){return(t,n={})=>{const r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(a);if(!i)return null;const o=i[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?Fe(s,w=>w.test(o)):Ce(s,w=>w.test(o));let f;f=e.valueCallback?e.valueCallback(c):c,f=n.valueCallback?n.valueCallback(f):f;const m=t.slice(o.length);return{value:f,rest:m}}}function Ce(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Fe(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Ee(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const a=r[0],i=t.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const s=t.slice(a.length);return{value:o,rest:s}}}const He=/^(\d+)(th|st|nd|rd)?/i,_e=/\d+/i,Xe={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},$e={any:[/^b/i,/^(a|c)/i]},Le={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ze={any:[/1/i,/2/i,/3/i,/4/i]},Ue={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},qe={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]},Ze={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},Ae={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]},je={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},Re={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}},Qe={ordinalNumber:Ee({matchPattern:He,parsePattern:_e,valueCallback:e=>parseInt(e,10)}),era:P({matchPatterns:Xe,defaultMatchWidth:"wide",parsePatterns:$e,defaultParseWidth:"any"}),quarter:P({matchPatterns:Le,defaultMatchWidth:"wide",parsePatterns:ze,defaultParseWidth:"any",valueCallback:e=>e+1}),month:P({matchPatterns:Ue,defaultMatchWidth:"wide",parsePatterns:qe,defaultParseWidth:"any"}),day:P({matchPatterns:Ze,defaultMatchWidth:"wide",parsePatterns:Ae,defaultParseWidth:"any"}),dayPeriod:P({matchPatterns:je,defaultMatchWidth:"any",parsePatterns:Re,defaultParseWidth:"any"})},ue={code:"en-US",formatDistance:be,formatLong:Oe,formatRelative:Ye,localize:Ie,match:Qe,options:{weekStartsOn:0,firstWeekContainsDate:1}};let Ge={};function O(){return Ge}const ce=6048e5,Be=864e5,Ve=6e4,Je=36e5,Ke=43200,et=1440;function g(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function j(e){const t=g(e);return t.setHours(0,0,0,0),t}function $(e){const t=g(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function tt(e,t){const n=j(e),r=j(t),a=+n-$(n),i=+r-$(r);return Math.round((a-i)/Be)}function b(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function nt(e){const t=g(e),n=b(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function rt(e){const t=g(e);return tt(t,nt(t))+1}function p(e,t){var s,c,f,m;const n=O(),r=(t==null?void 0:t.weekStartsOn)??((c=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((m=(f=n.locale)==null?void 0:f.options)==null?void 0:m.weekStartsOn)??0,a=g(e),i=a.getDay(),o=(i<r?7:0)+i-r;return a.setDate(a.getDate()-o),a.setHours(0,0,0,0),a}function k(e){return p(e,{weekStartsOn:1})}function fe(e){const t=g(e),n=t.getFullYear(),r=b(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const a=k(r),i=b(e,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const o=k(i);return t.getTime()>=a.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}function at(e){const t=fe(e),n=b(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),k(n)}function it(e){const t=g(e),n=+k(t)-+at(t);return Math.round(n/ce)+1}function de(e,t){var m,w,x,Y;const n=g(e),r=n.getFullYear(),a=O(),i=(t==null?void 0:t.firstWeekContainsDate)??((w=(m=t==null?void 0:t.locale)==null?void 0:m.options)==null?void 0:w.firstWeekContainsDate)??a.firstWeekContainsDate??((Y=(x=a.locale)==null?void 0:x.options)==null?void 0:Y.firstWeekContainsDate)??1,o=b(e,0);o.setFullYear(r+1,0,i),o.setHours(0,0,0,0);const s=p(o,t),c=b(e,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const f=p(c,t);return n.getTime()>=s.getTime()?r+1:n.getTime()>=f.getTime()?r:r-1}function ot(e,t){var s,c,f,m;const n=O(),r=(t==null?void 0:t.firstWeekContainsDate)??((c=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:c.firstWeekContainsDate)??n.firstWeekContainsDate??((m=(f=n.locale)==null?void 0:f.options)==null?void 0:m.firstWeekContainsDate)??1,a=de(e,t),i=b(e,0);return i.setFullYear(a,0,r),i.setHours(0,0,0,0),p(i,t)}function st(e,t){const n=g(e),r=+p(n,t)-+ot(n,t);return Math.round(r/ce)+1}function u(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const y={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return u(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):u(n+1,2)},d(e,t){return u(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){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(e,t){return u(e.getHours()%12||12,t.length)},H(e,t){return u(e.getHours(),t.length)},m(e,t){return u(e.getMinutes(),t.length)},s(e,t){return u(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return u(a,t.length)}},M={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},R={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){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(e,t,n){if(t==="yo"){const r=e.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return y.y(e,t)},Y:function(e,t,n,r){const a=de(e,r),i=a>0?a:1-a;if(t==="YY"){const o=i%100;return u(o,2)}return t==="Yo"?n.ordinalNumber(i,{unit:"year"}):u(i,t.length)},R:function(e,t){const n=fe(e);return u(n,t.length)},u:function(e,t){const n=e.getFullYear();return u(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return u(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(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return u(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(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return y.M(e,t);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(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return u(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(e,t,n,r){const a=st(e,r);return t==="wo"?n.ordinalNumber(a,{unit:"week"}):u(a,t.length)},I:function(e,t,n){const r=it(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):u(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):y.d(e,t)},D:function(e,t,n){const r=rt(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):u(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){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(e,t,n,r){const a=e.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return u(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(e,t,n,r){const a=e.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return u(i,t.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(e,t,n){const r=e.getDay(),a=r===0?7:r;switch(t){case"i":return String(a);case"ii":return u(a,t.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(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){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(e,t,n){const r=e.getHours();let a;switch(r===12?a=M.noon:r===0?a=M.midnight:a=r/12>=1?"pm":"am",t){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(e,t,n){const r=e.getHours();let a;switch(r>=17?a=M.evening:r>=12?a=M.afternoon:r>=4?a=M.morning:a=M.night,t){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(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return y.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):y.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):u(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):u(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):y.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):y.s(e,t)},S:function(e,t){return y.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return G(r);case"XXXX":case"XX":return D(r);case"XXXXX":case"XXX":default:return D(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return G(r);case"xxxx":case"xx":return D(r);case"xxxxx":case"xxx":default:return D(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Q(r,":");case"OOOO":default:return"GMT"+D(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Q(r,":");case"zzzz":default:return"GMT"+D(r,":")}},t:function(e,t,n){const r=Math.trunc(e.getTime()/1e3);return u(r,t.length)},T:function(e,t,n){const r=e.getTime();return u(r,t.length)}};function Q(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=Math.trunc(r/60),i=r%60;return i===0?n+String(a):n+String(a)+t+u(i,2)}function G(e,t){return e%60===0?(e>0?"-":"+")+u(Math.abs(e)/60,2):D(e,t)}function D(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=u(Math.trunc(r/60),2),i=u(r%60,2);return n+a+t+i}const B=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},le=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},ut=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return B(e,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",B(r,t)).replace("{{time}}",le(a,t))},ct={p:le,P:ut},ft=/^D+$/,dt=/^Y+$/,lt=["D","DD","YY","YYYY"];function mt(e){return ft.test(e)}function ht(e){return dt.test(e)}function gt(e,t,n){const r=wt(e,t,n);if(console.warn(r),lt.includes(e))throw new RangeError(r)}function wt(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function yt(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function bt(e){if(!yt(e)&&typeof e!="number")return!1;const t=g(e);return!isNaN(Number(t))}const Dt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Mt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Tt=/^'([^]*?)'?$/,Ot=/''/g,xt=/[a-zA-Z]/;function me(e,t,n){var m,w,x,Y,U,q,Z,A;const r=O(),a=(n==null?void 0:n.locale)??r.locale??ue,i=(n==null?void 0:n.firstWeekContainsDate)??((w=(m=n==null?void 0:n.locale)==null?void 0:m.options)==null?void 0:w.firstWeekContainsDate)??r.firstWeekContainsDate??((Y=(x=r.locale)==null?void 0:x.options)==null?void 0:Y.firstWeekContainsDate)??1,o=(n==null?void 0:n.weekStartsOn)??((q=(U=n==null?void 0:n.locale)==null?void 0:U.options)==null?void 0:q.weekStartsOn)??r.weekStartsOn??((A=(Z=r.locale)==null?void 0:Z.options)==null?void 0:A.weekStartsOn)??0,s=g(e);if(!bt(s))throw new RangeError("Invalid time value");let c=t.match(Mt).map(h=>{const l=h[0];if(l==="p"||l==="P"){const I=ct[l];return I(h,a.formatLong)}return h}).join("").match(Dt).map(h=>{if(h==="''")return{isToken:!1,value:"'"};const l=h[0];if(l==="'")return{isToken:!1,value:Yt(h)};if(R[l])return{isToken:!0,value:h};if(l.match(xt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+l+"`");return{isToken:!1,value:h}});a.localize.preprocessor&&(c=a.localize.preprocessor(s,c));const f={firstWeekContainsDate:i,weekStartsOn:o,locale:a};return c.map(h=>{if(!h.isToken)return h.value;const l=h.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&ht(l)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&mt(l))&&gt(l,t,String(e));const I=R[l[0]];return I(s,l,a.localize,f)}).join("")}function Yt(e){const t=e.match(Tt);return t?t[1].replace(Ot,"'"):e}function Nt(){return Object.assign({},O())}function V(e,t,n){const r=Nt(),a=kt(e,n.timeZone,n.locale??r.locale);return"formatToParts"in a?Pt(a,t):pt(a,t)}function Pt(e,t){const n=e.formatToParts(t);for(let r=n.length-1;r>=0;--r)if(n[r].type==="timeZoneName")return n[r].value}function pt(e,t){const n=e.format(t).replace(/\u200E/g,""),r=/ [\w-+ ]+$/.exec(n);return r?r[0].substr(1):""}function kt(e,t,n){return new Intl.DateTimeFormat(n?[n.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}function Wt(e,t){const n=Ft(t);return"formatToParts"in n?St(n,e):It(n,e)}const vt={year:0,month:1,day:2,hour:3,minute:4,second:5};function St(e,t){try{const n=e.formatToParts(t),r=[];for(let a=0;a<n.length;a++){const i=vt[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 It(e,t){const n=e.format(t),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 F={},J=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")),Ct=J==="06/25/2014, 00:00:00"||J==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";function Ft(e){return F[e]||(F[e]=Ct?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),F[e]}function z(e,t,n,r,a,i,o){const s=new Date(0);return s.setUTCFullYear(e,t,n),s.setUTCHours(r,a,i,o),s}const K=36e5,Et=6e4,E={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function S(e,t,n){if(!e)return 0;let r=E.timezoneZ.exec(e);if(r)return 0;let a,i;if(r=E.timezoneHH.exec(e),r)return a=parseInt(r[1],10),ee(a)?-(a*K):NaN;if(r=E.timezoneHHMM.exec(e),r){a=parseInt(r[2],10);const o=parseInt(r[3],10);return ee(a,o)?(i=Math.abs(a)*K+o*Et,r[1]==="+"?-i:i):NaN}if(Xt(e)){t=new Date(t||Date.now());const o=n?t:Ht(t),s=L(o,e);return-(n?s:_t(t,s,e))}return NaN}function Ht(e){return z(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function L(e,t){const n=Wt(e,t),r=z(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime();let a=e.getTime();const i=a%1e3;return a-=i>=0?i:1e3+i,r-a}function _t(e,t,n){let a=e.getTime()-t;const i=L(new Date(a),n);if(t===i)return t;a-=i-t;const o=L(new Date(a),n);return i===o?i:Math.max(i,o)}function ee(e,t){return-23<=e&&e<=23&&(t==null||0<=t&&t<=59)}const te={};function Xt(e){if(te[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),te[e]=!0,!0}catch{return!1}}const $t=60*1e3,Lt={X:function(e,t,n){const r=H(n.timeZone,e);if(r===0)return"Z";switch(t){case"X":return ne(r);case"XXXX":case"XX":return T(r);case"XXXXX":case"XXX":default:return T(r,":")}},x:function(e,t,n){const r=H(n.timeZone,e);switch(t){case"x":return ne(r);case"xxxx":case"xx":return T(r);case"xxxxx":case"xxx":default:return T(r,":")}},O:function(e,t,n){const r=H(n.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+zt(r,":");case"OOOO":default:return"GMT"+T(r,":")}},z:function(e,t,n){switch(t){case"z":case"zz":case"zzz":return V("short",e,n);case"zzzz":default:return V("long",e,n)}}};function H(e,t){const n=e?S(e,t,!0)/$t:(t==null?void 0:t.getTimezoneOffset())??0;if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+e);return n}function W(e,t){const n=e<0?"-":"";let r=Math.abs(e).toString();for(;r.length<t;)r="0"+r;return n+r}function T(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=W(Math.floor(r/60),2),i=W(Math.floor(r%60),2);return n+a+t+i}function ne(e,t){return e%60===0?(e>0?"-":"+")+W(Math.abs(e)/60,2):T(e,t)}function zt(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=Math.floor(r/60),i=r%60;return i===0?n+String(a):n+String(a)+t+W(i,2)}function re(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const he=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,_=36e5,ae=6e4,Ut=2,d={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:he};function v(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(e===null)return new Date(NaN);const n=t.additionalDigits==null?Ut:Number(t.additionalDigits);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]")return new Date(e.getTime());if(typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]")return new Date(e);if(Object.prototype.toString.call(e)!=="[object String]")return new Date(NaN);const r=qt(e),{year:a,restDateString:i}=Zt(r.date,n),o=At(i,a);if(o===null||isNaN(o.getTime()))return new Date(NaN);if(o){const s=o.getTime();let c=0,f;if(r.time&&(c=jt(r.time),c===null||isNaN(c)))return new Date(NaN);if(r.timeZone||t.timeZone){if(f=S(r.timeZone||t.timeZone,new Date(s+c)),isNaN(f))return new Date(NaN)}else f=re(new Date(s+c)),f=re(new Date(s+c+f));return new Date(s+c+f)}else return new Date(NaN)}function qt(e){const t={};let n=d.dateTimePattern.exec(e),r;if(n?(t.date=n[1],r=n[3]):(n=d.datePattern.exec(e),n?(t.date=n[1],r=n[2]):(t.date=null,r=e)),r){const a=d.timeZone.exec(r);a?(t.time=r.replace(a[1],""),t.timeZone=a[1].trim()):t.time=r}return t}function Zt(e,t){if(e){const n=d.YYY[t],r=d.YYYYY[t];let a=d.YYYY.exec(e)||r.exec(e);if(a){const i=a[1];return{year:parseInt(i,10),restDateString:e.slice(i.length)}}if(a=d.YY.exec(e)||n.exec(e),a){const i=a[1];return{year:parseInt(i,10)*100,restDateString:e.slice(i.length)}}}return{year:null}}function At(e,t){if(t===null)return null;let n,r,a;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let i=d.MM.exec(e);if(i)return n=new Date(0),r=parseInt(i[1],10)-1,oe(t,r)?(n.setUTCFullYear(t,r),n):new Date(NaN);if(i=d.DDD.exec(e),i){n=new Date(0);const o=parseInt(i[1],10);return Gt(t,o)?(n.setUTCFullYear(t,0,o),n):new Date(NaN)}if(i=d.MMDD.exec(e),i){n=new Date(0),r=parseInt(i[1],10)-1;const o=parseInt(i[2],10);return oe(t,r,o)?(n.setUTCFullYear(t,r,o),n):new Date(NaN)}if(i=d.Www.exec(e),i)return a=parseInt(i[1],10)-1,se(a)?ie(t,a):new Date(NaN);if(i=d.WwwD.exec(e),i){a=parseInt(i[1],10)-1;const o=parseInt(i[2],10)-1;return se(a,o)?ie(t,a,o):new Date(NaN)}return null}function jt(e){let t,n,r=d.HH.exec(e);if(r)return t=parseFloat(r[1].replace(",",".")),X(t)?t%24*_:NaN;if(r=d.HHMM.exec(e),r)return t=parseInt(r[1],10),n=parseFloat(r[2].replace(",",".")),X(t,n)?t%24*_+n*ae:NaN;if(r=d.HHMMSS.exec(e),r){t=parseInt(r[1],10),n=parseInt(r[2],10);const a=parseFloat(r[3].replace(",","."));return X(t,n,a)?t%24*_+n*ae+a*1e3:NaN}return null}function ie(e,t,n){t=t||0,n=n||0;const r=new Date(0);r.setUTCFullYear(e,0,4);const a=r.getUTCDay()||7,i=t*7+n+1-a;return r.setUTCDate(r.getUTCDate()+i),r}const Rt=[31,28,31,30,31,30,31,31,30,31,30,31],Qt=[31,29,31,30,31,30,31,31,30,31,30,31];function ge(e){return e%400===0||e%4===0&&e%100!==0}function oe(e,t,n){if(t<0||t>11)return!1;if(n!=null){if(n<1)return!1;const r=ge(e);if(r&&n>Qt[t]||!r&&n>Rt[t])return!1}return!0}function Gt(e,t){if(t<1)return!1;const n=ge(e);return!(n&&t>366||!n&&t>365)}function se(e,t){return!(e<0||e>52||t!=null&&(t<0||t>6))}function X(e,t,n){return!(e<0||e>=25||t!=null&&(t<0||t>=60)||n!=null&&(n<0||n>=60))}const Bt=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Vt(e,t,n={}){t=String(t);const r=t.match(Bt);if(r){const a=v(n.originalDate||e,n);t=r.reduce(function(i,o){if(o[0]==="'")return i;const s=i.indexOf(o),c=i[s-1]==="'",f=i.replace(o,"'"+Lt[o[0]](a,o,n)+"'");return c?f.substring(0,s-1)+f.substring(s+1):f},t)}return me(e,t,n)}function we(e,t,n){e=v(e,n);const r=S(t,e,!0),a=new Date(e.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 Jt(e,t,n,r){return r={...r,timeZone:t,originalDate:e},Vt(we(e,t,{timeZone:r.timeZone}),n,r)}function Kt(e,t,n){if(typeof e=="string"&&!e.match(he))return v(e,{...n,timeZone:t});e=v(e,n);const r=z(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()).getTime(),a=S(t,new Date(r));return new Date(r+a)}function en(e){if(!e||typeof e!="object")return!1;const t=e.type;return t==="number"||t==="currency"||t==="percent"||t==="scientific"}exports.constructFrom=b;exports.enUS=ue;exports.format=me;exports.formatInTimeZone=Jt;exports.fromZonedTime=Kt;exports.getDefaultOptions=O;exports.getTimezoneOffsetInMilliseconds=$;exports.isNumericCanonicalFormat=en;exports.millisecondsInHour=Je;exports.millisecondsInMinute=Ve;exports.minutesInDay=et;exports.minutesInMonth=Ke;exports.toDate=g;exports.toZonedTime=we;