zframes 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -18
- package/dist/index.js +170 -10
- package/package.json +4 -4
- package/runtime/assets/{bitcoin-dominance-BHcykQ8j.js → bitcoin-dominance-DoQXKqiB.js} +1 -1
- package/runtime/assets/{breakeven-PNgn_Prq.js → breakeven-C-RPYpuB.js} +1 -1
- package/runtime/assets/{breathing-DrPgIS4r.js → breathing-y5-8SC9y.js} +1 -1
- package/runtime/assets/{btc-blocks-mJPjO7gs.js → btc-blocks-Sw7Iyo4-.js} +1 -1
- package/runtime/assets/{btc-difficulty-D8kmEyQb.js → btc-difficulty-BYmWqBxZ.js} +1 -1
- package/runtime/assets/{btc-fees-Cv6K9S1L.js → btc-fees-D8mISVeZ.js} +1 -1
- package/runtime/assets/{btc-hashrate-DT6qyeME.js → btc-hashrate-BEJQmdg9.js} +1 -1
- package/runtime/assets/{btc-mempool-ftlit90k.js → btc-mempool-1XmL6cRJ.js} +1 -1
- package/runtime/assets/{calculator-CYNDBlrv.js → calculator-DXo_2gkF.js} +1 -1
- package/runtime/assets/{checklist-DygbP4AG.js → checklist-BdYa9ZOP.js} +1 -1
- package/runtime/assets/{clock-D2rGZ-yo.js → clock-D-I4lQmb.js} +1 -1
- package/runtime/assets/{coin-movers-DpHOtUMJ.js → coin-movers-DOacvI6E.js} +1 -1
- package/runtime/assets/{countdown-DcbUf2-f.js → countdown-BUHtC8Ve.js} +1 -1
- package/runtime/assets/{daily-analysis-D3g2BXJd.js → daily-analysis-CfKUC2nL.js} +1 -1
- package/runtime/assets/{day-meter-CDmmKsh5.js → day-meter-Bf2cGHVR.js} +1 -1
- package/runtime/assets/dex-volume-chart-61eDevFa.js +1 -0
- package/runtime/assets/dex-volume-treemap-DlwxBY_b.js +1 -0
- package/runtime/assets/{dice-B7dy1iZP.js → dice-Dl2uLedD.js} +1 -1
- package/runtime/assets/{dino-game-DLEtJMnt.js → dino-game-Cx4Nc7AZ.js} +1 -1
- package/runtime/assets/{divider-CVjQeL0n.js → divider-HYdZwv9D.js} +1 -1
- package/runtime/assets/{drawdy-DoJeRpgi.js → drawdy-C42tJRAO.js} +1 -1
- package/runtime/assets/editor-BMMobjrE.css +1 -0
- package/runtime/assets/editor-COIEaoVd.js +68 -0
- package/runtime/assets/{fear-greed-zPvN2LSi.js → fear-greed-BkmVWoHA.js} +1 -1
- package/runtime/assets/{filings-feed-CWAGVlAW.js → filings-feed-ChiZiKYE.js} +1 -1
- package/runtime/assets/{financial-stress-C5-XFPqY.js → financial-stress-BQJoviQU.js} +1 -1
- package/runtime/assets/{flappy-bird-CoKOL9Ib.js → flappy-bird-DphWPPwp.js} +1 -1
- package/runtime/assets/{fundamentals-BYjofvJi.js → fundamentals-D20TvQN_.js} +1 -1
- package/runtime/assets/funding-heatmap-DxH9NYjL.js +1 -0
- package/runtime/assets/{funding-rate-chart-CxBH7hVe.js → funding-rate-chart-BJ2jiIb4.js} +1 -1
- package/runtime/assets/fx-board-DXTpvuXF.js +1 -0
- package/runtime/assets/{heading-gFm9ZDY1.js → heading-Cr4OaUt7.js} +1 -1
- package/runtime/assets/{holiday-calendar-ffNyuPje.js → holiday-calendar-DHK0jzQc.js} +1 -1
- package/runtime/assets/{image-D3DwdoU8.js → image-DVddTOkv.js} +1 -1
- package/runtime/assets/{index-DRTPEQtR.css → index-BqHx9BjX.css} +1 -1
- package/runtime/assets/index-DK7jWlTL.js +1 -0
- package/runtime/assets/index-DNLPQoS7.js +936 -0
- package/runtime/assets/inflation-pulse-NCyRMTQV.js +1 -0
- package/runtime/assets/{journal-log-CcLb4w4A.js → journal-log-C_W9xs_w.js} +1 -1
- package/runtime/assets/{journal-open-C0BKFgMk.js → journal-open-CVlbbryx.js} +1 -1
- package/runtime/assets/{journal-results-Bpzb4REp.js → journal-results-Bsk6nwKi.js} +1 -1
- package/runtime/assets/{journal-score-BUDUgceb.js → journal-score-C6Aj9hWs.js} +1 -1
- package/runtime/assets/{journal-ui-CJIuEcIa.js → journal-ui-DgGd2Foc.js} +1 -1
- package/runtime/assets/{labor-market-DJihF3Mk.js → labor-market-BvFWS_YO.js} +1 -1
- package/runtime/assets/{lightning-stats-BV14FfAY.js → lightning-stats-DyRwU2-5.js} +1 -1
- package/runtime/assets/{link-grid-DK3kGS1q.js → link-grid-DxPMWWbo.js} +1 -1
- package/runtime/assets/live-tick-9Q3ubPF9.js +1 -0
- package/runtime/assets/liveline-bcaEuskN.js +1 -0
- package/runtime/assets/market-cap-treemap-LEDlsNnm.js +1 -0
- package/runtime/assets/{market-hours-D89LjpUm.js → market-hours-DlTlbyBC.js} +1 -1
- package/runtime/assets/{marquee-ByOQSr9Q.js → marquee-Ds-0N_-6.js} +1 -1
- package/runtime/assets/mini-line-chart-CHM5UBjJ.js +1 -0
- package/runtime/assets/{mining-pools-D6AnoVnf.js → mining-pools-Dg55Tg1-.js} +1 -1
- package/runtime/assets/{mover-row-BTeXB98H.js → mover-row-CunANlxa.js} +1 -1
- package/runtime/assets/{national-debt-CgI8LSK6.js → national-debt-G2V6-Lef.js} +1 -1
- package/runtime/assets/news-feed-RKSA0wsz.js +1 -0
- package/runtime/assets/note-CDlwRqhL.js +1 -0
- package/runtime/assets/{open-interest-DgDfcYh5.js → open-interest-Bs6LXeca.js} +1 -1
- package/runtime/assets/{options-iv-CqDfM4IA.js → options-iv-BClv6xRB.js} +1 -1
- package/runtime/assets/{options-oi-strike-CrIT5WTU.js → options-oi-strike-DbhE95-7.js} +1 -1
- package/runtime/assets/{options-put-call--RXL3vTA.js → options-put-call-C7tt191v.js} +1 -1
- package/runtime/assets/{pomodoro-DZEEQU2X.js → pomodoro-DpIO5pex.js} +1 -1
- package/runtime/assets/{portfolio-allocation-DKf6H-m6.js → portfolio-allocation-DqSXNMYF.js} +1 -1
- package/runtime/assets/{portfolio-common-CVt117Oi.js → portfolio-common-CCGvaNdA.js} +1 -1
- package/runtime/assets/{portfolio-holdings-CHtvm8aL.js → portfolio-holdings-Bxvf91Yo.js} +1 -1
- package/runtime/assets/portfolio-value-C6TFZyPZ.js +1 -0
- package/runtime/assets/price-chart-D4wf9Yju.js +1 -0
- package/runtime/assets/price-compare-B-mjV1jP.js +1 -0
- package/runtime/assets/price-liveline-K4S4XpSX.js +1 -0
- package/runtime/assets/{price-ticker-BmfARqHc.js → price-ticker-BNDRtpS8.js} +1 -1
- package/runtime/assets/protocol-fees-treemap-vjLiXJ6x.js +1 -0
- package/runtime/assets/{protocol-tvl-chart-Dl_MwJdU.js → protocol-tvl-chart-Dz8JtyuD.js} +1 -1
- package/runtime/assets/protocol-tvl-treemap-BrA0oXqV.js +1 -0
- package/runtime/assets/{quote-BjjZrPpM.js → quote-PcP5IX9V.js} +1 -1
- package/runtime/assets/{rates-board-B_OYdW_u.js → rates-board-BNAw2Iei.js} +1 -1
- package/runtime/assets/{returns-projector-EA7LLxnL.js → returns-projector-BSTPBgMR.js} +1 -1
- package/runtime/assets/{risk-reward-xhKH6ouR.js → risk-reward-Dnp2JQr7.js} +1 -1
- package/runtime/assets/{rules-card-CrDquc56.js → rules-card-BNInaYxt.js} +1 -1
- package/runtime/assets/{session-progress-BquR98Sm.js → session-progress-D1mhPWWM.js} +1 -1
- package/runtime/assets/{short-volume-CYxTQG8H.js → short-volume-Dsm5jHLL.js} +1 -1
- package/runtime/assets/{snake-9JevhL1w.js → snake-CyxVfmbr.js} +1 -1
- package/runtime/assets/{spotify-embed-CNEzG2xL.js → spotify-embed-DcnZGDEz.js} +1 -1
- package/runtime/assets/{stopwatch-BuN_qlhH.js → stopwatch-ggIRtWfw.js} +1 -1
- package/runtime/assets/top-movers-CanKFls6.js +1 -0
- package/runtime/assets/{treasury-auctions-bA-385ON.js → treasury-auctions-BBHz7Mbe.js} +1 -1
- package/runtime/assets/treemap-leaf-DNIoJEK-.js +1 -0
- package/runtime/assets/tvl-treemap-D-LqgfI7.js +1 -0
- package/runtime/assets/{video-CUWN4TBo.js → video-DqWW_aoH.js} +1 -1
- package/runtime/assets/{yield-curve-BOvLIfWe.js → yield-curve-Dpm8XDwi.js} +1 -1
- package/runtime/index.html +2 -2
- package/runtime/assets/dex-volume-chart-C3KHEnoK.js +0 -1
- package/runtime/assets/dex-volume-treemap-C-hqWu6U.js +0 -1
- package/runtime/assets/editor-CHAAJRb1.css +0 -1
- package/runtime/assets/editor-UP2LBUZ9.js +0 -68
- package/runtime/assets/funding-heatmap-BhL0jjq8.js +0 -1
- package/runtime/assets/fx-board-Cm0_zK03.js +0 -1
- package/runtime/assets/index-DbboK5sz.js +0 -820
- package/runtime/assets/index-jnySFpSv.js +0 -1
- package/runtime/assets/inflation-pulse-GrBWa9Z6.js +0 -1
- package/runtime/assets/liveline-C5zt2WuS.js +0 -1
- package/runtime/assets/market-cap-treemap-DpuSjWWe.js +0 -1
- package/runtime/assets/mini-line-chart-D-i1QqSe.js +0 -1
- package/runtime/assets/news-feed-CA8M5V3K.js +0 -1
- package/runtime/assets/note-Biu6llug.js +0 -1
- package/runtime/assets/portfolio-value-Dj37WMRc.js +0 -1
- package/runtime/assets/price-chart-hgZApQaG.js +0 -1
- package/runtime/assets/price-compare-BczbPKy-.js +0 -1
- package/runtime/assets/price-liveline-Cbor-Nv_.js +0 -1
- package/runtime/assets/protocol-fees-treemap-DeSBgGJ9.js +0 -1
- package/runtime/assets/protocol-tvl-treemap-Bvgp0EHh.js +0 -1
- package/runtime/assets/top-movers-D7sBm6jo.js +0 -1
- package/runtime/assets/treemap-leaf-DLQawrx4.js +0 -1
- package/runtime/assets/tvl-treemap-jrgafmGj.js +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import{r,j as e,c as Es,a as Jt}from"./react-qoZPGuNy.js";import{G as Qt}from"./gridstack-BxxvPIFU.js";import{t as ut,u as Ts,B as Ne,T as es,F as ts,a as Ls,b as Fs,c as Is,d as $s,N as ss,e as as}from"./index-DNLPQoS7.js";/**
|
|
2
|
+
* @license lucide-react v1.21.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 ms=(...t)=>t.filter((a,n,m)=>!!a&&a.trim()!==""&&m.indexOf(a)===n).join(" ").trim();/**
|
|
7
|
+
* @license lucide-react v1.21.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 Hs=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
12
|
+
* @license lucide-react v1.21.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 Os=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,n,m)=>m?m.toUpperCase():n.toLowerCase());/**
|
|
17
|
+
* @license lucide-react v1.21.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const rs=t=>{const a=Os(t);return a.charAt(0).toUpperCase()+a.slice(1)};/**
|
|
22
|
+
* @license lucide-react v1.21.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/var st={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
27
|
+
* @license lucide-react v1.21.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const Bs=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1},Ps=r.createContext({}),Gs=()=>r.useContext(Ps),Ds=r.forwardRef(({color:t,size:a,strokeWidth:n,absoluteStrokeWidth:m,className:N="",children:d,iconNode:h,...o},f)=>{const{size:g=24,strokeWidth:u=2,absoluteStrokeWidth:z=!1,color:j="currentColor",className:x=""}=Gs()??{},R=m??z?Number(n??u)*24/Number(a??g):n??u;return r.createElement("svg",{ref:f,...st,width:a??g??st.width,height:a??g??st.height,stroke:t??j,strokeWidth:R,className:ms("lucide",x,N),...!d&&!Bs(o)&&{"aria-hidden":"true"},...o},[...h.map(([T,w])=>r.createElement(T,w)),...Array.isArray(d)?d:[d]])});/**
|
|
32
|
+
* @license lucide-react v1.21.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const pe=(t,a)=>{const n=r.forwardRef(({className:m,...N},d)=>r.createElement(Ds,{ref:d,iconNode:a,className:ms(`lucide-${Hs(rs(t))}`,`lucide-${t}`,m),...N}));return n.displayName=rs(t),n};/**
|
|
37
|
+
* @license lucide-react v1.21.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/const _s=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Us=pe("check",_s);/**
|
|
42
|
+
* @license lucide-react v1.21.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/const Ws=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],qs=pe("chevron-down",Ws);/**
|
|
47
|
+
* @license lucide-react v1.21.0 - ISC
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the ISC license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/const Ks=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Vs=pe("plus",Ks);/**
|
|
52
|
+
* @license lucide-react v1.21.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/const Xs=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ys=pe("search",Xs);/**
|
|
57
|
+
* @license lucide-react v1.21.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/const Zs=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],Js=pe("sliders-horizontal",Zs);/**
|
|
62
|
+
* @license lucide-react v1.21.0 - ISC
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the ISC license.
|
|
65
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/const Qs=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Oe=pe("x",Qs),ds=["xyz:XYZ100","xyz:SP500","xyz:NVDA","xyz:TSLA","xyz:AAPL","xyz:MSFT","xyz:GOOGL","xyz:META","xyz:AMZN","xyz:MU","xyz:AMD","xyz:AVGO","xyz:ARM","xyz:TSM","xyz:SKHX","xyz:MSTR","xyz:COIN","xyz:HOOD","xyz:PLTR","xyz:SPCX","xyz:GOLD","xyz:SILVER","xyz:CL","xyz:BRENTOIL","xyz:COPPER","xyz:EUR","xyz:JPY","xyz:SMH","BTC","ETH","SOL","HYPE","BNB","XRP","DOGE","LINK","AVAX","SUI"],fs=new Map(ds.map((t,a)=>[t,a]));function ve(t){const a=t.indexOf(":");return(a===-1?t:t.slice(a+1)).toUpperCase()}function mt(t){return t.includes(":")?"Stock":"Crypto"}function ea(t){const a=t.indexOf(":");if(a!==-1){const n=t.slice(a+1);return`https://assets.parqet.com/logos/symbol/${encodeURIComponent(n)}?format=png`}return`https://assets.coincap.io/assets/icons/${t.toLowerCase()}@2x.png`}function ta(t){const a=t.trim().replace(/\s+/g,"");if(!a)return"";const n=a.indexOf(":");return n===-1?a.toUpperCase():`${a.slice(0,n).toLowerCase()}:${a.slice(n+1).toUpperCase()}`}function it(t,a,n=fs.get(t)??1e4){return{symbol:t,ticker:ve(t),kind:mt(t),markPx:a==null?void 0:a.markPx,changePct:a==null?void 0:a.changePct,rank:n}}function hs(t){if(!Number.isFinite(t))return"";const a=t;return a>=1e3?`$${a.toLocaleString(void 0,{maximumFractionDigits:0})}`:a>=100?`$${a.toFixed(2)}`:a>=1?`$${a.toFixed(3)}`:`$${a.toPrecision(3)}`}function sa(t){if(!Number.isFinite(t))return"";const a=t;return`${a>=0?"+":""}${a.toFixed(2)}%`}function gs(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function H(t,a){return t!=null&&t.type?Array.isArray(t.type)?t.type.includes(a):t.type===a:!1}function ps(t){const a=t==null?void 0:t.items;return!!a&&H(t,"array")&&H(a,"string")}function aa(t){var a,n,m;try{const d=ut(t.schema,{io:"input"}).properties??{};if(H(d.symbol,"string"))return{kind:"single"};if(ps(d.symbols))return{kind:"symbols",minItems:(a=d.symbols)==null?void 0:a.minItems,maxItems:(n=d.symbols)==null?void 0:n.maxItems};const h=d.holdings,o=((m=h==null?void 0:h.items)==null?void 0:m.properties)??{};if(H(h,"array")&&H(o.symbol,"string"))return{kind:"holdings",minItems:h==null?void 0:h.minItems,maxItems:h==null?void 0:h.maxItems}}catch{}return t.name==="price-chart"?{kind:"single"}:["price-liveline","price-ticker","funding-rate-chart","funding-heatmap","price-compare"].includes(t.name)?{kind:"symbols"}:null}function ra(t,a){return t.kind==="single"?typeof a.symbol=="string"&&a.symbol?[a.symbol]:[]:t.kind==="symbols"?Array.isArray(a.symbols)?a.symbols.filter(n=>typeof n=="string"):[]:Array.isArray(a.holdings)?a.holdings.map(n=>gs(n)&&typeof n.symbol=="string"?n.symbol:"").filter(Boolean):[]}const na=new Set(["symbol","symbols","holdings"]);function dt(t){const a=t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim();return a?a.charAt(0).toUpperCase()+a.slice(1):t}function ia(t){let a;try{a=ut(t.schema,{io:"input"})}catch{return[]}return Object.entries(a.properties??{}).filter(([n])=>!na.has(n)).map(([n,m])=>({key:n,label:dt(n),shape:m}))}const ns=["xyz:TSLA","xyz:NVDA","xyz:AAPL","xyz:MSFT","xyz:SP500","xyz:GOLD","xyz:GOOGL","xyz:AMZN"];function la(t,a){return t==="symbol"?ns[a%ns.length]:t==="url"?"https://":t==="text"?"New note":t==="title"?"Heading":dt(t)||"value"}function lt(t,a,n=0){var m;if(t.default!==void 0)return t.default;if(Array.isArray(t.enum)&&t.enum.length)return t.enum[0];if(H(t,"string"))return la(a,n);if(H(t,"number")||H(t,"integer"))return t.exclusiveMinimum!==void 0?t.exclusiveMinimum+1:t.minimum??0;if(H(t,"boolean"))return!1;if(H(t,"array")){const N=t.items??{},d=a==="symbols"?"symbol":a;return Array.from({length:t.minItems??0},(h,o)=>lt(N,d,o))}if(H(t,"object")){const N={};for(const d of t.required??[]){const h=(m=t.properties)==null?void 0:m[d];h&&(N[d]=lt(h,d,n))}return N}return null}function ca(t){const a=t.schema.safeParse({});if(a.success)return a.data;let n;try{n=ut(t.schema,{io:"input"})}catch{return{}}const m={},N=new Set(n.required??[]);for(const[h,o]of Object.entries(n.properties??{}))N.has(h)&&(m[h]=lt(o,h));const d=t.schema.safeParse(m);return d.success?d.data:m}function oa(t,a){const n=r.useMemo(()=>t.find(f=>f.capabilities.includes("day-stats")),[t]),[m,N]=r.useState({}),[d,h]=r.useState(!1);return r.useEffect(()=>{if(!a||!(n!=null&&n.getDayStats)){h(!1);return}let f=!1;return h(!0),Promise.allSettled([n.getDayStats(),n.getDayStats(["xyz:*"])]).then(g=>{if(f)return;const u={};for(const z of g)z.status==="fulfilled"&&Object.assign(u,z.value);N(u)}).finally(()=>{f||h(!1)}),()=>{f=!0}},[a,n]),{options:r.useMemo(()=>{const f=new Map;return ds.forEach((g,u)=>{f.set(g,it(g,m[g],u))}),Object.entries(m).forEach(([g,u])=>{f.set(g,it(g,u,fs.get(g)??1e4))}),[...f.values()].sort((g,u)=>g.rank!==u.rank?g.rank-u.rank:g.kind!==u.kind?g.kind==="Stock"?-1:1:g.ticker.localeCompare(u.ticker))},[m]),loading:d}}function ua({instance:t,registry:a,instancesRef:n,symbolUniverse:m,accentHue:N,onApply:d,onClose:h}){const o=a.get(t.frame),f=r.useMemo(()=>o?aa(o):null,[o]),g=r.useMemo(()=>o?ia(o):[],[o]),[u,z]=r.useState(()=>({...t.config??{}})),[j,x]=r.useState(null),[R,T]=r.useState(t.title??""),w=t.id,b=r.useCallback(S=>{if(z(S),o){const ce=o.schema.safeParse(S);if(!ce.success){x(ce.error.issues.map(xe=>`${xe.path.join(".")||"(root)"}: ${xe.message}`).join(`
|
|
67
|
+
`));return}}x(null);const O=n.current.get(w);O&&(n.current.set(w,{...O,config:S}),d(w))},[o,w,n,d]),A=r.useCallback(S=>{T(S);const O=n.current.get(w);if(!O)return;const ce=S.trim();n.current.set(w,{...O,title:ce===""?void 0:ce}),d(w)},[w,n,d]);r.useEffect(()=>{const S=O=>{O.key==="Escape"&&h()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[h]);const I=(S,O)=>b({...u,[S]:O}),le=(o==null?void 0:o.label)??t.frame.replace(/-/g," ");return e.jsx("div",{className:"zf-dialog-backdrop",style:{"--zf-accent-hue":N},onMouseDown:S=>{S.target===S.currentTarget&&h()},children:e.jsxs("div",{className:"zf-dialog",role:"dialog","aria-modal":"true","aria-label":`Configure ${le}`,children:[e.jsxs("header",{className:"zf-dialog-head",children:[e.jsxs("h3",{className:"zf-dialog-title",children:["Configure · ",le]}),e.jsx("button",{type:"button",className:"zf-dialog-close",onClick:h,"aria-label":"Close",title:"Close",children:e.jsx(Oe,{size:16,"aria-hidden":"true"})})]}),e.jsxs("div",{className:"zf-dialog-body",children:[(o==null?void 0:o.chrome)!=="bare"&&e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:"zf-instance-title",title:"Card title shown in the frame's chrome.",children:"Title"}),e.jsx("input",{id:"zf-instance-title",className:"zf-input",value:R,placeholder:o!=null&&o.titleContent?"Auto (live)":le,spellCheck:!1,onChange:S=>A(S.target.value)}),e.jsx("p",{className:"zf-field-hint",children:"Leave blank to use the frame’s default."})]}),f&&e.jsx(ga,{control:f,config:u,loading:m.loading,options:m.options,onChangeSymbol:S=>b({...u,symbol:S}),onChangeSymbols:S=>b({...u,symbols:S}),onChangeHoldings:S=>b({...u,holdings:S})}),g.map(S=>e.jsx(ma,{field:S,value:u[S.key],onChange:O=>I(S.key,O)},S.key)),!f&&g.length===0&&e.jsx("p",{className:"zf-rail-empty",children:"This frame has no settings."}),j&&e.jsx("div",{className:"zf-config-error",children:j})]}),e.jsx("footer",{className:"zf-dialog-foot",children:e.jsx("button",{type:"button",className:"zf-btn zf-btn--primary",onClick:h,children:"Done"})})]})})}function ma({field:t,value:a,onChange:n}){const{key:m,label:N,shape:d}=t,h=`zf-cfg-${m}`,o=d.description;if(H(d,"boolean")){const g=typeof a=="boolean"?a:!!d.default;return e.jsxs("label",{className:"zf-checkbox",title:o,children:[e.jsx("input",{type:"checkbox",checked:g,onChange:u=>n(u.target.checked)}),N]})}const f=Array.isArray(d.enum)&&d.enum.every(g=>typeof g=="string")?d.enum:null;if(f&&f.length>0){const g=typeof d.default=="string"?d.default:f[0],u=typeof a=="string"&&f.includes(a)?a:g;return e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:h,title:o,children:N}),e.jsx("select",{id:h,className:"zf-select",value:u,onChange:z=>n(z.target.value),children:f.map(z=>e.jsx("option",{value:z,children:dt(z)},z))})]})}return H(d,"integer")||H(d,"number")?e.jsx(da,{id:h,field:t,value:a,onChange:n}):ps(d)?e.jsx(ha,{id:h,field:t,value:a,onChange:n}):e.jsx(fa,{id:h,field:t,value:a,onChange:n})}function da({id:t,field:a,value:n,onChange:m}){const{label:N,shape:d}=a,h=d.description,o=typeof d.minimum=="number"?d.minimum:void 0,f=typeof d.maximum=="number"?d.maximum:void 0,g=H(d,"integer"),u=g?1:"any",z=typeof d.default=="number"?d.default:o??0,j=typeof n=="number"&&Number.isFinite(n)?n:void 0;if(o!==void 0&&f!==void 0){const x=j??z;return e.jsxs("div",{className:"zf-field",children:[e.jsxs("div",{className:"zf-field-row",children:[e.jsx("label",{htmlFor:t,title:h,children:N}),e.jsx("span",{className:"zf-field-num",children:x})]}),e.jsx("input",{id:t,type:"range",className:"zf-range",min:o,max:f,step:u,value:x,onChange:R=>m(g?Math.round(Number(R.target.value)):Number(R.target.value))})]})}return e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:t,title:h,children:N}),e.jsx("input",{id:t,type:"number",className:"zf-input",min:o,max:f,step:u,value:n==null?"":String(n),onChange:x=>m(x.target.value===""?"":Number(x.target.value))})]})}function fa({id:t,field:a,value:n,onChange:m}){const{key:N,label:d,shape:h}=a,o=h.description,f=typeof n=="string"?n:"",g=typeof h.default=="string"?h.default:"",u=typeof h.default=="string"&&/^#[0-9a-f]{6}$/i.test(h.default)?h.default:null;if(N==="color"||u){const z=/^#[0-9a-f]{6}$/i.test(f)?f:u??"#8b8df9";return e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:t,title:o,children:d}),e.jsxs("div",{className:"zf-color-row",children:[e.jsx("input",{type:"color",className:"zf-color",value:z,"aria-label":`${d} swatch`,onChange:j=>m(j.target.value)}),e.jsx("input",{id:t,className:"zf-input",value:f,placeholder:g,spellCheck:!1,onChange:j=>m(j.target.value)})]})]})}return N==="text"?e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:t,title:o,children:d}),e.jsx("textarea",{id:t,className:"zf-textarea zf-textarea--prose",value:f,placeholder:g,onChange:z=>m(z.target.value)})]}):e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:t,title:o,children:d}),e.jsx("input",{id:t,className:"zf-input",value:f,placeholder:g,spellCheck:!1,onChange:z=>m(z.target.value)})]})}function ha({id:t,field:a,value:n,onChange:m}){const{label:N,shape:d}=a,h=d.description,o=Array.isArray(n)?n.filter(x=>typeof x=="string"):[],[f,g]=r.useState(""),u=typeof d.maxItems=="number"?d.maxItems:void 0,z=u!==void 0&&o.length>=u,j=x=>{const R=x.trim().toUpperCase();g(""),!(!R||o.includes(R)||z)&&m([...o,R])};return e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:t,title:h,children:N}),o.length>0&&e.jsx("div",{className:"zf-taglist",children:o.map(x=>e.jsxs("span",{className:"zf-tag",children:[x,e.jsx("button",{type:"button",className:"zf-symbol-remove","aria-label":`Remove ${x}`,onClick:()=>m(o.filter(R=>R!==x)),children:e.jsx(Oe,{size:12,"aria-hidden":"true"})})]},x))}),e.jsx("input",{id:t,className:"zf-input",value:f,disabled:z,spellCheck:!1,placeholder:z?"Maximum reached":"Type a code, Enter to add",onChange:x=>g(x.target.value),onBlur:()=>j(f),onKeyDown:x=>{x.key==="Enter"||x.key===","?(x.preventDefault(),j(f)):x.key==="Backspace"&&f===""&&o.length>0&&m(o.slice(0,-1))}})]})}function ga({control:t,config:a,loading:n,options:m,onChangeSymbol:N,onChangeSymbols:d,onChangeHoldings:h}){const o=ra(t,a);if(t.kind==="single"){const u=o[0]??"";return e.jsxs("div",{className:"zf-symbol-editor",children:[e.jsx(at,{title:"Ticker",detail:u?ve(u):"None",loading:n}),u?e.jsx(ot,{symbol:u,option:ct(u,m)}):null,e.jsx(rt,{loading:n,options:m,selectedSymbols:u?[u]:[],placeholder:"Search TSLA, BTC...",onSelect:N})]})}if(t.kind==="symbols"){const u=typeof t.maxItems=="number"&&o.length>=t.maxItems;return e.jsxs("div",{className:"zf-symbol-editor",children:[e.jsx(at,{title:"Tickers",detail:is(o.length,t),loading:n}),e.jsx(pa,{symbols:o,options:m,onRemove:z=>d(o.filter(j=>j!==z))}),e.jsx(rt,{disabled:u,loading:n,options:m,selectedSymbols:o,placeholder:u?"Maximum tickers added":"Add ticker",keepOpenOnSelect:!0,onSelect:z=>{o.includes(z)||u||d([...o,z])}})]})}const f=Array.isArray(a.holdings)?a.holdings.filter(gs):[],g=typeof t.maxItems=="number"&&f.length>=t.maxItems;return e.jsxs("div",{className:"zf-symbol-editor",children:[e.jsx(at,{title:"Holding tickers",detail:is(f.length,t),loading:n}),e.jsx("div",{className:"zf-holding-list",children:f.map((u,z)=>{const j=typeof u.symbol=="string"?u.symbol:"";return e.jsxs("div",{className:"zf-holding-row",children:[e.jsxs("div",{className:"zf-holding-main",children:[j?e.jsx(ot,{symbol:j,option:ct(j,m),compact:!0}):e.jsx("span",{className:"zf-symbol-empty",children:"No ticker"}),typeof u.amount=="number"&&e.jsxs("span",{className:"zf-holding-amount",children:["x ",u.amount]})]}),e.jsx("button",{type:"button",className:"zf-symbol-remove","aria-label":`Remove ${j||"holding"}`,onClick:()=>{h(f.filter((x,R)=>R!==z))},children:e.jsx(Oe,{size:13,"aria-hidden":"true"})})]},`${j}-${z}`)})}),e.jsx(rt,{disabled:g,loading:n,options:m,selectedSymbols:o,placeholder:g?"Maximum holdings added":"Add holding",keepOpenOnSelect:!0,onSelect:u=>{g||h([...f,{symbol:u,amount:1}])}})]})}function at({title:t,detail:a,loading:n}){return e.jsxs("div",{className:"zf-symbol-head",children:[e.jsxs("div",{children:[e.jsx("div",{className:"zf-symbol-label",children:t}),e.jsx("div",{className:"zf-symbol-detail",children:a})]}),e.jsx("span",{className:n?"zf-symbol-source is-loading":"zf-symbol-source",children:n?"Loading":"Live list"})]})}function is(t,a){return typeof a.maxItems=="number"?`${t}/${a.maxItems}`:typeof a.minItems=="number"&&t<a.minItems?`${t}/${a.minItems}+`:String(t)}function ct(t,a){return a.find(n=>n.symbol===t)??it(t)}function pa({symbols:t,options:a,onRemove:n}){return t.length===0?e.jsx("div",{className:"zf-symbol-empty",children:"No tickers selected"}):e.jsx("div",{className:"zf-symbol-chips",children:t.map(m=>e.jsxs("span",{className:"zf-symbol-chip",children:[e.jsx(ot,{symbol:m,option:ct(m,a),compact:!0}),e.jsx("button",{type:"button",className:"zf-symbol-remove","aria-label":`Remove ${m}`,onClick:()=>n(m),children:e.jsx(Oe,{size:13,"aria-hidden":"true"})})]},m))})}function ot({symbol:t,option:a,compact:n=!1}){return e.jsxs("span",{className:n?"zf-selected-symbol is-compact":"zf-selected-symbol",children:[e.jsx(xs,{symbol:t}),e.jsxs("span",{className:"zf-selected-symbol-text",children:[e.jsx("strong",{children:ve(t)}),!n&&e.jsx("em",{children:t})]}),!n&&a.markPx!==void 0&&e.jsx("span",{className:"zf-selected-symbol-price",children:hs(a.markPx)})]})}function rt({disabled:t=!1,loading:a,options:n,selectedSymbols:m,placeholder:N,keepOpenOnSelect:d=!1,onSelect:h}){const[o,f]=r.useState(""),[g,u]=r.useState(!1),z=r.useMemo(()=>new Set(m),[m]),j=r.useMemo(()=>new Set(n.map(b=>b.symbol)),[n]),x=ta(o),R=r.useMemo(()=>{const b=o.trim().toLowerCase();return(b?n.filter(I=>I.ticker.toLowerCase().includes(b)||I.symbol.toLowerCase().includes(b)):n.slice(0,28)).slice().sort((I,le)=>ls(I,b)-ls(le,b)).slice(0,36)},[n,o]),T=r.useMemo(()=>{if(!x)return[];const b=x.includes(":")?[x]:[`xyz:${x}`,x];return b.filter((A,I)=>b.indexOf(A)===I&&!j.has(A)&&!z.has(A))},[j,x,z]),w=b=>{!b||d&&z.has(b)||(h(b),f(""),u(d))};return e.jsxs("div",{className:"zf-symbol-combo",onBlur:b=>{b.currentTarget.contains(b.relatedTarget)||u(!1)},children:[e.jsxs("div",{className:t?"zf-symbol-search is-disabled":"zf-symbol-search",children:[e.jsx(Ys,{size:14,"aria-hidden":"true"}),e.jsx("input",{value:o,disabled:t,placeholder:N,"aria-label":N,role:"combobox","aria-expanded":g,onFocus:()=>u(!0),onChange:b=>{f(b.target.value),u(!0)},onKeyDown:b=>{var A;b.key==="Enter"&&(b.preventDefault(),w(((A=R[0])==null?void 0:A.symbol)??T[0]??x))}}),e.jsx(qs,{size:14,"aria-hidden":"true"})]}),g&&!t&&e.jsxs("div",{className:"zf-symbol-menu",role:"listbox",children:[a&&e.jsx("div",{className:"zf-symbol-menu-status",children:"Loading live universe..."}),R.map(b=>{const A=z.has(b.symbol);return e.jsxs("button",{type:"button",className:A?"zf-symbol-option is-selected":"zf-symbol-option",disabled:d&&A,role:"option","aria-selected":A,onMouseDown:I=>{I.preventDefault(),w(b.symbol)},onClick:I=>{I.detail===0&&w(b.symbol)},children:[e.jsx(xs,{symbol:b.symbol}),e.jsxs("span",{className:"zf-symbol-option-main",children:[e.jsx("strong",{children:b.ticker}),e.jsx("em",{children:b.symbol})]}),e.jsxs("span",{className:"zf-symbol-option-meta",children:[e.jsx("span",{children:hs(b.markPx)||b.kind}),b.changePct!==void 0&&e.jsx("span",{className:b.changePct>=0?"zf-symbol-change is-up":"zf-symbol-change is-down",children:sa(b.changePct)})]}),A&&e.jsx(Us,{size:14,"aria-hidden":"true"})]},b.symbol)}),T.map(b=>e.jsxs("button",{type:"button",className:"zf-symbol-option zf-symbol-option--custom",onMouseDown:A=>{A.preventDefault(),w(b)},onClick:A=>{A.detail===0&&w(b)},children:[e.jsx("span",{className:"zf-symbol-custom-icon",children:e.jsx(Vs,{size:13,"aria-hidden":"true"})}),e.jsxs("span",{className:"zf-symbol-option-main",children:[e.jsx("strong",{children:ve(b)}),e.jsx("em",{children:b})]}),e.jsx("span",{className:"zf-symbol-option-meta",children:e.jsx("span",{children:mt(b)})})]},b)),!a&&R.length===0&&T.length===0&&e.jsx("div",{className:"zf-symbol-menu-status",children:"No matches"})]})]})}function ls(t,a){if(!a)return t.rank;const n=t.ticker.toLowerCase(),m=t.symbol.toLowerCase();return n===a||m===a?-40+t.rank/1e4:n.startsWith(a)?-20+t.rank/1e4:m.startsWith(a)?-10+t.rank/1e4:t.rank}function xs({symbol:t}){const a=mt(t).toLowerCase(),[n,m]=r.useState(!1);return r.useEffect(()=>m(!1),[t]),n?e.jsx("span",{className:`zf-symbol-avatar zf-symbol-avatar--${a}`,children:ve(t).slice(0,2)}):e.jsx("img",{className:`zf-symbol-avatar zf-symbol-avatar--logo zf-symbol-avatar--${a}`,src:ea(t),alt:"","aria-hidden":"true",draggable:!1,loading:"lazy",onError:()=>m(!0)})}const xa=24;function cs(t,a){var n;return a==="flow-horizontal"?(n=t.layouts)==null?void 0:n["flow-horizontal"]:t.position}function os(t,a){const n=t.reduce((m,N)=>m+Math.max(1,N.position.w)*Math.min(Math.max(1,N.position.h),a),0);return Math.max(xa,Math.ceil(n/a*1.25)+8)}function us(t,a,n){var h;const m=new Set,N=(o,f,g,u)=>{for(let z=0;z<g;z++)for(let j=0;j<u;j++){const x=o+z,R=f+j;x>=0&&R>=0&&m.add(`${x},${R}`)}},d=(o,f,g,u)=>{if(o+g>a||f+u>n)return!1;for(let z=0;z<g;z++)for(let j=0;j<u;j++)if(m.has(`${o+z},${f+j}`))return!1;return!0};for(const o of t){const f=(h=o.layouts)==null?void 0:h["flow-horizontal"];f&&N(f.x,f.y,f.w,Math.min(f.h,n))}return t.map(o=>{var z;if((z=o.layouts)!=null&&z["flow-horizontal"])return o;const f=Math.min(Math.max(1,o.position.w),a),g=Math.min(Math.max(1,o.position.h),n);let u={x:0,y:0,w:f,h:g};e:for(let j=0;j<=a-f;j++)for(let x=0;x<=n-g;x++)if(d(j,x,f,g)){u={x:j,y:x,w:f,h:g};break e}return N(u.x,u.y,u.w,u.h),{...o,layouts:{...o.layouts,"flow-horizontal":u}}})}const ba='<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>';function nt(t){queueMicrotask(()=>t.unmount())}function Na({spec:t,registry:a,onSave:n,customiseButtonTarget:m,onAccentHueChange:N,onAccentSatChange:d,onFontScaleChange:h,onUpColorChange:o,onDownColorChange:f,onModeChange:g,onBackgroundChange:u}){const z=Ts(),j=r.useRef(null),x=r.useRef(null),R=r.useRef(!1),T=r.useRef(t.grid.mode),w=r.useRef(new Map),b=r.useRef(new Map),A=r.useRef(new Map),I=r.useRef([]),le=r.useRef(t.theme.accentHue),S=r.useRef(t.theme.accentSat),O=r.useRef(t.theme.baseHue),ce=r.useRef(t.theme.baseSat),xe=r.useRef(t.theme.upColor),ft=r.useRef(t.theme.downColor),ht=r.useRef(t.grid.gap),Be=r.useRef(t.grid.mode),be=r.useRef(null),gt=r.useRef(t.appearance.radius),pt=r.useRef(t.appearance.borderStrength),xt=r.useRef(t.appearance.surfaceOpacity),bt=r.useRef(t.appearance.density),yt=r.useRef(t.appearance.elevation),zt=r.useRef(t.typography.fontFamily),jt=r.useRef(t.typography.numericStyle),Nt=r.useRef(t.typography.scale),vt=r.useRef(t.background.type),kt=r.useRef(t.background.projectId),wt=r.useRef(t.background.opacity),St=r.useRef(t.background.color),Ct=r.useRef(t.background.gradientFrom),Rt=r.useRef(t.background.gradientTo),At=r.useRef(t.background.gradientAngle),Mt=r.useRef(0),[L,Pe]=r.useState(!1),bs=oa(z,L),[ys,ye]=r.useState(t.frames.length),[P,ke]=r.useState(t.theme.accentHue),[D,we]=r.useState(t.theme.accentSat),[_,Se]=r.useState(t.theme.baseHue),[U,Ce]=r.useState(t.theme.baseSat),[W,Ge]=r.useState(t.theme.upColor),[q,De]=r.useState(t.theme.downColor),[$,Et]=r.useState(t.grid.mode),[zs,Tt]=r.useState(!1),[Q,_e]=r.useState(t.grid.gap),[K,Re]=r.useState(t.appearance.radius),[V,Ae]=r.useState(t.appearance.borderStrength),[X,Me]=r.useState(t.appearance.surfaceOpacity),[Y,Ee]=r.useState(t.appearance.density),[Z,Te]=r.useState(t.appearance.elevation),[ee,Ue]=r.useState(t.typography.fontFamily),[te,We]=r.useState(t.typography.numericStyle),[se,qe]=r.useState(t.typography.scale),[G,Ke]=r.useState(t.background.type),[J,Ve]=r.useState(t.background.projectId??Ne[0].projectId),[ae,Xe]=r.useState(t.background.opacity),[re,Ye]=r.useState(t.background.color),[oe,Lt]=r.useState(t.background.gradientFrom),[ue,Ft]=r.useState(t.background.gradientTo),[ne,Ze]=r.useState(t.background.gradientAngle),js=r.useCallback(s=>{ke(s.theme.accentHue),we(s.theme.accentSat),Se(s.theme.baseHue),Ce(s.theme.baseSat),Ue(s.typography.fontFamily),We(s.typography.numericStyle),Re(s.appearance.radius),Ae(s.appearance.borderStrength),Me(s.appearance.surfaceOpacity),Ee(s.appearance.density),Te(s.appearance.elevation);const l=Ne.find(i=>i.key===s.scene);l&&(Ke("unicorn"),Ve(l.projectId))},[]),It=r.useMemo(()=>{var s;return((s=es.find(l=>{var i;return l.theme.accentHue===P&&l.theme.accentSat===D&&l.theme.baseHue===_&&l.theme.baseSat===U&&l.typography.fontFamily===ee&&l.typography.numericStyle===te&&l.appearance.radius===K&&l.appearance.borderStrength===V&&l.appearance.surfaceOpacity===X&&l.appearance.density===Y&&l.appearance.elevation===Z&&G==="unicorn"&&((i=Ne.find(p=>p.key===l.scene))==null?void 0:i.projectId)===J}))==null?void 0:s.key)??null},[P,D,_,U,ee,te,K,V,X,Y,Z,G,J]),[me,$t]=r.useState("frames"),[Je,fe]=r.useState(null),Ht=r.useRef(null);Ht.current=Je,r.useEffect(()=>{N==null||N(P)},[P,N]),r.useEffect(()=>{d==null||d(D)},[D,d]),r.useEffect(()=>{h==null||h(se)},[se,h]),r.useEffect(()=>{o==null||o(W)},[W,o]),r.useEffect(()=>{f==null||f(q)},[q,f]),r.useEffect(()=>{T.current=$,g==null||g($)},[$,g]),r.useEffect(()=>{u==null||u({...t.background,type:G,projectId:J,opacity:ae,color:re,gradientFrom:oe,gradientTo:ue,gradientAngle:ne})},[G,J,ae,re,oe,ue,ne,t.background,u]),r.useEffect(()=>{var s;(s=x.current)==null||s.margin(Q/2)},[Q]);const Ot=r.useRef(z);Ot.current=z;const he=r.useRef(a);he.current=a;const Le=r.useMemo(()=>{const s=new Map;for(const c of a.values()){const y=c.category??"other",k=s.get(y);k?k.push(c):s.set(y,[c])}const l=ts.map(c=>c.key),i=ts.map(c=>({key:c.key,label:c.label,description:c.description,frames:s.get(c.key)??[]})),p=[...s.entries()].filter(([c])=>!l.includes(c)).flatMap(([,c])=>c);return p.length&&i.push({key:"other",label:"Other",description:"",frames:p}),i.filter(c=>c.frames.length>0).map(c=>({...c,frames:[...c.frames].sort((y,k)=>y.name.localeCompare(k.name))}))},[a]),[Bt,Ns]=r.useState(()=>new Set(Le[0]?[Le[0].key]:[])),vs=r.useCallback(s=>{Ns(l=>{const i=new Set(l);return i.has(s)?i.delete(s):i.add(s),i})},[]),ze=r.useCallback(s=>s?ca(s):{},[]),Fe=r.useCallback(s=>{let l=`${s}-${++Mt.current}`;for(;w.current.has(l);)l=`${s}-${++Mt.current}`;return l},[]),Ie=r.useRef(null),ie=r.useCallback(s=>{const l=A.current.get(s),i=w.current.get(s);if(!l||!i)return;let p=b.current.get(s);p||(l.innerHTML="",p=Es.createRoot(l),b.current.set(s,p)),p.render(e.jsx(Ls,{providers:Ot.current,children:e.jsx(Fs.Provider,{value:c=>{var y;return(y=Ie.current)==null?void 0:y.call(Ie,s,c)},children:e.jsx(Is,{instance:i,registry:he.current,className:"zf-fill"})})}))},[]),ks=r.useCallback((s,l)=>{const i=w.current.get(s);i&&(w.current.set(s,{...i,config:{...i.config,...l}}),ie(s))},[ie]);Ie.current=ks;const Pt=r.useCallback(s=>{const l=x.current;if(!l)return;const i=s.getAttribute("gs-id");if(i){const p=b.current.get(i);p&&nt(p),b.current.delete(i),A.current.delete(i),w.current.delete(i),Ht.current===i&&fe(null)}l.removeWidget(s,!0),ye(l.getGridItems().length)},[]),de=r.useCallback(s=>{if(!s.querySelector(".zf-cfg-btn")){const l=document.createElement("button");l.className="zf-cfg-btn",l.type="button",l.title="Edit frame",l.setAttribute("aria-label","Edit frame"),l.innerHTML=ba,l.addEventListener("click",i=>{i.stopPropagation();const p=s.getAttribute("gs-id");p&&fe(p)}),s.appendChild(l)}if(!s.querySelector(".zf-del-btn")){const l=document.createElement("button");l.className="zf-del-btn",l.type="button",l.title="Remove frame",l.innerHTML="×",l.addEventListener("click",i=>{i.stopPropagation(),Pt(s)}),s.appendChild(l)}},[Pt]),Gt=r.useCallback(s=>{var l,i;(l=s.querySelector(".zf-cfg-btn"))==null||l.remove(),(i=s.querySelector(".zf-del-btn"))==null||i.remove()},[]),$e=r.useCallback((s,l=!1)=>{const i=T.current,p=i==="flow-horizontal",c=cs(s,i),y=(c==null?void 0:c.w)??s.position.w,k=(c==null?void 0:c.h)??s.position.h,v=p?Math.min(k,t.grid.rows):k,E=he.current.get(s.frame),C=E==null?void 0:E.layout,M=document.createElement("div");M.className="grid-stack-item",M.setAttribute("gs-id",s.id),M.setAttribute("data-frame",s.frame),l||!c?M.setAttribute("gs-auto-position","true"):(M.setAttribute("gs-x",String(c.x)),M.setAttribute("gs-y",String(c.y))),M.setAttribute("gs-w",String(y)),M.setAttribute("gs-h",String(v)),C!=null&&C.minW&&M.setAttribute("gs-min-w",String(C.minW)),C!=null&&C.minH&&M.setAttribute("gs-min-h",String(C.minH)),C!=null&&C.maxW&&M.setAttribute("gs-max-w",String(C.maxW)),C!=null&&C.maxH&&M.setAttribute("gs-max-h",String(C.maxH));const F=document.createElement("div");return F.className="grid-stack-item-content",M.appendChild(F),A.current.set(s.id,F),M},[t.grid.rows]),je=r.useCallback(s=>{const l=x.current;if(l){b.current.forEach(nt),b.current.clear(),A.current.clear(),w.current=new Map(s.map(i=>[i.id,i])),l.removeAll(!0),l.el.querySelectorAll(".grid-stack-item").forEach(i=>i.remove()),l.batchUpdate();for(const i of s){const p=$e(i);l.el.appendChild(p),l.makeWidget(p),ie(i.id)}l.batchUpdate(!1),ye(s.length)}},[$e,ie]),Dt=r.useCallback(s=>{var k,v;const l=x.current;if(!l)return;const i=he.current.get(s),p=Fe(s),c={id:p,frame:s,position:{x:0,y:0,w:((k=i==null?void 0:i.layout)==null?void 0:k.w)??4,h:((v=i==null?void 0:i.layout)==null?void 0:v.h)??3},config:ze(i)};w.current.set(p,c);const y=$e(c,!0);l.el.appendChild(y),l.makeWidget(y),ie(p),de(y),ye(l.getGridItems().length),fe(p)},[$e,de,ze,ie,Fe]),He=r.useCallback(()=>{var p,c;const s=typeof window<"u"?window.innerHeight:800,l=((c=(p=j.current)==null?void 0:p.parentElement)==null?void 0:c.getBoundingClientRect().top)??120,i=s-l-56;return Math.max(80,Math.floor(i/t.grid.rows))},[t.grid.rows]),Qe=r.useCallback(()=>{const s=x.current;if(!s)return;const l=s.el;s.off("dropped"),s.off("removed"),s.off("drag"),s.off("dragstart"),s.off("dragstop"),document.body.classList.remove("zf-dragging"),b.current.forEach(nt),b.current.clear(),A.current.clear(),s.destroy(!1),l&&(l.querySelectorAll(".grid-stack-item").forEach(i=>i.remove()),l.style.width="",l.style.height=""),x.current=null},[]),et=r.useCallback((s,l)=>{const i=s==="flow-horizontal",p=i?He():t.grid.rowHeight,c=Qt.init({column:i?l:t.grid.columns,cellHeight:p,margin:t.grid.gap/2,float:!0,...i?{maxRow:t.grid.rows,minRow:t.grid.rows}:{},animate:!0,acceptWidgets:!0,disableDrag:!0,disableResize:!0},j.current);return c.el.style.width=i?`${l*p}px`:"",c.on("dropped",(y,k,v)=>{var Yt,Zt;const E=v==null?void 0:v.el;if(!E)return;const C=E.querySelector(".grid-stack-item-content"),M=E.getAttribute("data-frame");if(!C||!M)return;const F=E.getAttribute("gs-id")||Fe(M);E.setAttribute("gs-id",F);const B=he.current.get(M),Kt=(v==null?void 0:v.w)??((Yt=B==null?void 0:B.layout)==null?void 0:Yt.w)??4,Vt=(v==null?void 0:v.h)??((Zt=B==null?void 0:B.layout)==null?void 0:Zt.h)??3,Xt={x:(v==null?void 0:v.x)??0,y:(v==null?void 0:v.y)??0,w:Kt,h:Vt},Ms=T.current==="flow-horizontal"?{id:F,frame:M,position:{x:0,y:0,w:Kt,h:Vt},layouts:{"flow-horizontal":Xt},config:ze(B)}:{id:F,frame:M,position:Xt,config:ze(B)};w.current.set(F,Ms),A.current.set(F,C),ie(F),de(E),ye(c.getGridItems().length),fe(F)}),c.on("removed",()=>ye(c.getGridItems().length)),c.on("dragstart",()=>document.body.classList.add("zf-dragging")),c.on("dragstop",()=>document.body.classList.remove("zf-dragging")),i&&c.on("drag",y=>{var M,F,B;const k=(M=j.current)==null?void 0:M.parentElement;if(!k)return;const v=k.getBoundingClientRect(),E=y.clientX??((B=(F=y.touches)==null?void 0:F[0])==null?void 0:B.clientX);if(E==null)return;const C=64;E<v.left+C?k.scrollLeft-=18:E>v.right-C&&(k.scrollLeft+=18)}),c},[He,t.grid.columns,t.grid.rowHeight,t.grid.rows,t.grid.gap,Fe,ze,ie,de]);r.useEffect(()=>{if(!j.current||R.current)return;R.current=!0;const s=T.current==="flow-horizontal",l=s?os(t.frames,t.grid.rows):t.grid.columns;return x.current=et(T.current,l),je(s?us(t.frames,l,t.grid.rows):t.frames),()=>{Qe(),R.current=!1}},[]),r.useEffect(()=>{const s=x.current;s&&(s.enableMove(L),s.enableResize(L),L?s.getGridItems().forEach(de):s.getGridItems().forEach(Gt))},[L,de,Gt]),r.useEffect(()=>{const s=x.current;if(!s||T.current!=="flow-horizontal")return;const l=requestAnimationFrame(()=>{const i=He();s.cellHeight(i),s.el.style.width=`${s.getColumn()*i}px`});return()=>cancelAnimationFrame(l)},[L,He]),r.useEffect(()=>{!L||me!=="frames"||!x.current||Qt.setupDragIn(".zf-newwidget",{appendTo:"body",helper:s=>{var C;const i=(s.closest(".zf-newwidget")??s).dataset.frame??"",p=he.current.get(i),c=p==null?void 0:p.layout,y=document.createElement("div");y.className="grid-stack-item",y.setAttribute("data-frame",i),y.setAttribute("gs-w",String((c==null?void 0:c.w)??4)),y.setAttribute("gs-h",String((c==null?void 0:c.h)??3)),c!=null&&c.minW&&y.setAttribute("gs-min-w",String(c.minW)),c!=null&&c.minH&&y.setAttribute("gs-min-h",String(c.minH)),c!=null&&c.maxW&&y.setAttribute("gs-max-w",String(c.maxW)),c!=null&&c.maxH&&y.setAttribute("gs-max-h",String(c.maxH));const k=(C=j.current)==null?void 0:C.closest(".zf-editor");if(k){const M=getComputedStyle(k);for(const F of["--zf-accent-hue","--zf-accent-sat","--font-dmsans"]){const B=M.getPropertyValue(F).trim();B&&y.style.setProperty(F,B)}}const v=i.replace(/-/g," "),E=p!=null&&p.iconUrl?`<img class="zf-drag-ghost-icon" src="${p.iconUrl}" alt="" />`:"";return y.innerHTML=`<div class="grid-stack-item-content zf-drag-ghost" data-frame="${i}">${E}<span class="zf-drag-ghost-name">${v}</span></div>`,y}})},[L,me,Le,Bt]);const ge=r.useCallback(()=>{const s=x.current,l=[];if(s)for(const i of s.getGridItems()){const p=i.getAttribute("gs-id");if(!p)continue;const c=w.current.get(p);if(!c)continue;const y=i.gridstackNode,k=cs(c,$)??c.position,v={x:(y==null?void 0:y.x)??k.x,y:(y==null?void 0:y.y)??k.y,w:(y==null?void 0:y.w)??k.w,h:(y==null?void 0:y.h)??k.h};l.push($==="flow-horizontal"?{...c,layouts:{...c.layouts,"flow-horizontal":v}}:{...c,position:v})}return l.sort((i,p)=>i.position.y-p.position.y||i.position.x-p.position.x),{...t,grid:{...t.grid,gap:Q,mode:$},background:{...t.background,type:G,projectId:J,opacity:ae,color:re,gradientFrom:oe,gradientTo:ue,gradientAngle:ne},theme:{...t.theme,accentHue:P,accentSat:D,baseHue:_,baseSat:U,upColor:W,downColor:q},typography:{...t.typography,fontFamily:ee,numericStyle:te,scale:se},appearance:{...t.appearance,radius:K,borderStrength:V,surfaceOpacity:X,density:Y,elevation:Z},frames:l}},[t,P,D,_,U,W,q,ee,te,se,Q,$,K,V,X,Y,Z,G,J,ae,re,oe,ue,ne]),_t=r.useCallback(s=>{const l=new Blob([`${JSON.stringify(s,null,2)}
|
|
68
|
+
`],{type:"application/json"}),i=URL.createObjectURL(l),p=document.createElement("a");p.href=i,p.download="dashboard.json",p.click(),setTimeout(()=>URL.revokeObjectURL(i),0)},[]),ws=r.useCallback(()=>{I.current=ge().frames,le.current=P,S.current=D,O.current=_,ce.current=U,xe.current=W,ft.current=q,ht.current=Q,Be.current=$,gt.current=K,pt.current=V,xt.current=X,bt.current=Y,yt.current=Z,zt.current=ee,jt.current=te,Nt.current=se,vt.current=G,kt.current=J,wt.current=ae,St.current=re,Ct.current=oe,Rt.current=ue,At.current=ne,Pe(!0)},[ge,P,D,_,U,W,q,Q,$,K,V,X,Y,Z,ee,te,se,G,J,ae,re,oe,ue,ne]),Ss=r.useCallback(()=>{(Be.current!==T.current||JSON.stringify(ge().frames)!==JSON.stringify(I.current))&&je(I.current),ke(le.current),we(S.current),Se(O.current),Ce(ce.current),Ge(xe.current),De(ft.current),_e(ht.current),Et(Be.current),Re(gt.current),Ae(pt.current),Me(xt.current),Ee(bt.current),Te(yt.current),Ue(zt.current),We(jt.current),qe(Nt.current),Ke(vt.current),Ve(kt.current??Ne[0].projectId),Xe(wt.current),Ye(St.current),Lt(Ct.current),Ft(Rt.current),Ze(At.current),fe(null),Pe(!1)},[je,ge]),Cs=r.useCallback(async()=>{const s=ge();Pe(!1),fe(null),n?await n(s):_t(s)},[ge,n,_t]),Rs=r.useCallback(()=>{var s;(s=x.current)==null||s.compact(T.current==="flow-horizontal"?"list":"compact")},[]),Ut=r.useCallback(()=>{const s=x.current;if(!s)return;const l=T.current;for(const i of s.getGridItems()){const p=i.getAttribute("gs-id");if(!p)continue;const c=w.current.get(p);if(!c)continue;const y=i.gridstackNode;if(!y)continue;const k={x:y.x??0,y:y.y??0,w:y.w??1,h:y.h??1};w.current.set(p,l==="flow-horizontal"?{...c,layouts:{...c.layouts,"flow-horizontal":k}}:{...c,position:k})}},[]),Wt=r.useCallback(s=>{var p;if(s===T.current)return;const l=()=>{Ut();const c=[...w.current.values()],y=L,k=s==="flow-horizontal",v=k?os(c,t.grid.rows):t.grid.columns;Qe(),T.current=s,Et(s);const E=et(s,v);x.current=E,je(k?us(c,v,t.grid.rows):c),y&&(E.enableMove(!0),E.enableResize(!0),E.getGridItems().forEach(de))};if(typeof window<"u"&&((p=window.matchMedia)==null?void 0:p.call(window,"(prefers-reduced-motion: reduce)").matches)){l();return}be.current&&clearTimeout(be.current),Tt(!0),be.current=setTimeout(()=>{l(),requestAnimationFrame(()=>Tt(!1))},150)},[L,Ut,Qe,et,je,de,t.grid.rows,t.grid.columns]);r.useEffect(()=>()=>{be.current&&clearTimeout(be.current)},[]);const qt=()=>e.jsx("button",{type:"button",className:"zf-btn zf-btn--icon",onClick:ws,"aria-label":"Customise",title:"Customise",children:e.jsx(Js,{size:18,"aria-hidden":"true"})}),tt=L&&Je?w.current.get(Je):void 0,As=$==="flow-horizontal";return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:$s}),m&&!L?Jt.createPortal(qt(),m):null,e.jsxs("div",{className:L?"zf-editor zf-customise":"zf-editor","data-mode":$,"data-wiggle":L&&ys>12?"off":void 0,style:{"--zf-accent-hue":P,"--zf-accent-sat":`${D}%`,"--zf-base-hue":_,"--zf-base-sat":`${U}%`,"--zf-up":W,"--zf-down":q,"--zf-font-family":as[ee],"--zf-numeric":ss[te],"--zf-frame-radius":`${K}px`,"--zf-border-alpha":V,"--zf-surface-opacity":X,"--zf-density":Y,"--zf-elevation":Z},children:[(L||!m)&&e.jsxs("div",{className:"zf-editor-bar",children:[e.jsx("div",{className:"zf-editor-bar-spacer"}),L?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"zf-btn zf-btn--ghost",onClick:Rs,title:"Reclaim empty grid space",children:"Tidy"}),e.jsx("button",{type:"button",className:"zf-btn zf-btn--ghost",onClick:Ss,children:"Cancel"}),e.jsx("button",{type:"button",className:"zf-btn zf-btn--primary",onClick:Cs,children:"Save"})]}):qt()]}),e.jsxs("div",{className:"zf-editor-main",children:[e.jsx("div",{className:"zf-editor-grid","data-switching":zs,children:e.jsx("div",{ref:j,className:"grid-stack"})}),e.jsx("aside",{className:"zf-rail","aria-hidden":!L,inert:!L,children:e.jsxs("div",{className:"zf-rail-inner",children:[e.jsxs("div",{className:"zf-rail-tabs",role:"tablist","aria-label":"Customise",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":me==="frames",className:me==="frames"?"zf-rail-tab is-active":"zf-rail-tab",onClick:()=>$t("frames"),children:"Frames"}),e.jsx("button",{type:"button",role:"tab","aria-selected":me==="cosmetics",className:me==="cosmetics"?"zf-rail-tab is-active":"zf-rail-tab",onClick:()=>$t("cosmetics"),children:"Cosmetics"})]}),me==="cosmetics"&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"zf-theme",children:[e.jsx("h3",{className:"zf-rail-title",style:{margin:0},children:"Presets"}),e.jsx("div",{className:"zf-presets",children:es.map(s=>e.jsxs("button",{type:"button",className:It===s.key?"zf-preset is-active":"zf-preset",title:s.description,"aria-pressed":It===s.key,onClick:()=>js(s),children:[e.jsx("span",{className:"zf-preset-swatch",style:{background:`linear-gradient(135deg, hsl(${s.theme.baseHue} ${s.theme.baseSat}% 16%) 0 52%, hsl(${s.theme.accentHue} ${s.theme.accentSat}% 62%) 52% 100%)`}}),e.jsx("span",{className:"zf-preset-label",children:s.label})]},s.key))})]}),e.jsxs("section",{className:"zf-theme",children:[e.jsx("h3",{className:"zf-rail-title",style:{margin:0},children:"Accent"}),e.jsxs("div",{className:"zf-theme-row",style:{margin:"10px 0 0"},children:[e.jsxs("span",{className:"zf-theme-val",children:[e.jsx("span",{className:"zf-theme-swatch"}),"Hue ",P,"°"]}),P!==242&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>ke(242),children:"Reset"})]}),e.jsx("input",{type:"range",className:"zf-hue-slider",min:0,max:360,value:P,"aria-label":"Accent hue",onChange:s=>ke(Number(s.target.value))}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Saturation"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[D!==90&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>we(90),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[D,"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:100,value:D,"aria-label":"Accent saturation",onChange:s=>we(Number(s.target.value))})]}),e.jsxs("section",{className:"zf-theme",children:[e.jsx("h3",{className:"zf-rail-title",children:"Surface"}),e.jsxs("div",{className:"zf-theme-row",style:{margin:"10px 0 0"},children:[e.jsxs("span",{className:"zf-theme-val",children:[e.jsx("span",{className:"zf-theme-swatch",style:{background:`hsl(${_} ${U}% 32%)`,boxShadow:"none"}}),"Tint ",_,"°"]}),_!==233&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Se(233),children:"Reset"})]}),e.jsx("input",{type:"range",className:"zf-hue-slider",min:0,max:360,value:_,"aria-label":"Surface tint hue",onChange:s=>Se(Number(s.target.value))}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Tint strength"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[U!==20&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Ce(20),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[U,"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:100,value:U,"aria-label":"Surface tint strength",onChange:s=>Ce(Number(s.target.value))})]}),e.jsxs("section",{className:"zf-theme",children:[e.jsx("h3",{className:"zf-rail-title",children:"Gain / Loss"}),e.jsxs("div",{className:"zf-theme-row",style:{margin:"10px 0 0"},children:[e.jsxs("label",{className:"zf-theme-val",children:[e.jsx("input",{type:"color",className:"zf-color",value:W,"aria-label":"Gain (up) colour",onChange:s=>Ge(s.target.value)}),"Up ",W]}),W.toLowerCase()!=="#3fd08f"&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Ge("#3fd08f"),children:"Reset"})]}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:9},children:[e.jsxs("label",{className:"zf-theme-val",children:[e.jsx("input",{type:"color",className:"zf-color",value:q,"aria-label":"Loss (down) colour",onChange:s=>De(s.target.value)}),"Down ",q]}),q.toLowerCase()!=="#ff6b81"&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>De("#ff6b81"),children:"Reset"})]})]}),e.jsxs("section",{className:"zf-theme",children:[e.jsx("h3",{className:"zf-rail-title",children:"Background"}),e.jsx("div",{className:"zf-seg",role:"group","aria-label":"Background style",children:["none","color","gradient","unicorn"].map(s=>e.jsx("button",{type:"button",className:G===s?"zf-seg-btn is-active":"zf-seg-btn","aria-pressed":G===s,onClick:()=>Ke(s),children:s==="none"?"Glow":s==="color"?"Color":s==="gradient"?"Gradient":"Scene"},s))}),G==="color"&&e.jsxs("div",{className:"zf-theme-row",style:{marginTop:12},children:[e.jsxs("label",{className:"zf-theme-val",children:[e.jsx("input",{type:"color",className:"zf-color",value:re,"aria-label":"Background colour",onChange:s=>Ye(s.target.value)}),re]}),re.toLowerCase()!=="#0a0a12"&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Ye("#0a0a12"),children:"Reset"})]}),G==="gradient"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"zf-theme-row",style:{marginTop:12},children:e.jsxs("label",{className:"zf-theme-val",children:[e.jsx("input",{type:"color",className:"zf-color",value:oe,"aria-label":"Gradient start colour",onChange:s=>Lt(s.target.value)}),"From ",oe]})}),e.jsx("div",{className:"zf-theme-row",style:{marginTop:9},children:e.jsxs("label",{className:"zf-theme-val",children:[e.jsx("input",{type:"color",className:"zf-color",value:ue,"aria-label":"Gradient end colour",onChange:s=>Ft(s.target.value)}),"To ",ue]})}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Angle"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[ne!==160&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Ze(160),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[ne,"°"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:360,value:ne,"aria-label":"Gradient angle",onChange:s=>Ze(Number(s.target.value))})]}),G==="unicorn"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"zf-presets",style:{marginTop:12},role:"group","aria-label":"Background scene",children:Ne.map(s=>e.jsxs("button",{type:"button",className:J===s.projectId?"zf-preset is-active":"zf-preset",title:s.description,"aria-pressed":J===s.projectId,onClick:()=>Ve(s.projectId),children:[e.jsx("span",{className:"zf-preset-swatch",style:{background:s.swatch}}),e.jsx("span",{className:"zf-preset-label",children:s.label})]},s.key))}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Opacity"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[ae!==.16&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Xe(.16),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Math.round(ae*100),"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:.6,step:.02,value:ae,"aria-label":"Background scene opacity",onChange:s=>Xe(Math.round(Number(s.target.value)*100)/100)})]})]}),e.jsxs("section",{className:"zf-theme",children:[e.jsx("h3",{className:"zf-rail-title",children:"Layout"}),e.jsx("div",{className:"zf-theme-row",children:e.jsx("span",{className:"zf-theme-val",children:"Direction"})}),e.jsxs("div",{className:"zf-mode-seg",role:"group","aria-label":"Dashboard layout direction",children:[e.jsx("button",{type:"button",className:$==="flow-vertical"?"zf-mode-seg-btn is-active":"zf-mode-seg-btn","aria-pressed":$==="flow-vertical",onClick:()=>Wt("flow-vertical"),children:"Vertical"}),e.jsx("button",{type:"button",className:$==="flow-horizontal"?"zf-mode-seg-btn is-active":"zf-mode-seg-btn","aria-pressed":$==="flow-horizontal",onClick:()=>Wt("flow-horizontal"),children:"Horizontal"})]}),As&&e.jsx("p",{className:"zf-mode-seg-hint",children:"Rows fill the height; the board scrolls sideways. Arrange it freely — this layout is saved separately from Vertical."}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Frame gap"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[Q!==12&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>_e(12),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Q,"px"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:12,value:Q,"aria-label":"Frame gap",onChange:s=>_e(Number(s.target.value))})]}),e.jsxs("section",{className:"zf-theme",children:[e.jsx("h3",{className:"zf-rail-title",children:"Appearance"}),e.jsxs("div",{className:"zf-theme-row",children:[e.jsx("span",{className:"zf-theme-val",children:"Corner radius"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[K!==18&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Re(18),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[K,"px"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:32,value:K,"aria-label":"Corner radius",onChange:s=>Re(Number(s.target.value))}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Border"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[V!==.22&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Ae(.22),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Math.round(V*100),"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:1,step:.01,value:V,"aria-label":"Border strength",onChange:s=>Ae(Math.round(Number(s.target.value)*100)/100)}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Card opacity"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[X!==1&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Me(1),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Math.round(X*100),"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:.3,max:1,step:.05,value:X,"aria-label":"Card opacity",onChange:s=>Me(Math.round(Number(s.target.value)*100)/100)}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Density"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[Y!==1&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Ee(1),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Math.round(Y*100),"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:.6,max:1.4,step:.05,value:Y,"aria-label":"Card density",onChange:s=>Ee(Math.round(Number(s.target.value)*100)/100)}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Elevation"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[Z!==1&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Te(1),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Z.toFixed(1),"×"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:2,step:.1,value:Z,"aria-label":"Card elevation",onChange:s=>Te(Math.round(Number(s.target.value)*10)/10)})]}),e.jsxs("section",{className:"zf-theme",children:[e.jsx("h3",{className:"zf-rail-title",children:"Typography"}),e.jsx("div",{className:"zf-theme-row",children:e.jsx("span",{className:"zf-theme-val",children:"Font"})}),e.jsx("div",{className:"zf-seg",role:"group","aria-label":"Font family",children:["sans","mono","serif"].map(s=>e.jsx("button",{type:"button",className:ee===s?"zf-seg-btn is-active":"zf-seg-btn","aria-pressed":ee===s,style:{fontFamily:as[s]},onClick:()=>Ue(s),children:s==="sans"?"Sans":s==="mono"?"Mono":"Serif"},s))}),e.jsx("div",{className:"zf-theme-row",style:{marginTop:13},children:e.jsx("span",{className:"zf-theme-val",children:"Numbers"})}),e.jsx("div",{className:"zf-seg",role:"group","aria-label":"Numeric style",children:["proportional","tabular"].map(s=>e.jsx("button",{type:"button",className:te===s?"zf-seg-btn is-active":"zf-seg-btn","aria-pressed":te===s,onClick:()=>We(s),children:e.jsx("span",{style:{fontVariantNumeric:ss[s]},children:s==="proportional"?"Normal 1,071":"Tabular 1,071"})},s))}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Text size"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[se!==1&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>qe(1),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Math.round(se*100),"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:.85,max:1.25,step:.05,value:se,"aria-label":"Text size",onChange:s=>qe(Math.round(Number(s.target.value)*100)/100)})]})]}),me==="frames"&&e.jsxs("section",{children:[e.jsx("h3",{className:"zf-rail-title",children:"Add a frame"}),e.jsx("p",{className:"zf-palette-hint",children:"Open a category, then click a frame to add it — or drag it onto the grid."}),e.jsx("div",{className:"zf-palette-cats",children:Le.map(s=>{const l=Bt.has(s.key);return e.jsxs("div",{className:l?"zf-palette-cat is-open":"zf-palette-cat",children:[e.jsxs("button",{type:"button",className:"zf-palette-cat-header","aria-expanded":l,onClick:()=>vs(s.key),children:[e.jsx("svg",{className:"zf-palette-cat-chevron",viewBox:"0 0 16 16","aria-hidden":"true",children:e.jsx("path",{d:"M6 4l4 4-4 4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{className:"zf-palette-cat-label",children:s.label}),e.jsx("span",{className:"zf-palette-cat-count",children:s.frames.length})]}),l&&e.jsxs("div",{className:"zf-palette-cat-body",children:[s.description&&e.jsx("p",{className:"zf-palette-cat-desc",children:s.description}),e.jsx("div",{className:"zf-palette",children:s.frames.map(i=>{var p,c,y,k,v,E;return e.jsxs("div",{className:"grid-stack-item zf-newwidget","data-frame":i.name,"gs-w":((p=i.layout)==null?void 0:p.w)??4,"gs-h":((c=i.layout)==null?void 0:c.h)??3,"gs-min-w":(y=i.layout)==null?void 0:y.minW,"gs-min-h":(k=i.layout)==null?void 0:k.minH,"gs-max-w":(v=i.layout)==null?void 0:v.maxW,"gs-max-h":(E=i.layout)==null?void 0:E.maxH,role:"button",tabIndex:0,title:`Drag onto the board, or click to add ${i.label}`,onClick:()=>Dt(i.name),onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),Dt(i.name))},children:[i.iconUrl&&e.jsx("img",{className:"zf-newwidget-icon",src:i.iconUrl,alt:"",loading:"lazy",draggable:!1}),e.jsxs("div",{className:"zf-newwidget-copy",children:[e.jsx("div",{className:"zf-newwidget-name",children:i.label}),e.jsx("div",{className:"zf-newwidget-desc",children:i.description})]})]},i.name)})})]})]},s.key)})})]})]})})]})]}),tt?Jt.createPortal(e.jsx(ua,{instance:tt,registry:a,instancesRef:w,symbolUniverse:bs,accentHue:P,onApply:s=>ie(s),onClose:()=>fe(null)},tt.id),document.body):null]})}export{Na as DashboardEditor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e}from"./react-qoZPGuNy.js";import{f as u,
|
|
1
|
+
import{r as c,j as e}from"./react-qoZPGuNy.js";import{f as u,C as l,D as m}from"./index-DNLPQoS7.js";import{F as i}from"./ui-Bq3RQsdJ.js";import{M as p}from"./mini-line-chart-CHM5UBjJ.js";import"./d3-xK4fOkBU.js";import"./utils-DaT-yT0k.js";l.schema;function x(r){return r<=25?"#F21553":r<=45?"#F97316":r<=55?"#F59E0B":r<=75?"#84CC16":"#25A78D"}function f({config:r}){const{points:s,isLoading:o}=m(r.sparklineDays),t=s[0],d=c.useMemo(()=>[...s].reverse().map(n=>({date:new Date(n.time).toISOString(),value:n.value})),[s]);if(o)return e.jsx(i,{loading:!0,children:"loading index…"});if(!t)return e.jsx(i,{children:"no sentiment data yet"});const a=x(t.value);return e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2.5",children:[e.jsx("div",{className:"metric-xl leading-none",style:{color:a,textShadow:`0 0 28px ${a}55`},children:t.value}),e.jsx("div",{className:"body-sm rounded-full px-2.5 py-0.5 font-semibold uppercase tracking-wide",style:{color:a,background:`${a}1f`,border:`1px solid ${a}33`},children:t.classification}),e.jsxs("div",{className:"relative w-full max-w-[180px] overflow-hidden rounded-xl",children:[e.jsx("div",{className:"h-[11px] w-full opacity-40",style:{background:"linear-gradient(90deg, #FF1F5F 4.89%, #464646 34.15%, #464646 69.98%, #81FE90 100%)"}}),e.jsx("div",{className:"absolute left-0 top-0 h-full w-full",style:{background:"repeating-linear-gradient(to right, var(--color-background-terminal), var(--color-background-terminal) 2px, transparent 2px, transparent 3px)"}}),e.jsx("div",{className:"absolute top-1/2 h-3 w-[3px] -translate-x-1/2 -translate-y-1/2 rounded-xs",style:{left:`${t.value}%`,background:a}})]}),e.jsx(p,{data:d,width:150,height:30,color:a}),e.jsxs("div",{className:"caption text-soft",children:["crypto fear & greed · ",r.sparklineDays,"d"]})]})}const b=u({...l,component:f});export{b as fearGreedFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,j as t}from"./react-qoZPGuNy.js";import{f,
|
|
1
|
+
import{r as x,j as t}from"./react-qoZPGuNy.js";import{f,E as p,G as h,h as u,A as F}from"./index-DNLPQoS7.js";import{F as j}from"./feed-row-mVg1d5Zj.js";import{t as b}from"./format-CfAcS4D8.js";import{F as a,s as y}from"./ui-Bq3RQsdJ.js";p.schema;const n={"10-K":"Annual report","10-Q":"Quarterly report","8-K":"Material event","20-F":"Annual report (foreign)","40-F":"Annual report (foreign)","6-K":"Foreign interim report","S-1":"Registration","S-3":"Registration","S-4":"Registration (M&A)","DEF 14A":"Proxy statement",DEFA14A:"Proxy materials","SC 13D":"Activist stake","SC 13G":"Passive stake",SD:"Specialized disclosure",3:"Initial insider ownership",4:"Insider transaction",5:"Annual insider ownership",144:"Proposed insider sale","11-K":"Employee benefit plan"},A=/^(10-K|10-Q|8-K|20-F|40-F|6-K|S-|F-|424|DEF |DEFA|DEFM|11-K|SC 13|25)/i,E=/^(3|4|5|144)(\/A)?$/;function l(e){return e.replace(/^SCHEDULE /i,"SC ").trim()}function S(e,s){return s==="all"?!0:s==="insider"?E.test(e):A.test(e)}function D(e){const s=l(e.form);if(n[s])return n[s];const r=s.replace(/\/A$/,"");return r!==s&&n[r]?`${n[r]} (amended)`:e.description&&e.description.toUpperCase()!==e.form.toUpperCase()?e.description:s}function N({filing:e}){return t.jsx(j,{href:e.url,titleAttr:e.form,leading:t.jsx("span",{className:"caption text-strong inline-flex w-16 shrink-0 justify-center truncate rounded bg-white/[0.06] px-1.5 py-1 font-bold",children:l(e.form)}),title:D(e),subtitle:e.reportDate?`period ${e.reportDate}`:e.items?`items ${e.items}`:e.accessionNumber,meta:e.filingDate?b(new Date(e.filingDate).getTime()):void 0})}function v({config:e}){const{data:s,isLoading:r}=h(e.symbol),m=x.useMemo(()=>((s==null?void 0:s.filings)??[]).filter(i=>S(l(i.form),e.forms)).slice(0,e.count),[s==null?void 0:s.filings,e.forms,e.count]);if(r)return t.jsx(a,{loading:!0,children:"loading SEC filings…"});if(!s)return t.jsxs(a,{children:["no SEC data for “",u(e.symbol),"”"]});const o=s.tickers[0],c=e.symbol.includes(":")?e.symbol:o?`xyz:${o}`:null,d=[s.exchanges[0],s.category].filter(Boolean).join(" · ");return t.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c&&t.jsx(F,{symbol:c,size:22}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"body-sm text-strong truncate font-semibold",children:s.name||o||u(e.symbol)}),d&&t.jsx("div",{className:"caption text-soft truncate",children:d})]})]}),t.jsx("div",{className:"caption text-soft shrink-0 text-right",children:"filings"})]}),t.jsx("div",{className:y,children:m.length>0?m.map(i=>t.jsx(N,{filing:i},i.accessionNumber)):t.jsxs(a,{children:["no ",e.forms==="all"?"":`${e.forms} `,"filings yet"]})})]})}const k=f({...p,component:v});export{k as filingsFeedFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e}from"./react-qoZPGuNy.js";import{D as m,U as x}from"./format-CfAcS4D8.js";import{f as h,
|
|
1
|
+
import{r as c,j as e}from"./react-qoZPGuNy.js";import{D as m,U as x}from"./format-CfAcS4D8.js";import{f as h,J as l,K as u}from"./index-DNLPQoS7.js";import{F as r}from"./ui-Bq3RQsdJ.js";import{M as f}from"./mini-line-chart-CHM5UBjJ.js";import"./d3-xK4fOkBU.js";import"./utils-DaT-yT0k.js";l.schema;function n(t){return t>0?m:x}function p(t){return t>=2.5?"high stress":t>=1?"elevated":t>-1?"near average":"below average"}function j({config:t}){const{stress:s,isLoading:d}=u(),o=c.useMemo(()=>((s==null?void 0:s.trend)??[]).slice(-t.trendDays).map(a=>({date:new Date(a.time).toISOString(),value:a.value})),[t.trendDays,s==null?void 0:s.trend]);if(d)return e.jsx(r,{loading:!0,children:"loading stress index…"});if(!s)return e.jsx(r,{children:"no stress-index data yet"});const i=n(s.value);return e.jsxs("div",{className:"flex h-full min-h-0 flex-col justify-center gap-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"caption text-soft uppercase",children:"OFR FSI"}),e.jsx("div",{className:"body-sm text-normal",children:s.date})]}),e.jsx("div",{className:"caption text-soft text-right",children:"daily"})]}),e.jsxs("div",{className:"flex items-end justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"metric-xl leading-none",style:{color:i,textShadow:`0 0 24px ${i}44`},children:[s.value>0?"+":"",s.value.toFixed(2)]}),e.jsx("div",{className:"caption text-soft mt-1",children:p(s.value)})]}),e.jsxs("div",{className:"caption text-soft max-w-[46%] text-right leading-snug",children:["0 = long-run average",e.jsx("br",{}),"higher = more stress"]})]}),e.jsx(f,{data:o,width:210,height:42,color:i}),t.showCategories&&s.categories.length>0&&e.jsx("div",{className:"grid grid-cols-2 gap-1.5 border-t border-white/[0.08] pt-2",children:s.categories.map(a=>e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"caption text-soft truncate",children:a.label}),e.jsxs("span",{className:"body-sm font-bold tabular-nums",style:{color:n(a.value)},children:[a.value>0?"+":"",a.value.toFixed(2)]})]},a.label))})]})}const y=h({...l,component:j});export{y as financialStressFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as x}from"./react-qoZPGuNy.js";import{a as F,d as _,G as I}from"./game-ui-Dy_QYsPr.js";import{f as O,
|
|
1
|
+
import{r as i,j as x}from"./react-qoZPGuNy.js";import{a as F,d as _,G as I}from"./game-ui-Dy_QYsPr.js";import{f as O,aB as v}from"./index-DNLPQoS7.js";import"./format-CfAcS4D8.js";const L=.225,j=-3.6,b=52,A=132,z=210,U=1.3,C=64,p=12,M=28,N=28,R={bird:"rgba(255, 255, 255, 0.95)",eye:"rgba(0, 0, 0, 0.8)",pipe:"hsla(160, 64%, 40%, 0.9)",ground:"rgba(255, 255, 255, 0.1)"};function B(t,r,f,d){t.save(),t.translate(C,r),t.rotate(Math.max(-.5,Math.min(.9,f*.06))),t.fillStyle=R.bird,t.beginPath(),t.arc(0,0,p,0,Math.PI*2),t.fill(),t.fillStyle=d,t.fillRect(-p+2,0,10,5),t.fillStyle=R.eye,t.beginPath(),t.arc(5,-4,2,0,Math.PI*2),t.fill(),t.restore()}function V(t,r,f,d,y,h){r.clearRect(0,0,t.width,t.height);const c=t.height-M;r.fillStyle=R.ground,r.fillRect(0,c,t.width,2),B(r,t.height/2,0,h),r.textAlign="center",f==="idle"?(r.fillStyle=I.text,r.font='bold 14px "DM Sans", sans-serif',r.fillText("Press SPACE or tap to fly",t.width/2,t.height/2-40)):(r.fillStyle=I.gameOver,r.font='bold 20px "DM Sans", sans-serif',r.fillText("GAME OVER",t.width/2,t.height/2-50),r.fillStyle=I.text,r.font='bold 14px "DM Sans", sans-serif',r.fillText(`Score: ${d}`,t.width/2,t.height/2-22),r.fillStyle=I.textSoft,r.fillText("Press SPACE or tap to retry",t.width/2,t.height/2+6)),r.textAlign="left",_(t,r,d,y,h)}function X(){const t=i.useRef(null),r=i.useRef(null),[f,d]=i.useState("idle"),[y,h]=i.useState(0),[c,H]=i.useState(()=>{if(typeof window<"u"){const e=localStorage.getItem("zframes-flappy-bird-high-score");return e?parseInt(e,10):0}return 0}),[,k]=i.useState(!1),u=i.useRef(0),g=i.useRef(c),E=i.useRef(f),m=i.useRef(F(null));i.useEffect(()=>{g.current=c,c>0&&localStorage.setItem("zframes-flappy-bird-high-score",String(c))},[c]),i.useEffect(()=>{E.current=f},[f]);const w=i.useRef({birdY:0,birdVel:0,pipes:[],frameCount:0}),G=i.useCallback(e=>{const n=e.height-M,a=N,l=n-N-A;return a+Math.random()*Math.max(0,l-a)},[]),T=i.useCallback(()=>{const e=t.current;e&&(w.current={birdY:e.height/2,birdVel:0,pipes:[{x:e.width+60,gapY:G(e),passed:!1}],frameCount:0},u.current=0,h(0))},[G]),P=i.useCallback(()=>{var e;if((e=r.current)==null||e.focus(),E.current!=="playing"){T(),d("playing");return}w.current.birdVel=j},[T]);return i.useEffect(()=>{const e=a=>{const l=a.target;l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.isContentEditable||(a.code==="Space"||a.code==="ArrowUp")&&(a.preventDefault(),P())},n=r.current;if(n)return n.addEventListener("keydown",e),()=>n.removeEventListener("keydown",e)},[P]),i.useLayoutEffect(()=>{const e=t.current;if(!e)return;const n=()=>{const l=e.parentElement;if(l&&l.clientWidth>0&&l.clientHeight>0){e.width=l.clientWidth,e.height=l.clientHeight,m.current=F(e);const S=e.getContext("2d");E.current!=="playing"&&(w.current.birdY=e.height/2,S&&V(e,S,E.current,u.current,g.current,m.current)),k(Y=>!Y)}};n();const a=new ResizeObserver(n);return a.observe(e.parentElement),()=>a.disconnect()},[]),i.useEffect(()=>{if(f!=="playing")return;const e=t.current,n=e==null?void 0:e.getContext("2d");if(!e||!n)return;let a;const l=e.height-M,S=()=>{u.current>g.current&&(g.current=u.current,H(u.current)),d("gameover")},Y=()=>{const o=w.current;n.clearRect(0,0,e.width,e.height),o.birdVel+=L,o.birdY+=o.birdVel,o.pipes=o.pipes.filter(s=>s.x>-b),o.pipes.forEach(s=>s.x-=U);const D=o.pipes[o.pipes.length-1];if((!D||D.x<e.width-z)&&o.pipes.push({x:e.width,gapY:G(e),passed:!1}),o.birdY-p<=0||o.birdY+p>=l){S();return}for(const s of o.pipes){if(C+p>s.x&&C-p<s.x+b&&(o.birdY-p<s.gapY||o.birdY+p>s.gapY+A)){S();return}!s.passed&&s.x+b<C&&(s.passed=!0,u.current+=1,h(u.current))}n.fillStyle=R.pipe;for(const s of o.pipes)n.fillRect(s.x,0,b,s.gapY),n.fillRect(s.x,s.gapY+A,b,l-(s.gapY+A));n.fillStyle=R.ground,n.fillRect(0,l,e.width,2),B(n,o.birdY,o.birdVel,m.current),_(e,n,u.current,g.current,m.current),o.frameCount++,a=requestAnimationFrame(Y)};return a=requestAnimationFrame(Y),()=>cancelAnimationFrame(a)},[f]),i.useEffect(()=>{if(f==="playing")return;const e=t.current,n=e==null?void 0:e.getContext("2d");!e||!n||V(e,n,f,y,c,m.current)},[f,y,c]),x.jsx("div",{ref:r,tabIndex:0,className:"relative h-full w-full cursor-pointer select-none overflow-hidden outline-none",onClick:P,onTouchStart:P,role:"application","aria-label":"Flappy bird game. Press space or tap to flap.",children:x.jsx("canvas",{ref:t,className:"h-full w-full"})})}const Q=O({...v,component:X});export{Q as flappyBirdFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./react-qoZPGuNy.js";import{f as c,
|
|
1
|
+
import{j as s}from"./react-qoZPGuNy.js";import{f as c,H as r,I as o,h as i}from"./index-DNLPQoS7.js";import{d as m,e as d,f}from"./format-CfAcS4D8.js";import{F as n,s as u}from"./ui-Bq3RQsdJ.js";r.schema;function x(a){return a.unit==="USD/shares"?m(a.value):a.unit==="shares"?d(a.value):f(a.value)}function h({config:a}){const{data:t,isLoading:l}=o(a.symbol);return l?s.jsx(n,{loading:!0,children:"loading SEC financials…"}):!t||t.metrics.length===0?s.jsxs(n,{children:["no SEC financials for “",i(a.symbol),"”"]}):s.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"body-sm text-strong truncate font-semibold",children:t.entityName||i(a.symbol)}),s.jsx("div",{className:"caption text-soft truncate",children:"SEC EDGAR · XBRL company facts"})]}),s.jsx("div",{className:"caption text-soft shrink-0 text-right",children:"on filing"})]}),s.jsx("div",{className:`grid grid-cols-2 content-start gap-2 ${u}`,children:t.metrics.map(e=>s.jsxs("div",{className:"rounded bg-white/[0.04] px-3 py-2",children:[s.jsx("div",{className:"caption text-soft truncate",children:e.label}),s.jsx("div",{className:"metric-sm text-strong",children:x(e)}),s.jsx("div",{className:"caption text-soft truncate",children:e.fiscalPeriod})]},e.label))})]})}const N=c({...r,component:h});export{N as fundamentalsFrame};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{R as k,r as c,j as i}from"./react-qoZPGuNy.js";import{f as L,S as N,U as X,h as Y}from"./index-DNLPQoS7.js";import{h as q}from"./format-CfAcS4D8.js";import{F as D}from"./ui-Bq3RQsdJ.js";import{c as B}from"./utils-DaT-yT0k.js";const z="4px",G=6,P=80,K=24;function J({data:u,className:_,CellComponent:R,getColorValue:g,gap:x=G,showLabels:l=!1,rowLabelWidth:p=P,columnLabelHeight:b=K}){const j=c.useRef(null),[,M]=c.useTransition(),[m,w]=c.useState({width:0,height:0});c.useEffect(()=>{const t=j.current;if(t){const e=new ResizeObserver(()=>{M(()=>{w({width:t.offsetWidth,height:t.offsetHeight})})});return e.observe(t),()=>{e.disconnect()}}},[]);const{uniqueRows:v,uniqueColumns:I,rowToIndex:C,columnToIndex:E}=c.useMemo(()=>{const t=new Set,e=new Set,n=[],r=[];for(const s of u)t.has(s.row)||(t.add(s.row),n.push(s.row)),e.has(s.column)||(e.add(s.column),r.push(s.column));const a=new Map(n.map((s,f)=>[s,f])),d=new Map(r.map((s,f)=>[s,f]));return{uniqueRows:n,uniqueColumns:r,rowToIndex:a,columnToIndex:d}},[u]),h=c.useMemo(()=>{const t=l?p:0,e=l?b:0;return{x:t,y:e,width:Math.max(0,m.width-t),height:Math.max(0,m.height-e)}},[m,l,p,b]),y=c.useMemo(()=>{const t=I.length,e=v.length,n=t>0?Math.max(0,(h.width-x*(t-1))/t):0,r=e>0?Math.max(0,(h.height-x*(e-1))/e):0;return{cellWidth:n,cellHeight:r,columnX:s=>s*(n+x),rowY:s=>s*(r+x)}},[v.length,I.length,h,x]),S=c.useMemo(()=>{const t=u.map(o=>g?g(o):o.value),e=t.filter(o=>o>=0),n=t.filter(o=>o<0),r=e.length>0?Math.min(...e):0,a=e.length>0?Math.max(...e):0,d=n.length>0?Math.min(...n):0,s=n.length>0?Math.max(...n):0,f=o=>o<0?s===d?1:(o-s)/(d-s):a===r?1:(o-r)/(a-r);return u.map(o=>{const T=g?g(o):o.value,$=f(T),W=T>=0;return{cell:o,colorValue:T,intensity:$,isPositive:W}})},[u,g]),F=(t,e)=>{if(e){const a=Math.round(34+t*16);return`hsl(152 ${Math.round(42+t*20)}% ${a}%)`}const n=Math.round(36+t*15);return`hsl(350 ${Math.round(48+t*22)}% ${n}%)`},A=c.useMemo(()=>{const{cellWidth:t,cellHeight:e,columnX:n,rowY:r}=y;return t<=0||e<=0?null:S.map(({cell:a,intensity:d,isPositive:s})=>{const f=C.get(a.row),o=E.get(a.column);if(f===void 0||o===void 0)return null;const T=F(d,s);return i.jsx("div",{className:"group absolute cursor-pointer border border-transparent hover:bg-[radial-gradient(146.13%_118.42%_at_50%_-15.5%,rgba(255,255,255,0.1)_0%,rgba(255,255,255,0)_99.59%)] hover:bg-gradient-to-t",style:{left:h.x+n(o),top:h.y+r(f),width:t,height:e,borderRadius:z,backgroundColor:T},children:i.jsx(R,{width:t,height:e,data:a,rowIndex:f,columnIndex:o,colorIntensity:d,isPositive:s})},a.id)})},[S,y,h,C,E,R]),O=c.useMemo(()=>{if(!l)return null;const{cellHeight:t,rowY:e}=y;return v.map((n,r)=>i.jsx("div",{className:"absolute flex items-center justify-end pr-2 text-xs text-white/60",style:{left:0,top:h.y+e(r),width:p,height:t},children:i.jsx("span",{className:"truncate",children:n})},`row-${n}`))},[l,v,y,h,p]),U=c.useMemo(()=>{if(!l)return null;const{cellWidth:t,columnX:e}=y;return I.map((n,r)=>i.jsx("div",{className:"absolute flex items-end justify-center pb-1 text-xs text-white/60",style:{left:h.x+e(r),top:0,width:t,height:b},children:i.jsx("span",{className:"truncate",children:n})},`col-${n}`))},[l,I,y,h,b]);return i.jsx("div",{className:B("h-full w-full",_),ref:j,children:i.jsxs("div",{className:"relative overflow-hidden",style:{height:m.height,width:m.width},children:[O,U,A]})})}const Q=k.memo(J);N.schema;const H=1440*60*1e3,Z=10080*60*1e3;function V({data:u,width:_}){return _<44?null:i.jsx("div",{className:"flex h-full w-full items-center justify-center",children:i.jsx("span",{className:"caption text-normal tabular-nums",children:q(u.rate*100)})})}function tt({config:u}){const _=c.useMemo(()=>Date.now()-Z,[]),{history:R,isLoading:g}=X(u.symbols,_),x=c.useMemo(()=>{const l=[];for(const p of u.symbols){const b=R[p]??[],j=new Map;for(const M of b){const m=Math.floor(M.time/H)*H,w=j.get(m)??{sum:0,n:0};w.sum+=M.fundingRate,w.n+=1,j.set(m,w)}for(const[M,{sum:m,n:w}]of j){const v=m/w,C=new Date(M).toLocaleDateString("en-US",{month:"short",day:"numeric"});l.push({id:`${p}-${M}`,row:Y(p),column:C,value:v*1e4,rate:v})}}return l},[R,u.symbols]);return g?i.jsx(D,{loading:!0,children:"loading funding…"}):x.length===0?i.jsx(D,{children:"no funding data"}):i.jsx(Q,{data:x,CellComponent:V,gap:3,showLabels:!0,rowLabelWidth:48,columnLabelHeight:20})}const ct=L({...N,component:tt});export{ct as fundingHeatmapFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as a}from"./react-qoZPGuNy.js";import{f as l,
|
|
1
|
+
import{r as o,j as a}from"./react-qoZPGuNy.js";import{f as l,V as d,U as C,h as M}from"./index-DNLPQoS7.js";import{h as R}from"./format-CfAcS4D8.js";import{F as f}from"./ui-Bq3RQsdJ.js";import{a as r,C as u}from"./chart-utils-BYIZMM9J.js";import{M as S}from"./index-DK7jWlTL.js";import"./d3-xK4fOkBU.js";import"./utils-DaT-yT0k.js";const x={"24h":{ms:1440*60*1e3,timeframe:r["24h"]},"7D":{ms:10080*60*1e3,timeframe:r["7D"]},"1M":{ms:720*60*60*1e3,timeframe:r["1M"]}};d.schema;function F({config:e}){const{ms:s,timeframe:h}=x[e.lookback],c=o.useMemo(()=>Date.now()-s,[s]),{history:m,isLoading:p}=C(e.symbols,c),i=o.useMemo(()=>e.symbols.map((t,g)=>({id:t,name:M(t),color:u[g%u.length],data:(m[t]??[]).map(n=>({date:new Date(n.time).toISOString(),value:n.fundingRate*100}))})),[e.symbols,m]);return p?a.jsx(f,{loading:!0,children:"loading funding rates…"}):i.every(t=>t.data.length===0)?a.jsx(f,{children:"no funding data yet"}):a.jsx(S,{series:i,timeframe:h,height:250,formatValue:R})}const I=l({...d,component:F});export{I as fundingRateChartFrame};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./react-qoZPGuNy.js";import{c as x,i as p,a as f}from"./format-CfAcS4D8.js";import{f as b,ad as d,ae as j}from"./index-DNLPQoS7.js";import{F as c}from"./ui-Bq3RQsdJ.js";import{M as u}from"./mini-line-chart-CHM5UBjJ.js";import"./d3-xK4fOkBU.js";import"./utils-DaT-yT0k.js";d.schema;function g({config:a}){var n,o;const{rates:t,isLoading:h}=j(a.base,a.symbols);if(h)return e.jsx(c,{loading:!0,children:"loading FX rates…"});if(!t.length)return e.jsx(c,{children:"no FX data yet"});const r=(o=(n=t[0])==null?void 0:n.history.at(-1))==null?void 0:o.time;return e.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"caption text-soft uppercase",children:"FX rates"}),e.jsxs("div",{className:"body-sm text-normal",children:["1 ",a.base.toUpperCase()," buys"]})]}),e.jsx("div",{className:"caption text-soft text-right",children:r?new Date(r).toLocaleDateString("en-US",{month:"short",day:"numeric"}):"ECB daily"})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:t.map(s=>{const i=x(s.changePct),l=s.history.map(m=>({date:new Date(m.time).toISOString(),value:m.value}));return e.jsxs("div",{className:"flex items-center gap-3 border-b border-white/[0.06] py-1.5 last:border-b-0",children:[e.jsx("span",{className:"body-sm w-9 font-bold text-strong",children:s.symbol}),e.jsx("div",{className:"flex-1"}),a.showSparkline&&l.length>1&&e.jsx(u,{data:l,width:72,height:20,color:i}),e.jsxs("span",{className:"whitespace-nowrap text-right tabular-nums",children:[e.jsx("span",{className:"body-sm text-strong",children:p(s.rate)}),e.jsx("span",{className:"caption ml-2 font-bold",style:{color:i},children:f(s.changePct)})]})]},s.symbol)})})]})}const B=b({...d,component:g});export{B as fxBoardFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./react-qoZPGuNy.js";import{f as l,
|
|
1
|
+
import{j as e}from"./react-qoZPGuNy.js";import{f as l,W as s}from"./index-DNLPQoS7.js";s.schema;function n({config:a}){return e.jsxs("div",{className:"flex h-full w-full items-end gap-3 pb-2",children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-[5px] w-[5px] shrink-0 rounded-full",style:{background:"var(--color-highlight)",boxShadow:"0 0 8px var(--color-highlight)"}}),e.jsx("h2",{className:"body-md text-strong font-extrabold uppercase leading-none tracking-[0.14em]",children:a.title})]}),a.subtitle&&e.jsx("p",{className:"caption text-soft pl-[13px] leading-none",children:a.subtitle})]}),e.jsx("span",{className:"mb-[5px] h-px flex-1",style:{background:"linear-gradient(90deg, rgba(255,255,255,0.16), rgba(255,255,255,0.02) 65%, transparent)"}})]})}const i=l({...s,component:n});export{i as headingFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as n}from"./react-qoZPGuNy.js";import{E as d,a as u,n as h}from"./market-data-CvmpLFSo.js";import{M as f}from"./metric-row-BVVhjsjK.js";import{f as x,
|
|
1
|
+
import{j as n}from"./react-qoZPGuNy.js";import{E as d,a as u,n as h}from"./market-data-CvmpLFSo.js";import{M as f}from"./metric-row-BVVhjsjK.js";import{f as x,b7 as m}from"./index-DNLPQoS7.js";import{F as i,s as p}from"./ui-Bq3RQsdJ.js";m.schema;function y(e,o){const[t,a,s]=e.split("-").map(Number),[l,r,c]=o.split("-").map(Number);return Math.round((Date.UTC(l,r-1,c)-Date.UTC(t,a-1,s))/864e5)}function b(e){const[o,t,a]=e.split("-").map(Number);return new Date(Date.UTC(o,t-1,a)).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric",timeZone:"UTC"})}function C(e){return e<=0?"today":e===1?"tomorrow":`in ${e}d`}function j({config:e}){var l;if(!d[e.exchange])return n.jsx(i,{children:"unknown exchange"});const t=(l=u(e.exchange))==null?void 0:l.ymd,a=h(e.exchange,e.count),s=e.label.trim();return!t||a.length===0?n.jsx(i,{children:"no upcoming holidays on file"}):n.jsxs("div",{className:"flex h-full w-full flex-col",children:[s&&n.jsx("div",{className:"caption text-soft mb-1 shrink-0 uppercase tracking-[0.12em]",children:s}),n.jsx("div",{className:`min-h-0 flex-1 ${p}`,children:a.map(r=>n.jsx(f,{label:b(r),value:C(y(t,r))},r))})]})}const k=x({...m,component:j});export{k as holidayCalendarFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,j as e}from"./react-qoZPGuNy.js";import{f as l,
|
|
1
|
+
import{r as s,j as e}from"./react-qoZPGuNy.js";import{f as l,X as o}from"./index-DNLPQoS7.js";import{F as i}from"./ui-Bq3RQsdJ.js";o.schema;function n({config:a}){const[t,r]=s.useState("loading");return s.useEffect(()=>r("loading"),[a.url]),t==="error"?e.jsx(i,{children:"image unavailable"}):e.jsxs("div",{className:"relative flex h-full w-full items-center justify-center overflow-hidden rounded-md",children:[t==="loading"&&e.jsx("div",{className:"absolute inset-0 z-10",children:e.jsx(i,{loading:!0,children:"loading image…"})}),e.jsx("img",{src:a.url,alt:a.alt,className:`h-full w-full transition-opacity duration-300 ${t==="loaded"?"opacity-100":"opacity-0"}`,style:{objectFit:a.fit},onLoad:()=>r("loaded"),onError:()=>r("error")})]})}const c=l({...o,component:n});export{c as imageFrame};
|