zframes 0.5.3 → 0.6.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.
Files changed (123) hide show
  1. package/dist/index.js +608 -9
  2. package/package.json +4 -4
  3. package/runtime/assets/{bitcoin-dominance-CxfMBVwW.js → bitcoin-dominance-CweHlZx7.js} +1 -1
  4. package/runtime/assets/{breakeven-BrpmE2y2.js → breakeven-CG9rKwgE.js} +1 -1
  5. package/runtime/assets/{breathing-Bjv7D86F.js → breathing-cDundHq6.js} +1 -1
  6. package/runtime/assets/{btc-blocks-Cy-YFeqC.js → btc-blocks-Do_nySHd.js} +1 -1
  7. package/runtime/assets/{btc-difficulty-CQ_30M6B.js → btc-difficulty-vNbz5uRo.js} +1 -1
  8. package/runtime/assets/{btc-fees-DsYgskwn.js → btc-fees-BmADLsmK.js} +1 -1
  9. package/runtime/assets/{btc-hashrate-C0dYT_WJ.js → btc-hashrate-Wx2RAG-5.js} +1 -1
  10. package/runtime/assets/{btc-mempool-DipekM7O.js → btc-mempool-CTwbkMUR.js} +1 -1
  11. package/runtime/assets/{calculator-zC8onHXp.js → calculator-mvv6XpQC.js} +1 -1
  12. package/runtime/assets/{checklist-baxMKxEm.js → checklist-CuEw3GpE.js} +1 -1
  13. package/runtime/assets/{clock-x9v1tYQm.js → clock-Cjnwi03W.js} +1 -1
  14. package/runtime/assets/{coin-movers-fIxzBuhy.js → coin-movers-Bcx1XR0F.js} +1 -1
  15. package/runtime/assets/{countdown-BlyeM771.js → countdown-Cdi5gSSu.js} +1 -1
  16. package/runtime/assets/cycle-shared-BOGcJDzT.js +1 -0
  17. package/runtime/assets/cycle-signals-CS629ZDc.js +1 -0
  18. package/runtime/assets/{daily-analysis-DxjxE53t.js → daily-analysis-DX8bVq85.js} +1 -1
  19. package/runtime/assets/{day-meter-9YEIbKbk.js → day-meter-DDfTuhms.js} +1 -1
  20. package/runtime/assets/defi-revenue-CpeAGwhb.js +1 -0
  21. package/runtime/assets/{dex-volume-chart-CIN2oKpJ.js → dex-volume-chart-sHIuJACJ.js} +1 -1
  22. package/runtime/assets/{dex-volume-treemap-CqHdMsnd.js → dex-volume-treemap-rSTrzz7O.js} +1 -1
  23. package/runtime/assets/{dice-DnddcY-J.js → dice-BrFORdjN.js} +1 -1
  24. package/runtime/assets/{dino-game-D6AH1SSj.js → dino-game-BOV8mV1d.js} +1 -1
  25. package/runtime/assets/{divider-Bu8aGlm1.js → divider-C33tH1RU.js} +1 -1
  26. package/runtime/assets/{drawdy-BhOQeakE.js → drawdy-BIb36JN9.js} +1 -1
  27. package/runtime/assets/dxy-CRifEdp_.js +1 -0
  28. package/runtime/assets/editor-CZoWRTJC.css +1 -0
  29. package/runtime/assets/editor-Dnp1eXvY.js +68 -0
  30. package/runtime/assets/etf-flows-BV10E2R-.js +1 -0
  31. package/runtime/assets/etf-flows-chart-DHu8mkXm.js +1 -0
  32. package/runtime/assets/eth-staking-BqWeJq6F.js +1 -0
  33. package/runtime/assets/eth-supply-CF-MgHjn.js +1 -0
  34. package/runtime/assets/{fear-greed-i87oWLnT.js → fear-greed-DuDR56h2.js} +1 -1
  35. package/runtime/assets/{filings-feed-Cxg9eG9S.js → filings-feed-BpfO2yF6.js} +1 -1
  36. package/runtime/assets/{financial-stress-Bv_reW65.js → financial-stress-BfYJdlry.js} +1 -1
  37. package/runtime/assets/{flappy-bird-BENHBDEL.js → flappy-bird-Dbb2UQBv.js} +1 -1
  38. package/runtime/assets/{fundamentals-AlhngJ8G.js → fundamentals-CUnqjF--.js} +1 -1
  39. package/runtime/assets/funding-comparison-CMKxW1n-.js +1 -0
  40. package/runtime/assets/{funding-heatmap-B4RGXX4K.js → funding-heatmap-CZWnYF8Y.js} +1 -1
  41. package/runtime/assets/{funding-rate-chart-Cg6gi0YC.js → funding-rate-chart-C-tpwid_.js} +1 -1
  42. package/runtime/assets/{fx-board-BqGsP0Xx.js → fx-board-YAy44m5d.js} +1 -1
  43. package/runtime/assets/{heading-Dr7Q6vy_.js → heading-uIVBEE7K.js} +1 -1
  44. package/runtime/assets/{holiday-calendar-C1fruUVL.js → holiday-calendar-DCj83hi2.js} +1 -1
  45. package/runtime/assets/{image-BulRsYTV.js → image-CITPAmp0.js} +1 -1
  46. package/runtime/assets/index-Bx7RmzY8.js +1 -0
  47. package/runtime/assets/index-CrmTiZaB.css +1 -0
  48. package/runtime/assets/index-DyvZokhk.js +1097 -0
  49. package/runtime/assets/indicators-CogwjDn9.js +1 -0
  50. package/runtime/assets/{inflation-pulse-Q-3bZn55.js → inflation-pulse-Bqa3-cuC.js} +1 -1
  51. package/runtime/assets/{journal-log-FuAPC6JH.js → journal-log-Bgjia8cQ.js} +1 -1
  52. package/runtime/assets/{journal-open-BREaG6Cs.js → journal-open-Bm5gwWXz.js} +1 -1
  53. package/runtime/assets/{journal-results-Y_pKQcgg.js → journal-results-cEWe2pbe.js} +1 -1
  54. package/runtime/assets/{journal-score-ZATtCKrj.js → journal-score-vmfF-9bK.js} +1 -1
  55. package/runtime/assets/{journal-ui-C_1ADbUX.js → journal-ui-ApBNIq5_.js} +1 -1
  56. package/runtime/assets/{labor-market-DVybIeSN.js → labor-market-azDXD-dR.js} +1 -1
  57. package/runtime/assets/{lightning-stats-ByvWkKyP.js → lightning-stats-nkyh2dOX.js} +1 -1
  58. package/runtime/assets/{link-grid-CJC48i5r.js → link-grid-BEo4b54T.js} +1 -1
  59. package/runtime/assets/ma-multiplier-BllDQMF5.js +1 -0
  60. package/runtime/assets/macro-calendar-Ck0dJk4p.js +1 -0
  61. package/runtime/assets/{market-cap-treemap-CpnOP_gY.js → market-cap-treemap-AxE2EYPO.js} +1 -1
  62. package/runtime/assets/{market-hours-B9zPCvQk.js → market-hours-BSwXtU8c.js} +1 -1
  63. package/runtime/assets/{marquee-D8GTgVmy.js → marquee-1Zr5qDJP.js} +1 -1
  64. package/runtime/assets/mayer-multiple-DpBJNd4d.js +1 -0
  65. package/runtime/assets/{mining-pools-DiyEBr6a.js → mining-pools-B-jxdTot.js} +1 -1
  66. package/runtime/assets/{mover-row-CO2STKkw.js → mover-row-Dg96EIqq.js} +1 -1
  67. package/runtime/assets/mvrv-Dx_S0TwE.js +1 -0
  68. package/runtime/assets/{national-debt-CcTydivP.js → national-debt-BKVBHaqm.js} +1 -1
  69. package/runtime/assets/{news-feed-D4xS-sLD.js → news-feed-C9itZmyp.js} +1 -1
  70. package/runtime/assets/{note-BXsj5NlE.js → note-BtCnmuMo.js} +1 -1
  71. package/runtime/assets/nupl-aIjkc57m.js +1 -0
  72. package/runtime/assets/{open-interest-DaFRJd2O.js → open-interest-C0ulogv6.js} +1 -1
  73. package/runtime/assets/{options-iv-MpSqgS3E.js → options-iv-CdUder3x.js} +1 -1
  74. package/runtime/assets/{options-oi-strike-BHF28ASR.js → options-oi-strike-CvCZnMCR.js} +1 -1
  75. package/runtime/assets/{options-put-call-_ZFaepBW.js → options-put-call-FuaDHJ-S.js} +1 -1
  76. package/runtime/assets/pi-cycle-BuCnLnIJ.js +1 -0
  77. package/runtime/assets/{pomodoro-CxHVmgqp.js → pomodoro-DDBVVcSR.js} +1 -1
  78. package/runtime/assets/{portfolio-allocation-Cf251dcH.js → portfolio-allocation-DAnQk_h_.js} +1 -1
  79. package/runtime/assets/{portfolio-common-DnESc3oR.js → portfolio-common-Bi16i0aA.js} +1 -1
  80. package/runtime/assets/{portfolio-holdings-2vYKEk7f.js → portfolio-holdings-MyAinCzt.js} +1 -1
  81. package/runtime/assets/{portfolio-value-B-7uIpG4.js → portfolio-value-BPURwKf8.js} +1 -1
  82. package/runtime/assets/prediction-markets-Bzy51qnV.js +1 -0
  83. package/runtime/assets/{price-chart-Cx_2scgb.js → price-chart-BOCD8ka3.js} +1 -1
  84. package/runtime/assets/{price-compare-DQcEOpnr.js → price-compare-DZlF-qhZ.js} +1 -1
  85. package/runtime/assets/{price-liveline-TTo-aOFd.js → price-liveline-Bl7qCd5-.js} +1 -1
  86. package/runtime/assets/{price-ticker-Cp7yYsNm.js → price-ticker-D2W4T02y.js} +1 -1
  87. package/runtime/assets/{protocol-fees-treemap-D-koQrKr.js → protocol-fees-treemap-DiIt4bfo.js} +1 -1
  88. package/runtime/assets/{protocol-tvl-chart-CDZkrQuF.js → protocol-tvl-chart-CmzANiR7.js} +1 -1
  89. package/runtime/assets/{protocol-tvl-treemap-I8fjLZU7.js → protocol-tvl-treemap-BjNPrrtL.js} +1 -1
  90. package/runtime/assets/puell-multiple-BGrJX43r.js +1 -0
  91. package/runtime/assets/{quote-CKEEp9tF.js → quote-CRM3bfI7.js} +1 -1
  92. package/runtime/assets/{rates-board-BElUHlYN.js → rates-board-Cb9rV0_-.js} +1 -1
  93. package/runtime/assets/realized-price-CYlrFa0m.js +1 -0
  94. package/runtime/assets/reserve-risk-Be98XUsD.js +1 -0
  95. package/runtime/assets/{returns-projector-DjIbvas1.js → returns-projector-D67a_yvC.js} +1 -1
  96. package/runtime/assets/{risk-reward-pVHqmm_g.js → risk-reward-C7WMz2od.js} +1 -1
  97. package/runtime/assets/rsi-momentum-IglnulkJ.js +1 -0
  98. package/runtime/assets/{rules-card-uMZQ6oP0.js → rules-card-DJs3fDVN.js} +1 -1
  99. package/runtime/assets/sector-performance-DVMaleLY.js +1 -0
  100. package/runtime/assets/sector-treemap-B681nSi6.js +1 -0
  101. package/runtime/assets/{session-progress-Djhvb1G5.js → session-progress-CZO3LqUi.js} +1 -1
  102. package/runtime/assets/{short-volume-CiBfmCKw.js → short-volume-l8_9Yoh3.js} +1 -1
  103. package/runtime/assets/{snake-CYXVjy8d.js → snake-CifbTGlZ.js} +1 -1
  104. package/runtime/assets/sopr-Dw_oz-mC.js +1 -0
  105. package/runtime/assets/{spotify-embed-CGYKFOmX.js → spotify-embed-BA0m1IRb.js} +1 -1
  106. package/runtime/assets/stablecoin-chains-Dd2LqqqY.js +1 -0
  107. package/runtime/assets/stablecoin-supply-DM4ogL4V.js +1 -0
  108. package/runtime/assets/{stopwatch-Cl10sfaX.js → stopwatch-Co72v-7u.js} +1 -1
  109. package/runtime/assets/{top-movers-vvOomk6S.js → top-movers-CLmC2TNu.js} +1 -1
  110. package/runtime/assets/{treasury-auctions-JMoATy9T.js → treasury-auctions-Dl9fiRgf.js} +1 -1
  111. package/runtime/assets/{treemap-leaf-DNIoJEK-.js → treemap-leaf-Dn31k9S9.js} +1 -1
  112. package/runtime/assets/trending-coins-Cpx9T6cG.js +1 -0
  113. package/runtime/assets/{tvl-treemap-B28_19EZ.js → tvl-treemap-e610jE8k.js} +1 -1
  114. package/runtime/assets/{video-DjiOnvMm.js → video-CeKjM-cE.js} +1 -1
  115. package/runtime/assets/volume-profile-CiMFsIBu.js +1 -0
  116. package/runtime/assets/{yield-curve-Dj5vJwI4.js → yield-curve-DkB0u2_Q.js} +1 -1
  117. package/runtime/assets/yield-scanner-BP90untT.js +1 -0
  118. package/runtime/index.html +2 -2
  119. package/runtime/assets/editor-BMMobjrE.css +0 -1
  120. package/runtime/assets/editor-Ca-voh3h.js +0 -68
  121. package/runtime/assets/index-BgSQpj_B.js +0 -936
  122. package/runtime/assets/index-BqHx9BjX.css +0 -1
  123. package/runtime/assets/index-DK7jWlTL.js +0 -1
@@ -1,68 +0,0 @@
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-BgSQpj_B.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="&times;",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};